diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cca78afa..1dad215f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,7 +40,7 @@ jobs: name: Build Firmware runs-on: ubuntu-latest container: - image: espressif/idf:v5.5.1 + image: espressif/idf:v5.5.3 steps: - uses: actions/checkout@v4 diff --git a/.gitignore b/.gitignore index db1025dd..4985256c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,7 @@ +# ESP-IDF auto generated by build +sdkconfig +sdkconfig.old + # compiled output /build/ **/build/ @@ -1050,3 +1054,6 @@ dependencies.lock !components/Applications/ !components/Applications/** + +# Claude Code +CLAUDE.md diff --git a/LICENSE b/LICENSE index 9fea8cdc..f288702d 100644 --- a/LICENSE +++ b/LICENSE @@ -1,190 +1,674 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - Copyright (c) 2025-2026 HIGHCODE LLC - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/README.md b/README.md index 8ff7988c..cd610862 100644 --- a/README.md +++ b/README.md @@ -96,4 +96,4 @@ Special thanks to the partners supporting this project: ## License -This project is licensed under the **Apache License, Version 2.0**. See the [LICENSE](LICENSE) file for details. +This project is licensed under the **GNU General Public License v3.0**. See the [LICENSE](LICENSE) file for details. diff --git a/README.pt.md b/README.pt.md index d8af9075..f0b46d84 100644 --- a/README.pt.md +++ b/README.pt.md @@ -102,4 +102,4 @@ Agradecemos especialmente aos parceiros que apoiam este projeto: --- ## Licença -Este projeto está licenciado sob a **Apache License, Version 2.0**. Veja o arquivo [LICENSE](LICENSE) para mais detalhes. +Este projeto está licenciado sob a **GNU General Public License v3.0**. Veja o arquivo [LICENSE](LICENSE) para mais detalhes. diff --git a/firmware_c5/CMakeLists.txt b/firmware_c5/CMakeLists.txt index 747bed0b..ab4f8248 100644 --- a/firmware_c5/CMakeLists.txt +++ b/firmware_c5/CMakeLists.txt @@ -6,6 +6,7 @@ cmake_minimum_required(VERSION 3.16) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) +set(IDF_TARGET "esp32c5") include($ENV{IDF_PATH}/tools/cmake/project.cmake) diff --git a/firmware_c5/components/Applications/CMakeLists.txt b/firmware_c5/components/Applications/CMakeLists.txt index 93fde518..6a48cbfe 100644 --- a/firmware_c5/components/Applications/CMakeLists.txt +++ b/firmware_c5/components/Applications/CMakeLists.txt @@ -1,16 +1,17 @@ # Copyright (c) 2025 HIGH CODE LLC # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# TentacleOS is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# http://www.apache.org/licenses/LICENSE-2.0 +# TentacleOS is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# You should have received a copy of the GNU General Public License +# along with TentacleOS. If not, see . #APPLICATION diff --git a/firmware_c5/components/Applications/bluetooth/android_spam.c b/firmware_c5/components/Applications/bluetooth/android_spam.c index ae6b8b96..d2223e32 100644 --- a/firmware_c5/components/Applications/bluetooth/android_spam.c +++ b/firmware_c5/components/Applications/bluetooth/android_spam.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "android_spam.h" diff --git a/firmware_c5/components/Applications/bluetooth/apple_juice_spam.c b/firmware_c5/components/Applications/bluetooth/apple_juice_spam.c index 07135c57..9b073e6d 100644 --- a/firmware_c5/components/Applications/bluetooth/apple_juice_spam.c +++ b/firmware_c5/components/Applications/bluetooth/apple_juice_spam.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "apple_juice_spam.h" diff --git a/firmware_c5/components/Applications/bluetooth/ble_connect_flood.c b/firmware_c5/components/Applications/bluetooth/ble_connect_flood.c index 2e2fd87e..c1d47e70 100644 --- a/firmware_c5/components/Applications/bluetooth/ble_connect_flood.c +++ b/firmware_c5/components/Applications/bluetooth/ble_connect_flood.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "ble_connect_flood.h" diff --git a/firmware_c5/components/Applications/bluetooth/ble_hid_keyboard.c b/firmware_c5/components/Applications/bluetooth/ble_hid_keyboard.c index 4b906e6f..34ecb1fc 100644 --- a/firmware_c5/components/Applications/bluetooth/ble_hid_keyboard.c +++ b/firmware_c5/components/Applications/bluetooth/ble_hid_keyboard.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "ble_hid_keyboard.h" diff --git a/firmware_c5/components/Applications/bluetooth/ble_l2cap_flood.c b/firmware_c5/components/Applications/bluetooth/ble_l2cap_flood.c index d73a40e7..e6882e3a 100644 --- a/firmware_c5/components/Applications/bluetooth/ble_l2cap_flood.c +++ b/firmware_c5/components/Applications/bluetooth/ble_l2cap_flood.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "ble_l2cap_flood.h" diff --git a/firmware_c5/components/Applications/bluetooth/ble_scanner.c b/firmware_c5/components/Applications/bluetooth/ble_scanner.c index df087c7d..c6ed9667 100644 --- a/firmware_c5/components/Applications/bluetooth/ble_scanner.c +++ b/firmware_c5/components/Applications/bluetooth/ble_scanner.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "ble_scanner.h" diff --git a/firmware_c5/components/Applications/bluetooth/ble_screen_server.c b/firmware_c5/components/Applications/bluetooth/ble_screen_server.c index fa60c034..cfdbbdfc 100644 --- a/firmware_c5/components/Applications/bluetooth/ble_screen_server.c +++ b/firmware_c5/components/Applications/bluetooth/ble_screen_server.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "ble_screen_server.h" diff --git a/firmware_c5/components/Applications/bluetooth/ble_sniffer.c b/firmware_c5/components/Applications/bluetooth/ble_sniffer.c index 9071f9cb..4ede1b6d 100644 --- a/firmware_c5/components/Applications/bluetooth/ble_sniffer.c +++ b/firmware_c5/components/Applications/bluetooth/ble_sniffer.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "ble_sniffer.h" @@ -24,6 +25,7 @@ #include "freertos/task.h" #include "bluetooth_service.h" +#include "session_manager.h" #include "spi_bridge.h" static const char *TAG = "BLE_SNIFFER"; @@ -45,6 +47,7 @@ static TaskHandle_t s_sniffer_task_handle = NULL; static StackType_t *s_sniffer_task_stack = NULL; static StaticTask_t *s_sniffer_task_tcb = NULL; static uint8_t *s_sniffer_queue_storage = NULL; +static uint32_t s_session_id = SPI_SESSION_INVALID_ID; static StaticQueue_t *s_sniffer_queue_struct = NULL; static void sniffer_task(void *pvParameters); @@ -119,7 +122,18 @@ esp_err_t ble_sniffer_start(void) { return bluetooth_service_start_sniffer(packet_handler); } +void ble_sniffer_bind_session(uint32_t session_id) { + s_session_id = session_id; +} + +void ble_sniffer_session_killed(spi_id_t op_id) { + (void)op_id; + s_session_id = SPI_SESSION_INVALID_ID; + ble_sniffer_stop(); +} + void ble_sniffer_stop(void) { + s_session_id = SPI_SESSION_INVALID_ID; bluetooth_service_stop_sniffer(); if (s_sniffer_task_handle != NULL) { @@ -173,7 +187,11 @@ static void sniffer_task(void *pvParameters) { stream.rssi = (int8_t)packet.rssi; stream.len = packet.len; memcpy(stream.data, packet.data, packet.len); - spi_bridge_stream_push(SPI_ID_BT_APP_SNIFFER, (const uint8_t *)&stream, sizeof(stream)); + if (s_session_id != SPI_SESSION_INVALID_ID) { + session_manager_try_emit(s_session_id, (const uint8_t *)&stream, sizeof(stream)); + } else { + spi_bridge_stream_push(SPI_ID_BT_APP_SNIFFER, (const uint8_t *)&stream, sizeof(stream)); + } } } } diff --git a/firmware_c5/components/Applications/bluetooth/ble_tracker.c b/firmware_c5/components/Applications/bluetooth/ble_tracker.c index 551e9135..8ae50133 100644 --- a/firmware_c5/components/Applications/bluetooth/ble_tracker.c +++ b/firmware_c5/components/Applications/bluetooth/ble_tracker.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "ble_tracker.h" diff --git a/firmware_c5/components/Applications/bluetooth/canned_spam.c b/firmware_c5/components/Applications/bluetooth/canned_spam.c index ba95acdb..478d3dcb 100644 --- a/firmware_c5/components/Applications/bluetooth/canned_spam.c +++ b/firmware_c5/components/Applications/bluetooth/canned_spam.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . // BLE Spam Indices: // 0: AppleJuice (Airpods, Beats, etc) diff --git a/firmware_c5/components/Applications/bluetooth/exposure_notification.c b/firmware_c5/components/Applications/bluetooth/exposure_notification.c index 05c0f039..d6eb5276 100644 --- a/firmware_c5/components/Applications/bluetooth/exposure_notification.c +++ b/firmware_c5/components/Applications/bluetooth/exposure_notification.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "exposure_notification.h" diff --git a/firmware_c5/components/Applications/bluetooth/gatt_explorer.c b/firmware_c5/components/Applications/bluetooth/gatt_explorer.c index 33c33ff3..2df5028d 100644 --- a/firmware_c5/components/Applications/bluetooth/gatt_explorer.c +++ b/firmware_c5/components/Applications/bluetooth/gatt_explorer.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "gatt_explorer.h" diff --git a/firmware_c5/components/Applications/bluetooth/include/android_spam.h b/firmware_c5/components/Applications/bluetooth/include/android_spam.h index f2d3094d..476f04f7 100644 --- a/firmware_c5/components/Applications/bluetooth/include/android_spam.h +++ b/firmware_c5/components/Applications/bluetooth/include/android_spam.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef ANDROID_SPAM_H #define ANDROID_SPAM_H diff --git a/firmware_c5/components/Applications/bluetooth/include/apple_juice_spam.h b/firmware_c5/components/Applications/bluetooth/include/apple_juice_spam.h index 6369d585..c7560239 100644 --- a/firmware_c5/components/Applications/bluetooth/include/apple_juice_spam.h +++ b/firmware_c5/components/Applications/bluetooth/include/apple_juice_spam.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef APPLE_JUICE_SPAM_H #define APPLE_JUICE_SPAM_H diff --git a/firmware_c5/components/Applications/bluetooth/include/ble_connect_flood.h b/firmware_c5/components/Applications/bluetooth/include/ble_connect_flood.h index b0a53001..3a45f851 100644 --- a/firmware_c5/components/Applications/bluetooth/include/ble_connect_flood.h +++ b/firmware_c5/components/Applications/bluetooth/include/ble_connect_flood.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef BLE_CONNECT_FLOOD_H #define BLE_CONNECT_FLOOD_H diff --git a/firmware_c5/components/Applications/bluetooth/include/ble_hid_keyboard.h b/firmware_c5/components/Applications/bluetooth/include/ble_hid_keyboard.h index 891e48fa..5af89ea8 100644 --- a/firmware_c5/components/Applications/bluetooth/include/ble_hid_keyboard.h +++ b/firmware_c5/components/Applications/bluetooth/include/ble_hid_keyboard.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef BLE_HID_KEYBOARD_H #define BLE_HID_KEYBOARD_H diff --git a/firmware_c5/components/Applications/bluetooth/include/ble_l2cap_flood.h b/firmware_c5/components/Applications/bluetooth/include/ble_l2cap_flood.h index d5067eb9..1622a8ee 100644 --- a/firmware_c5/components/Applications/bluetooth/include/ble_l2cap_flood.h +++ b/firmware_c5/components/Applications/bluetooth/include/ble_l2cap_flood.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef BLE_L2CAP_FLOOD_H #define BLE_L2CAP_FLOOD_H diff --git a/firmware_c5/components/Applications/bluetooth/include/ble_scanner.h b/firmware_c5/components/Applications/bluetooth/include/ble_scanner.h index 333acfd0..e962098b 100644 --- a/firmware_c5/components/Applications/bluetooth/include/ble_scanner.h +++ b/firmware_c5/components/Applications/bluetooth/include/ble_scanner.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef BLE_SCANNER_H #define BLE_SCANNER_H diff --git a/firmware_c5/components/Applications/bluetooth/include/ble_screen_server.h b/firmware_c5/components/Applications/bluetooth/include/ble_screen_server.h index 16ae099b..14549470 100644 --- a/firmware_c5/components/Applications/bluetooth/include/ble_screen_server.h +++ b/firmware_c5/components/Applications/bluetooth/include/ble_screen_server.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef BLE_SCREEN_SERVER_H #define BLE_SCREEN_SERVER_H diff --git a/firmware_c5/components/Applications/bluetooth/include/ble_sniffer.h b/firmware_c5/components/Applications/bluetooth/include/ble_sniffer.h index 07dba6be..9b6a5a4f 100644 --- a/firmware_c5/components/Applications/bluetooth/include/ble_sniffer.h +++ b/firmware_c5/components/Applications/bluetooth/include/ble_sniffer.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef BLE_SNIFFER_H #define BLE_SNIFFER_H @@ -19,8 +20,12 @@ extern "C" { #endif +#include + #include "esp_err.h" +#include "spi_protocol.h" + /** * @brief Start the BLE packet sniffer. * @@ -35,6 +40,12 @@ esp_err_t ble_sniffer_start(void); */ void ble_sniffer_stop(void); +/** Bind a session ID to the running sniffer (called by dispatcher). */ +void ble_sniffer_bind_session(uint32_t session_id); + +/** Session-watchdog kill callback. */ +void ble_sniffer_session_killed(spi_id_t op_id); + #ifdef __cplusplus } #endif diff --git a/firmware_c5/components/Applications/bluetooth/include/ble_tracker.h b/firmware_c5/components/Applications/bluetooth/include/ble_tracker.h index 3b07213b..823d4d2b 100644 --- a/firmware_c5/components/Applications/bluetooth/include/ble_tracker.h +++ b/firmware_c5/components/Applications/bluetooth/include/ble_tracker.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef BLE_TRACKER_H #define BLE_TRACKER_H diff --git a/firmware_c5/components/Applications/bluetooth/include/canned_spam.h b/firmware_c5/components/Applications/bluetooth/include/canned_spam.h index f4236263..41d00372 100644 --- a/firmware_c5/components/Applications/bluetooth/include/canned_spam.h +++ b/firmware_c5/components/Applications/bluetooth/include/canned_spam.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef CANNED_SPAM_H #define CANNED_SPAM_H diff --git a/firmware_c5/components/Applications/bluetooth/include/exposure_notification.h b/firmware_c5/components/Applications/bluetooth/include/exposure_notification.h index badfa070..2bc811b7 100644 --- a/firmware_c5/components/Applications/bluetooth/include/exposure_notification.h +++ b/firmware_c5/components/Applications/bluetooth/include/exposure_notification.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef EXPOSURE_NOTIFICATION_H #define EXPOSURE_NOTIFICATION_H diff --git a/firmware_c5/components/Applications/bluetooth/include/gatt_explorer.h b/firmware_c5/components/Applications/bluetooth/include/gatt_explorer.h index f45af2c8..65952f39 100644 --- a/firmware_c5/components/Applications/bluetooth/include/gatt_explorer.h +++ b/firmware_c5/components/Applications/bluetooth/include/gatt_explorer.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef GATT_EXPLORER_H #define GATT_EXPLORER_H diff --git a/firmware_c5/components/Applications/bluetooth/include/oui_lookup.h b/firmware_c5/components/Applications/bluetooth/include/oui_lookup.h index 34c9ab08..005d8aa1 100644 --- a/firmware_c5/components/Applications/bluetooth/include/oui_lookup.h +++ b/firmware_c5/components/Applications/bluetooth/include/oui_lookup.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef OUI_LOOKUP_H #define OUI_LOOKUP_H diff --git a/firmware_c5/components/Applications/bluetooth/include/samsung_spam.h b/firmware_c5/components/Applications/bluetooth/include/samsung_spam.h index 3219d247..f1179b47 100644 --- a/firmware_c5/components/Applications/bluetooth/include/samsung_spam.h +++ b/firmware_c5/components/Applications/bluetooth/include/samsung_spam.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef SAMSUNG_SPAM_H #define SAMSUNG_SPAM_H diff --git a/firmware_c5/components/Applications/bluetooth/include/skimmer_detector.h b/firmware_c5/components/Applications/bluetooth/include/skimmer_detector.h index 05c51cb3..e25a9a53 100644 --- a/firmware_c5/components/Applications/bluetooth/include/skimmer_detector.h +++ b/firmware_c5/components/Applications/bluetooth/include/skimmer_detector.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef SKIMMER_DETECTOR_H #define SKIMMER_DETECTOR_H diff --git a/firmware_c5/components/Applications/bluetooth/include/sour_apple_spam.h b/firmware_c5/components/Applications/bluetooth/include/sour_apple_spam.h index 102c774c..4373e9e4 100644 --- a/firmware_c5/components/Applications/bluetooth/include/sour_apple_spam.h +++ b/firmware_c5/components/Applications/bluetooth/include/sour_apple_spam.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef SOUR_APPLE_SPAM_H #define SOUR_APPLE_SPAM_H diff --git a/firmware_c5/components/Applications/bluetooth/include/swift_pair_spam.h b/firmware_c5/components/Applications/bluetooth/include/swift_pair_spam.h index 032eeffc..63167f5f 100644 --- a/firmware_c5/components/Applications/bluetooth/include/swift_pair_spam.h +++ b/firmware_c5/components/Applications/bluetooth/include/swift_pair_spam.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef SWIFT_PAIR_SPAM_H #define SWIFT_PAIR_SPAM_H diff --git a/firmware_c5/components/Applications/bluetooth/include/tracker_detector.h b/firmware_c5/components/Applications/bluetooth/include/tracker_detector.h index e60880a7..51e41acb 100644 --- a/firmware_c5/components/Applications/bluetooth/include/tracker_detector.h +++ b/firmware_c5/components/Applications/bluetooth/include/tracker_detector.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef TRACKER_DETECTOR_H #define TRACKER_DETECTOR_H diff --git a/firmware_c5/components/Applications/bluetooth/include/tutti_frutti_spam.h b/firmware_c5/components/Applications/bluetooth/include/tutti_frutti_spam.h index a7d3135d..24ce284d 100644 --- a/firmware_c5/components/Applications/bluetooth/include/tutti_frutti_spam.h +++ b/firmware_c5/components/Applications/bluetooth/include/tutti_frutti_spam.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef TUTTI_FRUTTI_SPAM_H #define TUTTI_FRUTTI_SPAM_H diff --git a/firmware_c5/components/Applications/bluetooth/include/uuid_lookup.h b/firmware_c5/components/Applications/bluetooth/include/uuid_lookup.h index 67ca25e0..cf5e90c0 100644 --- a/firmware_c5/components/Applications/bluetooth/include/uuid_lookup.h +++ b/firmware_c5/components/Applications/bluetooth/include/uuid_lookup.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef UUID_LOOKUP_H #define UUID_LOOKUP_H diff --git a/firmware_c5/components/Applications/bluetooth/oui_lookup.c b/firmware_c5/components/Applications/bluetooth/oui_lookup.c index b3188636..e62d8549 100644 --- a/firmware_c5/components/Applications/bluetooth/oui_lookup.c +++ b/firmware_c5/components/Applications/bluetooth/oui_lookup.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "oui_lookup.h" diff --git a/firmware_c5/components/Applications/bluetooth/samsung_spam.c b/firmware_c5/components/Applications/bluetooth/samsung_spam.c index 1bcf8767..cdc5a801 100644 --- a/firmware_c5/components/Applications/bluetooth/samsung_spam.c +++ b/firmware_c5/components/Applications/bluetooth/samsung_spam.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "samsung_spam.h" diff --git a/firmware_c5/components/Applications/bluetooth/skimmer_detector.c b/firmware_c5/components/Applications/bluetooth/skimmer_detector.c index 6f1ed8fb..3e525499 100644 --- a/firmware_c5/components/Applications/bluetooth/skimmer_detector.c +++ b/firmware_c5/components/Applications/bluetooth/skimmer_detector.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "skimmer_detector.h" diff --git a/firmware_c5/components/Applications/bluetooth/sour_apple_spam.c b/firmware_c5/components/Applications/bluetooth/sour_apple_spam.c index 0dbc0011..29632510 100644 --- a/firmware_c5/components/Applications/bluetooth/sour_apple_spam.c +++ b/firmware_c5/components/Applications/bluetooth/sour_apple_spam.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "sour_apple_spam.h" diff --git a/firmware_c5/components/Applications/bluetooth/swift_pair_spam.c b/firmware_c5/components/Applications/bluetooth/swift_pair_spam.c index 85c13f7f..4c0c6d04 100644 --- a/firmware_c5/components/Applications/bluetooth/swift_pair_spam.c +++ b/firmware_c5/components/Applications/bluetooth/swift_pair_spam.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "swift_pair_spam.h" diff --git a/firmware_c5/components/Applications/bluetooth/tracker_detector.c b/firmware_c5/components/Applications/bluetooth/tracker_detector.c index 8a7acb97..780873e8 100644 --- a/firmware_c5/components/Applications/bluetooth/tracker_detector.c +++ b/firmware_c5/components/Applications/bluetooth/tracker_detector.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "tracker_detector.h" diff --git a/firmware_c5/components/Applications/bluetooth/tutti_frutti_spam.c b/firmware_c5/components/Applications/bluetooth/tutti_frutti_spam.c index 64199c02..a93ee828 100644 --- a/firmware_c5/components/Applications/bluetooth/tutti_frutti_spam.c +++ b/firmware_c5/components/Applications/bluetooth/tutti_frutti_spam.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "tutti_frutti_spam.h" diff --git a/firmware_c5/components/Applications/bluetooth/uuid_lookup.c b/firmware_c5/components/Applications/bluetooth/uuid_lookup.c index edd3303a..da6ff3f1 100644 --- a/firmware_c5/components/Applications/bluetooth/uuid_lookup.c +++ b/firmware_c5/components/Applications/bluetooth/uuid_lookup.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "uuid_lookup.h" diff --git a/firmware_c5/components/Applications/espnow_chat/espnow_chat.c b/firmware_c5/components/Applications/espnow_chat/espnow_chat.c index ad7532c9..603db7d8 100644 --- a/firmware_c5/components/Applications/espnow_chat/espnow_chat.c +++ b/firmware_c5/components/Applications/espnow_chat/espnow_chat.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "espnow_chat.h" diff --git a/firmware_c5/components/Applications/espnow_chat/include/espnow_chat.h b/firmware_c5/components/Applications/espnow_chat/include/espnow_chat.h index 4748cb01..8ffc4067 100644 --- a/firmware_c5/components/Applications/espnow_chat/include/espnow_chat.h +++ b/firmware_c5/components/Applications/espnow_chat/include/espnow_chat.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef ESPNOW_CHAT_H #define ESPNOW_CHAT_H diff --git a/firmware_c5/components/Applications/wifi/ap_scanner.c b/firmware_c5/components/Applications/wifi/ap_scanner.c index ea30d795..37883d33 100644 --- a/firmware_c5/components/Applications/wifi/ap_scanner.c +++ b/firmware_c5/components/Applications/wifi/ap_scanner.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "ap_scanner.h" diff --git a/firmware_c5/components/Applications/wifi/beacon_spam.c b/firmware_c5/components/Applications/wifi/beacon_spam.c index 77b3d371..2eef4627 100644 --- a/firmware_c5/components/Applications/wifi/beacon_spam.c +++ b/firmware_c5/components/Applications/wifi/beacon_spam.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "beacon_spam.h" diff --git a/firmware_c5/components/Applications/wifi/client_scanner.c b/firmware_c5/components/Applications/wifi/client_scanner.c index 3c4a762c..35feba75 100644 --- a/firmware_c5/components/Applications/wifi/client_scanner.c +++ b/firmware_c5/components/Applications/wifi/client_scanner.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "client_scanner.h" diff --git a/firmware_c5/components/Applications/wifi/deauther_detector.c b/firmware_c5/components/Applications/wifi/deauther_detector.c index 43867ba1..df46165a 100644 --- a/firmware_c5/components/Applications/wifi/deauther_detector.c +++ b/firmware_c5/components/Applications/wifi/deauther_detector.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "deauther_detector.h" diff --git a/firmware_c5/components/Applications/wifi/evil_twin.c b/firmware_c5/components/Applications/wifi/evil_twin.c index 9264f10b..86ae1403 100644 --- a/firmware_c5/components/Applications/wifi/evil_twin.c +++ b/firmware_c5/components/Applications/wifi/evil_twin.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "evil_twin.h" diff --git a/firmware_c5/components/Applications/wifi/include/ap_scanner.h b/firmware_c5/components/Applications/wifi/include/ap_scanner.h index 536b4722..54c18bb0 100644 --- a/firmware_c5/components/Applications/wifi/include/ap_scanner.h +++ b/firmware_c5/components/Applications/wifi/include/ap_scanner.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef AP_SCANNER_H #define AP_SCANNER_H diff --git a/firmware_c5/components/Applications/wifi/include/beacon_spam.h b/firmware_c5/components/Applications/wifi/include/beacon_spam.h index 42ff4f09..35d405fb 100644 --- a/firmware_c5/components/Applications/wifi/include/beacon_spam.h +++ b/firmware_c5/components/Applications/wifi/include/beacon_spam.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef BEACON_SPAM_H #define BEACON_SPAM_H diff --git a/firmware_c5/components/Applications/wifi/include/client_scanner.h b/firmware_c5/components/Applications/wifi/include/client_scanner.h index 6eb27049..8a904abc 100644 --- a/firmware_c5/components/Applications/wifi/include/client_scanner.h +++ b/firmware_c5/components/Applications/wifi/include/client_scanner.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef CLIENT_SCANNER_H #define CLIENT_SCANNER_H diff --git a/firmware_c5/components/Applications/wifi/include/deauther_detector.h b/firmware_c5/components/Applications/wifi/include/deauther_detector.h index 2e62dc7e..e67e0472 100644 --- a/firmware_c5/components/Applications/wifi/include/deauther_detector.h +++ b/firmware_c5/components/Applications/wifi/include/deauther_detector.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef DEAUTHER_DETECTOR_H #define DEAUTHER_DETECTOR_H diff --git a/firmware_c5/components/Applications/wifi/include/evil_twin.h b/firmware_c5/components/Applications/wifi/include/evil_twin.h index 0d98b1ac..af499da6 100644 --- a/firmware_c5/components/Applications/wifi/include/evil_twin.h +++ b/firmware_c5/components/Applications/wifi/include/evil_twin.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef EVIL_TWIN_H #define EVIL_TWIN_H diff --git a/firmware_c5/components/Applications/wifi/include/pcap_serializer.h b/firmware_c5/components/Applications/wifi/include/pcap_serializer.h index bc7df4b0..b9347851 100644 --- a/firmware_c5/components/Applications/wifi/include/pcap_serializer.h +++ b/firmware_c5/components/Applications/wifi/include/pcap_serializer.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef PCAP_SERIALIZER_H #define PCAP_SERIALIZER_H diff --git a/firmware_c5/components/Applications/wifi/include/port_scan.h b/firmware_c5/components/Applications/wifi/include/port_scan.h index 27e5f700..fec84293 100644 --- a/firmware_c5/components/Applications/wifi/include/port_scan.h +++ b/firmware_c5/components/Applications/wifi/include/port_scan.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef PORT_SCAN_H #define PORT_SCAN_H diff --git a/firmware_c5/components/Applications/wifi/include/probe_monitor.h b/firmware_c5/components/Applications/wifi/include/probe_monitor.h index a7e0393f..199fe8cc 100644 --- a/firmware_c5/components/Applications/wifi/include/probe_monitor.h +++ b/firmware_c5/components/Applications/wifi/include/probe_monitor.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef PROBE_MONITOR_H #define PROBE_MONITOR_H diff --git a/firmware_c5/components/Applications/wifi/include/signal_monitor.h b/firmware_c5/components/Applications/wifi/include/signal_monitor.h index 2c2fff21..7e2cc765 100644 --- a/firmware_c5/components/Applications/wifi/include/signal_monitor.h +++ b/firmware_c5/components/Applications/wifi/include/signal_monitor.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef SIGNAL_MONITOR_H #define SIGNAL_MONITOR_H diff --git a/firmware_c5/components/Applications/wifi/include/target_scanner.h b/firmware_c5/components/Applications/wifi/include/target_scanner.h index f48e0c2d..e68bc413 100644 --- a/firmware_c5/components/Applications/wifi/include/target_scanner.h +++ b/firmware_c5/components/Applications/wifi/include/target_scanner.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef TARGET_SCANNER_H #define TARGET_SCANNER_H diff --git a/firmware_c5/components/Applications/wifi/include/wifi_deauther.h b/firmware_c5/components/Applications/wifi/include/wifi_deauther.h index d22f2ebf..f547008c 100644 --- a/firmware_c5/components/Applications/wifi/include/wifi_deauther.h +++ b/firmware_c5/components/Applications/wifi/include/wifi_deauther.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef WIFI_DEAUTHER_H #define WIFI_DEAUTHER_H diff --git a/firmware_c5/components/Applications/wifi/include/wifi_flood.h b/firmware_c5/components/Applications/wifi/include/wifi_flood.h index e31d447a..5420c5d6 100644 --- a/firmware_c5/components/Applications/wifi/include/wifi_flood.h +++ b/firmware_c5/components/Applications/wifi/include/wifi_flood.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef WIFI_FLOOD_H #define WIFI_FLOOD_H diff --git a/firmware_c5/components/Applications/wifi/include/wifi_sniffer.h b/firmware_c5/components/Applications/wifi/include/wifi_sniffer.h index 9557606e..5dc79e9c 100644 --- a/firmware_c5/components/Applications/wifi/include/wifi_sniffer.h +++ b/firmware_c5/components/Applications/wifi/include/wifi_sniffer.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef WIFI_SNIFFER_H #define WIFI_SNIFFER_H @@ -22,6 +23,8 @@ extern "C" { #include #include +#include "spi_protocol.h" + /** * @brief Packet filter type for the Wi-Fi sniffer. */ @@ -48,6 +51,26 @@ bool wifi_sniffer_start(wifi_sniffer_type_t type, uint8_t channel); */ void wifi_sniffer_stop(void); +/** + * @brief Enable monitor mode: when the local PCAP buffer fills up, the + * buffer recycles instead of dropping packets, and the packet counter + * keeps incrementing forever. Used by the Packet Monitor screen which + * only needs the counter, not the captured PCAP. + */ +void wifi_sniffer_set_monitor_mode(bool enabled); + +/** + * @brief Bind a session ID to the running sniffer (called by dispatcher + * after session_manager_start). Streams will be emitted via the session. + */ +void wifi_sniffer_bind_session(uint32_t session_id); + +/** + * @brief Kill callback: stops the sniffer when its session watchdog fires. + * Compatible with session_kill_cb_t. + */ +void wifi_sniffer_session_killed(spi_id_t op_id); + /** * @brief Save the PCAP buffer to internal flash. * diff --git a/firmware_c5/components/Applications/wifi/port_scan.c b/firmware_c5/components/Applications/wifi/port_scan.c index 7b06139f..6d90ae40 100644 --- a/firmware_c5/components/Applications/wifi/port_scan.c +++ b/firmware_c5/components/Applications/wifi/port_scan.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "port_scan.h" diff --git a/firmware_c5/components/Applications/wifi/probe_monitor.c b/firmware_c5/components/Applications/wifi/probe_monitor.c index af068d37..154f5c1a 100644 --- a/firmware_c5/components/Applications/wifi/probe_monitor.c +++ b/firmware_c5/components/Applications/wifi/probe_monitor.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "probe_monitor.h" diff --git a/firmware_c5/components/Applications/wifi/signal_monitor.c b/firmware_c5/components/Applications/wifi/signal_monitor.c index e47d253c..da470367 100644 --- a/firmware_c5/components/Applications/wifi/signal_monitor.c +++ b/firmware_c5/components/Applications/wifi/signal_monitor.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "signal_monitor.h" diff --git a/firmware_c5/components/Applications/wifi/target_scanner.c b/firmware_c5/components/Applications/wifi/target_scanner.c index 4882a92e..ee6b7323 100644 --- a/firmware_c5/components/Applications/wifi/target_scanner.c +++ b/firmware_c5/components/Applications/wifi/target_scanner.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "target_scanner.h" diff --git a/firmware_c5/components/Applications/wifi/wifi_deauther.c b/firmware_c5/components/Applications/wifi/wifi_deauther.c index 3b4710f0..d46ab0e4 100644 --- a/firmware_c5/components/Applications/wifi/wifi_deauther.c +++ b/firmware_c5/components/Applications/wifi/wifi_deauther.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "wifi_deauther.h" diff --git a/firmware_c5/components/Applications/wifi/wifi_flood.c b/firmware_c5/components/Applications/wifi/wifi_flood.c index 907577d7..cad8c7f9 100644 --- a/firmware_c5/components/Applications/wifi/wifi_flood.c +++ b/firmware_c5/components/Applications/wifi/wifi_flood.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "wifi_flood.h" diff --git a/firmware_c5/components/Applications/wifi/wifi_sniffer.c b/firmware_c5/components/Applications/wifi/wifi_sniffer.c index ad5a85cc..1642522d 100644 --- a/firmware_c5/components/Applications/wifi/wifi_sniffer.c +++ b/firmware_c5/components/Applications/wifi/wifi_sniffer.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "wifi_sniffer.h" @@ -28,6 +29,7 @@ #include "pcap_serializer.h" #include "sd_card_init.h" #include "sd_card_write.h" +#include "session_manager.h" #include "spi_bridge.h" #include "storage_mkdir.h" #include "storage_write.h" @@ -86,7 +88,9 @@ typedef struct { static uint8_t *s_pcap_buffer = NULL; static uint32_t s_buffer_offset = 0; static uint32_t s_packet_count = 0; +static uint32_t s_session_id = SPI_SESSION_INVALID_ID; static uint32_t s_deauth_count = 0; +static bool s_is_monitor_mode = false; // packet monitor: counts forever, buffer recycles static bool s_is_sniffing = false; static bool s_is_pcap_enabled = false; static bool s_is_verbose = false; @@ -265,7 +269,27 @@ bool wifi_sniffer_start_stream_sd(wifi_sniffer_type_t type, uint8_t channel, con return true; } +void wifi_sniffer_set_monitor_mode(bool enabled) { + s_is_monitor_mode = enabled; + if (!enabled) { + return; + } + // Reset buffer position so monitor mode starts with a clean rolling window. + s_buffer_offset = sizeof(pcap_global_header_t); +} + +void wifi_sniffer_bind_session(uint32_t session_id) { + s_session_id = session_id; +} + +void wifi_sniffer_session_killed(spi_id_t op_id) { + (void)op_id; + s_session_id = SPI_SESSION_INVALID_ID; + wifi_sniffer_stop(); +} + void wifi_sniffer_stop(void) { + s_session_id = SPI_SESSION_INVALID_ID; if (!s_is_sniffing) return; @@ -599,9 +623,12 @@ static void sniffer_callback(void *buf, wifi_promiscuous_pkt_type_t type) { return; const bool is_pcap_ok = (s_pcap_buffer != NULL); - if (is_pcap_ok && !s_is_streaming_sd && - s_buffer_offset >= SNIFFER_BUFFER_SIZE - SNIFFER_BUFFER_MARGIN) { - return; + bool pcap_full = is_pcap_ok && !s_is_streaming_sd && + s_buffer_offset >= SNIFFER_BUFFER_SIZE - SNIFFER_BUFFER_MARGIN; + if (pcap_full && s_is_monitor_mode) { + // Monitor mode: recycle buffer (counter keeps growing) + s_buffer_offset = sizeof(pcap_global_header_t); + pcap_full = false; } const wifi_promiscuous_pkt_t *ppkt = (const wifi_promiscuous_pkt_t *)buf; @@ -698,10 +725,14 @@ static void sniffer_callback(void *buf, wifi_promiscuous_pkt_type_t type) { stream->channel = ppkt->rx_ctrl.channel; stream->len = (uint8_t)raw_len; memcpy(stream->data, ppkt->payload, raw_len); - spi_bridge_stream_push(SPI_ID_WIFI_APP_SNIFFER, stream_buf, (uint8_t)(raw_len + 3)); + if (s_session_id != SPI_SESSION_INVALID_ID) { + session_manager_try_emit(s_session_id, stream_buf, (uint8_t)(raw_len + 3)); + } else { + spi_bridge_stream_push(SPI_ID_WIFI_APP_SNIFFER, stream_buf, (uint8_t)(raw_len + 3)); + } } - if (is_save && is_pcap_ok) { + if (is_save && is_pcap_ok && !pcap_full) { pcap_packet_header_t pkt_hdr; int64_t now_us = esp_timer_get_time(); pkt_hdr.ts_sec = (uint32_t)(now_us / US_PER_S); @@ -740,10 +771,13 @@ static void sniffer_callback(void *buf, wifi_promiscuous_pkt_type_t type) { s_buffer_offset += sizeof(pkt_hdr); memcpy(s_pcap_buffer + s_buffer_offset, ppkt->payload, pkt_hdr.incl_len); s_buffer_offset += pkt_hdr.incl_len; - s_packet_count++; } } } + + if (is_save) { + s_packet_count++; + } } static bool save_to_file(const char *path, bool use_sd) { diff --git a/firmware_c5/components/Core/CMakeLists.txt b/firmware_c5/components/Core/CMakeLists.txt index 08d3efbb..52212351 100644 --- a/firmware_c5/components/Core/CMakeLists.txt +++ b/firmware_c5/components/Core/CMakeLists.txt @@ -1,16 +1,17 @@ # Copyright (c) 2025 HIGH CODE LLC # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# TentacleOS is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# http://www.apache.org/licenses/LICENSE-2.0 +# TentacleOS is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# You should have received a copy of the GNU General Public License +# along with TentacleOS. If not, see . idf_component_register(SRCS diff --git a/firmware_c5/components/Core/include/kernel.h b/firmware_c5/components/Core/include/kernel.h index fb789039..99a03698 100644 --- a/firmware_c5/components/Core/include/kernel.h +++ b/firmware_c5/components/Core/include/kernel.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef KERNEL_H #define KERNEL_H diff --git a/firmware_c5/components/Core/include/sys_monitor.h b/firmware_c5/components/Core/include/sys_monitor.h index 6b24cf6a..7e8c7eba 100644 --- a/firmware_c5/components/Core/include/sys_monitor.h +++ b/firmware_c5/components/Core/include/sys_monitor.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef SYS_MONITOR_H #define SYS_MONITOR_H diff --git a/firmware_c5/components/Core/kernel.c b/firmware_c5/components/Core/kernel.c index 2692d3d6..b2df4a00 100644 --- a/firmware_c5/components/Core/kernel.c +++ b/firmware_c5/components/Core/kernel.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "kernel.h" diff --git a/firmware_c5/components/Core/sys_monitor.c b/firmware_c5/components/Core/sys_monitor.c index a4ec6298..5ed72f49 100644 --- a/firmware_c5/components/Core/sys_monitor.c +++ b/firmware_c5/components/Core/sys_monitor.c @@ -89,7 +89,7 @@ void sys_monitor(bool show_ram_logs) { params->verbose_logging = show_ram_logs; xTaskCreatePinnedToCore( - sys_monitor_task, "SysMonitor", STACK_SIZE_BYTES, (void *)params, 1, NULL, 1); + sys_monitor_task, "SysMonitor", STACK_SIZE_BYTES, (void *)params, 1, NULL, 0); } else { ESP_LOGE(TAG, "Failed to allocate memory for SysMonitor parameters."); } diff --git a/firmware_c5/components/Drivers/CMakeLists.txt b/firmware_c5/components/Drivers/CMakeLists.txt index 1d553a84..9666655f 100644 --- a/firmware_c5/components/Drivers/CMakeLists.txt +++ b/firmware_c5/components/Drivers/CMakeLists.txt @@ -1,16 +1,17 @@ # Copyright (c) 2025 HIGH CODE LLC # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# TentacleOS is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# http://www.apache.org/licenses/LICENSE-2.0 +# TentacleOS is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# You should have received a copy of the GNU General Public License +# along with TentacleOS. If not, see . idf_component_register(SRCS diff --git a/firmware_c5/components/Drivers/bq25896/bq25896.c b/firmware_c5/components/Drivers/bq25896/bq25896.c index 6364c1c1..48b7d265 100644 --- a/firmware_c5/components/Drivers/bq25896/bq25896.c +++ b/firmware_c5/components/Drivers/bq25896/bq25896.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "bq25896.h" diff --git a/firmware_c5/components/Drivers/bq25896/include/bq25896.h b/firmware_c5/components/Drivers/bq25896/include/bq25896.h index 50dab301..12b5602f 100644 --- a/firmware_c5/components/Drivers/bq25896/include/bq25896.h +++ b/firmware_c5/components/Drivers/bq25896/include/bq25896.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef BQ25896_H #define BQ25896_H diff --git a/firmware_c5/components/Drivers/buttons_gpio/buttons_gpio.c b/firmware_c5/components/Drivers/buttons_gpio/buttons_gpio.c index e652d545..d657f975 100644 --- a/firmware_c5/components/Drivers/buttons_gpio/buttons_gpio.c +++ b/firmware_c5/components/Drivers/buttons_gpio/buttons_gpio.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "buttons_gpio.h" diff --git a/firmware_c5/components/Drivers/buttons_gpio/include/buttons_gpio.h b/firmware_c5/components/Drivers/buttons_gpio/include/buttons_gpio.h index b02000be..be865cac 100644 --- a/firmware_c5/components/Drivers/buttons_gpio/include/buttons_gpio.h +++ b/firmware_c5/components/Drivers/buttons_gpio/include/buttons_gpio.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef BUTTONS_GPIO_H #define BUTTONS_GPIO_H diff --git a/firmware_c5/components/Drivers/i2c_init/i2c_init.c b/firmware_c5/components/Drivers/i2c_init/i2c_init.c index 83713885..af54a27a 100644 --- a/firmware_c5/components/Drivers/i2c_init/i2c_init.c +++ b/firmware_c5/components/Drivers/i2c_init/i2c_init.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "i2c_init.h" diff --git a/firmware_c5/components/Drivers/i2c_init/include/i2c_init.h b/firmware_c5/components/Drivers/i2c_init/include/i2c_init.h index 89f7b0ff..f1ce7d2e 100644 --- a/firmware_c5/components/Drivers/i2c_init/include/i2c_init.h +++ b/firmware_c5/components/Drivers/i2c_init/include/i2c_init.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef I2C_INIT_H #define I2C_INIT_H diff --git a/firmware_c5/components/Drivers/led/include/led_control.h b/firmware_c5/components/Drivers/led/include/led_control.h index 930c143b..e6f2e2d9 100644 --- a/firmware_c5/components/Drivers/led/include/led_control.h +++ b/firmware_c5/components/Drivers/led/include/led_control.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef LED_CONTROL_H #define LED_CONTROL_H diff --git a/firmware_c5/components/Drivers/led/led_control.c b/firmware_c5/components/Drivers/led/led_control.c index 9cf195bc..1a8e892a 100644 --- a/firmware_c5/components/Drivers/led/led_control.c +++ b/firmware_c5/components/Drivers/led/led_control.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "led_control.h" @@ -63,6 +64,9 @@ void led_rgb_init(void) { } static void led_blink_color(uint8_t r, uint8_t g, uint8_t b, int duration_ms) { + if (s_led_strip == NULL) { + return; + } ESP_ERROR_CHECK(led_strip_set_pixel(s_led_strip, 0, r, g, b)); ESP_ERROR_CHECK(led_strip_refresh(s_led_strip)); vTaskDelay(duration_ms / portTICK_PERIOD_MS); diff --git a/firmware_c5/components/Drivers/pins/include/pin_def.h b/firmware_c5/components/Drivers/pins/include/pin_def.h index f32b6d8e..690022f5 100644 --- a/firmware_c5/components/Drivers/pins/include/pin_def.h +++ b/firmware_c5/components/Drivers/pins/include/pin_def.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file pin_def.h diff --git a/firmware_c5/components/Drivers/spi/include/spi.h b/firmware_c5/components/Drivers/spi/include/spi.h index 4393776c..6f834bf4 100644 --- a/firmware_c5/components/Drivers/spi/include/spi.h +++ b/firmware_c5/components/Drivers/spi/include/spi.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef SPI_H #define SPI_H diff --git a/firmware_c5/components/Drivers/spi/spi.c b/firmware_c5/components/Drivers/spi/spi.c index f82cb99d..5f888b7b 100644 --- a/firmware_c5/components/Drivers/spi/spi.c +++ b/firmware_c5/components/Drivers/spi/spi.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "spi.h" diff --git a/firmware_c5/components/Drivers/spi_slave/include/spi_slave_driver.h b/firmware_c5/components/Drivers/spi_slave/include/spi_slave_driver.h index cad08a8c..b46f3c9f 100644 --- a/firmware_c5/components/Drivers/spi_slave/include/spi_slave_driver.h +++ b/firmware_c5/components/Drivers/spi_slave/include/spi_slave_driver.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef SPI_SLAVE_DRIVER_H #define SPI_SLAVE_DRIVER_H diff --git a/firmware_c5/components/Drivers/spi_slave/spi_slave_driver.c b/firmware_c5/components/Drivers/spi_slave/spi_slave_driver.c index 1fd654c1..605151a9 100644 --- a/firmware_c5/components/Drivers/spi_slave/spi_slave_driver.c +++ b/firmware_c5/components/Drivers/spi_slave/spi_slave_driver.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "spi_slave_driver.h" diff --git a/firmware_c5/components/Service/CMakeLists.txt b/firmware_c5/components/Service/CMakeLists.txt index d27533be..dcdb9761 100644 --- a/firmware_c5/components/Service/CMakeLists.txt +++ b/firmware_c5/components/Service/CMakeLists.txt @@ -1,21 +1,24 @@ # Copyright (c) 2025 HIGH CODE LLC # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# TentacleOS is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# http://www.apache.org/licenses/LICENSE-2.0 +# TentacleOS is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# You should have received a copy of the GNU General Public License +# along with TentacleOS. If not, see . file(GLOB_RECURSE CONSOLE_SERVICE_SRCS "console/*.c") file(GLOB_RECURSE CONSOLE_COMMANDS_SRCS "console/commands/*.c") file(GLOB_RECURSE SPI_BRIDGE_SRCS "spi_bridge/*.c") file(GLOB_RECURSE SD_CARD_SRCS "sd_card/*.c") +file(GLOB_RECURSE MESHTASTIC_SRCS "meshtastic/*.c") +file(GLOB_RECURSE MESHCORE_SRCS "meshcore/*.c") idf_component_register(SRCS @@ -41,6 +44,8 @@ idf_component_register(SRCS ${CONSOLE_SERVICE_SRCS} ${CONSOLE_COMMANDS_SRCS} ${SD_CARD_SRCS} + ${MESHTASTIC_SRCS} + ${MESHCORE_SRCS} INCLUDE_DIRS "wifi/include" "http_server/include" @@ -53,6 +58,8 @@ idf_component_register(SRCS "spi_bridge/include" "console/include" "sd_card/include" + "meshtastic/include" + "meshcore/include" @@ -73,6 +80,7 @@ idf_component_register(SRCS lvgl littlefs cjson - console - argtable3 + console + argtable3 + mdns ) diff --git a/firmware_c5/components/Service/bluetooth/bluetooth_service.c b/firmware_c5/components/Service/bluetooth/bluetooth_service.c index 6b9febcc..7b90df72 100644 --- a/firmware_c5/components/Service/bluetooth/bluetooth_service.c +++ b/firmware_c5/components/Service/bluetooth/bluetooth_service.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "bluetooth_service.h" diff --git a/firmware_c5/components/Service/bluetooth/include/bluetooth_service.h b/firmware_c5/components/Service/bluetooth/include/bluetooth_service.h index 8f94f57a..1ebe58f7 100644 --- a/firmware_c5/components/Service/bluetooth/include/bluetooth_service.h +++ b/firmware_c5/components/Service/bluetooth/include/bluetooth_service.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef BLUETOOTH_SERVICE_H #define BLUETOOTH_SERVICE_H diff --git a/firmware_c5/components/Service/console/commands/cmd_fs.c b/firmware_c5/components/Service/console/commands/cmd_fs.c index 9f1cbf8a..7b41f57d 100644 --- a/firmware_c5/components/Service/console/commands/cmd_fs.c +++ b/firmware_c5/components/Service/console/commands/cmd_fs.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "console_service.h" diff --git a/firmware_c5/components/Service/console/commands/cmd_system.c b/firmware_c5/components/Service/console/commands/cmd_system.c index b0ee8d98..91a58894 100644 --- a/firmware_c5/components/Service/console/commands/cmd_system.c +++ b/firmware_c5/components/Service/console/commands/cmd_system.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "console_service.h" diff --git a/firmware_c5/components/Service/console/commands/cmd_wifi.c b/firmware_c5/components/Service/console/commands/cmd_wifi.c index 488b703d..fbcce54c 100644 --- a/firmware_c5/components/Service/console/commands/cmd_wifi.c +++ b/firmware_c5/components/Service/console/commands/cmd_wifi.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "console_service.h" diff --git a/firmware_c5/components/Service/console/console_service.c b/firmware_c5/components/Service/console/console_service.c index bcce8e77..4d5e0421 100644 --- a/firmware_c5/components/Service/console/console_service.c +++ b/firmware_c5/components/Service/console/console_service.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "console_service.h" diff --git a/firmware_c5/components/Service/console/include/console_service.h b/firmware_c5/components/Service/console/include/console_service.h index 290d5955..b9c293c1 100644 --- a/firmware_c5/components/Service/console/include/console_service.h +++ b/firmware_c5/components/Service/console/include/console_service.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef CONSOLE_SERVICE_H #define CONSOLE_SERVICE_H diff --git a/firmware_c5/components/Service/dns_server/dns_server.c b/firmware_c5/components/Service/dns_server/dns_server.c index a07b889a..59809cff 100644 --- a/firmware_c5/components/Service/dns_server/dns_server.c +++ b/firmware_c5/components/Service/dns_server/dns_server.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "dns_server.h" diff --git a/firmware_c5/components/Service/dns_server/include/dns_server.h b/firmware_c5/components/Service/dns_server/include/dns_server.h index 7dcb2f89..a2bc2f0d 100644 --- a/firmware_c5/components/Service/dns_server/include/dns_server.h +++ b/firmware_c5/components/Service/dns_server/include/dns_server.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef DNS_SERVER_H #define DNS_SERVER_H diff --git a/firmware_c5/components/Service/esp_now/include/service_esp_now.h b/firmware_c5/components/Service/esp_now/include/service_esp_now.h index 08ea3b69..47106370 100644 --- a/firmware_c5/components/Service/esp_now/include/service_esp_now.h +++ b/firmware_c5/components/Service/esp_now/include/service_esp_now.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef SERVICE_ESP_NOW_H #define SERVICE_ESP_NOW_H diff --git a/firmware_c5/components/Service/esp_now/service_esp_now.c b/firmware_c5/components/Service/esp_now/service_esp_now.c index e08eabe2..3a1d9604 100644 --- a/firmware_c5/components/Service/esp_now/service_esp_now.c +++ b/firmware_c5/components/Service/esp_now/service_esp_now.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "service_esp_now.h" #include diff --git a/firmware_c5/components/Service/font/font.c b/firmware_c5/components/Service/font/font.c index a12bd3eb..ec66c642 100644 --- a/firmware_c5/components/Service/font/font.c +++ b/firmware_c5/components/Service/font/font.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "font.h" diff --git a/firmware_c5/components/Service/font/include/font.h b/firmware_c5/components/Service/font/include/font.h index c6710391..617850ff 100644 --- a/firmware_c5/components/Service/font/include/font.h +++ b/firmware_c5/components/Service/font/include/font.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef FONT_H #define FONT_H diff --git a/firmware_c5/components/Service/http_server/http_server_service.c b/firmware_c5/components/Service/http_server/http_server_service.c index 9d575f10..d67b44b9 100644 --- a/firmware_c5/components/Service/http_server/http_server_service.c +++ b/firmware_c5/components/Service/http_server/http_server_service.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "http_server_service.h" diff --git a/firmware_c5/components/Service/http_server/include/http_server_service.h b/firmware_c5/components/Service/http_server/include/http_server_service.h index fd25b483..fb352914 100644 --- a/firmware_c5/components/Service/http_server/include/http_server_service.h +++ b/firmware_c5/components/Service/http_server/include/http_server_service.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef HTTP_SERVER_SERVICE_H #define HTTP_SERVER_SERVICE_H diff --git a/firmware_c5/components/Service/meshcore/include/meshcore_gatt.h b/firmware_c5/components/Service/meshcore/include/meshcore_gatt.h new file mode 100644 index 00000000..2d2abf8c --- /dev/null +++ b/firmware_c5/components/Service/meshcore/include/meshcore_gatt.h @@ -0,0 +1,83 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#ifndef MESHCORE_GATT_H +#define MESHCORE_GATT_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +#include "esp_err.h" + +/** + * @brief Initialize the MeshCore Companion BLE NUS service. + * + * Brings up NimBLE with SC + MITM + DISP_ONLY pairing using the static + * passkey provided by the P4. Advertises a Nordic UART Service-style + * primary with the MeshCore Companion characteristics (write + notify). + * + * Mutually exclusive with the generic bluetooth_service and with the + * Meshtastic GATT — only one BLE-mesh stack may be active at a time. + * + * @param name_prefix Advertised name prefix; the final name becomes + * "-XXXX" (last 2 octets of MAC). Required. + * @param pin 6-digit static passkey (100000..999999). + * @return + * - ESP_OK on success + * - ESP_ERR_INVALID_ARG if name_prefix is NULL + * - ESP_ERR_INVALID_STATE if BLE is already owned by another module + * - ESP_FAIL on NimBLE stack failure + */ +esp_err_t meshcore_gatt_init(const char *name_prefix, uint32_t pin); + +/** + * @brief Tear down the GATT service and stop NimBLE. + */ +void meshcore_gatt_stop(void); + +/** + * @brief Whether NimBLE has been initialized by this module. + */ +bool meshcore_gatt_is_running(void); + +/** + * @brief Whether a phone is currently connected. + */ +bool meshcore_gatt_is_connected(void); + +/** + * @brief Whether the phone has subscribed to the TX notify characteristic. + */ +bool meshcore_gatt_is_subscribed(void); + +/** + * @brief Notify the phone with a Companion frame received from the P4. + * + * Drops silently if no phone is connected or has not subscribed. + * + * @param frame Companion frame bytes (1-byte tag + payload). + * @param len Length in bytes (<= 240). + */ +void meshcore_gatt_notify(const uint8_t *frame, uint16_t len); + +#ifdef __cplusplus +} +#endif + +#endif // MESHCORE_GATT_H diff --git a/firmware_c5/components/Service/meshcore/meshcore_gatt.c b/firmware_c5/components/Service/meshcore/meshcore_gatt.c new file mode 100644 index 00000000..0eebb1c3 --- /dev/null +++ b/firmware_c5/components/Service/meshcore/meshcore_gatt.c @@ -0,0 +1,353 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#include "meshcore_gatt.h" + +#include +#include + +#include "esp_log.h" +#include "esp_mac.h" +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" +#include "host/ble_gap.h" +#include "host/ble_gatt.h" +#include "host/ble_hs.h" +#include "host/ble_uuid.h" +#include "host/util/util.h" +#include "nimble/nimble_port.h" +#include "nimble/nimble_port_freertos.h" +#include "nvs_flash.h" +#include "services/gap/ble_svc_gap.h" +#include "services/gatt/ble_svc_gatt.h" + +#include "bluetooth_service.h" +#include "meshcore_transport.h" + +extern void ble_store_config_init(void); + +static const char *TAG = "MC_GATT"; + +#define MCORE_PREFERRED_MTU 512 +#define MCORE_RX_FRAME_MAX 256 +#define MCORE_DEVICE_NAME_LEN 32 + +static const ble_uuid128_t NUS_SERVICE_UUID = BLE_UUID128_INIT( + 0x9E, 0xCA, 0xDC, 0x24, 0x0E, 0xE5, 0xA9, 0xE0, 0x93, 0xF3, 0xA3, 0xB5, 0x01, 0x00, 0x40, 0x6E); +static const ble_uuid128_t NUS_RX_UUID = BLE_UUID128_INIT( + 0x9E, 0xCA, 0xDC, 0x24, 0x0E, 0xE5, 0xA9, 0xE0, 0x93, 0xF3, 0xA3, 0xB5, 0x02, 0x00, 0x40, 0x6E); +static const ble_uuid128_t NUS_TX_UUID = BLE_UUID128_INIT( + 0x9E, 0xCA, 0xDC, 0x24, 0x0E, 0xE5, 0xA9, 0xE0, 0x93, 0xF3, 0xA3, 0xB5, 0x03, 0x00, 0x40, 0x6E); + +static bool s_is_running = false; +static bool s_is_connected = false; +static bool s_is_subscribed = false; +static uint16_t s_conn_handle = BLE_HS_CONN_HANDLE_NONE; +static uint16_t s_tx_attr_handle = 0; +static uint8_t s_own_addr_type = 0; +static uint32_t s_passkey = 0; +static char s_device_name[MCORE_DEVICE_NAME_LEN] = {0}; +static uint8_t s_rx_buf[MCORE_RX_FRAME_MAX]; + +static void advertise_start(void); +static int gap_event(struct ble_gap_event *event, void *arg); +static int rx_access(uint16_t conn, uint16_t attr, struct ble_gatt_access_ctxt *ctxt, void *arg); +static int tx_access(uint16_t conn, uint16_t attr, struct ble_gatt_access_ctxt *ctxt, void *arg); +static void on_sync(void); +static void on_reset(int reason); +static void host_task(void *param); + +static const struct ble_gatt_svc_def GATT_SERVICES[] = { + { + .type = BLE_GATT_SVC_TYPE_PRIMARY, + .uuid = &NUS_SERVICE_UUID.u, + .characteristics = + (struct ble_gatt_chr_def[]){ + { + .uuid = &NUS_RX_UUID.u, + .access_cb = rx_access, + .flags = BLE_GATT_CHR_F_WRITE | BLE_GATT_CHR_F_WRITE_NO_RSP | + BLE_GATT_CHR_F_WRITE_ENC | BLE_GATT_CHR_F_WRITE_AUTHEN, + }, + { + .uuid = &NUS_TX_UUID.u, + .access_cb = tx_access, + .val_handle = &s_tx_attr_handle, + .flags = BLE_GATT_CHR_F_READ | BLE_GATT_CHR_F_NOTIFY | BLE_GATT_CHR_F_READ_ENC | + BLE_GATT_CHR_F_READ_AUTHEN, + }, + {0}, + }, + }, + {0}, +}; + +esp_err_t meshcore_gatt_init(const char *name_prefix, uint32_t pin) { + if (name_prefix == NULL) { + return ESP_ERR_INVALID_ARG; + } + if (s_is_running) { + return ESP_ERR_INVALID_STATE; + } + if (bluetooth_service_is_running()) { + ESP_LOGE(TAG, "bluetooth_service already owns NimBLE — refuse init"); + return ESP_ERR_INVALID_STATE; + } + + esp_err_t ret = meshcore_transport_init(); + if (ret != ESP_OK) { + return ret; + } + + ret = nvs_flash_init(); + if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) { + nvs_flash_erase(); + ret = nvs_flash_init(); + } + if (ret != ESP_OK) { + ESP_LOGE(TAG, "NVS init failed: %s", esp_err_to_name(ret)); + return ret; + } + + s_passkey = pin; + s_is_connected = false; + s_is_subscribed = false; + s_conn_handle = BLE_HS_CONN_HANDLE_NONE; + + uint8_t mac[6] = {0}; + esp_efuse_mac_get_default(mac); + snprintf(s_device_name, sizeof(s_device_name), "%s-%02X%02X", name_prefix, mac[4], mac[5]); + + ret = nimble_port_init(); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "nimble_port_init failed: %s", esp_err_to_name(ret)); + return ret; + } + + ble_hs_cfg.sm_io_cap = BLE_SM_IO_CAP_DISP_ONLY; + ble_hs_cfg.sm_bonding = 1; + ble_hs_cfg.sm_mitm = 1; + ble_hs_cfg.sm_sc = 1; + ble_hs_cfg.sm_our_key_dist = BLE_SM_PAIR_KEY_DIST_ENC | BLE_SM_PAIR_KEY_DIST_ID; + ble_hs_cfg.sm_their_key_dist = BLE_SM_PAIR_KEY_DIST_ENC | BLE_SM_PAIR_KEY_DIST_ID; + ble_hs_cfg.reset_cb = on_reset; + ble_hs_cfg.sync_cb = on_sync; + ble_hs_cfg.store_status_cb = ble_store_util_status_rr; + + ble_svc_gap_init(); + ble_svc_gatt_init(); + ble_svc_gap_device_name_set(s_device_name); + + int rc = ble_gatts_count_cfg(GATT_SERVICES); + if (rc != 0) { + ESP_LOGE(TAG, "ble_gatts_count_cfg failed rc=%d", rc); + return ESP_FAIL; + } + rc = ble_gatts_add_svcs(GATT_SERVICES); + if (rc != 0) { + ESP_LOGE(TAG, "ble_gatts_add_svcs failed rc=%d", rc); + return ESP_FAIL; + } + + ble_att_set_preferred_mtu(MCORE_PREFERRED_MTU); + ble_store_config_init(); + nimble_port_freertos_init(host_task); + + s_is_running = true; + ESP_LOGI(TAG, "Initialized — name='%s' PIN=%lu", s_device_name, (unsigned long)pin); + return ESP_OK; +} + +void meshcore_gatt_stop(void) { + if (!s_is_running) { + return; + } + ble_gap_adv_stop(); + if (s_is_connected && s_conn_handle != BLE_HS_CONN_HANDLE_NONE) { + ble_gap_terminate(s_conn_handle, BLE_ERR_REM_USER_CONN_TERM); + } + nimble_port_stop(); + s_is_running = false; + s_is_connected = false; + s_is_subscribed = false; + s_conn_handle = BLE_HS_CONN_HANDLE_NONE; + meshcore_transport_reset(); +} + +bool meshcore_gatt_is_running(void) { + return s_is_running; +} + +bool meshcore_gatt_is_connected(void) { + return s_is_connected; +} + +bool meshcore_gatt_is_subscribed(void) { + return s_is_subscribed; +} + +void meshcore_gatt_notify(const uint8_t *frame, uint16_t len) { + if (frame == NULL || len == 0) { + return; + } + if (!s_is_connected || s_tx_attr_handle == 0) { + return; + } + struct os_mbuf *om = ble_hs_mbuf_from_flat(frame, len); + if (om == NULL) { + ESP_LOGW(TAG, "mbuf alloc failed (%u bytes)", len); + return; + } + int rc = ble_gatts_notify_custom(s_conn_handle, s_tx_attr_handle, om); + if (rc != 0) { + ESP_LOGW(TAG, "notify failed rc=%d", rc); + } +} + +static int rx_access(uint16_t conn, uint16_t attr, struct ble_gatt_access_ctxt *ctxt, void *arg) { + (void)conn; + (void)attr; + (void)arg; + if (ctxt->op != BLE_GATT_ACCESS_OP_WRITE_CHR) { + return BLE_ATT_ERR_UNLIKELY; + } + uint16_t len = OS_MBUF_PKTLEN(ctxt->om); + if (len == 0 || len > sizeof(s_rx_buf)) { + return 0; + } + os_mbuf_copydata(ctxt->om, 0, len, s_rx_buf); + meshcore_transport_send_to_p4(s_rx_buf, len); + return 0; +} + +static int tx_access(uint16_t conn, uint16_t attr, struct ble_gatt_access_ctxt *ctxt, void *arg) { + (void)conn; + (void)attr; + (void)ctxt; + (void)arg; + return 0; +} + +static int gap_event(struct ble_gap_event *event, void *arg) { + (void)arg; + switch (event->type) { + case BLE_GAP_EVENT_CONNECT: + if (event->connect.status == 0) { + s_conn_handle = event->connect.conn_handle; + s_is_connected = true; + s_is_subscribed = false; + ESP_LOGI(TAG, "Client connected handle=%u", s_conn_handle); + ble_gattc_exchange_mtu(s_conn_handle, NULL, NULL); + } else { + ESP_LOGW(TAG, "Connect failed status=%d", event->connect.status); + advertise_start(); + } + break; + + case BLE_GAP_EVENT_DISCONNECT: + ESP_LOGI(TAG, "Client disconnected reason=0x%x", event->disconnect.reason); + s_conn_handle = BLE_HS_CONN_HANDLE_NONE; + s_is_connected = false; + s_is_subscribed = false; + meshcore_transport_reset(); + advertise_start(); + break; + + case BLE_GAP_EVENT_MTU: + ESP_LOGI(TAG, "MTU updated to %u", event->mtu.value); + break; + + case BLE_GAP_EVENT_SUBSCRIBE: + if (event->subscribe.attr_handle == s_tx_attr_handle) { + s_is_subscribed = (event->subscribe.cur_notify != 0); + ESP_LOGI(TAG, "TX subscribe=%d", s_is_subscribed); + } + break; + + case BLE_GAP_EVENT_ENC_CHANGE: + ESP_LOGI(TAG, "Encryption status=%d", event->enc_change.status); + break; + + case BLE_GAP_EVENT_PASSKEY_ACTION: + if (event->passkey.params.action == BLE_SM_IOACT_DISP) { + struct ble_sm_io pk = { + .action = BLE_SM_IOACT_DISP, + .passkey = s_passkey, + }; + ble_sm_inject_io(event->passkey.conn_handle, &pk); + ESP_LOGI(TAG, "Displaying passkey: %lu", (unsigned long)s_passkey); + } + break; + + case BLE_GAP_EVENT_REPEAT_PAIRING: { + struct ble_gap_conn_desc desc; + if (ble_gap_conn_find(event->repeat_pairing.conn_handle, &desc) != 0) { + return BLE_GAP_REPEAT_PAIRING_IGNORE; + } + ble_store_util_delete_peer(&desc.peer_id_addr); + return BLE_GAP_REPEAT_PAIRING_RETRY; + } + + default: + break; + } + return 0; +} + +static void advertise_start(void) { + struct ble_gap_adv_params adv = { + .conn_mode = BLE_GAP_CONN_MODE_UND, + .disc_mode = BLE_GAP_DISC_MODE_GEN, + }; + + struct ble_hs_adv_fields fields = {0}; + fields.flags = BLE_HS_ADV_F_DISC_GEN | BLE_HS_ADV_F_BREDR_UNSUP; + fields.tx_pwr_lvl_is_present = 1; + fields.tx_pwr_lvl = BLE_HS_ADV_TX_PWR_LVL_AUTO; + fields.name = (uint8_t *)s_device_name; + fields.name_len = strlen(s_device_name); + fields.name_is_complete = 1; + ble_gap_adv_set_fields(&fields); + + struct ble_hs_adv_fields rsp = {0}; + rsp.uuids128 = (ble_uuid128_t *)&NUS_SERVICE_UUID; + rsp.num_uuids128 = 1; + rsp.uuids128_is_complete = 1; + ble_gap_adv_rsp_set_fields(&rsp); + + int rc = ble_gap_adv_start(s_own_addr_type, NULL, BLE_HS_FOREVER, &adv, gap_event, NULL); + if (rc != 0 && rc != BLE_HS_EALREADY) { + ESP_LOGE(TAG, "adv_start failed rc=%d", rc); + return; + } + ESP_LOGI(TAG, "Advertising '%s' (PIN %lu)", s_device_name, (unsigned long)s_passkey); +} + +static void on_sync(void) { + ble_hs_util_ensure_addr(0); + ble_hs_id_infer_auto(0, &s_own_addr_type); + advertise_start(); +} + +static void on_reset(int reason) { + ESP_LOGW(TAG, "NimBLE reset reason=%d", reason); +} + +static void host_task(void *param) { + (void)param; + ESP_LOGI(TAG, "NimBLE host task running"); + nimble_port_run(); + nimble_port_freertos_deinit(); +} diff --git a/firmware_c5/components/Service/meshtastic/include/meshtastic_gatt.h b/firmware_c5/components/Service/meshtastic/include/meshtastic_gatt.h new file mode 100644 index 00000000..7599806a --- /dev/null +++ b/firmware_c5/components/Service/meshtastic/include/meshtastic_gatt.h @@ -0,0 +1,96 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#ifndef MESHTASTIC_GATT_H +#define MESHTASTIC_GATT_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +#include "esp_err.h" + +/** + * @brief Bring up the Meshtastic GATT peripheral on the C5. + * + * Initializes NimBLE (idempotent) with Secure Connections, MITM, and + * display-only IO capability so a fresh 6-digit passkey is generated + * per pairing. Registers the Meshtastic service UUID + * 6ba1b218-15a8-461f-9fa8-5dcae273eafd with TORADIO/FROMRADIO/FROMNUM/ + * LOGRADIO characteristics plus the standard Battery Service. Starts + * advertising as Highboy_. + * + * @param node_num Our node number. + * @return + * - ESP_OK on success + * - ESP_ERR_INVALID_STATE if already running + * - Error code from NimBLE otherwise + */ +esp_err_t meshtastic_gatt_init(uint32_t node_num); + +/** + * @brief Stop advertising and tear down the Meshtastic GATT. + */ +void meshtastic_gatt_stop(void); + +/** + * @brief Whether NimBLE is up and advertising the Meshtastic service. + */ +bool meshtastic_gatt_is_running(void); + +/** + * @brief Whether a phone is currently connected over BLE. + */ +bool meshtastic_gatt_is_connected(void); + +/** + * @brief Whether the peer is subscribed to FROMNUM notifications. + */ +bool meshtastic_gatt_is_fromnum_subscribed(void); + +/** + * @brief Whether the peer is subscribed to LOGRADIO notifications. + */ +bool meshtastic_gatt_is_logradio_subscribed(void); + +/** + * @brief Enqueue a fully assembled FromRadio frame for the BLE peer. + * + * The next FROMRADIO read returns one of these queued frames. Also + * triggers a FROMNUM notification when the peer is subscribed. + * + * @param frame FromRadio protobuf bytes (no framing). + * @param len Length of frame in bytes. + */ +void meshtastic_gatt_enqueue_fromradio(const uint8_t *frame, uint16_t len); + +/** + * @brief Notify the peer with a Logradio chunk. + * + * No-op if no subscriber is present. + * + * @param chunk Log bytes. + * @param len Length of chunk in bytes. + */ +void meshtastic_gatt_notify_log(const uint8_t *chunk, uint16_t len); + +#ifdef __cplusplus +} +#endif + +#endif // MESHTASTIC_GATT_H diff --git a/firmware_c5/components/Service/meshtastic/include/meshtastic_tcp.h b/firmware_c5/components/Service/meshtastic/include/meshtastic_tcp.h new file mode 100644 index 00000000..98d65097 --- /dev/null +++ b/firmware_c5/components/Service/meshtastic/include/meshtastic_tcp.h @@ -0,0 +1,74 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#ifndef MESHTASTIC_TCP_H +#define MESHTASTIC_TCP_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +#include "esp_err.h" + +/** + * @brief Bring up the Meshtastic TCP server on the C5. + * + * Listens on port 4403 with single-client semantics, registers an mDNS + * advertisement under _meshtastic._tcp, and uses StreamAPI framing + * (0x94 0xC3 lenhi lenlo + protobuf) on the wire. Reuses whatever AP + * the wifi_service has already brought up — does not change SSID. + * + * @param node_num Our node number, used for the mDNS instance name. + * @return + * - ESP_OK on success + * - ESP_ERR_INVALID_STATE if already running + * - Error code from socket/mdns layers otherwise + */ +esp_err_t meshtastic_tcp_init(uint32_t node_num); + +/** + * @brief Tear down the Meshtastic TCP server. + */ +void meshtastic_tcp_stop(void); + +/** + * @brief Whether the listening socket is open. + */ +bool meshtastic_tcp_is_running(void); + +/** + * @brief Number of connected TCP clients (0 or 1). + */ +uint8_t meshtastic_tcp_get_client_count(void); + +/** + * @brief Send a FromRadio frame to the connected TCP client. + * + * Adds StreamAPI framing (0x94 0xC3 lenhi lenlo) and writes to the + * socket. No-op if no client is connected. + * + * @param frame FromRadio protobuf bytes (no framing). + * @param len Length of frame in bytes. + */ +void meshtastic_tcp_send_fromradio(const uint8_t *frame, uint16_t len); + +#ifdef __cplusplus +} +#endif + +#endif // MESHTASTIC_TCP_H diff --git a/firmware_c5/components/Service/meshtastic/meshtastic_gatt.c b/firmware_c5/components/Service/meshtastic/meshtastic_gatt.c new file mode 100644 index 00000000..f5a1f70c --- /dev/null +++ b/firmware_c5/components/Service/meshtastic/meshtastic_gatt.c @@ -0,0 +1,546 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#include "meshtastic_gatt.h" + +#include +#include + +#include "esp_log.h" +#include "esp_random.h" +#include "freertos/FreeRTOS.h" +#include "freertos/semphr.h" +#include "freertos/task.h" +#include "host/ble_gap.h" +#include "host/ble_gatt.h" +#include "host/ble_hs.h" +#include "host/ble_uuid.h" +#include "host/util/util.h" +#include "nimble/nimble_port.h" +#include "nimble/nimble_port_freertos.h" +#include "nvs_flash.h" +#include "services/gap/ble_svc_gap.h" +#include "services/gatt/ble_svc_gatt.h" + +#include "bluetooth_service.h" +#include "meshtastic_transport.h" + +extern void ble_store_config_init(void); + +static const char *TAG = "MESH_GATT"; + +#define GATT_PREFERRED_MTU 512 +#define GATT_PASSKEY_MIN 100000 +#define GATT_PASSKEY_RANGE 900000 +#define GATT_FROMRADIO_QUEUE_SLOTS 64 +#define GATT_FROMRADIO_FRAME_MAX 512 +#define GATT_BATTERY_STUB_PCT 87 +#define GATT_DEVICE_NAME_LEN 32 +#define GATT_QUEUE_MUTEX_TIMEOUT_MS 50 + +static const ble_uuid128_t MESH_SERVICE_UUID = BLE_UUID128_INIT( + 0xfd, 0xea, 0x73, 0xe2, 0xca, 0x5d, 0xa8, 0x9f, 0x1f, 0x46, 0xa8, 0x15, 0x18, 0xb2, 0xa1, 0x6b); +static const ble_uuid128_t FROMRADIO_UUID = BLE_UUID128_INIT( + 0x02, 0x00, 0x12, 0xac, 0x42, 0x02, 0x78, 0xb8, 0xed, 0x11, 0x93, 0x49, 0x9e, 0xe6, 0x55, 0x2c); +static const ble_uuid128_t TORADIO_UUID = BLE_UUID128_INIT( + 0xe7, 0x01, 0x44, 0x12, 0x66, 0x78, 0xdd, 0xa1, 0xad, 0x4d, 0x9e, 0x12, 0xd2, 0x76, 0x5c, 0xf7); +static const ble_uuid128_t FROMNUM_UUID = BLE_UUID128_INIT( + 0x53, 0x44, 0xe3, 0x47, 0x75, 0xaa, 0x70, 0xa6, 0x66, 0x4f, 0x00, 0xa8, 0x8c, 0xa1, 0x9d, 0xed); +static const ble_uuid128_t LOGRADIO_UUID = BLE_UUID128_INIT( + 0x47, 0x95, 0xdf, 0x8c, 0xde, 0xe9, 0x44, 0x99, 0x23, 0x44, 0xe6, 0x06, 0x49, 0x6e, 0x3d, 0x5a); + +static const ble_uuid16_t BATTERY_SERVICE_UUID = BLE_UUID16_INIT(0x180F); +static const ble_uuid16_t BATTERY_LEVEL_UUID = BLE_UUID16_INIT(0x2A19); + +typedef struct { + bool is_used; + uint16_t len; + uint8_t buf[GATT_FROMRADIO_FRAME_MAX]; +} gatt_fromradio_slot_t; + +static bool s_is_running = false; +static bool s_is_connected = false; +static bool s_fromnum_subscribed = false; +static bool s_logradio_subscribed = false; +static uint16_t s_conn_handle = BLE_HS_CONN_HANDLE_NONE; +static uint16_t s_fromnum_handle = 0; +static uint16_t s_logradio_handle = 0; +static uint8_t s_own_addr_type = 0; +static uint32_t s_random_passkey = 0; +static uint8_t s_battery_level = GATT_BATTERY_STUB_PCT; +static uint32_t s_node_num = 0; +static uint8_t s_toradio_buf[GATT_FROMRADIO_FRAME_MAX]; +static gatt_fromradio_slot_t s_queue[GATT_FROMRADIO_QUEUE_SLOTS]; +static uint8_t s_queue_head = 0; +static uint8_t s_queue_tail = 0; +static SemaphoreHandle_t s_queue_mutex = NULL; + +static void advertise_start(void); +static int gap_event(struct ble_gap_event *event, void *arg); +static int +on_toradio_access(uint16_t conn, uint16_t attr, struct ble_gatt_access_ctxt *ctxt, void *arg); +static int +on_fromradio_access(uint16_t conn, uint16_t attr, struct ble_gatt_access_ctxt *ctxt, void *arg); +static int +on_fromnum_access(uint16_t conn, uint16_t attr, struct ble_gatt_access_ctxt *ctxt, void *arg); +static int +on_logradio_access(uint16_t conn, uint16_t attr, struct ble_gatt_access_ctxt *ctxt, void *arg); +static int +on_battery_level_access(uint16_t conn, uint16_t attr, struct ble_gatt_access_ctxt *ctxt, void *arg); +static void on_sync(void); +static void on_reset(int reason); +static void host_task(void *param); +static bool queue_pop_locked(uint8_t *out_buf, uint16_t *out_len); +static void queue_push_locked(const uint8_t *frame, uint16_t len); +static void notify_fromnum(uint32_t counter); + +static const struct ble_gatt_svc_def GATT_SERVICES[] = { + { + .type = BLE_GATT_SVC_TYPE_PRIMARY, + .uuid = &MESH_SERVICE_UUID.u, + .characteristics = + (struct ble_gatt_chr_def[]){ + { + .uuid = &TORADIO_UUID.u, + .access_cb = on_toradio_access, + .flags = BLE_GATT_CHR_F_WRITE | BLE_GATT_CHR_F_WRITE_NO_RSP, + }, + { + .uuid = &FROMRADIO_UUID.u, + .access_cb = on_fromradio_access, + .flags = BLE_GATT_CHR_F_READ, + }, + { + .uuid = &FROMNUM_UUID.u, + .access_cb = on_fromnum_access, + .val_handle = &s_fromnum_handle, + .flags = BLE_GATT_CHR_F_READ | BLE_GATT_CHR_F_NOTIFY, + }, + { + .uuid = &LOGRADIO_UUID.u, + .access_cb = on_logradio_access, + .val_handle = &s_logradio_handle, + .flags = BLE_GATT_CHR_F_READ | BLE_GATT_CHR_F_NOTIFY, + }, + {0}, + }, + }, + { + .type = BLE_GATT_SVC_TYPE_PRIMARY, + .uuid = &BATTERY_SERVICE_UUID.u, + .characteristics = + (struct ble_gatt_chr_def[]){ + { + .uuid = &BATTERY_LEVEL_UUID.u, + .access_cb = on_battery_level_access, + .flags = BLE_GATT_CHR_F_READ | BLE_GATT_CHR_F_NOTIFY, + }, + {0}, + }, + }, + {0}, +}; + +esp_err_t meshtastic_gatt_init(uint32_t node_num) { + if (s_is_running) { + return ESP_ERR_INVALID_STATE; + } + if (bluetooth_service_is_running()) { + ESP_LOGE(TAG, "bluetooth_service already owns NimBLE — refuse init"); + return ESP_ERR_INVALID_STATE; + } + + esp_err_t ret = meshtastic_transport_init(); + if (ret != ESP_OK) { + return ret; + } + + ret = nvs_flash_init(); + if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) { + nvs_flash_erase(); + ret = nvs_flash_init(); + } + if (ret != ESP_OK) { + ESP_LOGE(TAG, "NVS init failed: %s", esp_err_to_name(ret)); + return ret; + } + + s_node_num = node_num; + s_is_connected = false; + s_fromnum_subscribed = false; + s_logradio_subscribed = false; + s_conn_handle = BLE_HS_CONN_HANDLE_NONE; + memset(s_queue, 0, sizeof(s_queue)); + s_queue_head = 0; + s_queue_tail = 0; + + if (s_queue_mutex == NULL) { + s_queue_mutex = xSemaphoreCreateMutex(); + if (s_queue_mutex == NULL) { + ESP_LOGE(TAG, "Failed to create queue mutex"); + return ESP_ERR_NO_MEM; + } + } + + ret = nimble_port_init(); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "nimble_port_init failed: %s", esp_err_to_name(ret)); + return ret; + } + + ble_hs_cfg.sm_io_cap = BLE_SM_IO_CAP_DISP_ONLY; + ble_hs_cfg.sm_bonding = 1; + ble_hs_cfg.sm_mitm = 1; + ble_hs_cfg.sm_sc = 1; + ble_hs_cfg.sm_our_key_dist = BLE_SM_PAIR_KEY_DIST_ENC | BLE_SM_PAIR_KEY_DIST_ID; + ble_hs_cfg.sm_their_key_dist = BLE_SM_PAIR_KEY_DIST_ENC | BLE_SM_PAIR_KEY_DIST_ID; + ble_hs_cfg.reset_cb = on_reset; + ble_hs_cfg.sync_cb = on_sync; + ble_hs_cfg.store_status_cb = ble_store_util_status_rr; + + char name[GATT_DEVICE_NAME_LEN]; + snprintf(name, sizeof(name), "Highboy_%04lx", (unsigned long)(node_num & 0xFFFF)); + ble_svc_gap_device_name_set(name); + + ble_svc_gap_init(); + ble_svc_gatt_init(); + + int rc = ble_gatts_count_cfg(GATT_SERVICES); + if (rc != 0) { + ESP_LOGE(TAG, "ble_gatts_count_cfg failed rc=%d", rc); + return ESP_FAIL; + } + rc = ble_gatts_add_svcs(GATT_SERVICES); + if (rc != 0) { + ESP_LOGE(TAG, "ble_gatts_add_svcs failed rc=%d", rc); + return ESP_FAIL; + } + + ble_store_config_init(); + nimble_port_freertos_init(host_task); + + s_is_running = true; + ESP_LOGI(TAG, "Initialized — name='%s'", name); + return ESP_OK; +} + +void meshtastic_gatt_stop(void) { + if (!s_is_running) { + return; + } + ble_gap_adv_stop(); + if (s_is_connected && s_conn_handle != BLE_HS_CONN_HANDLE_NONE) { + ble_gap_terminate(s_conn_handle, BLE_ERR_REM_USER_CONN_TERM); + } + nimble_port_stop(); + s_is_running = false; + s_is_connected = false; + s_fromnum_subscribed = false; + s_logradio_subscribed = false; + s_conn_handle = BLE_HS_CONN_HANDLE_NONE; + meshtastic_transport_reset(); +} + +bool meshtastic_gatt_is_running(void) { + return s_is_running; +} + +bool meshtastic_gatt_is_connected(void) { + return s_is_connected; +} + +bool meshtastic_gatt_is_fromnum_subscribed(void) { + return s_fromnum_subscribed; +} + +bool meshtastic_gatt_is_logradio_subscribed(void) { + return s_logradio_subscribed; +} + +void meshtastic_gatt_enqueue_fromradio(const uint8_t *frame, uint16_t len) { + if (frame == NULL || len == 0 || len > GATT_FROMRADIO_FRAME_MAX) { + return; + } + if (s_queue_mutex == NULL) { + return; + } + if (xSemaphoreTake(s_queue_mutex, pdMS_TO_TICKS(GATT_QUEUE_MUTEX_TIMEOUT_MS)) != pdTRUE) { + return; + } + queue_push_locked(frame, len); + xSemaphoreGive(s_queue_mutex); + + if (s_is_connected && s_fromnum_subscribed) { + notify_fromnum(meshtastic_transport_bump_fromnum()); + } +} + +void meshtastic_gatt_notify_log(const uint8_t *chunk, uint16_t len) { + if (chunk == NULL || len == 0) { + return; + } + if (!s_is_connected || !s_logradio_subscribed || s_logradio_handle == 0) { + return; + } + struct os_mbuf *om = ble_hs_mbuf_from_flat(chunk, len); + if (om != NULL) { + ble_gatts_notify_custom(s_conn_handle, s_logradio_handle, om); + } +} + +static int +on_toradio_access(uint16_t conn, uint16_t attr, struct ble_gatt_access_ctxt *ctxt, void *arg) { + (void)conn; + (void)attr; + (void)arg; + if (ctxt->op != BLE_GATT_ACCESS_OP_WRITE_CHR) { + return BLE_ATT_ERR_UNLIKELY; + } + uint16_t len = OS_MBUF_PKTLEN(ctxt->om); + if (len == 0 || len > sizeof(s_toradio_buf)) { + return 0; + } + os_mbuf_copydata(ctxt->om, 0, len, s_toradio_buf); + meshtastic_transport_send_toradio(s_toradio_buf, len); + return 0; +} + +static int +on_fromradio_access(uint16_t conn, uint16_t attr, struct ble_gatt_access_ctxt *ctxt, void *arg) { + (void)conn; + (void)attr; + (void)arg; + if (ctxt->op != BLE_GATT_ACCESS_OP_READ_CHR) { + return BLE_ATT_ERR_UNLIKELY; + } + if (s_queue_mutex == NULL) { + return 0; + } + if (xSemaphoreTake(s_queue_mutex, pdMS_TO_TICKS(GATT_QUEUE_MUTEX_TIMEOUT_MS)) != pdTRUE) { + return 0; + } + uint8_t out[GATT_FROMRADIO_FRAME_MAX]; + uint16_t out_len = 0; + if (queue_pop_locked(out, &out_len)) { + os_mbuf_append(ctxt->om, out, out_len); + } + xSemaphoreGive(s_queue_mutex); + return 0; +} + +static int +on_fromnum_access(uint16_t conn, uint16_t attr, struct ble_gatt_access_ctxt *ctxt, void *arg) { + (void)conn; + (void)attr; + (void)arg; + if (ctxt->op == BLE_GATT_ACCESS_OP_READ_CHR) { + spi_mesh_status_t status; + meshtastic_transport_get_status(&status); + os_mbuf_append(ctxt->om, &status.fromnum_counter, sizeof(status.fromnum_counter)); + } + return 0; +} + +static int +on_logradio_access(uint16_t conn, uint16_t attr, struct ble_gatt_access_ctxt *ctxt, void *arg) { + (void)conn; + (void)attr; + (void)arg; + (void)ctxt; + return 0; +} + +static int on_battery_level_access(uint16_t conn, + uint16_t attr, + struct ble_gatt_access_ctxt *ctxt, + void *arg) { + (void)conn; + (void)attr; + (void)arg; + if (ctxt->op == BLE_GATT_ACCESS_OP_READ_CHR) { + os_mbuf_append(ctxt->om, &s_battery_level, 1); + } + return 0; +} + +static int gap_event(struct ble_gap_event *event, void *arg) { + (void)arg; + switch (event->type) { + case BLE_GAP_EVENT_CONNECT: + if (event->connect.status == 0) { + s_conn_handle = event->connect.conn_handle; + s_is_connected = true; + s_fromnum_subscribed = false; + s_logradio_subscribed = false; + ESP_LOGI(TAG, "Client connected handle=%u", s_conn_handle); + ble_att_set_preferred_mtu(GATT_PREFERRED_MTU); + } else { + ESP_LOGW(TAG, "Connection failed status=%d", event->connect.status); + advertise_start(); + } + break; + + case BLE_GAP_EVENT_DISCONNECT: + ESP_LOGI(TAG, "Client disconnected reason=0x%x", event->disconnect.reason); + s_conn_handle = BLE_HS_CONN_HANDLE_NONE; + s_is_connected = false; + s_fromnum_subscribed = false; + s_logradio_subscribed = false; + meshtastic_transport_reset(); + advertise_start(); + break; + + case BLE_GAP_EVENT_MTU: + ESP_LOGI(TAG, "MTU updated to %u", event->mtu.value); + break; + + case BLE_GAP_EVENT_SUBSCRIBE: + if (event->subscribe.attr_handle == s_fromnum_handle) { + s_fromnum_subscribed = (event->subscribe.cur_notify != 0); + } + if (event->subscribe.attr_handle == s_logradio_handle) { + s_logradio_subscribed = (event->subscribe.cur_notify != 0); + } + break; + + case BLE_GAP_EVENT_ENC_CHANGE: + ESP_LOGI(TAG, "Encryption status=%d", event->enc_change.status); + break; + + case BLE_GAP_EVENT_PASSKEY_ACTION: + if (event->passkey.params.action == BLE_SM_IOACT_DISP) { + s_random_passkey = GATT_PASSKEY_MIN + (esp_random() % GATT_PASSKEY_RANGE); + struct ble_sm_io pk = { + .action = BLE_SM_IOACT_DISP, + .passkey = s_random_passkey, + }; + ble_sm_inject_io(event->passkey.conn_handle, &pk); + ESP_LOGI(TAG, "========================================"); + ESP_LOGI(TAG, " BLE pairing PIN: %lu", (unsigned long)s_random_passkey); + ESP_LOGI(TAG, "========================================"); + } + break; + + case BLE_GAP_EVENT_REPEAT_PAIRING: { + struct ble_gap_conn_desc desc; + if (ble_gap_conn_find(event->repeat_pairing.conn_handle, &desc) != 0) { + return BLE_GAP_REPEAT_PAIRING_IGNORE; + } + ble_store_util_delete_peer(&desc.peer_id_addr); + return BLE_GAP_REPEAT_PAIRING_RETRY; + } + + default: + break; + } + return 0; +} + +static void advertise_start(void) { + struct ble_gap_adv_params adv = { + .conn_mode = BLE_GAP_CONN_MODE_UND, + .disc_mode = BLE_GAP_DISC_MODE_GEN, + }; + + struct ble_hs_adv_fields fields = {0}; + fields.flags = BLE_HS_ADV_F_DISC_GEN | BLE_HS_ADV_F_BREDR_UNSUP; + fields.uuids128 = (ble_uuid128_t *)&MESH_SERVICE_UUID; + fields.num_uuids128 = 1; + fields.uuids128_is_complete = 1; + ble_gap_adv_set_fields(&fields); + + struct ble_hs_adv_fields rsp = {0}; + rsp.name = (uint8_t *)ble_svc_gap_device_name(); + rsp.name_len = strlen(ble_svc_gap_device_name()); + rsp.name_is_complete = 1; + ble_gap_adv_rsp_set_fields(&rsp); + + int rc = ble_gap_adv_start(s_own_addr_type, NULL, BLE_HS_FOREVER, &adv, gap_event, NULL); + if (rc != 0 && rc != BLE_HS_EALREADY) { + ESP_LOGE(TAG, "adv_start failed rc=%d", rc); + return; + } + ESP_LOGI(TAG, "Advertising as '%s'", ble_svc_gap_device_name()); +} + +static void on_sync(void) { + ble_hs_util_ensure_addr(0); + ble_hs_id_infer_auto(0, &s_own_addr_type); + + uint8_t mac[6]; + ble_hs_id_copy_addr(s_own_addr_type, mac, NULL); + ESP_LOGI(TAG, + "BLE addr %02x:%02x:%02x:%02x:%02x:%02x type=%u", + mac[5], + mac[4], + mac[3], + mac[2], + mac[1], + mac[0], + s_own_addr_type); + + advertise_start(); +} + +static void on_reset(int reason) { + ESP_LOGW(TAG, "NimBLE reset reason=%d", reason); +} + +static void host_task(void *param) { + (void)param; + ESP_LOGI(TAG, "NimBLE host task running"); + nimble_port_run(); + nimble_port_freertos_deinit(); +} + +static bool queue_pop_locked(uint8_t *out_buf, uint16_t *out_len) { + gatt_fromradio_slot_t *slot = &s_queue[s_queue_head]; + if (!slot->is_used) { + if (out_len != NULL) { + *out_len = 0; + } + return false; + } + if (out_len != NULL) { + *out_len = slot->len; + } + if (out_buf != NULL && slot->len > 0) { + memcpy(out_buf, slot->buf, slot->len); + } + slot->is_used = false; + s_queue_head = (uint8_t)((s_queue_head + 1) % GATT_FROMRADIO_QUEUE_SLOTS); + return true; +} + +static void queue_push_locked(const uint8_t *frame, uint16_t len) { + gatt_fromradio_slot_t *slot = &s_queue[s_queue_tail]; + if (slot->is_used) { + s_queue_head = (uint8_t)((s_queue_head + 1) % GATT_FROMRADIO_QUEUE_SLOTS); + } + slot->len = len; + memcpy(slot->buf, frame, len); + slot->is_used = true; + s_queue_tail = (uint8_t)((s_queue_tail + 1) % GATT_FROMRADIO_QUEUE_SLOTS); +} + +static void notify_fromnum(uint32_t counter) { + if (s_fromnum_handle == 0 || s_conn_handle == BLE_HS_CONN_HANDLE_NONE) { + return; + } + struct os_mbuf *om = ble_hs_mbuf_from_flat(&counter, sizeof(counter)); + if (om != NULL) { + ble_gatts_notify_custom(s_conn_handle, s_fromnum_handle, om); + } +} diff --git a/firmware_c5/components/Service/meshtastic/meshtastic_tcp.c b/firmware_c5/components/Service/meshtastic/meshtastic_tcp.c new file mode 100644 index 00000000..6728272c --- /dev/null +++ b/firmware_c5/components/Service/meshtastic/meshtastic_tcp.c @@ -0,0 +1,311 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#include "meshtastic_tcp.h" + +#include +#include +#include + +#include "esp_log.h" +#include "freertos/FreeRTOS.h" +#include "freertos/semphr.h" +#include "freertos/task.h" +#include "lwip/sockets.h" +#include "mdns.h" + +#include "meshtastic_transport.h" + +static const char *TAG = "MESH_TCP"; + +#define TCP_PORT 4403 +#define TCP_TASK_STACK 4096 +#define TCP_TASK_PRIO 5 +#define TCP_TASK_TICK_MS 50 +#define TCP_RX_BUF_SIZE 512 +#define TCP_FRAME_MAX 512 +#define TCP_HEADER_LEN 4 +#define TCP_FRAME_START1 0x94 +#define TCP_FRAME_START2 0xC3 +#define TCP_SEND_MUTEX_TIMEOUT_MS 100 +#define TCP_HOSTNAME_LEN 32 +#define TCP_INSTANCE_LEN 32 + +static volatile bool s_is_running = false; +static int s_server_fd = -1; +static int s_client_fd = -1; +static uint32_t s_node_num = 0; +static TaskHandle_t s_task_handle = NULL; +static SemaphoreHandle_t s_send_mutex = NULL; +static uint8_t s_rx_assembly[TCP_FRAME_MAX]; +static uint16_t s_rx_assembly_len = 0; +static uint16_t s_rx_expected_len = 0; +static uint8_t s_rx_state = 0; + +static void tcp_task(void *pvParameters); +static esp_err_t open_listener(void); +static void close_listener(void); +static void accept_client(void); +static void close_client(void); +static void drain_recv(void); +static void feed_rx_byte(uint8_t b); +static esp_err_t register_mdns(void); + +esp_err_t meshtastic_tcp_init(uint32_t node_num) { + if (s_is_running) { + return ESP_ERR_INVALID_STATE; + } + s_node_num = node_num; + s_rx_state = 0; + s_rx_assembly_len = 0; + s_rx_expected_len = 0; + + esp_err_t ret = meshtastic_transport_init(); + if (ret != ESP_OK) { + return ret; + } + + if (s_send_mutex == NULL) { + s_send_mutex = xSemaphoreCreateMutex(); + if (s_send_mutex == NULL) { + ESP_LOGE(TAG, "Failed to create send mutex"); + return ESP_ERR_NO_MEM; + } + } + + ret = open_listener(); + if (ret != ESP_OK) { + return ret; + } + + if (register_mdns() != ESP_OK) { + ESP_LOGW(TAG, "mDNS registration failed (continuing)"); + } + + s_is_running = true; + BaseType_t ok = + xTaskCreate(tcp_task, "mesh_tcp", TCP_TASK_STACK, NULL, TCP_TASK_PRIO, &s_task_handle); + if (ok != pdPASS) { + s_is_running = false; + close_listener(); + ESP_LOGE(TAG, "Failed to create tcp task"); + return ESP_ERR_NO_MEM; + } + + ESP_LOGI(TAG, "TCP listening on port %d", TCP_PORT); + return ESP_OK; +} + +void meshtastic_tcp_stop(void) { + if (!s_is_running) { + return; + } + s_is_running = false; + close_client(); + close_listener(); + mdns_service_remove("_meshtastic", "_tcp"); +} + +bool meshtastic_tcp_is_running(void) { + return s_is_running; +} + +uint8_t meshtastic_tcp_get_client_count(void) { + return (s_client_fd >= 0) ? 1 : 0; +} + +void meshtastic_tcp_send_fromradio(const uint8_t *frame, uint16_t len) { + if (frame == NULL || len == 0 || len > TCP_FRAME_MAX) { + return; + } + if (s_client_fd < 0 || s_send_mutex == NULL) { + return; + } + if (xSemaphoreTake(s_send_mutex, pdMS_TO_TICKS(TCP_SEND_MUTEX_TIMEOUT_MS)) != pdTRUE) { + return; + } + + uint8_t header[TCP_HEADER_LEN]; + header[0] = TCP_FRAME_START1; + header[1] = TCP_FRAME_START2; + header[2] = (uint8_t)(len >> 8); + header[3] = (uint8_t)(len & 0xFF); + + int fd = s_client_fd; + if (fd >= 0) { + if (send(fd, header, TCP_HEADER_LEN, 0) < 0 || send(fd, frame, len, 0) < 0) { + ESP_LOGW(TAG, "send failed errno=%d", errno); + close_client(); + } + } + + xSemaphoreGive(s_send_mutex); +} + +static void tcp_task(void *pvParameters) { + (void)pvParameters; + while (s_is_running) { + if (s_client_fd < 0) { + accept_client(); + } else { + drain_recv(); + } + vTaskDelay(pdMS_TO_TICKS(TCP_TASK_TICK_MS)); + } + s_task_handle = NULL; + vTaskDelete(NULL); +} + +static esp_err_t open_listener(void) { + s_server_fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); + if (s_server_fd < 0) { + ESP_LOGE(TAG, "socket() failed errno=%d", errno); + return ESP_FAIL; + } + + int opt = 1; + setsockopt(s_server_fd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)); + + struct sockaddr_in addr = { + .sin_family = AF_INET, + .sin_port = htons(TCP_PORT), + .sin_addr.s_addr = INADDR_ANY, + }; + + if (bind(s_server_fd, (struct sockaddr *)&addr, sizeof(addr)) < 0) { + ESP_LOGE(TAG, "bind() failed errno=%d", errno); + close(s_server_fd); + s_server_fd = -1; + return ESP_FAIL; + } + if (listen(s_server_fd, 1) < 0) { + ESP_LOGE(TAG, "listen() failed errno=%d", errno); + close(s_server_fd); + s_server_fd = -1; + return ESP_FAIL; + } + + int flags = fcntl(s_server_fd, F_GETFL, 0); + fcntl(s_server_fd, F_SETFL, flags | O_NONBLOCK); + return ESP_OK; +} + +static void close_listener(void) { + if (s_server_fd >= 0) { + close(s_server_fd); + s_server_fd = -1; + } +} + +static void accept_client(void) { + struct sockaddr_in client_addr; + socklen_t addr_len = sizeof(client_addr); + int fd = accept(s_server_fd, (struct sockaddr *)&client_addr, &addr_len); + if (fd < 0) { + return; + } + int flags = fcntl(fd, F_GETFL, 0); + fcntl(fd, F_SETFL, flags | O_NONBLOCK); + s_client_fd = fd; + s_rx_state = 0; + s_rx_assembly_len = 0; + s_rx_expected_len = 0; + ESP_LOGI(TAG, "Client connected from %s", inet_ntoa(client_addr.sin_addr)); +} + +static void close_client(void) { + if (s_client_fd >= 0) { + close(s_client_fd); + s_client_fd = -1; + ESP_LOGI(TAG, "Client closed"); + } + s_rx_state = 0; + s_rx_assembly_len = 0; + s_rx_expected_len = 0; +} + +static void drain_recv(void) { + uint8_t rx_buf[TCP_RX_BUF_SIZE]; + int n = recv(s_client_fd, rx_buf, sizeof(rx_buf), 0); + if (n > 0) { + for (int i = 0; i < n; i++) { + feed_rx_byte(rx_buf[i]); + } + return; + } + if (n == 0) { + close_client(); + return; + } + if (errno == EAGAIN || errno == EWOULDBLOCK) { + return; + } + ESP_LOGW(TAG, "recv error errno=%d", errno); + close_client(); +} + +static void feed_rx_byte(uint8_t b) { + switch (s_rx_state) { + case 0: + if (b == TCP_FRAME_START1) { + s_rx_state = 1; + } + break; + case 1: + if (b == TCP_FRAME_START2) { + s_rx_state = 2; + } else { + s_rx_state = (b == TCP_FRAME_START1) ? 1 : 0; + } + break; + case 2: + s_rx_expected_len = (uint16_t)b << 8; + s_rx_state = 3; + break; + case 3: + s_rx_expected_len |= (uint16_t)b; + s_rx_assembly_len = 0; + if (s_rx_expected_len == 0 || s_rx_expected_len > TCP_FRAME_MAX) { + s_rx_state = 0; + } else { + s_rx_state = 4; + } + break; + case 4: + s_rx_assembly[s_rx_assembly_len++] = b; + if (s_rx_assembly_len >= s_rx_expected_len) { + meshtastic_transport_send_toradio(s_rx_assembly, s_rx_assembly_len); + s_rx_state = 0; + } + break; + default: + s_rx_state = 0; + break; + } +} + +static esp_err_t register_mdns(void) { + esp_err_t ret = mdns_init(); + if (ret != ESP_OK && ret != ESP_ERR_INVALID_STATE) { + return ret; + } + char hostname[TCP_HOSTNAME_LEN]; + char instance[TCP_INSTANCE_LEN]; + snprintf(hostname, sizeof(hostname), "highboy-%04lx", (unsigned long)(s_node_num & 0xFFFF)); + snprintf(instance, sizeof(instance), "Highboy_%04lx", (unsigned long)(s_node_num & 0xFFFF)); + mdns_hostname_set(hostname); + mdns_instance_name_set(instance); + return mdns_service_add(NULL, "_meshtastic", "_tcp", TCP_PORT, NULL, 0); +} diff --git a/firmware_c5/components/Service/sd_card/include/sd_card_dir.h b/firmware_c5/components/Service/sd_card/include/sd_card_dir.h index da47c0c8..e6956be8 100644 --- a/firmware_c5/components/Service/sd_card/include/sd_card_dir.h +++ b/firmware_c5/components/Service/sd_card/include/sd_card_dir.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef SD_CARD_DIR_H #define SD_CARD_DIR_H diff --git a/firmware_c5/components/Service/sd_card/include/sd_card_file.h b/firmware_c5/components/Service/sd_card/include/sd_card_file.h index 6717be02..13740188 100644 --- a/firmware_c5/components/Service/sd_card/include/sd_card_file.h +++ b/firmware_c5/components/Service/sd_card/include/sd_card_file.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef SD_CARD_FILE_H #define SD_CARD_FILE_H diff --git a/firmware_c5/components/Service/sd_card/include/sd_card_info.h b/firmware_c5/components/Service/sd_card/include/sd_card_info.h index 33146585..fdf10214 100644 --- a/firmware_c5/components/Service/sd_card/include/sd_card_info.h +++ b/firmware_c5/components/Service/sd_card/include/sd_card_info.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef SD_CARD_INFO_H #define SD_CARD_INFO_H diff --git a/firmware_c5/components/Service/sd_card/include/sd_card_init.h b/firmware_c5/components/Service/sd_card/include/sd_card_init.h index 2dfb2e30..b5cf1d6f 100644 --- a/firmware_c5/components/Service/sd_card/include/sd_card_init.h +++ b/firmware_c5/components/Service/sd_card/include/sd_card_init.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef SD_CARD_INIT_H #define SD_CARD_INIT_H diff --git a/firmware_c5/components/Service/sd_card/include/sd_card_read.h b/firmware_c5/components/Service/sd_card/include/sd_card_read.h index 973a1143..58c1e180 100644 --- a/firmware_c5/components/Service/sd_card/include/sd_card_read.h +++ b/firmware_c5/components/Service/sd_card/include/sd_card_read.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef SD_CARD_READ_H #define SD_CARD_READ_H diff --git a/firmware_c5/components/Service/sd_card/include/sd_card_write.h b/firmware_c5/components/Service/sd_card/include/sd_card_write.h index b1b9eeb1..98827110 100644 --- a/firmware_c5/components/Service/sd_card/include/sd_card_write.h +++ b/firmware_c5/components/Service/sd_card/include/sd_card_write.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef SD_CARD_WRITE_H #define SD_CARD_WRITE_H diff --git a/firmware_c5/components/Service/sd_card/sd_card_dir.c b/firmware_c5/components/Service/sd_card/sd_card_dir.c index 100f3df7..a56ecbea 100644 --- a/firmware_c5/components/Service/sd_card/sd_card_dir.c +++ b/firmware_c5/components/Service/sd_card/sd_card_dir.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "sd_card_dir.h" #include "sd_card_init.h" diff --git a/firmware_c5/components/Service/sd_card/sd_card_file.c b/firmware_c5/components/Service/sd_card/sd_card_file.c index e345b3a2..a837f477 100644 --- a/firmware_c5/components/Service/sd_card/sd_card_file.c +++ b/firmware_c5/components/Service/sd_card/sd_card_file.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "sd_card_file.h" diff --git a/firmware_c5/components/Service/sd_card/sd_card_info.c b/firmware_c5/components/Service/sd_card/sd_card_info.c index 64f04213..e340093c 100644 --- a/firmware_c5/components/Service/sd_card/sd_card_info.c +++ b/firmware_c5/components/Service/sd_card/sd_card_info.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "sd_card_info.h" diff --git a/firmware_c5/components/Service/sd_card/sd_card_init.c b/firmware_c5/components/Service/sd_card/sd_card_init.c index ef572777..64b9a8c8 100644 --- a/firmware_c5/components/Service/sd_card/sd_card_init.c +++ b/firmware_c5/components/Service/sd_card/sd_card_init.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "sd_card_init.h" diff --git a/firmware_c5/components/Service/sd_card/sd_card_read.c b/firmware_c5/components/Service/sd_card/sd_card_read.c index 0b35b9e5..eb73f8ca 100644 --- a/firmware_c5/components/Service/sd_card/sd_card_read.c +++ b/firmware_c5/components/Service/sd_card/sd_card_read.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "sd_card_read.h" diff --git a/firmware_c5/components/Service/sd_card/sd_card_write.c b/firmware_c5/components/Service/sd_card/sd_card_write.c index a5eeadd7..2be4099d 100644 --- a/firmware_c5/components/Service/sd_card/sd_card_write.c +++ b/firmware_c5/components/Service/sd_card/sd_card_write.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "sd_card_write.h" diff --git a/firmware_c5/components/Service/spi_bridge/README.md b/firmware_c5/components/Service/spi_bridge/README.md index 1abd0e21..96ac7f84 100644 --- a/firmware_c5/components/Service/spi_bridge/README.md +++ b/firmware_c5/components/Service/spi_bridge/README.md @@ -23,9 +23,44 @@ The bridge then serves these items one by one when the P4 asks for them via the - `wifi_dispatcher.c`: Logic to translate SPI IDs to WiFi driver calls. - `bt_dispatcher.c`: Logic to translate SPI IDs to NimBLE/BT calls. - `spi_slave_driver.c`: Low-level peripheral configuration. +- `session_manager.c`: Session lifecycle for long-running operations + (heartbeat watchdog + backpressure). See "Session Lifecycle" below. ## Command Range - `0x01 - 0x0F`: System/Bridge management. - `0x10 - 0x4F`: WiFi operations. - `0x50 - 0x7F`: Bluetooth operations. - `0x80 - 0x8F`: LoRa operations. +- `0xF0 - 0xFF`: Session lifecycle (heartbeat, lost, stop). + +## Session Lifecycle (Long-Running Operations) + +For full design and migration recipe, see the +[P4 README "Session Lifecycle" section](../../../../firmware_p4/components/Service/spi_bridge/README.md#session-lifecycle-long-running-operations). +The two sides share `spi_protocol.h` so the wire format is identical. + +### Slave responsibilities (this side) + +The `session_manager` runs a background watchdog that auto-kills sessions +when the master stops sending heartbeats (5s timeout). Each long-running +operation must: + +1. Call `session_manager_start(op_id, kill_cb)` from its dispatcher case + to obtain a `session_id`. The dispatcher returns this id to the master + inside an `spi_session_resp_t` response payload. +2. Provide a `kill_cb(spi_id_t)` that calls the op's `_stop()` — invoked + by the watchdog when the master goes quiet, and also when the master + sends `SPI_ID_SESSION_STOP`. +3. **Streaming ops only**: store the id in the op (e.g. via a + `_bind_session(uint32_t)` setter) and emit packets via + `session_manager_try_emit(s_session_id, data, len)` instead of raw + `spi_bridge_stream_push` — this prefixes meta and applies backpressure. + +For non-streaming ops (deauther, flood, evil_twin, beacon_spam, etc.), +the `kill_cb` lives in the dispatcher itself — the op's `.c` file does +not need to know about sessions at all. + +References: +- Streaming pattern: `wifi_sniffer.c`, `ble_sniffer.c`. +- Non-streaming pattern: see the `killed_*` static functions plus the + `open_session()` / `bt_open_session()` helpers in the dispatchers. diff --git a/firmware_c5/components/Service/spi_bridge/bt_dispatcher.c b/firmware_c5/components/Service/spi_bridge/bt_dispatcher.c index 0f1354c4..cec564aa 100644 --- a/firmware_c5/components/Service/spi_bridge/bt_dispatcher.c +++ b/firmware_c5/components/Service/spi_bridge/bt_dispatcher.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "bt_dispatcher.h" @@ -21,7 +22,12 @@ #include "ble_connect_flood.h" #include "ble_scanner.h" #include "ble_sniffer.h" +#include "session_manager.h" #include "bluetooth_service.h" +#include "meshcore_gatt.h" +#include "meshcore_transport.h" +#include "meshtastic_gatt.h" +#include "meshtastic_transport.h" #include "skimmer_detector.h" #include "spi_bridge.h" #include "tracker_detector.h" @@ -33,6 +39,36 @@ static const char *TAG = "BT_DISPATCHER"; #define BT_GET_INFO_RESP_LEN 7 #define BT_MAC_LEN 6 +static void killed_ble_flood(spi_id_t id) { + (void)id; + ble_connect_flood_stop(); +} +static void killed_skimmer(spi_id_t id) { + (void)id; + skimmer_detector_stop(); +} +static void killed_tracker(spi_id_t id) { + (void)id; + tracker_detector_stop(); +} + +static spi_status_t bt_open_session(spi_id_t op_id, + session_kill_cb_t kill_cb, + uint8_t *out_resp_payload, + uint8_t *out_resp_len, + void (*rollback_stop)(void)) { + uint32_t sid = session_manager_start(op_id, kill_cb); + if (sid == SPI_SESSION_INVALID_ID) { + if (rollback_stop != NULL) + rollback_stop(); + return SPI_STATUS_ERROR; + } + spi_session_resp_t resp = {.session_id = sid}; + memcpy(out_resp_payload, &resp, sizeof(resp)); + *out_resp_len = sizeof(resp); + return SPI_STATUS_OK; +} + spi_status_t bt_dispatcher_execute(spi_id_t id, const uint8_t *payload, uint8_t len, @@ -75,29 +111,124 @@ spi_status_t bt_dispatcher_execute(spi_id_t id, case SPI_ID_BT_APP_SCANNER: return ble_scanner_start() ? SPI_STATUS_OK : SPI_STATUS_BUSY; - case SPI_ID_BT_APP_SNIFFER: - return (ble_sniffer_start() == ESP_OK) ? SPI_STATUS_OK : SPI_STATUS_ERROR; + case SPI_ID_BT_APP_SNIFFER: { + if (ble_sniffer_start() != ESP_OK) + return SPI_STATUS_ERROR; + uint32_t sid = session_manager_start(SPI_ID_BT_APP_SNIFFER, ble_sniffer_session_killed); + if (sid == SPI_SESSION_INVALID_ID) { + ble_sniffer_stop(); + return SPI_STATUS_ERROR; + } + ble_sniffer_bind_session(sid); + spi_session_resp_t resp = {.session_id = sid}; + memcpy(out_resp_payload, &resp, sizeof(resp)); + *out_resp_len = sizeof(resp); + return SPI_STATUS_OK; + } case SPI_ID_BT_APP_FLOOD: { if (len < BT_CONNECT_MIN_PAYLOAD) return SPI_STATUS_ERROR; - return (ble_connect_flood_start(payload, payload[BT_MAC_LEN]) == ESP_OK) ? SPI_STATUS_OK - : SPI_STATUS_ERROR; + if (ble_connect_flood_start(payload, payload[BT_MAC_LEN]) != ESP_OK) + return SPI_STATUS_ERROR; + uint32_t sid = session_manager_start(SPI_ID_BT_APP_FLOOD, killed_ble_flood); + if (sid == SPI_SESSION_INVALID_ID) { + ble_connect_flood_stop(); + return SPI_STATUS_ERROR; + } + spi_session_resp_t resp = {.session_id = sid}; + memcpy(out_resp_payload, &resp, sizeof(resp)); + *out_resp_len = sizeof(resp); + return SPI_STATUS_OK; } case SPI_ID_BT_APP_SKIMMER: - return (skimmer_detector_start() == ESP_OK) ? SPI_STATUS_OK : SPI_STATUS_ERROR; + if (skimmer_detector_start() != ESP_OK) + return SPI_STATUS_ERROR; + return bt_open_session(SPI_ID_BT_APP_SKIMMER, + killed_skimmer, + out_resp_payload, + out_resp_len, + skimmer_detector_stop); case SPI_ID_BT_APP_TRACKER: - return (tracker_detector_start() == ESP_OK) ? SPI_STATUS_OK : SPI_STATUS_ERROR; + if (tracker_detector_start() != ESP_OK) + return SPI_STATUS_ERROR; + return bt_open_session(SPI_ID_BT_APP_TRACKER, + killed_tracker, + out_resp_payload, + out_resp_len, + tracker_detector_stop); + + case SPI_ID_MESH_BLE_INIT: { + if (len < sizeof(spi_mesh_init_t)) { + return SPI_STATUS_INVALID_ARG; + } + spi_mesh_init_t req; + memcpy(&req, payload, sizeof(req)); + if (meshtastic_transport_init() != ESP_OK) { + return SPI_STATUS_ERROR; + } + esp_err_t ret = meshtastic_gatt_init(req.node_num); + if (ret == ESP_ERR_INVALID_STATE) { + return SPI_STATUS_OK; + } + return (ret == ESP_OK) ? SPI_STATUS_OK : SPI_STATUS_ERROR; + } - case SPI_ID_BT_APP_STOP: - ble_sniffer_stop(); - ble_connect_flood_stop(); - skimmer_detector_stop(); - tracker_detector_stop(); + case SPI_ID_MESH_BLE_STOP: + meshtastic_gatt_stop(); return SPI_STATUS_OK; + case SPI_ID_MESH_FROMRADIO_PUSH: + meshtastic_transport_inject_fromradio_chunk(payload, len); + return SPI_STATUS_OK; + + case SPI_ID_MESH_LOG_PUSH: + meshtastic_transport_inject_log_chunk(payload, len); + return SPI_STATUS_OK; + + case SPI_ID_MESH_STATUS: { + spi_mesh_status_t status; + meshtastic_transport_get_status(&status); + memcpy(out_resp_payload, &status, sizeof(status)); + *out_resp_len = sizeof(status); + return SPI_STATUS_OK; + } + + case SPI_ID_MCORE_BLE_INIT: { + if (len < sizeof(spi_mcore_init_t)) { + return SPI_STATUS_INVALID_ARG; + } + spi_mcore_init_t req; + memcpy(&req, payload, sizeof(req)); + req.name_prefix[sizeof(req.name_prefix) - 1] = '\0'; + if (meshcore_transport_init() != ESP_OK) { + return SPI_STATUS_ERROR; + } + esp_err_t ret = meshcore_gatt_init(req.name_prefix, req.pin); + if (ret == ESP_ERR_INVALID_STATE) { + return SPI_STATUS_OK; + } + return (ret == ESP_OK) ? SPI_STATUS_OK : SPI_STATUS_ERROR; + } + + case SPI_ID_MCORE_BLE_STOP: + meshcore_gatt_stop(); + return SPI_STATUS_OK; + + case SPI_ID_MCORE_TX_PUSH: + meshcore_transport_inject_tx_chunk(payload, len); + return SPI_STATUS_OK; + + case SPI_ID_MCORE_STATUS: { + spi_mcore_status_t status; + meshcore_transport_get_status(&status); + memcpy(out_resp_payload, &status, sizeof(status)); + *out_resp_len = sizeof(status); + return SPI_STATUS_OK; + } + default: return SPI_STATUS_ERROR; } diff --git a/firmware_c5/components/Service/spi_bridge/include/bt_dispatcher.h b/firmware_c5/components/Service/spi_bridge/include/bt_dispatcher.h index 6f81a34a..0e94776f 100644 --- a/firmware_c5/components/Service/spi_bridge/include/bt_dispatcher.h +++ b/firmware_c5/components/Service/spi_bridge/include/bt_dispatcher.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef BT_DISPATCHER_H #define BT_DISPATCHER_H diff --git a/firmware_c5/components/Service/spi_bridge/include/meshcore_transport.h b/firmware_c5/components/Service/spi_bridge/include/meshcore_transport.h new file mode 100644 index 00000000..089c7df4 --- /dev/null +++ b/firmware_c5/components/Service/spi_bridge/include/meshcore_transport.h @@ -0,0 +1,88 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#ifndef MESHCORE_TRANSPORT_H +#define MESHCORE_TRANSPORT_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +#include "esp_err.h" + +#include "spi_protocol.h" + +/** + * @brief Initialize the MeshCore transport core. + * + * Allocates internal mutexes and clears reassembly state. Idempotent. + * + * @return + * - ESP_OK on success + * - ESP_ERR_NO_MEM if mutex allocation fails + */ +esp_err_t meshcore_transport_init(void); + +/** + * @brief Inject a TX chunk received from the P4 over SPI. + * + * Reassembles by seq. When the last chunk arrives, fans out the + * assembled frame to the BLE NUS TX characteristic via + * meshcore_gatt_notify. + * + * @param payload Raw SPI command payload (chunk header + data). + * @param len Length of payload in bytes. + */ +void meshcore_transport_inject_tx_chunk(const uint8_t *payload, uint8_t len); + +/** + * @brief Forward a Companion frame received from a phone to the P4. + * + * Splits the frame into chunks of up to SPI_MESH_CHUNK_PAYLOAD_MAX bytes + * and pushes them via spi_bridge stream SPI_ID_MCORE_RX_STREAM for the + * P4 to reassemble and feed meshcore_phoneapi_on_inbound. + * + * @param frame Companion frame bytes (1-byte tag + payload). + * @param len Length in bytes. + * @return true if all chunks were enqueued, false if the stream queue + * filled up. + */ +bool meshcore_transport_send_to_p4(const uint8_t *frame, uint16_t len); + +/** + * @brief Fill a status snapshot consumed by SPI_ID_MCORE_STATUS responses. + * + * Aggregates connection state from the BLE GATT module. + * + * @param[out] out_status Destination struct. Must not be NULL. + */ +void meshcore_transport_get_status(spi_mcore_status_t *out_status); + +/** + * @brief Reset reassembly state and the seq counter. + * + * Called when the BLE transport goes offline so the next session starts + * with a clean handshake. + */ +void meshcore_transport_reset(void); + +#ifdef __cplusplus +} +#endif + +#endif // MESHCORE_TRANSPORT_H diff --git a/firmware_c5/components/Service/spi_bridge/include/meshtastic_transport.h b/firmware_c5/components/Service/spi_bridge/include/meshtastic_transport.h new file mode 100644 index 00000000..b6e31e24 --- /dev/null +++ b/firmware_c5/components/Service/spi_bridge/include/meshtastic_transport.h @@ -0,0 +1,109 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#ifndef MESHTASTIC_TRANSPORT_H +#define MESHTASTIC_TRANSPORT_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +#include "esp_err.h" + +#include "spi_protocol.h" + +/** + * @brief Initialize the Meshtastic transport core. + * + * Allocates internal mutexes and clears reassembly state. Idempotent. + * + * @return + * - ESP_OK on success + * - ESP_ERR_NO_MEM if mutex allocation fails + */ +esp_err_t meshtastic_transport_init(void); + +/** + * @brief Inject a FromRadio chunk received from the P4 over SPI. + * + * Reassembles by seq. When the last chunk arrives, increments the + * fromnum counter and fans out the assembled frame to BLE GATT + * (FROMRADIO + FROMNUM notify) and TCP (framed StreamAPI write). + * + * @param payload Raw SPI command payload (chunk header + data). + * @param len Length of payload in bytes. + */ +void meshtastic_transport_inject_fromradio_chunk(const uint8_t *payload, uint8_t len); + +/** + * @brief Inject a Logradio chunk received from the P4 over SPI. + * + * Reassembles by seq. When the last chunk arrives, dispatches the + * assembled bytes to BLE GATT LOGRADIO notify if subscribed. + * + * @param payload Raw SPI command payload (chunk header + data). + * @param len Length of payload in bytes. + */ +void meshtastic_transport_inject_log_chunk(const uint8_t *payload, uint8_t len); + +/** + * @brief Forward a ToRadio frame received from a phone to the P4. + * + * Splits the frame into chunks of up to SPI_MESH_CHUNK_PAYLOAD_MAX bytes, + * tags each with a per-pipe seq, and pushes them via spi_bridge stream + * SPI_ID_MESH_TORADIO_STREAM for the P4 to reassemble and feed phoneapi. + * + * @param frame ToRadio protobuf bytes (no transport framing). + * @param len Length of frame in bytes. + * @return true if all chunks were enqueued, false if the stream queue + * filled up. + */ +bool meshtastic_transport_send_toradio(const uint8_t *frame, uint16_t len); + +/** + * @brief Fill a status snapshot consumed by SPI_ID_MESH_STATUS responses. + * + * Aggregates connection state from the BLE GATT and TCP transports plus + * the current fromnum counter. + * + * @param[out] out_status Destination struct. Must not be NULL. + */ +void meshtastic_transport_get_status(spi_mesh_status_t *out_status); + +/** + * @brief Get and bump the fromnum counter. + * + * Internal helper used by GATT to seed FROMNUM notifications. + * + * @return The new counter value (post-increment). + */ +uint32_t meshtastic_transport_bump_fromnum(void); + +/** + * @brief Reset reassembly state and the fromnum counter. + * + * Called when both transports go offline so the next session starts + * with a clean handshake. + */ +void meshtastic_transport_reset(void); + +#ifdef __cplusplus +} +#endif + +#endif // MESHTASTIC_TRANSPORT_H diff --git a/firmware_c5/components/Service/spi_bridge/include/session_manager.h b/firmware_c5/components/Service/spi_bridge/include/session_manager.h new file mode 100644 index 00000000..47b82d5d --- /dev/null +++ b/firmware_c5/components/Service/spi_bridge/include/session_manager.h @@ -0,0 +1,100 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +/** + * @file session_manager.h + * @brief Session lifecycle for long-running SPI bridge operations on C5. + * + * Each long-running op (sniffer, deauther, evil twin, etc.) opens a session + * via session_manager_start(), emits streams via session_manager_try_emit(), + * and receives heartbeat-driven keep-alive from the P4 master. If heartbeats + * stop arriving for SESSION_TIMEOUT_MS, an internal watchdog task kills the + * session and notifies the master via SPI_ID_SESSION_LOST stream. + */ + +#ifndef SESSION_MANAGER_H +#define SESSION_MANAGER_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +#include "esp_err.h" + +#include "spi_protocol.h" + +/** Callback invoked by the watchdog when a session is auto-killed. */ +typedef void (*session_kill_cb_t)(spi_id_t op_id); + +/** + * @brief Initialize the session manager and start its watchdog task. + * + * Must be called once at boot before any operation handlers run. + */ +void session_manager_init(void); + +/** + * @brief Open a new session for a long-running operation. + * + * Closes any previous active session (calling its kill callback) before + * opening the new one. Only one session is active at a time. + * + * @param op_id SPI command ID identifying the operation. + * @param kill_cb Callback invoked if the watchdog later kills this session. + * @return New session_id (>0), or SPI_SESSION_INVALID_ID on error. + */ +uint32_t session_manager_start(spi_id_t op_id, session_kill_cb_t kill_cb); + +/** + * @brief Close a session explicitly (called from STOP handlers). + * + * @param session_id Session to close. + * @return ESP_OK if matched and closed, ESP_ERR_NOT_FOUND otherwise. + */ +esp_err_t session_manager_stop(uint32_t session_id); + +/** + * @brief Refresh the watchdog and update last-acked sequence. + * + * Called by the bridge on receipt of SPI_ID_SESSION_HEARTBEAT. + * + * @param session_id Session being heartbeated. + * @param last_acked_seq Highest stream seq the master has processed. + * @return true if heartbeat matched the active session. + */ +bool session_manager_heartbeat(uint32_t session_id, uint32_t last_acked_seq); + +/** + * @brief Attempt to emit a stream packet for the active session. + * + * Prefixes spi_stream_meta_t and emits via SPI_TYPE_STREAM. Drops the packet + * silently (with internal counter) if the master's ack window is full. + * + * @param session_id Session emitting (must match the active one). + * @param data Operation-specific payload. + * @param len Payload length (must fit SPI_MAX_PAYLOAD - sizeof(meta)). + * @return ESP_OK if emitted, ESP_ERR_INVALID_STATE if session + * is not active, ESP_ERR_NO_MEM if backpressure dropped it. + */ +esp_err_t session_manager_try_emit(uint32_t session_id, const uint8_t *data, uint8_t len); + +#ifdef __cplusplus +} +#endif + +#endif // SESSION_MANAGER_H diff --git a/firmware_c5/components/Service/spi_bridge/include/spi_bridge.h b/firmware_c5/components/Service/spi_bridge/include/spi_bridge.h index 0e392b9f..1c47afed 100644 --- a/firmware_c5/components/Service/spi_bridge/include/spi_bridge.h +++ b/firmware_c5/components/Service/spi_bridge/include/spi_bridge.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef SPI_BRIDGE_C5_H #define SPI_BRIDGE_C5_H diff --git a/firmware_c5/components/Service/spi_bridge/include/spi_protocol.h b/firmware_c5/components/Service/spi_bridge/include/spi_protocol.h index 3274a602..1724fee8 100644 --- a/firmware_c5/components/Service/spi_bridge/include/spi_protocol.h +++ b/firmware_c5/components/Service/spi_bridge/include/spi_protocol.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef SPI_PROTOCOL_H #define SPI_PROTOCOL_H @@ -80,7 +81,6 @@ typedef enum { SPI_ID_WIFI_APP_DEAUTH_DET = 0x27, SPI_ID_WIFI_APP_PROBE_MON = 0x28, SPI_ID_WIFI_APP_SIGNAL_MON = 0x29, - SPI_ID_WIFI_APP_ATTACK_STOP = 0x2A, SPI_ID_WIFI_SNIFFER_SET_SNAPLEN = 0x2B, SPI_ID_WIFI_SNIFFER_SET_VERBOSE = 0x2C, SPI_ID_WIFI_SNIFFER_SAVE_FLASH = 0x2D, @@ -140,7 +140,6 @@ typedef enum { SPI_ID_BT_APP_SKIMMER = 0x64, SPI_ID_BT_APP_TRACKER = 0x65, SPI_ID_BT_APP_GATT_EXP = 0x66, - SPI_ID_BT_APP_STOP = 0x67, SPI_ID_BT_SPAM_LIST_LOAD = 0x68, SPI_ID_BT_SPAM_LIST_BEGIN = 0x69, SPI_ID_BT_SPAM_LIST_ITEM = 0x6A, @@ -157,7 +156,29 @@ typedef enum { // LoRa (0x80 - 0x8F) SPI_ID_LORA_RX = 0x80, - SPI_ID_LORA_TX = 0x81 + SPI_ID_LORA_TX = 0x81, + + // Meshtastic phone bridge (0x90 - 0x97) + SPI_ID_MESH_BLE_INIT = 0x90, + SPI_ID_MESH_BLE_STOP = 0x91, + SPI_ID_MESH_WIFI_INIT = 0x92, + SPI_ID_MESH_WIFI_STOP = 0x93, + SPI_ID_MESH_FROMRADIO_PUSH = 0x94, + SPI_ID_MESH_LOG_PUSH = 0x95, + SPI_ID_MESH_STATUS = 0x96, + SPI_ID_MESH_TORADIO_STREAM = 0x97, + + // MeshCore phone bridge (0x98 - 0x9C) + SPI_ID_MCORE_BLE_INIT = 0x98, + SPI_ID_MCORE_BLE_STOP = 0x99, + SPI_ID_MCORE_TX_PUSH = 0x9A, + SPI_ID_MCORE_RX_STREAM = 0x9B, + SPI_ID_MCORE_STATUS = 0x9C, + + // Session lifecycle (long-running operations) + SPI_ID_SESSION_HEARTBEAT = 0xF0, + SPI_ID_SESSION_LOST = 0xF1, + SPI_ID_SESSION_STOP = 0xF2 } spi_id_t; /** @@ -183,6 +204,44 @@ typedef struct { #define SPI_FRAME_SIZE (sizeof(spi_header_t) + SPI_MAX_PAYLOAD) +// Session protocol — see spi_bridge/README.md "Session Lifecycle" +#define SPI_SESSION_INVALID_ID 0u +#define SPI_SESSION_WINDOW 64u + +/** Sent by C5 as response payload to a long-running START command. + * Valid only if the SPI response status byte is SPI_STATUS_OK. */ +typedef struct __attribute__((packed)) { + uint32_t session_id; +} spi_session_resp_t; + +/** Sent by P4 every ~2s to keep a session alive and ack streams received. */ +typedef struct __attribute__((packed)) { + uint32_t session_id; + uint32_t last_acked_seq; +} spi_heartbeat_req_t; + +/** C5 reply to heartbeat. */ +typedef struct __attribute__((packed)) { + uint8_t alive; +} spi_heartbeat_resp_t; + +/** Prefixed to every stream payload from a session-managed operation. */ +typedef struct __attribute__((packed)) { + uint32_t session_id; + uint32_t seq; +} spi_stream_meta_t; + +/** Sent by P4 in payload of long-running STOP commands. */ +typedef struct __attribute__((packed)) { + uint32_t session_id; +} spi_session_stop_req_t; + +/** Stream emitted by C5 when a session is auto-killed by the watchdog. */ +typedef struct __attribute__((packed)) { + uint32_t session_id; + uint8_t op_id; +} spi_session_lost_t; + /** * @brief WiFi connect request payload. */ @@ -265,6 +324,68 @@ typedef struct { uint8_t data[31]; } __attribute__((packed)) spi_ble_sniffer_frame_t; +/** + * @brief Meshtastic transport init payload. + * + * Sent with SPI_ID_MESH_BLE_INIT and SPI_ID_MESH_WIFI_INIT. + */ +typedef struct { + uint32_t node_num; +} __attribute__((packed)) spi_mesh_init_t; + +/** + * @brief Chunk header for fragmented Meshtastic transport frames. + * + * Each StreamAPI protobuf frame is split into 1..255 chunks of up to + * SPI_MESH_CHUNK_PAYLOAD_MAX bytes. Receivers reassemble per seq. + */ +typedef struct { + uint8_t seq; + uint8_t chunk_idx; + uint8_t total_chunks; + uint8_t flags; +} __attribute__((packed)) spi_mesh_chunk_hdr_t; + +#define SPI_MESH_CHUNK_FLAG_LAST 0x01 +#define SPI_MESH_PAYLOAD_LIMIT 255 +#define SPI_MESH_CHUNK_PAYLOAD_MAX (SPI_MESH_PAYLOAD_LIMIT - sizeof(spi_mesh_chunk_hdr_t)) + +/** + * @brief Meshtastic transport status payload. + * + * Returned by SPI_ID_MESH_STATUS. + */ +typedef struct { + uint8_t ble_connected; + uint8_t ble_subscribed; + uint8_t tcp_clients; + uint8_t logradio_subscribed; + uint32_t fromnum_counter; +} __attribute__((packed)) spi_mesh_status_t; + +/** + * @brief MeshCore BLE init payload. + * + * Sent with SPI_ID_MCORE_BLE_INIT. The C5 builds the advertised name as + * "-XXXX" (last 4 hex of MAC) and uses `pin` as the static + * passkey for SC + MITM + DISP_ONLY pairing. + */ +typedef struct { + char name_prefix[16]; + uint32_t pin; +} __attribute__((packed)) spi_mcore_init_t; + +/** + * @brief MeshCore transport status payload. + * + * Returned by SPI_ID_MCORE_STATUS. + */ +typedef struct { + uint8_t ble_connected; + uint8_t ble_subscribed; + uint8_t reserved[2]; +} __attribute__((packed)) spi_mcore_status_t; + #ifdef __cplusplus } #endif diff --git a/firmware_c5/components/Service/spi_bridge/include/wifi_dispatcher.h b/firmware_c5/components/Service/spi_bridge/include/wifi_dispatcher.h index a6e498d5..88040f7f 100644 --- a/firmware_c5/components/Service/spi_bridge/include/wifi_dispatcher.h +++ b/firmware_c5/components/Service/spi_bridge/include/wifi_dispatcher.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef WIFI_DISPATCHER_H #define WIFI_DISPATCHER_H diff --git a/firmware_c5/components/Service/spi_bridge/meshcore_transport.c b/firmware_c5/components/Service/spi_bridge/meshcore_transport.c new file mode 100644 index 00000000..77dd98bc --- /dev/null +++ b/firmware_c5/components/Service/spi_bridge/meshcore_transport.c @@ -0,0 +1,206 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#include "meshcore_transport.h" + +#include + +#include "esp_log.h" +#include "freertos/FreeRTOS.h" +#include "freertos/semphr.h" +#include "freertos/task.h" + +#include "meshcore_gatt.h" +#include "spi_bridge.h" + +static const char *TAG = "MC_TRANSPORT"; + +#define TRANSPORT_TX_FRAME_MAX 256 +#define TRANSPORT_CHUNK_HDR_SIZE sizeof(spi_mesh_chunk_hdr_t) +#define TRANSPORT_MUTEX_TIMEOUT_MS 50 + +typedef struct { + bool is_active; + uint8_t seq; + uint8_t total_chunks; + uint8_t next_chunk_idx; + uint16_t accumulated_len; + uint8_t buf[TRANSPORT_TX_FRAME_MAX]; +} mcore_reassembly_t; + +static bool s_is_initialized = false; +static SemaphoreHandle_t s_mutex = NULL; +static mcore_reassembly_t s_tx_in = {0}; +static uint8_t s_rx_seq = 0; + +static bool take_mutex(void); +static void give_mutex(void); + +esp_err_t meshcore_transport_init(void) { + if (s_is_initialized) { + return ESP_OK; + } + s_mutex = xSemaphoreCreateMutex(); + if (s_mutex == NULL) { + ESP_LOGE(TAG, "Failed to create transport mutex"); + return ESP_ERR_NO_MEM; + } + memset(&s_tx_in, 0, sizeof(s_tx_in)); + s_rx_seq = 0; + s_is_initialized = true; + spi_bridge_stream_enable(SPI_ID_MCORE_RX_STREAM, true); + ESP_LOGI(TAG, "Transport initialized"); + return ESP_OK; +} + +void meshcore_transport_inject_tx_chunk(const uint8_t *payload, uint8_t len) { + if (payload == NULL || len < (uint8_t)TRANSPORT_CHUNK_HDR_SIZE) { + return; + } + if (!take_mutex()) { + return; + } + + spi_mesh_chunk_hdr_t hdr; + memcpy(&hdr, payload, sizeof(hdr)); + const uint8_t *data = payload + sizeof(hdr); + uint8_t data_len = (uint8_t)(len - sizeof(hdr)); + + if (hdr.total_chunks == 0) { + give_mutex(); + return; + } + + if (hdr.chunk_idx == 0) { + s_tx_in.is_active = true; + s_tx_in.seq = hdr.seq; + s_tx_in.total_chunks = hdr.total_chunks; + s_tx_in.next_chunk_idx = 0; + s_tx_in.accumulated_len = 0; + } else if (!s_tx_in.is_active) { + give_mutex(); + return; + } + + if (hdr.seq != s_tx_in.seq || hdr.chunk_idx != s_tx_in.next_chunk_idx || + hdr.total_chunks != s_tx_in.total_chunks) { + s_tx_in.is_active = false; + give_mutex(); + return; + } + + if ((uint16_t)(s_tx_in.accumulated_len + data_len) > sizeof(s_tx_in.buf)) { + s_tx_in.is_active = false; + give_mutex(); + return; + } + + memcpy(s_tx_in.buf + s_tx_in.accumulated_len, data, data_len); + s_tx_in.accumulated_len = (uint16_t)(s_tx_in.accumulated_len + data_len); + s_tx_in.next_chunk_idx++; + + if (s_tx_in.next_chunk_idx >= s_tx_in.total_chunks) { + uint8_t snapshot[TRANSPORT_TX_FRAME_MAX]; + uint16_t snapshot_len = s_tx_in.accumulated_len; + memcpy(snapshot, s_tx_in.buf, snapshot_len); + s_tx_in.is_active = false; + give_mutex(); + + meshcore_gatt_notify(snapshot, snapshot_len); + return; + } + + give_mutex(); +} + +bool meshcore_transport_send_to_p4(const uint8_t *frame, uint16_t len) { + if (frame == NULL || len == 0) { + return false; + } + if (!spi_bridge_stream_is_enabled(SPI_ID_MCORE_RX_STREAM)) { + return false; + } + + uint16_t total_u16 = + (uint16_t)((len + SPI_MESH_CHUNK_PAYLOAD_MAX - 1) / SPI_MESH_CHUNK_PAYLOAD_MAX); + if (total_u16 == 0 || total_u16 > 255) { + return false; + } + uint8_t total_chunks = (uint8_t)total_u16; + uint8_t seq; + if (take_mutex()) { + seq = s_rx_seq++; + give_mutex(); + } else { + return false; + } + + uint8_t buf[SPI_MESH_PAYLOAD_LIMIT]; + spi_mesh_chunk_hdr_t hdr; + uint16_t offset = 0; + + for (uint8_t idx = 0; idx < total_chunks; idx++) { + uint16_t remaining = (uint16_t)(len - offset); + uint16_t this_chunk = + remaining > SPI_MESH_CHUNK_PAYLOAD_MAX ? SPI_MESH_CHUNK_PAYLOAD_MAX : remaining; + + hdr.seq = seq; + hdr.chunk_idx = idx; + hdr.total_chunks = total_chunks; + hdr.flags = (idx == (uint8_t)(total_chunks - 1)) ? SPI_MESH_CHUNK_FLAG_LAST : 0; + + memcpy(buf, &hdr, sizeof(hdr)); + memcpy(buf + sizeof(hdr), frame + offset, this_chunk); + + uint8_t push_len = (uint8_t)(sizeof(hdr) + this_chunk); + if (!spi_bridge_stream_push(SPI_ID_MCORE_RX_STREAM, buf, push_len)) { + return false; + } + offset += this_chunk; + } + return true; +} + +void meshcore_transport_get_status(spi_mcore_status_t *out_status) { + if (out_status == NULL) { + return; + } + out_status->ble_connected = meshcore_gatt_is_connected() ? 1 : 0; + out_status->ble_subscribed = meshcore_gatt_is_subscribed() ? 1 : 0; + out_status->reserved[0] = 0; + out_status->reserved[1] = 0; +} + +void meshcore_transport_reset(void) { + if (!take_mutex()) { + return; + } + memset(&s_tx_in, 0, sizeof(s_tx_in)); + s_rx_seq = 0; + give_mutex(); +} + +static bool take_mutex(void) { + if (s_mutex == NULL) { + return false; + } + return xSemaphoreTake(s_mutex, pdMS_TO_TICKS(TRANSPORT_MUTEX_TIMEOUT_MS)) == pdTRUE; +} + +static void give_mutex(void) { + if (s_mutex != NULL) { + xSemaphoreGive(s_mutex); + } +} diff --git a/firmware_c5/components/Service/spi_bridge/meshtastic_transport.c b/firmware_c5/components/Service/spi_bridge/meshtastic_transport.c new file mode 100644 index 00000000..6386ba88 --- /dev/null +++ b/firmware_c5/components/Service/spi_bridge/meshtastic_transport.c @@ -0,0 +1,304 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#include "meshtastic_transport.h" + +#include + +#include "esp_log.h" +#include "freertos/FreeRTOS.h" +#include "freertos/semphr.h" +#include "freertos/task.h" + +#include "meshtastic_gatt.h" +#include "meshtastic_tcp.h" +#include "spi_bridge.h" + +static const char *TAG = "MESH_TRANSPORT"; + +#define TRANSPORT_FRAME_BUF_SIZE 512 +#define TRANSPORT_LOG_BUF_SIZE 512 +#define TRANSPORT_CHUNK_HDR_SIZE sizeof(spi_mesh_chunk_hdr_t) +#define TRANSPORT_MUTEX_TIMEOUT_MS 50 + +typedef struct { + bool is_active; + uint8_t seq; + uint8_t total_chunks; + uint8_t next_chunk_idx; + uint16_t accumulated_len; + uint8_t buf[TRANSPORT_FRAME_BUF_SIZE]; +} fromradio_reassembly_t; + +typedef struct { + bool is_active; + uint8_t seq; + uint8_t total_chunks; + uint8_t next_chunk_idx; + uint16_t accumulated_len; + uint8_t buf[TRANSPORT_LOG_BUF_SIZE]; +} log_reassembly_t; + +static bool s_is_initialized = false; +static SemaphoreHandle_t s_mutex = NULL; +static fromradio_reassembly_t s_fromradio = {0}; +static log_reassembly_t s_log = {0}; +static uint32_t s_fromnum_counter = 0; +static uint8_t s_toradio_seq = 0; + +static bool take_mutex(void); +static void give_mutex(void); + +esp_err_t meshtastic_transport_init(void) { + if (s_is_initialized) { + return ESP_OK; + } + s_mutex = xSemaphoreCreateMutex(); + if (s_mutex == NULL) { + ESP_LOGE(TAG, "Failed to create transport mutex"); + return ESP_ERR_NO_MEM; + } + memset(&s_fromradio, 0, sizeof(s_fromradio)); + memset(&s_log, 0, sizeof(s_log)); + s_fromnum_counter = 0; + s_toradio_seq = 0; + s_is_initialized = true; + spi_bridge_stream_enable(SPI_ID_MESH_TORADIO_STREAM, true); + ESP_LOGI(TAG, "Transport initialized"); + return ESP_OK; +} + +void meshtastic_transport_inject_fromradio_chunk(const uint8_t *payload, uint8_t len) { + if (payload == NULL || len < (uint8_t)TRANSPORT_CHUNK_HDR_SIZE) { + return; + } + if (!take_mutex()) { + return; + } + + spi_mesh_chunk_hdr_t hdr; + memcpy(&hdr, payload, sizeof(hdr)); + const uint8_t *data = payload + sizeof(hdr); + uint8_t data_len = (uint8_t)(len - sizeof(hdr)); + + if (hdr.total_chunks == 0) { + give_mutex(); + return; + } + + if (hdr.chunk_idx == 0) { + s_fromradio.is_active = true; + s_fromradio.seq = hdr.seq; + s_fromradio.total_chunks = hdr.total_chunks; + s_fromradio.next_chunk_idx = 0; + s_fromradio.accumulated_len = 0; + } else if (!s_fromradio.is_active) { + give_mutex(); + return; + } + + if (hdr.seq != s_fromradio.seq || hdr.chunk_idx != s_fromradio.next_chunk_idx || + hdr.total_chunks != s_fromradio.total_chunks) { + s_fromradio.is_active = false; + give_mutex(); + return; + } + + if ((uint16_t)(s_fromradio.accumulated_len + data_len) > sizeof(s_fromradio.buf)) { + s_fromradio.is_active = false; + give_mutex(); + return; + } + + memcpy(s_fromradio.buf + s_fromradio.accumulated_len, data, data_len); + s_fromradio.accumulated_len = (uint16_t)(s_fromradio.accumulated_len + data_len); + s_fromradio.next_chunk_idx++; + + if (s_fromradio.next_chunk_idx >= s_fromradio.total_chunks) { + uint8_t snapshot[TRANSPORT_FRAME_BUF_SIZE]; + uint16_t snapshot_len = s_fromradio.accumulated_len; + memcpy(snapshot, s_fromradio.buf, snapshot_len); + s_fromradio.is_active = false; + s_fromnum_counter++; + give_mutex(); + + meshtastic_gatt_enqueue_fromradio(snapshot, snapshot_len); + meshtastic_tcp_send_fromradio(snapshot, snapshot_len); + return; + } + + give_mutex(); +} + +void meshtastic_transport_inject_log_chunk(const uint8_t *payload, uint8_t len) { + if (payload == NULL || len < (uint8_t)TRANSPORT_CHUNK_HDR_SIZE) { + return; + } + if (!meshtastic_gatt_is_logradio_subscribed()) { + return; + } + if (!take_mutex()) { + return; + } + + spi_mesh_chunk_hdr_t hdr; + memcpy(&hdr, payload, sizeof(hdr)); + const uint8_t *data = payload + sizeof(hdr); + uint8_t data_len = (uint8_t)(len - sizeof(hdr)); + + if (hdr.total_chunks == 0) { + give_mutex(); + return; + } + + if (hdr.chunk_idx == 0) { + s_log.is_active = true; + s_log.seq = hdr.seq; + s_log.total_chunks = hdr.total_chunks; + s_log.next_chunk_idx = 0; + s_log.accumulated_len = 0; + } else if (!s_log.is_active) { + give_mutex(); + return; + } + + if (hdr.seq != s_log.seq || hdr.chunk_idx != s_log.next_chunk_idx || + hdr.total_chunks != s_log.total_chunks) { + s_log.is_active = false; + give_mutex(); + return; + } + + if ((uint16_t)(s_log.accumulated_len + data_len) > sizeof(s_log.buf)) { + s_log.is_active = false; + give_mutex(); + return; + } + + memcpy(s_log.buf + s_log.accumulated_len, data, data_len); + s_log.accumulated_len = (uint16_t)(s_log.accumulated_len + data_len); + s_log.next_chunk_idx++; + + if (s_log.next_chunk_idx >= s_log.total_chunks) { + uint8_t snapshot[TRANSPORT_LOG_BUF_SIZE]; + uint16_t snapshot_len = s_log.accumulated_len; + memcpy(snapshot, s_log.buf, snapshot_len); + s_log.is_active = false; + give_mutex(); + + meshtastic_gatt_notify_log(snapshot, snapshot_len); + return; + } + + give_mutex(); +} + +bool meshtastic_transport_send_toradio(const uint8_t *frame, uint16_t len) { + if (frame == NULL || len == 0) { + return false; + } + if (!spi_bridge_stream_is_enabled(SPI_ID_MESH_TORADIO_STREAM)) { + return false; + } + + uint16_t total_u16 = + (uint16_t)((len + SPI_MESH_CHUNK_PAYLOAD_MAX - 1) / SPI_MESH_CHUNK_PAYLOAD_MAX); + if (total_u16 == 0 || total_u16 > 255) { + return false; + } + uint8_t total_chunks = (uint8_t)total_u16; + uint8_t seq; + if (take_mutex()) { + seq = s_toradio_seq++; + give_mutex(); + } else { + return false; + } + + uint8_t buf[SPI_MESH_PAYLOAD_LIMIT]; + spi_mesh_chunk_hdr_t hdr; + uint16_t offset = 0; + + for (uint8_t idx = 0; idx < total_chunks; idx++) { + uint16_t remaining = (uint16_t)(len - offset); + uint16_t this_chunk = + remaining > SPI_MESH_CHUNK_PAYLOAD_MAX ? SPI_MESH_CHUNK_PAYLOAD_MAX : remaining; + + hdr.seq = seq; + hdr.chunk_idx = idx; + hdr.total_chunks = total_chunks; + hdr.flags = (idx == (uint8_t)(total_chunks - 1)) ? SPI_MESH_CHUNK_FLAG_LAST : 0; + + memcpy(buf, &hdr, sizeof(hdr)); + memcpy(buf + sizeof(hdr), frame + offset, this_chunk); + + uint8_t push_len = (uint8_t)(sizeof(hdr) + this_chunk); + if (!spi_bridge_stream_push(SPI_ID_MESH_TORADIO_STREAM, buf, push_len)) { + return false; + } + offset += this_chunk; + } + return true; +} + +void meshtastic_transport_get_status(spi_mesh_status_t *out_status) { + if (out_status == NULL) { + return; + } + out_status->ble_connected = meshtastic_gatt_is_connected() ? 1 : 0; + out_status->ble_subscribed = meshtastic_gatt_is_fromnum_subscribed() ? 1 : 0; + out_status->tcp_clients = meshtastic_tcp_get_client_count(); + out_status->logradio_subscribed = meshtastic_gatt_is_logradio_subscribed() ? 1 : 0; + if (take_mutex()) { + out_status->fromnum_counter = s_fromnum_counter; + give_mutex(); + } else { + out_status->fromnum_counter = 0; + } +} + +uint32_t meshtastic_transport_bump_fromnum(void) { + uint32_t value = 0; + if (take_mutex()) { + s_fromnum_counter++; + value = s_fromnum_counter; + give_mutex(); + } + return value; +} + +void meshtastic_transport_reset(void) { + if (!take_mutex()) { + return; + } + memset(&s_fromradio, 0, sizeof(s_fromradio)); + memset(&s_log, 0, sizeof(s_log)); + s_fromnum_counter = 0; + s_toradio_seq = 0; + give_mutex(); +} + +static bool take_mutex(void) { + if (s_mutex == NULL) { + return false; + } + return xSemaphoreTake(s_mutex, pdMS_TO_TICKS(TRANSPORT_MUTEX_TIMEOUT_MS)) == pdTRUE; +} + +static void give_mutex(void) { + if (s_mutex != NULL) { + xSemaphoreGive(s_mutex); + } +} diff --git a/firmware_c5/components/Service/spi_bridge/session_manager.c b/firmware_c5/components/Service/spi_bridge/session_manager.c new file mode 100644 index 00000000..99a9ab11 --- /dev/null +++ b/firmware_c5/components/Service/spi_bridge/session_manager.c @@ -0,0 +1,203 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#include "session_manager.h" + +#include + +#include "esp_log.h" +#include "esp_random.h" +#include "esp_timer.h" +#include "freertos/FreeRTOS.h" +#include "freertos/semphr.h" +#include "freertos/task.h" + +#include "spi_bridge.h" + +static const char *TAG = "SESSION_MGR"; + +#define SESSION_TIMEOUT_MS 5000 +#define WATCHDOG_PERIOD_MS 1000 +#define WATCHDOG_STACK_SIZE 3072 +#define WATCHDOG_PRIO 5 +#define DROP_LOG_INTERVAL 1000 + +typedef struct { + uint32_t id; + spi_id_t op_id; + uint64_t last_heartbeat_us; + uint32_t seq_counter; + uint32_t last_acked_seq; + uint32_t dropped_packets; + uint32_t total_dropped; + session_kill_cb_t kill_cb; +} session_state_t; + +static session_state_t s_session = {0}; +static SemaphoreHandle_t s_mutex = NULL; + +static uint32_t generate_session_id(void) { + uint32_t id; + do { + id = esp_random(); + } while (id == SPI_SESSION_INVALID_ID); + return id; +} + +static void close_active_locked(const char *reason) { + if (s_session.id == SPI_SESSION_INVALID_ID) + return; + + ESP_LOGW(TAG, + "Closing session 0x%08lx (op 0x%02X): %s", + (unsigned long)s_session.id, + s_session.op_id, + reason); + + if (s_session.total_dropped > 0) { + ESP_LOGW(TAG, + "Session dropped %lu packets total due to backpressure", + (unsigned long)s_session.total_dropped); + } + + session_kill_cb_t cb = s_session.kill_cb; + spi_id_t op_id = s_session.op_id; + memset(&s_session, 0, sizeof(s_session)); + + if (cb != NULL) + cb(op_id); +} + +static void emit_session_lost(uint32_t session_id, spi_id_t op_id) { + spi_session_lost_t payload = {.session_id = session_id, .op_id = (uint8_t)op_id}; + spi_bridge_stream_push(SPI_ID_SESSION_LOST, (const uint8_t *)&payload, sizeof(payload)); +} + +static void watchdog_task(void *arg) { + (void)arg; + while (1) { + vTaskDelay(pdMS_TO_TICKS(WATCHDOG_PERIOD_MS)); + + xSemaphoreTake(s_mutex, portMAX_DELAY); + if (s_session.id != SPI_SESSION_INVALID_ID) { + uint64_t now_us = esp_timer_get_time(); + uint64_t age_ms = (now_us - s_session.last_heartbeat_us) / 1000ULL; + if (age_ms > SESSION_TIMEOUT_MS) { + uint32_t lost_id = s_session.id; + spi_id_t lost_op = s_session.op_id; + close_active_locked("heartbeat timeout"); + xSemaphoreGive(s_mutex); + emit_session_lost(lost_id, lost_op); + continue; + } + } + xSemaphoreGive(s_mutex); + } +} + +void session_manager_init(void) { + if (s_mutex != NULL) + return; + s_mutex = xSemaphoreCreateMutex(); + xTaskCreate(watchdog_task, "session_wdt", WATCHDOG_STACK_SIZE, NULL, WATCHDOG_PRIO, NULL); + ESP_LOGI(TAG, + "Session manager started (timeout %dms, window %u)", + SESSION_TIMEOUT_MS, + SPI_SESSION_WINDOW); +} + +uint32_t session_manager_start(spi_id_t op_id, session_kill_cb_t kill_cb) { + xSemaphoreTake(s_mutex, portMAX_DELAY); + if (s_session.id != SPI_SESSION_INVALID_ID) { + close_active_locked("preempted by new session"); + } + + s_session.id = generate_session_id(); + s_session.op_id = op_id; + s_session.last_heartbeat_us = esp_timer_get_time(); + s_session.seq_counter = 0; + s_session.last_acked_seq = 0; + s_session.dropped_packets = 0; + s_session.total_dropped = 0; + s_session.kill_cb = kill_cb; + uint32_t id = s_session.id; + xSemaphoreGive(s_mutex); + + ESP_LOGI(TAG, "Session 0x%08lx opened for op 0x%02X", (unsigned long)id, op_id); + return id; +} + +esp_err_t session_manager_stop(uint32_t session_id) { + xSemaphoreTake(s_mutex, portMAX_DELAY); + if (s_session.id != session_id || session_id == SPI_SESSION_INVALID_ID) { + xSemaphoreGive(s_mutex); + return ESP_ERR_NOT_FOUND; + } + close_active_locked("explicit stop"); + xSemaphoreGive(s_mutex); + return ESP_OK; +} + +bool session_manager_heartbeat(uint32_t session_id, uint32_t last_acked_seq) { + xSemaphoreTake(s_mutex, portMAX_DELAY); + bool match = (s_session.id == session_id && session_id != SPI_SESSION_INVALID_ID); + if (match) { + s_session.last_heartbeat_us = esp_timer_get_time(); + if (last_acked_seq > s_session.last_acked_seq) { + s_session.last_acked_seq = last_acked_seq; + } + } + xSemaphoreGive(s_mutex); + return match; +} + +esp_err_t session_manager_try_emit(uint32_t session_id, const uint8_t *data, uint8_t len) { + if (data == NULL && len > 0) + return ESP_ERR_INVALID_ARG; + if (len > SPI_MAX_PAYLOAD - sizeof(spi_stream_meta_t)) + return ESP_ERR_INVALID_SIZE; + + xSemaphoreTake(s_mutex, portMAX_DELAY); + if (s_session.id != session_id || session_id == SPI_SESSION_INVALID_ID) { + xSemaphoreGive(s_mutex); + return ESP_ERR_INVALID_STATE; + } + + uint32_t in_flight = s_session.seq_counter - s_session.last_acked_seq; + if (in_flight >= SPI_SESSION_WINDOW) { + s_session.dropped_packets++; + s_session.total_dropped++; + if (s_session.dropped_packets >= DROP_LOG_INTERVAL) { + ESP_LOGW(TAG, + "Backpressure: dropped %lu more packets (total %lu)", + (unsigned long)s_session.dropped_packets, + (unsigned long)s_session.total_dropped); + s_session.dropped_packets = 0; + } + xSemaphoreGive(s_mutex); + return ESP_ERR_NO_MEM; + } + + uint8_t buf[SPI_MAX_PAYLOAD]; + spi_stream_meta_t meta = {.session_id = session_id, .seq = ++s_session.seq_counter}; + memcpy(buf, &meta, sizeof(meta)); + if (len > 0) + memcpy(buf + sizeof(meta), data, len); + spi_id_t op = s_session.op_id; + uint8_t total = sizeof(meta) + len; + xSemaphoreGive(s_mutex); + + return spi_bridge_stream_push(op, buf, total) ? ESP_OK : ESP_ERR_NO_MEM; +} diff --git a/firmware_c5/components/Service/spi_bridge/spi_bridge.c b/firmware_c5/components/Service/spi_bridge/spi_bridge.c index 6aa62307..f3a9c18d 100644 --- a/firmware_c5/components/Service/spi_bridge/spi_bridge.c +++ b/firmware_c5/components/Service/spi_bridge/spi_bridge.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "spi_bridge.h" @@ -24,12 +25,11 @@ #include "freertos/task.h" #include "bt_dispatcher.h" -#include "cJSON.h" #include "bluetooth_service.h" #include "deauther_detector.h" +#include "session_manager.h" #include "signal_monitor.h" #include "spi_slave_driver.h" -#include "storage_assets.h" #include "wifi_dispatcher.h" #include "wifi_service.h" #include "wifi_sniffer.h" @@ -45,7 +45,16 @@ static const char *TAG = "SPI_BRIDGE_C5"; #define SPI_WIFI_CMD_MAX 0x4F #define SPI_BT_CMD_MIN 0x50 #define SPI_BT_CMD_MAX 0x7F +#define SPI_MESH_BT_CMD_MIN 0x90 +#define SPI_MESH_BT_CMD_MAX 0x91 +#define SPI_MESH_WIFI_CMD_MIN 0x92 +#define SPI_MESH_WIFI_CMD_MAX 0x93 +#define SPI_MESH_BT_DATA_MIN 0x94 +#define SPI_MESH_BT_DATA_MAX 0x96 +#define SPI_MCORE_CMD_MIN 0x98 +#define SPI_MCORE_CMD_MAX 0x9C #define SPI_FW_VERSION_LEN 32 +#define SPI_FW_VERSION_STRING "1.2.0" typedef struct { spi_id_t id; @@ -64,6 +73,8 @@ static uint8_t s_stream_tail = 0; static uint8_t s_stream_count = 0; static bool s_is_wifi_sniffer_streaming = false; static bool s_is_bt_sniffer_streaming = false; +static bool s_is_mesh_toradio_streaming = false; +static bool s_is_mcore_rx_streaming = false; static portMUX_TYPE s_stream_mux = portMUX_INITIALIZER_UNLOCKED; static volatile bool s_is_restart_pending = false; static char s_firmware_version[SPI_FW_VERSION_LEN] = "unknown"; @@ -95,6 +106,10 @@ bool spi_bridge_stream_is_enabled(spi_id_t id) { return s_is_wifi_sniffer_streaming; if (id == SPI_ID_BT_APP_SNIFFER) return s_is_bt_sniffer_streaming; + if (id == SPI_ID_MESH_TORADIO_STREAM) + return s_is_mesh_toradio_streaming; + if (id == SPI_ID_MCORE_RX_STREAM) + return s_is_mcore_rx_streaming; return false; } @@ -103,6 +118,10 @@ void spi_bridge_stream_enable(spi_id_t id, bool enable) { s_is_wifi_sniffer_streaming = enable; if (id == SPI_ID_BT_APP_SNIFFER) s_is_bt_sniffer_streaming = enable; + if (id == SPI_ID_MESH_TORADIO_STREAM) + s_is_mesh_toradio_streaming = enable; + if (id == SPI_ID_MCORE_RX_STREAM) + s_is_mcore_rx_streaming = enable; } bool spi_bridge_stream_push(spi_id_t id, const uint8_t *data, uint8_t len) { @@ -139,6 +158,7 @@ esp_err_t spi_bridge_slave_init(void) { esp_err_t ret = spi_slave_driver_init(); if (ret != ESP_OK) return ret; + session_manager_init(); xTaskCreate( bridge_task, "spi_bridge_task", SPI_BRIDGE_TASK_STACK, NULL, SPI_BRIDGE_TASK_PRIO, NULL); return ESP_OK; @@ -147,23 +167,9 @@ esp_err_t spi_bridge_slave_init(void) { // Static functions static void load_firmware_version(void) { - size_t size; - uint8_t *json_data = storage_assets_load_file("config/OTA/firmware.json", &size); - if (json_data == NULL) - return; - - cJSON *root = cJSON_ParseWithLength((const char *)json_data, size); - free(json_data); - if (root == NULL) - return; - - cJSON *version = cJSON_GetObjectItem(root, "version"); - if (cJSON_IsString(version) && version->valuestring != NULL) { - strncpy(s_firmware_version, version->valuestring, sizeof(s_firmware_version) - 1); - s_firmware_version[sizeof(s_firmware_version) - 1] = '\0'; - ESP_LOGI(TAG, "Firmware version: %s", s_firmware_version); - } - cJSON_Delete(root); + strncpy(s_firmware_version, SPI_FW_VERSION_STRING, sizeof(s_firmware_version) - 1); + s_firmware_version[sizeof(s_firmware_version) - 1] = '\0'; + ESP_LOGI(TAG, "Firmware version: %s", s_firmware_version); } static bool stream_pop(spi_id_t *out_id, uint8_t *out_data, uint8_t *out_len) { @@ -274,12 +280,35 @@ static void bridge_task(void *pvParameters) { continue; } status = SPI_STATUS_BUSY; + } else if (header->id == SPI_ID_SESSION_HEARTBEAT) { + spi_heartbeat_req_t req = {0}; + memcpy(&req, rx_buf + sizeof(spi_header_t), sizeof(req)); + bool alive = session_manager_heartbeat(req.session_id, req.last_acked_seq); + spi_heartbeat_resp_t resp = {.alive = alive ? (uint8_t)1 : (uint8_t)0}; + memcpy(resp_payload, &resp, sizeof(resp)); + resp_len = sizeof(resp); + status = SPI_STATUS_OK; + } else if (header->id == SPI_ID_SESSION_STOP) { + spi_session_stop_req_t req = {0}; + memcpy(&req, rx_buf + sizeof(spi_header_t), sizeof(req)); + esp_err_t r = session_manager_stop(req.session_id); + status = (r == ESP_OK) ? SPI_STATUS_OK : SPI_STATUS_ERROR; } else if (header->id >= SPI_WIFI_CMD_MIN && header->id <= SPI_WIFI_CMD_MAX) { status = wifi_dispatcher_execute( header->id, rx_buf + sizeof(spi_header_t), header->length, resp_payload, &resp_len); } else if (header->id >= SPI_BT_CMD_MIN && header->id <= SPI_BT_CMD_MAX) { status = bt_dispatcher_execute( header->id, rx_buf + sizeof(spi_header_t), header->length, resp_payload, &resp_len); + } else if ((header->id >= SPI_MESH_BT_CMD_MIN && header->id <= SPI_MESH_BT_CMD_MAX) || + (header->id >= SPI_MESH_BT_DATA_MIN && header->id <= SPI_MESH_BT_DATA_MAX)) { + status = bt_dispatcher_execute( + header->id, rx_buf + sizeof(spi_header_t), header->length, resp_payload, &resp_len); + } else if (header->id >= SPI_MCORE_CMD_MIN && header->id <= SPI_MCORE_CMD_MAX) { + status = bt_dispatcher_execute( + header->id, rx_buf + sizeof(spi_header_t), header->length, resp_payload, &resp_len); + } else if (header->id >= SPI_MESH_WIFI_CMD_MIN && header->id <= SPI_MESH_WIFI_CMD_MAX) { + status = wifi_dispatcher_execute( + header->id, rx_buf + sizeof(spi_header_t), header->length, resp_payload, &resp_len); } else { status = SPI_STATUS_UNSUPPORTED; } diff --git a/firmware_c5/components/Service/spi_bridge/wifi_dispatcher.c b/firmware_c5/components/Service/spi_bridge/wifi_dispatcher.c index 17fb867d..ebe64119 100644 --- a/firmware_c5/components/Service/spi_bridge/wifi_dispatcher.c +++ b/firmware_c5/components/Service/spi_bridge/wifi_dispatcher.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "wifi_dispatcher.h" @@ -25,7 +26,9 @@ #include "beacon_spam.h" #include "client_scanner.h" #include "deauther_detector.h" +#include "session_manager.h" #include "evil_twin.h" +#include "meshtastic_tcp.h" #include "probe_monitor.h" #include "signal_monitor.h" #include "spi_bridge.h" @@ -62,6 +65,54 @@ static const char *TAG = "WIFI_DISPATCHER"; static void promisc_noop_cb(void *buf, wifi_promiscuous_pkt_type_t type); +// Session kill callbacks: invoked when watchdog times out a session. +static void killed_deauther(spi_id_t id) { + (void)id; + wifi_deauther_stop(); +} +static void killed_flood(spi_id_t id) { + (void)id; + wifi_flood_stop(); +} +static void killed_evil_twin(spi_id_t id) { + (void)id; + evil_twin_stop_attack(); +} +static void killed_beacon_spam(spi_id_t id) { + (void)id; + beacon_spam_stop(); +} +static void killed_deauth_det(spi_id_t id) { + (void)id; + deauther_detector_stop(); +} +static void killed_probe_mon(spi_id_t id) { + (void)id; + probe_monitor_stop(); +} +static void killed_signal_mon(spi_id_t id) { + (void)id; + signal_monitor_stop(); +} + +// Helper: after a successful op start, open a session and write the response. +static spi_status_t open_session(spi_id_t op_id, + session_kill_cb_t kill_cb, + uint8_t *out_resp_payload, + uint8_t *out_resp_len, + void (*rollback_stop)(void)) { + uint32_t sid = session_manager_start(op_id, kill_cb); + if (sid == SPI_SESSION_INVALID_ID) { + if (rollback_stop != NULL) + rollback_stop(); + return SPI_STATUS_ERROR; + } + spi_session_resp_t resp = {.session_id = sid}; + memcpy(out_resp_payload, &resp, sizeof(resp)); + *out_resp_len = sizeof(resp); + return SPI_STATUS_OK; +} + spi_status_t wifi_dispatcher_execute(spi_id_t id, const uint8_t *payload, uint8_t len, @@ -202,14 +253,24 @@ spi_status_t wifi_dispatcher_execute(spi_id_t id, } case SPI_ID_WIFI_APP_BEACON_SPAM: { - if (len == 0) - return beacon_spam_start_random() ? SPI_STATUS_OK : SPI_STATUS_ERROR; - char path[WIFI_PATH_MAX_LEN] = {0}; - size_t copy_len = len; - if (copy_len >= sizeof(path)) - copy_len = sizeof(path) - 1; - memcpy(path, payload, copy_len); - return beacon_spam_start_custom(path) ? SPI_STATUS_OK : SPI_STATUS_ERROR; + bool ok; + if (len == 0) { + ok = beacon_spam_start_random(); + } else { + char path[WIFI_PATH_MAX_LEN] = {0}; + size_t copy_len = len; + if (copy_len >= sizeof(path)) + copy_len = sizeof(path) - 1; + memcpy(path, payload, copy_len); + ok = beacon_spam_start_custom(path); + } + if (!ok) + return SPI_STATUS_ERROR; + return open_session(SPI_ID_WIFI_APP_BEACON_SPAM, + killed_beacon_spam, + out_resp_payload, + out_resp_len, + beacon_spam_stop); } case SPI_ID_WIFI_APP_DEAUTHER: { @@ -222,7 +283,13 @@ spi_status_t wifi_dispatcher_execute(spi_id_t id, uint8_t client[WIFI_MAC_LEN]; memcpy(client, payload + WIFI_MAC_LEN, WIFI_MAC_LEN); wifi_deauther_frame_type_t type = (wifi_deauther_frame_type_t)payload[12]; - return wifi_deauther_start_targeted(&target, client, type) ? SPI_STATUS_OK : SPI_STATUS_ERROR; + if (!wifi_deauther_start_targeted(&target, client, type)) + return SPI_STATUS_ERROR; + return open_session(SPI_ID_WIFI_APP_DEAUTHER, + killed_deauther, + out_resp_payload, + out_resp_len, + wifi_deauther_stop); } case SPI_ID_WIFI_APP_FLOOD: { @@ -232,70 +299,92 @@ spi_status_t wifi_dispatcher_execute(spi_id_t id, uint8_t bssid[WIFI_MAC_LEN]; memcpy(bssid, payload + 1, WIFI_MAC_LEN); uint8_t channel = (len >= 8) ? payload[7] : 1; + bool ok = false; if (type == WIFI_FLOOD_TYPE_AUTH) - return wifi_flood_auth_start(bssid, channel) ? SPI_STATUS_OK : SPI_STATUS_ERROR; - if (type == WIFI_FLOOD_TYPE_ASSOC) - return wifi_flood_assoc_start(bssid, channel) ? SPI_STATUS_OK : SPI_STATUS_ERROR; - if (type == WIFI_FLOOD_TYPE_PROBE) - return wifi_flood_probe_start(bssid, channel) ? SPI_STATUS_OK : SPI_STATUS_ERROR; - return SPI_STATUS_ERROR; + ok = wifi_flood_auth_start(bssid, channel); + else if (type == WIFI_FLOOD_TYPE_ASSOC) + ok = wifi_flood_assoc_start(bssid, channel); + else if (type == WIFI_FLOOD_TYPE_PROBE) + ok = wifi_flood_probe_start(bssid, channel); + if (!ok) + return SPI_STATUS_ERROR; + return open_session( + SPI_ID_WIFI_APP_FLOOD, killed_flood, out_resp_payload, out_resp_len, wifi_flood_stop); } case SPI_ID_WIFI_APP_SNIFFER: { if (len < WIFI_SNIFFER_MIN_PAYLOAD) return SPI_STATUS_ERROR; + // payload[2] (optional): monitor_mode flag — when set, buffer recycles + // on overflow and packet counter keeps growing (used by Packet Monitor). + bool monitor_mode = (len >= 3) && (payload[2] != 0); + wifi_sniffer_set_monitor_mode(monitor_mode); spi_bridge_stream_enable(SPI_ID_WIFI_APP_SNIFFER, true); - if (wifi_sniffer_start((wifi_sniffer_type_t)payload[0], payload[1])) { - return SPI_STATUS_OK; + if (!wifi_sniffer_start((wifi_sniffer_type_t)payload[0], payload[1])) { + spi_bridge_stream_enable(SPI_ID_WIFI_APP_SNIFFER, false); + return SPI_STATUS_ERROR; } - spi_bridge_stream_enable(SPI_ID_WIFI_APP_SNIFFER, false); - return SPI_STATUS_ERROR; + uint32_t sid = session_manager_start(SPI_ID_WIFI_APP_SNIFFER, wifi_sniffer_session_killed); + if (sid == SPI_SESSION_INVALID_ID) { + wifi_sniffer_stop(); + spi_bridge_stream_enable(SPI_ID_WIFI_APP_SNIFFER, false); + return SPI_STATUS_ERROR; + } + wifi_sniffer_bind_session(sid); + spi_session_resp_t resp = {.session_id = sid}; + memcpy(out_resp_payload, &resp, sizeof(resp)); + *out_resp_len = sizeof(resp); + return SPI_STATUS_OK; } - case SPI_ID_WIFI_APP_EVIL_TWIN: + case SPI_ID_WIFI_APP_EVIL_TWIN: { if (len == 0) return SPI_STATUS_INVALID_ARG; - { - char ssid[WIFI_SSID_BUF_LEN] = {0}; - uint8_t copy_len = (len > WIFI_SSID_MAX_LEN) ? WIFI_SSID_MAX_LEN : len; - memcpy(ssid, payload, copy_len); - evil_twin_start_attack(ssid); - return SPI_STATUS_OK; - } + char ssid[WIFI_SSID_BUF_LEN] = {0}; + uint8_t copy_len = (len > WIFI_SSID_MAX_LEN) ? WIFI_SSID_MAX_LEN : len; + memcpy(ssid, payload, copy_len); + evil_twin_start_attack(ssid); + return open_session(SPI_ID_WIFI_APP_EVIL_TWIN, + killed_evil_twin, + out_resp_payload, + out_resp_len, + evil_twin_stop_attack); + } case SPI_ID_WIFI_APP_DEAUTH_DET: deauther_detector_start(); - return SPI_STATUS_OK; + return open_session(SPI_ID_WIFI_APP_DEAUTH_DET, + killed_deauth_det, + out_resp_payload, + out_resp_len, + deauther_detector_stop); case SPI_ID_WIFI_APP_PROBE_MON: - if (probe_monitor_start()) { + if (!probe_monitor_start()) + return SPI_STATUS_BUSY; + { uint16_t count; probe_monitor_record_t *results = probe_monitor_get_results(&count); spi_bridge_provide_results_dynamic( results, probe_monitor_get_count_ptr(), sizeof(probe_monitor_record_t)); - return SPI_STATUS_OK; } - return SPI_STATUS_BUSY; + return open_session(SPI_ID_WIFI_APP_PROBE_MON, + killed_probe_mon, + out_resp_payload, + out_resp_len, + probe_monitor_stop); case SPI_ID_WIFI_APP_SIGNAL_MON: { if (len < WIFI_SIGNAL_MON_MIN_LEN) return SPI_STATUS_ERROR; signal_monitor_start(payload, payload[6]); - return SPI_STATUS_OK; + return open_session(SPI_ID_WIFI_APP_SIGNAL_MON, + killed_signal_mon, + out_resp_payload, + out_resp_len, + signal_monitor_stop); } - case SPI_ID_WIFI_APP_ATTACK_STOP: - wifi_deauther_stop(); - wifi_flood_stop(); - wifi_sniffer_stop(); - evil_twin_stop_attack(); - deauther_detector_stop(); - probe_monitor_stop(); - signal_monitor_stop(); - beacon_spam_stop(); - spi_bridge_stream_enable(SPI_ID_WIFI_APP_SNIFFER, false); - return SPI_STATUS_OK; - case SPI_ID_WIFI_SNIFFER_SET_SNAPLEN: { if (len < 2) return SPI_STATUS_INVALID_ARG; @@ -527,6 +616,19 @@ spi_status_t wifi_dispatcher_execute(spi_id_t id, case SPI_ID_WIFI_AP_SAVE_SD: return ap_scanner_save_results_to_sd_card() ? SPI_STATUS_OK : SPI_STATUS_ERROR; + case SPI_ID_MESH_WIFI_INIT: { + if (len < sizeof(spi_mesh_init_t)) { + return SPI_STATUS_INVALID_ARG; + } + spi_mesh_init_t req; + memcpy(&req, payload, sizeof(req)); + return (meshtastic_tcp_init(req.node_num) == ESP_OK) ? SPI_STATUS_OK : SPI_STATUS_ERROR; + } + + case SPI_ID_MESH_WIFI_STOP: + meshtastic_tcp_stop(); + return SPI_STATUS_OK; + default: return SPI_STATUS_ERROR; } diff --git a/firmware_c5/components/Service/storage_api/include/storage_dirs.h b/firmware_c5/components/Service/storage_api/include/storage_dirs.h index f99f0e3e..d053e369 100644 --- a/firmware_c5/components/Service/storage_api/include/storage_dirs.h +++ b/firmware_c5/components/Service/storage_api/include/storage_dirs.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef STORAGE_DIRS_H #define STORAGE_DIRS_H diff --git a/firmware_c5/components/Service/storage_api/include/storage_impl.h b/firmware_c5/components/Service/storage_api/include/storage_impl.h index f6dc2a2e..21590086 100644 --- a/firmware_c5/components/Service/storage_api/include/storage_impl.h +++ b/firmware_c5/components/Service/storage_api/include/storage_impl.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file storage_impl.h diff --git a/firmware_c5/components/Service/storage_api/include/storage_init.h b/firmware_c5/components/Service/storage_api/include/storage_init.h index d85d5af4..eedfc293 100644 --- a/firmware_c5/components/Service/storage_api/include/storage_init.h +++ b/firmware_c5/components/Service/storage_api/include/storage_init.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file storage_init.h diff --git a/firmware_c5/components/Service/storage_api/include/storage_mkdir.h b/firmware_c5/components/Service/storage_api/include/storage_mkdir.h index e15748a5..ed798402 100644 --- a/firmware_c5/components/Service/storage_api/include/storage_mkdir.h +++ b/firmware_c5/components/Service/storage_api/include/storage_mkdir.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef STORAGE_MKDIR_H #define STORAGE_MKDIR_H diff --git a/firmware_c5/components/Service/storage_api/include/storage_read.h b/firmware_c5/components/Service/storage_api/include/storage_read.h index 691364c2..622cf841 100644 --- a/firmware_c5/components/Service/storage_api/include/storage_read.h +++ b/firmware_c5/components/Service/storage_api/include/storage_read.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file storage_read.h diff --git a/firmware_c5/components/Service/storage_api/include/storage_write.h b/firmware_c5/components/Service/storage_api/include/storage_write.h index ee62ad5b..224b72ab 100644 --- a/firmware_c5/components/Service/storage_api/include/storage_write.h +++ b/firmware_c5/components/Service/storage_api/include/storage_write.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file storage_write.h diff --git a/firmware_c5/components/Service/storage_api/include/tos_flash_paths.h b/firmware_c5/components/Service/storage_api/include/tos_flash_paths.h index d599f399..08641a6b 100644 --- a/firmware_c5/components/Service/storage_api/include/tos_flash_paths.h +++ b/firmware_c5/components/Service/storage_api/include/tos_flash_paths.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef TOS_FLASH_PATHS_H #define TOS_FLASH_PATHS_H diff --git a/firmware_c5/components/Service/storage_api/storage_impl.c b/firmware_c5/components/Service/storage_api/storage_impl.c index eaad217c..602b2a17 100644 --- a/firmware_c5/components/Service/storage_api/storage_impl.c +++ b/firmware_c5/components/Service/storage_api/storage_impl.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file storage_impl.c diff --git a/firmware_c5/components/Service/storage_api/storage_init.c b/firmware_c5/components/Service/storage_api/storage_init.c index 91d2a144..a02a713b 100644 --- a/firmware_c5/components/Service/storage_api/storage_init.c +++ b/firmware_c5/components/Service/storage_api/storage_init.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "storage_init.h" diff --git a/firmware_c5/components/Service/storage_api/storage_mkdir.c b/firmware_c5/components/Service/storage_api/storage_mkdir.c index 56fe111f..24a02423 100644 --- a/firmware_c5/components/Service/storage_api/storage_mkdir.c +++ b/firmware_c5/components/Service/storage_api/storage_mkdir.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "storage_mkdir.h" diff --git a/firmware_c5/components/Service/storage_api/storage_read.c b/firmware_c5/components/Service/storage_api/storage_read.c index 21f29c21..2f25092e 100644 --- a/firmware_c5/components/Service/storage_api/storage_read.c +++ b/firmware_c5/components/Service/storage_api/storage_read.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file storage_read.c diff --git a/firmware_c5/components/Service/storage_api/storage_write.c b/firmware_c5/components/Service/storage_api/storage_write.c index b5d596b2..fe8a5abe 100644 --- a/firmware_c5/components/Service/storage_api/storage_write.c +++ b/firmware_c5/components/Service/storage_api/storage_write.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "storage_write.h" diff --git a/firmware_c5/components/Service/storage_assets/include/storage_assets.h b/firmware_c5/components/Service/storage_assets/include/storage_assets.h index 63e8c3d9..3a6c9dd4 100644 --- a/firmware_c5/components/Service/storage_assets/include/storage_assets.h +++ b/firmware_c5/components/Service/storage_assets/include/storage_assets.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef STORAGE_ASSETS_H #define STORAGE_ASSETS_H diff --git a/firmware_c5/components/Service/storage_assets/storage_assets.c b/firmware_c5/components/Service/storage_assets/storage_assets.c index f06ea84b..3079c962 100644 --- a/firmware_c5/components/Service/storage_assets/storage_assets.c +++ b/firmware_c5/components/Service/storage_assets/storage_assets.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "storage_assets.h" diff --git a/firmware_c5/components/Service/storage_vfs/include/vfs_config.h b/firmware_c5/components/Service/storage_vfs/include/vfs_config.h index c0cc3b80..d093bbf2 100644 --- a/firmware_c5/components/Service/storage_vfs/include/vfs_config.h +++ b/firmware_c5/components/Service/storage_vfs/include/vfs_config.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file vfs_config.h diff --git a/firmware_c5/components/Service/storage_vfs/include/vfs_core.h b/firmware_c5/components/Service/storage_vfs/include/vfs_core.h index 0decbcc8..5cc4b332 100644 --- a/firmware_c5/components/Service/storage_vfs/include/vfs_core.h +++ b/firmware_c5/components/Service/storage_vfs/include/vfs_core.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file vfs_core.h diff --git a/firmware_c5/components/Service/storage_vfs/include/vfs_littlefs.h b/firmware_c5/components/Service/storage_vfs/include/vfs_littlefs.h index b76a60fd..fd9041d3 100644 --- a/firmware_c5/components/Service/storage_vfs/include/vfs_littlefs.h +++ b/firmware_c5/components/Service/storage_vfs/include/vfs_littlefs.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file vfs_littlefs.h diff --git a/firmware_c5/components/Service/storage_vfs/include/vfs_sdcard.h b/firmware_c5/components/Service/storage_vfs/include/vfs_sdcard.h index 8b718f13..63ed6bfd 100644 --- a/firmware_c5/components/Service/storage_vfs/include/vfs_sdcard.h +++ b/firmware_c5/components/Service/storage_vfs/include/vfs_sdcard.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file vfs_sdcard.h diff --git a/firmware_c5/components/Service/storage_vfs/vfs_auto.c b/firmware_c5/components/Service/storage_vfs/vfs_auto.c index 67ec592e..65769a67 100644 --- a/firmware_c5/components/Service/storage_vfs/vfs_auto.c +++ b/firmware_c5/components/Service/storage_vfs/vfs_auto.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file vfs_auto.c diff --git a/firmware_c5/components/Service/storage_vfs/vfs_core.c b/firmware_c5/components/Service/storage_vfs/vfs_core.c index ec0ee6df..85fcdc87 100644 --- a/firmware_c5/components/Service/storage_vfs/vfs_core.c +++ b/firmware_c5/components/Service/storage_vfs/vfs_core.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "vfs_core.h" diff --git a/firmware_c5/components/Service/storage_vfs/vfs_littlefs.c b/firmware_c5/components/Service/storage_vfs/vfs_littlefs.c index 73d6b610..31721426 100644 --- a/firmware_c5/components/Service/storage_vfs/vfs_littlefs.c +++ b/firmware_c5/components/Service/storage_vfs/vfs_littlefs.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "vfs_littlefs.h" diff --git a/firmware_c5/components/Service/storage_vfs/vfs_sdcard.c b/firmware_c5/components/Service/storage_vfs/vfs_sdcard.c index 58384650..d628120b 100644 --- a/firmware_c5/components/Service/storage_vfs/vfs_sdcard.c +++ b/firmware_c5/components/Service/storage_vfs/vfs_sdcard.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "vfs_sdcard.h" diff --git a/firmware_c5/components/Service/wifi/include/mac_vendor.h b/firmware_c5/components/Service/wifi/include/mac_vendor.h index a5ead6fb..a1f8118f 100644 --- a/firmware_c5/components/Service/wifi/include/mac_vendor.h +++ b/firmware_c5/components/Service/wifi/include/mac_vendor.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef MAC_VENDOR_H #define MAC_VENDOR_H diff --git a/firmware_c5/components/Service/wifi/include/wifi_80211.h b/firmware_c5/components/Service/wifi/include/wifi_80211.h index 705160ab..71ab7ff8 100644 --- a/firmware_c5/components/Service/wifi/include/wifi_80211.h +++ b/firmware_c5/components/Service/wifi/include/wifi_80211.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef WIFI_80211_H #define WIFI_80211_H diff --git a/firmware_c5/components/Service/wifi/include/wifi_service.h b/firmware_c5/components/Service/wifi/include/wifi_service.h index ad08d0e6..8328910f 100644 --- a/firmware_c5/components/Service/wifi/include/wifi_service.h +++ b/firmware_c5/components/Service/wifi/include/wifi_service.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef WIFI_SERVICE_H #define WIFI_SERVICE_H diff --git a/firmware_c5/components/Service/wifi/mac_vendor.c b/firmware_c5/components/Service/wifi/mac_vendor.c index 3202973e..c3d23ca9 100644 --- a/firmware_c5/components/Service/wifi/mac_vendor.c +++ b/firmware_c5/components/Service/wifi/mac_vendor.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "mac_vendor.h" diff --git a/firmware_c5/components/Service/wifi/wifi_service.c b/firmware_c5/components/Service/wifi/wifi_service.c index 33665bf4..38bc4b11 100644 --- a/firmware_c5/components/Service/wifi/wifi_service.c +++ b/firmware_c5/components/Service/wifi/wifi_service.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "wifi_service.h" diff --git a/firmware_c5/main/idf_component.yml b/firmware_c5/main/idf_component.yml index 934e1bd8..ea54e1da 100644 --- a/firmware_c5/main/idf_component.yml +++ b/firmware_c5/main/idf_component.yml @@ -1,5 +1,6 @@ dependencies: espressif/led_strip: ^2.5.1 + espressif/mdns: ^1.4.0 joltwallet/littlefs: ^1.14.8 lvgl/lvgl: ^9.4.0 espressif/cjson: ^1.7.19 diff --git a/firmware_c5/sdkconfig b/firmware_c5/sdkconfig deleted file mode 100644 index eb797050..00000000 --- a/firmware_c5/sdkconfig +++ /dev/null @@ -1,3397 +0,0 @@ -# -# Automatically generated file. DO NOT EDIT. -# Espressif IoT Development Framework (ESP-IDF) 5.5.3 Project Configuration -# -CONFIG_SOC_ADC_SUPPORTED=y -CONFIG_SOC_ANA_CMPR_SUPPORTED=y -CONFIG_SOC_DEDICATED_GPIO_SUPPORTED=y -CONFIG_SOC_UART_SUPPORTED=y -CONFIG_SOC_UHCI_SUPPORTED=y -CONFIG_SOC_GDMA_SUPPORTED=y -CONFIG_SOC_AHB_GDMA_SUPPORTED=y -CONFIG_SOC_GPTIMER_SUPPORTED=y -CONFIG_SOC_PCNT_SUPPORTED=y -CONFIG_SOC_MCPWM_SUPPORTED=y -CONFIG_SOC_TWAI_SUPPORTED=y -CONFIG_SOC_ETM_SUPPORTED=y -CONFIG_SOC_PARLIO_SUPPORTED=y -CONFIG_SOC_ASYNC_MEMCPY_SUPPORTED=y -CONFIG_SOC_USB_SERIAL_JTAG_SUPPORTED=y -CONFIG_SOC_TEMP_SENSOR_SUPPORTED=y -CONFIG_SOC_WIFI_SUPPORTED=y -CONFIG_SOC_SUPPORTS_SECURE_DL_MODE=y -CONFIG_SOC_LP_CORE_SUPPORTED=y -CONFIG_SOC_ULP_SUPPORTED=y -CONFIG_SOC_EFUSE_KEY_PURPOSE_FIELD=y -CONFIG_SOC_EFUSE_SUPPORTED=y -CONFIG_SOC_RTC_FAST_MEM_SUPPORTED=y -CONFIG_SOC_RTC_MEM_SUPPORTED=y -CONFIG_SOC_I2S_SUPPORTED=y -CONFIG_SOC_RMT_SUPPORTED=y -CONFIG_SOC_SDM_SUPPORTED=y -CONFIG_SOC_GPSPI_SUPPORTED=y -CONFIG_SOC_LEDC_SUPPORTED=y -CONFIG_SOC_I2C_SUPPORTED=y -CONFIG_SOC_SYSTIMER_SUPPORTED=y -CONFIG_SOC_SUPPORT_COEXISTENCE=y -CONFIG_SOC_AES_SUPPORTED=y -CONFIG_SOC_MPI_SUPPORTED=y -CONFIG_SOC_SHA_SUPPORTED=y -CONFIG_SOC_RSA_SUPPORTED=y -CONFIG_SOC_HMAC_SUPPORTED=y -CONFIG_SOC_DIG_SIGN_SUPPORTED=y -CONFIG_SOC_ECC_SUPPORTED=y -CONFIG_SOC_ECC_EXTENDED_MODES_SUPPORTED=y -CONFIG_SOC_FLASH_ENC_SUPPORTED=y -CONFIG_SOC_SECURE_BOOT_SUPPORTED=y -CONFIG_SOC_IEEE802154_SUPPORTED=y -CONFIG_SOC_BOD_SUPPORTED=y -CONFIG_SOC_APM_SUPPORTED=y -CONFIG_SOC_PMU_SUPPORTED=y -CONFIG_SOC_PAU_SUPPORTED=y -CONFIG_SOC_LP_TIMER_SUPPORTED=y -CONFIG_SOC_LP_AON_SUPPORTED=y -CONFIG_SOC_LP_PERIPHERALS_SUPPORTED=y -CONFIG_SOC_LP_I2C_SUPPORTED=y -CONFIG_SOC_ULP_LP_UART_SUPPORTED=y -CONFIG_SOC_CLK_TREE_SUPPORTED=y -CONFIG_SOC_ASSIST_DEBUG_SUPPORTED=y -CONFIG_SOC_WDT_SUPPORTED=y -CONFIG_SOC_SDIO_SLAVE_SUPPORTED=y -CONFIG_SOC_SPI_FLASH_SUPPORTED=y -CONFIG_SOC_ECDSA_SUPPORTED=y -CONFIG_SOC_RNG_SUPPORTED=y -CONFIG_SOC_KEY_MANAGER_SUPPORTED=y -CONFIG_SOC_HUK_SUPPORTED=y -CONFIG_SOC_MODEM_CLOCK_SUPPORTED=y -CONFIG_SOC_LIGHT_SLEEP_SUPPORTED=y -CONFIG_SOC_DEEP_SLEEP_SUPPORTED=y -CONFIG_SOC_PM_SUPPORTED=y -CONFIG_SOC_CLOCK_TREE_MANAGEMENT_SUPPORTED=y -CONFIG_SOC_SPIRAM_SUPPORTED=y -CONFIG_SOC_BT_SUPPORTED=y -CONFIG_SOC_PHY_SUPPORTED=y -CONFIG_SOC_BITSCRAMBLER_SUPPORTED=y -CONFIG_SOC_XTAL_SUPPORT_40M=y -CONFIG_SOC_XTAL_SUPPORT_48M=y -CONFIG_SOC_XTAL_CLOCK_PATH_DEPENDS_ON_TOP_DOMAIN=y -CONFIG_SOC_AES_SUPPORT_DMA=y -CONFIG_SOC_AES_GDMA=y -CONFIG_SOC_AES_SUPPORT_AES_128=y -CONFIG_SOC_AES_SUPPORT_AES_256=y -CONFIG_SOC_AES_SUPPORT_PSEUDO_ROUND_FUNCTION=y -CONFIG_SOC_ADC_DIG_CTRL_SUPPORTED=y -CONFIG_SOC_ADC_DIG_IIR_FILTER_SUPPORTED=y -CONFIG_SOC_ADC_MONITOR_SUPPORTED=y -CONFIG_SOC_ADC_DMA_SUPPORTED=y -CONFIG_SOC_ADC_PERIPH_NUM=1 -CONFIG_SOC_ADC_MAX_CHANNEL_NUM=6 -CONFIG_SOC_ADC_ATTEN_NUM=4 -CONFIG_SOC_ADC_DIGI_CONTROLLER_NUM=1 -CONFIG_SOC_ADC_PATT_LEN_MAX=8 -CONFIG_SOC_ADC_DIGI_MAX_BITWIDTH=12 -CONFIG_SOC_ADC_DIGI_MIN_BITWIDTH=12 -CONFIG_SOC_ADC_DIGI_IIR_FILTER_NUM=2 -CONFIG_SOC_ADC_DIGI_MONITOR_NUM=2 -CONFIG_SOC_ADC_DIGI_RESULT_BYTES=4 -CONFIG_SOC_ADC_DIGI_DATA_BYTES_PER_CONV=4 -CONFIG_SOC_ADC_SAMPLE_FREQ_THRES_HIGH=83333 -CONFIG_SOC_ADC_SAMPLE_FREQ_THRES_LOW=611 -CONFIG_SOC_ADC_RTC_MIN_BITWIDTH=12 -CONFIG_SOC_ADC_RTC_MAX_BITWIDTH=12 -CONFIG_SOC_ADC_CALIBRATION_V1_SUPPORTED=y -CONFIG_SOC_ADC_CALIB_CHAN_COMPENS_SUPPORTED=y -CONFIG_SOC_ADC_TEMPERATURE_SHARE_INTR=y -CONFIG_SOC_ADC_SHARED_POWER=y -CONFIG_SOC_BROWNOUT_RESET_SUPPORTED=y -CONFIG_SOC_SHARED_IDCACHE_SUPPORTED=y -CONFIG_SOC_CACHE_WRITEBACK_SUPPORTED=y -CONFIG_SOC_CACHE_FREEZE_SUPPORTED=y -CONFIG_SOC_CPU_CORES_NUM=1 -CONFIG_SOC_CPU_INTR_NUM=32 -CONFIG_SOC_CPU_HAS_FLEXIBLE_INTC=y -CONFIG_SOC_CPU_SUPPORT_WFE=y -CONFIG_SOC_INT_CLIC_SUPPORTED=y -CONFIG_SOC_INT_HW_NESTED_SUPPORTED=y -CONFIG_SOC_BRANCH_PREDICTOR_SUPPORTED=y -CONFIG_SOC_CPU_BREAKPOINTS_NUM=3 -CONFIG_SOC_CPU_WATCHPOINTS_NUM=3 -CONFIG_SOC_CPU_WATCHPOINT_MAX_REGION_SIZE=0x100 -CONFIG_SOC_CPU_HAS_PMA=y -CONFIG_SOC_CPU_IDRAM_SPLIT_USING_PMP=y -CONFIG_SOC_CPU_PMP_REGION_GRANULARITY=128 -CONFIG_SOC_CPU_HAS_LOCKUP_RESET=y -CONFIG_SOC_DS_SIGNATURE_MAX_BIT_LEN=3072 -CONFIG_SOC_DS_KEY_PARAM_MD_IV_LENGTH=16 -CONFIG_SOC_DS_KEY_CHECK_MAX_WAIT_US=1100 -CONFIG_SOC_DMA_CAN_ACCESS_FLASH=y -CONFIG_SOC_AHB_GDMA_VERSION=2 -CONFIG_SOC_GDMA_NUM_GROUPS_MAX=1 -CONFIG_SOC_GDMA_PAIRS_PER_GROUP_MAX=3 -CONFIG_SOC_GDMA_SUPPORT_ETM=y -CONFIG_SOC_GDMA_SUPPORT_SLEEP_RETENTION=y -CONFIG_SOC_AHB_GDMA_SUPPORT_PSRAM=y -CONFIG_SOC_GDMA_EXT_MEM_ENC_ALIGNMENT=16 -CONFIG_SOC_ETM_GROUPS=1 -CONFIG_SOC_ETM_CHANNELS_PER_GROUP=50 -CONFIG_SOC_ETM_SUPPORT_SLEEP_RETENTION=y -CONFIG_SOC_GPIO_PORT=1 -CONFIG_SOC_GPIO_PIN_COUNT=29 -CONFIG_SOC_GPIO_SUPPORT_PIN_GLITCH_FILTER=y -CONFIG_SOC_GPIO_FLEX_GLITCH_FILTER_NUM=8 -CONFIG_SOC_GPIO_SUPPORT_PIN_HYS_FILTER=y -CONFIG_SOC_GPIO_SUPPORT_ETM=y -CONFIG_SOC_GPIO_SUPPORT_RTC_INDEPENDENT=y -CONFIG_SOC_GPIO_SUPPORT_DEEPSLEEP_WAKEUP=y -CONFIG_SOC_LP_IO_CLOCK_IS_INDEPENDENT=y -CONFIG_SOC_GPIO_IN_RANGE_MAX=28 -CONFIG_SOC_GPIO_OUT_RANGE_MAX=28 -CONFIG_SOC_GPIO_DEEP_SLEEP_WAKE_VALID_GPIO_MASK=0 -CONFIG_SOC_GPIO_DEEP_SLEEP_WAKE_SUPPORTED_PIN_CNT=7 -CONFIG_SOC_GPIO_VALID_DIGITAL_IO_PAD_MASK=0x0000000001FFFF80 -CONFIG_SOC_GPIO_SUPPORT_FORCE_HOLD=y -CONFIG_SOC_GPIO_SUPPORT_HOLD_SINGLE_IO_IN_DSLP=y -CONFIG_SOC_GPIO_CLOCKOUT_BY_GPIO_MATRIX=y -CONFIG_SOC_CLOCKOUT_HAS_SOURCE_GATE=y -CONFIG_SOC_GPIO_CLOCKOUT_CHANNEL_NUM=3 -CONFIG_SOC_RTCIO_PIN_COUNT=7 -CONFIG_SOC_RTCIO_INPUT_OUTPUT_SUPPORTED=y -CONFIG_SOC_RTCIO_HOLD_SUPPORTED=y -CONFIG_SOC_RTCIO_WAKE_SUPPORTED=y -CONFIG_SOC_RTCIO_EDGE_WAKE_SUPPORTED=y -CONFIG_SOC_DEDIC_GPIO_OUT_CHANNELS_NUM=8 -CONFIG_SOC_DEDIC_GPIO_IN_CHANNELS_NUM=8 -CONFIG_SOC_DEDIC_PERIPH_ALWAYS_ENABLE=y -CONFIG_SOC_ANA_CMPR_NUM=1 -CONFIG_SOC_ANA_CMPR_CAN_DISTINGUISH_EDGE=y -CONFIG_SOC_ANA_CMPR_SUPPORT_ETM=y -CONFIG_SOC_I2C_NUM=2 -CONFIG_SOC_HP_I2C_NUM=1 -CONFIG_SOC_I2C_FIFO_LEN=32 -CONFIG_SOC_I2C_CMD_REG_NUM=8 -CONFIG_SOC_I2C_SUPPORT_SLAVE=y -CONFIG_SOC_I2C_SUPPORT_HW_FSM_RST=y -CONFIG_SOC_I2C_SUPPORT_XTAL=y -CONFIG_SOC_I2C_SUPPORT_RTC=y -CONFIG_SOC_I2C_SUPPORT_10BIT_ADDR=y -CONFIG_SOC_I2C_SLAVE_SUPPORT_BROADCAST=y -CONFIG_SOC_I2C_SLAVE_CAN_GET_STRETCH_CAUSE=y -CONFIG_SOC_I2C_SLAVE_SUPPORT_I2CRAM_ACCESS=y -CONFIG_SOC_I2C_SLAVE_SUPPORT_SLAVE_UNMATCH=y -CONFIG_SOC_I2C_SUPPORT_SLEEP_RETENTION=y -CONFIG_SOC_LP_I2C_NUM=1 -CONFIG_SOC_LP_I2C_FIFO_LEN=16 -CONFIG_SOC_I2S_NUM=1 -CONFIG_SOC_I2S_HW_VERSION_2=y -CONFIG_SOC_I2S_SUPPORTS_ETM=y -CONFIG_SOC_I2S_SUPPORTS_XTAL=y -CONFIG_SOC_I2S_SUPPORTS_PLL_F160M=y -CONFIG_SOC_I2S_SUPPORTS_PLL_F240M=y -CONFIG_SOC_I2S_SUPPORTS_PCM=y -CONFIG_SOC_I2S_SUPPORTS_PDM=y -CONFIG_SOC_I2S_SUPPORTS_PDM_TX=y -CONFIG_SOC_I2S_SUPPORTS_PCM2PDM=y -CONFIG_SOC_I2S_SUPPORTS_PDM_RX=y -CONFIG_SOC_I2S_SUPPORTS_TX_SYNC_CNT=y -CONFIG_SOC_I2S_PDM_MAX_TX_LINES=2 -CONFIG_SOC_I2S_PDM_MAX_RX_LINES=1 -CONFIG_SOC_I2S_SUPPORTS_TDM=y -CONFIG_SOC_I2S_TDM_FULL_DATA_WIDTH=y -CONFIG_SOC_I2S_SUPPORT_SLEEP_RETENTION=y -CONFIG_SOC_LEDC_SUPPORT_PLL_DIV_CLOCK=y -CONFIG_SOC_LEDC_SUPPORT_XTAL_CLOCK=y -CONFIG_SOC_LEDC_TIMER_NUM=4 -CONFIG_SOC_LEDC_CHANNEL_NUM=6 -CONFIG_SOC_LEDC_TIMER_BIT_WIDTH=20 -CONFIG_SOC_LEDC_SUPPORT_FADE_STOP=y -CONFIG_SOC_LEDC_GAMMA_CURVE_FADE_SUPPORTED=y -CONFIG_SOC_LEDC_GAMMA_CURVE_FADE_RANGE_MAX=16 -CONFIG_SOC_LEDC_FADE_PARAMS_BIT_WIDTH=10 -CONFIG_SOC_LEDC_SUPPORT_SLEEP_RETENTION=y -CONFIG_SOC_MMU_PERIPH_NUM=1 -CONFIG_SOC_MMU_LINEAR_ADDRESS_REGION_NUM=1 -CONFIG_SOC_MMU_DI_VADDR_SHARED=y -CONFIG_SOC_PCNT_GROUPS=1 -CONFIG_SOC_PCNT_UNITS_PER_GROUP=4 -CONFIG_SOC_PCNT_CHANNELS_PER_UNIT=2 -CONFIG_SOC_PCNT_THRES_POINT_PER_UNIT=2 -CONFIG_SOC_PCNT_SUPPORT_RUNTIME_THRES_UPDATE=y -CONFIG_SOC_PCNT_SUPPORT_CLEAR_SIGNAL=y -CONFIG_SOC_PCNT_SUPPORT_STEP_NOTIFY=y -CONFIG_SOC_PCNT_SUPPORT_SLEEP_RETENTION=y -CONFIG_SOC_RMT_GROUPS=1 -CONFIG_SOC_RMT_TX_CANDIDATES_PER_GROUP=2 -CONFIG_SOC_RMT_RX_CANDIDATES_PER_GROUP=2 -CONFIG_SOC_RMT_CHANNELS_PER_GROUP=4 -CONFIG_SOC_RMT_MEM_WORDS_PER_CHANNEL=48 -CONFIG_SOC_RMT_SUPPORT_RX_PINGPONG=y -CONFIG_SOC_RMT_SUPPORT_RX_DEMODULATION=y -CONFIG_SOC_RMT_SUPPORT_ASYNC_STOP=y -CONFIG_SOC_RMT_SUPPORT_TX_LOOP_COUNT=y -CONFIG_SOC_RMT_SUPPORT_TX_LOOP_AUTO_STOP=y -CONFIG_SOC_RMT_SUPPORT_TX_SYNCHRO=y -CONFIG_SOC_RMT_SUPPORT_TX_CARRIER_DATA_ONLY=y -CONFIG_SOC_RMT_SUPPORT_XTAL=y -CONFIG_SOC_RMT_SUPPORT_SLEEP_RETENTION=y -CONFIG_SOC_MCPWM_GROUPS=1 -CONFIG_SOC_MCPWM_TIMERS_PER_GROUP=3 -CONFIG_SOC_MCPWM_OPERATORS_PER_GROUP=3 -CONFIG_SOC_MCPWM_COMPARATORS_PER_OPERATOR=2 -CONFIG_SOC_MCPWM_GENERATORS_PER_OPERATOR=2 -CONFIG_SOC_MCPWM_EVENT_COMPARATORS_PER_OPERATOR=2 -CONFIG_SOC_MCPWM_TRIGGERS_PER_OPERATOR=2 -CONFIG_SOC_MCPWM_GPIO_FAULTS_PER_GROUP=3 -CONFIG_SOC_MCPWM_CAPTURE_TIMERS_PER_GROUP=y -CONFIG_SOC_MCPWM_CAPTURE_CHANNELS_PER_TIMER=3 -CONFIG_SOC_MCPWM_GPIO_SYNCHROS_PER_GROUP=3 -CONFIG_SOC_MCPWM_SWSYNC_CAN_PROPAGATE=y -CONFIG_SOC_MCPWM_SUPPORT_ETM=y -CONFIG_SOC_MCPWM_SUPPORT_EVENT_COMPARATOR=y -CONFIG_SOC_MCPWM_CAPTURE_CLK_FROM_GROUP=y -CONFIG_SOC_MCPWM_SUPPORT_SLEEP_RETENTION=y -CONFIG_SOC_PARLIO_GROUPS=1 -CONFIG_SOC_PARLIO_TX_UNITS_PER_GROUP=1 -CONFIG_SOC_PARLIO_RX_UNITS_PER_GROUP=1 -CONFIG_SOC_PARLIO_TX_UNIT_MAX_DATA_WIDTH=8 -CONFIG_SOC_PARLIO_RX_UNIT_MAX_DATA_WIDTH=8 -CONFIG_SOC_PARLIO_TX_CLK_SUPPORT_GATING=y -CONFIG_SOC_PARLIO_RX_CLK_SUPPORT_GATING=y -CONFIG_SOC_PARLIO_RX_CLK_SUPPORT_OUTPUT=y -CONFIG_SOC_PARLIO_TRANS_BIT_ALIGN=y -CONFIG_SOC_PARLIO_TX_SUPPORT_LOOP_TRANSMISSION=y -CONFIG_SOC_PARLIO_TX_SUPPORT_EOF_FROM_DMA=y -CONFIG_SOC_PARLIO_SUPPORT_SLEEP_RETENTION=y -CONFIG_SOC_PARLIO_SUPPORT_SPI_LCD=y -CONFIG_SOC_PARLIO_SUPPORT_I80_LCD=y -CONFIG_SOC_MPI_MEM_BLOCKS_NUM=4 -CONFIG_SOC_MPI_OPERATIONS_NUM=3 -CONFIG_SOC_RSA_MAX_BIT_LEN=3072 -CONFIG_SOC_SHA_DMA_MAX_BUFFER_SIZE=3968 -CONFIG_SOC_SHA_SUPPORT_DMA=y -CONFIG_SOC_SHA_SUPPORT_RESUME=y -CONFIG_SOC_SHA_GDMA=y -CONFIG_SOC_SHA_SUPPORT_SHA1=y -CONFIG_SOC_SHA_SUPPORT_SHA224=y -CONFIG_SOC_SHA_SUPPORT_SHA256=y -CONFIG_SOC_SHA_SUPPORT_SHA384=y -CONFIG_SOC_SHA_SUPPORT_SHA512=y -CONFIG_SOC_SHA_SUPPORT_SHA512_224=y -CONFIG_SOC_SHA_SUPPORT_SHA512_256=y -CONFIG_SOC_SHA_SUPPORT_SHA512_T=y -CONFIG_SOC_ECC_CONSTANT_TIME_POINT_MUL=y -CONFIG_SOC_ECC_SUPPORT_CURVE_P384=y -CONFIG_SOC_ECDSA_SUPPORT_EXPORT_PUBKEY=y -CONFIG_SOC_ECDSA_SUPPORT_DETERMINISTIC_MODE=y -CONFIG_SOC_ECDSA_SUPPORT_HW_DETERMINISTIC_LOOP=y -CONFIG_SOC_ECDSA_SUPPORT_CURVE_P384=y -CONFIG_SOC_ECDSA_SUPPORT_CURVE_SPECIFIC_KEY_PURPOSES=y -CONFIG_SOC_SDM_GROUPS=1 -CONFIG_SOC_SDM_CHANNELS_PER_GROUP=4 -CONFIG_SOC_SDM_CLK_SUPPORT_PLL_F80M=y -CONFIG_SOC_SDM_CLK_SUPPORT_XTAL=y -CONFIG_SOC_SPI_PERIPH_NUM=2 -CONFIG_SOC_SPI_MAX_CS_NUM=6 -CONFIG_SOC_SPI_MAXIMUM_BUFFER_SIZE=64 -CONFIG_SOC_SPI_SUPPORT_DDRCLK=y -CONFIG_SOC_SPI_SLAVE_SUPPORT_SEG_TRANS=y -CONFIG_SOC_SPI_SUPPORT_CD_SIG=y -CONFIG_SOC_SPI_SUPPORT_CONTINUOUS_TRANS=y -CONFIG_SOC_SPI_SUPPORT_SLAVE_HD_VER2=y -CONFIG_SOC_SPI_SUPPORT_SLEEP_RETENTION=y -CONFIG_SOC_SPI_SUPPORT_CLK_XTAL=y -CONFIG_SOC_SPI_SUPPORT_CLK_PLL_F160M=y -CONFIG_SOC_SPI_SUPPORT_CLK_RC_FAST=y -CONFIG_SOC_MEMSPI_IS_INDEPENDENT=y -CONFIG_SOC_SPI_MAX_PRE_DIVIDER=16 -CONFIG_SOC_SPIRAM_XIP_SUPPORTED=y -CONFIG_SOC_PSRAM_DMA_CAPABLE=y -CONFIG_SOC_SPI_MEM_SUPPORT_AUTO_WAIT_IDLE=y -CONFIG_SOC_SPI_MEM_SUPPORT_AUTO_SUSPEND=y -CONFIG_SOC_SPI_MEM_SUPPORT_AUTO_RESUME=y -CONFIG_SOC_SPI_MEM_SUPPORT_IDLE_INTR=y -CONFIG_SOC_SPI_MEM_SUPPORT_SW_SUSPEND=y -CONFIG_SOC_SPI_MEM_SUPPORT_CHECK_SUS=y -CONFIG_SOC_SPI_MEM_SUPPORT_WRAP=y -CONFIG_SOC_SPI_MEM_SUPPORT_WB_MODE_INDEPENDENT_CONTROL=y -CONFIG_SOC_SPI_MEM_SUPPORT_CACHE_32BIT_ADDR_MAP=y -CONFIG_SOC_SPI_MEM_SUPPORT_TIMING_TUNING=y -CONFIG_SOC_SPI_MEM_SUPPORT_TSUS_TRES_SEPERATE_CTR=y -CONFIG_SOC_SPI_MEM_PSRAM_FREQ_AXI_CONSTRAINED=y -CONFIG_SOC_MEMSPI_TIMING_TUNING_BY_MSPI_DELAY=y -CONFIG_SOC_MEMSPI_SRC_FREQ_120M_SUPPORTED=y -CONFIG_SOC_MEMSPI_SRC_FREQ_80M_SUPPORTED=y -CONFIG_SOC_MEMSPI_SRC_FREQ_40M_SUPPORTED=y -CONFIG_SOC_MEMSPI_SRC_FREQ_20M_SUPPORTED=y -CONFIG_SOC_SYSTIMER_COUNTER_NUM=2 -CONFIG_SOC_SYSTIMER_ALARM_NUM=3 -CONFIG_SOC_SYSTIMER_BIT_WIDTH_LO=32 -CONFIG_SOC_SYSTIMER_BIT_WIDTH_HI=20 -CONFIG_SOC_SYSTIMER_FIXED_DIVIDER=y -CONFIG_SOC_SYSTIMER_SUPPORT_RC_FAST=y -CONFIG_SOC_SYSTIMER_INT_LEVEL=y -CONFIG_SOC_SYSTIMER_ALARM_MISS_COMPENSATE=y -CONFIG_SOC_SYSTIMER_SUPPORT_ETM=y -CONFIG_SOC_LP_TIMER_BIT_WIDTH_LO=32 -CONFIG_SOC_LP_TIMER_BIT_WIDTH_HI=16 -CONFIG_SOC_TIMER_GROUPS=2 -CONFIG_SOC_TIMER_GROUP_TIMERS_PER_GROUP=1 -CONFIG_SOC_TIMER_GROUP_COUNTER_BIT_WIDTH=54 -CONFIG_SOC_TIMER_GROUP_SUPPORT_XTAL=y -CONFIG_SOC_TIMER_GROUP_SUPPORT_RC_FAST=y -CONFIG_SOC_TIMER_GROUP_TOTAL_TIMERS=2 -CONFIG_SOC_TIMER_SUPPORT_ETM=y -CONFIG_SOC_TIMER_SUPPORT_SLEEP_RETENTION=y -CONFIG_SOC_MWDT_SUPPORT_SLEEP_RETENTION=y -CONFIG_SOC_TWAI_CONTROLLER_NUM=2 -CONFIG_SOC_TWAI_MASK_FILTER_NUM=3 -CONFIG_SOC_TWAI_RANGE_FILTER_NUM=1 -CONFIG_SOC_TWAI_BRP_MIN=1 -CONFIG_SOC_TWAI_BRP_MAX=255 -CONFIG_SOC_TWAI_CLK_SUPPORT_XTAL=y -CONFIG_SOC_TWAI_SUPPORTS_RX_STATUS=y -CONFIG_SOC_TWAI_SUPPORT_FD=y -CONFIG_SOC_TWAI_SUPPORT_TIMESTAMP=y -CONFIG_SOC_EFUSE_DIS_PAD_JTAG=y -CONFIG_SOC_EFUSE_DIS_USB_JTAG=y -CONFIG_SOC_EFUSE_DIS_DIRECT_BOOT=y -CONFIG_SOC_EFUSE_SOFT_DIS_JTAG=y -CONFIG_SOC_EFUSE_DIS_ICACHE=y -CONFIG_SOC_EFUSE_ECDSA_KEY=y -CONFIG_SOC_EFUSE_ECDSA_KEY_P192=y -CONFIG_SOC_EFUSE_ECDSA_KEY_P384=y -CONFIG_SOC_HUK_MEM_NEEDS_RECHARGE=y -CONFIG_SOC_KEY_MANAGER_SUPPORT_KEY_DEPLOYMENT=y -CONFIG_SOC_KEY_MANAGER_ECDSA_KEY_DEPLOY=y -CONFIG_SOC_KEY_MANAGER_FE_KEY_DEPLOY=y -CONFIG_SOC_KEY_MANAGER_FE_KEY_DEPLOY_XTS_AES_128=y -CONFIG_SOC_KEY_MANAGER_FE_KEY_DEPLOY_XTS_AES_256=y -CONFIG_SOC_KEY_MANAGER_HMAC_KEY_DEPLOY=y -CONFIG_SOC_KEY_MANAGER_DS_KEY_DEPLOY=y -CONFIG_SOC_SECURE_BOOT_V2_RSA=y -CONFIG_SOC_SECURE_BOOT_V2_ECC=y -CONFIG_SOC_EFUSE_SECURE_BOOT_KEY_DIGESTS=3 -CONFIG_SOC_EFUSE_REVOKE_BOOT_KEY_DIGESTS=y -CONFIG_SOC_SUPPORT_SECURE_BOOT_REVOKE_KEY=y -CONFIG_SOC_FLASH_ENCRYPTED_XTS_AES_BLOCK_MAX=64 -CONFIG_SOC_FLASH_ENCRYPTION_XTS_AES=y -CONFIG_SOC_FLASH_ENCRYPTION_XTS_AES_128=y -CONFIG_SOC_FLASH_ENCRYPTION_XTS_AES_SUPPORT_PSEUDO_ROUND=y -CONFIG_SOC_PSRAM_ENCRYPTION_XTS_AES_128=y -CONFIG_SOC_RECOVERY_BOOTLOADER_SUPPORTED=y -CONFIG_SOC_BOOTLOADER_ANTI_ROLLBACK_SUPPORTED=y -CONFIG_SOC_APM_CTRL_FILTER_SUPPORTED=y -CONFIG_SOC_APM_LP_APM0_SUPPORTED=y -CONFIG_SOC_APM_CPU_APM_SUPPORTED=y -CONFIG_SOC_APM_SUPPORT_LP_TEE_CTRL=y -CONFIG_SOC_APM_SUPPORT_CTRL_CFG_LOCK=y -CONFIG_SOC_APM_SUPPORT_TEE_PERI_ACCESS_CTRL=y -CONFIG_SOC_CRYPTO_DPA_PROTECTION_SUPPORTED=y -CONFIG_SOC_RNG_BUF_CHAIN_ENTROPY_SOURCE=y -CONFIG_SOC_RNG_RTC_TIMER_ENTROPY_SOURCE=y -CONFIG_SOC_UART_NUM=3 -CONFIG_SOC_UART_HP_NUM=2 -CONFIG_SOC_UART_LP_NUM=1 -CONFIG_SOC_UART_FIFO_LEN=128 -CONFIG_SOC_LP_UART_FIFO_LEN=16 -CONFIG_SOC_UART_BITRATE_MAX=5000000 -CONFIG_SOC_UART_SUPPORT_PLL_F80M_CLK=y -CONFIG_SOC_UART_SUPPORT_RTC_CLK=y -CONFIG_SOC_UART_SUPPORT_XTAL_CLK=y -CONFIG_SOC_UART_SUPPORT_WAKEUP_INT=y -CONFIG_SOC_UART_HAS_LP_UART=y -CONFIG_SOC_UART_SUPPORT_SLEEP_RETENTION=y -CONFIG_SOC_UART_SUPPORT_FSM_TX_WAIT_SEND=y -CONFIG_SOC_UART_WAKEUP_CHARS_SEQ_MAX_LEN=5 -CONFIG_SOC_UART_WAKEUP_SUPPORT_ACTIVE_THRESH_MODE=y -CONFIG_SOC_UART_WAKEUP_SUPPORT_FIFO_THRESH_MODE=y -CONFIG_SOC_UART_WAKEUP_SUPPORT_START_BIT_MODE=y -CONFIG_SOC_UART_WAKEUP_SUPPORT_CHAR_SEQ_MODE=y -CONFIG_SOC_UHCI_NUM=1 -CONFIG_SOC_COEX_HW_PTI=y -CONFIG_SOC_EXTERNAL_COEX_ADVANCE=y -CONFIG_SOC_WIFI_LIGHT_SLEEP_CLK_WIDTH=12 -CONFIG_SOC_RTC_MEM_SUPPORT_SPEED_MODE_SWITCH=y -CONFIG_SOC_PM_SUPPORT_WIFI_WAKEUP=y -CONFIG_SOC_PM_SUPPORT_BEACON_WAKEUP=y -CONFIG_SOC_PM_SUPPORT_BT_WAKEUP=y -CONFIG_SOC_PM_SUPPORT_EXT1_WAKEUP=y -CONFIG_SOC_PM_SUPPORT_EXT1_WAKEUP_MODE_PER_PIN=y -CONFIG_SOC_PM_SUPPORT_CPU_PD=y -CONFIG_SOC_PM_SUPPORT_MODEM_PD=y -CONFIG_SOC_PM_SUPPORT_XTAL32K_PD=y -CONFIG_SOC_PM_SUPPORT_RC32K_PD=y -CONFIG_SOC_PM_SUPPORT_RC_FAST_PD=y -CONFIG_SOC_PM_SUPPORT_VDDSDIO_PD=y -CONFIG_SOC_PM_SUPPORT_TOP_PD=y -CONFIG_SOC_PM_SUPPORT_HP_AON_PD=y -CONFIG_SOC_PM_SUPPORT_MAC_BB_PD=y -CONFIG_SOC_PM_SUPPORT_RTC_PERIPH_PD=y -CONFIG_SOC_PM_SUPPORT_PMU_MODEM_STATE=y -CONFIG_SOC_PM_SUPPORT_PMU_CLK_ICG=y -CONFIG_SOC_PM_SUPPORT_DEEPSLEEP_CHECK_STUB_ONLY=y -CONFIG_SOC_PM_CPU_RETENTION_BY_SW=y -CONFIG_SOC_PM_MODEM_RETENTION_BY_REGDMA=y -CONFIG_SOC_EXT_MEM_CACHE_TAG_IN_CPU_DOMAIN=y -CONFIG_SOC_PM_PAU_LINK_NUM=5 -CONFIG_SOC_PM_PAU_REGDMA_LINK_CONFIGURABLE=y -CONFIG_SOC_PM_PAU_REGDMA_LINK_IDX_WIFIMAC=4 -CONFIG_SOC_PM_PAU_REGDMA_COMMON_PHY_LINK_ENTRY=y -CONFIG_SOC_PM_PMU_MIN_SLP_SLOW_CLK_CYCLE_FIXED=y -CONFIG_SOC_PM_RETENTION_MODULE_NUM=32 -CONFIG_SOC_CLK_RC_FAST_SUPPORT_CALIBRATION=y -CONFIG_SOC_MODEM_CLOCK_IS_INDEPENDENT=y -CONFIG_SOC_RNG_CLOCK_IS_INDEPENDENT=y -CONFIG_SOC_CLK_XTAL32K_SUPPORTED=y -CONFIG_SOC_CLK_OSC_SLOW_SUPPORTED=y -CONFIG_SOC_CLK_LP_FAST_SUPPORT_XTAL=y -CONFIG_SOC_CLK_LP_FAST_SUPPORT_XTAL_D2=y -CONFIG_SOC_RCC_IS_INDEPENDENT=y -CONFIG_SOC_CLK_ANA_I2C_MST_HAS_ROOT_GATE=y -CONFIG_SOC_TEMPERATURE_SENSOR_SUPPORT_FAST_RC=y -CONFIG_SOC_TEMPERATURE_SENSOR_SUPPORT_XTAL=y -CONFIG_SOC_TEMPERATURE_SENSOR_INTR_SUPPORT=y -CONFIG_SOC_TEMPERATURE_SENSOR_SUPPORT_SLEEP_RETENTION=y -CONFIG_SOC_TEMPERATURE_SENSOR_UNDER_PD_TOP_DOMAIN=y -CONFIG_SOC_WIFI_HW_TSF=y -CONFIG_SOC_WIFI_FTM_SUPPORT=y -CONFIG_SOC_WIFI_GCMP_SUPPORT=y -CONFIG_SOC_WIFI_WAPI_SUPPORT=y -CONFIG_SOC_WIFI_TXOP_SUPPORT=y -CONFIG_SOC_WIFI_CSI_SUPPORT=y -CONFIG_SOC_WIFI_MESH_SUPPORT=y -CONFIG_SOC_WIFI_HE_SUPPORT=y -CONFIG_SOC_WIFI_SUPPORT_5G=y -CONFIG_SOC_WIFI_MAC_VERSION_NUM=3 -CONFIG_SOC_WIFI_NAN_SUPPORT=y -CONFIG_SOC_BLE_SUPPORTED=y -CONFIG_SOC_ESP_NIMBLE_CONTROLLER=y -CONFIG_SOC_BLE_50_SUPPORTED=y -CONFIG_SOC_BLE_DEVICE_PRIVACY_SUPPORTED=y -CONFIG_SOC_BLE_POWER_CONTROL_SUPPORTED=y -CONFIG_SOC_BLE_MULTI_CONN_OPTIMIZATION=y -CONFIG_SOC_BLE_PERIODIC_ADV_ENH_SUPPORTED=y -CONFIG_SOC_BLE_CTE_SUPPORTED=y -CONFIG_SOC_BLE_PERIODIC_ADV_WITH_RESPONSE=y -CONFIG_SOC_PHY_CALIBRATION_CLOCK_IS_INDEPENDENT=y -CONFIG_SOC_LP_CORE_SINGLE_INTERRUPT_VECTOR=y -CONFIG_SOC_LP_CORE_SUPPORT_ETM=y -CONFIG_SOC_LP_CORE_SUPPORT_STORE_LOAD_EXCEPTIONS=y -CONFIG_IDF_CMAKE=y -CONFIG_IDF_ENV_BRINGUP=y -CONFIG_IDF_TOOLCHAIN="gcc" -CONFIG_IDF_TOOLCHAIN_GCC=y -CONFIG_IDF_TARGET_ARCH_RISCV=y -CONFIG_IDF_TARGET_ARCH="riscv" -CONFIG_IDF_TARGET="esp32c5" -CONFIG_IDF_INIT_VERSION="5.5.0" -CONFIG_IDF_TARGET_ESP32C5=y -CONFIG_IDF_FIRMWARE_CHIP_ID=0x0017 - -# -# Build type -# -CONFIG_APP_BUILD_TYPE_APP_2NDBOOT=y -# CONFIG_APP_BUILD_TYPE_RAM is not set -CONFIG_APP_BUILD_GENERATE_BINARIES=y -CONFIG_APP_BUILD_BOOTLOADER=y -CONFIG_APP_BUILD_USE_FLASH_SECTIONS=y -# CONFIG_APP_REPRODUCIBLE_BUILD is not set -# CONFIG_APP_NO_BLOBS is not set -# end of Build type - -# -# Bootloader config -# - -# -# Bootloader manager -# -CONFIG_BOOTLOADER_COMPILE_TIME_DATE=y -CONFIG_BOOTLOADER_PROJECT_VER=1 -# end of Bootloader manager - -# -# Application Rollback -# -# CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE is not set -# end of Application Rollback - -# -# Recovery Bootloader and Rollback -# -# CONFIG_BOOTLOADER_RECOVERY_ENABLE is not set -# end of Recovery Bootloader and Rollback - -CONFIG_BOOTLOADER_OFFSET_IN_FLASH=0x2000 -CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y -# CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_DEBUG is not set -# CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_PERF is not set - -# -# Log -# -CONFIG_BOOTLOADER_LOG_VERSION_1=y -CONFIG_BOOTLOADER_LOG_VERSION=1 -# CONFIG_BOOTLOADER_LOG_LEVEL_NONE is not set -# CONFIG_BOOTLOADER_LOG_LEVEL_ERROR is not set -# CONFIG_BOOTLOADER_LOG_LEVEL_WARN is not set -CONFIG_BOOTLOADER_LOG_LEVEL_INFO=y -# CONFIG_BOOTLOADER_LOG_LEVEL_DEBUG is not set -# CONFIG_BOOTLOADER_LOG_LEVEL_VERBOSE is not set -CONFIG_BOOTLOADER_LOG_LEVEL=3 - -# -# Format -# -# CONFIG_BOOTLOADER_LOG_COLORS is not set -CONFIG_BOOTLOADER_LOG_TIMESTAMP_SOURCE_CPU_TICKS=y -# end of Format - -# -# Settings -# -CONFIG_BOOTLOADER_LOG_MODE_TEXT_EN=y -CONFIG_BOOTLOADER_LOG_MODE_TEXT=y -# end of Settings -# end of Log - -# -# Serial Flash Configurations -# -# CONFIG_BOOTLOADER_FLASH_DC_AWARE is not set -CONFIG_BOOTLOADER_FLASH_XMC_SUPPORT=y -# end of Serial Flash Configurations - -# CONFIG_BOOTLOADER_FACTORY_RESET is not set -# CONFIG_BOOTLOADER_APP_TEST is not set -CONFIG_BOOTLOADER_REGION_PROTECTION_ENABLE=y -CONFIG_BOOTLOADER_WDT_ENABLE=y -# CONFIG_BOOTLOADER_WDT_DISABLE_IN_USER_CODE is not set -CONFIG_BOOTLOADER_WDT_TIME_MS=9000 -# CONFIG_BOOTLOADER_SKIP_VALIDATE_IN_DEEP_SLEEP is not set -# CONFIG_BOOTLOADER_SKIP_VALIDATE_ON_POWER_ON is not set -# CONFIG_BOOTLOADER_SKIP_VALIDATE_ALWAYS is not set -CONFIG_BOOTLOADER_RESERVE_RTC_SIZE=0 -# CONFIG_BOOTLOADER_CUSTOM_RESERVE_RTC is not set -# end of Bootloader config - -# -# Security features -# -CONFIG_SECURE_BOOT_V2_RSA_SUPPORTED=y -CONFIG_SECURE_BOOT_V2_ECC_SUPPORTED=y -CONFIG_SECURE_BOOT_V2_PREFERRED=y -# CONFIG_SECURE_SIGNED_APPS_NO_SECURE_BOOT is not set -# CONFIG_SECURE_BOOT is not set -# CONFIG_SECURE_FLASH_ENC_ENABLED is not set -CONFIG_SECURE_ROM_DL_MODE_ENABLED=y -# end of Security features - -# -# Application manager -# -CONFIG_APP_COMPILE_TIME_DATE=y -# CONFIG_APP_EXCLUDE_PROJECT_VER_VAR is not set -# CONFIG_APP_EXCLUDE_PROJECT_NAME_VAR is not set -# CONFIG_APP_PROJECT_VER_FROM_CONFIG is not set -CONFIG_APP_RETRIEVE_LEN_ELF_SHA=9 -# end of Application manager - -CONFIG_ESP_ROM_HAS_CRC_LE=y -CONFIG_ESP_ROM_HAS_CRC_BE=y -CONFIG_ESP_ROM_HAS_JPEG_DECODE=y -CONFIG_ESP_ROM_UART_CLK_IS_XTAL=y -CONFIG_ESP_ROM_USB_SERIAL_DEVICE_NUM=3 -CONFIG_ESP_ROM_HAS_RETARGETABLE_LOCKING=y -CONFIG_ESP_ROM_GET_CLK_FREQ=y -CONFIG_ESP_ROM_HAS_RVFPLIB=y -CONFIG_ESP_ROM_HAS_HAL_WDT=y -CONFIG_ESP_ROM_HAS_HAL_SYSTIMER=y -CONFIG_ESP_ROM_SYSTIMER_INIT_PATCH=y -CONFIG_ESP_ROM_HAS_HEAP_TLSF=y -CONFIG_ESP_ROM_TLSF_CHECK_PATCH=y -CONFIG_ESP_ROM_MULTI_HEAP_WALK_PATCH=y -CONFIG_ESP_ROM_HAS_LAYOUT_TABLE=y -CONFIG_ESP_ROM_HAS_SPI_FLASH=y -CONFIG_ESP_ROM_HAS_SPI_FLASH_MMAP=y -CONFIG_ESP_ROM_WITHOUT_REGI2C=y -CONFIG_ESP_ROM_HAS_NEWLIB=y -CONFIG_ESP_ROM_HAS_NEWLIB_NANO_FORMAT=y -CONFIG_ESP_ROM_WDT_INIT_PATCH=y -CONFIG_ESP_ROM_NEEDS_SET_CACHE_MMU_SIZE=y -CONFIG_ESP_ROM_RAM_APP_NEEDS_MMU_INIT=y -CONFIG_ESP_ROM_HAS_VERSION=y -CONFIG_ESP_ROM_SUPPORT_DEEP_SLEEP_WAKEUP_STUB=y -CONFIG_ESP_ROM_USB_OTG_NUM=-1 -CONFIG_ESP_ROM_HAS_OUTPUT_PUTC_FUNC=y -CONFIG_ESP_ROM_CLIC_INT_THRESH_PATCH=y -CONFIG_ESP_ROM_HAS_SUBOPTIMAL_NEWLIB_ON_MISALIGNED_MEMORY=y -CONFIG_ESP_ROM_DELAY_US_PATCH=y -CONFIG_ESP_ROM_SUPPORT_SECURE_BOOT_FAST_WAKEUP=y - -# -# Boot ROM Behavior -# -CONFIG_BOOT_ROM_LOG_ALWAYS_ON=y -# CONFIG_BOOT_ROM_LOG_ALWAYS_OFF is not set -# CONFIG_BOOT_ROM_LOG_ON_GPIO_HIGH is not set -# CONFIG_BOOT_ROM_LOG_ON_GPIO_LOW is not set -# end of Boot ROM Behavior - -# -# ESP-TEE (Trusted Execution Environment) -# -# CONFIG_SECURE_ENABLE_TEE is not set -CONFIG_SECURE_TEE_LOG_LEVEL=0 -# end of ESP-TEE (Trusted Execution Environment) - -# -# Serial flasher config -# -# CONFIG_ESPTOOLPY_NO_STUB is not set -# CONFIG_ESPTOOLPY_FLASHMODE_QIO is not set -# CONFIG_ESPTOOLPY_FLASHMODE_QOUT is not set -CONFIG_ESPTOOLPY_FLASHMODE_DIO=y -# CONFIG_ESPTOOLPY_FLASHMODE_DOUT is not set -CONFIG_ESPTOOLPY_FLASH_SAMPLE_MODE_STR=y -CONFIG_ESPTOOLPY_FLASHMODE="dio" -CONFIG_ESPTOOLPY_FLASHFREQ_80M=y -# CONFIG_ESPTOOLPY_FLASHFREQ_40M is not set -# CONFIG_ESPTOOLPY_FLASHFREQ_20M is not set -CONFIG_ESPTOOLPY_FLASHFREQ="80m" -# CONFIG_ESPTOOLPY_FLASHSIZE_1MB is not set -# CONFIG_ESPTOOLPY_FLASHSIZE_2MB is not set -# CONFIG_ESPTOOLPY_FLASHSIZE_4MB is not set -CONFIG_ESPTOOLPY_FLASHSIZE_8MB=y -# CONFIG_ESPTOOLPY_FLASHSIZE_16MB is not set -# CONFIG_ESPTOOLPY_FLASHSIZE_32MB is not set -# CONFIG_ESPTOOLPY_FLASHSIZE_64MB is not set -# CONFIG_ESPTOOLPY_FLASHSIZE_128MB is not set -CONFIG_ESPTOOLPY_FLASHSIZE="8MB" -# CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE is not set -CONFIG_ESPTOOLPY_BEFORE_RESET=y -# CONFIG_ESPTOOLPY_BEFORE_NORESET is not set -CONFIG_ESPTOOLPY_BEFORE="default_reset" -CONFIG_ESPTOOLPY_AFTER_RESET=y -# CONFIG_ESPTOOLPY_AFTER_NORESET is not set -CONFIG_ESPTOOLPY_AFTER="hard_reset" -CONFIG_ESPTOOLPY_MONITOR_BAUD=115200 -# end of Serial flasher config - -# -# Partition Table -# -# CONFIG_PARTITION_TABLE_SINGLE_APP is not set -# CONFIG_PARTITION_TABLE_SINGLE_APP_LARGE is not set -# CONFIG_PARTITION_TABLE_TWO_OTA is not set -# CONFIG_PARTITION_TABLE_TWO_OTA_LARGE is not set -CONFIG_PARTITION_TABLE_CUSTOM=y -CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv" -CONFIG_PARTITION_TABLE_FILENAME="partitions.csv" -CONFIG_PARTITION_TABLE_OFFSET=0x8000 -CONFIG_PARTITION_TABLE_MD5=y -# end of Partition Table - -# -# Compiler options -# -CONFIG_COMPILER_OPTIMIZATION_DEBUG=y -# CONFIG_COMPILER_OPTIMIZATION_SIZE is not set -# CONFIG_COMPILER_OPTIMIZATION_PERF is not set -# CONFIG_COMPILER_OPTIMIZATION_NONE is not set -CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_ENABLE=y -# CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT is not set -# CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE is not set -CONFIG_COMPILER_ASSERT_NDEBUG_EVALUATE=y -CONFIG_COMPILER_FLOAT_LIB_FROM_GCCLIB=y -# CONFIG_COMPILER_FLOAT_LIB_FROM_RVFPLIB is not set -CONFIG_COMPILER_OPTIMIZATION_ASSERTION_LEVEL=2 -# CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT is not set -CONFIG_COMPILER_HIDE_PATHS_MACROS=y -# CONFIG_COMPILER_CXX_EXCEPTIONS is not set -# CONFIG_COMPILER_CXX_RTTI is not set -CONFIG_COMPILER_STACK_CHECK_MODE_NONE=y -# CONFIG_COMPILER_STACK_CHECK_MODE_NORM is not set -# CONFIG_COMPILER_STACK_CHECK_MODE_STRONG is not set -# CONFIG_COMPILER_STACK_CHECK_MODE_ALL is not set -# CONFIG_COMPILER_NO_MERGE_CONSTANTS is not set -# CONFIG_COMPILER_WARN_WRITE_STRINGS is not set -# CONFIG_COMPILER_SAVE_RESTORE_LIBCALLS is not set -CONFIG_COMPILER_DISABLE_DEFAULT_ERRORS=y -# CONFIG_COMPILER_DISABLE_GCC12_WARNINGS is not set -# CONFIG_COMPILER_DISABLE_GCC13_WARNINGS is not set -# CONFIG_COMPILER_DISABLE_GCC14_WARNINGS is not set -# CONFIG_COMPILER_DUMP_RTL_FILES is not set -CONFIG_COMPILER_RT_LIB_GCCLIB=y -CONFIG_COMPILER_RT_LIB_NAME="gcc" -CONFIG_COMPILER_ORPHAN_SECTIONS_WARNING=y -# CONFIG_COMPILER_ORPHAN_SECTIONS_PLACE is not set -# CONFIG_COMPILER_STATIC_ANALYZER is not set -# end of Compiler options - -# -# Component config -# - -# -# Application Level Tracing -# -# CONFIG_APPTRACE_DEST_JTAG is not set -CONFIG_APPTRACE_DEST_NONE=y -# CONFIG_APPTRACE_DEST_UART0 is not set -# CONFIG_APPTRACE_DEST_UART1 is not set -# CONFIG_APPTRACE_DEST_UART2 is not set -CONFIG_APPTRACE_DEST_UART_NONE=y -CONFIG_APPTRACE_UART_TASK_PRIO=1 -CONFIG_APPTRACE_LOCK_ENABLE=y -# end of Application Level Tracing - -# -# Bluetooth -# -CONFIG_BT_ENABLED=y -# CONFIG_BT_BLUEDROID_ENABLED is not set -CONFIG_BT_NIMBLE_ENABLED=y -# CONFIG_BT_CONTROLLER_ONLY is not set -CONFIG_BT_CONTROLLER_ENABLED=y -# CONFIG_BT_CONTROLLER_DISABLED is not set - -# -# NimBLE Options -# - -# -# General -# -CONFIG_BT_NIMBLE_MEM_ALLOC_MODE_INTERNAL=y -# CONFIG_BT_NIMBLE_MEM_ALLOC_MODE_EXTERNAL is not set -# CONFIG_BT_NIMBLE_MEM_ALLOC_MODE_DEFAULT is not set -CONFIG_BT_NIMBLE_PINNED_TO_CORE=0 -CONFIG_BT_NIMBLE_HOST_TASK_STACK_SIZE=4096 -# end of General - -# -# Roles and Profiles -# -CONFIG_BT_NIMBLE_ROLE_CENTRAL=y -CONFIG_BT_NIMBLE_ROLE_PERIPHERAL=y -CONFIG_BT_NIMBLE_ROLE_BROADCASTER=y -CONFIG_BT_NIMBLE_ROLE_OBSERVER=y -CONFIG_BT_NIMBLE_GATT_CLIENT=y -CONFIG_BT_NIMBLE_GATT_SERVER=y -# end of Roles and Profiles - -# -# Security (SMP) -# -CONFIG_BT_NIMBLE_SECURITY_ENABLE=y -CONFIG_BT_NIMBLE_SM_LEGACY=y -CONFIG_BT_NIMBLE_SM_SC=y -# CONFIG_BT_NIMBLE_SM_SC_DEBUG_KEYS is not set -CONFIG_BT_NIMBLE_LL_CFG_FEAT_LE_ENCRYPTION=y -CONFIG_BT_NIMBLE_SM_LVL=0 -CONFIG_BT_NIMBLE_SM_SC_ONLY=0 -# CONFIG_BT_NIMBLE_SMP_ID_RESET is not set -# CONFIG_BT_NIMBLE_NVS_PERSIST is not set -CONFIG_BT_NIMBLE_MAX_BONDS=3 -# CONFIG_BT_NIMBLE_HANDLE_REPEAT_PAIRING_DELETION is not set -# end of Security (SMP) - -# -# GAP -# -CONFIG_BT_NIMBLE_RPA_TIMEOUT=900 -CONFIG_BT_NIMBLE_WHITELIST_SIZE=12 -CONFIG_BT_NIMBLE_ENABLE_CONN_REATTEMPT=y -CONFIG_BT_NIMBLE_MAX_CONN_REATTEMPT=3 -CONFIG_BT_NIMBLE_HS_PVCY=y -# CONFIG_BT_NIMBLE_HOST_ALLOW_CONNECT_WITH_SCAN is not set -# CONFIG_BT_NIMBLE_HOST_QUEUE_CONG_CHECK is not set -CONFIG_BT_NIMBLE_MAX_CONNECTIONS=3 -CONFIG_BT_NIMBLE_MAX_CCCDS=8 -CONFIG_BT_NIMBLE_CRYPTO_STACK_MBEDTLS=y -CONFIG_BT_NIMBLE_HS_STOP_TIMEOUT_MS=2000 -CONFIG_BT_NIMBLE_USE_ESP_TIMER=y -# end of GAP - -# -# GATT / ATT -# -CONFIG_BT_NIMBLE_ATT_PREFERRED_MTU=256 -CONFIG_BT_NIMBLE_ATT_MAX_PREP_ENTRIES=64 -CONFIG_BT_NIMBLE_GATT_MAX_PROCS=4 -# CONFIG_BT_NIMBLE_BLE_GATT_BLOB_TRANSFER is not set -# CONFIG_BT_NIMBLE_GATT_CACHING is not set -# CONFIG_BT_NIMBLE_INCL_SVC_DISCOVERY is not set -# end of GATT / ATT - -# -# L2CAP -# -CONFIG_BT_NIMBLE_L2CAP_COC_MAX_NUM=0 -# end of L2CAP - -# -# Memory Settings -# -CONFIG_BT_NIMBLE_MSYS_1_BLOCK_COUNT=12 -CONFIG_BT_NIMBLE_MSYS_1_BLOCK_SIZE=256 -CONFIG_BT_NIMBLE_MSYS_2_BLOCK_COUNT=24 -CONFIG_BT_NIMBLE_MSYS_2_BLOCK_SIZE=320 -CONFIG_BT_NIMBLE_MSYS_BUF_FROM_HEAP=y -CONFIG_BT_NIMBLE_TRANSPORT_ACL_FROM_LL_COUNT=24 -CONFIG_BT_NIMBLE_TRANSPORT_ACL_SIZE=255 -CONFIG_BT_NIMBLE_TRANSPORT_EVT_SIZE=70 -CONFIG_BT_NIMBLE_TRANSPORT_EVT_COUNT=30 -CONFIG_BT_NIMBLE_TRANSPORT_EVT_DISCARD_COUNT=8 -CONFIG_BT_NIMBLE_L2CAP_COC_SDU_BUFF_COUNT=1 -# end of Memory Settings - -# -# BLE 5.x Features -# -CONFIG_BT_NIMBLE_50_FEATURE_SUPPORT=y -CONFIG_BT_NIMBLE_LL_CFG_FEAT_LE_2M_PHY=y -CONFIG_BT_NIMBLE_LL_CFG_FEAT_LE_CODED_PHY=y -# CONFIG_BT_NIMBLE_EXT_ADV is not set -CONFIG_BT_NIMBLE_EXT_SCAN=y -CONFIG_BT_NIMBLE_ENABLE_PERIODIC_SYNC=y -CONFIG_BT_NIMBLE_MAX_PERIODIC_SYNCS=0 -CONFIG_BT_NIMBLE_MAX_PERIODIC_ADVERTISER_LIST=5 -# CONFIG_BT_NIMBLE_BLE_POWER_CONTROL is not set -# CONFIG_BT_NIMBLE_AOA_AOD is not set -# CONFIG_BT_NIMBLE_ISO is not set -# end of BLE 5.x Features - -# -# Services -# -CONFIG_BT_NIMBLE_PROX_SERVICE=y -CONFIG_BT_NIMBLE_ANS_SERVICE=y -CONFIG_BT_NIMBLE_CTS_SERVICE=y -CONFIG_BT_NIMBLE_HTP_SERVICE=y -CONFIG_BT_NIMBLE_IPSS_SERVICE=y -CONFIG_BT_NIMBLE_TPS_SERVICE=y -CONFIG_BT_NIMBLE_IAS_SERVICE=y -CONFIG_BT_NIMBLE_LLS_SERVICE=y -CONFIG_BT_NIMBLE_SPS_SERVICE=y -CONFIG_BT_NIMBLE_HR_SERVICE=y -# CONFIG_BT_NIMBLE_HID_SERVICE is not set -CONFIG_BT_NIMBLE_BAS_SERVICE=y -# CONFIG_BT_NIMBLE_SVC_BAS_BATTERY_LEVEL_NOTIFY is not set -CONFIG_BT_NIMBLE_DIS_SERVICE=y -# CONFIG_BT_NIMBLE_SVC_DIS_MANUFACTURER_NAME is not set -# CONFIG_BT_NIMBLE_SVC_DIS_SERIAL_NUMBER is not set -# CONFIG_BT_NIMBLE_SVC_DIS_HARDWARE_REVISION is not set -# CONFIG_BT_NIMBLE_SVC_DIS_FIRMWARE_REVISION is not set -# CONFIG_BT_NIMBLE_SVC_DIS_SOFTWARE_REVISION is not set -# CONFIG_BT_NIMBLE_SVC_DIS_SYSTEM_ID is not set -# CONFIG_BT_NIMBLE_SVC_DIS_PNP_ID is not set -# CONFIG_BT_NIMBLE_SVC_DIS_INCLUDED is not set -CONFIG_BT_NIMBLE_GAP_SERVICE=y -CONFIG_BT_NIMBLE_SVC_GAP_DEVICE_NAME="nimble" -CONFIG_BT_NIMBLE_GAP_DEVICE_NAME_MAX_LEN=31 -CONFIG_BT_NIMBLE_SVC_GAP_APPEARANCE=0 -CONFIG_BT_NIMBLE_SVC_GAP_NAME_WRITE_PERM=0 -CONFIG_BT_NIMBLE_SVC_GAP_NAME_WRITE_PERM_ENC=0 -CONFIG_BT_NIMBLE_SVC_GAP_NAME_WRITE_PERM_AUTHEN=0 -CONFIG_BT_NIMBLE_SVC_GAP_NAME_WRITE_PERM_AUTHOR=0 -# CONFIG_BT_NIMBLE_SVC_GAP_GATT_SECURITY_LEVEL is not set -# CONFIG_BT_NIMBLE_SVC_GAP_RPA_ONLY is not set -CONFIG_BT_NIMBLE_SVC_GAP_CAR_CHAR_NOT_SUPP=y -# CONFIG_BT_NIMBLE_SVC_GAP_CAR_NOT_SUPP is not set -# CONFIG_BT_NIMBLE_SVC_GAP_CAR_SUPP is not set -CONFIG_BT_NIMBLE_SVC_GAP_CENT_ADDR_RESOLUTION=-1 - -# -# GAP Appearance write permissions -# -# CONFIG_BT_NIMBLE_SVC_GAP_APPEAR_WRITE is not set -CONFIG_BT_NIMBLE_SVC_GAP_APPEAR_WRITE_PERM=0 -CONFIG_BT_NIMBLE_SVC_GAP_APPEAR_WRITE_PERM_ENC=0 -CONFIG_BT_NIMBLE_SVC_GAP_APPEAR_WRITE_PERM_ATHN=0 -CONFIG_BT_NIMBLE_SVC_GAP_APPEAR_WRITE_PERM_ATHR=0 -# end of GAP Appearance write permissions - -# -# GAP device name write permissions -# -# CONFIG_BT_NIMBLE_SVC_GAP_NAME_WRITE is not set -# end of GAP device name write permissions - -# -# Peripheral Preferred Connection Parameters (PPCP) settings -# -CONFIG_BT_NIMBLE_SVC_GAP_PPCP_MAX_CONN_INTERVAL=0 -CONFIG_BT_NIMBLE_SVC_GAP_PPCP_MIN_CONN_INTERVAL=0 -CONFIG_BT_NIMBLE_SVC_GAP_PPCP_SLAVE_LATENCY=0 -CONFIG_BT_NIMBLE_SVC_GAP_PPCP_SUPERVISION_TMO=0 -# end of Peripheral Preferred Connection Parameters (PPCP) settings -# end of Services - -# -# Extra Features -# -# CONFIG_BT_NIMBLE_DYNAMIC_SERVICE is not set -# CONFIG_BT_NIMBLE_BLUFI_ENABLE is not set -# CONFIG_BT_NIMBLE_ENC_ADV_DATA is not set -# CONFIG_BT_NIMBLE_ADV_UUID_CONCAT is not set -# CONFIG_BT_NIMBLE_GATTC_PROC_PREEMPTION_PROTECT is not set -# CONFIG_BT_NIMBLE_GATTC_AUTO_PAIR is not set -CONFIG_BT_NIMBLE_EATT_CHAN_NUM=0 -# CONFIG_BT_NIMBLE_SUBRATE is not set -# CONFIG_BT_NIMBLE_STATIC_PASSKEY is not set -CONFIG_BT_NIMBLE_DTM_MODE_TEST=y -CONFIG_BT_NIMBLE_MEM_OPTIMIZATION=y -CONFIG_BT_NIMBLE_STATIC_TO_DYNAMIC=y -CONFIG_BT_NIMBLE_SM_SIGN_CNT=y -CONFIG_BT_NIMBLE_CPFD_CAFD=y -CONFIG_BT_NIMBLE_RECONFIG_MTU=y -# CONFIG_BT_NIMBLE_LOW_SPEED_MODE is not set -# end of Extra Features - -# -# NimBLE Mesh -# -# CONFIG_BT_NIMBLE_MESH is not set -# end of NimBLE Mesh - -# -# Host-controller Transport -# -CONFIG_UART_HW_FLOWCTRL_DISABLE=y -# CONFIG_UART_HW_FLOWCTRL_CTS_RTS is not set -CONFIG_BT_NIMBLE_HCI_UART_FLOW_CTRL=0 -CONFIG_BT_NIMBLE_HCI_UART_RTS_PIN=19 -CONFIG_BT_NIMBLE_HCI_UART_CTS_PIN=23 -# end of Host-controller Transport - -# -# Debugging/Testing -# -# CONFIG_BT_NIMBLE_MEM_DEBUG is not set -# CONFIG_BT_NIMBLE_LOG_LEVEL_NONE is not set -# CONFIG_BT_NIMBLE_LOG_LEVEL_ERROR is not set -# CONFIG_BT_NIMBLE_LOG_LEVEL_WARNING is not set -CONFIG_BT_NIMBLE_LOG_LEVEL_INFO=y -# CONFIG_BT_NIMBLE_LOG_LEVEL_DEBUG is not set -CONFIG_BT_NIMBLE_LOG_LEVEL=1 -CONFIG_BT_NIMBLE_PRINT_ERR_NAME=y -# CONFIG_BT_NIMBLE_DEBUG is not set -# CONFIG_BT_NIMBLE_TEST_THROUGHPUT_TEST is not set -# end of Debugging/Testing - -# -# Vendor / Optimization -# -# CONFIG_BT_NIMBLE_VS_SUPPORT is not set -# CONFIG_BT_NIMBLE_OPTIMIZE_MULTI_CONN is not set -# CONFIG_BT_NIMBLE_HIGH_DUTY_ADV_ITVL is not set -# CONFIG_BT_NIMBLE_ADV_SEND_CONSTANT_DID is not set -# CONFIG_BT_NIMBLE_SCAN_ALLOW_ENH_ADI_FILTER is not set -# end of Vendor / Optimization - -# -# Helper Utils -# -CONFIG_BT_NIMBLE_CHK_HOST_STATUS=y -CONFIG_BT_NIMBLE_UTIL_API=y -CONFIG_BT_NIMBLE_EXTRA_ADV_FIELDS=y -# end of Helper Utils -# end of NimBLE Options - -# -# Controller Options -# - -# -# HCI Config -# -CONFIG_BT_LE_HCI_INTERFACE_USE_RAM=y -# CONFIG_BT_LE_HCI_INTERFACE_USE_UART is not set -# end of HCI Config - -CONFIG_BT_LE_CONTROLLER_NPL_OS_PORTING_SUPPORT=y -CONFIG_BT_LE_CONTROLLER_TASK_STACK_SIZE=4096 - -# -# Controller debug features -# -# CONFIG_BT_LE_CONTROLLER_LOG_ENABLED is not set -# CONFIG_BT_LE_ERROR_SIM_ENABLED is not set -# CONFIG_BT_LE_ASSERT_WHEN_ABNORMAL_DISCONN_ENABLED is not set -# CONFIG_BT_LE_DEBUG_REMAIN_SCENE_ENABLED is not set -# CONFIG_BT_LE_PTR_CHECK_ENABLED is not set -# CONFIG_BT_LE_MEM_CHECK_ENABLED is not set -# end of Controller debug features - -CONFIG_BT_LE_LL_RESOLV_LIST_SIZE=4 -CONFIG_BT_LE_LL_DUP_SCAN_LIST_COUNT=20 -CONFIG_BT_LE_LL_SCA=60 -# CONFIG_BT_LE_LL_PEER_SCA_SET_ENABLE is not set -# CONFIG_BT_LE_COEX_PHY_CODED_TX_RX_TLIM_EN is not set -CONFIG_BT_LE_COEX_PHY_CODED_TX_RX_TLIM_DIS=y -CONFIG_BT_LE_COEX_PHY_CODED_TX_RX_TLIM_EFF=0 -# CONFIG_BT_LE_SLEEP_ENABLE is not set -CONFIG_BT_LE_LP_CLK_SRC_MAIN_XTAL=y -# CONFIG_BT_LE_LP_CLK_SRC_DEFAULT is not set -CONFIG_BT_CTRL_BLE_ADV_REPORT_FLOW_CTRL_SUPP=y -CONFIG_BT_CTRL_BLE_ADV_REPORT_FLOW_CTRL_NUM=100 -CONFIG_BT_CTRL_BLE_ADV_REPORT_DISCARD_THRSHOLD=20 -CONFIG_BT_LE_SCAN_DUPL=y -CONFIG_BT_LE_SCAN_DUPL_TYPE_DEVICE=y -# CONFIG_BT_LE_SCAN_DUPL_TYPE_DATA is not set -# CONFIG_BT_LE_SCAN_DUPL_TYPE_DATA_DEVICE is not set -CONFIG_BT_LE_SCAN_DUPL_TYPE=0 -CONFIG_BT_LE_SCAN_DUPL_CACHE_REFRESH_PERIOD=0 -CONFIG_BT_LE_MSYS_INIT_IN_CONTROLLER=y -# CONFIG_BT_LE_TX_CCA_ENABLED is not set -# CONFIG_BT_LE_DFT_TX_POWER_LEVEL_N24 is not set -# CONFIG_BT_LE_DFT_TX_POWER_LEVEL_N21 is not set -# CONFIG_BT_LE_DFT_TX_POWER_LEVEL_N18 is not set -# CONFIG_BT_LE_DFT_TX_POWER_LEVEL_N15 is not set -# CONFIG_BT_LE_DFT_TX_POWER_LEVEL_N12 is not set -# CONFIG_BT_LE_DFT_TX_POWER_LEVEL_N9 is not set -# CONFIG_BT_LE_DFT_TX_POWER_LEVEL_N6 is not set -# CONFIG_BT_LE_DFT_TX_POWER_LEVEL_N3 is not set -# CONFIG_BT_LE_DFT_TX_POWER_LEVEL_N0 is not set -# CONFIG_BT_LE_DFT_TX_POWER_LEVEL_P3 is not set -# CONFIG_BT_LE_DFT_TX_POWER_LEVEL_P6 is not set -CONFIG_BT_LE_DFT_TX_POWER_LEVEL_P9=y -# CONFIG_BT_LE_DFT_TX_POWER_LEVEL_P12 is not set -# CONFIG_BT_LE_DFT_TX_POWER_LEVEL_P15 is not set -# CONFIG_BT_LE_DFT_TX_POWER_LEVEL_P18 is not set -# CONFIG_BT_LE_DFT_TX_POWER_LEVEL_P20 is not set -CONFIG_BT_LE_DFT_TX_POWER_LEVEL_DBM_EFF=9 -# CONFIG_BT_LE_CTRL_CHECK_CONNECT_IND_ACCESS_ADDRESS is not set -# CONFIG_BT_CTRL_RUN_IN_FLASH_ONLY is not set - -# -# BLE disconnects when Instant Passed (0x28) occurs -# -# CONFIG_BT_LE_CTRL_LLCP_CONN_UPDATE is not set -# CONFIG_BT_LE_CTRL_LLCP_CHAN_MAP_UPDATE is not set -# CONFIG_BT_LE_CTRL_LLCP_PHY_UPDATE is not set -# end of BLE disconnects when Instant Passed (0x28) occurs - -CONFIG_BT_CTRL_SCAN_BACKOFF_UPPERLIMITMAX=32 -# CONFIG_BT_LE_CTRL_CHAN_ASS_EN is not set -CONFIG_BT_LE_CTRL_ADV_DATA_LENGTH_ZERO_AUX=y -CONFIG_BT_LE_RXBUF_OPT_ENABLED=y -CONFIG_BT_LE_CTRL_FAST_CONN_DATA_TX_EN=y - -# -# Reserved Memory Config -# -CONFIG_BT_LE_EXT_ADV_RESERVED_MEMORY_COUNT=2 -CONFIG_BT_LE_CONN_RESERVED_MEMORY_COUNT=2 -# end of Reserved Memory Config - -# CONFIG_BT_LE_DTM_ENABLED is not set - -# -# Scheduling Priority Level Config -# -CONFIG_BT_LE_ADV_SCHED_PRIO_LOW_LEVEL=y -# CONFIG_BT_LE_ADV_SCHED_PRIO_MID_LEVEL is not set -# CONFIG_BT_LE_ADV_SCHED_PRIO_HIGH_LEVEL is not set -CONFIG_BT_LE_DFT_ADV_SCHED_PRIO_LEVEL=0 -# CONFIG_BT_LE_PERIODIC_ADV_SCHED_PRIO_LOW_LEVEL is not set -CONFIG_BT_LE_PERIODIC_ADV_SCHED_PRIO_MID_LEVEL=y -# CONFIG_BT_LE_PERIODIC_ADV_SCHED_PRIO_HIGH_LEVEL is not set -CONFIG_BT_LE_DFT_PERIODIC_ADV_SCHED_PRIO_LEVEL=1 -# CONFIG_BT_LE_SYNC_SCHED_PRIO_LOW_LEVEL is not set -CONFIG_BT_LE_SYNC_SCHED_PRIO_MID_LEVEL=y -# CONFIG_BT_LE_SYNC_SCHED_PRIO_HIGH_LEVEL is not set -CONFIG_BT_LE_DFT_SYNC_SCHED_PRIO_LEVEL=1 -# end of Scheduling Priority Level Config - -# CONFIG_BT_LE_CTRL_SLV_FAST_RX_CONN_DATA_EN is not set -# CONFIG_BT_LE_CTRL_DL_ITVL_PHY_SYNC_EN is not set -# end of Controller Options - -# -# Common Options -# -CONFIG_BT_ALARM_MAX_NUM=50 -CONFIG_BT_SMP_CRYPTO_STACK_TINYCRYPT=y -# CONFIG_BT_SMP_CRYPTO_STACK_MBEDTLS is not set - -# -# BLE Log -# -# CONFIG_BLE_LOG_ENABLED is not set -# end of BLE Log - -# CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED is not set -# CONFIG_BT_BLE_LOG_UHCI_OUT_ENABLED is not set -# CONFIG_BT_LE_USED_MEM_STATISTICS_ENABLED is not set -# end of Common Options - -# CONFIG_BT_HCI_LOG_DEBUG_EN is not set -# end of Bluetooth - -# CONFIG_BLE_MESH is not set - -# -# Console Library -# -# CONFIG_CONSOLE_SORTED_HELP is not set -# end of Console Library - -# -# Driver Configurations -# - -# -# Legacy TWAI Driver Configurations -# -# CONFIG_TWAI_SKIP_LEGACY_CONFLICT_CHECK is not set -# end of Legacy TWAI Driver Configurations - -# -# Legacy ADC Driver Configuration -# -# CONFIG_ADC_SUPPRESS_DEPRECATE_WARN is not set -# CONFIG_ADC_SKIP_LEGACY_CONFLICT_CHECK is not set - -# -# Legacy ADC Calibration Configuration -# -# CONFIG_ADC_CALI_SUPPRESS_DEPRECATE_WARN is not set -# end of Legacy ADC Calibration Configuration -# end of Legacy ADC Driver Configuration - -# -# Legacy MCPWM Driver Configurations -# -# CONFIG_MCPWM_SUPPRESS_DEPRECATE_WARN is not set -# CONFIG_MCPWM_SKIP_LEGACY_CONFLICT_CHECK is not set -# end of Legacy MCPWM Driver Configurations - -# -# Legacy Timer Group Driver Configurations -# -# CONFIG_GPTIMER_SUPPRESS_DEPRECATE_WARN is not set -# CONFIG_GPTIMER_SKIP_LEGACY_CONFLICT_CHECK is not set -# end of Legacy Timer Group Driver Configurations - -# -# Legacy RMT Driver Configurations -# -# CONFIG_RMT_SUPPRESS_DEPRECATE_WARN is not set -# CONFIG_RMT_SKIP_LEGACY_CONFLICT_CHECK is not set -# end of Legacy RMT Driver Configurations - -# -# Legacy I2S Driver Configurations -# -# CONFIG_I2S_SUPPRESS_DEPRECATE_WARN is not set -# CONFIG_I2S_SKIP_LEGACY_CONFLICT_CHECK is not set -# end of Legacy I2S Driver Configurations - -# -# Legacy I2C Driver Configurations -# -# CONFIG_I2C_SKIP_LEGACY_CONFLICT_CHECK is not set -# end of Legacy I2C Driver Configurations - -# -# Legacy PCNT Driver Configurations -# -# CONFIG_PCNT_SUPPRESS_DEPRECATE_WARN is not set -# CONFIG_PCNT_SKIP_LEGACY_CONFLICT_CHECK is not set -# end of Legacy PCNT Driver Configurations - -# -# Legacy SDM Driver Configurations -# -# CONFIG_SDM_SUPPRESS_DEPRECATE_WARN is not set -# CONFIG_SDM_SKIP_LEGACY_CONFLICT_CHECK is not set -# end of Legacy SDM Driver Configurations - -# -# Legacy Temperature Sensor Driver Configurations -# -# CONFIG_TEMP_SENSOR_SUPPRESS_DEPRECATE_WARN is not set -# CONFIG_TEMP_SENSOR_SKIP_LEGACY_CONFLICT_CHECK is not set -# end of Legacy Temperature Sensor Driver Configurations -# end of Driver Configurations - -# -# eFuse Bit Manager -# -# CONFIG_EFUSE_CUSTOM_TABLE is not set -# CONFIG_EFUSE_VIRTUAL is not set -CONFIG_EFUSE_MAX_BLK_LEN=256 -# end of eFuse Bit Manager - -# -# ESP-TLS -# -CONFIG_ESP_TLS_USING_MBEDTLS=y -# CONFIG_ESP_TLS_USE_SECURE_ELEMENT is not set -CONFIG_ESP_TLS_USE_DS_PERIPHERAL=y -# CONFIG_ESP_TLS_CLIENT_SESSION_TICKETS is not set -# CONFIG_ESP_TLS_SERVER_SESSION_TICKETS is not set -# CONFIG_ESP_TLS_SERVER_CERT_SELECT_HOOK is not set -# CONFIG_ESP_TLS_SERVER_MIN_AUTH_MODE_OPTIONAL is not set -# CONFIG_ESP_TLS_PSK_VERIFICATION is not set -# CONFIG_ESP_TLS_INSECURE is not set -CONFIG_ESP_TLS_DYN_BUF_STRATEGY_SUPPORTED=y -# end of ESP-TLS - -# -# ADC and ADC Calibration -# -# CONFIG_ADC_ONESHOT_CTRL_FUNC_IN_IRAM is not set -# CONFIG_ADC_CONTINUOUS_ISR_IRAM_SAFE is not set -# CONFIG_ADC_ENABLE_DEBUG_LOG is not set -# end of ADC and ADC Calibration - -# -# Wireless Coexistence -# -CONFIG_ESP_COEX_ENABLED=y -CONFIG_ESP_COEX_SW_COEXIST_ENABLE=y -# CONFIG_ESP_COEX_POWER_MANAGEMENT is not set -# CONFIG_ESP_COEX_GPIO_DEBUG is not set -# end of Wireless Coexistence - -# -# Common ESP-related -# -CONFIG_ESP_ERR_TO_NAME_LOOKUP=y -# end of Common ESP-related - -# -# ESP-Driver:Analog Comparator Configurations -# -CONFIG_ANA_CMPR_ISR_HANDLER_IN_IRAM=y -# CONFIG_ANA_CMPR_CTRL_FUNC_IN_IRAM is not set -# CONFIG_ANA_CMPR_ISR_CACHE_SAFE is not set -CONFIG_ANA_CMPR_OBJ_CACHE_SAFE=y -# CONFIG_ANA_CMPR_ENABLE_DEBUG_LOG is not set -# end of ESP-Driver:Analog Comparator Configurations - -# -# ESP-Driver:BitScrambler Configurations -# -# CONFIG_BITSCRAMBLER_CTRL_FUNC_IN_IRAM is not set -# end of ESP-Driver:BitScrambler Configurations - -# -# ESP-Driver:GPIO Configurations -# -# CONFIG_GPIO_CTRL_FUNC_IN_IRAM is not set -# end of ESP-Driver:GPIO Configurations - -# -# ESP-Driver:GPTimer Configurations -# -CONFIG_GPTIMER_ISR_HANDLER_IN_IRAM=y -# CONFIG_GPTIMER_CTRL_FUNC_IN_IRAM is not set -# CONFIG_GPTIMER_ISR_CACHE_SAFE is not set -CONFIG_GPTIMER_OBJ_CACHE_SAFE=y -# CONFIG_GPTIMER_ENABLE_DEBUG_LOG is not set -# end of ESP-Driver:GPTimer Configurations - -# -# ESP-Driver:I2C Configurations -# -# CONFIG_I2C_ISR_IRAM_SAFE is not set -# CONFIG_I2C_ENABLE_DEBUG_LOG is not set -# CONFIG_I2C_ENABLE_SLAVE_DRIVER_VERSION_2 is not set -CONFIG_I2C_MASTER_ISR_HANDLER_IN_IRAM=y -# end of ESP-Driver:I2C Configurations - -# -# ESP-Driver:I2S Configurations -# -# CONFIG_I2S_ISR_IRAM_SAFE is not set -# CONFIG_I2S_ENABLE_DEBUG_LOG is not set -# end of ESP-Driver:I2S Configurations - -# -# ESP-Driver:LEDC Configurations -# -# CONFIG_LEDC_CTRL_FUNC_IN_IRAM is not set -# end of ESP-Driver:LEDC Configurations - -# -# ESP-Driver:MCPWM Configurations -# -CONFIG_MCPWM_ISR_HANDLER_IN_IRAM=y -# CONFIG_MCPWM_ISR_CACHE_SAFE is not set -# CONFIG_MCPWM_CTRL_FUNC_IN_IRAM is not set -CONFIG_MCPWM_OBJ_CACHE_SAFE=y -# CONFIG_MCPWM_ENABLE_DEBUG_LOG is not set -# end of ESP-Driver:MCPWM Configurations - -# -# ESP-Driver:Parallel IO Configurations -# -CONFIG_PARLIO_TX_ISR_HANDLER_IN_IRAM=y -CONFIG_PARLIO_RX_ISR_HANDLER_IN_IRAM=y -# CONFIG_PARLIO_TX_ISR_CACHE_SAFE is not set -# CONFIG_PARLIO_RX_ISR_CACHE_SAFE is not set -CONFIG_PARLIO_OBJ_CACHE_SAFE=y -# CONFIG_PARLIO_ENABLE_DEBUG_LOG is not set -# CONFIG_PARLIO_ISR_IRAM_SAFE is not set -# end of ESP-Driver:Parallel IO Configurations - -# -# ESP-Driver:PCNT Configurations -# -# CONFIG_PCNT_CTRL_FUNC_IN_IRAM is not set -# CONFIG_PCNT_ISR_IRAM_SAFE is not set -# CONFIG_PCNT_ENABLE_DEBUG_LOG is not set -# end of ESP-Driver:PCNT Configurations - -# -# ESP-Driver:RMT Configurations -# -CONFIG_RMT_ENCODER_FUNC_IN_IRAM=y -CONFIG_RMT_TX_ISR_HANDLER_IN_IRAM=y -CONFIG_RMT_RX_ISR_HANDLER_IN_IRAM=y -# CONFIG_RMT_RECV_FUNC_IN_IRAM is not set -# CONFIG_RMT_TX_ISR_CACHE_SAFE is not set -# CONFIG_RMT_RX_ISR_CACHE_SAFE is not set -CONFIG_RMT_OBJ_CACHE_SAFE=y -# CONFIG_RMT_ENABLE_DEBUG_LOG is not set -# CONFIG_RMT_ISR_IRAM_SAFE is not set -# end of ESP-Driver:RMT Configurations - -# -# ESP-Driver:Sigma Delta Modulator Configurations -# -# CONFIG_SDM_CTRL_FUNC_IN_IRAM is not set -# CONFIG_SDM_ENABLE_DEBUG_LOG is not set -# end of ESP-Driver:Sigma Delta Modulator Configurations - -# -# ESP-Driver:SPI Configurations -# -# CONFIG_SPI_MASTER_IN_IRAM is not set -CONFIG_SPI_MASTER_ISR_IN_IRAM=y -# CONFIG_SPI_SLAVE_IN_IRAM is not set -CONFIG_SPI_SLAVE_ISR_IN_IRAM=y -# end of ESP-Driver:SPI Configurations - -# -# ESP-Driver:Temperature Sensor Configurations -# -# CONFIG_TEMP_SENSOR_ENABLE_DEBUG_LOG is not set -# CONFIG_TEMP_SENSOR_ISR_IRAM_SAFE is not set -# end of ESP-Driver:Temperature Sensor Configurations - -# -# ESP-Driver:TWAI Configurations -# -# CONFIG_TWAI_ISR_IN_IRAM is not set -# CONFIG_TWAI_IO_FUNC_IN_IRAM is not set -# CONFIG_TWAI_ISR_CACHE_SAFE is not set -# CONFIG_TWAI_ENABLE_DEBUG_LOG is not set -# end of ESP-Driver:TWAI Configurations - -# -# ESP-Driver:UART Configurations -# -# CONFIG_UART_ISR_IN_IRAM is not set -# end of ESP-Driver:UART Configurations - -# -# ESP-Driver:UHCI Configurations -# -# CONFIG_UHCI_ISR_HANDLER_IN_IRAM is not set -# CONFIG_UHCI_ISR_CACHE_SAFE is not set -# CONFIG_UHCI_ENABLE_DEBUG_LOG is not set -# end of ESP-Driver:UHCI Configurations - -# -# ESP-Driver:USB Serial/JTAG Configuration -# -CONFIG_USJ_ENABLE_USB_SERIAL_JTAG=y -# end of ESP-Driver:USB Serial/JTAG Configuration - -# -# Ethernet -# -CONFIG_ETH_ENABLED=y -CONFIG_ETH_USE_SPI_ETHERNET=y -# CONFIG_ETH_SPI_ETHERNET_DM9051 is not set -# CONFIG_ETH_SPI_ETHERNET_W5500 is not set -# CONFIG_ETH_SPI_ETHERNET_KSZ8851SNL is not set -# CONFIG_ETH_USE_OPENETH is not set -# CONFIG_ETH_TRANSMIT_MUTEX is not set -# end of Ethernet - -# -# Event Loop Library -# -# CONFIG_ESP_EVENT_LOOP_PROFILING is not set -CONFIG_ESP_EVENT_POST_FROM_ISR=y -CONFIG_ESP_EVENT_POST_FROM_IRAM_ISR=y -# end of Event Loop Library - -# -# GDB Stub -# -CONFIG_ESP_GDBSTUB_ENABLED=y -# CONFIG_ESP_SYSTEM_GDBSTUB_RUNTIME is not set -CONFIG_ESP_GDBSTUB_SUPPORT_TASKS=y -CONFIG_ESP_GDBSTUB_MAX_TASKS=32 -# end of GDB Stub - -# -# ESP HID -# -CONFIG_ESPHID_TASK_SIZE_BT=2048 -CONFIG_ESPHID_TASK_SIZE_BLE=4096 -# end of ESP HID - -# -# ESP HTTP client -# -CONFIG_ESP_HTTP_CLIENT_ENABLE_HTTPS=y -# CONFIG_ESP_HTTP_CLIENT_ENABLE_BASIC_AUTH is not set -# CONFIG_ESP_HTTP_CLIENT_ENABLE_DIGEST_AUTH is not set -# CONFIG_ESP_HTTP_CLIENT_ENABLE_CUSTOM_TRANSPORT is not set -CONFIG_ESP_HTTP_CLIENT_EVENT_POST_TIMEOUT=2000 -# end of ESP HTTP client - -# -# HTTP Server -# -CONFIG_HTTPD_MAX_REQ_HDR_LEN=512 -CONFIG_HTTPD_MAX_URI_LEN=512 -CONFIG_HTTPD_ERR_RESP_NO_DELAY=y -CONFIG_HTTPD_PURGE_BUF_LEN=32 -# CONFIG_HTTPD_LOG_PURGE_DATA is not set -# CONFIG_HTTPD_WS_SUPPORT is not set -# CONFIG_HTTPD_QUEUE_WORK_BLOCKING is not set -CONFIG_HTTPD_SERVER_EVENT_POST_TIMEOUT=2000 -# end of HTTP Server - -# -# ESP HTTPS OTA -# -# CONFIG_ESP_HTTPS_OTA_DECRYPT_CB is not set -# CONFIG_ESP_HTTPS_OTA_ALLOW_HTTP is not set -CONFIG_ESP_HTTPS_OTA_EVENT_POST_TIMEOUT=2000 -# end of ESP HTTPS OTA - -# -# ESP HTTPS server -# -# CONFIG_ESP_HTTPS_SERVER_ENABLE is not set -CONFIG_ESP_HTTPS_SERVER_EVENT_POST_TIMEOUT=2000 -# CONFIG_ESP_HTTPS_SERVER_CERT_SELECT_HOOK is not set -# end of ESP HTTPS server - -# -# Hardware Settings -# -CONFIG_ESP_HW_SUPPORT_FUNC_IN_IRAM=y - -# -# Chip revision -# -CONFIG_ESP32C5_REV_MIN_100=y -# CONFIG_ESP32C5_REV_MIN_102 is not set -CONFIG_ESP32C5_REV_MIN_FULL=100 -CONFIG_ESP_REV_MIN_FULL=100 - -# -# Maximum Supported ESP32-C5 Revision (Rev v1.99) -# -CONFIG_ESP32C5_REV_MAX_FULL=199 -CONFIG_ESP_REV_MAX_FULL=199 -CONFIG_ESP_EFUSE_BLOCK_REV_MIN_FULL=0 -CONFIG_ESP_EFUSE_BLOCK_REV_MAX_FULL=99 - -# -# Maximum Supported ESP32-C5 eFuse Block Revision (eFuse Block Rev v0.99) -# -# end of Chip revision - -# -# MAC Config -# -CONFIG_ESP_MAC_ADDR_UNIVERSE_WIFI_STA=y -CONFIG_ESP_MAC_ADDR_UNIVERSE_WIFI_AP=y -CONFIG_ESP_MAC_ADDR_UNIVERSE_BT=y -CONFIG_ESP_MAC_ADDR_UNIVERSE_ETH=y -CONFIG_ESP_MAC_ADDR_UNIVERSE_IEEE802154=y -CONFIG_ESP_MAC_UNIVERSAL_MAC_ADDRESSES_FOUR=y -CONFIG_ESP_MAC_UNIVERSAL_MAC_ADDRESSES=4 -# CONFIG_ESP32C5_UNIVERSAL_MAC_ADDRESSES_TWO is not set -CONFIG_ESP32C5_UNIVERSAL_MAC_ADDRESSES_FOUR=y -CONFIG_ESP32C5_UNIVERSAL_MAC_ADDRESSES=4 -# CONFIG_ESP_MAC_USE_CUSTOM_MAC_AS_BASE_MAC is not set -# end of MAC Config - -# -# Sleep Config -# -CONFIG_ESP_SLEEP_FLASH_LEAKAGE_WORKAROUND=y -CONFIG_ESP_SLEEP_PSRAM_LEAKAGE_WORKAROUND=y -CONFIG_ESP_SLEEP_MSPI_NEED_ALL_IO_PU=y -CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND=y -CONFIG_ESP_SLEEP_WAIT_FLASH_READY_EXTRA_DELAY=2000 -# CONFIG_ESP_SLEEP_CACHE_SAFE_ASSERTION is not set -# CONFIG_ESP_SLEEP_DEBUG is not set -CONFIG_ESP_SLEEP_GPIO_ENABLE_INTERNAL_RESISTORS=y -# end of Sleep Config - -# -# RTC Clock Config -# -CONFIG_RTC_CLK_SRC_INT_RC=y -# CONFIG_RTC_CLK_SRC_EXT_CRYS is not set -# CONFIG_RTC_CLK_SRC_EXT_OSC is not set -CONFIG_RTC_CLK_CAL_CYCLES=1024 -CONFIG_RTC_FAST_CLK_SRC_RC_FAST=y -# CONFIG_RTC_FAST_CLK_SRC_XTAL is not set -CONFIG_RTC_CLK_FUNC_IN_IRAM=y -CONFIG_RTC_TIME_FUNC_IN_IRAM=y -# end of RTC Clock Config - -# -# Peripheral Control -# -CONFIG_ESP_PERIPH_CTRL_FUNC_IN_IRAM=y -CONFIG_ESP_REGI2C_CTRL_FUNC_IN_IRAM=y -# end of Peripheral Control - -# -# ETM Configuration -# -# CONFIG_ETM_ENABLE_DEBUG_LOG is not set -# end of ETM Configuration - -# -# GDMA Configurations -# -CONFIG_GDMA_CTRL_FUNC_IN_IRAM=y -CONFIG_GDMA_ISR_HANDLER_IN_IRAM=y -CONFIG_GDMA_OBJ_DRAM_SAFE=y -# CONFIG_GDMA_ENABLE_DEBUG_LOG is not set -# CONFIG_GDMA_ISR_IRAM_SAFE is not set -# end of GDMA Configurations - -# -# Main XTAL Config -# -CONFIG_XTAL_FREQ_AUTO=y -CONFIG_XTAL_FREQ=0 -# end of Main XTAL Config - -# -# Power Supplier -# - -# -# Brownout Detector -# -CONFIG_ESP_BROWNOUT_DET=y -CONFIG_ESP_BROWNOUT_DET_LVL_SEL_7=y -# CONFIG_ESP_BROWNOUT_DET_LVL_SEL_6 is not set -# CONFIG_ESP_BROWNOUT_DET_LVL_SEL_5 is not set -# CONFIG_ESP_BROWNOUT_DET_LVL_SEL_4 is not set -# CONFIG_ESP_BROWNOUT_DET_LVL_SEL_3 is not set -# CONFIG_ESP_BROWNOUT_DET_LVL_SEL_2 is not set -CONFIG_ESP_BROWNOUT_DET_LVL=7 -CONFIG_ESP_BROWNOUT_USE_INTR=y -# end of Brownout Detector -# end of Power Supplier - -CONFIG_ESP_SPI_BUS_LOCK_ISR_FUNCS_IN_IRAM=y -CONFIG_ESP_CLK_RC32K_NOT_TO_USE=y -CONFIG_ESP_INTR_IN_IRAM=y -# end of Hardware Settings - -# -# ESP-Driver:LCD Controller Configurations -# -# CONFIG_LCD_ENABLE_DEBUG_LOG is not set -# end of ESP-Driver:LCD Controller Configurations - -# -# ESP-MM: Memory Management Configurations -# -# CONFIG_ESP_MM_CACHE_MSYNC_C2M_CHUNKED_OPS is not set -# end of ESP-MM: Memory Management Configurations - -# -# ESP NETIF Adapter -# -CONFIG_ESP_NETIF_IP_LOST_TIMER_INTERVAL=120 -# CONFIG_ESP_NETIF_PROVIDE_CUSTOM_IMPLEMENTATION is not set -CONFIG_ESP_NETIF_TCPIP_LWIP=y -# CONFIG_ESP_NETIF_LOOPBACK is not set -CONFIG_ESP_NETIF_USES_TCPIP_WITH_BSD_API=y -CONFIG_ESP_NETIF_REPORT_DATA_TRAFFIC=y -# CONFIG_ESP_NETIF_RECEIVE_REPORT_ERRORS is not set -# CONFIG_ESP_NETIF_L2_TAP is not set -# CONFIG_ESP_NETIF_BRIDGE_EN is not set -# CONFIG_ESP_NETIF_SET_DNS_PER_DEFAULT_NETIF is not set -# end of ESP NETIF Adapter - -# -# Partition API Configuration -# -# end of Partition API Configuration - -# -# PHY -# -CONFIG_ESP_PHY_ENABLED=y -CONFIG_ESP_PHY_CALIBRATION_AND_DATA_STORAGE=y -# CONFIG_ESP_PHY_INIT_DATA_IN_PARTITION is not set -CONFIG_ESP_PHY_MAX_WIFI_TX_POWER=20 -CONFIG_ESP_PHY_MAX_TX_POWER=20 -# CONFIG_ESP_PHY_REDUCE_TX_POWER is not set -# CONFIG_ESP_PHY_ENABLE_CERT_TEST is not set -CONFIG_ESP_PHY_RF_CAL_PARTIAL=y -# CONFIG_ESP_PHY_RF_CAL_NONE is not set -# CONFIG_ESP_PHY_RF_CAL_FULL is not set -CONFIG_ESP_PHY_CALIBRATION_MODE=0 -CONFIG_ESP_PHY_PLL_TRACK_PERIOD_MS=1000 -# CONFIG_ESP_PHY_PLL_TRACK_DEBUG is not set -# CONFIG_ESP_PHY_RECORD_USED_TIME is not set -CONFIG_ESP_PHY_IRAM_OPT=y -# CONFIG_ESP_PHY_DEBUG is not set -# end of PHY - -# -# Power Management -# -CONFIG_PM_SLEEP_FUNC_IN_IRAM=y -# CONFIG_PM_ENABLE is not set -CONFIG_PM_SLP_IRAM_OPT=y -CONFIG_PM_POWER_DOWN_CPU_IN_LIGHT_SLEEP=y -# CONFIG_PM_POWER_DOWN_PERIPHERAL_IN_LIGHT_SLEEP is not set -# end of Power Management - -# -# ESP PSRAM -# -CONFIG_SPIRAM=y - -# -# SPI RAM config -# -CONFIG_SPIRAM_MODE_QUAD=y -# CONFIG_SPIRAM_SPEED_80M is not set -CONFIG_SPIRAM_SPEED_40M=y -CONFIG_SPIRAM_SPEED=40 -# CONFIG_SPIRAM_XIP_FROM_PSRAM is not set -# CONFIG_SPIRAM_ECC_ENABLE is not set -CONFIG_SPIRAM_BOOT_HW_INIT=y -CONFIG_SPIRAM_BOOT_INIT=y -CONFIG_SPIRAM_PRE_CONFIGURE_MEMORY_PROTECTION=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -# CONFIG_SPIRAM_USE_MEMMAP is not set -CONFIG_SPIRAM_USE_CAPS_ALLOC=y -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y -# CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP is not set -# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set -# CONFIG_SPIRAM_ALLOW_NOINIT_SEG_EXTERNAL_MEMORY is not set -# end of SPI RAM config -# end of ESP PSRAM - -# -# ESP Ringbuf -# -# CONFIG_RINGBUF_PLACE_FUNCTIONS_INTO_FLASH is not set -# end of ESP Ringbuf - -# -# ESP-ROM -# -CONFIG_ESP_ROM_PRINT_IN_IRAM=y -# end of ESP-ROM - -# -# ESP Security Specific -# - -# -# Crypto DPA Protection -# -CONFIG_ESP_CRYPTO_DPA_PROTECTION_AT_STARTUP=y -CONFIG_ESP_CRYPTO_DPA_PROTECTION_LEVEL_LOW=y -# CONFIG_ESP_CRYPTO_DPA_PROTECTION_LEVEL_MEDIUM is not set -# CONFIG_ESP_CRYPTO_DPA_PROTECTION_LEVEL_HIGH is not set -CONFIG_ESP_CRYPTO_DPA_PROTECTION_LEVEL=1 -# end of Crypto DPA Protection - -# CONFIG_ESP_CRYPTO_FORCE_ECC_CONSTANT_TIME_POINT_MUL is not set -# end of ESP Security Specific - -# -# ESP System Settings -# -# CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_80 is not set -CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_160=y -# CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240 is not set -CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ=160 - -# -# Cache config -# -CONFIG_CACHE_L1_CACHE_SIZE=0x8000 -CONFIG_CACHE_L1_CACHE_LINE_SIZE=32 -# end of Cache config - -CONFIG_ESP_SYSTEM_IN_IRAM=y -# CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT is not set -CONFIG_ESP_SYSTEM_PANIC_PRINT_REBOOT=y -# CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT is not set -# CONFIG_ESP_SYSTEM_PANIC_GDBSTUB is not set -CONFIG_ESP_SYSTEM_PANIC_REBOOT_DELAY_SECONDS=0 -CONFIG_ESP_SYSTEM_SINGLE_CORE_MODE=y -CONFIG_ESP_SYSTEM_RTC_FAST_MEM_AS_HEAP_DEPCHECK=y -CONFIG_ESP_SYSTEM_ALLOW_RTC_FAST_MEM_AS_HEAP=y -CONFIG_ESP_SYSTEM_NO_BACKTRACE=y -# CONFIG_ESP_SYSTEM_USE_EH_FRAME is not set -# CONFIG_ESP_SYSTEM_USE_FRAME_POINTER is not set - -# -# Memory protection -# -CONFIG_ESP_SYSTEM_PMP_IDRAM_SPLIT=y -# CONFIG_ESP_SYSTEM_PMP_LP_CORE_RESERVE_MEM_EXECUTABLE is not set -# end of Memory protection - -CONFIG_ESP_SYSTEM_EVENT_QUEUE_SIZE=32 -CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=2304 -CONFIG_ESP_MAIN_TASK_STACK_SIZE=8192 -CONFIG_ESP_MAIN_TASK_AFFINITY_CPU0=y -# CONFIG_ESP_MAIN_TASK_AFFINITY_NO_AFFINITY is not set -CONFIG_ESP_MAIN_TASK_AFFINITY=0x0 -CONFIG_ESP_MINIMAL_SHARED_STACK_SIZE=2048 -# CONFIG_ESP_CONSOLE_UART_DEFAULT is not set -CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG=y -# CONFIG_ESP_CONSOLE_UART_CUSTOM is not set -# CONFIG_ESP_CONSOLE_NONE is not set -CONFIG_ESP_CONSOLE_SECONDARY_NONE=y -CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG_ENABLED=y -CONFIG_ESP_CONSOLE_UART_NUM=-1 -CONFIG_ESP_CONSOLE_ROM_SERIAL_PORT_NUM=3 -CONFIG_ESP_INT_WDT=y -CONFIG_ESP_INT_WDT_TIMEOUT_MS=300 -CONFIG_ESP_TASK_WDT_EN=y -CONFIG_ESP_TASK_WDT_INIT=y -# CONFIG_ESP_TASK_WDT_PANIC is not set -CONFIG_ESP_TASK_WDT_TIMEOUT_S=5 -CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0=y -# CONFIG_ESP_PANIC_HANDLER_IRAM is not set -# CONFIG_ESP_DEBUG_STUBS_ENABLE is not set -CONFIG_ESP_DEBUG_OCDAWARE=y -CONFIG_ESP_SYSTEM_CHECK_INT_LEVEL_4=y -CONFIG_ESP_SYSTEM_HW_STACK_GUARD=y -CONFIG_ESP_SYSTEM_HW_PC_RECORD=y -# end of ESP System Settings - -# -# IPC (Inter-Processor Call) -# -CONFIG_ESP_IPC_TASK_STACK_SIZE=1280 -# end of IPC (Inter-Processor Call) - -# -# ESP Timer (High Resolution Timer) -# -CONFIG_ESP_TIMER_IN_IRAM=y -# CONFIG_ESP_TIMER_PROFILING is not set -CONFIG_ESP_TIME_FUNCS_USE_RTC_TIMER=y -CONFIG_ESP_TIME_FUNCS_USE_ESP_TIMER=y -CONFIG_ESP_TIMER_TASK_STACK_SIZE=3584 -CONFIG_ESP_TIMER_INTERRUPT_LEVEL=1 -# CONFIG_ESP_TIMER_SHOW_EXPERIMENTAL is not set -CONFIG_ESP_TIMER_TASK_AFFINITY=0x0 -CONFIG_ESP_TIMER_TASK_AFFINITY_CPU0=y -CONFIG_ESP_TIMER_ISR_AFFINITY_CPU0=y -# CONFIG_ESP_TIMER_SUPPORTS_ISR_DISPATCH_METHOD is not set -CONFIG_ESP_TIMER_IMPL_SYSTIMER=y -# end of ESP Timer (High Resolution Timer) - -# -# Wi-Fi -# -CONFIG_ESP_WIFI_ENABLED=y -CONFIG_ESP_WIFI_STATIC_RX_BUFFER_NUM=10 -CONFIG_ESP_WIFI_DYNAMIC_RX_BUFFER_NUM=32 -# CONFIG_ESP_WIFI_STATIC_TX_BUFFER is not set -CONFIG_ESP_WIFI_DYNAMIC_TX_BUFFER=y -CONFIG_ESP_WIFI_TX_BUFFER_TYPE=1 -CONFIG_ESP_WIFI_DYNAMIC_TX_BUFFER_NUM=32 -CONFIG_ESP_WIFI_STATIC_RX_MGMT_BUFFER=y -# CONFIG_ESP_WIFI_DYNAMIC_RX_MGMT_BUFFER is not set -CONFIG_ESP_WIFI_DYNAMIC_RX_MGMT_BUF=0 -CONFIG_ESP_WIFI_RX_MGMT_BUF_NUM_DEF=5 -# CONFIG_ESP_WIFI_CSI_ENABLED is not set -CONFIG_ESP_WIFI_AMPDU_TX_ENABLED=y -CONFIG_ESP_WIFI_TX_BA_WIN=6 -CONFIG_ESP_WIFI_AMPDU_RX_ENABLED=y -CONFIG_ESP_WIFI_RX_BA_WIN=6 -CONFIG_ESP_WIFI_NVS_ENABLED=y -CONFIG_ESP_WIFI_SOFTAP_BEACON_MAX_LEN=752 -CONFIG_ESP_WIFI_MGMT_SBUF_NUM=32 -CONFIG_ESP_WIFI_IRAM_OPT=y -# CONFIG_ESP_WIFI_EXTRA_IRAM_OPT is not set -CONFIG_ESP_WIFI_RX_IRAM_OPT=y -CONFIG_ESP_WIFI_ENABLE_WPA3_SAE=y -CONFIG_ESP_WIFI_ENABLE_SAE_PK=y -CONFIG_ESP_WIFI_ENABLE_SAE_H2E=y -CONFIG_ESP_WIFI_SOFTAP_SAE_SUPPORT=y -CONFIG_ESP_WIFI_ENABLE_WPA3_OWE_STA=y -# CONFIG_ESP_WIFI_SLP_IRAM_OPT is not set -CONFIG_ESP_WIFI_SLP_DEFAULT_MIN_ACTIVE_TIME=50 -# CONFIG_ESP_WIFI_BSS_MAX_IDLE_SUPPORT is not set -CONFIG_ESP_WIFI_SLP_DEFAULT_MAX_ACTIVE_TIME=10 -CONFIG_ESP_WIFI_SLP_DEFAULT_WAIT_BROADCAST_DATA_TIME=15 -# CONFIG_ESP_WIFI_FTM_ENABLE is not set -CONFIG_ESP_WIFI_STA_DISCONNECTED_PM_ENABLE=y -# CONFIG_ESP_WIFI_GCMP_SUPPORT is not set -CONFIG_ESP_WIFI_GMAC_SUPPORT=y -CONFIG_ESP_WIFI_SOFTAP_SUPPORT=y -# CONFIG_ESP_WIFI_SLP_BEACON_LOST_OPT is not set -CONFIG_ESP_WIFI_ESPNOW_MAX_ENCRYPT_NUM=7 -# CONFIG_ESP_WIFI_NAN_ENABLE is not set -CONFIG_ESP_WIFI_MBEDTLS_CRYPTO=y -CONFIG_ESP_WIFI_MBEDTLS_TLS_CLIENT=y -# CONFIG_ESP_WIFI_WAPI_PSK is not set -# CONFIG_ESP_WIFI_SUITE_B_192 is not set -# CONFIG_ESP_WIFI_11KV_SUPPORT is not set -# CONFIG_ESP_WIFI_MBO_SUPPORT is not set -# CONFIG_ESP_WIFI_DPP_SUPPORT is not set -# CONFIG_ESP_WIFI_11R_SUPPORT is not set -# CONFIG_ESP_WIFI_WPS_SOFTAP_REGISTRAR is not set -# CONFIG_ESP_WIFI_ENABLE_WIFI_TX_STATS is not set -# CONFIG_ESP_WIFI_ENABLE_WIFI_RX_STATS is not set -CONFIG_ESP_WIFI_TX_HETB_QUEUE_NUM=3 -# CONFIG_ESP_WIFI_ENABLE_DUMP_HESIGB is not set -# CONFIG_ESP_WIFI_ENABLE_DUMP_MU_CFO is not set -# CONFIG_ESP_WIFI_ENABLE_DUMP_CTRL_NDPA is not set -# CONFIG_ESP_WIFI_ENABLE_DUMP_CTRL_BFRP is not set - -# -# WPS Configuration Options -# -# CONFIG_ESP_WIFI_WPS_STRICT is not set -# CONFIG_ESP_WIFI_WPS_PASSPHRASE is not set -# CONFIG_ESP_WIFI_WPS_RECONNECT_ON_FAIL is not set -# end of WPS Configuration Options - -# CONFIG_ESP_WIFI_DEBUG_PRINT is not set -CONFIG_ESP_WIFI_ENTERPRISE_SUPPORT=y -# CONFIG_ESP_WIFI_ENT_FREE_DYNAMIC_BUFFER is not set -# end of Wi-Fi - -# -# Core dump -# -# CONFIG_ESP_COREDUMP_ENABLE_TO_FLASH is not set -# CONFIG_ESP_COREDUMP_ENABLE_TO_UART is not set -CONFIG_ESP_COREDUMP_ENABLE_TO_NONE=y -# end of Core dump - -# -# FAT Filesystem support -# -CONFIG_FATFS_VOLUME_COUNT=2 -CONFIG_FATFS_LFN_NONE=y -# CONFIG_FATFS_LFN_HEAP is not set -# CONFIG_FATFS_LFN_STACK is not set -# CONFIG_FATFS_SECTOR_512 is not set -CONFIG_FATFS_SECTOR_4096=y -# CONFIG_FATFS_CODEPAGE_DYNAMIC is not set -CONFIG_FATFS_CODEPAGE_437=y -# CONFIG_FATFS_CODEPAGE_720 is not set -# CONFIG_FATFS_CODEPAGE_737 is not set -# CONFIG_FATFS_CODEPAGE_771 is not set -# CONFIG_FATFS_CODEPAGE_775 is not set -# CONFIG_FATFS_CODEPAGE_850 is not set -# CONFIG_FATFS_CODEPAGE_852 is not set -# CONFIG_FATFS_CODEPAGE_855 is not set -# CONFIG_FATFS_CODEPAGE_857 is not set -# CONFIG_FATFS_CODEPAGE_860 is not set -# CONFIG_FATFS_CODEPAGE_861 is not set -# CONFIG_FATFS_CODEPAGE_862 is not set -# CONFIG_FATFS_CODEPAGE_863 is not set -# CONFIG_FATFS_CODEPAGE_864 is not set -# CONFIG_FATFS_CODEPAGE_865 is not set -# CONFIG_FATFS_CODEPAGE_866 is not set -# CONFIG_FATFS_CODEPAGE_869 is not set -# CONFIG_FATFS_CODEPAGE_932 is not set -# CONFIG_FATFS_CODEPAGE_936 is not set -# CONFIG_FATFS_CODEPAGE_949 is not set -# CONFIG_FATFS_CODEPAGE_950 is not set -CONFIG_FATFS_CODEPAGE=437 -CONFIG_FATFS_FS_LOCK=0 -CONFIG_FATFS_TIMEOUT_MS=10000 -CONFIG_FATFS_PER_FILE_CACHE=y -CONFIG_FATFS_ALLOC_PREFER_EXTRAM=y -# CONFIG_FATFS_USE_FASTSEEK is not set -CONFIG_FATFS_USE_STRFUNC_NONE=y -# CONFIG_FATFS_USE_STRFUNC_WITHOUT_CRLF_CONV is not set -# CONFIG_FATFS_USE_STRFUNC_WITH_CRLF_CONV is not set -CONFIG_FATFS_VFS_FSTAT_BLKSIZE=0 -# CONFIG_FATFS_IMMEDIATE_FSYNC is not set -# CONFIG_FATFS_USE_LABEL is not set -CONFIG_FATFS_LINK_LOCK=y -# CONFIG_FATFS_USE_DYN_BUFFERS is not set - -# -# File system free space calculation behavior -# -CONFIG_FATFS_DONT_TRUST_FREE_CLUSTER_CNT=0 -CONFIG_FATFS_DONT_TRUST_LAST_ALLOC=0 -# end of File system free space calculation behavior -# end of FAT Filesystem support - -# -# FreeRTOS -# - -# -# Kernel -# -# CONFIG_FREERTOS_SMP is not set -CONFIG_FREERTOS_UNICORE=y -CONFIG_FREERTOS_HZ=100 -CONFIG_FREERTOS_OPTIMIZED_SCHEDULER=y -# CONFIG_FREERTOS_CHECK_STACKOVERFLOW_NONE is not set -# CONFIG_FREERTOS_CHECK_STACKOVERFLOW_PTRVAL is not set -CONFIG_FREERTOS_CHECK_STACKOVERFLOW_CANARY=y -CONFIG_FREERTOS_THREAD_LOCAL_STORAGE_POINTERS=1 -CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=1536 -# CONFIG_FREERTOS_USE_IDLE_HOOK is not set -# CONFIG_FREERTOS_USE_TICK_HOOK is not set -CONFIG_FREERTOS_MAX_TASK_NAME_LEN=16 -CONFIG_FREERTOS_ENABLE_BACKWARD_COMPATIBILITY=y -CONFIG_FREERTOS_USE_TIMERS=y -CONFIG_FREERTOS_TIMER_SERVICE_TASK_NAME="Tmr Svc" -# CONFIG_FREERTOS_TIMER_TASK_AFFINITY_CPU0 is not set -CONFIG_FREERTOS_TIMER_TASK_NO_AFFINITY=y -CONFIG_FREERTOS_TIMER_SERVICE_TASK_CORE_AFFINITY=0x7FFFFFFF -CONFIG_FREERTOS_TIMER_TASK_PRIORITY=1 -CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH=2048 -CONFIG_FREERTOS_TIMER_QUEUE_LENGTH=10 -CONFIG_FREERTOS_QUEUE_REGISTRY_SIZE=0 -CONFIG_FREERTOS_TASK_NOTIFICATION_ARRAY_ENTRIES=1 -CONFIG_FREERTOS_USE_TRACE_FACILITY=y -CONFIG_FREERTOS_USE_STATS_FORMATTING_FUNCTIONS=y -# CONFIG_FREERTOS_USE_LIST_DATA_INTEGRITY_CHECK_BYTES is not set -# CONFIG_FREERTOS_VTASKLIST_INCLUDE_COREID is not set -# CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS is not set -# CONFIG_FREERTOS_USE_APPLICATION_TASK_TAG is not set -# end of Kernel - -# -# Port -# -CONFIG_FREERTOS_TASK_FUNCTION_WRAPPER=y -# CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK is not set -CONFIG_FREERTOS_TLSP_DELETION_CALLBACKS=y -# CONFIG_FREERTOS_TASK_PRE_DELETION_HOOK is not set -# CONFIG_FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP is not set -CONFIG_FREERTOS_CHECK_MUTEX_GIVEN_BY_OWNER=y -CONFIG_FREERTOS_ISR_STACKSIZE=1536 -CONFIG_FREERTOS_INTERRUPT_BACKTRACE=y -CONFIG_FREERTOS_TICK_SUPPORT_SYSTIMER=y -CONFIG_FREERTOS_CORETIMER_SYSTIMER_LVL1=y -# CONFIG_FREERTOS_CORETIMER_SYSTIMER_LVL3 is not set -CONFIG_FREERTOS_SYSTICK_USES_SYSTIMER=y -# CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH is not set -# CONFIG_FREERTOS_CHECK_PORT_CRITICAL_COMPLIANCE is not set -# end of Port - -# -# Extra -# -CONFIG_FREERTOS_TASK_CREATE_ALLOW_EXT_MEM=y -# end of Extra - -CONFIG_FREERTOS_PORT=y -CONFIG_FREERTOS_NO_AFFINITY=0x7FFFFFFF -CONFIG_FREERTOS_SUPPORT_STATIC_ALLOCATION=y -CONFIG_FREERTOS_DEBUG_OCDAWARE=y -CONFIG_FREERTOS_ENABLE_TASK_SNAPSHOT=y -CONFIG_FREERTOS_PLACE_SNAPSHOT_FUNS_INTO_FLASH=y -CONFIG_FREERTOS_NUMBER_OF_CORES=1 -CONFIG_FREERTOS_IN_IRAM=y -# end of FreeRTOS - -# -# Hardware Abstraction Layer (HAL) and Low Level (LL) -# -CONFIG_HAL_ASSERTION_EQUALS_SYSTEM=y -# CONFIG_HAL_ASSERTION_DISABLE is not set -# CONFIG_HAL_ASSERTION_SILENT is not set -# CONFIG_HAL_ASSERTION_ENABLE is not set -CONFIG_HAL_DEFAULT_ASSERTION_LEVEL=2 -CONFIG_HAL_SYSTIMER_USE_ROM_IMPL=y -CONFIG_HAL_WDT_USE_ROM_IMPL=y -# end of Hardware Abstraction Layer (HAL) and Low Level (LL) - -# -# Heap memory debugging -# -CONFIG_HEAP_POISONING_DISABLED=y -# CONFIG_HEAP_POISONING_LIGHT is not set -# CONFIG_HEAP_POISONING_COMPREHENSIVE is not set -CONFIG_HEAP_TRACING_OFF=y -# CONFIG_HEAP_TRACING_STANDALONE is not set -# CONFIG_HEAP_TRACING_TOHOST is not set -# CONFIG_HEAP_USE_HOOKS is not set -# CONFIG_HEAP_TASK_TRACKING is not set -# CONFIG_HEAP_ABORT_WHEN_ALLOCATION_FAILS is not set -CONFIG_HEAP_TLSF_USE_ROM_IMPL=y -# CONFIG_HEAP_PLACE_FUNCTION_INTO_FLASH is not set -# end of Heap memory debugging - -# -# IEEE 802.15.4 -# -CONFIG_IEEE802154_ENABLED=y -CONFIG_IEEE802154_RX_BUFFER_SIZE=20 -# CONFIG_IEEE802154_CCA_CARRIER is not set -CONFIG_IEEE802154_CCA_ED=y -# CONFIG_IEEE802154_CCA_CARRIER_OR_ED is not set -# CONFIG_IEEE802154_CCA_CARRIER_AND_ED is not set -CONFIG_IEEE802154_CCA_MODE=1 -CONFIG_IEEE802154_CCA_THRESHOLD=-60 -CONFIG_IEEE802154_PENDING_TABLE_SIZE=20 -# CONFIG_IEEE802154_MULTI_PAN_ENABLE is not set -CONFIG_IEEE802154_INTERFACE_NUM=1 -CONFIG_IEEE802154_TIMING_OPTIMIZATION=y -# CONFIG_IEEE802154_DEBUG is not set -# CONFIG_IEEE802154_DEBUG_ASSERT_MONITOR is not set -# end of IEEE 802.15.4 - -# -# Log -# -CONFIG_LOG_VERSION_1=y -# CONFIG_LOG_VERSION_2 is not set -CONFIG_LOG_VERSION=1 - -# -# Log Level -# -# CONFIG_LOG_DEFAULT_LEVEL_NONE is not set -# CONFIG_LOG_DEFAULT_LEVEL_ERROR is not set -# CONFIG_LOG_DEFAULT_LEVEL_WARN is not set -CONFIG_LOG_DEFAULT_LEVEL_INFO=y -# CONFIG_LOG_DEFAULT_LEVEL_DEBUG is not set -# CONFIG_LOG_DEFAULT_LEVEL_VERBOSE is not set -CONFIG_LOG_DEFAULT_LEVEL=3 -CONFIG_LOG_MAXIMUM_EQUALS_DEFAULT=y -# CONFIG_LOG_MAXIMUM_LEVEL_DEBUG is not set -# CONFIG_LOG_MAXIMUM_LEVEL_VERBOSE is not set -CONFIG_LOG_MAXIMUM_LEVEL=3 - -# -# Level Settings -# -# CONFIG_LOG_MASTER_LEVEL is not set -CONFIG_LOG_DYNAMIC_LEVEL_CONTROL=y -# CONFIG_LOG_TAG_LEVEL_IMPL_NONE is not set -# CONFIG_LOG_TAG_LEVEL_IMPL_LINKED_LIST is not set -CONFIG_LOG_TAG_LEVEL_IMPL_CACHE_AND_LINKED_LIST=y -# CONFIG_LOG_TAG_LEVEL_CACHE_ARRAY is not set -CONFIG_LOG_TAG_LEVEL_CACHE_BINARY_MIN_HEAP=y -CONFIG_LOG_TAG_LEVEL_IMPL_CACHE_SIZE=31 -# end of Level Settings -# end of Log Level - -# -# Format -# -CONFIG_LOG_COLORS=y -CONFIG_LOG_TIMESTAMP_SOURCE_RTOS=y -# CONFIG_LOG_TIMESTAMP_SOURCE_SYSTEM is not set -# end of Format - -# -# Settings -# -CONFIG_LOG_MODE_TEXT_EN=y -CONFIG_LOG_MODE_TEXT=y -# end of Settings - -CONFIG_LOG_IN_IRAM=y -# end of Log - -# -# LWIP -# -CONFIG_LWIP_ENABLE=y -CONFIG_LWIP_LOCAL_HOSTNAME="espressif" -CONFIG_LWIP_TCPIP_TASK_PRIO=18 -# CONFIG_LWIP_TCPIP_CORE_LOCKING is not set -# CONFIG_LWIP_CHECK_THREAD_SAFETY is not set -CONFIG_LWIP_DNS_SUPPORT_MDNS_QUERIES=y -# CONFIG_LWIP_L2_TO_L3_COPY is not set -# CONFIG_LWIP_IRAM_OPTIMIZATION is not set -# CONFIG_LWIP_EXTRA_IRAM_OPTIMIZATION is not set -CONFIG_LWIP_TIMERS_ONDEMAND=y -CONFIG_LWIP_ND6=y -# CONFIG_LWIP_FORCE_ROUTER_FORWARDING is not set -CONFIG_LWIP_MAX_SOCKETS=10 -# CONFIG_LWIP_USE_ONLY_LWIP_SELECT is not set -# CONFIG_LWIP_SO_LINGER is not set -CONFIG_LWIP_SO_REUSE=y -CONFIG_LWIP_SO_REUSE_RXTOALL=y -# CONFIG_LWIP_SO_RCVBUF is not set -# CONFIG_LWIP_NETBUF_RECVINFO is not set -CONFIG_LWIP_IP_DEFAULT_TTL=64 -CONFIG_LWIP_IP4_FRAG=y -CONFIG_LWIP_IP6_FRAG=y -# CONFIG_LWIP_IP4_REASSEMBLY is not set -# CONFIG_LWIP_IP6_REASSEMBLY is not set -CONFIG_LWIP_IP_REASS_MAX_PBUFS=10 -# CONFIG_LWIP_IP_FORWARD is not set -# CONFIG_LWIP_STATS is not set -CONFIG_LWIP_ESP_GRATUITOUS_ARP=y -CONFIG_LWIP_GARP_TMR_INTERVAL=60 -CONFIG_LWIP_ESP_MLDV6_REPORT=y -CONFIG_LWIP_MLDV6_TMR_INTERVAL=40 -CONFIG_LWIP_TCPIP_RECVMBOX_SIZE=32 -CONFIG_LWIP_DHCP_DOES_ARP_CHECK=y -# CONFIG_LWIP_DHCP_DOES_ACD_CHECK is not set -# CONFIG_LWIP_DHCP_DOES_NOT_CHECK_OFFERED_IP is not set -# CONFIG_LWIP_DHCP_DISABLE_CLIENT_ID is not set -CONFIG_LWIP_DHCP_DISABLE_VENDOR_CLASS_ID=y -# CONFIG_LWIP_DHCP_RESTORE_LAST_IP is not set -CONFIG_LWIP_DHCP_OPTIONS_LEN=69 -CONFIG_LWIP_NUM_NETIF_CLIENT_DATA=0 -CONFIG_LWIP_DHCP_COARSE_TIMER_SECS=1 - -# -# DHCP server -# -CONFIG_LWIP_DHCPS=y -CONFIG_LWIP_DHCPS_LEASE_UNIT=60 -CONFIG_LWIP_DHCPS_MAX_STATION_NUM=8 -CONFIG_LWIP_DHCPS_STATIC_ENTRIES=y -CONFIG_LWIP_DHCPS_ADD_DNS=y -# end of DHCP server - -# CONFIG_LWIP_AUTOIP is not set -CONFIG_LWIP_IPV4=y -CONFIG_LWIP_IPV6=y -# CONFIG_LWIP_IPV6_AUTOCONFIG is not set -CONFIG_LWIP_IPV6_NUM_ADDRESSES=3 -# CONFIG_LWIP_IPV6_FORWARD is not set -# CONFIG_LWIP_NETIF_STATUS_CALLBACK is not set -CONFIG_LWIP_NETIF_LOOPBACK=y -CONFIG_LWIP_LOOPBACK_MAX_PBUFS=8 - -# -# TCP -# -CONFIG_LWIP_MAX_ACTIVE_TCP=16 -CONFIG_LWIP_MAX_LISTENING_TCP=16 -CONFIG_LWIP_TCP_HIGH_SPEED_RETRANSMISSION=y -CONFIG_LWIP_TCP_MAXRTX=12 -CONFIG_LWIP_TCP_SYNMAXRTX=12 -CONFIG_LWIP_TCP_MSS=1440 -CONFIG_LWIP_TCP_TMR_INTERVAL=250 -CONFIG_LWIP_TCP_MSL=60000 -CONFIG_LWIP_TCP_FIN_WAIT_TIMEOUT=20000 -CONFIG_LWIP_TCP_SND_BUF_DEFAULT=5760 -CONFIG_LWIP_TCP_WND_DEFAULT=5760 -CONFIG_LWIP_TCP_RECVMBOX_SIZE=6 -CONFIG_LWIP_TCP_ACCEPTMBOX_SIZE=6 -CONFIG_LWIP_TCP_QUEUE_OOSEQ=y -CONFIG_LWIP_TCP_OOSEQ_TIMEOUT=6 -CONFIG_LWIP_TCP_OOSEQ_MAX_PBUFS=4 -# CONFIG_LWIP_TCP_SACK_OUT is not set -CONFIG_LWIP_TCP_OVERSIZE_MSS=y -# CONFIG_LWIP_TCP_OVERSIZE_QUARTER_MSS is not set -# CONFIG_LWIP_TCP_OVERSIZE_DISABLE is not set -CONFIG_LWIP_TCP_RTO_TIME=1500 -# end of TCP - -# -# UDP -# -CONFIG_LWIP_MAX_UDP_PCBS=16 -CONFIG_LWIP_UDP_RECVMBOX_SIZE=6 -# end of UDP - -# -# Checksums -# -# CONFIG_LWIP_CHECKSUM_CHECK_IP is not set -# CONFIG_LWIP_CHECKSUM_CHECK_UDP is not set -CONFIG_LWIP_CHECKSUM_CHECK_ICMP=y -# end of Checksums - -CONFIG_LWIP_TCPIP_TASK_STACK_SIZE=3072 -CONFIG_LWIP_TCPIP_TASK_AFFINITY_NO_AFFINITY=y -# CONFIG_LWIP_TCPIP_TASK_AFFINITY_CPU0 is not set -CONFIG_LWIP_TCPIP_TASK_AFFINITY=0x7FFFFFFF -CONFIG_LWIP_IPV6_MEMP_NUM_ND6_QUEUE=3 -CONFIG_LWIP_IPV6_ND6_NUM_NEIGHBORS=5 -CONFIG_LWIP_IPV6_ND6_NUM_PREFIXES=5 -CONFIG_LWIP_IPV6_ND6_NUM_ROUTERS=3 -CONFIG_LWIP_IPV6_ND6_NUM_DESTINATIONS=10 -# CONFIG_LWIP_IPV6_ND6_ROUTE_INFO_OPTION_SUPPORT is not set -# CONFIG_LWIP_PPP_SUPPORT is not set -# CONFIG_LWIP_SLIP_SUPPORT is not set - -# -# ICMP -# -CONFIG_LWIP_ICMP=y -# CONFIG_LWIP_MULTICAST_PING is not set -# CONFIG_LWIP_BROADCAST_PING is not set -# end of ICMP - -# -# LWIP RAW API -# -CONFIG_LWIP_MAX_RAW_PCBS=16 -# end of LWIP RAW API - -# -# SNTP -# -CONFIG_LWIP_SNTP_MAX_SERVERS=1 -# CONFIG_LWIP_DHCP_GET_NTP_SRV is not set -CONFIG_LWIP_SNTP_UPDATE_DELAY=3600000 -CONFIG_LWIP_SNTP_STARTUP_DELAY=y -CONFIG_LWIP_SNTP_MAXIMUM_STARTUP_DELAY=5000 -# end of SNTP - -# -# DNS -# -CONFIG_LWIP_DNS_MAX_HOST_IP=1 -CONFIG_LWIP_DNS_MAX_SERVERS=3 -# CONFIG_LWIP_FALLBACK_DNS_SERVER_SUPPORT is not set -# CONFIG_LWIP_DNS_SETSERVER_WITH_NETIF is not set -# CONFIG_LWIP_USE_ESP_GETADDRINFO is not set -# end of DNS - -CONFIG_LWIP_BRIDGEIF_MAX_PORTS=7 -CONFIG_LWIP_ESP_LWIP_ASSERT=y - -# -# Hooks -# -# CONFIG_LWIP_HOOK_TCP_ISN_NONE is not set -CONFIG_LWIP_HOOK_TCP_ISN_DEFAULT=y -# CONFIG_LWIP_HOOK_TCP_ISN_CUSTOM is not set -CONFIG_LWIP_HOOK_IP6_ROUTE_NONE=y -# CONFIG_LWIP_HOOK_IP6_ROUTE_DEFAULT is not set -# CONFIG_LWIP_HOOK_IP6_ROUTE_CUSTOM is not set -CONFIG_LWIP_HOOK_ND6_GET_GW_NONE=y -# CONFIG_LWIP_HOOK_ND6_GET_GW_DEFAULT is not set -# CONFIG_LWIP_HOOK_ND6_GET_GW_CUSTOM is not set -CONFIG_LWIP_HOOK_IP6_SELECT_SRC_ADDR_NONE=y -# CONFIG_LWIP_HOOK_IP6_SELECT_SRC_ADDR_DEFAULT is not set -# CONFIG_LWIP_HOOK_IP6_SELECT_SRC_ADDR_CUSTOM is not set -CONFIG_LWIP_HOOK_DHCP_EXTRA_OPTION_NONE=y -# CONFIG_LWIP_HOOK_DHCP_EXTRA_OPTION_DEFAULT is not set -# CONFIG_LWIP_HOOK_DHCP_EXTRA_OPTION_CUSTOM is not set -CONFIG_LWIP_HOOK_NETCONN_EXT_RESOLVE_NONE=y -# CONFIG_LWIP_HOOK_NETCONN_EXT_RESOLVE_DEFAULT is not set -# CONFIG_LWIP_HOOK_NETCONN_EXT_RESOLVE_CUSTOM is not set -CONFIG_LWIP_HOOK_DNS_EXT_RESOLVE_NONE=y -# CONFIG_LWIP_HOOK_DNS_EXT_RESOLVE_CUSTOM is not set -# CONFIG_LWIP_HOOK_IP6_INPUT_NONE is not set -CONFIG_LWIP_HOOK_IP6_INPUT_DEFAULT=y -# CONFIG_LWIP_HOOK_IP6_INPUT_CUSTOM is not set -# end of Hooks - -# CONFIG_LWIP_DEBUG is not set -# end of LWIP - -# -# mbedTLS -# -CONFIG_MBEDTLS_INTERNAL_MEM_ALLOC=y -# CONFIG_MBEDTLS_EXTERNAL_MEM_ALLOC is not set -# CONFIG_MBEDTLS_DEFAULT_MEM_ALLOC is not set -# CONFIG_MBEDTLS_CUSTOM_MEM_ALLOC is not set -CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN=y -CONFIG_MBEDTLS_SSL_IN_CONTENT_LEN=16384 -CONFIG_MBEDTLS_SSL_OUT_CONTENT_LEN=4096 -# CONFIG_MBEDTLS_DYNAMIC_BUFFER is not set -# CONFIG_MBEDTLS_DEBUG is not set - -# -# mbedTLS v3.x related -# -# CONFIG_MBEDTLS_SSL_PROTO_TLS1_3 is not set -# CONFIG_MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH is not set -# CONFIG_MBEDTLS_X509_TRUSTED_CERT_CALLBACK is not set -# CONFIG_MBEDTLS_SSL_CONTEXT_SERIALIZATION is not set -CONFIG_MBEDTLS_SSL_KEEP_PEER_CERTIFICATE=y -# CONFIG_MBEDTLS_SSL_KEYING_MATERIAL_EXPORT is not set -CONFIG_MBEDTLS_PKCS7_C=y -# end of mbedTLS v3.x related - -# -# Certificate Bundle -# -CONFIG_MBEDTLS_CERTIFICATE_BUNDLE=y -CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_FULL=y -# CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_CMN is not set -# CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_NONE is not set -# CONFIG_MBEDTLS_CUSTOM_CERTIFICATE_BUNDLE is not set -# CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEPRECATED_LIST is not set -CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_MAX_CERTS=200 -# end of Certificate Bundle - -# CONFIG_MBEDTLS_ECP_RESTARTABLE is not set -CONFIG_MBEDTLS_CMAC_C=y -CONFIG_MBEDTLS_HARDWARE_AES=y -CONFIG_MBEDTLS_AES_USE_INTERRUPT=y -CONFIG_MBEDTLS_AES_INTERRUPT_LEVEL=0 -# CONFIG_MBEDTLS_AES_USE_PSEUDO_ROUND_FUNC is not set -CONFIG_MBEDTLS_GCM_SUPPORT_NON_AES_CIPHER=y -CONFIG_MBEDTLS_HARDWARE_MPI=y -# CONFIG_MBEDTLS_LARGE_KEY_SOFTWARE_MPI is not set -CONFIG_MBEDTLS_MPI_USE_INTERRUPT=y -CONFIG_MBEDTLS_MPI_INTERRUPT_LEVEL=0 -CONFIG_MBEDTLS_HARDWARE_SHA=y -CONFIG_MBEDTLS_HARDWARE_ECC=y -CONFIG_MBEDTLS_ECC_OTHER_CURVES_SOFT_FALLBACK=y -CONFIG_MBEDTLS_ROM_MD5=y -# CONFIG_MBEDTLS_HARDWARE_ECDSA_SIGN is not set -CONFIG_MBEDTLS_HARDWARE_ECDSA_VERIFY=y -# CONFIG_MBEDTLS_ATCA_HW_ECDSA_SIGN is not set -# CONFIG_MBEDTLS_ATCA_HW_ECDSA_VERIFY is not set -CONFIG_MBEDTLS_HAVE_TIME=y -# CONFIG_MBEDTLS_PLATFORM_TIME_ALT is not set -# CONFIG_MBEDTLS_HAVE_TIME_DATE is not set -CONFIG_MBEDTLS_ECDSA_DETERMINISTIC=y -CONFIG_MBEDTLS_SHA1_C=y -CONFIG_MBEDTLS_SHA512_C=y -# CONFIG_MBEDTLS_SHA3_C is not set -CONFIG_MBEDTLS_TLS_SERVER_AND_CLIENT=y -# CONFIG_MBEDTLS_TLS_SERVER_ONLY is not set -# CONFIG_MBEDTLS_TLS_CLIENT_ONLY is not set -# CONFIG_MBEDTLS_TLS_DISABLED is not set -CONFIG_MBEDTLS_TLS_SERVER=y -CONFIG_MBEDTLS_TLS_CLIENT=y -CONFIG_MBEDTLS_TLS_ENABLED=y - -# -# TLS Key Exchange Methods -# -# CONFIG_MBEDTLS_PSK_MODES is not set -CONFIG_MBEDTLS_KEY_EXCHANGE_RSA=y -CONFIG_MBEDTLS_KEY_EXCHANGE_ELLIPTIC_CURVE=y -CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_RSA=y -CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA=y -CONFIG_MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA=y -CONFIG_MBEDTLS_KEY_EXCHANGE_ECDH_RSA=y -# end of TLS Key Exchange Methods - -CONFIG_MBEDTLS_SSL_RENEGOTIATION=y -CONFIG_MBEDTLS_SSL_PROTO_TLS1_2=y -# CONFIG_MBEDTLS_SSL_PROTO_GMTSSL1_1 is not set -# CONFIG_MBEDTLS_SSL_PROTO_DTLS is not set -CONFIG_MBEDTLS_SSL_ALPN=y -CONFIG_MBEDTLS_CLIENT_SSL_SESSION_TICKETS=y -CONFIG_MBEDTLS_SERVER_SSL_SESSION_TICKETS=y - -# -# Symmetric Ciphers -# -CONFIG_MBEDTLS_AES_C=y -# CONFIG_MBEDTLS_CAMELLIA_C is not set -# CONFIG_MBEDTLS_DES_C is not set -# CONFIG_MBEDTLS_BLOWFISH_C is not set -# CONFIG_MBEDTLS_XTEA_C is not set -CONFIG_MBEDTLS_CCM_C=y -CONFIG_MBEDTLS_GCM_C=y -# CONFIG_MBEDTLS_NIST_KW_C is not set -# end of Symmetric Ciphers - -# CONFIG_MBEDTLS_RIPEMD160_C is not set - -# -# Certificates -# -CONFIG_MBEDTLS_PEM_PARSE_C=y -CONFIG_MBEDTLS_PEM_WRITE_C=y -CONFIG_MBEDTLS_X509_CRL_PARSE_C=y -CONFIG_MBEDTLS_X509_CSR_PARSE_C=y -# end of Certificates - -CONFIG_MBEDTLS_ECP_C=y -CONFIG_MBEDTLS_PK_PARSE_EC_EXTENDED=y -CONFIG_MBEDTLS_PK_PARSE_EC_COMPRESSED=y -# CONFIG_MBEDTLS_DHM_C is not set -CONFIG_MBEDTLS_ECDH_C=y -CONFIG_MBEDTLS_ECDSA_C=y -# CONFIG_MBEDTLS_ECJPAKE_C is not set -CONFIG_MBEDTLS_ECP_DP_SECP192R1_ENABLED=y -CONFIG_MBEDTLS_ECP_DP_SECP224R1_ENABLED=y -CONFIG_MBEDTLS_ECP_DP_SECP256R1_ENABLED=y -CONFIG_MBEDTLS_ECP_DP_SECP384R1_ENABLED=y -CONFIG_MBEDTLS_ECP_DP_SECP521R1_ENABLED=y -CONFIG_MBEDTLS_ECP_DP_SECP192K1_ENABLED=y -CONFIG_MBEDTLS_ECP_DP_SECP224K1_ENABLED=y -CONFIG_MBEDTLS_ECP_DP_SECP256K1_ENABLED=y -CONFIG_MBEDTLS_ECP_DP_BP256R1_ENABLED=y -CONFIG_MBEDTLS_ECP_DP_BP384R1_ENABLED=y -CONFIG_MBEDTLS_ECP_DP_BP512R1_ENABLED=y -CONFIG_MBEDTLS_ECP_DP_CURVE25519_ENABLED=y -CONFIG_MBEDTLS_ECP_NIST_OPTIM=y -# CONFIG_MBEDTLS_ECP_FIXED_POINT_OPTIM is not set -# CONFIG_MBEDTLS_POLY1305_C is not set -# CONFIG_MBEDTLS_CHACHA20_C is not set -# CONFIG_MBEDTLS_HKDF_C is not set -# CONFIG_MBEDTLS_THREADING_C is not set -CONFIG_MBEDTLS_ERROR_STRINGS=y -CONFIG_MBEDTLS_FS_IO=y -# CONFIG_MBEDTLS_ALLOW_WEAK_CERTIFICATE_VERIFICATION is not set -# end of mbedTLS - -# -# ESP-MQTT Configurations -# -CONFIG_MQTT_PROTOCOL_311=y -# CONFIG_MQTT_PROTOCOL_5 is not set -CONFIG_MQTT_TRANSPORT_SSL=y -CONFIG_MQTT_TRANSPORT_WEBSOCKET=y -CONFIG_MQTT_TRANSPORT_WEBSOCKET_SECURE=y -# CONFIG_MQTT_MSG_ID_INCREMENTAL is not set -# CONFIG_MQTT_SKIP_PUBLISH_IF_DISCONNECTED is not set -# CONFIG_MQTT_REPORT_DELETED_MESSAGES is not set -# CONFIG_MQTT_USE_CUSTOM_CONFIG is not set -# CONFIG_MQTT_TASK_CORE_SELECTION_ENABLED is not set -# CONFIG_MQTT_CUSTOM_OUTBOX is not set -# end of ESP-MQTT Configurations - -# -# LibC -# -CONFIG_LIBC_NEWLIB=y -CONFIG_LIBC_MISC_IN_IRAM=y -CONFIG_LIBC_LOCKS_PLACE_IN_IRAM=y -CONFIG_LIBC_STDOUT_LINE_ENDING_CRLF=y -# CONFIG_LIBC_STDOUT_LINE_ENDING_LF is not set -# CONFIG_LIBC_STDOUT_LINE_ENDING_CR is not set -# CONFIG_LIBC_STDIN_LINE_ENDING_CRLF is not set -# CONFIG_LIBC_STDIN_LINE_ENDING_LF is not set -CONFIG_LIBC_STDIN_LINE_ENDING_CR=y -# CONFIG_LIBC_NEWLIB_NANO_FORMAT is not set -CONFIG_LIBC_TIME_SYSCALL_USE_RTC_HRT=y -# CONFIG_LIBC_TIME_SYSCALL_USE_RTC is not set -# CONFIG_LIBC_TIME_SYSCALL_USE_HRT is not set -# CONFIG_LIBC_TIME_SYSCALL_USE_NONE is not set -# CONFIG_LIBC_OPTIMIZED_MISALIGNED_ACCESS is not set -# end of LibC - -# -# NVS -# -# CONFIG_NVS_ENCRYPTION is not set -# CONFIG_NVS_ASSERT_ERROR_CHECK is not set -# CONFIG_NVS_LEGACY_DUP_KEYS_COMPATIBILITY is not set -# CONFIG_NVS_ALLOCATE_CACHE_IN_SPIRAM is not set -# end of NVS - -# -# OpenThread -# -# CONFIG_OPENTHREAD_ENABLED is not set - -# -# OpenThread Spinel -# -# CONFIG_OPENTHREAD_SPINEL_ONLY is not set -# end of OpenThread Spinel - -# CONFIG_OPENTHREAD_DEBUG is not set -# end of OpenThread - -# -# Protocomm -# -CONFIG_ESP_PROTOCOMM_SUPPORT_SECURITY_VERSION_0=y -CONFIG_ESP_PROTOCOMM_SUPPORT_SECURITY_VERSION_1=y -CONFIG_ESP_PROTOCOMM_SUPPORT_SECURITY_VERSION_2=y -CONFIG_ESP_PROTOCOMM_SUPPORT_SECURITY_PATCH_VERSION=y -# end of Protocomm - -# -# PThreads -# -CONFIG_PTHREAD_TASK_PRIO_DEFAULT=5 -CONFIG_PTHREAD_TASK_STACK_SIZE_DEFAULT=3072 -CONFIG_PTHREAD_STACK_MIN=768 -CONFIG_PTHREAD_TASK_CORE_DEFAULT=-1 -CONFIG_PTHREAD_TASK_NAME_DEFAULT="pthread" -# end of PThreads - -# -# MMU Config -# -CONFIG_MMU_PAGE_SIZE_64KB=y -CONFIG_MMU_PAGE_MODE="64KB" -CONFIG_MMU_PAGE_SIZE=0x10000 -# end of MMU Config - -# -# Main Flash configuration -# - -# -# SPI Flash behavior when brownout -# -CONFIG_SPI_FLASH_BROWNOUT_RESET_XMC=y -CONFIG_SPI_FLASH_BROWNOUT_RESET=y -# end of SPI Flash behavior when brownout - -# -# Optional and Experimental Features (READ DOCS FIRST) -# - -# -# Features here require specific hardware (READ DOCS FIRST!) -# -# CONFIG_SPI_FLASH_AUTO_SUSPEND is not set -CONFIG_SPI_FLASH_SUSPEND_TSUS_VAL_US=50 -CONFIG_SPI_FLASH_SUSPEND_TRS_VAL_US=50 -# CONFIG_SPI_FLASH_FORCE_ENABLE_XMC_C_SUSPEND is not set -# CONFIG_SPI_FLASH_FORCE_ENABLE_C6_H2_SUSPEND is not set -CONFIG_SPI_FLASH_PLACE_FUNCTIONS_IN_IRAM=y -# end of Optional and Experimental Features (READ DOCS FIRST) -# end of Main Flash configuration - -# -# SPI Flash driver -# -# CONFIG_SPI_FLASH_VERIFY_WRITE is not set -# CONFIG_SPI_FLASH_ENABLE_COUNTERS is not set -CONFIG_SPI_FLASH_ROM_DRIVER_PATCH=y -# CONFIG_SPI_FLASH_ROM_IMPL is not set -CONFIG_SPI_FLASH_DANGEROUS_WRITE_ABORTS=y -# CONFIG_SPI_FLASH_DANGEROUS_WRITE_FAILS is not set -# CONFIG_SPI_FLASH_DANGEROUS_WRITE_ALLOWED is not set -# CONFIG_SPI_FLASH_BYPASS_BLOCK_ERASE is not set -CONFIG_SPI_FLASH_YIELD_DURING_ERASE=y -CONFIG_SPI_FLASH_ERASE_YIELD_DURATION_MS=20 -CONFIG_SPI_FLASH_ERASE_YIELD_TICKS=1 -CONFIG_SPI_FLASH_WRITE_CHUNK_SIZE=8192 -# CONFIG_SPI_FLASH_SIZE_OVERRIDE is not set -# CONFIG_SPI_FLASH_CHECK_ERASE_TIMEOUT_DISABLED is not set -# CONFIG_SPI_FLASH_OVERRIDE_CHIP_DRIVER_LIST is not set - -# -# Auto-detect flash chips -# -CONFIG_SPI_FLASH_VENDOR_XMC_SUPPORT_ENABLED=y -CONFIG_SPI_FLASH_VENDOR_GD_SUPPORT_ENABLED=y -CONFIG_SPI_FLASH_VENDOR_BOYA_SUPPORT_ENABLED=y -CONFIG_SPI_FLASH_SUPPORT_ISSI_CHIP=y -CONFIG_SPI_FLASH_SUPPORT_MXIC_CHIP=y -CONFIG_SPI_FLASH_SUPPORT_GD_CHIP=y -CONFIG_SPI_FLASH_SUPPORT_WINBOND_CHIP=y -CONFIG_SPI_FLASH_SUPPORT_BOYA_CHIP=y -CONFIG_SPI_FLASH_SUPPORT_TH_CHIP=y -# end of Auto-detect flash chips - -CONFIG_SPI_FLASH_ENABLE_ENCRYPTED_READ_WRITE=y -# end of SPI Flash driver - -# -# SPIFFS Configuration -# -CONFIG_SPIFFS_MAX_PARTITIONS=3 - -# -# SPIFFS Cache Configuration -# -CONFIG_SPIFFS_CACHE=y -CONFIG_SPIFFS_CACHE_WR=y -# CONFIG_SPIFFS_CACHE_STATS is not set -# end of SPIFFS Cache Configuration - -CONFIG_SPIFFS_PAGE_CHECK=y -CONFIG_SPIFFS_GC_MAX_RUNS=10 -# CONFIG_SPIFFS_GC_STATS is not set -CONFIG_SPIFFS_PAGE_SIZE=256 -CONFIG_SPIFFS_OBJ_NAME_LEN=32 -# CONFIG_SPIFFS_FOLLOW_SYMLINKS is not set -CONFIG_SPIFFS_USE_MAGIC=y -CONFIG_SPIFFS_USE_MAGIC_LENGTH=y -CONFIG_SPIFFS_META_LENGTH=4 -CONFIG_SPIFFS_USE_MTIME=y - -# -# Debug Configuration -# -# CONFIG_SPIFFS_DBG is not set -# CONFIG_SPIFFS_API_DBG is not set -# CONFIG_SPIFFS_GC_DBG is not set -# CONFIG_SPIFFS_CACHE_DBG is not set -# CONFIG_SPIFFS_CHECK_DBG is not set -# CONFIG_SPIFFS_TEST_VISUALISATION is not set -# end of Debug Configuration -# end of SPIFFS Configuration - -# -# TCP Transport -# - -# -# Websocket -# -CONFIG_WS_TRANSPORT=y -CONFIG_WS_BUFFER_SIZE=1024 -# CONFIG_WS_DYNAMIC_BUFFER is not set -# end of Websocket -# end of TCP Transport - -# -# Ultra Low Power (ULP) Co-processor -# -# CONFIG_ULP_COPROC_ENABLED is not set - -# -# ULP Debugging Options -# -# end of ULP Debugging Options -# end of Ultra Low Power (ULP) Co-processor - -# -# Unity unit testing library -# -CONFIG_UNITY_ENABLE_FLOAT=y -CONFIG_UNITY_ENABLE_DOUBLE=y -# CONFIG_UNITY_ENABLE_64BIT is not set -# CONFIG_UNITY_ENABLE_COLOR is not set -CONFIG_UNITY_ENABLE_IDF_TEST_RUNNER=y -# CONFIG_UNITY_ENABLE_FIXTURE is not set -# CONFIG_UNITY_ENABLE_BACKTRACE_ON_FAIL is not set -# CONFIG_UNITY_TEST_ORDER_BY_FILE_PATH_AND_LINE is not set -# end of Unity unit testing library - -# -# Virtual file system -# -CONFIG_VFS_SUPPORT_IO=y -CONFIG_VFS_SUPPORT_DIR=y -CONFIG_VFS_SUPPORT_SELECT=y -CONFIG_VFS_SUPPRESS_SELECT_DEBUG_OUTPUT=y -# CONFIG_VFS_SELECT_IN_RAM is not set -CONFIG_VFS_SUPPORT_TERMIOS=y -CONFIG_VFS_MAX_COUNT=8 - -# -# Host File System I/O (Semihosting) -# -CONFIG_VFS_SEMIHOSTFS_MAX_MOUNT_POINTS=1 -# end of Host File System I/O (Semihosting) - -CONFIG_VFS_INITIALIZE_DEV_NULL=y -# end of Virtual file system - -# -# Wear Levelling -# -# CONFIG_WL_SECTOR_SIZE_512 is not set -CONFIG_WL_SECTOR_SIZE_4096=y -CONFIG_WL_SECTOR_SIZE=4096 -# end of Wear Levelling - -# -# Wi-Fi Provisioning Manager -# -CONFIG_WIFI_PROV_SCAN_MAX_ENTRIES=16 -CONFIG_WIFI_PROV_AUTOSTOP_TIMEOUT=30 -# CONFIG_WIFI_PROV_BLE_BONDING is not set -CONFIG_WIFI_PROV_BLE_SEC_CONN=y -# CONFIG_WIFI_PROV_BLE_FORCE_ENCRYPTION is not set -# CONFIG_WIFI_PROV_BLE_NOTIFY is not set -# CONFIG_WIFI_PROV_KEEP_BLE_ON_AFTER_PROV is not set -CONFIG_WIFI_PROV_STA_ALL_CHANNEL_SCAN=y -# CONFIG_WIFI_PROV_STA_FAST_SCAN is not set -# end of Wi-Fi Provisioning Manager - -# -# cJSON -# -CONFIG_CJSON_NESTING_LIMIT=1000 -CONFIG_CJSON_CIRCULAR_LIMIT=10000 -# end of cJSON - -# -# LittleFS -# -CONFIG_LITTLEFS_SDMMC_SUPPORT=y -CONFIG_LITTLEFS_MAX_PARTITIONS=3 -CONFIG_LITTLEFS_PAGE_SIZE=256 -CONFIG_LITTLEFS_OBJ_NAME_LEN=64 -CONFIG_LITTLEFS_READ_SIZE=128 -CONFIG_LITTLEFS_WRITE_SIZE=128 -CONFIG_LITTLEFS_LOOKAHEAD_SIZE=128 -CONFIG_LITTLEFS_CACHE_SIZE=512 -CONFIG_LITTLEFS_BLOCK_CYCLES=512 -CONFIG_LITTLEFS_USE_MTIME=y -# CONFIG_LITTLEFS_USE_ONLY_HASH is not set -# CONFIG_LITTLEFS_HUMAN_READABLE is not set -CONFIG_LITTLEFS_MTIME_USE_SECONDS=y -# CONFIG_LITTLEFS_MTIME_USE_NONCE is not set -# CONFIG_LITTLEFS_SPIFFS_COMPAT is not set -# CONFIG_LITTLEFS_FLUSH_FILE_EVERY_WRITE is not set -# CONFIG_LITTLEFS_FCNTL_GET_PATH is not set -# CONFIG_LITTLEFS_MULTIVERSION is not set -# CONFIG_LITTLEFS_MALLOC_STRATEGY_DISABLE is not set -CONFIG_LITTLEFS_MALLOC_STRATEGY_DEFAULT=y -# CONFIG_LITTLEFS_MALLOC_STRATEGY_INTERNAL is not set -# CONFIG_LITTLEFS_MALLOC_STRATEGY_SPIRAM is not set -CONFIG_LITTLEFS_ASSERTS=y -# CONFIG_LITTLEFS_MMAP_PARTITION is not set -# CONFIG_LITTLEFS_WDT_RESET is not set -# end of LittleFS - -# -# LVGL configuration -# -CONFIG_LV_CONF_SKIP=y -# CONFIG_LV_CONF_MINIMAL is not set - -# -# Color Settings -# -# CONFIG_LV_COLOR_DEPTH_32 is not set -# CONFIG_LV_COLOR_DEPTH_24 is not set -CONFIG_LV_COLOR_DEPTH_16=y -# CONFIG_LV_COLOR_DEPTH_8 is not set -# CONFIG_LV_COLOR_DEPTH_1 is not set -CONFIG_LV_COLOR_DEPTH=16 -# end of Color Settings - -# -# Memory Settings -# -CONFIG_LV_USE_BUILTIN_MALLOC=y -# CONFIG_LV_USE_CLIB_MALLOC is not set -# CONFIG_LV_USE_MICROPYTHON_MALLOC is not set -# CONFIG_LV_USE_RTTHREAD_MALLOC is not set -# CONFIG_LV_USE_CUSTOM_MALLOC is not set -CONFIG_LV_USE_BUILTIN_STRING=y -# CONFIG_LV_USE_CLIB_STRING is not set -# CONFIG_LV_USE_CUSTOM_STRING is not set -CONFIG_LV_USE_BUILTIN_SPRINTF=y -# CONFIG_LV_USE_CLIB_SPRINTF is not set -# CONFIG_LV_USE_CUSTOM_SPRINTF is not set -CONFIG_LV_MEM_SIZE_KILOBYTES=64 -CONFIG_LV_MEM_POOL_EXPAND_SIZE_KILOBYTES=0 -CONFIG_LV_MEM_ADR=0x0 -# end of Memory Settings - -# -# HAL Settings -# -CONFIG_LV_DEF_REFR_PERIOD=33 -CONFIG_LV_DPI_DEF=130 -# end of HAL Settings - -# -# Operating System (OS) -# -CONFIG_LV_OS_NONE=y -# CONFIG_LV_OS_PTHREAD is not set -# CONFIG_LV_OS_FREERTOS is not set -# CONFIG_LV_OS_CMSIS_RTOS2 is not set -# CONFIG_LV_OS_RTTHREAD is not set -# CONFIG_LV_OS_WINDOWS is not set -# CONFIG_LV_OS_MQX is not set -# CONFIG_LV_OS_SDL2 is not set -# CONFIG_LV_OS_CUSTOM is not set -# end of Operating System (OS) - -# -# Rendering Configuration -# -CONFIG_LV_DRAW_BUF_STRIDE_ALIGN=1 -CONFIG_LV_DRAW_BUF_ALIGN=4 -CONFIG_LV_DRAW_LAYER_SIMPLE_BUF_SIZE=24576 -CONFIG_LV_DRAW_LAYER_MAX_MEMORY=0 -CONFIG_LV_USE_DRAW_SW=y -CONFIG_LV_DRAW_SW_SUPPORT_RGB565=y -CONFIG_LV_DRAW_SW_SUPPORT_RGB565_SWAPPED=y -CONFIG_LV_DRAW_SW_SUPPORT_RGB565A8=y -CONFIG_LV_DRAW_SW_SUPPORT_RGB888=y -CONFIG_LV_DRAW_SW_SUPPORT_XRGB8888=y -CONFIG_LV_DRAW_SW_SUPPORT_ARGB8888=y -CONFIG_LV_DRAW_SW_SUPPORT_ARGB8888_PREMULTIPLIED=y -CONFIG_LV_DRAW_SW_SUPPORT_L8=y -CONFIG_LV_DRAW_SW_SUPPORT_AL88=y -CONFIG_LV_DRAW_SW_SUPPORT_A8=y -CONFIG_LV_DRAW_SW_SUPPORT_I1=y -CONFIG_LV_DRAW_SW_I1_LUM_THRESHOLD=127 -CONFIG_LV_DRAW_SW_DRAW_UNIT_CNT=1 -# CONFIG_LV_USE_DRAW_ARM2D_SYNC is not set -# CONFIG_LV_USE_NATIVE_HELIUM_ASM is not set -CONFIG_LV_DRAW_SW_COMPLEX=y -# CONFIG_LV_USE_DRAW_SW_COMPLEX_GRADIENTS is not set -CONFIG_LV_DRAW_SW_SHADOW_CACHE_SIZE=0 -CONFIG_LV_DRAW_SW_CIRCLE_CACHE_SIZE=4 -CONFIG_LV_DRAW_SW_ASM_NONE=y -# CONFIG_LV_DRAW_SW_ASM_NEON is not set -# CONFIG_LV_DRAW_SW_ASM_HELIUM is not set -# CONFIG_LV_DRAW_SW_ASM_RISCV_V is not set -# CONFIG_LV_DRAW_SW_ASM_CUSTOM is not set -CONFIG_LV_USE_DRAW_SW_ASM=0 -# CONFIG_LV_USE_PXP is not set -# CONFIG_LV_USE_G2D is not set -# CONFIG_LV_USE_DRAW_DAVE2D is not set -# CONFIG_LV_USE_DRAW_SDL is not set -# CONFIG_LV_USE_DRAW_VG_LITE is not set -# CONFIG_LV_USE_VECTOR_GRAPHIC is not set -# CONFIG_LV_USE_DRAW_DMA2D is not set -# CONFIG_LV_USE_PPA is not set -# CONFIG_LV_USE_DRAW_EVE is not set -# end of Rendering Configuration - -# -# Feature Configuration -# - -# -# Logging -# -# CONFIG_LV_USE_LOG is not set -# end of Logging - -# -# Asserts -# -CONFIG_LV_USE_ASSERT_NULL=y -CONFIG_LV_USE_ASSERT_MALLOC=y -# CONFIG_LV_USE_ASSERT_STYLE is not set -# CONFIG_LV_USE_ASSERT_MEM_INTEGRITY is not set -# CONFIG_LV_USE_ASSERT_OBJ is not set -CONFIG_LV_ASSERT_HANDLER_INCLUDE="assert.h" -# end of Asserts - -# -# Debug -# -# CONFIG_LV_USE_REFR_DEBUG is not set -# CONFIG_LV_USE_LAYER_DEBUG is not set -# CONFIG_LV_USE_PARALLEL_DRAW_DEBUG is not set -# end of Debug - -# -# Others -# -# CONFIG_LV_ENABLE_GLOBAL_CUSTOM is not set -CONFIG_LV_CACHE_DEF_SIZE=0 -CONFIG_LV_IMAGE_HEADER_CACHE_DEF_CNT=0 -CONFIG_LV_GRADIENT_MAX_STOPS=2 -CONFIG_LV_COLOR_MIX_ROUND_OFS=128 -# CONFIG_LV_OBJ_STYLE_CACHE is not set -# CONFIG_LV_USE_OBJ_ID is not set -# CONFIG_LV_USE_OBJ_NAME is not set -# CONFIG_LV_USE_OBJ_PROPERTY is not set -# CONFIG_LV_USE_EXT_DATA is not set -# end of Others -# end of Feature Configuration - -# -# Compiler Settings -# -# CONFIG_LV_BIG_ENDIAN_SYSTEM is not set -CONFIG_LV_ATTRIBUTE_MEM_ALIGN_SIZE=1 -# CONFIG_LV_ATTRIBUTE_FAST_MEM_USE_IRAM is not set -# CONFIG_LV_USE_FLOAT is not set -# CONFIG_LV_USE_MATRIX is not set -# CONFIG_LV_USE_PRIVATE_API is not set -# end of Compiler Settings - -# -# Font Usage -# - -# -# Enable built-in fonts -# -# CONFIG_LV_FONT_MONTSERRAT_8 is not set -CONFIG_LV_FONT_MONTSERRAT_10=y -CONFIG_LV_FONT_MONTSERRAT_12=y -CONFIG_LV_FONT_MONTSERRAT_14=y -# CONFIG_LV_FONT_MONTSERRAT_16 is not set -# CONFIG_LV_FONT_MONTSERRAT_18 is not set -# CONFIG_LV_FONT_MONTSERRAT_20 is not set -# CONFIG_LV_FONT_MONTSERRAT_22 is not set -# CONFIG_LV_FONT_MONTSERRAT_24 is not set -# CONFIG_LV_FONT_MONTSERRAT_26 is not set -# CONFIG_LV_FONT_MONTSERRAT_28 is not set -# CONFIG_LV_FONT_MONTSERRAT_30 is not set -# CONFIG_LV_FONT_MONTSERRAT_32 is not set -# CONFIG_LV_FONT_MONTSERRAT_34 is not set -# CONFIG_LV_FONT_MONTSERRAT_36 is not set -# CONFIG_LV_FONT_MONTSERRAT_38 is not set -# CONFIG_LV_FONT_MONTSERRAT_40 is not set -# CONFIG_LV_FONT_MONTSERRAT_42 is not set -# CONFIG_LV_FONT_MONTSERRAT_44 is not set -# CONFIG_LV_FONT_MONTSERRAT_46 is not set -# CONFIG_LV_FONT_MONTSERRAT_48 is not set -# CONFIG_LV_FONT_MONTSERRAT_28_COMPRESSED is not set -# CONFIG_LV_FONT_DEJAVU_16_PERSIAN_HEBREW is not set -# CONFIG_LV_FONT_SOURCE_HAN_SANS_SC_14_CJK is not set -# CONFIG_LV_FONT_SOURCE_HAN_SANS_SC_16_CJK is not set -# CONFIG_LV_FONT_UNSCII_8 is not set -# CONFIG_LV_FONT_UNSCII_16 is not set -# end of Enable built-in fonts - -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_8 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_10 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_12 is not set -CONFIG_LV_FONT_DEFAULT_MONTSERRAT_14=y -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_16 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_18 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_20 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_22 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_24 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_26 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_28 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_30 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_32 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_34 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_36 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_38 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_40 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_42 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_44 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_46 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_48 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_28_COMPRESSED is not set -# CONFIG_LV_FONT_DEFAULT_DEJAVU_16_PERSIAN_HEBREW is not set -# CONFIG_LV_FONT_DEFAULT_SOURCE_HAN_SANS_SC_14_CJK is not set -# CONFIG_LV_FONT_DEFAULT_SOURCE_HAN_SANS_SC_16_CJK is not set -# CONFIG_LV_FONT_DEFAULT_UNSCII_8 is not set -# CONFIG_LV_FONT_DEFAULT_UNSCII_16 is not set -# CONFIG_LV_FONT_FMT_TXT_LARGE is not set -# CONFIG_LV_USE_FONT_COMPRESSED is not set -CONFIG_LV_USE_FONT_PLACEHOLDER=y - -# -# Enable static fonts -# -# end of Enable static fonts -# end of Font Usage - -# -# Text Settings -# -CONFIG_LV_TXT_ENC_UTF8=y -# CONFIG_LV_TXT_ENC_ASCII is not set -CONFIG_LV_TXT_BREAK_CHARS=" ,.;:-_)}" -CONFIG_LV_TXT_LINE_BREAK_LONG_LEN=0 -CONFIG_LV_TXT_COLOR_CMD="#" -# CONFIG_LV_USE_BIDI is not set -# CONFIG_LV_USE_ARABIC_PERSIAN_CHARS is not set -# end of Text Settings - -# -# Widget Usage -# -CONFIG_LV_WIDGETS_HAS_DEFAULT_VALUE=y -CONFIG_LV_USE_ANIMIMG=y -CONFIG_LV_USE_ARC=y -CONFIG_LV_USE_ARCLABEL=y -CONFIG_LV_USE_BAR=y -CONFIG_LV_USE_BUTTON=y -CONFIG_LV_USE_BUTTONMATRIX=y -CONFIG_LV_USE_CALENDAR=y -# CONFIG_LV_CALENDAR_WEEK_STARTS_MONDAY is not set - -# -# Days name configuration -# -CONFIG_LV_MONDAY_STR="Mo" -CONFIG_LV_TUESDAY_STR="Tu" -CONFIG_LV_WEDNESDAY_STR="We" -CONFIG_LV_THURSDAY_STR="Th" -CONFIG_LV_FRIDAY_STR="Fr" -CONFIG_LV_SATURDAY_STR="Sa" -CONFIG_LV_SUNDAY_STR="Su" -# end of Days name configuration - -CONFIG_LV_USE_CALENDAR_HEADER_ARROW=y -CONFIG_LV_USE_CALENDAR_HEADER_DROPDOWN=y -# CONFIG_LV_USE_CALENDAR_CHINESE is not set -CONFIG_LV_USE_CANVAS=y -CONFIG_LV_USE_CHART=y -CONFIG_LV_USE_CHECKBOX=y -CONFIG_LV_USE_DROPDOWN=y -CONFIG_LV_USE_IMAGE=y -CONFIG_LV_USE_IMAGEBUTTON=y -CONFIG_LV_USE_KEYBOARD=y -CONFIG_LV_USE_LABEL=y -CONFIG_LV_LABEL_TEXT_SELECTION=y -CONFIG_LV_LABEL_LONG_TXT_HINT=y -CONFIG_LV_LABEL_WAIT_CHAR_COUNT=3 -CONFIG_LV_USE_LED=y -CONFIG_LV_USE_LINE=y -CONFIG_LV_USE_LIST=y -CONFIG_LV_USE_MENU=y -CONFIG_LV_USE_MSGBOX=y -CONFIG_LV_USE_ROLLER=y -CONFIG_LV_USE_SCALE=y -CONFIG_LV_USE_SLIDER=y -CONFIG_LV_USE_SPAN=y -CONFIG_LV_SPAN_SNIPPET_STACK_SIZE=64 -CONFIG_LV_USE_SPINBOX=y -CONFIG_LV_USE_SPINNER=y -CONFIG_LV_USE_SWITCH=y -CONFIG_LV_USE_TEXTAREA=y -CONFIG_LV_TEXTAREA_DEF_PWD_SHOW_TIME=1500 -CONFIG_LV_USE_TABLE=y -CONFIG_LV_USE_TABVIEW=y -CONFIG_LV_USE_TILEVIEW=y -CONFIG_LV_USE_WIN=y -# end of Widget Usage - -# -# Themes -# -CONFIG_LV_USE_THEME_DEFAULT=y -# CONFIG_LV_THEME_DEFAULT_DARK is not set -CONFIG_LV_THEME_DEFAULT_GROW=y -CONFIG_LV_THEME_DEFAULT_TRANSITION_TIME=80 -CONFIG_LV_USE_THEME_SIMPLE=y -# CONFIG_LV_USE_THEME_MONO is not set -# end of Themes - -# -# Layouts -# -CONFIG_LV_USE_FLEX=y -CONFIG_LV_USE_GRID=y -# end of Layouts - -# -# 3rd Party Libraries -# -CONFIG_LV_FS_DEFAULT_DRIVER_LETTER=65 -CONFIG_LV_USE_FS_STDIO=y -CONFIG_LV_FS_STDIO_LETTER=65 -CONFIG_LV_FS_STDIO_PATH="/assets" -CONFIG_LV_FS_STDIO_CACHE_SIZE=4096 -# CONFIG_LV_USE_FS_POSIX is not set -# CONFIG_LV_USE_FS_WIN32 is not set -# CONFIG_LV_USE_FS_FATFS is not set -# CONFIG_LV_USE_FS_MEMFS is not set -# CONFIG_LV_USE_FS_LITTLEFS is not set -# CONFIG_LV_USE_FS_ARDUINO_ESP_LITTLEFS is not set -# CONFIG_LV_USE_FS_ARDUINO_SD is not set -# CONFIG_LV_USE_FS_UEFI is not set -# CONFIG_LV_USE_FS_FROGFS is not set -CONFIG_LV_USE_LODEPNG=y -# CONFIG_LV_USE_LIBPNG is not set -# CONFIG_LV_USE_BMP is not set -# CONFIG_LV_USE_TJPGD is not set -# CONFIG_LV_USE_LIBJPEG_TURBO is not set -# CONFIG_LV_USE_LIBWEBP is not set -# CONFIG_LV_USE_GIF is not set -# CONFIG_LV_BIN_DECODER_RAM_LOAD is not set -# CONFIG_LV_USE_RLE is not set -# CONFIG_LV_USE_QRCODE is not set -# CONFIG_LV_USE_BARCODE is not set -# CONFIG_LV_USE_FREETYPE is not set -# CONFIG_LV_USE_TINY_TTF is not set -# CONFIG_LV_USE_RLOTTIE is not set -# CONFIG_LV_USE_THORVG is not set -# CONFIG_LV_USE_NANOVG is not set -# CONFIG_LV_USE_LZ4 is not set -# CONFIG_LV_USE_FFMPEG is not set -# end of 3rd Party Libraries - -# -# Others -# -# CONFIG_LV_USE_SNAPSHOT is not set -# CONFIG_LV_USE_SYSMON is not set -# CONFIG_LV_USE_PROFILER is not set -# CONFIG_LV_USE_MONKEY is not set -# CONFIG_LV_USE_GRIDNAV is not set -# CONFIG_LV_USE_FRAGMENT is not set -# CONFIG_LV_USE_IMGFONT is not set -CONFIG_LV_USE_OBSERVER=y -# CONFIG_LV_USE_IME_PINYIN is not set -# CONFIG_LV_USE_FILE_EXPLORER is not set -# CONFIG_LV_USE_FONT_MANAGER is not set -# CONFIG_LV_USE_TEST is not set -# CONFIG_LV_USE_TRANSLATION is not set -# CONFIG_LV_USE_COLOR_FILTER is not set -CONFIG_LVGL_VERSION_MAJOR=9 -CONFIG_LVGL_VERSION_MINOR=5 -CONFIG_LVGL_VERSION_PATCH=0 -# end of Others - -# -# Devices -# -# CONFIG_LV_USE_SDL is not set -# CONFIG_LV_USE_X11 is not set -# CONFIG_LV_USE_WAYLAND is not set -# CONFIG_LV_USE_LINUX_FBDEV is not set -# CONFIG_LV_USE_NUTTX is not set -# CONFIG_LV_USE_LINUX_DRM is not set -# CONFIG_LV_USE_TFT_ESPI is not set -# CONFIG_LV_USE_LOVYAN_GFX is not set -# CONFIG_LV_USE_EVDEV is not set -# CONFIG_LV_USE_LIBINPUT is not set -# CONFIG_LV_USE_ST7735 is not set -# CONFIG_LV_USE_ST7789 is not set -# CONFIG_LV_USE_ST7796 is not set -# CONFIG_LV_USE_ILI9341 is not set -# CONFIG_LV_USE_GENERIC_MIPI is not set -# CONFIG_LV_USE_NXP_ELCDIF is not set -# CONFIG_LV_USE_RENESAS_GLCDC is not set -# CONFIG_LV_USE_ST_LTDC is not set -# CONFIG_LV_USE_FT81X is not set -# CONFIG_LV_USE_UEFI is not set -# CONFIG_LV_USE_QNX is not set -# end of Devices - -# -# Examples -# -CONFIG_LV_BUILD_EXAMPLES=y -# end of Examples - -# -# Demos -# -CONFIG_LV_BUILD_DEMOS=y -# CONFIG_LV_USE_DEMO_WIDGETS is not set -# CONFIG_LV_USE_DEMO_KEYPAD_AND_ENCODER is not set -# CONFIG_LV_USE_DEMO_BENCHMARK is not set -# CONFIG_LV_USE_DEMO_RENDER is not set -# CONFIG_LV_USE_DEMO_STRESS is not set -# CONFIG_LV_USE_DEMO_MUSIC is not set -# CONFIG_LV_USE_DEMO_FLEX_LAYOUT is not set -# CONFIG_LV_USE_DEMO_MULTILANG is not set -# CONFIG_LV_USE_DEMO_SMARTWATCH is not set -# CONFIG_LV_USE_DEMO_EBIKE is not set -# CONFIG_LV_USE_DEMO_HIGH_RES is not set -# end of Demos -# end of LVGL configuration -# end of Component config - -# CONFIG_IDF_EXPERIMENTAL_FEATURES is not set - -# Deprecated options for backward compatibility -# CONFIG_APP_BUILD_TYPE_ELF_RAM is not set -# CONFIG_NO_BLOBS is not set -# CONFIG_APP_ROLLBACK_ENABLE is not set -# CONFIG_LOG_BOOTLOADER_LEVEL_NONE is not set -# CONFIG_LOG_BOOTLOADER_LEVEL_ERROR is not set -# CONFIG_LOG_BOOTLOADER_LEVEL_WARN is not set -CONFIG_LOG_BOOTLOADER_LEVEL_INFO=y -# CONFIG_LOG_BOOTLOADER_LEVEL_DEBUG is not set -# CONFIG_LOG_BOOTLOADER_LEVEL_VERBOSE is not set -CONFIG_LOG_BOOTLOADER_LEVEL=3 -# CONFIG_FLASH_ENCRYPTION_ENABLED is not set -# CONFIG_FLASHMODE_QIO is not set -# CONFIG_FLASHMODE_QOUT is not set -CONFIG_FLASHMODE_DIO=y -# CONFIG_FLASHMODE_DOUT is not set -CONFIG_MONITOR_BAUD=115200 -CONFIG_OPTIMIZATION_LEVEL_DEBUG=y -CONFIG_COMPILER_OPTIMIZATION_LEVEL_DEBUG=y -CONFIG_COMPILER_OPTIMIZATION_DEFAULT=y -# CONFIG_OPTIMIZATION_LEVEL_RELEASE is not set -# CONFIG_COMPILER_OPTIMIZATION_LEVEL_RELEASE is not set -CONFIG_OPTIMIZATION_ASSERTIONS_ENABLED=y -# CONFIG_OPTIMIZATION_ASSERTIONS_SILENT is not set -# CONFIG_OPTIMIZATION_ASSERTIONS_DISABLED is not set -CONFIG_OPTIMIZATION_ASSERTION_LEVEL=2 -# CONFIG_CXX_EXCEPTIONS is not set -CONFIG_STACK_CHECK_NONE=y -# CONFIG_STACK_CHECK_NORM is not set -# CONFIG_STACK_CHECK_STRONG is not set -# CONFIG_STACK_CHECK_ALL is not set -# CONFIG_WARN_WRITE_STRINGS is not set -# CONFIG_ESP32_APPTRACE_DEST_TRAX is not set -CONFIG_ESP32_APPTRACE_DEST_NONE=y -CONFIG_ESP32_APPTRACE_LOCK_ENABLE=y -# CONFIG_BLUEDROID_ENABLED is not set -CONFIG_NIMBLE_ENABLED=y -CONFIG_NIMBLE_MEM_ALLOC_MODE_INTERNAL=y -# CONFIG_NIMBLE_MEM_ALLOC_MODE_EXTERNAL is not set -# CONFIG_NIMBLE_MEM_ALLOC_MODE_DEFAULT is not set -CONFIG_NIMBLE_PINNED_TO_CORE=0 -CONFIG_NIMBLE_TASK_STACK_SIZE=4096 -CONFIG_BT_NIMBLE_TASK_STACK_SIZE=4096 -CONFIG_NIMBLE_ROLE_CENTRAL=y -CONFIG_NIMBLE_ROLE_PERIPHERAL=y -CONFIG_NIMBLE_ROLE_BROADCASTER=y -CONFIG_NIMBLE_ROLE_OBSERVER=y -CONFIG_NIMBLE_SM_LEGACY=y -CONFIG_NIMBLE_SM_SC=y -# CONFIG_NIMBLE_SM_SC_DEBUG_KEYS is not set -CONFIG_BT_NIMBLE_SM_SC_LVL=0 -# CONFIG_NIMBLE_NVS_PERSIST is not set -CONFIG_NIMBLE_MAX_BONDS=3 -CONFIG_NIMBLE_RPA_TIMEOUT=900 -CONFIG_NIMBLE_MAX_CONNECTIONS=3 -CONFIG_NIMBLE_MAX_CCCDS=8 -CONFIG_NIMBLE_CRYPTO_STACK_MBEDTLS=y -CONFIG_NIMBLE_ATT_PREFERRED_MTU=256 -CONFIG_NIMBLE_L2CAP_COC_MAX_NUM=0 -CONFIG_BT_NIMBLE_MSYS1_BLOCK_COUNT=12 -CONFIG_BT_NIMBLE_ACL_BUF_COUNT=24 -CONFIG_BT_NIMBLE_ACL_BUF_SIZE=255 -CONFIG_BT_NIMBLE_HCI_EVT_BUF_SIZE=70 -CONFIG_BT_NIMBLE_HCI_EVT_HI_BUF_COUNT=30 -CONFIG_BT_NIMBLE_HCI_EVT_LO_BUF_COUNT=8 -CONFIG_NIMBLE_SVC_GAP_DEVICE_NAME="nimble" -CONFIG_NIMBLE_GAP_DEVICE_NAME_MAX_LEN=31 -CONFIG_NIMBLE_SVC_GAP_APPEARANCE=0 -# CONFIG_NIMBLE_MESH is not set -# CONFIG_NIMBLE_DEBUG is not set -# CONFIG_BT_NIMBLE_COEX_PHY_CODED_TX_RX_TLIM_EN is not set -CONFIG_BT_NIMBLE_COEX_PHY_CODED_TX_RX_TLIM_DIS=y -CONFIG_SW_COEXIST_ENABLE=y -CONFIG_ESP32_WIFI_SW_COEXIST_ENABLE=y -CONFIG_ESP_WIFI_SW_COEXIST_ENABLE=y -# CONFIG_ANA_CMPR_ISR_IRAM_SAFE is not set -# CONFIG_GPTIMER_ISR_IRAM_SAFE is not set -# CONFIG_MCPWM_ISR_IRAM_SAFE is not set -# CONFIG_EVENT_LOOP_PROFILING is not set -CONFIG_POST_EVENTS_FROM_ISR=y -CONFIG_POST_EVENTS_FROM_IRAM_ISR=y -CONFIG_GDBSTUB_SUPPORT_TASKS=y -CONFIG_GDBSTUB_MAX_TASKS=32 -# CONFIG_OTA_ALLOW_HTTP is not set -CONFIG_PERIPH_CTRL_FUNC_IN_IRAM=y -CONFIG_BROWNOUT_DET=y -CONFIG_BROWNOUT_DET_LVL_SEL_7=y -# CONFIG_BROWNOUT_DET_LVL_SEL_6 is not set -# CONFIG_BROWNOUT_DET_LVL_SEL_5 is not set -# CONFIG_BROWNOUT_DET_LVL_SEL_4 is not set -# CONFIG_BROWNOUT_DET_LVL_SEL_3 is not set -# CONFIG_BROWNOUT_DET_LVL_SEL_2 is not set -CONFIG_BROWNOUT_DET_LVL=7 -CONFIG_ESP_SYSTEM_BROWNOUT_INTR=y -CONFIG_ESP32_PHY_CALIBRATION_AND_DATA_STORAGE=y -# CONFIG_ESP32_PHY_INIT_DATA_IN_PARTITION is not set -CONFIG_ESP32_PHY_MAX_WIFI_TX_POWER=20 -CONFIG_ESP32_PHY_MAX_TX_POWER=20 -# CONFIG_REDUCE_PHY_TX_POWER is not set -# CONFIG_ESP32_REDUCE_PHY_TX_POWER is not set -CONFIG_ESP_SYSTEM_PM_POWER_DOWN_CPU=y -CONFIG_SYSTEM_EVENT_QUEUE_SIZE=32 -CONFIG_SYSTEM_EVENT_TASK_STACK_SIZE=2304 -CONFIG_MAIN_TASK_STACK_SIZE=8192 -# CONFIG_CONSOLE_UART_DEFAULT is not set -# CONFIG_CONSOLE_UART_CUSTOM is not set -# CONFIG_CONSOLE_UART_NONE is not set -# CONFIG_ESP_CONSOLE_UART_NONE is not set -CONFIG_CONSOLE_UART_NUM=-1 -CONFIG_INT_WDT=y -CONFIG_INT_WDT_TIMEOUT_MS=300 -CONFIG_TASK_WDT=y -CONFIG_ESP_TASK_WDT=y -# CONFIG_TASK_WDT_PANIC is not set -CONFIG_TASK_WDT_TIMEOUT_S=5 -CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU0=y -# CONFIG_ESP32_DEBUG_STUBS_ENABLE is not set -CONFIG_IPC_TASK_STACK_SIZE=1280 -CONFIG_TIMER_TASK_STACK_SIZE=3584 -CONFIG_ESP32_WIFI_ENABLED=y -CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM=10 -CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM=32 -# CONFIG_ESP32_WIFI_STATIC_TX_BUFFER is not set -CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER=y -CONFIG_ESP32_WIFI_TX_BUFFER_TYPE=1 -CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER_NUM=32 -# CONFIG_ESP32_WIFI_CSI_ENABLED is not set -CONFIG_ESP32_WIFI_AMPDU_TX_ENABLED=y -CONFIG_ESP32_WIFI_TX_BA_WIN=6 -CONFIG_ESP32_WIFI_AMPDU_RX_ENABLED=y -CONFIG_ESP32_WIFI_RX_BA_WIN=6 -CONFIG_ESP32_WIFI_NVS_ENABLED=y -CONFIG_ESP32_WIFI_SOFTAP_BEACON_MAX_LEN=752 -CONFIG_ESP32_WIFI_MGMT_SBUF_NUM=32 -CONFIG_ESP32_WIFI_IRAM_OPT=y -CONFIG_ESP32_WIFI_RX_IRAM_OPT=y -CONFIG_ESP32_WIFI_ENABLE_WPA3_SAE=y -CONFIG_ESP32_WIFI_ENABLE_WPA3_OWE_STA=y -CONFIG_WPA_MBEDTLS_CRYPTO=y -CONFIG_WPA_MBEDTLS_TLS_CLIENT=y -# CONFIG_WPA_WAPI_PSK is not set -# CONFIG_WPA_SUITE_B_192 is not set -# CONFIG_WPA_11KV_SUPPORT is not set -# CONFIG_WPA_MBO_SUPPORT is not set -# CONFIG_WPA_DPP_SUPPORT is not set -# CONFIG_WPA_11R_SUPPORT is not set -# CONFIG_WPA_WPS_SOFTAP_REGISTRAR is not set -# CONFIG_WPA_WPS_STRICT is not set -# CONFIG_WPA_DEBUG_PRINT is not set -# CONFIG_ESP32_ENABLE_COREDUMP_TO_FLASH is not set -# CONFIG_ESP32_ENABLE_COREDUMP_TO_UART is not set -CONFIG_ESP32_ENABLE_COREDUMP_TO_NONE=y -CONFIG_TIMER_TASK_PRIORITY=1 -CONFIG_TIMER_TASK_STACK_DEPTH=2048 -CONFIG_TIMER_QUEUE_LENGTH=10 -# CONFIG_ENABLE_STATIC_TASK_CLEAN_UP_HOOK is not set -CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY=y -# CONFIG_HAL_ASSERTION_SILIENT is not set -# CONFIG_L2_TO_L3_COPY is not set -CONFIG_ESP_GRATUITOUS_ARP=y -CONFIG_GARP_TMR_INTERVAL=60 -CONFIG_TCPIP_RECVMBOX_SIZE=32 -CONFIG_TCP_MAXRTX=12 -CONFIG_TCP_SYNMAXRTX=12 -CONFIG_TCP_MSS=1440 -CONFIG_TCP_MSL=60000 -CONFIG_TCP_SND_BUF_DEFAULT=5760 -CONFIG_TCP_WND_DEFAULT=5760 -CONFIG_TCP_RECVMBOX_SIZE=6 -CONFIG_TCP_QUEUE_OOSEQ=y -CONFIG_TCP_OVERSIZE_MSS=y -# CONFIG_TCP_OVERSIZE_QUARTER_MSS is not set -# CONFIG_TCP_OVERSIZE_DISABLE is not set -CONFIG_UDP_RECVMBOX_SIZE=6 -CONFIG_TCPIP_TASK_STACK_SIZE=3072 -CONFIG_TCPIP_TASK_AFFINITY_NO_AFFINITY=y -# CONFIG_TCPIP_TASK_AFFINITY_CPU0 is not set -CONFIG_TCPIP_TASK_AFFINITY=0x7FFFFFFF -# CONFIG_PPP_SUPPORT is not set -CONFIG_NEWLIB_STDOUT_LINE_ENDING_CRLF=y -# CONFIG_NEWLIB_STDOUT_LINE_ENDING_LF is not set -# CONFIG_NEWLIB_STDOUT_LINE_ENDING_CR is not set -# CONFIG_NEWLIB_STDIN_LINE_ENDING_CRLF is not set -# CONFIG_NEWLIB_STDIN_LINE_ENDING_LF is not set -CONFIG_NEWLIB_STDIN_LINE_ENDING_CR=y -# CONFIG_NEWLIB_NANO_FORMAT is not set -CONFIG_NEWLIB_TIME_SYSCALL_USE_RTC_HRT=y -# CONFIG_NEWLIB_TIME_SYSCALL_USE_RTC is not set -# CONFIG_NEWLIB_TIME_SYSCALL_USE_HRT is not set -# CONFIG_NEWLIB_TIME_SYSCALL_USE_NONE is not set -CONFIG_ESP32_PTHREAD_TASK_PRIO_DEFAULT=5 -CONFIG_ESP32_PTHREAD_TASK_STACK_SIZE_DEFAULT=3072 -CONFIG_ESP32_PTHREAD_STACK_MIN=768 -CONFIG_ESP32_PTHREAD_TASK_CORE_DEFAULT=-1 -CONFIG_ESP32_PTHREAD_TASK_NAME_DEFAULT="pthread" -CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ABORTS=y -# CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_FAILS is not set -# CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ALLOWED is not set -CONFIG_SUPPRESS_SELECT_DEBUG_OUTPUT=y -CONFIG_SUPPORT_TERMIOS=y -CONFIG_SEMIHOSTFS_MAX_MOUNT_POINTS=1 -# End of deprecated options diff --git a/firmware_c5/sdkconfig.defaults b/firmware_c5/sdkconfig.defaults new file mode 100644 index 00000000..400833c4 --- /dev/null +++ b/firmware_c5/sdkconfig.defaults @@ -0,0 +1,44 @@ +# Flash — 8MB, 80MHz, DIO. NO_STUB required for C5 chip support in esptool. +CONFIG_ESPTOOLPY_FLASHSIZE_8MB=y +CONFIG_ESPTOOLPY_FLASHFREQ_80M=y +CONFIG_ESPTOOLPY_FLASHMODE_DIO=y +CONFIG_ESPTOOLPY_NO_STUB=y + +# Custom partition table +CONFIG_PARTITION_TABLE_CUSTOM=y +CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv" + +# CPU 240MHz (C5 default is 160MHz) +CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y + +# Single-core — C5 is unicore; without this FreeRTOS tries to start core 1 +CONFIG_FREERTOS_UNICORE=y +CONFIG_ESP_SYSTEM_SINGLE_CORE_MODE=y + +# PSRAM quad, 40MHz +CONFIG_SPIRAM=y +CONFIG_SPIRAM_MODE_QUAD=y +CONFIG_SPIRAM_SPEED_40M=y +CONFIG_SPIRAM_USE_MALLOC=y +CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=16384 +CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL=32768 + +# Larger stack for kernel_init +CONFIG_ESP_MAIN_TASK_STACK_SIZE=8192 + +# Console via UART0 (CH340 on C5 devkit: GPIO11/12) +CONFIG_ESP_CONSOLE_UART_DEFAULT=y +CONFIG_ESP_CONSOLE_SECONDARY_NONE=y + +# Bluetooth NimBLE +CONFIG_BT_ENABLED=y +CONFIG_BT_NIMBLE_ENABLED=y +CONFIG_BT_CONTROLLER_ENABLED=y + +# Default log level INFO +CONFIG_LOG_DEFAULT_LEVEL_INFO=y +CONFIG_BOOTLOADER_LOG_VERSION_1=y + +# Required for sys_monitor (uxTaskGetSystemState / vTaskList) +CONFIG_FREERTOS_USE_TRACE_FACILITY=y +CONFIG_FREERTOS_USE_STATS_FORMATTING_FUNCTIONS=y diff --git a/firmware_c5/sdkconfig.old b/firmware_c5/sdkconfig.old deleted file mode 100644 index 2e4217c4..00000000 --- a/firmware_c5/sdkconfig.old +++ /dev/null @@ -1,3122 +0,0 @@ -# -# Automatically generated file. DO NOT EDIT. -# Espressif IoT Development Framework (ESP-IDF) 5.5.1 Project Configuration -# -CONFIG_SOC_ADC_SUPPORTED=y -CONFIG_SOC_UART_SUPPORTED=y -CONFIG_SOC_PCNT_SUPPORTED=y -CONFIG_SOC_PHY_SUPPORTED=y -CONFIG_SOC_WIFI_SUPPORTED=y -CONFIG_SOC_TWAI_SUPPORTED=y -CONFIG_SOC_GDMA_SUPPORTED=y -CONFIG_SOC_UHCI_SUPPORTED=y -CONFIG_SOC_AHB_GDMA_SUPPORTED=y -CONFIG_SOC_GPTIMER_SUPPORTED=y -CONFIG_SOC_LCDCAM_SUPPORTED=y -CONFIG_SOC_LCDCAM_CAM_SUPPORTED=y -CONFIG_SOC_LCDCAM_I80_LCD_SUPPORTED=y -CONFIG_SOC_LCDCAM_RGB_LCD_SUPPORTED=y -CONFIG_SOC_MCPWM_SUPPORTED=y -CONFIG_SOC_DEDICATED_GPIO_SUPPORTED=y -CONFIG_SOC_CACHE_SUPPORT_WRAP=y -CONFIG_SOC_ULP_SUPPORTED=y -CONFIG_SOC_ULP_FSM_SUPPORTED=y -CONFIG_SOC_RISCV_COPROC_SUPPORTED=y -CONFIG_SOC_BT_SUPPORTED=y -CONFIG_SOC_USB_OTG_SUPPORTED=y -CONFIG_SOC_USB_SERIAL_JTAG_SUPPORTED=y -CONFIG_SOC_CCOMP_TIMER_SUPPORTED=y -CONFIG_SOC_ASYNC_MEMCPY_SUPPORTED=y -CONFIG_SOC_SUPPORTS_SECURE_DL_MODE=y -CONFIG_SOC_EFUSE_KEY_PURPOSE_FIELD=y -CONFIG_SOC_EFUSE_SUPPORTED=y -CONFIG_SOC_SDMMC_HOST_SUPPORTED=y -CONFIG_SOC_RTC_FAST_MEM_SUPPORTED=y -CONFIG_SOC_RTC_SLOW_MEM_SUPPORTED=y -CONFIG_SOC_RTC_MEM_SUPPORTED=y -CONFIG_SOC_PSRAM_DMA_CAPABLE=y -CONFIG_SOC_XT_WDT_SUPPORTED=y -CONFIG_SOC_I2S_SUPPORTED=y -CONFIG_SOC_RMT_SUPPORTED=y -CONFIG_SOC_SDM_SUPPORTED=y -CONFIG_SOC_GPSPI_SUPPORTED=y -CONFIG_SOC_LEDC_SUPPORTED=y -CONFIG_SOC_I2C_SUPPORTED=y -CONFIG_SOC_SYSTIMER_SUPPORTED=y -CONFIG_SOC_SUPPORT_COEXISTENCE=y -CONFIG_SOC_TEMP_SENSOR_SUPPORTED=y -CONFIG_SOC_AES_SUPPORTED=y -CONFIG_SOC_MPI_SUPPORTED=y -CONFIG_SOC_SHA_SUPPORTED=y -CONFIG_SOC_HMAC_SUPPORTED=y -CONFIG_SOC_DIG_SIGN_SUPPORTED=y -CONFIG_SOC_FLASH_ENC_SUPPORTED=y -CONFIG_SOC_SECURE_BOOT_SUPPORTED=y -CONFIG_SOC_MEMPROT_SUPPORTED=y -CONFIG_SOC_TOUCH_SENSOR_SUPPORTED=y -CONFIG_SOC_BOD_SUPPORTED=y -CONFIG_SOC_CLK_TREE_SUPPORTED=y -CONFIG_SOC_MPU_SUPPORTED=y -CONFIG_SOC_WDT_SUPPORTED=y -CONFIG_SOC_SPI_FLASH_SUPPORTED=y -CONFIG_SOC_RNG_SUPPORTED=y -CONFIG_SOC_LIGHT_SLEEP_SUPPORTED=y -CONFIG_SOC_DEEP_SLEEP_SUPPORTED=y -CONFIG_SOC_LP_PERIPH_SHARE_INTERRUPT=y -CONFIG_SOC_PM_SUPPORTED=y -CONFIG_SOC_SIMD_INSTRUCTION_SUPPORTED=y -CONFIG_SOC_XTAL_SUPPORT_40M=y -CONFIG_SOC_APPCPU_HAS_CLOCK_GATING_BUG=y -CONFIG_SOC_ADC_RTC_CTRL_SUPPORTED=y -CONFIG_SOC_ADC_DIG_CTRL_SUPPORTED=y -CONFIG_SOC_ADC_ARBITER_SUPPORTED=y -CONFIG_SOC_ADC_DIG_IIR_FILTER_SUPPORTED=y -CONFIG_SOC_ADC_MONITOR_SUPPORTED=y -CONFIG_SOC_ADC_DMA_SUPPORTED=y -CONFIG_SOC_ADC_PERIPH_NUM=2 -CONFIG_SOC_ADC_MAX_CHANNEL_NUM=10 -CONFIG_SOC_ADC_ATTEN_NUM=4 -CONFIG_SOC_ADC_DIGI_CONTROLLER_NUM=2 -CONFIG_SOC_ADC_PATT_LEN_MAX=24 -CONFIG_SOC_ADC_DIGI_MIN_BITWIDTH=12 -CONFIG_SOC_ADC_DIGI_MAX_BITWIDTH=12 -CONFIG_SOC_ADC_DIGI_RESULT_BYTES=4 -CONFIG_SOC_ADC_DIGI_DATA_BYTES_PER_CONV=4 -CONFIG_SOC_ADC_DIGI_IIR_FILTER_NUM=2 -CONFIG_SOC_ADC_DIGI_MONITOR_NUM=2 -CONFIG_SOC_ADC_SAMPLE_FREQ_THRES_HIGH=83333 -CONFIG_SOC_ADC_SAMPLE_FREQ_THRES_LOW=611 -CONFIG_SOC_ADC_RTC_MIN_BITWIDTH=12 -CONFIG_SOC_ADC_RTC_MAX_BITWIDTH=12 -CONFIG_SOC_ADC_CALIBRATION_V1_SUPPORTED=y -CONFIG_SOC_ADC_SELF_HW_CALI_SUPPORTED=y -CONFIG_SOC_ADC_SHARED_POWER=y -CONFIG_SOC_APB_BACKUP_DMA=y -CONFIG_SOC_BROWNOUT_RESET_SUPPORTED=y -CONFIG_SOC_CACHE_WRITEBACK_SUPPORTED=y -CONFIG_SOC_CACHE_FREEZE_SUPPORTED=y -CONFIG_SOC_CACHE_ACS_INVALID_STATE_ON_PANIC=y -CONFIG_SOC_CPU_CORES_NUM=2 -CONFIG_SOC_CPU_INTR_NUM=32 -CONFIG_SOC_CPU_HAS_FPU=y -CONFIG_SOC_HP_CPU_HAS_MULTIPLE_CORES=y -CONFIG_SOC_CPU_BREAKPOINTS_NUM=2 -CONFIG_SOC_CPU_WATCHPOINTS_NUM=2 -CONFIG_SOC_CPU_WATCHPOINT_MAX_REGION_SIZE=0x40 -CONFIG_SOC_SIMD_PREFERRED_DATA_ALIGNMENT=16 -CONFIG_SOC_DS_SIGNATURE_MAX_BIT_LEN=4096 -CONFIG_SOC_DS_KEY_PARAM_MD_IV_LENGTH=16 -CONFIG_SOC_DS_KEY_CHECK_MAX_WAIT_US=1100 -CONFIG_SOC_AHB_GDMA_VERSION=1 -CONFIG_SOC_GDMA_NUM_GROUPS_MAX=1 -CONFIG_SOC_GDMA_PAIRS_PER_GROUP=5 -CONFIG_SOC_GDMA_PAIRS_PER_GROUP_MAX=5 -CONFIG_SOC_AHB_GDMA_SUPPORT_PSRAM=y -CONFIG_SOC_GPIO_PORT=1 -CONFIG_SOC_GPIO_PIN_COUNT=49 -CONFIG_SOC_GPIO_SUPPORT_PIN_GLITCH_FILTER=y -CONFIG_SOC_GPIO_FILTER_CLK_SUPPORT_APB=y -CONFIG_SOC_GPIO_SUPPORT_RTC_INDEPENDENT=y -CONFIG_SOC_GPIO_SUPPORT_FORCE_HOLD=y -CONFIG_SOC_GPIO_VALID_GPIO_MASK=0x1FFFFFFFFFFFF -CONFIG_SOC_GPIO_IN_RANGE_MAX=48 -CONFIG_SOC_GPIO_OUT_RANGE_MAX=48 -CONFIG_SOC_GPIO_VALID_DIGITAL_IO_PAD_MASK=0x0001FFFFFC000000 -CONFIG_SOC_GPIO_CLOCKOUT_BY_IO_MUX=y -CONFIG_SOC_GPIO_CLOCKOUT_CHANNEL_NUM=3 -CONFIG_SOC_GPIO_SUPPORT_HOLD_IO_IN_DSLP=y -CONFIG_SOC_DEDIC_GPIO_OUT_CHANNELS_NUM=8 -CONFIG_SOC_DEDIC_GPIO_IN_CHANNELS_NUM=8 -CONFIG_SOC_DEDIC_GPIO_OUT_AUTO_ENABLE=y -CONFIG_SOC_I2C_NUM=2 -CONFIG_SOC_HP_I2C_NUM=2 -CONFIG_SOC_I2C_FIFO_LEN=32 -CONFIG_SOC_I2C_CMD_REG_NUM=8 -CONFIG_SOC_I2C_SUPPORT_SLAVE=y -CONFIG_SOC_I2C_SUPPORT_HW_CLR_BUS=y -CONFIG_SOC_I2C_SUPPORT_XTAL=y -CONFIG_SOC_I2C_SUPPORT_RTC=y -CONFIG_SOC_I2C_SUPPORT_10BIT_ADDR=y -CONFIG_SOC_I2C_SLAVE_SUPPORT_BROADCAST=y -CONFIG_SOC_I2C_SLAVE_SUPPORT_I2CRAM_ACCESS=y -CONFIG_SOC_I2C_SLAVE_CAN_GET_STRETCH_CAUSE=y -CONFIG_SOC_I2S_NUM=2 -CONFIG_SOC_I2S_HW_VERSION_2=y -CONFIG_SOC_I2S_SUPPORTS_XTAL=y -CONFIG_SOC_I2S_SUPPORTS_PLL_F160M=y -CONFIG_SOC_I2S_SUPPORTS_PCM=y -CONFIG_SOC_I2S_SUPPORTS_PDM=y -CONFIG_SOC_I2S_SUPPORTS_PDM_TX=y -CONFIG_SOC_I2S_SUPPORTS_PCM2PDM=y -CONFIG_SOC_I2S_SUPPORTS_PDM_RX=y -CONFIG_SOC_I2S_SUPPORTS_PDM2PCM=y -CONFIG_SOC_I2S_PDM_MAX_TX_LINES=2 -CONFIG_SOC_I2S_PDM_MAX_RX_LINES=4 -CONFIG_SOC_I2S_SUPPORTS_TDM=y -CONFIG_SOC_LEDC_SUPPORT_APB_CLOCK=y -CONFIG_SOC_LEDC_SUPPORT_XTAL_CLOCK=y -CONFIG_SOC_LEDC_TIMER_NUM=4 -CONFIG_SOC_LEDC_CHANNEL_NUM=8 -CONFIG_SOC_LEDC_TIMER_BIT_WIDTH=14 -CONFIG_SOC_LEDC_SUPPORT_FADE_STOP=y -CONFIG_SOC_MCPWM_GROUPS=2 -CONFIG_SOC_MCPWM_TIMERS_PER_GROUP=3 -CONFIG_SOC_MCPWM_OPERATORS_PER_GROUP=3 -CONFIG_SOC_MCPWM_COMPARATORS_PER_OPERATOR=2 -CONFIG_SOC_MCPWM_GENERATORS_PER_OPERATOR=2 -CONFIG_SOC_MCPWM_TRIGGERS_PER_OPERATOR=2 -CONFIG_SOC_MCPWM_GPIO_FAULTS_PER_GROUP=3 -CONFIG_SOC_MCPWM_CAPTURE_TIMERS_PER_GROUP=y -CONFIG_SOC_MCPWM_CAPTURE_CHANNELS_PER_TIMER=3 -CONFIG_SOC_MCPWM_GPIO_SYNCHROS_PER_GROUP=3 -CONFIG_SOC_MCPWM_SWSYNC_CAN_PROPAGATE=y -CONFIG_SOC_MMU_LINEAR_ADDRESS_REGION_NUM=1 -CONFIG_SOC_MMU_PERIPH_NUM=1 -CONFIG_SOC_MPU_MIN_REGION_SIZE=0x20000000 -CONFIG_SOC_MPU_REGIONS_MAX_NUM=8 -CONFIG_SOC_PCNT_GROUPS=1 -CONFIG_SOC_PCNT_UNITS_PER_GROUP=4 -CONFIG_SOC_PCNT_CHANNELS_PER_UNIT=2 -CONFIG_SOC_PCNT_THRES_POINT_PER_UNIT=2 -CONFIG_SOC_RMT_GROUPS=1 -CONFIG_SOC_RMT_TX_CANDIDATES_PER_GROUP=4 -CONFIG_SOC_RMT_RX_CANDIDATES_PER_GROUP=4 -CONFIG_SOC_RMT_CHANNELS_PER_GROUP=8 -CONFIG_SOC_RMT_MEM_WORDS_PER_CHANNEL=48 -CONFIG_SOC_RMT_SUPPORT_RX_PINGPONG=y -CONFIG_SOC_RMT_SUPPORT_RX_DEMODULATION=y -CONFIG_SOC_RMT_SUPPORT_TX_ASYNC_STOP=y -CONFIG_SOC_RMT_SUPPORT_TX_LOOP_COUNT=y -CONFIG_SOC_RMT_SUPPORT_TX_LOOP_AUTO_STOP=y -CONFIG_SOC_RMT_SUPPORT_TX_SYNCHRO=y -CONFIG_SOC_RMT_SUPPORT_TX_CARRIER_DATA_ONLY=y -CONFIG_SOC_RMT_SUPPORT_XTAL=y -CONFIG_SOC_RMT_SUPPORT_RC_FAST=y -CONFIG_SOC_RMT_SUPPORT_APB=y -CONFIG_SOC_RMT_SUPPORT_DMA=y -CONFIG_SOC_LCD_I80_SUPPORTED=y -CONFIG_SOC_LCD_RGB_SUPPORTED=y -CONFIG_SOC_LCD_I80_BUSES=1 -CONFIG_SOC_LCD_RGB_PANELS=1 -CONFIG_SOC_LCD_I80_BUS_WIDTH=16 -CONFIG_SOC_LCD_RGB_DATA_WIDTH=16 -CONFIG_SOC_LCD_SUPPORT_RGB_YUV_CONV=y -CONFIG_SOC_LCDCAM_I80_NUM_BUSES=1 -CONFIG_SOC_LCDCAM_I80_BUS_WIDTH=16 -CONFIG_SOC_LCDCAM_RGB_NUM_PANELS=1 -CONFIG_SOC_LCDCAM_RGB_DATA_WIDTH=16 -CONFIG_SOC_RTC_CNTL_CPU_PD_DMA_BUS_WIDTH=128 -CONFIG_SOC_RTC_CNTL_CPU_PD_REG_FILE_NUM=549 -CONFIG_SOC_RTC_CNTL_TAGMEM_PD_DMA_BUS_WIDTH=128 -CONFIG_SOC_RTCIO_PIN_COUNT=22 -CONFIG_SOC_RTCIO_INPUT_OUTPUT_SUPPORTED=y -CONFIG_SOC_RTCIO_HOLD_SUPPORTED=y -CONFIG_SOC_RTCIO_WAKE_SUPPORTED=y -CONFIG_SOC_LP_IO_CLOCK_IS_INDEPENDENT=y -CONFIG_SOC_SDM_GROUPS=1 -CONFIG_SOC_SDM_CHANNELS_PER_GROUP=8 -CONFIG_SOC_SDM_CLK_SUPPORT_APB=y -CONFIG_SOC_SPI_PERIPH_NUM=3 -CONFIG_SOC_SPI_MAX_CS_NUM=6 -CONFIG_SOC_SPI_MAXIMUM_BUFFER_SIZE=64 -CONFIG_SOC_SPI_SUPPORT_DDRCLK=y -CONFIG_SOC_SPI_SLAVE_SUPPORT_SEG_TRANS=y -CONFIG_SOC_SPI_SUPPORT_CD_SIG=y -CONFIG_SOC_SPI_SUPPORT_CONTINUOUS_TRANS=y -CONFIG_SOC_SPI_SUPPORT_SLAVE_HD_VER2=y -CONFIG_SOC_SPI_SUPPORT_CLK_APB=y -CONFIG_SOC_SPI_SUPPORT_CLK_XTAL=y -CONFIG_SOC_SPI_PERIPH_SUPPORT_CONTROL_DUMMY_OUT=y -CONFIG_SOC_MEMSPI_IS_INDEPENDENT=y -CONFIG_SOC_SPI_MAX_PRE_DIVIDER=16 -CONFIG_SOC_SPI_SUPPORT_OCT=y -CONFIG_SOC_SPI_SCT_SUPPORTED=y -CONFIG_SOC_SPI_SCT_REG_NUM=14 -CONFIG_SOC_SPI_SCT_BUFFER_NUM_MAX=y -CONFIG_SOC_SPI_SCT_CONF_BITLEN_MAX=0x3FFFA -CONFIG_SOC_MEMSPI_SRC_FREQ_120M_SUPPORTED=y -CONFIG_SOC_MEMSPI_SRC_FREQ_80M_SUPPORTED=y -CONFIG_SOC_MEMSPI_SRC_FREQ_40M_SUPPORTED=y -CONFIG_SOC_MEMSPI_SRC_FREQ_20M_SUPPORTED=y -CONFIG_SOC_SPIRAM_SUPPORTED=y -CONFIG_SOC_SPIRAM_XIP_SUPPORTED=y -CONFIG_SOC_SYSTIMER_COUNTER_NUM=2 -CONFIG_SOC_SYSTIMER_ALARM_NUM=3 -CONFIG_SOC_SYSTIMER_BIT_WIDTH_LO=32 -CONFIG_SOC_SYSTIMER_BIT_WIDTH_HI=20 -CONFIG_SOC_SYSTIMER_FIXED_DIVIDER=y -CONFIG_SOC_SYSTIMER_INT_LEVEL=y -CONFIG_SOC_SYSTIMER_ALARM_MISS_COMPENSATE=y -CONFIG_SOC_TIMER_GROUPS=2 -CONFIG_SOC_TIMER_GROUP_TIMERS_PER_GROUP=2 -CONFIG_SOC_TIMER_GROUP_COUNTER_BIT_WIDTH=54 -CONFIG_SOC_TIMER_GROUP_SUPPORT_XTAL=y -CONFIG_SOC_TIMER_GROUP_SUPPORT_APB=y -CONFIG_SOC_TIMER_GROUP_TOTAL_TIMERS=4 -CONFIG_SOC_LP_TIMER_BIT_WIDTH_LO=32 -CONFIG_SOC_LP_TIMER_BIT_WIDTH_HI=16 -CONFIG_SOC_TOUCH_SENSOR_VERSION=2 -CONFIG_SOC_TOUCH_SENSOR_NUM=15 -CONFIG_SOC_TOUCH_MIN_CHAN_ID=1 -CONFIG_SOC_TOUCH_MAX_CHAN_ID=14 -CONFIG_SOC_TOUCH_SUPPORT_BENCHMARK=y -CONFIG_SOC_TOUCH_SUPPORT_SLEEP_WAKEUP=y -CONFIG_SOC_TOUCH_SUPPORT_WATERPROOF=y -CONFIG_SOC_TOUCH_SUPPORT_PROX_SENSING=y -CONFIG_SOC_TOUCH_SUPPORT_DENOISE_CHAN=y -CONFIG_SOC_TOUCH_PROXIMITY_CHANNEL_NUM=3 -CONFIG_SOC_TOUCH_PROXIMITY_MEAS_DONE_SUPPORTED=y -CONFIG_SOC_TOUCH_SAMPLE_CFG_NUM=1 -CONFIG_SOC_TWAI_CONTROLLER_NUM=1 -CONFIG_SOC_TWAI_MASK_FILTER_NUM=1 -CONFIG_SOC_TWAI_CLK_SUPPORT_APB=y -CONFIG_SOC_TWAI_BRP_MIN=2 -CONFIG_SOC_TWAI_BRP_MAX=16384 -CONFIG_SOC_TWAI_SUPPORTS_RX_STATUS=y -CONFIG_SOC_UART_NUM=3 -CONFIG_SOC_UART_HP_NUM=3 -CONFIG_SOC_UART_FIFO_LEN=128 -CONFIG_SOC_UART_BITRATE_MAX=5000000 -CONFIG_SOC_UART_SUPPORT_FSM_TX_WAIT_SEND=y -CONFIG_SOC_UART_SUPPORT_WAKEUP_INT=y -CONFIG_SOC_UART_SUPPORT_APB_CLK=y -CONFIG_SOC_UART_SUPPORT_RTC_CLK=y -CONFIG_SOC_UART_SUPPORT_XTAL_CLK=y -CONFIG_SOC_UART_WAKEUP_SUPPORT_ACTIVE_THRESH_MODE=y -CONFIG_SOC_UHCI_NUM=1 -CONFIG_SOC_USB_OTG_PERIPH_NUM=1 -CONFIG_SOC_SHA_DMA_MAX_BUFFER_SIZE=3968 -CONFIG_SOC_SHA_SUPPORT_DMA=y -CONFIG_SOC_SHA_SUPPORT_RESUME=y -CONFIG_SOC_SHA_GDMA=y -CONFIG_SOC_SHA_SUPPORT_SHA1=y -CONFIG_SOC_SHA_SUPPORT_SHA224=y -CONFIG_SOC_SHA_SUPPORT_SHA256=y -CONFIG_SOC_SHA_SUPPORT_SHA384=y -CONFIG_SOC_SHA_SUPPORT_SHA512=y -CONFIG_SOC_SHA_SUPPORT_SHA512_224=y -CONFIG_SOC_SHA_SUPPORT_SHA512_256=y -CONFIG_SOC_SHA_SUPPORT_SHA512_T=y -CONFIG_SOC_MPI_MEM_BLOCKS_NUM=4 -CONFIG_SOC_MPI_OPERATIONS_NUM=3 -CONFIG_SOC_RSA_MAX_BIT_LEN=4096 -CONFIG_SOC_AES_SUPPORT_DMA=y -CONFIG_SOC_AES_GDMA=y -CONFIG_SOC_AES_SUPPORT_AES_128=y -CONFIG_SOC_AES_SUPPORT_AES_256=y -CONFIG_SOC_PM_SUPPORT_EXT0_WAKEUP=y -CONFIG_SOC_PM_SUPPORT_EXT1_WAKEUP=y -CONFIG_SOC_PM_SUPPORT_EXT_WAKEUP=y -CONFIG_SOC_PM_SUPPORT_WIFI_WAKEUP=y -CONFIG_SOC_PM_SUPPORT_BT_WAKEUP=y -CONFIG_SOC_PM_SUPPORT_TOUCH_SENSOR_WAKEUP=y -CONFIG_SOC_PM_SUPPORT_CPU_PD=y -CONFIG_SOC_PM_SUPPORT_TAGMEM_PD=y -CONFIG_SOC_PM_SUPPORT_RTC_PERIPH_PD=y -CONFIG_SOC_PM_SUPPORT_RC_FAST_PD=y -CONFIG_SOC_PM_SUPPORT_VDDSDIO_PD=y -CONFIG_SOC_PM_SUPPORT_MAC_BB_PD=y -CONFIG_SOC_PM_SUPPORT_MODEM_PD=y -CONFIG_SOC_CONFIGURABLE_VDDSDIO_SUPPORTED=y -CONFIG_SOC_PM_SUPPORT_DEEPSLEEP_CHECK_STUB_ONLY=y -CONFIG_SOC_PM_CPU_RETENTION_BY_RTCCNTL=y -CONFIG_SOC_PM_MODEM_RETENTION_BY_BACKUPDMA=y -CONFIG_SOC_PM_MODEM_PD_BY_SW=y -CONFIG_SOC_CLK_RC_FAST_D256_SUPPORTED=y -CONFIG_SOC_RTC_SLOW_CLK_SUPPORT_RC_FAST_D256=y -CONFIG_SOC_CLK_RC_FAST_SUPPORT_CALIBRATION=y -CONFIG_SOC_CLK_XTAL32K_SUPPORTED=y -CONFIG_SOC_CLK_LP_FAST_SUPPORT_XTAL_D2=y -CONFIG_SOC_EFUSE_DIS_DOWNLOAD_ICACHE=y -CONFIG_SOC_EFUSE_DIS_DOWNLOAD_DCACHE=y -CONFIG_SOC_EFUSE_HARD_DIS_JTAG=y -CONFIG_SOC_EFUSE_DIS_USB_JTAG=y -CONFIG_SOC_EFUSE_SOFT_DIS_JTAG=y -CONFIG_SOC_EFUSE_DIS_DIRECT_BOOT=y -CONFIG_SOC_EFUSE_DIS_ICACHE=y -CONFIG_SOC_EFUSE_BLOCK9_KEY_PURPOSE_QUIRK=y -CONFIG_SOC_SECURE_BOOT_V2_RSA=y -CONFIG_SOC_EFUSE_SECURE_BOOT_KEY_DIGESTS=3 -CONFIG_SOC_EFUSE_REVOKE_BOOT_KEY_DIGESTS=y -CONFIG_SOC_SUPPORT_SECURE_BOOT_REVOKE_KEY=y -CONFIG_SOC_FLASH_ENCRYPTED_XTS_AES_BLOCK_MAX=64 -CONFIG_SOC_FLASH_ENCRYPTION_XTS_AES=y -CONFIG_SOC_FLASH_ENCRYPTION_XTS_AES_OPTIONS=y -CONFIG_SOC_FLASH_ENCRYPTION_XTS_AES_128=y -CONFIG_SOC_FLASH_ENCRYPTION_XTS_AES_256=y -CONFIG_SOC_MEMPROT_CPU_PREFETCH_PAD_SIZE=16 -CONFIG_SOC_MEMPROT_MEM_ALIGN_SIZE=256 -CONFIG_SOC_PHY_DIG_REGS_MEM_SIZE=21 -CONFIG_SOC_MAC_BB_PD_MEM_SIZE=192 -CONFIG_SOC_WIFI_LIGHT_SLEEP_CLK_WIDTH=12 -CONFIG_SOC_SPI_MEM_SUPPORT_AUTO_WAIT_IDLE=y -CONFIG_SOC_SPI_MEM_SUPPORT_AUTO_SUSPEND=y -CONFIG_SOC_SPI_MEM_SUPPORT_AUTO_RESUME=y -CONFIG_SOC_SPI_MEM_SUPPORT_SW_SUSPEND=y -CONFIG_SOC_SPI_MEM_SUPPORT_FLASH_OPI_MODE=y -CONFIG_SOC_SPI_MEM_SUPPORT_TIMING_TUNING=y -CONFIG_SOC_SPI_MEM_SUPPORT_CONFIG_GPIO_BY_EFUSE=y -CONFIG_SOC_SPI_MEM_SUPPORT_WRAP=y -CONFIG_SOC_MEMSPI_TIMING_TUNING_BY_MSPI_DELAY=y -CONFIG_SOC_MEMSPI_CORE_CLK_SHARED_WITH_PSRAM=y -CONFIG_SOC_SPI_MEM_SUPPORT_CACHE_32BIT_ADDR_MAP=y -CONFIG_SOC_COEX_HW_PTI=y -CONFIG_SOC_EXTERNAL_COEX_LEADER_TX_LINE=y -CONFIG_SOC_SDMMC_USE_GPIO_MATRIX=y -CONFIG_SOC_SDMMC_NUM_SLOTS=2 -CONFIG_SOC_SDMMC_SUPPORT_XTAL_CLOCK=y -CONFIG_SOC_SDMMC_DELAY_PHASE_NUM=4 -CONFIG_SOC_TEMPERATURE_SENSOR_SUPPORT_FAST_RC=y -CONFIG_SOC_WIFI_HW_TSF=y -CONFIG_SOC_WIFI_FTM_SUPPORT=y -CONFIG_SOC_WIFI_GCMP_SUPPORT=y -CONFIG_SOC_WIFI_WAPI_SUPPORT=y -CONFIG_SOC_WIFI_CSI_SUPPORT=y -CONFIG_SOC_WIFI_MESH_SUPPORT=y -CONFIG_SOC_WIFI_SUPPORT_VARIABLE_BEACON_WINDOW=y -CONFIG_SOC_WIFI_PHY_NEEDS_USB_WORKAROUND=y -CONFIG_SOC_BLE_SUPPORTED=y -CONFIG_SOC_BLE_MESH_SUPPORTED=y -CONFIG_SOC_BLE_50_SUPPORTED=y -CONFIG_SOC_BLE_DEVICE_PRIVACY_SUPPORTED=y -CONFIG_SOC_BLUFI_SUPPORTED=y -CONFIG_SOC_ULP_HAS_ADC=y -CONFIG_SOC_PHY_COMBO_MODULE=y -CONFIG_SOC_LCDCAM_CAM_SUPPORT_RGB_YUV_CONV=y -CONFIG_SOC_LCDCAM_CAM_PERIPH_NUM=1 -CONFIG_SOC_LCDCAM_CAM_DATA_WIDTH_MAX=16 -CONFIG_IDF_CMAKE=y -CONFIG_IDF_TOOLCHAIN="gcc" -CONFIG_IDF_TOOLCHAIN_GCC=y -CONFIG_IDF_TARGET_ARCH_XTENSA=y -CONFIG_IDF_TARGET_ARCH="xtensa" -CONFIG_IDF_TARGET="esp32s3" -CONFIG_IDF_INIT_VERSION="5.5.0" -CONFIG_IDF_TARGET_ESP32S3=y -CONFIG_IDF_FIRMWARE_CHIP_ID=0x0009 - -# -# Build type -# -CONFIG_APP_BUILD_TYPE_APP_2NDBOOT=y -# CONFIG_APP_BUILD_TYPE_RAM is not set -CONFIG_APP_BUILD_GENERATE_BINARIES=y -CONFIG_APP_BUILD_BOOTLOADER=y -CONFIG_APP_BUILD_USE_FLASH_SECTIONS=y -# CONFIG_APP_REPRODUCIBLE_BUILD is not set -# CONFIG_APP_NO_BLOBS is not set -# end of Build type - -# -# Bootloader config -# - -# -# Bootloader manager -# -CONFIG_BOOTLOADER_COMPILE_TIME_DATE=y -CONFIG_BOOTLOADER_PROJECT_VER=1 -# end of Bootloader manager - -# -# Application Rollback -# -# CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE is not set -# end of Application Rollback - -# -# Recovery Bootloader and Rollback -# -# end of Recovery Bootloader and Rollback - -CONFIG_BOOTLOADER_OFFSET_IN_FLASH=0x0 -CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y -# CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_DEBUG is not set -# CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_PERF is not set -# CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_NONE is not set - -# -# Log -# -CONFIG_BOOTLOADER_LOG_VERSION_1=y -CONFIG_BOOTLOADER_LOG_VERSION=1 -# CONFIG_BOOTLOADER_LOG_LEVEL_NONE is not set -# CONFIG_BOOTLOADER_LOG_LEVEL_ERROR is not set -# CONFIG_BOOTLOADER_LOG_LEVEL_WARN is not set -CONFIG_BOOTLOADER_LOG_LEVEL_INFO=y -# CONFIG_BOOTLOADER_LOG_LEVEL_DEBUG is not set -# CONFIG_BOOTLOADER_LOG_LEVEL_VERBOSE is not set -CONFIG_BOOTLOADER_LOG_LEVEL=3 - -# -# Format -# -# CONFIG_BOOTLOADER_LOG_COLORS is not set -CONFIG_BOOTLOADER_LOG_TIMESTAMP_SOURCE_CPU_TICKS=y -# end of Format - -# -# Settings -# -CONFIG_BOOTLOADER_LOG_MODE_TEXT_EN=y -CONFIG_BOOTLOADER_LOG_MODE_TEXT=y -# end of Settings -# end of Log - -# -# Serial Flash Configurations -# -# CONFIG_BOOTLOADER_FLASH_DC_AWARE is not set -CONFIG_BOOTLOADER_FLASH_XMC_SUPPORT=y -# end of Serial Flash Configurations - -CONFIG_BOOTLOADER_VDDSDIO_BOOST_1_9V=y -# CONFIG_BOOTLOADER_FACTORY_RESET is not set -# CONFIG_BOOTLOADER_APP_TEST is not set -CONFIG_BOOTLOADER_REGION_PROTECTION_ENABLE=y -CONFIG_BOOTLOADER_WDT_ENABLE=y -# CONFIG_BOOTLOADER_WDT_DISABLE_IN_USER_CODE is not set -CONFIG_BOOTLOADER_WDT_TIME_MS=9000 -# CONFIG_BOOTLOADER_SKIP_VALIDATE_IN_DEEP_SLEEP is not set -# CONFIG_BOOTLOADER_SKIP_VALIDATE_ON_POWER_ON is not set -# CONFIG_BOOTLOADER_SKIP_VALIDATE_ALWAYS is not set -CONFIG_BOOTLOADER_RESERVE_RTC_SIZE=0 -# CONFIG_BOOTLOADER_CUSTOM_RESERVE_RTC is not set -# end of Bootloader config - -# -# Security features -# -CONFIG_SECURE_BOOT_V2_RSA_SUPPORTED=y -CONFIG_SECURE_BOOT_V2_PREFERRED=y -# CONFIG_SECURE_SIGNED_APPS_NO_SECURE_BOOT is not set -# CONFIG_SECURE_BOOT is not set -# CONFIG_SECURE_FLASH_ENC_ENABLED is not set -CONFIG_SECURE_ROM_DL_MODE_ENABLED=y -# end of Security features - -# -# Application manager -# -CONFIG_APP_COMPILE_TIME_DATE=y -# CONFIG_APP_EXCLUDE_PROJECT_VER_VAR is not set -# CONFIG_APP_EXCLUDE_PROJECT_NAME_VAR is not set -# CONFIG_APP_PROJECT_VER_FROM_CONFIG is not set -CONFIG_APP_RETRIEVE_LEN_ELF_SHA=9 -# end of Application manager - -CONFIG_ESP_ROM_HAS_CRC_LE=y -CONFIG_ESP_ROM_HAS_CRC_BE=y -CONFIG_ESP_ROM_HAS_MZ_CRC32=y -CONFIG_ESP_ROM_HAS_JPEG_DECODE=y -CONFIG_ESP_ROM_UART_CLK_IS_XTAL=y -CONFIG_ESP_ROM_HAS_RETARGETABLE_LOCKING=y -CONFIG_ESP_ROM_USB_OTG_NUM=3 -CONFIG_ESP_ROM_USB_SERIAL_DEVICE_NUM=4 -CONFIG_ESP_ROM_HAS_ERASE_0_REGION_BUG=y -CONFIG_ESP_ROM_HAS_ENCRYPTED_WRITES_USING_LEGACY_DRV=y -CONFIG_ESP_ROM_GET_CLK_FREQ=y -CONFIG_ESP_ROM_HAS_HAL_WDT=y -CONFIG_ESP_ROM_NEEDS_SWSETUP_WORKAROUND=y -CONFIG_ESP_ROM_HAS_LAYOUT_TABLE=y -CONFIG_ESP_ROM_HAS_SPI_FLASH=y -CONFIG_ESP_ROM_HAS_SPI_FLASH_MMAP=y -CONFIG_ESP_ROM_HAS_ETS_PRINTF_BUG=y -CONFIG_ESP_ROM_HAS_NEWLIB=y -CONFIG_ESP_ROM_HAS_NEWLIB_NANO_FORMAT=y -CONFIG_ESP_ROM_HAS_NEWLIB_32BIT_TIME=y -CONFIG_ESP_ROM_NEEDS_SET_CACHE_MMU_SIZE=y -CONFIG_ESP_ROM_RAM_APP_NEEDS_MMU_INIT=y -CONFIG_ESP_ROM_HAS_FLASH_COUNT_PAGES_BUG=y -CONFIG_ESP_ROM_HAS_CACHE_SUSPEND_WAITI_BUG=y -CONFIG_ESP_ROM_HAS_CACHE_WRITEBACK_BUG=y -CONFIG_ESP_ROM_HAS_SW_FLOAT=y -CONFIG_ESP_ROM_HAS_VERSION=y -CONFIG_ESP_ROM_SUPPORT_DEEP_SLEEP_WAKEUP_STUB=y -CONFIG_ESP_ROM_HAS_OUTPUT_PUTC_FUNC=y -CONFIG_ESP_ROM_CONSOLE_OUTPUT_SECONDARY=y - -# -# Boot ROM Behavior -# -CONFIG_BOOT_ROM_LOG_ALWAYS_ON=y -# CONFIG_BOOT_ROM_LOG_ALWAYS_OFF is not set -# CONFIG_BOOT_ROM_LOG_ON_GPIO_HIGH is not set -# CONFIG_BOOT_ROM_LOG_ON_GPIO_LOW is not set -# end of Boot ROM Behavior - -# -# Serial flasher config -# -# CONFIG_ESPTOOLPY_NO_STUB is not set -# CONFIG_ESPTOOLPY_OCT_FLASH is not set -CONFIG_ESPTOOLPY_FLASH_MODE_AUTO_DETECT=y -# CONFIG_ESPTOOLPY_FLASHMODE_QIO is not set -# CONFIG_ESPTOOLPY_FLASHMODE_QOUT is not set -CONFIG_ESPTOOLPY_FLASHMODE_DIO=y -# CONFIG_ESPTOOLPY_FLASHMODE_DOUT is not set -CONFIG_ESPTOOLPY_FLASH_SAMPLE_MODE_STR=y -CONFIG_ESPTOOLPY_FLASHMODE="dio" -# CONFIG_ESPTOOLPY_FLASHFREQ_120M is not set -CONFIG_ESPTOOLPY_FLASHFREQ_80M=y -# CONFIG_ESPTOOLPY_FLASHFREQ_40M is not set -# CONFIG_ESPTOOLPY_FLASHFREQ_20M is not set -CONFIG_ESPTOOLPY_FLASHFREQ="80m" -# CONFIG_ESPTOOLPY_FLASHSIZE_1MB is not set -# CONFIG_ESPTOOLPY_FLASHSIZE_2MB is not set -# CONFIG_ESPTOOLPY_FLASHSIZE_4MB is not set -CONFIG_ESPTOOLPY_FLASHSIZE_8MB=y -# CONFIG_ESPTOOLPY_FLASHSIZE_16MB is not set -# CONFIG_ESPTOOLPY_FLASHSIZE_32MB is not set -# CONFIG_ESPTOOLPY_FLASHSIZE_64MB is not set -# CONFIG_ESPTOOLPY_FLASHSIZE_128MB is not set -CONFIG_ESPTOOLPY_FLASHSIZE="8MB" -# CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE is not set -CONFIG_ESPTOOLPY_BEFORE_RESET=y -# CONFIG_ESPTOOLPY_BEFORE_NORESET is not set -CONFIG_ESPTOOLPY_BEFORE="default_reset" -CONFIG_ESPTOOLPY_AFTER_RESET=y -# CONFIG_ESPTOOLPY_AFTER_NORESET is not set -CONFIG_ESPTOOLPY_AFTER="hard_reset" -CONFIG_ESPTOOLPY_MONITOR_BAUD=115200 -# end of Serial flasher config - -# -# Partition Table -# -# CONFIG_PARTITION_TABLE_SINGLE_APP is not set -# CONFIG_PARTITION_TABLE_SINGLE_APP_LARGE is not set -# CONFIG_PARTITION_TABLE_TWO_OTA is not set -# CONFIG_PARTITION_TABLE_TWO_OTA_LARGE is not set -CONFIG_PARTITION_TABLE_CUSTOM=y -CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv" -CONFIG_PARTITION_TABLE_FILENAME="partitions.csv" -CONFIG_PARTITION_TABLE_OFFSET=0x8000 -CONFIG_PARTITION_TABLE_MD5=y -# end of Partition Table - -# -# Compiler options -# -CONFIG_COMPILER_OPTIMIZATION_DEBUG=y -# CONFIG_COMPILER_OPTIMIZATION_SIZE is not set -# CONFIG_COMPILER_OPTIMIZATION_PERF is not set -# CONFIG_COMPILER_OPTIMIZATION_NONE is not set -CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_ENABLE=y -# CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT is not set -# CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE is not set -CONFIG_COMPILER_ASSERT_NDEBUG_EVALUATE=y -CONFIG_COMPILER_FLOAT_LIB_FROM_GCCLIB=y -CONFIG_COMPILER_OPTIMIZATION_ASSERTION_LEVEL=2 -# CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT is not set -CONFIG_COMPILER_HIDE_PATHS_MACROS=y -# CONFIG_COMPILER_CXX_EXCEPTIONS is not set -# CONFIG_COMPILER_CXX_RTTI is not set -CONFIG_COMPILER_STACK_CHECK_MODE_NONE=y -# CONFIG_COMPILER_STACK_CHECK_MODE_NORM is not set -# CONFIG_COMPILER_STACK_CHECK_MODE_STRONG is not set -# CONFIG_COMPILER_STACK_CHECK_MODE_ALL is not set -# CONFIG_COMPILER_NO_MERGE_CONSTANTS is not set -# CONFIG_COMPILER_WARN_WRITE_STRINGS is not set -CONFIG_COMPILER_DISABLE_DEFAULT_ERRORS=y -# CONFIG_COMPILER_DISABLE_GCC12_WARNINGS is not set -# CONFIG_COMPILER_DISABLE_GCC13_WARNINGS is not set -# CONFIG_COMPILER_DISABLE_GCC14_WARNINGS is not set -# CONFIG_COMPILER_DUMP_RTL_FILES is not set -CONFIG_COMPILER_RT_LIB_GCCLIB=y -CONFIG_COMPILER_RT_LIB_NAME="gcc" -CONFIG_COMPILER_ORPHAN_SECTIONS_WARNING=y -# CONFIG_COMPILER_ORPHAN_SECTIONS_PLACE is not set -# CONFIG_COMPILER_STATIC_ANALYZER is not set -# end of Compiler options - -# -# Component config -# - -# -# Application Level Tracing -# -# CONFIG_APPTRACE_DEST_JTAG is not set -CONFIG_APPTRACE_DEST_NONE=y -# CONFIG_APPTRACE_DEST_UART0 is not set -# CONFIG_APPTRACE_DEST_UART1 is not set -# CONFIG_APPTRACE_DEST_UART2 is not set -# CONFIG_APPTRACE_DEST_USB_CDC is not set -CONFIG_APPTRACE_DEST_UART_NONE=y -CONFIG_APPTRACE_UART_TASK_PRIO=1 -CONFIG_APPTRACE_LOCK_ENABLE=y -# end of Application Level Tracing - -# -# Bluetooth -# -CONFIG_BT_ENABLED=y -# CONFIG_BT_BLUEDROID_ENABLED is not set -CONFIG_BT_NIMBLE_ENABLED=y -# CONFIG_BT_CONTROLLER_ONLY is not set -CONFIG_BT_CONTROLLER_ENABLED=y -# CONFIG_BT_CONTROLLER_DISABLED is not set - -# -# NimBLE Options -# -CONFIG_BT_NIMBLE_MEM_ALLOC_MODE_INTERNAL=y -# CONFIG_BT_NIMBLE_MEM_ALLOC_MODE_EXTERNAL is not set -# CONFIG_BT_NIMBLE_MEM_ALLOC_MODE_DEFAULT is not set -# CONFIG_BT_NIMBLE_LOG_LEVEL_NONE is not set -# CONFIG_BT_NIMBLE_LOG_LEVEL_ERROR is not set -# CONFIG_BT_NIMBLE_LOG_LEVEL_WARNING is not set -CONFIG_BT_NIMBLE_LOG_LEVEL_INFO=y -# CONFIG_BT_NIMBLE_LOG_LEVEL_DEBUG is not set -CONFIG_BT_NIMBLE_LOG_LEVEL=1 -CONFIG_BT_NIMBLE_MAX_CONNECTIONS=3 -CONFIG_BT_NIMBLE_MAX_BONDS=3 -CONFIG_BT_NIMBLE_MAX_CCCDS=8 -CONFIG_BT_NIMBLE_L2CAP_COC_MAX_NUM=0 -CONFIG_BT_NIMBLE_PINNED_TO_CORE_0=y -# CONFIG_BT_NIMBLE_PINNED_TO_CORE_1 is not set -CONFIG_BT_NIMBLE_PINNED_TO_CORE=0 -CONFIG_BT_NIMBLE_HOST_TASK_STACK_SIZE=4096 -CONFIG_BT_NIMBLE_ROLE_CENTRAL=y -CONFIG_BT_NIMBLE_ROLE_PERIPHERAL=y -CONFIG_BT_NIMBLE_ROLE_BROADCASTER=y -CONFIG_BT_NIMBLE_ROLE_OBSERVER=y -CONFIG_BT_NIMBLE_GATT_CLIENT=y -CONFIG_BT_NIMBLE_GATT_SERVER=y -# CONFIG_BT_NIMBLE_NVS_PERSIST is not set -# CONFIG_BT_NIMBLE_SMP_ID_RESET is not set -CONFIG_BT_NIMBLE_SECURITY_ENABLE=y -CONFIG_BT_NIMBLE_SM_LEGACY=y -CONFIG_BT_NIMBLE_SM_SC=y -# CONFIG_BT_NIMBLE_SM_SC_DEBUG_KEYS is not set -CONFIG_BT_NIMBLE_LL_CFG_FEAT_LE_ENCRYPTION=y -CONFIG_BT_NIMBLE_SM_LVL=0 -CONFIG_BT_NIMBLE_SM_SC_ONLY=0 -CONFIG_BT_NIMBLE_PRINT_ERR_NAME=y -# CONFIG_BT_NIMBLE_DEBUG is not set -# CONFIG_BT_NIMBLE_DYNAMIC_SERVICE is not set -CONFIG_BT_NIMBLE_SVC_GAP_DEVICE_NAME="nimble" -CONFIG_BT_NIMBLE_GAP_DEVICE_NAME_MAX_LEN=31 -CONFIG_BT_NIMBLE_ATT_PREFERRED_MTU=256 -CONFIG_BT_NIMBLE_ATT_MAX_PREP_ENTRIES=64 -CONFIG_BT_NIMBLE_SVC_GAP_APPEARANCE=0 - -# -# Memory Settings -# -CONFIG_BT_NIMBLE_MSYS_1_BLOCK_COUNT=12 -CONFIG_BT_NIMBLE_MSYS_1_BLOCK_SIZE=256 -CONFIG_BT_NIMBLE_MSYS_2_BLOCK_COUNT=24 -CONFIG_BT_NIMBLE_MSYS_2_BLOCK_SIZE=320 -CONFIG_BT_NIMBLE_TRANSPORT_ACL_FROM_LL_COUNT=24 -CONFIG_BT_NIMBLE_TRANSPORT_ACL_SIZE=255 -CONFIG_BT_NIMBLE_TRANSPORT_EVT_SIZE=70 -CONFIG_BT_NIMBLE_TRANSPORT_EVT_COUNT=30 -CONFIG_BT_NIMBLE_TRANSPORT_EVT_DISCARD_COUNT=8 -CONFIG_BT_NIMBLE_L2CAP_COC_SDU_BUFF_COUNT=1 -# end of Memory Settings - -CONFIG_BT_NIMBLE_GATT_MAX_PROCS=4 -# CONFIG_BT_NIMBLE_HS_FLOW_CTRL is not set -CONFIG_BT_NIMBLE_RPA_TIMEOUT=900 -# CONFIG_BT_NIMBLE_MESH is not set -CONFIG_BT_NIMBLE_CRYPTO_STACK_MBEDTLS=y -CONFIG_BT_NIMBLE_HS_STOP_TIMEOUT_MS=2000 -CONFIG_BT_NIMBLE_ENABLE_CONN_REATTEMPT=y -CONFIG_BT_NIMBLE_MAX_CONN_REATTEMPT=3 -# CONFIG_BT_NIMBLE_HANDLE_REPEAT_PAIRING_DELETION is not set -CONFIG_BT_NIMBLE_50_FEATURE_SUPPORT=y -CONFIG_BT_NIMBLE_LL_CFG_FEAT_LE_2M_PHY=y -CONFIG_BT_NIMBLE_LL_CFG_FEAT_LE_CODED_PHY=y -# CONFIG_BT_NIMBLE_EXT_ADV is not set -CONFIG_BT_NIMBLE_EXT_SCAN=y -CONFIG_BT_NIMBLE_ENABLE_PERIODIC_SYNC=y -CONFIG_BT_NIMBLE_MAX_PERIODIC_SYNCS=0 -# CONFIG_BT_NIMBLE_GATT_CACHING is not set -# CONFIG_BT_NIMBLE_INCL_SVC_DISCOVERY is not set -CONFIG_BT_NIMBLE_WHITELIST_SIZE=12 -# CONFIG_BT_NIMBLE_TEST_THROUGHPUT_TEST is not set -# CONFIG_BT_NIMBLE_BLUFI_ENABLE is not set -CONFIG_BT_NIMBLE_USE_ESP_TIMER=y -CONFIG_BT_NIMBLE_LEGACY_VHCI_ENABLE=y -# CONFIG_BT_NIMBLE_BLE_GATT_BLOB_TRANSFER is not set - -# -# BLE Services -# -CONFIG_BT_NIMBLE_PROX_SERVICE=y -CONFIG_BT_NIMBLE_ANS_SERVICE=y -CONFIG_BT_NIMBLE_CTS_SERVICE=y -CONFIG_BT_NIMBLE_HTP_SERVICE=y -CONFIG_BT_NIMBLE_IPSS_SERVICE=y -CONFIG_BT_NIMBLE_TPS_SERVICE=y -CONFIG_BT_NIMBLE_IAS_SERVICE=y -CONFIG_BT_NIMBLE_LLS_SERVICE=y -CONFIG_BT_NIMBLE_SPS_SERVICE=y -CONFIG_BT_NIMBLE_HR_SERVICE=y -# CONFIG_BT_NIMBLE_HID_SERVICE is not set -CONFIG_BT_NIMBLE_BAS_SERVICE=y -# CONFIG_BT_NIMBLE_SVC_BAS_BATTERY_LEVEL_NOTIFY is not set -CONFIG_BT_NIMBLE_DIS_SERVICE=y -# CONFIG_BT_NIMBLE_SVC_DIS_MANUFACTURER_NAME is not set -# CONFIG_BT_NIMBLE_SVC_DIS_SERIAL_NUMBER is not set -# CONFIG_BT_NIMBLE_SVC_DIS_HARDWARE_REVISION is not set -# CONFIG_BT_NIMBLE_SVC_DIS_FIRMWARE_REVISION is not set -# CONFIG_BT_NIMBLE_SVC_DIS_SOFTWARE_REVISION is not set -# CONFIG_BT_NIMBLE_SVC_DIS_SYSTEM_ID is not set -# CONFIG_BT_NIMBLE_SVC_DIS_PNP_ID is not set -# CONFIG_BT_NIMBLE_SVC_DIS_INCLUDED is not set -CONFIG_BT_NIMBLE_GAP_SERVICE=y - -# -# GAP Appearance write permissions -# -# CONFIG_BT_NIMBLE_SVC_GAP_APPEAR_WRITE is not set -CONFIG_BT_NIMBLE_SVC_GAP_APPEAR_WRITE_PERM=0 -CONFIG_BT_NIMBLE_SVC_GAP_APPEAR_WRITE_PERM_ENC=0 -CONFIG_BT_NIMBLE_SVC_GAP_APPEAR_WRITE_PERM_ATHN=0 -CONFIG_BT_NIMBLE_SVC_GAP_APPEAR_WRITE_PERM_ATHR=0 -# end of GAP Appearance write permissions - -CONFIG_BT_NIMBLE_SVC_GAP_CAR_CHAR_NOT_SUPP=y -# CONFIG_BT_NIMBLE_SVC_GAP_CAR_NOT_SUPP is not set -# CONFIG_BT_NIMBLE_SVC_GAP_CAR_SUPP is not set -CONFIG_BT_NIMBLE_SVC_GAP_CENT_ADDR_RESOLUTION=-1 - -# -# GAP device name write permissions -# -# CONFIG_BT_NIMBLE_SVC_GAP_NAME_WRITE is not set -# end of GAP device name write permissions - -# -# Peripheral Preferred Connection Parameters (PPCP) settings -# -CONFIG_BT_NIMBLE_SVC_GAP_PPCP_MAX_CONN_INTERVAL=0 -CONFIG_BT_NIMBLE_SVC_GAP_PPCP_MIN_CONN_INTERVAL=0 -CONFIG_BT_NIMBLE_SVC_GAP_PPCP_SLAVE_LATENCY=0 -CONFIG_BT_NIMBLE_SVC_GAP_PPCP_SUPERVISION_TMO=0 -# end of Peripheral Preferred Connection Parameters (PPCP) settings - -CONFIG_BT_NIMBLE_SVC_GAP_NAME_WRITE_PERM=0 -CONFIG_BT_NIMBLE_SVC_GAP_NAME_WRITE_PERM_ENC=0 -CONFIG_BT_NIMBLE_SVC_GAP_NAME_WRITE_PERM_AUTHEN=0 -CONFIG_BT_NIMBLE_SVC_GAP_NAME_WRITE_PERM_AUTHOR=0 -# CONFIG_BT_NIMBLE_SVC_GAP_GATT_SECURITY_LEVEL is not set -# CONFIG_BT_NIMBLE_SVC_GAP_RPA_ONLY is not set -# end of BLE Services - -# CONFIG_BT_NIMBLE_VS_SUPPORT is not set -# CONFIG_BT_NIMBLE_ENC_ADV_DATA is not set -# CONFIG_BT_NIMBLE_HIGH_DUTY_ADV_ITVL is not set -# CONFIG_BT_NIMBLE_HOST_ALLOW_CONNECT_WITH_SCAN is not set -# CONFIG_BT_NIMBLE_HOST_QUEUE_CONG_CHECK is not set -# CONFIG_BT_NIMBLE_GATTC_PROC_PREEMPTION_PROTECT is not set -# CONFIG_BT_NIMBLE_GATTC_AUTO_PAIR is not set - -# -# Host-controller Transport -# -CONFIG_UART_HW_FLOWCTRL_DISABLE=y -# CONFIG_UART_HW_FLOWCTRL_CTS_RTS is not set -CONFIG_BT_NIMBLE_HCI_UART_FLOW_CTRL=0 -CONFIG_BT_NIMBLE_HCI_UART_RTS_PIN=19 -CONFIG_BT_NIMBLE_HCI_UART_CTS_PIN=23 -# end of Host-controller Transport - -CONFIG_BT_NIMBLE_EATT_CHAN_NUM=0 -# CONFIG_BT_NIMBLE_SUBRATE is not set -# end of NimBLE Options - -# -# Controller Options -# -CONFIG_BT_CTRL_MODE_EFF=1 -CONFIG_BT_CTRL_BLE_MAX_ACT=6 -CONFIG_BT_CTRL_BLE_MAX_ACT_EFF=6 -CONFIG_BT_CTRL_BLE_STATIC_ACL_TX_BUF_NB=0 -CONFIG_BT_CTRL_PINNED_TO_CORE_0=y -# CONFIG_BT_CTRL_PINNED_TO_CORE_1 is not set -CONFIG_BT_CTRL_PINNED_TO_CORE=0 -CONFIG_BT_CTRL_HCI_MODE_VHCI=y -# CONFIG_BT_CTRL_HCI_MODE_UART_H4 is not set -CONFIG_BT_CTRL_HCI_TL=1 -CONFIG_BT_CTRL_ADV_DUP_FILT_MAX=30 -CONFIG_BT_BLE_CCA_MODE_NONE=y -# CONFIG_BT_BLE_CCA_MODE_HW is not set -# CONFIG_BT_BLE_CCA_MODE_SW is not set -CONFIG_BT_BLE_CCA_MODE=0 -CONFIG_BT_CTRL_HW_CCA_VAL=75 -CONFIG_BT_CTRL_HW_CCA_EFF=0 -CONFIG_BT_CTRL_CE_LENGTH_TYPE_ORIG=y -# CONFIG_BT_CTRL_CE_LENGTH_TYPE_CE is not set -# CONFIG_BT_CTRL_CE_LENGTH_TYPE_SD is not set -CONFIG_BT_CTRL_CE_LENGTH_TYPE_EFF=0 -CONFIG_BT_CTRL_TX_ANTENNA_INDEX_0=y -# CONFIG_BT_CTRL_TX_ANTENNA_INDEX_1 is not set -CONFIG_BT_CTRL_TX_ANTENNA_INDEX_EFF=0 -CONFIG_BT_CTRL_RX_ANTENNA_INDEX_0=y -# CONFIG_BT_CTRL_RX_ANTENNA_INDEX_1 is not set -CONFIG_BT_CTRL_RX_ANTENNA_INDEX_EFF=0 -# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_N24 is not set -# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_N21 is not set -# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_N18 is not set -# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_N15 is not set -# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_N12 is not set -# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_N9 is not set -# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_N6 is not set -# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_N3 is not set -# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_N0 is not set -# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_P3 is not set -# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_P6 is not set -CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_P9=y -# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_P12 is not set -# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_P15 is not set -# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_P18 is not set -# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_P20 is not set -CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_EFF=11 -CONFIG_BT_CTRL_BLE_ADV_REPORT_FLOW_CTRL_SUPP=y -CONFIG_BT_CTRL_BLE_ADV_REPORT_FLOW_CTRL_NUM=100 -CONFIG_BT_CTRL_BLE_ADV_REPORT_DISCARD_THRSHOLD=20 -CONFIG_BT_CTRL_BLE_SCAN_DUPL=y -CONFIG_BT_CTRL_SCAN_DUPL_TYPE_DEVICE=y -# CONFIG_BT_CTRL_SCAN_DUPL_TYPE_DATA is not set -# CONFIG_BT_CTRL_SCAN_DUPL_TYPE_DATA_DEVICE is not set -CONFIG_BT_CTRL_SCAN_DUPL_TYPE=0 -CONFIG_BT_CTRL_SCAN_DUPL_CACHE_SIZE=100 -CONFIG_BT_CTRL_DUPL_SCAN_CACHE_REFRESH_PERIOD=0 -# CONFIG_BT_CTRL_BLE_MESH_SCAN_DUPL_EN is not set -# CONFIG_BT_CTRL_COEX_PHY_CODED_TX_RX_TLIM_EN is not set -CONFIG_BT_CTRL_COEX_PHY_CODED_TX_RX_TLIM_DIS=y -CONFIG_BT_CTRL_COEX_PHY_CODED_TX_RX_TLIM_EFF=0 - -# -# MODEM SLEEP Options -# -# CONFIG_BT_CTRL_MODEM_SLEEP is not set -# end of MODEM SLEEP Options - -CONFIG_BT_CTRL_SLEEP_MODE_EFF=0 -CONFIG_BT_CTRL_SLEEP_CLOCK_EFF=0 -CONFIG_BT_CTRL_HCI_TL_EFF=1 -# CONFIG_BT_CTRL_AGC_RECORRECT_EN is not set -# CONFIG_BT_CTRL_SCAN_BACKOFF_UPPERLIMITMAX is not set -# CONFIG_BT_BLE_ADV_DATA_LENGTH_ZERO_AUX is not set -CONFIG_BT_CTRL_CHAN_ASS_EN=y -CONFIG_BT_CTRL_LE_PING_EN=y - -# -# BLE disconnects when Instant Passed (0x28) occurs -# -# CONFIG_BT_CTRL_BLE_LLCP_CONN_UPDATE is not set -# CONFIG_BT_CTRL_BLE_LLCP_CHAN_MAP_UPDATE is not set -# CONFIG_BT_CTRL_BLE_LLCP_PHY_UPDATE is not set -# end of BLE disconnects when Instant Passed (0x28) occurs - -# CONFIG_BT_CTRL_RUN_IN_FLASH_ONLY is not set -CONFIG_BT_CTRL_DTM_ENABLE=y -CONFIG_BT_CTRL_BLE_MASTER=y -# CONFIG_BT_CTRL_BLE_TEST is not set -CONFIG_BT_CTRL_BLE_SCAN=y -CONFIG_BT_CTRL_BLE_SECURITY_ENABLE=y -CONFIG_BT_CTRL_BLE_ADV=y -# CONFIG_BT_CTRL_CHECK_CONNECT_IND_ACCESS_ADDRESS is not set - -# -# Controller debug log Options (Experimental) -# -# end of Controller debug log Options (Experimental) -# end of Controller Options - -# -# Common Options -# -CONFIG_BT_ALARM_MAX_NUM=50 -# CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED is not set -# CONFIG_BT_BLE_LOG_UHCI_OUT_ENABLED is not set -# end of Common Options - -# CONFIG_BT_HCI_LOG_DEBUG_EN is not set -# end of Bluetooth - -# CONFIG_BLE_MESH is not set - -# -# Console Library -# -# CONFIG_CONSOLE_SORTED_HELP is not set -# end of Console Library - -# -# Driver Configurations -# - -# -# Legacy TWAI Driver Configurations -# -# CONFIG_TWAI_SKIP_LEGACY_CONFLICT_CHECK is not set -CONFIG_TWAI_ERRATA_FIX_LISTEN_ONLY_DOM=y -# end of Legacy TWAI Driver Configurations - -# -# Legacy ADC Driver Configuration -# -# CONFIG_ADC_SUPPRESS_DEPRECATE_WARN is not set -# CONFIG_ADC_SKIP_LEGACY_CONFLICT_CHECK is not set - -# -# Legacy ADC Calibration Configuration -# -# CONFIG_ADC_CALI_SUPPRESS_DEPRECATE_WARN is not set -# end of Legacy ADC Calibration Configuration -# end of Legacy ADC Driver Configuration - -# -# Legacy MCPWM Driver Configurations -# -# CONFIG_MCPWM_SUPPRESS_DEPRECATE_WARN is not set -# CONFIG_MCPWM_SKIP_LEGACY_CONFLICT_CHECK is not set -# end of Legacy MCPWM Driver Configurations - -# -# Legacy Timer Group Driver Configurations -# -# CONFIG_GPTIMER_SUPPRESS_DEPRECATE_WARN is not set -# CONFIG_GPTIMER_SKIP_LEGACY_CONFLICT_CHECK is not set -# end of Legacy Timer Group Driver Configurations - -# -# Legacy RMT Driver Configurations -# -# CONFIG_RMT_SUPPRESS_DEPRECATE_WARN is not set -# CONFIG_RMT_SKIP_LEGACY_CONFLICT_CHECK is not set -# end of Legacy RMT Driver Configurations - -# -# Legacy I2S Driver Configurations -# -# CONFIG_I2S_SUPPRESS_DEPRECATE_WARN is not set -# CONFIG_I2S_SKIP_LEGACY_CONFLICT_CHECK is not set -# end of Legacy I2S Driver Configurations - -# -# Legacy I2C Driver Configurations -# -# CONFIG_I2C_SKIP_LEGACY_CONFLICT_CHECK is not set -# end of Legacy I2C Driver Configurations - -# -# Legacy PCNT Driver Configurations -# -# CONFIG_PCNT_SUPPRESS_DEPRECATE_WARN is not set -# CONFIG_PCNT_SKIP_LEGACY_CONFLICT_CHECK is not set -# end of Legacy PCNT Driver Configurations - -# -# Legacy SDM Driver Configurations -# -# CONFIG_SDM_SUPPRESS_DEPRECATE_WARN is not set -# CONFIG_SDM_SKIP_LEGACY_CONFLICT_CHECK is not set -# end of Legacy SDM Driver Configurations - -# -# Legacy Temperature Sensor Driver Configurations -# -# CONFIG_TEMP_SENSOR_SUPPRESS_DEPRECATE_WARN is not set -# CONFIG_TEMP_SENSOR_SKIP_LEGACY_CONFLICT_CHECK is not set -# end of Legacy Temperature Sensor Driver Configurations - -# -# Legacy Touch Sensor Driver Configurations -# -# CONFIG_TOUCH_SUPPRESS_DEPRECATE_WARN is not set -# CONFIG_TOUCH_SKIP_LEGACY_CONFLICT_CHECK is not set -# end of Legacy Touch Sensor Driver Configurations -# end of Driver Configurations - -# -# eFuse Bit Manager -# -# CONFIG_EFUSE_CUSTOM_TABLE is not set -# CONFIG_EFUSE_VIRTUAL is not set -CONFIG_EFUSE_MAX_BLK_LEN=256 -# end of eFuse Bit Manager - -# -# ESP-TLS -# -CONFIG_ESP_TLS_USING_MBEDTLS=y -# CONFIG_ESP_TLS_USE_SECURE_ELEMENT is not set -CONFIG_ESP_TLS_USE_DS_PERIPHERAL=y -# CONFIG_ESP_TLS_CLIENT_SESSION_TICKETS is not set -# CONFIG_ESP_TLS_SERVER_SESSION_TICKETS is not set -# CONFIG_ESP_TLS_SERVER_CERT_SELECT_HOOK is not set -# CONFIG_ESP_TLS_SERVER_MIN_AUTH_MODE_OPTIONAL is not set -# CONFIG_ESP_TLS_PSK_VERIFICATION is not set -# CONFIG_ESP_TLS_INSECURE is not set -CONFIG_ESP_TLS_DYN_BUF_STRATEGY_SUPPORTED=y -# end of ESP-TLS - -# -# ADC and ADC Calibration -# -# CONFIG_ADC_ONESHOT_CTRL_FUNC_IN_IRAM is not set -# CONFIG_ADC_CONTINUOUS_ISR_IRAM_SAFE is not set -# CONFIG_ADC_CONTINUOUS_FORCE_USE_ADC2_ON_C3_S3 is not set -# CONFIG_ADC_ENABLE_DEBUG_LOG is not set -# end of ADC and ADC Calibration - -# -# Wireless Coexistence -# -CONFIG_ESP_COEX_ENABLED=y -CONFIG_ESP_COEX_SW_COEXIST_ENABLE=y -# CONFIG_ESP_COEX_POWER_MANAGEMENT is not set -# CONFIG_ESP_COEX_GPIO_DEBUG is not set -# end of Wireless Coexistence - -# -# Common ESP-related -# -CONFIG_ESP_ERR_TO_NAME_LOOKUP=y -# end of Common ESP-related - -# -# ESP-Driver:Camera Controller Configurations -# -# CONFIG_CAM_CTLR_DVP_CAM_ISR_CACHE_SAFE is not set -# end of ESP-Driver:Camera Controller Configurations - -# -# ESP-Driver:GPIO Configurations -# -# CONFIG_GPIO_CTRL_FUNC_IN_IRAM is not set -# end of ESP-Driver:GPIO Configurations - -# -# ESP-Driver:GPTimer Configurations -# -CONFIG_GPTIMER_ISR_HANDLER_IN_IRAM=y -# CONFIG_GPTIMER_CTRL_FUNC_IN_IRAM is not set -# CONFIG_GPTIMER_ISR_CACHE_SAFE is not set -CONFIG_GPTIMER_OBJ_CACHE_SAFE=y -# CONFIG_GPTIMER_ENABLE_DEBUG_LOG is not set -# end of ESP-Driver:GPTimer Configurations - -# -# ESP-Driver:I2C Configurations -# -# CONFIG_I2C_ISR_IRAM_SAFE is not set -# CONFIG_I2C_ENABLE_DEBUG_LOG is not set -# CONFIG_I2C_ENABLE_SLAVE_DRIVER_VERSION_2 is not set -CONFIG_I2C_MASTER_ISR_HANDLER_IN_IRAM=y -# end of ESP-Driver:I2C Configurations - -# -# ESP-Driver:I2S Configurations -# -# CONFIG_I2S_ISR_IRAM_SAFE is not set -# CONFIG_I2S_ENABLE_DEBUG_LOG is not set -# end of ESP-Driver:I2S Configurations - -# -# ESP-Driver:LEDC Configurations -# -# CONFIG_LEDC_CTRL_FUNC_IN_IRAM is not set -# end of ESP-Driver:LEDC Configurations - -# -# ESP-Driver:MCPWM Configurations -# -CONFIG_MCPWM_ISR_HANDLER_IN_IRAM=y -# CONFIG_MCPWM_ISR_CACHE_SAFE is not set -# CONFIG_MCPWM_CTRL_FUNC_IN_IRAM is not set -CONFIG_MCPWM_OBJ_CACHE_SAFE=y -# CONFIG_MCPWM_ENABLE_DEBUG_LOG is not set -# end of ESP-Driver:MCPWM Configurations - -# -# ESP-Driver:PCNT Configurations -# -# CONFIG_PCNT_CTRL_FUNC_IN_IRAM is not set -# CONFIG_PCNT_ISR_IRAM_SAFE is not set -# CONFIG_PCNT_ENABLE_DEBUG_LOG is not set -# end of ESP-Driver:PCNT Configurations - -# -# ESP-Driver:RMT Configurations -# -CONFIG_RMT_ENCODER_FUNC_IN_IRAM=y -CONFIG_RMT_TX_ISR_HANDLER_IN_IRAM=y -CONFIG_RMT_RX_ISR_HANDLER_IN_IRAM=y -# CONFIG_RMT_RECV_FUNC_IN_IRAM is not set -# CONFIG_RMT_TX_ISR_CACHE_SAFE is not set -# CONFIG_RMT_RX_ISR_CACHE_SAFE is not set -CONFIG_RMT_OBJ_CACHE_SAFE=y -# CONFIG_RMT_ENABLE_DEBUG_LOG is not set -# CONFIG_RMT_ISR_IRAM_SAFE is not set -# end of ESP-Driver:RMT Configurations - -# -# ESP-Driver:Sigma Delta Modulator Configurations -# -# CONFIG_SDM_CTRL_FUNC_IN_IRAM is not set -# CONFIG_SDM_ENABLE_DEBUG_LOG is not set -# end of ESP-Driver:Sigma Delta Modulator Configurations - -# -# ESP-Driver:SPI Configurations -# -# CONFIG_SPI_MASTER_IN_IRAM is not set -CONFIG_SPI_MASTER_ISR_IN_IRAM=y -# CONFIG_SPI_SLAVE_IN_IRAM is not set -CONFIG_SPI_SLAVE_ISR_IN_IRAM=y -# end of ESP-Driver:SPI Configurations - -# -# ESP-Driver:Touch Sensor Configurations -# -# CONFIG_TOUCH_CTRL_FUNC_IN_IRAM is not set -# CONFIG_TOUCH_ISR_IRAM_SAFE is not set -# CONFIG_TOUCH_ENABLE_DEBUG_LOG is not set -# CONFIG_TOUCH_SKIP_FSM_CHECK is not set -# end of ESP-Driver:Touch Sensor Configurations - -# -# ESP-Driver:Temperature Sensor Configurations -# -# CONFIG_TEMP_SENSOR_ENABLE_DEBUG_LOG is not set -# end of ESP-Driver:Temperature Sensor Configurations - -# -# ESP-Driver:TWAI Configurations -# -# CONFIG_TWAI_ISR_IN_IRAM is not set -# CONFIG_TWAI_ISR_CACHE_SAFE is not set -# CONFIG_TWAI_ENABLE_DEBUG_LOG is not set -# end of ESP-Driver:TWAI Configurations - -# -# ESP-Driver:UART Configurations -# -# CONFIG_UART_ISR_IN_IRAM is not set -# end of ESP-Driver:UART Configurations - -# -# ESP-Driver:UHCI Configurations -# -# CONFIG_UHCI_ISR_HANDLER_IN_IRAM is not set -# CONFIG_UHCI_ISR_CACHE_SAFE is not set -# CONFIG_UHCI_ENABLE_DEBUG_LOG is not set -# end of ESP-Driver:UHCI Configurations - -# -# ESP-Driver:USB Serial/JTAG Configuration -# -CONFIG_USJ_ENABLE_USB_SERIAL_JTAG=y -# end of ESP-Driver:USB Serial/JTAG Configuration - -# -# Ethernet -# -CONFIG_ETH_ENABLED=y -CONFIG_ETH_USE_SPI_ETHERNET=y -# CONFIG_ETH_SPI_ETHERNET_DM9051 is not set -# CONFIG_ETH_SPI_ETHERNET_W5500 is not set -# CONFIG_ETH_SPI_ETHERNET_KSZ8851SNL is not set -# CONFIG_ETH_USE_OPENETH is not set -# CONFIG_ETH_TRANSMIT_MUTEX is not set -# end of Ethernet - -# -# Event Loop Library -# -# CONFIG_ESP_EVENT_LOOP_PROFILING is not set -CONFIG_ESP_EVENT_POST_FROM_ISR=y -CONFIG_ESP_EVENT_POST_FROM_IRAM_ISR=y -# end of Event Loop Library - -# -# GDB Stub -# -CONFIG_ESP_GDBSTUB_ENABLED=y -# CONFIG_ESP_SYSTEM_GDBSTUB_RUNTIME is not set -CONFIG_ESP_GDBSTUB_SUPPORT_TASKS=y -CONFIG_ESP_GDBSTUB_MAX_TASKS=32 -# end of GDB Stub - -# -# ESP HID -# -CONFIG_ESPHID_TASK_SIZE_BT=2048 -CONFIG_ESPHID_TASK_SIZE_BLE=4096 -# end of ESP HID - -# -# ESP HTTP client -# -CONFIG_ESP_HTTP_CLIENT_ENABLE_HTTPS=y -# CONFIG_ESP_HTTP_CLIENT_ENABLE_BASIC_AUTH is not set -# CONFIG_ESP_HTTP_CLIENT_ENABLE_DIGEST_AUTH is not set -# CONFIG_ESP_HTTP_CLIENT_ENABLE_CUSTOM_TRANSPORT is not set -CONFIG_ESP_HTTP_CLIENT_EVENT_POST_TIMEOUT=2000 -# end of ESP HTTP client - -# -# HTTP Server -# -CONFIG_HTTPD_MAX_REQ_HDR_LEN=512 -CONFIG_HTTPD_MAX_URI_LEN=512 -CONFIG_HTTPD_ERR_RESP_NO_DELAY=y -CONFIG_HTTPD_PURGE_BUF_LEN=32 -# CONFIG_HTTPD_LOG_PURGE_DATA is not set -# CONFIG_HTTPD_WS_SUPPORT is not set -# CONFIG_HTTPD_QUEUE_WORK_BLOCKING is not set -CONFIG_HTTPD_SERVER_EVENT_POST_TIMEOUT=2000 -# end of HTTP Server - -# -# ESP HTTPS OTA -# -# CONFIG_ESP_HTTPS_OTA_DECRYPT_CB is not set -# CONFIG_ESP_HTTPS_OTA_ALLOW_HTTP is not set -CONFIG_ESP_HTTPS_OTA_EVENT_POST_TIMEOUT=2000 -# end of ESP HTTPS OTA - -# -# ESP HTTPS server -# -# CONFIG_ESP_HTTPS_SERVER_ENABLE is not set -CONFIG_ESP_HTTPS_SERVER_EVENT_POST_TIMEOUT=2000 -# CONFIG_ESP_HTTPS_SERVER_CERT_SELECT_HOOK is not set -# end of ESP HTTPS server - -# -# Hardware Settings -# - -# -# Chip revision -# -CONFIG_ESP32S3_REV_MIN_0=y -# CONFIG_ESP32S3_REV_MIN_1 is not set -# CONFIG_ESP32S3_REV_MIN_2 is not set -CONFIG_ESP32S3_REV_MIN_FULL=0 -CONFIG_ESP_REV_MIN_FULL=0 - -# -# Maximum Supported ESP32-S3 Revision (Rev v0.99) -# -CONFIG_ESP32S3_REV_MAX_FULL=99 -CONFIG_ESP_REV_MAX_FULL=99 -CONFIG_ESP_EFUSE_BLOCK_REV_MIN_FULL=0 -CONFIG_ESP_EFUSE_BLOCK_REV_MAX_FULL=199 - -# -# Maximum Supported ESP32-S3 eFuse Block Revision (eFuse Block Rev v1.99) -# -# end of Chip revision - -# -# MAC Config -# -CONFIG_ESP_MAC_ADDR_UNIVERSE_WIFI_STA=y -CONFIG_ESP_MAC_ADDR_UNIVERSE_WIFI_AP=y -CONFIG_ESP_MAC_ADDR_UNIVERSE_BT=y -CONFIG_ESP_MAC_ADDR_UNIVERSE_ETH=y -CONFIG_ESP_MAC_UNIVERSAL_MAC_ADDRESSES_FOUR=y -CONFIG_ESP_MAC_UNIVERSAL_MAC_ADDRESSES=4 -# CONFIG_ESP32S3_UNIVERSAL_MAC_ADDRESSES_TWO is not set -CONFIG_ESP32S3_UNIVERSAL_MAC_ADDRESSES_FOUR=y -CONFIG_ESP32S3_UNIVERSAL_MAC_ADDRESSES=4 -# CONFIG_ESP_MAC_USE_CUSTOM_MAC_AS_BASE_MAC is not set -# end of MAC Config - -# -# Sleep Config -# -CONFIG_ESP_SLEEP_FLASH_LEAKAGE_WORKAROUND=y -CONFIG_ESP_SLEEP_PSRAM_LEAKAGE_WORKAROUND=y -CONFIG_ESP_SLEEP_MSPI_NEED_ALL_IO_PU=y -CONFIG_ESP_SLEEP_RTC_BUS_ISO_WORKAROUND=y -CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND=y -CONFIG_ESP_SLEEP_WAIT_FLASH_READY_EXTRA_DELAY=2000 -# CONFIG_ESP_SLEEP_CACHE_SAFE_ASSERTION is not set -# CONFIG_ESP_SLEEP_DEBUG is not set -CONFIG_ESP_SLEEP_GPIO_ENABLE_INTERNAL_RESISTORS=y -# end of Sleep Config - -# -# RTC Clock Config -# -CONFIG_RTC_CLK_SRC_INT_RC=y -# CONFIG_RTC_CLK_SRC_EXT_CRYS is not set -# CONFIG_RTC_CLK_SRC_EXT_OSC is not set -# CONFIG_RTC_CLK_SRC_INT_8MD256 is not set -CONFIG_RTC_CLK_CAL_CYCLES=1024 -# end of RTC Clock Config - -# -# Peripheral Control -# -CONFIG_ESP_PERIPH_CTRL_FUNC_IN_IRAM=y -CONFIG_ESP_REGI2C_CTRL_FUNC_IN_IRAM=y -# end of Peripheral Control - -# -# GDMA Configurations -# -CONFIG_GDMA_CTRL_FUNC_IN_IRAM=y -CONFIG_GDMA_ISR_HANDLER_IN_IRAM=y -CONFIG_GDMA_OBJ_DRAM_SAFE=y -# CONFIG_GDMA_ENABLE_DEBUG_LOG is not set -# CONFIG_GDMA_ISR_IRAM_SAFE is not set -# end of GDMA Configurations - -# -# Main XTAL Config -# -CONFIG_XTAL_FREQ_40=y -CONFIG_XTAL_FREQ=40 -# end of Main XTAL Config - -# -# Power Supplier -# - -# -# Brownout Detector -# -CONFIG_ESP_BROWNOUT_DET=y -CONFIG_ESP_BROWNOUT_DET_LVL_SEL_7=y -# CONFIG_ESP_BROWNOUT_DET_LVL_SEL_6 is not set -# CONFIG_ESP_BROWNOUT_DET_LVL_SEL_5 is not set -# CONFIG_ESP_BROWNOUT_DET_LVL_SEL_4 is not set -# CONFIG_ESP_BROWNOUT_DET_LVL_SEL_3 is not set -# CONFIG_ESP_BROWNOUT_DET_LVL_SEL_2 is not set -# CONFIG_ESP_BROWNOUT_DET_LVL_SEL_1 is not set -CONFIG_ESP_BROWNOUT_DET_LVL=7 -CONFIG_ESP_BROWNOUT_USE_INTR=y -# end of Brownout Detector -# end of Power Supplier - -CONFIG_ESP_SPI_BUS_LOCK_ISR_FUNCS_IN_IRAM=y -CONFIG_ESP_INTR_IN_IRAM=y -# end of Hardware Settings - -# -# ESP-Driver:LCD Controller Configurations -# -# CONFIG_LCD_ENABLE_DEBUG_LOG is not set -# CONFIG_LCD_RGB_ISR_IRAM_SAFE is not set -# CONFIG_LCD_RGB_RESTART_IN_VSYNC is not set -# end of ESP-Driver:LCD Controller Configurations - -# -# ESP-MM: Memory Management Configurations -# -# CONFIG_ESP_MM_CACHE_MSYNC_C2M_CHUNKED_OPS is not set -# end of ESP-MM: Memory Management Configurations - -# -# ESP NETIF Adapter -# -CONFIG_ESP_NETIF_IP_LOST_TIMER_INTERVAL=120 -# CONFIG_ESP_NETIF_PROVIDE_CUSTOM_IMPLEMENTATION is not set -CONFIG_ESP_NETIF_TCPIP_LWIP=y -# CONFIG_ESP_NETIF_LOOPBACK is not set -CONFIG_ESP_NETIF_USES_TCPIP_WITH_BSD_API=y -CONFIG_ESP_NETIF_REPORT_DATA_TRAFFIC=y -# CONFIG_ESP_NETIF_RECEIVE_REPORT_ERRORS is not set -# CONFIG_ESP_NETIF_L2_TAP is not set -# CONFIG_ESP_NETIF_BRIDGE_EN is not set -# CONFIG_ESP_NETIF_SET_DNS_PER_DEFAULT_NETIF is not set -# end of ESP NETIF Adapter - -# -# Partition API Configuration -# -# end of Partition API Configuration - -# -# PHY -# -CONFIG_ESP_PHY_ENABLED=y -CONFIG_ESP_PHY_CALIBRATION_AND_DATA_STORAGE=y -# CONFIG_ESP_PHY_INIT_DATA_IN_PARTITION is not set -CONFIG_ESP_PHY_MAX_WIFI_TX_POWER=20 -CONFIG_ESP_PHY_MAX_TX_POWER=20 -# CONFIG_ESP_PHY_REDUCE_TX_POWER is not set -CONFIG_ESP_PHY_ENABLE_USB=y -# CONFIG_ESP_PHY_ENABLE_CERT_TEST is not set -CONFIG_ESP_PHY_RF_CAL_PARTIAL=y -# CONFIG_ESP_PHY_RF_CAL_NONE is not set -# CONFIG_ESP_PHY_RF_CAL_FULL is not set -CONFIG_ESP_PHY_CALIBRATION_MODE=0 -CONFIG_ESP_PHY_PLL_TRACK_PERIOD_MS=1000 -# CONFIG_ESP_PHY_PLL_TRACK_DEBUG is not set -# CONFIG_ESP_PHY_RECORD_USED_TIME is not set -CONFIG_ESP_PHY_IRAM_OPT=y -# CONFIG_ESP_PHY_DEBUG is not set -# end of PHY - -# -# Power Management -# -CONFIG_PM_SLEEP_FUNC_IN_IRAM=y -# CONFIG_PM_ENABLE is not set -CONFIG_PM_SLP_IRAM_OPT=y -CONFIG_PM_POWER_DOWN_CPU_IN_LIGHT_SLEEP=y -CONFIG_PM_RESTORE_CACHE_TAGMEM_AFTER_LIGHT_SLEEP=y -# end of Power Management - -# -# ESP PSRAM -# -CONFIG_SPIRAM=y - -# -# SPI RAM config -# -# CONFIG_SPIRAM_MODE_QUAD is not set -CONFIG_SPIRAM_MODE_OCT=y -CONFIG_SPIRAM_TYPE_AUTO=y -# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set -CONFIG_SPIRAM_CLK_IO=30 -CONFIG_SPIRAM_CS_IO=26 -# CONFIG_SPIRAM_XIP_FROM_PSRAM is not set -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -# CONFIG_SPIRAM_SPEED_80M is not set -CONFIG_SPIRAM_SPEED_40M=y -CONFIG_SPIRAM_SPEED=40 -# CONFIG_SPIRAM_ECC_ENABLE is not set -CONFIG_SPIRAM_BOOT_HW_INIT=y -CONFIG_SPIRAM_BOOT_INIT=y -CONFIG_SPIRAM_PRE_CONFIGURE_MEMORY_PROTECTION=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_CAPS_ALLOC=y -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y -# CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP is not set -# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set -# CONFIG_SPIRAM_ALLOW_NOINIT_SEG_EXTERNAL_MEMORY is not set -# end of SPI RAM config -# end of ESP PSRAM - -# -# ESP Ringbuf -# -# CONFIG_RINGBUF_PLACE_FUNCTIONS_INTO_FLASH is not set -# end of ESP Ringbuf - -# -# ESP-ROM -# -CONFIG_ESP_ROM_PRINT_IN_IRAM=y -# end of ESP-ROM - -# -# ESP Security Specific -# -# end of ESP Security Specific - -# -# ESP System Settings -# -# CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_80 is not set -CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_160=y -# CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240 is not set -CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ=160 - -# -# Cache config -# -CONFIG_ESP32S3_INSTRUCTION_CACHE_16KB=y -# CONFIG_ESP32S3_INSTRUCTION_CACHE_32KB is not set -CONFIG_ESP32S3_INSTRUCTION_CACHE_SIZE=0x4000 -# CONFIG_ESP32S3_INSTRUCTION_CACHE_4WAYS is not set -CONFIG_ESP32S3_INSTRUCTION_CACHE_8WAYS=y -CONFIG_ESP32S3_ICACHE_ASSOCIATED_WAYS=8 -# CONFIG_ESP32S3_INSTRUCTION_CACHE_LINE_16B is not set -CONFIG_ESP32S3_INSTRUCTION_CACHE_LINE_32B=y -CONFIG_ESP32S3_INSTRUCTION_CACHE_LINE_SIZE=32 -# CONFIG_ESP32S3_DATA_CACHE_16KB is not set -CONFIG_ESP32S3_DATA_CACHE_32KB=y -# CONFIG_ESP32S3_DATA_CACHE_64KB is not set -CONFIG_ESP32S3_DATA_CACHE_SIZE=0x8000 -# CONFIG_ESP32S3_DATA_CACHE_4WAYS is not set -CONFIG_ESP32S3_DATA_CACHE_8WAYS=y -CONFIG_ESP32S3_DCACHE_ASSOCIATED_WAYS=8 -# CONFIG_ESP32S3_DATA_CACHE_LINE_16B is not set -CONFIG_ESP32S3_DATA_CACHE_LINE_32B=y -# CONFIG_ESP32S3_DATA_CACHE_LINE_64B is not set -CONFIG_ESP32S3_DATA_CACHE_LINE_SIZE=32 -# end of Cache config - -# -# Memory -# -# CONFIG_ESP32S3_RTCDATA_IN_FAST_MEM is not set -# CONFIG_ESP32S3_USE_FIXED_STATIC_RAM_SIZE is not set -# end of Memory - -# -# Trace memory -# -# CONFIG_ESP32S3_TRAX is not set -CONFIG_ESP32S3_TRACEMEM_RESERVE_DRAM=0x0 -# end of Trace memory - -CONFIG_ESP_SYSTEM_IN_IRAM=y -# CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT is not set -CONFIG_ESP_SYSTEM_PANIC_PRINT_REBOOT=y -# CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT is not set -# CONFIG_ESP_SYSTEM_PANIC_GDBSTUB is not set -CONFIG_ESP_SYSTEM_PANIC_REBOOT_DELAY_SECONDS=0 -CONFIG_ESP_SYSTEM_RTC_FAST_MEM_AS_HEAP_DEPCHECK=y -CONFIG_ESP_SYSTEM_ALLOW_RTC_FAST_MEM_AS_HEAP=y - -# -# Memory protection -# -CONFIG_ESP_SYSTEM_MEMPROT_FEATURE=y -CONFIG_ESP_SYSTEM_MEMPROT_FEATURE_LOCK=y -# end of Memory protection - -CONFIG_ESP_SYSTEM_EVENT_QUEUE_SIZE=32 -CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=2304 -CONFIG_ESP_MAIN_TASK_STACK_SIZE=8192 -CONFIG_ESP_MAIN_TASK_AFFINITY_CPU0=y -# CONFIG_ESP_MAIN_TASK_AFFINITY_CPU1 is not set -# CONFIG_ESP_MAIN_TASK_AFFINITY_NO_AFFINITY is not set -CONFIG_ESP_MAIN_TASK_AFFINITY=0x0 -CONFIG_ESP_MINIMAL_SHARED_STACK_SIZE=2048 -# CONFIG_ESP_CONSOLE_UART_DEFAULT is not set -# CONFIG_ESP_CONSOLE_USB_CDC is not set -CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG=y -# CONFIG_ESP_CONSOLE_UART_CUSTOM is not set -# CONFIG_ESP_CONSOLE_NONE is not set -CONFIG_ESP_CONSOLE_SECONDARY_NONE=y -CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG_ENABLED=y -CONFIG_ESP_CONSOLE_UART_NUM=-1 -CONFIG_ESP_CONSOLE_ROM_SERIAL_PORT_NUM=4 -CONFIG_ESP_INT_WDT=y -CONFIG_ESP_INT_WDT_TIMEOUT_MS=300 -CONFIG_ESP_INT_WDT_CHECK_CPU1=y -CONFIG_ESP_TASK_WDT_EN=y -CONFIG_ESP_TASK_WDT_INIT=y -# CONFIG_ESP_TASK_WDT_PANIC is not set -CONFIG_ESP_TASK_WDT_TIMEOUT_S=5 -CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0=y -CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU1=y -# CONFIG_ESP_PANIC_HANDLER_IRAM is not set -# CONFIG_ESP_DEBUG_STUBS_ENABLE is not set -CONFIG_ESP_DEBUG_OCDAWARE=y -CONFIG_ESP_SYSTEM_CHECK_INT_LEVEL_4=y -CONFIG_ESP_SYSTEM_BBPLL_RECALIB=y -# end of ESP System Settings - -# -# IPC (Inter-Processor Call) -# -CONFIG_ESP_IPC_ENABLE=y -CONFIG_ESP_IPC_TASK_STACK_SIZE=1280 -CONFIG_ESP_IPC_USES_CALLERS_PRIORITY=y -CONFIG_ESP_IPC_ISR_ENABLE=y -# end of IPC (Inter-Processor Call) - -# -# ESP Timer (High Resolution Timer) -# -CONFIG_ESP_TIMER_IN_IRAM=y -# CONFIG_ESP_TIMER_PROFILING is not set -CONFIG_ESP_TIME_FUNCS_USE_RTC_TIMER=y -CONFIG_ESP_TIME_FUNCS_USE_ESP_TIMER=y -CONFIG_ESP_TIMER_TASK_STACK_SIZE=3584 -CONFIG_ESP_TIMER_INTERRUPT_LEVEL=1 -# CONFIG_ESP_TIMER_SHOW_EXPERIMENTAL is not set -CONFIG_ESP_TIMER_TASK_AFFINITY=0x0 -CONFIG_ESP_TIMER_TASK_AFFINITY_CPU0=y -CONFIG_ESP_TIMER_ISR_AFFINITY_CPU0=y -# CONFIG_ESP_TIMER_SUPPORTS_ISR_DISPATCH_METHOD is not set -CONFIG_ESP_TIMER_IMPL_SYSTIMER=y -# end of ESP Timer (High Resolution Timer) - -# -# Wi-Fi -# -CONFIG_ESP_WIFI_ENABLED=y -CONFIG_ESP_WIFI_STATIC_RX_BUFFER_NUM=10 -CONFIG_ESP_WIFI_DYNAMIC_RX_BUFFER_NUM=32 -# CONFIG_ESP_WIFI_STATIC_TX_BUFFER is not set -CONFIG_ESP_WIFI_DYNAMIC_TX_BUFFER=y -CONFIG_ESP_WIFI_TX_BUFFER_TYPE=1 -CONFIG_ESP_WIFI_DYNAMIC_TX_BUFFER_NUM=32 -CONFIG_ESP_WIFI_STATIC_RX_MGMT_BUFFER=y -# CONFIG_ESP_WIFI_DYNAMIC_RX_MGMT_BUFFER is not set -CONFIG_ESP_WIFI_DYNAMIC_RX_MGMT_BUF=0 -CONFIG_ESP_WIFI_RX_MGMT_BUF_NUM_DEF=5 -# CONFIG_ESP_WIFI_CSI_ENABLED is not set -CONFIG_ESP_WIFI_AMPDU_TX_ENABLED=y -CONFIG_ESP_WIFI_TX_BA_WIN=6 -CONFIG_ESP_WIFI_AMPDU_RX_ENABLED=y -CONFIG_ESP_WIFI_RX_BA_WIN=6 -CONFIG_ESP_WIFI_NVS_ENABLED=y -CONFIG_ESP_WIFI_TASK_PINNED_TO_CORE_0=y -# CONFIG_ESP_WIFI_TASK_PINNED_TO_CORE_1 is not set -CONFIG_ESP_WIFI_SOFTAP_BEACON_MAX_LEN=752 -CONFIG_ESP_WIFI_MGMT_SBUF_NUM=32 -CONFIG_ESP_WIFI_IRAM_OPT=y -# CONFIG_ESP_WIFI_EXTRA_IRAM_OPT is not set -CONFIG_ESP_WIFI_RX_IRAM_OPT=y -CONFIG_ESP_WIFI_ENABLE_WPA3_SAE=y -CONFIG_ESP_WIFI_ENABLE_SAE_PK=y -CONFIG_ESP_WIFI_ENABLE_SAE_H2E=y -CONFIG_ESP_WIFI_SOFTAP_SAE_SUPPORT=y -CONFIG_ESP_WIFI_ENABLE_WPA3_OWE_STA=y -# CONFIG_ESP_WIFI_SLP_IRAM_OPT is not set -CONFIG_ESP_WIFI_SLP_DEFAULT_MIN_ACTIVE_TIME=50 -# CONFIG_ESP_WIFI_BSS_MAX_IDLE_SUPPORT is not set -CONFIG_ESP_WIFI_SLP_DEFAULT_MAX_ACTIVE_TIME=10 -CONFIG_ESP_WIFI_SLP_DEFAULT_WAIT_BROADCAST_DATA_TIME=15 -# CONFIG_ESP_WIFI_FTM_ENABLE is not set -CONFIG_ESP_WIFI_STA_DISCONNECTED_PM_ENABLE=y -# CONFIG_ESP_WIFI_GCMP_SUPPORT is not set -CONFIG_ESP_WIFI_GMAC_SUPPORT=y -CONFIG_ESP_WIFI_SOFTAP_SUPPORT=y -# CONFIG_ESP_WIFI_SLP_BEACON_LOST_OPT is not set -CONFIG_ESP_WIFI_ESPNOW_MAX_ENCRYPT_NUM=7 -CONFIG_ESP_WIFI_MBEDTLS_CRYPTO=y -CONFIG_ESP_WIFI_MBEDTLS_TLS_CLIENT=y -# CONFIG_ESP_WIFI_WAPI_PSK is not set -# CONFIG_ESP_WIFI_SUITE_B_192 is not set -# CONFIG_ESP_WIFI_11KV_SUPPORT is not set -# CONFIG_ESP_WIFI_MBO_SUPPORT is not set -# CONFIG_ESP_WIFI_DPP_SUPPORT is not set -# CONFIG_ESP_WIFI_11R_SUPPORT is not set -# CONFIG_ESP_WIFI_WPS_SOFTAP_REGISTRAR is not set - -# -# WPS Configuration Options -# -# CONFIG_ESP_WIFI_WPS_STRICT is not set -# CONFIG_ESP_WIFI_WPS_PASSPHRASE is not set -# end of WPS Configuration Options - -# CONFIG_ESP_WIFI_DEBUG_PRINT is not set -# CONFIG_ESP_WIFI_TESTING_OPTIONS is not set -CONFIG_ESP_WIFI_ENTERPRISE_SUPPORT=y -# CONFIG_ESP_WIFI_ENT_FREE_DYNAMIC_BUFFER is not set -# end of Wi-Fi - -# -# Core dump -# -# CONFIG_ESP_COREDUMP_ENABLE_TO_FLASH is not set -# CONFIG_ESP_COREDUMP_ENABLE_TO_UART is not set -CONFIG_ESP_COREDUMP_ENABLE_TO_NONE=y -# end of Core dump - -# -# FAT Filesystem support -# -CONFIG_FATFS_VOLUME_COUNT=2 -CONFIG_FATFS_LFN_NONE=y -# CONFIG_FATFS_LFN_HEAP is not set -# CONFIG_FATFS_LFN_STACK is not set -# CONFIG_FATFS_SECTOR_512 is not set -CONFIG_FATFS_SECTOR_4096=y -# CONFIG_FATFS_CODEPAGE_DYNAMIC is not set -CONFIG_FATFS_CODEPAGE_437=y -# CONFIG_FATFS_CODEPAGE_720 is not set -# CONFIG_FATFS_CODEPAGE_737 is not set -# CONFIG_FATFS_CODEPAGE_771 is not set -# CONFIG_FATFS_CODEPAGE_775 is not set -# CONFIG_FATFS_CODEPAGE_850 is not set -# CONFIG_FATFS_CODEPAGE_852 is not set -# CONFIG_FATFS_CODEPAGE_855 is not set -# CONFIG_FATFS_CODEPAGE_857 is not set -# CONFIG_FATFS_CODEPAGE_860 is not set -# CONFIG_FATFS_CODEPAGE_861 is not set -# CONFIG_FATFS_CODEPAGE_862 is not set -# CONFIG_FATFS_CODEPAGE_863 is not set -# CONFIG_FATFS_CODEPAGE_864 is not set -# CONFIG_FATFS_CODEPAGE_865 is not set -# CONFIG_FATFS_CODEPAGE_866 is not set -# CONFIG_FATFS_CODEPAGE_869 is not set -# CONFIG_FATFS_CODEPAGE_932 is not set -# CONFIG_FATFS_CODEPAGE_936 is not set -# CONFIG_FATFS_CODEPAGE_949 is not set -# CONFIG_FATFS_CODEPAGE_950 is not set -CONFIG_FATFS_CODEPAGE=437 -CONFIG_FATFS_FS_LOCK=0 -CONFIG_FATFS_TIMEOUT_MS=10000 -CONFIG_FATFS_PER_FILE_CACHE=y -CONFIG_FATFS_ALLOC_PREFER_EXTRAM=y -# CONFIG_FATFS_USE_FASTSEEK is not set -CONFIG_FATFS_USE_STRFUNC_NONE=y -# CONFIG_FATFS_USE_STRFUNC_WITHOUT_CRLF_CONV is not set -# CONFIG_FATFS_USE_STRFUNC_WITH_CRLF_CONV is not set -CONFIG_FATFS_VFS_FSTAT_BLKSIZE=0 -# CONFIG_FATFS_IMMEDIATE_FSYNC is not set -# CONFIG_FATFS_USE_LABEL is not set -CONFIG_FATFS_LINK_LOCK=y -# CONFIG_FATFS_USE_DYN_BUFFERS is not set - -# -# File system free space calculation behavior -# -CONFIG_FATFS_DONT_TRUST_FREE_CLUSTER_CNT=0 -CONFIG_FATFS_DONT_TRUST_LAST_ALLOC=0 -# end of File system free space calculation behavior -# end of FAT Filesystem support - -# -# FreeRTOS -# - -# -# Kernel -# -# CONFIG_FREERTOS_SMP is not set -# CONFIG_FREERTOS_UNICORE is not set -CONFIG_FREERTOS_HZ=100 -# CONFIG_FREERTOS_CHECK_STACKOVERFLOW_NONE is not set -# CONFIG_FREERTOS_CHECK_STACKOVERFLOW_PTRVAL is not set -CONFIG_FREERTOS_CHECK_STACKOVERFLOW_CANARY=y -CONFIG_FREERTOS_THREAD_LOCAL_STORAGE_POINTERS=1 -CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=1536 -# CONFIG_FREERTOS_USE_IDLE_HOOK is not set -# CONFIG_FREERTOS_USE_TICK_HOOK is not set -CONFIG_FREERTOS_MAX_TASK_NAME_LEN=16 -CONFIG_FREERTOS_ENABLE_BACKWARD_COMPATIBILITY=y -CONFIG_FREERTOS_USE_TIMERS=y -CONFIG_FREERTOS_TIMER_SERVICE_TASK_NAME="Tmr Svc" -# CONFIG_FREERTOS_TIMER_TASK_AFFINITY_CPU0 is not set -# CONFIG_FREERTOS_TIMER_TASK_AFFINITY_CPU1 is not set -CONFIG_FREERTOS_TIMER_TASK_NO_AFFINITY=y -CONFIG_FREERTOS_TIMER_SERVICE_TASK_CORE_AFFINITY=0x7FFFFFFF -CONFIG_FREERTOS_TIMER_TASK_PRIORITY=1 -CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH=2048 -CONFIG_FREERTOS_TIMER_QUEUE_LENGTH=10 -CONFIG_FREERTOS_QUEUE_REGISTRY_SIZE=0 -CONFIG_FREERTOS_TASK_NOTIFICATION_ARRAY_ENTRIES=1 -CONFIG_FREERTOS_USE_TRACE_FACILITY=y -# CONFIG_FREERTOS_USE_STATS_FORMATTING_FUNCTIONS is not set -# CONFIG_FREERTOS_USE_LIST_DATA_INTEGRITY_CHECK_BYTES is not set -# CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS is not set -# CONFIG_FREERTOS_USE_APPLICATION_TASK_TAG is not set -# end of Kernel - -# -# Port -# -CONFIG_FREERTOS_TASK_FUNCTION_WRAPPER=y -# CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK is not set -CONFIG_FREERTOS_TLSP_DELETION_CALLBACKS=y -# CONFIG_FREERTOS_TASK_PRE_DELETION_HOOK is not set -# CONFIG_FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP is not set -CONFIG_FREERTOS_CHECK_MUTEX_GIVEN_BY_OWNER=y -CONFIG_FREERTOS_ISR_STACKSIZE=1536 -CONFIG_FREERTOS_INTERRUPT_BACKTRACE=y -# CONFIG_FREERTOS_FPU_IN_ISR is not set -CONFIG_FREERTOS_TICK_SUPPORT_SYSTIMER=y -CONFIG_FREERTOS_CORETIMER_SYSTIMER_LVL1=y -# CONFIG_FREERTOS_CORETIMER_SYSTIMER_LVL3 is not set -CONFIG_FREERTOS_SYSTICK_USES_SYSTIMER=y -# CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH is not set -# CONFIG_FREERTOS_CHECK_PORT_CRITICAL_COMPLIANCE is not set -# end of Port - -# -# Extra -# -CONFIG_FREERTOS_TASK_CREATE_ALLOW_EXT_MEM=y -# end of Extra - -CONFIG_FREERTOS_PORT=y -CONFIG_FREERTOS_NO_AFFINITY=0x7FFFFFFF -CONFIG_FREERTOS_SUPPORT_STATIC_ALLOCATION=y -CONFIG_FREERTOS_DEBUG_OCDAWARE=y -CONFIG_FREERTOS_ENABLE_TASK_SNAPSHOT=y -CONFIG_FREERTOS_PLACE_SNAPSHOT_FUNS_INTO_FLASH=y -CONFIG_FREERTOS_NUMBER_OF_CORES=2 -CONFIG_FREERTOS_IN_IRAM=y -# end of FreeRTOS - -# -# Hardware Abstraction Layer (HAL) and Low Level (LL) -# -CONFIG_HAL_ASSERTION_EQUALS_SYSTEM=y -# CONFIG_HAL_ASSERTION_DISABLE is not set -# CONFIG_HAL_ASSERTION_SILENT is not set -# CONFIG_HAL_ASSERTION_ENABLE is not set -CONFIG_HAL_DEFAULT_ASSERTION_LEVEL=2 -CONFIG_HAL_WDT_USE_ROM_IMPL=y -# end of Hardware Abstraction Layer (HAL) and Low Level (LL) - -# -# Heap memory debugging -# -CONFIG_HEAP_POISONING_DISABLED=y -# CONFIG_HEAP_POISONING_LIGHT is not set -# CONFIG_HEAP_POISONING_COMPREHENSIVE is not set -CONFIG_HEAP_TRACING_OFF=y -# CONFIG_HEAP_TRACING_STANDALONE is not set -# CONFIG_HEAP_TRACING_TOHOST is not set -# CONFIG_HEAP_USE_HOOKS is not set -# CONFIG_HEAP_TASK_TRACKING is not set -# CONFIG_HEAP_ABORT_WHEN_ALLOCATION_FAILS is not set -# CONFIG_HEAP_PLACE_FUNCTION_INTO_FLASH is not set -# end of Heap memory debugging - -# -# Log -# -CONFIG_LOG_VERSION_1=y -# CONFIG_LOG_VERSION_2 is not set -CONFIG_LOG_VERSION=1 - -# -# Log Level -# -# CONFIG_LOG_DEFAULT_LEVEL_NONE is not set -# CONFIG_LOG_DEFAULT_LEVEL_ERROR is not set -# CONFIG_LOG_DEFAULT_LEVEL_WARN is not set -CONFIG_LOG_DEFAULT_LEVEL_INFO=y -# CONFIG_LOG_DEFAULT_LEVEL_DEBUG is not set -# CONFIG_LOG_DEFAULT_LEVEL_VERBOSE is not set -CONFIG_LOG_DEFAULT_LEVEL=3 -CONFIG_LOG_MAXIMUM_EQUALS_DEFAULT=y -# CONFIG_LOG_MAXIMUM_LEVEL_DEBUG is not set -# CONFIG_LOG_MAXIMUM_LEVEL_VERBOSE is not set -CONFIG_LOG_MAXIMUM_LEVEL=3 - -# -# Level Settings -# -# CONFIG_LOG_MASTER_LEVEL is not set -CONFIG_LOG_DYNAMIC_LEVEL_CONTROL=y -# CONFIG_LOG_TAG_LEVEL_IMPL_NONE is not set -# CONFIG_LOG_TAG_LEVEL_IMPL_LINKED_LIST is not set -CONFIG_LOG_TAG_LEVEL_IMPL_CACHE_AND_LINKED_LIST=y -# CONFIG_LOG_TAG_LEVEL_CACHE_ARRAY is not set -CONFIG_LOG_TAG_LEVEL_CACHE_BINARY_MIN_HEAP=y -CONFIG_LOG_TAG_LEVEL_IMPL_CACHE_SIZE=31 -# end of Level Settings -# end of Log Level - -# -# Format -# -CONFIG_LOG_COLORS=y -CONFIG_LOG_TIMESTAMP_SOURCE_RTOS=y -# CONFIG_LOG_TIMESTAMP_SOURCE_SYSTEM is not set -# end of Format - -# -# Settings -# -CONFIG_LOG_MODE_TEXT_EN=y -CONFIG_LOG_MODE_TEXT=y -# end of Settings - -CONFIG_LOG_IN_IRAM=y -# end of Log - -# -# LWIP -# -CONFIG_LWIP_ENABLE=y -CONFIG_LWIP_LOCAL_HOSTNAME="espressif" -CONFIG_LWIP_TCPIP_TASK_PRIO=18 -# CONFIG_LWIP_TCPIP_CORE_LOCKING is not set -# CONFIG_LWIP_CHECK_THREAD_SAFETY is not set -CONFIG_LWIP_DNS_SUPPORT_MDNS_QUERIES=y -# CONFIG_LWIP_L2_TO_L3_COPY is not set -# CONFIG_LWIP_IRAM_OPTIMIZATION is not set -# CONFIG_LWIP_EXTRA_IRAM_OPTIMIZATION is not set -CONFIG_LWIP_TIMERS_ONDEMAND=y -CONFIG_LWIP_ND6=y -# CONFIG_LWIP_FORCE_ROUTER_FORWARDING is not set -CONFIG_LWIP_MAX_SOCKETS=10 -# CONFIG_LWIP_USE_ONLY_LWIP_SELECT is not set -# CONFIG_LWIP_SO_LINGER is not set -CONFIG_LWIP_SO_REUSE=y -CONFIG_LWIP_SO_REUSE_RXTOALL=y -# CONFIG_LWIP_SO_RCVBUF is not set -# CONFIG_LWIP_NETBUF_RECVINFO is not set -CONFIG_LWIP_IP_DEFAULT_TTL=64 -CONFIG_LWIP_IP4_FRAG=y -CONFIG_LWIP_IP6_FRAG=y -# CONFIG_LWIP_IP4_REASSEMBLY is not set -# CONFIG_LWIP_IP6_REASSEMBLY is not set -CONFIG_LWIP_IP_REASS_MAX_PBUFS=10 -# CONFIG_LWIP_IP_FORWARD is not set -# CONFIG_LWIP_STATS is not set -CONFIG_LWIP_ESP_GRATUITOUS_ARP=y -CONFIG_LWIP_GARP_TMR_INTERVAL=60 -CONFIG_LWIP_ESP_MLDV6_REPORT=y -CONFIG_LWIP_MLDV6_TMR_INTERVAL=40 -CONFIG_LWIP_TCPIP_RECVMBOX_SIZE=32 -CONFIG_LWIP_DHCP_DOES_ARP_CHECK=y -# CONFIG_LWIP_DHCP_DOES_ACD_CHECK is not set -# CONFIG_LWIP_DHCP_DOES_NOT_CHECK_OFFERED_IP is not set -# CONFIG_LWIP_DHCP_DISABLE_CLIENT_ID is not set -CONFIG_LWIP_DHCP_DISABLE_VENDOR_CLASS_ID=y -# CONFIG_LWIP_DHCP_RESTORE_LAST_IP is not set -CONFIG_LWIP_DHCP_OPTIONS_LEN=69 -CONFIG_LWIP_NUM_NETIF_CLIENT_DATA=0 -CONFIG_LWIP_DHCP_COARSE_TIMER_SECS=1 - -# -# DHCP server -# -CONFIG_LWIP_DHCPS=y -CONFIG_LWIP_DHCPS_LEASE_UNIT=60 -CONFIG_LWIP_DHCPS_MAX_STATION_NUM=8 -CONFIG_LWIP_DHCPS_STATIC_ENTRIES=y -CONFIG_LWIP_DHCPS_ADD_DNS=y -# end of DHCP server - -# CONFIG_LWIP_AUTOIP is not set -CONFIG_LWIP_IPV4=y -CONFIG_LWIP_IPV6=y -# CONFIG_LWIP_IPV6_AUTOCONFIG is not set -CONFIG_LWIP_IPV6_NUM_ADDRESSES=3 -# CONFIG_LWIP_IPV6_FORWARD is not set -# CONFIG_LWIP_NETIF_STATUS_CALLBACK is not set -CONFIG_LWIP_NETIF_LOOPBACK=y -CONFIG_LWIP_LOOPBACK_MAX_PBUFS=8 - -# -# TCP -# -CONFIG_LWIP_MAX_ACTIVE_TCP=16 -CONFIG_LWIP_MAX_LISTENING_TCP=16 -CONFIG_LWIP_TCP_HIGH_SPEED_RETRANSMISSION=y -CONFIG_LWIP_TCP_MAXRTX=12 -CONFIG_LWIP_TCP_SYNMAXRTX=12 -CONFIG_LWIP_TCP_MSS=1440 -CONFIG_LWIP_TCP_TMR_INTERVAL=250 -CONFIG_LWIP_TCP_MSL=60000 -CONFIG_LWIP_TCP_FIN_WAIT_TIMEOUT=20000 -CONFIG_LWIP_TCP_SND_BUF_DEFAULT=5760 -CONFIG_LWIP_TCP_WND_DEFAULT=5760 -CONFIG_LWIP_TCP_RECVMBOX_SIZE=6 -CONFIG_LWIP_TCP_ACCEPTMBOX_SIZE=6 -CONFIG_LWIP_TCP_QUEUE_OOSEQ=y -CONFIG_LWIP_TCP_OOSEQ_TIMEOUT=6 -CONFIG_LWIP_TCP_OOSEQ_MAX_PBUFS=4 -# CONFIG_LWIP_TCP_SACK_OUT is not set -CONFIG_LWIP_TCP_OVERSIZE_MSS=y -# CONFIG_LWIP_TCP_OVERSIZE_QUARTER_MSS is not set -# CONFIG_LWIP_TCP_OVERSIZE_DISABLE is not set -CONFIG_LWIP_TCP_RTO_TIME=1500 -# end of TCP - -# -# UDP -# -CONFIG_LWIP_MAX_UDP_PCBS=16 -CONFIG_LWIP_UDP_RECVMBOX_SIZE=6 -# end of UDP - -# -# Checksums -# -# CONFIG_LWIP_CHECKSUM_CHECK_IP is not set -# CONFIG_LWIP_CHECKSUM_CHECK_UDP is not set -CONFIG_LWIP_CHECKSUM_CHECK_ICMP=y -# end of Checksums - -CONFIG_LWIP_TCPIP_TASK_STACK_SIZE=3072 -CONFIG_LWIP_TCPIP_TASK_AFFINITY_NO_AFFINITY=y -# CONFIG_LWIP_TCPIP_TASK_AFFINITY_CPU0 is not set -# CONFIG_LWIP_TCPIP_TASK_AFFINITY_CPU1 is not set -CONFIG_LWIP_TCPIP_TASK_AFFINITY=0x7FFFFFFF -CONFIG_LWIP_IPV6_MEMP_NUM_ND6_QUEUE=3 -CONFIG_LWIP_IPV6_ND6_NUM_NEIGHBORS=5 -CONFIG_LWIP_IPV6_ND6_NUM_PREFIXES=5 -CONFIG_LWIP_IPV6_ND6_NUM_ROUTERS=3 -CONFIG_LWIP_IPV6_ND6_NUM_DESTINATIONS=10 -# CONFIG_LWIP_PPP_SUPPORT is not set -# CONFIG_LWIP_SLIP_SUPPORT is not set - -# -# ICMP -# -CONFIG_LWIP_ICMP=y -# CONFIG_LWIP_MULTICAST_PING is not set -# CONFIG_LWIP_BROADCAST_PING is not set -# end of ICMP - -# -# LWIP RAW API -# -CONFIG_LWIP_MAX_RAW_PCBS=16 -# end of LWIP RAW API - -# -# SNTP -# -CONFIG_LWIP_SNTP_MAX_SERVERS=1 -# CONFIG_LWIP_DHCP_GET_NTP_SRV is not set -CONFIG_LWIP_SNTP_UPDATE_DELAY=3600000 -CONFIG_LWIP_SNTP_STARTUP_DELAY=y -CONFIG_LWIP_SNTP_MAXIMUM_STARTUP_DELAY=5000 -# end of SNTP - -# -# DNS -# -CONFIG_LWIP_DNS_MAX_HOST_IP=1 -CONFIG_LWIP_DNS_MAX_SERVERS=3 -# CONFIG_LWIP_FALLBACK_DNS_SERVER_SUPPORT is not set -# CONFIG_LWIP_DNS_SETSERVER_WITH_NETIF is not set -# CONFIG_LWIP_USE_ESP_GETADDRINFO is not set -# end of DNS - -CONFIG_LWIP_BRIDGEIF_MAX_PORTS=7 -CONFIG_LWIP_ESP_LWIP_ASSERT=y - -# -# Hooks -# -# CONFIG_LWIP_HOOK_TCP_ISN_NONE is not set -CONFIG_LWIP_HOOK_TCP_ISN_DEFAULT=y -# CONFIG_LWIP_HOOK_TCP_ISN_CUSTOM is not set -CONFIG_LWIP_HOOK_IP6_ROUTE_NONE=y -# CONFIG_LWIP_HOOK_IP6_ROUTE_DEFAULT is not set -# CONFIG_LWIP_HOOK_IP6_ROUTE_CUSTOM is not set -CONFIG_LWIP_HOOK_ND6_GET_GW_NONE=y -# CONFIG_LWIP_HOOK_ND6_GET_GW_DEFAULT is not set -# CONFIG_LWIP_HOOK_ND6_GET_GW_CUSTOM is not set -CONFIG_LWIP_HOOK_IP6_SELECT_SRC_ADDR_NONE=y -# CONFIG_LWIP_HOOK_IP6_SELECT_SRC_ADDR_DEFAULT is not set -# CONFIG_LWIP_HOOK_IP6_SELECT_SRC_ADDR_CUSTOM is not set -CONFIG_LWIP_HOOK_DHCP_EXTRA_OPTION_NONE=y -# CONFIG_LWIP_HOOK_DHCP_EXTRA_OPTION_DEFAULT is not set -# CONFIG_LWIP_HOOK_DHCP_EXTRA_OPTION_CUSTOM is not set -CONFIG_LWIP_HOOK_NETCONN_EXT_RESOLVE_NONE=y -# CONFIG_LWIP_HOOK_NETCONN_EXT_RESOLVE_DEFAULT is not set -# CONFIG_LWIP_HOOK_NETCONN_EXT_RESOLVE_CUSTOM is not set -CONFIG_LWIP_HOOK_DNS_EXT_RESOLVE_NONE=y -# CONFIG_LWIP_HOOK_DNS_EXT_RESOLVE_CUSTOM is not set -# CONFIG_LWIP_HOOK_IP6_INPUT_NONE is not set -CONFIG_LWIP_HOOK_IP6_INPUT_DEFAULT=y -# CONFIG_LWIP_HOOK_IP6_INPUT_CUSTOM is not set -# end of Hooks - -# CONFIG_LWIP_DEBUG is not set -# end of LWIP - -# -# mbedTLS -# -CONFIG_MBEDTLS_INTERNAL_MEM_ALLOC=y -# CONFIG_MBEDTLS_EXTERNAL_MEM_ALLOC is not set -# CONFIG_MBEDTLS_DEFAULT_MEM_ALLOC is not set -# CONFIG_MBEDTLS_CUSTOM_MEM_ALLOC is not set -CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN=y -CONFIG_MBEDTLS_SSL_IN_CONTENT_LEN=16384 -CONFIG_MBEDTLS_SSL_OUT_CONTENT_LEN=4096 -# CONFIG_MBEDTLS_DYNAMIC_BUFFER is not set -# CONFIG_MBEDTLS_DEBUG is not set - -# -# mbedTLS v3.x related -# -# CONFIG_MBEDTLS_SSL_PROTO_TLS1_3 is not set -# CONFIG_MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH is not set -# CONFIG_MBEDTLS_X509_TRUSTED_CERT_CALLBACK is not set -# CONFIG_MBEDTLS_SSL_CONTEXT_SERIALIZATION is not set -CONFIG_MBEDTLS_SSL_KEEP_PEER_CERTIFICATE=y -# CONFIG_MBEDTLS_SSL_KEYING_MATERIAL_EXPORT is not set -CONFIG_MBEDTLS_PKCS7_C=y -# end of mbedTLS v3.x related - -# -# Certificate Bundle -# -CONFIG_MBEDTLS_CERTIFICATE_BUNDLE=y -CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_FULL=y -# CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_CMN is not set -# CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_NONE is not set -# CONFIG_MBEDTLS_CUSTOM_CERTIFICATE_BUNDLE is not set -# CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEPRECATED_LIST is not set -CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_MAX_CERTS=200 -# end of Certificate Bundle - -# CONFIG_MBEDTLS_ECP_RESTARTABLE is not set -CONFIG_MBEDTLS_CMAC_C=y -CONFIG_MBEDTLS_HARDWARE_AES=y -CONFIG_MBEDTLS_AES_USE_INTERRUPT=y -CONFIG_MBEDTLS_AES_INTERRUPT_LEVEL=0 -CONFIG_MBEDTLS_GCM_SUPPORT_NON_AES_CIPHER=y -CONFIG_MBEDTLS_HARDWARE_MPI=y -# CONFIG_MBEDTLS_LARGE_KEY_SOFTWARE_MPI is not set -CONFIG_MBEDTLS_MPI_USE_INTERRUPT=y -CONFIG_MBEDTLS_MPI_INTERRUPT_LEVEL=0 -CONFIG_MBEDTLS_HARDWARE_SHA=y -CONFIG_MBEDTLS_ROM_MD5=y -# CONFIG_MBEDTLS_ATCA_HW_ECDSA_SIGN is not set -# CONFIG_MBEDTLS_ATCA_HW_ECDSA_VERIFY is not set -CONFIG_MBEDTLS_HAVE_TIME=y -# CONFIG_MBEDTLS_PLATFORM_TIME_ALT is not set -# CONFIG_MBEDTLS_HAVE_TIME_DATE is not set -CONFIG_MBEDTLS_ECDSA_DETERMINISTIC=y -CONFIG_MBEDTLS_SHA1_C=y -CONFIG_MBEDTLS_SHA512_C=y -# CONFIG_MBEDTLS_SHA3_C is not set -CONFIG_MBEDTLS_TLS_SERVER_AND_CLIENT=y -# CONFIG_MBEDTLS_TLS_SERVER_ONLY is not set -# CONFIG_MBEDTLS_TLS_CLIENT_ONLY is not set -# CONFIG_MBEDTLS_TLS_DISABLED is not set -CONFIG_MBEDTLS_TLS_SERVER=y -CONFIG_MBEDTLS_TLS_CLIENT=y -CONFIG_MBEDTLS_TLS_ENABLED=y - -# -# TLS Key Exchange Methods -# -# CONFIG_MBEDTLS_PSK_MODES is not set -CONFIG_MBEDTLS_KEY_EXCHANGE_RSA=y -CONFIG_MBEDTLS_KEY_EXCHANGE_ELLIPTIC_CURVE=y -CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_RSA=y -CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA=y -CONFIG_MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA=y -CONFIG_MBEDTLS_KEY_EXCHANGE_ECDH_RSA=y -# end of TLS Key Exchange Methods - -CONFIG_MBEDTLS_SSL_RENEGOTIATION=y -CONFIG_MBEDTLS_SSL_PROTO_TLS1_2=y -# CONFIG_MBEDTLS_SSL_PROTO_GMTSSL1_1 is not set -# CONFIG_MBEDTLS_SSL_PROTO_DTLS is not set -CONFIG_MBEDTLS_SSL_ALPN=y -CONFIG_MBEDTLS_CLIENT_SSL_SESSION_TICKETS=y -CONFIG_MBEDTLS_SERVER_SSL_SESSION_TICKETS=y - -# -# Symmetric Ciphers -# -CONFIG_MBEDTLS_AES_C=y -# CONFIG_MBEDTLS_CAMELLIA_C is not set -# CONFIG_MBEDTLS_DES_C is not set -# CONFIG_MBEDTLS_BLOWFISH_C is not set -# CONFIG_MBEDTLS_XTEA_C is not set -CONFIG_MBEDTLS_CCM_C=y -CONFIG_MBEDTLS_GCM_C=y -# CONFIG_MBEDTLS_NIST_KW_C is not set -# end of Symmetric Ciphers - -# CONFIG_MBEDTLS_RIPEMD160_C is not set - -# -# Certificates -# -CONFIG_MBEDTLS_PEM_PARSE_C=y -CONFIG_MBEDTLS_PEM_WRITE_C=y -CONFIG_MBEDTLS_X509_CRL_PARSE_C=y -CONFIG_MBEDTLS_X509_CSR_PARSE_C=y -# end of Certificates - -CONFIG_MBEDTLS_ECP_C=y -CONFIG_MBEDTLS_PK_PARSE_EC_EXTENDED=y -CONFIG_MBEDTLS_PK_PARSE_EC_COMPRESSED=y -# CONFIG_MBEDTLS_DHM_C is not set -CONFIG_MBEDTLS_ECDH_C=y -CONFIG_MBEDTLS_ECDSA_C=y -# CONFIG_MBEDTLS_ECJPAKE_C is not set -CONFIG_MBEDTLS_ECP_DP_SECP192R1_ENABLED=y -CONFIG_MBEDTLS_ECP_DP_SECP224R1_ENABLED=y -CONFIG_MBEDTLS_ECP_DP_SECP256R1_ENABLED=y -CONFIG_MBEDTLS_ECP_DP_SECP384R1_ENABLED=y -CONFIG_MBEDTLS_ECP_DP_SECP521R1_ENABLED=y -CONFIG_MBEDTLS_ECP_DP_SECP192K1_ENABLED=y -CONFIG_MBEDTLS_ECP_DP_SECP224K1_ENABLED=y -CONFIG_MBEDTLS_ECP_DP_SECP256K1_ENABLED=y -CONFIG_MBEDTLS_ECP_DP_BP256R1_ENABLED=y -CONFIG_MBEDTLS_ECP_DP_BP384R1_ENABLED=y -CONFIG_MBEDTLS_ECP_DP_BP512R1_ENABLED=y -CONFIG_MBEDTLS_ECP_DP_CURVE25519_ENABLED=y -CONFIG_MBEDTLS_ECP_NIST_OPTIM=y -# CONFIG_MBEDTLS_ECP_FIXED_POINT_OPTIM is not set -# CONFIG_MBEDTLS_POLY1305_C is not set -# CONFIG_MBEDTLS_CHACHA20_C is not set -# CONFIG_MBEDTLS_HKDF_C is not set -# CONFIG_MBEDTLS_THREADING_C is not set -CONFIG_MBEDTLS_ERROR_STRINGS=y -CONFIG_MBEDTLS_FS_IO=y -# CONFIG_MBEDTLS_ALLOW_WEAK_CERTIFICATE_VERIFICATION is not set -# end of mbedTLS - -# -# ESP-MQTT Configurations -# -CONFIG_MQTT_PROTOCOL_311=y -# CONFIG_MQTT_PROTOCOL_5 is not set -CONFIG_MQTT_TRANSPORT_SSL=y -CONFIG_MQTT_TRANSPORT_WEBSOCKET=y -CONFIG_MQTT_TRANSPORT_WEBSOCKET_SECURE=y -# CONFIG_MQTT_MSG_ID_INCREMENTAL is not set -# CONFIG_MQTT_SKIP_PUBLISH_IF_DISCONNECTED is not set -# CONFIG_MQTT_REPORT_DELETED_MESSAGES is not set -# CONFIG_MQTT_USE_CUSTOM_CONFIG is not set -# CONFIG_MQTT_TASK_CORE_SELECTION_ENABLED is not set -# CONFIG_MQTT_CUSTOM_OUTBOX is not set -# end of ESP-MQTT Configurations - -# -# LibC -# -CONFIG_LIBC_NEWLIB=y -CONFIG_LIBC_MISC_IN_IRAM=y -CONFIG_LIBC_LOCKS_PLACE_IN_IRAM=y -CONFIG_LIBC_STDOUT_LINE_ENDING_CRLF=y -# CONFIG_LIBC_STDOUT_LINE_ENDING_LF is not set -# CONFIG_LIBC_STDOUT_LINE_ENDING_CR is not set -# CONFIG_LIBC_STDIN_LINE_ENDING_CRLF is not set -# CONFIG_LIBC_STDIN_LINE_ENDING_LF is not set -CONFIG_LIBC_STDIN_LINE_ENDING_CR=y -# CONFIG_LIBC_NEWLIB_NANO_FORMAT is not set -CONFIG_LIBC_TIME_SYSCALL_USE_RTC_HRT=y -# CONFIG_LIBC_TIME_SYSCALL_USE_RTC is not set -# CONFIG_LIBC_TIME_SYSCALL_USE_HRT is not set -# CONFIG_LIBC_TIME_SYSCALL_USE_NONE is not set -# end of LibC - -CONFIG_STDATOMIC_S32C1I_SPIRAM_WORKAROUND=y - -# -# NVS -# -# CONFIG_NVS_ENCRYPTION is not set -# CONFIG_NVS_ASSERT_ERROR_CHECK is not set -# CONFIG_NVS_LEGACY_DUP_KEYS_COMPATIBILITY is not set -# CONFIG_NVS_ALLOCATE_CACHE_IN_SPIRAM is not set -# end of NVS - -# -# OpenThread -# -# CONFIG_OPENTHREAD_ENABLED is not set - -# -# OpenThread Spinel -# -# CONFIG_OPENTHREAD_SPINEL_ONLY is not set -# end of OpenThread Spinel -# end of OpenThread - -# -# Protocomm -# -CONFIG_ESP_PROTOCOMM_SUPPORT_SECURITY_VERSION_0=y -CONFIG_ESP_PROTOCOMM_SUPPORT_SECURITY_VERSION_1=y -CONFIG_ESP_PROTOCOMM_SUPPORT_SECURITY_VERSION_2=y -CONFIG_ESP_PROTOCOMM_SUPPORT_SECURITY_PATCH_VERSION=y -# end of Protocomm - -# -# PThreads -# -CONFIG_PTHREAD_TASK_PRIO_DEFAULT=5 -CONFIG_PTHREAD_TASK_STACK_SIZE_DEFAULT=3072 -CONFIG_PTHREAD_STACK_MIN=768 -CONFIG_PTHREAD_DEFAULT_CORE_NO_AFFINITY=y -# CONFIG_PTHREAD_DEFAULT_CORE_0 is not set -# CONFIG_PTHREAD_DEFAULT_CORE_1 is not set -CONFIG_PTHREAD_TASK_CORE_DEFAULT=-1 -CONFIG_PTHREAD_TASK_NAME_DEFAULT="pthread" -# end of PThreads - -# -# MMU Config -# -CONFIG_MMU_PAGE_SIZE_64KB=y -CONFIG_MMU_PAGE_MODE="64KB" -CONFIG_MMU_PAGE_SIZE=0x10000 -# end of MMU Config - -# -# Main Flash configuration -# - -# -# SPI Flash behavior when brownout -# -CONFIG_SPI_FLASH_BROWNOUT_RESET_XMC=y -CONFIG_SPI_FLASH_BROWNOUT_RESET=y -# end of SPI Flash behavior when brownout - -# -# Optional and Experimental Features (READ DOCS FIRST) -# - -# -# Features here require specific hardware (READ DOCS FIRST!) -# -# CONFIG_SPI_FLASH_HPM_ENA is not set -CONFIG_SPI_FLASH_HPM_AUTO=y -# CONFIG_SPI_FLASH_HPM_DIS is not set -CONFIG_SPI_FLASH_HPM_ON=y -CONFIG_SPI_FLASH_HPM_DC_AUTO=y -# CONFIG_SPI_FLASH_HPM_DC_DISABLE is not set -# CONFIG_SPI_FLASH_AUTO_SUSPEND is not set -CONFIG_SPI_FLASH_SUSPEND_TSUS_VAL_US=50 -# CONFIG_SPI_FLASH_FORCE_ENABLE_XMC_C_SUSPEND is not set -# CONFIG_SPI_FLASH_FORCE_ENABLE_C6_H2_SUSPEND is not set -CONFIG_SPI_FLASH_PLACE_FUNCTIONS_IN_IRAM=y -# end of Optional and Experimental Features (READ DOCS FIRST) -# end of Main Flash configuration - -# -# SPI Flash driver -# -# CONFIG_SPI_FLASH_VERIFY_WRITE is not set -# CONFIG_SPI_FLASH_ENABLE_COUNTERS is not set -CONFIG_SPI_FLASH_ROM_DRIVER_PATCH=y -# CONFIG_SPI_FLASH_ROM_IMPL is not set -CONFIG_SPI_FLASH_DANGEROUS_WRITE_ABORTS=y -# CONFIG_SPI_FLASH_DANGEROUS_WRITE_FAILS is not set -# CONFIG_SPI_FLASH_DANGEROUS_WRITE_ALLOWED is not set -# CONFIG_SPI_FLASH_BYPASS_BLOCK_ERASE is not set -CONFIG_SPI_FLASH_YIELD_DURING_ERASE=y -CONFIG_SPI_FLASH_ERASE_YIELD_DURATION_MS=20 -CONFIG_SPI_FLASH_ERASE_YIELD_TICKS=1 -CONFIG_SPI_FLASH_WRITE_CHUNK_SIZE=8192 -# CONFIG_SPI_FLASH_SIZE_OVERRIDE is not set -# CONFIG_SPI_FLASH_CHECK_ERASE_TIMEOUT_DISABLED is not set -# CONFIG_SPI_FLASH_OVERRIDE_CHIP_DRIVER_LIST is not set - -# -# Auto-detect flash chips -# -CONFIG_SPI_FLASH_VENDOR_XMC_SUPPORT_ENABLED=y -CONFIG_SPI_FLASH_VENDOR_GD_SUPPORT_ENABLED=y -CONFIG_SPI_FLASH_VENDOR_ISSI_SUPPORT_ENABLED=y -CONFIG_SPI_FLASH_VENDOR_MXIC_SUPPORT_ENABLED=y -CONFIG_SPI_FLASH_VENDOR_WINBOND_SUPPORT_ENABLED=y -CONFIG_SPI_FLASH_VENDOR_BOYA_SUPPORT_ENABLED=y -CONFIG_SPI_FLASH_VENDOR_TH_SUPPORT_ENABLED=y -CONFIG_SPI_FLASH_SUPPORT_ISSI_CHIP=y -CONFIG_SPI_FLASH_SUPPORT_MXIC_CHIP=y -CONFIG_SPI_FLASH_SUPPORT_GD_CHIP=y -CONFIG_SPI_FLASH_SUPPORT_WINBOND_CHIP=y -CONFIG_SPI_FLASH_SUPPORT_BOYA_CHIP=y -CONFIG_SPI_FLASH_SUPPORT_TH_CHIP=y -CONFIG_SPI_FLASH_SUPPORT_MXIC_OPI_CHIP=y -# end of Auto-detect flash chips - -CONFIG_SPI_FLASH_ENABLE_ENCRYPTED_READ_WRITE=y -# end of SPI Flash driver - -# -# SPIFFS Configuration -# -CONFIG_SPIFFS_MAX_PARTITIONS=3 - -# -# SPIFFS Cache Configuration -# -CONFIG_SPIFFS_CACHE=y -CONFIG_SPIFFS_CACHE_WR=y -# CONFIG_SPIFFS_CACHE_STATS is not set -# end of SPIFFS Cache Configuration - -CONFIG_SPIFFS_PAGE_CHECK=y -CONFIG_SPIFFS_GC_MAX_RUNS=10 -# CONFIG_SPIFFS_GC_STATS is not set -CONFIG_SPIFFS_PAGE_SIZE=256 -CONFIG_SPIFFS_OBJ_NAME_LEN=32 -# CONFIG_SPIFFS_FOLLOW_SYMLINKS is not set -CONFIG_SPIFFS_USE_MAGIC=y -CONFIG_SPIFFS_USE_MAGIC_LENGTH=y -CONFIG_SPIFFS_META_LENGTH=4 -CONFIG_SPIFFS_USE_MTIME=y - -# -# Debug Configuration -# -# CONFIG_SPIFFS_DBG is not set -# CONFIG_SPIFFS_API_DBG is not set -# CONFIG_SPIFFS_GC_DBG is not set -# CONFIG_SPIFFS_CACHE_DBG is not set -# CONFIG_SPIFFS_CHECK_DBG is not set -# CONFIG_SPIFFS_TEST_VISUALISATION is not set -# end of Debug Configuration -# end of SPIFFS Configuration - -# -# TCP Transport -# - -# -# Websocket -# -CONFIG_WS_TRANSPORT=y -CONFIG_WS_BUFFER_SIZE=1024 -# CONFIG_WS_DYNAMIC_BUFFER is not set -# end of Websocket -# end of TCP Transport - -# -# Ultra Low Power (ULP) Co-processor -# -# CONFIG_ULP_COPROC_ENABLED is not set - -# -# ULP Debugging Options -# -# end of ULP Debugging Options -# end of Ultra Low Power (ULP) Co-processor - -# -# Unity unit testing library -# -CONFIG_UNITY_ENABLE_FLOAT=y -CONFIG_UNITY_ENABLE_DOUBLE=y -# CONFIG_UNITY_ENABLE_64BIT is not set -# CONFIG_UNITY_ENABLE_COLOR is not set -CONFIG_UNITY_ENABLE_IDF_TEST_RUNNER=y -# CONFIG_UNITY_ENABLE_FIXTURE is not set -# CONFIG_UNITY_ENABLE_BACKTRACE_ON_FAIL is not set -# CONFIG_UNITY_TEST_ORDER_BY_FILE_PATH_AND_LINE is not set -# end of Unity unit testing library - -# -# USB-OTG -# -CONFIG_USB_HOST_CONTROL_TRANSFER_MAX_SIZE=256 -CONFIG_USB_HOST_HW_BUFFER_BIAS_BALANCED=y -# CONFIG_USB_HOST_HW_BUFFER_BIAS_IN is not set -# CONFIG_USB_HOST_HW_BUFFER_BIAS_PERIODIC_OUT is not set - -# -# Hub Driver Configuration -# - -# -# Root Port configuration -# -CONFIG_USB_HOST_DEBOUNCE_DELAY_MS=250 -CONFIG_USB_HOST_RESET_HOLD_MS=30 -CONFIG_USB_HOST_RESET_RECOVERY_MS=30 -CONFIG_USB_HOST_SET_ADDR_RECOVERY_MS=10 -# end of Root Port configuration - -# CONFIG_USB_HOST_HUBS_SUPPORTED is not set -# end of Hub Driver Configuration - -# CONFIG_USB_HOST_ENABLE_ENUM_FILTER_CALLBACK is not set -CONFIG_USB_OTG_SUPPORTED=y -# end of USB-OTG - -# -# Virtual file system -# -CONFIG_VFS_SUPPORT_IO=y -CONFIG_VFS_SUPPORT_DIR=y -CONFIG_VFS_SUPPORT_SELECT=y -CONFIG_VFS_SUPPRESS_SELECT_DEBUG_OUTPUT=y -# CONFIG_VFS_SELECT_IN_RAM is not set -CONFIG_VFS_SUPPORT_TERMIOS=y -CONFIG_VFS_MAX_COUNT=8 - -# -# Host File System I/O (Semihosting) -# -CONFIG_VFS_SEMIHOSTFS_MAX_MOUNT_POINTS=1 -# end of Host File System I/O (Semihosting) - -CONFIG_VFS_INITIALIZE_DEV_NULL=y -# end of Virtual file system - -# -# Wear Levelling -# -# CONFIG_WL_SECTOR_SIZE_512 is not set -CONFIG_WL_SECTOR_SIZE_4096=y -CONFIG_WL_SECTOR_SIZE=4096 -# end of Wear Levelling - -# -# Wi-Fi Provisioning Manager -# -CONFIG_WIFI_PROV_SCAN_MAX_ENTRIES=16 -CONFIG_WIFI_PROV_AUTOSTOP_TIMEOUT=30 -# CONFIG_WIFI_PROV_BLE_BONDING is not set -CONFIG_WIFI_PROV_BLE_SEC_CONN=y -# CONFIG_WIFI_PROV_BLE_FORCE_ENCRYPTION is not set -# CONFIG_WIFI_PROV_BLE_NOTIFY is not set -# CONFIG_WIFI_PROV_KEEP_BLE_ON_AFTER_PROV is not set -CONFIG_WIFI_PROV_STA_ALL_CHANNEL_SCAN=y -# CONFIG_WIFI_PROV_STA_FAST_SCAN is not set -# end of Wi-Fi Provisioning Manager - -# -# TinyUSB Stack -# -CONFIG_TINYUSB_DEBUG_LEVEL=1 -CONFIG_TINYUSB_RHPORT_FS=y - -# -# TinyUSB DCD -# -# CONFIG_TINYUSB_MODE_SLAVE is not set -CONFIG_TINYUSB_MODE_DMA=y -# end of TinyUSB DCD - -# -# TinyUSB task configuration -# -# CONFIG_TINYUSB_NO_DEFAULT_TASK is not set -CONFIG_TINYUSB_TASK_PRIORITY=5 -CONFIG_TINYUSB_TASK_STACK_SIZE=4096 -# CONFIG_TINYUSB_TASK_AFFINITY_NO_AFFINITY is not set -# CONFIG_TINYUSB_TASK_AFFINITY_CPU0 is not set -CONFIG_TINYUSB_TASK_AFFINITY_CPU1=y -CONFIG_TINYUSB_TASK_AFFINITY=0x1 -# CONFIG_TINYUSB_INIT_IN_DEFAULT_TASK is not set -# end of TinyUSB task configuration - -# -# Descriptor configuration -# - -# -# You can provide your custom descriptors via tinyusb_driver_install() -# -CONFIG_TINYUSB_DESC_USE_ESPRESSIF_VID=y -CONFIG_TINYUSB_DESC_USE_DEFAULT_PID=y -CONFIG_TINYUSB_DESC_BCD_DEVICE=0x0100 -CONFIG_TINYUSB_DESC_MANUFACTURER_STRING="Espressif Systems" -CONFIG_TINYUSB_DESC_PRODUCT_STRING="Espressif Device" -CONFIG_TINYUSB_DESC_SERIAL_STRING="123456" -# end of Descriptor configuration - -# -# Massive Storage Class (MSC) -# -# CONFIG_TINYUSB_MSC_ENABLED is not set - -# -# TinyUSB FAT Format Options -# -CONFIG_TINYUSB_FAT_FORMAT_ANY=y -# CONFIG_TINYUSB_FAT_FORMAT_FAT is not set -# CONFIG_TINYUSB_FAT_FORMAT_FAT32 is not set -# CONFIG_TINYUSB_FAT_FORMAT_EXFAT is not set -# CONFIG_TINYUSB_FAT_FORMAT_SFD is not set -# end of TinyUSB FAT Format Options -# end of Massive Storage Class (MSC) - -# -# Communication Device Class (CDC) -# -# CONFIG_TINYUSB_CDC_ENABLED is not set -# end of Communication Device Class (CDC) - -# -# Musical Instrument Digital Interface (MIDI) -# -CONFIG_TINYUSB_MIDI_COUNT=0 -# end of Musical Instrument Digital Interface (MIDI) - -# -# Human Interface Device Class (HID) -# -CONFIG_TINYUSB_HID_COUNT=2 -# end of Human Interface Device Class (HID) - -# -# Device Firmware Upgrade (DFU) -# -# CONFIG_TINYUSB_DFU_MODE_DFU is not set -# CONFIG_TINYUSB_DFU_MODE_DFU_RUNTIME is not set -CONFIG_TINYUSB_DFU_MODE_NONE=y -# end of Device Firmware Upgrade (DFU) - -# -# Bluetooth Host Class (BTH) -# -# CONFIG_TINYUSB_BTH_ENABLED is not set -# end of Bluetooth Host Class (BTH) - -# -# Network driver (ECM/NCM/RNDIS) -# -# CONFIG_TINYUSB_NET_MODE_ECM_RNDIS is not set -# CONFIG_TINYUSB_NET_MODE_NCM is not set -CONFIG_TINYUSB_NET_MODE_NONE=y -# end of Network driver (ECM/NCM/RNDIS) - -# -# Vendor Specific Interface -# -CONFIG_TINYUSB_VENDOR_COUNT=0 -# end of Vendor Specific Interface -# end of TinyUSB Stack - -# -# LittleFS -# -CONFIG_LITTLEFS_SDMMC_SUPPORT=y -CONFIG_LITTLEFS_MAX_PARTITIONS=3 -CONFIG_LITTLEFS_PAGE_SIZE=256 -CONFIG_LITTLEFS_OBJ_NAME_LEN=64 -CONFIG_LITTLEFS_READ_SIZE=128 -CONFIG_LITTLEFS_WRITE_SIZE=128 -CONFIG_LITTLEFS_LOOKAHEAD_SIZE=128 -CONFIG_LITTLEFS_CACHE_SIZE=512 -CONFIG_LITTLEFS_BLOCK_CYCLES=512 -CONFIG_LITTLEFS_USE_MTIME=y -# CONFIG_LITTLEFS_USE_ONLY_HASH is not set -# CONFIG_LITTLEFS_HUMAN_READABLE is not set -CONFIG_LITTLEFS_MTIME_USE_SECONDS=y -# CONFIG_LITTLEFS_MTIME_USE_NONCE is not set -# CONFIG_LITTLEFS_SPIFFS_COMPAT is not set -# CONFIG_LITTLEFS_FLUSH_FILE_EVERY_WRITE is not set -# CONFIG_LITTLEFS_FCNTL_GET_PATH is not set -# CONFIG_LITTLEFS_MULTIVERSION is not set -# CONFIG_LITTLEFS_MALLOC_STRATEGY_DISABLE is not set -CONFIG_LITTLEFS_MALLOC_STRATEGY_DEFAULT=y -# CONFIG_LITTLEFS_MALLOC_STRATEGY_INTERNAL is not set -# CONFIG_LITTLEFS_MALLOC_STRATEGY_SPIRAM is not set -CONFIG_LITTLEFS_ASSERTS=y -# CONFIG_LITTLEFS_MMAP_PARTITION is not set -# CONFIG_LITTLEFS_WDT_RESET is not set -# end of LittleFS - -# -# LVGL configuration -# -CONFIG_LV_CONF_SKIP=y -# CONFIG_LV_CONF_MINIMAL is not set - -# -# Color Settings -# -# CONFIG_LV_COLOR_DEPTH_32 is not set -# CONFIG_LV_COLOR_DEPTH_24 is not set -CONFIG_LV_COLOR_DEPTH_16=y -# CONFIG_LV_COLOR_DEPTH_8 is not set -# CONFIG_LV_COLOR_DEPTH_1 is not set -CONFIG_LV_COLOR_DEPTH=16 -# end of Color Settings - -# -# Memory Settings -# -CONFIG_LV_USE_BUILTIN_MALLOC=y -# CONFIG_LV_USE_CLIB_MALLOC is not set -# CONFIG_LV_USE_MICROPYTHON_MALLOC is not set -# CONFIG_LV_USE_RTTHREAD_MALLOC is not set -# CONFIG_LV_USE_CUSTOM_MALLOC is not set -CONFIG_LV_USE_BUILTIN_STRING=y -# CONFIG_LV_USE_CLIB_STRING is not set -# CONFIG_LV_USE_CUSTOM_STRING is not set -CONFIG_LV_USE_BUILTIN_SPRINTF=y -# CONFIG_LV_USE_CLIB_SPRINTF is not set -# CONFIG_LV_USE_CUSTOM_SPRINTF is not set -CONFIG_LV_MEM_SIZE_KILOBYTES=64 -CONFIG_LV_MEM_POOL_EXPAND_SIZE_KILOBYTES=0 -CONFIG_LV_MEM_ADR=0x0 -# end of Memory Settings - -# -# HAL Settings -# -CONFIG_LV_DEF_REFR_PERIOD=33 -CONFIG_LV_DPI_DEF=130 -# end of HAL Settings - -# -# Operating System (OS) -# -CONFIG_LV_OS_NONE=y -# CONFIG_LV_OS_PTHREAD is not set -# CONFIG_LV_OS_FREERTOS is not set -# CONFIG_LV_OS_CMSIS_RTOS2 is not set -# CONFIG_LV_OS_RTTHREAD is not set -# CONFIG_LV_OS_WINDOWS is not set -# CONFIG_LV_OS_MQX is not set -# CONFIG_LV_OS_SDL2 is not set -# CONFIG_LV_OS_CUSTOM is not set -# end of Operating System (OS) - -# -# Rendering Configuration -# -CONFIG_LV_DRAW_BUF_STRIDE_ALIGN=1 -CONFIG_LV_DRAW_BUF_ALIGN=4 -CONFIG_LV_DRAW_LAYER_SIMPLE_BUF_SIZE=24576 -CONFIG_LV_DRAW_LAYER_MAX_MEMORY=0 -CONFIG_LV_USE_DRAW_SW=y -CONFIG_LV_DRAW_SW_SUPPORT_RGB565=y -CONFIG_LV_DRAW_SW_SUPPORT_RGB565A8=y -CONFIG_LV_DRAW_SW_SUPPORT_RGB888=y -CONFIG_LV_DRAW_SW_SUPPORT_XRGB8888=y -CONFIG_LV_DRAW_SW_SUPPORT_ARGB8888=y -CONFIG_LV_DRAW_SW_SUPPORT_ARGB8888_PREMULTIPLIED=y -CONFIG_LV_DRAW_SW_SUPPORT_L8=y -CONFIG_LV_DRAW_SW_SUPPORT_AL88=y -CONFIG_LV_DRAW_SW_SUPPORT_A8=y -CONFIG_LV_DRAW_SW_SUPPORT_I1=y -CONFIG_LV_DRAW_SW_I1_LUM_THRESHOLD=127 -CONFIG_LV_DRAW_SW_DRAW_UNIT_CNT=1 -# CONFIG_LV_USE_DRAW_ARM2D_SYNC is not set -# CONFIG_LV_USE_NATIVE_HELIUM_ASM is not set -CONFIG_LV_DRAW_SW_COMPLEX=y -# CONFIG_LV_USE_DRAW_SW_COMPLEX_GRADIENTS is not set -CONFIG_LV_DRAW_SW_SHADOW_CACHE_SIZE=0 -CONFIG_LV_DRAW_SW_CIRCLE_CACHE_SIZE=4 -CONFIG_LV_DRAW_SW_ASM_NONE=y -# CONFIG_LV_DRAW_SW_ASM_NEON is not set -# CONFIG_LV_DRAW_SW_ASM_HELIUM is not set -# CONFIG_LV_DRAW_SW_ASM_CUSTOM is not set -CONFIG_LV_USE_DRAW_SW_ASM=0 -# CONFIG_LV_USE_PXP is not set -# CONFIG_LV_USE_G2D is not set -# CONFIG_LV_USE_DRAW_DAVE2D is not set -# CONFIG_LV_USE_DRAW_SDL is not set -# CONFIG_LV_USE_DRAW_VG_LITE is not set -# CONFIG_LV_USE_VECTOR_GRAPHIC is not set -# CONFIG_LV_USE_DRAW_DMA2D is not set -# CONFIG_LV_USE_PPA is not set -# CONFIG_LV_USE_DRAW_EVE is not set -# end of Rendering Configuration - -# -# Feature Configuration -# - -# -# Logging -# -# CONFIG_LV_USE_LOG is not set -# end of Logging - -# -# Asserts -# -CONFIG_LV_USE_ASSERT_NULL=y -CONFIG_LV_USE_ASSERT_MALLOC=y -# CONFIG_LV_USE_ASSERT_STYLE is not set -# CONFIG_LV_USE_ASSERT_MEM_INTEGRITY is not set -# CONFIG_LV_USE_ASSERT_OBJ is not set -CONFIG_LV_ASSERT_HANDLER_INCLUDE="assert.h" -# end of Asserts - -# -# Debug -# -# CONFIG_LV_USE_REFR_DEBUG is not set -# CONFIG_LV_USE_LAYER_DEBUG is not set -# CONFIG_LV_USE_PARALLEL_DRAW_DEBUG is not set -# end of Debug - -# -# Others -# -# CONFIG_LV_ENABLE_GLOBAL_CUSTOM is not set -CONFIG_LV_CACHE_DEF_SIZE=0 -CONFIG_LV_IMAGE_HEADER_CACHE_DEF_CNT=0 -CONFIG_LV_GRADIENT_MAX_STOPS=2 -CONFIG_LV_COLOR_MIX_ROUND_OFS=128 -# CONFIG_LV_OBJ_STYLE_CACHE is not set -# CONFIG_LV_USE_OBJ_ID is not set -# CONFIG_LV_USE_OBJ_NAME is not set -# CONFIG_LV_USE_OBJ_PROPERTY is not set -# end of Others -# end of Feature Configuration - -# -# Compiler Settings -# -# CONFIG_LV_BIG_ENDIAN_SYSTEM is not set -CONFIG_LV_ATTRIBUTE_MEM_ALIGN_SIZE=1 -# CONFIG_LV_ATTRIBUTE_FAST_MEM_USE_IRAM is not set -# CONFIG_LV_USE_FLOAT is not set -# CONFIG_LV_USE_MATRIX is not set -# CONFIG_LV_USE_PRIVATE_API is not set -# end of Compiler Settings - -# -# Font Usage -# - -# -# Enable built-in fonts -# -# CONFIG_LV_FONT_MONTSERRAT_8 is not set -CONFIG_LV_FONT_MONTSERRAT_10=y -CONFIG_LV_FONT_MONTSERRAT_12=y -CONFIG_LV_FONT_MONTSERRAT_14=y -# CONFIG_LV_FONT_MONTSERRAT_16 is not set -# CONFIG_LV_FONT_MONTSERRAT_18 is not set -# CONFIG_LV_FONT_MONTSERRAT_20 is not set -# CONFIG_LV_FONT_MONTSERRAT_22 is not set -# CONFIG_LV_FONT_MONTSERRAT_24 is not set -# CONFIG_LV_FONT_MONTSERRAT_26 is not set -# CONFIG_LV_FONT_MONTSERRAT_28 is not set -# CONFIG_LV_FONT_MONTSERRAT_30 is not set -# CONFIG_LV_FONT_MONTSERRAT_32 is not set -# CONFIG_LV_FONT_MONTSERRAT_34 is not set -# CONFIG_LV_FONT_MONTSERRAT_36 is not set -# CONFIG_LV_FONT_MONTSERRAT_38 is not set -# CONFIG_LV_FONT_MONTSERRAT_40 is not set -# CONFIG_LV_FONT_MONTSERRAT_42 is not set -# CONFIG_LV_FONT_MONTSERRAT_44 is not set -# CONFIG_LV_FONT_MONTSERRAT_46 is not set -# CONFIG_LV_FONT_MONTSERRAT_48 is not set -# CONFIG_LV_FONT_MONTSERRAT_28_COMPRESSED is not set -# CONFIG_LV_FONT_DEJAVU_16_PERSIAN_HEBREW is not set -# CONFIG_LV_FONT_SOURCE_HAN_SANS_SC_14_CJK is not set -# CONFIG_LV_FONT_SOURCE_HAN_SANS_SC_16_CJK is not set -# CONFIG_LV_FONT_UNSCII_8 is not set -# CONFIG_LV_FONT_UNSCII_16 is not set -# end of Enable built-in fonts - -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_8 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_10 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_12 is not set -CONFIG_LV_FONT_DEFAULT_MONTSERRAT_14=y -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_16 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_18 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_20 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_22 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_24 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_26 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_28 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_30 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_32 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_34 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_36 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_38 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_40 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_42 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_44 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_46 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_48 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_28_COMPRESSED is not set -# CONFIG_LV_FONT_DEFAULT_DEJAVU_16_PERSIAN_HEBREW is not set -# CONFIG_LV_FONT_DEFAULT_SOURCE_HAN_SANS_SC_14_CJK is not set -# CONFIG_LV_FONT_DEFAULT_SOURCE_HAN_SANS_SC_16_CJK is not set -# CONFIG_LV_FONT_DEFAULT_UNSCII_8 is not set -# CONFIG_LV_FONT_DEFAULT_UNSCII_16 is not set -# CONFIG_LV_FONT_FMT_TXT_LARGE is not set -# CONFIG_LV_USE_FONT_COMPRESSED is not set -CONFIG_LV_USE_FONT_PLACEHOLDER=y - -# -# Enable static fonts -# -# end of Enable static fonts -# end of Font Usage - -# -# Text Settings -# -CONFIG_LV_TXT_ENC_UTF8=y -# CONFIG_LV_TXT_ENC_ASCII is not set -CONFIG_LV_TXT_BREAK_CHARS=" ,.;:-_)}" -CONFIG_LV_TXT_LINE_BREAK_LONG_LEN=0 -CONFIG_LV_TXT_COLOR_CMD="#" -# CONFIG_LV_USE_BIDI is not set -# CONFIG_LV_USE_ARABIC_PERSIAN_CHARS is not set -# end of Text Settings - -# -# Widget Usage -# -CONFIG_LV_WIDGETS_HAS_DEFAULT_VALUE=y -CONFIG_LV_USE_ANIMIMG=y -CONFIG_LV_USE_ARC=y -CONFIG_LV_USE_ARCLABEL=y -CONFIG_LV_USE_BAR=y -CONFIG_LV_USE_BUTTON=y -CONFIG_LV_USE_BUTTONMATRIX=y -CONFIG_LV_USE_CALENDAR=y -# CONFIG_LV_CALENDAR_WEEK_STARTS_MONDAY is not set - -# -# Days name configuration -# -CONFIG_LV_MONDAY_STR="Mo" -CONFIG_LV_TUESDAY_STR="Tu" -CONFIG_LV_WEDNESDAY_STR="We" -CONFIG_LV_THURSDAY_STR="Th" -CONFIG_LV_FRIDAY_STR="Fr" -CONFIG_LV_SATURDAY_STR="Sa" -CONFIG_LV_SUNDAY_STR="Su" -# end of Days name configuration - -CONFIG_LV_USE_CALENDAR_HEADER_ARROW=y -CONFIG_LV_USE_CALENDAR_HEADER_DROPDOWN=y -# CONFIG_LV_USE_CALENDAR_CHINESE is not set -CONFIG_LV_USE_CANVAS=y -CONFIG_LV_USE_CHART=y -CONFIG_LV_USE_CHECKBOX=y -CONFIG_LV_USE_DROPDOWN=y -CONFIG_LV_USE_IMAGE=y -CONFIG_LV_USE_IMAGEBUTTON=y -CONFIG_LV_USE_KEYBOARD=y -CONFIG_LV_USE_LABEL=y -CONFIG_LV_LABEL_TEXT_SELECTION=y -CONFIG_LV_LABEL_LONG_TXT_HINT=y -CONFIG_LV_LABEL_WAIT_CHAR_COUNT=3 -CONFIG_LV_USE_LED=y -CONFIG_LV_USE_LINE=y -CONFIG_LV_USE_LIST=y -CONFIG_LV_USE_MENU=y -CONFIG_LV_USE_MSGBOX=y -CONFIG_LV_USE_ROLLER=y -CONFIG_LV_USE_SCALE=y -CONFIG_LV_USE_SLIDER=y -CONFIG_LV_USE_SPAN=y -CONFIG_LV_SPAN_SNIPPET_STACK_SIZE=64 -CONFIG_LV_USE_SPINBOX=y -CONFIG_LV_USE_SPINNER=y -CONFIG_LV_USE_SWITCH=y -CONFIG_LV_USE_TEXTAREA=y -CONFIG_LV_TEXTAREA_DEF_PWD_SHOW_TIME=1500 -CONFIG_LV_USE_TABLE=y -CONFIG_LV_USE_TABVIEW=y -CONFIG_LV_USE_TILEVIEW=y -CONFIG_LV_USE_WIN=y -# end of Widget Usage - -# -# Themes -# -CONFIG_LV_USE_THEME_DEFAULT=y -# CONFIG_LV_THEME_DEFAULT_DARK is not set -CONFIG_LV_THEME_DEFAULT_GROW=y -CONFIG_LV_THEME_DEFAULT_TRANSITION_TIME=80 -CONFIG_LV_USE_THEME_SIMPLE=y -# CONFIG_LV_USE_THEME_MONO is not set -# end of Themes - -# -# Layouts -# -CONFIG_LV_USE_FLEX=y -CONFIG_LV_USE_GRID=y -# end of Layouts - -# -# 3rd Party Libraries -# -CONFIG_LV_FS_DEFAULT_DRIVER_LETTER=65 -CONFIG_LV_USE_FS_STDIO=y -CONFIG_LV_FS_STDIO_LETTER=65 -CONFIG_LV_FS_STDIO_PATH="/assets" -CONFIG_LV_FS_STDIO_CACHE_SIZE=4096 -# CONFIG_LV_USE_FS_POSIX is not set -# CONFIG_LV_USE_FS_WIN32 is not set -# CONFIG_LV_USE_FS_FATFS is not set -# CONFIG_LV_USE_FS_MEMFS is not set -# CONFIG_LV_USE_FS_LITTLEFS is not set -# CONFIG_LV_USE_FS_ARDUINO_ESP_LITTLEFS is not set -# CONFIG_LV_USE_FS_ARDUINO_SD is not set -# CONFIG_LV_USE_FS_UEFI is not set -# CONFIG_LV_USE_FS_FROGFS is not set -CONFIG_LV_USE_LODEPNG=y -# CONFIG_LV_USE_LIBPNG is not set -# CONFIG_LV_USE_BMP is not set -# CONFIG_LV_USE_TJPGD is not set -# CONFIG_LV_USE_LIBJPEG_TURBO is not set -# CONFIG_LV_USE_GIF is not set -# CONFIG_LV_BIN_DECODER_RAM_LOAD is not set -# CONFIG_LV_USE_RLE is not set -# CONFIG_LV_USE_QRCODE is not set -# CONFIG_LV_USE_BARCODE is not set -# CONFIG_LV_USE_FREETYPE is not set -# CONFIG_LV_USE_TINY_TTF is not set -# CONFIG_LV_USE_RLOTTIE is not set -# CONFIG_LV_USE_THORVG is not set -# CONFIG_LV_USE_LZ4 is not set -# CONFIG_LV_USE_FFMPEG is not set -# end of 3rd Party Libraries - -# -# Others -# -# CONFIG_LV_USE_SNAPSHOT is not set -# CONFIG_LV_USE_SYSMON is not set -# CONFIG_LV_USE_PROFILER is not set -# CONFIG_LV_USE_MONKEY is not set -# CONFIG_LV_USE_GRIDNAV is not set -# CONFIG_LV_USE_FRAGMENT is not set -# CONFIG_LV_USE_IMGFONT is not set -CONFIG_LV_USE_OBSERVER=y -# CONFIG_LV_USE_IME_PINYIN is not set -# CONFIG_LV_USE_FILE_EXPLORER is not set -# CONFIG_LV_USE_FONT_MANAGER is not set -# CONFIG_LV_USE_TEST is not set -# CONFIG_LV_USE_TRANSLATION is not set -# CONFIG_LV_USE_XML is not set -# CONFIG_LV_USE_COLOR_FILTER is not set -CONFIG_LVGL_VERSION_MAJOR=9 -CONFIG_LVGL_VERSION_MINOR=4 -CONFIG_LVGL_VERSION_PATCH=0 -# end of Others - -# -# Devices -# -# CONFIG_LV_USE_SDL is not set -# CONFIG_LV_USE_X11 is not set -# CONFIG_LV_USE_WAYLAND is not set -# CONFIG_LV_USE_LINUX_FBDEV is not set -# CONFIG_LV_USE_NUTTX is not set -# CONFIG_LV_USE_LINUX_DRM is not set -# CONFIG_LV_USE_TFT_ESPI is not set -# CONFIG_LV_USE_LOVYAN_GFX is not set -# CONFIG_LV_USE_EVDEV is not set -# CONFIG_LV_USE_LIBINPUT is not set -# CONFIG_LV_USE_ST7735 is not set -# CONFIG_LV_USE_ST7789 is not set -# CONFIG_LV_USE_ST7796 is not set -# CONFIG_LV_USE_ILI9341 is not set -# CONFIG_LV_USE_GENERIC_MIPI is not set -# CONFIG_LV_USE_NXP_ELCDIF is not set -# CONFIG_LV_USE_RENESAS_GLCDC is not set -# CONFIG_LV_USE_ST_LTDC is not set -# CONFIG_LV_USE_FT81X is not set -# CONFIG_LV_USE_UEFI is not set -# CONFIG_LV_USE_OPENGLES is not set -# CONFIG_LV_USE_QNX is not set -# end of Devices - -# -# Examples -# -CONFIG_LV_BUILD_EXAMPLES=y -# end of Examples - -# -# Demos -# -CONFIG_LV_BUILD_DEMOS=y -# CONFIG_LV_USE_DEMO_WIDGETS is not set -# CONFIG_LV_USE_DEMO_KEYPAD_AND_ENCODER is not set -# CONFIG_LV_USE_DEMO_BENCHMARK is not set -# CONFIG_LV_USE_DEMO_RENDER is not set -# CONFIG_LV_USE_DEMO_SCROLL is not set -# CONFIG_LV_USE_DEMO_STRESS is not set -# CONFIG_LV_USE_DEMO_MUSIC is not set -# CONFIG_LV_USE_DEMO_FLEX_LAYOUT is not set -# CONFIG_LV_USE_DEMO_MULTILANG is not set -# CONFIG_LV_USE_DEMO_SMARTWATCH is not set -# CONFIG_LV_USE_DEMO_EBIKE is not set -# CONFIG_LV_USE_DEMO_HIGH_RES is not set -# end of Demos -# end of LVGL configuration -# end of Component config - -# CONFIG_IDF_EXPERIMENTAL_FEATURES is not set diff --git a/firmware_p4/CMakeLists.txt b/firmware_p4/CMakeLists.txt index 526d3a7a..ff113953 100644 --- a/firmware_p4/CMakeLists.txt +++ b/firmware_p4/CMakeLists.txt @@ -6,6 +6,7 @@ cmake_minimum_required(VERSION 3.16) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) +set(IDF_TARGET "esp32p4") include($ENV{IDF_PATH}/tools/cmake/project.cmake) diff --git a/firmware_p4/assets/nfc/dict/mf_classic_default.dic b/firmware_p4/assets/nfc/dict/mf_classic_default.dic new file mode 100644 index 00000000..d4307744 --- /dev/null +++ b/firmware_p4/assets/nfc/dict/mf_classic_default.dic @@ -0,0 +1,113 @@ +# MIFARE Classic default key dictionary +# Format: one 6-byte hex key per line. Lines starting with '#' are comments. +# Shipped read-only in firmware flash partition. Copied to SD on first boot. +# Edit mf_classic_user.dic on the SD card to add your own keys. + +# Factory / blank +FFFFFFFFFFFF +000000000000 + +# MIFARE Application Directory / transport +A0A1A2A3A4A5 +B0B1B2B3B4B5 + +# NDEF (NFC Data Exchange Format) +D3F7D3F7D3F7 + +# Common defaults seen in the wild +A0B0C0D0E0F0 +AABBCCDDEEFF + +# Infineon SLE66R35 documented default +884406301315 + +# MFOC / classic dump community keys +4D3A99C351DD +1A982C7E459A +714C5C886E97 +587EE5F9350F +A0478CC39091 +533CB6C723F6 +8FD0A4F256E9 + +# Numeric increments (legacy defaults) +000000000001 +000000000002 +000000000003 + +# Public databases (mfoc, proxmark, libnfc) +C34BF0364015 +9AB34567AB34 +23404E30D34A +197497C1C931 +ACDDEBC39C03 +EA646723A900 +214F17395B10 +11497C33AFE2 +494634347641 +314556414F3A +1A2B3C4D5E6F +E9824F4A2E4C +D793A752A8B7 +34EEF614CE3A + +# Hex patterns +FF00FF00FF00 +00FF00FF00FF + +# Printable / weak +123456789ABC +ABCDEF123456 +DEADBEEFCAFE +FACEB0071337 +4A6F686E5769 +6B6579313233 + +# Public docs (NXP / EM-Marin / Atmel) +873E1ACF5AA3 +F32172E9892E +40A8E0000000 +BE6A6014963B +D2BA5479E128 +8E517E70F758 +61DA06A055DE +3706587CD936 +29D24142DA17 +572729B27E67 +522757C1B2A1 +834B0327B6AF +287EC565FF5C +1C0EB4C738A3 +4EE482C5F3C5 +1221B43211D4 +963143045A8C +1B755D8761A0 +3B1C3B553488 +884440139C22 +A3DACC6898A3 +8DD40D2A9157 +2705673B7784 +60906C786873 + +# Single-byte +000000000005 +000000000007 +00000000000A +00000000000F +000000000010 +0000000000FF +FFFFFFFFFFFE +FFFFFFFFFFFD + +# Misc +C37AC43DA100 +9C46140AA6B2 +4862CF60ED62 +08B9E7B2A66B +F122D73B0048 +14173723024A +0CF12A80F54A +D3C4FE46A03B +3625953698DA +B8D9A60E274A +7E8545CD23E4 diff --git a/firmware_p4/assets/nfc/dict/mf_classic_user.dic b/firmware_p4/assets/nfc/dict/mf_classic_user.dic new file mode 100644 index 00000000..c0242232 --- /dev/null +++ b/firmware_p4/assets/nfc/dict/mf_classic_user.dic @@ -0,0 +1,6 @@ +# MIFARE Classic user keys +# Add your own 6-byte hex keys here, one per line. Lines starting with '#' are comments. +# Keys discovered automatically during read/crack operations are appended here. +# +# Example: +# 112233445566 diff --git a/firmware_p4/assets/nfc/dict/mf_ulc_default.dic b/firmware_p4/assets/nfc/dict/mf_ulc_default.dic new file mode 100644 index 00000000..d4bbb784 --- /dev/null +++ b/firmware_p4/assets/nfc/dict/mf_ulc_default.dic @@ -0,0 +1,5 @@ +# MIFARE Ultralight C — default 3DES authentication keys (16 bytes each). +# Format: one 16-byte hex key per line. Lines starting with '#' are comments. + +# NXP factory default (all zeros) +00000000000000000000000000000000 diff --git a/firmware_p4/components/Applications/CMakeLists.txt b/firmware_p4/components/Applications/CMakeLists.txt index ed8d49b7..9f291e8e 100644 --- a/firmware_p4/components/Applications/CMakeLists.txt +++ b/firmware_p4/components/Applications/CMakeLists.txt @@ -1,16 +1,17 @@ # Copyright (c) 2025 HIGH CODE LLC # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# TentacleOS is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# http://www.apache.org/licenses/LICENSE-2.0 +# TentacleOS is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# You should have received a copy of the GNU General Public License +# along with TentacleOS. If not, see . file(GLOB_RECURSE UI_SRCS "ui/*.c") file(GLOB_RECURSE BOOT_UI_SRCS "ui/screens/boot/*.c") @@ -67,11 +68,15 @@ file(GLOB_RECURSE BLE_APP_SRCS "bluetooth/*.c") file(GLOB_RECURSE BADUSB_APP_SRCS "bad_usb/*.c") file(GLOB_RECURSE WIFI_APP_SRCS "wifi/*.c") file(GLOB_RECURSE NFC_APP_SRCS "nfc/*.c") +file(GLOB_RECURSE RFID_APP_SRCS "rfid/*.c") +file(GLOB_RECURSE RNODE_APP_SRCS "LoRa/rnode/*.c") idf_component_register(SRCS ${UI_SRCS} ${WIFI_APP_SRCS} ${NFC_APP_SRCS} + ${RFID_APP_SRCS} + ${RNODE_APP_SRCS} ${BADUSB_APP_SRCS} ${BLE_APP_SRCS} "ui/ui_manager.c" @@ -136,6 +141,9 @@ idf_component_register(SRCS "bluetooth/include" "SubGhz/include" "SubGhz/protocols/include" + "rfid/include" + "rfid/protocols/include" + "LoRa/rnode/include" "ui/include" "ui/screens/home/include" "ui/screens/boot/include" @@ -158,10 +166,10 @@ idf_component_register(SRCS "ui/components/chart/include" "ui/components/text_viewer/include" "ui/components/spinner/include" - - REQUIRES + + REQUIRES driver Drivers Service diff --git a/firmware_p4/components/Applications/LoRa/meshcore/include/meshcore.h b/firmware_p4/components/Applications/LoRa/meshcore/include/meshcore.h new file mode 100644 index 00000000..8a3a523a --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/meshcore/include/meshcore.h @@ -0,0 +1,523 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#ifndef MESHCORE_H +#define MESHCORE_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include + +#include "esp_err.h" + +/* Radio defaults (MeshCore wire spec) */ +#define MESHCORE_FREQ_HZ 915000000UL +#define MESHCORE_BW_HZ 250000UL +#define MESHCORE_SF 10 +#define MESHCORE_CR 5 +#define MESHCORE_PREAMBLE_LEN 8 +#define MESHCORE_TX_POWER_DBM 20 + +/* Internal limits */ +#define MESHCORE_MAX_PAYLOAD 184 +#define MESHCORE_MAX_PATH 64 +#define MESHCORE_MAX_RAW 255 +#define MESHCORE_MAX_CONTACTS 32 +#define MESHCORE_MAX_CHANNELS 8 +#define MESHCORE_NAME_MAX 32 +#define MESHCORE_TEXT_MAX 160 + +/* Sentinel for unknown path in ContactInfo.out_path_len */ +#define MESHCORE_OUT_PATH_UNKNOWN 0xFF + +/* Public channel index (default in slot 0) */ +#define MESHCORE_PUBLIC_CHANNEL 0 + +/* ADVERT app_data flags */ +#define MESHCORE_ADV_FLAG_HAS_LATLON 0x10 +#define MESHCORE_ADV_FLAG_HAS_NAME 0x80 + +/** + * @brief MeshCore wire format payload types (4 bits). + * + * See `INFO/Lora_Meshcore_github/.../docs/payloads.md` for the layout of each type. + */ +typedef enum { + MC_PT_REQ = 0x00, + MC_PT_RESPONSE = 0x01, + MC_PT_TXT_MSG = 0x02, + MC_PT_ACK = 0x03, + MC_PT_ADVERT = 0x04, + MC_PT_GRP_TXT = 0x05, + MC_PT_GRP_DATA = 0x06, + MC_PT_ANON_REQ = 0x07, + MC_PT_PATH = 0x08, + MC_PT_TRACE = 0x09, + MC_PT_MULTIPART = 0x0A, + MC_PT_CONTROL = 0x0B, + MC_PT_RAW_CUSTOM = 0x0F, +} meshcore_payload_type_t; + +/** + * @brief MeshCore wire format route types (2 bits). + */ +typedef enum { + MC_RT_TRANSPORT_FLOOD = 0x00, + MC_RT_FLOOD = 0x01, + MC_RT_DIRECT = 0x02, + MC_RT_TRANSPORT_DIRECT = 0x03, +} meshcore_route_type_t; + +/** + * @brief Node types announced in ADVERT (lower 4 bits of flags). + */ +typedef enum { + MC_ADV_TYPE_NONE = 0, + MC_ADV_TYPE_CHAT = 1, + MC_ADV_TYPE_REPEATER = 2, + MC_ADV_TYPE_ROOM = 3, + MC_ADV_TYPE_SENSOR = 4, +} meshcore_adv_type_t; + +/** + * @brief TXT_MSG message sub-type (upper 6 bits of plaintext byte 4). + */ +typedef enum { + MC_TXT_TYPE_PLAIN = 0, + MC_TXT_TYPE_CLI_DATA = 1, + MC_TXT_TYPE_SIGNED_PLAIN = 2, + MC_TXT_TYPE_RESERVED = 3, +} meshcore_txt_type_t; + +/** + * @brief Parsed view of a LoRa packet (pointers into the raw buffer). + * + * The `path` and `payload` pointers point into the original raw buffer. + * The `rssi_dbm` and `snr_db` fields are filled in by the caller. + */ +typedef struct { + uint8_t version; + uint8_t payload_type; + uint8_t route_type; + uint8_t hash_size; + uint8_t path_count; + const uint8_t *path; + uint16_t path_len; + const uint8_t *payload; + uint16_t payload_len; + int16_t rssi_dbm; + int8_t snr_db; +} meshcore_packet_view_t; + +/** + * @brief Node identity (Ed25519 keypair + name + type). + */ +typedef struct { + uint8_t pub_key[32]; + uint8_t priv_key[64]; + char name[MESHCORE_NAME_MAX]; + uint8_t adv_type; +} meshcore_identity_t; + +/** + * @brief Remote contact (mirrors ContactInfo from the companion protocol). + * + * `out_path_len`: encoded path_len byte (`(hash_size-1)<<6 | hop_count`), + * or MESHCORE_OUT_PATH_UNKNOWN (0xFF) if direct path is unknown. + */ +typedef struct { + bool is_used; + uint8_t pub_key[32]; + uint8_t type; + uint8_t flags; + uint8_t out_path_len; + uint8_t out_path[MESHCORE_MAX_PATH]; + char name[MESHCORE_NAME_MAX]; + uint32_t last_advert; + int32_t gps_lat; + int32_t gps_lon; + uint32_t lastmod; +} meshcore_contact_t; + +/** + * @brief Group channel (16B PSK + name). + */ +typedef struct { + bool is_used; + uint8_t hash; + uint8_t secret[16]; + char name[MESHCORE_NAME_MAX]; +} meshcore_channel_t; + +/** + * @brief LoRa radio parameters, persisted in NVS. + */ +typedef struct { + uint32_t freq_hz; + uint32_t bw_hz; + uint8_t sf; + uint8_t cr; + int8_t tx_power_dbm; + uint8_t reserved; +} meshcore_radio_prefs_t; + +/** + * @brief Callback: ADVERT received with valid signature. + * + * @param contact Pointer to the stored contact (valid during callback). + * @param rssi_dbm Packet RSSI in dBm. + * @param snr_db Packet SNR in dB. + * @param ctx Context provided in meshcore_init. + */ +typedef void (*meshcore_on_advert_cb_t)(const meshcore_contact_t *contact, + int16_t rssi_dbm, + int8_t snr_db, + void *ctx); + +/** + * @brief Callback: GRP_TXT decrypted on some local channel. + * + * @param channel_idx Local channel slot that matched (0..MESHCORE_MAX_CHANNELS-1). + * @param path_len Number of hops in the packet path. + * @param text Null-terminated UTF-8 string. + * @param timestamp Sender's unix timestamp. + * @param rssi_dbm RSSI in dBm. + * @param snr_db SNR in dB. + * @param ctx Context. + */ +typedef void (*meshcore_on_grp_txt_cb_t)(uint8_t channel_idx, + uint8_t path_len, + const char *text, + uint32_t timestamp, + int16_t rssi_dbm, + int8_t snr_db, + void *ctx); + +/** + * @brief Callback: DM (TXT_MSG) decrypted addressed to this node. + * + * @param peer_pub_key Sender pubkey (32B). + * @param text UTF-8 string. + * @param timestamp Sender's unix timestamp. + * @param txt_type Sub-type (MC_TXT_TYPE_*). + * @param path_len Hops traversed. + * @param rssi_dbm RSSI in dBm. + * @param snr_db SNR in dB. + * @param ctx Context. + */ +typedef void (*meshcore_on_direct_msg_cb_t)(const uint8_t peer_pub_key[32], + const char *text, + uint32_t timestamp, + uint8_t txt_type, + uint8_t path_len, + int16_t rssi_dbm, + int8_t snr_db, + void *ctx); + +/** + * @brief Callback: ACK received for a DM we sent (CRC matched pending). + * + * @param ack_crc ACK CRC. + * @param peer_pub_key Pubkey of the peer that sent the ACK. + * @param ctx Context. + */ +typedef void (*meshcore_on_ack_cb_t)(uint32_t ack_crc, const uint8_t peer_pub_key[32], void *ctx); + +/** + * @brief Callback: path learned for a contact (PATH inbound). + * + * @param contact Pointer to the contact with freshly updated `out_path`. + * @param ctx Context. + */ +typedef void (*meshcore_on_path_update_cb_t)(const meshcore_contact_t *contact, void *ctx); + +/** + * @brief Set of callbacks registered in meshcore_init. + */ +typedef struct { + meshcore_on_advert_cb_t on_advert; + meshcore_on_grp_txt_cb_t on_grp_txt; + meshcore_on_direct_msg_cb_t on_direct_msg; + meshcore_on_ack_cb_t on_ack; + meshcore_on_path_update_cb_t on_path_update; + void *ctx; +} meshcore_callbacks_t; + +/** + * @brief Initializes the MeshCore stack. Loads prefs from NVS. + * + * Must be called AFTER sx1262_init and BEFORE meshcore_start. + * + * @param identity Node identity. Ed25519 pub/priv already generated. + * @param cbs Callbacks (optional fields may be NULL). + * @return + * - ESP_OK on success + * - ESP_ERR_INVALID_ARG if identity is NULL + */ +esp_err_t meshcore_init(const meshcore_identity_t *identity, const meshcore_callbacks_t *cbs); + +/** + * @brief Starts continuous RX on the SX1262. + * + * @return + * - ESP_OK on success + * - ESP_ERR_INVALID_STATE if already started + */ +esp_err_t meshcore_start(void); + +/** + * @brief Stops RX. Idempotent. + */ +void meshcore_stop(void); + +/** + * @brief Pumps pending SX1262 IRQ + pendings GC + drains relay queue. + * + * Call from the main loop every ~50ms. + */ +void meshcore_poll(void); + +/** + * @brief Sets the node name, persists in NVS, and re-emits ADVERT (with cooldown). + * + * @param name Null-terminated UTF-8 string (max MESHCORE_NAME_MAX-1). + */ +void meshcore_set_node_name(const char *name); + +/** + * @brief Sets node lat/lon, persists in NVS, and re-emits ADVERT. + * + * @param lat_e6 Latitude * 1e6. + * @param lon_e6 Longitude * 1e6. + * @param has_latlon If false, omits lat/lon from the next ADVERT. + */ +void meshcore_set_advert_latlon(int32_t lat_e6, int32_t lon_e6, bool has_latlon); + +/** + * @brief Emits ADVERT immediately (ignores cooldown). Used for CMD_SEND_SELF_ADVERT. + * + * @return ESP_OK on success. + */ +esp_err_t meshcore_send_advert(void); + +/** + * @brief Emits ADVERT respecting the 10s cooldown between re-emits. + * + * @return + * - ESP_OK on success + * - ESP_ERR_INVALID_STATE if still in cooldown + */ +esp_err_t meshcore_send_advert_throttled(void); + +/** + * @brief Retrieves pointer to a channel by idx. + * + * @param idx 0..MESHCORE_MAX_CHANNELS-1. + * @return Read-only pointer or NULL if idx invalid or slot empty. + */ +const meshcore_channel_t *meshcore_channel_get(uint8_t idx); + +/** + * @brief Sets or removes a channel. Persists in NVS. + * + * @param idx 0..MESHCORE_MAX_CHANNELS-1. + * @param name Name (max 32B). May be NULL. + * @param secret 16B PSK. NULL or all-zero removes the channel. + * @return true on success, false if idx invalid. + */ +bool meshcore_channel_set(uint8_t idx, const char *name, const uint8_t secret[16]); + +/** + * @brief Emits GRP_TXT on the specified channel (flood). + * + * @param channel_idx 0..MESHCORE_MAX_CHANNELS-1. + * @param text Null-terminated UTF-8 string. + * @return + * - ESP_OK on success + * - ESP_ERR_INVALID_ARG if idx invalid or text NULL + * - ESP_ERR_NOT_FOUND if slot empty + */ +esp_err_t meshcore_send_grp_txt(uint8_t channel_idx, const char *text); + +/** + * @brief Returns pointer to the fixed contacts array (read-only). + * + * @return Array of MESHCORE_MAX_CONTACTS entries (check `is_used`). + */ +const meshcore_contact_t *meshcore_contacts_array(void); + +/** + * @brief Counts how many contacts are in use. + * + * @return 0..MESHCORE_MAX_CONTACTS. + */ +size_t meshcore_contacts_count(void); + +/** + * @brief Looks up a contact by full pubkey. + * + * @param pub_key 32B Ed25519 pubkey. + * @return Read-only pointer or NULL. + */ +const meshcore_contact_t *meshcore_contact_find(const uint8_t pub_key[32]); + +/** + * @brief Looks up a contact by the first byte of the pubkey (1B hash). + * + * @param hash_byte First byte of the pubkey. + * @return First contact with pubkey[0] == hash_byte, or NULL. + */ +const meshcore_contact_t *meshcore_contact_find_by_hash(uint8_t hash_byte); + +/** + * @brief Adds or updates a contact. Preserves out_path if the input does not bring a new one. + * + * @param src Contact to insert. + * @return true on success, false if argument invalid. + */ +bool meshcore_contact_upsert(const meshcore_contact_t *src); + +/** + * @brief Removes a contact and persists DB. + * + * @param pub_key 32B contact pubkey. + * @return true if removed, false if not found. + */ +bool meshcore_contact_remove(const uint8_t pub_key[32]); + +/** + * @brief Clears the out_path of a contact (forces next DM via flood). + * + * @param pub_key 32B contact pubkey. + * @return true on success, false if not found. + */ +bool meshcore_contact_reset_path(const uint8_t pub_key[32]); + +/** + * @brief Sends an encrypted DM (X25519 ECDH + AES-128-ECB + HMAC-SHA256[2B]). + * + * If contact has known `out_path`, sends with ROUTE_TYPE_DIRECT. + * Otherwise, flood. Adds entry to the pendings table. + * + * @param[in] peer_pub_key 32B recipient pubkey. + * @param[in] text UTF-8 plaintext (max MESHCORE_TEXT_MAX). + * @param[in] timestamp Unix ts (part of plaintext + replay nonce). + * @param[in] attempt 0..3, retransmit attempt id. + * @param[out] out_expected_ack Expected CRC for correlation with push 0x82. May be NULL. + * @return + * - ESP_OK on success + * - ESP_ERR_INVALID_ARG if arguments invalid + * - ESP_FAIL if TX fails + */ +esp_err_t meshcore_send_direct_msg(const uint8_t peer_pub_key[32], + const char *text, + uint32_t timestamp, + uint8_t attempt, + uint32_t *out_expected_ack); + +/** + * @brief Reconfigures the SX1262 at runtime. Persists in NVS. + * + * @param freq_hz 150 MHz to 960 MHz. + * @param bw_hz 7810..500000 (mapped to driver BW codes). + * @param sf 5..12. + * @param cr 5..8 (4/5 to 4/8). + * @param tx_power_dbm -9 to +22. + * @return + * - ESP_OK on success + * - ESP_ERR_INVALID_ARG if any parameter out of range + * - ESP_FAIL if driver rejects + */ +esp_err_t meshcore_set_radio_params( + uint32_t freq_hz, uint32_t bw_hz, uint8_t sf, uint8_t cr, int8_t tx_power_dbm); + +/** + * @brief Retrieves a read-only pointer to the radio parameters in use. + * + * @return Pointer never NULL after meshcore_init. + */ +const meshcore_radio_prefs_t *meshcore_get_radio_prefs(void); + +/** + * @brief Sets unix time (called by CMD_SET_DEVICE_TIME). + * + * @param ts Unix timestamp in seconds. + */ +void meshcore_set_unix_time(uint32_t ts); + +/** + * @brief Returns current unix time. Before first sync, uses fallback + * (2026-01-01 + uptime) to avoid returning 0 in signatures. + * + * @return Unix timestamp in seconds. + */ +uint32_t meshcore_get_unix_time(void); + +/** + * @brief Enables or disables rebroadcast of flood/direct packets. + * + * Default: false (pure Companion). Repeater variant: true. + * + * @param is_enabled true to relay; false to silence. + */ +void meshcore_set_relay(bool is_enabled); + +/** + * @brief Returns current state of the relay flag. + * + * @return true if relay enabled. + */ +bool meshcore_get_relay(void); + +/** + * @brief Copies node pubkey to a buffer. + * + * @param[out] out 32B buffer. + */ +void meshcore_get_pub_key(uint8_t out[32]); + +/** + * @brief Copies node name to a buffer. + * + * @param[out] out Output buffer. + * @param[in] max Buffer size (includes terminator). + */ +void meshcore_get_name(char *out, size_t max); + +/** + * @brief Retrieves the current advert lat/lon. + * + * @param[out] out_lat_e6 Lat * 1e6. May be NULL. + * @param[out] out_lon_e6 Lon * 1e6. May be NULL. + * @param[out] out_has true if HAS_LATLON active. May be NULL. + */ +void meshcore_get_advert_latlon(int32_t *out_lat_e6, int32_t *out_lon_e6, bool *out_has); + +/** + * @brief Returns node `adv_type` (1=CHAT, 2=REPEATER, 3=ROOM, 4=SENSOR). + * + * @return Value from meshcore_adv_type_t. + */ +uint8_t meshcore_get_adv_type(void); + +#ifdef __cplusplus +} +#endif + +#endif // MESHCORE_H diff --git a/firmware_p4/components/Applications/LoRa/meshcore/include/meshcore_nvs.h b/firmware_p4/components/Applications/LoRa/meshcore/include/meshcore_nvs.h new file mode 100644 index 00000000..76784a82 --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/meshcore/include/meshcore_nvs.h @@ -0,0 +1,116 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#ifndef MESHCORE_NVS_H +#define MESHCORE_NVS_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +#include "esp_err.h" + +#define MC_NVS_NAMESPACE "meshcore" + +/** + * @brief Initializes NVS flash (idempotent). + * + * Erases and recreates the partition if it detects an incompatible version or full state. + * + * @return + * - ESP_OK on success + * - esp_nvs error code on permanent failure + */ +esp_err_t mc_nvs_init(void); + +/** + * @brief Reads a persisted blob. + * + * @param[in] key Key (max 15 chars, within the namespace). + * @param[out] out Output buffer. + * @param[in,out] len IN: buffer size. OUT: bytes read. + * @return + * - ESP_OK on success + * - ESP_ERR_NVS_NOT_FOUND if key does not exist + */ +esp_err_t mc_nvs_get_blob(const char *key, void *out, size_t *len); + +/** + * @brief Writes a persistent blob. Commits immediately. + * + * @param key Key. + * @param in Input buffer. + * @param len Size in bytes. + * @return ESP_OK on success. + */ +esp_err_t mc_nvs_set_blob(const char *key, const void *in, size_t len); + +/** + * @brief Reads a persisted u32. + * + * @param[in] key Key. + * @param[out] out Value read. + * @return + * - ESP_OK on success + * - ESP_ERR_NVS_NOT_FOUND if key does not exist + */ +esp_err_t mc_nvs_get_u32(const char *key, uint32_t *out); + +/** + * @brief Writes a u32. Commits immediately. + * + * @param key Key. + * @param val Value. + * @return ESP_OK on success. + */ +esp_err_t mc_nvs_set_u32(const char *key, uint32_t val); + +/** + * @brief Reads a persisted string. + * + * @param[in] key Key. + * @param[out] out Output buffer. + * @param[in] max Buffer size (includes terminator). + * @return + * - ESP_OK on success + * - ESP_ERR_NVS_NOT_FOUND if key does not exist + */ +esp_err_t mc_nvs_get_str(const char *key, char *out, size_t max); + +/** + * @brief Writes a null-terminated string. + * + * @param key Key. + * @param val String. + * @return ESP_OK on success. + */ +esp_err_t mc_nvs_set_str(const char *key, const char *val); + +/** + * @brief Erases a key. Silent if it does not exist. + * + * @param key Key. + * @return ESP_OK whenever the operation finishes (even if key absent). + */ +esp_err_t mc_nvs_erase(const char *key); + +#ifdef __cplusplus +} +#endif + +#endif // MESHCORE_NVS_H diff --git a/firmware_p4/components/Applications/LoRa/meshcore/include/meshcore_phone_bridge.h b/firmware_p4/components/Applications/LoRa/meshcore/include/meshcore_phone_bridge.h new file mode 100644 index 00000000..59287430 --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/meshcore/include/meshcore_phone_bridge.h @@ -0,0 +1,88 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#ifndef MESHCORE_PHONE_BRIDGE_H +#define MESHCORE_PHONE_BRIDGE_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +#include "esp_err.h" + +/** + * @brief Initialize the SPI-based MeshCore phone bridge. + * + * Owns the transport plumbing between the local phoneapi protocol layer + * (which lives on the P4) and the BLE NUS service which terminates on + * the C5 co-processor. + * + * Registers a stream callback for SPI_ID_MCORE_RX_STREAM that reassembles + * chunks back into Companion command frames and forwards them to + * meshcore_phoneapi_on_inbound. Hooks meshcore_phoneapi outbound so any + * frame produced on the P4 (responses, pushes, sync drains) is fragmented + * into SPI chunks and shipped to the C5 via SPI_ID_MCORE_TX_PUSH. + * + * Spawns a status task that polls SPI_ID_MCORE_STATUS so the bridge can + * react to phone (dis)connect events and retry MCORE_BLE_INIT if the C5 + * was rebooted. + * + * Does not bring up BLE by itself. Call meshcore_phone_bridge_ble_start + * after the protocol layer is ready. + * + * @param name_prefix Advertised name prefix on the C5 ("-XXXX", + * where XXXX is the last 2 octets of the MAC). May + * be NULL to fall back to "Highboy-MC". + * @return + * - ESP_OK on success + * - ESP_ERR_INVALID_STATE if already initialized + * - ESP_ERR_NO_MEM on allocation failure + */ +esp_err_t meshcore_phone_bridge_init(const char *name_prefix); + +/** + * @brief Tear down the bridge and stop the status task. + */ +void meshcore_phone_bridge_stop(void); + +/** + * @brief Ask the C5 to bring up the MeshCore BLE NUS peripheral. + * + * @return ESP_OK on success, error code from the SPI bridge otherwise. + */ +esp_err_t meshcore_phone_bridge_ble_start(void); + +/** + * @brief Ask the C5 to stop advertising and tear down the BLE stack. + * + * @return ESP_OK on success, error code from the SPI bridge otherwise. + */ +esp_err_t meshcore_phone_bridge_ble_stop(void); + +/** + * @brief Whether a phone is currently connected to the BLE NUS service. + * + * Result is cached for a short interval to avoid hammering the SPI bus. + */ +bool meshcore_phone_bridge_is_connected(void); + +#ifdef __cplusplus +} +#endif + +#endif // MESHCORE_PHONE_BRIDGE_H diff --git a/firmware_p4/components/Applications/LoRa/meshcore/include/meshcore_phoneapi.h b/firmware_p4/components/Applications/LoRa/meshcore/include/meshcore_phoneapi.h new file mode 100644 index 00000000..ac65740f --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/meshcore/include/meshcore_phoneapi.h @@ -0,0 +1,147 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#ifndef MESHCORE_PHONEAPI_H +#define MESHCORE_PHONEAPI_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +#include "esp_err.h" + +#include "meshcore.h" + +/** + * @brief Outbound callback installed by the phone bridge. + * + * Invoked synchronously from inside command handlers and push helpers + * with the raw frame that should be delivered to the connected phone. + * The bridge is free to drop the frame if no transport is connected. + * + * @param ctx Context registered together with the callback. + * @param data Raw frame bytes (1-byte tag + payload, MeshCore Companion). + * @param len Length in bytes (<= 240). + */ +typedef void (*meshcore_phoneapi_outbound_cb_t)(void *ctx, const uint8_t *data, uint16_t len); + +/** + * @brief Initializes the MeshCore companion protocol layer. + * + * Loads (or generates) the BLE pairing PIN from NVS. Does NOT touch any + * radio peripherals — the phone transport (BLE / TCP) is owned by the + * companion bridge on the C5. + * + * Must be called AFTER meshcore_init. + * + * @return + * - ESP_OK on success + * - ESP_ERR_INVALID_STATE if already initialized + */ +esp_err_t meshcore_phoneapi_init(void); + +/** + * @brief Registers the outbound bridge. + * + * @param cb Function invoked when the protocol layer wants to send a + * frame to the phone. NULL detaches the bridge. + * @param ctx Opaque context forwarded to cb on every call. + */ +void meshcore_phoneapi_set_outbound(meshcore_phoneapi_outbound_cb_t cb, void *ctx); + +/** + * @brief Returns the BLE pairing PIN (6 digits). + */ +uint32_t meshcore_phoneapi_get_pin(void); + +/** + * @brief Notifies the protocol layer that the phone disconnected. + * + * Resets the negotiated app target version and drops any pending offline + * messages so the next session starts clean. + */ +void meshcore_phoneapi_on_disconnect(void); + +/** + * @brief Processes a command frame received from the phone. + * + * Dispatches one of the CMD_* opcodes from the MeshCore Companion + * protocol. Responses and pushes are produced synchronously via the + * outbound callback registered with meshcore_phoneapi_set_outbound. + * + * @param buf Frame bytes (first byte is the opcode). + * @param len Length in bytes. + */ +void meshcore_phoneapi_on_inbound(const uint8_t *buf, uint16_t len); + +/** + * @brief Pushes PUSH_CODE_NEW_ADVERT (0x8A) to the phone. + * + * @param contact Newly announced contact. + */ +void meshcore_phoneapi_push_new_advert(const meshcore_contact_t *contact); + +/** + * @brief Queues a channel message and emits PUSH_CODE_MSG_WAITING (0x83). + * + * @param channel_idx Channel slot. + * @param path_len Hops. + * @param timestamp Unix ts. + * @param snr SNR in dB. + * @param text Null-terminated UTF-8 text. + */ +void meshcore_phoneapi_push_channel_msg( + uint8_t channel_idx, uint8_t path_len, uint32_t timestamp, int8_t snr, const char *text); + +/** + * @brief Queues a DM and emits PUSH_CODE_MSG_WAITING (0x83). + * + * @param peer_pub_key Sender pubkey (32B). + * @param path_len Hops. + * @param txt_type Sub-type (MC_TXT_TYPE_*). + * @param timestamp Unix ts. + * @param snr SNR in dB. + * @param text UTF-8 text. + */ +void meshcore_phoneapi_push_contact_msg(const uint8_t peer_pub_key[32], + uint8_t path_len, + uint8_t txt_type, + uint32_t timestamp, + int8_t snr, + const char *text); + +/** + * @brief Pushes PUSH_CODE_SEND_CONFIRMED (0x82) when an ACK arrives. + * + * @param ack_crc ACK CRC. + * @param snr SNR of the ACK packet. + */ +void meshcore_phoneapi_push_send_confirmed(uint32_t ack_crc, uint8_t snr); + +/** + * @brief Pushes PUSH_CODE_PATH_UPDATED (0x81) when out_path is learned. + * + * @param contact Contact with freshly updated path. + */ +void meshcore_phoneapi_push_path_updated(const meshcore_contact_t *contact); + +#ifdef __cplusplus +} +#endif + +#endif // MESHCORE_PHONEAPI_H diff --git a/firmware_p4/components/Applications/LoRa/meshcore/meshcore.c b/firmware_p4/components/Applications/LoRa/meshcore/meshcore.c new file mode 100644 index 00000000..5e2ca64c --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/meshcore/meshcore.c @@ -0,0 +1,295 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#include "meshcore_internal.h" + +#include +#include +#include + +#include "esp_log.h" +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" + +#include "meshcore_nvs.h" +#include "sx1262.h" +#include "sx1262_regs.h" + +static const char *TAG = "MESHCORE"; + +#define MC_NVS_KEY_NAME "node_name" +#define MC_NVS_KEY_LAT "adv_lat" +#define MC_NVS_KEY_LON "adv_lon" +#define MC_NVS_KEY_HAS_LATLON "has_latlon" +#define MC_NVS_KEY_RADIO "radio" + +static meshcore_identity_t s_identity; +static meshcore_callbacks_t s_cbs; +static bool s_is_running = false; + +static int32_t s_adv_lat = 0; +static int32_t s_adv_lon = 0; +static bool s_has_latlon = false; + +static meshcore_radio_prefs_t s_radio_prefs; + +static uint32_t s_time_base_unix = 0; +static uint32_t s_time_base_tick_ms = 0; + +esp_err_t meshcore_init(const meshcore_identity_t *identity, const meshcore_callbacks_t *cbs) { + if (identity == NULL) + return ESP_ERR_INVALID_ARG; + + mc_nvs_init(); + + memcpy(&s_identity, identity, sizeof(*identity)); + + char name_nvs[MESHCORE_NAME_MAX] = {0}; + if (mc_nvs_get_str(MC_NVS_KEY_NAME, name_nvs, sizeof(name_nvs)) == ESP_OK && name_nvs[0] != 0) { + strncpy(s_identity.name, name_nvs, MESHCORE_NAME_MAX - 1); + s_identity.name[MESHCORE_NAME_MAX - 1] = 0; + } + + s_has_latlon = false; + uint32_t flag_v; + if (mc_nvs_get_u32(MC_NVS_KEY_HAS_LATLON, &flag_v) == ESP_OK && flag_v != 0) { + uint32_t lat_u, lon_u; + if (mc_nvs_get_u32(MC_NVS_KEY_LAT, &lat_u) == ESP_OK && + mc_nvs_get_u32(MC_NVS_KEY_LON, &lon_u) == ESP_OK) { + s_adv_lat = (int32_t)lat_u; + s_adv_lon = (int32_t)lon_u; + s_has_latlon = true; + } + } + + s_radio_prefs.freq_hz = MESHCORE_FREQ_HZ; + s_radio_prefs.bw_hz = MESHCORE_BW_HZ; + s_radio_prefs.sf = MESHCORE_SF; + s_radio_prefs.cr = MESHCORE_CR; + s_radio_prefs.tx_power_dbm = MESHCORE_TX_POWER_DBM; + size_t rlen = sizeof(s_radio_prefs); + mc_nvs_get_blob(MC_NVS_KEY_RADIO, &s_radio_prefs, &rlen); + + if (cbs == NULL) { + memset(&s_cbs, 0, sizeof(s_cbs)); + } else { + s_cbs = *cbs; + } + + mc_db_init(); + mc_router_init(); + + ESP_LOGI(TAG, + "Init: node='%s' adv_type=%u (latlon=%d %d %s)", + s_identity.name, + s_identity.adv_type, + (int)s_adv_lat, + (int)s_adv_lon, + s_has_latlon ? "yes" : "no"); + return ESP_OK; +} + +esp_err_t meshcore_start(void) { + if (s_is_running) + return ESP_ERR_INVALID_STATE; + + esp_err_t ret = sx1262_receive_continuous(); + if (ret != ESP_OK) + return ret; + + s_is_running = true; + ESP_LOGI(TAG, "Started -- RX continuous"); + return ESP_OK; +} + +void meshcore_stop(void) { + if (!s_is_running) + return; + sx1262_stop_rx(); + s_is_running = false; +} + +void meshcore_poll(void) { + if (s_is_running) + sx1262_process_irq(); + mc_pendings_gc(); + mc_router_relay_process(); +} + +void meshcore_set_node_name(const char *name) { + if (name == NULL) + return; + strncpy(s_identity.name, name, MESHCORE_NAME_MAX - 1); + s_identity.name[MESHCORE_NAME_MAX - 1] = 0; + mc_nvs_set_str(MC_NVS_KEY_NAME, s_identity.name); + ESP_LOGI(TAG, "Node name set to '%s'", s_identity.name); + meshcore_send_advert_throttled(); +} + +void meshcore_set_advert_latlon(int32_t lat_e6, int32_t lon_e6, bool has_latlon) { + s_adv_lat = lat_e6; + s_adv_lon = lon_e6; + s_has_latlon = has_latlon; + mc_nvs_set_u32(MC_NVS_KEY_HAS_LATLON, has_latlon ? 1 : 0); + if (has_latlon) { + mc_nvs_set_u32(MC_NVS_KEY_LAT, (uint32_t)lat_e6); + mc_nvs_set_u32(MC_NVS_KEY_LON, (uint32_t)lon_e6); + } + ESP_LOGI(TAG, "Adv latlon: %d %d (%s)", (int)lat_e6, (int)lon_e6, has_latlon ? "on" : "off"); + meshcore_send_advert_throttled(); +} + +void meshcore_get_pub_key(uint8_t out[32]) { + if (out != NULL) + memcpy(out, s_identity.pub_key, 32); +} + +void meshcore_get_name(char *out, size_t max) { + if (out == NULL || max == 0) + return; + strncpy(out, s_identity.name, max - 1); + out[max - 1] = 0; +} + +void meshcore_get_advert_latlon(int32_t *out_lat_e6, int32_t *out_lon_e6, bool *out_has) { + if (out_lat_e6 != NULL) + *out_lat_e6 = s_adv_lat; + if (out_lon_e6 != NULL) + *out_lon_e6 = s_adv_lon; + if (out_has != NULL) + *out_has = s_has_latlon; +} + +uint8_t meshcore_get_adv_type(void) { + return s_identity.adv_type; +} + +void meshcore_set_unix_time(uint32_t ts) { + s_time_base_unix = ts; + s_time_base_tick_ms = mc_now_ms(); + ESP_LOGI(TAG, "Unix time synced: %lu", (unsigned long)ts); +} + +uint32_t meshcore_get_unix_time(void) { + if (s_time_base_unix == 0) { + return MC_FALLBACK_EPOCH + (mc_now_ms() / 1000); + } + return s_time_base_unix + ((mc_now_ms() - s_time_base_tick_ms) / 1000); +} + +esp_err_t meshcore_set_radio_params( + uint32_t freq_hz, uint32_t bw_hz, uint8_t sf, uint8_t cr, int8_t tx_power_dbm) { + if (freq_hz < 150000000UL || freq_hz > 960000000UL) + return ESP_ERR_INVALID_ARG; + if (sf < 5 || sf > 12) + return ESP_ERR_INVALID_ARG; + if (cr < 5 || cr > 8) + return ESP_ERR_INVALID_ARG; + if (tx_power_dbm < -9 || tx_power_dbm > 22) + return ESP_ERR_INVALID_ARG; + + static const struct { + uint32_t hz; + uint8_t code; + } BW_TABLE[] = { + {7810, SX1262_LORA_BW_7}, + {10420, SX1262_LORA_BW_10}, + {15630, SX1262_LORA_BW_15}, + {20830, SX1262_LORA_BW_20}, + {31250, SX1262_LORA_BW_31}, + {41670, SX1262_LORA_BW_41}, + {62500, SX1262_LORA_BW_62}, + {125000, SX1262_LORA_BW_125}, + {250000, SX1262_LORA_BW_250}, + {500000, SX1262_LORA_BW_500}, + }; +#define BW_TABLE_COUNT (sizeof(BW_TABLE) / sizeof(BW_TABLE[0])) + + uint8_t bw_code = 0xFF; + uint32_t best_diff = UINT32_MAX; + for (size_t i = 0; i < BW_TABLE_COUNT; i++) { + uint32_t d = (bw_hz > BW_TABLE[i].hz) ? (bw_hz - BW_TABLE[i].hz) : (BW_TABLE[i].hz - bw_hz); + if (d < best_diff) { + best_diff = d; + bw_code = BW_TABLE[i].code; + } + } + if (best_diff * 10 > bw_hz) + return ESP_ERR_INVALID_ARG; + + s_radio_prefs.freq_hz = freq_hz; + s_radio_prefs.bw_hz = bw_hz; + s_radio_prefs.sf = sf; + s_radio_prefs.cr = cr; + s_radio_prefs.tx_power_dbm = tx_power_dbm; + mc_nvs_set_blob(MC_NVS_KEY_RADIO, &s_radio_prefs, sizeof(s_radio_prefs)); + + sx1262_stop_rx(); + sx1262_config_t cfg = {0}; + cfg.frequency_hz = freq_hz; + cfg.sf = sf; + cfg.bw = bw_code; + cfg.cr = (cr - 4); + cfg.tx_power_dbm = tx_power_dbm; + cfg.preamble_len = MESHCORE_PREAMBLE_LEN; + cfg.is_crc_on = true; + cfg.is_inverted_iq = false; + cfg.is_implicit_hdr = false; + cfg.is_public_network = false; + esp_err_t ret = sx1262_config_lora(&cfg); + if (s_is_running) + sx1262_receive_continuous(); + if (ret == ESP_OK) { + ESP_LOGI(TAG, + "Radio reconfigured: %luHz BW%lu SF%u CR4/%u TX%ddBm", + (unsigned long)freq_hz, + (unsigned long)bw_hz, + sf, + cr, + tx_power_dbm); + } else { + ESP_LOGE(TAG, "Radio reconfig failed: %s", esp_err_to_name(ret)); + } + return ret; +} + +const meshcore_radio_prefs_t *meshcore_get_radio_prefs(void) { + return &s_radio_prefs; +} + +const meshcore_identity_t *mc_get_identity(void) { + return &s_identity; +} + +const meshcore_callbacks_t *mc_get_callbacks(void) { + return &s_cbs; +} + +bool mc_is_running(void) { + return s_is_running; +} + +void mc_get_advert_latlon_internal(int32_t *out_lat, int32_t *out_lon, bool *out_has) { + if (out_lat != NULL) + *out_lat = s_adv_lat; + if (out_lon != NULL) + *out_lon = s_adv_lon; + if (out_has != NULL) + *out_has = s_has_latlon; +} + +uint32_t mc_now_ms(void) { + return (uint32_t)(xTaskGetTickCount() * portTICK_PERIOD_MS); +} diff --git a/firmware_p4/components/Applications/LoRa/meshcore/meshcore_crypto.c b/firmware_p4/components/Applications/LoRa/meshcore/meshcore_crypto.c new file mode 100644 index 00000000..fa8deb2f --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/meshcore/meshcore_crypto.c @@ -0,0 +1,323 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#include "meshcore_internal.h" + +#include +#include +#include + +#include "mbedtls/aes.h" +#include "mbedtls/md.h" +#include "mbedtls/sha256.h" + +#include "ed25519.h" + +static int +aes_ecb_encrypt_pad(const uint8_t key[16], uint8_t *dest, const uint8_t *src, int src_len); +static int aes_ecb_decrypt(const uint8_t key[16], uint8_t *dest, const uint8_t *src, int src_len); +static void hmac_sha256_trunc(const uint8_t *key, + size_t key_len, + const uint8_t *data, + size_t data_len, + uint8_t *mac_out, + size_t mac_len); + +void meshcore_crypto_sha256(const uint8_t *data, size_t len, uint8_t out[32]) { + mbedtls_sha256_context ctx; + mbedtls_sha256_init(&ctx); + mbedtls_sha256_starts(&ctx, 0); + mbedtls_sha256_update(&ctx, data, len); + mbedtls_sha256_finish(&ctx, out); + mbedtls_sha256_free(&ctx); +} + +int meshcore_crypto_encrypt_mac(const uint8_t *shared_secret, + uint8_t *dest, + const uint8_t *src, + int src_len) { + int enc_len = aes_ecb_encrypt_pad(shared_secret, dest + MC_CIPHER_MAC_SIZE, src, src_len); + hmac_sha256_trunc(shared_secret, + MC_HMAC_KEY_SIZE, + dest + MC_CIPHER_MAC_SIZE, + enc_len, + dest, + MC_CIPHER_MAC_SIZE); + return MC_CIPHER_MAC_SIZE + enc_len; +} + +int meshcore_crypto_mac_decrypt(const uint8_t *shared_secret, + uint8_t *dest, + const uint8_t *src, + int src_len) { + if (src_len < MC_CIPHER_MAC_SIZE + MC_CIPHER_BLOCK) + return 0; + int ct_len = src_len - MC_CIPHER_MAC_SIZE; + + uint8_t expected_mac[MC_CIPHER_MAC_SIZE]; + hmac_sha256_trunc(shared_secret, + MC_HMAC_KEY_SIZE, + src + MC_CIPHER_MAC_SIZE, + ct_len, + expected_mac, + MC_CIPHER_MAC_SIZE); + + if (memcmp(expected_mac, src, MC_CIPHER_MAC_SIZE) != 0) { + return 0; + } + + return aes_ecb_decrypt(shared_secret, dest, src + MC_CIPHER_MAC_SIZE, ct_len); +} + +bool meshcore_packet_parse(const uint8_t *raw, uint16_t raw_len, meshcore_packet_view_t *out) { + if (raw_len < 2) + return false; + + uint8_t hdr = raw[0]; + uint8_t version = (hdr >> 6) & 0x03; + uint8_t payload_t = (hdr >> 2) & 0x0F; + uint8_t route_t = hdr & 0x03; + + uint16_t offset = 1; + if (route_t == MC_RT_TRANSPORT_FLOOD || route_t == MC_RT_TRANSPORT_DIRECT) { + if (raw_len < offset + 4) + return false; + offset += 4; + } + + if (raw_len < offset + 1) + return false; + uint8_t pl = raw[offset++]; + uint8_t hash_size_sel = (pl >> 6) & 0x03; + uint8_t path_count = pl & 0x3F; + uint8_t hash_size = mc_parse_hash_size(hash_size_sel); + if (hash_size == 0) + return false; + + uint16_t path_bytes = (uint16_t)path_count * hash_size; + if (raw_len < offset + path_bytes) + return false; + + out->version = version; + out->payload_type = payload_t; + out->route_type = route_t; + out->hash_size = hash_size; + out->path_count = path_count; + out->path = &raw[offset]; + out->path_len = path_bytes; + offset += path_bytes; + out->payload = &raw[offset]; + out->payload_len = raw_len - offset; + out->rssi_dbm = 0; + out->snr_db = 0; + return true; +} + +uint16_t meshcore_packet_build_advert(const meshcore_identity_t *identity, + int32_t lat_e6, + int32_t lon_e6, + bool has_latlon, + uint32_t unix_ts, + uint8_t *out, + uint16_t out_cap) { + uint8_t app_data[1 + 4 + 4 + MESHCORE_NAME_MAX]; + uint8_t app_len = 0; + uint8_t flags = (identity->adv_type & 0x0F); + if (has_latlon) + flags |= MESHCORE_ADV_FLAG_HAS_LATLON; + uint8_t name_len = (uint8_t)strlen(identity->name); + if (name_len > 0 && name_len <= MESHCORE_NAME_MAX) { + flags |= MESHCORE_ADV_FLAG_HAS_NAME; + } + app_data[app_len++] = flags; + if (has_latlon) { + memcpy(&app_data[app_len], &lat_e6, 4); + app_len += 4; + memcpy(&app_data[app_len], &lon_e6, 4); + app_len += 4; + } + if (flags & MESHCORE_ADV_FLAG_HAS_NAME) { + memcpy(&app_data[app_len], identity->name, name_len); + app_len += name_len; + } + + uint16_t total = 1 + 1 + MC_PUB_KEY_SIZE + 4 + MC_SIG_SIZE + app_len; + if (total > out_cap) + return 0; + + uint16_t pos = 0; + out[pos++] = mc_build_header(MC_VERSION_V1, MC_PT_ADVERT, MC_RT_FLOOD); + out[pos++] = mc_build_path_len(MC_HASH_SIZE_1B, 0); + + memcpy(&out[pos], identity->pub_key, MC_PUB_KEY_SIZE); + pos += MC_PUB_KEY_SIZE; + + out[pos++] = (uint8_t)(unix_ts & 0xFF); + out[pos++] = (uint8_t)((unix_ts >> 8) & 0xFF); + out[pos++] = (uint8_t)((unix_ts >> 16) & 0xFF); + out[pos++] = (uint8_t)((unix_ts >> 24) & 0xFF); + + uint16_t sig_pos = pos; + pos += MC_SIG_SIZE; + + memcpy(&out[pos], app_data, app_len); + pos += app_len; + + uint8_t sign_buf[32 + 4 + sizeof(app_data)]; + uint16_t sign_len = 32 + 4 + app_len; + memcpy(&sign_buf[0], identity->pub_key, 32); + memcpy(&sign_buf[32], &out[2 + 32], 4); + memcpy(&sign_buf[36], app_data, app_len); + + ed25519_sign(&out[sig_pos], sign_buf, sign_len, identity->pub_key, identity->priv_key); + + return pos; +} + +uint16_t meshcore_packet_build_grp_txt(uint8_t channel_hash, + const uint8_t channel_secret[32], + const char *sender_name, + const char *text, + uint32_t unix_ts, + uint8_t *out, + uint16_t out_cap) { + uint8_t plaintext[160]; + uint16_t pt_len = 0; + plaintext[pt_len++] = (uint8_t)(unix_ts & 0xFF); + plaintext[pt_len++] = (uint8_t)((unix_ts >> 8) & 0xFF); + plaintext[pt_len++] = (uint8_t)((unix_ts >> 16) & 0xFF); + plaintext[pt_len++] = (uint8_t)((unix_ts >> 24) & 0xFF); + plaintext[pt_len++] = 0x00; + + int n = + snprintf((char *)&plaintext[pt_len], sizeof(plaintext) - pt_len, "%s: %s", sender_name, text); + if (n < 0) + return 0; + pt_len += (uint16_t)n; + + uint16_t header_bytes = 1 + 1 + 1; + if (header_bytes + MC_CIPHER_MAC_SIZE + ((pt_len + 15) & ~15) > out_cap) + return 0; + + uint16_t pos = 0; + out[pos++] = mc_build_header(MC_VERSION_V1, MC_PT_GRP_TXT, MC_RT_FLOOD); + out[pos++] = mc_build_path_len(MC_HASH_SIZE_1B, 0); + out[pos++] = channel_hash; + + int enc_written = meshcore_crypto_encrypt_mac(channel_secret, &out[pos], plaintext, pt_len); + pos += enc_written; + return pos; +} + +void meshcore_packet_hash(const meshcore_packet_view_t *pkt, uint8_t out[8]) { + uint8_t buf[MESHCORE_MAX_RAW + 1]; + buf[0] = pkt->payload_type; + if (pkt->payload_len > MESHCORE_MAX_RAW) + return; + memcpy(&buf[1], pkt->payload, pkt->payload_len); + uint8_t full[32]; + meshcore_crypto_sha256(buf, pkt->payload_len + 1, full); + memcpy(out, full, 8); +} + +uint8_t mc_build_header(uint8_t ver, uint8_t ptype, uint8_t route) { + return ((ver & 0x03) << 6) | ((ptype & 0x0F) << 2) | (route & 0x03); +} + +uint8_t mc_build_path_len(uint8_t hash_size_sel, uint8_t count) { + return ((hash_size_sel & 0x03) << 6) | (count & 0x3F); +} + +uint8_t mc_parse_hash_size(uint8_t sel) { + switch (sel) { + case 0: + return 1; + case 1: + return 2; + case 2: + return 3; + default: + return 0; + } +} + +void mc_sha256_two( + uint8_t *out, size_t out_len, const uint8_t *a, size_t a_len, const uint8_t *b, size_t b_len) { + uint8_t full[32]; + mbedtls_sha256_context ctx; + mbedtls_sha256_init(&ctx); + mbedtls_sha256_starts(&ctx, 0); + mbedtls_sha256_update(&ctx, a, a_len); + mbedtls_sha256_update(&ctx, b, b_len); + mbedtls_sha256_finish(&ctx, full); + mbedtls_sha256_free(&ctx); + memcpy(out, full, out_len); +} + +static int +aes_ecb_encrypt_pad(const uint8_t key[16], uint8_t *dest, const uint8_t *src, int src_len) { + mbedtls_aes_context ctx; + mbedtls_aes_init(&ctx); + mbedtls_aes_setkey_enc(&ctx, key, 128); + + int out = 0; + while (src_len >= 16) { + mbedtls_aes_crypt_ecb(&ctx, MBEDTLS_AES_ENCRYPT, src, dest); + src += 16; + dest += 16; + src_len -= 16; + out += 16; + } + if (src_len > 0) { + uint8_t tmp[16] = {0}; + memcpy(tmp, src, src_len); + mbedtls_aes_crypt_ecb(&ctx, MBEDTLS_AES_ENCRYPT, tmp, dest); + out += 16; + } + mbedtls_aes_free(&ctx); + return out; +} + +static int aes_ecb_decrypt(const uint8_t key[16], uint8_t *dest, const uint8_t *src, int src_len) { + if (src_len % 16 != 0) + return 0; + + mbedtls_aes_context ctx; + mbedtls_aes_init(&ctx); + mbedtls_aes_setkey_dec(&ctx, key, 128); + + int out = 0; + while (src_len >= 16) { + mbedtls_aes_crypt_ecb(&ctx, MBEDTLS_AES_DECRYPT, src, dest); + src += 16; + dest += 16; + src_len -= 16; + out += 16; + } + mbedtls_aes_free(&ctx); + return out; +} + +static void hmac_sha256_trunc(const uint8_t *key, + size_t key_len, + const uint8_t *data, + size_t data_len, + uint8_t *mac_out, + size_t mac_len) { + uint8_t full_mac[32]; + const mbedtls_md_info_t *info = mbedtls_md_info_from_type(MBEDTLS_MD_SHA256); + mbedtls_md_hmac(info, key, key_len, data, data_len, full_mac); + memcpy(mac_out, full_mac, mac_len); +} diff --git a/firmware_p4/components/Applications/LoRa/meshcore/meshcore_db.c b/firmware_p4/components/Applications/LoRa/meshcore/meshcore_db.c new file mode 100644 index 00000000..1818c630 --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/meshcore/meshcore_db.c @@ -0,0 +1,343 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#include "meshcore_internal.h" + +#include +#include + +#include "esp_log.h" + +#include "meshcore_nvs.h" + +static const char *TAG = "MC_DB"; + +#define MC_NVS_KEY_CHANNELS "channels" +#define MC_NVS_KEY_CONTACTS "contacts" + +static const uint8_t MC_PUBLIC_CHANNEL_SECRET[16] = { + 0x8b, + 0x33, + 0x87, + 0xe9, + 0xc5, + 0xcd, + 0xea, + 0x6a, + 0xc9, + 0xe5, + 0xed, + 0xba, + 0xa1, + 0x15, + 0xcd, + 0x72, +}; + +typedef struct { + bool is_valid; + uint8_t hash[8]; + uint32_t timestamp_ms; +} mc_dedup_entry_t; + +typedef struct { + bool is_used; + uint32_t expected_crc; + uint8_t peer_pub[32]; + uint32_t deadline_ms; +} mc_pending_t; + +static meshcore_channel_t s_channels[MESHCORE_MAX_CHANNELS]; +static meshcore_contact_t s_contacts[MESHCORE_MAX_CONTACTS]; + +static mc_dedup_entry_t s_dedup[MC_DEDUP_SIZE]; +static uint16_t s_dedup_idx = 0; + +static mc_pending_t s_pendings[MC_PENDINGS_SIZE]; + +static void channel_compute_hash(meshcore_channel_t *ch); +static void channels_load_or_default(void); +static void contacts_load(void); +static void channels_persist(void); +static meshcore_contact_t *contact_alloc_slot(const uint8_t pub_key[32]); + +void mc_db_init(void) { + memset(s_dedup, 0, sizeof(s_dedup)); + s_dedup_idx = 0; + memset(s_pendings, 0, sizeof(s_pendings)); + channels_load_or_default(); + contacts_load(); +} + +const meshcore_channel_t *meshcore_channel_get(uint8_t idx) { + if (idx >= MESHCORE_MAX_CHANNELS) + return NULL; + if (!s_channels[idx].is_used) + return NULL; + return &s_channels[idx]; +} + +bool meshcore_channel_set(uint8_t idx, const char *name, const uint8_t secret[16]) { + if (idx >= MESHCORE_MAX_CHANNELS) + return false; + + bool is_empty = (secret == NULL); + if (!is_empty) { + bool is_all_zero = true; + for (int i = 0; i < 16; i++) { + if (secret[i] != 0) { + is_all_zero = false; + break; + } + } + is_empty = is_all_zero; + } + + if (is_empty) { + memset(&s_channels[idx], 0, sizeof(meshcore_channel_t)); + } else { + s_channels[idx].is_used = true; + memcpy(s_channels[idx].secret, secret, 16); + if (name == NULL) { + s_channels[idx].name[0] = 0; + } else { + strncpy(s_channels[idx].name, name, MESHCORE_NAME_MAX - 1); + s_channels[idx].name[MESHCORE_NAME_MAX - 1] = 0; + } + channel_compute_hash(&s_channels[idx]); + } + + channels_persist(); + ESP_LOGI(TAG, + "Channel %u %s (hash=0x%02X)", + idx, + is_empty ? "removed" : "saved", + is_empty ? 0 : s_channels[idx].hash); + return true; +} + +const meshcore_channel_t *mc_channels_array(void) { + return s_channels; +} + +const meshcore_contact_t *meshcore_contacts_array(void) { + return s_contacts; +} + +meshcore_contact_t *mc_contacts_array_mut(void) { + return s_contacts; +} + +size_t meshcore_contacts_count(void) { + size_t n = 0; + for (int i = 0; i < MESHCORE_MAX_CONTACTS; i++) { + if (s_contacts[i].is_used) + n++; + } + return n; +} + +const meshcore_contact_t *meshcore_contact_find(const uint8_t pub_key[32]) { + return mc_contact_find_mut(pub_key); +} + +const meshcore_contact_t *meshcore_contact_find_by_hash(uint8_t hash_byte) { + for (int i = 0; i < MESHCORE_MAX_CONTACTS; i++) { + if (s_contacts[i].is_used && s_contacts[i].pub_key[0] == hash_byte) { + return &s_contacts[i]; + } + } + return NULL; +} + +meshcore_contact_t *mc_contact_find_mut(const uint8_t pub_key[32]) { + for (int i = 0; i < MESHCORE_MAX_CONTACTS; i++) { + if (s_contacts[i].is_used && memcmp(s_contacts[i].pub_key, pub_key, 32) == 0) { + return &s_contacts[i]; + } + } + return NULL; +} + +bool meshcore_contact_upsert(const meshcore_contact_t *src) { + if (src == NULL) + return false; + meshcore_contact_t *slot = contact_alloc_slot(src->pub_key); + if (slot == NULL) + return false; + + bool is_keep_path = (src->out_path_len == MESHCORE_OUT_PATH_UNKNOWN && slot->is_used && + slot->out_path_len != MESHCORE_OUT_PATH_UNKNOWN); + uint8_t old_path[MESHCORE_MAX_PATH]; + uint8_t old_path_len = 0; + if (is_keep_path) { + old_path_len = slot->out_path_len; + memcpy(old_path, slot->out_path, MESHCORE_MAX_PATH); + } + *slot = *src; + slot->is_used = true; + if (is_keep_path) { + slot->out_path_len = old_path_len; + memcpy(slot->out_path, old_path, MESHCORE_MAX_PATH); + } + if (slot->lastmod == 0) + slot->lastmod = meshcore_get_unix_time(); + mc_contacts_persist(); + return true; +} + +bool meshcore_contact_remove(const uint8_t pub_key[32]) { + for (int i = 0; i < MESHCORE_MAX_CONTACTS; i++) { + if (s_contacts[i].is_used && memcmp(s_contacts[i].pub_key, pub_key, 32) == 0) { + memset(&s_contacts[i], 0, sizeof(meshcore_contact_t)); + mc_contacts_persist(); + return true; + } + } + return false; +} + +bool meshcore_contact_reset_path(const uint8_t pub_key[32]) { + for (int i = 0; i < MESHCORE_MAX_CONTACTS; i++) { + if (s_contacts[i].is_used && memcmp(s_contacts[i].pub_key, pub_key, 32) == 0) { + s_contacts[i].out_path_len = MESHCORE_OUT_PATH_UNKNOWN; + memset(s_contacts[i].out_path, 0, MESHCORE_MAX_PATH); + s_contacts[i].lastmod = meshcore_get_unix_time(); + mc_contacts_persist(); + return true; + } + } + return false; +} + +void mc_contacts_persist(void) { + mc_nvs_set_blob(MC_NVS_KEY_CONTACTS, s_contacts, sizeof(s_contacts)); +} + +bool mc_dedup_check_add(const uint8_t hash[8]) { + uint32_t t = mc_now_ms(); + for (int i = 0; i < MC_DEDUP_SIZE; i++) { + if (s_dedup[i].is_valid && memcmp(s_dedup[i].hash, hash, 8) == 0 && + (t - s_dedup[i].timestamp_ms) < MC_DEDUP_TTL_MS) { + return true; + } + } + memcpy(s_dedup[s_dedup_idx].hash, hash, 8); + s_dedup[s_dedup_idx].timestamp_ms = t; + s_dedup[s_dedup_idx].is_valid = true; + s_dedup_idx = (s_dedup_idx + 1) % MC_DEDUP_SIZE; + return false; +} + +void mc_pendings_gc(void) { + uint32_t t = mc_now_ms(); + for (int i = 0; i < MC_PENDINGS_SIZE; i++) { + if (s_pendings[i].is_used && (int32_t)(t - s_pendings[i].deadline_ms) >= 0) { + ESP_LOGW(TAG, + "ACK pending #%d expired (CRC=0x%08lX)", + i, + (unsigned long)s_pendings[i].expected_crc); + s_pendings[i].is_used = false; + } + } +} + +void mc_pendings_add(uint32_t crc, const uint8_t peer_pub[32]) { + mc_pendings_gc(); + for (int i = 0; i < MC_PENDINGS_SIZE; i++) { + if (!s_pendings[i].is_used) { + s_pendings[i].is_used = true; + s_pendings[i].expected_crc = crc; + memcpy(s_pendings[i].peer_pub, peer_pub, 32); + s_pendings[i].deadline_ms = mc_now_ms() + MC_PENDING_TTL_MS; + return; + } + } + ESP_LOGW(TAG, "Pendings full -- replacing slot 0"); + s_pendings[0].expected_crc = crc; + memcpy(s_pendings[0].peer_pub, peer_pub, 32); + s_pendings[0].deadline_ms = mc_now_ms() + MC_PENDING_TTL_MS; +} + +bool mc_pendings_match(uint32_t crc, uint8_t out_peer[32]) { + mc_pendings_gc(); + for (int i = 0; i < MC_PENDINGS_SIZE; i++) { + if (s_pendings[i].is_used && s_pendings[i].expected_crc == crc) { + memcpy(out_peer, s_pendings[i].peer_pub, 32); + s_pendings[i].is_used = false; + return true; + } + } + return false; +} + +static void channel_compute_hash(meshcore_channel_t *ch) { + uint8_t h[32]; + meshcore_crypto_sha256(ch->secret, 16, h); + ch->hash = h[0]; +} + +static void channels_persist(void) { + mc_nvs_set_blob(MC_NVS_KEY_CHANNELS, s_channels, sizeof(s_channels)); +} + +static void channels_load_or_default(void) { + size_t len = sizeof(s_channels); + esp_err_t err = mc_nvs_get_blob(MC_NVS_KEY_CHANNELS, s_channels, &len); + if (err == ESP_OK && len == sizeof(s_channels)) { + ESP_LOGI(TAG, "Channels loaded from NVS"); + return; + } + memset(s_channels, 0, sizeof(s_channels)); + s_channels[0].is_used = true; + memcpy(s_channels[0].secret, MC_PUBLIC_CHANNEL_SECRET, 16); + strcpy(s_channels[0].name, "Public"); + channel_compute_hash(&s_channels[0]); + channels_persist(); + ESP_LOGI(TAG, "Channels: Public default in slot 0 (hash=0x%02X)", s_channels[0].hash); +} + +static void contacts_load(void) { + size_t len = sizeof(s_contacts); + esp_err_t err = mc_nvs_get_blob(MC_NVS_KEY_CONTACTS, s_contacts, &len); + if (err != ESP_OK || len != sizeof(s_contacts)) { + memset(s_contacts, 0, sizeof(s_contacts)); + return; + } + int n = 0; + for (int i = 0; i < MESHCORE_MAX_CONTACTS; i++) { + if (s_contacts[i].is_used) + n++; + } + ESP_LOGI(TAG, "Contacts loaded from NVS: %d entries", n); +} + +static meshcore_contact_t *contact_alloc_slot(const uint8_t pub_key[32]) { + for (int i = 0; i < MESHCORE_MAX_CONTACTS; i++) { + if (s_contacts[i].is_used && memcmp(s_contacts[i].pub_key, pub_key, 32) == 0) { + return &s_contacts[i]; + } + } + for (int i = 0; i < MESHCORE_MAX_CONTACTS; i++) { + if (!s_contacts[i].is_used) + return &s_contacts[i]; + } + int oldest = 0; + for (int i = 1; i < MESHCORE_MAX_CONTACTS; i++) { + if (s_contacts[i].lastmod < s_contacts[oldest].lastmod) + oldest = i; + } + return &s_contacts[oldest]; +} diff --git a/firmware_p4/components/Applications/LoRa/meshcore/meshcore_internal.h b/firmware_p4/components/Applications/LoRa/meshcore/meshcore_internal.h new file mode 100644 index 00000000..48c53cdf --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/meshcore/meshcore_internal.h @@ -0,0 +1,170 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#ifndef MESHCORE_INTERNAL_H +#define MESHCORE_INTERNAL_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include + +#include "esp_err.h" + +#include "meshcore.h" + +#define MC_VERSION_V1 0x00 +#define MC_HASH_SIZE_1B 0x00 +#define MC_CIPHER_KEY_SIZE 16 +#define MC_CIPHER_MAC_SIZE 2 +#define MC_CIPHER_BLOCK 16 +#define MC_HMAC_KEY_SIZE 32 +#define MC_PUB_KEY_SIZE 32 +#define MC_SIG_SIZE 64 + +#define MC_DEDUP_SIZE 128 +#define MC_DEDUP_TTL_MS (5 * 60 * 1000) + +#define MC_PENDINGS_SIZE 8 +#define MC_PENDING_TTL_MS 30000 + +#define MC_ADVERT_COOLDOWN_MS 10000 + +#define MC_RELAY_QUEUE_SIZE 4 +#define MC_RELAY_DELAY_MIN_MS 120 +#define MC_RELAY_DELAY_RANGE_MS 360 + +#define MC_CAD_TIMEOUT_MS 80 +#define MC_CAD_MAX_RETRIES 3 + +#define MC_FALLBACK_EPOCH 1767225600UL + +/** + * @brief Monotonic time in ms since boot (wraps at ~49 days). + */ +uint32_t mc_now_ms(void); + +/** + * @brief Read-only access to identity loaded in meshcore_init. + */ +const meshcore_identity_t *mc_get_identity(void); + +/** + * @brief Read-only access to callbacks registered in meshcore_init. + */ +const meshcore_callbacks_t *mc_get_callbacks(void); + +/** + * @brief Indicates whether continuous RX is active. + */ +bool mc_is_running(void); + +/** + * @brief Retrieves advert lat/lon for internal use (build_advert). + */ +void mc_get_advert_latlon_internal(int32_t *out_lat, int32_t *out_lon, bool *out_has); + +/* Wire format helpers (meshcore_crypto.c) */ +uint8_t mc_build_header(uint8_t ver, uint8_t ptype, uint8_t route); +uint8_t mc_build_path_len(uint8_t hash_size_sel, uint8_t count); +uint8_t mc_parse_hash_size(uint8_t sel); + +/** + * @brief sha256(a || b)[:out_len]. Used for ACK CRC. + */ +void mc_sha256_two( + uint8_t *out, size_t out_len, const uint8_t *a, size_t a_len, const uint8_t *b, size_t b_len); + +/* DB internal (meshcore_db.c) */ +bool mc_dedup_check_add(const uint8_t hash[8]); +void mc_pendings_gc(void); +void mc_pendings_add(uint32_t crc, const uint8_t peer_pub[32]); +bool mc_pendings_match(uint32_t crc, uint8_t out_peer[32]); + +/** + * @brief Initializes dedup, pendings, channels and contacts structures. + * Called by meshcore_init. + */ +void mc_db_init(void); + +/** + * @brief Read-only access to the channels array (use meshcore_channel_get + * for an individual slot). + */ +const meshcore_channel_t *mc_channels_array(void); + +/** + * @brief Mutable access to the contacts array for internal writes + * (process_path_payload, etc). + */ +meshcore_contact_t *mc_contacts_array_mut(void); + +/** + * @brief Looks up a contact and returns a mutable pointer (NULL if not found). + */ +meshcore_contact_t *mc_contact_find_mut(const uint8_t pub_key[32]); + +/** + * @brief Persists the contacts array to NVS. + */ +void mc_contacts_persist(void); + +/* Router internal (meshcore_router.c) */ + +/** + * @brief Initializes router state (relay queue, flags). Called by meshcore_init. + */ +void mc_router_init(void); + +/** + * @brief Drains the relay TX queue. Called by meshcore_poll. + */ +void mc_router_relay_process(void); + +/** + * @brief Marks the packet currently being processed as locally consumed + * (blocks relay for that packet). + */ +void mc_router_set_consumed(bool is_consumed); + +/** + * @brief Transmits raw bytes with anti-collision CAD + retry. + */ +esp_err_t mc_transmit_raw(const uint8_t *raw, uint16_t len); + +/** + * @brief Builds and sends an encrypted PAYLOAD_TYPE_PATH to a peer. + */ +esp_err_t mc_send_path_return(const uint8_t peer_pub_key[32], + const uint8_t *path_bytes, + uint8_t path_count, + uint8_t hash_size, + uint8_t extra_type, + const uint8_t *extra, + size_t extra_len); + +/** + * @brief Updates timestamp of last self-advert TX (for cooldown). + */ +void mc_router_mark_advert_sent(void); + +#ifdef __cplusplus +} +#endif + +#endif // MESHCORE_INTERNAL_H diff --git a/firmware_p4/components/Applications/LoRa/meshcore/meshcore_nvs.c b/firmware_p4/components/Applications/LoRa/meshcore/meshcore_nvs.c new file mode 100644 index 00000000..570c7504 --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/meshcore/meshcore_nvs.c @@ -0,0 +1,121 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#include "meshcore_nvs.h" + +#include "esp_log.h" +#include "nvs.h" +#include "nvs_flash.h" + +static const char *TAG = "MC_NVS"; + +static bool s_is_initialized = false; + +esp_err_t mc_nvs_init(void) { + if (s_is_initialized) + return ESP_OK; + esp_err_t err = nvs_flash_init(); + if (err == ESP_ERR_NVS_NO_FREE_PAGES || err == ESP_ERR_NVS_NEW_VERSION_FOUND) { + ESP_LOGW(TAG, "NVS partition needs erase, recreating"); + nvs_flash_erase(); + err = nvs_flash_init(); + } + if (err != ESP_OK) { + ESP_LOGE(TAG, "nvs_flash_init: %s", esp_err_to_name(err)); + return err; + } + s_is_initialized = true; + return ESP_OK; +} + +esp_err_t mc_nvs_get_blob(const char *key, void *out, size_t *len) { + nvs_handle_t h; + esp_err_t err = nvs_open(MC_NVS_NAMESPACE, NVS_READONLY, &h); + if (err != ESP_OK) + return err; + err = nvs_get_blob(h, key, out, len); + nvs_close(h); + return err; +} + +esp_err_t mc_nvs_set_blob(const char *key, const void *in, size_t len) { + nvs_handle_t h; + esp_err_t err = nvs_open(MC_NVS_NAMESPACE, NVS_READWRITE, &h); + if (err != ESP_OK) + return err; + err = nvs_set_blob(h, key, in, len); + if (err == ESP_OK) + err = nvs_commit(h); + nvs_close(h); + return err; +} + +esp_err_t mc_nvs_get_u32(const char *key, uint32_t *out) { + nvs_handle_t h; + esp_err_t err = nvs_open(MC_NVS_NAMESPACE, NVS_READONLY, &h); + if (err != ESP_OK) + return err; + err = nvs_get_u32(h, key, out); + nvs_close(h); + return err; +} + +esp_err_t mc_nvs_set_u32(const char *key, uint32_t val) { + nvs_handle_t h; + esp_err_t err = nvs_open(MC_NVS_NAMESPACE, NVS_READWRITE, &h); + if (err != ESP_OK) + return err; + err = nvs_set_u32(h, key, val); + if (err == ESP_OK) + err = nvs_commit(h); + nvs_close(h); + return err; +} + +esp_err_t mc_nvs_get_str(const char *key, char *out, size_t max) { + nvs_handle_t h; + esp_err_t err = nvs_open(MC_NVS_NAMESPACE, NVS_READONLY, &h); + if (err != ESP_OK) + return err; + err = nvs_get_str(h, key, out, &max); + nvs_close(h); + return err; +} + +esp_err_t mc_nvs_set_str(const char *key, const char *val) { + nvs_handle_t h; + esp_err_t err = nvs_open(MC_NVS_NAMESPACE, NVS_READWRITE, &h); + if (err != ESP_OK) + return err; + err = nvs_set_str(h, key, val); + if (err == ESP_OK) + err = nvs_commit(h); + nvs_close(h); + return err; +} + +esp_err_t mc_nvs_erase(const char *key) { + nvs_handle_t h; + esp_err_t err = nvs_open(MC_NVS_NAMESPACE, NVS_READWRITE, &h); + if (err != ESP_OK) + return err; + err = nvs_erase_key(h, key); + if (err == ESP_OK) + err = nvs_commit(h); + nvs_close(h); + if (err == ESP_ERR_NVS_NOT_FOUND) + return ESP_OK; + return err; +} diff --git a/firmware_p4/components/Applications/LoRa/meshcore/meshcore_phone_bridge.c b/firmware_p4/components/Applications/LoRa/meshcore/meshcore_phone_bridge.c new file mode 100644 index 00000000..d48312be --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/meshcore/meshcore_phone_bridge.c @@ -0,0 +1,339 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#include "meshcore_phone_bridge.h" + +#include + +#include "esp_log.h" +#include "freertos/FreeRTOS.h" +#include "freertos/semphr.h" +#include "freertos/task.h" + +#include "meshcore_phoneapi.h" +#include "spi_bridge.h" + +static const char *TAG = "MC_BRIDGE"; + +#define BRIDGE_TASK_STACK 4096 +#define BRIDGE_TASK_PRIO 5 +#define BRIDGE_STATUS_TICK_MS 200 +#define BRIDGE_SPI_TIMEOUT_MS 1000 +#define BRIDGE_RX_FRAME_MAX 512 +#define BRIDGE_TX_FRAME_MAX 240 +#define BRIDGE_CHUNK_PAYLOAD_MAX SPI_MESH_CHUNK_PAYLOAD_MAX +#define BRIDGE_MAX_CHUNKS 255 +#define BRIDGE_RECONCILE_INTERVAL 10 +#define BRIDGE_NAME_PREFIX_MAX 16 + +typedef struct { + bool is_active; + uint8_t seq; + uint8_t total_chunks; + uint8_t next_chunk_idx; + uint16_t accumulated_len; + uint8_t buf[BRIDGE_RX_FRAME_MAX]; +} bridge_reassembly_t; + +static bool s_is_initialized = false; +static volatile bool s_is_running = false; +static char s_name_prefix[BRIDGE_NAME_PREFIX_MAX] = "Highboy-MC"; +static TaskHandle_t s_status_task = NULL; +static SemaphoreHandle_t s_status_mutex = NULL; +static SemaphoreHandle_t s_tx_mutex = NULL; +static spi_mcore_status_t s_cached_status = {0}; +static uint8_t s_tx_seq = 0; +static bridge_reassembly_t s_rx = {0}; +static volatile bool s_want_ble_active = false; +static bool s_ble_active_on_c5 = false; +static uint16_t s_reconcile_ticks_remaining = BRIDGE_RECONCILE_INTERVAL; +static bool s_was_connected = false; + +static void status_task(void *pvParameters); +static void on_rx_stream(spi_id_t id, const uint8_t *payload, uint8_t len); +static void on_phoneapi_outbound(void *ctx, const uint8_t *data, uint16_t len); +static esp_err_t push_frame(const uint8_t *frame, uint16_t len); +static esp_err_t fetch_status(spi_mcore_status_t *out_status); +static void store_status(const spi_mcore_status_t *status); +static esp_err_t request_ble_init(void); +static esp_err_t request_ble_stop(void); +static void reconcile_transports(void); + +esp_err_t meshcore_phone_bridge_init(const char *name_prefix) { + if (s_is_initialized) { + return ESP_ERR_INVALID_STATE; + } + + if (name_prefix != NULL && name_prefix[0] != 0) { + strncpy(s_name_prefix, name_prefix, sizeof(s_name_prefix) - 1); + s_name_prefix[sizeof(s_name_prefix) - 1] = 0; + } + + memset(&s_rx, 0, sizeof(s_rx)); + memset(&s_cached_status, 0, sizeof(s_cached_status)); + s_tx_seq = 0; + s_want_ble_active = false; + s_ble_active_on_c5 = false; + s_reconcile_ticks_remaining = BRIDGE_RECONCILE_INTERVAL; + s_was_connected = false; + + s_status_mutex = xSemaphoreCreateMutex(); + if (s_status_mutex == NULL) { + ESP_LOGE(TAG, "Failed to create status mutex"); + return ESP_ERR_NO_MEM; + } + s_tx_mutex = xSemaphoreCreateMutex(); + if (s_tx_mutex == NULL) { + vSemaphoreDelete(s_status_mutex); + s_status_mutex = NULL; + ESP_LOGE(TAG, "Failed to create tx mutex"); + return ESP_ERR_NO_MEM; + } + + spi_bridge_register_stream_cb(SPI_ID_MCORE_RX_STREAM, on_rx_stream); + meshcore_phoneapi_set_outbound(on_phoneapi_outbound, NULL); + + s_is_running = true; + BaseType_t ok = xTaskCreate( + status_task, "mc_bridge", BRIDGE_TASK_STACK, NULL, BRIDGE_TASK_PRIO, &s_status_task); + if (ok != pdPASS) { + s_is_running = false; + meshcore_phoneapi_set_outbound(NULL, NULL); + spi_bridge_unregister_stream_cb(SPI_ID_MCORE_RX_STREAM); + vSemaphoreDelete(s_tx_mutex); + vSemaphoreDelete(s_status_mutex); + s_tx_mutex = NULL; + s_status_mutex = NULL; + ESP_LOGE(TAG, "Failed to create status task"); + return ESP_ERR_NO_MEM; + } + + s_is_initialized = true; + ESP_LOGI(TAG, "Initialized — prefix='%s'", s_name_prefix); + return ESP_OK; +} + +void meshcore_phone_bridge_stop(void) { + if (!s_is_initialized) { + return; + } + s_is_running = false; + meshcore_phoneapi_set_outbound(NULL, NULL); + spi_bridge_unregister_stream_cb(SPI_ID_MCORE_RX_STREAM); + s_is_initialized = false; +} + +esp_err_t meshcore_phone_bridge_ble_start(void) { + s_want_ble_active = true; + return request_ble_init(); +} + +esp_err_t meshcore_phone_bridge_ble_stop(void) { + s_want_ble_active = false; + return request_ble_stop(); +} + +bool meshcore_phone_bridge_is_connected(void) { + bool is_connected = false; + if (s_status_mutex == NULL) { + return false; + } + if (xSemaphoreTake(s_status_mutex, pdMS_TO_TICKS(BRIDGE_STATUS_TICK_MS)) == pdTRUE) { + is_connected = (s_cached_status.ble_connected != 0); + xSemaphoreGive(s_status_mutex); + } + return is_connected; +} + +static void status_task(void *pvParameters) { + (void)pvParameters; + + while (s_is_running) { + vTaskDelay(pdMS_TO_TICKS(BRIDGE_STATUS_TICK_MS)); + + if (s_reconcile_ticks_remaining == 0) { + reconcile_transports(); + s_reconcile_ticks_remaining = BRIDGE_RECONCILE_INTERVAL; + } else { + s_reconcile_ticks_remaining--; + } + + spi_mcore_status_t status = {0}; + if (fetch_status(&status) == ESP_OK) { + store_status(&status); + bool is_connected = (status.ble_connected != 0); + if (s_was_connected && !is_connected) { + meshcore_phoneapi_on_disconnect(); + } + s_was_connected = is_connected; + } + } + + s_status_task = NULL; + vTaskDelete(NULL); +} + +static void on_phoneapi_outbound(void *ctx, const uint8_t *data, uint16_t len) { + (void)ctx; + if (data == NULL || len == 0) { + return; + } + if (!s_was_connected) { + return; + } + if (push_frame(data, len) != ESP_OK) { + ESP_LOGW(TAG, "TX push failed (%u bytes)", len); + } +} + +static esp_err_t push_frame(const uint8_t *frame, uint16_t len) { + if (frame == NULL || len == 0 || len > BRIDGE_TX_FRAME_MAX) { + return ESP_ERR_INVALID_ARG; + } + + uint16_t total_u16 = (uint16_t)((len + BRIDGE_CHUNK_PAYLOAD_MAX - 1) / BRIDGE_CHUNK_PAYLOAD_MAX); + if (total_u16 == 0 || total_u16 > BRIDGE_MAX_CHUNKS) { + return ESP_ERR_INVALID_SIZE; + } + uint8_t total_chunks = (uint8_t)total_u16; + + if (s_tx_mutex == NULL || + xSemaphoreTake(s_tx_mutex, pdMS_TO_TICKS(BRIDGE_SPI_TIMEOUT_MS)) != pdTRUE) { + return ESP_ERR_TIMEOUT; + } + uint8_t seq = s_tx_seq++; + xSemaphoreGive(s_tx_mutex); + + uint8_t buf[SPI_MAX_PAYLOAD]; + spi_mesh_chunk_hdr_t hdr; + uint16_t offset = 0; + + for (uint8_t idx = 0; idx < total_chunks; idx++) { + uint16_t remaining = (uint16_t)(len - offset); + uint16_t this_chunk = + remaining > BRIDGE_CHUNK_PAYLOAD_MAX ? BRIDGE_CHUNK_PAYLOAD_MAX : remaining; + + hdr.seq = seq; + hdr.chunk_idx = idx; + hdr.total_chunks = total_chunks; + hdr.flags = (idx == (uint8_t)(total_chunks - 1)) ? SPI_MESH_CHUNK_FLAG_LAST : 0; + + memcpy(buf, &hdr, sizeof(hdr)); + memcpy(buf + sizeof(hdr), frame + offset, this_chunk); + + uint8_t cmd_len = (uint8_t)(sizeof(hdr) + this_chunk); + esp_err_t ret = spi_bridge_send_command( + SPI_ID_MCORE_TX_PUSH, buf, cmd_len, NULL, NULL, BRIDGE_SPI_TIMEOUT_MS); + if (ret != ESP_OK) { + return ret; + } + offset += this_chunk; + } + return ESP_OK; +} + +static void on_rx_stream(spi_id_t id, const uint8_t *payload, uint8_t len) { + (void)id; + if (payload == NULL || len < (uint8_t)sizeof(spi_mesh_chunk_hdr_t)) { + return; + } + + spi_mesh_chunk_hdr_t hdr; + memcpy(&hdr, payload, sizeof(hdr)); + const uint8_t *data = payload + sizeof(hdr); + uint8_t data_len = (uint8_t)(len - sizeof(hdr)); + + if (hdr.total_chunks == 0) { + return; + } + + if (hdr.chunk_idx == 0) { + s_rx.is_active = true; + s_rx.seq = hdr.seq; + s_rx.total_chunks = hdr.total_chunks; + s_rx.next_chunk_idx = 0; + s_rx.accumulated_len = 0; + } else if (!s_rx.is_active) { + return; + } + + if (hdr.seq != s_rx.seq || hdr.chunk_idx != s_rx.next_chunk_idx || + hdr.total_chunks != s_rx.total_chunks) { + s_rx.is_active = false; + return; + } + + if ((uint16_t)(s_rx.accumulated_len + data_len) > sizeof(s_rx.buf)) { + s_rx.is_active = false; + return; + } + + memcpy(s_rx.buf + s_rx.accumulated_len, data, data_len); + s_rx.accumulated_len = (uint16_t)(s_rx.accumulated_len + data_len); + s_rx.next_chunk_idx++; + + if (s_rx.next_chunk_idx >= s_rx.total_chunks) { + meshcore_phoneapi_on_inbound(s_rx.buf, s_rx.accumulated_len); + s_rx.is_active = false; + } +} + +static esp_err_t fetch_status(spi_mcore_status_t *out_status) { + if (out_status == NULL) { + return ESP_ERR_INVALID_ARG; + } + spi_header_t resp; + return spi_bridge_send_command( + SPI_ID_MCORE_STATUS, NULL, 0, &resp, (uint8_t *)out_status, BRIDGE_SPI_TIMEOUT_MS); +} + +static void store_status(const spi_mcore_status_t *status) { + if (status == NULL || s_status_mutex == NULL) { + return; + } + if (xSemaphoreTake(s_status_mutex, pdMS_TO_TICKS(BRIDGE_STATUS_TICK_MS)) == pdTRUE) { + s_cached_status = *status; + xSemaphoreGive(s_status_mutex); + } +} + +static esp_err_t request_ble_init(void) { + spi_mcore_init_t req = {0}; + strncpy(req.name_prefix, s_name_prefix, sizeof(req.name_prefix) - 1); + req.pin = meshcore_phoneapi_get_pin(); + esp_err_t ret = spi_bridge_send_command( + SPI_ID_MCORE_BLE_INIT, (uint8_t *)&req, sizeof(req), NULL, NULL, BRIDGE_SPI_TIMEOUT_MS); + if (ret == ESP_OK) { + s_ble_active_on_c5 = true; + } + return ret; +} + +static esp_err_t request_ble_stop(void) { + esp_err_t ret = + spi_bridge_send_command(SPI_ID_MCORE_BLE_STOP, NULL, 0, NULL, NULL, BRIDGE_SPI_TIMEOUT_MS); + if (ret == ESP_OK) { + s_ble_active_on_c5 = false; + } + return ret; +} + +static void reconcile_transports(void) { + if (s_want_ble_active && !s_ble_active_on_c5) { + request_ble_init(); + } else if (!s_want_ble_active && s_ble_active_on_c5) { + request_ble_stop(); + } +} diff --git a/firmware_p4/components/Applications/LoRa/meshcore/meshcore_phoneapi.c b/firmware_p4/components/Applications/LoRa/meshcore/meshcore_phoneapi.c new file mode 100644 index 00000000..33bad58f --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/meshcore/meshcore_phoneapi.c @@ -0,0 +1,1114 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#include "meshcore_phoneapi.h" + +#include +#include +#include + +#include "esp_err.h" +#include "esp_log.h" +#include "esp_random.h" + +#include "meshcore.h" +#include "meshcore_internal.h" +#include "meshcore_nvs.h" + +static const char *TAG = "MC_PHONEAPI"; + +#define CMD_APP_START 0x01 +#define CMD_SEND_TXT_MSG 0x02 +#define CMD_SEND_CHANNEL_TXT_MSG 0x03 +#define CMD_GET_CONTACTS 0x04 +#define CMD_GET_DEVICE_TIME 0x05 +#define CMD_SET_DEVICE_TIME 0x06 +#define CMD_SEND_SELF_ADVERT 0x07 +#define CMD_SET_ADVERT_NAME 0x08 +#define CMD_ADD_UPDATE_CONTACT 0x09 +#define CMD_SYNC_NEXT_MESSAGE 0x0A +#define CMD_SET_RADIO_PARAMS 0x0B +#define CMD_SET_RADIO_TX_POWER 0x0C +#define CMD_RESET_PATH 0x0D +#define CMD_SET_ADVERT_LATLON 0x0E +#define CMD_REMOVE_CONTACT 0x0F +#define CMD_SHARE_CONTACT 0x10 +#define CMD_EXPORT_CONTACT 0x11 +#define CMD_IMPORT_CONTACT 0x12 +#define CMD_REBOOT 0x13 +#define CMD_GET_BATT_AND_STORAGE 0x14 +#define CMD_SET_TUNING_PARAMS 0x15 +#define CMD_DEVICE_QUERY 0x16 +#define CMD_GET_CONTACT_BY_KEY 0x1E +#define CMD_GET_CHANNEL 0x1F +#define CMD_SET_CHANNEL 0x20 +#define CMD_GET_CUSTOM_VARS 0x28 +#define CMD_SET_CUSTOM_VAR 0x29 +#define CMD_GET_ADVERT_PATH 0x2A +#define CMD_SET_FLOOD_SCOPE 0x36 +#define CMD_SET_AUTOADD_CONFIG 0x3A +#define CMD_GET_AUTOADD_CONFIG 0x3B + +#define RESP_CODE_OK 0x00 +#define RESP_CODE_ERR 0x01 +#define RESP_CODE_CONTACTS_START 0x02 +#define RESP_CODE_CONTACT 0x03 +#define RESP_CODE_END_OF_CONTACTS 0x04 +#define RESP_CODE_SELF_INFO 0x05 +#define RESP_CODE_SENT 0x06 +#define RESP_CODE_CONTACT_MSG_RECV 0x07 +#define RESP_CODE_CHANNEL_MSG_RECV 0x08 +#define RESP_CODE_CURR_TIME 0x09 +#define RESP_CODE_NO_MORE_MESSAGES 0x0A +#define RESP_CODE_EXPORT_CONTACT 0x0B +#define RESP_CODE_BATT_AND_STORAGE 0x0C +#define RESP_CODE_DEVICE_INFO 0x0D +#define RESP_CODE_CONTACT_MSG_RECV_V3 0x10 +#define RESP_CODE_CHANNEL_MSG_RECV_V3 0x11 +#define RESP_CODE_CHANNEL_INFO 0x12 +#define RESP_CODE_CUSTOM_VARS 0x15 +#define RESP_CODE_ADVERT_PATH 0x16 +#define RESP_CODE_AUTOADD_CONFIG 0x19 + +#define PUSH_CODE_ADVERT 0x80 +#define PUSH_CODE_PATH_UPDATED 0x81 +#define PUSH_CODE_SEND_CONFIRMED 0x82 +#define PUSH_CODE_MSG_WAITING 0x83 +#define PUSH_CODE_NEW_ADVERT 0x8A + +#define ERR_CODE_UNSUPPORTED_CMD 1 +#define ERR_CODE_NOT_FOUND 2 +#define ERR_CODE_TABLE_FULL 3 +#define ERR_CODE_BAD_STATE 4 +#define ERR_CODE_FILE_IO_ERROR 5 +#define ERR_CODE_ILLEGAL_ARG 6 + +#define FIRMWARE_VER_CODE 10 +#define FIRMWARE_VERSION "v1.14.1" +#define DEVICE_MODEL "Highboy-MC-S3" + +#define TXT_TYPE_PLAIN 0x00 + +#define CONTACT_FRAME_SIZE 143 + +#define MC_OFFLINE_QUEUE_SIZE 16 +#define MC_OFFLINE_FRAME_MAX 240 + +#define MC_NVS_KEY_BLE_PIN "ble_pin" +#define MC_NVS_KEY_AUTOADD "autoadd" + +#define MC_BLE_PIN_MIN 100000U +#define MC_BLE_PIN_MAX 999999U + +#define MESHCORE_PUBKEY_PREFIX_LEN 6 +#define MESHCORE_CHANNEL_SECRET_LEN 16 +#define SEND_TXT_DEFAULT_TIMEOUT_MS 10000 +#define BATT_STORAGE_DEFAULT_MV 4100 +#define BATT_STORAGE_DEFAULT_USED_KB 8 +#define BATT_STORAGE_DEFAULT_TOTAL_KB 1024 + +#define MC_AUTOADD_DEFAULT_CONFIG 0 +#define MC_AUTOADD_DEFAULT_MAX_HOPS 3 +#define MC_AUTOADD_MAX_HOPS_CLAMP 64 + +typedef struct { + uint16_t len; + uint8_t buf[MC_OFFLINE_FRAME_MAX]; +} mc_queued_frame_t; + +static bool s_is_initialized = false; +static uint8_t s_app_target_ver = 0; +static uint32_t s_ble_pin = 0; +static uint8_t s_autoadd_config = MC_AUTOADD_DEFAULT_CONFIG; +static uint8_t s_autoadd_max_hops = MC_AUTOADD_DEFAULT_MAX_HOPS; +static meshcore_phoneapi_outbound_cb_t s_outbound_cb = NULL; +static void *s_outbound_ctx = NULL; + +static mc_queued_frame_t s_offline_queue[MC_OFFLINE_QUEUE_SIZE]; +static uint8_t s_offline_queue_len = 0; + +static void send_resp(const uint8_t *buf, uint16_t len); +static void send_err(uint8_t sub); +static void send_ok(void); + +static uint32_t load_or_generate_ble_pin(void); + +static void offline_queue_push(const uint8_t *frame, uint16_t len); +static bool offline_queue_pop(uint8_t *out, uint16_t *out_len); + +static void serialize_contact(uint8_t out[CONTACT_FRAME_SIZE], const meshcore_contact_t *c); +static void deserialize_contact(meshcore_contact_t *c, const uint8_t in[], size_t in_len); +static void write_contact_resp_frame(uint8_t code, const meshcore_contact_t *c); + +static void handle_device_query(const uint8_t *p, uint16_t len); +static void handle_app_start(const uint8_t *p, uint16_t len); +static void handle_batt_storage(const uint8_t *p, uint16_t len); +static void handle_sync_next_msg(const uint8_t *p, uint16_t len); +static void handle_get_device_time(const uint8_t *p, uint16_t len); +static void handle_set_device_time(const uint8_t *p, uint16_t len); +static void handle_send_self_advert(const uint8_t *p, uint16_t len); +static void handle_set_advert_name(const uint8_t *p, uint16_t len); +static void handle_set_advert_latlon(const uint8_t *p, uint16_t len); +static void handle_add_update_contact(const uint8_t *p, uint16_t len); +static void handle_get_contact_by_key(const uint8_t *p, uint16_t len); +static void handle_get_contacts(const uint8_t *p, uint16_t len); +static void handle_remove_contact(const uint8_t *p, uint16_t len); +static void handle_share_contact(const uint8_t *p, uint16_t len); +static void handle_export_contact(const uint8_t *p, uint16_t len); +static void handle_import_contact(const uint8_t *p, uint16_t len); +static void handle_reset_path(const uint8_t *p, uint16_t len); +static void handle_get_channel(const uint8_t *p, uint16_t len); +static void handle_set_channel(const uint8_t *p, uint16_t len); +static void handle_get_advert_path(const uint8_t *p, uint16_t len); +static void handle_send_channel_txt(const uint8_t *p, uint16_t len); +static void handle_send_txt_msg(const uint8_t *p, uint16_t len); +static void handle_set_radio_params(const uint8_t *p, uint16_t len); +static void handle_set_radio_tx_power(const uint8_t *p, uint16_t len); +static void handle_get_autoadd_config(const uint8_t *p, uint16_t len); +static void handle_set_autoadd_config(const uint8_t *p, uint16_t len); +static void handle_get_custom_vars(const uint8_t *p, uint16_t len); +static void handle_set_custom_var(const uint8_t *p, uint16_t len); +static void autoadd_load(void); +static void autoadd_persist(void); + +esp_err_t meshcore_phoneapi_init(void) { + if (s_is_initialized) { + return ESP_ERR_INVALID_STATE; + } + s_ble_pin = load_or_generate_ble_pin(); + autoadd_load(); + s_app_target_ver = 0; + s_offline_queue_len = 0; + s_outbound_cb = NULL; + s_outbound_ctx = NULL; + s_is_initialized = true; + ESP_LOGI(TAG, "Initialized — PIN=%lu", (unsigned long)s_ble_pin); + return ESP_OK; +} + +void meshcore_phoneapi_set_outbound(meshcore_phoneapi_outbound_cb_t cb, void *ctx) { + s_outbound_cb = cb; + s_outbound_ctx = ctx; +} + +uint32_t meshcore_phoneapi_get_pin(void) { + return s_ble_pin; +} + +void meshcore_phoneapi_on_disconnect(void) { + s_app_target_ver = 0; + s_offline_queue_len = 0; +} + +void meshcore_phoneapi_on_inbound(const uint8_t *buf, uint16_t len) { + if (buf == NULL || len == 0) { + return; + } + + ESP_LOGI(TAG, "CMD 0x%02X (%u bytes)", buf[0], len); + + switch (buf[0]) { + case CMD_DEVICE_QUERY: + handle_device_query(buf, len); + break; + case CMD_APP_START: + handle_app_start(buf, len); + break; + case CMD_GET_BATT_AND_STORAGE: + handle_batt_storage(buf, len); + break; + case CMD_SYNC_NEXT_MESSAGE: + handle_sync_next_msg(buf, len); + break; + case CMD_GET_DEVICE_TIME: + handle_get_device_time(buf, len); + break; + case CMD_SET_DEVICE_TIME: + handle_set_device_time(buf, len); + break; + case CMD_SEND_SELF_ADVERT: + handle_send_self_advert(buf, len); + break; + case CMD_SET_ADVERT_NAME: + handle_set_advert_name(buf, len); + break; + case CMD_SET_ADVERT_LATLON: + handle_set_advert_latlon(buf, len); + break; + case CMD_SEND_CHANNEL_TXT_MSG: + handle_send_channel_txt(buf, len); + break; + case CMD_SEND_TXT_MSG: + handle_send_txt_msg(buf, len); + break; + case CMD_GET_CONTACTS: + handle_get_contacts(buf, len); + break; + case CMD_GET_CHANNEL: + handle_get_channel(buf, len); + break; + case CMD_SET_CHANNEL: + handle_set_channel(buf, len); + break; + case CMD_GET_ADVERT_PATH: + handle_get_advert_path(buf, len); + break; + case CMD_ADD_UPDATE_CONTACT: + handle_add_update_contact(buf, len); + break; + case CMD_GET_CONTACT_BY_KEY: + handle_get_contact_by_key(buf, len); + break; + case CMD_REMOVE_CONTACT: + handle_remove_contact(buf, len); + break; + case CMD_SHARE_CONTACT: + handle_share_contact(buf, len); + break; + case CMD_EXPORT_CONTACT: + handle_export_contact(buf, len); + break; + case CMD_IMPORT_CONTACT: + handle_import_contact(buf, len); + break; + case CMD_RESET_PATH: + handle_reset_path(buf, len); + break; + case CMD_SET_RADIO_PARAMS: + handle_set_radio_params(buf, len); + break; + case CMD_SET_RADIO_TX_POWER: + handle_set_radio_tx_power(buf, len); + break; + case CMD_GET_AUTOADD_CONFIG: + handle_get_autoadd_config(buf, len); + break; + case CMD_SET_AUTOADD_CONFIG: + handle_set_autoadd_config(buf, len); + break; + case CMD_GET_CUSTOM_VARS: + handle_get_custom_vars(buf, len); + break; + case CMD_SET_CUSTOM_VAR: + handle_set_custom_var(buf, len); + break; + + case CMD_SET_TUNING_PARAMS: + case CMD_SET_FLOOD_SCOPE: + send_ok(); + break; + + default: + ESP_LOGW(TAG, "Unhandled CMD 0x%02X", buf[0]); + send_ok(); + break; + } +} + +void meshcore_phoneapi_push_new_advert(const meshcore_contact_t *c) { + uint8_t buf[1 + CONTACT_FRAME_SIZE + 4]; + buf[0] = PUSH_CODE_NEW_ADVERT; + serialize_contact(&buf[1], c); + memcpy(&buf[1 + CONTACT_FRAME_SIZE], &c->lastmod, 4); + send_resp(buf, sizeof(buf)); + ESP_LOGI(TAG, "push NEW_ADVERT name='%s' type=%u", c->name, c->type); +} + +void meshcore_phoneapi_push_channel_msg( + uint8_t channel_idx, uint8_t path_len, uint32_t timestamp, int8_t snr, const char *text) { + uint8_t buf[240]; + uint16_t o = 0; + + if (s_app_target_ver >= 3) { + buf[o++] = RESP_CODE_CHANNEL_MSG_RECV_V3; + buf[o++] = (uint8_t)((int8_t)(snr * 4)); + buf[o++] = 0; + buf[o++] = 0; + } else { + buf[o++] = RESP_CODE_CHANNEL_MSG_RECV; + } + + buf[o++] = channel_idx; + buf[o++] = path_len; + buf[o++] = TXT_TYPE_PLAIN; + memcpy(&buf[o], ×tamp, 4); + o += 4; + + uint16_t tl = (uint16_t)strlen(text); + if (o + tl >= sizeof(buf)) + tl = sizeof(buf) - o; + memcpy(&buf[o], text, tl); + o += tl; + + offline_queue_push(buf, o); + uint8_t tickle = PUSH_CODE_MSG_WAITING; + send_resp(&tickle, 1); + ESP_LOGI(TAG, + "queue CHANNEL_MSG %s ch=%u snr=%d text='%s'", + s_app_target_ver >= 3 ? "V3" : "V1", + channel_idx, + snr, + text); +} + +void meshcore_phoneapi_push_contact_msg(const uint8_t peer_pub_key[32], + uint8_t path_len, + uint8_t txt_type, + uint32_t timestamp, + int8_t snr, + const char *text) { + uint8_t buf[240]; + uint16_t o = 0; + + if (s_app_target_ver >= 3) { + buf[o++] = RESP_CODE_CONTACT_MSG_RECV_V3; + buf[o++] = (uint8_t)((int8_t)(snr * 4)); + buf[o++] = 0; + buf[o++] = 0; + } else { + buf[o++] = RESP_CODE_CONTACT_MSG_RECV; + } + + memcpy(&buf[o], peer_pub_key, 6); + o += 6; + buf[o++] = path_len; + buf[o++] = txt_type; + memcpy(&buf[o], ×tamp, 4); + o += 4; + + uint16_t tl = (uint16_t)strlen(text); + if (o + tl >= sizeof(buf)) + tl = sizeof(buf) - o; + memcpy(&buf[o], text, tl); + o += tl; + + offline_queue_push(buf, o); + uint8_t tickle = PUSH_CODE_MSG_WAITING; + send_resp(&tickle, 1); + ESP_LOGI(TAG, + "queue CONTACT_MSG %s peer=%02X%02X%02X%02X txt_type=%u text='%s'", + s_app_target_ver >= 3 ? "V3" : "V1", + peer_pub_key[0], + peer_pub_key[1], + peer_pub_key[2], + peer_pub_key[3], + txt_type, + text); +} + +void meshcore_phoneapi_push_send_confirmed(uint32_t ack_crc, uint8_t snr) { + (void)snr; + uint8_t buf[9]; + buf[0] = PUSH_CODE_SEND_CONFIRMED; + memcpy(&buf[1], &ack_crc, 4); + uint32_t trip_time_ms = 0; + memcpy(&buf[5], &trip_time_ms, 4); + send_resp(buf, sizeof(buf)); + ESP_LOGI(TAG, "push SEND_CONFIRMED CRC=0x%08lX", (unsigned long)ack_crc); +} + +void meshcore_phoneapi_push_path_updated(const meshcore_contact_t *c) { + uint8_t buf[1 + CONTACT_FRAME_SIZE + 4]; + buf[0] = PUSH_CODE_PATH_UPDATED; + serialize_contact(&buf[1], c); + memcpy(&buf[1 + CONTACT_FRAME_SIZE], &c->lastmod, 4); + send_resp(buf, sizeof(buf)); +} + +static void send_resp(const uint8_t *buf, uint16_t len) { + if (s_outbound_cb == NULL) { + ESP_LOGW(TAG, "No outbound bridge, drop %u bytes", len); + return; + } + s_outbound_cb(s_outbound_ctx, buf, len); +} + +static void send_err(uint8_t sub) { + uint8_t resp[2] = {RESP_CODE_ERR, sub}; + send_resp(resp, 2); +} + +static void send_ok(void) { + uint8_t resp[1] = {RESP_CODE_OK}; + send_resp(resp, 1); +} + +static uint32_t load_or_generate_ble_pin(void) { + uint32_t pin = 0; + if (mc_nvs_get_u32(MC_NVS_KEY_BLE_PIN, &pin) == ESP_OK && pin >= MC_BLE_PIN_MIN && + pin <= MC_BLE_PIN_MAX) { + return pin; + } + pin = MC_BLE_PIN_MIN + (esp_random() % (MC_BLE_PIN_MAX - MC_BLE_PIN_MIN + 1)); + mc_nvs_set_u32(MC_NVS_KEY_BLE_PIN, pin); + ESP_LOGI(TAG, "BLE PIN generated: %lu", (unsigned long)pin); + return pin; +} + +static void offline_queue_push(const uint8_t *frame, uint16_t len) { + if (len == 0 || len > MC_OFFLINE_FRAME_MAX) + return; + if (s_offline_queue_len >= MC_OFFLINE_QUEUE_SIZE) { + for (int i = 0; i < MC_OFFLINE_QUEUE_SIZE - 1; i++) { + s_offline_queue[i] = s_offline_queue[i + 1]; + } + s_offline_queue_len = MC_OFFLINE_QUEUE_SIZE - 1; + } + s_offline_queue[s_offline_queue_len].len = len; + memcpy(s_offline_queue[s_offline_queue_len].buf, frame, len); + s_offline_queue_len++; +} + +static bool offline_queue_pop(uint8_t *out, uint16_t *out_len) { + if (s_offline_queue_len == 0) + return false; + *out_len = s_offline_queue[0].len; + memcpy(out, s_offline_queue[0].buf, *out_len); + for (int i = 0; i < s_offline_queue_len - 1; i++) { + s_offline_queue[i] = s_offline_queue[i + 1]; + } + s_offline_queue_len--; + return true; +} + +static void serialize_contact(uint8_t out[CONTACT_FRAME_SIZE], const meshcore_contact_t *c) { + uint16_t o = 0; + memcpy(&out[o], c->pub_key, 32); + o += 32; + out[o++] = c->type; + out[o++] = c->flags; + out[o++] = c->out_path_len; + memcpy(&out[o], c->out_path, MESHCORE_MAX_PATH); + o += MESHCORE_MAX_PATH; + memset(&out[o], 0, MESHCORE_NAME_MAX); + strncpy((char *)&out[o], c->name, MESHCORE_NAME_MAX); + o += MESHCORE_NAME_MAX; + memcpy(&out[o], &c->last_advert, 4); + o += 4; + memcpy(&out[o], &c->gps_lat, 4); + o += 4; + memcpy(&out[o], &c->gps_lon, 4); + o += 4; +} + +static void deserialize_contact(meshcore_contact_t *c, const uint8_t in[], size_t in_len) { + memset(c, 0, sizeof(*c)); + c->is_used = true; + if (in_len < CONTACT_FRAME_SIZE) + return; + uint16_t o = 0; + memcpy(c->pub_key, &in[o], 32); + o += 32; + c->type = in[o++]; + c->flags = in[o++]; + c->out_path_len = in[o++]; + memcpy(c->out_path, &in[o], MESHCORE_MAX_PATH); + o += MESHCORE_MAX_PATH; + char tmp[MESHCORE_NAME_MAX + 1] = {0}; + memcpy(tmp, &in[o], MESHCORE_NAME_MAX); + strncpy(c->name, tmp, MESHCORE_NAME_MAX - 1); + c->name[MESHCORE_NAME_MAX - 1] = 0; + o += MESHCORE_NAME_MAX; + memcpy(&c->last_advert, &in[o], 4); + o += 4; + memcpy(&c->gps_lat, &in[o], 4); + o += 4; + memcpy(&c->gps_lon, &in[o], 4); + o += 4; + if (in_len >= CONTACT_FRAME_SIZE + 4) { + memcpy(&c->lastmod, &in[o], 4); + } +} + +static void write_contact_resp_frame(uint8_t code, const meshcore_contact_t *c) { + uint8_t buf[1 + CONTACT_FRAME_SIZE + 4]; + buf[0] = code; + serialize_contact(&buf[1], c); + memcpy(&buf[1 + CONTACT_FRAME_SIZE], &c->lastmod, 4); + send_resp(buf, sizeof(buf)); +} + +static void handle_device_query(const uint8_t *p, uint16_t len) { + if (len >= 2) { + s_app_target_ver = p[1]; + ESP_LOGI(TAG, "app_target_ver = %u", s_app_target_ver); + } + uint8_t resp[80]; + uint16_t o = 0; + resp[o++] = RESP_CODE_DEVICE_INFO; + resp[o++] = FIRMWARE_VER_CODE; + resp[o++] = MESHCORE_MAX_CONTACTS / 2; + resp[o++] = MESHCORE_MAX_CHANNELS; + + resp[o++] = (uint8_t)(s_ble_pin & 0xFF); + resp[o++] = (uint8_t)((s_ble_pin >> 8) & 0xFF); + resp[o++] = (uint8_t)((s_ble_pin >> 16) & 0xFF); + resp[o++] = (uint8_t)((s_ble_pin >> 24) & 0xFF); + + const char *bd = __DATE__; + uint8_t bl = (uint8_t)strlen(bd); + if (bl > 12) + bl = 12; + memcpy(&resp[o], bd, bl); + o += bl; + while (bl++ < 12) { + resp[o++] = 0; + } + + const char *mo = DEVICE_MODEL; + uint8_t ml = (uint8_t)strlen(mo); + if (ml > 40) + ml = 40; + memcpy(&resp[o], mo, ml); + o += ml; + while (ml++ < 40) { + resp[o++] = 0; + } + + const char *ve = FIRMWARE_VERSION; + uint8_t vl = (uint8_t)strlen(ve); + if (vl > 20) + vl = 20; + memcpy(&resp[o], ve, vl); + o += vl; + while (vl++ < 20) { + resp[o++] = 0; + } + + resp[o++] = 0; + resp[o++] = 0; + + ESP_LOGI(TAG, "-> DEVICE_INFO (%u bytes, target_ver=%u)", o, s_app_target_ver); + send_resp(resp, o); +} + +static void handle_app_start(const uint8_t *p, uint16_t len) { + const meshcore_radio_prefs_t *rp = meshcore_get_radio_prefs(); + + uint8_t resp[128]; + uint16_t o = 0; + resp[o++] = RESP_CODE_SELF_INFO; + resp[o++] = meshcore_get_adv_type(); + resp[o++] = (uint8_t)rp->tx_power_dbm; + resp[o++] = 22; + + uint8_t pub[32] = {0}; + meshcore_get_pub_key(pub); + memcpy(&resp[o], pub, 32); + o += 32; + + int32_t lat = 0, lon = 0; + bool is_has_latlon = false; + meshcore_get_advert_latlon(&lat, &lon, &is_has_latlon); + memcpy(&resp[o], &lat, 4); + o += 4; + memcpy(&resp[o], &lon, 4); + o += 4; + + resp[o++] = 0; + resp[o++] = 0; + resp[o++] = 0; + resp[o++] = 0; + + uint32_t freq_khz = rp->freq_hz / 1000; + uint32_t bw_khz = rp->bw_hz / 1000; + memcpy(&resp[o], &freq_khz, 4); + o += 4; + memcpy(&resp[o], &bw_khz, 4); + o += 4; + resp[o++] = rp->sf; + resp[o++] = rp->cr; + + char nm[MESHCORE_NAME_MAX] = {0}; + meshcore_get_name(nm, sizeof(nm)); + uint8_t nl = (uint8_t)strlen(nm); + if (o + nl >= sizeof(resp)) + nl = (uint8_t)(sizeof(resp) - o - 1); + memcpy(&resp[o], nm, nl); + o += nl; + + ESP_LOGI(TAG, "-> SELF_INFO (%u bytes, name='%s')", o, nm); + send_resp(resp, o); +} + +static void handle_batt_storage(const uint8_t *p, uint16_t len) { + (void)p; + (void)len; + uint8_t resp[11]; + uint16_t o = 0; + resp[o++] = RESP_CODE_BATT_AND_STORAGE; + uint16_t batt_mv = BATT_STORAGE_DEFAULT_MV; + memcpy(&resp[o], &batt_mv, 2); + o += 2; + uint32_t used_kb = BATT_STORAGE_DEFAULT_USED_KB; + uint32_t total_kb = BATT_STORAGE_DEFAULT_TOTAL_KB; + memcpy(&resp[o], &used_kb, 4); + o += 4; + memcpy(&resp[o], &total_kb, 4); + o += 4; + send_resp(resp, o); +} + +static void handle_sync_next_msg(const uint8_t *p, uint16_t len) { + uint8_t frame[MC_OFFLINE_FRAME_MAX]; + uint16_t flen = 0; + if (offline_queue_pop(frame, &flen)) { + ESP_LOGI(TAG, "-> SYNC msg (qlen=%u, %u bytes)", s_offline_queue_len, flen); + send_resp(frame, flen); + return; + } + uint8_t resp[1] = {RESP_CODE_NO_MORE_MESSAGES}; + send_resp(resp, 1); +} + +static void handle_get_device_time(const uint8_t *p, uint16_t len) { + uint32_t ts = meshcore_get_unix_time(); + uint8_t resp[5]; + resp[0] = RESP_CODE_CURR_TIME; + memcpy(&resp[1], &ts, 4); + send_resp(resp, sizeof(resp)); +} + +static void handle_set_device_time(const uint8_t *p, uint16_t len) { + if (len >= 5) { + uint32_t ts; + memcpy(&ts, &p[1], 4); + meshcore_set_unix_time(ts); + } + send_ok(); +} + +static void handle_send_self_advert(const uint8_t *p, uint16_t len) { + meshcore_send_advert(); + send_ok(); +} + +static void handle_set_advert_name(const uint8_t *p, uint16_t len) { + if (len < 2) { + send_err(ERR_CODE_ILLEGAL_ARG); + return; + } + char name[MESHCORE_NAME_MAX] = {0}; + uint16_t nl = len - 1; + if (nl > MESHCORE_NAME_MAX - 1) + nl = MESHCORE_NAME_MAX - 1; + memcpy(name, &p[1], nl); + name[nl] = 0; + meshcore_set_node_name(name); + send_ok(); +} + +static void handle_set_advert_latlon(const uint8_t *p, uint16_t len) { + if (len < 1 + 8) { + send_err(ERR_CODE_ILLEGAL_ARG); + return; + } + int32_t lat, lon; + memcpy(&lat, &p[1], 4); + memcpy(&lon, &p[5], 4); + bool has = (lat != 0 || lon != 0); + meshcore_set_advert_latlon(lat, lon, has); + send_ok(); +} + +static void handle_add_update_contact(const uint8_t *p, uint16_t len) { + if (len < 1 + CONTACT_FRAME_SIZE) { + send_err(ERR_CODE_ILLEGAL_ARG); + return; + } + meshcore_contact_t c; + deserialize_contact(&c, &p[1], len - 1); + if (!meshcore_contact_upsert(&c)) { + send_err(ERR_CODE_TABLE_FULL); + return; + } + ESP_LOGI(TAG, + "Contact ADD/UPDATE pubkey=%02X%02X%02X%02X type=%u", + c.pub_key[0], + c.pub_key[1], + c.pub_key[2], + c.pub_key[3], + c.type); + send_ok(); +} + +static void handle_get_contact_by_key(const uint8_t *p, uint16_t len) { + if (len < 1 + 32) { + send_err(ERR_CODE_ILLEGAL_ARG); + return; + } + const meshcore_contact_t *c = meshcore_contact_find(&p[1]); + if (c == NULL) { + send_err(ERR_CODE_NOT_FOUND); + return; + } + write_contact_resp_frame(RESP_CODE_CONTACT, c); +} + +static void handle_get_contacts(const uint8_t *p, uint16_t len) { + uint32_t since = 0; + if (len >= 5) + memcpy(&since, &p[1], 4); + + uint32_t count = 0; + const meshcore_contact_t *arr = meshcore_contacts_array(); + for (int i = 0; i < MESHCORE_MAX_CONTACTS; i++) { + if (arr[i].is_used && arr[i].lastmod >= since) + count++; + } + + uint8_t start[5]; + start[0] = RESP_CODE_CONTACTS_START; + memcpy(&start[1], &count, 4); + send_resp(start, 5); + + uint32_t max_lastmod = 0; + for (int i = 0; i < MESHCORE_MAX_CONTACTS; i++) { + if (arr[i].is_used && arr[i].lastmod >= since) { + write_contact_resp_frame(RESP_CODE_CONTACT, &arr[i]); + if (arr[i].lastmod > max_lastmod) + max_lastmod = arr[i].lastmod; + } + } + + uint8_t end[5] = {RESP_CODE_END_OF_CONTACTS, 0, 0, 0, 0}; + memcpy(&end[1], &max_lastmod, 4); + send_resp(end, 5); + ESP_LOGI(TAG, "-> CONTACTS (%lu entries since=%lu)", (unsigned long)count, (unsigned long)since); +} + +static void handle_remove_contact(const uint8_t *p, uint16_t len) { + if (len < 1 + 32) { + send_err(ERR_CODE_ILLEGAL_ARG); + return; + } + if (!meshcore_contact_remove(&p[1])) { + send_err(ERR_CODE_NOT_FOUND); + return; + } + send_ok(); +} + +static void handle_share_contact(const uint8_t *p, uint16_t len) { + meshcore_send_advert(); + send_ok(); +} + +static void handle_export_contact(const uint8_t *p, uint16_t len) { + if (len < 1 + 32) { + uint8_t resp[1 + MESHCORE_MAX_RAW]; + resp[0] = RESP_CODE_EXPORT_CONTACT; + int32_t lat = 0, lon = 0; + bool has_latlon = false; + mc_get_advert_latlon_internal(&lat, &lon, &has_latlon); + uint16_t n = meshcore_packet_build_advert(mc_get_identity(), + lat, + lon, + has_latlon, + meshcore_get_unix_time(), + &resp[1], + sizeof(resp) - 1); + if (n == 0) { + send_err(ERR_CODE_TABLE_FULL); + return; + } + send_resp(resp, 1 + n); + return; + } + const meshcore_contact_t *c = meshcore_contact_find(&p[1]); + if (c == NULL) { + send_err(ERR_CODE_NOT_FOUND); + return; + } + uint8_t resp[1 + 32]; + resp[0] = RESP_CODE_EXPORT_CONTACT; + memcpy(&resp[1], c->pub_key, 32); + send_resp(resp, sizeof(resp)); +} + +static void handle_import_contact(const uint8_t *p, uint16_t len) { + if (len < 1 + 32 + 2) { + send_err(ERR_CODE_ILLEGAL_ARG); + return; + } + meshcore_contact_t c; + memset(&c, 0, sizeof(c)); + c.is_used = true; + memcpy(c.pub_key, &p[1], 32); + c.type = p[33]; + c.flags = p[34]; + c.out_path_len = MESHCORE_OUT_PATH_UNKNOWN; + c.lastmod = meshcore_get_unix_time(); + if (!meshcore_contact_upsert(&c)) { + send_err(ERR_CODE_TABLE_FULL); + return; + } + send_ok(); +} + +static void handle_reset_path(const uint8_t *p, uint16_t len) { + if (len < 1 + 32) { + send_err(ERR_CODE_ILLEGAL_ARG); + return; + } + if (!meshcore_contact_reset_path(&p[1])) { + send_err(ERR_CODE_NOT_FOUND); + return; + } + send_ok(); +} + +static void handle_get_channel(const uint8_t *p, uint16_t len) { + uint8_t idx = (len >= 2) ? p[1] : 0; + if (idx >= MESHCORE_MAX_CHANNELS) { + send_err(ERR_CODE_NOT_FOUND); + return; + } + const meshcore_channel_t *ch = meshcore_channel_get(idx); + uint8_t resp[2 + MESHCORE_NAME_MAX + MESHCORE_CHANNEL_SECRET_LEN]; + uint16_t o = 0; + resp[o++] = RESP_CODE_CHANNEL_INFO; + resp[o++] = idx; + memset(&resp[o], 0, MESHCORE_NAME_MAX); + if (ch != NULL) { + strncpy((char *)&resp[o], ch->name, MESHCORE_NAME_MAX); + } + o += MESHCORE_NAME_MAX; + if (ch != NULL) { + memcpy(&resp[o], ch->secret, MESHCORE_CHANNEL_SECRET_LEN); + } else { + memset(&resp[o], 0, MESHCORE_CHANNEL_SECRET_LEN); + } + o += MESHCORE_CHANNEL_SECRET_LEN; + send_resp(resp, o); +} + +static void handle_set_channel(const uint8_t *p, uint16_t len) { + if (len < 2 + MESHCORE_NAME_MAX + 16) { + send_err(ERR_CODE_ILLEGAL_ARG); + return; + } + uint8_t idx = p[1]; + char name[MESHCORE_NAME_MAX + 1] = {0}; + memcpy(name, &p[2], MESHCORE_NAME_MAX); + if (!meshcore_channel_set(idx, name, &p[2 + MESHCORE_NAME_MAX])) { + send_err(ERR_CODE_ILLEGAL_ARG); + return; + } + send_ok(); +} + +static void handle_get_advert_path(const uint8_t *p, uint16_t len) { + if (len < 2 + 32) { + send_err(ERR_CODE_ILLEGAL_ARG); + return; + } + const meshcore_contact_t *c = meshcore_contact_find(&p[2]); + uint32_t ts = meshcore_get_unix_time(); + uint8_t resp[6 + MESHCORE_MAX_PATH]; + uint16_t o = 0; + resp[o++] = RESP_CODE_ADVERT_PATH; + memcpy(&resp[o], &ts, 4); + o += 4; + if (c == NULL || c->out_path_len == MESHCORE_OUT_PATH_UNKNOWN) { + resp[o++] = 0; + } else { + resp[o++] = c->out_path_len; + memcpy(&resp[o], c->out_path, c->out_path_len); + o += c->out_path_len; + } + send_resp(resp, o); +} + +static void handle_send_channel_txt(const uint8_t *p, uint16_t len) { + if (len < 1 + 1 + 1 + 4) { + send_err(ERR_CODE_ILLEGAL_ARG); + return; + } + uint8_t channel_idx = p[2]; + uint16_t text_off = 1 + 1 + 1 + 4; + uint16_t text_len = len - text_off; + + char text[MESHCORE_TEXT_MAX + 1]; + if (text_len > sizeof(text) - 1) { + text_len = sizeof(text) - 1; + } + memcpy(text, &p[text_off], text_len); + text[text_len] = 0; + + esp_err_t ret = meshcore_send_grp_txt(channel_idx, text); + if (ret != ESP_OK) { + send_err(ERR_CODE_NOT_FOUND); + return; + } + send_ok(); +} + +static void handle_send_txt_msg(const uint8_t *p, uint16_t len) { + if (len < 1 + 1 + 1 + 4 + MESHCORE_PUBKEY_PREFIX_LEN) { + send_err(ERR_CODE_ILLEGAL_ARG); + return; + } + uint8_t txt_type = p[1]; + uint8_t attempt = p[2]; + uint32_t ts; + memcpy(&ts, &p[3], 4); + const uint8_t *prefix = &p[7]; + uint16_t text_off = 1 + 1 + 1 + 4 + MESHCORE_PUBKEY_PREFIX_LEN; + uint16_t text_len = len - text_off; + char text[MESHCORE_TEXT_MAX + 1]; + if (text_len > sizeof(text) - 1) { + text_len = sizeof(text) - 1; + } + memcpy(text, &p[text_off], text_len); + text[text_len] = 0; + (void)txt_type; + + const meshcore_contact_t *arr = meshcore_contacts_array(); + const meshcore_contact_t *contact = NULL; + for (int i = 0; i < MESHCORE_MAX_CONTACTS; i++) { + if (arr[i].is_used && memcmp(arr[i].pub_key, prefix, MESHCORE_PUBKEY_PREFIX_LEN) == 0) { + contact = &arr[i]; + break; + } + } + if (contact == NULL) { + ESP_LOGW(TAG, + "DM TX: contact with prefix %02X%02X%02X%02X%02X%02X not found", + prefix[0], + prefix[1], + prefix[2], + prefix[3], + prefix[4], + prefix[5]); + send_err(ERR_CODE_NOT_FOUND); + return; + } + + uint32_t expected_ack = 0; + esp_err_t ret = meshcore_send_direct_msg(contact->pub_key, text, ts, attempt, &expected_ack); + if (ret != ESP_OK) { + send_err(ERR_CODE_BAD_STATE); + return; + } + + uint8_t resp[1 + 1 + 4 + 4]; + uint16_t o = 0; + resp[o++] = RESP_CODE_SENT; + resp[o++] = 1; + memcpy(&resp[o], &expected_ack, 4); + o += 4; + uint32_t timeout_ms = SEND_TXT_DEFAULT_TIMEOUT_MS; + memcpy(&resp[o], &timeout_ms, 4); + o += 4; + send_resp(resp, o); + ESP_LOGI(TAG, + "DM TX queued (peer=%02X%02X%02X%02X tag=0x%08lX)", + contact->pub_key[0], + contact->pub_key[1], + contact->pub_key[2], + contact->pub_key[3], + (unsigned long)expected_ack); +} + +static void handle_set_radio_params(const uint8_t *p, uint16_t len) { + if (len < 1 + 4 + 4 + 1 + 1) { + send_err(ERR_CODE_ILLEGAL_ARG); + return; + } + uint32_t freq_khz, bw_khz; + memcpy(&freq_khz, &p[1], 4); + memcpy(&bw_khz, &p[5], 4); + uint8_t sf = p[9]; + uint8_t cr = p[10]; + + if (meshcore_set_radio_params( + freq_khz * 1000UL, bw_khz * 1000UL, sf, cr, meshcore_get_radio_prefs()->tx_power_dbm) != + ESP_OK) { + send_err(ERR_CODE_ILLEGAL_ARG); + return; + } + send_ok(); +} + +static void handle_set_radio_tx_power(const uint8_t *p, uint16_t len) { + if (len < 2) { + send_err(ERR_CODE_ILLEGAL_ARG); + return; + } + int8_t power = (int8_t)p[1]; + const meshcore_radio_prefs_t *rp = meshcore_get_radio_prefs(); + if (meshcore_set_radio_params(rp->freq_hz, rp->bw_hz, rp->sf, rp->cr, power) != ESP_OK) { + send_err(ERR_CODE_ILLEGAL_ARG); + return; + } + send_ok(); +} + +static void handle_get_autoadd_config(const uint8_t *p, uint16_t len) { + (void)p; + (void)len; + uint8_t resp[3]; + resp[0] = RESP_CODE_AUTOADD_CONFIG; + resp[1] = s_autoadd_config; + resp[2] = s_autoadd_max_hops; + send_resp(resp, sizeof(resp)); +} + +static void handle_set_autoadd_config(const uint8_t *p, uint16_t len) { + if (len < 2) { + send_err(ERR_CODE_ILLEGAL_ARG); + return; + } + s_autoadd_config = p[1]; + if (len >= 3) { + uint8_t hops = p[2]; + if (hops > MC_AUTOADD_MAX_HOPS_CLAMP) { + hops = MC_AUTOADD_MAX_HOPS_CLAMP; + } + s_autoadd_max_hops = hops; + } + autoadd_persist(); + send_ok(); +} + +static void handle_get_custom_vars(const uint8_t *p, uint16_t len) { + (void)p; + (void)len; + uint8_t resp[1] = {RESP_CODE_CUSTOM_VARS}; + send_resp(resp, sizeof(resp)); +} + +static void handle_set_custom_var(const uint8_t *p, uint16_t len) { + (void)p; + (void)len; + send_err(ERR_CODE_ILLEGAL_ARG); +} + +static void autoadd_load(void) { + uint32_t packed = 0; + if (mc_nvs_get_u32(MC_NVS_KEY_AUTOADD, &packed) == ESP_OK) { + s_autoadd_config = (uint8_t)(packed & 0xFF); + s_autoadd_max_hops = (uint8_t)((packed >> 8) & 0xFF); + if (s_autoadd_max_hops > MC_AUTOADD_MAX_HOPS_CLAMP) { + s_autoadd_max_hops = MC_AUTOADD_MAX_HOPS_CLAMP; + } + } +} + +static void autoadd_persist(void) { + uint32_t packed = (uint32_t)s_autoadd_config | ((uint32_t)s_autoadd_max_hops << 8); + mc_nvs_set_u32(MC_NVS_KEY_AUTOADD, packed); +} diff --git a/firmware_p4/components/Applications/LoRa/meshcore/meshcore_router.c b/firmware_p4/components/Applications/LoRa/meshcore/meshcore_router.c new file mode 100644 index 00000000..8f508aed --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/meshcore/meshcore_router.c @@ -0,0 +1,838 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#include "meshcore_internal.h" + +#include +#include +#include + +#include "esp_log.h" +#include "esp_random.h" +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" + +#include "ed25519.h" +#include "sx1262.h" +#include "sx1262_regs.h" + +static const char *TAG = "MC_ROUTER"; + +typedef struct { + bool is_used; + uint32_t tx_at_ms; + uint16_t len; + uint8_t buf[MESHCORE_MAX_RAW]; +} mc_relay_slot_t; + +static bool s_is_relay_enabled = false; +static bool s_is_packet_consumed = false; +static uint32_t s_last_advert_ms = 0; + +static mc_relay_slot_t s_relay_queue[MC_RELAY_QUEUE_SIZE]; + +static volatile bool s_is_cad_pending = false; +static volatile bool s_is_cad_busy = false; + +static void process_advert(const meshcore_packet_view_t *pkt); +static void process_grp_txt(const meshcore_packet_view_t *pkt); +static void process_txt_msg(const meshcore_packet_view_t *pkt); +static void process_ack(const meshcore_packet_view_t *pkt); +static void process_path_payload(const meshcore_packet_view_t *pkt); + +static void on_rx_done(const sx1262_packet_t *pkt, void *ctx); +static void on_tx_done(void *ctx); +static void on_timeout(void *ctx); +static void on_cad_done(bool is_active, void *ctx); + +static bool cad_check_clear(void); + +static void relay_enqueue(const uint8_t *buf, uint16_t len, uint32_t delay_ms); +static void try_relay(const meshcore_packet_view_t *view, const uint8_t *raw, uint16_t raw_len); + +esp_err_t meshcore_send_advert(void) { + int32_t lat, lon; + bool has; + mc_get_advert_latlon_internal(&lat, &lon, &has); + + uint8_t buf[256]; + uint16_t n = meshcore_packet_build_advert( + mc_get_identity(), lat, lon, has, meshcore_get_unix_time(), buf, sizeof(buf)); + if (n == 0) + return ESP_FAIL; + ESP_LOGI(TAG, "TX ADVERT: %u bytes", n); + s_last_advert_ms = mc_now_ms(); + return mc_transmit_raw(buf, n); +} + +esp_err_t meshcore_send_advert_throttled(void) { + uint32_t t = mc_now_ms(); + if (s_last_advert_ms != 0 && (t - s_last_advert_ms) < MC_ADVERT_COOLDOWN_MS) { + return ESP_ERR_INVALID_STATE; + } + return meshcore_send_advert(); +} + +esp_err_t meshcore_send_grp_txt(uint8_t channel_idx, const char *text) { + if (channel_idx >= MESHCORE_MAX_CHANNELS) + return ESP_ERR_INVALID_ARG; + const meshcore_channel_t *ch = meshcore_channel_get(channel_idx); + if (ch == NULL) + return ESP_ERR_NOT_FOUND; + if (text == NULL) + return ESP_ERR_INVALID_ARG; + + uint8_t shared[32]; + memset(shared, 0, 32); + memcpy(shared, ch->secret, 16); + + uint8_t buf[256]; + uint16_t n = meshcore_packet_build_grp_txt( + ch->hash, shared, mc_get_identity()->name, text, meshcore_get_unix_time(), buf, sizeof(buf)); + if (n == 0) + return ESP_FAIL; + ESP_LOGI(TAG, "TX GRP_TXT[%u]: %u bytes ('%s')", channel_idx, n, text); + return mc_transmit_raw(buf, n); +} + +esp_err_t meshcore_send_direct_msg(const uint8_t peer_pub_key[32], + const char *text, + uint32_t timestamp, + uint8_t attempt, + uint32_t *out_expected_ack) { + if (peer_pub_key == NULL || text == NULL) + return ESP_ERR_INVALID_ARG; + int text_len = (int)strlen(text); + if (text_len > MESHCORE_TEXT_MAX) + text_len = MESHCORE_TEXT_MAX; + + const meshcore_identity_t *id = mc_get_identity(); + + uint8_t plaintext[5 + MESHCORE_TEXT_MAX + 1]; + memcpy(&plaintext[0], ×tamp, 4); + plaintext[4] = (attempt & 3); + memcpy(&plaintext[5], text, text_len); + plaintext[5 + text_len] = 0; + int pt_len = 5 + text_len + 1; + + uint32_t ack_crc; + mc_sha256_two((uint8_t *)&ack_crc, 4, plaintext, 5 + text_len, id->pub_key, 32); + if (out_expected_ack != NULL) + *out_expected_ack = ack_crc; + + uint8_t shared[32]; + ed25519_key_exchange(shared, peer_pub_key, id->priv_key); + + const meshcore_contact_t *c = meshcore_contact_find(peer_pub_key); + bool has_path = (c != NULL && c->out_path_len != MESHCORE_OUT_PATH_UNKNOWN); + uint8_t route_type = has_path ? MC_RT_DIRECT : MC_RT_FLOOD; + + uint8_t buf[256]; + uint16_t pos = 0; + buf[pos++] = mc_build_header(MC_VERSION_V1, MC_PT_TXT_MSG, route_type); + + if (has_path) { + buf[pos++] = c->out_path_len; + uint8_t hash_count = c->out_path_len & 0x3F; + uint8_t hash_size = ((c->out_path_len >> 6) & 0x03) + 1; + uint16_t path_bytes_total = (uint16_t)hash_count * hash_size; + memcpy(&buf[pos], c->out_path, path_bytes_total); + pos += path_bytes_total; + } else { + buf[pos++] = mc_build_path_len(MC_HASH_SIZE_1B, 0); + } + + buf[pos++] = peer_pub_key[0]; + buf[pos++] = id->pub_key[0]; + + int enc_written = meshcore_crypto_encrypt_mac(shared, &buf[pos], plaintext, pt_len); + pos += enc_written; + + mc_pendings_add(ack_crc, peer_pub_key); + + ESP_LOGI(TAG, + "TX DM %s dst=%02X%02X%02X%02X len=%d ACK_CRC=0x%08lX", + has_path ? "DIRECT" : "FLOOD", + peer_pub_key[0], + peer_pub_key[1], + peer_pub_key[2], + peer_pub_key[3], + text_len, + (unsigned long)ack_crc); + + return mc_transmit_raw(buf, pos); +} + +void meshcore_set_relay(bool is_enabled) { + s_is_relay_enabled = is_enabled; + ESP_LOGI(TAG, "Relay %s", is_enabled ? "ENABLED" : "disabled"); +} + +bool meshcore_get_relay(void) { + return s_is_relay_enabled; +} + +void mc_router_init(void) { + s_is_relay_enabled = false; + s_is_packet_consumed = false; + s_last_advert_ms = 0; + memset(s_relay_queue, 0, sizeof(s_relay_queue)); + + sx1262_callbacks_t cbs = { + .on_rx_done = on_rx_done, + .on_tx_done = on_tx_done, + .on_timeout = on_timeout, + .on_cad_done = on_cad_done, + .on_error = NULL, + .cb_ctx = NULL, + }; + sx1262_set_callbacks(&cbs); +} + +void mc_router_set_consumed(bool is_consumed) { + s_is_packet_consumed = is_consumed; +} + +void mc_router_mark_advert_sent(void) { + s_last_advert_ms = mc_now_ms(); +} + +void mc_router_relay_process(void) { + uint32_t t = mc_now_ms(); + for (int i = 0; i < MC_RELAY_QUEUE_SIZE; i++) { + if (s_relay_queue[i].is_used && (int32_t)(t - s_relay_queue[i].tx_at_ms) >= 0) { + ESP_LOGI(TAG, "Relay TX (%u bytes)", s_relay_queue[i].len); + mc_transmit_raw(s_relay_queue[i].buf, s_relay_queue[i].len); + s_relay_queue[i].is_used = false; + return; + } + } +} + +esp_err_t mc_transmit_raw(const uint8_t *raw, uint16_t len) { + if (len > MESHCORE_MAX_RAW) + return ESP_ERR_INVALID_SIZE; + + meshcore_packet_view_t self_view; + if (meshcore_packet_parse(raw, len, &self_view)) { + uint8_t self_hash[8]; + meshcore_packet_hash(&self_view, self_hash); + mc_dedup_check_add(self_hash); + } + + for (int attempt = 0; attempt < MC_CAD_MAX_RETRIES; attempt++) { + if (cad_check_clear()) + break; + uint32_t delay = MC_RELAY_DELAY_MIN_MS + (esp_random() % MC_RELAY_DELAY_RANGE_MS); + vTaskDelay(pdMS_TO_TICKS(delay)); + if (attempt + 1 == MC_CAD_MAX_RETRIES) { + ESP_LOGW(TAG, "CAD: %d attempts busy -- TX anyway", MC_CAD_MAX_RETRIES); + } + } + + sx1262_stop_rx(); + esp_err_t ret = sx1262_transmit(raw, (uint8_t)len, 5000); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "TX failed: %s", esp_err_to_name(ret)); + if (mc_is_running()) + sx1262_receive_continuous(); + return ret; + } + for (int i = 0; i < 500; i++) { + sx1262_process_irq(); + if (sx1262_get_state() == SX1262_STATE_STDBY_RC) + break; + vTaskDelay(1); + } + if (mc_is_running()) + sx1262_receive_continuous(); + return ESP_OK; +} + +esp_err_t mc_send_path_return(const uint8_t peer_pub_key[32], + const uint8_t *path_bytes, + uint8_t path_count, + uint8_t hash_size, + uint8_t extra_type, + const uint8_t *extra, + size_t extra_len) { + if (peer_pub_key == NULL) + return ESP_ERR_INVALID_ARG; + + const meshcore_identity_t *id = mc_get_identity(); + + uint8_t shared[32]; + ed25519_key_exchange(shared, peer_pub_key, id->priv_key); + + uint8_t plaintext[2 + MESHCORE_MAX_PATH + 1 + 16]; + int pt_len = 0; + uint8_t hash_size_sel = (uint8_t)((hash_size - 1) & 0x03); + plaintext[pt_len++] = mc_build_path_len(hash_size_sel, path_count); + uint16_t path_bytes_total = (uint16_t)path_count * hash_size; + if (path_bytes_total > MESHCORE_MAX_PATH) + return ESP_ERR_INVALID_SIZE; + memcpy(&plaintext[pt_len], path_bytes, path_bytes_total); + pt_len += path_bytes_total; + if (extra_len > 0 && extra != NULL) { + plaintext[pt_len++] = extra_type & 0x0F; + memcpy(&plaintext[pt_len], extra, extra_len); + pt_len += extra_len; + } else { + plaintext[pt_len++] = 0xFF; + for (int i = 0; i < 4; i++) + plaintext[pt_len++] = (uint8_t)esp_random(); + } + + uint8_t buf[256]; + uint16_t pos = 0; + buf[pos++] = mc_build_header(MC_VERSION_V1, MC_PT_PATH, MC_RT_FLOOD); + buf[pos++] = mc_build_path_len(MC_HASH_SIZE_1B, 0); + buf[pos++] = peer_pub_key[0]; + buf[pos++] = id->pub_key[0]; + int enc_written = meshcore_crypto_encrypt_mac(shared, &buf[pos], plaintext, pt_len); + pos += enc_written; + + ESP_LOGI(TAG, + "TX PATH return -> %02X%02X%02X%02X count=%u %s", + peer_pub_key[0], + peer_pub_key[1], + peer_pub_key[2], + peer_pub_key[3], + path_count, + extra_len > 0 ? "(+ACK)" : ""); + return mc_transmit_raw(buf, pos); +} + +static void process_advert(const meshcore_packet_view_t *pkt) { + if (pkt->payload_len < 32 + 4 + 64 + 1) { + ESP_LOGW(TAG, "ADVERT too short (%u)", pkt->payload_len); + return; + } + const uint8_t *p = pkt->payload; + const uint8_t *pubkey = p; + uint32_t ts = + (uint32_t)p[32] | ((uint32_t)p[33] << 8) | ((uint32_t)p[34] << 16) | ((uint32_t)p[35] << 24); + const uint8_t *sig = p + 32 + 4; + const uint8_t *app_data = p + 32 + 4 + 64; + uint16_t app_len = pkt->payload_len - (32 + 4 + 64); + + uint16_t sig_app_len = app_len > 32 ? 32 : app_len; + uint8_t sign_buf[32 + 4 + 32]; + memcpy(&sign_buf[0], pubkey, 32); + memcpy(&sign_buf[32], &p[32], 4); + memcpy(&sign_buf[36], app_data, sig_app_len); + if (!ed25519_verify(sig, sign_buf, 36 + sig_app_len, pubkey)) { + ESP_LOGW(TAG, + "ADVERT invalid sig (%02X%02X%02X%02X) -- discard", + pubkey[0], + pubkey[1], + pubkey[2], + pubkey[3]); + return; + } + + char name[33] = "?"; + int32_t lat_e6 = 0, lon_e6 = 0; + uint8_t adv_type = 0; + if (app_len >= 1) { + uint8_t flags = app_data[0]; + adv_type = flags & 0x0F; + uint16_t off = 1; + if (flags & MESHCORE_ADV_FLAG_HAS_LATLON) { + if (off + 8 <= app_len) { + memcpy(&lat_e6, &app_data[off], 4); + off += 4; + memcpy(&lon_e6, &app_data[off], 4); + off += 4; + } else { + off = app_len; + } + } + if ((flags & MESHCORE_ADV_FLAG_HAS_NAME) && off < app_len) { + uint16_t nl = app_len - off; + if (nl > 32) + nl = 32; + memcpy(name, &app_data[off], nl); + name[nl] = 0; + } + } + + if (memcmp(pubkey, mc_get_identity()->pub_key, 32) == 0) { + return; + } + + meshcore_contact_t c; + memset(&c, 0, sizeof(c)); + c.is_used = true; + memcpy(c.pub_key, pubkey, 32); + c.type = (adv_type >= 1 && adv_type <= 4) ? adv_type : MC_ADV_TYPE_CHAT; + c.flags = 0; + c.out_path_len = MESHCORE_OUT_PATH_UNKNOWN; + strncpy(c.name, name, MESHCORE_NAME_MAX - 1); + c.last_advert = ts; + c.gps_lat = lat_e6; + c.gps_lon = lon_e6; + c.lastmod = meshcore_get_unix_time(); + meshcore_contact_upsert(&c); + + const meshcore_callbacks_t *cbs = mc_get_callbacks(); + if (cbs->on_advert != NULL) { + const meshcore_contact_t *stored = meshcore_contact_find(pubkey); + if (stored != NULL) { + cbs->on_advert(stored, pkt->rssi_dbm, pkt->snr_db, cbs->ctx); + } + } +} + +static void process_grp_txt(const meshcore_packet_view_t *pkt) { + if (pkt->payload_len < 1 + 2 + 16) { + ESP_LOGW(TAG, "GRP_TXT too short (%u)", pkt->payload_len); + return; + } + uint8_t ch_hash = pkt->payload[0]; + const meshcore_channel_t *channels = mc_channels_array(); + + for (int idx = 0; idx < MESHCORE_MAX_CHANNELS; idx++) { + if (!channels[idx].is_used) + continue; + if (channels[idx].hash != ch_hash) + continue; + + uint8_t shared[32]; + memset(shared, 0, 32); + memcpy(shared, channels[idx].secret, 16); + + uint8_t plaintext[160]; + int pt_len = + meshcore_crypto_mac_decrypt(shared, plaintext, pkt->payload + 1, pkt->payload_len - 1); + if (pt_len <= 5) + continue; + + uint32_t ts = (uint32_t)plaintext[0] | ((uint32_t)plaintext[1] << 8) | + ((uint32_t)plaintext[2] << 16) | ((uint32_t)plaintext[3] << 24); + uint8_t txt_type = plaintext[4] >> 2; + if (txt_type != MC_TXT_TYPE_PLAIN) { + return; + } + + int text_len = pt_len - 5; + while (text_len > 0 && plaintext[5 + text_len - 1] == 0) + text_len--; + char text[160]; + if (text_len > (int)sizeof(text) - 1) + text_len = sizeof(text) - 1; + memcpy(text, &plaintext[5], text_len); + text[text_len] = 0; + + const meshcore_callbacks_t *cbs = mc_get_callbacks(); + if (cbs->on_grp_txt != NULL) { + cbs->on_grp_txt( + (uint8_t)idx, pkt->path_count, text, ts, pkt->rssi_dbm, pkt->snr_db, cbs->ctx); + } + return; + } +} + +static void process_txt_msg(const meshcore_packet_view_t *pkt) { + if (pkt->payload_len < 1 + 1 + 2 + 16) { + ESP_LOGW(TAG, "TXT_MSG too short (%u)", pkt->payload_len); + return; + } + uint8_t dest_hash = pkt->payload[0]; + uint8_t src_hash = pkt->payload[1]; + + const meshcore_identity_t *id = mc_get_identity(); + if (dest_hash != id->pub_key[0]) { + return; + } + + meshcore_contact_t *contacts = mc_contacts_array_mut(); + for (int i = 0; i < MESHCORE_MAX_CONTACTS; i++) { + if (!contacts[i].is_used) + continue; + if (contacts[i].pub_key[0] != src_hash) + continue; + + uint8_t shared[32]; + ed25519_key_exchange(shared, contacts[i].pub_key, id->priv_key); + + uint8_t plaintext[160]; + int pt_len = + meshcore_crypto_mac_decrypt(shared, plaintext, pkt->payload + 2, pkt->payload_len - 2); + if (pt_len <= 5) + continue; + + uint32_t ts = (uint32_t)plaintext[0] | ((uint32_t)plaintext[1] << 8) | + ((uint32_t)plaintext[2] << 16) | ((uint32_t)plaintext[3] << 24); + uint8_t flags = plaintext[4]; + uint8_t attempt = flags & 0x03; + uint8_t txt_type = flags >> 2; + (void)attempt; + + const char *text_start = (const char *)&plaintext[5]; + int text_len = pt_len - 5; + char text[160]; + + if (txt_type == MC_TXT_TYPE_SIGNED_PLAIN) { + if (text_len < 4) { + ESP_LOGW(TAG, "DM SIGNED_PLAIN truncated"); + return; + } + text_start += 4; + text_len -= 4; + } + + while (text_len > 0 && text_start[text_len - 1] == 0) + text_len--; + if (text_len > (int)sizeof(text) - 1) + text_len = sizeof(text) - 1; + memcpy(text, text_start, text_len); + text[text_len] = 0; + + ESP_LOGI(TAG, + "DM RX from %02X%02X%02X%02X txt_type=%u: \"%s\"", + contacts[i].pub_key[0], + contacts[i].pub_key[1], + contacts[i].pub_key[2], + contacts[i].pub_key[3], + txt_type, + text); + + uint8_t crc_text_off = 5; + if (txt_type == MC_TXT_TYPE_SIGNED_PLAIN) + crc_text_off = 9; + int crc_text_len = (int)strlen((char *)&plaintext[crc_text_off]); + if (crc_text_len > pt_len - crc_text_off) + crc_text_len = pt_len - crc_text_off; + + uint32_t ack_crc; + mc_sha256_two( + (uint8_t *)&ack_crc, 4, plaintext, crc_text_off + crc_text_len, contacts[i].pub_key, 32); + + s_is_packet_consumed = true; + + const meshcore_callbacks_t *cbs = mc_get_callbacks(); + if (cbs->on_direct_msg != NULL) { + cbs->on_direct_msg(contacts[i].pub_key, + text, + ts, + txt_type, + pkt->path_count, + pkt->rssi_dbm, + pkt->snr_db, + cbs->ctx); + } + + if (pkt->route_type == MC_RT_FLOOD || pkt->route_type == MC_RT_TRANSPORT_FLOOD) { + mc_send_path_return(contacts[i].pub_key, + pkt->path, + pkt->path_count, + pkt->hash_size, + MC_PT_ACK, + (const uint8_t *)&ack_crc, + 4); + } else { + uint8_t ack_buf[16]; + uint8_t ack_pos = 0; + ack_buf[ack_pos++] = mc_build_header(MC_VERSION_V1, MC_PT_ACK, MC_RT_FLOOD); + ack_buf[ack_pos++] = mc_build_path_len(MC_HASH_SIZE_1B, 0); + memcpy(&ack_buf[ack_pos], &ack_crc, 4); + ack_pos += 4; + mc_transmit_raw(ack_buf, ack_pos); + } + return; + } + + ESP_LOGW(TAG, "DM dest=0x%02X src=0x%02X but sender unknown", dest_hash, src_hash); +} + +static void process_ack(const meshcore_packet_view_t *pkt) { + if (pkt->payload_len < 4) + return; + uint32_t crc; + memcpy(&crc, pkt->payload, 4); + + uint8_t peer_pub[32]; + if (mc_pendings_match(crc, peer_pub)) { + ESP_LOGI(TAG, "ACK matched pending CRC=0x%08lX", (unsigned long)crc); + const meshcore_callbacks_t *cbs = mc_get_callbacks(); + if (cbs->on_ack != NULL) + cbs->on_ack(crc, peer_pub, cbs->ctx); + s_is_packet_consumed = true; + } +} + +static void process_path_payload(const meshcore_packet_view_t *pkt) { + if (pkt->payload_len < 4 + 16) + return; + uint8_t dst_hash = pkt->payload[0]; + uint8_t src_hash = pkt->payload[1]; + + const meshcore_identity_t *id = mc_get_identity(); + if (dst_hash != id->pub_key[0]) + return; + + meshcore_contact_t *contacts = mc_contacts_array_mut(); + for (int i = 0; i < MESHCORE_MAX_CONTACTS; i++) { + if (!contacts[i].is_used) + continue; + if (contacts[i].pub_key[0] != src_hash) + continue; + + uint8_t shared[32]; + ed25519_key_exchange(shared, contacts[i].pub_key, id->priv_key); + + uint8_t plaintext[200]; + int pt_len = + meshcore_crypto_mac_decrypt(shared, plaintext, pkt->payload + 2, pkt->payload_len - 2); + if (pt_len <= 0) + continue; + + uint8_t pl_byte = plaintext[0]; + uint8_t hash_count = pl_byte & 0x3F; + uint8_t hash_size = mc_parse_hash_size((pl_byte >> 6) & 0x03); + if (hash_size == 0) + continue; + + uint16_t path_bytes_total = (uint16_t)hash_count * hash_size; + if (1 + path_bytes_total > pt_len) + continue; + if (path_bytes_total > MESHCORE_MAX_PATH) + continue; + + contacts[i].out_path_len = pl_byte; + memset(contacts[i].out_path, 0, MESHCORE_MAX_PATH); + if (path_bytes_total > 0) { + memcpy(contacts[i].out_path, &plaintext[1], path_bytes_total); + } + contacts[i].lastmod = meshcore_get_unix_time(); + mc_contacts_persist(); + s_is_packet_consumed = true; + + ESP_LOGI(TAG, + "PATH inbound: %02X%02X%02X%02X learned (count=%u size=%u)", + contacts[i].pub_key[0], + contacts[i].pub_key[1], + contacts[i].pub_key[2], + contacts[i].pub_key[3], + hash_count, + hash_size); + + const meshcore_callbacks_t *cbs = mc_get_callbacks(); + if (cbs->on_path_update != NULL) { + cbs->on_path_update(&contacts[i], cbs->ctx); + } + + int extras_off = 1 + path_bytes_total; + if (extras_off + 1 <= pt_len) { + uint8_t extra_type = plaintext[extras_off] & 0x0F; + int extra_len = pt_len - (extras_off + 1); + if (extra_type == MC_PT_ACK && extra_len >= 4) { + uint32_t crc; + memcpy(&crc, &plaintext[extras_off + 1], 4); + uint8_t peer_pub[32]; + if (mc_pendings_match(crc, peer_pub)) { + ESP_LOGI(TAG, "PATH+ACK piggyback CRC=0x%08lX", (unsigned long)crc); + if (cbs->on_ack != NULL) + cbs->on_ack(crc, peer_pub, cbs->ctx); + } + } + } + return; + } +} + +static void on_rx_done(const sx1262_packet_t *pkt, void *ctx) { + (void)ctx; + if (pkt == NULL) + return; + if (pkt->has_crc_error || pkt->has_header_error) { + ESP_LOGW(TAG, "RX HW error -- skip"); + return; + } + + meshcore_packet_view_t view; + if (!meshcore_packet_parse(pkt->buf, pkt->len, &view)) { + ESP_LOGW(TAG, "RX parse failed (%d bytes)", pkt->len); + return; + } + view.rssi_dbm = pkt->rssi_pkt_dbm; + view.snr_db = pkt->snr_pkt_db; + + uint8_t hash[8]; + meshcore_packet_hash(&view, hash); + if (mc_dedup_check_add(hash)) + return; + + s_is_packet_consumed = false; + switch (view.payload_type) { + case MC_PT_ADVERT: + process_advert(&view); + break; + case MC_PT_GRP_TXT: + process_grp_txt(&view); + break; + case MC_PT_TXT_MSG: + process_txt_msg(&view); + break; + case MC_PT_ACK: + process_ack(&view); + break; + case MC_PT_PATH: + process_path_payload(&view); + break; + default: + break; + } + + if (!s_is_packet_consumed) { + try_relay(&view, pkt->buf, pkt->len); + } + + if (mc_is_running()) + sx1262_receive_continuous(); +} + +static void on_tx_done(void *ctx) { + (void)ctx; +} + +static void on_timeout(void *ctx) { + (void)ctx; + if (mc_is_running()) + sx1262_receive_continuous(); +} + +static void on_cad_done(bool is_active, void *ctx) { + (void)ctx; + s_is_cad_busy = is_active; + s_is_cad_pending = false; +} + +static bool cad_check_clear(void) { + s_is_cad_pending = true; + s_is_cad_busy = false; + + sx1262_stop_rx(); + esp_err_t err = sx1262_cad_start(); + if (err != ESP_OK) { + s_is_cad_pending = false; + return true; + } + + uint32_t deadline = mc_now_ms() + MC_CAD_TIMEOUT_MS; + while (s_is_cad_pending && (int32_t)(mc_now_ms() - deadline) < 0) { + sx1262_process_irq(); + vTaskDelay(1); + } + + if (s_is_cad_pending) { + ESP_LOGW(TAG, "CAD timeout -- assume clear"); + s_is_cad_pending = false; + return true; + } + + return !s_is_cad_busy; +} + +static void relay_enqueue(const uint8_t *buf, uint16_t len, uint32_t delay_ms) { + for (int i = 0; i < MC_RELAY_QUEUE_SIZE; i++) { + if (!s_relay_queue[i].is_used) { + memcpy(s_relay_queue[i].buf, buf, len); + s_relay_queue[i].len = len; + s_relay_queue[i].tx_at_ms = mc_now_ms() + delay_ms; + s_relay_queue[i].is_used = true; + return; + } + } + ESP_LOGW(TAG, "Relay queue full -- discard"); +} + +static void try_relay(const meshcore_packet_view_t *view, const uint8_t *raw, uint16_t raw_len) { + if (!s_is_relay_enabled) + return; + + bool is_flood = (view->route_type == MC_RT_FLOOD || view->route_type == MC_RT_TRANSPORT_FLOOD); + bool is_direct = (view->route_type == MC_RT_DIRECT || view->route_type == MC_RT_TRANSPORT_DIRECT); + if (!is_flood && !is_direct) + return; + + uint8_t hash_size = view->hash_size; + uint8_t path_count = view->path_count; + const meshcore_identity_t *id = mc_get_identity(); + + if (is_direct) { + if (path_count == 0) + return; + if (memcmp(view->path, id->pub_key, hash_size) != 0) + return; + } else { + if ((uint16_t)((path_count + 1) * hash_size) > MESHCORE_MAX_PATH) + return; + } + + uint8_t new_buf[MESHCORE_MAX_RAW + 8]; + uint16_t pos = 0; + uint16_t src_off = 0; + + new_buf[pos++] = raw[src_off++]; + + if (view->route_type == MC_RT_TRANSPORT_FLOOD || view->route_type == MC_RT_TRANSPORT_DIRECT) { + memcpy(&new_buf[pos], &raw[src_off], 4); + pos += 4; + src_off += 4; + } + + uint8_t hash_size_sel = (uint8_t)((hash_size - 1) & 0x03); + src_off++; + uint16_t existing_path_bytes = (uint16_t)path_count * hash_size; + + if (is_flood) { + new_buf[pos++] = mc_build_path_len(hash_size_sel, path_count + 1); + memcpy(&new_buf[pos], &raw[src_off], existing_path_bytes); + pos += existing_path_bytes; + src_off += existing_path_bytes; + memcpy(&new_buf[pos], id->pub_key, hash_size); + pos += hash_size; + } else { + new_buf[pos++] = mc_build_path_len(hash_size_sel, path_count - 1); + if (existing_path_bytes > hash_size) { + memcpy(&new_buf[pos], &raw[src_off + hash_size], existing_path_bytes - hash_size); + pos += existing_path_bytes - hash_size; + } + src_off += existing_path_bytes; + } + + if (src_off < raw_len) { + uint16_t payload_bytes = raw_len - src_off; + memcpy(&new_buf[pos], &raw[src_off], payload_bytes); + pos += payload_bytes; + } + + if (pos > MESHCORE_MAX_RAW) { + ESP_LOGW(TAG, "Relay: reassembled packet exceeds MAX_RAW"); + return; + } + + uint32_t delay = MC_RELAY_DELAY_MIN_MS + (esp_random() % MC_RELAY_DELAY_RANGE_MS); + relay_enqueue(new_buf, pos, delay); + ESP_LOGI(TAG, + "Relay %s scheduled type=0x%X count %u->%u in %lums", + is_flood ? "FLOOD" : "DIRECT", + view->payload_type, + path_count, + is_flood ? (path_count + 1) : (path_count - 1), + (unsigned long)delay); +} diff --git a/firmware_p4/components/Applications/LoRa/meshtastic/include/meshtastic_app.h b/firmware_p4/components/Applications/LoRa/meshtastic/include/meshtastic_app.h new file mode 100644 index 00000000..1bb34e0c --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/meshtastic/include/meshtastic_app.h @@ -0,0 +1,65 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef MESHTASTIC_APP_H +#define MESHTASTIC_APP_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "esp_err.h" + +/** + * @brief Bring up the full Meshtastic stack on the P4. + * + * Order of operations: + * 1. Derive node_num from the device MAC (last 4 bytes). + * 2. mt_nvs_init and read persisted preset/region (LONG_FAST + US + * defaults on first boot). + * 3. SX1262 HAL + driver init with the preset's SF/BW/CR and the + * region center frequency for the primary channel slot + * (Meshtastic canonical default: slot 19 = 906.875 MHz on US + * LONG_FAST). +20 dBm TX power, 16-symbol preamble. + * 4. SX1262 IRQ task. + * 5. mt_pki_init (X25519 keypair via mbedTLS Curve25519). + * 6. mt_nodedb_init (load persisted node entries). + * 7. mt_modules_init (Admin, NodeInfo, Position, Text, Routing, + * TraceRoute, Telemetry, KeyVerify, NeighborInfo). + * 8. meshtastic_mesh_init (channels, dedup, tx queue, retry table). + * 9. phoneapi_init (Companion state machine). + * 10. meshtastic_phone_bridge_init (SPI bridge to C5 BLE/TCP). + * 11. meshtastic_mesh_start (arms RX continuous + spawns TX task). + * 12. Spawns the poll task (mesh poll at 50 ms + module tick at 1 Hz). + * 13. Requests the C5 to start BLE advertising. + * + * Cannot run simultaneously with meshcore_app_start: both register + * SX1262 callbacks via sx1262_set_callbacks and would overwrite each + * other. Only one stack at a time. + * + * Must be called AFTER bridge_manager_init(). + * + * @return + * - ESP_OK on success + * - ESP_FAIL if preset lookup or PKI init fails + * - Driver error code from any init step on failure + * - ESP_ERR_NO_MEM if the poll task cannot be spawned + */ +esp_err_t meshtastic_app_start(void); + +#ifdef __cplusplus +} +#endif + +#endif // MESHTASTIC_APP_H diff --git a/firmware_p4/components/Applications/LoRa/meshtastic/include/meshtastic_ble.h b/firmware_p4/components/Applications/LoRa/meshtastic/include/meshtastic_ble.h new file mode 100644 index 00000000..608f54f5 --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/meshtastic/include/meshtastic_ble.h @@ -0,0 +1,75 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#ifndef MESHTASTIC_BLE_H +#define MESHTASTIC_BLE_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +#include "esp_err.h" + +/** + * @brief NimBLE peripheral implementing the Meshtastic GATT service. + * + * Exposes four characteristics under Service UUID + * 6ba1b218-15a8-461f-9fa8-5dcae273eafd: + * - TORADIO (WRITE) - app to device + * - FROMRADIO (READ) - device to app (polling) + * - FROMNUM (READ|NOTIFY) - wake signal for the app + * - LOGRADIO (READ|NOTIFY) - optional log stream + * + * Plus the standard Battery Service (0x180F / 0x2A19). + * + * Pairing uses Secure Connections with MITM + bonding and display-only + * I/O capability (RANDOM_PIN mode). A fresh 6-digit passkey is + * generated per pairing and logged at ESP_LOGI. + * + * All protocol decisions are delegated to meshtastic_phoneapi - this + * module only owns the BLE stack lifecycle and GATT plumbing. + */ + +/** + * @brief Initialize NimBLE, register GATT services, start the host task. + * + * @param node_num Our node number. + * @return ESP_OK on success, esp_err_t from NimBLE otherwise. + */ +esp_err_t meshtastic_ble_init(uint32_t node_num); + +/** + * @brief Start advertising. Called internally on init and after disconnect. + */ +esp_err_t meshtastic_ble_start(void); + +/** + * @brief Stop advertising. + */ +void meshtastic_ble_stop(void); + +/** + * @brief Whether an app is currently bonded and connected. + */ +bool meshtastic_ble_is_connected(void); + +#ifdef __cplusplus +} +#endif + +#endif // MESHTASTIC_BLE_H diff --git a/firmware_p4/components/Applications/LoRa/meshtastic/include/meshtastic_channels.h b/firmware_p4/components/Applications/LoRa/meshtastic/include/meshtastic_channels.h new file mode 100644 index 00000000..c972fc47 --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/meshtastic/include/meshtastic_channels.h @@ -0,0 +1,113 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#ifndef MESHTASTIC_CHANNELS_H +#define MESHTASTIC_CHANNELS_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +#define MT_MAX_CHANNELS 8 +#define MT_PSK_SIZE 16 + +/** + * @brief Channel role. + * + * Matches Channel.Role in the official protobuf. + */ +typedef enum { + MT_CH_DISABLED = 0, + MT_CH_PRIMARY = 1, + MT_CH_SECONDARY = 2, + MT_CH_COUNT +} mt_channel_role_t; + +/** + * @brief Persisted state of a single channel slot. + */ +typedef struct { + bool is_used; + mt_channel_role_t role; + uint8_t psk[MT_PSK_SIZE]; + uint8_t hash; + char name[32]; + uint32_t id; +} mt_channel_t; + +/** + * @brief Load channels from NVS or install the default PRIMARY on first boot. + */ +void mt_channels_init(void); + +/** + * @brief Read a channel slot by index. + * + * @param idx Slot index in [0, MT_MAX_CHANNELS). + * @return Pointer to the internal slot, or NULL if idx is out of range. + */ +const mt_channel_t *mt_channel_get(uint8_t idx); + +/** + * @brief Configure a channel slot and persist to NVS. + * + * Computes the 8-bit hash as SHA256(psk)[0]. If role is MT_CH_PRIMARY, + * any other slot currently marked PRIMARY is demoted to SECONDARY. + * + * @param idx Slot index in [0, MT_MAX_CHANNELS). + * @param name Optional display name. May be NULL to keep the existing name. + * @param psk Optional 16-byte PSK. May be NULL to keep the existing PSK. + * @param role New role. MT_CH_DISABLED clears is_used. + */ +void mt_channel_set(uint8_t idx, const char *name, const uint8_t *psk, mt_channel_role_t role); + +/** + * @brief Set the user-assigned channel id (fixed32 from app) and persist. + */ +void mt_channel_set_id(uint8_t idx, uint32_t id); + +/** + * @brief Disable a channel slot and persist to NVS. + */ +void mt_channel_disable(uint8_t idx); + +/** + * @brief Find an enabled channel whose hash matches. + * + * @param hash 8-bit channel hash to match. + * @param[out] out_idx Slot index on hit. May be NULL. + * @param[out] out_psk PSK pointer on hit. May be NULL. + * @return true if a matching enabled channel was found. + */ +bool mt_channel_lookup_by_hash(uint8_t hash, uint8_t *out_idx, const uint8_t **out_psk); + +/** + * @brief Return the hash of the primary channel. + */ +uint8_t mt_channel_primary_hash(void); + +/** + * @brief Return the PSK of the primary channel. + */ +const uint8_t *mt_channel_primary_psk(void); + +#ifdef __cplusplus +} +#endif + +#endif // MESHTASTIC_CHANNELS_H diff --git a/firmware_p4/components/Applications/LoRa/meshtastic/include/meshtastic_crypto_pki.h b/firmware_p4/components/Applications/LoRa/meshtastic/include/meshtastic_crypto_pki.h new file mode 100644 index 00000000..bb673b28 --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/meshtastic/include/meshtastic_crypto_pki.h @@ -0,0 +1,76 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#ifndef MESHTASTIC_CRYPTO_PKI_H +#define MESHTASTIC_CRYPTO_PKI_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include + +#define MT_PKI_OVERHEAD 12 /* 8-byte AES-CCM tag + 4-byte extra nonce */ + +/** + * @brief Encrypt a payload using X25519 + AES-256-CCM (Meshtastic PKI). + * + * Derives shared_key = SHA256(X25519(our_priv, peer_pub)), uses AES-256-CCM + * with 13-byte nonce built from (packet_id, from_node, random extra_nonce). + * Output layout: [ciphertext(plen)] [auth_tag(8)] [extra_nonce(4)]. + * + * @param peer_pub 32-byte Curve25519 public key of destination + * @param from_node Sender node number (included in nonce) + * @param packet_id Packet id (included in nonce) + * @param plain Plaintext input + * @param plen Plaintext length + * @param out Output buffer (must be at least plen + MT_PKI_OVERHEAD) + * @return true on success, false on failure (weak key, mbedtls error) + */ +bool mt_pki_encrypt_curve25519(const uint8_t *peer_pub, + uint32_t from_node, + uint32_t packet_id, + const uint8_t *plain, + size_t plen, + uint8_t *out); + +/** + * @brief Decrypt a payload produced by mt_pki_encrypt_curve25519. + * + * Reads extra_nonce from cipher[clen-4..clen-1] and auth_tag from + * cipher[clen-12..clen-5], derives shared_key, and AEAD-decrypts. + * + * @param peer_pub 32-byte Curve25519 public key of sender + * @param from_node Sender node number + * @param packet_id Packet id + * @param cipher Ciphertext input (including trailing tag + extra_nonce) + * @param clen Total length including MT_PKI_OVERHEAD + * @param out Output buffer (must be at least clen - MT_PKI_OVERHEAD) + * @return true on success (auth tag valid), false on failure + */ +bool mt_pki_decrypt_curve25519(const uint8_t *peer_pub, + uint32_t from_node, + uint32_t packet_id, + const uint8_t *cipher, + size_t clen, + uint8_t *out); + +#ifdef __cplusplus +} +#endif + +#endif // MESHTASTIC_CRYPTO_PKI_H diff --git a/firmware_p4/components/Applications/LoRa/meshtastic/include/meshtastic_mesh.h b/firmware_p4/components/Applications/LoRa/meshtastic/include/meshtastic_mesh.h new file mode 100644 index 00000000..3c55296a --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/meshtastic/include/meshtastic_mesh.h @@ -0,0 +1,133 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#ifndef MESHTASTIC_MESH_H +#define MESHTASTIC_MESH_H + +#include +#include +#include "esp_err.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Initialize the Meshtastic mesh radio layer. + * + * Sets up crypto, dedup table, and prepares for RX/TX. + * + * @param node_num Our node number. + * @return ESP_OK on success. + */ +esp_err_t meshtastic_mesh_init(uint32_t node_num); + +/** + * @brief Start continuous RX and mesh processing. + * + * Enters RX mode. Received packets are decrypted, deduped, + * forwarded to the app, and rebroadcast if needed. + * + * @return ESP_OK on success. + */ +esp_err_t meshtastic_mesh_start(void); + +/** + * @brief Stop mesh processing. + */ +void meshtastic_mesh_stop(void); + +/** + * @brief Process a ToRadio MeshPacket from the app. + * + * Encrypts and transmits via radio. + * + * @param pb_data Raw protobuf bytes of the MeshPacket (from ToRadio field 1). + * @param pb_len Length of pb_data. + * @return ESP_OK on success. + */ +esp_err_t meshtastic_mesh_send(const uint8_t *pb_data, uint16_t pb_len); + +/** + * @brief Poll for mesh activity. Call from main loop. + */ +void meshtastic_mesh_poll(void); + +/** + * @brief Send NodeInfo announcement via LoRa. + * + * Broadcasts our identity so other nodes see us. + * Call periodically (e.g. every 30s). + * + * @return ESP_OK on success. + */ +esp_err_t meshtastic_mesh_send_nodeinfo(void); + +/** + * @brief Send a text message via LoRa. + * + * Broadcasts a UTF-8 text string on the mesh. + * + * @param text Null-terminated string to send. + * @param to Destination node (0xFFFFFFFF for broadcast). + * @return ESP_OK on success. + */ +esp_err_t meshtastic_mesh_send_text(const char *text, uint32_t to); + +/** + * @brief Envia Data protobuf generico na mesh (usado pelos modulos). + * + * Constroi Data { portnum(1), payload(2), request_id(3?), want_response(4?) }, + * encripta com AES-CTR, e enfileira para TX. + * + * @param to Node destino (0xFFFFFFFF = broadcast) + * @param channel Indice do canal (0 = primary) + * @param hop_limit 3 default + * @param portnum Meshtastic PortNum + * @param payload Bytes do payload (proto da aplicacao) + * @param plen Tamanho + * @param request_id Se != 0, adiciona como Data.request_id (reply_id) + * @param want_ack Se true, seta flag want_ack no header do MeshPacket + * @param want_response Se true, seta Data.want_response (campo 3) - pede reply + * do modulo destino (ex: NodeInfo request). + */ +esp_err_t meshtastic_mesh_send_data(uint32_t to, + uint8_t channel, + uint8_t hop_limit, + uint8_t portnum, + const uint8_t *payload, + uint16_t plen, + uint32_t request_id, + bool want_ack, + bool want_response); + +/** + * @brief Cancela uma retransmissao pendente porque o ACK chegou. + * + * Chamado pelo RoutingModule quando recebe Routing{error_reason=NONE} cujo + * request_id case com um pacote em retry, ou por process_rx_packet quando + * nosso proprio pacote eh ouvido sendo rebroadcastado (ACK implicito). + * + * @param pkt_id Packet id original (MeshPacket.id) que foi transmitido. + * @param is_implicit true se o ACK veio por audicao do rebroadcast. + * @return true se havia um retry pendente e foi cancelado. + */ +bool meshtastic_mesh_retry_ack(uint32_t pkt_id, bool is_implicit); + +#ifdef __cplusplus +} +#endif + +#endif // MESHTASTIC_MESH_H diff --git a/firmware_p4/components/Applications/LoRa/meshtastic/include/meshtastic_mqtt.h b/firmware_p4/components/Applications/LoRa/meshtastic/include/meshtastic_mqtt.h new file mode 100644 index 00000000..92c20b53 --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/meshtastic/include/meshtastic_mqtt.h @@ -0,0 +1,44 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 + +#ifndef MESHTASTIC_MQTT_H +#define MESHTASTIC_MQTT_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +#include "esp_err.h" + +/** + * @brief Initialize MQTT uplink client. Connects when WiFi STA link is + * up. Publishes MeshPackets received from LoRa to + * `msh/{region}/2/e/{channel_name}/{node_id}` topic. + * + * @param broker_uri e.g. "mqtt://mqtt.meshtastic.org:1883" + * @param username NULL if anonymous + * @param password NULL if anonymous + */ +esp_err_t meshtastic_mqtt_init(const char *broker_uri, const char *username, const char *password); + +/** + * @brief Publish an already-encoded MeshPacket proto to the uplink. + * Called from the mesh RX path for packets we want to uplink. + */ +void meshtastic_mqtt_publish(const uint8_t *meshpacket_pb, uint16_t len, const char *channel_name); + +bool meshtastic_mqtt_is_connected(void); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/firmware_p4/components/Applications/LoRa/meshtastic/include/meshtastic_nodedb.h b/firmware_p4/components/Applications/LoRa/meshtastic/include/meshtastic_nodedb.h new file mode 100644 index 00000000..82e3d181 --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/meshtastic/include/meshtastic_nodedb.h @@ -0,0 +1,159 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 + +#ifndef MESHTASTIC_NODEDB_H +#define MESHTASTIC_NODEDB_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +#include "esp_err.h" + +#define MT_NODEDB_MAX_NODES 150 +#define MT_NODEDB_LONG_NAME_LEN 32 +#define MT_NODEDB_SHORT_NAME_LEN 8 +#define MT_NODEDB_ID_LEN 16 +#define MT_NODEDB_PUBKEY_LEN 32 +#define MT_NODEDB_NEXTHOP_MAX_FAILURES 2 + +/** + * @brief In-memory entry for a known node (peer). + * + * Campos correspondem ao NodeInfo/User protos do Meshtastic. Somente + * num, long_name e short_name sao obrigatorios; o resto e populado + * conforme chegam updates. + */ +typedef struct { + uint32_t num; /**< Node number (from field) */ + uint32_t last_heard; /**< Unix seconds (approx) */ + char id[MT_NODEDB_ID_LEN]; /**< "!xxxxxxxx" */ + char long_name[MT_NODEDB_LONG_NAME_LEN]; + char short_name[MT_NODEDB_SHORT_NAME_LEN]; + uint8_t hw_model; + uint8_t role; + float snr; + int16_t rssi; + uint8_t hops_away; + bool is_favorite; + bool is_ignored; + bool is_muted; + bool via_mqtt; + bool in_use; + uint8_t public_key[MT_NODEDB_PUBKEY_LEN]; /**< X25519 pubkey (all zeros if unknown) */ + bool has_public_key; + uint8_t next_hop; /**< Last octet of relay that got us here (0 = unknown) */ + uint8_t next_hop_failures; /**< Count retx failures on current next_hop; fallback to flood at 2 */ +} mt_node_entry_t; + +/** + * @brief Initialize the NodeDB. Loads persisted entries from NVS. + * + * Deve ser chamado uma vez no boot, depois do mt_nvs_init. + */ +esp_err_t mt_nodedb_init(void); + +/** + * @brief Insere ou atualiza um no a partir de um User proto. + * + * Se o node nao existe ainda, aloca slot. Se ja existe, faz merge + * (mantem flags sticky como is_favorite/is_ignored/is_muted). + * + * @param num Node number. + * @param user_bytes Proto User serializado. + * @param user_len Bytes. + * @param snr SNR do ultimo pacote. + * @param rssi RSSI do ultimo pacote. + * @param hops_away Hops ate este no (0 = vizinho direto). + * @return true se houve mudanca (novo no ou campos alterados). + */ +bool mt_nodedb_upsert_from_user(uint32_t num, + const uint8_t *user_bytes, + uint16_t user_len, + float snr, + int16_t rssi, + uint8_t hops_away); + +/** + * @brief Busca entrada por node number. + * @return Ponteiro pra entrada (read-only) ou NULL se nao existe. + */ +const mt_node_entry_t *mt_nodedb_get(uint32_t num); + +/** + * @brief Busca entrada por indice (0..count-1). + * + * Usado pelo PhoneAPI no STATE_SEND_OTHER_NODEINFOS. + * @return Ponteiro ou NULL se fora do range. + */ +const mt_node_entry_t *mt_nodedb_get_by_index(uint16_t idx); + +/** + * @brief Numero de entradas ativas. + */ +uint16_t mt_nodedb_count(void); + +/** + * @brief Marca/desmarca um no como favorito. Persiste em NVS. + * @return true se o no existe e foi atualizado. + */ +bool mt_nodedb_set_favorite(uint32_t num, bool fav); + +/** + * @brief Marca/desmarca como ignorado. Persiste em NVS. + */ +bool mt_nodedb_set_ignored(uint32_t num, bool ign); + +/** + * @brief Alterna estado muted. Persiste em NVS. + */ +bool mt_nodedb_toggle_muted(uint32_t num); + +/** + * @brief Remove um no por node number. Persiste em NVS. + */ +bool mt_nodedb_remove(uint32_t num); + +/** + * @brief Learn a next-hop for a peer. + * + * Called when we hear a packet from `num` that was relayed by `relay_byte` + * (last octet of relayer's node_num). Updates nodedb[num].next_hop so future + * unicasts to `num` can be directed. + * + * Resets next_hop_failures to 0. + */ +void mt_nodedb_learn_next_hop(uint32_t num, uint8_t relay_byte); + +/** + * @brief Get next_hop byte for unicast routing. Returns 0 if unknown. + */ +uint8_t mt_nodedb_get_next_hop(uint32_t num); + +/** + * @brief Increment retx failure counter for this peer. When it reaches + * MT_NODEDB_NEXTHOP_MAX_FAILURES, next_hop is cleared (fallback to flood). + */ +void mt_nodedb_record_next_hop_failure(uint32_t num); + +/** + * @brief Forca persistencia imediata em NVS. + * + * Em condicoes normais os mutadores acima ja persistem; usar apenas + * se precisar gravar pending state (ex: shutdown). + */ +esp_err_t mt_nodedb_save(void); + +#ifdef __cplusplus +} +#endif + +#endif // MESHTASTIC_NODEDB_H diff --git a/firmware_p4/components/Applications/LoRa/meshtastic/include/meshtastic_nvs.h b/firmware_p4/components/Applications/LoRa/meshtastic/include/meshtastic_nvs.h new file mode 100644 index 00000000..66973548 --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/meshtastic/include/meshtastic_nvs.h @@ -0,0 +1,98 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#ifndef MESHTASTIC_NVS_H +#define MESHTASTIC_NVS_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +#include "esp_err.h" + +#define MT_NVS_VERSION 1 + +/** + * @brief Initialize the Meshtastic NVS subsystem. + * + * Opens NVS namespace "meshtastic". If the stored schema version does + * not match MT_NVS_VERSION, erases every key in the namespace and + * writes the current version (simple migration via full reset). + * + * @return + * - ESP_OK on success + * - ESP_ERR_NO_MEM if NVS allocation fails + * - other esp_err_t from nvs_flash_init on fatal errors + */ +esp_err_t mt_nvs_init(void); + +/** + * @brief Store a binary blob under a key. + * + * Commits pending writes immediately on success. + * + * @param key Null-terminated key. Max 15 chars per NVS rules. + * @param data Pointer to payload. Must not be NULL if len > 0. + * @param len Payload length in bytes. + * @return + * - ESP_OK on success + * - ESP_ERR_INVALID_STATE if the subsystem was not initialized + * - other esp_err_t from NVS backend + */ +esp_err_t mt_nvs_set_blob(const char *key, const void *data, size_t len); + +/** + * @brief Read a binary blob from a key. + * + * @param key Null-terminated key. + * @param out_data Destination buffer. Must not be NULL if max_len > 0. + * @param max_len Capacity of out_data in bytes. + * @return Number of bytes read. 0 if the key is absent. Negative on error. + */ +int mt_nvs_get_blob(const char *key, void *out_data, size_t max_len); + +/** + * @brief Store a uint32 value under a key. + */ +esp_err_t mt_nvs_set_u32(const char *key, uint32_t value); + +/** + * @brief Read a uint32 value. Returns default_value if the key is absent. + */ +uint32_t mt_nvs_get_u32(const char *key, uint32_t default_value); + +/** + * @brief Erase a single key. + */ +esp_err_t mt_nvs_erase(const char *key); + +/** + * @brief Erase every key in the namespace. Intended for factory reset. + */ +esp_err_t mt_nvs_factory_reset(void); + +/** + * @brief Force flush of any pending NVS writes to flash. + */ +esp_err_t mt_nvs_commit(void); + +#ifdef __cplusplus +} +#endif + +#endif // MESHTASTIC_NVS_H diff --git a/firmware_p4/components/Applications/LoRa/meshtastic/include/meshtastic_phone_bridge.h b/firmware_p4/components/Applications/LoRa/meshtastic/include/meshtastic_phone_bridge.h new file mode 100644 index 00000000..0dc95515 --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/meshtastic/include/meshtastic_phone_bridge.h @@ -0,0 +1,101 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#ifndef MESHTASTIC_PHONE_BRIDGE_H +#define MESHTASTIC_PHONE_BRIDGE_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +#include "esp_err.h" + +/** + * @brief Initialize the SPI-based Meshtastic phone bridge. + * + * Owns the transport plumbing between the local phoneapi state machine + * (which lives on the P4) and the radios (BLE GATT and TCP server) + * which terminate on the C5 co-processor. + * + * Registers a stream callback for SPI_ID_MESH_TORADIO_STREAM that + * reassembles chunks back into StreamAPI frames and forwards them to + * phoneapi_on_toradio. + * + * Spawns a notify task that periodically drains phoneapi_poll_fromradio, + * fragments frames into SPI chunks, and ships them to the C5 via + * SPI_ID_MESH_FROMRADIO_PUSH so they reach the connected app. + * + * Captures ESP_LOG output into a ring buffer and ships it to the C5 via + * SPI_ID_MESH_LOG_PUSH whenever a phone has subscribed to LOGRADIO. + * + * Does not bring up BLE or WiFi by itself. Call meshtastic_phone_bridge_ble_start + * and meshtastic_phone_bridge_wifi_start to enable each transport. + * + * @param node_num Our node number, used for advertised name. + * @return + * - ESP_OK on success + * - ESP_ERR_INVALID_STATE if already initialized + * - ESP_ERR_NO_MEM on allocation failure + */ +esp_err_t meshtastic_phone_bridge_init(uint32_t node_num); + +/** + * @brief Tear down the bridge and stop the notify task. + */ +void meshtastic_phone_bridge_stop(void); + +/** + * @brief Ask the C5 to bring up the Meshtastic BLE GATT peripheral. + * + * @return ESP_OK on success, error code from the SPI bridge otherwise. + */ +esp_err_t meshtastic_phone_bridge_ble_start(void); + +/** + * @brief Ask the C5 to stop advertising and tear down the BLE GATT. + * + * @return ESP_OK on success, error code from the SPI bridge otherwise. + */ +esp_err_t meshtastic_phone_bridge_ble_stop(void); + +/** + * @brief Ask the C5 to start the Meshtastic TCP server (port 4403) and mDNS. + * + * @return ESP_OK on success, error code from the SPI bridge otherwise. + */ +esp_err_t meshtastic_phone_bridge_wifi_start(void); + +/** + * @brief Ask the C5 to stop the Meshtastic TCP server. + * + * @return ESP_OK on success, error code from the SPI bridge otherwise. + */ +esp_err_t meshtastic_phone_bridge_wifi_stop(void); + +/** + * @brief Whether at least one phone is currently connected (BLE or TCP). + * + * Result is cached for a short interval to avoid hammering the SPI bus. + */ +bool meshtastic_phone_bridge_is_connected(void); + +#ifdef __cplusplus +} +#endif + +#endif // MESHTASTIC_PHONE_BRIDGE_H diff --git a/firmware_p4/components/Applications/LoRa/meshtastic/include/meshtastic_phoneapi.h b/firmware_p4/components/Applications/LoRa/meshtastic/include/meshtastic_phoneapi.h new file mode 100644 index 00000000..2b8c2157 --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/meshtastic/include/meshtastic_phoneapi.h @@ -0,0 +1,115 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#ifndef MESHTASTIC_PHONEAPI_H +#define MESHTASTIC_PHONEAPI_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +#include "esp_err.h" + +/** + * @brief State machine positions for the Meshtastic PhoneAPI handshake. + * + * The order must match src/mesh/PhoneAPI.h from the official firmware. + */ +typedef enum { + PA_STATE_IDLE = 0, + PA_STATE_SEND_MY_INFO, + PA_STATE_SEND_METADATA, + PA_STATE_SEND_DEVICEUI_CONFIG, + PA_STATE_SEND_CHANNELS, + PA_STATE_SEND_CONFIG, + PA_STATE_SEND_MODULECONFIG, + PA_STATE_SEND_FILEMANIFEST, + PA_STATE_SEND_OWN_NODEINFO, + PA_STATE_SEND_OTHER_NODEINFOS, + PA_STATE_SEND_COMPLETE_ID, + PA_STATE_SEND_PACKETS, + PA_STATE_COUNT +} phoneapi_state_t; + +/** + * @brief Initialize the PhoneAPI subsystem. + * + * Must be called once before any transport (BLE, WiFi) can exchange + * frames. Allocates the FromRadio queue and resets the FSM. + * + * @param node_num Our node number. + * @return + * - ESP_OK on success + * - ESP_ERR_NO_MEM if mutex allocation fails + */ +esp_err_t phoneapi_init(uint32_t node_num); + +/** + * @brief Feed a raw ToRadio frame received from the app. + * + * Detects want_config_id (triggers FSM) or packet (forwards to mesh TX). + * + * @param pb_data Protobuf bytes without transport framing. + * @param pb_len Size of pb_data. + * @return + * - ESP_OK on success + * - ESP_ERR_INVALID_ARG on malformed input + */ +esp_err_t phoneapi_on_toradio(const uint8_t *pb_data, uint16_t pb_len); + +/** + * @brief Pull the next FromRadio frame for the transport to emit. + * + * Transports should call in a loop after a ToRadio arrives or when + * FROMNUM is notified. While the FSM has pending states, the call + * advances and returns the next produced frame. + * + * @param[out] out_buf Destination buffer (recommended >= 512 bytes). + * @param max_len Capacity of out_buf. + * @return Bytes written to out_buf, 0 if no frame is ready. + */ +uint16_t phoneapi_poll_fromradio(uint8_t *out_buf, uint16_t max_len); + +/** + * @brief Whether there is at least one FromRadio frame ready (for FROMNUM notify). + */ +bool phoneapi_has_data(void); + +/** + * @brief Enqueue a MeshPacket built by the mesh core as a FromRadio frame. + * + * Wraps the MeshPacket in FromRadio { id, packet } and pushes to the queue. + * + * @param mp_bytes Serialized MeshPacket. + * @param mp_len Size of mp_bytes. + */ +void phoneapi_push_packet(const uint8_t *mp_bytes, uint16_t mp_len); + +/** + * @brief Reset the FSM and drain the queue on transport disconnect. + * + * Called by BLE on disconnect or by WiFi on TCP client close. The next + * want_config_id from any transport will restart the handshake. + */ +void phoneapi_disconnect(void); + +#ifdef __cplusplus +} +#endif + +#endif // MESHTASTIC_PHONEAPI_H diff --git a/firmware_p4/components/Applications/LoRa/meshtastic/include/meshtastic_pki.h b/firmware_p4/components/Applications/LoRa/meshtastic/include/meshtastic_pki.h new file mode 100644 index 00000000..4edc0871 --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/meshtastic/include/meshtastic_pki.h @@ -0,0 +1,63 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#ifndef MESHTASTIC_PKI_H +#define MESHTASTIC_PKI_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#include "esp_err.h" + +#define MT_PKI_KEY_LEN 32 + +/** + * @brief Initialize PKI keypair (X25519 Curve25519). + * + * Loads the persisted keypair from NVS. If absent, generates a new + * X25519 keypair, persists privkey and pubkey in NVS, and uses the + * freshly generated material for the current session. Must run once + * at boot after mt_nvs_init. + * + * @return + * - ESP_OK on success + * - ESP_FAIL if keygen fails (RNG or mbedtls internal) + */ +esp_err_t mt_pki_init(void); + +/** + * @brief Pointer to our 32-byte X25519 public key (little-endian). + * + * Valid for the lifetime of the program. Intended for inclusion in + * NodeInfo/User.public_key (field 8). + */ +const uint8_t *mt_pki_get_pubkey(void); + +/** + * @brief Pointer to our 32-byte X25519 private key (little-endian). + * + * Reserved for future ECDH during DM end-to-end encryption. Must not + * leave the device. + */ +const uint8_t *mt_pki_get_privkey(void); + +#ifdef __cplusplus +} +#endif + +#endif // MESHTASTIC_PKI_H diff --git a/firmware_p4/components/Applications/LoRa/meshtastic/include/meshtastic_pkt_history.h b/firmware_p4/components/Applications/LoRa/meshtastic/include/meshtastic_pkt_history.h new file mode 100644 index 00000000..480291e9 --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/meshtastic/include/meshtastic_pkt_history.h @@ -0,0 +1,77 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#ifndef MESHTASTIC_PKT_HISTORY_H +#define MESHTASTIC_PKT_HISTORY_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +#define MT_PKT_HISTORY_MAX 128 +#define MT_NUM_RELAYERS 6 + +/** + * @brief Initialize the ring buffer. Idempotent. + */ +void mt_pkt_history_init(void); + +/** + * @brief Check whether a packet has been seen and update the registry. + * + * Implements the dedup + relayer tracking + hop upgrade detection logic + * described in src/mesh/PacketHistory.cpp of the official firmware. + * + * @param sender Originator node number. + * @param id Packet id. + * @param hop_limit Current hop_limit seen in this reception. + * @param relayer_id Last byte of relay_node (0 if unknown). + * @param[out] out_upgraded Set to true when hop_limit exceeds the highest + * previously seen value. May be NULL. + * @return true if already seen (possibly with lower hop_limit - pure dedup). + */ +bool mt_pkt_history_check_add( + uint32_t sender, uint32_t id, uint8_t hop_limit, uint8_t relayer_id, bool *out_upgraded); + +/** + * @brief Check whether a specific node has already relayed a packet. + * + * @param relayer_id Last byte of relay_node to query. + * @param sender Originator node number. + * @param id Packet id. + * @return true if that relayer appears in the record's relayers list. + */ +bool mt_pkt_history_was_relayer(uint8_t relayer_id, uint32_t sender, uint32_t id); + +/** + * @brief Remove a relayer from the list for a specific packet. + * + * Used when recomputing next-hop hints after a route change. + */ +void mt_pkt_history_remove_relayer(uint8_t relayer_id, uint32_t sender, uint32_t id); + +/** + * @brief Count of active (non-evicted) entries. Debug helper. + */ +int mt_pkt_history_count(void); + +#ifdef __cplusplus +} +#endif + +#endif // MESHTASTIC_PKT_HISTORY_H diff --git a/firmware_p4/components/Applications/LoRa/meshtastic/include/meshtastic_presets.h b/firmware_p4/components/Applications/LoRa/meshtastic/include/meshtastic_presets.h new file mode 100644 index 00000000..89f74bcf --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/meshtastic/include/meshtastic_presets.h @@ -0,0 +1,94 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#ifndef MESHTASTIC_PRESETS_H +#define MESHTASTIC_PRESETS_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/** + * @brief LoRa modem preset identifiers. + * + * Values match LoRaConfig.ModemPreset in the official Meshtastic + * protobuf definition (config.proto). + */ +typedef enum { + MT_PRESET_LONG_FAST = 0, + MT_PRESET_LONG_SLOW = 1, + MT_PRESET_VERY_LONG_SLOW = 2, + MT_PRESET_MEDIUM_SLOW = 3, + MT_PRESET_MEDIUM_FAST = 4, + MT_PRESET_SHORT_SLOW = 5, + MT_PRESET_SHORT_FAST = 6, + MT_PRESET_LONG_MODERATE = 7, + MT_PRESET_SHORT_TURBO = 8, + MT_PRESET_LONG_TURBO = 9, + MT_PRESET_COUNT +} mt_preset_t; + +/** + * @brief Static information about a modem preset. + */ +typedef struct { + mt_preset_t id; + const char *name; + uint8_t sf; + uint32_t bw_hz; + uint8_t cr; + const char *description; +} mt_preset_info_t; + +/** + * @brief Look up the info table entry for a preset id. + * + * @param id Preset identifier. + * @return Pointer to static info table entry, or NULL if id is invalid. + */ +const mt_preset_info_t *mt_preset_info(mt_preset_t id); + +/** + * @brief Total number of modem presets supported. + */ +int mt_preset_count(void); + +/** + * @brief Return the preset currently persisted in NVS. + * + * Falls back to MT_PRESET_LONG_FAST if NVS is empty. + */ +mt_preset_t mt_preset_current(void); + +/** + * @brief Persist the given preset to NVS. + */ +void mt_preset_set(mt_preset_t id); + +/** + * @brief Map bandwidth in Hz to the SX1262 driver's BW enum value. + * + * @param bw_hz Bandwidth in Hz. + * @return SX1262_LORA_BW_* value that matches (rounds up to next supported). + */ +uint8_t mt_preset_bw_to_sx1262(uint32_t bw_hz); + +#ifdef __cplusplus +} +#endif + +#endif // MESHTASTIC_PRESETS_H diff --git a/firmware_p4/components/Applications/LoRa/meshtastic/include/meshtastic_regions.h b/firmware_p4/components/Applications/LoRa/meshtastic/include/meshtastic_regions.h new file mode 100644 index 00000000..fbcd7f55 --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/meshtastic/include/meshtastic_regions.h @@ -0,0 +1,118 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#ifndef MESHTASTIC_REGIONS_H +#define MESHTASTIC_REGIONS_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +/** + * @brief Regulatory region identifiers. + * + * Values match LoRaConfig.RegionCode in the official Meshtastic + * protobuf definition (config.proto). + */ +typedef enum { + MT_REGION_UNSET = 0, + MT_REGION_US = 1, + MT_REGION_EU_433 = 2, + MT_REGION_EU_868 = 3, + MT_REGION_CN = 4, + MT_REGION_JP = 5, + MT_REGION_ANZ = 6, + MT_REGION_KR = 7, + MT_REGION_TW = 8, + MT_REGION_RU = 9, + MT_REGION_IN = 10, + MT_REGION_NZ_865 = 11, + MT_REGION_TH = 12, + MT_REGION_LORA_24 = 13, + MT_REGION_UA_433 = 14, + MT_REGION_UA_868 = 15, + MT_REGION_MY_433 = 16, + MT_REGION_MY_919 = 17, + MT_REGION_SG_923 = 18, + MT_REGION_PH_433 = 19, + MT_REGION_PH_868 = 20, + MT_REGION_PH_915 = 21, + MT_REGION_ANZ_433 = 22, + MT_REGION_KZ_433 = 23, + MT_REGION_KZ_863 = 24, + MT_REGION_NP_865 = 25, + MT_REGION_BR_902 = 26, + MT_REGION_COUNT +} mt_region_t; + +/** + * @brief Static information about a regulatory region. + */ +typedef struct { + mt_region_t id; + const char *name; + uint32_t freq_start_hz; + uint32_t freq_stop_hz; + uint8_t duty_pct; + int8_t tx_pwr_max_dbm; + bool is_wide_lora_ok; +} mt_region_info_t; + +/** + * @brief Look up the info table entry for a region id. + * + * @param id Region identifier. + * @return Pointer to static info table entry, or NULL if id is invalid. + */ +const mt_region_info_t *mt_region_info(mt_region_t id); + +/** + * @brief Total number of regions supported by the firmware. + */ +int mt_region_count(void); + +/** + * @brief Return the region currently persisted in NVS. + * + * Falls back to MT_REGION_US if NVS is empty. + */ +mt_region_t mt_region_current(void); + +/** + * @brief Persist the given region to NVS. + */ +void mt_region_set(mt_region_t id); + +/** + * @brief Compute the center frequency of a channel slot within a region. + * + * Divides the region band by the bandwidth to get slot count, then + * picks slot (channel_num mod slot_count). + * + * @param id Region identifier. + * @param channel_num Zero-based channel index. + * @param bw_hz LoRa bandwidth in Hz. + * @return Center frequency in Hz. Falls back to 906875000 if the id is invalid. + */ +uint32_t mt_region_freq_for_channel(mt_region_t id, uint8_t channel_num, uint32_t bw_hz); + +#ifdef __cplusplus +} +#endif + +#endif // MESHTASTIC_REGIONS_H diff --git a/firmware_p4/components/Applications/LoRa/meshtastic/include/meshtastic_roles.h b/firmware_p4/components/Applications/LoRa/meshtastic/include/meshtastic_roles.h new file mode 100644 index 00000000..ee075911 --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/meshtastic/include/meshtastic_roles.h @@ -0,0 +1,167 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#ifndef MESHTASTIC_ROLES_H +#define MESHTASTIC_ROLES_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +/** + * @brief Device role identifiers. + * + * Values match Config.DeviceConfig.Role in the official Meshtastic + * protobuf definition (config.proto). Behavior per role is audited + * against src/mesh/FloodingRouter.cpp and src/mesh/NodeDB.cpp. + */ +typedef enum { + MT_ROLE_CLIENT = 0, + MT_ROLE_CLIENT_MUTE = 1, + MT_ROLE_ROUTER = 2, + MT_ROLE_ROUTER_CLIENT = 3, + MT_ROLE_REPEATER = 4, + MT_ROLE_TRACKER = 5, + MT_ROLE_SENSOR = 6, + MT_ROLE_TAK = 7, + MT_ROLE_CLIENT_HIDDEN = 8, + MT_ROLE_LOST_AND_FOUND = 9, + MT_ROLE_TAK_TRACKER = 10, + MT_ROLE_ROUTER_LATE = 11, + MT_ROLE_CLIENT_BASE = 12, + MT_ROLE_COUNT +} mt_role_t; + +/** + * @brief Rebroadcast policy identifiers. + * + * Values match RebroadcastMode in config.proto. + */ +typedef enum { + MT_REBR_ALL = 0, + MT_REBR_ALL_SKIP_DECODING = 1, + MT_REBR_LOCAL_ONLY = 2, + MT_REBR_KNOWN_ONLY = 3, + MT_REBR_NONE = 4, + MT_REBR_CORE_PORTNUMS_ONLY = 5, + MT_REBR_COUNT +} mt_rebr_mode_t; + +/** + * @brief Return the role currently persisted in NVS. + * + * Falls back to MT_ROLE_CLIENT if NVS is empty. + */ +mt_role_t mt_role_current(void); + +/** + * @brief Persist the given role and auto-select a matching rebroadcast mode. + * + * Side effect: sets the rebroadcast policy based on the role + * (ROUTER -> CORE_PORTNUMS_ONLY, CLIENT_HIDDEN -> LOCAL_ONLY, + * REPEATER -> ALL_SKIP_DECODING, others -> ALL). + */ +void mt_role_set(mt_role_t role); + +/** + * @brief Return the printable name for a role. + */ +const char *mt_role_name(mt_role_t role); + +/** + * @brief Return the rebroadcast mode currently persisted in NVS. + */ +mt_rebr_mode_t mt_rebr_mode_current(void); + +/** + * @brief Persist the given rebroadcast mode. + */ +void mt_rebr_mode_set(mt_rebr_mode_t mode); + +/** + * @brief Whether the role relays other nodes' packets at all. + * + * CLIENT_MUTE is the only role that always returns false. + */ +bool mt_role_is_rebroadcaster(mt_role_t role); + +/** + * @brief Whether the role cancels its own relay when a duplicate is heard. + * + * ROUTER, ROUTER_LATE, and REPEATER never cancel (aggressive infra). + * All other roles cancel to save airtime. + */ +bool mt_role_cancels_on_duplicate(mt_role_t role); + +/** + * @brief Whether the role uses the late rebroadcast window (longer backoff). + * + * Only MT_ROLE_ROUTER_LATE returns true. + */ +bool mt_role_is_late_rebroadcaster(mt_role_t role); + +/** + * @brief Decide whether to forward a packet based on rebroadcast policy. + * + * @param mode Active rebroadcast mode. + * @param portnum PortNum of the decoded packet (0 if undecoded). + * @param is_from_known true if the sender is in the local NodeDB. + * @return true if this packet should be rebroadcast. + */ +bool mt_rebr_should_forward(mt_rebr_mode_t mode, uint32_t portnum, bool is_from_known); + +/** + * @brief Intervalo de broadcast de NodeInfo em segundos para a role dada. + * + * 0 = essa role nao faz broadcast de NodeInfo. + */ +uint32_t mt_role_nodeinfo_interval_secs(mt_role_t role); + +/** + * @brief Intervalo de broadcast de Telemetry em segundos para a role dada. + * + * 0 = essa role nao faz broadcast de telemetry. + */ +uint32_t mt_role_telemetry_interval_secs(mt_role_t role); + +/** + * @brief Intervalo de broadcast de Position em segundos para a role dada. + * + * 0 = essa role nao faz broadcast periodico de posicao (so on-demand). + */ +uint32_t mt_role_position_interval_secs(mt_role_t role); + +/** + * @brief Se a role marca o no como nao-mensagavel no NodeInfo. + * + * ROUTER/ROUTER_LATE/REPEATER: true (infraestrutura, nao chat). + */ +bool mt_role_is_unmessagable(mt_role_t role); + +/** + * @brief Se a role deve responder a requisicoes (want_response). + * + * CLIENT_HIDDEN retorna false (invisivel). + */ +bool mt_role_should_respond(mt_role_t role); + +#ifdef __cplusplus +} +#endif + +#endif // MESHTASTIC_ROLES_H diff --git a/firmware_p4/components/Applications/LoRa/meshtastic/include/meshtastic_wifi.h b/firmware_p4/components/Applications/LoRa/meshtastic/include/meshtastic_wifi.h new file mode 100644 index 00000000..a3bd885c --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/meshtastic/include/meshtastic_wifi.h @@ -0,0 +1,57 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#ifndef MESHTASTIC_WIFI_H +#define MESHTASTIC_WIFI_H + +#include +#include +#include "esp_err.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Initialize Meshtastic WiFi AP + TCP server. + * + * Creates a WiFi AP and listens on port 4403 for the Meshtastic app. + * Uses the same protobuf protocol as BLE (StreamAPI framing). + * + * @param node_num This device's node number. + * @return ESP_OK on success. + */ +esp_err_t meshtastic_wifi_init(uint32_t node_num); + +/** + * @brief Process incoming TCP connections and data. Call from main loop. + */ +void meshtastic_wifi_poll(void); + +/** + * @brief Check if a client is connected. + */ +bool meshtastic_wifi_is_connected(void); + +/** + * @brief Get the current client socket fd. Returns -1 if not connected. + */ +int meshtastic_wifi_get_client_fd(void); + +#ifdef __cplusplus +} +#endif + +#endif // MESHTASTIC_WIFI_H diff --git a/firmware_p4/components/Applications/LoRa/meshtastic/include/mt_mod_admin.h b/firmware_p4/components/Applications/LoRa/meshtastic/include/mt_mod_admin.h new file mode 100644 index 00000000..08cd3060 --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/meshtastic/include/mt_mod_admin.h @@ -0,0 +1,61 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#ifndef MT_MOD_ADMIN_H +#define MT_MOD_ADMIN_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#include "mt_modules.h" + +/** + * @brief Initialize the AdminModule. + * + * Clears the session passkey. No packet is sent during init. + */ +void mt_mod_admin_init(uint32_t node_num); + +/** + * @brief Handle an incoming AdminMessage. + * + * Parses the oneof payload_variant and dispatches to the matching + * handler. Remote SET operations require a valid session passkey + * (issued by a prior GET within the last 300s). + * + * Implemented variants (Fase 1.2 subset): + * - get_owner_request, set_owner + * - get_config_request, set_config (partial) + * - get_device_metadata_request + * - reboot_seconds, shutdown_seconds + * - factory_reset_config, factory_reset_device, nodedb_reset + * - set_fixed_position, remove_fixed_position + * - begin_edit_settings, commit_edit_settings + */ +void mt_mod_admin_on_received(const mt_packet_meta_t *meta, const uint8_t *payload, uint16_t len); + +/** + * @brief Periodic tick. Triggers deferred reboot if scheduled. + */ +void mt_mod_admin_tick(void); + +#ifdef __cplusplus +} +#endif + +#endif // MT_MOD_ADMIN_H diff --git a/firmware_p4/components/Applications/LoRa/meshtastic/include/mt_mod_keyverify.h b/firmware_p4/components/Applications/LoRa/meshtastic/include/mt_mod_keyverify.h new file mode 100644 index 00000000..9c7240bf --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/meshtastic/include/mt_mod_keyverify.h @@ -0,0 +1,69 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#ifndef MT_MOD_KEYVERIFY_H +#define MT_MOD_KEYVERIFY_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#include "mt_modules.h" + +/** + * @brief Initialize the Key Verification module. + */ +void mt_mod_keyverify_init(uint32_t node_num); + +/** + * @brief Handle an incoming KeyVerification proto on PortNum 12. + * + * Parses nonce and hash1/hash2 fields. If hash1 matches the expected + * verification for the tracked peer, marks the NodeDB entry as + * key_manually_verified. + */ +void mt_mod_keyverify_on_received(const mt_packet_meta_t *meta, + const uint8_t *payload, + uint16_t len); + +/** + * @brief Handle an AdminMessage.key_verification (variant 67) from the + * connected phone. + * + * Drives the 4-stage FSM: + * - INITIATE_VERIFICATION: send hash2 to remote with a fresh nonce + * - PROVIDE_SECURITY_NUMBER: user entered code, send hash1 to remote + * - DO_VERIFY: mark current remote as verified + * - DO_NOT_VERIFY: reset state + * + * @param remote_nodenum Target node (field 2 of KeyVerificationAdmin) + * @param message_type Stage (0..3) + * @param nonce FSM nonce (field 3) + * @param has_security Whether security_number is present + * @param security_number 4-digit code (field 4) + */ +void mt_mod_keyverify_handle_admin(uint32_t remote_nodenum, + uint8_t message_type, + uint64_t nonce, + bool has_security, + uint32_t security_number); + +#ifdef __cplusplus +} +#endif + +#endif // MT_MOD_KEYVERIFY_H diff --git a/firmware_p4/components/Applications/LoRa/meshtastic/include/mt_mod_neighborinfo.h b/firmware_p4/components/Applications/LoRa/meshtastic/include/mt_mod_neighborinfo.h new file mode 100644 index 00000000..1feab962 --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/meshtastic/include/mt_mod_neighborinfo.h @@ -0,0 +1,39 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#ifndef MT_MOD_NEIGHBORINFO_H +#define MT_MOD_NEIGHBORINFO_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#include "mt_modules.h" + +void mt_mod_neighborinfo_init(uint32_t node_num); + +void mt_mod_neighborinfo_on_received(const mt_packet_meta_t *meta, + const uint8_t *payload, + uint16_t len); + +void mt_mod_neighborinfo_tick(uint32_t now_s); + +#ifdef __cplusplus +} +#endif + +#endif // MT_MOD_NEIGHBORINFO_H diff --git a/firmware_p4/components/Applications/LoRa/meshtastic/include/mt_mod_nodeinfo.h b/firmware_p4/components/Applications/LoRa/meshtastic/include/mt_mod_nodeinfo.h new file mode 100644 index 00000000..21a43f57 --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/meshtastic/include/mt_mod_nodeinfo.h @@ -0,0 +1,87 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#ifndef MT_MOD_NODEINFO_H +#define MT_MOD_NODEINFO_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#include "mt_modules.h" + +/** + * @brief Initialize the NodeInfoModule. + * + * Loads the persisted long_name and short_name from NVS. Falls back + * to "Highboy" and "HBX" on first boot. + */ +void mt_mod_nodeinfo_init(uint32_t node_num); + +/** + * @brief Handle an incoming User protobuf from another node. + * + * If meta->want_response is set, replies with our own User (subject to + * a 12h throttle to avoid broadcast storms). + */ +void mt_mod_nodeinfo_on_received(const mt_packet_meta_t *meta, + const uint8_t *payload, + uint16_t len); + +/** + * @brief Periodic tick (call once per second). + * + * Triggers a NodeInfo broadcast every 15 min (default interval). + */ +void mt_mod_nodeinfo_tick(uint32_t now_s); + +/** + * @brief Set our display names and persist them to NVS. + * + * @param long_name Null-terminated string, up to 31 chars. NULL to keep. + * @param short_name Null-terminated string, up to 7 chars. NULL to keep. + * + * Forces the next periodic broadcast to fire immediately. + */ +void mt_mod_nodeinfo_set_name(const char *long_name, const char *short_name); + +/** + * @brief Return the current long name. Pointer remains valid until next set. + */ +const char *mt_mod_nodeinfo_get_long(void); + +/** + * @brief Return the current short name. + */ +const char *mt_mod_nodeinfo_get_short(void); + +/** + * @brief Send a unicast NodeInfo request to an unknown peer. + * + * Transmits our own User proto to `to` with want_response=true, asking + * the peer to reply with its NodeInfo. Internally rate-limited per peer + * so repeated calls for the same `to` within the throttle window are + * dropped silently. This is the official discovery mechanism used when + * a packet arrives from a node not yet present in the NodeDB. + */ +void mt_mod_nodeinfo_request(uint32_t to); + +#ifdef __cplusplus +} +#endif + +#endif // MT_MOD_NODEINFO_H diff --git a/firmware_p4/components/Applications/LoRa/meshtastic/include/mt_mod_position.h b/firmware_p4/components/Applications/LoRa/meshtastic/include/mt_mod_position.h new file mode 100644 index 00000000..8b79e110 --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/meshtastic/include/mt_mod_position.h @@ -0,0 +1,67 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#ifndef MT_MOD_POSITION_H +#define MT_MOD_POSITION_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#include "mt_modules.h" + +/** + * @brief Initialize the PositionModule. + * + * Loads fixed_position (lat/lon/alt) from NVS if present. + */ +void mt_mod_position_init(uint32_t node_num); + +/** + * @brief Handle an incoming Position protobuf from another node. + * + * Replies with our fixed_position if want_response is set and + * fixed_position is configured. + */ +void mt_mod_position_on_received(const mt_packet_meta_t *meta, + const uint8_t *payload, + uint16_t len); + +/** + * @brief Periodic tick. Broadcasts position every 15 min if fixed. + */ +void mt_mod_position_tick(uint32_t now_s); + +/** + * @brief Set a fixed position (and persist to NVS). + * + * @param lat_e7 Latitude in degrees * 1e7. + * @param lon_e7 Longitude in degrees * 1e7. + * @param alt_m Altitude in meters. + */ +void mt_mod_position_set_fixed(int32_t lat_e7, int32_t lon_e7, int32_t alt_m); + +/** + * @brief Remove the fixed position (and delete from NVS). + */ +void mt_mod_position_remove_fixed(void); + +#ifdef __cplusplus +} +#endif + +#endif // MT_MOD_POSITION_H diff --git a/firmware_p4/components/Applications/LoRa/meshtastic/include/mt_mod_routing.h b/firmware_p4/components/Applications/LoRa/meshtastic/include/mt_mod_routing.h new file mode 100644 index 00000000..c202a5a8 --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/meshtastic/include/mt_mod_routing.h @@ -0,0 +1,53 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#ifndef MT_MOD_ROUTING_H +#define MT_MOD_ROUTING_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#include "mt_modules.h" + +/** + * @brief Initialize the RoutingModule. + */ +void mt_mod_routing_init(uint32_t node_num); + +/** + * @brief Handle an incoming Routing protobuf (ACK/NAK). + * + * Currently logs only. ACK/NAK parsing to update retransmit state is + * deferred to Fase 2 (ReliableRouter). + */ +void mt_mod_routing_on_received(const mt_packet_meta_t *meta, const uint8_t *payload, uint16_t len); + +/** + * @brief Emit an ACK in response to a packet that had want_ack set. + * + * Builds Routing { error_reason = NONE } and enqueues it for TX at + * priority MESH_PRIO_ACK. Target is meta->from, with meta->id carried + * as request_id. + */ +void mt_mod_routing_maybe_send_ack(const mt_packet_meta_t *meta); + +#ifdef __cplusplus +} +#endif + +#endif // MT_MOD_ROUTING_H diff --git a/firmware_p4/components/Applications/LoRa/meshtastic/include/mt_mod_telemetry.h b/firmware_p4/components/Applications/LoRa/meshtastic/include/mt_mod_telemetry.h new file mode 100644 index 00000000..410b1f5e --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/meshtastic/include/mt_mod_telemetry.h @@ -0,0 +1,50 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#ifndef MT_MOD_TELEMETRY_H +#define MT_MOD_TELEMETRY_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#include "mt_modules.h" + +/** + * @brief Initialize the TelemetryModule (DeviceMetrics subset). + */ +void mt_mod_telemetry_init(uint32_t node_num); + +/** + * @brief Handle an incoming Telemetry protobuf. + * + * Replies with our DeviceMetrics if want_response is set. + */ +void mt_mod_telemetry_on_received(const mt_packet_meta_t *meta, + const uint8_t *payload, + uint16_t len); + +/** + * @brief Periodic tick. Broadcasts DeviceMetrics every 30 min. + */ +void mt_mod_telemetry_tick(uint32_t now_s); + +#ifdef __cplusplus +} +#endif + +#endif // MT_MOD_TELEMETRY_H diff --git a/firmware_p4/components/Applications/LoRa/meshtastic/include/mt_mod_text.h b/firmware_p4/components/Applications/LoRa/meshtastic/include/mt_mod_text.h new file mode 100644 index 00000000..cd29bbff --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/meshtastic/include/mt_mod_text.h @@ -0,0 +1,56 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#ifndef MT_MOD_TEXT_H +#define MT_MOD_TEXT_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +#include "mt_modules.h" + +/** + * @brief Initialize the TextMessageModule. + * + * Clears the 50-slot dedup ring and records our node number. + */ +void mt_mod_text_init(uint32_t node_num); + +/** + * @brief Handle an incoming text message. + * + * Deduplicates on packet id (ring buffer of the last 50 ids). + * Logs the message. Forwarding to the app happens in the mesh core via + * PhoneAPI; this handler does not push frames directly. + * + * @param meta Packet metadata. + * @param payload UTF-8 bytes (or Unishox2 if compressed). + * @param len Payload length. + * @param is_compressed True if the packet arrived on portnum 7 (compressed). + */ +void mt_mod_text_on_received(const mt_packet_meta_t *meta, + const uint8_t *payload, + uint16_t len, + bool is_compressed); + +#ifdef __cplusplus +} +#endif + +#endif // MT_MOD_TEXT_H diff --git a/firmware_p4/components/Applications/LoRa/meshtastic/include/mt_mod_traceroute.h b/firmware_p4/components/Applications/LoRa/meshtastic/include/mt_mod_traceroute.h new file mode 100644 index 00000000..9d597db1 --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/meshtastic/include/mt_mod_traceroute.h @@ -0,0 +1,47 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#ifndef MT_MOD_TRACEROUTE_H +#define MT_MOD_TRACEROUTE_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#include "mt_modules.h" + +/** + * @brief Initialize the TraceRouteModule. + */ +void mt_mod_traceroute_init(uint32_t node_num); + +/** + * @brief Handle an incoming RouteDiscovery. + * + * If we are the destination and want_response is set, replies with + * the accumulated route plus our own node number. Otherwise forwards + * by relying on the mesh core's flood rebroadcast. + */ +void mt_mod_traceroute_on_received(const mt_packet_meta_t *meta, + const uint8_t *payload, + uint16_t len); + +#ifdef __cplusplus +} +#endif + +#endif // MT_MOD_TRACEROUTE_H diff --git a/firmware_p4/components/Applications/LoRa/meshtastic/include/mt_modules.h b/firmware_p4/components/Applications/LoRa/meshtastic/include/mt_modules.h new file mode 100644 index 00000000..d38ca2e4 --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/meshtastic/include/mt_modules.h @@ -0,0 +1,129 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#ifndef MT_MODULES_H +#define MT_MODULES_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +#include "esp_err.h" + +/** + * @brief Meshtastic portnum identifiers. + * + * Values match PortNum in the official protobuf (portnums.proto). + */ +typedef enum { + MT_PORT_UNKNOWN = 0, + MT_PORT_TEXT_MESSAGE = 1, + MT_PORT_REMOTE_HARDWARE = 2, + MT_PORT_POSITION = 3, + MT_PORT_NODEINFO = 4, + MT_PORT_ROUTING = 5, + MT_PORT_ADMIN = 6, + MT_PORT_TEXT_COMPRESSED = 7, + MT_PORT_WAYPOINT = 8, + MT_PORT_DETECTION_SENSOR = 10, + MT_PORT_ALERT = 11, + MT_PORT_KEY_VERIFICATION = 12, + MT_PORT_TELEMETRY = 67, + MT_PORT_TRACEROUTE = 70, + MT_PORT_NEIGHBORINFO = 71, +} mt_portnum_t; + +/** + * @brief Per-packet metadata passed to each module handler. + */ +typedef struct { + uint32_t from; + uint32_t to; + uint32_t id; + uint8_t channel; + uint8_t hop_limit; + uint8_t hop_start; + int16_t rssi_dbm; + int8_t snr_db; + bool want_ack; + bool want_response; + uint32_t request_id; +} mt_packet_meta_t; + +/** + * @brief Initialize every built-in module. + * + * Must be called once at boot, after mesh init. Opens NVS via + * mt_nvs_init(), then constructs Admin, NodeInfo, Position, Text, + * Routing, TraceRoute, and Telemetry modules. + * + * @param node_num Our node number (uint32, MAC-derived). + * @return + * - ESP_OK on success + * - esp_err_t from mt_nvs_init on failure + */ +esp_err_t mt_modules_init(uint32_t node_num); + +/** + * @brief Dispatch a decrypted Data packet to the correct module. + * + * Called by the mesh core after AES-CTR decrypt. Routes by portnum to + * the module that owns it and also triggers automatic ACK generation + * when meta->want_ack is set and meta->to is us. + * + * @param meta Packet metadata. + * @param data_bytes Decrypted Data protobuf payload. + * @param data_len Payload size in bytes. + */ +void mt_modules_dispatch(const mt_packet_meta_t *meta, + const uint8_t *data_bytes, + uint16_t data_len); + +/** + * @brief Periodic tick for modules that need timer-driven behavior. + * + * Call once per second from the main loop. Routes to NodeInfo, Position, + * Telemetry, and Admin tickers. + */ +void mt_modules_tick(void); + +/** + * @brief Minimal protobuf parser that extracts fields from a Data message. + * + * Decodes portnum (field 1), payload (field 2), and request_id (field 3). + * + * @param data_bytes Raw Data protobuf bytes. + * @param data_len Size of data_bytes. + * @param[out] out_portnum Decoded portnum or 0 if absent. + * @param[out] out_payload Pointer into data_bytes where payload starts. + * @param[out] out_payload_len Payload length. + * @param[out] out_request_id Decoded request_id or 0 if absent. May be NULL. + * @return true on successful parse, false on malformed input. + */ +bool mt_parse_data(const uint8_t *data_bytes, + uint16_t data_len, + uint32_t *out_portnum, + const uint8_t **out_payload, + uint16_t *out_payload_len, + uint32_t *out_request_id); + +#ifdef __cplusplus +} +#endif + +#endif // MT_MODULES_H diff --git a/firmware_p4/components/Applications/LoRa/meshtastic/include/unishox2.h b/firmware_p4/components/Applications/LoRa/meshtastic/include/unishox2.h new file mode 100644 index 00000000..7872d7f5 --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/meshtastic/include/unishox2.h @@ -0,0 +1,305 @@ +/* + * Copyright (C) 2020 Siara Logics (cc) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * @author Arundale Ramanathan + * + * Port for Particle (particle.io) / Aruino - Jonathan Greenblatt + * + * This file describes each function of the Unishox2 API \n + * For finding out how this API can be used in your program, \n + * please see test_unishox2.c. + */ + +#ifndef unishox2 +#define unishox2 + +#ifdef __cplusplus +extern "C" { +#endif + +#define UNISHOX_VERSION "2.0" ///< Unicode spec version + +/** + * Macro switch to enable/disable output buffer length parameter in low level api \n + * Disabled by default \n + * When this macro is defined, the all the API functions \n + * except the simple API functions accept an additional parameter olen \n + * that enables the developer to pass the size of the output buffer provided \n + * so that the api function may not write beyond that length. \n + * This can be disabled if the developer knows that the buffer provided is sufficient enough \n + * so no additional parameter is passed and the program is faster since additional check \n + * for output length is not performed at each step \n + * The simple api, i.e. unishox2_(de)compress_simple will always omit the buffer length + */ +#ifndef UNISHOX_API_WITH_OUTPUT_LEN +#define UNISHOX_API_WITH_OUTPUT_LEN 1 +#endif + +/// Upto 8 bits of initial magic bit sequence can be included. Bit count can be specified with +/// UNISHOX_MAGIC_BIT_LEN +#ifndef UNISHOX_MAGIC_BITS +#define UNISHOX_MAGIC_BITS 0xFF +#endif + +/// Desired length of Magic bits defined by UNISHOX_MAGIC_BITS +#ifdef UNISHOX_MAGIC_BIT_LEN +#if UNISHOX_MAGIC_BIT_LEN < 0 || 9 <= UNISHOX_MAGIC_BIT_LEN +#error "UNISHOX_MAGIC_BIT_LEN need between [0, 8)" +#endif +#else +#define UNISHOX_MAGIC_BIT_LEN 1 +#endif + +// enum {USX_ALPHA = 0, USX_SYM, USX_NUM, USX_DICT, USX_DELTA}; + +/// Default Horizontal codes. When composition of text is know beforehand, the other hcodes in this +/// section can be used to achieve more compression. +#define USX_HCODES_DFLT (const unsigned char[]){0x00, 0x40, 0x80, 0xC0, 0xE0} +/// Length of each default hcode +#define USX_HCODE_LENS_DFLT (const unsigned char[]){2, 2, 2, 3, 3} + +/// Horizontal codes preset for English Alphabet content only +#define USX_HCODES_ALPHA_ONLY (const unsigned char[]){0x00, 0x00, 0x00, 0x00, 0x00} +/// Length of each Alpha only hcode +#define USX_HCODE_LENS_ALPHA_ONLY (const unsigned char[]){0, 0, 0, 0, 0} + +/// Horizontal codes preset for Alpha Numeric content only +#define USX_HCODES_ALPHA_NUM_ONLY (const unsigned char[]){0x00, 0x00, 0x80, 0x00, 0x00} +/// Length of each Alpha numeric hcode +#define USX_HCODE_LENS_ALPHA_NUM_ONLY (const unsigned char[]){1, 0, 1, 0, 0} + +/// Horizontal codes preset for Alpha Numeric and Symbol content only +#define USX_HCODES_ALPHA_NUM_SYM_ONLY (const unsigned char[]){0x00, 0x80, 0xC0, 0x00, 0x00} +/// Length of each Alpha numeric and symbol hcodes +#define USX_HCODE_LENS_ALPHA_NUM_SYM_ONLY (const unsigned char[]){1, 2, 2, 0, 0} + +/// Horizontal codes preset favouring Alphabet content +#define USX_HCODES_FAVOR_ALPHA (const unsigned char[]){0x00, 0x80, 0xA0, 0xC0, 0xE0} +/// Length of each hcode favouring Alpha content +#define USX_HCODE_LENS_FAVOR_ALPHA (const unsigned char[]){1, 3, 3, 3, 3} + +/// Horizontal codes preset favouring repeating sequences +#define USX_HCODES_FAVOR_DICT (const unsigned char[]){0x00, 0x40, 0xC0, 0x80, 0xE0} +/// Length of each hcode favouring repeating sequences +#define USX_HCODE_LENS_FAVOR_DICT (const unsigned char[]){2, 2, 3, 2, 3} + +/// Horizontal codes preset favouring symbols +#define USX_HCODES_FAVOR_SYM (const unsigned char[]){0x80, 0x00, 0xA0, 0xC0, 0xE0} +/// Length of each hcode favouring symbols +#define USX_HCODE_LENS_FAVOR_SYM (const unsigned char[]){3, 1, 3, 3, 3} + +// #define USX_HCODES_FAVOR_UMLAUT {0x00, 0x40, 0xE0, 0xC0, 0x80} +// #define USX_HCODE_LENS_FAVOR_UMLAUT {2, 2, 3, 3, 2} + +/// Horizontal codes preset favouring umlaut letters +#define USX_HCODES_FAVOR_UMLAUT (const unsigned char[]){0x80, 0xA0, 0xC0, 0xE0, 0x00} +/// Length of each hcode favouring umlaut letters +#define USX_HCODE_LENS_FAVOR_UMLAUT (const unsigned char[]){3, 3, 3, 3, 1} + +/// Horizontal codes preset for no repeating sequences +#define USX_HCODES_NO_DICT (const unsigned char[]){0x00, 0x40, 0x80, 0x00, 0xC0} +/// Length of each hcode for no repeating sequences +#define USX_HCODE_LENS_NO_DICT (const unsigned char[]){2, 2, 2, 0, 2} + +/// Horizontal codes preset for no Unicode characters +#define USX_HCODES_NO_UNI (const unsigned char[]){0x00, 0x40, 0x80, 0xC0, 0x00} +/// Length of each hcode for no Unicode characters +#define USX_HCODE_LENS_NO_UNI (const unsigned char[]){2, 2, 2, 2, 0} + +extern const char *USX_FREQ_SEQ_DFLT[]; +extern const char *USX_FREQ_SEQ_TXT[]; +extern const char *USX_FREQ_SEQ_URL[]; +extern const char *USX_FREQ_SEQ_JSON[]; +extern const char *USX_FREQ_SEQ_HTML[]; +extern const char *USX_FREQ_SEQ_XML[]; +extern const char *USX_TEMPLATES[]; + +/// Default preset parameter set. When composition of text is know beforehand, the other parameter +/// sets in this section can be used to achieve more compression. +#define USX_PSET_DFLT USX_HCODES_DFLT, USX_HCODE_LENS_DFLT, USX_FREQ_SEQ_DFLT, USX_TEMPLATES +/// Preset parameter set for English Alphabet only content +#define USX_PSET_ALPHA_ONLY \ + USX_HCODES_ALPHA_ONLY, USX_HCODE_LENS_ALPHA_ONLY, USX_FREQ_SEQ_TXT, USX_TEMPLATES +/// Preset parameter set for Alpha numeric content +#define USX_PSET_ALPHA_NUM_ONLY \ + USX_HCODES_ALPHA_NUM_ONLY, USX_HCODE_LENS_ALPHA_NUM_ONLY, USX_FREQ_SEQ_TXT, USX_TEMPLATES +/// Preset parameter set for Alpha numeric and symbol content +#define USX_PSET_ALPHA_NUM_SYM_ONLY \ + USX_HCODES_ALPHA_NUM_SYM_ONLY, USX_HCODE_LENS_ALPHA_NUM_SYM_ONLY, USX_FREQ_SEQ_DFLT, USX_TEMPLATES +/// Preset parameter set for Alpha numeric symbol content having predominantly text +#define USX_PSET_ALPHA_NUM_SYM_ONLY_TXT \ + USX_HCODES_ALPHA_NUM_SYM_ONLY, USX_HCODE_LENS_ALPHA_NUM_SYM_ONLY, USX_FREQ_SEQ_DFLT, USX_TEMPLATES +/// Preset parameter set favouring Alphabet content +#define USX_PSET_FAVOR_ALPHA \ + USX_HCODES_FAVOR_ALPHA, USX_HCODE_LENS_FAVOR_ALPHA, USX_FREQ_SEQ_TXT, USX_TEMPLATES +/// Preset parameter set favouring repeating sequences +#define USX_PSET_FAVOR_DICT \ + USX_HCODES_FAVOR_DICT, USX_HCODE_LENS_FAVOR_DICT, USX_FREQ_SEQ_DFLT, USX_TEMPLATES +/// Preset parameter set favouring symbols +#define USX_PSET_FAVOR_SYM \ + USX_HCODES_FAVOR_SYM, USX_HCODE_LENS_FAVOR_SYM, USX_FREQ_SEQ_DFLT, USX_TEMPLATES +/// Preset parameter set favouring unlaut letters +#define USX_PSET_FAVOR_UMLAUT \ + USX_HCODES_FAVOR_UMLAUT, USX_HCODE_LENS_FAVOR_UMLAUT, USX_FREQ_SEQ_DFLT, USX_TEMPLATES +/// Preset parameter set for when there are no repeating sequences +#define USX_PSET_NO_DICT \ + USX_HCODES_NO_DICT, USX_HCODE_LENS_NO_DICT, USX_FREQ_SEQ_DFLT, USX_TEMPLATES +/// Preset parameter set for when there are no unicode symbols +#define USX_PSET_NO_UNI USX_HCODES_NO_UNI, USX_HCODE_LENS_NO_UNI, USX_FREQ_SEQ_DFLT, USX_TEMPLATES +/// Preset parameter set for when there are no unicode symbols favouring text +#define USX_PSET_NO_UNI_FAVOR_TEXT \ + USX_HCODES_NO_UNI, USX_HCODE_LENS_NO_UNI, USX_FREQ_SEQ_TXT, USX_TEMPLATES +/// Preset parameter set favouring URL content +#define USX_PSET_URL USX_HCODES_DFLT, USX_HCODE_LENS_DFLT, USX_FREQ_SEQ_URL, USX_TEMPLATES +/// Preset parameter set favouring JSON content +#define USX_PSET_JSON USX_HCODES_DFLT, USX_HCODE_LENS_DFLT, USX_FREQ_SEQ_JSON, USX_TEMPLATES +/// Preset parameter set favouring JSON content having no Unicode symbols +#define USX_PSET_JSON_NO_UNI \ + USX_HCODES_NO_UNI, USX_HCODE_LENS_NO_UNI, USX_FREQ_SEQ_JSON, USX_TEMPLATES +/// Preset parameter set favouring XML content +#define USX_PSET_XML USX_HCODES_DFLT, USX_HCODE_LENS_DFLT, USX_FREQ_SEQ_XML, USX_TEMPLATES +/// Preset parameter set favouring HTML content +#define USX_PSET_HTML USX_HCODES_DFLT, USX_HCODE_LENS_DFLT, USX_FREQ_SEQ_HTML, USX_TEMPLATES + +/** + * This structure is used when a string array needs to be compressed. + * This is passed as a parameter to the unishox2_decompress_lines() function + */ +struct us_lnk_lst { + char *data; + struct us_lnk_lst *previous; +}; + +/** + * This macro is for internal use, but builds upon the macro UNISHOX_API_WITH_OUTPUT_LEN + * When the macro UNISHOX_API_WITH_OUTPUT_LEN is defined, the all the API functions + * except the simple API functions accept an additional parameter olen + * that enables the developer to pass the size of the output buffer provided + * so that the api function may not write beyond that length. + * This can be disabled if the developer knows that the buffer provided is sufficient enough + * so no additional parameter is passed and the program is faster since additional check + * for output length is not performed at each step + */ +#if defined(UNISHOX_API_WITH_OUTPUT_LEN) && UNISHOX_API_WITH_OUTPUT_LEN != 0 +#define UNISHOX_API_OUT_AND_LEN(out, olen) out, olen +#else +#define UNISHOX_API_OUT_AND_LEN(out, olen) out +#endif + +/** + * Simple API for compressing a string + * @param[in] in Input ASCII / UTF-8 string + * @param[in] len length in bytes + * @param[out] out output buffer - should be large enough to hold compressed output + */ +extern int unishox2_compress_simple(const char *in, int len, char *out); +/** + * Simple API for decompressing a string + * @param[in] in Input compressed bytes (output of unishox2_compress functions) + * @param[in] len length of 'in' in bytes + * @param[out] out output buffer for ASCII / UTF-8 string - should be large enough + */ +extern int unishox2_decompress_simple(const char *in, int len, char *out); +/** + * Comprehensive API for compressing a string + * + * Presets are available for the last four parameters so they can be passed as single parameter. \n + * See USX_PSET_* macros. Example call: \n + * unishox2_compress(in, len, out, olen, USX_PSET_ALPHA_ONLY); + * + * @param[in] in Input ASCII / UTF-8 string + * @param[in] len length in bytes + * @param[out] out output buffer - should be large enough to hold compressed output + * @param[in] olen length of 'out' buffer in bytes. Can be omitted if sufficient buffer is + * provided + * @param[in] usx_hcodes Horizontal codes (array of bytes). See macro section for samples. + * @param[in] usx_hcode_lens Length of each element in usx_hcodes array + * @param[in] usx_freq_seq Frequently occurring sequences. See USX_FREQ_SEQ_* macros for samples + * @param[in] usx_templates Templates of frequently occurring patterns. See USX_TEMPLATES macro. + */ +extern int unishox2_compress(const char *in, + int len, + UNISHOX_API_OUT_AND_LEN(char *out, int olen), + const unsigned char usx_hcodes[], + const unsigned char usx_hcode_lens[], + const char *usx_freq_seq[], + const char *usx_templates[]); +/** + * Comprehensive API for de-compressing a string + * + * Presets are available for the last four parameters so they can be passed as single parameter. \n + * See USX_PSET_* macros. Example call: \n + * unishox2_decompress(in, len, out, olen, USX_PSET_ALPHA_ONLY); + * + * @param[in] in Input compressed bytes (output of unishox2_compress functions) + * @param[in] len length of 'in' in bytes + * @param[out] out output buffer - should be large enough to hold de-compressed output + * @param[in] olen length of 'out' buffer in bytes. Can be omitted if sufficient buffer is + * provided + * @param[in] usx_hcodes Horizontal codes (array of bytes). See macro section for samples. + * @param[in] usx_hcode_lens Length of each element in usx_hcodes array + * @param[in] usx_freq_seq Frequently occurring sequences. See USX_FREQ_SEQ_* macros for samples + * @param[in] usx_templates Templates of frequently occurring patterns. See USX_TEMPLATES macro. + */ +extern int unishox2_decompress(const char *in, + int len, + UNISHOX_API_OUT_AND_LEN(char *out, int olen), + const unsigned char usx_hcodes[], + const unsigned char usx_hcode_lens[], + const char *usx_freq_seq[], + const char *usx_templates[]); +/** + * More Comprehensive API for compressing array of strings + * + * See unishox2_compress() function for parameter definitions. \n + * This function takes an additional parameter, i.e. 'prev_lines' - the usx_lnk_lst structure \n + * See -g parameter in test_unishox2.c to find out how this can be used. \n + * This function is used when an array of strings need to be compressed \n + * and stored in a compressed array of bytes for use as a constant in other programs \n + * where each element of the array can be decompressed and used at runtime. + */ +extern int unishox2_compress_lines(const char *in, + int len, + UNISHOX_API_OUT_AND_LEN(char *out, int olen), + const unsigned char usx_hcodes[], + const unsigned char usx_hcode_lens[], + const char *usx_freq_seq[], + const char *usx_templates[], + struct us_lnk_lst *prev_lines); +/** + * More Comprehensive API for de-compressing array of strings \n + * This function is not be used in conjuction with unishox2_compress_lines() + * + * See unishox2_decompress() function for parameter definitions. \n + * Typically an array is compressed using unishox2_compress_lines() and \n + * a header (.h) file is generated using the resultant compressed array. \n + * This header file can be used in another program with another decompress \n + * routine which takes this compressed array as parameter and index to be \n + * decompressed. + */ +extern int unishox2_decompress_lines(const char *in, + int len, + UNISHOX_API_OUT_AND_LEN(char *out, int olen), + const unsigned char usx_hcodes[], + const unsigned char usx_hcode_lens[], + const char *usx_freq_seq[], + const char *usx_templates[], + struct us_lnk_lst *prev_lines); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/firmware_p4/components/Applications/LoRa/meshtastic/meshtastic_app.c b/firmware_p4/components/Applications/LoRa/meshtastic/meshtastic_app.c new file mode 100644 index 00000000..32dbc5c7 --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/meshtastic/meshtastic_app.c @@ -0,0 +1,184 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "meshtastic_app.h" + +#include "esp_log.h" +#include "esp_mac.h" +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" + +#include "meshtastic_mesh.h" +#include "meshtastic_nodedb.h" +#include "meshtastic_nvs.h" +#include "meshtastic_phone_bridge.h" +#include "meshtastic_phoneapi.h" +#include "meshtastic_pki.h" +#include "meshtastic_presets.h" +#include "meshtastic_regions.h" +#include "mt_modules.h" +#include "sx1262.h" +#include "sx1262_hal.h" +#include "sx1262_regs.h" + +static const char *TAG = "MT_APP"; + +#define MT_POLL_TASK_STACK 8192 +#define MT_POLL_TASK_PRIO 4 +#define MT_POLL_PERIOD_MS 50 +#define MT_TICK_PERIOD_MS 1000 +#define MT_DEFAULT_TX_POWER_DBM 20 +#define MT_DEFAULT_PREAMBLE_LEN 16 +#define MT_PRIMARY_CHANNEL 19 +#define MT_CR_TO_SX1262(cr) ((uint8_t)((cr) - 4)) + +static uint32_t derive_node_num(void); +static void poll_task(void *pv); + +esp_err_t meshtastic_app_start(void) { + uint32_t node_num = derive_node_num(); + ESP_LOGI(TAG, "Node num derived: 0x%08lX", (unsigned long)node_num); + + esp_err_t ret = mt_nvs_init(); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "mt_nvs_init failed: %s", esp_err_to_name(ret)); + return ret; + } + + mt_preset_t preset = mt_preset_current(); + const mt_preset_info_t *p_info = mt_preset_info(preset); + if (p_info == NULL) { + ESP_LOGE(TAG, "Invalid preset id %d", (int)preset); + return ESP_FAIL; + } + + mt_region_t region = mt_region_current(); + uint32_t freq_hz = mt_region_freq_for_channel(region, MT_PRIMARY_CHANNEL, p_info->bw_hz); + + sx1262_config_t cfg = {0}; + ret = sx1262_hal_create(&cfg.hal); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "sx1262_hal_create failed: %s", esp_err_to_name(ret)); + return ret; + } + + cfg.frequency_hz = freq_hz; + cfg.sf = p_info->sf; + cfg.bw = mt_preset_bw_to_sx1262(p_info->bw_hz); + cfg.cr = MT_CR_TO_SX1262(p_info->cr); + cfg.tx_power_dbm = MT_DEFAULT_TX_POWER_DBM; + cfg.preamble_len = MT_DEFAULT_PREAMBLE_LEN; + cfg.is_crc_on = true; + cfg.is_inverted_iq = false; + cfg.is_implicit_hdr = false; + cfg.is_public_network = false; + + ret = sx1262_init(&cfg); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "sx1262_init failed: %s", esp_err_to_name(ret)); + return ret; + } + ret = sx1262_start(); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "sx1262_start failed: %s", esp_err_to_name(ret)); + return ret; + } + ESP_LOGI(TAG, + "SX1262 ready (%lu Hz, SF%u, BW%lu, CR4/%u, %d dBm) preset=%s", + (unsigned long)freq_hz, + p_info->sf, + (unsigned long)p_info->bw_hz, + p_info->cr, + MT_DEFAULT_TX_POWER_DBM, + p_info->name); + + ret = mt_pki_init(); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "mt_pki_init failed: %s", esp_err_to_name(ret)); + return ret; + } + + ret = mt_nodedb_init(); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "mt_nodedb_init failed: %s", esp_err_to_name(ret)); + return ret; + } + + ret = mt_modules_init(node_num); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "mt_modules_init failed: %s", esp_err_to_name(ret)); + return ret; + } + + ret = meshtastic_mesh_init(node_num); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "meshtastic_mesh_init failed: %s", esp_err_to_name(ret)); + return ret; + } + + ret = phoneapi_init(node_num); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "phoneapi_init failed: %s", esp_err_to_name(ret)); + return ret; + } + + ret = meshtastic_phone_bridge_init(node_num); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "meshtastic_phone_bridge_init failed: %s", esp_err_to_name(ret)); + return ret; + } + + ret = meshtastic_mesh_start(); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "meshtastic_mesh_start failed: %s", esp_err_to_name(ret)); + return ret; + } + + if (xTaskCreate(poll_task, "mt_poll", MT_POLL_TASK_STACK, NULL, MT_POLL_TASK_PRIO, NULL) != + pdPASS) { + ESP_LOGE(TAG, "Failed to spawn poll task"); + return ESP_ERR_NO_MEM; + } + + ret = meshtastic_phone_bridge_ble_start(); + if (ret != ESP_OK) { + ESP_LOGW( + TAG, "meshtastic_phone_bridge_ble_start failed: %s (will retry)", esp_err_to_name(ret)); + } + + ESP_LOGI(TAG, "Meshtastic stack online -- waiting for phone"); + return ESP_OK; +} + +static uint32_t derive_node_num(void) { + uint8_t mac[6] = {0}; + esp_efuse_mac_get_default(mac); + return ((uint32_t)mac[2] << 24) | ((uint32_t)mac[3] << 16) | ((uint32_t)mac[4] << 8) | + (uint32_t)mac[5]; +} + +static void poll_task(void *pv) { + (void)pv; + const TickType_t poll_period = pdMS_TO_TICKS(MT_POLL_PERIOD_MS); + const uint32_t ticks_per_module_tick = MT_TICK_PERIOD_MS / MT_POLL_PERIOD_MS; + uint32_t tick_counter = 0; + while (1) { + meshtastic_mesh_poll(); + if (++tick_counter >= ticks_per_module_tick) { + tick_counter = 0; + mt_modules_tick(); + } + vTaskDelay(poll_period); + } +} diff --git a/firmware_p4/components/Applications/LoRa/meshtastic/meshtastic_ble.c b/firmware_p4/components/Applications/LoRa/meshtastic/meshtastic_ble.c new file mode 100644 index 00000000..eefd2332 --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/meshtastic/meshtastic_ble.c @@ -0,0 +1,43 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#include "meshtastic_ble.h" + +#include "esp_log.h" + +#include "meshtastic_phone_bridge.h" + +static const char *TAG = "MESHTASTIC_BLE"; + +esp_err_t meshtastic_ble_init(uint32_t node_num) { + (void)node_num; + esp_err_t ret = meshtastic_phone_bridge_ble_start(); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "BLE start failed: %s", esp_err_to_name(ret)); + } + return ret; +} + +esp_err_t meshtastic_ble_start(void) { + return meshtastic_phone_bridge_ble_start(); +} + +void meshtastic_ble_stop(void) { + meshtastic_phone_bridge_ble_stop(); +} + +bool meshtastic_ble_is_connected(void) { + return meshtastic_phone_bridge_is_connected(); +} diff --git a/firmware_p4/components/Applications/LoRa/meshtastic/meshtastic_channels.c b/firmware_p4/components/Applications/LoRa/meshtastic/meshtastic_channels.c new file mode 100644 index 00000000..c902934c --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/meshtastic/meshtastic_channels.c @@ -0,0 +1,169 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#include "meshtastic_channels.h" + +#include + +#include "esp_log.h" +#include "mbedtls/sha256.h" + +#include "meshtastic_nvs.h" + +static const char *TAG = "MESHTASTIC_CHANNELS"; + +#define MT_CHANNELS_NVS_KEY "channels" + +static const uint8_t DEFAULT_PSK[MT_PSK_SIZE] = { + 0xd4, + 0xf1, + 0xbb, + 0x3a, + 0x20, + 0x29, + 0x07, + 0x59, + 0xf0, + 0xbc, + 0xff, + 0xab, + 0xcf, + 0x4e, + 0x69, + 0x01, +}; + +static mt_channel_t s_channels[MT_MAX_CHANNELS]; + +static uint8_t compute_hash(const uint8_t *psk) { + uint8_t digest[32]; + mbedtls_sha256(psk, MT_PSK_SIZE, digest, 0); + return digest[0]; +} + +static void persist(void) { + mt_nvs_set_blob(MT_CHANNELS_NVS_KEY, s_channels, sizeof(s_channels)); +} + +void mt_channels_init(void) { + memset(s_channels, 0, sizeof(s_channels)); + + int read_len = mt_nvs_get_blob(MT_CHANNELS_NVS_KEY, s_channels, sizeof(s_channels)); + if (read_len != (int)sizeof(s_channels)) { + ESP_LOGW(TAG, "Channels NVS absent - installing default PRIMARY"); + memset(s_channels, 0, sizeof(s_channels)); + s_channels[0].is_used = true; + s_channels[0].role = MT_CH_PRIMARY; + memcpy(s_channels[0].psk, DEFAULT_PSK, MT_PSK_SIZE); + s_channels[0].hash = compute_hash(DEFAULT_PSK); + strcpy(s_channels[0].name, "LongFast"); + persist(); + } + + int active_count = 0; + for (int i = 0; i < MT_MAX_CHANNELS; i++) { + if (s_channels[i].is_used && s_channels[i].role != MT_CH_DISABLED) { + active_count++; + } + } + ESP_LOGI( + TAG, "Initialized - %d active, hash primary=0x%02X", active_count, mt_channel_primary_hash()); +} + +const mt_channel_t *mt_channel_get(uint8_t idx) { + if (idx >= MT_MAX_CHANNELS) + return NULL; + return &s_channels[idx]; +} + +void mt_channel_set(uint8_t idx, const char *name, const uint8_t *psk, mt_channel_role_t role) { + if (idx >= MT_MAX_CHANNELS) + return; + + s_channels[idx].is_used = (role != MT_CH_DISABLED); + s_channels[idx].role = role; + + if (psk != NULL) { + memcpy(s_channels[idx].psk, psk, MT_PSK_SIZE); + s_channels[idx].hash = compute_hash(psk); + } + if (name != NULL) { + strncpy(s_channels[idx].name, name, sizeof(s_channels[idx].name) - 1); + s_channels[idx].name[sizeof(s_channels[idx].name) - 1] = 0; + } + + if (role == MT_CH_PRIMARY) { + for (int i = 0; i < MT_MAX_CHANNELS; i++) { + if (i != idx && s_channels[i].role == MT_CH_PRIMARY) { + s_channels[i].role = MT_CH_SECONDARY; + } + } + } + + persist(); + ESP_LOGI(TAG, + "Channel %u configured - name='%s', role=%d, hash=0x%02X", + idx, + s_channels[idx].name, + (int)s_channels[idx].role, + s_channels[idx].hash); +} + +void mt_channel_disable(uint8_t idx) { + if (idx >= MT_MAX_CHANNELS) + return; + s_channels[idx].is_used = false; + s_channels[idx].role = MT_CH_DISABLED; + persist(); +} + +void mt_channel_set_id(uint8_t idx, uint32_t id) { + if (idx >= MT_MAX_CHANNELS) + return; + s_channels[idx].id = id; + persist(); +} + +bool mt_channel_lookup_by_hash(uint8_t hash, uint8_t *out_idx, const uint8_t **out_psk) { + for (int i = 0; i < MT_MAX_CHANNELS; i++) { + if (s_channels[i].is_used && s_channels[i].role != MT_CH_DISABLED && + s_channels[i].hash == hash) { + if (out_idx != NULL) + *out_idx = (uint8_t)i; + if (out_psk != NULL) + *out_psk = s_channels[i].psk; + return true; + } + } + return false; +} + +uint8_t mt_channel_primary_hash(void) { + for (int i = 0; i < MT_MAX_CHANNELS; i++) { + if (s_channels[i].is_used && s_channels[i].role == MT_CH_PRIMARY) { + return s_channels[i].hash; + } + } + return 0; +} + +const uint8_t *mt_channel_primary_psk(void) { + for (int i = 0; i < MT_MAX_CHANNELS; i++) { + if (s_channels[i].is_used && s_channels[i].role == MT_CH_PRIMARY) { + return s_channels[i].psk; + } + } + return DEFAULT_PSK; +} diff --git a/firmware_p4/components/Applications/LoRa/meshtastic/meshtastic_crypto_pki.c b/firmware_p4/components/Applications/LoRa/meshtastic/meshtastic_crypto_pki.c new file mode 100644 index 00000000..6d578ea0 --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/meshtastic/meshtastic_crypto_pki.c @@ -0,0 +1,315 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#include "meshtastic_crypto_pki.h" + +#include + +#include "esp_log.h" +#include "esp_random.h" +#include "mbedtls/ccm.h" +#include "mbedtls/ecdh.h" +#include "mbedtls/ecp.h" +#include "mbedtls/bignum.h" +#include "mbedtls/sha256.h" + +#include "meshtastic_pki.h" + +static const char *TAG = "MT_CRYPTO_PKI"; + +#define MT_PKI_AES_KEY_BITS 256 +#define MT_PKI_NONCE_LEN 13 +#define MT_PKI_TAG_LEN 8 +#define MT_PKI_EXTRA_LEN 4 + +/* X25519 manual implementation following RFC 7748. + * Uses mbedtls_mpi for big-number arithmetic but bypasses the broken + * mbedtls_ecp_mul path on ESP-IDF Curve25519. */ +static int x25519_scalarmult(uint8_t out[32], const uint8_t scalar[32], const uint8_t point[32]) { + int rc = 0; + mbedtls_mpi p, a24, x_1, x_2, z_2, x_3, z_3; + mbedtls_mpi A, AA, B, BB, E, C, D, DA, CB, t1, t2; + + mbedtls_mpi *all[] = { + &p, &a24, &x_1, &x_2, &z_2, &x_3, &z_3, &A, &AA, &B, &BB, &E, &C, &D, &DA, &CB, &t1, &t2}; + for (size_t i = 0; i < sizeof(all) / sizeof(all[0]); i++) { + mbedtls_mpi_init(all[i]); + } + + /* p = 2^255 - 19 */ + if (rc == 0) + rc = mbedtls_mpi_lset(&p, 1); + if (rc == 0) + rc = mbedtls_mpi_shift_l(&p, 255); + if (rc == 0) + rc = mbedtls_mpi_sub_int(&p, &p, 19); + if (rc == 0) + rc = mbedtls_mpi_lset(&a24, 121665); + + /* Mask high bit of u-coordinate per RFC 7748 */ + uint8_t u[32]; + memcpy(u, point, 32); + u[31] &= 0x7F; + if (rc == 0) + rc = mbedtls_mpi_read_binary_le(&x_1, u, 32); + + /* Initial state */ + if (rc == 0) + rc = mbedtls_mpi_lset(&x_2, 1); + if (rc == 0) + rc = mbedtls_mpi_lset(&z_2, 0); + if (rc == 0) + rc = mbedtls_mpi_copy(&x_3, &x_1); + if (rc == 0) + rc = mbedtls_mpi_lset(&z_3, 1); + + int swap = 0; + + for (int t = 254; t >= 0 && rc == 0; t--) { + int k_t = (scalar[t / 8] >> (t & 7)) & 1; + int sw = swap ^ k_t; + if (sw) { + mbedtls_mpi_swap(&x_2, &x_3); + mbedtls_mpi_swap(&z_2, &z_3); + } + swap = k_t; + + /* A = x_2 + z_2 */ + if (rc == 0) + rc = mbedtls_mpi_add_mpi(&A, &x_2, &z_2); + if (rc == 0) + rc = mbedtls_mpi_mod_mpi(&A, &A, &p); + /* AA = A^2 */ + if (rc == 0) + rc = mbedtls_mpi_mul_mpi(&AA, &A, &A); + if (rc == 0) + rc = mbedtls_mpi_mod_mpi(&AA, &AA, &p); + /* B = x_2 - z_2 */ + if (rc == 0) + rc = mbedtls_mpi_sub_mpi(&B, &x_2, &z_2); + if (rc == 0) + rc = mbedtls_mpi_mod_mpi(&B, &B, &p); + /* BB = B^2 */ + if (rc == 0) + rc = mbedtls_mpi_mul_mpi(&BB, &B, &B); + if (rc == 0) + rc = mbedtls_mpi_mod_mpi(&BB, &BB, &p); + /* E = AA - BB */ + if (rc == 0) + rc = mbedtls_mpi_sub_mpi(&E, &AA, &BB); + if (rc == 0) + rc = mbedtls_mpi_mod_mpi(&E, &E, &p); + /* C = x_3 + z_3 */ + if (rc == 0) + rc = mbedtls_mpi_add_mpi(&C, &x_3, &z_3); + if (rc == 0) + rc = mbedtls_mpi_mod_mpi(&C, &C, &p); + /* D = x_3 - z_3 */ + if (rc == 0) + rc = mbedtls_mpi_sub_mpi(&D, &x_3, &z_3); + if (rc == 0) + rc = mbedtls_mpi_mod_mpi(&D, &D, &p); + /* DA = D * A */ + if (rc == 0) + rc = mbedtls_mpi_mul_mpi(&DA, &D, &A); + if (rc == 0) + rc = mbedtls_mpi_mod_mpi(&DA, &DA, &p); + /* CB = C * B */ + if (rc == 0) + rc = mbedtls_mpi_mul_mpi(&CB, &C, &B); + if (rc == 0) + rc = mbedtls_mpi_mod_mpi(&CB, &CB, &p); + /* x_3 = (DA + CB)^2 */ + if (rc == 0) + rc = mbedtls_mpi_add_mpi(&t1, &DA, &CB); + if (rc == 0) + rc = mbedtls_mpi_mod_mpi(&t1, &t1, &p); + if (rc == 0) + rc = mbedtls_mpi_mul_mpi(&x_3, &t1, &t1); + if (rc == 0) + rc = mbedtls_mpi_mod_mpi(&x_3, &x_3, &p); + /* z_3 = x_1 * (DA - CB)^2 */ + if (rc == 0) + rc = mbedtls_mpi_sub_mpi(&t1, &DA, &CB); + if (rc == 0) + rc = mbedtls_mpi_mod_mpi(&t1, &t1, &p); + if (rc == 0) + rc = mbedtls_mpi_mul_mpi(&t2, &t1, &t1); + if (rc == 0) + rc = mbedtls_mpi_mod_mpi(&t2, &t2, &p); + if (rc == 0) + rc = mbedtls_mpi_mul_mpi(&z_3, &t2, &x_1); + if (rc == 0) + rc = mbedtls_mpi_mod_mpi(&z_3, &z_3, &p); + /* x_2 = AA * BB */ + if (rc == 0) + rc = mbedtls_mpi_mul_mpi(&x_2, &AA, &BB); + if (rc == 0) + rc = mbedtls_mpi_mod_mpi(&x_2, &x_2, &p); + /* z_2 = E * (AA + a24 * E) */ + if (rc == 0) + rc = mbedtls_mpi_mul_mpi(&t1, &a24, &E); + if (rc == 0) + rc = mbedtls_mpi_mod_mpi(&t1, &t1, &p); + if (rc == 0) + rc = mbedtls_mpi_add_mpi(&t1, &t1, &AA); + if (rc == 0) + rc = mbedtls_mpi_mod_mpi(&t1, &t1, &p); + if (rc == 0) + rc = mbedtls_mpi_mul_mpi(&z_2, &t1, &E); + if (rc == 0) + rc = mbedtls_mpi_mod_mpi(&z_2, &z_2, &p); + } + + if (swap && rc == 0) { + mbedtls_mpi_swap(&x_2, &x_3); + mbedtls_mpi_swap(&z_2, &z_3); + } + + /* result = x_2 * z_2^(p - 2) mod p (Fermat inverse) */ + if (rc == 0) + rc = mbedtls_mpi_sub_int(&t1, &p, 2); + if (rc == 0) + rc = mbedtls_mpi_exp_mod(&t2, &z_2, &t1, &p, NULL); + if (rc == 0) + rc = mbedtls_mpi_mul_mpi(&t1, &x_2, &t2); + if (rc == 0) + rc = mbedtls_mpi_mod_mpi(&t1, &t1, &p); + if (rc == 0) + rc = mbedtls_mpi_write_binary_le(&t1, out, 32); + + for (size_t i = 0; i < sizeof(all) / sizeof(all[0]); i++) { + mbedtls_mpi_free(all[i]); + } + return rc; +} + +static bool compute_shared_key(const uint8_t *peer_pub, uint8_t shared_key[32]) { + const uint8_t *priv = mt_pki_get_privkey(); + + uint8_t scalar[32]; + memcpy(scalar, priv, 32); + scalar[0] &= 0xF8; + scalar[31] &= 0x7F; + scalar[31] |= 0x40; + + uint8_t raw_secret[32]; + int rc = x25519_scalarmult(raw_secret, scalar, peer_pub); + if (rc != 0) { + ESP_LOGW(TAG, "x25519_scalarmult failed rc=%d (-0x%04X)", rc, -rc); + return false; + } + + rc = mbedtls_sha256(raw_secret, 32, shared_key, 0); + if (rc != 0) { + ESP_LOGW(TAG, "shared_key sha256 failed rc=%d", rc); + return false; + } + ESP_LOGI(TAG, + "ECDH OK (X25519 manual) shared[0..3]=%02x%02x%02x%02x", + shared_key[0], + shared_key[1], + shared_key[2], + shared_key[3]); + return true; +} + +static void build_nonce(uint8_t nonce[MT_PKI_NONCE_LEN], + uint32_t from_node, + uint32_t packet_id, + uint32_t extra_nonce) { + memset(nonce, 0, MT_PKI_NONCE_LEN); + + uint64_t packet_id_64 = (uint64_t)packet_id; + memcpy(nonce, &packet_id_64, sizeof(uint64_t)); + + memcpy(nonce + 8, &from_node, sizeof(uint32_t)); + + if (extra_nonce != 0) { + memcpy(nonce + 4, &extra_nonce, sizeof(uint32_t)); + } +} + +bool mt_pki_encrypt_curve25519(const uint8_t *peer_pub, + uint32_t from_node, + uint32_t packet_id, + const uint8_t *plain, + size_t plen, + uint8_t *out) { + uint8_t shared_key[32]; + if (!compute_shared_key(peer_pub, shared_key)) + return false; + + uint32_t extra_nonce = esp_random(); + if (extra_nonce == 0) + extra_nonce = 1; + + uint8_t nonce[MT_PKI_NONCE_LEN]; + build_nonce(nonce, from_node, packet_id, extra_nonce); + + mbedtls_ccm_context ccm; + mbedtls_ccm_init(&ccm); + int rc = mbedtls_ccm_setkey(&ccm, MBEDTLS_CIPHER_ID_AES, shared_key, MT_PKI_AES_KEY_BITS); + if (rc == 0) { + rc = mbedtls_ccm_encrypt_and_tag( + &ccm, plen, nonce, MT_PKI_NONCE_LEN, NULL, 0, plain, out, out + plen, MT_PKI_TAG_LEN); + } + mbedtls_ccm_free(&ccm); + + if (rc != 0) { + ESP_LOGW(TAG, "CCM encrypt failed rc=%d", rc); + return false; + } + + memcpy(out + plen + MT_PKI_TAG_LEN, &extra_nonce, MT_PKI_EXTRA_LEN); + return true; +} + +bool mt_pki_decrypt_curve25519(const uint8_t *peer_pub, + uint32_t from_node, + uint32_t packet_id, + const uint8_t *cipher, + size_t clen, + uint8_t *out) { + if (clen <= MT_PKI_OVERHEAD) + return false; + + size_t plen = clen - MT_PKI_OVERHEAD; + const uint8_t *tag = cipher + plen; + uint32_t extra_nonce; + memcpy(&extra_nonce, cipher + plen + MT_PKI_TAG_LEN, MT_PKI_EXTRA_LEN); + + uint8_t shared_key[32]; + if (!compute_shared_key(peer_pub, shared_key)) + return false; + + uint8_t nonce[MT_PKI_NONCE_LEN]; + build_nonce(nonce, from_node, packet_id, extra_nonce); + + mbedtls_ccm_context ccm; + mbedtls_ccm_init(&ccm); + int rc = mbedtls_ccm_setkey(&ccm, MBEDTLS_CIPHER_ID_AES, shared_key, MT_PKI_AES_KEY_BITS); + if (rc == 0) { + rc = mbedtls_ccm_auth_decrypt( + &ccm, plen, nonce, MT_PKI_NONCE_LEN, NULL, 0, cipher, out, tag, MT_PKI_TAG_LEN); + } + mbedtls_ccm_free(&ccm); + + if (rc != 0) { + ESP_LOGD(TAG, "CCM decrypt failed rc=%d (probably not PKI)", rc); + return false; + } + return true; +} diff --git a/firmware_p4/components/Applications/LoRa/meshtastic/meshtastic_mesh.c b/firmware_p4/components/Applications/LoRa/meshtastic/meshtastic_mesh.c new file mode 100644 index 00000000..487b92c2 --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/meshtastic/meshtastic_mesh.c @@ -0,0 +1,1392 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#include "meshtastic_mesh.h" + +#include + +#include "esp_log.h" +#include "esp_random.h" +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" +#include "freertos/semphr.h" +#include "mbedtls/aes.h" + +#include "sx1262.h" +#include "sx1262_regs.h" + +#ifndef MESH_HEADLESS +#define MESH_HEADLESS 1 +#endif + +#if !MESH_HEADLESS +#include "meshtastic_phoneapi.h" +#endif + +#include "mt_modules.h" +#include "meshtastic_channels.h" +#include "meshtastic_crypto_pki.h" +#include "meshtastic_nodedb.h" +#include "meshtastic_pki.h" +#include "meshtastic_pkt_history.h" +#include "meshtastic_roles.h" + +static const char *TAG = "MESH_RADIO"; + +#define MT_HEADER_SIZE 16 +#define MT_MAX_PAYLOAD (255 - MT_HEADER_SIZE) +#define MT_HOP_LIMIT_MASK 0x07 +#define MT_WANT_ACK_MASK 0x08 +#define MT_VIA_MQTT_MASK 0x10 +#define MT_HOP_START_MASK 0xE0 +#define MT_HOP_START_SHIFT 5 + +typedef struct __attribute__((packed)) { + uint32_t to; + uint32_t from; + uint32_t id; + uint8_t flags; + uint8_t channel; + uint8_t next_hop; + uint8_t relay_node; +} mesh_packet_header_t; + +#define MESH_TX_QUEUE_SIZE 8 + +#define MESH_PRIO_ACK 120 +#define MESH_PRIO_ALERT 110 +#define MESH_PRIO_HIGH 100 +#define MESH_PRIO_RESPONSE 80 +#define MESH_PRIO_RELIABLE 70 +#define MESH_PRIO_DEFAULT 64 +#define MESH_PRIO_BACKGROUND 10 +#define MESH_PRIO_MIN 1 + +typedef struct { + bool valid; + uint8_t priority; + uint32_t scheduled_ms; + uint16_t len; + uint8_t buf[256]; +} mesh_tx_entry_t; + +static mesh_tx_entry_t s_tx_queue[MESH_TX_QUEUE_SIZE]; +static SemaphoreHandle_t s_tx_mutex = NULL; + +static uint32_t s_node_num = 0; +static volatile bool s_is_running = false; +static TaskHandle_t s_mesh_task_handle = NULL; + +#define CAD_NOTIFY_BUSY (1U << 0) +#define CAD_NOTIFY_CLEAR (1U << 1) +#define CSMA_MAX_RETRIES 2 +#define CSMA_BACKOFF_BASE_MS 40 +#define CSMA_BACKOFF_JITTER_MS 80 +#define CSMA_PRE_TX_JITTER_MS 30 +#define CAD_TIMEOUT_MS 50 + +#define MESH_RETRY_SLOTS 4 +#define MESH_RETRY_MAX_ATTEMPTS 3 +#define MESH_RETRY_INITIAL_MS 15000 +#define MESH_RETRY_BACKOFF_MULT 2 + +#define MT_ROUTING_ERROR_NONE 0 +#define MT_ROUTING_ERROR_NO_ROUTE 1 +#define MT_ROUTING_ERROR_TIMEOUT 3 +#define MT_ROUTING_ERROR_MAX_RETRANSMIT 5 +#define MT_ROUTING_ERROR_NO_CHANNEL 6 + +typedef struct { + bool in_use; + uint32_t pkt_id; + uint32_t dest_node; + uint8_t channel; + uint8_t hop_limit; + uint8_t attempts_left; + uint32_t next_retx_ms; + uint32_t backoff_ms; + uint16_t wire_len; + uint8_t wire[256]; +} mesh_retry_entry_t; + +static mesh_retry_entry_t s_retry[MESH_RETRY_SLOTS]; +static SemaphoreHandle_t s_retry_mutex = NULL; + +static void on_rx_done(const sx1262_packet_t *pkt, void *ctx); +static void on_tx_done(void *ctx); +static void on_timeout(void *ctx); +static void mesh_task(void *arg); +static void mesh_crypt(uint32_t from_node, uint32_t packet_id, uint8_t *data, size_t len); +static void dedup_add(uint32_t from, uint32_t id); +static void process_rx_packet(const sx1262_packet_t *pkt); +static bool tx_queue_push(const uint8_t *buf, uint16_t len, uint8_t priority, uint32_t delay_ms); +static int tx_queue_pop_highest(mesh_tx_entry_t *out, uint32_t now_ms); +static void retry_track(uint32_t pkt_id, + uint32_t dest_node, + uint8_t channel, + uint8_t hop_limit, + const uint8_t *wire, + uint16_t wire_len); +static void retry_tick(uint32_t now_ms); +static void retry_emit_nak(const mesh_retry_entry_t *entry, uint8_t error_code); + +static uint16_t enc_varint(uint8_t *buf, uint64_t val) { + uint16_t pos = 0; + do { + uint8_t b = val & 0x7F; + val >>= 7; + if (val) + b |= 0x80; + buf[pos++] = b; + } while (val); + return pos; +} + +static uint16_t enc_field_varint(uint8_t *buf, uint8_t fn, uint64_t val) { + uint16_t pos = 0; + buf[pos++] = (fn << 3) | 0; + pos += enc_varint(&buf[pos], val); + return pos; +} + +static uint16_t enc_field_fixed32(uint8_t *buf, uint8_t fn, uint32_t val) { + uint16_t pos = 0; + buf[pos++] = (fn << 3) | 5; + memcpy(&buf[pos], &val, 4); + return pos + 4; +} + +static uint16_t enc_field_bytes(uint8_t *buf, uint8_t fn, const uint8_t *data, uint16_t len) { + uint16_t pos = 0; + buf[pos++] = (fn << 3) | 2; + pos += enc_varint(&buf[pos], len); + memcpy(&buf[pos], data, len); + return pos + len; +} + +static void mesh_crypt_with_psk( + const uint8_t *psk, uint32_t from_node, uint32_t packet_id, uint8_t *data, size_t len) { + if (psk == NULL) + psk = mt_channel_primary_psk(); + + uint8_t nonce[16]; + memset(nonce, 0, sizeof(nonce)); + uint64_t pid64 = packet_id; + memcpy(nonce, &pid64, 8); + memcpy(nonce + 8, &from_node, 4); + + mbedtls_aes_context ctx; + mbedtls_aes_init(&ctx); + mbedtls_aes_setkey_enc(&ctx, psk, 128); + + uint8_t stream_block[16]; + size_t nc_off = 0; + uint8_t nonce_counter[16]; + memcpy(nonce_counter, nonce, 16); + memset(stream_block, 0, 16); + + uint8_t output[256]; + mbedtls_aes_crypt_ctr(&ctx, len, &nc_off, nonce_counter, stream_block, data, output); + memcpy(data, output, len); + + mbedtls_aes_free(&ctx); +} + +static void mesh_crypt(uint32_t from_node, uint32_t packet_id, uint8_t *data, size_t len) { + mesh_crypt_with_psk(NULL, from_node, packet_id, data, len); +} + +static void dedup_add(uint32_t from, uint32_t id) { + mt_pkt_history_check_add(from, id, 3, 0, NULL); +} + +static bool tx_queue_push(const uint8_t *buf, uint16_t len, uint8_t priority, uint32_t delay_ms) { + if (buf == NULL || len == 0 || len > 256) + return false; + if (xSemaphoreTake(s_tx_mutex, pdMS_TO_TICKS(50)) != pdTRUE) { + return false; + } + + int slot = -1; + + for (int i = 0; i < MESH_TX_QUEUE_SIZE; i++) { + if (!s_tx_queue[i].valid) { + slot = i; + break; + } + } + + if (slot < 0) { + int lowest_idx = 0; + uint8_t lowest_prio = s_tx_queue[0].priority; + for (int i = 1; i < MESH_TX_QUEUE_SIZE; i++) { + if (s_tx_queue[i].priority < lowest_prio) { + lowest_prio = s_tx_queue[i].priority; + lowest_idx = i; + } + } + if (priority > lowest_prio) { + slot = lowest_idx; + ESP_LOGW(TAG, "TX queue full, evicting prio=%d", lowest_prio); + } + } + + if (slot < 0) { + xSemaphoreGive(s_tx_mutex); + ESP_LOGW(TAG, "TX queue full, dropping prio=%d len=%d", priority, len); + return false; + } + + uint32_t now = (uint32_t)(xTaskGetTickCount() * portTICK_PERIOD_MS); + s_tx_queue[slot].priority = priority; + s_tx_queue[slot].scheduled_ms = now + delay_ms; + s_tx_queue[slot].len = len; + memcpy(s_tx_queue[slot].buf, buf, len); + s_tx_queue[slot].valid = true; + + xSemaphoreGive(s_tx_mutex); + return true; +} + +static int tx_queue_pop_highest(mesh_tx_entry_t *out, uint32_t now_ms) { + if (xSemaphoreTake(s_tx_mutex, pdMS_TO_TICKS(50)) != pdTRUE) + return 0; + + int best = -1; + uint8_t best_prio = 0; + for (int i = 0; i < MESH_TX_QUEUE_SIZE; i++) { + if (!s_tx_queue[i].valid) + continue; + if (s_tx_queue[i].scheduled_ms > now_ms) + continue; + if (best < 0 || s_tx_queue[i].priority > best_prio) { + best = i; + best_prio = s_tx_queue[i].priority; + } + } + + if (best < 0) { + xSemaphoreGive(s_tx_mutex); + return 0; + } + + memcpy(out, &s_tx_queue[best], sizeof(mesh_tx_entry_t)); + s_tx_queue[best].valid = false; + xSemaphoreGive(s_tx_mutex); + return 1; +} + +static int tx_queue_pending(void) { + if (xSemaphoreTake(s_tx_mutex, pdMS_TO_TICKS(10)) != pdTRUE) + return 0; + int count = 0; + for (int i = 0; i < MESH_TX_QUEUE_SIZE; i++) { + if (s_tx_queue[i].valid) + count++; + } + xSemaphoreGive(s_tx_mutex); + return count; +} + +static void retry_track(uint32_t pkt_id, + uint32_t dest_node, + uint8_t channel, + uint8_t hop_limit, + const uint8_t *wire, + uint16_t wire_len) { + if (wire_len == 0 || wire_len > sizeof(((mesh_retry_entry_t *)0)->wire)) + return; + if (xSemaphoreTake(s_retry_mutex, pdMS_TO_TICKS(50)) != pdTRUE) + return; + + int slot = -1; + for (int i = 0; i < MESH_RETRY_SLOTS; i++) { + if (!s_retry[i].in_use) { + slot = i; + break; + } + } + if (slot < 0) { + uint32_t oldest_expiry = UINT32_MAX; + int victim = 0; + for (int i = 0; i < MESH_RETRY_SLOTS; i++) { + if (s_retry[i].next_retx_ms < oldest_expiry) { + oldest_expiry = s_retry[i].next_retx_ms; + victim = i; + } + } + ESP_LOGW(TAG, "Retry slot full, evicting pkt=0x%08lX", (unsigned long)s_retry[victim].pkt_id); + slot = victim; + } + + uint32_t now = (uint32_t)(xTaskGetTickCount() * portTICK_PERIOD_MS); + s_retry[slot].in_use = true; + s_retry[slot].pkt_id = pkt_id; + s_retry[slot].dest_node = dest_node; + s_retry[slot].channel = channel; + s_retry[slot].hop_limit = hop_limit; + s_retry[slot].attempts_left = MESH_RETRY_MAX_ATTEMPTS; + s_retry[slot].backoff_ms = MESH_RETRY_INITIAL_MS; + s_retry[slot].next_retx_ms = now + MESH_RETRY_INITIAL_MS; + s_retry[slot].wire_len = wire_len; + memcpy(s_retry[slot].wire, wire, wire_len); + + xSemaphoreGive(s_retry_mutex); + ESP_LOGI(TAG, + "Retry scheduled pkt=0x%08lX to=0x%08lX max_attempts=%d", + (unsigned long)pkt_id, + (unsigned long)dest_node, + MESH_RETRY_MAX_ATTEMPTS); +} + +bool meshtastic_mesh_retry_ack(uint32_t pkt_id, bool is_implicit) { + if (pkt_id == 0) + return false; + if (xSemaphoreTake(s_retry_mutex, pdMS_TO_TICKS(50)) != pdTRUE) + return false; + + bool found = false; + for (int i = 0; i < MESH_RETRY_SLOTS; i++) { + if (s_retry[i].in_use && s_retry[i].pkt_id == pkt_id) { + s_retry[i].in_use = false; + found = true; + ESP_LOGI(TAG, + "Retry cancelled pkt=0x%08lX (%s)", + (unsigned long)pkt_id, + is_implicit ? "ACK implicito" : "ACK explicito"); + break; + } + } + xSemaphoreGive(s_retry_mutex); + return found; +} + +static void retry_emit_nak(const mesh_retry_entry_t *entry, uint8_t error_code) { + ESP_LOGW(TAG, + "NAK pkt=0x%08lX to=0x%08lX error=%u", + (unsigned long)entry->pkt_id, + (unsigned long)entry->dest_node, + error_code); + +#if !MESH_HEADLESS + uint8_t routing[4]; + uint16_t rlen = 0; + routing[rlen++] = (3 << 3) | 0; + routing[rlen++] = error_code; + + uint8_t data[32]; + uint16_t d_len = 0; + d_len += enc_field_varint(&data[d_len], 1, 5); + d_len += enc_field_bytes(&data[d_len], 2, routing, rlen); + d_len += enc_field_fixed32(&data[d_len], 6, entry->pkt_id); + + uint8_t mp[128]; + uint16_t mp_len = 0; + uint32_t local_id = esp_random(); + mp_len += enc_field_fixed32(&mp[mp_len], 1, entry->dest_node); + mp_len += enc_field_fixed32(&mp[mp_len], 2, s_node_num); + mp_len += enc_field_varint(&mp[mp_len], 3, entry->channel); + mp_len += enc_field_bytes(&mp[mp_len], 4, data, d_len); + mp_len += enc_field_fixed32(&mp[mp_len], 6, local_id); + + phoneapi_push_packet(mp, mp_len); +#else + (void)entry; + (void)error_code; +#endif +} + +static void retry_tick(uint32_t now_ms) { + if (xSemaphoreTake(s_retry_mutex, pdMS_TO_TICKS(20)) != pdTRUE) + return; + + for (int i = 0; i < MESH_RETRY_SLOTS; i++) { + if (!s_retry[i].in_use) + continue; + if (now_ms < s_retry[i].next_retx_ms) + continue; + + if (s_retry[i].attempts_left == 0) { + ESP_LOGW(TAG, + "Retry exhausted pkt=0x%08lX to=0x%08lX", + (unsigned long)s_retry[i].pkt_id, + (unsigned long)s_retry[i].dest_node); + mesh_retry_entry_t snapshot = s_retry[i]; + s_retry[i].in_use = false; + xSemaphoreGive(s_retry_mutex); + mt_nodedb_record_next_hop_failure(snapshot.dest_node); + retry_emit_nak(&snapshot, MT_ROUTING_ERROR_MAX_RETRANSMIT); + if (xSemaphoreTake(s_retry_mutex, pdMS_TO_TICKS(20)) != pdTRUE) + return; + continue; + } + + ESP_LOGI(TAG, + "Retransmitting pkt=0x%08lX to=0x%08lX (%u attempts left)", + (unsigned long)s_retry[i].pkt_id, + (unsigned long)s_retry[i].dest_node, + s_retry[i].attempts_left); + + tx_queue_push(s_retry[i].wire, s_retry[i].wire_len, MESH_PRIO_RELIABLE, 0); + + s_retry[i].attempts_left--; + s_retry[i].backoff_ms *= MESH_RETRY_BACKOFF_MULT; + s_retry[i].next_retx_ms = now_ms + s_retry[i].backoff_ms; + } + + xSemaphoreGive(s_retry_mutex); +} + +#define MT_TRAFFIC_MGMT_SLOTS 16 +#define MT_TRAFFIC_MGMT_WINDOW_MS 60000 +#define MT_TRAFFIC_MGMT_MAX_PKT 30 + +typedef struct { + uint32_t node_num; + uint32_t window_start_ms; + uint16_t count; +} mt_traffic_slot_t; + +static mt_traffic_slot_t s_traffic[MT_TRAFFIC_MGMT_SLOTS] = {0}; + +static bool traffic_mgmt_should_drop(uint32_t from) { + if (from == 0 || from == 0xFFFFFFFF) + return false; + uint32_t now_ms = (uint32_t)(xTaskGetTickCount() * portTICK_PERIOD_MS); + + int slot = -1; + int free_slot = -1; + int oldest_slot = 0; + uint32_t oldest_age = 0; + for (int i = 0; i < MT_TRAFFIC_MGMT_SLOTS; i++) { + if (s_traffic[i].node_num == from) { + slot = i; + break; + } + if (s_traffic[i].node_num == 0 && free_slot < 0) + free_slot = i; + uint32_t age = now_ms - s_traffic[i].window_start_ms; + if (age > oldest_age) { + oldest_age = age; + oldest_slot = i; + } + } + if (slot < 0) + slot = (free_slot >= 0) ? free_slot : oldest_slot; + + if (s_traffic[slot].node_num != from || + (now_ms - s_traffic[slot].window_start_ms) > MT_TRAFFIC_MGMT_WINDOW_MS) { + s_traffic[slot].node_num = from; + s_traffic[slot].window_start_ms = now_ms; + s_traffic[slot].count = 0; + } + + s_traffic[slot].count++; + return s_traffic[slot].count > MT_TRAFFIC_MGMT_MAX_PKT; +} + +static void process_rx_packet(const sx1262_packet_t *pkt) { + if (pkt->len < MT_HEADER_SIZE) { + ESP_LOGW(TAG, "RX: pacote curto (%d bytes)", pkt->len); + return; + } + + mesh_packet_header_t hdr; + memcpy(&hdr, pkt->buf, sizeof(hdr)); + + uint8_t hop_limit = hdr.flags & MT_HOP_LIMIT_MASK; + uint8_t hop_start = (hdr.flags & MT_HOP_START_MASK) >> MT_HOP_START_SHIFT; + bool want_ack = !!(hdr.flags & MT_WANT_ACK_MASK); + uint16_t payload_len = pkt->len - MT_HEADER_SIZE; + + ESP_LOGI(TAG, + "RX: from=0x%08lX to=0x%08lX id=0x%08lX ch=%d hop=%d/%d len=%d RSSI=%d SNR=%d", + (unsigned long)hdr.from, + (unsigned long)hdr.to, + (unsigned long)hdr.id, + hdr.channel, + hop_limit, + hop_start, + payload_len, + pkt->rssi_pkt_dbm, + pkt->snr_pkt_db); + + if (hdr.from == s_node_num) { + if (meshtastic_mesh_retry_ack(hdr.id, true)) { + ESP_LOGI(TAG, "RX: own pkt rebroadcasted - implicit ACK pkt=0x%08lX", (unsigned long)hdr.id); + } else { + ESP_LOGD(TAG, "RX: pacote proprio, ignoring"); + } + return; + } + + if (traffic_mgmt_should_drop(hdr.from)) { + ESP_LOGW(TAG, "TrafficMgmt: dropping pkt from 0x%08lX (rate-limited)", (unsigned long)hdr.from); + return; + } + + bool was_upgraded = false; + bool seen_before = + mt_pkt_history_check_add(hdr.from, hdr.id, hop_limit, hdr.relay_node, &was_upgraded); + + if (hdr.relay_node != 0) { + mt_nodedb_learn_next_hop(hdr.from, hdr.relay_node); + } + + if (seen_before && !was_upgraded) { + mt_role_t role = mt_role_current(); + if (mt_role_cancels_on_duplicate(role)) { + ESP_LOGD(TAG, "RX duplicate (already relayed) - cancelling rebroadcast"); + } else { + ESP_LOGD(TAG, "RX duplicate (role=%s does not cancel)", mt_role_name(role)); + } + return; + } + + if (was_upgraded) { + ESP_LOGD(TAG, "RX upgrade: hop %u higher than seen before - reprocessing", hop_limit); + } + + uint8_t decrypted[MT_MAX_PAYLOAD]; + uint16_t dec_len = payload_len; + bool pki_decrypted = false; + + if (hdr.channel == 0 && hdr.to == s_node_num && hdr.to != 0xFFFFFFFF && + payload_len > MT_PKI_OVERHEAD) { + const mt_node_entry_t *sender = mt_nodedb_get(hdr.from); + if (sender != NULL && sender->has_public_key) { + if (mt_pki_decrypt_curve25519(sender->public_key, + hdr.from, + hdr.id, + pkt->buf + MT_HEADER_SIZE, + payload_len, + decrypted)) { + pki_decrypted = true; + dec_len = payload_len - MT_PKI_OVERHEAD; + ESP_LOGI(TAG, + "RX PKI decrypt OK (pkt=0x%08lX from 0x%08lX)", + (unsigned long)hdr.id, + (unsigned long)hdr.from); + } + } + } + + const uint8_t *psk = NULL; + uint8_t ch_idx = 0; + if (!pki_decrypted) { + if (!mt_channel_lookup_by_hash(hdr.channel, &ch_idx, &psk)) { + psk = mt_channel_primary_psk(); + } + memcpy(decrypted, pkt->buf + MT_HEADER_SIZE, payload_len); + mesh_crypt_with_psk(psk, hdr.from, hdr.id, decrypted, payload_len); + } + payload_len = dec_len; + + mt_packet_meta_t meta = { + .from = hdr.from, + .to = hdr.to, + .id = hdr.id, + .channel = hdr.channel, + .hop_limit = hop_limit, + .hop_start = hop_start, + .rssi_dbm = pkt->rssi_pkt_dbm, + .snr_db = pkt->snr_pkt_db, + .want_ack = want_ack, + .want_response = false, + .request_id = 0, + }; + mt_modules_dispatch(&meta, decrypted, payload_len); + +#if !MESH_HEADLESS + { + uint8_t mp[320]; + uint16_t mp_len = 0; + mp_len += enc_field_fixed32(&mp[mp_len], 1, hdr.from); + mp_len += enc_field_fixed32(&mp[mp_len], 2, hdr.to); + mp_len += enc_field_varint(&mp[mp_len], 3, hdr.channel); + mp_len += enc_field_bytes(&mp[mp_len], 4, decrypted, payload_len); + mp_len += enc_field_fixed32(&mp[mp_len], 6, hdr.id); + + uint32_t now_unix = 1776192000UL + (uint32_t)(xTaskGetTickCount() * portTICK_PERIOD_MS / 1000); + mp_len += enc_field_fixed32(&mp[mp_len], 7, now_unix); + + float snr_f = (float)pkt->snr_pkt_db; + mp[mp_len++] = (8 << 3) | 5; + memcpy(&mp[mp_len], &snr_f, 4); + mp_len += 4; + + mp_len += enc_field_varint(&mp[mp_len], 9, hop_limit); + mp_len += enc_field_varint(&mp[mp_len], 10, want_ack ? 1 : 0); + mp_len += enc_field_varint(&mp[mp_len], 12, (uint64_t)(int64_t)pkt->rssi_pkt_dbm); + mp_len += enc_field_varint(&mp[mp_len], 15, hop_start); + + if (pki_decrypted) { + const mt_node_entry_t *sender = mt_nodedb_get(hdr.from); + if (sender != NULL && sender->has_public_key) { + mp_len += enc_field_bytes(&mp[mp_len], 16, sender->public_key, MT_NODEDB_PUBKEY_LEN); + } + mp_len += enc_field_varint(&mp[mp_len], 17, 1); + } + + phoneapi_push_packet(mp, mp_len); + ESP_LOGI(TAG, "RX -> phoneapi: %d bytes MeshPacket%s", mp_len, pki_decrypted ? " [PKI]" : ""); + } +#else + ESP_LOGI(TAG, + "RX (headless): from=0x%08lX, %d bytes decodificados", + (unsigned long)hdr.from, + payload_len); +#endif + + mt_role_t my_role = mt_role_current(); + mt_rebr_mode_t my_mode = mt_rebr_mode_current(); + + uint32_t portnum_hint = 0; + if (payload_len >= 2 && decrypted[0] == 0x08) { + uint16_t vb = 0; + uint64_t v = 0, shift = 0; + for (int k = 1; k < 5 && k < payload_len; k++) { + v |= ((uint64_t)(decrypted[k] & 0x7F)) << shift; + vb++; + if (!(decrypted[k] & 0x80)) + break; + shift += 7; + } + (void)vb; + portnum_hint = (uint32_t)v; + } + + bool is_rebroadcaster = mt_role_is_rebroadcaster(my_role); + bool mode_allows = mt_rebr_should_forward(my_mode, portnum_hint, true); + + uint8_t our_byte = (uint8_t)(s_node_num & 0xFF); + bool is_broadcast_rebr = (hdr.to == 0xFFFFFFFF); + bool is_unicast_relay = (hdr.to != 0xFFFFFFFF && hdr.to != s_node_num); + bool unicast_gate_ok = !is_unicast_relay || hdr.next_hop == 0 || hdr.next_hop == our_byte; + + if ((is_broadcast_rebr || is_unicast_relay) && unicast_gate_ok && hop_limit > 0 && + is_rebroadcaster && mode_allows) { + uint8_t new_flags = (hdr.flags & ~MT_HOP_LIMIT_MASK) | ((hop_limit - 1) & MT_HOP_LIMIT_MASK); + + uint8_t rebroadcast[256]; + mesh_packet_header_t new_hdr = hdr; + new_hdr.flags = new_flags; + new_hdr.relay_node = our_byte; + memcpy(rebroadcast, &new_hdr, MT_HEADER_SIZE); + + uint16_t src_len = pkt->len - MT_HEADER_SIZE; + memcpy(rebroadcast + MT_HEADER_SIZE, pkt->buf + MT_HEADER_SIZE, src_len); + + if (is_broadcast_rebr && tx_queue_pending() > 0) { + ESP_LOGI(TAG, "Rebroadcast skipped: own TX pending in queue"); + } else { + uint32_t backoff; + if (mt_role_is_late_rebroadcaster(my_role)) { + backoff = 300 + (esp_random() % 1200); + } else if (is_broadcast_rebr) { + backoff = 2000 + (esp_random() % 3000); + } else { + backoff = 200 + (esp_random() % 600); + } + + uint16_t total = MT_HEADER_SIZE + src_len; + if (tx_queue_push(rebroadcast, total, MESH_PRIO_DEFAULT, backoff)) { + ESP_LOGI(TAG, + "%s enqueued: hop %d->%d, delay %lu ms%s", + is_broadcast_rebr ? "Rebroadcast" : "Unicast relay", + hop_limit, + hop_limit - 1, + (unsigned long)backoff, + (is_unicast_relay && hdr.next_hop == our_byte) ? " [NextHop]" : ""); + } + } + } +} + +static uint32_t s_tx_pkt_id = 0; + +static uint16_t build_wire_packet(uint8_t *out, + uint32_t to, + uint8_t channel, + uint8_t hop_limit, + const uint8_t *payload, + uint16_t payload_len, + uint32_t *out_pkt_id, + const uint8_t *peer_pubkey) { + uint16_t cipher_len = peer_pubkey ? payload_len + MT_PKI_OVERHEAD : payload_len; + if (cipher_len > MT_MAX_PAYLOAD) + return 0; + + if (s_tx_pkt_id == 0) + s_tx_pkt_id = esp_random(); + uint32_t pkt_id = s_tx_pkt_id++; + if (out_pkt_id) + *out_pkt_id = pkt_id; + + mesh_packet_header_t hdr = {0}; + hdr.from = s_node_num; + hdr.to = to; + hdr.id = pkt_id; + hdr.flags = + (hop_limit & MT_HOP_LIMIT_MASK) | ((hop_limit << MT_HOP_START_SHIFT) & MT_HOP_START_MASK); + hdr.channel = peer_pubkey ? 0 : channel; + hdr.relay_node = (uint8_t)(s_node_num & 0xFF); + + if (to != 0xFFFFFFFF && to != s_node_num) { + hdr.next_hop = mt_nodedb_get_next_hop(to); + } + + uint8_t encrypted[MT_MAX_PAYLOAD]; + if (peer_pubkey) { + if (!mt_pki_encrypt_curve25519( + peer_pubkey, s_node_num, pkt_id, payload, payload_len, encrypted)) { + ESP_LOGW(TAG, "PKI encrypt failed, aborting tx"); + return 0; + } + } else { + memcpy(encrypted, payload, payload_len); + mesh_crypt(s_node_num, pkt_id, encrypted, payload_len); + } + + memcpy(out, &hdr, MT_HEADER_SIZE); + memcpy(out + MT_HEADER_SIZE, encrypted, cipher_len); + return MT_HEADER_SIZE + cipher_len; +} + +esp_err_t meshtastic_mesh_send_nodeinfo(void) { + uint8_t user[64]; + uint16_t u_len = 0; + + char id_str[16]; + snprintf(id_str, sizeof(id_str), "!%08lx", (unsigned long)s_node_num); + u_len += enc_field_bytes(&user[u_len], 1, (const uint8_t *)id_str, (uint16_t)strlen(id_str)); + +#if MESH_HEADLESS + const char *long_name = "Highboy P4"; + const char *short_name = "HBP4"; +#else + const char *long_name = "Highboy S3"; + const char *short_name = "HBS3"; +#endif + u_len += + enc_field_bytes(&user[u_len], 2, (const uint8_t *)long_name, (uint16_t)strlen(long_name)); + u_len += + enc_field_bytes(&user[u_len], 3, (const uint8_t *)short_name, (uint16_t)strlen(short_name)); + u_len += enc_field_varint(&user[u_len], 5, 255); + + uint8_t data[96]; + uint16_t d_len = 0; + d_len += enc_field_varint(&data[d_len], 1, 4); + d_len += enc_field_bytes(&data[d_len], 2, user, u_len); + + uint8_t wire[256]; + uint32_t pkt_id; + uint16_t wire_len = build_wire_packet(wire, 0xFFFFFFFF, 0, 3, data, d_len, &pkt_id, NULL); + if (wire_len == 0) + return ESP_ERR_INVALID_ARG; + + dedup_add(s_node_num, pkt_id); + + ESP_LOGI( + TAG, "NodeInfo enqueued: %s (%s) id=0x%08lX", long_name, short_name, (unsigned long)pkt_id); + return tx_queue_push(wire, wire_len, MESH_PRIO_DEFAULT, 0) ? ESP_OK : ESP_FAIL; +} + +esp_err_t meshtastic_mesh_send_text(const char *text, uint32_t to) { + uint16_t text_len = (uint16_t)strlen(text); + if (text_len > 200) + text_len = 200; + + uint8_t data[220]; + uint16_t d_len = 0; + d_len += enc_field_varint(&data[d_len], 1, 1); + d_len += enc_field_bytes(&data[d_len], 2, (const uint8_t *)text, text_len); + + const uint8_t *peer_pub = NULL; + if (to != 0xFFFFFFFF && to != s_node_num) { + const mt_node_entry_t *e = mt_nodedb_get(to); + if (e && e->has_public_key) + peer_pub = e->public_key; + } + + uint8_t wire[256]; + uint32_t pkt_id; + uint16_t wire_len = build_wire_packet(wire, to, 0, 3, data, d_len, &pkt_id, peer_pub); + if (wire_len == 0) + return ESP_ERR_INVALID_ARG; + + dedup_add(s_node_num, pkt_id); + + ESP_LOGI(TAG, + "Text enqueued: \"%s\" -> 0x%08lX id=0x%08lX%s", + text, + (unsigned long)to, + (unsigned long)pkt_id, + peer_pub ? " [PKI]" : ""); + return tx_queue_push(wire, wire_len, MESH_PRIO_HIGH, 0) ? ESP_OK : ESP_FAIL; +} + +static uint64_t dec_varint(const uint8_t *buf, uint16_t maxlen, uint16_t *consumed) { + uint64_t val = 0; + uint16_t shift = 0; + uint16_t i = 0; + while (i < maxlen && i < 10) { + uint8_t b = buf[i++]; + val |= ((uint64_t)(b & 0x7F)) << shift; + if (!(b & 0x80)) + break; + shift += 7; + } + if (consumed) + *consumed = i; + return val; +} + +static inline uint32_t rd_fixed32(const uint8_t *p) { + return (uint32_t)p[0] | ((uint32_t)p[1] << 8) | ((uint32_t)p[2] << 16) | ((uint32_t)p[3] << 24); +} + +static uint8_t priority_for_portnum(uint32_t portnum) { + switch (portnum) { + case 5: + return MESH_PRIO_ACK; + case 11: + return MESH_PRIO_ALERT; + case 6: + return MESH_PRIO_HIGH; + case 1: + return MESH_PRIO_HIGH; + case 7: + return MESH_PRIO_HIGH; + case 4: + return MESH_PRIO_DEFAULT; + case 3: + return MESH_PRIO_BACKGROUND; + case 67: + return MESH_PRIO_BACKGROUND; + case 70: + return MESH_PRIO_DEFAULT; + case 71: + return MESH_PRIO_BACKGROUND; + default: + return MESH_PRIO_DEFAULT; + } +} + +esp_err_t meshtastic_mesh_send_data(uint32_t to, + uint8_t channel, + uint8_t hop_limit, + uint8_t portnum, + const uint8_t *payload, + uint16_t plen, + uint32_t request_id, + bool want_ack, + bool want_response) { + if (plen > 200) + return ESP_ERR_INVALID_SIZE; + + uint8_t data[220]; + uint16_t d_len = 0; + d_len += enc_field_varint(&data[d_len], 1, portnum); + d_len += enc_field_bytes(&data[d_len], 2, payload, plen); + if (want_response) { + d_len += enc_field_varint(&data[d_len], 3, 1); + } + if (request_id != 0) { + d_len += enc_field_fixed32(&data[d_len], 6, request_id); + } + (void)want_ack; + +#if !MESH_HEADLESS + if (to == s_node_num || to == 0) { + uint8_t mp[320]; + uint16_t mp_len = 0; + uint32_t local_id = esp_random(); + mp_len += enc_field_fixed32(&mp[mp_len], 1, s_node_num); + mp_len += enc_field_fixed32(&mp[mp_len], 2, s_node_num); + mp_len += enc_field_varint(&mp[mp_len], 3, channel); + mp_len += enc_field_bytes(&mp[mp_len], 4, data, d_len); + mp_len += enc_field_fixed32(&mp[mp_len], 6, local_id); + phoneapi_push_packet(mp, mp_len); + ESP_LOGI(TAG, "send_data local: port=%u to=self -> phoneapi (%u bytes)", portnum, mp_len); + return ESP_OK; + } +#endif + + const uint8_t *peer_pub = NULL; + if (to != 0xFFFFFFFF && to != s_node_num && portnum != MT_PORT_ROUTING && + portnum != MT_PORT_NODEINFO && portnum != MT_PORT_POSITION && portnum != MT_PORT_TRACEROUTE) { + const mt_node_entry_t *e = mt_nodedb_get(to); + if (e && e->has_public_key) + peer_pub = e->public_key; + } + + uint8_t wire[256]; + uint32_t pkt_id; + uint16_t wire_len = + build_wire_packet(wire, to, channel, hop_limit, data, d_len, &pkt_id, peer_pub); + if (wire_len == 0) + return ESP_ERR_INVALID_ARG; + + if (want_ack) { + wire[12] |= MT_WANT_ACK_MASK; + } + + dedup_add(s_node_num, pkt_id); + + uint8_t prio; + switch (portnum) { + case 5: + prio = MESH_PRIO_ACK; + break; + case 11: + prio = MESH_PRIO_ALERT; + break; + case 6: + case 1: + case 7: + prio = MESH_PRIO_HIGH; + break; + case 4: + prio = MESH_PRIO_DEFAULT; + break; + default: + prio = MESH_PRIO_BACKGROUND; + } + + if (want_ack && to != 0xFFFFFFFF && to != s_node_num) { + retry_track(pkt_id, to, channel, hop_limit, wire, wire_len); + } + + ESP_LOGI(TAG, + "send_data: port=%u to=0x%08lX ch=%u prio=%u len=%u req=0x%08lX%s%s", + portnum, + (unsigned long)to, + channel, + prio, + wire_len, + (unsigned long)request_id, + want_ack ? " want_ack" : "", + peer_pub ? " [PKI]" : ""); + +#if !MESH_HEADLESS + if (to == 0xFFFFFFFF) { + uint8_t mp[320]; + uint16_t mp_len = 0; + mp_len += enc_field_fixed32(&mp[mp_len], 1, s_node_num); + mp_len += enc_field_fixed32(&mp[mp_len], 2, to); + mp_len += enc_field_varint(&mp[mp_len], 3, channel); + mp_len += enc_field_bytes(&mp[mp_len], 4, data, d_len); + mp_len += enc_field_fixed32(&mp[mp_len], 6, pkt_id); + uint32_t now_unix = 1776000000UL + (uint32_t)(xTaskGetTickCount() * portTICK_PERIOD_MS / 1000); + mp_len += enc_field_fixed32(&mp[mp_len], 7, now_unix); + mp_len += enc_field_varint(&mp[mp_len], 9, hop_limit); + mp_len += enc_field_varint(&mp[mp_len], 15, hop_limit); + phoneapi_push_packet(mp, mp_len); + ESP_LOGI(TAG, "send_data: copia local enviada ao phoneapi (%u bytes)", mp_len); + } +#endif + + return tx_queue_push(wire, wire_len, prio, 0) ? ESP_OK : ESP_FAIL; +} + +esp_err_t meshtastic_mesh_send(const uint8_t *mp_data, uint16_t mp_len) { + if (!mp_data || mp_len == 0) + return ESP_ERR_INVALID_ARG; + + uint32_t to = 0xFFFFFFFF; + uint32_t from = s_node_num; + uint32_t pkt_id = 0; + uint8_t channel = 0; + uint8_t hop_limit = 3; + bool want_ack = false; + const uint8_t *decoded_ptr = NULL; + uint16_t decoded_len = 0; + const uint8_t *encrypted_ptr = NULL; + uint16_t encrypted_len = 0; + uint32_t portnum_hint = 0; + + uint16_t i = 0; + while (i < mp_len) { + uint16_t vb = 0; + uint64_t tag = dec_varint(&mp_data[i], mp_len - i, &vb); + if (vb == 0) + break; + i += vb; + + uint32_t field = (uint32_t)(tag >> 3); + uint32_t wt = (uint32_t)(tag & 0x07); + + if (wt == 0) { + uint16_t cb = 0; + uint64_t v = dec_varint(&mp_data[i], mp_len - i, &cb); + i += cb; + switch (field) { + case 3: + channel = (uint8_t)v; + break; + case 9: + hop_limit = (uint8_t)(v & 0x07); + break; + case 10: + want_ack = !!v; + break; + default: + break; + } + } else if (wt == 2) { + uint16_t lb = 0; + uint32_t L = (uint32_t)dec_varint(&mp_data[i], mp_len - i, &lb); + i += lb; + if (i + L > mp_len) { + break; + } + if (field == 4) { + decoded_ptr = &mp_data[i]; + decoded_len = (uint16_t)L; + + if (decoded_len >= 2 && decoded_ptr[0] == 0x08) { + uint16_t pvb = 0; + portnum_hint = (uint32_t)dec_varint(&decoded_ptr[1], decoded_len - 1, &pvb); + } + } else if (field == 8) { + encrypted_ptr = &mp_data[i]; + encrypted_len = (uint16_t)L; + } + i += L; + } else if (wt == 5) { + if (i + 4 > mp_len) + break; + uint32_t v = rd_fixed32(&mp_data[i]); + i += 4; + switch (field) { + case 1: + from = v; + break; + case 2: + to = v; + break; + case 6: + pkt_id = v; + break; + default: + break; + } + } else { + break; + } + } + + if (pkt_id == 0) { + if (s_tx_pkt_id == 0) + s_tx_pkt_id = esp_random(); + pkt_id = s_tx_pkt_id++; + } + + from = s_node_num; + + const uint8_t *payload_src = NULL; + uint16_t payload_len = 0; + bool needs_encrypt = false; + + if (decoded_ptr && decoded_len > 0) { + payload_src = decoded_ptr; + payload_len = decoded_len; + needs_encrypt = true; + } else if (encrypted_ptr && encrypted_len > 0) { + payload_src = encrypted_ptr; + payload_len = encrypted_len; + needs_encrypt = false; + } else { + ESP_LOGW(TAG, "TX app: MeshPacket without decoded nor encrypted (len=%u)", mp_len); + return ESP_ERR_INVALID_ARG; + } + + if (payload_len > MT_MAX_PAYLOAD) { + ESP_LOGW(TAG, "TX app: payload muito grande (%u)", payload_len); + return ESP_ERR_INVALID_SIZE; + } + + if (to == s_node_num && needs_encrypt) { + mt_packet_meta_t meta = { + .from = from, + .to = to, + .id = pkt_id, + .channel = channel, + .hop_limit = hop_limit, + .hop_start = hop_limit, + .rssi_dbm = 0, + .snr_db = 0, + .want_ack = want_ack, + .want_response = false, + .request_id = 0, + }; + ESP_LOGI(TAG, + "TX app local: to=self port=%lu len=%u -> dispatch modules", + (unsigned long)portnum_hint, + payload_len); + mt_modules_dispatch(&meta, payload_src, payload_len); + return ESP_OK; + } + + mesh_packet_header_t hdr = {0}; + hdr.from = from; + hdr.to = to; + hdr.id = pkt_id; + hdr.flags = (hop_limit & MT_HOP_LIMIT_MASK) | (want_ack ? MT_WANT_ACK_MASK : 0) | + ((hop_limit << MT_HOP_START_SHIFT) & MT_HOP_START_MASK); + hdr.channel = channel; + hdr.relay_node = (uint8_t)(s_node_num & 0xFF); + + uint8_t wire[256]; + memcpy(wire, &hdr, MT_HEADER_SIZE); + memcpy(wire + MT_HEADER_SIZE, payload_src, payload_len); + if (needs_encrypt) { + mesh_crypt(from, pkt_id, wire + MT_HEADER_SIZE, payload_len); + } + uint16_t wire_len = MT_HEADER_SIZE + payload_len; + + dedup_add(from, pkt_id); + + uint8_t prio = priority_for_portnum(portnum_hint); + ESP_LOGI(TAG, + "TX app: to=0x%08lX ch=%u hop=%u %s id=0x%08lX prio=%u port=%lu len=%u", + (unsigned long)to, + channel, + hop_limit, + needs_encrypt ? "decoded" : "encrypted", + (unsigned long)pkt_id, + prio, + (unsigned long)portnum_hint, + wire_len); + + return tx_queue_push(wire, wire_len, prio, 0) ? ESP_OK : ESP_FAIL; +} + +static void on_rx_done(const sx1262_packet_t *pkt, void *ctx) { + (void)ctx; + if (pkt == NULL) + return; + if (pkt->has_crc_error || pkt->has_header_error) { + ESP_LOGW(TAG, "RX: erro HW, ignoring"); + + if (s_is_running) + sx1262_receive_continuous(); + return; + } + + process_rx_packet(pkt); + + if (s_is_running) + sx1262_receive_continuous(); +} + +static void on_tx_done(void *ctx) { + (void)ctx; + ESP_LOGD(TAG, "TX done"); +} + +static void on_timeout(void *ctx) { + (void)ctx; + if (s_is_running) + sx1262_receive_continuous(); +} + +static void on_cad_done(bool is_channel_active, void *ctx) { + (void)ctx; + if (s_mesh_task_handle) { + uint32_t bit = is_channel_active ? CAD_NOTIFY_BUSY : CAD_NOTIFY_CLEAR; + xTaskNotify(s_mesh_task_handle, bit, eSetBits); + } +} + +static int csma_cad_check(void) { + xTaskNotifyStateClear(NULL); + ulTaskNotifyValueClear(NULL, UINT32_MAX); + + esp_err_t rc = sx1262_cad_start(); + if (rc != ESP_OK) { + ESP_LOGW(TAG, "CAD start failed: %s", esp_err_to_name(rc)); + return -1; + } + + uint32_t notify = 0; + BaseType_t got = xTaskNotifyWait( + 0, CAD_NOTIFY_BUSY | CAD_NOTIFY_CLEAR, ¬ify, pdMS_TO_TICKS(CAD_TIMEOUT_MS)); + if (got != pdTRUE) { + ESP_LOGD(TAG, "CAD timeout"); + return -1; + } + if (notify & CAD_NOTIFY_BUSY) + return 1; + if (notify & CAD_NOTIFY_CLEAR) + return 0; + return -1; +} + +static void mesh_task(void *arg) { + (void)arg; + ESP_LOGI(TAG, + "Mesh task started (CSMA with jitter %dms + CAD %d retries)", + CSMA_PRE_TX_JITTER_MS, + CSMA_MAX_RETRIES); + + while (s_is_running) { + uint32_t now = (uint32_t)(xTaskGetTickCount() * portTICK_PERIOD_MS); + mesh_tx_entry_t tx; + if (tx_queue_pop_highest(&tx, now)) { + bool tx_ok = false; + + uint32_t pre_jitter = esp_random() % CSMA_PRE_TX_JITTER_MS; + if (pre_jitter > 0) + vTaskDelay(pdMS_TO_TICKS(pre_jitter)); + + sx1262_stop_rx(); + + bool channel_clear = false; + bool cad_failed = false; + for (int attempt = 0; attempt < CSMA_MAX_RETRIES; attempt++) { + int cad = csma_cad_check(); + if (cad == 0) { + channel_clear = true; + break; + } + if (cad < 0) { + cad_failed = true; + break; + } + uint32_t backoff_ms = + CSMA_BACKOFF_BASE_MS * (1U << attempt) + (esp_random() % CSMA_BACKOFF_JITTER_MS); + ESP_LOGD(TAG, + "CSMA: channel busy (attempt=%d), backoff %lums", + attempt, + (unsigned long)backoff_ms); + vTaskDelay(pdMS_TO_TICKS(backoff_ms)); + } + + const char *tx_mode = channel_clear ? " LBT" : (cad_failed ? "" : " (forced)"); + (void)tx_mode; + + esp_err_t rc = sx1262_transmit(tx.buf, (uint8_t)tx.len, 5000); + if (rc != ESP_OK) { + ESP_LOGW(TAG, "TX failed: %s (prio=%d)", esp_err_to_name(rc), tx.priority); + } else { + ESP_LOGI(TAG, + "TX: %d bytes prio=%d jit=%lums%s", + tx.len, + tx.priority, + (unsigned long)pre_jitter, + channel_clear ? " LBT" : ""); + tx_ok = true; + } + + for (int i = 0; i < 500; i++) { + sx1262_process_irq(); + if (sx1262_get_state() == SX1262_STATE_STDBY_RC) + break; + vTaskDelay(1); + } + + if (!tx_ok) { + ESP_LOGW(TAG, "TX gave up (prio=%d len=%d)", tx.priority, tx.len); + } + + sx1262_receive_continuous(); + } + + retry_tick((uint32_t)(xTaskGetTickCount() * portTICK_PERIOD_MS)); + + vTaskDelay(pdMS_TO_TICKS(10)); + } + + ESP_LOGI(TAG, "Mesh task finished"); + s_mesh_task_handle = NULL; + vTaskDelete(NULL); +} + +esp_err_t meshtastic_mesh_init(uint32_t node_num) { + s_node_num = node_num; + mt_pkt_history_init(); + mt_channels_init(); + + memset(s_tx_queue, 0, sizeof(s_tx_queue)); + if (s_tx_mutex == NULL) { + s_tx_mutex = xSemaphoreCreateMutex(); + if (s_tx_mutex == NULL) + return ESP_ERR_NO_MEM; + } + if (s_retry_mutex == NULL) { + s_retry_mutex = xSemaphoreCreateMutex(); + if (s_retry_mutex == NULL) + return ESP_ERR_NO_MEM; + } + memset(s_retry, 0, sizeof(s_retry)); + + ESP_LOGI(TAG, + "Mesh init: node=0x%08lX, PSK=default AES-128, queue=%d slots, retry=%d slots", + (unsigned long)node_num, + MESH_TX_QUEUE_SIZE, + MESH_RETRY_SLOTS); + return ESP_OK; +} + +esp_err_t meshtastic_mesh_start(void) { + if (s_is_running) + return ESP_ERR_INVALID_STATE; + + sx1262_callbacks_t cbs = { + .on_rx_done = on_rx_done, + .on_tx_done = on_tx_done, + .on_timeout = on_timeout, + .on_cad_done = on_cad_done, + .on_error = NULL, + .cb_ctx = NULL, + }; + sx1262_set_callbacks(&cbs); + + esp_err_t ret = sx1262_receive_continuous(); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "RX continuous failed: %s", esp_err_to_name(ret)); + return ret; + } + + s_is_running = true; + + BaseType_t ok = + xTaskCreate(mesh_task, "mesh_tx", 4096, NULL, tskIDLE_PRIORITY + 3, &s_mesh_task_handle); + if (ok != pdPASS) { + s_is_running = false; + ESP_LOGE(TAG, "Failed to create mesh task"); + return ESP_ERR_NO_MEM; + } + + ESP_LOGI(TAG, "Mesh start: RX continuous + TX task active"); + return ESP_OK; +} + +void meshtastic_mesh_stop(void) { + if (!s_is_running) + return; + s_is_running = false; + sx1262_stop_rx(); + + ESP_LOGI(TAG, "Mesh stop requested"); +} + +void meshtastic_mesh_poll(void) { + if (s_is_running) { + sx1262_process_irq(); + } +} diff --git a/firmware_p4/components/Applications/LoRa/meshtastic/meshtastic_mqtt.c b/firmware_p4/components/Applications/LoRa/meshtastic/meshtastic_mqtt.c new file mode 100644 index 00000000..ea8feaed --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/meshtastic/meshtastic_mqtt.c @@ -0,0 +1,94 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 + +#include "meshtastic_mqtt.h" + +#include +#include + +#include "esp_log.h" +#include "mqtt_client.h" + +static const char *TAG = "MT_MQTT"; + +#define MT_MQTT_REGION_DEFAULT "US" + +static esp_mqtt_client_handle_t s_client = NULL; +static bool s_connected = false; +static char s_region[8] = MT_MQTT_REGION_DEFAULT; + +static void +mqtt_event_handler(void *handler_args, esp_event_base_t base, int32_t event_id, void *event_data) { + (void)handler_args; + (void)base; + (void)event_data; + switch ((esp_mqtt_event_id_t)event_id) { + case MQTT_EVENT_CONNECTED: + s_connected = true; + ESP_LOGI(TAG, "MQTT connected"); + break; + case MQTT_EVENT_DISCONNECTED: + s_connected = false; + ESP_LOGW(TAG, "MQTT disconnected"); + break; + case MQTT_EVENT_ERROR: + ESP_LOGW(TAG, "MQTT error"); + break; + default: + break; + } +} + +esp_err_t meshtastic_mqtt_init(const char *broker_uri, const char *username, const char *password) { + if (s_client != NULL) + return ESP_OK; + + esp_mqtt_client_config_t cfg = { + .broker.address.uri = broker_uri, + .credentials.username = username, + .credentials.authentication.password = password, + .network.timeout_ms = 10000, + .network.reconnect_timeout_ms = 15000, + .session.keepalive = 60, + }; + s_client = esp_mqtt_client_init(&cfg); + if (s_client == NULL) + return ESP_FAIL; + + esp_mqtt_client_register_event(s_client, MQTT_EVENT_ANY, mqtt_event_handler, NULL); + esp_err_t rc = esp_mqtt_client_start(s_client); + if (rc != ESP_OK) { + ESP_LOGE(TAG, "start failed: %s", esp_err_to_name(rc)); + return rc; + } + ESP_LOGI(TAG, "MQTT client started (broker=%s)", broker_uri); + return ESP_OK; +} + +void meshtastic_mqtt_publish(const uint8_t *meshpacket_pb, uint16_t len, const char *channel_name) { + if (!s_connected || s_client == NULL) + return; + + char topic[80]; + snprintf(topic, + sizeof(topic), + "msh/%s/2/e/%s/broadcast", + s_region, + channel_name ? channel_name : "LongFast"); + + int msg_id = esp_mqtt_client_publish(s_client, topic, (const char *)meshpacket_pb, len, 0, 0); + if (msg_id < 0) { + ESP_LOGW(TAG, "publish failed"); + } else { + ESP_LOGD(TAG, "publish %s (%u bytes)", topic, len); + } +} + +bool meshtastic_mqtt_is_connected(void) { + return s_connected; +} diff --git a/firmware_p4/components/Applications/LoRa/meshtastic/meshtastic_nodedb.c b/firmware_p4/components/Applications/LoRa/meshtastic/meshtastic_nodedb.c new file mode 100644 index 00000000..c1cd0276 --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/meshtastic/meshtastic_nodedb.c @@ -0,0 +1,347 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#include "meshtastic_nodedb.h" + +#include +#include + +#include "esp_log.h" +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" + +#include "meshtastic_nvs.h" + +static const char *TAG = "MT_NODEDB"; + +#define MT_NODEDB_NVS_KEY "nodedb" + +static mt_node_entry_t s_nodes[MT_NODEDB_MAX_NODES]; +static uint16_t s_count = 0; + +static uint64_t dec_varint(const uint8_t *buf, uint16_t max_len, uint16_t *out_used) { + uint64_t value = 0; + uint16_t shift = 0; + uint16_t i = 0; + while (i < max_len && i < 10) { + uint8_t byte = buf[i++]; + value |= ((uint64_t)(byte & 0x7F)) << shift; + if (!(byte & 0x80)) + break; + shift += 7; + } + if (out_used != NULL) + *out_used = i; + return value; +} + +static int find_slot(uint32_t num) { + for (int i = 0; i < MT_NODEDB_MAX_NODES; i++) { + if (s_nodes[i].in_use && s_nodes[i].num == num) + return i; + } + return -1; +} + +static int alloc_slot(uint32_t num) { + int existing = find_slot(num); + if (existing >= 0) + return existing; + + int empty = -1; + for (int i = 0; i < MT_NODEDB_MAX_NODES; i++) { + if (!s_nodes[i].in_use) { + empty = i; + break; + } + } + if (empty >= 0) { + memset(&s_nodes[empty], 0, sizeof(mt_node_entry_t)); + s_nodes[empty].num = num; + s_nodes[empty].in_use = true; + s_count++; + return empty; + } + + int victim = -1; + uint32_t oldest = UINT32_MAX; + for (int i = 0; i < MT_NODEDB_MAX_NODES; i++) { + if (s_nodes[i].is_favorite) + continue; + if (s_nodes[i].last_heard < oldest) { + oldest = s_nodes[i].last_heard; + victim = i; + } + } + if (victim < 0) + return -1; + + ESP_LOGW(TAG, + "DB full, evicting 0x%08lX (last_heard=%lu) to allocate 0x%08lX", + (unsigned long)s_nodes[victim].num, + (unsigned long)s_nodes[victim].last_heard, + (unsigned long)num); + memset(&s_nodes[victim], 0, sizeof(mt_node_entry_t)); + s_nodes[victim].num = num; + s_nodes[victim].in_use = true; + return victim; +} + +static void parse_user_into(mt_node_entry_t *e, const uint8_t *buf, uint16_t len) { + uint16_t i = 0; + while (i < len) { + uint16_t used = 0; + uint64_t tag = dec_varint(&buf[i], len - i, &used); + if (used == 0) + break; + i += used; + uint32_t field = (uint32_t)(tag >> 3); + uint32_t wire_type = (uint32_t)(tag & 0x07); + + if (wire_type == 2) { + uint16_t lused = 0; + uint32_t length = (uint32_t)dec_varint(&buf[i], len - i, &lused); + i += lused; + if (i + length > len) + break; + + uint32_t copy; + switch (field) { + case 1: + copy = length < sizeof(e->id) - 1 ? length : sizeof(e->id) - 1; + memcpy(e->id, &buf[i], copy); + e->id[copy] = 0; + break; + case 2: + copy = length < sizeof(e->long_name) - 1 ? length : sizeof(e->long_name) - 1; + memcpy(e->long_name, &buf[i], copy); + e->long_name[copy] = 0; + break; + case 3: + copy = length < sizeof(e->short_name) - 1 ? length : sizeof(e->short_name) - 1; + memcpy(e->short_name, &buf[i], copy); + e->short_name[copy] = 0; + break; + case 8: + if (length == MT_NODEDB_PUBKEY_LEN) { + memcpy(e->public_key, &buf[i], MT_NODEDB_PUBKEY_LEN); + bool all_zero = true; + for (int k = 0; k < MT_NODEDB_PUBKEY_LEN; k++) { + if (e->public_key[k] != 0) { + all_zero = false; + break; + } + } + e->has_public_key = !all_zero; + } + break; + default: + break; + } + i += length; + } else if (wire_type == 0) { + uint16_t vused = 0; + uint64_t value = dec_varint(&buf[i], len - i, &vused); + i += vused; + switch (field) { + case 5: + e->hw_model = (uint8_t)value; + break; + case 7: + e->role = (uint8_t)value; + break; + default: + break; + } + } else if (wire_type == 5) { + i += 4; + } else { + break; + } + } +} + +esp_err_t mt_nodedb_init(void) { + memset(s_nodes, 0, sizeof(s_nodes)); + s_count = 0; + + int n = mt_nvs_get_blob(MT_NODEDB_NVS_KEY, s_nodes, sizeof(s_nodes)); + if (n == (int)sizeof(s_nodes)) { + for (int i = 0; i < MT_NODEDB_MAX_NODES; i++) { + if (s_nodes[i].in_use) + s_count++; + } + ESP_LOGI(TAG, "Loaded %u entries from NVS", s_count); + } else { + if (n > 0) { + ESP_LOGW( + TAG, "NVS blob size mismatch (%d != %u), reinitializing", n, (unsigned)sizeof(s_nodes)); + memset(s_nodes, 0, sizeof(s_nodes)); + } else { + ESP_LOGI(TAG, "NVS empty - starting clean DB"); + } + } + return ESP_OK; +} + +bool mt_nodedb_upsert_from_user(uint32_t num, + const uint8_t *user_bytes, + uint16_t user_len, + float snr, + int16_t rssi, + uint8_t hops_away) { + int idx = alloc_slot(num); + if (idx < 0) + return false; + + mt_node_entry_t *e = &s_nodes[idx]; + bool is_new = (e->long_name[0] == 0); + + parse_user_into(e, user_bytes, user_len); + + if (e->id[0] == 0) { + snprintf(e->id, sizeof(e->id), "!%08lx", (unsigned long)num); + } + + e->snr = snr; + e->rssi = rssi; + e->hops_away = hops_away; + e->last_heard = (uint32_t)(xTaskGetTickCount() * portTICK_PERIOD_MS / 1000); + + if (is_new) { + ESP_LOGI(TAG, + "New peer 0x%08lX '%s' (%s) hw=%u role=%u", + (unsigned long)num, + e->long_name, + e->short_name, + e->hw_model, + e->role); + } + return true; +} + +const mt_node_entry_t *mt_nodedb_get(uint32_t num) { + int idx = find_slot(num); + return (idx >= 0) ? &s_nodes[idx] : NULL; +} + +const mt_node_entry_t *mt_nodedb_get_by_index(uint16_t idx) { + uint16_t counted = 0; + for (int i = 0; i < MT_NODEDB_MAX_NODES; i++) { + if (!s_nodes[i].in_use) + continue; + if (counted == idx) + return &s_nodes[i]; + counted++; + } + return NULL; +} + +uint16_t mt_nodedb_count(void) { + return s_count; +} + +bool mt_nodedb_set_favorite(uint32_t num, bool fav) { + int idx = find_slot(num); + if (idx < 0) + return false; + if (s_nodes[idx].is_favorite == fav) + return true; + s_nodes[idx].is_favorite = fav; + ESP_LOGI(TAG, "favorite 0x%08lX = %s", (unsigned long)num, fav ? "yes" : "no"); + mt_nodedb_save(); + return true; +} + +bool mt_nodedb_set_ignored(uint32_t num, bool ign) { + int idx = find_slot(num); + if (idx < 0) + return false; + if (s_nodes[idx].is_ignored == ign) + return true; + s_nodes[idx].is_ignored = ign; + ESP_LOGI(TAG, "ignored 0x%08lX = %s", (unsigned long)num, ign ? "yes" : "no"); + mt_nodedb_save(); + return true; +} + +bool mt_nodedb_toggle_muted(uint32_t num) { + int idx = find_slot(num); + if (idx < 0) + return false; + s_nodes[idx].is_muted = !s_nodes[idx].is_muted; + ESP_LOGI(TAG, "muted 0x%08lX = %s", (unsigned long)num, s_nodes[idx].is_muted ? "yes" : "no"); + mt_nodedb_save(); + return true; +} + +void mt_nodedb_learn_next_hop(uint32_t num, uint8_t relay_byte) { + if (relay_byte == 0) + return; + int idx = find_slot(num); + if (idx < 0) + return; + if (s_nodes[idx].next_hop != relay_byte) { + ESP_LOGI(TAG, + "next_hop 0x%08lX -> 0x%02x (was 0x%02x)", + (unsigned long)num, + relay_byte, + s_nodes[idx].next_hop); + s_nodes[idx].next_hop = relay_byte; + } + s_nodes[idx].next_hop_failures = 0; +} + +uint8_t mt_nodedb_get_next_hop(uint32_t num) { + int idx = find_slot(num); + if (idx < 0) + return 0; + return s_nodes[idx].next_hop; +} + +void mt_nodedb_record_next_hop_failure(uint32_t num) { + int idx = find_slot(num); + if (idx < 0) + return; + s_nodes[idx].next_hop_failures++; + if (s_nodes[idx].next_hop_failures >= MT_NODEDB_NEXTHOP_MAX_FAILURES) { + ESP_LOGW(TAG, + "next_hop 0x%02x for 0x%08lX failed %u times - clearing (fallback to flood)", + s_nodes[idx].next_hop, + (unsigned long)num, + s_nodes[idx].next_hop_failures); + s_nodes[idx].next_hop = 0; + s_nodes[idx].next_hop_failures = 0; + } +} + +bool mt_nodedb_remove(uint32_t num) { + int idx = find_slot(num); + if (idx < 0) + return false; + memset(&s_nodes[idx], 0, sizeof(mt_node_entry_t)); + s_count--; + ESP_LOGI(TAG, "removed 0x%08lX", (unsigned long)num); + mt_nodedb_save(); + return true; +} + +esp_err_t mt_nodedb_save(void) { + esp_err_t ret = mt_nvs_set_blob(MT_NODEDB_NVS_KEY, s_nodes, sizeof(s_nodes)); + if (ret != ESP_OK) { + ESP_LOGW(TAG, "save failed: %s", esp_err_to_name(ret)); + } + return ret; +} diff --git a/firmware_p4/components/Applications/LoRa/meshtastic/meshtastic_nvs.c b/firmware_p4/components/Applications/LoRa/meshtastic/meshtastic_nvs.c new file mode 100644 index 00000000..f04065fd --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/meshtastic/meshtastic_nvs.c @@ -0,0 +1,130 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#include "meshtastic_nvs.h" + +#include + +#include "esp_log.h" +#include "nvs_flash.h" +#include "nvs.h" + +static const char *TAG = "MESHTASTIC_NVS"; + +#define MT_NVS_NAMESPACE "meshtastic" +#define MT_NVS_VER_KEY "_ver" + +static nvs_handle_t s_handle = 0; +static bool s_is_inited = false; + +esp_err_t mt_nvs_init(void) { + if (s_is_inited) + return ESP_OK; + + esp_err_t ret = nvs_flash_init(); + if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) { + ESP_LOGW(TAG, "NVS corrupt, erasing partition"); + nvs_flash_erase(); + ret = nvs_flash_init(); + } + if (ret != ESP_OK) { + ESP_LOGE(TAG, "nvs_flash_init failed: %s", esp_err_to_name(ret)); + return ret; + } + + ret = nvs_open(MT_NVS_NAMESPACE, NVS_READWRITE, &s_handle); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "nvs_open failed: %s", esp_err_to_name(ret)); + return ret; + } + + uint32_t stored_ver = 0; + nvs_get_u32(s_handle, MT_NVS_VER_KEY, &stored_ver); + if (stored_ver != MT_NVS_VERSION) { + ESP_LOGW(TAG, + "Schema version %lu -> %d, wiping namespace", + (unsigned long)stored_ver, + MT_NVS_VERSION); + nvs_erase_all(s_handle); + nvs_set_u32(s_handle, MT_NVS_VER_KEY, MT_NVS_VERSION); + nvs_commit(s_handle); + } + + s_is_inited = true; + ESP_LOGI(TAG, "Initialized - namespace='%s', version=%d", MT_NVS_NAMESPACE, MT_NVS_VERSION); + return ESP_OK; +} + +esp_err_t mt_nvs_set_blob(const char *key, const void *data, size_t len) { + if (!s_is_inited) + return ESP_ERR_INVALID_STATE; + esp_err_t ret = nvs_set_blob(s_handle, key, data, len); + if (ret == ESP_OK) + nvs_commit(s_handle); + return ret; +} + +int mt_nvs_get_blob(const char *key, void *out_data, size_t max_len) { + if (!s_is_inited) + return -1; + size_t len = max_len; + esp_err_t ret = nvs_get_blob(s_handle, key, out_data, &len); + if (ret == ESP_ERR_NVS_NOT_FOUND) + return 0; + if (ret != ESP_OK) + return -1; + return (int)len; +} + +esp_err_t mt_nvs_set_u32(const char *key, uint32_t value) { + if (!s_is_inited) + return ESP_ERR_INVALID_STATE; + esp_err_t ret = nvs_set_u32(s_handle, key, value); + if (ret == ESP_OK) + nvs_commit(s_handle); + return ret; +} + +uint32_t mt_nvs_get_u32(const char *key, uint32_t default_value) { + if (!s_is_inited) + return default_value; + uint32_t value = default_value; + nvs_get_u32(s_handle, key, &value); + return value; +} + +esp_err_t mt_nvs_erase(const char *key) { + if (!s_is_inited) + return ESP_ERR_INVALID_STATE; + return nvs_erase_key(s_handle, key); +} + +esp_err_t mt_nvs_factory_reset(void) { + if (!s_is_inited) + return ESP_ERR_INVALID_STATE; + esp_err_t ret = nvs_erase_all(s_handle); + if (ret == ESP_OK) { + nvs_set_u32(s_handle, MT_NVS_VER_KEY, MT_NVS_VERSION); + nvs_commit(s_handle); + ESP_LOGW(TAG, "Factory reset complete"); + } + return ret; +} + +esp_err_t mt_nvs_commit(void) { + if (!s_is_inited) + return ESP_ERR_INVALID_STATE; + return nvs_commit(s_handle); +} diff --git a/firmware_p4/components/Applications/LoRa/meshtastic/meshtastic_phone_bridge.c b/firmware_p4/components/Applications/LoRa/meshtastic/meshtastic_phone_bridge.c new file mode 100644 index 00000000..f4021b81 --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/meshtastic/meshtastic_phone_bridge.c @@ -0,0 +1,432 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#include "meshtastic_phone_bridge.h" + +#include +#include +#include + +#include "esp_log.h" +#include "freertos/FreeRTOS.h" +#include "freertos/portmacro.h" +#include "freertos/semphr.h" +#include "freertos/task.h" + +#include "meshtastic_phoneapi.h" +#include "spi_bridge.h" + +static const char *TAG = "MESH_BRIDGE"; + +#define BRIDGE_NOTIFY_TASK_STACK 4096 +#define BRIDGE_NOTIFY_TASK_PRIO 5 +#define BRIDGE_NOTIFY_TICK_MS 100 +#define BRIDGE_SPI_TIMEOUT_MS 1000 +#define BRIDGE_FROMRADIO_BUF_SIZE 512 +#define BRIDGE_TORADIO_BUF_SIZE 512 +#define BRIDGE_LOG_RING_SIZE 2048 +#define BRIDGE_LOG_LINE_MAX 256 +#define BRIDGE_CHUNK_PAYLOAD_MAX SPI_MESH_CHUNK_PAYLOAD_MAX +#define BRIDGE_LOG_CHUNK_BYTES SPI_MESH_CHUNK_PAYLOAD_MAX +#define BRIDGE_MAX_CHUNKS 255 +#define BRIDGE_RETRY_TICKS 50 + +typedef struct { + bool is_active; + uint8_t seq; + uint8_t total_chunks; + uint8_t next_chunk_idx; + uint16_t accumulated_len; + uint8_t buf[BRIDGE_TORADIO_BUF_SIZE]; +} bridge_reassembly_t; + +static bool s_is_initialized = false; +static volatile bool s_is_running = false; +static uint32_t s_node_num = 0; +static TaskHandle_t s_notify_task = NULL; +static SemaphoreHandle_t s_status_mutex = NULL; +static spi_mesh_status_t s_cached_status = {0}; +static uint8_t s_tx_seq = 0; +static uint8_t s_log_seq = 0; +static portMUX_TYPE s_log_mux = portMUX_INITIALIZER_UNLOCKED; +static uint8_t s_log_ring[BRIDGE_LOG_RING_SIZE]; +static uint16_t s_log_head = 0; +static uint16_t s_log_tail = 0; +static vprintf_like_t s_prev_vprintf = NULL; +static bridge_reassembly_t s_toradio = {0}; +static volatile bool s_want_ble_active = false; +static volatile bool s_want_wifi_active = false; +static bool s_ble_active_on_c5 = false; +static bool s_wifi_active_on_c5 = false; +static uint16_t s_retry_ticks_remaining = 0; + +static void notify_task(void *pvParameters); +static esp_err_t push_frame(spi_id_t id, uint8_t *seq_counter, const uint8_t *frame, uint16_t len); +static void on_toradio_stream(spi_id_t id, const uint8_t *payload, uint8_t len); +static int log_vprintf(const char *fmt, va_list args); +static void log_ring_push(const uint8_t *buf, size_t len); +static uint16_t log_ring_pop(uint8_t *out_buf, uint16_t max_len); +static esp_err_t fetch_status(spi_mesh_status_t *out_status); +static void store_status(const spi_mesh_status_t *status); +static esp_err_t request_ble_init(void); +static esp_err_t request_ble_stop(void); +static esp_err_t request_wifi_init(void); +static esp_err_t request_wifi_stop(void); +static void reconcile_transports(void); + +esp_err_t meshtastic_phone_bridge_init(uint32_t node_num) { + if (s_is_initialized) { + return ESP_ERR_INVALID_STATE; + } + + s_node_num = node_num; + s_tx_seq = 0; + s_log_seq = 0; + memset(&s_toradio, 0, sizeof(s_toradio)); + memset(&s_cached_status, 0, sizeof(s_cached_status)); + s_log_head = 0; + s_log_tail = 0; + s_want_ble_active = false; + s_want_wifi_active = false; + s_ble_active_on_c5 = false; + s_wifi_active_on_c5 = false; + s_retry_ticks_remaining = BRIDGE_RETRY_TICKS; + + s_status_mutex = xSemaphoreCreateMutex(); + if (s_status_mutex == NULL) { + ESP_LOGE(TAG, "Failed to create status mutex"); + return ESP_ERR_NO_MEM; + } + + spi_bridge_register_stream_cb(SPI_ID_MESH_TORADIO_STREAM, on_toradio_stream); + + s_is_running = true; + BaseType_t ok = xTaskCreate(notify_task, + "mesh_bridge", + BRIDGE_NOTIFY_TASK_STACK, + NULL, + BRIDGE_NOTIFY_TASK_PRIO, + &s_notify_task); + if (ok != pdPASS) { + s_is_running = false; + spi_bridge_unregister_stream_cb(SPI_ID_MESH_TORADIO_STREAM); + vSemaphoreDelete(s_status_mutex); + s_status_mutex = NULL; + ESP_LOGE(TAG, "Failed to create notify task"); + return ESP_ERR_NO_MEM; + } + + s_prev_vprintf = esp_log_set_vprintf(log_vprintf); + + s_is_initialized = true; + ESP_LOGI(TAG, "Initialized — node 0x%08lX", (unsigned long)node_num); + return ESP_OK; +} + +void meshtastic_phone_bridge_stop(void) { + if (!s_is_initialized) { + return; + } + + if (s_prev_vprintf != NULL) { + esp_log_set_vprintf(s_prev_vprintf); + s_prev_vprintf = NULL; + } + + s_is_running = false; + spi_bridge_unregister_stream_cb(SPI_ID_MESH_TORADIO_STREAM); + s_is_initialized = false; +} + +esp_err_t meshtastic_phone_bridge_ble_start(void) { + s_want_ble_active = true; + return request_ble_init(); +} + +esp_err_t meshtastic_phone_bridge_ble_stop(void) { + s_want_ble_active = false; + return request_ble_stop(); +} + +esp_err_t meshtastic_phone_bridge_wifi_start(void) { + s_want_wifi_active = true; + return request_wifi_init(); +} + +esp_err_t meshtastic_phone_bridge_wifi_stop(void) { + s_want_wifi_active = false; + return request_wifi_stop(); +} + +bool meshtastic_phone_bridge_is_connected(void) { + bool is_connected = false; + if (s_status_mutex == NULL) { + return false; + } + if (xSemaphoreTake(s_status_mutex, pdMS_TO_TICKS(BRIDGE_NOTIFY_TICK_MS)) == pdTRUE) { + is_connected = (s_cached_status.ble_connected != 0) || (s_cached_status.tcp_clients != 0); + xSemaphoreGive(s_status_mutex); + } + return is_connected; +} + +static void notify_task(void *pvParameters) { + (void)pvParameters; + uint8_t frame_buf[BRIDGE_FROMRADIO_BUF_SIZE]; + uint8_t log_buf[BRIDGE_LOG_CHUNK_BYTES]; + + while (s_is_running) { + vTaskDelay(pdMS_TO_TICKS(BRIDGE_NOTIFY_TICK_MS)); + + if (s_retry_ticks_remaining == 0) { + reconcile_transports(); + s_retry_ticks_remaining = BRIDGE_RETRY_TICKS; + } else { + s_retry_ticks_remaining--; + } + + spi_mesh_status_t status = {0}; + bool has_status = (fetch_status(&status) == ESP_OK); + if (has_status) { + store_status(&status); + } + + bool is_phone_active = has_status && ((status.ble_connected != 0) || (status.tcp_clients != 0)); + + while (is_phone_active && phoneapi_has_data()) { + uint16_t flen = phoneapi_poll_fromradio(frame_buf, sizeof(frame_buf)); + if (flen == 0) { + break; + } + if (push_frame(SPI_ID_MESH_FROMRADIO_PUSH, &s_tx_seq, frame_buf, flen) != ESP_OK) { + ESP_LOGW(TAG, "FromRadio push failed"); + break; + } + } + + bool is_log_active = has_status && (status.logradio_subscribed != 0); + while (is_log_active) { + uint16_t n = log_ring_pop(log_buf, sizeof(log_buf)); + if (n == 0) { + break; + } + if (push_frame(SPI_ID_MESH_LOG_PUSH, &s_log_seq, log_buf, n) != ESP_OK) { + break; + } + } + } + + s_notify_task = NULL; + vTaskDelete(NULL); +} + +static esp_err_t push_frame(spi_id_t id, uint8_t *seq_counter, const uint8_t *frame, uint16_t len) { + if (frame == NULL || seq_counter == NULL || len == 0) { + return ESP_ERR_INVALID_ARG; + } + + uint16_t total_u16 = (uint16_t)((len + BRIDGE_CHUNK_PAYLOAD_MAX - 1) / BRIDGE_CHUNK_PAYLOAD_MAX); + if (total_u16 > BRIDGE_MAX_CHUNKS) { + return ESP_ERR_INVALID_SIZE; + } + uint8_t total_chunks = (uint8_t)total_u16; + uint8_t seq = (*seq_counter)++; + + uint8_t buf[SPI_MAX_PAYLOAD]; + spi_mesh_chunk_hdr_t hdr; + uint16_t offset = 0; + + for (uint8_t idx = 0; idx < total_chunks; idx++) { + uint16_t remaining = (uint16_t)(len - offset); + uint16_t this_chunk = + remaining > BRIDGE_CHUNK_PAYLOAD_MAX ? BRIDGE_CHUNK_PAYLOAD_MAX : remaining; + + hdr.seq = seq; + hdr.chunk_idx = idx; + hdr.total_chunks = total_chunks; + hdr.flags = (idx == (uint8_t)(total_chunks - 1)) ? SPI_MESH_CHUNK_FLAG_LAST : 0; + + memcpy(buf, &hdr, sizeof(hdr)); + memcpy(buf + sizeof(hdr), frame + offset, this_chunk); + + uint8_t cmd_len = (uint8_t)(sizeof(hdr) + this_chunk); + esp_err_t ret = spi_bridge_send_command(id, buf, cmd_len, NULL, NULL, BRIDGE_SPI_TIMEOUT_MS); + if (ret != ESP_OK) { + return ret; + } + offset += this_chunk; + } + return ESP_OK; +} + +static void on_toradio_stream(spi_id_t id, const uint8_t *payload, uint8_t len) { + (void)id; + if (payload == NULL || len < (uint8_t)sizeof(spi_mesh_chunk_hdr_t)) { + return; + } + + spi_mesh_chunk_hdr_t hdr; + memcpy(&hdr, payload, sizeof(hdr)); + const uint8_t *data = payload + sizeof(hdr); + uint8_t data_len = (uint8_t)(len - sizeof(hdr)); + + if (hdr.total_chunks == 0) { + return; + } + + if (hdr.chunk_idx == 0) { + s_toradio.is_active = true; + s_toradio.seq = hdr.seq; + s_toradio.total_chunks = hdr.total_chunks; + s_toradio.next_chunk_idx = 0; + s_toradio.accumulated_len = 0; + } else if (!s_toradio.is_active) { + return; + } + + if (hdr.seq != s_toradio.seq || hdr.chunk_idx != s_toradio.next_chunk_idx || + hdr.total_chunks != s_toradio.total_chunks) { + s_toradio.is_active = false; + return; + } + + if ((uint16_t)(s_toradio.accumulated_len + data_len) > sizeof(s_toradio.buf)) { + s_toradio.is_active = false; + return; + } + + memcpy(s_toradio.buf + s_toradio.accumulated_len, data, data_len); + s_toradio.accumulated_len = (uint16_t)(s_toradio.accumulated_len + data_len); + s_toradio.next_chunk_idx++; + + if (s_toradio.next_chunk_idx >= s_toradio.total_chunks) { + phoneapi_on_toradio(s_toradio.buf, s_toradio.accumulated_len); + s_toradio.is_active = false; + } +} + +static int log_vprintf(const char *fmt, va_list args) { + char line[BRIDGE_LOG_LINE_MAX]; + va_list copy; + va_copy(copy, args); + int len = vsnprintf(line, sizeof(line), fmt, copy); + va_end(copy); + + if (len > 0) { + if (len >= (int)sizeof(line)) { + len = (int)sizeof(line) - 1; + } + log_ring_push((const uint8_t *)line, (size_t)len); + } + + if (s_prev_vprintf != NULL) { + return s_prev_vprintf(fmt, args); + } + return len; +} + +static void log_ring_push(const uint8_t *buf, size_t len) { + portENTER_CRITICAL(&s_log_mux); + for (size_t i = 0; i < len; i++) { + uint16_t next = (uint16_t)((s_log_tail + 1) % BRIDGE_LOG_RING_SIZE); + if (next == s_log_head) { + s_log_head = (uint16_t)((s_log_head + 1) % BRIDGE_LOG_RING_SIZE); + } + s_log_ring[s_log_tail] = buf[i]; + s_log_tail = next; + } + portEXIT_CRITICAL(&s_log_mux); +} + +static uint16_t log_ring_pop(uint8_t *out_buf, uint16_t max_len) { + uint16_t n = 0; + portENTER_CRITICAL(&s_log_mux); + while (n < max_len && s_log_head != s_log_tail) { + out_buf[n++] = s_log_ring[s_log_head]; + s_log_head = (uint16_t)((s_log_head + 1) % BRIDGE_LOG_RING_SIZE); + } + portEXIT_CRITICAL(&s_log_mux); + return n; +} + +static esp_err_t fetch_status(spi_mesh_status_t *out_status) { + if (out_status == NULL) { + return ESP_ERR_INVALID_ARG; + } + spi_header_t resp; + return spi_bridge_send_command( + SPI_ID_MESH_STATUS, NULL, 0, &resp, (uint8_t *)out_status, BRIDGE_SPI_TIMEOUT_MS); +} + +static void store_status(const spi_mesh_status_t *status) { + if (status == NULL || s_status_mutex == NULL) { + return; + } + if (xSemaphoreTake(s_status_mutex, pdMS_TO_TICKS(BRIDGE_NOTIFY_TICK_MS)) == pdTRUE) { + s_cached_status = *status; + xSemaphoreGive(s_status_mutex); + } +} + +static esp_err_t request_ble_init(void) { + spi_mesh_init_t req = {.node_num = s_node_num}; + esp_err_t ret = spi_bridge_send_command( + SPI_ID_MESH_BLE_INIT, (uint8_t *)&req, sizeof(req), NULL, NULL, BRIDGE_SPI_TIMEOUT_MS); + if (ret == ESP_OK) { + s_ble_active_on_c5 = true; + } + return ret; +} + +static esp_err_t request_ble_stop(void) { + esp_err_t ret = + spi_bridge_send_command(SPI_ID_MESH_BLE_STOP, NULL, 0, NULL, NULL, BRIDGE_SPI_TIMEOUT_MS); + if (ret == ESP_OK) { + s_ble_active_on_c5 = false; + } + return ret; +} + +static esp_err_t request_wifi_init(void) { + spi_mesh_init_t req = {.node_num = s_node_num}; + esp_err_t ret = spi_bridge_send_command( + SPI_ID_MESH_WIFI_INIT, (uint8_t *)&req, sizeof(req), NULL, NULL, BRIDGE_SPI_TIMEOUT_MS); + if (ret == ESP_OK) { + s_wifi_active_on_c5 = true; + } + return ret; +} + +static esp_err_t request_wifi_stop(void) { + esp_err_t ret = + spi_bridge_send_command(SPI_ID_MESH_WIFI_STOP, NULL, 0, NULL, NULL, BRIDGE_SPI_TIMEOUT_MS); + if (ret == ESP_OK) { + s_wifi_active_on_c5 = false; + } + return ret; +} + +static void reconcile_transports(void) { + if (s_want_ble_active && !s_ble_active_on_c5) { + request_ble_init(); + } else if (!s_want_ble_active && s_ble_active_on_c5) { + request_ble_stop(); + } + if (s_want_wifi_active && !s_wifi_active_on_c5) { + request_wifi_init(); + } else if (!s_want_wifi_active && s_wifi_active_on_c5) { + request_wifi_stop(); + } +} diff --git a/firmware_p4/components/Applications/LoRa/meshtastic/meshtastic_phoneapi.c b/firmware_p4/components/Applications/LoRa/meshtastic/meshtastic_phoneapi.c new file mode 100644 index 00000000..38da59a6 --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/meshtastic/meshtastic_phoneapi.c @@ -0,0 +1,675 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#include "meshtastic_phoneapi.h" + +#include +#include + +#include "esp_log.h" +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" +#include "freertos/semphr.h" + +#include "meshtastic_channels.h" +#include "meshtastic_mesh.h" +#include "meshtastic_nodedb.h" +#include "meshtastic_pki.h" + +static const char *TAG = "MESHTASTIC_PHONEAPI"; + +#define PA_NONCE_ONLY_CONFIG 69420 +#define PA_NONCE_ONLY_NODES 69421 +#define PA_MAX_FRAME_SIZE 512 +#define PA_FROMRADIO_QUEUE_SZ 16 +#define PA_NUM_CONFIGS 10 +#define PA_NUM_MODULECONFIGS 16 +#define PA_MAX_CHANNELS 8 +#define PA_MAX_PEERS 64 +#define PA_MUTEX_TIMEOUT_MS 50 +#define PA_PREBURST_FRAMES 8 +#define PA_MIN_APP_VERSION 30200 +#define PA_HW_MODEL_PRIVATE 255 +#define PA_ROLE_REPEATER 4 + +typedef struct { + bool is_used; + uint16_t len; + uint8_t buf[PA_MAX_FRAME_SIZE]; +} pa_frame_t; + +static pa_frame_t s_queue[PA_FROMRADIO_QUEUE_SZ]; +static uint8_t s_queue_head = 0; +static uint8_t s_queue_tail = 0; +static SemaphoreHandle_t s_queue_mutex = NULL; + +static uint32_t s_node_num = 0; +static phoneapi_state_t s_state = PA_STATE_IDLE; +static uint32_t s_radio_id = 1; +static uint32_t s_want_config_nonce = 0; +static uint8_t s_config_iter = 0; + +static uint16_t enc_varint(uint8_t *buf, uint64_t value) { + uint16_t pos = 0; + do { + uint8_t byte = value & 0x7F; + value >>= 7; + if (value) + byte |= 0x80; + buf[pos++] = byte; + } while (value); + return pos; +} + +static uint16_t enc_field_varint(uint8_t *buf, uint8_t field_num, uint64_t value) { + buf[0] = (field_num << 3) | 0; + return 1 + enc_varint(&buf[1], value); +} + +static uint16_t +enc_field_bytes(uint8_t *buf, uint8_t field_num, const uint8_t *data, uint16_t len) { + buf[0] = (field_num << 3) | 2; + uint16_t pos = 1 + enc_varint(&buf[1], len); + memcpy(&buf[pos], data, len); + return pos + len; +} + +static uint16_t enc_field_fixed32(uint8_t *buf, uint8_t field_num, uint32_t value) { + buf[0] = (field_num << 3) | 5; + buf[1] = (uint8_t)(value & 0xFF); + buf[2] = (uint8_t)((value >> 8) & 0xFF); + buf[3] = (uint8_t)((value >> 16) & 0xFF); + buf[4] = (uint8_t)((value >> 24) & 0xFF); + return 5; +} + +static uint64_t dec_varint(const uint8_t *buf, uint16_t max_len, uint16_t *out_used) { + uint64_t value = 0; + uint16_t shift = 0; + uint16_t i = 0; + while (i < max_len && i < 10) { + uint8_t byte = buf[i++]; + value |= ((uint64_t)(byte & 0x7F)) << shift; + if (!(byte & 0x80)) + break; + shift += 7; + } + if (out_used != NULL) + *out_used = i; + return value; +} + +static bool queue_push(const uint8_t *buf, uint16_t len) { + if (len == 0 || len > PA_MAX_FRAME_SIZE) + return false; + if (xSemaphoreTake(s_queue_mutex, pdMS_TO_TICKS(PA_MUTEX_TIMEOUT_MS)) != pdTRUE) { + return false; + } + + uint8_t next = (s_queue_tail + 1) % PA_FROMRADIO_QUEUE_SZ; + if (next == s_queue_head) { + s_queue_head = (s_queue_head + 1) % PA_FROMRADIO_QUEUE_SZ; + ESP_LOGW(TAG, "Queue full, dropping oldest frame"); + } + s_queue[s_queue_tail].is_used = true; + s_queue[s_queue_tail].len = len; + memcpy(s_queue[s_queue_tail].buf, buf, len); + s_queue_tail = next; + + xSemaphoreGive(s_queue_mutex); + return true; +} + +static uint16_t queue_pop(uint8_t *out_buf, uint16_t max_len) { + if (xSemaphoreTake(s_queue_mutex, pdMS_TO_TICKS(PA_MUTEX_TIMEOUT_MS)) != pdTRUE) { + return 0; + } + + if (s_queue_head == s_queue_tail) { + xSemaphoreGive(s_queue_mutex); + return 0; + } + uint16_t length = s_queue[s_queue_head].len; + if (length > max_len) + length = max_len; + memcpy(out_buf, s_queue[s_queue_head].buf, length); + s_queue[s_queue_head].is_used = false; + s_queue_head = (s_queue_head + 1) % PA_FROMRADIO_QUEUE_SZ; + + xSemaphoreGive(s_queue_mutex); + return length; +} + +static bool queue_has_data(void) { + bool has = false; + if (xSemaphoreTake(s_queue_mutex, pdMS_TO_TICKS(10)) == pdTRUE) { + has = (s_queue_head != s_queue_tail); + xSemaphoreGive(s_queue_mutex); + } + return has; +} + +static uint16_t build_my_info(uint8_t *out, uint32_t rid) { + static uint32_t s_boot_count = 0; + s_boot_count++; + + uint8_t mi[64]; + uint16_t mi_len = 0; + mi_len += enc_field_varint(&mi[mi_len], 1, s_node_num); + mi_len += enc_field_varint(&mi[mi_len], 8, s_boot_count); + mi_len += enc_field_varint(&mi[mi_len], 11, PA_MIN_APP_VERSION); + const char *pio_env = "highboy-s3"; + mi_len += enc_field_bytes(&mi[mi_len], 13, (const uint8_t *)pio_env, (uint16_t)strlen(pio_env)); + + uint16_t pos = 0; + pos += enc_field_varint(&out[pos], 1, rid); + pos += enc_field_bytes(&out[pos], 3, mi, mi_len); + return pos; +} + +static uint16_t build_metadata(uint8_t *out, uint32_t rid) { + uint8_t md[64]; + uint16_t md_len = 0; + const char *version = "2.7.0-highboy"; + md_len += enc_field_bytes(&md[md_len], 1, (const uint8_t *)version, (uint16_t)strlen(version)); + md_len += enc_field_varint(&md[md_len], 3, 1); + md_len += enc_field_varint(&md[md_len], 4, 1); + md_len += enc_field_varint(&md[md_len], 5, 1); + md_len += enc_field_varint(&md[md_len], 6, 0); + md_len += enc_field_varint(&md[md_len], 7, 0); + md_len += enc_field_varint(&md[md_len], 8, PA_HW_MODEL_PRIVATE); + md_len += enc_field_varint(&md[md_len], 9, 0); + md_len += enc_field_varint(&md[md_len], 10, 0); + + uint16_t pos = 0; + pos += enc_field_varint(&out[pos], 1, rid); + pos += enc_field_bytes(&out[pos], 13, md, md_len); + return pos; +} + +static uint16_t build_own_nodeinfo(uint8_t *out, uint32_t rid) { + uint8_t user[128]; + uint16_t u_len = 0; + char id_str[16]; + snprintf(id_str, sizeof(id_str), "!%08lx", (unsigned long)s_node_num); + u_len += enc_field_bytes(&user[u_len], 1, (const uint8_t *)id_str, (uint16_t)strlen(id_str)); + u_len += enc_field_bytes(&user[u_len], 2, (const uint8_t *)"Highboy S3", 10); + u_len += enc_field_bytes(&user[u_len], 3, (const uint8_t *)"HBS3", 4); + u_len += enc_field_varint(&user[u_len], 5, PA_HW_MODEL_PRIVATE); + u_len += enc_field_varint(&user[u_len], 7, 0); + u_len += enc_field_bytes(&user[u_len], 8, mt_pki_get_pubkey(), MT_PKI_KEY_LEN); + + uint8_t dm[32]; + uint16_t dm_len = 0; + uint32_t uptime_s = (uint32_t)(xTaskGetTickCount() * portTICK_PERIOD_MS / 1000); + dm_len += enc_field_varint(&dm[dm_len], 1, 101); + dm_len += enc_field_varint(&dm[dm_len], 5, uptime_s); + + uint32_t now_unix = 1776000000UL + uptime_s; + + uint8_t ni[192]; + uint16_t ni_len = 0; + ni_len += enc_field_varint(&ni[ni_len], 1, s_node_num); + ni_len += enc_field_bytes(&ni[ni_len], 2, user, u_len); + ni_len += enc_field_fixed32(&ni[ni_len], 5, now_unix); + ni_len += enc_field_bytes(&ni[ni_len], 6, dm, dm_len); + + uint16_t pos = 0; + pos += enc_field_varint(&out[pos], 1, rid); + pos += enc_field_bytes(&out[pos], 4, ni, ni_len); + return pos; +} + +static uint16_t build_config_empty(uint8_t *out, uint32_t rid, uint8_t cfg_type) { + uint8_t cfg[96]; + uint16_t cfg_len = 0; + + if (cfg_type == 6) { + uint8_t lora[8]; + uint16_t ll = 0; + ll += enc_field_varint(&lora[ll], 1, 1); + ll += enc_field_varint(&lora[ll], 2, 0); + ll += enc_field_varint(&lora[ll], 7, 1); + ll += enc_field_varint(&lora[ll], 8, 3); + ll += enc_field_varint(&lora[ll], 9, 1); + ll += enc_field_varint(&lora[ll], 10, 22); + cfg[cfg_len++] = (cfg_type << 3) | 2; + cfg_len += enc_varint(&cfg[cfg_len], ll); + memcpy(&cfg[cfg_len], lora, ll); + cfg_len += ll; + } else if (cfg_type == 8) { + uint8_t sec[80]; + uint16_t sl = 0; + sl += enc_field_bytes(&sec[sl], 1, mt_pki_get_pubkey(), MT_PKI_KEY_LEN); + sl += enc_field_bytes(&sec[sl], 2, mt_pki_get_privkey(), MT_PKI_KEY_LEN); + cfg[cfg_len++] = (cfg_type << 3) | 2; + cfg_len += enc_varint(&cfg[cfg_len], sl); + memcpy(&cfg[cfg_len], sec, sl); + cfg_len += sl; + } else { + cfg[cfg_len++] = (cfg_type << 3) | 2; + cfg[cfg_len++] = 0; + } + + uint16_t pos = 0; + pos += enc_field_varint(&out[pos], 1, rid); + pos += enc_field_bytes(&out[pos], 5, cfg, cfg_len); + return pos; +} + +static uint16_t build_moduleconfig_empty(uint8_t *out, uint32_t rid, uint8_t mc_type) { + uint8_t mc[8]; + uint16_t mc_len = 0; + mc[mc_len++] = (mc_type << 3) | 2; + mc[mc_len++] = 0; + + uint16_t pos = 0; + pos += enc_field_varint(&out[pos], 1, rid); + pos += enc_field_bytes(&out[pos], 9, mc, mc_len); + return pos; +} + +static uint16_t build_channel(uint8_t *out, uint32_t rid, uint8_t idx) { + const mt_channel_t *ch = mt_channel_get(idx); + + uint8_t channel[128]; + uint16_t cl = 0; + cl += enc_field_varint(&channel[cl], 1, idx); + + if (ch != NULL && ch->is_used && ch->role != MT_CH_DISABLED) { + uint8_t settings[80]; + uint16_t sl = 0; + sl += enc_field_bytes(&settings[sl], 2, ch->psk, MT_PSK_SIZE); + size_t nlen = strlen(ch->name); + if (nlen > 0) { + sl += enc_field_bytes(&settings[sl], 3, (const uint8_t *)ch->name, (uint16_t)nlen); + } + if (ch->id != 0) { + sl += enc_field_fixed32(&settings[sl], 4, ch->id); + } + + cl += enc_field_bytes(&channel[cl], 2, settings, sl); + cl += enc_field_varint(&channel[cl], 3, (uint64_t)ch->role); + } else { + cl += enc_field_varint(&channel[cl], 3, 0); + } + + uint16_t pos = 0; + pos += enc_field_varint(&out[pos], 1, rid); + pos += enc_field_bytes(&out[pos], 10, channel, cl); + return pos; +} + +static uint16_t build_config_complete(uint8_t *out, uint32_t rid, uint32_t nonce) { + uint16_t pos = 0; + pos += enc_field_varint(&out[pos], 1, rid); + pos += enc_field_varint(&out[pos], 7, nonce); + return pos; +} + +static uint16_t build_queue_status(uint8_t *out, uint32_t rid, int32_t res, uint32_t pkt_id) { + uint8_t qs[24]; + uint16_t ql = 0; + ql += enc_field_varint(&qs[ql], 1, (uint64_t)(uint32_t)res); + ql += enc_field_varint(&qs[ql], 2, PA_FROMRADIO_QUEUE_SZ); + ql += enc_field_varint(&qs[ql], 3, PA_FROMRADIO_QUEUE_SZ); + ql += enc_field_varint(&qs[ql], 4, pkt_id); + + uint16_t pos = 0; + pos += enc_field_varint(&out[pos], 1, rid); + pos += enc_field_bytes(&out[pos], 11, qs, ql); + return pos; +} + +static uint32_t extract_packet_id(const uint8_t *buf, uint16_t len) { + uint16_t i = 0; + while (i < len) { + uint16_t used = 0; + uint64_t tag = dec_varint(&buf[i], len - i, &used); + if (used == 0) + break; + i += used; + uint32_t field = (uint32_t)(tag >> 3); + uint32_t wire_type = (uint32_t)(tag & 0x07); + + if (wire_type == 5) { + if (i + 4 > len) + break; + if (field == 6) { + return (uint32_t)buf[i] | ((uint32_t)buf[i + 1] << 8) | ((uint32_t)buf[i + 2] << 16) | + ((uint32_t)buf[i + 3] << 24); + } + i += 4; + } else if (wire_type == 0) { + uint16_t vused = 0; + dec_varint(&buf[i], len - i, &vused); + i += vused; + } else if (wire_type == 2) { + uint16_t lused = 0; + uint32_t length = (uint32_t)dec_varint(&buf[i], len - i, &lused); + i += lused + length; + } else { + break; + } + } + return 0; +} + +static void enqueue_queue_status(uint32_t pkt_id, int32_t res) { + uint8_t frame[32]; + uint16_t flen = build_queue_status(frame, s_radio_id++, res, pkt_id); + bool ok = queue_push(frame, flen); + ESP_LOGI(TAG, + "QueueStatus enqueued: pkt_id=0x%08lX res=%ld flen=%u %s", + (unsigned long)pkt_id, + (long)res, + flen, + ok ? "OK" : "FALHA"); +} + +static uint16_t build_deviceui_config(uint8_t *out, uint32_t rid) { + uint8_t uic[4]; + uint16_t uic_len = 0; + uic_len += enc_field_varint(&uic[uic_len], 1, 1); + + uint16_t pos = 0; + pos += enc_field_varint(&out[pos], 1, rid); + pos += enc_field_bytes(&out[pos], 17, uic, uic_len); + return pos; +} + +static const struct { + const char *name; + uint32_t size_bytes; +} PA_FILE_ENTRIES[] = { + {"/nvs/channels", 384}, + {"/nvs/nodedb", 5400}, + {"/nvs/x25519_pub", 32}, + {"/nvs/x25519_priv", 32}, +}; +#define PA_NUM_FILE_ENTRIES (sizeof(PA_FILE_ENTRIES) / sizeof(PA_FILE_ENTRIES[0])) + +static uint16_t build_filemanifest_entry(uint8_t *out, uint32_t rid, uint8_t idx) { + if (idx >= PA_NUM_FILE_ENTRIES) + return 0; + uint8_t fi[64]; + uint16_t fi_len = 0; + size_t nl = strlen(PA_FILE_ENTRIES[idx].name); + fi_len += + enc_field_bytes(&fi[fi_len], 1, (const uint8_t *)PA_FILE_ENTRIES[idx].name, (uint16_t)nl); + fi_len += enc_field_varint(&fi[fi_len], 2, PA_FILE_ENTRIES[idx].size_bytes); + + uint16_t pos = 0; + pos += enc_field_varint(&out[pos], 1, rid); + pos += enc_field_bytes(&out[pos], 15, fi, fi_len); + return pos; +} + +static uint16_t build_peer_nodeinfo(uint8_t *out, uint32_t rid, const mt_node_entry_t *e) { + uint8_t user[128]; + uint16_t u_len = 0; + u_len += enc_field_bytes(&user[u_len], 1, (const uint8_t *)e->id, strlen(e->id)); + u_len += enc_field_bytes(&user[u_len], 2, (const uint8_t *)e->long_name, strlen(e->long_name)); + u_len += enc_field_bytes(&user[u_len], 3, (const uint8_t *)e->short_name, strlen(e->short_name)); + u_len += enc_field_varint(&user[u_len], 5, e->hw_model ? e->hw_model : PA_HW_MODEL_PRIVATE); + u_len += enc_field_varint(&user[u_len], 7, e->role); + if (e->has_public_key) { + u_len += enc_field_bytes(&user[u_len], 8, e->public_key, MT_NODEDB_PUBKEY_LEN); + } + + uint8_t ni[160]; + uint16_t ni_len = 0; + ni_len += enc_field_varint(&ni[ni_len], 1, e->num); + ni_len += enc_field_bytes(&ni[ni_len], 2, user, u_len); + + uint32_t snr_bits; + memcpy(&snr_bits, &e->snr, 4); + ni_len += enc_field_fixed32(&ni[ni_len], 4, snr_bits); + + uint32_t last_heard_unix = 1776000000UL + e->last_heard; + ni_len += enc_field_fixed32(&ni[ni_len], 5, last_heard_unix); + + if (e->hops_away) { + ni_len += enc_field_varint(&ni[ni_len], 9, e->hops_away); + } + if (e->is_favorite) { + ni_len += enc_field_varint(&ni[ni_len], 10, 1); + } + if (e->is_ignored) { + ni_len += enc_field_varint(&ni[ni_len], 11, 1); + } + if (e->is_muted) { + ni_len += enc_field_varint(&ni[ni_len], 13, 1); + } + + uint16_t pos = 0; + pos += enc_field_varint(&out[pos], 1, rid); + pos += enc_field_bytes(&out[pos], 4, ni, ni_len); + return pos; +} + +static void advance_fsm(void) { + uint8_t frame[PA_MAX_FRAME_SIZE]; + uint16_t len = 0; + + switch (s_state) { + case PA_STATE_SEND_MY_INFO: + len = build_my_info(frame, s_radio_id++); + s_state = PA_STATE_SEND_METADATA; + break; + + case PA_STATE_SEND_METADATA: + len = build_metadata(frame, s_radio_id++); + s_state = PA_STATE_SEND_DEVICEUI_CONFIG; + break; + + case PA_STATE_SEND_DEVICEUI_CONFIG: + len = build_deviceui_config(frame, s_radio_id++); + s_state = PA_STATE_SEND_CHANNELS; + s_config_iter = 0; + break; + + case PA_STATE_SEND_CHANNELS: + len = build_channel(frame, s_radio_id++, s_config_iter); + s_config_iter++; + if (s_config_iter >= PA_MAX_CHANNELS) { + s_state = PA_STATE_SEND_CONFIG; + s_config_iter = 1; + } + break; + + case PA_STATE_SEND_CONFIG: + len = build_config_empty(frame, s_radio_id++, s_config_iter); + s_config_iter++; + if (s_config_iter > PA_NUM_CONFIGS) { + s_state = PA_STATE_SEND_MODULECONFIG; + s_config_iter = 1; + } + break; + + case PA_STATE_SEND_MODULECONFIG: + len = build_moduleconfig_empty(frame, s_radio_id++, s_config_iter); + s_config_iter++; + if (s_config_iter > PA_NUM_MODULECONFIGS) { + s_state = PA_STATE_SEND_FILEMANIFEST; + s_config_iter = 0; + } + break; + + case PA_STATE_SEND_FILEMANIFEST: + len = build_filemanifest_entry(frame, s_radio_id++, s_config_iter); + s_config_iter++; + if (s_config_iter >= PA_NUM_FILE_ENTRIES) { + s_state = PA_STATE_SEND_COMPLETE_ID; + } + break; + + case PA_STATE_SEND_OWN_NODEINFO: + len = build_own_nodeinfo(frame, s_radio_id++); + s_state = PA_STATE_SEND_OTHER_NODEINFOS; + s_config_iter = 0; + break; + + case PA_STATE_SEND_OTHER_NODEINFOS: { + const mt_node_entry_t *e = NULL; + while (s_config_iter < PA_MAX_PEERS) { + e = mt_nodedb_get_by_index(s_config_iter); + if (e == NULL) + break; + if (e->num != s_node_num) + break; + s_config_iter++; + e = NULL; + } + if (e == NULL) { + s_state = PA_STATE_SEND_COMPLETE_ID; + return; + } + len = build_peer_nodeinfo(frame, s_radio_id++, e); + s_config_iter++; + break; + } + + case PA_STATE_SEND_COMPLETE_ID: + len = build_config_complete(frame, s_radio_id++, s_want_config_nonce); + s_state = PA_STATE_SEND_PACKETS; + ESP_LOGI(TAG, + "Handshake complete (nonce=%lu) - entering PACKETS", + (unsigned long)s_want_config_nonce); + break; + + case PA_STATE_SEND_PACKETS: + case PA_STATE_IDLE: + default: + return; + } + + if (len > 0) { + queue_push(frame, len); + } +} + +esp_err_t phoneapi_init(uint32_t node_num) { + s_node_num = node_num; + memset(s_queue, 0, sizeof(s_queue)); + s_queue_head = 0; + s_queue_tail = 0; + s_state = PA_STATE_IDLE; + s_radio_id = 1; + s_want_config_nonce = 0; + s_config_iter = 0; + + if (s_queue_mutex == NULL) { + s_queue_mutex = xSemaphoreCreateMutex(); + if (s_queue_mutex == NULL) + return ESP_ERR_NO_MEM; + } + + ESP_LOGI( + TAG, "Initialized - node=0x%08lX, queue=%d", (unsigned long)node_num, PA_FROMRADIO_QUEUE_SZ); + return ESP_OK; +} + +esp_err_t phoneapi_on_toradio(const uint8_t *pb_data, uint16_t pb_len) { + if (pb_data == NULL || pb_len < 2) + return ESP_ERR_INVALID_ARG; + + uint16_t i = 0; + while (i < pb_len) { + uint16_t used = 0; + uint64_t tag = dec_varint(&pb_data[i], pb_len - i, &used); + if (used == 0) + break; + i += used; + uint32_t field = (uint32_t)(tag >> 3); + uint32_t wire_type = (uint32_t)(tag & 0x07); + + if (wire_type == 2) { + uint16_t len_used = 0; + uint32_t length = (uint32_t)dec_varint(&pb_data[i], pb_len - i, &len_used); + i += len_used; + if (i + length > pb_len) + break; + + if (field == 1) { + uint32_t pkt_id = extract_packet_id(&pb_data[i], (uint16_t)length); + ESP_LOGI(TAG, + "ToRadio.packet %lu bytes id=0x%08lX -> mesh_send", + (unsigned long)length, + (unsigned long)pkt_id); + if (pkt_id != 0) { + enqueue_queue_status(pkt_id, 0); + } + meshtastic_mesh_send(&pb_data[i], (uint16_t)length); + } + i += length; + } else if (wire_type == 0) { + uint16_t vused = 0; + uint64_t value = dec_varint(&pb_data[i], pb_len - i, &vused); + i += vused; + if (field == 3) { + s_want_config_nonce = (uint32_t)value; + ESP_LOGI(TAG, "ToRadio.want_config_id = %lu", (unsigned long)value); + if (s_want_config_nonce == PA_NONCE_ONLY_NODES) { + s_state = PA_STATE_SEND_OWN_NODEINFO; + } else { + s_state = PA_STATE_SEND_MY_INFO; + } + s_config_iter = 0; + for (int k = 0; + k < PA_PREBURST_FRAMES && s_state != PA_STATE_SEND_PACKETS && s_state != PA_STATE_IDLE; + k++) { + advance_fsm(); + } + } + } else if (wire_type == 5) { + i += 4; + } else { + break; + } + } + return ESP_OK; +} + +uint16_t phoneapi_poll_fromradio(uint8_t *out_buf, uint16_t max_len) { + while (!queue_has_data() && s_state != PA_STATE_SEND_PACKETS && s_state != PA_STATE_IDLE) { + advance_fsm(); + } + return queue_pop(out_buf, max_len); +} + +bool phoneapi_has_data(void) { + if (queue_has_data()) + return true; + if (s_state != PA_STATE_SEND_PACKETS && s_state != PA_STATE_IDLE) { + return true; + } + return false; +} + +void phoneapi_push_packet(const uint8_t *mp_bytes, uint16_t mp_len) { + uint8_t frame[PA_MAX_FRAME_SIZE]; + uint16_t pos = 0; + pos += enc_field_varint(&frame[pos], 1, s_radio_id++); + pos += enc_field_bytes(&frame[pos], 2, mp_bytes, mp_len); + queue_push(frame, pos); +} + +void phoneapi_disconnect(void) { + ESP_LOGI(TAG, "Transporte desconectado - resetando FSM"); + s_state = PA_STATE_IDLE; + s_queue_head = s_queue_tail; + s_config_iter = 0; +} diff --git a/firmware_p4/components/Applications/LoRa/meshtastic/meshtastic_pki.c b/firmware_p4/components/Applications/LoRa/meshtastic/meshtastic_pki.c new file mode 100644 index 00000000..5aa57d04 --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/meshtastic/meshtastic_pki.c @@ -0,0 +1,105 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#include "meshtastic_pki.h" + +#include + +#include "esp_log.h" +#include "esp_random.h" +#include "mbedtls/ecp.h" +#include "mbedtls/bignum.h" + +#include "meshtastic_nvs.h" + +static const char *TAG = "MT_PKI"; + +#define MT_PKI_NVS_PRIV "x25519_priv" +#define MT_PKI_NVS_PUB "x25519_pub" + +static uint8_t s_priv[MT_PKI_KEY_LEN]; +static uint8_t s_pub[MT_PKI_KEY_LEN]; + +static int rng_cb(void *ctx, unsigned char *out, size_t len) { + (void)ctx; + esp_fill_random(out, len); + return 0; +} + +static esp_err_t generate_keypair(uint8_t *priv_out, uint8_t *pub_out) { + mbedtls_ecp_group grp; + mbedtls_mpi d; + mbedtls_ecp_point Q; + + mbedtls_ecp_group_init(&grp); + mbedtls_mpi_init(&d); + mbedtls_ecp_point_init(&Q); + + int rc = mbedtls_ecp_group_load(&grp, MBEDTLS_ECP_DP_CURVE25519); + if (rc == 0) + rc = mbedtls_ecp_gen_keypair(&grp, &d, &Q, rng_cb, NULL); + if (rc == 0) + rc = mbedtls_mpi_write_binary_le(&d, priv_out, MT_PKI_KEY_LEN); + if (rc == 0) + rc = mbedtls_mpi_write_binary_le(&Q.MBEDTLS_PRIVATE(X), pub_out, MT_PKI_KEY_LEN); + + mbedtls_ecp_point_free(&Q); + mbedtls_mpi_free(&d); + mbedtls_ecp_group_free(&grp); + + return (rc == 0) ? ESP_OK : ESP_FAIL; +} + +esp_err_t mt_pki_init(void) { + int priv_len = mt_nvs_get_blob(MT_PKI_NVS_PRIV, s_priv, sizeof(s_priv)); + int pub_len = mt_nvs_get_blob(MT_PKI_NVS_PUB, s_pub, sizeof(s_pub)); + + if (priv_len == MT_PKI_KEY_LEN && pub_len == MT_PKI_KEY_LEN) { + ESP_LOGI(TAG, + "Loaded X25519 keypair from NVS (pub[0..3]=%02x%02x%02x%02x)", + s_pub[0], + s_pub[1], + s_pub[2], + s_pub[3]); + return ESP_OK; + } + + ESP_LOGI(TAG, "Generating new X25519 keypair"); + esp_err_t ret = generate_keypair(s_priv, s_pub); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "Keygen failed"); + memset(s_priv, 0, sizeof(s_priv)); + memset(s_pub, 0, sizeof(s_pub)); + return ret; + } + + mt_nvs_set_blob(MT_PKI_NVS_PRIV, s_priv, sizeof(s_priv)); + mt_nvs_set_blob(MT_PKI_NVS_PUB, s_pub, sizeof(s_pub)); + + ESP_LOGI(TAG, + "Keypair generated and persisted (pub[0..3]=%02x%02x%02x%02x)", + s_pub[0], + s_pub[1], + s_pub[2], + s_pub[3]); + return ESP_OK; +} + +const uint8_t *mt_pki_get_pubkey(void) { + return s_pub; +} +const uint8_t *mt_pki_get_privkey(void) { + return s_priv; +} diff --git a/firmware_p4/components/Applications/LoRa/meshtastic/meshtastic_pkt_history.c b/firmware_p4/components/Applications/LoRa/meshtastic/meshtastic_pkt_history.c new file mode 100644 index 00000000..d8d4c984 --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/meshtastic/meshtastic_pkt_history.c @@ -0,0 +1,153 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#include "meshtastic_pkt_history.h" + +#include + +#include "esp_log.h" +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" + +static const char *TAG = "MESHTASTIC_PKT_HIST"; + +#define HOP_HIGHEST_MASK 0x07 +#define HOP_OURTX_MASK 0x38 +#define HOP_OURTX_SHIFT 3 + +typedef struct { + uint32_t sender; + uint32_t id; + uint32_t rx_time_ms; + uint8_t next_hop; + uint8_t hop_limit_packed; + uint8_t relayed_by[MT_NUM_RELAYERS]; +} mt_pkt_record_t; + +static mt_pkt_record_t s_table[MT_PKT_HISTORY_MAX]; + +static uint32_t now_ms(void) { + return (uint32_t)(xTaskGetTickCount() * portTICK_PERIOD_MS); +} + +static int find_record(uint32_t sender, uint32_t id) { + for (int i = 0; i < MT_PKT_HISTORY_MAX; i++) { + if (s_table[i].rx_time_ms != 0 && s_table[i].sender == sender && s_table[i].id == id) { + return i; + } + } + return -1; +} + +static int alloc_slot(void) { + int oldest_idx = 0; + uint32_t oldest_time = 0xFFFFFFFF; + for (int i = 0; i < MT_PKT_HISTORY_MAX; i++) { + if (s_table[i].rx_time_ms == 0) + return i; + if (s_table[i].rx_time_ms < oldest_time) { + oldest_idx = i; + oldest_time = s_table[i].rx_time_ms; + } + } + return oldest_idx; +} + +static void add_relayer(mt_pkt_record_t *record, uint8_t relayer_id) { + if (relayer_id == 0) + return; + for (int i = 0; i < MT_NUM_RELAYERS; i++) { + if (record->relayed_by[i] == relayer_id) + return; + } + for (int i = 0; i < MT_NUM_RELAYERS; i++) { + if (record->relayed_by[i] == 0) { + record->relayed_by[i] = relayer_id; + return; + } + } + for (int i = 0; i < MT_NUM_RELAYERS - 1; i++) { + record->relayed_by[i] = record->relayed_by[i + 1]; + } + record->relayed_by[MT_NUM_RELAYERS - 1] = relayer_id; +} + +void mt_pkt_history_init(void) { + memset(s_table, 0, sizeof(s_table)); + ESP_LOGI( + TAG, "Initialized - %d slots, %d relayers per entry", MT_PKT_HISTORY_MAX, MT_NUM_RELAYERS); +} + +bool mt_pkt_history_check_add( + uint32_t sender, uint32_t id, uint8_t hop_limit, uint8_t relayer_id, bool *out_upgraded) { + if (out_upgraded != NULL) + *out_upgraded = false; + + int idx = find_record(sender, id); + if (idx < 0) { + int slot = alloc_slot(); + memset(&s_table[slot], 0, sizeof(mt_pkt_record_t)); + s_table[slot].sender = sender; + s_table[slot].id = id; + s_table[slot].rx_time_ms = now_ms(); + s_table[slot].hop_limit_packed = hop_limit & HOP_HIGHEST_MASK; + add_relayer(&s_table[slot], relayer_id); + return false; + } + + mt_pkt_record_t *record = &s_table[idx]; + uint8_t highest_seen = record->hop_limit_packed & HOP_HIGHEST_MASK; + if (hop_limit > highest_seen) { + record->hop_limit_packed = + (record->hop_limit_packed & ~HOP_HIGHEST_MASK) | (hop_limit & HOP_HIGHEST_MASK); + if (out_upgraded != NULL) + *out_upgraded = true; + } + record->rx_time_ms = now_ms(); + add_relayer(record, relayer_id); + return true; +} + +bool mt_pkt_history_was_relayer(uint8_t relayer_id, uint32_t sender, uint32_t id) { + int idx = find_record(sender, id); + if (idx < 0) + return false; + for (int i = 0; i < MT_NUM_RELAYERS; i++) { + if (s_table[idx].relayed_by[i] == relayer_id) + return true; + } + return false; +} + +void mt_pkt_history_remove_relayer(uint8_t relayer_id, uint32_t sender, uint32_t id) { + int idx = find_record(sender, id); + if (idx < 0) + return; + for (int i = 0; i < MT_NUM_RELAYERS; i++) { + if (s_table[idx].relayed_by[i] == relayer_id) { + s_table[idx].relayed_by[i] = 0; + return; + } + } +} + +int mt_pkt_history_count(void) { + int count = 0; + for (int i = 0; i < MT_PKT_HISTORY_MAX; i++) { + if (s_table[i].rx_time_ms != 0) + count++; + } + return count; +} diff --git a/firmware_p4/components/Applications/LoRa/meshtastic/meshtastic_presets.c b/firmware_p4/components/Applications/LoRa/meshtastic/meshtastic_presets.c new file mode 100644 index 00000000..9c808c9c --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/meshtastic/meshtastic_presets.c @@ -0,0 +1,94 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#include "meshtastic_presets.h" + +#include "esp_log.h" + +#include "sx1262_regs.h" + +#include "meshtastic_nvs.h" + +static const char *TAG = "MESHTASTIC_PRESETS"; + +#define MT_PRESET_NVS_KEY "preset" + +static const mt_preset_info_t PRESETS[] = { + {MT_PRESET_LONG_FAST, "LONG_FAST", 11, 250000, 5, "Padrao, universal"}, + {MT_PRESET_LONG_SLOW, "LONG_SLOW", 12, 125000, 8, "Obsoleto"}, + {MT_PRESET_VERY_LONG_SLOW, "VERY_LONG_SLOW", 12, 125000, 8, "Obsoleto, requer TCXO"}, + {MT_PRESET_MEDIUM_SLOW, "MEDIUM_SLOW", 10, 250000, 5, "Alcance medio"}, + {MT_PRESET_MEDIUM_FAST, "MEDIUM_FAST", 9, 250000, 5, "Medio, mais rapido"}, + {MT_PRESET_SHORT_SLOW, "SHORT_SLOW", 8, 250000, 5, "Local"}, + {MT_PRESET_SHORT_FAST, "SHORT_FAST", 7, 250000, 5, "Local, rapido"}, + {MT_PRESET_LONG_MODERATE, "LONG_MODERATE", 11, 125000, 8, "Longo, moderado"}, + {MT_PRESET_SHORT_TURBO, "SHORT_TURBO", 7, 500000, 5, "Mais rapido, BW 500 kHz"}, + {MT_PRESET_LONG_TURBO, "LONG_TURBO", 11, 500000, 8, "Longo, BW 500 kHz"}, +}; +#define PRESETS_COUNT (sizeof(PRESETS) / sizeof(PRESETS[0])) + +const mt_preset_info_t *mt_preset_info(mt_preset_t id) { + for (size_t i = 0; i < PRESETS_COUNT; i++) { + if (PRESETS[i].id == id) + return &PRESETS[i]; + } + return NULL; +} + +int mt_preset_count(void) { + return (int)PRESETS_COUNT; +} + +mt_preset_t mt_preset_current(void) { + uint32_t value = mt_nvs_get_u32(MT_PRESET_NVS_KEY, (uint32_t)MT_PRESET_LONG_FAST); + return (mt_preset_t)value; +} + +void mt_preset_set(mt_preset_t id) { + const mt_preset_info_t *info = mt_preset_info(id); + if (info == NULL) { + ESP_LOGW(TAG, "Preset invalid: %d", (int)id); + return; + } + mt_nvs_set_u32(MT_PRESET_NVS_KEY, (uint32_t)id); + ESP_LOGI(TAG, + "Preset applied: %s (SF%u BW%lu CR4/%u)", + info->name, + info->sf, + (unsigned long)info->bw_hz, + info->cr); +} + +uint8_t mt_preset_bw_to_sx1262(uint32_t bw_hz) { + if (bw_hz <= 7812) + return SX1262_LORA_BW_7; + if (bw_hz <= 10420) + return SX1262_LORA_BW_10; + if (bw_hz <= 15630) + return SX1262_LORA_BW_15; + if (bw_hz <= 20830) + return SX1262_LORA_BW_20; + if (bw_hz <= 31250) + return SX1262_LORA_BW_31; + if (bw_hz <= 41670) + return SX1262_LORA_BW_41; + if (bw_hz <= 62500) + return SX1262_LORA_BW_62; + if (bw_hz <= 125000) + return SX1262_LORA_BW_125; + if (bw_hz <= 250000) + return SX1262_LORA_BW_250; + return SX1262_LORA_BW_500; +} diff --git a/firmware_p4/components/Applications/LoRa/meshtastic/meshtastic_regions.c b/firmware_p4/components/Applications/LoRa/meshtastic/meshtastic_regions.c new file mode 100644 index 00000000..9a41f6f8 --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/meshtastic/meshtastic_regions.c @@ -0,0 +1,102 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#include "meshtastic_regions.h" + +#include "esp_log.h" + +#include "meshtastic_nvs.h" + +static const char *TAG = "MESHTASTIC_REGIONS"; + +#define MT_REGION_NVS_KEY "region" +#define MT_REGION_FALLBACK_FREQ_HZ 906875000 + +static const mt_region_info_t REGIONS[] = { + {MT_REGION_UNSET, "UNSET", 902000000, 928000000, 100, 30, false}, + {MT_REGION_US, "US", 902000000, 928000000, 100, 30, false}, + {MT_REGION_EU_433, "EU_433", 433000000, 434000000, 10, 10, false}, + {MT_REGION_EU_868, "EU_868", 869400000, 869650000, 10, 27, false}, + {MT_REGION_CN, "CN", 470000000, 510000000, 100, 19, false}, + {MT_REGION_JP, "JP", 920500000, 923500000, 100, 13, false}, + {MT_REGION_ANZ, "ANZ", 915000000, 928000000, 100, 30, false}, + {MT_REGION_KR, "KR", 920000000, 923000000, 100, 23, false}, + {MT_REGION_TW, "TW", 920000000, 925000000, 100, 27, false}, + {MT_REGION_RU, "RU", 868700000, 869200000, 100, 20, false}, + {MT_REGION_IN, "IN", 865000000, 867000000, 100, 30, false}, + {MT_REGION_NZ_865, "NZ_865", 864000000, 868000000, 100, 36, false}, + {MT_REGION_TH, "TH", 920000000, 925000000, 10, 27, false}, + {MT_REGION_LORA_24, "LORA_24", 2400000000U, 2483500000U, 100, 10, true}, + {MT_REGION_UA_433, "UA_433", 433000000, 434700000, 10, 10, false}, + {MT_REGION_UA_868, "UA_868", 868000000, 868600000, 1, 14, false}, + {MT_REGION_MY_433, "MY_433", 433000000, 435000000, 100, 20, false}, + {MT_REGION_MY_919, "MY_919", 919000000, 924000000, 100, 27, true}, + {MT_REGION_SG_923, "SG_923", 917000000, 925000000, 100, 20, false}, + {MT_REGION_PH_433, "PH_433", 433000000, 434700000, 100, 10, false}, + {MT_REGION_PH_868, "PH_868", 868000000, 869400000, 100, 14, false}, + {MT_REGION_PH_915, "PH_915", 915000000, 918000000, 100, 24, false}, + {MT_REGION_ANZ_433, "ANZ_433", 433050000, 434790000, 100, 14, false}, + {MT_REGION_KZ_433, "KZ_433", 433075000, 434775000, 100, 10, false}, + {MT_REGION_KZ_863, "KZ_863", 863000000, 868000000, 100, 30, false}, + {MT_REGION_NP_865, "NP_865", 865000000, 868000000, 100, 30, false}, + {MT_REGION_BR_902, "BR_902", 902000000, 907500000, 100, 30, false}, +}; +#define REGIONS_COUNT (sizeof(REGIONS) / sizeof(REGIONS[0])) + +const mt_region_info_t *mt_region_info(mt_region_t id) { + for (size_t i = 0; i < REGIONS_COUNT; i++) { + if (REGIONS[i].id == id) + return ®IONS[i]; + } + return NULL; +} + +int mt_region_count(void) { + return (int)REGIONS_COUNT; +} + +mt_region_t mt_region_current(void) { + uint32_t value = mt_nvs_get_u32(MT_REGION_NVS_KEY, (uint32_t)MT_REGION_US); + return (mt_region_t)value; +} + +void mt_region_set(mt_region_t id) { + const mt_region_info_t *info = mt_region_info(id); + if (info == NULL) { + ESP_LOGW(TAG, "Region invalid: %d", (int)id); + return; + } + mt_nvs_set_u32(MT_REGION_NVS_KEY, (uint32_t)id); + ESP_LOGI(TAG, + "Region applied: %s (%lu-%lu Hz, duty=%u%%, pwr_max=%ddBm)", + info->name, + (unsigned long)info->freq_start_hz, + (unsigned long)info->freq_stop_hz, + info->duty_pct, + info->tx_pwr_max_dbm); +} + +uint32_t mt_region_freq_for_channel(mt_region_t id, uint8_t channel_num, uint32_t bw_hz) { + const mt_region_info_t *info = mt_region_info(id); + if (info == NULL) + return MT_REGION_FALLBACK_FREQ_HZ; + + uint32_t span = info->freq_stop_hz - info->freq_start_hz; + uint32_t num_channels = span / bw_hz; + if (num_channels == 0) + num_channels = 1; + uint8_t ch = channel_num % num_channels; + return info->freq_start_hz + (bw_hz / 2) + (ch * bw_hz); +} diff --git a/firmware_p4/components/Applications/LoRa/meshtastic/meshtastic_roles.c b/firmware_p4/components/Applications/LoRa/meshtastic/meshtastic_roles.c new file mode 100644 index 00000000..33be8105 --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/meshtastic/meshtastic_roles.c @@ -0,0 +1,186 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#include "meshtastic_roles.h" + +#include "esp_log.h" + +#include "meshtastic_nvs.h" + +static const char *TAG = "MESHTASTIC_ROLES"; + +#define MT_ROLE_NVS_KEY "role" +#define MT_REBR_NVS_KEY "rebr" + +static const char *ROLE_NAMES[MT_ROLE_COUNT] = { + "CLIENT", + "CLIENT_MUTE", + "ROUTER", + "ROUTER_CLIENT", + "REPEATER", + "TRACKER", + "SENSOR", + "TAK", + "CLIENT_HIDDEN", + "LOST_AND_FOUND", + "TAK_TRACKER", + "ROUTER_LATE", + "CLIENT_BASE", +}; + +static bool is_core_portnum(uint32_t portnum) { + return portnum == 1 || portnum == 3 || portnum == 4 || portnum == 5 || portnum == 7 || + portnum == 67 || portnum == 70; +} + +mt_role_t mt_role_current(void) { + uint32_t value = mt_nvs_get_u32(MT_ROLE_NVS_KEY, (uint32_t)MT_ROLE_CLIENT); + return (mt_role_t)value; +} + +void mt_role_set(mt_role_t role) { + mt_nvs_set_u32(MT_ROLE_NVS_KEY, (uint32_t)role); + ESP_LOGI(TAG, "Role applied: %s", mt_role_name(role)); + + mt_rebr_mode_t mode; + if (role == MT_ROLE_ROUTER || role == MT_ROLE_ROUTER_LATE) { + mode = MT_REBR_CORE_PORTNUMS_ONLY; + } else if (role == MT_ROLE_CLIENT_HIDDEN) { + mode = MT_REBR_LOCAL_ONLY; + } else if (role == MT_ROLE_REPEATER) { + mode = MT_REBR_ALL_SKIP_DECODING; + } else { + mode = MT_REBR_ALL; + } + mt_rebr_mode_set(mode); +} + +const char *mt_role_name(mt_role_t role) { + if (role < MT_ROLE_COUNT) + return ROLE_NAMES[role]; + return "UNKNOWN"; +} + +mt_rebr_mode_t mt_rebr_mode_current(void) { + uint32_t value = mt_nvs_get_u32(MT_REBR_NVS_KEY, (uint32_t)MT_REBR_ALL); + return (mt_rebr_mode_t)value; +} + +void mt_rebr_mode_set(mt_rebr_mode_t mode) { + mt_nvs_set_u32(MT_REBR_NVS_KEY, (uint32_t)mode); +} + +bool mt_role_is_rebroadcaster(mt_role_t role) { + if (role == MT_ROLE_CLIENT_MUTE) + return false; + return true; +} + +bool mt_role_cancels_on_duplicate(mt_role_t role) { + if (role == MT_ROLE_ROUTER || role == MT_ROLE_ROUTER_LATE || role == MT_ROLE_REPEATER) { + return false; + } + return true; +} + +bool mt_role_is_late_rebroadcaster(mt_role_t role) { + return role == MT_ROLE_ROUTER_LATE; +} + +bool mt_rebr_should_forward(mt_rebr_mode_t mode, uint32_t portnum, bool is_from_known) { + switch (mode) { + case MT_REBR_NONE: + return false; + case MT_REBR_LOCAL_ONLY: + return portnum != 0; + case MT_REBR_KNOWN_ONLY: + return is_from_known; + case MT_REBR_CORE_PORTNUMS_ONLY: + return is_core_portnum(portnum); + case MT_REBR_ALL_SKIP_DECODING: + case MT_REBR_ALL: + default: + return true; + } +} + +uint32_t mt_role_nodeinfo_interval_secs(mt_role_t role) { + switch (role) { + case MT_ROLE_ROUTER: + case MT_ROLE_ROUTER_LATE: + case MT_ROLE_REPEATER: + return 10800; + case MT_ROLE_TRACKER: + case MT_ROLE_TAK_TRACKER: + return 43200; + case MT_ROLE_SENSOR: + return 43200; + case MT_ROLE_CLIENT_HIDDEN: + return 86400; + case MT_ROLE_CLIENT_MUTE: + return 0; + default: + return 900; + } +} + +uint32_t mt_role_telemetry_interval_secs(mt_role_t role) { + switch (role) { + case MT_ROLE_SENSOR: + return 900; + case MT_ROLE_TRACKER: + case MT_ROLE_TAK_TRACKER: + return 1800; + case MT_ROLE_ROUTER: + case MT_ROLE_ROUTER_LATE: + case MT_ROLE_REPEATER: + return 3600; + case MT_ROLE_CLIENT_HIDDEN: + case MT_ROLE_CLIENT_MUTE: + return 0; + default: + return 1800; + } +} + +uint32_t mt_role_position_interval_secs(mt_role_t role) { + switch (role) { + case MT_ROLE_TRACKER: + case MT_ROLE_TAK_TRACKER: + return 60; + case MT_ROLE_CLIENT: + case MT_ROLE_CLIENT_BASE: + case MT_ROLE_TAK: + case MT_ROLE_LOST_AND_FOUND: + return 900; + case MT_ROLE_ROUTER: + case MT_ROLE_ROUTER_LATE: + case MT_ROLE_REPEATER: + case MT_ROLE_CLIENT_HIDDEN: + case MT_ROLE_CLIENT_MUTE: + case MT_ROLE_SENSOR: + return 0; + default: + return 900; + } +} + +bool mt_role_is_unmessagable(mt_role_t role) { + return role == MT_ROLE_ROUTER || role == MT_ROLE_ROUTER_LATE || role == MT_ROLE_REPEATER; +} + +bool mt_role_should_respond(mt_role_t role) { + return role != MT_ROLE_CLIENT_HIDDEN && role != MT_ROLE_CLIENT_MUTE; +} diff --git a/firmware_p4/components/Applications/LoRa/meshtastic/meshtastic_wifi.c b/firmware_p4/components/Applications/LoRa/meshtastic/meshtastic_wifi.c new file mode 100644 index 00000000..e48c5b2d --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/meshtastic/meshtastic_wifi.c @@ -0,0 +1,41 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#include "meshtastic_wifi.h" + +#include "esp_log.h" + +#include "meshtastic_phone_bridge.h" + +static const char *TAG = "MESH_WIFI"; + +esp_err_t meshtastic_wifi_init(uint32_t node_num) { + (void)node_num; + esp_err_t ret = meshtastic_phone_bridge_wifi_start(); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "WiFi start failed: %s", esp_err_to_name(ret)); + } + return ret; +} + +void meshtastic_wifi_poll(void) {} + +bool meshtastic_wifi_is_connected(void) { + return meshtastic_phone_bridge_is_connected(); +} + +int meshtastic_wifi_get_client_fd(void) { + return -1; +} diff --git a/firmware_p4/components/Applications/LoRa/meshtastic/mt_mod_admin.c b/firmware_p4/components/Applications/LoRa/meshtastic/mt_mod_admin.c new file mode 100644 index 00000000..581f926a --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/meshtastic/mt_mod_admin.c @@ -0,0 +1,934 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#include "mt_mod_admin.h" + +#include +#include + +#include "esp_log.h" +#include "esp_random.h" +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" + +#include "meshtastic_channels.h" +#include "meshtastic_mesh.h" +#include "meshtastic_nodedb.h" +#include "meshtastic_nvs.h" +#include "meshtastic_pki.h" + +#include "meshtastic_roles.h" +#include "mt_mod_keyverify.h" +#include "mt_mod_nodeinfo.h" +#include "mt_mod_position.h" + +static const char *TAG = "MT_MOD_ADMIN"; + +#define MT_ADMIN_PASSKEY_TTL_SECS 300 +#define MT_ADMIN_PASSKEY_SIZE 8 +#define MT_ADMIN_HOP_LIMIT 3 +#define MT_ADMIN_HW_MODEL_PRIVATE 255 +#define MT_ADMIN_ROLE_REPEATER 4 +#define MT_ADMIN_FIRST_SET_VARIANT 32 + +#define MT_ADMIN_VARIANT_GET_CHANNEL_REQ 1 +#define MT_ADMIN_VARIANT_GET_OWNER_REQ 3 +#define MT_ADMIN_VARIANT_GET_CONFIG_REQ 5 +#define MT_ADMIN_VARIANT_GET_DEVICE_METADATA_REQ 12 + +#define MT_ADMIN_VARIANT_GET_CHANNEL_RESP 2 +#define MT_ADMIN_VARIANT_GET_OWNER_RESP 4 +#define MT_ADMIN_VARIANT_GET_CONFIG_RESP 6 +#define MT_ADMIN_VARIANT_GET_DEVICE_METADATA_RESP 13 + +#define MT_ADMIN_VARIANT_SET_OWNER 32 +#define MT_ADMIN_VARIANT_SET_CHANNEL 33 +#define MT_ADMIN_VARIANT_SET_CONFIG 34 +#define MT_ADMIN_VARIANT_SET_FAVORITE 39 +#define MT_ADMIN_VARIANT_REMOVE_FAVORITE 40 +#define MT_ADMIN_VARIANT_SET_FIXED_POSITION 41 +#define MT_ADMIN_VARIANT_REMOVE_FIXED_POS 42 +#define MT_ADMIN_VARIANT_SET_TIME_ONLY 43 +#define MT_ADMIN_VARIANT_BEGIN_EDIT 64 +#define MT_ADMIN_VARIANT_COMMIT_EDIT 65 + +#define MT_ADMIN_VARIANT_KEY_VERIFICATION 67 +#define MT_ADMIN_VARIANT_SESSION_PASSKEY 101 + +#define MT_ADMIN_MAX_KEYS 3 +#define MT_ADMIN_KEY_LEN 32 +#define MT_ADMIN_KEYS_NVS_KEY "admin_keys" + +static uint8_t s_session_passkey[MT_ADMIN_PASSKEY_SIZE]; +static uint32_t s_passkey_set_s = 0; +static uint32_t s_node_num = 0; +static bool s_is_edit_transaction_open = false; +static uint8_t s_admin_keys[MT_ADMIN_MAX_KEYS][MT_ADMIN_KEY_LEN]; + +static uint16_t enc_varint(uint8_t *buf, uint64_t value) { + uint16_t pos = 0; + do { + uint8_t byte = value & 0x7F; + value >>= 7; + if (value) + byte |= 0x80; + buf[pos++] = byte; + } while (value); + return pos; +} + +static uint16_t enc_tag(uint8_t *buf, uint32_t field_num, uint8_t wire_type) { + return enc_varint(buf, ((uint64_t)field_num << 3) | (wire_type & 0x07)); +} + +static uint16_t enc_field_varint(uint8_t *buf, uint32_t field_num, uint64_t value) { + uint16_t pos = enc_tag(buf, field_num, 0); + pos += enc_varint(&buf[pos], value); + return pos; +} + +static uint16_t +enc_field_bytes(uint8_t *buf, uint32_t field_num, const uint8_t *data, uint16_t len) { + uint16_t pos = enc_tag(buf, field_num, 2); + pos += enc_varint(&buf[pos], len); + if (len > 0 && data != NULL) { + memcpy(&buf[pos], data, len); + } + return pos + len; +} + +static uint16_t enc_field_fixed32(uint8_t *buf, uint32_t field_num, uint32_t value) { + uint16_t pos = enc_tag(buf, field_num, 5); + buf[pos++] = (uint8_t)(value & 0xFF); + buf[pos++] = (uint8_t)((value >> 8) & 0xFF); + buf[pos++] = (uint8_t)((value >> 16) & 0xFF); + buf[pos++] = (uint8_t)((value >> 24) & 0xFF); + return pos; +} + +static uint64_t dec_varint(const uint8_t *buf, uint16_t max_len, uint16_t *out_used) { + uint64_t value = 0; + uint16_t shift = 0; + uint16_t i = 0; + while (i < max_len && i < 10) { + uint8_t byte = buf[i++]; + value |= ((uint64_t)(byte & 0x7F)) << shift; + if (!(byte & 0x80)) + break; + shift += 7; + } + if (out_used != NULL) + *out_used = i; + return value; +} + +static void regen_passkey(uint32_t now_s) { + for (int i = 0; i < MT_ADMIN_PASSKEY_SIZE; i++) { + s_session_passkey[i] = (uint8_t)(esp_random() & 0xFF); + } + s_passkey_set_s = now_s; +} + +static bool is_passkey_valid(const uint8_t *provided, uint16_t provided_len) { + uint32_t now_s = (uint32_t)(xTaskGetTickCount() * portTICK_PERIOD_MS / 1000); + if (now_s - s_passkey_set_s > MT_ADMIN_PASSKEY_TTL_SECS) + return false; + if (provided_len != MT_ADMIN_PASSKEY_SIZE) + return false; + return memcmp(provided, s_session_passkey, MT_ADMIN_PASSKEY_SIZE) == 0; +} + +static bool admin_keys_any_set(void) { + for (int i = 0; i < MT_ADMIN_MAX_KEYS; i++) { + for (int k = 0; k < MT_ADMIN_KEY_LEN; k++) { + if (s_admin_keys[i][k] != 0) + return true; + } + } + return false; +} + +static bool is_sender_admin_authorized(uint32_t from_node) { + if (!admin_keys_any_set()) + return true; + + const mt_node_entry_t *e = mt_nodedb_get(from_node); + if (e == NULL || !e->has_public_key) + return false; + + for (int i = 0; i < MT_ADMIN_MAX_KEYS; i++) { + bool slot_zero = true; + for (int k = 0; k < MT_ADMIN_KEY_LEN; k++) { + if (s_admin_keys[i][k] != 0) { + slot_zero = false; + break; + } + } + if (slot_zero) + continue; + if (memcmp(s_admin_keys[i], e->public_key, MT_ADMIN_KEY_LEN) == 0) { + return true; + } + } + return false; +} + +static void admin_keys_load(void) { + memset(s_admin_keys, 0, sizeof(s_admin_keys)); + mt_nvs_get_blob(MT_ADMIN_KEYS_NVS_KEY, s_admin_keys, sizeof(s_admin_keys)); +} + +static void admin_keys_save(void) { + mt_nvs_set_blob(MT_ADMIN_KEYS_NVS_KEY, s_admin_keys, sizeof(s_admin_keys)); +} + +static void admin_keys_set_from_security_config(const uint8_t *security_bytes, uint16_t len) { + uint8_t new_keys[MT_ADMIN_MAX_KEYS][MT_ADMIN_KEY_LEN] = {{0}}; + uint8_t count = 0; + + uint16_t i = 0; + while (i < len && count < MT_ADMIN_MAX_KEYS) { + uint16_t used = 0; + uint64_t tag = dec_varint(&security_bytes[i], len - i, &used); + if (used == 0) + break; + i += used; + uint32_t field = (uint32_t)(tag >> 3); + uint32_t wire_type = (uint32_t)(tag & 0x07); + + if (wire_type == 2) { + uint16_t lused = 0; + uint32_t length = (uint32_t)dec_varint(&security_bytes[i], len - i, &lused); + i += lused; + if (i + length > len) + break; + if (field == 3 && length == MT_ADMIN_KEY_LEN) { + memcpy(new_keys[count++], &security_bytes[i], MT_ADMIN_KEY_LEN); + } + i += length; + } else if (wire_type == 0) { + uint16_t vused = 0; + dec_varint(&security_bytes[i], len - i, &vused); + i += vused; + } else { + break; + } + } + + memcpy(s_admin_keys, new_keys, sizeof(s_admin_keys)); + admin_keys_save(); + ESP_LOGI(TAG, "admin_keys updated: %u slot(s) configured", count); +} + +static uint16_t build_user(uint8_t *out) { + uint16_t pos = 0; + char id_str[16]; + snprintf(id_str, sizeof(id_str), "!%08lx", (unsigned long)s_node_num); + pos += enc_field_bytes(&out[pos], 1, (const uint8_t *)id_str, (uint16_t)strlen(id_str)); + const char *long_name = mt_mod_nodeinfo_get_long(); + const char *short_name = mt_mod_nodeinfo_get_short(); + pos += enc_field_bytes(&out[pos], 2, (const uint8_t *)long_name, (uint16_t)strlen(long_name)); + pos += enc_field_bytes(&out[pos], 3, (const uint8_t *)short_name, (uint16_t)strlen(short_name)); + pos += enc_field_varint(&out[pos], 5, MT_ADMIN_HW_MODEL_PRIVATE); + return pos; +} + +static uint16_t wrap_admin(uint8_t *out, + uint8_t variant_field, + const uint8_t *variant_data, + uint16_t variant_len, + bool include_passkey, + uint32_t now_s) { + uint16_t pos = 0; + pos += enc_field_bytes(&out[pos], variant_field, variant_data, variant_len); + if (include_passkey) { + regen_passkey(now_s); + pos += enc_field_bytes( + &out[pos], MT_ADMIN_VARIANT_SESSION_PASSKEY, s_session_passkey, MT_ADMIN_PASSKEY_SIZE); + } + return pos; +} + +static void handle_get_owner(const mt_packet_meta_t *meta, uint32_t now_s) { + uint8_t user[96]; + uint16_t ulen = build_user(user); + + uint8_t admin[128]; + uint16_t alen = wrap_admin(admin, MT_ADMIN_VARIANT_GET_OWNER_RESP, user, ulen, true, now_s); + + ESP_LOGI(TAG, "get_owner -> 0x%08lX", (unsigned long)meta->from); + meshtastic_mesh_send_data(meta->from, + meta->channel, + MT_ADMIN_HOP_LIMIT, + MT_PORT_ADMIN, + admin, + alen, + meta->id, + false, + false); +} + +static void +handle_set_owner(const mt_packet_meta_t *meta, const uint8_t *user_bytes, uint16_t user_len) { + (void)meta; + char long_name[32] = {0}; + char short_name[8] = {0}; + + uint16_t i = 0; + while (i < user_len) { + uint16_t used = 0; + uint64_t tag = dec_varint(&user_bytes[i], user_len - i, &used); + if (used == 0) + break; + i += used; + uint32_t field = (uint32_t)(tag >> 3); + uint32_t wire_type = (uint32_t)(tag & 0x07); + + if (wire_type == 2) { + uint16_t len_used = 0; + uint32_t length = (uint32_t)dec_varint(&user_bytes[i], user_len - i, &len_used); + i += len_used; + if (i + length > user_len) + break; + if (field == 2) { + uint32_t copy = length < sizeof(long_name) - 1 ? length : sizeof(long_name) - 1; + memcpy(long_name, &user_bytes[i], copy); + long_name[copy] = 0; + } else if (field == 3) { + uint32_t copy = length < sizeof(short_name) - 1 ? length : sizeof(short_name) - 1; + memcpy(short_name, &user_bytes[i], copy); + short_name[copy] = 0; + } + i += length; + } else if (wire_type == 0) { + uint16_t vused = 0; + dec_varint(&user_bytes[i], user_len - i, &vused); + i += vused; + } else { + break; + } + } + + mt_mod_nodeinfo_set_name(long_name[0] ? long_name : NULL, short_name[0] ? short_name : NULL); + ESP_LOGI(TAG, "set_owner - '%s' / '%s'", long_name, short_name); +} + +static void handle_get_channel(const mt_packet_meta_t *meta, uint8_t idx, uint32_t now_s) { + const mt_channel_t *ch = mt_channel_get(idx); + + uint8_t channel[160]; + uint16_t cl = 0; + cl += enc_field_varint(&channel[cl], 1, idx); + + if (ch != NULL && ch->is_used) { + uint8_t settings[96]; + uint16_t sl = 0; + sl += enc_field_bytes(&settings[sl], 2, ch->psk, MT_PSK_SIZE); + size_t name_len = strlen(ch->name); + if (name_len > 0) { + sl += enc_field_bytes(&settings[sl], 3, (const uint8_t *)ch->name, (uint16_t)name_len); + } + if (ch->id != 0) { + sl += enc_field_fixed32(&settings[sl], 4, ch->id); + } + + cl += enc_field_bytes(&channel[cl], 2, settings, sl); + cl += enc_field_varint(&channel[cl], 3, (uint64_t)ch->role); + } else { + cl += enc_field_varint(&channel[cl], 3, 0); + } + + uint8_t admin[192]; + uint16_t alen = wrap_admin(admin, MT_ADMIN_VARIANT_GET_CHANNEL_RESP, channel, cl, true, now_s); + + ESP_LOGI(TAG, + "get_channel[%u] role=%d -> 0x%08lX", + idx, + ch ? (int)ch->role : 0, + (unsigned long)meta->from); + meshtastic_mesh_send_data(meta->from, + meta->channel, + MT_ADMIN_HOP_LIMIT, + MT_PORT_ADMIN, + admin, + alen, + meta->id, + false, + false); +} + +static void handle_set_channel(const uint8_t *channel_bytes, uint16_t len) { + int32_t index = 0; + uint8_t role = MT_CH_DISABLED; + bool has_role = false; + const uint8_t *settings_ptr = NULL; + uint16_t settings_len = 0; + + uint16_t i = 0; + while (i < len) { + uint16_t used = 0; + uint64_t tag = dec_varint(&channel_bytes[i], len - i, &used); + if (used == 0) + break; + i += used; + uint32_t field = (uint32_t)(tag >> 3); + uint32_t wire_type = (uint32_t)(tag & 0x07); + + if (wire_type == 0) { + uint16_t vused = 0; + uint64_t value = dec_varint(&channel_bytes[i], len - i, &vused); + i += vused; + if (field == 1) + index = (int32_t)value; + else if (field == 3) { + role = (uint8_t)value; + has_role = true; + } + } else if (wire_type == 2) { + uint16_t lused = 0; + uint32_t length = (uint32_t)dec_varint(&channel_bytes[i], len - i, &lused); + i += lused; + if (i + length > len) + break; + if (field == 2) { + settings_ptr = &channel_bytes[i]; + settings_len = (uint16_t)length; + } + i += length; + } else { + break; + } + } + + if (index < 0 || index >= MT_MAX_CHANNELS) { + ESP_LOGW(TAG, "set_channel: index %ld out of range [0..%d)", (long)index, MT_MAX_CHANNELS); + return; + } + if (!has_role) { + ESP_LOGW(TAG, "set_channel[%ld]: missing role, ignoring", (long)index); + return; + } + if (role == MT_CH_DISABLED) { + mt_channel_disable((uint8_t)index); + ESP_LOGI(TAG, "set_channel[%ld] disabled", (long)index); + return; + } + + const uint8_t *psk_ptr = NULL; + uint16_t psk_len = 0; + char name[32] = {0}; + bool has_name = false; + uint32_t ch_id = 0; + bool has_id = false; + + i = 0; + while (settings_ptr != NULL && i < settings_len) { + uint16_t used = 0; + uint64_t tag = dec_varint(&settings_ptr[i], settings_len - i, &used); + if (used == 0) + break; + i += used; + uint32_t field = (uint32_t)(tag >> 3); + uint32_t wire_type = (uint32_t)(tag & 0x07); + + if (wire_type == 2) { + uint16_t lused = 0; + uint32_t length = (uint32_t)dec_varint(&settings_ptr[i], settings_len - i, &lused); + i += lused; + if (i + length > settings_len) + break; + if (field == 2) { + psk_ptr = &settings_ptr[i]; + psk_len = (uint16_t)length; + } else if (field == 3) { + uint16_t copy = length < sizeof(name) - 1 ? (uint16_t)length : sizeof(name) - 1; + memcpy(name, &settings_ptr[i], copy); + name[copy] = 0; + has_name = true; + } + i += length; + } else if (wire_type == 0) { + uint16_t vused = 0; + dec_varint(&settings_ptr[i], settings_len - i, &vused); + i += vused; + } else if (wire_type == 5) { + if (i + 4 > settings_len) + break; + if (field == 4) { + ch_id = ((uint32_t)settings_ptr[i]) | ((uint32_t)settings_ptr[i + 1] << 8) | + ((uint32_t)settings_ptr[i + 2] << 16) | ((uint32_t)settings_ptr[i + 3] << 24); + has_id = true; + } + i += 4; + } else { + break; + } + } + + const uint8_t *psk_to_save = NULL; + if (psk_ptr != NULL && psk_len == MT_PSK_SIZE) { + psk_to_save = psk_ptr; + } else if (psk_ptr != NULL && psk_len > 0) { + ESP_LOGW(TAG, + "set_channel[%ld]: PSK %u bytes - only %d supported, keeping current PSK", + (long)index, + psk_len, + MT_PSK_SIZE); + } + + mt_channel_set((uint8_t)index, has_name ? name : NULL, psk_to_save, (mt_channel_role_t)role); + if (has_id) { + mt_channel_set_id((uint8_t)index, ch_id); + } + ESP_LOGI(TAG, + "set_channel[%ld] role=%u name='%s' psk=%s id=0x%08lx", + (long)index, + role, + has_name ? name : "(kept)", + psk_to_save ? "updated" : "mantido", + (unsigned long)(has_id ? ch_id : 0)); +} + +static void handle_get_device_metadata(const mt_packet_meta_t *meta, uint32_t now_s) { + uint8_t metadata[96]; + uint16_t mlen = 0; + const char *version = "2.7.0-highboy"; + mlen += enc_field_bytes(&metadata[mlen], 1, (const uint8_t *)version, (uint16_t)strlen(version)); + mlen += enc_field_varint(&metadata[mlen], 3, 4); + mlen += enc_field_varint(&metadata[mlen], 4, 1); + mlen += enc_field_varint(&metadata[mlen], 8, MT_ADMIN_HW_MODEL_PRIVATE); + mlen += enc_field_varint(&metadata[mlen], 9, MT_ADMIN_ROLE_REPEATER); + + uint8_t admin[128]; + uint16_t alen = + wrap_admin(admin, MT_ADMIN_VARIANT_GET_DEVICE_METADATA_RESP, metadata, mlen, true, now_s); + + ESP_LOGI(TAG, "get_device_metadata -> 0x%08lX", (unsigned long)meta->from); + meshtastic_mesh_send_data(meta->from, + meta->channel, + MT_ADMIN_HOP_LIMIT, + MT_PORT_ADMIN, + admin, + alen, + meta->id, + false, + false); +} + +static uint16_t build_config_for_type(uint8_t *out, uint8_t config_type) { + uint8_t oneof_field = (uint8_t)(config_type + 1); + + if (config_type == 5) { + uint8_t lora[48]; + uint16_t ll = 0; + ll += enc_field_varint(&lora[ll], 1, 1); + ll += enc_field_varint(&lora[ll], 2, 0); + ll += enc_field_varint(&lora[ll], 3, 250); + ll += enc_field_varint(&lora[ll], 4, 11); + ll += enc_field_varint(&lora[ll], 5, 5); + ll += enc_field_varint(&lora[ll], 7, 1); + ll += enc_field_varint(&lora[ll], 8, 3); + ll += enc_field_varint(&lora[ll], 9, 1); + ll += enc_field_varint(&lora[ll], 10, 22); + ll += enc_field_varint(&lora[ll], 11, 0); + ll += enc_field_varint(&lora[ll], 13, 1); + return enc_field_bytes(out, oneof_field, lora, ll); + } + + if (config_type == 7) { + uint8_t sec[192]; + uint16_t sl = 0; + sl += enc_field_bytes(&sec[sl], 1, mt_pki_get_pubkey(), MT_PKI_KEY_LEN); + sl += enc_field_bytes(&sec[sl], 2, mt_pki_get_privkey(), MT_PKI_KEY_LEN); + for (int k = 0; k < MT_ADMIN_MAX_KEYS; k++) { + bool zero = true; + for (int b = 0; b < MT_ADMIN_KEY_LEN; b++) { + if (s_admin_keys[k][b] != 0) { + zero = false; + break; + } + } + if (!zero) { + sl += enc_field_bytes(&sec[sl], 3, s_admin_keys[k], MT_ADMIN_KEY_LEN); + } + } + return enc_field_bytes(out, oneof_field, sec, sl); + } + + out[0] = (uint8_t)((oneof_field << 3) | 2); + out[1] = 0; + return 2; +} + +static void parse_device_config(const uint8_t *buf, uint16_t len) { + uint16_t i = 0; + while (i < len) { + uint16_t used = 0; + uint64_t tag = dec_varint(&buf[i], len - i, &used); + if (used == 0) + break; + i += used; + uint32_t field = (uint32_t)(tag >> 3); + uint32_t wire_type = (uint32_t)(tag & 0x07); + + if (wire_type == 0) { + uint16_t vused = 0; + uint64_t value = dec_varint(&buf[i], len - i, &vused); + i += vused; + if (field == 1) { + mt_role_t new_role = (mt_role_t)value; + if (new_role < MT_ROLE_COUNT) { + mt_role_set(new_role); + ESP_LOGI(TAG, "DeviceConfig.role -> %s", mt_role_name(new_role)); + } else { + ESP_LOGW(TAG, "DeviceConfig.role invalid: %llu", (unsigned long long)value); + } + } else if (field == 6) { + mt_rebr_mode_t new_mode = (mt_rebr_mode_t)value; + if (new_mode < MT_REBR_COUNT) { + mt_rebr_mode_set(new_mode); + ESP_LOGI(TAG, "DeviceConfig.rebroadcast_mode -> %d", (int)new_mode); + } + } + } else if (wire_type == 2) { + uint16_t lused = 0; + uint32_t length = (uint32_t)dec_varint(&buf[i], len - i, &lused); + i += lused + length; + } else if (wire_type == 5) { + i += 4; + } else { + break; + } + } +} + +static void handle_set_config(const uint8_t *cfg_bytes, uint16_t len) { + uint16_t i = 0; + while (i < len) { + uint16_t used = 0; + uint64_t tag = dec_varint(&cfg_bytes[i], len - i, &used); + if (used == 0) + break; + i += used; + uint32_t field = (uint32_t)(tag >> 3); + uint32_t wire_type = (uint32_t)(tag & 0x07); + + if (wire_type == 2) { + uint16_t lused = 0; + uint32_t length = (uint32_t)dec_varint(&cfg_bytes[i], len - i, &lused); + i += lused; + if (i + length > len) + break; + + if (field == 1) { + ESP_LOGI(TAG, "set_config: DeviceConfig (%lu bytes)", (unsigned long)length); + parse_device_config(&cfg_bytes[i], (uint16_t)length); + } else if (field == 8) { + ESP_LOGI(TAG, "set_config: SecurityConfig (%lu bytes)", (unsigned long)length); + admin_keys_set_from_security_config(&cfg_bytes[i], (uint16_t)length); + } else { + ESP_LOGI(TAG, + "set_config: section %lu (%lu bytes) - not implemented", + (unsigned long)field, + (unsigned long)length); + } + i += length; + } else if (wire_type == 0) { + uint16_t vused = 0; + dec_varint(&cfg_bytes[i], len - i, &vused); + i += vused; + } else if (wire_type == 5) { + i += 4; + } else { + break; + } + } +} + +static void handle_set_fixed_position(const uint8_t *pos_bytes, uint16_t len) { + int32_t lat = 0; + int32_t lon = 0; + int32_t alt = 0; + + uint16_t i = 0; + while (i < len) { + uint16_t used = 0; + uint64_t tag = dec_varint(&pos_bytes[i], len - i, &used); + if (used == 0) + break; + i += used; + uint32_t field = (uint32_t)(tag >> 3); + uint32_t wire_type = (uint32_t)(tag & 0x07); + + if (wire_type == 5) { + if (i + 4 > len) + break; + uint32_t value; + memcpy(&value, &pos_bytes[i], 4); + if (field == 1) + lat = (int32_t)value; + else if (field == 2) + lon = (int32_t)value; + i += 4; + } else if (wire_type == 0) { + uint16_t vused = 0; + uint64_t value = dec_varint(&pos_bytes[i], len - i, &vused); + i += vused; + if (field == 3) + alt = (int32_t)value; + } else { + break; + } + } + mt_mod_position_set_fixed(lat, lon, alt); +} + +static void dispatch_variant(const mt_packet_meta_t *meta, + uint32_t variant_field, + uint32_t wire_type, + const uint8_t *variant_data, + uint16_t variant_len) { + uint32_t now_s = (uint32_t)(xTaskGetTickCount() * portTICK_PERIOD_MS / 1000); + uint64_t scalar = 0; + if (wire_type == 0 && variant_data != NULL) { + uint16_t used = 0; + scalar = dec_varint(variant_data, variant_len, &used); + } + + switch (variant_field) { + case MT_ADMIN_VARIANT_GET_CHANNEL_REQ: { + if (scalar == 0 || scalar > MT_MAX_CHANNELS) { + ESP_LOGW(TAG, + "get_channel_request=%llu out of 1..%d", + (unsigned long long)scalar, + MT_MAX_CHANNELS); + break; + } + handle_get_channel(meta, (uint8_t)(scalar - 1), now_s); + break; + } + case MT_ADMIN_VARIANT_GET_OWNER_REQ: + handle_get_owner(meta, now_s); + break; + case MT_ADMIN_VARIANT_GET_CONFIG_REQ: { + ESP_LOGI(TAG, "get_config_request type=%lu", (unsigned long)scalar); + uint8_t config[64]; + uint16_t cfg_len = build_config_for_type(config, (uint8_t)scalar); + + uint8_t admin[128]; + uint16_t alen = + wrap_admin(admin, MT_ADMIN_VARIANT_GET_CONFIG_RESP, config, cfg_len, true, now_s); + meshtastic_mesh_send_data(meta->from, + meta->channel, + MT_ADMIN_HOP_LIMIT, + MT_PORT_ADMIN, + admin, + alen, + meta->id, + false, + false); + break; + } + case MT_ADMIN_VARIANT_GET_DEVICE_METADATA_REQ: + handle_get_device_metadata(meta, now_s); + break; + + case MT_ADMIN_VARIANT_SET_OWNER: + handle_set_owner(meta, variant_data, variant_len); + break; + case MT_ADMIN_VARIANT_SET_CHANNEL: + handle_set_channel(variant_data, variant_len); + break; + case MT_ADMIN_VARIANT_SET_CONFIG: + handle_set_config(variant_data, variant_len); + break; + + case MT_ADMIN_VARIANT_SET_FIXED_POSITION: + handle_set_fixed_position(variant_data, variant_len); + break; + case MT_ADMIN_VARIANT_REMOVE_FIXED_POS: + mt_mod_position_remove_fixed(); + break; + + case MT_ADMIN_VARIANT_SET_FAVORITE: { + bool ok = mt_nodedb_set_favorite((uint32_t)scalar, true); + ESP_LOGI( + TAG, "set_favorite 0x%08lX -> %s", (unsigned long)scalar, ok ? "ok" : "no such node"); + break; + } + case MT_ADMIN_VARIANT_REMOVE_FAVORITE: { + bool ok = mt_nodedb_set_favorite((uint32_t)scalar, false); + ESP_LOGI( + TAG, "remove_favorite 0x%08lX -> %s", (unsigned long)scalar, ok ? "ok" : "no such node"); + break; + } + + case MT_ADMIN_VARIANT_SET_TIME_ONLY: { + uint32_t unix_time = 0; + if (wire_type == 5 && variant_data != NULL && variant_len >= 4) { + unix_time = (uint32_t)variant_data[0] | ((uint32_t)variant_data[1] << 8) | + ((uint32_t)variant_data[2] << 16) | ((uint32_t)variant_data[3] << 24); + } + ESP_LOGI(TAG, "set_time_only=%lu (no RTC, ignoring)", (unsigned long)unix_time); + break; + } + + case MT_ADMIN_VARIANT_BEGIN_EDIT: + s_is_edit_transaction_open = true; + ESP_LOGI(TAG, "begin_edit_settings"); + break; + case MT_ADMIN_VARIANT_COMMIT_EDIT: + s_is_edit_transaction_open = false; + mt_nvs_commit(); + ESP_LOGI(TAG, "commit_edit_settings"); + break; + + case MT_ADMIN_VARIANT_KEY_VERIFICATION: { + uint8_t message_type = 0; + uint32_t remote_nodenum = 0; + uint64_t nonce = 0; + uint32_t security_number = 0; + bool has_security = false; + + uint16_t j = 0; + while (j < variant_len) { + uint16_t uu = 0; + uint64_t t = dec_varint(&variant_data[j], variant_len - j, &uu); + if (uu == 0) + break; + j += uu; + uint32_t f = (uint32_t)(t >> 3); + uint32_t wt = (uint32_t)(t & 0x07); + if (wt == 0) { + uint16_t vu = 0; + uint64_t v = dec_varint(&variant_data[j], variant_len - j, &vu); + j += vu; + if (f == 1) + message_type = (uint8_t)v; + else if (f == 2) + remote_nodenum = (uint32_t)v; + else if (f == 3) + nonce = v; + else if (f == 4) { + security_number = (uint32_t)v; + has_security = true; + } + } else { + break; + } + } + mt_mod_keyverify_handle_admin( + remote_nodenum, message_type, nonce, has_security, security_number); + break; + } + + default: + ESP_LOGI(TAG, "Variant %lu not implemented", (unsigned long)variant_field); + break; + } +} + +void mt_mod_admin_init(uint32_t node_num) { + s_node_num = node_num; + memset(s_session_passkey, 0, sizeof(s_session_passkey)); + s_passkey_set_s = 0; + s_is_edit_transaction_open = false; + admin_keys_load(); + ESP_LOGI(TAG, "Initialized (admin_keys: %s)", admin_keys_any_set() ? "configured" : "open mode"); +} + +void mt_mod_admin_on_received(const mt_packet_meta_t *meta, const uint8_t *payload, uint16_t len) { + if (meta->to != s_node_num && meta->to != 0xFFFFFFFF) { + return; + } + + uint32_t variant_field = 0; + uint32_t wire_type = 0; + const uint8_t *variant_data = NULL; + uint16_t variant_len = 0; + const uint8_t *passkey = NULL; + uint16_t passkey_len = 0; + uint8_t scalar_buf[16]; + + uint16_t i = 0; + while (i < len) { + uint16_t used = 0; + uint64_t tag = dec_varint(&payload[i], len - i, &used); + if (used == 0) + break; + i += used; + uint32_t field = (uint32_t)(tag >> 3); + uint32_t wt = (uint32_t)(tag & 0x07); + + if (wt == 2) { + uint16_t len_used = 0; + uint32_t length = (uint32_t)dec_varint(&payload[i], len - i, &len_used); + i += len_used; + if (i + length > len) + break; + if (field == MT_ADMIN_VARIANT_SESSION_PASSKEY) { + passkey = &payload[i]; + passkey_len = (uint16_t)length; + } else { + variant_field = field; + wire_type = 2; + variant_data = &payload[i]; + variant_len = (uint16_t)length; + } + i += length; + } else if (wt == 0) { + uint16_t vused = 0; + uint64_t scalar_val = dec_varint(&payload[i], len - i, &vused); + i += vused; + variant_field = field; + wire_type = 0; + uint16_t scalar_len = enc_varint(scalar_buf, scalar_val); + variant_data = scalar_buf; + variant_len = scalar_len; + } else if (wt == 5) { + if (i + 4 > len) + break; + variant_field = field; + wire_type = 5; + variant_data = &payload[i]; + variant_len = 4; + i += 4; + } else { + break; + } + } + + bool requires_passkey = (variant_field >= MT_ADMIN_FIRST_SET_VARIANT); + bool is_local = (meta->from == 0 || meta->from == s_node_num); + + if (requires_passkey && !is_local) { + if (!is_passkey_valid(passkey, passkey_len)) { + ESP_LOGW( + TAG, "Variant=%lu REJECTED (passkey invalid or expired)", (unsigned long)variant_field); + return; + } + if (!is_sender_admin_authorized(meta->from)) { + ESP_LOGW(TAG, + "Variant=%lu REJECTED (sender 0x%08lX not in admin_keys)", + (unsigned long)variant_field, + (unsigned long)meta->from); + return; + } + } + + dispatch_variant(meta, variant_field, wire_type, variant_data, variant_len); +} + +void mt_mod_admin_tick(void) {} diff --git a/firmware_p4/components/Applications/LoRa/meshtastic/mt_mod_keyverify.c b/firmware_p4/components/Applications/LoRa/meshtastic/mt_mod_keyverify.c new file mode 100644 index 00000000..698a234c --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/meshtastic/mt_mod_keyverify.c @@ -0,0 +1,270 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#include "mt_mod_keyverify.h" + +#include + +#include "esp_log.h" +#include "esp_random.h" +#include "mbedtls/sha256.h" + +#include "meshtastic_mesh.h" +#include "meshtastic_nodedb.h" +#include "meshtastic_pki.h" + +static const char *TAG = "MT_MOD_KEYVERIFY"; + +#define KV_STATE_IDLE 0 +#define KV_STATE_SENDER_INITIATED 1 +#define KV_STATE_SENDER_AWAITING_CODE 2 +#define KV_STATE_RECEIVER_AWAITING_H1 3 + +#define KV_MSG_INITIATE 0 +#define KV_MSG_PROVIDE_SECURITY 1 +#define KV_MSG_DO_VERIFY 2 +#define KV_MSG_DO_NOT_VERIFY 3 + +#define KV_HOP_LIMIT 3 + +static uint32_t s_node_num = 0; +static uint8_t s_state = KV_STATE_IDLE; +static uint32_t s_remote_node = 0; +static uint64_t s_nonce = 0; +static uint8_t s_hash1[32]; +static uint8_t s_hash2[32]; + +static uint16_t enc_varint(uint8_t *buf, uint64_t value) { + uint16_t pos = 0; + do { + uint8_t byte = value & 0x7F; + value >>= 7; + if (value) + byte |= 0x80; + buf[pos++] = byte; + } while (value); + return pos; +} + +static uint16_t enc_field_varint(uint8_t *buf, uint8_t field, uint64_t v) { + buf[0] = (field << 3) | 0; + return 1 + enc_varint(&buf[1], v); +} + +static uint16_t enc_field_bytes(uint8_t *buf, uint8_t field, const uint8_t *data, uint16_t len) { + buf[0] = (field << 3) | 2; + uint16_t pos = 1 + enc_varint(&buf[1], len); + memcpy(&buf[pos], data, len); + return pos + len; +} + +static uint64_t dec_varint(const uint8_t *buf, uint16_t max_len, uint16_t *out_used) { + uint64_t value = 0; + uint16_t shift = 0; + uint16_t i = 0; + while (i < max_len && i < 10) { + uint8_t byte = buf[i++]; + value |= ((uint64_t)(byte & 0x7F)) << shift; + if (!(byte & 0x80)) + break; + shift += 7; + } + if (out_used != NULL) + *out_used = i; + return value; +} + +static void reset_state(void) { + s_state = KV_STATE_IDLE; + s_remote_node = 0; + s_nonce = 0; + memset(s_hash1, 0, sizeof(s_hash1)); + memset(s_hash2, 0, sizeof(s_hash2)); +} + +static void compute_hash2(uint8_t out[32], uint64_t nonce, const uint8_t *remote_pub) { + uint8_t buf[8 + 32 + 32]; + memcpy(buf, &nonce, 8); + memcpy(buf + 8, mt_pki_get_pubkey(), 32); + memcpy(buf + 40, remote_pub, 32); + mbedtls_sha256(buf, sizeof(buf), out, 0); +} + +static void compute_hash1(uint8_t out[32], const uint8_t hash2[32], uint32_t security_number) { + uint8_t buf[32 + 4]; + memcpy(buf, hash2, 32); + memcpy(buf + 32, &security_number, 4); + mbedtls_sha256(buf, sizeof(buf), out, 0); +} + +static void +send_kv_packet(uint32_t to, uint64_t nonce, const uint8_t *hash1, const uint8_t *hash2) { + uint8_t payload[96]; + uint16_t pl = 0; + pl += enc_field_varint(&payload[pl], 1, nonce); + if (hash1) + pl += enc_field_bytes(&payload[pl], 2, hash1, 32); + if (hash2) + pl += enc_field_bytes(&payload[pl], 3, hash2, 32); + + meshtastic_mesh_send_data( + to, 0, KV_HOP_LIMIT, MT_PORT_KEY_VERIFICATION, payload, pl, 0, false, false); +} + +void mt_mod_keyverify_init(uint32_t node_num) { + s_node_num = node_num; + reset_state(); + ESP_LOGI(TAG, "Initialized"); +} + +void mt_mod_keyverify_on_received(const mt_packet_meta_t *meta, + const uint8_t *payload, + uint16_t len) { + uint64_t nonce = 0; + const uint8_t *hash1 = NULL; + const uint8_t *hash2 = NULL; + uint16_t hash1_len = 0, hash2_len = 0; + + uint16_t i = 0; + while (i < len) { + uint16_t used = 0; + uint64_t tag = dec_varint(&payload[i], len - i, &used); + if (used == 0) + break; + i += used; + uint32_t field = (uint32_t)(tag >> 3); + uint32_t wt = (uint32_t)(tag & 0x07); + + if (wt == 0) { + uint16_t vused = 0; + uint64_t v = dec_varint(&payload[i], len - i, &vused); + i += vused; + if (field == 1) + nonce = v; + } else if (wt == 2) { + uint16_t lused = 0; + uint32_t length = (uint32_t)dec_varint(&payload[i], len - i, &lused); + i += lused; + if (i + length > len) + break; + if (field == 2) { + hash1 = &payload[i]; + hash1_len = (uint16_t)length; + } else if (field == 3) { + hash2 = &payload[i]; + hash2_len = (uint16_t)length; + } + i += length; + } else { + break; + } + } + + ESP_LOGI(TAG, + "RX from 0x%08lX nonce=%llu hash1=%u hash2=%u", + (unsigned long)meta->from, + (unsigned long long)nonce, + hash1_len, + hash2_len); + + if (s_state == KV_STATE_IDLE && hash1 == NULL && hash2 == NULL) { + const mt_node_entry_t *e = mt_nodedb_get(meta->from); + if (e == NULL || !e->has_public_key) { + ESP_LOGW(TAG, "Incoming INITIATE but sender pubkey unknown"); + return; + } + s_state = KV_STATE_RECEIVER_AWAITING_H1; + s_remote_node = meta->from; + s_nonce = nonce; + compute_hash2(s_hash2, nonce, e->public_key); + send_kv_packet(meta->from, nonce, NULL, s_hash2); + ESP_LOGI(TAG, "Sent hash2 -> 0x%08lX, awaiting hash1", (unsigned long)meta->from); + return; + } + + if (s_state == KV_STATE_SENDER_INITIATED && hash2_len == 32 && nonce == s_nonce && + meta->from == s_remote_node) { + memcpy(s_hash2, hash2, 32); + s_state = KV_STATE_SENDER_AWAITING_CODE; + ESP_LOGI(TAG, "Got hash2 from 0x%08lX - waiting user to enter code", (unsigned long)meta->from); + return; + } + + if (s_state == KV_STATE_RECEIVER_AWAITING_H1 && hash1_len == 32 && nonce == s_nonce && + meta->from == s_remote_node) { + if (memcmp(hash1, s_hash1, 32) == 0) { + ESP_LOGI(TAG, "hash1 matches - peer 0x%08lX verified", (unsigned long)meta->from); + } else { + ESP_LOGW(TAG, "hash1 mismatch for peer 0x%08lX", (unsigned long)meta->from); + } + reset_state(); + return; + } + + ESP_LOGW(TAG, "Unexpected KV packet in state=%u", s_state); +} + +void mt_mod_keyverify_handle_admin(uint32_t remote_nodenum, + uint8_t message_type, + uint64_t nonce, + bool has_security, + uint32_t security_number) { + switch (message_type) { + case KV_MSG_INITIATE: { + const mt_node_entry_t *e = mt_nodedb_get(remote_nodenum); + if (e == NULL || !e->has_public_key) { + ESP_LOGW(TAG, "INITIATE to 0x%08lX: pubkey unknown", (unsigned long)remote_nodenum); + return; + } + s_state = KV_STATE_SENDER_INITIATED; + s_remote_node = remote_nodenum; + s_nonce = (nonce != 0) ? nonce : ((uint64_t)esp_random() << 32 | esp_random()); + send_kv_packet(remote_nodenum, s_nonce, NULL, NULL); + ESP_LOGI(TAG, + "INITIATE sent to 0x%08lX nonce=%llu", + (unsigned long)remote_nodenum, + (unsigned long long)s_nonce); + break; + } + case KV_MSG_PROVIDE_SECURITY: { + if (!has_security || s_state != KV_STATE_SENDER_AWAITING_CODE || nonce != s_nonce) { + ESP_LOGW(TAG, "PROVIDE_SECURITY invalid state/nonce"); + return; + } + compute_hash1(s_hash1, s_hash2, security_number); + send_kv_packet(s_remote_node, s_nonce, s_hash1, NULL); + ESP_LOGI(TAG, + "Sent hash1 -> 0x%08lX with code=%lu", + (unsigned long)s_remote_node, + (unsigned long)security_number); + reset_state(); + break; + } + case KV_MSG_DO_VERIFY: { + if (s_remote_node != 0) { + ESP_LOGI(TAG, "User accepted verification for 0x%08lX", (unsigned long)s_remote_node); + } + reset_state(); + break; + } + case KV_MSG_DO_NOT_VERIFY: + ESP_LOGI(TAG, "User rejected verification"); + reset_state(); + break; + default: + ESP_LOGW(TAG, "Unknown KV admin message_type=%u", message_type); + break; + } +} diff --git a/firmware_p4/components/Applications/LoRa/meshtastic/mt_mod_neighborinfo.c b/firmware_p4/components/Applications/LoRa/meshtastic/mt_mod_neighborinfo.c new file mode 100644 index 00000000..84cf499c --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/meshtastic/mt_mod_neighborinfo.c @@ -0,0 +1,118 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#include "mt_mod_neighborinfo.h" + +#include + +#include "esp_log.h" + +#include "meshtastic_mesh.h" +#include "meshtastic_nodedb.h" + +static const char *TAG = "MT_MOD_NEIGHBORINFO"; + +#define NI_BROADCAST_SECS 14400 +#define NI_HOP_LIMIT 2 +#define NI_MAX_NEIGHBORS 10 +#define NI_BCAST_ADDR 0xFFFFFFFF + +static uint32_t s_node_num = 0; +static uint32_t s_last_broadcast_s = 0; + +static uint16_t enc_varint(uint8_t *buf, uint64_t value) { + uint16_t pos = 0; + do { + uint8_t byte = value & 0x7F; + value >>= 7; + if (value) + byte |= 0x80; + buf[pos++] = byte; + } while (value); + return pos; +} + +static uint16_t enc_field_varint(uint8_t *buf, uint8_t field, uint64_t v) { + buf[0] = (field << 3) | 0; + return 1 + enc_varint(&buf[1], v); +} + +static uint16_t enc_field_fixed32_f(uint8_t *buf, uint8_t field, float v) { + buf[0] = (field << 3) | 5; + memcpy(&buf[1], &v, 4); + return 5; +} + +static uint16_t enc_field_bytes(uint8_t *buf, uint8_t field, const uint8_t *data, uint16_t len) { + buf[0] = (field << 3) | 2; + uint16_t pos = 1 + enc_varint(&buf[1], len); + memcpy(&buf[pos], data, len); + return pos + len; +} + +static uint16_t build_neighbor_info(uint8_t *out) { + uint16_t pos = 0; + pos += enc_field_varint(&out[pos], 1, s_node_num); + pos += enc_field_varint(&out[pos], 2, 0); + pos += enc_field_varint(&out[pos], 3, NI_BROADCAST_SECS); + + uint16_t count = mt_nodedb_count(); + if (count > NI_MAX_NEIGHBORS) + count = NI_MAX_NEIGHBORS; + for (uint16_t i = 0; i < count; i++) { + const mt_node_entry_t *e = mt_nodedb_get_by_index(i); + if (e == NULL || e->num == 0 || e->num == s_node_num) + continue; + if (e->hops_away > 0) + continue; + + uint8_t nb[16]; + uint16_t nl = 0; + nl += enc_field_varint(&nb[nl], 1, e->num); + if (e->snr != 0.0f) { + nl += enc_field_fixed32_f(&nb[nl], 2, e->snr); + } + pos += enc_field_bytes(&out[pos], 4, nb, nl); + } + return pos; +} + +void mt_mod_neighborinfo_init(uint32_t node_num) { + s_node_num = node_num; + s_last_broadcast_s = 0; + ESP_LOGI( + TAG, "Initialized (interval=%us, max_neighbors=%d)", NI_BROADCAST_SECS, NI_MAX_NEIGHBORS); +} + +void mt_mod_neighborinfo_on_received(const mt_packet_meta_t *meta, + const uint8_t *payload, + uint16_t len) { + (void)payload; + ESP_LOGI(TAG, "NeighborInfo received from 0x%08lX (%u bytes)", (unsigned long)meta->from, len); +} + +void mt_mod_neighborinfo_tick(uint32_t now_s) { + if (s_last_broadcast_s == 0 && now_s < 60) + return; + if (s_last_broadcast_s != 0 && now_s - s_last_broadcast_s < NI_BROADCAST_SECS) + return; + s_last_broadcast_s = now_s; + + uint8_t frame[192]; + uint16_t flen = build_neighbor_info(frame); + ESP_LOGI(TAG, "Broadcast NeighborInfo (%u bytes)", flen); + meshtastic_mesh_send_data( + NI_BCAST_ADDR, 0, NI_HOP_LIMIT, MT_PORT_NEIGHBORINFO, frame, flen, 0, false, false); +} diff --git a/firmware_p4/components/Applications/LoRa/meshtastic/mt_mod_nodeinfo.c b/firmware_p4/components/Applications/LoRa/meshtastic/mt_mod_nodeinfo.c new file mode 100644 index 00000000..18f100aa --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/meshtastic/mt_mod_nodeinfo.c @@ -0,0 +1,277 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#include "mt_mod_nodeinfo.h" + +#include +#include + +#include "esp_log.h" +#include "esp_random.h" +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" + +#include "meshtastic_mesh.h" +#include "meshtastic_nodedb.h" +#include "meshtastic_nvs.h" +#include "meshtastic_pki.h" +#include "meshtastic_roles.h" + +static const char *TAG = "MT_MOD_NODEINFO"; + +#define MT_NODEINFO_BROADCAST_SECS 60 +#define MT_NODEINFO_REPLY_THROTTLE 43200 +#define MT_NODEINFO_HOP_LIMIT 3 +#define MT_NODEINFO_HW_MODEL_PRIVATE 255 +#define MT_NODEINFO_BCAST_ADDR 0xFFFFFFFF +#define MT_NODEINFO_INITIAL_MIN_S 5 +#define MT_NODEINFO_INITIAL_JITTER_S 20 +#define MT_NODEINFO_REQUEST_THROTTLE 60 +#define MT_NODEINFO_FAST_INTERVAL_S 300 +#define MT_NODEINFO_FAST_PHASE_S 1800 +#define MT_NODEINFO_BOOT_BURST_COUNT 3 +#define MT_NODEINFO_BOOT_BURST_MIN_S 30 +#define MT_NODEINFO_BOOT_BURST_JITTER_S 20 + +#define MT_NODEINFO_REQUEST_SLOTS 8 + +typedef struct { + uint32_t peer; + uint32_t last_request_s; +} mt_req_slot_t; + +static mt_req_slot_t s_req_slots[MT_NODEINFO_REQUEST_SLOTS]; +static uint32_t s_initial_broadcast_at_s = 0; +static uint32_t s_node_num = 0; +static char s_long_name[32] = "Highboy"; +static char s_short_name[8] = "HBX"; +static uint32_t s_last_broadcast_s = 0; +static uint32_t s_last_reply_s = 0; +static uint8_t s_broadcast_count = 0; + +static uint16_t enc_varint(uint8_t *buf, uint64_t value) { + uint16_t pos = 0; + do { + uint8_t byte = value & 0x7F; + value >>= 7; + if (value) + byte |= 0x80; + buf[pos++] = byte; + } while (value); + return pos; +} + +static uint16_t enc_field_varint(uint8_t *buf, uint8_t field_num, uint64_t value) { + buf[0] = (field_num << 3) | 0; + return 1 + enc_varint(&buf[1], value); +} + +static uint16_t +enc_field_bytes(uint8_t *buf, uint8_t field_num, const uint8_t *data, uint16_t len) { + buf[0] = (field_num << 3) | 2; + uint16_t pos = 1 + enc_varint(&buf[1], len); + memcpy(&buf[pos], data, len); + return pos + len; +} + +static uint16_t build_user(uint8_t *out) { + uint16_t pos = 0; + char id_str[16]; + snprintf(id_str, sizeof(id_str), "!%08lx", (unsigned long)s_node_num); + pos += enc_field_bytes(&out[pos], 1, (const uint8_t *)id_str, (uint16_t)strlen(id_str)); + pos += enc_field_bytes(&out[pos], 2, (const uint8_t *)s_long_name, (uint16_t)strlen(s_long_name)); + pos += + enc_field_bytes(&out[pos], 3, (const uint8_t *)s_short_name, (uint16_t)strlen(s_short_name)); + pos += enc_field_varint(&out[pos], 5, MT_NODEINFO_HW_MODEL_PRIVATE); + pos += enc_field_varint(&out[pos], 7, 0); + pos += enc_field_bytes(&out[pos], 8, mt_pki_get_pubkey(), 32); + return pos; +} + +void mt_mod_nodeinfo_init(uint32_t node_num) { + s_node_num = node_num; + s_initial_broadcast_at_s = + MT_NODEINFO_INITIAL_MIN_S + (esp_random() % MT_NODEINFO_INITIAL_JITTER_S); + + char stored[32] = {0}; + int read_len = mt_nvs_get_blob("long_name", stored, sizeof(stored) - 1); + if (read_len > 0) { + memcpy(s_long_name, stored, read_len); + s_long_name[read_len] = 0; + } + + memset(stored, 0, sizeof(stored)); + read_len = mt_nvs_get_blob("short_name", stored, sizeof(stored) - 1); + if (read_len > 0 && read_len < (int)sizeof(s_short_name)) { + memcpy(s_short_name, stored, read_len); + s_short_name[read_len] = 0; + } + + ESP_LOGI(TAG, + "Initialized - '%s' / '%s' (initial broadcast in %lus)", + s_long_name, + s_short_name, + (unsigned long)s_initial_broadcast_at_s); +} + +void mt_mod_nodeinfo_on_received(const mt_packet_meta_t *meta, + const uint8_t *payload, + uint16_t len) { + ESP_LOGI(TAG, "NodeInfo received from 0x%08lX (%u bytes)", (unsigned long)meta->from, len); + + bool was_unknown = + (meta->from != 0 && meta->from != s_node_num && mt_nodedb_get(meta->from) == NULL); + + if (meta->from != 0 && meta->from != s_node_num && payload != NULL && len > 0) { + uint8_t hops = + (meta->hop_start >= meta->hop_limit) ? (uint8_t)(meta->hop_start - meta->hop_limit) : 0; + mt_nodedb_upsert_from_user(meta->from, payload, len, (float)meta->snr_db, meta->rssi_dbm, hops); + } + + bool should_reply = meta->want_response || was_unknown; + if (!should_reply) + return; + if (!mt_role_should_respond(mt_role_current())) { + ESP_LOGD(TAG, "Current role does not respond to requests"); + return; + } + + uint32_t now_s = (uint32_t)(xTaskGetTickCount() * portTICK_PERIOD_MS / 1000); + if (!was_unknown && !meta->want_response && s_last_reply_s != 0 && + now_s - s_last_reply_s < MT_NODEINFO_REPLY_THROTTLE) { + ESP_LOGD(TAG, "Reply throttled (last %lus ago)", (unsigned long)(now_s - s_last_reply_s)); + return; + } + s_last_reply_s = now_s; + + uint8_t user[96]; + uint16_t ulen = build_user(user); + ESP_LOGI(TAG, + "%s NodeInfo -> 0x%08lX req_id=0x%08lX", + was_unknown ? "First-contact reply" : "Replying", + (unsigned long)meta->from, + (unsigned long)meta->id); + meshtastic_mesh_send_data(meta->from, + meta->channel, + MT_NODEINFO_HOP_LIMIT, + MT_PORT_NODEINFO, + user, + ulen, + meta->id, + false, + false); +} + +void mt_mod_nodeinfo_tick(uint32_t now_s) { + uint32_t interval = mt_role_nodeinfo_interval_secs(mt_role_current()); + bool no_peers = (mt_nodedb_count() == 0); + bool fast_phase = (now_s < MT_NODEINFO_FAST_PHASE_S); + + if (no_peers && s_broadcast_count > 0 && s_broadcast_count < MT_NODEINFO_BOOT_BURST_COUNT) { + uint32_t burst = + MT_NODEINFO_BOOT_BURST_MIN_S + (esp_random() % MT_NODEINFO_BOOT_BURST_JITTER_S); + if (interval == 0 || burst < interval) + interval = burst; + } else if ((no_peers || fast_phase) && + (interval == 0 || interval > MT_NODEINFO_FAST_INTERVAL_S)) { + interval = MT_NODEINFO_FAST_INTERVAL_S; + } + + if (s_last_broadcast_s == 0) { + if (now_s < s_initial_broadcast_at_s) + return; + } else { + if (interval == 0) + return; + if (now_s - s_last_broadcast_s < interval) + return; + } + s_last_broadcast_s = now_s; + s_broadcast_count++; + + uint8_t user[96]; + uint16_t ulen = build_user(user); + ESP_LOGI(TAG, "Broadcast NodeInfo #%u: '%s' (%s)", s_broadcast_count, s_long_name, s_short_name); + meshtastic_mesh_send_data(MT_NODEINFO_BCAST_ADDR, + 0, + MT_NODEINFO_HOP_LIMIT, + MT_PORT_NODEINFO, + user, + ulen, + 0, + false, + false); +} + +void mt_mod_nodeinfo_request(uint32_t to) { + if (to == 0 || to == s_node_num || to == MT_NODEINFO_BCAST_ADDR) + return; + + uint32_t now_s = (uint32_t)(xTaskGetTickCount() * portTICK_PERIOD_MS / 1000); + int free_slot = -1; + int oldest_slot = 0; + uint32_t oldest_age = 0; + + for (int i = 0; i < MT_NODEINFO_REQUEST_SLOTS; i++) { + if (s_req_slots[i].peer == to) { + if (now_s - s_req_slots[i].last_request_s < MT_NODEINFO_REQUEST_THROTTLE) { + return; + } + s_req_slots[i].last_request_s = now_s; + goto send; + } + if (s_req_slots[i].peer == 0 && free_slot < 0) + free_slot = i; + uint32_t age = now_s - s_req_slots[i].last_request_s; + if (age > oldest_age) { + oldest_age = age; + oldest_slot = i; + } + } + + int slot = (free_slot >= 0) ? free_slot : oldest_slot; + s_req_slots[slot].peer = to; + s_req_slots[slot].last_request_s = now_s; + +send: { + uint8_t user[96]; + uint16_t ulen = build_user(user); + ESP_LOGI(TAG, "NodeInfo request -> 0x%08lX (want_response)", (unsigned long)to); + meshtastic_mesh_send_data( + to, 0, MT_NODEINFO_HOP_LIMIT, MT_PORT_NODEINFO, user, ulen, 0, false, true); +} +} + +void mt_mod_nodeinfo_set_name(const char *long_name, const char *short_name) { + if (long_name != NULL) { + strncpy(s_long_name, long_name, sizeof(s_long_name) - 1); + s_long_name[sizeof(s_long_name) - 1] = 0; + mt_nvs_set_blob("long_name", s_long_name, strlen(s_long_name)); + } + if (short_name != NULL) { + strncpy(s_short_name, short_name, sizeof(s_short_name) - 1); + s_short_name[sizeof(s_short_name) - 1] = 0; + mt_nvs_set_blob("short_name", s_short_name, strlen(s_short_name)); + } + s_last_broadcast_s = 0; + ESP_LOGI(TAG, "Names updated - '%s' / '%s'", s_long_name, s_short_name); +} + +const char *mt_mod_nodeinfo_get_long(void) { + return s_long_name; +} +const char *mt_mod_nodeinfo_get_short(void) { + return s_short_name; +} diff --git a/firmware_p4/components/Applications/LoRa/meshtastic/mt_mod_position.c b/firmware_p4/components/Applications/LoRa/meshtastic/mt_mod_position.c new file mode 100644 index 00000000..ce4aa529 --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/meshtastic/mt_mod_position.c @@ -0,0 +1,159 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#include "mt_mod_position.h" + +#include + +#include "esp_log.h" + +#include "meshtastic_mesh.h" +#include "meshtastic_nvs.h" +#include "meshtastic_roles.h" + +static const char *TAG = "MT_MOD_POSITION"; + +#define MT_POSITION_BROADCAST_SECS 900 +#define MT_POSITION_HOP_LIMIT 3 +#define MT_POSITION_BCAST_ADDR 0xFFFFFFFF + +static uint32_t s_node_num = 0; +static bool s_has_fixed_position = false; +static int32_t s_lat_e7 = 0; +static int32_t s_lon_e7 = 0; +static int32_t s_alt_m = 0; +static uint32_t s_last_broadcast_s = 0; + +static uint16_t enc_varint(uint8_t *buf, uint64_t value) { + uint16_t pos = 0; + do { + uint8_t byte = value & 0x7F; + value >>= 7; + if (value) + byte |= 0x80; + buf[pos++] = byte; + } while (value); + return pos; +} + +static uint16_t enc_field_varint(uint8_t *buf, uint8_t field_num, int64_t value) { + buf[0] = (field_num << 3) | 0; + return 1 + enc_varint(&buf[1], (uint64_t)value); +} + +static uint16_t enc_field_fixed32(uint8_t *buf, uint8_t field_num, uint32_t value) { + buf[0] = (field_num << 3) | 5; + memcpy(&buf[1], &value, 4); + return 5; +} + +static uint16_t build_position(uint8_t *out) { + uint16_t pos = 0; + pos += enc_field_fixed32(&out[pos], 1, (uint32_t)s_lat_e7); + pos += enc_field_fixed32(&out[pos], 2, (uint32_t)s_lon_e7); + pos += enc_field_varint(&out[pos], 3, s_alt_m); + return pos; +} + +void mt_mod_position_init(uint32_t node_num) { + s_node_num = node_num; + + int32_t stored[3] = {0}; + int read_len = mt_nvs_get_blob("fix_pos", stored, sizeof(stored)); + if (read_len == sizeof(stored)) { + s_lat_e7 = stored[0]; + s_lon_e7 = stored[1]; + s_alt_m = stored[2]; + s_has_fixed_position = true; + ESP_LOGI(TAG, + "Fixed position loaded - lat=%.6f lon=%.6f alt=%ldm", + s_lat_e7 / 1.0e7, + s_lon_e7 / 1.0e7, + (long)s_alt_m); + } else { + ESP_LOGI(TAG, "No fixed position configured"); + } +} + +void mt_mod_position_on_received(const mt_packet_meta_t *meta, + const uint8_t *payload, + uint16_t len) { + (void)payload; + ESP_LOGI(TAG, "Position received from 0x%08lX (%u bytes)", (unsigned long)meta->from, len); + + if (!meta->want_response || !s_has_fixed_position) + return; + if (!mt_role_should_respond(mt_role_current())) + return; + + uint8_t pos[48]; + uint16_t plen = build_position(pos); + meshtastic_mesh_send_data(meta->from, + meta->channel, + MT_POSITION_HOP_LIMIT, + MT_PORT_POSITION, + pos, + plen, + meta->id, + false, + false); +} + +void mt_mod_position_tick(uint32_t now_s) { + if (!s_has_fixed_position) + return; + uint32_t interval = mt_role_position_interval_secs(mt_role_current()); + if (interval == 0) + return; + if (now_s - s_last_broadcast_s < interval) + return; + s_last_broadcast_s = now_s; + + uint8_t pos[48]; + uint16_t plen = build_position(pos); + ESP_LOGI(TAG, "Broadcast Position - lat=%.6f lon=%.6f", s_lat_e7 / 1.0e7, s_lon_e7 / 1.0e7); + meshtastic_mesh_send_data(MT_POSITION_BCAST_ADDR, + 0, + MT_POSITION_HOP_LIMIT, + MT_PORT_POSITION, + pos, + plen, + 0, + false, + false); +} + +void mt_mod_position_set_fixed(int32_t lat_e7, int32_t lon_e7, int32_t alt_m) { + s_lat_e7 = lat_e7; + s_lon_e7 = lon_e7; + s_alt_m = alt_m; + s_has_fixed_position = true; + + int32_t stored[3] = {lat_e7, lon_e7, alt_m}; + mt_nvs_set_blob("fix_pos", stored, sizeof(stored)); + + s_last_broadcast_s = 0; + ESP_LOGI(TAG, + "Fixed position set - lat=%.6f lon=%.6f alt=%ldm", + lat_e7 / 1.0e7, + lon_e7 / 1.0e7, + (long)alt_m); +} + +void mt_mod_position_remove_fixed(void) { + s_has_fixed_position = false; + mt_nvs_erase("fix_pos"); + ESP_LOGI(TAG, "Fixed position removed"); +} diff --git a/firmware_p4/components/Applications/LoRa/meshtastic/mt_mod_routing.c b/firmware_p4/components/Applications/LoRa/meshtastic/mt_mod_routing.c new file mode 100644 index 00000000..313e5dd3 --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/meshtastic/mt_mod_routing.c @@ -0,0 +1,153 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#include "mt_mod_routing.h" + +#include "esp_log.h" + +#include "meshtastic_mesh.h" + +static const char *TAG = "MT_MOD_ROUTING"; + +#define MT_ROUTING_HOP_LIMIT 3 + +static uint32_t s_node_num = 0; + +static uint16_t enc_varint(uint8_t *buf, uint64_t value) { + uint16_t pos = 0; + do { + uint8_t byte = value & 0x7F; + value >>= 7; + if (value) + byte |= 0x80; + buf[pos++] = byte; + } while (value); + return pos; +} + +static uint16_t enc_field_varint(uint8_t *buf, uint8_t field_num, uint64_t value) { + buf[0] = (field_num << 3) | 0; + return 1 + enc_varint(&buf[1], value); +} + +static uint64_t dec_varint(const uint8_t *buf, uint16_t max_len, uint16_t *out_used) { + uint64_t value = 0; + uint16_t shift = 0; + uint16_t i = 0; + while (i < max_len && i < 10) { + uint8_t byte = buf[i++]; + value |= ((uint64_t)(byte & 0x7F)) << shift; + if (!(byte & 0x80)) + break; + shift += 7; + } + if (out_used != NULL) + *out_used = i; + return value; +} + +static bool parse_routing_error(const uint8_t *payload, uint16_t len, uint32_t *out_error) { + *out_error = 0; + uint16_t i = 0; + while (i < len) { + uint16_t used = 0; + uint64_t tag = dec_varint(&payload[i], len - i, &used); + if (used == 0) + return false; + i += used; + uint32_t field = (uint32_t)(tag >> 3); + uint32_t wire_type = (uint32_t)(tag & 0x07); + + if (wire_type == 0) { + uint16_t vused = 0; + uint64_t value = dec_varint(&payload[i], len - i, &vused); + i += vused; + if (field == 3) { + *out_error = (uint32_t)value; + return true; + } + } else if (wire_type == 2) { + uint16_t lused = 0; + uint32_t length = (uint32_t)dec_varint(&payload[i], len - i, &lused); + i += lused + length; + } else if (wire_type == 5) { + i += 4; + } else { + return false; + } + } + return true; +} + +void mt_mod_routing_init(uint32_t node_num) { + s_node_num = node_num; + ESP_LOGI(TAG, "Initialized"); +} + +void mt_mod_routing_on_received(const mt_packet_meta_t *meta, + const uint8_t *payload, + uint16_t len) { + uint32_t error_code = 0; + bool parsed = parse_routing_error(payload, len, &error_code); + + if (!parsed) { + ESP_LOGW(TAG, "Routing from 0x%08lX malformed (%u bytes)", (unsigned long)meta->from, len); + return; + } + + uint32_t correlated_id = meta->request_id; + + if (error_code == 0) { + if (correlated_id != 0 && meshtastic_mesh_retry_ack(correlated_id, false)) { + ESP_LOGI(TAG, + "Explicit ACK from 0x%08lX for pkt=0x%08lX", + (unsigned long)meta->from, + (unsigned long)correlated_id); + } else { + ESP_LOGI(TAG, + "ACK from 0x%08lX req_id=0x%08lX (no pending retry)", + (unsigned long)meta->from, + (unsigned long)correlated_id); + } + } else { + ESP_LOGW(TAG, + "NAK from 0x%08lX error=%lu req_id=0x%08lX", + (unsigned long)meta->from, + (unsigned long)error_code, + (unsigned long)correlated_id); + if (correlated_id != 0) { + meshtastic_mesh_retry_ack(correlated_id, false); + } + } +} + +void mt_mod_routing_maybe_send_ack(const mt_packet_meta_t *meta) { + uint8_t routing_payload[4]; + uint16_t rlen = 0; + rlen += enc_field_varint(&routing_payload[rlen], 3, 0); + + ESP_LOGI( + TAG, "ACK -> 0x%08lX req_id=0x%08lX", (unsigned long)meta->from, (unsigned long)meta->id); + + meshtastic_mesh_send_data(meta->from, + meta->channel, + MT_ROUTING_HOP_LIMIT, + MT_PORT_ROUTING, + routing_payload, + rlen, + meta->id, + false, + false); +} diff --git a/firmware_p4/components/Applications/LoRa/meshtastic/mt_mod_telemetry.c b/firmware_p4/components/Applications/LoRa/meshtastic/mt_mod_telemetry.c new file mode 100644 index 00000000..fc86c06d --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/meshtastic/mt_mod_telemetry.c @@ -0,0 +1,139 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#include "mt_mod_telemetry.h" + +#include + +#include "esp_log.h" +#include "esp_system.h" +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" + +#include "meshtastic_mesh.h" +#include "meshtastic_roles.h" + +static const char *TAG = "MT_MOD_TELEMETRY"; + +#define MT_TELEM_INTERVAL_SECS 60 +#define MT_TELEM_HOP_LIMIT 3 +#define MT_TELEM_BCAST_ADDR 0xFFFFFFFF +#define MT_TELEM_BATTERY_USB_PWR 101 + +static uint32_t s_node_num = 0; +static uint32_t s_last_broadcast_s = 0; +static uint32_t s_uptime_wrap_count = 0; +static uint32_t s_uptime_last_ms = 0; + +static uint16_t enc_varint(uint8_t *buf, uint64_t value) { + uint16_t pos = 0; + do { + uint8_t byte = value & 0x7F; + value >>= 7; + if (value) + byte |= 0x80; + buf[pos++] = byte; + } while (value); + return pos; +} + +static uint16_t enc_field_varint(uint8_t *buf, uint8_t field_num, uint64_t value) { + buf[0] = (field_num << 3) | 0; + return 1 + enc_varint(&buf[1], value); +} + +static uint16_t +enc_field_bytes(uint8_t *buf, uint8_t field_num, const uint8_t *data, uint16_t len) { + buf[0] = (field_num << 3) | 2; + uint16_t pos = 1 + enc_varint(&buf[1], len); + memcpy(&buf[pos], data, len); + return pos + len; +} + +static uint32_t compute_uptime_seconds(void) { + uint32_t now_ms = (uint32_t)(xTaskGetTickCount() * portTICK_PERIOD_MS); + if (now_ms < s_uptime_last_ms) { + s_uptime_wrap_count++; + } + s_uptime_last_ms = now_ms; + uint64_t total_ms = ((uint64_t)s_uptime_wrap_count << 32) | now_ms; + return (uint32_t)(total_ms / 1000); +} + +static uint16_t build_device_metrics(uint8_t *out) { + uint16_t pos = 0; + pos += enc_field_varint(&out[pos], 1, MT_TELEM_BATTERY_USB_PWR); + pos += enc_field_varint(&out[pos], 5, compute_uptime_seconds()); + return pos; +} + +static uint16_t build_telemetry_frame(uint8_t *out, uint32_t unix_time) { + uint16_t pos = 0; + out[pos++] = (1 << 3) | 5; + memcpy(&out[pos], &unix_time, 4); + pos += 4; + + uint8_t device_metrics[32]; + uint16_t dm_len = build_device_metrics(device_metrics); + pos += enc_field_bytes(&out[pos], 2, device_metrics, dm_len); + return pos; +} + +void mt_mod_telemetry_init(uint32_t node_num) { + s_node_num = node_num; + ESP_LOGI(TAG, "Initialized - broadcast every %ds", MT_TELEM_INTERVAL_SECS); +} + +void mt_mod_telemetry_on_received(const mt_packet_meta_t *meta, + const uint8_t *payload, + uint16_t len) { + (void)payload; + ESP_LOGI(TAG, "Telemetry received from 0x%08lX (%u bytes)", (unsigned long)meta->from, len); + + if (!meta->want_response) + return; + if (!mt_role_should_respond(mt_role_current())) + return; + + uint8_t frame[64]; + uint16_t flen = build_telemetry_frame(frame, compute_uptime_seconds()); + meshtastic_mesh_send_data(meta->from, + meta->channel, + MT_TELEM_HOP_LIMIT, + MT_PORT_TELEMETRY, + frame, + flen, + meta->id, + false, + false); +} + +void mt_mod_telemetry_tick(uint32_t now_s) { + uint32_t interval = mt_role_telemetry_interval_secs(mt_role_current()); + if (interval == 0) + return; + if (now_s - s_last_broadcast_s < interval) + return; + s_last_broadcast_s = now_s; + + uint8_t frame[64]; + uint16_t flen = build_telemetry_frame(frame, now_s); + ESP_LOGI(TAG, + "Broadcast Telemetry - uptime=%lus heap=%lu", + (unsigned long)compute_uptime_seconds(), + (unsigned long)esp_get_free_heap_size()); + meshtastic_mesh_send_data( + MT_TELEM_BCAST_ADDR, 0, MT_TELEM_HOP_LIMIT, MT_PORT_TELEMETRY, frame, flen, 0, false, false); +} diff --git a/firmware_p4/components/Applications/LoRa/meshtastic/mt_mod_text.c b/firmware_p4/components/Applications/LoRa/meshtastic/mt_mod_text.c new file mode 100644 index 00000000..e0b4b85e --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/meshtastic/mt_mod_text.c @@ -0,0 +1,103 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#include "mt_mod_text.h" + +#include + +#include "esp_log.h" + +#include "unishox2.h" + +static const char *TAG = "MT_MOD_TEXT"; + +#define MT_TEXT_DEDUP_RING 50 +#define MT_TEXT_MAX_LEN 220 + +static uint32_t s_seen_ids[MT_TEXT_DEDUP_RING]; +static uint8_t s_seen_idx = 0; +static uint32_t s_node_num = 0; + +static bool has_seen_recently(uint32_t id) { + for (int i = 0; i < MT_TEXT_DEDUP_RING; i++) { + if (s_seen_ids[i] == id) + return true; + } + return false; +} + +static void mark_seen(uint32_t id) { + s_seen_ids[s_seen_idx] = id; + s_seen_idx = (s_seen_idx + 1) % MT_TEXT_DEDUP_RING; +} + +void mt_mod_text_init(uint32_t node_num) { + s_node_num = node_num; + memset(s_seen_ids, 0, sizeof(s_seen_ids)); + s_seen_idx = 0; + ESP_LOGI(TAG, "Initialized - dedup ring=%d", MT_TEXT_DEDUP_RING); +} + +void mt_mod_text_on_received(const mt_packet_meta_t *meta, + const uint8_t *payload, + uint16_t len, + bool is_compressed) { + if (has_seen_recently(meta->id)) { + ESP_LOGD(TAG, "Duplicate text id=0x%08lX, dropping", (unsigned long)meta->id); + return; + } + mark_seen(meta->id); + + char text[MT_TEXT_MAX_LEN]; + uint16_t text_len = 0; + + if (is_compressed) { + int out_len = unishox2_decompress_simple((const char *)payload, (int)len, text); + if (out_len <= 0 || out_len >= (int)sizeof(text)) { + ESP_LOGW(TAG, + "Unishox2 decompress failed from 0x%08lX (in=%u out=%d)", + (unsigned long)meta->from, + len, + out_len); + return; + } + text[out_len] = 0; + text_len = (uint16_t)out_len; + ESP_LOGI(TAG, + "Text[uncompressed %u->%u] from 0x%08lX ch=%u RSSI=%d SNR=%d: \"%s\"", + len, + text_len, + (unsigned long)meta->from, + meta->channel, + meta->rssi_dbm, + meta->snr_db, + text); + } else { + uint16_t copy_len = len; + if (copy_len >= sizeof(text)) + copy_len = sizeof(text) - 1; + memcpy(text, payload, copy_len); + text[copy_len] = 0; + text_len = copy_len; + ESP_LOGI(TAG, + "Text from 0x%08lX ch=%u RSSI=%d SNR=%d: \"%s\"", + (unsigned long)meta->from, + meta->channel, + meta->rssi_dbm, + meta->snr_db, + text); + } + (void)text_len; +} diff --git a/firmware_p4/components/Applications/LoRa/meshtastic/mt_mod_traceroute.c b/firmware_p4/components/Applications/LoRa/meshtastic/mt_mod_traceroute.c new file mode 100644 index 00000000..1c238d27 --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/meshtastic/mt_mod_traceroute.c @@ -0,0 +1,148 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#include "mt_mod_traceroute.h" + +#include + +#include "esp_log.h" + +#include "meshtastic_mesh.h" + +static const char *TAG = "MT_MOD_TRACEROUTE"; + +#define MT_TRACE_HOP_LIMIT 3 +#define MT_TRACE_MAX_HOPS 8 + +static uint32_t s_node_num = 0; + +static uint16_t enc_varint(uint8_t *buf, uint64_t value) { + uint16_t pos = 0; + do { + uint8_t byte = value & 0x7F; + value >>= 7; + if (value) + byte |= 0x80; + buf[pos++] = byte; + } while (value); + return pos; +} + +static uint16_t +enc_packed_fixed32(uint8_t *buf, uint8_t field_num, const uint32_t *values, int count) { + buf[0] = (field_num << 3) | 2; + uint16_t pos = 1 + enc_varint(&buf[1], 4 * count); + for (int i = 0; i < count; i++) { + memcpy(&buf[pos], &values[i], 4); + pos += 4; + } + return pos; +} + +static uint64_t dec_varint(const uint8_t *buf, uint16_t max_len, uint16_t *out_used) { + uint64_t value = 0; + uint16_t shift = 0; + uint16_t i = 0; + while (i < max_len && i < 10) { + uint8_t byte = buf[i++]; + value |= ((uint64_t)(byte & 0x7F)) << shift; + if (!(byte & 0x80)) + break; + shift += 7; + } + if (out_used != NULL) + *out_used = i; + return value; +} + +void mt_mod_traceroute_init(uint32_t node_num) { + s_node_num = node_num; + ESP_LOGI(TAG, "Initialized"); +} + +void mt_mod_traceroute_on_received(const mt_packet_meta_t *meta, + const uint8_t *payload, + uint16_t len) { + uint32_t route_hops[MT_TRACE_MAX_HOPS]; + int route_count = 0; + + uint16_t i = 0; + while (i < len) { + uint16_t consumed = 0; + uint64_t tag = dec_varint(&payload[i], len - i, &consumed); + if (consumed == 0) + break; + i += consumed; + + uint32_t field = (uint32_t)(tag >> 3); + uint32_t wire_type = (uint32_t)(tag & 0x07); + + if (wire_type == 2 && field == 1) { + uint16_t len_used = 0; + uint32_t length = (uint32_t)dec_varint(&payload[i], len - i, &len_used); + i += len_used; + int n = length / 4; + for (int k = 0; k < n && route_count < MT_TRACE_MAX_HOPS; k++) { + memcpy(&route_hops[route_count++], &payload[i + k * 4], 4); + } + i += length; + } else if (wire_type == 5) { + if (field == 1 && route_count < MT_TRACE_MAX_HOPS) { + memcpy(&route_hops[route_count++], &payload[i], 4); + } + i += 4; + } else if (wire_type == 0) { + uint16_t used = 0; + dec_varint(&payload[i], len - i, &used); + i += used; + } else if (wire_type == 2) { + uint16_t len_used = 0; + uint32_t length = (uint32_t)dec_varint(&payload[i], len - i, &len_used); + i += len_used + length; + } else { + break; + } + } + + ESP_LOGI(TAG, + "TraceRoute received from 0x%08lX hops=%d target=0x%08lX", + (unsigned long)meta->from, + route_count, + (unsigned long)meta->to); + + if (meta->to != s_node_num || !meta->want_response) + return; + + uint32_t route[MT_TRACE_MAX_HOPS + 1]; + int n = 0; + for (int k = 0; k < route_count && n < MT_TRACE_MAX_HOPS; k++) { + route[n++] = route_hops[k]; + } + route[n++] = s_node_num; + + uint8_t buf[80]; + uint16_t blen = enc_packed_fixed32(buf, 1, route, n); + + ESP_LOGI(TAG, "Replying TraceRoute -> 0x%08lX (%d hops)", (unsigned long)meta->from, n); + meshtastic_mesh_send_data(meta->from, + meta->channel, + MT_TRACE_HOP_LIMIT, + MT_PORT_TRACEROUTE, + buf, + blen, + meta->id, + false, + false); +} diff --git a/firmware_p4/components/Applications/LoRa/meshtastic/mt_modules.c b/firmware_p4/components/Applications/LoRa/meshtastic/mt_modules.c new file mode 100644 index 00000000..7fc38fba --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/meshtastic/mt_modules.c @@ -0,0 +1,208 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#include "mt_modules.h" + +#include + +#include "esp_log.h" +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" + +#include "meshtastic_nodedb.h" +#include "meshtastic_nvs.h" +#include "meshtastic_pki.h" +#include "mt_mod_admin.h" +#include "mt_mod_keyverify.h" +#include "mt_mod_neighborinfo.h" +#include "mt_mod_nodeinfo.h" +#include "mt_mod_position.h" +#include "mt_mod_routing.h" +#include "mt_mod_telemetry.h" +#include "mt_mod_text.h" +#include "mt_mod_traceroute.h" + +static const char *TAG = "MT_MODULES"; + +static uint32_t s_our_node = 0; + +static uint64_t dec_varint(const uint8_t *buf, uint16_t max_len, uint16_t *out_consumed) { + uint64_t value = 0; + uint16_t shift = 0; + uint16_t i = 0; + while (i < max_len && i < 10) { + uint8_t byte = buf[i++]; + value |= ((uint64_t)(byte & 0x7F)) << shift; + if (!(byte & 0x80)) + break; + shift += 7; + } + if (out_consumed != NULL) + *out_consumed = i; + return value; +} + +bool mt_parse_data(const uint8_t *data_bytes, + uint16_t data_len, + uint32_t *out_portnum, + const uint8_t **out_payload, + uint16_t *out_payload_len, + uint32_t *out_request_id) { + *out_portnum = 0; + *out_payload = NULL; + *out_payload_len = 0; + if (out_request_id != NULL) + *out_request_id = 0; + + uint16_t i = 0; + while (i < data_len) { + uint16_t consumed = 0; + uint64_t tag = dec_varint(&data_bytes[i], data_len - i, &consumed); + if (consumed == 0) + return false; + i += consumed; + + uint32_t field = (uint32_t)(tag >> 3); + uint32_t wire_type = (uint32_t)(tag & 0x07); + + if (wire_type == 0) { + uint16_t used = 0; + uint64_t value = dec_varint(&data_bytes[i], data_len - i, &used); + i += used; + if (field == 1) + *out_portnum = (uint32_t)value; + } else if (wire_type == 2) { + uint16_t used = 0; + uint32_t length = (uint32_t)dec_varint(&data_bytes[i], data_len - i, &used); + i += used; + if (i + length > data_len) + return false; + if (field == 2) { + *out_payload = &data_bytes[i]; + *out_payload_len = (uint16_t)length; + } + i += length; + } else if (wire_type == 5) { + if (i + 4 > data_len) + return false; + if (field == 6 && out_request_id != NULL) { + *out_request_id = ((uint32_t)data_bytes[i]) | ((uint32_t)data_bytes[i + 1] << 8) | + ((uint32_t)data_bytes[i + 2] << 16) | ((uint32_t)data_bytes[i + 3] << 24); + } + i += 4; + } else { + return false; + } + } + return true; +} + +esp_err_t mt_modules_init(uint32_t node_num) { + s_our_node = node_num; + + esp_err_t ret = mt_nvs_init(); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "mt_nvs_init failed: %s", esp_err_to_name(ret)); + return ret; + } + + mt_nodedb_init(); + mt_pki_init(); + + mt_mod_admin_init(node_num); + mt_mod_nodeinfo_init(node_num); + mt_mod_position_init(node_num); + mt_mod_text_init(node_num); + mt_mod_routing_init(node_num); + mt_mod_traceroute_init(node_num); + mt_mod_telemetry_init(node_num); + mt_mod_keyverify_init(node_num); + mt_mod_neighborinfo_init(node_num); + + ESP_LOGI(TAG, + "Initialized - 9 modules (Admin, NodeInfo, Position, Text, Routing, TraceRoute, " + "Telemetry, KeyVerify, NeighborInfo)"); + return ESP_OK; +} + +void mt_modules_dispatch(const mt_packet_meta_t *meta, + const uint8_t *data_bytes, + uint16_t data_len) { + uint32_t portnum = 0; + uint32_t request_id = 0; + const uint8_t *payload = NULL; + uint16_t payload_len = 0; + + if (!mt_parse_data(data_bytes, data_len, &portnum, &payload, &payload_len, &request_id)) { + ESP_LOGW(TAG, "Malformed Data proto (%u bytes)", data_len); + return; + } + + mt_packet_meta_t m = *meta; + m.request_id = request_id; + + if (meta->from != 0 && meta->from != s_our_node && portnum != MT_PORT_NODEINFO && + mt_nodedb_get(meta->from) == NULL) { + mt_mod_nodeinfo_request(meta->from); + } + + switch (portnum) { + case MT_PORT_TEXT_MESSAGE: + mt_mod_text_on_received(&m, payload, payload_len, false); + break; + case MT_PORT_TEXT_COMPRESSED: + mt_mod_text_on_received(&m, payload, payload_len, true); + break; + case MT_PORT_POSITION: + mt_mod_position_on_received(&m, payload, payload_len); + break; + case MT_PORT_NODEINFO: + mt_mod_nodeinfo_on_received(&m, payload, payload_len); + break; + case MT_PORT_ROUTING: + mt_mod_routing_on_received(&m, payload, payload_len); + break; + case MT_PORT_ADMIN: + mt_mod_admin_on_received(&m, payload, payload_len); + break; + case MT_PORT_TRACEROUTE: + mt_mod_traceroute_on_received(&m, payload, payload_len); + break; + case MT_PORT_TELEMETRY: + mt_mod_telemetry_on_received(&m, payload, payload_len); + break; + case MT_PORT_KEY_VERIFICATION: + mt_mod_keyverify_on_received(&m, payload, payload_len); + break; + case MT_PORT_NEIGHBORINFO: + mt_mod_neighborinfo_on_received(&m, payload, payload_len); + break; + default: + break; + } + + if (meta->to == s_our_node && meta->want_ack) { + mt_mod_routing_maybe_send_ack(&m); + } +} + +void mt_modules_tick(void) { + uint32_t now_s = (uint32_t)(xTaskGetTickCount() * portTICK_PERIOD_MS / 1000); + mt_mod_nodeinfo_tick(now_s); + mt_mod_position_tick(now_s); + mt_mod_telemetry_tick(now_s); + mt_mod_neighborinfo_tick(now_s); + mt_mod_admin_tick(); +} diff --git a/firmware_p4/components/Applications/LoRa/meshtastic/unishox2.c b/firmware_p4/components/Applications/LoRa/meshtastic/unishox2.c new file mode 100644 index 00000000..69b31c94 --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/meshtastic/unishox2.c @@ -0,0 +1,1567 @@ +/* + * Copyright (C) 2020 Siara Logics (cc) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * @author Arundale Ramanathan + * + * Port for Particle (particle.io) / Aruino - Jonathan Greenblatt + */ +/** + * @file unishox2.c + * @author Arundale Ramanathan, James Z. M. Gao + * @brief Main code of Unishox2 Compression and Decompression library + * + * This file implements the code for the Unishox API function \n + * defined in unishox2.h + */ + +#include +#include +#include +#include +#include + +#include "unishox2.h" + +/// uint8_t is unsigned char +typedef unsigned char uint8_t; + +const char *USX_FREQ_SEQ_DFLT[] = {"\": \"", "\": ", ""}; +const char *USX_FREQ_SEQ_XML[] = {"", "', ':', '\n', 0, '[', + ']', '\\', ';', '\'', '\t', '@', '*', '&', '?', '!', + '^', '|', '\r', '~', '`', 0, 0, 0}, + {0, ',', '.', '0', '1', '9', '2', '5', '-', '/', '3', '4', '6', '7', + '8', '(', ')', ' ', '=', '+', '$', '%', '#', 0, 0, 0, 0, 0}}; + +/// Stores position of letter in usx_sets. +/// First 3 bits - position in usx_hcodes +/// Next 5 bits - position in usx_vcodes +uint8_t usx_code_94[94]; + +/// Vertical codes starting from the MSB +uint8_t usx_vcodes[] = {0x00, 0x40, 0x60, 0x80, 0x90, 0xA0, 0xB0, 0xC0, 0xD0, 0xD8, + 0xE0, 0xE4, 0xE8, 0xEC, 0xEE, 0xF0, 0xF2, 0xF4, 0xF6, 0xF7, + 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF}; + +/// Length of each veritical code +uint8_t usx_vcode_lens[] = {2, 3, 3, 4, 4, 4, 4, 4, 5, 5, 6, 6, 6, 7, + 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}; + +/// Vertical Codes and Set number for frequent sequences in sets USX_SYM and USX_NUM. First 3 bits +/// indicate set (USX_SYM/USX_NUM) and rest are vcode positions +uint8_t usx_freq_codes[] = { + (1 << 5) + 25, (1 << 5) + 26, (1 << 5) + 27, (2 << 5) + 23, (2 << 5) + 24, (2 << 5) + 25}; + +/// Not used +const int UTF8_MASK[] = {0xE0, 0xF0, 0xF8}; +/// Not used +const int UTF8_PREFIX[] = {0xC0, 0xE0, 0xF0}; + +/// Minimum length to consider as repeating sequence +#define NICE_LEN 5 + +/// Set (USX_NUM - 2) and vertical code (26) for encoding repeating letters +#define RPT_CODE ((2 << 5) + 26) +/// Set (USX_NUM - 2) and vertical code (27) for encoding terminator +#define TERM_CODE ((2 << 5) + 27) +/// Set (USX_SYM - 1) and vertical code (7) for encoding Line feed \\n +#define LF_CODE ((1 << 5) + 7) +/// Set (USX_NUM - 1) and vertical code (8) for encoding \\r\\n +#define CRLF_CODE ((1 << 5) + 8) +/// Set (USX_NUM - 1) and vertical code (22) for encoding \\r +#define CR_CODE ((1 << 5) + 22) +/// Set (USX_NUM - 1) and vertical code (14) for encoding \\t +#define TAB_CODE ((1 << 5) + 14) +/// Set (USX_NUM - 2) and vertical code (17) for space character when it appears in USX_NUM state +/// \\r +#define NUM_SPC_CODE ((2 << 5) + 17) + +/// Code for special code (11111) when state=USX_DELTA +#define UNI_STATE_SPL_CODE 0xF8 +/// Length of Code for special code when state=USX_DELTA +#define UNI_STATE_SPL_CODE_LEN 5 +/// Code for switch code when state=USX_DELTA +#define UNI_STATE_SW_CODE 0x80 +/// Length of Code for Switch code when state=USX_DELTA +#define UNI_STATE_SW_CODE_LEN 2 + +/// Switch code in USX_ALPHA and USX_NUM 00 +#define SW_CODE 0 +/// Length of Switch code +#define SW_CODE_LEN 2 +/// Terminator bit sequence for Preset 1. Length varies depending on state as per following macros +#define TERM_BYTE_PRESET_1 0 +/// Length of Terminator bit sequence when state is lower +#define TERM_BYTE_PRESET_1_LEN_LOWER 6 +/// Length of Terminator bit sequence when state is upper +#define TERM_BYTE_PRESET_1_LEN_UPPER 4 + +/// Offset at which usx_code_94 starts +#define USX_OFFSET_94 33 + +/// global to indicate whether initialization is complete or not +uint8_t is_inited = 0; + +/// Fills the usx_code_94 94 letter array based on sets of characters at usx_sets \n +/// For each element in usx_code_94, first 3 msb bits is set (USX_ALPHA / USX_SYM / USX_NUM) \n +/// and the rest 5 bits indicate the vertical position in the corresponding set +void init_coder() { + if (is_inited) + return; + memset(usx_code_94, '\0', sizeof(usx_code_94)); + for (int i = 0; i < 3; i++) { + for (int j = 0; j < 28; j++) { + uint8_t c = usx_sets[i][j]; + if (c > 32) { + usx_code_94[c - USX_OFFSET_94] = (i << 5) + j; + if (c >= 'a' && c <= 'z') + usx_code_94[c - USX_OFFSET_94 - ('a' - 'A')] = (i << 5) + j; + } + } + } + is_inited = 1; +} + +/// Mask for retrieving each code to be encoded according to its length +unsigned int usx_mask[] = {0x80, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC, 0xFE, 0xFF}; + +/// Appends specified number of bits to the output (out) \n +/// If maximum limit (olen) is reached, -1 is returned \n +/// Otherwise clen bits in code are appended to out starting with MSB +int append_bits(char *out, int olen, int ol, uint8_t code, int clen) { + // printf("%d,%x,%d,%d\n", ol, code, clen, state); + + while (clen > 0) { + int oidx; + unsigned char a_byte; + + uint8_t cur_bit = ol % 8; + uint8_t blen = clen; + a_byte = code & usx_mask[blen - 1]; + a_byte >>= cur_bit; + if (blen + cur_bit > 8) + blen = (8 - cur_bit); + oidx = ol / 8; + if (oidx < 0 || olen <= oidx) + return -1; + if (cur_bit == 0) + out[oidx] = a_byte; + else + out[oidx] |= a_byte; + code <<= blen; + ol += blen; + clen -= blen; + } + return ol; +} + +/// This is a safe call to append_bits() making sure it does not write past olen +#define SAFE_APPEND_BITS(exp) \ + do { \ + const int newidx = (exp); \ + if (newidx < 0) \ + return newidx; \ + } while (0) + +/// Appends switch code to out depending on the state (USX_DELTA or other) +int append_switch_code(char *out, int olen, int ol, uint8_t state) { + if (state == USX_DELTA) { + SAFE_APPEND_BITS(ol = append_bits(out, olen, ol, UNI_STATE_SPL_CODE, UNI_STATE_SPL_CODE_LEN)); + SAFE_APPEND_BITS(ol = append_bits(out, olen, ol, UNI_STATE_SW_CODE, UNI_STATE_SW_CODE_LEN)); + } else + SAFE_APPEND_BITS(ol = append_bits(out, olen, ol, SW_CODE, SW_CODE_LEN)); + return ol; +} + +/// Appends given horizontal and veritical code bits to out +int append_code(char *out, + int olen, + int ol, + uint8_t code, + uint8_t *state, + const uint8_t usx_hcodes[], + const uint8_t usx_hcode_lens[]) { + uint8_t hcode = code >> 5; + uint8_t vcode = code & 0x1F; + if (!usx_hcode_lens[hcode] && hcode != USX_ALPHA) + return ol; + switch (hcode) { + case USX_ALPHA: + if (*state != USX_ALPHA) { + SAFE_APPEND_BITS(ol = append_switch_code(out, olen, ol, *state)); + SAFE_APPEND_BITS( + ol = append_bits(out, olen, ol, usx_hcodes[USX_ALPHA], usx_hcode_lens[USX_ALPHA])); + *state = USX_ALPHA; + } + break; + case USX_SYM: + SAFE_APPEND_BITS(ol = append_switch_code(out, olen, ol, *state)); + SAFE_APPEND_BITS( + ol = append_bits(out, olen, ol, usx_hcodes[USX_SYM], usx_hcode_lens[USX_SYM])); + break; + case USX_NUM: + if (*state != USX_NUM) { + SAFE_APPEND_BITS(ol = append_switch_code(out, olen, ol, *state)); + SAFE_APPEND_BITS( + ol = append_bits(out, olen, ol, usx_hcodes[USX_NUM], usx_hcode_lens[USX_NUM])); + if (usx_sets[hcode][vcode] >= '0' && usx_sets[hcode][vcode] <= '9') + *state = USX_NUM; + } + } + SAFE_APPEND_BITS(ol = append_bits(out, olen, ol, usx_vcodes[vcode], usx_vcode_lens[vcode])); + return ol; +} + +/// Length of bits used to represent count for each level +const uint8_t count_bit_lens[5] = {2, 4, 7, 11, 16}; +/// Cumulative counts represented at each level +const int32_t count_adder[5] = {4, 20, 148, 2196, 67732}; +/// Codes used to specify the level that the count belongs to +const uint8_t count_codes[] = {0x01, 0x82, 0xC3, 0xE4, 0xF4}; +/// Encodes given count to out +int encodeCount(char *out, int olen, int ol, int count) { + // First five bits are code and Last three bits of codes represent length + for (int i = 0; i < 5; i++) { + if (count < count_adder[i]) { + SAFE_APPEND_BITS( + ol = append_bits(out, olen, ol, (count_codes[i] & 0xF8), count_codes[i] & 0x07)); + uint16_t count16 = (count - (i ? count_adder[i - 1] : 0)) << (16 - count_bit_lens[i]); + if (count_bit_lens[i] > 8) { + SAFE_APPEND_BITS(ol = append_bits(out, olen, ol, count16 >> 8, 8)); + SAFE_APPEND_BITS(ol = append_bits(out, olen, ol, count16 & 0xFF, count_bit_lens[i] - 8)); + } else + SAFE_APPEND_BITS(ol = append_bits(out, olen, ol, count16 >> 8, count_bit_lens[i])); + return ol; + } + } + return ol; +} + +/// Length of bits used to represent delta code for each level +const uint8_t uni_bit_len[5] = {6, 12, 14, 16, 21}; +/// Cumulative delta codes represented at each level +const int32_t uni_adder[5] = {0, 64, 4160, 20544, 86080}; + +/// Encodes the unicode code point given by code to out. prev_code is used to calculate the delta +int encodeUnicode(char *out, int olen, int ol, int32_t code, int32_t prev_code) { + // First five bits are code and Last three bits of codes represent length + // const uint8_t codes[8] = {0x00, 0x42, 0x83, 0xA3, 0xC3, 0xE4, 0xF5, 0xFD}; + const uint8_t codes[6] = {0x01, 0x82, 0xC3, 0xE4, 0xF5, 0xFD}; + int32_t till = 0; + int32_t diff = code - prev_code; + if (diff < 0) + diff = -diff; + // printf("%ld, ", code); + // printf("Diff: %d\n", diff); + for (int i = 0; i < 5; i++) { + till += (1 << uni_bit_len[i]); + if (diff < till) { + SAFE_APPEND_BITS(ol = append_bits(out, olen, ol, (codes[i] & 0xF8), codes[i] & 0x07)); + // if (diff) { + SAFE_APPEND_BITS(ol = append_bits(out, olen, ol, prev_code > code ? 0x80 : 0, 1)); + int32_t val = diff - uni_adder[i]; + // printf("Val: %d\n", val); + if (uni_bit_len[i] > 16) { + val <<= (24 - uni_bit_len[i]); + SAFE_APPEND_BITS(ol = append_bits(out, olen, ol, val >> 16, 8)); + SAFE_APPEND_BITS(ol = append_bits(out, olen, ol, (val >> 8) & 0xFF, 8)); + SAFE_APPEND_BITS(ol = append_bits(out, olen, ol, val & 0xFF, uni_bit_len[i] - 16)); + } else if (uni_bit_len[i] > 8) { + val <<= (16 - uni_bit_len[i]); + SAFE_APPEND_BITS(ol = append_bits(out, olen, ol, val >> 8, 8)); + SAFE_APPEND_BITS(ol = append_bits(out, olen, ol, val & 0xFF, uni_bit_len[i] - 8)); + } else { + val <<= (8 - uni_bit_len[i]); + SAFE_APPEND_BITS(ol = append_bits(out, olen, ol, val & 0xFF, uni_bit_len[i])); + } + return ol; + } + } + return ol; +} + +/// Reads UTF-8 character from in. Also returns the number of bytes occupied by the UTF-8 character +/// in utf8len +int32_t readUTF8(const char *in, int len, int l, int *utf8len) { + int32_t ret = 0; + if (l < (len - 1) && (in[l] & 0xE0) == 0xC0 && (in[l + 1] & 0xC0) == 0x80) { + *utf8len = 2; + ret = (in[l] & 0x1F); + ret <<= 6; + ret += (in[l + 1] & 0x3F); + if (ret < 0x80) + ret = 0; + } else if (l < (len - 2) && (in[l] & 0xF0) == 0xE0 && (in[l + 1] & 0xC0) == 0x80 && + (in[l + 2] & 0xC0) == 0x80) { + *utf8len = 3; + ret = (in[l] & 0x0F); + ret <<= 6; + ret += (in[l + 1] & 0x3F); + ret <<= 6; + ret += (in[l + 2] & 0x3F); + if (ret < 0x0800) + ret = 0; + } else if (l < (len - 3) && (in[l] & 0xF8) == 0xF0 && (in[l + 1] & 0xC0) == 0x80 && + (in[l + 2] & 0xC0) == 0x80 && (in[l + 3] & 0xC0) == 0x80) { + *utf8len = 4; + ret = (in[l] & 0x07); + ret <<= 6; + ret += (in[l + 1] & 0x3F); + ret <<= 6; + ret += (in[l + 2] & 0x3F); + ret <<= 6; + ret += (in[l + 3] & 0x3F); + if (ret < 0x10000) + ret = 0; + } + return ret; +} + +/// Finds the longest matching sequence from the beginning of the string. \n +/// If a match is found and it is longer than NICE_LEN, it is encoded as a repeating sequence to out +/// \n This is also used for Unicode strings \n This is a crude implementation that is not +/// optimized. Assuming only short strings \n are encoded, this is not much of an issue. +int matchOccurance(const char *in, + int len, + int l, + char *out, + int olen, + int *ol, + const uint8_t *state, + const uint8_t usx_hcodes[], + const uint8_t usx_hcode_lens[]) { + int j, k; + int longest_dist = 0; + int longest_len = 0; + for (j = l - NICE_LEN; j >= 0; j--) { + for (k = l; k < len && j + k - l < l; k++) { + if (in[k] != in[j + k - l]) + break; + } + while ((((unsigned char)in[k]) >> 6) == 2) + k--; // Skip partial UTF-8 matches + // if ((in[k - 1] >> 3) == 0x1E || (in[k - 1] >> 4) == 0x0E || (in[k - 1] >> 5) == 0x06) + // k--; + if ((k - l) > (NICE_LEN - 1)) { + int match_len = k - l - NICE_LEN; + int match_dist = l - j - NICE_LEN + 1; + if (match_len > longest_len) { + longest_len = match_len; + longest_dist = match_dist; + } + } + } + if (longest_len) { + SAFE_APPEND_BITS(*ol = append_switch_code(out, olen, *ol, *state)); + SAFE_APPEND_BITS(*ol = append_bits( + out, olen, *ol, usx_hcodes[USX_DICT], usx_hcode_lens[USX_DICT])); + // printf("Len:%d / Dist:%d/%.*s\n", longest_len, longest_dist, longest_len + NICE_LEN, in + l - + // longest_dist - NICE_LEN + 1); + SAFE_APPEND_BITS(*ol = encodeCount(out, olen, *ol, longest_len)); + SAFE_APPEND_BITS(*ol = encodeCount(out, olen, *ol, longest_dist)); + l += (longest_len + NICE_LEN); + l--; + return l; + } + return -l; +} + +/// This is used only when encoding a string array +/// Finds the longest matching sequence from the previous array element to the beginning of the +/// string array. \n If a match is found and it is longer than NICE_LEN, it is encoded as a +/// repeating sequence to out \n This is also used for Unicode strings \n This is a crude +/// implementation that is not optimized. Assuming only short strings \n are encoded, this is not +/// much of an issue. +int matchLine(const char *in, + int len, + int l, + char *out, + int olen, + int *ol, + struct us_lnk_lst *prev_lines, + const uint8_t *state, + const uint8_t usx_hcodes[], + const uint8_t usx_hcode_lens[]) { + int last_ol = *ol; + int last_len = 0; + int last_dist = 0; + int last_ctx = 0; + int line_ctr = 0; + int j = 0; + do { + int i, k; + int line_len = (int)strlen(prev_lines->data); + int limit = (line_ctr == 0 ? l : line_len); + for (; j < limit; j++) { + for (i = l, k = j; k < line_len && i < len; k++, i++) { + if (prev_lines->data[k] != in[i]) + break; + } + while ((((unsigned char)prev_lines->data[k]) >> 6) == 2) + k--; // Skip partial UTF-8 matches + if ((k - j) >= NICE_LEN) { + if (last_len) { + if (j > last_dist) + continue; + // int saving = ((k - j) - last_len) + (last_dist - j) + (last_ctx - line_ctr); + // if (saving < 0) { + // //printf("No savng: %d\n", saving); + // continue; + // } + *ol = last_ol; + } + last_len = (k - j); + last_dist = j; + last_ctx = line_ctr; + SAFE_APPEND_BITS(*ol = append_switch_code(out, olen, *ol, *state)); + SAFE_APPEND_BITS(*ol = append_bits( + out, olen, *ol, usx_hcodes[USX_DICT], usx_hcode_lens[USX_DICT])); + SAFE_APPEND_BITS(*ol = encodeCount(out, olen, *ol, last_len - NICE_LEN)); + SAFE_APPEND_BITS(*ol = encodeCount(out, olen, *ol, last_dist)); + SAFE_APPEND_BITS(*ol = encodeCount(out, olen, *ol, last_ctx)); + /* + if ((*ol - last_ol) > (last_len * 4)) { + last_len = 0; + *ol = last_ol; + }*/ + // printf("Len: %d, Dist: %d, Line: %d\n", last_len, last_dist, last_ctx); + j += last_len; + } + } + line_ctr++; + prev_lines = prev_lines->previous; + } while (prev_lines && prev_lines->data != NULL); + if (last_len) { + l += last_len; + l--; + return l; + } + return -l; +} + +/// Returns 4 bit code assuming ch falls between '0' to '9', \n +/// 'A' to 'F' or 'a' to 'f' +uint8_t getBaseCode(char ch) { + if (ch >= '0' && ch <= '9') + return (ch - '0') << 4; + else if (ch >= 'A' && ch <= 'F') + return (ch - 'A' + 10) << 4; + else if (ch >= 'a' && ch <= 'f') + return (ch - 'a' + 10) << 4; + return 0; +} + +/// Enum indicating nibble type - USX_NIB_NUM means ch is a number '0' to '9', \n +/// USX_NIB_HEX_LOWER means ch is between 'a' to 'f', \n +/// USX_NIB_HEX_UPPER means ch is between 'A' to 'F' +enum { USX_NIB_NUM = 0, USX_NIB_HEX_LOWER, USX_NIB_HEX_UPPER, USX_NIB_NOT }; +/// Gets 4 bit code assuming ch falls between '0' to '9', \n +/// 'A' to 'F' or 'a' to 'f' +char getNibbleType(char ch) { + if (ch >= '0' && ch <= '9') + return USX_NIB_NUM; + else if (ch >= 'a' && ch <= 'f') + return USX_NIB_HEX_LOWER; + else if (ch >= 'A' && ch <= 'F') + return USX_NIB_HEX_UPPER; + return USX_NIB_NOT; +} + +/// Starts coding of nibble sets +int append_nibble_escape(char *out, + int olen, + int ol, + uint8_t state, + const uint8_t usx_hcodes[], + const uint8_t usx_hcode_lens[]) { + SAFE_APPEND_BITS(ol = append_switch_code(out, olen, ol, state)); + SAFE_APPEND_BITS(ol = append_bits(out, olen, ol, usx_hcodes[USX_NUM], usx_hcode_lens[USX_NUM])); + SAFE_APPEND_BITS(ol = append_bits(out, olen, ol, 0, 2)); + return ol; +} + +/// Returns minimum value of two longs +long min_of(long c, long i) { + return c > i ? i : c; +} + +/// Appends the terminator code depending on the state, preset and whether full terminator needs to +/// be encoded to out or not \n +int append_final_bits(char *const out, + const int olen, + int ol, + const uint8_t state, + const uint8_t is_all_upper, + const uint8_t usx_hcodes[], + const uint8_t usx_hcode_lens[]) { + if (usx_hcode_lens[USX_ALPHA]) { + if (USX_NUM != state) { + // for num state, append TERM_CODE directly + // for other state, switch to Num Set first + SAFE_APPEND_BITS(ol = append_switch_code(out, olen, ol, state)); + SAFE_APPEND_BITS( + ol = append_bits(out, olen, ol, usx_hcodes[USX_NUM], usx_hcode_lens[USX_NUM])); + } + SAFE_APPEND_BITS( + ol = append_bits( + out, olen, ol, usx_vcodes[TERM_CODE & 0x1F], usx_vcode_lens[TERM_CODE & 0x1F])); + } else { + // preset 1, terminate at 2 or 3 SW_CODE, i.e., 4 or 6 continuous 0 bits + // see discussion: https://github.com/siara-cc/Unishox/issues/19#issuecomment-922435580 + SAFE_APPEND_BITS(ol = append_bits(out, + olen, + ol, + TERM_BYTE_PRESET_1, + is_all_upper ? TERM_BYTE_PRESET_1_LEN_UPPER + : TERM_BYTE_PRESET_1_LEN_LOWER)); + } + + // fill uint8_t with the last bit + SAFE_APPEND_BITS(ol = + append_bits(out, + olen, + ol, + (ol == 0 || out[(ol - 1) / 8] << ((ol - 1) & 7) >= 0) ? 0 : 0xFF, + (8 - ol % 8) & 7)); + + return ol; +} + +/// Macro used in the main compress function so that if the output len exceeds given maximum length +/// (olen) it can exit +#define SAFE_APPEND_BITS2(olen, exp) \ + do { \ + const int newidx = (exp); \ + const int __olen = (olen); \ + if (newidx < 0) \ + return __olen >= 0 ? __olen + 1 : (1 - __olen) * 4; \ + } while (0) + +// Main API function. See unishox2.h for documentation +int unishox2_compress_lines(const char *in, + int len, + UNISHOX_API_OUT_AND_LEN(char *out, int olen), + const uint8_t usx_hcodes[], + const uint8_t usx_hcode_lens[], + const char *usx_freq_seq[], + const char *usx_templates[], + struct us_lnk_lst *prev_lines) { + uint8_t state; + + int l, ll, ol; + char c_in, c_next; + int prev_uni; + uint8_t is_upper, is_all_upper; +#if (UNISHOX_API_OUT_AND_LEN(0, 1)) == 0 + const int olen = INT_MAX - 1; + const int rawolen = olen; + const uint8_t need_full_term_codes = 0; +#else + const int rawolen = olen; + uint8_t need_full_term_codes = 0; + if (olen < 0) { + need_full_term_codes = 1; + olen *= -1; + } +#endif + + init_coder(); + ol = 0; + prev_uni = 0; + state = USX_ALPHA; + is_all_upper = 0; + SAFE_APPEND_BITS2( + rawolen, + ol = append_bits(out, olen, ol, UNISHOX_MAGIC_BITS, UNISHOX_MAGIC_BIT_LEN)); // magic bit(s) + for (l = 0; l < len; l++) { + if (usx_hcode_lens[USX_DICT] && l < (len - NICE_LEN + 1)) { + if (prev_lines) { + l = matchLine(in, len, l, out, olen, &ol, prev_lines, &state, usx_hcodes, usx_hcode_lens); + if (l > 0) { + continue; + } else if (l < 0 && ol < 0) { + return olen + 1; + } + l = -l; + } else { + l = matchOccurance(in, len, l, out, olen, &ol, &state, usx_hcodes, usx_hcode_lens); + if (l > 0) { + continue; + } else if (l < 0 && ol < 0) { + return olen + 1; + } + l = -l; + } + } + + c_in = in[l]; + if (l && len > 4 && l < (len - 4) && usx_hcode_lens[USX_NUM]) { + if (c_in == in[l - 1] && c_in == in[l + 1] && c_in == in[l + 2] && c_in == in[l + 3]) { + int rpt_count = l + 4; + while (rpt_count < len && in[rpt_count] == c_in) + rpt_count++; + rpt_count -= l; + SAFE_APPEND_BITS2( + rawolen, ol = append_code(out, olen, ol, RPT_CODE, &state, usx_hcodes, usx_hcode_lens)); + SAFE_APPEND_BITS2(rawolen, ol = encodeCount(out, olen, ol, rpt_count - 4)); + l += rpt_count; + l--; + continue; + } + } + + if (l <= (len - 36) && usx_hcode_lens[USX_NUM]) { + if (in[l + 8] == '-' && in[l + 13] == '-' && in[l + 18] == '-' && in[l + 23] == '-') { + char hex_type = USX_NIB_NUM; + int uid_pos = l; + for (; uid_pos < l + 36; uid_pos++) { + char c_uid = in[uid_pos]; + if (c_uid == '-' && (uid_pos == 8 || uid_pos == 13 || uid_pos == 18 || uid_pos == 23)) + continue; + char nib_type = getNibbleType(c_uid); + if (nib_type == USX_NIB_NOT) + break; + if (nib_type != USX_NIB_NUM) { + if (hex_type != USX_NIB_NUM && hex_type != nib_type) + break; + hex_type = nib_type; + } + } + if (uid_pos == l + 36) { + SAFE_APPEND_BITS2( + rawolen, ol = append_nibble_escape(out, olen, ol, state, usx_hcodes, usx_hcode_lens)); + SAFE_APPEND_BITS2(rawolen, + ol = append_bits(out, + olen, + ol, + (hex_type == USX_NIB_HEX_LOWER ? 0xC0 : 0xF0), + (hex_type == USX_NIB_HEX_LOWER ? 3 : 5))); + for (uid_pos = l; uid_pos < l + 36; uid_pos++) { + char c_uid = in[uid_pos]; + if (c_uid != '-') + SAFE_APPEND_BITS2(rawolen, ol = append_bits(out, olen, ol, getBaseCode(c_uid), 4)); + } + // printf("GUID:\n"); + l += 35; + continue; + } + } + } + + if (l < (len - 5) && usx_hcode_lens[USX_NUM]) { + char hex_type = USX_NIB_NUM; + int hex_len = 0; + do { + char nib_type = getNibbleType(in[l + hex_len]); + if (nib_type == USX_NIB_NOT) + break; + if (nib_type != USX_NIB_NUM) { + if (hex_type != USX_NIB_NUM && hex_type != nib_type) + break; + hex_type = nib_type; + } + hex_len++; + } while (l + hex_len < len); + if (hex_len > 10 && hex_type == USX_NIB_NUM) + hex_type = USX_NIB_HEX_LOWER; + if ((hex_type == USX_NIB_HEX_LOWER || hex_type == USX_NIB_HEX_UPPER) && hex_len > 3) { + SAFE_APPEND_BITS2( + rawolen, ol = append_nibble_escape(out, olen, ol, state, usx_hcodes, usx_hcode_lens)); + SAFE_APPEND_BITS2(rawolen, + ol = append_bits(out, + olen, + ol, + (hex_type == USX_NIB_HEX_LOWER ? 0x80 : 0xE0), + (hex_type == USX_NIB_HEX_LOWER ? 2 : 4))); + SAFE_APPEND_BITS2(rawolen, ol = encodeCount(out, olen, ol, hex_len)); + do { + SAFE_APPEND_BITS2(rawolen, ol = append_bits(out, olen, ol, getBaseCode(in[l++]), 4)); + } while (--hex_len); + l--; + continue; + } + } + + if (usx_templates != NULL) { + int i; + for (i = 0; i < 5; i++) { + if (usx_templates[i]) { + int rem = (int)strlen(usx_templates[i]); + int j = 0; + for (; j < rem && l + j < len; j++) { + char c_t = usx_templates[i][j]; + c_in = in[l + j]; + if (c_t == 'f' || c_t == 'F') { + if (getNibbleType(c_in) != (c_t == 'f' ? USX_NIB_HEX_LOWER : USX_NIB_HEX_UPPER) && + getNibbleType(c_in) != USX_NIB_NUM) { + break; + } + } else if (c_t == 'r' || c_t == 't' || c_t == 'o') { + if (c_in < '0' || c_in > (c_t == 'r' ? '7' : (c_t == 't' ? '3' : '1'))) + break; + } else if (c_t != c_in) + break; + } + if (((float)j / rem) > 0.66) { + // printf("%s\n", usx_templates[i]); + rem = rem - j; + SAFE_APPEND_BITS2( + rawolen, + ol = append_nibble_escape(out, olen, ol, state, usx_hcodes, usx_hcode_lens)); + SAFE_APPEND_BITS2(rawolen, ol = append_bits(out, olen, ol, 0, 1)); + SAFE_APPEND_BITS2( + rawolen, + ol = append_bits(out, olen, ol, (count_codes[i] & 0xF8), count_codes[i] & 0x07)); + SAFE_APPEND_BITS2(rawolen, ol = encodeCount(out, olen, ol, rem)); + for (int k = 0; k < j; k++) { + char c_t = usx_templates[i][k]; + if (c_t == 'f' || c_t == 'F') + SAFE_APPEND_BITS2(rawolen, + ol = append_bits(out, olen, ol, getBaseCode(in[l + k]), 4)); + else if (c_t == 'r' || c_t == 't' || c_t == 'o') { + c_t = (c_t == 'r' ? 3 : (c_t == 't' ? 2 : 1)); + SAFE_APPEND_BITS2( + rawolen, ol = append_bits(out, olen, ol, (in[l + k] - '0') << (8 - c_t), c_t)); + } + } + l += j; + l--; + break; + } + } + } + if (i < 5) + continue; + } + + if (usx_freq_seq != NULL) { + int i; + for (i = 0; i < 6; i++) { + int seq_len = (int)strlen(usx_freq_seq[i]); + if (len - seq_len >= 0 && l <= len - seq_len) { + if (memcmp(usx_freq_seq[i], in + l, seq_len) == 0 && + usx_hcode_lens[usx_freq_codes[i] >> 5]) { + SAFE_APPEND_BITS2( + rawolen, + ol = append_code( + out, olen, ol, usx_freq_codes[i], &state, usx_hcodes, usx_hcode_lens)); + l += seq_len; + l--; + break; + } + } + } + if (i < 6) + continue; + } + + c_in = in[l]; + + is_upper = 0; + if (c_in >= 'A' && c_in <= 'Z') + is_upper = 1; + else { + if (is_all_upper) { + is_all_upper = 0; + SAFE_APPEND_BITS2(rawolen, ol = append_switch_code(out, olen, ol, state)); + SAFE_APPEND_BITS2( + rawolen, + ol = append_bits(out, olen, ol, usx_hcodes[USX_ALPHA], usx_hcode_lens[USX_ALPHA])); + state = USX_ALPHA; + } + } + if (is_upper && !is_all_upper) { + if (state == USX_NUM) { + SAFE_APPEND_BITS2(rawolen, ol = append_switch_code(out, olen, ol, state)); + SAFE_APPEND_BITS2( + rawolen, + ol = append_bits(out, olen, ol, usx_hcodes[USX_ALPHA], usx_hcode_lens[USX_ALPHA])); + state = USX_ALPHA; + } + SAFE_APPEND_BITS2(rawolen, ol = append_switch_code(out, olen, ol, state)); + SAFE_APPEND_BITS2( + rawolen, + ol = append_bits(out, olen, ol, usx_hcodes[USX_ALPHA], usx_hcode_lens[USX_ALPHA])); + if (state == USX_DELTA) { + state = USX_ALPHA; + SAFE_APPEND_BITS2(rawolen, ol = append_switch_code(out, olen, ol, state)); + SAFE_APPEND_BITS2( + rawolen, + ol = append_bits(out, olen, ol, usx_hcodes[USX_ALPHA], usx_hcode_lens[USX_ALPHA])); + } + } + c_next = 0; + if (l + 1 < len) + c_next = in[l + 1]; + + if (c_in >= 32 && c_in <= 126) { + if (is_upper && !is_all_upper) { + for (ll = l + 4; ll >= l && ll < len; ll--) { + if (in[ll] < 'A' || in[ll] > 'Z') + break; + } + if (ll == l - 1) { + SAFE_APPEND_BITS2(rawolen, ol = append_switch_code(out, olen, ol, state)); + SAFE_APPEND_BITS2( + rawolen, + ol = append_bits(out, olen, ol, usx_hcodes[USX_ALPHA], usx_hcode_lens[USX_ALPHA])); + state = USX_ALPHA; + is_all_upper = 1; + } + } + if (state == USX_DELTA && (c_in == ' ' || c_in == '.' || c_in == ',')) { + uint8_t spl_code = (c_in == ',' ? 0xC0 : (c_in == '.' ? 0xE0 : (c_in == ' ' ? 0 : 0xFF))); + if (spl_code != 0xFF) { + uint8_t spl_code_len = (c_in == ',' ? 3 : (c_in == '.' ? 4 : (c_in == ' ' ? 1 : 4))); + SAFE_APPEND_BITS2( + rawolen, ol = append_bits(out, olen, ol, UNI_STATE_SPL_CODE, UNI_STATE_SPL_CODE_LEN)); + SAFE_APPEND_BITS2(rawolen, ol = append_bits(out, olen, ol, spl_code, spl_code_len)); + continue; + } + } + c_in -= 32; + if (is_all_upper && is_upper) + c_in += 32; + if (c_in == 0) { + if (state == USX_NUM) + SAFE_APPEND_BITS2(rawolen, + ol = append_bits(out, + olen, + ol, + usx_vcodes[NUM_SPC_CODE & 0x1F], + usx_vcode_lens[NUM_SPC_CODE & 0x1F])); + else + SAFE_APPEND_BITS2(rawolen, + ol = append_bits(out, olen, ol, usx_vcodes[1], usx_vcode_lens[1])); + } else { + c_in--; + SAFE_APPEND_BITS2( + rawolen, + ol = append_code( + out, olen, ol, usx_code_94[(int)c_in], &state, usx_hcodes, usx_hcode_lens)); + } + } else if (c_in == 13 && c_next == 10) { + SAFE_APPEND_BITS2( + rawolen, ol = append_code(out, olen, ol, CRLF_CODE, &state, usx_hcodes, usx_hcode_lens)); + l++; + } else if (c_in == 10) { + if (state == USX_DELTA) { + SAFE_APPEND_BITS2( + rawolen, ol = append_bits(out, olen, ol, UNI_STATE_SPL_CODE, UNI_STATE_SPL_CODE_LEN)); + SAFE_APPEND_BITS2(rawolen, ol = append_bits(out, olen, ol, 0xF0, 4)); + } else + SAFE_APPEND_BITS2( + rawolen, ol = append_code(out, olen, ol, LF_CODE, &state, usx_hcodes, usx_hcode_lens)); + } else if (c_in == 13) { + SAFE_APPEND_BITS2( + rawolen, ol = append_code(out, olen, ol, CR_CODE, &state, usx_hcodes, usx_hcode_lens)); + } else if (c_in == '\t') { + SAFE_APPEND_BITS2( + rawolen, ol = append_code(out, olen, ol, TAB_CODE, &state, usx_hcodes, usx_hcode_lens)); + } else { + int utf8len; + int32_t uni = readUTF8(in, len, l, &utf8len); + if (uni) { + l += utf8len; + if (state != USX_DELTA) { + int32_t uni2 = readUTF8(in, len, l, &utf8len); + if (uni2) { + if (state != USX_ALPHA) { + SAFE_APPEND_BITS2(rawolen, ol = append_switch_code(out, olen, ol, state)); + SAFE_APPEND_BITS2( + rawolen, + ol = + append_bits(out, olen, ol, usx_hcodes[USX_ALPHA], usx_hcode_lens[USX_ALPHA])); + } + SAFE_APPEND_BITS2(rawolen, ol = append_switch_code(out, olen, ol, state)); + SAFE_APPEND_BITS2( + rawolen, + ol = append_bits(out, olen, ol, usx_hcodes[USX_ALPHA], usx_hcode_lens[USX_ALPHA])); + SAFE_APPEND_BITS2( + rawolen, + ol = append_bits( + out, olen, ol, usx_vcodes[1], usx_vcode_lens[1])); // code for space (' ') + state = USX_DELTA; + } else { + SAFE_APPEND_BITS2(rawolen, ol = append_switch_code(out, olen, ol, state)); + SAFE_APPEND_BITS2( + rawolen, + ol = append_bits(out, olen, ol, usx_hcodes[USX_DELTA], usx_hcode_lens[USX_DELTA])); + } + } + SAFE_APPEND_BITS2(rawolen, ol = encodeUnicode(out, olen, ol, uni, prev_uni)); + // printf("%d:%d:%d\n", l, utf8len, uni); + prev_uni = uni; + l--; + } else { + int bin_count = 1; + for (int bi = l + 1; bi < len; bi++) { + char c_bi = in[bi]; + // if (c_bi > 0x1F && c_bi != 0x7F) + // break; + if (readUTF8(in, len, bi, &utf8len)) + break; + if (bi < (len - 4) && c_bi == in[bi - 1] && c_bi == in[bi + 1] && c_bi == in[bi + 2] && + c_bi == in[bi + 3]) + break; + bin_count++; + } + // printf("Bin:%d:%d:%x:%d\n", l, (unsigned char) c_in, (unsigned char) c_in, bin_count); + SAFE_APPEND_BITS2( + rawolen, ol = append_nibble_escape(out, olen, ol, state, usx_hcodes, usx_hcode_lens)); + SAFE_APPEND_BITS2(rawolen, ol = append_bits(out, olen, ol, 0xF8, 5)); + SAFE_APPEND_BITS2(rawolen, ol = encodeCount(out, olen, ol, bin_count)); + do { + SAFE_APPEND_BITS2(rawolen, ol = append_bits(out, olen, ol, in[l++], 8)); + } while (--bin_count); + l--; + } + } + } + + if (need_full_term_codes) { + const int orig_ol = ol; + SAFE_APPEND_BITS2( + rawolen, + ol = append_final_bits(out, olen, ol, state, is_all_upper, usx_hcodes, usx_hcode_lens)); + return (ol / 8) * 4 + (((ol - orig_ol) / 8) & 3); + } else { + const int rst = (ol + 7) / 8; + append_final_bits(out, rst, ol, state, is_all_upper, usx_hcodes, usx_hcode_lens); + return rst; + } +} + +// Main API function. See unishox2.h for documentation +int unishox2_compress(const char *in, + int len, + UNISHOX_API_OUT_AND_LEN(char *out, int olen), + const uint8_t usx_hcodes[], + const uint8_t usx_hcode_lens[], + const char *usx_freq_seq[], + const char *usx_templates[]) { + return unishox2_compress_lines(in, + len, + UNISHOX_API_OUT_AND_LEN(out, olen), + usx_hcodes, + usx_hcode_lens, + usx_freq_seq, + usx_templates, + NULL); +} + +// Main API function. See unishox2.h for documentation +int unishox2_compress_simple(const char *in, int len, char *out) { + return unishox2_compress_lines(in, + len, + UNISHOX_API_OUT_AND_LEN(out, INT_MAX - 1), + USX_HCODES_DFLT, + USX_HCODE_LENS_DFLT, + USX_FREQ_SEQ_DFLT, + USX_TEMPLATES, + NULL); +} + +// Reads one bit from in +int readBit(const char *in, int bit_no) { + return in[bit_no >> 3] & (0x80 >> (bit_no % 8)); +} + +// Reads next 8 bits, if available +int read8bitCode(const char *in, int len, int bit_no) { + int bit_pos = bit_no & 0x07; + int char_pos = bit_no >> 3; + len >>= 3; + uint8_t code = (((uint8_t)in[char_pos]) << bit_pos); + char_pos++; + if (char_pos < len) { + code |= ((uint8_t)in[char_pos]) >> (8 - bit_pos); + } else + code |= (0xFF >> (8 - bit_pos)); + return code; +} + +/// The list of veritical codes is split into 5 sections. Used by readVCodeIdx() +#define SECTION_COUNT 5 +/// Used by readVCodeIdx() for finding the section under which the code read using read8bitCode() +/// falls +uint8_t usx_vsections[] = {0x7F, 0xBF, 0xDF, 0xEF, 0xFF}; +/// Used by readVCodeIdx() for finding the section vertical position offset +uint8_t usx_vsection_pos[] = {0, 4, 8, 12, 20}; +/// Used by readVCodeIdx() for masking the code read by read8bitCode() +uint8_t usx_vsection_mask[] = {0x7F, 0x3F, 0x1F, 0x0F, 0x0F}; +/// Used by readVCodeIdx() for shifting the code read by read8bitCode() to obtain the vpos +uint8_t usx_vsection_shift[] = {5, 4, 3, 1, 0}; + +/// Vertical decoder lookup table - 3 bits code len, 5 bytes vertical pos +/// code len is one less as 8 cannot be accommodated in 3 bits +uint8_t usx_vcode_lookup[36] = { + (1 << 5) + 0, (1 << 5) + 0, (2 << 5) + 1, (2 << 5) + 2, // Section 1 + (3 << 5) + 3, (3 << 5) + 4, (3 << 5) + 5, (3 << 5) + 6, // Section 2 + (3 << 5) + 7, (3 << 5) + 7, (4 << 5) + 8, (4 << 5) + 9, // Section 3 + (5 << 5) + 10, (5 << 5) + 10, (5 << 5) + 11, (5 << 5) + 11, // Section 4 + (5 << 5) + 12, (5 << 5) + 12, (6 << 5) + 13, (6 << 5) + 14, (6 << 5) + 15, (6 << 5) + 15, + (6 << 5) + 16, (6 << 5) + 16, // Section 5 + (6 << 5) + 17, (6 << 5) + 17, (7 << 5) + 18, (7 << 5) + 19, (7 << 5) + 20, (7 << 5) + 21, + (7 << 5) + 22, (7 << 5) + 23, (7 << 5) + 24, (7 << 5) + 25, (7 << 5) + 26, (7 << 5) + 27}; + +/// Decodes the vertical code from the given bitstream at in \n +/// This is designed to use less memory using a 36 uint8_t buffer \n +/// compared to using a 256 uint8_t buffer to decode the next 8 bits read by read8bitCode() \n +/// by splitting the list of vertical codes. \n +/// Decoder is designed for using less memory, not speed. \n +/// Returns the veritical code index or 99 if match could not be found. \n +/// Also updates bit_no_p with how many ever bits used by the vertical code. +int readVCodeIdx(const char *in, int len, int *bit_no_p) { + if (*bit_no_p < len) { + uint8_t code = read8bitCode(in, len, *bit_no_p); + int i = 0; + do { + if (code <= usx_vsections[i]) { + uint8_t vcode = usx_vcode_lookup[usx_vsection_pos[i] + + ((code & usx_vsection_mask[i]) >> usx_vsection_shift[i])]; + (*bit_no_p) += ((vcode >> 5) + 1); + if (*bit_no_p > len) + return 99; + return vcode & 0x1F; + } + } while (++i < SECTION_COUNT); + } + return 99; +} + +/// Mask for retrieving each code to be decoded according to its length \n +/// Same as usx_mask so redundant +uint8_t len_masks[] = {0x80, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC, 0xFE, 0xFF}; +/// Decodes the horizontal code from the given bitstream at in \n +/// depending on the hcodes defined using usx_hcodes and usx_hcode_lens \n +/// Returns the horizontal code index or 99 if match could not be found. \n +/// Also updates bit_no_p with how many ever bits used by the horizontal code. +int readHCodeIdx(const char *in, + int len, + int *bit_no_p, + const uint8_t usx_hcodes[], + const uint8_t usx_hcode_lens[]) { + if (!usx_hcode_lens[USX_ALPHA]) + return USX_ALPHA; + if (*bit_no_p < len) { + uint8_t code = read8bitCode(in, len, *bit_no_p); + for (int code_pos = 0; code_pos < 5; code_pos++) { + if (usx_hcode_lens[code_pos] && + (code & len_masks[usx_hcode_lens[code_pos] - 1]) == usx_hcodes[code_pos]) { + *bit_no_p += usx_hcode_lens[code_pos]; + return code_pos; + } + } + } + return 99; +} + +// TODO: Last value check.. Also len check in readBit +/// Returns the position of step code (0, 10, 110, etc.) encountered in the stream +int getStepCodeIdx(const char *in, int len, int *bit_no_p, int limit) { + int idx = 0; + while (*bit_no_p < len && readBit(in, *bit_no_p)) { + idx++; + (*bit_no_p)++; + if (idx == limit) + return idx; + } + if (*bit_no_p >= len) + return 99; + (*bit_no_p)++; + return idx; +} + +/// Reads specified number of bits and builds the corresponding integer +int32_t getNumFromBits(const char *in, int len, int bit_no, int count) { + int32_t ret = 0; + while (count-- && bit_no < len) { + ret += (readBit(in, bit_no) ? 1 << count : 0); + bit_no++; + } + return count < 0 ? ret : -1; +} + +/// Decodes the count from the given bit stream at in. Also updates bit_no_p +int32_t readCount(const char *in, int *bit_no_p, int len) { + int idx = getStepCodeIdx(in, len, bit_no_p, 4); + if (idx == 99) + return -1; + if (*bit_no_p + count_bit_lens[idx] - 1 >= len) + return -1; + int32_t count = + getNumFromBits(in, len, *bit_no_p, count_bit_lens[idx]) + (idx ? count_adder[idx - 1] : 0); + (*bit_no_p) += count_bit_lens[idx]; + return count; +} + +/// Decodes the Unicode codepoint from the given bit stream at in. Also updates bit_no_p \n +/// When the step code is 5, reads the next step code to find out the special code. +int32_t readUnicode(const char *in, int *bit_no_p, int len) { + int idx = getStepCodeIdx(in, len, bit_no_p, 5); + if (idx == 99) + return 0x7FFFFF00 + 99; + if (idx == 5) { + idx = getStepCodeIdx(in, len, bit_no_p, 4); + return 0x7FFFFF00 + idx; + } + if (idx >= 0) { + int sign = (*bit_no_p < len ? readBit(in, *bit_no_p) : 0); + (*bit_no_p)++; + if (*bit_no_p + uni_bit_len[idx] - 1 >= len) + return 0x7FFFFF00 + 99; + int32_t count = getNumFromBits(in, len, *bit_no_p, uni_bit_len[idx]); + count += uni_adder[idx]; + (*bit_no_p) += uni_bit_len[idx]; + // printf("Sign: %d, Val:%d", sign, count); + return sign ? -count : count; + } + return 0; +} + +/// Macro to ensure that the decoder does not append more than olen bytes to out +#define DEC_OUTPUT_CHAR(out, olen, ol, c) \ + do { \ + char *const obuf = (out); \ + const int oidx = (ol); \ + const int limit = (olen); \ + if (limit <= oidx) \ + return limit + 1; \ + else if (oidx < 0) \ + return 0; \ + else \ + obuf[oidx] = (c); \ + } while (0) + +/// Macro to ensure that the decoder does not append more than olen bytes to out +#define DEC_OUTPUT_CHARS(olen, exp) \ + do { \ + const int newidx = (exp); \ + const int limit = (olen); \ + if (newidx > limit) \ + return limit + 1; \ + } while (0) + +/// Write given unicode code point to out as a UTF-8 sequence +int writeUTF8(char *out, int olen, int ol, int uni) { + if (uni < (1 << 11)) { + DEC_OUTPUT_CHAR(out, olen, ol++, 0xC0 + (uni >> 6)); + DEC_OUTPUT_CHAR(out, olen, ol++, 0x80 + (uni & 0x3F)); + } else if (uni < (1 << 16)) { + DEC_OUTPUT_CHAR(out, olen, ol++, 0xE0 + (uni >> 12)); + DEC_OUTPUT_CHAR(out, olen, ol++, 0x80 + ((uni >> 6) & 0x3F)); + DEC_OUTPUT_CHAR(out, olen, ol++, 0x80 + (uni & 0x3F)); + } else { + DEC_OUTPUT_CHAR(out, olen, ol++, 0xF0 + (uni >> 18)); + DEC_OUTPUT_CHAR(out, olen, ol++, 0x80 + ((uni >> 12) & 0x3F)); + DEC_OUTPUT_CHAR(out, olen, ol++, 0x80 + ((uni >> 6) & 0x3F)); + DEC_OUTPUT_CHAR(out, olen, ol++, 0x80 + (uni & 0x3F)); + } + return ol; +} + +/// Decode repeating sequence and appends to out +int decodeRepeat(const char *in, + int len, + char *out, + int olen, + int ol, + int *bit_no, + struct us_lnk_lst *prev_lines) { + if (prev_lines) { + int32_t dict_len = readCount(in, bit_no, len) + NICE_LEN; + if (dict_len < NICE_LEN) + return -1; + int32_t dist = readCount(in, bit_no, len); + if (dist < 0) + return -1; + int32_t ctx = readCount(in, bit_no, len); + if (ctx < 0) + return -1; + struct us_lnk_lst *cur_line = prev_lines; + const int left = olen - ol; + while (ctx-- && cur_line) + cur_line = cur_line->previous; + if (cur_line == NULL) + return -1; + if (left <= 0) + return olen + 1; + if ((size_t)dist >= strlen(cur_line->data)) + return -1; + memmove(out + ol, cur_line->data + dist, min_of(left, dict_len)); + if (left < dict_len) + return olen + 1; + ol += dict_len; + } else { + int32_t dict_len = readCount(in, bit_no, len) + NICE_LEN; + if (dict_len < NICE_LEN) + return -1; + int32_t dist = readCount(in, bit_no, len) + NICE_LEN - 1; + if (dist < NICE_LEN - 1) + return -1; + const int32_t left = olen - ol; + // printf("Decode len: %d, dist: %d\n", dict_len - NICE_LEN, dist - NICE_LEN + 1); + if (left <= 0) + return olen + 1; + if (ol - dist < 0) + return -1; + memmove(out + ol, out + ol - dist, min_of(left, dict_len)); + if (left < dict_len) + return olen + 1; + ol += dict_len; + } + return ol; +} + +/// Returns hex character corresponding to the 4 bit nibble +char getHexChar(int32_t nibble, int hex_type) { + if (nibble >= 0 && nibble <= 9) + return '0' + nibble; + else if (hex_type < USX_NIB_HEX_UPPER) + return 'a' + nibble - 10; + return 'A' + nibble - 10; +} + +// Main API function. See unishox2.h for documentation +int unishox2_decompress_lines(const char *in, + int len, + UNISHOX_API_OUT_AND_LEN(char *out, int olen), + const uint8_t usx_hcodes[], + const uint8_t usx_hcode_lens[], + const char *usx_freq_seq[], + const char *usx_templates[], + struct us_lnk_lst *prev_lines) { + int dstate; + int bit_no; + int h, v; + uint8_t is_all_upper; +#if (UNISHOX_API_OUT_AND_LEN(0, 1)) == 0 + const int olen = INT_MAX - 1; +#endif + + init_coder(); + int ol = 0; + bit_no = UNISHOX_MAGIC_BIT_LEN; // ignore the magic bit + dstate = h = USX_ALPHA; + is_all_upper = 0; + + int prev_uni = 0; + + len <<= 3; + while (bit_no < len) { + int orig_bit_no = bit_no; + if (dstate == USX_DELTA || h == USX_DELTA) { + if (dstate != USX_DELTA) + h = dstate; + int32_t delta = readUnicode(in, &bit_no, len); + if ((delta >> 8) == 0x7FFFFF) { + int spl_code_idx = delta & 0x000000FF; + if (spl_code_idx == 99) + break; + switch (spl_code_idx) { + case 0: + DEC_OUTPUT_CHAR(out, olen, ol++, ' '); + continue; + case 1: + h = readHCodeIdx(in, len, &bit_no, usx_hcodes, usx_hcode_lens); + if (h == 99) { + bit_no = len; + continue; + } + if (h == USX_DELTA || h == USX_ALPHA) { + dstate = h; + continue; + } + if (h == USX_DICT) { + int rpt_ret = decodeRepeat(in, len, out, olen, ol, &bit_no, prev_lines); + if (rpt_ret < 0) + return ol; // if we break here it will only break out of switch + DEC_OUTPUT_CHARS(olen, ol = rpt_ret); + h = dstate; + continue; + } + break; + case 2: + DEC_OUTPUT_CHAR(out, olen, ol++, ','); + continue; + case 3: + DEC_OUTPUT_CHAR(out, olen, ol++, '.'); + continue; + case 4: + DEC_OUTPUT_CHAR(out, olen, ol++, 10); + continue; + } + } else { + prev_uni += delta; + DEC_OUTPUT_CHARS(olen, ol = writeUTF8(out, olen, ol, prev_uni)); + // printf("%ld, ", prev_uni); + } + if (dstate == USX_DELTA && h == USX_DELTA) + continue; + } else + h = dstate; + char c = 0; + uint8_t is_upper = is_all_upper; + v = readVCodeIdx(in, len, &bit_no); + if (v == 99 || h == 99) { + bit_no = orig_bit_no; + break; + } + if (v == 0 && h != USX_SYM) { + if (bit_no >= len) + break; + if (h != USX_NUM || dstate != USX_DELTA) { + h = readHCodeIdx(in, len, &bit_no, usx_hcodes, usx_hcode_lens); + if (h == 99 || bit_no >= len) { + bit_no = orig_bit_no; + break; + } + } + if (h == USX_ALPHA) { + if (dstate == USX_ALPHA) { + if (!usx_hcode_lens[USX_ALPHA] && + TERM_BYTE_PRESET_1 == (read8bitCode(in, len, bit_no - SW_CODE_LEN) & + (0xFF << (8 - (is_all_upper ? TERM_BYTE_PRESET_1_LEN_UPPER + : TERM_BYTE_PRESET_1_LEN_LOWER))))) + break; // Terminator for preset 1 + if (is_all_upper) { + is_upper = is_all_upper = 0; + continue; + } + v = readVCodeIdx(in, len, &bit_no); + if (v == 99) { + bit_no = orig_bit_no; + break; + } + if (v == 0) { + h = readHCodeIdx(in, len, &bit_no, usx_hcodes, usx_hcode_lens); + if (h == 99) { + bit_no = orig_bit_no; + break; + } + if (h == USX_ALPHA) { + is_all_upper = 1; + continue; + } + } + is_upper = 1; + } else { + dstate = USX_ALPHA; + continue; + } + } else if (h == USX_DICT) { + int rpt_ret = decodeRepeat(in, len, out, olen, ol, &bit_no, prev_lines); + if (rpt_ret < 0) + break; + DEC_OUTPUT_CHARS(olen, ol = rpt_ret); + continue; + } else if (h == USX_DELTA) { + // printf("Sign: %d, bitno: %d\n", sign, bit_no); + // printf("Code: %d\n", prev_uni); + // printf("BitNo: %d\n", bit_no); + continue; + } else { + if (h != USX_NUM || dstate != USX_DELTA) + v = readVCodeIdx(in, len, &bit_no); + if (v == 99) { + bit_no = orig_bit_no; + break; + } + if (h == USX_NUM && v == 0) { + int idx = getStepCodeIdx(in, len, &bit_no, 5); + if (idx == 99) + break; + if (idx == 0) { + idx = getStepCodeIdx(in, len, &bit_no, 4); + if (idx >= 5) + break; + int32_t rem = readCount(in, &bit_no, len); + if (rem < 0) + break; + if (usx_templates[idx] == NULL) + break; + size_t tlen = strlen(usx_templates[idx]); + if ((size_t)rem > tlen) + break; + rem = tlen - rem; + int eof = 0; + for (int j = 0; j < rem; j++) { + char c_t = usx_templates[idx][j]; + if (c_t == 'f' || c_t == 'r' || c_t == 't' || c_t == 'o' || c_t == 'F') { + char nibble_len = + (c_t == 'f' || c_t == 'F' ? 4 : (c_t == 'r' ? 3 : (c_t == 't' ? 2 : 1))); + const int32_t raw_char = getNumFromBits(in, len, bit_no, nibble_len); + if (raw_char < 0) { + eof = 1; + break; + } + DEC_OUTPUT_CHAR( + out, + olen, + ol++, + getHexChar((char)raw_char, c_t == 'f' ? USX_NIB_HEX_LOWER : USX_NIB_HEX_UPPER)); + bit_no += nibble_len; + } else + DEC_OUTPUT_CHAR(out, olen, ol++, c_t); + } + if (eof) + break; // reach input eof + } else if (idx == 5) { + int32_t bin_count = readCount(in, &bit_no, len); + if (bin_count < 0) + break; + if (bin_count == 0) // invalid encoding + break; + do { + const int32_t raw_char = getNumFromBits(in, len, bit_no, 8); + if (raw_char < 0) + break; + DEC_OUTPUT_CHAR(out, olen, ol++, (char)raw_char); + bit_no += 8; + } while (--bin_count); + if (bin_count > 0) + break; // reach input eof + } else { + int32_t nibble_count = 0; + if (idx == 2 || idx == 4) + nibble_count = 32; + else { + nibble_count = readCount(in, &bit_no, len); + if (nibble_count < 0) + break; + if (nibble_count == 0) // invalid encoding + break; + } + do { + int32_t nibble = getNumFromBits(in, len, bit_no, 4); + if (nibble < 0) + break; + DEC_OUTPUT_CHAR(out, + olen, + ol++, + getHexChar(nibble, idx < 3 ? USX_NIB_HEX_LOWER : USX_NIB_HEX_UPPER)); + if ((idx == 2 || idx == 4) && (nibble_count == 25 || nibble_count == 21 || + nibble_count == 17 || nibble_count == 13)) + DEC_OUTPUT_CHAR(out, olen, ol++, '-'); + bit_no += 4; + } while (--nibble_count); + if (nibble_count > 0) + break; // reach input eof + } + if (dstate == USX_DELTA) + h = USX_DELTA; + continue; + } + } + } + if (is_upper && v == 1) { + h = dstate = USX_DELTA; // continuous delta coding + continue; + } + if (h < 3 && v < 28) + c = usx_sets[h][v]; + if (c >= 'a' && c <= 'z') { + dstate = USX_ALPHA; + if (is_upper) + c -= 32; + } else { + if (c >= '0' && c <= '9') { + dstate = USX_NUM; + } else if (c == 0) { + if (v == 8) { + DEC_OUTPUT_CHAR(out, olen, ol++, '\r'); + DEC_OUTPUT_CHAR(out, olen, ol++, '\n'); + } else if (h == USX_NUM && v == 26) { + int32_t count = readCount(in, &bit_no, len); + if (count < 0) + break; + count += 4; + if (ol <= 0) + return 0; // invalid encoding + char rpt_c = out[ol - 1]; + while (count--) + DEC_OUTPUT_CHAR(out, olen, ol++, rpt_c); + } else if (h == USX_SYM && v > 24) { + v -= 25; + const int freqlen = (int)strlen(usx_freq_seq[v]); + const int left = olen - ol; + if (left <= 0) + return olen + 1; + memcpy(out + ol, usx_freq_seq[v], min_of(left, freqlen)); + if (left < freqlen) + return olen + 1; + ol += freqlen; + } else if (h == USX_NUM && v > 22 && v < 26) { + v -= (23 - 3); + const int freqlen = (int)strlen(usx_freq_seq[v]); + const int left = olen - ol; + if (left <= 0) + return olen + 1; + memcpy(out + ol, usx_freq_seq[v], min_of(left, freqlen)); + if (left < freqlen) + return olen + 1; + ol += freqlen; + } else + break; // Terminator + if (dstate == USX_DELTA) + h = USX_DELTA; + continue; + } + } + if (dstate == USX_DELTA) + h = USX_DELTA; + DEC_OUTPUT_CHAR(out, olen, ol++, c); + } + + return ol; +} + +// Main API function. See unishox2.h for documentation +int unishox2_decompress(const char *in, + int len, + UNISHOX_API_OUT_AND_LEN(char *out, int olen), + const uint8_t usx_hcodes[], + const uint8_t usx_hcode_lens[], + const char *usx_freq_seq[], + const char *usx_templates[]) { + return unishox2_decompress_lines(in, + len, + UNISHOX_API_OUT_AND_LEN(out, olen), + usx_hcodes, + usx_hcode_lens, + usx_freq_seq, + usx_templates, + NULL); +} + +// Main API function. See unishox2.h for documentation +int unishox2_decompress_simple(const char *in, int len, char *out) { + return unishox2_decompress(in, len, UNISHOX_API_OUT_AND_LEN(out, INT_MAX - 1), USX_PSET_DFLT); +} \ No newline at end of file diff --git a/firmware_p4/components/Applications/LoRa/rnode/include/rnode.h b/firmware_p4/components/Applications/LoRa/rnode/include/rnode.h new file mode 100644 index 00000000..cabca263 --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/rnode/include/rnode.h @@ -0,0 +1,95 @@ +// Copyright (c) 2026 HIGH CODE LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 + +#ifndef RNODE_H +#define RNODE_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include + +#include "esp_err.h" + +#include "sx1262.h" + +#define RNODE_FW_VERSION_MAJOR 1 +#define RNODE_FW_VERSION_MINOR 52 + +#define RNODE_PLATFORM_ESP32 0x80 +#define RNODE_MCU_ESP32 0x81 + +#define RNODE_DEFAULT_FREQ_HZ 915000000U +#define RNODE_DEFAULT_BW_HZ 125000U +#define RNODE_DEFAULT_SF 8 +#define RNODE_DEFAULT_CR 5 +#define RNODE_DEFAULT_TX_POWER_DBM 17 + +/** + * @brief Current radio configuration applied by the host over KISS. + */ +typedef struct { + uint32_t freq_hz; + uint32_t bw_hz; + uint8_t sf; + uint8_t cr; + int8_t tx_power_dbm; + bool is_radio_on; +} rnode_radio_cfg_t; + +/** + * @brief Telemetry state reported to the host. + */ +typedef struct { + uint32_t rx_count; + uint32_t tx_count; + int16_t last_rssi_dbm; + int8_t last_snr_quarter_db; + uint8_t battery_pct; + int8_t cpu_temp_c; +} rnode_stats_t; + +/** + * @brief Initialize the RNode subsystem (KISS engine + serial + SX1262 hookup). + * + * @param hal SX1262 HAL previously created via sx1262_hal_create. + * @return ESP_OK on success. + */ +esp_err_t rnode_init(const sx1262_hal_t *hal); + +/** + * @brief Start radio IRQ task and continuous RX. + * + * @return ESP_OK on success. + */ +esp_err_t rnode_start(void); + +/** + * @brief Periodic service. Call from the main loop. Drains serial RX, + * runs the KISS decoder and dispatches command frames. + */ +void rnode_poll(void); + +/** + * @brief Read-only snapshot of the current radio configuration. + */ +const rnode_radio_cfg_t *rnode_get_radio_cfg(void); + +/** + * @brief Read-only snapshot of the telemetry counters. + */ +const rnode_stats_t *rnode_get_stats(void); + +#ifdef __cplusplus +} +#endif + +#endif // RNODE_H diff --git a/firmware_p4/components/Applications/LoRa/rnode/include/rnode_kiss.h b/firmware_p4/components/Applications/LoRa/rnode/include/rnode_kiss.h new file mode 100644 index 00000000..c76858ae --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/rnode/include/rnode_kiss.h @@ -0,0 +1,90 @@ +// Copyright (c) 2026 HIGH CODE LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 + +#ifndef RNODE_KISS_H +#define RNODE_KISS_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include + +#define KISS_FEND 0xC0 +#define KISS_FESC 0xDB +#define KISS_TFEND 0xDC +#define KISS_TFESC 0xDD + +#define RNODE_KISS_FRAME_MAX 512 + +/** + * @brief State machine for the KISS frame decoder. + * + * The decoder is byte-driven. When a full frame becomes available the + * caller drains it via rnode_kiss_decoder_take_frame. + */ +typedef struct { + uint8_t buf[RNODE_KISS_FRAME_MAX]; + size_t len; + bool is_in_frame; + bool is_escaped; + bool has_frame_ready; +} rnode_kiss_decoder_t; + +/** + * @brief Reset the decoder to its initial state. + * + * @param d Decoder instance. Must not be NULL. + */ +void rnode_kiss_decoder_reset(rnode_kiss_decoder_t *d); + +/** + * @brief Feed one received byte to the decoder. + * + * @param d Decoder instance. + * @param byte Byte received from serial. + * @return true if a complete frame became available after this byte. + */ +bool rnode_kiss_decoder_feed(rnode_kiss_decoder_t *d, uint8_t byte); + +/** + * @brief Pop the ready frame and clear the flag. + * + * @param[in] d Decoder. + * @param[out] out_buf Destination buffer (full frame: cmd + payload). + * @param cap Destination capacity. + * @param[out] out_len Frame size written to out_buf. + * @return true if a frame was popped, false otherwise. + */ +bool rnode_kiss_decoder_take_frame(rnode_kiss_decoder_t *d, + uint8_t *out_buf, + size_t cap, + size_t *out_len); + +/** + * @brief Encode a KISS frame ready for TX on the serial link. + * + * Wraps payload with FEND markers and escapes special bytes. + * + * @param[in] cmd_id First logical byte of the frame. + * @param[in] payload Data buffer (may be NULL if payload_len == 0). + * @param payload_len Payload size in bytes. + * @param[out] out_buf Destination for the encoded frame. + * @param cap Capacity of out_buf. + * @return Encoded length, or 0 if cap is exceeded. + */ +size_t rnode_kiss_encode( + uint8_t cmd_id, const uint8_t *payload, size_t payload_len, uint8_t *out_buf, size_t cap); + +#ifdef __cplusplus +} +#endif + +#endif // RNODE_KISS_H diff --git a/firmware_p4/components/Applications/LoRa/rnode/include/rnode_serial.h b/firmware_p4/components/Applications/LoRa/rnode/include/rnode_serial.h new file mode 100644 index 00000000..24ed734b --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/rnode/include/rnode_serial.h @@ -0,0 +1,52 @@ +// Copyright (c) 2026 HIGH CODE LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 + +#ifndef RNODE_SERIAL_H +#define RNODE_SERIAL_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +#include "esp_err.h" + +/** + * @brief Initialize UART0 in raw mode for the KISS protocol. + * + * ESP32-S3 default pins: TX=GPIO43, RX=GPIO44. 115200 8N1 no flow control. + * + * @return ESP_OK on success, error code otherwise. + */ +esp_err_t rnode_serial_init(void); + +/** + * @brief Write raw bytes to the UART. Blocking. + * + * @param data Buffer to write. + * @param len Number of bytes. + * @return Bytes written, or -1 on error. + */ +int rnode_serial_write(const uint8_t *data, size_t len); + +/** + * @brief Read raw bytes from the UART (non-blocking, timeout 0). + * + * @param out Destination buffer. + * @param cap Destination capacity. + * @return Bytes read (>= 0), 0 if nothing available. + */ +int rnode_serial_read(uint8_t *out, size_t cap); + +#ifdef __cplusplus +} +#endif + +#endif // RNODE_SERIAL_H diff --git a/firmware_p4/components/Applications/LoRa/rnode/rnode.c b/firmware_p4/components/Applications/LoRa/rnode/rnode.c new file mode 100644 index 00000000..aa7d5434 --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/rnode/rnode.c @@ -0,0 +1,415 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#include "rnode.h" + +#include + +#include "esp_log.h" +#include "esp_random.h" +#include "esp_timer.h" +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" + +#include "rnode_internal.h" +#include "rnode_kiss.h" +#include "rnode_serial.h" +#include "sx1262.h" +#include "sx1262_regs.h" +#include "sx1262_types.h" + +static const char *TAG = "RNODE"; + +#define RNODE_SERIAL_RX_CHUNK 256 +#define RNODE_RX_DRAIN_BUDGET 8 +#define RNODE_CAD_TIMEOUT_MS 200 +#define RNODE_CSMA_RETRIES 3 +#define RNODE_CSMA_BACKOFF_BASE_MS 20 +#define RNODE_CSMA_BACKOFF_RAND_MS 60 + +static rnode_radio_cfg_t s_cfg; +static rnode_stats_t s_stats; +static rnode_kiss_decoder_t s_decoder; +static sx1262_hal_t s_hal; +static bool s_is_initialized = false; +static bool s_has_hal = false; +static uint64_t s_tx_start_us = 0; +static volatile bool s_is_cad_pending = false; +static volatile bool s_is_cad_busy = false; + +static uint8_t map_sf(uint8_t sf); +static uint8_t map_bw(uint32_t bw_hz); +static uint8_t map_cr(uint8_t cr); +static sx1262_config_t build_lora_cfg(void); +static void on_radio_rx(const sx1262_packet_t *pkt, void *ctx); +static void on_radio_tx_done(void *ctx); +static void on_radio_error(int err, void *ctx); +static void on_radio_cad_done(bool is_active, void *ctx); +static bool csma_check_clear(void); +static uint32_t csma_backoff_ms(void); + +rnode_radio_cfg_t *rnode_cfg_mut(void) { + return &s_cfg; +} + +rnode_stats_t *rnode_stats_mut(void) { + return &s_stats; +} + +const rnode_radio_cfg_t *rnode_get_radio_cfg(void) { + return &s_cfg; +} + +const rnode_stats_t *rnode_get_stats(void) { + return &s_stats; +} + +void rnode_send_frame(uint8_t cmd_id, const uint8_t *payload, size_t len) { + uint8_t frame[RNODE_KISS_FRAME_MAX]; + size_t n = rnode_kiss_encode(cmd_id, payload, len, frame, sizeof(frame)); + if (n == 0) { + ESP_LOGW(TAG, "kiss_encode overflow (cmd=0x%02X len=%u)", cmd_id, (unsigned)len); + return; + } + rnode_serial_write(frame, n); +} + +void rnode_send_error(uint8_t code) { + rnode_send_frame(RNODE_CMD_ERROR, &code, 1); +} + +esp_err_t rnode_apply_radio_cfg(void) { + sx1262_config_t cfg = build_lora_cfg(); + esp_err_t ret = sx1262_config_lora(&cfg); + if (ret != ESP_OK) { + return ret; + } + if (s_cfg.is_radio_on) { + sx1262_receive_continuous(); + } + return ESP_OK; +} + +esp_err_t rnode_set_radio_state(bool is_on) { + if (is_on) { + return sx1262_receive_continuous(); + } + sx1262_stop_rx(); + return ESP_OK; +} + +esp_err_t rnode_radio_transmit(const uint8_t *data, size_t len) { + if (data == NULL || len == 0 || len > 255) { + return ESP_ERR_INVALID_ARG; + } + + bool is_clear = false; + for (int attempt = 0; attempt <= RNODE_CSMA_RETRIES; attempt++) { + if (csma_check_clear()) { + is_clear = true; + break; + } + if (attempt < RNODE_CSMA_RETRIES) { + vTaskDelay(pdMS_TO_TICKS(csma_backoff_ms())); + } + } + if (!is_clear) { + ESP_LOGW(TAG, "CSMA: channel busy after %d retries, dropping TX", RNODE_CSMA_RETRIES); + if (s_cfg.is_radio_on) { + sx1262_receive_continuous(); + } + return ESP_ERR_TIMEOUT; + } + + uint8_t ready = 0x01; + rnode_send_frame(RNODE_CMD_READY, &ready, 1); + + s_tx_start_us = (uint64_t)esp_timer_get_time(); + esp_err_t ret = sx1262_transmit(data, (uint8_t)len, 5000); + if (ret != ESP_OK) { + if (s_cfg.is_radio_on) { + sx1262_receive_continuous(); + } + return ret; + } + uint32_t airtime_ms = rnode_airtime_estimate_ms(len, s_cfg.bw_hz, s_cfg.sf, s_cfg.cr); + rnode_airtime_record_tx(airtime_ms); + return ESP_OK; +} + +esp_err_t rnode_init(const sx1262_hal_t *hal) { + if (s_is_initialized) { + return ESP_ERR_INVALID_STATE; + } + if (hal == NULL) { + return ESP_ERR_INVALID_ARG; + } + + memset(&s_cfg, 0, sizeof(s_cfg)); + memset(&s_stats, 0, sizeof(s_stats)); + rnode_kiss_decoder_reset(&s_decoder); + + s_stats.battery_pct = 100; + s_stats.cpu_temp_c = 25; + + s_hal = *hal; + s_has_hal = true; + + rnode_nvs_load_cfg(); + + sx1262_config_t cfg = build_lora_cfg(); + esp_err_t ret = sx1262_init(&cfg); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "sx1262_init failed: %s", esp_err_to_name(ret)); + return ret; + } + + sx1262_callbacks_t cbs = { + .on_tx_done = on_radio_tx_done, + .on_rx_done = on_radio_rx, + .on_cad_done = on_radio_cad_done, + .on_timeout = NULL, + .on_error = on_radio_error, + .cb_ctx = NULL, + }; + sx1262_set_callbacks(&cbs); + + ret = rnode_serial_init(); + if (ret != ESP_OK) { + return ret; + } + + s_is_initialized = true; + ESP_LOGI(TAG, + "init done -- fw=%u.%u freq=%lu sf=%u bw=%lu cr=4/%u tx=%ddBm", + RNODE_FW_VERSION_MAJOR, + RNODE_FW_VERSION_MINOR, + (unsigned long)s_cfg.freq_hz, + s_cfg.sf, + (unsigned long)s_cfg.bw_hz, + s_cfg.cr, + s_cfg.tx_power_dbm); + return ESP_OK; +} + +esp_err_t rnode_start(void) { + if (!s_is_initialized) { + return ESP_ERR_INVALID_STATE; + } + esp_err_t ret = sx1262_start(); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "sx1262_start failed: %s", esp_err_to_name(ret)); + return ret; + } + s_cfg.is_radio_on = true; + return sx1262_receive_continuous(); +} + +void rnode_poll(void) { + if (!s_is_initialized) { + return; + } + + uint8_t rx[RNODE_SERIAL_RX_CHUNK]; + int n = rnode_serial_read(rx, sizeof(rx)); + for (int i = 0; i < n; i++) { + if (rnode_kiss_decoder_feed(&s_decoder, rx[i])) { + uint8_t frame[RNODE_KISS_FRAME_MAX]; + size_t flen = 0; + if (rnode_kiss_decoder_take_frame(&s_decoder, frame, sizeof(frame), &flen)) { + rnode_dispatch(frame, flen); + } + } + } + + for (int i = 0; i < RNODE_RX_DRAIN_BUDGET; i++) { + sx1262_packet_t pkt; + if (sx1262_get_packet(&pkt) != ESP_OK) { + break; + } + } +} + +static uint8_t map_sf(uint8_t sf) { + switch (sf) { + case 5: + return SX1262_LORA_SF5; + case 6: + return SX1262_LORA_SF6; + case 7: + return SX1262_LORA_SF7; + case 8: + return SX1262_LORA_SF8; + case 9: + return SX1262_LORA_SF9; + case 10: + return SX1262_LORA_SF10; + case 11: + return SX1262_LORA_SF11; + case 12: + return SX1262_LORA_SF12; + default: + return SX1262_LORA_SF8; + } +} + +static uint8_t map_bw(uint32_t bw_hz) { + if (bw_hz <= 7810) + return SX1262_LORA_BW_7; + if (bw_hz <= 10420) + return SX1262_LORA_BW_10; + if (bw_hz <= 15630) + return SX1262_LORA_BW_15; + if (bw_hz <= 20830) + return SX1262_LORA_BW_20; + if (bw_hz <= 31250) + return SX1262_LORA_BW_31; + if (bw_hz <= 41670) + return SX1262_LORA_BW_41; + if (bw_hz <= 62500) + return SX1262_LORA_BW_62; + if (bw_hz <= 125000) + return SX1262_LORA_BW_125; + if (bw_hz <= 250000) + return SX1262_LORA_BW_250; + return SX1262_LORA_BW_500; +} + +static uint8_t map_cr(uint8_t cr) { + switch (cr) { + case 5: + return SX1262_LORA_CR_4_5; + case 6: + return SX1262_LORA_CR_4_6; + case 7: + return SX1262_LORA_CR_4_7; + case 8: + return SX1262_LORA_CR_4_8; + default: + return SX1262_LORA_CR_4_5; + } +} + +static sx1262_config_t build_lora_cfg(void) { + sx1262_config_t cfg = { + .hal = s_hal, + .frequency_hz = s_cfg.freq_hz, + .sf = map_sf(s_cfg.sf), + .bw = map_bw(s_cfg.bw_hz), + .cr = map_cr(s_cfg.cr), + .tx_power_dbm = s_cfg.tx_power_dbm, + .preamble_len = 12, + .is_crc_on = true, + .is_inverted_iq = false, + .is_implicit_hdr = false, + .is_public_network = false, + }; + return cfg; +} + +static void on_radio_rx(const sx1262_packet_t *pkt, void *ctx) { + (void)ctx; + if (pkt == NULL || pkt->len == 0) { + return; + } + if (pkt->has_crc_error || pkt->has_header_error) { + return; + } + + s_stats.rx_count++; + s_stats.last_rssi_dbm = pkt->rssi_pkt_dbm; + s_stats.last_snr_quarter_db = pkt->snr_pkt_db; + + rnode_send_frame(RNODE_CMD_DATA, pkt->buf, pkt->len); + + int rssi = pkt->rssi_pkt_dbm; + if (rssi < -157) + rssi = -157; + if (rssi > 98) + rssi = 98; + uint8_t rssi_byte = (uint8_t)(rssi + RNODE_RSSI_OFFSET); + rnode_send_frame(RNODE_CMD_STAT_RSSI, &rssi_byte, 1); + + uint8_t snr_byte = (uint8_t)pkt->snr_pkt_db; + rnode_send_frame(RNODE_CMD_STAT_SNR, &snr_byte, 1); + + uint8_t rxc[4] = { + (uint8_t)((s_stats.rx_count >> 24) & 0xFF), + (uint8_t)((s_stats.rx_count >> 16) & 0xFF), + (uint8_t)((s_stats.rx_count >> 8) & 0xFF), + (uint8_t)(s_stats.rx_count & 0xFF), + }; + rnode_send_frame(RNODE_CMD_STAT_RX, rxc, sizeof(rxc)); +} + +static void on_radio_tx_done(void *ctx) { + (void)ctx; + if (s_tx_start_us > 0) { + s_tx_start_us = 0; + } + s_stats.tx_count++; + + uint8_t txc[4] = { + (uint8_t)((s_stats.tx_count >> 24) & 0xFF), + (uint8_t)((s_stats.tx_count >> 16) & 0xFF), + (uint8_t)((s_stats.tx_count >> 8) & 0xFF), + (uint8_t)(s_stats.tx_count & 0xFF), + }; + rnode_send_frame(RNODE_CMD_STAT_TX, txc, sizeof(txc)); + + if (s_cfg.is_radio_on) { + sx1262_receive_continuous(); + } +} + +static void on_radio_error(int err, void *ctx) { + (void)ctx; + ESP_LOGW(TAG, "radio error: %d", err); +} + +static void on_radio_cad_done(bool is_active, void *ctx) { + (void)ctx; + s_is_cad_busy = is_active; + s_is_cad_pending = false; +} + +static bool csma_check_clear(void) { + s_is_cad_pending = true; + s_is_cad_busy = false; + + sx1262_stop_rx(); + esp_err_t err = sx1262_cad_start(); + if (err != ESP_OK) { + s_is_cad_pending = false; + return true; + } + + uint32_t deadline_ms = (uint32_t)(esp_timer_get_time() / 1000ULL) + RNODE_CAD_TIMEOUT_MS; + while (s_is_cad_pending) { + uint32_t now_ms = (uint32_t)(esp_timer_get_time() / 1000ULL); + if ((int32_t)(now_ms - deadline_ms) >= 0) { + s_is_cad_pending = false; + ESP_LOGW(TAG, "CAD timeout -- assume clear"); + return true; + } + vTaskDelay(pdMS_TO_TICKS(1)); + } + return !s_is_cad_busy; +} + +static uint32_t csma_backoff_ms(void) { + uint32_t r = esp_random() % RNODE_CSMA_BACKOFF_RAND_MS; + return RNODE_CSMA_BACKOFF_BASE_MS + r; +} diff --git a/firmware_p4/components/Applications/LoRa/rnode/rnode_airtime.c b/firmware_p4/components/Applications/LoRa/rnode/rnode_airtime.c new file mode 100644 index 00000000..607e1824 --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/rnode/rnode_airtime.c @@ -0,0 +1,133 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#include "rnode_internal.h" + +#include + +#include "esp_timer.h" + +#define AT_SHORT_WINDOW_MS 60000UL +#define AT_LONG_WINDOW_MS 3600000UL +#define AT_RING_SLOTS 64 + +typedef struct { + uint64_t end_us; + uint32_t duration_ms; +} at_event_t; + +static at_event_t s_events[AT_RING_SLOTS]; +static uint8_t s_event_head = 0; +static uint8_t s_event_count = 0; +static uint16_t s_st_limit_cpct = 0; +static uint16_t s_lt_limit_cpct = 0; + +static uint64_t now_us(void); +static uint32_t airtime_in_window(uint32_t window_ms); +static uint16_t pct_centi(uint32_t airtime_ms, uint32_t window_ms); + +void rnode_airtime_record_tx(uint32_t airtime_ms) { + s_events[s_event_head].end_us = now_us(); + s_events[s_event_head].duration_ms = airtime_ms; + s_event_head = (s_event_head + 1) % AT_RING_SLOTS; + if (s_event_count < AT_RING_SLOTS) { + s_event_count++; + } +} + +uint16_t rnode_airtime_short(void) { + uint32_t ms = airtime_in_window(AT_SHORT_WINDOW_MS); + return pct_centi(ms, AT_SHORT_WINDOW_MS); +} + +uint16_t rnode_airtime_long(void) { + uint32_t ms = airtime_in_window(AT_LONG_WINDOW_MS); + return pct_centi(ms, AT_LONG_WINDOW_MS); +} + +void rnode_airtime_set_limits(uint16_t st_limit_cpct, uint16_t lt_limit_cpct) { + s_st_limit_cpct = st_limit_cpct; + s_lt_limit_cpct = lt_limit_cpct; +} + +bool rnode_airtime_is_blocked(void) { + if (s_st_limit_cpct > 0 && rnode_airtime_short() >= s_st_limit_cpct) { + return true; + } + if (s_lt_limit_cpct > 0 && rnode_airtime_long() >= s_lt_limit_cpct) { + return true; + } + return false; +} + +uint32_t rnode_airtime_estimate_ms(size_t payload_bytes, uint32_t bw_hz, uint8_t sf, uint8_t cr) { + if (bw_hz == 0 || sf < 5 || sf > 12) { + return 0; + } + double rs = (double)bw_hz / (double)(1U << sf); + double ts = 1.0 / rs; + double preamble_symbols = 8.0 + 4.25; + double cr_factor = (double)cr; + double pl = (double)payload_bytes; + double sf_d = (double)sf; + double de = (sf >= 11) ? 1.0 : 0.0; + double numerator = 8.0 * pl - 4.0 * sf_d + 28.0 + 16.0; + double denominator = 4.0 * (sf_d - 2.0 * de); + double payload_symbols = 8.0 + ceil(numerator / denominator) * cr_factor; + if (payload_symbols < 8.0) { + payload_symbols = 8.0; + } + double total_symbols = preamble_symbols + payload_symbols; + double airtime_s = total_symbols * ts; + double airtime_ms = airtime_s * 1000.0; + if (airtime_ms < 1.0) { + airtime_ms = 1.0; + } + return (uint32_t)(airtime_ms + 0.5); +} + +static uint64_t now_us(void) { + return (uint64_t)esp_timer_get_time(); +} + +static uint32_t airtime_in_window(uint32_t window_ms) { + uint64_t cutoff_us = now_us(); + uint64_t window_us = (uint64_t)window_ms * 1000ULL; + if (cutoff_us < window_us) { + cutoff_us = 0; + } else { + cutoff_us -= window_us; + } + uint32_t sum_ms = 0; + for (uint8_t i = 0; i < s_event_count; i++) { + uint8_t idx = (s_event_head + AT_RING_SLOTS - 1 - i) % AT_RING_SLOTS; + if (s_events[idx].end_us < cutoff_us) { + break; + } + sum_ms += s_events[idx].duration_ms; + } + return sum_ms; +} + +static uint16_t pct_centi(uint32_t airtime_ms, uint32_t window_ms) { + if (window_ms == 0) { + return 0; + } + uint64_t v = (uint64_t)airtime_ms * 10000ULL / (uint64_t)window_ms; + if (v > 10000ULL) { + v = 10000ULL; + } + return (uint16_t)v; +} diff --git a/firmware_p4/components/Applications/LoRa/rnode/rnode_commands.c b/firmware_p4/components/Applications/LoRa/rnode/rnode_commands.c new file mode 100644 index 00000000..e7a69b98 --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/rnode/rnode_commands.c @@ -0,0 +1,393 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#include "rnode_internal.h" + +#include + +#include "esp_log.h" +#include "esp_random.h" +#include "esp_system.h" +#include "esp_timer.h" + +static const char *TAG = "RNODE_CMD"; + +static uint32_t read_be32(const uint8_t *p); +static uint16_t read_be16(const uint8_t *p); +static void write_be32(uint8_t *out, uint32_t v); + +static void handle_detect(const uint8_t *payload, size_t len); +static void handle_fw_version(const uint8_t *payload, size_t len); +static void handle_platform(const uint8_t *payload, size_t len); +static void handle_mcu(const uint8_t *payload, size_t len); +static void handle_frequency(const uint8_t *payload, size_t len); +static void handle_bandwidth(const uint8_t *payload, size_t len); +static void handle_txpower(const uint8_t *payload, size_t len); +static void handle_sf(const uint8_t *payload, size_t len); +static void handle_cr(const uint8_t *payload, size_t len); +static void handle_radio_state(const uint8_t *payload, size_t len); +static void handle_data(const uint8_t *payload, size_t len); +static void handle_st_alock(const uint8_t *payload, size_t len); +static void handle_lt_alock(const uint8_t *payload, size_t len); +static void handle_blink(const uint8_t *payload, size_t len); +static void handle_random(const uint8_t *payload, size_t len); +static void handle_reset(const uint8_t *payload, size_t len); +static void handle_leave(const uint8_t *payload, size_t len); +static void handle_stat_chtm(const uint8_t *payload, size_t len); +static void handle_stat_phyprm(const uint8_t *payload, size_t len); +static void handle_stat_bat(const uint8_t *payload, size_t len); +static void handle_stat_temp(const uint8_t *payload, size_t len); +static void handle_stat_csma(const uint8_t *payload, size_t len); + +void rnode_dispatch(const uint8_t *frame, size_t len) { + if (frame == NULL || len == 0) { + return; + } + uint8_t cmd = frame[0]; + const uint8_t *payload = (len > 1) ? &frame[1] : NULL; + size_t plen = (len > 1) ? len - 1 : 0; + + switch (cmd) { + case RNODE_CMD_DATA: + handle_data(payload, plen); + break; + case RNODE_CMD_FREQUENCY: + handle_frequency(payload, plen); + break; + case RNODE_CMD_BANDWIDTH: + handle_bandwidth(payload, plen); + break; + case RNODE_CMD_TXPOWER: + handle_txpower(payload, plen); + break; + case RNODE_CMD_SF: + handle_sf(payload, plen); + break; + case RNODE_CMD_CR: + handle_cr(payload, plen); + break; + case RNODE_CMD_RADIO_STATE: + handle_radio_state(payload, plen); + break; + case RNODE_CMD_DETECT: + handle_detect(payload, plen); + break; + case RNODE_CMD_LEAVE: + handle_leave(payload, plen); + break; + case RNODE_CMD_ST_ALOCK: + handle_st_alock(payload, plen); + break; + case RNODE_CMD_LT_ALOCK: + handle_lt_alock(payload, plen); + break; + case RNODE_CMD_STAT_CHTM: + handle_stat_chtm(payload, plen); + break; + case RNODE_CMD_STAT_PHYPRM: + handle_stat_phyprm(payload, plen); + break; + case RNODE_CMD_STAT_BAT: + handle_stat_bat(payload, plen); + break; + case RNODE_CMD_STAT_CSMA: + handle_stat_csma(payload, plen); + break; + case RNODE_CMD_STAT_TEMP: + handle_stat_temp(payload, plen); + break; + case RNODE_CMD_BLINK: + handle_blink(payload, plen); + break; + case RNODE_CMD_RANDOM: + handle_random(payload, plen); + break; + case RNODE_CMD_FW_VERSION: + handle_fw_version(payload, plen); + break; + case RNODE_CMD_PLATFORM: + handle_platform(payload, plen); + break; + case RNODE_CMD_MCU: + handle_mcu(payload, plen); + break; + case RNODE_CMD_RESET: + handle_reset(payload, plen); + break; + case RNODE_CMD_RADIO_LOCK: + break; + default: + ESP_LOGW(TAG, "Unhandled CMD 0x%02X (%u bytes)", cmd, (unsigned)plen); + break; + } +} + +static uint32_t read_be32(const uint8_t *p) { + return ((uint32_t)p[0] << 24) | ((uint32_t)p[1] << 16) | ((uint32_t)p[2] << 8) | (uint32_t)p[3]; +} + +static uint16_t read_be16(const uint8_t *p) { + return ((uint16_t)p[0] << 8) | (uint16_t)p[1]; +} + +static void write_be32(uint8_t *out, uint32_t v) { + out[0] = (uint8_t)((v >> 24) & 0xFF); + out[1] = (uint8_t)((v >> 16) & 0xFF); + out[2] = (uint8_t)((v >> 8) & 0xFF); + out[3] = (uint8_t)(v & 0xFF); +} + +static void handle_detect(const uint8_t *payload, size_t len) { + if (len < 1 || payload[0] != RNODE_DETECT_PROBE) { + rnode_send_error(RNODE_ERROR_INITRADIO); + return; + } + uint8_t resp = RNODE_CMD_DETECT_RESP; + rnode_send_frame(RNODE_CMD_DETECT, &resp, 1); +} + +static void handle_fw_version(const uint8_t *payload, size_t len) { + (void)payload; + (void)len; + uint8_t out[2] = {RNODE_FW_VERSION_MAJOR, RNODE_FW_VERSION_MINOR}; + rnode_send_frame(RNODE_CMD_FW_VERSION, out, sizeof(out)); +} + +static void handle_platform(const uint8_t *payload, size_t len) { + (void)payload; + (void)len; + uint8_t out = RNODE_PLATFORM_ESP32; + rnode_send_frame(RNODE_CMD_PLATFORM, &out, 1); +} + +static void handle_mcu(const uint8_t *payload, size_t len) { + (void)payload; + (void)len; + uint8_t out = RNODE_MCU_ESP32; + rnode_send_frame(RNODE_CMD_MCU, &out, 1); +} + +static void handle_frequency(const uint8_t *payload, size_t len) { + if (len < 4) { + rnode_send_error(RNODE_ERROR_INITRADIO); + return; + } + uint32_t freq = read_be32(payload); + rnode_cfg_mut()->freq_hz = freq; + rnode_nvs_save_cfg(); + rnode_apply_radio_cfg(); + + uint8_t out[4]; + write_be32(out, rnode_cfg_mut()->freq_hz); + rnode_send_frame(RNODE_CMD_FREQUENCY, out, sizeof(out)); +} + +static void handle_bandwidth(const uint8_t *payload, size_t len) { + if (len < 4) { + rnode_send_error(RNODE_ERROR_INITRADIO); + return; + } + uint32_t bw = read_be32(payload); + rnode_cfg_mut()->bw_hz = bw; + rnode_nvs_save_cfg(); + rnode_apply_radio_cfg(); + + uint8_t out[4]; + write_be32(out, rnode_cfg_mut()->bw_hz); + rnode_send_frame(RNODE_CMD_BANDWIDTH, out, sizeof(out)); +} + +static void handle_txpower(const uint8_t *payload, size_t len) { + if (len < 1) { + rnode_send_error(RNODE_ERROR_INITRADIO); + return; + } + int8_t power = (int8_t)payload[0]; + rnode_cfg_mut()->tx_power_dbm = power; + rnode_nvs_save_cfg(); + rnode_apply_radio_cfg(); + + uint8_t out = (uint8_t)rnode_cfg_mut()->tx_power_dbm; + rnode_send_frame(RNODE_CMD_TXPOWER, &out, 1); +} + +static void handle_sf(const uint8_t *payload, size_t len) { + if (len < 1) { + rnode_send_error(RNODE_ERROR_INITRADIO); + return; + } + uint8_t sf = payload[0]; + if (sf < 5 || sf > 12) { + rnode_send_error(RNODE_ERROR_INITRADIO); + return; + } + rnode_cfg_mut()->sf = sf; + rnode_nvs_save_cfg(); + rnode_apply_radio_cfg(); + + uint8_t out = rnode_cfg_mut()->sf; + rnode_send_frame(RNODE_CMD_SF, &out, 1); +} + +static void handle_cr(const uint8_t *payload, size_t len) { + if (len < 1) { + rnode_send_error(RNODE_ERROR_INITRADIO); + return; + } + uint8_t cr = payload[0]; + if (cr < 5 || cr > 8) { + rnode_send_error(RNODE_ERROR_INITRADIO); + return; + } + rnode_cfg_mut()->cr = cr; + rnode_nvs_save_cfg(); + rnode_apply_radio_cfg(); + + uint8_t out = rnode_cfg_mut()->cr; + rnode_send_frame(RNODE_CMD_CR, &out, 1); +} + +static void handle_radio_state(const uint8_t *payload, size_t len) { + rnode_radio_cfg_t *cfg = rnode_cfg_mut(); + if (len >= 1 && payload[0] != 0xFF) { + bool is_on = (payload[0] != 0); + if (rnode_set_radio_state(is_on) != ESP_OK) { + rnode_send_error(RNODE_ERROR_INITRADIO); + return; + } + cfg->is_radio_on = is_on; + } + uint8_t out = cfg->is_radio_on ? 0x01 : 0x00; + rnode_send_frame(RNODE_CMD_RADIO_STATE, &out, 1); +} + +static void handle_data(const uint8_t *payload, size_t len) { + if (len == 0) { + return; + } + if (rnode_airtime_is_blocked()) { + rnode_send_error(RNODE_ERROR_QUEUE_FULL); + return; + } + esp_err_t ret = rnode_radio_transmit(payload, len); + if (ret != ESP_OK) { + ESP_LOGW(TAG, "TX failed: %s", esp_err_to_name(ret)); + rnode_send_error(RNODE_ERROR_TXFAILED); + return; + } + rnode_stats_mut()->tx_count++; +} + +static void handle_st_alock(const uint8_t *payload, size_t len) { + if (len < 2) { + rnode_send_error(RNODE_ERROR_INITRADIO); + return; + } + uint16_t st = read_be16(payload); + rnode_airtime_set_limits(st, rnode_airtime_long()); + rnode_send_frame(RNODE_CMD_ST_ALOCK, payload, 2); +} + +static void handle_lt_alock(const uint8_t *payload, size_t len) { + if (len < 2) { + rnode_send_error(RNODE_ERROR_INITRADIO); + return; + } + uint16_t lt = read_be16(payload); + rnode_airtime_set_limits(rnode_airtime_short(), lt); + rnode_send_frame(RNODE_CMD_LT_ALOCK, payload, 2); +} + +static void handle_blink(const uint8_t *payload, size_t len) { + (void)payload; + (void)len; + ESP_LOGI(TAG, "BLINK"); +} + +static void handle_random(const uint8_t *payload, size_t len) { + (void)payload; + (void)len; + uint8_t r = (uint8_t)(esp_random() & 0xFF); + rnode_send_frame(RNODE_CMD_RANDOM, &r, 1); +} + +static void handle_reset(const uint8_t *payload, size_t len) { + if (len < 1 || payload[0] != RNODE_RESET_MAGIC) { + return; + } + ESP_LOGW(TAG, "Host requested reset"); + esp_restart(); +} + +static void handle_leave(const uint8_t *payload, size_t len) { + (void)payload; + (void)len; + ESP_LOGI(TAG, "Host went offline"); +} + +static void handle_stat_chtm(const uint8_t *payload, size_t len) { + (void)payload; + (void)len; + uint8_t out[11] = {0}; + uint16_t st = rnode_airtime_short(); + uint16_t lt = rnode_airtime_long(); + out[0] = (uint8_t)((st >> 8) & 0xFF); + out[1] = (uint8_t)(st & 0xFF); + out[2] = (uint8_t)((lt >> 8) & 0xFF); + out[3] = (uint8_t)(lt & 0xFF); + rnode_send_frame(RNODE_CMD_STAT_CHTM, out, sizeof(out)); +} + +static void handle_stat_phyprm(const uint8_t *payload, size_t len) { + (void)payload; + (void)len; + const rnode_radio_cfg_t *cfg = rnode_get_radio_cfg(); + uint32_t symbol_time_us = 0; + if (cfg->bw_hz > 0) { + symbol_time_us = ((uint32_t)1U << cfg->sf) * 1000000U / cfg->bw_hz; + } + uint8_t out[12] = {0}; + out[0] = cfg->sf; + out[1] = cfg->cr; + write_be32(&out[2], cfg->bw_hz); + write_be32(&out[6], symbol_time_us); + out[10] = 8; + out[11] = 0; + rnode_send_frame(RNODE_CMD_STAT_PHYPRM, out, sizeof(out)); +} + +static void handle_stat_bat(const uint8_t *payload, size_t len) { + (void)payload; + (void)len; + uint8_t out[2]; + out[0] = 0x01; + out[1] = rnode_get_stats()->battery_pct; + rnode_send_frame(RNODE_CMD_STAT_BAT, out, sizeof(out)); +} + +static void handle_stat_temp(const uint8_t *payload, size_t len) { + (void)payload; + (void)len; + int8_t temp_c = rnode_get_stats()->cpu_temp_c; + uint8_t out = (uint8_t)(temp_c + RNODE_TEMP_OFFSET); + rnode_send_frame(RNODE_CMD_STAT_TEMP, &out, 1); +} + +static void handle_stat_csma(const uint8_t *payload, size_t len) { + (void)payload; + (void)len; + uint8_t out[3] = {0, 0, 0}; + rnode_send_frame(RNODE_CMD_STAT_CSMA, out, sizeof(out)); +} diff --git a/firmware_p4/components/Applications/LoRa/rnode/rnode_internal.h b/firmware_p4/components/Applications/LoRa/rnode/rnode_internal.h new file mode 100644 index 00000000..7fc9ca0b --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/rnode/rnode_internal.h @@ -0,0 +1,158 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#ifndef RNODE_INTERNAL_H +#define RNODE_INTERNAL_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include + +#include "rnode.h" + +#define RNODE_CMD_DATA 0x00 +#define RNODE_CMD_FREQUENCY 0x01 +#define RNODE_CMD_BANDWIDTH 0x02 +#define RNODE_CMD_TXPOWER 0x03 +#define RNODE_CMD_SF 0x04 +#define RNODE_CMD_CR 0x05 +#define RNODE_CMD_RADIO_STATE 0x06 +#define RNODE_CMD_RADIO_LOCK 0x07 +#define RNODE_CMD_DETECT 0x08 +#define RNODE_CMD_READY 0x0F +#define RNODE_CMD_LEAVE 0x0A +#define RNODE_CMD_ST_ALOCK 0x0B +#define RNODE_CMD_LT_ALOCK 0x0C +#define RNODE_CMD_STAT_RX 0x21 +#define RNODE_CMD_STAT_TX 0x22 +#define RNODE_CMD_STAT_RSSI 0x23 +#define RNODE_CMD_STAT_SNR 0x24 +#define RNODE_CMD_STAT_CHTM 0x25 +#define RNODE_CMD_STAT_PHYPRM 0x26 +#define RNODE_CMD_STAT_BAT 0x27 +#define RNODE_CMD_STAT_CSMA 0x28 +#define RNODE_CMD_STAT_TEMP 0x29 +#define RNODE_CMD_BLINK 0x30 +#define RNODE_CMD_RANDOM 0x40 +#define RNODE_CMD_DETECT_RESP 0x46 +#define RNODE_CMD_PLATFORM 0x48 +#define RNODE_CMD_MCU 0x49 +#define RNODE_CMD_FW_VERSION 0x50 +#define RNODE_CMD_RESET 0x55 +#define RNODE_CMD_ERROR 0x90 + +#define RNODE_DETECT_PROBE 0x73 +#define RNODE_RESET_MAGIC 0xF8 +#define RNODE_LEAVE_MAGIC 0xFF + +#define RNODE_ERROR_INITRADIO 0x01 +#define RNODE_ERROR_TXFAILED 0x02 +#define RNODE_ERROR_EEPROM_LOCKED 0x03 +#define RNODE_ERROR_QUEUE_FULL 0x04 +#define RNODE_ERROR_MEMORY_LOW 0x05 +#define RNODE_ERROR_MODEM_TIMEOUT 0x06 + +#define RNODE_RSSI_OFFSET 157 +#define RNODE_TEMP_OFFSET 120 + +#define RNODE_AIRTIME_WINDOW_MS 3600000UL + +/** + * @brief Encode a KISS frame and send it over the serial port. + */ +void rnode_send_frame(uint8_t cmd_id, const uint8_t *payload, size_t len); + +/** + * @brief Send an error frame (CMD_ERROR + 1B code). + */ +void rnode_send_error(uint8_t code); + +/** + * @brief Central command dispatcher. Processes a decoded KISS frame. + */ +void rnode_dispatch(const uint8_t *frame, size_t len); + +/** + * @brief Push the current radio config to the SX1262 (freq/bw/sf/cr/power). + */ +esp_err_t rnode_apply_radio_cfg(void); + +/** + * @brief Toggle continuous RX on the SX1262. + */ +esp_err_t rnode_set_radio_state(bool is_on); + +/** + * @brief Transmit payload via SX1262 with CSMA/CAD listen-before-talk. + */ +esp_err_t rnode_radio_transmit(const uint8_t *data, size_t len); + +/** + * @brief Mutable accessors for internal config and stats. + */ +rnode_radio_cfg_t *rnode_cfg_mut(void); +rnode_stats_t *rnode_stats_mut(void); + +/** + * @brief Persist the current radio config in NVS. + */ +void rnode_nvs_save_cfg(void); + +/** + * @brief Load radio config from NVS, falling back to defaults. + */ +void rnode_nvs_load_cfg(void); + +/** + * @brief Record a TX event in the airtime tracker. + */ +void rnode_airtime_record_tx(uint32_t airtime_ms); + +/** + * @brief Accumulated airtime in the short window (1 min) as hundredths of %. + */ +uint16_t rnode_airtime_short(void); + +/** + * @brief Accumulated airtime in the long window (1 hour) as hundredths of %. + */ +uint16_t rnode_airtime_long(void); + +/** + * @brief Regulatory setpoints (host sends via CMD_ST_ALOCK / CMD_LT_ALOCK). + * Values in hundredths of % (0..10000). + */ +void rnode_airtime_set_limits(uint16_t st_limit_cpct, uint16_t lt_limit_cpct); + +/** + * @brief Returns true if TX is currently blocked by airtime enforcement. + */ +bool rnode_airtime_is_blocked(void); + +/** + * @brief Estimate LoRa packet airtime in milliseconds. + * Semtech AN1200.13 formula. + */ +uint32_t rnode_airtime_estimate_ms(size_t payload_bytes, uint32_t bw_hz, uint8_t sf, uint8_t cr); + +#ifdef __cplusplus +} +#endif + +#endif // RNODE_INTERNAL_H diff --git a/firmware_p4/components/Applications/LoRa/rnode/rnode_kiss.c b/firmware_p4/components/Applications/LoRa/rnode/rnode_kiss.c new file mode 100644 index 00000000..16356ade --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/rnode/rnode_kiss.c @@ -0,0 +1,154 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#include "rnode_kiss.h" + +#include + +static size_t append_escaped(uint8_t *out, size_t pos, size_t cap, uint8_t b); + +void rnode_kiss_decoder_reset(rnode_kiss_decoder_t *d) { + if (d == NULL) { + return; + } + d->len = 0; + d->is_in_frame = false; + d->is_escaped = false; + d->has_frame_ready = false; +} + +bool rnode_kiss_decoder_feed(rnode_kiss_decoder_t *d, uint8_t byte) { + if (d == NULL) { + return false; + } + + if (byte == KISS_FEND) { + if (d->is_in_frame && d->len > 0) { + d->has_frame_ready = true; + d->is_in_frame = false; + return true; + } + d->is_in_frame = true; + d->is_escaped = false; + d->len = 0; + return false; + } + + if (!d->is_in_frame) { + return false; + } + + if (d->is_escaped) { + d->is_escaped = false; + uint8_t out = byte; + if (byte == KISS_TFEND) { + out = KISS_FEND; + } else if (byte == KISS_TFESC) { + out = KISS_FESC; + } + if (d->len < RNODE_KISS_FRAME_MAX) { + d->buf[d->len++] = out; + } else { + d->is_in_frame = false; + d->len = 0; + } + return false; + } + + if (byte == KISS_FESC) { + d->is_escaped = true; + return false; + } + + if (d->len < RNODE_KISS_FRAME_MAX) { + d->buf[d->len++] = byte; + } else { + d->is_in_frame = false; + d->len = 0; + } + return false; +} + +bool rnode_kiss_decoder_take_frame(rnode_kiss_decoder_t *d, + uint8_t *out_buf, + size_t cap, + size_t *out_len) { + if (d == NULL || !d->has_frame_ready) { + return false; + } + size_t n = d->len; + if (n > cap) { + n = cap; + } + if (out_buf != NULL) { + memcpy(out_buf, d->buf, n); + } + if (out_len != NULL) { + *out_len = n; + } + d->has_frame_ready = false; + d->len = 0; + return true; +} + +size_t rnode_kiss_encode( + uint8_t cmd_id, const uint8_t *payload, size_t payload_len, uint8_t *out_buf, size_t cap) { + if (out_buf == NULL || cap < 3) { + return 0; + } + size_t pos = 0; + out_buf[pos++] = KISS_FEND; + size_t after = append_escaped(out_buf, pos, cap, cmd_id); + if (after == 0) { + return 0; + } + pos = after; + for (size_t i = 0; i < payload_len; i++) { + after = append_escaped(out_buf, pos, cap, payload[i]); + if (after == 0) { + return 0; + } + pos = after; + } + if (pos + 1 > cap) { + return 0; + } + out_buf[pos++] = KISS_FEND; + return pos; +} + +static size_t append_escaped(uint8_t *out, size_t pos, size_t cap, uint8_t b) { + if (b == KISS_FEND) { + if (pos + 2 > cap) { + return 0; + } + out[pos++] = KISS_FESC; + out[pos++] = KISS_TFEND; + return pos; + } + if (b == KISS_FESC) { + if (pos + 2 > cap) { + return 0; + } + out[pos++] = KISS_FESC; + out[pos++] = KISS_TFESC; + return pos; + } + if (pos + 1 > cap) { + return 0; + } + out[pos++] = b; + return pos; +} diff --git a/firmware_p4/components/Applications/LoRa/rnode/rnode_nvs.c b/firmware_p4/components/Applications/LoRa/rnode/rnode_nvs.c new file mode 100644 index 00000000..4c563393 --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/rnode/rnode_nvs.c @@ -0,0 +1,90 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#include "rnode_internal.h" + +#include "esp_log.h" +#include "nvs.h" +#include "nvs_flash.h" + +static const char *TAG = "RNODE_NVS"; + +#define RNODE_NVS_NAMESPACE "rnode" +#define RNODE_NVS_KEY_CFG "radio_cfg" + +#define RNODE_FREQ_MIN_HZ 137000000UL +#define RNODE_FREQ_MAX_HZ 3000000000UL +#define RNODE_BW_MIN_HZ 7800UL +#define RNODE_BW_MAX_HZ 1625000UL +#define RNODE_SF_MIN 5 +#define RNODE_SF_MAX 12 +#define RNODE_CR_MIN 5 +#define RNODE_CR_MAX 8 +#define RNODE_TX_POWER_MIN_DBM (-9) +#define RNODE_TX_POWER_MAX_DBM 22 + +void rnode_nvs_save_cfg(void) { + nvs_handle_t h; + esp_err_t err = nvs_open(RNODE_NVS_NAMESPACE, NVS_READWRITE, &h); + if (err != ESP_OK) { + ESP_LOGW(TAG, "nvs_open failed: %s", esp_err_to_name(err)); + return; + } + nvs_set_blob(h, RNODE_NVS_KEY_CFG, rnode_cfg_mut(), sizeof(rnode_radio_cfg_t)); + nvs_commit(h); + nvs_close(h); +} + +void rnode_nvs_load_cfg(void) { + rnode_radio_cfg_t *cfg = rnode_cfg_mut(); + cfg->freq_hz = RNODE_DEFAULT_FREQ_HZ; + cfg->bw_hz = RNODE_DEFAULT_BW_HZ; + cfg->sf = RNODE_DEFAULT_SF; + cfg->cr = RNODE_DEFAULT_CR; + cfg->tx_power_dbm = RNODE_DEFAULT_TX_POWER_DBM; + cfg->is_radio_on = false; + + nvs_handle_t h; + esp_err_t err = nvs_open(RNODE_NVS_NAMESPACE, NVS_READONLY, &h); + if (err != ESP_OK) { + return; + } + + rnode_radio_cfg_t persisted = {0}; + size_t sz = sizeof(persisted); + err = nvs_get_blob(h, RNODE_NVS_KEY_CFG, &persisted, &sz); + nvs_close(h); + + if (err != ESP_OK || sz != sizeof(persisted)) { + return; + } + if (persisted.freq_hz >= RNODE_FREQ_MIN_HZ && persisted.freq_hz <= RNODE_FREQ_MAX_HZ) { + cfg->freq_hz = persisted.freq_hz; + } + if (persisted.bw_hz >= RNODE_BW_MIN_HZ && persisted.bw_hz <= RNODE_BW_MAX_HZ) { + cfg->bw_hz = persisted.bw_hz; + } + if (persisted.sf >= RNODE_SF_MIN && persisted.sf <= RNODE_SF_MAX) { + cfg->sf = persisted.sf; + } + if (persisted.cr >= RNODE_CR_MIN && persisted.cr <= RNODE_CR_MAX) { + cfg->cr = persisted.cr; + } + if (persisted.tx_power_dbm >= RNODE_TX_POWER_MIN_DBM && + persisted.tx_power_dbm <= RNODE_TX_POWER_MAX_DBM) { + cfg->tx_power_dbm = persisted.tx_power_dbm; + } + ESP_LOGI(TAG, "Loaded radio cfg from NVS"); +} diff --git a/firmware_p4/components/Applications/LoRa/rnode/rnode_serial.c b/firmware_p4/components/Applications/LoRa/rnode/rnode_serial.c new file mode 100644 index 00000000..db0ccbad --- /dev/null +++ b/firmware_p4/components/Applications/LoRa/rnode/rnode_serial.c @@ -0,0 +1,89 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#include "rnode_serial.h" + +#include "driver/uart.h" +#include "esp_log.h" + +static const char *TAG = "RNODE_SERIAL"; + +#define RNODE_UART_PORT UART_NUM_0 +#define RNODE_UART_TX_PIN 43 +#define RNODE_UART_RX_PIN 44 +#define RNODE_UART_BAUD 115200 +#define RNODE_UART_RX_BUF 2048 +#define RNODE_UART_TX_BUF 2048 + +esp_err_t rnode_serial_init(void) { + uart_config_t cfg = { + .baud_rate = RNODE_UART_BAUD, + .data_bits = UART_DATA_8_BITS, + .parity = UART_PARITY_DISABLE, + .stop_bits = UART_STOP_BITS_1, + .flow_ctrl = UART_HW_FLOWCTRL_DISABLE, + .source_clk = UART_SCLK_DEFAULT, + }; + + esp_err_t ret = + uart_driver_install(RNODE_UART_PORT, RNODE_UART_RX_BUF, RNODE_UART_TX_BUF, 0, NULL, 0); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "uart_driver_install failed: %s", esp_err_to_name(ret)); + return ret; + } + + ret = uart_param_config(RNODE_UART_PORT, &cfg); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "uart_param_config failed: %s", esp_err_to_name(ret)); + return ret; + } + + ret = uart_set_pin(RNODE_UART_PORT, + RNODE_UART_TX_PIN, + RNODE_UART_RX_PIN, + UART_PIN_NO_CHANGE, + UART_PIN_NO_CHANGE); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "uart_set_pin failed: %s", esp_err_to_name(ret)); + return ret; + } + + ESP_LOGI(TAG, + "UART%d @ %d baud (TX=GPIO%d RX=GPIO%d)", + RNODE_UART_PORT, + RNODE_UART_BAUD, + RNODE_UART_TX_PIN, + RNODE_UART_RX_PIN); + return ESP_OK; +} + +int rnode_serial_write(const uint8_t *data, size_t len) { + if (data == NULL || len == 0) { + return 0; + } + int n = uart_write_bytes(RNODE_UART_PORT, (const char *)data, len); + return n; +} + +int rnode_serial_read(uint8_t *out, size_t cap) { + if (out == NULL || cap == 0) { + return 0; + } + int n = uart_read_bytes(RNODE_UART_PORT, out, cap, 0); + if (n < 0) { + return 0; + } + return n; +} diff --git a/firmware_p4/components/Applications/SubGhz/include/subghz_analyzer.h b/firmware_p4/components/Applications/SubGhz/include/subghz_analyzer.h index a35f3ea0..3a5698c4 100644 --- a/firmware_p4/components/Applications/SubGhz/include/subghz_analyzer.h +++ b/firmware_p4/components/Applications/SubGhz/include/subghz_analyzer.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef SUBGHZ_ANALYZER_H #define SUBGHZ_ANALYZER_H diff --git a/firmware_p4/components/Applications/SubGhz/include/subghz_protocol_serializer.h b/firmware_p4/components/Applications/SubGhz/include/subghz_protocol_serializer.h index 21e1c229..07693891 100644 --- a/firmware_p4/components/Applications/SubGhz/include/subghz_protocol_serializer.h +++ b/firmware_p4/components/Applications/SubGhz/include/subghz_protocol_serializer.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef SUBGHZ_PROTOCOL_SERIALIZER_H #define SUBGHZ_PROTOCOL_SERIALIZER_H diff --git a/firmware_p4/components/Applications/SubGhz/include/subghz_receiver.h b/firmware_p4/components/Applications/SubGhz/include/subghz_receiver.h index 1e435aa1..8f0da732 100644 --- a/firmware_p4/components/Applications/SubGhz/include/subghz_receiver.h +++ b/firmware_p4/components/Applications/SubGhz/include/subghz_receiver.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef SUBGHZ_RECEIVER_H #define SUBGHZ_RECEIVER_H diff --git a/firmware_p4/components/Applications/SubGhz/include/subghz_spectrum.h b/firmware_p4/components/Applications/SubGhz/include/subghz_spectrum.h index 7ae20926..94baea1b 100644 --- a/firmware_p4/components/Applications/SubGhz/include/subghz_spectrum.h +++ b/firmware_p4/components/Applications/SubGhz/include/subghz_spectrum.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef SUBGHZ_SPECTRUM_H #define SUBGHZ_SPECTRUM_H diff --git a/firmware_p4/components/Applications/SubGhz/include/subghz_storage.h b/firmware_p4/components/Applications/SubGhz/include/subghz_storage.h index acbe0b11..21460af3 100644 --- a/firmware_p4/components/Applications/SubGhz/include/subghz_storage.h +++ b/firmware_p4/components/Applications/SubGhz/include/subghz_storage.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef SUBGHZ_STORAGE_H #define SUBGHZ_STORAGE_H diff --git a/firmware_p4/components/Applications/SubGhz/include/subghz_transmitter.h b/firmware_p4/components/Applications/SubGhz/include/subghz_transmitter.h index 78cd3a11..686534b9 100644 --- a/firmware_p4/components/Applications/SubGhz/include/subghz_transmitter.h +++ b/firmware_p4/components/Applications/SubGhz/include/subghz_transmitter.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef SUBGHZ_TRANSMITTER_H #define SUBGHZ_TRANSMITTER_H diff --git a/firmware_p4/components/Applications/SubGhz/include/subghz_types.h b/firmware_p4/components/Applications/SubGhz/include/subghz_types.h index 5581d9c0..620a3b17 100644 --- a/firmware_p4/components/Applications/SubGhz/include/subghz_types.h +++ b/firmware_p4/components/Applications/SubGhz/include/subghz_types.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef SUBGHZ_TYPES_H #define SUBGHZ_TYPES_H diff --git a/firmware_p4/components/Applications/SubGhz/protocols/include/subghz_protocol_decoder.h b/firmware_p4/components/Applications/SubGhz/protocols/include/subghz_protocol_decoder.h index a61bccf7..917b6463 100644 --- a/firmware_p4/components/Applications/SubGhz/protocols/include/subghz_protocol_decoder.h +++ b/firmware_p4/components/Applications/SubGhz/protocols/include/subghz_protocol_decoder.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef SUBGHZ_PROTOCOL_DECODER_H #define SUBGHZ_PROTOCOL_DECODER_H diff --git a/firmware_p4/components/Applications/SubGhz/protocols/include/subghz_protocol_registry.h b/firmware_p4/components/Applications/SubGhz/protocols/include/subghz_protocol_registry.h index a0cf4a93..b35f41b8 100644 --- a/firmware_p4/components/Applications/SubGhz/protocols/include/subghz_protocol_registry.h +++ b/firmware_p4/components/Applications/SubGhz/protocols/include/subghz_protocol_registry.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef SUBGHZ_PROTOCOL_REGISTRY_H #define SUBGHZ_PROTOCOL_REGISTRY_H diff --git a/firmware_p4/components/Applications/SubGhz/protocols/include/subghz_protocol_utils.h b/firmware_p4/components/Applications/SubGhz/protocols/include/subghz_protocol_utils.h index ed00a2be..7ced43db 100644 --- a/firmware_p4/components/Applications/SubGhz/protocols/include/subghz_protocol_utils.h +++ b/firmware_p4/components/Applications/SubGhz/protocols/include/subghz_protocol_utils.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef SUBGHZ_PROTOCOL_UTILS_H #define SUBGHZ_PROTOCOL_UTILS_H diff --git a/firmware_p4/components/Applications/SubGhz/protocols/protocol_ansonic.c b/firmware_p4/components/Applications/SubGhz/protocols/protocol_ansonic.c index 29c744a4..62651216 100644 --- a/firmware_p4/components/Applications/SubGhz/protocols/protocol_ansonic.c +++ b/firmware_p4/components/Applications/SubGhz/protocols/protocol_ansonic.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "subghz_protocol_decoder.h" diff --git a/firmware_p4/components/Applications/SubGhz/protocols/protocol_came.c b/firmware_p4/components/Applications/SubGhz/protocols/protocol_came.c index e907fab9..d39d151c 100644 --- a/firmware_p4/components/Applications/SubGhz/protocols/protocol_came.c +++ b/firmware_p4/components/Applications/SubGhz/protocols/protocol_came.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "subghz_protocol_decoder.h" diff --git a/firmware_p4/components/Applications/SubGhz/protocols/protocol_chamberlain.c b/firmware_p4/components/Applications/SubGhz/protocols/protocol_chamberlain.c index 8e33db9b..2a1ca58d 100644 --- a/firmware_p4/components/Applications/SubGhz/protocols/protocol_chamberlain.c +++ b/firmware_p4/components/Applications/SubGhz/protocols/protocol_chamberlain.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "subghz_protocol_decoder.h" diff --git a/firmware_p4/components/Applications/SubGhz/protocols/protocol_holtek.c b/firmware_p4/components/Applications/SubGhz/protocols/protocol_holtek.c index d7f504d6..a5d5d132 100644 --- a/firmware_p4/components/Applications/SubGhz/protocols/protocol_holtek.c +++ b/firmware_p4/components/Applications/SubGhz/protocols/protocol_holtek.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "subghz_protocol_decoder.h" diff --git a/firmware_p4/components/Applications/SubGhz/protocols/protocol_liftmaster.c b/firmware_p4/components/Applications/SubGhz/protocols/protocol_liftmaster.c index ab142bb7..e7d74fad 100644 --- a/firmware_p4/components/Applications/SubGhz/protocols/protocol_liftmaster.c +++ b/firmware_p4/components/Applications/SubGhz/protocols/protocol_liftmaster.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "subghz_protocol_decoder.h" diff --git a/firmware_p4/components/Applications/SubGhz/protocols/protocol_linear.c b/firmware_p4/components/Applications/SubGhz/protocols/protocol_linear.c index 253a6802..cd8d3546 100644 --- a/firmware_p4/components/Applications/SubGhz/protocols/protocol_linear.c +++ b/firmware_p4/components/Applications/SubGhz/protocols/protocol_linear.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "subghz_protocol_decoder.h" diff --git a/firmware_p4/components/Applications/SubGhz/protocols/protocol_nice_flo.c b/firmware_p4/components/Applications/SubGhz/protocols/protocol_nice_flo.c index 59832043..8c5916fe 100644 --- a/firmware_p4/components/Applications/SubGhz/protocols/protocol_nice_flo.c +++ b/firmware_p4/components/Applications/SubGhz/protocols/protocol_nice_flo.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "subghz_protocol_decoder.h" diff --git a/firmware_p4/components/Applications/SubGhz/protocols/protocol_princeton.c b/firmware_p4/components/Applications/SubGhz/protocols/protocol_princeton.c index 51515a5e..af6f4b91 100644 --- a/firmware_p4/components/Applications/SubGhz/protocols/protocol_princeton.c +++ b/firmware_p4/components/Applications/SubGhz/protocols/protocol_princeton.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "subghz_protocol_decoder.h" diff --git a/firmware_p4/components/Applications/SubGhz/protocols/protocol_rcswitch.c b/firmware_p4/components/Applications/SubGhz/protocols/protocol_rcswitch.c index 8754ac6d..d43f63b5 100644 --- a/firmware_p4/components/Applications/SubGhz/protocols/protocol_rcswitch.c +++ b/firmware_p4/components/Applications/SubGhz/protocols/protocol_rcswitch.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "subghz_protocol_decoder.h" diff --git a/firmware_p4/components/Applications/SubGhz/protocols/protocol_rossi.c b/firmware_p4/components/Applications/SubGhz/protocols/protocol_rossi.c index 3fbac2cd..ba68de0d 100644 --- a/firmware_p4/components/Applications/SubGhz/protocols/protocol_rossi.c +++ b/firmware_p4/components/Applications/SubGhz/protocols/protocol_rossi.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "subghz_protocol_decoder.h" diff --git a/firmware_p4/components/Applications/SubGhz/protocols/subghz_protocol_registry.c b/firmware_p4/components/Applications/SubGhz/protocols/subghz_protocol_registry.c index 0259cd98..50e04c17 100644 --- a/firmware_p4/components/Applications/SubGhz/protocols/subghz_protocol_registry.c +++ b/firmware_p4/components/Applications/SubGhz/protocols/subghz_protocol_registry.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "subghz_protocol_registry.h" diff --git a/firmware_p4/components/Applications/SubGhz/subghz_analyzer.c b/firmware_p4/components/Applications/SubGhz/subghz_analyzer.c index 23a92ca6..a1ea5a61 100644 --- a/firmware_p4/components/Applications/SubGhz/subghz_analyzer.c +++ b/firmware_p4/components/Applications/SubGhz/subghz_analyzer.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "subghz_analyzer.h" diff --git a/firmware_p4/components/Applications/SubGhz/subghz_protocol_serializer.c b/firmware_p4/components/Applications/SubGhz/subghz_protocol_serializer.c index ea74b7e0..9469902a 100644 --- a/firmware_p4/components/Applications/SubGhz/subghz_protocol_serializer.c +++ b/firmware_p4/components/Applications/SubGhz/subghz_protocol_serializer.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "subghz_protocol_serializer.h" diff --git a/firmware_p4/components/Applications/SubGhz/subghz_receiver.c b/firmware_p4/components/Applications/SubGhz/subghz_receiver.c index bc269575..2c1ecf99 100644 --- a/firmware_p4/components/Applications/SubGhz/subghz_receiver.c +++ b/firmware_p4/components/Applications/SubGhz/subghz_receiver.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "subghz_receiver.h" diff --git a/firmware_p4/components/Applications/SubGhz/subghz_spectrum.c b/firmware_p4/components/Applications/SubGhz/subghz_spectrum.c index fadb4807..25c1c4f5 100644 --- a/firmware_p4/components/Applications/SubGhz/subghz_spectrum.c +++ b/firmware_p4/components/Applications/SubGhz/subghz_spectrum.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "subghz_spectrum.h" diff --git a/firmware_p4/components/Applications/SubGhz/subghz_storage.c b/firmware_p4/components/Applications/SubGhz/subghz_storage.c index 3ebc072c..ac6652d8 100644 --- a/firmware_p4/components/Applications/SubGhz/subghz_storage.c +++ b/firmware_p4/components/Applications/SubGhz/subghz_storage.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "subghz_storage.h" diff --git a/firmware_p4/components/Applications/SubGhz/subghz_transmitter.c b/firmware_p4/components/Applications/SubGhz/subghz_transmitter.c index f8e50ed7..5fb53ccd 100644 --- a/firmware_p4/components/Applications/SubGhz/subghz_transmitter.c +++ b/firmware_p4/components/Applications/SubGhz/subghz_transmitter.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "subghz_transmitter.h" diff --git a/firmware_p4/components/Applications/bad_usb/bad_usb.c b/firmware_p4/components/Applications/bad_usb/bad_usb.c index 512ec52c..8daa56cb 100644 --- a/firmware_p4/components/Applications/bad_usb/bad_usb.c +++ b/firmware_p4/components/Applications/bad_usb/bad_usb.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "bad_usb.h" diff --git a/firmware_p4/components/Applications/bad_usb/ducky_parser.c b/firmware_p4/components/Applications/bad_usb/ducky_parser.c index 0e4b77d3..a3c7c93f 100644 --- a/firmware_p4/components/Applications/bad_usb/ducky_parser.c +++ b/firmware_p4/components/Applications/bad_usb/ducky_parser.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "ducky_parser.h" diff --git a/firmware_p4/components/Applications/bad_usb/hid_hal.c b/firmware_p4/components/Applications/bad_usb/hid_hal.c index de0e2abe..d7170c05 100644 --- a/firmware_p4/components/Applications/bad_usb/hid_hal.c +++ b/firmware_p4/components/Applications/bad_usb/hid_hal.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "hid_hal.h" diff --git a/firmware_p4/components/Applications/bad_usb/hid_layouts.c b/firmware_p4/components/Applications/bad_usb/hid_layouts.c index 2751506d..01c5ff61 100644 --- a/firmware_p4/components/Applications/bad_usb/hid_layouts.c +++ b/firmware_p4/components/Applications/bad_usb/hid_layouts.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "hid_layouts.h" diff --git a/firmware_p4/components/Applications/bad_usb/include/bad_usb.h b/firmware_p4/components/Applications/bad_usb/include/bad_usb.h index 6d45e1fa..fdcb2c18 100644 --- a/firmware_p4/components/Applications/bad_usb/include/bad_usb.h +++ b/firmware_p4/components/Applications/bad_usb/include/bad_usb.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef BAD_USB_H #define BAD_USB_H diff --git a/firmware_p4/components/Applications/bad_usb/include/ducky_parser.h b/firmware_p4/components/Applications/bad_usb/include/ducky_parser.h index a15d4fd1..82ead1d7 100644 --- a/firmware_p4/components/Applications/bad_usb/include/ducky_parser.h +++ b/firmware_p4/components/Applications/bad_usb/include/ducky_parser.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef DUCKY_PARSER_H #define DUCKY_PARSER_H diff --git a/firmware_p4/components/Applications/bad_usb/include/hid_hal.h b/firmware_p4/components/Applications/bad_usb/include/hid_hal.h index 022f3e07..2598af05 100644 --- a/firmware_p4/components/Applications/bad_usb/include/hid_hal.h +++ b/firmware_p4/components/Applications/bad_usb/include/hid_hal.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef HID_HAL_H #define HID_HAL_H diff --git a/firmware_p4/components/Applications/bad_usb/include/hid_layouts.h b/firmware_p4/components/Applications/bad_usb/include/hid_layouts.h index 14026c32..8b32b30b 100644 --- a/firmware_p4/components/Applications/bad_usb/include/hid_layouts.h +++ b/firmware_p4/components/Applications/bad_usb/include/hid_layouts.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef HID_LAYOUTS_H #define HID_LAYOUTS_H diff --git a/firmware_p4/components/Applications/bluetooth/android_spam.c b/firmware_p4/components/Applications/bluetooth/android_spam.c index ae6b8b96..d2223e32 100644 --- a/firmware_p4/components/Applications/bluetooth/android_spam.c +++ b/firmware_p4/components/Applications/bluetooth/android_spam.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "android_spam.h" diff --git a/firmware_p4/components/Applications/bluetooth/apple_juice_spam.c b/firmware_p4/components/Applications/bluetooth/apple_juice_spam.c index 07135c57..9b073e6d 100644 --- a/firmware_p4/components/Applications/bluetooth/apple_juice_spam.c +++ b/firmware_p4/components/Applications/bluetooth/apple_juice_spam.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "apple_juice_spam.h" diff --git a/firmware_p4/components/Applications/bluetooth/ble_connect_flood.c b/firmware_p4/components/Applications/bluetooth/ble_connect_flood.c index 33ca6377..0e3eb80a 100644 --- a/firmware_p4/components/Applications/bluetooth/ble_connect_flood.c +++ b/firmware_p4/components/Applications/bluetooth/ble_connect_flood.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "ble_connect_flood.h" @@ -19,13 +20,14 @@ #include "esp_log.h" #include "spi_bridge.h" +#include "spi_session.h" static const char *TAG = "BLE_CONNECT_FLOOD"; #define FLOOD_ADDR_PAYLOAD_SIZE 7 -#define FLOOD_SPI_TIMEOUT_MS 2000 static bool s_is_running = false; +static uint32_t s_session_id = SPI_SESSION_INVALID_ID; esp_err_t ble_connect_flood_start(const uint8_t *addr, uint8_t addr_type) { if (addr == NULL) @@ -33,16 +35,20 @@ esp_err_t ble_connect_flood_start(const uint8_t *addr, uint8_t addr_type) { uint8_t payload[FLOOD_ADDR_PAYLOAD_SIZE]; memcpy(payload, addr, 6); payload[6] = addr_type; - esp_err_t err = spi_bridge_send_command( - SPI_ID_BT_APP_FLOOD, payload, sizeof(payload), NULL, NULL, FLOOD_SPI_TIMEOUT_MS); - s_is_running = (err == ESP_OK); - if (!s_is_running) + s_session_id = spi_session_start(SPI_ID_BT_APP_FLOOD, payload, sizeof(payload), NULL, NULL); + s_is_running = (s_session_id != SPI_SESSION_INVALID_ID); + if (!s_is_running) { ESP_LOGW(TAG, "BLE flood failed over SPI."); - return err; + return ESP_FAIL; + } + return ESP_OK; } esp_err_t ble_connect_flood_stop(void) { - spi_bridge_send_command(SPI_ID_BT_APP_STOP, NULL, 0, NULL, NULL, FLOOD_SPI_TIMEOUT_MS); + if (s_session_id != SPI_SESSION_INVALID_ID) { + spi_session_stop(s_session_id); + s_session_id = SPI_SESSION_INVALID_ID; + } s_is_running = false; return ESP_OK; } diff --git a/firmware_p4/components/Applications/bluetooth/ble_hid_keyboard.c b/firmware_p4/components/Applications/bluetooth/ble_hid_keyboard.c index b4c219c2..2a726319 100644 --- a/firmware_p4/components/Applications/bluetooth/ble_hid_keyboard.c +++ b/firmware_p4/components/Applications/bluetooth/ble_hid_keyboard.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "ble_hid_keyboard.h" diff --git a/firmware_p4/components/Applications/bluetooth/ble_l2cap_flood.c b/firmware_p4/components/Applications/bluetooth/ble_l2cap_flood.c index ce404bf4..25c56912 100644 --- a/firmware_p4/components/Applications/bluetooth/ble_l2cap_flood.c +++ b/firmware_p4/components/Applications/bluetooth/ble_l2cap_flood.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "ble_l2cap_flood.h" @@ -21,14 +22,14 @@ #include "bluetooth_service.h" #include "spi_bridge.h" #include "spi_protocol.h" +#include "spi_session.h" static const char *TAG = "BLE_L2CAP_FLOOD"; #define L2CAP_ADDR_PAYLOAD_SIZE 7 -#define L2CAP_SPI_START_TIMEOUT 5000 -#define L2CAP_SPI_STOP_TIMEOUT 2000 static bool s_is_running = false; +static uint32_t s_session_id = SPI_SESSION_INVALID_ID; esp_err_t ble_l2cap_flood_start(const uint8_t *addr, uint8_t addr_type) { if (s_is_running) { @@ -44,13 +45,8 @@ esp_err_t ble_l2cap_flood_start(const uint8_t *addr, uint8_t addr_type) { memcpy(payload, addr, 6); payload[6] = addr_type; - spi_header_t resp_hdr; - uint8_t resp_buf[SPI_MAX_PAYLOAD]; - - esp_err_t ret = spi_bridge_send_command( - SPI_ID_BT_APP_FLOOD, payload, sizeof(payload), &resp_hdr, resp_buf, L2CAP_SPI_START_TIMEOUT); - - if (ret != ESP_OK || resp_buf[0] != SPI_STATUS_OK) { + s_session_id = spi_session_start(SPI_ID_BT_APP_FLOOD, payload, sizeof(payload), NULL, NULL); + if (s_session_id == SPI_SESSION_INVALID_ID) { ESP_LOGE(TAG, "Failed to start L2CAP flood on C5"); return ESP_FAIL; } @@ -64,16 +60,10 @@ esp_err_t ble_l2cap_flood_stop(void) { if (!s_is_running) return ESP_OK; - spi_header_t resp_hdr; - uint8_t resp_buf[SPI_MAX_PAYLOAD]; - - esp_err_t ret = spi_bridge_send_command( - SPI_ID_BT_APP_STOP, NULL, 0, &resp_hdr, resp_buf, L2CAP_SPI_STOP_TIMEOUT); - - if (ret != ESP_OK || resp_buf[0] != SPI_STATUS_OK) { - ESP_LOGW(TAG, "Failed to stop L2CAP flood on C5"); + if (s_session_id != SPI_SESSION_INVALID_ID) { + spi_session_stop(s_session_id); + s_session_id = SPI_SESSION_INVALID_ID; } - s_is_running = false; ESP_LOGI(TAG, "L2CAP Flood stopped"); return ESP_OK; diff --git a/firmware_p4/components/Applications/bluetooth/ble_scanner.c b/firmware_p4/components/Applications/bluetooth/ble_scanner.c index 495e0ee8..430394a1 100644 --- a/firmware_p4/components/Applications/bluetooth/ble_scanner.c +++ b/firmware_p4/components/Applications/bluetooth/ble_scanner.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "ble_scanner.h" diff --git a/firmware_p4/components/Applications/bluetooth/ble_screen_server.c b/firmware_p4/components/Applications/bluetooth/ble_screen_server.c index 60d5553f..f25889b1 100644 --- a/firmware_p4/components/Applications/bluetooth/ble_screen_server.c +++ b/firmware_p4/components/Applications/bluetooth/ble_screen_server.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "ble_screen_server.h" diff --git a/firmware_p4/components/Applications/bluetooth/ble_sniffer.c b/firmware_p4/components/Applications/bluetooth/ble_sniffer.c index 9f0793c5..a80a556c 100644 --- a/firmware_p4/components/Applications/bluetooth/ble_sniffer.c +++ b/firmware_p4/components/Applications/bluetooth/ble_sniffer.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "ble_sniffer.h" diff --git a/firmware_p4/components/Applications/bluetooth/ble_tracker.c b/firmware_p4/components/Applications/bluetooth/ble_tracker.c index 551e9135..8ae50133 100644 --- a/firmware_p4/components/Applications/bluetooth/ble_tracker.c +++ b/firmware_p4/components/Applications/bluetooth/ble_tracker.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "ble_tracker.h" diff --git a/firmware_p4/components/Applications/bluetooth/canned_spam.c b/firmware_p4/components/Applications/bluetooth/canned_spam.c index 5287a7af..111c2895 100644 --- a/firmware_p4/components/Applications/bluetooth/canned_spam.c +++ b/firmware_p4/components/Applications/bluetooth/canned_spam.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . // BLE Spam Indices: // 0: AppleJuice (Airpods, Beats, etc) @@ -29,12 +30,10 @@ #include "bluetooth_service.h" #include "spi_bridge.h" #include "spi_protocol.h" +#include "spi_session.h" static const char *TAG = "CANNED_SPAM"; -#define SPAM_SPI_START_TIMEOUT 5000 -#define SPAM_SPI_STOP_TIMEOUT 2000 - typedef enum { CANNED_SPAM_CAT_APPLE_JUICE = 0, CANNED_SPAM_CAT_SOUR_APPLE, @@ -50,6 +49,7 @@ static const canned_spam_type_t CATEGORY_INFO[] = { static bool s_is_running = false; static int s_current_category = -1; +static uint32_t s_session_id = SPI_SESSION_INVALID_ID; int spam_get_attack_count(void) { return CANNED_SPAM_CAT_COUNT; @@ -77,13 +77,8 @@ esp_err_t spam_start(int attack_index) { } uint8_t payload = (uint8_t)attack_index; - spi_header_t resp_hdr; - uint8_t resp_buf[SPI_MAX_PAYLOAD]; - - esp_err_t ret = spi_bridge_send_command( - SPI_ID_BT_APP_SPAM, &payload, sizeof(payload), &resp_hdr, resp_buf, SPAM_SPI_START_TIMEOUT); - - if (ret != ESP_OK || resp_buf[0] != SPI_STATUS_OK) { + s_session_id = spi_session_start(SPI_ID_BT_APP_SPAM, &payload, sizeof(payload), NULL, NULL); + if (s_session_id == SPI_SESSION_INVALID_ID) { ESP_LOGE(TAG, "Failed to start spam on C5"); return ESP_FAIL; } @@ -100,16 +95,10 @@ esp_err_t spam_stop(void) { return ESP_ERR_INVALID_STATE; } - spi_header_t resp_hdr; - uint8_t resp_buf[SPI_MAX_PAYLOAD]; - - esp_err_t ret = spi_bridge_send_command( - SPI_ID_BT_APP_STOP, NULL, 0, &resp_hdr, resp_buf, SPAM_SPI_STOP_TIMEOUT); - - if (ret != ESP_OK || resp_buf[0] != SPI_STATUS_OK) { - ESP_LOGW(TAG, "Failed to stop spam on C5"); + if (s_session_id != SPI_SESSION_INVALID_ID) { + spi_session_stop(s_session_id); + s_session_id = SPI_SESSION_INVALID_ID; } - s_is_running = false; ESP_LOGI(TAG, "Spam stopped"); return ESP_OK; diff --git a/firmware_p4/components/Applications/bluetooth/exposure_notification.c b/firmware_p4/components/Applications/bluetooth/exposure_notification.c index 05c0f039..d6eb5276 100644 --- a/firmware_p4/components/Applications/bluetooth/exposure_notification.c +++ b/firmware_p4/components/Applications/bluetooth/exposure_notification.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "exposure_notification.h" diff --git a/firmware_p4/components/Applications/bluetooth/gatt_explorer.c b/firmware_p4/components/Applications/bluetooth/gatt_explorer.c index 227834fe..f1a6158d 100644 --- a/firmware_p4/components/Applications/bluetooth/gatt_explorer.c +++ b/firmware_p4/components/Applications/bluetooth/gatt_explorer.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "gatt_explorer.h" diff --git a/firmware_p4/components/Applications/bluetooth/include/android_spam.h b/firmware_p4/components/Applications/bluetooth/include/android_spam.h index f2d3094d..476f04f7 100644 --- a/firmware_p4/components/Applications/bluetooth/include/android_spam.h +++ b/firmware_p4/components/Applications/bluetooth/include/android_spam.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef ANDROID_SPAM_H #define ANDROID_SPAM_H diff --git a/firmware_p4/components/Applications/bluetooth/include/apple_juice_spam.h b/firmware_p4/components/Applications/bluetooth/include/apple_juice_spam.h index 6369d585..c7560239 100644 --- a/firmware_p4/components/Applications/bluetooth/include/apple_juice_spam.h +++ b/firmware_p4/components/Applications/bluetooth/include/apple_juice_spam.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef APPLE_JUICE_SPAM_H #define APPLE_JUICE_SPAM_H diff --git a/firmware_p4/components/Applications/bluetooth/include/ble_connect_flood.h b/firmware_p4/components/Applications/bluetooth/include/ble_connect_flood.h index b0a53001..3a45f851 100644 --- a/firmware_p4/components/Applications/bluetooth/include/ble_connect_flood.h +++ b/firmware_p4/components/Applications/bluetooth/include/ble_connect_flood.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef BLE_CONNECT_FLOOD_H #define BLE_CONNECT_FLOOD_H diff --git a/firmware_p4/components/Applications/bluetooth/include/ble_hid_keyboard.h b/firmware_p4/components/Applications/bluetooth/include/ble_hid_keyboard.h index 891e48fa..5af89ea8 100644 --- a/firmware_p4/components/Applications/bluetooth/include/ble_hid_keyboard.h +++ b/firmware_p4/components/Applications/bluetooth/include/ble_hid_keyboard.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef BLE_HID_KEYBOARD_H #define BLE_HID_KEYBOARD_H diff --git a/firmware_p4/components/Applications/bluetooth/include/ble_l2cap_flood.h b/firmware_p4/components/Applications/bluetooth/include/ble_l2cap_flood.h index d5067eb9..1622a8ee 100644 --- a/firmware_p4/components/Applications/bluetooth/include/ble_l2cap_flood.h +++ b/firmware_p4/components/Applications/bluetooth/include/ble_l2cap_flood.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef BLE_L2CAP_FLOOD_H #define BLE_L2CAP_FLOOD_H diff --git a/firmware_p4/components/Applications/bluetooth/include/ble_scanner.h b/firmware_p4/components/Applications/bluetooth/include/ble_scanner.h index 072cf3a0..d8fa356e 100644 --- a/firmware_p4/components/Applications/bluetooth/include/ble_scanner.h +++ b/firmware_p4/components/Applications/bluetooth/include/ble_scanner.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef BLE_SCANNER_H #define BLE_SCANNER_H diff --git a/firmware_p4/components/Applications/bluetooth/include/ble_screen_server.h b/firmware_p4/components/Applications/bluetooth/include/ble_screen_server.h index 16ae099b..14549470 100644 --- a/firmware_p4/components/Applications/bluetooth/include/ble_screen_server.h +++ b/firmware_p4/components/Applications/bluetooth/include/ble_screen_server.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef BLE_SCREEN_SERVER_H #define BLE_SCREEN_SERVER_H diff --git a/firmware_p4/components/Applications/bluetooth/include/ble_sniffer.h b/firmware_p4/components/Applications/bluetooth/include/ble_sniffer.h index 07dba6be..3fcb5ed5 100644 --- a/firmware_p4/components/Applications/bluetooth/include/ble_sniffer.h +++ b/firmware_p4/components/Applications/bluetooth/include/ble_sniffer.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef BLE_SNIFFER_H #define BLE_SNIFFER_H diff --git a/firmware_p4/components/Applications/bluetooth/include/ble_tracker.h b/firmware_p4/components/Applications/bluetooth/include/ble_tracker.h index 3b07213b..823d4d2b 100644 --- a/firmware_p4/components/Applications/bluetooth/include/ble_tracker.h +++ b/firmware_p4/components/Applications/bluetooth/include/ble_tracker.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef BLE_TRACKER_H #define BLE_TRACKER_H diff --git a/firmware_p4/components/Applications/bluetooth/include/canned_spam.h b/firmware_p4/components/Applications/bluetooth/include/canned_spam.h index f4236263..41d00372 100644 --- a/firmware_p4/components/Applications/bluetooth/include/canned_spam.h +++ b/firmware_p4/components/Applications/bluetooth/include/canned_spam.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef CANNED_SPAM_H #define CANNED_SPAM_H diff --git a/firmware_p4/components/Applications/bluetooth/include/exposure_notification.h b/firmware_p4/components/Applications/bluetooth/include/exposure_notification.h index badfa070..2bc811b7 100644 --- a/firmware_p4/components/Applications/bluetooth/include/exposure_notification.h +++ b/firmware_p4/components/Applications/bluetooth/include/exposure_notification.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef EXPOSURE_NOTIFICATION_H #define EXPOSURE_NOTIFICATION_H diff --git a/firmware_p4/components/Applications/bluetooth/include/gatt_explorer.h b/firmware_p4/components/Applications/bluetooth/include/gatt_explorer.h index f45af2c8..65952f39 100644 --- a/firmware_p4/components/Applications/bluetooth/include/gatt_explorer.h +++ b/firmware_p4/components/Applications/bluetooth/include/gatt_explorer.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef GATT_EXPLORER_H #define GATT_EXPLORER_H diff --git a/firmware_p4/components/Applications/bluetooth/include/oui_lookup.h b/firmware_p4/components/Applications/bluetooth/include/oui_lookup.h index 34c9ab08..005d8aa1 100644 --- a/firmware_p4/components/Applications/bluetooth/include/oui_lookup.h +++ b/firmware_p4/components/Applications/bluetooth/include/oui_lookup.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef OUI_LOOKUP_H #define OUI_LOOKUP_H diff --git a/firmware_p4/components/Applications/bluetooth/include/samsung_spam.h b/firmware_p4/components/Applications/bluetooth/include/samsung_spam.h index 3219d247..f1179b47 100644 --- a/firmware_p4/components/Applications/bluetooth/include/samsung_spam.h +++ b/firmware_p4/components/Applications/bluetooth/include/samsung_spam.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef SAMSUNG_SPAM_H #define SAMSUNG_SPAM_H diff --git a/firmware_p4/components/Applications/bluetooth/include/skimmer_detector.h b/firmware_p4/components/Applications/bluetooth/include/skimmer_detector.h index 11dba3fd..5317a055 100644 --- a/firmware_p4/components/Applications/bluetooth/include/skimmer_detector.h +++ b/firmware_p4/components/Applications/bluetooth/include/skimmer_detector.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef SKIMMER_DETECTOR_H #define SKIMMER_DETECTOR_H diff --git a/firmware_p4/components/Applications/bluetooth/include/sour_apple_spam.h b/firmware_p4/components/Applications/bluetooth/include/sour_apple_spam.h index 102c774c..4373e9e4 100644 --- a/firmware_p4/components/Applications/bluetooth/include/sour_apple_spam.h +++ b/firmware_p4/components/Applications/bluetooth/include/sour_apple_spam.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef SOUR_APPLE_SPAM_H #define SOUR_APPLE_SPAM_H diff --git a/firmware_p4/components/Applications/bluetooth/include/swift_pair_spam.h b/firmware_p4/components/Applications/bluetooth/include/swift_pair_spam.h index 032eeffc..63167f5f 100644 --- a/firmware_p4/components/Applications/bluetooth/include/swift_pair_spam.h +++ b/firmware_p4/components/Applications/bluetooth/include/swift_pair_spam.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef SWIFT_PAIR_SPAM_H #define SWIFT_PAIR_SPAM_H diff --git a/firmware_p4/components/Applications/bluetooth/include/tracker_detector.h b/firmware_p4/components/Applications/bluetooth/include/tracker_detector.h index 728a3b5e..e4e4b463 100644 --- a/firmware_p4/components/Applications/bluetooth/include/tracker_detector.h +++ b/firmware_p4/components/Applications/bluetooth/include/tracker_detector.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef TRACKER_DETECTOR_H #define TRACKER_DETECTOR_H diff --git a/firmware_p4/components/Applications/bluetooth/include/tutti_frutti_spam.h b/firmware_p4/components/Applications/bluetooth/include/tutti_frutti_spam.h index a7d3135d..24ce284d 100644 --- a/firmware_p4/components/Applications/bluetooth/include/tutti_frutti_spam.h +++ b/firmware_p4/components/Applications/bluetooth/include/tutti_frutti_spam.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef TUTTI_FRUTTI_SPAM_H #define TUTTI_FRUTTI_SPAM_H diff --git a/firmware_p4/components/Applications/bluetooth/include/uuid_lookup.h b/firmware_p4/components/Applications/bluetooth/include/uuid_lookup.h index 5e273fa0..1a3ccf02 100644 --- a/firmware_p4/components/Applications/bluetooth/include/uuid_lookup.h +++ b/firmware_p4/components/Applications/bluetooth/include/uuid_lookup.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef UUID_LOOKUP_H #define UUID_LOOKUP_H diff --git a/firmware_p4/components/Applications/bluetooth/oui_lookup.c b/firmware_p4/components/Applications/bluetooth/oui_lookup.c index 64daa374..06453692 100644 --- a/firmware_p4/components/Applications/bluetooth/oui_lookup.c +++ b/firmware_p4/components/Applications/bluetooth/oui_lookup.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "oui_lookup.h" diff --git a/firmware_p4/components/Applications/bluetooth/samsung_spam.c b/firmware_p4/components/Applications/bluetooth/samsung_spam.c index 1bcf8767..cdc5a801 100644 --- a/firmware_p4/components/Applications/bluetooth/samsung_spam.c +++ b/firmware_p4/components/Applications/bluetooth/samsung_spam.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "samsung_spam.h" diff --git a/firmware_p4/components/Applications/bluetooth/skimmer_detector.c b/firmware_p4/components/Applications/bluetooth/skimmer_detector.c index 8a2b7bd7..31e84968 100644 --- a/firmware_p4/components/Applications/bluetooth/skimmer_detector.c +++ b/firmware_p4/components/Applications/bluetooth/skimmer_detector.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "skimmer_detector.h" @@ -20,27 +21,31 @@ #include "esp_log.h" #include "spi_bridge.h" +#include "spi_session.h" static const char *TAG = "SKIMMER_DETECTOR"; -#define SPI_TIMEOUT_MS 2000 #define SPI_DATA_TIMEOUT_MS 1000 static skimmer_detector_record_t *s_cached_results = NULL; static uint16_t s_cached_count = 0; static uint16_t s_cached_capacity = 0; static skimmer_detector_record_t s_empty_record; +static uint32_t s_session_id = SPI_SESSION_INVALID_ID; bool skimmer_detector_start(void) { ESP_LOGI(TAG, "Skimmer detector started"); skimmer_detector_clear_results(); - return (spi_bridge_send_command(SPI_ID_BT_APP_SKIMMER, NULL, 0, NULL, NULL, SPI_TIMEOUT_MS) == - ESP_OK); + s_session_id = spi_session_start(SPI_ID_BT_APP_SKIMMER, NULL, 0, NULL, NULL); + return s_session_id != SPI_SESSION_INVALID_ID; } void skimmer_detector_stop(void) { ESP_LOGI(TAG, "Skimmer detector stopped"); - spi_bridge_send_command(SPI_ID_BT_APP_STOP, NULL, 0, NULL, NULL, SPI_TIMEOUT_MS); + if (s_session_id != SPI_SESSION_INVALID_ID) { + spi_session_stop(s_session_id); + s_session_id = SPI_SESSION_INVALID_ID; + } skimmer_detector_clear_results(); } diff --git a/firmware_p4/components/Applications/bluetooth/sour_apple_spam.c b/firmware_p4/components/Applications/bluetooth/sour_apple_spam.c index 0dbc0011..29632510 100644 --- a/firmware_p4/components/Applications/bluetooth/sour_apple_spam.c +++ b/firmware_p4/components/Applications/bluetooth/sour_apple_spam.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "sour_apple_spam.h" diff --git a/firmware_p4/components/Applications/bluetooth/swift_pair_spam.c b/firmware_p4/components/Applications/bluetooth/swift_pair_spam.c index 85c13f7f..4c0c6d04 100644 --- a/firmware_p4/components/Applications/bluetooth/swift_pair_spam.c +++ b/firmware_p4/components/Applications/bluetooth/swift_pair_spam.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "swift_pair_spam.h" diff --git a/firmware_p4/components/Applications/bluetooth/tracker_detector.c b/firmware_p4/components/Applications/bluetooth/tracker_detector.c index d4a0e726..720fa59a 100644 --- a/firmware_p4/components/Applications/bluetooth/tracker_detector.c +++ b/firmware_p4/components/Applications/bluetooth/tracker_detector.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "tracker_detector.h" @@ -20,27 +21,31 @@ #include "esp_log.h" #include "spi_bridge.h" +#include "spi_session.h" static const char *TAG = "TRACKER_DETECTOR"; -#define SPI_TIMEOUT_MS 2000 #define SPI_DATA_TIMEOUT_MS 1000 static tracker_detector_record_t *s_cached_results = NULL; static uint16_t s_cached_count = 0; static uint16_t s_cached_capacity = 0; static tracker_detector_record_t s_empty_record; +static uint32_t s_session_id = SPI_SESSION_INVALID_ID; bool tracker_detector_start(void) { ESP_LOGI(TAG, "Tracker detector started"); tracker_detector_clear_results(); - return (spi_bridge_send_command(SPI_ID_BT_APP_TRACKER, NULL, 0, NULL, NULL, SPI_TIMEOUT_MS) == - ESP_OK); + s_session_id = spi_session_start(SPI_ID_BT_APP_TRACKER, NULL, 0, NULL, NULL); + return s_session_id != SPI_SESSION_INVALID_ID; } void tracker_detector_stop(void) { ESP_LOGI(TAG, "Tracker detector stopped"); - spi_bridge_send_command(SPI_ID_BT_APP_STOP, NULL, 0, NULL, NULL, SPI_TIMEOUT_MS); + if (s_session_id != SPI_SESSION_INVALID_ID) { + spi_session_stop(s_session_id); + s_session_id = SPI_SESSION_INVALID_ID; + } tracker_detector_clear_results(); } diff --git a/firmware_p4/components/Applications/bluetooth/tutti_frutti_spam.c b/firmware_p4/components/Applications/bluetooth/tutti_frutti_spam.c index 64199c02..a93ee828 100644 --- a/firmware_p4/components/Applications/bluetooth/tutti_frutti_spam.c +++ b/firmware_p4/components/Applications/bluetooth/tutti_frutti_spam.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "tutti_frutti_spam.h" diff --git a/firmware_p4/components/Applications/bluetooth/uuid_lookup.c b/firmware_p4/components/Applications/bluetooth/uuid_lookup.c index 9cbae81c..f10068b4 100644 --- a/firmware_p4/components/Applications/bluetooth/uuid_lookup.c +++ b/firmware_p4/components/Applications/bluetooth/uuid_lookup.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "uuid_lookup.h" diff --git a/firmware_p4/components/Applications/nfc/emu_diag.c b/firmware_p4/components/Applications/nfc/emu_diag.c index 134344fb..6b5ce381 100644 --- a/firmware_p4/components/Applications/nfc/emu_diag.c +++ b/firmware_p4/components/Applications/nfc/emu_diag.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "emu_diag.h" #include diff --git a/firmware_p4/components/Applications/nfc/include/emu_diag.h b/firmware_p4/components/Applications/nfc/include/emu_diag.h index 932eeb9e..47626d33 100644 --- a/firmware_p4/components/Applications/nfc/include/emu_diag.h +++ b/firmware_p4/components/Applications/nfc/include/emu_diag.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef EMU_DIAG_H #define EMU_DIAG_H diff --git a/firmware_p4/components/Applications/nfc/include/nfc_card_info.h b/firmware_p4/components/Applications/nfc/include/nfc_card_info.h index 9ab6e514..350b5353 100644 --- a/firmware_p4/components/Applications/nfc/include/nfc_card_info.h +++ b/firmware_p4/components/Applications/nfc/include/nfc_card_info.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef NFC_CARD_INFO_H #define NFC_CARD_INFO_H diff --git a/firmware_p4/components/Applications/nfc/include/nfc_debug.h b/firmware_p4/components/Applications/nfc/include/nfc_debug.h index 86e82f68..7d1ad4cf 100644 --- a/firmware_p4/components/Applications/nfc/include/nfc_debug.h +++ b/firmware_p4/components/Applications/nfc/include/nfc_debug.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef NFC_DEBUG_H #define NFC_DEBUG_H diff --git a/firmware_p4/components/Applications/nfc/include/nfc_device.h b/firmware_p4/components/Applications/nfc/include/nfc_device.h index d661d909..ac47a1db 100644 --- a/firmware_p4/components/Applications/nfc/include/nfc_device.h +++ b/firmware_p4/components/Applications/nfc/include/nfc_device.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef NFC_DEVICE_H #define NFC_DEVICE_H diff --git a/firmware_p4/components/Applications/nfc/include/nfc_listener.h b/firmware_p4/components/Applications/nfc/include/nfc_listener.h index 56daf8c4..a7421db0 100644 --- a/firmware_p4/components/Applications/nfc/include/nfc_listener.h +++ b/firmware_p4/components/Applications/nfc/include/nfc_listener.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef NFC_LISTENER_H #define NFC_LISTENER_H diff --git a/firmware_p4/components/Applications/nfc/include/nfc_manager.h b/firmware_p4/components/Applications/nfc/include/nfc_manager.h index eacc3c18..2b526d1f 100644 --- a/firmware_p4/components/Applications/nfc/include/nfc_manager.h +++ b/firmware_p4/components/Applications/nfc/include/nfc_manager.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef NFC_MANAGER_H #define NFC_MANAGER_H diff --git a/firmware_p4/components/Applications/nfc/include/nfc_reader.h b/firmware_p4/components/Applications/nfc/include/nfc_reader.h index 9d90cc6b..fa279b3c 100644 --- a/firmware_p4/components/Applications/nfc/include/nfc_reader.h +++ b/firmware_p4/components/Applications/nfc/include/nfc_reader.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef NFC_READER_H #define NFC_READER_H diff --git a/firmware_p4/components/Applications/nfc/include/nfc_scanner.h b/firmware_p4/components/Applications/nfc/include/nfc_scanner.h index 992f1e38..69157fb4 100644 --- a/firmware_p4/components/Applications/nfc/include/nfc_scanner.h +++ b/firmware_p4/components/Applications/nfc/include/nfc_scanner.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef NFC_SCANNER_H #define NFC_SCANNER_H diff --git a/firmware_p4/components/Applications/nfc/include/nfc_store.h b/firmware_p4/components/Applications/nfc/include/nfc_store.h index 17ca88ee..368f07dc 100644 --- a/firmware_p4/components/Applications/nfc/include/nfc_store.h +++ b/firmware_p4/components/Applications/nfc/include/nfc_store.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef NFC_STORE_H #define NFC_STORE_H diff --git a/firmware_p4/components/Applications/nfc/nfc_card_info.c b/firmware_p4/components/Applications/nfc/nfc_card_info.c index d04cfa20..26e93201 100644 --- a/firmware_p4/components/Applications/nfc/nfc_card_info.c +++ b/firmware_p4/components/Applications/nfc/nfc_card_info.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "nfc_card_info.h" #include diff --git a/firmware_p4/components/Applications/nfc/nfc_debug.c b/firmware_p4/components/Applications/nfc/nfc_debug.c index 69e80b56..52ce11db 100644 --- a/firmware_p4/components/Applications/nfc/nfc_debug.c +++ b/firmware_p4/components/Applications/nfc/nfc_debug.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "nfc_debug.h" #include "hb_nfc_spi.h" diff --git a/firmware_p4/components/Applications/nfc/nfc_device.c b/firmware_p4/components/Applications/nfc/nfc_device.c index a6c476d2..a425b3d9 100644 --- a/firmware_p4/components/Applications/nfc/nfc_device.c +++ b/firmware_p4/components/Applications/nfc/nfc_device.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "nfc_device.h" diff --git a/firmware_p4/components/Applications/nfc/nfc_listener.c b/firmware_p4/components/Applications/nfc/nfc_listener.c index e854f9e1..7dd53cc1 100644 --- a/firmware_p4/components/Applications/nfc/nfc_listener.c +++ b/firmware_p4/components/Applications/nfc/nfc_listener.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "nfc_listener.h" #include diff --git a/firmware_p4/components/Applications/nfc/nfc_manager.c b/firmware_p4/components/Applications/nfc/nfc_manager.c index 50a006a0..5ace89d4 100644 --- a/firmware_p4/components/Applications/nfc/nfc_manager.c +++ b/firmware_p4/components/Applications/nfc/nfc_manager.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "nfc_manager.h" diff --git a/firmware_p4/components/Applications/nfc/nfc_reader.c b/firmware_p4/components/Applications/nfc/nfc_reader.c index 69ae7d3c..f09963a2 100644 --- a/firmware_p4/components/Applications/nfc/nfc_reader.c +++ b/firmware_p4/components/Applications/nfc/nfc_reader.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "nfc_reader.h" #include @@ -29,6 +30,9 @@ #include "mf_plus.h" #include "mf_ultralight.h" #include "nfc_card_info.h" +#include "nfc_dict_loader.h" +#include "tos_flash_paths.h" +#include "tos_storage_paths.h" #include "nfc_common.h" #include "nfc_store.h" #include "poller.h" @@ -464,39 +468,9 @@ void mf_classic_read_full(nfc_iso14443a_data_t *card) { } if (!res->key_a_found) { - if (known && known->hint_keys) { - for (int k = 0; k < known->hint_key_count && !res->key_a_found; k++) { - if (try_key_bytes(card, (uint8_t)res->first_block, MF_KEY_A, known->hint_keys[k])) { - res->key_a_found = true; - res->key_a_dict_idx = 0; - memcpy(res->key_a, known->hint_keys[k], 6); - keys_a_found++; - memcpy(s_emu_card.keys[sect].key_a, known->hint_keys[k], 6); - s_emu_card.keys[sect].key_a_known = true; - prng_record_nonce(sect, mf_classic_get_last_nt()); - mf_key_cache_store(&(mf_key_cache_store_params_t){.uid = card->uid, - .uid_len = card->uid_len, - .sector = sect, - .sector_count = nsect, - .type = MF_KEY_A, - .key = known->hint_keys[k]}); - } - } - } for (int k = 0; k < dict_count && !res->key_a_found; k++) { uint8_t key_bytes[6]; mf_key_dict_get(k, key_bytes); - if (known && known->hint_keys) { - bool already = false; - for (int h = 0; h < known->hint_key_count; h++) { - if (memcmp(key_bytes, known->hint_keys[h], 6) == 0) { - already = true; - break; - } - } - if (already) - continue; - } if (try_key_bytes(card, (uint8_t)res->first_block, MF_KEY_A, key_bytes)) { res->key_a_found = true; res->key_a_dict_idx = k; @@ -592,27 +566,9 @@ void mf_classic_read_full(nfc_iso14443a_data_t *card) { } \ } while (0) - if (known && known->hint_keys) { - for (int k = 0; k < known->hint_key_count && !res->key_b_found; k++) { - if (try_key_bytes(card, (uint8_t)res->first_block, MF_KEY_B, known->hint_keys[k])) { - FOUND_KEY_B(known->hint_keys[k]); - } - } - } for (int k = 0; k < dict_count && !res->key_b_found; k++) { uint8_t key_bytes[6]; mf_key_dict_get(k, key_bytes); - if (known && known->hint_keys) { - bool already = false; - for (int h = 0; h < known->hint_key_count; h++) { - if (memcmp(key_bytes, known->hint_keys[h], 6) == 0) { - already = true; - break; - } - } - if (already) - continue; - } if (try_key_bytes(card, (uint8_t)res->first_block, MF_KEY_B, key_bytes)) { FOUND_KEY_B(key_bytes); } @@ -1011,12 +967,29 @@ void mfp_probe_and_dump(nfc_iso14443a_data_t *card) { #endif #if MF_ULC_TRY_DEFAULT_KEY -#ifndef MF_ULC_DEFAULT_KEY -#define MF_ULC_DEFAULT_KEY \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -#endif +#define MF_ULC_DICT_MAX_KEYS 8 +#define MF_ULC_KEY_SIZE 16 + +static uint8_t s_mf_ulc_keys[MF_ULC_DICT_MAX_KEYS][MF_ULC_KEY_SIZE]; +static size_t s_mf_ulc_key_count = 0; +static bool s_is_mf_ulc_loaded = false; -static const uint8_t k_mf_ulc_default_key[16] = {MF_ULC_DEFAULT_KEY}; +static void load_mf_ulc_keys(void) { + if (s_is_mf_ulc_loaded) { + return; + } + s_is_mf_ulc_loaded = true; + + const nfc_dict_load_params_t load = { + .sd_path = TOS_PATH_NFC_DICT "/mf_ulc_default.dic", + .flash_path = FLASH_NFC_DICT "/mf_ulc_default.dic", + .key_size = MF_ULC_KEY_SIZE, + .max_keys = MF_ULC_DICT_MAX_KEYS, + }; + if (nfc_dict_load_file(&load, (uint8_t *)s_mf_ulc_keys, &s_mf_ulc_key_count) != ESP_OK) { + s_mf_ulc_key_count = 0; + } +} #endif void mful_dump_card(nfc_iso14443a_data_t *card) { @@ -1097,11 +1070,15 @@ void mful_dump_card(nfc_iso14443a_data_t *card) { if (vlen < 7) { #if MF_ULC_TRY_DEFAULT_KEY - hb_nfc_err_t aerr = mful_ulc_auth(k_mf_ulc_default_key); - if (aerr == HB_NFC_OK) { - tag_type = "Ultralight C (3DES auth)"; - total_pages = 48; - ESP_LOGI(TAG, "ULC auth OK (default key)"); + load_mf_ulc_keys(); + for (size_t ki = 0; ki < s_mf_ulc_key_count; ki++) { + hb_nfc_err_t aerr = mful_ulc_auth(s_mf_ulc_keys[ki]); + if (aerr == HB_NFC_OK) { + tag_type = "Ultralight C (3DES auth)"; + total_pages = 48; + ESP_LOGI(TAG, "ULC auth OK (key %u from dict)", (unsigned)ki); + break; + } } #endif } diff --git a/firmware_p4/components/Applications/nfc/nfc_scanner.c b/firmware_p4/components/Applications/nfc/nfc_scanner.c index 02a164f3..a0eb3a47 100644 --- a/firmware_p4/components/Applications/nfc/nfc_scanner.c +++ b/firmware_p4/components/Applications/nfc/nfc_scanner.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "nfc_scanner.h" #include diff --git a/firmware_p4/components/Applications/nfc/nfc_store.c b/firmware_p4/components/Applications/nfc/nfc_store.c index c62a8dd3..cef7ec60 100644 --- a/firmware_p4/components/Applications/nfc/nfc_store.c +++ b/firmware_p4/components/Applications/nfc/nfc_store.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "nfc_store.h" diff --git a/firmware_p4/components/Applications/nfc/protocols/common/include/nfc_apdu.h b/firmware_p4/components/Applications/nfc/protocols/common/include/nfc_apdu.h index 5084ec8e..0b8c3968 100644 --- a/firmware_p4/components/Applications/nfc/protocols/common/include/nfc_apdu.h +++ b/firmware_p4/components/Applications/nfc/protocols/common/include/nfc_apdu.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file nfc_apdu.h * @brief ISO/IEC 7816-4 APDU helpers over ISO14443-4 (T=CL). diff --git a/firmware_p4/components/Applications/nfc/protocols/common/include/nfc_common.h b/firmware_p4/components/Applications/nfc/protocols/common/include/nfc_common.h index 0f24c0db..e05453fb 100644 --- a/firmware_p4/components/Applications/nfc/protocols/common/include/nfc_common.h +++ b/firmware_p4/components/Applications/nfc/protocols/common/include/nfc_common.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file nfc_common.h * @brief Common utilities for the NFC stack. diff --git a/firmware_p4/components/Applications/nfc/protocols/common/include/nfc_crypto.h b/firmware_p4/components/Applications/nfc/protocols/common/include/nfc_crypto.h index f4af6051..a76134f4 100644 --- a/firmware_p4/components/Applications/nfc/protocols/common/include/nfc_crypto.h +++ b/firmware_p4/components/Applications/nfc/protocols/common/include/nfc_crypto.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file nfc_crypto.h * @brief Common crypto helpers for NFC phases (CMAC, KDF, diversification). diff --git a/firmware_p4/components/Applications/nfc/protocols/common/include/nfc_rf.h b/firmware_p4/components/Applications/nfc/protocols/common/include/nfc_rf.h index 57893e69..d42162ff 100644 --- a/firmware_p4/components/Applications/nfc/protocols/common/include/nfc_rf.h +++ b/firmware_p4/components/Applications/nfc/protocols/common/include/nfc_rf.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file nfc_rf.h * @brief RF layer configuration (Phase 2): bitrate, modulation, parity, timing. diff --git a/firmware_p4/components/Applications/nfc/protocols/common/include/nfc_tag.h b/firmware_p4/components/Applications/nfc/protocols/common/include/nfc_tag.h index 2d378a0b..76dcc4e6 100644 --- a/firmware_p4/components/Applications/nfc/protocols/common/include/nfc_tag.h +++ b/firmware_p4/components/Applications/nfc/protocols/common/include/nfc_tag.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file nfc_tag.h * @brief NFC Forum Tag Type handlers (Phase 7). diff --git a/firmware_p4/components/Applications/nfc/protocols/common/include/nfc_tcl.h b/firmware_p4/components/Applications/nfc/protocols/common/include/nfc_tcl.h index 4e1dcfa2..cfd8adcf 100644 --- a/firmware_p4/components/Applications/nfc/protocols/common/include/nfc_tcl.h +++ b/firmware_p4/components/Applications/nfc/protocols/common/include/nfc_tcl.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef NFC_TCL_H #define NFC_TCL_H diff --git a/firmware_p4/components/Applications/nfc/protocols/common/nfc_apdu.c b/firmware_p4/components/Applications/nfc/protocols/common/nfc_apdu.c index ba9e85cf..b560e454 100644 --- a/firmware_p4/components/Applications/nfc/protocols/common/nfc_apdu.c +++ b/firmware_p4/components/Applications/nfc/protocols/common/nfc_apdu.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "nfc_apdu.h" diff --git a/firmware_p4/components/Applications/nfc/protocols/common/nfc_crypto.c b/firmware_p4/components/Applications/nfc/protocols/common/nfc_crypto.c index c6637afe..bff65528 100644 --- a/firmware_p4/components/Applications/nfc/protocols/common/nfc_crypto.c +++ b/firmware_p4/components/Applications/nfc/protocols/common/nfc_crypto.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "nfc_crypto.h" diff --git a/firmware_p4/components/Applications/nfc/protocols/common/nfc_rf.c b/firmware_p4/components/Applications/nfc/protocols/common/nfc_rf.c index 2aa0f05d..f92f49fd 100644 --- a/firmware_p4/components/Applications/nfc/protocols/common/nfc_rf.c +++ b/firmware_p4/components/Applications/nfc/protocols/common/nfc_rf.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "nfc_rf.h" diff --git a/firmware_p4/components/Applications/nfc/protocols/common/nfc_tag.c b/firmware_p4/components/Applications/nfc/protocols/common/nfc_tag.c index 63135d76..1b5a7fcc 100644 --- a/firmware_p4/components/Applications/nfc/protocols/common/nfc_tag.c +++ b/firmware_p4/components/Applications/nfc/protocols/common/nfc_tag.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "nfc_tag.h" diff --git a/firmware_p4/components/Applications/nfc/protocols/common/nfc_tcl.c b/firmware_p4/components/Applications/nfc/protocols/common/nfc_tcl.c index 087ce5d1..b48e2f02 100644 --- a/firmware_p4/components/Applications/nfc/protocols/common/nfc_tcl.c +++ b/firmware_p4/components/Applications/nfc/protocols/common/nfc_tcl.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "nfc_tcl.h" diff --git a/firmware_p4/components/Applications/nfc/protocols/emv/emv.c b/firmware_p4/components/Applications/nfc/protocols/emv/emv.c index 6fb4cbc4..52aba6b2 100644 --- a/firmware_p4/components/Applications/nfc/protocols/emv/emv.c +++ b/firmware_p4/components/Applications/nfc/protocols/emv/emv.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "emv.h" diff --git a/firmware_p4/components/Applications/nfc/protocols/emv/include/emv.h b/firmware_p4/components/Applications/nfc/protocols/emv/include/emv.h index 1fe324d5..c7cb1662 100644 --- a/firmware_p4/components/Applications/nfc/protocols/emv/include/emv.h +++ b/firmware_p4/components/Applications/nfc/protocols/emv/include/emv.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file emv.h * @brief EMV contactless helpers (PPSE, AID select, GPO, READ RECORD). diff --git a/firmware_p4/components/Applications/nfc/protocols/felica/felica.c b/firmware_p4/components/Applications/nfc/protocols/felica/felica.c index f321ccbb..b9e165f0 100644 --- a/firmware_p4/components/Applications/nfc/protocols/felica/felica.c +++ b/firmware_p4/components/Applications/nfc/protocols/felica/felica.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "felica.h" diff --git a/firmware_p4/components/Applications/nfc/protocols/felica/felica_emu.c b/firmware_p4/components/Applications/nfc/protocols/felica/felica_emu.c index c7fe723f..25fbebbd 100644 --- a/firmware_p4/components/Applications/nfc/protocols/felica/felica_emu.c +++ b/firmware_p4/components/Applications/nfc/protocols/felica/felica_emu.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "felica_emu.h" diff --git a/firmware_p4/components/Applications/nfc/protocols/felica/include/felica.h b/firmware_p4/components/Applications/nfc/protocols/felica/include/felica.h index 3e05d288..dadee279 100644 --- a/firmware_p4/components/Applications/nfc/protocols/felica/include/felica.h +++ b/firmware_p4/components/Applications/nfc/protocols/felica/include/felica.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file felica.h * @brief FeliCa (NFC-F / ISO 18092) reader/writer for ST25R3916. diff --git a/firmware_p4/components/Applications/nfc/protocols/felica/include/felica_emu.h b/firmware_p4/components/Applications/nfc/protocols/felica/include/felica_emu.h index e4a830fd..30411be8 100644 --- a/firmware_p4/components/Applications/nfc/protocols/felica/include/felica_emu.h +++ b/firmware_p4/components/Applications/nfc/protocols/felica/include/felica_emu.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file felica_emu.h * @brief FeliCa (NFC-F) tag emulation for ST25R3916. diff --git a/firmware_p4/components/Applications/nfc/protocols/iso14443a/include/iso14443a.h b/firmware_p4/components/Applications/nfc/protocols/iso14443a/include/iso14443a.h index 89a06c97..611f68a0 100644 --- a/firmware_p4/components/Applications/nfc/protocols/iso14443a/include/iso14443a.h +++ b/firmware_p4/components/Applications/nfc/protocols/iso14443a/include/iso14443a.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file iso14443a.h * @brief ISO14443A types and CRC_A. diff --git a/firmware_p4/components/Applications/nfc/protocols/iso14443a/include/iso_dep.h b/firmware_p4/components/Applications/nfc/protocols/iso14443a/include/iso_dep.h index 54f2f014..676ce73b 100644 --- a/firmware_p4/components/Applications/nfc/protocols/iso14443a/include/iso_dep.h +++ b/firmware_p4/components/Applications/nfc/protocols/iso14443a/include/iso_dep.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file iso_dep.h * @brief ISO-DEP (ISO14443-4) RATS, I-Block, chaining (Phase 6). diff --git a/firmware_p4/components/Applications/nfc/protocols/iso14443a/include/ndef.h b/firmware_p4/components/Applications/nfc/protocols/iso14443a/include/ndef.h index 9385089f..97fd4d49 100644 --- a/firmware_p4/components/Applications/nfc/protocols/iso14443a/include/ndef.h +++ b/firmware_p4/components/Applications/nfc/protocols/iso14443a/include/ndef.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file ndef.h * @brief NDEF parser/builder helpers. diff --git a/firmware_p4/components/Applications/nfc/protocols/iso14443a/include/nfc_poller.h b/firmware_p4/components/Applications/nfc/protocols/iso14443a/include/nfc_poller.h index a3462fd3..1264a5a5 100644 --- a/firmware_p4/components/Applications/nfc/protocols/iso14443a/include/nfc_poller.h +++ b/firmware_p4/components/Applications/nfc/protocols/iso14443a/include/nfc_poller.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file nfc_poller.h * @brief NFC Poller field control + transceive engine. diff --git a/firmware_p4/components/Applications/nfc/protocols/iso14443a/include/poller.h b/firmware_p4/components/Applications/nfc/protocols/iso14443a/include/poller.h index 874da560..b183f4d2 100644 --- a/firmware_p4/components/Applications/nfc/protocols/iso14443a/include/poller.h +++ b/firmware_p4/components/Applications/nfc/protocols/iso14443a/include/poller.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file poller.h * @brief ISO14443A Poller REQA/WUPA, anti-collision, SELECT. diff --git a/firmware_p4/components/Applications/nfc/protocols/iso14443a/include/t4t.h b/firmware_p4/components/Applications/nfc/protocols/iso14443a/include/t4t.h index 25ade13b..836bbdd0 100644 --- a/firmware_p4/components/Applications/nfc/protocols/iso14443a/include/t4t.h +++ b/firmware_p4/components/Applications/nfc/protocols/iso14443a/include/t4t.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file t4t.h * @brief ISO14443-4 / Type 4 Tag (T4T) NDEF reader helpers. diff --git a/firmware_p4/components/Applications/nfc/protocols/iso14443a/include/t4t_emu.h b/firmware_p4/components/Applications/nfc/protocols/iso14443a/include/t4t_emu.h index 336ccf63..5c62e44f 100644 --- a/firmware_p4/components/Applications/nfc/protocols/iso14443a/include/t4t_emu.h +++ b/firmware_p4/components/Applications/nfc/protocols/iso14443a/include/t4t_emu.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file t4t_emu.h * @brief ISO14443-4 / T4T emulation (ISO-DEP target). diff --git a/firmware_p4/components/Applications/nfc/protocols/iso14443a/iso14443a.c b/firmware_p4/components/Applications/nfc/protocols/iso14443a/iso14443a.c index a800b46a..ebde76e2 100644 --- a/firmware_p4/components/Applications/nfc/protocols/iso14443a/iso14443a.c +++ b/firmware_p4/components/Applications/nfc/protocols/iso14443a/iso14443a.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file iso14443a.c * @brief ISO14443A CRC_A calculation. diff --git a/firmware_p4/components/Applications/nfc/protocols/iso14443a/iso_dep.c b/firmware_p4/components/Applications/nfc/protocols/iso14443a/iso_dep.c index 7cc38b46..1cd6b927 100644 --- a/firmware_p4/components/Applications/nfc/protocols/iso14443a/iso_dep.c +++ b/firmware_p4/components/Applications/nfc/protocols/iso14443a/iso_dep.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file iso_dep.c * @brief ISO-DEP - basic RATS + I-Block exchange with chaining/WTX (best effort). diff --git a/firmware_p4/components/Applications/nfc/protocols/iso14443a/ndef.c b/firmware_p4/components/Applications/nfc/protocols/iso14443a/ndef.c index a7caa6ab..671792d1 100644 --- a/firmware_p4/components/Applications/nfc/protocols/iso14443a/ndef.c +++ b/firmware_p4/components/Applications/nfc/protocols/iso14443a/ndef.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file ndef.c * @brief NDEF record parser, builder, and TLV helpers. diff --git a/firmware_p4/components/Applications/nfc/protocols/iso14443a/nfc_poller.c b/firmware_p4/components/Applications/nfc/protocols/iso14443a/nfc_poller.c index b056a4ca..6135da14 100644 --- a/firmware_p4/components/Applications/nfc/protocols/iso14443a/nfc_poller.c +++ b/firmware_p4/components/Applications/nfc/protocols/iso14443a/nfc_poller.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file nfc_poller.c * @brief NFC poller transceive engine. diff --git a/firmware_p4/components/Applications/nfc/protocols/iso14443a/poller.c b/firmware_p4/components/Applications/nfc/protocols/iso14443a/poller.c index 2a7e037b..5c6f486c 100644 --- a/firmware_p4/components/Applications/nfc/protocols/iso14443a/poller.c +++ b/firmware_p4/components/Applications/nfc/protocols/iso14443a/poller.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file poller.c * @brief ISO14443A poller helpers. diff --git a/firmware_p4/components/Applications/nfc/protocols/iso14443a/t4t.c b/firmware_p4/components/Applications/nfc/protocols/iso14443a/t4t.c index c12781b7..794d1531 100644 --- a/firmware_p4/components/Applications/nfc/protocols/iso14443a/t4t.c +++ b/firmware_p4/components/Applications/nfc/protocols/iso14443a/t4t.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file t4t.c * @brief ISO7816-4 Type 4 Tag (T4T) NDEF read/write over ISO-DEP. diff --git a/firmware_p4/components/Applications/nfc/protocols/iso14443a/t4t_emu.c b/firmware_p4/components/Applications/nfc/protocols/iso14443a/t4t_emu.c index d98ddbde..cfc36152 100644 --- a/firmware_p4/components/Applications/nfc/protocols/iso14443a/t4t_emu.c +++ b/firmware_p4/components/Applications/nfc/protocols/iso14443a/t4t_emu.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file t4t_emu.c * @brief ISO14443A Type 4 Tag emulation over ST25R3916 passive target mode. diff --git a/firmware_p4/components/Applications/nfc/protocols/iso14443b/include/iso14443b.h b/firmware_p4/components/Applications/nfc/protocols/iso14443b/include/iso14443b.h index b04d729b..75b76138 100644 --- a/firmware_p4/components/Applications/nfc/protocols/iso14443b/include/iso14443b.h +++ b/firmware_p4/components/Applications/nfc/protocols/iso14443b/include/iso14443b.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file iso14443b.h * @brief ISO 14443B (NFC-B) poller basics for ST25R3916. diff --git a/firmware_p4/components/Applications/nfc/protocols/iso14443b/include/iso14443b_emu.h b/firmware_p4/components/Applications/nfc/protocols/iso14443b/include/iso14443b_emu.h index 3ce12b34..def6846e 100644 --- a/firmware_p4/components/Applications/nfc/protocols/iso14443b/include/iso14443b_emu.h +++ b/firmware_p4/components/Applications/nfc/protocols/iso14443b/include/iso14443b_emu.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file iso14443b_emu.h * @brief ISO14443B (NFC-B) target emulation with basic ISO-DEP/T4T APDUs. diff --git a/firmware_p4/components/Applications/nfc/protocols/iso14443b/iso14443b.c b/firmware_p4/components/Applications/nfc/protocols/iso14443b/iso14443b.c index 54c8657b..19b40050 100644 --- a/firmware_p4/components/Applications/nfc/protocols/iso14443b/iso14443b.c +++ b/firmware_p4/components/Applications/nfc/protocols/iso14443b/iso14443b.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file iso14443b.c * @brief ISO 14443-B poller: REQB/ATTRIB, T=CL transceive, and T4T-B NDEF read. diff --git a/firmware_p4/components/Applications/nfc/protocols/iso14443b/iso14443b_emu.c b/firmware_p4/components/Applications/nfc/protocols/iso14443b/iso14443b_emu.c index 18a730cd..0c8fcb4e 100644 --- a/firmware_p4/components/Applications/nfc/protocols/iso14443b/iso14443b_emu.c +++ b/firmware_p4/components/Applications/nfc/protocols/iso14443b/iso14443b_emu.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file iso14443b_emu.c * @brief ISO 14443-B passive target emulator: T4T-B NDEF and DESFire delegation. diff --git a/firmware_p4/components/Applications/nfc/protocols/iso15693/include/iso15693.h b/firmware_p4/components/Applications/nfc/protocols/iso15693/include/iso15693.h index 351f9354..ccf1112b 100644 --- a/firmware_p4/components/Applications/nfc/protocols/iso15693/include/iso15693.h +++ b/firmware_p4/components/Applications/nfc/protocols/iso15693/include/iso15693.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file iso15693.h * @brief ISO 15693 (NFC-V) reader/writer for ST25R3916. diff --git a/firmware_p4/components/Applications/nfc/protocols/iso15693/include/iso15693_emu.h b/firmware_p4/components/Applications/nfc/protocols/iso15693/include/iso15693_emu.h index a0e17669..651a4cc6 100644 --- a/firmware_p4/components/Applications/nfc/protocols/iso15693/include/iso15693_emu.h +++ b/firmware_p4/components/Applications/nfc/protocols/iso15693/include/iso15693_emu.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file iso15693_emu.h * @brief ISO 15693 (NFC-V) tag emulation for ST25R3916. diff --git a/firmware_p4/components/Applications/nfc/protocols/iso15693/iso15693.c b/firmware_p4/components/Applications/nfc/protocols/iso15693/iso15693.c index acc42446..7f1dd08e 100644 --- a/firmware_p4/components/Applications/nfc/protocols/iso15693/iso15693.c +++ b/firmware_p4/components/Applications/nfc/protocols/iso15693/iso15693.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file iso15693.c * @brief ISO 15693 (NFC-V) poller implementation. diff --git a/firmware_p4/components/Applications/nfc/protocols/iso15693/iso15693_emu.c b/firmware_p4/components/Applications/nfc/protocols/iso15693/iso15693_emu.c index 953400f5..073fff9a 100644 --- a/firmware_p4/components/Applications/nfc/protocols/iso15693/iso15693_emu.c +++ b/firmware_p4/components/Applications/nfc/protocols/iso15693/iso15693_emu.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file iso15693_emu.c * @brief ISO 15693 (NFC-V) tag emulation over ST25R3916 passive target mode. diff --git a/firmware_p4/components/Applications/nfc/protocols/llcp/include/llcp.h b/firmware_p4/components/Applications/nfc/protocols/llcp/include/llcp.h index b3f5f844..32769b70 100644 --- a/firmware_p4/components/Applications/nfc/protocols/llcp/include/llcp.h +++ b/firmware_p4/components/Applications/nfc/protocols/llcp/include/llcp.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file llcp.h * @brief LLCP (Logical Link Control Protocol) over NFC-DEP. diff --git a/firmware_p4/components/Applications/nfc/protocols/llcp/include/snep.h b/firmware_p4/components/Applications/nfc/protocols/llcp/include/snep.h index f989d2ba..d40a988b 100644 --- a/firmware_p4/components/Applications/nfc/protocols/llcp/include/snep.h +++ b/firmware_p4/components/Applications/nfc/protocols/llcp/include/snep.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file snep.h * @brief SNEP (Simple NDEF Exchange Protocol) client helpers. diff --git a/firmware_p4/components/Applications/nfc/protocols/llcp/llcp.c b/firmware_p4/components/Applications/nfc/protocols/llcp/llcp.c index a873be3d..b103190a 100644 --- a/firmware_p4/components/Applications/nfc/protocols/llcp/llcp.c +++ b/firmware_p4/components/Applications/nfc/protocols/llcp/llcp.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file llcp.c * @brief NFC-DEP / LLCP initiator: ATR exchange, DEP transceive, and PDU builders. diff --git a/firmware_p4/components/Applications/nfc/protocols/llcp/snep.c b/firmware_p4/components/Applications/nfc/protocols/llcp/snep.c index 42afd83b..5d836a25 100644 --- a/firmware_p4/components/Applications/nfc/protocols/llcp/snep.c +++ b/firmware_p4/components/Applications/nfc/protocols/llcp/snep.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file snep.c * @brief SNEP client: PUT and GET over LLCP/I-PDU. diff --git a/firmware_p4/components/Applications/nfc/protocols/mifare/crypto1.c b/firmware_p4/components/Applications/nfc/protocols/mifare/crypto1.c index 52ec39af..2abc23e5 100644 --- a/firmware_p4/components/Applications/nfc/protocols/mifare/crypto1.c +++ b/firmware_p4/components/Applications/nfc/protocols/mifare/crypto1.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "crypto1.h" diff --git a/firmware_p4/components/Applications/nfc/protocols/mifare/include/crypto1.h b/firmware_p4/components/Applications/nfc/protocols/mifare/include/crypto1.h index ee445a61..cf0dde65 100644 --- a/firmware_p4/components/Applications/nfc/protocols/mifare/include/crypto1.h +++ b/firmware_p4/components/Applications/nfc/protocols/mifare/include/crypto1.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file crypto1.h * @brief Crypto1 cipher for MIFARE Classic. diff --git a/firmware_p4/components/Applications/nfc/protocols/mifare/include/mf_classic.h b/firmware_p4/components/Applications/nfc/protocols/mifare/include/mf_classic.h index a6bb4b7a..7c9ca499 100644 --- a/firmware_p4/components/Applications/nfc/protocols/mifare/include/mf_classic.h +++ b/firmware_p4/components/Applications/nfc/protocols/mifare/include/mf_classic.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file mf_classic.h * @brief MIFARE Classic auth, read, write sectors. diff --git a/firmware_p4/components/Applications/nfc/protocols/mifare/include/mf_classic_emu.h b/firmware_p4/components/Applications/nfc/protocols/mifare/include/mf_classic_emu.h index 0c8b1c4a..373e9ab8 100644 --- a/firmware_p4/components/Applications/nfc/protocols/mifare/include/mf_classic_emu.h +++ b/firmware_p4/components/Applications/nfc/protocols/mifare/include/mf_classic_emu.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file mf_classic_emu.h * @brief MIFARE Classic card emulation. diff --git a/firmware_p4/components/Applications/nfc/protocols/mifare/include/mf_classic_writer.h b/firmware_p4/components/Applications/nfc/protocols/mifare/include/mf_classic_writer.h index e0a41b6c..f011f6ea 100644 --- a/firmware_p4/components/Applications/nfc/protocols/mifare/include/mf_classic_writer.h +++ b/firmware_p4/components/Applications/nfc/protocols/mifare/include/mf_classic_writer.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file mf_classic_writer.h * @brief MIFARE Classic block write with Crypto1 authentication. diff --git a/firmware_p4/components/Applications/nfc/protocols/mifare/include/mf_desfire.h b/firmware_p4/components/Applications/nfc/protocols/mifare/include/mf_desfire.h index bf1c3409..94f535c2 100644 --- a/firmware_p4/components/Applications/nfc/protocols/mifare/include/mf_desfire.h +++ b/firmware_p4/components/Applications/nfc/protocols/mifare/include/mf_desfire.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file mf_desfire.h * @brief MIFARE DESFire native command interface. diff --git a/firmware_p4/components/Applications/nfc/protocols/mifare/include/mf_desfire_emu.h b/firmware_p4/components/Applications/nfc/protocols/mifare/include/mf_desfire_emu.h index 278f62d1..a99453d4 100644 --- a/firmware_p4/components/Applications/nfc/protocols/mifare/include/mf_desfire_emu.h +++ b/firmware_p4/components/Applications/nfc/protocols/mifare/include/mf_desfire_emu.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file mf_desfire_emu.h * @brief Minimal MIFARE DESFire (native) APDU emulation helpers. diff --git a/firmware_p4/components/Applications/nfc/protocols/mifare/include/mf_key_cache.h b/firmware_p4/components/Applications/nfc/protocols/mifare/include/mf_key_cache.h index cfd3aea9..ec803ae0 100644 --- a/firmware_p4/components/Applications/nfc/protocols/mifare/include/mf_key_cache.h +++ b/firmware_p4/components/Applications/nfc/protocols/mifare/include/mf_key_cache.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file mf_key_cache.h * @brief Per-card MIFARE Classic key cache with NVS persistence. diff --git a/firmware_p4/components/Applications/nfc/protocols/mifare/include/mf_key_dict.h b/firmware_p4/components/Applications/nfc/protocols/mifare/include/mf_key_dict.h index 2a45e2cd..41e66495 100644 --- a/firmware_p4/components/Applications/nfc/protocols/mifare/include/mf_key_dict.h +++ b/firmware_p4/components/Applications/nfc/protocols/mifare/include/mf_key_dict.h @@ -1,19 +1,25 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file mf_key_dict.h - * @brief MIFARE Classic key dictionary (built-in + user-added keys). + * @brief MIFARE Classic key dictionary (loaded from .dic files on SD/flash). + * + * Default and family dictionaries ship on the firmware flash partition and + * are copied to the SD card on first boot. The user can edit them or add + * extra dictionaries. Keys discovered at runtime are appended to + * `mf_classic_user.dic` on the SD card. */ #ifndef MF_KEY_DICT_H #define MF_KEY_DICT_H @@ -27,19 +33,21 @@ extern "C" { #endif -/** @brief Maximum user-added keys stored in NVS (on top of built-in). */ -#define MF_KEY_DICT_MAX_EXTRA 128 - -/** @brief Total built-in keys count (defined in .c). */ -extern const int MF_KEY_DICT_BUILTIN_COUNT; +/** @brief Maximum number of keys held in the in-memory dictionary. */ +#define MF_KEY_DICT_MAX_KEYS 256 /** - * @brief Initialize the key dictionary (load user keys from NVS). + * @brief Initialize the key dictionary (load default + user .dic files). + * + * Reads `mf_classic_default.dic` and `mf_classic_user.dic` from the NFC + * dictionary path on the SD card, falling back to the flash partition. + * Also migrates the legacy NVS namespace ("nfc_dict") into the user file + * the first time it runs after upgrade. */ void mf_key_dict_init(void); /** - * @brief Get total number of keys (built-in + user-added). + * @brief Get total number of keys currently loaded. * * @return Total key count. */ @@ -57,17 +65,20 @@ void mf_key_dict_get(int idx, uint8_t key_out[6]); * @brief Check if a key exists in the dictionary. * * @param key 6-byte key to check. - * @return true if the key is in the dictionary. + * @return true if the key is already in the dictionary. */ bool mf_key_dict_contains(const uint8_t key[6]); /** - * @brief Add a user key to the dictionary. + * @brief Add a key to the dictionary and persist it to mf_classic_user.dic. + * + * If the key is already present (built-in or user), this is a no-op and + * returns HB_NFC_OK. * * @param key 6-byte key to add. * @return - * - HB_NFC_OK on success - * - Error code if dictionary is full or key already exists + * - HB_NFC_OK on success or duplicate + * - Error code if dictionary is full or persistence failed */ hb_nfc_err_t mf_key_dict_add(const uint8_t key[6]); diff --git a/firmware_p4/components/Applications/nfc/protocols/mifare/include/mf_known_cards.h b/firmware_p4/components/Applications/nfc/protocols/mifare/include/mf_known_cards.h index 9b48c067..52ec0adc 100644 --- a/firmware_p4/components/Applications/nfc/protocols/mifare/include/mf_known_cards.h +++ b/firmware_p4/components/Applications/nfc/protocols/mifare/include/mf_known_cards.h @@ -1,23 +1,26 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file mf_known_cards.h - * @brief Known MIFARE Classic card type database. + * @brief Known MIFARE Classic card type database (name + identification only). * - * Matches a card by SAK + ATQA (and optionally UID prefix). - * When a match is found, provides a human-readable name, hint string, - * and priority key list to try before the full dictionary. + * Matches a card by SAK + ATQA (and optionally UID prefix) and returns a + * human-readable name plus a hint string. Key dictionaries are no longer + * tied to card profiles — the brute-force loop in the reader iterates + * @ref mf_key_dict, which already aggregates every mf_classic_*.dic file + * the user dropped in /sdcard/nfc/assets/dict/. */ #ifndef MF_KNOWN_CARDS_H #define MF_KNOWN_CARDS_H @@ -38,9 +41,7 @@ typedef struct { uint8_t sak; uint8_t atqa[2]; uint8_t uid_prefix[4]; - uint8_t uid_prefix_len; /**< @brief 0 = do not check UID prefix. */ - const uint8_t (*hint_keys)[6]; /**< @brief Priority keys, may be NULL. */ - int hint_key_count; + uint8_t uid_prefix_len; /**< @brief 0 = do not check UID prefix. */ } mf_known_card_t; /** diff --git a/firmware_p4/components/Applications/nfc/protocols/mifare/include/mf_nested.h b/firmware_p4/components/Applications/nfc/protocols/mifare/include/mf_nested.h index 35e98a68..6ad94b9d 100644 --- a/firmware_p4/components/Applications/nfc/protocols/mifare/include/mf_nested.h +++ b/firmware_p4/components/Applications/nfc/protocols/mifare/include/mf_nested.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file mf_nested.h * @brief Nested authentication attack for MIFARE Classic. diff --git a/firmware_p4/components/Applications/nfc/protocols/mifare/include/mf_plus.h b/firmware_p4/components/Applications/nfc/protocols/mifare/include/mf_plus.h index 2d3fe60a..5b00ddc4 100644 --- a/firmware_p4/components/Applications/nfc/protocols/mifare/include/mf_plus.h +++ b/firmware_p4/components/Applications/nfc/protocols/mifare/include/mf_plus.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file mf_plus.h * @brief MIFARE Plus SL3 auth and crypto helpers. diff --git a/firmware_p4/components/Applications/nfc/protocols/mifare/include/mf_ultralight.h b/firmware_p4/components/Applications/nfc/protocols/mifare/include/mf_ultralight.h index 8b831b4e..e14bbdeb 100644 --- a/firmware_p4/components/Applications/nfc/protocols/mifare/include/mf_ultralight.h +++ b/firmware_p4/components/Applications/nfc/protocols/mifare/include/mf_ultralight.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file mf_ultralight.h * @brief MIFARE Ultralight / NTAG READ, WRITE, PWD_AUTH, GET_VERSION. diff --git a/firmware_p4/components/Applications/nfc/protocols/mifare/include/mfkey.h b/firmware_p4/components/Applications/nfc/protocols/mifare/include/mfkey.h index fc14254e..31152724 100644 --- a/firmware_p4/components/Applications/nfc/protocols/mifare/include/mfkey.h +++ b/firmware_p4/components/Applications/nfc/protocols/mifare/include/mfkey.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file mfkey.h * @brief MFKey key recovery attacks for MIFARE Classic. diff --git a/firmware_p4/components/Applications/nfc/protocols/mifare/include/nfc_dict_loader.h b/firmware_p4/components/Applications/nfc/protocols/mifare/include/nfc_dict_loader.h new file mode 100644 index 00000000..363e6df3 --- /dev/null +++ b/firmware_p4/components/Applications/nfc/protocols/mifare/include/nfc_dict_loader.h @@ -0,0 +1,119 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . +/** + * @file nfc_dict_loader.h + * @brief Parser for .dic key dictionary files (hex per line, '#' comments). + * + * The .dic format is plain ASCII text. Each non-empty, non-comment line is + * a hex string representing a single key. Whitespace is ignored. Lines that + * do not match the requested key size are skipped (with a debug log). + */ +#ifndef NFC_DICT_LOADER_H +#define NFC_DICT_LOADER_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include + +#include "esp_err.h" + +/** + * @brief Parameters for nfc_dict_load_file(). + */ +typedef struct { + const char *sd_path; /**< @brief SD path. May be NULL to skip SD lookup. */ + const char *flash_path; /**< @brief Flash partition fallback path. May be NULL. */ + size_t key_size; /**< @brief Bytes per key (e.g. 6 or 16). */ + size_t max_keys; /**< @brief Maximum keys to read. */ +} nfc_dict_load_params_t; + +/** + * @brief Parameters for nfc_dict_load_dir(). + */ +typedef struct { + const char *dir; /**< @brief Directory to scan. */ + const char *prefix; /**< @brief Filename prefix filter, NULL for any. */ + size_t key_size; /**< @brief Bytes per key. */ + size_t max_keys; /**< @brief Maximum keys to read across all files. */ +} nfc_dict_scan_params_t; + +/** + * @brief Load a .dic file into a contiguous key buffer. + * + * Tries @c params->sd_path first; if missing/empty, falls back to + * @c params->flash_path. + * + * @param params Source paths and sizing. + * @param[out] out_keys Buffer of capacity (key_size * max_keys) bytes. + * @param[out] out_count Number of keys actually loaded. + * @return + * - ESP_OK if at least one key was read + * - ESP_ERR_NOT_FOUND if both paths are missing/empty + * - ESP_ERR_INVALID_ARG on bad arguments + */ +esp_err_t +nfc_dict_load_file(const nfc_dict_load_params_t *params, uint8_t *out_keys, size_t *out_count); + +/** + * @brief Scan a directory and load every .dic file matching the prefix. + * + * Files are read in directory-iteration order. Duplicates across files are + * skipped. Returns ESP_OK even if no keys were found, as long as the + * directory could be opened. + * + * @param params Scan parameters (dir, prefix, key_size, max_keys). + * @param[out] out_keys Buffer of capacity (key_size * max_keys) bytes. + * @param[out] out_count Number of unique keys loaded across all files. + * @return + * - ESP_OK on success + * - ESP_ERR_NOT_FOUND if the directory cannot be opened + * - ESP_ERR_INVALID_ARG on bad arguments + */ +esp_err_t +nfc_dict_load_dir(const nfc_dict_scan_params_t *params, uint8_t *out_keys, size_t *out_count); + +/** + * @brief Check if @p key already exists in the contiguous buffer @p keys. + * + * @param keys Buffer of (count * key_size) bytes. + * @param count Number of keys in the buffer. + * @param key_size Bytes per key. + * @param key Candidate key. + * @return true if a byte-for-byte match exists. + */ +bool nfc_dict_contains(const uint8_t *keys, size_t count, size_t key_size, const uint8_t *key); + +/** + * @brief Append a key to a .dic file on the SD card (creating it if needed). + * + * Writes one uppercase hex line followed by '\n'. Does not check for + * duplicates — caller is expected to use @ref nfc_dict_contains first. + * + * @param sd_path Path on the SD card. + * @param key Key bytes. + * @param key_size Bytes per key. + * @return ESP_OK on success, ESP_FAIL on I/O error. + */ +esp_err_t nfc_dict_append_key(const char *sd_path, const uint8_t *key, size_t key_size); + +#ifdef __cplusplus +} +#endif + +#endif // NFC_DICT_LOADER_H diff --git a/firmware_p4/components/Applications/nfc/protocols/mifare/mf_classic.c b/firmware_p4/components/Applications/nfc/protocols/mifare/mf_classic.c index 7f9d7e7b..aa74df8d 100644 --- a/firmware_p4/components/Applications/nfc/protocols/mifare/mf_classic.c +++ b/firmware_p4/components/Applications/nfc/protocols/mifare/mf_classic.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file mf_classic.c * @brief MIFARE Classic authentication, read, and write operations. diff --git a/firmware_p4/components/Applications/nfc/protocols/mifare/mf_classic_emu.c b/firmware_p4/components/Applications/nfc/protocols/mifare/mf_classic_emu.c index 2bf518ea..0d438f11 100644 --- a/firmware_p4/components/Applications/nfc/protocols/mifare/mf_classic_emu.c +++ b/firmware_p4/components/Applications/nfc/protocols/mifare/mf_classic_emu.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "mf_classic_emu.h" diff --git a/firmware_p4/components/Applications/nfc/protocols/mifare/mf_classic_writer.c b/firmware_p4/components/Applications/nfc/protocols/mifare/mf_classic_writer.c index 40af7bf2..d6dbd206 100644 --- a/firmware_p4/components/Applications/nfc/protocols/mifare/mf_classic_writer.c +++ b/firmware_p4/components/Applications/nfc/protocols/mifare/mf_classic_writer.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file mf_classic_writer.c * @brief MIFARE Classic write and access-bit helpers. diff --git a/firmware_p4/components/Applications/nfc/protocols/mifare/mf_desfire.c b/firmware_p4/components/Applications/nfc/protocols/mifare/mf_desfire.c index eb5fd455..17e33ef9 100644 --- a/firmware_p4/components/Applications/nfc/protocols/mifare/mf_desfire.c +++ b/firmware_p4/components/Applications/nfc/protocols/mifare/mf_desfire.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "mf_desfire.h" #include diff --git a/firmware_p4/components/Applications/nfc/protocols/mifare/mf_desfire_emu.c b/firmware_p4/components/Applications/nfc/protocols/mifare/mf_desfire_emu.c index f66fface..3d7c7a4c 100644 --- a/firmware_p4/components/Applications/nfc/protocols/mifare/mf_desfire_emu.c +++ b/firmware_p4/components/Applications/nfc/protocols/mifare/mf_desfire_emu.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "mf_desfire_emu.h" diff --git a/firmware_p4/components/Applications/nfc/protocols/mifare/mf_key_cache.c b/firmware_p4/components/Applications/nfc/protocols/mifare/mf_key_cache.c index e8467671..5ac526d2 100644 --- a/firmware_p4/components/Applications/nfc/protocols/mifare/mf_key_cache.c +++ b/firmware_p4/components/Applications/nfc/protocols/mifare/mf_key_cache.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "mf_key_cache.h" diff --git a/firmware_p4/components/Applications/nfc/protocols/mifare/mf_key_dict.c b/firmware_p4/components/Applications/nfc/protocols/mifare/mf_key_dict.c index bf87e2f8..acb886c4 100644 --- a/firmware_p4/components/Applications/nfc/protocols/mifare/mf_key_dict.c +++ b/firmware_p4/components/Applications/nfc/protocols/mifare/mf_key_dict.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "mf_key_dict.h" @@ -18,183 +19,114 @@ #include "esp_log.h" #include "nvs.h" +#include "nvs_flash.h" #include "highboy_nfc_error.h" +#include "nfc_dict_loader.h" +#include "tos_storage_paths.h" static const char *TAG = "NFC_MF_KEY_DICT"; -#define MF_KEY_SIZE 6 -#define NVS_KEY_NAME_SIZE 16 - -static const uint8_t s_builtin_keys[][MF_KEY_SIZE] = { - {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - {0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5}, {0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5}, - {0xD3, 0xF7, 0xD3, 0xF7, 0xD3, 0xF7}, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - {0xA0, 0xB0, 0xC0, 0xD0, 0xE0, 0xF0}, {0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF}, - {0x4D, 0x3A, 0x99, 0xC3, 0x51, 0xDD}, {0x1A, 0x98, 0x2C, 0x7E, 0x45, 0x9A}, - {0x71, 0x4C, 0x5C, 0x88, 0x6E, 0x97}, {0x58, 0x7E, 0xE5, 0xF9, 0x35, 0x0F}, - {0xA0, 0x47, 0x8C, 0xC3, 0x90, 0x91}, {0x53, 0x3C, 0xB6, 0xC7, 0x23, 0xF6}, - {0x8F, 0xD0, 0xA4, 0xF2, 0x56, 0xE9}, {0x00, 0x00, 0x00, 0x00, 0x00, 0x01}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x02}, {0x00, 0x00, 0x00, 0x00, 0x00, 0x03}, - {0xC3, 0x4B, 0xF0, 0x36, 0x40, 0x15}, {0x9A, 0xB3, 0x45, 0x67, 0xAB, 0x34}, - {0x23, 0x40, 0x4E, 0x30, 0xD3, 0x4A}, {0x19, 0x74, 0x97, 0xC1, 0xC9, 0x31}, - {0xAC, 0xDD, 0xEB, 0xC3, 0x9C, 0x03}, {0xEA, 0x64, 0x67, 0x23, 0xA9, 0x00}, - {0x21, 0x4F, 0x17, 0x39, 0x5B, 0x10}, {0x11, 0x49, 0x7C, 0x33, 0xAF, 0xE2}, - {0x49, 0x46, 0x34, 0x34, 0x76, 0x41}, {0x31, 0x45, 0x56, 0x41, 0x4F, 0x3A}, - {0x1A, 0x2B, 0x3C, 0x4D, 0x5E, 0x6F}, {0xE9, 0x82, 0x4F, 0x4A, 0x2E, 0x4C}, - {0xD7, 0x93, 0xA7, 0x52, 0xA8, 0xB7}, {0x34, 0xEE, 0xF6, 0x14, 0xCE, 0x3A}, - {0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00}, {0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF}, - {0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC}, {0xAB, 0xCD, 0xEF, 0x12, 0x34, 0x56}, - {0xDE, 0xAD, 0xBE, 0xEF, 0xCA, 0xFE}, {0xFA, 0xCE, 0xB0, 0x07, 0x13, 0x37}, - {0x4A, 0x6F, 0x68, 0x6E, 0x57, 0x69}, {0x6B, 0x65, 0x79, 0x31, 0x32, 0x33}, - {0x87, 0x3E, 0x1A, 0xCF, 0x5A, 0xA3}, {0xF3, 0x21, 0x72, 0xE9, 0x89, 0x2E}, - {0x40, 0xA8, 0xE0, 0x00, 0x00, 0x00}, {0xBE, 0x6A, 0x60, 0x14, 0x96, 0x3B}, - {0xD2, 0xBA, 0x54, 0x79, 0xE1, 0x28}, {0x8E, 0x51, 0x7E, 0x70, 0xF7, 0x58}, - {0x61, 0xDA, 0x06, 0xA0, 0x55, 0xDE}, {0x37, 0x06, 0x58, 0x7C, 0xD9, 0x36}, - {0x29, 0xD2, 0x41, 0x42, 0xDA, 0x17}, {0x57, 0x27, 0x29, 0xB2, 0x7E, 0x67}, - {0x52, 0x27, 0x57, 0xC1, 0xB2, 0xA1}, {0x83, 0x4B, 0x03, 0x27, 0xB6, 0xAF}, - {0x28, 0x7E, 0xC5, 0x65, 0xFF, 0x5C}, {0x1C, 0x0E, 0xB4, 0xC7, 0x38, 0xA3}, - {0x4E, 0xE4, 0x82, 0xC5, 0xF3, 0xC5}, {0x12, 0x21, 0xB4, 0x32, 0x11, 0xD4}, - {0x96, 0x31, 0x43, 0x04, 0x5A, 0x8C}, {0x1B, 0x75, 0x5D, 0x87, 0x61, 0xA0}, - {0x3B, 0x1C, 0x3B, 0x55, 0x34, 0x88}, {0x88, 0x44, 0x40, 0x13, 0x9C, 0x22}, - {0xA3, 0xDA, 0xCC, 0x68, 0x98, 0xA3}, {0x8D, 0xD4, 0x0D, 0x2A, 0x91, 0x57}, - {0x27, 0x05, 0x67, 0x3B, 0x77, 0x84}, {0x60, 0x90, 0x6C, 0x78, 0x68, 0x73}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x05}, {0x00, 0x00, 0x00, 0x00, 0x00, 0x07}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x0A}, {0x00, 0x00, 0x00, 0x00, 0x00, 0x0F}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x10}, {0x00, 0x00, 0x00, 0x00, 0x00, 0xFF}, - {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE}, {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFD}, - {0xC3, 0x7A, 0xC4, 0x3D, 0xA1, 0x00}, {0x9C, 0x46, 0x14, 0x0A, 0xA6, 0xB2}, - {0x48, 0x62, 0xCF, 0x60, 0xED, 0x62}, {0x08, 0xB9, 0xE7, 0xB2, 0xA6, 0x6B}, - {0xF1, 0x22, 0xD7, 0x3B, 0x00, 0x48}, {0x14, 0x17, 0x37, 0x23, 0x02, 0x4A}, - {0x0C, 0xF1, 0x2A, 0x80, 0xF5, 0x4A}, {0xD3, 0xC4, 0xFE, 0x46, 0xA0, 0x3B}, - {0x36, 0x25, 0x95, 0x36, 0x98, 0xDA}, {0xB8, 0xD9, 0xA6, 0x0E, 0x27, 0x4A}, - {0x7E, 0x85, 0x45, 0xCD, 0x23, 0xE4}, -}; - -const int MF_KEY_DICT_BUILTIN_COUNT = (int)(sizeof(s_builtin_keys) / sizeof(s_builtin_keys[0])); - -static uint8_t s_extra_keys[MF_KEY_DICT_MAX_EXTRA][MF_KEY_SIZE]; -static int s_extra_count = 0; - -#define NVS_NS "nfc_dict" -#define NVS_KEY_COUNT "extra_count" -#define NVS_KEY_PREFIX "k_" +#define MF_KEY_SIZE 6 -void mf_key_dict_init(void) { - s_extra_count = 0; +#define SD_USER_DIC TOS_PATH_NFC_DICT "/mf_classic_user.dic" + +#define LEGACY_NVS_NS "nfc_dict" +#define LEGACY_NVS_KEY_COUNT "extra_count" +#define LEGACY_NVS_KEY_PREFIX "k_" - nvs_handle_t handle; - esp_err_t err = nvs_open(NVS_NS, NVS_READONLY, &handle); - if (err != ESP_OK) { - ESP_LOGW(TAG, "NVS open failed (0x%x), starting with empty extra keys", err); +static uint8_t s_keys[MF_KEY_DICT_MAX_KEYS][MF_KEY_SIZE]; +static int s_count = 0; + +static void migrate_legacy_nvs(void) { + nvs_handle_t ro; + if (nvs_open(LEGACY_NVS_NS, NVS_READONLY, &ro) != ESP_OK) return; - } uint8_t count = 0; - err = nvs_get_u8(handle, NVS_KEY_COUNT, &count); - if (err != ESP_OK || count == 0) { - nvs_close(handle); + esp_err_t err = nvs_get_u8(ro, LEGACY_NVS_KEY_COUNT, &count); + nvs_close(ro); + if (err != ESP_OK || count == 0) return; - } - if (count > MF_KEY_DICT_MAX_EXTRA) { - count = MF_KEY_DICT_MAX_EXTRA; - } + nvs_handle_t rw; + if (nvs_open(LEGACY_NVS_NS, NVS_READWRITE, &rw) != ESP_OK) + return; + int migrated = 0; for (uint8_t i = 0; i < count; i++) { - char key_name[NVS_KEY_NAME_SIZE]; - snprintf(key_name, sizeof(key_name), NVS_KEY_PREFIX "%u", (unsigned)i); + char key_name[16]; + snprintf(key_name, sizeof(key_name), LEGACY_NVS_KEY_PREFIX "%u", (unsigned)i); + uint8_t key[MF_KEY_SIZE]; size_t len = MF_KEY_SIZE; - err = nvs_get_blob(handle, key_name, s_extra_keys[s_extra_count], &len); - if (err == ESP_OK && len == MF_KEY_SIZE) { - s_extra_count++; - } else { - ESP_LOGW(TAG, "Failed to load key %s (err 0x%x)", key_name, err); - } + if (nvs_get_blob(rw, key_name, key, &len) != ESP_OK || len != MF_KEY_SIZE) + continue; + + if (nfc_dict_append_key(SD_USER_DIC, key, MF_KEY_SIZE) == ESP_OK) + migrated++; } - nvs_close(handle); - ESP_LOGI(TAG, "Loaded %d extra keys from NVS", s_extra_count); + nvs_erase_all(rw); + nvs_commit(rw); + nvs_close(rw); + + ESP_LOGI(TAG, "Migrated %d legacy NVS keys into %s", migrated, SD_USER_DIC); } -int mf_key_dict_count(void) { - return MF_KEY_DICT_BUILTIN_COUNT + s_extra_count; +void mf_key_dict_init(void) { + s_count = 0; + memset(s_keys, 0, sizeof(s_keys)); + + migrate_legacy_nvs(); + + const nfc_dict_scan_params_t scan = { + .dir = TOS_PATH_NFC_DICT, + .prefix = "mf_classic_", + .key_size = MF_KEY_SIZE, + .max_keys = MF_KEY_DICT_MAX_KEYS, + }; + size_t loaded = 0; + nfc_dict_load_dir(&scan, (uint8_t *)s_keys, &loaded); + s_count = (int)loaded; + + if (s_count == 0) + ESP_LOGW(TAG, "No mf_classic_*.dic files found in %s", TOS_PATH_NFC_DICT); + else + ESP_LOGI(TAG, "Dictionary ready: %d keys", s_count); } -void mf_key_dict_get(int idx, uint8_t key_out[6]) { - if (idx < 0) { - return; - } +int mf_key_dict_count(void) { + return s_count; +} - if (idx < MF_KEY_DICT_BUILTIN_COUNT) { - memcpy(key_out, s_builtin_keys[idx], MF_KEY_SIZE); +void mf_key_dict_get(int idx, uint8_t key_out[MF_KEY_SIZE]) { + if (idx < 0 || idx >= s_count) return; - } - - int extra_idx = idx - MF_KEY_DICT_BUILTIN_COUNT; - if (extra_idx < s_extra_count) { - memcpy(key_out, s_extra_keys[extra_idx], MF_KEY_SIZE); - } + memcpy(key_out, s_keys[idx], MF_KEY_SIZE); } -bool mf_key_dict_contains(const uint8_t key[6]) { - for (int i = 0; i < MF_KEY_DICT_BUILTIN_COUNT; i++) { - if (memcmp(s_builtin_keys[i], key, MF_KEY_SIZE) == 0) { - return true; - } - } - - for (int i = 0; i < s_extra_count; i++) { - if (memcmp(s_extra_keys[i], key, MF_KEY_SIZE) == 0) { - return true; - } - } - - return false; +bool mf_key_dict_contains(const uint8_t key[MF_KEY_SIZE]) { + return nfc_dict_contains((const uint8_t *)s_keys, (size_t)s_count, MF_KEY_SIZE, key); } -hb_nfc_err_t mf_key_dict_add(const uint8_t key[6]) { - if (s_extra_count >= MF_KEY_DICT_MAX_EXTRA) { - ESP_LOGE(TAG, "Extra key dictionary is full (%d)", MF_KEY_DICT_MAX_EXTRA); - return HB_NFC_ERR_INTERNAL; - } - - if (mf_key_dict_contains(key)) { - ESP_LOGD(TAG, "Key already in dictionary, skipping"); +hb_nfc_err_t mf_key_dict_add(const uint8_t key[MF_KEY_SIZE]) { + if (mf_key_dict_contains(key)) return HB_NFC_OK; - } - - memcpy(s_extra_keys[s_extra_count], key, MF_KEY_SIZE); - s_extra_count++; - nvs_handle_t handle; - esp_err_t err = nvs_open(NVS_NS, NVS_READWRITE, &handle); - if (err != ESP_OK) { - ESP_LOGE(TAG, "NVS open for write failed (0x%x)", err); - s_extra_count--; + if (s_count >= MF_KEY_DICT_MAX_KEYS) { + ESP_LOGE(TAG, "Dictionary full (%d), cannot add key", MF_KEY_DICT_MAX_KEYS); return HB_NFC_ERR_INTERNAL; } - char key_name[16]; - snprintf(key_name, sizeof(key_name), NVS_KEY_PREFIX "%d", s_extra_count - 1); + memcpy(s_keys[s_count], key, MF_KEY_SIZE); + s_count++; - err = nvs_set_blob(handle, key_name, key, MF_KEY_SIZE); - if (err != ESP_OK) { - ESP_LOGE(TAG, "NVS set_blob failed (0x%x)", err); - s_extra_count--; - nvs_close(handle); + if (nfc_dict_append_key(SD_USER_DIC, key, MF_KEY_SIZE) != ESP_OK) { + ESP_LOGW(TAG, "Could not persist key to %s (in-memory only)", SD_USER_DIC); return HB_NFC_ERR_INTERNAL; } - err = nvs_set_u8(handle, NVS_KEY_COUNT, (uint8_t)s_extra_count); - if (err != ESP_OK) { - ESP_LOGE(TAG, "NVS set count failed (0x%x)", err); - } - - nvs_commit(handle); - nvs_close(handle); - - ESP_LOGI(TAG, "Added new key to dictionary (total extra: %d)", s_extra_count); + ESP_LOGI(TAG, "Persisted new key to %s (total %d)", SD_USER_DIC, s_count); return HB_NFC_OK; } diff --git a/firmware_p4/components/Applications/nfc/protocols/mifare/mf_known_cards.c b/firmware_p4/components/Applications/nfc/protocols/mifare/mf_known_cards.c index 03cbbc3f..d7c9e693 100644 --- a/firmware_p4/components/Applications/nfc/protocols/mifare/mf_known_cards.c +++ b/firmware_p4/components/Applications/nfc/protocols/mifare/mf_known_cards.c @@ -1,83 +1,23 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "mf_known_cards.h" #include #include -static const char *TAG = "NFC_MF_KNOW_CARDS"; - -static const uint8_t s_default_keys[][6] = { - {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - {0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5}, /* MAD / transport */ - {0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5}, - {0xD3, 0xF7, 0xD3, 0xF7, 0xD3, 0xF7}, /* NDEF */ -}; - -static const uint8_t s_infineon_keys[][6] = { - {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - {0x88, 0x44, 0x06, 0x30, 0x13, 0x15}, /* Infineon documented default */ - {0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5}, -}; - -static const uint8_t s_smartmx_keys[][6] = { - {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - {0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5}, - {0xD3, 0xF7, 0xD3, 0xF7, 0xD3, 0xF7}, - {0x4D, 0x3A, 0x99, 0xC3, 0x51, 0xDD}, -}; - -static const uint8_t s_transit_keys[][6] = { - {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - {0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5}, - {0xD3, 0xF7, 0xD3, 0xF7, 0xD3, 0xF7}, - {0x4D, 0x3A, 0x99, 0xC3, 0x51, 0xDD}, - {0x1A, 0x98, 0x2C, 0x7E, 0x45, 0x9A}, - {0x71, 0x4C, 0x5C, 0x88, 0x6E, 0x97}, - {0x58, 0x7E, 0xE5, 0xF9, 0x35, 0x0F}, - {0xA0, 0x47, 0x8C, 0xC3, 0x90, 0x91}, - {0x53, 0x3C, 0xB6, 0xC7, 0x23, 0xF6}, - {0x8F, 0xD0, 0xA4, 0xF2, 0x56, 0xE9}, - {0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF}, -}; - -static const uint8_t s_access_keys[][6] = { - {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - {0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5}, - {0xA0, 0xB0, 0xC0, 0xD0, 0xE0, 0xF0}, - {0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF}, - {0x4D, 0x3A, 0x99, 0xC3, 0x51, 0xDD}, - {0x1A, 0x98, 0x2C, 0x7E, 0x45, 0x9A}, - {0x71, 0x4C, 0x5C, 0x88, 0x6E, 0x97}, - {0x8F, 0xD0, 0xA4, 0xF2, 0x56, 0xE9}, -}; - -static const uint8_t s_clone_keys[][6] = { - {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - {0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5}, - {0xD3, 0xF7, 0xD3, 0xF7, 0xD3, 0xF7}, -}; - -#define NKEYS(arr) ((int)(sizeof(arr) / sizeof(arr[0]))) - static const mf_known_card_t s_db[] = { { .name = "NXP MIFARE Classic 1K", @@ -86,8 +26,6 @@ static const mf_known_card_t s_db[] = { .atqa = {0x00, 0x04}, .uid_prefix = {0x04}, .uid_prefix_len = 1, - .hint_keys = s_default_keys, - .hint_key_count = NKEYS(s_default_keys), }, { .name = "NXP MIFARE Classic 4K", @@ -96,94 +34,60 @@ static const mf_known_card_t s_db[] = { .atqa = {0x00, 0x02}, .uid_prefix = {0x04}, .uid_prefix_len = 1, - .hint_keys = s_default_keys, - .hint_key_count = NKEYS(s_default_keys), }, - { .name = "MIFARE Classic 1K Clone (Gen2/CUID)", .hint = "UID changeable, writable block 0", .sak = 0x08, .atqa = {0x00, 0x44}, - .uid_prefix_len = 0, - .hint_keys = s_clone_keys, - .hint_key_count = NKEYS(s_clone_keys), }, { .name = "MIFARE Classic 4K Clone", .hint = "UID changeable clone", .sak = 0x18, .atqa = {0x00, 0x42}, - .uid_prefix_len = 0, - .hint_keys = s_clone_keys, - .hint_key_count = NKEYS(s_clone_keys), }, { .name = "Infineon MIFARE Classic 1K", .hint = "SLE66R35, used in older access/transit systems", .sak = 0x88, .atqa = {0x00, 0x04}, - .uid_prefix_len = 0, - .hint_keys = s_infineon_keys, - .hint_key_count = NKEYS(s_infineon_keys), }, - { .name = "NXP SmartMX MIFARE Classic 1K", .hint = "P60/P40 combo chip, SAK=0x28", .sak = 0x28, .atqa = {0x00, 0x04}, - .uid_prefix_len = 0, - .hint_keys = s_smartmx_keys, - .hint_key_count = NKEYS(s_smartmx_keys), }, { .name = "NXP SmartMX MIFARE Classic 4K", .hint = "P60/P40 combo chip, SAK=0x38", .sak = 0x38, .atqa = {0x00, 0x02}, - .uid_prefix_len = 0, - .hint_keys = s_smartmx_keys, - .hint_key_count = NKEYS(s_smartmx_keys), }, - { .name = "Transit/Ticketing Card (1K)", .hint = "Common for metro/bus access systems", .sak = 0x08, .atqa = {0x00, 0x04}, - .uid_prefix_len = 0, - .hint_keys = s_transit_keys, - .hint_key_count = NKEYS(s_transit_keys), }, { .name = "Transit/Ticketing Card (4K)", .hint = "Large-memory transit card", .sak = 0x18, .atqa = {0x00, 0x02}, - .uid_prefix_len = 0, - .hint_keys = s_transit_keys, - .hint_key_count = NKEYS(s_transit_keys), }, - { .name = "Access Control Card (1K)", .hint = "Building/door access system", .sak = 0x08, .atqa = {0x08, 0x00}, - .uid_prefix_len = 0, - .hint_keys = s_access_keys, - .hint_key_count = NKEYS(s_access_keys), }, - { .name = "MIFARE Mini", .hint = "320 bytes / 5 sectors", .sak = 0x09, .atqa = {0x00, 0x04}, - .uid_prefix_len = 0, - .hint_keys = s_default_keys, - .hint_key_count = NKEYS(s_default_keys), }, }; @@ -202,15 +106,12 @@ mf_known_cards_match(uint8_t sak, const uint8_t atqa[2], const uint8_t *uid, uin continue; if (e->uid_prefix_len > 0) { - /* UID-specific entry */ if (uid_len < e->uid_prefix_len) continue; if (memcmp(uid, e->uid_prefix, e->uid_prefix_len) != 0) continue; - /* Specific match wins immediately */ return e; } else { - /* Generic match — remember first, keep looking for specific */ if (generic_match == NULL) generic_match = e; } diff --git a/firmware_p4/components/Applications/nfc/protocols/mifare/mf_nested.c b/firmware_p4/components/Applications/nfc/protocols/mifare/mf_nested.c index 7a6e4c31..c37c96c2 100644 --- a/firmware_p4/components/Applications/nfc/protocols/mifare/mf_nested.c +++ b/firmware_p4/components/Applications/nfc/protocols/mifare/mf_nested.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "mf_nested.h" diff --git a/firmware_p4/components/Applications/nfc/protocols/mifare/mf_plus.c b/firmware_p4/components/Applications/nfc/protocols/mifare/mf_plus.c index 9625772e..655b001f 100644 --- a/firmware_p4/components/Applications/nfc/protocols/mifare/mf_plus.c +++ b/firmware_p4/components/Applications/nfc/protocols/mifare/mf_plus.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file mf_plus.c * @brief MiFARE Plus SL3 auth and crypto helpers. diff --git a/firmware_p4/components/Applications/nfc/protocols/mifare/mf_ultralight.c b/firmware_p4/components/Applications/nfc/protocols/mifare/mf_ultralight.c index 00a655b1..e1e42cc9 100644 --- a/firmware_p4/components/Applications/nfc/protocols/mifare/mf_ultralight.c +++ b/firmware_p4/components/Applications/nfc/protocols/mifare/mf_ultralight.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file mf_ultralight.c * @brief MIFARE Ultralight / Ultralight-C read, write, and auth operations. diff --git a/firmware_p4/components/Applications/nfc/protocols/mifare/mfkey.c b/firmware_p4/components/Applications/nfc/protocols/mifare/mfkey.c index 510e783e..cf37d118 100644 --- a/firmware_p4/components/Applications/nfc/protocols/mifare/mfkey.c +++ b/firmware_p4/components/Applications/nfc/protocols/mifare/mfkey.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "mfkey.h" diff --git a/firmware_p4/components/Applications/nfc/protocols/mifare/nfc_dict_loader.c b/firmware_p4/components/Applications/nfc/protocols/mifare/nfc_dict_loader.c new file mode 100644 index 00000000..676d8209 --- /dev/null +++ b/firmware_p4/components/Applications/nfc/protocols/mifare/nfc_dict_loader.c @@ -0,0 +1,280 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#include "nfc_dict_loader.h" + +#include +#include +#include +#include + +#include "esp_log.h" + +static const char *TAG = "NFC_DICT"; + +#define MAX_LINE_LEN 96 +#define MAX_KEY_SIZE 32 +#define MAX_PATH_LEN 256 +#define DIC_EXTENSION ".dic" +#define DIC_EXTENSION_LEN 4 + +static int hex_nibble(char c) { + if (c >= '0' && c <= '9') { + return c - '0'; + } + if (c >= 'a' && c <= 'f') { + return 10 + (c - 'a'); + } + if (c >= 'A' && c <= 'F') { + return 10 + (c - 'A'); + } + return -1; +} + +static bool parse_hex_line(const char *line, size_t key_size, uint8_t *out_key) { + size_t got = 0; + int hi = -1; + + for (const char *p = line; *p != '\0'; p++) { + if (*p == '#' || *p == '\n' || *p == '\r') { + break; + } + if (isspace((unsigned char)*p)) { + continue; + } + + int n = hex_nibble(*p); + if (n < 0) { + return false; + } + + if (hi < 0) { + hi = n; + } else { + if (got >= key_size) { + return false; + } + out_key[got++] = (uint8_t)((hi << 4) | n); + hi = -1; + } + } + + return (hi < 0) && (got == key_size); +} + +typedef struct { + size_t key_size; + size_t max_keys; +} nfc_dict_io_t; + +static esp_err_t +load_from(const char *path, const nfc_dict_io_t *io, uint8_t *out_keys, size_t *out_count) { + FILE *f = fopen(path, "r"); + if (f == NULL) { + return ESP_ERR_NOT_FOUND; + } + + if (io->key_size > MAX_KEY_SIZE) { + ESP_LOGE(TAG, "key_size %u exceeds MAX_KEY_SIZE", (unsigned)io->key_size); + fclose(f); + return ESP_ERR_INVALID_ARG; + } + + char line[MAX_LINE_LEN]; + size_t loaded = 0; + size_t lineno = 0; + + while (loaded < io->max_keys && fgets(line, sizeof(line), f) != NULL) { + lineno++; + + const char *p = line; + while (*p != '\0' && isspace((unsigned char)*p)) { + p++; + } + if (*p == '\0' || *p == '#') { + continue; + } + + uint8_t key[MAX_KEY_SIZE]; + if (!parse_hex_line(line, io->key_size, key)) { + ESP_LOGD(TAG, "%s:%u: skip malformed line", path, (unsigned)lineno); + continue; + } + + memcpy(out_keys + loaded * io->key_size, key, io->key_size); + loaded++; + } + + fclose(f); + *out_count = loaded; + return (loaded > 0) ? ESP_OK : ESP_ERR_NOT_FOUND; +} + +esp_err_t +nfc_dict_load_file(const nfc_dict_load_params_t *params, uint8_t *out_keys, size_t *out_count) { + if (params == NULL || out_keys == NULL || out_count == NULL || params->key_size == 0 || + params->max_keys == 0) { + return ESP_ERR_INVALID_ARG; + } + + *out_count = 0; + + const nfc_dict_io_t io = {.key_size = params->key_size, .max_keys = params->max_keys}; + + if (params->sd_path != NULL) { + esp_err_t err = load_from(params->sd_path, &io, out_keys, out_count); + if (err == ESP_OK) { + ESP_LOGI(TAG, "Loaded %u keys from %s", (unsigned)*out_count, params->sd_path); + return ESP_OK; + } + } + + if (params->flash_path != NULL) { + esp_err_t err = load_from(params->flash_path, &io, out_keys, out_count); + if (err == ESP_OK) { + ESP_LOGI( + TAG, "Loaded %u keys from %s (flash fallback)", (unsigned)*out_count, params->flash_path); + return ESP_OK; + } + } + + ESP_LOGW(TAG, + "No keys loaded (sd=%s flash=%s)", + params->sd_path != NULL ? params->sd_path : "(none)", + params->flash_path != NULL ? params->flash_path : "(none)"); + return ESP_ERR_NOT_FOUND; +} + +static bool name_has_dic_extension(const char *name) { + size_t nlen = strlen(name); + if (nlen < DIC_EXTENSION_LEN) { + return false; + } + return strcmp(name + nlen - DIC_EXTENSION_LEN, DIC_EXTENSION) == 0; +} + +esp_err_t +nfc_dict_load_dir(const nfc_dict_scan_params_t *params, uint8_t *out_keys, size_t *out_count) { + if (params == NULL || params->dir == NULL || out_keys == NULL || out_count == NULL || + params->key_size == 0 || params->max_keys == 0) { + return ESP_ERR_INVALID_ARG; + } + + *out_count = 0; + + DIR *d = opendir(params->dir); + if (d == NULL) { + ESP_LOGW(TAG, "Cannot open dir %s", params->dir); + return ESP_ERR_NOT_FOUND; + } + + size_t prefix_len = (params->prefix != NULL) ? strlen(params->prefix) : 0; + int files_loaded = 0; + + struct dirent *de; + while ((de = readdir(d)) != NULL) { + if (de->d_name[0] == '.') { + continue; + } + if (prefix_len > 0 && strncmp(de->d_name, params->prefix, prefix_len) != 0) { + continue; + } + if (!name_has_dic_extension(de->d_name)) { + continue; + } + + char path[MAX_PATH_LEN]; + int n = snprintf(path, sizeof(path), "%s/%s", params->dir, de->d_name); + if (n <= 0 || (size_t)n >= sizeof(path)) { + continue; + } + + if (*out_count >= params->max_keys) { + break; + } + + uint8_t *tail = out_keys + (*out_count) * params->key_size; + const nfc_dict_io_t file_io = { + .key_size = params->key_size, + .max_keys = params->max_keys - *out_count, + }; + size_t file_count = 0; + + if (load_from(path, &file_io, tail, &file_count) != ESP_OK) { + continue; + } + + size_t kept = 0; + for (size_t i = 0; i < file_count; i++) { + const uint8_t *k = tail + i * params->key_size; + if (nfc_dict_contains(out_keys, *out_count + kept, params->key_size, k)) { + continue; + } + if (kept != i) { + memmove(tail + kept * params->key_size, k, params->key_size); + } + kept++; + } + *out_count += kept; + + if (kept > 0) { + ESP_LOGI(TAG, "Loaded %u new keys from %s", (unsigned)kept, de->d_name); + files_loaded++; + } + } + closedir(d); + + ESP_LOGI(TAG, + "%s: scanned dir, %d files contributed, %u total keys", + params->dir, + files_loaded, + (unsigned)*out_count); + return ESP_OK; +} + +bool nfc_dict_contains(const uint8_t *keys, size_t count, size_t key_size, const uint8_t *key) { + if (keys == NULL || key == NULL || key_size == 0) { + return false; + } + for (size_t i = 0; i < count; i++) { + if (memcmp(keys + i * key_size, key, key_size) == 0) { + return true; + } + } + return false; +} + +esp_err_t nfc_dict_append_key(const char *sd_path, const uint8_t *key, size_t key_size) { + if (sd_path == NULL || key == NULL || key_size == 0) { + return ESP_ERR_INVALID_ARG; + } + + FILE *f = fopen(sd_path, "a"); + if (f == NULL) { + ESP_LOGE(TAG, "Cannot open %s for append", sd_path); + return ESP_FAIL; + } + + for (size_t i = 0; i < key_size; i++) { + if (fprintf(f, "%02X", key[i]) < 0) { + fclose(f); + return ESP_FAIL; + } + } + fputc('\n', f); + fclose(f); + + return ESP_OK; +} diff --git a/firmware_p4/components/Applications/nfc/protocols/t1t/include/t1t.h b/firmware_p4/components/Applications/nfc/protocols/t1t/include/t1t.h index 14b940db..ab7ea305 100644 --- a/firmware_p4/components/Applications/nfc/protocols/t1t/include/t1t.h +++ b/firmware_p4/components/Applications/nfc/protocols/t1t/include/t1t.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file t1t.h * @brief NFC Forum Type 1 Tag (Topaz) commands. diff --git a/firmware_p4/components/Applications/nfc/protocols/t1t/t1t.c b/firmware_p4/components/Applications/nfc/protocols/t1t/t1t.c index 3a50f84a..227a6d0a 100644 --- a/firmware_p4/components/Applications/nfc/protocols/t1t/t1t.c +++ b/firmware_p4/components/Applications/nfc/protocols/t1t/t1t.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file t1t.c * @brief NFC Forum Type 1 Tag (Topaz) protocol (Phase 4). diff --git a/firmware_p4/components/Applications/nfc/protocols/t2t/include/t2t_emu.h b/firmware_p4/components/Applications/nfc/protocols/t2t/include/t2t_emu.h index 45dcb2a9..83e5a800 100644 --- a/firmware_p4/components/Applications/nfc/protocols/t2t/include/t2t_emu.h +++ b/firmware_p4/components/Applications/nfc/protocols/t2t/include/t2t_emu.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file t2t_emu.h * @brief NFC-A Type 2 Tag (T2T) Emulation ST25R3916. diff --git a/firmware_p4/components/Applications/nfc/protocols/t2t/t2t_emu.c b/firmware_p4/components/Applications/nfc/protocols/t2t/t2t_emu.c index 2a089116..fd92f45f 100644 --- a/firmware_p4/components/Applications/nfc/protocols/t2t/t2t_emu.c +++ b/firmware_p4/components/Applications/nfc/protocols/t2t/t2t_emu.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "t2t_emu.h" diff --git a/firmware_p4/components/Applications/rfid/include/rfid_manager.h b/firmware_p4/components/Applications/rfid/include/rfid_manager.h new file mode 100644 index 00000000..9c22d5ff --- /dev/null +++ b/firmware_p4/components/Applications/rfid/include/rfid_manager.h @@ -0,0 +1,88 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#ifndef RFID_MANAGER_H +#define RFID_MANAGER_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#include "esp_err.h" + +#include "ys_rfid2_types.h" +#include "rfid_types.h" + +/** + * @brief Full card event with raw + decoded data. + */ +typedef struct { + ys_rfid2_event_t driver_event; + rfid_decoded_data_t decoded; + bool is_decoded; +} rfid_card_event_t; + +/** + * @brief Callback invoked when a card event occurs. + * + * @param event Pointer to card event. Valid only during callback scope. + * @param ctx User context pointer. + */ +typedef void (*rfid_manager_event_cb_t)(const rfid_card_event_t *event, void *ctx); + +/** + * @brief Start the RFID manager. + * + * Starts the YS-RFID2 driver and routes events through the protocol registry. + * + * @param cb Event callback. Must not be NULL. + * @param ctx User context pointer. + * @return + * - ESP_OK on success + * - ESP_ERR_INVALID_ARG if cb is NULL + * - ESP_ERR_INVALID_STATE if already running + */ +esp_err_t rfid_manager_start(rfid_manager_event_cb_t cb, void *ctx); + +/** + * @brief Stop the RFID manager. + * + * Stops the YS-RFID2 driver. + */ +void rfid_manager_stop(void); + +/** + * @brief Check if the manager is running. + */ +bool rfid_manager_is_running(void); + +/** + * @brief Get the last card event. + * + * @param[out] out_event Pointer to receive the event. + * @return + * - ESP_OK on success + * - ESP_ERR_NOT_FOUND if no card has been detected yet + * - ESP_ERR_INVALID_ARG if out_event is NULL + */ +esp_err_t rfid_manager_get_last_card(rfid_card_event_t *out_event); + +#ifdef __cplusplus +} +#endif + +#endif // RFID_MANAGER_H diff --git a/firmware_p4/components/Applications/rfid/include/rfid_storage.h b/firmware_p4/components/Applications/rfid/include/rfid_storage.h new file mode 100644 index 00000000..5c76428c --- /dev/null +++ b/firmware_p4/components/Applications/rfid/include/rfid_storage.h @@ -0,0 +1,140 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#ifndef RFID_STORAGE_H +#define RFID_STORAGE_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +#include "esp_err.h" + +#include "ys_rfid2_types.h" +#include "rfid_types.h" + +#define RFID_STORAGE_MAX_ENTRIES 32 +#define RFID_STORAGE_NAME_MAX 32 + +/** + * @brief Full RFID card entry for save/load. + */ +typedef struct { + char name[RFID_STORAGE_NAME_MAX]; + ys_rfid2_raw_data_t raw; + rfid_decoded_data_t decoded; + bool is_decoded; + int64_t timestamp_ms; +} rfid_storage_entry_t; + +/** + * @brief Lightweight info struct for listing (no raw data). + */ +typedef struct { + char name[RFID_STORAGE_NAME_MAX]; + const char *protocol_name; + uint32_t card_number; + uint16_t facility_code; +} rfid_storage_info_t; + +/** + * @brief Initialize RFID storage. + */ +void rfid_storage_init(void); + +/** + * @brief Get number of stored entries. + */ +int rfid_storage_count(void); + +/** + * @brief Save a card entry to storage. + * + * @param name Entry name. Must not be NULL. + * @param raw Raw card data. + * @param decoded Decoded data (may be empty if is_decoded is false). + * @param is_decoded Whether decoded data is valid. + * @return + * - ESP_OK on success + * - ESP_ERR_INVALID_ARG if name or raw is NULL + * - ESP_ERR_NO_MEM if storage is full + * - ESP_FAIL on write error + */ +esp_err_t rfid_storage_save(const char *name, + const ys_rfid2_raw_data_t *raw, + const rfid_decoded_data_t *decoded, + bool is_decoded); + +/** + * @brief Load a full entry by index. + * + * @param index Entry index (0-based). + * @param[out] out_entry Loaded entry data. + * @return + * - ESP_OK on success + * - ESP_ERR_INVALID_ARG if out_entry is NULL or index out of range + * - ESP_ERR_NOT_FOUND if entry does not exist + */ +esp_err_t rfid_storage_load(int index, rfid_storage_entry_t *out_entry); + +/** + * @brief Get lightweight info for an entry. + * + * @param index Entry index. + * @param[out] out_info Lightweight entry info. + * @return + * - ESP_OK on success + * - ESP_ERR_NOT_FOUND if entry does not exist + */ +esp_err_t rfid_storage_get_info(int index, rfid_storage_info_t *out_info); + +/** + * @brief List all stored entry infos. + * + * @param[out] out_infos Output array. + * @param max Maximum entries to fill. + * @return Number of entries listed. + */ +int rfid_storage_list(rfid_storage_info_t *out_infos, int max); + +/** + * @brief Delete an entry by index. + * + * @param index Entry index. + * @return + * - ESP_OK on success + * - ESP_ERR_NOT_FOUND if entry does not exist + */ +esp_err_t rfid_storage_delete(int index); + +/** + * @brief Find an entry by raw card ID string. + * + * @param id_str 10-digit card ID string. + * @param[out] out_index Matching entry index. + * @return + * - ESP_OK if found + * - ESP_ERR_NOT_FOUND if no match + */ +esp_err_t rfid_storage_find_by_id(const char *id_str, int *out_index); + +#ifdef __cplusplus +} +#endif + +#endif // RFID_STORAGE_H diff --git a/firmware_p4/components/Applications/rfid/include/rfid_types.h b/firmware_p4/components/Applications/rfid/include/rfid_types.h new file mode 100644 index 00000000..7a01c823 --- /dev/null +++ b/firmware_p4/components/Applications/rfid/include/rfid_types.h @@ -0,0 +1,40 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#ifndef RFID_TYPES_H +#define RFID_TYPES_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/** + * @brief Decoded card data produced by protocol plugins. + */ +typedef struct { + const char *protocol_name; + uint32_t card_number; + uint16_t facility_code; + uint8_t bit_count; + uint64_t raw_value; +} rfid_decoded_data_t; + +#ifdef __cplusplus +} +#endif + +#endif // RFID_TYPES_H diff --git a/firmware_p4/components/Applications/rfid/protocols/include/rfid_protocol_decoder.h b/firmware_p4/components/Applications/rfid/protocols/include/rfid_protocol_decoder.h new file mode 100644 index 00000000..d07e0bb7 --- /dev/null +++ b/firmware_p4/components/Applications/rfid/protocols/include/rfid_protocol_decoder.h @@ -0,0 +1,50 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#ifndef RFID_PROTOCOL_DECODER_H +#define RFID_PROTOCOL_DECODER_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include + +#include "ys_rfid2_types.h" +#include "rfid_types.h" + +/** + * @brief Interface for RFID 125kHz protocol decoders. + */ +typedef struct { + const char *name; + + /** + * @brief Decode raw card data into structured fields. + * + * @param raw Raw data from the RFID reader (40-bit card ID). + * @param out_data Pointer to store decoded results. + * @return true if the protocol recognized the data. + */ + bool (*decode)(const ys_rfid2_raw_data_t *raw, rfid_decoded_data_t *out_data); +} rfid_protocol_t; + +#ifdef __cplusplus +} +#endif + +#endif // RFID_PROTOCOL_DECODER_H diff --git a/firmware_p4/components/Applications/rfid/protocols/include/rfid_protocol_registry.h b/firmware_p4/components/Applications/rfid/protocols/include/rfid_protocol_registry.h new file mode 100644 index 00000000..d58441f7 --- /dev/null +++ b/firmware_p4/components/Applications/rfid/protocols/include/rfid_protocol_registry.h @@ -0,0 +1,65 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#ifndef RFID_PROTOCOL_REGISTRY_H +#define RFID_PROTOCOL_REGISTRY_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "rfid_protocol_decoder.h" + +/** + * @brief Initialize the protocol registry. + */ +void rfid_protocol_registry_init(void); + +/** + * @brief Run all registered decoders on raw card data. + * + * @param raw Raw data from the RFID reader. + * @param out_data Pointer to store decoded results. + * @return true if a protocol claimed the data. + */ +bool rfid_protocol_registry_decode_all(const ys_rfid2_raw_data_t *raw, + rfid_decoded_data_t *out_data); + +/** + * @brief Find a protocol by name. + * + * @param name Protocol name to search for. + * @return Pointer to protocol structure, or NULL if not found. + */ +const rfid_protocol_t *rfid_protocol_registry_get_by_name(const char *name); + +/** + * @brief Get the number of registered protocols. + */ +size_t rfid_protocol_registry_get_count(void); + +/** + * @brief Get a protocol by index. + * + * @param index Zero-based index into the registry. + * @return Pointer to protocol structure, or NULL if index is out of range. + */ +const rfid_protocol_t *rfid_protocol_registry_get_by_index(size_t index); + +#ifdef __cplusplus +} +#endif + +#endif // RFID_PROTOCOL_REGISTRY_H diff --git a/firmware_p4/components/Applications/rfid/protocols/protocol_awid.c b/firmware_p4/components/Applications/rfid/protocols/protocol_awid.c new file mode 100644 index 00000000..e562a830 --- /dev/null +++ b/firmware_p4/components/Applications/rfid/protocols/protocol_awid.c @@ -0,0 +1,91 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +// AWID — 26-bit Wiegand format +// Identical structure to HID H10301: +// Bit 25: even parity (covers bits 25-13) +// Bits 24-17: 8-bit facility code (0-255) +// Bits 16-1: 16-bit card number (0-65535) +// Bit 0: odd parity (covers bits 12-0) +// Distinguished from HID by the EM4100 customer code byte. +// AWID cards typically have customer code 0x01. + +#include "rfid_protocol_decoder.h" + +#include "esp_log.h" + +static const char *TAG = "PROTO_AWID"; + +#define AWID_BITS 26 +#define AWID_CUSTOMER_ID 0x01 +#define AWID_FC_SHIFT 17 +#define AWID_FC_MASK 0xFF +#define AWID_CARD_SHIFT 1 +#define AWID_CARD_MASK 0xFFFF + +static int count_bits(uint32_t value, int from_bit, int to_bit) { + int count = 0; + for (int i = from_bit; i <= to_bit; i++) { + if (value & (1u << i)) { + count++; + } + } + return count; +} + +static bool protocol_awid_decode(const ys_rfid2_raw_data_t *raw, rfid_decoded_data_t *out_data) { + if (raw->bit_count != 40) { + return false; + } + + // Check AWID customer code in the upper byte + if (raw->data[0] != AWID_CUSTOMER_ID) { + return false; + } + + uint64_t full_value = 0; + for (int i = 0; i < YS_RFID2_RAW_DATA_LEN; i++) { + full_value = (full_value << 8) | raw->data[i]; + } + + uint32_t wiegand = (uint32_t)(full_value & 0x03FFFFFF); + + uint8_t facility_code = (wiegand >> AWID_FC_SHIFT) & AWID_FC_MASK; + uint16_t card_number = (wiegand >> AWID_CARD_SHIFT) & AWID_CARD_MASK; + + // Validate even parity (bits 25-13) + if ((count_bits(wiegand, 13, 25) % 2) != 0) { + return false; + } + + // Validate odd parity (bits 12-0) + if ((count_bits(wiegand, 0, 12) % 2) != 1) { + return false; + } + + out_data->protocol_name = "AWID"; + out_data->facility_code = facility_code; + out_data->card_number = card_number; + out_data->bit_count = AWID_BITS; + out_data->raw_value = wiegand; + + ESP_LOGD(TAG, "FC: %u, Card: %u", facility_code, card_number); + return true; +} + +rfid_protocol_t protocol_awid = { + .name = "AWID", + .decode = protocol_awid_decode, +}; diff --git a/firmware_p4/components/Applications/rfid/protocols/protocol_em4100.c b/firmware_p4/components/Applications/rfid/protocols/protocol_em4100.c new file mode 100644 index 00000000..f5aa5a16 --- /dev/null +++ b/firmware_p4/components/Applications/rfid/protocols/protocol_em4100.c @@ -0,0 +1,57 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +// EM4100 / EM-Marin / TK4100 — 125kHz read-only RFID +// 40-bit data: 8-bit customer/version code + 32-bit unique card ID +// Ref: https://www.priority1design.com.au/em4100_protocol.html + +#include "rfid_protocol_decoder.h" + +#include "esp_log.h" + +static const char *TAG = "PROTO_EM4100"; + +#define EM4100_CUSTOMER_SHIFT 32 +#define EM4100_CUSTOMER_MASK 0xFF +#define EM4100_CARD_MASK 0xFFFFFFFF + +static bool protocol_em4100_decode(const ys_rfid2_raw_data_t *raw, rfid_decoded_data_t *out_data) { + if (raw->bit_count != 40) { + return false; + } + + // Reconstruct 40-bit value from raw bytes (big-endian) + uint64_t value = 0; + for (int i = 0; i < YS_RFID2_RAW_DATA_LEN; i++) { + value = (value << 8) | raw->data[i]; + } + + uint8_t customer_code = (uint8_t)((value >> EM4100_CUSTOMER_SHIFT) & EM4100_CUSTOMER_MASK); + uint32_t card_id = (uint32_t)(value & EM4100_CARD_MASK); + + out_data->protocol_name = "EM4100"; + out_data->facility_code = customer_code; + out_data->card_number = card_id; + out_data->bit_count = 40; + out_data->raw_value = value; + + ESP_LOGD(TAG, "Customer: %u, Card: %lu", customer_code, (unsigned long)card_id); + return true; +} + +rfid_protocol_t protocol_em4100 = { + .name = "EM4100", + .decode = protocol_em4100_decode, +}; diff --git a/firmware_p4/components/Applications/rfid/protocols/protocol_fdxb.c b/firmware_p4/components/Applications/rfid/protocols/protocol_fdxb.c new file mode 100644 index 00000000..0147f545 --- /dev/null +++ b/firmware_p4/components/Applications/rfid/protocols/protocol_fdxb.c @@ -0,0 +1,67 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +// FDX-B — ISO 11784/11785 Animal Identification +// 134.2kHz carrier (may not be directly readable by 125kHz YS-RFID2) +// When raw 40-bit data is available, attempt to extract: +// - 10-bit country code +// - 38-bit national ID (lower 32 bits stored as card_number) +// This is a best-effort decoder for cloned/compatible data. +// Ref: https://www.priority1design.com.au/fdx-b_animal_identification_protocol.html + +#include "rfid_protocol_decoder.h" + +#include "esp_log.h" + +static const char *TAG = "PROTO_FDXB"; + +#define FDXB_BITS 40 +#define FDXB_COUNTRY_MASK 0x3FF +#define FDXB_COUNTRY_SHIFT 32 + +static bool protocol_fdxb_decode(const ys_rfid2_raw_data_t *raw, rfid_decoded_data_t *out_data) { + if (raw->bit_count != 40) { + return false; + } + + uint64_t full_value = 0; + for (int i = 0; i < YS_RFID2_RAW_DATA_LEN; i++) { + full_value = (full_value << 8) | raw->data[i]; + } + + // Upper 8 bits as country hint (only 10 bits in full FDX-B, we have 8) + uint16_t country_code = (uint16_t)((full_value >> FDXB_COUNTRY_SHIFT) & FDXB_COUNTRY_MASK); + uint32_t national_id = (uint32_t)(full_value & 0xFFFFFFFF); + + // FDX-B country codes are in range 1-999 (ISO 3166) + // If the upper byte doesn't look like a valid country code range, skip + if (country_code == 0 || country_code > 999) { + return false; + } + + out_data->protocol_name = "FDX-B"; + out_data->facility_code = country_code; + out_data->card_number = national_id; + out_data->bit_count = FDXB_BITS; + out_data->raw_value = full_value; + + ESP_LOGD(TAG, "Country: %u, ID: %lu", country_code, (unsigned long)national_id); + return true; +} + +rfid_protocol_t protocol_fdxb = { + .name = "FDX-B", + .decode = protocol_fdxb_decode, +}; diff --git a/firmware_p4/components/Applications/rfid/protocols/protocol_gallagher.c b/firmware_p4/components/Applications/rfid/protocols/protocol_gallagher.c new file mode 100644 index 00000000..78a724f3 --- /dev/null +++ b/firmware_p4/components/Applications/rfid/protocols/protocol_gallagher.c @@ -0,0 +1,81 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +// Gallagher — Enterprise access control +// Uses EM4100 customer code 0x09. +// Data layout in lower 32 bits: +// Bits [31:24] = 8-bit region code +// Bits [23:8] = 16-bit cardholder number +// Bits [7:4] = 4-bit issue level +// Bits [3:0] = 4-bit checksum nibble +// Ref: https://github.com/megabug/gallagher-research + +#include "rfid_protocol_decoder.h" + +#include "esp_log.h" + +static const char *TAG = "PROTO_GALLAGHER"; + +#define GALLAGHER_BITS 40 +#define GALLAGHER_CUSTOMER_ID 0x09 +#define GALLAGHER_REGION_MASK 0xFF +#define GALLAGHER_CARD_MASK 0xFFFF +#define GALLAGHER_ISSUE_MASK 0x0F + +static bool protocol_gallagher_decode(const ys_rfid2_raw_data_t *raw, + rfid_decoded_data_t *out_data) { + if (raw->bit_count != 40) { + return false; + } + + if (raw->data[0] != GALLAGHER_CUSTOMER_ID) { + return false; + } + + uint8_t region = raw->data[1]; + uint16_t card_number = ((uint16_t)raw->data[2] << 8) | raw->data[3]; + uint8_t issue_level = (raw->data[4] >> 4) & GALLAGHER_ISSUE_MASK; + uint8_t checksum = raw->data[4] & 0x0F; + + // Simple checksum: XOR of all nibbles should produce a known value + uint8_t calc = 0; + for (int i = 0; i < 4; i++) { + calc ^= (raw->data[i] >> 4) ^ (raw->data[i] & 0x0F); + } + calc ^= (raw->data[4] >> 4); + + if ((calc & 0x0F) != checksum) { + return false; + } + + uint64_t full_value = 0; + for (int i = 0; i < YS_RFID2_RAW_DATA_LEN; i++) { + full_value = (full_value << 8) | raw->data[i]; + } + + out_data->protocol_name = "Gallagher"; + out_data->facility_code = region; + out_data->card_number = card_number; + out_data->bit_count = GALLAGHER_BITS; + out_data->raw_value = full_value; + + ESP_LOGD(TAG, "Region: %u, Card: %u, Issue: %u", region, card_number, issue_level); + return true; +} + +rfid_protocol_t protocol_gallagher = { + .name = "Gallagher", + .decode = protocol_gallagher_decode, +}; diff --git a/firmware_p4/components/Applications/rfid/protocols/protocol_hid.c b/firmware_p4/components/Applications/rfid/protocols/protocol_hid.c new file mode 100644 index 00000000..af5436d7 --- /dev/null +++ b/firmware_p4/components/Applications/rfid/protocols/protocol_hid.c @@ -0,0 +1,91 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +// HID Prox H10301 — 26-bit Wiegand format +// Bit 25: even parity (covers bits 25-13) +// Bits 24-17: 8-bit facility code (0-255) +// Bits 16-1: 16-bit card number (0-65535) +// Bit 0: odd parity (covers bits 12-0) +// Ref: https://www.proxcards.com/hid-26-bit-h10301-format/ + +#include "rfid_protocol_decoder.h" + +#include "esp_log.h" + +static const char *TAG = "PROTO_HID"; + +#define HID_WIEGAND_BITS 26 +#define HID_FC_SHIFT 17 +#define HID_FC_MASK 0xFF +#define HID_CARD_SHIFT 1 +#define HID_CARD_MASK 0xFFFF +#define HID_EVEN_PARITY_BIT 25 +#define HID_ODD_PARITY_BIT 0 + +static int count_bits(uint32_t value, int from_bit, int to_bit) { + int count = 0; + for (int i = from_bit; i <= to_bit; i++) { + if (value & (1u << i)) { + count++; + } + } + return count; +} + +static bool protocol_hid_decode(const ys_rfid2_raw_data_t *raw, rfid_decoded_data_t *out_data) { + if (raw->bit_count != 40) { + return false; + } + + // Use lower 26 bits of the 40-bit raw value + uint64_t full_value = 0; + for (int i = 0; i < YS_RFID2_RAW_DATA_LEN; i++) { + full_value = (full_value << 8) | raw->data[i]; + } + + uint32_t wiegand = (uint32_t)(full_value & 0x03FFFFFF); + + // Extract fields + uint8_t even_parity = (wiegand >> HID_EVEN_PARITY_BIT) & 1; + uint8_t facility_code = (wiegand >> HID_FC_SHIFT) & HID_FC_MASK; + uint16_t card_number = (wiegand >> HID_CARD_SHIFT) & HID_CARD_MASK; + uint8_t odd_parity = (wiegand >> HID_ODD_PARITY_BIT) & 1; + + // Validate even parity (bits 25-13, including parity bit itself) + int even_count = count_bits(wiegand, 13, HID_EVEN_PARITY_BIT); + if ((even_count % 2) != 0) { + return false; + } + + // Validate odd parity (bits 12-0, including parity bit itself) + int odd_count = count_bits(wiegand, HID_ODD_PARITY_BIT, 12); + if ((odd_count % 2) != 1) { + return false; + } + + out_data->protocol_name = "HID Prox"; + out_data->facility_code = facility_code; + out_data->card_number = card_number; + out_data->bit_count = HID_WIEGAND_BITS; + out_data->raw_value = wiegand; + + ESP_LOGD(TAG, "FC: %u, Card: %u", facility_code, card_number); + return true; +} + +rfid_protocol_t protocol_hid = { + .name = "HID Prox", + .decode = protocol_hid_decode, +}; diff --git a/firmware_p4/components/Applications/rfid/protocols/protocol_hid_corp.c b/firmware_p4/components/Applications/rfid/protocols/protocol_hid_corp.c new file mode 100644 index 00000000..c4a6773a --- /dev/null +++ b/firmware_p4/components/Applications/rfid/protocols/protocol_hid_corp.c @@ -0,0 +1,94 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +// HID Corporate 1000 H10302 — 35-bit format +// Bit 34: even parity (covers bits 34-18) +// Bits 33-22: 12-bit company/site code (0-4095) +// Bits 21-2: 20-bit card number (0-1048575) +// Bit 1: odd parity (covers bits 17-1) +// Bit 0: odd parity (covers bits 34-2, full frame) + +#include "rfid_protocol_decoder.h" + +#include "esp_log.h" + +static const char *TAG = "PROTO_HID_CORP"; + +#define HID_CORP_BITS 35 +#define HID_CORP_SITE_SHIFT 22 +#define HID_CORP_SITE_MASK 0xFFF +#define HID_CORP_CARD_SHIFT 2 +#define HID_CORP_CARD_MASK 0xFFFFF + +static int count_bits_64(uint64_t value, int from_bit, int to_bit) { + int count = 0; + for (int i = from_bit; i <= to_bit; i++) { + if (value & (1ULL << i)) { + count++; + } + } + return count; +} + +static bool protocol_hid_corp_decode(const ys_rfid2_raw_data_t *raw, + rfid_decoded_data_t *out_data) { + if (raw->bit_count != 40) { + return false; + } + + uint64_t full_value = 0; + for (int i = 0; i < YS_RFID2_RAW_DATA_LEN; i++) { + full_value = (full_value << 8) | raw->data[i]; + } + + // Use lower 35 bits + uint64_t corp = full_value & 0x7FFFFFFFFULL; + + // Extract fields + uint16_t site_code = (uint16_t)((corp >> HID_CORP_SITE_SHIFT) & HID_CORP_SITE_MASK); + uint32_t card_number = (uint32_t)((corp >> HID_CORP_CARD_SHIFT) & HID_CORP_CARD_MASK); + + // Validate even parity (bit 34 covers bits 34-18) + int even_count = count_bits_64(corp, 18, 34); + if ((even_count % 2) != 0) { + return false; + } + + // Validate odd parity (bit 1 covers bits 17-1) + int odd_count = count_bits_64(corp, 1, 17); + if ((odd_count % 2) != 1) { + return false; + } + + // Validate frame parity (bit 0 covers bits 34-2) + int frame_count = count_bits_64(corp, 0, 34); + if ((frame_count % 2) != 1) { + return false; + } + + out_data->protocol_name = "HID Corp 1000"; + out_data->facility_code = site_code; + out_data->card_number = card_number; + out_data->bit_count = HID_CORP_BITS; + out_data->raw_value = corp; + + ESP_LOGD(TAG, "Site: %u, Card: %lu", site_code, (unsigned long)card_number); + return true; +} + +rfid_protocol_t protocol_hid_corp = { + .name = "HID Corp 1000", + .decode = protocol_hid_corp_decode, +}; diff --git a/firmware_p4/components/Applications/rfid/protocols/protocol_indala.c b/firmware_p4/components/Applications/rfid/protocols/protocol_indala.c new file mode 100644 index 00000000..b8334a09 --- /dev/null +++ b/firmware_p4/components/Applications/rfid/protocols/protocol_indala.c @@ -0,0 +1,88 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +// Indala 26-bit (Motorola/Identiv format 40134) +// 26 bits with proprietary bit scrambling: +// 1 even parity + 12-bit site code + 12-bit card number + 1 odd parity +// The bit positions are scrambled within the raw data. +// Ref: Identiv 4000/4020 clamshell card specs + +#include "rfid_protocol_decoder.h" + +#include "esp_log.h" + +static const char *TAG = "PROTO_INDALA"; + +#define INDALA_BITS 26 +#define INDALA_SITE_MASK 0xFFF +#define INDALA_CARD_MASK 0xFFF + +static bool protocol_indala_decode(const ys_rfid2_raw_data_t *raw, rfid_decoded_data_t *out_data) { + if (raw->bit_count != 40) { + return false; + } + + uint64_t full_value = 0; + for (int i = 0; i < YS_RFID2_RAW_DATA_LEN; i++) { + full_value = (full_value << 8) | raw->data[i]; + } + + // Use lower 26 bits + uint32_t indala = (uint32_t)(full_value & 0x03FFFFFF); + + // Extract parity bits + uint8_t even_parity = (indala >> 25) & 1; + uint8_t odd_parity = indala & 1; + + // Extract site code (bits 24-13) and card number (bits 12-1) + uint16_t site_code = (uint16_t)((indala >> 13) & INDALA_SITE_MASK); + uint16_t card_number = (uint16_t)((indala >> 1) & INDALA_CARD_MASK); + + // Validate even parity (covers upper half: bits 25-13) + int even_count = 0; + for (int i = 13; i <= 25; i++) { + if (indala & (1u << i)) { + even_count++; + } + } + if ((even_count % 2) != 0) { + return false; + } + + // Validate odd parity (covers lower half: bits 12-0) + int odd_count = 0; + for (int i = 0; i <= 12; i++) { + if (indala & (1u << i)) { + odd_count++; + } + } + if ((odd_count % 2) != 1) { + return false; + } + + out_data->protocol_name = "Indala"; + out_data->facility_code = site_code; + out_data->card_number = card_number; + out_data->bit_count = INDALA_BITS; + out_data->raw_value = indala; + + ESP_LOGD(TAG, "Site: %u, Card: %u", site_code, card_number); + return true; +} + +rfid_protocol_t protocol_indala = { + .name = "Indala", + .decode = protocol_indala_decode, +}; diff --git a/firmware_p4/components/Applications/rfid/protocols/protocol_jablotron.c b/firmware_p4/components/Applications/rfid/protocols/protocol_jablotron.c new file mode 100644 index 00000000..546c4a30 --- /dev/null +++ b/firmware_p4/components/Applications/rfid/protocols/protocol_jablotron.c @@ -0,0 +1,83 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +// Jablotron — Czech security system 26-bit format +// Uses 26-bit Wiegand with EM4100 customer code 0x07. +// Bit 25: even parity (covers bits 25-13) +// Bits 24-17: 8-bit facility code +// Bits 16-1: 16-bit card number +// Bit 0: odd parity (covers bits 12-0) + +#include "rfid_protocol_decoder.h" + +#include "esp_log.h" + +static const char *TAG = "PROTO_JABLOTRON"; + +#define JABLOTRON_BITS 26 +#define JABLOTRON_CUSTOMER_ID 0x07 +#define JABLOTRON_FC_SHIFT 17 +#define JABLOTRON_FC_MASK 0xFF +#define JABLOTRON_CARD_SHIFT 1 +#define JABLOTRON_CARD_MASK 0xFFFF + +static int count_bits(uint32_t value, int from_bit, int to_bit) { + int count = 0; + for (int i = from_bit; i <= to_bit; i++) { + if (value & (1u << i)) { + count++; + } + } + return count; +} + +static bool protocol_jablotron_decode(const ys_rfid2_raw_data_t *raw, + rfid_decoded_data_t *out_data) { + if (raw->bit_count != 40) { + return false; + } + + if (raw->data[0] != JABLOTRON_CUSTOMER_ID) { + return false; + } + + uint64_t full_value = 0; + for (int i = 0; i < YS_RFID2_RAW_DATA_LEN; i++) { + full_value = (full_value << 8) | raw->data[i]; + } + + uint32_t wiegand = (uint32_t)(full_value & 0x03FFFFFF); + + if ((count_bits(wiegand, 13, 25) % 2) != 0) { + return false; + } + if ((count_bits(wiegand, 0, 12) % 2) != 1) { + return false; + } + + out_data->protocol_name = "Jablotron"; + out_data->facility_code = (wiegand >> JABLOTRON_FC_SHIFT) & JABLOTRON_FC_MASK; + out_data->card_number = (wiegand >> JABLOTRON_CARD_SHIFT) & JABLOTRON_CARD_MASK; + out_data->bit_count = JABLOTRON_BITS; + out_data->raw_value = wiegand; + + ESP_LOGD(TAG, "FC: %u, Card: %lu", out_data->facility_code, (unsigned long)out_data->card_number); + return true; +} + +rfid_protocol_t protocol_jablotron = { + .name = "Jablotron", + .decode = protocol_jablotron_decode, +}; diff --git a/firmware_p4/components/Applications/rfid/protocols/protocol_kantech.c b/firmware_p4/components/Applications/rfid/protocols/protocol_kantech.c new file mode 100644 index 00000000..eb9a8814 --- /dev/null +++ b/firmware_p4/components/Applications/rfid/protocols/protocol_kantech.c @@ -0,0 +1,61 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +// Kantech ioProx XSF — 26-bit proprietary format +// Uses EM4100 customer code 0x08. +// Bits [31:24] = 8-bit family code +// Bits [23:16] = 8-bit facility code +// Bits [15:0] = 16-bit card number + +#include "rfid_protocol_decoder.h" + +#include "esp_log.h" + +static const char *TAG = "PROTO_KANTECH"; + +#define KANTECH_BITS 40 +#define KANTECH_CUSTOMER_ID 0x08 + +static bool protocol_kantech_decode(const ys_rfid2_raw_data_t *raw, rfid_decoded_data_t *out_data) { + if (raw->bit_count != 40) { + return false; + } + + if (raw->data[0] != KANTECH_CUSTOMER_ID) { + return false; + } + + uint8_t facility_code = raw->data[2]; + uint16_t card_number = ((uint16_t)raw->data[3] << 8) | raw->data[4]; + + uint64_t full_value = 0; + for (int i = 0; i < YS_RFID2_RAW_DATA_LEN; i++) { + full_value = (full_value << 8) | raw->data[i]; + } + + out_data->protocol_name = "Kantech ioProx"; + out_data->facility_code = facility_code; + out_data->card_number = card_number; + out_data->bit_count = KANTECH_BITS; + out_data->raw_value = full_value; + + ESP_LOGD(TAG, "FC: %u, Card: %u", facility_code, card_number); + return true; +} + +rfid_protocol_t protocol_kantech = { + .name = "Kantech ioProx", + .decode = protocol_kantech_decode, +}; diff --git a/firmware_p4/components/Applications/rfid/protocols/protocol_keri.c b/firmware_p4/components/Applications/rfid/protocols/protocol_keri.c new file mode 100644 index 00000000..b74dda2d --- /dev/null +++ b/firmware_p4/components/Applications/rfid/protocols/protocol_keri.c @@ -0,0 +1,82 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +// Keri — 26-bit Wiegand format +// Bit 25: even parity (covers bits 25-13) +// Bits 24-17: 8-bit facility code (0-255) +// Bits 16-1: 16-bit card number (0-65535) +// Bit 0: odd parity (covers bits 12-0) +// Distinguished from HID by EM4100 customer code 0x04. + +#include "rfid_protocol_decoder.h" + +#include "esp_log.h" + +static const char *TAG = "PROTO_KERI"; + +#define KERI_BITS 26 +#define KERI_CUSTOMER_ID 0x04 +#define KERI_FC_SHIFT 17 +#define KERI_FC_MASK 0xFF +#define KERI_CARD_SHIFT 1 +#define KERI_CARD_MASK 0xFFFF + +static int count_bits(uint32_t value, int from_bit, int to_bit) { + int count = 0; + for (int i = from_bit; i <= to_bit; i++) { + if (value & (1u << i)) { + count++; + } + } + return count; +} + +static bool protocol_keri_decode(const ys_rfid2_raw_data_t *raw, rfid_decoded_data_t *out_data) { + if (raw->bit_count != 40) { + return false; + } + + if (raw->data[0] != KERI_CUSTOMER_ID) { + return false; + } + + uint64_t full_value = 0; + for (int i = 0; i < YS_RFID2_RAW_DATA_LEN; i++) { + full_value = (full_value << 8) | raw->data[i]; + } + + uint32_t wiegand = (uint32_t)(full_value & 0x03FFFFFF); + + if ((count_bits(wiegand, 13, 25) % 2) != 0) { + return false; + } + if ((count_bits(wiegand, 0, 12) % 2) != 1) { + return false; + } + + out_data->protocol_name = "Keri"; + out_data->facility_code = (wiegand >> KERI_FC_SHIFT) & KERI_FC_MASK; + out_data->card_number = (wiegand >> KERI_CARD_SHIFT) & KERI_CARD_MASK; + out_data->bit_count = KERI_BITS; + out_data->raw_value = wiegand; + + ESP_LOGD(TAG, "FC: %u, Card: %lu", out_data->facility_code, (unsigned long)out_data->card_number); + return true; +} + +rfid_protocol_t protocol_keri = { + .name = "Keri", + .decode = protocol_keri_decode, +}; diff --git a/firmware_p4/components/Applications/rfid/protocols/protocol_nexwatch.c b/firmware_p4/components/Applications/rfid/protocols/protocol_nexwatch.c new file mode 100644 index 00000000..bc0c1084 --- /dev/null +++ b/firmware_p4/components/Applications/rfid/protocols/protocol_nexwatch.c @@ -0,0 +1,65 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +// Honeywell Nexwatch — 32-bit QuadraKey format +// Uses EM4100 customer code 0x0A. +// Lower 32 bits: +// Bits [31:24] = 8-bit facility code +// Bits [23:0] = 24-bit card number + +#include "rfid_protocol_decoder.h" + +#include "esp_log.h" + +static const char *TAG = "PROTO_NEXWATCH"; + +#define NEXWATCH_BITS 32 +#define NEXWATCH_CUSTOMER_ID 0x0A +#define NEXWATCH_FC_MASK 0xFF +#define NEXWATCH_CARD_MASK 0x00FFFFFF + +static bool protocol_nexwatch_decode(const ys_rfid2_raw_data_t *raw, + rfid_decoded_data_t *out_data) { + if (raw->bit_count != 40) { + return false; + } + + if (raw->data[0] != NEXWATCH_CUSTOMER_ID) { + return false; + } + + uint8_t facility_code = raw->data[1]; + uint32_t card_number = + ((uint32_t)raw->data[2] << 16) | ((uint32_t)raw->data[3] << 8) | raw->data[4]; + + uint64_t full_value = 0; + for (int i = 0; i < YS_RFID2_RAW_DATA_LEN; i++) { + full_value = (full_value << 8) | raw->data[i]; + } + + out_data->protocol_name = "Nexwatch"; + out_data->facility_code = facility_code; + out_data->card_number = card_number; + out_data->bit_count = NEXWATCH_BITS; + out_data->raw_value = full_value; + + ESP_LOGD(TAG, "FC: %u, Card: %lu", facility_code, (unsigned long)card_number); + return true; +} + +rfid_protocol_t protocol_nexwatch = { + .name = "Nexwatch", + .decode = protocol_nexwatch_decode, +}; diff --git a/firmware_p4/components/Applications/rfid/protocols/protocol_noralsy.c b/firmware_p4/components/Applications/rfid/protocols/protocol_noralsy.c new file mode 100644 index 00000000..dbabc9cf --- /dev/null +++ b/firmware_p4/components/Applications/rfid/protocols/protocol_noralsy.c @@ -0,0 +1,61 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +// Noralsy — French access control system +// Uses EM4100 customer code 0x0B. +// Lower 32 bits: +// Bits [31:16] = 16-bit site code +// Bits [15:0] = 16-bit card number + +#include "rfid_protocol_decoder.h" + +#include "esp_log.h" + +static const char *TAG = "PROTO_NORALSY"; + +#define NORALSY_BITS 40 +#define NORALSY_CUSTOMER_ID 0x0B + +static bool protocol_noralsy_decode(const ys_rfid2_raw_data_t *raw, rfid_decoded_data_t *out_data) { + if (raw->bit_count != 40) { + return false; + } + + if (raw->data[0] != NORALSY_CUSTOMER_ID) { + return false; + } + + uint16_t site_code = ((uint16_t)raw->data[1] << 8) | raw->data[2]; + uint16_t card_number = ((uint16_t)raw->data[3] << 8) | raw->data[4]; + + uint64_t full_value = 0; + for (int i = 0; i < YS_RFID2_RAW_DATA_LEN; i++) { + full_value = (full_value << 8) | raw->data[i]; + } + + out_data->protocol_name = "Noralsy"; + out_data->facility_code = site_code; + out_data->card_number = card_number; + out_data->bit_count = NORALSY_BITS; + out_data->raw_value = full_value; + + ESP_LOGD(TAG, "Site: %u, Card: %u", site_code, card_number); + return true; +} + +rfid_protocol_t protocol_noralsy = { + .name = "Noralsy", + .decode = protocol_noralsy_decode, +}; diff --git a/firmware_p4/components/Applications/rfid/protocols/protocol_pac_stanley.c b/firmware_p4/components/Applications/rfid/protocols/protocol_pac_stanley.c new file mode 100644 index 00000000..7983d5b9 --- /dev/null +++ b/firmware_p4/components/Applications/rfid/protocols/protocol_pac_stanley.c @@ -0,0 +1,83 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +// PAC / Stanley — 26-bit Wiegand format +// Bit 25: even parity (covers bits 25-13) +// Bits 24-17: 8-bit facility code (0-255) +// Bits 16-1: 16-bit card number (0-65535) +// Bit 0: odd parity (covers bits 12-0) +// Distinguished from HID by EM4100 customer code 0x03. + +#include "rfid_protocol_decoder.h" + +#include "esp_log.h" + +static const char *TAG = "PROTO_PAC"; + +#define PAC_BITS 26 +#define PAC_CUSTOMER_ID 0x03 +#define PAC_FC_SHIFT 17 +#define PAC_FC_MASK 0xFF +#define PAC_CARD_SHIFT 1 +#define PAC_CARD_MASK 0xFFFF + +static int count_bits(uint32_t value, int from_bit, int to_bit) { + int count = 0; + for (int i = from_bit; i <= to_bit; i++) { + if (value & (1u << i)) { + count++; + } + } + return count; +} + +static bool protocol_pac_stanley_decode(const ys_rfid2_raw_data_t *raw, + rfid_decoded_data_t *out_data) { + if (raw->bit_count != 40) { + return false; + } + + if (raw->data[0] != PAC_CUSTOMER_ID) { + return false; + } + + uint64_t full_value = 0; + for (int i = 0; i < YS_RFID2_RAW_DATA_LEN; i++) { + full_value = (full_value << 8) | raw->data[i]; + } + + uint32_t wiegand = (uint32_t)(full_value & 0x03FFFFFF); + + if ((count_bits(wiegand, 13, 25) % 2) != 0) { + return false; + } + if ((count_bits(wiegand, 0, 12) % 2) != 1) { + return false; + } + + out_data->protocol_name = "PAC/Stanley"; + out_data->facility_code = (wiegand >> PAC_FC_SHIFT) & PAC_FC_MASK; + out_data->card_number = (wiegand >> PAC_CARD_SHIFT) & PAC_CARD_MASK; + out_data->bit_count = PAC_BITS; + out_data->raw_value = wiegand; + + ESP_LOGD(TAG, "FC: %u, Card: %lu", out_data->facility_code, (unsigned long)out_data->card_number); + return true; +} + +rfid_protocol_t protocol_pac_stanley = { + .name = "PAC/Stanley", + .decode = protocol_pac_stanley_decode, +}; diff --git a/firmware_p4/components/Applications/rfid/protocols/protocol_paradox.c b/firmware_p4/components/Applications/rfid/protocols/protocol_paradox.c new file mode 100644 index 00000000..c5666b4f --- /dev/null +++ b/firmware_p4/components/Applications/rfid/protocols/protocol_paradox.c @@ -0,0 +1,66 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +// Paradox — Proprietary security system format +// Uses the full 40 bits from EM4100: +// Bits [39:32] = 8-bit facility/site code +// Bits [31:16] = 16-bit card number +// Bits [15:0] = 16-bit checksum/serial +// Distinguished by EM4100 customer code 0x05. + +#include "rfid_protocol_decoder.h" + +#include "esp_log.h" + +static const char *TAG = "PROTO_PARADOX"; + +#define PARADOX_BITS 40 +#define PARADOX_CUSTOMER_ID 0x05 +#define PARADOX_FC_SHIFT 24 +#define PARADOX_FC_MASK 0xFF +#define PARADOX_CARD_SHIFT 8 +#define PARADOX_CARD_MASK 0xFFFF + +static bool protocol_paradox_decode(const ys_rfid2_raw_data_t *raw, rfid_decoded_data_t *out_data) { + if (raw->bit_count != 40) { + return false; + } + + if (raw->data[0] != PARADOX_CUSTOMER_ID) { + return false; + } + + uint64_t full_value = 0; + for (int i = 0; i < YS_RFID2_RAW_DATA_LEN; i++) { + full_value = (full_value << 8) | raw->data[i]; + } + + // Strip customer code byte, work with lower 32 bits + uint32_t payload = (uint32_t)(full_value & 0xFFFFFFFF); + + out_data->protocol_name = "Paradox"; + out_data->facility_code = (payload >> PARADOX_FC_SHIFT) & PARADOX_FC_MASK; + out_data->card_number = (payload >> PARADOX_CARD_SHIFT) & PARADOX_CARD_MASK; + out_data->bit_count = PARADOX_BITS; + out_data->raw_value = full_value; + + ESP_LOGD(TAG, "FC: %u, Card: %lu", out_data->facility_code, (unsigned long)out_data->card_number); + return true; +} + +rfid_protocol_t protocol_paradox = { + .name = "Paradox", + .decode = protocol_paradox_decode, +}; diff --git a/firmware_p4/components/Applications/rfid/protocols/protocol_pyramid.c b/firmware_p4/components/Applications/rfid/protocols/protocol_pyramid.c new file mode 100644 index 00000000..f4ea3f6a --- /dev/null +++ b/firmware_p4/components/Applications/rfid/protocols/protocol_pyramid.c @@ -0,0 +1,82 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +// Pyramid / Farpointe Data — 26-bit format +// Bit 25: even parity (covers bits 25-13) +// Bits 24-17: 8-bit facility code (0-255) +// Bits 16-1: 16-bit card number (0-65535) +// Bit 0: odd parity (covers bits 12-0) +// Distinguished from HID by EM4100 customer code 0x02. + +#include "rfid_protocol_decoder.h" + +#include "esp_log.h" + +static const char *TAG = "PROTO_PYRAMID"; + +#define PYRAMID_BITS 26 +#define PYRAMID_CUSTOMER_ID 0x02 +#define PYRAMID_FC_SHIFT 17 +#define PYRAMID_FC_MASK 0xFF +#define PYRAMID_CARD_SHIFT 1 +#define PYRAMID_CARD_MASK 0xFFFF + +static int count_bits(uint32_t value, int from_bit, int to_bit) { + int count = 0; + for (int i = from_bit; i <= to_bit; i++) { + if (value & (1u << i)) { + count++; + } + } + return count; +} + +static bool protocol_pyramid_decode(const ys_rfid2_raw_data_t *raw, rfid_decoded_data_t *out_data) { + if (raw->bit_count != 40) { + return false; + } + + if (raw->data[0] != PYRAMID_CUSTOMER_ID) { + return false; + } + + uint64_t full_value = 0; + for (int i = 0; i < YS_RFID2_RAW_DATA_LEN; i++) { + full_value = (full_value << 8) | raw->data[i]; + } + + uint32_t wiegand = (uint32_t)(full_value & 0x03FFFFFF); + + if ((count_bits(wiegand, 13, 25) % 2) != 0) { + return false; + } + if ((count_bits(wiegand, 0, 12) % 2) != 1) { + return false; + } + + out_data->protocol_name = "Pyramid"; + out_data->facility_code = (wiegand >> PYRAMID_FC_SHIFT) & PYRAMID_FC_MASK; + out_data->card_number = (wiegand >> PYRAMID_CARD_SHIFT) & PYRAMID_CARD_MASK; + out_data->bit_count = PYRAMID_BITS; + out_data->raw_value = wiegand; + + ESP_LOGD(TAG, "FC: %u, Card: %lu", out_data->facility_code, (unsigned long)out_data->card_number); + return true; +} + +rfid_protocol_t protocol_pyramid = { + .name = "Pyramid", + .decode = protocol_pyramid_decode, +}; diff --git a/firmware_p4/components/Applications/rfid/protocols/protocol_securakey.c b/firmware_p4/components/Applications/rfid/protocols/protocol_securakey.c new file mode 100644 index 00000000..4d16da03 --- /dev/null +++ b/firmware_p4/components/Applications/rfid/protocols/protocol_securakey.c @@ -0,0 +1,62 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +// Securakey — Proprietary access control format +// Uses EM4100 customer code 0x0C. +// Lower 32 bits: +// Bits [31:16] = 16-bit facility code +// Bits [15:0] = 16-bit card number + +#include "rfid_protocol_decoder.h" + +#include "esp_log.h" + +static const char *TAG = "PROTO_SECURAKEY"; + +#define SECURAKEY_BITS 40 +#define SECURAKEY_CUSTOMER_ID 0x0C + +static bool protocol_securakey_decode(const ys_rfid2_raw_data_t *raw, + rfid_decoded_data_t *out_data) { + if (raw->bit_count != 40) { + return false; + } + + if (raw->data[0] != SECURAKEY_CUSTOMER_ID) { + return false; + } + + uint16_t facility_code = ((uint16_t)raw->data[1] << 8) | raw->data[2]; + uint16_t card_number = ((uint16_t)raw->data[3] << 8) | raw->data[4]; + + uint64_t full_value = 0; + for (int i = 0; i < YS_RFID2_RAW_DATA_LEN; i++) { + full_value = (full_value << 8) | raw->data[i]; + } + + out_data->protocol_name = "Securakey"; + out_data->facility_code = facility_code; + out_data->card_number = card_number; + out_data->bit_count = SECURAKEY_BITS; + out_data->raw_value = full_value; + + ESP_LOGD(TAG, "FC: %u, Card: %u", facility_code, card_number); + return true; +} + +rfid_protocol_t protocol_securakey = { + .name = "Securakey", + .decode = protocol_securakey_decode, +}; diff --git a/firmware_p4/components/Applications/rfid/protocols/protocol_viking.c b/firmware_p4/components/Applications/rfid/protocols/protocol_viking.c new file mode 100644 index 00000000..c9e243f4 --- /dev/null +++ b/firmware_p4/components/Applications/rfid/protocols/protocol_viking.c @@ -0,0 +1,82 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +// Viking — 26-bit Wiegand format for Nordic access control +// Bit 25: even parity (covers bits 25-13) +// Bits 24-17: 8-bit facility code (0-255) +// Bits 16-1: 16-bit card number (0-65535) +// Bit 0: odd parity (covers bits 12-0) +// Distinguished from HID by EM4100 customer code 0x06. + +#include "rfid_protocol_decoder.h" + +#include "esp_log.h" + +static const char *TAG = "PROTO_VIKING"; + +#define VIKING_BITS 26 +#define VIKING_CUSTOMER_ID 0x06 +#define VIKING_FC_SHIFT 17 +#define VIKING_FC_MASK 0xFF +#define VIKING_CARD_SHIFT 1 +#define VIKING_CARD_MASK 0xFFFF + +static int count_bits(uint32_t value, int from_bit, int to_bit) { + int count = 0; + for (int i = from_bit; i <= to_bit; i++) { + if (value & (1u << i)) { + count++; + } + } + return count; +} + +static bool protocol_viking_decode(const ys_rfid2_raw_data_t *raw, rfid_decoded_data_t *out_data) { + if (raw->bit_count != 40) { + return false; + } + + if (raw->data[0] != VIKING_CUSTOMER_ID) { + return false; + } + + uint64_t full_value = 0; + for (int i = 0; i < YS_RFID2_RAW_DATA_LEN; i++) { + full_value = (full_value << 8) | raw->data[i]; + } + + uint32_t wiegand = (uint32_t)(full_value & 0x03FFFFFF); + + if ((count_bits(wiegand, 13, 25) % 2) != 0) { + return false; + } + if ((count_bits(wiegand, 0, 12) % 2) != 1) { + return false; + } + + out_data->protocol_name = "Viking"; + out_data->facility_code = (wiegand >> VIKING_FC_SHIFT) & VIKING_FC_MASK; + out_data->card_number = (wiegand >> VIKING_CARD_SHIFT) & VIKING_CARD_MASK; + out_data->bit_count = VIKING_BITS; + out_data->raw_value = wiegand; + + ESP_LOGD(TAG, "FC: %u, Card: %lu", out_data->facility_code, (unsigned long)out_data->card_number); + return true; +} + +rfid_protocol_t protocol_viking = { + .name = "Viking", + .decode = protocol_viking_decode, +}; diff --git a/firmware_p4/components/Applications/rfid/protocols/rfid_protocol_registry.c b/firmware_p4/components/Applications/rfid/protocols/rfid_protocol_registry.c new file mode 100644 index 00000000..92dfed4b --- /dev/null +++ b/firmware_p4/components/Applications/rfid/protocols/rfid_protocol_registry.c @@ -0,0 +1,99 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#include "rfid_protocol_registry.h" + +#include +#include + +#include "esp_log.h" + +static const char *TAG = "RFID_REGISTRY"; + +extern rfid_protocol_t protocol_em4100; +extern rfid_protocol_t protocol_hid; +extern rfid_protocol_t protocol_hid_corp; +extern rfid_protocol_t protocol_indala; +extern rfid_protocol_t protocol_awid; +extern rfid_protocol_t protocol_fdxb; +extern rfid_protocol_t protocol_viking; +extern rfid_protocol_t protocol_pyramid; +extern rfid_protocol_t protocol_keri; +extern rfid_protocol_t protocol_pac_stanley; +extern rfid_protocol_t protocol_paradox; +extern rfid_protocol_t protocol_jablotron; +extern rfid_protocol_t protocol_kantech; +extern rfid_protocol_t protocol_gallagher; +extern rfid_protocol_t protocol_nexwatch; +extern rfid_protocol_t protocol_noralsy; +extern rfid_protocol_t protocol_securakey; + +static const rfid_protocol_t *REGISTERED_PROTOCOLS[] = { + &protocol_em4100, + &protocol_hid, + &protocol_hid_corp, + &protocol_indala, + &protocol_awid, + &protocol_fdxb, + &protocol_viking, + &protocol_pyramid, + &protocol_keri, + &protocol_pac_stanley, + &protocol_paradox, + &protocol_jablotron, + &protocol_kantech, + &protocol_gallagher, + &protocol_nexwatch, + &protocol_noralsy, + &protocol_securakey, +}; + +#define REGISTERED_PROTOCOLS_COUNT (sizeof(REGISTERED_PROTOCOLS) / sizeof(REGISTERED_PROTOCOLS[0])) + +void rfid_protocol_registry_init(void) {} + +bool rfid_protocol_registry_decode_all(const ys_rfid2_raw_data_t *raw, + rfid_decoded_data_t *out_data) { + for (size_t i = 0; i < REGISTERED_PROTOCOLS_COUNT; i++) { + if (REGISTERED_PROTOCOLS[i]->decode != NULL && REGISTERED_PROTOCOLS[i]->decode(raw, out_data)) { + ESP_LOGD(TAG, "Decoded protocol: %s", REGISTERED_PROTOCOLS[i]->name); + return true; + } + } + return false; +} + +const rfid_protocol_t *rfid_protocol_registry_get_by_name(const char *name) { + if (name == NULL) { + return NULL; + } + for (size_t i = 0; i < REGISTERED_PROTOCOLS_COUNT; i++) { + if (strcmp(REGISTERED_PROTOCOLS[i]->name, name) == 0) { + return REGISTERED_PROTOCOLS[i]; + } + } + return NULL; +} + +size_t rfid_protocol_registry_get_count(void) { + return REGISTERED_PROTOCOLS_COUNT; +} + +const rfid_protocol_t *rfid_protocol_registry_get_by_index(size_t index) { + if (index >= REGISTERED_PROTOCOLS_COUNT) { + return NULL; + } + return REGISTERED_PROTOCOLS[index]; +} diff --git a/firmware_p4/components/Applications/rfid/rfid_manager.c b/firmware_p4/components/Applications/rfid/rfid_manager.c new file mode 100644 index 00000000..0928f674 --- /dev/null +++ b/firmware_p4/components/Applications/rfid/rfid_manager.c @@ -0,0 +1,123 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#include "rfid_manager.h" + +#include + +#include "esp_log.h" + +#include "ys_rfid2.h" +#include "rfid_protocol_registry.h" + +static const char *TAG = "RFID_MANAGER"; + +static struct { + rfid_manager_event_cb_t cb; + void *ctx; + bool is_running; + rfid_card_event_t last_event; + bool has_last_event; +} s_mgr = {0}; + +static void driver_event_handler(const ys_rfid2_event_t *event, void *ctx); + +esp_err_t rfid_manager_start(rfid_manager_event_cb_t cb, void *ctx) { + if (cb == NULL) { + return ESP_ERR_INVALID_ARG; + } + + if (s_mgr.is_running) { + return ESP_ERR_INVALID_STATE; + } + + rfid_protocol_registry_init(); + + s_mgr.cb = cb; + s_mgr.ctx = ctx; + s_mgr.has_last_event = false; + + esp_err_t ret = ys_rfid2_start(driver_event_handler, NULL); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "Failed to start driver: %s", esp_err_to_name(ret)); + return ret; + } + + s_mgr.is_running = true; + ESP_LOGI(TAG, "Started"); + return ESP_OK; +} + +void rfid_manager_stop(void) { + if (!s_mgr.is_running) { + return; + } + + ys_rfid2_stop(); + + s_mgr.is_running = false; + s_mgr.cb = NULL; + s_mgr.ctx = NULL; + + ESP_LOGI(TAG, "Stopped"); +} + +bool rfid_manager_is_running(void) { + return s_mgr.is_running; +} + +esp_err_t rfid_manager_get_last_card(rfid_card_event_t *out_event) { + if (out_event == NULL) { + return ESP_ERR_INVALID_ARG; + } + + if (!s_mgr.has_last_event) { + return ESP_ERR_NOT_FOUND; + } + + *out_event = s_mgr.last_event; + return ESP_OK; +} + +static void driver_event_handler(const ys_rfid2_event_t *event, void *ctx) { + (void)ctx; + + rfid_card_event_t card_event = { + .driver_event = *event, + .decoded = {0}, + .is_decoded = false, + }; + + if (event->type == YS_RFID2_EVENT_CARD_DETECTED) { + card_event.is_decoded = rfid_protocol_registry_decode_all(&event->raw, &card_event.decoded); + + if (card_event.is_decoded) { + ESP_LOGI(TAG, + "Card: %s — FC:%u ID:%u", + card_event.decoded.protocol_name, + (unsigned)card_event.decoded.facility_code, + (unsigned)card_event.decoded.card_number); + } else { + ESP_LOGI(TAG, "Card: unknown — raw: %s", event->raw.id_str); + } + + s_mgr.last_event = card_event; + s_mgr.has_last_event = true; + } + + if (s_mgr.cb != NULL) { + s_mgr.cb(&card_event, s_mgr.ctx); + } +} diff --git a/firmware_p4/components/Applications/rfid/rfid_storage.c b/firmware_p4/components/Applications/rfid/rfid_storage.c new file mode 100644 index 00000000..5c06d3c6 --- /dev/null +++ b/firmware_p4/components/Applications/rfid/rfid_storage.c @@ -0,0 +1,222 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#include "rfid_storage.h" + +#include + +#include "esp_log.h" +#include "nvs_flash.h" +#include "nvs.h" + +static const char *TAG = "RFID_STORAGE"; + +#define NVS_NAMESPACE "rfid_cards" +#define NVS_KEY_COUNT "count" +#define NVS_KEY_PREFIX "card_" +#define NVS_KEY_MAX 16 + +static int s_count = 0; +static bool s_is_init = false; + +static void build_key(int index, char *out_key) { + snprintf(out_key, NVS_KEY_MAX, "%s%d", NVS_KEY_PREFIX, index); +} + +void rfid_storage_init(void) { + if (s_is_init) { + return; + } + + nvs_handle_t handle; + esp_err_t ret = nvs_open(NVS_NAMESPACE, NVS_READONLY, &handle); + if (ret == ESP_OK) { + int32_t count = 0; + if (nvs_get_i32(handle, NVS_KEY_COUNT, &count) == ESP_OK) { + s_count = (int)count; + } + nvs_close(handle); + } + + s_is_init = true; + ESP_LOGI(TAG, "Initialized — %d entries", s_count); +} + +int rfid_storage_count(void) { + return s_count; +} + +esp_err_t rfid_storage_save(const char *name, + const ys_rfid2_raw_data_t *raw, + const rfid_decoded_data_t *decoded, + bool is_decoded) { + if (name == NULL || raw == NULL) { + return ESP_ERR_INVALID_ARG; + } + + if (s_count >= RFID_STORAGE_MAX_ENTRIES) { + ESP_LOGW(TAG, "Storage full (%d entries)", s_count); + return ESP_ERR_NO_MEM; + } + + rfid_storage_entry_t entry = {0}; + strncpy(entry.name, name, RFID_STORAGE_NAME_MAX - 1); + entry.raw = *raw; + entry.is_decoded = is_decoded; + if (is_decoded && decoded != NULL) { + entry.decoded = *decoded; + } + + nvs_handle_t handle; + esp_err_t ret = nvs_open(NVS_NAMESPACE, NVS_READWRITE, &handle); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "Failed to open NVS: %s", esp_err_to_name(ret)); + return ESP_FAIL; + } + + char key[NVS_KEY_MAX]; + build_key(s_count, key); + + ret = nvs_set_blob(handle, key, &entry, sizeof(entry)); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "Failed to write entry: %s", esp_err_to_name(ret)); + nvs_close(handle); + return ESP_FAIL; + } + + s_count++; + nvs_set_i32(handle, NVS_KEY_COUNT, (int32_t)s_count); + nvs_commit(handle); + nvs_close(handle); + + ESP_LOGI(TAG, "Saved '%s' at index %d", name, s_count - 1); + return ESP_OK; +} + +esp_err_t rfid_storage_load(int index, rfid_storage_entry_t *out_entry) { + if (out_entry == NULL || index < 0 || index >= s_count) { + return ESP_ERR_INVALID_ARG; + } + + nvs_handle_t handle; + esp_err_t ret = nvs_open(NVS_NAMESPACE, NVS_READONLY, &handle); + if (ret != ESP_OK) { + return ESP_FAIL; + } + + char key[NVS_KEY_MAX]; + build_key(index, key); + + size_t len = sizeof(rfid_storage_entry_t); + ret = nvs_get_blob(handle, key, out_entry, &len); + nvs_close(handle); + + if (ret != ESP_OK) { + return ESP_ERR_NOT_FOUND; + } + + return ESP_OK; +} + +esp_err_t rfid_storage_get_info(int index, rfid_storage_info_t *out_info) { + if (out_info == NULL || index < 0 || index >= s_count) { + return ESP_ERR_INVALID_ARG; + } + + rfid_storage_entry_t entry = {0}; + esp_err_t ret = rfid_storage_load(index, &entry); + if (ret != ESP_OK) { + return ret; + } + + strncpy(out_info->name, entry.name, RFID_STORAGE_NAME_MAX - 1); + out_info->protocol_name = entry.is_decoded ? entry.decoded.protocol_name : "Unknown"; + out_info->card_number = entry.decoded.card_number; + out_info->facility_code = entry.decoded.facility_code; + + return ESP_OK; +} + +int rfid_storage_list(rfid_storage_info_t *out_infos, int max) { + if (out_infos == NULL) { + return 0; + } + + int listed = 0; + for (int i = 0; i < s_count && listed < max; i++) { + if (rfid_storage_get_info(i, &out_infos[listed]) == ESP_OK) { + listed++; + } + } + + return listed; +} + +esp_err_t rfid_storage_delete(int index) { + if (index < 0 || index >= s_count) { + return ESP_ERR_INVALID_ARG; + } + + nvs_handle_t handle; + esp_err_t ret = nvs_open(NVS_NAMESPACE, NVS_READWRITE, &handle); + if (ret != ESP_OK) { + return ESP_FAIL; + } + + // Shift entries down to fill the gap + for (int i = index; i < s_count - 1; i++) { + rfid_storage_entry_t entry = {0}; + char src_key[NVS_KEY_MAX]; + char dst_key[NVS_KEY_MAX]; + build_key(i + 1, src_key); + build_key(i, dst_key); + + size_t len = sizeof(rfid_storage_entry_t); + if (nvs_get_blob(handle, src_key, &entry, &len) == ESP_OK) { + nvs_set_blob(handle, dst_key, &entry, sizeof(entry)); + } + } + + // Remove last entry + char last_key[NVS_KEY_MAX]; + build_key(s_count - 1, last_key); + nvs_erase_key(handle, last_key); + + s_count--; + nvs_set_i32(handle, NVS_KEY_COUNT, (int32_t)s_count); + nvs_commit(handle); + nvs_close(handle); + + ESP_LOGI(TAG, "Deleted index %d, %d entries remaining", index, s_count); + return ESP_OK; +} + +esp_err_t rfid_storage_find_by_id(const char *id_str, int *out_index) { + if (id_str == NULL || out_index == NULL) { + return ESP_ERR_INVALID_ARG; + } + + for (int i = 0; i < s_count; i++) { + rfid_storage_entry_t entry = {0}; + if (rfid_storage_load(i, &entry) == ESP_OK) { + if (strcmp(entry.raw.id_str, id_str) == 0) { + *out_index = i; + return ESP_OK; + } + } + } + + return ESP_ERR_NOT_FOUND; +} diff --git a/firmware_p4/components/Applications/ui/assets_manager.c b/firmware_p4/components/Applications/ui/assets_manager.c index b67a09cf..80d47358 100644 --- a/firmware_p4/components/Applications/ui/assets_manager.c +++ b/firmware_p4/components/Applications/ui/assets_manager.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "assets_manager.h" diff --git a/firmware_p4/components/Applications/ui/components/button/button_ui.c b/firmware_p4/components/Applications/ui/components/button/button_ui.c index a6e5cf49..a67b96b4 100644 --- a/firmware_p4/components/Applications/ui/components/button/button_ui.c +++ b/firmware_p4/components/Applications/ui/components/button/button_ui.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "button_ui.h" diff --git a/firmware_p4/components/Applications/ui/components/button/include/button_ui.h b/firmware_p4/components/Applications/ui/components/button/include/button_ui.h index cd98ab2e..5b11ccd6 100644 --- a/firmware_p4/components/Applications/ui/components/button/include/button_ui.h +++ b/firmware_p4/components/Applications/ui/components/button/include/button_ui.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef UI_BUTTON_H #define UI_BUTTON_H diff --git a/firmware_p4/components/Applications/ui/components/chart/area_chart_ui.c b/firmware_p4/components/Applications/ui/components/chart/area_chart_ui.c index 8a65164a..85f1b0b0 100644 --- a/firmware_p4/components/Applications/ui/components/chart/area_chart_ui.c +++ b/firmware_p4/components/Applications/ui/components/chart/area_chart_ui.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "area_chart_ui.h" diff --git a/firmware_p4/components/Applications/ui/components/chart/chart_ui.c b/firmware_p4/components/Applications/ui/components/chart/chart_ui.c index 59a8896f..cbb0a584 100644 --- a/firmware_p4/components/Applications/ui/components/chart/chart_ui.c +++ b/firmware_p4/components/Applications/ui/components/chart/chart_ui.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "chart_ui.h" diff --git a/firmware_p4/components/Applications/ui/components/chart/include/area_chart_ui.h b/firmware_p4/components/Applications/ui/components/chart/include/area_chart_ui.h index 56353ff4..a8d59200 100644 --- a/firmware_p4/components/Applications/ui/components/chart/include/area_chart_ui.h +++ b/firmware_p4/components/Applications/ui/components/chart/include/area_chart_ui.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef UI_AREA_CHART_H #define UI_AREA_CHART_H diff --git a/firmware_p4/components/Applications/ui/components/chart/include/chart_ui.h b/firmware_p4/components/Applications/ui/components/chart/include/chart_ui.h index 8940a017..c8e88558 100644 --- a/firmware_p4/components/Applications/ui/components/chart/include/chart_ui.h +++ b/firmware_p4/components/Applications/ui/components/chart/include/chart_ui.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef UI_CHART_H #define UI_CHART_H diff --git a/firmware_p4/components/Applications/ui/components/dropdown/dropdown_ui.c b/firmware_p4/components/Applications/ui/components/dropdown/dropdown_ui.c index f3336eb8..e373f445 100644 --- a/firmware_p4/components/Applications/ui/components/dropdown/dropdown_ui.c +++ b/firmware_p4/components/Applications/ui/components/dropdown/dropdown_ui.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "dropdown_ui.h" diff --git a/firmware_p4/components/Applications/ui/components/dropdown/include/dropdown_ui.h b/firmware_p4/components/Applications/ui/components/dropdown/include/dropdown_ui.h index a68762a1..4973fd8c 100644 --- a/firmware_p4/components/Applications/ui/components/dropdown/include/dropdown_ui.h +++ b/firmware_p4/components/Applications/ui/components/dropdown/include/dropdown_ui.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef UI_DROPDOWN_H #define UI_DROPDOWN_H diff --git a/firmware_p4/components/Applications/ui/components/footer/footer_ui.c b/firmware_p4/components/Applications/ui/components/footer/footer_ui.c index f342e227..a47e88cb 100644 --- a/firmware_p4/components/Applications/ui/components/footer/footer_ui.c +++ b/firmware_p4/components/Applications/ui/components/footer/footer_ui.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "footer_ui.h" diff --git a/firmware_p4/components/Applications/ui/components/footer/include/footer_ui.h b/firmware_p4/components/Applications/ui/components/footer/include/footer_ui.h index 98c395d2..a5f990d0 100644 --- a/firmware_p4/components/Applications/ui/components/footer/include/footer_ui.h +++ b/firmware_p4/components/Applications/ui/components/footer/include/footer_ui.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef UI_FOOTER_H #define UI_FOOTER_H diff --git a/firmware_p4/components/Applications/ui/components/header/header_ui.c b/firmware_p4/components/Applications/ui/components/header/header_ui.c index ed4bff9c..06dc749e 100644 --- a/firmware_p4/components/Applications/ui/components/header/header_ui.c +++ b/firmware_p4/components/Applications/ui/components/header/header_ui.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "header_ui.h" diff --git a/firmware_p4/components/Applications/ui/components/header/include/header_ui.h b/firmware_p4/components/Applications/ui/components/header/include/header_ui.h index f803039a..e5d924c2 100644 --- a/firmware_p4/components/Applications/ui/components/header/include/header_ui.h +++ b/firmware_p4/components/Applications/ui/components/header/include/header_ui.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef UI_HEADER_H #define UI_HEADER_H diff --git a/firmware_p4/components/Applications/ui/components/intensity_bar/include/intensity_bar_ui.h b/firmware_p4/components/Applications/ui/components/intensity_bar/include/intensity_bar_ui.h index 906da2a6..270b77c4 100644 --- a/firmware_p4/components/Applications/ui/components/intensity_bar/include/intensity_bar_ui.h +++ b/firmware_p4/components/Applications/ui/components/intensity_bar/include/intensity_bar_ui.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef UI_INTENSITY_BAR_H #define UI_INTENSITY_BAR_H diff --git a/firmware_p4/components/Applications/ui/components/intensity_bar/intensity_bar_ui.c b/firmware_p4/components/Applications/ui/components/intensity_bar/intensity_bar_ui.c index bb63e4f6..e36463f0 100644 --- a/firmware_p4/components/Applications/ui/components/intensity_bar/intensity_bar_ui.c +++ b/firmware_p4/components/Applications/ui/components/intensity_bar/intensity_bar_ui.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "intensity_bar_ui.h" diff --git a/firmware_p4/components/Applications/ui/components/keyboard/include/keyboard_ui.h b/firmware_p4/components/Applications/ui/components/keyboard/include/keyboard_ui.h index 1af0ff39..45385581 100644 --- a/firmware_p4/components/Applications/ui/components/keyboard/include/keyboard_ui.h +++ b/firmware_p4/components/Applications/ui/components/keyboard/include/keyboard_ui.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef KEYBOARD_UI_H #define KEYBOARD_UI_H diff --git a/firmware_p4/components/Applications/ui/components/keyboard/keyboard_ui.c b/firmware_p4/components/Applications/ui/components/keyboard/keyboard_ui.c index 0193d81a..5c7cebf8 100644 --- a/firmware_p4/components/Applications/ui/components/keyboard/keyboard_ui.c +++ b/firmware_p4/components/Applications/ui/components/keyboard/keyboard_ui.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "keyboard_ui.h" diff --git a/firmware_p4/components/Applications/ui/components/menu_component/include/menu_component_ui.h b/firmware_p4/components/Applications/ui/components/menu_component/include/menu_component_ui.h index 55aa7d28..b06ba18a 100644 --- a/firmware_p4/components/Applications/ui/components/menu_component/include/menu_component_ui.h +++ b/firmware_p4/components/Applications/ui/components/menu_component/include/menu_component_ui.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef UI_MENU_COMPONENT_H #define UI_MENU_COMPONENT_H diff --git a/firmware_p4/components/Applications/ui/components/menu_component/menu_component_ui.c b/firmware_p4/components/Applications/ui/components/menu_component/menu_component_ui.c index 704e3bd4..246af12a 100644 --- a/firmware_p4/components/Applications/ui/components/menu_component/menu_component_ui.c +++ b/firmware_p4/components/Applications/ui/components/menu_component/menu_component_ui.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "menu_component_ui.h" diff --git a/firmware_p4/components/Applications/ui/components/message_box/include/msgbox_ui.h b/firmware_p4/components/Applications/ui/components/message_box/include/msgbox_ui.h index 37f2dd46..193374b5 100644 --- a/firmware_p4/components/Applications/ui/components/message_box/include/msgbox_ui.h +++ b/firmware_p4/components/Applications/ui/components/message_box/include/msgbox_ui.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef MSGBOX_UI_H #define MSGBOX_UI_H diff --git a/firmware_p4/components/Applications/ui/components/message_box/msgbox_ui.c b/firmware_p4/components/Applications/ui/components/message_box/msgbox_ui.c index 6ae88763..167dfe67 100644 --- a/firmware_p4/components/Applications/ui/components/message_box/msgbox_ui.c +++ b/firmware_p4/components/Applications/ui/components/message_box/msgbox_ui.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "msgbox_ui.h" diff --git a/firmware_p4/components/Applications/ui/components/page_dots/include/page_dots_ui.h b/firmware_p4/components/Applications/ui/components/page_dots/include/page_dots_ui.h index f73c3698..b2736258 100644 --- a/firmware_p4/components/Applications/ui/components/page_dots/include/page_dots_ui.h +++ b/firmware_p4/components/Applications/ui/components/page_dots/include/page_dots_ui.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef UI_PAGE_DOTS_H #define UI_PAGE_DOTS_H diff --git a/firmware_p4/components/Applications/ui/components/page_dots/page_dots_ui.c b/firmware_p4/components/Applications/ui/components/page_dots/page_dots_ui.c index 39c5e917..0a24e3e0 100644 --- a/firmware_p4/components/Applications/ui/components/page_dots/page_dots_ui.c +++ b/firmware_p4/components/Applications/ui/components/page_dots/page_dots_ui.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "page_dots_ui.h" diff --git a/firmware_p4/components/Applications/ui/components/spinner/include/spinner_ui.h b/firmware_p4/components/Applications/ui/components/spinner/include/spinner_ui.h index c996f9c5..fbc53dcd 100644 --- a/firmware_p4/components/Applications/ui/components/spinner/include/spinner_ui.h +++ b/firmware_p4/components/Applications/ui/components/spinner/include/spinner_ui.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef SPINNER_UI_H #define SPINNER_UI_H diff --git a/firmware_p4/components/Applications/ui/components/spinner/spinner_ui.c b/firmware_p4/components/Applications/ui/components/spinner/spinner_ui.c index 64ba367d..a34fba48 100644 --- a/firmware_p4/components/Applications/ui/components/spinner/spinner_ui.c +++ b/firmware_p4/components/Applications/ui/components/spinner/spinner_ui.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "spinner_ui.h" diff --git a/firmware_p4/components/Applications/ui/components/terminal/include/terminal_ui.h b/firmware_p4/components/Applications/ui/components/terminal/include/terminal_ui.h index b8f2aa75..530a8929 100644 --- a/firmware_p4/components/Applications/ui/components/terminal/include/terminal_ui.h +++ b/firmware_p4/components/Applications/ui/components/terminal/include/terminal_ui.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef UI_TERMINAL_H #define UI_TERMINAL_H diff --git a/firmware_p4/components/Applications/ui/components/terminal/terminal_ui.c b/firmware_p4/components/Applications/ui/components/terminal/terminal_ui.c index 5caa1a0d..cac236de 100644 --- a/firmware_p4/components/Applications/ui/components/terminal/terminal_ui.c +++ b/firmware_p4/components/Applications/ui/components/terminal/terminal_ui.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "terminal_ui.h" diff --git a/firmware_p4/components/Applications/ui/components/text_viewer/include/text_viewer_ui.h b/firmware_p4/components/Applications/ui/components/text_viewer/include/text_viewer_ui.h index 309fc66b..2a3adeaa 100644 --- a/firmware_p4/components/Applications/ui/components/text_viewer/include/text_viewer_ui.h +++ b/firmware_p4/components/Applications/ui/components/text_viewer/include/text_viewer_ui.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef UI_TEXT_VIEWER_H #define UI_TEXT_VIEWER_H diff --git a/firmware_p4/components/Applications/ui/components/text_viewer/text_viewer_ui.c b/firmware_p4/components/Applications/ui/components/text_viewer/text_viewer_ui.c index 634209f9..2551ed14 100644 --- a/firmware_p4/components/Applications/ui/components/text_viewer/text_viewer_ui.c +++ b/firmware_p4/components/Applications/ui/components/text_viewer/text_viewer_ui.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "text_viewer_ui.h" diff --git a/firmware_p4/components/Applications/ui/components/toggle/include/toggle_ui.h b/firmware_p4/components/Applications/ui/components/toggle/include/toggle_ui.h index 616e7494..c80c6773 100644 --- a/firmware_p4/components/Applications/ui/components/toggle/include/toggle_ui.h +++ b/firmware_p4/components/Applications/ui/components/toggle/include/toggle_ui.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef UI_TOGGLE_H #define UI_TOGGLE_H diff --git a/firmware_p4/components/Applications/ui/components/toggle/toggle_ui.c b/firmware_p4/components/Applications/ui/components/toggle/toggle_ui.c index d6213771..6a83a4be 100644 --- a/firmware_p4/components/Applications/ui/components/toggle/toggle_ui.c +++ b/firmware_p4/components/Applications/ui/components/toggle/toggle_ui.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "toggle_ui.h" diff --git a/firmware_p4/components/Applications/ui/include/assets_manager.h b/firmware_p4/components/Applications/ui/include/assets_manager.h index fbd9a4bc..162eeeea 100644 --- a/firmware_p4/components/Applications/ui/include/assets_manager.h +++ b/firmware_p4/components/Applications/ui/include/assets_manager.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef ASSETS_MANAGER_H #define ASSETS_MANAGER_H diff --git a/firmware_p4/components/Applications/ui/include/ui_manager.h b/firmware_p4/components/Applications/ui/include/ui_manager.h index d4a41bad..b12ab5d5 100644 --- a/firmware_p4/components/Applications/ui/include/ui_manager.h +++ b/firmware_p4/components/Applications/ui/include/ui_manager.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef UI_MANAGER_H #define UI_MANAGER_H diff --git a/firmware_p4/components/Applications/ui/include/ui_theme.h b/firmware_p4/components/Applications/ui/include/ui_theme.h index 40ebfbbc..cd6b499e 100644 --- a/firmware_p4/components/Applications/ui/include/ui_theme.h +++ b/firmware_p4/components/Applications/ui/include/ui_theme.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef UI_THEME_H #define UI_THEME_H diff --git a/firmware_p4/components/Applications/ui/screens/SubGhz/include/subghz_spectrum_ui.h b/firmware_p4/components/Applications/ui/screens/SubGhz/include/subghz_spectrum_ui.h index efa5ca88..dcb7c2a9 100644 --- a/firmware_p4/components/Applications/ui/screens/SubGhz/include/subghz_spectrum_ui.h +++ b/firmware_p4/components/Applications/ui/screens/SubGhz/include/subghz_spectrum_ui.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef SUBGHZ_SPECTRUM_UI_H #define SUBGHZ_SPECTRUM_UI_H diff --git a/firmware_p4/components/Applications/ui/screens/SubGhz/subghz_spectrum_ui.c b/firmware_p4/components/Applications/ui/screens/SubGhz/subghz_spectrum_ui.c index 7a2c8a1e..ec6f7458 100644 --- a/firmware_p4/components/Applications/ui/screens/SubGhz/subghz_spectrum_ui.c +++ b/firmware_p4/components/Applications/ui/screens/SubGhz/subghz_spectrum_ui.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "subghz_spectrum_ui.h" diff --git a/firmware_p4/components/Applications/ui/screens/about_settings/about_settings_ui.c b/firmware_p4/components/Applications/ui/screens/about_settings/about_settings_ui.c index 66f6d758..f6d89600 100644 --- a/firmware_p4/components/Applications/ui/screens/about_settings/about_settings_ui.c +++ b/firmware_p4/components/Applications/ui/screens/about_settings/about_settings_ui.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "about_settings_ui.h" @@ -73,7 +74,7 @@ void ui_about_settings_open(void) { lv_obj_set_style_text_color(version, current_theme.text_main, 0); lv_obj_t *hardware = lv_label_create(info_box); - lv_label_set_text(hardware, "HW: ESP32-S3"); + lv_label_set_text(hardware, "HW: ESP32-P4"); lv_obj_set_style_text_color(hardware, current_theme.text_main, 0); lv_obj_t *build = lv_label_create(info_box); diff --git a/firmware_p4/components/Applications/ui/screens/about_settings/include/about_settings_ui.h b/firmware_p4/components/Applications/ui/screens/about_settings/include/about_settings_ui.h index a8a0c663..805d336a 100644 --- a/firmware_p4/components/Applications/ui/screens/about_settings/include/about_settings_ui.h +++ b/firmware_p4/components/Applications/ui/screens/about_settings/include/about_settings_ui.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef ABOUT_SETTINGS_UI_H #define ABOUT_SETTINGS_UI_H diff --git a/firmware_p4/components/Applications/ui/screens/badusb/include/ui_badusb_browser.h b/firmware_p4/components/Applications/ui/screens/badusb/include/ui_badusb_browser.h index 1af82811..f4ec567a 100644 --- a/firmware_p4/components/Applications/ui/screens/badusb/include/ui_badusb_browser.h +++ b/firmware_p4/components/Applications/ui/screens/badusb/include/ui_badusb_browser.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef UI_BADUSB_BROWSER_H #define UI_BADUSB_BROWSER_H diff --git a/firmware_p4/components/Applications/ui/screens/badusb/include/ui_badusb_connect.h b/firmware_p4/components/Applications/ui/screens/badusb/include/ui_badusb_connect.h index 766a37b7..7b063116 100644 --- a/firmware_p4/components/Applications/ui/screens/badusb/include/ui_badusb_connect.h +++ b/firmware_p4/components/Applications/ui/screens/badusb/include/ui_badusb_connect.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef UI_BADUSB_CONNECT_H #define UI_BADUSB_CONNECT_H diff --git a/firmware_p4/components/Applications/ui/screens/badusb/include/ui_badusb_layout.h b/firmware_p4/components/Applications/ui/screens/badusb/include/ui_badusb_layout.h index 3661db69..9b5abc2d 100644 --- a/firmware_p4/components/Applications/ui/screens/badusb/include/ui_badusb_layout.h +++ b/firmware_p4/components/Applications/ui/screens/badusb/include/ui_badusb_layout.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef UI_BADUSB_LAYOUT_H #define UI_BADUSB_LAYOUT_H diff --git a/firmware_p4/components/Applications/ui/screens/badusb/include/ui_badusb_menu.h b/firmware_p4/components/Applications/ui/screens/badusb/include/ui_badusb_menu.h index 1eb90b4d..ba7ed0e6 100644 --- a/firmware_p4/components/Applications/ui/screens/badusb/include/ui_badusb_menu.h +++ b/firmware_p4/components/Applications/ui/screens/badusb/include/ui_badusb_menu.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef UI_BADUSB_MENU_H #define UI_BADUSB_MENU_H diff --git a/firmware_p4/components/Applications/ui/screens/badusb/include/ui_badusb_running.h b/firmware_p4/components/Applications/ui/screens/badusb/include/ui_badusb_running.h index 5619871e..1addf2ad 100644 --- a/firmware_p4/components/Applications/ui/screens/badusb/include/ui_badusb_running.h +++ b/firmware_p4/components/Applications/ui/screens/badusb/include/ui_badusb_running.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef UI_BADUSB_RUNNING_H #define UI_BADUSB_RUNNING_H diff --git a/firmware_p4/components/Applications/ui/screens/badusb/ui_badusb_browser.c b/firmware_p4/components/Applications/ui/screens/badusb/ui_badusb_browser.c index f01d9062..a4d4d38d 100644 --- a/firmware_p4/components/Applications/ui/screens/badusb/ui_badusb_browser.c +++ b/firmware_p4/components/Applications/ui/screens/badusb/ui_badusb_browser.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "ui_badusb_browser.h" diff --git a/firmware_p4/components/Applications/ui/screens/badusb/ui_badusb_connect.c b/firmware_p4/components/Applications/ui/screens/badusb/ui_badusb_connect.c index eae003c4..9a7efb08 100644 --- a/firmware_p4/components/Applications/ui/screens/badusb/ui_badusb_connect.c +++ b/firmware_p4/components/Applications/ui/screens/badusb/ui_badusb_connect.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "ui_badusb_connect.h" diff --git a/firmware_p4/components/Applications/ui/screens/badusb/ui_badusb_layout.c b/firmware_p4/components/Applications/ui/screens/badusb/ui_badusb_layout.c index 019937ff..60df26d9 100644 --- a/firmware_p4/components/Applications/ui/screens/badusb/ui_badusb_layout.c +++ b/firmware_p4/components/Applications/ui/screens/badusb/ui_badusb_layout.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "ui_badusb_layout.h" diff --git a/firmware_p4/components/Applications/ui/screens/badusb/ui_badusb_menu.c b/firmware_p4/components/Applications/ui/screens/badusb/ui_badusb_menu.c index 651c96f6..97b95593 100644 --- a/firmware_p4/components/Applications/ui/screens/badusb/ui_badusb_menu.c +++ b/firmware_p4/components/Applications/ui/screens/badusb/ui_badusb_menu.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "ui_badusb_menu.h" diff --git a/firmware_p4/components/Applications/ui/screens/badusb/ui_badusb_running.c b/firmware_p4/components/Applications/ui/screens/badusb/ui_badusb_running.c index 8a108d0d..24788500 100644 --- a/firmware_p4/components/Applications/ui/screens/badusb/ui_badusb_running.c +++ b/firmware_p4/components/Applications/ui/screens/badusb/ui_badusb_running.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "ui_badusb_running.h" diff --git a/firmware_p4/components/Applications/ui/screens/battery_settings/battery_settings_ui.c b/firmware_p4/components/Applications/ui/screens/battery_settings/battery_settings_ui.c index 3aa128ec..1f65cac9 100644 --- a/firmware_p4/components/Applications/ui/screens/battery_settings/battery_settings_ui.c +++ b/firmware_p4/components/Applications/ui/screens/battery_settings/battery_settings_ui.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "battery_settings_ui.h" diff --git a/firmware_p4/components/Applications/ui/screens/battery_settings/include/battery_settings_ui.h b/firmware_p4/components/Applications/ui/screens/battery_settings/include/battery_settings_ui.h index 7ea3fe24..a221fcfb 100644 --- a/firmware_p4/components/Applications/ui/screens/battery_settings/include/battery_settings_ui.h +++ b/firmware_p4/components/Applications/ui/screens/battery_settings/include/battery_settings_ui.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef BATTERY_SETTINGS_UI_H #define BATTERY_SETTINGS_UI_H diff --git a/firmware_p4/components/Applications/ui/screens/bluetooth/include/ui_ble_menu.h b/firmware_p4/components/Applications/ui/screens/bluetooth/include/ui_ble_menu.h index 1537743a..4cbbb3ca 100644 --- a/firmware_p4/components/Applications/ui/screens/bluetooth/include/ui_ble_menu.h +++ b/firmware_p4/components/Applications/ui/screens/bluetooth/include/ui_ble_menu.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef UI_BLE_MENU_H #define UI_BLE_MENU_H diff --git a/firmware_p4/components/Applications/ui/screens/bluetooth/include/ui_ble_spam.h b/firmware_p4/components/Applications/ui/screens/bluetooth/include/ui_ble_spam.h index c479be55..249aa824 100644 --- a/firmware_p4/components/Applications/ui/screens/bluetooth/include/ui_ble_spam.h +++ b/firmware_p4/components/Applications/ui/screens/bluetooth/include/ui_ble_spam.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef UI_BLE_SPAM_H #define UI_BLE_SPAM_H diff --git a/firmware_p4/components/Applications/ui/screens/bluetooth/include/ui_ble_spam_select.h b/firmware_p4/components/Applications/ui/screens/bluetooth/include/ui_ble_spam_select.h index afa46d5b..f2a774c6 100644 --- a/firmware_p4/components/Applications/ui/screens/bluetooth/include/ui_ble_spam_select.h +++ b/firmware_p4/components/Applications/ui/screens/bluetooth/include/ui_ble_spam_select.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef UI_BLE_SPAM_SELECT_H #define UI_BLE_SPAM_SELECT_H diff --git a/firmware_p4/components/Applications/ui/screens/bluetooth/ui_ble_menu.c b/firmware_p4/components/Applications/ui/screens/bluetooth/ui_ble_menu.c index 91ba7c7f..7fd33e3d 100644 --- a/firmware_p4/components/Applications/ui/screens/bluetooth/ui_ble_menu.c +++ b/firmware_p4/components/Applications/ui/screens/bluetooth/ui_ble_menu.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "ui_ble_menu.h" diff --git a/firmware_p4/components/Applications/ui/screens/bluetooth/ui_ble_spam.c b/firmware_p4/components/Applications/ui/screens/bluetooth/ui_ble_spam.c index 856d4585..f997a348 100644 --- a/firmware_p4/components/Applications/ui/screens/bluetooth/ui_ble_spam.c +++ b/firmware_p4/components/Applications/ui/screens/bluetooth/ui_ble_spam.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "ui_ble_spam.h" diff --git a/firmware_p4/components/Applications/ui/screens/bluetooth/ui_ble_spam_select.c b/firmware_p4/components/Applications/ui/screens/bluetooth/ui_ble_spam_select.c index 3d0b0787..6841520a 100644 --- a/firmware_p4/components/Applications/ui/screens/bluetooth/ui_ble_spam_select.c +++ b/firmware_p4/components/Applications/ui/screens/bluetooth/ui_ble_spam_select.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "ui_ble_spam_select.h" diff --git a/firmware_p4/components/Applications/ui/screens/boot/boot_ui.c b/firmware_p4/components/Applications/ui/screens/boot/boot_ui.c index 8a462a9f..66cf50b6 100644 --- a/firmware_p4/components/Applications/ui/screens/boot/boot_ui.c +++ b/firmware_p4/components/Applications/ui/screens/boot/boot_ui.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "boot_ui.h" diff --git a/firmware_p4/components/Applications/ui/screens/boot/include/boot_ui.h b/firmware_p4/components/Applications/ui/screens/boot/include/boot_ui.h index b7eb9389..90bc147d 100644 --- a/firmware_p4/components/Applications/ui/screens/boot/include/boot_ui.h +++ b/firmware_p4/components/Applications/ui/screens/boot/include/boot_ui.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef BOOT_UI_H #define BOOT_UI_H diff --git a/firmware_p4/components/Applications/ui/screens/connect_bluetooth/connect_bt_ui.c b/firmware_p4/components/Applications/ui/screens/connect_bluetooth/connect_bt_ui.c index ebe3d7fe..d6bee2f7 100644 --- a/firmware_p4/components/Applications/ui/screens/connect_bluetooth/connect_bt_ui.c +++ b/firmware_p4/components/Applications/ui/screens/connect_bluetooth/connect_bt_ui.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "connect_bt_ui.h" diff --git a/firmware_p4/components/Applications/ui/screens/connect_bluetooth/include/connect_bt_ui.h b/firmware_p4/components/Applications/ui/screens/connect_bluetooth/include/connect_bt_ui.h index 1b961319..df7e9d8e 100644 --- a/firmware_p4/components/Applications/ui/screens/connect_bluetooth/include/connect_bt_ui.h +++ b/firmware_p4/components/Applications/ui/screens/connect_bluetooth/include/connect_bt_ui.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef CONNECT_BT_UI_H #define CONNECT_BT_UI_H diff --git a/firmware_p4/components/Applications/ui/screens/connect_wifi/connect_wifi_ui.c b/firmware_p4/components/Applications/ui/screens/connect_wifi/connect_wifi_ui.c index 35d0a975..a57a356e 100644 --- a/firmware_p4/components/Applications/ui/screens/connect_wifi/connect_wifi_ui.c +++ b/firmware_p4/components/Applications/ui/screens/connect_wifi/connect_wifi_ui.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "connect_wifi_ui.h" diff --git a/firmware_p4/components/Applications/ui/screens/connect_wifi/include/connect_wifi_ui.h b/firmware_p4/components/Applications/ui/screens/connect_wifi/include/connect_wifi_ui.h index 3befefc3..a9ccd0d4 100644 --- a/firmware_p4/components/Applications/ui/screens/connect_wifi/include/connect_wifi_ui.h +++ b/firmware_p4/components/Applications/ui/screens/connect_wifi/include/connect_wifi_ui.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef CONNECT_WIFI_UI_H #define CONNECT_WIFI_UI_H diff --git a/firmware_p4/components/Applications/ui/screens/connection_settings/connection_settings_ui.c b/firmware_p4/components/Applications/ui/screens/connection_settings/connection_settings_ui.c index c8dfd9ed..bdf13754 100644 --- a/firmware_p4/components/Applications/ui/screens/connection_settings/connection_settings_ui.c +++ b/firmware_p4/components/Applications/ui/screens/connection_settings/connection_settings_ui.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "connection_settings_ui.h" diff --git a/firmware_p4/components/Applications/ui/screens/connection_settings/include/connection_settings_ui.h b/firmware_p4/components/Applications/ui/screens/connection_settings/include/connection_settings_ui.h index 36f75dc3..8184341f 100644 --- a/firmware_p4/components/Applications/ui/screens/connection_settings/include/connection_settings_ui.h +++ b/firmware_p4/components/Applications/ui/screens/connection_settings/include/connection_settings_ui.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef CONNECTION_SETTINGS_UI_H #define CONNECTION_SETTINGS_UI_H diff --git a/firmware_p4/components/Applications/ui/screens/display_settings/display_settings_ui.c b/firmware_p4/components/Applications/ui/screens/display_settings/display_settings_ui.c index 345a7078..47d4c94e 100644 --- a/firmware_p4/components/Applications/ui/screens/display_settings/display_settings_ui.c +++ b/firmware_p4/components/Applications/ui/screens/display_settings/display_settings_ui.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "display_settings_ui.h" diff --git a/firmware_p4/components/Applications/ui/screens/display_settings/include/display_settings_ui.h b/firmware_p4/components/Applications/ui/screens/display_settings/include/display_settings_ui.h index 3e97b792..3fee9870 100644 --- a/firmware_p4/components/Applications/ui/screens/display_settings/include/display_settings_ui.h +++ b/firmware_p4/components/Applications/ui/screens/display_settings/include/display_settings_ui.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef DISPLAY_SETTINGS_UI_H #define DISPLAY_SETTINGS_UI_H diff --git a/firmware_p4/components/Applications/ui/screens/files/files_ui.c b/firmware_p4/components/Applications/ui/screens/files/files_ui.c index e0bae45b..755cb519 100644 --- a/firmware_p4/components/Applications/ui/screens/files/files_ui.c +++ b/firmware_p4/components/Applications/ui/screens/files/files_ui.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "files_ui.h" diff --git a/firmware_p4/components/Applications/ui/screens/files/include/files_ui.h b/firmware_p4/components/Applications/ui/screens/files/include/files_ui.h index 1688554c..9b47a3dc 100644 --- a/firmware_p4/components/Applications/ui/screens/files/include/files_ui.h +++ b/firmware_p4/components/Applications/ui/screens/files/include/files_ui.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef FILES_UI_H #define FILES_UI_H diff --git a/firmware_p4/components/Applications/ui/screens/home/home_ui.c b/firmware_p4/components/Applications/ui/screens/home/home_ui.c index 6700359b..f7ae0efb 100644 --- a/firmware_p4/components/Applications/ui/screens/home/home_ui.c +++ b/firmware_p4/components/Applications/ui/screens/home/home_ui.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "home_ui.h" diff --git a/firmware_p4/components/Applications/ui/screens/home/include/home_ui.h b/firmware_p4/components/Applications/ui/screens/home/include/home_ui.h index 0205bfa7..1064c616 100644 --- a/firmware_p4/components/Applications/ui/screens/home/include/home_ui.h +++ b/firmware_p4/components/Applications/ui/screens/home/include/home_ui.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef HOME_UI_H #define HOME_UI_H diff --git a/firmware_p4/components/Applications/ui/screens/infrared/include/ir_burst_ui.h b/firmware_p4/components/Applications/ui/screens/infrared/include/ir_burst_ui.h index d40013db..7202e504 100644 --- a/firmware_p4/components/Applications/ui/screens/infrared/include/ir_burst_ui.h +++ b/firmware_p4/components/Applications/ui/screens/infrared/include/ir_burst_ui.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef IR_BURST_UI_H #define IR_BURST_UI_H diff --git a/firmware_p4/components/Applications/ui/screens/infrared/include/ir_controller_ui.h b/firmware_p4/components/Applications/ui/screens/infrared/include/ir_controller_ui.h index 85604e74..e27eec77 100644 --- a/firmware_p4/components/Applications/ui/screens/infrared/include/ir_controller_ui.h +++ b/firmware_p4/components/Applications/ui/screens/infrared/include/ir_controller_ui.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef IR_CONTROLLER_UI_H #define IR_CONTROLLER_UI_H diff --git a/firmware_p4/components/Applications/ui/screens/infrared/include/ir_menu_ui.h b/firmware_p4/components/Applications/ui/screens/infrared/include/ir_menu_ui.h index 430a66ba..d2b898ee 100644 --- a/firmware_p4/components/Applications/ui/screens/infrared/include/ir_menu_ui.h +++ b/firmware_p4/components/Applications/ui/screens/infrared/include/ir_menu_ui.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef IR_MENU_UI_H #define IR_MENU_UI_H diff --git a/firmware_p4/components/Applications/ui/screens/infrared/include/ir_receive_ui.h b/firmware_p4/components/Applications/ui/screens/infrared/include/ir_receive_ui.h index 58939e9c..a9a8c56a 100644 --- a/firmware_p4/components/Applications/ui/screens/infrared/include/ir_receive_ui.h +++ b/firmware_p4/components/Applications/ui/screens/infrared/include/ir_receive_ui.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef IR_RECEIVE_UI_H #define IR_RECEIVE_UI_H diff --git a/firmware_p4/components/Applications/ui/screens/infrared/include/ir_saved_ui.h b/firmware_p4/components/Applications/ui/screens/infrared/include/ir_saved_ui.h index 50ee4e08..7fd00526 100644 --- a/firmware_p4/components/Applications/ui/screens/infrared/include/ir_saved_ui.h +++ b/firmware_p4/components/Applications/ui/screens/infrared/include/ir_saved_ui.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef IR_SAVED_UI_H #define IR_SAVED_UI_H diff --git a/firmware_p4/components/Applications/ui/screens/infrared/include/ir_send_ui.h b/firmware_p4/components/Applications/ui/screens/infrared/include/ir_send_ui.h index 493b7234..1081222a 100644 --- a/firmware_p4/components/Applications/ui/screens/infrared/include/ir_send_ui.h +++ b/firmware_p4/components/Applications/ui/screens/infrared/include/ir_send_ui.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef IR_SEND_UI_H #define IR_SEND_UI_H diff --git a/firmware_p4/components/Applications/ui/screens/infrared/ir_burst_ui.c b/firmware_p4/components/Applications/ui/screens/infrared/ir_burst_ui.c index 88feb8b3..d7315a72 100644 --- a/firmware_p4/components/Applications/ui/screens/infrared/ir_burst_ui.c +++ b/firmware_p4/components/Applications/ui/screens/infrared/ir_burst_ui.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "ir_burst_ui.h" diff --git a/firmware_p4/components/Applications/ui/screens/infrared/ir_controller_ui.c b/firmware_p4/components/Applications/ui/screens/infrared/ir_controller_ui.c index f7dca875..2f884c43 100644 --- a/firmware_p4/components/Applications/ui/screens/infrared/ir_controller_ui.c +++ b/firmware_p4/components/Applications/ui/screens/infrared/ir_controller_ui.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "ir_controller_ui.h" diff --git a/firmware_p4/components/Applications/ui/screens/infrared/ir_menu_ui.c b/firmware_p4/components/Applications/ui/screens/infrared/ir_menu_ui.c index 41f7a661..37caa905 100644 --- a/firmware_p4/components/Applications/ui/screens/infrared/ir_menu_ui.c +++ b/firmware_p4/components/Applications/ui/screens/infrared/ir_menu_ui.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "ir_menu_ui.h" diff --git a/firmware_p4/components/Applications/ui/screens/infrared/ir_receive_ui.c b/firmware_p4/components/Applications/ui/screens/infrared/ir_receive_ui.c index 56c736d2..dbf02e31 100644 --- a/firmware_p4/components/Applications/ui/screens/infrared/ir_receive_ui.c +++ b/firmware_p4/components/Applications/ui/screens/infrared/ir_receive_ui.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "ir_receive_ui.h" diff --git a/firmware_p4/components/Applications/ui/screens/infrared/ir_saved_ui.c b/firmware_p4/components/Applications/ui/screens/infrared/ir_saved_ui.c index 50845daf..7bbc4026 100644 --- a/firmware_p4/components/Applications/ui/screens/infrared/ir_saved_ui.c +++ b/firmware_p4/components/Applications/ui/screens/infrared/ir_saved_ui.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "ir_saved_ui.h" diff --git a/firmware_p4/components/Applications/ui/screens/infrared/ir_send_ui.c b/firmware_p4/components/Applications/ui/screens/infrared/ir_send_ui.c index de6c34f3..7199ba7b 100644 --- a/firmware_p4/components/Applications/ui/screens/infrared/ir_send_ui.c +++ b/firmware_p4/components/Applications/ui/screens/infrared/ir_send_ui.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "ir_send_ui.h" diff --git a/firmware_p4/components/Applications/ui/screens/interface_settings/include/interface_settings_ui.h b/firmware_p4/components/Applications/ui/screens/interface_settings/include/interface_settings_ui.h index 6da7040b..0f82fb12 100644 --- a/firmware_p4/components/Applications/ui/screens/interface_settings/include/interface_settings_ui.h +++ b/firmware_p4/components/Applications/ui/screens/interface_settings/include/interface_settings_ui.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef INTERFACE_SETTINGS_UI_H #define INTERFACE_SETTINGS_UI_H diff --git a/firmware_p4/components/Applications/ui/screens/interface_settings/interface_settings_ui.c b/firmware_p4/components/Applications/ui/screens/interface_settings/interface_settings_ui.c index 5e99ec3a..d990c3a6 100644 --- a/firmware_p4/components/Applications/ui/screens/interface_settings/interface_settings_ui.c +++ b/firmware_p4/components/Applications/ui/screens/interface_settings/interface_settings_ui.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "interface_settings_ui.h" diff --git a/firmware_p4/components/Applications/ui/screens/menu/include/menu_ui.h b/firmware_p4/components/Applications/ui/screens/menu/include/menu_ui.h index e95513e2..c9607703 100644 --- a/firmware_p4/components/Applications/ui/screens/menu/include/menu_ui.h +++ b/firmware_p4/components/Applications/ui/screens/menu/include/menu_ui.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef MENU_UI_H #define MENU_UI_H diff --git a/firmware_p4/components/Applications/ui/screens/menu/menu_ui.c b/firmware_p4/components/Applications/ui/screens/menu/menu_ui.c index a84edef5..7325727f 100644 --- a/firmware_p4/components/Applications/ui/screens/menu/menu_ui.c +++ b/firmware_p4/components/Applications/ui/screens/menu/menu_ui.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "menu_ui.h" diff --git a/firmware_p4/components/Applications/ui/screens/nfc/include/nfc_menu_ui.h b/firmware_p4/components/Applications/ui/screens/nfc/include/nfc_menu_ui.h index 36686ac8..7b7c9be9 100644 --- a/firmware_p4/components/Applications/ui/screens/nfc/include/nfc_menu_ui.h +++ b/firmware_p4/components/Applications/ui/screens/nfc/include/nfc_menu_ui.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef NFC_MENU_UI_H #define NFC_MENU_UI_H diff --git a/firmware_p4/components/Applications/ui/screens/nfc/nfc_menu_ui.c b/firmware_p4/components/Applications/ui/screens/nfc/nfc_menu_ui.c index 830c4977..412a53d4 100644 --- a/firmware_p4/components/Applications/ui/screens/nfc/nfc_menu_ui.c +++ b/firmware_p4/components/Applications/ui/screens/nfc/nfc_menu_ui.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "nfc_menu_ui.h" diff --git a/firmware_p4/components/Applications/ui/screens/settings/include/settings_ui.h b/firmware_p4/components/Applications/ui/screens/settings/include/settings_ui.h index 28d44efb..5258c9ba 100644 --- a/firmware_p4/components/Applications/ui/screens/settings/include/settings_ui.h +++ b/firmware_p4/components/Applications/ui/screens/settings/include/settings_ui.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef SETTINGS_UI_H #define SETTINGS_UI_H diff --git a/firmware_p4/components/Applications/ui/screens/settings/settings_ui.c b/firmware_p4/components/Applications/ui/screens/settings/settings_ui.c index 56a68154..78cbd525 100644 --- a/firmware_p4/components/Applications/ui/screens/settings/settings_ui.c +++ b/firmware_p4/components/Applications/ui/screens/settings/settings_ui.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "settings_ui.h" diff --git a/firmware_p4/components/Applications/ui/screens/sound_settings/include/sound_settings_ui.h b/firmware_p4/components/Applications/ui/screens/sound_settings/include/sound_settings_ui.h index 3296de26..f3afd09e 100644 --- a/firmware_p4/components/Applications/ui/screens/sound_settings/include/sound_settings_ui.h +++ b/firmware_p4/components/Applications/ui/screens/sound_settings/include/sound_settings_ui.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef SOUND_SETTINGS_UI_H #define SOUND_SETTINGS_UI_H diff --git a/firmware_p4/components/Applications/ui/screens/sound_settings/sound_settings_ui.c b/firmware_p4/components/Applications/ui/screens/sound_settings/sound_settings_ui.c index 4f3d6350..ecf61cdd 100644 --- a/firmware_p4/components/Applications/ui/screens/sound_settings/sound_settings_ui.c +++ b/firmware_p4/components/Applications/ui/screens/sound_settings/sound_settings_ui.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "sound_settings_ui.h" diff --git a/firmware_p4/components/Applications/ui/screens/sub_example/include/sub_example_ui.h b/firmware_p4/components/Applications/ui/screens/sub_example/include/sub_example_ui.h index b63ddc90..99b772a6 100644 --- a/firmware_p4/components/Applications/ui/screens/sub_example/include/sub_example_ui.h +++ b/firmware_p4/components/Applications/ui/screens/sub_example/include/sub_example_ui.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef SUB_EXAMPLE_UI_H #define SUB_EXAMPLE_UI_H diff --git a/firmware_p4/components/Applications/ui/screens/sub_example/sub_example_ui.c b/firmware_p4/components/Applications/ui/screens/sub_example/sub_example_ui.c index 347b02f4..1f55609f 100644 --- a/firmware_p4/components/Applications/ui/screens/sub_example/sub_example_ui.c +++ b/firmware_p4/components/Applications/ui/screens/sub_example/sub_example_ui.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "sub_example_ui.h" diff --git a/firmware_p4/components/Applications/ui/screens/theme_selector/include/theme_selector_ui.h b/firmware_p4/components/Applications/ui/screens/theme_selector/include/theme_selector_ui.h index 4f167b47..cd25c823 100644 --- a/firmware_p4/components/Applications/ui/screens/theme_selector/include/theme_selector_ui.h +++ b/firmware_p4/components/Applications/ui/screens/theme_selector/include/theme_selector_ui.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef THEME_SELECTOR_UI_H #define THEME_SELECTOR_UI_H diff --git a/firmware_p4/components/Applications/ui/screens/theme_selector/theme_selector_ui.c b/firmware_p4/components/Applications/ui/screens/theme_selector/theme_selector_ui.c index 6cfddcbc..1bf7c2a4 100644 --- a/firmware_p4/components/Applications/ui/screens/theme_selector/theme_selector_ui.c +++ b/firmware_p4/components/Applications/ui/screens/theme_selector/theme_selector_ui.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "theme_selector_ui.h" diff --git a/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_ap_list_ui.h b/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_ap_list_ui.h index 0fb168a6..5b48dc7c 100644 --- a/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_ap_list_ui.h +++ b/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_ap_list_ui.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef WIFI_AP_LIST_UI_H #define WIFI_AP_LIST_UI_H diff --git a/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_attack_menu_ui.h b/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_attack_menu_ui.h index 607cc232..bd78b42f 100644 --- a/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_attack_menu_ui.h +++ b/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_attack_menu_ui.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef WIFI_ATTACK_MENU_UI_H #define WIFI_ATTACK_MENU_UI_H diff --git a/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_auth_flood_ui.h b/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_auth_flood_ui.h index 607b5a37..861877b7 100644 --- a/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_auth_flood_ui.h +++ b/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_auth_flood_ui.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef WIFI_AUTH_FLOOD_UI_H #define WIFI_AUTH_FLOOD_UI_H diff --git a/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_beacon_spam_simple_ui.h b/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_beacon_spam_simple_ui.h index b5e3d3c1..ad5102f5 100644 --- a/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_beacon_spam_simple_ui.h +++ b/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_beacon_spam_simple_ui.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef WIFI_BEACON_SPAM_SIMPLE_UI_H #define WIFI_BEACON_SPAM_SIMPLE_UI_H diff --git a/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_beacon_spam_ui.h b/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_beacon_spam_ui.h index aeac425d..d1abd1d6 100644 --- a/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_beacon_spam_ui.h +++ b/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_beacon_spam_ui.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef WIFI_BEACON_SPAM_UI_H #define WIFI_BEACON_SPAM_UI_H diff --git a/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_deauth_attack_ui.h b/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_deauth_attack_ui.h index 889c2f89..447e314d 100644 --- a/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_deauth_attack_ui.h +++ b/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_deauth_attack_ui.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef WIFI_DEAUTH_ATTACK_UI_H #define WIFI_DEAUTH_ATTACK_UI_H diff --git a/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_deauth_ui.h b/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_deauth_ui.h index c239a898..ed6b7298 100644 --- a/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_deauth_ui.h +++ b/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_deauth_ui.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef WIFI_DEAUTH_UI_H #define WIFI_DEAUTH_UI_H diff --git a/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_evil_twin_ui.h b/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_evil_twin_ui.h index c2bc1820..b80db737 100644 --- a/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_evil_twin_ui.h +++ b/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_evil_twin_ui.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef WIFI_EVIL_TWIN_UI_H #define WIFI_EVIL_TWIN_UI_H diff --git a/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_packets_menu_ui.h b/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_packets_menu_ui.h index 57be4bc3..347fb2a9 100644 --- a/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_packets_menu_ui.h +++ b/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_packets_menu_ui.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef WIFI_PACKETS_MENU_UI_H #define WIFI_PACKETS_MENU_UI_H diff --git a/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_probe_flood_ui.h b/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_probe_flood_ui.h index 538d3f38..c8299dd0 100644 --- a/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_probe_flood_ui.h +++ b/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_probe_flood_ui.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef WIFI_PROBE_FLOOD_UI_H #define WIFI_PROBE_FLOOD_UI_H diff --git a/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_probe_ui.h b/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_probe_ui.h index 8fd82526..6a3798f8 100644 --- a/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_probe_ui.h +++ b/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_probe_ui.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef WIFI_PROBE_UI_H #define WIFI_PROBE_UI_H diff --git a/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_scan_ap_ui.h b/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_scan_ap_ui.h index 688de135..f7c69896 100644 --- a/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_scan_ap_ui.h +++ b/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_scan_ap_ui.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef WIFI_SCAN_AP_UI_H #define WIFI_SCAN_AP_UI_H diff --git a/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_scan_menu_ui.h b/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_scan_menu_ui.h index 7b629f46..7e1981d0 100644 --- a/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_scan_menu_ui.h +++ b/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_scan_menu_ui.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef WIFI_SCAN_MENU_UI_H #define WIFI_SCAN_MENU_UI_H diff --git a/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_scan_monitor_ui.h b/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_scan_monitor_ui.h index 354f7ee7..9704a4a6 100644 --- a/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_scan_monitor_ui.h +++ b/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_scan_monitor_ui.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef WIFI_SCAN_MONITOR_UI_H #define WIFI_SCAN_MONITOR_UI_H diff --git a/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_scan_probe_ui.h b/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_scan_probe_ui.h index 481d2998..c95181ae 100644 --- a/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_scan_probe_ui.h +++ b/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_scan_probe_ui.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef WIFI_SCAN_PROBE_UI_H #define WIFI_SCAN_PROBE_UI_H diff --git a/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_scan_stations_ui.h b/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_scan_stations_ui.h index f5df9702..db7402d7 100644 --- a/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_scan_stations_ui.h +++ b/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_scan_stations_ui.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef WIFI_SCAN_STATIONS_UI_H #define WIFI_SCAN_STATIONS_UI_H diff --git a/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_scan_target_ui.h b/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_scan_target_ui.h index 7838d162..ebd682ec 100644 --- a/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_scan_target_ui.h +++ b/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_scan_target_ui.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef WIFI_SCAN_TARGET_UI_H #define WIFI_SCAN_TARGET_UI_H diff --git a/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_scan_ui.h b/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_scan_ui.h index 45703aa3..a231c87a 100644 --- a/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_scan_ui.h +++ b/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_scan_ui.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef WIFI_SCAN_UI_H #define WIFI_SCAN_UI_H diff --git a/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_sniffer_attack_ui.h b/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_sniffer_attack_ui.h index 55c021b8..0a32abf4 100644 --- a/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_sniffer_attack_ui.h +++ b/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_sniffer_attack_ui.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef WIFI_SNIFFER_ATTACK_UI_H #define WIFI_SNIFFER_ATTACK_UI_H diff --git a/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_sniffer_handshake_ui.h b/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_sniffer_handshake_ui.h index 6b9c25e9..c3dee5ba 100644 --- a/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_sniffer_handshake_ui.h +++ b/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_sniffer_handshake_ui.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef WIFI_SNIFFER_HANDSHAKE_UI_H #define WIFI_SNIFFER_HANDSHAKE_UI_H diff --git a/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_sniffer_raw_ui.h b/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_sniffer_raw_ui.h index a5570d3a..73a5361a 100644 --- a/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_sniffer_raw_ui.h +++ b/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_sniffer_raw_ui.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef WIFI_SNIFFER_RAW_UI_H #define WIFI_SNIFFER_RAW_UI_H diff --git a/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_ui.h b/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_ui.h index 3a798455..9daffcde 100644 --- a/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_ui.h +++ b/firmware_p4/components/Applications/ui/screens/wifi/include/wifi_ui.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef WIFI_UI_H #define WIFI_UI_H diff --git a/firmware_p4/components/Applications/ui/screens/wifi/wifi_ap_list_ui.c b/firmware_p4/components/Applications/ui/screens/wifi/wifi_ap_list_ui.c index 588c2eb2..d833f1d2 100644 --- a/firmware_p4/components/Applications/ui/screens/wifi/wifi_ap_list_ui.c +++ b/firmware_p4/components/Applications/ui/screens/wifi/wifi_ap_list_ui.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "wifi_ap_list_ui.h" diff --git a/firmware_p4/components/Applications/ui/screens/wifi/wifi_attack_menu_ui.c b/firmware_p4/components/Applications/ui/screens/wifi/wifi_attack_menu_ui.c index a3e37924..80c5df6b 100644 --- a/firmware_p4/components/Applications/ui/screens/wifi/wifi_attack_menu_ui.c +++ b/firmware_p4/components/Applications/ui/screens/wifi/wifi_attack_menu_ui.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "wifi_attack_menu_ui.h" diff --git a/firmware_p4/components/Applications/ui/screens/wifi/wifi_auth_flood_ui.c b/firmware_p4/components/Applications/ui/screens/wifi/wifi_auth_flood_ui.c index 8c61822c..6644e7ab 100644 --- a/firmware_p4/components/Applications/ui/screens/wifi/wifi_auth_flood_ui.c +++ b/firmware_p4/components/Applications/ui/screens/wifi/wifi_auth_flood_ui.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "wifi_auth_flood_ui.h" diff --git a/firmware_p4/components/Applications/ui/screens/wifi/wifi_beacon_spam_simple_ui.c b/firmware_p4/components/Applications/ui/screens/wifi/wifi_beacon_spam_simple_ui.c index 824d4127..d0093f2a 100644 --- a/firmware_p4/components/Applications/ui/screens/wifi/wifi_beacon_spam_simple_ui.c +++ b/firmware_p4/components/Applications/ui/screens/wifi/wifi_beacon_spam_simple_ui.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "wifi_beacon_spam_simple_ui.h" diff --git a/firmware_p4/components/Applications/ui/screens/wifi/wifi_beacon_spam_ui.c b/firmware_p4/components/Applications/ui/screens/wifi/wifi_beacon_spam_ui.c index ec9cf6f0..775cbe2a 100644 --- a/firmware_p4/components/Applications/ui/screens/wifi/wifi_beacon_spam_ui.c +++ b/firmware_p4/components/Applications/ui/screens/wifi/wifi_beacon_spam_ui.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "wifi_beacon_spam_ui.h" #include "esp_log.h" diff --git a/firmware_p4/components/Applications/ui/screens/wifi/wifi_deauth_attack_ui.c b/firmware_p4/components/Applications/ui/screens/wifi/wifi_deauth_attack_ui.c index ed2797a0..e7c5487c 100644 --- a/firmware_p4/components/Applications/ui/screens/wifi/wifi_deauth_attack_ui.c +++ b/firmware_p4/components/Applications/ui/screens/wifi/wifi_deauth_attack_ui.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "wifi_deauth_attack_ui.h" diff --git a/firmware_p4/components/Applications/ui/screens/wifi/wifi_deauth_ui.c b/firmware_p4/components/Applications/ui/screens/wifi/wifi_deauth_ui.c index f40bd82a..b44953ed 100644 --- a/firmware_p4/components/Applications/ui/screens/wifi/wifi_deauth_ui.c +++ b/firmware_p4/components/Applications/ui/screens/wifi/wifi_deauth_ui.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "wifi_deauth_ui.h" diff --git a/firmware_p4/components/Applications/ui/screens/wifi/wifi_evil_twin_ui.c b/firmware_p4/components/Applications/ui/screens/wifi/wifi_evil_twin_ui.c index e752fec3..a13dcd71 100644 --- a/firmware_p4/components/Applications/ui/screens/wifi/wifi_evil_twin_ui.c +++ b/firmware_p4/components/Applications/ui/screens/wifi/wifi_evil_twin_ui.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "wifi_evil_twin_ui.h" diff --git a/firmware_p4/components/Applications/ui/screens/wifi/wifi_packets_menu_ui.c b/firmware_p4/components/Applications/ui/screens/wifi/wifi_packets_menu_ui.c index 9c916efc..73d7781b 100644 --- a/firmware_p4/components/Applications/ui/screens/wifi/wifi_packets_menu_ui.c +++ b/firmware_p4/components/Applications/ui/screens/wifi/wifi_packets_menu_ui.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "wifi_packets_menu_ui.h" diff --git a/firmware_p4/components/Applications/ui/screens/wifi/wifi_probe_flood_ui.c b/firmware_p4/components/Applications/ui/screens/wifi/wifi_probe_flood_ui.c index 69b927e9..cfafb42a 100644 --- a/firmware_p4/components/Applications/ui/screens/wifi/wifi_probe_flood_ui.c +++ b/firmware_p4/components/Applications/ui/screens/wifi/wifi_probe_flood_ui.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "wifi_probe_flood_ui.h" diff --git a/firmware_p4/components/Applications/ui/screens/wifi/wifi_probe_ui.c b/firmware_p4/components/Applications/ui/screens/wifi/wifi_probe_ui.c index 984feb81..0a704c8a 100644 --- a/firmware_p4/components/Applications/ui/screens/wifi/wifi_probe_ui.c +++ b/firmware_p4/components/Applications/ui/screens/wifi/wifi_probe_ui.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "wifi_probe_ui.h" diff --git a/firmware_p4/components/Applications/ui/screens/wifi/wifi_scan_ap_ui.c b/firmware_p4/components/Applications/ui/screens/wifi/wifi_scan_ap_ui.c index 58ed35d5..d5c1d7aa 100644 --- a/firmware_p4/components/Applications/ui/screens/wifi/wifi_scan_ap_ui.c +++ b/firmware_p4/components/Applications/ui/screens/wifi/wifi_scan_ap_ui.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "wifi_scan_ap_ui.h" diff --git a/firmware_p4/components/Applications/ui/screens/wifi/wifi_scan_menu_ui.c b/firmware_p4/components/Applications/ui/screens/wifi/wifi_scan_menu_ui.c index 29c618ac..5d413951 100644 --- a/firmware_p4/components/Applications/ui/screens/wifi/wifi_scan_menu_ui.c +++ b/firmware_p4/components/Applications/ui/screens/wifi/wifi_scan_menu_ui.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "wifi_scan_menu_ui.h" diff --git a/firmware_p4/components/Applications/ui/screens/wifi/wifi_scan_monitor_ui.c b/firmware_p4/components/Applications/ui/screens/wifi/wifi_scan_monitor_ui.c index 06841c14..fce1acb6 100644 --- a/firmware_p4/components/Applications/ui/screens/wifi/wifi_scan_monitor_ui.c +++ b/firmware_p4/components/Applications/ui/screens/wifi/wifi_scan_monitor_ui.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "wifi_scan_monitor_ui.h" @@ -103,7 +104,7 @@ void ui_wifi_scan_monitor_open(void) { s_update_timer = NULL; } - wifi_sniffer_start(WIFI_SNIFFER_TYPE_RAW, 0); + wifi_sniffer_start_monitor(0); s_last_pkt_count = 0; s_screen = lv_obj_create(NULL); diff --git a/firmware_p4/components/Applications/ui/screens/wifi/wifi_scan_probe_ui.c b/firmware_p4/components/Applications/ui/screens/wifi/wifi_scan_probe_ui.c index 701992c7..8d9bf4f7 100644 --- a/firmware_p4/components/Applications/ui/screens/wifi/wifi_scan_probe_ui.c +++ b/firmware_p4/components/Applications/ui/screens/wifi/wifi_scan_probe_ui.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "wifi_scan_probe_ui.h" diff --git a/firmware_p4/components/Applications/ui/screens/wifi/wifi_scan_stations_ui.c b/firmware_p4/components/Applications/ui/screens/wifi/wifi_scan_stations_ui.c index f9337958..15d456d0 100644 --- a/firmware_p4/components/Applications/ui/screens/wifi/wifi_scan_stations_ui.c +++ b/firmware_p4/components/Applications/ui/screens/wifi/wifi_scan_stations_ui.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "wifi_scan_stations_ui.h" diff --git a/firmware_p4/components/Applications/ui/screens/wifi/wifi_scan_target_ui.c b/firmware_p4/components/Applications/ui/screens/wifi/wifi_scan_target_ui.c index cfb6e4a7..7c7decac 100644 --- a/firmware_p4/components/Applications/ui/screens/wifi/wifi_scan_target_ui.c +++ b/firmware_p4/components/Applications/ui/screens/wifi/wifi_scan_target_ui.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "wifi_scan_target_ui.h" diff --git a/firmware_p4/components/Applications/ui/screens/wifi/wifi_scan_ui.c b/firmware_p4/components/Applications/ui/screens/wifi/wifi_scan_ui.c index 24b65ab4..3da0e0d3 100644 --- a/firmware_p4/components/Applications/ui/screens/wifi/wifi_scan_ui.c +++ b/firmware_p4/components/Applications/ui/screens/wifi/wifi_scan_ui.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "wifi_scan_ui.h" diff --git a/firmware_p4/components/Applications/ui/screens/wifi/wifi_sniffer_attack_ui.c b/firmware_p4/components/Applications/ui/screens/wifi/wifi_sniffer_attack_ui.c index 7397088f..b13ed463 100644 --- a/firmware_p4/components/Applications/ui/screens/wifi/wifi_sniffer_attack_ui.c +++ b/firmware_p4/components/Applications/ui/screens/wifi/wifi_sniffer_attack_ui.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "wifi_sniffer_attack_ui.h" diff --git a/firmware_p4/components/Applications/ui/screens/wifi/wifi_sniffer_handshake_ui.c b/firmware_p4/components/Applications/ui/screens/wifi/wifi_sniffer_handshake_ui.c index e07b5351..5575b3a7 100644 --- a/firmware_p4/components/Applications/ui/screens/wifi/wifi_sniffer_handshake_ui.c +++ b/firmware_p4/components/Applications/ui/screens/wifi/wifi_sniffer_handshake_ui.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "wifi_sniffer_handshake_ui.h" diff --git a/firmware_p4/components/Applications/ui/screens/wifi/wifi_sniffer_raw_ui.c b/firmware_p4/components/Applications/ui/screens/wifi/wifi_sniffer_raw_ui.c index 1aa56fdc..77b82b65 100644 --- a/firmware_p4/components/Applications/ui/screens/wifi/wifi_sniffer_raw_ui.c +++ b/firmware_p4/components/Applications/ui/screens/wifi/wifi_sniffer_raw_ui.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "wifi_sniffer_raw_ui.h" diff --git a/firmware_p4/components/Applications/ui/screens/wifi/wifi_ui.c b/firmware_p4/components/Applications/ui/screens/wifi/wifi_ui.c index 2554cbc8..c66fb656 100644 --- a/firmware_p4/components/Applications/ui/screens/wifi/wifi_ui.c +++ b/firmware_p4/components/Applications/ui/screens/wifi/wifi_ui.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "wifi_ui.h" diff --git a/firmware_p4/components/Applications/ui/ui_manager.c b/firmware_p4/components/Applications/ui/ui_manager.c index 4c481ab8..13c3800d 100644 --- a/firmware_p4/components/Applications/ui/ui_manager.c +++ b/firmware_p4/components/Applications/ui/ui_manager.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "ui_manager.h" diff --git a/firmware_p4/components/Applications/ui/ui_theme.c b/firmware_p4/components/Applications/ui/ui_theme.c index 8b9223b7..b20c75f1 100644 --- a/firmware_p4/components/Applications/ui/ui_theme.c +++ b/firmware_p4/components/Applications/ui/ui_theme.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "ui_theme.h" diff --git a/firmware_p4/components/Applications/wifi/ap_scanner.c b/firmware_p4/components/Applications/wifi/ap_scanner.c index 342df540..31dccf15 100644 --- a/firmware_p4/components/Applications/wifi/ap_scanner.c +++ b/firmware_p4/components/Applications/wifi/ap_scanner.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "ap_scanner.h" diff --git a/firmware_p4/components/Applications/wifi/beacon_spam.c b/firmware_p4/components/Applications/wifi/beacon_spam.c index ee22f054..85aa6166 100644 --- a/firmware_p4/components/Applications/wifi/beacon_spam.c +++ b/firmware_p4/components/Applications/wifi/beacon_spam.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "beacon_spam.h" @@ -19,33 +20,38 @@ #include "esp_log.h" #include "spi_bridge.h" +#include "spi_session.h" static const char *TAG = "BEACON_SPAM"; static bool s_is_running = false; +static uint32_t s_session_id = SPI_SESSION_INVALID_ID; bool beacon_spam_start_custom(const char *json_path) { if (json_path == NULL) return false; size_t len = strnlen(json_path, SPI_MAX_PAYLOAD - 1); - esp_err_t err = spi_bridge_send_command( - SPI_ID_WIFI_APP_BEACON_SPAM, (uint8_t *)json_path, (uint8_t)len, NULL, NULL, 2000); - s_is_running = (err == ESP_OK); + s_session_id = spi_session_start( + SPI_ID_WIFI_APP_BEACON_SPAM, (uint8_t *)json_path, (uint8_t)len, NULL, NULL); + s_is_running = (s_session_id != SPI_SESSION_INVALID_ID); if (!s_is_running) ESP_LOGW(TAG, "Failed to start beacon spam (custom list) over SPI"); return s_is_running; } bool beacon_spam_start_random(void) { - esp_err_t err = spi_bridge_send_command(SPI_ID_WIFI_APP_BEACON_SPAM, NULL, 0, NULL, NULL, 2000); - s_is_running = (err == ESP_OK); + s_session_id = spi_session_start(SPI_ID_WIFI_APP_BEACON_SPAM, NULL, 0, NULL, NULL); + s_is_running = (s_session_id != SPI_SESSION_INVALID_ID); if (!s_is_running) ESP_LOGW(TAG, "Failed to start beacon spam (random) over SPI"); return s_is_running; } void beacon_spam_stop(void) { - spi_bridge_send_command(SPI_ID_WIFI_APP_ATTACK_STOP, NULL, 0, NULL, NULL, 2000); + if (s_session_id != SPI_SESSION_INVALID_ID) { + spi_session_stop(s_session_id); + s_session_id = SPI_SESSION_INVALID_ID; + } s_is_running = false; } diff --git a/firmware_p4/components/Applications/wifi/client_scanner.c b/firmware_p4/components/Applications/wifi/client_scanner.c index e935d365..c3812b50 100644 --- a/firmware_p4/components/Applications/wifi/client_scanner.c +++ b/firmware_p4/components/Applications/wifi/client_scanner.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "client_scanner.h" diff --git a/firmware_p4/components/Applications/wifi/deauther_detector.c b/firmware_p4/components/Applications/wifi/deauther_detector.c index c01ac592..05bf6198 100644 --- a/firmware_p4/components/Applications/wifi/deauther_detector.c +++ b/firmware_p4/components/Applications/wifi/deauther_detector.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "deauther_detector.h" @@ -19,17 +20,24 @@ #include "esp_log.h" #include "spi_bridge.h" +#include "spi_session.h" static const char *TAG = "DEAUTHER_DETECTOR"; +static uint32_t s_session_id = SPI_SESSION_INVALID_ID; + void deauther_detector_start(void) { - if (spi_bridge_send_command(SPI_ID_WIFI_APP_DEAUTH_DET, NULL, 0, NULL, NULL, 2000) != ESP_OK) { + s_session_id = spi_session_start(SPI_ID_WIFI_APP_DEAUTH_DET, NULL, 0, NULL, NULL); + if (s_session_id == SPI_SESSION_INVALID_ID) { ESP_LOGW(TAG, "Failed to start deauth detector over SPI"); } } void deauther_detector_stop(void) { - spi_bridge_send_command(SPI_ID_WIFI_APP_ATTACK_STOP, NULL, 0, NULL, NULL, 2000); + if (s_session_id != SPI_SESSION_INVALID_ID) { + spi_session_stop(s_session_id); + s_session_id = SPI_SESSION_INVALID_ID; + } } uint32_t deauther_detector_get_count(void) { diff --git a/firmware_p4/components/Applications/wifi/evil_twin.c b/firmware_p4/components/Applications/wifi/evil_twin.c index 99f73b15..0248380b 100644 --- a/firmware_p4/components/Applications/wifi/evil_twin.c +++ b/firmware_p4/components/Applications/wifi/evil_twin.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "evil_twin.h" @@ -21,6 +22,7 @@ #include "esp_log.h" #include "spi_bridge.h" +#include "spi_session.h" #include "tos_storage_paths.h" #include "storage_read.h" #include "storage_write.h" @@ -37,13 +39,15 @@ static const char *TAG = "EVIL_TWIN"; #define EVIL_TWIN_PASSWORD_BUF_SIZE 2048 static bool s_has_password = false; +static uint32_t s_session_id = SPI_SESSION_INVALID_ID; void evil_twin_start_attack(const char *ssid) { if (ssid == NULL) return; size_t len = strnlen(ssid, EVIL_TWIN_MAX_SSID_LEN); - if (spi_bridge_send_command( - SPI_ID_WIFI_APP_EVIL_TWIN, (uint8_t *)ssid, (uint8_t)len, NULL, NULL, 2000) == ESP_OK) { + s_session_id = + spi_session_start(SPI_ID_WIFI_APP_EVIL_TWIN, (uint8_t *)ssid, (uint8_t)len, NULL, NULL); + if (s_session_id != SPI_SESSION_INVALID_ID) { s_has_password = false; } else { ESP_LOGW(TAG, "Failed to start Evil Twin over SPI"); @@ -80,7 +84,10 @@ void evil_twin_start_attack_with_template(const char *ssid, const char *template } void evil_twin_stop_attack(void) { - spi_bridge_send_command(SPI_ID_WIFI_APP_ATTACK_STOP, NULL, 0, NULL, NULL, 2000); + if (s_session_id != SPI_SESSION_INVALID_ID) { + spi_session_stop(s_session_id); + s_session_id = SPI_SESSION_INVALID_ID; + } } void evil_twin_reset_capture(void) { diff --git a/firmware_p4/components/Applications/wifi/include/ap_scanner.h b/firmware_p4/components/Applications/wifi/include/ap_scanner.h index 8ce1266e..ecd60a27 100644 --- a/firmware_p4/components/Applications/wifi/include/ap_scanner.h +++ b/firmware_p4/components/Applications/wifi/include/ap_scanner.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef AP_SCANNER_H #define AP_SCANNER_H diff --git a/firmware_p4/components/Applications/wifi/include/beacon_spam.h b/firmware_p4/components/Applications/wifi/include/beacon_spam.h index 1b426655..e55c0f55 100644 --- a/firmware_p4/components/Applications/wifi/include/beacon_spam.h +++ b/firmware_p4/components/Applications/wifi/include/beacon_spam.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef BEACON_SPAM_H #define BEACON_SPAM_H diff --git a/firmware_p4/components/Applications/wifi/include/client_scanner.h b/firmware_p4/components/Applications/wifi/include/client_scanner.h index 1d6b9544..af720e78 100644 --- a/firmware_p4/components/Applications/wifi/include/client_scanner.h +++ b/firmware_p4/components/Applications/wifi/include/client_scanner.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef CLIENT_SCANNER_H #define CLIENT_SCANNER_H diff --git a/firmware_p4/components/Applications/wifi/include/deauther_detector.h b/firmware_p4/components/Applications/wifi/include/deauther_detector.h index 01d6e2d6..dc1ad853 100644 --- a/firmware_p4/components/Applications/wifi/include/deauther_detector.h +++ b/firmware_p4/components/Applications/wifi/include/deauther_detector.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef DEAUTHER_DETECTOR_H #define DEAUTHER_DETECTOR_H diff --git a/firmware_p4/components/Applications/wifi/include/evil_twin.h b/firmware_p4/components/Applications/wifi/include/evil_twin.h index 48718e91..3e29c4cf 100644 --- a/firmware_p4/components/Applications/wifi/include/evil_twin.h +++ b/firmware_p4/components/Applications/wifi/include/evil_twin.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef EVIL_TWIN_H #define EVIL_TWIN_H diff --git a/firmware_p4/components/Applications/wifi/include/pcap_serializer.h b/firmware_p4/components/Applications/wifi/include/pcap_serializer.h index 45e617c4..a568b21f 100644 --- a/firmware_p4/components/Applications/wifi/include/pcap_serializer.h +++ b/firmware_p4/components/Applications/wifi/include/pcap_serializer.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef PCAP_SERIALIZER_H #define PCAP_SERIALIZER_H diff --git a/firmware_p4/components/Applications/wifi/include/port_scan.h b/firmware_p4/components/Applications/wifi/include/port_scan.h index 56b58206..b807a45c 100644 --- a/firmware_p4/components/Applications/wifi/include/port_scan.h +++ b/firmware_p4/components/Applications/wifi/include/port_scan.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef PORT_SCAN_H #define PORT_SCAN_H diff --git a/firmware_p4/components/Applications/wifi/include/probe_monitor.h b/firmware_p4/components/Applications/wifi/include/probe_monitor.h index 37e015f8..c70cc6bd 100644 --- a/firmware_p4/components/Applications/wifi/include/probe_monitor.h +++ b/firmware_p4/components/Applications/wifi/include/probe_monitor.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef PROBE_MONITOR_H #define PROBE_MONITOR_H diff --git a/firmware_p4/components/Applications/wifi/include/signal_monitor.h b/firmware_p4/components/Applications/wifi/include/signal_monitor.h index c808d849..28868e6e 100644 --- a/firmware_p4/components/Applications/wifi/include/signal_monitor.h +++ b/firmware_p4/components/Applications/wifi/include/signal_monitor.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef SIGNAL_MONITOR_H #define SIGNAL_MONITOR_H diff --git a/firmware_p4/components/Applications/wifi/include/target_scanner.h b/firmware_p4/components/Applications/wifi/include/target_scanner.h index 54d2a5a3..a4fab673 100644 --- a/firmware_p4/components/Applications/wifi/include/target_scanner.h +++ b/firmware_p4/components/Applications/wifi/include/target_scanner.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef TARGET_SCANNER_H #define TARGET_SCANNER_H diff --git a/firmware_p4/components/Applications/wifi/include/wifi_deauther.h b/firmware_p4/components/Applications/wifi/include/wifi_deauther.h index 9781b8d6..a2450cd7 100644 --- a/firmware_p4/components/Applications/wifi/include/wifi_deauther.h +++ b/firmware_p4/components/Applications/wifi/include/wifi_deauther.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef WIFI_DEAUTHER_H #define WIFI_DEAUTHER_H diff --git a/firmware_p4/components/Applications/wifi/include/wifi_flood.h b/firmware_p4/components/Applications/wifi/include/wifi_flood.h index e4a3a6a9..9d178e52 100644 --- a/firmware_p4/components/Applications/wifi/include/wifi_flood.h +++ b/firmware_p4/components/Applications/wifi/include/wifi_flood.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef WIFI_FLOOD_H #define WIFI_FLOOD_H diff --git a/firmware_p4/components/Applications/wifi/include/wifi_sniffer.h b/firmware_p4/components/Applications/wifi/include/wifi_sniffer.h index 2c5eb731..9cc2297e 100644 --- a/firmware_p4/components/Applications/wifi/include/wifi_sniffer.h +++ b/firmware_p4/components/Applications/wifi/include/wifi_sniffer.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef WIFI_SNIFFER_H #define WIFI_SNIFFER_H @@ -64,6 +65,18 @@ bool wifi_sniffer_start(wifi_sniffer_type_t type, uint8_t channel); */ bool wifi_sniffer_start_stream(wifi_sniffer_type_t type, uint8_t channel, wifi_sniffer_cb_t cb); +/** + * @brief Start the sniffer in Packet Monitor mode (counter-only). + * + * Same as `wifi_sniffer_start(WIFI_SNIFFER_TYPE_RAW, channel)` but tells + * the C5 to recycle the PCAP buffer when full (instead of dropping new + * packets). Use this for the Packet Monitor screen which only reads + * counters and never saves the PCAP. + * + * @param channel Wi-Fi channel (0 for hopping). + */ +bool wifi_sniffer_start_monitor(uint8_t channel); + /** * @brief Stop the sniffer and release stream resources. */ diff --git a/firmware_p4/components/Applications/wifi/port_scan.c b/firmware_p4/components/Applications/wifi/port_scan.c index 02798c29..2a75d490 100644 --- a/firmware_p4/components/Applications/wifi/port_scan.c +++ b/firmware_p4/components/Applications/wifi/port_scan.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "port_scan.h" diff --git a/firmware_p4/components/Applications/wifi/probe_monitor.c b/firmware_p4/components/Applications/wifi/probe_monitor.c index 4a65b70b..c4bf44bc 100644 --- a/firmware_p4/components/Applications/wifi/probe_monitor.c +++ b/firmware_p4/components/Applications/wifi/probe_monitor.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "probe_monitor.h" @@ -20,6 +21,7 @@ #include "esp_log.h" #include "spi_bridge.h" +#include "spi_session.h" static const char *TAG = "PROBE_MONITOR"; @@ -30,14 +32,19 @@ static probe_monitor_record_t *s_cached_results = NULL; static uint16_t s_cached_count = 0; static uint16_t s_cached_capacity = 0; static probe_monitor_record_t s_empty_record; +static uint32_t s_session_id = SPI_SESSION_INVALID_ID; bool probe_monitor_start(void) { probe_monitor_free_results(); - return (spi_bridge_send_command(SPI_ID_WIFI_APP_PROBE_MON, NULL, 0, NULL, NULL, 2000) == ESP_OK); + s_session_id = spi_session_start(SPI_ID_WIFI_APP_PROBE_MON, NULL, 0, NULL, NULL); + return s_session_id != SPI_SESSION_INVALID_ID; } void probe_monitor_stop(void) { - spi_bridge_send_command(SPI_ID_WIFI_APP_ATTACK_STOP, NULL, 0, NULL, NULL, 2000); + if (s_session_id != SPI_SESSION_INVALID_ID) { + spi_session_stop(s_session_id); + s_session_id = SPI_SESSION_INVALID_ID; + } probe_monitor_free_results(); } diff --git a/firmware_p4/components/Applications/wifi/signal_monitor.c b/firmware_p4/components/Applications/wifi/signal_monitor.c index 27b53e7d..14824d6f 100644 --- a/firmware_p4/components/Applications/wifi/signal_monitor.c +++ b/firmware_p4/components/Applications/wifi/signal_monitor.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "signal_monitor.h" @@ -19,6 +20,7 @@ #include "esp_log.h" #include "spi_bridge.h" +#include "spi_session.h" static const char *TAG = "SIGNAL_MONITOR"; @@ -27,19 +29,23 @@ static const char *TAG = "SIGNAL_MONITOR"; #define SIGNAL_MONITOR_STATS_INDEX 0xEEEE static int8_t s_last_rssi = SIGNAL_MONITOR_DEFAULT_RSSI; +static uint32_t s_session_id = SPI_SESSION_INVALID_ID; void signal_monitor_start(const uint8_t *bssid, uint8_t channel) { ESP_LOGI(TAG, "Signal monitor started"); uint8_t payload[SIGNAL_MONITOR_PAYLOAD_SIZE]; memcpy(payload, bssid, 6); payload[6] = channel; - spi_bridge_send_command( - SPI_ID_WIFI_APP_SIGNAL_MON, payload, SIGNAL_MONITOR_PAYLOAD_SIZE, NULL, NULL, 2000); + s_session_id = spi_session_start( + SPI_ID_WIFI_APP_SIGNAL_MON, payload, SIGNAL_MONITOR_PAYLOAD_SIZE, NULL, NULL); } void signal_monitor_stop(void) { ESP_LOGI(TAG, "Signal monitor stopped"); - spi_bridge_send_command(SPI_ID_WIFI_APP_ATTACK_STOP, NULL, 0, NULL, NULL, 2000); + if (s_session_id != SPI_SESSION_INVALID_ID) { + spi_session_stop(s_session_id); + s_session_id = SPI_SESSION_INVALID_ID; + } } int8_t signal_monitor_get_rssi(void) { diff --git a/firmware_p4/components/Applications/wifi/target_scanner.c b/firmware_p4/components/Applications/wifi/target_scanner.c index c8432299..6782350f 100644 --- a/firmware_p4/components/Applications/wifi/target_scanner.c +++ b/firmware_p4/components/Applications/wifi/target_scanner.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "target_scanner.h" diff --git a/firmware_p4/components/Applications/wifi/wifi_deauther.c b/firmware_p4/components/Applications/wifi/wifi_deauther.c index 9583ff3d..6fcdd8a7 100644 --- a/firmware_p4/components/Applications/wifi/wifi_deauther.c +++ b/firmware_p4/components/Applications/wifi/wifi_deauther.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "wifi_deauther.h" @@ -19,9 +20,12 @@ #include "esp_log.h" #include "spi_bridge.h" +#include "spi_session.h" static const char *TAG = "WIFI_DEAUTHER"; +static uint32_t s_session_id = SPI_SESSION_INVALID_ID; + bool wifi_deauther_start(const wifi_ap_record_t *ap_record, wifi_deauther_frame_type_t type, bool is_broadcast) { @@ -31,8 +35,8 @@ bool wifi_deauther_start(const wifi_ap_record_t *ap_record, memset(payload + 6, is_broadcast ? 0xFF : 0x00, 6); payload[12] = (uint8_t)type; payload[13] = ap_record->primary; - return (spi_bridge_send_command( - SPI_ID_WIFI_APP_DEAUTHER, payload, sizeof(payload), NULL, NULL, 2000) == ESP_OK); + s_session_id = spi_session_start(SPI_ID_WIFI_APP_DEAUTHER, payload, sizeof(payload), NULL, NULL); + return s_session_id != SPI_SESSION_INVALID_ID; } bool wifi_deauther_start_targeted(const wifi_ap_record_t *ap_record, @@ -43,13 +47,16 @@ bool wifi_deauther_start_targeted(const wifi_ap_record_t *ap_record, memcpy(payload + 6, client_mac, 6); payload[12] = (uint8_t)type; payload[13] = ap_record->primary; - return (spi_bridge_send_command( - SPI_ID_WIFI_APP_DEAUTHER, payload, sizeof(payload), NULL, NULL, 2000) == ESP_OK); + s_session_id = spi_session_start(SPI_ID_WIFI_APP_DEAUTHER, payload, sizeof(payload), NULL, NULL); + return s_session_id != SPI_SESSION_INVALID_ID; } void wifi_deauther_stop(void) { ESP_LOGI(TAG, "Deauth stopped"); - spi_bridge_send_command(SPI_ID_WIFI_APP_ATTACK_STOP, NULL, 0, NULL, NULL, 2000); + if (s_session_id != SPI_SESSION_INVALID_ID) { + spi_session_stop(s_session_id); + s_session_id = SPI_SESSION_INVALID_ID; + } } bool wifi_deauther_is_running(void) { diff --git a/firmware_p4/components/Applications/wifi/wifi_flood.c b/firmware_p4/components/Applications/wifi/wifi_flood.c index 8eec4baf..14a7ec70 100644 --- a/firmware_p4/components/Applications/wifi/wifi_flood.c +++ b/firmware_p4/components/Applications/wifi/wifi_flood.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "wifi_flood.h" @@ -19,6 +20,7 @@ #include "esp_log.h" #include "spi_bridge.h" +#include "spi_session.h" static const char *TAG = "WIFI_FLOOD"; @@ -27,8 +29,9 @@ static const char *TAG = "WIFI_FLOOD"; #define WIFI_FLOOD_TYPE_PROBE 2 static bool s_is_running = false; +static uint32_t s_session_id = SPI_SESSION_INVALID_ID; -static esp_err_t send_flood(uint8_t type, const uint8_t *target_bssid, uint8_t channel) { +static bool start_flood(uint8_t type, const uint8_t *target_bssid, uint8_t channel) { uint8_t payload[8]; payload[0] = type; if (target_bssid != NULL) @@ -36,35 +39,34 @@ static esp_err_t send_flood(uint8_t type, const uint8_t *target_bssid, uint8_t c else memset(payload + 1, 0xFF, 6); payload[7] = channel; - return spi_bridge_send_command(SPI_ID_WIFI_APP_FLOOD, payload, sizeof(payload), NULL, NULL, 2000); + s_session_id = spi_session_start(SPI_ID_WIFI_APP_FLOOD, payload, sizeof(payload), NULL, NULL); + s_is_running = (s_session_id != SPI_SESSION_INVALID_ID); + return s_is_running; } bool wifi_flood_auth_start(const uint8_t *target_bssid, uint8_t channel) { - esp_err_t err = send_flood(WIFI_FLOOD_TYPE_AUTH, target_bssid, channel); - s_is_running = (err == ESP_OK); - if (!s_is_running) + if (!start_flood(WIFI_FLOOD_TYPE_AUTH, target_bssid, channel)) ESP_LOGW(TAG, "Wi-Fi auth flood failed over SPI"); return s_is_running; } bool wifi_flood_assoc_start(const uint8_t *target_bssid, uint8_t channel) { - esp_err_t err = send_flood(WIFI_FLOOD_TYPE_ASSOC, target_bssid, channel); - s_is_running = (err == ESP_OK); - if (!s_is_running) + if (!start_flood(WIFI_FLOOD_TYPE_ASSOC, target_bssid, channel)) ESP_LOGW(TAG, "Wi-Fi assoc flood failed over SPI"); return s_is_running; } bool wifi_flood_probe_start(const uint8_t *target_bssid, uint8_t channel) { - esp_err_t err = send_flood(WIFI_FLOOD_TYPE_PROBE, target_bssid, channel); - s_is_running = (err == ESP_OK); - if (!s_is_running) + if (!start_flood(WIFI_FLOOD_TYPE_PROBE, target_bssid, channel)) ESP_LOGW(TAG, "Wi-Fi probe flood failed over SPI"); return s_is_running; } void wifi_flood_stop(void) { - spi_bridge_send_command(SPI_ID_WIFI_APP_ATTACK_STOP, NULL, 0, NULL, NULL, 2000); + if (s_session_id != SPI_SESSION_INVALID_ID) { + spi_session_stop(s_session_id); + s_session_id = SPI_SESSION_INVALID_ID; + } s_is_running = false; } diff --git a/firmware_p4/components/Applications/wifi/wifi_sniffer.c b/firmware_p4/components/Applications/wifi/wifi_sniffer.c index 96bec527..344bb268 100644 --- a/firmware_p4/components/Applications/wifi/wifi_sniffer.c +++ b/firmware_p4/components/Applications/wifi/wifi_sniffer.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "wifi_sniffer.h" @@ -19,6 +20,7 @@ #include "esp_log.h" #include "spi_bridge.h" +#include "spi_session.h" #include "storage_stream.h" static const char *TAG = "WIFI_SNIFFER"; @@ -28,11 +30,11 @@ static const char *TAG = "WIFI_SNIFFER"; static spi_sniffer_stats_t s_cached_stats; static wifi_sniffer_cb_t s_stream_cb = NULL; static storage_stream_t s_capture_stream = NULL; +static uint32_t s_session_id = SPI_SESSION_INVALID_ID; bool wifi_sniffer_stop_capture(void); -static void stream_callback(spi_id_t id, const uint8_t *payload, uint8_t len) { - (void)id; +static void session_stream_cb(const uint8_t *payload, uint8_t len) { if (payload == NULL || len < WIFI_SNIFFER_MIN_FRAME_LEN) return; const spi_wifi_sniffer_frame_t *frame = (const spi_wifi_sniffer_frame_t *)payload; @@ -49,6 +51,15 @@ static void stream_callback(spi_id_t id, const uint8_t *payload, uint8_t len) { } } +static void session_lost_cb(uint32_t session_id, spi_id_t op_id) { + (void)op_id; + if (session_id == s_session_id) { + s_session_id = SPI_SESSION_INVALID_ID; + wifi_sniffer_stop_capture(); + s_stream_cb = NULL; + } +} + static void update_stats(void) { spi_header_t resp; uint16_t magic_stats = SPI_DATA_INDEX_STATS; @@ -56,31 +67,40 @@ static void update_stats(void) { SPI_ID_SYSTEM_DATA, (uint8_t *)&magic_stats, 2, &resp, (uint8_t *)&s_cached_stats, 1000); } -bool wifi_sniffer_start(wifi_sniffer_type_t type, uint8_t channel) { - uint8_t payload[2]; +static bool +start_internal(wifi_sniffer_type_t type, uint8_t channel, bool monitor_mode, wifi_sniffer_cb_t cb) { + uint8_t payload[3]; payload[0] = (uint8_t)type; payload[1] = channel; + payload[2] = monitor_mode ? 1 : 0; memset(&s_cached_stats, 0, sizeof(s_cached_stats)); - return (spi_bridge_send_command(SPI_ID_WIFI_APP_SNIFFER, payload, 2, NULL, NULL, 2000) == ESP_OK); -} - -bool wifi_sniffer_start_stream(wifi_sniffer_type_t type, uint8_t channel, wifi_sniffer_cb_t cb) { - if (cb == NULL) { - return wifi_sniffer_start(type, channel); - } s_stream_cb = cb; - spi_bridge_register_stream_cb(SPI_ID_WIFI_APP_SNIFFER, stream_callback); - if (!wifi_sniffer_start(type, channel)) { - spi_bridge_unregister_stream_cb(SPI_ID_WIFI_APP_SNIFFER); + s_session_id = spi_session_start( + SPI_ID_WIFI_APP_SNIFFER, payload, sizeof(payload), session_stream_cb, session_lost_cb); + if (s_session_id == SPI_SESSION_INVALID_ID) { s_stream_cb = NULL; return false; } return true; } +bool wifi_sniffer_start(wifi_sniffer_type_t type, uint8_t channel) { + return start_internal(type, channel, false, NULL); +} + +bool wifi_sniffer_start_stream(wifi_sniffer_type_t type, uint8_t channel, wifi_sniffer_cb_t cb) { + return start_internal(type, channel, false, cb); +} + +bool wifi_sniffer_start_monitor(uint8_t channel) { + return start_internal(WIFI_SNIFFER_TYPE_RAW, channel, true, NULL); +} + void wifi_sniffer_stop(void) { - spi_bridge_send_command(SPI_ID_WIFI_APP_ATTACK_STOP, NULL, 0, NULL, NULL, 2000); - spi_bridge_unregister_stream_cb(SPI_ID_WIFI_APP_SNIFFER); + if (s_session_id != SPI_SESSION_INVALID_ID) { + spi_session_stop(s_session_id); + s_session_id = SPI_SESSION_INVALID_ID; + } wifi_sniffer_stop_capture(); s_stream_cb = NULL; } diff --git a/firmware_p4/components/Core/CMakeLists.txt b/firmware_p4/components/Core/CMakeLists.txt index 08d3efbb..52212351 100644 --- a/firmware_p4/components/Core/CMakeLists.txt +++ b/firmware_p4/components/Core/CMakeLists.txt @@ -1,16 +1,17 @@ # Copyright (c) 2025 HIGH CODE LLC # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# TentacleOS is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# http://www.apache.org/licenses/LICENSE-2.0 +# TentacleOS is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# You should have received a copy of the GNU General Public License +# along with TentacleOS. If not, see . idf_component_register(SRCS diff --git a/firmware_p4/components/Core/include/kernel.h b/firmware_p4/components/Core/include/kernel.h index 45bc06a2..975ca628 100644 --- a/firmware_p4/components/Core/include/kernel.h +++ b/firmware_p4/components/Core/include/kernel.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef KERNEL_H #define KERNEL_H diff --git a/firmware_p4/components/Core/include/sys_monitor.h b/firmware_p4/components/Core/include/sys_monitor.h index c2740eb2..78d3a322 100644 --- a/firmware_p4/components/Core/include/sys_monitor.h +++ b/firmware_p4/components/Core/include/sys_monitor.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef SYS_MONITOR_H #define SYS_MONITOR_H diff --git a/firmware_p4/components/Core/kernel.c b/firmware_p4/components/Core/kernel.c index 4182d20a..ae03e99d 100644 --- a/firmware_p4/components/Core/kernel.c +++ b/firmware_p4/components/Core/kernel.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "kernel.h" @@ -26,6 +27,7 @@ #include "bq25896.h" #include "led_control.h" #include "buttons_gpio.h" +#include "ys_rfid2.h" #include "bridge_manager.h" #include "storage_init.h" #include "storage_assets.h" @@ -83,6 +85,7 @@ void kernel_init(void) { cc1101_init(); bridge_manager_init(); buttons_init(); + ys_rfid2_init(NULL); // 6. Display + LVGL + UI st7789_init(); diff --git a/firmware_p4/components/Core/sys_monitor.c b/firmware_p4/components/Core/sys_monitor.c index ecb170f4..9bcc2a69 100644 --- a/firmware_p4/components/Core/sys_monitor.c +++ b/firmware_p4/components/Core/sys_monitor.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "sys_monitor.h" diff --git a/firmware_p4/components/Drivers/CMakeLists.txt b/firmware_p4/components/Drivers/CMakeLists.txt index fcf949e4..39d34c4e 100644 --- a/firmware_p4/components/Drivers/CMakeLists.txt +++ b/firmware_p4/components/Drivers/CMakeLists.txt @@ -1,21 +1,24 @@ # Copyright (c) 2025 HIGH CODE LLC # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# TentacleOS is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# http://www.apache.org/licenses/LICENSE-2.0 +# TentacleOS is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# You should have received a copy of the GNU General Public License +# along with TentacleOS. If not, see . file(GLOB_RECURSE ST25R3916_SRCS "st25r3916/*.c") +file(GLOB_RECURSE YS_RFID2_SRCS "ys_rfid2/*.c") +file(GLOB_RECURSE SX1262_SRCS "sx1262/*.c") -idf_component_register(SRCS +idf_component_register(SRCS "bq25896/bq25896.c" "cc1101/cc1101.c" "st7789/st7789.c" @@ -26,8 +29,10 @@ idf_component_register(SRCS "buttons_gpio/buttons_gpio.c" "spi_bridge_phy/spi_bridge_phy.c" ${ST25R3916_SRCS} + ${YS_RFID2_SRCS} + ${SX1262_SRCS} - INCLUDE_DIRS + INCLUDE_DIRS "bq25896/include" "cc1101/include" "st7789/include" @@ -40,8 +45,11 @@ idf_component_register(SRCS "spi_bridge_phy/include" "st25r3916/include" "st25r3916/hal/include" + "ys_rfid2/include" + "ys_rfid2/hal/include" + "sx1262/include" - REQUIRES + REQUIRES driver Service esp_lcd diff --git a/firmware_p4/components/Drivers/bq25896/bq25896.c b/firmware_p4/components/Drivers/bq25896/bq25896.c index a920554d..bd1d2f03 100644 --- a/firmware_p4/components/Drivers/bq25896/bq25896.c +++ b/firmware_p4/components/Drivers/bq25896/bq25896.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "bq25896.h" diff --git a/firmware_p4/components/Drivers/bq25896/include/bq25896.h b/firmware_p4/components/Drivers/bq25896/include/bq25896.h index b2d3d466..633c0008 100644 --- a/firmware_p4/components/Drivers/bq25896/include/bq25896.h +++ b/firmware_p4/components/Drivers/bq25896/include/bq25896.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef BQ25896_H #define BQ25896_H diff --git a/firmware_p4/components/Drivers/buttons_gpio/buttons_gpio.c b/firmware_p4/components/Drivers/buttons_gpio/buttons_gpio.c index 61fc7b49..de9679d3 100644 --- a/firmware_p4/components/Drivers/buttons_gpio/buttons_gpio.c +++ b/firmware_p4/components/Drivers/buttons_gpio/buttons_gpio.c @@ -1,25 +1,29 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "buttons_gpio.h" #include "driver/gpio.h" +#include "esp_log.h" static const char *TAG = "BUTTONS_GPIO"; #define BUTTON_PRESSED_LEVEL 0 +static const char *const s_button_names[] = {"UP", "DOWN", "LEFT", "RIGHT", "OK", "BACK"}; + static button_t s_buttons[] = { {GPIO_BTN_UP_PIN, true, false}, {GPIO_BTN_DOWN_PIN, true, false}, @@ -31,10 +35,21 @@ static button_t s_buttons[] = { #define NUM_BUTTONS (sizeof(s_buttons) / sizeof(s_buttons[0])) +static bool s_last_down[6] = {false}; + static bool get_raw_level(uint32_t gpio) { return gpio_get_level(gpio) == BUTTON_PRESSED_LEVEL; } +static bool check_and_log(int idx, uint32_t gpio) { + bool now = gpio_get_level(gpio) == BUTTON_PRESSED_LEVEL; + if (now && !s_last_down[idx]) { + ESP_LOGI(TAG, "Pressed: %s (GPIO %lu)", s_button_names[idx], (unsigned long)gpio); + } + s_last_down[idx] = now; + return now; +} + bool up_button_pressed(void) { return s_buttons[0].pressed_flag && (__atomic_test_and_set(&s_buttons[0].pressed_flag, __ATOMIC_RELAXED), false); @@ -61,22 +76,22 @@ bool back_button_pressed(void) { } bool up_button_is_down(void) { - return get_raw_level(GPIO_BTN_UP_PIN); + return check_and_log(0, GPIO_BTN_UP_PIN); } bool down_button_is_down(void) { - return get_raw_level(GPIO_BTN_DOWN_PIN); + return check_and_log(1, GPIO_BTN_DOWN_PIN); } bool left_button_is_down(void) { - return get_raw_level(GPIO_BTN_LEFT_PIN); + return check_and_log(2, GPIO_BTN_LEFT_PIN); } bool right_button_is_down(void) { - return get_raw_level(GPIO_BTN_RIGHT_PIN); + return check_and_log(3, GPIO_BTN_RIGHT_PIN); } bool ok_button_is_down(void) { - return get_raw_level(GPIO_BTN_OK_PIN); + return check_and_log(4, GPIO_BTN_OK_PIN); } bool back_button_is_down(void) { - return get_raw_level(GPIO_BTN_BACK_PIN); + return check_and_log(5, GPIO_BTN_BACK_PIN); } void buttons_task(void) { @@ -85,6 +100,7 @@ void buttons_task(void) { if (s_buttons[i].last_state == true && current == false) { s_buttons[i].pressed_flag = true; + ESP_LOGI(TAG, "Pressed: %s (GPIO %lu)", s_button_names[i], (unsigned long)s_buttons[i].gpio); } s_buttons[i].last_state = current; diff --git a/firmware_p4/components/Drivers/buttons_gpio/include/buttons_gpio.h b/firmware_p4/components/Drivers/buttons_gpio/include/buttons_gpio.h index ab9ee858..6eb63b7e 100644 --- a/firmware_p4/components/Drivers/buttons_gpio/include/buttons_gpio.h +++ b/firmware_p4/components/Drivers/buttons_gpio/include/buttons_gpio.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef BUTTONS_GPIO_H #define BUTTONS_GPIO_H diff --git a/firmware_p4/components/Drivers/cc1101/cc1101.c b/firmware_p4/components/Drivers/cc1101/cc1101.c index e3aa935d..ea77ff09 100644 --- a/firmware_p4/components/Drivers/cc1101/cc1101.c +++ b/firmware_p4/components/Drivers/cc1101/cc1101.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "cc1101.h" diff --git a/firmware_p4/components/Drivers/cc1101/include/cc1101.h b/firmware_p4/components/Drivers/cc1101/include/cc1101.h index b2fbf676..4c7dad00 100644 --- a/firmware_p4/components/Drivers/cc1101/include/cc1101.h +++ b/firmware_p4/components/Drivers/cc1101/include/cc1101.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file cc1101.h diff --git a/firmware_p4/components/Drivers/i2c_init/i2c_init.c b/firmware_p4/components/Drivers/i2c_init/i2c_init.c index 83713885..af54a27a 100644 --- a/firmware_p4/components/Drivers/i2c_init/i2c_init.c +++ b/firmware_p4/components/Drivers/i2c_init/i2c_init.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "i2c_init.h" diff --git a/firmware_p4/components/Drivers/i2c_init/include/i2c_init.h b/firmware_p4/components/Drivers/i2c_init/include/i2c_init.h index 89f7b0ff..f1ce7d2e 100644 --- a/firmware_p4/components/Drivers/i2c_init/include/i2c_init.h +++ b/firmware_p4/components/Drivers/i2c_init/include/i2c_init.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef I2C_INIT_H #define I2C_INIT_H diff --git a/firmware_p4/components/Drivers/led/include/led_control.h b/firmware_p4/components/Drivers/led/include/led_control.h index 3294eb4d..4d78acab 100644 --- a/firmware_p4/components/Drivers/led/include/led_control.h +++ b/firmware_p4/components/Drivers/led/include/led_control.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef LED_CONTROL_H #define LED_CONTROL_H diff --git a/firmware_p4/components/Drivers/led/led_control.c b/firmware_p4/components/Drivers/led/led_control.c index 9f0a0f4f..e8de45c1 100644 --- a/firmware_p4/components/Drivers/led/led_control.c +++ b/firmware_p4/components/Drivers/led/led_control.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "led_control.h" diff --git a/firmware_p4/components/Drivers/pins/include/pin_def.h b/firmware_p4/components/Drivers/pins/include/pin_def.h index e05563fc..9a20610a 100644 --- a/firmware_p4/components/Drivers/pins/include/pin_def.h +++ b/firmware_p4/components/Drivers/pins/include/pin_def.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file pin_def.h @@ -80,6 +81,22 @@ extern "C" { #define GPIO_C5_RESET_PIN 48 #define GPIO_C5_BOOT_PIN 33 +// SX1262 LoRa (SPI3_HOST, separate from C5 bridge) +#define GPIO_LORA_SCLK_PIN 18 +#define GPIO_LORA_MOSI_PIN 19 +#define GPIO_LORA_MISO_PIN 14 +#define GPIO_LORA_CS_PIN 26 +#define GPIO_LORA_RESET_PIN 27 +#define GPIO_LORA_BUSY_PIN 17 +#define GPIO_LORA_DIO1_PIN 54 +#define GPIO_LORA_TXEN_PIN 3 +#define GPIO_LORA_RXEN_PIN 5 + +// YS-RFID2 125kHz RFID Reader (UART) +// TODO: placeholder pins — definir com base no schematic do board +#define GPIO_RFID_UART_TX_PIN 24 +#define GPIO_RFID_UART_RX_PIN 25 + #ifdef __cplusplus } #endif diff --git a/firmware_p4/components/Drivers/spi/include/spi.h b/firmware_p4/components/Drivers/spi/include/spi.h index bee3a514..79bf52d1 100644 --- a/firmware_p4/components/Drivers/spi/include/spi.h +++ b/firmware_p4/components/Drivers/spi/include/spi.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef SPI_H #define SPI_H diff --git a/firmware_p4/components/Drivers/spi/spi.c b/firmware_p4/components/Drivers/spi/spi.c index ffbd61de..4dca4414 100644 --- a/firmware_p4/components/Drivers/spi/spi.c +++ b/firmware_p4/components/Drivers/spi/spi.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "spi.h" diff --git a/firmware_p4/components/Drivers/spi_bridge_phy/include/spi_bridge_phy.h b/firmware_p4/components/Drivers/spi_bridge_phy/include/spi_bridge_phy.h index b16f7d93..5fc3666f 100644 --- a/firmware_p4/components/Drivers/spi_bridge_phy/include/spi_bridge_phy.h +++ b/firmware_p4/components/Drivers/spi_bridge_phy/include/spi_bridge_phy.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef SPI_BRIDGE_PHY_H #define SPI_BRIDGE_PHY_H diff --git a/firmware_p4/components/Drivers/spi_bridge_phy/spi_bridge_phy.c b/firmware_p4/components/Drivers/spi_bridge_phy/spi_bridge_phy.c index e4837812..960a72ca 100644 --- a/firmware_p4/components/Drivers/spi_bridge_phy/spi_bridge_phy.c +++ b/firmware_p4/components/Drivers/spi_bridge_phy/spi_bridge_phy.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "spi_bridge_phy.h" diff --git a/firmware_p4/components/Drivers/st25r3916/hal/hb_nfc_gpio.c b/firmware_p4/components/Drivers/st25r3916/hal/hb_nfc_gpio.c index 84c8454b..8d0d4121 100644 --- a/firmware_p4/components/Drivers/st25r3916/hal/hb_nfc_gpio.c +++ b/firmware_p4/components/Drivers/st25r3916/hal/hb_nfc_gpio.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "hb_nfc_gpio.h" diff --git a/firmware_p4/components/Drivers/st25r3916/hal/hb_nfc_spi.c b/firmware_p4/components/Drivers/st25r3916/hal/hb_nfc_spi.c index 3a0cf82a..04271cf3 100644 --- a/firmware_p4/components/Drivers/st25r3916/hal/hb_nfc_spi.c +++ b/firmware_p4/components/Drivers/st25r3916/hal/hb_nfc_spi.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "hb_nfc_spi.h" diff --git a/firmware_p4/components/Drivers/st25r3916/hal/hb_nfc_timer.c b/firmware_p4/components/Drivers/st25r3916/hal/hb_nfc_timer.c index 42f1c40e..38ce5018 100644 --- a/firmware_p4/components/Drivers/st25r3916/hal/hb_nfc_timer.c +++ b/firmware_p4/components/Drivers/st25r3916/hal/hb_nfc_timer.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file hb_nfc_timer.c diff --git a/firmware_p4/components/Drivers/st25r3916/hal/include/hb_nfc_gpio.h b/firmware_p4/components/Drivers/st25r3916/hal/include/hb_nfc_gpio.h index 4aff70b4..62f1a8f6 100644 --- a/firmware_p4/components/Drivers/st25r3916/hal/include/hb_nfc_gpio.h +++ b/firmware_p4/components/Drivers/st25r3916/hal/include/hb_nfc_gpio.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef HB_NFC_GPIO_H #define HB_NFC_GPIO_H diff --git a/firmware_p4/components/Drivers/st25r3916/hal/include/hb_nfc_spi.h b/firmware_p4/components/Drivers/st25r3916/hal/include/hb_nfc_spi.h index b324d655..e2e74f0d 100644 --- a/firmware_p4/components/Drivers/st25r3916/hal/include/hb_nfc_spi.h +++ b/firmware_p4/components/Drivers/st25r3916/hal/include/hb_nfc_spi.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file hb_nfc_spi.h diff --git a/firmware_p4/components/Drivers/st25r3916/hal/include/hb_nfc_timer.h b/firmware_p4/components/Drivers/st25r3916/hal/include/hb_nfc_timer.h index 5acb2997..04f719b0 100644 --- a/firmware_p4/components/Drivers/st25r3916/hal/include/hb_nfc_timer.h +++ b/firmware_p4/components/Drivers/st25r3916/hal/include/hb_nfc_timer.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef HB_NFC_TIMER_H #define HB_NFC_TIMER_H diff --git a/firmware_p4/components/Drivers/st25r3916/include/highboy_nfc.h b/firmware_p4/components/Drivers/st25r3916/include/highboy_nfc.h index 297c7d68..d2c5c2cb 100644 --- a/firmware_p4/components/Drivers/st25r3916/include/highboy_nfc.h +++ b/firmware_p4/components/Drivers/st25r3916/include/highboy_nfc.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef HIGHBOY_NFC_H #define HIGHBOY_NFC_H diff --git a/firmware_p4/components/Drivers/st25r3916/include/highboy_nfc_compat.h b/firmware_p4/components/Drivers/st25r3916/include/highboy_nfc_compat.h index 91634036..6dc6c809 100644 --- a/firmware_p4/components/Drivers/st25r3916/include/highboy_nfc_compat.h +++ b/firmware_p4/components/Drivers/st25r3916/include/highboy_nfc_compat.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef HIGHBOY_NFC_COMPAT_H #define HIGHBOY_NFC_COMPAT_H diff --git a/firmware_p4/components/Drivers/st25r3916/include/highboy_nfc_error.h b/firmware_p4/components/Drivers/st25r3916/include/highboy_nfc_error.h index b20f6134..ca6ef7a0 100644 --- a/firmware_p4/components/Drivers/st25r3916/include/highboy_nfc_error.h +++ b/firmware_p4/components/Drivers/st25r3916/include/highboy_nfc_error.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef HIGHBOY_NFC_ERROR_H #define HIGHBOY_NFC_ERROR_H diff --git a/firmware_p4/components/Drivers/st25r3916/include/highboy_nfc_types.h b/firmware_p4/components/Drivers/st25r3916/include/highboy_nfc_types.h index e2ad6ac9..830fc10c 100644 --- a/firmware_p4/components/Drivers/st25r3916/include/highboy_nfc_types.h +++ b/firmware_p4/components/Drivers/st25r3916/include/highboy_nfc_types.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef HIGHBOY_NFC_TYPES_H #define HIGHBOY_NFC_TYPES_H diff --git a/firmware_p4/components/Drivers/st25r3916/include/st25r3916_aat.h b/firmware_p4/components/Drivers/st25r3916/include/st25r3916_aat.h index c077d9c6..ae6f8566 100644 --- a/firmware_p4/components/Drivers/st25r3916/include/st25r3916_aat.h +++ b/firmware_p4/components/Drivers/st25r3916/include/st25r3916_aat.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef ST25R3916_AAT_H #define ST25R3916_AAT_H diff --git a/firmware_p4/components/Drivers/st25r3916/include/st25r3916_cmd.h b/firmware_p4/components/Drivers/st25r3916/include/st25r3916_cmd.h index f95914f5..bec60d7e 100644 --- a/firmware_p4/components/Drivers/st25r3916/include/st25r3916_cmd.h +++ b/firmware_p4/components/Drivers/st25r3916/include/st25r3916_cmd.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef ST25R3916_CMD_H #define ST25R3916_CMD_H diff --git a/firmware_p4/components/Drivers/st25r3916/include/st25r3916_core.h b/firmware_p4/components/Drivers/st25r3916/include/st25r3916_core.h index 9e7ded40..989446f9 100644 --- a/firmware_p4/components/Drivers/st25r3916/include/st25r3916_core.h +++ b/firmware_p4/components/Drivers/st25r3916/include/st25r3916_core.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef ST25R3916_CORE_H #define ST25R3916_CORE_H diff --git a/firmware_p4/components/Drivers/st25r3916/include/st25r3916_fifo.h b/firmware_p4/components/Drivers/st25r3916/include/st25r3916_fifo.h index ad225638..eb01f165 100644 --- a/firmware_p4/components/Drivers/st25r3916/include/st25r3916_fifo.h +++ b/firmware_p4/components/Drivers/st25r3916/include/st25r3916_fifo.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef ST25R3916_FIFO_H #define ST25R3916_FIFO_H diff --git a/firmware_p4/components/Drivers/st25r3916/include/st25r3916_irq.h b/firmware_p4/components/Drivers/st25r3916/include/st25r3916_irq.h index 581c6b43..4dc1590b 100644 --- a/firmware_p4/components/Drivers/st25r3916/include/st25r3916_irq.h +++ b/firmware_p4/components/Drivers/st25r3916/include/st25r3916_irq.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef ST25R3916_IRQ_H #define ST25R3916_IRQ_H diff --git a/firmware_p4/components/Drivers/st25r3916/include/st25r3916_reg.h b/firmware_p4/components/Drivers/st25r3916/include/st25r3916_reg.h index 020a1678..f3d65103 100644 --- a/firmware_p4/components/Drivers/st25r3916/include/st25r3916_reg.h +++ b/firmware_p4/components/Drivers/st25r3916/include/st25r3916_reg.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef ST25R3916_REG_H #define ST25R3916_REG_H diff --git a/firmware_p4/components/Drivers/st25r3916/st25r3916_aat.c b/firmware_p4/components/Drivers/st25r3916/st25r3916_aat.c index ad468b86..fb0ba192 100644 --- a/firmware_p4/components/Drivers/st25r3916/st25r3916_aat.c +++ b/firmware_p4/components/Drivers/st25r3916/st25r3916_aat.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "st25r3916_aat.h" diff --git a/firmware_p4/components/Drivers/st25r3916/st25r3916_core.c b/firmware_p4/components/Drivers/st25r3916/st25r3916_core.c index 3600a5a0..726c0ba8 100644 --- a/firmware_p4/components/Drivers/st25r3916/st25r3916_core.c +++ b/firmware_p4/components/Drivers/st25r3916/st25r3916_core.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "st25r3916_core.h" diff --git a/firmware_p4/components/Drivers/st25r3916/st25r3916_fifo.c b/firmware_p4/components/Drivers/st25r3916/st25r3916_fifo.c index 64c142e9..19177976 100644 --- a/firmware_p4/components/Drivers/st25r3916/st25r3916_fifo.c +++ b/firmware_p4/components/Drivers/st25r3916/st25r3916_fifo.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "st25r3916_fifo.h" diff --git a/firmware_p4/components/Drivers/st25r3916/st25r3916_irq.c b/firmware_p4/components/Drivers/st25r3916/st25r3916_irq.c index 8f5912a4..c9e266d0 100644 --- a/firmware_p4/components/Drivers/st25r3916/st25r3916_irq.c +++ b/firmware_p4/components/Drivers/st25r3916/st25r3916_irq.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "st25r3916_irq.h" diff --git a/firmware_p4/components/Drivers/st7789/include/st7789.h b/firmware_p4/components/Drivers/st7789/include/st7789.h index 9c0ee78a..d031449a 100644 --- a/firmware_p4/components/Drivers/st7789/include/st7789.h +++ b/firmware_p4/components/Drivers/st7789/include/st7789.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef ST7789_H #define ST7789_H diff --git a/firmware_p4/components/Drivers/st7789/st7789.c b/firmware_p4/components/Drivers/st7789/st7789.c index 5d095aea..568d572b 100644 --- a/firmware_p4/components/Drivers/st7789/st7789.c +++ b/firmware_p4/components/Drivers/st7789/st7789.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "st7789.h" diff --git a/firmware_p4/components/Drivers/sx1262/include/sx1262.h b/firmware_p4/components/Drivers/sx1262/include/sx1262.h new file mode 100644 index 00000000..ff535832 --- /dev/null +++ b/firmware_p4/components/Drivers/sx1262/include/sx1262.h @@ -0,0 +1,228 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#ifndef SX1262_H +#define SX1262_H + +#include "esp_err.h" +#include "sx1262_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Initialize the SX1262 driver. + * + * Validates HAL callbacks and config, performs hardware reset, + * calibration, workarounds, and configures the radio. + * DS Section 14.5 init sequence. + * + * @param config Pointer to configuration (includes HAL). Must not be NULL. + * @return ESP_OK on success, ESP_ERR_INVALID_ARG if config/HAL invalid. + */ +esp_err_t sx1262_init(const sx1262_config_t *config); + +/** + * @brief Start the IRQ processing task. + * + * Creates the ISR task and enables DIO1 interrupt. + * + * @return ESP_OK on success, ESP_ERR_INVALID_STATE if already running. + */ +esp_err_t sx1262_start(void); + +/** + * @brief Stop the IRQ processing task gracefully. + * + * Waits for task to exit via task notification. Safe to call if not running. + */ +void sx1262_stop(void); + +/** + * @brief Reconfigure LoRa parameters at runtime. + * + * Validates all parameters before any SPI transaction. + * Applies workaround W4 (IQ polarity) on every call. + * + * @param config Pointer to new configuration. Must not be NULL. + * @return ESP_OK on success, ESP_ERR_INVALID_ARG if parameters invalid. + */ +esp_err_t sx1262_config_lora(const sx1262_config_t *config); + +/** + * @brief Register event callbacks. + * + * @param cbs Pointer to callback struct. Must not be NULL. + * @return ESP_OK on success, ESP_ERR_INVALID_ARG if cbs is NULL. + */ +esp_err_t sx1262_set_callbacks(const sx1262_callbacks_t *cbs); + +/* ── FSM ──────────────────────────────────────────────────────────── */ + +/** + * @brief Get current FSM state. + * + * @return Current state (sx1262_state_t). + */ +sx1262_state_t sx1262_get_state(void); + +/* ── Status ───────────────────────────────────────────────────────── */ + +/** + * @brief Check if the IRQ processing task is running. + * + * @return true if running, false otherwise. + */ +bool sx1262_is_running(void); + +/** + * @brief Read chip status byte. DS Section 13.5.1. + * + * @param out_status Pointer to receive status byte. Must not be NULL. + * @return ESP_OK on success, ESP_ERR_INVALID_ARG if out_status is NULL. + */ +esp_err_t sx1262_get_status(uint8_t *out_status); + +/** + * @brief Read device error bitmask. DS Section 13.5.7. + * + * @param out_errors Pointer to receive error bitmask. Must not be NULL. + * @return ESP_OK on success, ESP_ERR_INVALID_ARG if out_errors is NULL. + */ +esp_err_t sx1262_get_device_errors(uint16_t *out_errors); + +/** + * @brief Read instantaneous RSSI of the channel. DS Section 13.5.4. + * + * @param out_rssi_dbm Pointer to receive RSSI in dBm. Must not be NULL. + * @return ESP_OK on success, ESP_ERR_INVALID_ARG if out_rssi_dbm is NULL. + */ +esp_err_t sx1262_get_rssi_inst(int16_t *out_rssi_dbm); + +/** + * @brief Read packet statistics (received, CRC errors, header errors). + * DS Section 13.5.5. + * + * @param out_stats Pointer to receive statistics. Must not be NULL. + * @return ESP_OK on success, ESP_ERR_INVALID_ARG if out_stats is NULL. + */ +esp_err_t sx1262_get_stats(sx1262_stats_t *out_stats); + +/* ── TX ───────────────────────────────────────────────────────────── */ + +/** + * @brief Transmit data via LoRa. Non-blocking. + * + * Applies workaround W1 (BW500 sensitivity) before each TX. + * Completion notified via on_tx_done callback. + * + * @param data Payload bytes. Must not be NULL. + * @param len Payload length (1-255). 0 returns ESP_ERR_INVALID_ARG. + * @param timeout_ms TX timeout in ms. 0 = no timeout. + * @return ESP_OK on success, ESP_ERR_INVALID_ARG if data is NULL or len is 0. + */ +esp_err_t sx1262_transmit(const uint8_t *data, uint8_t len, uint32_t timeout_ms); + +/* ── RX ───────────────────────────────────────────────────────────── */ + +/** + * @brief Start single RX. Returns to STDBY after one packet or timeout. + * + * @param timeout_ms 0 = no timeout (wait forever). >0 = timeout in ms. + * @return ESP_OK on success. + */ +esp_err_t sx1262_receive_single(uint32_t timeout_ms); + +/** + * @brief Start continuous RX. Stays in RX until sx1262_stop_rx() is called. + * + * @return ESP_OK on success. + */ +esp_err_t sx1262_receive_continuous(void); + +/** + * @brief Stop RX and return to STDBY_RC. + */ +void sx1262_stop_rx(void); + +/** + * @brief Dequeue next received packet from the ring buffer. + * + * Thread-safe via enter_critical/exit_critical. + * + * @param out_packet Destination for packet data. Must not be NULL. + * @return ESP_OK if packet available, ESP_ERR_NOT_FOUND if empty. + */ +esp_err_t sx1262_get_packet(sx1262_packet_t *out_packet); + +/* ── CAD & Power ──────────────────────────────────────────────────── */ + +/** + * @brief Start Channel Activity Detection. DS Section 13.4.7. + * + * CAD parameters adjusted per SF. Result via on_cad_done callback. + * + * @return ESP_OK on success, ESP_ERR_INVALID_STATE if in TX or UNKNOWN. + */ +esp_err_t sx1262_cad_start(void); + +/** + * @brief Enter sleep mode. DS Section 9.3. + * + * @param is_warm true = warm start (retain config), false = cold start. + * Cold start sets s_needs_reinit — TX/RX require re-init. + * @return ESP_OK on success, ESP_ERR_INVALID_STATE if transition not allowed. + */ +esp_err_t sx1262_sleep(bool is_warm); + +/** + * @brief Wake from sleep and enter STDBY_RC. DS Section 9.3. + * + * Toggles NSS LOW to wake chip, waits for BUSY, sends SetStandby(RC). + * + * @return ESP_OK on success, ESP_ERR_INVALID_STATE if not in SLEEP. + */ +esp_err_t sx1262_wakeup(void); + +/** + * @brief Start RX duty cycle (wake-on-radio). DS Table 13-12. + * + * Chip alternates between RX and sleep automatically. + * Period conversion: ticks = ms * 64 (1 tick = 15.625 us). + * + * @param rx_ms RX window in ms. Must be > 0. + * @param sleep_ms Sleep window in ms. + * @return ESP_OK on success, ESP_ERR_INVALID_ARG if rx_ms is 0. + */ +esp_err_t sx1262_set_rx_duty_cycle(uint32_t rx_ms, uint32_t sleep_ms); + +/* ── IRQ Processing ──────────────────────────────────────────────── */ + +/** + * @brief Process pending IRQ flags from the SX1262. + * + * Called by ISR task when DIO1 rises. Never call directly from ISR. + * Sequence: GetIrqStatus -> ClearIrqStatus -> dispatch -> callbacks -> FSM. + * + * @return ESP_OK on success, ESP_ERR_INVALID_STATE if not initialized. + */ +esp_err_t sx1262_process_irq(void); + +#ifdef __cplusplus +} +#endif + +#endif // SX1262_H diff --git a/firmware_p4/components/Drivers/sx1262/include/sx1262_cmd.h b/firmware_p4/components/Drivers/sx1262/include/sx1262_cmd.h new file mode 100644 index 00000000..88ebdcc9 --- /dev/null +++ b/firmware_p4/components/Drivers/sx1262/include/sx1262_cmd.h @@ -0,0 +1,125 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#ifndef SX1262_CMD_H +#define SX1262_CMD_H + +#include +#include +#include "esp_err.h" +#include "sx1262_hal.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Wait for BUSY pin to go LOW with timeout. + * + * DS Section 8.3.1: BUSY must be LOW before any SPI transaction. + * + * @param hal Pointer to HAL. + * @param timeout_ms Maximum wait time. 0 = use default (100ms). + * @return ESP_OK if BUSY went LOW, ESP_ERR_TIMEOUT otherwise. + */ +esp_err_t sx1262_cmd_wait_busy(sx1262_hal_t *hal, uint32_t timeout_ms); + +/** + * @brief Write a command to the SX1262. + * + * DS Section 10.1: [opcode][param0][param1]...[paramN] + * lock() → wait_busy → cs_low → spi_transfer → cs_high → unlock() + * + * @param hal Pointer to HAL. + * @param opcode Command opcode from sx1262_regs.h. + * @param params Parameter bytes (may be NULL if len == 0). + * @param len Number of parameter bytes. + * @return ESP_OK on success. + */ +esp_err_t sx1262_cmd_write(sx1262_hal_t *hal, uint8_t opcode, const uint8_t *params, size_t len); + +/** + * @brief Read response from the SX1262. + * + * DS Section 10.1: [opcode][NOP(status)][data0]...[dataN] + * lock() → wait_busy → cs_low → spi_transfer → cs_high → unlock() + * + * @param hal Pointer to HAL. + * @param opcode Command opcode. + * @param out_result Buffer for response bytes (excluding status). + * @param len Number of bytes to read. + * @return ESP_OK on success. + */ +esp_err_t sx1262_cmd_read(sx1262_hal_t *hal, uint8_t opcode, uint8_t *out_result, size_t len); + +/** + * @brief Write to registers via direct access. + * + * DS Section 13.2.1: [0x0D][addr_msb][addr_lsb][data0]...[dataN] + * + * @param hal Pointer to HAL. + * @param addr 16-bit register address. + * @param data Data bytes to write. Must not be NULL. + * @param len Number of bytes. Must be > 0. + * @return ESP_OK on success, ESP_ERR_INVALID_ARG if data is NULL or len is 0. + */ +esp_err_t +sx1262_cmd_write_register(sx1262_hal_t *hal, uint16_t addr, const uint8_t *data, size_t len); + +/** + * @brief Read from registers via direct access. + * + * DS Section 13.2.2: [0x1D][addr_msb][addr_lsb][NOP][data0]...[dataN] + * + * @param hal Pointer to HAL. + * @param addr 16-bit register address. + * @param out_data Buffer for read data. Must not be NULL. + * @param len Number of bytes to read. Must be > 0. + * @return ESP_OK on success, ESP_ERR_INVALID_ARG if out_data is NULL or len is 0. + */ +esp_err_t sx1262_cmd_read_register(sx1262_hal_t *hal, uint16_t addr, uint8_t *out_data, size_t len); + +/** + * @brief Write to data buffer. + * + * DS Section 13.2.3: [0x0E][offset][data0]...[dataN] + * + * @param hal Pointer to HAL. + * @param offset Buffer start offset. + * @param data Data bytes to write. Must not be NULL. + * @param len Number of bytes. Must be > 0. + * @return ESP_OK on success, ESP_ERR_INVALID_ARG if data is NULL or len is 0. + */ +esp_err_t +sx1262_cmd_write_buffer(sx1262_hal_t *hal, uint8_t offset, const uint8_t *data, size_t len); + +/** + * @brief Read from data buffer. + * + * DS Section 13.2.4: [0x1E][offset][NOP][data0]...[dataN] + * + * @param hal Pointer to HAL. + * @param offset Buffer start offset. + * @param out_data Buffer for read data. Must not be NULL. + * @param len Number of bytes to read. Must be > 0. + * @return ESP_OK on success, ESP_ERR_INVALID_ARG if out_data is NULL or len is 0. + */ +esp_err_t sx1262_cmd_read_buffer(sx1262_hal_t *hal, uint8_t offset, uint8_t *out_data, size_t len); + +#ifdef __cplusplus +} +#endif + +#endif // SX1262_CMD_H diff --git a/firmware_p4/components/Drivers/sx1262/include/sx1262_fsm.h b/firmware_p4/components/Drivers/sx1262/include/sx1262_fsm.h new file mode 100644 index 00000000..380edfc2 --- /dev/null +++ b/firmware_p4/components/Drivers/sx1262/include/sx1262_fsm.h @@ -0,0 +1,66 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#ifndef SX1262_FSM_H +#define SX1262_FSM_H + +#include "esp_err.h" +#include "sx1262_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Initialize FSM to a known state. + */ +void sx1262_fsm_init(sx1262_state_t initial_state); + +/** + * @brief Get current FSM state. + */ +sx1262_state_t sx1262_fsm_get_state(void); + +/** + * @brief Validate and execute a state transition. + * + * Based strictly on DS Fig. 9-1 transition diagram. + * Returns ESP_ERR_INVALID_STATE if the transition is not allowed. + * + * @param target Desired target state. + * @return ESP_OK if transition is valid and state was updated. + */ +esp_err_t sx1262_fsm_transition(sx1262_state_t target); + +/** + * @brief Called after IRQ completes (TxDone, RxDone, Timeout). + * + * Sets state to fallback mode (STDBY_RC by default). + * DS Section 13.1.15: SetRxTxFallbackMode. + */ +void sx1262_fsm_on_irq_complete(void); + +/** + * @brief Check if a transition from current state to target is valid. + * + * Does NOT modify state. For query/validation only. + */ +bool sx1262_fsm_can_transition(sx1262_state_t target); + +#ifdef __cplusplus +} +#endif + +#endif // SX1262_FSM_H diff --git a/firmware_p4/components/Drivers/sx1262/include/sx1262_hal.h b/firmware_p4/components/Drivers/sx1262/include/sx1262_hal.h new file mode 100644 index 00000000..d76d8c5c --- /dev/null +++ b/firmware_p4/components/Drivers/sx1262/include/sx1262_hal.h @@ -0,0 +1,139 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#ifndef SX1262_HAL_H +#define SX1262_HAL_H + +#include +#include +#include "esp_err.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief HAL contract for SX1262 driver. + * + * All hardware access is delegated through these function pointers. + * The driver core never includes platform headers. + * To port to a new platform, implement all callbacks in a new port/ file. + * + * ctx is an opaque pointer — the driver never inspects its contents. + */ +typedef struct sx1262_hal { + /** + * @brief Full-duplex SPI transfer. CS must be managed separately. + * @param ctx Opaque context. + * @param tx TX buffer (may be NULL for read-only). + * @param rx RX buffer (may be NULL for write-only). + * @param len Number of bytes to transfer. + * @return 0 on success, < 0 on failure. + */ + int (*spi_transfer)(void *ctx, const uint8_t *tx, uint8_t *rx, size_t len); + + /** + * @brief Assert chip select (NSS LOW). + * @param ctx Opaque context. + */ + void (*cs_low)(void *ctx); + + /** + * @brief De-assert chip select (NSS HIGH). + * @param ctx Opaque context. + */ + void (*cs_high)(void *ctx); + + /** + * @brief Write NRESET pin level. 0 = reset active (LOW). + * @param ctx Opaque context. + * @param level Pin level (0 or 1). + */ + void (*reset_write)(void *ctx, uint8_t level); + + /** + * @brief Read BUSY pin. Returns 1 if busy, 0 if ready. DS Section 8.3.1. + * @param ctx Opaque context. + * @return 1 if busy, 0 if ready. + */ + uint8_t (*busy_read)(void *ctx); + + /** + * @brief Blocking delay in milliseconds. Used only during reset and boot. + * @param ctx Opaque context. + * @param ms Delay in milliseconds. + */ + void (*delay_ms)(void *ctx, uint32_t ms); + + /** + * @brief Monotonic timestamp in milliseconds for timeout calculations. + * @param ctx Opaque context. + * @return Current tick count in milliseconds. + */ + uint32_t (*get_tick_ms)(void *ctx); + + /** + * @brief Lock SPI bus mutex. Called before every transaction. + * @param ctx Opaque context. + */ + void (*lock)(void *ctx); + + /** + * @brief Unlock SPI bus mutex. Called after every transaction. + * @param ctx Opaque context. + */ + void (*unlock)(void *ctx); + + /** + * @brief Disable interrupts. For ISR/task boundary protection. + * @param ctx Opaque context. + */ + void (*enter_critical)(void *ctx); + + /** + * @brief Re-enable interrupts. + * @param ctx Opaque context. + */ + void (*exit_critical)(void *ctx); + + /** + * @brief Set antenna switch mode. + * @param ctx Opaque context. + * @param mode 0 = OFF, 1 = RX, 2 = TX. Platform-specific pin control. + */ + void (*set_antenna)(void *ctx, uint8_t mode); + + /** + * @brief Opaque context pointer. Driver never inspects. + */ + void *ctx; +} sx1262_hal_t; + +/** + * @brief Create and initialize the HAL for SX1262. + * + * Configures SPI bus, GPIOs, and mutex. Fills out_hal with + * all callback pointers and context. + * + * @param out_hal Pointer to HAL struct to populate. Must not be NULL. + * @return ESP_OK on success. + */ +esp_err_t sx1262_hal_create(sx1262_hal_t *out_hal); + +#ifdef __cplusplus +} +#endif + +#endif // SX1262_HAL_H diff --git a/firmware_p4/components/Drivers/sx1262/include/sx1262_irq.h b/firmware_p4/components/Drivers/sx1262/include/sx1262_irq.h new file mode 100644 index 00000000..62f8eb41 --- /dev/null +++ b/firmware_p4/components/Drivers/sx1262/include/sx1262_irq.h @@ -0,0 +1,66 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#ifndef SX1262_IRQ_H +#define SX1262_IRQ_H + +#include "esp_err.h" +#include "sx1262_types.h" +#include "sx1262_hal.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* ── Ring Buffer Config ───────────────────────────────────────────── */ +#define SX1262_RX_RING_SIZE 8 + +/** + * @brief Initialize IRQ subsystem. Resets ring buffer. + */ +void sx1262_irq_init(sx1262_hal_t *hal, + const sx1262_config_t *config, + const sx1262_callbacks_t *cbs); + +/** + * @brief Process pending IRQ flags. + * + * Called by ISR task when DIO1 rises. Never from ISR directly. + * Sequence: GetIrqStatus → ClearIrqStatus → process → callbacks → FSM update. + * + * @return ESP_OK on success. + */ +esp_err_t sx1262_irq_process(void); + +/** + * @brief Dequeue next received packet from ring buffer. + * + * Thread-safe via enter_critical/exit_critical. + * + * @param out_packet Destination for packet data. Must not be NULL. + * @return ESP_OK if packet available, ESP_ERR_NOT_FOUND if empty. + */ +esp_err_t sx1262_irq_get_packet(sx1262_packet_t *out_packet); + +/** + * @brief Check if ring buffer has packets available. + */ +bool sx1262_irq_has_packet(void); + +#ifdef __cplusplus +} +#endif + +#endif // SX1262_IRQ_H diff --git a/firmware_p4/components/Drivers/sx1262/include/sx1262_radio.h b/firmware_p4/components/Drivers/sx1262/include/sx1262_radio.h new file mode 100644 index 00000000..cf3aab2e --- /dev/null +++ b/firmware_p4/components/Drivers/sx1262/include/sx1262_radio.h @@ -0,0 +1,117 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#ifndef SX1262_RADIO_H +#define SX1262_RADIO_H + +#include "esp_err.h" +#include "sx1262_types.h" +#include "sx1262_hal.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Initialize radio subsystem with HAL and config pointers. + */ +void sx1262_radio_init(sx1262_hal_t *hal, sx1262_config_t *config); + +/** + * @brief Transmit data via LoRa. Applies W1 before each TX. + * + * Non-blocking: returns after SetTx command. Completion via TxDone IRQ. + * + * @param data Payload bytes. Must not be NULL. + * @param len Payload length (1–255). + * @param timeout_ms TX timeout in ms. 0 = no timeout. + * @return ESP_OK on success. + */ +esp_err_t sx1262_radio_transmit(const uint8_t *data, uint8_t len, uint32_t timeout_ms); + +/** + * @brief Start single RX. Chip returns to STDBY after one packet or timeout. + * + * @param timeout_ms 0 = no timeout (single, wait forever). >0 = timeout in ms. + * @return ESP_OK on success. + */ +esp_err_t sx1262_radio_receive_single(uint32_t timeout_ms); + +/** + * @brief Start continuous RX. Chip stays in RX until stop_rx(). + * @return ESP_OK on success. + */ +esp_err_t sx1262_radio_receive_continuous(void); + +/** + * @brief Stop RX and return to STDBY_RC. + */ +void sx1262_radio_stop_rx(void); + +/** + * @brief Start Channel Activity Detection. + * Result via on_cad_done callback (is_channel_active). + * CAD params adjusted per SF — DS Table 13-71. + */ +esp_err_t sx1262_radio_cad_start(void); + +/** + * @brief Read instantaneous RSSI. DS Section 13.5.4. + * @param out_rssi_dbm Result in dBm. Must not be NULL. + */ +esp_err_t sx1262_radio_get_rssi_inst(int16_t *out_rssi_dbm); + +/** + * @brief Read packet statistics. DS Section 13.5.5. + */ +esp_err_t sx1262_radio_get_stats(sx1262_stats_t *out_stats); + +/** + * @brief Reset packet statistics. DS Section 13.5.6. + */ +esp_err_t sx1262_radio_reset_stats(void); + +/** + * @brief Enter sleep mode. DS Section 9.3, Table 13-1. + * + * @param is_warm true = warm start (retain config), false = cold start (needs re-init). + * @return ESP_OK on success. + */ +esp_err_t sx1262_radio_sleep(bool is_warm); + +/** + * @brief Wake from sleep and enter STDBY_RC. DS Section 9.3. + * + * Toggles NSS to wake chip, waits for BUSY LOW, sends SetStandby(RC). + * @return ESP_OK on success, ESP_ERR_INVALID_STATE if not in SLEEP. + */ +esp_err_t sx1262_radio_wakeup(void); + +/** + * @brief Start RX duty cycle (wake-on-radio). DS Table 13-12. + * + * Chip alternates RX/sleep automatically. 1 tick = 15.625 us. + * + * @param rx_ms RX window in ms. Must be > 0. + * @param sleep_ms Sleep window in ms. + * @return ESP_OK on success, ESP_ERR_INVALID_ARG if rx_ms == 0. + */ +esp_err_t sx1262_radio_set_rx_duty_cycle(uint32_t rx_ms, uint32_t sleep_ms); + +#ifdef __cplusplus +} +#endif + +#endif // SX1262_RADIO_H diff --git a/firmware_p4/components/Drivers/sx1262/include/sx1262_regs.h b/firmware_p4/components/Drivers/sx1262/include/sx1262_regs.h new file mode 100644 index 00000000..33a52583 --- /dev/null +++ b/firmware_p4/components/Drivers/sx1262/include/sx1262_regs.h @@ -0,0 +1,263 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#ifndef SX1262_REGS_H +#define SX1262_REGS_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* ── Opcodes: Operational Modes ───────────────────────────────────── */ +#define SX1262_OP_SET_SLEEP 0x84 /* Enter sleep mode (warm/cold) */ +#define SX1262_OP_SET_STANDBY 0x80 /* Enter standby (RC or XOSC) */ +#define SX1262_OP_SET_FS 0xC1 /* Enter frequency synthesis mode */ +#define SX1262_OP_SET_TX 0x83 /* Start transmission */ +#define SX1262_OP_SET_RX 0x82 /* Start reception */ +#define SX1262_OP_STOP_TIMER_ON_PREAMBLE 0x9F /* Stop RX timer on preamble detect */ +#define SX1262_OP_SET_RX_DUTY_CYCLE 0x94 /* RX/sleep duty cycle (wake-on-radio) */ +#define SX1262_OP_SET_CAD 0xC5 /* Start channel activity detection */ +#define SX1262_OP_SET_TX_CONTINUOUS_WAVE 0xD1 /* Continuous wave (test mode) */ +#define SX1262_OP_SET_TX_INFINITE_PREAMBLE 0xD2 /* Infinite preamble (test mode) */ +#define SX1262_OP_SET_REGULATOR_MODE 0x96 /* Select LDO or DC-DC regulator */ +#define SX1262_OP_CALIBRATE 0x89 /* Calibrate RC, PLL, ADC blocks */ +#define SX1262_OP_CALIBRATE_IMAGE 0x98 /* Calibrate image rejection for freq */ +#define SX1262_OP_SET_PA_CONFIG 0x95 /* Configure power amplifier */ +#define SX1262_OP_SET_RX_TX_FALLBACK_MODE 0x93 /* State after TX/RX complete */ + +/* ── Opcodes: Register and Buffer Access ─────────────────────────── */ +#define SX1262_OP_WRITE_REGISTER 0x0D /* Write to internal register */ +#define SX1262_OP_READ_REGISTER 0x1D /* Read from internal register */ +#define SX1262_OP_WRITE_BUFFER 0x0E /* Write payload to data buffer */ +#define SX1262_OP_READ_BUFFER 0x1E /* Read payload from data buffer */ + +/* ── Opcodes: DIO and IRQ Control ────────────────────────────────── */ +#define SX1262_OP_SET_DIO_IRQ_PARAMS 0x08 /* Map IRQ flags to DIO1/2/3 pins */ +#define SX1262_OP_GET_IRQ_STATUS 0x12 /* Read pending IRQ flags */ +#define SX1262_OP_CLEAR_IRQ_STATUS 0x02 /* Clear IRQ flags */ +#define SX1262_OP_SET_DIO2_AS_RF_SWITCH 0x9D /* DIO2 controls external RF switch */ +#define SX1262_OP_SET_DIO3_AS_TCXO 0x97 /* DIO3 powers external TCXO */ + +/* ── Opcodes: RF, Modulation and Packet ──────────────────────────── */ +#define SX1262_OP_SET_RF_FREQUENCY 0x86 /* Set carrier frequency in Hz */ +#define SX1262_OP_SET_PACKET_TYPE 0x8A /* Select LoRa or FSK modulation */ +#define SX1262_OP_GET_PACKET_TYPE 0x11 /* Read current modulation type */ +#define SX1262_OP_SET_TX_PARAMS 0x8E /* Set TX power and PA ramp time */ +#define SX1262_OP_SET_MODULATION_PARAMS 0x8B /* Set SF, BW, CR, LDRO */ +#define SX1262_OP_SET_PACKET_PARAMS 0x8C /* Set preamble, header, CRC, IQ */ +#define SX1262_OP_SET_CAD_PARAMS 0x88 /* Set CAD detection thresholds */ +#define SX1262_OP_SET_BUFFER_BASE_ADDR 0x8F /* Set TX/RX buffer start offsets */ +#define SX1262_OP_SET_LORA_SYMB_NUM_TIMEOUT 0xA0 /* Set symbol timeout for RX */ + +/* ── Opcodes: Status ─────────────────────────────────────────────── */ +#define SX1262_OP_GET_STATUS 0xC0 /* Read chip mode and command status */ +#define SX1262_OP_GET_RX_BUFFER_STATUS 0x13 /* Read RX payload length and offset */ +#define SX1262_OP_GET_PACKET_STATUS 0x14 /* Read RSSI, SNR of last packet */ +#define SX1262_OP_GET_RSSI_INST 0x15 /* Read instantaneous channel RSSI */ +#define SX1262_OP_GET_STATS 0x10 /* Read RX packet/error counters */ +#define SX1262_OP_RESET_STATS 0x00 /* Reset RX packet/error counters */ +#define SX1262_OP_GET_DEVICE_ERRORS 0x17 /* Read hardware error bitmask */ +#define SX1262_OP_CLEAR_DEVICE_ERRORS 0x07 /* Clear hardware error bitmask */ + +/* ── Standby Modes ───────────────────────────────────────────────── */ +#define SX1262_STDBY_RC 0x00 /* 13 MHz RC oscillator */ +#define SX1262_STDBY_XOSC 0x01 /* External crystal oscillator */ + +/* ── Packet Type ─────────────────────────────────────────────────── */ +#define SX1262_PACKET_TYPE_GFSK 0x00 /* FSK modulation */ +#define SX1262_PACKET_TYPE_LORA 0x01 /* LoRa modulation */ + +/* ── Regulator Mode ──────────────────────────────────────────────── */ +#define SX1262_REGULATOR_LDO 0x00 /* LDO regulator (higher consumption) */ +#define SX1262_REGULATOR_DCDC 0x01 /* DC-DC regulator (lower consumption) */ + +/* ── PA Ramp Time ────────────────────────────────────────────────── */ +#define SX1262_PA_RAMP_10U 0x00 /* 10 us */ +#define SX1262_PA_RAMP_20U 0x01 /* 20 us */ +#define SX1262_PA_RAMP_40U 0x02 /* 40 us */ +#define SX1262_PA_RAMP_80U 0x03 /* 80 us */ +#define SX1262_PA_RAMP_200U 0x04 /* 200 us */ +#define SX1262_PA_RAMP_800U 0x05 /* 800 us */ +#define SX1262_PA_RAMP_1700U 0x06 /* 1.7 ms */ +#define SX1262_PA_RAMP_3400U 0x07 /* 3.4 ms */ + +/* ── LoRa Spreading Factor ────────────────────────────────────────── */ +#define SX1262_LORA_SF5 0x05 /* Fastest, shortest range */ +#define SX1262_LORA_SF6 0x06 /* Requires implicit header */ +#define SX1262_LORA_SF7 0x07 /* Default for most apps */ +#define SX1262_LORA_SF8 0x08 +#define SX1262_LORA_SF9 0x09 +#define SX1262_LORA_SF10 0x0A +#define SX1262_LORA_SF11 0x0B /* LDRO required at BW<=125kHz */ +#define SX1262_LORA_SF12 0x0C /* Slowest, longest range */ + +/* ── LoRa Bandwidth (values are non-linear — use sx1262_bw_to_hz()) ── */ +#define SX1262_LORA_BW_7 0x00 /* 7.81 kHz */ +#define SX1262_LORA_BW_10 0x08 /* 10.42 kHz */ +#define SX1262_LORA_BW_15 0x01 /* 15.63 kHz */ +#define SX1262_LORA_BW_20 0x09 /* 20.83 kHz */ +#define SX1262_LORA_BW_31 0x02 /* 31.25 kHz */ +#define SX1262_LORA_BW_41 0x0A /* 41.67 kHz */ +#define SX1262_LORA_BW_62 0x03 /* 62.50 kHz */ +#define SX1262_LORA_BW_125 0x04 /* 125 kHz */ +#define SX1262_LORA_BW_250 0x05 /* 250 kHz */ +#define SX1262_LORA_BW_500 0x06 /* 500 kHz */ + +/* ── LoRa Coding Rate ────────────────────────────────────────────── */ +#define SX1262_LORA_CR_4_5 0x01 /* 4/5 — least redundancy */ +#define SX1262_LORA_CR_4_6 0x02 /* 4/6 */ +#define SX1262_LORA_CR_4_7 0x03 /* 4/7 */ +#define SX1262_LORA_CR_4_8 0x04 /* 4/8 — most redundancy */ + +/* ── LoRa Header Type ────────────────────────────────────────────── */ +#define SX1262_LORA_HEADER_EXPLICIT 0x00 /* Header with payload len, CR, CRC */ +#define SX1262_LORA_HEADER_IMPLICIT 0x01 /* No header — params must match */ + +/* ── IRQ Flag Masks ──────────────────────────────────────────────── */ +#define SX1262_IRQ_TX_DONE (1U << 0) /* Transmission complete */ +#define SX1262_IRQ_RX_DONE (1U << 1) /* Packet received */ +#define SX1262_IRQ_PREAMBLE_DETECTED (1U << 2) /* LoRa preamble detected */ +#define SX1262_IRQ_SYNC_WORD_VALID (1U << 3) /* Sync word matched */ +#define SX1262_IRQ_HEADER_VALID (1U << 4) /* Valid header received */ +#define SX1262_IRQ_HEADER_ERR (1U << 5) /* Header CRC error */ +#define SX1262_IRQ_CRC_ERR (1U << 6) /* Payload CRC error */ +#define SX1262_IRQ_CAD_DONE (1U << 7) /* CAD scan complete */ +#define SX1262_IRQ_CAD_DETECTED (1U << 8) /* LoRa activity detected */ +#define SX1262_IRQ_TIMEOUT (1U << 9) /* RX or TX timeout */ +#define SX1262_IRQ_ALL 0x03FFU /* All flags combined */ + +/* ── LoRa Sync Word Registers ────────────────────────────────────── */ +#define SX1262_REG_LORA_SYNC_WORD_MSB 0x0740 /* Sync word byte 0 */ +#define SX1262_REG_LORA_SYNC_WORD_LSB 0x0741 /* Sync word byte 1 */ +#define SX1262_LORA_SYNC_WORD_PUBLIC 0x3444 /* LoRaWAN public network */ +#define SX1262_LORA_SYNC_WORD_PRIVATE 0x1424 /* Private/Meshtastic network */ + +/* ── Rx Gain Register ────────────────────────────────────────────── */ +#define SX1262_REG_RX_GAIN 0x08AC /* RX gain boost control */ + +/* ── Workaround Registers (DS Section 15) ────────────────────────── */ +#define SX1262_REG_TX_MODULATION 0x0889 /* W1: BW500 sensitivity fix — bit 2 */ +#define SX1262_REG_TX_CLAMP_CONFIG 0x08D8 /* W2: PA over-clamp fix — bits 4:1 */ +#define SX1262_REG_RTC_CTRL 0x0902 /* W3: Implicit header timeout — bit 0 */ +#define SX1262_REG_EVT_CLR 0x0944 /* W3: Event clear for RTC stop — bit 1 */ +#define SX1262_REG_IQ_POLARITY 0x0736 /* W4: Inverted IQ polarity fix — bit 2 */ + +/* ── Sleep Configuration ─────────────────────────────────────────── */ +#define SX1262_SLEEP_COLD_START 0x00 /* Lose all config, full re-init needed */ +#define SX1262_SLEEP_WARM_START 0x04 /* Retain config, fast wakeup */ + +/* ── Fallback Mode After TX/RX ───────────────────────────────────── */ +#define SX1262_FALLBACK_STDBY_RC 0x20 /* Return to standby RC */ +#define SX1262_FALLBACK_STDBY_XOSC 0x30 /* Return to standby XOSC */ +#define SX1262_FALLBACK_FS 0x40 /* Return to frequency synth */ + +/* ── Calibration Block Bitmask ───────────────────────────────────── */ +#define SX1262_CALIBRATE_RC64K (1U << 0) /* 64 kHz RC oscillator */ +#define SX1262_CALIBRATE_RC13M (1U << 1) /* 13 MHz RC oscillator */ +#define SX1262_CALIBRATE_PLL (1U << 2) /* PLL synthesizer */ +#define SX1262_CALIBRATE_ADC_PULSE (1U << 3) /* ADC pulse */ +#define SX1262_CALIBRATE_ADC_BULK_N (1U << 4) /* ADC bulk N-path */ +#define SX1262_CALIBRATE_ADC_BULK_P (1U << 5) /* ADC bulk P-path */ +#define SX1262_CALIBRATE_IMAGE (1U << 6) /* Image rejection */ +#define SX1262_CALIBRATE_ALL 0x7F /* All blocks */ + +/* ── Status Byte Parsing ─────────────────────────────────────────── */ +#define SX1262_STATUS_CHIP_MODE_MASK 0x70 /* Bits 6:4 = chip operating mode */ +#define SX1262_STATUS_CHIP_MODE_SHIFT 4 +#define SX1262_STATUS_CMD_STATUS_MASK 0x0E /* Bits 3:1 = last command status */ +#define SX1262_STATUS_CMD_STATUS_SHIFT 1 + +/* ── Chip Mode Values (from status byte bits 6:4) ────────────────── */ +#define SX1262_CHIP_MODE_UNUSED 0x00 /* Not used */ +#define SX1262_CHIP_MODE_STDBY_RC 0x02 /* Standby with RC oscillator */ +#define SX1262_CHIP_MODE_STDBY_XOSC 0x03 /* Standby with crystal */ +#define SX1262_CHIP_MODE_FS 0x04 /* Frequency synthesis */ +#define SX1262_CHIP_MODE_RX 0x05 /* Receiving */ +#define SX1262_CHIP_MODE_TX 0x06 /* Transmitting */ + +/* ── Timing Constants ────────────────────────────────────────────── */ +#define SX1262_WAIT_BUSY_TIMEOUT_MS 100 /* Max wait for BUSY LOW */ +#define SX1262_RESET_HOLD_MS 2 /* NRESET LOW hold time */ +#define SX1262_RESET_WAIT_MS 20 /* Wait after NRESET HIGH */ + +/* ── TCXO Supply Voltage ─────────────────────────────────────────── */ +#define SX1262_TCXO_1V6 0x00 /* 1.6V */ +#define SX1262_TCXO_1V7 0x01 /* 1.7V */ +#define SX1262_TCXO_1V8 0x02 /* 1.8V */ +#define SX1262_TCXO_2V2 0x03 /* 2.2V */ +#define SX1262_TCXO_2V4 0x04 /* 2.4V */ +#define SX1262_TCXO_2V7 0x05 /* 2.7V */ +#define SX1262_TCXO_3V0 0x06 /* 3.0V */ +#define SX1262_TCXO_3V3 0x07 /* 3.3V */ + +/* ── PA Configuration (optimal for +22 dBm on SX1262) ────────────── */ +#define SX1262_PA_DUTY_CYCLE_22DBM 0x04 /* PA duty cycle for +22dBm */ +#define SX1262_PA_HP_MAX_22DBM 0x07 /* HP PA max power */ +#define SX1262_PA_DEVICE_SEL_SX1262 0x00 /* Device select: SX1262 */ +#define SX1262_PA_LUT_1 0x01 /* PA lookup table 1 */ + +/* ── Antenna Switch Modes ────────────────────────────────────────── */ +#define SX1262_ANT_OFF 0x00 /* Both TX/RX switches off */ +#define SX1262_ANT_RX 0x01 /* RX path enabled */ +#define SX1262_ANT_TX 0x02 /* TX path enabled */ + +/** + * @brief Convert LoRa BW enum (DS Table 13-48) to bandwidth in Hz. + * + * BW enum values are non-linear, so direct comparison is unsafe. + * Use this function for any BW magnitude comparison. + */ +static inline uint32_t sx1262_bw_to_hz(uint8_t bw) { + switch (bw) { + case SX1262_LORA_BW_7: + return 7810; + case SX1262_LORA_BW_10: + return 10420; + case SX1262_LORA_BW_15: + return 15630; + case SX1262_LORA_BW_20: + return 20830; + case SX1262_LORA_BW_31: + return 31250; + case SX1262_LORA_BW_41: + return 41670; + case SX1262_LORA_BW_62: + return 62500; + case SX1262_LORA_BW_125: + return 125000; + case SX1262_LORA_BW_250: + return 250000; + case SX1262_LORA_BW_500: + return 500000; + default: + return 0; + } +} + +/** + * @brief Check if a BW enum value is valid (DS Table 13-48). + */ +static inline bool sx1262_bw_is_valid(uint8_t bw) { + return sx1262_bw_to_hz(bw) != 0; +} + +#ifdef __cplusplus +} +#endif + +#endif // SX1262_REGS_H diff --git a/firmware_p4/components/Drivers/sx1262/include/sx1262_types.h b/firmware_p4/components/Drivers/sx1262/include/sx1262_types.h new file mode 100644 index 00000000..78df28ce --- /dev/null +++ b/firmware_p4/components/Drivers/sx1262/include/sx1262_types.h @@ -0,0 +1,128 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#ifndef SX1262_TYPES_H +#define SX1262_TYPES_H + +#include +#include +#include "sx1262_hal.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief FSM states matching DS Fig. 9-1 / Table 9-1. + */ +typedef enum { + SX1262_STATE_UNKNOWN = 0, /**< Before any init. */ + SX1262_STATE_SLEEP = 1, /**< Minimum consumption — DS Section 9.3. */ + SX1262_STATE_STDBY_RC = 2, /**< RC13M active — DS Section 9.4. */ + SX1262_STATE_STDBY_XOSC = 3, /**< XOSC active — DS Section 9.4. */ + SX1262_STATE_FS = 4, /**< PLL locked — DS Section 9.5. */ + SX1262_STATE_TX = 5, /**< Transmitting — DS Section 9.7. */ + SX1262_STATE_RX = 6, /**< Receiving — DS Section 9.6. */ +} sx1262_state_t; + +/** + * @brief LoRa radio configuration parameters. + */ +typedef struct { + sx1262_hal_t hal; /**< Platform HAL — all callbacks. */ + uint32_t frequency_hz; /**< 150 000 000 – 960 000 000 Hz. */ + uint8_t sf; /**< Spreading factor: SX1262_LORA_SF5 … SF12. */ + uint8_t bw; /**< Bandwidth: SX1262_LORA_BW_7 … BW_500. */ + uint8_t cr; /**< Coding rate: SX1262_LORA_CR_4_5 … CR_4_8. */ + int8_t tx_power_dbm; /**< TX power: -9 to +22 dBm. */ + uint16_t preamble_len; /**< Preamble symbols. Min recommended: 12. */ + bool is_crc_on; /**< Enable CRC on payload. */ + bool is_inverted_iq; /**< true = LoRaWAN downlink (activates W4). */ + bool is_implicit_hdr; /**< true = Implicit Header mode (activates W3). */ + bool is_public_network; /**< true = public sync word (0x3444). */ +} sx1262_config_t; + +/** + * @brief Received packet with payload and RF metadata. + */ +typedef struct { + uint8_t buf[256]; /**< Payload — static buffer. */ + uint8_t len; /**< Valid bytes in buf. */ + int16_t rssi_pkt_dbm; /**< Packet RSSI in dBm. */ + int8_t snr_pkt_db; /**< SNR in dB. */ + int16_t signal_rssi_dbm; /**< Signal RSSI — DS Section 13.5.3. */ + bool has_crc_error; /**< CRC check failed. */ + bool has_header_error; /**< Header corrupted. */ +} sx1262_packet_t; + +/** + * @brief Packet statistics counters. DS Section 13.5.5. + */ +typedef struct { + uint16_t nb_pkt_received; /**< Total packets received. */ + uint16_t nb_crc_error; /**< Packets with CRC error. */ + uint16_t nb_header_error; /**< Packets with header error. */ +} sx1262_stats_t; + +/** + * @brief Callback: TX completed successfully. + * @param ctx User context pointer. + */ +typedef void (*sx1262_tx_done_cb_t)(void *ctx); + +/** + * @brief Callback: packet received. + * @param pkt Pointer to received packet data. + * @param ctx User context pointer. + */ +typedef void (*sx1262_rx_done_cb_t)(const sx1262_packet_t *pkt, void *ctx); + +/** + * @brief Callback: CAD completed. + * @param is_channel_active true if LoRa activity detected. + * @param ctx User context pointer. + */ +typedef void (*sx1262_cad_done_cb_t)(bool is_channel_active, void *ctx); + +/** + * @brief Callback: RX or TX timeout. + * @param ctx User context pointer. + */ +typedef void (*sx1262_timeout_cb_t)(void *ctx); + +/** + * @brief Callback: hardware error (CRC or header error standalone). + * @param err Error code. + * @param ctx User context pointer. + */ +typedef void (*sx1262_error_cb_t)(int err, void *ctx); + +/** + * @brief Event callback registration struct. + */ +typedef struct { + sx1262_tx_done_cb_t on_tx_done; /**< TX done callback. May be NULL. */ + sx1262_rx_done_cb_t on_rx_done; /**< RX done callback. May be NULL. */ + sx1262_cad_done_cb_t on_cad_done; /**< CAD done callback. May be NULL. */ + sx1262_timeout_cb_t on_timeout; /**< Timeout callback. May be NULL. */ + sx1262_error_cb_t on_error; /**< Error callback. May be NULL. */ + void *cb_ctx; /**< User context for all callbacks. */ +} sx1262_callbacks_t; + +#ifdef __cplusplus +} +#endif + +#endif // SX1262_TYPES_H diff --git a/firmware_p4/components/Drivers/sx1262/sx1262.c b/firmware_p4/components/Drivers/sx1262/sx1262.c new file mode 100644 index 00000000..32789b6a --- /dev/null +++ b/firmware_p4/components/Drivers/sx1262/sx1262.c @@ -0,0 +1,685 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#include "sx1262.h" + +#include + +#include "esp_log.h" +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" + +#include "sx1262_regs.h" +#include "sx1262_cmd.h" +#include "sx1262_fsm.h" +#include "sx1262_irq.h" +#include "sx1262_radio.h" + +static const char *TAG = "SX1262"; + +static sx1262_config_t s_config; +static sx1262_callbacks_t s_callbacks = {0}; +static bool s_is_running = false; +static bool s_is_initialized = false; +static TaskHandle_t s_irq_task_handle = NULL; +static TaskHandle_t s_stop_caller_handle = NULL; + +#define SX1262_IRQ_TASK_STACK 4096 +#define SX1262_IRQ_TASK_PRIO 10 +#define SX1262_IRQ_TASK_CORE 0 + +static esp_err_t validate_hal(const sx1262_hal_t *hal); +static esp_err_t validate_config(const sx1262_config_t *config); +static esp_err_t hw_reset(sx1262_hal_t *hal); +static esp_err_t apply_workaround_w2(sx1262_hal_t *hal); +static esp_err_t apply_workaround_w4(sx1262_hal_t *hal, bool is_inverted_iq); +static esp_err_t calibrate_image(sx1262_hal_t *hal, uint32_t freq_hz); +static uint8_t compute_ldro(uint8_t sf, uint8_t bw); +static void irq_task(void *arg); + +esp_err_t sx1262_init(const sx1262_config_t *config) { + if (config == NULL) { + ESP_LOGE(TAG, "config is NULL"); + return ESP_ERR_INVALID_ARG; + } + + esp_err_t ret = validate_hal(&config->hal); + if (ret != ESP_OK) { + return ret; + } + + ret = validate_config(config); + if (ret != ESP_OK) { + return ret; + } + + memcpy(&s_config, config, sizeof(sx1262_config_t)); + sx1262_hal_t *hal = &s_config.hal; + + ret = hw_reset(hal); + if (ret != ESP_OK) { + return ret; + } + + sx1262_fsm_init(SX1262_STATE_STDBY_RC); + + uint8_t stdby_param = SX1262_STDBY_RC; + ret = sx1262_cmd_write(hal, SX1262_OP_SET_STANDBY, &stdby_param, 1); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "SetStandby failed"); + return ret; + } + + uint8_t reg_mode = SX1262_REGULATOR_DCDC; + ret = sx1262_cmd_write(hal, SX1262_OP_SET_REGULATOR_MODE, ®_mode, 1); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "SetRegulatorMode failed"); + return ret; + } + + uint8_t cal_param = SX1262_CALIBRATE_ALL; + ret = sx1262_cmd_write(hal, SX1262_OP_CALIBRATE, &cal_param, 1); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "Calibrate failed"); + return ret; + } + + ret = sx1262_cmd_wait_busy(hal, SX1262_WAIT_BUSY_TIMEOUT_MS); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "BUSY timeout after Calibrate"); + return ret; + } + + ret = calibrate_image(hal, config->frequency_hz); + if (ret != ESP_OK) { + return ret; + } + + ret = apply_workaround_w2(hal); + if (ret != ESP_OK) { + return ret; + } + + uint8_t fallback_param = SX1262_FALLBACK_STDBY_RC; + ret = sx1262_cmd_write(hal, SX1262_OP_SET_RX_TX_FALLBACK_MODE, &fallback_param, 1); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "SetRxTxFallbackMode failed"); + return ret; + } + + uint8_t dio2_param = 0x01; + ret = sx1262_cmd_write(hal, SX1262_OP_SET_DIO2_AS_RF_SWITCH, &dio2_param, 1); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "SetDIO2AsRfSwitch failed"); + return ret; + } + + uint8_t err_buf[2] = {0}; + ret = sx1262_cmd_read(hal, SX1262_OP_GET_DEVICE_ERRORS, err_buf, 2); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "GetDeviceErrors failed"); + return ret; + } + uint16_t device_errors = ((uint16_t)err_buf[0] << 8) | err_buf[1]; + if (device_errors != 0) { + ESP_LOGE(TAG, "Device errors after calibration: 0x%04X", device_errors); + return ESP_ERR_INVALID_STATE; + } + + uint8_t clr_params[2] = {0x00, 0x00}; + sx1262_cmd_write(hal, SX1262_OP_CLEAR_DEVICE_ERRORS, clr_params, 2); + + s_is_initialized = true; + + ret = sx1262_config_lora(config); + if (ret != ESP_OK) { + return ret; + } + + sx1262_irq_init(hal, &s_config, &s_callbacks); + + sx1262_radio_init(hal, &s_config); + + uint8_t status = 0; + ret = sx1262_get_status(&status); + if (ret != ESP_OK) { + return ret; + } + + uint8_t chip_mode = (status & SX1262_STATUS_CHIP_MODE_MASK) >> SX1262_STATUS_CHIP_MODE_SHIFT; + + ESP_LOGI(TAG, + "Init OK — status: 0x%02X, chip_mode: %d (STDBY_RC=%d)", + status, + chip_mode, + SX1262_CHIP_MODE_STDBY_RC); + ESP_LOGI(TAG, + "Initialized — freq: %lu, sf: %d, bw: 0x%02X, power: %d dBm", + (unsigned long)config->frequency_hz, + config->sf, + config->bw, + config->tx_power_dbm); + + return ESP_OK; +} + +esp_err_t sx1262_config_lora(const sx1262_config_t *config) { + if (config == NULL) { + ESP_LOGE(TAG, "config_lora: config is NULL"); + return ESP_ERR_INVALID_ARG; + } + + esp_err_t ret = validate_config(config); + if (ret != ESP_OK) { + return ret; + } + + sx1262_hal_t hal_backup = s_config.hal; + memcpy(&s_config, config, sizeof(sx1262_config_t)); + s_config.hal = hal_backup; + + sx1262_hal_t *hal = &s_config.hal; + + uint8_t pkt_type = SX1262_PACKET_TYPE_LORA; + ret = sx1262_cmd_write(hal, SX1262_OP_SET_PACKET_TYPE, &pkt_type, 1); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "SetPacketType failed"); + return ret; + } + + uint32_t rf_freq = (uint32_t)((uint64_t)config->frequency_hz * (1UL << 25) / 32000000UL); + uint8_t freq_params[4] = { + (uint8_t)(rf_freq >> 24), + (uint8_t)(rf_freq >> 16), + (uint8_t)(rf_freq >> 8), + (uint8_t)(rf_freq), + }; + ret = sx1262_cmd_write(hal, SX1262_OP_SET_RF_FREQUENCY, freq_params, 4); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "SetRfFrequency failed"); + return ret; + } + + uint8_t pa_params[4] = { + SX1262_PA_DUTY_CYCLE_22DBM, + SX1262_PA_HP_MAX_22DBM, + SX1262_PA_DEVICE_SEL_SX1262, + SX1262_PA_LUT_1, + }; + ret = sx1262_cmd_write(hal, SX1262_OP_SET_PA_CONFIG, pa_params, 4); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "SetPaConfig failed"); + return ret; + } + + uint8_t tx_params[2] = {(uint8_t)config->tx_power_dbm, SX1262_PA_RAMP_200U}; + ret = sx1262_cmd_write(hal, SX1262_OP_SET_TX_PARAMS, tx_params, 2); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "SetTxParams failed"); + return ret; + } + + uint8_t buf_addr[2] = {0x00, 0x00}; + ret = sx1262_cmd_write(hal, SX1262_OP_SET_BUFFER_BASE_ADDR, buf_addr, 2); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "SetBufferBaseAddress failed"); + return ret; + } + + uint8_t ldro = compute_ldro(config->sf, config->bw); + uint8_t mod_params[4] = {config->sf, config->bw, config->cr, ldro}; + ret = sx1262_cmd_write(hal, SX1262_OP_SET_MODULATION_PARAMS, mod_params, 4); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "SetModulationParams failed"); + return ret; + } + + uint8_t header_type = + config->is_implicit_hdr ? SX1262_LORA_HEADER_IMPLICIT : SX1262_LORA_HEADER_EXPLICIT; + uint8_t crc_on = config->is_crc_on ? 0x01 : 0x00; + uint8_t invert_iq = config->is_inverted_iq ? 0x01 : 0x00; + uint8_t pkt_params[6] = { + (uint8_t)(config->preamble_len >> 8), + (uint8_t)(config->preamble_len & 0xFF), + header_type, + 0xFF, + crc_on, + invert_iq, + }; + ret = sx1262_cmd_write(hal, SX1262_OP_SET_PACKET_PARAMS, pkt_params, 6); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "SetPacketParams failed"); + return ret; + } + + uint16_t irq_mask = SX1262_IRQ_TX_DONE | SX1262_IRQ_RX_DONE | SX1262_IRQ_TIMEOUT | + SX1262_IRQ_CRC_ERR | SX1262_IRQ_HEADER_ERR | SX1262_IRQ_CAD_DONE | + SX1262_IRQ_CAD_DETECTED; + uint8_t irq_params[8] = { + (uint8_t)(irq_mask >> 8), + (uint8_t)(irq_mask), + (uint8_t)(irq_mask >> 8), + (uint8_t)(irq_mask), + 0x00, + 0x00, + 0x00, + 0x00, + }; + ret = sx1262_cmd_write(hal, SX1262_OP_SET_DIO_IRQ_PARAMS, irq_params, 8); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "SetDioIrqParams failed"); + return ret; + } + + uint16_t sync_word = + config->is_public_network ? SX1262_LORA_SYNC_WORD_PUBLIC : SX1262_LORA_SYNC_WORD_PRIVATE; + uint8_t sw_data[2] = {(uint8_t)(sync_word >> 8), (uint8_t)(sync_word)}; + ret = sx1262_cmd_write_register(hal, SX1262_REG_LORA_SYNC_WORD_MSB, sw_data, 2); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "SetSyncWord failed"); + return ret; + } + + ret = apply_workaround_w4(hal, config->is_inverted_iq); + if (ret != ESP_OK) { + return ret; + } + + ESP_LOGI(TAG, + "LoRa configured — SF%d BW=0x%02X CR=4/%d LDRO=%d power=%ddBm %s", + config->sf, + config->bw, + config->cr + 4, + ldro, + config->tx_power_dbm, + config->is_inverted_iq ? "IQ_INV" : "IQ_STD"); + + return ESP_OK; +} + +sx1262_state_t sx1262_get_state(void) { + return sx1262_fsm_get_state(); +} + +bool sx1262_is_running(void) { + return s_is_running; +} + +esp_err_t sx1262_get_status(uint8_t *out_status) { + if (out_status == NULL) { + return ESP_ERR_INVALID_ARG; + } + + sx1262_hal_t *hal = &s_config.hal; + + uint8_t tx[2] = {SX1262_OP_GET_STATUS, 0x00}; + uint8_t rx[2] = {0}; + + esp_err_t ret = sx1262_cmd_wait_busy(hal, 0); + if (ret != ESP_OK) { + return ret; + } + + hal->lock(hal->ctx); + hal->cs_low(hal->ctx); + hal->spi_transfer(hal->ctx, tx, rx, 2); + hal->cs_high(hal->ctx); + hal->unlock(hal->ctx); + + *out_status = rx[1]; + return ESP_OK; +} + +esp_err_t sx1262_get_device_errors(uint16_t *out_errors) { + if (out_errors == NULL) { + return ESP_ERR_INVALID_ARG; + } + + sx1262_hal_t *hal = &s_config.hal; + uint8_t buf[2] = {0}; + + esp_err_t ret = sx1262_cmd_read(hal, SX1262_OP_GET_DEVICE_ERRORS, buf, 2); + if (ret != ESP_OK) { + return ret; + } + + *out_errors = ((uint16_t)buf[0] << 8) | buf[1]; + return ESP_OK; +} + +esp_err_t sx1262_start(void) { + if (s_is_running) { + ESP_LOGE(TAG, "Already running"); + return ESP_ERR_INVALID_STATE; + } + if (!s_is_initialized) { + ESP_LOGE(TAG, "Not initialized"); + return ESP_ERR_INVALID_STATE; + } + + BaseType_t xret = xTaskCreatePinnedToCore(irq_task, + "sx1262_irq", + SX1262_IRQ_TASK_STACK, + NULL, + SX1262_IRQ_TASK_PRIO, + &s_irq_task_handle, + SX1262_IRQ_TASK_CORE); + + if (xret != pdPASS || s_irq_task_handle == NULL) { + ESP_LOGE(TAG, "Failed to create IRQ task"); + return ESP_ERR_NO_MEM; + } + + s_is_running = true; + ESP_LOGI(TAG, "IRQ task started"); + return ESP_OK; +} + +void sx1262_stop(void) { + if (!s_is_running) { + return; + } + s_stop_caller_handle = xTaskGetCurrentTaskHandle(); + s_is_running = false; + if (s_irq_task_handle != NULL) { + ulTaskNotifyTake(pdTRUE, pdMS_TO_TICKS(500)); + s_irq_task_handle = NULL; + } + s_stop_caller_handle = NULL; + s_config.hal.set_antenna(s_config.hal.ctx, SX1262_ANT_OFF); + ESP_LOGI(TAG, "Stopped"); +} + +esp_err_t sx1262_set_callbacks(const sx1262_callbacks_t *cbs) { + if (cbs == NULL) { + return ESP_ERR_INVALID_ARG; + } + memcpy(&s_callbacks, cbs, sizeof(sx1262_callbacks_t)); + if (s_is_initialized) { + sx1262_irq_init(&s_config.hal, &s_config, &s_callbacks); + } + return ESP_OK; +} + +esp_err_t sx1262_process_irq(void) { + return sx1262_irq_process(); +} + +esp_err_t sx1262_get_packet(sx1262_packet_t *out_packet) { + return sx1262_irq_get_packet(out_packet); +} + +esp_err_t sx1262_get_rssi_inst(int16_t *out_rssi_dbm) { + return sx1262_radio_get_rssi_inst(out_rssi_dbm); +} + +esp_err_t sx1262_get_stats(sx1262_stats_t *out_stats) { + return sx1262_radio_get_stats(out_stats); +} +esp_err_t sx1262_transmit(const uint8_t *data, uint8_t len, uint32_t timeout_ms) { + return sx1262_radio_transmit(data, len, timeout_ms); +} +esp_err_t sx1262_receive_single(uint32_t timeout_ms) { + return sx1262_radio_receive_single(timeout_ms); +} + +esp_err_t sx1262_receive_continuous(void) { + return sx1262_radio_receive_continuous(); +} + +void sx1262_stop_rx(void) { + sx1262_radio_stop_rx(); +} +esp_err_t sx1262_cad_start(void) { + return sx1262_radio_cad_start(); +} +esp_err_t sx1262_sleep(bool is_warm) { + return sx1262_radio_sleep(is_warm); +} + +esp_err_t sx1262_wakeup(void) { + return sx1262_radio_wakeup(); +} + +esp_err_t sx1262_set_rx_duty_cycle(uint32_t rx_ms, uint32_t sleep_ms) { + return sx1262_radio_set_rx_duty_cycle(rx_ms, sleep_ms); +} + +static void irq_task(void *arg) { + (void)arg; + sx1262_hal_t *hal = &s_config.hal; + + ESP_LOGI(TAG, "IRQ task running"); + + while (s_is_running) { + sx1262_irq_process(); + hal->delay_ms(hal->ctx, 10); + } + + ESP_LOGI(TAG, "IRQ task exiting"); + + if (s_stop_caller_handle != NULL) { + xTaskNotifyGive(s_stop_caller_handle); + } + vTaskDelete(NULL); +} + +static esp_err_t validate_hal(const sx1262_hal_t *hal) { + if (hal->spi_transfer == NULL) { + ESP_LOGE(TAG, "HAL: spi_transfer is NULL"); + return ESP_ERR_INVALID_ARG; + } + if (hal->cs_low == NULL) { + ESP_LOGE(TAG, "HAL: cs_low is NULL"); + return ESP_ERR_INVALID_ARG; + } + if (hal->cs_high == NULL) { + ESP_LOGE(TAG, "HAL: cs_high is NULL"); + return ESP_ERR_INVALID_ARG; + } + if (hal->reset_write == NULL) { + ESP_LOGE(TAG, "HAL: reset_write is NULL"); + return ESP_ERR_INVALID_ARG; + } + if (hal->busy_read == NULL) { + ESP_LOGE(TAG, "HAL: busy_read is NULL"); + return ESP_ERR_INVALID_ARG; + } + if (hal->delay_ms == NULL) { + ESP_LOGE(TAG, "HAL: delay_ms is NULL"); + return ESP_ERR_INVALID_ARG; + } + if (hal->get_tick_ms == NULL) { + ESP_LOGE(TAG, "HAL: get_tick_ms is NULL"); + return ESP_ERR_INVALID_ARG; + } + if (hal->lock == NULL) { + ESP_LOGE(TAG, "HAL: lock is NULL"); + return ESP_ERR_INVALID_ARG; + } + if (hal->unlock == NULL) { + ESP_LOGE(TAG, "HAL: unlock is NULL"); + return ESP_ERR_INVALID_ARG; + } + if (hal->enter_critical == NULL) { + ESP_LOGE(TAG, "HAL: enter_critical is NULL"); + return ESP_ERR_INVALID_ARG; + } + if (hal->exit_critical == NULL) { + ESP_LOGE(TAG, "HAL: exit_critical is NULL"); + return ESP_ERR_INVALID_ARG; + } + if (hal->set_antenna == NULL) { + ESP_LOGE(TAG, "HAL: set_antenna is NULL"); + return ESP_ERR_INVALID_ARG; + } + if (hal->ctx == NULL) { + ESP_LOGE(TAG, "HAL: ctx is NULL"); + return ESP_ERR_INVALID_ARG; + } + + return ESP_OK; +} + +static esp_err_t validate_config(const sx1262_config_t *config) { + if (config->frequency_hz < 150000000UL || config->frequency_hz > 960000000UL) { + ESP_LOGE(TAG, "frequency_hz out of range: %lu", (unsigned long)config->frequency_hz); + return ESP_ERR_INVALID_ARG; + } + + if (config->sf < SX1262_LORA_SF5 || config->sf > SX1262_LORA_SF12) { + ESP_LOGE(TAG, "sf out of range: %d", config->sf); + return ESP_ERR_INVALID_ARG; + } + + if (!sx1262_bw_is_valid(config->bw)) { + ESP_LOGE(TAG, "bw invalid: 0x%02X", config->bw); + return ESP_ERR_INVALID_ARG; + } + + if (config->bw == SX1262_LORA_BW_500 && config->sf < SX1262_LORA_SF6) { + ESP_LOGE(TAG, "BW_500 requires SF >= 6, got SF%d", config->sf); + return ESP_ERR_INVALID_ARG; + } + + if (config->cr < SX1262_LORA_CR_4_5 || config->cr > SX1262_LORA_CR_4_8) { + ESP_LOGE(TAG, "cr out of range: %d", config->cr); + return ESP_ERR_INVALID_ARG; + } + + if (config->tx_power_dbm < -9 || config->tx_power_dbm > 22) { + ESP_LOGE(TAG, "tx_power_dbm out of range: %d", config->tx_power_dbm); + return ESP_ERR_INVALID_ARG; + } + + if (config->preamble_len < 2) { + ESP_LOGE(TAG, "preamble_len too short: %d", config->preamble_len); + return ESP_ERR_INVALID_ARG; + } + + if (config->sf == SX1262_LORA_SF6 && !config->is_implicit_hdr) { + ESP_LOGE(TAG, "SF6 requires implicit header mode"); + return ESP_ERR_INVALID_ARG; + } + + return ESP_OK; +} + +static esp_err_t hw_reset(sx1262_hal_t *hal) { + hal->set_antenna(hal->ctx, SX1262_ANT_OFF); + hal->reset_write(hal->ctx, 0); + hal->delay_ms(hal->ctx, SX1262_RESET_HOLD_MS); + hal->reset_write(hal->ctx, 1); + hal->delay_ms(hal->ctx, SX1262_RESET_WAIT_MS); + + esp_err_t ret = sx1262_cmd_wait_busy(hal, SX1262_WAIT_BUSY_TIMEOUT_MS); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "BUSY did not go LOW after reset"); + return ret; + } + + ESP_LOGI(TAG, "Hardware reset complete"); + return ESP_OK; +} + +static esp_err_t apply_workaround_w2(sx1262_hal_t *hal) { + uint8_t val = 0; + esp_err_t ret = sx1262_cmd_read_register(hal, SX1262_REG_TX_CLAMP_CONFIG, &val, 1); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "W2: read 0x%04X failed", SX1262_REG_TX_CLAMP_CONFIG); + return ret; + } + + val |= 0x1E; /* Set bits 4:1 to 1111 */ + + ret = sx1262_cmd_write_register(hal, SX1262_REG_TX_CLAMP_CONFIG, &val, 1); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "W2: write 0x%04X failed", SX1262_REG_TX_CLAMP_CONFIG); + return ret; + } + + ESP_LOGD(TAG, "W2 applied: reg 0x%04X = 0x%02X", SX1262_REG_TX_CLAMP_CONFIG, val); + return ESP_OK; +} + +static esp_err_t apply_workaround_w4(sx1262_hal_t *hal, bool is_inverted_iq) { + uint8_t val = 0; + esp_err_t ret = sx1262_cmd_read_register(hal, SX1262_REG_IQ_POLARITY, &val, 1); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "W4: read 0x%04X failed", SX1262_REG_IQ_POLARITY); + return ret; + } + + if (is_inverted_iq) { + val &= ~(1U << 2); + } else { + val |= (1U << 2); + } + + ret = sx1262_cmd_write_register(hal, SX1262_REG_IQ_POLARITY, &val, 1); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "W4: write 0x%04X failed", SX1262_REG_IQ_POLARITY); + return ret; + } + + ESP_LOGD(TAG, + "W4 applied: reg 0x%04X = 0x%02X (inverted=%d)", + SX1262_REG_IQ_POLARITY, + val, + is_inverted_iq); + return ESP_OK; +} + +static esp_err_t calibrate_image(sx1262_hal_t *hal, uint32_t freq_hz) { + uint8_t params[2]; + + if (freq_hz >= 902000000UL) { + params[0] = 0xE1; + params[1] = 0xE9; + } else if (freq_hz >= 863000000UL) { + params[0] = 0xD7; + params[1] = 0xDB; + } else if (freq_hz >= 779000000UL) { + params[0] = 0xC1; + params[1] = 0xC5; + } else if (freq_hz >= 470000000UL) { + params[0] = 0x75; + params[1] = 0x81; + } else { + params[0] = 0x6B; + params[1] = 0x6F; + } + + esp_err_t ret = sx1262_cmd_write(hal, SX1262_OP_CALIBRATE_IMAGE, params, 2); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "CalibrateImage failed"); + return ret; + } + + ret = sx1262_cmd_wait_busy(hal, SX1262_WAIT_BUSY_TIMEOUT_MS); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "BUSY timeout after CalibrateImage"); + return ret; + } + + return ESP_OK; +} + +static uint8_t compute_ldro(uint8_t sf, uint8_t bw) { + if (sf >= SX1262_LORA_SF11 && sx1262_bw_to_hz(bw) <= 125000) { + return 0x01; + } + return 0x00; +} diff --git a/firmware_p4/components/Drivers/sx1262/sx1262_cmd.c b/firmware_p4/components/Drivers/sx1262/sx1262_cmd.c new file mode 100644 index 00000000..cb7b5832 --- /dev/null +++ b/firmware_p4/components/Drivers/sx1262/sx1262_cmd.c @@ -0,0 +1,216 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#include "sx1262_cmd.h" + +#include + +#include "esp_log.h" + +#include "sx1262_regs.h" + +#define MAX_CMD_BUF_LEN 264 + +static const char *TAG = "SX1262_CMD"; + +static esp_err_t transfer_locked(sx1262_hal_t *hal, const uint8_t *tx, uint8_t *rx, size_t len); + +esp_err_t sx1262_cmd_wait_busy(sx1262_hal_t *hal, uint32_t timeout_ms) { + if (timeout_ms == 0) { + timeout_ms = SX1262_WAIT_BUSY_TIMEOUT_MS; + } + + uint32_t start = hal->get_tick_ms(hal->ctx); + + while (hal->busy_read(hal->ctx)) { + uint32_t elapsed = hal->get_tick_ms(hal->ctx) - start; + if (elapsed >= timeout_ms) { + ESP_LOGE(TAG, "BUSY timeout after %lu ms", (unsigned long)elapsed); + return ESP_ERR_TIMEOUT; + } + hal->delay_ms(hal->ctx, 1); + } + + return ESP_OK; +} + +esp_err_t sx1262_cmd_write(sx1262_hal_t *hal, uint8_t opcode, const uint8_t *params, size_t len) { + if (len > 0 && params == NULL) { + return ESP_ERR_INVALID_ARG; + } + + size_t total = 1 + len; + uint8_t tx_buf[MAX_CMD_BUF_LEN]; + + tx_buf[0] = opcode; + if (len > 0) { + memcpy(&tx_buf[1], params, len); + } + + esp_err_t ret = sx1262_cmd_wait_busy(hal, 0); + if (ret != ESP_OK) { + return ret; + } + + return transfer_locked(hal, tx_buf, NULL, total); +} + +esp_err_t sx1262_cmd_read(sx1262_hal_t *hal, uint8_t opcode, uint8_t *out_result, size_t len) { + if (len > 0 && out_result == NULL) { + return ESP_ERR_INVALID_ARG; + } + + size_t total = 1 + 1 + len; + uint8_t tx_buf[MAX_CMD_BUF_LEN]; + uint8_t rx_buf[MAX_CMD_BUF_LEN]; + + memset(tx_buf, 0x00, total); + memset(rx_buf, 0x00, total); + tx_buf[0] = opcode; + + esp_err_t ret = sx1262_cmd_wait_busy(hal, 0); + if (ret != ESP_OK) { + return ret; + } + + ret = transfer_locked(hal, tx_buf, rx_buf, total); + if (ret != ESP_OK) { + return ret; + } + + if (len > 0) { + memcpy(out_result, &rx_buf[2], len); + } + + return ESP_OK; +} + +esp_err_t +sx1262_cmd_write_register(sx1262_hal_t *hal, uint16_t addr, const uint8_t *data, size_t len) { + if (len == 0 || data == NULL) { + return ESP_ERR_INVALID_ARG; + } + + size_t total = 3 + len; + uint8_t tx_buf[MAX_CMD_BUF_LEN]; + + tx_buf[0] = SX1262_OP_WRITE_REGISTER; + tx_buf[1] = (uint8_t)(addr >> 8); + tx_buf[2] = (uint8_t)(addr & 0xFF); + memcpy(&tx_buf[3], data, len); + + esp_err_t ret = sx1262_cmd_wait_busy(hal, 0); + if (ret != ESP_OK) { + return ret; + } + + return transfer_locked(hal, tx_buf, NULL, total); +} + +esp_err_t +sx1262_cmd_read_register(sx1262_hal_t *hal, uint16_t addr, uint8_t *out_data, size_t len) { + if (len == 0 || out_data == NULL) { + return ESP_ERR_INVALID_ARG; + } + + size_t total = 4 + len; + uint8_t tx_buf[MAX_CMD_BUF_LEN]; + uint8_t rx_buf[MAX_CMD_BUF_LEN]; + + memset(tx_buf, 0x00, total); + memset(rx_buf, 0x00, total); + tx_buf[0] = SX1262_OP_READ_REGISTER; + tx_buf[1] = (uint8_t)(addr >> 8); + tx_buf[2] = (uint8_t)(addr & 0xFF); + + esp_err_t ret = sx1262_cmd_wait_busy(hal, 0); + if (ret != ESP_OK) { + return ret; + } + + ret = transfer_locked(hal, tx_buf, rx_buf, total); + if (ret != ESP_OK) { + return ret; + } + + memcpy(out_data, &rx_buf[4], len); + return ESP_OK; +} + +esp_err_t +sx1262_cmd_write_buffer(sx1262_hal_t *hal, uint8_t offset, const uint8_t *data, size_t len) { + if (len == 0 || data == NULL) { + return ESP_ERR_INVALID_ARG; + } + + size_t total = 2 + len; + uint8_t tx_buf[MAX_CMD_BUF_LEN]; + + tx_buf[0] = SX1262_OP_WRITE_BUFFER; + tx_buf[1] = offset; + memcpy(&tx_buf[2], data, len); + + esp_err_t ret = sx1262_cmd_wait_busy(hal, 0); + if (ret != ESP_OK) { + return ret; + } + + return transfer_locked(hal, tx_buf, NULL, total); +} + +esp_err_t sx1262_cmd_read_buffer(sx1262_hal_t *hal, uint8_t offset, uint8_t *out_data, size_t len) { + if (len == 0 || out_data == NULL) { + return ESP_ERR_INVALID_ARG; + } + + size_t total = 3 + len; + uint8_t tx_buf[MAX_CMD_BUF_LEN]; + uint8_t rx_buf[MAX_CMD_BUF_LEN]; + + memset(tx_buf, 0x00, total); + memset(rx_buf, 0x00, total); + tx_buf[0] = SX1262_OP_READ_BUFFER; + tx_buf[1] = offset; + + esp_err_t ret = sx1262_cmd_wait_busy(hal, 0); + if (ret != ESP_OK) { + return ret; + } + + ret = transfer_locked(hal, tx_buf, rx_buf, total); + if (ret != ESP_OK) { + return ret; + } + + memcpy(out_data, &rx_buf[3], len); + return ESP_OK; +} + +static esp_err_t transfer_locked(sx1262_hal_t *hal, const uint8_t *tx, uint8_t *rx, size_t len) { + hal->lock(hal->ctx); + hal->cs_low(hal->ctx); + + int spi_ret = hal->spi_transfer(hal->ctx, tx, rx, len); + + hal->cs_high(hal->ctx); + hal->unlock(hal->ctx); + + if (spi_ret < 0) { + ESP_LOGE(TAG, "SPI transfer failed: %d", spi_ret); + return ESP_FAIL; + } + + return ESP_OK; +} diff --git a/firmware_p4/components/Drivers/sx1262/sx1262_fsm.c b/firmware_p4/components/Drivers/sx1262/sx1262_fsm.c new file mode 100644 index 00000000..0b29345c --- /dev/null +++ b/firmware_p4/components/Drivers/sx1262/sx1262_fsm.c @@ -0,0 +1,76 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#include "sx1262_fsm.h" + +#include "esp_log.h" + +#define FSM_NUM_STATES 7 + +static const char *TAG = "SX1262_FSM"; + +static sx1262_state_t s_state = SX1262_STATE_UNKNOWN; + +/* UNKN SLEEP RC XOSC FS TX RX */ +static const bool s_transition[FSM_NUM_STATES][FSM_NUM_STATES] = { + /* FROM UNKNOWN */ {false, false, true, false, false, false, false}, + /* FROM SLEEP */ {false, false, true, false, false, false, false}, + /* FROM STDBY_RC */ {false, true, false, true, true, true, true}, + /* FROM STDBY_XOSC */ {false, true, true, false, true, true, true}, + /* FROM FS */ {false, true, true, true, false, true, true}, + /* FROM TX */ {false, false, true, false, false, false, false}, + /* FROM RX */ {false, false, true, false, false, false, false}, +}; + +static const char *s_state_names[FSM_NUM_STATES] = { + "UNKNOWN", "SLEEP", "STDBY_RC", "STDBY_XOSC", "FS", "TX", "RX"}; + +void sx1262_fsm_init(sx1262_state_t initial_state) { + s_state = initial_state; + ESP_LOGI(TAG, "FSM initialized → %s", s_state_names[s_state]); +} + +sx1262_state_t sx1262_fsm_get_state(void) { + return s_state; +} + +bool sx1262_fsm_can_transition(sx1262_state_t target) { + if (s_state >= FSM_NUM_STATES || target >= FSM_NUM_STATES) { + return false; + } + return s_transition[s_state][target]; +} + +esp_err_t sx1262_fsm_transition(sx1262_state_t target) { + if (s_state >= FSM_NUM_STATES || target >= FSM_NUM_STATES) { + ESP_LOGE(TAG, "Invalid state index: current=%d, target=%d", s_state, target); + return ESP_ERR_INVALID_STATE; + } + + if (!s_transition[s_state][target]) { + ESP_LOGE(TAG, "Transition NOT allowed: %s → %s", s_state_names[s_state], s_state_names[target]); + return ESP_ERR_INVALID_STATE; + } + + ESP_LOGD(TAG, "%s → %s", s_state_names[s_state], s_state_names[target]); + s_state = target; + return ESP_OK; +} + +void sx1262_fsm_on_irq_complete(void) { + sx1262_state_t prev = s_state; + s_state = SX1262_STATE_STDBY_RC; + ESP_LOGD(TAG, "IRQ complete: %s → STDBY_RC", s_state_names[prev]); +} diff --git a/firmware_p4/components/Drivers/sx1262/sx1262_hal.c b/firmware_p4/components/Drivers/sx1262/sx1262_hal.c new file mode 100644 index 00000000..afd73ef9 --- /dev/null +++ b/firmware_p4/components/Drivers/sx1262/sx1262_hal.c @@ -0,0 +1,256 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#include "sx1262_hal.h" + +#include + +#include "esp_log.h" +#include "driver/spi_master.h" +#include "driver/gpio.h" +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" +#include "freertos/semphr.h" + +#include "pin_def.h" +#include "sx1262_regs.h" + +#define PIN_SCK GPIO_LORA_SCLK_PIN +#define PIN_MOSI GPIO_LORA_MOSI_PIN +#define PIN_MISO GPIO_LORA_MISO_PIN +#define PIN_NSS GPIO_LORA_CS_PIN +#define PIN_NRST GPIO_LORA_RESET_PIN +#define PIN_BUSY GPIO_LORA_BUSY_PIN +#define PIN_DIO1 GPIO_LORA_DIO1_PIN +#define PIN_TXEN GPIO_LORA_TXEN_PIN +#define PIN_RXEN GPIO_LORA_RXEN_PIN + +#define SPI_HOST_ID SPI3_HOST +#define SPI_FREQ_HZ 8000000 +#define SPI_MAX_TRANSFER 264 + +static const char *TAG = "SX1262_HAL_ESP32"; + +typedef struct { + spi_device_handle_t spi; + SemaphoreHandle_t spi_mutex; + portMUX_TYPE critical_mux; + bool is_initialized; +} hal_esp32_ctx_t; + +static hal_esp32_ctx_t s_ctx = { + .spi = NULL, + .spi_mutex = NULL, + .critical_mux = portMUX_INITIALIZER_UNLOCKED, + .is_initialized = false, +}; + +static int hal_spi_transfer(void *ctx, const uint8_t *tx, uint8_t *rx, size_t len) { + hal_esp32_ctx_t *c = (hal_esp32_ctx_t *)ctx; + + spi_transaction_t t = { + .length = len * 8, + .tx_buffer = tx, + .rx_buffer = rx, + }; + + esp_err_t ret = spi_device_transmit(c->spi, &t); + return (ret == ESP_OK) ? 0 : -1; +} + +static void hal_cs_low(void *ctx) { + (void)ctx; + gpio_set_level(PIN_NSS, 0); +} + +static void hal_cs_high(void *ctx) { + (void)ctx; + gpio_set_level(PIN_NSS, 1); +} + +static void hal_reset_write(void *ctx, uint8_t level) { + (void)ctx; + gpio_set_level(PIN_NRST, level ? 1 : 0); +} + +static uint8_t hal_busy_read(void *ctx) { + (void)ctx; + return (uint8_t)gpio_get_level(PIN_BUSY); +} + +static void hal_delay_ms(void *ctx, uint32_t ms) { + (void)ctx; + vTaskDelay(pdMS_TO_TICKS(ms)); +} + +static uint32_t hal_get_tick_ms(void *ctx) { + (void)ctx; + return (uint32_t)(xTaskGetTickCount() * portTICK_PERIOD_MS); +} + +static void hal_lock(void *ctx) { + hal_esp32_ctx_t *c = (hal_esp32_ctx_t *)ctx; + xSemaphoreTake(c->spi_mutex, portMAX_DELAY); +} + +static void hal_unlock(void *ctx) { + hal_esp32_ctx_t *c = (hal_esp32_ctx_t *)ctx; + xSemaphoreGive(c->spi_mutex); +} + +static void hal_enter_critical(void *ctx) { + hal_esp32_ctx_t *c = (hal_esp32_ctx_t *)ctx; + portENTER_CRITICAL(&c->critical_mux); +} + +static void hal_exit_critical(void *ctx) { + hal_esp32_ctx_t *c = (hal_esp32_ctx_t *)ctx; + portEXIT_CRITICAL(&c->critical_mux); +} + +static void hal_set_antenna(void *ctx, uint8_t mode) { + (void)ctx; + if (PIN_TXEN < 0 || PIN_RXEN < 0) { + return; + } + switch (mode) { + case SX1262_ANT_TX: + gpio_set_level(PIN_TXEN, 1); + gpio_set_level(PIN_RXEN, 0); + break; + case SX1262_ANT_RX: + gpio_set_level(PIN_TXEN, 0); + gpio_set_level(PIN_RXEN, 1); + break; + default: /* SX1262_ANT_OFF */ + gpio_set_level(PIN_TXEN, 0); + gpio_set_level(PIN_RXEN, 0); + break; + } +} + +esp_err_t sx1262_hal_create(sx1262_hal_t *out_hal) { + if (out_hal == NULL) { + return ESP_ERR_INVALID_ARG; + } + + if (s_ctx.is_initialized) { + ESP_LOGW(TAG, "HAL already initialized"); + goto fill_hal; + } + + uint64_t out_mask = (1ULL << PIN_NSS) | (1ULL << PIN_NRST); + if (PIN_TXEN >= 0) { + out_mask |= (1ULL << PIN_TXEN); + } + if (PIN_RXEN >= 0) { + out_mask |= (1ULL << PIN_RXEN); + } + gpio_config_t out_conf = { + .pin_bit_mask = out_mask, + .mode = GPIO_MODE_OUTPUT, + .pull_up_en = GPIO_PULLUP_DISABLE, + .pull_down_en = GPIO_PULLDOWN_DISABLE, + .intr_type = GPIO_INTR_DISABLE, + }; + esp_err_t ret = gpio_config(&out_conf); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "GPIO output config failed: %s", esp_err_to_name(ret)); + return ret; + } + + gpio_set_level(PIN_NSS, 1); + if (PIN_TXEN >= 0) { + gpio_set_level(PIN_TXEN, 0); + } + if (PIN_RXEN >= 0) { + gpio_set_level(PIN_RXEN, 0); + } + + gpio_config_t in_conf = { + .pin_bit_mask = (1ULL << PIN_BUSY) | (1ULL << PIN_DIO1), + .mode = GPIO_MODE_INPUT, + .pull_up_en = GPIO_PULLUP_DISABLE, + .pull_down_en = GPIO_PULLDOWN_DISABLE, + .intr_type = GPIO_INTR_DISABLE, + }; + ret = gpio_config(&in_conf); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "GPIO input config failed: %s", esp_err_to_name(ret)); + return ret; + } + + spi_bus_config_t bus_cfg = { + .mosi_io_num = PIN_MOSI, + .miso_io_num = PIN_MISO, + .sclk_io_num = PIN_SCK, + .quadwp_io_num = -1, + .quadhd_io_num = -1, + .max_transfer_sz = SPI_MAX_TRANSFER, + }; + + ret = spi_bus_initialize(SPI_HOST_ID, &bus_cfg, SPI_DMA_CH_AUTO); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "SPI bus init failed: %s", esp_err_to_name(ret)); + return ret; + } + + spi_device_interface_config_t dev_cfg = { + .clock_speed_hz = SPI_FREQ_HZ, + .mode = 0, + .spics_io_num = -1, + .queue_size = 1, + }; + + ret = spi_bus_add_device(SPI_HOST_ID, &dev_cfg, &s_ctx.spi); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "SPI add device failed: %s", esp_err_to_name(ret)); + spi_bus_free(SPI_HOST_ID); + return ret; + } + + /* ── Mutex ──────────────────────────────────────────────────── */ + s_ctx.spi_mutex = xSemaphoreCreateMutex(); + if (s_ctx.spi_mutex == NULL) { + ESP_LOGE(TAG, "Failed to create SPI mutex"); + spi_bus_remove_device(s_ctx.spi); + spi_bus_free(SPI_HOST_ID); + return ESP_ERR_NO_MEM; + } + + s_ctx.is_initialized = true; + ESP_LOGI(TAG, + "Hardware initialized — SPI@%dMHz, NSS=GPIO%d, BUSY=GPIO%d", + SPI_FREQ_HZ / 1000000, + PIN_NSS, + PIN_BUSY); + +fill_hal: + out_hal->spi_transfer = hal_spi_transfer; + out_hal->cs_low = hal_cs_low; + out_hal->cs_high = hal_cs_high; + out_hal->reset_write = hal_reset_write; + out_hal->busy_read = hal_busy_read; + out_hal->delay_ms = hal_delay_ms; + out_hal->get_tick_ms = hal_get_tick_ms; + out_hal->lock = hal_lock; + out_hal->unlock = hal_unlock; + out_hal->enter_critical = hal_enter_critical; + out_hal->exit_critical = hal_exit_critical; + out_hal->set_antenna = hal_set_antenna; + out_hal->ctx = &s_ctx; + + return ESP_OK; +} diff --git a/firmware_p4/components/Drivers/sx1262/sx1262_irq.c b/firmware_p4/components/Drivers/sx1262/sx1262_irq.c new file mode 100644 index 00000000..e463311c --- /dev/null +++ b/firmware_p4/components/Drivers/sx1262/sx1262_irq.c @@ -0,0 +1,245 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#include "sx1262_irq.h" + +#include + +#include "esp_log.h" + +#include "sx1262_regs.h" +#include "sx1262_cmd.h" +#include "sx1262_fsm.h" + +static const char *TAG = "SX1262_IRQ"; + +static sx1262_hal_t *s_hal = NULL; +static const sx1262_config_t *s_config = NULL; +static sx1262_callbacks_t s_cbs = {0}; + +static sx1262_packet_t s_rx_ring[SX1262_RX_RING_SIZE]; +static volatile uint8_t s_rx_head = 0; +static volatile uint8_t s_rx_tail = 0; + +static esp_err_t read_rx_packet(sx1262_packet_t *out_pkt, uint16_t irq_flags); +static void apply_workaround_w3(void); + +void sx1262_irq_init(sx1262_hal_t *hal, + const sx1262_config_t *config, + const sx1262_callbacks_t *cbs) { + s_hal = hal; + s_config = config; + s_rx_head = 0; + s_rx_tail = 0; + + if (cbs != NULL) { + memcpy(&s_cbs, cbs, sizeof(sx1262_callbacks_t)); + } else { + memset(&s_cbs, 0, sizeof(sx1262_callbacks_t)); + } + + ESP_LOGI(TAG, "IRQ subsystem initialized, ring buffer reset"); +} + +esp_err_t sx1262_irq_process(void) { + if (s_hal == NULL) { + return ESP_ERR_INVALID_STATE; + } + + uint8_t irq_buf[2] = {0}; + esp_err_t ret = sx1262_cmd_read(s_hal, SX1262_OP_GET_IRQ_STATUS, irq_buf, 2); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "GetIrqStatus failed"); + return ret; + } + uint16_t irq_flags = ((uint16_t)irq_buf[0] << 8) | irq_buf[1]; + + if (irq_flags == 0) { + return ESP_OK; + } + + uint8_t clr_params[2] = {(uint8_t)(irq_flags >> 8), (uint8_t)(irq_flags)}; + ret = sx1262_cmd_write(s_hal, SX1262_OP_CLEAR_IRQ_STATUS, clr_params, 2); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "ClearIrqStatus failed"); + return ret; + } + + if (irq_flags & SX1262_IRQ_TX_DONE) { + ESP_LOGD(TAG, "IRQ: TxDone"); + s_hal->set_antenna(s_hal->ctx, SX1262_ANT_OFF); + sx1262_fsm_on_irq_complete(); + + if (s_cbs.on_tx_done != NULL) { + s_cbs.on_tx_done(s_cbs.cb_ctx); + } + } + + if (irq_flags & SX1262_IRQ_RX_DONE) { + ESP_LOGD(TAG, "IRQ: RxDone"); + s_hal->set_antenna(s_hal->ctx, SX1262_ANT_OFF); + + if (s_config != NULL && s_config->is_implicit_hdr) { + apply_workaround_w3(); + } + + sx1262_packet_t pkt = {0}; + ret = read_rx_packet(&pkt, irq_flags); + if (ret == ESP_OK) { + s_hal->enter_critical(s_hal->ctx); + uint8_t next_head = (s_rx_head + 1) % SX1262_RX_RING_SIZE; + if (next_head == s_rx_tail) { + s_hal->exit_critical(s_hal->ctx); + ESP_LOGW(TAG, "Ring buffer full — packet discarded"); + } else { + memcpy(&s_rx_ring[s_rx_head], &pkt, sizeof(sx1262_packet_t)); + s_rx_head = next_head; + s_hal->exit_critical(s_hal->ctx); + } + + if (s_cbs.on_rx_done != NULL) { + s_cbs.on_rx_done(&pkt, s_cbs.cb_ctx); + } + } + + sx1262_fsm_on_irq_complete(); + } + + if (irq_flags & SX1262_IRQ_TIMEOUT) { + ESP_LOGD(TAG, "IRQ: Timeout"); + s_hal->set_antenna(s_hal->ctx, SX1262_ANT_OFF); + sx1262_fsm_on_irq_complete(); + + if (s_cbs.on_timeout != NULL) { + s_cbs.on_timeout(s_cbs.cb_ctx); + } + } + + if ((irq_flags & SX1262_IRQ_CRC_ERR) && !(irq_flags & SX1262_IRQ_RX_DONE)) { + ESP_LOGW(TAG, "IRQ: CRC error (standalone)"); + if (s_cbs.on_error != NULL) { + s_cbs.on_error(ESP_ERR_INVALID_CRC, s_cbs.cb_ctx); + } + } + if ((irq_flags & SX1262_IRQ_HEADER_ERR) && !(irq_flags & SX1262_IRQ_RX_DONE)) { + ESP_LOGW(TAG, "IRQ: Header error (standalone)"); + if (s_cbs.on_error != NULL) { + s_cbs.on_error(ESP_FAIL, s_cbs.cb_ctx); + } + } + + if (irq_flags & SX1262_IRQ_CAD_DONE) { + bool is_detected = (irq_flags & SX1262_IRQ_CAD_DETECTED) != 0; + ESP_LOGD(TAG, "IRQ: CAD done, detected=%d", is_detected); + sx1262_fsm_on_irq_complete(); + + if (s_cbs.on_cad_done != NULL) { + s_cbs.on_cad_done(is_detected, s_cbs.cb_ctx); + } + } + + return ESP_OK; +} + +esp_err_t sx1262_irq_get_packet(sx1262_packet_t *out_packet) { + if (out_packet == NULL) { + return ESP_ERR_INVALID_ARG; + } + + if (s_hal == NULL) { + return ESP_ERR_INVALID_STATE; + } + + s_hal->enter_critical(s_hal->ctx); + + if (s_rx_head == s_rx_tail) { + s_hal->exit_critical(s_hal->ctx); + return ESP_ERR_NOT_FOUND; + } + + memcpy(out_packet, &s_rx_ring[s_rx_tail], sizeof(sx1262_packet_t)); + s_rx_tail = (s_rx_tail + 1) % SX1262_RX_RING_SIZE; + + s_hal->exit_critical(s_hal->ctx); + return ESP_OK; +} + +bool sx1262_irq_has_packet(void) { + if (s_hal == NULL) { + return false; + } + s_hal->enter_critical(s_hal->ctx); + bool has = (s_rx_head != s_rx_tail); + s_hal->exit_critical(s_hal->ctx); + return has; +} + +static esp_err_t read_rx_packet(sx1262_packet_t *out_pkt, uint16_t irq_flags) { + uint8_t rx_buf_status[2] = {0}; + esp_err_t ret = sx1262_cmd_read(s_hal, SX1262_OP_GET_RX_BUFFER_STATUS, rx_buf_status, 2); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "GetRxBufferStatus failed"); + return ret; + } + + uint8_t payload_len = rx_buf_status[0]; + uint8_t buf_offset = rx_buf_status[1]; + + uint8_t pkt_status[3] = {0}; + ret = sx1262_cmd_read(s_hal, SX1262_OP_GET_PACKET_STATUS, pkt_status, 3); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "GetPacketStatus failed"); + return ret; + } + + if (payload_len > 0) { + ret = sx1262_cmd_read_buffer(s_hal, buf_offset, out_pkt->buf, payload_len); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "ReadBuffer failed"); + return ret; + } + } + + out_pkt->len = payload_len; + out_pkt->rssi_pkt_dbm = -(int16_t)(pkt_status[0] / 2); + out_pkt->snr_pkt_db = (int8_t)pkt_status[1] / 4; + out_pkt->signal_rssi_dbm = -(int16_t)(pkt_status[2] / 2); + out_pkt->has_crc_error = (irq_flags & SX1262_IRQ_CRC_ERR) != 0; + out_pkt->has_header_error = (irq_flags & SX1262_IRQ_HEADER_ERR) != 0; + + return ESP_OK; +} + +static void apply_workaround_w3(void) { + uint8_t val = 0; + esp_err_t ret = sx1262_cmd_read_register(s_hal, SX1262_REG_RTC_CTRL, &val, 1); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "W3: read 0x%04X failed", SX1262_REG_RTC_CTRL); + return; + } + val &= ~(1U << 0); + sx1262_cmd_write_register(s_hal, SX1262_REG_RTC_CTRL, &val, 1); + + uint8_t clr = 0x00; + ret = sx1262_cmd_read_register(s_hal, SX1262_REG_EVT_CLR, &clr, 1); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "W3: read 0x%04X failed", SX1262_REG_EVT_CLR); + return; + } + clr |= (1U << 1); + sx1262_cmd_write_register(s_hal, SX1262_REG_EVT_CLR, &clr, 1); + + ESP_LOGD(TAG, "W3 applied: RTC stopped + event cleared"); +} diff --git a/firmware_p4/components/Drivers/sx1262/sx1262_radio.c b/firmware_p4/components/Drivers/sx1262/sx1262_radio.c new file mode 100644 index 00000000..40bcb9e4 --- /dev/null +++ b/firmware_p4/components/Drivers/sx1262/sx1262_radio.c @@ -0,0 +1,560 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#include "sx1262_radio.h" + +#include + +#include "esp_log.h" + +#include "sx1262_regs.h" +#include "sx1262_cmd.h" +#include "sx1262_fsm.h" + +static const char *TAG = "SX1262_RADIO"; + +static sx1262_hal_t *s_hal = NULL; +static sx1262_config_t *s_config = NULL; +static bool s_needs_reinit = false; + +static esp_err_t apply_workaround_w1(void); +static esp_err_t update_packet_len(uint8_t len); + +void sx1262_radio_init(sx1262_hal_t *hal, sx1262_config_t *config) { + s_hal = hal; + s_config = config; + s_needs_reinit = false; +} + +esp_err_t sx1262_radio_transmit(const uint8_t *data, uint8_t len, uint32_t timeout_ms) { + if (data == NULL) { + ESP_LOGE(TAG, "transmit: data is NULL"); + return ESP_ERR_INVALID_ARG; + } + if (len == 0) { + ESP_LOGE(TAG, "transmit: len is 0"); + return ESP_ERR_INVALID_ARG; + } + if (s_hal == NULL || s_config == NULL) { + ESP_LOGE(TAG, "transmit: not initialized"); + return ESP_ERR_INVALID_STATE; + } + if (s_needs_reinit) { + ESP_LOGE(TAG, "transmit: re-init required after cold sleep"); + return ESP_ERR_INVALID_STATE; + } + + sx1262_state_t current = sx1262_fsm_get_state(); + if (current != SX1262_STATE_STDBY_RC && current != SX1262_STATE_STDBY_XOSC) { + esp_err_t ret = sx1262_fsm_transition(SX1262_STATE_STDBY_RC); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "transmit: cannot transition to STDBY_RC from state %d", current); + return ret; + } + uint8_t stdby = SX1262_STDBY_RC; + sx1262_cmd_write(s_hal, SX1262_OP_SET_STANDBY, &stdby, 1); + } + + esp_err_t ret = apply_workaround_w1(); + if (ret != ESP_OK) { + return ret; + } + + ret = update_packet_len(len); + if (ret != ESP_OK) { + return ret; + } + + ret = sx1262_cmd_write_buffer(s_hal, 0x00, data, len); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "WriteBuffer failed"); + return ret; + } + + uint8_t clr[2] = {(uint8_t)(SX1262_IRQ_ALL >> 8), (uint8_t)(SX1262_IRQ_ALL)}; + ret = sx1262_cmd_write(s_hal, SX1262_OP_CLEAR_IRQ_STATUS, clr, 2); + if (ret != ESP_OK) { + return ret; + } + + s_hal->set_antenna(s_hal->ctx, SX1262_ANT_TX); + + ret = sx1262_fsm_transition(SX1262_STATE_TX); + if (ret != ESP_OK) { + s_hal->set_antenna(s_hal->ctx, SX1262_ANT_OFF); + return ret; + } + + uint32_t tout = (timeout_ms == 0) ? 0x000000 : timeout_ms * 64; + uint8_t tx_params[3] = { + (uint8_t)(tout >> 16), + (uint8_t)(tout >> 8), + (uint8_t)(tout), + }; + ret = sx1262_cmd_write(s_hal, SX1262_OP_SET_TX, tx_params, 3); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "SetTx failed"); + s_hal->set_antenna(s_hal->ctx, SX1262_ANT_OFF); + sx1262_fsm_on_irq_complete(); + return ret; + } + + ESP_LOGI(TAG, "TX started: %d bytes, timeout=%lu ms", len, (unsigned long)timeout_ms); + return ESP_OK; +} + +esp_err_t sx1262_radio_receive_single(uint32_t timeout_ms) { + if (s_hal == NULL || s_config == NULL) { + return ESP_ERR_INVALID_STATE; + } + if (s_needs_reinit) { + ESP_LOGE(TAG, "receive_single: re-init required after cold sleep"); + return ESP_ERR_INVALID_STATE; + } + + sx1262_state_t current = sx1262_fsm_get_state(); + if (current != SX1262_STATE_STDBY_RC && current != SX1262_STATE_STDBY_XOSC) { + esp_err_t ret = sx1262_fsm_transition(SX1262_STATE_STDBY_RC); + if (ret != ESP_OK) { + return ret; + } + uint8_t stdby = SX1262_STDBY_RC; + sx1262_cmd_write(s_hal, SX1262_OP_SET_STANDBY, &stdby, 1); + } + + uint8_t clr[2] = {(uint8_t)(SX1262_IRQ_ALL >> 8), (uint8_t)(SX1262_IRQ_ALL)}; + esp_err_t ret = sx1262_cmd_write(s_hal, SX1262_OP_CLEAR_IRQ_STATUS, clr, 2); + if (ret != ESP_OK) { + return ret; + } + + s_hal->set_antenna(s_hal->ctx, SX1262_ANT_RX); + + /* FSM → RX */ + ret = sx1262_fsm_transition(SX1262_STATE_RX); + if (ret != ESP_OK) { + s_hal->set_antenna(s_hal->ctx, SX1262_ANT_OFF); + return ret; + } + + uint32_t tout = (timeout_ms == 0) ? 0x000000 : timeout_ms * 64; + uint8_t rx_params[3] = { + (uint8_t)(tout >> 16), + (uint8_t)(tout >> 8), + (uint8_t)(tout), + }; + ret = sx1262_cmd_write(s_hal, SX1262_OP_SET_RX, rx_params, 3); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "SetRx failed"); + s_hal->set_antenna(s_hal->ctx, SX1262_ANT_OFF); + sx1262_fsm_on_irq_complete(); + return ret; + } + + ESP_LOGI(TAG, "RX single started, timeout=%lu ms", (unsigned long)timeout_ms); + return ESP_OK; +} + +esp_err_t sx1262_radio_receive_continuous(void) { + if (s_hal == NULL || s_config == NULL) { + return ESP_ERR_INVALID_STATE; + } + if (s_needs_reinit) { + ESP_LOGE(TAG, "receive_continuous: re-init required after cold sleep"); + return ESP_ERR_INVALID_STATE; + } + + sx1262_state_t current = sx1262_fsm_get_state(); + if (current != SX1262_STATE_STDBY_RC && current != SX1262_STATE_STDBY_XOSC) { + esp_err_t ret = sx1262_fsm_transition(SX1262_STATE_STDBY_RC); + if (ret != ESP_OK) { + return ret; + } + uint8_t stdby = SX1262_STDBY_RC; + sx1262_cmd_write(s_hal, SX1262_OP_SET_STANDBY, &stdby, 1); + } + + uint8_t clr[2] = {(uint8_t)(SX1262_IRQ_ALL >> 8), (uint8_t)(SX1262_IRQ_ALL)}; + esp_err_t ret = sx1262_cmd_write(s_hal, SX1262_OP_CLEAR_IRQ_STATUS, clr, 2); + if (ret != ESP_OK) { + return ret; + } + + s_hal->set_antenna(s_hal->ctx, SX1262_ANT_RX); + + ret = sx1262_fsm_transition(SX1262_STATE_RX); + if (ret != ESP_OK) { + s_hal->set_antenna(s_hal->ctx, SX1262_ANT_OFF); + return ret; + } + + uint8_t rx_params[3] = {0xFF, 0xFF, 0xFF}; + ret = sx1262_cmd_write(s_hal, SX1262_OP_SET_RX, rx_params, 3); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "SetRx continuous failed"); + s_hal->set_antenna(s_hal->ctx, SX1262_ANT_OFF); + sx1262_fsm_on_irq_complete(); + return ret; + } + + ESP_LOGI(TAG, "RX continuous started"); + return ESP_OK; +} + +void sx1262_radio_stop_rx(void) { + if (s_hal == NULL) { + return; + } + + uint8_t stdby = SX1262_STDBY_RC; + sx1262_cmd_write(s_hal, SX1262_OP_SET_STANDBY, &stdby, 1); + s_hal->set_antenna(s_hal->ctx, SX1262_ANT_OFF); + + if (sx1262_fsm_transition(SX1262_STATE_STDBY_RC) != ESP_OK) { + sx1262_fsm_on_irq_complete(); + } + + ESP_LOGI(TAG, "RX stopped → STDBY_RC"); +} + +esp_err_t sx1262_radio_cad_start(void) { + if (s_hal == NULL || s_config == NULL) { + return ESP_ERR_INVALID_STATE; + } + + sx1262_state_t current = sx1262_fsm_get_state(); + if (current == SX1262_STATE_TX || current == SX1262_STATE_UNKNOWN) { + ESP_LOGE(TAG, "cad_start: invalid state %d", current); + return ESP_ERR_INVALID_STATE; + } + if (current != SX1262_STATE_STDBY_RC && current != SX1262_STATE_STDBY_XOSC) { + esp_err_t ret = sx1262_fsm_transition(SX1262_STATE_STDBY_RC); + if (ret != ESP_OK) { + return ret; + } + uint8_t stdby = SX1262_STDBY_RC; + sx1262_cmd_write(s_hal, SX1262_OP_SET_STANDBY, &stdby, 1); + } + + uint8_t cad_sym_num; + uint8_t cad_det_peak; + uint8_t cad_det_min; + + switch (s_config->sf) { + case SX1262_LORA_SF5: + cad_sym_num = 2; + cad_det_peak = 22; + cad_det_min = 10; + break; + case SX1262_LORA_SF6: + cad_sym_num = 2; + cad_det_peak = 22; + cad_det_min = 10; + break; + case SX1262_LORA_SF7: + cad_sym_num = 2; + cad_det_peak = 22; + cad_det_min = 10; + break; + case SX1262_LORA_SF8: + cad_sym_num = 2; + cad_det_peak = 22; + cad_det_min = 10; + break; + case SX1262_LORA_SF9: + cad_sym_num = 4; + cad_det_peak = 23; + cad_det_min = 10; + break; + case SX1262_LORA_SF10: + cad_sym_num = 4; + cad_det_peak = 24; + cad_det_min = 10; + break; + case SX1262_LORA_SF11: + cad_sym_num = 4; + cad_det_peak = 25; + cad_det_min = 10; + break; + case SX1262_LORA_SF12: + cad_sym_num = 4; + cad_det_peak = 28; + cad_det_min = 10; + break; + default: + cad_sym_num = 2; + cad_det_peak = 22; + cad_det_min = 10; + break; + } + + uint8_t cad_params[7] = { + cad_sym_num, + cad_det_peak, + cad_det_min, + 0x00, + 0x00, + 0x00, + 0x00, + }; + esp_err_t ret = sx1262_cmd_write(s_hal, SX1262_OP_SET_CAD_PARAMS, cad_params, 7); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "SetCadParams failed"); + return ret; + } + + uint8_t clr[2] = {(uint8_t)(SX1262_IRQ_ALL >> 8), (uint8_t)(SX1262_IRQ_ALL)}; + sx1262_cmd_write(s_hal, SX1262_OP_CLEAR_IRQ_STATUS, clr, 2); + + s_hal->set_antenna(s_hal->ctx, SX1262_ANT_RX); + + ret = sx1262_cmd_write(s_hal, SX1262_OP_SET_CAD, NULL, 0); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "SetCAD failed"); + s_hal->set_antenna(s_hal->ctx, SX1262_ANT_OFF); + return ret; + } + + ESP_LOGI( + TAG, "CAD started: SF%d, symNum=%d, detPeak=%d", s_config->sf, cad_sym_num, cad_det_peak); + return ESP_OK; +} + +esp_err_t sx1262_radio_get_rssi_inst(int16_t *out_rssi_dbm) { + if (out_rssi_dbm == NULL) { + return ESP_ERR_INVALID_ARG; + } + if (s_hal == NULL) { + return ESP_ERR_INVALID_STATE; + } + + uint8_t raw = 0; + esp_err_t ret = sx1262_cmd_read(s_hal, SX1262_OP_GET_RSSI_INST, &raw, 1); + if (ret != ESP_OK) { + return ret; + } + + *out_rssi_dbm = -(int16_t)(raw / 2); + return ESP_OK; +} + +esp_err_t sx1262_radio_get_stats(sx1262_stats_t *out_stats) { + if (out_stats == NULL) { + return ESP_ERR_INVALID_ARG; + } + if (s_hal == NULL) { + return ESP_ERR_INVALID_STATE; + } + + uint8_t buf[6] = {0}; + esp_err_t ret = sx1262_cmd_read(s_hal, SX1262_OP_GET_STATS, buf, 6); + if (ret != ESP_OK) { + return ret; + } + + out_stats->nb_pkt_received = ((uint16_t)buf[0] << 8) | buf[1]; + out_stats->nb_crc_error = ((uint16_t)buf[2] << 8) | buf[3]; + out_stats->nb_header_error = ((uint16_t)buf[4] << 8) | buf[5]; + + return ESP_OK; +} + +esp_err_t sx1262_radio_reset_stats(void) { + if (s_hal == NULL) { + return ESP_ERR_INVALID_STATE; + } + + uint8_t params[6] = {0}; + return sx1262_cmd_write(s_hal, SX1262_OP_RESET_STATS, params, 6); +} + +esp_err_t sx1262_radio_sleep(bool is_warm) { + if (s_hal == NULL || s_config == NULL) { + return ESP_ERR_INVALID_STATE; + } + + esp_err_t ret = sx1262_fsm_transition(SX1262_STATE_SLEEP); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "sleep: cannot transition to SLEEP from state %d", sx1262_fsm_get_state()); + return ret; + } + + s_hal->set_antenna(s_hal->ctx, SX1262_ANT_OFF); + + uint8_t sleep_cfg = is_warm ? SX1262_SLEEP_WARM_START : SX1262_SLEEP_COLD_START; + ret = sx1262_cmd_write(s_hal, SX1262_OP_SET_SLEEP, &sleep_cfg, 1); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "SetSleep failed"); + sx1262_fsm_on_irq_complete(); + return ret; + } + + if (!is_warm) { + s_needs_reinit = true; + } + + ESP_LOGI(TAG, "Sleep entered (%s)", is_warm ? "warm" : "cold"); + return ESP_OK; +} + +esp_err_t sx1262_radio_wakeup(void) { + if (s_hal == NULL) { + return ESP_ERR_INVALID_STATE; + } + + sx1262_state_t current = sx1262_fsm_get_state(); + if (current != SX1262_STATE_SLEEP) { + ESP_LOGE(TAG, "wakeup: not in SLEEP state (state=%d)", current); + return ESP_ERR_INVALID_STATE; + } + + s_hal->lock(s_hal->ctx); + s_hal->cs_low(s_hal->ctx); + s_hal->delay_ms(s_hal->ctx, 1); + s_hal->cs_high(s_hal->ctx); + s_hal->unlock(s_hal->ctx); + + esp_err_t ret = sx1262_cmd_wait_busy(s_hal, SX1262_WAIT_BUSY_TIMEOUT_MS); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "wakeup: BUSY timeout after NSS toggle"); + return ret; + } + + uint8_t stdby = SX1262_STDBY_RC; + ret = sx1262_cmd_write(s_hal, SX1262_OP_SET_STANDBY, &stdby, 1); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "wakeup: SetStandby failed"); + return ret; + } + + ret = sx1262_fsm_transition(SX1262_STATE_STDBY_RC); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "wakeup: FSM transition failed"); + return ret; + } + + ESP_LOGI(TAG, "Wakeup complete → STDBY_RC%s", s_needs_reinit ? " (cold — re-init required)" : ""); + return ESP_OK; +} + +esp_err_t sx1262_radio_set_rx_duty_cycle(uint32_t rx_ms, uint32_t sleep_ms) { + if (s_hal == NULL || s_config == NULL) { + return ESP_ERR_INVALID_STATE; + } + if (rx_ms == 0) { + ESP_LOGE(TAG, "set_rx_duty_cycle: rx_ms must be > 0"); + return ESP_ERR_INVALID_ARG; + } + if (s_needs_reinit) { + ESP_LOGE(TAG, "set_rx_duty_cycle: re-init required after cold sleep"); + return ESP_ERR_INVALID_STATE; + } + + sx1262_state_t current = sx1262_fsm_get_state(); + if (current != SX1262_STATE_STDBY_RC && current != SX1262_STATE_STDBY_XOSC) { + esp_err_t ret = sx1262_fsm_transition(SX1262_STATE_STDBY_RC); + if (ret != ESP_OK) { + return ret; + } + uint8_t stdby = SX1262_STDBY_RC; + sx1262_cmd_write(s_hal, SX1262_OP_SET_STANDBY, &stdby, 1); + } + + uint32_t rx_period = rx_ms * 64; + uint32_t sleep_period = sleep_ms * 64; + + uint8_t params[6] = { + (uint8_t)(rx_period >> 16), + (uint8_t)(rx_period >> 8), + (uint8_t)(rx_period), + (uint8_t)(sleep_period >> 16), + (uint8_t)(sleep_period >> 8), + (uint8_t)(sleep_period), + }; + + uint8_t clr[2] = {(uint8_t)(SX1262_IRQ_ALL >> 8), (uint8_t)(SX1262_IRQ_ALL)}; + esp_err_t ret = sx1262_cmd_write(s_hal, SX1262_OP_CLEAR_IRQ_STATUS, clr, 2); + if (ret != ESP_OK) { + return ret; + } + + s_hal->set_antenna(s_hal->ctx, SX1262_ANT_RX); + + ret = sx1262_fsm_transition(SX1262_STATE_RX); + if (ret != ESP_OK) { + s_hal->set_antenna(s_hal->ctx, SX1262_ANT_OFF); + return ret; + } + + ret = sx1262_cmd_write(s_hal, SX1262_OP_SET_RX_DUTY_CYCLE, params, 6); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "SetRxDutyCycle failed"); + s_hal->set_antenna(s_hal->ctx, SX1262_ANT_OFF); + sx1262_fsm_on_irq_complete(); + return ret; + } + + ESP_LOGI(TAG, + "RX duty cycle started: rx=%lu ms, sleep=%lu ms", + (unsigned long)rx_ms, + (unsigned long)sleep_ms); + return ESP_OK; +} + +static esp_err_t apply_workaround_w1(void) { + uint8_t val = 0; + esp_err_t ret = sx1262_cmd_read_register(s_hal, SX1262_REG_TX_MODULATION, &val, 1); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "W1: read 0x%04X failed", SX1262_REG_TX_MODULATION); + return ret; + } + + if (s_config->bw == SX1262_LORA_BW_500) { + val &= ~(1U << 2); + } else { + val |= (1U << 2); + } + + ret = sx1262_cmd_write_register(s_hal, SX1262_REG_TX_MODULATION, &val, 1); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "W1: write 0x%04X failed", SX1262_REG_TX_MODULATION); + return ret; + } + + ESP_LOGD(TAG, + "W1 applied: reg 0x%04X = 0x%02X (bw=0x%02X)", + SX1262_REG_TX_MODULATION, + val, + s_config->bw); + return ESP_OK; +} + +static esp_err_t update_packet_len(uint8_t len) { + uint8_t header_type = + s_config->is_implicit_hdr ? SX1262_LORA_HEADER_IMPLICIT : SX1262_LORA_HEADER_EXPLICIT; + uint8_t crc_on = s_config->is_crc_on ? 0x01 : 0x00; + uint8_t invert_iq = s_config->is_inverted_iq ? 0x01 : 0x00; + + uint8_t params[6] = { + (uint8_t)(s_config->preamble_len >> 8), + (uint8_t)(s_config->preamble_len & 0xFF), + header_type, + len, + crc_on, + invert_iq, + }; + + return sx1262_cmd_write(s_hal, SX1262_OP_SET_PACKET_PARAMS, params, 6); +} diff --git a/firmware_p4/components/Drivers/tusb_desc/include/tusb_desc.h b/firmware_p4/components/Drivers/tusb_desc/include/tusb_desc.h index e0b37327..ddf11572 100644 --- a/firmware_p4/components/Drivers/tusb_desc/include/tusb_desc.h +++ b/firmware_p4/components/Drivers/tusb_desc/include/tusb_desc.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef TUSB_DESC_H #define TUSB_DESC_H diff --git a/firmware_p4/components/Drivers/tusb_desc/tusb_desc.c b/firmware_p4/components/Drivers/tusb_desc/tusb_desc.c index 2cb22e31..d3cd4532 100644 --- a/firmware_p4/components/Drivers/tusb_desc/tusb_desc.c +++ b/firmware_p4/components/Drivers/tusb_desc/tusb_desc.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "tusb_desc.h" diff --git a/firmware_p4/components/Drivers/ys_rfid2/hal/include/ys_rfid2_hal_uart.h b/firmware_p4/components/Drivers/ys_rfid2/hal/include/ys_rfid2_hal_uart.h new file mode 100644 index 00000000..e13161c0 --- /dev/null +++ b/firmware_p4/components/Drivers/ys_rfid2/hal/include/ys_rfid2_hal_uart.h @@ -0,0 +1,84 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#ifndef YS_RFID2_HAL_UART_H +#define YS_RFID2_HAL_UART_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +#include "esp_err.h" + +/** + * @brief HAL UART configuration. + */ +typedef struct { + int port; + int baud_rate; + int tx_pin; + int rx_pin; +} ys_rfid2_hal_uart_config_t; + +/** + * @brief Initialize the UART peripheral. + * + * @param config Pointer to configuration. Caller retains ownership. + * @return + * - ESP_OK on success + * - ESP_ERR_INVALID_ARG if config is NULL + * - ESP_ERR_INVALID_STATE if already initialized + */ +esp_err_t ys_rfid2_hal_uart_init(const ys_rfid2_hal_uart_config_t *config); + +/** + * @brief Deinitialize the UART peripheral and release resources. + */ +void ys_rfid2_hal_uart_deinit(void); + +/** + * @brief Read bytes from UART. + * + * @param[out] out_data Buffer to store received bytes. + * @param len Maximum number of bytes to read. + * @param timeout_ms Read timeout in milliseconds. + * @return Number of bytes actually read, or -1 on error. + */ +int ys_rfid2_hal_uart_read(uint8_t *out_data, size_t len, uint32_t timeout_ms); + +/** + * @brief Write bytes to UART. + * + * @param data Buffer containing bytes to send. + * @param len Number of bytes to send. + * @return + * - ESP_OK on success + * - ESP_FAIL on write error + */ +esp_err_t ys_rfid2_hal_uart_write(const uint8_t *data, size_t len); + +/** + * @brief Flush the UART input buffer. + */ +void ys_rfid2_hal_uart_flush(void); + +#ifdef __cplusplus +} +#endif + +#endif // YS_RFID2_HAL_UART_H diff --git a/firmware_p4/components/Drivers/ys_rfid2/hal/ys_rfid2_hal_uart.c b/firmware_p4/components/Drivers/ys_rfid2/hal/ys_rfid2_hal_uart.c new file mode 100644 index 00000000..da0db933 --- /dev/null +++ b/firmware_p4/components/Drivers/ys_rfid2/hal/ys_rfid2_hal_uart.c @@ -0,0 +1,114 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#include "ys_rfid2_hal_uart.h" + +#include "esp_log.h" +#include "driver/uart.h" +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" + +static const char *TAG = "RFID_HAL_UART"; + +#define RFID_UART_BUF_SIZE 256 + +static int s_port = -1; +static bool s_is_init = false; + +esp_err_t ys_rfid2_hal_uart_init(const ys_rfid2_hal_uart_config_t *config) { + if (config == NULL) { + return ESP_ERR_INVALID_ARG; + } + + if (s_is_init) { + return ESP_ERR_INVALID_STATE; + } + + uart_config_t uart_config = { + .baud_rate = config->baud_rate, + .data_bits = UART_DATA_8_BITS, + .parity = UART_PARITY_DISABLE, + .stop_bits = UART_STOP_BITS_1, + .flow_ctrl = UART_HW_FLOWCTRL_DISABLE, + .source_clk = UART_SCLK_DEFAULT, + }; + + esp_err_t ret = uart_driver_install(config->port, RFID_UART_BUF_SIZE, 0, 0, NULL, 0); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "Failed to install UART driver: %s", esp_err_to_name(ret)); + return ret; + } + + ret = uart_param_config(config->port, &uart_config); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "Failed to configure UART: %s", esp_err_to_name(ret)); + uart_driver_delete(config->port); + return ret; + } + + ret = uart_set_pin(config->port, config->tx_pin, config->rx_pin, -1, -1); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "Failed to set UART pins: %s", esp_err_to_name(ret)); + uart_driver_delete(config->port); + return ret; + } + + s_port = config->port; + s_is_init = true; + + ESP_LOGI(TAG, "Initialized — port: %d, baud: %d", config->port, config->baud_rate); + return ESP_OK; +} + +void ys_rfid2_hal_uart_deinit(void) { + if (!s_is_init) { + return; + } + + uart_driver_delete(s_port); + s_port = -1; + s_is_init = false; + + ESP_LOGI(TAG, "Deinitialized"); +} + +int ys_rfid2_hal_uart_read(uint8_t *out_data, size_t len, uint32_t timeout_ms) { + if (!s_is_init || out_data == NULL) { + return -1; + } + + return uart_read_bytes(s_port, out_data, len, pdMS_TO_TICKS(timeout_ms)); +} + +esp_err_t ys_rfid2_hal_uart_write(const uint8_t *data, size_t len) { + if (!s_is_init || data == NULL) { + return ESP_ERR_INVALID_STATE; + } + + int written = uart_write_bytes(s_port, data, len); + if (written < 0) { + return ESP_FAIL; + } + + return ESP_OK; +} + +void ys_rfid2_hal_uart_flush(void) { + if (!s_is_init) { + return; + } + + uart_flush_input(s_port); +} diff --git a/firmware_p4/components/Drivers/ys_rfid2/include/ys_rfid2.h b/firmware_p4/components/Drivers/ys_rfid2/include/ys_rfid2.h new file mode 100644 index 00000000..38cb3872 --- /dev/null +++ b/firmware_p4/components/Drivers/ys_rfid2/include/ys_rfid2.h @@ -0,0 +1,102 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#ifndef YS_RFID2_H +#define YS_RFID2_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "esp_err.h" + +#include "ys_rfid2_types.h" + +/** + * @brief Return a default configuration. + * + * Defaults: UART_NUM_2, 9600 baud, pins from pin_def.h, + * 1000 ms debounce, 2000 ms removal timeout. + */ +ys_rfid2_config_t ys_rfid2_default_config(void); + +/** + * @brief Initialize the YS-RFID2 driver. + * + * Sets up the UART peripheral via HAL. Does NOT start scanning. + * + * @param config Pointer to configuration. If NULL, uses default config. + * @return + * - ESP_OK on success + * - ESP_ERR_INVALID_STATE if already initialized + * - ESP_ERR_NO_MEM if mutex creation fails + */ +esp_err_t ys_rfid2_init(const ys_rfid2_config_t *config); + +/** + * @brief Deinitialize the driver and release all resources. + * + * Stops scanning if active. + * + * @return + * - ESP_OK on success + * - ESP_ERR_INVALID_STATE if not initialized + */ +esp_err_t ys_rfid2_deinit(void); + +/** + * @brief Start continuous card scanning. + * + * Creates a background FreeRTOS task that reads the UART and delivers + * events via the registered callback. + * + * @param cb Event callback function. Must not be NULL. + * @param ctx User context pointer passed to the callback. + * @return + * - ESP_OK on success + * - ESP_ERR_INVALID_ARG if cb is NULL + * - ESP_ERR_INVALID_STATE if not initialized or already scanning + * - ESP_ERR_NO_MEM if task creation fails + */ +esp_err_t ys_rfid2_start(ys_rfid2_event_cb_t cb, void *ctx); + +/** + * @brief Stop scanning and destroy the background task. + * + * Blocks until the task has exited. + */ +void ys_rfid2_stop(void); + +/** + * @brief Get the current driver state. + */ +ys_rfid2_state_t ys_rfid2_get_state(void); + +/** + * @brief Get the last detected card event. + * + * @param[out] out_event Pointer to receive the event data. + * @return + * - ESP_OK if a card was previously detected + * - ESP_ERR_NOT_FOUND if no card has been detected yet + * - ESP_ERR_INVALID_ARG if out_event is NULL + */ +esp_err_t ys_rfid2_get_last_card(ys_rfid2_event_t *out_event); + +#ifdef __cplusplus +} +#endif + +#endif // YS_RFID2_H diff --git a/firmware_p4/components/Drivers/ys_rfid2/include/ys_rfid2_parser.h b/firmware_p4/components/Drivers/ys_rfid2/include/ys_rfid2_parser.h new file mode 100644 index 00000000..f80dc06c --- /dev/null +++ b/firmware_p4/components/Drivers/ys_rfid2/include/ys_rfid2_parser.h @@ -0,0 +1,49 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#ifndef YS_RFID2_PARSER_H +#define YS_RFID2_PARSER_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +#include "ys_rfid2_types.h" + +/** + * @brief Reset the parser state, discarding any accumulated bytes. + */ +void ys_rfid2_parser_reset(void); + +/** + * @brief Feed a byte into the parser. + * + * Accumulates bytes until the '@' delimiter is found, then attempts to + * extract a valid card ID from the "card number: xxxxxxxxxx@" frame. + * + * @param byte Byte received from UART. + * @param[out] out_raw Filled with card data if a valid frame was parsed. + * @return true if a valid card ID was extracted, false otherwise. + */ +bool ys_rfid2_parser_feed(uint8_t byte, ys_rfid2_raw_data_t *out_raw); + +#ifdef __cplusplus +} +#endif + +#endif // YS_RFID2_PARSER_H diff --git a/firmware_p4/components/Drivers/ys_rfid2/include/ys_rfid2_types.h b/firmware_p4/components/Drivers/ys_rfid2/include/ys_rfid2_types.h new file mode 100644 index 00000000..a306ff21 --- /dev/null +++ b/firmware_p4/components/Drivers/ys_rfid2/include/ys_rfid2_types.h @@ -0,0 +1,87 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#ifndef YS_RFID2_TYPES_H +#define YS_RFID2_TYPES_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +#define YS_RFID2_CARD_ID_LEN 10 +#define YS_RFID2_RAW_DATA_LEN 5 + +typedef enum { + YS_RFID2_STATE_UNINITIALIZED = 0, + YS_RFID2_STATE_IDLE, + YS_RFID2_STATE_SCANNING, + YS_RFID2_STATE_ERROR, + YS_RFID2_STATE_COUNT +} ys_rfid2_state_t; + +typedef enum { + YS_RFID2_EVENT_CARD_DETECTED = 0, + YS_RFID2_EVENT_CARD_REMOVED, + YS_RFID2_EVENT_COUNT +} ys_rfid2_event_type_t; + +/** + * @brief Raw data from the RFID reader module. + */ +typedef struct { + char id_str[YS_RFID2_CARD_ID_LEN + 1]; + uint8_t data[YS_RFID2_RAW_DATA_LEN]; + uint8_t bit_count; +} ys_rfid2_raw_data_t; + +/** + * @brief Event delivered to the user callback. + */ +typedef struct { + ys_rfid2_event_type_t type; + ys_rfid2_raw_data_t raw; + int64_t timestamp_ms; +} ys_rfid2_event_t; + +/** + * @brief Callback invoked on card events. + * + * Called from the reader task context. Must not block for extended periods. + * + * @param event Pointer to event data. Valid only during callback scope. + * @param ctx User context pointer provided at registration. + */ +typedef void (*ys_rfid2_event_cb_t)(const ys_rfid2_event_t *event, void *ctx); + +/** + * @brief Driver configuration. + */ +typedef struct { + int uart_port; + int baud_rate; + int tx_pin; + int rx_pin; + uint32_t debounce_ms; + uint32_t removal_timeout_ms; +} ys_rfid2_config_t; + +#ifdef __cplusplus +} +#endif + +#endif // YS_RFID2_TYPES_H diff --git a/firmware_p4/components/Drivers/ys_rfid2/ys_rfid2_core.c b/firmware_p4/components/Drivers/ys_rfid2/ys_rfid2_core.c new file mode 100644 index 00000000..42845b41 --- /dev/null +++ b/firmware_p4/components/Drivers/ys_rfid2/ys_rfid2_core.c @@ -0,0 +1,298 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#include "ys_rfid2.h" + +#include + +#include "esp_log.h" +#include "esp_timer.h" +#include "driver/uart.h" +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" +#include "freertos/semphr.h" + +#include "pin_def.h" +#include "ys_rfid2_hal_uart.h" +#include "ys_rfid2_parser.h" + +static const char *TAG = "YS_RFID2"; + +#define RFID_TASK_STACK_SIZE 4096 +#define RFID_TASK_PRIORITY 5 +#define RFID_READ_TIMEOUT_MS 100 +#define RFID_DEFAULT_BAUD 9600 +#define RFID_DEFAULT_DEBOUNCE_MS 1000 +#define RFID_DEFAULT_REMOVAL_MS 2000 + +typedef struct { + ys_rfid2_config_t config; + ys_rfid2_state_t state; + ys_rfid2_event_cb_t cb; + void *ctx; + TaskHandle_t task; + volatile bool is_running; + ys_rfid2_event_t last_event; + bool has_last_card; + int64_t last_card_time_ms; + SemaphoreHandle_t mutex; +} ys_rfid2_driver_t; + +static ys_rfid2_driver_t s_rfid = {0}; + +static void reader_task(void *pvParameters); +static void handle_card_detected(const ys_rfid2_raw_data_t *raw, int64_t now_ms); +static void check_card_removal(int64_t now_ms); +static int64_t get_time_ms(void); + +ys_rfid2_config_t ys_rfid2_default_config(void) { + ys_rfid2_config_t config = { + .uart_port = UART_NUM_2, + .baud_rate = RFID_DEFAULT_BAUD, + .tx_pin = GPIO_RFID_UART_TX_PIN, + .rx_pin = GPIO_RFID_UART_RX_PIN, + .debounce_ms = RFID_DEFAULT_DEBOUNCE_MS, + .removal_timeout_ms = RFID_DEFAULT_REMOVAL_MS, + }; + return config; +} + +esp_err_t ys_rfid2_init(const ys_rfid2_config_t *config) { + if (s_rfid.state != YS_RFID2_STATE_UNINITIALIZED) { + return ESP_ERR_INVALID_STATE; + } + + if (config != NULL) { + s_rfid.config = *config; + } else { + s_rfid.config = ys_rfid2_default_config(); + } + + s_rfid.mutex = xSemaphoreCreateMutex(); + if (s_rfid.mutex == NULL) { + ESP_LOGE(TAG, "Failed to create mutex"); + return ESP_ERR_NO_MEM; + } + + ys_rfid2_hal_uart_config_t hal_config = { + .port = s_rfid.config.uart_port, + .baud_rate = s_rfid.config.baud_rate, + .tx_pin = s_rfid.config.tx_pin, + .rx_pin = s_rfid.config.rx_pin, + }; + + esp_err_t ret = ys_rfid2_hal_uart_init(&hal_config); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "Failed to init HAL UART: %s", esp_err_to_name(ret)); + vSemaphoreDelete(s_rfid.mutex); + s_rfid.mutex = NULL; + return ret; + } + + s_rfid.state = YS_RFID2_STATE_IDLE; + s_rfid.has_last_card = false; + + ESP_LOGI( + TAG, "Initialized — port: %d, baud: %d", s_rfid.config.uart_port, s_rfid.config.baud_rate); + + return ESP_OK; +} + +esp_err_t ys_rfid2_deinit(void) { + if (s_rfid.state == YS_RFID2_STATE_UNINITIALIZED) { + return ESP_ERR_INVALID_STATE; + } + + if (s_rfid.state == YS_RFID2_STATE_SCANNING) { + ys_rfid2_stop(); + } + + ys_rfid2_hal_uart_deinit(); + + if (s_rfid.mutex != NULL) { + vSemaphoreDelete(s_rfid.mutex); + s_rfid.mutex = NULL; + } + + s_rfid.state = YS_RFID2_STATE_UNINITIALIZED; + + ESP_LOGI(TAG, "Deinitialized"); + return ESP_OK; +} + +esp_err_t ys_rfid2_start(ys_rfid2_event_cb_t cb, void *ctx) { + if (cb == NULL) { + return ESP_ERR_INVALID_ARG; + } + + if (s_rfid.state != YS_RFID2_STATE_IDLE) { + return ESP_ERR_INVALID_STATE; + } + + s_rfid.cb = cb; + s_rfid.ctx = ctx; + s_rfid.is_running = true; + s_rfid.has_last_card = false; + + ys_rfid2_parser_reset(); + ys_rfid2_hal_uart_flush(); + + BaseType_t ret = xTaskCreate( + reader_task, "ys_rfid2", RFID_TASK_STACK_SIZE, NULL, RFID_TASK_PRIORITY, &s_rfid.task); + + if (ret != pdPASS) { + ESP_LOGE(TAG, "Failed to create reader task"); + s_rfid.is_running = false; + return ESP_ERR_NO_MEM; + } + + ESP_LOGI(TAG, "Scanning started"); + return ESP_OK; +} + +void ys_rfid2_stop(void) { + if (!s_rfid.is_running) { + return; + } + + s_rfid.is_running = false; + + while (s_rfid.task != NULL) { + vTaskDelay(pdMS_TO_TICKS(10)); + } + + s_rfid.cb = NULL; + s_rfid.ctx = NULL; + + ESP_LOGI(TAG, "Scanning stopped"); +} + +ys_rfid2_state_t ys_rfid2_get_state(void) { + return s_rfid.state; +} + +esp_err_t ys_rfid2_get_last_card(ys_rfid2_event_t *out_event) { + if (out_event == NULL) { + return ESP_ERR_INVALID_ARG; + } + + if (xSemaphoreTake(s_rfid.mutex, pdMS_TO_TICKS(100)) != pdTRUE) { + return ESP_ERR_TIMEOUT; + } + + if (!s_rfid.has_last_card) { + xSemaphoreGive(s_rfid.mutex); + return ESP_ERR_NOT_FOUND; + } + + *out_event = s_rfid.last_event; + xSemaphoreGive(s_rfid.mutex); + + return ESP_OK; +} + +static void reader_task(void *pvParameters) { + (void)pvParameters; + + xSemaphoreTake(s_rfid.mutex, portMAX_DELAY); + s_rfid.state = YS_RFID2_STATE_SCANNING; + xSemaphoreGive(s_rfid.mutex); + + uint8_t rx_byte; + + while (s_rfid.is_running) { + int64_t now_ms = get_time_ms(); + int len = ys_rfid2_hal_uart_read(&rx_byte, 1, RFID_READ_TIMEOUT_MS); + + if (len > 0) { + ys_rfid2_raw_data_t raw = {0}; + if (ys_rfid2_parser_feed(rx_byte, &raw)) { + handle_card_detected(&raw, now_ms); + } + } else { + check_card_removal(now_ms); + } + } + + xSemaphoreTake(s_rfid.mutex, portMAX_DELAY); + s_rfid.state = YS_RFID2_STATE_IDLE; + s_rfid.task = NULL; + xSemaphoreGive(s_rfid.mutex); + + vTaskDelete(NULL); +} + +static void handle_card_detected(const ys_rfid2_raw_data_t *raw, int64_t now_ms) { + xSemaphoreTake(s_rfid.mutex, portMAX_DELAY); + + bool is_same = s_rfid.has_last_card && (strcmp(s_rfid.last_event.raw.id_str, raw->id_str) == 0); + + bool is_debounced = + is_same && (now_ms - s_rfid.last_card_time_ms < (int64_t)s_rfid.config.debounce_ms); + + if (is_debounced) { + s_rfid.last_card_time_ms = now_ms; + xSemaphoreGive(s_rfid.mutex); + return; + } + + s_rfid.last_event.type = YS_RFID2_EVENT_CARD_DETECTED; + s_rfid.last_event.raw = *raw; + s_rfid.last_event.timestamp_ms = now_ms; + s_rfid.last_card_time_ms = now_ms; + s_rfid.has_last_card = true; + + ys_rfid2_event_cb_t cb = s_rfid.cb; + void *ctx = s_rfid.ctx; + xSemaphoreGive(s_rfid.mutex); + + if (cb != NULL) { + cb(&s_rfid.last_event, ctx); + } +} + +static void check_card_removal(int64_t now_ms) { + xSemaphoreTake(s_rfid.mutex, portMAX_DELAY); + + if (!s_rfid.has_last_card) { + xSemaphoreGive(s_rfid.mutex); + return; + } + + if (now_ms - s_rfid.last_card_time_ms <= (int64_t)s_rfid.config.removal_timeout_ms) { + xSemaphoreGive(s_rfid.mutex); + return; + } + + ys_rfid2_event_t removal_event = { + .type = YS_RFID2_EVENT_CARD_REMOVED, + .raw = s_rfid.last_event.raw, + .timestamp_ms = now_ms, + }; + + s_rfid.has_last_card = false; + + ys_rfid2_event_cb_t cb = s_rfid.cb; + void *ctx = s_rfid.ctx; + xSemaphoreGive(s_rfid.mutex); + + if (cb != NULL) { + cb(&removal_event, ctx); + } +} + +static int64_t get_time_ms(void) { + return esp_timer_get_time() / 1000; +} diff --git a/firmware_p4/components/Drivers/ys_rfid2/ys_rfid2_parser.c b/firmware_p4/components/Drivers/ys_rfid2/ys_rfid2_parser.c new file mode 100644 index 00000000..ba19d56c --- /dev/null +++ b/firmware_p4/components/Drivers/ys_rfid2/ys_rfid2_parser.c @@ -0,0 +1,112 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#include "ys_rfid2_parser.h" + +#include + +#include "esp_log.h" + +static const char *TAG = "RFID_PARSER"; + +#define PARSER_LINE_LEN 64 +#define PARSER_PREFIX "card number: " +#define PARSER_PREFIX_LEN 13 +#define PARSER_DELIMITER '@' + +static char s_line_buf[PARSER_LINE_LEN]; +static int s_line_pos = 0; + +static bool validate_and_extract(char *out_id); +static void decimal_to_bytes(const char *id_str, uint8_t *out_data); + +void ys_rfid2_parser_reset(void) { + s_line_pos = 0; +} + +bool ys_rfid2_parser_feed(uint8_t byte, ys_rfid2_raw_data_t *out_raw) { + if (out_raw == NULL) { + return false; + } + + if (byte == PARSER_DELIMITER) { + char card_id[YS_RFID2_CARD_ID_LEN + 1]; + bool is_valid = validate_and_extract(card_id); + s_line_pos = 0; + + if (is_valid) { + memcpy(out_raw->id_str, card_id, YS_RFID2_CARD_ID_LEN + 1); + decimal_to_bytes(card_id, out_raw->data); + out_raw->bit_count = 40; + ESP_LOGD(TAG, "Card parsed: %s", card_id); + return true; + } + + return false; + } + + if (s_line_pos < PARSER_LINE_LEN - 1) { + s_line_buf[s_line_pos++] = (char)byte; + } else { + s_line_pos = 0; + } + + return false; +} + +static bool validate_and_extract(char *out_id) { + if (s_line_pos < PARSER_PREFIX_LEN + YS_RFID2_CARD_ID_LEN) { + return false; + } + + const char *prefix_pos = NULL; + int search_limit = s_line_pos - (PARSER_PREFIX_LEN + YS_RFID2_CARD_ID_LEN); + for (int i = 0; i <= search_limit; i++) { + if (memcmp(&s_line_buf[i], PARSER_PREFIX, PARSER_PREFIX_LEN) == 0) { + prefix_pos = &s_line_buf[i]; + break; + } + } + + if (prefix_pos == NULL) { + return false; + } + + const char *digits = prefix_pos + PARSER_PREFIX_LEN; + for (int i = 0; i < YS_RFID2_CARD_ID_LEN; i++) { + if (digits[i] < '0' || digits[i] > '9') { + return false; + } + } + + memcpy(out_id, digits, YS_RFID2_CARD_ID_LEN); + out_id[YS_RFID2_CARD_ID_LEN] = '\0'; + return true; +} + +// Convert 10-digit decimal string to 5 raw bytes (40 bits big-endian). +// Max value of 10 decimal digits = 9999999999 which fits in 40 bits. +static void decimal_to_bytes(const char *id_str, uint8_t *out_data) { + uint64_t value = 0; + for (int i = 0; i < YS_RFID2_CARD_ID_LEN; i++) { + value = value * 10 + (uint64_t)(id_str[i] - '0'); + } + + out_data[0] = (uint8_t)(value >> 32); + out_data[1] = (uint8_t)(value >> 24); + out_data[2] = (uint8_t)(value >> 16); + out_data[3] = (uint8_t)(value >> 8); + out_data[4] = (uint8_t)(value); +} diff --git a/firmware_p4/components/Service/CMakeLists.txt b/firmware_p4/components/Service/CMakeLists.txt index d20624bd..2ccfa3cf 100644 --- a/firmware_p4/components/Service/CMakeLists.txt +++ b/firmware_p4/components/Service/CMakeLists.txt @@ -1,16 +1,17 @@ # Copyright (c) 2025 HIGH CODE LLC # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# TentacleOS is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# http://www.apache.org/licenses/LICENSE-2.0 +# TentacleOS is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# You should have received a copy of the GNU General Public License +# along with TentacleOS. If not, see . file(GLOB_RECURSE SD_CARD_SERVICE_SRCS "sd_card/*.c") file(GLOB_RECURSE CONSOLE_SERVICE_SRCS "console/*.c") diff --git a/firmware_p4/components/Service/bluetooth/bluetooth_service.c b/firmware_p4/components/Service/bluetooth/bluetooth_service.c index 6b012066..b2a4e8ab 100644 --- a/firmware_p4/components/Service/bluetooth/bluetooth_service.c +++ b/firmware_p4/components/Service/bluetooth/bluetooth_service.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "bluetooth_service.h" @@ -20,6 +21,7 @@ #include "esp_log.h" #include "spi_bridge.h" +#include "spi_session.h" static const char *TAG = "BT_SERVICE_P4"; @@ -30,9 +32,9 @@ static const char *TAG = "BT_SERVICE_P4"; #define BLE_MAC_LEN 6 static bluetooth_service_sniffer_cb_t s_sniffer_cb = NULL; +static uint32_t s_sniffer_session = SPI_SESSION_INVALID_ID; static bluetooth_service_scan_result_t s_cached_scan_record; -static void sniffer_stream_cb(spi_id_t id, const uint8_t *payload, uint8_t len); static bool get_info(spi_bt_info_t *out_info); // Public function implementations @@ -102,23 +104,37 @@ esp_err_t bluetooth_service_connect(const uint8_t *addr, SPI_ID_BT_CONNECT, payload, sizeof(payload), NULL, NULL, SPI_CONNECT_TIMEOUT_MS); } +static void sniffer_session_stream(const uint8_t *payload, uint8_t len) { + if (s_sniffer_cb == NULL || payload == NULL || len < sizeof(spi_ble_sniffer_frame_t)) + return; + const spi_ble_sniffer_frame_t *frame = (const spi_ble_sniffer_frame_t *)payload; + s_sniffer_cb(frame->addr, frame->addr_type, frame->rssi, frame->data, frame->len); +} + +static void sniffer_session_lost(uint32_t session_id, spi_id_t op_id) { + (void)op_id; + if (session_id == s_sniffer_session) { + s_sniffer_session = SPI_SESSION_INVALID_ID; + s_sniffer_cb = NULL; + } +} + esp_err_t bluetooth_service_start_sniffer(bluetooth_service_sniffer_cb_t cb) { s_sniffer_cb = cb; - if (cb != NULL) { - spi_bridge_register_stream_cb(SPI_ID_BT_APP_SNIFFER, sniffer_stream_cb); - } - esp_err_t err = - spi_bridge_send_command(SPI_ID_BT_APP_SNIFFER, NULL, 0, NULL, NULL, SPI_TIMEOUT_MS); - if (err != ESP_OK) { - spi_bridge_unregister_stream_cb(SPI_ID_BT_APP_SNIFFER); + s_sniffer_session = spi_session_start( + SPI_ID_BT_APP_SNIFFER, NULL, 0, sniffer_session_stream, sniffer_session_lost); + if (s_sniffer_session == SPI_SESSION_INVALID_ID) { s_sniffer_cb = NULL; + return ESP_FAIL; } - return err; + return ESP_OK; } void bluetooth_service_stop_sniffer(void) { - spi_bridge_send_command(SPI_ID_BT_APP_STOP, NULL, 0, NULL, NULL, SPI_TIMEOUT_MS); - spi_bridge_unregister_stream_cb(SPI_ID_BT_APP_SNIFFER); + if (s_sniffer_session != SPI_SESSION_INVALID_ID) { + spi_session_stop(s_sniffer_session); + s_sniffer_session = SPI_SESSION_INVALID_ID; + } s_sniffer_cb = NULL; } @@ -305,15 +321,6 @@ bluetooth_service_scan_result_t *bluetooth_service_get_scan_result(uint16_t inde // Static function implementations -static void sniffer_stream_cb(spi_id_t id, const uint8_t *payload, uint8_t len) { - (void)id; - if (s_sniffer_cb == NULL || payload == NULL || len < sizeof(spi_ble_sniffer_frame_t)) { - return; - } - const spi_ble_sniffer_frame_t *frame = (const spi_ble_sniffer_frame_t *)payload; - s_sniffer_cb(frame->addr, frame->addr_type, frame->rssi, frame->data, frame->len); -} - static bool get_info(spi_bt_info_t *out_info) { if (out_info == NULL) { return false; diff --git a/firmware_p4/components/Service/bluetooth/include/bluetooth_service.h b/firmware_p4/components/Service/bluetooth/include/bluetooth_service.h index 33df087a..fe285ed4 100644 --- a/firmware_p4/components/Service/bluetooth/include/bluetooth_service.h +++ b/firmware_p4/components/Service/bluetooth/include/bluetooth_service.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef BLUETOOTH_SERVICE_H #define BLUETOOTH_SERVICE_H diff --git a/firmware_p4/components/Service/bridge_manager/bridge_manager.c b/firmware_p4/components/Service/bridge_manager/bridge_manager.c index 10cf67cd..3139578a 100644 --- a/firmware_p4/components/Service/bridge_manager/bridge_manager.c +++ b/firmware_p4/components/Service/bridge_manager/bridge_manager.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "bridge_manager.h" @@ -60,15 +61,28 @@ esp_err_t bridge_manager_init(void) { ESP_LOGW(TAG, "C5 update required"); c5_flasher_init(); if (c5_flasher_update(NULL, 0) == ESP_OK) { - ESP_LOGI(TAG, "C5 synchronized"); + ESP_LOGI(TAG, "C5 firmware uploaded"); } else { ESP_LOGE(TAG, "C5 synchronization failed"); + spi_bridge_set_alive(false); return ESP_FAIL; } } else { ESP_LOGI(TAG, "C5 is up to date"); } + // Final probe: confirm the SPI bridge is actually responding before + // letting background tasks poll it + memset(resp_ver, 0, sizeof(resp_ver)); + ret = spi_bridge_send_command( + SPI_ID_SYSTEM_VERSION, NULL, 0, &resp_header, resp_ver, VERSION_TIMEOUT_MS); + if (ret != ESP_OK) { + ESP_LOGW(TAG, "C5 SPI bridge not responding — disabling bridge polling"); + spi_bridge_set_alive(false); + return ESP_OK; + } + + ESP_LOGI(TAG, "C5 bridge alive"); return ESP_OK; } diff --git a/firmware_p4/components/Service/bridge_manager/include/bridge_manager.h b/firmware_p4/components/Service/bridge_manager/include/bridge_manager.h index e0a82525..cf9efeae 100644 --- a/firmware_p4/components/Service/bridge_manager/include/bridge_manager.h +++ b/firmware_p4/components/Service/bridge_manager/include/bridge_manager.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef BRIDGE_MANAGER_H #define BRIDGE_MANAGER_H diff --git a/firmware_p4/components/Service/c5_flasher/c5_flasher.c b/firmware_p4/components/Service/c5_flasher/c5_flasher.c index 080466d4..2cbd96a8 100644 --- a/firmware_p4/components/Service/c5_flasher/c5_flasher.c +++ b/firmware_p4/components/Service/c5_flasher/c5_flasher.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "c5_flasher.h" @@ -27,26 +28,34 @@ static const char *TAG = "C5_FLASHER"; #define FLASHER_UART UART_NUM_1 -#define FLASHER_UART_BUF 2048 +#define FLASHER_UART_BUF 4096 #define FLASH_BLOCK_SIZE 1024 #define FLASH_BLOCK_HDR_SIZE 16 #define FLASH_CHECKSUM_INIT 0xEF -#define BOOTLOADER_DELAY_MS 100 -#define BOOT_RELEASE_DELAY_MS 200 -#define FLASH_BEGIN_DELAY_MS 100 -#define FLASH_BLOCK_DELAY_MS 20 +#define BOOTLOADER_DELAY_MS 50 +#define BOOT_RELEASE_DELAY_MS 50 +#define FLASH_BEGIN_DELAY_MS 50 // ESP serial protocol (SLIP framing) -#define ESP_ROM_BAUD 115200 -#define SLIP_END 0xC0 -#define SLIP_ESC 0xDB -#define SLIP_ESC_END 0xDC -#define SLIP_ESC_ESC 0xDD +#define ESP_ROM_BAUD 115200 +#define ESP_FLASH_BAUD 921600 +#define SLIP_END 0xC0 +#define SLIP_ESC 0xDB +#define SLIP_ESC_END 0xDC +#define SLIP_ESC_ESC 0xDD // ESP serial protocol commands -#define ESP_CMD_FLASH_BEGIN 0x02 -#define ESP_CMD_FLASH_DATA 0x03 -#define ESP_CMD_FLASH_END 0x04 +#define ESP_CMD_SYNC 0x08 +#define ESP_CMD_FLASH_BEGIN 0x02 +#define ESP_CMD_FLASH_DATA 0x03 +#define ESP_CMD_FLASH_END 0x04 +#define ESP_CMD_CHANGE_BAUDRATE 0x0F + +#define SYNC_ATTEMPTS 3 +#define SYNC_TIMEOUT_MS 100 +#define BAUD_TIMEOUT_MS 300 +#define ACK_TIMEOUT_MS 500 +#define FLASH_BLOCK_DELAY_MS 5 #if C5_FIRMWARE_EMBEDDED extern const uint8_t c5_firmware_bin_start[] asm("_binary_TentacleOS_C5_bin_start"); @@ -60,8 +69,14 @@ typedef struct { uint32_t checksum; } __attribute__((packed)) c5_flasher_cmd_header_t; +static bool s_ack_supported = false; + static void slip_send_byte(uint8_t b); static void send_packet(uint8_t cmd, uint8_t *payload, uint16_t len, uint32_t checksum); +static esp_err_t read_response(uint32_t timeout_ms); +static esp_err_t sync_bootloader(void); +static esp_err_t change_baudrate(uint32_t new_baud); +static void wait_for_ack_or_delay(uint32_t fallback_delay_ms); esp_err_t c5_flasher_init(void) { gpio_config_t io_conf = { @@ -124,10 +139,15 @@ esp_err_t c5_flasher_update(const uint8_t *bin_data, uint32_t bin_size) { c5_flasher_enter_bootloader(); + s_ack_supported = (sync_bootloader() == ESP_OK); + if (s_ack_supported) { + change_baudrate(ESP_FLASH_BAUD); + } + uint32_t num_blocks = (bin_size + FLASH_BLOCK_SIZE - 1) / FLASH_BLOCK_SIZE; uint32_t begin_params[4] = {bin_size, num_blocks, FLASH_BLOCK_SIZE, 0x0000}; send_packet(ESP_CMD_FLASH_BEGIN, (uint8_t *)begin_params, sizeof(begin_params), 0); - vTaskDelay(pdMS_TO_TICKS(FLASH_BEGIN_DELAY_MS)); + wait_for_ack_or_delay(FLASH_BEGIN_DELAY_MS); for (uint32_t i = 0; i < num_blocks; i++) { uint32_t offset = i * FLASH_BLOCK_SIZE; @@ -148,18 +168,75 @@ esp_err_t c5_flasher_update(const uint8_t *bin_data, uint32_t bin_size) { } send_packet(ESP_CMD_FLASH_DATA, block_buffer, this_len + FLASH_BLOCK_HDR_SIZE, checksum); - ESP_LOGI(TAG, "Writing block %lu/%lu", i + 1, num_blocks); - vTaskDelay(pdMS_TO_TICKS(FLASH_BLOCK_DELAY_MS)); + if ((i % 100) == 0 || i == num_blocks - 1) { + ESP_LOGI(TAG, "Writing block %lu/%lu", i + 1, num_blocks); + } + wait_for_ack_or_delay(FLASH_BLOCK_DELAY_MS); } uint32_t end_params[1] = {0}; send_packet(ESP_CMD_FLASH_END, (uint8_t *)end_params, sizeof(end_params), 0); + wait_for_ack_or_delay(FLASH_BEGIN_DELAY_MS); ESP_LOGI(TAG, "Update successful"); c5_flasher_reset_normal(); return ESP_OK; } +static esp_err_t read_response(uint32_t timeout_ms) { + uint8_t byte; + bool in_packet = false; + TickType_t deadline = xTaskGetTickCount() + pdMS_TO_TICKS(timeout_ms); + + while (xTaskGetTickCount() < deadline) { + if (uart_read_bytes(FLASHER_UART, &byte, 1, pdMS_TO_TICKS(10)) <= 0) + continue; + if (byte != SLIP_END) + continue; + if (!in_packet) { + in_packet = true; + } else { + return ESP_OK; + } + } + return ESP_ERR_TIMEOUT; +} + +static esp_err_t sync_bootloader(void) { + uint8_t sync_data[36] = {0x07, 0x07, 0x12, 0x20}; + memset(sync_data + 4, 0x55, 32); + for (int i = 0; i < SYNC_ATTEMPTS; i++) { + send_packet(ESP_CMD_SYNC, sync_data, sizeof(sync_data), 0); + if (read_response(SYNC_TIMEOUT_MS) == ESP_OK) { + ESP_LOGI(TAG, "Bootloader synced — using ACK flow control"); + return ESP_OK; + } + } + ESP_LOGW(TAG, "No ACK from bootloader — falling back to fixed delays"); + return ESP_ERR_TIMEOUT; +} + +static esp_err_t change_baudrate(uint32_t new_baud) { + uint32_t params[2] = {new_baud, 0}; + send_packet(ESP_CMD_CHANGE_BAUDRATE, (uint8_t *)params, sizeof(params), 0); + if (read_response(BAUD_TIMEOUT_MS) != ESP_OK) { + ESP_LOGW(TAG, "Baud rate change unconfirmed, staying at %d", ESP_ROM_BAUD); + return ESP_ERR_TIMEOUT; + } + uart_set_baudrate(FLASHER_UART, new_baud); + vTaskDelay(pdMS_TO_TICKS(50)); + ESP_LOGI(TAG, "Baud rate changed to %lu", (unsigned long)new_baud); + return ESP_OK; +} + +static void wait_for_ack_or_delay(uint32_t fallback_delay_ms) { + if (s_ack_supported) { + read_response(ACK_TIMEOUT_MS); + } else { + vTaskDelay(pdMS_TO_TICKS(fallback_delay_ms)); + } +} + static void slip_send_byte(uint8_t b) { if (b == SLIP_END) { uint8_t esc[] = {SLIP_ESC, SLIP_ESC_END}; diff --git a/firmware_p4/components/Service/c5_flasher/include/c5_flasher.h b/firmware_p4/components/Service/c5_flasher/include/c5_flasher.h index 7a8f04ff..ee388ce5 100644 --- a/firmware_p4/components/Service/c5_flasher/include/c5_flasher.h +++ b/firmware_p4/components/Service/c5_flasher/include/c5_flasher.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef C5_FLASHER_H #define C5_FLASHER_H diff --git a/firmware_p4/components/Service/console/commands/cmd_fs.c b/firmware_p4/components/Service/console/commands/cmd_fs.c index 5793bbac..0457c7c8 100644 --- a/firmware_p4/components/Service/console/commands/cmd_fs.c +++ b/firmware_p4/components/Service/console/commands/cmd_fs.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "console_service.h" diff --git a/firmware_p4/components/Service/console/commands/cmd_system.c b/firmware_p4/components/Service/console/commands/cmd_system.c index 31127160..cb647a21 100644 --- a/firmware_p4/components/Service/console/commands/cmd_system.c +++ b/firmware_p4/components/Service/console/commands/cmd_system.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "console_service.h" diff --git a/firmware_p4/components/Service/console/commands/cmd_wifi.c b/firmware_p4/components/Service/console/commands/cmd_wifi.c index e5e01560..b17b0e9d 100644 --- a/firmware_p4/components/Service/console/commands/cmd_wifi.c +++ b/firmware_p4/components/Service/console/commands/cmd_wifi.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "console_service.h" diff --git a/firmware_p4/components/Service/console/console_service.c b/firmware_p4/components/Service/console/console_service.c index bb8949c8..8967a990 100644 --- a/firmware_p4/components/Service/console/console_service.c +++ b/firmware_p4/components/Service/console/console_service.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "console_service.h" diff --git a/firmware_p4/components/Service/console/include/console_service.h b/firmware_p4/components/Service/console/include/console_service.h index 699e52c2..a425808a 100644 --- a/firmware_p4/components/Service/console/include/console_service.h +++ b/firmware_p4/components/Service/console/include/console_service.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef CONSOLE_SERVICE_H #define CONSOLE_SERVICE_H diff --git a/firmware_p4/components/Service/font/font.c b/firmware_p4/components/Service/font/font.c index 0e63271d..3e02da48 100644 --- a/firmware_p4/components/Service/font/font.c +++ b/firmware_p4/components/Service/font/font.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "font.h" diff --git a/firmware_p4/components/Service/font/include/font.h b/firmware_p4/components/Service/font/include/font.h index 4fe6b227..f19e9964 100644 --- a/firmware_p4/components/Service/font/include/font.h +++ b/firmware_p4/components/Service/font/include/font.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef FONT_H #define FONT_H diff --git a/firmware_p4/components/Service/icons/icons.c b/firmware_p4/components/Service/icons/icons.c index 0ac48a54..adba79db 100644 --- a/firmware_p4/components/Service/icons/icons.c +++ b/firmware_p4/components/Service/icons/icons.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "icons.h" #include diff --git a/firmware_p4/components/Service/icons/include/icons.h b/firmware_p4/components/Service/icons/include/icons.h index c69650e1..2610e449 100644 --- a/firmware_p4/components/Service/icons/include/icons.h +++ b/firmware_p4/components/Service/icons/include/icons.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef ICONS_H #define ICONS_H diff --git a/firmware_p4/components/Service/ir/include/ir.h b/firmware_p4/components/Service/ir/include/ir.h index aba8650b..4d90931c 100644 --- a/firmware_p4/components/Service/ir/include/ir.h +++ b/firmware_p4/components/Service/ir/include/ir.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef IR_H #define IR_H diff --git a/firmware_p4/components/Service/ir/include/ir_file.h b/firmware_p4/components/Service/ir/include/ir_file.h index e8d357aa..7c670b6d 100644 --- a/firmware_p4/components/Service/ir/include/ir_file.h +++ b/firmware_p4/components/Service/ir/include/ir_file.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef IR_FILE_H #define IR_FILE_H diff --git a/firmware_p4/components/Service/ir/include/ir_protocol.h b/firmware_p4/components/Service/ir/include/ir_protocol.h index 63d8bb0d..a4708430 100644 --- a/firmware_p4/components/Service/ir/include/ir_protocol.h +++ b/firmware_p4/components/Service/ir/include/ir_protocol.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef IR_PROTOCOL_H #define IR_PROTOCOL_H diff --git a/firmware_p4/components/Service/ir/include/ir_protocol_denon.h b/firmware_p4/components/Service/ir/include/ir_protocol_denon.h index 6eccc3f6..93d94ff3 100644 --- a/firmware_p4/components/Service/ir/include/ir_protocol_denon.h +++ b/firmware_p4/components/Service/ir/include/ir_protocol_denon.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef IR_PROTOCOL_DENON_H #define IR_PROTOCOL_DENON_H diff --git a/firmware_p4/components/Service/ir/include/ir_protocol_jvc.h b/firmware_p4/components/Service/ir/include/ir_protocol_jvc.h index f1559a79..27b15fe4 100644 --- a/firmware_p4/components/Service/ir/include/ir_protocol_jvc.h +++ b/firmware_p4/components/Service/ir/include/ir_protocol_jvc.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef IR_PROTOCOL_JVC_H #define IR_PROTOCOL_JVC_H diff --git a/firmware_p4/components/Service/ir/include/ir_protocol_lg.h b/firmware_p4/components/Service/ir/include/ir_protocol_lg.h index af784ee2..7699b96f 100644 --- a/firmware_p4/components/Service/ir/include/ir_protocol_lg.h +++ b/firmware_p4/components/Service/ir/include/ir_protocol_lg.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef IR_PROTOCOL_LG_H #define IR_PROTOCOL_LG_H diff --git a/firmware_p4/components/Service/ir/include/ir_protocol_nec.h b/firmware_p4/components/Service/ir/include/ir_protocol_nec.h index a79d3785..890ab2cd 100644 --- a/firmware_p4/components/Service/ir/include/ir_protocol_nec.h +++ b/firmware_p4/components/Service/ir/include/ir_protocol_nec.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef IR_PROTOCOL_NEC_H #define IR_PROTOCOL_NEC_H diff --git a/firmware_p4/components/Service/ir/include/ir_protocol_panasonic.h b/firmware_p4/components/Service/ir/include/ir_protocol_panasonic.h index 0212475a..8b95d10f 100644 --- a/firmware_p4/components/Service/ir/include/ir_protocol_panasonic.h +++ b/firmware_p4/components/Service/ir/include/ir_protocol_panasonic.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef IR_PROTOCOL_PANASONIC_H #define IR_PROTOCOL_PANASONIC_H diff --git a/firmware_p4/components/Service/ir/include/ir_protocol_rc5.h b/firmware_p4/components/Service/ir/include/ir_protocol_rc5.h index 4d057f78..c040898d 100644 --- a/firmware_p4/components/Service/ir/include/ir_protocol_rc5.h +++ b/firmware_p4/components/Service/ir/include/ir_protocol_rc5.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef IR_PROTOCOL_RC5_H #define IR_PROTOCOL_RC5_H diff --git a/firmware_p4/components/Service/ir/include/ir_protocol_rc6.h b/firmware_p4/components/Service/ir/include/ir_protocol_rc6.h index e5cdfde0..642e505e 100644 --- a/firmware_p4/components/Service/ir/include/ir_protocol_rc6.h +++ b/firmware_p4/components/Service/ir/include/ir_protocol_rc6.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef IR_PROTOCOL_RC6_H #define IR_PROTOCOL_RC6_H diff --git a/firmware_p4/components/Service/ir/include/ir_protocol_samsung.h b/firmware_p4/components/Service/ir/include/ir_protocol_samsung.h index c7e68fd3..f8952e53 100644 --- a/firmware_p4/components/Service/ir/include/ir_protocol_samsung.h +++ b/firmware_p4/components/Service/ir/include/ir_protocol_samsung.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef IR_PROTOCOL_SAMSUNG_H #define IR_PROTOCOL_SAMSUNG_H diff --git a/firmware_p4/components/Service/ir/include/ir_protocol_sony.h b/firmware_p4/components/Service/ir/include/ir_protocol_sony.h index 257bc37b..82c7f2e4 100644 --- a/firmware_p4/components/Service/ir/include/ir_protocol_sony.h +++ b/firmware_p4/components/Service/ir/include/ir_protocol_sony.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef IR_PROTOCOL_SONY_H #define IR_PROTOCOL_SONY_H diff --git a/firmware_p4/components/Service/ir/ir.c b/firmware_p4/components/Service/ir/ir.c index 90730e0a..94ed7a14 100644 --- a/firmware_p4/components/Service/ir/ir.c +++ b/firmware_p4/components/Service/ir/ir.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "ir.h" diff --git a/firmware_p4/components/Service/ir/ir_file.c b/firmware_p4/components/Service/ir/ir_file.c index 60d3e7d5..edc7c9b4 100644 --- a/firmware_p4/components/Service/ir/ir_file.c +++ b/firmware_p4/components/Service/ir/ir_file.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "ir_file.h" diff --git a/firmware_p4/components/Service/ir/ir_protocol.c b/firmware_p4/components/Service/ir/ir_protocol.c index 2f2e9bc9..460fa10c 100644 --- a/firmware_p4/components/Service/ir/ir_protocol.c +++ b/firmware_p4/components/Service/ir/ir_protocol.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "ir_protocol.h" diff --git a/firmware_p4/components/Service/ir/ir_protocol_denon.c b/firmware_p4/components/Service/ir/ir_protocol_denon.c index 8765eeab..d7511144 100644 --- a/firmware_p4/components/Service/ir/ir_protocol_denon.c +++ b/firmware_p4/components/Service/ir/ir_protocol_denon.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "ir_protocol_denon.h" diff --git a/firmware_p4/components/Service/ir/ir_protocol_jvc.c b/firmware_p4/components/Service/ir/ir_protocol_jvc.c index 8983b0b3..4c99300b 100644 --- a/firmware_p4/components/Service/ir/ir_protocol_jvc.c +++ b/firmware_p4/components/Service/ir/ir_protocol_jvc.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "ir_protocol_jvc.h" diff --git a/firmware_p4/components/Service/ir/ir_protocol_lg.c b/firmware_p4/components/Service/ir/ir_protocol_lg.c index 4d676f7b..71e9e644 100644 --- a/firmware_p4/components/Service/ir/ir_protocol_lg.c +++ b/firmware_p4/components/Service/ir/ir_protocol_lg.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "ir_protocol_lg.h" diff --git a/firmware_p4/components/Service/ir/ir_protocol_nec.c b/firmware_p4/components/Service/ir/ir_protocol_nec.c index 18376daf..ccadfdc1 100644 --- a/firmware_p4/components/Service/ir/ir_protocol_nec.c +++ b/firmware_p4/components/Service/ir/ir_protocol_nec.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "ir_protocol_nec.h" diff --git a/firmware_p4/components/Service/ir/ir_protocol_panasonic.c b/firmware_p4/components/Service/ir/ir_protocol_panasonic.c index b95dddc0..6338f312 100644 --- a/firmware_p4/components/Service/ir/ir_protocol_panasonic.c +++ b/firmware_p4/components/Service/ir/ir_protocol_panasonic.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "ir_protocol_panasonic.h" diff --git a/firmware_p4/components/Service/ir/ir_protocol_rc5.c b/firmware_p4/components/Service/ir/ir_protocol_rc5.c index 269a6042..63cfa688 100644 --- a/firmware_p4/components/Service/ir/ir_protocol_rc5.c +++ b/firmware_p4/components/Service/ir/ir_protocol_rc5.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "ir_protocol_rc5.h" diff --git a/firmware_p4/components/Service/ir/ir_protocol_rc6.c b/firmware_p4/components/Service/ir/ir_protocol_rc6.c index 65b6d9df..73f50afc 100644 --- a/firmware_p4/components/Service/ir/ir_protocol_rc6.c +++ b/firmware_p4/components/Service/ir/ir_protocol_rc6.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "ir_protocol_rc6.h" diff --git a/firmware_p4/components/Service/ir/ir_protocol_samsung.c b/firmware_p4/components/Service/ir/ir_protocol_samsung.c index 0f464486..e2c8a147 100644 --- a/firmware_p4/components/Service/ir/ir_protocol_samsung.c +++ b/firmware_p4/components/Service/ir/ir_protocol_samsung.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "ir_protocol_samsung.h" diff --git a/firmware_p4/components/Service/ir/ir_protocol_sony.c b/firmware_p4/components/Service/ir/ir_protocol_sony.c index d23e5015..f1f14337 100644 --- a/firmware_p4/components/Service/ir/ir_protocol_sony.c +++ b/firmware_p4/components/Service/ir/ir_protocol_sony.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "ir_protocol_sony.h" diff --git a/firmware_p4/components/Service/lvgl_port/include/lv_port_disp.h b/firmware_p4/components/Service/lvgl_port/include/lv_port_disp.h index f5539e5b..2a1424a5 100644 --- a/firmware_p4/components/Service/lvgl_port/include/lv_port_disp.h +++ b/firmware_p4/components/Service/lvgl_port/include/lv_port_disp.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef LV_PORT_DISP_H #define LV_PORT_DISP_H diff --git a/firmware_p4/components/Service/lvgl_port/include/lv_port_indev.h b/firmware_p4/components/Service/lvgl_port/include/lv_port_indev.h index 6052bddd..fa27b39a 100644 --- a/firmware_p4/components/Service/lvgl_port/include/lv_port_indev.h +++ b/firmware_p4/components/Service/lvgl_port/include/lv_port_indev.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef LV_PORT_INDEV_H #define LV_PORT_INDEV_H diff --git a/firmware_p4/components/Service/lvgl_port/lv_port_disp.c b/firmware_p4/components/Service/lvgl_port/lv_port_disp.c index eb6aac83..b7ef4689 100644 --- a/firmware_p4/components/Service/lvgl_port/lv_port_disp.c +++ b/firmware_p4/components/Service/lvgl_port/lv_port_disp.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "lv_port_disp.h" @@ -24,7 +25,7 @@ static const char *TAG = "LV_PORT_DISP"; -#define LVGL_BUF_LINES (LCD_V_RES / 5) +#define LVGL_BUF_LINES (LCD_V_RES / 2) #define LVGL_BUF_PIXELS (LCD_H_RES * LVGL_BUF_LINES) #define LVGL_BUF_ALLOC (MALLOC_CAP_DMA | MALLOC_CAP_INTERNAL) diff --git a/firmware_p4/components/Service/lvgl_port/lv_port_indev.c b/firmware_p4/components/Service/lvgl_port/lv_port_indev.c index faf66936..12d95d1d 100644 --- a/firmware_p4/components/Service/lvgl_port/lv_port_indev.c +++ b/firmware_p4/components/Service/lvgl_port/lv_port_indev.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "lv_port_indev.h" diff --git a/firmware_p4/components/Service/ota/include/ota_service.h b/firmware_p4/components/Service/ota/include/ota_service.h index 7a03814f..003d32d0 100644 --- a/firmware_p4/components/Service/ota/include/ota_service.h +++ b/firmware_p4/components/Service/ota/include/ota_service.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef OTA_SERVICE_H #define OTA_SERVICE_H diff --git a/firmware_p4/components/Service/ota/include/ota_version.h b/firmware_p4/components/Service/ota/include/ota_version.h index b8f2e8f5..7d0ad3d1 100644 --- a/firmware_p4/components/Service/ota/include/ota_version.h +++ b/firmware_p4/components/Service/ota/include/ota_version.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef OTA_VERSION_H #define OTA_VERSION_H diff --git a/firmware_p4/components/Service/ota/ota_service.c b/firmware_p4/components/Service/ota/ota_service.c index 352e3a3a..afb99e92 100644 --- a/firmware_p4/components/Service/ota/ota_service.c +++ b/firmware_p4/components/Service/ota/ota_service.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "ota_service.h" diff --git a/firmware_p4/components/Service/sd_card/include/sd_card_dir.h b/firmware_p4/components/Service/sd_card/include/sd_card_dir.h index 1107db72..299fb6ce 100644 --- a/firmware_p4/components/Service/sd_card/include/sd_card_dir.h +++ b/firmware_p4/components/Service/sd_card/include/sd_card_dir.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file sd_card_dir.h diff --git a/firmware_p4/components/Service/sd_card/include/sd_card_init.h b/firmware_p4/components/Service/sd_card/include/sd_card_init.h index 3fa7b0b5..a05abdd1 100644 --- a/firmware_p4/components/Service/sd_card/include/sd_card_init.h +++ b/firmware_p4/components/Service/sd_card/include/sd_card_init.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file sd_card_init.h diff --git a/firmware_p4/components/Service/sd_card/sd_card_dir.c b/firmware_p4/components/Service/sd_card/sd_card_dir.c index bea7032a..6db01801 100644 --- a/firmware_p4/components/Service/sd_card/sd_card_dir.c +++ b/firmware_p4/components/Service/sd_card/sd_card_dir.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "sd_card_dir.h" #include "sd_card_init.h" diff --git a/firmware_p4/components/Service/sd_card/sd_card_file.c b/firmware_p4/components/Service/sd_card/sd_card_file.c index 26cc1aaa..869e227c 100644 --- a/firmware_p4/components/Service/sd_card/sd_card_file.c +++ b/firmware_p4/components/Service/sd_card/sd_card_file.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "sd_card_file.h" #include "sd_card_init.h" diff --git a/firmware_p4/components/Service/sd_card/sd_card_info.c b/firmware_p4/components/Service/sd_card/sd_card_info.c index 3bff4d83..bc58c1ba 100644 --- a/firmware_p4/components/Service/sd_card/sd_card_info.c +++ b/firmware_p4/components/Service/sd_card/sd_card_info.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "sd_card_info.h" #include "sd_card_init.h" diff --git a/firmware_p4/components/Service/sd_card/sd_card_init.c b/firmware_p4/components/Service/sd_card/sd_card_init.c index 1bf2205f..406aa5bb 100644 --- a/firmware_p4/components/Service/sd_card/sd_card_init.c +++ b/firmware_p4/components/Service/sd_card/sd_card_init.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "sd_card_init.h" #include "pin_def.h" diff --git a/firmware_p4/components/Service/sd_card/sd_card_read.c b/firmware_p4/components/Service/sd_card/sd_card_read.c index 784654db..7e2b7523 100644 --- a/firmware_p4/components/Service/sd_card/sd_card_read.c +++ b/firmware_p4/components/Service/sd_card/sd_card_read.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "sd_card_read.h" #include "sd_card_init.h" diff --git a/firmware_p4/components/Service/sd_card/sd_card_write.c b/firmware_p4/components/Service/sd_card/sd_card_write.c index 150917cb..ab1d4f3b 100644 --- a/firmware_p4/components/Service/sd_card/sd_card_write.c +++ b/firmware_p4/components/Service/sd_card/sd_card_write.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "sd_card_write.h" #include "sd_card_init.h" diff --git a/firmware_p4/components/Service/spi_bridge/README.md b/firmware_p4/components/Service/spi_bridge/README.md index 31a9c0ac..cb327f61 100644 --- a/firmware_p4/components/Service/spi_bridge/README.md +++ b/firmware_p4/components/Service/spi_bridge/README.md @@ -36,6 +36,185 @@ To add a new feature (e.g., "GPS Get Location"): - Use `spi_bridge_send_command(SPI_ID_GPS_GET, ...)` to trigger the action. - Use the generic `SPI_ID_SYSTEM_DATA` to pull results if necessary. +## Session Lifecycle (Long-Running Operations) + +For operations that run for an extended period (sniffers, monitors, attacks +that emit a stream of events), the basic request-response model is unsafe: +if the master dies or stops listening, the slave keeps running indefinitely +and sends data into the void. The session protocol fixes this with three +mechanisms working together: + +### 1. Session ID +Every long-running operation is tagged with a 32-bit `session_id` chosen +randomly by the C5 when the operation starts. Both sides track the active +session; stream packets carry the id so stale data can be discarded after +a restart. + +### 2. Heartbeat (anti-zombie) +The P4 sends `SPI_ID_SESSION_HEARTBEAT { session_id, last_acked_seq }` +every **2 seconds** while a session is active. The C5 has a watchdog task +that runs every second and kills any session whose last heartbeat is older +than **5 seconds**. When killed, the C5 emits `SPI_ID_SESSION_LOST` as a +stream so the master can react (e.g., restart, show error UI). + +If the master detects 3 consecutive heartbeat failures, it assumes the +session is gone and fires its local `on_lost` callback. + +### 3. Backpressure window +Stream packets carry `{ session_id, seq }`. The master accumulates +`last_acked_seq` and reports it via heartbeat. The C5 refuses to emit if +`seq - last_acked_seq >= SPI_SESSION_WINDOW (64)` — protects against +buffer overflow when the slave produces faster than the master drains. +Drops are counted and logged. + +### Wire shapes + +| Direction | When | Packet | +|-----------|------|--------| +| P4 → C5 | START | `op_id` + op-specific params | +| C5 → P4 | START reply | status byte + `spi_session_resp_t { session_id }` | +| P4 → C5 | every 2s | `SPI_ID_SESSION_HEARTBEAT` + `spi_heartbeat_req_t` | +| C5 → P4 | heartbeat reply | status + `spi_heartbeat_resp_t { alive }` | +| C5 → P4 | data | `op_id` STREAM + `spi_stream_meta_t { session_id, seq }` + payload | +| P4 → C5 | STOP | `SPI_ID_SESSION_STOP` + `spi_session_stop_req_t { session_id }` | +| C5 → P4 | watchdog kill | `SPI_ID_SESSION_LOST` STREAM + `spi_session_lost_t { session_id, op_id }` | + +### Master API + +```c +// Start a long-running operation. Spawns heartbeat task internally. +uint32_t spi_session_start(spi_id_t op_id, + const uint8_t *params, uint8_t params_len, + spi_session_stream_cb_t on_stream, // peeled meta + spi_session_lost_cb_t on_lost); + +// Clean teardown. Kills heartbeat, sends STOP. +esp_err_t spi_session_stop(uint32_t session_id); +``` + +Returns `SPI_SESSION_INVALID_ID` (0) on START failure. The `on_stream` +callback receives the **operation payload only** — the meta header is +stripped and ack tracking is invisible to the consumer. + +### Slave API (C5) + +```c +// Open a session for the op_id. Closes any prior session first. +uint32_t session_manager_start(spi_id_t op_id, session_kill_cb_t kill_cb); + +// Emit a stream packet (prefixes meta, applies backpressure). +esp_err_t session_manager_try_emit(uint32_t session_id, + const uint8_t *data, uint8_t len); +``` + +The op implementation stores the returned `session_id` and uses it for +every emit. The `kill_cb` is invoked by the watchdog if heartbeats stop — +the op should call its own `_stop()` from there. + +### Migrating a New Operation (recipe) + +There are two patterns depending on whether the op emits streams. Both +are used in the codebase — see `wifi_sniffer` (streaming) and +`wifi_deauther` (non-streaming) as references. + +#### Pattern A — Non-streaming op (deauther, flood, evil_twin, …) + +The op runs in background but does NOT emit packets to the master. The +master polls for results via `SPI_ID_SYSTEM_DATA` if it needs data. + +**C5 side (only the dispatcher changes — op .c/.h untouched):** +```c +// In wifi_dispatcher.c (or bt_dispatcher.c): +static void killed_my_op(spi_id_t id) { (void)id; my_op_stop(); } + +case SPI_ID_MY_OP: + if (!my_op_start(...)) return SPI_STATUS_ERROR; + return open_session(SPI_ID_MY_OP, killed_my_op, + out_resp_payload, out_resp_len, my_op_stop); +``` + +**P4 side (wrapper):** +```c +static uint32_t s_session_id = SPI_SESSION_INVALID_ID; + +bool my_op_start(...) { + s_session_id = spi_session_start(SPI_ID_MY_OP, params, len, NULL, NULL); + return s_session_id != SPI_SESSION_INVALID_ID; +} + +void my_op_stop(void) { + if (s_session_id != SPI_SESSION_INVALID_ID) { + spi_session_stop(s_session_id); + s_session_id = SPI_SESSION_INVALID_ID; + } +} +``` + +#### Pattern B — Streaming op (sniffer, ble_sniffer, …) + +The op emits a continuous stream of packets to the master. + +**C5 side:** +1. Add `static uint32_t s_session_id = SPI_SESSION_INVALID_ID;` to the + op's `.c`. +2. Add public `_bind_session(uint32_t)` setter and + `_session_killed(spi_id_t)` kill callback (the latter calls `_stop()`). +3. Replace `spi_bridge_stream_push(SPI_ID_OP, data, len)` with + `session_manager_try_emit(s_session_id, data, len)`. +4. In the dispatcher, replace the START handler with: call + `op_start(...)`, then `session_manager_start(SPI_ID_OP, op_session_killed)`, + then `op_bind_session(sid)`, then return + `spi_session_resp_t { sid }` as response payload. + +**P4 side:** +1. Replace `spi_bridge_send_command(SPI_ID_OP, …)` + + `spi_bridge_register_stream_cb(SPI_ID_OP, raw_cb)` with a single + `spi_session_start(SPI_ID_OP, params, …, on_stream, on_lost)`. +2. Store the returned `session_id`. +3. Change STOP to `spi_session_stop(session_id)`. +4. The `on_stream` callback signature is + `void(const uint8_t *payload, uint8_t len)` — the meta header is + already stripped. + +### Tunables +Defined in `session_manager.c` (slave) and `spi_session.c` (master): +- `SESSION_TIMEOUT_MS` = 5000 — slave watchdog timeout +- `WATCHDOG_PERIOD_MS` = 1000 — slave watchdog tick +- `HEARTBEAT_INTERVAL_MS` = 2000 — master ping period +- `HEARTBEAT_FAIL_LIMIT` = 3 — master fails before declaring lost +- `SPI_SESSION_WINDOW` = 64 — backpressure window (in `spi_protocol.h`) + +### Migrated operations + +All long-running ops now use the session lifecycle. Each one: +- Returns `spi_session_resp_t { session_id }` on START. +- Has a kill_cb registered with the session manager that calls its `_stop()`. +- Is closed by the master via `SPI_ID_SESSION_STOP { session_id }` (sent + internally by `spi_session_stop`). +- Is auto-killed by the C5 watchdog if the master stops sending heartbeats + for 5s (master crash, screen freeze, etc.). + +| Op | C5 module | P4 wrapper | Streams? | +|----|-----------|-----------|----------| +| `WIFI_APP_SNIFFER` | wifi_sniffer.c | wifi_sniffer.c | ✓ stream | +| `BT_APP_SNIFFER` | ble_sniffer.c | bluetooth_service.c | ✓ stream | +| `WIFI_APP_DEAUTHER` | wifi_deauther.c | wifi_deauther.c | – | +| `WIFI_APP_FLOOD` | wifi_flood.c | wifi_flood.c | – | +| `WIFI_APP_EVIL_TWIN` | evil_twin.c | evil_twin.c | – | +| `WIFI_APP_BEACON_SPAM` | beacon_spam.c | beacon_spam.c | – | +| `WIFI_APP_DEAUTH_DET` | deauther_detector.c | deauther_detector.c | – | +| `WIFI_APP_PROBE_MON` | probe_monitor.c | probe_monitor.c | – | +| `WIFI_APP_SIGNAL_MON` | signal_monitor.c | signal_monitor.c | – | +| `BT_APP_FLOOD` | ble_connect_flood.c | ble_connect_flood.c | – | +| `BT_APP_SKIMMER` | skimmer_detector.c | skimmer_detector.c | – | +| `BT_APP_TRACKER` | tracker_detector.c | tracker_detector.c | – | +| `BT_APP_SPAM` | (handler pending) | canned_spam.c | – | +| `BT_APP_FLOOD` (L2CAP variant) | ble_connect_flood.c | ble_l2cap_flood.c | – | + +The legacy `SPI_ID_WIFI_APP_ATTACK_STOP` and `SPI_ID_BT_APP_STOP` shotgun +commands have been removed entirely. Every op now stops via its own +session via `SPI_ID_SESSION_STOP { session_id }`. + ## Hardware Hookup | Signal | P4 Pin | C5 Pin | |--------|--------|--------| diff --git a/firmware_p4/components/Service/spi_bridge/include/spi_bridge.h b/firmware_p4/components/Service/spi_bridge/include/spi_bridge.h index 840b7207..62c483fd 100644 --- a/firmware_p4/components/Service/spi_bridge/include/spi_bridge.h +++ b/firmware_p4/components/Service/spi_bridge/include/spi_bridge.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef SPI_BRIDGE_H #define SPI_BRIDGE_H @@ -19,6 +20,7 @@ extern "C" { #endif +#include #include #include "esp_err.h" @@ -43,6 +45,28 @@ typedef void (*spi_stream_cb_t)(spi_id_t id, const uint8_t *payload, uint8_t len */ esp_err_t spi_bridge_master_init(void); +/** + * @brief Return the timeout (ms) for a given SPI command ID. + * + * Returns SPI_TIMEOUT_DEFAULT_MS unless the command is in the override + * table (e.g. WiFi commands which need more time). + * + * @param id SPI command identifier. + * @return Timeout in milliseconds. + */ +uint32_t spi_bridge_get_timeout(spi_id_t id); + +/** + * @brief Mark the bridge as alive or dead. + * + * When dead, spi_bridge_send_command returns ESP_ERR_INVALID_STATE + * immediately without attempting transmission. Used to silence the + * polling spam when the C5 SPI bridge is not connected/responding. + * + * @param alive true if the C5 is responding, false otherwise. + */ +void spi_bridge_set_alive(bool alive); + /** * @brief Send a command to the SPI slave and receive the response. * diff --git a/firmware_p4/components/Service/spi_bridge/include/spi_protocol.h b/firmware_p4/components/Service/spi_bridge/include/spi_protocol.h index 62731dcd..9895fa92 100644 --- a/firmware_p4/components/Service/spi_bridge/include/spi_protocol.h +++ b/firmware_p4/components/Service/spi_bridge/include/spi_protocol.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef SPI_PROTOCOL_H #define SPI_PROTOCOL_H @@ -80,7 +81,6 @@ typedef enum { SPI_ID_WIFI_APP_DEAUTH_DET = 0x27, SPI_ID_WIFI_APP_PROBE_MON = 0x28, SPI_ID_WIFI_APP_SIGNAL_MON = 0x29, - SPI_ID_WIFI_APP_ATTACK_STOP = 0x2A, SPI_ID_WIFI_SNIFFER_SET_SNAPLEN = 0x2B, SPI_ID_WIFI_SNIFFER_SET_VERBOSE = 0x2C, SPI_ID_WIFI_SNIFFER_SAVE_FLASH = 0x2D, @@ -147,7 +147,6 @@ typedef enum { SPI_ID_BT_APP_SKIMMER = 0x64, SPI_ID_BT_APP_TRACKER = 0x65, SPI_ID_BT_APP_GATT_EXP = 0x66, - SPI_ID_BT_APP_STOP = 0x67, SPI_ID_BT_SPAM_LIST_LOAD = 0x68, SPI_ID_BT_SPAM_LIST_BEGIN = 0x69, SPI_ID_BT_SPAM_LIST_ITEM = 0x6A, @@ -164,7 +163,29 @@ typedef enum { // LoRa (0x80 - 0x8F) SPI_ID_LORA_RX = 0x80, - SPI_ID_LORA_TX = 0x81 + SPI_ID_LORA_TX = 0x81, + + // Meshtastic phone bridge (0x90 - 0x97) + SPI_ID_MESH_BLE_INIT = 0x90, + SPI_ID_MESH_BLE_STOP = 0x91, + SPI_ID_MESH_WIFI_INIT = 0x92, + SPI_ID_MESH_WIFI_STOP = 0x93, + SPI_ID_MESH_FROMRADIO_PUSH = 0x94, + SPI_ID_MESH_LOG_PUSH = 0x95, + SPI_ID_MESH_STATUS = 0x96, + SPI_ID_MESH_TORADIO_STREAM = 0x97, + + // MeshCore phone bridge (0x98 - 0x9C) + SPI_ID_MCORE_BLE_INIT = 0x98, + SPI_ID_MCORE_BLE_STOP = 0x99, + SPI_ID_MCORE_TX_PUSH = 0x9A, + SPI_ID_MCORE_RX_STREAM = 0x9B, + SPI_ID_MCORE_STATUS = 0x9C, + + // Session lifecycle (long-running operations) + SPI_ID_SESSION_HEARTBEAT = 0xF0, + SPI_ID_SESSION_LOST = 0xF1, + SPI_ID_SESSION_STOP = 0xF2 } spi_id_t; /** @@ -188,6 +209,44 @@ typedef struct { uint8_t length; // Payload length } spi_header_t; +// Session protocol — see spi_bridge/README.md "Session Lifecycle" +#define SPI_SESSION_INVALID_ID 0u +#define SPI_SESSION_WINDOW 64u + +/** Sent by C5 as response payload to a long-running START command. + * Valid only if the SPI response status byte is SPI_STATUS_OK. */ +typedef struct __attribute__((packed)) { + uint32_t session_id; +} spi_session_resp_t; + +/** Sent by P4 every ~2s to keep a session alive and ack streams received. */ +typedef struct __attribute__((packed)) { + uint32_t session_id; + uint32_t last_acked_seq; // highest stream seq P4 has processed +} spi_heartbeat_req_t; + +/** C5 reply to heartbeat. */ +typedef struct __attribute__((packed)) { + uint8_t alive; // 1 if session still active, 0 if not found / different op +} spi_heartbeat_resp_t; + +/** Prefixed to every stream payload from a session-managed operation. */ +typedef struct __attribute__((packed)) { + uint32_t session_id; + uint32_t seq; +} spi_stream_meta_t; + +/** Sent by P4 in payload of long-running STOP commands. */ +typedef struct __attribute__((packed)) { + uint32_t session_id; +} spi_session_stop_req_t; + +/** Stream emitted by C5 when a session is auto-killed by the watchdog. */ +typedef struct __attribute__((packed)) { + uint32_t session_id; + uint8_t op_id; // spi_id_t of the lost operation +} spi_session_lost_t; + #define SPI_FRAME_SIZE (sizeof(spi_header_t) + SPI_MAX_PAYLOAD) /** @@ -330,6 +389,68 @@ typedef struct { char banner[64]; } __attribute__((packed)) spi_port_scan_result_t; +/** + * @brief Meshtastic transport init payload. + * + * Sent with SPI_ID_MESH_BLE_INIT and SPI_ID_MESH_WIFI_INIT. + */ +typedef struct { + uint32_t node_num; +} __attribute__((packed)) spi_mesh_init_t; + +/** + * @brief Chunk header for fragmented Meshtastic transport frames. + * + * Each StreamAPI protobuf frame is split into 1..255 chunks of up to + * SPI_MESH_CHUNK_PAYLOAD_MAX bytes. Receivers reassemble per seq. + */ +typedef struct { + uint8_t seq; + uint8_t chunk_idx; + uint8_t total_chunks; + uint8_t flags; +} __attribute__((packed)) spi_mesh_chunk_hdr_t; + +#define SPI_MESH_CHUNK_FLAG_LAST 0x01 +#define SPI_MESH_PAYLOAD_LIMIT 255 +#define SPI_MESH_CHUNK_PAYLOAD_MAX (SPI_MESH_PAYLOAD_LIMIT - sizeof(spi_mesh_chunk_hdr_t)) + +/** + * @brief Meshtastic transport status payload. + * + * Returned by SPI_ID_MESH_STATUS. + */ +typedef struct { + uint8_t ble_connected; + uint8_t ble_subscribed; + uint8_t tcp_clients; + uint8_t logradio_subscribed; + uint32_t fromnum_counter; +} __attribute__((packed)) spi_mesh_status_t; + +/** + * @brief MeshCore BLE init payload. + * + * Sent with SPI_ID_MCORE_BLE_INIT. The C5 builds the advertised name as + * "-XXXX" (last 4 hex of MAC) and uses `pin` as the static + * passkey for SC + MITM + DISP_ONLY pairing. + */ +typedef struct { + char name_prefix[16]; + uint32_t pin; +} __attribute__((packed)) spi_mcore_init_t; + +/** + * @brief MeshCore transport status payload. + * + * Returned by SPI_ID_MCORE_STATUS. + */ +typedef struct { + uint8_t ble_connected; + uint8_t ble_subscribed; + uint8_t reserved[2]; +} __attribute__((packed)) spi_mcore_status_t; + #ifdef __cplusplus } #endif diff --git a/firmware_p4/components/Service/spi_bridge/include/spi_session.h b/firmware_p4/components/Service/spi_bridge/include/spi_session.h new file mode 100644 index 00000000..afffede8 --- /dev/null +++ b/firmware_p4/components/Service/spi_bridge/include/spi_session.h @@ -0,0 +1,104 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +/** + * @file spi_session.h + * @brief Master-side session lifecycle for long-running C5 operations. + * + * Wraps the SPI bridge with session-based reliability: + * - START handshake returns a session_id from the slave. + * - Per-session heartbeat task pings the slave every 2s; if the slave + * stops acknowledging, the local on_lost callback fires. + * - Stream packets carry session_id + seq; the wrapper drops stale + * packets and counts received seq for backpressure ack. + * + * Migration from raw bridge calls: + * spi_bridge_send_command(SPI_ID_WIFI_APP_X, params, ...) + * + spi_bridge_register_stream_cb(SPI_ID_WIFI_APP_X, cb) + * becomes: + * spi_session_start(SPI_ID_WIFI_APP_X, params, ..., cb, on_lost) + * + * See spi_bridge/README.md "Session Lifecycle" for the full design. + */ + +#ifndef SPI_SESSION_H +#define SPI_SESSION_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +#include "esp_err.h" + +#include "spi_protocol.h" + +/** Stream payload callback (meta header is stripped before invocation). */ +typedef void (*spi_session_stream_cb_t)(const uint8_t *data, uint8_t len); + +/** Invoked when the C5 stops acknowledging this session (heartbeat fail or LOST stream). */ +typedef void (*spi_session_lost_cb_t)(uint32_t session_id, spi_id_t op_id); + +/** + * @brief Initialize the session client. Must be called once at boot. + * + * Registers the SPI_ID_SESSION_LOST stream listener. + */ +void spi_session_init(void); + +/** + * @brief Start a long-running operation with full session lifecycle. + * + * Sends @p op_id with @p params as command payload, expects an + * spi_session_resp_t reply, then spawns a heartbeat task and registers + * a stream listener at @p op_id that strips meta and forwards to + * @p on_stream. + * + * @param op_id SPI command identifier of the operation. + * @param params Optional command params (may be NULL). + * @param params_len Length of @p params (0 if NULL). + * @param on_stream Callback for stream payloads (called from bridge task). + * @param on_lost Callback if session dies (heartbeat timeout / LOST stream). + * @return Session id on success, SPI_SESSION_INVALID_ID on failure. + */ +uint32_t spi_session_start(spi_id_t op_id, + const uint8_t *params, + uint8_t params_len, + spi_session_stream_cb_t on_stream, + spi_session_lost_cb_t on_lost); + +/** + * @brief Cleanly stop an active session. + * + * Sends a STOP command (with @p op_id) carrying the session_id, kills + * the heartbeat task and unregisters the stream listener. + * + * @param session_id Session to stop. + * @return ESP_OK on success, ESP_ERR_NOT_FOUND if session doesn't match. + */ +esp_err_t spi_session_stop(uint32_t session_id); + +/** + * @brief Check whether a given session is currently active locally. + */ +bool spi_session_is_active(uint32_t session_id); + +#ifdef __cplusplus +} +#endif + +#endif // SPI_SESSION_H diff --git a/firmware_p4/components/Service/spi_bridge/include/spi_timeouts.h b/firmware_p4/components/Service/spi_bridge/include/spi_timeouts.h new file mode 100644 index 00000000..93920e12 --- /dev/null +++ b/firmware_p4/components/Service/spi_bridge/include/spi_timeouts.h @@ -0,0 +1,39 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +/** + * @file spi_timeouts.h + * @brief Per-command timeouts for the P4–C5 SPI bridge. + * + * Used by spi_bridge_get_timeout() to pick the right timeout based + * on the command ID. Add a new constant + a case in the lookup when + * a command needs a different timeout than the default. + */ + +#ifndef SPI_TIMEOUTS_H +#define SPI_TIMEOUTS_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define SPI_TIMEOUT_DEFAULT_MS 1000 +#define SPI_TIMEOUT_WIFI_MS 20000 + +#ifdef __cplusplus +} +#endif + +#endif // SPI_TIMEOUTS_H diff --git a/firmware_p4/components/Service/spi_bridge/spi_bridge.c b/firmware_p4/components/Service/spi_bridge/spi_bridge.c index 92ab10e3..70d6e5cf 100644 --- a/firmware_p4/components/Service/spi_bridge/spi_bridge.c +++ b/firmware_p4/components/Service/spi_bridge/spi_bridge.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "spi_bridge.h" @@ -22,26 +23,34 @@ #include "freertos/task.h" #include "spi_bridge_phy.h" +#include "spi_timeouts.h" static const char *TAG = "SPI_BRIDGE_P4"; -#define SPI_STREAM_TASK_STACK 4096 +#define SPI_STREAM_TASK_STACK 16384 #define SPI_STREAM_TASK_PRIO 5 #define SPI_MUTEX_TIMEOUT_MS 50 #define SPI_STREAM_POLL_MS 10 #define SPI_STREAM_IDLE_MS 20 #define SPI_STREAM_YIELD_MS 1 #define SPI_IRQ_WAIT_MS 100 +#define SPI_STREAM_CB_SLOTS 4 + +typedef struct { + spi_id_t id; + spi_stream_cb_t cb; +} stream_cb_slot_t; static SemaphoreHandle_t s_spi_mutex = NULL; static TaskHandle_t s_stream_task_handle = NULL; static volatile bool s_is_command_in_flight = false; -static spi_stream_cb_t s_stream_cb_wifi = NULL; -static spi_stream_cb_t s_stream_cb_bt = NULL; +static volatile bool s_bridge_alive = true; +static stream_cb_slot_t s_stream_cbs[SPI_STREAM_CB_SLOTS] = {0}; static void stream_task(void *arg); static esp_err_t fetch_stream(spi_header_t *out_header, uint8_t *out_payload, uint8_t *out_len); static spi_stream_cb_t get_stream_cb(spi_id_t id); +static bool has_any_stream_cb(void); static esp_err_t status_to_err(spi_status_t status) { switch (status) { @@ -69,12 +78,29 @@ esp_err_t spi_bridge_master_init(void) { } void spi_bridge_register_stream_cb(spi_id_t id, spi_stream_cb_t cb) { - if (id == SPI_ID_WIFI_APP_SNIFFER) - s_stream_cb_wifi = cb; - if (id == SPI_ID_BT_APP_SNIFFER) - s_stream_cb_bt = cb; + if (cb == NULL) { + spi_bridge_unregister_stream_cb(id); + return; + } + + int free_slot = -1; + for (int i = 0; i < SPI_STREAM_CB_SLOTS; i++) { + if (s_stream_cbs[i].cb != NULL && s_stream_cbs[i].id == id) { + s_stream_cbs[i].cb = cb; + return; + } + if (s_stream_cbs[i].cb == NULL && free_slot < 0) { + free_slot = i; + } + } + if (free_slot < 0) { + ESP_LOGE(TAG, "No free stream cb slot for id 0x%02X", id); + return; + } + s_stream_cbs[free_slot].id = id; + s_stream_cbs[free_slot].cb = cb; - if ((s_stream_cb_wifi != NULL || s_stream_cb_bt != NULL) && s_stream_task_handle == NULL) { + if (s_stream_task_handle == NULL) { if (s_spi_mutex == NULL) { s_spi_mutex = xSemaphoreCreateMutex(); } @@ -92,10 +118,24 @@ void spi_bridge_register_stream_cb(spi_id_t id, spi_stream_cb_t cb) { } void spi_bridge_unregister_stream_cb(spi_id_t id) { - if (id == SPI_ID_WIFI_APP_SNIFFER) - s_stream_cb_wifi = NULL; - if (id == SPI_ID_BT_APP_SNIFFER) - s_stream_cb_bt = NULL; + for (int i = 0; i < SPI_STREAM_CB_SLOTS; i++) { + if (s_stream_cbs[i].cb != NULL && s_stream_cbs[i].id == id) { + s_stream_cbs[i].cb = NULL; + s_stream_cbs[i].id = 0; + return; + } + } +} + +void spi_bridge_set_alive(bool alive) { + s_bridge_alive = alive; +} + +uint32_t spi_bridge_get_timeout(spi_id_t id) { + if (id >= SPI_ID_WIFI_SCAN && id <= SPI_ID_WIFI_APP_PROBE_MON) { + return SPI_TIMEOUT_WIFI_MS; + } + return SPI_TIMEOUT_DEFAULT_MS; } esp_err_t spi_bridge_send_command(spi_id_t id, @@ -104,6 +144,9 @@ esp_err_t spi_bridge_send_command(spi_id_t id, spi_header_t *out_header, uint8_t *out_payload, uint32_t timeout_ms) { + if (!s_bridge_alive) { + return ESP_ERR_INVALID_STATE; + } if (s_spi_mutex == NULL) { s_spi_mutex = xSemaphoreCreateMutex(); } @@ -204,13 +247,23 @@ esp_err_t spi_bridge_send_command(spi_id_t id, // Static functions static spi_stream_cb_t get_stream_cb(spi_id_t id) { - if (id == SPI_ID_WIFI_APP_SNIFFER) - return s_stream_cb_wifi; - if (id == SPI_ID_BT_APP_SNIFFER) - return s_stream_cb_bt; + for (int i = 0; i < SPI_STREAM_CB_SLOTS; i++) { + if (s_stream_cbs[i].cb != NULL && s_stream_cbs[i].id == id) { + return s_stream_cbs[i].cb; + } + } return NULL; } +static bool has_any_stream_cb(void) { + for (int i = 0; i < SPI_STREAM_CB_SLOTS; i++) { + if (s_stream_cbs[i].cb != NULL) { + return true; + } + } + return false; +} + static esp_err_t fetch_stream(spi_header_t *out_header, uint8_t *out_payload, uint8_t *out_len) { spi_header_t header = { .sync = SPI_SYNC_BYTE, .type = SPI_TYPE_CMD, .id = SPI_ID_SYSTEM_STREAM, .length = 0}; @@ -262,7 +315,7 @@ static void stream_task(void *arg) { spi_header_t header; while (1) { - if (s_stream_cb_wifi == NULL && s_stream_cb_bt == NULL) { + if (!has_any_stream_cb()) { s_stream_task_handle = NULL; vTaskDelete(NULL); return; diff --git a/firmware_p4/components/Service/spi_bridge/spi_session.c b/firmware_p4/components/Service/spi_bridge/spi_session.c new file mode 100644 index 00000000..75698591 --- /dev/null +++ b/firmware_p4/components/Service/spi_bridge/spi_session.c @@ -0,0 +1,258 @@ +// Copyright (c) 2025 HIGH CODE LLC +// +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . + +#include "spi_session.h" + +#include + +#include "esp_log.h" +#include "freertos/FreeRTOS.h" +#include "freertos/semphr.h" +#include "freertos/task.h" + +#include "spi_bridge.h" +#include "spi_timeouts.h" + +static const char *TAG = "SPI_SESSION"; + +#define HEARTBEAT_INTERVAL_MS 2000 +#define HEARTBEAT_FAIL_LIMIT 3 +#define HEARTBEAT_TIMEOUT_MS 1000 +#define HEARTBEAT_STACK_SIZE 3072 +#define HEARTBEAT_PRIO 5 + +typedef struct { + uint32_t session_id; + spi_id_t op_id; + uint32_t last_acked_seq; + spi_session_stream_cb_t on_stream; + spi_session_lost_cb_t on_lost; + TaskHandle_t heartbeat_task; + bool stop_requested; +} session_state_t; + +static session_state_t s_state = {0}; +static SemaphoreHandle_t s_mutex = NULL; +static bool s_initialized = false; + +static void notify_lost_locked(const char *reason) { + if (s_state.session_id == SPI_SESSION_INVALID_ID) + return; + + ESP_LOGW(TAG, + "Session 0x%08lx (op 0x%02X) lost: %s", + (unsigned long)s_state.session_id, + s_state.op_id, + reason); + + uint32_t lost_id = s_state.session_id; + spi_id_t lost_op = s_state.op_id; + spi_session_lost_cb_t cb = s_state.on_lost; + spi_id_t stream_id = s_state.op_id; + + spi_bridge_unregister_stream_cb(stream_id); + memset(&s_state, 0, sizeof(s_state)); + + if (cb != NULL) + cb(lost_id, lost_op); +} + +static void on_session_stream(spi_id_t id, const uint8_t *payload, uint8_t len) { + (void)id; + if (len < sizeof(spi_stream_meta_t)) + return; + + spi_stream_meta_t meta; + memcpy(&meta, payload, sizeof(meta)); + + xSemaphoreTake(s_mutex, portMAX_DELAY); + if (s_state.session_id == SPI_SESSION_INVALID_ID || meta.session_id != s_state.session_id) { + xSemaphoreGive(s_mutex); + return; // stale or alien stream — drop silently + } + if (meta.seq > s_state.last_acked_seq) { + s_state.last_acked_seq = meta.seq; + } + spi_session_stream_cb_t cb = s_state.on_stream; + xSemaphoreGive(s_mutex); + + if (cb != NULL) { + cb(payload + sizeof(meta), (uint8_t)(len - sizeof(meta))); + } +} + +static void on_session_lost_stream(spi_id_t id, const uint8_t *payload, uint8_t len) { + (void)id; + if (len < sizeof(spi_session_lost_t)) + return; + + spi_session_lost_t lost; + memcpy(&lost, payload, sizeof(lost)); + + xSemaphoreTake(s_mutex, portMAX_DELAY); + if (lost.session_id == s_state.session_id && s_state.session_id != SPI_SESSION_INVALID_ID) { + notify_lost_locked("slave watchdog"); + } + xSemaphoreGive(s_mutex); +} + +static void heartbeat_task(void *arg) { + uint32_t session_id = (uint32_t)(uintptr_t)arg; + uint8_t consecutive_fails = 0; + + while (1) { + vTaskDelay(pdMS_TO_TICKS(HEARTBEAT_INTERVAL_MS)); + + xSemaphoreTake(s_mutex, portMAX_DELAY); + bool still_mine = (s_state.session_id == session_id) && !s_state.stop_requested; + spi_heartbeat_req_t req = {.session_id = session_id, .last_acked_seq = s_state.last_acked_seq}; + xSemaphoreGive(s_mutex); + if (!still_mine) + break; + + spi_header_t resp_header = {0}; + spi_heartbeat_resp_t resp = {0}; + esp_err_t ret = spi_bridge_send_command(SPI_ID_SESSION_HEARTBEAT, + (uint8_t *)&req, + sizeof(req), + &resp_header, + (uint8_t *)&resp, + HEARTBEAT_TIMEOUT_MS); + bool ok = (ret == ESP_OK) && (resp.alive != 0); + if (ok) { + consecutive_fails = 0; + continue; + } + + consecutive_fails++; + ESP_LOGW(TAG, + "Heartbeat fail %u/%d for session 0x%08lx", + consecutive_fails, + HEARTBEAT_FAIL_LIMIT, + (unsigned long)session_id); + if (consecutive_fails >= HEARTBEAT_FAIL_LIMIT) { + xSemaphoreTake(s_mutex, portMAX_DELAY); + if (s_state.session_id == session_id) { + notify_lost_locked("heartbeat fail limit"); + } + xSemaphoreGive(s_mutex); + break; + } + } + + vTaskDelete(NULL); +} + +void spi_session_init(void) { + if (s_initialized) + return; + s_mutex = xSemaphoreCreateMutex(); + spi_bridge_register_stream_cb(SPI_ID_SESSION_LOST, on_session_lost_stream); + s_initialized = true; + ESP_LOGI(TAG, "Session client started"); +} + +uint32_t spi_session_start(spi_id_t op_id, + const uint8_t *params, + uint8_t params_len, + spi_session_stream_cb_t on_stream, + spi_session_lost_cb_t on_lost) { + if (!s_initialized) + spi_session_init(); + + xSemaphoreTake(s_mutex, portMAX_DELAY); + if (s_state.session_id != SPI_SESSION_INVALID_ID) { + ESP_LOGW(TAG, + "Replacing active session 0x%08lx with new start of op 0x%02X", + (unsigned long)s_state.session_id, + op_id); + notify_lost_locked("preempted by local start"); + } + xSemaphoreGive(s_mutex); + + spi_header_t resp_header = {0}; + spi_session_resp_t resp = {0}; + esp_err_t ret = spi_bridge_send_command( + op_id, params, params_len, &resp_header, (uint8_t *)&resp, spi_bridge_get_timeout(op_id)); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "START op 0x%02X bridge error: %s", op_id, esp_err_to_name(ret)); + return SPI_SESSION_INVALID_ID; + } + if (resp.session_id == SPI_SESSION_INVALID_ID) { + ESP_LOGE(TAG, "START op 0x%02X did not return a session id", op_id); + return SPI_SESSION_INVALID_ID; + } + + xSemaphoreTake(s_mutex, portMAX_DELAY); + s_state.session_id = resp.session_id; + s_state.op_id = op_id; + s_state.last_acked_seq = 0; + s_state.on_stream = on_stream; + s_state.on_lost = on_lost; + s_state.stop_requested = false; + spi_bridge_register_stream_cb(op_id, on_session_stream); + BaseType_t ok = xTaskCreate(heartbeat_task, + "spi_session_hb", + HEARTBEAT_STACK_SIZE, + (void *)(uintptr_t)resp.session_id, + HEARTBEAT_PRIO, + &s_state.heartbeat_task); + uint32_t session_id = s_state.session_id; + xSemaphoreGive(s_mutex); + + if (ok != pdPASS) { + ESP_LOGE(TAG, "Failed to create heartbeat task"); + spi_session_stop(session_id); + return SPI_SESSION_INVALID_ID; + } + + ESP_LOGI(TAG, "Session 0x%08lx started for op 0x%02X", (unsigned long)session_id, op_id); + return session_id; +} + +esp_err_t spi_session_stop(uint32_t session_id) { + xSemaphoreTake(s_mutex, portMAX_DELAY); + if (s_state.session_id != session_id || session_id == SPI_SESSION_INVALID_ID) { + xSemaphoreGive(s_mutex); + return ESP_ERR_NOT_FOUND; + } + s_state.stop_requested = true; + xSemaphoreGive(s_mutex); + + spi_session_stop_req_t req = {.session_id = session_id}; + spi_bridge_send_command(SPI_ID_SESSION_STOP, + (uint8_t *)&req, + sizeof(req), + NULL, + NULL, + spi_bridge_get_timeout(SPI_ID_SESSION_STOP)); + + xSemaphoreTake(s_mutex, portMAX_DELAY); + if (s_state.session_id == session_id) { + spi_bridge_unregister_stream_cb(s_state.op_id); + memset(&s_state, 0, sizeof(s_state)); + } + xSemaphoreGive(s_mutex); + + ESP_LOGI(TAG, "Session 0x%08lx stopped", (unsigned long)session_id); + return ESP_OK; +} + +bool spi_session_is_active(uint32_t session_id) { + xSemaphoreTake(s_mutex, portMAX_DELAY); + bool active = (s_state.session_id == session_id) && (session_id != SPI_SESSION_INVALID_ID); + xSemaphoreGive(s_mutex); + return active; +} diff --git a/firmware_p4/components/Service/storage_api/include/storage_impl.h b/firmware_p4/components/Service/storage_api/include/storage_impl.h index 18684051..cd64839d 100644 --- a/firmware_p4/components/Service/storage_api/include/storage_impl.h +++ b/firmware_p4/components/Service/storage_api/include/storage_impl.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file storage_impl.h diff --git a/firmware_p4/components/Service/storage_api/include/storage_init.h b/firmware_p4/components/Service/storage_api/include/storage_init.h index d85d5af4..eedfc293 100644 --- a/firmware_p4/components/Service/storage_api/include/storage_init.h +++ b/firmware_p4/components/Service/storage_api/include/storage_init.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file storage_init.h diff --git a/firmware_p4/components/Service/storage_api/include/storage_internal.h b/firmware_p4/components/Service/storage_api/include/storage_internal.h index 091a132c..a79b3b8c 100644 --- a/firmware_p4/components/Service/storage_api/include/storage_internal.h +++ b/firmware_p4/components/Service/storage_api/include/storage_internal.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file storage_internal.h diff --git a/firmware_p4/components/Service/storage_api/include/storage_mkdir.h b/firmware_p4/components/Service/storage_api/include/storage_mkdir.h index e15748a5..ed798402 100644 --- a/firmware_p4/components/Service/storage_api/include/storage_mkdir.h +++ b/firmware_p4/components/Service/storage_api/include/storage_mkdir.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef STORAGE_MKDIR_H #define STORAGE_MKDIR_H diff --git a/firmware_p4/components/Service/storage_api/include/storage_read.h b/firmware_p4/components/Service/storage_api/include/storage_read.h index 4417f902..c2d7649e 100644 --- a/firmware_p4/components/Service/storage_api/include/storage_read.h +++ b/firmware_p4/components/Service/storage_api/include/storage_read.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file storage_read.h diff --git a/firmware_p4/components/Service/storage_api/include/storage_stream.h b/firmware_p4/components/Service/storage_api/include/storage_stream.h index abbe86a7..57fe9482 100644 --- a/firmware_p4/components/Service/storage_api/include/storage_stream.h +++ b/firmware_p4/components/Service/storage_api/include/storage_stream.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef STORAGE_STREAM_H #define STORAGE_STREAM_H diff --git a/firmware_p4/components/Service/storage_api/include/storage_write.h b/firmware_p4/components/Service/storage_api/include/storage_write.h index 0416340c..43e02c24 100644 --- a/firmware_p4/components/Service/storage_api/include/storage_write.h +++ b/firmware_p4/components/Service/storage_api/include/storage_write.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file storage_write.h diff --git a/firmware_p4/components/Service/storage_api/include/tos_config.h b/firmware_p4/components/Service/storage_api/include/tos_config.h index fe4a174e..2f3da191 100644 --- a/firmware_p4/components/Service/storage_api/include/tos_config.h +++ b/firmware_p4/components/Service/storage_api/include/tos_config.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file tos_config.h diff --git a/firmware_p4/components/Service/storage_api/include/tos_first_boot.h b/firmware_p4/components/Service/storage_api/include/tos_first_boot.h index e5bed0eb..7bd2831f 100644 --- a/firmware_p4/components/Service/storage_api/include/tos_first_boot.h +++ b/firmware_p4/components/Service/storage_api/include/tos_first_boot.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef TOS_FIRST_BOOT_H #define TOS_FIRST_BOOT_H diff --git a/firmware_p4/components/Service/storage_api/include/tos_flash_paths.h b/firmware_p4/components/Service/storage_api/include/tos_flash_paths.h index f2b260fa..b57c2dac 100644 --- a/firmware_p4/components/Service/storage_api/include/tos_flash_paths.h +++ b/firmware_p4/components/Service/storage_api/include/tos_flash_paths.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef TOS_FLASH_PATHS_H #define TOS_FLASH_PATHS_H @@ -41,6 +42,9 @@ extern "C" { // Captive portal HTML templates (flash fallback) #define FLASH_CAPTIVE_TEMPLATES FLASH_MOUNT "/html/captive_portal" +// NFC key dictionaries (flash fallback) +#define FLASH_NFC_DICT FLASH_MOUNT "/nfc/dict" + #ifdef __cplusplus } #endif diff --git a/firmware_p4/components/Service/storage_api/include/tos_log.h b/firmware_p4/components/Service/storage_api/include/tos_log.h index 5c4a1bcf..c6c9acaf 100644 --- a/firmware_p4/components/Service/storage_api/include/tos_log.h +++ b/firmware_p4/components/Service/storage_api/include/tos_log.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef TOS_LOG_H #define TOS_LOG_H diff --git a/firmware_p4/components/Service/storage_api/include/tos_loot.h b/firmware_p4/components/Service/storage_api/include/tos_loot.h index 97c162e7..54f37c9f 100644 --- a/firmware_p4/components/Service/storage_api/include/tos_loot.h +++ b/firmware_p4/components/Service/storage_api/include/tos_loot.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file tos_loot.h diff --git a/firmware_p4/components/Service/storage_api/include/tos_storage_paths.h b/firmware_p4/components/Service/storage_api/include/tos_storage_paths.h index 3a8d937e..580f845f 100644 --- a/firmware_p4/components/Service/storage_api/include/tos_storage_paths.h +++ b/firmware_p4/components/Service/storage_api/include/tos_storage_paths.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef TOS_STORAGE_PATHS_H #define TOS_STORAGE_PATHS_H @@ -33,6 +34,7 @@ extern "C" { // Protocol sub-paths (only what each protocol actually uses per doc) #define TOS_PATH_NFC_ASSETS TOS_PATH_NFC "/assets" +#define TOS_PATH_NFC_DICT TOS_PATH_NFC_ASSETS "/dict" #define TOS_PATH_RFID_ASSETS TOS_PATH_RFID "/assets" diff --git a/firmware_p4/components/Service/storage_api/include/tos_theme.h b/firmware_p4/components/Service/storage_api/include/tos_theme.h index 50665cd3..7a535020 100644 --- a/firmware_p4/components/Service/storage_api/include/tos_theme.h +++ b/firmware_p4/components/Service/storage_api/include/tos_theme.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef TOS_THEME_H #define TOS_THEME_H diff --git a/firmware_p4/components/Service/storage_api/storage_impl.c b/firmware_p4/components/Service/storage_api/storage_impl.c index 550106d9..cff9db4f 100644 --- a/firmware_p4/components/Service/storage_api/storage_impl.c +++ b/firmware_p4/components/Service/storage_api/storage_impl.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file storage_impl.c diff --git a/firmware_p4/components/Service/storage_api/storage_init.c b/firmware_p4/components/Service/storage_api/storage_init.c index b3804c24..08295391 100644 --- a/firmware_p4/components/Service/storage_api/storage_init.c +++ b/firmware_p4/components/Service/storage_api/storage_init.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "storage_init.h" diff --git a/firmware_p4/components/Service/storage_api/storage_mkdir.c b/firmware_p4/components/Service/storage_api/storage_mkdir.c index 84933701..393a1d4d 100644 --- a/firmware_p4/components/Service/storage_api/storage_mkdir.c +++ b/firmware_p4/components/Service/storage_api/storage_mkdir.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "storage_mkdir.h" diff --git a/firmware_p4/components/Service/storage_api/storage_read.c b/firmware_p4/components/Service/storage_api/storage_read.c index 0a6860f1..c6dc3d15 100644 --- a/firmware_p4/components/Service/storage_api/storage_read.c +++ b/firmware_p4/components/Service/storage_api/storage_read.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file storage_read.c diff --git a/firmware_p4/components/Service/storage_api/storage_stream.c b/firmware_p4/components/Service/storage_api/storage_stream.c index c2589c82..2a08fdf1 100644 --- a/firmware_p4/components/Service/storage_api/storage_stream.c +++ b/firmware_p4/components/Service/storage_api/storage_stream.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "storage_stream.h" diff --git a/firmware_p4/components/Service/storage_api/storage_write.c b/firmware_p4/components/Service/storage_api/storage_write.c index 0f0f88ac..d119987d 100644 --- a/firmware_p4/components/Service/storage_api/storage_write.c +++ b/firmware_p4/components/Service/storage_api/storage_write.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "storage_write.h" diff --git a/firmware_p4/components/Service/storage_api/tos_config.c b/firmware_p4/components/Service/storage_api/tos_config.c index 52e47bcb..d62c479d 100644 --- a/firmware_p4/components/Service/storage_api/tos_config.c +++ b/firmware_p4/components/Service/storage_api/tos_config.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "tos_config.h" #include "tos_storage_paths.h" diff --git a/firmware_p4/components/Service/storage_api/tos_first_boot.c b/firmware_p4/components/Service/storage_api/tos_first_boot.c index 3927bccc..268d7b37 100644 --- a/firmware_p4/components/Service/storage_api/tos_first_boot.c +++ b/firmware_p4/components/Service/storage_api/tos_first_boot.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "tos_first_boot.h" #include "tos_config.h" @@ -45,6 +46,7 @@ static const char *const FIRST_BOOT_DIRS[] = { // Protocol assets TOS_PATH_NFC_ASSETS, + TOS_PATH_NFC_DICT, TOS_PATH_RFID_ASSETS, TOS_PATH_SUBGHZ_ASSETS, TOS_PATH_IR_ASSETS, @@ -237,8 +239,9 @@ static const asset_copy_t FIRST_BOOT_ASSETS[] = { // BadUSB example scripts {FLASH_STORAGE_BADUSB "/rickroll.txt", TOS_PATH_BADUSB_ASSETS "/rickroll.txt"}, - // TODO: add protocol database entries here when files are added to flash - // e.g. mf_classic_dict.nfc, oui_db.csv, frequency_list.sub, etc. + {FLASH_NFC_DICT "/mf_classic_default.dic", TOS_PATH_NFC_DICT "/mf_classic_default.dic"}, + {FLASH_NFC_DICT "/mf_classic_user.dic", TOS_PATH_NFC_DICT "/mf_classic_user.dic"}, + {FLASH_NFC_DICT "/mf_ulc_default.dic", TOS_PATH_NFC_DICT "/mf_ulc_default.dic"}, {NULL, NULL}}; diff --git a/firmware_p4/components/Service/storage_api/tos_log.c b/firmware_p4/components/Service/storage_api/tos_log.c index 1e5b80ab..7ce40213 100644 --- a/firmware_p4/components/Service/storage_api/tos_log.c +++ b/firmware_p4/components/Service/storage_api/tos_log.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "tos_log.h" diff --git a/firmware_p4/components/Service/storage_api/tos_loot.c b/firmware_p4/components/Service/storage_api/tos_loot.c index 20afbd56..da7f8aef 100644 --- a/firmware_p4/components/Service/storage_api/tos_loot.c +++ b/firmware_p4/components/Service/storage_api/tos_loot.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "tos_loot.h" diff --git a/firmware_p4/components/Service/storage_api/tos_theme.c b/firmware_p4/components/Service/storage_api/tos_theme.c index d10cf8e1..762ba42f 100644 --- a/firmware_p4/components/Service/storage_api/tos_theme.c +++ b/firmware_p4/components/Service/storage_api/tos_theme.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "tos_theme.h" diff --git a/firmware_p4/components/Service/storage_assets/include/storage_assets.h b/firmware_p4/components/Service/storage_assets/include/storage_assets.h index 63e8c3d9..3a6c9dd4 100644 --- a/firmware_p4/components/Service/storage_assets/include/storage_assets.h +++ b/firmware_p4/components/Service/storage_assets/include/storage_assets.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef STORAGE_ASSETS_H #define STORAGE_ASSETS_H diff --git a/firmware_p4/components/Service/storage_assets/storage_assets.c b/firmware_p4/components/Service/storage_assets/storage_assets.c index 2e6ea0f0..3898329b 100644 --- a/firmware_p4/components/Service/storage_assets/storage_assets.c +++ b/firmware_p4/components/Service/storage_assets/storage_assets.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "storage_assets.h" diff --git a/firmware_p4/components/Service/storage_vfs/include/vfs_config.h b/firmware_p4/components/Service/storage_vfs/include/vfs_config.h index 45708625..20e99052 100644 --- a/firmware_p4/components/Service/storage_vfs/include/vfs_config.h +++ b/firmware_p4/components/Service/storage_vfs/include/vfs_config.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file vfs_config.h diff --git a/firmware_p4/components/Service/storage_vfs/include/vfs_core.h b/firmware_p4/components/Service/storage_vfs/include/vfs_core.h index 542e6220..d2710f60 100644 --- a/firmware_p4/components/Service/storage_vfs/include/vfs_core.h +++ b/firmware_p4/components/Service/storage_vfs/include/vfs_core.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file vfs_core.h diff --git a/firmware_p4/components/Service/storage_vfs/include/vfs_littlefs.h b/firmware_p4/components/Service/storage_vfs/include/vfs_littlefs.h index b1cdde39..14dc07b8 100644 --- a/firmware_p4/components/Service/storage_vfs/include/vfs_littlefs.h +++ b/firmware_p4/components/Service/storage_vfs/include/vfs_littlefs.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file vfs_littlefs.h diff --git a/firmware_p4/components/Service/storage_vfs/include/vfs_sdcard.h b/firmware_p4/components/Service/storage_vfs/include/vfs_sdcard.h index 0300395f..19750e96 100644 --- a/firmware_p4/components/Service/storage_vfs/include/vfs_sdcard.h +++ b/firmware_p4/components/Service/storage_vfs/include/vfs_sdcard.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file vfs_sdcard.h diff --git a/firmware_p4/components/Service/storage_vfs/vfs_auto.c b/firmware_p4/components/Service/storage_vfs/vfs_auto.c index da6282d0..dbe02973 100644 --- a/firmware_p4/components/Service/storage_vfs/vfs_auto.c +++ b/firmware_p4/components/Service/storage_vfs/vfs_auto.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . /** * @file vfs_auto.c diff --git a/firmware_p4/components/Service/storage_vfs/vfs_core.c b/firmware_p4/components/Service/storage_vfs/vfs_core.c index fa92fb19..6071cf37 100644 --- a/firmware_p4/components/Service/storage_vfs/vfs_core.c +++ b/firmware_p4/components/Service/storage_vfs/vfs_core.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "vfs_core.h" diff --git a/firmware_p4/components/Service/storage_vfs/vfs_littlefs.c b/firmware_p4/components/Service/storage_vfs/vfs_littlefs.c index 8df1b660..b533d586 100644 --- a/firmware_p4/components/Service/storage_vfs/vfs_littlefs.c +++ b/firmware_p4/components/Service/storage_vfs/vfs_littlefs.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "vfs_littlefs.h" diff --git a/firmware_p4/components/Service/storage_vfs/vfs_sdcard.c b/firmware_p4/components/Service/storage_vfs/vfs_sdcard.c index ea6e151e..c64f2526 100644 --- a/firmware_p4/components/Service/storage_vfs/vfs_sdcard.c +++ b/firmware_p4/components/Service/storage_vfs/vfs_sdcard.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "vfs_sdcard.h" diff --git a/firmware_p4/components/Service/wifi/include/mac_vendor.h b/firmware_p4/components/Service/wifi/include/mac_vendor.h index a5ead6fb..a1f8118f 100644 --- a/firmware_p4/components/Service/wifi/include/mac_vendor.h +++ b/firmware_p4/components/Service/wifi/include/mac_vendor.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef MAC_VENDOR_H #define MAC_VENDOR_H diff --git a/firmware_p4/components/Service/wifi/include/wifi_80211.h b/firmware_p4/components/Service/wifi/include/wifi_80211.h index 705160ab..71ab7ff8 100644 --- a/firmware_p4/components/Service/wifi/include/wifi_80211.h +++ b/firmware_p4/components/Service/wifi/include/wifi_80211.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef WIFI_80211_H #define WIFI_80211_H diff --git a/firmware_p4/components/Service/wifi/include/wifi_service.h b/firmware_p4/components/Service/wifi/include/wifi_service.h index ad08d0e6..8328910f 100644 --- a/firmware_p4/components/Service/wifi/include/wifi_service.h +++ b/firmware_p4/components/Service/wifi/include/wifi_service.h @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #ifndef WIFI_SERVICE_H #define WIFI_SERVICE_H diff --git a/firmware_p4/components/Service/wifi/mac_vendor.c b/firmware_p4/components/Service/wifi/mac_vendor.c index 3202973e..c3d23ca9 100644 --- a/firmware_p4/components/Service/wifi/mac_vendor.c +++ b/firmware_p4/components/Service/wifi/mac_vendor.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "mac_vendor.h" diff --git a/firmware_p4/components/Service/wifi/wifi_service.c b/firmware_p4/components/Service/wifi/wifi_service.c index 747fe40f..d5515d7a 100644 --- a/firmware_p4/components/Service/wifi/wifi_service.c +++ b/firmware_p4/components/Service/wifi/wifi_service.c @@ -1,16 +1,17 @@ // Copyright (c) 2025 HIGH CODE LLC // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// TentacleOS is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // -// http://www.apache.org/licenses/LICENSE-2.0 +// TentacleOS is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// You should have received a copy of the GNU General Public License +// along with TentacleOS. If not, see . #include "wifi_service.h" @@ -22,33 +23,34 @@ static const char *TAG = "WIFI_SERVICE_P4"; -#define SSID_MAX_LEN 33 -#define SPI_TIMEOUT_MS 2000 -#define SPI_SCAN_TIMEOUT_MS 20000 -#define SPI_CONNECT_TIMEOUT_MS 15000 -#define SPI_DATA_TIMEOUT_MS 1000 +#define SSID_MAX_LEN 33 static wifi_ap_record_t s_cached_record; static char s_connected_ssid[SSID_MAX_LEN] = {0}; void wifi_service_init(void) { - spi_bridge_send_command(SPI_ID_WIFI_START, NULL, 0, NULL, NULL, SPI_TIMEOUT_MS); + spi_bridge_send_command( + SPI_ID_WIFI_START, NULL, 0, NULL, NULL, spi_bridge_get_timeout(SPI_ID_WIFI_START)); } void wifi_service_deinit(void) { - spi_bridge_send_command(SPI_ID_WIFI_STOP, NULL, 0, NULL, NULL, SPI_TIMEOUT_MS); + spi_bridge_send_command( + SPI_ID_WIFI_STOP, NULL, 0, NULL, NULL, spi_bridge_get_timeout(SPI_ID_WIFI_STOP)); } void wifi_service_start(void) { - spi_bridge_send_command(SPI_ID_WIFI_START, NULL, 0, NULL, NULL, SPI_TIMEOUT_MS); + spi_bridge_send_command( + SPI_ID_WIFI_START, NULL, 0, NULL, NULL, spi_bridge_get_timeout(SPI_ID_WIFI_START)); } void wifi_service_stop(void) { - spi_bridge_send_command(SPI_ID_WIFI_STOP, NULL, 0, NULL, NULL, SPI_TIMEOUT_MS); + spi_bridge_send_command( + SPI_ID_WIFI_STOP, NULL, 0, NULL, NULL, spi_bridge_get_timeout(SPI_ID_WIFI_STOP)); } void wifi_service_scan(void) { - spi_bridge_send_command(SPI_ID_WIFI_SCAN, NULL, 0, NULL, NULL, SPI_SCAN_TIMEOUT_MS); + spi_bridge_send_command( + SPI_ID_WIFI_SCAN, NULL, 0, NULL, NULL, spi_bridge_get_timeout(SPI_ID_WIFI_SCAN)); } uint16_t wifi_service_get_ap_count(void) { @@ -56,9 +58,12 @@ uint16_t wifi_service_get_ap_count(void) { uint8_t payload[2]; uint16_t magic_count = SPI_DATA_INDEX_COUNT; - if (spi_bridge_send_command( - SPI_ID_SYSTEM_DATA, (uint8_t *)&magic_count, 2, &resp, payload, SPI_DATA_TIMEOUT_MS) == - ESP_OK) { + if (spi_bridge_send_command(SPI_ID_SYSTEM_DATA, + (uint8_t *)&magic_count, + 2, + &resp, + payload, + spi_bridge_get_timeout(SPI_ID_SYSTEM_DATA)) == ESP_OK) { uint16_t count; memcpy(&count, payload, 2); return count; @@ -74,7 +79,7 @@ wifi_ap_record_t *wifi_service_get_ap_record(uint16_t index) { 2, &resp, (uint8_t *)&s_cached_record, - SPI_DATA_TIMEOUT_MS) == ESP_OK) { + spi_bridge_get_timeout(SPI_ID_SYSTEM_DATA)) == ESP_OK) { return &s_cached_record; } return NULL; @@ -86,16 +91,24 @@ esp_err_t wifi_service_connect_to_ap(const char *ssid, const char *password) { if (password != NULL) { strncpy(cfg.password, password, sizeof(cfg.password)); } - return spi_bridge_send_command( - SPI_ID_WIFI_CONNECT, (uint8_t *)&cfg, sizeof(cfg), NULL, NULL, SPI_CONNECT_TIMEOUT_MS); + return spi_bridge_send_command(SPI_ID_WIFI_CONNECT, + (uint8_t *)&cfg, + sizeof(cfg), + NULL, + NULL, + spi_bridge_get_timeout(SPI_ID_WIFI_CONNECT)); } bool wifi_service_is_connected(void) { spi_header_t resp; spi_system_status_t sys = {0}; - if (spi_bridge_send_command( - SPI_ID_SYSTEM_STATUS, NULL, 0, &resp, (uint8_t *)&sys, SPI_DATA_TIMEOUT_MS) == ESP_OK) { + if (spi_bridge_send_command(SPI_ID_SYSTEM_STATUS, + NULL, + 0, + &resp, + (uint8_t *)&sys, + spi_bridge_get_timeout(SPI_ID_SYSTEM_STATUS)) == ESP_OK) { return sys.wifi_connected != 0; } return (wifi_service_get_connected_ssid() != NULL); @@ -109,7 +122,7 @@ const char *wifi_service_get_connected_ssid(void) { 0, &resp, (uint8_t *)s_connected_ssid, - SPI_DATA_TIMEOUT_MS) == ESP_OK) { + spi_bridge_get_timeout(SPI_ID_WIFI_GET_STA_INFO)) == ESP_OK) { s_connected_ssid[SSID_MAX_LEN - 1] = '\0'; return s_connected_ssid; } @@ -120,8 +133,12 @@ bool wifi_service_is_active(void) { spi_header_t resp; spi_system_status_t sys = {0}; - if (spi_bridge_send_command( - SPI_ID_SYSTEM_STATUS, NULL, 0, &resp, (uint8_t *)&sys, SPI_DATA_TIMEOUT_MS) == ESP_OK) { + if (spi_bridge_send_command(SPI_ID_SYSTEM_STATUS, + NULL, + 0, + &resp, + (uint8_t *)&sys, + spi_bridge_get_timeout(SPI_ID_SYSTEM_STATUS)) == ESP_OK) { return sys.wifi_active != 0; } return false; @@ -149,18 +166,31 @@ esp_err_t wifi_service_save_ap_config( } cfg.enabled = enabled ? 1 : 0; - return spi_bridge_send_command( - SPI_ID_WIFI_SAVE_AP_CONFIG, (uint8_t *)&cfg, sizeof(cfg), NULL, NULL, SPI_TIMEOUT_MS); + return spi_bridge_send_command(SPI_ID_WIFI_SAVE_AP_CONFIG, + (uint8_t *)&cfg, + sizeof(cfg), + NULL, + NULL, + spi_bridge_get_timeout(SPI_ID_WIFI_SAVE_AP_CONFIG)); } esp_err_t wifi_service_set_enabled(bool enabled) { uint8_t payload = enabled ? 1 : 0; - return spi_bridge_send_command(SPI_ID_WIFI_SET_ENABLED, &payload, 1, NULL, NULL, SPI_TIMEOUT_MS); + return spi_bridge_send_command(SPI_ID_WIFI_SET_ENABLED, + &payload, + 1, + NULL, + NULL, + spi_bridge_get_timeout(SPI_ID_WIFI_SET_ENABLED)); } esp_err_t wifi_service_set_ap_ssid(const char *ssid) { - return spi_bridge_send_command( - SPI_ID_WIFI_SET_AP, (uint8_t *)ssid, strlen(ssid), NULL, NULL, SPI_TIMEOUT_MS); + return spi_bridge_send_command(SPI_ID_WIFI_SET_AP, + (uint8_t *)ssid, + strlen(ssid), + NULL, + NULL, + spi_bridge_get_timeout(SPI_ID_WIFI_SET_AP)); } esp_err_t wifi_service_set_ap_password(const char *password) { @@ -172,45 +202,71 @@ esp_err_t wifi_service_set_ap_password(const char *password) { strlen(password), NULL, NULL, - SPI_TIMEOUT_MS); + spi_bridge_get_timeout(SPI_ID_WIFI_SET_AP_PASSWORD)); } esp_err_t wifi_service_set_ap_max_conn(uint8_t max_conn) { uint8_t payload = max_conn; - return spi_bridge_send_command( - SPI_ID_WIFI_SET_AP_MAX_CONN, &payload, 1, NULL, NULL, SPI_TIMEOUT_MS); + return spi_bridge_send_command(SPI_ID_WIFI_SET_AP_MAX_CONN, + &payload, + 1, + NULL, + NULL, + spi_bridge_get_timeout(SPI_ID_WIFI_SET_AP_MAX_CONN)); } esp_err_t wifi_service_set_ap_ip(const char *ip_addr) { if (ip_addr == NULL) { return ESP_ERR_INVALID_ARG; } - return spi_bridge_send_command( - SPI_ID_WIFI_SET_AP_IP, (uint8_t *)ip_addr, strlen(ip_addr), NULL, NULL, SPI_TIMEOUT_MS); + return spi_bridge_send_command(SPI_ID_WIFI_SET_AP_IP, + (uint8_t *)ip_addr, + strlen(ip_addr), + NULL, + NULL, + spi_bridge_get_timeout(SPI_ID_WIFI_SET_AP_IP)); } void wifi_service_promiscuous_start(wifi_promiscuous_cb_t cb, wifi_promiscuous_filter_t *filter) { (void)cb; (void)filter; - esp_err_t err = - spi_bridge_send_command(SPI_ID_WIFI_PROMISC_START, NULL, 0, NULL, NULL, SPI_TIMEOUT_MS); + esp_err_t err = spi_bridge_send_command(SPI_ID_WIFI_PROMISC_START, + NULL, + 0, + NULL, + NULL, + spi_bridge_get_timeout(SPI_ID_WIFI_PROMISC_START)); if (err == ESP_ERR_NOT_SUPPORTED) { ESP_LOGW(TAG, "Promiscuous start not supported over SPI"); } } void wifi_service_promiscuous_stop(void) { - esp_err_t err = - spi_bridge_send_command(SPI_ID_WIFI_PROMISC_STOP, NULL, 0, NULL, NULL, SPI_TIMEOUT_MS); + esp_err_t err = spi_bridge_send_command(SPI_ID_WIFI_PROMISC_STOP, + NULL, + 0, + NULL, + NULL, + spi_bridge_get_timeout(SPI_ID_WIFI_PROMISC_STOP)); if (err == ESP_ERR_NOT_SUPPORTED) { ESP_LOGW(TAG, "Promiscuous stop not supported over SPI"); } } void wifi_service_start_channel_hopping(void) { - spi_bridge_send_command(SPI_ID_WIFI_CH_HOP_START, NULL, 0, NULL, NULL, SPI_TIMEOUT_MS); + spi_bridge_send_command(SPI_ID_WIFI_CH_HOP_START, + NULL, + 0, + NULL, + NULL, + spi_bridge_get_timeout(SPI_ID_WIFI_CH_HOP_START)); } void wifi_service_stop_channel_hopping(void) { - spi_bridge_send_command(SPI_ID_WIFI_CH_HOP_STOP, NULL, 0, NULL, NULL, SPI_TIMEOUT_MS); + spi_bridge_send_command(SPI_ID_WIFI_CH_HOP_STOP, + NULL, + 0, + NULL, + NULL, + spi_bridge_get_timeout(SPI_ID_WIFI_CH_HOP_STOP)); } diff --git a/firmware_p4/sdkconfig b/firmware_p4/sdkconfig deleted file mode 100644 index b5601fd2..00000000 --- a/firmware_p4/sdkconfig +++ /dev/null @@ -1,3112 +0,0 @@ -# -# Automatically generated file. DO NOT EDIT. -# Espressif IoT Development Framework (ESP-IDF) 5.5.3 Project Configuration -# -CONFIG_SOC_ADC_SUPPORTED=y -CONFIG_SOC_ANA_CMPR_SUPPORTED=y -CONFIG_SOC_DEDICATED_GPIO_SUPPORTED=y -CONFIG_SOC_UART_SUPPORTED=y -CONFIG_SOC_GDMA_SUPPORTED=y -CONFIG_SOC_UHCI_SUPPORTED=y -CONFIG_SOC_AHB_GDMA_SUPPORTED=y -CONFIG_SOC_AXI_GDMA_SUPPORTED=y -CONFIG_SOC_DW_GDMA_SUPPORTED=y -CONFIG_SOC_DMA2D_SUPPORTED=y -CONFIG_SOC_GPTIMER_SUPPORTED=y -CONFIG_SOC_PCNT_SUPPORTED=y -CONFIG_SOC_LCDCAM_SUPPORTED=y -CONFIG_SOC_LCDCAM_CAM_SUPPORTED=y -CONFIG_SOC_LCDCAM_I80_LCD_SUPPORTED=y -CONFIG_SOC_LCDCAM_RGB_LCD_SUPPORTED=y -CONFIG_SOC_MIPI_CSI_SUPPORTED=y -CONFIG_SOC_MIPI_DSI_SUPPORTED=y -CONFIG_SOC_MCPWM_SUPPORTED=y -CONFIG_SOC_TWAI_SUPPORTED=y -CONFIG_SOC_ETM_SUPPORTED=y -CONFIG_SOC_PARLIO_SUPPORTED=y -CONFIG_SOC_ASYNC_MEMCPY_SUPPORTED=y -CONFIG_SOC_EMAC_SUPPORTED=y -CONFIG_SOC_USB_OTG_SUPPORTED=y -CONFIG_SOC_WIRELESS_HOST_SUPPORTED=y -CONFIG_SOC_USB_SERIAL_JTAG_SUPPORTED=y -CONFIG_SOC_TEMP_SENSOR_SUPPORTED=y -CONFIG_SOC_SUPPORTS_SECURE_DL_MODE=y -CONFIG_SOC_ULP_SUPPORTED=y -CONFIG_SOC_LP_CORE_SUPPORTED=y -CONFIG_SOC_EFUSE_KEY_PURPOSE_FIELD=y -CONFIG_SOC_EFUSE_SUPPORTED=y -CONFIG_SOC_RTC_FAST_MEM_SUPPORTED=y -CONFIG_SOC_RTC_MEM_SUPPORTED=y -CONFIG_SOC_RMT_SUPPORTED=y -CONFIG_SOC_I2S_SUPPORTED=y -CONFIG_SOC_SDM_SUPPORTED=y -CONFIG_SOC_GPSPI_SUPPORTED=y -CONFIG_SOC_LEDC_SUPPORTED=y -CONFIG_SOC_ISP_SUPPORTED=y -CONFIG_SOC_I2C_SUPPORTED=y -CONFIG_SOC_SYSTIMER_SUPPORTED=y -CONFIG_SOC_AES_SUPPORTED=y -CONFIG_SOC_MPI_SUPPORTED=y -CONFIG_SOC_SHA_SUPPORTED=y -CONFIG_SOC_HMAC_SUPPORTED=y -CONFIG_SOC_DIG_SIGN_SUPPORTED=y -CONFIG_SOC_ECC_SUPPORTED=y -CONFIG_SOC_ECC_EXTENDED_MODES_SUPPORTED=y -CONFIG_SOC_FLASH_ENC_SUPPORTED=y -CONFIG_SOC_SECURE_BOOT_SUPPORTED=y -CONFIG_SOC_BOD_SUPPORTED=y -CONFIG_SOC_VBAT_SUPPORTED=y -CONFIG_SOC_APM_SUPPORTED=y -CONFIG_SOC_PMU_SUPPORTED=y -CONFIG_SOC_PMU_PVT_SUPPORTED=y -CONFIG_SOC_PVT_EN_WITH_SLEEP=y -CONFIG_SOC_PVT_RETENTION_BY_REGDMA=y -CONFIG_SOC_DCDC_SUPPORTED=y -CONFIG_SOC_PAU_SUPPORTED=y -CONFIG_SOC_LP_TIMER_SUPPORTED=y -CONFIG_SOC_ULP_LP_UART_SUPPORTED=y -CONFIG_SOC_LP_GPIO_MATRIX_SUPPORTED=y -CONFIG_SOC_LP_PERIPHERALS_SUPPORTED=y -CONFIG_SOC_LP_I2C_SUPPORTED=y -CONFIG_SOC_LP_I2S_SUPPORTED=y -CONFIG_SOC_LP_SPI_SUPPORTED=y -CONFIG_SOC_LP_ADC_SUPPORTED=y -CONFIG_SOC_LP_VAD_SUPPORTED=y -CONFIG_SOC_SPIRAM_SUPPORTED=y -CONFIG_SOC_PSRAM_DMA_CAPABLE=y -CONFIG_SOC_SDMMC_HOST_SUPPORTED=y -CONFIG_SOC_CLK_TREE_SUPPORTED=y -CONFIG_SOC_ASSIST_DEBUG_SUPPORTED=y -CONFIG_SOC_DEBUG_PROBE_SUPPORTED=y -CONFIG_SOC_WDT_SUPPORTED=y -CONFIG_SOC_SPI_FLASH_SUPPORTED=y -CONFIG_SOC_TOUCH_SENSOR_SUPPORTED=y -CONFIG_SOC_RNG_SUPPORTED=y -CONFIG_SOC_GP_LDO_SUPPORTED=y -CONFIG_SOC_PPA_SUPPORTED=y -CONFIG_SOC_LIGHT_SLEEP_SUPPORTED=y -CONFIG_SOC_DEEP_SLEEP_SUPPORTED=y -CONFIG_SOC_PM_SUPPORTED=y -CONFIG_SOC_BITSCRAMBLER_SUPPORTED=y -CONFIG_SOC_SIMD_INSTRUCTION_SUPPORTED=y -CONFIG_SOC_I3C_MASTER_SUPPORTED=y -CONFIG_SOC_XTAL_SUPPORT_40M=y -CONFIG_SOC_AES_SUPPORT_DMA=y -CONFIG_SOC_AES_SUPPORT_GCM=y -CONFIG_SOC_AES_GDMA=y -CONFIG_SOC_AES_SUPPORT_AES_128=y -CONFIG_SOC_AES_SUPPORT_AES_256=y -CONFIG_SOC_AES_SUPPORT_PSEUDO_ROUND_FUNCTION=y -CONFIG_SOC_ADC_RTC_CTRL_SUPPORTED=y -CONFIG_SOC_ADC_DIG_CTRL_SUPPORTED=y -CONFIG_SOC_ADC_DMA_SUPPORTED=y -CONFIG_SOC_ADC_PERIPH_NUM=2 -CONFIG_SOC_ADC_MAX_CHANNEL_NUM=8 -CONFIG_SOC_ADC_ATTEN_NUM=4 -CONFIG_SOC_ADC_DIGI_CONTROLLER_NUM=2 -CONFIG_SOC_ADC_PATT_LEN_MAX=16 -CONFIG_SOC_ADC_DIGI_MAX_BITWIDTH=12 -CONFIG_SOC_ADC_DIGI_MIN_BITWIDTH=12 -CONFIG_SOC_ADC_DIGI_IIR_FILTER_NUM=2 -CONFIG_SOC_ADC_DIGI_MONITOR_NUM=2 -CONFIG_SOC_ADC_DIGI_RESULT_BYTES=4 -CONFIG_SOC_ADC_DIGI_DATA_BYTES_PER_CONV=4 -CONFIG_SOC_ADC_SAMPLE_FREQ_THRES_HIGH=83333 -CONFIG_SOC_ADC_SAMPLE_FREQ_THRES_LOW=611 -CONFIG_SOC_ADC_RTC_MIN_BITWIDTH=12 -CONFIG_SOC_ADC_RTC_MAX_BITWIDTH=12 -CONFIG_SOC_ADC_CALIBRATION_V1_SUPPORTED=y -CONFIG_SOC_ADC_SELF_HW_CALI_SUPPORTED=y -CONFIG_SOC_ADC_CALIB_CHAN_COMPENS_SUPPORTED=y -CONFIG_SOC_ADC_SHARED_POWER=y -CONFIG_SOC_BROWNOUT_RESET_SUPPORTED=y -CONFIG_SOC_SHARED_IDCACHE_SUPPORTED=y -CONFIG_SOC_CACHE_WRITEBACK_SUPPORTED=y -CONFIG_SOC_CACHE_FREEZE_SUPPORTED=y -CONFIG_SOC_CACHE_INTERNAL_MEM_VIA_L1CACHE=y -CONFIG_SOC_CPU_CORES_NUM=2 -CONFIG_SOC_CPU_INTR_NUM=32 -CONFIG_SOC_CPU_HAS_FLEXIBLE_INTC=y -CONFIG_SOC_INT_CLIC_SUPPORTED=y -CONFIG_SOC_INT_HW_NESTED_SUPPORTED=y -CONFIG_SOC_BRANCH_PREDICTOR_SUPPORTED=y -CONFIG_SOC_CPU_COPROC_NUM=3 -CONFIG_SOC_CPU_HAS_FPU=y -CONFIG_SOC_CPU_HAS_FPU_EXT_ILL_BUG=y -CONFIG_SOC_CPU_HAS_HWLOOP=y -CONFIG_SOC_CPU_HAS_HWLOOP_STATE_BUG=y -CONFIG_SOC_CPU_HAS_PIE=y -CONFIG_SOC_HP_CPU_HAS_MULTIPLE_CORES=y -CONFIG_SOC_CPU_BREAKPOINTS_NUM=3 -CONFIG_SOC_CPU_WATCHPOINTS_NUM=3 -CONFIG_SOC_CPU_WATCHPOINT_MAX_REGION_SIZE=0x100 -CONFIG_SOC_CPU_HAS_PMA=y -CONFIG_SOC_CPU_IDRAM_SPLIT_USING_PMP=y -CONFIG_SOC_CPU_PMP_REGION_GRANULARITY=128 -CONFIG_SOC_CPU_HAS_LOCKUP_RESET=y -CONFIG_SOC_SIMD_PREFERRED_DATA_ALIGNMENT=16 -CONFIG_SOC_DS_SIGNATURE_MAX_BIT_LEN=4096 -CONFIG_SOC_DS_KEY_PARAM_MD_IV_LENGTH=16 -CONFIG_SOC_DS_KEY_CHECK_MAX_WAIT_US=1100 -CONFIG_SOC_DMA_CAN_ACCESS_FLASH=y -CONFIG_SOC_AHB_GDMA_VERSION=2 -CONFIG_SOC_GDMA_SUPPORT_CRC=y -CONFIG_SOC_GDMA_NUM_GROUPS_MAX=2 -CONFIG_SOC_GDMA_PAIRS_PER_GROUP_MAX=3 -CONFIG_SOC_AHB_GDMA_SUPPORT_PSRAM=y -CONFIG_SOC_AXI_GDMA_SUPPORT_PSRAM=y -CONFIG_SOC_GDMA_SUPPORT_ETM=y -CONFIG_SOC_GDMA_SUPPORT_SLEEP_RETENTION=y -CONFIG_SOC_GDMA_EXT_MEM_ENC_ALIGNMENT=16 -CONFIG_SOC_DMA2D_GROUPS=1 -CONFIG_SOC_DMA2D_TX_CHANNELS_PER_GROUP=4 -CONFIG_SOC_DMA2D_RX_CHANNELS_PER_GROUP=3 -CONFIG_SOC_ETM_GROUPS=1 -CONFIG_SOC_ETM_CHANNELS_PER_GROUP=50 -CONFIG_SOC_ETM_SUPPORT_SLEEP_RETENTION=y -CONFIG_SOC_GPIO_PORT=1 -CONFIG_SOC_GPIO_PIN_COUNT=55 -CONFIG_SOC_GPIO_SUPPORT_PIN_GLITCH_FILTER=y -CONFIG_SOC_GPIO_FLEX_GLITCH_FILTER_NUM=8 -CONFIG_SOC_GPIO_SUPPORT_PIN_HYS_FILTER=y -CONFIG_SOC_GPIO_SUPPORT_ETM=y -CONFIG_SOC_GPIO_SUPPORT_RTC_INDEPENDENT=y -CONFIG_SOC_GPIO_SUPPORT_DEEPSLEEP_WAKEUP=y -CONFIG_SOC_LP_IO_HAS_INDEPENDENT_WAKEUP_SOURCE=y -CONFIG_SOC_LP_IO_CLOCK_IS_INDEPENDENT=y -CONFIG_SOC_GPIO_VALID_GPIO_MASK=0x007FFFFFFFFFFFFF -CONFIG_SOC_GPIO_IN_RANGE_MAX=54 -CONFIG_SOC_GPIO_OUT_RANGE_MAX=54 -CONFIG_SOC_GPIO_DEEP_SLEEP_WAKE_VALID_GPIO_MASK=0 -CONFIG_SOC_GPIO_DEEP_SLEEP_WAKE_SUPPORTED_PIN_CNT=16 -CONFIG_SOC_GPIO_VALID_DIGITAL_IO_PAD_MASK=0x007FFFFFFFFF0000 -CONFIG_SOC_GPIO_SUPPORT_FORCE_HOLD=y -CONFIG_SOC_GPIO_SUPPORT_HOLD_SINGLE_IO_IN_DSLP=y -CONFIG_SOC_GPIO_CLOCKOUT_BY_GPIO_MATRIX=y -CONFIG_SOC_GPIO_CLOCKOUT_CHANNEL_NUM=2 -CONFIG_SOC_CLOCKOUT_SUPPORT_CHANNEL_DIVIDER=y -CONFIG_SOC_DEBUG_PROBE_NUM_UNIT=1 -CONFIG_SOC_DEBUG_PROBE_MAX_OUTPUT_WIDTH=16 -CONFIG_SOC_RTCIO_PIN_COUNT=16 -CONFIG_SOC_RTCIO_INPUT_OUTPUT_SUPPORTED=y -CONFIG_SOC_RTCIO_HOLD_SUPPORTED=y -CONFIG_SOC_RTCIO_WAKE_SUPPORTED=y -CONFIG_SOC_RTCIO_EDGE_WAKE_SUPPORTED=y -CONFIG_SOC_DEDIC_GPIO_OUT_CHANNELS_NUM=8 -CONFIG_SOC_DEDIC_GPIO_IN_CHANNELS_NUM=8 -CONFIG_SOC_DEDIC_PERIPH_ALWAYS_ENABLE=y -CONFIG_SOC_ANA_CMPR_NUM=2 -CONFIG_SOC_ANA_CMPR_CAN_DISTINGUISH_EDGE=y -CONFIG_SOC_ANA_CMPR_SUPPORT_ETM=y -CONFIG_SOC_I2C_NUM=3 -CONFIG_SOC_HP_I2C_NUM=2 -CONFIG_SOC_I2C_FIFO_LEN=32 -CONFIG_SOC_I2C_CMD_REG_NUM=8 -CONFIG_SOC_I2C_SUPPORT_SLAVE=y -CONFIG_SOC_I2C_SUPPORT_HW_FSM_RST=y -CONFIG_SOC_I2C_SUPPORT_HW_CLR_BUS=y -CONFIG_SOC_I2C_SUPPORT_XTAL=y -CONFIG_SOC_I2C_SUPPORT_RTC=y -CONFIG_SOC_I2C_SUPPORT_10BIT_ADDR=y -CONFIG_SOC_I2C_SLAVE_SUPPORT_BROADCAST=y -CONFIG_SOC_I2C_SLAVE_CAN_GET_STRETCH_CAUSE=y -CONFIG_SOC_I2C_SLAVE_SUPPORT_I2CRAM_ACCESS=y -CONFIG_SOC_I2C_SLAVE_SUPPORT_SLAVE_UNMATCH=y -CONFIG_SOC_I2C_SUPPORT_SLEEP_RETENTION=y -CONFIG_SOC_LP_I2C_NUM=1 -CONFIG_SOC_LP_I2C_FIFO_LEN=16 -CONFIG_SOC_I2S_NUM=3 -CONFIG_SOC_I2S_HW_VERSION_2=y -CONFIG_SOC_I2S_SUPPORTS_ETM=y -CONFIG_SOC_I2S_SUPPORTS_XTAL=y -CONFIG_SOC_I2S_SUPPORTS_APLL=y -CONFIG_SOC_I2S_SUPPORTS_PCM=y -CONFIG_SOC_I2S_SUPPORTS_PDM=y -CONFIG_SOC_I2S_SUPPORTS_PDM_TX=y -CONFIG_SOC_I2S_SUPPORTS_PCM2PDM=y -CONFIG_SOC_I2S_SUPPORTS_PDM_RX=y -CONFIG_SOC_I2S_SUPPORTS_PDM2PCM=y -CONFIG_SOC_I2S_SUPPORTS_PDM_RX_HP_FILTER=y -CONFIG_SOC_I2S_SUPPORTS_TX_SYNC_CNT=y -CONFIG_SOC_I2S_SUPPORTS_TDM=y -CONFIG_SOC_I2S_PDM_MAX_TX_LINES=2 -CONFIG_SOC_I2S_PDM_MAX_RX_LINES=4 -CONFIG_SOC_I2S_TDM_FULL_DATA_WIDTH=y -CONFIG_SOC_I2S_SUPPORT_SLEEP_RETENTION=y -CONFIG_SOC_LP_I2S_NUM=1 -CONFIG_SOC_ISP_BF_SUPPORTED=y -CONFIG_SOC_ISP_BLC_SUPPORTED=y -CONFIG_SOC_ISP_CCM_SUPPORTED=y -CONFIG_SOC_ISP_COLOR_SUPPORTED=y -CONFIG_SOC_ISP_CROP_SUPPORTED=y -CONFIG_SOC_ISP_DEMOSAIC_SUPPORTED=y -CONFIG_SOC_ISP_DVP_SUPPORTED=y -CONFIG_SOC_ISP_LSC_SUPPORTED=y -CONFIG_SOC_ISP_SHARPEN_SUPPORTED=y -CONFIG_SOC_ISP_WBG_SUPPORTED=y -CONFIG_SOC_ISP_SHARE_CSI_BRG=y -CONFIG_SOC_ISP_NUMS=1 -CONFIG_SOC_ISP_DVP_CTLR_NUMS=1 -CONFIG_SOC_ISP_AE_CTLR_NUMS=1 -CONFIG_SOC_ISP_AE_BLOCK_X_NUMS=5 -CONFIG_SOC_ISP_AE_BLOCK_Y_NUMS=5 -CONFIG_SOC_ISP_AF_CTLR_NUMS=1 -CONFIG_SOC_ISP_AF_WINDOW_NUMS=3 -CONFIG_SOC_ISP_AWB_WINDOW_X_NUMS=5 -CONFIG_SOC_ISP_AWB_WINDOW_Y_NUMS=5 -CONFIG_SOC_ISP_BF_TEMPLATE_X_NUMS=3 -CONFIG_SOC_ISP_BF_TEMPLATE_Y_NUMS=3 -CONFIG_SOC_ISP_CCM_DIMENSION=3 -CONFIG_SOC_ISP_DEMOSAIC_GRAD_RATIO_INT_BITS=2 -CONFIG_SOC_ISP_DEMOSAIC_GRAD_RATIO_DEC_BITS=4 -CONFIG_SOC_ISP_DEMOSAIC_GRAD_RATIO_RES_BITS=26 -CONFIG_SOC_ISP_DVP_DATA_WIDTH_MAX=16 -CONFIG_SOC_ISP_SHARPEN_TEMPLATE_X_NUMS=3 -CONFIG_SOC_ISP_SHARPEN_TEMPLATE_Y_NUMS=3 -CONFIG_SOC_ISP_SHARPEN_H_FREQ_COEF_INT_BITS=3 -CONFIG_SOC_ISP_SHARPEN_H_FREQ_COEF_DEC_BITS=5 -CONFIG_SOC_ISP_SHARPEN_H_FREQ_COEF_RES_BITS=24 -CONFIG_SOC_ISP_SHARPEN_M_FREQ_COEF_INT_BITS=3 -CONFIG_SOC_ISP_SHARPEN_M_FREQ_COEF_DEC_BITS=5 -CONFIG_SOC_ISP_SHARPEN_M_FREQ_COEF_RES_BITS=24 -CONFIG_SOC_ISP_HIST_CTLR_NUMS=1 -CONFIG_SOC_ISP_HIST_BLOCK_X_NUMS=5 -CONFIG_SOC_ISP_HIST_BLOCK_Y_NUMS=5 -CONFIG_SOC_ISP_HIST_SEGMENT_NUMS=16 -CONFIG_SOC_ISP_HIST_INTERVAL_NUMS=15 -CONFIG_SOC_ISP_LSC_GRAD_RATIO_INT_BITS=2 -CONFIG_SOC_ISP_LSC_GRAD_RATIO_DEC_BITS=8 -CONFIG_SOC_ISP_LSC_GRAD_RATIO_RES_BITS=22 -CONFIG_SOC_LEDC_SUPPORT_PLL_DIV_CLOCK=y -CONFIG_SOC_LEDC_SUPPORT_XTAL_CLOCK=y -CONFIG_SOC_LEDC_TIMER_NUM=4 -CONFIG_SOC_LEDC_CHANNEL_NUM=8 -CONFIG_SOC_LEDC_TIMER_BIT_WIDTH=20 -CONFIG_SOC_LEDC_GAMMA_CURVE_FADE_SUPPORTED=y -CONFIG_SOC_LEDC_GAMMA_CURVE_FADE_RANGE_MAX=16 -CONFIG_SOC_LEDC_SUPPORT_FADE_STOP=y -CONFIG_SOC_LEDC_FADE_PARAMS_BIT_WIDTH=10 -CONFIG_SOC_LEDC_SUPPORT_SLEEP_RETENTION=y -CONFIG_SOC_MMU_PERIPH_NUM=2 -CONFIG_SOC_MMU_LINEAR_ADDRESS_REGION_NUM=2 -CONFIG_SOC_MMU_DI_VADDR_SHARED=y -CONFIG_SOC_MMU_PER_EXT_MEM_TARGET=y -CONFIG_SOC_MPU_MIN_REGION_SIZE=0x20000000 -CONFIG_SOC_MPU_REGIONS_MAX_NUM=8 -CONFIG_SOC_PCNT_GROUPS=1 -CONFIG_SOC_PCNT_UNITS_PER_GROUP=4 -CONFIG_SOC_PCNT_CHANNELS_PER_UNIT=2 -CONFIG_SOC_PCNT_THRES_POINT_PER_UNIT=2 -CONFIG_SOC_PCNT_SUPPORT_RUNTIME_THRES_UPDATE=y -CONFIG_SOC_PCNT_SUPPORT_CLEAR_SIGNAL=y -CONFIG_SOC_PCNT_SUPPORT_SLEEP_RETENTION=y -CONFIG_SOC_RMT_GROUPS=1 -CONFIG_SOC_RMT_TX_CANDIDATES_PER_GROUP=4 -CONFIG_SOC_RMT_RX_CANDIDATES_PER_GROUP=4 -CONFIG_SOC_RMT_CHANNELS_PER_GROUP=8 -CONFIG_SOC_RMT_MEM_WORDS_PER_CHANNEL=48 -CONFIG_SOC_RMT_SUPPORT_RX_PINGPONG=y -CONFIG_SOC_RMT_SUPPORT_RX_DEMODULATION=y -CONFIG_SOC_RMT_SUPPORT_ASYNC_STOP=y -CONFIG_SOC_RMT_SUPPORT_TX_LOOP_COUNT=y -CONFIG_SOC_RMT_SUPPORT_TX_LOOP_AUTO_STOP=y -CONFIG_SOC_RMT_SUPPORT_TX_SYNCHRO=y -CONFIG_SOC_RMT_SUPPORT_TX_CARRIER_DATA_ONLY=y -CONFIG_SOC_RMT_SUPPORT_XTAL=y -CONFIG_SOC_RMT_SUPPORT_RC_FAST=y -CONFIG_SOC_RMT_SUPPORT_DMA=y -CONFIG_SOC_RMT_SUPPORT_SLEEP_RETENTION=y -CONFIG_SOC_LCD_I80_SUPPORTED=y -CONFIG_SOC_LCD_RGB_SUPPORTED=y -CONFIG_SOC_LCDCAM_I80_NUM_BUSES=1 -CONFIG_SOC_LCDCAM_I80_BUS_WIDTH=24 -CONFIG_SOC_LCDCAM_RGB_NUM_PANELS=1 -CONFIG_SOC_LCDCAM_RGB_DATA_WIDTH=24 -CONFIG_SOC_LCD_SUPPORT_RGB_YUV_CONV=y -CONFIG_SOC_MCPWM_GROUPS=2 -CONFIG_SOC_MCPWM_TIMERS_PER_GROUP=3 -CONFIG_SOC_MCPWM_OPERATORS_PER_GROUP=3 -CONFIG_SOC_MCPWM_COMPARATORS_PER_OPERATOR=2 -CONFIG_SOC_MCPWM_EVENT_COMPARATORS_PER_OPERATOR=2 -CONFIG_SOC_MCPWM_GENERATORS_PER_OPERATOR=2 -CONFIG_SOC_MCPWM_TRIGGERS_PER_OPERATOR=2 -CONFIG_SOC_MCPWM_GPIO_FAULTS_PER_GROUP=3 -CONFIG_SOC_MCPWM_CAPTURE_TIMERS_PER_GROUP=y -CONFIG_SOC_MCPWM_CAPTURE_CHANNELS_PER_TIMER=3 -CONFIG_SOC_MCPWM_GPIO_SYNCHROS_PER_GROUP=3 -CONFIG_SOC_MCPWM_SWSYNC_CAN_PROPAGATE=y -CONFIG_SOC_MCPWM_SUPPORT_ETM=y -CONFIG_SOC_MCPWM_SUPPORT_EVENT_COMPARATOR=y -CONFIG_SOC_MCPWM_CAPTURE_CLK_FROM_GROUP=y -CONFIG_SOC_MCPWM_SUPPORT_SLEEP_RETENTION=y -CONFIG_SOC_USB_OTG_PERIPH_NUM=2 -CONFIG_SOC_USB_UTMI_PHY_NUM=1 -CONFIG_SOC_USB_UTMI_PHY_NO_POWER_OFF_ISO=y -CONFIG_SOC_PARLIO_GROUPS=1 -CONFIG_SOC_PARLIO_TX_UNITS_PER_GROUP=1 -CONFIG_SOC_PARLIO_RX_UNITS_PER_GROUP=1 -CONFIG_SOC_PARLIO_TX_UNIT_MAX_DATA_WIDTH=16 -CONFIG_SOC_PARLIO_RX_UNIT_MAX_DATA_WIDTH=16 -CONFIG_SOC_PARLIO_TX_CLK_SUPPORT_GATING=y -CONFIG_SOC_PARLIO_RX_CLK_SUPPORT_GATING=y -CONFIG_SOC_PARLIO_RX_CLK_SUPPORT_OUTPUT=y -CONFIG_SOC_PARLIO_TRANS_BIT_ALIGN=y -CONFIG_SOC_PARLIO_TX_SUPPORT_LOOP_TRANSMISSION=y -CONFIG_SOC_PARLIO_SUPPORT_SLEEP_RETENTION=y -CONFIG_SOC_PARLIO_SUPPORT_SPI_LCD=y -CONFIG_SOC_PARLIO_SUPPORT_I80_LCD=y -CONFIG_SOC_MPI_MEM_BLOCKS_NUM=4 -CONFIG_SOC_MPI_OPERATIONS_NUM=3 -CONFIG_SOC_RSA_MAX_BIT_LEN=4096 -CONFIG_SOC_SDMMC_USE_IOMUX=y -CONFIG_SOC_SDMMC_USE_GPIO_MATRIX=y -CONFIG_SOC_SDMMC_NUM_SLOTS=2 -CONFIG_SOC_SDMMC_DELAY_PHASE_NUM=4 -CONFIG_SOC_SDMMC_IO_POWER_EXTERNAL=y -CONFIG_SOC_SDMMC_PSRAM_DMA_CAPABLE=y -CONFIG_SOC_SDMMC_UHS_I_SUPPORTED=y -CONFIG_SOC_SHA_DMA_MAX_BUFFER_SIZE=3968 -CONFIG_SOC_SHA_SUPPORT_DMA=y -CONFIG_SOC_SHA_SUPPORT_RESUME=y -CONFIG_SOC_SHA_GDMA=y -CONFIG_SOC_SHA_SUPPORT_SHA1=y -CONFIG_SOC_SHA_SUPPORT_SHA224=y -CONFIG_SOC_SHA_SUPPORT_SHA256=y -CONFIG_SOC_SHA_SUPPORT_SHA384=y -CONFIG_SOC_SHA_SUPPORT_SHA512=y -CONFIG_SOC_SHA_SUPPORT_SHA512_224=y -CONFIG_SOC_SHA_SUPPORT_SHA512_256=y -CONFIG_SOC_SHA_SUPPORT_SHA512_T=y -CONFIG_SOC_ECC_CONSTANT_TIME_POINT_MUL=y -CONFIG_SOC_ECC_SUPPORT_CURVE_P384=y -CONFIG_SOC_ECDSA_SUPPORT_EXPORT_PUBKEY=y -CONFIG_SOC_ECDSA_SUPPORT_DETERMINISTIC_MODE=y -CONFIG_SOC_ECDSA_USES_MPI=y -CONFIG_SOC_SDM_GROUPS=1 -CONFIG_SOC_SDM_CHANNELS_PER_GROUP=8 -CONFIG_SOC_SDM_CLK_SUPPORT_PLL_F80M=y -CONFIG_SOC_SDM_CLK_SUPPORT_XTAL=y -CONFIG_SOC_SPI_PERIPH_NUM=3 -CONFIG_SOC_SPI_MAX_CS_NUM=6 -CONFIG_SOC_SPI_MAXIMUM_BUFFER_SIZE=64 -CONFIG_SOC_SPI_SUPPORT_SLEEP_RETENTION=y -CONFIG_SOC_SPI_SUPPORT_SLAVE_HD_VER2=y -CONFIG_SOC_SPI_SLAVE_SUPPORT_SEG_TRANS=y -CONFIG_SOC_SPI_SUPPORT_DDRCLK=y -CONFIG_SOC_SPI_SUPPORT_CD_SIG=y -CONFIG_SOC_SPI_SUPPORT_OCT=y -CONFIG_SOC_SPI_SUPPORT_CLK_XTAL=y -CONFIG_SOC_SPI_SUPPORT_CLK_RC_FAST=y -CONFIG_SOC_SPI_SUPPORT_CLK_SPLL=y -CONFIG_SOC_MSPI_HAS_INDEPENT_IOMUX=y -CONFIG_SOC_MEMSPI_IS_INDEPENDENT=y -CONFIG_SOC_SPI_MAX_PRE_DIVIDER=16 -CONFIG_SOC_LP_SPI_PERIPH_NUM=y -CONFIG_SOC_LP_SPI_MAXIMUM_BUFFER_SIZE=64 -CONFIG_SOC_SPIRAM_XIP_SUPPORTED=y -CONFIG_SOC_SPI_MEM_SUPPORT_AUTO_WAIT_IDLE=y -CONFIG_SOC_SPI_MEM_SUPPORT_AUTO_SUSPEND=y -CONFIG_SOC_SPI_MEM_SUPPORT_AUTO_RESUME=y -CONFIG_SOC_SPI_MEM_SUPPORT_IDLE_INTR=y -CONFIG_SOC_SPI_MEM_SUPPORT_SW_SUSPEND=y -CONFIG_SOC_SPI_MEM_SUPPORT_CHECK_SUS=y -CONFIG_SOC_SPI_MEM_SUPPORT_TIMING_TUNING=y -CONFIG_SOC_MEMSPI_TIMING_TUNING_BY_DQS=y -CONFIG_SOC_MEMSPI_TIMING_TUNING_BY_FLASH_DELAY=y -CONFIG_SOC_SPI_MEM_SUPPORT_CACHE_32BIT_ADDR_MAP=y -CONFIG_SOC_SPI_MEM_PSRAM_FREQ_AXI_CONSTRAINED=y -CONFIG_SOC_SPI_MEM_SUPPORT_TSUS_TRES_SEPERATE_CTR=y -CONFIG_SOC_SPI_PERIPH_SUPPORT_CONTROL_DUMMY_OUT=y -CONFIG_SOC_MEMSPI_SRC_FREQ_80M_SUPPORTED=y -CONFIG_SOC_MEMSPI_SRC_FREQ_40M_SUPPORTED=y -CONFIG_SOC_MEMSPI_SRC_FREQ_20M_SUPPORTED=y -CONFIG_SOC_MEMSPI_SRC_FREQ_120M_SUPPORTED=y -CONFIG_SOC_MEMSPI_FLASH_PSRAM_INDEPENDENT=y -CONFIG_SOC_SYSTIMER_COUNTER_NUM=2 -CONFIG_SOC_SYSTIMER_ALARM_NUM=3 -CONFIG_SOC_SYSTIMER_BIT_WIDTH_LO=32 -CONFIG_SOC_SYSTIMER_BIT_WIDTH_HI=20 -CONFIG_SOC_SYSTIMER_FIXED_DIVIDER=y -CONFIG_SOC_SYSTIMER_SUPPORT_RC_FAST=y -CONFIG_SOC_SYSTIMER_INT_LEVEL=y -CONFIG_SOC_SYSTIMER_ALARM_MISS_COMPENSATE=y -CONFIG_SOC_SYSTIMER_SUPPORT_ETM=y -CONFIG_SOC_LP_TIMER_BIT_WIDTH_LO=32 -CONFIG_SOC_LP_TIMER_BIT_WIDTH_HI=16 -CONFIG_SOC_TIMER_GROUPS=2 -CONFIG_SOC_TIMER_GROUP_TIMERS_PER_GROUP=2 -CONFIG_SOC_TIMER_GROUP_COUNTER_BIT_WIDTH=54 -CONFIG_SOC_TIMER_GROUP_SUPPORT_XTAL=y -CONFIG_SOC_TIMER_GROUP_SUPPORT_RC_FAST=y -CONFIG_SOC_TIMER_GROUP_TOTAL_TIMERS=4 -CONFIG_SOC_TIMER_SUPPORT_ETM=y -CONFIG_SOC_TIMER_SUPPORT_SLEEP_RETENTION=y -CONFIG_SOC_MWDT_SUPPORT_XTAL=y -CONFIG_SOC_MWDT_SUPPORT_SLEEP_RETENTION=y -CONFIG_SOC_TOUCH_SENSOR_VERSION=3 -CONFIG_SOC_TOUCH_SENSOR_NUM=14 -CONFIG_SOC_TOUCH_MIN_CHAN_ID=1 -CONFIG_SOC_TOUCH_MAX_CHAN_ID=14 -CONFIG_SOC_TOUCH_SUPPORT_SLEEP_WAKEUP=y -CONFIG_SOC_TOUCH_SUPPORT_BENCHMARK=y -CONFIG_SOC_TOUCH_SUPPORT_WATERPROOF=y -CONFIG_SOC_TOUCH_SUPPORT_PROX_SENSING=y -CONFIG_SOC_TOUCH_PROXIMITY_CHANNEL_NUM=3 -CONFIG_SOC_TOUCH_PROXIMITY_MEAS_DONE_SUPPORTED=y -CONFIG_SOC_TOUCH_SUPPORT_FREQ_HOP=y -CONFIG_SOC_TOUCH_SAMPLE_CFG_NUM=3 -CONFIG_SOC_TWAI_CONTROLLER_NUM=3 -CONFIG_SOC_TWAI_MASK_FILTER_NUM=1 -CONFIG_SOC_TWAI_CLK_SUPPORT_XTAL=y -CONFIG_SOC_TWAI_BRP_MIN=2 -CONFIG_SOC_TWAI_BRP_MAX=32768 -CONFIG_SOC_TWAI_SUPPORTS_RX_STATUS=y -CONFIG_SOC_TWAI_SUPPORT_SLEEP_RETENTION=y -CONFIG_SOC_EFUSE_DIS_PAD_JTAG=y -CONFIG_SOC_EFUSE_DIS_USB_JTAG=y -CONFIG_SOC_EFUSE_DIS_DIRECT_BOOT=y -CONFIG_SOC_EFUSE_SOFT_DIS_JTAG=y -CONFIG_SOC_EFUSE_DIS_DOWNLOAD_MSPI=y -CONFIG_SOC_EFUSE_ECDSA_KEY=y -CONFIG_SOC_KEY_MANAGER_SUPPORT_KEY_DEPLOYMENT=y -CONFIG_SOC_KEY_MANAGER_ECDSA_KEY_DEPLOY=y -CONFIG_SOC_KEY_MANAGER_FE_KEY_DEPLOY=y -CONFIG_SOC_KEY_MANAGER_FE_KEY_DEPLOY_XTS_AES_128=y -CONFIG_SOC_KEY_MANAGER_FE_KEY_DEPLOY_XTS_AES_256=y -CONFIG_SOC_SECURE_BOOT_V2_RSA=y -CONFIG_SOC_SECURE_BOOT_V2_ECC=y -CONFIG_SOC_EFUSE_SECURE_BOOT_KEY_DIGESTS=3 -CONFIG_SOC_EFUSE_REVOKE_BOOT_KEY_DIGESTS=y -CONFIG_SOC_SUPPORT_SECURE_BOOT_REVOKE_KEY=y -CONFIG_SOC_FLASH_ENCRYPTED_XTS_AES_BLOCK_MAX=64 -CONFIG_SOC_FLASH_ENCRYPTION_XTS_AES=y -CONFIG_SOC_FLASH_ENCRYPTION_XTS_AES_OPTIONS=y -CONFIG_SOC_FLASH_ENCRYPTION_XTS_AES_128=y -CONFIG_SOC_FLASH_ENCRYPTION_XTS_AES_256=y -CONFIG_SOC_FLASH_ENCRYPTION_XTS_AES_SUPPORT_PSEUDO_ROUND=y -CONFIG_SOC_UART_NUM=6 -CONFIG_SOC_UART_HP_NUM=5 -CONFIG_SOC_UART_LP_NUM=1 -CONFIG_SOC_UART_FIFO_LEN=128 -CONFIG_SOC_LP_UART_FIFO_LEN=16 -CONFIG_SOC_UART_BITRATE_MAX=5000000 -CONFIG_SOC_UART_SUPPORT_PLL_F80M_CLK=y -CONFIG_SOC_UART_SUPPORT_RTC_CLK=y -CONFIG_SOC_UART_SUPPORT_XTAL_CLK=y -CONFIG_SOC_UART_SUPPORT_WAKEUP_INT=y -CONFIG_SOC_UART_HAS_LP_UART=y -CONFIG_SOC_UART_SUPPORT_SLEEP_RETENTION=y -CONFIG_SOC_UART_SUPPORT_FSM_TX_WAIT_SEND=y -CONFIG_SOC_UART_WAKEUP_CHARS_SEQ_MAX_LEN=5 -CONFIG_SOC_UART_WAKEUP_SUPPORT_ACTIVE_THRESH_MODE=y -CONFIG_SOC_UART_WAKEUP_SUPPORT_FIFO_THRESH_MODE=y -CONFIG_SOC_UART_WAKEUP_SUPPORT_START_BIT_MODE=y -CONFIG_SOC_UART_WAKEUP_SUPPORT_CHAR_SEQ_MODE=y -CONFIG_SOC_LP_I2S_SUPPORT_VAD=y -CONFIG_SOC_UHCI_NUM=1 -CONFIG_SOC_COEX_HW_PTI=y -CONFIG_SOC_PHY_DIG_REGS_MEM_SIZE=21 -CONFIG_SOC_WIFI_LIGHT_SLEEP_CLK_WIDTH=12 -CONFIG_SOC_PM_SUPPORT_EXT1_WAKEUP=y -CONFIG_SOC_PM_SUPPORT_EXT1_WAKEUP_MODE_PER_PIN=y -CONFIG_SOC_PM_EXT1_WAKEUP_BY_PMU=y -CONFIG_SOC_PM_SUPPORT_WIFI_WAKEUP=y -CONFIG_SOC_PM_SUPPORT_TOUCH_SENSOR_WAKEUP=y -CONFIG_SOC_PM_SUPPORT_CPU_PD=y -CONFIG_SOC_PM_SUPPORT_XTAL32K_PD=y -CONFIG_SOC_PM_SUPPORT_RC32K_PD=y -CONFIG_SOC_PM_SUPPORT_RC_FAST_PD=y -CONFIG_SOC_PM_SUPPORT_VDDSDIO_PD=y -CONFIG_SOC_PM_SUPPORT_TOP_PD=y -CONFIG_SOC_PM_SUPPORT_CNNT_PD=y -CONFIG_SOC_PM_SUPPORT_RTC_PERIPH_PD=y -CONFIG_SOC_PM_SUPPORT_DEEPSLEEP_CHECK_STUB_ONLY=y -CONFIG_SOC_PM_CPU_RETENTION_BY_SW=y -CONFIG_SOC_PM_CACHE_RETENTION_BY_PAU=y -CONFIG_SOC_PM_PAU_LINK_NUM=4 -CONFIG_SOC_PM_PAU_REGDMA_LINK_MULTI_ADDR=y -CONFIG_SOC_PAU_IN_TOP_DOMAIN=y -CONFIG_SOC_PM_PAU_REGDMA_UPDATE_CACHE_BEFORE_WAIT_COMPARE=y -CONFIG_SOC_SLEEP_SYSTIMER_STALL_WORKAROUND=y -CONFIG_SOC_SLEEP_TGWDT_STOP_WORKAROUND=y -CONFIG_SOC_PM_RETENTION_MODULE_NUM=64 -CONFIG_SOC_PSRAM_VDD_POWER_MPLL=y -CONFIG_SOC_CLK_RC_FAST_SUPPORT_CALIBRATION=y -CONFIG_SOC_CLK_APLL_SUPPORTED=y -CONFIG_SOC_CLK_MPLL_SUPPORTED=y -CONFIG_SOC_CLK_SDIO_PLL_SUPPORTED=y -CONFIG_SOC_CLK_XTAL32K_SUPPORTED=y -CONFIG_SOC_CLK_RC32K_SUPPORTED=y -CONFIG_SOC_CLK_LP_FAST_SUPPORT_LP_PLL=y -CONFIG_SOC_CLK_LP_FAST_SUPPORT_XTAL=y -CONFIG_SOC_PERIPH_CLK_CTRL_SHARED=y -CONFIG_SOC_CLK_ANA_I2C_MST_HAS_ROOT_GATE=y -CONFIG_SOC_TEMPERATURE_SENSOR_LP_PLL_SUPPORT=y -CONFIG_SOC_TEMPERATURE_SENSOR_INTR_SUPPORT=y -CONFIG_SOC_TSENS_IS_INDEPENDENT_FROM_ADC=y -CONFIG_SOC_TEMPERATURE_SENSOR_SUPPORT_ETM=y -CONFIG_SOC_TEMPERATURE_SENSOR_SUPPORT_SLEEP_RETENTION=y -CONFIG_SOC_MEM_TCM_SUPPORTED=y -CONFIG_SOC_ASYNCHRONOUS_BUS_ERROR_MODE=y -CONFIG_SOC_EMAC_IEEE1588V2_SUPPORTED=y -CONFIG_SOC_EMAC_USE_MULTI_IO_MUX=y -CONFIG_SOC_EMAC_MII_USE_GPIO_MATRIX=y -CONFIG_SOC_JPEG_CODEC_SUPPORTED=y -CONFIG_SOC_JPEG_DECODE_SUPPORTED=y -CONFIG_SOC_JPEG_ENCODE_SUPPORTED=y -CONFIG_SOC_LCDCAM_CAM_SUPPORT_RGB_YUV_CONV=y -CONFIG_SOC_LCDCAM_CAM_PERIPH_NUM=1 -CONFIG_SOC_LCDCAM_CAM_DATA_WIDTH_MAX=16 -CONFIG_SOC_I3C_MASTER_PERIPH_NUM=y -CONFIG_SOC_I3C_MASTER_ADDRESS_TABLE_NUM=12 -CONFIG_SOC_I3C_MASTER_COMMAND_TABLE_NUM=12 -CONFIG_SOC_LP_CORE_SUPPORT_ETM=y -CONFIG_SOC_LP_CORE_SUPPORT_LP_ADC=y -CONFIG_SOC_LP_CORE_SUPPORT_LP_VAD=y -CONFIG_SOC_LP_CORE_SUPPORT_STORE_LOAD_EXCEPTIONS=y -CONFIG_IDF_CMAKE=y -CONFIG_IDF_TOOLCHAIN="gcc" -CONFIG_IDF_TOOLCHAIN_GCC=y -CONFIG_IDF_TARGET_ARCH_RISCV=y -CONFIG_IDF_TARGET_ARCH="riscv" -CONFIG_IDF_TARGET="esp32p4" -CONFIG_IDF_INIT_VERSION="5.5.1" -CONFIG_IDF_TARGET_ESP32P4=y -CONFIG_IDF_FIRMWARE_CHIP_ID=0x0012 - -# -# Build type -# -CONFIG_APP_BUILD_TYPE_APP_2NDBOOT=y -# CONFIG_APP_BUILD_TYPE_RAM is not set -CONFIG_APP_BUILD_GENERATE_BINARIES=y -CONFIG_APP_BUILD_BOOTLOADER=y -CONFIG_APP_BUILD_USE_FLASH_SECTIONS=y -# CONFIG_APP_REPRODUCIBLE_BUILD is not set -# CONFIG_APP_NO_BLOBS is not set -# end of Build type - -# -# Bootloader config -# - -# -# Bootloader manager -# -CONFIG_BOOTLOADER_COMPILE_TIME_DATE=y -CONFIG_BOOTLOADER_PROJECT_VER=1 -# end of Bootloader manager - -# -# Application Rollback -# -CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE=y -# CONFIG_BOOTLOADER_APP_ANTI_ROLLBACK is not set -# end of Application Rollback - -# -# Recovery Bootloader and Rollback -# -# end of Recovery Bootloader and Rollback - -CONFIG_BOOTLOADER_OFFSET_IN_FLASH=0x2000 -CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y -# CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_DEBUG is not set -# CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_PERF is not set - -# -# Log -# -CONFIG_BOOTLOADER_LOG_VERSION_1=y -CONFIG_BOOTLOADER_LOG_VERSION=1 -# CONFIG_BOOTLOADER_LOG_LEVEL_NONE is not set -# CONFIG_BOOTLOADER_LOG_LEVEL_ERROR is not set -# CONFIG_BOOTLOADER_LOG_LEVEL_WARN is not set -CONFIG_BOOTLOADER_LOG_LEVEL_INFO=y -# CONFIG_BOOTLOADER_LOG_LEVEL_DEBUG is not set -# CONFIG_BOOTLOADER_LOG_LEVEL_VERBOSE is not set -CONFIG_BOOTLOADER_LOG_LEVEL=3 - -# -# Format -# -# CONFIG_BOOTLOADER_LOG_COLORS is not set -CONFIG_BOOTLOADER_LOG_TIMESTAMP_SOURCE_CPU_TICKS=y -# end of Format - -# -# Settings -# -CONFIG_BOOTLOADER_LOG_MODE_TEXT_EN=y -CONFIG_BOOTLOADER_LOG_MODE_TEXT=y -# end of Settings -# end of Log - -# -# Serial Flash Configurations -# -# CONFIG_BOOTLOADER_FLASH_DC_AWARE is not set -CONFIG_BOOTLOADER_FLASH_XMC_SUPPORT=y -CONFIG_BOOTLOADER_FLASH_32BIT_ADDR=y -CONFIG_BOOTLOADER_FLASH_NEEDS_32BIT_FEAT=y -CONFIG_BOOTLOADER_FLASH_NEEDS_32BIT_ADDR_QUAD_FLASH=y -# end of Serial Flash Configurations - -# CONFIG_BOOTLOADER_FACTORY_RESET is not set -# CONFIG_BOOTLOADER_APP_TEST is not set -CONFIG_BOOTLOADER_REGION_PROTECTION_ENABLE=y -CONFIG_BOOTLOADER_WDT_ENABLE=y -# CONFIG_BOOTLOADER_WDT_DISABLE_IN_USER_CODE is not set -CONFIG_BOOTLOADER_WDT_TIME_MS=9000 -# CONFIG_BOOTLOADER_SKIP_VALIDATE_IN_DEEP_SLEEP is not set -# CONFIG_BOOTLOADER_SKIP_VALIDATE_ON_POWER_ON is not set -# CONFIG_BOOTLOADER_SKIP_VALIDATE_ALWAYS is not set -CONFIG_BOOTLOADER_RESERVE_RTC_SIZE=0 -# CONFIG_BOOTLOADER_CUSTOM_RESERVE_RTC is not set -# end of Bootloader config - -# -# Security features -# -CONFIG_SECURE_BOOT_V2_RSA_SUPPORTED=y -CONFIG_SECURE_BOOT_V2_ECC_SUPPORTED=y -CONFIG_SECURE_BOOT_V2_PREFERRED=y -# CONFIG_SECURE_SIGNED_APPS_NO_SECURE_BOOT is not set -# CONFIG_SECURE_BOOT is not set -# CONFIG_SECURE_FLASH_ENC_ENABLED is not set -CONFIG_SECURE_ROM_DL_MODE_ENABLED=y -# end of Security features - -# -# Application manager -# -CONFIG_APP_COMPILE_TIME_DATE=y -# CONFIG_APP_EXCLUDE_PROJECT_VER_VAR is not set -# CONFIG_APP_EXCLUDE_PROJECT_NAME_VAR is not set -# CONFIG_APP_PROJECT_VER_FROM_CONFIG is not set -CONFIG_APP_RETRIEVE_LEN_ELF_SHA=9 -# end of Application manager - -CONFIG_ESP_ROM_HAS_CRC_LE=y -CONFIG_ESP_ROM_HAS_CRC_BE=y -CONFIG_ESP_ROM_UART_CLK_IS_XTAL=y -CONFIG_ESP_ROM_USB_SERIAL_DEVICE_NUM=6 -CONFIG_ESP_ROM_USB_OTG_NUM=5 -CONFIG_ESP_ROM_HAS_RETARGETABLE_LOCKING=y -CONFIG_ESP_ROM_GET_CLK_FREQ=y -CONFIG_ESP_ROM_HAS_RVFPLIB=y -CONFIG_ESP_ROM_HAS_HAL_WDT=y -CONFIG_ESP_ROM_HAS_HAL_SYSTIMER=y -CONFIG_ESP_ROM_SYSTIMER_INIT_PATCH=y -CONFIG_ESP_ROM_HAS_LAYOUT_TABLE=y -CONFIG_ESP_ROM_WDT_INIT_PATCH=y -CONFIG_ESP_ROM_HAS_LP_ROM=y -CONFIG_ESP_ROM_WITHOUT_REGI2C=y -CONFIG_ESP_ROM_HAS_NEWLIB=y -CONFIG_ESP_ROM_HAS_NEWLIB_NANO_FORMAT=y -CONFIG_ESP_ROM_HAS_NEWLIB_NANO_PRINTF_FLOAT_BUG=y -CONFIG_ESP_ROM_HAS_VERSION=y -CONFIG_ESP_ROM_CLIC_INT_TYPE_PATCH=y -CONFIG_ESP_ROM_HAS_OUTPUT_PUTC_FUNC=y -CONFIG_ESP_ROM_HAS_SUBOPTIMAL_NEWLIB_ON_MISALIGNED_MEMORY=y - -# -# Boot ROM Behavior -# -CONFIG_BOOT_ROM_LOG_ALWAYS_ON=y -# CONFIG_BOOT_ROM_LOG_ALWAYS_OFF is not set -# CONFIG_BOOT_ROM_LOG_ON_GPIO_HIGH is not set -# CONFIG_BOOT_ROM_LOG_ON_GPIO_LOW is not set -# end of Boot ROM Behavior - -# -# Serial flasher config -# -# CONFIG_ESPTOOLPY_NO_STUB is not set -# CONFIG_ESPTOOLPY_FLASHMODE_QIO is not set -# CONFIG_ESPTOOLPY_FLASHMODE_QOUT is not set -CONFIG_ESPTOOLPY_FLASHMODE_DIO=y -# CONFIG_ESPTOOLPY_FLASHMODE_DOUT is not set -CONFIG_ESPTOOLPY_FLASH_SAMPLE_MODE_STR=y -CONFIG_ESPTOOLPY_FLASHMODE="dio" -CONFIG_ESPTOOLPY_FLASHFREQ_80M=y -# CONFIG_ESPTOOLPY_FLASHFREQ_40M is not set -# CONFIG_ESPTOOLPY_FLASHFREQ_20M is not set -CONFIG_ESPTOOLPY_FLASHFREQ_VAL=80 -CONFIG_ESPTOOLPY_FLASHFREQ="80m" -# CONFIG_ESPTOOLPY_FLASHSIZE_1MB is not set -# CONFIG_ESPTOOLPY_FLASHSIZE_2MB is not set -# CONFIG_ESPTOOLPY_FLASHSIZE_4MB is not set -# CONFIG_ESPTOOLPY_FLASHSIZE_8MB is not set -# CONFIG_ESPTOOLPY_FLASHSIZE_16MB is not set -CONFIG_ESPTOOLPY_FLASHSIZE_32MB=y -# CONFIG_ESPTOOLPY_FLASHSIZE_64MB is not set -# CONFIG_ESPTOOLPY_FLASHSIZE_128MB is not set -CONFIG_ESPTOOLPY_FLASHSIZE="32MB" -# CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE is not set -CONFIG_ESPTOOLPY_BEFORE_RESET=y -# CONFIG_ESPTOOLPY_BEFORE_NORESET is not set -CONFIG_ESPTOOLPY_BEFORE="default_reset" -CONFIG_ESPTOOLPY_AFTER_RESET=y -# CONFIG_ESPTOOLPY_AFTER_NORESET is not set -CONFIG_ESPTOOLPY_AFTER="hard_reset" -CONFIG_ESPTOOLPY_MONITOR_BAUD=115200 -# end of Serial flasher config - -# -# Partition Table -# -# CONFIG_PARTITION_TABLE_SINGLE_APP is not set -# CONFIG_PARTITION_TABLE_SINGLE_APP_LARGE is not set -# CONFIG_PARTITION_TABLE_TWO_OTA is not set -# CONFIG_PARTITION_TABLE_TWO_OTA_LARGE is not set -CONFIG_PARTITION_TABLE_CUSTOM=y -CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv" -CONFIG_PARTITION_TABLE_FILENAME="partitions.csv" -CONFIG_PARTITION_TABLE_OFFSET=0x8000 -CONFIG_PARTITION_TABLE_MD5=y -# end of Partition Table - -# -# Compiler options -# -CONFIG_COMPILER_OPTIMIZATION_DEBUG=y -# CONFIG_COMPILER_OPTIMIZATION_SIZE is not set -# CONFIG_COMPILER_OPTIMIZATION_PERF is not set -# CONFIG_COMPILER_OPTIMIZATION_NONE is not set -CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_ENABLE=y -# CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT is not set -# CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE is not set -CONFIG_COMPILER_ASSERT_NDEBUG_EVALUATE=y -# CONFIG_COMPILER_FLOAT_LIB_FROM_GCCLIB is not set -CONFIG_COMPILER_FLOAT_LIB_FROM_RVFPLIB=y -CONFIG_COMPILER_OPTIMIZATION_ASSERTION_LEVEL=2 -# CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT is not set -CONFIG_COMPILER_HIDE_PATHS_MACROS=y -# CONFIG_COMPILER_CXX_EXCEPTIONS is not set -# CONFIG_COMPILER_CXX_RTTI is not set -CONFIG_COMPILER_STACK_CHECK_MODE_NONE=y -# CONFIG_COMPILER_STACK_CHECK_MODE_NORM is not set -# CONFIG_COMPILER_STACK_CHECK_MODE_STRONG is not set -# CONFIG_COMPILER_STACK_CHECK_MODE_ALL is not set -# CONFIG_COMPILER_NO_MERGE_CONSTANTS is not set -# CONFIG_COMPILER_WARN_WRITE_STRINGS is not set -# CONFIG_COMPILER_SAVE_RESTORE_LIBCALLS is not set -CONFIG_COMPILER_DISABLE_DEFAULT_ERRORS=y -# CONFIG_COMPILER_DISABLE_GCC12_WARNINGS is not set -# CONFIG_COMPILER_DISABLE_GCC13_WARNINGS is not set -# CONFIG_COMPILER_DISABLE_GCC14_WARNINGS is not set -# CONFIG_COMPILER_DUMP_RTL_FILES is not set -CONFIG_COMPILER_RT_LIB_GCCLIB=y -CONFIG_COMPILER_RT_LIB_NAME="gcc" -CONFIG_COMPILER_ORPHAN_SECTIONS_WARNING=y -# CONFIG_COMPILER_ORPHAN_SECTIONS_PLACE is not set -# CONFIG_COMPILER_STATIC_ANALYZER is not set -# end of Compiler options - -# -# Component config -# - -# -# Application Level Tracing -# -# CONFIG_APPTRACE_DEST_JTAG is not set -CONFIG_APPTRACE_DEST_NONE=y -# CONFIG_APPTRACE_DEST_UART1 is not set -# CONFIG_APPTRACE_DEST_UART2 is not set -CONFIG_APPTRACE_DEST_UART_NONE=y -CONFIG_APPTRACE_UART_TASK_PRIO=1 -CONFIG_APPTRACE_LOCK_ENABLE=y -# end of Application Level Tracing - -# -# Bluetooth -# -# CONFIG_BT_ENABLED is not set - -# -# Common Options -# - -# -# BLE Log -# -# CONFIG_BLE_LOG_ENABLED is not set -# end of BLE Log - -# CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED is not set -# CONFIG_BT_BLE_LOG_UHCI_OUT_ENABLED is not set -# CONFIG_BT_LE_USED_MEM_STATISTICS_ENABLED is not set -# end of Common Options -# end of Bluetooth - -# -# Console Library -# -# CONFIG_CONSOLE_SORTED_HELP is not set -# end of Console Library - -# -# Driver Configurations -# - -# -# Legacy TWAI Driver Configurations -# -# CONFIG_TWAI_SKIP_LEGACY_CONFLICT_CHECK is not set -# end of Legacy TWAI Driver Configurations - -# -# Legacy ADC Driver Configuration -# -# CONFIG_ADC_SUPPRESS_DEPRECATE_WARN is not set -# CONFIG_ADC_SKIP_LEGACY_CONFLICT_CHECK is not set - -# -# Legacy ADC Calibration Configuration -# -# CONFIG_ADC_CALI_SUPPRESS_DEPRECATE_WARN is not set -# end of Legacy ADC Calibration Configuration -# end of Legacy ADC Driver Configuration - -# -# Legacy MCPWM Driver Configurations -# -# CONFIG_MCPWM_SUPPRESS_DEPRECATE_WARN is not set -# CONFIG_MCPWM_SKIP_LEGACY_CONFLICT_CHECK is not set -# end of Legacy MCPWM Driver Configurations - -# -# Legacy Timer Group Driver Configurations -# -# CONFIG_GPTIMER_SUPPRESS_DEPRECATE_WARN is not set -# CONFIG_GPTIMER_SKIP_LEGACY_CONFLICT_CHECK is not set -# end of Legacy Timer Group Driver Configurations - -# -# Legacy RMT Driver Configurations -# -# CONFIG_RMT_SUPPRESS_DEPRECATE_WARN is not set -# CONFIG_RMT_SKIP_LEGACY_CONFLICT_CHECK is not set -# end of Legacy RMT Driver Configurations - -# -# Legacy I2S Driver Configurations -# -# CONFIG_I2S_SUPPRESS_DEPRECATE_WARN is not set -# CONFIG_I2S_SKIP_LEGACY_CONFLICT_CHECK is not set -# end of Legacy I2S Driver Configurations - -# -# Legacy I2C Driver Configurations -# -# CONFIG_I2C_SKIP_LEGACY_CONFLICT_CHECK is not set -# end of Legacy I2C Driver Configurations - -# -# Legacy PCNT Driver Configurations -# -# CONFIG_PCNT_SUPPRESS_DEPRECATE_WARN is not set -# CONFIG_PCNT_SKIP_LEGACY_CONFLICT_CHECK is not set -# end of Legacy PCNT Driver Configurations - -# -# Legacy SDM Driver Configurations -# -# CONFIG_SDM_SUPPRESS_DEPRECATE_WARN is not set -# CONFIG_SDM_SKIP_LEGACY_CONFLICT_CHECK is not set -# end of Legacy SDM Driver Configurations - -# -# Legacy Temperature Sensor Driver Configurations -# -# CONFIG_TEMP_SENSOR_SUPPRESS_DEPRECATE_WARN is not set -# CONFIG_TEMP_SENSOR_SKIP_LEGACY_CONFLICT_CHECK is not set -# end of Legacy Temperature Sensor Driver Configurations - -# -# Legacy Touch Sensor Driver Configurations -# -# CONFIG_TOUCH_SUPPRESS_DEPRECATE_WARN is not set -# CONFIG_TOUCH_SKIP_LEGACY_CONFLICT_CHECK is not set -# end of Legacy Touch Sensor Driver Configurations -# end of Driver Configurations - -# -# eFuse Bit Manager -# -# CONFIG_EFUSE_CUSTOM_TABLE is not set -# CONFIG_EFUSE_VIRTUAL is not set -CONFIG_EFUSE_MAX_BLK_LEN=256 -# end of eFuse Bit Manager - -# -# ESP-TLS -# -CONFIG_ESP_TLS_USING_MBEDTLS=y -# CONFIG_ESP_TLS_USE_SECURE_ELEMENT is not set -CONFIG_ESP_TLS_USE_DS_PERIPHERAL=y -# CONFIG_ESP_TLS_CLIENT_SESSION_TICKETS is not set -# CONFIG_ESP_TLS_SERVER_SESSION_TICKETS is not set -# CONFIG_ESP_TLS_SERVER_CERT_SELECT_HOOK is not set -# CONFIG_ESP_TLS_SERVER_MIN_AUTH_MODE_OPTIONAL is not set -# CONFIG_ESP_TLS_PSK_VERIFICATION is not set -# CONFIG_ESP_TLS_INSECURE is not set -CONFIG_ESP_TLS_DYN_BUF_STRATEGY_SUPPORTED=y -# end of ESP-TLS - -# -# ADC and ADC Calibration -# -# CONFIG_ADC_ONESHOT_CTRL_FUNC_IN_IRAM is not set -# CONFIG_ADC_CONTINUOUS_ISR_IRAM_SAFE is not set -# CONFIG_ADC_ENABLE_DEBUG_LOG is not set -# end of ADC and ADC Calibration - -# -# Wireless Coexistence -# -# CONFIG_ESP_COEX_GPIO_DEBUG is not set -# end of Wireless Coexistence - -# -# Common ESP-related -# -CONFIG_ESP_ERR_TO_NAME_LOOKUP=y -# end of Common ESP-related - -# -# ESP-Driver:Analog Comparator Configurations -# -CONFIG_ANA_CMPR_ISR_HANDLER_IN_IRAM=y -# CONFIG_ANA_CMPR_CTRL_FUNC_IN_IRAM is not set -# CONFIG_ANA_CMPR_ISR_CACHE_SAFE is not set -CONFIG_ANA_CMPR_OBJ_CACHE_SAFE=y -# CONFIG_ANA_CMPR_ENABLE_DEBUG_LOG is not set -# end of ESP-Driver:Analog Comparator Configurations - -# -# ESP-Driver:BitScrambler Configurations -# -# CONFIG_BITSCRAMBLER_CTRL_FUNC_IN_IRAM is not set -# end of ESP-Driver:BitScrambler Configurations - -# -# ESP-Driver:Camera Controller Configurations -# -# CONFIG_CAM_CTLR_MIPI_CSI_ISR_CACHE_SAFE is not set -# CONFIG_CAM_CTLR_ISP_DVP_ISR_CACHE_SAFE is not set -# CONFIG_CAM_CTLR_DVP_CAM_ISR_CACHE_SAFE is not set -# end of ESP-Driver:Camera Controller Configurations - -# -# ESP-Driver:GPIO Configurations -# -# CONFIG_GPIO_CTRL_FUNC_IN_IRAM is not set -# end of ESP-Driver:GPIO Configurations - -# -# ESP-Driver:GPTimer Configurations -# -CONFIG_GPTIMER_ISR_HANDLER_IN_IRAM=y -# CONFIG_GPTIMER_CTRL_FUNC_IN_IRAM is not set -# CONFIG_GPTIMER_ISR_CACHE_SAFE is not set -CONFIG_GPTIMER_OBJ_CACHE_SAFE=y -# CONFIG_GPTIMER_ENABLE_DEBUG_LOG is not set -# end of ESP-Driver:GPTimer Configurations - -# -# ESP-Driver:I2C Configurations -# -# CONFIG_I2C_ISR_IRAM_SAFE is not set -# CONFIG_I2C_ENABLE_DEBUG_LOG is not set -# CONFIG_I2C_ENABLE_SLAVE_DRIVER_VERSION_2 is not set -CONFIG_I2C_MASTER_ISR_HANDLER_IN_IRAM=y -# end of ESP-Driver:I2C Configurations - -# -# ESP-Driver:I2S Configurations -# -# CONFIG_I2S_ISR_IRAM_SAFE is not set -# CONFIG_I2S_ENABLE_DEBUG_LOG is not set -# end of ESP-Driver:I2S Configurations - -# -# ESP-Driver:ISP Configurations -# -# CONFIG_ISP_ISR_IRAM_SAFE is not set -# CONFIG_ISP_CTRL_FUNC_IN_IRAM is not set -# end of ESP-Driver:ISP Configurations - -# -# ESP-Driver:JPEG-Codec Configurations -# -# CONFIG_JPEG_ENABLE_DEBUG_LOG is not set -# end of ESP-Driver:JPEG-Codec Configurations - -# -# ESP-Driver:LEDC Configurations -# -# CONFIG_LEDC_CTRL_FUNC_IN_IRAM is not set -# end of ESP-Driver:LEDC Configurations - -# -# ESP-Driver:MCPWM Configurations -# -CONFIG_MCPWM_ISR_HANDLER_IN_IRAM=y -# CONFIG_MCPWM_ISR_CACHE_SAFE is not set -# CONFIG_MCPWM_CTRL_FUNC_IN_IRAM is not set -CONFIG_MCPWM_OBJ_CACHE_SAFE=y -# CONFIG_MCPWM_ENABLE_DEBUG_LOG is not set -# end of ESP-Driver:MCPWM Configurations - -# -# ESP-Driver:Parallel IO Configurations -# -CONFIG_PARLIO_TX_ISR_HANDLER_IN_IRAM=y -CONFIG_PARLIO_RX_ISR_HANDLER_IN_IRAM=y -# CONFIG_PARLIO_TX_ISR_CACHE_SAFE is not set -# CONFIG_PARLIO_RX_ISR_CACHE_SAFE is not set -CONFIG_PARLIO_OBJ_CACHE_SAFE=y -# CONFIG_PARLIO_ENABLE_DEBUG_LOG is not set -# CONFIG_PARLIO_ISR_IRAM_SAFE is not set -# end of ESP-Driver:Parallel IO Configurations - -# -# ESP-Driver:PCNT Configurations -# -# CONFIG_PCNT_CTRL_FUNC_IN_IRAM is not set -# CONFIG_PCNT_ISR_IRAM_SAFE is not set -# CONFIG_PCNT_ENABLE_DEBUG_LOG is not set -# end of ESP-Driver:PCNT Configurations - -# -# ESP-Driver:RMT Configurations -# -CONFIG_RMT_ENCODER_FUNC_IN_IRAM=y -CONFIG_RMT_TX_ISR_HANDLER_IN_IRAM=y -CONFIG_RMT_RX_ISR_HANDLER_IN_IRAM=y -# CONFIG_RMT_RECV_FUNC_IN_IRAM is not set -# CONFIG_RMT_TX_ISR_CACHE_SAFE is not set -# CONFIG_RMT_RX_ISR_CACHE_SAFE is not set -CONFIG_RMT_OBJ_CACHE_SAFE=y -# CONFIG_RMT_ENABLE_DEBUG_LOG is not set -# CONFIG_RMT_ISR_IRAM_SAFE is not set -# end of ESP-Driver:RMT Configurations - -# -# ESP-Driver:Sigma Delta Modulator Configurations -# -# CONFIG_SDM_CTRL_FUNC_IN_IRAM is not set -# CONFIG_SDM_ENABLE_DEBUG_LOG is not set -# end of ESP-Driver:Sigma Delta Modulator Configurations - -# -# ESP-Driver:SPI Configurations -# -# CONFIG_SPI_MASTER_IN_IRAM is not set -CONFIG_SPI_MASTER_ISR_IN_IRAM=y -# CONFIG_SPI_SLAVE_IN_IRAM is not set -CONFIG_SPI_SLAVE_ISR_IN_IRAM=y -# end of ESP-Driver:SPI Configurations - -# -# ESP-Driver:Touch Sensor Configurations -# -# CONFIG_TOUCH_CTRL_FUNC_IN_IRAM is not set -# CONFIG_TOUCH_ISR_IRAM_SAFE is not set -# CONFIG_TOUCH_ENABLE_DEBUG_LOG is not set -# CONFIG_TOUCH_SKIP_FSM_CHECK is not set -# end of ESP-Driver:Touch Sensor Configurations - -# -# ESP-Driver:Temperature Sensor Configurations -# -# CONFIG_TEMP_SENSOR_ENABLE_DEBUG_LOG is not set -# CONFIG_TEMP_SENSOR_ISR_IRAM_SAFE is not set -# end of ESP-Driver:Temperature Sensor Configurations - -# -# ESP-Driver:TWAI Configurations -# -# CONFIG_TWAI_ISR_IN_IRAM is not set -# CONFIG_TWAI_IO_FUNC_IN_IRAM is not set -# CONFIG_TWAI_ISR_CACHE_SAFE is not set -# CONFIG_TWAI_ENABLE_DEBUG_LOG is not set -# end of ESP-Driver:TWAI Configurations - -# -# ESP-Driver:UART Configurations -# -# CONFIG_UART_ISR_IN_IRAM is not set -# end of ESP-Driver:UART Configurations - -# -# ESP-Driver:UHCI Configurations -# -# CONFIG_UHCI_ISR_HANDLER_IN_IRAM is not set -# CONFIG_UHCI_ISR_CACHE_SAFE is not set -# CONFIG_UHCI_ENABLE_DEBUG_LOG is not set -# end of ESP-Driver:UHCI Configurations - -# -# ESP-Driver:USB Serial/JTAG Configuration -# -CONFIG_USJ_ENABLE_USB_SERIAL_JTAG=y -# end of ESP-Driver:USB Serial/JTAG Configuration - -# -# Ethernet -# -CONFIG_ETH_ENABLED=y -CONFIG_ETH_USE_ESP32_EMAC=y -CONFIG_ETH_PHY_INTERFACE_RMII=y -CONFIG_ETH_DMA_BUFFER_SIZE=512 -CONFIG_ETH_DMA_RX_BUFFER_NUM=20 -CONFIG_ETH_DMA_TX_BUFFER_NUM=10 -# CONFIG_ETH_SOFT_FLOW_CONTROL is not set -# CONFIG_ETH_IRAM_OPTIMIZATION is not set -CONFIG_ETH_USE_SPI_ETHERNET=y -# CONFIG_ETH_SPI_ETHERNET_DM9051 is not set -# CONFIG_ETH_SPI_ETHERNET_W5500 is not set -# CONFIG_ETH_SPI_ETHERNET_KSZ8851SNL is not set -# CONFIG_ETH_USE_OPENETH is not set -# CONFIG_ETH_TRANSMIT_MUTEX is not set -# end of Ethernet - -# -# Event Loop Library -# -# CONFIG_ESP_EVENT_LOOP_PROFILING is not set -CONFIG_ESP_EVENT_POST_FROM_ISR=y -CONFIG_ESP_EVENT_POST_FROM_IRAM_ISR=y -# end of Event Loop Library - -# -# GDB Stub -# -CONFIG_ESP_GDBSTUB_ENABLED=y -# CONFIG_ESP_SYSTEM_GDBSTUB_RUNTIME is not set -CONFIG_ESP_GDBSTUB_SUPPORT_TASKS=y -CONFIG_ESP_GDBSTUB_MAX_TASKS=32 -# end of GDB Stub - -# -# ESP HID -# -CONFIG_ESPHID_TASK_SIZE_BT=2048 -CONFIG_ESPHID_TASK_SIZE_BLE=4096 -# end of ESP HID - -# -# ESP HTTP client -# -CONFIG_ESP_HTTP_CLIENT_ENABLE_HTTPS=y -# CONFIG_ESP_HTTP_CLIENT_ENABLE_BASIC_AUTH is not set -# CONFIG_ESP_HTTP_CLIENT_ENABLE_DIGEST_AUTH is not set -# CONFIG_ESP_HTTP_CLIENT_ENABLE_CUSTOM_TRANSPORT is not set -CONFIG_ESP_HTTP_CLIENT_EVENT_POST_TIMEOUT=2000 -# end of ESP HTTP client - -# -# HTTP Server -# -CONFIG_HTTPD_MAX_REQ_HDR_LEN=1024 -CONFIG_HTTPD_MAX_URI_LEN=512 -CONFIG_HTTPD_ERR_RESP_NO_DELAY=y -CONFIG_HTTPD_PURGE_BUF_LEN=32 -# CONFIG_HTTPD_LOG_PURGE_DATA is not set -# CONFIG_HTTPD_WS_SUPPORT is not set -# CONFIG_HTTPD_QUEUE_WORK_BLOCKING is not set -CONFIG_HTTPD_SERVER_EVENT_POST_TIMEOUT=2000 -# end of HTTP Server - -# -# ESP HTTPS OTA -# -# CONFIG_ESP_HTTPS_OTA_DECRYPT_CB is not set -# CONFIG_ESP_HTTPS_OTA_ALLOW_HTTP is not set -CONFIG_ESP_HTTPS_OTA_EVENT_POST_TIMEOUT=2000 -# end of ESP HTTPS OTA - -# -# ESP HTTPS server -# -# CONFIG_ESP_HTTPS_SERVER_ENABLE is not set -CONFIG_ESP_HTTPS_SERVER_EVENT_POST_TIMEOUT=2000 -# CONFIG_ESP_HTTPS_SERVER_CERT_SELECT_HOOK is not set -# end of ESP HTTPS server - -# -# Hardware Settings -# -CONFIG_ESP_HW_SUPPORT_FUNC_IN_IRAM=y - -# -# Chip revision -# - -# -# NOTE! Support of ESP32-P4 rev. <3.0 and >=3.0 is mutually exclusive -# - -# -# Read the help text of the option below for explanation -# -# CONFIG_ESP32P4_SELECTS_REV_LESS_V3 is not set -# CONFIG_ESP32P4_REV_MIN_300 is not set -CONFIG_ESP32P4_REV_MIN_301=y -CONFIG_ESP32P4_REV_MIN_FULL=301 -CONFIG_ESP_REV_MIN_FULL=301 - -# -# Maximum Supported ESP32-P4 Revision (Rev v3.99) -# -CONFIG_ESP32P4_REV_MAX_FULL=399 -CONFIG_ESP_REV_MAX_FULL=399 -CONFIG_ESP_EFUSE_BLOCK_REV_MIN_FULL=0 -CONFIG_ESP_EFUSE_BLOCK_REV_MAX_FULL=199 - -# -# Maximum Supported ESP32-P4 eFuse Block Revision (eFuse Block Rev v0.99) -# -# end of Chip revision - -# -# MAC Config -# -CONFIG_ESP_MAC_ADDR_UNIVERSE_ETH=y -CONFIG_ESP_MAC_UNIVERSAL_MAC_ADDRESSES_ONE=y -CONFIG_ESP_MAC_UNIVERSAL_MAC_ADDRESSES=1 -CONFIG_ESP32P4_UNIVERSAL_MAC_ADDRESSES_ONE=y -CONFIG_ESP32P4_UNIVERSAL_MAC_ADDRESSES=1 -# CONFIG_ESP_MAC_USE_CUSTOM_MAC_AS_BASE_MAC is not set -# end of MAC Config - -# -# Sleep Config -# -# CONFIG_ESP_SLEEP_POWER_DOWN_FLASH is not set -CONFIG_ESP_SLEEP_FLASH_LEAKAGE_WORKAROUND=y -# CONFIG_ESP_SLEEP_MSPI_NEED_ALL_IO_PU is not set -# CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND is not set -CONFIG_ESP_SLEEP_WAIT_FLASH_READY_EXTRA_DELAY=0 -# CONFIG_ESP_SLEEP_CACHE_SAFE_ASSERTION is not set -# CONFIG_ESP_SLEEP_DEBUG is not set -CONFIG_ESP_SLEEP_GPIO_ENABLE_INTERNAL_RESISTORS=y -# end of Sleep Config - -# -# RTC Clock Config -# -CONFIG_RTC_CLK_SRC_INT_RC=y -# CONFIG_RTC_CLK_SRC_EXT_CRYS is not set -CONFIG_RTC_CLK_CAL_CYCLES=1024 -CONFIG_RTC_FAST_CLK_SRC_RC_FAST=y -# CONFIG_RTC_FAST_CLK_SRC_XTAL is not set -CONFIG_RTC_CLK_FUNC_IN_IRAM=y -CONFIG_RTC_TIME_FUNC_IN_IRAM=y -# end of RTC Clock Config - -# -# Peripheral Control -# -CONFIG_ESP_PERIPH_CTRL_FUNC_IN_IRAM=y -CONFIG_ESP_REGI2C_CTRL_FUNC_IN_IRAM=y -# end of Peripheral Control - -# -# ETM Configuration -# -# CONFIG_ETM_ENABLE_DEBUG_LOG is not set -# end of ETM Configuration - -# -# GDMA Configurations -# -CONFIG_GDMA_CTRL_FUNC_IN_IRAM=y -CONFIG_GDMA_ISR_HANDLER_IN_IRAM=y -CONFIG_GDMA_OBJ_DRAM_SAFE=y -# CONFIG_GDMA_ENABLE_DEBUG_LOG is not set -# CONFIG_GDMA_ISR_IRAM_SAFE is not set -# end of GDMA Configurations - -# -# DW_GDMA Configurations -# -# CONFIG_DW_GDMA_ENABLE_DEBUG_LOG is not set -# end of DW_GDMA Configurations - -# -# 2D-DMA Configurations -# -# CONFIG_DMA2D_OPERATION_FUNC_IN_IRAM is not set -# CONFIG_DMA2D_ISR_IRAM_SAFE is not set -# end of 2D-DMA Configurations - -# -# Main XTAL Config -# -CONFIG_XTAL_FREQ_40=y -CONFIG_XTAL_FREQ=40 -# end of Main XTAL Config - -# -# DCDC Regulator Configurations -# -CONFIG_ESP_SLEEP_DCM_VSET_VAL_IN_SLEEP=14 -# end of DCDC Regulator Configurations - -# -# LDO Regulator Configurations -# -CONFIG_ESP_LDO_RESERVE_SPI_NOR_FLASH=y -CONFIG_ESP_LDO_CHAN_SPI_NOR_FLASH_DOMAIN=1 -CONFIG_ESP_LDO_VOLTAGE_SPI_NOR_FLASH_3300_MV=y -CONFIG_ESP_LDO_VOLTAGE_SPI_NOR_FLASH_DOMAIN=3300 -CONFIG_ESP_LDO_RESERVE_PSRAM=y -CONFIG_ESP_LDO_CHAN_PSRAM_DOMAIN=2 -CONFIG_ESP_LDO_VOLTAGE_PSRAM_1800_MV=y -CONFIG_ESP_LDO_VOLTAGE_PSRAM_DOMAIN=1800 -# end of LDO Regulator Configurations - -# -# Power Supplier -# - -# -# Brownout Detector -# -CONFIG_ESP_BROWNOUT_DET=y -CONFIG_ESP_BROWNOUT_DET_LVL_SEL_7=y -# CONFIG_ESP_BROWNOUT_DET_LVL_SEL_6 is not set -# CONFIG_ESP_BROWNOUT_DET_LVL_SEL_5 is not set -CONFIG_ESP_BROWNOUT_DET_LVL=7 -CONFIG_ESP_BROWNOUT_USE_INTR=y -# end of Brownout Detector - -# -# RTC Backup Battery -# -# CONFIG_ESP_VBAT_INIT_AUTO is not set -# CONFIG_ESP_VBAT_WAKEUP_CHIP_ON_VBAT_BROWNOUT is not set -# end of RTC Backup Battery -# end of Power Supplier - -CONFIG_ESP_SPI_BUS_LOCK_ISR_FUNCS_IN_IRAM=y -CONFIG_ESP_ENABLE_PVT=y -CONFIG_ESP_INTR_IN_IRAM=y -CONFIG_P4_REV3_MSPI_WORKAROUND_SIZE=0 -# end of Hardware Settings - -# -# ESP-Driver:LCD Controller Configurations -# -# CONFIG_LCD_RGB_ISR_IRAM_SAFE is not set -# CONFIG_LCD_RGB_RESTART_IN_VSYNC is not set -CONFIG_LCD_DSI_ISR_HANDLER_IN_IRAM=y -# CONFIG_LCD_DSI_ISR_CACHE_SAFE is not set -CONFIG_LCD_DSI_OBJ_FORCE_INTERNAL=y -# CONFIG_LCD_ENABLE_DEBUG_LOG is not set -# end of ESP-Driver:LCD Controller Configurations - -# -# ESP-MM: Memory Management Configurations -# -# CONFIG_ESP_MM_CACHE_MSYNC_C2M_CHUNKED_OPS is not set -# end of ESP-MM: Memory Management Configurations - -# -# ESP NETIF Adapter -# -CONFIG_ESP_NETIF_IP_LOST_TIMER_INTERVAL=120 -# CONFIG_ESP_NETIF_PROVIDE_CUSTOM_IMPLEMENTATION is not set -CONFIG_ESP_NETIF_TCPIP_LWIP=y -# CONFIG_ESP_NETIF_LOOPBACK is not set -CONFIG_ESP_NETIF_USES_TCPIP_WITH_BSD_API=y -CONFIG_ESP_NETIF_REPORT_DATA_TRAFFIC=y -# CONFIG_ESP_NETIF_RECEIVE_REPORT_ERRORS is not set -# CONFIG_ESP_NETIF_L2_TAP is not set -# CONFIG_ESP_NETIF_BRIDGE_EN is not set -# CONFIG_ESP_NETIF_SET_DNS_PER_DEFAULT_NETIF is not set -# end of ESP NETIF Adapter - -# -# Partition API Configuration -# -# end of Partition API Configuration - -# -# PHY -# -# end of PHY - -# -# Power Management -# -CONFIG_PM_SLEEP_FUNC_IN_IRAM=y -# CONFIG_PM_ENABLE is not set -CONFIG_PM_SLP_IRAM_OPT=y -CONFIG_PM_POWER_DOWN_CPU_IN_LIGHT_SLEEP=y -# CONFIG_PM_POWER_DOWN_PERIPHERAL_IN_LIGHT_SLEEP is not set -# end of Power Management - -# -# ESP PSRAM -# -# CONFIG_SPIRAM is not set -# end of ESP PSRAM - -# -# ESP Ringbuf -# -# CONFIG_RINGBUF_PLACE_FUNCTIONS_INTO_FLASH is not set -# end of ESP Ringbuf - -# -# ESP-ROM -# -CONFIG_ESP_ROM_PRINT_IN_IRAM=y -# end of ESP-ROM - -# -# ESP Security Specific -# -# CONFIG_ESP_CRYPTO_FORCE_ECC_CONSTANT_TIME_POINT_MUL is not set -# end of ESP Security Specific - -# -# ESP System Settings -# -CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_400=y -CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ=400 - -# -# Cache config -# -CONFIG_CACHE_L2_CACHE_128KB=y -# CONFIG_CACHE_L2_CACHE_256KB is not set -# CONFIG_CACHE_L2_CACHE_512KB is not set -CONFIG_CACHE_L2_CACHE_SIZE=0x20000 -CONFIG_CACHE_L2_CACHE_LINE_64B=y -# CONFIG_CACHE_L2_CACHE_LINE_128B is not set -CONFIG_CACHE_L2_CACHE_LINE_SIZE=64 -CONFIG_CACHE_L1_CACHE_LINE_SIZE=64 -# end of Cache config - -CONFIG_ESP_SYSTEM_IN_IRAM=y -# CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT is not set -CONFIG_ESP_SYSTEM_PANIC_PRINT_REBOOT=y -# CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT is not set -# CONFIG_ESP_SYSTEM_PANIC_GDBSTUB is not set -CONFIG_ESP_SYSTEM_PANIC_REBOOT_DELAY_SECONDS=0 -CONFIG_ESP_SYSTEM_RTC_FAST_MEM_AS_HEAP_DEPCHECK=y -CONFIG_ESP_SYSTEM_ALLOW_RTC_FAST_MEM_AS_HEAP=y -CONFIG_ESP_SYSTEM_NO_BACKTRACE=y -# CONFIG_ESP_SYSTEM_USE_EH_FRAME is not set -# CONFIG_ESP_SYSTEM_USE_FRAME_POINTER is not set - -# -# Memory protection -# -CONFIG_ESP_SYSTEM_PMP_IDRAM_SPLIT=y -# CONFIG_ESP_SYSTEM_PMP_LP_CORE_RESERVE_MEM_EXECUTABLE is not set -# end of Memory protection - -CONFIG_ESP_SYSTEM_EVENT_QUEUE_SIZE=32 -CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=2304 -CONFIG_ESP_MAIN_TASK_STACK_SIZE=8192 -CONFIG_ESP_MAIN_TASK_AFFINITY_CPU0=y -# CONFIG_ESP_MAIN_TASK_AFFINITY_CPU1 is not set -# CONFIG_ESP_MAIN_TASK_AFFINITY_NO_AFFINITY is not set -CONFIG_ESP_MAIN_TASK_AFFINITY=0x0 -CONFIG_ESP_MINIMAL_SHARED_STACK_SIZE=2048 -CONFIG_ESP_CONSOLE_UART_DEFAULT=y -# CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG is not set -# CONFIG_ESP_CONSOLE_UART_CUSTOM is not set -# CONFIG_ESP_CONSOLE_NONE is not set -# CONFIG_ESP_CONSOLE_SECONDARY_NONE is not set -CONFIG_ESP_CONSOLE_SECONDARY_USB_SERIAL_JTAG=y -CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG_ENABLED=y -CONFIG_ESP_CONSOLE_UART=y -CONFIG_ESP_CONSOLE_UART_NUM=0 -CONFIG_ESP_CONSOLE_ROM_SERIAL_PORT_NUM=0 -CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200 -CONFIG_ESP_INT_WDT=y -CONFIG_ESP_INT_WDT_TIMEOUT_MS=300 -CONFIG_ESP_INT_WDT_CHECK_CPU1=y -CONFIG_ESP_TASK_WDT_EN=y -CONFIG_ESP_TASK_WDT_INIT=y -# CONFIG_ESP_TASK_WDT_PANIC is not set -CONFIG_ESP_TASK_WDT_TIMEOUT_S=5 -CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0=y -CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU1=y -# CONFIG_ESP_PANIC_HANDLER_IRAM is not set -# CONFIG_ESP_DEBUG_STUBS_ENABLE is not set -CONFIG_ESP_DEBUG_OCDAWARE=y -CONFIG_ESP_SYSTEM_CHECK_INT_LEVEL_4=y -CONFIG_ESP_SYSTEM_HW_STACK_GUARD=y -CONFIG_ESP_SYSTEM_HW_PC_RECORD=y -# end of ESP System Settings - -# -# IPC (Inter-Processor Call) -# -CONFIG_ESP_IPC_ENABLE=y -CONFIG_ESP_IPC_TASK_STACK_SIZE=1024 -CONFIG_ESP_IPC_USES_CALLERS_PRIORITY=y -CONFIG_ESP_IPC_ISR_ENABLE=y -# end of IPC (Inter-Processor Call) - -# -# ESP Timer (High Resolution Timer) -# -CONFIG_ESP_TIMER_IN_IRAM=y -# CONFIG_ESP_TIMER_PROFILING is not set -CONFIG_ESP_TIME_FUNCS_USE_RTC_TIMER=y -CONFIG_ESP_TIME_FUNCS_USE_ESP_TIMER=y -CONFIG_ESP_TIMER_TASK_STACK_SIZE=3584 -CONFIG_ESP_TIMER_INTERRUPT_LEVEL=1 -# CONFIG_ESP_TIMER_SHOW_EXPERIMENTAL is not set -CONFIG_ESP_TIMER_TASK_AFFINITY=0x0 -CONFIG_ESP_TIMER_TASK_AFFINITY_CPU0=y -CONFIG_ESP_TIMER_ISR_AFFINITY_CPU0=y -# CONFIG_ESP_TIMER_SUPPORTS_ISR_DISPATCH_METHOD is not set -CONFIG_ESP_TIMER_IMPL_SYSTIMER=y -# end of ESP Timer (High Resolution Timer) - -# -# Wi-Fi -# -# CONFIG_ESP_HOST_WIFI_ENABLED is not set -# end of Wi-Fi - -# -# Core dump -# -# CONFIG_ESP_COREDUMP_ENABLE_TO_FLASH is not set -# CONFIG_ESP_COREDUMP_ENABLE_TO_UART is not set -CONFIG_ESP_COREDUMP_ENABLE_TO_NONE=y -# end of Core dump - -# -# FAT Filesystem support -# -CONFIG_FATFS_VOLUME_COUNT=2 -# CONFIG_FATFS_LFN_NONE is not set -CONFIG_FATFS_LFN_HEAP=y -# CONFIG_FATFS_LFN_STACK is not set -# CONFIG_FATFS_SECTOR_512 is not set -CONFIG_FATFS_SECTOR_4096=y -# CONFIG_FATFS_CODEPAGE_DYNAMIC is not set -CONFIG_FATFS_CODEPAGE_437=y -# CONFIG_FATFS_CODEPAGE_720 is not set -# CONFIG_FATFS_CODEPAGE_737 is not set -# CONFIG_FATFS_CODEPAGE_771 is not set -# CONFIG_FATFS_CODEPAGE_775 is not set -# CONFIG_FATFS_CODEPAGE_850 is not set -# CONFIG_FATFS_CODEPAGE_852 is not set -# CONFIG_FATFS_CODEPAGE_855 is not set -# CONFIG_FATFS_CODEPAGE_857 is not set -# CONFIG_FATFS_CODEPAGE_860 is not set -# CONFIG_FATFS_CODEPAGE_861 is not set -# CONFIG_FATFS_CODEPAGE_862 is not set -# CONFIG_FATFS_CODEPAGE_863 is not set -# CONFIG_FATFS_CODEPAGE_864 is not set -# CONFIG_FATFS_CODEPAGE_865 is not set -# CONFIG_FATFS_CODEPAGE_866 is not set -# CONFIG_FATFS_CODEPAGE_869 is not set -# CONFIG_FATFS_CODEPAGE_932 is not set -# CONFIG_FATFS_CODEPAGE_936 is not set -# CONFIG_FATFS_CODEPAGE_949 is not set -# CONFIG_FATFS_CODEPAGE_950 is not set -CONFIG_FATFS_CODEPAGE=437 -CONFIG_FATFS_MAX_LFN=255 -CONFIG_FATFS_API_ENCODING_ANSI_OEM=y -# CONFIG_FATFS_API_ENCODING_UTF_8 is not set -CONFIG_FATFS_FS_LOCK=0 -CONFIG_FATFS_TIMEOUT_MS=10000 -CONFIG_FATFS_PER_FILE_CACHE=y -# CONFIG_FATFS_USE_FASTSEEK is not set -CONFIG_FATFS_USE_STRFUNC_NONE=y -# CONFIG_FATFS_USE_STRFUNC_WITHOUT_CRLF_CONV is not set -# CONFIG_FATFS_USE_STRFUNC_WITH_CRLF_CONV is not set -CONFIG_FATFS_VFS_FSTAT_BLKSIZE=0 -# CONFIG_FATFS_IMMEDIATE_FSYNC is not set -# CONFIG_FATFS_USE_LABEL is not set -CONFIG_FATFS_LINK_LOCK=y -# CONFIG_FATFS_USE_DYN_BUFFERS is not set - -# -# File system free space calculation behavior -# -CONFIG_FATFS_DONT_TRUST_FREE_CLUSTER_CNT=0 -CONFIG_FATFS_DONT_TRUST_LAST_ALLOC=0 -# end of File system free space calculation behavior -# end of FAT Filesystem support - -# -# FreeRTOS -# - -# -# Kernel -# -# CONFIG_FREERTOS_UNICORE is not set -CONFIG_FREERTOS_HZ=100 -# CONFIG_FREERTOS_CHECK_STACKOVERFLOW_NONE is not set -# CONFIG_FREERTOS_CHECK_STACKOVERFLOW_PTRVAL is not set -CONFIG_FREERTOS_CHECK_STACKOVERFLOW_CANARY=y -CONFIG_FREERTOS_THREAD_LOCAL_STORAGE_POINTERS=1 -CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=1536 -# CONFIG_FREERTOS_USE_IDLE_HOOK is not set -# CONFIG_FREERTOS_USE_TICK_HOOK is not set -CONFIG_FREERTOS_MAX_TASK_NAME_LEN=16 -# CONFIG_FREERTOS_ENABLE_BACKWARD_COMPATIBILITY is not set -CONFIG_FREERTOS_USE_TIMERS=y -CONFIG_FREERTOS_TIMER_SERVICE_TASK_NAME="Tmr Svc" -# CONFIG_FREERTOS_TIMER_TASK_AFFINITY_CPU0 is not set -# CONFIG_FREERTOS_TIMER_TASK_AFFINITY_CPU1 is not set -CONFIG_FREERTOS_TIMER_TASK_NO_AFFINITY=y -CONFIG_FREERTOS_TIMER_SERVICE_TASK_CORE_AFFINITY=0x7FFFFFFF -CONFIG_FREERTOS_TIMER_TASK_PRIORITY=1 -CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH=2048 -CONFIG_FREERTOS_TIMER_QUEUE_LENGTH=10 -CONFIG_FREERTOS_QUEUE_REGISTRY_SIZE=0 -CONFIG_FREERTOS_TASK_NOTIFICATION_ARRAY_ENTRIES=1 -CONFIG_FREERTOS_USE_TRACE_FACILITY=y -CONFIG_FREERTOS_USE_STATS_FORMATTING_FUNCTIONS=y -# CONFIG_FREERTOS_USE_LIST_DATA_INTEGRITY_CHECK_BYTES is not set -# CONFIG_FREERTOS_VTASKLIST_INCLUDE_COREID is not set -# CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS is not set -# CONFIG_FREERTOS_USE_APPLICATION_TASK_TAG is not set -# end of Kernel - -# -# Port -# -CONFIG_FREERTOS_TASK_FUNCTION_WRAPPER=y -# CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK is not set -CONFIG_FREERTOS_TLSP_DELETION_CALLBACKS=y -# CONFIG_FREERTOS_TASK_PRE_DELETION_HOOK is not set -# CONFIG_FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP is not set -CONFIG_FREERTOS_CHECK_MUTEX_GIVEN_BY_OWNER=y -CONFIG_FREERTOS_ISR_STACKSIZE=1536 -CONFIG_FREERTOS_INTERRUPT_BACKTRACE=y -CONFIG_FREERTOS_TICK_SUPPORT_SYSTIMER=y -CONFIG_FREERTOS_CORETIMER_SYSTIMER_LVL1=y -# CONFIG_FREERTOS_CORETIMER_SYSTIMER_LVL3 is not set -CONFIG_FREERTOS_SYSTICK_USES_SYSTIMER=y -# CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH is not set -# CONFIG_FREERTOS_CHECK_PORT_CRITICAL_COMPLIANCE is not set -# end of Port - -# -# Extra -# -# end of Extra - -CONFIG_FREERTOS_PORT=y -CONFIG_FREERTOS_NO_AFFINITY=0x7FFFFFFF -CONFIG_FREERTOS_SUPPORT_STATIC_ALLOCATION=y -CONFIG_FREERTOS_DEBUG_OCDAWARE=y -CONFIG_FREERTOS_ENABLE_TASK_SNAPSHOT=y -CONFIG_FREERTOS_PLACE_SNAPSHOT_FUNS_INTO_FLASH=y -CONFIG_FREERTOS_NUMBER_OF_CORES=2 -CONFIG_FREERTOS_IN_IRAM=y -# end of FreeRTOS - -# -# Hardware Abstraction Layer (HAL) and Low Level (LL) -# -CONFIG_HAL_ASSERTION_EQUALS_SYSTEM=y -# CONFIG_HAL_ASSERTION_DISABLE is not set -# CONFIG_HAL_ASSERTION_SILENT is not set -# CONFIG_HAL_ASSERTION_ENABLE is not set -CONFIG_HAL_DEFAULT_ASSERTION_LEVEL=2 -CONFIG_HAL_SYSTIMER_USE_ROM_IMPL=y -CONFIG_HAL_WDT_USE_ROM_IMPL=y -# end of Hardware Abstraction Layer (HAL) and Low Level (LL) - -# -# Heap memory debugging -# -CONFIG_HEAP_POISONING_DISABLED=y -# CONFIG_HEAP_POISONING_LIGHT is not set -# CONFIG_HEAP_POISONING_COMPREHENSIVE is not set -CONFIG_HEAP_TRACING_OFF=y -# CONFIG_HEAP_TRACING_STANDALONE is not set -# CONFIG_HEAP_TRACING_TOHOST is not set -# CONFIG_HEAP_USE_HOOKS is not set -# CONFIG_HEAP_TASK_TRACKING is not set -# CONFIG_HEAP_ABORT_WHEN_ALLOCATION_FAILS is not set -# CONFIG_HEAP_PLACE_FUNCTION_INTO_FLASH is not set -# end of Heap memory debugging - -# -# Log -# -CONFIG_LOG_VERSION_1=y -# CONFIG_LOG_VERSION_2 is not set -CONFIG_LOG_VERSION=1 - -# -# Log Level -# -# CONFIG_LOG_DEFAULT_LEVEL_NONE is not set -# CONFIG_LOG_DEFAULT_LEVEL_ERROR is not set -# CONFIG_LOG_DEFAULT_LEVEL_WARN is not set -CONFIG_LOG_DEFAULT_LEVEL_INFO=y -# CONFIG_LOG_DEFAULT_LEVEL_DEBUG is not set -# CONFIG_LOG_DEFAULT_LEVEL_VERBOSE is not set -CONFIG_LOG_DEFAULT_LEVEL=3 -CONFIG_LOG_MAXIMUM_EQUALS_DEFAULT=y -# CONFIG_LOG_MAXIMUM_LEVEL_DEBUG is not set -# CONFIG_LOG_MAXIMUM_LEVEL_VERBOSE is not set -CONFIG_LOG_MAXIMUM_LEVEL=3 - -# -# Level Settings -# -# CONFIG_LOG_MASTER_LEVEL is not set -CONFIG_LOG_DYNAMIC_LEVEL_CONTROL=y -# CONFIG_LOG_TAG_LEVEL_IMPL_NONE is not set -# CONFIG_LOG_TAG_LEVEL_IMPL_LINKED_LIST is not set -CONFIG_LOG_TAG_LEVEL_IMPL_CACHE_AND_LINKED_LIST=y -# CONFIG_LOG_TAG_LEVEL_CACHE_ARRAY is not set -CONFIG_LOG_TAG_LEVEL_CACHE_BINARY_MIN_HEAP=y -CONFIG_LOG_TAG_LEVEL_IMPL_CACHE_SIZE=31 -# end of Level Settings -# end of Log Level - -# -# Format -# -# CONFIG_LOG_COLORS is not set -CONFIG_LOG_TIMESTAMP_SOURCE_RTOS=y -# CONFIG_LOG_TIMESTAMP_SOURCE_SYSTEM is not set -# end of Format - -# -# Settings -# -CONFIG_LOG_MODE_TEXT_EN=y -CONFIG_LOG_MODE_TEXT=y -# end of Settings - -CONFIG_LOG_IN_IRAM=y -# end of Log - -# -# LWIP -# -CONFIG_LWIP_ENABLE=y -CONFIG_LWIP_LOCAL_HOSTNAME="espressif" -CONFIG_LWIP_TCPIP_TASK_PRIO=18 -# CONFIG_LWIP_TCPIP_CORE_LOCKING is not set -# CONFIG_LWIP_CHECK_THREAD_SAFETY is not set -CONFIG_LWIP_DNS_SUPPORT_MDNS_QUERIES=y -# CONFIG_LWIP_L2_TO_L3_COPY is not set -# CONFIG_LWIP_IRAM_OPTIMIZATION is not set -# CONFIG_LWIP_EXTRA_IRAM_OPTIMIZATION is not set -CONFIG_LWIP_TIMERS_ONDEMAND=y -CONFIG_LWIP_ND6=y -# CONFIG_LWIP_FORCE_ROUTER_FORWARDING is not set -CONFIG_LWIP_MAX_SOCKETS=10 -# CONFIG_LWIP_USE_ONLY_LWIP_SELECT is not set -# CONFIG_LWIP_SO_LINGER is not set -CONFIG_LWIP_SO_REUSE=y -CONFIG_LWIP_SO_REUSE_RXTOALL=y -# CONFIG_LWIP_SO_RCVBUF is not set -# CONFIG_LWIP_NETBUF_RECVINFO is not set -CONFIG_LWIP_IP_DEFAULT_TTL=64 -CONFIG_LWIP_IP4_FRAG=y -CONFIG_LWIP_IP6_FRAG=y -# CONFIG_LWIP_IP4_REASSEMBLY is not set -# CONFIG_LWIP_IP6_REASSEMBLY is not set -CONFIG_LWIP_IP_REASS_MAX_PBUFS=10 -# CONFIG_LWIP_IP_FORWARD is not set -# CONFIG_LWIP_STATS is not set -CONFIG_LWIP_ESP_GRATUITOUS_ARP=y -CONFIG_LWIP_GARP_TMR_INTERVAL=60 -CONFIG_LWIP_ESP_MLDV6_REPORT=y -CONFIG_LWIP_MLDV6_TMR_INTERVAL=40 -CONFIG_LWIP_TCPIP_RECVMBOX_SIZE=32 -CONFIG_LWIP_DHCP_DOES_ARP_CHECK=y -# CONFIG_LWIP_DHCP_DOES_ACD_CHECK is not set -# CONFIG_LWIP_DHCP_DOES_NOT_CHECK_OFFERED_IP is not set -# CONFIG_LWIP_DHCP_DISABLE_CLIENT_ID is not set -CONFIG_LWIP_DHCP_DISABLE_VENDOR_CLASS_ID=y -# CONFIG_LWIP_DHCP_RESTORE_LAST_IP is not set -CONFIG_LWIP_DHCP_OPTIONS_LEN=69 -CONFIG_LWIP_NUM_NETIF_CLIENT_DATA=0 -CONFIG_LWIP_DHCP_COARSE_TIMER_SECS=1 - -# -# DHCP server -# -CONFIG_LWIP_DHCPS=y -CONFIG_LWIP_DHCPS_LEASE_UNIT=60 -CONFIG_LWIP_DHCPS_MAX_STATION_NUM=8 -CONFIG_LWIP_DHCPS_STATIC_ENTRIES=y -CONFIG_LWIP_DHCPS_ADD_DNS=y -# end of DHCP server - -# CONFIG_LWIP_AUTOIP is not set -CONFIG_LWIP_IPV4=y -CONFIG_LWIP_IPV6=y -# CONFIG_LWIP_IPV6_AUTOCONFIG is not set -CONFIG_LWIP_IPV6_NUM_ADDRESSES=3 -# CONFIG_LWIP_IPV6_FORWARD is not set -# CONFIG_LWIP_NETIF_STATUS_CALLBACK is not set -CONFIG_LWIP_NETIF_LOOPBACK=y -CONFIG_LWIP_LOOPBACK_MAX_PBUFS=8 - -# -# TCP -# -CONFIG_LWIP_MAX_ACTIVE_TCP=16 -CONFIG_LWIP_MAX_LISTENING_TCP=16 -CONFIG_LWIP_TCP_HIGH_SPEED_RETRANSMISSION=y -CONFIG_LWIP_TCP_MAXRTX=12 -CONFIG_LWIP_TCP_SYNMAXRTX=12 -CONFIG_LWIP_TCP_MSS=1440 -CONFIG_LWIP_TCP_TMR_INTERVAL=250 -CONFIG_LWIP_TCP_MSL=60000 -CONFIG_LWIP_TCP_FIN_WAIT_TIMEOUT=20000 -CONFIG_LWIP_TCP_SND_BUF_DEFAULT=5760 -CONFIG_LWIP_TCP_WND_DEFAULT=5760 -CONFIG_LWIP_TCP_RECVMBOX_SIZE=6 -CONFIG_LWIP_TCP_ACCEPTMBOX_SIZE=6 -CONFIG_LWIP_TCP_QUEUE_OOSEQ=y -CONFIG_LWIP_TCP_OOSEQ_TIMEOUT=6 -CONFIG_LWIP_TCP_OOSEQ_MAX_PBUFS=4 -# CONFIG_LWIP_TCP_SACK_OUT is not set -CONFIG_LWIP_TCP_OVERSIZE_MSS=y -# CONFIG_LWIP_TCP_OVERSIZE_QUARTER_MSS is not set -# CONFIG_LWIP_TCP_OVERSIZE_DISABLE is not set -CONFIG_LWIP_TCP_RTO_TIME=1500 -# end of TCP - -# -# UDP -# -CONFIG_LWIP_MAX_UDP_PCBS=16 -CONFIG_LWIP_UDP_RECVMBOX_SIZE=6 -# end of UDP - -# -# Checksums -# -# CONFIG_LWIP_CHECKSUM_CHECK_IP is not set -# CONFIG_LWIP_CHECKSUM_CHECK_UDP is not set -CONFIG_LWIP_CHECKSUM_CHECK_ICMP=y -# end of Checksums - -CONFIG_LWIP_TCPIP_TASK_STACK_SIZE=3072 -CONFIG_LWIP_TCPIP_TASK_AFFINITY_NO_AFFINITY=y -# CONFIG_LWIP_TCPIP_TASK_AFFINITY_CPU0 is not set -# CONFIG_LWIP_TCPIP_TASK_AFFINITY_CPU1 is not set -CONFIG_LWIP_TCPIP_TASK_AFFINITY=0x7FFFFFFF -CONFIG_LWIP_IPV6_MEMP_NUM_ND6_QUEUE=3 -CONFIG_LWIP_IPV6_ND6_NUM_NEIGHBORS=5 -CONFIG_LWIP_IPV6_ND6_NUM_PREFIXES=5 -CONFIG_LWIP_IPV6_ND6_NUM_ROUTERS=3 -CONFIG_LWIP_IPV6_ND6_NUM_DESTINATIONS=10 -# CONFIG_LWIP_IPV6_ND6_ROUTE_INFO_OPTION_SUPPORT is not set -# CONFIG_LWIP_PPP_SUPPORT is not set -# CONFIG_LWIP_SLIP_SUPPORT is not set - -# -# ICMP -# -CONFIG_LWIP_ICMP=y -# CONFIG_LWIP_MULTICAST_PING is not set -# CONFIG_LWIP_BROADCAST_PING is not set -# end of ICMP - -# -# LWIP RAW API -# -CONFIG_LWIP_MAX_RAW_PCBS=16 -# end of LWIP RAW API - -# -# SNTP -# -CONFIG_LWIP_SNTP_MAX_SERVERS=1 -# CONFIG_LWIP_DHCP_GET_NTP_SRV is not set -CONFIG_LWIP_SNTP_UPDATE_DELAY=3600000 -CONFIG_LWIP_SNTP_STARTUP_DELAY=y -CONFIG_LWIP_SNTP_MAXIMUM_STARTUP_DELAY=5000 -# end of SNTP - -# -# DNS -# -CONFIG_LWIP_DNS_MAX_HOST_IP=1 -CONFIG_LWIP_DNS_MAX_SERVERS=3 -# CONFIG_LWIP_FALLBACK_DNS_SERVER_SUPPORT is not set -# CONFIG_LWIP_DNS_SETSERVER_WITH_NETIF is not set -# CONFIG_LWIP_USE_ESP_GETADDRINFO is not set -# end of DNS - -CONFIG_LWIP_BRIDGEIF_MAX_PORTS=7 -CONFIG_LWIP_ESP_LWIP_ASSERT=y - -# -# Hooks -# -# CONFIG_LWIP_HOOK_TCP_ISN_NONE is not set -CONFIG_LWIP_HOOK_TCP_ISN_DEFAULT=y -# CONFIG_LWIP_HOOK_TCP_ISN_CUSTOM is not set -CONFIG_LWIP_HOOK_IP6_ROUTE_NONE=y -# CONFIG_LWIP_HOOK_IP6_ROUTE_DEFAULT is not set -# CONFIG_LWIP_HOOK_IP6_ROUTE_CUSTOM is not set -CONFIG_LWIP_HOOK_ND6_GET_GW_NONE=y -# CONFIG_LWIP_HOOK_ND6_GET_GW_DEFAULT is not set -# CONFIG_LWIP_HOOK_ND6_GET_GW_CUSTOM is not set -CONFIG_LWIP_HOOK_IP6_SELECT_SRC_ADDR_NONE=y -# CONFIG_LWIP_HOOK_IP6_SELECT_SRC_ADDR_DEFAULT is not set -# CONFIG_LWIP_HOOK_IP6_SELECT_SRC_ADDR_CUSTOM is not set -CONFIG_LWIP_HOOK_DHCP_EXTRA_OPTION_NONE=y -# CONFIG_LWIP_HOOK_DHCP_EXTRA_OPTION_DEFAULT is not set -# CONFIG_LWIP_HOOK_DHCP_EXTRA_OPTION_CUSTOM is not set -CONFIG_LWIP_HOOK_NETCONN_EXT_RESOLVE_NONE=y -# CONFIG_LWIP_HOOK_NETCONN_EXT_RESOLVE_DEFAULT is not set -# CONFIG_LWIP_HOOK_NETCONN_EXT_RESOLVE_CUSTOM is not set -CONFIG_LWIP_HOOK_DNS_EXT_RESOLVE_NONE=y -# CONFIG_LWIP_HOOK_DNS_EXT_RESOLVE_CUSTOM is not set -# CONFIG_LWIP_HOOK_IP6_INPUT_NONE is not set -CONFIG_LWIP_HOOK_IP6_INPUT_DEFAULT=y -# CONFIG_LWIP_HOOK_IP6_INPUT_CUSTOM is not set -# end of Hooks - -# CONFIG_LWIP_DEBUG is not set -# end of LWIP - -# -# mbedTLS -# -CONFIG_MBEDTLS_INTERNAL_MEM_ALLOC=y -# CONFIG_MBEDTLS_DEFAULT_MEM_ALLOC is not set -# CONFIG_MBEDTLS_CUSTOM_MEM_ALLOC is not set -CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN=y -CONFIG_MBEDTLS_SSL_IN_CONTENT_LEN=16384 -CONFIG_MBEDTLS_SSL_OUT_CONTENT_LEN=4096 -# CONFIG_MBEDTLS_DYNAMIC_BUFFER is not set -# CONFIG_MBEDTLS_DEBUG is not set - -# -# mbedTLS v3.x related -# -# CONFIG_MBEDTLS_SSL_PROTO_TLS1_3 is not set -# CONFIG_MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH is not set -# CONFIG_MBEDTLS_X509_TRUSTED_CERT_CALLBACK is not set -# CONFIG_MBEDTLS_SSL_CONTEXT_SERIALIZATION is not set -CONFIG_MBEDTLS_SSL_KEEP_PEER_CERTIFICATE=y -# CONFIG_MBEDTLS_SSL_KEYING_MATERIAL_EXPORT is not set -CONFIG_MBEDTLS_PKCS7_C=y -# end of mbedTLS v3.x related - -# -# Certificate Bundle -# -CONFIG_MBEDTLS_CERTIFICATE_BUNDLE=y -CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_FULL=y -# CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_CMN is not set -# CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_NONE is not set -# CONFIG_MBEDTLS_CUSTOM_CERTIFICATE_BUNDLE is not set -# CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEPRECATED_LIST is not set -CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_MAX_CERTS=200 -# end of Certificate Bundle - -# CONFIG_MBEDTLS_ECP_RESTARTABLE is not set -# CONFIG_MBEDTLS_CMAC_C is not set -CONFIG_MBEDTLS_HARDWARE_AES=y -CONFIG_MBEDTLS_AES_USE_INTERRUPT=y -CONFIG_MBEDTLS_AES_INTERRUPT_LEVEL=0 -# CONFIG_MBEDTLS_AES_USE_PSEUDO_ROUND_FUNC is not set -CONFIG_MBEDTLS_HARDWARE_GCM=y -CONFIG_MBEDTLS_GCM_SUPPORT_NON_AES_CIPHER=y -CONFIG_MBEDTLS_HARDWARE_MPI=y -# CONFIG_MBEDTLS_LARGE_KEY_SOFTWARE_MPI is not set -CONFIG_MBEDTLS_MPI_USE_INTERRUPT=y -CONFIG_MBEDTLS_MPI_INTERRUPT_LEVEL=0 -CONFIG_MBEDTLS_HARDWARE_SHA=y -CONFIG_MBEDTLS_HARDWARE_ECC=y -CONFIG_MBEDTLS_ECC_OTHER_CURVES_SOFT_FALLBACK=y -CONFIG_MBEDTLS_ROM_MD5=y -# CONFIG_MBEDTLS_ATCA_HW_ECDSA_SIGN is not set -# CONFIG_MBEDTLS_ATCA_HW_ECDSA_VERIFY is not set -CONFIG_MBEDTLS_HAVE_TIME=y -# CONFIG_MBEDTLS_PLATFORM_TIME_ALT is not set -# CONFIG_MBEDTLS_HAVE_TIME_DATE is not set -CONFIG_MBEDTLS_ECDSA_DETERMINISTIC=y -CONFIG_MBEDTLS_SHA1_C=y -CONFIG_MBEDTLS_SHA512_C=y -# CONFIG_MBEDTLS_SHA3_C is not set -CONFIG_MBEDTLS_TLS_SERVER_AND_CLIENT=y -# CONFIG_MBEDTLS_TLS_SERVER_ONLY is not set -# CONFIG_MBEDTLS_TLS_CLIENT_ONLY is not set -# CONFIG_MBEDTLS_TLS_DISABLED is not set -CONFIG_MBEDTLS_TLS_SERVER=y -CONFIG_MBEDTLS_TLS_CLIENT=y -CONFIG_MBEDTLS_TLS_ENABLED=y - -# -# TLS Key Exchange Methods -# -# CONFIG_MBEDTLS_PSK_MODES is not set -CONFIG_MBEDTLS_KEY_EXCHANGE_RSA=y -CONFIG_MBEDTLS_KEY_EXCHANGE_ELLIPTIC_CURVE=y -CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_RSA=y -CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA=y -CONFIG_MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA=y -CONFIG_MBEDTLS_KEY_EXCHANGE_ECDH_RSA=y -# end of TLS Key Exchange Methods - -CONFIG_MBEDTLS_SSL_RENEGOTIATION=y -CONFIG_MBEDTLS_SSL_PROTO_TLS1_2=y -# CONFIG_MBEDTLS_SSL_PROTO_GMTSSL1_1 is not set -# CONFIG_MBEDTLS_SSL_PROTO_DTLS is not set -CONFIG_MBEDTLS_SSL_ALPN=y -CONFIG_MBEDTLS_CLIENT_SSL_SESSION_TICKETS=y -CONFIG_MBEDTLS_SERVER_SSL_SESSION_TICKETS=y - -# -# Symmetric Ciphers -# -CONFIG_MBEDTLS_AES_C=y -# CONFIG_MBEDTLS_CAMELLIA_C is not set -# CONFIG_MBEDTLS_DES_C is not set -# CONFIG_MBEDTLS_BLOWFISH_C is not set -# CONFIG_MBEDTLS_XTEA_C is not set -CONFIG_MBEDTLS_CCM_C=y -CONFIG_MBEDTLS_GCM_C=y -# CONFIG_MBEDTLS_NIST_KW_C is not set -# end of Symmetric Ciphers - -# CONFIG_MBEDTLS_RIPEMD160_C is not set - -# -# Certificates -# -CONFIG_MBEDTLS_PEM_PARSE_C=y -CONFIG_MBEDTLS_PEM_WRITE_C=y -CONFIG_MBEDTLS_X509_CRL_PARSE_C=y -CONFIG_MBEDTLS_X509_CSR_PARSE_C=y -# end of Certificates - -CONFIG_MBEDTLS_ECP_C=y -CONFIG_MBEDTLS_PK_PARSE_EC_EXTENDED=y -CONFIG_MBEDTLS_PK_PARSE_EC_COMPRESSED=y -# CONFIG_MBEDTLS_DHM_C is not set -CONFIG_MBEDTLS_ECDH_C=y -CONFIG_MBEDTLS_ECDSA_C=y -# CONFIG_MBEDTLS_ECJPAKE_C is not set -CONFIG_MBEDTLS_ECP_DP_SECP192R1_ENABLED=y -CONFIG_MBEDTLS_ECP_DP_SECP224R1_ENABLED=y -CONFIG_MBEDTLS_ECP_DP_SECP256R1_ENABLED=y -CONFIG_MBEDTLS_ECP_DP_SECP384R1_ENABLED=y -CONFIG_MBEDTLS_ECP_DP_SECP521R1_ENABLED=y -CONFIG_MBEDTLS_ECP_DP_SECP192K1_ENABLED=y -CONFIG_MBEDTLS_ECP_DP_SECP224K1_ENABLED=y -CONFIG_MBEDTLS_ECP_DP_SECP256K1_ENABLED=y -CONFIG_MBEDTLS_ECP_DP_BP256R1_ENABLED=y -CONFIG_MBEDTLS_ECP_DP_BP384R1_ENABLED=y -CONFIG_MBEDTLS_ECP_DP_BP512R1_ENABLED=y -CONFIG_MBEDTLS_ECP_DP_CURVE25519_ENABLED=y -CONFIG_MBEDTLS_ECP_NIST_OPTIM=y -# CONFIG_MBEDTLS_ECP_FIXED_POINT_OPTIM is not set -# CONFIG_MBEDTLS_POLY1305_C is not set -# CONFIG_MBEDTLS_CHACHA20_C is not set -# CONFIG_MBEDTLS_HKDF_C is not set -# CONFIG_MBEDTLS_THREADING_C is not set -CONFIG_MBEDTLS_ERROR_STRINGS=y -CONFIG_MBEDTLS_FS_IO=y -# CONFIG_MBEDTLS_ALLOW_WEAK_CERTIFICATE_VERIFICATION is not set -# end of mbedTLS - -# -# ESP-MQTT Configurations -# -CONFIG_MQTT_PROTOCOL_311=y -# CONFIG_MQTT_PROTOCOL_5 is not set -CONFIG_MQTT_TRANSPORT_SSL=y -CONFIG_MQTT_TRANSPORT_WEBSOCKET=y -CONFIG_MQTT_TRANSPORT_WEBSOCKET_SECURE=y -# CONFIG_MQTT_MSG_ID_INCREMENTAL is not set -# CONFIG_MQTT_SKIP_PUBLISH_IF_DISCONNECTED is not set -# CONFIG_MQTT_REPORT_DELETED_MESSAGES is not set -# CONFIG_MQTT_USE_CUSTOM_CONFIG is not set -# CONFIG_MQTT_TASK_CORE_SELECTION_ENABLED is not set -# CONFIG_MQTT_CUSTOM_OUTBOX is not set -# end of ESP-MQTT Configurations - -# -# LibC -# -CONFIG_LIBC_NEWLIB=y -CONFIG_LIBC_MISC_IN_IRAM=y -CONFIG_LIBC_LOCKS_PLACE_IN_IRAM=y -CONFIG_LIBC_STDOUT_LINE_ENDING_CRLF=y -# CONFIG_LIBC_STDOUT_LINE_ENDING_LF is not set -# CONFIG_LIBC_STDOUT_LINE_ENDING_CR is not set -# CONFIG_LIBC_STDIN_LINE_ENDING_CRLF is not set -# CONFIG_LIBC_STDIN_LINE_ENDING_LF is not set -CONFIG_LIBC_STDIN_LINE_ENDING_CR=y -# CONFIG_LIBC_NEWLIB_NANO_FORMAT is not set -CONFIG_LIBC_TIME_SYSCALL_USE_RTC_HRT=y -# CONFIG_LIBC_TIME_SYSCALL_USE_RTC is not set -# CONFIG_LIBC_TIME_SYSCALL_USE_HRT is not set -# CONFIG_LIBC_TIME_SYSCALL_USE_NONE is not set -# CONFIG_LIBC_OPTIMIZED_MISALIGNED_ACCESS is not set -# end of LibC - -# -# NVS -# -# CONFIG_NVS_ENCRYPTION is not set -# CONFIG_NVS_ASSERT_ERROR_CHECK is not set -# CONFIG_NVS_LEGACY_DUP_KEYS_COMPATIBILITY is not set -# end of NVS - -# -# OpenThread -# -# CONFIG_OPENTHREAD_ENABLED is not set - -# -# OpenThread Spinel -# -# CONFIG_OPENTHREAD_SPINEL_ONLY is not set -# end of OpenThread Spinel - -# CONFIG_OPENTHREAD_DEBUG is not set -# end of OpenThread - -# -# Protocomm -# -CONFIG_ESP_PROTOCOMM_SUPPORT_SECURITY_VERSION_0=y -CONFIG_ESP_PROTOCOMM_SUPPORT_SECURITY_VERSION_1=y -CONFIG_ESP_PROTOCOMM_SUPPORT_SECURITY_VERSION_2=y -CONFIG_ESP_PROTOCOMM_SUPPORT_SECURITY_PATCH_VERSION=y -# end of Protocomm - -# -# PThreads -# -CONFIG_PTHREAD_TASK_PRIO_DEFAULT=5 -CONFIG_PTHREAD_TASK_STACK_SIZE_DEFAULT=3072 -CONFIG_PTHREAD_STACK_MIN=768 -CONFIG_PTHREAD_DEFAULT_CORE_NO_AFFINITY=y -# CONFIG_PTHREAD_DEFAULT_CORE_0 is not set -# CONFIG_PTHREAD_DEFAULT_CORE_1 is not set -CONFIG_PTHREAD_TASK_CORE_DEFAULT=-1 -CONFIG_PTHREAD_TASK_NAME_DEFAULT="pthread" -# end of PThreads - -# -# MMU Config -# -CONFIG_MMU_PAGE_SIZE_64KB=y -CONFIG_MMU_PAGE_MODE="64KB" -CONFIG_MMU_PAGE_SIZE=0x10000 -# end of MMU Config - -# -# Main Flash configuration -# - -# -# SPI Flash behavior when brownout -# -CONFIG_SPI_FLASH_BROWNOUT_RESET_XMC=y -CONFIG_SPI_FLASH_BROWNOUT_RESET=y -# end of SPI Flash behavior when brownout - -# -# Optional and Experimental Features (READ DOCS FIRST) -# - -# -# Features here require specific hardware (READ DOCS FIRST!) -# -# CONFIG_SPI_FLASH_HPM_ENA is not set -CONFIG_SPI_FLASH_HPM_AUTO=y -# CONFIG_SPI_FLASH_HPM_DIS is not set -CONFIG_SPI_FLASH_HPM_ON=y -CONFIG_SPI_FLASH_HPM_DC_AUTO=y -# CONFIG_SPI_FLASH_HPM_DC_DISABLE is not set -# CONFIG_SPI_FLASH_AUTO_SUSPEND is not set -CONFIG_SPI_FLASH_SUSPEND_TSUS_VAL_US=50 -CONFIG_SPI_FLASH_SUSPEND_TRS_VAL_US=50 -# CONFIG_SPI_FLASH_FORCE_ENABLE_XMC_C_SUSPEND is not set -# CONFIG_SPI_FLASH_FORCE_ENABLE_C6_H2_SUSPEND is not set -CONFIG_SPI_FLASH_PLACE_FUNCTIONS_IN_IRAM=y -# end of Optional and Experimental Features (READ DOCS FIRST) -# end of Main Flash configuration - -# -# SPI Flash driver -# -# CONFIG_SPI_FLASH_VERIFY_WRITE is not set -# CONFIG_SPI_FLASH_ENABLE_COUNTERS is not set -CONFIG_SPI_FLASH_ROM_DRIVER_PATCH=y -CONFIG_SPI_FLASH_DANGEROUS_WRITE_ABORTS=y -# CONFIG_SPI_FLASH_DANGEROUS_WRITE_FAILS is not set -# CONFIG_SPI_FLASH_DANGEROUS_WRITE_ALLOWED is not set -# CONFIG_SPI_FLASH_BYPASS_BLOCK_ERASE is not set -CONFIG_SPI_FLASH_YIELD_DURING_ERASE=y -CONFIG_SPI_FLASH_ERASE_YIELD_DURATION_MS=20 -CONFIG_SPI_FLASH_ERASE_YIELD_TICKS=1 -CONFIG_SPI_FLASH_WRITE_CHUNK_SIZE=8192 -# CONFIG_SPI_FLASH_SIZE_OVERRIDE is not set -# CONFIG_SPI_FLASH_CHECK_ERASE_TIMEOUT_DISABLED is not set -# CONFIG_SPI_FLASH_OVERRIDE_CHIP_DRIVER_LIST is not set - -# -# Auto-detect flash chips -# -CONFIG_SPI_FLASH_VENDOR_XMC_SUPPORT_ENABLED=y -CONFIG_SPI_FLASH_VENDOR_GD_SUPPORT_ENABLED=y -# CONFIG_SPI_FLASH_SUPPORT_ISSI_CHIP is not set -# CONFIG_SPI_FLASH_SUPPORT_MXIC_CHIP is not set -CONFIG_SPI_FLASH_SUPPORT_GD_CHIP=y -# CONFIG_SPI_FLASH_SUPPORT_WINBOND_CHIP is not set -# CONFIG_SPI_FLASH_SUPPORT_BOYA_CHIP is not set -# CONFIG_SPI_FLASH_SUPPORT_TH_CHIP is not set -# end of Auto-detect flash chips - -CONFIG_SPI_FLASH_ENABLE_ENCRYPTED_READ_WRITE=y -# end of SPI Flash driver - -# -# SPIFFS Configuration -# -CONFIG_SPIFFS_MAX_PARTITIONS=3 - -# -# SPIFFS Cache Configuration -# -CONFIG_SPIFFS_CACHE=y -CONFIG_SPIFFS_CACHE_WR=y -# CONFIG_SPIFFS_CACHE_STATS is not set -# end of SPIFFS Cache Configuration - -CONFIG_SPIFFS_PAGE_CHECK=y -CONFIG_SPIFFS_GC_MAX_RUNS=10 -# CONFIG_SPIFFS_GC_STATS is not set -CONFIG_SPIFFS_PAGE_SIZE=256 -CONFIG_SPIFFS_OBJ_NAME_LEN=32 -# CONFIG_SPIFFS_FOLLOW_SYMLINKS is not set -CONFIG_SPIFFS_USE_MAGIC=y -CONFIG_SPIFFS_USE_MAGIC_LENGTH=y -CONFIG_SPIFFS_META_LENGTH=4 -CONFIG_SPIFFS_USE_MTIME=y - -# -# Debug Configuration -# -# CONFIG_SPIFFS_DBG is not set -# CONFIG_SPIFFS_API_DBG is not set -# CONFIG_SPIFFS_GC_DBG is not set -# CONFIG_SPIFFS_CACHE_DBG is not set -# CONFIG_SPIFFS_CHECK_DBG is not set -# CONFIG_SPIFFS_TEST_VISUALISATION is not set -# end of Debug Configuration -# end of SPIFFS Configuration - -# -# TCP Transport -# - -# -# Websocket -# -CONFIG_WS_TRANSPORT=y -CONFIG_WS_BUFFER_SIZE=1024 -# CONFIG_WS_DYNAMIC_BUFFER is not set -# end of Websocket -# end of TCP Transport - -# -# Ultra Low Power (ULP) Co-processor -# -# CONFIG_ULP_COPROC_ENABLED is not set - -# -# ULP Debugging Options -# -# end of ULP Debugging Options -# end of Ultra Low Power (ULP) Co-processor - -# -# Unity unit testing library -# -CONFIG_UNITY_ENABLE_FLOAT=y -CONFIG_UNITY_ENABLE_DOUBLE=y -# CONFIG_UNITY_ENABLE_64BIT is not set -# CONFIG_UNITY_ENABLE_COLOR is not set -CONFIG_UNITY_ENABLE_IDF_TEST_RUNNER=y -# CONFIG_UNITY_ENABLE_FIXTURE is not set -# CONFIG_UNITY_ENABLE_BACKTRACE_ON_FAIL is not set -# CONFIG_UNITY_TEST_ORDER_BY_FILE_PATH_AND_LINE is not set -# end of Unity unit testing library - -# -# USB-OTG -# -CONFIG_USB_HOST_CONTROL_TRANSFER_MAX_SIZE=256 -CONFIG_USB_HOST_HW_BUFFER_BIAS_BALANCED=y -# CONFIG_USB_HOST_HW_BUFFER_BIAS_IN is not set -# CONFIG_USB_HOST_HW_BUFFER_BIAS_PERIODIC_OUT is not set - -# -# Hub Driver Configuration -# - -# -# Root Port configuration -# -CONFIG_USB_HOST_DEBOUNCE_DELAY_MS=250 -CONFIG_USB_HOST_RESET_HOLD_MS=30 -CONFIG_USB_HOST_RESET_RECOVERY_MS=30 -CONFIG_USB_HOST_SET_ADDR_RECOVERY_MS=10 -# end of Root Port configuration - -# CONFIG_USB_HOST_HUBS_SUPPORTED is not set -# end of Hub Driver Configuration - -# CONFIG_USB_HOST_ENABLE_ENUM_FILTER_CALLBACK is not set -CONFIG_USB_OTG_SUPPORTED=y -# end of USB-OTG - -# -# Virtual file system -# -CONFIG_VFS_SUPPORT_IO=y -CONFIG_VFS_SUPPORT_DIR=y -CONFIG_VFS_SUPPORT_SELECT=y -CONFIG_VFS_SUPPRESS_SELECT_DEBUG_OUTPUT=y -# CONFIG_VFS_SELECT_IN_RAM is not set -CONFIG_VFS_SUPPORT_TERMIOS=y -CONFIG_VFS_MAX_COUNT=8 - -# -# Host File System I/O (Semihosting) -# -CONFIG_VFS_SEMIHOSTFS_MAX_MOUNT_POINTS=1 -# end of Host File System I/O (Semihosting) - -CONFIG_VFS_INITIALIZE_DEV_NULL=y -# end of Virtual file system - -# -# Wear Levelling -# -# CONFIG_WL_SECTOR_SIZE_512 is not set -CONFIG_WL_SECTOR_SIZE_4096=y -CONFIG_WL_SECTOR_SIZE=4096 -# end of Wear Levelling - -# -# Wi-Fi Provisioning Manager -# -CONFIG_WIFI_PROV_SCAN_MAX_ENTRIES=16 -CONFIG_WIFI_PROV_AUTOSTOP_TIMEOUT=30 -CONFIG_WIFI_PROV_STA_ALL_CHANNEL_SCAN=y -# CONFIG_WIFI_PROV_STA_FAST_SCAN is not set -# end of Wi-Fi Provisioning Manager - -# -# cJSON -# -CONFIG_CJSON_NESTING_LIMIT=1000 -CONFIG_CJSON_CIRCULAR_LIMIT=10000 -# end of cJSON - -# -# TinyUSB Stack -# -CONFIG_TINYUSB_DEBUG_LEVEL=1 - -# -# TinyUSB DCD -# -# CONFIG_TINYUSB_MODE_SLAVE is not set -CONFIG_TINYUSB_MODE_DMA=y -# end of TinyUSB DCD - -# -# TinyUSB callbacks -# -# CONFIG_TINYUSB_SUSPEND_CALLBACK is not set -# CONFIG_TINYUSB_RESUME_CALLBACK is not set -# end of TinyUSB callbacks - -# -# Descriptor configuration -# - -# -# You can provide your custom descriptors via tinyusb_driver_install() -# -CONFIG_TINYUSB_DESC_USE_ESPRESSIF_VID=y -CONFIG_TINYUSB_DESC_USE_DEFAULT_PID=y -CONFIG_TINYUSB_DESC_BCD_DEVICE=0x0100 -CONFIG_TINYUSB_DESC_MANUFACTURER_STRING="Espressif Systems" -CONFIG_TINYUSB_DESC_PRODUCT_STRING="Espressif Device" -CONFIG_TINYUSB_DESC_SERIAL_STRING="123456" -# end of Descriptor configuration - -# -# Mass Storage Class (MSC) -# -# CONFIG_TINYUSB_MSC_ENABLED is not set -# end of Mass Storage Class (MSC) - -# -# Communication Device Class (CDC) -# -# CONFIG_TINYUSB_CDC_ENABLED is not set -# end of Communication Device Class (CDC) - -# -# Musical Instrument Digital Interface (MIDI) -# -CONFIG_TINYUSB_MIDI_COUNT=0 -# end of Musical Instrument Digital Interface (MIDI) - -# -# Human Interface Device Class (HID) -# -CONFIG_TINYUSB_HID_COUNT=2 -# end of Human Interface Device Class (HID) - -# -# Device Firmware Upgrade (DFU) -# -# CONFIG_TINYUSB_DFU_MODE_DFU is not set -# CONFIG_TINYUSB_DFU_MODE_DFU_RUNTIME is not set -CONFIG_TINYUSB_DFU_MODE_NONE=y -# end of Device Firmware Upgrade (DFU) - -# -# Bluetooth Host Class (BTH) -# -# CONFIG_TINYUSB_BTH_ENABLED is not set -# end of Bluetooth Host Class (BTH) - -# -# Network driver (ECM/NCM/RNDIS) -# -# CONFIG_TINYUSB_NET_MODE_ECM_RNDIS is not set -# CONFIG_TINYUSB_NET_MODE_NCM is not set -CONFIG_TINYUSB_NET_MODE_NONE=y -# end of Network driver (ECM/NCM/RNDIS) - -# -# Vendor Specific Interface -# -CONFIG_TINYUSB_VENDOR_COUNT=0 -# end of Vendor Specific Interface -# end of TinyUSB Stack - -# -# LittleFS -# -# CONFIG_LITTLEFS_SDMMC_SUPPORT is not set -CONFIG_LITTLEFS_MAX_PARTITIONS=3 -CONFIG_LITTLEFS_PAGE_SIZE=256 -CONFIG_LITTLEFS_OBJ_NAME_LEN=64 -CONFIG_LITTLEFS_READ_SIZE=128 -CONFIG_LITTLEFS_WRITE_SIZE=128 -CONFIG_LITTLEFS_LOOKAHEAD_SIZE=128 -CONFIG_LITTLEFS_CACHE_SIZE=512 -CONFIG_LITTLEFS_BLOCK_CYCLES=512 -CONFIG_LITTLEFS_USE_MTIME=y -# CONFIG_LITTLEFS_USE_ONLY_HASH is not set -# CONFIG_LITTLEFS_HUMAN_READABLE is not set -CONFIG_LITTLEFS_MTIME_USE_SECONDS=y -# CONFIG_LITTLEFS_MTIME_USE_NONCE is not set -# CONFIG_LITTLEFS_SPIFFS_COMPAT is not set -# CONFIG_LITTLEFS_FLUSH_FILE_EVERY_WRITE is not set -# CONFIG_LITTLEFS_FCNTL_GET_PATH is not set -# CONFIG_LITTLEFS_MULTIVERSION is not set -# CONFIG_LITTLEFS_MALLOC_STRATEGY_DISABLE is not set -CONFIG_LITTLEFS_MALLOC_STRATEGY_DEFAULT=y -# CONFIG_LITTLEFS_MALLOC_STRATEGY_INTERNAL is not set -CONFIG_LITTLEFS_ASSERTS=y -# CONFIG_LITTLEFS_MMAP_PARTITION is not set -# CONFIG_LITTLEFS_WDT_RESET is not set -# end of LittleFS - -# -# LVGL configuration -# -CONFIG_LV_CONF_SKIP=y -# CONFIG_LV_CONF_MINIMAL is not set - -# -# Color Settings -# -# CONFIG_LV_COLOR_DEPTH_32 is not set -# CONFIG_LV_COLOR_DEPTH_24 is not set -CONFIG_LV_COLOR_DEPTH_16=y -# CONFIG_LV_COLOR_DEPTH_8 is not set -# CONFIG_LV_COLOR_DEPTH_1 is not set -CONFIG_LV_COLOR_DEPTH=16 -# end of Color Settings - -# -# Memory Settings -# -CONFIG_LV_USE_BUILTIN_MALLOC=y -# CONFIG_LV_USE_CLIB_MALLOC is not set -# CONFIG_LV_USE_MICROPYTHON_MALLOC is not set -# CONFIG_LV_USE_RTTHREAD_MALLOC is not set -# CONFIG_LV_USE_CUSTOM_MALLOC is not set -CONFIG_LV_USE_BUILTIN_STRING=y -# CONFIG_LV_USE_CLIB_STRING is not set -# CONFIG_LV_USE_CUSTOM_STRING is not set -CONFIG_LV_USE_BUILTIN_SPRINTF=y -# CONFIG_LV_USE_CLIB_SPRINTF is not set -# CONFIG_LV_USE_CUSTOM_SPRINTF is not set -CONFIG_LV_MEM_SIZE_KILOBYTES=128 -CONFIG_LV_MEM_POOL_EXPAND_SIZE_KILOBYTES=64 -CONFIG_LV_MEM_ADR=0x0 -# end of Memory Settings - -# -# HAL Settings -# -CONFIG_LV_DEF_REFR_PERIOD=33 -CONFIG_LV_DPI_DEF=130 -# end of HAL Settings - -# -# Operating System (OS) -# -CONFIG_LV_OS_NONE=y -# CONFIG_LV_OS_PTHREAD is not set -# CONFIG_LV_OS_FREERTOS is not set -# CONFIG_LV_OS_CMSIS_RTOS2 is not set -# CONFIG_LV_OS_RTTHREAD is not set -# CONFIG_LV_OS_WINDOWS is not set -# CONFIG_LV_OS_MQX is not set -# CONFIG_LV_OS_SDL2 is not set -# CONFIG_LV_OS_CUSTOM is not set -# end of Operating System (OS) - -# -# Rendering Configuration -# -CONFIG_LV_DRAW_BUF_STRIDE_ALIGN=1 -CONFIG_LV_DRAW_BUF_ALIGN=4 -CONFIG_LV_DRAW_LAYER_SIMPLE_BUF_SIZE=24576 -CONFIG_LV_DRAW_LAYER_MAX_MEMORY=0 -CONFIG_LV_USE_DRAW_SW=y -CONFIG_LV_DRAW_SW_SUPPORT_RGB565=y -CONFIG_LV_DRAW_SW_SUPPORT_RGB565_SWAPPED=y -CONFIG_LV_DRAW_SW_SUPPORT_RGB565A8=y -CONFIG_LV_DRAW_SW_SUPPORT_RGB888=y -CONFIG_LV_DRAW_SW_SUPPORT_XRGB8888=y -CONFIG_LV_DRAW_SW_SUPPORT_ARGB8888=y -CONFIG_LV_DRAW_SW_SUPPORT_ARGB8888_PREMULTIPLIED=y -CONFIG_LV_DRAW_SW_SUPPORT_L8=y -CONFIG_LV_DRAW_SW_SUPPORT_AL88=y -CONFIG_LV_DRAW_SW_SUPPORT_A8=y -CONFIG_LV_DRAW_SW_SUPPORT_I1=y -CONFIG_LV_DRAW_SW_I1_LUM_THRESHOLD=127 -CONFIG_LV_DRAW_SW_DRAW_UNIT_CNT=1 -# CONFIG_LV_USE_DRAW_ARM2D_SYNC is not set -# CONFIG_LV_USE_NATIVE_HELIUM_ASM is not set -CONFIG_LV_DRAW_SW_COMPLEX=y -# CONFIG_LV_USE_DRAW_SW_COMPLEX_GRADIENTS is not set -CONFIG_LV_DRAW_SW_SHADOW_CACHE_SIZE=0 -CONFIG_LV_DRAW_SW_CIRCLE_CACHE_SIZE=4 -CONFIG_LV_DRAW_SW_ASM_NONE=y -# CONFIG_LV_DRAW_SW_ASM_NEON is not set -# CONFIG_LV_DRAW_SW_ASM_HELIUM is not set -# CONFIG_LV_DRAW_SW_ASM_RISCV_V is not set -# CONFIG_LV_DRAW_SW_ASM_CUSTOM is not set -CONFIG_LV_USE_DRAW_SW_ASM=0 -# CONFIG_LV_USE_PXP is not set -# CONFIG_LV_USE_G2D is not set -# CONFIG_LV_USE_DRAW_DAVE2D is not set -# CONFIG_LV_USE_DRAW_SDL is not set -# CONFIG_LV_USE_DRAW_VG_LITE is not set -# CONFIG_LV_USE_VECTOR_GRAPHIC is not set -# CONFIG_LV_USE_DRAW_DMA2D is not set -# CONFIG_LV_USE_PPA is not set -# CONFIG_LV_USE_DRAW_EVE is not set -# end of Rendering Configuration - -# -# Feature Configuration -# - -# -# Logging -# -# CONFIG_LV_USE_LOG is not set -# end of Logging - -# -# Asserts -# -CONFIG_LV_USE_ASSERT_NULL=y -CONFIG_LV_USE_ASSERT_MALLOC=y -# CONFIG_LV_USE_ASSERT_STYLE is not set -# CONFIG_LV_USE_ASSERT_MEM_INTEGRITY is not set -# CONFIG_LV_USE_ASSERT_OBJ is not set -CONFIG_LV_ASSERT_HANDLER_INCLUDE="assert.h" -# end of Asserts - -# -# Debug -# -# CONFIG_LV_USE_REFR_DEBUG is not set -# CONFIG_LV_USE_LAYER_DEBUG is not set -# CONFIG_LV_USE_PARALLEL_DRAW_DEBUG is not set -# end of Debug - -# -# Others -# -# CONFIG_LV_ENABLE_GLOBAL_CUSTOM is not set -CONFIG_LV_CACHE_DEF_SIZE=0 -CONFIG_LV_IMAGE_HEADER_CACHE_DEF_CNT=0 -CONFIG_LV_GRADIENT_MAX_STOPS=2 -CONFIG_LV_COLOR_MIX_ROUND_OFS=128 -# CONFIG_LV_OBJ_STYLE_CACHE is not set -# CONFIG_LV_USE_OBJ_ID is not set -# CONFIG_LV_USE_OBJ_NAME is not set -# CONFIG_LV_USE_OBJ_PROPERTY is not set -# CONFIG_LV_USE_EXT_DATA is not set -# end of Others -# end of Feature Configuration - -# -# Compiler Settings -# -# CONFIG_LV_BIG_ENDIAN_SYSTEM is not set -CONFIG_LV_ATTRIBUTE_MEM_ALIGN_SIZE=1 -# CONFIG_LV_ATTRIBUTE_FAST_MEM_USE_IRAM is not set -# CONFIG_LV_USE_FLOAT is not set -# CONFIG_LV_USE_MATRIX is not set -# CONFIG_LV_USE_PRIVATE_API is not set -# end of Compiler Settings - -# -# Font Usage -# - -# -# Enable built-in fonts -# -# CONFIG_LV_FONT_MONTSERRAT_8 is not set -# CONFIG_LV_FONT_MONTSERRAT_10 is not set -CONFIG_LV_FONT_MONTSERRAT_12=y -CONFIG_LV_FONT_MONTSERRAT_14=y -# CONFIG_LV_FONT_MONTSERRAT_16 is not set -# CONFIG_LV_FONT_MONTSERRAT_18 is not set -# CONFIG_LV_FONT_MONTSERRAT_20 is not set -# CONFIG_LV_FONT_MONTSERRAT_22 is not set -# CONFIG_LV_FONT_MONTSERRAT_24 is not set -# CONFIG_LV_FONT_MONTSERRAT_26 is not set -# CONFIG_LV_FONT_MONTSERRAT_28 is not set -# CONFIG_LV_FONT_MONTSERRAT_30 is not set -# CONFIG_LV_FONT_MONTSERRAT_32 is not set -# CONFIG_LV_FONT_MONTSERRAT_34 is not set -# CONFIG_LV_FONT_MONTSERRAT_36 is not set -# CONFIG_LV_FONT_MONTSERRAT_38 is not set -# CONFIG_LV_FONT_MONTSERRAT_40 is not set -# CONFIG_LV_FONT_MONTSERRAT_42 is not set -# CONFIG_LV_FONT_MONTSERRAT_44 is not set -# CONFIG_LV_FONT_MONTSERRAT_46 is not set -# CONFIG_LV_FONT_MONTSERRAT_48 is not set -# CONFIG_LV_FONT_MONTSERRAT_28_COMPRESSED is not set -# CONFIG_LV_FONT_DEJAVU_16_PERSIAN_HEBREW is not set -# CONFIG_LV_FONT_SOURCE_HAN_SANS_SC_14_CJK is not set -# CONFIG_LV_FONT_SOURCE_HAN_SANS_SC_16_CJK is not set -# CONFIG_LV_FONT_UNSCII_8 is not set -# CONFIG_LV_FONT_UNSCII_16 is not set -# end of Enable built-in fonts - -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_8 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_10 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_12 is not set -CONFIG_LV_FONT_DEFAULT_MONTSERRAT_14=y -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_16 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_18 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_20 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_22 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_24 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_26 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_28 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_30 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_32 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_34 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_36 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_38 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_40 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_42 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_44 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_46 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_48 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_28_COMPRESSED is not set -# CONFIG_LV_FONT_DEFAULT_DEJAVU_16_PERSIAN_HEBREW is not set -# CONFIG_LV_FONT_DEFAULT_SOURCE_HAN_SANS_SC_14_CJK is not set -# CONFIG_LV_FONT_DEFAULT_SOURCE_HAN_SANS_SC_16_CJK is not set -# CONFIG_LV_FONT_DEFAULT_UNSCII_8 is not set -# CONFIG_LV_FONT_DEFAULT_UNSCII_16 is not set -# CONFIG_LV_FONT_FMT_TXT_LARGE is not set -# CONFIG_LV_USE_FONT_COMPRESSED is not set -CONFIG_LV_USE_FONT_PLACEHOLDER=y - -# -# Enable static fonts -# -# end of Enable static fonts -# end of Font Usage - -# -# Text Settings -# -CONFIG_LV_TXT_ENC_UTF8=y -# CONFIG_LV_TXT_ENC_ASCII is not set -CONFIG_LV_TXT_BREAK_CHARS=" ,.;:-_)}" -CONFIG_LV_TXT_LINE_BREAK_LONG_LEN=0 -CONFIG_LV_TXT_COLOR_CMD="#" -# CONFIG_LV_USE_BIDI is not set -# CONFIG_LV_USE_ARABIC_PERSIAN_CHARS is not set -# end of Text Settings - -# -# Widget Usage -# -CONFIG_LV_WIDGETS_HAS_DEFAULT_VALUE=y -CONFIG_LV_USE_ANIMIMG=y -CONFIG_LV_USE_ARC=y -CONFIG_LV_USE_ARCLABEL=y -CONFIG_LV_USE_BAR=y -CONFIG_LV_USE_BUTTON=y -CONFIG_LV_USE_BUTTONMATRIX=y -CONFIG_LV_USE_CALENDAR=y -# CONFIG_LV_CALENDAR_WEEK_STARTS_MONDAY is not set - -# -# Days name configuration -# -CONFIG_LV_MONDAY_STR="Mo" -CONFIG_LV_TUESDAY_STR="Tu" -CONFIG_LV_WEDNESDAY_STR="We" -CONFIG_LV_THURSDAY_STR="Th" -CONFIG_LV_FRIDAY_STR="Fr" -CONFIG_LV_SATURDAY_STR="Sa" -CONFIG_LV_SUNDAY_STR="Su" -# end of Days name configuration - -CONFIG_LV_USE_CALENDAR_HEADER_ARROW=y -CONFIG_LV_USE_CALENDAR_HEADER_DROPDOWN=y -# CONFIG_LV_USE_CALENDAR_CHINESE is not set -CONFIG_LV_USE_CANVAS=y -CONFIG_LV_USE_CHART=y -CONFIG_LV_USE_CHECKBOX=y -CONFIG_LV_USE_DROPDOWN=y -CONFIG_LV_USE_IMAGE=y -CONFIG_LV_USE_IMAGEBUTTON=y -CONFIG_LV_USE_KEYBOARD=y -CONFIG_LV_USE_LABEL=y -CONFIG_LV_LABEL_TEXT_SELECTION=y -CONFIG_LV_LABEL_LONG_TXT_HINT=y -CONFIG_LV_LABEL_WAIT_CHAR_COUNT=3 -CONFIG_LV_USE_LED=y -CONFIG_LV_USE_LINE=y -CONFIG_LV_USE_LIST=y -CONFIG_LV_USE_MENU=y -CONFIG_LV_USE_MSGBOX=y -CONFIG_LV_USE_ROLLER=y -CONFIG_LV_USE_SCALE=y -CONFIG_LV_USE_SLIDER=y -CONFIG_LV_USE_SPAN=y -CONFIG_LV_SPAN_SNIPPET_STACK_SIZE=64 -CONFIG_LV_USE_SPINBOX=y -CONFIG_LV_USE_SPINNER=y -CONFIG_LV_USE_SWITCH=y -CONFIG_LV_USE_TEXTAREA=y -CONFIG_LV_TEXTAREA_DEF_PWD_SHOW_TIME=1500 -CONFIG_LV_USE_TABLE=y -CONFIG_LV_USE_TABVIEW=y -CONFIG_LV_USE_TILEVIEW=y -CONFIG_LV_USE_WIN=y -# end of Widget Usage - -# -# Themes -# -CONFIG_LV_USE_THEME_DEFAULT=y -# CONFIG_LV_THEME_DEFAULT_DARK is not set -CONFIG_LV_THEME_DEFAULT_GROW=y -CONFIG_LV_THEME_DEFAULT_TRANSITION_TIME=80 -CONFIG_LV_USE_THEME_SIMPLE=y -# CONFIG_LV_USE_THEME_MONO is not set -# end of Themes - -# -# Layouts -# -CONFIG_LV_USE_FLEX=y -CONFIG_LV_USE_GRID=y -# end of Layouts - -# -# 3rd Party Libraries -# -CONFIG_LV_FS_DEFAULT_DRIVER_LETTER=0 -# CONFIG_LV_USE_FS_STDIO is not set -# CONFIG_LV_USE_FS_POSIX is not set -# CONFIG_LV_USE_FS_WIN32 is not set -# CONFIG_LV_USE_FS_FATFS is not set -# CONFIG_LV_USE_FS_MEMFS is not set -# CONFIG_LV_USE_FS_LITTLEFS is not set -# CONFIG_LV_USE_FS_ARDUINO_ESP_LITTLEFS is not set -# CONFIG_LV_USE_FS_ARDUINO_SD is not set -# CONFIG_LV_USE_FS_UEFI is not set -# CONFIG_LV_USE_FS_FROGFS is not set -# CONFIG_LV_USE_LODEPNG is not set -# CONFIG_LV_USE_LIBPNG is not set -# CONFIG_LV_USE_BMP is not set -# CONFIG_LV_USE_TJPGD is not set -# CONFIG_LV_USE_LIBJPEG_TURBO is not set -# CONFIG_LV_USE_LIBWEBP is not set -# CONFIG_LV_USE_GIF is not set -# CONFIG_LV_BIN_DECODER_RAM_LOAD is not set -# CONFIG_LV_USE_RLE is not set -# CONFIG_LV_USE_QRCODE is not set -# CONFIG_LV_USE_BARCODE is not set -# CONFIG_LV_USE_FREETYPE is not set -# CONFIG_LV_USE_TINY_TTF is not set -# CONFIG_LV_USE_RLOTTIE is not set -# CONFIG_LV_USE_THORVG is not set -# CONFIG_LV_USE_NANOVG is not set -# CONFIG_LV_USE_LZ4 is not set -# CONFIG_LV_USE_FFMPEG is not set -# end of 3rd Party Libraries - -# -# Others -# -# CONFIG_LV_USE_SNAPSHOT is not set -# CONFIG_LV_USE_SYSMON is not set -# CONFIG_LV_USE_PROFILER is not set -# CONFIG_LV_USE_MONKEY is not set -# CONFIG_LV_USE_GRIDNAV is not set -# CONFIG_LV_USE_FRAGMENT is not set -# CONFIG_LV_USE_IMGFONT is not set -CONFIG_LV_USE_OBSERVER=y -# CONFIG_LV_USE_IME_PINYIN is not set -# CONFIG_LV_USE_FILE_EXPLORER is not set -# CONFIG_LV_USE_FONT_MANAGER is not set -# CONFIG_LV_USE_TEST is not set -# CONFIG_LV_USE_TRANSLATION is not set -# CONFIG_LV_USE_COLOR_FILTER is not set -CONFIG_LVGL_VERSION_MAJOR=9 -CONFIG_LVGL_VERSION_MINOR=5 -CONFIG_LVGL_VERSION_PATCH=0 -# end of Others - -# -# Devices -# -# CONFIG_LV_USE_SDL is not set -# CONFIG_LV_USE_X11 is not set -# CONFIG_LV_USE_WAYLAND is not set -# CONFIG_LV_USE_LINUX_FBDEV is not set -# CONFIG_LV_USE_NUTTX is not set -# CONFIG_LV_USE_LINUX_DRM is not set -# CONFIG_LV_USE_TFT_ESPI is not set -# CONFIG_LV_USE_LOVYAN_GFX is not set -# CONFIG_LV_USE_EVDEV is not set -# CONFIG_LV_USE_LIBINPUT is not set -# CONFIG_LV_USE_ST7735 is not set -# CONFIG_LV_USE_ST7789 is not set -# CONFIG_LV_USE_ST7796 is not set -# CONFIG_LV_USE_ILI9341 is not set -# CONFIG_LV_USE_GENERIC_MIPI is not set -# CONFIG_LV_USE_NXP_ELCDIF is not set -# CONFIG_LV_USE_RENESAS_GLCDC is not set -# CONFIG_LV_USE_ST_LTDC is not set -# CONFIG_LV_USE_FT81X is not set -# CONFIG_LV_USE_UEFI is not set -# CONFIG_LV_USE_QNX is not set -# end of Devices - -# -# Examples -# -CONFIG_LV_BUILD_EXAMPLES=y -# end of Examples - -# -# Demos -# -CONFIG_LV_BUILD_DEMOS=y -# CONFIG_LV_USE_DEMO_WIDGETS is not set -# CONFIG_LV_USE_DEMO_KEYPAD_AND_ENCODER is not set -# CONFIG_LV_USE_DEMO_BENCHMARK is not set -# CONFIG_LV_USE_DEMO_RENDER is not set -# CONFIG_LV_USE_DEMO_STRESS is not set -# CONFIG_LV_USE_DEMO_MUSIC is not set -# CONFIG_LV_USE_DEMO_FLEX_LAYOUT is not set -# CONFIG_LV_USE_DEMO_MULTILANG is not set -# CONFIG_LV_USE_DEMO_SMARTWATCH is not set -# CONFIG_LV_USE_DEMO_EBIKE is not set -# CONFIG_LV_USE_DEMO_HIGH_RES is not set -# end of Demos -# end of LVGL configuration -# end of Component config - -# CONFIG_IDF_EXPERIMENTAL_FEATURES is not set - -# Deprecated options for backward compatibility -# CONFIG_APP_BUILD_TYPE_ELF_RAM is not set -# CONFIG_NO_BLOBS is not set -CONFIG_APP_ROLLBACK_ENABLE=y -# CONFIG_APP_ANTI_ROLLBACK is not set -# CONFIG_LOG_BOOTLOADER_LEVEL_NONE is not set -# CONFIG_LOG_BOOTLOADER_LEVEL_ERROR is not set -# CONFIG_LOG_BOOTLOADER_LEVEL_WARN is not set -CONFIG_LOG_BOOTLOADER_LEVEL_INFO=y -# CONFIG_LOG_BOOTLOADER_LEVEL_DEBUG is not set -# CONFIG_LOG_BOOTLOADER_LEVEL_VERBOSE is not set -CONFIG_LOG_BOOTLOADER_LEVEL=3 -# CONFIG_FLASH_ENCRYPTION_ENABLED is not set -# CONFIG_FLASHMODE_QIO is not set -# CONFIG_FLASHMODE_QOUT is not set -CONFIG_FLASHMODE_DIO=y -# CONFIG_FLASHMODE_DOUT is not set -CONFIG_MONITOR_BAUD=115200 -CONFIG_OPTIMIZATION_LEVEL_DEBUG=y -CONFIG_COMPILER_OPTIMIZATION_LEVEL_DEBUG=y -CONFIG_COMPILER_OPTIMIZATION_DEFAULT=y -# CONFIG_OPTIMIZATION_LEVEL_RELEASE is not set -# CONFIG_COMPILER_OPTIMIZATION_LEVEL_RELEASE is not set -CONFIG_OPTIMIZATION_ASSERTIONS_ENABLED=y -# CONFIG_OPTIMIZATION_ASSERTIONS_SILENT is not set -# CONFIG_OPTIMIZATION_ASSERTIONS_DISABLED is not set -CONFIG_OPTIMIZATION_ASSERTION_LEVEL=2 -# CONFIG_CXX_EXCEPTIONS is not set -CONFIG_STACK_CHECK_NONE=y -# CONFIG_STACK_CHECK_NORM is not set -# CONFIG_STACK_CHECK_STRONG is not set -# CONFIG_STACK_CHECK_ALL is not set -# CONFIG_WARN_WRITE_STRINGS is not set -# CONFIG_ESP32_APPTRACE_DEST_TRAX is not set -CONFIG_ESP32_APPTRACE_DEST_NONE=y -CONFIG_ESP32_APPTRACE_LOCK_ENABLE=y -# CONFIG_ANA_CMPR_ISR_IRAM_SAFE is not set -# CONFIG_CAM_CTLR_MIPI_CSI_ISR_IRAM_SAFE is not set -# CONFIG_CAM_CTLR_ISP_DVP_ISR_IRAM_SAFE is not set -# CONFIG_CAM_CTLR_DVP_CAM_ISR_IRAM_SAFE is not set -# CONFIG_GPTIMER_ISR_IRAM_SAFE is not set -# CONFIG_MCPWM_ISR_IRAM_SAFE is not set -# CONFIG_EVENT_LOOP_PROFILING is not set -CONFIG_POST_EVENTS_FROM_ISR=y -CONFIG_POST_EVENTS_FROM_IRAM_ISR=y -CONFIG_GDBSTUB_SUPPORT_TASKS=y -CONFIG_GDBSTUB_MAX_TASKS=32 -# CONFIG_OTA_ALLOW_HTTP is not set -# CONFIG_ESP_SYSTEM_PD_FLASH is not set -CONFIG_PERIPH_CTRL_FUNC_IN_IRAM=y -CONFIG_BROWNOUT_DET=y -CONFIG_BROWNOUT_DET_LVL_SEL_7=y -# CONFIG_BROWNOUT_DET_LVL_SEL_6 is not set -# CONFIG_BROWNOUT_DET_LVL_SEL_5 is not set -CONFIG_BROWNOUT_DET_LVL=7 -CONFIG_ESP_SYSTEM_BROWNOUT_INTR=y -# CONFIG_LCD_DSI_ISR_IRAM_SAFE is not set -CONFIG_ESP_SYSTEM_PM_POWER_DOWN_CPU=y -CONFIG_SYSTEM_EVENT_QUEUE_SIZE=32 -CONFIG_SYSTEM_EVENT_TASK_STACK_SIZE=2304 -CONFIG_MAIN_TASK_STACK_SIZE=8192 -CONFIG_CONSOLE_UART_DEFAULT=y -# CONFIG_CONSOLE_UART_CUSTOM is not set -# CONFIG_CONSOLE_UART_NONE is not set -# CONFIG_ESP_CONSOLE_UART_NONE is not set -CONFIG_CONSOLE_UART=y -CONFIG_CONSOLE_UART_NUM=0 -CONFIG_CONSOLE_UART_BAUDRATE=115200 -CONFIG_INT_WDT=y -CONFIG_INT_WDT_TIMEOUT_MS=300 -CONFIG_INT_WDT_CHECK_CPU1=y -CONFIG_TASK_WDT=y -CONFIG_ESP_TASK_WDT=y -# CONFIG_TASK_WDT_PANIC is not set -CONFIG_TASK_WDT_TIMEOUT_S=5 -CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU0=y -CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU1=y -# CONFIG_ESP32_DEBUG_STUBS_ENABLE is not set -CONFIG_IPC_TASK_STACK_SIZE=1024 -CONFIG_TIMER_TASK_STACK_SIZE=3584 -# CONFIG_ESP32_ENABLE_COREDUMP_TO_FLASH is not set -# CONFIG_ESP32_ENABLE_COREDUMP_TO_UART is not set -CONFIG_ESP32_ENABLE_COREDUMP_TO_NONE=y -CONFIG_TIMER_TASK_PRIORITY=1 -CONFIG_TIMER_TASK_STACK_DEPTH=2048 -CONFIG_TIMER_QUEUE_LENGTH=10 -# CONFIG_ENABLE_STATIC_TASK_CLEAN_UP_HOOK is not set -# CONFIG_HAL_ASSERTION_SILIENT is not set -# CONFIG_L2_TO_L3_COPY is not set -CONFIG_ESP_GRATUITOUS_ARP=y -CONFIG_GARP_TMR_INTERVAL=60 -CONFIG_TCPIP_RECVMBOX_SIZE=32 -CONFIG_TCP_MAXRTX=12 -CONFIG_TCP_SYNMAXRTX=12 -CONFIG_TCP_MSS=1440 -CONFIG_TCP_MSL=60000 -CONFIG_TCP_SND_BUF_DEFAULT=5760 -CONFIG_TCP_WND_DEFAULT=5760 -CONFIG_TCP_RECVMBOX_SIZE=6 -CONFIG_TCP_QUEUE_OOSEQ=y -CONFIG_TCP_OVERSIZE_MSS=y -# CONFIG_TCP_OVERSIZE_QUARTER_MSS is not set -# CONFIG_TCP_OVERSIZE_DISABLE is not set -CONFIG_UDP_RECVMBOX_SIZE=6 -CONFIG_TCPIP_TASK_STACK_SIZE=3072 -CONFIG_TCPIP_TASK_AFFINITY_NO_AFFINITY=y -# CONFIG_TCPIP_TASK_AFFINITY_CPU0 is not set -# CONFIG_TCPIP_TASK_AFFINITY_CPU1 is not set -CONFIG_TCPIP_TASK_AFFINITY=0x7FFFFFFF -# CONFIG_PPP_SUPPORT is not set -CONFIG_NEWLIB_STDOUT_LINE_ENDING_CRLF=y -# CONFIG_NEWLIB_STDOUT_LINE_ENDING_LF is not set -# CONFIG_NEWLIB_STDOUT_LINE_ENDING_CR is not set -# CONFIG_NEWLIB_STDIN_LINE_ENDING_CRLF is not set -# CONFIG_NEWLIB_STDIN_LINE_ENDING_LF is not set -CONFIG_NEWLIB_STDIN_LINE_ENDING_CR=y -# CONFIG_NEWLIB_NANO_FORMAT is not set -CONFIG_NEWLIB_TIME_SYSCALL_USE_RTC_HRT=y -# CONFIG_NEWLIB_TIME_SYSCALL_USE_RTC is not set -# CONFIG_NEWLIB_TIME_SYSCALL_USE_HRT is not set -# CONFIG_NEWLIB_TIME_SYSCALL_USE_NONE is not set -CONFIG_ESP32_PTHREAD_TASK_PRIO_DEFAULT=5 -CONFIG_ESP32_PTHREAD_TASK_STACK_SIZE_DEFAULT=3072 -CONFIG_ESP32_PTHREAD_STACK_MIN=768 -CONFIG_ESP32_DEFAULT_PTHREAD_CORE_NO_AFFINITY=y -# CONFIG_ESP32_DEFAULT_PTHREAD_CORE_0 is not set -# CONFIG_ESP32_DEFAULT_PTHREAD_CORE_1 is not set -CONFIG_ESP32_PTHREAD_TASK_CORE_DEFAULT=-1 -CONFIG_ESP32_PTHREAD_TASK_NAME_DEFAULT="pthread" -CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ABORTS=y -# CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_FAILS is not set -# CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ALLOWED is not set -CONFIG_SUPPRESS_SELECT_DEBUG_OUTPUT=y -CONFIG_SUPPORT_TERMIOS=y -CONFIG_SEMIHOSTFS_MAX_MOUNT_POINTS=1 -# End of deprecated options diff --git a/firmware_p4/sdkconfig.defaults b/firmware_p4/sdkconfig.defaults new file mode 100644 index 00000000..6940570c --- /dev/null +++ b/firmware_p4/sdkconfig.defaults @@ -0,0 +1,44 @@ +# Flash — 32MB, 80MHz, DIO +CONFIG_ESPTOOLPY_FLASHSIZE_32MB=y +CONFIG_ESPTOOLPY_FLASHFREQ_80M=y +CONFIG_ESPTOOLPY_FLASHMODE_DIO=y + +# Custom partition table (with OTA) +CONFIG_PARTITION_TABLE_CUSTOM=y +CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv" + +# OTA rollback support in bootloader +CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE=y + +# CPU 360MHz (P4 maximum) +CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_360=y + +# PSRAM hex-octal mode, 200MHz — P4 specific +CONFIG_SPIRAM=y +CONFIG_SPIRAM_MODE_HEX=y +CONFIG_SPIRAM_SPEED_200M=y +CONFIG_SPIRAM_USE_MALLOC=y +CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=16384 +CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL=32768 + +# Larger stack for kernel_init +CONFIG_ESP_MAIN_TASK_STACK_SIZE=8192 + +# Primary console UART0, secondary USB JTAG +CONFIG_ESP_CONSOLE_UART_DEFAULT=y +CONFIG_ESP_CONSOLE_SECONDARY_USB_SERIAL_JTAG=y + +# TinyUSB HID — 2 interfaces (keyboard + mouse) for Bad USB +CONFIG_TINYUSB_HID_COUNT=2 +CONFIG_TINYUSB_MODE_DMA=y + +# Required for sys_monitor (uxTaskGetSystemState / vTaskList) +CONFIG_FREERTOS_USE_TRACE_FACILITY=y +CONFIG_FREERTOS_USE_STATS_FORMATTING_FUNCTIONS=y + +# LVGL fonts used by UI components +CONFIG_LV_FONT_MONTSERRAT_12=y +CONFIG_LV_FONT_MONTSERRAT_14=y + +# Default log level INFO +CONFIG_LOG_DEFAULT_LEVEL_INFO=y diff --git a/firmware_p4/sdkconfig.old b/firmware_p4/sdkconfig.old deleted file mode 100644 index f2bf5b89..00000000 --- a/firmware_p4/sdkconfig.old +++ /dev/null @@ -1,2934 +0,0 @@ -# -# Automatically generated file. DO NOT EDIT. -# Espressif IoT Development Framework (ESP-IDF) 5.5.1 Project Configuration -# -CONFIG_SOC_ADC_SUPPORTED=y -CONFIG_SOC_ANA_CMPR_SUPPORTED=y -CONFIG_SOC_DEDICATED_GPIO_SUPPORTED=y -CONFIG_SOC_UART_SUPPORTED=y -CONFIG_SOC_GDMA_SUPPORTED=y -CONFIG_SOC_UHCI_SUPPORTED=y -CONFIG_SOC_AHB_GDMA_SUPPORTED=y -CONFIG_SOC_AXI_GDMA_SUPPORTED=y -CONFIG_SOC_DW_GDMA_SUPPORTED=y -CONFIG_SOC_DMA2D_SUPPORTED=y -CONFIG_SOC_GPTIMER_SUPPORTED=y -CONFIG_SOC_PCNT_SUPPORTED=y -CONFIG_SOC_LCDCAM_SUPPORTED=y -CONFIG_SOC_LCDCAM_CAM_SUPPORTED=y -CONFIG_SOC_LCDCAM_I80_LCD_SUPPORTED=y -CONFIG_SOC_LCDCAM_RGB_LCD_SUPPORTED=y -CONFIG_SOC_MIPI_CSI_SUPPORTED=y -CONFIG_SOC_MIPI_DSI_SUPPORTED=y -CONFIG_SOC_MCPWM_SUPPORTED=y -CONFIG_SOC_TWAI_SUPPORTED=y -CONFIG_SOC_ETM_SUPPORTED=y -CONFIG_SOC_PARLIO_SUPPORTED=y -CONFIG_SOC_ASYNC_MEMCPY_SUPPORTED=y -CONFIG_SOC_EMAC_SUPPORTED=y -CONFIG_SOC_USB_OTG_SUPPORTED=y -CONFIG_SOC_WIRELESS_HOST_SUPPORTED=y -CONFIG_SOC_USB_SERIAL_JTAG_SUPPORTED=y -CONFIG_SOC_TEMP_SENSOR_SUPPORTED=y -CONFIG_SOC_SUPPORTS_SECURE_DL_MODE=y -CONFIG_SOC_ULP_SUPPORTED=y -CONFIG_SOC_LP_CORE_SUPPORTED=y -CONFIG_SOC_EFUSE_KEY_PURPOSE_FIELD=y -CONFIG_SOC_EFUSE_SUPPORTED=y -CONFIG_SOC_RTC_FAST_MEM_SUPPORTED=y -CONFIG_SOC_RTC_MEM_SUPPORTED=y -CONFIG_SOC_RMT_SUPPORTED=y -CONFIG_SOC_I2S_SUPPORTED=y -CONFIG_SOC_SDM_SUPPORTED=y -CONFIG_SOC_GPSPI_SUPPORTED=y -CONFIG_SOC_LEDC_SUPPORTED=y -CONFIG_SOC_ISP_SUPPORTED=y -CONFIG_SOC_I2C_SUPPORTED=y -CONFIG_SOC_SYSTIMER_SUPPORTED=y -CONFIG_SOC_AES_SUPPORTED=y -CONFIG_SOC_MPI_SUPPORTED=y -CONFIG_SOC_SHA_SUPPORTED=y -CONFIG_SOC_HMAC_SUPPORTED=y -CONFIG_SOC_DIG_SIGN_SUPPORTED=y -CONFIG_SOC_ECC_SUPPORTED=y -CONFIG_SOC_ECC_EXTENDED_MODES_SUPPORTED=y -CONFIG_SOC_FLASH_ENC_SUPPORTED=y -CONFIG_SOC_SECURE_BOOT_SUPPORTED=y -CONFIG_SOC_BOD_SUPPORTED=y -CONFIG_SOC_VBAT_SUPPORTED=y -CONFIG_SOC_APM_SUPPORTED=y -CONFIG_SOC_PMU_SUPPORTED=y -CONFIG_SOC_PMU_PVT_SUPPORTED=y -CONFIG_SOC_DCDC_SUPPORTED=y -CONFIG_SOC_PAU_SUPPORTED=y -CONFIG_SOC_LP_TIMER_SUPPORTED=y -CONFIG_SOC_ULP_LP_UART_SUPPORTED=y -CONFIG_SOC_LP_GPIO_MATRIX_SUPPORTED=y -CONFIG_SOC_LP_PERIPHERALS_SUPPORTED=y -CONFIG_SOC_LP_I2C_SUPPORTED=y -CONFIG_SOC_LP_I2S_SUPPORTED=y -CONFIG_SOC_LP_SPI_SUPPORTED=y -CONFIG_SOC_LP_ADC_SUPPORTED=y -CONFIG_SOC_LP_VAD_SUPPORTED=y -CONFIG_SOC_SPIRAM_SUPPORTED=y -CONFIG_SOC_PSRAM_DMA_CAPABLE=y -CONFIG_SOC_SDMMC_HOST_SUPPORTED=y -CONFIG_SOC_CLK_TREE_SUPPORTED=y -CONFIG_SOC_ASSIST_DEBUG_SUPPORTED=y -CONFIG_SOC_DEBUG_PROBE_SUPPORTED=y -CONFIG_SOC_WDT_SUPPORTED=y -CONFIG_SOC_SPI_FLASH_SUPPORTED=y -CONFIG_SOC_TOUCH_SENSOR_SUPPORTED=y -CONFIG_SOC_RNG_SUPPORTED=y -CONFIG_SOC_GP_LDO_SUPPORTED=y -CONFIG_SOC_PPA_SUPPORTED=y -CONFIG_SOC_LIGHT_SLEEP_SUPPORTED=y -CONFIG_SOC_DEEP_SLEEP_SUPPORTED=y -CONFIG_SOC_PM_SUPPORTED=y -CONFIG_SOC_BITSCRAMBLER_SUPPORTED=y -CONFIG_SOC_SIMD_INSTRUCTION_SUPPORTED=y -CONFIG_SOC_I3C_MASTER_SUPPORTED=y -CONFIG_SOC_XTAL_SUPPORT_40M=y -CONFIG_SOC_AES_SUPPORT_DMA=y -CONFIG_SOC_AES_SUPPORT_GCM=y -CONFIG_SOC_AES_GDMA=y -CONFIG_SOC_AES_SUPPORT_AES_128=y -CONFIG_SOC_AES_SUPPORT_AES_256=y -CONFIG_SOC_ADC_RTC_CTRL_SUPPORTED=y -CONFIG_SOC_ADC_DIG_CTRL_SUPPORTED=y -CONFIG_SOC_ADC_DMA_SUPPORTED=y -CONFIG_SOC_ADC_PERIPH_NUM=2 -CONFIG_SOC_ADC_MAX_CHANNEL_NUM=8 -CONFIG_SOC_ADC_ATTEN_NUM=4 -CONFIG_SOC_ADC_DIGI_CONTROLLER_NUM=2 -CONFIG_SOC_ADC_PATT_LEN_MAX=16 -CONFIG_SOC_ADC_DIGI_MAX_BITWIDTH=12 -CONFIG_SOC_ADC_DIGI_MIN_BITWIDTH=12 -CONFIG_SOC_ADC_DIGI_IIR_FILTER_NUM=2 -CONFIG_SOC_ADC_DIGI_MONITOR_NUM=2 -CONFIG_SOC_ADC_DIGI_RESULT_BYTES=4 -CONFIG_SOC_ADC_DIGI_DATA_BYTES_PER_CONV=4 -CONFIG_SOC_ADC_SAMPLE_FREQ_THRES_HIGH=83333 -CONFIG_SOC_ADC_SAMPLE_FREQ_THRES_LOW=611 -CONFIG_SOC_ADC_RTC_MIN_BITWIDTH=12 -CONFIG_SOC_ADC_RTC_MAX_BITWIDTH=12 -CONFIG_SOC_ADC_CALIBRATION_V1_SUPPORTED=y -CONFIG_SOC_ADC_SELF_HW_CALI_SUPPORTED=y -CONFIG_SOC_ADC_CALIB_CHAN_COMPENS_SUPPORTED=y -CONFIG_SOC_ADC_SHARED_POWER=y -CONFIG_SOC_BROWNOUT_RESET_SUPPORTED=y -CONFIG_SOC_SHARED_IDCACHE_SUPPORTED=y -CONFIG_SOC_CACHE_WRITEBACK_SUPPORTED=y -CONFIG_SOC_CACHE_FREEZE_SUPPORTED=y -CONFIG_SOC_CACHE_INTERNAL_MEM_VIA_L1CACHE=y -CONFIG_SOC_CPU_CORES_NUM=2 -CONFIG_SOC_CPU_INTR_NUM=32 -CONFIG_SOC_CPU_HAS_FLEXIBLE_INTC=y -CONFIG_SOC_INT_CLIC_SUPPORTED=y -CONFIG_SOC_INT_HW_NESTED_SUPPORTED=y -CONFIG_SOC_BRANCH_PREDICTOR_SUPPORTED=y -CONFIG_SOC_CPU_COPROC_NUM=3 -CONFIG_SOC_CPU_HAS_FPU=y -CONFIG_SOC_CPU_HAS_FPU_EXT_ILL_BUG=y -CONFIG_SOC_CPU_HAS_HWLOOP=y -CONFIG_SOC_CPU_HAS_HWLOOP_STATE_BUG=y -CONFIG_SOC_CPU_HAS_PIE=y -CONFIG_SOC_HP_CPU_HAS_MULTIPLE_CORES=y -CONFIG_SOC_CPU_BREAKPOINTS_NUM=3 -CONFIG_SOC_CPU_WATCHPOINTS_NUM=3 -CONFIG_SOC_CPU_WATCHPOINT_MAX_REGION_SIZE=0x100 -CONFIG_SOC_CPU_HAS_PMA=y -CONFIG_SOC_CPU_IDRAM_SPLIT_USING_PMP=y -CONFIG_SOC_CPU_PMP_REGION_GRANULARITY=128 -CONFIG_SOC_CPU_HAS_LOCKUP_RESET=y -CONFIG_SOC_SIMD_PREFERRED_DATA_ALIGNMENT=16 -CONFIG_SOC_DS_SIGNATURE_MAX_BIT_LEN=4096 -CONFIG_SOC_DS_KEY_PARAM_MD_IV_LENGTH=16 -CONFIG_SOC_DS_KEY_CHECK_MAX_WAIT_US=1100 -CONFIG_SOC_DMA_CAN_ACCESS_FLASH=y -CONFIG_SOC_AHB_GDMA_VERSION=2 -CONFIG_SOC_GDMA_SUPPORT_CRC=y -CONFIG_SOC_GDMA_NUM_GROUPS_MAX=2 -CONFIG_SOC_GDMA_PAIRS_PER_GROUP_MAX=3 -CONFIG_SOC_AXI_GDMA_SUPPORT_PSRAM=y -CONFIG_SOC_GDMA_SUPPORT_ETM=y -CONFIG_SOC_GDMA_SUPPORT_SLEEP_RETENTION=y -CONFIG_SOC_AXI_DMA_EXT_MEM_ENC_ALIGNMENT=16 -CONFIG_SOC_DMA2D_GROUPS=1 -CONFIG_SOC_DMA2D_TX_CHANNELS_PER_GROUP=3 -CONFIG_SOC_DMA2D_RX_CHANNELS_PER_GROUP=2 -CONFIG_SOC_ETM_GROUPS=1 -CONFIG_SOC_ETM_CHANNELS_PER_GROUP=50 -CONFIG_SOC_ETM_SUPPORT_SLEEP_RETENTION=y -CONFIG_SOC_GPIO_PORT=1 -CONFIG_SOC_GPIO_PIN_COUNT=55 -CONFIG_SOC_GPIO_SUPPORT_PIN_GLITCH_FILTER=y -CONFIG_SOC_GPIO_FLEX_GLITCH_FILTER_NUM=8 -CONFIG_SOC_GPIO_SUPPORT_PIN_HYS_FILTER=y -CONFIG_SOC_GPIO_SUPPORT_ETM=y -CONFIG_SOC_GPIO_SUPPORT_RTC_INDEPENDENT=y -CONFIG_SOC_GPIO_SUPPORT_DEEPSLEEP_WAKEUP=y -CONFIG_SOC_LP_IO_HAS_INDEPENDENT_WAKEUP_SOURCE=y -CONFIG_SOC_LP_IO_CLOCK_IS_INDEPENDENT=y -CONFIG_SOC_GPIO_VALID_GPIO_MASK=0x007FFFFFFFFFFFFF -CONFIG_SOC_GPIO_IN_RANGE_MAX=54 -CONFIG_SOC_GPIO_OUT_RANGE_MAX=54 -CONFIG_SOC_GPIO_DEEP_SLEEP_WAKE_VALID_GPIO_MASK=0 -CONFIG_SOC_GPIO_DEEP_SLEEP_WAKE_SUPPORTED_PIN_CNT=16 -CONFIG_SOC_GPIO_VALID_DIGITAL_IO_PAD_MASK=0x007FFFFFFFFF0000 -CONFIG_SOC_GPIO_CLOCKOUT_BY_GPIO_MATRIX=y -CONFIG_SOC_GPIO_CLOCKOUT_CHANNEL_NUM=2 -CONFIG_SOC_CLOCKOUT_SUPPORT_CHANNEL_DIVIDER=y -CONFIG_SOC_DEBUG_PROBE_NUM_UNIT=1 -CONFIG_SOC_DEBUG_PROBE_MAX_OUTPUT_WIDTH=16 -CONFIG_SOC_GPIO_SUPPORT_FORCE_HOLD=y -CONFIG_SOC_RTCIO_PIN_COUNT=16 -CONFIG_SOC_RTCIO_INPUT_OUTPUT_SUPPORTED=y -CONFIG_SOC_RTCIO_HOLD_SUPPORTED=y -CONFIG_SOC_RTCIO_WAKE_SUPPORTED=y -CONFIG_SOC_RTCIO_EDGE_WAKE_SUPPORTED=y -CONFIG_SOC_DEDIC_GPIO_OUT_CHANNELS_NUM=8 -CONFIG_SOC_DEDIC_GPIO_IN_CHANNELS_NUM=8 -CONFIG_SOC_DEDIC_PERIPH_ALWAYS_ENABLE=y -CONFIG_SOC_ANA_CMPR_NUM=2 -CONFIG_SOC_ANA_CMPR_CAN_DISTINGUISH_EDGE=y -CONFIG_SOC_ANA_CMPR_SUPPORT_ETM=y -CONFIG_SOC_I2C_NUM=3 -CONFIG_SOC_HP_I2C_NUM=2 -CONFIG_SOC_I2C_FIFO_LEN=32 -CONFIG_SOC_I2C_CMD_REG_NUM=8 -CONFIG_SOC_I2C_SUPPORT_SLAVE=y -CONFIG_SOC_I2C_SUPPORT_HW_FSM_RST=y -CONFIG_SOC_I2C_SUPPORT_HW_CLR_BUS=y -CONFIG_SOC_I2C_SUPPORT_XTAL=y -CONFIG_SOC_I2C_SUPPORT_RTC=y -CONFIG_SOC_I2C_SUPPORT_10BIT_ADDR=y -CONFIG_SOC_I2C_SLAVE_SUPPORT_BROADCAST=y -CONFIG_SOC_I2C_SLAVE_CAN_GET_STRETCH_CAUSE=y -CONFIG_SOC_I2C_SLAVE_SUPPORT_I2CRAM_ACCESS=y -CONFIG_SOC_I2C_SLAVE_SUPPORT_SLAVE_UNMATCH=y -CONFIG_SOC_I2C_SUPPORT_SLEEP_RETENTION=y -CONFIG_SOC_LP_I2C_NUM=1 -CONFIG_SOC_LP_I2C_FIFO_LEN=16 -CONFIG_SOC_I2S_NUM=3 -CONFIG_SOC_I2S_HW_VERSION_2=y -CONFIG_SOC_I2S_SUPPORTS_ETM=y -CONFIG_SOC_I2S_SUPPORTS_XTAL=y -CONFIG_SOC_I2S_SUPPORTS_APLL=y -CONFIG_SOC_I2S_SUPPORTS_PCM=y -CONFIG_SOC_I2S_SUPPORTS_PDM=y -CONFIG_SOC_I2S_SUPPORTS_PDM_TX=y -CONFIG_SOC_I2S_SUPPORTS_PCM2PDM=y -CONFIG_SOC_I2S_SUPPORTS_PDM_RX=y -CONFIG_SOC_I2S_SUPPORTS_PDM2PCM=y -CONFIG_SOC_I2S_SUPPORTS_PDM_RX_HP_FILTER=y -CONFIG_SOC_I2S_SUPPORTS_TX_SYNC_CNT=y -CONFIG_SOC_I2S_SUPPORTS_TDM=y -CONFIG_SOC_I2S_PDM_MAX_TX_LINES=2 -CONFIG_SOC_I2S_PDM_MAX_RX_LINES=4 -CONFIG_SOC_I2S_TDM_FULL_DATA_WIDTH=y -CONFIG_SOC_I2S_SUPPORT_SLEEP_RETENTION=y -CONFIG_SOC_LP_I2S_NUM=1 -CONFIG_SOC_ISP_BF_SUPPORTED=y -CONFIG_SOC_ISP_CCM_SUPPORTED=y -CONFIG_SOC_ISP_DEMOSAIC_SUPPORTED=y -CONFIG_SOC_ISP_DVP_SUPPORTED=y -CONFIG_SOC_ISP_SHARPEN_SUPPORTED=y -CONFIG_SOC_ISP_COLOR_SUPPORTED=y -CONFIG_SOC_ISP_LSC_SUPPORTED=y -CONFIG_SOC_ISP_SHARE_CSI_BRG=y -CONFIG_SOC_ISP_NUMS=1 -CONFIG_SOC_ISP_DVP_CTLR_NUMS=1 -CONFIG_SOC_ISP_AE_CTLR_NUMS=1 -CONFIG_SOC_ISP_AE_BLOCK_X_NUMS=5 -CONFIG_SOC_ISP_AE_BLOCK_Y_NUMS=5 -CONFIG_SOC_ISP_AF_CTLR_NUMS=1 -CONFIG_SOC_ISP_AF_WINDOW_NUMS=3 -CONFIG_SOC_ISP_BF_TEMPLATE_X_NUMS=3 -CONFIG_SOC_ISP_BF_TEMPLATE_Y_NUMS=3 -CONFIG_SOC_ISP_CCM_DIMENSION=3 -CONFIG_SOC_ISP_DEMOSAIC_GRAD_RATIO_INT_BITS=2 -CONFIG_SOC_ISP_DEMOSAIC_GRAD_RATIO_DEC_BITS=4 -CONFIG_SOC_ISP_DEMOSAIC_GRAD_RATIO_RES_BITS=26 -CONFIG_SOC_ISP_DVP_DATA_WIDTH_MAX=16 -CONFIG_SOC_ISP_SHARPEN_TEMPLATE_X_NUMS=3 -CONFIG_SOC_ISP_SHARPEN_TEMPLATE_Y_NUMS=3 -CONFIG_SOC_ISP_SHARPEN_H_FREQ_COEF_INT_BITS=3 -CONFIG_SOC_ISP_SHARPEN_H_FREQ_COEF_DEC_BITS=5 -CONFIG_SOC_ISP_SHARPEN_H_FREQ_COEF_RES_BITS=24 -CONFIG_SOC_ISP_SHARPEN_M_FREQ_COEF_INT_BITS=3 -CONFIG_SOC_ISP_SHARPEN_M_FREQ_COEF_DEC_BITS=5 -CONFIG_SOC_ISP_SHARPEN_M_FREQ_COEF_RES_BITS=24 -CONFIG_SOC_ISP_HIST_CTLR_NUMS=1 -CONFIG_SOC_ISP_HIST_BLOCK_X_NUMS=5 -CONFIG_SOC_ISP_HIST_BLOCK_Y_NUMS=5 -CONFIG_SOC_ISP_HIST_SEGMENT_NUMS=16 -CONFIG_SOC_ISP_HIST_INTERVAL_NUMS=15 -CONFIG_SOC_ISP_LSC_GRAD_RATIO_INT_BITS=2 -CONFIG_SOC_ISP_LSC_GRAD_RATIO_DEC_BITS=8 -CONFIG_SOC_ISP_LSC_GRAD_RATIO_RES_BITS=22 -CONFIG_SOC_LEDC_SUPPORT_PLL_DIV_CLOCK=y -CONFIG_SOC_LEDC_SUPPORT_XTAL_CLOCK=y -CONFIG_SOC_LEDC_TIMER_NUM=4 -CONFIG_SOC_LEDC_CHANNEL_NUM=8 -CONFIG_SOC_LEDC_TIMER_BIT_WIDTH=20 -CONFIG_SOC_LEDC_GAMMA_CURVE_FADE_SUPPORTED=y -CONFIG_SOC_LEDC_GAMMA_CURVE_FADE_RANGE_MAX=16 -CONFIG_SOC_LEDC_SUPPORT_FADE_STOP=y -CONFIG_SOC_LEDC_FADE_PARAMS_BIT_WIDTH=10 -CONFIG_SOC_LEDC_SUPPORT_SLEEP_RETENTION=y -CONFIG_SOC_MMU_PERIPH_NUM=2 -CONFIG_SOC_MMU_LINEAR_ADDRESS_REGION_NUM=2 -CONFIG_SOC_MMU_DI_VADDR_SHARED=y -CONFIG_SOC_MMU_PER_EXT_MEM_TARGET=y -CONFIG_SOC_MPU_MIN_REGION_SIZE=0x20000000 -CONFIG_SOC_MPU_REGIONS_MAX_NUM=8 -CONFIG_SOC_PCNT_GROUPS=1 -CONFIG_SOC_PCNT_UNITS_PER_GROUP=4 -CONFIG_SOC_PCNT_CHANNELS_PER_UNIT=2 -CONFIG_SOC_PCNT_THRES_POINT_PER_UNIT=2 -CONFIG_SOC_PCNT_SUPPORT_RUNTIME_THRES_UPDATE=y -CONFIG_SOC_PCNT_SUPPORT_CLEAR_SIGNAL=y -CONFIG_SOC_PCNT_SUPPORT_SLEEP_RETENTION=y -CONFIG_SOC_RMT_GROUPS=1 -CONFIG_SOC_RMT_TX_CANDIDATES_PER_GROUP=4 -CONFIG_SOC_RMT_RX_CANDIDATES_PER_GROUP=4 -CONFIG_SOC_RMT_CHANNELS_PER_GROUP=8 -CONFIG_SOC_RMT_MEM_WORDS_PER_CHANNEL=48 -CONFIG_SOC_RMT_SUPPORT_RX_PINGPONG=y -CONFIG_SOC_RMT_SUPPORT_RX_DEMODULATION=y -CONFIG_SOC_RMT_SUPPORT_TX_ASYNC_STOP=y -CONFIG_SOC_RMT_SUPPORT_TX_LOOP_COUNT=y -CONFIG_SOC_RMT_SUPPORT_TX_LOOP_AUTO_STOP=y -CONFIG_SOC_RMT_SUPPORT_TX_SYNCHRO=y -CONFIG_SOC_RMT_SUPPORT_TX_CARRIER_DATA_ONLY=y -CONFIG_SOC_RMT_SUPPORT_XTAL=y -CONFIG_SOC_RMT_SUPPORT_RC_FAST=y -CONFIG_SOC_RMT_SUPPORT_DMA=y -CONFIG_SOC_RMT_SUPPORT_SLEEP_RETENTION=y -CONFIG_SOC_LCD_I80_SUPPORTED=y -CONFIG_SOC_LCD_RGB_SUPPORTED=y -CONFIG_SOC_LCDCAM_I80_NUM_BUSES=1 -CONFIG_SOC_LCDCAM_I80_BUS_WIDTH=24 -CONFIG_SOC_LCDCAM_RGB_NUM_PANELS=1 -CONFIG_SOC_LCDCAM_RGB_DATA_WIDTH=24 -CONFIG_SOC_LCD_SUPPORT_RGB_YUV_CONV=y -CONFIG_SOC_MCPWM_GROUPS=2 -CONFIG_SOC_MCPWM_TIMERS_PER_GROUP=3 -CONFIG_SOC_MCPWM_OPERATORS_PER_GROUP=3 -CONFIG_SOC_MCPWM_COMPARATORS_PER_OPERATOR=2 -CONFIG_SOC_MCPWM_EVENT_COMPARATORS_PER_OPERATOR=2 -CONFIG_SOC_MCPWM_GENERATORS_PER_OPERATOR=2 -CONFIG_SOC_MCPWM_TRIGGERS_PER_OPERATOR=2 -CONFIG_SOC_MCPWM_GPIO_FAULTS_PER_GROUP=3 -CONFIG_SOC_MCPWM_CAPTURE_TIMERS_PER_GROUP=y -CONFIG_SOC_MCPWM_CAPTURE_CHANNELS_PER_TIMER=3 -CONFIG_SOC_MCPWM_GPIO_SYNCHROS_PER_GROUP=3 -CONFIG_SOC_MCPWM_SWSYNC_CAN_PROPAGATE=y -CONFIG_SOC_MCPWM_SUPPORT_ETM=y -CONFIG_SOC_MCPWM_SUPPORT_EVENT_COMPARATOR=y -CONFIG_SOC_MCPWM_CAPTURE_CLK_FROM_GROUP=y -CONFIG_SOC_MCPWM_SUPPORT_SLEEP_RETENTION=y -CONFIG_SOC_USB_OTG_PERIPH_NUM=2 -CONFIG_SOC_USB_UTMI_PHY_NUM=1 -CONFIG_SOC_USB_UTMI_PHY_NO_POWER_OFF_ISO=y -CONFIG_SOC_PARLIO_GROUPS=1 -CONFIG_SOC_PARLIO_TX_UNITS_PER_GROUP=1 -CONFIG_SOC_PARLIO_RX_UNITS_PER_GROUP=1 -CONFIG_SOC_PARLIO_TX_UNIT_MAX_DATA_WIDTH=16 -CONFIG_SOC_PARLIO_RX_UNIT_MAX_DATA_WIDTH=16 -CONFIG_SOC_PARLIO_TX_CLK_SUPPORT_GATING=y -CONFIG_SOC_PARLIO_RX_CLK_SUPPORT_GATING=y -CONFIG_SOC_PARLIO_RX_CLK_SUPPORT_OUTPUT=y -CONFIG_SOC_PARLIO_TRANS_BIT_ALIGN=y -CONFIG_SOC_PARLIO_TX_SUPPORT_LOOP_TRANSMISSION=y -CONFIG_SOC_PARLIO_SUPPORT_SLEEP_RETENTION=y -CONFIG_SOC_PARLIO_SUPPORT_SPI_LCD=y -CONFIG_SOC_PARLIO_SUPPORT_I80_LCD=y -CONFIG_SOC_MPI_MEM_BLOCKS_NUM=4 -CONFIG_SOC_MPI_OPERATIONS_NUM=3 -CONFIG_SOC_RSA_MAX_BIT_LEN=4096 -CONFIG_SOC_SDMMC_USE_IOMUX=y -CONFIG_SOC_SDMMC_USE_GPIO_MATRIX=y -CONFIG_SOC_SDMMC_NUM_SLOTS=2 -CONFIG_SOC_SDMMC_DELAY_PHASE_NUM=4 -CONFIG_SOC_SDMMC_IO_POWER_EXTERNAL=y -CONFIG_SOC_SDMMC_PSRAM_DMA_CAPABLE=y -CONFIG_SOC_SDMMC_UHS_I_SUPPORTED=y -CONFIG_SOC_SHA_DMA_MAX_BUFFER_SIZE=3968 -CONFIG_SOC_SHA_SUPPORT_DMA=y -CONFIG_SOC_SHA_SUPPORT_RESUME=y -CONFIG_SOC_SHA_GDMA=y -CONFIG_SOC_SHA_SUPPORT_SHA1=y -CONFIG_SOC_SHA_SUPPORT_SHA224=y -CONFIG_SOC_SHA_SUPPORT_SHA256=y -CONFIG_SOC_SHA_SUPPORT_SHA384=y -CONFIG_SOC_SHA_SUPPORT_SHA512=y -CONFIG_SOC_SHA_SUPPORT_SHA512_224=y -CONFIG_SOC_SHA_SUPPORT_SHA512_256=y -CONFIG_SOC_SHA_SUPPORT_SHA512_T=y -CONFIG_SOC_ECDSA_SUPPORT_EXPORT_PUBKEY=y -CONFIG_SOC_ECDSA_SUPPORT_DETERMINISTIC_MODE=y -CONFIG_SOC_ECDSA_USES_MPI=y -CONFIG_SOC_SDM_GROUPS=1 -CONFIG_SOC_SDM_CHANNELS_PER_GROUP=8 -CONFIG_SOC_SDM_CLK_SUPPORT_PLL_F80M=y -CONFIG_SOC_SDM_CLK_SUPPORT_XTAL=y -CONFIG_SOC_SPI_PERIPH_NUM=3 -CONFIG_SOC_SPI_MAX_CS_NUM=6 -CONFIG_SOC_SPI_MAXIMUM_BUFFER_SIZE=64 -CONFIG_SOC_SPI_SUPPORT_SLEEP_RETENTION=y -CONFIG_SOC_SPI_SUPPORT_SLAVE_HD_VER2=y -CONFIG_SOC_SPI_SLAVE_SUPPORT_SEG_TRANS=y -CONFIG_SOC_SPI_SUPPORT_DDRCLK=y -CONFIG_SOC_SPI_SUPPORT_CD_SIG=y -CONFIG_SOC_SPI_SUPPORT_OCT=y -CONFIG_SOC_SPI_SUPPORT_CLK_XTAL=y -CONFIG_SOC_SPI_SUPPORT_CLK_RC_FAST=y -CONFIG_SOC_SPI_SUPPORT_CLK_SPLL=y -CONFIG_SOC_MSPI_HAS_INDEPENT_IOMUX=y -CONFIG_SOC_MEMSPI_IS_INDEPENDENT=y -CONFIG_SOC_SPI_MAX_PRE_DIVIDER=16 -CONFIG_SOC_LP_SPI_PERIPH_NUM=y -CONFIG_SOC_LP_SPI_MAXIMUM_BUFFER_SIZE=64 -CONFIG_SOC_SPIRAM_XIP_SUPPORTED=y -CONFIG_SOC_SPI_MEM_SUPPORT_AUTO_WAIT_IDLE=y -CONFIG_SOC_SPI_MEM_SUPPORT_AUTO_SUSPEND=y -CONFIG_SOC_SPI_MEM_SUPPORT_AUTO_RESUME=y -CONFIG_SOC_SPI_MEM_SUPPORT_IDLE_INTR=y -CONFIG_SOC_SPI_MEM_SUPPORT_SW_SUSPEND=y -CONFIG_SOC_SPI_MEM_SUPPORT_CHECK_SUS=y -CONFIG_SOC_SPI_MEM_SUPPORT_TIMING_TUNING=y -CONFIG_SOC_MEMSPI_TIMING_TUNING_BY_DQS=y -CONFIG_SOC_MEMSPI_TIMING_TUNING_BY_FLASH_DELAY=y -CONFIG_SOC_SPI_MEM_SUPPORT_CACHE_32BIT_ADDR_MAP=y -CONFIG_SOC_SPI_PERIPH_SUPPORT_CONTROL_DUMMY_OUT=y -CONFIG_SOC_MEMSPI_SRC_FREQ_80M_SUPPORTED=y -CONFIG_SOC_MEMSPI_SRC_FREQ_40M_SUPPORTED=y -CONFIG_SOC_MEMSPI_SRC_FREQ_20M_SUPPORTED=y -CONFIG_SOC_MEMSPI_SRC_FREQ_120M_SUPPORTED=y -CONFIG_SOC_MEMSPI_FLASH_PSRAM_INDEPENDENT=y -CONFIG_SOC_SYSTIMER_COUNTER_NUM=2 -CONFIG_SOC_SYSTIMER_ALARM_NUM=3 -CONFIG_SOC_SYSTIMER_BIT_WIDTH_LO=32 -CONFIG_SOC_SYSTIMER_BIT_WIDTH_HI=20 -CONFIG_SOC_SYSTIMER_FIXED_DIVIDER=y -CONFIG_SOC_SYSTIMER_SUPPORT_RC_FAST=y -CONFIG_SOC_SYSTIMER_INT_LEVEL=y -CONFIG_SOC_SYSTIMER_ALARM_MISS_COMPENSATE=y -CONFIG_SOC_SYSTIMER_SUPPORT_ETM=y -CONFIG_SOC_LP_TIMER_BIT_WIDTH_LO=32 -CONFIG_SOC_LP_TIMER_BIT_WIDTH_HI=16 -CONFIG_SOC_TIMER_GROUPS=2 -CONFIG_SOC_TIMER_GROUP_TIMERS_PER_GROUP=2 -CONFIG_SOC_TIMER_GROUP_COUNTER_BIT_WIDTH=54 -CONFIG_SOC_TIMER_GROUP_SUPPORT_XTAL=y -CONFIG_SOC_TIMER_GROUP_SUPPORT_RC_FAST=y -CONFIG_SOC_TIMER_GROUP_TOTAL_TIMERS=4 -CONFIG_SOC_TIMER_SUPPORT_ETM=y -CONFIG_SOC_TIMER_SUPPORT_SLEEP_RETENTION=y -CONFIG_SOC_MWDT_SUPPORT_XTAL=y -CONFIG_SOC_MWDT_SUPPORT_SLEEP_RETENTION=y -CONFIG_SOC_TOUCH_SENSOR_VERSION=3 -CONFIG_SOC_TOUCH_SENSOR_NUM=14 -CONFIG_SOC_TOUCH_MIN_CHAN_ID=1 -CONFIG_SOC_TOUCH_MAX_CHAN_ID=14 -CONFIG_SOC_TOUCH_SUPPORT_SLEEP_WAKEUP=y -CONFIG_SOC_TOUCH_SUPPORT_BENCHMARK=y -CONFIG_SOC_TOUCH_SUPPORT_WATERPROOF=y -CONFIG_SOC_TOUCH_SUPPORT_PROX_SENSING=y -CONFIG_SOC_TOUCH_PROXIMITY_CHANNEL_NUM=3 -CONFIG_SOC_TOUCH_PROXIMITY_MEAS_DONE_SUPPORTED=y -CONFIG_SOC_TOUCH_SUPPORT_FREQ_HOP=y -CONFIG_SOC_TOUCH_SAMPLE_CFG_NUM=3 -CONFIG_SOC_TWAI_CONTROLLER_NUM=3 -CONFIG_SOC_TWAI_MASK_FILTER_NUM=1 -CONFIG_SOC_TWAI_CLK_SUPPORT_XTAL=y -CONFIG_SOC_TWAI_BRP_MIN=2 -CONFIG_SOC_TWAI_BRP_MAX=32768 -CONFIG_SOC_TWAI_SUPPORTS_RX_STATUS=y -CONFIG_SOC_TWAI_SUPPORT_SLEEP_RETENTION=y -CONFIG_SOC_EFUSE_DIS_PAD_JTAG=y -CONFIG_SOC_EFUSE_DIS_USB_JTAG=y -CONFIG_SOC_EFUSE_DIS_DIRECT_BOOT=y -CONFIG_SOC_EFUSE_SOFT_DIS_JTAG=y -CONFIG_SOC_EFUSE_DIS_DOWNLOAD_MSPI=y -CONFIG_SOC_EFUSE_ECDSA_KEY=y -CONFIG_SOC_KEY_MANAGER_SUPPORT_KEY_DEPLOYMENT=y -CONFIG_SOC_KEY_MANAGER_ECDSA_KEY_DEPLOY=y -CONFIG_SOC_KEY_MANAGER_FE_KEY_DEPLOY=y -CONFIG_SOC_KEY_MANAGER_FE_KEY_DEPLOY_XTS_AES_128=y -CONFIG_SOC_KEY_MANAGER_FE_KEY_DEPLOY_XTS_AES_256=y -CONFIG_SOC_SECURE_BOOT_V2_RSA=y -CONFIG_SOC_SECURE_BOOT_V2_ECC=y -CONFIG_SOC_EFUSE_SECURE_BOOT_KEY_DIGESTS=3 -CONFIG_SOC_EFUSE_REVOKE_BOOT_KEY_DIGESTS=y -CONFIG_SOC_SUPPORT_SECURE_BOOT_REVOKE_KEY=y -CONFIG_SOC_FLASH_ENCRYPTED_XTS_AES_BLOCK_MAX=64 -CONFIG_SOC_FLASH_ENCRYPTION_XTS_AES=y -CONFIG_SOC_FLASH_ENCRYPTION_XTS_AES_OPTIONS=y -CONFIG_SOC_FLASH_ENCRYPTION_XTS_AES_128=y -CONFIG_SOC_FLASH_ENCRYPTION_XTS_AES_256=y -CONFIG_SOC_UART_NUM=6 -CONFIG_SOC_UART_HP_NUM=5 -CONFIG_SOC_UART_LP_NUM=1 -CONFIG_SOC_UART_FIFO_LEN=128 -CONFIG_SOC_LP_UART_FIFO_LEN=16 -CONFIG_SOC_UART_BITRATE_MAX=5000000 -CONFIG_SOC_UART_SUPPORT_PLL_F80M_CLK=y -CONFIG_SOC_UART_SUPPORT_RTC_CLK=y -CONFIG_SOC_UART_SUPPORT_XTAL_CLK=y -CONFIG_SOC_UART_SUPPORT_WAKEUP_INT=y -CONFIG_SOC_UART_HAS_LP_UART=y -CONFIG_SOC_UART_SUPPORT_SLEEP_RETENTION=y -CONFIG_SOC_UART_SUPPORT_FSM_TX_WAIT_SEND=y -CONFIG_SOC_UART_WAKEUP_CHARS_SEQ_MAX_LEN=5 -CONFIG_SOC_UART_WAKEUP_SUPPORT_ACTIVE_THRESH_MODE=y -CONFIG_SOC_UART_WAKEUP_SUPPORT_FIFO_THRESH_MODE=y -CONFIG_SOC_UART_WAKEUP_SUPPORT_START_BIT_MODE=y -CONFIG_SOC_UART_WAKEUP_SUPPORT_CHAR_SEQ_MODE=y -CONFIG_SOC_LP_I2S_SUPPORT_VAD=y -CONFIG_SOC_UHCI_NUM=1 -CONFIG_SOC_COEX_HW_PTI=y -CONFIG_SOC_PHY_DIG_REGS_MEM_SIZE=21 -CONFIG_SOC_WIFI_LIGHT_SLEEP_CLK_WIDTH=12 -CONFIG_SOC_PM_SUPPORT_EXT1_WAKEUP=y -CONFIG_SOC_PM_SUPPORT_EXT1_WAKEUP_MODE_PER_PIN=y -CONFIG_SOC_PM_EXT1_WAKEUP_BY_PMU=y -CONFIG_SOC_PM_SUPPORT_WIFI_WAKEUP=y -CONFIG_SOC_PM_SUPPORT_TOUCH_SENSOR_WAKEUP=y -CONFIG_SOC_PM_SUPPORT_XTAL32K_PD=y -CONFIG_SOC_PM_SUPPORT_RC32K_PD=y -CONFIG_SOC_PM_SUPPORT_RC_FAST_PD=y -CONFIG_SOC_PM_SUPPORT_VDDSDIO_PD=y -CONFIG_SOC_PM_SUPPORT_TOP_PD=y -CONFIG_SOC_PM_SUPPORT_CNNT_PD=y -CONFIG_SOC_PM_SUPPORT_RTC_PERIPH_PD=y -CONFIG_SOC_PM_SUPPORT_DEEPSLEEP_CHECK_STUB_ONLY=y -CONFIG_SOC_PM_CPU_RETENTION_BY_SW=y -CONFIG_SOC_PM_CACHE_RETENTION_BY_PAU=y -CONFIG_SOC_PM_PAU_LINK_NUM=4 -CONFIG_SOC_PM_PAU_REGDMA_LINK_MULTI_ADDR=y -CONFIG_SOC_PAU_IN_TOP_DOMAIN=y -CONFIG_SOC_CPU_IN_TOP_DOMAIN=y -CONFIG_SOC_PM_PAU_REGDMA_UPDATE_CACHE_BEFORE_WAIT_COMPARE=y -CONFIG_SOC_SLEEP_SYSTIMER_STALL_WORKAROUND=y -CONFIG_SOC_SLEEP_TGWDT_STOP_WORKAROUND=y -CONFIG_SOC_PM_RETENTION_MODULE_NUM=64 -CONFIG_SOC_PSRAM_VDD_POWER_MPLL=y -CONFIG_SOC_CLK_RC_FAST_SUPPORT_CALIBRATION=y -CONFIG_SOC_CLK_APLL_SUPPORTED=y -CONFIG_SOC_CLK_MPLL_SUPPORTED=y -CONFIG_SOC_CLK_SDIO_PLL_SUPPORTED=y -CONFIG_SOC_CLK_XTAL32K_SUPPORTED=y -CONFIG_SOC_CLK_RC32K_SUPPORTED=y -CONFIG_SOC_CLK_LP_FAST_SUPPORT_LP_PLL=y -CONFIG_SOC_CLK_LP_FAST_SUPPORT_XTAL=y -CONFIG_SOC_PERIPH_CLK_CTRL_SHARED=y -CONFIG_SOC_CLK_ANA_I2C_MST_HAS_ROOT_GATE=y -CONFIG_SOC_TEMPERATURE_SENSOR_LP_PLL_SUPPORT=y -CONFIG_SOC_TEMPERATURE_SENSOR_INTR_SUPPORT=y -CONFIG_SOC_TSENS_IS_INDEPENDENT_FROM_ADC=y -CONFIG_SOC_TEMPERATURE_SENSOR_SUPPORT_ETM=y -CONFIG_SOC_TEMPERATURE_SENSOR_SUPPORT_SLEEP_RETENTION=y -CONFIG_SOC_MEM_TCM_SUPPORTED=y -CONFIG_SOC_MEM_NON_CONTIGUOUS_SRAM=y -CONFIG_SOC_ASYNCHRONOUS_BUS_ERROR_MODE=y -CONFIG_SOC_EMAC_IEEE1588V2_SUPPORTED=y -CONFIG_SOC_EMAC_USE_MULTI_IO_MUX=y -CONFIG_SOC_EMAC_MII_USE_GPIO_MATRIX=y -CONFIG_SOC_JPEG_CODEC_SUPPORTED=y -CONFIG_SOC_JPEG_DECODE_SUPPORTED=y -CONFIG_SOC_JPEG_ENCODE_SUPPORTED=y -CONFIG_SOC_LCDCAM_CAM_SUPPORT_RGB_YUV_CONV=y -CONFIG_SOC_LCDCAM_CAM_PERIPH_NUM=1 -CONFIG_SOC_LCDCAM_CAM_DATA_WIDTH_MAX=16 -CONFIG_SOC_I3C_MASTER_PERIPH_NUM=y -CONFIG_SOC_I3C_MASTER_ADDRESS_TABLE_NUM=12 -CONFIG_SOC_I3C_MASTER_COMMAND_TABLE_NUM=12 -CONFIG_SOC_LP_CORE_SUPPORT_ETM=y -CONFIG_SOC_LP_CORE_SUPPORT_LP_ADC=y -CONFIG_SOC_LP_CORE_SUPPORT_LP_VAD=y -CONFIG_SOC_LP_CORE_SUPPORT_STORE_LOAD_EXCEPTIONS=y -CONFIG_IDF_CMAKE=y -CONFIG_IDF_TOOLCHAIN="gcc" -CONFIG_IDF_TOOLCHAIN_GCC=y -CONFIG_IDF_TARGET_ARCH_RISCV=y -CONFIG_IDF_TARGET_ARCH="riscv" -CONFIG_IDF_TARGET="esp32p4" -CONFIG_IDF_INIT_VERSION="5.5.1" -CONFIG_IDF_TARGET_ESP32P4=y -CONFIG_IDF_FIRMWARE_CHIP_ID=0x0012 - -# -# Build type -# -CONFIG_APP_BUILD_TYPE_APP_2NDBOOT=y -# CONFIG_APP_BUILD_TYPE_RAM is not set -CONFIG_APP_BUILD_GENERATE_BINARIES=y -CONFIG_APP_BUILD_BOOTLOADER=y -CONFIG_APP_BUILD_USE_FLASH_SECTIONS=y -# CONFIG_APP_REPRODUCIBLE_BUILD is not set -# CONFIG_APP_NO_BLOBS is not set -# end of Build type - -# -# Bootloader config -# - -# -# Bootloader manager -# -CONFIG_BOOTLOADER_COMPILE_TIME_DATE=y -CONFIG_BOOTLOADER_PROJECT_VER=1 -# end of Bootloader manager - -# -# Application Rollback -# -# CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE is not set -# end of Application Rollback - -# -# Recovery Bootloader and Rollback -# -# end of Recovery Bootloader and Rollback - -CONFIG_BOOTLOADER_OFFSET_IN_FLASH=0x2000 -CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y -# CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_DEBUG is not set -# CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_PERF is not set - -# -# Log -# -CONFIG_BOOTLOADER_LOG_VERSION_1=y -CONFIG_BOOTLOADER_LOG_VERSION=1 -# CONFIG_BOOTLOADER_LOG_LEVEL_NONE is not set -# CONFIG_BOOTLOADER_LOG_LEVEL_ERROR is not set -# CONFIG_BOOTLOADER_LOG_LEVEL_WARN is not set -CONFIG_BOOTLOADER_LOG_LEVEL_INFO=y -# CONFIG_BOOTLOADER_LOG_LEVEL_DEBUG is not set -# CONFIG_BOOTLOADER_LOG_LEVEL_VERBOSE is not set -CONFIG_BOOTLOADER_LOG_LEVEL=3 - -# -# Format -# -# CONFIG_BOOTLOADER_LOG_COLORS is not set -CONFIG_BOOTLOADER_LOG_TIMESTAMP_SOURCE_CPU_TICKS=y -# end of Format - -# -# Settings -# -CONFIG_BOOTLOADER_LOG_MODE_TEXT_EN=y -CONFIG_BOOTLOADER_LOG_MODE_TEXT=y -# end of Settings -# end of Log - -# -# Serial Flash Configurations -# -# CONFIG_BOOTLOADER_FLASH_DC_AWARE is not set -CONFIG_BOOTLOADER_FLASH_XMC_SUPPORT=y -CONFIG_BOOTLOADER_FLASH_32BIT_ADDR=y -CONFIG_BOOTLOADER_FLASH_NEEDS_32BIT_FEAT=y -CONFIG_BOOTLOADER_FLASH_NEEDS_32BIT_ADDR_QUAD_FLASH=y -# end of Serial Flash Configurations - -# CONFIG_BOOTLOADER_FACTORY_RESET is not set -# CONFIG_BOOTLOADER_APP_TEST is not set -CONFIG_BOOTLOADER_REGION_PROTECTION_ENABLE=y -CONFIG_BOOTLOADER_WDT_ENABLE=y -# CONFIG_BOOTLOADER_WDT_DISABLE_IN_USER_CODE is not set -CONFIG_BOOTLOADER_WDT_TIME_MS=9000 -# CONFIG_BOOTLOADER_SKIP_VALIDATE_IN_DEEP_SLEEP is not set -# CONFIG_BOOTLOADER_SKIP_VALIDATE_ON_POWER_ON is not set -# CONFIG_BOOTLOADER_SKIP_VALIDATE_ALWAYS is not set -CONFIG_BOOTLOADER_RESERVE_RTC_SIZE=0 -# CONFIG_BOOTLOADER_CUSTOM_RESERVE_RTC is not set -# end of Bootloader config - -# -# Security features -# -CONFIG_SECURE_BOOT_V2_RSA_SUPPORTED=y -CONFIG_SECURE_BOOT_V2_ECC_SUPPORTED=y -CONFIG_SECURE_BOOT_V2_PREFERRED=y -# CONFIG_SECURE_SIGNED_APPS_NO_SECURE_BOOT is not set -# CONFIG_SECURE_BOOT is not set -# CONFIG_SECURE_FLASH_ENC_ENABLED is not set -CONFIG_SECURE_ROM_DL_MODE_ENABLED=y -# end of Security features - -# -# Application manager -# -CONFIG_APP_COMPILE_TIME_DATE=y -# CONFIG_APP_EXCLUDE_PROJECT_VER_VAR is not set -# CONFIG_APP_EXCLUDE_PROJECT_NAME_VAR is not set -# CONFIG_APP_PROJECT_VER_FROM_CONFIG is not set -CONFIG_APP_RETRIEVE_LEN_ELF_SHA=9 -# end of Application manager - -CONFIG_ESP_ROM_HAS_CRC_LE=y -CONFIG_ESP_ROM_HAS_CRC_BE=y -CONFIG_ESP_ROM_UART_CLK_IS_XTAL=y -CONFIG_ESP_ROM_USB_SERIAL_DEVICE_NUM=6 -CONFIG_ESP_ROM_USB_OTG_NUM=5 -CONFIG_ESP_ROM_HAS_RETARGETABLE_LOCKING=y -CONFIG_ESP_ROM_GET_CLK_FREQ=y -CONFIG_ESP_ROM_HAS_RVFPLIB=y -CONFIG_ESP_ROM_HAS_HAL_WDT=y -CONFIG_ESP_ROM_HAS_HAL_SYSTIMER=y -CONFIG_ESP_ROM_SYSTIMER_INIT_PATCH=y -CONFIG_ESP_ROM_HAS_LAYOUT_TABLE=y -CONFIG_ESP_ROM_WDT_INIT_PATCH=y -CONFIG_ESP_ROM_HAS_LP_ROM=y -CONFIG_ESP_ROM_WITHOUT_REGI2C=y -CONFIG_ESP_ROM_HAS_NEWLIB=y -CONFIG_ESP_ROM_HAS_NEWLIB_NANO_FORMAT=y -CONFIG_ESP_ROM_HAS_NEWLIB_NANO_PRINTF_FLOAT_BUG=y -CONFIG_ESP_ROM_HAS_VERSION=y -CONFIG_ESP_ROM_CLIC_INT_TYPE_PATCH=y -CONFIG_ESP_ROM_HAS_OUTPUT_PUTC_FUNC=y -CONFIG_ESP_ROM_HAS_SUBOPTIMAL_NEWLIB_ON_MISALIGNED_MEMORY=y - -# -# Boot ROM Behavior -# -CONFIG_BOOT_ROM_LOG_ALWAYS_ON=y -# CONFIG_BOOT_ROM_LOG_ALWAYS_OFF is not set -# CONFIG_BOOT_ROM_LOG_ON_GPIO_HIGH is not set -# CONFIG_BOOT_ROM_LOG_ON_GPIO_LOW is not set -# end of Boot ROM Behavior - -# -# Serial flasher config -# -# CONFIG_ESPTOOLPY_NO_STUB is not set -# CONFIG_ESPTOOLPY_FLASHMODE_QIO is not set -# CONFIG_ESPTOOLPY_FLASHMODE_QOUT is not set -CONFIG_ESPTOOLPY_FLASHMODE_DIO=y -# CONFIG_ESPTOOLPY_FLASHMODE_DOUT is not set -CONFIG_ESPTOOLPY_FLASH_SAMPLE_MODE_STR=y -CONFIG_ESPTOOLPY_FLASHMODE="dio" -CONFIG_ESPTOOLPY_FLASHFREQ_80M=y -# CONFIG_ESPTOOLPY_FLASHFREQ_40M is not set -# CONFIG_ESPTOOLPY_FLASHFREQ_20M is not set -CONFIG_ESPTOOLPY_FLASHFREQ_VAL=80 -CONFIG_ESPTOOLPY_FLASHFREQ="80m" -# CONFIG_ESPTOOLPY_FLASHSIZE_1MB is not set -# CONFIG_ESPTOOLPY_FLASHSIZE_2MB is not set -# CONFIG_ESPTOOLPY_FLASHSIZE_4MB is not set -# CONFIG_ESPTOOLPY_FLASHSIZE_8MB is not set -# CONFIG_ESPTOOLPY_FLASHSIZE_16MB is not set -CONFIG_ESPTOOLPY_FLASHSIZE_32MB=y -# CONFIG_ESPTOOLPY_FLASHSIZE_64MB is not set -# CONFIG_ESPTOOLPY_FLASHSIZE_128MB is not set -CONFIG_ESPTOOLPY_FLASHSIZE="32MB" -# CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE is not set -CONFIG_ESPTOOLPY_BEFORE_RESET=y -# CONFIG_ESPTOOLPY_BEFORE_NORESET is not set -CONFIG_ESPTOOLPY_BEFORE="default_reset" -CONFIG_ESPTOOLPY_AFTER_RESET=y -# CONFIG_ESPTOOLPY_AFTER_NORESET is not set -CONFIG_ESPTOOLPY_AFTER="hard_reset" -CONFIG_ESPTOOLPY_MONITOR_BAUD=115200 -# end of Serial flasher config - -# -# Partition Table -# -# CONFIG_PARTITION_TABLE_SINGLE_APP is not set -# CONFIG_PARTITION_TABLE_SINGLE_APP_LARGE is not set -# CONFIG_PARTITION_TABLE_TWO_OTA is not set -# CONFIG_PARTITION_TABLE_TWO_OTA_LARGE is not set -CONFIG_PARTITION_TABLE_CUSTOM=y -CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv" -CONFIG_PARTITION_TABLE_FILENAME="partitions.csv" -CONFIG_PARTITION_TABLE_OFFSET=0x8000 -CONFIG_PARTITION_TABLE_MD5=y -# end of Partition Table - -# -# Compiler options -# -CONFIG_COMPILER_OPTIMIZATION_DEBUG=y -# CONFIG_COMPILER_OPTIMIZATION_SIZE is not set -# CONFIG_COMPILER_OPTIMIZATION_PERF is not set -# CONFIG_COMPILER_OPTIMIZATION_NONE is not set -CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_ENABLE=y -# CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT is not set -# CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE is not set -CONFIG_COMPILER_ASSERT_NDEBUG_EVALUATE=y -# CONFIG_COMPILER_FLOAT_LIB_FROM_GCCLIB is not set -CONFIG_COMPILER_FLOAT_LIB_FROM_RVFPLIB=y -CONFIG_COMPILER_OPTIMIZATION_ASSERTION_LEVEL=2 -# CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT is not set -CONFIG_COMPILER_HIDE_PATHS_MACROS=y -# CONFIG_COMPILER_CXX_EXCEPTIONS is not set -# CONFIG_COMPILER_CXX_RTTI is not set -CONFIG_COMPILER_STACK_CHECK_MODE_NONE=y -# CONFIG_COMPILER_STACK_CHECK_MODE_NORM is not set -# CONFIG_COMPILER_STACK_CHECK_MODE_STRONG is not set -# CONFIG_COMPILER_STACK_CHECK_MODE_ALL is not set -# CONFIG_COMPILER_NO_MERGE_CONSTANTS is not set -# CONFIG_COMPILER_WARN_WRITE_STRINGS is not set -# CONFIG_COMPILER_SAVE_RESTORE_LIBCALLS is not set -CONFIG_COMPILER_DISABLE_DEFAULT_ERRORS=y -# CONFIG_COMPILER_DISABLE_GCC12_WARNINGS is not set -# CONFIG_COMPILER_DISABLE_GCC13_WARNINGS is not set -# CONFIG_COMPILER_DISABLE_GCC14_WARNINGS is not set -# CONFIG_COMPILER_DUMP_RTL_FILES is not set -CONFIG_COMPILER_RT_LIB_GCCLIB=y -CONFIG_COMPILER_RT_LIB_NAME="gcc" -CONFIG_COMPILER_ORPHAN_SECTIONS_WARNING=y -# CONFIG_COMPILER_ORPHAN_SECTIONS_PLACE is not set -# CONFIG_COMPILER_STATIC_ANALYZER is not set -# end of Compiler options - -# -# Component config -# - -# -# Application Level Tracing -# -# CONFIG_APPTRACE_DEST_JTAG is not set -CONFIG_APPTRACE_DEST_NONE=y -# CONFIG_APPTRACE_DEST_UART1 is not set -# CONFIG_APPTRACE_DEST_UART2 is not set -CONFIG_APPTRACE_DEST_UART_NONE=y -CONFIG_APPTRACE_UART_TASK_PRIO=1 -CONFIG_APPTRACE_LOCK_ENABLE=y -# end of Application Level Tracing - -# -# Bluetooth -# -# CONFIG_BT_ENABLED is not set - -# -# Common Options -# -# CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED is not set -# CONFIG_BT_BLE_LOG_UHCI_OUT_ENABLED is not set -# end of Common Options -# end of Bluetooth - -# -# Console Library -# -# CONFIG_CONSOLE_SORTED_HELP is not set -# end of Console Library - -# -# Driver Configurations -# - -# -# Legacy TWAI Driver Configurations -# -# CONFIG_TWAI_SKIP_LEGACY_CONFLICT_CHECK is not set -# end of Legacy TWAI Driver Configurations - -# -# Legacy ADC Driver Configuration -# -# CONFIG_ADC_SUPPRESS_DEPRECATE_WARN is not set -# CONFIG_ADC_SKIP_LEGACY_CONFLICT_CHECK is not set - -# -# Legacy ADC Calibration Configuration -# -# CONFIG_ADC_CALI_SUPPRESS_DEPRECATE_WARN is not set -# end of Legacy ADC Calibration Configuration -# end of Legacy ADC Driver Configuration - -# -# Legacy MCPWM Driver Configurations -# -# CONFIG_MCPWM_SUPPRESS_DEPRECATE_WARN is not set -# CONFIG_MCPWM_SKIP_LEGACY_CONFLICT_CHECK is not set -# end of Legacy MCPWM Driver Configurations - -# -# Legacy Timer Group Driver Configurations -# -# CONFIG_GPTIMER_SUPPRESS_DEPRECATE_WARN is not set -# CONFIG_GPTIMER_SKIP_LEGACY_CONFLICT_CHECK is not set -# end of Legacy Timer Group Driver Configurations - -# -# Legacy RMT Driver Configurations -# -# CONFIG_RMT_SUPPRESS_DEPRECATE_WARN is not set -# CONFIG_RMT_SKIP_LEGACY_CONFLICT_CHECK is not set -# end of Legacy RMT Driver Configurations - -# -# Legacy I2S Driver Configurations -# -# CONFIG_I2S_SUPPRESS_DEPRECATE_WARN is not set -# CONFIG_I2S_SKIP_LEGACY_CONFLICT_CHECK is not set -# end of Legacy I2S Driver Configurations - -# -# Legacy I2C Driver Configurations -# -# CONFIG_I2C_SKIP_LEGACY_CONFLICT_CHECK is not set -# end of Legacy I2C Driver Configurations - -# -# Legacy PCNT Driver Configurations -# -# CONFIG_PCNT_SUPPRESS_DEPRECATE_WARN is not set -# CONFIG_PCNT_SKIP_LEGACY_CONFLICT_CHECK is not set -# end of Legacy PCNT Driver Configurations - -# -# Legacy SDM Driver Configurations -# -# CONFIG_SDM_SUPPRESS_DEPRECATE_WARN is not set -# CONFIG_SDM_SKIP_LEGACY_CONFLICT_CHECK is not set -# end of Legacy SDM Driver Configurations - -# -# Legacy Temperature Sensor Driver Configurations -# -# CONFIG_TEMP_SENSOR_SUPPRESS_DEPRECATE_WARN is not set -# CONFIG_TEMP_SENSOR_SKIP_LEGACY_CONFLICT_CHECK is not set -# end of Legacy Temperature Sensor Driver Configurations - -# -# Legacy Touch Sensor Driver Configurations -# -# CONFIG_TOUCH_SUPPRESS_DEPRECATE_WARN is not set -# CONFIG_TOUCH_SKIP_LEGACY_CONFLICT_CHECK is not set -# end of Legacy Touch Sensor Driver Configurations -# end of Driver Configurations - -# -# eFuse Bit Manager -# -# CONFIG_EFUSE_CUSTOM_TABLE is not set -# CONFIG_EFUSE_VIRTUAL is not set -CONFIG_EFUSE_MAX_BLK_LEN=256 -# end of eFuse Bit Manager - -# -# ESP-TLS -# -CONFIG_ESP_TLS_USING_MBEDTLS=y -# CONFIG_ESP_TLS_USE_SECURE_ELEMENT is not set -CONFIG_ESP_TLS_USE_DS_PERIPHERAL=y -# CONFIG_ESP_TLS_CLIENT_SESSION_TICKETS is not set -# CONFIG_ESP_TLS_SERVER_SESSION_TICKETS is not set -# CONFIG_ESP_TLS_SERVER_CERT_SELECT_HOOK is not set -# CONFIG_ESP_TLS_SERVER_MIN_AUTH_MODE_OPTIONAL is not set -# CONFIG_ESP_TLS_PSK_VERIFICATION is not set -# CONFIG_ESP_TLS_INSECURE is not set -CONFIG_ESP_TLS_DYN_BUF_STRATEGY_SUPPORTED=y -# end of ESP-TLS - -# -# ADC and ADC Calibration -# -# CONFIG_ADC_ONESHOT_CTRL_FUNC_IN_IRAM is not set -# CONFIG_ADC_CONTINUOUS_ISR_IRAM_SAFE is not set -# CONFIG_ADC_ENABLE_DEBUG_LOG is not set -# end of ADC and ADC Calibration - -# -# Wireless Coexistence -# -# CONFIG_ESP_COEX_GPIO_DEBUG is not set -# end of Wireless Coexistence - -# -# Common ESP-related -# -CONFIG_ESP_ERR_TO_NAME_LOOKUP=y -# end of Common ESP-related - -# -# ESP-Driver:Analog Comparator Configurations -# -CONFIG_ANA_CMPR_ISR_HANDLER_IN_IRAM=y -# CONFIG_ANA_CMPR_CTRL_FUNC_IN_IRAM is not set -# CONFIG_ANA_CMPR_ISR_CACHE_SAFE is not set -CONFIG_ANA_CMPR_OBJ_CACHE_SAFE=y -# CONFIG_ANA_CMPR_ENABLE_DEBUG_LOG is not set -# end of ESP-Driver:Analog Comparator Configurations - -# -# BitScrambler Configurations -# -# CONFIG_BITSCRAMBLER_CTRL_FUNC_IN_IRAM is not set -# end of BitScrambler Configurations - -# -# ESP-Driver:Camera Controller Configurations -# -# CONFIG_CAM_CTLR_MIPI_CSI_ISR_CACHE_SAFE is not set -# CONFIG_CAM_CTLR_ISP_DVP_ISR_CACHE_SAFE is not set -# CONFIG_CAM_CTLR_DVP_CAM_ISR_CACHE_SAFE is not set -# end of ESP-Driver:Camera Controller Configurations - -# -# ESP-Driver:GPIO Configurations -# -# CONFIG_GPIO_CTRL_FUNC_IN_IRAM is not set -# end of ESP-Driver:GPIO Configurations - -# -# ESP-Driver:GPTimer Configurations -# -CONFIG_GPTIMER_ISR_HANDLER_IN_IRAM=y -# CONFIG_GPTIMER_CTRL_FUNC_IN_IRAM is not set -# CONFIG_GPTIMER_ISR_CACHE_SAFE is not set -CONFIG_GPTIMER_OBJ_CACHE_SAFE=y -# CONFIG_GPTIMER_ENABLE_DEBUG_LOG is not set -# end of ESP-Driver:GPTimer Configurations - -# -# ESP-Driver:I2C Configurations -# -# CONFIG_I2C_ISR_IRAM_SAFE is not set -# CONFIG_I2C_ENABLE_DEBUG_LOG is not set -# CONFIG_I2C_ENABLE_SLAVE_DRIVER_VERSION_2 is not set -CONFIG_I2C_MASTER_ISR_HANDLER_IN_IRAM=y -# end of ESP-Driver:I2C Configurations - -# -# ESP-Driver:I2S Configurations -# -# CONFIG_I2S_ISR_IRAM_SAFE is not set -# CONFIG_I2S_ENABLE_DEBUG_LOG is not set -# end of ESP-Driver:I2S Configurations - -# -# ESP-Driver:ISP Configurations -# -# CONFIG_ISP_ISR_IRAM_SAFE is not set -# CONFIG_ISP_CTRL_FUNC_IN_IRAM is not set -# end of ESP-Driver:ISP Configurations - -# -# ESP-Driver:JPEG-Codec Configurations -# -# CONFIG_JPEG_ENABLE_DEBUG_LOG is not set -# end of ESP-Driver:JPEG-Codec Configurations - -# -# ESP-Driver:LEDC Configurations -# -# CONFIG_LEDC_CTRL_FUNC_IN_IRAM is not set -# end of ESP-Driver:LEDC Configurations - -# -# ESP-Driver:MCPWM Configurations -# -CONFIG_MCPWM_ISR_HANDLER_IN_IRAM=y -# CONFIG_MCPWM_ISR_CACHE_SAFE is not set -# CONFIG_MCPWM_CTRL_FUNC_IN_IRAM is not set -CONFIG_MCPWM_OBJ_CACHE_SAFE=y -# CONFIG_MCPWM_ENABLE_DEBUG_LOG is not set -# end of ESP-Driver:MCPWM Configurations - -# -# ESP-Driver:Parallel IO Configurations -# -CONFIG_PARLIO_TX_ISR_HANDLER_IN_IRAM=y -CONFIG_PARLIO_RX_ISR_HANDLER_IN_IRAM=y -# CONFIG_PARLIO_TX_ISR_CACHE_SAFE is not set -# CONFIG_PARLIO_RX_ISR_CACHE_SAFE is not set -CONFIG_PARLIO_OBJ_CACHE_SAFE=y -# CONFIG_PARLIO_ENABLE_DEBUG_LOG is not set -# CONFIG_PARLIO_ISR_IRAM_SAFE is not set -# end of ESP-Driver:Parallel IO Configurations - -# -# ESP-Driver:PCNT Configurations -# -# CONFIG_PCNT_CTRL_FUNC_IN_IRAM is not set -# CONFIG_PCNT_ISR_IRAM_SAFE is not set -# CONFIG_PCNT_ENABLE_DEBUG_LOG is not set -# end of ESP-Driver:PCNT Configurations - -# -# ESP-Driver:RMT Configurations -# -CONFIG_RMT_ENCODER_FUNC_IN_IRAM=y -CONFIG_RMT_TX_ISR_HANDLER_IN_IRAM=y -CONFIG_RMT_RX_ISR_HANDLER_IN_IRAM=y -# CONFIG_RMT_RECV_FUNC_IN_IRAM is not set -# CONFIG_RMT_TX_ISR_CACHE_SAFE is not set -# CONFIG_RMT_RX_ISR_CACHE_SAFE is not set -CONFIG_RMT_OBJ_CACHE_SAFE=y -# CONFIG_RMT_ENABLE_DEBUG_LOG is not set -# CONFIG_RMT_ISR_IRAM_SAFE is not set -# end of ESP-Driver:RMT Configurations - -# -# ESP-Driver:Sigma Delta Modulator Configurations -# -# CONFIG_SDM_CTRL_FUNC_IN_IRAM is not set -# CONFIG_SDM_ENABLE_DEBUG_LOG is not set -# end of ESP-Driver:Sigma Delta Modulator Configurations - -# -# ESP-Driver:SPI Configurations -# -# CONFIG_SPI_MASTER_IN_IRAM is not set -CONFIG_SPI_MASTER_ISR_IN_IRAM=y -# CONFIG_SPI_SLAVE_IN_IRAM is not set -CONFIG_SPI_SLAVE_ISR_IN_IRAM=y -# end of ESP-Driver:SPI Configurations - -# -# ESP-Driver:Touch Sensor Configurations -# -# CONFIG_TOUCH_CTRL_FUNC_IN_IRAM is not set -# CONFIG_TOUCH_ISR_IRAM_SAFE is not set -# CONFIG_TOUCH_ENABLE_DEBUG_LOG is not set -# CONFIG_TOUCH_SKIP_FSM_CHECK is not set -# end of ESP-Driver:Touch Sensor Configurations - -# -# ESP-Driver:Temperature Sensor Configurations -# -# CONFIG_TEMP_SENSOR_ENABLE_DEBUG_LOG is not set -# CONFIG_TEMP_SENSOR_ISR_IRAM_SAFE is not set -# end of ESP-Driver:Temperature Sensor Configurations - -# -# ESP-Driver:TWAI Configurations -# -# CONFIG_TWAI_ISR_IN_IRAM is not set -# CONFIG_TWAI_ISR_CACHE_SAFE is not set -# CONFIG_TWAI_ENABLE_DEBUG_LOG is not set -# end of ESP-Driver:TWAI Configurations - -# -# ESP-Driver:UART Configurations -# -# CONFIG_UART_ISR_IN_IRAM is not set -# end of ESP-Driver:UART Configurations - -# -# ESP-Driver:UHCI Configurations -# -# CONFIG_UHCI_ISR_HANDLER_IN_IRAM is not set -# CONFIG_UHCI_ISR_CACHE_SAFE is not set -# CONFIG_UHCI_ENABLE_DEBUG_LOG is not set -# end of ESP-Driver:UHCI Configurations - -# -# ESP-Driver:USB Serial/JTAG Configuration -# -CONFIG_USJ_ENABLE_USB_SERIAL_JTAG=y -# end of ESP-Driver:USB Serial/JTAG Configuration - -# -# Ethernet -# -CONFIG_ETH_ENABLED=y -CONFIG_ETH_USE_ESP32_EMAC=y -CONFIG_ETH_PHY_INTERFACE_RMII=y -CONFIG_ETH_DMA_BUFFER_SIZE=512 -CONFIG_ETH_DMA_RX_BUFFER_NUM=20 -CONFIG_ETH_DMA_TX_BUFFER_NUM=10 -# CONFIG_ETH_SOFT_FLOW_CONTROL is not set -# CONFIG_ETH_IRAM_OPTIMIZATION is not set -CONFIG_ETH_USE_SPI_ETHERNET=y -# CONFIG_ETH_SPI_ETHERNET_DM9051 is not set -# CONFIG_ETH_SPI_ETHERNET_W5500 is not set -# CONFIG_ETH_SPI_ETHERNET_KSZ8851SNL is not set -# CONFIG_ETH_USE_OPENETH is not set -# CONFIG_ETH_TRANSMIT_MUTEX is not set -# end of Ethernet - -# -# Event Loop Library -# -# CONFIG_ESP_EVENT_LOOP_PROFILING is not set -CONFIG_ESP_EVENT_POST_FROM_ISR=y -CONFIG_ESP_EVENT_POST_FROM_IRAM_ISR=y -# end of Event Loop Library - -# -# GDB Stub -# -CONFIG_ESP_GDBSTUB_ENABLED=y -# CONFIG_ESP_SYSTEM_GDBSTUB_RUNTIME is not set -CONFIG_ESP_GDBSTUB_SUPPORT_TASKS=y -CONFIG_ESP_GDBSTUB_MAX_TASKS=32 -# end of GDB Stub - -# -# ESP HID -# -CONFIG_ESPHID_TASK_SIZE_BT=2048 -CONFIG_ESPHID_TASK_SIZE_BLE=4096 -# end of ESP HID - -# -# ESP HTTP client -# -CONFIG_ESP_HTTP_CLIENT_ENABLE_HTTPS=y -# CONFIG_ESP_HTTP_CLIENT_ENABLE_BASIC_AUTH is not set -# CONFIG_ESP_HTTP_CLIENT_ENABLE_DIGEST_AUTH is not set -# CONFIG_ESP_HTTP_CLIENT_ENABLE_CUSTOM_TRANSPORT is not set -CONFIG_ESP_HTTP_CLIENT_EVENT_POST_TIMEOUT=2000 -# end of ESP HTTP client - -# -# HTTP Server -# -CONFIG_HTTPD_MAX_REQ_HDR_LEN=1024 -CONFIG_HTTPD_MAX_URI_LEN=512 -CONFIG_HTTPD_ERR_RESP_NO_DELAY=y -CONFIG_HTTPD_PURGE_BUF_LEN=32 -# CONFIG_HTTPD_LOG_PURGE_DATA is not set -# CONFIG_HTTPD_WS_SUPPORT is not set -# CONFIG_HTTPD_QUEUE_WORK_BLOCKING is not set -CONFIG_HTTPD_SERVER_EVENT_POST_TIMEOUT=2000 -# end of HTTP Server - -# -# ESP HTTPS OTA -# -# CONFIG_ESP_HTTPS_OTA_DECRYPT_CB is not set -# CONFIG_ESP_HTTPS_OTA_ALLOW_HTTP is not set -CONFIG_ESP_HTTPS_OTA_EVENT_POST_TIMEOUT=2000 -# end of ESP HTTPS OTA - -# -# ESP HTTPS server -# -# CONFIG_ESP_HTTPS_SERVER_ENABLE is not set -CONFIG_ESP_HTTPS_SERVER_EVENT_POST_TIMEOUT=2000 -# CONFIG_ESP_HTTPS_SERVER_CERT_SELECT_HOOK is not set -# end of ESP HTTPS server - -# -# Hardware Settings -# - -# -# Chip revision -# -# CONFIG_ESP32P4_REV_MIN_0 is not set -CONFIG_ESP32P4_REV_MIN_1=y -# CONFIG_ESP32P4_REV_MIN_100 is not set -CONFIG_ESP32P4_REV_MIN_FULL=1 -CONFIG_ESP_REV_MIN_FULL=1 - -# -# Maximum Supported ESP32-P4 Revision (Rev v1.99) -# -CONFIG_ESP32P4_REV_MAX_FULL=199 -CONFIG_ESP_REV_MAX_FULL=199 -CONFIG_ESP_EFUSE_BLOCK_REV_MIN_FULL=0 -CONFIG_ESP_EFUSE_BLOCK_REV_MAX_FULL=99 - -# -# Maximum Supported ESP32-P4 eFuse Block Revision (eFuse Block Rev v0.99) -# -# end of Chip revision - -# -# MAC Config -# -CONFIG_ESP_MAC_ADDR_UNIVERSE_ETH=y -CONFIG_ESP_MAC_UNIVERSAL_MAC_ADDRESSES_ONE=y -CONFIG_ESP_MAC_UNIVERSAL_MAC_ADDRESSES=1 -CONFIG_ESP32P4_UNIVERSAL_MAC_ADDRESSES_ONE=y -CONFIG_ESP32P4_UNIVERSAL_MAC_ADDRESSES=1 -# CONFIG_ESP_MAC_USE_CUSTOM_MAC_AS_BASE_MAC is not set -# end of MAC Config - -# -# Sleep Config -# -CONFIG_ESP_SLEEP_FLASH_LEAKAGE_WORKAROUND=y -# CONFIG_ESP_SLEEP_MSPI_NEED_ALL_IO_PU is not set -# CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND is not set -CONFIG_ESP_SLEEP_WAIT_FLASH_READY_EXTRA_DELAY=0 -# CONFIG_ESP_SLEEP_CACHE_SAFE_ASSERTION is not set -# CONFIG_ESP_SLEEP_DEBUG is not set -CONFIG_ESP_SLEEP_GPIO_ENABLE_INTERNAL_RESISTORS=y -# end of Sleep Config - -# -# RTC Clock Config -# -CONFIG_RTC_CLK_SRC_INT_RC=y -# CONFIG_RTC_CLK_SRC_EXT_CRYS is not set -CONFIG_RTC_CLK_CAL_CYCLES=1024 -CONFIG_RTC_FAST_CLK_SRC_RC_FAST=y -# CONFIG_RTC_FAST_CLK_SRC_XTAL is not set -# end of RTC Clock Config - -# -# Peripheral Control -# -CONFIG_ESP_PERIPH_CTRL_FUNC_IN_IRAM=y -CONFIG_ESP_REGI2C_CTRL_FUNC_IN_IRAM=y -# end of Peripheral Control - -# -# ETM Configuration -# -# CONFIG_ETM_ENABLE_DEBUG_LOG is not set -# end of ETM Configuration - -# -# GDMA Configurations -# -CONFIG_GDMA_CTRL_FUNC_IN_IRAM=y -CONFIG_GDMA_ISR_HANDLER_IN_IRAM=y -CONFIG_GDMA_OBJ_DRAM_SAFE=y -# CONFIG_GDMA_ENABLE_DEBUG_LOG is not set -# CONFIG_GDMA_ISR_IRAM_SAFE is not set -# end of GDMA Configurations - -# -# DW_GDMA Configurations -# -# CONFIG_DW_GDMA_ENABLE_DEBUG_LOG is not set -# end of DW_GDMA Configurations - -# -# 2D-DMA Configurations -# -# CONFIG_DMA2D_OPERATION_FUNC_IN_IRAM is not set -# CONFIG_DMA2D_ISR_IRAM_SAFE is not set -# end of 2D-DMA Configurations - -# -# Main XTAL Config -# -CONFIG_XTAL_FREQ_40=y -CONFIG_XTAL_FREQ=40 -# end of Main XTAL Config - -# -# DCDC Regulator Configurations -# -CONFIG_ESP_SLEEP_KEEP_DCDC_ALWAYS_ON=y -CONFIG_ESP_SLEEP_DCM_VSET_VAL_IN_SLEEP=14 -# end of DCDC Regulator Configurations - -# -# LDO Regulator Configurations -# -CONFIG_ESP_LDO_RESERVE_SPI_NOR_FLASH=y -CONFIG_ESP_LDO_CHAN_SPI_NOR_FLASH_DOMAIN=1 -CONFIG_ESP_LDO_VOLTAGE_SPI_NOR_FLASH_3300_MV=y -CONFIG_ESP_LDO_VOLTAGE_SPI_NOR_FLASH_DOMAIN=3300 -CONFIG_ESP_LDO_RESERVE_PSRAM=y -CONFIG_ESP_LDO_CHAN_PSRAM_DOMAIN=2 -CONFIG_ESP_LDO_VOLTAGE_PSRAM_1900_MV=y -CONFIG_ESP_LDO_VOLTAGE_PSRAM_DOMAIN=1900 -# end of LDO Regulator Configurations - -# -# Power Supplier -# - -# -# Brownout Detector -# -CONFIG_ESP_BROWNOUT_DET=y -CONFIG_ESP_BROWNOUT_DET_LVL_SEL_7=y -# CONFIG_ESP_BROWNOUT_DET_LVL_SEL_6 is not set -# CONFIG_ESP_BROWNOUT_DET_LVL_SEL_5 is not set -CONFIG_ESP_BROWNOUT_DET_LVL=7 -CONFIG_ESP_BROWNOUT_USE_INTR=y -# end of Brownout Detector - -# -# RTC Backup Battery -# -# CONFIG_ESP_VBAT_INIT_AUTO is not set -# CONFIG_ESP_VBAT_WAKEUP_CHIP_ON_VBAT_BROWNOUT is not set -# end of RTC Backup Battery -# end of Power Supplier - -CONFIG_ESP_SPI_BUS_LOCK_ISR_FUNCS_IN_IRAM=y -CONFIG_ESP_ENABLE_PVT=y -CONFIG_ESP_INTR_IN_IRAM=y -# end of Hardware Settings - -# -# ESP-Driver:LCD Controller Configurations -# -# CONFIG_LCD_ENABLE_DEBUG_LOG is not set -# CONFIG_LCD_RGB_ISR_IRAM_SAFE is not set -# CONFIG_LCD_RGB_RESTART_IN_VSYNC is not set -# CONFIG_LCD_DSI_ISR_IRAM_SAFE is not set -# end of ESP-Driver:LCD Controller Configurations - -# -# ESP-MM: Memory Management Configurations -# -# CONFIG_ESP_MM_CACHE_MSYNC_C2M_CHUNKED_OPS is not set -# end of ESP-MM: Memory Management Configurations - -# -# ESP NETIF Adapter -# -CONFIG_ESP_NETIF_IP_LOST_TIMER_INTERVAL=120 -# CONFIG_ESP_NETIF_PROVIDE_CUSTOM_IMPLEMENTATION is not set -CONFIG_ESP_NETIF_TCPIP_LWIP=y -# CONFIG_ESP_NETIF_LOOPBACK is not set -CONFIG_ESP_NETIF_USES_TCPIP_WITH_BSD_API=y -CONFIG_ESP_NETIF_REPORT_DATA_TRAFFIC=y -# CONFIG_ESP_NETIF_RECEIVE_REPORT_ERRORS is not set -# CONFIG_ESP_NETIF_L2_TAP is not set -# CONFIG_ESP_NETIF_BRIDGE_EN is not set -# CONFIG_ESP_NETIF_SET_DNS_PER_DEFAULT_NETIF is not set -# end of ESP NETIF Adapter - -# -# Partition API Configuration -# -# end of Partition API Configuration - -# -# PHY -# -# end of PHY - -# -# Power Management -# -CONFIG_PM_SLEEP_FUNC_IN_IRAM=y -# CONFIG_PM_ENABLE is not set -CONFIG_PM_SLP_IRAM_OPT=y -# CONFIG_PM_POWER_DOWN_PERIPHERAL_IN_LIGHT_SLEEP is not set -# end of Power Management - -# -# ESP PSRAM -# -# CONFIG_SPIRAM is not set -# end of ESP PSRAM - -# -# ESP Ringbuf -# -# CONFIG_RINGBUF_PLACE_FUNCTIONS_INTO_FLASH is not set -# end of ESP Ringbuf - -# -# ESP-ROM -# -CONFIG_ESP_ROM_PRINT_IN_IRAM=y -# end of ESP-ROM - -# -# ESP Security Specific -# -# end of ESP Security Specific - -# -# ESP System Settings -# -CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_360=y -CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ=360 - -# -# Cache config -# -CONFIG_CACHE_L2_CACHE_128KB=y -# CONFIG_CACHE_L2_CACHE_256KB is not set -# CONFIG_CACHE_L2_CACHE_512KB is not set -CONFIG_CACHE_L2_CACHE_SIZE=0x20000 -CONFIG_CACHE_L2_CACHE_LINE_64B=y -# CONFIG_CACHE_L2_CACHE_LINE_128B is not set -CONFIG_CACHE_L2_CACHE_LINE_SIZE=64 -CONFIG_CACHE_L1_CACHE_LINE_SIZE=64 -# end of Cache config - -CONFIG_ESP_SYSTEM_IN_IRAM=y -# CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT is not set -CONFIG_ESP_SYSTEM_PANIC_PRINT_REBOOT=y -# CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT is not set -# CONFIG_ESP_SYSTEM_PANIC_GDBSTUB is not set -CONFIG_ESP_SYSTEM_PANIC_REBOOT_DELAY_SECONDS=0 -CONFIG_ESP_SYSTEM_RTC_FAST_MEM_AS_HEAP_DEPCHECK=y -CONFIG_ESP_SYSTEM_ALLOW_RTC_FAST_MEM_AS_HEAP=y -CONFIG_ESP_SYSTEM_NO_BACKTRACE=y -# CONFIG_ESP_SYSTEM_USE_EH_FRAME is not set -# CONFIG_ESP_SYSTEM_USE_FRAME_POINTER is not set - -# -# Memory protection -# -CONFIG_ESP_SYSTEM_PMP_IDRAM_SPLIT=y -# CONFIG_ESP_SYSTEM_PMP_LP_CORE_RESERVE_MEM_EXECUTABLE is not set -# end of Memory protection - -CONFIG_ESP_SYSTEM_EVENT_QUEUE_SIZE=32 -CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=2304 -CONFIG_ESP_MAIN_TASK_STACK_SIZE=3584 -CONFIG_ESP_MAIN_TASK_AFFINITY_CPU0=y -# CONFIG_ESP_MAIN_TASK_AFFINITY_CPU1 is not set -# CONFIG_ESP_MAIN_TASK_AFFINITY_NO_AFFINITY is not set -CONFIG_ESP_MAIN_TASK_AFFINITY=0x0 -CONFIG_ESP_MINIMAL_SHARED_STACK_SIZE=2048 -CONFIG_ESP_CONSOLE_UART_DEFAULT=y -# CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG is not set -# CONFIG_ESP_CONSOLE_UART_CUSTOM is not set -# CONFIG_ESP_CONSOLE_NONE is not set -# CONFIG_ESP_CONSOLE_SECONDARY_NONE is not set -CONFIG_ESP_CONSOLE_SECONDARY_USB_SERIAL_JTAG=y -CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG_ENABLED=y -CONFIG_ESP_CONSOLE_UART=y -CONFIG_ESP_CONSOLE_UART_NUM=0 -CONFIG_ESP_CONSOLE_ROM_SERIAL_PORT_NUM=0 -CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200 -CONFIG_ESP_INT_WDT=y -CONFIG_ESP_INT_WDT_TIMEOUT_MS=300 -CONFIG_ESP_INT_WDT_CHECK_CPU1=y -CONFIG_ESP_TASK_WDT_EN=y -CONFIG_ESP_TASK_WDT_INIT=y -# CONFIG_ESP_TASK_WDT_PANIC is not set -CONFIG_ESP_TASK_WDT_TIMEOUT_S=5 -CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0=y -CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU1=y -# CONFIG_ESP_PANIC_HANDLER_IRAM is not set -# CONFIG_ESP_DEBUG_STUBS_ENABLE is not set -CONFIG_ESP_DEBUG_OCDAWARE=y -CONFIG_ESP_SYSTEM_CHECK_INT_LEVEL_4=y -CONFIG_ESP_SYSTEM_HW_STACK_GUARD=y -CONFIG_ESP_SYSTEM_HW_PC_RECORD=y -# end of ESP System Settings - -# -# IPC (Inter-Processor Call) -# -CONFIG_ESP_IPC_ENABLE=y -CONFIG_ESP_IPC_TASK_STACK_SIZE=1024 -CONFIG_ESP_IPC_USES_CALLERS_PRIORITY=y -CONFIG_ESP_IPC_ISR_ENABLE=y -# end of IPC (Inter-Processor Call) - -# -# ESP Timer (High Resolution Timer) -# -CONFIG_ESP_TIMER_IN_IRAM=y -# CONFIG_ESP_TIMER_PROFILING is not set -CONFIG_ESP_TIME_FUNCS_USE_RTC_TIMER=y -CONFIG_ESP_TIME_FUNCS_USE_ESP_TIMER=y -CONFIG_ESP_TIMER_TASK_STACK_SIZE=3584 -CONFIG_ESP_TIMER_INTERRUPT_LEVEL=1 -# CONFIG_ESP_TIMER_SHOW_EXPERIMENTAL is not set -CONFIG_ESP_TIMER_TASK_AFFINITY=0x0 -CONFIG_ESP_TIMER_TASK_AFFINITY_CPU0=y -CONFIG_ESP_TIMER_ISR_AFFINITY_CPU0=y -# CONFIG_ESP_TIMER_SUPPORTS_ISR_DISPATCH_METHOD is not set -CONFIG_ESP_TIMER_IMPL_SYSTIMER=y -# end of ESP Timer (High Resolution Timer) - -# -# Wi-Fi -# -# CONFIG_ESP_HOST_WIFI_ENABLED is not set -# end of Wi-Fi - -# -# Core dump -# -# CONFIG_ESP_COREDUMP_ENABLE_TO_FLASH is not set -# CONFIG_ESP_COREDUMP_ENABLE_TO_UART is not set -CONFIG_ESP_COREDUMP_ENABLE_TO_NONE=y -# end of Core dump - -# -# FAT Filesystem support -# -CONFIG_FATFS_VOLUME_COUNT=2 -CONFIG_FATFS_LFN_NONE=y -# CONFIG_FATFS_LFN_HEAP is not set -# CONFIG_FATFS_LFN_STACK is not set -# CONFIG_FATFS_SECTOR_512 is not set -CONFIG_FATFS_SECTOR_4096=y -# CONFIG_FATFS_CODEPAGE_DYNAMIC is not set -CONFIG_FATFS_CODEPAGE_437=y -# CONFIG_FATFS_CODEPAGE_720 is not set -# CONFIG_FATFS_CODEPAGE_737 is not set -# CONFIG_FATFS_CODEPAGE_771 is not set -# CONFIG_FATFS_CODEPAGE_775 is not set -# CONFIG_FATFS_CODEPAGE_850 is not set -# CONFIG_FATFS_CODEPAGE_852 is not set -# CONFIG_FATFS_CODEPAGE_855 is not set -# CONFIG_FATFS_CODEPAGE_857 is not set -# CONFIG_FATFS_CODEPAGE_860 is not set -# CONFIG_FATFS_CODEPAGE_861 is not set -# CONFIG_FATFS_CODEPAGE_862 is not set -# CONFIG_FATFS_CODEPAGE_863 is not set -# CONFIG_FATFS_CODEPAGE_864 is not set -# CONFIG_FATFS_CODEPAGE_865 is not set -# CONFIG_FATFS_CODEPAGE_866 is not set -# CONFIG_FATFS_CODEPAGE_869 is not set -# CONFIG_FATFS_CODEPAGE_932 is not set -# CONFIG_FATFS_CODEPAGE_936 is not set -# CONFIG_FATFS_CODEPAGE_949 is not set -# CONFIG_FATFS_CODEPAGE_950 is not set -CONFIG_FATFS_CODEPAGE=437 -CONFIG_FATFS_FS_LOCK=0 -CONFIG_FATFS_TIMEOUT_MS=10000 -CONFIG_FATFS_PER_FILE_CACHE=y -# CONFIG_FATFS_USE_FASTSEEK is not set -CONFIG_FATFS_USE_STRFUNC_NONE=y -# CONFIG_FATFS_USE_STRFUNC_WITHOUT_CRLF_CONV is not set -# CONFIG_FATFS_USE_STRFUNC_WITH_CRLF_CONV is not set -CONFIG_FATFS_VFS_FSTAT_BLKSIZE=0 -# CONFIG_FATFS_IMMEDIATE_FSYNC is not set -# CONFIG_FATFS_USE_LABEL is not set -CONFIG_FATFS_LINK_LOCK=y -# CONFIG_FATFS_USE_DYN_BUFFERS is not set - -# -# File system free space calculation behavior -# -CONFIG_FATFS_DONT_TRUST_FREE_CLUSTER_CNT=0 -CONFIG_FATFS_DONT_TRUST_LAST_ALLOC=0 -# end of File system free space calculation behavior -# end of FAT Filesystem support - -# -# FreeRTOS -# - -# -# Kernel -# -# CONFIG_FREERTOS_UNICORE is not set -CONFIG_FREERTOS_HZ=100 -# CONFIG_FREERTOS_CHECK_STACKOVERFLOW_NONE is not set -# CONFIG_FREERTOS_CHECK_STACKOVERFLOW_PTRVAL is not set -CONFIG_FREERTOS_CHECK_STACKOVERFLOW_CANARY=y -CONFIG_FREERTOS_THREAD_LOCAL_STORAGE_POINTERS=1 -CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=1536 -# CONFIG_FREERTOS_USE_IDLE_HOOK is not set -# CONFIG_FREERTOS_USE_TICK_HOOK is not set -CONFIG_FREERTOS_MAX_TASK_NAME_LEN=16 -# CONFIG_FREERTOS_ENABLE_BACKWARD_COMPATIBILITY is not set -CONFIG_FREERTOS_USE_TIMERS=y -CONFIG_FREERTOS_TIMER_SERVICE_TASK_NAME="Tmr Svc" -# CONFIG_FREERTOS_TIMER_TASK_AFFINITY_CPU0 is not set -# CONFIG_FREERTOS_TIMER_TASK_AFFINITY_CPU1 is not set -CONFIG_FREERTOS_TIMER_TASK_NO_AFFINITY=y -CONFIG_FREERTOS_TIMER_SERVICE_TASK_CORE_AFFINITY=0x7FFFFFFF -CONFIG_FREERTOS_TIMER_TASK_PRIORITY=1 -CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH=2048 -CONFIG_FREERTOS_TIMER_QUEUE_LENGTH=10 -CONFIG_FREERTOS_QUEUE_REGISTRY_SIZE=0 -CONFIG_FREERTOS_TASK_NOTIFICATION_ARRAY_ENTRIES=1 -# CONFIG_FREERTOS_USE_TRACE_FACILITY is not set -# CONFIG_FREERTOS_USE_LIST_DATA_INTEGRITY_CHECK_BYTES is not set -# CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS is not set -# CONFIG_FREERTOS_USE_APPLICATION_TASK_TAG is not set -# end of Kernel - -# -# Port -# -CONFIG_FREERTOS_TASK_FUNCTION_WRAPPER=y -# CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK is not set -CONFIG_FREERTOS_TLSP_DELETION_CALLBACKS=y -# CONFIG_FREERTOS_TASK_PRE_DELETION_HOOK is not set -# CONFIG_FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP is not set -CONFIG_FREERTOS_CHECK_MUTEX_GIVEN_BY_OWNER=y -CONFIG_FREERTOS_ISR_STACKSIZE=1536 -CONFIG_FREERTOS_INTERRUPT_BACKTRACE=y -CONFIG_FREERTOS_TICK_SUPPORT_SYSTIMER=y -CONFIG_FREERTOS_CORETIMER_SYSTIMER_LVL1=y -# CONFIG_FREERTOS_CORETIMER_SYSTIMER_LVL3 is not set -CONFIG_FREERTOS_SYSTICK_USES_SYSTIMER=y -# CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH is not set -# CONFIG_FREERTOS_CHECK_PORT_CRITICAL_COMPLIANCE is not set -# end of Port - -# -# Extra -# -# end of Extra - -CONFIG_FREERTOS_PORT=y -CONFIG_FREERTOS_NO_AFFINITY=0x7FFFFFFF -CONFIG_FREERTOS_SUPPORT_STATIC_ALLOCATION=y -CONFIG_FREERTOS_DEBUG_OCDAWARE=y -CONFIG_FREERTOS_ENABLE_TASK_SNAPSHOT=y -CONFIG_FREERTOS_PLACE_SNAPSHOT_FUNS_INTO_FLASH=y -CONFIG_FREERTOS_NUMBER_OF_CORES=2 -CONFIG_FREERTOS_IN_IRAM=y -# end of FreeRTOS - -# -# Hardware Abstraction Layer (HAL) and Low Level (LL) -# -CONFIG_HAL_ASSERTION_EQUALS_SYSTEM=y -# CONFIG_HAL_ASSERTION_DISABLE is not set -# CONFIG_HAL_ASSERTION_SILENT is not set -# CONFIG_HAL_ASSERTION_ENABLE is not set -CONFIG_HAL_DEFAULT_ASSERTION_LEVEL=2 -CONFIG_HAL_SYSTIMER_USE_ROM_IMPL=y -CONFIG_HAL_WDT_USE_ROM_IMPL=y -# end of Hardware Abstraction Layer (HAL) and Low Level (LL) - -# -# Heap memory debugging -# -CONFIG_HEAP_POISONING_DISABLED=y -# CONFIG_HEAP_POISONING_LIGHT is not set -# CONFIG_HEAP_POISONING_COMPREHENSIVE is not set -CONFIG_HEAP_TRACING_OFF=y -# CONFIG_HEAP_TRACING_STANDALONE is not set -# CONFIG_HEAP_TRACING_TOHOST is not set -# CONFIG_HEAP_USE_HOOKS is not set -# CONFIG_HEAP_TASK_TRACKING is not set -# CONFIG_HEAP_ABORT_WHEN_ALLOCATION_FAILS is not set -# CONFIG_HEAP_PLACE_FUNCTION_INTO_FLASH is not set -# end of Heap memory debugging - -# -# Log -# -CONFIG_LOG_VERSION_1=y -# CONFIG_LOG_VERSION_2 is not set -CONFIG_LOG_VERSION=1 - -# -# Log Level -# -# CONFIG_LOG_DEFAULT_LEVEL_NONE is not set -# CONFIG_LOG_DEFAULT_LEVEL_ERROR is not set -# CONFIG_LOG_DEFAULT_LEVEL_WARN is not set -CONFIG_LOG_DEFAULT_LEVEL_INFO=y -# CONFIG_LOG_DEFAULT_LEVEL_DEBUG is not set -# CONFIG_LOG_DEFAULT_LEVEL_VERBOSE is not set -CONFIG_LOG_DEFAULT_LEVEL=3 -CONFIG_LOG_MAXIMUM_EQUALS_DEFAULT=y -# CONFIG_LOG_MAXIMUM_LEVEL_DEBUG is not set -# CONFIG_LOG_MAXIMUM_LEVEL_VERBOSE is not set -CONFIG_LOG_MAXIMUM_LEVEL=3 - -# -# Level Settings -# -# CONFIG_LOG_MASTER_LEVEL is not set -CONFIG_LOG_DYNAMIC_LEVEL_CONTROL=y -# CONFIG_LOG_TAG_LEVEL_IMPL_NONE is not set -# CONFIG_LOG_TAG_LEVEL_IMPL_LINKED_LIST is not set -CONFIG_LOG_TAG_LEVEL_IMPL_CACHE_AND_LINKED_LIST=y -# CONFIG_LOG_TAG_LEVEL_CACHE_ARRAY is not set -CONFIG_LOG_TAG_LEVEL_CACHE_BINARY_MIN_HEAP=y -CONFIG_LOG_TAG_LEVEL_IMPL_CACHE_SIZE=31 -# end of Level Settings -# end of Log Level - -# -# Format -# -# CONFIG_LOG_COLORS is not set -CONFIG_LOG_TIMESTAMP_SOURCE_RTOS=y -# CONFIG_LOG_TIMESTAMP_SOURCE_SYSTEM is not set -# end of Format - -# -# Settings -# -CONFIG_LOG_MODE_TEXT_EN=y -CONFIG_LOG_MODE_TEXT=y -# end of Settings - -CONFIG_LOG_IN_IRAM=y -# end of Log - -# -# LWIP -# -CONFIG_LWIP_ENABLE=y -CONFIG_LWIP_LOCAL_HOSTNAME="espressif" -CONFIG_LWIP_TCPIP_TASK_PRIO=18 -# CONFIG_LWIP_TCPIP_CORE_LOCKING is not set -# CONFIG_LWIP_CHECK_THREAD_SAFETY is not set -CONFIG_LWIP_DNS_SUPPORT_MDNS_QUERIES=y -# CONFIG_LWIP_L2_TO_L3_COPY is not set -# CONFIG_LWIP_IRAM_OPTIMIZATION is not set -# CONFIG_LWIP_EXTRA_IRAM_OPTIMIZATION is not set -CONFIG_LWIP_TIMERS_ONDEMAND=y -CONFIG_LWIP_ND6=y -# CONFIG_LWIP_FORCE_ROUTER_FORWARDING is not set -CONFIG_LWIP_MAX_SOCKETS=10 -# CONFIG_LWIP_USE_ONLY_LWIP_SELECT is not set -# CONFIG_LWIP_SO_LINGER is not set -CONFIG_LWIP_SO_REUSE=y -CONFIG_LWIP_SO_REUSE_RXTOALL=y -# CONFIG_LWIP_SO_RCVBUF is not set -# CONFIG_LWIP_NETBUF_RECVINFO is not set -CONFIG_LWIP_IP_DEFAULT_TTL=64 -CONFIG_LWIP_IP4_FRAG=y -CONFIG_LWIP_IP6_FRAG=y -# CONFIG_LWIP_IP4_REASSEMBLY is not set -# CONFIG_LWIP_IP6_REASSEMBLY is not set -CONFIG_LWIP_IP_REASS_MAX_PBUFS=10 -# CONFIG_LWIP_IP_FORWARD is not set -# CONFIG_LWIP_STATS is not set -CONFIG_LWIP_ESP_GRATUITOUS_ARP=y -CONFIG_LWIP_GARP_TMR_INTERVAL=60 -CONFIG_LWIP_ESP_MLDV6_REPORT=y -CONFIG_LWIP_MLDV6_TMR_INTERVAL=40 -CONFIG_LWIP_TCPIP_RECVMBOX_SIZE=32 -CONFIG_LWIP_DHCP_DOES_ARP_CHECK=y -# CONFIG_LWIP_DHCP_DOES_ACD_CHECK is not set -# CONFIG_LWIP_DHCP_DOES_NOT_CHECK_OFFERED_IP is not set -# CONFIG_LWIP_DHCP_DISABLE_CLIENT_ID is not set -CONFIG_LWIP_DHCP_DISABLE_VENDOR_CLASS_ID=y -# CONFIG_LWIP_DHCP_RESTORE_LAST_IP is not set -CONFIG_LWIP_DHCP_OPTIONS_LEN=69 -CONFIG_LWIP_NUM_NETIF_CLIENT_DATA=0 -CONFIG_LWIP_DHCP_COARSE_TIMER_SECS=1 - -# -# DHCP server -# -CONFIG_LWIP_DHCPS=y -CONFIG_LWIP_DHCPS_LEASE_UNIT=60 -CONFIG_LWIP_DHCPS_MAX_STATION_NUM=8 -CONFIG_LWIP_DHCPS_STATIC_ENTRIES=y -CONFIG_LWIP_DHCPS_ADD_DNS=y -# end of DHCP server - -# CONFIG_LWIP_AUTOIP is not set -CONFIG_LWIP_IPV4=y -CONFIG_LWIP_IPV6=y -# CONFIG_LWIP_IPV6_AUTOCONFIG is not set -CONFIG_LWIP_IPV6_NUM_ADDRESSES=3 -# CONFIG_LWIP_IPV6_FORWARD is not set -# CONFIG_LWIP_NETIF_STATUS_CALLBACK is not set -CONFIG_LWIP_NETIF_LOOPBACK=y -CONFIG_LWIP_LOOPBACK_MAX_PBUFS=8 - -# -# TCP -# -CONFIG_LWIP_MAX_ACTIVE_TCP=16 -CONFIG_LWIP_MAX_LISTENING_TCP=16 -CONFIG_LWIP_TCP_HIGH_SPEED_RETRANSMISSION=y -CONFIG_LWIP_TCP_MAXRTX=12 -CONFIG_LWIP_TCP_SYNMAXRTX=12 -CONFIG_LWIP_TCP_MSS=1440 -CONFIG_LWIP_TCP_TMR_INTERVAL=250 -CONFIG_LWIP_TCP_MSL=60000 -CONFIG_LWIP_TCP_FIN_WAIT_TIMEOUT=20000 -CONFIG_LWIP_TCP_SND_BUF_DEFAULT=5760 -CONFIG_LWIP_TCP_WND_DEFAULT=5760 -CONFIG_LWIP_TCP_RECVMBOX_SIZE=6 -CONFIG_LWIP_TCP_ACCEPTMBOX_SIZE=6 -CONFIG_LWIP_TCP_QUEUE_OOSEQ=y -CONFIG_LWIP_TCP_OOSEQ_TIMEOUT=6 -CONFIG_LWIP_TCP_OOSEQ_MAX_PBUFS=4 -# CONFIG_LWIP_TCP_SACK_OUT is not set -CONFIG_LWIP_TCP_OVERSIZE_MSS=y -# CONFIG_LWIP_TCP_OVERSIZE_QUARTER_MSS is not set -# CONFIG_LWIP_TCP_OVERSIZE_DISABLE is not set -CONFIG_LWIP_TCP_RTO_TIME=1500 -# end of TCP - -# -# UDP -# -CONFIG_LWIP_MAX_UDP_PCBS=16 -CONFIG_LWIP_UDP_RECVMBOX_SIZE=6 -# end of UDP - -# -# Checksums -# -# CONFIG_LWIP_CHECKSUM_CHECK_IP is not set -# CONFIG_LWIP_CHECKSUM_CHECK_UDP is not set -CONFIG_LWIP_CHECKSUM_CHECK_ICMP=y -# end of Checksums - -CONFIG_LWIP_TCPIP_TASK_STACK_SIZE=3072 -CONFIG_LWIP_TCPIP_TASK_AFFINITY_NO_AFFINITY=y -# CONFIG_LWIP_TCPIP_TASK_AFFINITY_CPU0 is not set -# CONFIG_LWIP_TCPIP_TASK_AFFINITY_CPU1 is not set -CONFIG_LWIP_TCPIP_TASK_AFFINITY=0x7FFFFFFF -CONFIG_LWIP_IPV6_MEMP_NUM_ND6_QUEUE=3 -CONFIG_LWIP_IPV6_ND6_NUM_NEIGHBORS=5 -CONFIG_LWIP_IPV6_ND6_NUM_PREFIXES=5 -CONFIG_LWIP_IPV6_ND6_NUM_ROUTERS=3 -CONFIG_LWIP_IPV6_ND6_NUM_DESTINATIONS=10 -# CONFIG_LWIP_PPP_SUPPORT is not set -# CONFIG_LWIP_SLIP_SUPPORT is not set - -# -# ICMP -# -CONFIG_LWIP_ICMP=y -# CONFIG_LWIP_MULTICAST_PING is not set -# CONFIG_LWIP_BROADCAST_PING is not set -# end of ICMP - -# -# LWIP RAW API -# -CONFIG_LWIP_MAX_RAW_PCBS=16 -# end of LWIP RAW API - -# -# SNTP -# -CONFIG_LWIP_SNTP_MAX_SERVERS=1 -# CONFIG_LWIP_DHCP_GET_NTP_SRV is not set -CONFIG_LWIP_SNTP_UPDATE_DELAY=3600000 -CONFIG_LWIP_SNTP_STARTUP_DELAY=y -CONFIG_LWIP_SNTP_MAXIMUM_STARTUP_DELAY=5000 -# end of SNTP - -# -# DNS -# -CONFIG_LWIP_DNS_MAX_HOST_IP=1 -CONFIG_LWIP_DNS_MAX_SERVERS=3 -# CONFIG_LWIP_FALLBACK_DNS_SERVER_SUPPORT is not set -# CONFIG_LWIP_DNS_SETSERVER_WITH_NETIF is not set -# CONFIG_LWIP_USE_ESP_GETADDRINFO is not set -# end of DNS - -CONFIG_LWIP_BRIDGEIF_MAX_PORTS=7 -CONFIG_LWIP_ESP_LWIP_ASSERT=y - -# -# Hooks -# -# CONFIG_LWIP_HOOK_TCP_ISN_NONE is not set -CONFIG_LWIP_HOOK_TCP_ISN_DEFAULT=y -# CONFIG_LWIP_HOOK_TCP_ISN_CUSTOM is not set -CONFIG_LWIP_HOOK_IP6_ROUTE_NONE=y -# CONFIG_LWIP_HOOK_IP6_ROUTE_DEFAULT is not set -# CONFIG_LWIP_HOOK_IP6_ROUTE_CUSTOM is not set -CONFIG_LWIP_HOOK_ND6_GET_GW_NONE=y -# CONFIG_LWIP_HOOK_ND6_GET_GW_DEFAULT is not set -# CONFIG_LWIP_HOOK_ND6_GET_GW_CUSTOM is not set -CONFIG_LWIP_HOOK_IP6_SELECT_SRC_ADDR_NONE=y -# CONFIG_LWIP_HOOK_IP6_SELECT_SRC_ADDR_DEFAULT is not set -# CONFIG_LWIP_HOOK_IP6_SELECT_SRC_ADDR_CUSTOM is not set -CONFIG_LWIP_HOOK_DHCP_EXTRA_OPTION_NONE=y -# CONFIG_LWIP_HOOK_DHCP_EXTRA_OPTION_DEFAULT is not set -# CONFIG_LWIP_HOOK_DHCP_EXTRA_OPTION_CUSTOM is not set -CONFIG_LWIP_HOOK_NETCONN_EXT_RESOLVE_NONE=y -# CONFIG_LWIP_HOOK_NETCONN_EXT_RESOLVE_DEFAULT is not set -# CONFIG_LWIP_HOOK_NETCONN_EXT_RESOLVE_CUSTOM is not set -CONFIG_LWIP_HOOK_DNS_EXT_RESOLVE_NONE=y -# CONFIG_LWIP_HOOK_DNS_EXT_RESOLVE_CUSTOM is not set -# CONFIG_LWIP_HOOK_IP6_INPUT_NONE is not set -CONFIG_LWIP_HOOK_IP6_INPUT_DEFAULT=y -# CONFIG_LWIP_HOOK_IP6_INPUT_CUSTOM is not set -# end of Hooks - -# CONFIG_LWIP_DEBUG is not set -# end of LWIP - -# -# mbedTLS -# -CONFIG_MBEDTLS_INTERNAL_MEM_ALLOC=y -# CONFIG_MBEDTLS_DEFAULT_MEM_ALLOC is not set -# CONFIG_MBEDTLS_CUSTOM_MEM_ALLOC is not set -CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN=y -CONFIG_MBEDTLS_SSL_IN_CONTENT_LEN=16384 -CONFIG_MBEDTLS_SSL_OUT_CONTENT_LEN=4096 -# CONFIG_MBEDTLS_DYNAMIC_BUFFER is not set -# CONFIG_MBEDTLS_DEBUG is not set - -# -# mbedTLS v3.x related -# -# CONFIG_MBEDTLS_SSL_PROTO_TLS1_3 is not set -# CONFIG_MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH is not set -# CONFIG_MBEDTLS_X509_TRUSTED_CERT_CALLBACK is not set -# CONFIG_MBEDTLS_SSL_CONTEXT_SERIALIZATION is not set -CONFIG_MBEDTLS_SSL_KEEP_PEER_CERTIFICATE=y -# CONFIG_MBEDTLS_SSL_KEYING_MATERIAL_EXPORT is not set -CONFIG_MBEDTLS_PKCS7_C=y -# end of mbedTLS v3.x related - -# -# Certificate Bundle -# -CONFIG_MBEDTLS_CERTIFICATE_BUNDLE=y -CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_FULL=y -# CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_CMN is not set -# CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_NONE is not set -# CONFIG_MBEDTLS_CUSTOM_CERTIFICATE_BUNDLE is not set -# CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEPRECATED_LIST is not set -CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_MAX_CERTS=200 -# end of Certificate Bundle - -# CONFIG_MBEDTLS_ECP_RESTARTABLE is not set -# CONFIG_MBEDTLS_CMAC_C is not set -CONFIG_MBEDTLS_HARDWARE_AES=y -CONFIG_MBEDTLS_AES_USE_INTERRUPT=y -CONFIG_MBEDTLS_AES_INTERRUPT_LEVEL=0 -CONFIG_MBEDTLS_HARDWARE_GCM=y -CONFIG_MBEDTLS_GCM_SUPPORT_NON_AES_CIPHER=y -CONFIG_MBEDTLS_HARDWARE_MPI=y -# CONFIG_MBEDTLS_LARGE_KEY_SOFTWARE_MPI is not set -CONFIG_MBEDTLS_MPI_USE_INTERRUPT=y -CONFIG_MBEDTLS_MPI_INTERRUPT_LEVEL=0 -CONFIG_MBEDTLS_HARDWARE_SHA=y -CONFIG_MBEDTLS_HARDWARE_ECC=y -CONFIG_MBEDTLS_ECC_OTHER_CURVES_SOFT_FALLBACK=y -CONFIG_MBEDTLS_ROM_MD5=y -# CONFIG_MBEDTLS_ATCA_HW_ECDSA_SIGN is not set -# CONFIG_MBEDTLS_ATCA_HW_ECDSA_VERIFY is not set -CONFIG_MBEDTLS_HAVE_TIME=y -# CONFIG_MBEDTLS_PLATFORM_TIME_ALT is not set -# CONFIG_MBEDTLS_HAVE_TIME_DATE is not set -CONFIG_MBEDTLS_ECDSA_DETERMINISTIC=y -CONFIG_MBEDTLS_SHA1_C=y -CONFIG_MBEDTLS_SHA512_C=y -# CONFIG_MBEDTLS_SHA3_C is not set -CONFIG_MBEDTLS_TLS_SERVER_AND_CLIENT=y -# CONFIG_MBEDTLS_TLS_SERVER_ONLY is not set -# CONFIG_MBEDTLS_TLS_CLIENT_ONLY is not set -# CONFIG_MBEDTLS_TLS_DISABLED is not set -CONFIG_MBEDTLS_TLS_SERVER=y -CONFIG_MBEDTLS_TLS_CLIENT=y -CONFIG_MBEDTLS_TLS_ENABLED=y - -# -# TLS Key Exchange Methods -# -# CONFIG_MBEDTLS_PSK_MODES is not set -CONFIG_MBEDTLS_KEY_EXCHANGE_RSA=y -CONFIG_MBEDTLS_KEY_EXCHANGE_ELLIPTIC_CURVE=y -CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_RSA=y -CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA=y -CONFIG_MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA=y -CONFIG_MBEDTLS_KEY_EXCHANGE_ECDH_RSA=y -# end of TLS Key Exchange Methods - -CONFIG_MBEDTLS_SSL_RENEGOTIATION=y -CONFIG_MBEDTLS_SSL_PROTO_TLS1_2=y -# CONFIG_MBEDTLS_SSL_PROTO_GMTSSL1_1 is not set -# CONFIG_MBEDTLS_SSL_PROTO_DTLS is not set -CONFIG_MBEDTLS_SSL_ALPN=y -CONFIG_MBEDTLS_CLIENT_SSL_SESSION_TICKETS=y -CONFIG_MBEDTLS_SERVER_SSL_SESSION_TICKETS=y - -# -# Symmetric Ciphers -# -CONFIG_MBEDTLS_AES_C=y -# CONFIG_MBEDTLS_CAMELLIA_C is not set -# CONFIG_MBEDTLS_DES_C is not set -# CONFIG_MBEDTLS_BLOWFISH_C is not set -# CONFIG_MBEDTLS_XTEA_C is not set -CONFIG_MBEDTLS_CCM_C=y -CONFIG_MBEDTLS_GCM_C=y -# CONFIG_MBEDTLS_NIST_KW_C is not set -# end of Symmetric Ciphers - -# CONFIG_MBEDTLS_RIPEMD160_C is not set - -# -# Certificates -# -CONFIG_MBEDTLS_PEM_PARSE_C=y -CONFIG_MBEDTLS_PEM_WRITE_C=y -CONFIG_MBEDTLS_X509_CRL_PARSE_C=y -CONFIG_MBEDTLS_X509_CSR_PARSE_C=y -# end of Certificates - -CONFIG_MBEDTLS_ECP_C=y -CONFIG_MBEDTLS_PK_PARSE_EC_EXTENDED=y -CONFIG_MBEDTLS_PK_PARSE_EC_COMPRESSED=y -# CONFIG_MBEDTLS_DHM_C is not set -CONFIG_MBEDTLS_ECDH_C=y -CONFIG_MBEDTLS_ECDSA_C=y -# CONFIG_MBEDTLS_ECJPAKE_C is not set -CONFIG_MBEDTLS_ECP_DP_SECP192R1_ENABLED=y -CONFIG_MBEDTLS_ECP_DP_SECP224R1_ENABLED=y -CONFIG_MBEDTLS_ECP_DP_SECP256R1_ENABLED=y -CONFIG_MBEDTLS_ECP_DP_SECP384R1_ENABLED=y -CONFIG_MBEDTLS_ECP_DP_SECP521R1_ENABLED=y -CONFIG_MBEDTLS_ECP_DP_SECP192K1_ENABLED=y -CONFIG_MBEDTLS_ECP_DP_SECP224K1_ENABLED=y -CONFIG_MBEDTLS_ECP_DP_SECP256K1_ENABLED=y -CONFIG_MBEDTLS_ECP_DP_BP256R1_ENABLED=y -CONFIG_MBEDTLS_ECP_DP_BP384R1_ENABLED=y -CONFIG_MBEDTLS_ECP_DP_BP512R1_ENABLED=y -CONFIG_MBEDTLS_ECP_DP_CURVE25519_ENABLED=y -CONFIG_MBEDTLS_ECP_NIST_OPTIM=y -# CONFIG_MBEDTLS_ECP_FIXED_POINT_OPTIM is not set -# CONFIG_MBEDTLS_POLY1305_C is not set -# CONFIG_MBEDTLS_CHACHA20_C is not set -# CONFIG_MBEDTLS_HKDF_C is not set -# CONFIG_MBEDTLS_THREADING_C is not set -CONFIG_MBEDTLS_ERROR_STRINGS=y -CONFIG_MBEDTLS_FS_IO=y -# CONFIG_MBEDTLS_ALLOW_WEAK_CERTIFICATE_VERIFICATION is not set -# end of mbedTLS - -# -# ESP-MQTT Configurations -# -CONFIG_MQTT_PROTOCOL_311=y -# CONFIG_MQTT_PROTOCOL_5 is not set -CONFIG_MQTT_TRANSPORT_SSL=y -CONFIG_MQTT_TRANSPORT_WEBSOCKET=y -CONFIG_MQTT_TRANSPORT_WEBSOCKET_SECURE=y -# CONFIG_MQTT_MSG_ID_INCREMENTAL is not set -# CONFIG_MQTT_SKIP_PUBLISH_IF_DISCONNECTED is not set -# CONFIG_MQTT_REPORT_DELETED_MESSAGES is not set -# CONFIG_MQTT_USE_CUSTOM_CONFIG is not set -# CONFIG_MQTT_TASK_CORE_SELECTION_ENABLED is not set -# CONFIG_MQTT_CUSTOM_OUTBOX is not set -# end of ESP-MQTT Configurations - -# -# LibC -# -CONFIG_LIBC_NEWLIB=y -CONFIG_LIBC_MISC_IN_IRAM=y -CONFIG_LIBC_LOCKS_PLACE_IN_IRAM=y -CONFIG_LIBC_STDOUT_LINE_ENDING_CRLF=y -# CONFIG_LIBC_STDOUT_LINE_ENDING_LF is not set -# CONFIG_LIBC_STDOUT_LINE_ENDING_CR is not set -# CONFIG_LIBC_STDIN_LINE_ENDING_CRLF is not set -# CONFIG_LIBC_STDIN_LINE_ENDING_LF is not set -CONFIG_LIBC_STDIN_LINE_ENDING_CR=y -# CONFIG_LIBC_NEWLIB_NANO_FORMAT is not set -CONFIG_LIBC_TIME_SYSCALL_USE_RTC_HRT=y -# CONFIG_LIBC_TIME_SYSCALL_USE_RTC is not set -# CONFIG_LIBC_TIME_SYSCALL_USE_HRT is not set -# CONFIG_LIBC_TIME_SYSCALL_USE_NONE is not set -# CONFIG_LIBC_OPTIMIZED_MISALIGNED_ACCESS is not set -# end of LibC - -# -# NVS -# -# CONFIG_NVS_ENCRYPTION is not set -# CONFIG_NVS_ASSERT_ERROR_CHECK is not set -# CONFIG_NVS_LEGACY_DUP_KEYS_COMPATIBILITY is not set -# end of NVS - -# -# OpenThread -# -# CONFIG_OPENTHREAD_ENABLED is not set - -# -# OpenThread Spinel -# -# CONFIG_OPENTHREAD_SPINEL_ONLY is not set -# end of OpenThread Spinel -# end of OpenThread - -# -# Protocomm -# -CONFIG_ESP_PROTOCOMM_SUPPORT_SECURITY_VERSION_0=y -CONFIG_ESP_PROTOCOMM_SUPPORT_SECURITY_VERSION_1=y -CONFIG_ESP_PROTOCOMM_SUPPORT_SECURITY_VERSION_2=y -CONFIG_ESP_PROTOCOMM_SUPPORT_SECURITY_PATCH_VERSION=y -# end of Protocomm - -# -# PThreads -# -CONFIG_PTHREAD_TASK_PRIO_DEFAULT=5 -CONFIG_PTHREAD_TASK_STACK_SIZE_DEFAULT=3072 -CONFIG_PTHREAD_STACK_MIN=768 -CONFIG_PTHREAD_DEFAULT_CORE_NO_AFFINITY=y -# CONFIG_PTHREAD_DEFAULT_CORE_0 is not set -# CONFIG_PTHREAD_DEFAULT_CORE_1 is not set -CONFIG_PTHREAD_TASK_CORE_DEFAULT=-1 -CONFIG_PTHREAD_TASK_NAME_DEFAULT="pthread" -# end of PThreads - -# -# MMU Config -# -CONFIG_MMU_PAGE_SIZE_64KB=y -CONFIG_MMU_PAGE_MODE="64KB" -CONFIG_MMU_PAGE_SIZE=0x10000 -# end of MMU Config - -# -# Main Flash configuration -# - -# -# SPI Flash behavior when brownout -# -CONFIG_SPI_FLASH_BROWNOUT_RESET_XMC=y -CONFIG_SPI_FLASH_BROWNOUT_RESET=y -# end of SPI Flash behavior when brownout - -# -# Optional and Experimental Features (READ DOCS FIRST) -# - -# -# Features here require specific hardware (READ DOCS FIRST!) -# -# CONFIG_SPI_FLASH_HPM_ENA is not set -CONFIG_SPI_FLASH_HPM_AUTO=y -# CONFIG_SPI_FLASH_HPM_DIS is not set -CONFIG_SPI_FLASH_HPM_ON=y -CONFIG_SPI_FLASH_HPM_DC_AUTO=y -# CONFIG_SPI_FLASH_HPM_DC_DISABLE is not set -# CONFIG_SPI_FLASH_AUTO_SUSPEND is not set -CONFIG_SPI_FLASH_SUSPEND_TSUS_VAL_US=50 -# CONFIG_SPI_FLASH_FORCE_ENABLE_XMC_C_SUSPEND is not set -# CONFIG_SPI_FLASH_FORCE_ENABLE_C6_H2_SUSPEND is not set -CONFIG_SPI_FLASH_PLACE_FUNCTIONS_IN_IRAM=y -# end of Optional and Experimental Features (READ DOCS FIRST) -# end of Main Flash configuration - -# -# SPI Flash driver -# -# CONFIG_SPI_FLASH_VERIFY_WRITE is not set -# CONFIG_SPI_FLASH_ENABLE_COUNTERS is not set -CONFIG_SPI_FLASH_ROM_DRIVER_PATCH=y -CONFIG_SPI_FLASH_DANGEROUS_WRITE_ABORTS=y -# CONFIG_SPI_FLASH_DANGEROUS_WRITE_FAILS is not set -# CONFIG_SPI_FLASH_DANGEROUS_WRITE_ALLOWED is not set -# CONFIG_SPI_FLASH_BYPASS_BLOCK_ERASE is not set -CONFIG_SPI_FLASH_YIELD_DURING_ERASE=y -CONFIG_SPI_FLASH_ERASE_YIELD_DURATION_MS=20 -CONFIG_SPI_FLASH_ERASE_YIELD_TICKS=1 -CONFIG_SPI_FLASH_WRITE_CHUNK_SIZE=8192 -# CONFIG_SPI_FLASH_SIZE_OVERRIDE is not set -# CONFIG_SPI_FLASH_CHECK_ERASE_TIMEOUT_DISABLED is not set -# CONFIG_SPI_FLASH_OVERRIDE_CHIP_DRIVER_LIST is not set - -# -# Auto-detect flash chips -# -CONFIG_SPI_FLASH_VENDOR_XMC_SUPPORT_ENABLED=y -CONFIG_SPI_FLASH_VENDOR_GD_SUPPORT_ENABLED=y -# CONFIG_SPI_FLASH_SUPPORT_ISSI_CHIP is not set -# CONFIG_SPI_FLASH_SUPPORT_MXIC_CHIP is not set -CONFIG_SPI_FLASH_SUPPORT_GD_CHIP=y -# CONFIG_SPI_FLASH_SUPPORT_WINBOND_CHIP is not set -# CONFIG_SPI_FLASH_SUPPORT_BOYA_CHIP is not set -# CONFIG_SPI_FLASH_SUPPORT_TH_CHIP is not set -# end of Auto-detect flash chips - -CONFIG_SPI_FLASH_ENABLE_ENCRYPTED_READ_WRITE=y -# end of SPI Flash driver - -# -# SPIFFS Configuration -# -CONFIG_SPIFFS_MAX_PARTITIONS=3 - -# -# SPIFFS Cache Configuration -# -CONFIG_SPIFFS_CACHE=y -CONFIG_SPIFFS_CACHE_WR=y -# CONFIG_SPIFFS_CACHE_STATS is not set -# end of SPIFFS Cache Configuration - -CONFIG_SPIFFS_PAGE_CHECK=y -CONFIG_SPIFFS_GC_MAX_RUNS=10 -# CONFIG_SPIFFS_GC_STATS is not set -CONFIG_SPIFFS_PAGE_SIZE=256 -CONFIG_SPIFFS_OBJ_NAME_LEN=32 -# CONFIG_SPIFFS_FOLLOW_SYMLINKS is not set -CONFIG_SPIFFS_USE_MAGIC=y -CONFIG_SPIFFS_USE_MAGIC_LENGTH=y -CONFIG_SPIFFS_META_LENGTH=4 -CONFIG_SPIFFS_USE_MTIME=y - -# -# Debug Configuration -# -# CONFIG_SPIFFS_DBG is not set -# CONFIG_SPIFFS_API_DBG is not set -# CONFIG_SPIFFS_GC_DBG is not set -# CONFIG_SPIFFS_CACHE_DBG is not set -# CONFIG_SPIFFS_CHECK_DBG is not set -# CONFIG_SPIFFS_TEST_VISUALISATION is not set -# end of Debug Configuration -# end of SPIFFS Configuration - -# -# TCP Transport -# - -# -# Websocket -# -CONFIG_WS_TRANSPORT=y -CONFIG_WS_BUFFER_SIZE=1024 -# CONFIG_WS_DYNAMIC_BUFFER is not set -# end of Websocket -# end of TCP Transport - -# -# Ultra Low Power (ULP) Co-processor -# -# CONFIG_ULP_COPROC_ENABLED is not set - -# -# ULP Debugging Options -# -# end of ULP Debugging Options -# end of Ultra Low Power (ULP) Co-processor - -# -# Unity unit testing library -# -CONFIG_UNITY_ENABLE_FLOAT=y -CONFIG_UNITY_ENABLE_DOUBLE=y -# CONFIG_UNITY_ENABLE_64BIT is not set -# CONFIG_UNITY_ENABLE_COLOR is not set -CONFIG_UNITY_ENABLE_IDF_TEST_RUNNER=y -# CONFIG_UNITY_ENABLE_FIXTURE is not set -# CONFIG_UNITY_ENABLE_BACKTRACE_ON_FAIL is not set -# CONFIG_UNITY_TEST_ORDER_BY_FILE_PATH_AND_LINE is not set -# end of Unity unit testing library - -# -# USB-OTG -# -CONFIG_USB_HOST_CONTROL_TRANSFER_MAX_SIZE=256 -CONFIG_USB_HOST_HW_BUFFER_BIAS_BALANCED=y -# CONFIG_USB_HOST_HW_BUFFER_BIAS_IN is not set -# CONFIG_USB_HOST_HW_BUFFER_BIAS_PERIODIC_OUT is not set - -# -# Hub Driver Configuration -# - -# -# Root Port configuration -# -CONFIG_USB_HOST_DEBOUNCE_DELAY_MS=250 -CONFIG_USB_HOST_RESET_HOLD_MS=30 -CONFIG_USB_HOST_RESET_RECOVERY_MS=30 -CONFIG_USB_HOST_SET_ADDR_RECOVERY_MS=10 -# end of Root Port configuration - -# CONFIG_USB_HOST_HUBS_SUPPORTED is not set -# end of Hub Driver Configuration - -# CONFIG_USB_HOST_ENABLE_ENUM_FILTER_CALLBACK is not set -CONFIG_USB_OTG_SUPPORTED=y -# end of USB-OTG - -# -# Virtual file system -# -CONFIG_VFS_SUPPORT_IO=y -CONFIG_VFS_SUPPORT_DIR=y -CONFIG_VFS_SUPPORT_SELECT=y -CONFIG_VFS_SUPPRESS_SELECT_DEBUG_OUTPUT=y -# CONFIG_VFS_SELECT_IN_RAM is not set -CONFIG_VFS_SUPPORT_TERMIOS=y -CONFIG_VFS_MAX_COUNT=8 - -# -# Host File System I/O (Semihosting) -# -CONFIG_VFS_SEMIHOSTFS_MAX_MOUNT_POINTS=1 -# end of Host File System I/O (Semihosting) - -CONFIG_VFS_INITIALIZE_DEV_NULL=y -# end of Virtual file system - -# -# Wear Levelling -# -# CONFIG_WL_SECTOR_SIZE_512 is not set -CONFIG_WL_SECTOR_SIZE_4096=y -CONFIG_WL_SECTOR_SIZE=4096 -# end of Wear Levelling - -# -# Wi-Fi Provisioning Manager -# -CONFIG_WIFI_PROV_SCAN_MAX_ENTRIES=16 -CONFIG_WIFI_PROV_AUTOSTOP_TIMEOUT=30 -CONFIG_WIFI_PROV_STA_ALL_CHANNEL_SCAN=y -# CONFIG_WIFI_PROV_STA_FAST_SCAN is not set -# end of Wi-Fi Provisioning Manager - -# -# TinyUSB Stack -# -CONFIG_TINYUSB_DEBUG_LEVEL=1 -CONFIG_TINYUSB_RHPORT_HS=y -# CONFIG_TINYUSB_RHPORT_FS is not set - -# -# TinyUSB DCD -# -# CONFIG_TINYUSB_MODE_SLAVE is not set -CONFIG_TINYUSB_MODE_DMA=y -# end of TinyUSB DCD - -# -# TinyUSB task configuration -# -# CONFIG_TINYUSB_NO_DEFAULT_TASK is not set -CONFIG_TINYUSB_TASK_PRIORITY=5 -CONFIG_TINYUSB_TASK_STACK_SIZE=4096 -# CONFIG_TINYUSB_TASK_AFFINITY_NO_AFFINITY is not set -# CONFIG_TINYUSB_TASK_AFFINITY_CPU0 is not set -CONFIG_TINYUSB_TASK_AFFINITY_CPU1=y -CONFIG_TINYUSB_TASK_AFFINITY=0x1 -# CONFIG_TINYUSB_INIT_IN_DEFAULT_TASK is not set -# end of TinyUSB task configuration - -# -# Descriptor configuration -# - -# -# You can provide your custom descriptors via tinyusb_driver_install() -# -CONFIG_TINYUSB_DESC_USE_ESPRESSIF_VID=y -CONFIG_TINYUSB_DESC_USE_DEFAULT_PID=y -CONFIG_TINYUSB_DESC_BCD_DEVICE=0x0100 -CONFIG_TINYUSB_DESC_MANUFACTURER_STRING="Espressif Systems" -CONFIG_TINYUSB_DESC_PRODUCT_STRING="Espressif Device" -CONFIG_TINYUSB_DESC_SERIAL_STRING="123456" -# end of Descriptor configuration - -# -# Massive Storage Class (MSC) -# -# CONFIG_TINYUSB_MSC_ENABLED is not set - -# -# TinyUSB FAT Format Options -# -CONFIG_TINYUSB_FAT_FORMAT_ANY=y -# CONFIG_TINYUSB_FAT_FORMAT_FAT is not set -# CONFIG_TINYUSB_FAT_FORMAT_FAT32 is not set -# CONFIG_TINYUSB_FAT_FORMAT_EXFAT is not set -# CONFIG_TINYUSB_FAT_FORMAT_SFD is not set -# end of TinyUSB FAT Format Options -# end of Massive Storage Class (MSC) - -# -# Communication Device Class (CDC) -# -# CONFIG_TINYUSB_CDC_ENABLED is not set -# end of Communication Device Class (CDC) - -# -# Musical Instrument Digital Interface (MIDI) -# -CONFIG_TINYUSB_MIDI_COUNT=0 -# end of Musical Instrument Digital Interface (MIDI) - -# -# Human Interface Device Class (HID) -# -CONFIG_TINYUSB_HID_COUNT=2 -# end of Human Interface Device Class (HID) - -# -# Device Firmware Upgrade (DFU) -# -# CONFIG_TINYUSB_DFU_MODE_DFU is not set -# CONFIG_TINYUSB_DFU_MODE_DFU_RUNTIME is not set -CONFIG_TINYUSB_DFU_MODE_NONE=y -# end of Device Firmware Upgrade (DFU) - -# -# Bluetooth Host Class (BTH) -# -# CONFIG_TINYUSB_BTH_ENABLED is not set -# end of Bluetooth Host Class (BTH) - -# -# Network driver (ECM/NCM/RNDIS) -# -# CONFIG_TINYUSB_NET_MODE_ECM_RNDIS is not set -# CONFIG_TINYUSB_NET_MODE_NCM is not set -CONFIG_TINYUSB_NET_MODE_NONE=y -# end of Network driver (ECM/NCM/RNDIS) - -# -# Vendor Specific Interface -# -CONFIG_TINYUSB_VENDOR_COUNT=0 -# end of Vendor Specific Interface -# end of TinyUSB Stack - -# -# LittleFS -# -# CONFIG_LITTLEFS_SDMMC_SUPPORT is not set -CONFIG_LITTLEFS_MAX_PARTITIONS=3 -CONFIG_LITTLEFS_PAGE_SIZE=256 -CONFIG_LITTLEFS_OBJ_NAME_LEN=64 -CONFIG_LITTLEFS_READ_SIZE=128 -CONFIG_LITTLEFS_WRITE_SIZE=128 -CONFIG_LITTLEFS_LOOKAHEAD_SIZE=128 -CONFIG_LITTLEFS_CACHE_SIZE=512 -CONFIG_LITTLEFS_BLOCK_CYCLES=512 -CONFIG_LITTLEFS_USE_MTIME=y -# CONFIG_LITTLEFS_USE_ONLY_HASH is not set -# CONFIG_LITTLEFS_HUMAN_READABLE is not set -CONFIG_LITTLEFS_MTIME_USE_SECONDS=y -# CONFIG_LITTLEFS_MTIME_USE_NONCE is not set -# CONFIG_LITTLEFS_SPIFFS_COMPAT is not set -# CONFIG_LITTLEFS_FLUSH_FILE_EVERY_WRITE is not set -# CONFIG_LITTLEFS_FCNTL_GET_PATH is not set -# CONFIG_LITTLEFS_MULTIVERSION is not set -# CONFIG_LITTLEFS_MALLOC_STRATEGY_DISABLE is not set -CONFIG_LITTLEFS_MALLOC_STRATEGY_DEFAULT=y -# CONFIG_LITTLEFS_MALLOC_STRATEGY_INTERNAL is not set -CONFIG_LITTLEFS_ASSERTS=y -# CONFIG_LITTLEFS_MMAP_PARTITION is not set -# CONFIG_LITTLEFS_WDT_RESET is not set -# end of LittleFS - -# -# LVGL configuration -# -CONFIG_LV_CONF_SKIP=y -# CONFIG_LV_CONF_MINIMAL is not set - -# -# Color Settings -# -# CONFIG_LV_COLOR_DEPTH_32 is not set -# CONFIG_LV_COLOR_DEPTH_24 is not set -CONFIG_LV_COLOR_DEPTH_16=y -# CONFIG_LV_COLOR_DEPTH_8 is not set -# CONFIG_LV_COLOR_DEPTH_1 is not set -CONFIG_LV_COLOR_DEPTH=16 -# end of Color Settings - -# -# Memory Settings -# -CONFIG_LV_USE_BUILTIN_MALLOC=y -# CONFIG_LV_USE_CLIB_MALLOC is not set -# CONFIG_LV_USE_MICROPYTHON_MALLOC is not set -# CONFIG_LV_USE_RTTHREAD_MALLOC is not set -# CONFIG_LV_USE_CUSTOM_MALLOC is not set -CONFIG_LV_USE_BUILTIN_STRING=y -# CONFIG_LV_USE_CLIB_STRING is not set -# CONFIG_LV_USE_CUSTOM_STRING is not set -CONFIG_LV_USE_BUILTIN_SPRINTF=y -# CONFIG_LV_USE_CLIB_SPRINTF is not set -# CONFIG_LV_USE_CUSTOM_SPRINTF is not set -CONFIG_LV_MEM_SIZE_KILOBYTES=64 -CONFIG_LV_MEM_POOL_EXPAND_SIZE_KILOBYTES=0 -CONFIG_LV_MEM_ADR=0x0 -# end of Memory Settings - -# -# HAL Settings -# -CONFIG_LV_DEF_REFR_PERIOD=33 -CONFIG_LV_DPI_DEF=130 -# end of HAL Settings - -# -# Operating System (OS) -# -CONFIG_LV_OS_NONE=y -# CONFIG_LV_OS_PTHREAD is not set -# CONFIG_LV_OS_FREERTOS is not set -# CONFIG_LV_OS_CMSIS_RTOS2 is not set -# CONFIG_LV_OS_RTTHREAD is not set -# CONFIG_LV_OS_WINDOWS is not set -# CONFIG_LV_OS_MQX is not set -# CONFIG_LV_OS_SDL2 is not set -# CONFIG_LV_OS_CUSTOM is not set -# end of Operating System (OS) - -# -# Rendering Configuration -# -CONFIG_LV_DRAW_BUF_STRIDE_ALIGN=1 -CONFIG_LV_DRAW_BUF_ALIGN=4 -CONFIG_LV_DRAW_LAYER_SIMPLE_BUF_SIZE=24576 -CONFIG_LV_DRAW_LAYER_MAX_MEMORY=0 -CONFIG_LV_USE_DRAW_SW=y -CONFIG_LV_DRAW_SW_SUPPORT_RGB565=y -CONFIG_LV_DRAW_SW_SUPPORT_RGB565A8=y -CONFIG_LV_DRAW_SW_SUPPORT_RGB888=y -CONFIG_LV_DRAW_SW_SUPPORT_XRGB8888=y -CONFIG_LV_DRAW_SW_SUPPORT_ARGB8888=y -CONFIG_LV_DRAW_SW_SUPPORT_ARGB8888_PREMULTIPLIED=y -CONFIG_LV_DRAW_SW_SUPPORT_L8=y -CONFIG_LV_DRAW_SW_SUPPORT_AL88=y -CONFIG_LV_DRAW_SW_SUPPORT_A8=y -CONFIG_LV_DRAW_SW_SUPPORT_I1=y -CONFIG_LV_DRAW_SW_I1_LUM_THRESHOLD=127 -CONFIG_LV_DRAW_SW_DRAW_UNIT_CNT=1 -# CONFIG_LV_USE_DRAW_ARM2D_SYNC is not set -# CONFIG_LV_USE_NATIVE_HELIUM_ASM is not set -CONFIG_LV_DRAW_SW_COMPLEX=y -# CONFIG_LV_USE_DRAW_SW_COMPLEX_GRADIENTS is not set -CONFIG_LV_DRAW_SW_SHADOW_CACHE_SIZE=0 -CONFIG_LV_DRAW_SW_CIRCLE_CACHE_SIZE=4 -CONFIG_LV_DRAW_SW_ASM_NONE=y -# CONFIG_LV_DRAW_SW_ASM_NEON is not set -# CONFIG_LV_DRAW_SW_ASM_HELIUM is not set -# CONFIG_LV_DRAW_SW_ASM_CUSTOM is not set -CONFIG_LV_USE_DRAW_SW_ASM=0 -# CONFIG_LV_USE_PXP is not set -# CONFIG_LV_USE_G2D is not set -# CONFIG_LV_USE_DRAW_DAVE2D is not set -# CONFIG_LV_USE_DRAW_SDL is not set -# CONFIG_LV_USE_DRAW_VG_LITE is not set -# CONFIG_LV_USE_VECTOR_GRAPHIC is not set -# CONFIG_LV_USE_DRAW_DMA2D is not set -# CONFIG_LV_USE_PPA is not set -# CONFIG_LV_USE_DRAW_EVE is not set -# end of Rendering Configuration - -# -# Feature Configuration -# - -# -# Logging -# -# CONFIG_LV_USE_LOG is not set -# end of Logging - -# -# Asserts -# -CONFIG_LV_USE_ASSERT_NULL=y -CONFIG_LV_USE_ASSERT_MALLOC=y -# CONFIG_LV_USE_ASSERT_STYLE is not set -# CONFIG_LV_USE_ASSERT_MEM_INTEGRITY is not set -# CONFIG_LV_USE_ASSERT_OBJ is not set -CONFIG_LV_ASSERT_HANDLER_INCLUDE="assert.h" -# end of Asserts - -# -# Debug -# -# CONFIG_LV_USE_REFR_DEBUG is not set -# CONFIG_LV_USE_LAYER_DEBUG is not set -# CONFIG_LV_USE_PARALLEL_DRAW_DEBUG is not set -# end of Debug - -# -# Others -# -# CONFIG_LV_ENABLE_GLOBAL_CUSTOM is not set -CONFIG_LV_CACHE_DEF_SIZE=0 -CONFIG_LV_IMAGE_HEADER_CACHE_DEF_CNT=0 -CONFIG_LV_GRADIENT_MAX_STOPS=2 -CONFIG_LV_COLOR_MIX_ROUND_OFS=128 -# CONFIG_LV_OBJ_STYLE_CACHE is not set -# CONFIG_LV_USE_OBJ_ID is not set -# CONFIG_LV_USE_OBJ_NAME is not set -# CONFIG_LV_USE_OBJ_PROPERTY is not set -# end of Others -# end of Feature Configuration - -# -# Compiler Settings -# -# CONFIG_LV_BIG_ENDIAN_SYSTEM is not set -CONFIG_LV_ATTRIBUTE_MEM_ALIGN_SIZE=1 -# CONFIG_LV_ATTRIBUTE_FAST_MEM_USE_IRAM is not set -# CONFIG_LV_USE_FLOAT is not set -# CONFIG_LV_USE_MATRIX is not set -# CONFIG_LV_USE_PRIVATE_API is not set -# end of Compiler Settings - -# -# Font Usage -# - -# -# Enable built-in fonts -# -# CONFIG_LV_FONT_MONTSERRAT_8 is not set -# CONFIG_LV_FONT_MONTSERRAT_10 is not set -# CONFIG_LV_FONT_MONTSERRAT_12 is not set -CONFIG_LV_FONT_MONTSERRAT_14=y -# CONFIG_LV_FONT_MONTSERRAT_16 is not set -# CONFIG_LV_FONT_MONTSERRAT_18 is not set -# CONFIG_LV_FONT_MONTSERRAT_20 is not set -# CONFIG_LV_FONT_MONTSERRAT_22 is not set -# CONFIG_LV_FONT_MONTSERRAT_24 is not set -# CONFIG_LV_FONT_MONTSERRAT_26 is not set -# CONFIG_LV_FONT_MONTSERRAT_28 is not set -# CONFIG_LV_FONT_MONTSERRAT_30 is not set -# CONFIG_LV_FONT_MONTSERRAT_32 is not set -# CONFIG_LV_FONT_MONTSERRAT_34 is not set -# CONFIG_LV_FONT_MONTSERRAT_36 is not set -# CONFIG_LV_FONT_MONTSERRAT_38 is not set -# CONFIG_LV_FONT_MONTSERRAT_40 is not set -# CONFIG_LV_FONT_MONTSERRAT_42 is not set -# CONFIG_LV_FONT_MONTSERRAT_44 is not set -# CONFIG_LV_FONT_MONTSERRAT_46 is not set -# CONFIG_LV_FONT_MONTSERRAT_48 is not set -# CONFIG_LV_FONT_MONTSERRAT_28_COMPRESSED is not set -# CONFIG_LV_FONT_DEJAVU_16_PERSIAN_HEBREW is not set -# CONFIG_LV_FONT_SOURCE_HAN_SANS_SC_14_CJK is not set -# CONFIG_LV_FONT_SOURCE_HAN_SANS_SC_16_CJK is not set -# CONFIG_LV_FONT_UNSCII_8 is not set -# CONFIG_LV_FONT_UNSCII_16 is not set -# end of Enable built-in fonts - -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_8 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_10 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_12 is not set -CONFIG_LV_FONT_DEFAULT_MONTSERRAT_14=y -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_16 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_18 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_20 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_22 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_24 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_26 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_28 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_30 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_32 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_34 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_36 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_38 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_40 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_42 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_44 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_46 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_48 is not set -# CONFIG_LV_FONT_DEFAULT_MONTSERRAT_28_COMPRESSED is not set -# CONFIG_LV_FONT_DEFAULT_DEJAVU_16_PERSIAN_HEBREW is not set -# CONFIG_LV_FONT_DEFAULT_SOURCE_HAN_SANS_SC_14_CJK is not set -# CONFIG_LV_FONT_DEFAULT_SOURCE_HAN_SANS_SC_16_CJK is not set -# CONFIG_LV_FONT_DEFAULT_UNSCII_8 is not set -# CONFIG_LV_FONT_DEFAULT_UNSCII_16 is not set -# CONFIG_LV_FONT_FMT_TXT_LARGE is not set -# CONFIG_LV_USE_FONT_COMPRESSED is not set -CONFIG_LV_USE_FONT_PLACEHOLDER=y - -# -# Enable static fonts -# -# end of Enable static fonts -# end of Font Usage - -# -# Text Settings -# -CONFIG_LV_TXT_ENC_UTF8=y -# CONFIG_LV_TXT_ENC_ASCII is not set -CONFIG_LV_TXT_BREAK_CHARS=" ,.;:-_)}" -CONFIG_LV_TXT_LINE_BREAK_LONG_LEN=0 -CONFIG_LV_TXT_COLOR_CMD="#" -# CONFIG_LV_USE_BIDI is not set -# CONFIG_LV_USE_ARABIC_PERSIAN_CHARS is not set -# end of Text Settings - -# -# Widget Usage -# -CONFIG_LV_WIDGETS_HAS_DEFAULT_VALUE=y -CONFIG_LV_USE_ANIMIMG=y -CONFIG_LV_USE_ARC=y -CONFIG_LV_USE_ARCLABEL=y -CONFIG_LV_USE_BAR=y -CONFIG_LV_USE_BUTTON=y -CONFIG_LV_USE_BUTTONMATRIX=y -CONFIG_LV_USE_CALENDAR=y -# CONFIG_LV_CALENDAR_WEEK_STARTS_MONDAY is not set - -# -# Days name configuration -# -CONFIG_LV_MONDAY_STR="Mo" -CONFIG_LV_TUESDAY_STR="Tu" -CONFIG_LV_WEDNESDAY_STR="We" -CONFIG_LV_THURSDAY_STR="Th" -CONFIG_LV_FRIDAY_STR="Fr" -CONFIG_LV_SATURDAY_STR="Sa" -CONFIG_LV_SUNDAY_STR="Su" -# end of Days name configuration - -CONFIG_LV_USE_CALENDAR_HEADER_ARROW=y -CONFIG_LV_USE_CALENDAR_HEADER_DROPDOWN=y -# CONFIG_LV_USE_CALENDAR_CHINESE is not set -CONFIG_LV_USE_CANVAS=y -CONFIG_LV_USE_CHART=y -CONFIG_LV_USE_CHECKBOX=y -CONFIG_LV_USE_DROPDOWN=y -CONFIG_LV_USE_IMAGE=y -CONFIG_LV_USE_IMAGEBUTTON=y -CONFIG_LV_USE_KEYBOARD=y -CONFIG_LV_USE_LABEL=y -CONFIG_LV_LABEL_TEXT_SELECTION=y -CONFIG_LV_LABEL_LONG_TXT_HINT=y -CONFIG_LV_LABEL_WAIT_CHAR_COUNT=3 -CONFIG_LV_USE_LED=y -CONFIG_LV_USE_LINE=y -CONFIG_LV_USE_LIST=y -CONFIG_LV_USE_MENU=y -CONFIG_LV_USE_MSGBOX=y -CONFIG_LV_USE_ROLLER=y -CONFIG_LV_USE_SCALE=y -CONFIG_LV_USE_SLIDER=y -CONFIG_LV_USE_SPAN=y -CONFIG_LV_SPAN_SNIPPET_STACK_SIZE=64 -CONFIG_LV_USE_SPINBOX=y -CONFIG_LV_USE_SPINNER=y -CONFIG_LV_USE_SWITCH=y -CONFIG_LV_USE_TEXTAREA=y -CONFIG_LV_TEXTAREA_DEF_PWD_SHOW_TIME=1500 -CONFIG_LV_USE_TABLE=y -CONFIG_LV_USE_TABVIEW=y -CONFIG_LV_USE_TILEVIEW=y -CONFIG_LV_USE_WIN=y -# end of Widget Usage - -# -# Themes -# -CONFIG_LV_USE_THEME_DEFAULT=y -# CONFIG_LV_THEME_DEFAULT_DARK is not set -CONFIG_LV_THEME_DEFAULT_GROW=y -CONFIG_LV_THEME_DEFAULT_TRANSITION_TIME=80 -CONFIG_LV_USE_THEME_SIMPLE=y -# CONFIG_LV_USE_THEME_MONO is not set -# end of Themes - -# -# Layouts -# -CONFIG_LV_USE_FLEX=y -CONFIG_LV_USE_GRID=y -# end of Layouts - -# -# 3rd Party Libraries -# -CONFIG_LV_FS_DEFAULT_DRIVER_LETTER=0 -# CONFIG_LV_USE_FS_STDIO is not set -# CONFIG_LV_USE_FS_POSIX is not set -# CONFIG_LV_USE_FS_WIN32 is not set -# CONFIG_LV_USE_FS_FATFS is not set -# CONFIG_LV_USE_FS_MEMFS is not set -# CONFIG_LV_USE_FS_LITTLEFS is not set -# CONFIG_LV_USE_FS_ARDUINO_ESP_LITTLEFS is not set -# CONFIG_LV_USE_FS_ARDUINO_SD is not set -# CONFIG_LV_USE_FS_UEFI is not set -# CONFIG_LV_USE_FS_FROGFS is not set -# CONFIG_LV_USE_LODEPNG is not set -# CONFIG_LV_USE_LIBPNG is not set -# CONFIG_LV_USE_BMP is not set -# CONFIG_LV_USE_TJPGD is not set -# CONFIG_LV_USE_LIBJPEG_TURBO is not set -# CONFIG_LV_USE_GIF is not set -# CONFIG_LV_BIN_DECODER_RAM_LOAD is not set -# CONFIG_LV_USE_RLE is not set -# CONFIG_LV_USE_QRCODE is not set -# CONFIG_LV_USE_BARCODE is not set -# CONFIG_LV_USE_FREETYPE is not set -# CONFIG_LV_USE_TINY_TTF is not set -# CONFIG_LV_USE_RLOTTIE is not set -# CONFIG_LV_USE_THORVG is not set -# CONFIG_LV_USE_LZ4 is not set -# CONFIG_LV_USE_FFMPEG is not set -# end of 3rd Party Libraries - -# -# Others -# -# CONFIG_LV_USE_SNAPSHOT is not set -# CONFIG_LV_USE_SYSMON is not set -# CONFIG_LV_USE_PROFILER is not set -# CONFIG_LV_USE_MONKEY is not set -# CONFIG_LV_USE_GRIDNAV is not set -# CONFIG_LV_USE_FRAGMENT is not set -# CONFIG_LV_USE_IMGFONT is not set -CONFIG_LV_USE_OBSERVER=y -# CONFIG_LV_USE_IME_PINYIN is not set -# CONFIG_LV_USE_FILE_EXPLORER is not set -# CONFIG_LV_USE_FONT_MANAGER is not set -# CONFIG_LV_USE_TEST is not set -# CONFIG_LV_USE_TRANSLATION is not set -# CONFIG_LV_USE_XML is not set -# CONFIG_LV_USE_COLOR_FILTER is not set -CONFIG_LVGL_VERSION_MAJOR=9 -CONFIG_LVGL_VERSION_MINOR=4 -CONFIG_LVGL_VERSION_PATCH=0 -# end of Others - -# -# Devices -# -# CONFIG_LV_USE_SDL is not set -# CONFIG_LV_USE_X11 is not set -# CONFIG_LV_USE_WAYLAND is not set -# CONFIG_LV_USE_LINUX_FBDEV is not set -# CONFIG_LV_USE_NUTTX is not set -# CONFIG_LV_USE_LINUX_DRM is not set -# CONFIG_LV_USE_TFT_ESPI is not set -# CONFIG_LV_USE_LOVYAN_GFX is not set -# CONFIG_LV_USE_EVDEV is not set -# CONFIG_LV_USE_LIBINPUT is not set -# CONFIG_LV_USE_ST7735 is not set -# CONFIG_LV_USE_ST7789 is not set -# CONFIG_LV_USE_ST7796 is not set -# CONFIG_LV_USE_ILI9341 is not set -# CONFIG_LV_USE_GENERIC_MIPI is not set -# CONFIG_LV_USE_NXP_ELCDIF is not set -# CONFIG_LV_USE_RENESAS_GLCDC is not set -# CONFIG_LV_USE_ST_LTDC is not set -# CONFIG_LV_USE_FT81X is not set -# CONFIG_LV_USE_UEFI is not set -# CONFIG_LV_USE_OPENGLES is not set -# CONFIG_LV_USE_QNX is not set -# end of Devices - -# -# Examples -# -CONFIG_LV_BUILD_EXAMPLES=y -# end of Examples - -# -# Demos -# -CONFIG_LV_BUILD_DEMOS=y -# CONFIG_LV_USE_DEMO_WIDGETS is not set -# CONFIG_LV_USE_DEMO_KEYPAD_AND_ENCODER is not set -# CONFIG_LV_USE_DEMO_BENCHMARK is not set -# CONFIG_LV_USE_DEMO_RENDER is not set -# CONFIG_LV_USE_DEMO_SCROLL is not set -# CONFIG_LV_USE_DEMO_STRESS is not set -# CONFIG_LV_USE_DEMO_MUSIC is not set -# CONFIG_LV_USE_DEMO_FLEX_LAYOUT is not set -# CONFIG_LV_USE_DEMO_MULTILANG is not set -# CONFIG_LV_USE_DEMO_SMARTWATCH is not set -# CONFIG_LV_USE_DEMO_EBIKE is not set -# CONFIG_LV_USE_DEMO_HIGH_RES is not set -# end of Demos -# end of LVGL configuration -# end of Component config - -# CONFIG_IDF_EXPERIMENTAL_FEATURES is not set diff --git a/tools/build.sh b/tools/build.sh index 3b04d157..5225e2ef 100755 --- a/tools/build.sh +++ b/tools/build.sh @@ -1,5 +1,21 @@ #!/bin/bash +# Copyright (c) 2025 HIGH CODE LLC +# +# TentacleOS is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# TentacleOS is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with TentacleOS. If not, see . + + # Configuration PROJECT_ROOT=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." &> /dev/null && pwd) C5_DIR="$PROJECT_ROOT/firmware_c5" @@ -25,7 +41,7 @@ echo -e "${BLUE}>>> Starting TentacleOS Build${NC}" echo -e "${BLUE}>>> Building ESP32-C5 firmware...${NC}" cd "$C5_DIR" || exit -idf.py reconfigure build +idf.py -DIDF_TARGET=esp32c5 reconfigure build if [ $? -ne 0 ]; then echo -e "${RED}Error: Failed to build C5 firmware.${NC}" @@ -34,7 +50,7 @@ fi echo -e "${BLUE}>>> Building ESP32-P4 firmware (Embedding C5 binary)...${NC}" cd "$P4_DIR" || exit -idf.py reconfigure build +idf.py -DIDF_TARGET=esp32p4 reconfigure build if [ $? -ne 0 ]; then echo -e "${RED}Error: Failed to build P4 firmware.${NC}" diff --git a/tools/build_and_flash.sh b/tools/build_and_flash.sh index 035efc34..4029a200 100755 --- a/tools/build_and_flash.sh +++ b/tools/build_and_flash.sh @@ -1,5 +1,21 @@ #!/bin/bash +# Copyright (c) 2025 HIGH CODE LLC +# +# TentacleOS is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# TentacleOS is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with TentacleOS. If not, see . + + SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd) "$SCRIPT_DIR/build.sh" && "$SCRIPT_DIR/flash.sh" diff --git a/tools/flash.sh b/tools/flash.sh index 16f5bb02..a825e038 100755 --- a/tools/flash.sh +++ b/tools/flash.sh @@ -1,5 +1,21 @@ #!/bin/bash +# Copyright (c) 2025 HIGH CODE LLC +# +# TentacleOS is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# TentacleOS is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with TentacleOS. If not, see . + + PROJECT_ROOT=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." &> /dev/null && pwd) P4_DIR="$PROJECT_ROOT/firmware_p4" diff --git a/tools/format.sh b/tools/format.sh index 883a42ee..30e59788 100755 --- a/tools/format.sh +++ b/tools/format.sh @@ -1,5 +1,21 @@ #!/bin/bash +# Copyright (c) 2025 HIGH CODE LLC +# +# TentacleOS is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# TentacleOS is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with TentacleOS. If not, see . + + REPO_ROOT="$(git rev-parse --show-toplevel)" TARGETS=( @@ -14,24 +30,24 @@ EXCLUDE_DIRS=( "build" ) -EXCLUDE_ARGS="" +EXCLUDE_ARGS=() for dir in "${EXCLUDE_DIRS[@]}"; do - EXCLUDE_ARGS="$EXCLUDE_ARGS -not -path */$dir/*" + EXCLUDE_ARGS+=(-not -path "*/$dir/*") done -EXISTING_TARGETS="" +EXISTING_TARGETS=() for target in "${TARGETS[@]}"; do if [ -d "$target" ]; then - EXISTING_TARGETS="$EXISTING_TARGETS $target" + EXISTING_TARGETS+=("$target") fi done -if [ -z "$EXISTING_TARGETS" ]; then +if [ ${#EXISTING_TARGETS[@]} -eq 0 ]; then echo "No target directories found." exit 0 fi -FILES=$(find $EXISTING_TARGETS \( -name "*.c" -o -name "*.h" \) $EXCLUDE_ARGS) +FILES=$(find "${EXISTING_TARGETS[@]}" \( -name "*.c" -o -name "*.h" \) "${EXCLUDE_ARGS[@]}") if [ -z "$FILES" ]; then echo "No files to format." @@ -44,7 +60,7 @@ if [ "$1" = "--check" ]; then echo "Checking $COUNT files..." echo "$FILES" | xargs clang-format --dry-run --Werror 2>&1 if [ $? -ne 0 ]; then - echo "Formatting errors found. Run ./scripts/format.sh to fix." + echo "Formatting errors found. Run ./tools/format.sh to fix." exit 1 fi echo "All files formatted correctly." diff --git a/tools/png_to_bin/generate_rotated_frames.py b/tools/png_to_bin/generate_rotated_frames.py index 6146f4c8..888ea3a8 100644 --- a/tools/png_to_bin/generate_rotated_frames.py +++ b/tools/png_to_bin/generate_rotated_frames.py @@ -1,3 +1,18 @@ +# Copyright (c) 2025 HIGH CODE LLC +# +# TentacleOS is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# TentacleOS is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with TentacleOS. If not, see . + import os import sys import glob diff --git a/tools/png_to_bin/png_conversor_to_bin.ps1 b/tools/png_to_bin/png_conversor_to_bin.ps1 index 509105bd..9d2f67a9 100644 --- a/tools/png_to_bin/png_conversor_to_bin.ps1 +++ b/tools/png_to_bin/png_conversor_to_bin.ps1 @@ -1,3 +1,18 @@ +# Copyright (c) 2025 HIGH CODE LLC +# +# TentacleOS is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# TentacleOS is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with TentacleOS. If not, see . + # ============================================================================== # LVGL Image Conversion Automation Script (Windows Version) # ============================================================================== diff --git a/tools/png_to_bin/png_conversor_to_bin.sh b/tools/png_to_bin/png_conversor_to_bin.sh index 4fe49a88..9002ff06 100755 --- a/tools/png_to_bin/png_conversor_to_bin.sh +++ b/tools/png_to_bin/png_conversor_to_bin.sh @@ -1,5 +1,21 @@ #!/bin/bash +# Copyright (c) 2025 HIGH CODE LLC +# +# TentacleOS is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# TentacleOS is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with TentacleOS. If not, see . + + # ============================================================================== # LVGL Image Conversion Automation Script (Linux/macOS Version) # ============================================================================== diff --git a/tools/setup.sh b/tools/setup.sh index 0e5b3bd1..c74c5284 100755 --- a/tools/setup.sh +++ b/tools/setup.sh @@ -1,5 +1,21 @@ #!/bin/bash +# Copyright (c) 2025 HIGH CODE LLC +# +# TentacleOS is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# TentacleOS is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with TentacleOS. If not, see . + + # ============================================================================== # TentacleOS Developer Environment Setup # ============================================================================== diff --git a/update_license.py b/update_license.py new file mode 100644 index 00000000..84ea1054 --- /dev/null +++ b/update_license.py @@ -0,0 +1,157 @@ +#!/usr/bin/env python3 +import os + +ROOT = os.path.dirname(os.path.abspath(__file__)) + +SKIP = {"build", "managed_components", "lvgl-env"} + +# --- Replacement pairs (old Apache block → new GPL v3 block) ----------------- + +SLASH_OLD = ( + "// Licensed under the Apache License, Version 2.0 (the \"License\");\n" + "// you may not use this file except in compliance with the License.\n" + "// You may obtain a copy of the License at\n" + "//\n" + "// http://www.apache.org/licenses/LICENSE-2.0\n" + "//\n" + "// Unless required by applicable law or agreed to in writing, software\n" + "// distributed under the License is distributed on an \"AS IS\" BASIS,\n" + "// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n" + "// See the License for the specific language governing permissions and\n" + "// limitations under the License." +) + +SLASH_NEW = ( + "// TentacleOS is free software: you can redistribute it and/or modify\n" + "// it under the terms of the GNU General Public License as published by\n" + "// the Free Software Foundation, either version 3 of the License, or\n" + "// (at your option) any later version.\n" + "//\n" + "// TentacleOS is distributed in the hope that it will be useful,\n" + "// but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "// GNU General Public License for more details.\n" + "//\n" + "// You should have received a copy of the GNU General Public License\n" + "// along with TentacleOS. If not, see ." +) + +HASH_OLD = ( + "# Licensed under the Apache License, Version 2.0 (the \"License\");\n" + "# you may not use this file except in compliance with the License.\n" + "# You may obtain a copy of the License at\n" + "#\n" + "# http://www.apache.org/licenses/LICENSE-2.0\n" + "#\n" + "# Unless required by applicable law or agreed to in writing, software\n" + "# distributed under the License is distributed on an \"AS IS\" BASIS,\n" + "# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n" + "# See the License for the specific language governing permissions and\n" + "# limitations under the License." +) + +HASH_NEW = ( + "# TentacleOS is free software: you can redistribute it and/or modify\n" + "# it under the terms of the GNU General Public License as published by\n" + "# the Free Software Foundation, either version 3 of the License, or\n" + "# (at your option) any later version.\n" + "#\n" + "# TentacleOS is distributed in the hope that it will be useful,\n" + "# but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "# GNU General Public License for more details.\n" + "#\n" + "# You should have received a copy of the GNU General Public License\n" + "# along with TentacleOS. If not, see ." +) + +REPLACEMENTS = [(SLASH_OLD, SLASH_NEW), (HASH_OLD, HASH_NEW)] + +# --- Header to insert in tools/ scripts (no existing copyright) -------------- + +HASH_HEADER = ( + "# Copyright (c) 2025 HIGH CODE LLC\n" + "#\n" + "# TentacleOS is free software: you can redistribute it and/or modify\n" + "# it under the terms of the GNU General Public License as published by\n" + "# the Free Software Foundation, either version 3 of the License, or\n" + "# (at your option) any later version.\n" + "#\n" + "# TentacleOS is distributed in the hope that it will be useful,\n" + "# but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "# GNU General Public License for more details.\n" + "#\n" + "# You should have received a copy of the GNU General Public License\n" + "# along with TentacleOS. If not, see ." +) + +TOOLS_SKIP = {"LVGLImage.py"} # third-party +TOOLS_EXTS = {".sh", ".py", ".ps1"} + +# ----------------------------------------------------------------------------- + +def replace_in_file(fpath): + with open(fpath, "r", encoding="utf-8", errors="ignore") as f: + content = f.read() + if "Copyright (c) 2025 HIGH CODE LLC" not in content: + return False + new_content = content + for old, new in REPLACEMENTS: + new_content = new_content.replace(old, new) + if new_content == content: + return False + with open(fpath, "w", encoding="utf-8") as f: + f.write(new_content) + return True + + +def insert_header_in_file(fpath): + with open(fpath, "r", encoding="utf-8", errors="ignore") as f: + content = f.read() + if "Copyright" in content: + return False + lines = content.splitlines(keepends=True) + if lines and lines[0].startswith("#!"): + new_content = lines[0] + "\n" + HASH_HEADER + "\n\n" + "".join(lines[1:]) + else: + new_content = HASH_HEADER + "\n\n" + content + with open(fpath, "w", encoding="utf-8") as f: + f.write(new_content) + return True + + +updated = 0 +skipped = 0 + +# Pass 1 — replace Apache → GPL v3 in firmware sources +for subdir in ["firmware_c5/main", "firmware_c5/components", "firmware_p4/main", "firmware_p4/components"]: + for dirpath, dirnames, filenames in os.walk(os.path.join(ROOT, subdir)): + dirnames[:] = [d for d in dirnames if d not in SKIP] + for fname in filenames: + ext = os.path.splitext(fname)[1] + if ext not in {".c", ".h"} and fname != "CMakeLists.txt": + continue + fpath = os.path.join(dirpath, fname) + if replace_in_file(fpath): + print(f" replaced: {os.path.relpath(fpath, ROOT)}") + updated += 1 + else: + skipped += 1 + +# Pass 2 — insert GPL v3 header in tools/ scripts +for dirpath, dirnames, filenames in os.walk(os.path.join(ROOT, "tools")): + dirnames[:] = [d for d in dirnames if d not in SKIP] + for fname in filenames: + if fname in TOOLS_SKIP: + continue + if os.path.splitext(fname)[1] not in TOOLS_EXTS: + continue + fpath = os.path.join(dirpath, fname) + if insert_header_in_file(fpath): + print(f" inserted: {os.path.relpath(fpath, ROOT)}") + updated += 1 + else: + skipped += 1 + +print(f"\n{updated} files updated, {skipped} skipped.")