diff --git a/.github/ISSUE_TEMPLATE/Bug_report.md b/.github/ISSUE_TEMPLATE/Bug_report.md index ad522ec4e..a0ab5e7e3 100644 --- a/.github/ISSUE_TEMPLATE/Bug_report.md +++ b/.github/ISSUE_TEMPLATE/Bug_report.md @@ -4,39 +4,61 @@ about: Create a report to help us improve --- -**IMPORTANT NOTICE** -If you do not complete the template below it is likely that your issue will not be addressed. When providing information about your issue please be as extensive as possible so that it can be solved by as little as possible responses. + -**FAILURE TO COMPLETE THE REQUESTED INFORMATION WILL RESULT IN YOUR ISSUE BEING CLOSED** + + + + + + + + -**Describe the bug** +### BUG DESCRIPTION _A clear and concise description of what the bug is._ -_Also, make sure these boxes are checked [x] before submitting your issue - Thank you!_ -- [ ] _Searched the problem in issues and in the wiki_ -- [ ] _Hardware used_ : -- [ ] _Development/Compiler/Upload tools used_ : -- [ ] _If a pre-compiled release or development binary was used, which one?_ : -- [ ] _You have tried latest release or development binaries?_ : -- [ ] _Provide the output of command_``status 0`` : +### REQUESTED INFORMATION +_Make sure these boxes are checked before submitting your issue. Thank you_ + +**FAILURE TO COMPLETE THE REQUESTED INFORMATION WILL RESULT IN YOUR ISSUE BEING CLOSED** + +- [ ] Read the [Contributing Guide and Policy](https://github.com/arendst/Sonoff-Tasmota/blob/development/CONTRIBUTING.md) and [the Code of Conduct](https://github.com/arendst/Sonoff-Tasmota/blob/development/CODE_OF_CONDUCT.md) +- [ ] Searched the problem in issues (https://github.com/arendst/Sonoff-Tasmota/issues) +- [ ] Searched the problem in the wiki (https://github.com/arendst/Sonoff-Tasmota/wiki/Troubleshooting) +- [ ] Searched the problem in the forum (https://groups.google.com/d/forum/sonoffusers) +- [ ] Searched the problem in the chat (https://discord.gg/Ks2Kzd4) +- [ ] Device used (i.e. Sonoff Basic) : _____ +- [ ] Tasmota binary firmware version number used : ____ / (pre-compiled or self-compiled ?) +- [ ] Development IDE - Compiler / Upload tools used : ____ / ____ +- [ ] Provide the output of command ``status 0`` : ``` -STATUS 0 OUTPUT HERE - DO NOT DELETE THE MARKERS ABOVE AND BELOW THIS LINE +STATUS 0 OUTPUT HERE: + + +``` +- [ ] Provide the output of console when you experience your issue if apply : +_(Please use_ ``weblog 4`` _for more debug information)_ +``` +CONSOLE OUTPUT HERE: + + ``` -**To Reproduce** +### TO REPRODUCE _Steps to reproduce the behavior:_ -**Expected behavior** +### EXPECTED BEHAVIOUR _A clear and concise description of what you expected to happen._ -**Screenshots** +### SCREENSHOTS _If applicable, add screenshots to help explain your problem._ -**Additional context** +### ADDITIONAL CONTEXT _Add any other context about the problem here._ diff --git a/.github/ISSUE_TEMPLATE/Custom.md b/.github/ISSUE_TEMPLATE/Custom.md index 4d1eba459..44bd847cb 100644 --- a/.github/ISSUE_TEMPLATE/Custom.md +++ b/.github/ISSUE_TEMPLATE/Custom.md @@ -4,24 +4,47 @@ about: Users Troubleshooting Help --- -**IMPORTANT NOTICE** -If you do not complete the template below it is likely that your issue will not be addressed. When providing information about your issue please be as extensive as possible so that it can be solved by as little as possible responses. + + + + + + + + + + + + + +### ISSUE DESCRIPTION - TROUBLESHOOTING +_A clear description of what the issue is and be as extensive as possible_ + + +### REQUESTED INFORMATION +_Make sure these boxes are checked before submitting your issue. Thank you_ **FAILURE TO COMPLETE THE REQUESTED INFORMATION WILL RESULT IN YOUR ISSUE BEING CLOSED** -Make sure these boxes are checked [x] before submitting your issue - Thank you! - +- [ ] Read the [Contributing Guide and Policy](https://github.com/arendst/Sonoff-Tasmota/blob/development/CONTRIBUTING.md) and [the Code of Conduct](https://github.com/arendst/Sonoff-Tasmota/blob/development/CODE_OF_CONDUCT.md) - [ ] Searched the problem in issues (https://github.com/arendst/Sonoff-Tasmota/issues) - [ ] Searched the problem in the wiki (https://github.com/arendst/Sonoff-Tasmota/wiki/Troubleshooting) - [ ] Searched the problem in the forum (https://groups.google.com/d/forum/sonoffusers) - [ ] Searched the problem in the chat (https://discord.gg/Ks2Kzd4) -- [ ] Development/Compiler/Upload tools used : -- [ ] Hardware used : -- [ ] If a pre-compiled release or development binary was used, which one? : -- [ ] You have tried latest release or development binaries? : +- [ ] Device used (i.e. Sonoff Basic) : _____ +- [ ] Tasmota binary firmware version number used : ____ / (pre-compiled or self-compiled ?) +- [ ] Development IDE - Compiler / Upload tools used : ____ / ____ - [ ] Provide the output of command ``status 0`` : ``` -STATUS 0 OUTPUT HERE -``` +STATUS 0 OUTPUT HERE: + +``` +- [ ] Provide the output of console when you experience your issue if apply : +_(Please use_ ``weblog 4`` _for more debug information)_ +``` +CONSOLE OUTPUT HERE: + + +``` **(Please, remember to close the issue when the problem has been addressed)** diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 000000000..a4a459a18 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,11 @@ +## Description: + +**Related issue (if applicable):** fixes # + +## Checklist: + - [ ] The pull request is done against the latest dev branch + - [ ] Only relevant files were touched (Also remember to update _changelog.ino_ file) + - [ ] Only one feature/fix was added per PR. + - [ ] The code change is tested and works. + - [ ] The code change pass travis tests. **Your PR cannot be merged unless tests pass** + - [ ] I accept the [CLA](https://github.com/arendst/Sonoff-Tasmota/blob/development/CONTRIBUTING.md#contributor-license-agreement-cla). diff --git a/.github/stale.yml b/.github/stale.yml index 88c5f7c21..484010321 100644 --- a/.github/stale.yml +++ b/.github/stale.yml @@ -1,9 +1,9 @@ # Number of days of inactivity before an Issue or Pull Request becomes stale -daysUntilStale: 45 +daysUntilStale: 25 # Number of days of inactivity before a stale Issue or Pull Request is closed. # Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale. -daysUntilClose: 15 +daysUntilClose: 5 # Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable exemptLabels: @@ -37,4 +37,4 @@ closeComment: > limitPerRun: 30 # Limit to only `issues` or `pulls` -only: issues +#only: issues diff --git a/API.md b/API.md index 23e45369d..caec908c6 100644 --- a/API.md +++ b/API.md @@ -23,6 +23,8 @@ FUNC_JSON_APPEND | | | | x | | Extend tele FUNC_WEB_APPEND | | | | x | | Extend webgui ajax info FUNC_SAVE_BEFORE_RESTART | | | | x | | Just before a planned restart FUNC_COMMAND | x | | x | x | | When a command is not recognized +FUNC_COMMAND_DRIVER | x | 6.4.1.21 | x | | | When command Driver\ is executed +FUNC_COMMAND_SENSOR | x | 6.4.1.21 | | x | | When command Sensor\ is executed FUNC_MQTT_SUBSCRIBE | | 5.12.0k | x | | | At end of MQTT subscriptions FUNC_MQTT_INIT | | 5.12.0k | x | | | Once at end of MQTT connection FUNC_MQTT_DATA | x | 5.12.0k | x | | | Before decoding command diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 000000000..1408ce048 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,76 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, sex characteristics, gender identity and expression, +level of experience, education, socio-economic status, nationality, personal +appearance, race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or + advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at https://sidweb.nl/cms3/en/contact. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see +https://www.contributor-covenant.org/faq diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 000000000..3ecb5a9bc --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,113 @@ +# Contributing to Sonoff-Tasmota + +**Any contribution helps our team and makes Tasmota better for the entire community!** + +Everybody is welcome and invited to contribute to Sonoff-Tasmota Project by: + +* Testing newly released features and reporting issues. +* Providing Pull Requests (Features, Proof of Concepts, Language files or Fixes) +* Contributing missing documentation for features and devices on our [Wiki](https://github.com/arendst/Sonoff-Tasmota/wiki/Contributing) + +This document describes rules that are in effect for this repository, meant for handling issues by contributors in the issue tracker and PRs. + +## Opening New Issues + +**Issue tracker is NOT a general discussion forum!** +1. Opening an issue means that a problem exists in the code and should be addressed by the project contributors. +2. When opening an issue, it is required to fill out the presented template. The requested information is important! If the template is ignored or insufficient info about the issue is provided, the issue may be closed. +3. Questions of type "How do I..." or "Can you please help me with..." or "Can Tasmota do..." WILL NOT be handled here. Such questions should be directed at a discussion forum or to the Tasmota Support Chat. All issues of this type will be closed with a simple reference to this contributing policy. +4. Issues about topics already handled in the documentation will be closed in a similar manner. +5. Issues for unmerged PRs will be closed. If there is an issue with a PR, the explanation should be added to the PR itself. +6. Issues with accompanied investigation that shows the root of the problem should be given priority. +7. Duplicate issues will be closed. + +## Triaging of Issues/PR's + +1. Any contributor to the project can participate in the triaging process, if he/she chooses to do so. +2. An issue that needs to be closed, either due to not complying with this policy, or for other reasons, should be closed by a contributor. +3. Issues that are accepted should be marked with appropriate labels. +4. Issues that could impact functionality for many users should be considered severe. +5. Issues caused by the SDK or chip should not be marked severe, as there usually isn’t much to be done. Common sense should be applied when deciding. Such issues should be documented in the Wiki, for reference by users. +6. Issues with feature requests should be discussed for viability/desirability. +7. Feature requests or changes that are meant to address a very specific/limited use case, especially if at the expense of increased code complexity, may be denied, or may be required to be redesigned, generalized, or simplified. +8. Feature requests that are not accompanied by a PR: + * could be closed immediately (denied). + * could be closed after some predetermined period of time (left as candidate for somebody to pick up). +9. In some cases, feedback may be requested from the issue reporter, either as additional info for clarification, additional testing, or other. If no feedback is provided, the issue may be closed by a contributor or after 30 days by the STALE bot. + +## Pull requests + +A Pull Request (PR) is the process where code modifications are managed in GitHub. + +The process is straight-forward. + + - Read [How to get faster PR reviews](https://github.com/kubernetes/community/blob/master/contributors/guide/pull-requests.md#best-practices-for-faster-reviews) by Kubernetes (but skip step 0) + - Fork the Sonoff-Tasmota Repository [git repository](https://github.com/arendst/Sonoff-Tasmota). + - Write/Change the code in your Fork for a new feature, bug fix, new sensor, optimization, etc. + - Ensure tests work. + - Create a Pull Request against the [**dev**](https://github.com/arendst/Sonoff-Tasmota/tree/dev) branch of Sonoff-Tasmota. + +1. All pull requests must be done against the dev branch. +2. Only relevant files should be touched (Also beware if your editor has auto-formatting feature enabled). +3. Only one feature/fix should be added per PR. +4. If adding a new functionality (new hardware, new library support) not related to an existing component move it to it's own modules (.ino file). +5. PRs that don't compile (break Travis) or cause coding errors will not be merged. Please fix the issue. Same goes for PRs that are raised against older commit in dev - you might need to rebase and resolve conflicts. +6. All pull requests should undergo peer review by at least one contributor other than the creator, excepts for the owner. +7. All pull requests should consider updates to the documentation. +8. Pull requests that address an outstanding issue, particularly an issue deemed to be severe, should be given priority. +9. If a PR is accepted, then it should undergo review and updated based on the feedback provided, then merged. +10. By submitting a PR, it is needed to use the provided PR template and check all boxes, performing the required tasks and accepting the CLA. +11. Pull requests that don't meet the above will be denied and closed. + +-------------------------------------- + +## Contributor License Agreement (CLA) + +``` +By making a contribution to this project, I certify that: + +(a) The contribution was created in whole or in part by me and I + have the right to submit it under the GPL-3.0 license; or + +(b) The contribution is based upon previous work that, to the best + of my knowledge, is covered under an appropriate open source + license and I have the right under that license to submit that + work with modifications, whether created in whole or in part + by me, under the GPL-3.0 license; or + +(c) The contribution was provided directly to me by some other + person who certified (a), (b) or (c) and I have not modified + it. + +(d) I understand and agree that this project and the contribution + are public and that a record of the contribution (including all + personal information I submit with it) is maintained indefinitely + and may be redistributed consistent with this project or the open + source license(s) involved. +``` + +This Contributor License Agreement (CLA) was adopted on April 1st, 2019. + +The text of this license is available under the [Creative Commons Attribution-ShareAlike 3.0 Unported License](http://creativecommons.org/licenses/by-sa/3.0/). It is based on the Linux [Developer Certificate Of Origin](http://elinux.org/Developer_Certificate_Of_Origin), but is modified to explicitly use the GPL-3.0 license and not mention sign-off (due to GitHub.com keeps an historial, with your user name, of PRs' commits and all editions on PR's comments). + +To accept the CLA it is required to put a x between [ ] on `[ ] I accept the CLA` in the PR template when submitting it. The [ ] is an opt-in box, so you have to manually accept it. + +**Why a CLA ?** + +_"A Contributor Licence Agreement (CLA) is strongly recommended when accepting third party contributions to an open development project, such as an open source software project. In order to redistribute contributions, it is necessary to ensure that the project has the necessary rights to do so. A Contributor Licence Agreement is a lightweight agreement, signed by the copyright holder, that grants the necessary rights for the contribution to be redistributed as part of the project."_ [OSS Watch](http://oss-watch.ac.uk/resources/cla) + +A CLA is a legal document in which you state _you are entitled to contribute the code/documentation/translation to the project_ you’re contributing to and that _you are willing to have it used in distributions and derivative works_. This means that should there be any kind of legal issue in the future as to the origins and ownership of any particular piece of code, then that project has the necessary forms on file from the contributor(s) saying they were permitted to make this contribution. + +CLA is a safety because it also ensures that once you have provided a contribution, you cannot try to withdraw permission for its use at a later date. People can therefore use that software, confident that they will not be asked to stop using pieces of the code at a later date. + +A __license__ grants "outbound" rights to the user of project. + +A __CLA__ enables a contributor to grant "inbound" rights to a project. + + + + + + + + diff --git a/README.md b/README.md index 0184e7cc5..586520fc6 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ## Sonoff-Tasmota -Alternative firmware for _ESP8266 based devices_ like [iTead](https://www.itead.cc/) _**Sonoff**_ with **web**, **timers**, 'Over The Air' (**OTA**) firmware updates and **sensors support**, allowing control under **Serial**, **HTTP**, **MQTT** and **KNX**, so as to be used on **Smart Home Systems**. Written for Arduino IDE and PlatformIO. +Alternative firmware for _ESP8266 based devices_ like [iTead](https://www.itead.cc/) _**Sonoff**_ with **web UI, rules and timers, OTA updates, custom device templates and sensor support**. Allows control over **MQTT**, **HTTP**, **Serial** and **KNX** for integrations with smart home systems. Written for Arduino IDE and PlatformIO. [![GitHub version](https://img.shields.io/github/release/arendst/Sonoff-Tasmota.svg)](https://github.com/arendst/Sonoff-Tasmota/releases/latest) [![GitHub download](https://img.shields.io/github/downloads/arendst/Sonoff-Tasmota/total.svg)](https://github.com/arendst/Sonoff-Tasmota/releases/latest) @@ -15,10 +15,10 @@ If you like **Sonoff-Tasmota**, give it a star, or fork it and contribute! See [RELEASENOTES.md](https://github.com/arendst/Sonoff-Tasmota/blob/development/RELEASENOTES.md) for release information. -In addition to the [release webpage](https://github.com/arendst/Sonoff-Tasmota/releases/latest) the binaries can also be OTA downloaded from http://thehackbox.org/tasmota/release/ +In addition to the [release webpage](https://github.com/arendst/Sonoff-Tasmota/releases/latest), the binaries can also be OTA downloaded from http://thehackbox.org/tasmota/release/ ### Development -[![Dev Version](https://img.shields.io/badge/development%20version-6.4.1.x-blue.svg)](https://github.com/arendst/Sonoff-Tasmota) +[![Dev Version](https://img.shields.io/badge/development%20version-6.5.0.x-blue.svg)](https://github.com/arendst/Sonoff-Tasmota) [![Download Dev](https://img.shields.io/badge/download-development-yellow.svg)](http://thehackbox.org/tasmota/) [![Build Status](https://img.shields.io/travis/arendst/Sonoff-Tasmota.svg)](https://travis-ci.org/arendst/Sonoff-Tasmota) @@ -29,12 +29,12 @@ The development codebase is checked hourly for changes and if new commits have b ### Disclaimer :warning: **DANGER OF ELECTROCUTION** :warning: -A Sonoff device is not a toy. It uses Mains AC so there is a danger of electrocution if not installed properly. If you don't know how to install it, please call an electrician. Remember: _**SAFETY FIRST**_. It is not worth to risk yourself, your family and your home if you don't know exactly what you are doing. Never try to flash a Sonoff device while it is connected to MAINS AC. +A Sonoff device is not a toy. It uses Mains AC so there is a danger of electrocution if not installed properly. If you don't know how to install it, please call an electrician. Remember: _**SAFETY FIRST**_. It is not worth risk to yourself, your family, and your home if you don't know exactly what you are doing. Never try to flash a Sonoff device while it is connected to MAINS AC. We don't take any responsibility nor liability for using this software nor for the installation or any tips, advice, videos, etc. given by any member of this site or any related site. ### Note -Please do not ask to add devices where you can't provide a basic working configuration (other than sonoff). Since there are thousands of them.. +Please do not ask to add devices where you can't provide a basic working configuration (other than sonoff). Since there are thousands of them. ### Quick Install Download one of the released binaries from https://github.com/arendst/Sonoff-Tasmota/releases and flash it to your hardware as documented in the wiki. @@ -64,7 +64,7 @@ See [wiki migration path](https://github.com/arendst/Sonoff-Tasmota/wiki/Upgrade See [Wiki](https://github.com/arendst/Sonoff-Tasmota/wiki) for more information.
See [Community](https://groups.google.com/d/forum/sonoffusers) for forum.
-See [Chat](https://discord.gg/Ks2Kzd4) for more user experience. +Visit [Discord Chat](https://discord.gg/Ks2Kzd4) for discussions and troubleshooting. The following devices are supported: - [iTead Sonoff Basic (R2)](https://www.itead.cc/smart-home/sonoff-wifi-wireless-switch-1.html) @@ -113,6 +113,7 @@ You can contribute to Sonoff-Tasmota by - providing Pull Requests (Features, Proof of Concepts, Language files or Fixes) - testing new released features and report issues - donating to acquire hardware for testing and implementing or out of gratitude +- contributing missing documentation for features and devices on our [Wiki](https://github.com/arendst/Sonoff-Tasmota/wiki) [![donate](https://img.shields.io/badge/donate-PayPal-blue.svg)](https://paypal.me/tasmota) @@ -128,14 +129,15 @@ Libraries used with Sonoff-Tasmota are: - [Adafruit SSD1306](https://github.com/adafruit/Adafruit_SSD1306) - [Adafruit GFX](https://github.com/adafruit/Adafruit-GFX-Library) - [ArduinoJson](https://arduinojson.org/) -- [arduino mqtt](https://github.com/256dpi/arduino-mqtt) - [Bosch BME680](https://github.com/BoschSensortec/BME680_driver) - [C2 Programmer](http://app.cear.ufpb.br/~lucas.hartmann/tag/efm8bb1/) - [esp-epaper-29-ws-20171230-gemu](https://github.com/gemu2015/Sonoff-Tasmota/tree/displays/lib) - [esp-knx-ip](https://github.com/envy/esp-knx-ip) +- FrogmoreScd30 - [I2Cdevlib](https://github.com/jrowberg/i2cdevlib) - [IRremoteEsp8266](https://github.com/markszabo/IRremoteESP8266) - [JobaTsl2561](https://github.com/joba-1/Joba_Tsl2561) +- [LinkedList](https://github.com/ivanseidel/LinkedList) - [Liquid Cristal](https://github.com/marcoschwartz/LiquidCrystal_I2C) - [MultiChannelGasSensor](http://wiki.seeedstudio.com/Grove-Multichannel_Gas_Sensor/) - [NeoPixelBus](https://github.com/Makuna/NeoPixelBus) @@ -169,7 +171,8 @@ People helping to keep the show on the road: - Andre Thomas for providing [thehackbox](http://thehackbox.org/tasmota/) OTA support and daily development builds - Joel Stein and digiblur for their Tuya research and driver - Frogmore42 and Jason2866 for providing many issue answers -- Many more providing Tips, Pocs or PRs +- Blakadder for editing the wiki and providing template management +- Many more providing Tips, Wips, Pocs or PRs ### License diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 1198a6165..c3e3afd4b 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -7,16 +7,14 @@ See [wiki migration path](https://github.com/arendst/Sonoff-Tasmota/wiki/Upgrade 4. Migrate to **Sonoff-Tasmota 6.x** ## Release notes +### Core version 2.3.0 vs 2.4.2 +This release is based on ESP8266/Arduino library core 2.3.0 (again) as some people encountered wifi related issues on core 2.4.2. For others core 2.4.2 is working just fine. Both version are available from http://thehackbox.org/tasmota/release/ + ### Change in default initial configuration tool Firmware binary **sonoff-classic.bin** supports **WifiManager, Wps and SmartConfig** for initial configuration. The default tool is **Wps**. To save memory space all other binaries support **WifiManager only**. -See _changelog.ino how to enable them again. -- Define WIFI_CONFIG_TOOL now contains the default behaviour once a SSID has been configured. -- If no SSID is configured making a wifi connection impossible the new define WIFI_CONFIG_NO_SSID will be used. -- While define WIFI_CONFIG_NO_SSID is set to WIFI_WPSCONFIG in my_user_config.h the compiler will check for define USE_WPS and if not enabled WIFI_CONFIG_NO_SSID will default to WIFI_MANAGER using the webserver. If define USE_WEBSERVER is also not enabled WIFI_CONFIG_NO_SSID will default to WIFI_SMARTCONFIG. If define USE_SMARTCONFIG is also not enabled WIFI_CONFIG_NO_SSID will default to a new option WIFI_SERIAL allowing to enter wifi parameters to serial which is always possible. - ## Supported Modules The following hardware modules are supported. @@ -82,180 +80,204 @@ Module | Description 58 PS-16-DZ | PS-16-DZ Wifi dimmer for Incandescent Lights and Led 59 Teckin US | Teckin US and ZooZee SA102 Wifi Smart Switch with Energy Monitoring 60 Manzoku strip | Manzoku Wifi Smart Power Strip with four Relays +61 OBI Socket 2 | OBI 2 Wifi Smart Socket +62 YTF IR Bridge | YTF Infra Red Wifi Bridge +63 Digoo DG-SP202 | Digoo DG-SP202 Dual Wifi Smart Switch with Energy Monitoring +64 KA10 | Smanergy KA10 Wifi Smart Wall Switch with Energy Monitoring +65 Luminea ZX2820 | Luminea ZX2820 Wifi Smart Switch with Energy Monitoring +66 Mi Desk Lamp | Mi Desk Lamp with rotary switch and Wifi +67 SP10 | Tuya SP10 Wifi Smart Switch with Energy Monitoring +68 WAGA CHCZ02MB | WAGA life CHCZ02MB Wifi Smart Switch with Energy Monitoring +69 SYF05 | Sunyesmart SYF05 RGBWW Wifi Led Bulb ## Provided Binary Downloads -The following binary downloads have been compiled with ESP8266/Arduino library core version **2.4.2** patched with the Alexa fix. +The following binary downloads have been compiled with ESP8266/Arduino library core version **2.3.0**. -- **sonoff-minimal.bin** = The Minimal version allows intermediate OTA uploads to support larger versions and does NOT change any persistent parameter. This version **should NOT be used for initial installation**. -- **sonoff-classic.bin** = The Classic version allows **initial installation** using either WifiManager, Wps or SmartConfig. -- **sonoff.bin** = The Sonoff version without Wps and SmartConfig configuration but adds more sensors. +- **sonoff.bin** = The Sonoff version without Wps and SmartConfig configuration but adds more sensors. **RECOMMENDED RELEASE BINARY** +- **sonoff-basic.bin** = The Basic version without Wps and SmartConfig configuration and most sensors. +- **sonoff-classic.bin** = The Classic version allows initial installation using either WifiManager, Wps or SmartConfig. - **sonoff-BG.bin** to **sonoff-TW.bin** = The Sonoff version without Wps and SmartConfig configuration in different languages. -- **sonoff-sensors.bin** = The Sensors version without Wps and SmartConfig configuration but adds even more useful sensors. -- **sonoff-display.bin** = The Display version without Wps and SmartConfig configuration but adds display support. - **sonoff-knx.bin** = The Knx version without Wps and SmartConfig configuration and some other features but adds KNX support. +- **sonoff-sensors.bin** = The Sensors version without Wps and SmartConfig configuration but adds even more useful sensors. +- **sonoff-display.bin** = The Display version without Wps and SmartConfig configuration and Energy Monitoring but adds display support. +- **sonoff-minimal.bin** = The Minimal version allows intermediate OTA uploads to support larger versions and does NOT change any persistent parameter. This version **should NOT be used for initial installation**. + +Core version **2.4.2** binaries can be found at http://thehackbox.org/tasmota/release/020402/ ### Available Features and Sensors -| Feature or Sensor | minimal | basic | classic | sonoff | knx | sensors | Remarks -|--------------------------------|---------|-------|---------|--------|------|---------|-------- -| ESP/Arduino lib v2.3.0 | 346k | 429k | 482k | 504k | 522k | 535k | -| ESP/Arduino lib v2.4.2 | 366k | 446k | 496k | 522k | 538k | 551k | No wifi sleep -| | | | | | | | -| MY_LANGUAGE en-GB | x | x | x | x | x | x | -| MQTT_LIBRARY_TYPE PUBSUBCLIENT | x | x | x | x | x | x | -| USE_WPS | - | - | x | - | - | - | WPS -| USE_SMARTCONFIG | - | - | x | - | - | - | SmartConfig -| USE_ARDUINO_OTA | - | - | - | - | - | - | -| USE_DOMOTICZ | - | - | x | x | x | x | -| USE_HOME_ASSISTANT | - | - | - | x | x | x | -| USE_MQTT_TLS | - | - | - | - | - | - | -| USE_KNX | - | - | - | - | x | - | -| USE_WEBSERVER | x | x | x | x | x | x | WifiManager -| USE_EMULATION | - | x | x | x | - | x | -| USE_DISCOVERY | - | - | x | x | x | x | -| WEBSERVER_ADVERTISE | - | - | x | x | x | x | -| MQTT_HOST_DISCOVERY | - | - | x | x | x | x | -| USE_TIMERS | - | x | - | x | x | x | -| USE_TIMERS_WEB | - | x | - | x | x | x | -| USE_SUNRISE | - | x | - | x | x | x | -| USE_RULES | - | x | - | x | x | x | -| | | | | | | -| USE_ADC_VCC | x | x | x | x | x | - | -| USE_DS18B20 | - | - | - | - | - | - | Single sensor -| USE_DS18x20 | - | - | x | x | x | x | Multiple sensors -| USE_DS18x20_LEGACY | - | - | - | - | - | - | Multiple sensors -| | | | | | | | -| Feature or Sensor | minimal | basic | classic | sonoff | knx | sensors | -| USE_I2C | - | - | - | x | x | x | -| USE_SHT | - | - | - | x | x | x | -| USE_HTU | - | - | - | x | x | x | -| USE_BMP | - | - | - | x | x | x | -| USE_BME680 | - | - | - | - | - | x | -| USE_BH1750 | - | - | - | x | x | x | -| USE_VEML6070 | - | - | - | - | - | x | -| USE_ADS1115 | - | - | - | - | - | x | -| USE_ADS1115_I2CDEV | - | - | - | - | - | - | -| USE_INA219 | - | - | - | - | - | x | -| USE_SHT3X | - | - | - | x | x | x | -| USE_TSL2561 | - | - | - | - | - | x | -| USE_MGS | - | - | - | - | - | x | -| USE_SGP30 | - | - | - | x | x | x | -| USE_SI1145 | - | - | - | - | - | x | -| USE_LM75AD | - | - | - | x | x | x | -| USE_APDS9960 | - | - | - | - | - | - | -| USE_MCP230xx | - | - | - | - | - | - | -| USE_PCA9685 | - | - | - | - | - | - | -| USE_MPR121 | - | - | - | - | - | - | -| USE_CCS811 | - | - | - | - | - | - | -| USE_MPU6050 | - | - | - | - | - | - | -| USE_DS3231 | - | - | - | - | - | - | -| USE_MGC3130 | - | - | - | - | - | - | -| | | | | | | | -| Feature or Sensor | minimal | basic | classic | sonoff | knx | sensors | -| USE_SPI | - | - | - | - | - | - | -| USE_MHZ19 | - | - | - | x | x | x | -| USE_SENSEAIR | - | - | - | x | x | x | -| USE_PMS5003 | - | - | - | x | x | x | -| USE_NOVA_SDS | - | - | - | x | x | x | -| USE_PZEM004T | - | - | - | x | x | x | -| USE_PZEM_AC | - | - | - | x | x | x | -| USE_PZEM_DC | - | - | - | x | x | x | -| USE_MCP39F501 | - | x | - | x | x | x | -| USE_SERIAL_BRIDGE | - | - | - | x | x | x | -| USE_SDM120 | - | - | - | - | - | x | -| USE_SDM630 | - | - | - | - | - | x | -| USE_MP3_PLAYER | - | - | - | - | - | x | -| USE_TUYA_DIMMER | - | x | - | x | x | x | -| USE_ARMTRONIX_DIMMERS | - | x | - | x | x | x | -| USE_PS_16_DZ | - | x | - | x | x | x | -| USE_AZ7798 | - | - | - | - | - | - | -| USE_IR_REMOTE | - | - | - | x | x | x | -| USE_IR_HVAC | - | - | - | - | - | x | -| USE_IR_RECEIVE | - | - | - | x | x | x | -| USE_WS2812 | - | - | x | x | x | x | -| USE_WS2812_DMA | - | - | - | - | - | - | -| USE_ARILUX_RF | - | - | - | x | x | x | -| USE_SR04 | - | - | - | x | x | x | -| USE_TM1638 | - | - | - | - | - | x | -| USE_HX711 | - | - | - | x | x | x | -| USE_RF_FLASH | - | - | - | x | x | x | -| USE_TX20_WIND_SENSOR | - | - | - | x | x | x | -| USE_RC_SWITCH | - | - | - | x | x | x | -| USE_RF_SENSOR | - | - | - | - | - | x | AlectoV2 only -| USE_DISPLAY | - | - | - | - | - | - | +| Feature or Sensor | minimal | basic | classic | sonoff | knx | sensors | display | Remarks +|-----------------------|---------|-------|---------|--------|------|---------|---------|-------- +| MY_LANGUAGE en-GB | x | x | x | x | x | x | x | +| USE_WPS | - | - | x | - | - | - | - | WPS +| USE_SMARTCONFIG | - | - | x | - | - | - | - | SmartConfig +| USE_ARDUINO_OTA | - | - | - | - | - | - | - | +| USE_DOMOTICZ | - | - | x | x | x | x | - | +| USE_HOME_ASSISTANT | - | - | - | x | x | x | - | +| USE_MQTT_TLS | - | - | - | - | - | - | - | +| USE_KNX | - | - | - | - | x | - | - | +| USE_WEBSERVER | x | x | x | x | x | x | x | WifiManager +| USE_EMULATION | - | x | x | x | - | x | - | +| USE_DISCOVERY | - | - | x | x | x | x | x | +| WEBSERVER_ADVERTISE | - | - | x | x | x | x | x | +| MQTT_HOST_DISCOVERY | - | - | x | x | x | x | x | +| USE_TIMERS | - | x | - | x | x | x | x | +| USE_TIMERS_WEB | - | x | - | x | x | x | x | +| USE_SUNRISE | - | x | - | x | x | x | x | +| USE_RULES | - | x | - | x | x | x | x | +| USE_EXPRESSION | - | - | - | - | - | - | - | +| | | | | | | | | +| USE_ADC_VCC | x | x | x | x | x | - | x | +| USE_DS18B20 | - | - | - | - | - | - | - | Single sensor +| USE_DS18x20 | - | - | x | x | x | x | x | Multiple sensors +| USE_DS18x20_LEGACY | - | - | - | - | - | - | - | Multiple sensors +| | | | | | | | | +| Feature or Sensor | minimal | basic | classic | sonoff | knx | sensors | display | Remarks +| USE_I2C | - | - | - | x | x | x | x | +| USE_SHT | - | - | - | x | x | x | x | +| USE_HTU | - | - | - | x | x | x | x | +| USE_BMP | - | - | - | x | x | x | x | +| USE_BME680 | - | - | - | - | - | x | - | +| USE_BH1750 | - | - | - | x | x | x | x | +| USE_VEML6070 | - | - | - | - | - | x | - | +| USE_ADS1115 | - | - | - | - | - | x | - | +| USE_ADS1115_I2CDEV | - | - | - | - | - | - | - | +| USE_INA219 | - | - | - | - | - | x | - | +| USE_SHT3X | - | - | - | x | x | x | x | +| USE_TSL2561 | - | - | - | - | - | x | - | +| USE_MGS | - | - | - | - | - | x | - | +| USE_SGP30 | - | - | - | x | x | x | x | +| USE_SI1145 | - | - | - | - | - | - | - | +| USE_LM75AD | - | - | - | x | x | x | x | +| USE_APDS9960 | - | - | - | - | - | - | - | +| USE_MCP230xx | - | - | - | - | - | - | - | +| USE_PCA9685 | - | - | - | - | - | - | - | +| USE_MPR121 | - | - | - | - | - | - | - | +| USE_CCS811 | - | - | - | - | - | - | - | +| USE_MPU6050 | - | - | - | - | - | - | - | +| USE_DS3231 | - | - | - | - | - | - | - | +| USE_MGC3130 | - | - | - | - | - | - | - | +| USE_MAX44009 | - | - | - | - | - | - | - | +| USE_SCD30 | - | - | - | - | - | x | - | +| | | | | | | | | +| Feature or Sensor | minimal | basic | classic | sonoff | knx | sensors | display | Remarks +| USE_SPI | - | - | - | - | - | - | x | +| USE_MHZ19 | - | - | - | x | x | x | x | +| USE_SENSEAIR | - | - | - | x | x | x | x | +| USE_PMS5003 | - | - | - | x | x | x | x | +| USE_NOVA_SDS | - | - | - | x | x | x | x | +| USE_ENERGY_SENSOR | - | x | x | x | x | x | - | +| USE_PZEM004T | - | - | - | x | x | x | - | +| USE_PZEM_AC | - | - | - | x | x | x | - | +| USE_PZEM_DC | - | - | - | x | x | x | - | +| USE_MCP39F501 | - | x | - | x | x | x | - | +| USE_SERIAL_BRIDGE | - | - | - | x | x | x | x | +| USE_SDM120 | - | - | - | - | - | x | - | +| USE_SDM630 | - | - | - | - | - | x | - | +| USE_MP3_PLAYER | - | - | - | - | - | x | - | +| USE_TUYA_DIMMER | - | x | - | x | x | x | x | +| USE_ARMTRONIX_DIMMERS | - | x | - | x | x | x | x | +| USE_PS_16_DZ | - | x | - | x | x | x | x | +| USE_AZ7798 | - | - | - | - | - | - | - | +| USE_PN532_HSU | - | - | - | - | - | x | - | +| USE_IR_REMOTE | - | - | - | x | x | x | x | +| USE_IR_HVAC | - | - | - | - | - | x | - | +| USE_IR_RECEIVE | - | - | - | x | x | x | x | +| USE_WS2812 | - | - | x | x | x | x | x | +| USE_WS2812_DMA | - | - | - | - | - | - | - | +| USE_ARILUX_RF | - | - | - | x | x | x | - | +| USE_SR04 | - | - | - | x | x | x | x | +| USE_TM1638 | - | - | - | - | - | x | - | +| USE_HX711 | - | - | - | x | x | x | x | +| USE_RF_FLASH | - | - | - | x | x | x | - | +| USE_TX20_WIND_SENSOR | - | - | - | x | x | x | x | +| USE_RC_SWITCH | - | - | - | x | x | x | x | +| USE_RF_SENSOR | - | - | - | - | - | x | - | AlectoV2 only +| USE_SM16716 | - | x | x | x | x | x | x | +| USE_HRE | - | - | - | - | - | x | - | +| USE_DISPLAY | - | - | - | - | - | - | x | +| USE_DISPLAY_LCD | - | - | - | - | - | - | x | +| USE_DISPLAY_SSD1306 | - | - | - | - | - | - | x | +| USE_DISPLAY_MATRIX | - | - | - | - | - | - | x | +| USE_DISPLAY_ILI9341 | - | - | - | - | - | - | x | +| USE_DISPLAY_EPAPER_29 | - | - | - | - | - | - | x | Disabled for core 2.3.0 ## Changelog -Version 6.4.1 20181225 - * Change RAM usage BMP/BME I2C sensors - * Change FallbackTopic from cmnd/\/ to cmnd/\_fb/ to discriminate from Topic (#1528) - * Change FallbackTopic detection (#4706) - * Change Hass discovery to short MQTT messages as used by Hass 0.81 and up (#4711) - * Change MQTT GUI password handling (#4723) - * Fix possible dtostrf buffer overflows by increasing buffers - * Fix wifi strongest signal detection (#4704) - * Fix Alexa "this value is outside the range of the device". Needs power cycle and Alexa deletion/discovery cycle. (#3159, #4712) - * Add Slovak language file (#4663) - * Add support for AZ-Instrument 7798 CO2 meter/datalogger (#4672) - * Add define WIFI_SOFT_AP_CHANNEL in my_user_config.h to set Soft Access Point Channel number between 1 and 13 as used by Wifi Manager web GUI (#4673) - * Add define USE_MQTT_TLS_CA_CERT for checking MQTT TLS against root ca using Let's Encrypt cert from sonoff_letsencrypt.h - not supported with core 2.3.0 (#4703) - -Version 6.4.0 20181217 - * Change GUI Configure Module by using AJAX for data fetch to cut page size (and memory use) by 40%. - In case of web page errors clear your browser cache or do Page Reload (F5 or Ctrl+R) - * Change enforcing flashmode dout but it is still mandatory - * Change bootcount update (being first) flash write to 10 seconds after restart - * Change display and epaper drivers - * Change command WebSend Host header field from IP address to hostname (#4331) - * Change log buffer size from 512 to 520 to accommodate http sensor data (#4354) - * Change default WIFI_CONFIG_TOOL from WIFI_WAIT to WIFI_RETRY in my_user_config.h (#4400) - * Change webgui refresh time delay for Save Settings and local OTA Upload (#4423) - * Change SR-04 driver to use NewPing library (#4488) - * Change MCP230xx driver to support interrupt retention over teleperiod (#4547) - * Change support for MPU6050 using DMP (#4581) - * Fix unintended function overload of WifiState - * Fix wifi connection errors using wifi disconnect and ESP.reset instead of ESP.restart - * Fix Sonoff Pow R2 and Sonoff S31 Serial interface hang caused by Sonoff Basic R2 driver delay implementation (and possibly core bug) - * Fix MQTT connection error after restart - * Fix wifi re-scan connection baseline - * Fix possible strncat buffer overflows - * Fix intermittent Pzem sensor energy overflow calculation error - * Fix shelly2 ghost switching caused by lack of pull-up inputs (#4255) - * Fix hardware serial pin configuration. To keep using hardware serial swap current Rx/Tx pin configuration only (#4280) - * Fix MqttRetry values above 255 seconds (#4424) - * Fix WifiManager functionality on initial installation (#4433) - * Fix ArduinoOTA for Core 2.5.0 (#4620) - * Add minutes to commands Timezone to allow all possible world timezones - * Add more strict checks for GPIO selections - * Add code image and optional commit number to version - * Add dynamic delay to main loop providing time for wifi background tasks - * Add additional start-up delay during initial wifi connection - * Add support for decoding Theo V2 sensors as documented on https://sidweb.nl using 434MHz RF sensor receiver - * Add support for decoding Alecto V2 sensors like ACH2010, WS3000 and DKW2012 weather stations using 868MHz RF sensor receiver - * Add user definition of defines WIFI_RSSI_THRESHOLD (default 10) and WIFI_RESCAN_MINUTES (default 44) - * Add command SetOption58 0/1 to enable IR raw data info in JSON message (#2116) - * Add command IRSend \|0,\,\,.. to allow raw data transmission (#2116) - * Add command SetOption56 0/1 to enable wifi network scan and select highest RSSI (#3173) - * Add command SetOption57 0/1 to enable wifi network re-scan every 44 minutes with a rssi threshold of 10 to select highest RSSI (#3173) - * Add support for SDM220 (#3610) - * Add default sleep 1 to sonoff-basic to lower energy consumption (#4217) - * Add wifi status to Tuya (#4221) - * Add delays to reduce CPU usage at boot time (#4233) - * Add command SetOption24 0/1 to select pressure unit as hPa or mmHg (#4241) - * Add optional hardware serial when GPIO13(Rx) and GPIO15(Tx) are selected removing hardware serial from GPIO01(Tx) and GPIO03(Rx) (#4288) - * Add support for Gosund SP1 v2.3 Power Socket with Energy Monitoring (#4297) - * Add support for Armtronix dimmers. See wiki for info (#4321) - * Add to command WebSend option to send a direct path when command starts with a slash (#4329) - * Add support for LG HVac and IrRemote (#4377) - * Add initial support for Hass sensor discovery (#4380) - * Add support for Fujitsu HVac and IrRemote (#4387) - * Add support for I2C MGC3130 Electric Field Effect sensor by Christian Baars (#3774, #4404) - * Add command CalcRes to set number of decimals (0 - 7) used in commands ADD, SUB, MULT and SCALE (#4420) - * Add CPU average load to state message (#4431) - * Add command SetOption59 0/1 to change state topic from tele/STATE to stat/RESULT (#4450) - * Add support for SM Smart Wifi Dimmer PS-16-DZ (#4465) - * Add support for Teckin US Power Socket with Energy Monitoring (#4481) - * Add command SetOption60 0/1 to select dynamic sleep (0) or sleep (1) (#4497) - * Add support for iFan02 Fanspeed in Domoticz using a selector (#4517) - * Add support for GPIO02 for newer Sonoff Basic (#4518) - * Add Announce Switches to MQTT Discovery (#4531) - * Add support for Manzoku Power Strip (#4590) +Version 6.5.0 20190319 + * Remove commands SetOption14 and SetOption63 as it has been superseded by command Interlock + * Remove command SetOption35 0-255 for mDNS start-up delay (#4793) + * Remove support for MQTT_LIBRARY_TYPE, MQTT_ARDUINOMQTT and MQTT_TASMOTAMQTT (#5474) + * Change webserver content handling from single String to small Chunks increasing RAM + * Change code use of boolean to bool and byte to uint8_t + * Change code uint8_t flags to bool flags + * Change sonoff_template.h layout regarding optional module flags like ADC0 + * Change sonoff_template.h module lay-out by removing non-configurable GPIOs + * Change button driver making it modular + * Change switch driver making it modular and introduce input filter (#4665, #4724) + * Change switch input detection by optimizing switch debounce (#4724) + * Change web authentication (#4865) + * Change image name BE_MINIMAL to FIRMWARE_MINIMAL and USE_xyz to FIRMWARE_xyz (#5106) + * Change GUI weblog from XML to plain text solving possible empty screens (#5154) + * Fix most compiler warnings + * Fix Display exception 28 when JSON value is NULL received + * Fix epaper driver (#4785) + * Fix HAss Sensor Discovery Software Watchdog restart (#4831, #4988) + * Fix allowable MAX_RULE_VARS to 16 (#4933) + * Fix mDNS addService (#4938, #4951) + * Fix HAss discovery of MHZ19(B) sensors (#4992) + * Fix some exceptions and watchdogs due to lack of stack space (#5215) + * Fix GUI wifi password acception starting with asteriks (*) (#5231, #5242) + * Fix command WebSend intermittent results (#5273, #5304) + * Fix additional characters in fallbacktopic, hostname and mqttclient on core 2.5.0 (#5359, #5417) + * Fix Energy TotalStartTime when commands EnergyReset0 and/or EnergyReset3 used (#5373) + * Fix DS18S20 temperature calculation (#5375) + * Fix float calculations in range from 0 to -1 (#5386) + * Fix exception on GUI Configure Logging and Configure Other (#5424) + * Add commands PowerCal, VoltageCal and CurrentCal for HLW8012, HJL01 and BL0937 based energy sensors + * Add command SerialDelimiter 128 to filter reception of only characters between ASCII 32 and 127 (#5131) + * Add command SSerialSend5 \ to SerialBridge + * Add command Interlock 0 / 1 / 1,2 3,4 .. to control interlock ON/OFF and add up to 8 relays in 1 to 4 interlock groups (#4910, #5014) + * Add command Template 255 to copy module configuration over to current active template and store as user template named Merged (#5371) + * Add command WifiConfig 7 to allow reset of device in AP mode without admin password (#5297) + * Add command SetOption36 to control boot loop default restoration (#4645, #5063) + * Add command SetOption37 for RGBCW color mapping (#5326) + * Add command SetOption55 0/1 and define MDNS_ENABLE to disable/enable mDNS (#4793, #4923) + * Add command SetOption62 0/1 to disable retain on Button or Switch hold messages (#5299) + * Add support for Smanergy KA10 Smart Wall Socket with Energy monitoring + * Add support for commands in sensor drivers + * Add support for MAX31855 K-Type thermocouple sensor using softSPI (#4764) + * Add support for Near Field Communication (NFC) controller PN532 using Serial (#4791, #5162) + * Add support for OBI Power Socket 2 (#4829) + * Add support for YTF IR Bridge (#4855) + * Add support for Mi LED Desk Lamp with rotary switch (#4887) + * Add support for Digoo DG-SP202 Smart Socket with Energy monitoring (#4891) + * Add support for MAX44009 Ambient Light sensor (#4907) + * Add support for inverted buttons and inverted buttons without pullup (#4914) + * Add support for Luminea ZX2820 Smart Socket with Energy monitoring (#4921) + * Add support for multiple ADS1115 I2C devices (#5083) + * Add support for online template change using command Template or GUI Configure Other (#5177) + * Add support for Korean language translations (#5344) + * Add support for sensor SCD30 (#5434) + * Add parameter CFG_HOLDER to status 1 message (#5206) + * Add SetOption32 until SetOption49 diagnostic information to Status 3 report as replacement for second property value in SetOption property name + * Add Resolution property to Status 3 report providing previous SetOption second value property + * Add property MqttCount to status 6 message representing number of Mqtt re-connections + * Add property LinkCount to state and status 11 message representing number of Wifi Link re-connections + * Add property Downtime to state and status 11 message representing the duration of wifi connection loss + * Add variable %timestamp% to rules (#4749) + * Add rule support for "==", "!=" ">=" and "<=" (#5122) + * Add rule expression enabled by define USE_EXPRESSION in my_user_config.h (#5210) + * Add Power status functionality to LED2 when configured leaving LED1 for Link status indication + * Add user configuration of HLW8012 and HJL-01/BL0937 Energy Monitoring as used in Sonoff Pow and many Tuya based devices + * Add user configuration of MCP39F501 Energy Monitoring as used in Shelly2 + * Add online template configuration using both commands and Configure Template menu option in GUI + * Add (S)SerialSend3 escape sequence \x to allow hexadecimal byte value (#3560, #4947) + * Add define DS18B20_INTERNAL_PULLUP to select internal input pullup when only one DS18B20 sensor is connected eliminating external resistor (#4738) + * Add button control when no relay configured (#4682) + * Add startup delay of 4 seconds to button control (#4829) + * Add core version conditional compile options to provided PWM files (#4917) + * Add resiliency to saved Settings (#5065) + * Add MHZ19 Temperature as Domoticz Temperature selection (#5128) + * Add HAss status sensor (#5139) + * Add status message to former declined group commands (#5145) + * Add 0x to IRRemote (SetOption29) and RCSwitch (SetOption28) received hexadecimal data (#5431) diff --git a/SUPPORT.md b/SUPPORT.md new file mode 100644 index 000000000..46fa03ebc --- /dev/null +++ b/SUPPORT.md @@ -0,0 +1,22 @@ +# Sonoff-Tasmota Support + +If you're looking for support on **Sonoff-Tasmota** there are some options available: + +### Documentation: + +* [Wiki Pages](https://github.com/arendst/Sonoff-Tasmota/wiki): For information on how to Flash Tasmota, configure and use it. +* [Troubleshooting Information](https://github.com/arendst/Sonoff-Tasmota/wiki/Troubleshooting): For information on common problems and solutions. +* [Commands Information](https://github.com/arendst/Sonoff-Tasmota/wiki/Commands): For information on all the commands supported by Tasmota. + +### Support's Community: + +* [Tasmota Forum](https://groups.google.com/d/forum/sonoffusers): For usage and discussions. +* [Tasmota Support Chat](https://discord.gg/Ks2Kzd4): For support, troubleshooting and general questions. You have better chances to get fast answers from members of the Tasmota Community. +* [Search in Issues](https://github.com/arendst/Sonoff-Tasmota/issues): You might find an answer to your question by searching current or closed issues. + +### Developers' Community: + +* [Bug Report](https://github.com/arendst/Sonoff-Tasmota/issues/new?template=Bug_report.md): For reporting Bugs of Tasmota Software. +* [Feature Request](https://github.com/arendst/Sonoff-Tasmota/issues/new?template=Feature_request.md): For requesting features/functions to Tasmota Software. +* [Troubleshooting](https://github.com/arendst/Sonoff-Tasmota/issues/new?template=Custom.md): As a last resort, you can open new *Troubleshooting* issue on GitHub if the solution could not be found using the other channels. Just remember: the more info you provide the more chances you'll have to get an accurate answer. +* [Issue a question](https://github.com/arendst/Sonoff-Tasmota/issues/new/choose): As a last resort, you can open new *Question* issue on GitHub if the answer could not be found using the other channels. Just remember: the more info you provide the more chances you'll have to get an accurate answer. diff --git a/TEMPLATE.md b/TEMPLATE.md index 91bd8d293..67431f651 100644 --- a/TEMPLATE.md +++ b/TEMPLATE.md @@ -3,7 +3,7 @@ Sonoff-Tasmota uses Device or Module information to control peripherals connecte Starting with version 6.4.1.16 Sonoff-Tasmota Modules can be extended by users online using a template. To provide easy processing by Sonoff-Tasmota a user template is written as JSON text and could look like this: -{"NAME":"UserModule1","GPIO":[17,243,29,244,7,201,255,255,138,255,139,255,255],"FLAG":0,"BASE":18} +{"NAME":"UserModule1","GPIO":[17,148,29,149,7,255,255,255,138,255,139,255,255],"FLAG":0,"BASE":18} The four properties with UPPERCASE property names have the following functionality: @@ -74,7 +74,7 @@ Template | 0 | Copy active module template to user template Template | 1 .. 69 | Copy hard-coded module template to user template The following command will store a complete template based on the Generic module -``Template {"NAME":"UserModule1","GPIO":[17,243,29,244,7,201,255,255,138,255,139,255,255],"FLAG":0,"BASE":18}`` +``Template {"NAME":"UserModule1","GPIO":[17,148,29,149,7,255,255,255,138,255,139,255,255],"FLAG":0,"BASE":18}`` The following command will update the name of a stored template ``Template {"NAME":"UserModule2"}`` diff --git a/arduino/version 2.5.0-beta2/boards.txt b/arduino/version 2.5.0-beta2/boards.txt deleted file mode 100644 index 2334302b8..000000000 --- a/arduino/version 2.5.0-beta2/boards.txt +++ /dev/null @@ -1,6086 +0,0 @@ -# -# Do not create pull-requests for this file only, CI will not accept them. -# You *must* edit/modify/run boards.txt.py to regenerate boards.txt. -# All modified files after running with option "--allgen" must be included in the pull-request. -# - -menu.BoardModel=Model -menu.baud=Upload Speed -menu.UploadTool=Upload Using -menu.xtal=CPU Frequency -menu.CrystalFreq=Crystal Frequency -menu.eesz=Flash Size -menu.FlashMode=Flash Mode -menu.FlashFreq=Flash Frequency -menu.ResetMethod=Reset Method -menu.ESPModule=Module -menu.dbg=Debug port -menu.lvl=Debug Level -menu.ip=lwIP Variant -menu.vt=VTables -menu.exception=Exceptions -menu.led=Builtin Led -menu.wipe=Erase Flash - -############################################################## -generic.name=Generic ESP8266 Module -generic.build.board=ESP8266_GENERIC -generic.upload.tool=esptool -generic.upload.maximum_data_size=81920 -generic.upload.wait_for_upload_port=true -generic.upload.erase_cmd= -generic.serial.disableDTR=true -generic.serial.disableRTS=true -generic.build.mcu=esp8266 -generic.build.core=esp8266 -generic.build.variant=generic -generic.build.spiffs_pagesize=256 -generic.build.debug_port= -generic.build.debug_level= - -generic.menu.UploadTool.esptool=Serial -generic.menu.UploadTool.esptool.upload.tool=esptool -generic.menu.UploadTool.esptool.upload.verbose=-vv -generic.menu.UploadTool.espupload=OTA_upload -generic.menu.UploadTool.espupload.upload.tool=espupload - -generic.menu.xtal.80=80 MHz -generic.menu.xtal.80.build.f_cpu=80000000L -generic.menu.xtal.160=160 MHz -generic.menu.xtal.160.build.f_cpu=160000000L -generic.menu.vt.flash=Flash -generic.menu.vt.flash.build.vtable_flags=-DVTABLES_IN_FLASH -generic.menu.vt.heap=Heap -generic.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM -generic.menu.vt.iram=IRAM -generic.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM -generic.menu.exception.enabled=Enabled -generic.menu.exception.enabled.build.exception_flags=-fexceptions -generic.menu.exception.enabled.build.stdcpp_lib=-lstdc++ -generic.menu.exception.disabled=Disabled -generic.menu.exception.disabled.build.exception_flags=-fno-exceptions -generic.menu.exception.disabled.build.stdcpp_lib=-lstdc++-nox -generic.menu.ResetMethod.ck=ck -generic.menu.ResetMethod.ck.upload.resetmethod=ck -generic.menu.ResetMethod.nodemcu=nodemcu -generic.menu.ResetMethod.nodemcu.upload.resetmethod=nodemcu -generic.menu.ResetMethod.none=none -generic.menu.ResetMethod.none.upload.resetmethod=none -generic.menu.ResetMethod.dtrset=dtrset -generic.menu.ResetMethod.dtrset.upload.resetmethod=dtrset -generic.menu.CrystalFreq.26=26 MHz -generic.menu.CrystalFreq.40=40 MHz -generic.menu.CrystalFreq.40.build.extra_flags=-DF_CRYSTAL=40000000 -DESP8266 -generic.menu.FlashFreq.40=40MHz -generic.menu.FlashFreq.40.build.flash_freq=40 -generic.menu.FlashFreq.80=80MHz -generic.menu.FlashFreq.80.build.flash_freq=80 -generic.menu.FlashMode.qio=QIO -generic.menu.FlashMode.qio.build.flash_mode=qio -generic.menu.FlashMode.qout=QOUT -generic.menu.FlashMode.qout.build.flash_mode=qout -generic.menu.FlashMode.dio=DIO -generic.menu.FlashMode.dio.build.flash_mode=dio -generic.menu.FlashMode.dout=DOUT -generic.menu.FlashMode.dout.build.flash_mode=dout -generic.menu.eesz.512K=512K (no SPIFFS) -generic.menu.eesz.512K.build.flash_size=512K -generic.menu.eesz.512K.build.flash_size_bytes=0x80000 -generic.menu.eesz.512K.build.flash_ld=eagle.flash.512k.ld -generic.menu.eesz.512K.build.spiffs_pagesize=256 -generic.menu.eesz.512K.upload.maximum_size=499696 -generic.menu.eesz.512K.build.rfcal_addr=0x7C000 -generic.menu.eesz.512K32=512K (32K SPIFFS) -generic.menu.eesz.512K32.build.flash_size=512K -generic.menu.eesz.512K32.build.flash_size_bytes=0x80000 -generic.menu.eesz.512K32.build.flash_ld=eagle.flash.512k32.ld -generic.menu.eesz.512K32.build.spiffs_pagesize=256 -generic.menu.eesz.512K32.upload.maximum_size=466928 -generic.menu.eesz.512K32.build.rfcal_addr=0x7C000 -generic.menu.eesz.512K32.build.spiffs_start=0x73000 -generic.menu.eesz.512K32.build.spiffs_end=0x7B000 -generic.menu.eesz.512K32.build.spiffs_blocksize=4096 -generic.menu.eesz.512K64=512K (64K SPIFFS) -generic.menu.eesz.512K64.build.flash_size=512K -generic.menu.eesz.512K64.build.flash_size_bytes=0x80000 -generic.menu.eesz.512K64.build.flash_ld=eagle.flash.512k64.ld -generic.menu.eesz.512K64.build.spiffs_pagesize=256 -generic.menu.eesz.512K64.upload.maximum_size=434160 -generic.menu.eesz.512K64.build.rfcal_addr=0x7C000 -generic.menu.eesz.512K64.build.spiffs_start=0x6B000 -generic.menu.eesz.512K64.build.spiffs_end=0x7B000 -generic.menu.eesz.512K64.build.spiffs_blocksize=4096 -generic.menu.eesz.512K128=512K (128K SPIFFS) -generic.menu.eesz.512K128.build.flash_size=512K -generic.menu.eesz.512K128.build.flash_size_bytes=0x80000 -generic.menu.eesz.512K128.build.flash_ld=eagle.flash.512k128.ld -generic.menu.eesz.512K128.build.spiffs_pagesize=256 -generic.menu.eesz.512K128.upload.maximum_size=368624 -generic.menu.eesz.512K128.build.rfcal_addr=0x7C000 -generic.menu.eesz.512K128.build.spiffs_start=0x5B000 -generic.menu.eesz.512K128.build.spiffs_end=0x7B000 -generic.menu.eesz.512K128.build.spiffs_blocksize=4096 -generic.menu.eesz.1M=1M (no SPIFFS) -generic.menu.eesz.1M.build.flash_size=1M -generic.menu.eesz.1M.build.flash_size_bytes=0x100000 -generic.menu.eesz.1M.build.flash_ld=eagle.flash.1m.ld -generic.menu.eesz.1M.build.spiffs_pagesize=256 -generic.menu.eesz.1M.upload.maximum_size=1023984 -generic.menu.eesz.1M.build.rfcal_addr=0xFC000 -generic.menu.eesz.1M64=1M (64K SPIFFS) -generic.menu.eesz.1M64.build.flash_size=1M -generic.menu.eesz.1M64.build.flash_size_bytes=0x100000 -generic.menu.eesz.1M64.build.flash_ld=eagle.flash.1m64.ld -generic.menu.eesz.1M64.build.spiffs_pagesize=256 -generic.menu.eesz.1M64.upload.maximum_size=958448 -generic.menu.eesz.1M64.build.rfcal_addr=0xFC000 -generic.menu.eesz.1M64.build.spiffs_start=0xEB000 -generic.menu.eesz.1M64.build.spiffs_end=0xFB000 -generic.menu.eesz.1M64.build.spiffs_blocksize=4096 -generic.menu.eesz.1M128=1M (128K SPIFFS) -generic.menu.eesz.1M128.build.flash_size=1M -generic.menu.eesz.1M128.build.flash_size_bytes=0x100000 -generic.menu.eesz.1M128.build.flash_ld=eagle.flash.1m128.ld -generic.menu.eesz.1M128.build.spiffs_pagesize=256 -generic.menu.eesz.1M128.upload.maximum_size=892912 -generic.menu.eesz.1M128.build.rfcal_addr=0xFC000 -generic.menu.eesz.1M128.build.spiffs_start=0xDB000 -generic.menu.eesz.1M128.build.spiffs_end=0xFB000 -generic.menu.eesz.1M128.build.spiffs_blocksize=4096 -generic.menu.eesz.1M144=1M (144K SPIFFS) -generic.menu.eesz.1M144.build.flash_size=1M -generic.menu.eesz.1M144.build.flash_size_bytes=0x100000 -generic.menu.eesz.1M144.build.flash_ld=eagle.flash.1m144.ld -generic.menu.eesz.1M144.build.spiffs_pagesize=256 -generic.menu.eesz.1M144.upload.maximum_size=876528 -generic.menu.eesz.1M144.build.rfcal_addr=0xFC000 -generic.menu.eesz.1M144.build.spiffs_start=0xD7000 -generic.menu.eesz.1M144.build.spiffs_end=0xFB000 -generic.menu.eesz.1M144.build.spiffs_blocksize=4096 -generic.menu.eesz.1M160=1M (160K SPIFFS) -generic.menu.eesz.1M160.build.flash_size=1M -generic.menu.eesz.1M160.build.flash_size_bytes=0x100000 -generic.menu.eesz.1M160.build.flash_ld=eagle.flash.1m160.ld -generic.menu.eesz.1M160.build.spiffs_pagesize=256 -generic.menu.eesz.1M160.upload.maximum_size=860144 -generic.menu.eesz.1M160.build.rfcal_addr=0xFC000 -generic.menu.eesz.1M160.build.spiffs_start=0xD3000 -generic.menu.eesz.1M160.build.spiffs_end=0xFB000 -generic.menu.eesz.1M160.build.spiffs_blocksize=4096 -generic.menu.eesz.1M192=1M (192K SPIFFS) -generic.menu.eesz.1M192.build.flash_size=1M -generic.menu.eesz.1M192.build.flash_size_bytes=0x100000 -generic.menu.eesz.1M192.build.flash_ld=eagle.flash.1m192.ld -generic.menu.eesz.1M192.build.spiffs_pagesize=256 -generic.menu.eesz.1M192.upload.maximum_size=827376 -generic.menu.eesz.1M192.build.rfcal_addr=0xFC000 -generic.menu.eesz.1M192.build.spiffs_start=0xCB000 -generic.menu.eesz.1M192.build.spiffs_end=0xFB000 -generic.menu.eesz.1M192.build.spiffs_blocksize=4096 -generic.menu.eesz.1M256=1M (256K SPIFFS) -generic.menu.eesz.1M256.build.flash_size=1M -generic.menu.eesz.1M256.build.flash_size_bytes=0x100000 -generic.menu.eesz.1M256.build.flash_ld=eagle.flash.1m256.ld -generic.menu.eesz.1M256.build.spiffs_pagesize=256 -generic.menu.eesz.1M256.upload.maximum_size=761840 -generic.menu.eesz.1M256.build.rfcal_addr=0xFC000 -generic.menu.eesz.1M256.build.spiffs_start=0xBB000 -generic.menu.eesz.1M256.build.spiffs_end=0xFB000 -generic.menu.eesz.1M256.build.spiffs_blocksize=4096 -generic.menu.eesz.1M512=1M (512K SPIFFS) -generic.menu.eesz.1M512.build.flash_size=1M -generic.menu.eesz.1M512.build.flash_size_bytes=0x100000 -generic.menu.eesz.1M512.build.flash_ld=eagle.flash.1m512.ld -generic.menu.eesz.1M512.build.spiffs_pagesize=256 -generic.menu.eesz.1M512.upload.maximum_size=499696 -generic.menu.eesz.1M512.build.rfcal_addr=0xFC000 -generic.menu.eesz.1M512.build.spiffs_start=0x7B000 -generic.menu.eesz.1M512.build.spiffs_end=0xFB000 -generic.menu.eesz.1M512.build.spiffs_blocksize=4096 -generic.menu.eesz.2M=2M (no SPIFFS) -generic.menu.eesz.2M.build.flash_size=2M -generic.menu.eesz.2M.build.flash_size_bytes=0x200000 -generic.menu.eesz.2M.build.flash_ld=eagle.flash.2m.ld -generic.menu.eesz.2M.build.spiffs_pagesize=256 -generic.menu.eesz.2M.upload.maximum_size=1044464 -generic.menu.eesz.2M.build.rfcal_addr=0x1FC000 -generic.menu.eesz.2M128=2M (128K SPIFFS) -generic.menu.eesz.2M128.build.flash_size=2M -generic.menu.eesz.2M128.build.flash_size_bytes=0x200000 -generic.menu.eesz.2M128.build.flash_ld=eagle.flash.2m128.ld -generic.menu.eesz.2M128.build.spiffs_pagesize=256 -generic.menu.eesz.2M128.upload.maximum_size=1044464 -generic.menu.eesz.2M128.build.rfcal_addr=0x1FC000 -generic.menu.eesz.2M128.build.spiffs_start=0x1E0000 -generic.menu.eesz.2M128.build.spiffs_end=0x1FB000 -generic.menu.eesz.2M128.build.spiffs_blocksize=4096 -generic.menu.eesz.2M256=2M (256K SPIFFS) -generic.menu.eesz.2M256.build.flash_size=2M -generic.menu.eesz.2M256.build.flash_size_bytes=0x200000 -generic.menu.eesz.2M256.build.flash_ld=eagle.flash.2m256.ld -generic.menu.eesz.2M256.build.spiffs_pagesize=256 -generic.menu.eesz.2M256.upload.maximum_size=1044464 -generic.menu.eesz.2M256.build.rfcal_addr=0x1FC000 -generic.menu.eesz.2M256.build.spiffs_start=0x1C0000 -generic.menu.eesz.2M256.build.spiffs_end=0x1FB000 -generic.menu.eesz.2M256.build.spiffs_blocksize=4096 -generic.menu.eesz.2M512=2M (512K SPIFFS) -generic.menu.eesz.2M512.build.flash_size=2M -generic.menu.eesz.2M512.build.flash_size_bytes=0x200000 -generic.menu.eesz.2M512.build.flash_ld=eagle.flash.2m512.ld -generic.menu.eesz.2M512.build.spiffs_pagesize=256 -generic.menu.eesz.2M512.upload.maximum_size=1044464 -generic.menu.eesz.2M512.build.rfcal_addr=0x1FC000 -generic.menu.eesz.2M512.build.spiffs_start=0x180000 -generic.menu.eesz.2M512.build.spiffs_end=0x1FB000 -generic.menu.eesz.2M512.build.spiffs_blocksize=8192 -generic.menu.eesz.2M1M=2M (1M SPIFFS) -generic.menu.eesz.2M1M.build.flash_size=2M -generic.menu.eesz.2M1M.build.flash_size_bytes=0x200000 -generic.menu.eesz.2M1M.build.flash_ld=eagle.flash.2m1m.ld -generic.menu.eesz.2M1M.build.spiffs_pagesize=256 -generic.menu.eesz.2M1M.upload.maximum_size=1044464 -generic.menu.eesz.2M1M.build.rfcal_addr=0x1FC000 -generic.menu.eesz.2M1M.build.spiffs_start=0x100000 -generic.menu.eesz.2M1M.build.spiffs_end=0x1FB000 -generic.menu.eesz.2M1M.build.spiffs_blocksize=8192 -generic.menu.eesz.4M=4M (no SPIFFS) -generic.menu.eesz.4M.build.flash_size=4M -generic.menu.eesz.4M.build.flash_size_bytes=0x400000 -generic.menu.eesz.4M.build.flash_ld=eagle.flash.4m.ld -generic.menu.eesz.4M.build.spiffs_pagesize=256 -generic.menu.eesz.4M.upload.maximum_size=1044464 -generic.menu.eesz.4M.build.rfcal_addr=0x3FC000 -generic.menu.eesz.4M1M=4M (1M SPIFFS) -generic.menu.eesz.4M1M.build.flash_size=4M -generic.menu.eesz.4M1M.build.flash_size_bytes=0x400000 -generic.menu.eesz.4M1M.build.flash_ld=eagle.flash.4m1m.ld -generic.menu.eesz.4M1M.build.spiffs_pagesize=256 -generic.menu.eesz.4M1M.upload.maximum_size=1044464 -generic.menu.eesz.4M1M.build.rfcal_addr=0x3FC000 -generic.menu.eesz.4M1M.build.spiffs_start=0x300000 -generic.menu.eesz.4M1M.build.spiffs_end=0x3FB000 -generic.menu.eesz.4M1M.build.spiffs_blocksize=8192 -generic.menu.eesz.4M2M=4M (2M SPIFFS) -generic.menu.eesz.4M2M.build.flash_size=4M -generic.menu.eesz.4M2M.build.flash_size_bytes=0x400000 -generic.menu.eesz.4M2M.build.flash_ld=eagle.flash.4m2m.ld -generic.menu.eesz.4M2M.build.spiffs_pagesize=256 -generic.menu.eesz.4M2M.upload.maximum_size=1044464 -generic.menu.eesz.4M2M.build.rfcal_addr=0x3FC000 -generic.menu.eesz.4M2M.build.spiffs_start=0x200000 -generic.menu.eesz.4M2M.build.spiffs_end=0x3FB000 -generic.menu.eesz.4M2M.build.spiffs_blocksize=8192 -generic.menu.eesz.4M3M=4M (3M SPIFFS) -generic.menu.eesz.4M3M.build.flash_size=4M -generic.menu.eesz.4M3M.build.flash_size_bytes=0x400000 -generic.menu.eesz.4M3M.build.flash_ld=eagle.flash.4m3m.ld -generic.menu.eesz.4M3M.build.spiffs_pagesize=256 -generic.menu.eesz.4M3M.upload.maximum_size=1044464 -generic.menu.eesz.4M3M.build.rfcal_addr=0x3FC000 -generic.menu.eesz.4M3M.build.spiffs_start=0x100000 -generic.menu.eesz.4M3M.build.spiffs_end=0x3FB000 -generic.menu.eesz.4M3M.build.spiffs_blocksize=8192 -generic.menu.eesz.8M6M=8M (6M SPIFFS) -generic.menu.eesz.8M6M.build.flash_size=8M -generic.menu.eesz.8M6M.build.flash_size_bytes=0x800000 -generic.menu.eesz.8M6M.build.flash_ld=eagle.flash.8m6m.ld -generic.menu.eesz.8M6M.build.spiffs_pagesize=256 -generic.menu.eesz.8M6M.upload.maximum_size=1044464 -generic.menu.eesz.8M6M.build.rfcal_addr=0x7FC000 -generic.menu.eesz.8M6M.build.spiffs_start=0x200000 -generic.menu.eesz.8M6M.build.spiffs_end=0x7FB000 -generic.menu.eesz.8M6M.build.spiffs_blocksize=8192 -generic.menu.eesz.8M7M=8M (7M SPIFFS) -generic.menu.eesz.8M7M.build.flash_size=8M -generic.menu.eesz.8M7M.build.flash_size_bytes=0x800000 -generic.menu.eesz.8M7M.build.flash_ld=eagle.flash.8m7m.ld -generic.menu.eesz.8M7M.build.spiffs_pagesize=256 -generic.menu.eesz.8M7M.upload.maximum_size=1044464 -generic.menu.eesz.8M7M.build.rfcal_addr=0x7FC000 -generic.menu.eesz.8M7M.build.spiffs_start=0x100000 -generic.menu.eesz.8M7M.build.spiffs_end=0x7FB000 -generic.menu.eesz.8M7M.build.spiffs_blocksize=8192 -generic.menu.eesz.16M14M=16M (14M SPIFFS) -generic.menu.eesz.16M14M.build.flash_size=16M -generic.menu.eesz.16M14M.build.flash_size_bytes=0x1000000 -generic.menu.eesz.16M14M.build.flash_ld=eagle.flash.16m14m.ld -generic.menu.eesz.16M14M.build.spiffs_pagesize=256 -generic.menu.eesz.16M14M.upload.maximum_size=1044464 -generic.menu.eesz.16M14M.build.rfcal_addr=0xFFC000 -generic.menu.eesz.16M14M.build.spiffs_start=0x200000 -generic.menu.eesz.16M14M.build.spiffs_end=0xFFB000 -generic.menu.eesz.16M14M.build.spiffs_blocksize=8192 -generic.menu.eesz.16M15M=16M (15M SPIFFS) -generic.menu.eesz.16M15M.build.flash_size=16M -generic.menu.eesz.16M15M.build.flash_size_bytes=0x1000000 -generic.menu.eesz.16M15M.build.flash_ld=eagle.flash.16m15m.ld -generic.menu.eesz.16M15M.build.spiffs_pagesize=256 -generic.menu.eesz.16M15M.upload.maximum_size=1044464 -generic.menu.eesz.16M15M.build.rfcal_addr=0xFFC000 -generic.menu.eesz.16M15M.build.spiffs_start=0x100000 -generic.menu.eesz.16M15M.build.spiffs_end=0xFFB000 -generic.menu.eesz.16M15M.build.spiffs_blocksize=8192 -generic.menu.led.2=2 -generic.menu.led.2.build.led=-DLED_BUILTIN=2 -generic.menu.led.0=0 -generic.menu.led.0.build.led=-DLED_BUILTIN=0 -generic.menu.led.1=1 -generic.menu.led.1.build.led=-DLED_BUILTIN=1 -generic.menu.led.3=3 -generic.menu.led.3.build.led=-DLED_BUILTIN=3 -generic.menu.led.4=4 -generic.menu.led.4.build.led=-DLED_BUILTIN=4 -generic.menu.led.5=5 -generic.menu.led.5.build.led=-DLED_BUILTIN=5 -generic.menu.led.6=6 -generic.menu.led.6.build.led=-DLED_BUILTIN=6 -generic.menu.led.7=7 -generic.menu.led.7.build.led=-DLED_BUILTIN=7 -generic.menu.led.8=8 -generic.menu.led.8.build.led=-DLED_BUILTIN=8 -generic.menu.led.9=9 -generic.menu.led.9.build.led=-DLED_BUILTIN=9 -generic.menu.led.10=10 -generic.menu.led.10.build.led=-DLED_BUILTIN=10 -generic.menu.led.11=11 -generic.menu.led.11.build.led=-DLED_BUILTIN=11 -generic.menu.led.12=12 -generic.menu.led.12.build.led=-DLED_BUILTIN=12 -generic.menu.led.13=13 -generic.menu.led.13.build.led=-DLED_BUILTIN=13 -generic.menu.led.14=14 -generic.menu.led.14.build.led=-DLED_BUILTIN=14 -generic.menu.led.15=15 -generic.menu.led.15.build.led=-DLED_BUILTIN=15 -generic.menu.ip.lm2f=v2 Lower Memory -generic.menu.ip.lm2f.build.lwip_include=lwip2/include -generic.menu.ip.lm2f.build.lwip_lib=-llwip2-536-feat -generic.menu.ip.lm2f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -generic.menu.ip.hb2f=v2 Higher Bandwidth -generic.menu.ip.hb2f.build.lwip_include=lwip2/include -generic.menu.ip.hb2f.build.lwip_lib=-llwip2-1460-feat -generic.menu.ip.hb2f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -generic.menu.ip.lm2n=v2 Lower Memory (no features) -generic.menu.ip.lm2n.build.lwip_include=lwip2/include -generic.menu.ip.lm2n.build.lwip_lib=-llwip2-536 -generic.menu.ip.lm2n.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=0 -DLWIP_IPV6=0 -generic.menu.ip.hb2n=v2 Higher Bandwidth (no features) -generic.menu.ip.hb2n.build.lwip_include=lwip2/include -generic.menu.ip.hb2n.build.lwip_lib=-llwip2-1460 -generic.menu.ip.hb2n.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=0 -DLWIP_IPV6=0 -generic.menu.ip.lm6f=v2 IPv6 Lower Memory -generic.menu.ip.lm6f.build.lwip_include=lwip2/include -generic.menu.ip.lm6f.build.lwip_lib=-llwip6-536-feat -generic.menu.ip.lm6f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=1 -generic.menu.ip.hb6f=v2 IPv6 Higher Bandwidth -generic.menu.ip.hb6f.build.lwip_include=lwip2/include -generic.menu.ip.hb6f.build.lwip_lib=-llwip6-1460-feat -generic.menu.ip.hb6f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=1 -DLWIP_IPV6=1 -generic.menu.ip.hb1=v1.4 Higher Bandwidth -generic.menu.ip.hb1.build.lwip_lib=-llwip_gcc -generic.menu.ip.hb1.build.lwip_flags=-DLWIP_OPEN_SRC -generic.menu.ip.src=v1.4 Compile from source -generic.menu.ip.src.build.lwip_lib=-llwip_src -generic.menu.ip.src.build.lwip_flags=-DLWIP_OPEN_SRC -generic.menu.ip.src.recipe.hooks.sketch.prebuild.1.pattern=make -C "{runtime.platform.path}/tools/sdk/lwip/src" install TOOLS_PATH="{runtime.tools.xtensa-lx106-elf-gcc.path}/bin/xtensa-lx106-elf-" -generic.menu.dbg.Disabled=Disabled -generic.menu.dbg.Disabled.build.debug_port= -generic.menu.dbg.Serial=Serial -generic.menu.dbg.Serial.build.debug_port=-DDEBUG_ESP_PORT=Serial -generic.menu.dbg.Serial1=Serial1 -generic.menu.dbg.Serial1.build.debug_port=-DDEBUG_ESP_PORT=Serial1 -generic.menu.lvl.None____=None -generic.menu.lvl.None____.build.debug_level= -generic.menu.lvl.SSL=SSL -generic.menu.lvl.SSL.build.debug_level= -DDEBUG_ESP_SSL -generic.menu.lvl.TLS_MEM=TLS_MEM -generic.menu.lvl.TLS_MEM.build.debug_level= -DDEBUG_ESP_TLS_MEM -generic.menu.lvl.HTTP_CLIENT=HTTP_CLIENT -generic.menu.lvl.HTTP_CLIENT.build.debug_level= -DDEBUG_ESP_HTTP_CLIENT -generic.menu.lvl.HTTP_SERVER=HTTP_SERVER -generic.menu.lvl.HTTP_SERVER.build.debug_level= -DDEBUG_ESP_HTTP_SERVER -generic.menu.lvl.SSLTLS_MEM=SSL+TLS_MEM -generic.menu.lvl.SSLTLS_MEM.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -generic.menu.lvl.SSLHTTP_CLIENT=SSL+HTTP_CLIENT -generic.menu.lvl.SSLHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_CLIENT -generic.menu.lvl.SSLHTTP_SERVER=SSL+HTTP_SERVER -generic.menu.lvl.SSLHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_SERVER -generic.menu.lvl.TLS_MEMHTTP_CLIENT=TLS_MEM+HTTP_CLIENT -generic.menu.lvl.TLS_MEMHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -generic.menu.lvl.TLS_MEMHTTP_SERVER=TLS_MEM+HTTP_SERVER -generic.menu.lvl.TLS_MEMHTTP_SERVER.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_SERVER -generic.menu.lvl.HTTP_CLIENTHTTP_SERVER=HTTP_CLIENT+HTTP_SERVER -generic.menu.lvl.HTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -generic.menu.lvl.SSLTLS_MEMHTTP_CLIENT=SSL+TLS_MEM+HTTP_CLIENT -generic.menu.lvl.SSLTLS_MEMHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -generic.menu.lvl.SSLTLS_MEMHTTP_SERVER=SSL+TLS_MEM+HTTP_SERVER -generic.menu.lvl.SSLTLS_MEMHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_SERVER -generic.menu.lvl.SSLHTTP_CLIENTHTTP_SERVER=SSL+HTTP_CLIENT+HTTP_SERVER -generic.menu.lvl.SSLHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -generic.menu.lvl.TLS_MEMHTTP_CLIENTHTTP_SERVER=TLS_MEM+HTTP_CLIENT+HTTP_SERVER -generic.menu.lvl.TLS_MEMHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -generic.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVER=SSL+TLS_MEM+HTTP_CLIENT+HTTP_SERVER -generic.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -generic.menu.lvl.CORE=CORE -generic.menu.lvl.CORE.build.debug_level= -DDEBUG_ESP_CORE -generic.menu.lvl.WIFI=WIFI -generic.menu.lvl.WIFI.build.debug_level= -DDEBUG_ESP_WIFI -generic.menu.lvl.HTTP_UPDATE=HTTP_UPDATE -generic.menu.lvl.HTTP_UPDATE.build.debug_level= -DDEBUG_ESP_HTTP_UPDATE -generic.menu.lvl.UPDATER=UPDATER -generic.menu.lvl.UPDATER.build.debug_level= -DDEBUG_ESP_UPDATER -generic.menu.lvl.OTA=OTA -generic.menu.lvl.OTA.build.debug_level= -DDEBUG_ESP_OTA -generic.menu.lvl.OOM=OOM -generic.menu.lvl.OOM.build.debug_level= -DDEBUG_ESP_OOM -generic.menu.lvl.COREWIFIHTTP_UPDATEUPDATEROTAOOM=CORE+WIFI+HTTP_UPDATE+UPDATER+OTA+OOM -generic.menu.lvl.COREWIFIHTTP_UPDATEUPDATEROTAOOM.build.debug_level= -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM -generic.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVERCOREWIFIHTTP_UPDATEUPDATEROTAOOM=SSL+TLS_MEM+HTTP_CLIENT+HTTP_SERVER+CORE+WIFI+HTTP_UPDATE+UPDATER+OTA+OOM -generic.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVERCOREWIFIHTTP_UPDATEUPDATEROTAOOM.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM -generic.menu.lvl.NoAssert-NDEBUG=NoAssert-NDEBUG -generic.menu.lvl.NoAssert-NDEBUG.build.debug_level= -DNDEBUG -generic.menu.wipe.none=Only Sketch -generic.menu.wipe.none.upload.erase_cmd= -generic.menu.wipe.sdk=Sketch + WiFi Settings -generic.menu.wipe.sdk.upload.erase_cmd=-ca "{build.rfcal_addr}" -cz 0x4000 -generic.menu.wipe.all=All Flash Contents -generic.menu.wipe.all.upload.erase_cmd=-ca 0x0 -cz "{build.flash_size_bytes}" -generic.menu.baud.115200=115200 -generic.menu.baud.115200.upload.speed=115200 -generic.menu.baud.9600=9600 -generic.menu.baud.9600.upload.speed=9600 -generic.menu.baud.57600=57600 -generic.menu.baud.57600.upload.speed=57600 -generic.menu.baud.230400.linux=230400 -generic.menu.baud.230400.macosx=230400 -generic.menu.baud.230400.upload.speed=230400 -generic.menu.baud.256000.windows=256000 -generic.menu.baud.256000.upload.speed=256000 -generic.menu.baud.460800.linux=460800 -generic.menu.baud.460800.macosx=460800 -generic.menu.baud.460800.upload.speed=460800 -generic.menu.baud.512000.windows=512000 -generic.menu.baud.512000.upload.speed=512000 -generic.menu.baud.921600=921600 -generic.menu.baud.921600.upload.speed=921600 - -############################################################## -esp8285.name=Generic ESP8285 Module -esp8285.build.board=ESP8266_ESP01 -esp8285.build.variant=esp8285 -esp8285.upload.tool=esptool -esp8285.upload.maximum_data_size=81920 -esp8285.upload.wait_for_upload_port=true -esp8285.upload.erase_cmd= -esp8285.serial.disableDTR=true -esp8285.serial.disableRTS=true -esp8285.build.mcu=esp8266 -esp8285.build.core=esp8266 -esp8285.build.spiffs_pagesize=256 -esp8285.build.debug_port= -esp8285.build.debug_level= -esp8285.menu.xtal.80=80 MHz -esp8285.menu.xtal.80.build.f_cpu=80000000L -esp8285.menu.xtal.160=160 MHz -esp8285.menu.xtal.160.build.f_cpu=160000000L -esp8285.menu.vt.flash=Flash -esp8285.menu.vt.flash.build.vtable_flags=-DVTABLES_IN_FLASH -esp8285.menu.vt.heap=Heap -esp8285.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM -esp8285.menu.vt.iram=IRAM -esp8285.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM -esp8285.menu.exception.enabled=Enabled -esp8285.menu.exception.enabled.build.exception_flags=-fexceptions -esp8285.menu.exception.enabled.build.stdcpp_lib=-lstdc++ -esp8285.menu.exception.disabled=Disabled -esp8285.menu.exception.disabled.build.exception_flags=-fno-exceptions -esp8285.menu.exception.disabled.build.stdcpp_lib=-lstdc++-nox -esp8285.menu.ResetMethod.ck=ck -esp8285.menu.ResetMethod.ck.upload.resetmethod=ck -esp8285.menu.ResetMethod.nodemcu=nodemcu -esp8285.menu.ResetMethod.nodemcu.upload.resetmethod=nodemcu -esp8285.menu.ResetMethod.none=none -esp8285.menu.ResetMethod.none.upload.resetmethod=none -esp8285.menu.ResetMethod.dtrset=dtrset -esp8285.menu.ResetMethod.dtrset.upload.resetmethod=dtrset -esp8285.menu.CrystalFreq.26=26 MHz -esp8285.menu.CrystalFreq.40=40 MHz -esp8285.menu.CrystalFreq.40.build.extra_flags=-DF_CRYSTAL=40000000 -DESP8266 -esp8285.build.flash_mode=dout -esp8285.build.flash_freq=40 -esp8285.menu.eesz.1M=1M (no SPIFFS) -esp8285.menu.eesz.1M.build.flash_size=1M -esp8285.menu.eesz.1M.build.flash_size_bytes=0x100000 -esp8285.menu.eesz.1M.build.flash_ld=eagle.flash.1m.ld -esp8285.menu.eesz.1M.build.spiffs_pagesize=256 -esp8285.menu.eesz.1M.upload.maximum_size=1023984 -esp8285.menu.eesz.1M.build.rfcal_addr=0xFC000 -esp8285.menu.eesz.1M64=1M (64K SPIFFS) -esp8285.menu.eesz.1M64.build.flash_size=1M -esp8285.menu.eesz.1M64.build.flash_size_bytes=0x100000 -esp8285.menu.eesz.1M64.build.flash_ld=eagle.flash.1m64.ld -esp8285.menu.eesz.1M64.build.spiffs_pagesize=256 -esp8285.menu.eesz.1M64.upload.maximum_size=958448 -esp8285.menu.eesz.1M64.build.rfcal_addr=0xFC000 -esp8285.menu.eesz.1M64.build.spiffs_start=0xEB000 -esp8285.menu.eesz.1M64.build.spiffs_end=0xFB000 -esp8285.menu.eesz.1M64.build.spiffs_blocksize=4096 -esp8285.menu.eesz.1M128=1M (128K SPIFFS) -esp8285.menu.eesz.1M128.build.flash_size=1M -esp8285.menu.eesz.1M128.build.flash_size_bytes=0x100000 -esp8285.menu.eesz.1M128.build.flash_ld=eagle.flash.1m128.ld -esp8285.menu.eesz.1M128.build.spiffs_pagesize=256 -esp8285.menu.eesz.1M128.upload.maximum_size=892912 -esp8285.menu.eesz.1M128.build.rfcal_addr=0xFC000 -esp8285.menu.eesz.1M128.build.spiffs_start=0xDB000 -esp8285.menu.eesz.1M128.build.spiffs_end=0xFB000 -esp8285.menu.eesz.1M128.build.spiffs_blocksize=4096 -esp8285.menu.eesz.1M144=1M (144K SPIFFS) -esp8285.menu.eesz.1M144.build.flash_size=1M -esp8285.menu.eesz.1M144.build.flash_size_bytes=0x100000 -esp8285.menu.eesz.1M144.build.flash_ld=eagle.flash.1m144.ld -esp8285.menu.eesz.1M144.build.spiffs_pagesize=256 -esp8285.menu.eesz.1M144.upload.maximum_size=876528 -esp8285.menu.eesz.1M144.build.rfcal_addr=0xFC000 -esp8285.menu.eesz.1M144.build.spiffs_start=0xD7000 -esp8285.menu.eesz.1M144.build.spiffs_end=0xFB000 -esp8285.menu.eesz.1M144.build.spiffs_blocksize=4096 -esp8285.menu.eesz.1M160=1M (160K SPIFFS) -esp8285.menu.eesz.1M160.build.flash_size=1M -esp8285.menu.eesz.1M160.build.flash_size_bytes=0x100000 -esp8285.menu.eesz.1M160.build.flash_ld=eagle.flash.1m160.ld -esp8285.menu.eesz.1M160.build.spiffs_pagesize=256 -esp8285.menu.eesz.1M160.upload.maximum_size=860144 -esp8285.menu.eesz.1M160.build.rfcal_addr=0xFC000 -esp8285.menu.eesz.1M160.build.spiffs_start=0xD3000 -esp8285.menu.eesz.1M160.build.spiffs_end=0xFB000 -esp8285.menu.eesz.1M160.build.spiffs_blocksize=4096 -esp8285.menu.eesz.1M192=1M (192K SPIFFS) -esp8285.menu.eesz.1M192.build.flash_size=1M -esp8285.menu.eesz.1M192.build.flash_size_bytes=0x100000 -esp8285.menu.eesz.1M192.build.flash_ld=eagle.flash.1m192.ld -esp8285.menu.eesz.1M192.build.spiffs_pagesize=256 -esp8285.menu.eesz.1M192.upload.maximum_size=827376 -esp8285.menu.eesz.1M192.build.rfcal_addr=0xFC000 -esp8285.menu.eesz.1M192.build.spiffs_start=0xCB000 -esp8285.menu.eesz.1M192.build.spiffs_end=0xFB000 -esp8285.menu.eesz.1M192.build.spiffs_blocksize=4096 -esp8285.menu.eesz.1M256=1M (256K SPIFFS) -esp8285.menu.eesz.1M256.build.flash_size=1M -esp8285.menu.eesz.1M256.build.flash_size_bytes=0x100000 -esp8285.menu.eesz.1M256.build.flash_ld=eagle.flash.1m256.ld -esp8285.menu.eesz.1M256.build.spiffs_pagesize=256 -esp8285.menu.eesz.1M256.upload.maximum_size=761840 -esp8285.menu.eesz.1M256.build.rfcal_addr=0xFC000 -esp8285.menu.eesz.1M256.build.spiffs_start=0xBB000 -esp8285.menu.eesz.1M256.build.spiffs_end=0xFB000 -esp8285.menu.eesz.1M256.build.spiffs_blocksize=4096 -esp8285.menu.eesz.1M512=1M (512K SPIFFS) -esp8285.menu.eesz.1M512.build.flash_size=1M -esp8285.menu.eesz.1M512.build.flash_size_bytes=0x100000 -esp8285.menu.eesz.1M512.build.flash_ld=eagle.flash.1m512.ld -esp8285.menu.eesz.1M512.build.spiffs_pagesize=256 -esp8285.menu.eesz.1M512.upload.maximum_size=499696 -esp8285.menu.eesz.1M512.build.rfcal_addr=0xFC000 -esp8285.menu.eesz.1M512.build.spiffs_start=0x7B000 -esp8285.menu.eesz.1M512.build.spiffs_end=0xFB000 -esp8285.menu.eesz.1M512.build.spiffs_blocksize=4096 -esp8285.menu.led.2=2 -esp8285.menu.led.2.build.led=-DLED_BUILTIN=2 -esp8285.menu.led.0=0 -esp8285.menu.led.0.build.led=-DLED_BUILTIN=0 -esp8285.menu.led.1=1 -esp8285.menu.led.1.build.led=-DLED_BUILTIN=1 -esp8285.menu.led.3=3 -esp8285.menu.led.3.build.led=-DLED_BUILTIN=3 -esp8285.menu.led.4=4 -esp8285.menu.led.4.build.led=-DLED_BUILTIN=4 -esp8285.menu.led.5=5 -esp8285.menu.led.5.build.led=-DLED_BUILTIN=5 -esp8285.menu.led.6=6 -esp8285.menu.led.6.build.led=-DLED_BUILTIN=6 -esp8285.menu.led.7=7 -esp8285.menu.led.7.build.led=-DLED_BUILTIN=7 -esp8285.menu.led.8=8 -esp8285.menu.led.8.build.led=-DLED_BUILTIN=8 -esp8285.menu.led.9=9 -esp8285.menu.led.9.build.led=-DLED_BUILTIN=9 -esp8285.menu.led.10=10 -esp8285.menu.led.10.build.led=-DLED_BUILTIN=10 -esp8285.menu.led.11=11 -esp8285.menu.led.11.build.led=-DLED_BUILTIN=11 -esp8285.menu.led.12=12 -esp8285.menu.led.12.build.led=-DLED_BUILTIN=12 -esp8285.menu.led.13=13 -esp8285.menu.led.13.build.led=-DLED_BUILTIN=13 -esp8285.menu.led.14=14 -esp8285.menu.led.14.build.led=-DLED_BUILTIN=14 -esp8285.menu.led.15=15 -esp8285.menu.led.15.build.led=-DLED_BUILTIN=15 -esp8285.menu.ip.lm2f=v2 Lower Memory -esp8285.menu.ip.lm2f.build.lwip_include=lwip2/include -esp8285.menu.ip.lm2f.build.lwip_lib=-llwip2-536-feat -esp8285.menu.ip.lm2f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -esp8285.menu.ip.hb2f=v2 Higher Bandwidth -esp8285.menu.ip.hb2f.build.lwip_include=lwip2/include -esp8285.menu.ip.hb2f.build.lwip_lib=-llwip2-1460-feat -esp8285.menu.ip.hb2f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -esp8285.menu.ip.lm2n=v2 Lower Memory (no features) -esp8285.menu.ip.lm2n.build.lwip_include=lwip2/include -esp8285.menu.ip.lm2n.build.lwip_lib=-llwip2-536 -esp8285.menu.ip.lm2n.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=0 -DLWIP_IPV6=0 -esp8285.menu.ip.hb2n=v2 Higher Bandwidth (no features) -esp8285.menu.ip.hb2n.build.lwip_include=lwip2/include -esp8285.menu.ip.hb2n.build.lwip_lib=-llwip2-1460 -esp8285.menu.ip.hb2n.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=0 -DLWIP_IPV6=0 -esp8285.menu.ip.lm6f=v2 IPv6 Lower Memory -esp8285.menu.ip.lm6f.build.lwip_include=lwip2/include -esp8285.menu.ip.lm6f.build.lwip_lib=-llwip6-536-feat -esp8285.menu.ip.lm6f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=1 -esp8285.menu.ip.hb6f=v2 IPv6 Higher Bandwidth -esp8285.menu.ip.hb6f.build.lwip_include=lwip2/include -esp8285.menu.ip.hb6f.build.lwip_lib=-llwip6-1460-feat -esp8285.menu.ip.hb6f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=1 -DLWIP_IPV6=1 -esp8285.menu.ip.hb1=v1.4 Higher Bandwidth -esp8285.menu.ip.hb1.build.lwip_lib=-llwip_gcc -esp8285.menu.ip.hb1.build.lwip_flags=-DLWIP_OPEN_SRC -esp8285.menu.ip.src=v1.4 Compile from source -esp8285.menu.ip.src.build.lwip_lib=-llwip_src -esp8285.menu.ip.src.build.lwip_flags=-DLWIP_OPEN_SRC -esp8285.menu.ip.src.recipe.hooks.sketch.prebuild.1.pattern=make -C "{runtime.platform.path}/tools/sdk/lwip/src" install TOOLS_PATH="{runtime.tools.xtensa-lx106-elf-gcc.path}/bin/xtensa-lx106-elf-" -esp8285.menu.dbg.Disabled=Disabled -esp8285.menu.dbg.Disabled.build.debug_port= -esp8285.menu.dbg.Serial=Serial -esp8285.menu.dbg.Serial.build.debug_port=-DDEBUG_ESP_PORT=Serial -esp8285.menu.dbg.Serial1=Serial1 -esp8285.menu.dbg.Serial1.build.debug_port=-DDEBUG_ESP_PORT=Serial1 -esp8285.menu.lvl.None____=None -esp8285.menu.lvl.None____.build.debug_level= -esp8285.menu.lvl.SSL=SSL -esp8285.menu.lvl.SSL.build.debug_level= -DDEBUG_ESP_SSL -esp8285.menu.lvl.TLS_MEM=TLS_MEM -esp8285.menu.lvl.TLS_MEM.build.debug_level= -DDEBUG_ESP_TLS_MEM -esp8285.menu.lvl.HTTP_CLIENT=HTTP_CLIENT -esp8285.menu.lvl.HTTP_CLIENT.build.debug_level= -DDEBUG_ESP_HTTP_CLIENT -esp8285.menu.lvl.HTTP_SERVER=HTTP_SERVER -esp8285.menu.lvl.HTTP_SERVER.build.debug_level= -DDEBUG_ESP_HTTP_SERVER -esp8285.menu.lvl.SSLTLS_MEM=SSL+TLS_MEM -esp8285.menu.lvl.SSLTLS_MEM.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -esp8285.menu.lvl.SSLHTTP_CLIENT=SSL+HTTP_CLIENT -esp8285.menu.lvl.SSLHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_CLIENT -esp8285.menu.lvl.SSLHTTP_SERVER=SSL+HTTP_SERVER -esp8285.menu.lvl.SSLHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_SERVER -esp8285.menu.lvl.TLS_MEMHTTP_CLIENT=TLS_MEM+HTTP_CLIENT -esp8285.menu.lvl.TLS_MEMHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -esp8285.menu.lvl.TLS_MEMHTTP_SERVER=TLS_MEM+HTTP_SERVER -esp8285.menu.lvl.TLS_MEMHTTP_SERVER.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_SERVER -esp8285.menu.lvl.HTTP_CLIENTHTTP_SERVER=HTTP_CLIENT+HTTP_SERVER -esp8285.menu.lvl.HTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -esp8285.menu.lvl.SSLTLS_MEMHTTP_CLIENT=SSL+TLS_MEM+HTTP_CLIENT -esp8285.menu.lvl.SSLTLS_MEMHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -esp8285.menu.lvl.SSLTLS_MEMHTTP_SERVER=SSL+TLS_MEM+HTTP_SERVER -esp8285.menu.lvl.SSLTLS_MEMHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_SERVER -esp8285.menu.lvl.SSLHTTP_CLIENTHTTP_SERVER=SSL+HTTP_CLIENT+HTTP_SERVER -esp8285.menu.lvl.SSLHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -esp8285.menu.lvl.TLS_MEMHTTP_CLIENTHTTP_SERVER=TLS_MEM+HTTP_CLIENT+HTTP_SERVER -esp8285.menu.lvl.TLS_MEMHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -esp8285.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVER=SSL+TLS_MEM+HTTP_CLIENT+HTTP_SERVER -esp8285.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -esp8285.menu.lvl.CORE=CORE -esp8285.menu.lvl.CORE.build.debug_level= -DDEBUG_ESP_CORE -esp8285.menu.lvl.WIFI=WIFI -esp8285.menu.lvl.WIFI.build.debug_level= -DDEBUG_ESP_WIFI -esp8285.menu.lvl.HTTP_UPDATE=HTTP_UPDATE -esp8285.menu.lvl.HTTP_UPDATE.build.debug_level= -DDEBUG_ESP_HTTP_UPDATE -esp8285.menu.lvl.UPDATER=UPDATER -esp8285.menu.lvl.UPDATER.build.debug_level= -DDEBUG_ESP_UPDATER -esp8285.menu.lvl.OTA=OTA -esp8285.menu.lvl.OTA.build.debug_level= -DDEBUG_ESP_OTA -esp8285.menu.lvl.OOM=OOM -esp8285.menu.lvl.OOM.build.debug_level= -DDEBUG_ESP_OOM -esp8285.menu.lvl.COREWIFIHTTP_UPDATEUPDATEROTAOOM=CORE+WIFI+HTTP_UPDATE+UPDATER+OTA+OOM -esp8285.menu.lvl.COREWIFIHTTP_UPDATEUPDATEROTAOOM.build.debug_level= -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM -esp8285.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVERCOREWIFIHTTP_UPDATEUPDATEROTAOOM=SSL+TLS_MEM+HTTP_CLIENT+HTTP_SERVER+CORE+WIFI+HTTP_UPDATE+UPDATER+OTA+OOM -esp8285.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVERCOREWIFIHTTP_UPDATEUPDATEROTAOOM.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM -esp8285.menu.lvl.NoAssert-NDEBUG=NoAssert-NDEBUG -esp8285.menu.lvl.NoAssert-NDEBUG.build.debug_level= -DNDEBUG -esp8285.menu.wipe.none=Only Sketch -esp8285.menu.wipe.none.upload.erase_cmd= -esp8285.menu.wipe.sdk=Sketch + WiFi Settings -esp8285.menu.wipe.sdk.upload.erase_cmd=-ca "{build.rfcal_addr}" -cz 0x4000 -esp8285.menu.wipe.all=All Flash Contents -esp8285.menu.wipe.all.upload.erase_cmd=-ca 0x0 -cz "{build.flash_size_bytes}" -esp8285.menu.baud.115200=115200 -esp8285.menu.baud.115200.upload.speed=115200 -esp8285.menu.baud.9600=9600 -esp8285.menu.baud.9600.upload.speed=9600 -esp8285.menu.baud.57600=57600 -esp8285.menu.baud.57600.upload.speed=57600 -esp8285.menu.baud.230400.linux=230400 -esp8285.menu.baud.230400.macosx=230400 -esp8285.menu.baud.230400.upload.speed=230400 -esp8285.menu.baud.256000.windows=256000 -esp8285.menu.baud.256000.upload.speed=256000 -esp8285.menu.baud.460800.linux=460800 -esp8285.menu.baud.460800.macosx=460800 -esp8285.menu.baud.460800.upload.speed=460800 -esp8285.menu.baud.512000.windows=512000 -esp8285.menu.baud.512000.upload.speed=512000 -esp8285.menu.baud.921600=921600 -esp8285.menu.baud.921600.upload.speed=921600 - -############################################################## -espduino.name=ESPDuino (ESP-13 Module) -espduino.build.board=ESP8266_ESP13 -espduino.build.variant=ESPDuino -espduino.menu.ResetMethod.v2=ESPduino-V2 -espduino.menu.ResetMethod.v2.upload.resetmethod=nodemcu -espduino.menu.ResetMethod.v1=ESPduino-V1 -espduino.menu.ResetMethod.v1.upload.resetmethod=ck -espduino.menu.UploadTool.esptool=Serial -espduino.menu.UploadTool.esptool.upload.tool=esptool -espduino.menu.UploadTool.esptool.upload.verbose=-vv -espduino.menu.UploadTool.espota=OTA -espduino.menu.UploadTool.espota.upload.tool=espota -espduino.upload.tool=esptool -espduino.upload.maximum_data_size=81920 -espduino.upload.wait_for_upload_port=true -espduino.upload.erase_cmd= -espduino.serial.disableDTR=true -espduino.serial.disableRTS=true -espduino.build.mcu=esp8266 -espduino.build.core=esp8266 -espduino.build.spiffs_pagesize=256 -espduino.build.debug_port= -espduino.build.debug_level= -espduino.menu.xtal.80=80 MHz -espduino.menu.xtal.80.build.f_cpu=80000000L -espduino.menu.xtal.160=160 MHz -espduino.menu.xtal.160.build.f_cpu=160000000L -espduino.menu.vt.flash=Flash -espduino.menu.vt.flash.build.vtable_flags=-DVTABLES_IN_FLASH -espduino.menu.vt.heap=Heap -espduino.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM -espduino.menu.vt.iram=IRAM -espduino.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM -espduino.menu.exception.enabled=Enabled -espduino.menu.exception.enabled.build.exception_flags=-fexceptions -espduino.menu.exception.enabled.build.stdcpp_lib=-lstdc++ -espduino.menu.exception.disabled=Disabled -espduino.menu.exception.disabled.build.exception_flags=-fno-exceptions -espduino.menu.exception.disabled.build.stdcpp_lib=-lstdc++-nox -espduino.build.flash_mode=dio -espduino.build.flash_freq=40 -espduino.menu.eesz.4M=4M (no SPIFFS) -espduino.menu.eesz.4M.build.flash_size=4M -espduino.menu.eesz.4M.build.flash_size_bytes=0x400000 -espduino.menu.eesz.4M.build.flash_ld=eagle.flash.4m.ld -espduino.menu.eesz.4M.build.spiffs_pagesize=256 -espduino.menu.eesz.4M.upload.maximum_size=1044464 -espduino.menu.eesz.4M.build.rfcal_addr=0x3FC000 -espduino.menu.eesz.4M1M=4M (1M SPIFFS) -espduino.menu.eesz.4M1M.build.flash_size=4M -espduino.menu.eesz.4M1M.build.flash_size_bytes=0x400000 -espduino.menu.eesz.4M1M.build.flash_ld=eagle.flash.4m1m.ld -espduino.menu.eesz.4M1M.build.spiffs_pagesize=256 -espduino.menu.eesz.4M1M.upload.maximum_size=1044464 -espduino.menu.eesz.4M1M.build.rfcal_addr=0x3FC000 -espduino.menu.eesz.4M1M.build.spiffs_start=0x300000 -espduino.menu.eesz.4M1M.build.spiffs_end=0x3FB000 -espduino.menu.eesz.4M1M.build.spiffs_blocksize=8192 -espduino.menu.eesz.4M2M=4M (2M SPIFFS) -espduino.menu.eesz.4M2M.build.flash_size=4M -espduino.menu.eesz.4M2M.build.flash_size_bytes=0x400000 -espduino.menu.eesz.4M2M.build.flash_ld=eagle.flash.4m2m.ld -espduino.menu.eesz.4M2M.build.spiffs_pagesize=256 -espduino.menu.eesz.4M2M.upload.maximum_size=1044464 -espduino.menu.eesz.4M2M.build.rfcal_addr=0x3FC000 -espduino.menu.eesz.4M2M.build.spiffs_start=0x200000 -espduino.menu.eesz.4M2M.build.spiffs_end=0x3FB000 -espduino.menu.eesz.4M2M.build.spiffs_blocksize=8192 -espduino.menu.eesz.4M3M=4M (3M SPIFFS) -espduino.menu.eesz.4M3M.build.flash_size=4M -espduino.menu.eesz.4M3M.build.flash_size_bytes=0x400000 -espduino.menu.eesz.4M3M.build.flash_ld=eagle.flash.4m3m.ld -espduino.menu.eesz.4M3M.build.spiffs_pagesize=256 -espduino.menu.eesz.4M3M.upload.maximum_size=1044464 -espduino.menu.eesz.4M3M.build.rfcal_addr=0x3FC000 -espduino.menu.eesz.4M3M.build.spiffs_start=0x100000 -espduino.menu.eesz.4M3M.build.spiffs_end=0x3FB000 -espduino.menu.eesz.4M3M.build.spiffs_blocksize=8192 -espduino.menu.ip.lm2f=v2 Lower Memory -espduino.menu.ip.lm2f.build.lwip_include=lwip2/include -espduino.menu.ip.lm2f.build.lwip_lib=-llwip2-536-feat -espduino.menu.ip.lm2f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -espduino.menu.ip.hb2f=v2 Higher Bandwidth -espduino.menu.ip.hb2f.build.lwip_include=lwip2/include -espduino.menu.ip.hb2f.build.lwip_lib=-llwip2-1460-feat -espduino.menu.ip.hb2f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -espduino.menu.ip.lm2n=v2 Lower Memory (no features) -espduino.menu.ip.lm2n.build.lwip_include=lwip2/include -espduino.menu.ip.lm2n.build.lwip_lib=-llwip2-536 -espduino.menu.ip.lm2n.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=0 -DLWIP_IPV6=0 -espduino.menu.ip.hb2n=v2 Higher Bandwidth (no features) -espduino.menu.ip.hb2n.build.lwip_include=lwip2/include -espduino.menu.ip.hb2n.build.lwip_lib=-llwip2-1460 -espduino.menu.ip.hb2n.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=0 -DLWIP_IPV6=0 -espduino.menu.ip.lm6f=v2 IPv6 Lower Memory -espduino.menu.ip.lm6f.build.lwip_include=lwip2/include -espduino.menu.ip.lm6f.build.lwip_lib=-llwip6-536-feat -espduino.menu.ip.lm6f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=1 -espduino.menu.ip.hb6f=v2 IPv6 Higher Bandwidth -espduino.menu.ip.hb6f.build.lwip_include=lwip2/include -espduino.menu.ip.hb6f.build.lwip_lib=-llwip6-1460-feat -espduino.menu.ip.hb6f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=1 -DLWIP_IPV6=1 -espduino.menu.ip.hb1=v1.4 Higher Bandwidth -espduino.menu.ip.hb1.build.lwip_lib=-llwip_gcc -espduino.menu.ip.hb1.build.lwip_flags=-DLWIP_OPEN_SRC -espduino.menu.ip.src=v1.4 Compile from source -espduino.menu.ip.src.build.lwip_lib=-llwip_src -espduino.menu.ip.src.build.lwip_flags=-DLWIP_OPEN_SRC -espduino.menu.ip.src.recipe.hooks.sketch.prebuild.1.pattern=make -C "{runtime.platform.path}/tools/sdk/lwip/src" install TOOLS_PATH="{runtime.tools.xtensa-lx106-elf-gcc.path}/bin/xtensa-lx106-elf-" -espduino.menu.dbg.Disabled=Disabled -espduino.menu.dbg.Disabled.build.debug_port= -espduino.menu.dbg.Serial=Serial -espduino.menu.dbg.Serial.build.debug_port=-DDEBUG_ESP_PORT=Serial -espduino.menu.dbg.Serial1=Serial1 -espduino.menu.dbg.Serial1.build.debug_port=-DDEBUG_ESP_PORT=Serial1 -espduino.menu.lvl.None____=None -espduino.menu.lvl.None____.build.debug_level= -espduino.menu.lvl.SSL=SSL -espduino.menu.lvl.SSL.build.debug_level= -DDEBUG_ESP_SSL -espduino.menu.lvl.TLS_MEM=TLS_MEM -espduino.menu.lvl.TLS_MEM.build.debug_level= -DDEBUG_ESP_TLS_MEM -espduino.menu.lvl.HTTP_CLIENT=HTTP_CLIENT -espduino.menu.lvl.HTTP_CLIENT.build.debug_level= -DDEBUG_ESP_HTTP_CLIENT -espduino.menu.lvl.HTTP_SERVER=HTTP_SERVER -espduino.menu.lvl.HTTP_SERVER.build.debug_level= -DDEBUG_ESP_HTTP_SERVER -espduino.menu.lvl.SSLTLS_MEM=SSL+TLS_MEM -espduino.menu.lvl.SSLTLS_MEM.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -espduino.menu.lvl.SSLHTTP_CLIENT=SSL+HTTP_CLIENT -espduino.menu.lvl.SSLHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_CLIENT -espduino.menu.lvl.SSLHTTP_SERVER=SSL+HTTP_SERVER -espduino.menu.lvl.SSLHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_SERVER -espduino.menu.lvl.TLS_MEMHTTP_CLIENT=TLS_MEM+HTTP_CLIENT -espduino.menu.lvl.TLS_MEMHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -espduino.menu.lvl.TLS_MEMHTTP_SERVER=TLS_MEM+HTTP_SERVER -espduino.menu.lvl.TLS_MEMHTTP_SERVER.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_SERVER -espduino.menu.lvl.HTTP_CLIENTHTTP_SERVER=HTTP_CLIENT+HTTP_SERVER -espduino.menu.lvl.HTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -espduino.menu.lvl.SSLTLS_MEMHTTP_CLIENT=SSL+TLS_MEM+HTTP_CLIENT -espduino.menu.lvl.SSLTLS_MEMHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -espduino.menu.lvl.SSLTLS_MEMHTTP_SERVER=SSL+TLS_MEM+HTTP_SERVER -espduino.menu.lvl.SSLTLS_MEMHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_SERVER -espduino.menu.lvl.SSLHTTP_CLIENTHTTP_SERVER=SSL+HTTP_CLIENT+HTTP_SERVER -espduino.menu.lvl.SSLHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -espduino.menu.lvl.TLS_MEMHTTP_CLIENTHTTP_SERVER=TLS_MEM+HTTP_CLIENT+HTTP_SERVER -espduino.menu.lvl.TLS_MEMHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -espduino.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVER=SSL+TLS_MEM+HTTP_CLIENT+HTTP_SERVER -espduino.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -espduino.menu.lvl.CORE=CORE -espduino.menu.lvl.CORE.build.debug_level= -DDEBUG_ESP_CORE -espduino.menu.lvl.WIFI=WIFI -espduino.menu.lvl.WIFI.build.debug_level= -DDEBUG_ESP_WIFI -espduino.menu.lvl.HTTP_UPDATE=HTTP_UPDATE -espduino.menu.lvl.HTTP_UPDATE.build.debug_level= -DDEBUG_ESP_HTTP_UPDATE -espduino.menu.lvl.UPDATER=UPDATER -espduino.menu.lvl.UPDATER.build.debug_level= -DDEBUG_ESP_UPDATER -espduino.menu.lvl.OTA=OTA -espduino.menu.lvl.OTA.build.debug_level= -DDEBUG_ESP_OTA -espduino.menu.lvl.OOM=OOM -espduino.menu.lvl.OOM.build.debug_level= -DDEBUG_ESP_OOM -espduino.menu.lvl.COREWIFIHTTP_UPDATEUPDATEROTAOOM=CORE+WIFI+HTTP_UPDATE+UPDATER+OTA+OOM -espduino.menu.lvl.COREWIFIHTTP_UPDATEUPDATEROTAOOM.build.debug_level= -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM -espduino.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVERCOREWIFIHTTP_UPDATEUPDATEROTAOOM=SSL+TLS_MEM+HTTP_CLIENT+HTTP_SERVER+CORE+WIFI+HTTP_UPDATE+UPDATER+OTA+OOM -espduino.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVERCOREWIFIHTTP_UPDATEUPDATEROTAOOM.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM -espduino.menu.lvl.NoAssert-NDEBUG=NoAssert-NDEBUG -espduino.menu.lvl.NoAssert-NDEBUG.build.debug_level= -DNDEBUG -espduino.menu.wipe.none=Only Sketch -espduino.menu.wipe.none.upload.erase_cmd= -espduino.menu.wipe.sdk=Sketch + WiFi Settings -espduino.menu.wipe.sdk.upload.erase_cmd=-ca "{build.rfcal_addr}" -cz 0x4000 -espduino.menu.wipe.all=All Flash Contents -espduino.menu.wipe.all.upload.erase_cmd=-ca 0x0 -cz "{build.flash_size_bytes}" -espduino.menu.baud.115200=115200 -espduino.menu.baud.115200.upload.speed=115200 -espduino.menu.baud.9600=9600 -espduino.menu.baud.9600.upload.speed=9600 -espduino.menu.baud.57600=57600 -espduino.menu.baud.57600.upload.speed=57600 -espduino.menu.baud.230400.linux=230400 -espduino.menu.baud.230400.macosx=230400 -espduino.menu.baud.230400.upload.speed=230400 -espduino.menu.baud.256000.windows=256000 -espduino.menu.baud.256000.upload.speed=256000 -espduino.menu.baud.460800.linux=460800 -espduino.menu.baud.460800.macosx=460800 -espduino.menu.baud.460800.upload.speed=460800 -espduino.menu.baud.512000.windows=512000 -espduino.menu.baud.512000.upload.speed=512000 -espduino.menu.baud.921600=921600 -espduino.menu.baud.921600.upload.speed=921600 - -############################################################## -huzzah.name=Adafruit Feather HUZZAH ESP8266 -huzzah.build.board=ESP8266_ESP12 -huzzah.build.variant=adafruit -huzzah.upload.tool=esptool -huzzah.upload.maximum_data_size=81920 -huzzah.upload.wait_for_upload_port=true -huzzah.upload.erase_cmd= -huzzah.serial.disableDTR=true -huzzah.serial.disableRTS=true -huzzah.build.mcu=esp8266 -huzzah.build.core=esp8266 -huzzah.build.spiffs_pagesize=256 -huzzah.build.debug_port= -huzzah.build.debug_level= -huzzah.menu.xtal.80=80 MHz -huzzah.menu.xtal.80.build.f_cpu=80000000L -huzzah.menu.xtal.160=160 MHz -huzzah.menu.xtal.160.build.f_cpu=160000000L -huzzah.menu.vt.flash=Flash -huzzah.menu.vt.flash.build.vtable_flags=-DVTABLES_IN_FLASH -huzzah.menu.vt.heap=Heap -huzzah.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM -huzzah.menu.vt.iram=IRAM -huzzah.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM -huzzah.menu.exception.enabled=Enabled -huzzah.menu.exception.enabled.build.exception_flags=-fexceptions -huzzah.menu.exception.enabled.build.stdcpp_lib=-lstdc++ -huzzah.menu.exception.disabled=Disabled -huzzah.menu.exception.disabled.build.exception_flags=-fno-exceptions -huzzah.menu.exception.disabled.build.stdcpp_lib=-lstdc++-nox -huzzah.upload.resetmethod=nodemcu -huzzah.build.flash_mode=qio -huzzah.build.flash_freq=40 -huzzah.menu.eesz.4M=4M (no SPIFFS) -huzzah.menu.eesz.4M.build.flash_size=4M -huzzah.menu.eesz.4M.build.flash_size_bytes=0x400000 -huzzah.menu.eesz.4M.build.flash_ld=eagle.flash.4m.ld -huzzah.menu.eesz.4M.build.spiffs_pagesize=256 -huzzah.menu.eesz.4M.upload.maximum_size=1044464 -huzzah.menu.eesz.4M.build.rfcal_addr=0x3FC000 -huzzah.menu.eesz.4M1M=4M (1M SPIFFS) -huzzah.menu.eesz.4M1M.build.flash_size=4M -huzzah.menu.eesz.4M1M.build.flash_size_bytes=0x400000 -huzzah.menu.eesz.4M1M.build.flash_ld=eagle.flash.4m1m.ld -huzzah.menu.eesz.4M1M.build.spiffs_pagesize=256 -huzzah.menu.eesz.4M1M.upload.maximum_size=1044464 -huzzah.menu.eesz.4M1M.build.rfcal_addr=0x3FC000 -huzzah.menu.eesz.4M1M.build.spiffs_start=0x300000 -huzzah.menu.eesz.4M1M.build.spiffs_end=0x3FB000 -huzzah.menu.eesz.4M1M.build.spiffs_blocksize=8192 -huzzah.menu.eesz.4M2M=4M (2M SPIFFS) -huzzah.menu.eesz.4M2M.build.flash_size=4M -huzzah.menu.eesz.4M2M.build.flash_size_bytes=0x400000 -huzzah.menu.eesz.4M2M.build.flash_ld=eagle.flash.4m2m.ld -huzzah.menu.eesz.4M2M.build.spiffs_pagesize=256 -huzzah.menu.eesz.4M2M.upload.maximum_size=1044464 -huzzah.menu.eesz.4M2M.build.rfcal_addr=0x3FC000 -huzzah.menu.eesz.4M2M.build.spiffs_start=0x200000 -huzzah.menu.eesz.4M2M.build.spiffs_end=0x3FB000 -huzzah.menu.eesz.4M2M.build.spiffs_blocksize=8192 -huzzah.menu.eesz.4M3M=4M (3M SPIFFS) -huzzah.menu.eesz.4M3M.build.flash_size=4M -huzzah.menu.eesz.4M3M.build.flash_size_bytes=0x400000 -huzzah.menu.eesz.4M3M.build.flash_ld=eagle.flash.4m3m.ld -huzzah.menu.eesz.4M3M.build.spiffs_pagesize=256 -huzzah.menu.eesz.4M3M.upload.maximum_size=1044464 -huzzah.menu.eesz.4M3M.build.rfcal_addr=0x3FC000 -huzzah.menu.eesz.4M3M.build.spiffs_start=0x100000 -huzzah.menu.eesz.4M3M.build.spiffs_end=0x3FB000 -huzzah.menu.eesz.4M3M.build.spiffs_blocksize=8192 -huzzah.menu.ip.lm2f=v2 Lower Memory -huzzah.menu.ip.lm2f.build.lwip_include=lwip2/include -huzzah.menu.ip.lm2f.build.lwip_lib=-llwip2-536-feat -huzzah.menu.ip.lm2f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -huzzah.menu.ip.hb2f=v2 Higher Bandwidth -huzzah.menu.ip.hb2f.build.lwip_include=lwip2/include -huzzah.menu.ip.hb2f.build.lwip_lib=-llwip2-1460-feat -huzzah.menu.ip.hb2f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -huzzah.menu.ip.lm2n=v2 Lower Memory (no features) -huzzah.menu.ip.lm2n.build.lwip_include=lwip2/include -huzzah.menu.ip.lm2n.build.lwip_lib=-llwip2-536 -huzzah.menu.ip.lm2n.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=0 -DLWIP_IPV6=0 -huzzah.menu.ip.hb2n=v2 Higher Bandwidth (no features) -huzzah.menu.ip.hb2n.build.lwip_include=lwip2/include -huzzah.menu.ip.hb2n.build.lwip_lib=-llwip2-1460 -huzzah.menu.ip.hb2n.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=0 -DLWIP_IPV6=0 -huzzah.menu.ip.lm6f=v2 IPv6 Lower Memory -huzzah.menu.ip.lm6f.build.lwip_include=lwip2/include -huzzah.menu.ip.lm6f.build.lwip_lib=-llwip6-536-feat -huzzah.menu.ip.lm6f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=1 -huzzah.menu.ip.hb6f=v2 IPv6 Higher Bandwidth -huzzah.menu.ip.hb6f.build.lwip_include=lwip2/include -huzzah.menu.ip.hb6f.build.lwip_lib=-llwip6-1460-feat -huzzah.menu.ip.hb6f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=1 -DLWIP_IPV6=1 -huzzah.menu.ip.hb1=v1.4 Higher Bandwidth -huzzah.menu.ip.hb1.build.lwip_lib=-llwip_gcc -huzzah.menu.ip.hb1.build.lwip_flags=-DLWIP_OPEN_SRC -huzzah.menu.ip.src=v1.4 Compile from source -huzzah.menu.ip.src.build.lwip_lib=-llwip_src -huzzah.menu.ip.src.build.lwip_flags=-DLWIP_OPEN_SRC -huzzah.menu.ip.src.recipe.hooks.sketch.prebuild.1.pattern=make -C "{runtime.platform.path}/tools/sdk/lwip/src" install TOOLS_PATH="{runtime.tools.xtensa-lx106-elf-gcc.path}/bin/xtensa-lx106-elf-" -huzzah.menu.dbg.Disabled=Disabled -huzzah.menu.dbg.Disabled.build.debug_port= -huzzah.menu.dbg.Serial=Serial -huzzah.menu.dbg.Serial.build.debug_port=-DDEBUG_ESP_PORT=Serial -huzzah.menu.dbg.Serial1=Serial1 -huzzah.menu.dbg.Serial1.build.debug_port=-DDEBUG_ESP_PORT=Serial1 -huzzah.menu.lvl.None____=None -huzzah.menu.lvl.None____.build.debug_level= -huzzah.menu.lvl.SSL=SSL -huzzah.menu.lvl.SSL.build.debug_level= -DDEBUG_ESP_SSL -huzzah.menu.lvl.TLS_MEM=TLS_MEM -huzzah.menu.lvl.TLS_MEM.build.debug_level= -DDEBUG_ESP_TLS_MEM -huzzah.menu.lvl.HTTP_CLIENT=HTTP_CLIENT -huzzah.menu.lvl.HTTP_CLIENT.build.debug_level= -DDEBUG_ESP_HTTP_CLIENT -huzzah.menu.lvl.HTTP_SERVER=HTTP_SERVER -huzzah.menu.lvl.HTTP_SERVER.build.debug_level= -DDEBUG_ESP_HTTP_SERVER -huzzah.menu.lvl.SSLTLS_MEM=SSL+TLS_MEM -huzzah.menu.lvl.SSLTLS_MEM.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -huzzah.menu.lvl.SSLHTTP_CLIENT=SSL+HTTP_CLIENT -huzzah.menu.lvl.SSLHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_CLIENT -huzzah.menu.lvl.SSLHTTP_SERVER=SSL+HTTP_SERVER -huzzah.menu.lvl.SSLHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_SERVER -huzzah.menu.lvl.TLS_MEMHTTP_CLIENT=TLS_MEM+HTTP_CLIENT -huzzah.menu.lvl.TLS_MEMHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -huzzah.menu.lvl.TLS_MEMHTTP_SERVER=TLS_MEM+HTTP_SERVER -huzzah.menu.lvl.TLS_MEMHTTP_SERVER.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_SERVER -huzzah.menu.lvl.HTTP_CLIENTHTTP_SERVER=HTTP_CLIENT+HTTP_SERVER -huzzah.menu.lvl.HTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -huzzah.menu.lvl.SSLTLS_MEMHTTP_CLIENT=SSL+TLS_MEM+HTTP_CLIENT -huzzah.menu.lvl.SSLTLS_MEMHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -huzzah.menu.lvl.SSLTLS_MEMHTTP_SERVER=SSL+TLS_MEM+HTTP_SERVER -huzzah.menu.lvl.SSLTLS_MEMHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_SERVER -huzzah.menu.lvl.SSLHTTP_CLIENTHTTP_SERVER=SSL+HTTP_CLIENT+HTTP_SERVER -huzzah.menu.lvl.SSLHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -huzzah.menu.lvl.TLS_MEMHTTP_CLIENTHTTP_SERVER=TLS_MEM+HTTP_CLIENT+HTTP_SERVER -huzzah.menu.lvl.TLS_MEMHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -huzzah.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVER=SSL+TLS_MEM+HTTP_CLIENT+HTTP_SERVER -huzzah.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -huzzah.menu.lvl.CORE=CORE -huzzah.menu.lvl.CORE.build.debug_level= -DDEBUG_ESP_CORE -huzzah.menu.lvl.WIFI=WIFI -huzzah.menu.lvl.WIFI.build.debug_level= -DDEBUG_ESP_WIFI -huzzah.menu.lvl.HTTP_UPDATE=HTTP_UPDATE -huzzah.menu.lvl.HTTP_UPDATE.build.debug_level= -DDEBUG_ESP_HTTP_UPDATE -huzzah.menu.lvl.UPDATER=UPDATER -huzzah.menu.lvl.UPDATER.build.debug_level= -DDEBUG_ESP_UPDATER -huzzah.menu.lvl.OTA=OTA -huzzah.menu.lvl.OTA.build.debug_level= -DDEBUG_ESP_OTA -huzzah.menu.lvl.OOM=OOM -huzzah.menu.lvl.OOM.build.debug_level= -DDEBUG_ESP_OOM -huzzah.menu.lvl.COREWIFIHTTP_UPDATEUPDATEROTAOOM=CORE+WIFI+HTTP_UPDATE+UPDATER+OTA+OOM -huzzah.menu.lvl.COREWIFIHTTP_UPDATEUPDATEROTAOOM.build.debug_level= -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM -huzzah.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVERCOREWIFIHTTP_UPDATEUPDATEROTAOOM=SSL+TLS_MEM+HTTP_CLIENT+HTTP_SERVER+CORE+WIFI+HTTP_UPDATE+UPDATER+OTA+OOM -huzzah.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVERCOREWIFIHTTP_UPDATEUPDATEROTAOOM.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM -huzzah.menu.lvl.NoAssert-NDEBUG=NoAssert-NDEBUG -huzzah.menu.lvl.NoAssert-NDEBUG.build.debug_level= -DNDEBUG -huzzah.menu.wipe.none=Only Sketch -huzzah.menu.wipe.none.upload.erase_cmd= -huzzah.menu.wipe.sdk=Sketch + WiFi Settings -huzzah.menu.wipe.sdk.upload.erase_cmd=-ca "{build.rfcal_addr}" -cz 0x4000 -huzzah.menu.wipe.all=All Flash Contents -huzzah.menu.wipe.all.upload.erase_cmd=-ca 0x0 -cz "{build.flash_size_bytes}" -huzzah.menu.baud.115200=115200 -huzzah.menu.baud.115200.upload.speed=115200 -huzzah.menu.baud.9600=9600 -huzzah.menu.baud.9600.upload.speed=9600 -huzzah.menu.baud.57600=57600 -huzzah.menu.baud.57600.upload.speed=57600 -huzzah.menu.baud.230400.linux=230400 -huzzah.menu.baud.230400.macosx=230400 -huzzah.menu.baud.230400.upload.speed=230400 -huzzah.menu.baud.256000.windows=256000 -huzzah.menu.baud.256000.upload.speed=256000 -huzzah.menu.baud.460800.linux=460800 -huzzah.menu.baud.460800.macosx=460800 -huzzah.menu.baud.460800.upload.speed=460800 -huzzah.menu.baud.512000.windows=512000 -huzzah.menu.baud.512000.upload.speed=512000 -huzzah.menu.baud.921600=921600 -huzzah.menu.baud.921600.upload.speed=921600 - -############################################################## -inventone.name=Invent One -inventone.build.board=ESP8266_GENERIC -inventone.build.variant=inventone -inventone.upload.tool=esptool -inventone.upload.maximum_data_size=81920 -inventone.upload.wait_for_upload_port=true -inventone.upload.erase_cmd= -inventone.serial.disableDTR=true -inventone.serial.disableRTS=true -inventone.build.mcu=esp8266 -inventone.build.core=esp8266 -inventone.build.spiffs_pagesize=256 -inventone.build.debug_port= -inventone.build.debug_level= -inventone.menu.xtal.80=80 MHz -inventone.menu.xtal.80.build.f_cpu=80000000L -inventone.menu.xtal.160=160 MHz -inventone.menu.xtal.160.build.f_cpu=160000000L -inventone.menu.vt.flash=Flash -inventone.menu.vt.flash.build.vtable_flags=-DVTABLES_IN_FLASH -inventone.menu.vt.heap=Heap -inventone.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM -inventone.menu.vt.iram=IRAM -inventone.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM -inventone.menu.exception.enabled=Enabled -inventone.menu.exception.enabled.build.exception_flags=-fexceptions -inventone.menu.exception.enabled.build.stdcpp_lib=-lstdc++ -inventone.menu.exception.disabled=Disabled -inventone.menu.exception.disabled.build.exception_flags=-fno-exceptions -inventone.menu.exception.disabled.build.stdcpp_lib=-lstdc++-nox -inventone.upload.resetmethod=nodemcu -inventone.build.flash_mode=dio -inventone.build.flash_freq=40 -inventone.menu.eesz.4M=4M (no SPIFFS) -inventone.menu.eesz.4M.build.flash_size=4M -inventone.menu.eesz.4M.build.flash_size_bytes=0x400000 -inventone.menu.eesz.4M.build.flash_ld=eagle.flash.4m.ld -inventone.menu.eesz.4M.build.spiffs_pagesize=256 -inventone.menu.eesz.4M.upload.maximum_size=1044464 -inventone.menu.eesz.4M.build.rfcal_addr=0x3FC000 -inventone.menu.eesz.4M1M=4M (1M SPIFFS) -inventone.menu.eesz.4M1M.build.flash_size=4M -inventone.menu.eesz.4M1M.build.flash_size_bytes=0x400000 -inventone.menu.eesz.4M1M.build.flash_ld=eagle.flash.4m1m.ld -inventone.menu.eesz.4M1M.build.spiffs_pagesize=256 -inventone.menu.eesz.4M1M.upload.maximum_size=1044464 -inventone.menu.eesz.4M1M.build.rfcal_addr=0x3FC000 -inventone.menu.eesz.4M1M.build.spiffs_start=0x300000 -inventone.menu.eesz.4M1M.build.spiffs_end=0x3FB000 -inventone.menu.eesz.4M1M.build.spiffs_blocksize=8192 -inventone.menu.eesz.4M2M=4M (2M SPIFFS) -inventone.menu.eesz.4M2M.build.flash_size=4M -inventone.menu.eesz.4M2M.build.flash_size_bytes=0x400000 -inventone.menu.eesz.4M2M.build.flash_ld=eagle.flash.4m2m.ld -inventone.menu.eesz.4M2M.build.spiffs_pagesize=256 -inventone.menu.eesz.4M2M.upload.maximum_size=1044464 -inventone.menu.eesz.4M2M.build.rfcal_addr=0x3FC000 -inventone.menu.eesz.4M2M.build.spiffs_start=0x200000 -inventone.menu.eesz.4M2M.build.spiffs_end=0x3FB000 -inventone.menu.eesz.4M2M.build.spiffs_blocksize=8192 -inventone.menu.eesz.4M3M=4M (3M SPIFFS) -inventone.menu.eesz.4M3M.build.flash_size=4M -inventone.menu.eesz.4M3M.build.flash_size_bytes=0x400000 -inventone.menu.eesz.4M3M.build.flash_ld=eagle.flash.4m3m.ld -inventone.menu.eesz.4M3M.build.spiffs_pagesize=256 -inventone.menu.eesz.4M3M.upload.maximum_size=1044464 -inventone.menu.eesz.4M3M.build.rfcal_addr=0x3FC000 -inventone.menu.eesz.4M3M.build.spiffs_start=0x100000 -inventone.menu.eesz.4M3M.build.spiffs_end=0x3FB000 -inventone.menu.eesz.4M3M.build.spiffs_blocksize=8192 -inventone.menu.ip.lm2f=v2 Lower Memory -inventone.menu.ip.lm2f.build.lwip_include=lwip2/include -inventone.menu.ip.lm2f.build.lwip_lib=-llwip2-536-feat -inventone.menu.ip.lm2f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -inventone.menu.ip.hb2f=v2 Higher Bandwidth -inventone.menu.ip.hb2f.build.lwip_include=lwip2/include -inventone.menu.ip.hb2f.build.lwip_lib=-llwip2-1460-feat -inventone.menu.ip.hb2f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -inventone.menu.ip.lm2n=v2 Lower Memory (no features) -inventone.menu.ip.lm2n.build.lwip_include=lwip2/include -inventone.menu.ip.lm2n.build.lwip_lib=-llwip2-536 -inventone.menu.ip.lm2n.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=0 -DLWIP_IPV6=0 -inventone.menu.ip.hb2n=v2 Higher Bandwidth (no features) -inventone.menu.ip.hb2n.build.lwip_include=lwip2/include -inventone.menu.ip.hb2n.build.lwip_lib=-llwip2-1460 -inventone.menu.ip.hb2n.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=0 -DLWIP_IPV6=0 -inventone.menu.ip.lm6f=v2 IPv6 Lower Memory -inventone.menu.ip.lm6f.build.lwip_include=lwip2/include -inventone.menu.ip.lm6f.build.lwip_lib=-llwip6-536-feat -inventone.menu.ip.lm6f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=1 -inventone.menu.ip.hb6f=v2 IPv6 Higher Bandwidth -inventone.menu.ip.hb6f.build.lwip_include=lwip2/include -inventone.menu.ip.hb6f.build.lwip_lib=-llwip6-1460-feat -inventone.menu.ip.hb6f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=1 -DLWIP_IPV6=1 -inventone.menu.ip.hb1=v1.4 Higher Bandwidth -inventone.menu.ip.hb1.build.lwip_lib=-llwip_gcc -inventone.menu.ip.hb1.build.lwip_flags=-DLWIP_OPEN_SRC -inventone.menu.ip.src=v1.4 Compile from source -inventone.menu.ip.src.build.lwip_lib=-llwip_src -inventone.menu.ip.src.build.lwip_flags=-DLWIP_OPEN_SRC -inventone.menu.ip.src.recipe.hooks.sketch.prebuild.1.pattern=make -C "{runtime.platform.path}/tools/sdk/lwip/src" install TOOLS_PATH="{runtime.tools.xtensa-lx106-elf-gcc.path}/bin/xtensa-lx106-elf-" -inventone.menu.dbg.Disabled=Disabled -inventone.menu.dbg.Disabled.build.debug_port= -inventone.menu.dbg.Serial=Serial -inventone.menu.dbg.Serial.build.debug_port=-DDEBUG_ESP_PORT=Serial -inventone.menu.dbg.Serial1=Serial1 -inventone.menu.dbg.Serial1.build.debug_port=-DDEBUG_ESP_PORT=Serial1 -inventone.menu.lvl.None____=None -inventone.menu.lvl.None____.build.debug_level= -inventone.menu.lvl.SSL=SSL -inventone.menu.lvl.SSL.build.debug_level= -DDEBUG_ESP_SSL -inventone.menu.lvl.TLS_MEM=TLS_MEM -inventone.menu.lvl.TLS_MEM.build.debug_level= -DDEBUG_ESP_TLS_MEM -inventone.menu.lvl.HTTP_CLIENT=HTTP_CLIENT -inventone.menu.lvl.HTTP_CLIENT.build.debug_level= -DDEBUG_ESP_HTTP_CLIENT -inventone.menu.lvl.HTTP_SERVER=HTTP_SERVER -inventone.menu.lvl.HTTP_SERVER.build.debug_level= -DDEBUG_ESP_HTTP_SERVER -inventone.menu.lvl.SSLTLS_MEM=SSL+TLS_MEM -inventone.menu.lvl.SSLTLS_MEM.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -inventone.menu.lvl.SSLHTTP_CLIENT=SSL+HTTP_CLIENT -inventone.menu.lvl.SSLHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_CLIENT -inventone.menu.lvl.SSLHTTP_SERVER=SSL+HTTP_SERVER -inventone.menu.lvl.SSLHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_SERVER -inventone.menu.lvl.TLS_MEMHTTP_CLIENT=TLS_MEM+HTTP_CLIENT -inventone.menu.lvl.TLS_MEMHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -inventone.menu.lvl.TLS_MEMHTTP_SERVER=TLS_MEM+HTTP_SERVER -inventone.menu.lvl.TLS_MEMHTTP_SERVER.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_SERVER -inventone.menu.lvl.HTTP_CLIENTHTTP_SERVER=HTTP_CLIENT+HTTP_SERVER -inventone.menu.lvl.HTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -inventone.menu.lvl.SSLTLS_MEMHTTP_CLIENT=SSL+TLS_MEM+HTTP_CLIENT -inventone.menu.lvl.SSLTLS_MEMHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -inventone.menu.lvl.SSLTLS_MEMHTTP_SERVER=SSL+TLS_MEM+HTTP_SERVER -inventone.menu.lvl.SSLTLS_MEMHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_SERVER -inventone.menu.lvl.SSLHTTP_CLIENTHTTP_SERVER=SSL+HTTP_CLIENT+HTTP_SERVER -inventone.menu.lvl.SSLHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -inventone.menu.lvl.TLS_MEMHTTP_CLIENTHTTP_SERVER=TLS_MEM+HTTP_CLIENT+HTTP_SERVER -inventone.menu.lvl.TLS_MEMHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -inventone.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVER=SSL+TLS_MEM+HTTP_CLIENT+HTTP_SERVER -inventone.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -inventone.menu.lvl.CORE=CORE -inventone.menu.lvl.CORE.build.debug_level= -DDEBUG_ESP_CORE -inventone.menu.lvl.WIFI=WIFI -inventone.menu.lvl.WIFI.build.debug_level= -DDEBUG_ESP_WIFI -inventone.menu.lvl.HTTP_UPDATE=HTTP_UPDATE -inventone.menu.lvl.HTTP_UPDATE.build.debug_level= -DDEBUG_ESP_HTTP_UPDATE -inventone.menu.lvl.UPDATER=UPDATER -inventone.menu.lvl.UPDATER.build.debug_level= -DDEBUG_ESP_UPDATER -inventone.menu.lvl.OTA=OTA -inventone.menu.lvl.OTA.build.debug_level= -DDEBUG_ESP_OTA -inventone.menu.lvl.OOM=OOM -inventone.menu.lvl.OOM.build.debug_level= -DDEBUG_ESP_OOM -inventone.menu.lvl.COREWIFIHTTP_UPDATEUPDATEROTAOOM=CORE+WIFI+HTTP_UPDATE+UPDATER+OTA+OOM -inventone.menu.lvl.COREWIFIHTTP_UPDATEUPDATEROTAOOM.build.debug_level= -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM -inventone.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVERCOREWIFIHTTP_UPDATEUPDATEROTAOOM=SSL+TLS_MEM+HTTP_CLIENT+HTTP_SERVER+CORE+WIFI+HTTP_UPDATE+UPDATER+OTA+OOM -inventone.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVERCOREWIFIHTTP_UPDATEUPDATEROTAOOM.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM -inventone.menu.lvl.NoAssert-NDEBUG=NoAssert-NDEBUG -inventone.menu.lvl.NoAssert-NDEBUG.build.debug_level= -DNDEBUG -inventone.menu.wipe.none=Only Sketch -inventone.menu.wipe.none.upload.erase_cmd= -inventone.menu.wipe.sdk=Sketch + WiFi Settings -inventone.menu.wipe.sdk.upload.erase_cmd=-ca "{build.rfcal_addr}" -cz 0x4000 -inventone.menu.wipe.all=All Flash Contents -inventone.menu.wipe.all.upload.erase_cmd=-ca 0x0 -cz "{build.flash_size_bytes}" -inventone.menu.baud.115200=115200 -inventone.menu.baud.115200.upload.speed=115200 -inventone.menu.baud.9600=9600 -inventone.menu.baud.9600.upload.speed=9600 -inventone.menu.baud.57600=57600 -inventone.menu.baud.57600.upload.speed=57600 -inventone.menu.baud.230400.linux=230400 -inventone.menu.baud.230400.macosx=230400 -inventone.menu.baud.230400.upload.speed=230400 -inventone.menu.baud.256000.windows=256000 -inventone.menu.baud.256000.upload.speed=256000 -inventone.menu.baud.460800.linux=460800 -inventone.menu.baud.460800.macosx=460800 -inventone.menu.baud.460800.upload.speed=460800 -inventone.menu.baud.512000.windows=512000 -inventone.menu.baud.512000.upload.speed=512000 -inventone.menu.baud.921600=921600 -inventone.menu.baud.921600.upload.speed=921600 - -############################################################## -cw01.name=XinaBox CW01 -cw01.build.board=ESP8266_GENERIC -cw01.build.variant=xinabox -cw01.upload.tool=esptool -cw01.upload.maximum_data_size=81920 -cw01.upload.wait_for_upload_port=true -cw01.upload.erase_cmd= -cw01.serial.disableDTR=true -cw01.serial.disableRTS=true -cw01.build.mcu=esp8266 -cw01.build.core=esp8266 -cw01.build.spiffs_pagesize=256 -cw01.build.debug_port= -cw01.build.debug_level= -cw01.menu.xtal.80=80 MHz -cw01.menu.xtal.80.build.f_cpu=80000000L -cw01.menu.xtal.160=160 MHz -cw01.menu.xtal.160.build.f_cpu=160000000L -cw01.menu.vt.flash=Flash -cw01.menu.vt.flash.build.vtable_flags=-DVTABLES_IN_FLASH -cw01.menu.vt.heap=Heap -cw01.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM -cw01.menu.vt.iram=IRAM -cw01.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM -cw01.menu.exception.enabled=Enabled -cw01.menu.exception.enabled.build.exception_flags=-fexceptions -cw01.menu.exception.enabled.build.stdcpp_lib=-lstdc++ -cw01.menu.exception.disabled=Disabled -cw01.menu.exception.disabled.build.exception_flags=-fno-exceptions -cw01.menu.exception.disabled.build.stdcpp_lib=-lstdc++-nox -cw01.upload.resetmethod=nodemcu -cw01.menu.CrystalFreq.26=26 MHz -cw01.menu.CrystalFreq.40=40 MHz -cw01.menu.CrystalFreq.40.build.extra_flags=-DF_CRYSTAL=40000000 -DESP8266 -cw01.build.flash_mode=qio -cw01.build.flash_freq=40 -cw01.menu.eesz.4M=4M (no SPIFFS) -cw01.menu.eesz.4M.build.flash_size=4M -cw01.menu.eesz.4M.build.flash_size_bytes=0x400000 -cw01.menu.eesz.4M.build.flash_ld=eagle.flash.4m.ld -cw01.menu.eesz.4M.build.spiffs_pagesize=256 -cw01.menu.eesz.4M.upload.maximum_size=1044464 -cw01.menu.eesz.4M.build.rfcal_addr=0x3FC000 -cw01.menu.eesz.4M1M=4M (1M SPIFFS) -cw01.menu.eesz.4M1M.build.flash_size=4M -cw01.menu.eesz.4M1M.build.flash_size_bytes=0x400000 -cw01.menu.eesz.4M1M.build.flash_ld=eagle.flash.4m1m.ld -cw01.menu.eesz.4M1M.build.spiffs_pagesize=256 -cw01.menu.eesz.4M1M.upload.maximum_size=1044464 -cw01.menu.eesz.4M1M.build.rfcal_addr=0x3FC000 -cw01.menu.eesz.4M1M.build.spiffs_start=0x300000 -cw01.menu.eesz.4M1M.build.spiffs_end=0x3FB000 -cw01.menu.eesz.4M1M.build.spiffs_blocksize=8192 -cw01.menu.eesz.4M2M=4M (2M SPIFFS) -cw01.menu.eesz.4M2M.build.flash_size=4M -cw01.menu.eesz.4M2M.build.flash_size_bytes=0x400000 -cw01.menu.eesz.4M2M.build.flash_ld=eagle.flash.4m2m.ld -cw01.menu.eesz.4M2M.build.spiffs_pagesize=256 -cw01.menu.eesz.4M2M.upload.maximum_size=1044464 -cw01.menu.eesz.4M2M.build.rfcal_addr=0x3FC000 -cw01.menu.eesz.4M2M.build.spiffs_start=0x200000 -cw01.menu.eesz.4M2M.build.spiffs_end=0x3FB000 -cw01.menu.eesz.4M2M.build.spiffs_blocksize=8192 -cw01.menu.eesz.4M3M=4M (3M SPIFFS) -cw01.menu.eesz.4M3M.build.flash_size=4M -cw01.menu.eesz.4M3M.build.flash_size_bytes=0x400000 -cw01.menu.eesz.4M3M.build.flash_ld=eagle.flash.4m3m.ld -cw01.menu.eesz.4M3M.build.spiffs_pagesize=256 -cw01.menu.eesz.4M3M.upload.maximum_size=1044464 -cw01.menu.eesz.4M3M.build.rfcal_addr=0x3FC000 -cw01.menu.eesz.4M3M.build.spiffs_start=0x100000 -cw01.menu.eesz.4M3M.build.spiffs_end=0x3FB000 -cw01.menu.eesz.4M3M.build.spiffs_blocksize=8192 -cw01.menu.ip.lm2f=v2 Lower Memory -cw01.menu.ip.lm2f.build.lwip_include=lwip2/include -cw01.menu.ip.lm2f.build.lwip_lib=-llwip2-536-feat -cw01.menu.ip.lm2f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -cw01.menu.ip.hb2f=v2 Higher Bandwidth -cw01.menu.ip.hb2f.build.lwip_include=lwip2/include -cw01.menu.ip.hb2f.build.lwip_lib=-llwip2-1460-feat -cw01.menu.ip.hb2f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -cw01.menu.ip.lm2n=v2 Lower Memory (no features) -cw01.menu.ip.lm2n.build.lwip_include=lwip2/include -cw01.menu.ip.lm2n.build.lwip_lib=-llwip2-536 -cw01.menu.ip.lm2n.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=0 -DLWIP_IPV6=0 -cw01.menu.ip.hb2n=v2 Higher Bandwidth (no features) -cw01.menu.ip.hb2n.build.lwip_include=lwip2/include -cw01.menu.ip.hb2n.build.lwip_lib=-llwip2-1460 -cw01.menu.ip.hb2n.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=0 -DLWIP_IPV6=0 -cw01.menu.ip.lm6f=v2 IPv6 Lower Memory -cw01.menu.ip.lm6f.build.lwip_include=lwip2/include -cw01.menu.ip.lm6f.build.lwip_lib=-llwip6-536-feat -cw01.menu.ip.lm6f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=1 -cw01.menu.ip.hb6f=v2 IPv6 Higher Bandwidth -cw01.menu.ip.hb6f.build.lwip_include=lwip2/include -cw01.menu.ip.hb6f.build.lwip_lib=-llwip6-1460-feat -cw01.menu.ip.hb6f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=1 -DLWIP_IPV6=1 -cw01.menu.ip.hb1=v1.4 Higher Bandwidth -cw01.menu.ip.hb1.build.lwip_lib=-llwip_gcc -cw01.menu.ip.hb1.build.lwip_flags=-DLWIP_OPEN_SRC -cw01.menu.ip.src=v1.4 Compile from source -cw01.menu.ip.src.build.lwip_lib=-llwip_src -cw01.menu.ip.src.build.lwip_flags=-DLWIP_OPEN_SRC -cw01.menu.ip.src.recipe.hooks.sketch.prebuild.1.pattern=make -C "{runtime.platform.path}/tools/sdk/lwip/src" install TOOLS_PATH="{runtime.tools.xtensa-lx106-elf-gcc.path}/bin/xtensa-lx106-elf-" -cw01.menu.dbg.Disabled=Disabled -cw01.menu.dbg.Disabled.build.debug_port= -cw01.menu.dbg.Serial=Serial -cw01.menu.dbg.Serial.build.debug_port=-DDEBUG_ESP_PORT=Serial -cw01.menu.dbg.Serial1=Serial1 -cw01.menu.dbg.Serial1.build.debug_port=-DDEBUG_ESP_PORT=Serial1 -cw01.menu.lvl.None____=None -cw01.menu.lvl.None____.build.debug_level= -cw01.menu.lvl.SSL=SSL -cw01.menu.lvl.SSL.build.debug_level= -DDEBUG_ESP_SSL -cw01.menu.lvl.TLS_MEM=TLS_MEM -cw01.menu.lvl.TLS_MEM.build.debug_level= -DDEBUG_ESP_TLS_MEM -cw01.menu.lvl.HTTP_CLIENT=HTTP_CLIENT -cw01.menu.lvl.HTTP_CLIENT.build.debug_level= -DDEBUG_ESP_HTTP_CLIENT -cw01.menu.lvl.HTTP_SERVER=HTTP_SERVER -cw01.menu.lvl.HTTP_SERVER.build.debug_level= -DDEBUG_ESP_HTTP_SERVER -cw01.menu.lvl.SSLTLS_MEM=SSL+TLS_MEM -cw01.menu.lvl.SSLTLS_MEM.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -cw01.menu.lvl.SSLHTTP_CLIENT=SSL+HTTP_CLIENT -cw01.menu.lvl.SSLHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_CLIENT -cw01.menu.lvl.SSLHTTP_SERVER=SSL+HTTP_SERVER -cw01.menu.lvl.SSLHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_SERVER -cw01.menu.lvl.TLS_MEMHTTP_CLIENT=TLS_MEM+HTTP_CLIENT -cw01.menu.lvl.TLS_MEMHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -cw01.menu.lvl.TLS_MEMHTTP_SERVER=TLS_MEM+HTTP_SERVER -cw01.menu.lvl.TLS_MEMHTTP_SERVER.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_SERVER -cw01.menu.lvl.HTTP_CLIENTHTTP_SERVER=HTTP_CLIENT+HTTP_SERVER -cw01.menu.lvl.HTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -cw01.menu.lvl.SSLTLS_MEMHTTP_CLIENT=SSL+TLS_MEM+HTTP_CLIENT -cw01.menu.lvl.SSLTLS_MEMHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -cw01.menu.lvl.SSLTLS_MEMHTTP_SERVER=SSL+TLS_MEM+HTTP_SERVER -cw01.menu.lvl.SSLTLS_MEMHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_SERVER -cw01.menu.lvl.SSLHTTP_CLIENTHTTP_SERVER=SSL+HTTP_CLIENT+HTTP_SERVER -cw01.menu.lvl.SSLHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -cw01.menu.lvl.TLS_MEMHTTP_CLIENTHTTP_SERVER=TLS_MEM+HTTP_CLIENT+HTTP_SERVER -cw01.menu.lvl.TLS_MEMHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -cw01.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVER=SSL+TLS_MEM+HTTP_CLIENT+HTTP_SERVER -cw01.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -cw01.menu.lvl.CORE=CORE -cw01.menu.lvl.CORE.build.debug_level= -DDEBUG_ESP_CORE -cw01.menu.lvl.WIFI=WIFI -cw01.menu.lvl.WIFI.build.debug_level= -DDEBUG_ESP_WIFI -cw01.menu.lvl.HTTP_UPDATE=HTTP_UPDATE -cw01.menu.lvl.HTTP_UPDATE.build.debug_level= -DDEBUG_ESP_HTTP_UPDATE -cw01.menu.lvl.UPDATER=UPDATER -cw01.menu.lvl.UPDATER.build.debug_level= -DDEBUG_ESP_UPDATER -cw01.menu.lvl.OTA=OTA -cw01.menu.lvl.OTA.build.debug_level= -DDEBUG_ESP_OTA -cw01.menu.lvl.OOM=OOM -cw01.menu.lvl.OOM.build.debug_level= -DDEBUG_ESP_OOM -cw01.menu.lvl.COREWIFIHTTP_UPDATEUPDATEROTAOOM=CORE+WIFI+HTTP_UPDATE+UPDATER+OTA+OOM -cw01.menu.lvl.COREWIFIHTTP_UPDATEUPDATEROTAOOM.build.debug_level= -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM -cw01.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVERCOREWIFIHTTP_UPDATEUPDATEROTAOOM=SSL+TLS_MEM+HTTP_CLIENT+HTTP_SERVER+CORE+WIFI+HTTP_UPDATE+UPDATER+OTA+OOM -cw01.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVERCOREWIFIHTTP_UPDATEUPDATEROTAOOM.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM -cw01.menu.lvl.NoAssert-NDEBUG=NoAssert-NDEBUG -cw01.menu.lvl.NoAssert-NDEBUG.build.debug_level= -DNDEBUG -cw01.menu.wipe.none=Only Sketch -cw01.menu.wipe.none.upload.erase_cmd= -cw01.menu.wipe.sdk=Sketch + WiFi Settings -cw01.menu.wipe.sdk.upload.erase_cmd=-ca "{build.rfcal_addr}" -cz 0x4000 -cw01.menu.wipe.all=All Flash Contents -cw01.menu.wipe.all.upload.erase_cmd=-ca 0x0 -cz "{build.flash_size_bytes}" -cw01.menu.baud.115200=115200 -cw01.menu.baud.115200.upload.speed=115200 -cw01.menu.baud.9600=9600 -cw01.menu.baud.9600.upload.speed=9600 -cw01.menu.baud.57600=57600 -cw01.menu.baud.57600.upload.speed=57600 -cw01.menu.baud.230400.linux=230400 -cw01.menu.baud.230400.macosx=230400 -cw01.menu.baud.230400.upload.speed=230400 -cw01.menu.baud.256000.windows=256000 -cw01.menu.baud.256000.upload.speed=256000 -cw01.menu.baud.460800.linux=460800 -cw01.menu.baud.460800.macosx=460800 -cw01.menu.baud.460800.upload.speed=460800 -cw01.menu.baud.512000.windows=512000 -cw01.menu.baud.512000.upload.speed=512000 -cw01.menu.baud.921600=921600 -cw01.menu.baud.921600.upload.speed=921600 - -############################################################## -espresso_lite_v1.name=ESPresso Lite 1.0 -espresso_lite_v1.build.board=ESP8266_ESPRESSO_LITE_V1 -espresso_lite_v1.build.variant=espresso_lite_v1 -espresso_lite_v1.upload.tool=esptool -espresso_lite_v1.upload.maximum_data_size=81920 -espresso_lite_v1.upload.wait_for_upload_port=true -espresso_lite_v1.upload.erase_cmd= -espresso_lite_v1.serial.disableDTR=true -espresso_lite_v1.serial.disableRTS=true -espresso_lite_v1.build.mcu=esp8266 -espresso_lite_v1.build.core=esp8266 -espresso_lite_v1.build.spiffs_pagesize=256 -espresso_lite_v1.build.debug_port= -espresso_lite_v1.build.debug_level= -espresso_lite_v1.menu.xtal.80=80 MHz -espresso_lite_v1.menu.xtal.80.build.f_cpu=80000000L -espresso_lite_v1.menu.xtal.160=160 MHz -espresso_lite_v1.menu.xtal.160.build.f_cpu=160000000L -espresso_lite_v1.menu.vt.flash=Flash -espresso_lite_v1.menu.vt.flash.build.vtable_flags=-DVTABLES_IN_FLASH -espresso_lite_v1.menu.vt.heap=Heap -espresso_lite_v1.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM -espresso_lite_v1.menu.vt.iram=IRAM -espresso_lite_v1.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM -espresso_lite_v1.menu.exception.enabled=Enabled -espresso_lite_v1.menu.exception.enabled.build.exception_flags=-fexceptions -espresso_lite_v1.menu.exception.enabled.build.stdcpp_lib=-lstdc++ -espresso_lite_v1.menu.exception.disabled=Disabled -espresso_lite_v1.menu.exception.disabled.build.exception_flags=-fno-exceptions -espresso_lite_v1.menu.exception.disabled.build.stdcpp_lib=-lstdc++-nox -espresso_lite_v1.build.flash_mode=dio -espresso_lite_v1.build.flash_freq=40 -espresso_lite_v1.menu.eesz.4M=4M (no SPIFFS) -espresso_lite_v1.menu.eesz.4M.build.flash_size=4M -espresso_lite_v1.menu.eesz.4M.build.flash_size_bytes=0x400000 -espresso_lite_v1.menu.eesz.4M.build.flash_ld=eagle.flash.4m.ld -espresso_lite_v1.menu.eesz.4M.build.spiffs_pagesize=256 -espresso_lite_v1.menu.eesz.4M.upload.maximum_size=1044464 -espresso_lite_v1.menu.eesz.4M.build.rfcal_addr=0x3FC000 -espresso_lite_v1.menu.eesz.4M1M=4M (1M SPIFFS) -espresso_lite_v1.menu.eesz.4M1M.build.flash_size=4M -espresso_lite_v1.menu.eesz.4M1M.build.flash_size_bytes=0x400000 -espresso_lite_v1.menu.eesz.4M1M.build.flash_ld=eagle.flash.4m1m.ld -espresso_lite_v1.menu.eesz.4M1M.build.spiffs_pagesize=256 -espresso_lite_v1.menu.eesz.4M1M.upload.maximum_size=1044464 -espresso_lite_v1.menu.eesz.4M1M.build.rfcal_addr=0x3FC000 -espresso_lite_v1.menu.eesz.4M1M.build.spiffs_start=0x300000 -espresso_lite_v1.menu.eesz.4M1M.build.spiffs_end=0x3FB000 -espresso_lite_v1.menu.eesz.4M1M.build.spiffs_blocksize=8192 -espresso_lite_v1.menu.eesz.4M2M=4M (2M SPIFFS) -espresso_lite_v1.menu.eesz.4M2M.build.flash_size=4M -espresso_lite_v1.menu.eesz.4M2M.build.flash_size_bytes=0x400000 -espresso_lite_v1.menu.eesz.4M2M.build.flash_ld=eagle.flash.4m2m.ld -espresso_lite_v1.menu.eesz.4M2M.build.spiffs_pagesize=256 -espresso_lite_v1.menu.eesz.4M2M.upload.maximum_size=1044464 -espresso_lite_v1.menu.eesz.4M2M.build.rfcal_addr=0x3FC000 -espresso_lite_v1.menu.eesz.4M2M.build.spiffs_start=0x200000 -espresso_lite_v1.menu.eesz.4M2M.build.spiffs_end=0x3FB000 -espresso_lite_v1.menu.eesz.4M2M.build.spiffs_blocksize=8192 -espresso_lite_v1.menu.eesz.4M3M=4M (3M SPIFFS) -espresso_lite_v1.menu.eesz.4M3M.build.flash_size=4M -espresso_lite_v1.menu.eesz.4M3M.build.flash_size_bytes=0x400000 -espresso_lite_v1.menu.eesz.4M3M.build.flash_ld=eagle.flash.4m3m.ld -espresso_lite_v1.menu.eesz.4M3M.build.spiffs_pagesize=256 -espresso_lite_v1.menu.eesz.4M3M.upload.maximum_size=1044464 -espresso_lite_v1.menu.eesz.4M3M.build.rfcal_addr=0x3FC000 -espresso_lite_v1.menu.eesz.4M3M.build.spiffs_start=0x100000 -espresso_lite_v1.menu.eesz.4M3M.build.spiffs_end=0x3FB000 -espresso_lite_v1.menu.eesz.4M3M.build.spiffs_blocksize=8192 -espresso_lite_v1.menu.ResetMethod.ck=ck -espresso_lite_v1.menu.ResetMethod.ck.upload.resetmethod=ck -espresso_lite_v1.menu.ResetMethod.nodemcu=nodemcu -espresso_lite_v1.menu.ResetMethod.nodemcu.upload.resetmethod=nodemcu -espresso_lite_v1.menu.ip.lm2f=v2 Lower Memory -espresso_lite_v1.menu.ip.lm2f.build.lwip_include=lwip2/include -espresso_lite_v1.menu.ip.lm2f.build.lwip_lib=-llwip2-536-feat -espresso_lite_v1.menu.ip.lm2f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -espresso_lite_v1.menu.ip.hb2f=v2 Higher Bandwidth -espresso_lite_v1.menu.ip.hb2f.build.lwip_include=lwip2/include -espresso_lite_v1.menu.ip.hb2f.build.lwip_lib=-llwip2-1460-feat -espresso_lite_v1.menu.ip.hb2f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -espresso_lite_v1.menu.ip.lm2n=v2 Lower Memory (no features) -espresso_lite_v1.menu.ip.lm2n.build.lwip_include=lwip2/include -espresso_lite_v1.menu.ip.lm2n.build.lwip_lib=-llwip2-536 -espresso_lite_v1.menu.ip.lm2n.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=0 -DLWIP_IPV6=0 -espresso_lite_v1.menu.ip.hb2n=v2 Higher Bandwidth (no features) -espresso_lite_v1.menu.ip.hb2n.build.lwip_include=lwip2/include -espresso_lite_v1.menu.ip.hb2n.build.lwip_lib=-llwip2-1460 -espresso_lite_v1.menu.ip.hb2n.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=0 -DLWIP_IPV6=0 -espresso_lite_v1.menu.ip.lm6f=v2 IPv6 Lower Memory -espresso_lite_v1.menu.ip.lm6f.build.lwip_include=lwip2/include -espresso_lite_v1.menu.ip.lm6f.build.lwip_lib=-llwip6-536-feat -espresso_lite_v1.menu.ip.lm6f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=1 -espresso_lite_v1.menu.ip.hb6f=v2 IPv6 Higher Bandwidth -espresso_lite_v1.menu.ip.hb6f.build.lwip_include=lwip2/include -espresso_lite_v1.menu.ip.hb6f.build.lwip_lib=-llwip6-1460-feat -espresso_lite_v1.menu.ip.hb6f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=1 -DLWIP_IPV6=1 -espresso_lite_v1.menu.ip.hb1=v1.4 Higher Bandwidth -espresso_lite_v1.menu.ip.hb1.build.lwip_lib=-llwip_gcc -espresso_lite_v1.menu.ip.hb1.build.lwip_flags=-DLWIP_OPEN_SRC -espresso_lite_v1.menu.ip.src=v1.4 Compile from source -espresso_lite_v1.menu.ip.src.build.lwip_lib=-llwip_src -espresso_lite_v1.menu.ip.src.build.lwip_flags=-DLWIP_OPEN_SRC -espresso_lite_v1.menu.ip.src.recipe.hooks.sketch.prebuild.1.pattern=make -C "{runtime.platform.path}/tools/sdk/lwip/src" install TOOLS_PATH="{runtime.tools.xtensa-lx106-elf-gcc.path}/bin/xtensa-lx106-elf-" -espresso_lite_v1.menu.dbg.Disabled=Disabled -espresso_lite_v1.menu.dbg.Disabled.build.debug_port= -espresso_lite_v1.menu.dbg.Serial=Serial -espresso_lite_v1.menu.dbg.Serial.build.debug_port=-DDEBUG_ESP_PORT=Serial -espresso_lite_v1.menu.dbg.Serial1=Serial1 -espresso_lite_v1.menu.dbg.Serial1.build.debug_port=-DDEBUG_ESP_PORT=Serial1 -espresso_lite_v1.menu.lvl.None____=None -espresso_lite_v1.menu.lvl.None____.build.debug_level= -espresso_lite_v1.menu.lvl.SSL=SSL -espresso_lite_v1.menu.lvl.SSL.build.debug_level= -DDEBUG_ESP_SSL -espresso_lite_v1.menu.lvl.TLS_MEM=TLS_MEM -espresso_lite_v1.menu.lvl.TLS_MEM.build.debug_level= -DDEBUG_ESP_TLS_MEM -espresso_lite_v1.menu.lvl.HTTP_CLIENT=HTTP_CLIENT -espresso_lite_v1.menu.lvl.HTTP_CLIENT.build.debug_level= -DDEBUG_ESP_HTTP_CLIENT -espresso_lite_v1.menu.lvl.HTTP_SERVER=HTTP_SERVER -espresso_lite_v1.menu.lvl.HTTP_SERVER.build.debug_level= -DDEBUG_ESP_HTTP_SERVER -espresso_lite_v1.menu.lvl.SSLTLS_MEM=SSL+TLS_MEM -espresso_lite_v1.menu.lvl.SSLTLS_MEM.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -espresso_lite_v1.menu.lvl.SSLHTTP_CLIENT=SSL+HTTP_CLIENT -espresso_lite_v1.menu.lvl.SSLHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_CLIENT -espresso_lite_v1.menu.lvl.SSLHTTP_SERVER=SSL+HTTP_SERVER -espresso_lite_v1.menu.lvl.SSLHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_SERVER -espresso_lite_v1.menu.lvl.TLS_MEMHTTP_CLIENT=TLS_MEM+HTTP_CLIENT -espresso_lite_v1.menu.lvl.TLS_MEMHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -espresso_lite_v1.menu.lvl.TLS_MEMHTTP_SERVER=TLS_MEM+HTTP_SERVER -espresso_lite_v1.menu.lvl.TLS_MEMHTTP_SERVER.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_SERVER -espresso_lite_v1.menu.lvl.HTTP_CLIENTHTTP_SERVER=HTTP_CLIENT+HTTP_SERVER -espresso_lite_v1.menu.lvl.HTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -espresso_lite_v1.menu.lvl.SSLTLS_MEMHTTP_CLIENT=SSL+TLS_MEM+HTTP_CLIENT -espresso_lite_v1.menu.lvl.SSLTLS_MEMHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -espresso_lite_v1.menu.lvl.SSLTLS_MEMHTTP_SERVER=SSL+TLS_MEM+HTTP_SERVER -espresso_lite_v1.menu.lvl.SSLTLS_MEMHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_SERVER -espresso_lite_v1.menu.lvl.SSLHTTP_CLIENTHTTP_SERVER=SSL+HTTP_CLIENT+HTTP_SERVER -espresso_lite_v1.menu.lvl.SSLHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -espresso_lite_v1.menu.lvl.TLS_MEMHTTP_CLIENTHTTP_SERVER=TLS_MEM+HTTP_CLIENT+HTTP_SERVER -espresso_lite_v1.menu.lvl.TLS_MEMHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -espresso_lite_v1.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVER=SSL+TLS_MEM+HTTP_CLIENT+HTTP_SERVER -espresso_lite_v1.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -espresso_lite_v1.menu.lvl.CORE=CORE -espresso_lite_v1.menu.lvl.CORE.build.debug_level= -DDEBUG_ESP_CORE -espresso_lite_v1.menu.lvl.WIFI=WIFI -espresso_lite_v1.menu.lvl.WIFI.build.debug_level= -DDEBUG_ESP_WIFI -espresso_lite_v1.menu.lvl.HTTP_UPDATE=HTTP_UPDATE -espresso_lite_v1.menu.lvl.HTTP_UPDATE.build.debug_level= -DDEBUG_ESP_HTTP_UPDATE -espresso_lite_v1.menu.lvl.UPDATER=UPDATER -espresso_lite_v1.menu.lvl.UPDATER.build.debug_level= -DDEBUG_ESP_UPDATER -espresso_lite_v1.menu.lvl.OTA=OTA -espresso_lite_v1.menu.lvl.OTA.build.debug_level= -DDEBUG_ESP_OTA -espresso_lite_v1.menu.lvl.OOM=OOM -espresso_lite_v1.menu.lvl.OOM.build.debug_level= -DDEBUG_ESP_OOM -espresso_lite_v1.menu.lvl.COREWIFIHTTP_UPDATEUPDATEROTAOOM=CORE+WIFI+HTTP_UPDATE+UPDATER+OTA+OOM -espresso_lite_v1.menu.lvl.COREWIFIHTTP_UPDATEUPDATEROTAOOM.build.debug_level= -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM -espresso_lite_v1.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVERCOREWIFIHTTP_UPDATEUPDATEROTAOOM=SSL+TLS_MEM+HTTP_CLIENT+HTTP_SERVER+CORE+WIFI+HTTP_UPDATE+UPDATER+OTA+OOM -espresso_lite_v1.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVERCOREWIFIHTTP_UPDATEUPDATEROTAOOM.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM -espresso_lite_v1.menu.lvl.NoAssert-NDEBUG=NoAssert-NDEBUG -espresso_lite_v1.menu.lvl.NoAssert-NDEBUG.build.debug_level= -DNDEBUG -espresso_lite_v1.menu.wipe.none=Only Sketch -espresso_lite_v1.menu.wipe.none.upload.erase_cmd= -espresso_lite_v1.menu.wipe.sdk=Sketch + WiFi Settings -espresso_lite_v1.menu.wipe.sdk.upload.erase_cmd=-ca "{build.rfcal_addr}" -cz 0x4000 -espresso_lite_v1.menu.wipe.all=All Flash Contents -espresso_lite_v1.menu.wipe.all.upload.erase_cmd=-ca 0x0 -cz "{build.flash_size_bytes}" -espresso_lite_v1.menu.baud.115200=115200 -espresso_lite_v1.menu.baud.115200.upload.speed=115200 -espresso_lite_v1.menu.baud.9600=9600 -espresso_lite_v1.menu.baud.9600.upload.speed=9600 -espresso_lite_v1.menu.baud.57600=57600 -espresso_lite_v1.menu.baud.57600.upload.speed=57600 -espresso_lite_v1.menu.baud.230400.linux=230400 -espresso_lite_v1.menu.baud.230400.macosx=230400 -espresso_lite_v1.menu.baud.230400.upload.speed=230400 -espresso_lite_v1.menu.baud.256000.windows=256000 -espresso_lite_v1.menu.baud.256000.upload.speed=256000 -espresso_lite_v1.menu.baud.460800.linux=460800 -espresso_lite_v1.menu.baud.460800.macosx=460800 -espresso_lite_v1.menu.baud.460800.upload.speed=460800 -espresso_lite_v1.menu.baud.512000.windows=512000 -espresso_lite_v1.menu.baud.512000.upload.speed=512000 -espresso_lite_v1.menu.baud.921600=921600 -espresso_lite_v1.menu.baud.921600.upload.speed=921600 - -############################################################## -espresso_lite_v2.name=ESPresso Lite 2.0 -espresso_lite_v2.build.board=ESP8266_ESPRESSO_LITE_V2 -espresso_lite_v2.build.variant=espresso_lite_v2 -espresso_lite_v2.upload.tool=esptool -espresso_lite_v2.upload.maximum_data_size=81920 -espresso_lite_v2.upload.wait_for_upload_port=true -espresso_lite_v2.upload.erase_cmd= -espresso_lite_v2.serial.disableDTR=true -espresso_lite_v2.serial.disableRTS=true -espresso_lite_v2.build.mcu=esp8266 -espresso_lite_v2.build.core=esp8266 -espresso_lite_v2.build.spiffs_pagesize=256 -espresso_lite_v2.build.debug_port= -espresso_lite_v2.build.debug_level= -espresso_lite_v2.menu.xtal.80=80 MHz -espresso_lite_v2.menu.xtal.80.build.f_cpu=80000000L -espresso_lite_v2.menu.xtal.160=160 MHz -espresso_lite_v2.menu.xtal.160.build.f_cpu=160000000L -espresso_lite_v2.menu.vt.flash=Flash -espresso_lite_v2.menu.vt.flash.build.vtable_flags=-DVTABLES_IN_FLASH -espresso_lite_v2.menu.vt.heap=Heap -espresso_lite_v2.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM -espresso_lite_v2.menu.vt.iram=IRAM -espresso_lite_v2.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM -espresso_lite_v2.menu.exception.enabled=Enabled -espresso_lite_v2.menu.exception.enabled.build.exception_flags=-fexceptions -espresso_lite_v2.menu.exception.enabled.build.stdcpp_lib=-lstdc++ -espresso_lite_v2.menu.exception.disabled=Disabled -espresso_lite_v2.menu.exception.disabled.build.exception_flags=-fno-exceptions -espresso_lite_v2.menu.exception.disabled.build.stdcpp_lib=-lstdc++-nox -espresso_lite_v2.build.flash_mode=dio -espresso_lite_v2.build.flash_freq=40 -espresso_lite_v2.menu.eesz.4M=4M (no SPIFFS) -espresso_lite_v2.menu.eesz.4M.build.flash_size=4M -espresso_lite_v2.menu.eesz.4M.build.flash_size_bytes=0x400000 -espresso_lite_v2.menu.eesz.4M.build.flash_ld=eagle.flash.4m.ld -espresso_lite_v2.menu.eesz.4M.build.spiffs_pagesize=256 -espresso_lite_v2.menu.eesz.4M.upload.maximum_size=1044464 -espresso_lite_v2.menu.eesz.4M.build.rfcal_addr=0x3FC000 -espresso_lite_v2.menu.eesz.4M1M=4M (1M SPIFFS) -espresso_lite_v2.menu.eesz.4M1M.build.flash_size=4M -espresso_lite_v2.menu.eesz.4M1M.build.flash_size_bytes=0x400000 -espresso_lite_v2.menu.eesz.4M1M.build.flash_ld=eagle.flash.4m1m.ld -espresso_lite_v2.menu.eesz.4M1M.build.spiffs_pagesize=256 -espresso_lite_v2.menu.eesz.4M1M.upload.maximum_size=1044464 -espresso_lite_v2.menu.eesz.4M1M.build.rfcal_addr=0x3FC000 -espresso_lite_v2.menu.eesz.4M1M.build.spiffs_start=0x300000 -espresso_lite_v2.menu.eesz.4M1M.build.spiffs_end=0x3FB000 -espresso_lite_v2.menu.eesz.4M1M.build.spiffs_blocksize=8192 -espresso_lite_v2.menu.eesz.4M2M=4M (2M SPIFFS) -espresso_lite_v2.menu.eesz.4M2M.build.flash_size=4M -espresso_lite_v2.menu.eesz.4M2M.build.flash_size_bytes=0x400000 -espresso_lite_v2.menu.eesz.4M2M.build.flash_ld=eagle.flash.4m2m.ld -espresso_lite_v2.menu.eesz.4M2M.build.spiffs_pagesize=256 -espresso_lite_v2.menu.eesz.4M2M.upload.maximum_size=1044464 -espresso_lite_v2.menu.eesz.4M2M.build.rfcal_addr=0x3FC000 -espresso_lite_v2.menu.eesz.4M2M.build.spiffs_start=0x200000 -espresso_lite_v2.menu.eesz.4M2M.build.spiffs_end=0x3FB000 -espresso_lite_v2.menu.eesz.4M2M.build.spiffs_blocksize=8192 -espresso_lite_v2.menu.eesz.4M3M=4M (3M SPIFFS) -espresso_lite_v2.menu.eesz.4M3M.build.flash_size=4M -espresso_lite_v2.menu.eesz.4M3M.build.flash_size_bytes=0x400000 -espresso_lite_v2.menu.eesz.4M3M.build.flash_ld=eagle.flash.4m3m.ld -espresso_lite_v2.menu.eesz.4M3M.build.spiffs_pagesize=256 -espresso_lite_v2.menu.eesz.4M3M.upload.maximum_size=1044464 -espresso_lite_v2.menu.eesz.4M3M.build.rfcal_addr=0x3FC000 -espresso_lite_v2.menu.eesz.4M3M.build.spiffs_start=0x100000 -espresso_lite_v2.menu.eesz.4M3M.build.spiffs_end=0x3FB000 -espresso_lite_v2.menu.eesz.4M3M.build.spiffs_blocksize=8192 -espresso_lite_v2.menu.ResetMethod.ck=ck -espresso_lite_v2.menu.ResetMethod.ck.upload.resetmethod=ck -espresso_lite_v2.menu.ResetMethod.nodemcu=nodemcu -espresso_lite_v2.menu.ResetMethod.nodemcu.upload.resetmethod=nodemcu -espresso_lite_v2.menu.ip.lm2f=v2 Lower Memory -espresso_lite_v2.menu.ip.lm2f.build.lwip_include=lwip2/include -espresso_lite_v2.menu.ip.lm2f.build.lwip_lib=-llwip2-536-feat -espresso_lite_v2.menu.ip.lm2f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -espresso_lite_v2.menu.ip.hb2f=v2 Higher Bandwidth -espresso_lite_v2.menu.ip.hb2f.build.lwip_include=lwip2/include -espresso_lite_v2.menu.ip.hb2f.build.lwip_lib=-llwip2-1460-feat -espresso_lite_v2.menu.ip.hb2f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -espresso_lite_v2.menu.ip.lm2n=v2 Lower Memory (no features) -espresso_lite_v2.menu.ip.lm2n.build.lwip_include=lwip2/include -espresso_lite_v2.menu.ip.lm2n.build.lwip_lib=-llwip2-536 -espresso_lite_v2.menu.ip.lm2n.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=0 -DLWIP_IPV6=0 -espresso_lite_v2.menu.ip.hb2n=v2 Higher Bandwidth (no features) -espresso_lite_v2.menu.ip.hb2n.build.lwip_include=lwip2/include -espresso_lite_v2.menu.ip.hb2n.build.lwip_lib=-llwip2-1460 -espresso_lite_v2.menu.ip.hb2n.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=0 -DLWIP_IPV6=0 -espresso_lite_v2.menu.ip.lm6f=v2 IPv6 Lower Memory -espresso_lite_v2.menu.ip.lm6f.build.lwip_include=lwip2/include -espresso_lite_v2.menu.ip.lm6f.build.lwip_lib=-llwip6-536-feat -espresso_lite_v2.menu.ip.lm6f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=1 -espresso_lite_v2.menu.ip.hb6f=v2 IPv6 Higher Bandwidth -espresso_lite_v2.menu.ip.hb6f.build.lwip_include=lwip2/include -espresso_lite_v2.menu.ip.hb6f.build.lwip_lib=-llwip6-1460-feat -espresso_lite_v2.menu.ip.hb6f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=1 -DLWIP_IPV6=1 -espresso_lite_v2.menu.ip.hb1=v1.4 Higher Bandwidth -espresso_lite_v2.menu.ip.hb1.build.lwip_lib=-llwip_gcc -espresso_lite_v2.menu.ip.hb1.build.lwip_flags=-DLWIP_OPEN_SRC -espresso_lite_v2.menu.ip.src=v1.4 Compile from source -espresso_lite_v2.menu.ip.src.build.lwip_lib=-llwip_src -espresso_lite_v2.menu.ip.src.build.lwip_flags=-DLWIP_OPEN_SRC -espresso_lite_v2.menu.ip.src.recipe.hooks.sketch.prebuild.1.pattern=make -C "{runtime.platform.path}/tools/sdk/lwip/src" install TOOLS_PATH="{runtime.tools.xtensa-lx106-elf-gcc.path}/bin/xtensa-lx106-elf-" -espresso_lite_v2.menu.dbg.Disabled=Disabled -espresso_lite_v2.menu.dbg.Disabled.build.debug_port= -espresso_lite_v2.menu.dbg.Serial=Serial -espresso_lite_v2.menu.dbg.Serial.build.debug_port=-DDEBUG_ESP_PORT=Serial -espresso_lite_v2.menu.dbg.Serial1=Serial1 -espresso_lite_v2.menu.dbg.Serial1.build.debug_port=-DDEBUG_ESP_PORT=Serial1 -espresso_lite_v2.menu.lvl.None____=None -espresso_lite_v2.menu.lvl.None____.build.debug_level= -espresso_lite_v2.menu.lvl.SSL=SSL -espresso_lite_v2.menu.lvl.SSL.build.debug_level= -DDEBUG_ESP_SSL -espresso_lite_v2.menu.lvl.TLS_MEM=TLS_MEM -espresso_lite_v2.menu.lvl.TLS_MEM.build.debug_level= -DDEBUG_ESP_TLS_MEM -espresso_lite_v2.menu.lvl.HTTP_CLIENT=HTTP_CLIENT -espresso_lite_v2.menu.lvl.HTTP_CLIENT.build.debug_level= -DDEBUG_ESP_HTTP_CLIENT -espresso_lite_v2.menu.lvl.HTTP_SERVER=HTTP_SERVER -espresso_lite_v2.menu.lvl.HTTP_SERVER.build.debug_level= -DDEBUG_ESP_HTTP_SERVER -espresso_lite_v2.menu.lvl.SSLTLS_MEM=SSL+TLS_MEM -espresso_lite_v2.menu.lvl.SSLTLS_MEM.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -espresso_lite_v2.menu.lvl.SSLHTTP_CLIENT=SSL+HTTP_CLIENT -espresso_lite_v2.menu.lvl.SSLHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_CLIENT -espresso_lite_v2.menu.lvl.SSLHTTP_SERVER=SSL+HTTP_SERVER -espresso_lite_v2.menu.lvl.SSLHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_SERVER -espresso_lite_v2.menu.lvl.TLS_MEMHTTP_CLIENT=TLS_MEM+HTTP_CLIENT -espresso_lite_v2.menu.lvl.TLS_MEMHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -espresso_lite_v2.menu.lvl.TLS_MEMHTTP_SERVER=TLS_MEM+HTTP_SERVER -espresso_lite_v2.menu.lvl.TLS_MEMHTTP_SERVER.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_SERVER -espresso_lite_v2.menu.lvl.HTTP_CLIENTHTTP_SERVER=HTTP_CLIENT+HTTP_SERVER -espresso_lite_v2.menu.lvl.HTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -espresso_lite_v2.menu.lvl.SSLTLS_MEMHTTP_CLIENT=SSL+TLS_MEM+HTTP_CLIENT -espresso_lite_v2.menu.lvl.SSLTLS_MEMHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -espresso_lite_v2.menu.lvl.SSLTLS_MEMHTTP_SERVER=SSL+TLS_MEM+HTTP_SERVER -espresso_lite_v2.menu.lvl.SSLTLS_MEMHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_SERVER -espresso_lite_v2.menu.lvl.SSLHTTP_CLIENTHTTP_SERVER=SSL+HTTP_CLIENT+HTTP_SERVER -espresso_lite_v2.menu.lvl.SSLHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -espresso_lite_v2.menu.lvl.TLS_MEMHTTP_CLIENTHTTP_SERVER=TLS_MEM+HTTP_CLIENT+HTTP_SERVER -espresso_lite_v2.menu.lvl.TLS_MEMHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -espresso_lite_v2.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVER=SSL+TLS_MEM+HTTP_CLIENT+HTTP_SERVER -espresso_lite_v2.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -espresso_lite_v2.menu.lvl.CORE=CORE -espresso_lite_v2.menu.lvl.CORE.build.debug_level= -DDEBUG_ESP_CORE -espresso_lite_v2.menu.lvl.WIFI=WIFI -espresso_lite_v2.menu.lvl.WIFI.build.debug_level= -DDEBUG_ESP_WIFI -espresso_lite_v2.menu.lvl.HTTP_UPDATE=HTTP_UPDATE -espresso_lite_v2.menu.lvl.HTTP_UPDATE.build.debug_level= -DDEBUG_ESP_HTTP_UPDATE -espresso_lite_v2.menu.lvl.UPDATER=UPDATER -espresso_lite_v2.menu.lvl.UPDATER.build.debug_level= -DDEBUG_ESP_UPDATER -espresso_lite_v2.menu.lvl.OTA=OTA -espresso_lite_v2.menu.lvl.OTA.build.debug_level= -DDEBUG_ESP_OTA -espresso_lite_v2.menu.lvl.OOM=OOM -espresso_lite_v2.menu.lvl.OOM.build.debug_level= -DDEBUG_ESP_OOM -espresso_lite_v2.menu.lvl.COREWIFIHTTP_UPDATEUPDATEROTAOOM=CORE+WIFI+HTTP_UPDATE+UPDATER+OTA+OOM -espresso_lite_v2.menu.lvl.COREWIFIHTTP_UPDATEUPDATEROTAOOM.build.debug_level= -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM -espresso_lite_v2.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVERCOREWIFIHTTP_UPDATEUPDATEROTAOOM=SSL+TLS_MEM+HTTP_CLIENT+HTTP_SERVER+CORE+WIFI+HTTP_UPDATE+UPDATER+OTA+OOM -espresso_lite_v2.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVERCOREWIFIHTTP_UPDATEUPDATEROTAOOM.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM -espresso_lite_v2.menu.lvl.NoAssert-NDEBUG=NoAssert-NDEBUG -espresso_lite_v2.menu.lvl.NoAssert-NDEBUG.build.debug_level= -DNDEBUG -espresso_lite_v2.menu.wipe.none=Only Sketch -espresso_lite_v2.menu.wipe.none.upload.erase_cmd= -espresso_lite_v2.menu.wipe.sdk=Sketch + WiFi Settings -espresso_lite_v2.menu.wipe.sdk.upload.erase_cmd=-ca "{build.rfcal_addr}" -cz 0x4000 -espresso_lite_v2.menu.wipe.all=All Flash Contents -espresso_lite_v2.menu.wipe.all.upload.erase_cmd=-ca 0x0 -cz "{build.flash_size_bytes}" -espresso_lite_v2.menu.baud.115200=115200 -espresso_lite_v2.menu.baud.115200.upload.speed=115200 -espresso_lite_v2.menu.baud.9600=9600 -espresso_lite_v2.menu.baud.9600.upload.speed=9600 -espresso_lite_v2.menu.baud.57600=57600 -espresso_lite_v2.menu.baud.57600.upload.speed=57600 -espresso_lite_v2.menu.baud.230400.linux=230400 -espresso_lite_v2.menu.baud.230400.macosx=230400 -espresso_lite_v2.menu.baud.230400.upload.speed=230400 -espresso_lite_v2.menu.baud.256000.windows=256000 -espresso_lite_v2.menu.baud.256000.upload.speed=256000 -espresso_lite_v2.menu.baud.460800.linux=460800 -espresso_lite_v2.menu.baud.460800.macosx=460800 -espresso_lite_v2.menu.baud.460800.upload.speed=460800 -espresso_lite_v2.menu.baud.512000.windows=512000 -espresso_lite_v2.menu.baud.512000.upload.speed=512000 -espresso_lite_v2.menu.baud.921600=921600 -espresso_lite_v2.menu.baud.921600.upload.speed=921600 - -############################################################## -phoenix_v1.name=Phoenix 1.0 -phoenix_v1.build.board=ESP8266_PHOENIX_V1 -phoenix_v1.build.variant=phoenix_v1 -phoenix_v1.upload.tool=esptool -phoenix_v1.upload.maximum_data_size=81920 -phoenix_v1.upload.wait_for_upload_port=true -phoenix_v1.upload.erase_cmd= -phoenix_v1.serial.disableDTR=true -phoenix_v1.serial.disableRTS=true -phoenix_v1.build.mcu=esp8266 -phoenix_v1.build.core=esp8266 -phoenix_v1.build.spiffs_pagesize=256 -phoenix_v1.build.debug_port= -phoenix_v1.build.debug_level= -phoenix_v1.menu.xtal.80=80 MHz -phoenix_v1.menu.xtal.80.build.f_cpu=80000000L -phoenix_v1.menu.xtal.160=160 MHz -phoenix_v1.menu.xtal.160.build.f_cpu=160000000L -phoenix_v1.menu.vt.flash=Flash -phoenix_v1.menu.vt.flash.build.vtable_flags=-DVTABLES_IN_FLASH -phoenix_v1.menu.vt.heap=Heap -phoenix_v1.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM -phoenix_v1.menu.vt.iram=IRAM -phoenix_v1.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM -phoenix_v1.menu.exception.enabled=Enabled -phoenix_v1.menu.exception.enabled.build.exception_flags=-fexceptions -phoenix_v1.menu.exception.enabled.build.stdcpp_lib=-lstdc++ -phoenix_v1.menu.exception.disabled=Disabled -phoenix_v1.menu.exception.disabled.build.exception_flags=-fno-exceptions -phoenix_v1.menu.exception.disabled.build.stdcpp_lib=-lstdc++-nox -phoenix_v1.build.flash_mode=dio -phoenix_v1.build.flash_freq=40 -phoenix_v1.menu.eesz.4M=4M (no SPIFFS) -phoenix_v1.menu.eesz.4M.build.flash_size=4M -phoenix_v1.menu.eesz.4M.build.flash_size_bytes=0x400000 -phoenix_v1.menu.eesz.4M.build.flash_ld=eagle.flash.4m.ld -phoenix_v1.menu.eesz.4M.build.spiffs_pagesize=256 -phoenix_v1.menu.eesz.4M.upload.maximum_size=1044464 -phoenix_v1.menu.eesz.4M.build.rfcal_addr=0x3FC000 -phoenix_v1.menu.eesz.4M1M=4M (1M SPIFFS) -phoenix_v1.menu.eesz.4M1M.build.flash_size=4M -phoenix_v1.menu.eesz.4M1M.build.flash_size_bytes=0x400000 -phoenix_v1.menu.eesz.4M1M.build.flash_ld=eagle.flash.4m1m.ld -phoenix_v1.menu.eesz.4M1M.build.spiffs_pagesize=256 -phoenix_v1.menu.eesz.4M1M.upload.maximum_size=1044464 -phoenix_v1.menu.eesz.4M1M.build.rfcal_addr=0x3FC000 -phoenix_v1.menu.eesz.4M1M.build.spiffs_start=0x300000 -phoenix_v1.menu.eesz.4M1M.build.spiffs_end=0x3FB000 -phoenix_v1.menu.eesz.4M1M.build.spiffs_blocksize=8192 -phoenix_v1.menu.eesz.4M2M=4M (2M SPIFFS) -phoenix_v1.menu.eesz.4M2M.build.flash_size=4M -phoenix_v1.menu.eesz.4M2M.build.flash_size_bytes=0x400000 -phoenix_v1.menu.eesz.4M2M.build.flash_ld=eagle.flash.4m2m.ld -phoenix_v1.menu.eesz.4M2M.build.spiffs_pagesize=256 -phoenix_v1.menu.eesz.4M2M.upload.maximum_size=1044464 -phoenix_v1.menu.eesz.4M2M.build.rfcal_addr=0x3FC000 -phoenix_v1.menu.eesz.4M2M.build.spiffs_start=0x200000 -phoenix_v1.menu.eesz.4M2M.build.spiffs_end=0x3FB000 -phoenix_v1.menu.eesz.4M2M.build.spiffs_blocksize=8192 -phoenix_v1.menu.eesz.4M3M=4M (3M SPIFFS) -phoenix_v1.menu.eesz.4M3M.build.flash_size=4M -phoenix_v1.menu.eesz.4M3M.build.flash_size_bytes=0x400000 -phoenix_v1.menu.eesz.4M3M.build.flash_ld=eagle.flash.4m3m.ld -phoenix_v1.menu.eesz.4M3M.build.spiffs_pagesize=256 -phoenix_v1.menu.eesz.4M3M.upload.maximum_size=1044464 -phoenix_v1.menu.eesz.4M3M.build.rfcal_addr=0x3FC000 -phoenix_v1.menu.eesz.4M3M.build.spiffs_start=0x100000 -phoenix_v1.menu.eesz.4M3M.build.spiffs_end=0x3FB000 -phoenix_v1.menu.eesz.4M3M.build.spiffs_blocksize=8192 -phoenix_v1.menu.ResetMethod.ck=ck -phoenix_v1.menu.ResetMethod.ck.upload.resetmethod=ck -phoenix_v1.menu.ResetMethod.nodemcu=nodemcu -phoenix_v1.menu.ResetMethod.nodemcu.upload.resetmethod=nodemcu -phoenix_v1.menu.ip.lm2f=v2 Lower Memory -phoenix_v1.menu.ip.lm2f.build.lwip_include=lwip2/include -phoenix_v1.menu.ip.lm2f.build.lwip_lib=-llwip2-536-feat -phoenix_v1.menu.ip.lm2f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -phoenix_v1.menu.ip.hb2f=v2 Higher Bandwidth -phoenix_v1.menu.ip.hb2f.build.lwip_include=lwip2/include -phoenix_v1.menu.ip.hb2f.build.lwip_lib=-llwip2-1460-feat -phoenix_v1.menu.ip.hb2f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -phoenix_v1.menu.ip.lm2n=v2 Lower Memory (no features) -phoenix_v1.menu.ip.lm2n.build.lwip_include=lwip2/include -phoenix_v1.menu.ip.lm2n.build.lwip_lib=-llwip2-536 -phoenix_v1.menu.ip.lm2n.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=0 -DLWIP_IPV6=0 -phoenix_v1.menu.ip.hb2n=v2 Higher Bandwidth (no features) -phoenix_v1.menu.ip.hb2n.build.lwip_include=lwip2/include -phoenix_v1.menu.ip.hb2n.build.lwip_lib=-llwip2-1460 -phoenix_v1.menu.ip.hb2n.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=0 -DLWIP_IPV6=0 -phoenix_v1.menu.ip.lm6f=v2 IPv6 Lower Memory -phoenix_v1.menu.ip.lm6f.build.lwip_include=lwip2/include -phoenix_v1.menu.ip.lm6f.build.lwip_lib=-llwip6-536-feat -phoenix_v1.menu.ip.lm6f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=1 -phoenix_v1.menu.ip.hb6f=v2 IPv6 Higher Bandwidth -phoenix_v1.menu.ip.hb6f.build.lwip_include=lwip2/include -phoenix_v1.menu.ip.hb6f.build.lwip_lib=-llwip6-1460-feat -phoenix_v1.menu.ip.hb6f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=1 -DLWIP_IPV6=1 -phoenix_v1.menu.ip.hb1=v1.4 Higher Bandwidth -phoenix_v1.menu.ip.hb1.build.lwip_lib=-llwip_gcc -phoenix_v1.menu.ip.hb1.build.lwip_flags=-DLWIP_OPEN_SRC -phoenix_v1.menu.ip.src=v1.4 Compile from source -phoenix_v1.menu.ip.src.build.lwip_lib=-llwip_src -phoenix_v1.menu.ip.src.build.lwip_flags=-DLWIP_OPEN_SRC -phoenix_v1.menu.ip.src.recipe.hooks.sketch.prebuild.1.pattern=make -C "{runtime.platform.path}/tools/sdk/lwip/src" install TOOLS_PATH="{runtime.tools.xtensa-lx106-elf-gcc.path}/bin/xtensa-lx106-elf-" -phoenix_v1.menu.dbg.Disabled=Disabled -phoenix_v1.menu.dbg.Disabled.build.debug_port= -phoenix_v1.menu.dbg.Serial=Serial -phoenix_v1.menu.dbg.Serial.build.debug_port=-DDEBUG_ESP_PORT=Serial -phoenix_v1.menu.dbg.Serial1=Serial1 -phoenix_v1.menu.dbg.Serial1.build.debug_port=-DDEBUG_ESP_PORT=Serial1 -phoenix_v1.menu.lvl.None____=None -phoenix_v1.menu.lvl.None____.build.debug_level= -phoenix_v1.menu.lvl.SSL=SSL -phoenix_v1.menu.lvl.SSL.build.debug_level= -DDEBUG_ESP_SSL -phoenix_v1.menu.lvl.TLS_MEM=TLS_MEM -phoenix_v1.menu.lvl.TLS_MEM.build.debug_level= -DDEBUG_ESP_TLS_MEM -phoenix_v1.menu.lvl.HTTP_CLIENT=HTTP_CLIENT -phoenix_v1.menu.lvl.HTTP_CLIENT.build.debug_level= -DDEBUG_ESP_HTTP_CLIENT -phoenix_v1.menu.lvl.HTTP_SERVER=HTTP_SERVER -phoenix_v1.menu.lvl.HTTP_SERVER.build.debug_level= -DDEBUG_ESP_HTTP_SERVER -phoenix_v1.menu.lvl.SSLTLS_MEM=SSL+TLS_MEM -phoenix_v1.menu.lvl.SSLTLS_MEM.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -phoenix_v1.menu.lvl.SSLHTTP_CLIENT=SSL+HTTP_CLIENT -phoenix_v1.menu.lvl.SSLHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_CLIENT -phoenix_v1.menu.lvl.SSLHTTP_SERVER=SSL+HTTP_SERVER -phoenix_v1.menu.lvl.SSLHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_SERVER -phoenix_v1.menu.lvl.TLS_MEMHTTP_CLIENT=TLS_MEM+HTTP_CLIENT -phoenix_v1.menu.lvl.TLS_MEMHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -phoenix_v1.menu.lvl.TLS_MEMHTTP_SERVER=TLS_MEM+HTTP_SERVER -phoenix_v1.menu.lvl.TLS_MEMHTTP_SERVER.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_SERVER -phoenix_v1.menu.lvl.HTTP_CLIENTHTTP_SERVER=HTTP_CLIENT+HTTP_SERVER -phoenix_v1.menu.lvl.HTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -phoenix_v1.menu.lvl.SSLTLS_MEMHTTP_CLIENT=SSL+TLS_MEM+HTTP_CLIENT -phoenix_v1.menu.lvl.SSLTLS_MEMHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -phoenix_v1.menu.lvl.SSLTLS_MEMHTTP_SERVER=SSL+TLS_MEM+HTTP_SERVER -phoenix_v1.menu.lvl.SSLTLS_MEMHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_SERVER -phoenix_v1.menu.lvl.SSLHTTP_CLIENTHTTP_SERVER=SSL+HTTP_CLIENT+HTTP_SERVER -phoenix_v1.menu.lvl.SSLHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -phoenix_v1.menu.lvl.TLS_MEMHTTP_CLIENTHTTP_SERVER=TLS_MEM+HTTP_CLIENT+HTTP_SERVER -phoenix_v1.menu.lvl.TLS_MEMHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -phoenix_v1.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVER=SSL+TLS_MEM+HTTP_CLIENT+HTTP_SERVER -phoenix_v1.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -phoenix_v1.menu.lvl.CORE=CORE -phoenix_v1.menu.lvl.CORE.build.debug_level= -DDEBUG_ESP_CORE -phoenix_v1.menu.lvl.WIFI=WIFI -phoenix_v1.menu.lvl.WIFI.build.debug_level= -DDEBUG_ESP_WIFI -phoenix_v1.menu.lvl.HTTP_UPDATE=HTTP_UPDATE -phoenix_v1.menu.lvl.HTTP_UPDATE.build.debug_level= -DDEBUG_ESP_HTTP_UPDATE -phoenix_v1.menu.lvl.UPDATER=UPDATER -phoenix_v1.menu.lvl.UPDATER.build.debug_level= -DDEBUG_ESP_UPDATER -phoenix_v1.menu.lvl.OTA=OTA -phoenix_v1.menu.lvl.OTA.build.debug_level= -DDEBUG_ESP_OTA -phoenix_v1.menu.lvl.OOM=OOM -phoenix_v1.menu.lvl.OOM.build.debug_level= -DDEBUG_ESP_OOM -phoenix_v1.menu.lvl.COREWIFIHTTP_UPDATEUPDATEROTAOOM=CORE+WIFI+HTTP_UPDATE+UPDATER+OTA+OOM -phoenix_v1.menu.lvl.COREWIFIHTTP_UPDATEUPDATEROTAOOM.build.debug_level= -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM -phoenix_v1.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVERCOREWIFIHTTP_UPDATEUPDATEROTAOOM=SSL+TLS_MEM+HTTP_CLIENT+HTTP_SERVER+CORE+WIFI+HTTP_UPDATE+UPDATER+OTA+OOM -phoenix_v1.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVERCOREWIFIHTTP_UPDATEUPDATEROTAOOM.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM -phoenix_v1.menu.lvl.NoAssert-NDEBUG=NoAssert-NDEBUG -phoenix_v1.menu.lvl.NoAssert-NDEBUG.build.debug_level= -DNDEBUG -phoenix_v1.menu.wipe.none=Only Sketch -phoenix_v1.menu.wipe.none.upload.erase_cmd= -phoenix_v1.menu.wipe.sdk=Sketch + WiFi Settings -phoenix_v1.menu.wipe.sdk.upload.erase_cmd=-ca "{build.rfcal_addr}" -cz 0x4000 -phoenix_v1.menu.wipe.all=All Flash Contents -phoenix_v1.menu.wipe.all.upload.erase_cmd=-ca 0x0 -cz "{build.flash_size_bytes}" -phoenix_v1.menu.baud.115200=115200 -phoenix_v1.menu.baud.115200.upload.speed=115200 -phoenix_v1.menu.baud.9600=9600 -phoenix_v1.menu.baud.9600.upload.speed=9600 -phoenix_v1.menu.baud.57600=57600 -phoenix_v1.menu.baud.57600.upload.speed=57600 -phoenix_v1.menu.baud.230400.linux=230400 -phoenix_v1.menu.baud.230400.macosx=230400 -phoenix_v1.menu.baud.230400.upload.speed=230400 -phoenix_v1.menu.baud.256000.windows=256000 -phoenix_v1.menu.baud.256000.upload.speed=256000 -phoenix_v1.menu.baud.460800.linux=460800 -phoenix_v1.menu.baud.460800.macosx=460800 -phoenix_v1.menu.baud.460800.upload.speed=460800 -phoenix_v1.menu.baud.512000.windows=512000 -phoenix_v1.menu.baud.512000.upload.speed=512000 -phoenix_v1.menu.baud.921600=921600 -phoenix_v1.menu.baud.921600.upload.speed=921600 - -############################################################## -phoenix_v2.name=Phoenix 2.0 -phoenix_v2.build.board=ESP8266_PHOENIX_V2 -phoenix_v2.build.variant=phoenix_v2 -phoenix_v2.upload.tool=esptool -phoenix_v2.upload.maximum_data_size=81920 -phoenix_v2.upload.wait_for_upload_port=true -phoenix_v2.upload.erase_cmd= -phoenix_v2.serial.disableDTR=true -phoenix_v2.serial.disableRTS=true -phoenix_v2.build.mcu=esp8266 -phoenix_v2.build.core=esp8266 -phoenix_v2.build.spiffs_pagesize=256 -phoenix_v2.build.debug_port= -phoenix_v2.build.debug_level= -phoenix_v2.menu.xtal.80=80 MHz -phoenix_v2.menu.xtal.80.build.f_cpu=80000000L -phoenix_v2.menu.xtal.160=160 MHz -phoenix_v2.menu.xtal.160.build.f_cpu=160000000L -phoenix_v2.menu.vt.flash=Flash -phoenix_v2.menu.vt.flash.build.vtable_flags=-DVTABLES_IN_FLASH -phoenix_v2.menu.vt.heap=Heap -phoenix_v2.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM -phoenix_v2.menu.vt.iram=IRAM -phoenix_v2.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM -phoenix_v2.menu.exception.enabled=Enabled -phoenix_v2.menu.exception.enabled.build.exception_flags=-fexceptions -phoenix_v2.menu.exception.enabled.build.stdcpp_lib=-lstdc++ -phoenix_v2.menu.exception.disabled=Disabled -phoenix_v2.menu.exception.disabled.build.exception_flags=-fno-exceptions -phoenix_v2.menu.exception.disabled.build.stdcpp_lib=-lstdc++-nox -phoenix_v2.build.flash_mode=dio -phoenix_v2.build.flash_freq=40 -phoenix_v2.menu.eesz.4M=4M (no SPIFFS) -phoenix_v2.menu.eesz.4M.build.flash_size=4M -phoenix_v2.menu.eesz.4M.build.flash_size_bytes=0x400000 -phoenix_v2.menu.eesz.4M.build.flash_ld=eagle.flash.4m.ld -phoenix_v2.menu.eesz.4M.build.spiffs_pagesize=256 -phoenix_v2.menu.eesz.4M.upload.maximum_size=1044464 -phoenix_v2.menu.eesz.4M.build.rfcal_addr=0x3FC000 -phoenix_v2.menu.eesz.4M1M=4M (1M SPIFFS) -phoenix_v2.menu.eesz.4M1M.build.flash_size=4M -phoenix_v2.menu.eesz.4M1M.build.flash_size_bytes=0x400000 -phoenix_v2.menu.eesz.4M1M.build.flash_ld=eagle.flash.4m1m.ld -phoenix_v2.menu.eesz.4M1M.build.spiffs_pagesize=256 -phoenix_v2.menu.eesz.4M1M.upload.maximum_size=1044464 -phoenix_v2.menu.eesz.4M1M.build.rfcal_addr=0x3FC000 -phoenix_v2.menu.eesz.4M1M.build.spiffs_start=0x300000 -phoenix_v2.menu.eesz.4M1M.build.spiffs_end=0x3FB000 -phoenix_v2.menu.eesz.4M1M.build.spiffs_blocksize=8192 -phoenix_v2.menu.eesz.4M2M=4M (2M SPIFFS) -phoenix_v2.menu.eesz.4M2M.build.flash_size=4M -phoenix_v2.menu.eesz.4M2M.build.flash_size_bytes=0x400000 -phoenix_v2.menu.eesz.4M2M.build.flash_ld=eagle.flash.4m2m.ld -phoenix_v2.menu.eesz.4M2M.build.spiffs_pagesize=256 -phoenix_v2.menu.eesz.4M2M.upload.maximum_size=1044464 -phoenix_v2.menu.eesz.4M2M.build.rfcal_addr=0x3FC000 -phoenix_v2.menu.eesz.4M2M.build.spiffs_start=0x200000 -phoenix_v2.menu.eesz.4M2M.build.spiffs_end=0x3FB000 -phoenix_v2.menu.eesz.4M2M.build.spiffs_blocksize=8192 -phoenix_v2.menu.eesz.4M3M=4M (3M SPIFFS) -phoenix_v2.menu.eesz.4M3M.build.flash_size=4M -phoenix_v2.menu.eesz.4M3M.build.flash_size_bytes=0x400000 -phoenix_v2.menu.eesz.4M3M.build.flash_ld=eagle.flash.4m3m.ld -phoenix_v2.menu.eesz.4M3M.build.spiffs_pagesize=256 -phoenix_v2.menu.eesz.4M3M.upload.maximum_size=1044464 -phoenix_v2.menu.eesz.4M3M.build.rfcal_addr=0x3FC000 -phoenix_v2.menu.eesz.4M3M.build.spiffs_start=0x100000 -phoenix_v2.menu.eesz.4M3M.build.spiffs_end=0x3FB000 -phoenix_v2.menu.eesz.4M3M.build.spiffs_blocksize=8192 -phoenix_v2.menu.ResetMethod.ck=ck -phoenix_v2.menu.ResetMethod.ck.upload.resetmethod=ck -phoenix_v2.menu.ResetMethod.nodemcu=nodemcu -phoenix_v2.menu.ResetMethod.nodemcu.upload.resetmethod=nodemcu -phoenix_v2.menu.ip.lm2f=v2 Lower Memory -phoenix_v2.menu.ip.lm2f.build.lwip_include=lwip2/include -phoenix_v2.menu.ip.lm2f.build.lwip_lib=-llwip2-536-feat -phoenix_v2.menu.ip.lm2f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -phoenix_v2.menu.ip.hb2f=v2 Higher Bandwidth -phoenix_v2.menu.ip.hb2f.build.lwip_include=lwip2/include -phoenix_v2.menu.ip.hb2f.build.lwip_lib=-llwip2-1460-feat -phoenix_v2.menu.ip.hb2f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -phoenix_v2.menu.ip.lm2n=v2 Lower Memory (no features) -phoenix_v2.menu.ip.lm2n.build.lwip_include=lwip2/include -phoenix_v2.menu.ip.lm2n.build.lwip_lib=-llwip2-536 -phoenix_v2.menu.ip.lm2n.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=0 -DLWIP_IPV6=0 -phoenix_v2.menu.ip.hb2n=v2 Higher Bandwidth (no features) -phoenix_v2.menu.ip.hb2n.build.lwip_include=lwip2/include -phoenix_v2.menu.ip.hb2n.build.lwip_lib=-llwip2-1460 -phoenix_v2.menu.ip.hb2n.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=0 -DLWIP_IPV6=0 -phoenix_v2.menu.ip.lm6f=v2 IPv6 Lower Memory -phoenix_v2.menu.ip.lm6f.build.lwip_include=lwip2/include -phoenix_v2.menu.ip.lm6f.build.lwip_lib=-llwip6-536-feat -phoenix_v2.menu.ip.lm6f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=1 -phoenix_v2.menu.ip.hb6f=v2 IPv6 Higher Bandwidth -phoenix_v2.menu.ip.hb6f.build.lwip_include=lwip2/include -phoenix_v2.menu.ip.hb6f.build.lwip_lib=-llwip6-1460-feat -phoenix_v2.menu.ip.hb6f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=1 -DLWIP_IPV6=1 -phoenix_v2.menu.ip.hb1=v1.4 Higher Bandwidth -phoenix_v2.menu.ip.hb1.build.lwip_lib=-llwip_gcc -phoenix_v2.menu.ip.hb1.build.lwip_flags=-DLWIP_OPEN_SRC -phoenix_v2.menu.ip.src=v1.4 Compile from source -phoenix_v2.menu.ip.src.build.lwip_lib=-llwip_src -phoenix_v2.menu.ip.src.build.lwip_flags=-DLWIP_OPEN_SRC -phoenix_v2.menu.ip.src.recipe.hooks.sketch.prebuild.1.pattern=make -C "{runtime.platform.path}/tools/sdk/lwip/src" install TOOLS_PATH="{runtime.tools.xtensa-lx106-elf-gcc.path}/bin/xtensa-lx106-elf-" -phoenix_v2.menu.dbg.Disabled=Disabled -phoenix_v2.menu.dbg.Disabled.build.debug_port= -phoenix_v2.menu.dbg.Serial=Serial -phoenix_v2.menu.dbg.Serial.build.debug_port=-DDEBUG_ESP_PORT=Serial -phoenix_v2.menu.dbg.Serial1=Serial1 -phoenix_v2.menu.dbg.Serial1.build.debug_port=-DDEBUG_ESP_PORT=Serial1 -phoenix_v2.menu.lvl.None____=None -phoenix_v2.menu.lvl.None____.build.debug_level= -phoenix_v2.menu.lvl.SSL=SSL -phoenix_v2.menu.lvl.SSL.build.debug_level= -DDEBUG_ESP_SSL -phoenix_v2.menu.lvl.TLS_MEM=TLS_MEM -phoenix_v2.menu.lvl.TLS_MEM.build.debug_level= -DDEBUG_ESP_TLS_MEM -phoenix_v2.menu.lvl.HTTP_CLIENT=HTTP_CLIENT -phoenix_v2.menu.lvl.HTTP_CLIENT.build.debug_level= -DDEBUG_ESP_HTTP_CLIENT -phoenix_v2.menu.lvl.HTTP_SERVER=HTTP_SERVER -phoenix_v2.menu.lvl.HTTP_SERVER.build.debug_level= -DDEBUG_ESP_HTTP_SERVER -phoenix_v2.menu.lvl.SSLTLS_MEM=SSL+TLS_MEM -phoenix_v2.menu.lvl.SSLTLS_MEM.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -phoenix_v2.menu.lvl.SSLHTTP_CLIENT=SSL+HTTP_CLIENT -phoenix_v2.menu.lvl.SSLHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_CLIENT -phoenix_v2.menu.lvl.SSLHTTP_SERVER=SSL+HTTP_SERVER -phoenix_v2.menu.lvl.SSLHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_SERVER -phoenix_v2.menu.lvl.TLS_MEMHTTP_CLIENT=TLS_MEM+HTTP_CLIENT -phoenix_v2.menu.lvl.TLS_MEMHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -phoenix_v2.menu.lvl.TLS_MEMHTTP_SERVER=TLS_MEM+HTTP_SERVER -phoenix_v2.menu.lvl.TLS_MEMHTTP_SERVER.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_SERVER -phoenix_v2.menu.lvl.HTTP_CLIENTHTTP_SERVER=HTTP_CLIENT+HTTP_SERVER -phoenix_v2.menu.lvl.HTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -phoenix_v2.menu.lvl.SSLTLS_MEMHTTP_CLIENT=SSL+TLS_MEM+HTTP_CLIENT -phoenix_v2.menu.lvl.SSLTLS_MEMHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -phoenix_v2.menu.lvl.SSLTLS_MEMHTTP_SERVER=SSL+TLS_MEM+HTTP_SERVER -phoenix_v2.menu.lvl.SSLTLS_MEMHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_SERVER -phoenix_v2.menu.lvl.SSLHTTP_CLIENTHTTP_SERVER=SSL+HTTP_CLIENT+HTTP_SERVER -phoenix_v2.menu.lvl.SSLHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -phoenix_v2.menu.lvl.TLS_MEMHTTP_CLIENTHTTP_SERVER=TLS_MEM+HTTP_CLIENT+HTTP_SERVER -phoenix_v2.menu.lvl.TLS_MEMHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -phoenix_v2.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVER=SSL+TLS_MEM+HTTP_CLIENT+HTTP_SERVER -phoenix_v2.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -phoenix_v2.menu.lvl.CORE=CORE -phoenix_v2.menu.lvl.CORE.build.debug_level= -DDEBUG_ESP_CORE -phoenix_v2.menu.lvl.WIFI=WIFI -phoenix_v2.menu.lvl.WIFI.build.debug_level= -DDEBUG_ESP_WIFI -phoenix_v2.menu.lvl.HTTP_UPDATE=HTTP_UPDATE -phoenix_v2.menu.lvl.HTTP_UPDATE.build.debug_level= -DDEBUG_ESP_HTTP_UPDATE -phoenix_v2.menu.lvl.UPDATER=UPDATER -phoenix_v2.menu.lvl.UPDATER.build.debug_level= -DDEBUG_ESP_UPDATER -phoenix_v2.menu.lvl.OTA=OTA -phoenix_v2.menu.lvl.OTA.build.debug_level= -DDEBUG_ESP_OTA -phoenix_v2.menu.lvl.OOM=OOM -phoenix_v2.menu.lvl.OOM.build.debug_level= -DDEBUG_ESP_OOM -phoenix_v2.menu.lvl.COREWIFIHTTP_UPDATEUPDATEROTAOOM=CORE+WIFI+HTTP_UPDATE+UPDATER+OTA+OOM -phoenix_v2.menu.lvl.COREWIFIHTTP_UPDATEUPDATEROTAOOM.build.debug_level= -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM -phoenix_v2.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVERCOREWIFIHTTP_UPDATEUPDATEROTAOOM=SSL+TLS_MEM+HTTP_CLIENT+HTTP_SERVER+CORE+WIFI+HTTP_UPDATE+UPDATER+OTA+OOM -phoenix_v2.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVERCOREWIFIHTTP_UPDATEUPDATEROTAOOM.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM -phoenix_v2.menu.lvl.NoAssert-NDEBUG=NoAssert-NDEBUG -phoenix_v2.menu.lvl.NoAssert-NDEBUG.build.debug_level= -DNDEBUG -phoenix_v2.menu.wipe.none=Only Sketch -phoenix_v2.menu.wipe.none.upload.erase_cmd= -phoenix_v2.menu.wipe.sdk=Sketch + WiFi Settings -phoenix_v2.menu.wipe.sdk.upload.erase_cmd=-ca "{build.rfcal_addr}" -cz 0x4000 -phoenix_v2.menu.wipe.all=All Flash Contents -phoenix_v2.menu.wipe.all.upload.erase_cmd=-ca 0x0 -cz "{build.flash_size_bytes}" -phoenix_v2.menu.baud.115200=115200 -phoenix_v2.menu.baud.115200.upload.speed=115200 -phoenix_v2.menu.baud.9600=9600 -phoenix_v2.menu.baud.9600.upload.speed=9600 -phoenix_v2.menu.baud.57600=57600 -phoenix_v2.menu.baud.57600.upload.speed=57600 -phoenix_v2.menu.baud.230400.linux=230400 -phoenix_v2.menu.baud.230400.macosx=230400 -phoenix_v2.menu.baud.230400.upload.speed=230400 -phoenix_v2.menu.baud.256000.windows=256000 -phoenix_v2.menu.baud.256000.upload.speed=256000 -phoenix_v2.menu.baud.460800.linux=460800 -phoenix_v2.menu.baud.460800.macosx=460800 -phoenix_v2.menu.baud.460800.upload.speed=460800 -phoenix_v2.menu.baud.512000.windows=512000 -phoenix_v2.menu.baud.512000.upload.speed=512000 -phoenix_v2.menu.baud.921600=921600 -phoenix_v2.menu.baud.921600.upload.speed=921600 - -############################################################## -nodemcu.name=NodeMCU 0.9 (ESP-12 Module) -nodemcu.build.board=ESP8266_NODEMCU -nodemcu.build.variant=nodemcu -nodemcu.upload.tool=esptool -nodemcu.upload.maximum_data_size=81920 -nodemcu.upload.wait_for_upload_port=true -nodemcu.upload.erase_cmd= -nodemcu.serial.disableDTR=true -nodemcu.serial.disableRTS=true -nodemcu.build.mcu=esp8266 -nodemcu.build.core=esp8266 -nodemcu.build.spiffs_pagesize=256 -nodemcu.build.debug_port= -nodemcu.build.debug_level= -nodemcu.menu.xtal.80=80 MHz -nodemcu.menu.xtal.80.build.f_cpu=80000000L -nodemcu.menu.xtal.160=160 MHz -nodemcu.menu.xtal.160.build.f_cpu=160000000L -nodemcu.menu.vt.flash=Flash -nodemcu.menu.vt.flash.build.vtable_flags=-DVTABLES_IN_FLASH -nodemcu.menu.vt.heap=Heap -nodemcu.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM -nodemcu.menu.vt.iram=IRAM -nodemcu.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM -nodemcu.menu.exception.enabled=Enabled -nodemcu.menu.exception.enabled.build.exception_flags=-fexceptions -nodemcu.menu.exception.enabled.build.stdcpp_lib=-lstdc++ -nodemcu.menu.exception.disabled=Disabled -nodemcu.menu.exception.disabled.build.exception_flags=-fno-exceptions -nodemcu.menu.exception.disabled.build.stdcpp_lib=-lstdc++-nox -nodemcu.upload.resetmethod=nodemcu -nodemcu.build.flash_mode=qio -nodemcu.build.flash_freq=40 -nodemcu.menu.eesz.4M=4M (no SPIFFS) -nodemcu.menu.eesz.4M.build.flash_size=4M -nodemcu.menu.eesz.4M.build.flash_size_bytes=0x400000 -nodemcu.menu.eesz.4M.build.flash_ld=eagle.flash.4m.ld -nodemcu.menu.eesz.4M.build.spiffs_pagesize=256 -nodemcu.menu.eesz.4M.upload.maximum_size=1044464 -nodemcu.menu.eesz.4M.build.rfcal_addr=0x3FC000 -nodemcu.menu.eesz.4M1M=4M (1M SPIFFS) -nodemcu.menu.eesz.4M1M.build.flash_size=4M -nodemcu.menu.eesz.4M1M.build.flash_size_bytes=0x400000 -nodemcu.menu.eesz.4M1M.build.flash_ld=eagle.flash.4m1m.ld -nodemcu.menu.eesz.4M1M.build.spiffs_pagesize=256 -nodemcu.menu.eesz.4M1M.upload.maximum_size=1044464 -nodemcu.menu.eesz.4M1M.build.rfcal_addr=0x3FC000 -nodemcu.menu.eesz.4M1M.build.spiffs_start=0x300000 -nodemcu.menu.eesz.4M1M.build.spiffs_end=0x3FB000 -nodemcu.menu.eesz.4M1M.build.spiffs_blocksize=8192 -nodemcu.menu.eesz.4M2M=4M (2M SPIFFS) -nodemcu.menu.eesz.4M2M.build.flash_size=4M -nodemcu.menu.eesz.4M2M.build.flash_size_bytes=0x400000 -nodemcu.menu.eesz.4M2M.build.flash_ld=eagle.flash.4m2m.ld -nodemcu.menu.eesz.4M2M.build.spiffs_pagesize=256 -nodemcu.menu.eesz.4M2M.upload.maximum_size=1044464 -nodemcu.menu.eesz.4M2M.build.rfcal_addr=0x3FC000 -nodemcu.menu.eesz.4M2M.build.spiffs_start=0x200000 -nodemcu.menu.eesz.4M2M.build.spiffs_end=0x3FB000 -nodemcu.menu.eesz.4M2M.build.spiffs_blocksize=8192 -nodemcu.menu.eesz.4M3M=4M (3M SPIFFS) -nodemcu.menu.eesz.4M3M.build.flash_size=4M -nodemcu.menu.eesz.4M3M.build.flash_size_bytes=0x400000 -nodemcu.menu.eesz.4M3M.build.flash_ld=eagle.flash.4m3m.ld -nodemcu.menu.eesz.4M3M.build.spiffs_pagesize=256 -nodemcu.menu.eesz.4M3M.upload.maximum_size=1044464 -nodemcu.menu.eesz.4M3M.build.rfcal_addr=0x3FC000 -nodemcu.menu.eesz.4M3M.build.spiffs_start=0x100000 -nodemcu.menu.eesz.4M3M.build.spiffs_end=0x3FB000 -nodemcu.menu.eesz.4M3M.build.spiffs_blocksize=8192 -nodemcu.menu.ip.lm2f=v2 Lower Memory -nodemcu.menu.ip.lm2f.build.lwip_include=lwip2/include -nodemcu.menu.ip.lm2f.build.lwip_lib=-llwip2-536-feat -nodemcu.menu.ip.lm2f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -nodemcu.menu.ip.hb2f=v2 Higher Bandwidth -nodemcu.menu.ip.hb2f.build.lwip_include=lwip2/include -nodemcu.menu.ip.hb2f.build.lwip_lib=-llwip2-1460-feat -nodemcu.menu.ip.hb2f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -nodemcu.menu.ip.lm2n=v2 Lower Memory (no features) -nodemcu.menu.ip.lm2n.build.lwip_include=lwip2/include -nodemcu.menu.ip.lm2n.build.lwip_lib=-llwip2-536 -nodemcu.menu.ip.lm2n.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=0 -DLWIP_IPV6=0 -nodemcu.menu.ip.hb2n=v2 Higher Bandwidth (no features) -nodemcu.menu.ip.hb2n.build.lwip_include=lwip2/include -nodemcu.menu.ip.hb2n.build.lwip_lib=-llwip2-1460 -nodemcu.menu.ip.hb2n.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=0 -DLWIP_IPV6=0 -nodemcu.menu.ip.lm6f=v2 IPv6 Lower Memory -nodemcu.menu.ip.lm6f.build.lwip_include=lwip2/include -nodemcu.menu.ip.lm6f.build.lwip_lib=-llwip6-536-feat -nodemcu.menu.ip.lm6f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=1 -nodemcu.menu.ip.hb6f=v2 IPv6 Higher Bandwidth -nodemcu.menu.ip.hb6f.build.lwip_include=lwip2/include -nodemcu.menu.ip.hb6f.build.lwip_lib=-llwip6-1460-feat -nodemcu.menu.ip.hb6f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=1 -DLWIP_IPV6=1 -nodemcu.menu.ip.hb1=v1.4 Higher Bandwidth -nodemcu.menu.ip.hb1.build.lwip_lib=-llwip_gcc -nodemcu.menu.ip.hb1.build.lwip_flags=-DLWIP_OPEN_SRC -nodemcu.menu.ip.src=v1.4 Compile from source -nodemcu.menu.ip.src.build.lwip_lib=-llwip_src -nodemcu.menu.ip.src.build.lwip_flags=-DLWIP_OPEN_SRC -nodemcu.menu.ip.src.recipe.hooks.sketch.prebuild.1.pattern=make -C "{runtime.platform.path}/tools/sdk/lwip/src" install TOOLS_PATH="{runtime.tools.xtensa-lx106-elf-gcc.path}/bin/xtensa-lx106-elf-" -nodemcu.menu.dbg.Disabled=Disabled -nodemcu.menu.dbg.Disabled.build.debug_port= -nodemcu.menu.dbg.Serial=Serial -nodemcu.menu.dbg.Serial.build.debug_port=-DDEBUG_ESP_PORT=Serial -nodemcu.menu.dbg.Serial1=Serial1 -nodemcu.menu.dbg.Serial1.build.debug_port=-DDEBUG_ESP_PORT=Serial1 -nodemcu.menu.lvl.None____=None -nodemcu.menu.lvl.None____.build.debug_level= -nodemcu.menu.lvl.SSL=SSL -nodemcu.menu.lvl.SSL.build.debug_level= -DDEBUG_ESP_SSL -nodemcu.menu.lvl.TLS_MEM=TLS_MEM -nodemcu.menu.lvl.TLS_MEM.build.debug_level= -DDEBUG_ESP_TLS_MEM -nodemcu.menu.lvl.HTTP_CLIENT=HTTP_CLIENT -nodemcu.menu.lvl.HTTP_CLIENT.build.debug_level= -DDEBUG_ESP_HTTP_CLIENT -nodemcu.menu.lvl.HTTP_SERVER=HTTP_SERVER -nodemcu.menu.lvl.HTTP_SERVER.build.debug_level= -DDEBUG_ESP_HTTP_SERVER -nodemcu.menu.lvl.SSLTLS_MEM=SSL+TLS_MEM -nodemcu.menu.lvl.SSLTLS_MEM.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -nodemcu.menu.lvl.SSLHTTP_CLIENT=SSL+HTTP_CLIENT -nodemcu.menu.lvl.SSLHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_CLIENT -nodemcu.menu.lvl.SSLHTTP_SERVER=SSL+HTTP_SERVER -nodemcu.menu.lvl.SSLHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_SERVER -nodemcu.menu.lvl.TLS_MEMHTTP_CLIENT=TLS_MEM+HTTP_CLIENT -nodemcu.menu.lvl.TLS_MEMHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -nodemcu.menu.lvl.TLS_MEMHTTP_SERVER=TLS_MEM+HTTP_SERVER -nodemcu.menu.lvl.TLS_MEMHTTP_SERVER.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_SERVER -nodemcu.menu.lvl.HTTP_CLIENTHTTP_SERVER=HTTP_CLIENT+HTTP_SERVER -nodemcu.menu.lvl.HTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -nodemcu.menu.lvl.SSLTLS_MEMHTTP_CLIENT=SSL+TLS_MEM+HTTP_CLIENT -nodemcu.menu.lvl.SSLTLS_MEMHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -nodemcu.menu.lvl.SSLTLS_MEMHTTP_SERVER=SSL+TLS_MEM+HTTP_SERVER -nodemcu.menu.lvl.SSLTLS_MEMHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_SERVER -nodemcu.menu.lvl.SSLHTTP_CLIENTHTTP_SERVER=SSL+HTTP_CLIENT+HTTP_SERVER -nodemcu.menu.lvl.SSLHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -nodemcu.menu.lvl.TLS_MEMHTTP_CLIENTHTTP_SERVER=TLS_MEM+HTTP_CLIENT+HTTP_SERVER -nodemcu.menu.lvl.TLS_MEMHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -nodemcu.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVER=SSL+TLS_MEM+HTTP_CLIENT+HTTP_SERVER -nodemcu.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -nodemcu.menu.lvl.CORE=CORE -nodemcu.menu.lvl.CORE.build.debug_level= -DDEBUG_ESP_CORE -nodemcu.menu.lvl.WIFI=WIFI -nodemcu.menu.lvl.WIFI.build.debug_level= -DDEBUG_ESP_WIFI -nodemcu.menu.lvl.HTTP_UPDATE=HTTP_UPDATE -nodemcu.menu.lvl.HTTP_UPDATE.build.debug_level= -DDEBUG_ESP_HTTP_UPDATE -nodemcu.menu.lvl.UPDATER=UPDATER -nodemcu.menu.lvl.UPDATER.build.debug_level= -DDEBUG_ESP_UPDATER -nodemcu.menu.lvl.OTA=OTA -nodemcu.menu.lvl.OTA.build.debug_level= -DDEBUG_ESP_OTA -nodemcu.menu.lvl.OOM=OOM -nodemcu.menu.lvl.OOM.build.debug_level= -DDEBUG_ESP_OOM -nodemcu.menu.lvl.COREWIFIHTTP_UPDATEUPDATEROTAOOM=CORE+WIFI+HTTP_UPDATE+UPDATER+OTA+OOM -nodemcu.menu.lvl.COREWIFIHTTP_UPDATEUPDATEROTAOOM.build.debug_level= -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM -nodemcu.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVERCOREWIFIHTTP_UPDATEUPDATEROTAOOM=SSL+TLS_MEM+HTTP_CLIENT+HTTP_SERVER+CORE+WIFI+HTTP_UPDATE+UPDATER+OTA+OOM -nodemcu.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVERCOREWIFIHTTP_UPDATEUPDATEROTAOOM.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM -nodemcu.menu.lvl.NoAssert-NDEBUG=NoAssert-NDEBUG -nodemcu.menu.lvl.NoAssert-NDEBUG.build.debug_level= -DNDEBUG -nodemcu.menu.wipe.none=Only Sketch -nodemcu.menu.wipe.none.upload.erase_cmd= -nodemcu.menu.wipe.sdk=Sketch + WiFi Settings -nodemcu.menu.wipe.sdk.upload.erase_cmd=-ca "{build.rfcal_addr}" -cz 0x4000 -nodemcu.menu.wipe.all=All Flash Contents -nodemcu.menu.wipe.all.upload.erase_cmd=-ca 0x0 -cz "{build.flash_size_bytes}" -nodemcu.menu.baud.115200=115200 -nodemcu.menu.baud.115200.upload.speed=115200 -nodemcu.menu.baud.9600=9600 -nodemcu.menu.baud.9600.upload.speed=9600 -nodemcu.menu.baud.57600=57600 -nodemcu.menu.baud.57600.upload.speed=57600 -nodemcu.menu.baud.230400.linux=230400 -nodemcu.menu.baud.230400.macosx=230400 -nodemcu.menu.baud.230400.upload.speed=230400 -nodemcu.menu.baud.256000.windows=256000 -nodemcu.menu.baud.256000.upload.speed=256000 -nodemcu.menu.baud.460800.linux=460800 -nodemcu.menu.baud.460800.macosx=460800 -nodemcu.menu.baud.460800.upload.speed=460800 -nodemcu.menu.baud.512000.windows=512000 -nodemcu.menu.baud.512000.upload.speed=512000 -nodemcu.menu.baud.921600=921600 -nodemcu.menu.baud.921600.upload.speed=921600 - -############################################################## -nodemcuv2.name=NodeMCU 1.0 (ESP-12E Module) -nodemcuv2.build.board=ESP8266_NODEMCU -nodemcuv2.build.variant=nodemcu -nodemcuv2.upload.tool=esptool -nodemcuv2.upload.maximum_data_size=81920 -nodemcuv2.upload.wait_for_upload_port=true -nodemcuv2.upload.erase_cmd= -nodemcuv2.serial.disableDTR=true -nodemcuv2.serial.disableRTS=true -nodemcuv2.build.mcu=esp8266 -nodemcuv2.build.core=esp8266 -nodemcuv2.build.spiffs_pagesize=256 -nodemcuv2.build.debug_port= -nodemcuv2.build.debug_level= -nodemcuv2.menu.xtal.80=80 MHz -nodemcuv2.menu.xtal.80.build.f_cpu=80000000L -nodemcuv2.menu.xtal.160=160 MHz -nodemcuv2.menu.xtal.160.build.f_cpu=160000000L -nodemcuv2.menu.vt.flash=Flash -nodemcuv2.menu.vt.flash.build.vtable_flags=-DVTABLES_IN_FLASH -nodemcuv2.menu.vt.heap=Heap -nodemcuv2.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM -nodemcuv2.menu.vt.iram=IRAM -nodemcuv2.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM -nodemcuv2.menu.exception.enabled=Enabled -nodemcuv2.menu.exception.enabled.build.exception_flags=-fexceptions -nodemcuv2.menu.exception.enabled.build.stdcpp_lib=-lstdc++ -nodemcuv2.menu.exception.disabled=Disabled -nodemcuv2.menu.exception.disabled.build.exception_flags=-fno-exceptions -nodemcuv2.menu.exception.disabled.build.stdcpp_lib=-lstdc++-nox -nodemcuv2.upload.resetmethod=nodemcu -nodemcuv2.build.flash_mode=dio -nodemcuv2.build.flash_freq=40 -nodemcuv2.menu.eesz.4M=4M (no SPIFFS) -nodemcuv2.menu.eesz.4M.build.flash_size=4M -nodemcuv2.menu.eesz.4M.build.flash_size_bytes=0x400000 -nodemcuv2.menu.eesz.4M.build.flash_ld=eagle.flash.4m.ld -nodemcuv2.menu.eesz.4M.build.spiffs_pagesize=256 -nodemcuv2.menu.eesz.4M.upload.maximum_size=1044464 -nodemcuv2.menu.eesz.4M.build.rfcal_addr=0x3FC000 -nodemcuv2.menu.eesz.4M1M=4M (1M SPIFFS) -nodemcuv2.menu.eesz.4M1M.build.flash_size=4M -nodemcuv2.menu.eesz.4M1M.build.flash_size_bytes=0x400000 -nodemcuv2.menu.eesz.4M1M.build.flash_ld=eagle.flash.4m1m.ld -nodemcuv2.menu.eesz.4M1M.build.spiffs_pagesize=256 -nodemcuv2.menu.eesz.4M1M.upload.maximum_size=1044464 -nodemcuv2.menu.eesz.4M1M.build.rfcal_addr=0x3FC000 -nodemcuv2.menu.eesz.4M1M.build.spiffs_start=0x300000 -nodemcuv2.menu.eesz.4M1M.build.spiffs_end=0x3FB000 -nodemcuv2.menu.eesz.4M1M.build.spiffs_blocksize=8192 -nodemcuv2.menu.eesz.4M2M=4M (2M SPIFFS) -nodemcuv2.menu.eesz.4M2M.build.flash_size=4M -nodemcuv2.menu.eesz.4M2M.build.flash_size_bytes=0x400000 -nodemcuv2.menu.eesz.4M2M.build.flash_ld=eagle.flash.4m2m.ld -nodemcuv2.menu.eesz.4M2M.build.spiffs_pagesize=256 -nodemcuv2.menu.eesz.4M2M.upload.maximum_size=1044464 -nodemcuv2.menu.eesz.4M2M.build.rfcal_addr=0x3FC000 -nodemcuv2.menu.eesz.4M2M.build.spiffs_start=0x200000 -nodemcuv2.menu.eesz.4M2M.build.spiffs_end=0x3FB000 -nodemcuv2.menu.eesz.4M2M.build.spiffs_blocksize=8192 -nodemcuv2.menu.eesz.4M3M=4M (3M SPIFFS) -nodemcuv2.menu.eesz.4M3M.build.flash_size=4M -nodemcuv2.menu.eesz.4M3M.build.flash_size_bytes=0x400000 -nodemcuv2.menu.eesz.4M3M.build.flash_ld=eagle.flash.4m3m.ld -nodemcuv2.menu.eesz.4M3M.build.spiffs_pagesize=256 -nodemcuv2.menu.eesz.4M3M.upload.maximum_size=1044464 -nodemcuv2.menu.eesz.4M3M.build.rfcal_addr=0x3FC000 -nodemcuv2.menu.eesz.4M3M.build.spiffs_start=0x100000 -nodemcuv2.menu.eesz.4M3M.build.spiffs_end=0x3FB000 -nodemcuv2.menu.eesz.4M3M.build.spiffs_blocksize=8192 -nodemcuv2.menu.ip.lm2f=v2 Lower Memory -nodemcuv2.menu.ip.lm2f.build.lwip_include=lwip2/include -nodemcuv2.menu.ip.lm2f.build.lwip_lib=-llwip2-536-feat -nodemcuv2.menu.ip.lm2f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -nodemcuv2.menu.ip.hb2f=v2 Higher Bandwidth -nodemcuv2.menu.ip.hb2f.build.lwip_include=lwip2/include -nodemcuv2.menu.ip.hb2f.build.lwip_lib=-llwip2-1460-feat -nodemcuv2.menu.ip.hb2f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -nodemcuv2.menu.ip.lm2n=v2 Lower Memory (no features) -nodemcuv2.menu.ip.lm2n.build.lwip_include=lwip2/include -nodemcuv2.menu.ip.lm2n.build.lwip_lib=-llwip2-536 -nodemcuv2.menu.ip.lm2n.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=0 -DLWIP_IPV6=0 -nodemcuv2.menu.ip.hb2n=v2 Higher Bandwidth (no features) -nodemcuv2.menu.ip.hb2n.build.lwip_include=lwip2/include -nodemcuv2.menu.ip.hb2n.build.lwip_lib=-llwip2-1460 -nodemcuv2.menu.ip.hb2n.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=0 -DLWIP_IPV6=0 -nodemcuv2.menu.ip.lm6f=v2 IPv6 Lower Memory -nodemcuv2.menu.ip.lm6f.build.lwip_include=lwip2/include -nodemcuv2.menu.ip.lm6f.build.lwip_lib=-llwip6-536-feat -nodemcuv2.menu.ip.lm6f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=1 -nodemcuv2.menu.ip.hb6f=v2 IPv6 Higher Bandwidth -nodemcuv2.menu.ip.hb6f.build.lwip_include=lwip2/include -nodemcuv2.menu.ip.hb6f.build.lwip_lib=-llwip6-1460-feat -nodemcuv2.menu.ip.hb6f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=1 -DLWIP_IPV6=1 -nodemcuv2.menu.ip.hb1=v1.4 Higher Bandwidth -nodemcuv2.menu.ip.hb1.build.lwip_lib=-llwip_gcc -nodemcuv2.menu.ip.hb1.build.lwip_flags=-DLWIP_OPEN_SRC -nodemcuv2.menu.ip.src=v1.4 Compile from source -nodemcuv2.menu.ip.src.build.lwip_lib=-llwip_src -nodemcuv2.menu.ip.src.build.lwip_flags=-DLWIP_OPEN_SRC -nodemcuv2.menu.ip.src.recipe.hooks.sketch.prebuild.1.pattern=make -C "{runtime.platform.path}/tools/sdk/lwip/src" install TOOLS_PATH="{runtime.tools.xtensa-lx106-elf-gcc.path}/bin/xtensa-lx106-elf-" -nodemcuv2.menu.dbg.Disabled=Disabled -nodemcuv2.menu.dbg.Disabled.build.debug_port= -nodemcuv2.menu.dbg.Serial=Serial -nodemcuv2.menu.dbg.Serial.build.debug_port=-DDEBUG_ESP_PORT=Serial -nodemcuv2.menu.dbg.Serial1=Serial1 -nodemcuv2.menu.dbg.Serial1.build.debug_port=-DDEBUG_ESP_PORT=Serial1 -nodemcuv2.menu.lvl.None____=None -nodemcuv2.menu.lvl.None____.build.debug_level= -nodemcuv2.menu.lvl.SSL=SSL -nodemcuv2.menu.lvl.SSL.build.debug_level= -DDEBUG_ESP_SSL -nodemcuv2.menu.lvl.TLS_MEM=TLS_MEM -nodemcuv2.menu.lvl.TLS_MEM.build.debug_level= -DDEBUG_ESP_TLS_MEM -nodemcuv2.menu.lvl.HTTP_CLIENT=HTTP_CLIENT -nodemcuv2.menu.lvl.HTTP_CLIENT.build.debug_level= -DDEBUG_ESP_HTTP_CLIENT -nodemcuv2.menu.lvl.HTTP_SERVER=HTTP_SERVER -nodemcuv2.menu.lvl.HTTP_SERVER.build.debug_level= -DDEBUG_ESP_HTTP_SERVER -nodemcuv2.menu.lvl.SSLTLS_MEM=SSL+TLS_MEM -nodemcuv2.menu.lvl.SSLTLS_MEM.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -nodemcuv2.menu.lvl.SSLHTTP_CLIENT=SSL+HTTP_CLIENT -nodemcuv2.menu.lvl.SSLHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_CLIENT -nodemcuv2.menu.lvl.SSLHTTP_SERVER=SSL+HTTP_SERVER -nodemcuv2.menu.lvl.SSLHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_SERVER -nodemcuv2.menu.lvl.TLS_MEMHTTP_CLIENT=TLS_MEM+HTTP_CLIENT -nodemcuv2.menu.lvl.TLS_MEMHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -nodemcuv2.menu.lvl.TLS_MEMHTTP_SERVER=TLS_MEM+HTTP_SERVER -nodemcuv2.menu.lvl.TLS_MEMHTTP_SERVER.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_SERVER -nodemcuv2.menu.lvl.HTTP_CLIENTHTTP_SERVER=HTTP_CLIENT+HTTP_SERVER -nodemcuv2.menu.lvl.HTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -nodemcuv2.menu.lvl.SSLTLS_MEMHTTP_CLIENT=SSL+TLS_MEM+HTTP_CLIENT -nodemcuv2.menu.lvl.SSLTLS_MEMHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -nodemcuv2.menu.lvl.SSLTLS_MEMHTTP_SERVER=SSL+TLS_MEM+HTTP_SERVER -nodemcuv2.menu.lvl.SSLTLS_MEMHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_SERVER -nodemcuv2.menu.lvl.SSLHTTP_CLIENTHTTP_SERVER=SSL+HTTP_CLIENT+HTTP_SERVER -nodemcuv2.menu.lvl.SSLHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -nodemcuv2.menu.lvl.TLS_MEMHTTP_CLIENTHTTP_SERVER=TLS_MEM+HTTP_CLIENT+HTTP_SERVER -nodemcuv2.menu.lvl.TLS_MEMHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -nodemcuv2.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVER=SSL+TLS_MEM+HTTP_CLIENT+HTTP_SERVER -nodemcuv2.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -nodemcuv2.menu.lvl.CORE=CORE -nodemcuv2.menu.lvl.CORE.build.debug_level= -DDEBUG_ESP_CORE -nodemcuv2.menu.lvl.WIFI=WIFI -nodemcuv2.menu.lvl.WIFI.build.debug_level= -DDEBUG_ESP_WIFI -nodemcuv2.menu.lvl.HTTP_UPDATE=HTTP_UPDATE -nodemcuv2.menu.lvl.HTTP_UPDATE.build.debug_level= -DDEBUG_ESP_HTTP_UPDATE -nodemcuv2.menu.lvl.UPDATER=UPDATER -nodemcuv2.menu.lvl.UPDATER.build.debug_level= -DDEBUG_ESP_UPDATER -nodemcuv2.menu.lvl.OTA=OTA -nodemcuv2.menu.lvl.OTA.build.debug_level= -DDEBUG_ESP_OTA -nodemcuv2.menu.lvl.OOM=OOM -nodemcuv2.menu.lvl.OOM.build.debug_level= -DDEBUG_ESP_OOM -nodemcuv2.menu.lvl.COREWIFIHTTP_UPDATEUPDATEROTAOOM=CORE+WIFI+HTTP_UPDATE+UPDATER+OTA+OOM -nodemcuv2.menu.lvl.COREWIFIHTTP_UPDATEUPDATEROTAOOM.build.debug_level= -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM -nodemcuv2.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVERCOREWIFIHTTP_UPDATEUPDATEROTAOOM=SSL+TLS_MEM+HTTP_CLIENT+HTTP_SERVER+CORE+WIFI+HTTP_UPDATE+UPDATER+OTA+OOM -nodemcuv2.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVERCOREWIFIHTTP_UPDATEUPDATEROTAOOM.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM -nodemcuv2.menu.lvl.NoAssert-NDEBUG=NoAssert-NDEBUG -nodemcuv2.menu.lvl.NoAssert-NDEBUG.build.debug_level= -DNDEBUG -nodemcuv2.menu.wipe.none=Only Sketch -nodemcuv2.menu.wipe.none.upload.erase_cmd= -nodemcuv2.menu.wipe.sdk=Sketch + WiFi Settings -nodemcuv2.menu.wipe.sdk.upload.erase_cmd=-ca "{build.rfcal_addr}" -cz 0x4000 -nodemcuv2.menu.wipe.all=All Flash Contents -nodemcuv2.menu.wipe.all.upload.erase_cmd=-ca 0x0 -cz "{build.flash_size_bytes}" -nodemcuv2.menu.baud.115200=115200 -nodemcuv2.menu.baud.115200.upload.speed=115200 -nodemcuv2.menu.baud.9600=9600 -nodemcuv2.menu.baud.9600.upload.speed=9600 -nodemcuv2.menu.baud.57600=57600 -nodemcuv2.menu.baud.57600.upload.speed=57600 -nodemcuv2.menu.baud.230400.linux=230400 -nodemcuv2.menu.baud.230400.macosx=230400 -nodemcuv2.menu.baud.230400.upload.speed=230400 -nodemcuv2.menu.baud.256000.windows=256000 -nodemcuv2.menu.baud.256000.upload.speed=256000 -nodemcuv2.menu.baud.460800.linux=460800 -nodemcuv2.menu.baud.460800.macosx=460800 -nodemcuv2.menu.baud.460800.upload.speed=460800 -nodemcuv2.menu.baud.512000.windows=512000 -nodemcuv2.menu.baud.512000.upload.speed=512000 -nodemcuv2.menu.baud.921600=921600 -nodemcuv2.menu.baud.921600.upload.speed=921600 - -############################################################## -modwifi.name=Olimex MOD-WIFI-ESP8266(-DEV) -modwifi.build.board=MOD_WIFI_ESP8266 -modwifi.build.variant=modwifi -modwifi.upload.tool=esptool -modwifi.upload.maximum_data_size=81920 -modwifi.upload.wait_for_upload_port=true -modwifi.upload.erase_cmd= -modwifi.serial.disableDTR=true -modwifi.serial.disableRTS=true -modwifi.build.mcu=esp8266 -modwifi.build.core=esp8266 -modwifi.build.spiffs_pagesize=256 -modwifi.build.debug_port= -modwifi.build.debug_level= -modwifi.menu.xtal.80=80 MHz -modwifi.menu.xtal.80.build.f_cpu=80000000L -modwifi.menu.xtal.160=160 MHz -modwifi.menu.xtal.160.build.f_cpu=160000000L -modwifi.menu.vt.flash=Flash -modwifi.menu.vt.flash.build.vtable_flags=-DVTABLES_IN_FLASH -modwifi.menu.vt.heap=Heap -modwifi.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM -modwifi.menu.vt.iram=IRAM -modwifi.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM -modwifi.menu.exception.enabled=Enabled -modwifi.menu.exception.enabled.build.exception_flags=-fexceptions -modwifi.menu.exception.enabled.build.stdcpp_lib=-lstdc++ -modwifi.menu.exception.disabled=Disabled -modwifi.menu.exception.disabled.build.exception_flags=-fno-exceptions -modwifi.menu.exception.disabled.build.stdcpp_lib=-lstdc++-nox -modwifi.upload.resetmethod=ck -modwifi.build.flash_mode=qio -modwifi.build.flash_freq=40 -modwifi.menu.eesz.2M=2M (no SPIFFS) -modwifi.menu.eesz.2M.build.flash_size=2M -modwifi.menu.eesz.2M.build.flash_size_bytes=0x200000 -modwifi.menu.eesz.2M.build.flash_ld=eagle.flash.2m.ld -modwifi.menu.eesz.2M.build.spiffs_pagesize=256 -modwifi.menu.eesz.2M.upload.maximum_size=1044464 -modwifi.menu.eesz.2M.build.rfcal_addr=0x1FC000 -modwifi.menu.eesz.2M128=2M (128K SPIFFS) -modwifi.menu.eesz.2M128.build.flash_size=2M -modwifi.menu.eesz.2M128.build.flash_size_bytes=0x200000 -modwifi.menu.eesz.2M128.build.flash_ld=eagle.flash.2m128.ld -modwifi.menu.eesz.2M128.build.spiffs_pagesize=256 -modwifi.menu.eesz.2M128.upload.maximum_size=1044464 -modwifi.menu.eesz.2M128.build.rfcal_addr=0x1FC000 -modwifi.menu.eesz.2M128.build.spiffs_start=0x1E0000 -modwifi.menu.eesz.2M128.build.spiffs_end=0x1FB000 -modwifi.menu.eesz.2M128.build.spiffs_blocksize=4096 -modwifi.menu.eesz.2M256=2M (256K SPIFFS) -modwifi.menu.eesz.2M256.build.flash_size=2M -modwifi.menu.eesz.2M256.build.flash_size_bytes=0x200000 -modwifi.menu.eesz.2M256.build.flash_ld=eagle.flash.2m256.ld -modwifi.menu.eesz.2M256.build.spiffs_pagesize=256 -modwifi.menu.eesz.2M256.upload.maximum_size=1044464 -modwifi.menu.eesz.2M256.build.rfcal_addr=0x1FC000 -modwifi.menu.eesz.2M256.build.spiffs_start=0x1C0000 -modwifi.menu.eesz.2M256.build.spiffs_end=0x1FB000 -modwifi.menu.eesz.2M256.build.spiffs_blocksize=4096 -modwifi.menu.eesz.2M512=2M (512K SPIFFS) -modwifi.menu.eesz.2M512.build.flash_size=2M -modwifi.menu.eesz.2M512.build.flash_size_bytes=0x200000 -modwifi.menu.eesz.2M512.build.flash_ld=eagle.flash.2m512.ld -modwifi.menu.eesz.2M512.build.spiffs_pagesize=256 -modwifi.menu.eesz.2M512.upload.maximum_size=1044464 -modwifi.menu.eesz.2M512.build.rfcal_addr=0x1FC000 -modwifi.menu.eesz.2M512.build.spiffs_start=0x180000 -modwifi.menu.eesz.2M512.build.spiffs_end=0x1FB000 -modwifi.menu.eesz.2M512.build.spiffs_blocksize=8192 -modwifi.menu.eesz.2M1M=2M (1M SPIFFS) -modwifi.menu.eesz.2M1M.build.flash_size=2M -modwifi.menu.eesz.2M1M.build.flash_size_bytes=0x200000 -modwifi.menu.eesz.2M1M.build.flash_ld=eagle.flash.2m1m.ld -modwifi.menu.eesz.2M1M.build.spiffs_pagesize=256 -modwifi.menu.eesz.2M1M.upload.maximum_size=1044464 -modwifi.menu.eesz.2M1M.build.rfcal_addr=0x1FC000 -modwifi.menu.eesz.2M1M.build.spiffs_start=0x100000 -modwifi.menu.eesz.2M1M.build.spiffs_end=0x1FB000 -modwifi.menu.eesz.2M1M.build.spiffs_blocksize=8192 -modwifi.menu.ip.lm2f=v2 Lower Memory -modwifi.menu.ip.lm2f.build.lwip_include=lwip2/include -modwifi.menu.ip.lm2f.build.lwip_lib=-llwip2-536-feat -modwifi.menu.ip.lm2f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -modwifi.menu.ip.hb2f=v2 Higher Bandwidth -modwifi.menu.ip.hb2f.build.lwip_include=lwip2/include -modwifi.menu.ip.hb2f.build.lwip_lib=-llwip2-1460-feat -modwifi.menu.ip.hb2f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -modwifi.menu.ip.lm2n=v2 Lower Memory (no features) -modwifi.menu.ip.lm2n.build.lwip_include=lwip2/include -modwifi.menu.ip.lm2n.build.lwip_lib=-llwip2-536 -modwifi.menu.ip.lm2n.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=0 -DLWIP_IPV6=0 -modwifi.menu.ip.hb2n=v2 Higher Bandwidth (no features) -modwifi.menu.ip.hb2n.build.lwip_include=lwip2/include -modwifi.menu.ip.hb2n.build.lwip_lib=-llwip2-1460 -modwifi.menu.ip.hb2n.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=0 -DLWIP_IPV6=0 -modwifi.menu.ip.lm6f=v2 IPv6 Lower Memory -modwifi.menu.ip.lm6f.build.lwip_include=lwip2/include -modwifi.menu.ip.lm6f.build.lwip_lib=-llwip6-536-feat -modwifi.menu.ip.lm6f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=1 -modwifi.menu.ip.hb6f=v2 IPv6 Higher Bandwidth -modwifi.menu.ip.hb6f.build.lwip_include=lwip2/include -modwifi.menu.ip.hb6f.build.lwip_lib=-llwip6-1460-feat -modwifi.menu.ip.hb6f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=1 -DLWIP_IPV6=1 -modwifi.menu.ip.hb1=v1.4 Higher Bandwidth -modwifi.menu.ip.hb1.build.lwip_lib=-llwip_gcc -modwifi.menu.ip.hb1.build.lwip_flags=-DLWIP_OPEN_SRC -modwifi.menu.ip.src=v1.4 Compile from source -modwifi.menu.ip.src.build.lwip_lib=-llwip_src -modwifi.menu.ip.src.build.lwip_flags=-DLWIP_OPEN_SRC -modwifi.menu.ip.src.recipe.hooks.sketch.prebuild.1.pattern=make -C "{runtime.platform.path}/tools/sdk/lwip/src" install TOOLS_PATH="{runtime.tools.xtensa-lx106-elf-gcc.path}/bin/xtensa-lx106-elf-" -modwifi.menu.dbg.Disabled=Disabled -modwifi.menu.dbg.Disabled.build.debug_port= -modwifi.menu.dbg.Serial=Serial -modwifi.menu.dbg.Serial.build.debug_port=-DDEBUG_ESP_PORT=Serial -modwifi.menu.dbg.Serial1=Serial1 -modwifi.menu.dbg.Serial1.build.debug_port=-DDEBUG_ESP_PORT=Serial1 -modwifi.menu.lvl.None____=None -modwifi.menu.lvl.None____.build.debug_level= -modwifi.menu.lvl.SSL=SSL -modwifi.menu.lvl.SSL.build.debug_level= -DDEBUG_ESP_SSL -modwifi.menu.lvl.TLS_MEM=TLS_MEM -modwifi.menu.lvl.TLS_MEM.build.debug_level= -DDEBUG_ESP_TLS_MEM -modwifi.menu.lvl.HTTP_CLIENT=HTTP_CLIENT -modwifi.menu.lvl.HTTP_CLIENT.build.debug_level= -DDEBUG_ESP_HTTP_CLIENT -modwifi.menu.lvl.HTTP_SERVER=HTTP_SERVER -modwifi.menu.lvl.HTTP_SERVER.build.debug_level= -DDEBUG_ESP_HTTP_SERVER -modwifi.menu.lvl.SSLTLS_MEM=SSL+TLS_MEM -modwifi.menu.lvl.SSLTLS_MEM.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -modwifi.menu.lvl.SSLHTTP_CLIENT=SSL+HTTP_CLIENT -modwifi.menu.lvl.SSLHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_CLIENT -modwifi.menu.lvl.SSLHTTP_SERVER=SSL+HTTP_SERVER -modwifi.menu.lvl.SSLHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_SERVER -modwifi.menu.lvl.TLS_MEMHTTP_CLIENT=TLS_MEM+HTTP_CLIENT -modwifi.menu.lvl.TLS_MEMHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -modwifi.menu.lvl.TLS_MEMHTTP_SERVER=TLS_MEM+HTTP_SERVER -modwifi.menu.lvl.TLS_MEMHTTP_SERVER.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_SERVER -modwifi.menu.lvl.HTTP_CLIENTHTTP_SERVER=HTTP_CLIENT+HTTP_SERVER -modwifi.menu.lvl.HTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -modwifi.menu.lvl.SSLTLS_MEMHTTP_CLIENT=SSL+TLS_MEM+HTTP_CLIENT -modwifi.menu.lvl.SSLTLS_MEMHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -modwifi.menu.lvl.SSLTLS_MEMHTTP_SERVER=SSL+TLS_MEM+HTTP_SERVER -modwifi.menu.lvl.SSLTLS_MEMHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_SERVER -modwifi.menu.lvl.SSLHTTP_CLIENTHTTP_SERVER=SSL+HTTP_CLIENT+HTTP_SERVER -modwifi.menu.lvl.SSLHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -modwifi.menu.lvl.TLS_MEMHTTP_CLIENTHTTP_SERVER=TLS_MEM+HTTP_CLIENT+HTTP_SERVER -modwifi.menu.lvl.TLS_MEMHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -modwifi.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVER=SSL+TLS_MEM+HTTP_CLIENT+HTTP_SERVER -modwifi.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -modwifi.menu.lvl.CORE=CORE -modwifi.menu.lvl.CORE.build.debug_level= -DDEBUG_ESP_CORE -modwifi.menu.lvl.WIFI=WIFI -modwifi.menu.lvl.WIFI.build.debug_level= -DDEBUG_ESP_WIFI -modwifi.menu.lvl.HTTP_UPDATE=HTTP_UPDATE -modwifi.menu.lvl.HTTP_UPDATE.build.debug_level= -DDEBUG_ESP_HTTP_UPDATE -modwifi.menu.lvl.UPDATER=UPDATER -modwifi.menu.lvl.UPDATER.build.debug_level= -DDEBUG_ESP_UPDATER -modwifi.menu.lvl.OTA=OTA -modwifi.menu.lvl.OTA.build.debug_level= -DDEBUG_ESP_OTA -modwifi.menu.lvl.OOM=OOM -modwifi.menu.lvl.OOM.build.debug_level= -DDEBUG_ESP_OOM -modwifi.menu.lvl.COREWIFIHTTP_UPDATEUPDATEROTAOOM=CORE+WIFI+HTTP_UPDATE+UPDATER+OTA+OOM -modwifi.menu.lvl.COREWIFIHTTP_UPDATEUPDATEROTAOOM.build.debug_level= -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM -modwifi.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVERCOREWIFIHTTP_UPDATEUPDATEROTAOOM=SSL+TLS_MEM+HTTP_CLIENT+HTTP_SERVER+CORE+WIFI+HTTP_UPDATE+UPDATER+OTA+OOM -modwifi.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVERCOREWIFIHTTP_UPDATEUPDATEROTAOOM.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM -modwifi.menu.lvl.NoAssert-NDEBUG=NoAssert-NDEBUG -modwifi.menu.lvl.NoAssert-NDEBUG.build.debug_level= -DNDEBUG -modwifi.menu.wipe.none=Only Sketch -modwifi.menu.wipe.none.upload.erase_cmd= -modwifi.menu.wipe.sdk=Sketch + WiFi Settings -modwifi.menu.wipe.sdk.upload.erase_cmd=-ca "{build.rfcal_addr}" -cz 0x4000 -modwifi.menu.wipe.all=All Flash Contents -modwifi.menu.wipe.all.upload.erase_cmd=-ca 0x0 -cz "{build.flash_size_bytes}" -modwifi.menu.baud.115200=115200 -modwifi.menu.baud.115200.upload.speed=115200 -modwifi.menu.baud.9600=9600 -modwifi.menu.baud.9600.upload.speed=9600 -modwifi.menu.baud.57600=57600 -modwifi.menu.baud.57600.upload.speed=57600 -modwifi.menu.baud.230400.linux=230400 -modwifi.menu.baud.230400.macosx=230400 -modwifi.menu.baud.230400.upload.speed=230400 -modwifi.menu.baud.256000.windows=256000 -modwifi.menu.baud.256000.upload.speed=256000 -modwifi.menu.baud.460800.linux=460800 -modwifi.menu.baud.460800.macosx=460800 -modwifi.menu.baud.460800.upload.speed=460800 -modwifi.menu.baud.512000.windows=512000 -modwifi.menu.baud.512000.upload.speed=512000 -modwifi.menu.baud.921600=921600 -modwifi.menu.baud.921600.upload.speed=921600 - -############################################################## -thing.name=SparkFun ESP8266 Thing -thing.build.board=ESP8266_THING -thing.build.variant=thing -thing.upload.tool=esptool -thing.upload.maximum_data_size=81920 -thing.upload.wait_for_upload_port=true -thing.upload.erase_cmd= -thing.serial.disableDTR=true -thing.serial.disableRTS=true -thing.build.mcu=esp8266 -thing.build.core=esp8266 -thing.build.spiffs_pagesize=256 -thing.build.debug_port= -thing.build.debug_level= -thing.menu.xtal.80=80 MHz -thing.menu.xtal.80.build.f_cpu=80000000L -thing.menu.xtal.160=160 MHz -thing.menu.xtal.160.build.f_cpu=160000000L -thing.menu.vt.flash=Flash -thing.menu.vt.flash.build.vtable_flags=-DVTABLES_IN_FLASH -thing.menu.vt.heap=Heap -thing.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM -thing.menu.vt.iram=IRAM -thing.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM -thing.menu.exception.enabled=Enabled -thing.menu.exception.enabled.build.exception_flags=-fexceptions -thing.menu.exception.enabled.build.stdcpp_lib=-lstdc++ -thing.menu.exception.disabled=Disabled -thing.menu.exception.disabled.build.exception_flags=-fno-exceptions -thing.menu.exception.disabled.build.stdcpp_lib=-lstdc++-nox -thing.upload.resetmethod=ck -thing.build.flash_mode=qio -thing.build.flash_freq=40 -thing.menu.eesz.512K=512K (no SPIFFS) -thing.menu.eesz.512K.build.flash_size=512K -thing.menu.eesz.512K.build.flash_size_bytes=0x80000 -thing.menu.eesz.512K.build.flash_ld=eagle.flash.512k.ld -thing.menu.eesz.512K.build.spiffs_pagesize=256 -thing.menu.eesz.512K.upload.maximum_size=499696 -thing.menu.eesz.512K.build.rfcal_addr=0x7C000 -thing.menu.eesz.512K32=512K (32K SPIFFS) -thing.menu.eesz.512K32.build.flash_size=512K -thing.menu.eesz.512K32.build.flash_size_bytes=0x80000 -thing.menu.eesz.512K32.build.flash_ld=eagle.flash.512k32.ld -thing.menu.eesz.512K32.build.spiffs_pagesize=256 -thing.menu.eesz.512K32.upload.maximum_size=466928 -thing.menu.eesz.512K32.build.rfcal_addr=0x7C000 -thing.menu.eesz.512K32.build.spiffs_start=0x73000 -thing.menu.eesz.512K32.build.spiffs_end=0x7B000 -thing.menu.eesz.512K32.build.spiffs_blocksize=4096 -thing.menu.eesz.512K64=512K (64K SPIFFS) -thing.menu.eesz.512K64.build.flash_size=512K -thing.menu.eesz.512K64.build.flash_size_bytes=0x80000 -thing.menu.eesz.512K64.build.flash_ld=eagle.flash.512k64.ld -thing.menu.eesz.512K64.build.spiffs_pagesize=256 -thing.menu.eesz.512K64.upload.maximum_size=434160 -thing.menu.eesz.512K64.build.rfcal_addr=0x7C000 -thing.menu.eesz.512K64.build.spiffs_start=0x6B000 -thing.menu.eesz.512K64.build.spiffs_end=0x7B000 -thing.menu.eesz.512K64.build.spiffs_blocksize=4096 -thing.menu.eesz.512K128=512K (128K SPIFFS) -thing.menu.eesz.512K128.build.flash_size=512K -thing.menu.eesz.512K128.build.flash_size_bytes=0x80000 -thing.menu.eesz.512K128.build.flash_ld=eagle.flash.512k128.ld -thing.menu.eesz.512K128.build.spiffs_pagesize=256 -thing.menu.eesz.512K128.upload.maximum_size=368624 -thing.menu.eesz.512K128.build.rfcal_addr=0x7C000 -thing.menu.eesz.512K128.build.spiffs_start=0x5B000 -thing.menu.eesz.512K128.build.spiffs_end=0x7B000 -thing.menu.eesz.512K128.build.spiffs_blocksize=4096 -thing.menu.ip.lm2f=v2 Lower Memory -thing.menu.ip.lm2f.build.lwip_include=lwip2/include -thing.menu.ip.lm2f.build.lwip_lib=-llwip2-536-feat -thing.menu.ip.lm2f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -thing.menu.ip.hb2f=v2 Higher Bandwidth -thing.menu.ip.hb2f.build.lwip_include=lwip2/include -thing.menu.ip.hb2f.build.lwip_lib=-llwip2-1460-feat -thing.menu.ip.hb2f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -thing.menu.ip.lm2n=v2 Lower Memory (no features) -thing.menu.ip.lm2n.build.lwip_include=lwip2/include -thing.menu.ip.lm2n.build.lwip_lib=-llwip2-536 -thing.menu.ip.lm2n.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=0 -DLWIP_IPV6=0 -thing.menu.ip.hb2n=v2 Higher Bandwidth (no features) -thing.menu.ip.hb2n.build.lwip_include=lwip2/include -thing.menu.ip.hb2n.build.lwip_lib=-llwip2-1460 -thing.menu.ip.hb2n.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=0 -DLWIP_IPV6=0 -thing.menu.ip.lm6f=v2 IPv6 Lower Memory -thing.menu.ip.lm6f.build.lwip_include=lwip2/include -thing.menu.ip.lm6f.build.lwip_lib=-llwip6-536-feat -thing.menu.ip.lm6f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=1 -thing.menu.ip.hb6f=v2 IPv6 Higher Bandwidth -thing.menu.ip.hb6f.build.lwip_include=lwip2/include -thing.menu.ip.hb6f.build.lwip_lib=-llwip6-1460-feat -thing.menu.ip.hb6f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=1 -DLWIP_IPV6=1 -thing.menu.ip.hb1=v1.4 Higher Bandwidth -thing.menu.ip.hb1.build.lwip_lib=-llwip_gcc -thing.menu.ip.hb1.build.lwip_flags=-DLWIP_OPEN_SRC -thing.menu.ip.src=v1.4 Compile from source -thing.menu.ip.src.build.lwip_lib=-llwip_src -thing.menu.ip.src.build.lwip_flags=-DLWIP_OPEN_SRC -thing.menu.ip.src.recipe.hooks.sketch.prebuild.1.pattern=make -C "{runtime.platform.path}/tools/sdk/lwip/src" install TOOLS_PATH="{runtime.tools.xtensa-lx106-elf-gcc.path}/bin/xtensa-lx106-elf-" -thing.menu.dbg.Disabled=Disabled -thing.menu.dbg.Disabled.build.debug_port= -thing.menu.dbg.Serial=Serial -thing.menu.dbg.Serial.build.debug_port=-DDEBUG_ESP_PORT=Serial -thing.menu.dbg.Serial1=Serial1 -thing.menu.dbg.Serial1.build.debug_port=-DDEBUG_ESP_PORT=Serial1 -thing.menu.lvl.None____=None -thing.menu.lvl.None____.build.debug_level= -thing.menu.lvl.SSL=SSL -thing.menu.lvl.SSL.build.debug_level= -DDEBUG_ESP_SSL -thing.menu.lvl.TLS_MEM=TLS_MEM -thing.menu.lvl.TLS_MEM.build.debug_level= -DDEBUG_ESP_TLS_MEM -thing.menu.lvl.HTTP_CLIENT=HTTP_CLIENT -thing.menu.lvl.HTTP_CLIENT.build.debug_level= -DDEBUG_ESP_HTTP_CLIENT -thing.menu.lvl.HTTP_SERVER=HTTP_SERVER -thing.menu.lvl.HTTP_SERVER.build.debug_level= -DDEBUG_ESP_HTTP_SERVER -thing.menu.lvl.SSLTLS_MEM=SSL+TLS_MEM -thing.menu.lvl.SSLTLS_MEM.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -thing.menu.lvl.SSLHTTP_CLIENT=SSL+HTTP_CLIENT -thing.menu.lvl.SSLHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_CLIENT -thing.menu.lvl.SSLHTTP_SERVER=SSL+HTTP_SERVER -thing.menu.lvl.SSLHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_SERVER -thing.menu.lvl.TLS_MEMHTTP_CLIENT=TLS_MEM+HTTP_CLIENT -thing.menu.lvl.TLS_MEMHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -thing.menu.lvl.TLS_MEMHTTP_SERVER=TLS_MEM+HTTP_SERVER -thing.menu.lvl.TLS_MEMHTTP_SERVER.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_SERVER -thing.menu.lvl.HTTP_CLIENTHTTP_SERVER=HTTP_CLIENT+HTTP_SERVER -thing.menu.lvl.HTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -thing.menu.lvl.SSLTLS_MEMHTTP_CLIENT=SSL+TLS_MEM+HTTP_CLIENT -thing.menu.lvl.SSLTLS_MEMHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -thing.menu.lvl.SSLTLS_MEMHTTP_SERVER=SSL+TLS_MEM+HTTP_SERVER -thing.menu.lvl.SSLTLS_MEMHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_SERVER -thing.menu.lvl.SSLHTTP_CLIENTHTTP_SERVER=SSL+HTTP_CLIENT+HTTP_SERVER -thing.menu.lvl.SSLHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -thing.menu.lvl.TLS_MEMHTTP_CLIENTHTTP_SERVER=TLS_MEM+HTTP_CLIENT+HTTP_SERVER -thing.menu.lvl.TLS_MEMHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -thing.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVER=SSL+TLS_MEM+HTTP_CLIENT+HTTP_SERVER -thing.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -thing.menu.lvl.CORE=CORE -thing.menu.lvl.CORE.build.debug_level= -DDEBUG_ESP_CORE -thing.menu.lvl.WIFI=WIFI -thing.menu.lvl.WIFI.build.debug_level= -DDEBUG_ESP_WIFI -thing.menu.lvl.HTTP_UPDATE=HTTP_UPDATE -thing.menu.lvl.HTTP_UPDATE.build.debug_level= -DDEBUG_ESP_HTTP_UPDATE -thing.menu.lvl.UPDATER=UPDATER -thing.menu.lvl.UPDATER.build.debug_level= -DDEBUG_ESP_UPDATER -thing.menu.lvl.OTA=OTA -thing.menu.lvl.OTA.build.debug_level= -DDEBUG_ESP_OTA -thing.menu.lvl.OOM=OOM -thing.menu.lvl.OOM.build.debug_level= -DDEBUG_ESP_OOM -thing.menu.lvl.COREWIFIHTTP_UPDATEUPDATEROTAOOM=CORE+WIFI+HTTP_UPDATE+UPDATER+OTA+OOM -thing.menu.lvl.COREWIFIHTTP_UPDATEUPDATEROTAOOM.build.debug_level= -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM -thing.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVERCOREWIFIHTTP_UPDATEUPDATEROTAOOM=SSL+TLS_MEM+HTTP_CLIENT+HTTP_SERVER+CORE+WIFI+HTTP_UPDATE+UPDATER+OTA+OOM -thing.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVERCOREWIFIHTTP_UPDATEUPDATEROTAOOM.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM -thing.menu.lvl.NoAssert-NDEBUG=NoAssert-NDEBUG -thing.menu.lvl.NoAssert-NDEBUG.build.debug_level= -DNDEBUG -thing.menu.wipe.none=Only Sketch -thing.menu.wipe.none.upload.erase_cmd= -thing.menu.wipe.sdk=Sketch + WiFi Settings -thing.menu.wipe.sdk.upload.erase_cmd=-ca "{build.rfcal_addr}" -cz 0x4000 -thing.menu.wipe.all=All Flash Contents -thing.menu.wipe.all.upload.erase_cmd=-ca 0x0 -cz "{build.flash_size_bytes}" -thing.menu.baud.115200=115200 -thing.menu.baud.115200.upload.speed=115200 -thing.menu.baud.9600=9600 -thing.menu.baud.9600.upload.speed=9600 -thing.menu.baud.57600=57600 -thing.menu.baud.57600.upload.speed=57600 -thing.menu.baud.230400.linux=230400 -thing.menu.baud.230400.macosx=230400 -thing.menu.baud.230400.upload.speed=230400 -thing.menu.baud.256000.windows=256000 -thing.menu.baud.256000.upload.speed=256000 -thing.menu.baud.460800.linux=460800 -thing.menu.baud.460800.macosx=460800 -thing.menu.baud.460800.upload.speed=460800 -thing.menu.baud.512000.windows=512000 -thing.menu.baud.512000.upload.speed=512000 -thing.menu.baud.921600=921600 -thing.menu.baud.921600.upload.speed=921600 - -############################################################## -thingdev.name=SparkFun ESP8266 Thing Dev -thingdev.build.board=ESP8266_THING_DEV -thingdev.build.variant=thing -thingdev.upload.tool=esptool -thingdev.upload.maximum_data_size=81920 -thingdev.upload.wait_for_upload_port=true -thingdev.upload.erase_cmd= -thingdev.serial.disableDTR=true -thingdev.serial.disableRTS=true -thingdev.build.mcu=esp8266 -thingdev.build.core=esp8266 -thingdev.build.spiffs_pagesize=256 -thingdev.build.debug_port= -thingdev.build.debug_level= -thingdev.menu.xtal.80=80 MHz -thingdev.menu.xtal.80.build.f_cpu=80000000L -thingdev.menu.xtal.160=160 MHz -thingdev.menu.xtal.160.build.f_cpu=160000000L -thingdev.menu.vt.flash=Flash -thingdev.menu.vt.flash.build.vtable_flags=-DVTABLES_IN_FLASH -thingdev.menu.vt.heap=Heap -thingdev.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM -thingdev.menu.vt.iram=IRAM -thingdev.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM -thingdev.menu.exception.enabled=Enabled -thingdev.menu.exception.enabled.build.exception_flags=-fexceptions -thingdev.menu.exception.enabled.build.stdcpp_lib=-lstdc++ -thingdev.menu.exception.disabled=Disabled -thingdev.menu.exception.disabled.build.exception_flags=-fno-exceptions -thingdev.menu.exception.disabled.build.stdcpp_lib=-lstdc++-nox -thingdev.upload.resetmethod=nodemcu -thingdev.build.flash_mode=dio -thingdev.build.flash_freq=40 -thingdev.menu.eesz.512K=512K (no SPIFFS) -thingdev.menu.eesz.512K.build.flash_size=512K -thingdev.menu.eesz.512K.build.flash_size_bytes=0x80000 -thingdev.menu.eesz.512K.build.flash_ld=eagle.flash.512k.ld -thingdev.menu.eesz.512K.build.spiffs_pagesize=256 -thingdev.menu.eesz.512K.upload.maximum_size=499696 -thingdev.menu.eesz.512K.build.rfcal_addr=0x7C000 -thingdev.menu.eesz.512K32=512K (32K SPIFFS) -thingdev.menu.eesz.512K32.build.flash_size=512K -thingdev.menu.eesz.512K32.build.flash_size_bytes=0x80000 -thingdev.menu.eesz.512K32.build.flash_ld=eagle.flash.512k32.ld -thingdev.menu.eesz.512K32.build.spiffs_pagesize=256 -thingdev.menu.eesz.512K32.upload.maximum_size=466928 -thingdev.menu.eesz.512K32.build.rfcal_addr=0x7C000 -thingdev.menu.eesz.512K32.build.spiffs_start=0x73000 -thingdev.menu.eesz.512K32.build.spiffs_end=0x7B000 -thingdev.menu.eesz.512K32.build.spiffs_blocksize=4096 -thingdev.menu.eesz.512K64=512K (64K SPIFFS) -thingdev.menu.eesz.512K64.build.flash_size=512K -thingdev.menu.eesz.512K64.build.flash_size_bytes=0x80000 -thingdev.menu.eesz.512K64.build.flash_ld=eagle.flash.512k64.ld -thingdev.menu.eesz.512K64.build.spiffs_pagesize=256 -thingdev.menu.eesz.512K64.upload.maximum_size=434160 -thingdev.menu.eesz.512K64.build.rfcal_addr=0x7C000 -thingdev.menu.eesz.512K64.build.spiffs_start=0x6B000 -thingdev.menu.eesz.512K64.build.spiffs_end=0x7B000 -thingdev.menu.eesz.512K64.build.spiffs_blocksize=4096 -thingdev.menu.eesz.512K128=512K (128K SPIFFS) -thingdev.menu.eesz.512K128.build.flash_size=512K -thingdev.menu.eesz.512K128.build.flash_size_bytes=0x80000 -thingdev.menu.eesz.512K128.build.flash_ld=eagle.flash.512k128.ld -thingdev.menu.eesz.512K128.build.spiffs_pagesize=256 -thingdev.menu.eesz.512K128.upload.maximum_size=368624 -thingdev.menu.eesz.512K128.build.rfcal_addr=0x7C000 -thingdev.menu.eesz.512K128.build.spiffs_start=0x5B000 -thingdev.menu.eesz.512K128.build.spiffs_end=0x7B000 -thingdev.menu.eesz.512K128.build.spiffs_blocksize=4096 -thingdev.menu.ip.lm2f=v2 Lower Memory -thingdev.menu.ip.lm2f.build.lwip_include=lwip2/include -thingdev.menu.ip.lm2f.build.lwip_lib=-llwip2-536-feat -thingdev.menu.ip.lm2f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -thingdev.menu.ip.hb2f=v2 Higher Bandwidth -thingdev.menu.ip.hb2f.build.lwip_include=lwip2/include -thingdev.menu.ip.hb2f.build.lwip_lib=-llwip2-1460-feat -thingdev.menu.ip.hb2f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -thingdev.menu.ip.lm2n=v2 Lower Memory (no features) -thingdev.menu.ip.lm2n.build.lwip_include=lwip2/include -thingdev.menu.ip.lm2n.build.lwip_lib=-llwip2-536 -thingdev.menu.ip.lm2n.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=0 -DLWIP_IPV6=0 -thingdev.menu.ip.hb2n=v2 Higher Bandwidth (no features) -thingdev.menu.ip.hb2n.build.lwip_include=lwip2/include -thingdev.menu.ip.hb2n.build.lwip_lib=-llwip2-1460 -thingdev.menu.ip.hb2n.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=0 -DLWIP_IPV6=0 -thingdev.menu.ip.lm6f=v2 IPv6 Lower Memory -thingdev.menu.ip.lm6f.build.lwip_include=lwip2/include -thingdev.menu.ip.lm6f.build.lwip_lib=-llwip6-536-feat -thingdev.menu.ip.lm6f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=1 -thingdev.menu.ip.hb6f=v2 IPv6 Higher Bandwidth -thingdev.menu.ip.hb6f.build.lwip_include=lwip2/include -thingdev.menu.ip.hb6f.build.lwip_lib=-llwip6-1460-feat -thingdev.menu.ip.hb6f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=1 -DLWIP_IPV6=1 -thingdev.menu.ip.hb1=v1.4 Higher Bandwidth -thingdev.menu.ip.hb1.build.lwip_lib=-llwip_gcc -thingdev.menu.ip.hb1.build.lwip_flags=-DLWIP_OPEN_SRC -thingdev.menu.ip.src=v1.4 Compile from source -thingdev.menu.ip.src.build.lwip_lib=-llwip_src -thingdev.menu.ip.src.build.lwip_flags=-DLWIP_OPEN_SRC -thingdev.menu.ip.src.recipe.hooks.sketch.prebuild.1.pattern=make -C "{runtime.platform.path}/tools/sdk/lwip/src" install TOOLS_PATH="{runtime.tools.xtensa-lx106-elf-gcc.path}/bin/xtensa-lx106-elf-" -thingdev.menu.dbg.Disabled=Disabled -thingdev.menu.dbg.Disabled.build.debug_port= -thingdev.menu.dbg.Serial=Serial -thingdev.menu.dbg.Serial.build.debug_port=-DDEBUG_ESP_PORT=Serial -thingdev.menu.dbg.Serial1=Serial1 -thingdev.menu.dbg.Serial1.build.debug_port=-DDEBUG_ESP_PORT=Serial1 -thingdev.menu.lvl.None____=None -thingdev.menu.lvl.None____.build.debug_level= -thingdev.menu.lvl.SSL=SSL -thingdev.menu.lvl.SSL.build.debug_level= -DDEBUG_ESP_SSL -thingdev.menu.lvl.TLS_MEM=TLS_MEM -thingdev.menu.lvl.TLS_MEM.build.debug_level= -DDEBUG_ESP_TLS_MEM -thingdev.menu.lvl.HTTP_CLIENT=HTTP_CLIENT -thingdev.menu.lvl.HTTP_CLIENT.build.debug_level= -DDEBUG_ESP_HTTP_CLIENT -thingdev.menu.lvl.HTTP_SERVER=HTTP_SERVER -thingdev.menu.lvl.HTTP_SERVER.build.debug_level= -DDEBUG_ESP_HTTP_SERVER -thingdev.menu.lvl.SSLTLS_MEM=SSL+TLS_MEM -thingdev.menu.lvl.SSLTLS_MEM.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -thingdev.menu.lvl.SSLHTTP_CLIENT=SSL+HTTP_CLIENT -thingdev.menu.lvl.SSLHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_CLIENT -thingdev.menu.lvl.SSLHTTP_SERVER=SSL+HTTP_SERVER -thingdev.menu.lvl.SSLHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_SERVER -thingdev.menu.lvl.TLS_MEMHTTP_CLIENT=TLS_MEM+HTTP_CLIENT -thingdev.menu.lvl.TLS_MEMHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -thingdev.menu.lvl.TLS_MEMHTTP_SERVER=TLS_MEM+HTTP_SERVER -thingdev.menu.lvl.TLS_MEMHTTP_SERVER.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_SERVER -thingdev.menu.lvl.HTTP_CLIENTHTTP_SERVER=HTTP_CLIENT+HTTP_SERVER -thingdev.menu.lvl.HTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -thingdev.menu.lvl.SSLTLS_MEMHTTP_CLIENT=SSL+TLS_MEM+HTTP_CLIENT -thingdev.menu.lvl.SSLTLS_MEMHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -thingdev.menu.lvl.SSLTLS_MEMHTTP_SERVER=SSL+TLS_MEM+HTTP_SERVER -thingdev.menu.lvl.SSLTLS_MEMHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_SERVER -thingdev.menu.lvl.SSLHTTP_CLIENTHTTP_SERVER=SSL+HTTP_CLIENT+HTTP_SERVER -thingdev.menu.lvl.SSLHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -thingdev.menu.lvl.TLS_MEMHTTP_CLIENTHTTP_SERVER=TLS_MEM+HTTP_CLIENT+HTTP_SERVER -thingdev.menu.lvl.TLS_MEMHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -thingdev.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVER=SSL+TLS_MEM+HTTP_CLIENT+HTTP_SERVER -thingdev.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -thingdev.menu.lvl.CORE=CORE -thingdev.menu.lvl.CORE.build.debug_level= -DDEBUG_ESP_CORE -thingdev.menu.lvl.WIFI=WIFI -thingdev.menu.lvl.WIFI.build.debug_level= -DDEBUG_ESP_WIFI -thingdev.menu.lvl.HTTP_UPDATE=HTTP_UPDATE -thingdev.menu.lvl.HTTP_UPDATE.build.debug_level= -DDEBUG_ESP_HTTP_UPDATE -thingdev.menu.lvl.UPDATER=UPDATER -thingdev.menu.lvl.UPDATER.build.debug_level= -DDEBUG_ESP_UPDATER -thingdev.menu.lvl.OTA=OTA -thingdev.menu.lvl.OTA.build.debug_level= -DDEBUG_ESP_OTA -thingdev.menu.lvl.OOM=OOM -thingdev.menu.lvl.OOM.build.debug_level= -DDEBUG_ESP_OOM -thingdev.menu.lvl.COREWIFIHTTP_UPDATEUPDATEROTAOOM=CORE+WIFI+HTTP_UPDATE+UPDATER+OTA+OOM -thingdev.menu.lvl.COREWIFIHTTP_UPDATEUPDATEROTAOOM.build.debug_level= -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM -thingdev.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVERCOREWIFIHTTP_UPDATEUPDATEROTAOOM=SSL+TLS_MEM+HTTP_CLIENT+HTTP_SERVER+CORE+WIFI+HTTP_UPDATE+UPDATER+OTA+OOM -thingdev.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVERCOREWIFIHTTP_UPDATEUPDATEROTAOOM.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM -thingdev.menu.lvl.NoAssert-NDEBUG=NoAssert-NDEBUG -thingdev.menu.lvl.NoAssert-NDEBUG.build.debug_level= -DNDEBUG -thingdev.menu.wipe.none=Only Sketch -thingdev.menu.wipe.none.upload.erase_cmd= -thingdev.menu.wipe.sdk=Sketch + WiFi Settings -thingdev.menu.wipe.sdk.upload.erase_cmd=-ca "{build.rfcal_addr}" -cz 0x4000 -thingdev.menu.wipe.all=All Flash Contents -thingdev.menu.wipe.all.upload.erase_cmd=-ca 0x0 -cz "{build.flash_size_bytes}" -thingdev.menu.baud.115200=115200 -thingdev.menu.baud.115200.upload.speed=115200 -thingdev.menu.baud.9600=9600 -thingdev.menu.baud.9600.upload.speed=9600 -thingdev.menu.baud.57600=57600 -thingdev.menu.baud.57600.upload.speed=57600 -thingdev.menu.baud.230400.linux=230400 -thingdev.menu.baud.230400.macosx=230400 -thingdev.menu.baud.230400.upload.speed=230400 -thingdev.menu.baud.256000.windows=256000 -thingdev.menu.baud.256000.upload.speed=256000 -thingdev.menu.baud.460800.linux=460800 -thingdev.menu.baud.460800.macosx=460800 -thingdev.menu.baud.460800.upload.speed=460800 -thingdev.menu.baud.512000.windows=512000 -thingdev.menu.baud.512000.upload.speed=512000 -thingdev.menu.baud.921600=921600 -thingdev.menu.baud.921600.upload.speed=921600 - -############################################################## -esp210.name=SweetPea ESP-210 -esp210.build.board=ESP8266_ESP210 -esp210.upload.tool=esptool -esp210.upload.maximum_data_size=81920 -esp210.upload.wait_for_upload_port=true -esp210.upload.erase_cmd= -esp210.serial.disableDTR=true -esp210.serial.disableRTS=true -esp210.build.mcu=esp8266 -esp210.build.core=esp8266 -esp210.build.variant=generic -esp210.build.spiffs_pagesize=256 -esp210.build.debug_port= -esp210.build.debug_level= -esp210.menu.xtal.80=80 MHz -esp210.menu.xtal.80.build.f_cpu=80000000L -esp210.menu.xtal.160=160 MHz -esp210.menu.xtal.160.build.f_cpu=160000000L -esp210.menu.vt.flash=Flash -esp210.menu.vt.flash.build.vtable_flags=-DVTABLES_IN_FLASH -esp210.menu.vt.heap=Heap -esp210.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM -esp210.menu.vt.iram=IRAM -esp210.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM -esp210.menu.exception.enabled=Enabled -esp210.menu.exception.enabled.build.exception_flags=-fexceptions -esp210.menu.exception.enabled.build.stdcpp_lib=-lstdc++ -esp210.menu.exception.disabled=Disabled -esp210.menu.exception.disabled.build.exception_flags=-fno-exceptions -esp210.menu.exception.disabled.build.stdcpp_lib=-lstdc++-nox -esp210.upload.resetmethod=ck -esp210.build.flash_mode=qio -esp210.build.flash_freq=40 -esp210.menu.eesz.4M=4M (no SPIFFS) -esp210.menu.eesz.4M.build.flash_size=4M -esp210.menu.eesz.4M.build.flash_size_bytes=0x400000 -esp210.menu.eesz.4M.build.flash_ld=eagle.flash.4m.ld -esp210.menu.eesz.4M.build.spiffs_pagesize=256 -esp210.menu.eesz.4M.upload.maximum_size=1044464 -esp210.menu.eesz.4M.build.rfcal_addr=0x3FC000 -esp210.menu.eesz.4M1M=4M (1M SPIFFS) -esp210.menu.eesz.4M1M.build.flash_size=4M -esp210.menu.eesz.4M1M.build.flash_size_bytes=0x400000 -esp210.menu.eesz.4M1M.build.flash_ld=eagle.flash.4m1m.ld -esp210.menu.eesz.4M1M.build.spiffs_pagesize=256 -esp210.menu.eesz.4M1M.upload.maximum_size=1044464 -esp210.menu.eesz.4M1M.build.rfcal_addr=0x3FC000 -esp210.menu.eesz.4M1M.build.spiffs_start=0x300000 -esp210.menu.eesz.4M1M.build.spiffs_end=0x3FB000 -esp210.menu.eesz.4M1M.build.spiffs_blocksize=8192 -esp210.menu.eesz.4M2M=4M (2M SPIFFS) -esp210.menu.eesz.4M2M.build.flash_size=4M -esp210.menu.eesz.4M2M.build.flash_size_bytes=0x400000 -esp210.menu.eesz.4M2M.build.flash_ld=eagle.flash.4m2m.ld -esp210.menu.eesz.4M2M.build.spiffs_pagesize=256 -esp210.menu.eesz.4M2M.upload.maximum_size=1044464 -esp210.menu.eesz.4M2M.build.rfcal_addr=0x3FC000 -esp210.menu.eesz.4M2M.build.spiffs_start=0x200000 -esp210.menu.eesz.4M2M.build.spiffs_end=0x3FB000 -esp210.menu.eesz.4M2M.build.spiffs_blocksize=8192 -esp210.menu.eesz.4M3M=4M (3M SPIFFS) -esp210.menu.eesz.4M3M.build.flash_size=4M -esp210.menu.eesz.4M3M.build.flash_size_bytes=0x400000 -esp210.menu.eesz.4M3M.build.flash_ld=eagle.flash.4m3m.ld -esp210.menu.eesz.4M3M.build.spiffs_pagesize=256 -esp210.menu.eesz.4M3M.upload.maximum_size=1044464 -esp210.menu.eesz.4M3M.build.rfcal_addr=0x3FC000 -esp210.menu.eesz.4M3M.build.spiffs_start=0x100000 -esp210.menu.eesz.4M3M.build.spiffs_end=0x3FB000 -esp210.menu.eesz.4M3M.build.spiffs_blocksize=8192 -esp210.menu.ip.lm2f=v2 Lower Memory -esp210.menu.ip.lm2f.build.lwip_include=lwip2/include -esp210.menu.ip.lm2f.build.lwip_lib=-llwip2-536-feat -esp210.menu.ip.lm2f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -esp210.menu.ip.hb2f=v2 Higher Bandwidth -esp210.menu.ip.hb2f.build.lwip_include=lwip2/include -esp210.menu.ip.hb2f.build.lwip_lib=-llwip2-1460-feat -esp210.menu.ip.hb2f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -esp210.menu.ip.lm2n=v2 Lower Memory (no features) -esp210.menu.ip.lm2n.build.lwip_include=lwip2/include -esp210.menu.ip.lm2n.build.lwip_lib=-llwip2-536 -esp210.menu.ip.lm2n.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=0 -DLWIP_IPV6=0 -esp210.menu.ip.hb2n=v2 Higher Bandwidth (no features) -esp210.menu.ip.hb2n.build.lwip_include=lwip2/include -esp210.menu.ip.hb2n.build.lwip_lib=-llwip2-1460 -esp210.menu.ip.hb2n.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=0 -DLWIP_IPV6=0 -esp210.menu.ip.lm6f=v2 IPv6 Lower Memory -esp210.menu.ip.lm6f.build.lwip_include=lwip2/include -esp210.menu.ip.lm6f.build.lwip_lib=-llwip6-536-feat -esp210.menu.ip.lm6f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=1 -esp210.menu.ip.hb6f=v2 IPv6 Higher Bandwidth -esp210.menu.ip.hb6f.build.lwip_include=lwip2/include -esp210.menu.ip.hb6f.build.lwip_lib=-llwip6-1460-feat -esp210.menu.ip.hb6f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=1 -DLWIP_IPV6=1 -esp210.menu.ip.hb1=v1.4 Higher Bandwidth -esp210.menu.ip.hb1.build.lwip_lib=-llwip_gcc -esp210.menu.ip.hb1.build.lwip_flags=-DLWIP_OPEN_SRC -esp210.menu.ip.src=v1.4 Compile from source -esp210.menu.ip.src.build.lwip_lib=-llwip_src -esp210.menu.ip.src.build.lwip_flags=-DLWIP_OPEN_SRC -esp210.menu.ip.src.recipe.hooks.sketch.prebuild.1.pattern=make -C "{runtime.platform.path}/tools/sdk/lwip/src" install TOOLS_PATH="{runtime.tools.xtensa-lx106-elf-gcc.path}/bin/xtensa-lx106-elf-" -esp210.menu.dbg.Disabled=Disabled -esp210.menu.dbg.Disabled.build.debug_port= -esp210.menu.dbg.Serial=Serial -esp210.menu.dbg.Serial.build.debug_port=-DDEBUG_ESP_PORT=Serial -esp210.menu.dbg.Serial1=Serial1 -esp210.menu.dbg.Serial1.build.debug_port=-DDEBUG_ESP_PORT=Serial1 -esp210.menu.lvl.None____=None -esp210.menu.lvl.None____.build.debug_level= -esp210.menu.lvl.SSL=SSL -esp210.menu.lvl.SSL.build.debug_level= -DDEBUG_ESP_SSL -esp210.menu.lvl.TLS_MEM=TLS_MEM -esp210.menu.lvl.TLS_MEM.build.debug_level= -DDEBUG_ESP_TLS_MEM -esp210.menu.lvl.HTTP_CLIENT=HTTP_CLIENT -esp210.menu.lvl.HTTP_CLIENT.build.debug_level= -DDEBUG_ESP_HTTP_CLIENT -esp210.menu.lvl.HTTP_SERVER=HTTP_SERVER -esp210.menu.lvl.HTTP_SERVER.build.debug_level= -DDEBUG_ESP_HTTP_SERVER -esp210.menu.lvl.SSLTLS_MEM=SSL+TLS_MEM -esp210.menu.lvl.SSLTLS_MEM.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -esp210.menu.lvl.SSLHTTP_CLIENT=SSL+HTTP_CLIENT -esp210.menu.lvl.SSLHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_CLIENT -esp210.menu.lvl.SSLHTTP_SERVER=SSL+HTTP_SERVER -esp210.menu.lvl.SSLHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_SERVER -esp210.menu.lvl.TLS_MEMHTTP_CLIENT=TLS_MEM+HTTP_CLIENT -esp210.menu.lvl.TLS_MEMHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -esp210.menu.lvl.TLS_MEMHTTP_SERVER=TLS_MEM+HTTP_SERVER -esp210.menu.lvl.TLS_MEMHTTP_SERVER.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_SERVER -esp210.menu.lvl.HTTP_CLIENTHTTP_SERVER=HTTP_CLIENT+HTTP_SERVER -esp210.menu.lvl.HTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -esp210.menu.lvl.SSLTLS_MEMHTTP_CLIENT=SSL+TLS_MEM+HTTP_CLIENT -esp210.menu.lvl.SSLTLS_MEMHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -esp210.menu.lvl.SSLTLS_MEMHTTP_SERVER=SSL+TLS_MEM+HTTP_SERVER -esp210.menu.lvl.SSLTLS_MEMHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_SERVER -esp210.menu.lvl.SSLHTTP_CLIENTHTTP_SERVER=SSL+HTTP_CLIENT+HTTP_SERVER -esp210.menu.lvl.SSLHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -esp210.menu.lvl.TLS_MEMHTTP_CLIENTHTTP_SERVER=TLS_MEM+HTTP_CLIENT+HTTP_SERVER -esp210.menu.lvl.TLS_MEMHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -esp210.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVER=SSL+TLS_MEM+HTTP_CLIENT+HTTP_SERVER -esp210.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -esp210.menu.lvl.CORE=CORE -esp210.menu.lvl.CORE.build.debug_level= -DDEBUG_ESP_CORE -esp210.menu.lvl.WIFI=WIFI -esp210.menu.lvl.WIFI.build.debug_level= -DDEBUG_ESP_WIFI -esp210.menu.lvl.HTTP_UPDATE=HTTP_UPDATE -esp210.menu.lvl.HTTP_UPDATE.build.debug_level= -DDEBUG_ESP_HTTP_UPDATE -esp210.menu.lvl.UPDATER=UPDATER -esp210.menu.lvl.UPDATER.build.debug_level= -DDEBUG_ESP_UPDATER -esp210.menu.lvl.OTA=OTA -esp210.menu.lvl.OTA.build.debug_level= -DDEBUG_ESP_OTA -esp210.menu.lvl.OOM=OOM -esp210.menu.lvl.OOM.build.debug_level= -DDEBUG_ESP_OOM -esp210.menu.lvl.COREWIFIHTTP_UPDATEUPDATEROTAOOM=CORE+WIFI+HTTP_UPDATE+UPDATER+OTA+OOM -esp210.menu.lvl.COREWIFIHTTP_UPDATEUPDATEROTAOOM.build.debug_level= -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM -esp210.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVERCOREWIFIHTTP_UPDATEUPDATEROTAOOM=SSL+TLS_MEM+HTTP_CLIENT+HTTP_SERVER+CORE+WIFI+HTTP_UPDATE+UPDATER+OTA+OOM -esp210.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVERCOREWIFIHTTP_UPDATEUPDATEROTAOOM.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM -esp210.menu.lvl.NoAssert-NDEBUG=NoAssert-NDEBUG -esp210.menu.lvl.NoAssert-NDEBUG.build.debug_level= -DNDEBUG -esp210.menu.wipe.none=Only Sketch -esp210.menu.wipe.none.upload.erase_cmd= -esp210.menu.wipe.sdk=Sketch + WiFi Settings -esp210.menu.wipe.sdk.upload.erase_cmd=-ca "{build.rfcal_addr}" -cz 0x4000 -esp210.menu.wipe.all=All Flash Contents -esp210.menu.wipe.all.upload.erase_cmd=-ca 0x0 -cz "{build.flash_size_bytes}" -esp210.menu.baud.57600=57600 -esp210.menu.baud.57600.upload.speed=57600 -esp210.menu.baud.9600=9600 -esp210.menu.baud.9600.upload.speed=9600 -esp210.menu.baud.115200=115200 -esp210.menu.baud.115200.upload.speed=115200 -esp210.menu.baud.230400.linux=230400 -esp210.menu.baud.230400.macosx=230400 -esp210.menu.baud.230400.upload.speed=230400 -esp210.menu.baud.256000.windows=256000 -esp210.menu.baud.256000.upload.speed=256000 -esp210.menu.baud.460800.linux=460800 -esp210.menu.baud.460800.macosx=460800 -esp210.menu.baud.460800.upload.speed=460800 -esp210.menu.baud.512000.windows=512000 -esp210.menu.baud.512000.upload.speed=512000 -esp210.menu.baud.921600=921600 -esp210.menu.baud.921600.upload.speed=921600 - -############################################################## -d1_mini.name=LOLIN(WEMOS) D1 R2 & mini -d1_mini.build.board=ESP8266_WEMOS_D1MINI -d1_mini.build.variant=d1_mini -d1_mini.upload.tool=esptool -d1_mini.upload.maximum_data_size=81920 -d1_mini.upload.wait_for_upload_port=true -d1_mini.upload.erase_cmd= -d1_mini.serial.disableDTR=true -d1_mini.serial.disableRTS=true -d1_mini.build.mcu=esp8266 -d1_mini.build.core=esp8266 -d1_mini.build.spiffs_pagesize=256 -d1_mini.build.debug_port= -d1_mini.build.debug_level= -d1_mini.menu.xtal.80=80 MHz -d1_mini.menu.xtal.80.build.f_cpu=80000000L -d1_mini.menu.xtal.160=160 MHz -d1_mini.menu.xtal.160.build.f_cpu=160000000L -d1_mini.menu.vt.flash=Flash -d1_mini.menu.vt.flash.build.vtable_flags=-DVTABLES_IN_FLASH -d1_mini.menu.vt.heap=Heap -d1_mini.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM -d1_mini.menu.vt.iram=IRAM -d1_mini.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM -d1_mini.menu.exception.enabled=Enabled -d1_mini.menu.exception.enabled.build.exception_flags=-fexceptions -d1_mini.menu.exception.enabled.build.stdcpp_lib=-lstdc++ -d1_mini.menu.exception.disabled=Disabled -d1_mini.menu.exception.disabled.build.exception_flags=-fno-exceptions -d1_mini.menu.exception.disabled.build.stdcpp_lib=-lstdc++-nox -d1_mini.upload.resetmethod=nodemcu -d1_mini.build.flash_mode=dio -d1_mini.build.flash_freq=40 -d1_mini.menu.eesz.4M=4M (no SPIFFS) -d1_mini.menu.eesz.4M.build.flash_size=4M -d1_mini.menu.eesz.4M.build.flash_size_bytes=0x400000 -d1_mini.menu.eesz.4M.build.flash_ld=eagle.flash.4m.ld -d1_mini.menu.eesz.4M.build.spiffs_pagesize=256 -d1_mini.menu.eesz.4M.upload.maximum_size=1044464 -d1_mini.menu.eesz.4M.build.rfcal_addr=0x3FC000 -d1_mini.menu.eesz.4M1M=4M (1M SPIFFS) -d1_mini.menu.eesz.4M1M.build.flash_size=4M -d1_mini.menu.eesz.4M1M.build.flash_size_bytes=0x400000 -d1_mini.menu.eesz.4M1M.build.flash_ld=eagle.flash.4m1m.ld -d1_mini.menu.eesz.4M1M.build.spiffs_pagesize=256 -d1_mini.menu.eesz.4M1M.upload.maximum_size=1044464 -d1_mini.menu.eesz.4M1M.build.rfcal_addr=0x3FC000 -d1_mini.menu.eesz.4M1M.build.spiffs_start=0x300000 -d1_mini.menu.eesz.4M1M.build.spiffs_end=0x3FB000 -d1_mini.menu.eesz.4M1M.build.spiffs_blocksize=8192 -d1_mini.menu.eesz.4M2M=4M (2M SPIFFS) -d1_mini.menu.eesz.4M2M.build.flash_size=4M -d1_mini.menu.eesz.4M2M.build.flash_size_bytes=0x400000 -d1_mini.menu.eesz.4M2M.build.flash_ld=eagle.flash.4m2m.ld -d1_mini.menu.eesz.4M2M.build.spiffs_pagesize=256 -d1_mini.menu.eesz.4M2M.upload.maximum_size=1044464 -d1_mini.menu.eesz.4M2M.build.rfcal_addr=0x3FC000 -d1_mini.menu.eesz.4M2M.build.spiffs_start=0x200000 -d1_mini.menu.eesz.4M2M.build.spiffs_end=0x3FB000 -d1_mini.menu.eesz.4M2M.build.spiffs_blocksize=8192 -d1_mini.menu.eesz.4M3M=4M (3M SPIFFS) -d1_mini.menu.eesz.4M3M.build.flash_size=4M -d1_mini.menu.eesz.4M3M.build.flash_size_bytes=0x400000 -d1_mini.menu.eesz.4M3M.build.flash_ld=eagle.flash.4m3m.ld -d1_mini.menu.eesz.4M3M.build.spiffs_pagesize=256 -d1_mini.menu.eesz.4M3M.upload.maximum_size=1044464 -d1_mini.menu.eesz.4M3M.build.rfcal_addr=0x3FC000 -d1_mini.menu.eesz.4M3M.build.spiffs_start=0x100000 -d1_mini.menu.eesz.4M3M.build.spiffs_end=0x3FB000 -d1_mini.menu.eesz.4M3M.build.spiffs_blocksize=8192 -d1_mini.menu.ip.lm2f=v2 Lower Memory -d1_mini.menu.ip.lm2f.build.lwip_include=lwip2/include -d1_mini.menu.ip.lm2f.build.lwip_lib=-llwip2-536-feat -d1_mini.menu.ip.lm2f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -d1_mini.menu.ip.hb2f=v2 Higher Bandwidth -d1_mini.menu.ip.hb2f.build.lwip_include=lwip2/include -d1_mini.menu.ip.hb2f.build.lwip_lib=-llwip2-1460-feat -d1_mini.menu.ip.hb2f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -d1_mini.menu.ip.lm2n=v2 Lower Memory (no features) -d1_mini.menu.ip.lm2n.build.lwip_include=lwip2/include -d1_mini.menu.ip.lm2n.build.lwip_lib=-llwip2-536 -d1_mini.menu.ip.lm2n.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=0 -DLWIP_IPV6=0 -d1_mini.menu.ip.hb2n=v2 Higher Bandwidth (no features) -d1_mini.menu.ip.hb2n.build.lwip_include=lwip2/include -d1_mini.menu.ip.hb2n.build.lwip_lib=-llwip2-1460 -d1_mini.menu.ip.hb2n.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=0 -DLWIP_IPV6=0 -d1_mini.menu.ip.lm6f=v2 IPv6 Lower Memory -d1_mini.menu.ip.lm6f.build.lwip_include=lwip2/include -d1_mini.menu.ip.lm6f.build.lwip_lib=-llwip6-536-feat -d1_mini.menu.ip.lm6f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=1 -d1_mini.menu.ip.hb6f=v2 IPv6 Higher Bandwidth -d1_mini.menu.ip.hb6f.build.lwip_include=lwip2/include -d1_mini.menu.ip.hb6f.build.lwip_lib=-llwip6-1460-feat -d1_mini.menu.ip.hb6f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=1 -DLWIP_IPV6=1 -d1_mini.menu.ip.hb1=v1.4 Higher Bandwidth -d1_mini.menu.ip.hb1.build.lwip_lib=-llwip_gcc -d1_mini.menu.ip.hb1.build.lwip_flags=-DLWIP_OPEN_SRC -d1_mini.menu.ip.src=v1.4 Compile from source -d1_mini.menu.ip.src.build.lwip_lib=-llwip_src -d1_mini.menu.ip.src.build.lwip_flags=-DLWIP_OPEN_SRC -d1_mini.menu.ip.src.recipe.hooks.sketch.prebuild.1.pattern=make -C "{runtime.platform.path}/tools/sdk/lwip/src" install TOOLS_PATH="{runtime.tools.xtensa-lx106-elf-gcc.path}/bin/xtensa-lx106-elf-" -d1_mini.menu.dbg.Disabled=Disabled -d1_mini.menu.dbg.Disabled.build.debug_port= -d1_mini.menu.dbg.Serial=Serial -d1_mini.menu.dbg.Serial.build.debug_port=-DDEBUG_ESP_PORT=Serial -d1_mini.menu.dbg.Serial1=Serial1 -d1_mini.menu.dbg.Serial1.build.debug_port=-DDEBUG_ESP_PORT=Serial1 -d1_mini.menu.lvl.None____=None -d1_mini.menu.lvl.None____.build.debug_level= -d1_mini.menu.lvl.SSL=SSL -d1_mini.menu.lvl.SSL.build.debug_level= -DDEBUG_ESP_SSL -d1_mini.menu.lvl.TLS_MEM=TLS_MEM -d1_mini.menu.lvl.TLS_MEM.build.debug_level= -DDEBUG_ESP_TLS_MEM -d1_mini.menu.lvl.HTTP_CLIENT=HTTP_CLIENT -d1_mini.menu.lvl.HTTP_CLIENT.build.debug_level= -DDEBUG_ESP_HTTP_CLIENT -d1_mini.menu.lvl.HTTP_SERVER=HTTP_SERVER -d1_mini.menu.lvl.HTTP_SERVER.build.debug_level= -DDEBUG_ESP_HTTP_SERVER -d1_mini.menu.lvl.SSLTLS_MEM=SSL+TLS_MEM -d1_mini.menu.lvl.SSLTLS_MEM.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -d1_mini.menu.lvl.SSLHTTP_CLIENT=SSL+HTTP_CLIENT -d1_mini.menu.lvl.SSLHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_CLIENT -d1_mini.menu.lvl.SSLHTTP_SERVER=SSL+HTTP_SERVER -d1_mini.menu.lvl.SSLHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_SERVER -d1_mini.menu.lvl.TLS_MEMHTTP_CLIENT=TLS_MEM+HTTP_CLIENT -d1_mini.menu.lvl.TLS_MEMHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -d1_mini.menu.lvl.TLS_MEMHTTP_SERVER=TLS_MEM+HTTP_SERVER -d1_mini.menu.lvl.TLS_MEMHTTP_SERVER.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_SERVER -d1_mini.menu.lvl.HTTP_CLIENTHTTP_SERVER=HTTP_CLIENT+HTTP_SERVER -d1_mini.menu.lvl.HTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -d1_mini.menu.lvl.SSLTLS_MEMHTTP_CLIENT=SSL+TLS_MEM+HTTP_CLIENT -d1_mini.menu.lvl.SSLTLS_MEMHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -d1_mini.menu.lvl.SSLTLS_MEMHTTP_SERVER=SSL+TLS_MEM+HTTP_SERVER -d1_mini.menu.lvl.SSLTLS_MEMHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_SERVER -d1_mini.menu.lvl.SSLHTTP_CLIENTHTTP_SERVER=SSL+HTTP_CLIENT+HTTP_SERVER -d1_mini.menu.lvl.SSLHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -d1_mini.menu.lvl.TLS_MEMHTTP_CLIENTHTTP_SERVER=TLS_MEM+HTTP_CLIENT+HTTP_SERVER -d1_mini.menu.lvl.TLS_MEMHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -d1_mini.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVER=SSL+TLS_MEM+HTTP_CLIENT+HTTP_SERVER -d1_mini.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -d1_mini.menu.lvl.CORE=CORE -d1_mini.menu.lvl.CORE.build.debug_level= -DDEBUG_ESP_CORE -d1_mini.menu.lvl.WIFI=WIFI -d1_mini.menu.lvl.WIFI.build.debug_level= -DDEBUG_ESP_WIFI -d1_mini.menu.lvl.HTTP_UPDATE=HTTP_UPDATE -d1_mini.menu.lvl.HTTP_UPDATE.build.debug_level= -DDEBUG_ESP_HTTP_UPDATE -d1_mini.menu.lvl.UPDATER=UPDATER -d1_mini.menu.lvl.UPDATER.build.debug_level= -DDEBUG_ESP_UPDATER -d1_mini.menu.lvl.OTA=OTA -d1_mini.menu.lvl.OTA.build.debug_level= -DDEBUG_ESP_OTA -d1_mini.menu.lvl.OOM=OOM -d1_mini.menu.lvl.OOM.build.debug_level= -DDEBUG_ESP_OOM -d1_mini.menu.lvl.COREWIFIHTTP_UPDATEUPDATEROTAOOM=CORE+WIFI+HTTP_UPDATE+UPDATER+OTA+OOM -d1_mini.menu.lvl.COREWIFIHTTP_UPDATEUPDATEROTAOOM.build.debug_level= -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM -d1_mini.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVERCOREWIFIHTTP_UPDATEUPDATEROTAOOM=SSL+TLS_MEM+HTTP_CLIENT+HTTP_SERVER+CORE+WIFI+HTTP_UPDATE+UPDATER+OTA+OOM -d1_mini.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVERCOREWIFIHTTP_UPDATEUPDATEROTAOOM.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM -d1_mini.menu.lvl.NoAssert-NDEBUG=NoAssert-NDEBUG -d1_mini.menu.lvl.NoAssert-NDEBUG.build.debug_level= -DNDEBUG -d1_mini.menu.wipe.none=Only Sketch -d1_mini.menu.wipe.none.upload.erase_cmd= -d1_mini.menu.wipe.sdk=Sketch + WiFi Settings -d1_mini.menu.wipe.sdk.upload.erase_cmd=-ca "{build.rfcal_addr}" -cz 0x4000 -d1_mini.menu.wipe.all=All Flash Contents -d1_mini.menu.wipe.all.upload.erase_cmd=-ca 0x0 -cz "{build.flash_size_bytes}" -d1_mini.menu.baud.921600=921600 -d1_mini.menu.baud.921600.upload.speed=921600 -d1_mini.menu.baud.9600=9600 -d1_mini.menu.baud.9600.upload.speed=9600 -d1_mini.menu.baud.57600=57600 -d1_mini.menu.baud.57600.upload.speed=57600 -d1_mini.menu.baud.115200=115200 -d1_mini.menu.baud.115200.upload.speed=115200 -d1_mini.menu.baud.230400.linux=230400 -d1_mini.menu.baud.230400.macosx=230400 -d1_mini.menu.baud.230400.upload.speed=230400 -d1_mini.menu.baud.256000.windows=256000 -d1_mini.menu.baud.256000.upload.speed=256000 -d1_mini.menu.baud.460800.linux=460800 -d1_mini.menu.baud.460800.macosx=460800 -d1_mini.menu.baud.460800.upload.speed=460800 -d1_mini.menu.baud.512000.windows=512000 -d1_mini.menu.baud.512000.upload.speed=512000 - -############################################################## -d1_mini_pro.name=LOLIN(WEMOS) D1 mini Pro -d1_mini_pro.build.board=ESP8266_WEMOS_D1MINIPRO -d1_mini_pro.build.variant=d1_mini -d1_mini_pro.upload.tool=esptool -d1_mini_pro.upload.maximum_data_size=81920 -d1_mini_pro.upload.wait_for_upload_port=true -d1_mini_pro.upload.erase_cmd= -d1_mini_pro.serial.disableDTR=true -d1_mini_pro.serial.disableRTS=true -d1_mini_pro.build.mcu=esp8266 -d1_mini_pro.build.core=esp8266 -d1_mini_pro.build.spiffs_pagesize=256 -d1_mini_pro.build.debug_port= -d1_mini_pro.build.debug_level= -d1_mini_pro.menu.xtal.80=80 MHz -d1_mini_pro.menu.xtal.80.build.f_cpu=80000000L -d1_mini_pro.menu.xtal.160=160 MHz -d1_mini_pro.menu.xtal.160.build.f_cpu=160000000L -d1_mini_pro.menu.vt.flash=Flash -d1_mini_pro.menu.vt.flash.build.vtable_flags=-DVTABLES_IN_FLASH -d1_mini_pro.menu.vt.heap=Heap -d1_mini_pro.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM -d1_mini_pro.menu.vt.iram=IRAM -d1_mini_pro.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM -d1_mini_pro.menu.exception.enabled=Enabled -d1_mini_pro.menu.exception.enabled.build.exception_flags=-fexceptions -d1_mini_pro.menu.exception.enabled.build.stdcpp_lib=-lstdc++ -d1_mini_pro.menu.exception.disabled=Disabled -d1_mini_pro.menu.exception.disabled.build.exception_flags=-fno-exceptions -d1_mini_pro.menu.exception.disabled.build.stdcpp_lib=-lstdc++-nox -d1_mini_pro.upload.resetmethod=nodemcu -d1_mini_pro.build.flash_mode=dio -d1_mini_pro.build.flash_freq=40 -d1_mini_pro.menu.eesz.16M14M=16M (14M SPIFFS) -d1_mini_pro.menu.eesz.16M14M.build.flash_size=16M -d1_mini_pro.menu.eesz.16M14M.build.flash_size_bytes=0x1000000 -d1_mini_pro.menu.eesz.16M14M.build.flash_ld=eagle.flash.16m14m.ld -d1_mini_pro.menu.eesz.16M14M.build.spiffs_pagesize=256 -d1_mini_pro.menu.eesz.16M14M.upload.maximum_size=1044464 -d1_mini_pro.menu.eesz.16M14M.build.rfcal_addr=0xFFC000 -d1_mini_pro.menu.eesz.16M14M.build.spiffs_start=0x200000 -d1_mini_pro.menu.eesz.16M14M.build.spiffs_end=0xFFB000 -d1_mini_pro.menu.eesz.16M14M.build.spiffs_blocksize=8192 -d1_mini_pro.menu.eesz.16M15M=16M (15M SPIFFS) -d1_mini_pro.menu.eesz.16M15M.build.flash_size=16M -d1_mini_pro.menu.eesz.16M15M.build.flash_size_bytes=0x1000000 -d1_mini_pro.menu.eesz.16M15M.build.flash_ld=eagle.flash.16m15m.ld -d1_mini_pro.menu.eesz.16M15M.build.spiffs_pagesize=256 -d1_mini_pro.menu.eesz.16M15M.upload.maximum_size=1044464 -d1_mini_pro.menu.eesz.16M15M.build.rfcal_addr=0xFFC000 -d1_mini_pro.menu.eesz.16M15M.build.spiffs_start=0x100000 -d1_mini_pro.menu.eesz.16M15M.build.spiffs_end=0xFFB000 -d1_mini_pro.menu.eesz.16M15M.build.spiffs_blocksize=8192 -d1_mini_pro.menu.ip.lm2f=v2 Lower Memory -d1_mini_pro.menu.ip.lm2f.build.lwip_include=lwip2/include -d1_mini_pro.menu.ip.lm2f.build.lwip_lib=-llwip2-536-feat -d1_mini_pro.menu.ip.lm2f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -d1_mini_pro.menu.ip.hb2f=v2 Higher Bandwidth -d1_mini_pro.menu.ip.hb2f.build.lwip_include=lwip2/include -d1_mini_pro.menu.ip.hb2f.build.lwip_lib=-llwip2-1460-feat -d1_mini_pro.menu.ip.hb2f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -d1_mini_pro.menu.ip.lm2n=v2 Lower Memory (no features) -d1_mini_pro.menu.ip.lm2n.build.lwip_include=lwip2/include -d1_mini_pro.menu.ip.lm2n.build.lwip_lib=-llwip2-536 -d1_mini_pro.menu.ip.lm2n.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=0 -DLWIP_IPV6=0 -d1_mini_pro.menu.ip.hb2n=v2 Higher Bandwidth (no features) -d1_mini_pro.menu.ip.hb2n.build.lwip_include=lwip2/include -d1_mini_pro.menu.ip.hb2n.build.lwip_lib=-llwip2-1460 -d1_mini_pro.menu.ip.hb2n.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=0 -DLWIP_IPV6=0 -d1_mini_pro.menu.ip.lm6f=v2 IPv6 Lower Memory -d1_mini_pro.menu.ip.lm6f.build.lwip_include=lwip2/include -d1_mini_pro.menu.ip.lm6f.build.lwip_lib=-llwip6-536-feat -d1_mini_pro.menu.ip.lm6f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=1 -d1_mini_pro.menu.ip.hb6f=v2 IPv6 Higher Bandwidth -d1_mini_pro.menu.ip.hb6f.build.lwip_include=lwip2/include -d1_mini_pro.menu.ip.hb6f.build.lwip_lib=-llwip6-1460-feat -d1_mini_pro.menu.ip.hb6f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=1 -DLWIP_IPV6=1 -d1_mini_pro.menu.ip.hb1=v1.4 Higher Bandwidth -d1_mini_pro.menu.ip.hb1.build.lwip_lib=-llwip_gcc -d1_mini_pro.menu.ip.hb1.build.lwip_flags=-DLWIP_OPEN_SRC -d1_mini_pro.menu.ip.src=v1.4 Compile from source -d1_mini_pro.menu.ip.src.build.lwip_lib=-llwip_src -d1_mini_pro.menu.ip.src.build.lwip_flags=-DLWIP_OPEN_SRC -d1_mini_pro.menu.ip.src.recipe.hooks.sketch.prebuild.1.pattern=make -C "{runtime.platform.path}/tools/sdk/lwip/src" install TOOLS_PATH="{runtime.tools.xtensa-lx106-elf-gcc.path}/bin/xtensa-lx106-elf-" -d1_mini_pro.menu.dbg.Disabled=Disabled -d1_mini_pro.menu.dbg.Disabled.build.debug_port= -d1_mini_pro.menu.dbg.Serial=Serial -d1_mini_pro.menu.dbg.Serial.build.debug_port=-DDEBUG_ESP_PORT=Serial -d1_mini_pro.menu.dbg.Serial1=Serial1 -d1_mini_pro.menu.dbg.Serial1.build.debug_port=-DDEBUG_ESP_PORT=Serial1 -d1_mini_pro.menu.lvl.None____=None -d1_mini_pro.menu.lvl.None____.build.debug_level= -d1_mini_pro.menu.lvl.SSL=SSL -d1_mini_pro.menu.lvl.SSL.build.debug_level= -DDEBUG_ESP_SSL -d1_mini_pro.menu.lvl.TLS_MEM=TLS_MEM -d1_mini_pro.menu.lvl.TLS_MEM.build.debug_level= -DDEBUG_ESP_TLS_MEM -d1_mini_pro.menu.lvl.HTTP_CLIENT=HTTP_CLIENT -d1_mini_pro.menu.lvl.HTTP_CLIENT.build.debug_level= -DDEBUG_ESP_HTTP_CLIENT -d1_mini_pro.menu.lvl.HTTP_SERVER=HTTP_SERVER -d1_mini_pro.menu.lvl.HTTP_SERVER.build.debug_level= -DDEBUG_ESP_HTTP_SERVER -d1_mini_pro.menu.lvl.SSLTLS_MEM=SSL+TLS_MEM -d1_mini_pro.menu.lvl.SSLTLS_MEM.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -d1_mini_pro.menu.lvl.SSLHTTP_CLIENT=SSL+HTTP_CLIENT -d1_mini_pro.menu.lvl.SSLHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_CLIENT -d1_mini_pro.menu.lvl.SSLHTTP_SERVER=SSL+HTTP_SERVER -d1_mini_pro.menu.lvl.SSLHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_SERVER -d1_mini_pro.menu.lvl.TLS_MEMHTTP_CLIENT=TLS_MEM+HTTP_CLIENT -d1_mini_pro.menu.lvl.TLS_MEMHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -d1_mini_pro.menu.lvl.TLS_MEMHTTP_SERVER=TLS_MEM+HTTP_SERVER -d1_mini_pro.menu.lvl.TLS_MEMHTTP_SERVER.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_SERVER -d1_mini_pro.menu.lvl.HTTP_CLIENTHTTP_SERVER=HTTP_CLIENT+HTTP_SERVER -d1_mini_pro.menu.lvl.HTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -d1_mini_pro.menu.lvl.SSLTLS_MEMHTTP_CLIENT=SSL+TLS_MEM+HTTP_CLIENT -d1_mini_pro.menu.lvl.SSLTLS_MEMHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -d1_mini_pro.menu.lvl.SSLTLS_MEMHTTP_SERVER=SSL+TLS_MEM+HTTP_SERVER -d1_mini_pro.menu.lvl.SSLTLS_MEMHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_SERVER -d1_mini_pro.menu.lvl.SSLHTTP_CLIENTHTTP_SERVER=SSL+HTTP_CLIENT+HTTP_SERVER -d1_mini_pro.menu.lvl.SSLHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -d1_mini_pro.menu.lvl.TLS_MEMHTTP_CLIENTHTTP_SERVER=TLS_MEM+HTTP_CLIENT+HTTP_SERVER -d1_mini_pro.menu.lvl.TLS_MEMHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -d1_mini_pro.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVER=SSL+TLS_MEM+HTTP_CLIENT+HTTP_SERVER -d1_mini_pro.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -d1_mini_pro.menu.lvl.CORE=CORE -d1_mini_pro.menu.lvl.CORE.build.debug_level= -DDEBUG_ESP_CORE -d1_mini_pro.menu.lvl.WIFI=WIFI -d1_mini_pro.menu.lvl.WIFI.build.debug_level= -DDEBUG_ESP_WIFI -d1_mini_pro.menu.lvl.HTTP_UPDATE=HTTP_UPDATE -d1_mini_pro.menu.lvl.HTTP_UPDATE.build.debug_level= -DDEBUG_ESP_HTTP_UPDATE -d1_mini_pro.menu.lvl.UPDATER=UPDATER -d1_mini_pro.menu.lvl.UPDATER.build.debug_level= -DDEBUG_ESP_UPDATER -d1_mini_pro.menu.lvl.OTA=OTA -d1_mini_pro.menu.lvl.OTA.build.debug_level= -DDEBUG_ESP_OTA -d1_mini_pro.menu.lvl.OOM=OOM -d1_mini_pro.menu.lvl.OOM.build.debug_level= -DDEBUG_ESP_OOM -d1_mini_pro.menu.lvl.COREWIFIHTTP_UPDATEUPDATEROTAOOM=CORE+WIFI+HTTP_UPDATE+UPDATER+OTA+OOM -d1_mini_pro.menu.lvl.COREWIFIHTTP_UPDATEUPDATEROTAOOM.build.debug_level= -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM -d1_mini_pro.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVERCOREWIFIHTTP_UPDATEUPDATEROTAOOM=SSL+TLS_MEM+HTTP_CLIENT+HTTP_SERVER+CORE+WIFI+HTTP_UPDATE+UPDATER+OTA+OOM -d1_mini_pro.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVERCOREWIFIHTTP_UPDATEUPDATEROTAOOM.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM -d1_mini_pro.menu.lvl.NoAssert-NDEBUG=NoAssert-NDEBUG -d1_mini_pro.menu.lvl.NoAssert-NDEBUG.build.debug_level= -DNDEBUG -d1_mini_pro.menu.wipe.none=Only Sketch -d1_mini_pro.menu.wipe.none.upload.erase_cmd= -d1_mini_pro.menu.wipe.sdk=Sketch + WiFi Settings -d1_mini_pro.menu.wipe.sdk.upload.erase_cmd=-ca "{build.rfcal_addr}" -cz 0x4000 -d1_mini_pro.menu.wipe.all=All Flash Contents -d1_mini_pro.menu.wipe.all.upload.erase_cmd=-ca 0x0 -cz "{build.flash_size_bytes}" -d1_mini_pro.menu.baud.921600=921600 -d1_mini_pro.menu.baud.921600.upload.speed=921600 -d1_mini_pro.menu.baud.9600=9600 -d1_mini_pro.menu.baud.9600.upload.speed=9600 -d1_mini_pro.menu.baud.57600=57600 -d1_mini_pro.menu.baud.57600.upload.speed=57600 -d1_mini_pro.menu.baud.115200=115200 -d1_mini_pro.menu.baud.115200.upload.speed=115200 -d1_mini_pro.menu.baud.230400.linux=230400 -d1_mini_pro.menu.baud.230400.macosx=230400 -d1_mini_pro.menu.baud.230400.upload.speed=230400 -d1_mini_pro.menu.baud.256000.windows=256000 -d1_mini_pro.menu.baud.256000.upload.speed=256000 -d1_mini_pro.menu.baud.460800.linux=460800 -d1_mini_pro.menu.baud.460800.macosx=460800 -d1_mini_pro.menu.baud.460800.upload.speed=460800 -d1_mini_pro.menu.baud.512000.windows=512000 -d1_mini_pro.menu.baud.512000.upload.speed=512000 - -############################################################## -d1_mini_lite.name=LOLIN(WEMOS) D1 mini Lite -d1_mini_lite.build.board=ESP8266_WEMOS_D1MINILITE -d1_mini_lite.build.variant=d1_mini -d1_mini_lite.upload.tool=esptool -d1_mini_lite.upload.maximum_data_size=81920 -d1_mini_lite.upload.wait_for_upload_port=true -d1_mini_lite.upload.erase_cmd= -d1_mini_lite.serial.disableDTR=true -d1_mini_lite.serial.disableRTS=true -d1_mini_lite.build.mcu=esp8266 -d1_mini_lite.build.core=esp8266 -d1_mini_lite.build.spiffs_pagesize=256 -d1_mini_lite.build.debug_port= -d1_mini_lite.build.debug_level= -d1_mini_lite.menu.xtal.80=80 MHz -d1_mini_lite.menu.xtal.80.build.f_cpu=80000000L -d1_mini_lite.menu.xtal.160=160 MHz -d1_mini_lite.menu.xtal.160.build.f_cpu=160000000L -d1_mini_lite.menu.vt.flash=Flash -d1_mini_lite.menu.vt.flash.build.vtable_flags=-DVTABLES_IN_FLASH -d1_mini_lite.menu.vt.heap=Heap -d1_mini_lite.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM -d1_mini_lite.menu.vt.iram=IRAM -d1_mini_lite.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM -d1_mini_lite.menu.exception.enabled=Enabled -d1_mini_lite.menu.exception.enabled.build.exception_flags=-fexceptions -d1_mini_lite.menu.exception.enabled.build.stdcpp_lib=-lstdc++ -d1_mini_lite.menu.exception.disabled=Disabled -d1_mini_lite.menu.exception.disabled.build.exception_flags=-fno-exceptions -d1_mini_lite.menu.exception.disabled.build.stdcpp_lib=-lstdc++-nox -d1_mini_lite.upload.resetmethod=nodemcu -d1_mini_lite.build.flash_mode=dout -d1_mini_lite.build.flash_freq=40 -d1_mini_lite.menu.eesz.1M=1M (no SPIFFS) -d1_mini_lite.menu.eesz.1M.build.flash_size=1M -d1_mini_lite.menu.eesz.1M.build.flash_size_bytes=0x100000 -d1_mini_lite.menu.eesz.1M.build.flash_ld=eagle.flash.1m.ld -d1_mini_lite.menu.eesz.1M.build.spiffs_pagesize=256 -d1_mini_lite.menu.eesz.1M.upload.maximum_size=1023984 -d1_mini_lite.menu.eesz.1M.build.rfcal_addr=0xFC000 -d1_mini_lite.menu.eesz.1M64=1M (64K SPIFFS) -d1_mini_lite.menu.eesz.1M64.build.flash_size=1M -d1_mini_lite.menu.eesz.1M64.build.flash_size_bytes=0x100000 -d1_mini_lite.menu.eesz.1M64.build.flash_ld=eagle.flash.1m64.ld -d1_mini_lite.menu.eesz.1M64.build.spiffs_pagesize=256 -d1_mini_lite.menu.eesz.1M64.upload.maximum_size=958448 -d1_mini_lite.menu.eesz.1M64.build.rfcal_addr=0xFC000 -d1_mini_lite.menu.eesz.1M64.build.spiffs_start=0xEB000 -d1_mini_lite.menu.eesz.1M64.build.spiffs_end=0xFB000 -d1_mini_lite.menu.eesz.1M64.build.spiffs_blocksize=4096 -d1_mini_lite.menu.eesz.1M128=1M (128K SPIFFS) -d1_mini_lite.menu.eesz.1M128.build.flash_size=1M -d1_mini_lite.menu.eesz.1M128.build.flash_size_bytes=0x100000 -d1_mini_lite.menu.eesz.1M128.build.flash_ld=eagle.flash.1m128.ld -d1_mini_lite.menu.eesz.1M128.build.spiffs_pagesize=256 -d1_mini_lite.menu.eesz.1M128.upload.maximum_size=892912 -d1_mini_lite.menu.eesz.1M128.build.rfcal_addr=0xFC000 -d1_mini_lite.menu.eesz.1M128.build.spiffs_start=0xDB000 -d1_mini_lite.menu.eesz.1M128.build.spiffs_end=0xFB000 -d1_mini_lite.menu.eesz.1M128.build.spiffs_blocksize=4096 -d1_mini_lite.menu.eesz.1M144=1M (144K SPIFFS) -d1_mini_lite.menu.eesz.1M144.build.flash_size=1M -d1_mini_lite.menu.eesz.1M144.build.flash_size_bytes=0x100000 -d1_mini_lite.menu.eesz.1M144.build.flash_ld=eagle.flash.1m144.ld -d1_mini_lite.menu.eesz.1M144.build.spiffs_pagesize=256 -d1_mini_lite.menu.eesz.1M144.upload.maximum_size=876528 -d1_mini_lite.menu.eesz.1M144.build.rfcal_addr=0xFC000 -d1_mini_lite.menu.eesz.1M144.build.spiffs_start=0xD7000 -d1_mini_lite.menu.eesz.1M144.build.spiffs_end=0xFB000 -d1_mini_lite.menu.eesz.1M144.build.spiffs_blocksize=4096 -d1_mini_lite.menu.eesz.1M160=1M (160K SPIFFS) -d1_mini_lite.menu.eesz.1M160.build.flash_size=1M -d1_mini_lite.menu.eesz.1M160.build.flash_size_bytes=0x100000 -d1_mini_lite.menu.eesz.1M160.build.flash_ld=eagle.flash.1m160.ld -d1_mini_lite.menu.eesz.1M160.build.spiffs_pagesize=256 -d1_mini_lite.menu.eesz.1M160.upload.maximum_size=860144 -d1_mini_lite.menu.eesz.1M160.build.rfcal_addr=0xFC000 -d1_mini_lite.menu.eesz.1M160.build.spiffs_start=0xD3000 -d1_mini_lite.menu.eesz.1M160.build.spiffs_end=0xFB000 -d1_mini_lite.menu.eesz.1M160.build.spiffs_blocksize=4096 -d1_mini_lite.menu.eesz.1M192=1M (192K SPIFFS) -d1_mini_lite.menu.eesz.1M192.build.flash_size=1M -d1_mini_lite.menu.eesz.1M192.build.flash_size_bytes=0x100000 -d1_mini_lite.menu.eesz.1M192.build.flash_ld=eagle.flash.1m192.ld -d1_mini_lite.menu.eesz.1M192.build.spiffs_pagesize=256 -d1_mini_lite.menu.eesz.1M192.upload.maximum_size=827376 -d1_mini_lite.menu.eesz.1M192.build.rfcal_addr=0xFC000 -d1_mini_lite.menu.eesz.1M192.build.spiffs_start=0xCB000 -d1_mini_lite.menu.eesz.1M192.build.spiffs_end=0xFB000 -d1_mini_lite.menu.eesz.1M192.build.spiffs_blocksize=4096 -d1_mini_lite.menu.eesz.1M256=1M (256K SPIFFS) -d1_mini_lite.menu.eesz.1M256.build.flash_size=1M -d1_mini_lite.menu.eesz.1M256.build.flash_size_bytes=0x100000 -d1_mini_lite.menu.eesz.1M256.build.flash_ld=eagle.flash.1m256.ld -d1_mini_lite.menu.eesz.1M256.build.spiffs_pagesize=256 -d1_mini_lite.menu.eesz.1M256.upload.maximum_size=761840 -d1_mini_lite.menu.eesz.1M256.build.rfcal_addr=0xFC000 -d1_mini_lite.menu.eesz.1M256.build.spiffs_start=0xBB000 -d1_mini_lite.menu.eesz.1M256.build.spiffs_end=0xFB000 -d1_mini_lite.menu.eesz.1M256.build.spiffs_blocksize=4096 -d1_mini_lite.menu.eesz.1M512=1M (512K SPIFFS) -d1_mini_lite.menu.eesz.1M512.build.flash_size=1M -d1_mini_lite.menu.eesz.1M512.build.flash_size_bytes=0x100000 -d1_mini_lite.menu.eesz.1M512.build.flash_ld=eagle.flash.1m512.ld -d1_mini_lite.menu.eesz.1M512.build.spiffs_pagesize=256 -d1_mini_lite.menu.eesz.1M512.upload.maximum_size=499696 -d1_mini_lite.menu.eesz.1M512.build.rfcal_addr=0xFC000 -d1_mini_lite.menu.eesz.1M512.build.spiffs_start=0x7B000 -d1_mini_lite.menu.eesz.1M512.build.spiffs_end=0xFB000 -d1_mini_lite.menu.eesz.1M512.build.spiffs_blocksize=4096 -d1_mini_lite.menu.ip.lm2f=v2 Lower Memory -d1_mini_lite.menu.ip.lm2f.build.lwip_include=lwip2/include -d1_mini_lite.menu.ip.lm2f.build.lwip_lib=-llwip2-536-feat -d1_mini_lite.menu.ip.lm2f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -d1_mini_lite.menu.ip.hb2f=v2 Higher Bandwidth -d1_mini_lite.menu.ip.hb2f.build.lwip_include=lwip2/include -d1_mini_lite.menu.ip.hb2f.build.lwip_lib=-llwip2-1460-feat -d1_mini_lite.menu.ip.hb2f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -d1_mini_lite.menu.ip.lm2n=v2 Lower Memory (no features) -d1_mini_lite.menu.ip.lm2n.build.lwip_include=lwip2/include -d1_mini_lite.menu.ip.lm2n.build.lwip_lib=-llwip2-536 -d1_mini_lite.menu.ip.lm2n.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=0 -DLWIP_IPV6=0 -d1_mini_lite.menu.ip.hb2n=v2 Higher Bandwidth (no features) -d1_mini_lite.menu.ip.hb2n.build.lwip_include=lwip2/include -d1_mini_lite.menu.ip.hb2n.build.lwip_lib=-llwip2-1460 -d1_mini_lite.menu.ip.hb2n.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=0 -DLWIP_IPV6=0 -d1_mini_lite.menu.ip.lm6f=v2 IPv6 Lower Memory -d1_mini_lite.menu.ip.lm6f.build.lwip_include=lwip2/include -d1_mini_lite.menu.ip.lm6f.build.lwip_lib=-llwip6-536-feat -d1_mini_lite.menu.ip.lm6f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=1 -d1_mini_lite.menu.ip.hb6f=v2 IPv6 Higher Bandwidth -d1_mini_lite.menu.ip.hb6f.build.lwip_include=lwip2/include -d1_mini_lite.menu.ip.hb6f.build.lwip_lib=-llwip6-1460-feat -d1_mini_lite.menu.ip.hb6f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=1 -DLWIP_IPV6=1 -d1_mini_lite.menu.ip.hb1=v1.4 Higher Bandwidth -d1_mini_lite.menu.ip.hb1.build.lwip_lib=-llwip_gcc -d1_mini_lite.menu.ip.hb1.build.lwip_flags=-DLWIP_OPEN_SRC -d1_mini_lite.menu.ip.src=v1.4 Compile from source -d1_mini_lite.menu.ip.src.build.lwip_lib=-llwip_src -d1_mini_lite.menu.ip.src.build.lwip_flags=-DLWIP_OPEN_SRC -d1_mini_lite.menu.ip.src.recipe.hooks.sketch.prebuild.1.pattern=make -C "{runtime.platform.path}/tools/sdk/lwip/src" install TOOLS_PATH="{runtime.tools.xtensa-lx106-elf-gcc.path}/bin/xtensa-lx106-elf-" -d1_mini_lite.menu.dbg.Disabled=Disabled -d1_mini_lite.menu.dbg.Disabled.build.debug_port= -d1_mini_lite.menu.dbg.Serial=Serial -d1_mini_lite.menu.dbg.Serial.build.debug_port=-DDEBUG_ESP_PORT=Serial -d1_mini_lite.menu.dbg.Serial1=Serial1 -d1_mini_lite.menu.dbg.Serial1.build.debug_port=-DDEBUG_ESP_PORT=Serial1 -d1_mini_lite.menu.lvl.None____=None -d1_mini_lite.menu.lvl.None____.build.debug_level= -d1_mini_lite.menu.lvl.SSL=SSL -d1_mini_lite.menu.lvl.SSL.build.debug_level= -DDEBUG_ESP_SSL -d1_mini_lite.menu.lvl.TLS_MEM=TLS_MEM -d1_mini_lite.menu.lvl.TLS_MEM.build.debug_level= -DDEBUG_ESP_TLS_MEM -d1_mini_lite.menu.lvl.HTTP_CLIENT=HTTP_CLIENT -d1_mini_lite.menu.lvl.HTTP_CLIENT.build.debug_level= -DDEBUG_ESP_HTTP_CLIENT -d1_mini_lite.menu.lvl.HTTP_SERVER=HTTP_SERVER -d1_mini_lite.menu.lvl.HTTP_SERVER.build.debug_level= -DDEBUG_ESP_HTTP_SERVER -d1_mini_lite.menu.lvl.SSLTLS_MEM=SSL+TLS_MEM -d1_mini_lite.menu.lvl.SSLTLS_MEM.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -d1_mini_lite.menu.lvl.SSLHTTP_CLIENT=SSL+HTTP_CLIENT -d1_mini_lite.menu.lvl.SSLHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_CLIENT -d1_mini_lite.menu.lvl.SSLHTTP_SERVER=SSL+HTTP_SERVER -d1_mini_lite.menu.lvl.SSLHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_SERVER -d1_mini_lite.menu.lvl.TLS_MEMHTTP_CLIENT=TLS_MEM+HTTP_CLIENT -d1_mini_lite.menu.lvl.TLS_MEMHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -d1_mini_lite.menu.lvl.TLS_MEMHTTP_SERVER=TLS_MEM+HTTP_SERVER -d1_mini_lite.menu.lvl.TLS_MEMHTTP_SERVER.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_SERVER -d1_mini_lite.menu.lvl.HTTP_CLIENTHTTP_SERVER=HTTP_CLIENT+HTTP_SERVER -d1_mini_lite.menu.lvl.HTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -d1_mini_lite.menu.lvl.SSLTLS_MEMHTTP_CLIENT=SSL+TLS_MEM+HTTP_CLIENT -d1_mini_lite.menu.lvl.SSLTLS_MEMHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -d1_mini_lite.menu.lvl.SSLTLS_MEMHTTP_SERVER=SSL+TLS_MEM+HTTP_SERVER -d1_mini_lite.menu.lvl.SSLTLS_MEMHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_SERVER -d1_mini_lite.menu.lvl.SSLHTTP_CLIENTHTTP_SERVER=SSL+HTTP_CLIENT+HTTP_SERVER -d1_mini_lite.menu.lvl.SSLHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -d1_mini_lite.menu.lvl.TLS_MEMHTTP_CLIENTHTTP_SERVER=TLS_MEM+HTTP_CLIENT+HTTP_SERVER -d1_mini_lite.menu.lvl.TLS_MEMHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -d1_mini_lite.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVER=SSL+TLS_MEM+HTTP_CLIENT+HTTP_SERVER -d1_mini_lite.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -d1_mini_lite.menu.lvl.CORE=CORE -d1_mini_lite.menu.lvl.CORE.build.debug_level= -DDEBUG_ESP_CORE -d1_mini_lite.menu.lvl.WIFI=WIFI -d1_mini_lite.menu.lvl.WIFI.build.debug_level= -DDEBUG_ESP_WIFI -d1_mini_lite.menu.lvl.HTTP_UPDATE=HTTP_UPDATE -d1_mini_lite.menu.lvl.HTTP_UPDATE.build.debug_level= -DDEBUG_ESP_HTTP_UPDATE -d1_mini_lite.menu.lvl.UPDATER=UPDATER -d1_mini_lite.menu.lvl.UPDATER.build.debug_level= -DDEBUG_ESP_UPDATER -d1_mini_lite.menu.lvl.OTA=OTA -d1_mini_lite.menu.lvl.OTA.build.debug_level= -DDEBUG_ESP_OTA -d1_mini_lite.menu.lvl.OOM=OOM -d1_mini_lite.menu.lvl.OOM.build.debug_level= -DDEBUG_ESP_OOM -d1_mini_lite.menu.lvl.COREWIFIHTTP_UPDATEUPDATEROTAOOM=CORE+WIFI+HTTP_UPDATE+UPDATER+OTA+OOM -d1_mini_lite.menu.lvl.COREWIFIHTTP_UPDATEUPDATEROTAOOM.build.debug_level= -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM -d1_mini_lite.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVERCOREWIFIHTTP_UPDATEUPDATEROTAOOM=SSL+TLS_MEM+HTTP_CLIENT+HTTP_SERVER+CORE+WIFI+HTTP_UPDATE+UPDATER+OTA+OOM -d1_mini_lite.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVERCOREWIFIHTTP_UPDATEUPDATEROTAOOM.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM -d1_mini_lite.menu.lvl.NoAssert-NDEBUG=NoAssert-NDEBUG -d1_mini_lite.menu.lvl.NoAssert-NDEBUG.build.debug_level= -DNDEBUG -d1_mini_lite.menu.wipe.none=Only Sketch -d1_mini_lite.menu.wipe.none.upload.erase_cmd= -d1_mini_lite.menu.wipe.sdk=Sketch + WiFi Settings -d1_mini_lite.menu.wipe.sdk.upload.erase_cmd=-ca "{build.rfcal_addr}" -cz 0x4000 -d1_mini_lite.menu.wipe.all=All Flash Contents -d1_mini_lite.menu.wipe.all.upload.erase_cmd=-ca 0x0 -cz "{build.flash_size_bytes}" -d1_mini_lite.menu.baud.921600=921600 -d1_mini_lite.menu.baud.921600.upload.speed=921600 -d1_mini_lite.menu.baud.9600=9600 -d1_mini_lite.menu.baud.9600.upload.speed=9600 -d1_mini_lite.menu.baud.57600=57600 -d1_mini_lite.menu.baud.57600.upload.speed=57600 -d1_mini_lite.menu.baud.115200=115200 -d1_mini_lite.menu.baud.115200.upload.speed=115200 -d1_mini_lite.menu.baud.230400.linux=230400 -d1_mini_lite.menu.baud.230400.macosx=230400 -d1_mini_lite.menu.baud.230400.upload.speed=230400 -d1_mini_lite.menu.baud.256000.windows=256000 -d1_mini_lite.menu.baud.256000.upload.speed=256000 -d1_mini_lite.menu.baud.460800.linux=460800 -d1_mini_lite.menu.baud.460800.macosx=460800 -d1_mini_lite.menu.baud.460800.upload.speed=460800 -d1_mini_lite.menu.baud.512000.windows=512000 -d1_mini_lite.menu.baud.512000.upload.speed=512000 - -############################################################## -d1.name=WeMos D1 R1 -d1.build.board=ESP8266_WEMOS_D1R1 -d1.build.variant=d1 -d1.upload.tool=esptool -d1.upload.maximum_data_size=81920 -d1.upload.wait_for_upload_port=true -d1.upload.erase_cmd= -d1.serial.disableDTR=true -d1.serial.disableRTS=true -d1.build.mcu=esp8266 -d1.build.core=esp8266 -d1.build.spiffs_pagesize=256 -d1.build.debug_port= -d1.build.debug_level= -d1.menu.xtal.80=80 MHz -d1.menu.xtal.80.build.f_cpu=80000000L -d1.menu.xtal.160=160 MHz -d1.menu.xtal.160.build.f_cpu=160000000L -d1.menu.vt.flash=Flash -d1.menu.vt.flash.build.vtable_flags=-DVTABLES_IN_FLASH -d1.menu.vt.heap=Heap -d1.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM -d1.menu.vt.iram=IRAM -d1.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM -d1.menu.exception.enabled=Enabled -d1.menu.exception.enabled.build.exception_flags=-fexceptions -d1.menu.exception.enabled.build.stdcpp_lib=-lstdc++ -d1.menu.exception.disabled=Disabled -d1.menu.exception.disabled.build.exception_flags=-fno-exceptions -d1.menu.exception.disabled.build.stdcpp_lib=-lstdc++-nox -d1.upload.resetmethod=nodemcu -d1.build.flash_mode=dio -d1.build.flash_freq=40 -d1.menu.eesz.4M=4M (no SPIFFS) -d1.menu.eesz.4M.build.flash_size=4M -d1.menu.eesz.4M.build.flash_size_bytes=0x400000 -d1.menu.eesz.4M.build.flash_ld=eagle.flash.4m.ld -d1.menu.eesz.4M.build.spiffs_pagesize=256 -d1.menu.eesz.4M.upload.maximum_size=1044464 -d1.menu.eesz.4M.build.rfcal_addr=0x3FC000 -d1.menu.eesz.4M1M=4M (1M SPIFFS) -d1.menu.eesz.4M1M.build.flash_size=4M -d1.menu.eesz.4M1M.build.flash_size_bytes=0x400000 -d1.menu.eesz.4M1M.build.flash_ld=eagle.flash.4m1m.ld -d1.menu.eesz.4M1M.build.spiffs_pagesize=256 -d1.menu.eesz.4M1M.upload.maximum_size=1044464 -d1.menu.eesz.4M1M.build.rfcal_addr=0x3FC000 -d1.menu.eesz.4M1M.build.spiffs_start=0x300000 -d1.menu.eesz.4M1M.build.spiffs_end=0x3FB000 -d1.menu.eesz.4M1M.build.spiffs_blocksize=8192 -d1.menu.eesz.4M2M=4M (2M SPIFFS) -d1.menu.eesz.4M2M.build.flash_size=4M -d1.menu.eesz.4M2M.build.flash_size_bytes=0x400000 -d1.menu.eesz.4M2M.build.flash_ld=eagle.flash.4m2m.ld -d1.menu.eesz.4M2M.build.spiffs_pagesize=256 -d1.menu.eesz.4M2M.upload.maximum_size=1044464 -d1.menu.eesz.4M2M.build.rfcal_addr=0x3FC000 -d1.menu.eesz.4M2M.build.spiffs_start=0x200000 -d1.menu.eesz.4M2M.build.spiffs_end=0x3FB000 -d1.menu.eesz.4M2M.build.spiffs_blocksize=8192 -d1.menu.eesz.4M3M=4M (3M SPIFFS) -d1.menu.eesz.4M3M.build.flash_size=4M -d1.menu.eesz.4M3M.build.flash_size_bytes=0x400000 -d1.menu.eesz.4M3M.build.flash_ld=eagle.flash.4m3m.ld -d1.menu.eesz.4M3M.build.spiffs_pagesize=256 -d1.menu.eesz.4M3M.upload.maximum_size=1044464 -d1.menu.eesz.4M3M.build.rfcal_addr=0x3FC000 -d1.menu.eesz.4M3M.build.spiffs_start=0x100000 -d1.menu.eesz.4M3M.build.spiffs_end=0x3FB000 -d1.menu.eesz.4M3M.build.spiffs_blocksize=8192 -d1.menu.ip.lm2f=v2 Lower Memory -d1.menu.ip.lm2f.build.lwip_include=lwip2/include -d1.menu.ip.lm2f.build.lwip_lib=-llwip2-536-feat -d1.menu.ip.lm2f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -d1.menu.ip.hb2f=v2 Higher Bandwidth -d1.menu.ip.hb2f.build.lwip_include=lwip2/include -d1.menu.ip.hb2f.build.lwip_lib=-llwip2-1460-feat -d1.menu.ip.hb2f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -d1.menu.ip.lm2n=v2 Lower Memory (no features) -d1.menu.ip.lm2n.build.lwip_include=lwip2/include -d1.menu.ip.lm2n.build.lwip_lib=-llwip2-536 -d1.menu.ip.lm2n.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=0 -DLWIP_IPV6=0 -d1.menu.ip.hb2n=v2 Higher Bandwidth (no features) -d1.menu.ip.hb2n.build.lwip_include=lwip2/include -d1.menu.ip.hb2n.build.lwip_lib=-llwip2-1460 -d1.menu.ip.hb2n.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=0 -DLWIP_IPV6=0 -d1.menu.ip.lm6f=v2 IPv6 Lower Memory -d1.menu.ip.lm6f.build.lwip_include=lwip2/include -d1.menu.ip.lm6f.build.lwip_lib=-llwip6-536-feat -d1.menu.ip.lm6f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=1 -d1.menu.ip.hb6f=v2 IPv6 Higher Bandwidth -d1.menu.ip.hb6f.build.lwip_include=lwip2/include -d1.menu.ip.hb6f.build.lwip_lib=-llwip6-1460-feat -d1.menu.ip.hb6f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=1 -DLWIP_IPV6=1 -d1.menu.ip.hb1=v1.4 Higher Bandwidth -d1.menu.ip.hb1.build.lwip_lib=-llwip_gcc -d1.menu.ip.hb1.build.lwip_flags=-DLWIP_OPEN_SRC -d1.menu.ip.src=v1.4 Compile from source -d1.menu.ip.src.build.lwip_lib=-llwip_src -d1.menu.ip.src.build.lwip_flags=-DLWIP_OPEN_SRC -d1.menu.ip.src.recipe.hooks.sketch.prebuild.1.pattern=make -C "{runtime.platform.path}/tools/sdk/lwip/src" install TOOLS_PATH="{runtime.tools.xtensa-lx106-elf-gcc.path}/bin/xtensa-lx106-elf-" -d1.menu.dbg.Disabled=Disabled -d1.menu.dbg.Disabled.build.debug_port= -d1.menu.dbg.Serial=Serial -d1.menu.dbg.Serial.build.debug_port=-DDEBUG_ESP_PORT=Serial -d1.menu.dbg.Serial1=Serial1 -d1.menu.dbg.Serial1.build.debug_port=-DDEBUG_ESP_PORT=Serial1 -d1.menu.lvl.None____=None -d1.menu.lvl.None____.build.debug_level= -d1.menu.lvl.SSL=SSL -d1.menu.lvl.SSL.build.debug_level= -DDEBUG_ESP_SSL -d1.menu.lvl.TLS_MEM=TLS_MEM -d1.menu.lvl.TLS_MEM.build.debug_level= -DDEBUG_ESP_TLS_MEM -d1.menu.lvl.HTTP_CLIENT=HTTP_CLIENT -d1.menu.lvl.HTTP_CLIENT.build.debug_level= -DDEBUG_ESP_HTTP_CLIENT -d1.menu.lvl.HTTP_SERVER=HTTP_SERVER -d1.menu.lvl.HTTP_SERVER.build.debug_level= -DDEBUG_ESP_HTTP_SERVER -d1.menu.lvl.SSLTLS_MEM=SSL+TLS_MEM -d1.menu.lvl.SSLTLS_MEM.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -d1.menu.lvl.SSLHTTP_CLIENT=SSL+HTTP_CLIENT -d1.menu.lvl.SSLHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_CLIENT -d1.menu.lvl.SSLHTTP_SERVER=SSL+HTTP_SERVER -d1.menu.lvl.SSLHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_SERVER -d1.menu.lvl.TLS_MEMHTTP_CLIENT=TLS_MEM+HTTP_CLIENT -d1.menu.lvl.TLS_MEMHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -d1.menu.lvl.TLS_MEMHTTP_SERVER=TLS_MEM+HTTP_SERVER -d1.menu.lvl.TLS_MEMHTTP_SERVER.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_SERVER -d1.menu.lvl.HTTP_CLIENTHTTP_SERVER=HTTP_CLIENT+HTTP_SERVER -d1.menu.lvl.HTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -d1.menu.lvl.SSLTLS_MEMHTTP_CLIENT=SSL+TLS_MEM+HTTP_CLIENT -d1.menu.lvl.SSLTLS_MEMHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -d1.menu.lvl.SSLTLS_MEMHTTP_SERVER=SSL+TLS_MEM+HTTP_SERVER -d1.menu.lvl.SSLTLS_MEMHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_SERVER -d1.menu.lvl.SSLHTTP_CLIENTHTTP_SERVER=SSL+HTTP_CLIENT+HTTP_SERVER -d1.menu.lvl.SSLHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -d1.menu.lvl.TLS_MEMHTTP_CLIENTHTTP_SERVER=TLS_MEM+HTTP_CLIENT+HTTP_SERVER -d1.menu.lvl.TLS_MEMHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -d1.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVER=SSL+TLS_MEM+HTTP_CLIENT+HTTP_SERVER -d1.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -d1.menu.lvl.CORE=CORE -d1.menu.lvl.CORE.build.debug_level= -DDEBUG_ESP_CORE -d1.menu.lvl.WIFI=WIFI -d1.menu.lvl.WIFI.build.debug_level= -DDEBUG_ESP_WIFI -d1.menu.lvl.HTTP_UPDATE=HTTP_UPDATE -d1.menu.lvl.HTTP_UPDATE.build.debug_level= -DDEBUG_ESP_HTTP_UPDATE -d1.menu.lvl.UPDATER=UPDATER -d1.menu.lvl.UPDATER.build.debug_level= -DDEBUG_ESP_UPDATER -d1.menu.lvl.OTA=OTA -d1.menu.lvl.OTA.build.debug_level= -DDEBUG_ESP_OTA -d1.menu.lvl.OOM=OOM -d1.menu.lvl.OOM.build.debug_level= -DDEBUG_ESP_OOM -d1.menu.lvl.COREWIFIHTTP_UPDATEUPDATEROTAOOM=CORE+WIFI+HTTP_UPDATE+UPDATER+OTA+OOM -d1.menu.lvl.COREWIFIHTTP_UPDATEUPDATEROTAOOM.build.debug_level= -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM -d1.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVERCOREWIFIHTTP_UPDATEUPDATEROTAOOM=SSL+TLS_MEM+HTTP_CLIENT+HTTP_SERVER+CORE+WIFI+HTTP_UPDATE+UPDATER+OTA+OOM -d1.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVERCOREWIFIHTTP_UPDATEUPDATEROTAOOM.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM -d1.menu.lvl.NoAssert-NDEBUG=NoAssert-NDEBUG -d1.menu.lvl.NoAssert-NDEBUG.build.debug_level= -DNDEBUG -d1.menu.wipe.none=Only Sketch -d1.menu.wipe.none.upload.erase_cmd= -d1.menu.wipe.sdk=Sketch + WiFi Settings -d1.menu.wipe.sdk.upload.erase_cmd=-ca "{build.rfcal_addr}" -cz 0x4000 -d1.menu.wipe.all=All Flash Contents -d1.menu.wipe.all.upload.erase_cmd=-ca 0x0 -cz "{build.flash_size_bytes}" -d1.menu.baud.921600=921600 -d1.menu.baud.921600.upload.speed=921600 -d1.menu.baud.9600=9600 -d1.menu.baud.9600.upload.speed=9600 -d1.menu.baud.57600=57600 -d1.menu.baud.57600.upload.speed=57600 -d1.menu.baud.115200=115200 -d1.menu.baud.115200.upload.speed=115200 -d1.menu.baud.230400.linux=230400 -d1.menu.baud.230400.macosx=230400 -d1.menu.baud.230400.upload.speed=230400 -d1.menu.baud.256000.windows=256000 -d1.menu.baud.256000.upload.speed=256000 -d1.menu.baud.460800.linux=460800 -d1.menu.baud.460800.macosx=460800 -d1.menu.baud.460800.upload.speed=460800 -d1.menu.baud.512000.windows=512000 -d1.menu.baud.512000.upload.speed=512000 - -############################################################## -espino.name=ESPino (ESP-12 Module) -espino.build.board=ESP8266_ESP12 -espino.build.variant=espino -espino.upload.tool=esptool -espino.upload.maximum_data_size=81920 -espino.upload.wait_for_upload_port=true -espino.upload.erase_cmd= -espino.serial.disableDTR=true -espino.serial.disableRTS=true -espino.build.mcu=esp8266 -espino.build.core=esp8266 -espino.build.spiffs_pagesize=256 -espino.build.debug_port= -espino.build.debug_level= -espino.menu.xtal.80=80 MHz -espino.menu.xtal.80.build.f_cpu=80000000L -espino.menu.xtal.160=160 MHz -espino.menu.xtal.160.build.f_cpu=160000000L -espino.menu.vt.flash=Flash -espino.menu.vt.flash.build.vtable_flags=-DVTABLES_IN_FLASH -espino.menu.vt.heap=Heap -espino.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM -espino.menu.vt.iram=IRAM -espino.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM -espino.menu.exception.enabled=Enabled -espino.menu.exception.enabled.build.exception_flags=-fexceptions -espino.menu.exception.enabled.build.stdcpp_lib=-lstdc++ -espino.menu.exception.disabled=Disabled -espino.menu.exception.disabled.build.exception_flags=-fno-exceptions -espino.menu.exception.disabled.build.stdcpp_lib=-lstdc++-nox -espino.menu.ResetMethod.ck=ck -espino.menu.ResetMethod.ck.upload.resetmethod=ck -espino.menu.ResetMethod.nodemcu=nodemcu -espino.menu.ResetMethod.nodemcu.upload.resetmethod=nodemcu -espino.build.flash_mode=qio -espino.build.flash_freq=40 -espino.menu.eesz.4M=4M (no SPIFFS) -espino.menu.eesz.4M.build.flash_size=4M -espino.menu.eesz.4M.build.flash_size_bytes=0x400000 -espino.menu.eesz.4M.build.flash_ld=eagle.flash.4m.ld -espino.menu.eesz.4M.build.spiffs_pagesize=256 -espino.menu.eesz.4M.upload.maximum_size=1044464 -espino.menu.eesz.4M.build.rfcal_addr=0x3FC000 -espino.menu.eesz.4M1M=4M (1M SPIFFS) -espino.menu.eesz.4M1M.build.flash_size=4M -espino.menu.eesz.4M1M.build.flash_size_bytes=0x400000 -espino.menu.eesz.4M1M.build.flash_ld=eagle.flash.4m1m.ld -espino.menu.eesz.4M1M.build.spiffs_pagesize=256 -espino.menu.eesz.4M1M.upload.maximum_size=1044464 -espino.menu.eesz.4M1M.build.rfcal_addr=0x3FC000 -espino.menu.eesz.4M1M.build.spiffs_start=0x300000 -espino.menu.eesz.4M1M.build.spiffs_end=0x3FB000 -espino.menu.eesz.4M1M.build.spiffs_blocksize=8192 -espino.menu.eesz.4M2M=4M (2M SPIFFS) -espino.menu.eesz.4M2M.build.flash_size=4M -espino.menu.eesz.4M2M.build.flash_size_bytes=0x400000 -espino.menu.eesz.4M2M.build.flash_ld=eagle.flash.4m2m.ld -espino.menu.eesz.4M2M.build.spiffs_pagesize=256 -espino.menu.eesz.4M2M.upload.maximum_size=1044464 -espino.menu.eesz.4M2M.build.rfcal_addr=0x3FC000 -espino.menu.eesz.4M2M.build.spiffs_start=0x200000 -espino.menu.eesz.4M2M.build.spiffs_end=0x3FB000 -espino.menu.eesz.4M2M.build.spiffs_blocksize=8192 -espino.menu.eesz.4M3M=4M (3M SPIFFS) -espino.menu.eesz.4M3M.build.flash_size=4M -espino.menu.eesz.4M3M.build.flash_size_bytes=0x400000 -espino.menu.eesz.4M3M.build.flash_ld=eagle.flash.4m3m.ld -espino.menu.eesz.4M3M.build.spiffs_pagesize=256 -espino.menu.eesz.4M3M.upload.maximum_size=1044464 -espino.menu.eesz.4M3M.build.rfcal_addr=0x3FC000 -espino.menu.eesz.4M3M.build.spiffs_start=0x100000 -espino.menu.eesz.4M3M.build.spiffs_end=0x3FB000 -espino.menu.eesz.4M3M.build.spiffs_blocksize=8192 -espino.menu.ip.lm2f=v2 Lower Memory -espino.menu.ip.lm2f.build.lwip_include=lwip2/include -espino.menu.ip.lm2f.build.lwip_lib=-llwip2-536-feat -espino.menu.ip.lm2f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -espino.menu.ip.hb2f=v2 Higher Bandwidth -espino.menu.ip.hb2f.build.lwip_include=lwip2/include -espino.menu.ip.hb2f.build.lwip_lib=-llwip2-1460-feat -espino.menu.ip.hb2f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -espino.menu.ip.lm2n=v2 Lower Memory (no features) -espino.menu.ip.lm2n.build.lwip_include=lwip2/include -espino.menu.ip.lm2n.build.lwip_lib=-llwip2-536 -espino.menu.ip.lm2n.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=0 -DLWIP_IPV6=0 -espino.menu.ip.hb2n=v2 Higher Bandwidth (no features) -espino.menu.ip.hb2n.build.lwip_include=lwip2/include -espino.menu.ip.hb2n.build.lwip_lib=-llwip2-1460 -espino.menu.ip.hb2n.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=0 -DLWIP_IPV6=0 -espino.menu.ip.lm6f=v2 IPv6 Lower Memory -espino.menu.ip.lm6f.build.lwip_include=lwip2/include -espino.menu.ip.lm6f.build.lwip_lib=-llwip6-536-feat -espino.menu.ip.lm6f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=1 -espino.menu.ip.hb6f=v2 IPv6 Higher Bandwidth -espino.menu.ip.hb6f.build.lwip_include=lwip2/include -espino.menu.ip.hb6f.build.lwip_lib=-llwip6-1460-feat -espino.menu.ip.hb6f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=1 -DLWIP_IPV6=1 -espino.menu.ip.hb1=v1.4 Higher Bandwidth -espino.menu.ip.hb1.build.lwip_lib=-llwip_gcc -espino.menu.ip.hb1.build.lwip_flags=-DLWIP_OPEN_SRC -espino.menu.ip.src=v1.4 Compile from source -espino.menu.ip.src.build.lwip_lib=-llwip_src -espino.menu.ip.src.build.lwip_flags=-DLWIP_OPEN_SRC -espino.menu.ip.src.recipe.hooks.sketch.prebuild.1.pattern=make -C "{runtime.platform.path}/tools/sdk/lwip/src" install TOOLS_PATH="{runtime.tools.xtensa-lx106-elf-gcc.path}/bin/xtensa-lx106-elf-" -espino.menu.dbg.Disabled=Disabled -espino.menu.dbg.Disabled.build.debug_port= -espino.menu.dbg.Serial=Serial -espino.menu.dbg.Serial.build.debug_port=-DDEBUG_ESP_PORT=Serial -espino.menu.dbg.Serial1=Serial1 -espino.menu.dbg.Serial1.build.debug_port=-DDEBUG_ESP_PORT=Serial1 -espino.menu.lvl.None____=None -espino.menu.lvl.None____.build.debug_level= -espino.menu.lvl.SSL=SSL -espino.menu.lvl.SSL.build.debug_level= -DDEBUG_ESP_SSL -espino.menu.lvl.TLS_MEM=TLS_MEM -espino.menu.lvl.TLS_MEM.build.debug_level= -DDEBUG_ESP_TLS_MEM -espino.menu.lvl.HTTP_CLIENT=HTTP_CLIENT -espino.menu.lvl.HTTP_CLIENT.build.debug_level= -DDEBUG_ESP_HTTP_CLIENT -espino.menu.lvl.HTTP_SERVER=HTTP_SERVER -espino.menu.lvl.HTTP_SERVER.build.debug_level= -DDEBUG_ESP_HTTP_SERVER -espino.menu.lvl.SSLTLS_MEM=SSL+TLS_MEM -espino.menu.lvl.SSLTLS_MEM.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -espino.menu.lvl.SSLHTTP_CLIENT=SSL+HTTP_CLIENT -espino.menu.lvl.SSLHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_CLIENT -espino.menu.lvl.SSLHTTP_SERVER=SSL+HTTP_SERVER -espino.menu.lvl.SSLHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_SERVER -espino.menu.lvl.TLS_MEMHTTP_CLIENT=TLS_MEM+HTTP_CLIENT -espino.menu.lvl.TLS_MEMHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -espino.menu.lvl.TLS_MEMHTTP_SERVER=TLS_MEM+HTTP_SERVER -espino.menu.lvl.TLS_MEMHTTP_SERVER.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_SERVER -espino.menu.lvl.HTTP_CLIENTHTTP_SERVER=HTTP_CLIENT+HTTP_SERVER -espino.menu.lvl.HTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -espino.menu.lvl.SSLTLS_MEMHTTP_CLIENT=SSL+TLS_MEM+HTTP_CLIENT -espino.menu.lvl.SSLTLS_MEMHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -espino.menu.lvl.SSLTLS_MEMHTTP_SERVER=SSL+TLS_MEM+HTTP_SERVER -espino.menu.lvl.SSLTLS_MEMHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_SERVER -espino.menu.lvl.SSLHTTP_CLIENTHTTP_SERVER=SSL+HTTP_CLIENT+HTTP_SERVER -espino.menu.lvl.SSLHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -espino.menu.lvl.TLS_MEMHTTP_CLIENTHTTP_SERVER=TLS_MEM+HTTP_CLIENT+HTTP_SERVER -espino.menu.lvl.TLS_MEMHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -espino.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVER=SSL+TLS_MEM+HTTP_CLIENT+HTTP_SERVER -espino.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -espino.menu.lvl.CORE=CORE -espino.menu.lvl.CORE.build.debug_level= -DDEBUG_ESP_CORE -espino.menu.lvl.WIFI=WIFI -espino.menu.lvl.WIFI.build.debug_level= -DDEBUG_ESP_WIFI -espino.menu.lvl.HTTP_UPDATE=HTTP_UPDATE -espino.menu.lvl.HTTP_UPDATE.build.debug_level= -DDEBUG_ESP_HTTP_UPDATE -espino.menu.lvl.UPDATER=UPDATER -espino.menu.lvl.UPDATER.build.debug_level= -DDEBUG_ESP_UPDATER -espino.menu.lvl.OTA=OTA -espino.menu.lvl.OTA.build.debug_level= -DDEBUG_ESP_OTA -espino.menu.lvl.OOM=OOM -espino.menu.lvl.OOM.build.debug_level= -DDEBUG_ESP_OOM -espino.menu.lvl.COREWIFIHTTP_UPDATEUPDATEROTAOOM=CORE+WIFI+HTTP_UPDATE+UPDATER+OTA+OOM -espino.menu.lvl.COREWIFIHTTP_UPDATEUPDATEROTAOOM.build.debug_level= -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM -espino.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVERCOREWIFIHTTP_UPDATEUPDATEROTAOOM=SSL+TLS_MEM+HTTP_CLIENT+HTTP_SERVER+CORE+WIFI+HTTP_UPDATE+UPDATER+OTA+OOM -espino.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVERCOREWIFIHTTP_UPDATEUPDATEROTAOOM.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM -espino.menu.lvl.NoAssert-NDEBUG=NoAssert-NDEBUG -espino.menu.lvl.NoAssert-NDEBUG.build.debug_level= -DNDEBUG -espino.menu.wipe.none=Only Sketch -espino.menu.wipe.none.upload.erase_cmd= -espino.menu.wipe.sdk=Sketch + WiFi Settings -espino.menu.wipe.sdk.upload.erase_cmd=-ca "{build.rfcal_addr}" -cz 0x4000 -espino.menu.wipe.all=All Flash Contents -espino.menu.wipe.all.upload.erase_cmd=-ca 0x0 -cz "{build.flash_size_bytes}" -espino.menu.baud.115200=115200 -espino.menu.baud.115200.upload.speed=115200 -espino.menu.baud.9600=9600 -espino.menu.baud.9600.upload.speed=9600 -espino.menu.baud.57600=57600 -espino.menu.baud.57600.upload.speed=57600 -espino.menu.baud.230400.linux=230400 -espino.menu.baud.230400.macosx=230400 -espino.menu.baud.230400.upload.speed=230400 -espino.menu.baud.256000.windows=256000 -espino.menu.baud.256000.upload.speed=256000 -espino.menu.baud.460800.linux=460800 -espino.menu.baud.460800.macosx=460800 -espino.menu.baud.460800.upload.speed=460800 -espino.menu.baud.512000.windows=512000 -espino.menu.baud.512000.upload.speed=512000 -espino.menu.baud.921600=921600 -espino.menu.baud.921600.upload.speed=921600 - -############################################################## -espinotee.name=ThaiEasyElec's ESPino -espinotee.build.board=ESP8266_ESP13 -espinotee.build.variant=espinotee -espinotee.upload.tool=esptool -espinotee.upload.maximum_data_size=81920 -espinotee.upload.wait_for_upload_port=true -espinotee.upload.erase_cmd= -espinotee.serial.disableDTR=true -espinotee.serial.disableRTS=true -espinotee.build.mcu=esp8266 -espinotee.build.core=esp8266 -espinotee.build.spiffs_pagesize=256 -espinotee.build.debug_port= -espinotee.build.debug_level= -espinotee.menu.xtal.80=80 MHz -espinotee.menu.xtal.80.build.f_cpu=80000000L -espinotee.menu.xtal.160=160 MHz -espinotee.menu.xtal.160.build.f_cpu=160000000L -espinotee.menu.vt.flash=Flash -espinotee.menu.vt.flash.build.vtable_flags=-DVTABLES_IN_FLASH -espinotee.menu.vt.heap=Heap -espinotee.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM -espinotee.menu.vt.iram=IRAM -espinotee.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM -espinotee.menu.exception.enabled=Enabled -espinotee.menu.exception.enabled.build.exception_flags=-fexceptions -espinotee.menu.exception.enabled.build.stdcpp_lib=-lstdc++ -espinotee.menu.exception.disabled=Disabled -espinotee.menu.exception.disabled.build.exception_flags=-fno-exceptions -espinotee.menu.exception.disabled.build.stdcpp_lib=-lstdc++-nox -espinotee.upload.resetmethod=nodemcu -espinotee.build.flash_mode=qio -espinotee.build.flash_freq=40 -espinotee.menu.eesz.4M=4M (no SPIFFS) -espinotee.menu.eesz.4M.build.flash_size=4M -espinotee.menu.eesz.4M.build.flash_size_bytes=0x400000 -espinotee.menu.eesz.4M.build.flash_ld=eagle.flash.4m.ld -espinotee.menu.eesz.4M.build.spiffs_pagesize=256 -espinotee.menu.eesz.4M.upload.maximum_size=1044464 -espinotee.menu.eesz.4M.build.rfcal_addr=0x3FC000 -espinotee.menu.eesz.4M1M=4M (1M SPIFFS) -espinotee.menu.eesz.4M1M.build.flash_size=4M -espinotee.menu.eesz.4M1M.build.flash_size_bytes=0x400000 -espinotee.menu.eesz.4M1M.build.flash_ld=eagle.flash.4m1m.ld -espinotee.menu.eesz.4M1M.build.spiffs_pagesize=256 -espinotee.menu.eesz.4M1M.upload.maximum_size=1044464 -espinotee.menu.eesz.4M1M.build.rfcal_addr=0x3FC000 -espinotee.menu.eesz.4M1M.build.spiffs_start=0x300000 -espinotee.menu.eesz.4M1M.build.spiffs_end=0x3FB000 -espinotee.menu.eesz.4M1M.build.spiffs_blocksize=8192 -espinotee.menu.eesz.4M2M=4M (2M SPIFFS) -espinotee.menu.eesz.4M2M.build.flash_size=4M -espinotee.menu.eesz.4M2M.build.flash_size_bytes=0x400000 -espinotee.menu.eesz.4M2M.build.flash_ld=eagle.flash.4m2m.ld -espinotee.menu.eesz.4M2M.build.spiffs_pagesize=256 -espinotee.menu.eesz.4M2M.upload.maximum_size=1044464 -espinotee.menu.eesz.4M2M.build.rfcal_addr=0x3FC000 -espinotee.menu.eesz.4M2M.build.spiffs_start=0x200000 -espinotee.menu.eesz.4M2M.build.spiffs_end=0x3FB000 -espinotee.menu.eesz.4M2M.build.spiffs_blocksize=8192 -espinotee.menu.eesz.4M3M=4M (3M SPIFFS) -espinotee.menu.eesz.4M3M.build.flash_size=4M -espinotee.menu.eesz.4M3M.build.flash_size_bytes=0x400000 -espinotee.menu.eesz.4M3M.build.flash_ld=eagle.flash.4m3m.ld -espinotee.menu.eesz.4M3M.build.spiffs_pagesize=256 -espinotee.menu.eesz.4M3M.upload.maximum_size=1044464 -espinotee.menu.eesz.4M3M.build.rfcal_addr=0x3FC000 -espinotee.menu.eesz.4M3M.build.spiffs_start=0x100000 -espinotee.menu.eesz.4M3M.build.spiffs_end=0x3FB000 -espinotee.menu.eesz.4M3M.build.spiffs_blocksize=8192 -espinotee.menu.ip.lm2f=v2 Lower Memory -espinotee.menu.ip.lm2f.build.lwip_include=lwip2/include -espinotee.menu.ip.lm2f.build.lwip_lib=-llwip2-536-feat -espinotee.menu.ip.lm2f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -espinotee.menu.ip.hb2f=v2 Higher Bandwidth -espinotee.menu.ip.hb2f.build.lwip_include=lwip2/include -espinotee.menu.ip.hb2f.build.lwip_lib=-llwip2-1460-feat -espinotee.menu.ip.hb2f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -espinotee.menu.ip.lm2n=v2 Lower Memory (no features) -espinotee.menu.ip.lm2n.build.lwip_include=lwip2/include -espinotee.menu.ip.lm2n.build.lwip_lib=-llwip2-536 -espinotee.menu.ip.lm2n.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=0 -DLWIP_IPV6=0 -espinotee.menu.ip.hb2n=v2 Higher Bandwidth (no features) -espinotee.menu.ip.hb2n.build.lwip_include=lwip2/include -espinotee.menu.ip.hb2n.build.lwip_lib=-llwip2-1460 -espinotee.menu.ip.hb2n.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=0 -DLWIP_IPV6=0 -espinotee.menu.ip.lm6f=v2 IPv6 Lower Memory -espinotee.menu.ip.lm6f.build.lwip_include=lwip2/include -espinotee.menu.ip.lm6f.build.lwip_lib=-llwip6-536-feat -espinotee.menu.ip.lm6f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=1 -espinotee.menu.ip.hb6f=v2 IPv6 Higher Bandwidth -espinotee.menu.ip.hb6f.build.lwip_include=lwip2/include -espinotee.menu.ip.hb6f.build.lwip_lib=-llwip6-1460-feat -espinotee.menu.ip.hb6f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=1 -DLWIP_IPV6=1 -espinotee.menu.ip.hb1=v1.4 Higher Bandwidth -espinotee.menu.ip.hb1.build.lwip_lib=-llwip_gcc -espinotee.menu.ip.hb1.build.lwip_flags=-DLWIP_OPEN_SRC -espinotee.menu.ip.src=v1.4 Compile from source -espinotee.menu.ip.src.build.lwip_lib=-llwip_src -espinotee.menu.ip.src.build.lwip_flags=-DLWIP_OPEN_SRC -espinotee.menu.ip.src.recipe.hooks.sketch.prebuild.1.pattern=make -C "{runtime.platform.path}/tools/sdk/lwip/src" install TOOLS_PATH="{runtime.tools.xtensa-lx106-elf-gcc.path}/bin/xtensa-lx106-elf-" -espinotee.menu.dbg.Disabled=Disabled -espinotee.menu.dbg.Disabled.build.debug_port= -espinotee.menu.dbg.Serial=Serial -espinotee.menu.dbg.Serial.build.debug_port=-DDEBUG_ESP_PORT=Serial -espinotee.menu.dbg.Serial1=Serial1 -espinotee.menu.dbg.Serial1.build.debug_port=-DDEBUG_ESP_PORT=Serial1 -espinotee.menu.lvl.None____=None -espinotee.menu.lvl.None____.build.debug_level= -espinotee.menu.lvl.SSL=SSL -espinotee.menu.lvl.SSL.build.debug_level= -DDEBUG_ESP_SSL -espinotee.menu.lvl.TLS_MEM=TLS_MEM -espinotee.menu.lvl.TLS_MEM.build.debug_level= -DDEBUG_ESP_TLS_MEM -espinotee.menu.lvl.HTTP_CLIENT=HTTP_CLIENT -espinotee.menu.lvl.HTTP_CLIENT.build.debug_level= -DDEBUG_ESP_HTTP_CLIENT -espinotee.menu.lvl.HTTP_SERVER=HTTP_SERVER -espinotee.menu.lvl.HTTP_SERVER.build.debug_level= -DDEBUG_ESP_HTTP_SERVER -espinotee.menu.lvl.SSLTLS_MEM=SSL+TLS_MEM -espinotee.menu.lvl.SSLTLS_MEM.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -espinotee.menu.lvl.SSLHTTP_CLIENT=SSL+HTTP_CLIENT -espinotee.menu.lvl.SSLHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_CLIENT -espinotee.menu.lvl.SSLHTTP_SERVER=SSL+HTTP_SERVER -espinotee.menu.lvl.SSLHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_SERVER -espinotee.menu.lvl.TLS_MEMHTTP_CLIENT=TLS_MEM+HTTP_CLIENT -espinotee.menu.lvl.TLS_MEMHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -espinotee.menu.lvl.TLS_MEMHTTP_SERVER=TLS_MEM+HTTP_SERVER -espinotee.menu.lvl.TLS_MEMHTTP_SERVER.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_SERVER -espinotee.menu.lvl.HTTP_CLIENTHTTP_SERVER=HTTP_CLIENT+HTTP_SERVER -espinotee.menu.lvl.HTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -espinotee.menu.lvl.SSLTLS_MEMHTTP_CLIENT=SSL+TLS_MEM+HTTP_CLIENT -espinotee.menu.lvl.SSLTLS_MEMHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -espinotee.menu.lvl.SSLTLS_MEMHTTP_SERVER=SSL+TLS_MEM+HTTP_SERVER -espinotee.menu.lvl.SSLTLS_MEMHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_SERVER -espinotee.menu.lvl.SSLHTTP_CLIENTHTTP_SERVER=SSL+HTTP_CLIENT+HTTP_SERVER -espinotee.menu.lvl.SSLHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -espinotee.menu.lvl.TLS_MEMHTTP_CLIENTHTTP_SERVER=TLS_MEM+HTTP_CLIENT+HTTP_SERVER -espinotee.menu.lvl.TLS_MEMHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -espinotee.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVER=SSL+TLS_MEM+HTTP_CLIENT+HTTP_SERVER -espinotee.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -espinotee.menu.lvl.CORE=CORE -espinotee.menu.lvl.CORE.build.debug_level= -DDEBUG_ESP_CORE -espinotee.menu.lvl.WIFI=WIFI -espinotee.menu.lvl.WIFI.build.debug_level= -DDEBUG_ESP_WIFI -espinotee.menu.lvl.HTTP_UPDATE=HTTP_UPDATE -espinotee.menu.lvl.HTTP_UPDATE.build.debug_level= -DDEBUG_ESP_HTTP_UPDATE -espinotee.menu.lvl.UPDATER=UPDATER -espinotee.menu.lvl.UPDATER.build.debug_level= -DDEBUG_ESP_UPDATER -espinotee.menu.lvl.OTA=OTA -espinotee.menu.lvl.OTA.build.debug_level= -DDEBUG_ESP_OTA -espinotee.menu.lvl.OOM=OOM -espinotee.menu.lvl.OOM.build.debug_level= -DDEBUG_ESP_OOM -espinotee.menu.lvl.COREWIFIHTTP_UPDATEUPDATEROTAOOM=CORE+WIFI+HTTP_UPDATE+UPDATER+OTA+OOM -espinotee.menu.lvl.COREWIFIHTTP_UPDATEUPDATEROTAOOM.build.debug_level= -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM -espinotee.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVERCOREWIFIHTTP_UPDATEUPDATEROTAOOM=SSL+TLS_MEM+HTTP_CLIENT+HTTP_SERVER+CORE+WIFI+HTTP_UPDATE+UPDATER+OTA+OOM -espinotee.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVERCOREWIFIHTTP_UPDATEUPDATEROTAOOM.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM -espinotee.menu.lvl.NoAssert-NDEBUG=NoAssert-NDEBUG -espinotee.menu.lvl.NoAssert-NDEBUG.build.debug_level= -DNDEBUG -espinotee.menu.wipe.none=Only Sketch -espinotee.menu.wipe.none.upload.erase_cmd= -espinotee.menu.wipe.sdk=Sketch + WiFi Settings -espinotee.menu.wipe.sdk.upload.erase_cmd=-ca "{build.rfcal_addr}" -cz 0x4000 -espinotee.menu.wipe.all=All Flash Contents -espinotee.menu.wipe.all.upload.erase_cmd=-ca 0x0 -cz "{build.flash_size_bytes}" -espinotee.menu.baud.115200=115200 -espinotee.menu.baud.115200.upload.speed=115200 -espinotee.menu.baud.9600=9600 -espinotee.menu.baud.9600.upload.speed=9600 -espinotee.menu.baud.57600=57600 -espinotee.menu.baud.57600.upload.speed=57600 -espinotee.menu.baud.230400.linux=230400 -espinotee.menu.baud.230400.macosx=230400 -espinotee.menu.baud.230400.upload.speed=230400 -espinotee.menu.baud.256000.windows=256000 -espinotee.menu.baud.256000.upload.speed=256000 -espinotee.menu.baud.460800.linux=460800 -espinotee.menu.baud.460800.macosx=460800 -espinotee.menu.baud.460800.upload.speed=460800 -espinotee.menu.baud.512000.windows=512000 -espinotee.menu.baud.512000.upload.speed=512000 -espinotee.menu.baud.921600=921600 -espinotee.menu.baud.921600.upload.speed=921600 - -############################################################## -wifinfo.name=WifInfo -wifinfo.menu.ESPModule.ESP12.build.board=ESP8266_ESP12 -wifinfo.menu.ESPModule.ESP12.upload.maximum_size=1044464 -wifinfo.menu.ESPModule.ESP12.build.spiffs_pagesize=256 -wifinfo.menu.ESPModule.ESP12.build.flash_ld=eagle.flash.4m1m.ld -wifinfo.menu.ESPModule.ESP07192.build.spiffs_blocksize=4096 -wifinfo.menu.ESPModule.ESP07192.build.spiffs_end=0xFB000 -wifinfo.menu.ESPModule.ESP12=ESP12 (4M/1M SPIFFS) -wifinfo.menu.ESPModule.ESP12.build.spiffs_start=0x300000 -wifinfo.menu.ESPModule.ESP12.build.spiffs_end=0x3FB000 -wifinfo.menu.ESPModule.ESP07192.build.spiffs_start=0xCB000 -wifinfo.menu.ESPModule.ESP07192.build.board=ESP8266_ESP07 -wifinfo.menu.ESPModule.ESP12.build.spiffs_blocksize=8192 -wifinfo.menu.ESPModule.ESP12.build.flash_size=4M -wifinfo.build.board=WIFINFO -wifinfo.build.variant=wifinfo -wifinfo.menu.ESPModule.ESP07192.build.flash_ld=eagle.flash.1m192.ld -wifinfo.menu.ESPModule.ESP07192.build.flash_size=1M -wifinfo.menu.ESPModule.ESP07192=ESP07 (1M/192K SPIFFS) -wifinfo.menu.ESPModule.ESP07192.upload.maximum_size=827376 -wifinfo.upload.tool=esptool -wifinfo.upload.maximum_data_size=81920 -wifinfo.upload.wait_for_upload_port=true -wifinfo.upload.erase_cmd= -wifinfo.serial.disableDTR=true -wifinfo.serial.disableRTS=true -wifinfo.build.mcu=esp8266 -wifinfo.build.core=esp8266 -wifinfo.build.spiffs_pagesize=256 -wifinfo.build.debug_port= -wifinfo.build.debug_level= -wifinfo.menu.xtal.80=80 MHz -wifinfo.menu.xtal.80.build.f_cpu=80000000L -wifinfo.menu.xtal.160=160 MHz -wifinfo.menu.xtal.160.build.f_cpu=160000000L -wifinfo.menu.vt.flash=Flash -wifinfo.menu.vt.flash.build.vtable_flags=-DVTABLES_IN_FLASH -wifinfo.menu.vt.heap=Heap -wifinfo.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM -wifinfo.menu.vt.iram=IRAM -wifinfo.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM -wifinfo.menu.exception.enabled=Enabled -wifinfo.menu.exception.enabled.build.exception_flags=-fexceptions -wifinfo.menu.exception.enabled.build.stdcpp_lib=-lstdc++ -wifinfo.menu.exception.disabled=Disabled -wifinfo.menu.exception.disabled.build.exception_flags=-fno-exceptions -wifinfo.menu.exception.disabled.build.stdcpp_lib=-lstdc++-nox -wifinfo.upload.resetmethod=nodemcu -wifinfo.build.flash_mode=qio -wifinfo.menu.FlashFreq.40=40MHz -wifinfo.menu.FlashFreq.40.build.flash_freq=40 -wifinfo.menu.FlashFreq.80=80MHz -wifinfo.menu.FlashFreq.80.build.flash_freq=80 -wifinfo.menu.eesz.1M=1M (no SPIFFS) -wifinfo.menu.eesz.1M.build.flash_size=1M -wifinfo.menu.eesz.1M.build.flash_size_bytes=0x100000 -wifinfo.menu.eesz.1M.build.flash_ld=eagle.flash.1m.ld -wifinfo.menu.eesz.1M.build.spiffs_pagesize=256 -wifinfo.menu.eesz.1M.upload.maximum_size=1023984 -wifinfo.menu.eesz.1M.build.rfcal_addr=0xFC000 -wifinfo.menu.eesz.1M64=1M (64K SPIFFS) -wifinfo.menu.eesz.1M64.build.flash_size=1M -wifinfo.menu.eesz.1M64.build.flash_size_bytes=0x100000 -wifinfo.menu.eesz.1M64.build.flash_ld=eagle.flash.1m64.ld -wifinfo.menu.eesz.1M64.build.spiffs_pagesize=256 -wifinfo.menu.eesz.1M64.upload.maximum_size=958448 -wifinfo.menu.eesz.1M64.build.rfcal_addr=0xFC000 -wifinfo.menu.eesz.1M64.build.spiffs_start=0xEB000 -wifinfo.menu.eesz.1M64.build.spiffs_end=0xFB000 -wifinfo.menu.eesz.1M64.build.spiffs_blocksize=4096 -wifinfo.menu.eesz.1M128=1M (128K SPIFFS) -wifinfo.menu.eesz.1M128.build.flash_size=1M -wifinfo.menu.eesz.1M128.build.flash_size_bytes=0x100000 -wifinfo.menu.eesz.1M128.build.flash_ld=eagle.flash.1m128.ld -wifinfo.menu.eesz.1M128.build.spiffs_pagesize=256 -wifinfo.menu.eesz.1M128.upload.maximum_size=892912 -wifinfo.menu.eesz.1M128.build.rfcal_addr=0xFC000 -wifinfo.menu.eesz.1M128.build.spiffs_start=0xDB000 -wifinfo.menu.eesz.1M128.build.spiffs_end=0xFB000 -wifinfo.menu.eesz.1M128.build.spiffs_blocksize=4096 -wifinfo.menu.eesz.1M144=1M (144K SPIFFS) -wifinfo.menu.eesz.1M144.build.flash_size=1M -wifinfo.menu.eesz.1M144.build.flash_size_bytes=0x100000 -wifinfo.menu.eesz.1M144.build.flash_ld=eagle.flash.1m144.ld -wifinfo.menu.eesz.1M144.build.spiffs_pagesize=256 -wifinfo.menu.eesz.1M144.upload.maximum_size=876528 -wifinfo.menu.eesz.1M144.build.rfcal_addr=0xFC000 -wifinfo.menu.eesz.1M144.build.spiffs_start=0xD7000 -wifinfo.menu.eesz.1M144.build.spiffs_end=0xFB000 -wifinfo.menu.eesz.1M144.build.spiffs_blocksize=4096 -wifinfo.menu.eesz.1M160=1M (160K SPIFFS) -wifinfo.menu.eesz.1M160.build.flash_size=1M -wifinfo.menu.eesz.1M160.build.flash_size_bytes=0x100000 -wifinfo.menu.eesz.1M160.build.flash_ld=eagle.flash.1m160.ld -wifinfo.menu.eesz.1M160.build.spiffs_pagesize=256 -wifinfo.menu.eesz.1M160.upload.maximum_size=860144 -wifinfo.menu.eesz.1M160.build.rfcal_addr=0xFC000 -wifinfo.menu.eesz.1M160.build.spiffs_start=0xD3000 -wifinfo.menu.eesz.1M160.build.spiffs_end=0xFB000 -wifinfo.menu.eesz.1M160.build.spiffs_blocksize=4096 -wifinfo.menu.eesz.1M192=1M (192K SPIFFS) -wifinfo.menu.eesz.1M192.build.flash_size=1M -wifinfo.menu.eesz.1M192.build.flash_size_bytes=0x100000 -wifinfo.menu.eesz.1M192.build.flash_ld=eagle.flash.1m192.ld -wifinfo.menu.eesz.1M192.build.spiffs_pagesize=256 -wifinfo.menu.eesz.1M192.upload.maximum_size=827376 -wifinfo.menu.eesz.1M192.build.rfcal_addr=0xFC000 -wifinfo.menu.eesz.1M192.build.spiffs_start=0xCB000 -wifinfo.menu.eesz.1M192.build.spiffs_end=0xFB000 -wifinfo.menu.eesz.1M192.build.spiffs_blocksize=4096 -wifinfo.menu.eesz.1M256=1M (256K SPIFFS) -wifinfo.menu.eesz.1M256.build.flash_size=1M -wifinfo.menu.eesz.1M256.build.flash_size_bytes=0x100000 -wifinfo.menu.eesz.1M256.build.flash_ld=eagle.flash.1m256.ld -wifinfo.menu.eesz.1M256.build.spiffs_pagesize=256 -wifinfo.menu.eesz.1M256.upload.maximum_size=761840 -wifinfo.menu.eesz.1M256.build.rfcal_addr=0xFC000 -wifinfo.menu.eesz.1M256.build.spiffs_start=0xBB000 -wifinfo.menu.eesz.1M256.build.spiffs_end=0xFB000 -wifinfo.menu.eesz.1M256.build.spiffs_blocksize=4096 -wifinfo.menu.eesz.1M512=1M (512K SPIFFS) -wifinfo.menu.eesz.1M512.build.flash_size=1M -wifinfo.menu.eesz.1M512.build.flash_size_bytes=0x100000 -wifinfo.menu.eesz.1M512.build.flash_ld=eagle.flash.1m512.ld -wifinfo.menu.eesz.1M512.build.spiffs_pagesize=256 -wifinfo.menu.eesz.1M512.upload.maximum_size=499696 -wifinfo.menu.eesz.1M512.build.rfcal_addr=0xFC000 -wifinfo.menu.eesz.1M512.build.spiffs_start=0x7B000 -wifinfo.menu.eesz.1M512.build.spiffs_end=0xFB000 -wifinfo.menu.eesz.1M512.build.spiffs_blocksize=4096 -wifinfo.menu.ip.lm2f=v2 Lower Memory -wifinfo.menu.ip.lm2f.build.lwip_include=lwip2/include -wifinfo.menu.ip.lm2f.build.lwip_lib=-llwip2-536-feat -wifinfo.menu.ip.lm2f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -wifinfo.menu.ip.hb2f=v2 Higher Bandwidth -wifinfo.menu.ip.hb2f.build.lwip_include=lwip2/include -wifinfo.menu.ip.hb2f.build.lwip_lib=-llwip2-1460-feat -wifinfo.menu.ip.hb2f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -wifinfo.menu.ip.lm2n=v2 Lower Memory (no features) -wifinfo.menu.ip.lm2n.build.lwip_include=lwip2/include -wifinfo.menu.ip.lm2n.build.lwip_lib=-llwip2-536 -wifinfo.menu.ip.lm2n.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=0 -DLWIP_IPV6=0 -wifinfo.menu.ip.hb2n=v2 Higher Bandwidth (no features) -wifinfo.menu.ip.hb2n.build.lwip_include=lwip2/include -wifinfo.menu.ip.hb2n.build.lwip_lib=-llwip2-1460 -wifinfo.menu.ip.hb2n.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=0 -DLWIP_IPV6=0 -wifinfo.menu.ip.lm6f=v2 IPv6 Lower Memory -wifinfo.menu.ip.lm6f.build.lwip_include=lwip2/include -wifinfo.menu.ip.lm6f.build.lwip_lib=-llwip6-536-feat -wifinfo.menu.ip.lm6f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=1 -wifinfo.menu.ip.hb6f=v2 IPv6 Higher Bandwidth -wifinfo.menu.ip.hb6f.build.lwip_include=lwip2/include -wifinfo.menu.ip.hb6f.build.lwip_lib=-llwip6-1460-feat -wifinfo.menu.ip.hb6f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=1 -DLWIP_IPV6=1 -wifinfo.menu.ip.hb1=v1.4 Higher Bandwidth -wifinfo.menu.ip.hb1.build.lwip_lib=-llwip_gcc -wifinfo.menu.ip.hb1.build.lwip_flags=-DLWIP_OPEN_SRC -wifinfo.menu.ip.src=v1.4 Compile from source -wifinfo.menu.ip.src.build.lwip_lib=-llwip_src -wifinfo.menu.ip.src.build.lwip_flags=-DLWIP_OPEN_SRC -wifinfo.menu.ip.src.recipe.hooks.sketch.prebuild.1.pattern=make -C "{runtime.platform.path}/tools/sdk/lwip/src" install TOOLS_PATH="{runtime.tools.xtensa-lx106-elf-gcc.path}/bin/xtensa-lx106-elf-" -wifinfo.menu.dbg.Disabled=Disabled -wifinfo.menu.dbg.Disabled.build.debug_port= -wifinfo.menu.dbg.Serial=Serial -wifinfo.menu.dbg.Serial.build.debug_port=-DDEBUG_ESP_PORT=Serial -wifinfo.menu.dbg.Serial1=Serial1 -wifinfo.menu.dbg.Serial1.build.debug_port=-DDEBUG_ESP_PORT=Serial1 -wifinfo.menu.lvl.None____=None -wifinfo.menu.lvl.None____.build.debug_level= -wifinfo.menu.lvl.SSL=SSL -wifinfo.menu.lvl.SSL.build.debug_level= -DDEBUG_ESP_SSL -wifinfo.menu.lvl.TLS_MEM=TLS_MEM -wifinfo.menu.lvl.TLS_MEM.build.debug_level= -DDEBUG_ESP_TLS_MEM -wifinfo.menu.lvl.HTTP_CLIENT=HTTP_CLIENT -wifinfo.menu.lvl.HTTP_CLIENT.build.debug_level= -DDEBUG_ESP_HTTP_CLIENT -wifinfo.menu.lvl.HTTP_SERVER=HTTP_SERVER -wifinfo.menu.lvl.HTTP_SERVER.build.debug_level= -DDEBUG_ESP_HTTP_SERVER -wifinfo.menu.lvl.SSLTLS_MEM=SSL+TLS_MEM -wifinfo.menu.lvl.SSLTLS_MEM.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -wifinfo.menu.lvl.SSLHTTP_CLIENT=SSL+HTTP_CLIENT -wifinfo.menu.lvl.SSLHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_CLIENT -wifinfo.menu.lvl.SSLHTTP_SERVER=SSL+HTTP_SERVER -wifinfo.menu.lvl.SSLHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_SERVER -wifinfo.menu.lvl.TLS_MEMHTTP_CLIENT=TLS_MEM+HTTP_CLIENT -wifinfo.menu.lvl.TLS_MEMHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -wifinfo.menu.lvl.TLS_MEMHTTP_SERVER=TLS_MEM+HTTP_SERVER -wifinfo.menu.lvl.TLS_MEMHTTP_SERVER.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_SERVER -wifinfo.menu.lvl.HTTP_CLIENTHTTP_SERVER=HTTP_CLIENT+HTTP_SERVER -wifinfo.menu.lvl.HTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -wifinfo.menu.lvl.SSLTLS_MEMHTTP_CLIENT=SSL+TLS_MEM+HTTP_CLIENT -wifinfo.menu.lvl.SSLTLS_MEMHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -wifinfo.menu.lvl.SSLTLS_MEMHTTP_SERVER=SSL+TLS_MEM+HTTP_SERVER -wifinfo.menu.lvl.SSLTLS_MEMHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_SERVER -wifinfo.menu.lvl.SSLHTTP_CLIENTHTTP_SERVER=SSL+HTTP_CLIENT+HTTP_SERVER -wifinfo.menu.lvl.SSLHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -wifinfo.menu.lvl.TLS_MEMHTTP_CLIENTHTTP_SERVER=TLS_MEM+HTTP_CLIENT+HTTP_SERVER -wifinfo.menu.lvl.TLS_MEMHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -wifinfo.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVER=SSL+TLS_MEM+HTTP_CLIENT+HTTP_SERVER -wifinfo.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -wifinfo.menu.lvl.CORE=CORE -wifinfo.menu.lvl.CORE.build.debug_level= -DDEBUG_ESP_CORE -wifinfo.menu.lvl.WIFI=WIFI -wifinfo.menu.lvl.WIFI.build.debug_level= -DDEBUG_ESP_WIFI -wifinfo.menu.lvl.HTTP_UPDATE=HTTP_UPDATE -wifinfo.menu.lvl.HTTP_UPDATE.build.debug_level= -DDEBUG_ESP_HTTP_UPDATE -wifinfo.menu.lvl.UPDATER=UPDATER -wifinfo.menu.lvl.UPDATER.build.debug_level= -DDEBUG_ESP_UPDATER -wifinfo.menu.lvl.OTA=OTA -wifinfo.menu.lvl.OTA.build.debug_level= -DDEBUG_ESP_OTA -wifinfo.menu.lvl.OOM=OOM -wifinfo.menu.lvl.OOM.build.debug_level= -DDEBUG_ESP_OOM -wifinfo.menu.lvl.COREWIFIHTTP_UPDATEUPDATEROTAOOM=CORE+WIFI+HTTP_UPDATE+UPDATER+OTA+OOM -wifinfo.menu.lvl.COREWIFIHTTP_UPDATEUPDATEROTAOOM.build.debug_level= -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM -wifinfo.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVERCOREWIFIHTTP_UPDATEUPDATEROTAOOM=SSL+TLS_MEM+HTTP_CLIENT+HTTP_SERVER+CORE+WIFI+HTTP_UPDATE+UPDATER+OTA+OOM -wifinfo.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVERCOREWIFIHTTP_UPDATEUPDATEROTAOOM.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM -wifinfo.menu.lvl.NoAssert-NDEBUG=NoAssert-NDEBUG -wifinfo.menu.lvl.NoAssert-NDEBUG.build.debug_level= -DNDEBUG -wifinfo.menu.wipe.none=Only Sketch -wifinfo.menu.wipe.none.upload.erase_cmd= -wifinfo.menu.wipe.sdk=Sketch + WiFi Settings -wifinfo.menu.wipe.sdk.upload.erase_cmd=-ca "{build.rfcal_addr}" -cz 0x4000 -wifinfo.menu.wipe.all=All Flash Contents -wifinfo.menu.wipe.all.upload.erase_cmd=-ca 0x0 -cz "{build.flash_size_bytes}" -wifinfo.menu.baud.115200=115200 -wifinfo.menu.baud.115200.upload.speed=115200 -wifinfo.menu.baud.9600=9600 -wifinfo.menu.baud.9600.upload.speed=9600 -wifinfo.menu.baud.57600=57600 -wifinfo.menu.baud.57600.upload.speed=57600 -wifinfo.menu.baud.230400.linux=230400 -wifinfo.menu.baud.230400.macosx=230400 -wifinfo.menu.baud.230400.upload.speed=230400 -wifinfo.menu.baud.256000.windows=256000 -wifinfo.menu.baud.256000.upload.speed=256000 -wifinfo.menu.baud.460800.linux=460800 -wifinfo.menu.baud.460800.macosx=460800 -wifinfo.menu.baud.460800.upload.speed=460800 -wifinfo.menu.baud.512000.windows=512000 -wifinfo.menu.baud.512000.upload.speed=512000 -wifinfo.menu.baud.921600=921600 -wifinfo.menu.baud.921600.upload.speed=921600 - -############################################################## -arduino-esp8266.name=Arduino -arduino-esp8266.menu.BoardModel.starottodeved.build.board=ESP8266_ARDUINO_STAR_OTTO -arduino-esp8266.menu.BoardModel.primo.build.extra_flags=-DF_CRYSTAL=40000000 -DESP8266 -arduino-esp8266.menu.BoardModel.starottodeved.build.extra_flags=-DF_CRYSTAL=40000000 -DESP8266 -arduino-esp8266.menu.BoardModel.starottodeved.build.variant=arduino_uart -arduino-esp8266.menu.BoardModel.unowifideved.build.board=ESP8266_ARDUINO_UNOWIFI -arduino-esp8266.menu.BoardModel.unowifideved.build.extra_flags=-DF_CRYSTAL=40000000 -DESP8266 -arduino-esp8266.menu.BoardModel.primo=Primo -arduino-esp8266.menu.BoardModel.unowifideved.build.variant=arduino_uart -arduino-esp8266.menu.BoardModel.primo.build.variant=arduino_spi -arduino-esp8266.menu.BoardModel.starottodeved=Star OTTO -arduino-esp8266.build.board=ESP8266_ARDUINO -arduino-esp8266.menu.BoardModel.primo.build.board=ESP8266_ARDUINO_PRIMO -arduino-esp8266.menu.BoardModel.unowifideved=Uno WiFi -arduino-esp8266.upload.tool=esptool -arduino-esp8266.upload.maximum_data_size=81920 -arduino-esp8266.upload.wait_for_upload_port=true -arduino-esp8266.upload.erase_cmd= -arduino-esp8266.serial.disableDTR=true -arduino-esp8266.serial.disableRTS=true -arduino-esp8266.build.mcu=esp8266 -arduino-esp8266.build.core=esp8266 -arduino-esp8266.build.variant=generic -arduino-esp8266.build.spiffs_pagesize=256 -arduino-esp8266.build.debug_port= -arduino-esp8266.build.debug_level= -arduino-esp8266.menu.xtal.80=80 MHz -arduino-esp8266.menu.xtal.80.build.f_cpu=80000000L -arduino-esp8266.menu.xtal.160=160 MHz -arduino-esp8266.menu.xtal.160.build.f_cpu=160000000L -arduino-esp8266.menu.vt.flash=Flash -arduino-esp8266.menu.vt.flash.build.vtable_flags=-DVTABLES_IN_FLASH -arduino-esp8266.menu.vt.heap=Heap -arduino-esp8266.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM -arduino-esp8266.menu.vt.iram=IRAM -arduino-esp8266.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM -arduino-esp8266.menu.exception.enabled=Enabled -arduino-esp8266.menu.exception.enabled.build.exception_flags=-fexceptions -arduino-esp8266.menu.exception.enabled.build.stdcpp_lib=-lstdc++ -arduino-esp8266.menu.exception.disabled=Disabled -arduino-esp8266.menu.exception.disabled.build.exception_flags=-fno-exceptions -arduino-esp8266.menu.exception.disabled.build.stdcpp_lib=-lstdc++-nox -arduino-esp8266.upload.resetmethod=ck -arduino-esp8266.build.flash_mode=qio -arduino-esp8266.build.flash_freq=40 -arduino-esp8266.menu.eesz.4M=4M (no SPIFFS) -arduino-esp8266.menu.eesz.4M.build.flash_size=4M -arduino-esp8266.menu.eesz.4M.build.flash_size_bytes=0x400000 -arduino-esp8266.menu.eesz.4M.build.flash_ld=eagle.flash.4m.ld -arduino-esp8266.menu.eesz.4M.build.spiffs_pagesize=256 -arduino-esp8266.menu.eesz.4M.upload.maximum_size=1044464 -arduino-esp8266.menu.eesz.4M.build.rfcal_addr=0x3FC000 -arduino-esp8266.menu.eesz.4M1M=4M (1M SPIFFS) -arduino-esp8266.menu.eesz.4M1M.build.flash_size=4M -arduino-esp8266.menu.eesz.4M1M.build.flash_size_bytes=0x400000 -arduino-esp8266.menu.eesz.4M1M.build.flash_ld=eagle.flash.4m1m.ld -arduino-esp8266.menu.eesz.4M1M.build.spiffs_pagesize=256 -arduino-esp8266.menu.eesz.4M1M.upload.maximum_size=1044464 -arduino-esp8266.menu.eesz.4M1M.build.rfcal_addr=0x3FC000 -arduino-esp8266.menu.eesz.4M1M.build.spiffs_start=0x300000 -arduino-esp8266.menu.eesz.4M1M.build.spiffs_end=0x3FB000 -arduino-esp8266.menu.eesz.4M1M.build.spiffs_blocksize=8192 -arduino-esp8266.menu.eesz.4M2M=4M (2M SPIFFS) -arduino-esp8266.menu.eesz.4M2M.build.flash_size=4M -arduino-esp8266.menu.eesz.4M2M.build.flash_size_bytes=0x400000 -arduino-esp8266.menu.eesz.4M2M.build.flash_ld=eagle.flash.4m2m.ld -arduino-esp8266.menu.eesz.4M2M.build.spiffs_pagesize=256 -arduino-esp8266.menu.eesz.4M2M.upload.maximum_size=1044464 -arduino-esp8266.menu.eesz.4M2M.build.rfcal_addr=0x3FC000 -arduino-esp8266.menu.eesz.4M2M.build.spiffs_start=0x200000 -arduino-esp8266.menu.eesz.4M2M.build.spiffs_end=0x3FB000 -arduino-esp8266.menu.eesz.4M2M.build.spiffs_blocksize=8192 -arduino-esp8266.menu.eesz.4M3M=4M (3M SPIFFS) -arduino-esp8266.menu.eesz.4M3M.build.flash_size=4M -arduino-esp8266.menu.eesz.4M3M.build.flash_size_bytes=0x400000 -arduino-esp8266.menu.eesz.4M3M.build.flash_ld=eagle.flash.4m3m.ld -arduino-esp8266.menu.eesz.4M3M.build.spiffs_pagesize=256 -arduino-esp8266.menu.eesz.4M3M.upload.maximum_size=1044464 -arduino-esp8266.menu.eesz.4M3M.build.rfcal_addr=0x3FC000 -arduino-esp8266.menu.eesz.4M3M.build.spiffs_start=0x100000 -arduino-esp8266.menu.eesz.4M3M.build.spiffs_end=0x3FB000 -arduino-esp8266.menu.eesz.4M3M.build.spiffs_blocksize=8192 -arduino-esp8266.menu.ip.lm2f=v2 Lower Memory -arduino-esp8266.menu.ip.lm2f.build.lwip_include=lwip2/include -arduino-esp8266.menu.ip.lm2f.build.lwip_lib=-llwip2-536-feat -arduino-esp8266.menu.ip.lm2f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -arduino-esp8266.menu.ip.hb2f=v2 Higher Bandwidth -arduino-esp8266.menu.ip.hb2f.build.lwip_include=lwip2/include -arduino-esp8266.menu.ip.hb2f.build.lwip_lib=-llwip2-1460-feat -arduino-esp8266.menu.ip.hb2f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -arduino-esp8266.menu.ip.lm2n=v2 Lower Memory (no features) -arduino-esp8266.menu.ip.lm2n.build.lwip_include=lwip2/include -arduino-esp8266.menu.ip.lm2n.build.lwip_lib=-llwip2-536 -arduino-esp8266.menu.ip.lm2n.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=0 -DLWIP_IPV6=0 -arduino-esp8266.menu.ip.hb2n=v2 Higher Bandwidth (no features) -arduino-esp8266.menu.ip.hb2n.build.lwip_include=lwip2/include -arduino-esp8266.menu.ip.hb2n.build.lwip_lib=-llwip2-1460 -arduino-esp8266.menu.ip.hb2n.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=0 -DLWIP_IPV6=0 -arduino-esp8266.menu.ip.lm6f=v2 IPv6 Lower Memory -arduino-esp8266.menu.ip.lm6f.build.lwip_include=lwip2/include -arduino-esp8266.menu.ip.lm6f.build.lwip_lib=-llwip6-536-feat -arduino-esp8266.menu.ip.lm6f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=1 -arduino-esp8266.menu.ip.hb6f=v2 IPv6 Higher Bandwidth -arduino-esp8266.menu.ip.hb6f.build.lwip_include=lwip2/include -arduino-esp8266.menu.ip.hb6f.build.lwip_lib=-llwip6-1460-feat -arduino-esp8266.menu.ip.hb6f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=1 -DLWIP_IPV6=1 -arduino-esp8266.menu.ip.hb1=v1.4 Higher Bandwidth -arduino-esp8266.menu.ip.hb1.build.lwip_lib=-llwip_gcc -arduino-esp8266.menu.ip.hb1.build.lwip_flags=-DLWIP_OPEN_SRC -arduino-esp8266.menu.ip.src=v1.4 Compile from source -arduino-esp8266.menu.ip.src.build.lwip_lib=-llwip_src -arduino-esp8266.menu.ip.src.build.lwip_flags=-DLWIP_OPEN_SRC -arduino-esp8266.menu.ip.src.recipe.hooks.sketch.prebuild.1.pattern=make -C "{runtime.platform.path}/tools/sdk/lwip/src" install TOOLS_PATH="{runtime.tools.xtensa-lx106-elf-gcc.path}/bin/xtensa-lx106-elf-" -arduino-esp8266.menu.dbg.Disabled=Disabled -arduino-esp8266.menu.dbg.Disabled.build.debug_port= -arduino-esp8266.menu.dbg.Serial=Serial -arduino-esp8266.menu.dbg.Serial.build.debug_port=-DDEBUG_ESP_PORT=Serial -arduino-esp8266.menu.dbg.Serial1=Serial1 -arduino-esp8266.menu.dbg.Serial1.build.debug_port=-DDEBUG_ESP_PORT=Serial1 -arduino-esp8266.menu.lvl.None____=None -arduino-esp8266.menu.lvl.None____.build.debug_level= -arduino-esp8266.menu.lvl.SSL=SSL -arduino-esp8266.menu.lvl.SSL.build.debug_level= -DDEBUG_ESP_SSL -arduino-esp8266.menu.lvl.TLS_MEM=TLS_MEM -arduino-esp8266.menu.lvl.TLS_MEM.build.debug_level= -DDEBUG_ESP_TLS_MEM -arduino-esp8266.menu.lvl.HTTP_CLIENT=HTTP_CLIENT -arduino-esp8266.menu.lvl.HTTP_CLIENT.build.debug_level= -DDEBUG_ESP_HTTP_CLIENT -arduino-esp8266.menu.lvl.HTTP_SERVER=HTTP_SERVER -arduino-esp8266.menu.lvl.HTTP_SERVER.build.debug_level= -DDEBUG_ESP_HTTP_SERVER -arduino-esp8266.menu.lvl.SSLTLS_MEM=SSL+TLS_MEM -arduino-esp8266.menu.lvl.SSLTLS_MEM.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -arduino-esp8266.menu.lvl.SSLHTTP_CLIENT=SSL+HTTP_CLIENT -arduino-esp8266.menu.lvl.SSLHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_CLIENT -arduino-esp8266.menu.lvl.SSLHTTP_SERVER=SSL+HTTP_SERVER -arduino-esp8266.menu.lvl.SSLHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_SERVER -arduino-esp8266.menu.lvl.TLS_MEMHTTP_CLIENT=TLS_MEM+HTTP_CLIENT -arduino-esp8266.menu.lvl.TLS_MEMHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -arduino-esp8266.menu.lvl.TLS_MEMHTTP_SERVER=TLS_MEM+HTTP_SERVER -arduino-esp8266.menu.lvl.TLS_MEMHTTP_SERVER.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_SERVER -arduino-esp8266.menu.lvl.HTTP_CLIENTHTTP_SERVER=HTTP_CLIENT+HTTP_SERVER -arduino-esp8266.menu.lvl.HTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -arduino-esp8266.menu.lvl.SSLTLS_MEMHTTP_CLIENT=SSL+TLS_MEM+HTTP_CLIENT -arduino-esp8266.menu.lvl.SSLTLS_MEMHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -arduino-esp8266.menu.lvl.SSLTLS_MEMHTTP_SERVER=SSL+TLS_MEM+HTTP_SERVER -arduino-esp8266.menu.lvl.SSLTLS_MEMHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_SERVER -arduino-esp8266.menu.lvl.SSLHTTP_CLIENTHTTP_SERVER=SSL+HTTP_CLIENT+HTTP_SERVER -arduino-esp8266.menu.lvl.SSLHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -arduino-esp8266.menu.lvl.TLS_MEMHTTP_CLIENTHTTP_SERVER=TLS_MEM+HTTP_CLIENT+HTTP_SERVER -arduino-esp8266.menu.lvl.TLS_MEMHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -arduino-esp8266.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVER=SSL+TLS_MEM+HTTP_CLIENT+HTTP_SERVER -arduino-esp8266.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -arduino-esp8266.menu.lvl.CORE=CORE -arduino-esp8266.menu.lvl.CORE.build.debug_level= -DDEBUG_ESP_CORE -arduino-esp8266.menu.lvl.WIFI=WIFI -arduino-esp8266.menu.lvl.WIFI.build.debug_level= -DDEBUG_ESP_WIFI -arduino-esp8266.menu.lvl.HTTP_UPDATE=HTTP_UPDATE -arduino-esp8266.menu.lvl.HTTP_UPDATE.build.debug_level= -DDEBUG_ESP_HTTP_UPDATE -arduino-esp8266.menu.lvl.UPDATER=UPDATER -arduino-esp8266.menu.lvl.UPDATER.build.debug_level= -DDEBUG_ESP_UPDATER -arduino-esp8266.menu.lvl.OTA=OTA -arduino-esp8266.menu.lvl.OTA.build.debug_level= -DDEBUG_ESP_OTA -arduino-esp8266.menu.lvl.OOM=OOM -arduino-esp8266.menu.lvl.OOM.build.debug_level= -DDEBUG_ESP_OOM -arduino-esp8266.menu.lvl.COREWIFIHTTP_UPDATEUPDATEROTAOOM=CORE+WIFI+HTTP_UPDATE+UPDATER+OTA+OOM -arduino-esp8266.menu.lvl.COREWIFIHTTP_UPDATEUPDATEROTAOOM.build.debug_level= -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM -arduino-esp8266.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVERCOREWIFIHTTP_UPDATEUPDATEROTAOOM=SSL+TLS_MEM+HTTP_CLIENT+HTTP_SERVER+CORE+WIFI+HTTP_UPDATE+UPDATER+OTA+OOM -arduino-esp8266.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVERCOREWIFIHTTP_UPDATEUPDATEROTAOOM.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM -arduino-esp8266.menu.lvl.NoAssert-NDEBUG=NoAssert-NDEBUG -arduino-esp8266.menu.lvl.NoAssert-NDEBUG.build.debug_level= -DNDEBUG -arduino-esp8266.menu.wipe.none=Only Sketch -arduino-esp8266.menu.wipe.none.upload.erase_cmd= -arduino-esp8266.menu.wipe.sdk=Sketch + WiFi Settings -arduino-esp8266.menu.wipe.sdk.upload.erase_cmd=-ca "{build.rfcal_addr}" -cz 0x4000 -arduino-esp8266.menu.wipe.all=All Flash Contents -arduino-esp8266.menu.wipe.all.upload.erase_cmd=-ca 0x0 -cz "{build.flash_size_bytes}" -arduino-esp8266.menu.baud.115200=115200 -arduino-esp8266.menu.baud.115200.upload.speed=115200 -arduino-esp8266.menu.baud.9600=9600 -arduino-esp8266.menu.baud.9600.upload.speed=9600 -arduino-esp8266.menu.baud.57600=57600 -arduino-esp8266.menu.baud.57600.upload.speed=57600 -arduino-esp8266.menu.baud.230400.linux=230400 -arduino-esp8266.menu.baud.230400.macosx=230400 -arduino-esp8266.menu.baud.230400.upload.speed=230400 -arduino-esp8266.menu.baud.256000.windows=256000 -arduino-esp8266.menu.baud.256000.upload.speed=256000 -arduino-esp8266.menu.baud.460800.linux=460800 -arduino-esp8266.menu.baud.460800.macosx=460800 -arduino-esp8266.menu.baud.460800.upload.speed=460800 -arduino-esp8266.menu.baud.512000.windows=512000 -arduino-esp8266.menu.baud.512000.upload.speed=512000 -arduino-esp8266.menu.baud.921600=921600 -arduino-esp8266.menu.baud.921600.upload.speed=921600 - -############################################################## -gen4iod.name=4D Systems gen4 IoD Range -gen4iod.build.board=GEN4_IOD -gen4iod.build.f_cpu=160000000L -gen4iod.build.variant=generic -gen4iod.upload.tool=esptool -gen4iod.upload.maximum_data_size=81920 -gen4iod.upload.wait_for_upload_port=true -gen4iod.upload.erase_cmd= -gen4iod.serial.disableDTR=true -gen4iod.serial.disableRTS=true -gen4iod.build.mcu=esp8266 -gen4iod.build.core=esp8266 -gen4iod.build.spiffs_pagesize=256 -gen4iod.build.debug_port= -gen4iod.build.debug_level= -gen4iod.menu.xtal.80=80 MHz -gen4iod.menu.xtal.80.build.f_cpu=80000000L -gen4iod.menu.xtal.160=160 MHz -gen4iod.menu.xtal.160.build.f_cpu=160000000L -gen4iod.menu.vt.flash=Flash -gen4iod.menu.vt.flash.build.vtable_flags=-DVTABLES_IN_FLASH -gen4iod.menu.vt.heap=Heap -gen4iod.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM -gen4iod.menu.vt.iram=IRAM -gen4iod.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM -gen4iod.menu.exception.enabled=Enabled -gen4iod.menu.exception.enabled.build.exception_flags=-fexceptions -gen4iod.menu.exception.enabled.build.stdcpp_lib=-lstdc++ -gen4iod.menu.exception.disabled=Disabled -gen4iod.menu.exception.disabled.build.exception_flags=-fno-exceptions -gen4iod.menu.exception.disabled.build.stdcpp_lib=-lstdc++-nox -gen4iod.upload.resetmethod=nodemcu -gen4iod.build.flash_mode=dio -gen4iod.build.flash_freq=80 -gen4iod.menu.eesz.512K=512K (no SPIFFS) -gen4iod.menu.eesz.512K.build.flash_size=512K -gen4iod.menu.eesz.512K.build.flash_size_bytes=0x80000 -gen4iod.menu.eesz.512K.build.flash_ld=eagle.flash.512k.ld -gen4iod.menu.eesz.512K.build.spiffs_pagesize=256 -gen4iod.menu.eesz.512K.upload.maximum_size=499696 -gen4iod.menu.eesz.512K.build.rfcal_addr=0x7C000 -gen4iod.menu.eesz.512K32=512K (32K SPIFFS) -gen4iod.menu.eesz.512K32.build.flash_size=512K -gen4iod.menu.eesz.512K32.build.flash_size_bytes=0x80000 -gen4iod.menu.eesz.512K32.build.flash_ld=eagle.flash.512k32.ld -gen4iod.menu.eesz.512K32.build.spiffs_pagesize=256 -gen4iod.menu.eesz.512K32.upload.maximum_size=466928 -gen4iod.menu.eesz.512K32.build.rfcal_addr=0x7C000 -gen4iod.menu.eesz.512K32.build.spiffs_start=0x73000 -gen4iod.menu.eesz.512K32.build.spiffs_end=0x7B000 -gen4iod.menu.eesz.512K32.build.spiffs_blocksize=4096 -gen4iod.menu.eesz.512K64=512K (64K SPIFFS) -gen4iod.menu.eesz.512K64.build.flash_size=512K -gen4iod.menu.eesz.512K64.build.flash_size_bytes=0x80000 -gen4iod.menu.eesz.512K64.build.flash_ld=eagle.flash.512k64.ld -gen4iod.menu.eesz.512K64.build.spiffs_pagesize=256 -gen4iod.menu.eesz.512K64.upload.maximum_size=434160 -gen4iod.menu.eesz.512K64.build.rfcal_addr=0x7C000 -gen4iod.menu.eesz.512K64.build.spiffs_start=0x6B000 -gen4iod.menu.eesz.512K64.build.spiffs_end=0x7B000 -gen4iod.menu.eesz.512K64.build.spiffs_blocksize=4096 -gen4iod.menu.eesz.512K128=512K (128K SPIFFS) -gen4iod.menu.eesz.512K128.build.flash_size=512K -gen4iod.menu.eesz.512K128.build.flash_size_bytes=0x80000 -gen4iod.menu.eesz.512K128.build.flash_ld=eagle.flash.512k128.ld -gen4iod.menu.eesz.512K128.build.spiffs_pagesize=256 -gen4iod.menu.eesz.512K128.upload.maximum_size=368624 -gen4iod.menu.eesz.512K128.build.rfcal_addr=0x7C000 -gen4iod.menu.eesz.512K128.build.spiffs_start=0x5B000 -gen4iod.menu.eesz.512K128.build.spiffs_end=0x7B000 -gen4iod.menu.eesz.512K128.build.spiffs_blocksize=4096 -gen4iod.menu.ip.lm2f=v2 Lower Memory -gen4iod.menu.ip.lm2f.build.lwip_include=lwip2/include -gen4iod.menu.ip.lm2f.build.lwip_lib=-llwip2-536-feat -gen4iod.menu.ip.lm2f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -gen4iod.menu.ip.hb2f=v2 Higher Bandwidth -gen4iod.menu.ip.hb2f.build.lwip_include=lwip2/include -gen4iod.menu.ip.hb2f.build.lwip_lib=-llwip2-1460-feat -gen4iod.menu.ip.hb2f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -gen4iod.menu.ip.lm2n=v2 Lower Memory (no features) -gen4iod.menu.ip.lm2n.build.lwip_include=lwip2/include -gen4iod.menu.ip.lm2n.build.lwip_lib=-llwip2-536 -gen4iod.menu.ip.lm2n.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=0 -DLWIP_IPV6=0 -gen4iod.menu.ip.hb2n=v2 Higher Bandwidth (no features) -gen4iod.menu.ip.hb2n.build.lwip_include=lwip2/include -gen4iod.menu.ip.hb2n.build.lwip_lib=-llwip2-1460 -gen4iod.menu.ip.hb2n.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=0 -DLWIP_IPV6=0 -gen4iod.menu.ip.lm6f=v2 IPv6 Lower Memory -gen4iod.menu.ip.lm6f.build.lwip_include=lwip2/include -gen4iod.menu.ip.lm6f.build.lwip_lib=-llwip6-536-feat -gen4iod.menu.ip.lm6f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=1 -gen4iod.menu.ip.hb6f=v2 IPv6 Higher Bandwidth -gen4iod.menu.ip.hb6f.build.lwip_include=lwip2/include -gen4iod.menu.ip.hb6f.build.lwip_lib=-llwip6-1460-feat -gen4iod.menu.ip.hb6f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=1 -DLWIP_IPV6=1 -gen4iod.menu.ip.hb1=v1.4 Higher Bandwidth -gen4iod.menu.ip.hb1.build.lwip_lib=-llwip_gcc -gen4iod.menu.ip.hb1.build.lwip_flags=-DLWIP_OPEN_SRC -gen4iod.menu.ip.src=v1.4 Compile from source -gen4iod.menu.ip.src.build.lwip_lib=-llwip_src -gen4iod.menu.ip.src.build.lwip_flags=-DLWIP_OPEN_SRC -gen4iod.menu.ip.src.recipe.hooks.sketch.prebuild.1.pattern=make -C "{runtime.platform.path}/tools/sdk/lwip/src" install TOOLS_PATH="{runtime.tools.xtensa-lx106-elf-gcc.path}/bin/xtensa-lx106-elf-" -gen4iod.menu.dbg.Disabled=Disabled -gen4iod.menu.dbg.Disabled.build.debug_port= -gen4iod.menu.dbg.Serial=Serial -gen4iod.menu.dbg.Serial.build.debug_port=-DDEBUG_ESP_PORT=Serial -gen4iod.menu.dbg.Serial1=Serial1 -gen4iod.menu.dbg.Serial1.build.debug_port=-DDEBUG_ESP_PORT=Serial1 -gen4iod.menu.lvl.None____=None -gen4iod.menu.lvl.None____.build.debug_level= -gen4iod.menu.lvl.SSL=SSL -gen4iod.menu.lvl.SSL.build.debug_level= -DDEBUG_ESP_SSL -gen4iod.menu.lvl.TLS_MEM=TLS_MEM -gen4iod.menu.lvl.TLS_MEM.build.debug_level= -DDEBUG_ESP_TLS_MEM -gen4iod.menu.lvl.HTTP_CLIENT=HTTP_CLIENT -gen4iod.menu.lvl.HTTP_CLIENT.build.debug_level= -DDEBUG_ESP_HTTP_CLIENT -gen4iod.menu.lvl.HTTP_SERVER=HTTP_SERVER -gen4iod.menu.lvl.HTTP_SERVER.build.debug_level= -DDEBUG_ESP_HTTP_SERVER -gen4iod.menu.lvl.SSLTLS_MEM=SSL+TLS_MEM -gen4iod.menu.lvl.SSLTLS_MEM.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -gen4iod.menu.lvl.SSLHTTP_CLIENT=SSL+HTTP_CLIENT -gen4iod.menu.lvl.SSLHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_CLIENT -gen4iod.menu.lvl.SSLHTTP_SERVER=SSL+HTTP_SERVER -gen4iod.menu.lvl.SSLHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_SERVER -gen4iod.menu.lvl.TLS_MEMHTTP_CLIENT=TLS_MEM+HTTP_CLIENT -gen4iod.menu.lvl.TLS_MEMHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -gen4iod.menu.lvl.TLS_MEMHTTP_SERVER=TLS_MEM+HTTP_SERVER -gen4iod.menu.lvl.TLS_MEMHTTP_SERVER.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_SERVER -gen4iod.menu.lvl.HTTP_CLIENTHTTP_SERVER=HTTP_CLIENT+HTTP_SERVER -gen4iod.menu.lvl.HTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -gen4iod.menu.lvl.SSLTLS_MEMHTTP_CLIENT=SSL+TLS_MEM+HTTP_CLIENT -gen4iod.menu.lvl.SSLTLS_MEMHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -gen4iod.menu.lvl.SSLTLS_MEMHTTP_SERVER=SSL+TLS_MEM+HTTP_SERVER -gen4iod.menu.lvl.SSLTLS_MEMHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_SERVER -gen4iod.menu.lvl.SSLHTTP_CLIENTHTTP_SERVER=SSL+HTTP_CLIENT+HTTP_SERVER -gen4iod.menu.lvl.SSLHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -gen4iod.menu.lvl.TLS_MEMHTTP_CLIENTHTTP_SERVER=TLS_MEM+HTTP_CLIENT+HTTP_SERVER -gen4iod.menu.lvl.TLS_MEMHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -gen4iod.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVER=SSL+TLS_MEM+HTTP_CLIENT+HTTP_SERVER -gen4iod.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -gen4iod.menu.lvl.CORE=CORE -gen4iod.menu.lvl.CORE.build.debug_level= -DDEBUG_ESP_CORE -gen4iod.menu.lvl.WIFI=WIFI -gen4iod.menu.lvl.WIFI.build.debug_level= -DDEBUG_ESP_WIFI -gen4iod.menu.lvl.HTTP_UPDATE=HTTP_UPDATE -gen4iod.menu.lvl.HTTP_UPDATE.build.debug_level= -DDEBUG_ESP_HTTP_UPDATE -gen4iod.menu.lvl.UPDATER=UPDATER -gen4iod.menu.lvl.UPDATER.build.debug_level= -DDEBUG_ESP_UPDATER -gen4iod.menu.lvl.OTA=OTA -gen4iod.menu.lvl.OTA.build.debug_level= -DDEBUG_ESP_OTA -gen4iod.menu.lvl.OOM=OOM -gen4iod.menu.lvl.OOM.build.debug_level= -DDEBUG_ESP_OOM -gen4iod.menu.lvl.COREWIFIHTTP_UPDATEUPDATEROTAOOM=CORE+WIFI+HTTP_UPDATE+UPDATER+OTA+OOM -gen4iod.menu.lvl.COREWIFIHTTP_UPDATEUPDATEROTAOOM.build.debug_level= -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM -gen4iod.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVERCOREWIFIHTTP_UPDATEUPDATEROTAOOM=SSL+TLS_MEM+HTTP_CLIENT+HTTP_SERVER+CORE+WIFI+HTTP_UPDATE+UPDATER+OTA+OOM -gen4iod.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVERCOREWIFIHTTP_UPDATEUPDATEROTAOOM.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM -gen4iod.menu.lvl.NoAssert-NDEBUG=NoAssert-NDEBUG -gen4iod.menu.lvl.NoAssert-NDEBUG.build.debug_level= -DNDEBUG -gen4iod.menu.wipe.none=Only Sketch -gen4iod.menu.wipe.none.upload.erase_cmd= -gen4iod.menu.wipe.sdk=Sketch + WiFi Settings -gen4iod.menu.wipe.sdk.upload.erase_cmd=-ca "{build.rfcal_addr}" -cz 0x4000 -gen4iod.menu.wipe.all=All Flash Contents -gen4iod.menu.wipe.all.upload.erase_cmd=-ca 0x0 -cz "{build.flash_size_bytes}" -gen4iod.menu.baud.115200=115200 -gen4iod.menu.baud.115200.upload.speed=115200 -gen4iod.menu.baud.9600=9600 -gen4iod.menu.baud.9600.upload.speed=9600 -gen4iod.menu.baud.57600=57600 -gen4iod.menu.baud.57600.upload.speed=57600 -gen4iod.menu.baud.230400.linux=230400 -gen4iod.menu.baud.230400.macosx=230400 -gen4iod.menu.baud.230400.upload.speed=230400 -gen4iod.menu.baud.256000.windows=256000 -gen4iod.menu.baud.256000.upload.speed=256000 -gen4iod.menu.baud.460800.linux=460800 -gen4iod.menu.baud.460800.macosx=460800 -gen4iod.menu.baud.460800.upload.speed=460800 -gen4iod.menu.baud.512000.windows=512000 -gen4iod.menu.baud.512000.upload.speed=512000 -gen4iod.menu.baud.921600=921600 -gen4iod.menu.baud.921600.upload.speed=921600 - -############################################################## -oak.name=Digistump Oak -oak.build.board=ESP8266_OAK -oak.build.variant=oak -oak.upload.maximum_size=1040368 -oak.upload.tool=esptool -oak.upload.maximum_data_size=81920 -oak.upload.wait_for_upload_port=true -oak.upload.erase_cmd= -oak.serial.disableDTR=true -oak.serial.disableRTS=true -oak.build.mcu=esp8266 -oak.build.core=esp8266 -oak.build.spiffs_pagesize=256 -oak.build.debug_port= -oak.build.debug_level= -oak.menu.xtal.80=80 MHz -oak.menu.xtal.80.build.f_cpu=80000000L -oak.menu.xtal.160=160 MHz -oak.menu.xtal.160.build.f_cpu=160000000L -oak.menu.vt.flash=Flash -oak.menu.vt.flash.build.vtable_flags=-DVTABLES_IN_FLASH -oak.menu.vt.heap=Heap -oak.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM -oak.menu.vt.iram=IRAM -oak.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM -oak.menu.exception.enabled=Enabled -oak.menu.exception.enabled.build.exception_flags=-fexceptions -oak.menu.exception.enabled.build.stdcpp_lib=-lstdc++ -oak.menu.exception.disabled=Disabled -oak.menu.exception.disabled.build.exception_flags=-fno-exceptions -oak.menu.exception.disabled.build.stdcpp_lib=-lstdc++-nox -oak.upload.resetmethod=none -oak.build.flash_mode=dio -oak.build.flash_freq=40 -oak.menu.eesz.4M=4M (no SPIFFS) -oak.menu.eesz.4M.build.flash_size=4M -oak.menu.eesz.4M.build.flash_size_bytes=0x400000 -oak.menu.eesz.4M.build.flash_ld=eagle.flash.4m.ld -oak.menu.eesz.4M.build.spiffs_pagesize=256 -oak.menu.eesz.4M.upload.maximum_size=1044464 -oak.menu.eesz.4M.build.rfcal_addr=0x3FC000 -oak.menu.eesz.4M1M=4M (1M SPIFFS) -oak.menu.eesz.4M1M.build.flash_size=4M -oak.menu.eesz.4M1M.build.flash_size_bytes=0x400000 -oak.menu.eesz.4M1M.build.flash_ld=eagle.flash.4m1m.ld -oak.menu.eesz.4M1M.build.spiffs_pagesize=256 -oak.menu.eesz.4M1M.upload.maximum_size=1044464 -oak.menu.eesz.4M1M.build.rfcal_addr=0x3FC000 -oak.menu.eesz.4M1M.build.spiffs_start=0x300000 -oak.menu.eesz.4M1M.build.spiffs_end=0x3FB000 -oak.menu.eesz.4M1M.build.spiffs_blocksize=8192 -oak.menu.eesz.4M2M=4M (2M SPIFFS) -oak.menu.eesz.4M2M.build.flash_size=4M -oak.menu.eesz.4M2M.build.flash_size_bytes=0x400000 -oak.menu.eesz.4M2M.build.flash_ld=eagle.flash.4m2m.ld -oak.menu.eesz.4M2M.build.spiffs_pagesize=256 -oak.menu.eesz.4M2M.upload.maximum_size=1044464 -oak.menu.eesz.4M2M.build.rfcal_addr=0x3FC000 -oak.menu.eesz.4M2M.build.spiffs_start=0x200000 -oak.menu.eesz.4M2M.build.spiffs_end=0x3FB000 -oak.menu.eesz.4M2M.build.spiffs_blocksize=8192 -oak.menu.eesz.4M3M=4M (3M SPIFFS) -oak.menu.eesz.4M3M.build.flash_size=4M -oak.menu.eesz.4M3M.build.flash_size_bytes=0x400000 -oak.menu.eesz.4M3M.build.flash_ld=eagle.flash.4m3m.ld -oak.menu.eesz.4M3M.build.spiffs_pagesize=256 -oak.menu.eesz.4M3M.upload.maximum_size=1044464 -oak.menu.eesz.4M3M.build.rfcal_addr=0x3FC000 -oak.menu.eesz.4M3M.build.spiffs_start=0x100000 -oak.menu.eesz.4M3M.build.spiffs_end=0x3FB000 -oak.menu.eesz.4M3M.build.spiffs_blocksize=8192 -oak.menu.ip.lm2f=v2 Lower Memory -oak.menu.ip.lm2f.build.lwip_include=lwip2/include -oak.menu.ip.lm2f.build.lwip_lib=-llwip2-536-feat -oak.menu.ip.lm2f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -oak.menu.ip.hb2f=v2 Higher Bandwidth -oak.menu.ip.hb2f.build.lwip_include=lwip2/include -oak.menu.ip.hb2f.build.lwip_lib=-llwip2-1460-feat -oak.menu.ip.hb2f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -oak.menu.ip.lm2n=v2 Lower Memory (no features) -oak.menu.ip.lm2n.build.lwip_include=lwip2/include -oak.menu.ip.lm2n.build.lwip_lib=-llwip2-536 -oak.menu.ip.lm2n.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=0 -DLWIP_IPV6=0 -oak.menu.ip.hb2n=v2 Higher Bandwidth (no features) -oak.menu.ip.hb2n.build.lwip_include=lwip2/include -oak.menu.ip.hb2n.build.lwip_lib=-llwip2-1460 -oak.menu.ip.hb2n.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=0 -DLWIP_IPV6=0 -oak.menu.ip.lm6f=v2 IPv6 Lower Memory -oak.menu.ip.lm6f.build.lwip_include=lwip2/include -oak.menu.ip.lm6f.build.lwip_lib=-llwip6-536-feat -oak.menu.ip.lm6f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=1 -oak.menu.ip.hb6f=v2 IPv6 Higher Bandwidth -oak.menu.ip.hb6f.build.lwip_include=lwip2/include -oak.menu.ip.hb6f.build.lwip_lib=-llwip6-1460-feat -oak.menu.ip.hb6f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=1 -DLWIP_IPV6=1 -oak.menu.ip.hb1=v1.4 Higher Bandwidth -oak.menu.ip.hb1.build.lwip_lib=-llwip_gcc -oak.menu.ip.hb1.build.lwip_flags=-DLWIP_OPEN_SRC -oak.menu.ip.src=v1.4 Compile from source -oak.menu.ip.src.build.lwip_lib=-llwip_src -oak.menu.ip.src.build.lwip_flags=-DLWIP_OPEN_SRC -oak.menu.ip.src.recipe.hooks.sketch.prebuild.1.pattern=make -C "{runtime.platform.path}/tools/sdk/lwip/src" install TOOLS_PATH="{runtime.tools.xtensa-lx106-elf-gcc.path}/bin/xtensa-lx106-elf-" -oak.menu.dbg.Disabled=Disabled -oak.menu.dbg.Disabled.build.debug_port= -oak.menu.dbg.Serial=Serial -oak.menu.dbg.Serial.build.debug_port=-DDEBUG_ESP_PORT=Serial -oak.menu.dbg.Serial1=Serial1 -oak.menu.dbg.Serial1.build.debug_port=-DDEBUG_ESP_PORT=Serial1 -oak.menu.lvl.None____=None -oak.menu.lvl.None____.build.debug_level= -oak.menu.lvl.SSL=SSL -oak.menu.lvl.SSL.build.debug_level= -DDEBUG_ESP_SSL -oak.menu.lvl.TLS_MEM=TLS_MEM -oak.menu.lvl.TLS_MEM.build.debug_level= -DDEBUG_ESP_TLS_MEM -oak.menu.lvl.HTTP_CLIENT=HTTP_CLIENT -oak.menu.lvl.HTTP_CLIENT.build.debug_level= -DDEBUG_ESP_HTTP_CLIENT -oak.menu.lvl.HTTP_SERVER=HTTP_SERVER -oak.menu.lvl.HTTP_SERVER.build.debug_level= -DDEBUG_ESP_HTTP_SERVER -oak.menu.lvl.SSLTLS_MEM=SSL+TLS_MEM -oak.menu.lvl.SSLTLS_MEM.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -oak.menu.lvl.SSLHTTP_CLIENT=SSL+HTTP_CLIENT -oak.menu.lvl.SSLHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_CLIENT -oak.menu.lvl.SSLHTTP_SERVER=SSL+HTTP_SERVER -oak.menu.lvl.SSLHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_SERVER -oak.menu.lvl.TLS_MEMHTTP_CLIENT=TLS_MEM+HTTP_CLIENT -oak.menu.lvl.TLS_MEMHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -oak.menu.lvl.TLS_MEMHTTP_SERVER=TLS_MEM+HTTP_SERVER -oak.menu.lvl.TLS_MEMHTTP_SERVER.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_SERVER -oak.menu.lvl.HTTP_CLIENTHTTP_SERVER=HTTP_CLIENT+HTTP_SERVER -oak.menu.lvl.HTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -oak.menu.lvl.SSLTLS_MEMHTTP_CLIENT=SSL+TLS_MEM+HTTP_CLIENT -oak.menu.lvl.SSLTLS_MEMHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -oak.menu.lvl.SSLTLS_MEMHTTP_SERVER=SSL+TLS_MEM+HTTP_SERVER -oak.menu.lvl.SSLTLS_MEMHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_SERVER -oak.menu.lvl.SSLHTTP_CLIENTHTTP_SERVER=SSL+HTTP_CLIENT+HTTP_SERVER -oak.menu.lvl.SSLHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -oak.menu.lvl.TLS_MEMHTTP_CLIENTHTTP_SERVER=TLS_MEM+HTTP_CLIENT+HTTP_SERVER -oak.menu.lvl.TLS_MEMHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -oak.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVER=SSL+TLS_MEM+HTTP_CLIENT+HTTP_SERVER -oak.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -oak.menu.lvl.CORE=CORE -oak.menu.lvl.CORE.build.debug_level= -DDEBUG_ESP_CORE -oak.menu.lvl.WIFI=WIFI -oak.menu.lvl.WIFI.build.debug_level= -DDEBUG_ESP_WIFI -oak.menu.lvl.HTTP_UPDATE=HTTP_UPDATE -oak.menu.lvl.HTTP_UPDATE.build.debug_level= -DDEBUG_ESP_HTTP_UPDATE -oak.menu.lvl.UPDATER=UPDATER -oak.menu.lvl.UPDATER.build.debug_level= -DDEBUG_ESP_UPDATER -oak.menu.lvl.OTA=OTA -oak.menu.lvl.OTA.build.debug_level= -DDEBUG_ESP_OTA -oak.menu.lvl.OOM=OOM -oak.menu.lvl.OOM.build.debug_level= -DDEBUG_ESP_OOM -oak.menu.lvl.COREWIFIHTTP_UPDATEUPDATEROTAOOM=CORE+WIFI+HTTP_UPDATE+UPDATER+OTA+OOM -oak.menu.lvl.COREWIFIHTTP_UPDATEUPDATEROTAOOM.build.debug_level= -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM -oak.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVERCOREWIFIHTTP_UPDATEUPDATEROTAOOM=SSL+TLS_MEM+HTTP_CLIENT+HTTP_SERVER+CORE+WIFI+HTTP_UPDATE+UPDATER+OTA+OOM -oak.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVERCOREWIFIHTTP_UPDATEUPDATEROTAOOM.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM -oak.menu.lvl.NoAssert-NDEBUG=NoAssert-NDEBUG -oak.menu.lvl.NoAssert-NDEBUG.build.debug_level= -DNDEBUG -oak.menu.wipe.none=Only Sketch -oak.menu.wipe.none.upload.erase_cmd= -oak.menu.wipe.sdk=Sketch + WiFi Settings -oak.menu.wipe.sdk.upload.erase_cmd=-ca "{build.rfcal_addr}" -cz 0x4000 -oak.menu.wipe.all=All Flash Contents -oak.menu.wipe.all.upload.erase_cmd=-ca 0x0 -cz "{build.flash_size_bytes}" -oak.menu.baud.921600=921600 -oak.menu.baud.921600.upload.speed=921600 -oak.menu.baud.9600=9600 -oak.menu.baud.9600.upload.speed=9600 -oak.menu.baud.57600=57600 -oak.menu.baud.57600.upload.speed=57600 -oak.menu.baud.115200=115200 -oak.menu.baud.115200.upload.speed=115200 -oak.menu.baud.230400.linux=230400 -oak.menu.baud.230400.macosx=230400 -oak.menu.baud.230400.upload.speed=230400 -oak.menu.baud.256000.windows=256000 -oak.menu.baud.256000.upload.speed=256000 -oak.menu.baud.460800.linux=460800 -oak.menu.baud.460800.macosx=460800 -oak.menu.baud.460800.upload.speed=460800 -oak.menu.baud.512000.windows=512000 -oak.menu.baud.512000.upload.speed=512000 - -############################################################## -wifiduino.name=WiFiduino -wifiduino.build.board=WIFIDUINO_ESP8266 -wifiduino.build.variant=wifiduino -wifiduino.upload.tool=esptool -wifiduino.upload.maximum_data_size=81920 -wifiduino.upload.wait_for_upload_port=true -wifiduino.upload.erase_cmd= -wifiduino.serial.disableDTR=true -wifiduino.serial.disableRTS=true -wifiduino.build.mcu=esp8266 -wifiduino.build.core=esp8266 -wifiduino.build.spiffs_pagesize=256 -wifiduino.build.debug_port= -wifiduino.build.debug_level= -wifiduino.menu.xtal.80=80 MHz -wifiduino.menu.xtal.80.build.f_cpu=80000000L -wifiduino.menu.xtal.160=160 MHz -wifiduino.menu.xtal.160.build.f_cpu=160000000L -wifiduino.menu.vt.flash=Flash -wifiduino.menu.vt.flash.build.vtable_flags=-DVTABLES_IN_FLASH -wifiduino.menu.vt.heap=Heap -wifiduino.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM -wifiduino.menu.vt.iram=IRAM -wifiduino.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM -wifiduino.menu.exception.enabled=Enabled -wifiduino.menu.exception.enabled.build.exception_flags=-fexceptions -wifiduino.menu.exception.enabled.build.stdcpp_lib=-lstdc++ -wifiduino.menu.exception.disabled=Disabled -wifiduino.menu.exception.disabled.build.exception_flags=-fno-exceptions -wifiduino.menu.exception.disabled.build.stdcpp_lib=-lstdc++-nox -wifiduino.upload.resetmethod=nodemcu -wifiduino.build.flash_mode=dio -wifiduino.build.flash_freq=40 -wifiduino.menu.eesz.4M=4M (no SPIFFS) -wifiduino.menu.eesz.4M.build.flash_size=4M -wifiduino.menu.eesz.4M.build.flash_size_bytes=0x400000 -wifiduino.menu.eesz.4M.build.flash_ld=eagle.flash.4m.ld -wifiduino.menu.eesz.4M.build.spiffs_pagesize=256 -wifiduino.menu.eesz.4M.upload.maximum_size=1044464 -wifiduino.menu.eesz.4M.build.rfcal_addr=0x3FC000 -wifiduino.menu.eesz.4M1M=4M (1M SPIFFS) -wifiduino.menu.eesz.4M1M.build.flash_size=4M -wifiduino.menu.eesz.4M1M.build.flash_size_bytes=0x400000 -wifiduino.menu.eesz.4M1M.build.flash_ld=eagle.flash.4m1m.ld -wifiduino.menu.eesz.4M1M.build.spiffs_pagesize=256 -wifiduino.menu.eesz.4M1M.upload.maximum_size=1044464 -wifiduino.menu.eesz.4M1M.build.rfcal_addr=0x3FC000 -wifiduino.menu.eesz.4M1M.build.spiffs_start=0x300000 -wifiduino.menu.eesz.4M1M.build.spiffs_end=0x3FB000 -wifiduino.menu.eesz.4M1M.build.spiffs_blocksize=8192 -wifiduino.menu.eesz.4M2M=4M (2M SPIFFS) -wifiduino.menu.eesz.4M2M.build.flash_size=4M -wifiduino.menu.eesz.4M2M.build.flash_size_bytes=0x400000 -wifiduino.menu.eesz.4M2M.build.flash_ld=eagle.flash.4m2m.ld -wifiduino.menu.eesz.4M2M.build.spiffs_pagesize=256 -wifiduino.menu.eesz.4M2M.upload.maximum_size=1044464 -wifiduino.menu.eesz.4M2M.build.rfcal_addr=0x3FC000 -wifiduino.menu.eesz.4M2M.build.spiffs_start=0x200000 -wifiduino.menu.eesz.4M2M.build.spiffs_end=0x3FB000 -wifiduino.menu.eesz.4M2M.build.spiffs_blocksize=8192 -wifiduino.menu.eesz.4M3M=4M (3M SPIFFS) -wifiduino.menu.eesz.4M3M.build.flash_size=4M -wifiduino.menu.eesz.4M3M.build.flash_size_bytes=0x400000 -wifiduino.menu.eesz.4M3M.build.flash_ld=eagle.flash.4m3m.ld -wifiduino.menu.eesz.4M3M.build.spiffs_pagesize=256 -wifiduino.menu.eesz.4M3M.upload.maximum_size=1044464 -wifiduino.menu.eesz.4M3M.build.rfcal_addr=0x3FC000 -wifiduino.menu.eesz.4M3M.build.spiffs_start=0x100000 -wifiduino.menu.eesz.4M3M.build.spiffs_end=0x3FB000 -wifiduino.menu.eesz.4M3M.build.spiffs_blocksize=8192 -wifiduino.menu.ip.lm2f=v2 Lower Memory -wifiduino.menu.ip.lm2f.build.lwip_include=lwip2/include -wifiduino.menu.ip.lm2f.build.lwip_lib=-llwip2-536-feat -wifiduino.menu.ip.lm2f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -wifiduino.menu.ip.hb2f=v2 Higher Bandwidth -wifiduino.menu.ip.hb2f.build.lwip_include=lwip2/include -wifiduino.menu.ip.hb2f.build.lwip_lib=-llwip2-1460-feat -wifiduino.menu.ip.hb2f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -wifiduino.menu.ip.lm2n=v2 Lower Memory (no features) -wifiduino.menu.ip.lm2n.build.lwip_include=lwip2/include -wifiduino.menu.ip.lm2n.build.lwip_lib=-llwip2-536 -wifiduino.menu.ip.lm2n.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=0 -DLWIP_IPV6=0 -wifiduino.menu.ip.hb2n=v2 Higher Bandwidth (no features) -wifiduino.menu.ip.hb2n.build.lwip_include=lwip2/include -wifiduino.menu.ip.hb2n.build.lwip_lib=-llwip2-1460 -wifiduino.menu.ip.hb2n.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=0 -DLWIP_IPV6=0 -wifiduino.menu.ip.lm6f=v2 IPv6 Lower Memory -wifiduino.menu.ip.lm6f.build.lwip_include=lwip2/include -wifiduino.menu.ip.lm6f.build.lwip_lib=-llwip6-536-feat -wifiduino.menu.ip.lm6f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=1 -wifiduino.menu.ip.hb6f=v2 IPv6 Higher Bandwidth -wifiduino.menu.ip.hb6f.build.lwip_include=lwip2/include -wifiduino.menu.ip.hb6f.build.lwip_lib=-llwip6-1460-feat -wifiduino.menu.ip.hb6f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=1 -DLWIP_IPV6=1 -wifiduino.menu.ip.hb1=v1.4 Higher Bandwidth -wifiduino.menu.ip.hb1.build.lwip_lib=-llwip_gcc -wifiduino.menu.ip.hb1.build.lwip_flags=-DLWIP_OPEN_SRC -wifiduino.menu.ip.src=v1.4 Compile from source -wifiduino.menu.ip.src.build.lwip_lib=-llwip_src -wifiduino.menu.ip.src.build.lwip_flags=-DLWIP_OPEN_SRC -wifiduino.menu.ip.src.recipe.hooks.sketch.prebuild.1.pattern=make -C "{runtime.platform.path}/tools/sdk/lwip/src" install TOOLS_PATH="{runtime.tools.xtensa-lx106-elf-gcc.path}/bin/xtensa-lx106-elf-" -wifiduino.menu.dbg.Disabled=Disabled -wifiduino.menu.dbg.Disabled.build.debug_port= -wifiduino.menu.dbg.Serial=Serial -wifiduino.menu.dbg.Serial.build.debug_port=-DDEBUG_ESP_PORT=Serial -wifiduino.menu.dbg.Serial1=Serial1 -wifiduino.menu.dbg.Serial1.build.debug_port=-DDEBUG_ESP_PORT=Serial1 -wifiduino.menu.lvl.None____=None -wifiduino.menu.lvl.None____.build.debug_level= -wifiduino.menu.lvl.SSL=SSL -wifiduino.menu.lvl.SSL.build.debug_level= -DDEBUG_ESP_SSL -wifiduino.menu.lvl.TLS_MEM=TLS_MEM -wifiduino.menu.lvl.TLS_MEM.build.debug_level= -DDEBUG_ESP_TLS_MEM -wifiduino.menu.lvl.HTTP_CLIENT=HTTP_CLIENT -wifiduino.menu.lvl.HTTP_CLIENT.build.debug_level= -DDEBUG_ESP_HTTP_CLIENT -wifiduino.menu.lvl.HTTP_SERVER=HTTP_SERVER -wifiduino.menu.lvl.HTTP_SERVER.build.debug_level= -DDEBUG_ESP_HTTP_SERVER -wifiduino.menu.lvl.SSLTLS_MEM=SSL+TLS_MEM -wifiduino.menu.lvl.SSLTLS_MEM.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -wifiduino.menu.lvl.SSLHTTP_CLIENT=SSL+HTTP_CLIENT -wifiduino.menu.lvl.SSLHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_CLIENT -wifiduino.menu.lvl.SSLHTTP_SERVER=SSL+HTTP_SERVER -wifiduino.menu.lvl.SSLHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_SERVER -wifiduino.menu.lvl.TLS_MEMHTTP_CLIENT=TLS_MEM+HTTP_CLIENT -wifiduino.menu.lvl.TLS_MEMHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -wifiduino.menu.lvl.TLS_MEMHTTP_SERVER=TLS_MEM+HTTP_SERVER -wifiduino.menu.lvl.TLS_MEMHTTP_SERVER.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_SERVER -wifiduino.menu.lvl.HTTP_CLIENTHTTP_SERVER=HTTP_CLIENT+HTTP_SERVER -wifiduino.menu.lvl.HTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -wifiduino.menu.lvl.SSLTLS_MEMHTTP_CLIENT=SSL+TLS_MEM+HTTP_CLIENT -wifiduino.menu.lvl.SSLTLS_MEMHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -wifiduino.menu.lvl.SSLTLS_MEMHTTP_SERVER=SSL+TLS_MEM+HTTP_SERVER -wifiduino.menu.lvl.SSLTLS_MEMHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_SERVER -wifiduino.menu.lvl.SSLHTTP_CLIENTHTTP_SERVER=SSL+HTTP_CLIENT+HTTP_SERVER -wifiduino.menu.lvl.SSLHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -wifiduino.menu.lvl.TLS_MEMHTTP_CLIENTHTTP_SERVER=TLS_MEM+HTTP_CLIENT+HTTP_SERVER -wifiduino.menu.lvl.TLS_MEMHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -wifiduino.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVER=SSL+TLS_MEM+HTTP_CLIENT+HTTP_SERVER -wifiduino.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -wifiduino.menu.lvl.CORE=CORE -wifiduino.menu.lvl.CORE.build.debug_level= -DDEBUG_ESP_CORE -wifiduino.menu.lvl.WIFI=WIFI -wifiduino.menu.lvl.WIFI.build.debug_level= -DDEBUG_ESP_WIFI -wifiduino.menu.lvl.HTTP_UPDATE=HTTP_UPDATE -wifiduino.menu.lvl.HTTP_UPDATE.build.debug_level= -DDEBUG_ESP_HTTP_UPDATE -wifiduino.menu.lvl.UPDATER=UPDATER -wifiduino.menu.lvl.UPDATER.build.debug_level= -DDEBUG_ESP_UPDATER -wifiduino.menu.lvl.OTA=OTA -wifiduino.menu.lvl.OTA.build.debug_level= -DDEBUG_ESP_OTA -wifiduino.menu.lvl.OOM=OOM -wifiduino.menu.lvl.OOM.build.debug_level= -DDEBUG_ESP_OOM -wifiduino.menu.lvl.COREWIFIHTTP_UPDATEUPDATEROTAOOM=CORE+WIFI+HTTP_UPDATE+UPDATER+OTA+OOM -wifiduino.menu.lvl.COREWIFIHTTP_UPDATEUPDATEROTAOOM.build.debug_level= -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM -wifiduino.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVERCOREWIFIHTTP_UPDATEUPDATEROTAOOM=SSL+TLS_MEM+HTTP_CLIENT+HTTP_SERVER+CORE+WIFI+HTTP_UPDATE+UPDATER+OTA+OOM -wifiduino.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVERCOREWIFIHTTP_UPDATEUPDATEROTAOOM.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM -wifiduino.menu.lvl.NoAssert-NDEBUG=NoAssert-NDEBUG -wifiduino.menu.lvl.NoAssert-NDEBUG.build.debug_level= -DNDEBUG -wifiduino.menu.wipe.none=Only Sketch -wifiduino.menu.wipe.none.upload.erase_cmd= -wifiduino.menu.wipe.sdk=Sketch + WiFi Settings -wifiduino.menu.wipe.sdk.upload.erase_cmd=-ca "{build.rfcal_addr}" -cz 0x4000 -wifiduino.menu.wipe.all=All Flash Contents -wifiduino.menu.wipe.all.upload.erase_cmd=-ca 0x0 -cz "{build.flash_size_bytes}" -wifiduino.menu.baud.921600=921600 -wifiduino.menu.baud.921600.upload.speed=921600 -wifiduino.menu.baud.9600=9600 -wifiduino.menu.baud.9600.upload.speed=9600 -wifiduino.menu.baud.57600=57600 -wifiduino.menu.baud.57600.upload.speed=57600 -wifiduino.menu.baud.115200=115200 -wifiduino.menu.baud.115200.upload.speed=115200 -wifiduino.menu.baud.230400.linux=230400 -wifiduino.menu.baud.230400.macosx=230400 -wifiduino.menu.baud.230400.upload.speed=230400 -wifiduino.menu.baud.256000.windows=256000 -wifiduino.menu.baud.256000.upload.speed=256000 -wifiduino.menu.baud.460800.linux=460800 -wifiduino.menu.baud.460800.macosx=460800 -wifiduino.menu.baud.460800.upload.speed=460800 -wifiduino.menu.baud.512000.windows=512000 -wifiduino.menu.baud.512000.upload.speed=512000 - -############################################################## -wifi_slot.name=Amperka WiFi Slot -wifi_slot.build.board=AMPERKA_WIFI_SLOT -wifi_slot.build.variant=wifi_slot -wifi_slot.upload.tool=esptool -wifi_slot.upload.maximum_data_size=81920 -wifi_slot.upload.wait_for_upload_port=true -wifi_slot.upload.erase_cmd= -wifi_slot.serial.disableDTR=true -wifi_slot.serial.disableRTS=true -wifi_slot.build.mcu=esp8266 -wifi_slot.build.core=esp8266 -wifi_slot.build.spiffs_pagesize=256 -wifi_slot.build.debug_port= -wifi_slot.build.debug_level= -wifi_slot.menu.xtal.80=80 MHz -wifi_slot.menu.xtal.80.build.f_cpu=80000000L -wifi_slot.menu.xtal.160=160 MHz -wifi_slot.menu.xtal.160.build.f_cpu=160000000L -wifi_slot.menu.vt.flash=Flash -wifi_slot.menu.vt.flash.build.vtable_flags=-DVTABLES_IN_FLASH -wifi_slot.menu.vt.heap=Heap -wifi_slot.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM -wifi_slot.menu.vt.iram=IRAM -wifi_slot.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM -wifi_slot.menu.exception.enabled=Enabled -wifi_slot.menu.exception.enabled.build.exception_flags=-fexceptions -wifi_slot.menu.exception.enabled.build.stdcpp_lib=-lstdc++ -wifi_slot.menu.exception.disabled=Disabled -wifi_slot.menu.exception.disabled.build.exception_flags=-fno-exceptions -wifi_slot.menu.exception.disabled.build.stdcpp_lib=-lstdc++-nox -wifi_slot.upload.resetmethod=nodemcu -wifi_slot.menu.FlashFreq.40=40MHz -wifi_slot.menu.FlashFreq.40.build.flash_freq=40 -wifi_slot.menu.FlashFreq.80=80MHz -wifi_slot.menu.FlashFreq.80.build.flash_freq=80 -wifi_slot.menu.FlashMode.qio=QIO -wifi_slot.menu.FlashMode.qio.build.flash_mode=qio -wifi_slot.menu.FlashMode.qout=QOUT -wifi_slot.menu.FlashMode.qout.build.flash_mode=qout -wifi_slot.menu.FlashMode.dio=DIO -wifi_slot.menu.FlashMode.dio.build.flash_mode=dio -wifi_slot.menu.FlashMode.dout=DOUT -wifi_slot.menu.FlashMode.dout.build.flash_mode=dout -wifi_slot.menu.eesz.1M=1M (no SPIFFS) -wifi_slot.menu.eesz.1M.build.flash_size=1M -wifi_slot.menu.eesz.1M.build.flash_size_bytes=0x100000 -wifi_slot.menu.eesz.1M.build.flash_ld=eagle.flash.1m.ld -wifi_slot.menu.eesz.1M.build.spiffs_pagesize=256 -wifi_slot.menu.eesz.1M.upload.maximum_size=1023984 -wifi_slot.menu.eesz.1M.build.rfcal_addr=0xFC000 -wifi_slot.menu.eesz.1M64=1M (64K SPIFFS) -wifi_slot.menu.eesz.1M64.build.flash_size=1M -wifi_slot.menu.eesz.1M64.build.flash_size_bytes=0x100000 -wifi_slot.menu.eesz.1M64.build.flash_ld=eagle.flash.1m64.ld -wifi_slot.menu.eesz.1M64.build.spiffs_pagesize=256 -wifi_slot.menu.eesz.1M64.upload.maximum_size=958448 -wifi_slot.menu.eesz.1M64.build.rfcal_addr=0xFC000 -wifi_slot.menu.eesz.1M64.build.spiffs_start=0xEB000 -wifi_slot.menu.eesz.1M64.build.spiffs_end=0xFB000 -wifi_slot.menu.eesz.1M64.build.spiffs_blocksize=4096 -wifi_slot.menu.eesz.1M128=1M (128K SPIFFS) -wifi_slot.menu.eesz.1M128.build.flash_size=1M -wifi_slot.menu.eesz.1M128.build.flash_size_bytes=0x100000 -wifi_slot.menu.eesz.1M128.build.flash_ld=eagle.flash.1m128.ld -wifi_slot.menu.eesz.1M128.build.spiffs_pagesize=256 -wifi_slot.menu.eesz.1M128.upload.maximum_size=892912 -wifi_slot.menu.eesz.1M128.build.rfcal_addr=0xFC000 -wifi_slot.menu.eesz.1M128.build.spiffs_start=0xDB000 -wifi_slot.menu.eesz.1M128.build.spiffs_end=0xFB000 -wifi_slot.menu.eesz.1M128.build.spiffs_blocksize=4096 -wifi_slot.menu.eesz.1M144=1M (144K SPIFFS) -wifi_slot.menu.eesz.1M144.build.flash_size=1M -wifi_slot.menu.eesz.1M144.build.flash_size_bytes=0x100000 -wifi_slot.menu.eesz.1M144.build.flash_ld=eagle.flash.1m144.ld -wifi_slot.menu.eesz.1M144.build.spiffs_pagesize=256 -wifi_slot.menu.eesz.1M144.upload.maximum_size=876528 -wifi_slot.menu.eesz.1M144.build.rfcal_addr=0xFC000 -wifi_slot.menu.eesz.1M144.build.spiffs_start=0xD7000 -wifi_slot.menu.eesz.1M144.build.spiffs_end=0xFB000 -wifi_slot.menu.eesz.1M144.build.spiffs_blocksize=4096 -wifi_slot.menu.eesz.1M160=1M (160K SPIFFS) -wifi_slot.menu.eesz.1M160.build.flash_size=1M -wifi_slot.menu.eesz.1M160.build.flash_size_bytes=0x100000 -wifi_slot.menu.eesz.1M160.build.flash_ld=eagle.flash.1m160.ld -wifi_slot.menu.eesz.1M160.build.spiffs_pagesize=256 -wifi_slot.menu.eesz.1M160.upload.maximum_size=860144 -wifi_slot.menu.eesz.1M160.build.rfcal_addr=0xFC000 -wifi_slot.menu.eesz.1M160.build.spiffs_start=0xD3000 -wifi_slot.menu.eesz.1M160.build.spiffs_end=0xFB000 -wifi_slot.menu.eesz.1M160.build.spiffs_blocksize=4096 -wifi_slot.menu.eesz.1M192=1M (192K SPIFFS) -wifi_slot.menu.eesz.1M192.build.flash_size=1M -wifi_slot.menu.eesz.1M192.build.flash_size_bytes=0x100000 -wifi_slot.menu.eesz.1M192.build.flash_ld=eagle.flash.1m192.ld -wifi_slot.menu.eesz.1M192.build.spiffs_pagesize=256 -wifi_slot.menu.eesz.1M192.upload.maximum_size=827376 -wifi_slot.menu.eesz.1M192.build.rfcal_addr=0xFC000 -wifi_slot.menu.eesz.1M192.build.spiffs_start=0xCB000 -wifi_slot.menu.eesz.1M192.build.spiffs_end=0xFB000 -wifi_slot.menu.eesz.1M192.build.spiffs_blocksize=4096 -wifi_slot.menu.eesz.1M256=1M (256K SPIFFS) -wifi_slot.menu.eesz.1M256.build.flash_size=1M -wifi_slot.menu.eesz.1M256.build.flash_size_bytes=0x100000 -wifi_slot.menu.eesz.1M256.build.flash_ld=eagle.flash.1m256.ld -wifi_slot.menu.eesz.1M256.build.spiffs_pagesize=256 -wifi_slot.menu.eesz.1M256.upload.maximum_size=761840 -wifi_slot.menu.eesz.1M256.build.rfcal_addr=0xFC000 -wifi_slot.menu.eesz.1M256.build.spiffs_start=0xBB000 -wifi_slot.menu.eesz.1M256.build.spiffs_end=0xFB000 -wifi_slot.menu.eesz.1M256.build.spiffs_blocksize=4096 -wifi_slot.menu.eesz.1M512=1M (512K SPIFFS) -wifi_slot.menu.eesz.1M512.build.flash_size=1M -wifi_slot.menu.eesz.1M512.build.flash_size_bytes=0x100000 -wifi_slot.menu.eesz.1M512.build.flash_ld=eagle.flash.1m512.ld -wifi_slot.menu.eesz.1M512.build.spiffs_pagesize=256 -wifi_slot.menu.eesz.1M512.upload.maximum_size=499696 -wifi_slot.menu.eesz.1M512.build.rfcal_addr=0xFC000 -wifi_slot.menu.eesz.1M512.build.spiffs_start=0x7B000 -wifi_slot.menu.eesz.1M512.build.spiffs_end=0xFB000 -wifi_slot.menu.eesz.1M512.build.spiffs_blocksize=4096 -wifi_slot.menu.eesz.2M=2M (no SPIFFS) -wifi_slot.menu.eesz.2M.build.flash_size=2M -wifi_slot.menu.eesz.2M.build.flash_size_bytes=0x200000 -wifi_slot.menu.eesz.2M.build.flash_ld=eagle.flash.2m.ld -wifi_slot.menu.eesz.2M.build.spiffs_pagesize=256 -wifi_slot.menu.eesz.2M.upload.maximum_size=1044464 -wifi_slot.menu.eesz.2M.build.rfcal_addr=0x1FC000 -wifi_slot.menu.eesz.2M128=2M (128K SPIFFS) -wifi_slot.menu.eesz.2M128.build.flash_size=2M -wifi_slot.menu.eesz.2M128.build.flash_size_bytes=0x200000 -wifi_slot.menu.eesz.2M128.build.flash_ld=eagle.flash.2m128.ld -wifi_slot.menu.eesz.2M128.build.spiffs_pagesize=256 -wifi_slot.menu.eesz.2M128.upload.maximum_size=1044464 -wifi_slot.menu.eesz.2M128.build.rfcal_addr=0x1FC000 -wifi_slot.menu.eesz.2M128.build.spiffs_start=0x1E0000 -wifi_slot.menu.eesz.2M128.build.spiffs_end=0x1FB000 -wifi_slot.menu.eesz.2M128.build.spiffs_blocksize=4096 -wifi_slot.menu.eesz.2M256=2M (256K SPIFFS) -wifi_slot.menu.eesz.2M256.build.flash_size=2M -wifi_slot.menu.eesz.2M256.build.flash_size_bytes=0x200000 -wifi_slot.menu.eesz.2M256.build.flash_ld=eagle.flash.2m256.ld -wifi_slot.menu.eesz.2M256.build.spiffs_pagesize=256 -wifi_slot.menu.eesz.2M256.upload.maximum_size=1044464 -wifi_slot.menu.eesz.2M256.build.rfcal_addr=0x1FC000 -wifi_slot.menu.eesz.2M256.build.spiffs_start=0x1C0000 -wifi_slot.menu.eesz.2M256.build.spiffs_end=0x1FB000 -wifi_slot.menu.eesz.2M256.build.spiffs_blocksize=4096 -wifi_slot.menu.eesz.2M512=2M (512K SPIFFS) -wifi_slot.menu.eesz.2M512.build.flash_size=2M -wifi_slot.menu.eesz.2M512.build.flash_size_bytes=0x200000 -wifi_slot.menu.eesz.2M512.build.flash_ld=eagle.flash.2m512.ld -wifi_slot.menu.eesz.2M512.build.spiffs_pagesize=256 -wifi_slot.menu.eesz.2M512.upload.maximum_size=1044464 -wifi_slot.menu.eesz.2M512.build.rfcal_addr=0x1FC000 -wifi_slot.menu.eesz.2M512.build.spiffs_start=0x180000 -wifi_slot.menu.eesz.2M512.build.spiffs_end=0x1FB000 -wifi_slot.menu.eesz.2M512.build.spiffs_blocksize=8192 -wifi_slot.menu.eesz.2M1M=2M (1M SPIFFS) -wifi_slot.menu.eesz.2M1M.build.flash_size=2M -wifi_slot.menu.eesz.2M1M.build.flash_size_bytes=0x200000 -wifi_slot.menu.eesz.2M1M.build.flash_ld=eagle.flash.2m1m.ld -wifi_slot.menu.eesz.2M1M.build.spiffs_pagesize=256 -wifi_slot.menu.eesz.2M1M.upload.maximum_size=1044464 -wifi_slot.menu.eesz.2M1M.build.rfcal_addr=0x1FC000 -wifi_slot.menu.eesz.2M1M.build.spiffs_start=0x100000 -wifi_slot.menu.eesz.2M1M.build.spiffs_end=0x1FB000 -wifi_slot.menu.eesz.2M1M.build.spiffs_blocksize=8192 -wifi_slot.menu.ip.lm2f=v2 Lower Memory -wifi_slot.menu.ip.lm2f.build.lwip_include=lwip2/include -wifi_slot.menu.ip.lm2f.build.lwip_lib=-llwip2-536-feat -wifi_slot.menu.ip.lm2f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -wifi_slot.menu.ip.hb2f=v2 Higher Bandwidth -wifi_slot.menu.ip.hb2f.build.lwip_include=lwip2/include -wifi_slot.menu.ip.hb2f.build.lwip_lib=-llwip2-1460-feat -wifi_slot.menu.ip.hb2f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -wifi_slot.menu.ip.lm2n=v2 Lower Memory (no features) -wifi_slot.menu.ip.lm2n.build.lwip_include=lwip2/include -wifi_slot.menu.ip.lm2n.build.lwip_lib=-llwip2-536 -wifi_slot.menu.ip.lm2n.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=0 -DLWIP_IPV6=0 -wifi_slot.menu.ip.hb2n=v2 Higher Bandwidth (no features) -wifi_slot.menu.ip.hb2n.build.lwip_include=lwip2/include -wifi_slot.menu.ip.hb2n.build.lwip_lib=-llwip2-1460 -wifi_slot.menu.ip.hb2n.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=0 -DLWIP_IPV6=0 -wifi_slot.menu.ip.lm6f=v2 IPv6 Lower Memory -wifi_slot.menu.ip.lm6f.build.lwip_include=lwip2/include -wifi_slot.menu.ip.lm6f.build.lwip_lib=-llwip6-536-feat -wifi_slot.menu.ip.lm6f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=1 -wifi_slot.menu.ip.hb6f=v2 IPv6 Higher Bandwidth -wifi_slot.menu.ip.hb6f.build.lwip_include=lwip2/include -wifi_slot.menu.ip.hb6f.build.lwip_lib=-llwip6-1460-feat -wifi_slot.menu.ip.hb6f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=1 -DLWIP_IPV6=1 -wifi_slot.menu.ip.hb1=v1.4 Higher Bandwidth -wifi_slot.menu.ip.hb1.build.lwip_lib=-llwip_gcc -wifi_slot.menu.ip.hb1.build.lwip_flags=-DLWIP_OPEN_SRC -wifi_slot.menu.ip.src=v1.4 Compile from source -wifi_slot.menu.ip.src.build.lwip_lib=-llwip_src -wifi_slot.menu.ip.src.build.lwip_flags=-DLWIP_OPEN_SRC -wifi_slot.menu.ip.src.recipe.hooks.sketch.prebuild.1.pattern=make -C "{runtime.platform.path}/tools/sdk/lwip/src" install TOOLS_PATH="{runtime.tools.xtensa-lx106-elf-gcc.path}/bin/xtensa-lx106-elf-" -wifi_slot.menu.dbg.Disabled=Disabled -wifi_slot.menu.dbg.Disabled.build.debug_port= -wifi_slot.menu.dbg.Serial=Serial -wifi_slot.menu.dbg.Serial.build.debug_port=-DDEBUG_ESP_PORT=Serial -wifi_slot.menu.dbg.Serial1=Serial1 -wifi_slot.menu.dbg.Serial1.build.debug_port=-DDEBUG_ESP_PORT=Serial1 -wifi_slot.menu.lvl.None____=None -wifi_slot.menu.lvl.None____.build.debug_level= -wifi_slot.menu.lvl.SSL=SSL -wifi_slot.menu.lvl.SSL.build.debug_level= -DDEBUG_ESP_SSL -wifi_slot.menu.lvl.TLS_MEM=TLS_MEM -wifi_slot.menu.lvl.TLS_MEM.build.debug_level= -DDEBUG_ESP_TLS_MEM -wifi_slot.menu.lvl.HTTP_CLIENT=HTTP_CLIENT -wifi_slot.menu.lvl.HTTP_CLIENT.build.debug_level= -DDEBUG_ESP_HTTP_CLIENT -wifi_slot.menu.lvl.HTTP_SERVER=HTTP_SERVER -wifi_slot.menu.lvl.HTTP_SERVER.build.debug_level= -DDEBUG_ESP_HTTP_SERVER -wifi_slot.menu.lvl.SSLTLS_MEM=SSL+TLS_MEM -wifi_slot.menu.lvl.SSLTLS_MEM.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -wifi_slot.menu.lvl.SSLHTTP_CLIENT=SSL+HTTP_CLIENT -wifi_slot.menu.lvl.SSLHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_CLIENT -wifi_slot.menu.lvl.SSLHTTP_SERVER=SSL+HTTP_SERVER -wifi_slot.menu.lvl.SSLHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_SERVER -wifi_slot.menu.lvl.TLS_MEMHTTP_CLIENT=TLS_MEM+HTTP_CLIENT -wifi_slot.menu.lvl.TLS_MEMHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -wifi_slot.menu.lvl.TLS_MEMHTTP_SERVER=TLS_MEM+HTTP_SERVER -wifi_slot.menu.lvl.TLS_MEMHTTP_SERVER.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_SERVER -wifi_slot.menu.lvl.HTTP_CLIENTHTTP_SERVER=HTTP_CLIENT+HTTP_SERVER -wifi_slot.menu.lvl.HTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -wifi_slot.menu.lvl.SSLTLS_MEMHTTP_CLIENT=SSL+TLS_MEM+HTTP_CLIENT -wifi_slot.menu.lvl.SSLTLS_MEMHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -wifi_slot.menu.lvl.SSLTLS_MEMHTTP_SERVER=SSL+TLS_MEM+HTTP_SERVER -wifi_slot.menu.lvl.SSLTLS_MEMHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_SERVER -wifi_slot.menu.lvl.SSLHTTP_CLIENTHTTP_SERVER=SSL+HTTP_CLIENT+HTTP_SERVER -wifi_slot.menu.lvl.SSLHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -wifi_slot.menu.lvl.TLS_MEMHTTP_CLIENTHTTP_SERVER=TLS_MEM+HTTP_CLIENT+HTTP_SERVER -wifi_slot.menu.lvl.TLS_MEMHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -wifi_slot.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVER=SSL+TLS_MEM+HTTP_CLIENT+HTTP_SERVER -wifi_slot.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -wifi_slot.menu.lvl.CORE=CORE -wifi_slot.menu.lvl.CORE.build.debug_level= -DDEBUG_ESP_CORE -wifi_slot.menu.lvl.WIFI=WIFI -wifi_slot.menu.lvl.WIFI.build.debug_level= -DDEBUG_ESP_WIFI -wifi_slot.menu.lvl.HTTP_UPDATE=HTTP_UPDATE -wifi_slot.menu.lvl.HTTP_UPDATE.build.debug_level= -DDEBUG_ESP_HTTP_UPDATE -wifi_slot.menu.lvl.UPDATER=UPDATER -wifi_slot.menu.lvl.UPDATER.build.debug_level= -DDEBUG_ESP_UPDATER -wifi_slot.menu.lvl.OTA=OTA -wifi_slot.menu.lvl.OTA.build.debug_level= -DDEBUG_ESP_OTA -wifi_slot.menu.lvl.OOM=OOM -wifi_slot.menu.lvl.OOM.build.debug_level= -DDEBUG_ESP_OOM -wifi_slot.menu.lvl.COREWIFIHTTP_UPDATEUPDATEROTAOOM=CORE+WIFI+HTTP_UPDATE+UPDATER+OTA+OOM -wifi_slot.menu.lvl.COREWIFIHTTP_UPDATEUPDATEROTAOOM.build.debug_level= -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM -wifi_slot.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVERCOREWIFIHTTP_UPDATEUPDATEROTAOOM=SSL+TLS_MEM+HTTP_CLIENT+HTTP_SERVER+CORE+WIFI+HTTP_UPDATE+UPDATER+OTA+OOM -wifi_slot.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVERCOREWIFIHTTP_UPDATEUPDATEROTAOOM.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM -wifi_slot.menu.lvl.NoAssert-NDEBUG=NoAssert-NDEBUG -wifi_slot.menu.lvl.NoAssert-NDEBUG.build.debug_level= -DNDEBUG -wifi_slot.menu.wipe.none=Only Sketch -wifi_slot.menu.wipe.none.upload.erase_cmd= -wifi_slot.menu.wipe.sdk=Sketch + WiFi Settings -wifi_slot.menu.wipe.sdk.upload.erase_cmd=-ca "{build.rfcal_addr}" -cz 0x4000 -wifi_slot.menu.wipe.all=All Flash Contents -wifi_slot.menu.wipe.all.upload.erase_cmd=-ca 0x0 -cz "{build.flash_size_bytes}" -wifi_slot.menu.baud.115200=115200 -wifi_slot.menu.baud.115200.upload.speed=115200 -wifi_slot.menu.baud.9600=9600 -wifi_slot.menu.baud.9600.upload.speed=9600 -wifi_slot.menu.baud.57600=57600 -wifi_slot.menu.baud.57600.upload.speed=57600 -wifi_slot.menu.baud.230400.linux=230400 -wifi_slot.menu.baud.230400.macosx=230400 -wifi_slot.menu.baud.230400.upload.speed=230400 -wifi_slot.menu.baud.256000.windows=256000 -wifi_slot.menu.baud.256000.upload.speed=256000 -wifi_slot.menu.baud.460800.linux=460800 -wifi_slot.menu.baud.460800.macosx=460800 -wifi_slot.menu.baud.460800.upload.speed=460800 -wifi_slot.menu.baud.512000.windows=512000 -wifi_slot.menu.baud.512000.upload.speed=512000 -wifi_slot.menu.baud.921600=921600 -wifi_slot.menu.baud.921600.upload.speed=921600 - -############################################################## -wiolink.name=Seeed Wio Link -wiolink.build.board=ESP8266_WIO_LINK -wiolink.build.variant=wiolink -wiolink.upload.tool=esptool -wiolink.upload.maximum_data_size=81920 -wiolink.upload.wait_for_upload_port=true -wiolink.upload.erase_cmd= -wiolink.serial.disableDTR=true -wiolink.serial.disableRTS=true -wiolink.build.mcu=esp8266 -wiolink.build.core=esp8266 -wiolink.build.spiffs_pagesize=256 -wiolink.build.debug_port= -wiolink.build.debug_level= -wiolink.menu.xtal.80=80 MHz -wiolink.menu.xtal.80.build.f_cpu=80000000L -wiolink.menu.xtal.160=160 MHz -wiolink.menu.xtal.160.build.f_cpu=160000000L -wiolink.menu.vt.flash=Flash -wiolink.menu.vt.flash.build.vtable_flags=-DVTABLES_IN_FLASH -wiolink.menu.vt.heap=Heap -wiolink.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM -wiolink.menu.vt.iram=IRAM -wiolink.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM -wiolink.menu.exception.enabled=Enabled -wiolink.menu.exception.enabled.build.exception_flags=-fexceptions -wiolink.menu.exception.enabled.build.stdcpp_lib=-lstdc++ -wiolink.menu.exception.disabled=Disabled -wiolink.menu.exception.disabled.build.exception_flags=-fno-exceptions -wiolink.menu.exception.disabled.build.stdcpp_lib=-lstdc++-nox -wiolink.upload.resetmethod=nodemcu -wiolink.build.flash_mode=qio -wiolink.build.flash_freq=40 -wiolink.menu.eesz.4M=4M (no SPIFFS) -wiolink.menu.eesz.4M.build.flash_size=4M -wiolink.menu.eesz.4M.build.flash_size_bytes=0x400000 -wiolink.menu.eesz.4M.build.flash_ld=eagle.flash.4m.ld -wiolink.menu.eesz.4M.build.spiffs_pagesize=256 -wiolink.menu.eesz.4M.upload.maximum_size=1044464 -wiolink.menu.eesz.4M.build.rfcal_addr=0x3FC000 -wiolink.menu.eesz.4M1M=4M (1M SPIFFS) -wiolink.menu.eesz.4M1M.build.flash_size=4M -wiolink.menu.eesz.4M1M.build.flash_size_bytes=0x400000 -wiolink.menu.eesz.4M1M.build.flash_ld=eagle.flash.4m1m.ld -wiolink.menu.eesz.4M1M.build.spiffs_pagesize=256 -wiolink.menu.eesz.4M1M.upload.maximum_size=1044464 -wiolink.menu.eesz.4M1M.build.rfcal_addr=0x3FC000 -wiolink.menu.eesz.4M1M.build.spiffs_start=0x300000 -wiolink.menu.eesz.4M1M.build.spiffs_end=0x3FB000 -wiolink.menu.eesz.4M1M.build.spiffs_blocksize=8192 -wiolink.menu.eesz.4M2M=4M (2M SPIFFS) -wiolink.menu.eesz.4M2M.build.flash_size=4M -wiolink.menu.eesz.4M2M.build.flash_size_bytes=0x400000 -wiolink.menu.eesz.4M2M.build.flash_ld=eagle.flash.4m2m.ld -wiolink.menu.eesz.4M2M.build.spiffs_pagesize=256 -wiolink.menu.eesz.4M2M.upload.maximum_size=1044464 -wiolink.menu.eesz.4M2M.build.rfcal_addr=0x3FC000 -wiolink.menu.eesz.4M2M.build.spiffs_start=0x200000 -wiolink.menu.eesz.4M2M.build.spiffs_end=0x3FB000 -wiolink.menu.eesz.4M2M.build.spiffs_blocksize=8192 -wiolink.menu.eesz.4M3M=4M (3M SPIFFS) -wiolink.menu.eesz.4M3M.build.flash_size=4M -wiolink.menu.eesz.4M3M.build.flash_size_bytes=0x400000 -wiolink.menu.eesz.4M3M.build.flash_ld=eagle.flash.4m3m.ld -wiolink.menu.eesz.4M3M.build.spiffs_pagesize=256 -wiolink.menu.eesz.4M3M.upload.maximum_size=1044464 -wiolink.menu.eesz.4M3M.build.rfcal_addr=0x3FC000 -wiolink.menu.eesz.4M3M.build.spiffs_start=0x100000 -wiolink.menu.eesz.4M3M.build.spiffs_end=0x3FB000 -wiolink.menu.eesz.4M3M.build.spiffs_blocksize=8192 -wiolink.menu.ip.lm2f=v2 Lower Memory -wiolink.menu.ip.lm2f.build.lwip_include=lwip2/include -wiolink.menu.ip.lm2f.build.lwip_lib=-llwip2-536-feat -wiolink.menu.ip.lm2f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -wiolink.menu.ip.hb2f=v2 Higher Bandwidth -wiolink.menu.ip.hb2f.build.lwip_include=lwip2/include -wiolink.menu.ip.hb2f.build.lwip_lib=-llwip2-1460-feat -wiolink.menu.ip.hb2f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -wiolink.menu.ip.lm2n=v2 Lower Memory (no features) -wiolink.menu.ip.lm2n.build.lwip_include=lwip2/include -wiolink.menu.ip.lm2n.build.lwip_lib=-llwip2-536 -wiolink.menu.ip.lm2n.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=0 -DLWIP_IPV6=0 -wiolink.menu.ip.hb2n=v2 Higher Bandwidth (no features) -wiolink.menu.ip.hb2n.build.lwip_include=lwip2/include -wiolink.menu.ip.hb2n.build.lwip_lib=-llwip2-1460 -wiolink.menu.ip.hb2n.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=0 -DLWIP_IPV6=0 -wiolink.menu.ip.lm6f=v2 IPv6 Lower Memory -wiolink.menu.ip.lm6f.build.lwip_include=lwip2/include -wiolink.menu.ip.lm6f.build.lwip_lib=-llwip6-536-feat -wiolink.menu.ip.lm6f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=1 -wiolink.menu.ip.hb6f=v2 IPv6 Higher Bandwidth -wiolink.menu.ip.hb6f.build.lwip_include=lwip2/include -wiolink.menu.ip.hb6f.build.lwip_lib=-llwip6-1460-feat -wiolink.menu.ip.hb6f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=1 -DLWIP_IPV6=1 -wiolink.menu.ip.hb1=v1.4 Higher Bandwidth -wiolink.menu.ip.hb1.build.lwip_lib=-llwip_gcc -wiolink.menu.ip.hb1.build.lwip_flags=-DLWIP_OPEN_SRC -wiolink.menu.ip.src=v1.4 Compile from source -wiolink.menu.ip.src.build.lwip_lib=-llwip_src -wiolink.menu.ip.src.build.lwip_flags=-DLWIP_OPEN_SRC -wiolink.menu.ip.src.recipe.hooks.sketch.prebuild.1.pattern=make -C "{runtime.platform.path}/tools/sdk/lwip/src" install TOOLS_PATH="{runtime.tools.xtensa-lx106-elf-gcc.path}/bin/xtensa-lx106-elf-" -wiolink.menu.dbg.Disabled=Disabled -wiolink.menu.dbg.Disabled.build.debug_port= -wiolink.menu.dbg.Serial=Serial -wiolink.menu.dbg.Serial.build.debug_port=-DDEBUG_ESP_PORT=Serial -wiolink.menu.dbg.Serial1=Serial1 -wiolink.menu.dbg.Serial1.build.debug_port=-DDEBUG_ESP_PORT=Serial1 -wiolink.menu.lvl.None____=None -wiolink.menu.lvl.None____.build.debug_level= -wiolink.menu.lvl.SSL=SSL -wiolink.menu.lvl.SSL.build.debug_level= -DDEBUG_ESP_SSL -wiolink.menu.lvl.TLS_MEM=TLS_MEM -wiolink.menu.lvl.TLS_MEM.build.debug_level= -DDEBUG_ESP_TLS_MEM -wiolink.menu.lvl.HTTP_CLIENT=HTTP_CLIENT -wiolink.menu.lvl.HTTP_CLIENT.build.debug_level= -DDEBUG_ESP_HTTP_CLIENT -wiolink.menu.lvl.HTTP_SERVER=HTTP_SERVER -wiolink.menu.lvl.HTTP_SERVER.build.debug_level= -DDEBUG_ESP_HTTP_SERVER -wiolink.menu.lvl.SSLTLS_MEM=SSL+TLS_MEM -wiolink.menu.lvl.SSLTLS_MEM.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -wiolink.menu.lvl.SSLHTTP_CLIENT=SSL+HTTP_CLIENT -wiolink.menu.lvl.SSLHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_CLIENT -wiolink.menu.lvl.SSLHTTP_SERVER=SSL+HTTP_SERVER -wiolink.menu.lvl.SSLHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_SERVER -wiolink.menu.lvl.TLS_MEMHTTP_CLIENT=TLS_MEM+HTTP_CLIENT -wiolink.menu.lvl.TLS_MEMHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -wiolink.menu.lvl.TLS_MEMHTTP_SERVER=TLS_MEM+HTTP_SERVER -wiolink.menu.lvl.TLS_MEMHTTP_SERVER.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_SERVER -wiolink.menu.lvl.HTTP_CLIENTHTTP_SERVER=HTTP_CLIENT+HTTP_SERVER -wiolink.menu.lvl.HTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -wiolink.menu.lvl.SSLTLS_MEMHTTP_CLIENT=SSL+TLS_MEM+HTTP_CLIENT -wiolink.menu.lvl.SSLTLS_MEMHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -wiolink.menu.lvl.SSLTLS_MEMHTTP_SERVER=SSL+TLS_MEM+HTTP_SERVER -wiolink.menu.lvl.SSLTLS_MEMHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_SERVER -wiolink.menu.lvl.SSLHTTP_CLIENTHTTP_SERVER=SSL+HTTP_CLIENT+HTTP_SERVER -wiolink.menu.lvl.SSLHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -wiolink.menu.lvl.TLS_MEMHTTP_CLIENTHTTP_SERVER=TLS_MEM+HTTP_CLIENT+HTTP_SERVER -wiolink.menu.lvl.TLS_MEMHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -wiolink.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVER=SSL+TLS_MEM+HTTP_CLIENT+HTTP_SERVER -wiolink.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -wiolink.menu.lvl.CORE=CORE -wiolink.menu.lvl.CORE.build.debug_level= -DDEBUG_ESP_CORE -wiolink.menu.lvl.WIFI=WIFI -wiolink.menu.lvl.WIFI.build.debug_level= -DDEBUG_ESP_WIFI -wiolink.menu.lvl.HTTP_UPDATE=HTTP_UPDATE -wiolink.menu.lvl.HTTP_UPDATE.build.debug_level= -DDEBUG_ESP_HTTP_UPDATE -wiolink.menu.lvl.UPDATER=UPDATER -wiolink.menu.lvl.UPDATER.build.debug_level= -DDEBUG_ESP_UPDATER -wiolink.menu.lvl.OTA=OTA -wiolink.menu.lvl.OTA.build.debug_level= -DDEBUG_ESP_OTA -wiolink.menu.lvl.OOM=OOM -wiolink.menu.lvl.OOM.build.debug_level= -DDEBUG_ESP_OOM -wiolink.menu.lvl.COREWIFIHTTP_UPDATEUPDATEROTAOOM=CORE+WIFI+HTTP_UPDATE+UPDATER+OTA+OOM -wiolink.menu.lvl.COREWIFIHTTP_UPDATEUPDATEROTAOOM.build.debug_level= -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM -wiolink.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVERCOREWIFIHTTP_UPDATEUPDATEROTAOOM=SSL+TLS_MEM+HTTP_CLIENT+HTTP_SERVER+CORE+WIFI+HTTP_UPDATE+UPDATER+OTA+OOM -wiolink.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVERCOREWIFIHTTP_UPDATEUPDATEROTAOOM.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM -wiolink.menu.lvl.NoAssert-NDEBUG=NoAssert-NDEBUG -wiolink.menu.lvl.NoAssert-NDEBUG.build.debug_level= -DNDEBUG -wiolink.menu.wipe.none=Only Sketch -wiolink.menu.wipe.none.upload.erase_cmd= -wiolink.menu.wipe.sdk=Sketch + WiFi Settings -wiolink.menu.wipe.sdk.upload.erase_cmd=-ca "{build.rfcal_addr}" -cz 0x4000 -wiolink.menu.wipe.all=All Flash Contents -wiolink.menu.wipe.all.upload.erase_cmd=-ca 0x0 -cz "{build.flash_size_bytes}" -wiolink.menu.baud.115200=115200 -wiolink.menu.baud.115200.upload.speed=115200 -wiolink.menu.baud.9600=9600 -wiolink.menu.baud.9600.upload.speed=9600 -wiolink.menu.baud.57600=57600 -wiolink.menu.baud.57600.upload.speed=57600 -wiolink.menu.baud.230400.linux=230400 -wiolink.menu.baud.230400.macosx=230400 -wiolink.menu.baud.230400.upload.speed=230400 -wiolink.menu.baud.256000.windows=256000 -wiolink.menu.baud.256000.upload.speed=256000 -wiolink.menu.baud.460800.linux=460800 -wiolink.menu.baud.460800.macosx=460800 -wiolink.menu.baud.460800.upload.speed=460800 -wiolink.menu.baud.512000.windows=512000 -wiolink.menu.baud.512000.upload.speed=512000 -wiolink.menu.baud.921600=921600 -wiolink.menu.baud.921600.upload.speed=921600 - -############################################################## -espectro.name=ESPectro Core -espectro.build.board=ESP8266_ESPECTRO_CORE -espectro.build.variant=espectro -espectro.upload.tool=esptool -espectro.upload.maximum_data_size=81920 -espectro.upload.wait_for_upload_port=true -espectro.upload.erase_cmd= -espectro.serial.disableDTR=true -espectro.serial.disableRTS=true -espectro.build.mcu=esp8266 -espectro.build.core=esp8266 -espectro.build.spiffs_pagesize=256 -espectro.build.debug_port= -espectro.build.debug_level= -espectro.menu.xtal.80=80 MHz -espectro.menu.xtal.80.build.f_cpu=80000000L -espectro.menu.xtal.160=160 MHz -espectro.menu.xtal.160.build.f_cpu=160000000L -espectro.menu.vt.flash=Flash -espectro.menu.vt.flash.build.vtable_flags=-DVTABLES_IN_FLASH -espectro.menu.vt.heap=Heap -espectro.menu.vt.heap.build.vtable_flags=-DVTABLES_IN_DRAM -espectro.menu.vt.iram=IRAM -espectro.menu.vt.iram.build.vtable_flags=-DVTABLES_IN_IRAM -espectro.menu.exception.enabled=Enabled -espectro.menu.exception.enabled.build.exception_flags=-fexceptions -espectro.menu.exception.enabled.build.stdcpp_lib=-lstdc++ -espectro.menu.exception.disabled=Disabled -espectro.menu.exception.disabled.build.exception_flags=-fno-exceptions -espectro.menu.exception.disabled.build.stdcpp_lib=-lstdc++-nox -espectro.upload.resetmethod=nodemcu -espectro.build.flash_mode=dio -espectro.build.flash_freq=40 -espectro.menu.eesz.4M=4M (no SPIFFS) -espectro.menu.eesz.4M.build.flash_size=4M -espectro.menu.eesz.4M.build.flash_size_bytes=0x400000 -espectro.menu.eesz.4M.build.flash_ld=eagle.flash.4m.ld -espectro.menu.eesz.4M.build.spiffs_pagesize=256 -espectro.menu.eesz.4M.upload.maximum_size=1044464 -espectro.menu.eesz.4M.build.rfcal_addr=0x3FC000 -espectro.menu.eesz.4M1M=4M (1M SPIFFS) -espectro.menu.eesz.4M1M.build.flash_size=4M -espectro.menu.eesz.4M1M.build.flash_size_bytes=0x400000 -espectro.menu.eesz.4M1M.build.flash_ld=eagle.flash.4m1m.ld -espectro.menu.eesz.4M1M.build.spiffs_pagesize=256 -espectro.menu.eesz.4M1M.upload.maximum_size=1044464 -espectro.menu.eesz.4M1M.build.rfcal_addr=0x3FC000 -espectro.menu.eesz.4M1M.build.spiffs_start=0x300000 -espectro.menu.eesz.4M1M.build.spiffs_end=0x3FB000 -espectro.menu.eesz.4M1M.build.spiffs_blocksize=8192 -espectro.menu.eesz.4M2M=4M (2M SPIFFS) -espectro.menu.eesz.4M2M.build.flash_size=4M -espectro.menu.eesz.4M2M.build.flash_size_bytes=0x400000 -espectro.menu.eesz.4M2M.build.flash_ld=eagle.flash.4m2m.ld -espectro.menu.eesz.4M2M.build.spiffs_pagesize=256 -espectro.menu.eesz.4M2M.upload.maximum_size=1044464 -espectro.menu.eesz.4M2M.build.rfcal_addr=0x3FC000 -espectro.menu.eesz.4M2M.build.spiffs_start=0x200000 -espectro.menu.eesz.4M2M.build.spiffs_end=0x3FB000 -espectro.menu.eesz.4M2M.build.spiffs_blocksize=8192 -espectro.menu.eesz.4M3M=4M (3M SPIFFS) -espectro.menu.eesz.4M3M.build.flash_size=4M -espectro.menu.eesz.4M3M.build.flash_size_bytes=0x400000 -espectro.menu.eesz.4M3M.build.flash_ld=eagle.flash.4m3m.ld -espectro.menu.eesz.4M3M.build.spiffs_pagesize=256 -espectro.menu.eesz.4M3M.upload.maximum_size=1044464 -espectro.menu.eesz.4M3M.build.rfcal_addr=0x3FC000 -espectro.menu.eesz.4M3M.build.spiffs_start=0x100000 -espectro.menu.eesz.4M3M.build.spiffs_end=0x3FB000 -espectro.menu.eesz.4M3M.build.spiffs_blocksize=8192 -espectro.menu.ip.lm2f=v2 Lower Memory -espectro.menu.ip.lm2f.build.lwip_include=lwip2/include -espectro.menu.ip.lm2f.build.lwip_lib=-llwip2-536-feat -espectro.menu.ip.lm2f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -espectro.menu.ip.hb2f=v2 Higher Bandwidth -espectro.menu.ip.hb2f.build.lwip_include=lwip2/include -espectro.menu.ip.hb2f.build.lwip_lib=-llwip2-1460-feat -espectro.menu.ip.hb2f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -espectro.menu.ip.lm2n=v2 Lower Memory (no features) -espectro.menu.ip.lm2n.build.lwip_include=lwip2/include -espectro.menu.ip.lm2n.build.lwip_lib=-llwip2-536 -espectro.menu.ip.lm2n.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=0 -DLWIP_IPV6=0 -espectro.menu.ip.hb2n=v2 Higher Bandwidth (no features) -espectro.menu.ip.hb2n.build.lwip_include=lwip2/include -espectro.menu.ip.hb2n.build.lwip_lib=-llwip2-1460 -espectro.menu.ip.hb2n.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=0 -DLWIP_IPV6=0 -espectro.menu.ip.lm6f=v2 IPv6 Lower Memory -espectro.menu.ip.lm6f.build.lwip_include=lwip2/include -espectro.menu.ip.lm6f.build.lwip_lib=-llwip6-536-feat -espectro.menu.ip.lm6f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=1 -espectro.menu.ip.hb6f=v2 IPv6 Higher Bandwidth -espectro.menu.ip.hb6f.build.lwip_include=lwip2/include -espectro.menu.ip.hb6f.build.lwip_lib=-llwip6-1460-feat -espectro.menu.ip.hb6f.build.lwip_flags=-DLWIP_OPEN_SRC -DTCP_MSS=1460 -DLWIP_FEATURES=1 -DLWIP_IPV6=1 -espectro.menu.ip.hb1=v1.4 Higher Bandwidth -espectro.menu.ip.hb1.build.lwip_lib=-llwip_gcc -espectro.menu.ip.hb1.build.lwip_flags=-DLWIP_OPEN_SRC -espectro.menu.ip.src=v1.4 Compile from source -espectro.menu.ip.src.build.lwip_lib=-llwip_src -espectro.menu.ip.src.build.lwip_flags=-DLWIP_OPEN_SRC -espectro.menu.ip.src.recipe.hooks.sketch.prebuild.1.pattern=make -C "{runtime.platform.path}/tools/sdk/lwip/src" install TOOLS_PATH="{runtime.tools.xtensa-lx106-elf-gcc.path}/bin/xtensa-lx106-elf-" -espectro.menu.dbg.Disabled=Disabled -espectro.menu.dbg.Disabled.build.debug_port= -espectro.menu.dbg.Serial=Serial -espectro.menu.dbg.Serial.build.debug_port=-DDEBUG_ESP_PORT=Serial -espectro.menu.dbg.Serial1=Serial1 -espectro.menu.dbg.Serial1.build.debug_port=-DDEBUG_ESP_PORT=Serial1 -espectro.menu.lvl.None____=None -espectro.menu.lvl.None____.build.debug_level= -espectro.menu.lvl.SSL=SSL -espectro.menu.lvl.SSL.build.debug_level= -DDEBUG_ESP_SSL -espectro.menu.lvl.TLS_MEM=TLS_MEM -espectro.menu.lvl.TLS_MEM.build.debug_level= -DDEBUG_ESP_TLS_MEM -espectro.menu.lvl.HTTP_CLIENT=HTTP_CLIENT -espectro.menu.lvl.HTTP_CLIENT.build.debug_level= -DDEBUG_ESP_HTTP_CLIENT -espectro.menu.lvl.HTTP_SERVER=HTTP_SERVER -espectro.menu.lvl.HTTP_SERVER.build.debug_level= -DDEBUG_ESP_HTTP_SERVER -espectro.menu.lvl.SSLTLS_MEM=SSL+TLS_MEM -espectro.menu.lvl.SSLTLS_MEM.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -espectro.menu.lvl.SSLHTTP_CLIENT=SSL+HTTP_CLIENT -espectro.menu.lvl.SSLHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_CLIENT -espectro.menu.lvl.SSLHTTP_SERVER=SSL+HTTP_SERVER -espectro.menu.lvl.SSLHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_SERVER -espectro.menu.lvl.TLS_MEMHTTP_CLIENT=TLS_MEM+HTTP_CLIENT -espectro.menu.lvl.TLS_MEMHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -espectro.menu.lvl.TLS_MEMHTTP_SERVER=TLS_MEM+HTTP_SERVER -espectro.menu.lvl.TLS_MEMHTTP_SERVER.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_SERVER -espectro.menu.lvl.HTTP_CLIENTHTTP_SERVER=HTTP_CLIENT+HTTP_SERVER -espectro.menu.lvl.HTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -espectro.menu.lvl.SSLTLS_MEMHTTP_CLIENT=SSL+TLS_MEM+HTTP_CLIENT -espectro.menu.lvl.SSLTLS_MEMHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -espectro.menu.lvl.SSLTLS_MEMHTTP_SERVER=SSL+TLS_MEM+HTTP_SERVER -espectro.menu.lvl.SSLTLS_MEMHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_SERVER -espectro.menu.lvl.SSLHTTP_CLIENTHTTP_SERVER=SSL+HTTP_CLIENT+HTTP_SERVER -espectro.menu.lvl.SSLHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -espectro.menu.lvl.TLS_MEMHTTP_CLIENTHTTP_SERVER=TLS_MEM+HTTP_CLIENT+HTTP_SERVER -espectro.menu.lvl.TLS_MEMHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -espectro.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVER=SSL+TLS_MEM+HTTP_CLIENT+HTTP_SERVER -espectro.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -espectro.menu.lvl.CORE=CORE -espectro.menu.lvl.CORE.build.debug_level= -DDEBUG_ESP_CORE -espectro.menu.lvl.WIFI=WIFI -espectro.menu.lvl.WIFI.build.debug_level= -DDEBUG_ESP_WIFI -espectro.menu.lvl.HTTP_UPDATE=HTTP_UPDATE -espectro.menu.lvl.HTTP_UPDATE.build.debug_level= -DDEBUG_ESP_HTTP_UPDATE -espectro.menu.lvl.UPDATER=UPDATER -espectro.menu.lvl.UPDATER.build.debug_level= -DDEBUG_ESP_UPDATER -espectro.menu.lvl.OTA=OTA -espectro.menu.lvl.OTA.build.debug_level= -DDEBUG_ESP_OTA -espectro.menu.lvl.OOM=OOM -espectro.menu.lvl.OOM.build.debug_level= -DDEBUG_ESP_OOM -espectro.menu.lvl.COREWIFIHTTP_UPDATEUPDATEROTAOOM=CORE+WIFI+HTTP_UPDATE+UPDATER+OTA+OOM -espectro.menu.lvl.COREWIFIHTTP_UPDATEUPDATEROTAOOM.build.debug_level= -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM -espectro.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVERCOREWIFIHTTP_UPDATEUPDATEROTAOOM=SSL+TLS_MEM+HTTP_CLIENT+HTTP_SERVER+CORE+WIFI+HTTP_UPDATE+UPDATER+OTA+OOM -espectro.menu.lvl.SSLTLS_MEMHTTP_CLIENTHTTP_SERVERCOREWIFIHTTP_UPDATEUPDATEROTAOOM.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM -espectro.menu.lvl.NoAssert-NDEBUG=NoAssert-NDEBUG -espectro.menu.lvl.NoAssert-NDEBUG.build.debug_level= -DNDEBUG -espectro.menu.wipe.none=Only Sketch -espectro.menu.wipe.none.upload.erase_cmd= -espectro.menu.wipe.sdk=Sketch + WiFi Settings -espectro.menu.wipe.sdk.upload.erase_cmd=-ca "{build.rfcal_addr}" -cz 0x4000 -espectro.menu.wipe.all=All Flash Contents -espectro.menu.wipe.all.upload.erase_cmd=-ca 0x0 -cz "{build.flash_size_bytes}" -espectro.menu.baud.115200=115200 -espectro.menu.baud.115200.upload.speed=115200 -espectro.menu.baud.9600=9600 -espectro.menu.baud.9600.upload.speed=9600 -espectro.menu.baud.57600=57600 -espectro.menu.baud.57600.upload.speed=57600 -espectro.menu.baud.230400.linux=230400 -espectro.menu.baud.230400.macosx=230400 -espectro.menu.baud.230400.upload.speed=230400 -espectro.menu.baud.256000.windows=256000 -espectro.menu.baud.256000.upload.speed=256000 -espectro.menu.baud.460800.linux=460800 -espectro.menu.baud.460800.macosx=460800 -espectro.menu.baud.460800.upload.speed=460800 -espectro.menu.baud.512000.windows=512000 -espectro.menu.baud.512000.upload.speed=512000 -espectro.menu.baud.921600=921600 -espectro.menu.baud.921600.upload.speed=921600 - diff --git a/arduino/version 2.5.0-beta2/platform.txt b/arduino/version 2.5.0-beta2/platform.txt deleted file mode 100644 index 39988668a..000000000 --- a/arduino/version 2.5.0-beta2/platform.txt +++ /dev/null @@ -1,156 +0,0 @@ - -# ESP8266 platform -# ------------------------------ - -# For more info: -# https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5---3rd-party-Hardware-specification - -name=ESP8266 Boards (2.5.0-beta2) -version=2.5.0-beta2 - - - -runtime.tools.signing={runtime.platform.path}/tools/signing.py - -compiler.warning_flags=-w -compiler.warning_flags.none=-w -compiler.warning_flags.default= -compiler.warning_flags.more=-Wall -compiler.warning_flags.all=-Wall -Wextra - -build.lwip_lib=-llwip_gcc -build.lwip_include=lwip/include -build.lwip_flags=-DLWIP_OPEN_SRC - -build.vtable_flags=-DVTABLES_IN_FLASH - -#build.exception_flags=-fexceptions -build.exception_flags=-fno-exceptions -#build.stdcpp_lib=-lstdc++ -build.stdcpp_lib=-lstdc++-nox - -#build.float=-u _printf_float -u _scanf_float -build.float= -build.led= - -compiler.path={runtime.tools.xtensa-lx106-elf-gcc.path}/bin/ -compiler.sdk.path={runtime.platform.path}/tools/sdk -compiler.libc.path={runtime.platform.path}/tools/sdk/libc/xtensa-lx106-elf -compiler.cpreprocessor.flags=-D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ "-I{compiler.sdk.path}/include" "-I{compiler.sdk.path}/{build.lwip_include}" "-I{compiler.libc.path}/include" "-I{build.path}/core" - -compiler.c.cmd=xtensa-lx106-elf-gcc -compiler.c.flags=-c {compiler.warning_flags} -Os -g -Wpointer-arith -Wno-implicit-function-declaration -Wl,-EL -fno-inline-functions -nostdlib -mlongcalls -mtext-section-literals -falign-functions=4 -MMD -std=gnu99 {build.exception_flags} -ffunction-sections -fdata-sections {build.exception_flags} - -compiler.S.cmd=xtensa-lx106-elf-gcc -compiler.S.flags=-c -g -x assembler-with-cpp -MMD -mlongcalls - -compiler.c.elf.flags=-g {compiler.warning_flags} -Os -nostdlib -Wl,--no-check-sections -u app_entry {build.float} -Wl,-static "-L{compiler.sdk.path}/lib" "-L{compiler.sdk.path}/ld" "-L{compiler.libc.path}/lib" "-T{build.flash_ld}" -Wl,--gc-sections -Wl,-wrap,system_restart_local -Wl,-wrap,spi_flash_read - -compiler.c.elf.cmd=xtensa-lx106-elf-gcc -compiler.c.elf.libs=-lhal -lphy -lpp -lnet80211 {build.lwip_lib} -lwpa -lcrypto -lmain -lwps -lbearssl -laxtls -lespnow -lsmartconfig -lairkiss -lwpa2 {build.stdcpp_lib} -lm -lc -lgcc - -compiler.cpp.cmd=xtensa-lx106-elf-g++ -compiler.cpp.flags=-c {compiler.warning_flags} -Os -g -mlongcalls -mtext-section-literals -fno-rtti -falign-functions=4 -std=c++11 -MMD -ffunction-sections -fdata-sections {build.exception_flags} - -compiler.as.cmd=xtensa-lx106-elf-as - -compiler.ar.cmd=xtensa-lx106-elf-ar -compiler.ar.flags=cru - -compiler.elf2hex.cmd=esptool -compiler.elf2hex.flags= - -compiler.size.cmd=xtensa-lx106-elf-size - -compiler.esptool.cmd=esptool -compiler.esptool.cmd.windows=esptool.exe - -# This can be overriden in boards.txt -build.extra_flags=-DESP8266 - -# These can be overridden in platform.local.txt -compiler.c.extra_flags= -compiler.c.elf.extra_flags= -compiler.S.extra_flags= -compiler.cpp.extra_flags= -compiler.ar.extra_flags= -compiler.objcopy.eep.extra_flags= -compiler.elf2hex.extra_flags= - -## generate file with git version number -## needs bash, git, and echo -recipe.hooks.core.prebuild.1.pattern=python "{runtime.tools.signing}" --mode header --publickey "{build.source.path}/public.key" --out "{build.path}/core/Updater_Signing.h" - - - -## windows-compatible version without git -recipe.hooks.core.prebuild.1.pattern.windows=cmd.exe /c rem cannot sign on windows - - - -## Build the app.ld linker file -recipe.hooks.linking.prelink.1.pattern="{compiler.path}{compiler.c.cmd}" -CC -E -P {build.vtable_flags} "{runtime.platform.path}/tools/sdk/ld/eagle.app.v6.common.ld.h" -o "{build.path}/local.eagle.app.v6.common.ld" - -## Compile c files -recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.cpreprocessor.flags} {compiler.c.flags} -DF_CPU={build.f_cpu} {build.lwip_flags} {build.debug_port} {build.debug_level} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} -DARDUINO_BOARD="{build.board}" {build.led} {compiler.c.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{object_file}" - -## Compile c++ files -recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpreprocessor.flags} {compiler.cpp.flags} -DF_CPU={build.f_cpu} {build.lwip_flags} {build.debug_port} {build.debug_level} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} -DARDUINO_BOARD="{build.board}" {build.led} {compiler.cpp.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{object_file}" - -## Compile S files -recipe.S.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.cpreprocessor.flags} {compiler.S.flags} -DF_CPU={build.f_cpu} {build.lwip_flags} {build.debug_port} {build.debug_level} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} -DARDUINO_BOARD="{build.board}" {build.led} {compiler.c.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{object_file}" - -## Create archives -recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{archive_file_path}" "{object_file}" - -## Combine gc-sections, archives, and objects -recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" -Wl,-Map "-Wl,{build.path}/{build.project_name}.map" {compiler.c.elf.flags} {compiler.c.elf.extra_flags} -o "{build.path}/{build.project_name}.elf" -Wl,--start-group {object_files} "{archive_file_path}" {compiler.c.elf.libs} -Wl,--end-group "-L{build.path}" - -## Create eeprom -recipe.objcopy.eep.pattern= - -## Create hex -#recipe.objcopy.hex.pattern="{compiler.path}{compiler.elf2hex.cmd}" {compiler.elf2hex.flags} {compiler.elf2hex.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.hex" - -recipe.objcopy.hex.1.pattern="{runtime.tools.esptool.path}/{compiler.esptool.cmd}" -eo "{runtime.platform.path}/bootloaders/eboot/eboot.elf" -bo "{build.path}/{build.project_name}.bin" -bm {build.flash_mode} -bf {build.flash_freq} -bz {build.flash_size} -bs .text -bp 4096 -ec -eo "{build.path}/{build.project_name}.elf" -bs .irom0.text -bs .text -bs .data -bs .rodata -bc -ec -recipe.objcopy.hex.2.pattern=python "{runtime.tools.signing}" --mode sign --privatekey "{build.source.path}/private.key" --bin "{build.path}/{build.project_name}.bin" --out "{build.path}/{build.project_name}.bin.signed" - -# No signing on Windows -recipe.objcopy.hex.1.pattern.windows="{runtime.tools.esptool.path}/{compiler.esptool.cmd}" -eo "{runtime.platform.path}/bootloaders/eboot/eboot.elf" -bo "{build.path}/{build.project_name}.bin" -bm {build.flash_mode} -bf {build.flash_freq} -bz {build.flash_size} -bs .text -bp 4096 -ec -eo "{build.path}/{build.project_name}.elf" -bs .irom0.text -bs .text -bs .data -bs .rodata -bc -ec -recipe.objcopy.hex.2.pattern.windows= - -## Save hex -recipe.output.tmp_file={build.project_name}.bin -recipe.output.save_file={build.project_name}.{build.variant}.bin - -## Compute size -recipe.size.pattern="{compiler.path}{compiler.size.cmd}" -A "{build.path}/{build.project_name}.elf" -recipe.size.regex=^(?:\.irom0\.text|\.text|\.data|\.rodata|)\s+([0-9]+).* -recipe.size.regex.data=^(?:\.data|\.rodata|\.bss)\s+([0-9]+).* -#recipe.size.regex.eeprom=^(?:\.eeprom)\s+([0-9]+).* - -# ------------------------------ - -tools.esptool.cmd=esptool -tools.esptool.cmd.windows=esptool.exe -tools.esptool.path={runtime.tools.esptool.path} -tools.esptool.network_cmd=python -tools.esptool.network_cmd.windows=python.exe - -tools.esptool.upload.protocol=esp -tools.esptool.upload.params.verbose=-vv -tools.esptool.upload.params.quiet= -tools.esptool.upload.pattern="{path}/{cmd}" {upload.verbose} -cd {upload.resetmethod} -cb {upload.speed} -cp "{serial.port}" {upload.erase_cmd} -ca 0x00000 -cf "{build.path}/{build.project_name}.bin" -tools.esptool.upload.network_pattern="{network_cmd}" "{runtime.platform.path}/tools/espota.py" -i "{serial.port}" -p "{network.port}" "--auth={network.password}" -f "{build.path}/{build.project_name}.bin" - -tools.mkspiffs.cmd=mkspiffs -tools.mkspiffs.cmd.windows=mkspiffs.exe -tools.mkspiffs.path={runtime.tools.mkspiffs.path} - -tools.espupload.cmd=python -tools.espupload.cmd.windows=python.exe -tools.espupload.path={runtime.platform.path}/tools -tools.espupload.upload.protocol=espupload -tools.espupload.upload.params.verbose= -tools.espupload.upload.params.quiet= -tools.espupload.upload.pattern="{cmd}" "{path}/espupload.py" -f "{build.path}/{build.project_name}.bin" diff --git a/arduino/version 2.5.0-beta3/boards.txt b/arduino/version 2.5.0/boards.txt similarity index 99% rename from arduino/version 2.5.0-beta3/boards.txt rename to arduino/version 2.5.0/boards.txt index 542054e59..300a608c4 100644 --- a/arduino/version 2.5.0-beta3/boards.txt +++ b/arduino/version 2.5.0/boards.txt @@ -1330,8 +1330,8 @@ cw01.upload.resetmethod=nodemcu cw01.menu.CrystalFreq.26=26 MHz cw01.menu.CrystalFreq.40=40 MHz cw01.menu.CrystalFreq.40.build.extra_flags=-DF_CRYSTAL=40000000 -DESP8266 -cw01.build.flash_mode=qio -cw01.build.flash_flags=-DFLASHMODE_QIO +cw01.build.flash_mode=dio +cw01.build.flash_flags=-DFLASHMODE_DIO cw01.build.flash_freq=40 cw01.menu.eesz.4M=4M (no SPIFFS) cw01.menu.eesz.4M.build.flash_size=4M @@ -6119,4 +6119,3 @@ espectro.menu.baud.512000.windows=512000 espectro.menu.baud.512000.upload.speed=512000 espectro.menu.baud.921600=921600 espectro.menu.baud.921600.upload.speed=921600 - diff --git a/arduino/version 2.5.0-beta3/platform.txt b/arduino/version 2.5.0/platform.txt similarity index 86% rename from arduino/version 2.5.0-beta3/platform.txt rename to arduino/version 2.5.0/platform.txt index a790bc6c0..caa408904 100644 --- a/arduino/version 2.5.0-beta3/platform.txt +++ b/arduino/version 2.5.0/platform.txt @@ -1,154 +1,155 @@ - -# ESP8266 platform -# ------------------------------ - -# For more info: -# https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5---3rd-party-Hardware-specification - -name=ESP8266 Boards (2.5.0-beta3) -version=2.5.0-beta3 - - - -runtime.tools.signing={runtime.platform.path}/tools/signing.py - -compiler.warning_flags=-w -compiler.warning_flags.none=-w -compiler.warning_flags.default= -compiler.warning_flags.more=-Wall -compiler.warning_flags.all=-Wall -Wextra - -build.lwip_lib=-llwip_gcc -build.lwip_include=lwip/include -build.lwip_flags=-DLWIP_OPEN_SRC - -build.vtable_flags=-DVTABLES_IN_FLASH - -build.exception_flags=-fno-exceptions -build.stdcpp_lib=-lstdc++ - -#build.float=-u _printf_float -u _scanf_float -build.float= -build.led= - -compiler.path={runtime.tools.xtensa-lx106-elf-gcc.path}/bin/ -compiler.sdk.path={runtime.platform.path}/tools/sdk -compiler.libc.path={runtime.platform.path}/tools/sdk/libc/xtensa-lx106-elf -compiler.cpreprocessor.flags=-D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ "-I{compiler.sdk.path}/include" "-I{compiler.sdk.path}/{build.lwip_include}" "-I{compiler.libc.path}/include" "-I{build.path}/core" - -compiler.c.cmd=xtensa-lx106-elf-gcc -compiler.c.flags=-c {compiler.warning_flags} -Os -g -Wpointer-arith -Wno-implicit-function-declaration -Wl,-EL -fno-inline-functions -nostdlib -mlongcalls -mtext-section-literals -falign-functions=4 -MMD -std=gnu99 -ffunction-sections -fdata-sections {build.exception_flags} - -compiler.S.cmd=xtensa-lx106-elf-gcc -compiler.S.flags=-c -g -x assembler-with-cpp -MMD -mlongcalls - -compiler.c.elf.flags=-g {compiler.warning_flags} -Os -nostdlib -Wl,--no-check-sections -u app_entry {build.float} -Wl,-static "-L{compiler.sdk.path}/lib" "-L{compiler.sdk.path}/ld" "-L{compiler.libc.path}/lib" "-T{build.flash_ld}" -Wl,--gc-sections -Wl,-wrap,system_restart_local -Wl,-wrap,spi_flash_read - -compiler.c.elf.cmd=xtensa-lx106-elf-gcc -compiler.c.elf.libs=-lhal -lphy -lpp -lnet80211 {build.lwip_lib} -lwpa -lcrypto -lmain -lwps -lbearssl -laxtls -lespnow -lsmartconfig -lairkiss -lwpa2 {build.stdcpp_lib} -lm -lc -lgcc - -compiler.cpp.cmd=xtensa-lx106-elf-g++ -compiler.cpp.flags=-c {compiler.warning_flags} -Os -g -mlongcalls -mtext-section-literals -fno-rtti -falign-functions=4 -std=c++11 -MMD -ffunction-sections -fdata-sections {build.exception_flags} - -compiler.as.cmd=xtensa-lx106-elf-as - -compiler.ar.cmd=xtensa-lx106-elf-ar -compiler.ar.flags=cru - -compiler.elf2hex.cmd=esptool -compiler.elf2hex.flags= - -compiler.size.cmd=xtensa-lx106-elf-size - -compiler.esptool.cmd=esptool -compiler.esptool.cmd.windows=esptool.exe - -# This can be overriden in boards.txt -build.extra_flags=-DESP8266 - -# These can be overridden in platform.local.txt -compiler.c.extra_flags= -compiler.c.elf.extra_flags= -compiler.S.extra_flags= -compiler.cpp.extra_flags= -compiler.ar.extra_flags= -compiler.objcopy.eep.extra_flags= -compiler.elf2hex.extra_flags= - -## generate file with git version number -## needs bash, git, and echo -recipe.hooks.core.prebuild.1.pattern=python "{runtime.tools.signing}" --mode header --publickey "{build.source.path}/public.key" --out "{build.path}/core/Updater_Signing.h" - - - -## windows-compatible version without git -recipe.hooks.core.prebuild.1.pattern.windows=cmd.exe /c rem cannot sign on windows - - - -## Build the app.ld linker file -recipe.hooks.linking.prelink.1.pattern="{compiler.path}{compiler.c.cmd}" -CC -E -P {build.vtable_flags} "{runtime.platform.path}/tools/sdk/ld/eagle.app.v6.common.ld.h" -o "{build.path}/local.eagle.app.v6.common.ld" - -## Compile c files -recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.cpreprocessor.flags} {compiler.c.flags} -DF_CPU={build.f_cpu} {build.lwip_flags} {build.debug_port} {build.debug_level} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} -DARDUINO_BOARD="{build.board}" {build.led} {build.flash_flags} {compiler.c.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{object_file}" - -## Compile c++ files -recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpreprocessor.flags} {compiler.cpp.flags} -DF_CPU={build.f_cpu} {build.lwip_flags} {build.debug_port} {build.debug_level} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} -DARDUINO_BOARD="{build.board}" {build.led} {build.flash_flags} {compiler.cpp.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{object_file}" - -## Compile S files -recipe.S.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.cpreprocessor.flags} {compiler.S.flags} -DF_CPU={build.f_cpu} {build.lwip_flags} {build.debug_port} {build.debug_level} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} -DARDUINO_BOARD="{build.board}" {build.led} {build.flash_flags} {compiler.c.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{object_file}" - -## Create archives -recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{archive_file_path}" "{object_file}" - -## Combine gc-sections, archives, and objects -recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {build.exception_flags} -Wl,-Map "-Wl,{build.path}/{build.project_name}.map" {compiler.c.elf.flags} {compiler.c.elf.extra_flags} -o "{build.path}/{build.project_name}.elf" -Wl,--start-group {object_files} "{archive_file_path}" {compiler.c.elf.libs} -Wl,--end-group "-L{build.path}" - -## Create eeprom -recipe.objcopy.eep.pattern= - -## Create hex -#recipe.objcopy.hex.pattern="{compiler.path}{compiler.elf2hex.cmd}" {compiler.elf2hex.flags} {compiler.elf2hex.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.hex" - -recipe.objcopy.hex.1.pattern="{runtime.tools.esptool.path}/{compiler.esptool.cmd}" -eo "{runtime.platform.path}/bootloaders/eboot/eboot.elf" -bo "{build.path}/{build.project_name}.bin" -bm {build.flash_mode} -bf {build.flash_freq} -bz {build.flash_size} -bs .text -bp 4096 -ec -eo "{build.path}/{build.project_name}.elf" -bs .irom0.text -bs .text -bs .data -bs .rodata -bc -ec -recipe.objcopy.hex.2.pattern=python "{runtime.tools.signing}" --mode sign --privatekey "{build.source.path}/private.key" --bin "{build.path}/{build.project_name}.bin" --out "{build.path}/{build.project_name}.bin.signed" - -# No signing on Windows -recipe.objcopy.hex.1.pattern.windows="{runtime.tools.esptool.path}/{compiler.esptool.cmd}" -eo "{runtime.platform.path}/bootloaders/eboot/eboot.elf" -bo "{build.path}/{build.project_name}.bin" -bm {build.flash_mode} -bf {build.flash_freq} -bz {build.flash_size} -bs .text -bp 4096 -ec -eo "{build.path}/{build.project_name}.elf" -bs .irom0.text -bs .text -bs .data -bs .rodata -bc -ec -recipe.objcopy.hex.2.pattern.windows= - -## Save hex -recipe.output.tmp_file={build.project_name}.bin -recipe.output.save_file={build.project_name}.{build.variant}.bin - -## Compute size -recipe.size.pattern="{compiler.path}{compiler.size.cmd}" -A "{build.path}/{build.project_name}.elf" -recipe.size.regex=^(?:\.irom0\.text|\.text|\.data|\.rodata|)\s+([0-9]+).* -recipe.size.regex.data=^(?:\.data|\.rodata|\.bss)\s+([0-9]+).* -#recipe.size.regex.eeprom=^(?:\.eeprom)\s+([0-9]+).* - -# ------------------------------ - -tools.esptool.cmd=esptool -tools.esptool.cmd.windows=esptool.exe -tools.esptool.path={runtime.tools.esptool.path} -tools.esptool.network_cmd=python -tools.esptool.network_cmd.windows=python.exe - -tools.esptool.upload.protocol=esp -tools.esptool.upload.params.verbose=-vv -tools.esptool.upload.params.quiet= -tools.esptool.upload.pattern="{path}/{cmd}" {upload.verbose} -cd {upload.resetmethod} -cb {upload.speed} -cp "{serial.port}" {upload.erase_cmd} -ca 0x00000 -cf "{build.path}/{build.project_name}.bin" -tools.esptool.upload.network_pattern="{network_cmd}" "{runtime.platform.path}/tools/espota.py" -i "{serial.port}" -p "{network.port}" "--auth={network.password}" -f "{build.path}/{build.project_name}.bin" - -tools.mkspiffs.cmd=mkspiffs -tools.mkspiffs.cmd.windows=mkspiffs.exe -tools.mkspiffs.path={runtime.tools.mkspiffs.path} - -tools.espupload.cmd=python -tools.espupload.cmd.windows=python.exe -tools.espupload.path={runtime.platform.path}/tools -tools.espupload.upload.protocol=espupload -tools.espupload.upload.params.verbose= -tools.espupload.upload.params.quiet= -tools.espupload.upload.pattern="{cmd}" "{path}/espupload.py" -f "{build.path}/{build.project_name}.bin" + +# ESP8266 platform +# ------------------------------ + +# For more info: +# https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5---3rd-party-Hardware-specification + +name=ESP8266 Boards (2.5.0) +version=2.5.0 + +runtime.tools.xtensa-lx106-elf-gcc.path={runtime.platform.path}/tools/xtensa-lx106-elf +runtime.tools.esptool.path={runtime.platform.path}/tools/esptool +runtime.tools.signing={runtime.platform.path}/tools/signing.py + +compiler.warning_flags=-w +compiler.warning_flags.none=-w +compiler.warning_flags.default= +compiler.warning_flags.more=-Wall +compiler.warning_flags.all=-Wall -Wextra + +build.lwip_lib=-llwip_gcc +build.lwip_include=lwip/include +build.lwip_flags=-DLWIP_OPEN_SRC + +build.vtable_flags=-DVTABLES_IN_FLASH + +build.exception_flags=-fno-exceptions +build.stdcpp_lib=-lstdc++ + +#build.float=-u _printf_float -u _scanf_float +build.float= +build.led= + +compiler.path={runtime.tools.xtensa-lx106-elf-gcc.path}/bin/ +compiler.sdk.path={runtime.platform.path}/tools/sdk +compiler.libc.path={runtime.platform.path}/tools/sdk/libc/xtensa-lx106-elf +compiler.cpreprocessor.flags=-D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ "-I{compiler.sdk.path}/include" "-I{compiler.sdk.path}/{build.lwip_include}" "-I{compiler.libc.path}/include" "-I{build.path}/core" + +compiler.c.cmd=xtensa-lx106-elf-gcc +compiler.c.flags=-c {compiler.warning_flags} -Os -g -Wpointer-arith -Wno-implicit-function-declaration -Wl,-EL -fno-inline-functions -nostdlib -mlongcalls -mtext-section-literals -falign-functions=4 -MMD -std=gnu99 -ffunction-sections -fdata-sections {build.exception_flags} + +compiler.S.cmd=xtensa-lx106-elf-gcc +compiler.S.flags=-c -g -x assembler-with-cpp -MMD -mlongcalls + +compiler.c.elf.flags=-g {compiler.warning_flags} -Os -nostdlib -Wl,--no-check-sections -u app_entry {build.float} -Wl,-static "-L{compiler.sdk.path}/lib" "-L{compiler.sdk.path}/ld" "-L{compiler.libc.path}/lib" "-T{build.flash_ld}" -Wl,--gc-sections -Wl,-wrap,system_restart_local -Wl,-wrap,spi_flash_read + +compiler.c.elf.cmd=xtensa-lx106-elf-gcc +compiler.c.elf.libs=-lhal -lphy -lpp -lnet80211 {build.lwip_lib} -lwpa -lcrypto -lmain -lwps -lbearssl -laxtls -lespnow -lsmartconfig -lairkiss -lwpa2 {build.stdcpp_lib} -lm -lc -lgcc + +compiler.cpp.cmd=xtensa-lx106-elf-g++ +compiler.cpp.flags=-c {compiler.warning_flags} -Os -g -mlongcalls -mtext-section-literals -fno-rtti -falign-functions=4 -std=c++11 -MMD -ffunction-sections -fdata-sections {build.exception_flags} + +compiler.as.cmd=xtensa-lx106-elf-as + +compiler.ar.cmd=xtensa-lx106-elf-ar +compiler.ar.flags=cru + +compiler.elf2hex.cmd=esptool +compiler.elf2hex.flags= + +compiler.size.cmd=xtensa-lx106-elf-size + +compiler.esptool.cmd=esptool +compiler.esptool.cmd.windows=esptool.exe + +# This can be overriden in boards.txt +build.extra_flags=-DESP8266 + +# These can be overridden in platform.local.txt +compiler.c.extra_flags= +compiler.c.elf.extra_flags= +compiler.S.extra_flags= +compiler.cpp.extra_flags= +compiler.ar.extra_flags= +compiler.objcopy.eep.extra_flags= +compiler.elf2hex.extra_flags= + +## generate file with git version number +## needs bash, git, and echo +recipe.hooks.core.prebuild.1.pattern=python "{runtime.tools.signing}" --mode header --publickey "{build.source.path}/public.key" --out "{build.path}/core/Updater_Signing.h" +recipe.hooks.core.prebuild.2.pattern=bash -c "mkdir -p {build.path}/core && echo \#define ARDUINO_ESP8266_GIT_VER 0x`git --git-dir {runtime.platform.path}/.git rev-parse --short=8 HEAD 2>/dev/null || echo ffffffff` >{build.path}/core/core_version.h" +recipe.hooks.core.prebuild.3.pattern=bash -c "mkdir -p {build.path}/core && echo \#define ARDUINO_ESP8266_GIT_DESC `cd "{runtime.platform.path}"; git describe --tags 2>/dev/null || echo unix-{version}` >>{build.path}/core/core_version.h" + +## windows-compatible version without git +recipe.hooks.core.prebuild.1.pattern.windows=cmd.exe /c rem cannot sign on windows +recipe.hooks.core.prebuild.2.pattern.windows=cmd.exe /c mkdir {build.path}\core & (echo #define ARDUINO_ESP8266_GIT_VER 0x00000000 & echo #define ARDUINO_ESP8266_GIT_DESC win-{version} ) > {build.path}\core\core_version.h +recipe.hooks.core.prebuild.3.pattern.windows=cmd.exe /c if exist {build.source.path}\public.key echo #error Cannot automatically build signed binaries on Windows > {build.path}\core\Updater_Signing.h + +## Build the app.ld linker file +recipe.hooks.linking.prelink.1.pattern="{compiler.path}{compiler.c.cmd}" -CC -E -P {build.vtable_flags} "{runtime.platform.path}/tools/sdk/ld/eagle.app.v6.common.ld.h" -o "{build.path}/local.eagle.app.v6.common.ld" + +## Compile c files +recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.cpreprocessor.flags} {compiler.c.flags} -DF_CPU={build.f_cpu} {build.lwip_flags} {build.debug_port} {build.debug_level} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} -DARDUINO_BOARD="{build.board}" {build.led} {build.flash_flags} {compiler.c.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{object_file}" + +## Compile c++ files +recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpreprocessor.flags} {compiler.cpp.flags} -DF_CPU={build.f_cpu} {build.lwip_flags} {build.debug_port} {build.debug_level} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} -DARDUINO_BOARD="{build.board}" {build.led} {build.flash_flags} {compiler.cpp.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{object_file}" + +## Compile S files +recipe.S.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.cpreprocessor.flags} {compiler.S.flags} -DF_CPU={build.f_cpu} {build.lwip_flags} {build.debug_port} {build.debug_level} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} -DARDUINO_BOARD="{build.board}" {build.led} {build.flash_flags} {compiler.c.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{object_file}" + +## Create archives +recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{archive_file_path}" "{object_file}" + +## Combine gc-sections, archives, and objects +recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {build.exception_flags} -Wl,-Map "-Wl,{build.path}/{build.project_name}.map" {compiler.c.elf.flags} {compiler.c.elf.extra_flags} -o "{build.path}/{build.project_name}.elf" -Wl,--start-group {object_files} "{archive_file_path}" {compiler.c.elf.libs} -Wl,--end-group "-L{build.path}" + +## Create eeprom +recipe.objcopy.eep.pattern= + +## Create hex +#recipe.objcopy.hex.pattern="{compiler.path}{compiler.elf2hex.cmd}" {compiler.elf2hex.flags} {compiler.elf2hex.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.hex" + +recipe.objcopy.hex.1.pattern="{runtime.tools.esptool.path}/{compiler.esptool.cmd}" -eo "{runtime.platform.path}/bootloaders/eboot/eboot.elf" -bo "{build.path}/{build.project_name}.bin" -bm {build.flash_mode} -bf {build.flash_freq} -bz {build.flash_size} -bs .text -bp 4096 -ec -eo "{build.path}/{build.project_name}.elf" -bs .irom0.text -bs .text -bs .data -bs .rodata -bc -ec +recipe.objcopy.hex.2.pattern=python "{runtime.tools.signing}" --mode sign --privatekey "{build.source.path}/private.key" --bin "{build.path}/{build.project_name}.bin" --out "{build.path}/{build.project_name}.bin.signed" + +# No signing on Windows +recipe.objcopy.hex.1.pattern.windows="{runtime.tools.esptool.path}/{compiler.esptool.cmd}" -eo "{runtime.platform.path}/bootloaders/eboot/eboot.elf" -bo "{build.path}/{build.project_name}.bin" -bm {build.flash_mode} -bf {build.flash_freq} -bz {build.flash_size} -bs .text -bp 4096 -ec -eo "{build.path}/{build.project_name}.elf" -bs .irom0.text -bs .text -bs .data -bs .rodata -bc -ec +recipe.objcopy.hex.2.pattern.windows= + +## Save hex +recipe.output.tmp_file={build.project_name}.bin +recipe.output.save_file={build.project_name}.{build.variant}.bin + +## Compute size +recipe.size.pattern="{compiler.path}{compiler.size.cmd}" -A "{build.path}/{build.project_name}.elf" +recipe.size.regex=^(?:\.irom0\.text|\.text|\.data|\.rodata|)\s+([0-9]+).* +recipe.size.regex.data=^(?:\.data|\.rodata|\.bss)\s+([0-9]+).* +#recipe.size.regex.eeprom=^(?:\.eeprom)\s+([0-9]+).* + +# ------------------------------ + +tools.esptool.cmd=esptool +tools.esptool.cmd.windows=esptool.exe +tools.esptool.path={runtime.tools.esptool.path} +tools.esptool.network_cmd=python +tools.esptool.network_cmd.windows=python.exe + +tools.esptool.upload.protocol=esp +tools.esptool.upload.params.verbose=-vv +tools.esptool.upload.params.quiet= +tools.esptool.upload.pattern="{path}/{cmd}" {upload.verbose} -cd {upload.resetmethod} -cb {upload.speed} -cp "{serial.port}" {upload.erase_cmd} -ca 0x00000 -cf "{build.path}/{build.project_name}.bin" +tools.esptool.upload.network_pattern="{network_cmd}" "{runtime.platform.path}/tools/espota.py" -i "{serial.port}" -p "{network.port}" "--auth={network.password}" -f "{build.path}/{build.project_name}.bin" + +tools.mkspiffs.cmd=mkspiffs +tools.mkspiffs.cmd.windows=mkspiffs.exe +tools.mkspiffs.path={runtime.tools.mkspiffs.path} + +tools.espupload.cmd=python +tools.espupload.cmd.windows=python.exe +tools.espupload.path={runtime.platform.path}/tools +tools.espupload.upload.protocol=espupload +tools.espupload.upload.params.verbose= +tools.espupload.upload.params.quiet= +tools.espupload.upload.pattern="{cmd}" "{path}/espupload.py" -f "{build.path}/{build.project_name}.bin" + diff --git a/lib/FrogmoreScd30/FrogmoreScd30.cpp b/lib/FrogmoreScd30/FrogmoreScd30.cpp new file mode 100644 index 000000000..32bbee5ba --- /dev/null +++ b/lib/FrogmoreScd30/FrogmoreScd30.cpp @@ -0,0 +1,653 @@ +/* +# Copyright (c) 2019 Frogmore42 +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ +#include +#include +#include +#include +#include + +#define COMMAND_SCD30_CONTINUOUS_MEASUREMENT 0x0010 +#define COMMAND_SCD30_MEASUREMENT_INTERVAL 0x4600 +#define COMMAND_SCD30_GET_DATA_READY 0x0202 +#define COMMAND_SCD30_READ_MEASUREMENT 0x0300 +#define COMMAND_SCD30_CALIBRATION_TYPE 0x5306 +#define COMMAND_SCD30_FORCED_RECALIBRATION_FACTOR 0x5204 +#define COMMAND_SCD30_TEMPERATURE_OFFSET 0x5403 +#define COMMAND_SCD30_ALTITUDE_COMPENSATION 0x5102 +#define COMMAND_SCD30_SOFT_RESET 0xD304 +#define COMMAND_SCD30_GET_FW_VERSION 0xD100 +#define COMMAND_SCD30_STOP_MEASUREMENT 0x0104 + +#define SCD30_DATA_REGISTER_BYTES 2 +#define SCD30_DATA_REGISTER_WITH_CRC 3 +#define SCD30_MEAS_BYTES 18 + +#ifdef SCD30_DEBUG +enum LoggingLevels {LOG_LEVEL_NONE, LOG_LEVEL_ERROR, LOG_LEVEL_INFO, LOG_LEVEL_DEBUG, LOG_LEVEL_DEBUG_MORE, LOG_LEVEL_ALL}; +char scd30log_data[180]; +#endif + +void FrogmoreScd30::begin(TwoWire *pWire, uint8_t i2cAddress) +{ + this->i2cAddress = i2cAddress; + if (pWire == NULL) + { + this->pWire = &Wire; + } + else + { + this->pWire = pWire; + } + + co2NewDataLocation = -1; // indicates there is no data, so the 1st data point needs to fill up the median filter + this->pWire->setClockStretchLimit(200000); + this->ambientPressure = 0; +} + +void FrogmoreScd30::begin(uint8_t i2cAddress) +{ + begin(NULL, i2cAddress); +} + +void FrogmoreScd30::begin(TwoWire *pWire) +{ + begin(pWire, SCD30_ADDRESS); +} + +void FrogmoreScd30::begin(void) +{ + begin(NULL, SCD30_ADDRESS); +} + +/*--------------------------------------------------------------------------- + Function : opt_med5() In : pointer to array of 5 values + Out : a uint16_t which is the middle value of the sorted array + Job : optimized search of the median of 5 values + Notice : found on sci.image.processing cannot go faster unless assumptions are made on the nature of the input signal. + ---------------------------------------------------------------------------*/ +#define PIX_SORT(a,b) { if ((a)>(b)) PIX_SWAP((a),(b)); } +#define PIX_SWAP(a,b) { uint16_t temp=(a);(a)=(b);(b)=temp; } + +uint16_t opt_med5(uint16_t * p) +{ + PIX_SORT(p[0], p[1]); + PIX_SORT(p[3], p[4]); + PIX_SORT(p[0], p[3]); + PIX_SORT(p[1], p[4]); + PIX_SORT(p[1], p[2]); + PIX_SORT(p[2], p[3]); + PIX_SORT(p[1], p[2]); + return(p[2]); +} + +// twi_status() attempts to read out any data left that is holding SDA low, so a new transaction can take place +// something like (http://www.forward.com.au/pfod/ArduinoProgramming/I2C_ClearBus/index.html) +int FrogmoreScd30::clearI2CBus(void) +{ +#ifdef SCD30_DEBUG + snprintf_P(scd30log_data, sizeof(scd30log_data), "clearI2CBus"); + AddLog(LOG_LEVEL_DEBUG_MORE); +#endif + return (twi_status()); +} + +#ifdef SCD30_DEBUG +void FrogmoreScd30::AddLog(uint8_t loglevel) +{ + if (loglevel <= LOG_LEVEL_INFO) + { + Serial.printf("%s\r\n", scd30log_data); + } +} +#endif + +uint8_t FrogmoreScd30::computeCRC8(uint8_t data[], uint8_t len) +// Computes the CRC that the SCD30 uses +{ + uint8_t crc = 0xFF; //Init with 0xFF + + for (uint8_t x = 0 ; x < len ; x++) + { + crc ^= data[x]; // XOR-in the next input byte + for (uint8_t i = 0 ; i < 8 ; i++) + { + if ((crc & 0x80) != 0) + crc = (uint8_t)((crc << 1) ^ 0x31); + else + crc <<= 1; + } + } + + return crc; //No output reflection +} + +// Sends stream of bytes to device +int FrogmoreScd30::sendBytes(void *pInput, uint8_t len) +{ + uint8_t *pBytes = (uint8_t *) pInput; + int result; + uint8_t errorBytes = 0; // number of bytes that had an error in transmission +#ifdef SCD30_DEBUG + snprintf_P(scd30log_data, sizeof(scd30log_data), "Scd30SendBytes: data: 0x %02X %02X %02X | 0x %02X %02X %02X | 0x %02X %02X %02X", pBytes[0], pBytes[1], pBytes[2], pBytes[3], pBytes[4], pBytes[5], pBytes[6], pBytes[7], pBytes[8]); + AddLog(LOG_LEVEL_DEBUG_MORE); +#endif + pWire->beginTransmission(this->i2cAddress); + errorBytes = len - (pWire->write(pBytes, len)); + result = pWire->endTransmission(); + if (errorBytes || result) + { +#ifdef SCD30_DEBUG + snprintf_P(scd30log_data, sizeof(scd30log_data), "Scd30SendBytes: errorBytes: %d | Wire.end: %d", errorBytes, result); + AddLog(LOG_LEVEL_INFO); +#endif + } + + result <<= 8; // leave room for error bytes number + result |= errorBytes; // low byte has number of bytes that were not written correctly + return (result); +} + +// Gets a number of bytes from device +int FrogmoreScd30::getBytes(void *pOutput, uint8_t len) +{ + uint8_t *pBytes = (uint8_t *) pOutput; + uint8_t result; + + result = pWire->requestFrom(this->i2cAddress, len); + if (len != result) + { +#ifdef SCD30_DEBUG + snprintf_P(scd30log_data, sizeof(scd30log_data), "Scd30GetBytes: wire request expected %d got: %d", len, result); + AddLog(LOG_LEVEL_INFO); +#endif + return (ERROR_SCD30_NOT_ENOUGH_BYTES_ERROR); + } + + if (pWire->available()) + { + for (int x = 0; x < len; x++) + { + pBytes[x] = pWire->read(); + } +#ifdef SCD30_DEBUG + snprintf_P(scd30log_data, sizeof(scd30log_data), "Scd30GetBytes: data: 0x %02X %02X %02X | 0x %02X %02X %02X | 0x %02X %02X %02X", pBytes[0], pBytes[1], pBytes[2], pBytes[3], pBytes[4], pBytes[5], pBytes[6], pBytes[7], pBytes[8]); + AddLog(LOG_LEVEL_DEBUG_MORE); +#endif + return (ERROR_SCD30_NO_ERROR); + } + + return (ERROR_SCD30_UNKNOWN_ERROR); +} + +//Sends just a command, no arguments, no CRC +int FrogmoreScd30::sendCommand(uint16_t command) +{ + uint8_t data[2]; + data[0] = command >> 8; + data[1] = command & 0xFF; + int error = sendBytes(data, sizeof(data)); + if (error) + { +#ifdef SCD30_DEBUG + snprintf_P(scd30log_data, sizeof(scd30log_data), "Scd30SendCommand: Scd30SendBytes failed: 0x%lX", error); + AddLog(LOG_LEVEL_INFO); +#endif + } + return (error); +} + +//Sends a command along with arguments and CRC +int FrogmoreScd30::sendCommandArguments(uint16_t command, uint16_t arguments) +{ + uint8_t data[5]; + data[0] = command >> 8; + data[1] = command & 0xFF; + data[2] = arguments >> 8; + data[3] = arguments & 0xFF; + data[4] = computeCRC8(&data[2], 2); //Calc CRC on the arguments only, not the command + int error = sendBytes(data, sizeof(data)); + if (error) + { +#ifdef SCD30_DEBUG + snprintf_P(scd30log_data, sizeof(scd30log_data), "Scd30SendCommandArguments: Scd30SendBytes failed: 0x%lX", error); + AddLog(LOG_LEVEL_INFO); +#endif + } + return (error); +} + +int FrogmoreScd30::get16BitRegCheckCRC(void* pInput, uint16_t *pData) +{ + uint8_t *pBytes = (uint8_t *) pInput; + uint8_t expectedCRC = computeCRC8(pBytes, SCD30_DATA_REGISTER_BYTES); + if (expectedCRC != pBytes[SCD30_DATA_REGISTER_BYTES]) + { +#ifdef SCD30_DEBUG + snprintf_P(scd30log_data, sizeof(scd30log_data), "Scd30get16BitRegCheckCRC: expected: 0x%02X, but got: 0x%02X", expectedCRC, pBytes[SCD30_DATA_REGISTER_BYTES]); + AddLog(LOG_LEVEL_INFO); + snprintf_P(scd30log_data, sizeof(scd30log_data), "Scd30get16BitRegCheckCRC: data: 0x%02X, 0x%02X, 0x%02X", pBytes[0], pBytes[1], pBytes[2]); + AddLog(LOG_LEVEL_INFO); +#endif + return (ERROR_SCD30_CRC_ERROR); + } + *pData = (uint16_t) pBytes[0] << 8 | pBytes[1]; // data from SCD30 is Big-Endian + return (ERROR_SCD30_NO_ERROR); +} + +// gets 32 bits, (2) 16-bit chunks, and validates the CRCs +// +int FrogmoreScd30::get32BitRegCheckCRC(void *pInput, float *pData) +{ + uint16_t tempU16High; + uint16_t tempU16Low; + uint8_t *pBytes = (uint8_t *) pInput; + uint32_t rawInt = 0; + + int error = get16BitRegCheckCRC(pBytes, &tempU16High); + if (error) { + return (error); + } + + error = get16BitRegCheckCRC(pBytes + SCD30_DATA_REGISTER_WITH_CRC, &tempU16Low); + if (error) { + return (error); + } + + // data from SCD is Big-Endian + rawInt |= tempU16High; + rawInt <<= 16; + rawInt |= tempU16Low; + + *pData = * (float *) &rawInt; +#ifdef SCD30_DEBUG + snprintf_P(scd30log_data, sizeof(scd30log_data), "get32BitRegCheckCRC: got: tempUs 0x%lX, %lX", tempU16High, tempU16Low); + AddLog(LOG_LEVEL_DEBUG); +#endif + + if (isnan(*pData) || isinf(*pData)) + { +#ifdef SCD30_DEBUG + snprintf_P(scd30log_data, sizeof(scd30log_data), "get32BitRegCheckCRC: not a floating point number: rawInt 0x%lX", rawInt); + AddLog(LOG_LEVEL_INFO); +#endif + return (ERROR_SCD30_NOT_A_NUMBER_ERROR); + } + + return (ERROR_SCD30_NO_ERROR); +} + +//Gets two bytes (and check CRC) from SCD30 +int FrogmoreScd30::readRegister(uint16_t registerAddress, uint16_t* pData) +{ + int error = sendCommand(registerAddress); + if (error) + { +#ifdef SCD30_DEBUG + snprintf_P(scd30log_data, sizeof(scd30log_data), "Scd30ReadRegister: SendCommand error: 0x%lX", error); + AddLog(LOG_LEVEL_INFO); +#endif + return (error); + } + delay(1); // the SCD30 uses clock streching to give it time to prepare data, waiting here makes it work + uint8_t data[SCD30_DATA_REGISTER_WITH_CRC]; + error = getBytes(data, sizeof(data)); + if (error) + { +#ifdef SCD30_DEBUG + snprintf_P(scd30log_data, sizeof(scd30log_data), "Scd30ReadRegister: Scd30GetBytes error: 0x%lX", error); + AddLog(LOG_LEVEL_INFO); +#endif + return (error); + } + uint16 regValue; + error = get16BitRegCheckCRC(data, ®Value); + if (error) + { +#ifdef SCD30_DEBUG + snprintf_P(scd30log_data, sizeof(scd30log_data), "Scd30ReadRegister: Scd30get16BitRegCheckCRC error: 0x%lX", error); + AddLog(LOG_LEVEL_INFO); +#endif + return (error); + } + + *pData = regValue; + return (ERROR_SCD30_NO_ERROR); +} + +int FrogmoreScd30::softReset(void) +{ + return (sendCommand(COMMAND_SCD30_SOFT_RESET)); +} + +int FrogmoreScd30::getAltitudeCompensation(uint16_t *pHeight_meter) +{ + return (readRegister(COMMAND_SCD30_ALTITUDE_COMPENSATION, pHeight_meter)); +} + +int FrogmoreScd30::getAmbientPressure(uint16_t *pAirPressure_mbar) +{ + *pAirPressure_mbar = ambientPressure; + return (ERROR_SCD30_NO_ERROR); +} + +int FrogmoreScd30::getCalibrationType(uint16_t *pIsAuto) +{ + uint16_t value = 0; + int error = readRegister(COMMAND_SCD30_CALIBRATION_TYPE, &value); + if (!error) + { + *pIsAuto = value != 0; + } + return (error); +} + +int FrogmoreScd30::getFirmwareVersion(uint8_t *pMajor, uint8_t *pMinor) +{ + uint16_t value; + int error = readRegister(COMMAND_SCD30_GET_FW_VERSION, &value); + if (!error) + { + *pMajor = value >> 8; + *pMinor = value & 0xFF; + } + return (error); +} + +int FrogmoreScd30::getForcedRecalibrationFactor(uint16_t *pCo2_ppm) +{ + return (readRegister(COMMAND_SCD30_FORCED_RECALIBRATION_FACTOR, pCo2_ppm)); +} + +int FrogmoreScd30::getMeasurementInterval(uint16_t *pTime_sec) +{ + return (readRegister(COMMAND_SCD30_MEASUREMENT_INTERVAL, pTime_sec)); +} + +int FrogmoreScd30::getTemperatureOffset(float *pOffset_degC) +{ + uint16_t value; + int error = readRegister(COMMAND_SCD30_TEMPERATURE_OFFSET, &value); + if (!error) + { + // result is in centi-degrees, need to convert to degrees + *pOffset_degC = (float) value / 100.0; + } + return (error); +} + +int FrogmoreScd30::getTemperatureOffset(uint16_t *pOffset_centiDegC) +{ + uint16_t value; + int error = readRegister(COMMAND_SCD30_TEMPERATURE_OFFSET, &value); + if (!error) + { + // result is in centi-degrees, need to convert to degrees + *pOffset_centiDegC = value; + } + return (error); +} + +int FrogmoreScd30::setAltitudeCompensation(uint16_t height_meter) +{ + return (sendCommandArguments(COMMAND_SCD30_ALTITUDE_COMPENSATION, height_meter)); +} + +int FrogmoreScd30::setAmbientPressure(uint16_t airPressure_mbar) +{ + ambientPressure = airPressure_mbar; + return (beginMeasuring(ambientPressure)); +} + +int FrogmoreScd30::setAutoSelfCalibration(void) +{ + bool isAuto = true; + return (setCalibrationType(isAuto)); +} + +int FrogmoreScd30::setCalibrationType(bool isAuto) +{ + bool value = !!isAuto; // using NOT operator twice makes sure value is 0 or 1 + return (sendCommandArguments(COMMAND_SCD30_CALIBRATION_TYPE, value)); +} + +int FrogmoreScd30::setForcedRecalibrationFactor(uint16_t co2_ppm) +{ + return (sendCommandArguments(COMMAND_SCD30_FORCED_RECALIBRATION_FACTOR, co2_ppm)); +} + +int FrogmoreScd30::setManualCalibration(void) +{ + bool isAuto = false; + return (setCalibrationType(isAuto)); +} + +int FrogmoreScd30::setMeasurementInterval(uint16_t time_sec) +{ + if (time_sec < 2) time_sec = 2; + if (time_sec > 1800) time_sec = 1800; + return (sendCommandArguments(COMMAND_SCD30_MEASUREMENT_INTERVAL, time_sec)); +} + +int FrogmoreScd30::setTemperatureOffset(float offset_degC) +{ + uint16_t offset_centiDegC; + if (offset_degC >= 0) + { + offset_centiDegC = (uint16_t) offset_degC * 100; + return (sendCommandArguments(COMMAND_SCD30_TEMPERATURE_OFFSET, offset_centiDegC)); + } + else + { + return (ERROR_SCD30_INVALID_VALUE); + } + +} + +int FrogmoreScd30::setTemperatureOffset(uint16_t offset_centiDegC) +{ + return (sendCommandArguments(COMMAND_SCD30_TEMPERATURE_OFFSET, offset_centiDegC)); +} + +int FrogmoreScd30::beginMeasuring(void) +{ + return (beginMeasuring(ambientPressure)); +} + +int FrogmoreScd30::beginMeasuring(uint16_t airPressure_mbar) +{ + ambientPressure = airPressure_mbar; + return(sendCommandArguments(COMMAND_SCD30_CONTINUOUS_MEASUREMENT, ambientPressure)); +} + +int FrogmoreScd30::isDataAvailable(bool *pIsAvailable) +{ + uint16_t isDataAvailable = false; + int error = readRegister(COMMAND_SCD30_GET_DATA_READY, &isDataAvailable); + if (!error) + { + *pIsAvailable = isDataAvailable != 0; + } + return (error); +} + +int FrogmoreScd30::readMeasurement( + uint16 *pCO2_ppm, + uint16 *pCO2EAvg_ppm, + float *pTemperature, + float *pHumidity +) +{ + bool isAvailable = false; + int error = 0; + float tempCO2; + float tempHumidity; + float tempTemperature; + + error = isDataAvailable(&isAvailable); + if (error) + { + return (error); + } + + if (!isAvailable) + { + return (ERROR_SCD30_NO_DATA); + } + +#ifdef SCD30_DEBUG + snprintf_P(scd30log_data, sizeof(scd30log_data), "Scd30ReadMeasurement: have data"); + AddLog(LOG_LEVEL_DEBUG_MORE); +#endif + + error = sendCommand(COMMAND_SCD30_READ_MEASUREMENT); + if (error) + { +#ifdef SCD30_DEBUG + snprintf_P(scd30log_data, sizeof(scd30log_data), "Scd30ReadMeasurement: send command failed: 0x%lX", error); + AddLog(LOG_LEVEL_INFO); +#endif + return (error); + } + delay(1); // the SCD30 uses clock streching to give it time to prepare data, waiting here makes it work + + uint8_t bytes[SCD30_MEAS_BYTES]; + // there are (6) 16-bit values, each with a CRC in the measurement data + // the chip does not seem to like sending this data, except all at once + error = getBytes(bytes, SCD30_MEAS_BYTES); + if (error) + { +#ifdef SCD30_DEBUG + snprintf_P(scd30log_data, sizeof(scd30log_data), "Scd30ReadMeasurement: Scd30GetBytes command failed: 0x%lX", error); + AddLog(LOG_LEVEL_INFO); +#endif + return (error); + } + +#ifdef SCD30_DEBUG + snprintf_P(scd30log_data, sizeof(scd30log_data), "Scd30ReadMeasurement: Scd30GetBytes data: 0x %02X %02X %02X | 0x %02X %02X %02X | 0x %02X %02X %02X", bytes[0], bytes[1], bytes[2], bytes[3], bytes[4], bytes[5], bytes[6], bytes[7], bytes[8]); + AddLog(LOG_LEVEL_DEBUG_MORE); + snprintf_P(scd30log_data, sizeof(scd30log_data), "Scd30ReadMeasurement: Scd30GetBytes data: 0x %02X %02X %02X | 0x %02X %02X %02X | 0x %02X %02X %02X", bytes[9], bytes[10], bytes[11], bytes[12], bytes[13], bytes[14], bytes[15], bytes[16], bytes[17]); + AddLog(LOG_LEVEL_DEBUG_MORE); +#endif + + error = get32BitRegCheckCRC(&bytes[0], &tempCO2); + if (error) + { +#ifdef SCD30_DEBUG + snprintf_P(scd30log_data, sizeof(scd30log_data), "Scd30ReadMeasurement: Scd30Get32BitsCheckCRC 1st command failed: 0x%lX", error); + AddLog(LOG_LEVEL_INFO); +#endif + return (error); + } + + error = get32BitRegCheckCRC(&bytes[6], &tempTemperature); + if (error) + { +#ifdef SCD30_DEBUG + snprintf_P(scd30log_data, sizeof(scd30log_data), "Scd30ReadMeasurement: Scd30Get32BitsCheckCRC 2nd command failed: 0x%lX", error); + AddLog(LOG_LEVEL_INFO); +#endif + return (error); + } + + error = get32BitRegCheckCRC(&bytes[12], &tempHumidity); + if (error) + { +#ifdef SCD30_DEBUG + snprintf_P(scd30log_data, sizeof(scd30log_data), "Scd30ReadMeasurement: Scd30Get32BitsCheckCRC 3rd command failed: 0x%lX", error); + AddLog(LOG_LEVEL_INFO); +#endif + return (error); + } + + if (tempCO2 == 0) + { + return (ERROR_SCD30_CO2_ZERO); + } + + if (co2NewDataLocation < 0) + { + co2EAverage = tempCO2; + for (int x = 0; x < SCD30_MEDIAN_FILTER_SIZE; x++) + { + co2History[x] = tempCO2; + co2NewDataLocation = 1; + } + } + else + { + co2History[co2NewDataLocation++] = tempCO2; + if (co2NewDataLocation >= SCD30_MEDIAN_FILTER_SIZE) + { + co2NewDataLocation = 0; + } + } + +#ifdef SCD30_DEBUG + snprintf_P(scd30log_data, sizeof(scd30log_data), "Scd30ReadMeasurement: co2History: %ld, %ld, %ld, %ld, %ld", co2History[0], co2History[1], co2History[2], co2History[3], co2History[4]); + AddLog(LOG_LEVEL_DEBUG_MORE); +#endif + // copy array since the median filter function will re-arrange it + uint16_t temp[SCD30_MEDIAN_FILTER_SIZE]; + for (int x = 0; x < SCD30_MEDIAN_FILTER_SIZE; x++) + { + temp[x] = co2History[x]; + } +#ifdef SCD30_DEBUG + snprintf_P(scd30log_data, sizeof(scd30log_data), "Scd30ReadMeasurement: temp: %ld, %ld, %ld, %ld, %ld", temp[0], temp[1], temp[2], temp[3], temp[4]); + AddLog(LOG_LEVEL_DEBUG_MORE); +#endif + + *pCO2_ppm = opt_med5(temp); +#ifdef SCD30_DEBUG + snprintf_P(scd30log_data, sizeof(scd30log_data), "Scd30ReadMeasurement: CO2_ppm: %ld", *pCO2_ppm); + AddLog(LOG_LEVEL_DEBUG_MORE); +#endif + if (pCO2EAvg_ppm) + { + int16_t delta = (int16_t) *pCO2_ppm - (int16_t) co2EAverage; + int16_t change = delta / 32; + co2EAverage += change; +#if 0 + uint16_t remain = co2EAverage % 5; + uint16_t dividend = co2EAverage / 5; + uint16_t co2EAReported = dividend * 5; + if (remain > 2) + { + co2EAReported += 5; + } + *pCO2EAvg_ppm = co2EAReported; +#else + *pCO2EAvg_ppm = co2EAverage; +#endif + + } + + *pTemperature = tempTemperature; + *pHumidity = tempHumidity; + return (ERROR_SCD30_NO_ERROR); +} + +int FrogmoreScd30::stopMeasuring(void) +{ + return (sendCommand(COMMAND_SCD30_STOP_MEASUREMENT)); +} + diff --git a/lib/FrogmoreScd30/FrogmoreScd30.h b/lib/FrogmoreScd30/FrogmoreScd30.h new file mode 100644 index 000000000..d1f2d1309 --- /dev/null +++ b/lib/FrogmoreScd30/FrogmoreScd30.h @@ -0,0 +1,105 @@ +/* +# Copyright (c) 2019 Frogmore42 +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ +#pragma once + +#include "Arduino.h" + +//#define SCD30_DEBUG + +#define SCD30_ADDRESS 0x61 +#define ERROR_SCD30_NO_ERROR 0 +#define ERROR_SCD30_NO_DATA 0x80000000 +#define ERROR_SCD30_CO2_ZERO 0x90000000 +#define ERROR_SCD30_UNKNOWN_ERROR 0x1000000 +#define ERROR_SCD30_CRC_ERROR 0x2000000 +#define ERROR_SCD30_NOT_ENOUGH_BYTES_ERROR 0x3000000 +#define ERROR_SCD30_NOT_FOUND_ERROR 0x4000000 +#define ERROR_SCD30_NOT_A_NUMBER_ERROR 0x5000000 +#define ERROR_SCD30_INVALID_VALUE 0x6000000 + +#define SCD30_MEDIAN_FILTER_SIZE 5 + +class FrogmoreScd30 +{ + public: + FrogmoreScd30() {}; + // Constructors + // the SCD30 only lists a single i2c address, so not necesary to specify + // + void begin(void); + void begin(uint8_t _i2cAddress); + void begin(TwoWire *pWire); + void begin(TwoWire *pWire, uint8_t _i2cAddress); + + int softReset(void); + int clearI2CBus(void); // this is a HARD reset of the IC2 bus to restore communication, it will disrupt the bus + + int getAltitudeCompensation(uint16_t *pHeight_meter); + int getAmbientPressure(uint16_t *pAirPressure_mbar); + int getCalibrationType(uint16_t *pIsAuto); + int getFirmwareVersion(uint8_t *pMajor, uint8_t *pMinor); + int getForcedRecalibrationFactor(uint16_t *pCo2_ppm); + int getMeasurementInterval(uint16_t *pTime_sec); + int getTemperatureOffset(float *pOffset_degC); + int getTemperatureOffset(uint16_t *pOffset_centiDegC); + + int setAltitudeCompensation(uint16_t height_meter); + int setAmbientPressure(uint16_t airPressure_mbar); + int setAutoSelfCalibration(void); + int setCalibrationType(bool isAuto); + int setForcedRecalibrationFactor(uint16_t co2_ppm); + int setManualCalibration(void); + int setMeasurementInterval(uint16_t time_sec); + int setTemperatureOffset(float offset_degC); + int setTemperatureOffset(uint16_t offset_centiDegC); + + int beginMeasuring(void); + int beginMeasuring(uint16_t airPressure_mbar); // also sets ambient pressure offset in mbar/hPascal + int isDataAvailable(bool *pIsAvailable); + int readMeasurement( + uint16 *pCO2_ppm, + uint16 *pCO2EAvg_ppm, + float *pTemperature, + float *pHumidity + ); + int stopMeasuring(void); + + private: + uint8_t i2cAddress; + TwoWire *pWire; + uint16_t ambientPressure; + uint16_t co2AvgExtra; + uint16_t co2History[SCD30_MEDIAN_FILTER_SIZE]; + uint16_t co2EAverage; + int8_t co2NewDataLocation; // location to put new CO2 data for median filter + + uint8_t computeCRC8(uint8_t data[], uint8_t len); + int sendBytes(void *pInput, uint8_t len); + int getBytes(void *pOutput, uint8_t len); + int sendCommand(uint16_t command); + int sendCommandArguments(uint16_t command, uint16_t arguments); + int get16BitRegCheckCRC(void* pInput, uint16_t* pData); + int get32BitRegCheckCRC(void* pInput, float* pData); + int readRegister(uint16_t registerAddress, uint16_t* pData); +#ifdef SCD30_DEBUG + void AddLog(uint8_t loglevel); +#endif +}; \ No newline at end of file diff --git a/lib/arduino-mqtt-2.4.0/LICENSE.md b/lib/LinkedList-1.2.3/LICENSE.txt similarity index 96% rename from lib/arduino-mqtt-2.4.0/LICENSE.md rename to lib/LinkedList-1.2.3/LICENSE.txt index 325e07cff..5c02604a0 100644 --- a/lib/arduino-mqtt-2.4.0/LICENSE.md +++ b/lib/LinkedList-1.2.3/LICENSE.txt @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2015 Joël Gähwiler +Copyright (c) 2015 Ivan Seidel Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/lib/LinkedList-1.2.3/LinkedList.h b/lib/LinkedList-1.2.3/LinkedList.h new file mode 100644 index 000000000..371b14ac7 --- /dev/null +++ b/lib/LinkedList-1.2.3/LinkedList.h @@ -0,0 +1,325 @@ +/* + LinkedList.h - V1.1 - Generic LinkedList implementation + Works better with FIFO, because LIFO will need to + search the entire List to find the last one; + + For instructions, go to https://github.com/ivanseidel/LinkedList + + Created by Ivan Seidel Gomes, March, 2013. + Released into the public domain. +*/ + + +#ifndef LinkedList_h +#define LinkedList_h + +#include + +template +struct ListNode +{ + T data; + ListNode *next; +}; + +template +class LinkedList{ + +protected: + int _size; + ListNode *root; + ListNode *last; + + // Helps "get" method, by saving last position + ListNode *lastNodeGot; + int lastIndexGot; + // isCached should be set to FALSE + // everytime the list suffer changes + bool isCached; + + ListNode* getNode(int index); + +public: + LinkedList(); + ~LinkedList(); + + /* + Returns current size of LinkedList + */ + virtual int size(); + /* + Adds a T object in the specified index; + Unlink and link the LinkedList correcly; + Increment _size + */ + virtual bool add(int index, T); + /* + Adds a T object in the end of the LinkedList; + Increment _size; + */ + virtual bool add(T); + /* + Adds a T object in the start of the LinkedList; + Increment _size; + */ + virtual bool unshift(T); + /* + Set the object at index, with T; + Increment _size; + */ + virtual bool set(int index, T); + /* + Remove object at index; + If index is not reachable, returns false; + else, decrement _size + */ + virtual T remove(int index); + /* + Remove last object; + */ + virtual T pop(); + /* + Remove first object; + */ + virtual T shift(); + /* + Get the index'th element on the list; + Return Element if accessible, + else, return false; + */ + virtual T get(int index); + + /* + Clear the entire array + */ + virtual void clear(); + +}; + +// Initialize LinkedList with false values +template +LinkedList::LinkedList() +{ + root=NULL; + last=NULL; + _size=0; + + lastNodeGot = root; + lastIndexGot = 0; + isCached = false; +} + +// Clear Nodes and free Memory +template +LinkedList::~LinkedList() +{ + ListNode* tmp; + while(root!=NULL) + { + tmp=root; + root=root->next; + delete tmp; + } + last = NULL; + _size=0; + isCached = false; +} + +/* + Actualy "logic" coding +*/ + +template +ListNode* LinkedList::getNode(int index){ + + int _pos = 0; + ListNode* current = root; + + // Check if the node trying to get is + // immediatly AFTER the previous got one + if(isCached && lastIndexGot <= index){ + _pos = lastIndexGot; + current = lastNodeGot; + } + + while(_pos < index && current){ + current = current->next; + + _pos++; + } + + // Check if the object index got is the same as the required + if(_pos == index){ + isCached = true; + lastIndexGot = index; + lastNodeGot = current; + + return current; + } + + return false; +} + +template +int LinkedList::size(){ + return _size; +} + +template +bool LinkedList::add(int index, T _t){ + + if(index >= _size) + return add(_t); + + if(index == 0) + return unshift(_t); + + ListNode *tmp = new ListNode(), + *_prev = getNode(index-1); + tmp->data = _t; + tmp->next = _prev->next; + _prev->next = tmp; + + _size++; + isCached = false; + + return true; +} + +template +bool LinkedList::add(T _t){ + + ListNode *tmp = new ListNode(); + tmp->data = _t; + tmp->next = NULL; + + if(root){ + // Already have elements inserted + last->next = tmp; + last = tmp; + }else{ + // First element being inserted + root = tmp; + last = tmp; + } + + _size++; + isCached = false; + + return true; +} + +template +bool LinkedList::unshift(T _t){ + + if(_size == 0) + return add(_t); + + ListNode *tmp = new ListNode(); + tmp->next = root; + tmp->data = _t; + root = tmp; + + _size++; + isCached = false; + + return true; +} + +template +bool LinkedList::set(int index, T _t){ + // Check if index position is in bounds + if(index < 0 || index >= _size) + return false; + + getNode(index)->data = _t; + return true; +} + +template +T LinkedList::pop(){ + if(_size <= 0) + return T(); + + isCached = false; + + if(_size >= 2){ + ListNode *tmp = getNode(_size - 2); + T ret = tmp->next->data; + delete(tmp->next); + tmp->next = NULL; + last = tmp; + _size--; + return ret; + }else{ + // Only one element left on the list + T ret = root->data; + delete(root); + root = NULL; + last = NULL; + _size = 0; + return ret; + } +} + +template +T LinkedList::shift(){ + if(_size <= 0) + return T(); + + if(_size > 1){ + ListNode *_next = root->next; + T ret = root->data; + delete(root); + root = _next; + _size --; + isCached = false; + + return ret; + }else{ + // Only one left, then pop() + return pop(); + } + +} + +template +T LinkedList::remove(int index){ + if (index < 0 || index >= _size) + { + return T(); + } + + if(index == 0) + return shift(); + + if (index == _size-1) + { + return pop(); + } + + ListNode *tmp = getNode(index - 1); + ListNode *toDelete = tmp->next; + T ret = toDelete->data; + tmp->next = tmp->next->next; + delete(toDelete); + _size--; + isCached = false; + return ret; +} + + +template +T LinkedList::get(int index){ + ListNode *tmp = getNode(index); + + return (tmp ? tmp->data : T()); +} + +template +void LinkedList::clear(){ + while(size() > 0) + shift(); +} + +#endif diff --git a/lib/LinkedList-1.2.3/README.md b/lib/LinkedList-1.2.3/README.md new file mode 100644 index 000000000..bdb16fdbd --- /dev/null +++ b/lib/LinkedList-1.2.3/README.md @@ -0,0 +1,171 @@ +# LinkedList + +This library was developed targeting **`Arduino`** applications. However, works just great with any C++. + +Implementing a buffer for objects takes time. If we are not in the mood, we just create an `array[1000]` with enough size. + +The objective of this library is to create a pattern for projects. +If you need to use a List of: `int`, `float`, `objects`, `Lists` or `Wales`. **This is what you are looking for.** + +With a simple but powerful caching algorithm, you can get subsequent objects much faster than usual. Tested without any problems with Lists bigger than 2000 members. + +## Installation + +1. [Download](https://github.com/ivanseidel/LinkedList/archive/master.zip) the Latest release from gitHub. +2. Unzip and modify the Folder name to "LinkedList" (Remove the '-version') +3. Paste the modified folder on your Library folder (On your `Libraries` folder inside Sketchbooks or Arduino software). +4. Reopen the Arduino software. + +**If you are here, because another Library requires this class, just don't waste time reading bellow. Install and ready.** + +------------------------- + +## Getting started + +### The `LinkedList` class + +In case you don't know what a LinkedList is and what it's used for, take a quick look at [Wikipedia::LinkedList](https://en.wikipedia.org/wiki/Linked_list) before continuing. + +#### To declare a LinkedList object +```c++ +// Instantiate a LinkedList that will hold 'integer' +LinkedList myLinkedList = LinkedList(); + +// Or just this +LinkedList myLinkedList; + +// But if you are instantiating a pointer LinkedList... +LinkedList *myLinkedList = new LinkedList(); + +// If you want a LinkedList with any other type such as 'MyClass' +// Make sure you call delete(MyClass) when you remove! +LinkedList *myLinkedList = new LinkedList(); +``` + +#### Getting the size of the linked list +```c++ +// To get the size of a linked list, make use of the size() method +int theSize = myList.size(); + +// Notice that if it's pointer to the linked list, you should use -> instead +int theSize = myList->size(); +``` + +#### Adding elements + +```c++ +// add(obj) method will insert at the END of the list +myList.add(myObject); + +// add(index, obj) method will try to insert the object at the specified index +myList.add(0, myObject); // Add at the beginning +myList.add(3, myObject); // Add at index 3 + +// unshift(obj) method will insert the object at the beginning +myList.unshift(myObject); +``` + +#### Getting elements + +```c++ +// get(index) will return the element at index +// (notice that the start element is 0, not 1) + +// Get the FIRST element +myObject = myList.get(0); + +// Get the third element +myObject = myList.get(2); + +// Get the LAST element +myObject = myList.get(myList.size() - 1); +``` + +#### Changing elements +```c++ +// set(index, obj) method will change the object at index to obj + +// Change the first element to myObject +myList.set(0, myObject); + +// Change the third element to myObject +myList.set(2, myObject); + +// Change the LAST element of the list +myList.set(myList.size() - 1, myObject); +``` + +#### Removing elements +```c++ +// remove(index) will remove and return the element at index + +// Remove the first object +myList.remove(0); + +// Get and Delete the third element +myDeletedObject = myList.remove(2); + +// pop() will remove and return the LAST element +myDeletedObject = myList.pop(); + +// shift() will remove and return the FIRST element +myDeletedObject = myList.shift(); + +// clear() will erase the entire list, leaving it with 0 elements +// NOTE: Clear wont DELETE/FREE memory from Pointers, if you +// are using Classes/Poiners, manualy delete and free those. +myList.clear(); +``` + +------------------------ + +## Library Reference + +### `ListNode` struct + +- `T` `ListNode::data` - The object data + +- `ListNode` `*next` - Pointer to the next Node + +### `LinkedList` class + +**`boolean` methods returns if succeeded** + +- `LinkedList::LinkedList()` - Constructor. + +- `LinkedList::~LinkedList()` - Destructor. Clear Nodes to minimize memory. Does not free pointer memory. + +- `int` `LinkedList::size()` - Returns the current size of the list. + +- `bool` `LinkedList::add(T)` - Add element T at the END of the list. + +- `bool` `LinkedList::add(int index, T)` - Add element T at `index` of the list. + +- `bool` `LinkedList::unshift(T)` - Add element T at the BEGINNING of the list. + +- `bool` `LinkedList::set(int index, T)` - Set the element at `index` to T. + +- `T` `LinkedList::remove(int index)` - Remove element at `index`. Return the removed element. Does not free pointer memory + +- `T` `LinkedList::pop()` - Remove the LAST element. Return the removed element. + +- `T` `LinkedList::shift()` - Remove the FIRST element. Return the removed element. + +- `T` `LinkedList::get(int index)` - Return the element at `index`. + +- `void` `LinkedList::clear()` - Removes all elements. Does not free pointer memory. + +- **protected** `int` `LinkedList::_size` - Holds the cached size of the list. + +- **protected** `ListNode` `LinkedList::*root` - Holds the root node of the list. + +- **protected** `ListNode` `LinkedList::*last` - Holds the last node of the list. + +- **protected** `ListNode*` `LinkedList::getNode(int index)` - Returns the `index` node of the list. + +### Version History + +* `1.1 (2013-07-20)`: Cache implemented. Getting subsequent objects is now O(N). Before, O(N^2). +* `1.0 (2013-07-20)`: Original release + +![LinkedList](https://d2weczhvl823v0.cloudfront.net/ivanseidel/LinkedList/trend.png) diff --git a/lib/LinkedList-1.2.3/examples/ClassList/ClassList.pde b/lib/LinkedList-1.2.3/examples/ClassList/ClassList.pde new file mode 100644 index 000000000..9a8ea9d99 --- /dev/null +++ b/lib/LinkedList-1.2.3/examples/ClassList/ClassList.pde @@ -0,0 +1,81 @@ +/* + LinkedList Example + Link: http://github.com/ivanseidel/LinkedList + + Example Created by + Tom Stewart, github.com/tastewar + + Edited by: + Ivan Seidel, github.com/ivanseidel +*/ + +#include + +// Let's define a new class +class Animal { + public: + char *name; + bool isMammal; +}; + +char catname[]="kitty"; +char dogname[]="doggie"; +char emuname[]="emu"; + +LinkedList myAnimalList = LinkedList(); + +void setup() +{ + + Serial.begin(9600); + Serial.println("Hello!" ); + + // Create a Cat + Animal *cat = new Animal(); + cat->name = catname; + cat->isMammal = true; + + // Create a dog + Animal *dog = new Animal(); + dog->name = dogname; + dog->isMammal = true; + + // Create a emu + Animal *emu = new Animal(); + emu->name = emuname; + emu->isMammal = false; // just an example; no offense to pig lovers + + // Add animals to list + myAnimalList.add(cat); + myAnimalList.add(emu); + myAnimalList.add(dog); +} + +void loop() { + + Serial.print("There are "); + Serial.print(myAnimalList.size()); + Serial.print(" animals in the list. The mammals are: "); + + int current = 0; + Animal *animal; + for(int i = 0; i < myAnimalList.size(); i++){ + + // Get animal from list + animal = myAnimalList.get(i); + + // If its a mammal, then print it's name + if(animal->isMammal){ + + // Avoid printing spacer on the first element + if(current++) + Serial.print(", "); + + // Print animal name + Serial.print(animal->name); + } + } + Serial.println("."); + + while (true); // nothing else to do, loop forever +} \ No newline at end of file diff --git a/lib/LinkedList-1.2.3/examples/SimpleIntegerList/SimpleIntegerList.pde b/lib/LinkedList-1.2.3/examples/SimpleIntegerList/SimpleIntegerList.pde new file mode 100644 index 000000000..1bcbe9c37 --- /dev/null +++ b/lib/LinkedList-1.2.3/examples/SimpleIntegerList/SimpleIntegerList.pde @@ -0,0 +1,58 @@ +/* + LinkedList Example + Link: http://github.com/ivanseidel/LinkedList + + Example Created by + Tom Stewart, github.com/tastewar + + Edited by: + Ivan Seidel, github.com/ivanseidel +*/ +#include + +LinkedList myList = LinkedList(); + +void setup() +{ + + Serial.begin(9600); + Serial.println("Hello!"); + + // Add some stuff to the list + int k = -240, + l = 123, + m = -2, + n = 222; + myList.add(n); + myList.add(0); + myList.add(l); + myList.add(17); + myList.add(k); + myList.add(m); +} + +void loop() { + + int listSize = myList.size(); + + Serial.print("There are "); + Serial.print(listSize); + Serial.print(" integers in the list. The negative ones are: "); + + // Print Negative numbers + for (int h = 0; h < listSize; h++) { + + // Get value from list + int val = myList.get(h); + + // If the value is negative, print it + if (val < 0) { + Serial.print(" "); + Serial.print(val); + } + } + + while (true); // nothing else to do, loop forever +} + + diff --git a/lib/LinkedList-1.2.3/keywords.txt b/lib/LinkedList-1.2.3/keywords.txt new file mode 100644 index 000000000..3ae496859 --- /dev/null +++ b/lib/LinkedList-1.2.3/keywords.txt @@ -0,0 +1,28 @@ +####################################### +# Syntax Coloring +####################################### + +####################################### +# Datatypes (KEYWORD1) +####################################### + +LinkedList KEYWORD1 +ListNode KEYWORD1 + +####################################### +# Methods and Functions (KEYWORD2) +####################################### + +size KEYWORD2 +add KEYWORD2 +unshift KEYWORD2 +set KEYWORD2 +remove KEYWORD2 +pop KEYWORD2 +shift KEYWORD2 +get KEYWORD2 +clear KEYWORD2 + +####################################### +# Constants (LITERAL1) +####################################### diff --git a/lib/LinkedList-1.2.3/library.json b/lib/LinkedList-1.2.3/library.json new file mode 100644 index 000000000..4179b248d --- /dev/null +++ b/lib/LinkedList-1.2.3/library.json @@ -0,0 +1,12 @@ +{ + "name": "LinkedList", + "keywords": "pattern", + "description": "A fully implemented LinkedList (int, float, objects, Lists or Wales) made to work with Arduino projects", + "repository": + { + "type": "git", + "url": "https://github.com/ivanseidel/LinkedList.git" + }, + "frameworks": "arduino", + "platforms": "*" +} diff --git a/lib/LinkedList-1.2.3/library.properties b/lib/LinkedList-1.2.3/library.properties new file mode 100644 index 000000000..77b1423c0 --- /dev/null +++ b/lib/LinkedList-1.2.3/library.properties @@ -0,0 +1,9 @@ +name=LinkedList +version=1.2.3 +author=Ivan Seidel +maintainer=Ivan Seidel +sentence=A fully implemented LinkedList made to work with Arduino projects +paragraph=The objective of this library is to create a pattern for projects. If you need to use a List of: int, float, objects, Lists or Wales. This is what you are looking for. +category=Data Processing +url=https://github.com/ivanseidel/LinkedList +architectures=* diff --git a/lib/NeoPixelBus-2.2.9/src/internal/NeoEsp8266DmaMethod.h b/lib/NeoPixelBus-2.2.9/src/internal/NeoEsp8266DmaMethod.h index af11e1a7a..dc4dd2723 100644 --- a/lib/NeoPixelBus-2.2.9/src/internal/NeoEsp8266DmaMethod.h +++ b/lib/NeoPixelBus-2.2.9/src/internal/NeoEsp8266DmaMethod.h @@ -48,7 +48,11 @@ extern "C" #include "ets_sys.h" #include "user_interface.h" +// Workaround STAGE compile error +#include +#if defined(ARDUINO_ESP8266_RELEASE_2_3_0) || defined(ARDUINO_ESP8266_RELEASE_2_4_0) || defined(ARDUINO_ESP8266_RELEASE_2_4_1) || defined(ARDUINO_ESP8266_RELEASE_2_4_2) || defined(ARDUINO_ESP8266_RELEASE_2_5_0) void rom_i2c_writeReg_Mask(uint32_t block, uint32_t host_id, uint32_t reg_add, uint32_t Msb, uint32_t Lsb, uint32_t indata); +#endif } struct slc_queue_item @@ -74,7 +78,7 @@ public: class NeoEsp8266DmaSpeed800Kbps { public: - const static uint32_t I2sClockDivisor = 3; + const static uint32_t I2sClockDivisor = 3; const static uint32_t I2sBaseClockDivisor = 16; const static uint32_t ResetTimeUs = 50; }; @@ -82,7 +86,7 @@ public: class NeoEsp8266DmaSpeed400Kbps { public: - const static uint32_t I2sClockDivisor = 6; + const static uint32_t I2sClockDivisor = 6; const static uint32_t I2sBaseClockDivisor = 16; const static uint32_t ResetTimeUs = 50; }; @@ -100,7 +104,7 @@ const uint8_t c_I2sPin = 3; // due to I2S hardware, the pin used is restricted t template class NeoEsp8266DmaMethodBase { public: - NeoEsp8266DmaMethodBase(uint16_t pixelCount, size_t elementSize) + NeoEsp8266DmaMethodBase(uint16_t pixelCount, size_t elementSize) { uint16_t dmaPixelSize = c_dmaBytesPerPixelBytes * elementSize; @@ -269,7 +273,7 @@ public: private: static NeoEsp8266DmaMethodBase* s_this; // for the ISR - size_t _pixelsSize; // Size of '_pixels' buffer + size_t _pixelsSize; // Size of '_pixels' buffer uint8_t* _pixels; // Holds LED color values uint32_t _i2sBufferSize; // total size of _i2sBuffer @@ -310,7 +314,7 @@ private: slc_queue_item* finished_item = (slc_queue_item*)SLCRXEDA; // data block has pending data waiting to send, prepare it - // point last state block to top + // point last state block to top (finished_item + 1)->next_link_ptr = (uint32_t)(s_this->_i2sBufDesc); s_this->_dmaState = NeoDmaState_Sending; @@ -367,7 +371,7 @@ private: } }; -template +template NeoEsp8266DmaMethodBase* NeoEsp8266DmaMethodBase::s_this; typedef NeoEsp8266DmaMethodBase NeoEsp8266DmaWs2813Method; diff --git a/lib/TasmotaMqtt-1.1.1/.gitignore b/lib/TasmotaMqtt-1.1.1/.gitignore deleted file mode 100644 index 2ee75414c..000000000 --- a/lib/TasmotaMqtt-1.1.1/.gitignore +++ /dev/null @@ -1,28 +0,0 @@ -# C++ objects and libs - -*.slo -*.lo -*.o -#*.a -*.la -*.lai -*.so -*.dll -*.dylib - -#Makefile -*-build-* -build-* -*.autosave - -# .log files (usually created by QtTest - thanks to VestniK) -*.log - - -# Editors temporary files -*~ - - -#OSX -.DS_Store -._* diff --git a/lib/TasmotaMqtt-1.1.1/README.md b/lib/TasmotaMqtt-1.1.1/README.md deleted file mode 100644 index db197299e..000000000 --- a/lib/TasmotaMqtt-1.1.1/README.md +++ /dev/null @@ -1,8 +0,0 @@ -MQTT -==== - -A Wrapper around mqtt for Arduino to be used with esp8266 modules. - -It wraps a slightly modified version of mqtt for esp8266 ported by Tuan PM. -Original code for esp: https://github.com/tuanpmt/esp_mqtt -Original code for contiki: https://github.com/esar/contiki-mqtt diff --git a/lib/TasmotaMqtt-1.1.1/examples/mqtt_pub/mqtt_pub.ino b/lib/TasmotaMqtt-1.1.1/examples/mqtt_pub/mqtt_pub.ino deleted file mode 100644 index 17b3be8db..000000000 --- a/lib/TasmotaMqtt-1.1.1/examples/mqtt_pub/mqtt_pub.ino +++ /dev/null @@ -1,102 +0,0 @@ -#include -#include - -void myDataCb(String& topic, String& data); -void myPublishedCb(); -void myDisconnectedCb(); -void myConnectedCb(); - -#define CLIENT_ID "client1" - -// create MQTT object -MQTT myMqtt(CLIENT_ID, "192.168.0.1", 1883); - -// -const char* ssid = "ssid"; -const char* password = "ssid_password"; - - -// -void setup() { - Serial.begin(115200); - delay(1000); - - Serial.println(); - Serial.println(); - Serial.print("Connecting to "); - Serial.println(ssid); - - WiFi.begin(ssid, password); - - while (WiFi.status() != WL_CONNECTED) { - delay(500); - Serial.print("."); - } - - Serial.println(""); - Serial.println("WiFi connected"); - Serial.println("IP address: "); - Serial.println(WiFi.localIP()); - - Serial.println("Connecting to MQTT server"); - - // setup callbacks - myMqtt.onConnected(myConnectedCb); - myMqtt.onDisconnected(myDisconnectedCb); - myMqtt.onPublished(myPublishedCb); - myMqtt.onData(myDataCb); - - Serial.println("connect mqtt..."); - myMqtt.connect(); - - delay(10); -} - -// -void loop() { - - int value = analogRead(A0); - - String topic("/"); - topic += CLIENT_ID; - topic += "/value"; - - String valueStr(value); - - // publish value to topic - boolean result = myMqtt.publish(topic, valueStr); - - delay(1000); -} - - -/* - * - */ -void myConnectedCb() -{ - Serial.println("connected to MQTT server"); -} - -void myDisconnectedCb() -{ - Serial.println("disconnected. try to reconnect..."); - delay(500); - myMqtt.connect(); -} - -void myPublishedCb() -{ - //Serial.println("published."); -} - -void myDataCb(String& topic, String& data) -{ - - Serial.print(topic); - Serial.print(": "); - Serial.println(data); -} - - - diff --git a/lib/TasmotaMqtt-1.1.1/examples/mqtt_sub/mqtt_sub.ino b/lib/TasmotaMqtt-1.1.1/examples/mqtt_sub/mqtt_sub.ino deleted file mode 100644 index e88e0a7bb..000000000 --- a/lib/TasmotaMqtt-1.1.1/examples/mqtt_sub/mqtt_sub.ino +++ /dev/null @@ -1,97 +0,0 @@ -#include -#include - -// This needs testing - -void myDataCb(char* topic, uint8_t* data, unsigned int data_len); -void myPublishedCb(); -void myDisconnectedCb(); -void myConnectedCb(); - -#define CLIENT_ID "client3" -#define TOPIC "/client1/value" - -// create MQTT -TasmotaMqtt myMqtt(); - -const char* ssid = "ssid"; -const char* password = "ssid_password"; - -// -void setup() { - Serial.begin(115200); - delay(1000); - - Serial.println(); - Serial.println(); - Serial.print("Connecting to "); - Serial.println(ssid); - - WiFi.begin(ssid, password); - - while (WiFi.status() != WL_CONNECTED) { - delay(500); - Serial.print("."); - } - - Serial.println(""); - Serial.println("WiFi connected"); - Serial.println("IP address: "); - Serial.println(WiFi.localIP()); - - - Serial.println("Connecting to MQTT server"); - - myMqtt.InitConnection("192.168.0.1", 1883); - myMqtt.InitClient(CLIENT_ID, "", ""); - myMqtt.InitLWT("/lwt", "offline"); - - // setup callbacks - myMqtt.OnConnected(myConnectedCb); - myMqtt.OnDisconnected(myDisconnectedCb); - myMqtt.OnPublished(myPublishedCb); - myMqtt.OnData(myDataCb); - - Serial.println("connect mqtt..."); - myMqtt.Connect(); - - Serial.println("subscribe to topic..."); - myMqtt.Subscribe(TOPIC); - - delay(10); -} - -// -void loop() { -} - - -/* - * - */ -void myConnectedCb() -{ - Serial.println("connected to MQTT server"); -} - -void myDisconnectedCb() -{ - Serial.println("disconnected. try to reconnect..."); - delay(500); - myMqtt.Connect(); -} - -void myPublishedCb() -{ - //Serial.println("published."); -} - -void myDataCb(char* topic, uint8_t* data, unsigned int data_len) -{ - Serial.print(topic); - Serial.print(": "); - Serial.println(data); -} - - - diff --git a/lib/TasmotaMqtt-1.1.1/keywords.txt b/lib/TasmotaMqtt-1.1.1/keywords.txt deleted file mode 100644 index 198919125..000000000 --- a/lib/TasmotaMqtt-1.1.1/keywords.txt +++ /dev/null @@ -1,39 +0,0 @@ -####################################### -# Syntax Coloring Map For Test -####################################### - -####################################### -# Datatypes (KEYWORD1) -####################################### - -TasmotaMqtt.h KEYWORD1 -TasmotaMqtt KEYWORD1 - -####################################### -# Methods and Functions (KEYWORD2) -####################################### - -InitConnection KEYWORD2 -InitClient KEYWORD2 -InitLWT KEYWORD2 - -Connect KEYWORD2 -Disconnect KEYWORD2 -Connected KEYWORD2 - -Publish KEYWORD2 -Subscribe KEYWORD2 - -#general -OnConnected KEYWORD2 -OnDisconnected KEYWORD2 -OnData KEYWORD2 - -####################################### -# Instances (KEYWORD2) -####################################### - -####################################### -# Constants (LITERAL1) -####################################### - diff --git a/lib/TasmotaMqtt-1.1.1/library.properties b/lib/TasmotaMqtt-1.1.1/library.properties deleted file mode 100644 index 5a3802f35..000000000 --- a/lib/TasmotaMqtt-1.1.1/library.properties +++ /dev/null @@ -1,9 +0,0 @@ -name=TasmotaMqtt -version=1.0.0 -author=Theo Arends -maintainer=Theo Arends -sentence=A Wrapper around mqtt for Arduino to be used with esp8266 modules. -paragraph=It wraps a slightly modified version of mqtt for esp8266 ported by Tuan PM. Original code for esp: https://github.com/tuanpmt/esp_mqtt Original code for contiki: https://github.com/esar/contiki-mqtt -category=Communication -url= -architectures=esp8266 \ No newline at end of file diff --git a/lib/TasmotaMqtt-1.1.1/src/TasmotaMqtt.cpp b/lib/TasmotaMqtt-1.1.1/src/TasmotaMqtt.cpp deleted file mode 100644 index 9beddd452..000000000 --- a/lib/TasmotaMqtt-1.1.1/src/TasmotaMqtt.cpp +++ /dev/null @@ -1,194 +0,0 @@ -/* - TasmotaMqtt.cpp - Wrapper for mqtt for esp8266 by Tuan PM for Tasmota - - Copyright (C) 2018 Theo Arends and Ingo Randolf - - This library is free software: you can redistribute it and/or modify - it under the terms of the 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 . -*/ - -#include "TasmotaMqtt.h" - -#include "user_interface.h" -#include "osapi.h" -#include "os_type.h" - -/*********************************************************************************************\ - * Prerequisite - * - * Copy .c and .h files from https://github.com/tuanpmt/esp_mqtt folder mqtt to folder mqtt - * - Replace BOOL with bool - * - Remove variables certificate and private_key from file mqtt.c - * - Add file user_config.h with default defines for - * MQTT_BUF_SIZE 256, MQTT_RECONNECT_TIMEOUT 5, QUEUE_BUFFER_SIZE 2048 and PROTOCOL_NAMEv311 -\*********************************************************************************************/ - -/*********************************************************************************************\ - * Mqtt internal callbacks -\*********************************************************************************************/ - -static void mqttConnectedCb(uint32_t *args) -{ - MQTT_Client* client = (MQTT_Client*)args; - TasmotaMqtt* _this = (TasmotaMqtt*)client->user_data; - if (_this && _this->onMqttConnectedCb) _this->onMqttConnectedCb(); -} - -static void mqttDisconnectedCb(uint32_t *args) -{ - MQTT_Client* client = (MQTT_Client*)args; - TasmotaMqtt* _this = (TasmotaMqtt*)client->user_data; - if (_this && _this->onMqttDisconnectedCb) _this->onMqttDisconnectedCb(); -} - -static void mqttPublishedCb(uint32_t *args) -{ - MQTT_Client* client = (MQTT_Client*)args; - TasmotaMqtt* _this = (TasmotaMqtt*)client->user_data; - if (_this && _this->onMqttPublishedCb) _this->onMqttPublishedCb(); -} - -static void mqttTimeoutCb(uint32_t *args) -{ - MQTT_Client* client = (MQTT_Client*)args; - TasmotaMqtt* _this = (TasmotaMqtt*)client->user_data; - if (_this && _this->onMqttTimeoutCb) _this->onMqttTimeoutCb(); -} - -static void mqttDataCb(uint32_t *args, const char* topic, uint32_t topic_len, const char *data, uint32_t data_len) -{ - MQTT_Client* client = (MQTT_Client*)args; - TasmotaMqtt* _this = (TasmotaMqtt*)client->user_data; - if (_this) _this->_onMqttDataCb(topic, topic_len, data, data_len); -} - -/*********************************************************************************************\ - * TasmotaMqtt class implementation -\*********************************************************************************************/ - -TasmotaMqtt::TasmotaMqtt() : - onMqttConnectedCb(0), - onMqttDisconnectedCb(0), - onMqttPublishedCb(0), - onMqttTimeoutCb(0), - onMqttDataCb(0) -{ -} - -TasmotaMqtt::~TasmotaMqtt() -{ - MQTT_DeleteClient(&mqttClient); -} - -void TasmotaMqtt::InitConnection(const char* host, uint32_t port, uint8_t security) -{ - MQTT_InitConnection(&mqttClient, (uint8_t*)host, port, security); - - // set user data - mqttClient.user_data = (void*)this; - - MQTT_OnConnected(&mqttClient, mqttConnectedCb); - MQTT_OnDisconnected(&mqttClient, mqttDisconnectedCb); - MQTT_OnPublished(&mqttClient, mqttPublishedCb); - MQTT_OnTimeout(&mqttClient, mqttTimeoutCb); - MQTT_OnData(&mqttClient, mqttDataCb); -} - -void TasmotaMqtt::InitClient(const char* client_id, const char* client_user, const char* client_pass, uint32_t keep_alive_time, uint8_t clean_session) -{ - MQTT_InitClient(&mqttClient, (uint8_t*)client_id, (uint8_t*)client_user, (uint8_t*)client_pass, keep_alive_time, clean_session); -} - -void TasmotaMqtt::DeleteClient() -{ - MQTT_DeleteClient(&mqttClient); -} - -void TasmotaMqtt::InitLWT(const char* will_topic, const char* will_msg, uint8_t will_qos, bool will_retain) -{ - MQTT_InitLWT(&mqttClient, (uint8_t*)will_topic, (uint8_t*)will_msg, will_qos, (uint8_t)will_retain); -} - -void TasmotaMqtt::OnConnected( void (*function)(void) ) -{ - onMqttConnectedCb = function; -} - -void TasmotaMqtt::OnDisconnected( void (*function)(void) ) -{ - onMqttDisconnectedCb = function; -} - -void TasmotaMqtt::OnPublished( void (*function)(void) ) -{ - onMqttPublishedCb = function; -} - -void TasmotaMqtt::OnTimeout( void (*function)(void) ) -{ - onMqttTimeoutCb = function; -} - -void TasmotaMqtt::OnData( void (*function)(char*, uint8_t*, unsigned int) ) -{ - onMqttDataCb = function; -} - -bool TasmotaMqtt::Subscribe(const char* topic, uint8_t qos) -{ - return MQTT_Subscribe(&mqttClient, (char*)topic, qos); -} - -bool TasmotaMqtt::Unsubscribe(const char* topic) -{ - return MQTT_UnSubscribe(&mqttClient, (char*)topic); -} - -void TasmotaMqtt::Connect() -{ - MQTT_Connect(&mqttClient); -} - -void TasmotaMqtt::Connect(const char* client_id, const char* client_user, const char* client_pass, const char* will_topic, const char* will_msg, uint8_t will_qos, bool will_retain) -{ - MQTT_InitClient(&mqttClient, (uint8_t*)client_id, (uint8_t*)client_user, (uint8_t*)client_pass, MQTT_KEEPALIVE, 1); - MQTT_InitLWT(&mqttClient, (uint8_t*)will_topic, (uint8_t*)will_msg, will_qos, (uint8_t)will_retain); - MQTT_Connect(&mqttClient); -} - -void TasmotaMqtt::Disconnect() -{ - MQTT_Disconnect(&mqttClient); -} - -bool TasmotaMqtt::Publish(const char* topic, const char* data, int data_length, int qos, bool retain) -{ - return MQTT_Publish(&mqttClient, topic, data, data_length, qos, (int)retain); -} - -bool TasmotaMqtt::Connected() -{ - return (mqttClient.connState > TCP_CONNECTED); -} - -/*********************************************************************************************/ - -void TasmotaMqtt::_onMqttDataCb(const char* topic, uint32_t topic_len, const char* data, uint32_t data_len) -{ - char topic_copy[topic_len +1]; - - memcpy(topic_copy, topic, topic_len); - topic_copy[topic_len] = 0; - if (0 == data_len) data = (const char*)&topic_copy + topic_len; - onMqttDataCb((char*)topic_copy, (byte*)data, data_len); -} diff --git a/lib/TasmotaMqtt-1.1.1/src/TasmotaMqtt.h b/lib/TasmotaMqtt-1.1.1/src/TasmotaMqtt.h deleted file mode 100644 index e512d8d5a..000000000 --- a/lib/TasmotaMqtt-1.1.1/src/TasmotaMqtt.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - TasmotaMqtt.h - Wrapper for mqtt for esp8266 by Tuan PM for Tasmota - - Copyright (C) 2018 Theo Arends and Ingo Randolf - - This library is free software: you can redistribute it and/or modify - it under the terms of the 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 . -*/ - -#ifndef TasmotaMqtt_h -#define TasmotaMqtt_h -/*********************************************************************************************\ - * TasmotaMqtt supports currently only non-TLS MQTT - * - * Adapted from esp-mqtt-arduino by Ingo Randolf (https://github.com/i-n-g-o/esp-mqtt-arduino) -\*********************************************************************************************/ - -#include - -#include -#include -#include -#include -#include - -extern "C" { - #include - #include "mqtt/mqtt.h" -} - -// MQTT_KEEPALIVE : keepAlive interval in Seconds -#ifndef MQTT_KEEPALIVE -#define MQTT_KEEPALIVE 15 -#endif - -class TasmotaMqtt { -public: - TasmotaMqtt(); - ~TasmotaMqtt(); - - void InitConnection(const char* host, uint32_t port, uint8_t security = 0); - void InitClient(const char* client_id, const char* client_user, const char* client_pass, uint32_t keep_alive_time = MQTT_KEEPALIVE, uint8_t clean_session = 1); - void DeleteClient(); - void InitLWT(const char* will_topic, const char* will_msg, uint8_t will_qos = 0, bool will_retain = false); - - void OnConnected( void (*)(void) ); - void OnDisconnected( void (*)(void) ); - void OnPublished( void (*)(void) ); - void OnTimeout( void (*)(void) ); - void OnData( void (*)(char*, uint8_t*, unsigned int) ); - - bool Subscribe(const char* topic, uint8_t qos = 0); - bool Unsubscribe(const char* topic); - - void Connect(); - void Connect(const char* client_id, const char* client_user, const char* client_pass, const char* will_topic, const char* will_msg, uint8_t will_qos = 0, bool will_retain = false); - void Disconnect(); - - bool Publish(const char* topic, const char* data, int data_length, int qos = 0, bool retain = false); - - bool Connected(); - - int State() { return mqttClient.connState; }; - - void (*onMqttConnectedCb)(void); - void (*onMqttDisconnectedCb)(void); - void (*onMqttPublishedCb)(void); - void (*onMqttTimeoutCb)(void); - void (*onMqttDataCb) (char*, uint8_t*, unsigned int); - - // internal callback - void _onMqttDataCb(const char*, uint32_t, const char*, uint32_t); - -private: - MQTT_Client mqttClient; -}; - -#endif // TasmotaMqtt_h \ No newline at end of file diff --git a/lib/TasmotaMqtt-1.1.1/src/mqtt/debug.h b/lib/TasmotaMqtt-1.1.1/src/mqtt/debug.h deleted file mode 100644 index f45dd6d8d..000000000 --- a/lib/TasmotaMqtt-1.1.1/src/mqtt/debug.h +++ /dev/null @@ -1,19 +0,0 @@ -/* - * debug.h - * - * Created on: Dec 4, 2014 - * Author: Minh - */ - -#ifndef USER_DEBUG_H_ -#define USER_DEBUG_H_ - - -#if defined(MQTT_DEBUG_ON) -#define MQTT_INFO( format, ... ) os_printf( format, ## __VA_ARGS__ ) -#else -#define MQTT_INFO( format, ... ) -#endif - - -#endif /* USER_DEBUG_H_ */ diff --git a/lib/TasmotaMqtt-1.1.1/src/mqtt/mqtt.c b/lib/TasmotaMqtt-1.1.1/src/mqtt/mqtt.c deleted file mode 100644 index 06609fe4a..000000000 --- a/lib/TasmotaMqtt-1.1.1/src/mqtt/mqtt.c +++ /dev/null @@ -1,997 +0,0 @@ -/* mqtt.c -* Protocol: http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html -* -* Copyright (c) 2014-2015, Tuan PM -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* -* * Redistributions of source code must retain the above copyright notice, -* this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of Redis nor the names of its contributors may be used -* to endorse or promote products derived from this software without -* specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -* POSSIBILITY OF SUCH DAMAGE. -*/ - -#include "user_interface.h" -#include "osapi.h" -#include "espconn.h" -#include "os_type.h" -#include "mem.h" -#include "mqtt_msg.h" -#include "debug.h" -#include "user_config.h" -#include "mqtt.h" -#include "queue.h" - -#define MQTT_TASK_PRIO 2 -#define MQTT_TASK_QUEUE_SIZE 1 -#define MQTT_SEND_TIMOUT 5 - -#ifndef MQTT_SSL_SIZE -#define MQTT_SSL_SIZE 5120 -#endif - -#ifndef QUEUE_BUFFER_SIZE -#define QUEUE_BUFFER_SIZE 2048 -#endif - -/* -unsigned char *default_certificate; -unsigned int default_certificate_len = 0; -unsigned char *default_private_key; -unsigned int default_private_key_len = 0; -*/ - -os_event_t mqtt_procTaskQueue[MQTT_TASK_QUEUE_SIZE]; - -#ifdef PROTOCOL_NAMEv311 -LOCAL uint8_t zero_len_id[2] = { 0, 0 }; -#endif - -LOCAL void ICACHE_FLASH_ATTR -mqtt_dns_found(const char *name, ip_addr_t *ipaddr, void *arg) -{ - struct espconn *pConn = (struct espconn *)arg; - MQTT_Client* client = (MQTT_Client *)pConn->reverse; - - - if (ipaddr == NULL) - { - MQTT_INFO("DNS: Found, but got no ip, try to reconnect\r\n"); - client->connState = TCP_RECONNECT_REQ; - return; - } - - MQTT_INFO("DNS: found ip %d.%d.%d.%d\n", - *((uint8 *) &ipaddr->addr), - *((uint8 *) &ipaddr->addr + 1), - *((uint8 *) &ipaddr->addr + 2), - *((uint8 *) &ipaddr->addr + 3)); - - if (client->ip.addr == 0 && ipaddr->addr != 0) - { - os_memcpy(client->pCon->proto.tcp->remote_ip, &ipaddr->addr, 4); - if (client->security) { -#ifdef MQTT_SSL_ENABLE - espconn_secure_set_size(ESPCONN_CLIENT, MQTT_SSL_SIZE); - espconn_secure_connect(client->pCon); -#else - MQTT_INFO("TCP: Do not support SSL\r\n"); -#endif - } - else { - espconn_connect(client->pCon); - } - - client->connState = TCP_CONNECTING; - MQTT_INFO("TCP: connecting...\r\n"); - } - - system_os_post(MQTT_TASK_PRIO, 0, (os_param_t)client); -} - - - -LOCAL void ICACHE_FLASH_ATTR -deliver_publish(MQTT_Client* client, uint8_t* message, int length) -{ - mqtt_event_data_t event_data; - - event_data.topic_length = length; - event_data.topic = mqtt_get_publish_topic(message, &event_data.topic_length); - event_data.data_length = length; - event_data.data = mqtt_get_publish_data(message, &event_data.data_length); - - if (client->dataCb) - client->dataCb((uint32_t*)client, event_data.topic, event_data.topic_length, event_data.data, event_data.data_length); - -} - -void ICACHE_FLASH_ATTR -mqtt_send_keepalive(MQTT_Client *client) -{ - MQTT_INFO("\r\nMQTT: Send keepalive packet to %s:%d!\r\n", client->host, client->port); - client->mqtt_state.outbound_message = mqtt_msg_pingreq(&client->mqtt_state.mqtt_connection); - client->mqtt_state.pending_msg_type = MQTT_MSG_TYPE_PINGREQ; - client->mqtt_state.pending_msg_type = mqtt_get_type(client->mqtt_state.outbound_message->data); - client->mqtt_state.pending_msg_id = mqtt_get_id(client->mqtt_state.outbound_message->data, client->mqtt_state.outbound_message->length); - - - client->sendTimeout = MQTT_SEND_TIMOUT; - MQTT_INFO("MQTT: Sending, type: %d, id: %04X\r\n", client->mqtt_state.pending_msg_type, client->mqtt_state.pending_msg_id); - err_t result = ESPCONN_OK; - if (client->security) { -#ifdef MQTT_SSL_ENABLE - result = espconn_secure_send(client->pCon, client->mqtt_state.outbound_message->data, client->mqtt_state.outbound_message->length); -#else - MQTT_INFO("TCP: Do not support SSL\r\n"); -#endif - } - else { - result = espconn_send(client->pCon, client->mqtt_state.outbound_message->data, client->mqtt_state.outbound_message->length); - } - - client->mqtt_state.outbound_message = NULL; - if (ESPCONN_OK == result) { - client->keepAliveTick = 0; - client->connState = MQTT_DATA; - system_os_post(MQTT_TASK_PRIO, 0, (os_param_t)client); - } - else { - client->connState = TCP_RECONNECT_DISCONNECTING; - system_os_post(MQTT_TASK_PRIO, 0, (os_param_t)client); - } -} - -/** - * @brief Delete tcp client and free all memory - * @param mqttClient: The mqtt client which contain TCP client - * @retval None - */ -void ICACHE_FLASH_ATTR -mqtt_tcpclient_delete(MQTT_Client *mqttClient) -{ - if (mqttClient->pCon != NULL) { - MQTT_INFO("TCP: Free memory\r\n"); - // Force abort connections - espconn_abort(mqttClient->pCon); - // Delete connections - espconn_delete(mqttClient->pCon); - - if (mqttClient->pCon->proto.tcp) { - os_free(mqttClient->pCon->proto.tcp); - mqttClient->pCon->proto.tcp = NULL; - } - os_free(mqttClient->pCon); - mqttClient->pCon = NULL; - } -} - -/** - * @brief Delete MQTT client and free all memory - * @param mqttClient: The mqtt client - * @retval None - */ -void ICACHE_FLASH_ATTR -mqtt_client_delete(MQTT_Client *mqttClient) -{ - if (mqttClient == NULL) - return; - - if (mqttClient->pCon != NULL) { - mqtt_tcpclient_delete(mqttClient); - } - - if (mqttClient->host != NULL) { - os_free(mqttClient->host); - mqttClient->host = NULL; - } - - if (mqttClient->user_data != NULL) { - os_free(mqttClient->user_data); - mqttClient->user_data = NULL; - } - - if (mqttClient->mqtt_state.in_buffer != NULL) { - os_free(mqttClient->mqtt_state.in_buffer); - mqttClient->mqtt_state.in_buffer = NULL; - } - - if (mqttClient->mqtt_state.out_buffer != NULL) { - os_free(mqttClient->mqtt_state.out_buffer); - mqttClient->mqtt_state.out_buffer = NULL; - } - - if (mqttClient->mqtt_state.outbound_message != NULL) { - if (mqttClient->mqtt_state.outbound_message->data != NULL) - { - os_free(mqttClient->mqtt_state.outbound_message->data); - mqttClient->mqtt_state.outbound_message->data = NULL; - } - } - - if (mqttClient->mqtt_state.mqtt_connection.buffer != NULL) { - // Already freed but not NULL - mqttClient->mqtt_state.mqtt_connection.buffer = NULL; - } - - if (mqttClient->connect_info.client_id != NULL) { -#ifdef PROTOCOL_NAMEv311 - /* Don't attempt to free if it's the zero_len array */ - if ( ((uint8_t*)mqttClient->connect_info.client_id) != zero_len_id ) - os_free(mqttClient->connect_info.client_id); -#else - os_free(mqttClient->connect_info.client_id); -#endif - mqttClient->connect_info.client_id = NULL; - } - - if (mqttClient->connect_info.username != NULL) { - os_free(mqttClient->connect_info.username); - mqttClient->connect_info.username = NULL; - } - - if (mqttClient->connect_info.password != NULL) { - os_free(mqttClient->connect_info.password); - mqttClient->connect_info.password = NULL; - } - - if (mqttClient->connect_info.will_topic != NULL) { - os_free(mqttClient->connect_info.will_topic); - mqttClient->connect_info.will_topic = NULL; - } - - if (mqttClient->connect_info.will_message != NULL) { - os_free(mqttClient->connect_info.will_message); - mqttClient->connect_info.will_message = NULL; - } - - if (mqttClient->msgQueue.buf != NULL) { - os_free(mqttClient->msgQueue.buf); - mqttClient->msgQueue.buf = NULL; - } - - // Initialize state - mqttClient->connState = WIFI_INIT; - // Clear callback functions to avoid abnormal callback - mqttClient->connectedCb = NULL; - mqttClient->disconnectedCb = NULL; - mqttClient->publishedCb = NULL; - mqttClient->timeoutCb = NULL; - mqttClient->dataCb = NULL; - - MQTT_INFO("MQTT: client already deleted\r\n"); -} - - -/** - * @brief Client received callback function. - * @param arg: contain the ip link information - * @param pdata: received data - * @param len: the lenght of received data - * @retval None - */ -void ICACHE_FLASH_ATTR -mqtt_tcpclient_recv(void *arg, char *pdata, unsigned short len) -{ - uint8_t msg_type; - uint8_t msg_qos; - uint16_t msg_id; - uint8_t msg_conn_ret; - - struct espconn *pCon = (struct espconn*)arg; - MQTT_Client *client = (MQTT_Client *)pCon->reverse; - -READPACKET: - MQTT_INFO("TCP: data received %d bytes\r\n", len); - // MQTT_INFO("STATE: %d\r\n", client->connState); - if (len < MQTT_BUF_SIZE && len > 0) { - os_memcpy(client->mqtt_state.in_buffer, pdata, len); - - msg_type = mqtt_get_type(client->mqtt_state.in_buffer); - msg_qos = mqtt_get_qos(client->mqtt_state.in_buffer); - msg_id = mqtt_get_id(client->mqtt_state.in_buffer, client->mqtt_state.in_buffer_length); - switch (client->connState) { - case MQTT_CONNECT_SENDING: - if (msg_type == MQTT_MSG_TYPE_CONNACK) { - if (client->mqtt_state.pending_msg_type != MQTT_MSG_TYPE_CONNECT) { - MQTT_INFO("MQTT: Invalid packet\r\n"); - if (client->security) { -#ifdef MQTT_SSL_ENABLE - espconn_secure_disconnect(client->pCon); -#else - MQTT_INFO("TCP: Do not support SSL\r\n"); -#endif - } - else { - espconn_disconnect(client->pCon); - } - } else { - msg_conn_ret = mqtt_get_connect_return_code(client->mqtt_state.in_buffer); - switch (msg_conn_ret) { - case CONNECTION_ACCEPTED: - MQTT_INFO("MQTT: Connected to %s:%d\r\n", client->host, client->port); - client->connState = MQTT_DATA; - if (client->connectedCb) - client->connectedCb((uint32_t*)client); - break; - case CONNECTION_REFUSE_PROTOCOL: - case CONNECTION_REFUSE_SERVER_UNAVAILABLE: - case CONNECTION_REFUSE_BAD_USERNAME: - case CONNECTION_REFUSE_NOT_AUTHORIZED: - MQTT_INFO("MQTT: Connection refuse, reason code: %d\r\n", msg_conn_ret); - default: - if (client->security) { -#ifdef MQTT_SSL_ENABLE - espconn_secure_disconnect(client->pCon); -#else - MQTT_INFO("TCP: Do not support SSL\r\n"); -#endif - } - else { - espconn_disconnect(client->pCon); - } - - } - - } - - } - break; - case MQTT_DATA: - case MQTT_KEEPALIVE_SEND: - client->mqtt_state.message_length_read = len; - client->mqtt_state.message_length = mqtt_get_total_length(client->mqtt_state.in_buffer, client->mqtt_state.message_length_read); - - - switch (msg_type) - { - - case MQTT_MSG_TYPE_SUBACK: - if (client->mqtt_state.pending_msg_type == MQTT_MSG_TYPE_SUBSCRIBE && client->mqtt_state.pending_msg_id == msg_id) - MQTT_INFO("MQTT: Subscribe successful\r\n"); - break; - case MQTT_MSG_TYPE_UNSUBACK: - if (client->mqtt_state.pending_msg_type == MQTT_MSG_TYPE_UNSUBSCRIBE && client->mqtt_state.pending_msg_id == msg_id) - MQTT_INFO("MQTT: UnSubscribe successful\r\n"); - break; - case MQTT_MSG_TYPE_PUBLISH: - if (msg_qos == 1) - client->mqtt_state.outbound_message = mqtt_msg_puback(&client->mqtt_state.mqtt_connection, msg_id); - else if (msg_qos == 2) - client->mqtt_state.outbound_message = mqtt_msg_pubrec(&client->mqtt_state.mqtt_connection, msg_id); - if (msg_qos == 1 || msg_qos == 2) { - MQTT_INFO("MQTT: Queue response QoS: %d\r\n", msg_qos); - if (QUEUE_Puts(&client->msgQueue, client->mqtt_state.outbound_message->data, client->mqtt_state.outbound_message->length) == -1) { - MQTT_INFO("MQTT: Queue full\r\n"); - } - } - - deliver_publish(client, client->mqtt_state.in_buffer, client->mqtt_state.message_length_read); - break; - case MQTT_MSG_TYPE_PUBACK: - if (client->mqtt_state.pending_msg_type == MQTT_MSG_TYPE_PUBLISH && client->mqtt_state.pending_msg_id == msg_id) { - MQTT_INFO("MQTT: received MQTT_MSG_TYPE_PUBACK, finish QoS1 publish\r\n"); - } - - break; - case MQTT_MSG_TYPE_PUBREC: - client->mqtt_state.outbound_message = mqtt_msg_pubrel(&client->mqtt_state.mqtt_connection, msg_id); - if (QUEUE_Puts(&client->msgQueue, client->mqtt_state.outbound_message->data, client->mqtt_state.outbound_message->length) == -1) { - MQTT_INFO("MQTT: Queue full\r\n"); - } - break; - case MQTT_MSG_TYPE_PUBREL: - client->mqtt_state.outbound_message = mqtt_msg_pubcomp(&client->mqtt_state.mqtt_connection, msg_id); - if (QUEUE_Puts(&client->msgQueue, client->mqtt_state.outbound_message->data, client->mqtt_state.outbound_message->length) == -1) { - MQTT_INFO("MQTT: Queue full\r\n"); - } - break; - case MQTT_MSG_TYPE_PUBCOMP: - if (client->mqtt_state.pending_msg_type == MQTT_MSG_TYPE_PUBLISH && client->mqtt_state.pending_msg_id == msg_id) { - MQTT_INFO("MQTT: receive MQTT_MSG_TYPE_PUBCOMP, finish QoS2 publish\r\n"); - } - break; - case MQTT_MSG_TYPE_PINGREQ: - client->mqtt_state.outbound_message = mqtt_msg_pingresp(&client->mqtt_state.mqtt_connection); - if (QUEUE_Puts(&client->msgQueue, client->mqtt_state.outbound_message->data, client->mqtt_state.outbound_message->length) == -1) { - MQTT_INFO("MQTT: Queue full\r\n"); - } - break; - case MQTT_MSG_TYPE_PINGRESP: - // Ignore - break; - } - // NOTE: this is done down here and not in the switch case above - // because the PSOCK_READBUF_LEN() won't work inside a switch - // statement due to the way protothreads resume. - if (msg_type == MQTT_MSG_TYPE_PUBLISH) - { - len = client->mqtt_state.message_length_read; - - if (client->mqtt_state.message_length < client->mqtt_state.message_length_read) - { - //client->connState = MQTT_PUBLISH_RECV; - //Not Implement yet - len -= client->mqtt_state.message_length; - pdata += client->mqtt_state.message_length; - - MQTT_INFO("Get another published message\r\n"); - goto READPACKET; - } - - } - break; - } - } else { - MQTT_INFO("ERROR: Message too long\r\n"); - } - system_os_post(MQTT_TASK_PRIO, 0, (os_param_t)client); -} - -/** - * @brief Client send over callback function. - * @param arg: contain the ip link information - * @retval None - */ -void ICACHE_FLASH_ATTR -mqtt_tcpclient_sent_cb(void *arg) -{ - struct espconn *pCon = (struct espconn *)arg; - MQTT_Client* client = (MQTT_Client *)pCon->reverse; - MQTT_INFO("TCP: Sent\r\n"); - client->sendTimeout = 0; - client->keepAliveTick = 0; - - if ((client->connState == MQTT_DATA || client->connState == MQTT_KEEPALIVE_SEND) - && client->mqtt_state.pending_msg_type == MQTT_MSG_TYPE_PUBLISH) { - if (client->publishedCb) - client->publishedCb((uint32_t*)client); - } - system_os_post(MQTT_TASK_PRIO, 0, (os_param_t)client); -} - -void ICACHE_FLASH_ATTR mqtt_timer(void *arg) -{ - MQTT_Client* client = (MQTT_Client*)arg; - - if (client->connState == MQTT_DATA) { - client->keepAliveTick ++; - if (client->keepAliveTick > (client->mqtt_state.connect_info->keepalive / 2)) { - client->connState = MQTT_KEEPALIVE_SEND; - system_os_post(MQTT_TASK_PRIO, 0, (os_param_t)client); - } - - } else if (client->connState == TCP_RECONNECT_REQ) { - client->reconnectTick ++; - if (client->reconnectTick > MQTT_RECONNECT_TIMEOUT) { - client->reconnectTick = 0; - client->connState = TCP_RECONNECT; - system_os_post(MQTT_TASK_PRIO, 0, (os_param_t)client); - if (client->timeoutCb) - client->timeoutCb((uint32_t*)client); - } - } - if (client->sendTimeout > 0) - client->sendTimeout --; -} - -void ICACHE_FLASH_ATTR -mqtt_tcpclient_discon_cb(void *arg) -{ - - struct espconn *pespconn = (struct espconn *)arg; - MQTT_Client* client = (MQTT_Client *)pespconn->reverse; - MQTT_INFO("TCP: Disconnected callback\r\n"); - if (TCP_DISCONNECTING == client->connState) { - client->connState = TCP_DISCONNECTED; - } - else if (MQTT_DELETING == client->connState) { - client->connState = MQTT_DELETED; - } - else { - client->connState = TCP_RECONNECT_REQ; - } - if (client->disconnectedCb) - client->disconnectedCb((uint32_t*)client); - - system_os_post(MQTT_TASK_PRIO, 0, (os_param_t)client); -} - - - -/** - * @brief Tcp client connect success callback function. - * @param arg: contain the ip link information - * @retval None - */ -void ICACHE_FLASH_ATTR -mqtt_tcpclient_connect_cb(void *arg) -{ - struct espconn *pCon = (struct espconn *)arg; - MQTT_Client* client = (MQTT_Client *)pCon->reverse; - - espconn_regist_disconcb(client->pCon, mqtt_tcpclient_discon_cb); - espconn_regist_recvcb(client->pCon, mqtt_tcpclient_recv);//////// - espconn_regist_sentcb(client->pCon, mqtt_tcpclient_sent_cb);/////// - MQTT_INFO("MQTT: Connected to broker %s:%d\r\n", client->host, client->port); - - mqtt_msg_init(&client->mqtt_state.mqtt_connection, client->mqtt_state.out_buffer, client->mqtt_state.out_buffer_length); - client->mqtt_state.outbound_message = mqtt_msg_connect(&client->mqtt_state.mqtt_connection, client->mqtt_state.connect_info); - client->mqtt_state.pending_msg_type = mqtt_get_type(client->mqtt_state.outbound_message->data); - client->mqtt_state.pending_msg_id = mqtt_get_id(client->mqtt_state.outbound_message->data, client->mqtt_state.outbound_message->length); - - - client->sendTimeout = MQTT_SEND_TIMOUT; - MQTT_INFO("MQTT: Sending, type: %d, id: %04X\r\n", client->mqtt_state.pending_msg_type, client->mqtt_state.pending_msg_id); - if (client->security) { -#ifdef MQTT_SSL_ENABLE - espconn_secure_send(client->pCon, client->mqtt_state.outbound_message->data, client->mqtt_state.outbound_message->length); -#else - MQTT_INFO("TCP: Do not support SSL\r\n"); -#endif - } - else { - espconn_send(client->pCon, client->mqtt_state.outbound_message->data, client->mqtt_state.outbound_message->length); - } - - client->mqtt_state.outbound_message = NULL; - client->connState = MQTT_CONNECT_SENDING; - system_os_post(MQTT_TASK_PRIO, 0, (os_param_t)client); -} - -/** - * @brief Tcp client connect repeat callback function. - * @param arg: contain the ip link information - * @retval None - */ -void ICACHE_FLASH_ATTR -mqtt_tcpclient_recon_cb(void *arg, sint8 errType) -{ - struct espconn *pCon = (struct espconn *)arg; - MQTT_Client* client = (MQTT_Client *)pCon->reverse; - - MQTT_INFO("TCP: Reconnect to %s:%d\r\n", client->host, client->port); - - client->connState = TCP_RECONNECT_REQ; - - system_os_post(MQTT_TASK_PRIO, 0, (os_param_t)client); - -} - -/** - * @brief MQTT publish function. - * @param client: MQTT_Client reference - * @param topic: string topic will publish to - * @param data: buffer data send point to - * @param data_length: length of data - * @param qos: qos - * @param retain: retain - * @retval TRUE if success queue - */ -bool ICACHE_FLASH_ATTR -MQTT_Publish(MQTT_Client *client, const char* topic, const char* data, int data_length, int qos, int retain) -{ - uint8_t dataBuffer[MQTT_BUF_SIZE]; - uint16_t dataLen; - client->mqtt_state.outbound_message = mqtt_msg_publish(&client->mqtt_state.mqtt_connection, - topic, data, data_length, - qos, retain, - &client->mqtt_state.pending_msg_id); - if (client->mqtt_state.outbound_message->length == 0) { - MQTT_INFO("MQTT: Queuing publish failed\r\n"); - return FALSE; - } - MQTT_INFO("MQTT: queuing publish, length: %d, queue size(%d/%d)\r\n", client->mqtt_state.outbound_message->length, client->msgQueue.rb.fill_cnt, client->msgQueue.rb.size); - while (QUEUE_Puts(&client->msgQueue, client->mqtt_state.outbound_message->data, client->mqtt_state.outbound_message->length) == -1) { - MQTT_INFO("MQTT: Queue full\r\n"); - if (QUEUE_Gets(&client->msgQueue, dataBuffer, &dataLen, MQTT_BUF_SIZE) == -1) { - MQTT_INFO("MQTT: Serious buffer error\r\n"); - return FALSE; - } - } - system_os_post(MQTT_TASK_PRIO, 0, (os_param_t)client); - return TRUE; -} - -/** - * @brief MQTT subscibe function. - * @param client: MQTT_Client reference - * @param topic: string topic will subscribe - * @param qos: qos - * @retval TRUE if success queue - */ -bool ICACHE_FLASH_ATTR -MQTT_Subscribe(MQTT_Client *client, char* topic, uint8_t qos) -{ - uint8_t dataBuffer[MQTT_BUF_SIZE]; - uint16_t dataLen; - - client->mqtt_state.outbound_message = mqtt_msg_subscribe(&client->mqtt_state.mqtt_connection, - topic, qos, - &client->mqtt_state.pending_msg_id); - MQTT_INFO("MQTT: queue subscribe, topic\"%s\", id: %d\r\n", topic, client->mqtt_state.pending_msg_id); - while (QUEUE_Puts(&client->msgQueue, client->mqtt_state.outbound_message->data, client->mqtt_state.outbound_message->length) == -1) { - MQTT_INFO("MQTT: Queue full\r\n"); - if (QUEUE_Gets(&client->msgQueue, dataBuffer, &dataLen, MQTT_BUF_SIZE) == -1) { - MQTT_INFO("MQTT: Serious buffer error\r\n"); - return FALSE; - } - } - system_os_post(MQTT_TASK_PRIO, 0, (os_param_t)client); - - return TRUE; -} - -/** - * @brief MQTT un-subscibe function. - * @param client: MQTT_Client reference - * @param topic: String topic will un-subscribe - * @retval TRUE if success queue - */ -bool ICACHE_FLASH_ATTR -MQTT_UnSubscribe(MQTT_Client *client, char* topic) -{ - uint8_t dataBuffer[MQTT_BUF_SIZE]; - uint16_t dataLen; - client->mqtt_state.outbound_message = mqtt_msg_unsubscribe(&client->mqtt_state.mqtt_connection, - topic, - &client->mqtt_state.pending_msg_id); - MQTT_INFO("MQTT: queue un-subscribe, topic\"%s\", id: %d\r\n", topic, client->mqtt_state.pending_msg_id); - while (QUEUE_Puts(&client->msgQueue, client->mqtt_state.outbound_message->data, client->mqtt_state.outbound_message->length) == -1) { - MQTT_INFO("MQTT: Queue full\r\n"); - if (QUEUE_Gets(&client->msgQueue, dataBuffer, &dataLen, MQTT_BUF_SIZE) == -1) { - MQTT_INFO("MQTT: Serious buffer error\r\n"); - return FALSE; - } - } - system_os_post(MQTT_TASK_PRIO, 0, (os_param_t)client); - return TRUE; -} - -/** - * @brief MQTT ping function. - * @param client: MQTT_Client reference - * @retval TRUE if success queue - */ -bool ICACHE_FLASH_ATTR -MQTT_Ping(MQTT_Client *client) -{ - uint8_t dataBuffer[MQTT_BUF_SIZE]; - uint16_t dataLen; - client->mqtt_state.outbound_message = mqtt_msg_pingreq(&client->mqtt_state.mqtt_connection); - if (client->mqtt_state.outbound_message->length == 0) { - MQTT_INFO("MQTT: Queuing publish failed\r\n"); - return FALSE; - } - MQTT_INFO("MQTT: queuing publish, length: %d, queue size(%d/%d)\r\n", client->mqtt_state.outbound_message->length, client->msgQueue.rb.fill_cnt, client->msgQueue.rb.size); - while (QUEUE_Puts(&client->msgQueue, client->mqtt_state.outbound_message->data, client->mqtt_state.outbound_message->length) == -1) { - MQTT_INFO("MQTT: Queue full\r\n"); - if (QUEUE_Gets(&client->msgQueue, dataBuffer, &dataLen, MQTT_BUF_SIZE) == -1) { - MQTT_INFO("MQTT: Serious buffer error\r\n"); - return FALSE; - } - } - system_os_post(MQTT_TASK_PRIO, 0, (os_param_t)client); - return TRUE; -} - -void ICACHE_FLASH_ATTR -MQTT_Task(os_event_t *e) -{ - MQTT_Client* client = (MQTT_Client*)e->par; - uint8_t dataBuffer[MQTT_BUF_SIZE]; - uint16_t dataLen; - if (e->par == 0) - return; - switch (client->connState) { - - case TCP_RECONNECT_REQ: - break; - case TCP_RECONNECT: - mqtt_tcpclient_delete(client); - MQTT_Connect(client); - MQTT_INFO("TCP: Reconnect to: %s:%d\r\n", client->host, client->port); - client->connState = TCP_CONNECTING; - break; - case MQTT_DELETING: - case TCP_DISCONNECTING: - case TCP_RECONNECT_DISCONNECTING: - if (client->security) { -#ifdef MQTT_SSL_ENABLE - espconn_secure_disconnect(client->pCon); -#else - MQTT_INFO("TCP: Do not support SSL\r\n"); -#endif - } - else { - espconn_disconnect(client->pCon); - } - break; - case TCP_DISCONNECTED: - MQTT_INFO("MQTT: Disconnected\r\n"); - mqtt_tcpclient_delete(client); - break; - case MQTT_DELETED: - MQTT_INFO("MQTT: Deleted client\r\n"); - mqtt_client_delete(client); - break; - case MQTT_KEEPALIVE_SEND: - mqtt_send_keepalive(client); - break; - case MQTT_DATA: - if (QUEUE_IsEmpty(&client->msgQueue) || client->sendTimeout != 0) { - break; - } - if (QUEUE_Gets(&client->msgQueue, dataBuffer, &dataLen, MQTT_BUF_SIZE) == 0) { - client->mqtt_state.pending_msg_type = mqtt_get_type(dataBuffer); - client->mqtt_state.pending_msg_id = mqtt_get_id(dataBuffer, dataLen); - - - client->sendTimeout = MQTT_SEND_TIMOUT; - MQTT_INFO("MQTT: Sending, type: %d, id: %04X\r\n", client->mqtt_state.pending_msg_type, client->mqtt_state.pending_msg_id); - client->keepAliveTick = 0; - if (client->security) { -#ifdef MQTT_SSL_ENABLE - espconn_secure_send(client->pCon, dataBuffer, dataLen); -#else - MQTT_INFO("TCP: Do not support SSL\r\n"); -#endif - } - else { - espconn_send(client->pCon, dataBuffer, dataLen); - } - - client->mqtt_state.outbound_message = NULL; - break; - } - break; - } -} - -/** - * @brief MQTT initialization connection function - * @param client: MQTT_Client reference - * @param host: Domain or IP string - * @param port: Port to connect - * @param security: 1 for ssl, 0 for none - * @retval None - */ -void ICACHE_FLASH_ATTR -MQTT_InitConnection(MQTT_Client *mqttClient, uint8_t* host, uint32_t port, uint8_t security) -{ - uint32_t temp; - MQTT_INFO("MQTT:InitConnection\r\n"); - os_memset(mqttClient, 0, sizeof(MQTT_Client)); - temp = os_strlen(host); - mqttClient->host = (uint8_t*)os_zalloc(temp + 1); - os_strcpy(mqttClient->host, host); - mqttClient->host[temp] = 0; - mqttClient->port = port; - mqttClient->security = security; - -} - -/** - * @brief MQTT initialization mqtt client function - * @param client: MQTT_Client reference - * @param clientid: MQTT client id - * @param client_user:MQTT client user - * @param client_pass:MQTT client password - * @param client_pass:MQTT keep alive timer, in second - * @retval None - */ -bool ICACHE_FLASH_ATTR -MQTT_InitClient(MQTT_Client *mqttClient, uint8_t* client_id, uint8_t* client_user, uint8_t* client_pass, uint32_t keepAliveTime, uint8_t cleanSession) -{ - uint32_t temp; - MQTT_INFO("MQTT:InitClient\r\n"); - - os_memset(&mqttClient->connect_info, 0, sizeof(mqtt_connect_info_t)); - - if ( !client_id ) - { - /* Should be allowed by broker, but clean session flag must be set. */ - #ifdef PROTOCOL_NAMEv311 - if (cleanSession) - { - mqttClient->connect_info.client_id = zero_len_id; - } else { - MQTT_INFO("cleanSession must be set to use 0 length client_id\r\n"); - return false; - } - /* Not supported. Return. */ - #else - MQTT_INFO("Client ID required for MQTT < 3.1.1!\r\n"); - return false; - #endif - } - - /* If connect_info's client_id is still NULL and we get here, we can * - * assume the passed client_id is non-NULL. */ - if ( !(mqttClient->connect_info.client_id) ) - { - temp = os_strlen(client_id); - mqttClient->connect_info.client_id = (uint8_t*)os_zalloc(temp + 1); - os_strcpy(mqttClient->connect_info.client_id, client_id); - mqttClient->connect_info.client_id[temp] = 0; - } - - if (client_user) - { - temp = os_strlen(client_user); - mqttClient->connect_info.username = (uint8_t*)os_zalloc(temp + 1); - os_strcpy(mqttClient->connect_info.username, client_user); - mqttClient->connect_info.username[temp] = 0; - } - - if (client_pass) - { - temp = os_strlen(client_pass); - mqttClient->connect_info.password = (uint8_t*)os_zalloc(temp + 1); - os_strcpy(mqttClient->connect_info.password, client_pass); - mqttClient->connect_info.password[temp] = 0; - } - - - mqttClient->connect_info.keepalive = keepAliveTime; - mqttClient->connect_info.clean_session = cleanSession; - - mqttClient->mqtt_state.in_buffer = (uint8_t *)os_zalloc(MQTT_BUF_SIZE); - mqttClient->mqtt_state.in_buffer_length = MQTT_BUF_SIZE; - mqttClient->mqtt_state.out_buffer = (uint8_t *)os_zalloc(MQTT_BUF_SIZE); - mqttClient->mqtt_state.out_buffer_length = MQTT_BUF_SIZE; - mqttClient->mqtt_state.connect_info = &mqttClient->connect_info; - - mqtt_msg_init(&mqttClient->mqtt_state.mqtt_connection, mqttClient->mqtt_state.out_buffer, mqttClient->mqtt_state.out_buffer_length); - - QUEUE_Init(&mqttClient->msgQueue, QUEUE_BUFFER_SIZE); - - system_os_task(MQTT_Task, MQTT_TASK_PRIO, mqtt_procTaskQueue, MQTT_TASK_QUEUE_SIZE); - system_os_post(MQTT_TASK_PRIO, 0, (os_param_t)mqttClient); - return true; -} -void ICACHE_FLASH_ATTR -MQTT_InitLWT(MQTT_Client *mqttClient, uint8_t* will_topic, uint8_t* will_msg, uint8_t will_qos, uint8_t will_retain) -{ - uint32_t temp; - temp = os_strlen(will_topic); - mqttClient->connect_info.will_topic = (uint8_t*)os_zalloc(temp + 1); - os_strcpy(mqttClient->connect_info.will_topic, will_topic); - mqttClient->connect_info.will_topic[temp] = 0; - - temp = os_strlen(will_msg); - mqttClient->connect_info.will_message = (uint8_t*)os_zalloc(temp + 1); - os_strcpy(mqttClient->connect_info.will_message, will_msg); - mqttClient->connect_info.will_message[temp] = 0; - - - mqttClient->connect_info.will_qos = will_qos; - mqttClient->connect_info.will_retain = will_retain; -} -/** - * @brief Begin connect to MQTT broker - * @param client: MQTT_Client reference - * @retval None - */ -void ICACHE_FLASH_ATTR -MQTT_Connect(MQTT_Client *mqttClient) -{ - if (mqttClient->pCon) { - // Clean up the old connection forcefully - using MQTT_Disconnect - // does not actually release the old connection until the - // disconnection callback is invoked. - mqtt_tcpclient_delete(mqttClient); - } - mqttClient->pCon = (struct espconn *)os_zalloc(sizeof(struct espconn)); - mqttClient->pCon->type = ESPCONN_TCP; - mqttClient->pCon->state = ESPCONN_NONE; - mqttClient->pCon->proto.tcp = (esp_tcp *)os_zalloc(sizeof(esp_tcp)); - mqttClient->pCon->proto.tcp->local_port = espconn_port(); - mqttClient->pCon->proto.tcp->remote_port = mqttClient->port; - mqttClient->pCon->reverse = mqttClient; - espconn_regist_connectcb(mqttClient->pCon, mqtt_tcpclient_connect_cb); - espconn_regist_reconcb(mqttClient->pCon, mqtt_tcpclient_recon_cb); - - mqttClient->keepAliveTick = 0; - mqttClient->reconnectTick = 0; - - - os_timer_disarm(&mqttClient->mqttTimer); - os_timer_setfn(&mqttClient->mqttTimer, (os_timer_func_t *)mqtt_timer, mqttClient); - os_timer_arm(&mqttClient->mqttTimer, 1000, 1); - - if (UTILS_StrToIP(mqttClient->host, &mqttClient->pCon->proto.tcp->remote_ip)) { - MQTT_INFO("TCP: Connect to ip %s:%d\r\n", mqttClient->host, mqttClient->port); - if (mqttClient->security) - { -#ifdef MQTT_SSL_ENABLE - espconn_secure_set_size(ESPCONN_CLIENT, MQTT_SSL_SIZE); - espconn_secure_connect(mqttClient->pCon); -#else - MQTT_INFO("TCP: Do not support SSL\r\n"); -#endif - } - else - { - espconn_connect(mqttClient->pCon); - } - } - else { - MQTT_INFO("TCP: Connect to domain %s:%d\r\n", mqttClient->host, mqttClient->port); - espconn_gethostbyname(mqttClient->pCon, mqttClient->host, &mqttClient->ip, mqtt_dns_found); - } - mqttClient->connState = TCP_CONNECTING; -} - -void ICACHE_FLASH_ATTR -MQTT_Disconnect(MQTT_Client *mqttClient) -{ - mqttClient->connState = TCP_DISCONNECTING; - system_os_post(MQTT_TASK_PRIO, 0, (os_param_t)mqttClient); - os_timer_disarm(&mqttClient->mqttTimer); -} - -void ICACHE_FLASH_ATTR -MQTT_DeleteClient(MQTT_Client *mqttClient) -{ - if (NULL == mqttClient) - return; - - mqttClient->connState = MQTT_DELETED; - // if(TCP_DISCONNECTED == mqttClient->connState) { - // mqttClient->connState = MQTT_DELETED; - // } else if(MQTT_DELETED != mqttClient->connState) { - // mqttClient->connState = MQTT_DELETING; - // } - - system_os_post(MQTT_TASK_PRIO, 0, (os_param_t)mqttClient); - os_timer_disarm(&mqttClient->mqttTimer); -} - -void ICACHE_FLASH_ATTR -MQTT_OnConnected(MQTT_Client *mqttClient, MqttCallback connectedCb) -{ - mqttClient->connectedCb = connectedCb; -} - -void ICACHE_FLASH_ATTR -MQTT_OnDisconnected(MQTT_Client *mqttClient, MqttCallback disconnectedCb) -{ - mqttClient->disconnectedCb = disconnectedCb; -} - -void ICACHE_FLASH_ATTR -MQTT_OnData(MQTT_Client *mqttClient, MqttDataCallback dataCb) -{ - mqttClient->dataCb = dataCb; -} - -void ICACHE_FLASH_ATTR -MQTT_OnPublished(MQTT_Client *mqttClient, MqttCallback publishedCb) -{ - mqttClient->publishedCb = publishedCb; -} - -void ICACHE_FLASH_ATTR -MQTT_OnTimeout(MQTT_Client *mqttClient, MqttCallback timeoutCb) -{ - mqttClient->timeoutCb = timeoutCb; -} diff --git a/lib/TasmotaMqtt-1.1.1/src/mqtt/mqtt.h b/lib/TasmotaMqtt-1.1.1/src/mqtt/mqtt.h deleted file mode 100644 index 96489107e..000000000 --- a/lib/TasmotaMqtt-1.1.1/src/mqtt/mqtt.h +++ /dev/null @@ -1,148 +0,0 @@ -/* mqtt.h -* -* Copyright (c) 2014-2015, Tuan PM -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* -* * Redistributions of source code must retain the above copyright notice, -* this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of Redis nor the names of its contributors may be used -* to endorse or promote products derived from this software without -* specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -* POSSIBILITY OF SUCH DAMAGE. -*/ -#ifndef USER_AT_MQTT_H_ -#define USER_AT_MQTT_H_ -#include "user_config.h" -#include "mqtt_msg.h" -#include "user_interface.h" - -#include "queue.h" -typedef struct mqtt_event_data_t -{ - uint8_t type; - const char* topic; - const char* data; - uint16_t topic_length; - uint16_t data_length; - uint16_t data_offset; -} mqtt_event_data_t; - -typedef struct mqtt_state_t -{ - uint16_t port; - int auto_reconnect; - mqtt_connect_info_t* connect_info; - uint8_t* in_buffer; - uint8_t* out_buffer; - int in_buffer_length; - int out_buffer_length; - uint16_t message_length; - uint16_t message_length_read; - mqtt_message_t* outbound_message; - mqtt_connection_t mqtt_connection; - uint16_t pending_msg_id; - int pending_msg_type; - int pending_publish_qos; -} mqtt_state_t; - -typedef enum { - WIFI_INIT, - WIFI_CONNECTING, - WIFI_CONNECTING_ERROR, - WIFI_CONNECTED, - DNS_RESOLVE, - TCP_DISCONNECTING, - TCP_DISCONNECTED, - TCP_RECONNECT_DISCONNECTING, - TCP_RECONNECT_REQ, - TCP_RECONNECT, - TCP_CONNECTING, - TCP_CONNECTING_ERROR, - TCP_CONNECTED, - MQTT_CONNECT_SEND, - MQTT_CONNECT_SENDING, - MQTT_SUBSCIBE_SEND, - MQTT_SUBSCIBE_SENDING, - MQTT_DATA, - MQTT_KEEPALIVE_SEND, - MQTT_PUBLISH_RECV, - MQTT_PUBLISHING, - MQTT_DELETING, - MQTT_DELETED, -} tConnState; - -typedef void (*MqttCallback)(uint32_t *args); -typedef void (*MqttDataCallback)(uint32_t *args, const char* topic, uint32_t topic_len, const char *data, uint32_t lengh); - -typedef struct { - struct espconn *pCon; - uint8_t security; - uint8_t* host; - uint32_t port; - ip_addr_t ip; - mqtt_state_t mqtt_state; - mqtt_connect_info_t connect_info; - MqttCallback connectedCb; - MqttCallback disconnectedCb; - MqttCallback publishedCb; - MqttCallback timeoutCb; - MqttDataCallback dataCb; - ETSTimer mqttTimer; - uint32_t keepAliveTick; - uint32_t reconnectTick; - uint32_t sendTimeout; - tConnState connState; - QUEUE msgQueue; - void* user_data; -} MQTT_Client; - -#define SEC_NONSSL 0 -#define SEC_SSL 1 - -#define MQTT_FLAG_CONNECTED 1 -#define MQTT_FLAG_READY 2 -#define MQTT_FLAG_EXIT 4 - -#define MQTT_EVENT_TYPE_NONE 0 -#define MQTT_EVENT_TYPE_CONNECTED 1 -#define MQTT_EVENT_TYPE_DISCONNECTED 2 -#define MQTT_EVENT_TYPE_SUBSCRIBED 3 -#define MQTT_EVENT_TYPE_UNSUBSCRIBED 4 -#define MQTT_EVENT_TYPE_PUBLISH 5 -#define MQTT_EVENT_TYPE_PUBLISHED 6 -#define MQTT_EVENT_TYPE_EXITED 7 -#define MQTT_EVENT_TYPE_PUBLISH_CONTINUATION 8 - -void ICACHE_FLASH_ATTR MQTT_InitConnection(MQTT_Client *mqttClient, uint8_t* host, uint32_t port, uint8_t security); -bool ICACHE_FLASH_ATTR MQTT_InitClient(MQTT_Client *mqttClient, uint8_t* client_id, uint8_t* client_user, uint8_t* client_pass, uint32_t keepAliveTime, uint8_t cleanSession); -void ICACHE_FLASH_ATTR MQTT_DeleteClient(MQTT_Client *mqttClient); -void ICACHE_FLASH_ATTR MQTT_InitLWT(MQTT_Client *mqttClient, uint8_t* will_topic, uint8_t* will_msg, uint8_t will_qos, uint8_t will_retain); -void ICACHE_FLASH_ATTR MQTT_OnConnected(MQTT_Client *mqttClient, MqttCallback connectedCb); -void ICACHE_FLASH_ATTR MQTT_OnDisconnected(MQTT_Client *mqttClient, MqttCallback disconnectedCb); -void ICACHE_FLASH_ATTR MQTT_OnPublished(MQTT_Client *mqttClient, MqttCallback publishedCb); -void ICACHE_FLASH_ATTR MQTT_OnTimeout(MQTT_Client *mqttClient, MqttCallback timeoutCb); -void ICACHE_FLASH_ATTR MQTT_OnData(MQTT_Client *mqttClient, MqttDataCallback dataCb); -bool ICACHE_FLASH_ATTR MQTT_Subscribe(MQTT_Client *client, char* topic, uint8_t qos); -bool ICACHE_FLASH_ATTR MQTT_UnSubscribe(MQTT_Client *client, char* topic); -void ICACHE_FLASH_ATTR MQTT_Connect(MQTT_Client *mqttClient); -void ICACHE_FLASH_ATTR MQTT_Disconnect(MQTT_Client *mqttClient); -bool ICACHE_FLASH_ATTR MQTT_Publish(MQTT_Client *client, const char* topic, const char* data, int data_length, int qos, int retain); - -#endif /* USER_AT_MQTT_H_ */ diff --git a/lib/TasmotaMqtt-1.1.1/src/mqtt/mqtt_msg.c b/lib/TasmotaMqtt-1.1.1/src/mqtt/mqtt_msg.c deleted file mode 100644 index 57dcbac27..000000000 --- a/lib/TasmotaMqtt-1.1.1/src/mqtt/mqtt_msg.c +++ /dev/null @@ -1,487 +0,0 @@ -/* -* Copyright (c) 2014, Stephen Robinson -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* 1. Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* 2. Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* 3. Neither the name of the copyright holder nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -* POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#include -#include "mqtt_msg.h" -#include "user_config.h" -#define MQTT_MAX_FIXED_HEADER_SIZE 3 - -enum mqtt_connect_flag -{ - MQTT_CONNECT_FLAG_USERNAME = 1 << 7, - MQTT_CONNECT_FLAG_PASSWORD = 1 << 6, - MQTT_CONNECT_FLAG_WILL_RETAIN = 1 << 5, - MQTT_CONNECT_FLAG_WILL = 1 << 2, - MQTT_CONNECT_FLAG_CLEAN_SESSION = 1 << 1 -}; - -struct __attribute((__packed__)) mqtt_connect_variable_header -{ - uint8_t lengthMsb; - uint8_t lengthLsb; -#if defined(PROTOCOL_NAMEv31) - uint8_t magic[6]; -#elif defined(PROTOCOL_NAMEv311) - uint8_t magic[4]; -#else -#error "Please define protocol name" -#endif - uint8_t version; - uint8_t flags; - uint8_t keepaliveMsb; - uint8_t keepaliveLsb; -}; - -static int ICACHE_FLASH_ATTR append_string(mqtt_connection_t* connection, const char* string, int len) -{ - if (connection->message.length + len + 2 > connection->buffer_length) - return -1; - - connection->buffer[connection->message.length++] = len >> 8; - connection->buffer[connection->message.length++] = len & 0xff; - memcpy(connection->buffer + connection->message.length, string, len); - connection->message.length += len; - - return len + 2; -} - -static uint16_t ICACHE_FLASH_ATTR append_message_id(mqtt_connection_t* connection, uint16_t message_id) -{ - // If message_id is zero then we should assign one, otherwise - // we'll use the one supplied by the caller - while (message_id == 0) - message_id = ++connection->message_id; - - if (connection->message.length + 2 > connection->buffer_length) - return 0; - - connection->buffer[connection->message.length++] = message_id >> 8; - connection->buffer[connection->message.length++] = message_id & 0xff; - - return message_id; -} - -static int ICACHE_FLASH_ATTR init_message(mqtt_connection_t* connection) -{ - connection->message.length = MQTT_MAX_FIXED_HEADER_SIZE; - return MQTT_MAX_FIXED_HEADER_SIZE; -} - -static mqtt_message_t* ICACHE_FLASH_ATTR fail_message(mqtt_connection_t* connection) -{ - connection->message.data = connection->buffer; - connection->message.length = 0; - return &connection->message; -} - -static mqtt_message_t* ICACHE_FLASH_ATTR fini_message(mqtt_connection_t* connection, int type, int dup, int qos, int retain) -{ - int remaining_length = connection->message.length - MQTT_MAX_FIXED_HEADER_SIZE; - - if (remaining_length > 127) - { - connection->buffer[0] = ((type & 0x0f) << 4) | ((dup & 1) << 3) | ((qos & 3) << 1) | (retain & 1); - connection->buffer[1] = 0x80 | (remaining_length % 128); - connection->buffer[2] = remaining_length / 128; - connection->message.length = remaining_length + 3; - connection->message.data = connection->buffer; - } - else - { - connection->buffer[1] = ((type & 0x0f) << 4) | ((dup & 1) << 3) | ((qos & 3) << 1) | (retain & 1); - connection->buffer[2] = remaining_length; - connection->message.length = remaining_length + 2; - connection->message.data = connection->buffer + 1; - } - - return &connection->message; -} - -void ICACHE_FLASH_ATTR mqtt_msg_init(mqtt_connection_t* connection, uint8_t* buffer, uint16_t buffer_length) -{ - memset(connection, 0, sizeof(mqtt_connection_t)); - connection->buffer = buffer; - connection->buffer_length = buffer_length; -} - -int ICACHE_FLASH_ATTR mqtt_get_total_length(uint8_t* buffer, uint16_t length) -{ - int i; - int totlen = 0; - - for (i = 1; i < length; ++i) - { - totlen += (buffer[i] & 0x7f) << (7 * (i - 1)); - if ((buffer[i] & 0x80) == 0) - { - ++i; - break; - } - } - totlen += i; - - return totlen; -} - -const char* ICACHE_FLASH_ATTR mqtt_get_publish_topic(uint8_t* buffer, uint16_t* length) -{ - int i; - int totlen = 0; - int topiclen; - - for (i = 1; i < *length; ++i) - { - totlen += (buffer[i] & 0x7f) << (7 * (i - 1)); - if ((buffer[i] & 0x80) == 0) - { - ++i; - break; - } - } - totlen += i; - - if (i + 2 >= *length) - return NULL; - topiclen = buffer[i++] << 8; - topiclen |= buffer[i++]; - - if (i + topiclen > *length) - return NULL; - - *length = topiclen; - return (const char*)(buffer + i); -} - -const char* ICACHE_FLASH_ATTR mqtt_get_publish_data(uint8_t* buffer, uint16_t* length) -{ - int i; - int totlen = 0; - int topiclen; - int blength = *length; - *length = 0; - - for (i = 1; i < blength; ++i) - { - totlen += (buffer[i] & 0x7f) << (7 * (i - 1)); - if ((buffer[i] & 0x80) == 0) - { - ++i; - break; - } - } - totlen += i; - - if (i + 2 >= blength) - return NULL; - topiclen = buffer[i++] << 8; - topiclen |= buffer[i++]; - - if (i + topiclen >= blength) - return NULL; - - i += topiclen; - - if (mqtt_get_qos(buffer) > 0) - { - if (i + 2 >= blength) - return NULL; - i += 2; - } - - if (totlen < i) - return NULL; - - if (totlen <= blength) - *length = totlen - i; - else - *length = blength - i; - return (const char*)(buffer + i); -} - -uint16_t ICACHE_FLASH_ATTR mqtt_get_id(uint8_t* buffer, uint16_t length) -{ - if (length < 1) - return 0; - - switch (mqtt_get_type(buffer)) - { - case MQTT_MSG_TYPE_PUBLISH: - { - int i; - int topiclen; - - for (i = 1; i < length; ++i) - { - if ((buffer[i] & 0x80) == 0) - { - ++i; - break; - } - } - - if (i + 2 >= length) - return 0; - topiclen = buffer[i++] << 8; - topiclen |= buffer[i++]; - - if (i + topiclen >= length) - return 0; - i += topiclen; - - if (mqtt_get_qos(buffer) > 0) - { - if (i + 2 >= length) - return 0; - //i += 2; - } else { - return 0; - } - - return (buffer[i] << 8) | buffer[i + 1]; - } - case MQTT_MSG_TYPE_PUBACK: - case MQTT_MSG_TYPE_PUBREC: - case MQTT_MSG_TYPE_PUBREL: - case MQTT_MSG_TYPE_PUBCOMP: - case MQTT_MSG_TYPE_SUBACK: - case MQTT_MSG_TYPE_UNSUBACK: - case MQTT_MSG_TYPE_SUBSCRIBE: - { - // This requires the remaining length to be encoded in 1 byte, - // which it should be. - if (length >= 4 && (buffer[1] & 0x80) == 0) - return (buffer[2] << 8) | buffer[3]; - else - return 0; - } - - default: - return 0; - } -} - -mqtt_message_t* ICACHE_FLASH_ATTR mqtt_msg_connect(mqtt_connection_t* connection, mqtt_connect_info_t* info) -{ - struct mqtt_connect_variable_header* variable_header; - - init_message(connection); - - if (connection->message.length + sizeof(*variable_header) > connection->buffer_length) - return fail_message(connection); - variable_header = (void*)(connection->buffer + connection->message.length); - connection->message.length += sizeof(*variable_header); - - variable_header->lengthMsb = 0; -#if defined(PROTOCOL_NAMEv31) - variable_header->lengthLsb = 6; - memcpy(variable_header->magic, "MQIsdp", 6); - variable_header->version = 3; -#elif defined(PROTOCOL_NAMEv311) - variable_header->lengthLsb = 4; - memcpy(variable_header->magic, "MQTT", 4); - variable_header->version = 4; -#else -#error "Please define protocol name" -#endif - - variable_header->flags = 0; - variable_header->keepaliveMsb = info->keepalive >> 8; - variable_header->keepaliveLsb = info->keepalive & 0xff; - - if (info->clean_session) - variable_header->flags |= MQTT_CONNECT_FLAG_CLEAN_SESSION; - - if (info->client_id == NULL) - { - /* Never allowed */ - return fail_message(connection); - } - else if (info->client_id[0] == '\0') - { -#ifdef PROTOCOL_NAMEv311 - /* Allowed. Format 0 Length ID */ - append_string(connection, info->client_id, 2) ; -#else - /* 0 Length not allowed */ - return fail_message(connection); -#endif - } - else - { - /* No 0 data and at least 1 long. Good to go. */ - if(append_string(connection, info->client_id, strlen(info->client_id)) < 0) - return fail_message(connection); - } - - if (info->will_topic != NULL && info->will_topic[0] != '\0') - { - if (append_string(connection, info->will_topic, strlen(info->will_topic)) < 0) - return fail_message(connection); - - if (append_string(connection, info->will_message, strlen(info->will_message)) < 0) - return fail_message(connection); - - variable_header->flags |= MQTT_CONNECT_FLAG_WILL; - if (info->will_retain) - variable_header->flags |= MQTT_CONNECT_FLAG_WILL_RETAIN; - variable_header->flags |= (info->will_qos & 3) << 3; - } - - if (info->username != NULL && info->username[0] != '\0') - { - if (append_string(connection, info->username, strlen(info->username)) < 0) - return fail_message(connection); - - variable_header->flags |= MQTT_CONNECT_FLAG_USERNAME; - } - - if (info->password != NULL && info->password[0] != '\0') - { - if (append_string(connection, info->password, strlen(info->password)) < 0) - return fail_message(connection); - - variable_header->flags |= MQTT_CONNECT_FLAG_PASSWORD; - } - - return fini_message(connection, MQTT_MSG_TYPE_CONNECT, 0, 0, 0); -} - -mqtt_message_t* ICACHE_FLASH_ATTR mqtt_msg_publish(mqtt_connection_t* connection, const char* topic, const char* data, int data_length, int qos, int retain, uint16_t* message_id) -{ - init_message(connection); - - if (topic == NULL || topic[0] == '\0') - return fail_message(connection); - - if (append_string(connection, topic, strlen(topic)) < 0) - return fail_message(connection); - - if (qos > 0) - { - if ((*message_id = append_message_id(connection, 0)) == 0) - return fail_message(connection); - } - else - *message_id = 0; - - if (connection->message.length + data_length > connection->buffer_length) - return fail_message(connection); - memcpy(connection->buffer + connection->message.length, data, data_length); - connection->message.length += data_length; - - return fini_message(connection, MQTT_MSG_TYPE_PUBLISH, 0, qos, retain); -} - -mqtt_message_t* ICACHE_FLASH_ATTR mqtt_msg_puback(mqtt_connection_t* connection, uint16_t message_id) -{ - init_message(connection); - if (append_message_id(connection, message_id) == 0) - return fail_message(connection); - return fini_message(connection, MQTT_MSG_TYPE_PUBACK, 0, 0, 0); -} - -mqtt_message_t* ICACHE_FLASH_ATTR mqtt_msg_pubrec(mqtt_connection_t* connection, uint16_t message_id) -{ - init_message(connection); - if (append_message_id(connection, message_id) == 0) - return fail_message(connection); - return fini_message(connection, MQTT_MSG_TYPE_PUBREC, 0, 0, 0); -} - -mqtt_message_t* ICACHE_FLASH_ATTR mqtt_msg_pubrel(mqtt_connection_t* connection, uint16_t message_id) -{ - init_message(connection); - if (append_message_id(connection, message_id) == 0) - return fail_message(connection); - return fini_message(connection, MQTT_MSG_TYPE_PUBREL, 0, 1, 0); -} - -mqtt_message_t* ICACHE_FLASH_ATTR mqtt_msg_pubcomp(mqtt_connection_t* connection, uint16_t message_id) -{ - init_message(connection); - if (append_message_id(connection, message_id) == 0) - return fail_message(connection); - return fini_message(connection, MQTT_MSG_TYPE_PUBCOMP, 0, 0, 0); -} - -mqtt_message_t* ICACHE_FLASH_ATTR mqtt_msg_subscribe(mqtt_connection_t* connection, const char* topic, int qos, uint16_t* message_id) -{ - init_message(connection); - - if (topic == NULL || topic[0] == '\0') - return fail_message(connection); - - if ((*message_id = append_message_id(connection, 0)) == 0) - return fail_message(connection); - - if (append_string(connection, topic, strlen(topic)) < 0) - return fail_message(connection); - - if (connection->message.length + 1 > connection->buffer_length) - return fail_message(connection); - connection->buffer[connection->message.length++] = qos; - - return fini_message(connection, MQTT_MSG_TYPE_SUBSCRIBE, 0, 1, 0); -} - -mqtt_message_t* ICACHE_FLASH_ATTR mqtt_msg_unsubscribe(mqtt_connection_t* connection, const char* topic, uint16_t* message_id) -{ - init_message(connection); - - if (topic == NULL || topic[0] == '\0') - return fail_message(connection); - - if ((*message_id = append_message_id(connection, 0)) == 0) - return fail_message(connection); - - if (append_string(connection, topic, strlen(topic)) < 0) - return fail_message(connection); - - return fini_message(connection, MQTT_MSG_TYPE_UNSUBSCRIBE, 0, 1, 0); -} - -mqtt_message_t* ICACHE_FLASH_ATTR mqtt_msg_pingreq(mqtt_connection_t* connection) -{ - init_message(connection); - return fini_message(connection, MQTT_MSG_TYPE_PINGREQ, 0, 0, 0); -} - -mqtt_message_t* ICACHE_FLASH_ATTR mqtt_msg_pingresp(mqtt_connection_t* connection) -{ - init_message(connection); - return fini_message(connection, MQTT_MSG_TYPE_PINGRESP, 0, 0, 0); -} - -mqtt_message_t* ICACHE_FLASH_ATTR mqtt_msg_disconnect(mqtt_connection_t* connection) -{ - init_message(connection); - return fini_message(connection, MQTT_MSG_TYPE_DISCONNECT, 0, 0, 0); -} diff --git a/lib/TasmotaMqtt-1.1.1/src/mqtt/mqtt_msg.h b/lib/TasmotaMqtt-1.1.1/src/mqtt/mqtt_msg.h deleted file mode 100644 index be3cc55cb..000000000 --- a/lib/TasmotaMqtt-1.1.1/src/mqtt/mqtt_msg.h +++ /dev/null @@ -1,141 +0,0 @@ -/* - * File: mqtt_msg.h - * Author: Minh Tuan - * - * Created on July 12, 2014, 1:05 PM - */ - -#ifndef MQTT_MSG_H -#define MQTT_MSG_H -#include "user_config.h" -#include "c_types.h" -#ifdef __cplusplus -extern "C" { -#endif - -/* -* Copyright (c) 2014, Stephen Robinson -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* 1. Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* 2. Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* 3. Neither the name of the copyright holder nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -* POSSIBILITY OF SUCH DAMAGE. -* -*/ -/* 7 6 5 4 3 2 1 0*/ -/*| --- Message Type---- | DUP Flag | QoS Level | Retain | -/* Remaining Length */ - - -enum mqtt_message_type -{ - MQTT_MSG_TYPE_CONNECT = 1, - MQTT_MSG_TYPE_CONNACK = 2, - MQTT_MSG_TYPE_PUBLISH = 3, - MQTT_MSG_TYPE_PUBACK = 4, - MQTT_MSG_TYPE_PUBREC = 5, - MQTT_MSG_TYPE_PUBREL = 6, - MQTT_MSG_TYPE_PUBCOMP = 7, - MQTT_MSG_TYPE_SUBSCRIBE = 8, - MQTT_MSG_TYPE_SUBACK = 9, - MQTT_MSG_TYPE_UNSUBSCRIBE = 10, - MQTT_MSG_TYPE_UNSUBACK = 11, - MQTT_MSG_TYPE_PINGREQ = 12, - MQTT_MSG_TYPE_PINGRESP = 13, - MQTT_MSG_TYPE_DISCONNECT = 14 -}; - -enum mqtt_connect_return_code -{ - CONNECTION_ACCEPTED = 0, - CONNECTION_REFUSE_PROTOCOL, - CONNECTION_REFUSE_ID_REJECTED, - CONNECTION_REFUSE_SERVER_UNAVAILABLE, - CONNECTION_REFUSE_BAD_USERNAME, - CONNECTION_REFUSE_NOT_AUTHORIZED -}; - -typedef struct mqtt_message -{ - uint8_t* data; - uint16_t length; - -} mqtt_message_t; - -typedef struct mqtt_connection -{ - mqtt_message_t message; - - uint16_t message_id; - uint8_t* buffer; - uint16_t buffer_length; - -} mqtt_connection_t; - -typedef struct mqtt_connect_info -{ - char* client_id; - char* username; - char* password; - char* will_topic; - char* will_message; - uint32_t keepalive; - int will_qos; - int will_retain; - int clean_session; - -} mqtt_connect_info_t; - - -static inline int ICACHE_FLASH_ATTR mqtt_get_type(uint8_t* buffer) { return (buffer[0] & 0xf0) >> 4; } -static inline int ICACHE_FLASH_ATTR mqtt_get_connect_return_code(uint8_t* buffer) { return buffer[3]; } -static inline int ICACHE_FLASH_ATTR mqtt_get_dup(uint8_t* buffer) { return (buffer[0] & 0x08) >> 3; } -static inline int ICACHE_FLASH_ATTR mqtt_get_qos(uint8_t* buffer) { return (buffer[0] & 0x06) >> 1; } -static inline int ICACHE_FLASH_ATTR mqtt_get_retain(uint8_t* buffer) { return (buffer[0] & 0x01); } - -void ICACHE_FLASH_ATTR mqtt_msg_init(mqtt_connection_t* connection, uint8_t* buffer, uint16_t buffer_length); -int ICACHE_FLASH_ATTR mqtt_get_total_length(uint8_t* buffer, uint16_t length); -const char* ICACHE_FLASH_ATTR mqtt_get_publish_topic(uint8_t* buffer, uint16_t* length); -const char* ICACHE_FLASH_ATTR mqtt_get_publish_data(uint8_t* buffer, uint16_t* length); -uint16_t ICACHE_FLASH_ATTR mqtt_get_id(uint8_t* buffer, uint16_t length); - -mqtt_message_t* ICACHE_FLASH_ATTR mqtt_msg_connect(mqtt_connection_t* connection, mqtt_connect_info_t* info); -mqtt_message_t* ICACHE_FLASH_ATTR mqtt_msg_publish(mqtt_connection_t* connection, const char* topic, const char* data, int data_length, int qos, int retain, uint16_t* message_id); -mqtt_message_t* ICACHE_FLASH_ATTR mqtt_msg_puback(mqtt_connection_t* connection, uint16_t message_id); -mqtt_message_t* ICACHE_FLASH_ATTR mqtt_msg_pubrec(mqtt_connection_t* connection, uint16_t message_id); -mqtt_message_t* ICACHE_FLASH_ATTR mqtt_msg_pubrel(mqtt_connection_t* connection, uint16_t message_id); -mqtt_message_t* ICACHE_FLASH_ATTR mqtt_msg_pubcomp(mqtt_connection_t* connection, uint16_t message_id); -mqtt_message_t* ICACHE_FLASH_ATTR mqtt_msg_subscribe(mqtt_connection_t* connection, const char* topic, int qos, uint16_t* message_id); -mqtt_message_t* ICACHE_FLASH_ATTR mqtt_msg_unsubscribe(mqtt_connection_t* connection, const char* topic, uint16_t* message_id); -mqtt_message_t* ICACHE_FLASH_ATTR mqtt_msg_pingreq(mqtt_connection_t* connection); -mqtt_message_t* ICACHE_FLASH_ATTR mqtt_msg_pingresp(mqtt_connection_t* connection); -mqtt_message_t* ICACHE_FLASH_ATTR mqtt_msg_disconnect(mqtt_connection_t* connection); - - -#ifdef __cplusplus -} -#endif - -#endif /* MQTT_MSG_H */ - diff --git a/lib/TasmotaMqtt-1.1.1/src/mqtt/proto.c b/lib/TasmotaMqtt-1.1.1/src/mqtt/proto.c deleted file mode 100644 index 84078b233..000000000 --- a/lib/TasmotaMqtt-1.1.1/src/mqtt/proto.c +++ /dev/null @@ -1,129 +0,0 @@ -#include "proto.h" -#include "ringbuf.h" -I8 ICACHE_FLASH_ATTR PROTO_Init(PROTO_PARSER *parser, PROTO_PARSE_CALLBACK *completeCallback, U8 *buf, U16 bufSize) -{ - parser->buf = buf; - parser->bufSize = bufSize; - parser->dataLen = 0; - parser->callback = completeCallback; - parser->isEsc = 0; - return 0; -} - -I8 ICACHE_FLASH_ATTR PROTO_ParseByte(PROTO_PARSER *parser, U8 value) -{ - switch (value) { - case 0x7D: - parser->isEsc = 1; - break; - - case 0x7E: - parser->dataLen = 0; - parser->isEsc = 0; - parser->isBegin = 1; - break; - - case 0x7F: - if (parser->callback != NULL) - parser->callback(); - parser->isBegin = 0; - return 0; - break; - - default: - if (parser->isBegin == 0) break; - - if (parser->isEsc) { - value ^= 0x20; - parser->isEsc = 0; - } - - if (parser->dataLen < parser->bufSize) - parser->buf[parser->dataLen++] = value; - - break; - } - return -1; -} - -I8 ICACHE_FLASH_ATTR PROTO_Parse(PROTO_PARSER *parser, U8 *buf, U16 len) -{ - while (len--) - PROTO_ParseByte(parser, *buf++); - - return 0; -} -I16 ICACHE_FLASH_ATTR PROTO_ParseRb(RINGBUF* rb, U8 *bufOut, U16* len, U16 maxBufLen) -{ - U8 c; - - PROTO_PARSER proto; - PROTO_Init(&proto, NULL, bufOut, maxBufLen); - while (RINGBUF_Get(rb, &c) == 0) { - if (PROTO_ParseByte(&proto, c) == 0) { - *len = proto.dataLen; - return 0; - } - } - return -1; -} -I16 ICACHE_FLASH_ATTR PROTO_Add(U8 *buf, const U8 *packet, I16 bufSize) -{ - U16 i = 2; - U16 len = *(U16*) packet; - - if (bufSize < 1) return -1; - - *buf++ = 0x7E; - bufSize--; - - while (len--) { - switch (*packet) { - case 0x7D: - case 0x7E: - case 0x7F: - if (bufSize < 2) return -1; - *buf++ = 0x7D; - *buf++ = *packet++ ^ 0x20; - i += 2; - bufSize -= 2; - break; - default: - if (bufSize < 1) return -1; - *buf++ = *packet++; - i++; - bufSize--; - break; - } - } - - if (bufSize < 1) return -1; - *buf++ = 0x7F; - - return i; -} - -I16 ICACHE_FLASH_ATTR PROTO_AddRb(RINGBUF *rb, const U8 *packet, I16 len) -{ - U16 i = 2; - if (RINGBUF_Put(rb, 0x7E) == -1) return -1; - while (len--) { - switch (*packet) { - case 0x7D: - case 0x7E: - case 0x7F: - if (RINGBUF_Put(rb, 0x7D) == -1) return -1; - if (RINGBUF_Put(rb, *packet++ ^ 0x20) == -1) return -1; - i += 2; - break; - default: - if (RINGBUF_Put(rb, *packet++) == -1) return -1; - i++; - break; - } - } - if (RINGBUF_Put(rb, 0x7F) == -1) return -1; - - return i; -} - diff --git a/lib/TasmotaMqtt-1.1.1/src/mqtt/proto.h b/lib/TasmotaMqtt-1.1.1/src/mqtt/proto.h deleted file mode 100644 index a405bcb95..000000000 --- a/lib/TasmotaMqtt-1.1.1/src/mqtt/proto.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * File: proto.h - * Author: ThuHien - * - * Created on November 23, 2012, 8:57 AM - */ - -#ifndef _PROTO_H_ -#define _PROTO_H_ -#include -#include "typedef.h" -#include "ringbuf.h" - -typedef void(PROTO_PARSE_CALLBACK)(); - -typedef struct { - U8 *buf; - U16 bufSize; - U16 dataLen; - U8 isEsc; - U8 isBegin; - PROTO_PARSE_CALLBACK* callback; -} PROTO_PARSER; - -I8 ICACHE_FLASH_ATTR PROTO_Init(PROTO_PARSER *parser, PROTO_PARSE_CALLBACK *completeCallback, U8 *buf, U16 bufSize); -I8 ICACHE_FLASH_ATTR PROTO_Parse(PROTO_PARSER *parser, U8 *buf, U16 len); -I16 ICACHE_FLASH_ATTR PROTO_Add(U8 *buf, const U8 *packet, I16 bufSize); -I16 ICACHE_FLASH_ATTR PROTO_AddRb(RINGBUF *rb, const U8 *packet, I16 len); -I8 ICACHE_FLASH_ATTR PROTO_ParseByte(PROTO_PARSER *parser, U8 value); -I16 ICACHE_FLASH_ATTR PROTO_ParseRb(RINGBUF *rb, U8 *bufOut, U16* len, U16 maxBufLen); -#endif - diff --git a/lib/TasmotaMqtt-1.1.1/src/mqtt/queue.c b/lib/TasmotaMqtt-1.1.1/src/mqtt/queue.c deleted file mode 100644 index 5e4216d0f..000000000 --- a/lib/TasmotaMqtt-1.1.1/src/mqtt/queue.c +++ /dev/null @@ -1,75 +0,0 @@ -/* str_queue.c -* -* Copyright (c) 2014-2015, Tuan PM -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* -* * Redistributions of source code must retain the above copyright notice, -* this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of Redis nor the names of its contributors may be used -* to endorse or promote products derived from this software without -* specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -* POSSIBILITY OF SUCH DAMAGE. -*/ -#include "queue.h" - -#include "user_interface.h" -#include "osapi.h" -#include "os_type.h" -#include "mem.h" -#include "proto.h" - -uint8_t *last_rb_p_r; -uint8_t *last_rb_p_w; -uint32_t last_fill_cnt; - -void ICACHE_FLASH_ATTR QUEUE_Init(QUEUE *queue, int bufferSize) -{ - queue->buf = (uint8_t*)os_zalloc(bufferSize); - RINGBUF_Init(&queue->rb, queue->buf, bufferSize); -} -int32_t ICACHE_FLASH_ATTR QUEUE_Puts(QUEUE *queue, uint8_t* buffer, uint16_t len) -{ - uint32_t ret; - - last_rb_p_r = queue->rb.p_r; - last_rb_p_w = queue->rb.p_w; - last_fill_cnt = queue->rb.fill_cnt; - - ret = PROTO_AddRb(&queue->rb, buffer, len); - if (ret == -1) { - // rolling ring buffer back - queue->rb.p_r = last_rb_p_r; - queue->rb.p_w = last_rb_p_w; - queue->rb.fill_cnt = last_fill_cnt; - } - return ret; -} -int32_t ICACHE_FLASH_ATTR QUEUE_Gets(QUEUE *queue, uint8_t* buffer, uint16_t* len, uint16_t maxLen) -{ - - return PROTO_ParseRb(&queue->rb, buffer, len, maxLen); -} - -bool ICACHE_FLASH_ATTR QUEUE_IsEmpty(QUEUE *queue) -{ - if (queue->rb.fill_cnt <= 0) - return TRUE; - return FALSE; -} diff --git a/lib/TasmotaMqtt-1.1.1/src/mqtt/queue.h b/lib/TasmotaMqtt-1.1.1/src/mqtt/queue.h deleted file mode 100644 index 79107f2d5..000000000 --- a/lib/TasmotaMqtt-1.1.1/src/mqtt/queue.h +++ /dev/null @@ -1,44 +0,0 @@ -/* str_queue.h -- -* -* Copyright (c) 2014-2015, Tuan PM -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* -* * Redistributions of source code must retain the above copyright notice, -* this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* * Neither the name of Redis nor the names of its contributors may be used -* to endorse or promote products derived from this software without -* specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -* POSSIBILITY OF SUCH DAMAGE. -*/ - -#ifndef USER_QUEUE_H_ -#define USER_QUEUE_H_ -#include "os_type.h" -#include "ringbuf.h" -typedef struct { - uint8_t *buf; - RINGBUF rb; -} QUEUE; - -void ICACHE_FLASH_ATTR QUEUE_Init(QUEUE *queue, int bufferSize); -int32_t ICACHE_FLASH_ATTR QUEUE_Puts(QUEUE *queue, uint8_t* buffer, uint16_t len); -int32_t ICACHE_FLASH_ATTR QUEUE_Gets(QUEUE *queue, uint8_t* buffer, uint16_t* len, uint16_t maxLen); -bool ICACHE_FLASH_ATTR QUEUE_IsEmpty(QUEUE *queue); -#endif /* USER_QUEUE_H_ */ diff --git a/lib/TasmotaMqtt-1.1.1/src/mqtt/ringbuf.c b/lib/TasmotaMqtt-1.1.1/src/mqtt/ringbuf.c deleted file mode 100644 index fc882fd5c..000000000 --- a/lib/TasmotaMqtt-1.1.1/src/mqtt/ringbuf.c +++ /dev/null @@ -1,67 +0,0 @@ -/** -* \file -* Ring Buffer library -*/ - -#include "ringbuf.h" - - -/** -* \brief init a RINGBUF object -* \param r pointer to a RINGBUF object -* \param buf pointer to a byte array -* \param size size of buf -* \return 0 if successfull, otherwise failed -*/ -I16 ICACHE_FLASH_ATTR RINGBUF_Init(RINGBUF *r, U8* buf, I32 size) -{ - if (r == NULL || buf == NULL || size < 2) return -1; - - r->p_o = r->p_r = r->p_w = buf; - r->fill_cnt = 0; - r->size = size; - - return 0; -} -/** -* \brief put a character into ring buffer -* \param r pointer to a ringbuf object -* \param c character to be put -* \return 0 if successfull, otherwise failed -*/ -I16 ICACHE_FLASH_ATTR RINGBUF_Put(RINGBUF *r, U8 c) -{ - if (r->fill_cnt >= r->size)return -1; // ring buffer is full, this should be atomic operation - - - r->fill_cnt++; // increase filled slots count, this should be atomic operation - - - *r->p_w++ = c; // put character into buffer - - if (r->p_w >= r->p_o + r->size) // rollback if write pointer go pass - r->p_w = r->p_o; // the physical boundary - - return 0; -} -/** -* \brief get a character from ring buffer -* \param r pointer to a ringbuf object -* \param c read character -* \return 0 if successfull, otherwise failed -*/ -I16 ICACHE_FLASH_ATTR RINGBUF_Get(RINGBUF *r, U8* c) -{ - if (r->fill_cnt <= 0)return -1; // ring buffer is empty, this should be atomic operation - - - r->fill_cnt--; // decrease filled slots count - - - *c = *r->p_r++; // get the character out - - if (r->p_r >= r->p_o + r->size) // rollback if write pointer go pass - r->p_r = r->p_o; // the physical boundary - - return 0; -} diff --git a/lib/TasmotaMqtt-1.1.1/src/mqtt/ringbuf.h b/lib/TasmotaMqtt-1.1.1/src/mqtt/ringbuf.h deleted file mode 100644 index f1a4f7e8b..000000000 --- a/lib/TasmotaMqtt-1.1.1/src/mqtt/ringbuf.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef _RING_BUF_H_ -#define _RING_BUF_H_ - -#include -#include -#include "typedef.h" - -typedef struct { - U8* p_o; /**< Original pointer */ - U8* volatile p_r; /**< Read pointer */ - U8* volatile p_w; /**< Write pointer */ - volatile I32 fill_cnt; /**< Number of filled slots */ - I32 size; /**< Buffer size */ -} RINGBUF; - -I16 ICACHE_FLASH_ATTR RINGBUF_Init(RINGBUF *r, U8* buf, I32 size); -I16 ICACHE_FLASH_ATTR RINGBUF_Put(RINGBUF *r, U8 c); -I16 ICACHE_FLASH_ATTR RINGBUF_Get(RINGBUF *r, U8* c); -#endif diff --git a/lib/TasmotaMqtt-1.1.1/src/mqtt/typedef.h b/lib/TasmotaMqtt-1.1.1/src/mqtt/typedef.h deleted file mode 100644 index 887001ace..000000000 --- a/lib/TasmotaMqtt-1.1.1/src/mqtt/typedef.h +++ /dev/null @@ -1,17 +0,0 @@ -/** -* \file -* Standard Types definition -*/ - -#ifndef _TYPE_DEF_H_ -#define _TYPE_DEF_H_ - -typedef char I8; -typedef unsigned char U8; -typedef short I16; -typedef unsigned short U16; -typedef long I32; -typedef unsigned long U32; -typedef unsigned long long U64; - -#endif diff --git a/lib/TasmotaMqtt-1.1.1/src/mqtt/user_config.h b/lib/TasmotaMqtt-1.1.1/src/mqtt/user_config.h deleted file mode 100644 index 125353ed0..000000000 --- a/lib/TasmotaMqtt-1.1.1/src/mqtt/user_config.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef __MQTT_CONFIG_H__ -#define __MQTT_CONFIG_H__ - -//#define MQTT_SSL_ENABLE - -#define MQTT_RECONNECT_TIMEOUT 5 /*second*/ - -//#define MQTT_BUF_SIZE 1024 -#define MQTT_BUF_SIZE 512 -#define QUEUE_BUFFER_SIZE 2048 - -//#define PROTOCOL_NAMEv31 /*MQTT version 3.1 compatible with Mosquitto v0.15*/ -#define PROTOCOL_NAMEv311 /*MQTT version 3.11 compatible with https://eclipse.org/paho/clients/testing/*/ - -#endif // __MQTT_CONFIG_H__ \ No newline at end of file diff --git a/lib/TasmotaMqtt-1.1.1/src/mqtt/utils.c b/lib/TasmotaMqtt-1.1.1/src/mqtt/utils.c deleted file mode 100644 index ac4c9272b..000000000 --- a/lib/TasmotaMqtt-1.1.1/src/mqtt/utils.c +++ /dev/null @@ -1,149 +0,0 @@ -/* -* Copyright (c) 2014, Tuan PM -* Email: tuanpm@live.com -* -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* 1. Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* 2. Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* 3. Neither the name of the copyright holder nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -* POSSIBILITY OF SUCH DAMAGE. -* -*/ -#include -#include -#include -#include -#include -#include "utils.h" - - -uint8_t ICACHE_FLASH_ATTR UTILS_IsIPV4 (int8_t *str) -{ - uint8_t segs = 0; /* Segment count. */ - uint8_t chcnt = 0; /* Character count within segment. */ - uint8_t accum = 0; /* Accumulator for segment. */ - /* Catch NULL pointer. */ - if (str == 0) - return 0; - /* Process every character in string. */ - - while (*str != '\0') { - /* Segment changeover. */ - - if (*str == '.') { - /* Must have some digits in segment. */ - if (chcnt == 0) - return 0; - /* Limit number of segments. */ - if (++segs == 4) - return 0; - /* Reset segment values and restart loop. */ - chcnt = accum = 0; - str++; - continue; - } - - /* Check numeric. */ - if ((*str < '0') || (*str > '9')) - return 0; - - /* Accumulate and check segment. */ - - if ((accum = accum * 10 + *str - '0') > 255) - return 0; - /* Advance other segment specific stuff and continue loop. */ - - chcnt++; - str++; - } - - /* Check enough segments and enough characters in last segment. */ - - if (segs != 3) - return 0; - if (chcnt == 0) - return 0; - /* Address okay. */ - - return 1; -} -uint8_t ICACHE_FLASH_ATTR UTILS_StrToIP(const int8_t* str, void *ip) -{ - - /* The count of the number of bytes processed. */ - int i; - /* A pointer to the next digit to process. */ - const char * start; - - start = str; - for (i = 0; i < 4; i++) { - /* The digit being processed. */ - char c; - /* The value of this byte. */ - int n = 0; - while (1) { - c = * start; - start++; - if (c >= '0' && c <= '9') { - n *= 10; - n += c - '0'; - } - /* We insist on stopping at "." if we are still parsing - the first, second, or third numbers. If we have reached - the end of the numbers, we will allow any character. */ - else if ((i < 3 && c == '.') || i == 3) { - break; - } - else { - return 0; - } - } - if (n >= 256) { - return 0; - } - ((uint8_t*)ip)[i] = n; - } - return 1; - -} -uint32_t ICACHE_FLASH_ATTR UTILS_Atoh(const int8_t *s) -{ - uint32_t value = 0, digit; - int8_t c; - - while ((c = *s++)) { - if ('0' <= c && c <= '9') - digit = c - '0'; - else if ('A' <= c && c <= 'F') - digit = c - 'A' + 10; - else if ('a' <= c && c <= 'f') - digit = c - 'a' + 10; - else break; - - value = (value << 4) | digit; - } - - return value; -} - diff --git a/lib/TasmotaMqtt-1.1.1/src/mqtt/utils.h b/lib/TasmotaMqtt-1.1.1/src/mqtt/utils.h deleted file mode 100644 index fe2874803..000000000 --- a/lib/TasmotaMqtt-1.1.1/src/mqtt/utils.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef _UTILS_H_ -#define _UTILS_H_ - -#include "c_types.h" - -uint32_t ICACHE_FLASH_ATTR UTILS_Atoh(const int8_t *s); -uint8_t ICACHE_FLASH_ATTR UTILS_StrToIP(const int8_t* str, void *ip); -uint8_t ICACHE_FLASH_ATTR UTILS_IsIPV4 (int8_t *str); -#endif diff --git a/lib/arduino-mqtt-2.4.0/.editorconfig b/lib/arduino-mqtt-2.4.0/.editorconfig deleted file mode 100644 index 3edae7b53..000000000 --- a/lib/arduino-mqtt-2.4.0/.editorconfig +++ /dev/null @@ -1,7 +0,0 @@ -[Makefile] -indent_style = tab -indent_size = 4 - -[src/*.h,src/*.cpp,examples/**.ino] -indent_style = space -indent_size = 2 diff --git a/lib/arduino-mqtt-2.4.0/.gitignore b/lib/arduino-mqtt-2.4.0/.gitignore deleted file mode 100644 index 0c4fe4711..000000000 --- a/lib/arduino-mqtt-2.4.0/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -.DS_Store -cmake-build-debug/ diff --git a/lib/arduino-mqtt-2.4.0/.travis.yml b/lib/arduino-mqtt-2.4.0/.travis.yml deleted file mode 100644 index 6971b9fba..000000000 --- a/lib/arduino-mqtt-2.4.0/.travis.yml +++ /dev/null @@ -1,46 +0,0 @@ -language: generic -env: - global: - - IDE_VERSION=1.8.7 - matrix: - - EXAMPLE="AdafruitHuzzahESP8266" BOARD="esp8266:esp8266:huzzah:FlashSize=4M3M,CpuFrequency=80" - - EXAMPLE="AdafruitHuzzahESP8266Secure" BOARD="esp8266:esp8266:huzzah:FlashSize=4M3M,CpuFrequency=80" - - EXAMPLE="ArduinoEthernetShield" BOARD="arduino:avr:uno" - - EXAMPLE="ArduinoMKRGSM1400" BOARD="arduino:samd:mkrgsm1400" - - EXAMPLE="ArduinoMKRGSM1400Secure" BOARD="arduino:samd:mkrgsm1400" - - EXAMPLE="ArduinoWiFi101Secure" BOARD="arduino:avr:uno" - - EXAMPLE="ArduinoWiFiShield" BOARD="arduino:avr:uno" - - EXAMPLE="ArduinoYun" BOARD="arduino:avr:yun" - - EXAMPLE="ArduinoYunSecure" BOARD="arduino:avr:yun" - - EXAMPLE="ESP32DevelopmentBoard" BOARD="espressif:esp32:esp32:FlashFreq=80" - - EXAMPLE="ESP32DevelopmentBoardSecure" BOARD="espressif:esp32:esp32:FlashFreq=80" -before_install: - - /sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_1.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :1 -ac -screen 0 1280x1024x16 - - sleep 3 - - export DISPLAY=:1.0 - - wget http://downloads.arduino.cc/arduino-$IDE_VERSION-linux64.tar.xz - - tar xf arduino-$IDE_VERSION-linux64.tar.xz - - mv arduino-$IDE_VERSION ~/arduino-ide - - export PATH=$PATH:~/arduino-ide - - if [[ "$BOARD" =~ "esp8266:esp8266:" ]]; then - arduino --pref "boardsmanager.additional.urls=http://arduino.esp8266.com/stable/package_esp8266com_index.json" --install-boards esp8266:esp8266; - arduino --pref "boardsmanager.additional.urls=" --save-prefs; - fi - - if [[ "$BOARD" =~ "espressif:esp32:" ]]; then - mkdir -p ~/Arduino/hardware/espressif && - cd ~/Arduino/hardware/espressif && - git clone https://github.com/espressif/arduino-esp32.git esp32 && - cd esp32/tools/ && - python get.py && - cd $TRAVIS_BUILD_DIR; - fi - - if [[ "$BOARD" =~ "arduino:samd:mkrgsm1400" ]]; then - arduino --install-boards arduino:samd; - arduino --install-library MKRGSM; - fi - - arduino --install-library WiFi101 -install: - - mkdir -p ~/Arduino/libraries - - ln -s $PWD ~/Arduino/libraries/. -script: - - arduino --verbose-build --verify --board $BOARD $PWD/examples/$EXAMPLE/$EXAMPLE.ino; diff --git a/lib/arduino-mqtt-2.4.0/CMakeLists.txt b/lib/arduino-mqtt-2.4.0/CMakeLists.txt deleted file mode 100644 index 328ce0c87..000000000 --- a/lib/arduino-mqtt-2.4.0/CMakeLists.txt +++ /dev/null @@ -1,38 +0,0 @@ -# Uncompilable CMake File to enable project editing with CLion IDE - -cmake_minimum_required(VERSION 2.8.4) -project(arduino-mqtt) - -include_directories( - /Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino/ - /Users/256dpi/Development/Arduino/libraries/Ethernet/src - /Users/256dpi/Development/Arduino/libraries/WiFi101/src - /Users/256dpi/Development/Arduino/libraries/MKRGSM/src - /Applications/Arduino.app/Contents/Java/libraries/Bridge/src - /Users/256dpi/Library/Arduino15/packages/esp8266/hardware/esp8266/2.3.0/libraries/ESP8266WiFi/src - /Users/256dpi/Library/Arduino15/packages/esp32/libraries/WiFi/src - /Users/256dpi/Library/Arduino15/packages/esp32/libraries/WiFiClientSecure/src - src/) - -include_directories(src/) - -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") - -set(SOURCE_FILES - examples/AdafruitHuzzahESP8266/AdafruitHuzzahESP8266.ino - examples/AdafruitHuzzahESP8266Secure/AdafruitHuzzahESP8266Secure.ino - examples/ArduinoEthernetShield/ArduinoEthernetShield.ino - examples/ArduinoMKRGSM1400/ArduinoMKRGSM1400.ino - examples/ArduinoMKRGSM1400Secure/ArduinoMKRGSM1400Secure.ino - examples/ArduinoWiFi101/ArduinoWiFi101.ino - examples/ArduinoWiFi101Secure/ArduinoWiFi101Secure.ino - examples/ArduinoWiFiShield/ArduinoWiFiShield.ino - examples/ArduinoYun/ArduinoYun.ino - examples/ArduinoYunSecure/ArduinoYunSecure.ino - examples/ESP32DevelopmentBoard/ESP32DevelopmentBoard.ino - examples/ESP32DevelopmentBoardSecure/ESP32DevelopmentBoardSecure.ino - src/lwmqtt - src/MQTT.h - src/MQTTClient.h) - -add_executable(arduino-mqtt ${SOURCE_FILES}) diff --git a/lib/arduino-mqtt-2.4.0/Makefile b/lib/arduino-mqtt-2.4.0/Makefile deleted file mode 100644 index 9e734fcc3..000000000 --- a/lib/arduino-mqtt-2.4.0/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -all: fmt - -fmt: - clang-format -i src/*.h -style="{BasedOnStyle: Google, ColumnLimit: 120}" - -update: - rm -rf ./lwmqtt - git clone --branch v0.6.2 https://github.com/256dpi/lwmqtt.git ./lwmqtt - mkdir -p ./src/lwmqtt - cp -r ./lwmqtt/src/*.c ./src/lwmqtt/ - cp -r ./lwmqtt/src/*.h ./src/lwmqtt/ - cp -r ./lwmqtt/include/*.h ./src/lwmqtt/ - rm -rf ./lwmqtt - sed -i '' "s//\"lwmqtt.h\"/g" ./src/lwmqtt/* diff --git a/lib/arduino-mqtt-2.4.0/README.md b/lib/arduino-mqtt-2.4.0/README.md deleted file mode 100644 index 92e61ed6e..000000000 --- a/lib/arduino-mqtt-2.4.0/README.md +++ /dev/null @@ -1,226 +0,0 @@ -# arduino-mqtt - -[![Build Status](https://travis-ci.org/256dpi/arduino-mqtt.svg?branch=master)](https://travis-ci.org/256dpi/arduino-mqtt) -[![GitHub release](https://img.shields.io/github/release/256dpi/arduino-mqtt.svg)](https://github.com/256dpi/arduino-mqtt/releases) - -This library bundles the [lwmqtt](https://github.com/256dpi/lwmqtt) MQTT 3.1.1 client and adds a thin wrapper to get an Arduino like API. - -Download the latest version from the [release](https://github.com/256dpi/arduino-mqtt/releases) section. Or even better use the builtin Library Manager in the Arduino IDE and search for "MQTT". - -The library is also available on [PlatformIO](https://platformio.org/lib/show/617/MQTT). You can install it by running: `pio lib install "MQTT"`. - -## Compatibility - -The following examples show how you can use the library with various Arduino compatible hardware: - -- [Arduino Yun & Yun-Shield](https://github.com/256dpi/arduino-mqtt/blob/master/examples/ArduinoYun/ArduinoYun.ino) ([Secure](https://github.com/256dpi/arduino-mqtt/blob/master/examples/ArduinoYunSecure/ArduinoYunSecure.ino)) -- [Arduino Ethernet Shield](https://github.com/256dpi/arduino-mqtt/blob/master/examples/ArduinoEthernetShield/ArduinoEthernetShield.ino) -- [Arduino WiFi Shield](https://github.com/256dpi/arduino-mqtt/blob/master/examples/ArduinoWiFiShield/ArduinoWiFiShield.ino) -- [Adafruit HUZZAH ESP8266](https://github.com/256dpi/arduino-mqtt/blob/master/examples/AdafruitHuzzahESP8266/AdafruitHuzzahESP8266.ino) ([Secure](https://github.com/256dpi/arduino-mqtt/blob/master/examples/AdafruitHuzzahESP8266Secure/AdafruitHuzzahESP8266Secure.ino)) -- [Arduino/Genuino WiFi101 Shield](https://github.com/256dpi/arduino-mqtt/blob/master/examples/ArduinoWiFi101/ArduinoWiFi101.ino) ([Secure](https://github.com/256dpi/arduino-mqtt/blob/master/examples/ArduinoWiFi101Secure/ArduinoWiFi101Secure.ino)) -- [Arduino MKR GSM 1400](https://github.com/256dpi/arduino-mqtt/blob/master/examples/ArduinoMKRGSM1400/ArduinoMKRGSM1400.ino) ([Secure](https://github.com/256dpi/arduino-mqtt/blob/master/examples/ArduinoMKRGSM1400Secure/ArduinoMKRGSM1400Secure.ino)) -- [ESP32 Development Board](https://github.com/256dpi/arduino-mqtt/blob/master/examples/ESP32DevelopmentBoard/ESP32DevelopmentBoard.ino) ([Secure](https://github.com/256dpi/arduino-mqtt/blob/master/examples/ESP32DevelopmentBoardSecure/ESP32DevelopmentBoardSecure.ino)) - -Other shields and boards should also work if they provide a [Client](https://www.arduino.cc/en/Reference/ClientConstructor) based network implementation. - -## Notes - -- The maximum size for packets being published and received is set by default to 128 bytes. To change the buffer sizes, you need to use `MQTTClient client(256)` instead of just `MQTTClient client` on the top of your sketch. The passed value denotes the read and write buffer size. - -- On the ESP8266 it has been reported that an additional `delay(10);` after `client.loop();` fixes many stability issues with WiFi connections. - -- To use the library with shiftr.io, you need to provide the token key (username) and token secret (password) as the second and third argument to `client.connect(name, key, secret)`. - -## Example - -The following example uses an Arduino MKR1000 to connect to shiftr.io. You can check on your device after a successful connection here: https://shiftr.io/try. - -```c++ -#include -#include -#include - -const char ssid[] = "ssid"; -const char pass[] = "pass"; - -WiFiClient net; -MQTTClient client; - -unsigned long lastMillis = 0; - -void connect() { - Serial.print("checking wifi..."); - while (WiFi.status() != WL_CONNECTED) { - Serial.print("."); - delay(1000); - } - - Serial.print("\nconnecting..."); - while (!client.connect("arduino", "try", "try")) { - Serial.print("."); - delay(1000); - } - - Serial.println("\nconnected!"); - - client.subscribe("/hello"); - // client.unsubscribe("/hello"); -} - -void messageReceived(String &topic, String &payload) { - Serial.println("incoming: " + topic + " - " + payload); -} - -void setup() { - Serial.begin(115200); - WiFi.begin(ssid, pass); - - // Note: Local domain names (e.g. "Computer.local" on OSX) are not supported by Arduino. - // You need to set the IP address directly. - client.begin("broker.shiftr.io", net); - client.onMessage(messageReceived); - - connect(); -} - -void loop() { - client.loop(); - - if (!client.connected()) { - connect(); - } - - // publish a message roughly every second. - if (millis() - lastMillis > 1000) { - lastMillis = millis(); - client.publish("/hello", "world"); - } -} -``` - -## API - -Initialize the object using the hostname of the broker, the brokers port (default: `1883`) and the underlying Client class for network transport: - -```c++ -void begin(const char hostname[], Client &client); -void begin(const char hostname[], int port, Client &client); -``` - -- Specify port `8883` when using secure clients for encrypted connections. -- Local domain names (e.g. `Computer.local` on OSX) are not supported by Arduino. You need to set the IP address directly. - -The hostname and port can also be changed after calling `begin()`: - -```c++ -void setHost(const char hostname[]); -void setHost(const char hostname[], int port); -``` - -Set a will message (last testament) that gets registered on the broker after connecting. `setWill()` has to be called before calling `connect()`: - -```c++ -void setWill(const char topic[]); -void setWill(const char topic[], const char payload[]); -void setWill(const char topic[], const char payload[], bool retained, int qos); -void clearWill(); -``` - -Register a callback to receive messages: - -```c++ -void onMessage(MQTTClientCallbackSimple); -// Callback signature: void messageReceived(String &topic, String &payload) {} - -void onMessageAdvanced(MQTTClientCallbackAdvanced); -// Callback signature: void messageReceived(MQTTClient *client, char topic[], char payload[], int payload_length) {} -``` - -- The set callback is mostly called during a call to `loop()` but may also be called during a call to `subscribe()`, `unsubscribe()` or `publish() // QoS > 0` if messages have been received before receiving the required acknowledgement. Therefore, it is strongly recommended to not call `subscribe()`, `unsubscribe()` or `publish() // QoS > 0` directly in the callback. - -Set more advanced options: - -```c++ -void setOptions(int keepAlive, bool cleanSession, int timeout); -``` - -- The `keepAlive` option controls the keep alive interval in seconds (default: 10). -- The `cleanSession` option controls the session retention on the broker side (default: true). -- The `timeout` option controls the default timeout for all commands in milliseconds (default: 1000). - -Connect to broker using the supplied client id and an optional username and password: - -```c++ -bool connect(const char clientId[], bool skip = false); -bool connect(const char clientId[], const char username[], bool skip = false); -bool connect(const char clientId[], const char username[], const char password[], bool skip = false); -``` - -- If the `skip` option is set to true, the client will skip the network level connection and jump to the MQTT level connection. This option can be used in order to establish and verify TLS connections manually before giving control to the MQTT client. -- This functions returns a boolean that indicates if the connection has been established successfully. - -Publishes a message to the broker with an optional payload: - -```c++ -bool publish(const String &topic); -bool publish(const char topic[]); -bool publish(const String &topic, const String &payload); -bool publish(const String &topic, const String &payload, bool retained, int qos); -bool publish(const char topic[], const String &payload); -bool publish(const char topic[], const String &payload, bool retained, int qos); -bool publish(const char topic[], const char payload[]); -bool publish(const char topic[], const char payload[], bool retained, int qos); -bool publish(const char topic[], const char payload[], int length); -bool publish(const char topic[], const char payload[], int length, bool retained, int qos); -``` - -Subscribe to a topic: - -```c++ -bool subscribe(const String &topic); -bool subscribe(const String &topic, int qos); -bool subscribe(const char topic[]); -bool subscribe(const char topic[], int qos); -``` - -Unsubscribe from a topic: - -```c++ -bool unsubscribe(const String &topic); -bool unsubscribe(const char topic[]); -``` - -Sends and receives packets: - -```c++ -bool loop(); -``` - -- This function should be called in every `loop`. - -Check if the client is currently connected: - -```c++ -bool connected(); -``` - -Access low-level information for debugging: - -```c++ -lwmqtt_err_t lastError(); -lwmqtt_return_code_t returnCode(); -``` - -- The error codes can be found [here](https://github.com/256dpi/lwmqtt/blob/master/include/lwmqtt.h#L11). -- The return codes can be found [here](https://github.com/256dpi/lwmqtt/blob/master/include/lwmqtt.h#L243). - -Disconnect from the broker: - -```c++ -bool disconnect(); -``` - -## Release Management - -- Update version in `library.properties`. -- Create release on GitHub. diff --git a/lib/arduino-mqtt-2.4.0/examples/AdafruitHuzzahESP8266/AdafruitHuzzahESP8266.ino b/lib/arduino-mqtt-2.4.0/examples/AdafruitHuzzahESP8266/AdafruitHuzzahESP8266.ino deleted file mode 100644 index ca5a22607..000000000 --- a/lib/arduino-mqtt-2.4.0/examples/AdafruitHuzzahESP8266/AdafruitHuzzahESP8266.ino +++ /dev/null @@ -1,69 +0,0 @@ -// This example uses an Adafruit Huzzah ESP8266 -// to connect to shiftr.io. -// -// You can check on your device after a successful -// connection here: https://shiftr.io/try. -// -// by Joël Gähwiler -// https://github.com/256dpi/arduino-mqtt - -#include -#include - -const char ssid[] = "ssid"; -const char pass[] = "pass"; - -WiFiClient net; -MQTTClient client; - -unsigned long lastMillis = 0; - -void connect() { - Serial.print("checking wifi..."); - while (WiFi.status() != WL_CONNECTED) { - Serial.print("."); - delay(1000); - } - - Serial.print("\nconnecting..."); - while (!client.connect("arduino", "try", "try")) { - Serial.print("."); - delay(1000); - } - - Serial.println("\nconnected!"); - - client.subscribe("/hello"); - // client.unsubscribe("/hello"); -} - -void messageReceived(String &topic, String &payload) { - Serial.println("incoming: " + topic + " - " + payload); -} - -void setup() { - Serial.begin(115200); - WiFi.begin(ssid, pass); - - // Note: Local domain names (e.g. "Computer.local" on OSX) are not supported by Arduino. - // You need to set the IP address directly. - client.begin("broker.shiftr.io", net); - client.onMessage(messageReceived); - - connect(); -} - -void loop() { - client.loop(); - delay(10); // <- fixes some issues with WiFi stability - - if (!client.connected()) { - connect(); - } - - // publish a message roughly every second. - if (millis() - lastMillis > 1000) { - lastMillis = millis(); - client.publish("/hello", "world"); - } -} diff --git a/lib/arduino-mqtt-2.4.0/examples/AdafruitHuzzahESP8266Secure/AdafruitHuzzahESP8266Secure.ino b/lib/arduino-mqtt-2.4.0/examples/AdafruitHuzzahESP8266Secure/AdafruitHuzzahESP8266Secure.ino deleted file mode 100644 index 1def5678d..000000000 --- a/lib/arduino-mqtt-2.4.0/examples/AdafruitHuzzahESP8266Secure/AdafruitHuzzahESP8266Secure.ino +++ /dev/null @@ -1,71 +0,0 @@ -// This example uses an Adafruit Huzzah ESP8266 -// to connect to shiftr.io. -// -// You can check on your device after a successful -// connection here: https://shiftr.io/try. -// -// by Joël Gähwiler -// https://github.com/256dpi/arduino-mqtt - -#include -#include - -const char ssid[] = "ssid"; -const char pass[] = "pass"; - -WiFiClientSecure net; -MQTTClient client; - -unsigned long lastMillis = 0; - -void connect() { - Serial.print("checking wifi..."); - while (WiFi.status() != WL_CONNECTED) { - Serial.print("."); - delay(1000); - } - - Serial.print("\nconnecting..."); - while (!client.connect("arduino", "try", "try")) { - Serial.print("."); - delay(1000); - } - - Serial.println("\nconnected!"); - - client.subscribe("/hello"); - // client.unsubscribe("/hello"); -} - -void messageReceived(String &topic, String &payload) { - Serial.println("incoming: " + topic + " - " + payload); -} - -void setup() { - Serial.begin(115200); - WiFi.begin(ssid, pass); - - // Note: Local domain names (e.g. "Computer.local" on OSX) are not supported by Arduino. - // You need to set the IP address directly. - // - // MQTT brokers usually use port 8883 for secure connections. - client.begin("broker.shiftr.io", 8883, net); - client.onMessage(messageReceived); - - connect(); -} - -void loop() { - client.loop(); - delay(10); // <- fixes some issues with WiFi stability - - if (!client.connected()) { - connect(); - } - - // publish a message roughly every second. - if (millis() - lastMillis > 1000) { - lastMillis = millis(); - client.publish("/hello", "world"); - } -} diff --git a/lib/arduino-mqtt-2.4.0/examples/ArduinoEthernetShield/ArduinoEthernetShield.ino b/lib/arduino-mqtt-2.4.0/examples/ArduinoEthernetShield/ArduinoEthernetShield.ino deleted file mode 100644 index 8386c7788..000000000 --- a/lib/arduino-mqtt-2.4.0/examples/ArduinoEthernetShield/ArduinoEthernetShield.ino +++ /dev/null @@ -1,62 +0,0 @@ -// This example uses an Arduino Uno together with -// an Ethernet Shield to connect to shiftr.io. -// -// You can check on your device after a successful -// connection here: https://shiftr.io/try. -// -// by Joël Gähwiler -// https://github.com/256dpi/arduino-mqtt - -#include -#include - -byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED}; -byte ip[] = {192, 168, 1, 177}; // <- change to match your network - -EthernetClient net; -MQTTClient client; - -unsigned long lastMillis = 0; - -void connect() { - Serial.print("connecting..."); - while (!client.connect("arduino", "try", "try")) { - Serial.print("."); - delay(1000); - } - - Serial.println("\nconnected!"); - - client.subscribe("/hello"); - // client.unsubscribe("/hello"); -} - -void messageReceived(String &topic, String &payload) { - Serial.println("incoming: " + topic + " - " + payload); -} - -void setup() { - Serial.begin(115200); - Ethernet.begin(mac, ip); - - // Note: Local domain names (e.g. "Computer.local" on OSX) are not supported by Arduino. - // You need to set the IP address directly. - client.begin("broker.shiftr.io", net); - client.onMessage(messageReceived); - - connect(); -} - -void loop() { - client.loop(); - - if (!client.connected()) { - connect(); - } - - // publish a message roughly every second. - if (millis() - lastMillis > 1000) { - lastMillis = millis(); - client.publish("/hello", "world"); - } -} diff --git a/lib/arduino-mqtt-2.4.0/examples/ArduinoMKRGSM1400/ArduinoMKRGSM1400.ino b/lib/arduino-mqtt-2.4.0/examples/ArduinoMKRGSM1400/ArduinoMKRGSM1400.ino deleted file mode 100644 index dd56d5e21..000000000 --- a/lib/arduino-mqtt-2.4.0/examples/ArduinoMKRGSM1400/ArduinoMKRGSM1400.ino +++ /dev/null @@ -1,84 +0,0 @@ -// This example uses an Arduino MKR GSM 1400 board -// to connect to shiftr.io. -// -// IMPORTANT: This example uses the new MKRGSM library. -// -// You can check on your device after a successful -// connection here: https://shiftr.io/try. -// -// by Sandeep Mistry -// https://github.com/256dpi/arduino-mqtt - -#include -#include - -const char pin[] = ""; -const char apn[] = "apn"; -const char login[] = "login"; -const char password[] = "password"; - -GSMClient net; -GPRS gprs; -GSM gsmAccess; -MQTTClient client; - -unsigned long lastMillis = 0; - -void connect() { - // connection state - bool connected = false; - - Serial.print("connecting to cellular network ..."); - - // After starting the modem with gsmAccess.begin() - // attach to the GPRS network with the APN, login and password - while (!connected) { - if ((gsmAccess.begin(pin) == GSM_READY) && - (gprs.attachGPRS(apn, login, password) == GPRS_READY)) { - connected = true; - } else { - Serial.print("."); - delay(1000); - } - } - - Serial.print("\nconnecting..."); - while (!client.connect("arduino", "try", "try")) { - Serial.print("."); - delay(1000); - } - - Serial.println("\nconnected!"); - - client.subscribe("/hello"); - // client.unsubscribe("/hello"); -} - -void messageReceived(String &topic, String &payload) { - Serial.println("incoming: " + topic + " - " + payload); -} - -void setup() { - Serial.begin(115200); - - // Note: Local domain names (e.g. "Computer.local" on OSX) are not supported by Arduino. - // You need to set the IP address directly. - client.begin("broker.shiftr.io", net); - client.onMessage(messageReceived); - - connect(); -} - -void loop() { - client.loop(); - - if (!client.connected()) { - connect(); - } - - // publish a message roughly every second. - if (millis() - lastMillis > 1000) { - lastMillis = millis(); - client.publish("/hello", "world"); - } -} diff --git a/lib/arduino-mqtt-2.4.0/examples/ArduinoMKRGSM1400Secure/ArduinoMKRGSM1400Secure.ino b/lib/arduino-mqtt-2.4.0/examples/ArduinoMKRGSM1400Secure/ArduinoMKRGSM1400Secure.ino deleted file mode 100644 index 1b172ab6e..000000000 --- a/lib/arduino-mqtt-2.4.0/examples/ArduinoMKRGSM1400Secure/ArduinoMKRGSM1400Secure.ino +++ /dev/null @@ -1,86 +0,0 @@ -// This example uses an Arduino MKR GSM 1400 board -// to securely connect to shiftr.io. -// -// IMPORTANT: This example uses the new MKRGSM library. -// -// You can check on your device after a successful -// connection here: https://shiftr.io/try. -// -// by Sandeep Mistry -// https://github.com/256dpi/arduino-mqtt - -#include -#include - -const char pin[] = ""; -const char apn[] = "apn"; -const char login[] = "login"; -const char password[] = "password"; - -GSMSSLClient net; -GPRS gprs; -GSM gsmAccess; -MQTTClient client; - -unsigned long lastMillis = 0; - -void connect() { - // connection state - bool connected = false; - - Serial.print("connecting to cellular network ..."); - - // After starting the modem with gsmAccess.begin() - // attach to the GPRS network with the APN, login and password - while (!connected) { - if ((gsmAccess.begin(pin) == GSM_READY) && - (gprs.attachGPRS(apn, login, password) == GPRS_READY)) { - connected = true; - } else { - Serial.print("."); - delay(1000); - } - } - - Serial.print("\nconnecting..."); - while (!client.connect("arduino", "try", "try")) { - Serial.print("."); - delay(1000); - } - - Serial.println("\nconnected!"); - - client.subscribe("/hello"); - // client.unsubscribe("/hello"); -} - -void messageReceived(String &topic, String &payload) { - Serial.println("incoming: " + topic + " - " + payload); -} - -void setup() { - Serial.begin(115200); - - // Note: Local domain names (e.g. "Computer.local" on OSX) are not supported by Arduino. - // You need to set the IP address directly. - // - // MQTT brokers usually use port 8883 for secure connections. - client.begin("broker.shiftr.io", 8883, net); - client.onMessage(messageReceived); - - connect(); -} - -void loop() { - client.loop(); - - if (!client.connected()) { - connect(); - } - - // publish a message roughly every second. - if (millis() - lastMillis > 1000) { - lastMillis = millis(); - client.publish("/hello", "world"); - } -} diff --git a/lib/arduino-mqtt-2.4.0/examples/ArduinoWiFi101/ArduinoWiFi101.ino b/lib/arduino-mqtt-2.4.0/examples/ArduinoWiFi101/ArduinoWiFi101.ino deleted file mode 100644 index a36bd65aa..000000000 --- a/lib/arduino-mqtt-2.4.0/examples/ArduinoWiFi101/ArduinoWiFi101.ino +++ /dev/null @@ -1,70 +0,0 @@ -// This example uses an Arduino/Genuino Zero together with -// a WiFi101 Shield or a MKR1000 to connect to shiftr.io. -// -// IMPORTANT: This example uses the new WiFi101 library. -// -// You can check on your device after a successful -// connection here: https://shiftr.io/try. -// -// by Gilberto Conti -// https://github.com/256dpi/arduino-mqtt - -#include -#include - -const char ssid[] = "ssid"; -const char pass[] = "pass"; - -WiFiClient net; -MQTTClient client; - -unsigned long lastMillis = 0; - -void connect() { - Serial.print("checking wifi..."); - while (WiFi.status() != WL_CONNECTED) { - Serial.print("."); - delay(1000); - } - - Serial.print("\nconnecting..."); - while (!client.connect("arduino", "try", "try")) { - Serial.print("."); - delay(1000); - } - - Serial.println("\nconnected!"); - - client.subscribe("/hello"); - // client.unsubscribe("/hello"); -} - -void messageReceived(String &topic, String &payload) { - Serial.println("incoming: " + topic + " - " + payload); -} - -void setup() { - Serial.begin(115200); - WiFi.begin(ssid, pass); - - // Note: Local domain names (e.g. "Computer.local" on OSX) are not supported by Arduino. - // You need to set the IP address directly. - client.begin("broker.shiftr.io", net); - client.onMessage(messageReceived); - - connect(); -} - -void loop() { - client.loop(); - - if (!client.connected()) { - connect(); - } - - // publish a message roughly every second. - if (millis() - lastMillis > 1000) { - lastMillis = millis(); - client.publish("/hello", "world"); - } -} diff --git a/lib/arduino-mqtt-2.4.0/examples/ArduinoWiFi101Secure/ArduinoWiFi101Secure.ino b/lib/arduino-mqtt-2.4.0/examples/ArduinoWiFi101Secure/ArduinoWiFi101Secure.ino deleted file mode 100644 index c21e7ae99..000000000 --- a/lib/arduino-mqtt-2.4.0/examples/ArduinoWiFi101Secure/ArduinoWiFi101Secure.ino +++ /dev/null @@ -1,75 +0,0 @@ -// This example uses an Arduino/Genuino Zero together with -// a WiFi101 Shield or a MKR1000 to connect to shiftr.io. -// -// IMPORTANT: This example uses the new WiFi101 library. -// -// IMPORTANT: You need to install/update the SSL certificates first: -// https://github.com/arduino-libraries/WiFi101-FirmwareUpdater#to-update-ssl-certificates -// -// You can check on your device after a successful -// connection here: https://shiftr.io/try. -// -// by Gilberto Conti -// https://github.com/256dpi/arduino-mqtt - -#include -#include - -const char ssid[] = "ssid"; -const char pass[] = "pass"; - -WiFiSSLClient net; -MQTTClient client; - -unsigned long lastMillis = 0; - -void connect() { - Serial.print("checking wifi..."); - while (WiFi.status() != WL_CONNECTED) { - Serial.print("."); - delay(1000); - } - - Serial.print("\nconnecting..."); - while (!client.connect("arduino", "try", "try")) { - Serial.print("."); - delay(1000); - } - - Serial.println("\nconnected!"); - - client.subscribe("/hello"); - // client.unsubscribe("/hello"); -} - -void messageReceived(String &topic, String &payload) { - Serial.println("incoming: " + topic + " - " + payload); -} - -void setup() { - Serial.begin(115200); - WiFi.begin(ssid, pass); - - // Note: Local domain names (e.g. "Computer.local" on OSX) are not supported by Arduino. - // You need to set the IP address directly. - // - // MQTT brokers usually use port 8883 for secure connections. - client.begin("broker.shiftr.io", 8883, net); - client.onMessage(messageReceived); - - connect(); -} - -void loop() { - client.loop(); - - if (!client.connected()) { - connect(); - } - - // publish a message roughly every second. - if (millis() - lastMillis > 1000) { - lastMillis = millis(); - client.publish("/hello", "world"); - } -} diff --git a/lib/arduino-mqtt-2.4.0/examples/ArduinoWiFiShield/ArduinoWiFiShield.ino b/lib/arduino-mqtt-2.4.0/examples/ArduinoWiFiShield/ArduinoWiFiShield.ino deleted file mode 100644 index 4aff769f4..000000000 --- a/lib/arduino-mqtt-2.4.0/examples/ArduinoWiFiShield/ArduinoWiFiShield.ino +++ /dev/null @@ -1,68 +0,0 @@ -// This example uses an Arduino Uno together with -// a WiFi Shield to connect to shiftr.io. -// -// You can check on your device after a successful -// connection here: https://shiftr.io/try. -// -// by Joël Gähwiler -// https://github.com/256dpi/arduino-mqtt - -#include -#include - -const char ssid[] = "ssid"; -const char pass[] = "pass"; - -WiFiClient net; -MQTTClient client; - -unsigned long lastMillis = 0; - -void connect() { - Serial.print("checking wifi..."); - while (WiFi.status() != WL_CONNECTED) { - Serial.print("."); - delay(1000); - } - - Serial.print("\nconnecting..."); - while (!client.connect("arduino", "try", "try")) { - Serial.print("."); - delay(1000); - } - - Serial.println("\nconnected!"); - - client.subscribe("/hello"); - // client.unsubscribe("/hello"); -} - -void messageReceived(String &topic, String &payload) { - Serial.println("incoming: " + topic + " - " + payload); -} - -void setup() { - Serial.begin(115200); - WiFi.begin(ssid, pass); - - // Note: Local domain names (e.g. "Computer.local" on OSX) are not supported by Arduino. - // You need to set the IP address directly. - client.begin("broker.shiftr.io", net); - client.onMessage(messageReceived); - - connect(); -} - -void loop() { - client.loop(); - - if (!client.connected()) { - connect(); - } - - // publish a message roughly every second. - if (millis() - lastMillis > 1000) { - lastMillis = millis(); - client.publish("/hello", "world"); - } -} diff --git a/lib/arduino-mqtt-2.4.0/examples/ArduinoYun/ArduinoYun.ino b/lib/arduino-mqtt-2.4.0/examples/ArduinoYun/ArduinoYun.ino deleted file mode 100644 index 823bdff36..000000000 --- a/lib/arduino-mqtt-2.4.0/examples/ArduinoYun/ArduinoYun.ino +++ /dev/null @@ -1,60 +0,0 @@ -// This example uses an Arduino Yun or a Yun-Shield -// and the MQTTClient to connect to shiftr.io. -// -// You can check on your device after a successful -// connection here: https://shiftr.io/try. -// -// by Joël Gähwiler -// https://github.com/256dpi/arduino-mqtt - -#include -#include -#include - -BridgeClient net; -MQTTClient client; - -unsigned long lastMillis = 0; - -void connect() { - Serial.print("connecting..."); - while (!client.connect("arduino", "try", "try")) { - Serial.print("."); - delay(1000); - } - - Serial.println("\nconnected!"); - - client.subscribe("/hello"); - // client.unsubscribe("/hello"); -} - -void messageReceived(String &topic, String &payload) { - Serial.println("incoming: " + topic + " - " + payload); -} - -void setup() { - Bridge.begin(); - Serial.begin(115200); - - // Note: Local domain names (e.g. "Computer.local" on OSX) are not supported by Arduino. - // You need to set the IP address directly. - client.begin("broker.shiftr.io", net); - client.onMessage(messageReceived); - - connect(); -} - -void loop() { - client.loop(); - - if (!client.connected()) { - connect(); - } - - // publish a message roughly every second. - if (millis() - lastMillis > 1000) { - lastMillis = millis(); - client.publish("/hello", "world"); - } -} diff --git a/lib/arduino-mqtt-2.4.0/examples/ArduinoYunSecure/ArduinoYunSecure.ino b/lib/arduino-mqtt-2.4.0/examples/ArduinoYunSecure/ArduinoYunSecure.ino deleted file mode 100644 index 46c068ab2..000000000 --- a/lib/arduino-mqtt-2.4.0/examples/ArduinoYunSecure/ArduinoYunSecure.ino +++ /dev/null @@ -1,62 +0,0 @@ -// This example uses an Arduino Yun or a Yun-Shield -// and the MQTTClient to connect to shiftr.io. -// -// You can check on your device after a successful -// connection here: https://shiftr.io/try. -// -// by Joël Gähwiler -// https://github.com/256dpi/arduino-mqtt - -#include -#include -#include - -BridgeSSLClient net; -MQTTClient client; - -unsigned long lastMillis = 0; - -void connect() { - Serial.print("connecting..."); - while (!client.connect("arduino", "try", "try")) { - Serial.print("."); - delay(1000); - } - - Serial.println("\nconnected!"); - - client.subscribe("/hello"); - // client.unsubscribe("/hello"); -} - -void messageReceived(String &topic, String &payload) { - Serial.println("incoming: " + topic + " - " + payload); -} - -void setup() { - Bridge.begin(); - Serial.begin(115200); - - // Note: Local domain names (e.g. "Computer.local" on OSX) are not supported by Arduino. - // You need to set the IP address directly. - // - // MQTT brokers usually use port 8883 for secure connections. - client.begin("broker.shiftr.io", 8883, net); - client.onMessage(messageReceived); - - connect(); -} - -void loop() { - client.loop(); - - if (!client.connected()) { - connect(); - } - - // publish a message roughly every second. - if (millis() - lastMillis > 1000) { - lastMillis = millis(); - client.publish("/hello", "world"); - } -} diff --git a/lib/arduino-mqtt-2.4.0/examples/ESP32DevelopmentBoard/ESP32DevelopmentBoard.ino b/lib/arduino-mqtt-2.4.0/examples/ESP32DevelopmentBoard/ESP32DevelopmentBoard.ino deleted file mode 100644 index c6919280d..000000000 --- a/lib/arduino-mqtt-2.4.0/examples/ESP32DevelopmentBoard/ESP32DevelopmentBoard.ino +++ /dev/null @@ -1,69 +0,0 @@ -// This example uses an ESP32 Development Board -// to connect to shiftr.io. -// -// You can check on your device after a successful -// connection here: https://shiftr.io/try. -// -// by Joël Gähwiler -// https://github.com/256dpi/arduino-mqtt - -#include -#include - -const char ssid[] = "ssid"; -const char pass[] = "pass"; - -WiFiClient net; -MQTTClient client; - -unsigned long lastMillis = 0; - -void connect() { - Serial.print("checking wifi..."); - while (WiFi.status() != WL_CONNECTED) { - Serial.print("."); - delay(1000); - } - - Serial.print("\nconnecting..."); - while (!client.connect("arduino", "try", "try")) { - Serial.print("."); - delay(1000); - } - - Serial.println("\nconnected!"); - - client.subscribe("/hello"); - // client.unsubscribe("/hello"); -} - -void messageReceived(String &topic, String &payload) { - Serial.println("incoming: " + topic + " - " + payload); -} - -void setup() { - Serial.begin(115200); - WiFi.begin(ssid, pass); - - // Note: Local domain names (e.g. "Computer.local" on OSX) are not supported by Arduino. - // You need to set the IP address directly. - client.begin("broker.shiftr.io", net); - client.onMessage(messageReceived); - - connect(); -} - -void loop() { - client.loop(); - delay(10); // <- fixes some issues with WiFi stability - - if (!client.connected()) { - connect(); - } - - // publish a message roughly every second. - if (millis() - lastMillis > 1000) { - lastMillis = millis(); - client.publish("/hello", "world"); - } -} diff --git a/lib/arduino-mqtt-2.4.0/examples/ESP32DevelopmentBoardSecure/ESP32DevelopmentBoardSecure.ino b/lib/arduino-mqtt-2.4.0/examples/ESP32DevelopmentBoardSecure/ESP32DevelopmentBoardSecure.ino deleted file mode 100644 index cff75379e..000000000 --- a/lib/arduino-mqtt-2.4.0/examples/ESP32DevelopmentBoardSecure/ESP32DevelopmentBoardSecure.ino +++ /dev/null @@ -1,71 +0,0 @@ -// This example uses an ESP32 Development Board -// to connect to shiftr.io. -// -// You can check on your device after a successful -// connection here: https://shiftr.io/try. -// -// by Joël Gähwiler -// https://github.com/256dpi/arduino-mqtt - -#include -#include - -const char ssid[] = "ssid"; -const char pass[] = "pass"; - -WiFiClientSecure net; -MQTTClient client; - -unsigned long lastMillis = 0; - -void connect() { - Serial.print("checking wifi..."); - while (WiFi.status() != WL_CONNECTED) { - Serial.print("."); - delay(1000); - } - - Serial.print("\nconnecting..."); - while (!client.connect("arduino", "try", "try")) { - Serial.print("."); - delay(1000); - } - - Serial.println("\nconnected!"); - - client.subscribe("/hello"); - // client.unsubscribe("/hello"); -} - -void messageReceived(String &topic, String &payload) { - Serial.println("incoming: " + topic + " - " + payload); -} - -void setup() { - Serial.begin(115200); - WiFi.begin(ssid, pass); - - // Note: Local domain names (e.g. "Computer.local" on OSX) are not supported by Arduino. - // You need to set the IP address directly. - // - // MQTT brokers usually use port 8883 for secure connections. - client.begin("broker.shiftr.io", 8883, net); - client.onMessage(messageReceived); - - connect(); -} - -void loop() { - client.loop(); - delay(10); // <- fixes some issues with WiFi stability - - if (!client.connected()) { - connect(); - } - - // publish a message roughly every second. - if (millis() - lastMillis > 1000) { - lastMillis = millis(); - client.publish("/hello", "world"); - } -} diff --git a/lib/arduino-mqtt-2.4.0/library.properties b/lib/arduino-mqtt-2.4.0/library.properties deleted file mode 100644 index 0cf498e9b..000000000 --- a/lib/arduino-mqtt-2.4.0/library.properties +++ /dev/null @@ -1,9 +0,0 @@ -name=MQTT -version=2.4.0 -author=Joel Gaehwiler -maintainer=Joel Gaehwiler -sentence=MQTT library for Arduino -paragraph=This library bundles the lwmqtt client and adds a thin wrapper to get an Arduino like API. -category=Communication -url=https://github.com/256dpi/arduino-mqtt -architectures=* diff --git a/lib/arduino-mqtt-2.4.0/src/MQTT.h b/lib/arduino-mqtt-2.4.0/src/MQTT.h deleted file mode 100644 index 35652c45f..000000000 --- a/lib/arduino-mqtt-2.4.0/src/MQTT.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef MQTT_H -#define MQTT_H - -#include "MQTTClient.h" - -#endif diff --git a/lib/arduino-mqtt-2.4.0/src/MQTTClient.h b/lib/arduino-mqtt-2.4.0/src/MQTTClient.h deleted file mode 100644 index d87f62cd5..000000000 --- a/lib/arduino-mqtt-2.4.0/src/MQTTClient.h +++ /dev/null @@ -1,491 +0,0 @@ -#ifndef MQTT_CLIENT_H -#define MQTT_CLIENT_H - -#include -#include -#include - -extern "C" { -#include "lwmqtt/lwmqtt.h" -}; - -typedef struct { - uint32_t end; -} lwmqtt_arduino_timer_t; - -void lwmqtt_arduino_timer_set(void *ref, uint32_t timeout); - -int32_t lwmqtt_arduino_timer_get(void *ref); - -typedef struct { - Client *client; -} lwmqtt_arduino_network_t; - -void lwmqtt_arduino_timer_set(void *ref, uint32_t timeout) { - // cast timer reference - auto t = (lwmqtt_arduino_timer_t *)ref; - - // set future end time - t->end = (uint32_t)(millis() + timeout); -} - -int32_t lwmqtt_arduino_timer_get(void *ref) { - // cast timer reference - auto t = (lwmqtt_arduino_timer_t *)ref; - - // get difference to end time - return (int32_t)t->end - (int32_t)millis(); -} - -lwmqtt_err_t lwmqtt_arduino_network_read(void *ref, uint8_t *buffer, size_t len, size_t *read, uint32_t timeout) { - // cast network reference - auto n = (lwmqtt_arduino_network_t *)ref; - - // set timeout - n->client->setTimeout(timeout); - - // read bytes - *read = n->client->readBytes(buffer, len); - if (*read <= 0) { - return LWMQTT_NETWORK_FAILED_READ; - } - - return LWMQTT_SUCCESS; -} - -lwmqtt_err_t lwmqtt_arduino_network_write(void *ref, uint8_t *buffer, size_t len, size_t *sent, uint32_t /*timeout*/) { - // cast network reference - auto n = (lwmqtt_arduino_network_t *)ref; - - // write bytes - *sent = n->client->write(buffer, len); - if (*sent <= 0) { - return LWMQTT_NETWORK_FAILED_WRITE; - }; - - return LWMQTT_SUCCESS; -} - -class MQTTClient; - -typedef void (*MQTTClientCallbackSimple)(String &topic, String &payload); -typedef void (*MQTTClientCallbackAdvanced)(MQTTClient *client, char topic[], char bytes[], int length); - -typedef struct { - MQTTClient *client = nullptr; - MQTTClientCallbackSimple simple = nullptr; - MQTTClientCallbackAdvanced advanced = nullptr; -} MQTTClientCallback; - -static void MQTTClientHandler(lwmqtt_client_t * /*client*/, void *ref, lwmqtt_string_t topic, - lwmqtt_message_t message) { - // get callback - auto cb = (MQTTClientCallback *)ref; - - // null terminate topic - char terminated_topic[topic.len + 1]; - memcpy(terminated_topic, topic.data, topic.len); - terminated_topic[topic.len] = '\0'; - - // null terminate payload if available - if (message.payload != nullptr) { - message.payload[message.payload_len] = '\0'; - } - - // call the advanced callback and return if available - if (cb->advanced != nullptr) { - cb->advanced(cb->client, terminated_topic, (char *)message.payload, (int)message.payload_len); - return; - } - - // return if simple callback is not set - if (cb->simple == nullptr) { - return; - } - - // create topic string - String str_topic = String(terminated_topic); - - // create payload string - String str_payload; - if (message.payload != nullptr) { - str_payload = String((const char *)message.payload); - } - - // call simple callback - cb->simple(str_topic, str_payload); -} - -class MQTTClient { - private: - size_t bufSize = 0; - uint8_t *readBuf = nullptr; - uint8_t *writeBuf = nullptr; - - uint16_t keepAlive = 10; - bool cleanSession = true; - uint32_t timeout = 1000; - - Client *netClient = nullptr; - const char *hostname = nullptr; - int port = 0; - lwmqtt_will_t *will = nullptr; - MQTTClientCallback callback; - - lwmqtt_arduino_network_t network = {nullptr}; - lwmqtt_arduino_timer_t timer1 = {0}; - lwmqtt_arduino_timer_t timer2 = {0}; - lwmqtt_client_t client = {0}; - - bool _connected = false; - lwmqtt_return_code_t _returnCode = (lwmqtt_return_code_t)0; - lwmqtt_err_t _lastError = (lwmqtt_err_t)0; - - public: - explicit MQTTClient(int bufSize = 128) { - // reset client - memset(&this->client, 0, sizeof(lwmqtt_client_t)); - - // allocate buffers - this->bufSize = (size_t)bufSize; - this->readBuf = (uint8_t *)malloc((size_t)bufSize + 1); - this->writeBuf = (uint8_t *)malloc((size_t)bufSize); - } - - ~MQTTClient() { - // free will - this->clearWill(); - - // free hostname - if (this->hostname != nullptr) { - free((void *)this->hostname); - } - - // free buffers - free(this->readBuf); - free(this->writeBuf); - } - - void begin(const char hostname[], Client &client) { this->begin(hostname, 1883, client); } - - void begin(const char hostname[], int port, Client &client) { - // set hostname and port - this->setHost(hostname, port); - - // set client - this->netClient = &client; - - // initialize client - lwmqtt_init(&this->client, this->writeBuf, this->bufSize, this->readBuf, this->bufSize); - - // set timers - lwmqtt_set_timers(&this->client, &this->timer1, &this->timer2, lwmqtt_arduino_timer_set, lwmqtt_arduino_timer_get); - - // set network - lwmqtt_set_network(&this->client, &this->network, lwmqtt_arduino_network_read, lwmqtt_arduino_network_write); - - // set callback - lwmqtt_set_callback(&this->client, (void *)&this->callback, MQTTClientHandler); - } - - void onMessage(MQTTClientCallbackSimple cb) { - // set callback - this->callback.client = this; - this->callback.simple = cb; - this->callback.advanced = nullptr; - } - - void onMessageAdvanced(MQTTClientCallbackAdvanced cb) { - // set callback - this->callback.client = this; - this->callback.simple = nullptr; - this->callback.advanced = cb; - } - - void setHost(const char hostname[]) { this->setHost(hostname, 1883); } - - void setHost(const char hostname[], int port) { - // free hostname if set - if (this->hostname != nullptr) { - free((void *)this->hostname); - } - - // set hostname and port - this->hostname = strdup(hostname); - this->port = port; - } - - void setWill(const char topic[]) { this->setWill(topic, ""); } - - void setWill(const char topic[], const char payload[]) { this->setWill(topic, payload, false, 0); } - - void setWill(const char topic[], const char payload[], bool retained, int qos) { - // return if topic is missing - if (topic == nullptr || strlen(topic) == 0) { - return; - } - - // clear existing will - this->clearWill(); - - // allocate will - this->will = (lwmqtt_will_t *)malloc(sizeof(lwmqtt_will_t)); - memset(this->will, 0, sizeof(lwmqtt_will_t)); - - // set topic - this->will->topic = lwmqtt_string(strdup(topic)); - - // set payload if available - if (payload != nullptr && strlen(payload) > 0) { - this->will->payload = lwmqtt_string(strdup(payload)); - } - - // set flags - this->will->retained = retained; - this->will->qos = (lwmqtt_qos_t)qos; - } - - void clearWill() { - // return if not set - if (this->will == nullptr) { - return; - } - - // free payload if set - if (this->will->payload.len > 0) { - free(this->will->payload.data); - } - - // free topic if set - if (this->will->topic.len > 0) { - free(this->will->topic.data); - } - - // free will - free(this->will); - this->will = nullptr; - } - - void setOptions(int keepAlive, bool cleanSession, int timeout) { - // set new options - this->keepAlive = (uint16_t)keepAlive; - this->cleanSession = cleanSession; - this->timeout = (uint32_t)timeout; - } - - bool connect(const char clientId[], bool skip = false) { return this->connect(clientId, nullptr, nullptr); } - - bool connect(const char clientId[], const char username[], bool skip = false) { return this->connect(clientId, username, nullptr); } - - bool connect(const char clientId[], const char username[], const char password[], bool skip = false) { - // close left open connection if still connected - if (!skip && this->connected()) { - this->close(); - } - - // save client - this->network.client = this->netClient; - - // connect to hostg - if(!skip) { - int ret = this->netClient->connect(this->hostname, (uint16_t)this->port); - if (ret <= 0) { - return false; - } - } - - // prepare options - lwmqtt_options_t options = lwmqtt_default_options; - options.keep_alive = this->keepAlive; - options.clean_session = this->cleanSession; - options.client_id = lwmqtt_string(clientId); - - // set username and password if available - if (username != nullptr) { - options.username = lwmqtt_string(username); - - if (password != nullptr) { - options.password = lwmqtt_string(password); - } - } - - // connect to broker - this->_lastError = lwmqtt_connect(&this->client, options, this->will, &this->_returnCode, this->timeout); - if (this->_lastError != LWMQTT_SUCCESS) { - // close connection - this->close(); - - return false; - } - - // set flag - this->_connected = true; - - return true; - } - - bool publish(const String &topic) { return this->publish(topic.c_str(), ""); } - - bool publish(const char topic[]) { return this->publish(topic, ""); } - - bool publish(const String &topic, const String &payload) { return this->publish(topic.c_str(), payload.c_str()); } - - bool publish(const String &topic, const String &payload, bool retained, int qos) { - return this->publish(topic.c_str(), payload.c_str(), retained, qos); - } - - bool publish(const char topic[], const String &payload) { return this->publish(topic, payload.c_str()); } - - bool publish(const char topic[], const String &payload, bool retained, int qos) { - return this->publish(topic, payload.c_str(), retained, qos); - } - - bool publish(const char topic[], const char payload[]) { - return this->publish(topic, (char *)payload, (int)strlen(payload)); - } - - bool publish(const char topic[], const char payload[], bool retained, int qos) { - return this->publish(topic, (char *)payload, (int)strlen(payload), retained, qos); - } - - bool publish(const char topic[], const char payload[], int length) { - return this->publish(topic, payload, length, false, 0); - } - - bool publish(const char topic[], const char payload[], int length, bool retained, int qos) { - // return immediately if not connected - if (!this->connected()) { - return false; - } - - // prepare message - lwmqtt_message_t message = lwmqtt_default_message; - message.payload = (uint8_t *)payload; - message.payload_len = (size_t)length; - message.retained = retained; - message.qos = lwmqtt_qos_t(qos); - - // publish message - this->_lastError = lwmqtt_publish(&this->client, lwmqtt_string(topic), message, this->timeout); - if (this->_lastError != LWMQTT_SUCCESS) { - // close connection - this->close(); - - return false; - } - - return true; - } - - bool subscribe(const String &topic) { return this->subscribe(topic.c_str()); } - - bool subscribe(const String &topic, int qos) { return this->subscribe(topic.c_str(), qos); } - - bool subscribe(const char topic[]) { return this->subscribe(topic, 0); } - - bool subscribe(const char topic[], int qos) { - // return immediately if not connected - if (!this->connected()) { - return false; - } - - // subscribe to topic - this->_lastError = lwmqtt_subscribe_one(&this->client, lwmqtt_string(topic), (lwmqtt_qos_t)qos, this->timeout); - if (this->_lastError != LWMQTT_SUCCESS) { - // close connection - this->close(); - - return false; - } - - return true; - } - - bool unsubscribe(const String &topic) { return this->unsubscribe(topic.c_str()); } - - bool unsubscribe(const char topic[]) { - // return immediately if not connected - if (!this->connected()) { - return false; - } - - // unsubscribe from topic - this->_lastError = lwmqtt_unsubscribe_one(&this->client, lwmqtt_string(topic), this->timeout); - if (this->_lastError != LWMQTT_SUCCESS) { - // close connection - this->close(); - - return false; - } - - return true; - } - - bool loop() { - // return immediately if not connected - if (!this->connected()) { - return false; - } - - // get available bytes on the network - auto available = (size_t)this->netClient->available(); - - // yield if data is available - if (available > 0) { - this->_lastError = lwmqtt_yield(&this->client, available, this->timeout); - if (this->_lastError != LWMQTT_SUCCESS) { - // close connection - this->close(); - - return false; - } - } - - // keep the connection alive - this->_lastError = lwmqtt_keep_alive(&this->client, this->timeout); - if (this->_lastError != LWMQTT_SUCCESS) { - // close connection - this->close(); - - return false; - } - - return true; - } - - bool connected() { - // a client is connected if the network is connected, a client is available and - // the connection has been properly initiated - return this->netClient != nullptr && this->netClient->connected() == 1 && this->_connected; - } - - lwmqtt_err_t lastError() { return this->_lastError; } - - lwmqtt_return_code_t returnCode() { return this->_returnCode; } - - bool disconnect() { - // return immediately if not connected anymore - if (!this->connected()) { - return false; - } - - // cleanly disconnect - this->_lastError = lwmqtt_disconnect(&this->client, this->timeout); - - // close - this->close(); - - return this->_lastError == LWMQTT_SUCCESS; - } - - private: - void close() { - // set flag - this->_connected = false; - - // close network - this->netClient->stop(); - } -}; - -#endif diff --git a/lib/arduino-mqtt-2.4.0/src/lwmqtt/client.c b/lib/arduino-mqtt-2.4.0/src/lwmqtt/client.c deleted file mode 100644 index b1772b9f7..000000000 --- a/lib/arduino-mqtt-2.4.0/src/lwmqtt/client.c +++ /dev/null @@ -1,618 +0,0 @@ -#include "packet.h" - -void lwmqtt_init(lwmqtt_client_t *client, uint8_t *write_buf, size_t write_buf_size, uint8_t *read_buf, - size_t read_buf_size) { - client->last_packet_id = 1; - client->keep_alive_interval = 0; - client->pong_pending = false; - - client->write_buf = write_buf; - client->write_buf_size = write_buf_size; - client->read_buf = read_buf; - client->read_buf_size = read_buf_size; - - client->callback = NULL; - client->callback_ref = NULL; - - client->network = NULL; - client->network_read = NULL; - client->network_write = NULL; - - client->keep_alive_timer = NULL; - client->command_timer = NULL; - client->timer_set = NULL; - client->timer_get = NULL; -} - -void lwmqtt_set_network(lwmqtt_client_t *client, void *ref, lwmqtt_network_read_t read, lwmqtt_network_write_t write) { - client->network = ref; - client->network_read = read; - client->network_write = write; -} - -void lwmqtt_set_timers(lwmqtt_client_t *client, void *keep_alive_timer, void *command_timer, lwmqtt_timer_set_t set, - lwmqtt_timer_get_t get) { - client->keep_alive_timer = keep_alive_timer; - client->command_timer = command_timer; - client->timer_set = set; - client->timer_get = get; - - client->timer_set(client->keep_alive_timer, 0); - client->timer_set(client->command_timer, 0); -} - -void lwmqtt_set_callback(lwmqtt_client_t *client, void *ref, lwmqtt_callback_t cb) { - client->callback_ref = ref; - client->callback = cb; -} - -static uint16_t lwmqtt_get_next_packet_id(lwmqtt_client_t *client) { - // check overflow - if (client->last_packet_id == 65535) { - client->last_packet_id = 1; - return 1; - } - - // increment packet id - client->last_packet_id++; - - return client->last_packet_id; -} - -static lwmqtt_err_t lwmqtt_read_from_network(lwmqtt_client_t *client, size_t offset, size_t len) { - // check read buffer capacity - if (client->read_buf_size < offset + len) { - return LWMQTT_BUFFER_TOO_SHORT; - } - - // prepare counter - size_t read = 0; - - // read while data is missing - while (read < len) { - // check remaining time - int32_t remaining_time = client->timer_get(client->command_timer); - if (remaining_time <= 0) { - return LWMQTT_NETWORK_TIMEOUT; - } - - // read - size_t partial_read = 0; - lwmqtt_err_t err = client->network_read(client->network, client->read_buf + offset + read, len - read, - &partial_read, (uint32_t)remaining_time); - if (err != LWMQTT_SUCCESS) { - return err; - } - - // increment counter - read += partial_read; - } - - return LWMQTT_SUCCESS; -} - -static lwmqtt_err_t lwmqtt_write_to_network(lwmqtt_client_t *client, size_t offset, size_t len) { - // prepare counter - size_t written = 0; - - // write while data is left - while (written < len) { - // check remaining time - int32_t remaining_time = client->timer_get(client->command_timer); - if (remaining_time <= 0) { - return LWMQTT_NETWORK_TIMEOUT; - } - - // write - size_t partial_write = 0; - lwmqtt_err_t err = client->network_write(client->network, client->write_buf + offset + written, len - written, - &partial_write, (uint32_t)remaining_time); - if (err != LWMQTT_SUCCESS) { - return err; - } - - // increment counter - written += partial_write; - } - - return LWMQTT_SUCCESS; -} - -static lwmqtt_err_t lwmqtt_read_packet_in_buffer(lwmqtt_client_t *client, size_t *read, - lwmqtt_packet_type_t *packet_type) { - // preset packet type - *packet_type = LWMQTT_NO_PACKET; - - // read or wait for header byte - lwmqtt_err_t err = lwmqtt_read_from_network(client, 0, 1); - if (err == LWMQTT_NETWORK_TIMEOUT) { - // this is ok as no data has been read at all - return LWMQTT_SUCCESS; - } else if (err != LWMQTT_SUCCESS) { - return err; - } - - // detect packet type - err = lwmqtt_detect_packet_type(client->read_buf, 1, packet_type); - if (err != LWMQTT_SUCCESS) { - return err; - } - - // prepare variables - size_t len = 0; - uint32_t rem_len = 0; - - do { - // adjust len - len++; - - // read next byte - err = lwmqtt_read_from_network(client, len, 1); - if (err != LWMQTT_SUCCESS) { - return err; - } - - // attempt to detect remaining length - err = lwmqtt_detect_remaining_length(client->read_buf + 1, len, &rem_len); - } while (err == LWMQTT_BUFFER_TOO_SHORT); - - // check final error - if (err != LWMQTT_SUCCESS) { - return err; - } - - // read the rest of the buffer if needed - if (rem_len > 0) { - err = lwmqtt_read_from_network(client, 1 + len, rem_len); - if (err != LWMQTT_SUCCESS) { - return err; - } - } - - // adjust counter - *read += 1 + len + rem_len; - - return LWMQTT_SUCCESS; -} - -static lwmqtt_err_t lwmqtt_send_packet_in_buffer(lwmqtt_client_t *client, size_t length) { - // write to network - lwmqtt_err_t err = lwmqtt_write_to_network(client, 0, length); - if (err != LWMQTT_SUCCESS) { - return err; - } - - // reset keep alive timer - client->timer_set(client->keep_alive_timer, client->keep_alive_interval); - - return LWMQTT_SUCCESS; -} - -static lwmqtt_err_t lwmqtt_cycle(lwmqtt_client_t *client, size_t *read, lwmqtt_packet_type_t *packet_type) { - // read next packet from the network - lwmqtt_err_t err = lwmqtt_read_packet_in_buffer(client, read, packet_type); - if (err != LWMQTT_SUCCESS) { - return err; - } else if (*packet_type == LWMQTT_NO_PACKET) { - return LWMQTT_SUCCESS; - } - - switch (*packet_type) { - // handle publish packets - case LWMQTT_PUBLISH_PACKET: { - // decode publish packet - bool dup; - uint16_t packet_id; - lwmqtt_string_t topic; - lwmqtt_message_t msg; - err = lwmqtt_decode_publish(client->read_buf, client->read_buf_size, &dup, &packet_id, &topic, &msg); - if (err != LWMQTT_SUCCESS) { - return err; - } - - // call callback if set - if (client->callback != NULL) { - client->callback(client, client->callback_ref, topic, msg); - } - - // break early on qos zero - if (msg.qos == LWMQTT_QOS0) { - break; - } - - // define ack packet - lwmqtt_packet_type_t ack_type = LWMQTT_NO_PACKET; - if (msg.qos == LWMQTT_QOS1) { - ack_type = LWMQTT_PUBACK_PACKET; - } else if (msg.qos == LWMQTT_QOS2) { - ack_type = LWMQTT_PUBREC_PACKET; - } - - // encode ack packet - size_t len; - err = lwmqtt_encode_ack(client->write_buf, client->write_buf_size, &len, ack_type, false, packet_id); - if (err != LWMQTT_SUCCESS) { - return err; - } - - // send ack packet - err = lwmqtt_send_packet_in_buffer(client, len); - if (err != LWMQTT_SUCCESS) { - return err; - } - - break; - } - - // handle pubrec packets - case LWMQTT_PUBREC_PACKET: { - // decode pubrec packet - bool dup; - uint16_t packet_id; - err = lwmqtt_decode_ack(client->read_buf, client->read_buf_size, LWMQTT_PUBREC_PACKET, &dup, &packet_id); - if (err != LWMQTT_SUCCESS) { - return err; - } - - // encode pubrel packet - size_t len; - err = lwmqtt_encode_ack(client->write_buf, client->write_buf_size, &len, LWMQTT_PUBREL_PACKET, 0, packet_id); - if (err != LWMQTT_SUCCESS) { - return err; - } - - // send pubrel packet - err = lwmqtt_send_packet_in_buffer(client, len); - if (err != LWMQTT_SUCCESS) { - return err; - } - - break; - } - - // handle pubrel packets - case LWMQTT_PUBREL_PACKET: { - // decode pubrec packet - bool dup; - uint16_t packet_id; - err = lwmqtt_decode_ack(client->read_buf, client->read_buf_size, LWMQTT_PUBREL_PACKET, &dup, &packet_id); - if (err != LWMQTT_SUCCESS) { - return err; - } - - // encode pubcomp packet - size_t len; - err = lwmqtt_encode_ack(client->write_buf, client->write_buf_size, &len, LWMQTT_PUBCOMP_PACKET, 0, packet_id); - if (err != LWMQTT_SUCCESS) { - return err; - } - - // send pubcomp packet - err = lwmqtt_send_packet_in_buffer(client, len); - if (err != LWMQTT_SUCCESS) { - return err; - } - - break; - } - - // handle pingresp packets - case LWMQTT_PINGRESP_PACKET: { - // set flag - client->pong_pending = false; - - break; - } - - // handle all other packets - default: { break; } - } - - return LWMQTT_SUCCESS; -} - -static lwmqtt_err_t lwmqtt_cycle_until(lwmqtt_client_t *client, lwmqtt_packet_type_t *packet_type, size_t available, - lwmqtt_packet_type_t needle) { - // prepare counter - size_t read = 0; - - // loop until timeout has been reached - do { - // do one cycle - lwmqtt_err_t err = lwmqtt_cycle(client, &read, packet_type); - if (err != LWMQTT_SUCCESS) { - return err; - } - - // return when one packet has been successfully read when no availability has been given - if (needle == LWMQTT_NO_PACKET && available == 0) { - return LWMQTT_SUCCESS; - } - - // otherwise check if needle has been found - if (*packet_type == needle) { - return LWMQTT_SUCCESS; - } - } while (client->timer_get(client->command_timer) > 0 && (available == 0 || read < available)); - - return LWMQTT_SUCCESS; -} - -lwmqtt_err_t lwmqtt_yield(lwmqtt_client_t *client, size_t available, uint32_t timeout) { - // set command timer - client->timer_set(client->command_timer, timeout); - - // cycle until timeout has been reached - lwmqtt_packet_type_t packet_type = LWMQTT_NO_PACKET; - lwmqtt_err_t err = lwmqtt_cycle_until(client, &packet_type, available, LWMQTT_NO_PACKET); - if (err != LWMQTT_SUCCESS) { - return err; - } - - return LWMQTT_SUCCESS; -} - -lwmqtt_err_t lwmqtt_connect(lwmqtt_client_t *client, lwmqtt_options_t options, lwmqtt_will_t *will, - lwmqtt_return_code_t *return_code, uint32_t timeout) { - // set command timer - client->timer_set(client->command_timer, timeout); - - // save keep alive interval (take 75% to be a little earlier than actually needed) - client->keep_alive_interval = (uint32_t)(options.keep_alive * 750); - - // set keep alive timer - client->timer_set(client->keep_alive_timer, client->keep_alive_interval); - - // reset pong pending flag - client->pong_pending = false; - - // initialize return code - *return_code = LWMQTT_UNKNOWN_RETURN_CODE; - - // encode connect packet - size_t len; - lwmqtt_err_t err = lwmqtt_encode_connect(client->write_buf, client->write_buf_size, &len, options, will); - if (err != LWMQTT_SUCCESS) { - return err; - } - - // send packet - err = lwmqtt_send_packet_in_buffer(client, len); - if (err != LWMQTT_SUCCESS) { - return err; - } - - // wait for connack packet - lwmqtt_packet_type_t packet_type = LWMQTT_NO_PACKET; - err = lwmqtt_cycle_until(client, &packet_type, 0, LWMQTT_CONNACK_PACKET); - if (err != LWMQTT_SUCCESS) { - return err; - } else if (packet_type != LWMQTT_CONNACK_PACKET) { - return LWMQTT_MISSING_OR_WRONG_PACKET; - } - - // decode connack packet - bool session_present; - err = lwmqtt_decode_connack(client->read_buf, client->read_buf_size, &session_present, return_code); - if (err != LWMQTT_SUCCESS) { - return err; - } - - // return error if connection was not accepted - if (*return_code != LWMQTT_CONNECTION_ACCEPTED) { - return LWMQTT_CONNECTION_DENIED; - } - - return LWMQTT_SUCCESS; -} - -lwmqtt_err_t lwmqtt_subscribe(lwmqtt_client_t *client, int count, lwmqtt_string_t *topic_filter, lwmqtt_qos_t *qos, - uint32_t timeout) { - // set command timer - client->timer_set(client->command_timer, timeout); - - // encode subscribe packet - size_t len; - lwmqtt_err_t err = lwmqtt_encode_subscribe(client->write_buf, client->write_buf_size, &len, - lwmqtt_get_next_packet_id(client), count, topic_filter, qos); - if (err != LWMQTT_SUCCESS) { - return err; - } - - // send packet - err = lwmqtt_send_packet_in_buffer(client, len); - if (err != LWMQTT_SUCCESS) { - return err; - } - - // wait for suback packet - lwmqtt_packet_type_t packet_type = LWMQTT_NO_PACKET; - err = lwmqtt_cycle_until(client, &packet_type, 0, LWMQTT_SUBACK_PACKET); - if (err != LWMQTT_SUCCESS) { - return err; - } else if (packet_type != LWMQTT_SUBACK_PACKET) { - return LWMQTT_MISSING_OR_WRONG_PACKET; - } - - // decode packet - int suback_count = 0; - lwmqtt_qos_t granted_qos[count]; - uint16_t packet_id; - err = lwmqtt_decode_suback(client->read_buf, client->read_buf_size, &packet_id, count, &suback_count, granted_qos); - if (err != LWMQTT_SUCCESS) { - return err; - } - - // check suback codes - for (int i = 0; i < suback_count; i++) { - if (granted_qos[i] == LWMQTT_QOS_FAILURE) { - return LWMQTT_FAILED_SUBSCRIPTION; - } - } - - return LWMQTT_SUCCESS; -} - -lwmqtt_err_t lwmqtt_subscribe_one(lwmqtt_client_t *client, lwmqtt_string_t topic_filter, lwmqtt_qos_t qos, - uint32_t timeout) { - return lwmqtt_subscribe(client, 1, &topic_filter, &qos, timeout); -} - -lwmqtt_err_t lwmqtt_unsubscribe(lwmqtt_client_t *client, int count, lwmqtt_string_t *topic_filter, uint32_t timeout) { - // set command timer - client->timer_set(client->command_timer, timeout); - - // encode unsubscribe packet - size_t len; - lwmqtt_err_t err = lwmqtt_encode_unsubscribe(client->write_buf, client->write_buf_size, &len, - lwmqtt_get_next_packet_id(client), count, topic_filter); - if (err != LWMQTT_SUCCESS) { - return err; - } - - // send unsubscribe packet - err = lwmqtt_send_packet_in_buffer(client, len); - if (err != LWMQTT_SUCCESS) { - return err; - } - - // wait for unsuback packet - lwmqtt_packet_type_t packet_type = LWMQTT_NO_PACKET; - err = lwmqtt_cycle_until(client, &packet_type, 0, LWMQTT_UNSUBACK_PACKET); - if (err != LWMQTT_SUCCESS) { - return err; - } else if (packet_type != LWMQTT_UNSUBACK_PACKET) { - return LWMQTT_MISSING_OR_WRONG_PACKET; - } - - // decode unsuback packet - bool dup; - uint16_t packet_id; - err = lwmqtt_decode_ack(client->read_buf, client->read_buf_size, LWMQTT_UNSUBACK_PACKET, &dup, &packet_id); - if (err != LWMQTT_SUCCESS) { - return err; - } - - return LWMQTT_SUCCESS; -} - -lwmqtt_err_t lwmqtt_unsubscribe_one(lwmqtt_client_t *client, lwmqtt_string_t topic_filter, uint32_t timeout) { - return lwmqtt_unsubscribe(client, 1, &topic_filter, timeout); -} - -lwmqtt_err_t lwmqtt_publish(lwmqtt_client_t *client, lwmqtt_string_t topic, lwmqtt_message_t message, - uint32_t timeout) { - // set command timer - client->timer_set(client->command_timer, timeout); - - // add packet id if at least qos 1 - uint16_t packet_id = 0; - if (message.qos == LWMQTT_QOS1 || message.qos == LWMQTT_QOS2) { - packet_id = lwmqtt_get_next_packet_id(client); - } - - // encode publish packet - size_t len = 0; - lwmqtt_err_t err = - lwmqtt_encode_publish(client->write_buf, client->write_buf_size, &len, 0, packet_id, topic, message); - if (err != LWMQTT_SUCCESS) { - return err; - } - - // send packet - err = lwmqtt_send_packet_in_buffer(client, len); - if (err != LWMQTT_SUCCESS) { - return err; - } - - // immediately return on qos zero - if (message.qos == LWMQTT_QOS0) { - return LWMQTT_SUCCESS; - } - - // define ack packet - lwmqtt_packet_type_t ack_type = LWMQTT_NO_PACKET; - if (message.qos == LWMQTT_QOS1) { - ack_type = LWMQTT_PUBACK_PACKET; - } else if (message.qos == LWMQTT_QOS2) { - ack_type = LWMQTT_PUBCOMP_PACKET; - } - - // wait for ack packet - lwmqtt_packet_type_t packet_type = LWMQTT_NO_PACKET; - err = lwmqtt_cycle_until(client, &packet_type, 0, ack_type); - if (err != LWMQTT_SUCCESS) { - return err; - } else if (packet_type != ack_type) { - return LWMQTT_MISSING_OR_WRONG_PACKET; - } - - // decode ack packet - bool dup; - err = lwmqtt_decode_ack(client->read_buf, client->read_buf_size, ack_type, &dup, &packet_id); - if (err != LWMQTT_SUCCESS) { - return err; - } - - return LWMQTT_SUCCESS; -} - -lwmqtt_err_t lwmqtt_disconnect(lwmqtt_client_t *client, uint32_t timeout) { - // set command timer - client->timer_set(client->command_timer, timeout); - - // encode disconnect packet - size_t len; - lwmqtt_err_t err = lwmqtt_encode_zero(client->write_buf, client->write_buf_size, &len, LWMQTT_DISCONNECT_PACKET); - if (err != LWMQTT_SUCCESS) { - return err; - } - - // send disconnected packet - err = lwmqtt_send_packet_in_buffer(client, len); - if (err != LWMQTT_SUCCESS) { - return err; - } - - return LWMQTT_SUCCESS; -} - -lwmqtt_err_t lwmqtt_keep_alive(lwmqtt_client_t *client, uint32_t timeout) { - // set command timer - client->timer_set(client->command_timer, timeout); - - // return immediately if keep alive interval is zero - if (client->keep_alive_interval == 0) { - return LWMQTT_SUCCESS; - } - - // return immediately if no ping is due - if (client->timer_get(client->keep_alive_timer) > 0) { - return LWMQTT_SUCCESS; - } - - // a ping is due - - // fail immediately if a pong is already pending - if (client->pong_pending) { - return LWMQTT_PONG_TIMEOUT; - } - - // encode pingreq packet - size_t len; - lwmqtt_err_t err = lwmqtt_encode_zero(client->write_buf, client->write_buf_size, &len, LWMQTT_PINGREQ_PACKET); - if (err != LWMQTT_SUCCESS) { - return err; - } - - // send packet - err = lwmqtt_send_packet_in_buffer(client, len); - if (err != LWMQTT_SUCCESS) { - return err; - } - - // set flag - client->pong_pending = true; - - return LWMQTT_SUCCESS; -} diff --git a/lib/arduino-mqtt-2.4.0/src/lwmqtt/helpers.c b/lib/arduino-mqtt-2.4.0/src/lwmqtt/helpers.c deleted file mode 100644 index 9c78f4eaf..000000000 --- a/lib/arduino-mqtt-2.4.0/src/lwmqtt/helpers.c +++ /dev/null @@ -1,249 +0,0 @@ -#include - -#include "helpers.h" - -uint8_t lwmqtt_read_bits(uint8_t byte, int pos, int num) { return (byte & (uint8_t)((~(0xFF << num)) << pos)) >> pos; } - -void lwmqtt_write_bits(uint8_t *byte, uint8_t value, int pos, int num) { - *byte = (*byte & ~(uint8_t)((~(0xFF << num)) << pos)) | (value << pos); -} - -lwmqtt_err_t lwmqtt_read_data(uint8_t **buf, const uint8_t *buf_end, uint8_t **data, size_t len) { - // check zero length - if (len == 0) { - *data = NULL; - return LWMQTT_SUCCESS; - } - - // check buffer size - if ((size_t)(buf_end - (*buf)) < len) { - return LWMQTT_BUFFER_TOO_SHORT; - } - - // read data - *data = *buf; - - // advance pointer - *buf += len; - - return LWMQTT_SUCCESS; -} - -lwmqtt_err_t lwmqtt_write_data(uint8_t **buf, const uint8_t *buf_end, uint8_t *data, size_t len) { - // check zero length - if (len == 0) { - return LWMQTT_SUCCESS; - } - - // check buffer size - if ((size_t)(buf_end - (*buf)) < len) { - return LWMQTT_BUFFER_TOO_SHORT; - } - - // write data - memcpy(*buf, data, len); - - // advance pointer - *buf += len; - - return LWMQTT_SUCCESS; -} - -lwmqtt_err_t lwmqtt_read_num(uint8_t **buf, const uint8_t *buf_end, uint16_t *num) { - // check buffer size - if ((size_t)(buf_end - (*buf)) < 2) { - *num = 0; - return LWMQTT_BUFFER_TOO_SHORT; - } - - // read two byte integer - *num = (uint16_t)256 * (*buf)[0] + (*buf)[1]; - - // adjust pointer - *buf += 2; - - return LWMQTT_SUCCESS; -} - -lwmqtt_err_t lwmqtt_write_num(uint8_t **buf, const uint8_t *buf_end, uint16_t num) { - // check buffer size - if ((size_t)(buf_end - (*buf)) < 2) { - return LWMQTT_BUFFER_TOO_SHORT; - } - - // write bytes - (*buf)[0] = (uint8_t)(num / 256); - (*buf)[1] = (uint8_t)(num % 256); - - // adjust pointer - *buf += 2; - - return LWMQTT_SUCCESS; -} - -lwmqtt_err_t lwmqtt_read_string(uint8_t **buf, const uint8_t *buf_end, lwmqtt_string_t *str) { - // read length - uint16_t len; - lwmqtt_err_t err = lwmqtt_read_num(buf, buf_end, &len); - if (err != LWMQTT_SUCCESS) { - return err; - } - - // read data - err = lwmqtt_read_data(buf, buf_end, (uint8_t **)&str->data, len); - if (err != LWMQTT_SUCCESS) { - return err; - } - - // set length - str->len = len; - - return LWMQTT_SUCCESS; -} - -lwmqtt_err_t lwmqtt_write_string(uint8_t **buf, const uint8_t *buf_end, lwmqtt_string_t str) { - // write string length - lwmqtt_err_t err = lwmqtt_write_num(buf, buf_end, str.len); - if (err != LWMQTT_SUCCESS) { - return err; - } - - // write data - err = lwmqtt_write_data(buf, buf_end, (uint8_t *)str.data, str.len); - if (err != LWMQTT_SUCCESS) { - return err; - } - - return LWMQTT_SUCCESS; -} - -lwmqtt_err_t lwmqtt_read_byte(uint8_t **buf, const uint8_t *buf_end, uint8_t *byte) { - // check buffer size - if ((size_t)(buf_end - (*buf)) < 1) { - *byte = 0; - return LWMQTT_BUFFER_TOO_SHORT; - } - - // read byte - *byte = (*buf)[0]; - - // adjust pointer - *buf += 1; - - return LWMQTT_SUCCESS; -} - -lwmqtt_err_t lwmqtt_write_byte(uint8_t **buf, const uint8_t *buf_end, uint8_t byte) { - // check buffer size - if ((size_t)(buf_end - (*buf)) < 1) { - return LWMQTT_BUFFER_TOO_SHORT; - } - - // write byte - (*buf)[0] = byte; - - // adjust pointer - *buf += 1; - - return LWMQTT_SUCCESS; -} - -lwmqtt_err_t lwmqtt_varnum_length(uint32_t varnum, int *len) { - if (varnum < 128) { - *len = 1; - return LWMQTT_SUCCESS; - } else if (varnum < 16384) { - *len = 2; - return LWMQTT_SUCCESS; - } else if (varnum < 2097151) { - *len = 3; - return LWMQTT_SUCCESS; - } else if (varnum < 268435455) { - *len = 4; - return LWMQTT_SUCCESS; - } else { - *len = 0; - return LWMQTT_VARNUM_OVERFLOW; - } -} - -lwmqtt_err_t lwmqtt_read_varnum(uint8_t **buf, const uint8_t *buf_end, uint32_t *varnum) { - // prepare last byte - uint8_t byte; - - // prepare multiplier - uint32_t multiplier = 1; - - // prepare length - size_t len = 0; - - // initialize number - *varnum = 0; - - // decode variadic number - do { - // increment length - len++; - - // return error if buffer is to small - if ((size_t)(buf_end - (*buf)) < len) { - return LWMQTT_BUFFER_TOO_SHORT; - } - - // return error if the length has overflowed - if (len > 4) { - return LWMQTT_VARNUM_OVERFLOW; - } - - // read byte - byte = (*buf)[len - 1]; - - // add byte to number - *varnum += (byte & 127) * multiplier; - - // increase multiplier - multiplier *= 128; - } while ((byte & 128) != 0); - - // adjust pointer - *buf += len; - - return LWMQTT_SUCCESS; -} - -lwmqtt_err_t lwmqtt_write_varnum(uint8_t **buf, const uint8_t *buf_end, uint32_t varnum) { - // init len counter - size_t len = 0; - - // encode variadic number - do { - // check overflow - if (len == 4) { - return LWMQTT_VARNUM_OVERFLOW; - } - - // return error if buffer is to small - if ((size_t)(buf_end - (*buf)) < len + 1) { - return LWMQTT_BUFFER_TOO_SHORT; - } - - // calculate current byte - uint8_t byte = (uint8_t)(varnum % 128); - - // change remaining length - varnum /= 128; - - // set the top bit of this byte if there are more to encode - if (varnum > 0) { - byte |= 0x80; - } - - // write byte - (*buf)[len++] = byte; - } while (varnum > 0); - - // adjust pointer - *buf += len; - - return LWMQTT_SUCCESS; -} diff --git a/lib/arduino-mqtt-2.4.0/src/lwmqtt/helpers.h b/lib/arduino-mqtt-2.4.0/src/lwmqtt/helpers.h deleted file mode 100644 index 978eaf4a5..000000000 --- a/lib/arduino-mqtt-2.4.0/src/lwmqtt/helpers.h +++ /dev/null @@ -1,137 +0,0 @@ -#ifndef LWMQTT_HELPERS_H -#define LWMQTT_HELPERS_H - -#include "lwmqtt.h" - -/** - * Reads bits from a byte. - * - * @param byte - The byte to read from. - * @param pos - The position of the first bit. - * @param num - The number of bits to read. - * @return The read bits as a byte. - */ -uint8_t lwmqtt_read_bits(uint8_t byte, int pos, int num); - -/** - * Write bits to a byte. - * - * @param byte - The byte to write bits to. - * @param value - The bits to write as a byte. - * @param pos - The position of the first bit. - * @param num - The number of bits to write. - */ -void lwmqtt_write_bits(uint8_t *byte, uint8_t value, int pos, int num); - -/** - * Reads arbitrary data from the specified buffer. The pointer is incremented by bytes read. - * - * @param buf - Pointer to the buffer. - * @param buf_end - Pointer to the end of the buffer. - * @param data - Pointer to beginning of data. - * @param len - The amount of data to read. - * @return LWMQTT_SUCCESS or LWMQTT_BUFFER_TOO_SHORT. - */ -lwmqtt_err_t lwmqtt_read_data(uint8_t **buf, const uint8_t *buf_end, uint8_t **data, size_t len); - -/** - * Writes arbitrary data to the specified buffer. The pointer is incremented by the bytes written. - * - * @param buf - Pointer to the buffer. - * @param buf_end - Pointer to the end of the buffer. - * @param data - Pointer to the to be written data. - * @param len - The amount of data to write. - * @return LWMQTT_SUCCESS or LWMQTT_BUFFER_TOO_SHORT. - */ -lwmqtt_err_t lwmqtt_write_data(uint8_t **buf, const uint8_t *buf_end, uint8_t *data, size_t len); - -/** - * Reads two byte number from the specified buffer. The pointer is incremented by two. - * - * @param buf - Pointer to the buffer. - * @param buf_end - Pointer to the end of the buffer. - * @param num - The read number. - * @return LWMQTT_SUCCESS or LWMQTT_BUFFER_TOO_SHORT. - */ -lwmqtt_err_t lwmqtt_read_num(uint8_t **buf, const uint8_t *buf_end, uint16_t *num); - -/** - * Writes a two byte number to the specified buffer. The pointer is incremented by two. - * - * @param buf - Pointer to the buffer. - * @param buf_end - Pointer to the end of the buffer. - * @param num - The number to write. - * @return LWMQTT_SUCCESS or LWMQTT_BUFFER_TOO_SHORT. - */ -lwmqtt_err_t lwmqtt_write_num(uint8_t **buf, const uint8_t *buf_end, uint16_t num); - -/** - * Reads a string from the specified buffer into the passed object. The pointer is incremented by the bytes read. - * - * @param buf - Pointer to the buffer. - * @param buf_end - Pointer to the end of the buffer. - * @param str - The object into which the data is to be read. - * @return LWMQTT_SUCCESS or LWMQTT_BUFFER_TOO_SHORT. - */ -lwmqtt_err_t lwmqtt_read_string(uint8_t **buf, const uint8_t *buf_end, lwmqtt_string_t *str); - -/** - * Writes a string to the specified buffer. The pointer is incremented by the bytes written. - * - * @param buf - Pointer to the buffer. - * @param buf_end - Pointer to the end of the buffer. - * @param str - The string to write. - * @return LWMQTT_SUCCESS or LWMQTT_BUFFER_TOO_SHORT. - */ -lwmqtt_err_t lwmqtt_write_string(uint8_t **buf, const uint8_t *buf_end, lwmqtt_string_t str); - -/** - * Reads one byte from the buffer. The pointer is incremented by one. - * - * @param buf - Pointer to the buffer. - * @param buf_end - Pointer to the end of the buffer. - * @param byte - The read byte. - * @return LWMQTT_SUCCESS or LWMQTT_BUFFER_TOO_SHORT. - */ -lwmqtt_err_t lwmqtt_read_byte(uint8_t **buf, const uint8_t *buf_end, uint8_t *byte); - -/** - * Writes one byte to the specified buffer. The pointer is incremented by one. - * - * @param buf - Pointer to the buffer. - * @param buf_end - Pointer to the end of the buffer. - * @param byte - The byte to write. - * @return LWMQTT_SUCCESS or LWMQTT_BUFFER_TOO_SHORT. - */ -lwmqtt_err_t lwmqtt_write_byte(uint8_t **buf, const uint8_t *buf_end, uint8_t byte); - -/** - * Returns the amount of bytes required by the variable number. - * - * @param varnum - The number to check. - * @param len - The required length; - * @return LWMQTT_SUCCESS or LWMQTT_VARNUM_OVERFLOW. - */ -lwmqtt_err_t lwmqtt_varnum_length(uint32_t varnum, int *len); - -/** - * Reads a variable number from the specified buffer. The pointer is incremented by the bytes read. - * - * @param buf - Pointer to the buffer. - * @param buf_end - Pointer to the end of the buffer. - * @param varnum - The read varnum. - * @return LWMQTT_SUCCESS, LWMQTT_BUFFER_TOO_SHORT or LWMQTT_VARNUM_OVERFLOW. - */ -lwmqtt_err_t lwmqtt_read_varnum(uint8_t **buf, const uint8_t *buf_end, uint32_t *varnum); - -/** - * Writes a variable number to the specified buffer. The pointer is incremented by the bytes written. - * - * @param buf - Pointer to the buffer. - * @param buf_end - Pointer to the end of the buffer. - * @param varnum - The number to write. - * @return LWMQTT_SUCCESS, LWMQTT_BUFFER_TOO_SHORT or LWMQTT_VARNUM_OVERFLOW. - */ -lwmqtt_err_t lwmqtt_write_varnum(uint8_t **buf, const uint8_t *buf_end, uint32_t varnum); - -#endif diff --git a/lib/arduino-mqtt-2.4.0/src/lwmqtt/lwmqtt.h b/lib/arduino-mqtt-2.4.0/src/lwmqtt/lwmqtt.h deleted file mode 100644 index 7a7f142cc..000000000 --- a/lib/arduino-mqtt-2.4.0/src/lwmqtt/lwmqtt.h +++ /dev/null @@ -1,381 +0,0 @@ -#ifndef LWMQTT_H -#define LWMQTT_H - -#include -#include -#include - -/** - * The error type used by all exposed APIs. - * - * If a function returns an error that operates on a connected client (e.g publish, keep_alive, etc.) the caller should - * switch into a disconnected state, close and cleanup the current connection and start over by creating a new - * connection. - */ -typedef enum { - LWMQTT_SUCCESS = 0, - LWMQTT_BUFFER_TOO_SHORT = -1, - LWMQTT_VARNUM_OVERFLOW = -2, - LWMQTT_NETWORK_FAILED_CONNECT = -3, - LWMQTT_NETWORK_TIMEOUT = -4, - LWMQTT_NETWORK_FAILED_READ = -5, - LWMQTT_NETWORK_FAILED_WRITE = -6, - LWMQTT_REMAINING_LENGTH_OVERFLOW = -7, - LWMQTT_REMAINING_LENGTH_MISMATCH = -8, - LWMQTT_MISSING_OR_WRONG_PACKET = -9, - LWMQTT_CONNECTION_DENIED = -10, - LWMQTT_FAILED_SUBSCRIPTION = -11, - LWMQTT_SUBACK_ARRAY_OVERFLOW = -12, - LWMQTT_PONG_TIMEOUT = -13, -} lwmqtt_err_t; - -/** - * A common string object. - */ -typedef struct { - uint16_t len; - char *data; -} lwmqtt_string_t; - -/** - * The initializer for string objects. - */ -#define lwmqtt_default_string \ - { 0, NULL } - -/** - * Returns a string object for the passed C string. - * - * @param str - The C string. - * @return A string object. - */ -lwmqtt_string_t lwmqtt_string(const char *str); - -/** - * Compares a string object to a C string. - * - * @param a - The string object to compare. - * @param b - The C string to compare. - * @return Similarity e.g. strcmp(). - */ -int lwmqtt_strcmp(lwmqtt_string_t a, const char *b); - -/** - * The available QOS levels. - */ -typedef enum { LWMQTT_QOS0 = 0, LWMQTT_QOS1 = 1, LWMQTT_QOS2 = 2, LWMQTT_QOS_FAILURE = 128 } lwmqtt_qos_t; - -/** - * The message object used to publish and receive messages. - */ -typedef struct { - lwmqtt_qos_t qos; - bool retained; - uint8_t *payload; - size_t payload_len; -} lwmqtt_message_t; - -/** - * The initializer for message objects. - */ -#define lwmqtt_default_message \ - { LWMQTT_QOS0, false, NULL, 0 } - -/** - * Forward declaration of the client object. - */ -typedef struct lwmqtt_client_t lwmqtt_client_t; - -/** - * The callback used to read from a network object. - * - * The callbacks is expected to read up to the amount of bytes in to the passed buffer. It should block the specified - * timeout and wait for more incoming data. - * - * @param ref - A custom reference. - * @param buf - The buffer. - * @param len - The length of the buffer. - * @param read - Variable that must be set with the amount of read bytes. - * @param timeout - The timeout in milliseconds for the operation. - */ -typedef lwmqtt_err_t (*lwmqtt_network_read_t)(void *ref, uint8_t *buf, size_t len, size_t *read, uint32_t timeout); - -/** - * The callback used to write to a network object. - * - * The callback is expected to write up to the amount of bytes from the passed buffer. It should wait up to the - * specified timeout to write the specified data to the network. - * - * @param ref - A custom reference. - * @param buf - The buffer. - * @param len - The length of the buffer. - * @param sent - Variable that must be set with the amount of written bytes. - * @param timeout - The timeout in milliseconds for the operation. - */ -typedef lwmqtt_err_t (*lwmqtt_network_write_t)(void *ref, uint8_t *buf, size_t len, size_t *sent, uint32_t timeout); - -/** - * The callback used to set a timer. - * - * @param ref - A custom reference. - * @param timeout - The amount of milliseconds until the deadline. - */ -typedef void (*lwmqtt_timer_set_t)(void *ref, uint32_t timeout); - -/** - * The callback used to get a timers value. - * - * @param - A custom reference. - * @return The amount of milliseconds until the deadline. May return negative numbers if the deadline has been reached. - */ -typedef int32_t (*lwmqtt_timer_get_t)(void *ref); - -/** - * The callback used to forward incoming messages. - * - * Note: The callback is mostly executed because of a call to lwmqtt_yield() that processes incoming messages. However, - * it is possible that the callback is also executed during a call to lwmqtt_subscribe(), lwmqtt_publish() or - * lwmqtt_unsubscribe() if incoming messages are received between the required acknowledgements. It is therefore not - * recommended to call any further lwmqtt methods in the callback as this might result in weird call stacks. The - * callback should place the received messages in a queue and dispatch them after the caller has returned. - */ -typedef void (*lwmqtt_callback_t)(lwmqtt_client_t *client, void *ref, lwmqtt_string_t str, lwmqtt_message_t msg); - -/** - * The client object. - */ -struct lwmqtt_client_t { - uint16_t last_packet_id; - uint32_t keep_alive_interval; - bool pong_pending; - - size_t write_buf_size, read_buf_size; - uint8_t *write_buf, *read_buf; - - lwmqtt_callback_t callback; - void *callback_ref; - - void *network; - lwmqtt_network_read_t network_read; - lwmqtt_network_write_t network_write; - - void *keep_alive_timer; - void *command_timer; - lwmqtt_timer_set_t timer_set; - lwmqtt_timer_get_t timer_get; -}; - -/** - * Will initialize the specified client object. - * - * @param client - The client object. - * @param write_buf - The write buffer. - * @param write_buf_size - The write buffer size. - * @param read_buf - The read buffer. - * @param read_buf_size - The read buffer size. - */ -void lwmqtt_init(lwmqtt_client_t *client, uint8_t *write_buf, size_t write_buf_size, uint8_t *read_buf, - size_t read_buf_size); - -/** - * Will set the network reference and callbacks for this client object. - * - * @param client - The client object. - * @param ref - The reference to the network object. - * @param read - The read callback. - * @param write - The write callback. - */ -void lwmqtt_set_network(lwmqtt_client_t *client, void *ref, lwmqtt_network_read_t read, lwmqtt_network_write_t write); - -/** - * Will set the timer references and callbacks for this client object. - * - * @param client - The client object. - * @param keep_alive_timer - The reference to the keep alive timer. - * @param command_timer - The reference to the command timer. - * @param set - The set callback. - * @param get - The get callback. - */ -void lwmqtt_set_timers(lwmqtt_client_t *client, void *keep_alive_timer, void *command_timer, lwmqtt_timer_set_t set, - lwmqtt_timer_get_t get); - -/** - * Will set the callback used to receive incoming messages. - * - * @param client - The client object. - * @param ref - A custom reference that will passed to the callback. - * @param cb - The callback to be called. - */ -void lwmqtt_set_callback(lwmqtt_client_t *client, void *ref, lwmqtt_callback_t cb); - -/** - * The object defining the last will of a client. - */ -typedef struct { - lwmqtt_string_t topic; - lwmqtt_qos_t qos; - bool retained; - lwmqtt_string_t payload; -} lwmqtt_will_t; - -/** - * The default initializer for the will object. - */ -#define lwmqtt_default_will \ - { lwmqtt_default_string, LWMQTT_QOS0, false, lwmqtt_default_string } - -/** - * The object containing the connection options for a client. - */ -typedef struct { - lwmqtt_string_t client_id; - uint16_t keep_alive; - bool clean_session; - lwmqtt_string_t username; - lwmqtt_string_t password; -} lwmqtt_options_t; - -/** - * The default initializer for the options object. - */ -#define lwmqtt_default_options \ - { lwmqtt_default_string, 60, true, lwmqtt_default_string, lwmqtt_default_string } - -/** - * The available return codes transported by the connack packet. - */ -typedef enum { - LWMQTT_CONNECTION_ACCEPTED = 0, - LWMQTT_UNACCEPTABLE_PROTOCOL = 1, - LWMQTT_IDENTIFIER_REJECTED = 2, - LWMQTT_SERVER_UNAVAILABLE = 3, - LWMQTT_BAD_USERNAME_OR_PASSWORD = 4, - LWMQTT_NOT_AUTHORIZED = 5, - LWMQTT_UNKNOWN_RETURN_CODE = 6 -} lwmqtt_return_code_t; - -/** - * Will send a connect packet and wait for a connack response and set the return code. - * - * The network object must already be connected to the server. An error is returned if the broker rejects the - * connection. - * - * @param client - The client object. - * @param options - The options object. - * @param will - The will object. - * @param return_code - The variable that will receive the return code. - * @param timeout - The command timeout. - * @return An error value. - */ -lwmqtt_err_t lwmqtt_connect(lwmqtt_client_t *client, lwmqtt_options_t options, lwmqtt_will_t *will, - lwmqtt_return_code_t *return_code, uint32_t timeout); - -/** - * Will send a publish packet and wait for all acks to complete. - * - * Note: The message callback might be called with incoming messages as part of this call. - * - * @param client - The client object. - * @param topic - The topic. - * @param message - The message. - * @param timeout - The command timeout. - * @return An error value. - */ -lwmqtt_err_t lwmqtt_publish(lwmqtt_client_t *client, lwmqtt_string_t topic, lwmqtt_message_t msg, uint32_t timeout); - -/** - * Will send a subscribe packet with multiple topic filters plus QOS levels and wait for the suback to complete. - * - * Note: The message callback might be called with incoming messages as part of this call. - * - * @param client - The client object. - * @param count - The number of topic filters and QOS levels. - * @param topic_filter - The list of topic filters. - * @param qos - The list of QOS levels. - * @param timeout - The command timeout. - * @return An error value. - */ -lwmqtt_err_t lwmqtt_subscribe(lwmqtt_client_t *client, int count, lwmqtt_string_t *topic_filter, lwmqtt_qos_t *qos, - uint32_t timeout); - -/** - * Will send a subscribe packet with a single topic filter plus QOS level and wait for the suback to complete. - * - * Note: The message callback might be called with incoming messages as part of this call. - * - * @param client - The client object. - * @param topic_filter - The topic filter. - * @param qos - The QOS level. - * @param timeout - The command timeout. - * @return An error value. - */ -lwmqtt_err_t lwmqtt_subscribe_one(lwmqtt_client_t *client, lwmqtt_string_t topic_filter, lwmqtt_qos_t qos, - uint32_t timeout); - -/** - * Will send an unsubscribe packet with multiple topic filters and wait for the unsuback to complete. - * - * Note: The message callback might be called with incoming messages as part of this call. - * - * @param client - The client object. - * @param count - The number of topic filters. - * @param topic_filter - The topic filter. - * @param timeout - The command timeout. - * @return An error value. - */ -lwmqtt_err_t lwmqtt_unsubscribe(lwmqtt_client_t *client, int count, lwmqtt_string_t *topic_filter, uint32_t timeout); - -/** - * Will send an unsubscribe packet with a single topic filter and wait for the unsuback to complete. - * - * Note: The message callback might be called with incoming messages as part of this call. - * - * @param client - The client object. - * @param topic_filter - The topic filter. - * @param timeout - The command timeout. - * @return An error value. - */ -lwmqtt_err_t lwmqtt_unsubscribe_one(lwmqtt_client_t *client, lwmqtt_string_t topic_filter, uint32_t timeout); - -/** - * Will send a disconnect packet and finish the client. - * - * @param client - The client object. - * @param timeout - The command timeout. - * @return An error value. - */ -lwmqtt_err_t lwmqtt_disconnect(lwmqtt_client_t *client, uint32_t timeout); - -/** - * Will yield control to the client and receive incoming packets from the network. - * - * Single-threaded applications may peek on the network and assess if data is available to read before calling yield and - * potentially block until the timeout is reached. Multi-threaded applications may select on the socket and block until - * data is available and then yield to the client if data is available. All applications may specify the amount of bytes - * available to read in order to constrain the yield to only receive packets that are already in-flight. - * - * If no availability info is given the yield will return after one packet has been successfully read or the deadline - * has been reached but no single bytes has been received. - * - * Note: The message callback might be called with incoming messages as part of this call. - * - * @param client - The client object. - * @param available - The available bytes to read. - * @param timeout - The command timeout. - * @return An error value. - */ -lwmqtt_err_t lwmqtt_yield(lwmqtt_client_t *client, size_t available, uint32_t timeout); - -/** - * Will yield control to the client to keep the connection alive. - * - * This functions must be called at a rate slightly lower than 25% of the configured keep alive. If keep alive is zero, - * the function must not be called at all. - * - * @param client - The client object. - * @param timeout - The command timeout. - * @return An error value. - */ -lwmqtt_err_t lwmqtt_keep_alive(lwmqtt_client_t *client, uint32_t timeout); - -#endif // LWMQTT_H diff --git a/lib/arduino-mqtt-2.4.0/src/lwmqtt/packet.c b/lib/arduino-mqtt-2.4.0/src/lwmqtt/packet.c deleted file mode 100644 index 512b44d94..000000000 --- a/lib/arduino-mqtt-2.4.0/src/lwmqtt/packet.c +++ /dev/null @@ -1,742 +0,0 @@ -#include "packet.h" - -lwmqtt_err_t lwmqtt_detect_packet_type(uint8_t *buf, size_t buf_len, lwmqtt_packet_type_t *packet_type) { - // set default packet type - *packet_type = LWMQTT_NO_PACKET; - - // prepare pointer - uint8_t *buf_ptr = buf; - uint8_t *buf_end = buf + buf_len; - - // prepare header - uint8_t header; - - // read header - lwmqtt_err_t err = lwmqtt_read_byte(&buf_ptr, buf_end, &header); - if (err != LWMQTT_SUCCESS) { - return err; - } - - // get packet type - *packet_type = (lwmqtt_packet_type_t)lwmqtt_read_bits(header, 4, 4); - - // check if packet type is correct and can be received - switch (*packet_type) { - case LWMQTT_CONNACK_PACKET: - case LWMQTT_PUBLISH_PACKET: - case LWMQTT_PUBACK_PACKET: - case LWMQTT_PUBREC_PACKET: - case LWMQTT_PUBREL_PACKET: - case LWMQTT_PUBCOMP_PACKET: - case LWMQTT_SUBACK_PACKET: - case LWMQTT_UNSUBACK_PACKET: - case LWMQTT_PINGRESP_PACKET: - return LWMQTT_SUCCESS; - default: - *packet_type = LWMQTT_NO_PACKET; - return LWMQTT_MISSING_OR_WRONG_PACKET; - } -} - -lwmqtt_err_t lwmqtt_detect_remaining_length(uint8_t *buf, size_t buf_len, uint32_t *rem_len) { - // prepare pointer - uint8_t *ptr = buf; - - // attempt to decode remaining length - lwmqtt_err_t err = lwmqtt_read_varnum(&ptr, buf + buf_len, rem_len); - if (err == LWMQTT_VARNUM_OVERFLOW) { - *rem_len = 0; - return LWMQTT_REMAINING_LENGTH_OVERFLOW; - } else if (err != LWMQTT_SUCCESS) { - *rem_len = 0; - return err; - } - - return LWMQTT_SUCCESS; -} - -lwmqtt_err_t lwmqtt_encode_connect(uint8_t *buf, size_t buf_len, size_t *len, lwmqtt_options_t options, - lwmqtt_will_t *will) { - // prepare pointers - uint8_t *buf_ptr = buf; - uint8_t *buf_end = buf + buf_len; - - // fixed header is 10 - uint32_t rem_len = 10; - - // add client id to remaining length - rem_len += options.client_id.len + 2; - - // add will if present to remaining length - if (will != NULL) { - rem_len += will->topic.len + 2 + will->payload.len + 2; - } - - // add username if present to remaining length - if (options.username.len > 0) { - rem_len += options.username.len + 2; - - // add password if present to remaining length - if (options.password.len > 0) { - rem_len += options.password.len + 2; - } - } - - // check remaining length length - int rem_len_len; - lwmqtt_err_t err = lwmqtt_varnum_length(rem_len, &rem_len_len); - if (err == LWMQTT_VARNUM_OVERFLOW) { - return LWMQTT_REMAINING_LENGTH_OVERFLOW; - } - - // prepare header - uint8_t header = 0; - lwmqtt_write_bits(&header, LWMQTT_CONNECT_PACKET, 4, 4); - - // write header - err = lwmqtt_write_byte(&buf_ptr, buf_end, header); - if (err != LWMQTT_SUCCESS) { - return err; - } - - // write remaining length - err = lwmqtt_write_varnum(&buf_ptr, buf_end, rem_len); - if (err != LWMQTT_SUCCESS) { - return err; - } - - // write version string - err = lwmqtt_write_string(&buf_ptr, buf_end, lwmqtt_string("MQTT")); - if (err != LWMQTT_SUCCESS) { - return err; - } - - // write version number - err = lwmqtt_write_byte(&buf_ptr, buf_end, 4); - if (err != LWMQTT_SUCCESS) { - return err; - } - - // prepare flags - uint8_t flags = 0; - - // set clean session - lwmqtt_write_bits(&flags, (uint8_t)(options.clean_session), 1, 1); - - // set will flags if present - if (will != NULL) { - lwmqtt_write_bits(&flags, 1, 2, 1); - lwmqtt_write_bits(&flags, will->qos, 3, 2); - lwmqtt_write_bits(&flags, (uint8_t)(will->retained), 5, 1); - } - - // set username flag if present - if (options.username.len > 0) { - lwmqtt_write_bits(&flags, 1, 7, 1); - - // set password flag if present - if (options.password.len > 0) { - lwmqtt_write_bits(&flags, 1, 6, 1); - } - } - - // write flags - err = lwmqtt_write_byte(&buf_ptr, buf_end, flags); - if (err != LWMQTT_SUCCESS) { - return err; - } - - // write keep alive - err = lwmqtt_write_num(&buf_ptr, buf_end, options.keep_alive); - if (err != LWMQTT_SUCCESS) { - return err; - } - - // write client id - err = lwmqtt_write_string(&buf_ptr, buf_end, options.client_id); - if (err != LWMQTT_SUCCESS) { - return err; - } - - // write will if present - if (will != NULL) { - // write topic - err = lwmqtt_write_string(&buf_ptr, buf_end, will->topic); - if (err != LWMQTT_SUCCESS) { - return err; - } - - // write payload length - err = lwmqtt_write_num(&buf_ptr, buf_end, (uint16_t)will->payload.len); - if (err != LWMQTT_SUCCESS) { - return err; - } - - // write payload - err = lwmqtt_write_data(&buf_ptr, buf_end, (uint8_t *)will->payload.data, will->payload.len); - if (err != LWMQTT_SUCCESS) { - return err; - } - } - - // write username if present - if (options.username.len > 0) { - err = lwmqtt_write_string(&buf_ptr, buf_end, options.username); - if (err != LWMQTT_SUCCESS) { - return err; - } - } - - // write password if present - if (options.username.len > 0 && options.password.len > 0) { - err = lwmqtt_write_string(&buf_ptr, buf_end, options.password); - if (err != LWMQTT_SUCCESS) { - return err; - } - } - - // set written length - *len = buf_ptr - buf; - - return LWMQTT_SUCCESS; -} - -lwmqtt_err_t lwmqtt_decode_connack(uint8_t *buf, size_t buf_len, bool *session_present, - lwmqtt_return_code_t *return_code) { - // prepare pointers - uint8_t *buf_ptr = buf; - uint8_t *buf_end = buf + buf_len; - - // read header - uint8_t header; - lwmqtt_err_t err = lwmqtt_read_byte(&buf_ptr, buf_end, &header); - if (err != LWMQTT_SUCCESS) { - return err; - } - - // check packet type - if (lwmqtt_read_bits(header, 4, 4) != LWMQTT_CONNACK_PACKET) { - return LWMQTT_MISSING_OR_WRONG_PACKET; - } - - // read remaining length - uint32_t rem_len; - err = lwmqtt_read_varnum(&buf_ptr, buf_end, &rem_len); - if (err != LWMQTT_SUCCESS) { - return err; - } - - // check remaining length - if (rem_len != 2) { - return LWMQTT_REMAINING_LENGTH_MISMATCH; - } - - // read flags - uint8_t flags; - err = lwmqtt_read_byte(&buf_ptr, buf_end, &flags); - if (err != LWMQTT_SUCCESS) { - return err; - } - - // read return code - uint8_t raw_return_code; - err = lwmqtt_read_byte(&buf_ptr, buf_end, &raw_return_code); - if (err != LWMQTT_SUCCESS) { - return err; - } - - // get session present - *session_present = lwmqtt_read_bits(flags, 7, 1) == 1; - - // get return code - switch (raw_return_code) { - case 0: - *return_code = LWMQTT_CONNECTION_ACCEPTED; - break; - case 1: - *return_code = LWMQTT_UNACCEPTABLE_PROTOCOL; - break; - case 2: - *return_code = LWMQTT_IDENTIFIER_REJECTED; - break; - case 3: - *return_code = LWMQTT_SERVER_UNAVAILABLE; - break; - case 4: - *return_code = LWMQTT_BAD_USERNAME_OR_PASSWORD; - break; - case 5: - *return_code = LWMQTT_NOT_AUTHORIZED; - break; - default: - *return_code = LWMQTT_UNKNOWN_RETURN_CODE; - } - - return LWMQTT_SUCCESS; -} - -lwmqtt_err_t lwmqtt_encode_zero(uint8_t *buf, size_t buf_len, size_t *len, lwmqtt_packet_type_t packet_type) { - // prepare pointer - uint8_t *buf_ptr = buf; - uint8_t *buf_end = buf + buf_len; - - // write header - uint8_t header = 0; - lwmqtt_write_bits(&header, packet_type, 4, 4); - lwmqtt_err_t err = lwmqtt_write_byte(&buf_ptr, buf_end, header); - if (err != LWMQTT_SUCCESS) { - return err; - } - - // write remaining length - err = lwmqtt_write_varnum(&buf_ptr, buf_end, 0); - if (err != LWMQTT_SUCCESS) { - return err; - } - - // set length - *len = buf_ptr - buf; - - return LWMQTT_SUCCESS; -} - -lwmqtt_err_t lwmqtt_decode_ack(uint8_t *buf, size_t buf_len, lwmqtt_packet_type_t packet_type, bool *dup, - uint16_t *packet_id) { - // prepare pointer - uint8_t *buf_ptr = buf; - uint8_t *buf_end = buf + buf_len; - - // read header - uint8_t header = 0; - lwmqtt_err_t err = lwmqtt_read_byte(&buf_ptr, buf_end, &header); - if (err != LWMQTT_SUCCESS) { - return err; - } - - // check packet type - if (lwmqtt_read_bits(header, 4, 4) != packet_type) { - return LWMQTT_MISSING_OR_WRONG_PACKET; - } - - // get dup - *dup = lwmqtt_read_bits(header, 3, 1) == 1; - - // read remaining length - uint32_t rem_len; - err = lwmqtt_read_varnum(&buf_ptr, buf + buf_len, &rem_len); - if (err != LWMQTT_SUCCESS) { - return err; - } - - // check remaining length - if (rem_len != 2) { - return LWMQTT_REMAINING_LENGTH_MISMATCH; - } - - // read packet id - err = lwmqtt_read_num(&buf_ptr, buf_end, packet_id); - if (err != LWMQTT_SUCCESS) { - return err; - } - - return LWMQTT_SUCCESS; -} - -lwmqtt_err_t lwmqtt_encode_ack(uint8_t *buf, size_t buf_len, size_t *len, lwmqtt_packet_type_t packet_type, bool dup, - uint16_t packet_id) { - // prepare pointer - uint8_t *buf_ptr = buf; - uint8_t *buf_end = buf + buf_len; - - // prepare header - uint8_t header = 0; - - // set packet type - lwmqtt_write_bits(&header, packet_type, 4, 4); - - // set dup - lwmqtt_write_bits(&header, (uint8_t)(dup), 3, 1); - - // set qos - lwmqtt_write_bits(&header, (uint8_t)(packet_type == LWMQTT_PUBREL_PACKET ? LWMQTT_QOS1 : LWMQTT_QOS0), 1, 2); - - // write header - lwmqtt_err_t err = lwmqtt_write_byte(&buf_ptr, buf_end, header); - if (err != LWMQTT_SUCCESS) { - return err; - } - - // write remaining length - err = lwmqtt_write_varnum(&buf_ptr, buf_end, 2); - if (err != LWMQTT_SUCCESS) { - return err; - } - - // write packet id - err = lwmqtt_write_num(&buf_ptr, buf_end, packet_id); - if (err != LWMQTT_SUCCESS) { - return err; - } - - // set written length - *len = buf_ptr - buf; - - return LWMQTT_SUCCESS; -} - -lwmqtt_err_t lwmqtt_decode_publish(uint8_t *buf, size_t buf_len, bool *dup, uint16_t *packet_id, lwmqtt_string_t *topic, - lwmqtt_message_t *msg) { - // prepare pointer - uint8_t *buf_ptr = buf; - uint8_t *buf_end = buf + buf_len; - - // read header - uint8_t header; - lwmqtt_err_t err = lwmqtt_read_byte(&buf_ptr, buf_end, &header); - if (err != LWMQTT_SUCCESS) { - return err; - } - - // check packet type - if (lwmqtt_read_bits(header, 4, 4) != LWMQTT_PUBLISH_PACKET) { - return LWMQTT_MISSING_OR_WRONG_PACKET; - } - - // get dup - *dup = lwmqtt_read_bits(header, 3, 1) == 1; - - // get retained - msg->retained = lwmqtt_read_bits(header, 0, 1) == 1; - - // get qos - switch (lwmqtt_read_bits(header, 1, 2)) { - case 0: - msg->qos = LWMQTT_QOS0; - break; - case 1: - msg->qos = LWMQTT_QOS1; - break; - case 2: - msg->qos = LWMQTT_QOS2; - break; - default: - msg->qos = LWMQTT_QOS0; - break; - } - - // read remaining length - uint32_t rem_len; - err = lwmqtt_read_varnum(&buf_ptr, buf_end, &rem_len); - if (err != LWMQTT_SUCCESS) { - return err; - } - - // check remaining length (topic length) - if (rem_len < 2) { - return LWMQTT_REMAINING_LENGTH_MISMATCH; - } - - // check buffer capacity - if ((uint32_t)(buf_end - buf_ptr) < rem_len) { - return LWMQTT_BUFFER_TOO_SHORT; - } - - // reset buf end - buf_end = buf_ptr + rem_len; - - // read topic - err = lwmqtt_read_string(&buf_ptr, buf_end, topic); - if (err != LWMQTT_SUCCESS) { - return err; - } - - // read packet id if qos is at least 1 - if (msg->qos > 0) { - err = lwmqtt_read_num(&buf_ptr, buf_end, packet_id); - if (err != LWMQTT_SUCCESS) { - return err; - } - } else { - *packet_id = 0; - } - - // set payload length - msg->payload_len = buf_end - buf_ptr; - - // read payload - err = lwmqtt_read_data(&buf_ptr, buf_end, &msg->payload, buf_end - buf_ptr); - if (err != LWMQTT_SUCCESS) { - return err; - } - - return LWMQTT_SUCCESS; -} - -lwmqtt_err_t lwmqtt_encode_publish(uint8_t *buf, size_t buf_len, size_t *len, bool dup, uint16_t packet_id, - lwmqtt_string_t topic, lwmqtt_message_t msg) { - // prepare pointer - uint8_t *buf_ptr = buf; - uint8_t *buf_end = buf + buf_len; - - // calculate remaining length - uint32_t rem_len = 2 + topic.len + (uint32_t)msg.payload_len; - if (msg.qos > 0) { - rem_len += 2; - } - - // check remaining length length - int rem_len_len; - lwmqtt_err_t err = lwmqtt_varnum_length(rem_len, &rem_len_len); - if (err == LWMQTT_VARNUM_OVERFLOW) { - return LWMQTT_REMAINING_LENGTH_OVERFLOW; - } - - // prepare header - uint8_t header = 0; - - // set packet type - lwmqtt_write_bits(&header, LWMQTT_PUBLISH_PACKET, 4, 4); - - // set dup - lwmqtt_write_bits(&header, (uint8_t)(dup), 3, 1); - - // set qos - lwmqtt_write_bits(&header, msg.qos, 1, 2); - - // set retained - lwmqtt_write_bits(&header, (uint8_t)(msg.retained), 0, 1); - - // write header - err = lwmqtt_write_byte(&buf_ptr, buf_end, header); - if (err != LWMQTT_SUCCESS) { - return err; - } - - // write remaining length - err = lwmqtt_write_varnum(&buf_ptr, buf_end, rem_len); - if (err != LWMQTT_SUCCESS) { - return err; - } - - // write topic - err = lwmqtt_write_string(&buf_ptr, buf_end, topic); - if (err != LWMQTT_SUCCESS) { - return err; - } - - // write packet id if qos is at least 1 - if (msg.qos > 0) { - err = lwmqtt_write_num(&buf_ptr, buf_end, packet_id); - if (err != LWMQTT_SUCCESS) { - return err; - } - } - - // write payload - err = lwmqtt_write_data(&buf_ptr, buf_end, msg.payload, msg.payload_len); - if (err != LWMQTT_SUCCESS) { - return err; - } - - // set length - *len = buf_ptr - buf; - - return LWMQTT_SUCCESS; -} - -lwmqtt_err_t lwmqtt_encode_subscribe(uint8_t *buf, size_t buf_len, size_t *len, uint16_t packet_id, int count, - lwmqtt_string_t *topic_filters, lwmqtt_qos_t *qos_levels) { - // prepare pointer - uint8_t *buf_ptr = buf; - uint8_t *buf_end = buf + buf_len; - - // calculate remaining length - uint32_t rem_len = 2; - for (int i = 0; i < count; i++) { - rem_len += 2 + topic_filters[i].len + 1; - } - - // check remaining length length - int rem_len_len; - lwmqtt_err_t err = lwmqtt_varnum_length(rem_len, &rem_len_len); - if (err == LWMQTT_VARNUM_OVERFLOW) { - return LWMQTT_REMAINING_LENGTH_OVERFLOW; - } - - // prepare header - uint8_t header = 0; - - // set packet type - lwmqtt_write_bits(&header, LWMQTT_SUBSCRIBE_PACKET, 4, 4); - - // set qos - lwmqtt_write_bits(&header, LWMQTT_QOS1, 1, 2); - - // write header - err = lwmqtt_write_byte(&buf_ptr, buf_end, header); - if (err != LWMQTT_SUCCESS) { - return err; - } - - // write remaining length - err = lwmqtt_write_varnum(&buf_ptr, buf_end, rem_len); - if (err != LWMQTT_SUCCESS) { - return err; - } - - // write packet id - err = lwmqtt_write_num(&buf_ptr, buf_end, packet_id); - if (err != LWMQTT_SUCCESS) { - return err; - } - - // write all subscriptions - for (int i = 0; i < count; i++) { - // write topic - err = lwmqtt_write_string(&buf_ptr, buf_end, topic_filters[i]); - if (err != LWMQTT_SUCCESS) { - return err; - } - - // write qos level - err = lwmqtt_write_byte(&buf_ptr, buf_end, (uint8_t)qos_levels[i]); - if (err != LWMQTT_SUCCESS) { - return err; - } - } - - // set length - *len = buf_ptr - buf; - - return LWMQTT_SUCCESS; -} - -lwmqtt_err_t lwmqtt_decode_suback(uint8_t *buf, size_t buf_len, uint16_t *packet_id, int max_count, int *count, - lwmqtt_qos_t *granted_qos_levels) { - // prepare pointer - uint8_t *buf_ptr = buf; - uint8_t *buf_end = buf + buf_len; - - // read header - uint8_t header; - lwmqtt_err_t err = lwmqtt_read_byte(&buf_ptr, buf_end, &header); - if (err != LWMQTT_SUCCESS) { - return err; - } - - // check packet type - if (lwmqtt_read_bits(header, 4, 4) != LWMQTT_SUBACK_PACKET) { - return LWMQTT_MISSING_OR_WRONG_PACKET; - } - - // read remaining length - uint32_t rem_len; - err = lwmqtt_read_varnum(&buf_ptr, buf_end, &rem_len); - if (err != LWMQTT_SUCCESS) { - return err; - } - - // check remaining length (packet id + min. one suback code) - if (rem_len < 3) { - return LWMQTT_REMAINING_LENGTH_MISMATCH; - } - - // read packet id - err = lwmqtt_read_num(&buf_ptr, buf_end, packet_id); - if (err != LWMQTT_SUCCESS) { - return err; - } - - // read all suback codes - for (*count = 0; *count < (int)rem_len - 2; (*count)++) { - // check max count - if (*count > max_count) { - return LWMQTT_SUBACK_ARRAY_OVERFLOW; - } - - // read qos level - uint8_t raw_qos_level; - err = lwmqtt_read_byte(&buf_ptr, buf_end, &raw_qos_level); - if (err != LWMQTT_SUCCESS) { - return err; - } - - // set qos level - switch (raw_qos_level) { - case 0: - granted_qos_levels[*count] = LWMQTT_QOS0; - break; - case 1: - granted_qos_levels[*count] = LWMQTT_QOS1; - break; - case 2: - granted_qos_levels[*count] = LWMQTT_QOS2; - break; - default: - granted_qos_levels[*count] = LWMQTT_QOS_FAILURE; - break; - } - } - - return LWMQTT_SUCCESS; -} - -lwmqtt_err_t lwmqtt_encode_unsubscribe(uint8_t *buf, size_t buf_len, size_t *len, uint16_t packet_id, int count, - lwmqtt_string_t *topic_filters) { - // prepare pointer - uint8_t *buf_ptr = buf; - uint8_t *buf_end = buf + buf_len; - - // calculate remaining length - uint32_t rem_len = 2; - for (int i = 0; i < count; i++) { - rem_len += 2 + topic_filters[i].len; - } - - // check remaining length length - int rem_len_len; - lwmqtt_err_t err = lwmqtt_varnum_length(rem_len, &rem_len_len); - if (err == LWMQTT_VARNUM_OVERFLOW) { - return LWMQTT_REMAINING_LENGTH_OVERFLOW; - } - - // prepare header - uint8_t header = 0; - - // set packet type - lwmqtt_write_bits(&header, LWMQTT_UNSUBSCRIBE_PACKET, 4, 4); - - // set qos - lwmqtt_write_bits(&header, LWMQTT_QOS1, 1, 2); - - // write header - err = lwmqtt_write_byte(&buf_ptr, buf_end, header); - if (err != LWMQTT_SUCCESS) { - return err; - } - - // write remaining length - err = lwmqtt_write_varnum(&buf_ptr, buf_end, rem_len); - if (err != LWMQTT_SUCCESS) { - return err; - } - - // write packet id - err = lwmqtt_write_num(&buf_ptr, buf_end, packet_id); - if (err != LWMQTT_SUCCESS) { - return err; - } - - // write topics - for (int i = 0; i < count; i++) { - err = lwmqtt_write_string(&buf_ptr, buf_end, topic_filters[i]); - if (err != LWMQTT_SUCCESS) { - return err; - } - } - - // set length - *len = buf_ptr - buf; - - return LWMQTT_SUCCESS; -} diff --git a/lib/arduino-mqtt-2.4.0/src/lwmqtt/packet.h b/lib/arduino-mqtt-2.4.0/src/lwmqtt/packet.h deleted file mode 100644 index 5fe9e50f1..000000000 --- a/lib/arduino-mqtt-2.4.0/src/lwmqtt/packet.h +++ /dev/null @@ -1,185 +0,0 @@ -#ifndef LWMQTT_PACKET_H -#define LWMQTT_PACKET_H - -#include "helpers.h" - -/** - * The available packet types. - */ -typedef enum { - LWMQTT_NO_PACKET = 0, - LWMQTT_CONNECT_PACKET = 1, - LWMQTT_CONNACK_PACKET, - LWMQTT_PUBLISH_PACKET, - LWMQTT_PUBACK_PACKET, - LWMQTT_PUBREC_PACKET, - LWMQTT_PUBREL_PACKET, - LWMQTT_PUBCOMP_PACKET, - LWMQTT_SUBSCRIBE_PACKET, - LWMQTT_SUBACK_PACKET, - LWMQTT_UNSUBSCRIBE_PACKET, - LWMQTT_UNSUBACK_PACKET, - LWMQTT_PINGREQ_PACKET, - LWMQTT_PINGRESP_PACKET, - LWMQTT_DISCONNECT_PACKET -} lwmqtt_packet_type_t; - -/** - * Will detect the packet type from the at least one byte long buffer. - * - * @param buf - The buffer from which the packet type will be detected. - * @param buf_len - The length of the specified buffer. - * @param packet_type - The packet type. - * @return An error value. - */ -lwmqtt_err_t lwmqtt_detect_packet_type(uint8_t *buf, size_t buf_len, lwmqtt_packet_type_t *packet_type); - -/** - * Will detect the remaining length form the at least on byte long buffer. - * - * It will return LWMQTT_BUFFER_TOO_SHORT if the buffer is to short and an additional byte should be read from the - * network. In case the remaining length is overflowed it will return LWMQTT_REMAINING_LENGTH_OVERFLOW. - * - * @param buf - The buffer from which the remaining length will be detected. - * @param buf_len - The length of the specified buffer. - * @param rem_len - The detected remaining length. - * @return An error value. - */ -lwmqtt_err_t lwmqtt_detect_remaining_length(uint8_t *buf, size_t buf_len, uint32_t *rem_len); - -/** - * Encodes a connect packet into the supplied buffer. - * - * @param buf - The buffer into which the packet will be encoded. - * @param buf_len - The length of the specified buffer. - * @param len - The encoded length of the packet. - * @param options - The options to be used to build the connect packet. - * @param will - The last will and testament. - * @return An error value. - */ -lwmqtt_err_t lwmqtt_encode_connect(uint8_t *buf, size_t buf_len, size_t *len, lwmqtt_options_t options, - lwmqtt_will_t *will); - -/** - * Decodes a connack packet from the supplied buffer. - * - * @param buf - The raw buffer data. - * @param buf_len - The length of the specified buffer. - * @param session_present - The session present flag. - * @param return_code - The return code. - * @return An error value. - */ -lwmqtt_err_t lwmqtt_decode_connack(uint8_t *buf, size_t buf_len, bool *session_present, - lwmqtt_return_code_t *return_code); - -/** - * Encodes a zero (disconnect, pingreq) packet into the supplied buffer. - * - * @param buf - The buffer into which the packet will be encoded. - * @param buf_len - The length of the specified buffer. - * @param len - The encoded length of the packet. - * @param packet_type - The packets type. - * @return An error value. - */ -lwmqtt_err_t lwmqtt_encode_zero(uint8_t *buf, size_t buf_len, size_t *len, lwmqtt_packet_type_t packet_type); - -/** - * Decodes an ack (puback, pubrec, pubrel, pubcomp, unsuback) packet from the supplied buffer. - * - * @param buf - The raw buffer data. - * @param buf_len - The length of the specified buffer. - * @param packet_type - The packet type. - * @param dup - The dup flag. - * @param packet_id - The packet id. - * @return An error value. - */ -lwmqtt_err_t lwmqtt_decode_ack(uint8_t *buf, size_t buf_len, lwmqtt_packet_type_t packet_type, bool *dup, - uint16_t *packet_id); - -/** - * Encodes an ack (puback, pubrec, pubrel, pubcomp) packet into the supplied buffer. - * - * @param buf - The buffer into which the packet will be encoded. - * @param buf_len - The length of the specified buffer. - * @param len - The encoded length of the packet. - * @param packet_type - The packets type. - * @param dup - The dup flag. - * @param packet_id - The packet id. - * @return An error value. - */ -lwmqtt_err_t lwmqtt_encode_ack(uint8_t *buf, size_t buf_len, size_t *len, lwmqtt_packet_type_t packet_type, bool dup, - uint16_t packet_id); - -/** - * Decodes a publish packet from the supplied buffer. - * - * @param buf - The raw buffer data. - * @param buf_len - The length of the specified buffer. - * @param dup - The dup flag. - * @param packet_id - The packet id. - * @param topic - The topic. - * @parma msg - The message. - * @return An error value. - */ -lwmqtt_err_t lwmqtt_decode_publish(uint8_t *buf, size_t buf_len, bool *dup, uint16_t *packet_id, lwmqtt_string_t *topic, - lwmqtt_message_t *msg); - -/** - * Encodes a publish packet into the supplied buffer. - * - * @param buf - The buffer into which the packet will be encoded. - * @param buf_len - The length of the specified buffer. - * @param len - The encoded length of the packet. - * @param dup - The dup flag. - * @param packet_id - The packet id. - * @param topic - The topic. - * @param msg - The message. - * @return An error value. - */ -lwmqtt_err_t lwmqtt_encode_publish(uint8_t *buf, size_t buf_len, size_t *len, bool dup, uint16_t packet_id, - lwmqtt_string_t topic, lwmqtt_message_t msg); - -/** - * Encodes a subscribe packet into the supplied buffer. - * - * @param buf - The buffer into which the packet will be encoded. - * @param buf_len - The length of the specified buffer. - * @param len - The encoded length of the packet. - * @param packet_id - The packet id. - * @param count - The number of members in the topic_filters and qos_levels array. - * @param topic_filters - The array of topic filter. - * @param qos_levels - The array of requested QoS levels. - * @return An error value. - */ -lwmqtt_err_t lwmqtt_encode_subscribe(uint8_t *buf, size_t buf_len, size_t *len, uint16_t packet_id, int count, - lwmqtt_string_t *topic_filters, lwmqtt_qos_t *qos_levels); - -/** - * Decodes a suback packet from the supplied buffer. - * - * @param buf - The raw buffer data. - * @param buf_len - The length of the specified buffer. - * @param packet_id - The packet id. - * @param max_count - The maximum number of members allowed in the granted_qos_levels array. - * @param count - The number of members in the granted_qos_levels array. - * @param granted_qos_levels - The granted QoS levels. - * @return An error value. - */ -lwmqtt_err_t lwmqtt_decode_suback(uint8_t *buf, size_t buf_len, uint16_t *packet_id, int max_count, int *count, - lwmqtt_qos_t *granted_qos_levels); - -/** - * Encodes the supplied unsubscribe data into the supplied buffer, ready for sending - * - * @param buf - The buffer into which the packet will be encoded. - * @param buf_len - The length of the specified buffer. - * @param len - The encoded length of the packet. - * @param packet_id - The packet id. - * @param count - The number of members in the topic_filters array. - * @param topic_filters - The array of topic filters. - * @return An error value. - */ -lwmqtt_err_t lwmqtt_encode_unsubscribe(uint8_t *buf, size_t buf_len, size_t *len, uint16_t packet_id, int count, - lwmqtt_string_t *topic_filters); - -#endif // LWMQTT_PACKET_H diff --git a/lib/arduino-mqtt-2.4.0/src/lwmqtt/string.c b/lib/arduino-mqtt-2.4.0/src/lwmqtt/string.c deleted file mode 100644 index c27dc94e3..000000000 --- a/lib/arduino-mqtt-2.4.0/src/lwmqtt/string.c +++ /dev/null @@ -1,38 +0,0 @@ -#include - -#include "lwmqtt.h" - -lwmqtt_string_t lwmqtt_string(const char *str) { - // check for null - if (str == NULL) { - return (lwmqtt_string_t){0, NULL}; - } - - // get length - uint16_t len = (uint16_t)strlen(str); - - // check zero length - if (len == 0) { - return (lwmqtt_string_t){0, NULL}; - } - - return (lwmqtt_string_t){len, (char *)str}; -} - -int lwmqtt_strcmp(lwmqtt_string_t a, const char *b) { - // get string of b - lwmqtt_string_t b_str = lwmqtt_string(b); - - // return if both are zero length - if (a.len == 0 && b_str.len == 0) { - return 0; - } - - // return if lengths are different - if (a.len != b_str.len) { - return -1; - } - - // compare memory of same length - return strncmp(a.data, b_str.data, a.len); -} diff --git a/platformio.ini b/platformio.ini index f5d958ebf..9ca59d3e8 100644 --- a/platformio.ini +++ b/platformio.ini @@ -29,6 +29,7 @@ src_dir = sonoff ;env_default = sonoff-HE ;env_default = sonoff-HU ;env_default = sonoff-IT +;env_default = sonoff-KO ;env_default = sonoff-NL ;env_default = sonoff-PL ;env_default = sonoff-PT @@ -65,10 +66,12 @@ build_flags = ${esp82xx_defaults.build_flags} -DVTABLES_IN_FLASH [core_2_5_0] -; *** Esp8266 core for Arduino version 2.5.0 release (still not available via platformio) -platform = https://github.com/Jason2866/platform-espressif8266.git#Tasmota +; *** Esp8266 core for Arduino version 2.5.0 +platform = espressif8266@~2.0.4 build_flags = ${esp82xx_defaults.build_flags} -Wl,-Teagle.flash.1m.ld +; Code optimization see https://github.com/esp8266/Arduino/issues/5790#issuecomment-475672473 + -O2 ; lwIP 1.4 (Default) ; -DPIO_FRAMEWORK_ARDUINO_LWIP_HIGHER_BANDWIDTH ; lwIP 2 - Low Memory @@ -88,6 +91,12 @@ build_flags = ${esp82xx_defaults.build_flags} platform = https://github.com/platformio/platform-espressif8266.git#feature/stage build_flags = ${esp82xx_defaults.build_flags} -Wl,-Teagle.flash.1m.ld +; Code optimization see https://github.com/esp8266/Arduino/issues/5790#issuecomment-475672473 + -O2 +; nonos-sdk 22x + -DPIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK22x +; nonos-sdk-pre-v3 +; -DPIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK3 ; lwIP 1.4 (Default) ; -DPIO_FRAMEWORK_ARDUINO_LWIP_HIGHER_BANDWIDTH ; lwIP 2 - Low Memory @@ -338,7 +347,7 @@ board = ${common.board} board_build.flash_mode = ${common.board_build.flash_mode} board_build.f_cpu = ${common.board_build.f_cpu} build_unflags = ${common.build_unflags} -build_flags = ${common.build_flags} -DMY_LANGUAGE=es-AR +build_flags = ${common.build_flags} -DMY_LANGUAGE=es-ES monitor_speed = ${common.monitor_speed} upload_port = ${common.upload_port} upload_resetmethod = ${common.upload_resetmethod} @@ -415,6 +424,20 @@ upload_resetmethod = ${common.upload_resetmethod} upload_speed = ${common.upload_speed} extra_scripts = ${common.extra_scripts} +[env:sonoff-KO] +platform = ${common.platform} +framework = ${common.framework} +board = ${common.board} +board_build.flash_mode = ${common.board_build.flash_mode} +board_build.f_cpu = ${common.board_build.f_cpu} +build_unflags = ${common.build_unflags} +build_flags = ${common.build_flags} -DMY_LANGUAGE=ko-KO +monitor_speed = ${common.monitor_speed} +upload_port = ${common.upload_port} +upload_resetmethod = ${common.upload_resetmethod} +upload_speed = ${common.upload_speed} +extra_scripts = ${common.extra_scripts} + [env:sonoff-NL] platform = ${common.platform} framework = ${common.framework} diff --git a/sonoff/Parsing.cpp b/sonoff/Parsing.cpp index 525277c74..6c68a3af4 100644 --- a/sonoff/Parsing.cpp +++ b/sonoff/Parsing.cpp @@ -415,7 +415,7 @@ bool ESP8266WebServer::_parseForm(WiFiClient& client, String boundary, uint32_t DEBUG_OUTPUT.println(argFilename); #endif //use GET to set the filename if uploading using blob - if (argFilename == F("blob") && hasArg(FPSTR(filename))) + if (argFilename == F("blob") && hasArg(FPSTR(filename))) argFilename = arg(FPSTR(filename)); } #ifdef DEBUG_ESP_HTTP_SERVER @@ -510,7 +510,7 @@ readfile: uint8_t endBuf[boundary.length()]; client.readBytes(endBuf, boundary.length()); - if (strstr((const char*)endBuf, boundary.c_str()) != NULL){ + if (strstr((const char*)endBuf, boundary.c_str()) != nullptr){ if(_currentHandler && _currentHandler->canUpload(_currentUri)) _currentHandler->upload(*this, _currentUri, *_currentUpload); _currentUpload->totalSize += _currentUpload->currentSize; @@ -571,7 +571,7 @@ readfile: arg.value = postArgs[iarg].value; } _currentArgCount = iarg; - if (postArgs) + if (postArgs) delete[] postArgs; return true; } diff --git a/sonoff/_changelog.ino b/sonoff/_changelog.ino index 371cbeb7f..e21c7409a 100644 --- a/sonoff/_changelog.ino +++ b/sonoff/_changelog.ino @@ -1,97 +1,99 @@ -/* 6.4.1.16 20190211 - * Initial support for online template change using command Template or GUI Configure Other (#5177) +/* 6.5.0.4 20190402 + * Fix Configure Timer Web GUI (#5568) + * Add validation check when loading settings from flash + * Fixed Display Bug in KNX webmenu for Physical Address * - * 6.4.1.15 20190208 - * Change image name BE_MINIMAL to FIRMWARE_MINIMAL (#5106) - * Change image names USE_xyz to FIRMWARE_xyz (#5106) - * Add command SerialDelimiter 128 to filter reception of only characters between ASCII 32 and 127 (#5131) - * Add status message to former declined group commands (#5145) + * 6.5.0.3 20190328 + * Add command Sensor20 1..255 to change Nova Fitness SDS01 working period in minutes (#5452) + * Change some defines to const + * Change IRsend and receive for 64-bit support (#5523) + * Change IRSend Panasonic protocol to 64-bit (#5523) * - * 6.4.1.14 20190203 - * Add SetOption32 until SetOption49 diagnostic information to Status 3 report as replacement for second property value in SetOption property name - * Add Resolution property to Status 3 report providing previous SetOption second value property - * Fix IR local echo - * Add user configuration of HLW8012 and HJL-01/BL0937 Energy Monitoring as used in Sonoff S31, Pow Ra and many Tuya based devices - * Add user configuration of MCP39F501 Energy Monitoring as used in Shelly2 - * Add support for multiple ADS1115 I2C devices (#5083) - * Add rule support for "==", "!=" ">=" and "<=" (#5122) - * Add Hass status sensor (#5139) - * Change GUI weblog solving possible empty screens (#5154) - * Change PN532 support from I2C to Serial for more stability (#5162) - * Add MHZ19 Temperature as Domoticz Temperature selection (#5128) + * 6.5.0.2 20190325 + * Change UDP initial message handling from string to char using static memory and add debug info (#5505) + * Add optional support for Badger HR-E Water Meter (#5539) * - * 6.4.1.13 20190130 - * Add command SetOption36 to control boot loop default restoration (#4645, #5063) - * Add resiliency to saved Settings (#5065) + * 6.5.0.1 20190319 + * Change Web GUI sensor data collection * - * 6.4.1.12 20190128 + * 6.5.0 20190319 + * Remove commands SetOption14 and SetOption63 as it has been superseded by command Interlock + * Remove command SetOption35 0-255 for mDNS start-up delay (#4793) + * Remove support for MQTT_LIBRARY_TYPE, MQTT_ARDUINOMQTT and MQTT_TASMOTAMQTT (#5474) + * Change webserver content handling from single String to small Chunks increasing RAM * Change code use of boolean to bool and byte to uint8_t * Change code uint8_t flags to bool flags - * - * 6.4.1.11 20190124 - * Remove command SetOption14 as it has been superseded by command Interlock - * Remove command SetOption63 as it has been superseded by command Interlock - * Add command Interlock 0 / 1 / 1,2 3,4 .. to control interlock ON/OFF and add up to 8 relays in 1 to 4 interlock groups (#5014) - * Add core version conditional compile options to provided PWM files (#4917) - * Add support for inverted buttons and inverted buttons without pullup (#4914) - * - * 6.4.1.10 20190121 - * Fix Hass discovery of MHZ19(B) sensors (#4992) - * Fix Hass Software Watchdog exception during discovery (#4988) - * Add support for MAX44009 Ambient Light sensor (#4907) - * - * 6.4.1.9 20190115 - * Add support for Mi LED Desk Lamp with rotary switch (#4887) - * Fix mDNS addService (#4938, #4951) - * Fix allowable MAX_RULE_VARS to 16 (#4933) - * Add (S)SerialSend3 escape sequence \x to allow hexadecimal byte value (#3560, #4947) - * Add SerialBridge command SSerialSend5 - * - * 6.4.1.8 20190107 * Change sonoff_template.h layout regarding optional module flags like ADC0 - * Add command SetOption62 1 to force no Button/Switch pullup on dedicated modules. Currently only supported on Shelly2 (#4841) - * Fix Display exception 28 when JSON value is NULL received - * Fix Home Assistant Sensor Discovery Software Watchdog restart (#4831) + * Change sonoff_template.h module lay-out by removing non-configurable GPIOs + * Change button driver making it modular + * Change switch driver making it modular and introduce input filter (#4665, #4724) + * Change switch input detection by optimizing switch debounce (#4724) + * Change web authentication (#4865) + * Change image name BE_MINIMAL to FIRMWARE_MINIMAL and USE_xyz to FIRMWARE_xyz (#5106) + * Change GUI weblog from XML to plain text solving possible empty screens (#5154) + * Fix most compiler warnings + * Fix Display exception 28 when JSON value is nullptr received + * Fix epaper driver (#4785) + * Fix HAss Sensor Discovery Software Watchdog restart (#4831, #4988) + * Fix allowable MAX_RULE_VARS to 16 (#4933) + * Fix mDNS addService (#4938, #4951) + * Fix HAss discovery of MHZ19(B) sensors (#4992) + * Fix some exceptions and watchdogs due to lack of stack space (#5215) + * Fix GUI wifi password acception starting with asteriks (*) (#5231, #5242) + * Fix command WebSend intermittent results (#5273, #5304) + * Fix additional characters in fallbacktopic, hostname and mqttclient on core 2.5.0 (#5359, #5417) + * Fix Energy TotalStartTime when commands EnergyReset0 and/or EnergyReset3 used (#5373) + * Fix DS18S20 temperature calculation (#5375) + * Fix float calculations in range from 0 to -1 (#5386) + * Fix exception on GUI Configure Logging and Configure Other (#5424) + * Add commands PowerCal, VoltageCal and CurrentCal for HLW8012, HJL01 and BL0937 based energy sensors + * Add command SerialDelimiter 128 to filter reception of only characters between ASCII 32 and 127 (#5131) + * Add command SSerialSend5 \ to SerialBridge + * Add command Interlock 0 / 1 / 1,2 3,4 .. to control interlock ON/OFF and add up to 8 relays in 1 to 4 interlock groups (#4910, #5014) + * Add command Template 255 to copy module configuration over to current active template and store as user template named Merged (#5371) + * Add command WifiConfig 7 to allow reset of device in AP mode without admin password (#5297) + * Add command SetOption36 to control boot loop default restoration (#4645, #5063) + * Add command SetOption37 for RGBCW color mapping (#5326) + * Add command SetOption55 0/1 and define MDNS_ENABLE to disable/enable mDNS (#4793, #4923) + * Add command SetOption62 0/1 to disable retain on Button or Switch hold messages (#5299) + * Add support for Smanergy KA10 Smart Wall Socket with Energy monitoring + * Add support for commands in sensor drivers + * Add support for MAX31855 K-Type thermocouple sensor using softSPI (#4764) + * Add support for Near Field Communication (NFC) controller PN532 using Serial (#4791, #5162) * Add support for OBI Power Socket 2 (#4829) * Add support for YTF IR Bridge (#4855) - * Change web authentication (#4865) + * Add support for Mi LED Desk Lamp with rotary switch (#4887) * Add support for Digoo DG-SP202 Smart Socket with Energy monitoring (#4891) - * Add support for Smanergy KA10 Smart Wall Socket with Energy monitoring + * Add support for MAX44009 Ambient Light sensor (#4907) + * Add support for inverted buttons and inverted buttons without pullup (#4914) * Add support for Luminea ZX2820 Smart Socket with Energy monitoring (#4921) - * Add define MDNS_ENABLE to control initial mDNS state (#4923) - * Add split interlock part 1 (#4910) - * - * 6.4.1.7 20190106 - * Fix HLW8012, HJL01 and BL0937 based energy sensors low Power (below 10W) measurement regression from 6.4.1.6 - * Add Power status functionality to LED2 when configured leaving LED1 for Link status indication - * Add no pull-up control to Shelly 2 module (default is pull-up, change GPIO2 to Switch3n for no pull-up) (#4841) - * Add 4 seconds startup delay to button control (#4829) - * Change button driver making it modular - * - * 6.4.1.6 20190105 - * Add commands PowerCal, VoltageCal and CurrentCal for HLW8012, HJL01 and BL0937 based energy sensors - * - * 6.4.1.5 20190103 - * Remove command SetOption35 0-255 for mDNS start-up delay (#4793) - * Add command SetOption55 0/1 to disable/enable mDNS (#4793) - * - * 6.4.1.4 20190101 - * Update Copyright (C) 2019 - * Fix epaper driver (#4785) - * Add support for Near Field Communication (NFC) controller PN532 using I2C (#4791) - * - * 6.4.1.3 20181229 - * Change sonoff_template.h module lay-out by removing non-configurable GPIOs - * Add support for MAX31855 K-Type thermocouple sensor using softSPI (#4764) - * - * 6.4.1.2 20181228 - * Change switch driver making it modular and introduce input filter (#4665, #4724) - * Add define DS18B20_INTERNAL_PULLUP to select internal input pullup when only one DS18B20 sensor is connected eliminating external resistor (#4738) + * Add support for multiple ADS1115 I2C devices (#5083) + * Add support for online template change using command Template or GUI Configure Other (#5177) + * Add support for Korean language translations (#5344) + * Add support for sensor SCD30 (#5434) + * Add parameter CFG_HOLDER to status 1 message (#5206) + * Add SetOption32 until SetOption49 diagnostic information to Status 3 report as replacement for second property value in SetOption property name + * Add Resolution property to Status 3 report providing previous SetOption second value property + * Add property MqttCount to status 6 message representing number of Mqtt re-connections + * Add property LinkCount to state and status 11 message representing number of Wifi Link re-connections + * Add property Downtime to state and status 11 message representing the duration of wifi connection loss * Add variable %timestamp% to rules (#4749) - * - * 6.4.1.1 20181224 - * Fix most compiler warnings - * Change switch input detection by optimizing switch debounce (#4724) + * Add rule support for "==", "!=" ">=" and "<=" (#5122) + * Add rule expression enabled by define USE_EXPRESSION in my_user_config.h (#5210) + * Add Power status functionality to LED2 when configured leaving LED1 for Link status indication + * Add user configuration of HLW8012 and HJL-01/BL0937 Energy Monitoring as used in Sonoff Pow and many Tuya based devices + * Add user configuration of MCP39F501 Energy Monitoring as used in Shelly2 + * Add online template configuration using both commands and Configure Template menu option in GUI + * Add (S)SerialSend3 escape sequence \x to allow hexadecimal byte value (#3560, #4947) + * Add define DS18B20_INTERNAL_PULLUP to select internal input pullup when only one DS18B20 sensor is connected eliminating external resistor (#4738) + * Add button control when no relay configured (#4682) + * Add startup delay of 4 seconds to button control (#4829) + * Add core version conditional compile options to provided PWM files (#4917) + * Add resiliency to saved Settings (#5065) + * Add MHZ19 Temperature as Domoticz Temperature selection (#5128) + * Add HAss status sensor (#5139) + * Add status message to former declined group commands (#5145) + * Add 0x to IRRemote (SetOption29) and RCSwitch (SetOption28) received hexadecimal data (#5431) * * 6.4.1 20181224 * Change RAM usage BMP/BME I2C sensors diff --git a/sonoff/i18n.h b/sonoff/i18n.h index b4b3b1df7..58e1ba63d 100644 --- a/sonoff/i18n.h +++ b/sonoff/i18n.h @@ -44,6 +44,7 @@ #define D_JSON_CHANNEL "Channel" #define D_JSON_CO2 "CarbonDioxide" #define D_JSON_COMMAND "Command" +#define D_JSON_CONFIG_HOLDER "CfgHolder" #define D_JSON_CONNECT_FAILED "Connect failed" #define D_JSON_COREVERSION "Core" #define D_JSON_COUNT "Count" @@ -53,6 +54,7 @@ #define D_JSON_DISTANCE "Distance" #define D_JSON_DNSSERVER "DNSServer" #define D_JSON_DONE "Done" +#define D_JSON_DOWNTIME "Downtime" #define D_JSON_ECO2 "eCO2" #define D_JSON_EMPTY "Empty" #define D_JSON_ENDDST "EndDST" // End Daylight Savings Time @@ -67,6 +69,7 @@ #define D_JSON_FLASHCHIPID "FlashChipId" #define D_JSON_FLASHMODE "FlashMode" #define D_JSON_FLASHSIZE "FlashSize" +#define D_JSON_FLOWRATE "FlowRate" #define D_JSON_FREEMEMORY "Free" #define D_JSON_FREQUENCY "Frequency" #define D_JSON_FROM "from" @@ -88,12 +91,14 @@ #define D_JSON_INFRARED "Infrared" #define D_JSON_UNKNOWN "Unknown" #define D_JSON_LIGHT "Light" +#define D_JSON_LINK_COUNT "LinkCount" #define D_JSON_LOCAL_TIME "Local" #define D_JSON_LOW "Low" #define D_JSON_MAC "Mac" #define D_JSON_MASK "Mask" #define D_JSON_MINIMAL "minimal" #define D_JSON_MODEL "Model" +#define D_JSON_MQTT_COUNT "MqttCount" #define D_JSON_NO "No" #define D_JSON_NOISE "Noise" #define D_JSON_NONE "None" @@ -139,6 +144,7 @@ #define D_JSON_TIME "Time" #define D_JSON_TODAY "Today" #define D_JSON_TOTAL "Total" +#define D_JSON_TOTAL_USAGE "TotalUsage" #define D_JSON_TOTAL_REACTIVE "TotalReactivePower" #define D_JSON_TOTAL_START_TIME "TotalStartTime" #define D_JSON_TVOC "TVOC" @@ -244,6 +250,7 @@ #define D_WCFG_4_RETRY "Retry" #define D_WCFG_5_WAIT "Wait" #define D_WCFG_6_SERIAL "Serial" + #define D_WCFG_7_WIFIMANAGER_RESET_ONLY "ManagerRst" #define D_CMND_FRIENDLYNAME "FriendlyName" #define D_CMND_SWITCHMODE "SwitchMode" #define D_CMND_INTERLOCK "Interlock" @@ -418,6 +425,7 @@ /********************************************************************************************/ #define D_ASTERIX "********" +#define D_ASTERISK_PWD "****" #ifndef MY_LANGUAGE #include "language/en-GB.h" @@ -500,14 +508,16 @@ const char S_JSON_COMMAND_INDEX_ASTERIX[] PROGMEM = "{\"%s%d\":\"" D_A const char S_JSON_COMMAND_INDEX_SVALUE_SVALUE[] PROGMEM = "{\"%s%d\":\"%s%s\"}"; const char S_JSON_COMMAND_INDEX_NVALUE_ACTIVE_NVALUE[] PROGMEM = "{\"%s%d\":\"%d (" D_JSON_ACTIVE " %d)\"}"; -const char S_JSON_SENSOR_INDEX_NVALUE[] PROGMEM = "{\"" D_CMND_SENSOR "%d\":%d}"; -const char S_JSON_SENSOR_INDEX_SVALUE[] PROGMEM = "{\"" D_CMND_SENSOR "%d\":\"%s\"}"; +const char S_JSON_SENSOR_INDEX_NVALUE[] PROGMEM = "{\"" D_CMND_SENSOR "%d\":%d}"; +const char S_JSON_SENSOR_INDEX_SVALUE[] PROGMEM = "{\"" D_CMND_SENSOR "%d\":\"%s\"}"; -const char S_JSON_DRIVER_INDEX_NVALUE[] PROGMEM = "{\"" D_CMND_DRIVER "%d\":%d}"; -const char S_JSON_DRIVER_INDEX_SVALUE[] PROGMEM = "{\"" D_CMND_DRIVER "%d\":\"%s\"}"; +const char S_JSON_DRIVER_INDEX_NVALUE[] PROGMEM = "{\"" D_CMND_DRIVER "%d\":%d}"; +const char S_JSON_DRIVER_INDEX_SVALUE[] PROGMEM = "{\"" D_CMND_DRIVER "%d\":\"%s\"}"; -const char JSON_SNS_TEMP[] PROGMEM = "%s,\"%s\":{\"" D_JSON_TEMPERATURE "\":%s}"; -const char JSON_SNS_TEMPHUM[] PROGMEM = "%s,\"%s\":{\"" D_JSON_TEMPERATURE "\":%s,\"" D_JSON_HUMIDITY "\":%s}"; +const char JSON_SNS_TEMP[] PROGMEM = ",\"%s\":{\"" D_JSON_TEMPERATURE "\":%s}"; +const char JSON_SNS_TEMPHUM[] PROGMEM = ",\"%s\":{\"" D_JSON_TEMPERATURE "\":%s,\"" D_JSON_HUMIDITY "\":%s}"; + +const char JSON_SNS_GNGPM[] PROGMEM = ",\"%s\":{\"" D_JSON_TOTAL_USAGE "\":%s,\"" D_JSON_FLOWRATE "\":%s}"; const char S_LOG_I2C_FOUND_AT[] PROGMEM = D_LOG_I2C "%s " D_FOUND_AT " 0x%x"; @@ -535,7 +545,8 @@ const char kWifiConfig[MAX_WIFI_OPTION][WCFG_MAX_STRING_LENGTH] PROGMEM = { D_WCFG_3_WPSCONFIG, D_WCFG_4_RETRY, D_WCFG_5_WAIT, - D_WCFG_6_SERIAL }; + D_WCFG_6_SERIAL, + D_WCFG_7_WIFIMANAGER_RESET_ONLY }; const char kPrefixes[3][PRFX_MAX_STRING_LENGTH] PROGMEM = { D_CMND, D_STAT, @@ -554,19 +565,20 @@ const char kOptionBlinkOff[] PROGMEM = "BLINKOFF|" D_BLINKOFF ; // xdrv_02_webserver.ino #ifdef USE_WEBSERVER -const char HTTP_SNS_TEMP[] PROGMEM = "%s{s}%s " D_TEMPERATURE "{m}%s°%c{e}"; // {s} = , {m} = , {e} = -const char HTTP_SNS_HUM[] PROGMEM = "%s{s}%s " D_HUMIDITY "{m}%s%%{e}"; // {s} = , {m} = , {e} = -const char HTTP_SNS_PRESSURE[] PROGMEM = "%s{s}%s " D_PRESSURE "{m}%s %s{e}"; // {s} = , {m} = , {e} = -const char HTTP_SNS_SEAPRESSURE[] PROGMEM = "%s{s}%s " D_PRESSUREATSEALEVEL "{m}%s %s{e}"; // {s} = , {m} = , {e} = -const char HTTP_SNS_ANALOG[] PROGMEM = "%s{s}%s " D_ANALOG_INPUT "%d{m}%d{e}"; // {s} = , {m} = , {e} = -const char HTTP_SNS_ILLUMINANCE[] PROGMEM = "%s{s}%s " D_ILLUMINANCE "{m}%d " D_UNIT_LUX "{e}"; // {s} = , {m} = , {e} = - -#if defined(USE_MHZ19) || defined(USE_SENSEAIR) || defined(USE_AZ7798) -const char HTTP_SNS_CO2[] PROGMEM = "%s{s}%s " D_CO2 "{m}%d " D_UNIT_PARTS_PER_MILLION "{e}"; // {s} = , {m} = , {e} = -#endif // USE_WEBSERVER +const char HTTP_SNS_TEMP[] PROGMEM = "{s}%s " D_TEMPERATURE "{m}%s°%c{e}"; // {s} = , {m} = , {e} = +const char HTTP_SNS_HUM[] PROGMEM = "{s}%s " D_HUMIDITY "{m}%s%%{e}"; // {s} = , {m} = , {e} = +const char HTTP_SNS_PRESSURE[] PROGMEM = "{s}%s " D_PRESSURE "{m}%s %s{e}"; // {s} = , {m} = , {e} = +const char HTTP_SNS_SEAPRESSURE[] PROGMEM = "{s}%s " D_PRESSUREATSEALEVEL "{m}%s %s{e}"; // {s} = , {m} = , {e} = +const char HTTP_SNS_ANALOG[] PROGMEM = "{s}%s " D_ANALOG_INPUT "%d{m}%d{e}"; // {s} = , {m} = , {e} = +const char HTTP_SNS_ILLUMINANCE[] PROGMEM = "{s}%s " D_ILLUMINANCE "{m}%d " D_UNIT_LUX "{e}"; // {s} = , {m} = , {e} = +const char HTTP_SNS_CO2[] PROGMEM = "{s}%s " D_CO2 "{m}%d " D_UNIT_PARTS_PER_MILLION "{e}"; // {s} = , {m} = , {e} = +const char HTTP_SNS_CO2EAVG[] PROGMEM = "{s}%s " D_ECO2 "{m}%d " D_UNIT_PARTS_PER_MILLION "{e}"; // {s} = , {m} = , {e} = +const char HTTP_SNS_GALLONS[] PROGMEM = "{s}%s " D_TOTAL_USAGE "{m}%s " D_UNIT_GALLONS " {e}"; // {s} = , {m} = , {e} = +const char HTTP_SNS_GPM[] PROGMEM = "{s}%s " D_FLOW_RATE "{m}%s " D_UNIT_GALLONS_PER_MIN" {e}"; // {s} = , {m} = , {e} = const char S_MAIN_MENU[] PROGMEM = D_MAIN_MENU; const char S_CONFIGURATION[] PROGMEM = D_CONFIGURATION; +const char S_CONFIGURE_TEMPLATE[] PROGMEM = D_CONFIGURE_TEMPLATE; const char S_CONFIGURE_MODULE[] PROGMEM = D_CONFIGURE_MODULE; const char S_CONFIGURE_WIFI[] PROGMEM = D_CONFIGURE_WIFI; const char S_NO_NETWORKS_FOUND[] PROGMEM = D_NO_NETWORKS_FOUND; diff --git a/sonoff/language/bg-BG.h b/sonoff/language/bg-BG.h index da1636422..bd71bf38c 100644 --- a/sonoff/language/bg-BG.h +++ b/sonoff/language/bg-BG.h @@ -28,7 +28,7 @@ * Use online command StateText to translate ON, OFF, HOLD and TOGGLE. * Use online command Prefix to translate cmnd, stat and tele. * - * Updated until v6.4.0.1 + * Updated until v6.4.1.18 \*********************************************************************/ //#define LANGUAGE_MODULE_NAME // Enable to display "Module Generic" (ie Spanish), Disable to display "Generic Module" (ie English) @@ -93,6 +93,7 @@ #define D_FALLBACK_TOPIC "Помощен топик" #define D_FALSE "Невярно" #define D_FILE "Файл" +#define D_FLOW_RATE "Flow rate" #define D_FREE_MEMORY "Свободна памет" #define D_FREQUENCY "Честота" #define D_GAS "Газ" @@ -148,6 +149,7 @@ #define D_STOP "Стоп" #define D_SUBNET_MASK "Маска на подмрежата" #define D_SUBSCRIBE_TO "Записване за" +#define D_UNSUBSCRIBE_FROM "Отписване от" #define D_SUCCESSFUL "Успешно" #define D_SUNRISE "Изгрев" #define D_SUNSET "Залез" @@ -155,6 +157,7 @@ #define D_TO "към" #define D_TOGGLE "Превключване" #define D_TOPIC "Топик" +#define D_TOTAL_USAGE "Total Usage" #define D_TRANSMIT "Предаване" #define D_TRUE "Вярно" #define D_TVOC "TVOC" @@ -219,7 +222,7 @@ // xdrv_02_webserver.ino #define D_NOSCRIPT "Разрешете JavaScript, за да използвате Tasmota" -#define D_MINIMAL_FIRMWARE_PLEASE_UPGRADE "Минимален фърмуеър - моля надградете го" +#define D_MINIMAL_FIRMWARE_PLEASE_UPGRADE "Минимален фърмуеър
моля надградете го" #define D_WEBSERVER_ACTIVE_ON "Уеб сървърът е активен на" #define D_WITH_IP_ADDRESS "с IP адрес" #define D_WEBSERVER_STOPPED "Уеб сървърът е спрян" @@ -253,7 +256,7 @@ #define D_MODULE_PARAMETERS "Параметри на модула" #define D_MODULE_TYPE "Тип на модула" -#define D_PULLUP_ENABLE "No Button/Switch pull-up" +#define D_PULLUP_ENABLE "Без pull-up за бутон/ключ" #define D_GPIO "GPIO" #define D_SERIAL_IN "Сериен вход" #define D_SERIAL_OUT "Сериен изход" @@ -288,7 +291,8 @@ #define D_TELEMETRY_PERIOD "Период на телеметрия" #define D_OTHER_PARAMETERS "Други параметри" -#define D_TEMPLATE "Template" +#define D_TEMPLATE "Модел" +#define D_ACTIVATE "Активирай" #define D_WEB_ADMIN_PASSWORD "Парола на уеб администратора" #define D_MQTT_ENABLE "Активиране на MQTT" #define D_FRIENDLY_NAME "Приятелско име" @@ -297,6 +301,14 @@ #define D_SINGLE_DEVICE "Единично" #define D_MULTI_DEVICE "Мулти" +#define D_CONFIGURE_TEMPLATE "Конфигуриране на модел" +#define D_TEMPLATE_PARAMETERS "Параметри на модел" +#define D_TEMPLATE_NAME "Име" +#define D_BASE_TYPE "Базиран на" +#define D_TEMPLATE_FLAGS "Флагове" +#define D_ALLOW_ADC0 "ADC0 вход" +#define D_ALLOW_PULLUP "Потребителски избор на pull-up" + #define D_SAVE_CONFIGURATION "Запазване на конфигурацията" #define D_CONFIGURATION_SAVED "Конфигурацията е запазена" #define D_CONFIGURATION_RESET "Конфигурацията е изчистена" @@ -482,8 +494,13 @@ #define D_TX20_SOUTH "Ю" #define D_TX20_WEST "З" +//xsns_43_hre.ino +#define D_LOG_HRE "HRE: " + + // sonoff_template.h - keep them as short as possible to be able to fit them in GUI drop down box #define D_SENSOR_NONE "Няма" +#define D_SENSOR_USER "Потребит." #define D_SENSOR_DHT11 "DHT11" #define D_SENSOR_AM2301 "AM2301" #define D_SENSOR_SI7021 "SI7021" @@ -565,12 +582,16 @@ #define D_SENSOR_TXD "Serial Tx" #define D_SENSOR_RXD "Serial Rx" #define D_SENSOR_ROTARY "Rotary" // Suffix "1A" +#define D_SENSOR_HRE_CLOCK "HRE Clock" +#define D_SENSOR_HRE_DATA "HRE Data" // Units #define D_UNIT_AMPERE "A" #define D_UNIT_CENTIMETER "cm" #define D_UNIT_HERTZ "Hz" #define D_UNIT_HOUR "h" +#define D_UNIT_GALLONS "gal" +#define D_UNIT_GALLONS_PER_MIN "g/m" #define D_UNIT_KILOGRAM "kg" #define D_UNIT_INCREMENTS "inc" #define D_UNIT_KILOMETER_PER_HOUR "km/h" diff --git a/sonoff/language/cs-CZ.h b/sonoff/language/cs-CZ.h index 17d2df484..a0b48f627 100644 --- a/sonoff/language/cs-CZ.h +++ b/sonoff/language/cs-CZ.h @@ -93,6 +93,7 @@ #define D_FALLBACK_TOPIC "Záložní topic" #define D_FALSE "Nepravda" #define D_FILE "Soubor" +#define D_FLOW_RATE "Flow rate" #define D_FREE_MEMORY "Volná paměť" #define D_FREQUENCY "Kmitočet" #define D_GAS "Plyn" @@ -148,6 +149,7 @@ #define D_STOP "Stop" #define D_SUBNET_MASK "Maska podsítě" #define D_SUBSCRIBE_TO "Přihlaš se do" +#define D_UNSUBSCRIBE_FROM "Unsubscribe from" #define D_SUCCESSFUL "úspěšné." #define D_SUNRISE "Svítání" #define D_SUNSET "Soumrak" @@ -155,6 +157,7 @@ #define D_TO "do" #define D_TOGGLE "Přepni" #define D_TOPIC "Topic" +#define D_TOTAL_USAGE "Total Usage" #define D_TRANSMIT "Odešli" #define D_TRUE "Pravda" #define D_TVOC "TVOC" @@ -219,7 +222,7 @@ // xdrv_02_webserver.ino #define D_NOSCRIPT "Pro používání prostředí Tasmota povolte JavaScript" -#define D_MINIMAL_FIRMWARE_PLEASE_UPGRADE "Firmware MINIMÁLNÍ - prosím zaktualizujte" +#define D_MINIMAL_FIRMWARE_PLEASE_UPGRADE "Firmware MINIMÁLNÍ
prosím zaktualizujte" #define D_WEBSERVER_ACTIVE_ON "Aktivní Web server" #define D_WITH_IP_ADDRESS "na IP adrese" #define D_WEBSERVER_STOPPED "Web server zastaven" @@ -289,6 +292,7 @@ #define D_OTHER_PARAMETERS "Další nastavení" #define D_TEMPLATE "Template" +#define D_ACTIVATE "Activate" #define D_WEB_ADMIN_PASSWORD "Heslo Web administrátora" #define D_MQTT_ENABLE "MQTT aktivní" #define D_FRIENDLY_NAME "Friendly Name" @@ -297,6 +301,14 @@ #define D_SINGLE_DEVICE "single device" #define D_MULTI_DEVICE "multi device" +#define D_CONFIGURE_TEMPLATE "Configure Template" +#define D_TEMPLATE_PARAMETERS "Template parameters" +#define D_TEMPLATE_NAME "Name" +#define D_BASE_TYPE "Based on" +#define D_TEMPLATE_FLAGS "Options" +#define D_ALLOW_ADC0 "ADC0 input" +#define D_ALLOW_PULLUP "User pull-up selection" + #define D_SAVE_CONFIGURATION "Ulož nastavení" #define D_CONFIGURATION_SAVED "Nastavení uloženo" #define D_CONFIGURATION_RESET "Nastavení resetováno" @@ -482,8 +494,12 @@ #define D_TX20_SOUTH "J" #define D_TX20_WEST "Z" +//xsns_43_hre.ino +#define D_LOG_HRE "HRE: " + // sonoff_template.h - keep them as short as possible to be able to fit them in GUI drop down box #define D_SENSOR_NONE "Není" +#define D_SENSOR_USER "User" #define D_SENSOR_DHT11 "DHT11" #define D_SENSOR_AM2301 "AM2301" #define D_SENSOR_SI7021 "SI7021" @@ -565,12 +581,16 @@ #define D_SENSOR_TXD "Serial Tx" #define D_SENSOR_RXD "Serial Rx" #define D_SENSOR_ROTARY "Rotary" // Suffix "1A" +#define D_SENSOR_HRE_CLOCK "HRE Clock" +#define D_SENSOR_HRE_DATA "HRE Data" // Units #define D_UNIT_AMPERE "A" #define D_UNIT_CENTIMETER "cm" #define D_UNIT_HERTZ "Hz" #define D_UNIT_HOUR "hod" +#define D_UNIT_GALLONS "gal" +#define D_UNIT_GALLONS_PER_MIN "g/m" #define D_UNIT_KILOGRAM "kg" #define D_UNIT_INCREMENTS "inc" #define D_UNIT_KILOMETER_PER_HOUR "km/h" // or "km/h" diff --git a/sonoff/language/de-DE.h b/sonoff/language/de-DE.h index 335a2892f..dbcc39b9a 100644 --- a/sonoff/language/de-DE.h +++ b/sonoff/language/de-DE.h @@ -28,7 +28,7 @@ * Use online command StateText to translate ON, OFF, HOLD and TOGGLE. * Use online command Prefix to translate cmnd, stat and tele. * - * Updated until v6.3.0.17 + * Updated until v6.4.1.18 \*********************************************************************/ //#define LANGUAGE_MODULE_NAME // Enable to display "Module Generic" (ie Spanish), Disable to display "Generic Module" (ie English) @@ -93,6 +93,7 @@ #define D_FALLBACK_TOPIC "Fallback-Topic" #define D_FALSE "falsch" #define D_FILE "Datei" +#define D_FLOW_RATE "Flow rate" #define D_FREE_MEMORY "Freier Arbeitsspeicher" #define D_FREQUENCY "Frequenz" #define D_GAS "Gas" @@ -148,6 +149,7 @@ #define D_STOP "Stop" #define D_SUBNET_MASK "Subnetzmaske" #define D_SUBSCRIBE_TO "abonniere" +#define D_UNSUBSCRIBE_FROM "löse abo. von" #define D_SUCCESSFUL "erfolgreich" #define D_SUNRISE "Sonnenaufgang" #define D_SUNSET "Sonnenuntergang" @@ -155,6 +157,7 @@ #define D_TO "zu" #define D_TOGGLE "An/Aus" #define D_TOPIC "topic" +#define D_TOTAL_USAGE "Total Usage" #define D_TRANSMIT "Übertragen" #define D_TRUE "wahr" #define D_TVOC "TVOC" @@ -219,7 +222,7 @@ // xdrv_02_webserver.ino #define D_NOSCRIPT "JavaScript aktivieren um Tasmota benutzen zu können" -#define D_MINIMAL_FIRMWARE_PLEASE_UPGRADE "MINIMUM-Firmware - bitte upgraden" +#define D_MINIMAL_FIRMWARE_PLEASE_UPGRADE "MINIMUM-Firmware
bitte upgraden" #define D_WEBSERVER_ACTIVE_ON "Web-Server aktiv bei" #define D_WITH_IP_ADDRESS "mit IP-Adresse" #define D_WEBSERVER_STOPPED "Web-Server angehalten" @@ -288,7 +291,8 @@ #define D_TELEMETRY_PERIOD "Telemetrieperiode" #define D_OTHER_PARAMETERS "Sonstige Einstellungen" -#define D_TEMPLATE "Template" +#define D_TEMPLATE "Vorlage" +#define D_ACTIVATE "Aktivieren" #define D_WEB_ADMIN_PASSWORD "Passwort für Web Oberfläche" #define D_MQTT_ENABLE "MQTT aktivieren" #define D_FRIENDLY_NAME "Name [friendly name]" @@ -297,6 +301,14 @@ #define D_SINGLE_DEVICE "Einzelnes Gerät" #define D_MULTI_DEVICE "Mehrfachgerät" +#define D_CONFIGURE_TEMPLATE "Vorlage konfigurieren" +#define D_TEMPLATE_PARAMETERS "Vorlage Parameter" +#define D_TEMPLATE_NAME "Name" +#define D_BASE_TYPE "basiert auf" +#define D_TEMPLATE_FLAGS "Options" +#define D_ALLOW_ADC0 "ADC0 input" +#define D_ALLOW_PULLUP "Nutzer pull-up Auswahl" + #define D_SAVE_CONFIGURATION "Konfiguration speichern" #define D_CONFIGURATION_SAVED "Konfiguration gespeichert" #define D_CONFIGURATION_RESET "Konfiguration zurücksetzen" @@ -482,8 +494,12 @@ #define D_TX20_SOUTH "S" #define D_TX20_WEST "W" +//xsns_43_hre.ino +#define D_LOG_HRE "HRE: " + // sonoff_template.h - keep them as short as possible to be able to fit them in GUI drop down box #define D_SENSOR_NONE "None" +#define D_SENSOR_USER "User" #define D_SENSOR_DHT11 "DHT11" #define D_SENSOR_AM2301 "AM2301" #define D_SENSOR_SI7021 "SI7021" @@ -565,12 +581,16 @@ #define D_SENSOR_TXD "Serial Tx" #define D_SENSOR_RXD "Serial Rx" #define D_SENSOR_ROTARY "Rotary" // Suffix "1A" +#define D_SENSOR_HRE_CLOCK "HRE Clock" +#define D_SENSOR_HRE_DATA "HRE Data" // Units #define D_UNIT_AMPERE "A" #define D_UNIT_CENTIMETER "cm" #define D_UNIT_HERTZ "Hz" #define D_UNIT_HOUR "h" +#define D_UNIT_GALLONS "gal" +#define D_UNIT_GALLONS_PER_MIN "g/m" #define D_UNIT_INCREMENTS "inc" #define D_UNIT_KILOGRAM "kg" #define D_UNIT_KILOMETER_PER_HOUR "km/h" diff --git a/sonoff/language/el-GR.h b/sonoff/language/el-GR.h index 3775135b5..20e4ed47a 100644 --- a/sonoff/language/el-GR.h +++ b/sonoff/language/el-GR.h @@ -93,6 +93,7 @@ #define D_FALLBACK_TOPIC "Fallback Topic" #define D_FALSE "Ψευδές" #define D_FILE "Αρχείο" +#define D_FLOW_RATE "Flow rate" #define D_FREE_MEMORY "Ελεύθερη μνήμη" #define D_FREQUENCY "Συχνότητα" #define D_GAS "Αέριο" @@ -148,6 +149,7 @@ #define D_STOP "Τερματισμός" #define D_SUBNET_MASK "Μάσκα υποδικτύου" #define D_SUBSCRIBE_TO "Εγγραφή στο" +#define D_UNSUBSCRIBE_FROM "Unsubscribe from" #define D_SUCCESSFUL "Επιτυχές" #define D_SUNRISE "Σούρουπο" #define D_SUNSET "Ηλιοβασίλεμα" @@ -155,6 +157,7 @@ #define D_TO "έως" #define D_TOGGLE "Εναλλαγή" #define D_TOPIC "Topic" +#define D_TOTAL_USAGE "Total Usage" #define D_TRANSMIT "Μετάδοση" #define D_TRUE "Αληθές" #define D_TVOC "TVOC" @@ -219,7 +222,7 @@ // webserver.ino #define D_NOSCRIPT "To use Tasmota, please enable JavaScript" -#define D_MINIMAL_FIRMWARE_PLEASE_UPGRADE "MINIMAL firmware - παρακαλώ αναβαθμίστε" +#define D_MINIMAL_FIRMWARE_PLEASE_UPGRADE "MINIMAL firmware
παρακαλώ αναβαθμίστε" #define D_WEBSERVER_ACTIVE_ON "Ενεργός διακομιστής Web στο" #define D_WITH_IP_ADDRESS "με διεύθυνση IP" #define D_WEBSERVER_STOPPED "Ο διακομιστής Web σταμάτησε" @@ -289,6 +292,7 @@ #define D_OTHER_PARAMETERS "Άλλες παράμετροι" #define D_TEMPLATE "Template" +#define D_ACTIVATE "Activate" #define D_WEB_ADMIN_PASSWORD "Κωδικός διαχειριστή" #define D_MQTT_ENABLE "Ενεργοποίηση MQTT" #define D_FRIENDLY_NAME "Φιλική ονομασία" @@ -297,6 +301,14 @@ #define D_SINGLE_DEVICE "μονή συσκευή" #define D_MULTI_DEVICE "πολλαπλές συσκευές" +#define D_CONFIGURE_TEMPLATE "Configure Template" +#define D_TEMPLATE_PARAMETERS "Template parameters" +#define D_TEMPLATE_NAME "Name" +#define D_BASE_TYPE "Based on" +#define D_TEMPLATE_FLAGS "Options" +#define D_ALLOW_ADC0 "ADC0 input" +#define D_ALLOW_PULLUP "User pull-up selection" + #define D_SAVE_CONFIGURATION "Αποθήκευση ρυθμίσεων" #define D_CONFIGURATION_SAVED "Οι ρυθμίσεις αποθηκεύτηκαν" #define D_CONFIGURATION_RESET "Επαναφορά ρυθμίσεων" @@ -482,8 +494,12 @@ #define D_TX20_SOUTH "Ν" #define D_TX20_WEST "Δ" +//xsns_43_hre.ino +#define D_LOG_HRE "HRE: " + // sonoff_template.h - keep them as short as possible to be able to fit them in GUI drop down box #define D_SENSOR_NONE "Κανένα" +#define D_SENSOR_USER "User" #define D_SENSOR_DHT11 "DHT11" #define D_SENSOR_AM2301 "AM2301" #define D_SENSOR_SI7021 "SI7021" @@ -565,12 +581,16 @@ #define D_SENSOR_TXD "Serial Tx" #define D_SENSOR_RXD "Serial Rx" #define D_SENSOR_ROTARY "Rotary" // Suffix "1A" +#define D_SENSOR_HRE_CLOCK "HRE Clock" +#define D_SENSOR_HRE_DATA "HRE Data" // Units #define D_UNIT_AMPERE "A" #define D_UNIT_CENTIMETER "cm" #define D_UNIT_HERTZ "Hz" #define D_UNIT_HOUR "Hr" +#define D_UNIT_GALLONS "gal" +#define D_UNIT_GALLONS_PER_MIN "g/m" #define D_UNIT_INCREMENTS "inc" #define D_UNIT_KILOGRAM "kg" #define D_UNIT_KILOMETER_PER_HOUR "km/h" // or "km/h" diff --git a/sonoff/language/en-GB.h b/sonoff/language/en-GB.h index 587f8c0f2..911e88d29 100644 --- a/sonoff/language/en-GB.h +++ b/sonoff/language/en-GB.h @@ -93,6 +93,7 @@ #define D_FALLBACK_TOPIC "Fallback Topic" #define D_FALSE "False" #define D_FILE "File" +#define D_FLOW_RATE "Flow rate" #define D_FREE_MEMORY "Free Memory" #define D_FREQUENCY "Frequency" #define D_GAS "Gas" @@ -148,6 +149,7 @@ #define D_STOP "Stop" #define D_SUBNET_MASK "Subnet Mask" #define D_SUBSCRIBE_TO "Subscribe to" +#define D_UNSUBSCRIBE_FROM "Unsubscribe from" #define D_SUCCESSFUL "Successful" #define D_SUNRISE "Sunrise" #define D_SUNSET "Sunset" @@ -155,6 +157,7 @@ #define D_TO "to" #define D_TOGGLE "Toggle" #define D_TOPIC "Topic" +#define D_TOTAL_USAGE "Total Usage" #define D_TRANSMIT "Transmit" #define D_TRUE "True" #define D_TVOC "TVOC" @@ -219,7 +222,7 @@ // xdrv_02_webserver.ino #define D_NOSCRIPT "To use Tasmota, please enable JavaScript" -#define D_MINIMAL_FIRMWARE_PLEASE_UPGRADE "MINIMAL firmware - please upgrade" +#define D_MINIMAL_FIRMWARE_PLEASE_UPGRADE "MINIMAL firmware
please upgrade" #define D_WEBSERVER_ACTIVE_ON "Web server active on" #define D_WITH_IP_ADDRESS "with IP address" #define D_WEBSERVER_STOPPED "Web server stopped" @@ -289,6 +292,7 @@ #define D_OTHER_PARAMETERS "Other parameters" #define D_TEMPLATE "Template" +#define D_ACTIVATE "Activate" #define D_WEB_ADMIN_PASSWORD "Web Admin Password" #define D_MQTT_ENABLE "MQTT enable" #define D_FRIENDLY_NAME "Friendly Name" @@ -297,6 +301,14 @@ #define D_SINGLE_DEVICE "single device" #define D_MULTI_DEVICE "multi device" +#define D_CONFIGURE_TEMPLATE "Configure Template" +#define D_TEMPLATE_PARAMETERS "Template parameters" +#define D_TEMPLATE_NAME "Name" +#define D_BASE_TYPE "Based on" +#define D_TEMPLATE_FLAGS "Options" +#define D_ALLOW_ADC0 "ADC0 input" +#define D_ALLOW_PULLUP "User pull-up selection" + #define D_SAVE_CONFIGURATION "Save configuration" #define D_CONFIGURATION_SAVED "Configuration saved" #define D_CONFIGURATION_RESET "Configuration reset" @@ -482,8 +494,12 @@ #define D_TX20_SOUTH "S" #define D_TX20_WEST "W" +//xsns_43_hre.ino +#define D_LOG_HRE "HRE: " + // sonoff_template.h - keep them as short as possible to be able to fit them in GUI drop down box #define D_SENSOR_NONE "None" +#define D_SENSOR_USER "User" #define D_SENSOR_DHT11 "DHT11" #define D_SENSOR_AM2301 "AM2301" #define D_SENSOR_SI7021 "SI7021" @@ -565,12 +581,15 @@ #define D_SENSOR_TXD "Serial Tx" #define D_SENSOR_RXD "Serial Rx" #define D_SENSOR_ROTARY "Rotary" // Suffix "1A" - +#define D_SENSOR_HRE_CLOCK "HRE Clock" +#define D_SENSOR_HRE_DATA "HRE Data" // Units #define D_UNIT_AMPERE "A" #define D_UNIT_CENTIMETER "cm" #define D_UNIT_HERTZ "Hz" #define D_UNIT_HOUR "Hr" +#define D_UNIT_GALLONS "gal" +#define D_UNIT_GALLONS_PER_MIN "g/m" #define D_UNIT_INCREMENTS "inc" #define D_UNIT_KILOGRAM "kg" #define D_UNIT_KILOMETER_PER_HOUR "km/h" // or "km/h" diff --git a/sonoff/language/es-AR.h b/sonoff/language/es-ES.h similarity index 96% rename from sonoff/language/es-AR.h rename to sonoff/language/es-ES.h index 4a4f7d2c6..426d829bd 100644 --- a/sonoff/language/es-AR.h +++ b/sonoff/language/es-ES.h @@ -1,5 +1,5 @@ /* - es-AR.h - localization for Spanish - Argentina for Sonoff-Tasmota + es-ES.h - localization for Spanish - Spain for Sonoff-Tasmota Copyright (C) 2019 Adrian Scillato @@ -17,8 +17,8 @@ along with this program. If not, see . */ -#ifndef _LANGUAGE_ES_AR_H_ -#define _LANGUAGE_ES_AR_H_ +#ifndef _LANGUAGE_ES_ES_H_ +#define _LANGUAGE_ES_ES_H_ /*************************** ATTENTION *******************************\ * @@ -33,7 +33,7 @@ #define LANGUAGE_MODULE_NAME // Enable to display "Module Generic" (ie Spanish), Disable to display "Generic Module" (ie English) -#define LANGUAGE_LCID 11274 +#define LANGUAGE_LCID 1034 // HTML (ISO 639-1) Language Code #define D_HTML_LANGUAGE "es" @@ -93,6 +93,7 @@ #define D_FALLBACK_TOPIC "FallbackTopic" #define D_FALSE "Falso" #define D_FILE "Archivo" +#define D_FLOW_RATE "Flow rate" #define D_FREE_MEMORY "Memoria Libre" #define D_FREQUENCY "Frecuencia" #define D_GAS "Gas" @@ -148,6 +149,7 @@ #define D_STOP "Detener" #define D_SUBNET_MASK "Máscara Subred" #define D_SUBSCRIBE_TO "Suscribir a" +#define D_UNSUBSCRIBE_FROM "Unsubscribe from" #define D_SUCCESSFUL "Exitosa" #define D_SUNRISE "Salida del Sol" #define D_SUNSET "Puesta del Sol" @@ -155,6 +157,7 @@ #define D_TO "a" #define D_TOGGLE "Conmutar" #define D_TOPIC "Topic" +#define D_TOTAL_USAGE "Total Usage" #define D_TRANSMIT "Transmitir" #define D_TRUE "Verdadero" #define D_TVOC "TVOC" @@ -219,7 +222,7 @@ // xdrv_02_webserver.ino #define D_NOSCRIPT "Habilitar JavaScript para usar Tasmota" -#define D_MINIMAL_FIRMWARE_PLEASE_UPGRADE "Firmware MÍNIMO - actualice por favor" +#define D_MINIMAL_FIRMWARE_PLEASE_UPGRADE "Firmware MÍNIMO
actualice por favor" #define D_WEBSERVER_ACTIVE_ON "Servidor web activo en" #define D_WITH_IP_ADDRESS "con dirección IP" #define D_WEBSERVER_STOPPED "Servidor web detenido" @@ -289,6 +292,7 @@ #define D_OTHER_PARAMETERS "Otros parámetros" #define D_TEMPLATE "Template" +#define D_ACTIVATE "Activate" #define D_WEB_ADMIN_PASSWORD "Clave Administrador Web" #define D_MQTT_ENABLE "Habilitar MQTT" #define D_FRIENDLY_NAME "Nombre Amigable" @@ -297,6 +301,14 @@ #define D_SINGLE_DEVICE "dispositivo simple" #define D_MULTI_DEVICE "dispositivo múltiple" +#define D_CONFIGURE_TEMPLATE "Configure Template" +#define D_TEMPLATE_PARAMETERS "Template parameters" +#define D_TEMPLATE_NAME "Name" +#define D_BASE_TYPE "Based on" +#define D_TEMPLATE_FLAGS "Options" +#define D_ALLOW_ADC0 "ADC0 input" +#define D_ALLOW_PULLUP "User pull-up selection" + #define D_SAVE_CONFIGURATION "Grabar configuración" #define D_CONFIGURATION_SAVED "Configuración grabada" #define D_CONFIGURATION_RESET "Configuración restablecida" @@ -482,8 +494,12 @@ #define D_TX20_SOUTH "S" #define D_TX20_WEST "O" +//xsns_43_hre.ino +#define D_LOG_HRE "HRE: " + // sonoff_template.h - keep them as short as possible to be able to fit them in GUI drop down box #define D_SENSOR_NONE "Ninguno" +#define D_SENSOR_USER "User" #define D_SENSOR_DHT11 "DHT11" #define D_SENSOR_AM2301 "AM2301" #define D_SENSOR_SI7021 "SI7021" @@ -565,12 +581,16 @@ #define D_SENSOR_TXD "Serial Tx" #define D_SENSOR_RXD "Serial Rx" #define D_SENSOR_ROTARY "Rotary" // Suffix "1A" +#define D_SENSOR_HRE_CLOCK "HRE Clock" +#define D_SENSOR_HRE_DATA "HRE Data" // Units #define D_UNIT_AMPERE "A" #define D_UNIT_CENTIMETER "cm" #define D_UNIT_HERTZ "Hz" #define D_UNIT_HOUR "Hr" +#define D_UNIT_GALLONS "gal" +#define D_UNIT_GALLONS_PER_MIN "g/m" #define D_UNIT_INCREMENTS "inc" #define D_UNIT_KILOGRAM "kg" #define D_UNIT_KILOMETER_PER_HOUR "km/h" // or "km/h" @@ -633,4 +653,4 @@ #define D_UNIT_KWARH "kVArH" #define D_UNIT_ANGLE "Grados" -#endif // _LANGUAGE_ES_AR_H_ +#endif // _LANGUAGE_ES_ES_H_ diff --git a/sonoff/language/fr-FR.h b/sonoff/language/fr-FR.h index 4b30de366..36e8566f3 100644 --- a/sonoff/language/fr-FR.h +++ b/sonoff/language/fr-FR.h @@ -28,7 +28,7 @@ * Use online command StateText to translate ON, OFF, HOLD and TOGGLE. * Use online command Prefix to translate cmnd, stat and tele. * - * Updated until v6.3.0.17 + * Updated until v6.4.1.18 \*********************************************************************/ #define LANGUAGE_MODULE_NAME // Enable to display "Module Generic" (ie Spanish), Disable to display "Generic Module" (ie English) @@ -93,13 +93,14 @@ #define D_FALLBACK_TOPIC "Topic de secours" #define D_FALSE "Faux" #define D_FILE "Fichier" +#define D_FLOW_RATE "Flow rate" #define D_FREE_MEMORY "Mémoire libre" #define D_FREQUENCY "Fréquence" #define D_GAS "Gaz" #define D_GATEWAY "Passerelle" #define D_GROUP "Groupe" -#define D_HOST "Host" -#define D_HOSTNAME "Hostname" +#define D_HOST "Hôte" +#define D_HOSTNAME "Nom d'Hôte" #define D_HUMIDITY "Humidité" #define D_ILLUMINANCE "Éclairement" #define D_IMMEDIATE "immédiat" // Button immediate @@ -138,7 +139,7 @@ #define D_RESTARTING "Redémarre" #define D_RESTART_REASON "Raison du redémarrage" #define D_RESTORE "restaurer" -#define D_RETAINED "retenu" +#define D_RETAINED "persistant" // MQTT #define D_RULE "Règle" #define D_SAVE "Enregistrer" #define D_SENSOR "Capteur" @@ -147,7 +148,8 @@ #define D_STD_TIME "STD" #define D_STOP "Stop" #define D_SUBNET_MASK "Masque sous-réseau" -#define D_SUBSCRIBE_TO "Souscrire à" +#define D_SUBSCRIBE_TO "S'abonner à" +#define D_UNSUBSCRIBE_FROM "Se désabonner de" #define D_SUCCESSFUL "Réussi" #define D_SUNRISE "Lever du jour" #define D_SUNSET "Tombée de la nuit" @@ -155,6 +157,7 @@ #define D_TO "à" #define D_TOGGLE "Inverser" #define D_TOPIC "Topic" // Keep MQTT keyword +#define D_TOTAL_USAGE "Total Usage" #define D_TRANSMIT "Transmettre" #define D_TRUE "Vrai" #define D_TVOC "TVOC" @@ -184,7 +187,7 @@ #define D_LEVEL_10 "level 1-0" #define D_LEVEL_01 "level 0-1" #define D_SERIAL_LOGGING_DISABLED "Journalisation série désactivée" -#define D_SYSLOG_LOGGING_REENABLED "Jounalisation syslog réactivée" +#define D_SYSLOG_LOGGING_REENABLED "Jounalisation SysLog réactivée" #define D_SET_BAUDRATE_TO "Définir le débit à" #define D_RECEIVED_TOPIC "Topic reçu" // Terme MQTT @@ -209,7 +212,7 @@ #define D_QUERY_DONE "Requête terminée. Services MQTT trouvés" #define D_MQTT_SERVICE_FOUND "Service MQTT trouvé sur" #define D_FOUND_AT "trouvé à" -#define D_SYSLOG_HOST_NOT_FOUND "Host syslog introuvable" +#define D_SYSLOG_HOST_NOT_FOUND "Hôte SysLog introuvable" // settings.ino #define D_SAVED_TO_FLASH_AT "Enregistré en flash à" @@ -219,7 +222,7 @@ // xdrv_02_webserver.ino #define D_NOSCRIPT "Pour utiliser Tasmota, veuillez activer JavaScript" -#define D_MINIMAL_FIRMWARE_PLEASE_UPGRADE "Firmware MINIMAL - merci de mettre à jour" +#define D_MINIMAL_FIRMWARE_PLEASE_UPGRADE "Firmware MINIMAL
merci de mettre à jour" #define D_WEBSERVER_ACTIVE_ON "Serveur web actif sur" #define D_WITH_IP_ADDRESS "avec l'adresse IP" #define D_WEBSERVER_STOPPED "Serveur web éteint" @@ -253,7 +256,7 @@ #define D_MODULE_PARAMETERS "Paramètres module" #define D_MODULE_TYPE "Type de module" -#define D_PULLUP_ENABLE "No Button/Switch pull-up" +#define D_PULLUP_ENABLE "Inter. sans pull-up" #define D_GPIO "GPIO" #define D_SERIAL_IN "Entrée série" #define D_SERIAL_OUT "Sortie série" @@ -281,14 +284,15 @@ #define D_LOGGING_PARAMETERS "Paramètres du journal" #define D_SERIAL_LOG_LEVEL "Niveau de journalisation série" #define D_WEB_LOG_LEVEL "Niveau de journalisation web" -#define D_SYS_LOG_LEVEL "Niveau Syslog" +#define D_SYS_LOG_LEVEL "Niveau SysLog" #define D_MORE_DEBUG "Plus de debug" -#define D_SYSLOG_HOST "Hôte Syslog" -#define D_SYSLOG_PORT "Port Syslog" +#define D_SYSLOG_HOST "Hôte SysLog" +#define D_SYSLOG_PORT "Port SysLog" #define D_TELEMETRY_PERIOD "Période télémétrie" #define D_OTHER_PARAMETERS "Autres paramètres" -#define D_TEMPLATE "Template" +#define D_TEMPLATE "Modèle" +#define D_ACTIVATE "Activer" #define D_WEB_ADMIN_PASSWORD "Mot de passe Web Admin" #define D_MQTT_ENABLE "MQTT activé" #define D_FRIENDLY_NAME "Surnom" @@ -297,6 +301,14 @@ #define D_SINGLE_DEVICE "module unique" #define D_MULTI_DEVICE "multi module" +#define D_CONFIGURE_TEMPLATE "Configuration du modèle" +#define D_TEMPLATE_PARAMETERS "Paramètres du modèle" +#define D_TEMPLATE_NAME "Nom" +#define D_BASE_TYPE "Basé sur" +#define D_TEMPLATE_FLAGS "Options" +#define D_ALLOW_ADC0 "Entrée ADC0" +#define D_ALLOW_PULLUP "Pull-up utilisateur" + #define D_SAVE_CONFIGURATION "Enregistrer la configuration" #define D_CONFIGURATION_SAVED "Configuration enregistrée" #define D_CONFIGURATION_RESET "Configuration réinitialisée" @@ -332,7 +344,7 @@ #define D_UPLOAD_ERR_3 "L'octet magique n'est pas 0xE9" #define D_UPLOAD_ERR_4 "La taille du programme à flasher est plus grande que la taille réelle de la mémoire flash" #define D_UPLOAD_ERR_5 "Erreur de comparaison du buffer de téléchargement" -#define D_UPLOAD_ERR_6 "Téléchargement échoué. Activer Weblog 3" +#define D_UPLOAD_ERR_6 "Téléchargement échoué. Activer WebLog 3" #define D_UPLOAD_ERR_7 "Téléchargement annulé" #define D_UPLOAD_ERR_8 "Fichier invalide" #define D_UPLOAD_ERR_9 "Fichier trop grand" @@ -343,7 +355,7 @@ #define D_UPLOAD_ERROR_CODE "Code d'erreur téléchargement" #define D_ENTER_COMMAND "Saisir une commande" -#define D_ENABLE_WEBLOG_FOR_RESPONSE "Activer Weblog 2 si une réponse est attendue" +#define D_ENABLE_WEBLOG_FOR_RESPONSE "Activer WebLog 2 si une réponse est attendue" #define D_NEED_USER_AND_PASSWORD "Nécessite utilisateur=&password=" // xdrv_01_mqtt.ino @@ -482,8 +494,12 @@ #define D_TX20_SOUTH "S" #define D_TX20_WEST "O" +//xsns_43_hre.ino +#define D_LOG_HRE "HRE: " + // sonoff_template.h - keep them as short as possible to be able to fit them in GUI drop down box #define D_SENSOR_NONE "Aucun" +#define D_SENSOR_USER "Utilisateur" #define D_SENSOR_DHT11 "DHT11" #define D_SENSOR_AM2301 "AM2301" #define D_SENSOR_SI7021 "SI7021" @@ -565,12 +581,16 @@ #define D_SENSOR_TXD "Serial Tx" #define D_SENSOR_RXD "Serial Rx" #define D_SENSOR_ROTARY "Rotary" // Suffix "1A" +#define D_SENSOR_HRE_CLOCK "HRE Clock" +#define D_SENSOR_HRE_DATA "HRE Data" // Units #define D_UNIT_AMPERE "A" #define D_UNIT_CENTIMETER "cm" #define D_UNIT_HERTZ "Hz" #define D_UNIT_HOUR "h" +#define D_UNIT_GALLONS "gal" +#define D_UNIT_GALLONS_PER_MIN "g/m" #define D_UNIT_INCREMENTS "inc" #define D_UNIT_KILOGRAM "kg" #define D_UNIT_KILOMETER_PER_HOUR "km/h" diff --git a/sonoff/language/he-HE.h b/sonoff/language/he-HE.h index 6fc333a7b..c6061d05a 100644 --- a/sonoff/language/he-HE.h +++ b/sonoff/language/he-HE.h @@ -54,21 +54,21 @@ #define D_ADMIN "מנהל" #define D_AIR_QUALITY "איכות אוויר" #define D_AP "AP" // Access Point -#define D_AS "as" -#define D_AUTO "AUTO" +#define D_AS "-כ" +#define D_AUTO "אוטומטי" #define D_BLINK "מהבהב" #define D_BLINKOFF "כיבוי היבהוב" #define D_BOOT_COUNT "מונה הפעלה מחדש" #define D_BRIGHTLIGHT "בהירות" #define D_BSSID "BSSId" #define D_BUTTON "לחצן" -#define D_BY "by" // Written by me +#define D_BY "על ידי" // Written by me #define D_BYTES "בייט" #define D_CELSIUS "צלזיוס" #define D_CHANNEL "ערוץ" -#define D_CO2 "Carbon dioxide" +#define D_CO2 "פחמן דו חמצני" #define D_CODE "קוד" // Button code -#define D_COLDLIGHT "קור" +#define D_COLDLIGHT "אור קר" #define D_COMMAND "פקודה" #define D_CONNECTED "מחובר" #define D_COUNT "סופר" @@ -93,6 +93,7 @@ #define D_FALLBACK_TOPIC "נושא לחזרה" #define D_FALSE "שגוי" #define D_FILE "קובץ" +#define D_FLOW_RATE "Flow rate" #define D_FREE_MEMORY "זכרון פנוי" #define D_FREQUENCY "תדר" #define D_GAS "גז" @@ -112,7 +113,7 @@ #define D_LWT "LWT" #define D_MODULE "מודול" #define D_MQTT "MQTT" -#define D_MULTI_PRESS "multi-press" +#define D_MULTI_PRESS "לחיצה מרובה" #define D_NOISE "רעש" #define D_NONE "כלום" #define D_OFF "כבוי" @@ -132,7 +133,7 @@ #define D_PROGRAM_FLASH_SIZE "גודל תוכנית פלאש" #define D_PROGRAM_SIZE "גודל תוכנית" #define D_PROJECT "פרויקט" -#define D_RAIN "Rain" +#define D_RAIN "גשם" #define D_RECEIVED "התקבל" #define D_RESTART "איתחול" #define D_RESTARTING "הפעלה מחדש" @@ -148,6 +149,7 @@ #define D_STOP "עצירה" #define D_SUBNET_MASK "רשת מסכת משנה" #define D_SUBSCRIBE_TO "הרשם ל" +#define D_UNSUBSCRIBE_FROM "בטל רישום" #define D_SUCCESSFUL "הצליח" #define D_SUNRISE "זריחה" #define D_SUNSET "שקיעה" @@ -155,6 +157,7 @@ #define D_TO "ל" #define D_TOGGLE "מתג" #define D_TOPIC "נושא" +#define D_TOTAL_USAGE "Total Usage" #define D_TRANSMIT "עבר" #define D_TRUE "נכון" #define D_TVOC "TVOC" @@ -175,61 +178,61 @@ #define D_UV_POWER "UV Power" #define D_VERSION "גרסה" #define D_VOLTAGE "מתח" -#define D_WEIGHT "Weight" +#define D_WEIGHT "משקל" #define D_WARMLIGHT "חום" #define D_WEB_SERVER "Web שרת" // sonoff.ino -#define D_WARNING_MINIMAL_VERSION "WARNING This version does not support persistent settings" +#define D_WARNING_MINIMAL_VERSION "אזהרה גרסה זו אינה תומכת בהגדרות קבועות" #define D_LEVEL_10 "level 1-0" #define D_LEVEL_01 "level 0-1" -#define D_SERIAL_LOGGING_DISABLED "Serial logging disabled" -#define D_SYSLOG_LOGGING_REENABLED "Syslog logging re-enabled" +#define D_SERIAL_LOGGING_DISABLED "רישום טורי מושבת" +#define D_SYSLOG_LOGGING_REENABLED "הופעל מחדש Syslog רישום" -#define D_SET_BAUDRATE_TO "Set Baudrate to" -#define D_RECEIVED_TOPIC "Received Topic" -#define D_DATA_SIZE "Data Size" +#define D_SET_BAUDRATE_TO "הגדר קצב שידור ל" +#define D_RECEIVED_TOPIC "Topic התקבל" +#define D_DATA_SIZE "גודל נתונים" #define D_ANALOG_INPUT "אנלוגי" // support.ino #define D_OSWATCH "osWatch" -#define D_BLOCKED_LOOP "Blocked Loop" -#define D_WPS_FAILED_WITH_STATUS "WPSconfig FAILED with status" -#define D_ACTIVE_FOR_3_MINUTES "active for 3 minutes" -#define D_FAILED_TO_START "failed to start" -#define D_PATCH_ISSUE_2186 "Patch issue 2186" -#define D_CONNECTING_TO_AP "Connecting to AP" -#define D_IN_MODE "in mode" -#define D_CONNECT_FAILED_NO_IP_ADDRESS "Connect failed as no IP address received" -#define D_CONNECT_FAILED_AP_NOT_REACHED "Connect failed as AP cannot be reached" -#define D_CONNECT_FAILED_WRONG_PASSWORD "Connect failed with AP incorrect password" -#define D_CONNECT_FAILED_AP_TIMEOUT "Connect failed with AP timeout" -#define D_ATTEMPTING_CONNECTION "Attempting connection..." -#define D_CHECKING_CONNECTION "Checking connection..." -#define D_QUERY_DONE "Query done. MQTT services found" -#define D_MQTT_SERVICE_FOUND "MQTT service found on" -#define D_FOUND_AT "found at" -#define D_SYSLOG_HOST_NOT_FOUND "Syslog Host not found" +#define D_BLOCKED_LOOP "לולאות חסומות" +#define D_WPS_FAILED_WITH_STATUS "נכשל עם הסטטוס WPSconfig" +#define D_ACTIVE_FOR_3_MINUTES "פעיל במשך 3 דקות" +#define D_FAILED_TO_START "נכשל בנסיון להתחיל" +#define D_PATCH_ISSUE_2186 "בעית תיקון 2186" +#define D_CONNECTING_TO_AP "AP -מתחבר ל" +#define D_IN_MODE "במצב" +#define D_CONNECT_FAILED_NO_IP_ADDRESS "IP החיבור נכשל מכיוון שלא התקבלה כתובת" +#define D_CONNECT_FAILED_AP_NOT_REACHED "זמין AP החיבור נכשל כיוון שאין" +#define D_CONNECT_FAILED_WRONG_PASSWORD "סיסמא שגויה , AP חיבור נכשל ל" +#define D_CONNECT_FAILED_AP_TIMEOUT "פג זמן המתנה , AP חיבור נכשל ל" +#define D_ATTEMPTING_CONNECTION "...מנסה להתחבר" +#define D_CHECKING_CONNECTION "...בודק חיבור" +#define D_QUERY_DONE "MQTT השאילתה נעשתה. נמצאו שירותי" +#define D_MQTT_SERVICE_FOUND "MQTT נמצאו שירותי" +#define D_FOUND_AT "נמצא ב" +#define D_SYSLOG_HOST_NOT_FOUND "לא נמצא Syslog מארח" // settings.ino -#define D_SAVED_TO_FLASH_AT "Saved to flash at" -#define D_LOADED_FROM_FLASH_AT "Loaded from flash at" +#define D_SAVED_TO_FLASH_AT "נשמר לפלאש ב" +#define D_LOADED_FROM_FLASH_AT "נטען מהפלאש מ" #define D_USE_DEFAULTS "השתמש בהגדרות ברירת המחדל" #define D_ERASED_SECTOR "סקטור מחוק" // xdrv_02_webserver.ino -#define D_NOSCRIPT "JavaScript - כדי להשתמש ב קושחה אסמוטה אנא הפעל" +#define D_NOSCRIPT "JavaScript - כדי להשתמש בקושחת אסמוטה אנא הפעל" #define D_MINIMAL_FIRMWARE_PLEASE_UPGRADE "קושחה מינימלית - בבקשה אנא שדרג" -#define D_WEBSERVER_ACTIVE_ON "Web server active on" -#define D_WITH_IP_ADDRESS "with IP address" -#define D_WEBSERVER_STOPPED "Web server stopped" -#define D_FILE_NOT_FOUND "File Not Found" -#define D_REDIRECTED "Redirected to captive portal" +#define D_WEBSERVER_ACTIVE_ON "שרת ווב פעיל" +#define D_WITH_IP_ADDRESS "IP עם כתובת" +#define D_WEBSERVER_STOPPED "שרת ווב הופסק" +#define D_FILE_NOT_FOUND "קובץ לא נמצא" +#define D_REDIRECTED "הופנה מחדש לפורטל" #define D_WIFIMANAGER_SET_ACCESSPOINT_AND_STATION "Wifimanager set AccessPoint and keep Station" #define D_WIFIMANAGER_SET_ACCESSPOINT "Wifimanager set AccessPoint" #define D_TRYING_TO_CONNECT "מנסה לחבר את ההתקן לרשת" -#define D_RESTART_IN "הפעלה מחדש תןך" +#define D_RESTART_IN "הפעלה מחדש תוך" #define D_SECONDS "שניות" #define D_DEVICE_WILL_RESTART "ההתקן יופעל מחדש בעוד מס' שניות" #define D_BUTTON_TOGGLE "מצב" @@ -253,7 +256,7 @@ #define D_MODULE_PARAMETERS "מודול פרמטרים" #define D_MODULE_TYPE "סוג מודול" -#define D_PULLUP_ENABLE "No Button/Switch pull-up" +#define D_PULLUP_ENABLE "pull-up אין לחצן/מתג" #define D_GPIO " רגל " #define D_SERIAL_IN "כניסת סריאל" #define D_SERIAL_OUT "יציאת סריאל" @@ -285,11 +288,12 @@ #define D_MORE_DEBUG "מיפוי נוסף" #define D_SYSLOG_HOST "Syslog מארח" #define D_SYSLOG_PORT "Syslog פורט" -#define D_TELEMETRY_PERIOD "Telemetry period" +#define D_TELEMETRY_PERIOD "זמן שידור" #define D_OTHER_PARAMETERS "פרמטרים שונים" -#define D_TEMPLATE "Template" -#define D_WEB_ADMIN_PASSWORD "סיסמת מנהל - אתר" +#define D_TEMPLATE "תבנית" +#define D_ACTIVATE "הפעל" +#define D_WEB_ADMIN_PASSWORD "סיסמת מנהל" #define D_MQTT_ENABLE "MQTT אפשר" #define D_FRIENDLY_NAME "שם ידידותי" #define D_BELKIN_WEMO "Belkin WeMo" @@ -297,6 +301,14 @@ #define D_SINGLE_DEVICE "התקן בודד" #define D_MULTI_DEVICE "התקנים" +#define D_CONFIGURE_TEMPLATE "הגדר תבנית" +#define D_TEMPLATE_PARAMETERS "פרמטרים של תבנית" +#define D_TEMPLATE_NAME "שם" +#define D_BASE_TYPE "מבוסס על" +#define D_TEMPLATE_FLAGS "אפשריות" +#define D_ALLOW_ADC0 "ADC0 כניסת" +#define D_ALLOW_PULLUP "pull-up בחירת משתמש עבור" + #define D_SAVE_CONFIGURATION "שמירת הגדרות" #define D_CONFIGURATION_SAVED "הגדרות נשמרו" #define D_CONFIGURATION_RESET "איפוס הגדרות" @@ -347,12 +359,12 @@ #define D_NEED_USER_AND_PASSWORD "Need user=&password=" // xdrv_01_mqtt.ino -#define D_FINGERPRINT "Verify TLS fingerprint..." -#define D_TLS_CONNECT_FAILED_TO "TLS Connect failed to" -#define D_RETRY_IN "Retry in" -#define D_VERIFIED "Verified using Fingerprint" -#define D_INSECURE "Insecure connection due to invalid Fingerprint" -#define D_CONNECT_FAILED_TO "Connect failed to" +#define D_FINGERPRINT "...TLS אמת טביעת אצבע של" +#define D_TLS_CONNECT_FAILED_TO "נכשל TLS חיבור" +#define D_RETRY_IN "נסה שוב תוך" +#define D_VERIFIED "מאומת באמצעות טביעת אצבע" +#define D_INSECURE "חיבור לא מאובטח עקב טביעת אצבע לא חוקית" +#define D_CONNECT_FAILED_TO "חיבור נכשל ל" // xplg_wemohue.ino #define D_MULTICAST_DISABLED "Multicast disabled" @@ -364,38 +376,38 @@ #define D_WEMO_BASIC_EVENT "WeMo basic event" #define D_WEMO_EVENT_SERVICE "WeMo event service" #define D_WEMO_META_SERVICE "WeMo meta service" -#define D_WEMO_SETUP "WeMo setup" -#define D_RESPONSE_SENT "Response sent" +#define D_WEMO_SETUP "WeMo הגדרת" +#define D_RESPONSE_SENT "תגובה נשלחה" #define D_HUE "Hue" -#define D_HUE_BRIDGE_SETUP "Hue setup" +#define D_HUE_BRIDGE_SETUP "Hue הגדרת" #define D_HUE_API_NOT_IMPLEMENTED "Hue API not implemented" #define D_HUE_API "Hue API" #define D_HUE_POST_ARGS "Hue POST args" #define D_3_RESPONSE_PACKETS_SENT "3 response packets sent" // xdrv_07_domoticz.ino -#define D_DOMOTICZ_PARAMETERS "Domoticz parameters" +#define D_DOMOTICZ_PARAMETERS "Domoticz פרמטרי" #define D_DOMOTICZ_IDX "Idx" #define D_DOMOTICZ_KEY_IDX "Key idx" #define D_DOMOTICZ_SWITCH_IDX "Switch idx" #define D_DOMOTICZ_SENSOR_IDX "Sensor idx" - #define D_DOMOTICZ_TEMP "Temp" - #define D_DOMOTICZ_TEMP_HUM "Temp,Hum" - #define D_DOMOTICZ_TEMP_HUM_BARO "Temp,Hum,Baro" - #define D_DOMOTICZ_POWER_ENERGY "Power,Energy" - #define D_DOMOTICZ_ILLUMINANCE "Illuminance" + #define D_DOMOTICZ_TEMP "טמפרטורה" + #define D_DOMOTICZ_TEMP_HUM "טמפרטורה,לחות" + #define D_DOMOTICZ_TEMP_HUM_BARO "טמפרטורה,לחות,ברומטר" + #define D_DOMOTICZ_POWER_ENERGY "הספק,צריכה" + #define D_DOMOTICZ_ILLUMINANCE "עוצמת אור" #define D_DOMOTICZ_COUNT "Count/PM1" #define D_DOMOTICZ_VOLTAGE "Voltage/PM2.5" #define D_DOMOTICZ_CURRENT "Current/PM10" - #define D_DOMOTICZ_AIRQUALITY "AirQuality" -#define D_DOMOTICZ_UPDATE_TIMER "Update timer" + #define D_DOMOTICZ_AIRQUALITY "איכות אוויר" +#define D_DOMOTICZ_UPDATE_TIMER "עדכן טיימר" // xdrv_09_timers.ino #define D_CONFIGURE_TIMER "הגדרות תזמון" #define D_TIMER_PARAMETERS "פרמטרים עבור תזמון" #define D_TIMER_ENABLE "אפשר תזמון" -#define D_TIMER_ARM "חמש" +#define D_TIMER_ARM "טען" #define D_TIMER_TIME "זמן" #define D_TIMER_DAYS "ימים" #define D_TIMER_REPEAT "חזרות" @@ -403,25 +415,25 @@ #define D_TIMER_ACTION "פעולה" // xdrv_10_knx.ino -#define D_CONFIGURE_KNX "Configure KNX" -#define D_KNX_PARAMETERS "KNX Parameters" -#define D_KNX_GENERAL_CONFIG "General" -#define D_KNX_PHYSICAL_ADDRESS "Physical Address" +#define D_CONFIGURE_KNX "KNX הגדר" +#define D_KNX_PARAMETERS "KNX פרמטרי" +#define D_KNX_GENERAL_CONFIG "כללי" +#define D_KNX_PHYSICAL_ADDRESS "כתובת פיזית" #define D_KNX_PHYSICAL_ADDRESS_NOTE "( Must be unique on the KNX network )" -#define D_KNX_ENABLE "Enable KNX" -#define D_KNX_GROUP_ADDRESS_TO_WRITE "Data to Send to Group Addresses" -#define D_ADD "Add" -#define D_DELETE "Delete" -#define D_REPLY "Reply" -#define D_KNX_GROUP_ADDRESS_TO_READ "Group Addresses to Receive Data from" +#define D_KNX_ENABLE "KNX אפשר" +#define D_KNX_GROUP_ADDRESS_TO_WRITE "נתונים לשליחה אל כתובות קבוצתיות" +#define D_ADD "הוסף" +#define D_DELETE "מחק" +#define D_REPLY "השב" +#define D_KNX_GROUP_ADDRESS_TO_READ "כתובות קבוצתיות לקבלת נתונים מ" #define D_LOG_KNX "KNX: " -#define D_RECEIVED_FROM "Received from" -#define D_KNX_COMMAND_WRITE "Write" -#define D_KNX_COMMAND_READ "Read" -#define D_KNX_COMMAND_OTHER "Other" -#define D_SENT_TO "sent to" +#define D_RECEIVED_FROM "התקבל מאת" +#define D_KNX_COMMAND_WRITE "כתיבה" +#define D_KNX_COMMAND_READ "קריאה" +#define D_KNX_COMMAND_OTHER "אחר" +#define D_SENT_TO "נשלח ל" #define D_KNX_WARNING "The group address ( 0 / 0 / 0 ) is reserved and can not be used." -#define D_KNX_ENHANCEMENT "Communication Enhancement" +#define D_KNX_ENHANCEMENT "שיפור התקשורת" #define D_KNX_TX_SLOT "KNX TX" #define D_KNX_RX_SLOT "KNX RX" @@ -431,16 +443,16 @@ #define D_ENERGY_TOTAL "צריכה כללית" // xsns_05_ds18b20.ino -#define D_SENSOR_BUSY "Sensor busy" -#define D_SENSOR_CRC_ERROR "Sensor CRC error" -#define D_SENSORS_FOUND "Sensors found" +#define D_SENSOR_BUSY "שרת עסוק" +#define D_SENSOR_CRC_ERROR "בחיישן CRC שגיאת" +#define D_SENSORS_FOUND "חיישנים לא נמצאו" // xsns_06_dht.ino -#define D_TIMEOUT_WAITING_FOR "Timeout waiting for" -#define D_START_SIGNAL_LOW "start signal low" -#define D_START_SIGNAL_HIGH "start signal high" -#define D_PULSE "pulse" -#define D_CHECKSUM_FAILURE "Checksum failure" +#define D_TIMEOUT_WAITING_FOR "הזמן הקצוב להמתנה" +#define D_START_SIGNAL_LOW "להתחיל אות נמוך" +#define D_START_SIGNAL_HIGH "להתחיל אות גבוה" +#define D_PULSE "פעימה" +#define D_CHECKSUM_FAILURE "בדיקת כשל נכשלה" // xsns_07_sht1x.ino #define D_SENSOR_DID_NOT_ACK_COMMAND "Sensor did not ACK command" @@ -449,7 +461,7 @@ // xsns_18_pms5003.ino #define D_STANDARD_CONCENTRATION "CF-1 PM" // Standard Particle CF-1 Particle Matter #define D_ENVIRONMENTAL_CONCENTRATION "PM" // Environmetal Particle Matter -#define D_PARTICALS_BEYOND "Particals" +#define D_PARTICALS_BEYOND "חלקיקים" // xsns_32_mpu6050.ino #define D_AX_AXIS "Accel. X-Axis" @@ -460,30 +472,34 @@ #define D_GZ_AXIS "Gyro Z-Axis" // xsns_34_hx711.ino -#define D_HX_CAL_REMOVE "Remove weigth" -#define D_HX_CAL_REFERENCE "Load reference weigth" -#define D_HX_CAL_DONE "Calibrated" -#define D_HX_CAL_FAIL "Calibration failed" -#define D_RESET_HX711 "Reset Scale" -#define D_CONFIGURE_HX711 "Configure Scale" -#define D_HX711_PARAMETERS "Scale parameters" -#define D_ITEM_WEIGHT "Item weight" -#define D_REFERENCE_WEIGHT "Reference weigth" -#define D_CALIBRATE "Calibrate" -#define D_CALIBRATION "Calibration" +#define D_HX_CAL_REMOVE "הסר משקל" +#define D_HX_CAL_REFERENCE "טען משקל התייחסות" +#define D_HX_CAL_DONE "מכויל" +#define D_HX_CAL_FAIL "כיול נכשל" +#define D_RESET_HX711 "אפס את קנה המידה" +#define D_CONFIGURE_HX711 "הגדר קנה מידה" +#define D_HX711_PARAMETERS "פרמטרים של קנה מידה" +#define D_ITEM_WEIGHT "משקל פריט" +#define D_REFERENCE_WEIGHT "משקל הפניה" +#define D_CALIBRATE "כייל" +#define D_CALIBRATION "כיול" //xsns_35_tx20.ino -#define D_TX20_WIND_DIRECTION "Wind Direction" -#define D_TX20_WIND_SPEED "Wind Speed" -#define D_TX20_WIND_SPEED_AVG "Wind Speed Avg" -#define D_TX20_WIND_SPEED_MAX "Wind Speed Max" +#define D_TX20_WIND_DIRECTION "כיוון הרוח" +#define D_TX20_WIND_SPEED "מהירות הרוח" +#define D_TX20_WIND_SPEED_AVG "מהירות הרוח ממוצעת" +#define D_TX20_WIND_SPEED_MAX "מהירות הרוח מקסימלית" #define D_TX20_NORTH "N" #define D_TX20_EAST "E" #define D_TX20_SOUTH "S" #define D_TX20_WEST "W" +//xsns_43_hre.ino +#define D_LOG_HRE "HRE: " + // sonoff_template.h - keep them as short as possible to be able to fit them in GUI drop down box #define D_SENSOR_NONE "None" +#define D_SENSOR_USER "משתמש" #define D_SENSOR_DHT11 "DHT11" #define D_SENSOR_AM2301 "AM2301" #define D_SENSOR_SI7021 "SI7021" @@ -491,7 +507,7 @@ #define D_SENSOR_I2C_SCL "I2C SCL" #define D_SENSOR_I2C_SDA "I2C SDA" #define D_SENSOR_WS2812 "WS2812" -#define D_SENSOR_DFR562 "MP3 Player" +#define D_SENSOR_DFR562 "נגן מוזיקה" #define D_SENSOR_IRSEND "IRsend" #define D_SENSOR_SWITCH "מתג" // Suffix "1" #define D_SENSOR_BUTTON "לחצן" // Suffix "1" @@ -565,12 +581,16 @@ #define D_SENSOR_TXD "Serial Tx" #define D_SENSOR_RXD "Serial Rx" #define D_SENSOR_ROTARY "Rotary" // Suffix "1A" +#define D_SENSOR_HRE_CLOCK "HRE Clock" +#define D_SENSOR_HRE_DATA "HRE Data" // Units #define D_UNIT_AMPERE "A" #define D_UNIT_CENTIMETER "cm" #define D_UNIT_HERTZ "Hz" #define D_UNIT_HOUR "Hr" +#define D_UNIT_GALLONS "gal" +#define D_UNIT_GALLONS_PER_MIN "g/m" #define D_UNIT_INCREMENTS "inc" #define D_UNIT_KILOGRAM "kg" #define D_UNIT_KILOMETER_PER_HOUR "km/h" // or "km/h" diff --git a/sonoff/language/hu-HU.h b/sonoff/language/hu-HU.h index 43e6a51db..76628df43 100644 --- a/sonoff/language/hu-HU.h +++ b/sonoff/language/hu-HU.h @@ -93,6 +93,7 @@ #define D_FALLBACK_TOPIC "fallback topik" #define D_FALSE "Hamis" #define D_FILE "Fájl" +#define D_FLOW_RATE "Flow rate" #define D_FREE_MEMORY "Szabad memória" #define D_FREQUENCY "Frekvencia" #define D_GAS "Gáz" @@ -148,6 +149,7 @@ #define D_STOP "Leállítás" #define D_SUBNET_MASK "Alhálózati maszk" #define D_SUBSCRIBE_TO "Feliratkozás a(z)" +#define D_UNSUBSCRIBE_FROM "Unsubscribe from" #define D_SUCCESSFUL "Sikeres" #define D_SUNRISE "Napkelte" #define D_SUNSET "Napnyugta" @@ -155,6 +157,7 @@ #define D_TO "-nak" #define D_TOGGLE "Megfordítás" #define D_TOPIC "Topic" +#define D_TOTAL_USAGE "Total Usage" #define D_TRANSMIT "Továbbít" #define D_TRUE "Igaz" #define D_TVOC "TVOC" @@ -219,7 +222,7 @@ // xdrv_02_webserver.ino #define D_NOSCRIPT "A Tasmota használatához engedélyezd a Javascriptet!" -#define D_MINIMAL_FIRMWARE_PLEASE_UPGRADE "MINIMÁLIS firmware - frissítsd!" +#define D_MINIMAL_FIRMWARE_PLEASE_UPGRADE "MINIMÁLIS firmware
frissítsd!" #define D_WEBSERVER_ACTIVE_ON "Webszerver aktív:" #define D_WITH_IP_ADDRESS "IP cím:" #define D_WEBSERVER_STOPPED "Webszerver leállítva" @@ -289,6 +292,7 @@ #define D_OTHER_PARAMETERS "Egyéb beállítások" #define D_TEMPLATE "Template" +#define D_ACTIVATE "Activate" #define D_WEB_ADMIN_PASSWORD "Web admin jelszó" #define D_MQTT_ENABLE "MQTT engedélyezése" #define D_FRIENDLY_NAME "Név" @@ -297,6 +301,14 @@ #define D_SINGLE_DEVICE "single device" #define D_MULTI_DEVICE "multi device" +#define D_CONFIGURE_TEMPLATE "Configure Template" +#define D_TEMPLATE_PARAMETERS "Template parameters" +#define D_TEMPLATE_NAME "Name" +#define D_BASE_TYPE "Based on" +#define D_TEMPLATE_FLAGS "Options" +#define D_ALLOW_ADC0 "ADC0 input" +#define D_ALLOW_PULLUP "User pull-up selection" + #define D_SAVE_CONFIGURATION "Beállítások mentése" #define D_CONFIGURATION_SAVED "Beállítások elmentve" #define D_CONFIGURATION_RESET "Beállítások visszaállítása" @@ -482,8 +494,12 @@ #define D_TX20_SOUTH "D" #define D_TX20_WEST "NY" +//xsns_43_hre.ino +#define D_LOG_HRE "HRE: " + // sonoff_template.h - keep them as short as possible to be able to fit them in GUI drop down box #define D_SENSOR_NONE "Nincs" +#define D_SENSOR_USER "User" #define D_SENSOR_DHT11 "DHT11" #define D_SENSOR_AM2301 "AM2301" #define D_SENSOR_SI7021 "SI7021" @@ -565,12 +581,16 @@ #define D_SENSOR_TXD "Serial Tx" #define D_SENSOR_RXD "Serial Rx" #define D_SENSOR_ROTARY "Rotary" // Suffix "1A" +#define D_SENSOR_HRE_CLOCK "HRE Clock" +#define D_SENSOR_HRE_DATA "HRE Data" // Units #define D_UNIT_AMPERE "A" #define D_UNIT_CENTIMETER "cm" #define D_UNIT_HERTZ "Hz" #define D_UNIT_HOUR "h" +#define D_UNIT_GALLONS "gal" +#define D_UNIT_GALLONS_PER_MIN "g/m" #define D_UNIT_INCREMENTS "inc" #define D_UNIT_KILOGRAM "kg" #define D_UNIT_KILOMETER_PER_HOUR "km/h" // or "km/h" diff --git a/sonoff/language/it-IT.h b/sonoff/language/it-IT.h index ec1e57aba..b77fc7282 100644 --- a/sonoff/language/it-IT.h +++ b/sonoff/language/it-IT.h @@ -93,6 +93,7 @@ #define D_FALLBACK_TOPIC "Topic Riserva" #define D_FALSE "Falso" #define D_FILE "File" +#define D_FLOW_RATE "Flow rate" #define D_FREE_MEMORY "Memoria Libera" #define D_FREQUENCY "Frequenza" #define D_GAS "Gas" @@ -148,6 +149,7 @@ #define D_STOP "Stop" #define D_SUBNET_MASK "Maschera sottorete" #define D_SUBSCRIBE_TO "Sottoscrivi a" +#define D_UNSUBSCRIBE_FROM "Unsubscribe from" #define D_SUCCESSFUL "Riuscito" #define D_SUNRISE "Alba" #define D_SUNSET "Tramonto" @@ -155,6 +157,7 @@ #define D_TO "a" #define D_TOGGLE "Toggle" #define D_TOPIC "Topic" +#define D_TOTAL_USAGE "Total Usage" #define D_TRANSMIT "Trasmesso" #define D_TRUE "Vero" #define D_TVOC "TVOC" @@ -219,7 +222,7 @@ // xdrv_02_webserver.ino #define D_NOSCRIPT "Abilitare JavaScript per utilizzare Tasmota" -#define D_MINIMAL_FIRMWARE_PLEASE_UPGRADE "MINIMAL firmware - effettuare aggiornamento" +#define D_MINIMAL_FIRMWARE_PLEASE_UPGRADE "MINIMAL firmware
effettuare aggiornamento" #define D_WEBSERVER_ACTIVE_ON "Web server attivo su" #define D_WITH_IP_ADDRESS "con indirizzo IP" #define D_WEBSERVER_STOPPED "Web server arrestato" @@ -289,6 +292,7 @@ #define D_OTHER_PARAMETERS "Altri parametri" #define D_TEMPLATE "Template" +#define D_ACTIVATE "Activate" #define D_WEB_ADMIN_PASSWORD "Password Amministratore Web" #define D_MQTT_ENABLE "Abilita MQTT" #define D_FRIENDLY_NAME "Nome confidenziale" @@ -297,6 +301,14 @@ #define D_SINGLE_DEVICE "dispositivo singolo" #define D_MULTI_DEVICE "dispositivo multiplo" +#define D_CONFIGURE_TEMPLATE "Configure Template" +#define D_TEMPLATE_PARAMETERS "Template parameters" +#define D_TEMPLATE_NAME "Name" +#define D_BASE_TYPE "Based on" +#define D_TEMPLATE_FLAGS "Options" +#define D_ALLOW_ADC0 "ADC0 input" +#define D_ALLOW_PULLUP "User pull-up selection" + #define D_SAVE_CONFIGURATION "Salva configurazione" #define D_CONFIGURATION_SAVED "Configurazione salvata" #define D_CONFIGURATION_RESET "Configurazione azzerata" @@ -482,8 +494,12 @@ #define D_TX20_SOUTH "S" #define D_TX20_WEST "W" +//xsns_43_hre.ino +#define D_LOG_HRE "HRE: " + // sonoff_template.h - keep them as short as possible to be able to fit them in GUI drop down box #define D_SENSOR_NONE "Nessuno" +#define D_SENSOR_USER "User" #define D_SENSOR_DHT11 "DHT11" #define D_SENSOR_AM2301 "AM2301" #define D_SENSOR_SI7021 "SI7021" @@ -565,12 +581,16 @@ #define D_SENSOR_TXD "Serial Tx" #define D_SENSOR_RXD "Serial Rx" #define D_SENSOR_ROTARY "Rotary" // Suffix "1A" +#define D_SENSOR_HRE_CLOCK "HRE Clock" +#define D_SENSOR_HRE_DATA "HRE Data" // Units #define D_UNIT_AMPERE "A" #define D_UNIT_CENTIMETER "cm" #define D_UNIT_HERTZ "Hz" #define D_UNIT_HOUR "Hr" +#define D_UNIT_GALLONS "gal" +#define D_UNIT_GALLONS_PER_MIN "g/m" #define D_UNIT_INCREMENTS "inc" #define D_UNIT_KILOGRAM "kg" #define D_UNIT_KILOMETER_PER_HOUR "km/h" // or "km/h" diff --git a/sonoff/language/ko-KO.h b/sonoff/language/ko-KO.h new file mode 100644 index 000000000..c1c5d2b43 --- /dev/null +++ b/sonoff/language/ko-KO.h @@ -0,0 +1,656 @@ +/* + ko-KO.h - localization for Korean - Korean for Sonoff-Tasmota + + Copyright (C) 2019 Theo Arends (translated by NyaamZ) + + 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 . +*/ + +#ifndef _LANGUAGE_KO_KO_H_ +#define _LANGUAGE_KO_KO_H_ + +/*************************** ATTENTION *******************************\ + * + * Due to memory constraints only UTF-8 is supported. + * To save code space keep text as short as possible. + * Time and Date provided by SDK can not be localized (yet). + * Use online command StateText to translate ON, OFF, HOLD and TOGGLE. + * Use online command Prefix to translate cmnd, stat and tele. + * + * Updated until v6.2.1.11 +\*********************************************************************/ + +//#define LANGUAGE_MODULE_NAME // Enable to display "Module Generic" (ie Spanish), Disable to display "Generic Module" (ie English) +// https://www.science.co.il/language/Locale-codes.php +#define LANGUAGE_LCID 1042 +// HTML (ISO 639-1) Language Code +#define D_HTML_LANGUAGE "ko" + +// "2017-03-07T11:08:02" - ISO8601:2004 +#define D_YEAR_MONTH_SEPARATOR "-" +#define D_MONTH_DAY_SEPARATOR "-" +#define D_DATE_TIME_SEPARATOR "T" +#define D_HOUR_MINUTE_SEPARATOR ":" +#define D_MINUTE_SECOND_SEPARATOR ":" + +#define D_DAY3LIST "일 월 화 수 목 금 토 " +#define D_MONTH3LIST "1월 2월 3월 4월 5월 6월 7월 8월 9월 10월11월12월" + +// Non JSON decimal separator +#define D_DECIMAL_SEPARATOR "." + +// Common +#define D_ADMIN "Admin" +#define D_AIR_QUALITY "공기질" +#define D_AP "AP" // Access Point +#define D_AS "as" +#define D_AUTO "자동" +#define D_BLINK "깜박임" +#define D_BLINKOFF "깜박임 끄기" +#define D_BOOT_COUNT "가동횟수" +#define D_BRIGHTLIGHT "밝기" +#define D_BSSID "BSSId" +#define D_BUTTON "버튼" +#define D_BY "by" // Written by me +#define D_BYTES "Bytes" +#define D_CELSIUS "섭씨" +#define D_CHANNEL "채널" +#define D_CO2 "이산화탄소" +#define D_CODE "코드" // Button code +#define D_COLDLIGHT "차갑게" +#define D_COMMAND "명령" +#define D_CONNECTED "연결됨" +#define D_COUNT "횟수" +#define D_COUNTER "Counter" +#define D_CURRENT "전류" // As in Voltage and Current +#define D_DATA "데이터" +#define D_DARKLIGHT "어둡게" +#define D_DEBUG "디버그" +#define D_DISABLED "사용 불가" +#define D_DISTANCE "거리" +#define D_DNS_SERVER "DNS 서버" +#define D_DONE "완료" +#define D_DST_TIME "DST" +#define D_ECO2 "eCO2" +#define D_EMULATION "에뮬레이션" +#define D_ENABLED "사용 가능" +#define D_ERASE "삭제" +#define D_ERROR "에러" +#define D_FAHRENHEIT "화씨" +#define D_FAILED "실패" +#define D_FALLBACK "Fallback" +#define D_FALLBACK_TOPIC "Fallback Topic" +#define D_FALSE "거짓" +#define D_FILE "파일" +#define D_FLOW_RATE "Flow rate" +#define D_FREE_MEMORY "남은 메모리" +#define D_FREQUENCY "빈도" +#define D_GAS "가스" +#define D_GATEWAY "게이트웨이" +#define D_GROUP "그룹" +#define D_HOST "호스트" +#define D_HOSTNAME "호스트이름" +#define D_HUMIDITY "습도" +#define D_ILLUMINANCE "조도" +#define D_IMMEDIATE "immediate" // Button immediate +#define D_INDEX "인덱스" +#define D_INFO "정보" +#define D_INFRARED "적외선" +#define D_INITIALIZED "초기화 완료" +#define D_IP_ADDRESS "IP 주소" +#define D_LIGHT "밝게" +#define D_LWT "LWT" +#define D_MODULE "모듈" +#define D_MQTT "MQTT" +#define D_MULTI_PRESS "multi-press" +#define D_NOISE "소음" +#define D_NONE "없음" +#define D_OFF "꺼짐" +#define D_OFFLINE "오프라인" +#define D_OK "Ok" +#define D_ON "켜짐" +#define D_ONLINE "온라인" +#define D_PASSWORD "비밀번호" +#define D_PORT "포트" +#define D_POWER_FACTOR "Power Factor" +#define D_POWERUSAGE "전원" +#define D_POWERUSAGE_ACTIVE "Active Power" +#define D_POWERUSAGE_APPARENT "Apparent Power" +#define D_POWERUSAGE_REACTIVE "Reactive Power" +#define D_PRESSURE "기압" +#define D_PRESSUREATSEALEVEL "해수면기압" +#define D_PROGRAM_FLASH_SIZE "플래시 용량" +#define D_PROGRAM_SIZE "프로그램 용량" +#define D_PROJECT "프로젝트" +#define D_RAIN "비" +#define D_RECEIVED "받음" +#define D_RESTART "재시작" +#define D_RESTARTING "재시작 중" +#define D_RESTART_REASON "재시작 이유" +#define D_RESTORE "복구" +#define D_RETAINED "보류" +#define D_RULE "규칙" +#define D_SAVE "저장" +#define D_SENSOR "센서" +#define D_SSID "SSId" +#define D_START "시작" +#define D_STD_TIME "STD" +#define D_STOP "정지" +#define D_SUBNET_MASK "서브넷 마스크" +#define D_SUBSCRIBE_TO "구독" +#define D_UNSUBSCRIBE_FROM "구독 해제" +#define D_SUCCESSFUL "성공" +#define D_SUNRISE "일출" +#define D_SUNSET "일몰" +#define D_TEMPERATURE "온도" +#define D_TO "to" +#define D_TOGGLE "전환" +#define D_TOPIC "Topic" +#define D_TOTAL_USAGE "Total Usage" +#define D_TRANSMIT "전송" +#define D_TRUE "참" +#define D_TVOC "TVOC" +#define D_UPGRADE "업그레이드" +#define D_UPLOAD "업로드" +#define D_UPTIME "가동시간" +#define D_USER "User" +#define D_UTC_TIME "UTC" +#define D_UV_INDEX "UV 색인" +#define D_UV_INDEX_1 "낮음" +#define D_UV_INDEX_2 "보통" +#define D_UV_INDEX_3 "높음" +#define D_UV_INDEX_4 "위험" +#define D_UV_INDEX_5 "BurnL1/2" +#define D_UV_INDEX_6 "BurnL3" +#define D_UV_INDEX_7 "OoR" // Out of Range +#define D_UV_LEVEL "UV 레벨" +#define D_UV_POWER "UV 파워" +#define D_VERSION "버전" +#define D_VOLTAGE "전압" +#define D_WEIGHT "무게" +#define D_WARMLIGHT "따뜻하게" +#define D_WEB_SERVER "웹 서버" + +// sonoff.ino +#define D_WARNING_MINIMAL_VERSION "경고: 이 버전은 영구 설정을 지원하지 않습니다" +#define D_LEVEL_10 "level 1-0" +#define D_LEVEL_01 "level 0-1" +#define D_SERIAL_LOGGING_DISABLED "Serial log 사용 안함" +#define D_SYSLOG_LOGGING_REENABLED "Syslog log 다시 사용" + +#define D_SET_BAUDRATE_TO "Set Baudrate to" +#define D_RECEIVED_TOPIC "Received Topic" +#define D_DATA_SIZE "데이터 용량" +#define D_ANALOG_INPUT "아날로그" + +// support.ino +#define D_OSWATCH "osWatch" +#define D_BLOCKED_LOOP "Blocked Loop" +#define D_WPS_FAILED_WITH_STATUS "WPS설정 실패" +#define D_ACTIVE_FOR_3_MINUTES "3분동안 활성화" +#define D_FAILED_TO_START "시작 실패" +#define D_PATCH_ISSUE_2186 "Patch issue 2186" +#define D_CONNECTING_TO_AP "AP에 연결 중" +#define D_IN_MODE "in mode" +#define D_CONNECT_FAILED_NO_IP_ADDRESS "IP 주소가 수신되지 않아 연결이 실패했습니다" +#define D_CONNECT_FAILED_AP_NOT_REACHED "연결이 닿지 않아 AP에 연결할 수 없습니다" +#define D_CONNECT_FAILED_WRONG_PASSWORD "비밀번호가 틀려 AP에 연결할 수 없습니다" +#define D_CONNECT_FAILED_AP_TIMEOUT "시간초과로 AP에 연결할 수 없습니다" +#define D_ATTEMPTING_CONNECTION "연결 시도 중..." +#define D_CHECKING_CONNECTION "연결 체크 중..." +#define D_QUERY_DONE "쿼리 완료. MQTT 서비스 발견" +#define D_MQTT_SERVICE_FOUND "MQTT 서비스 발견" +#define D_FOUND_AT "다음에서 발견" +#define D_SYSLOG_HOST_NOT_FOUND "Syslog 호스트가 발견되지 않았습니다" + +// settings.ino +#define D_SAVED_TO_FLASH_AT "플래시에 저장" +#define D_LOADED_FROM_FLASH_AT "플래시에서 로드" +#define D_USE_DEFAULTS "디폴트 사용" +#define D_ERASED_SECTOR "삭제된 섹터" + +// xdrv_02_webserver.ino +#define D_NOSCRIPT "Tasmota를 사용하려면 JavaScript를 활성화 하십시오." +#define D_MINIMAL_FIRMWARE_PLEASE_UPGRADE "MINIMAL firmware
업그레이드가 필요합니다" +#define D_WEBSERVER_ACTIVE_ON "Web 서버 작동 중" +#define D_WITH_IP_ADDRESS "IP 주소" +#define D_WEBSERVER_STOPPED "Web 서버 멈춤" +#define D_FILE_NOT_FOUND "파일을 찾을 수 없습니다" +#define D_REDIRECTED "인증 페이지로 리디렉션" +#define D_WIFIMANAGER_SET_ACCESSPOINT_AND_STATION "와이파이 매니저가 AccessPoint와 keep Station을 설정" +#define D_WIFIMANAGER_SET_ACCESSPOINT "와이파이 매니저가 AccessPoint를 설정" +#define D_TRYING_TO_CONNECT "장치를 네트워크에 연결하려고 시도 중" + +#define D_RESTART_IN "재시작" +#define D_SECONDS "초" +#define D_DEVICE_WILL_RESTART "이 장치는 몇 초 후 재시작됩니다" +#define D_BUTTON_TOGGLE "켜기/끄기" +#define D_CONFIGURATION "설정" +#define D_INFORMATION "정보" +#define D_FIRMWARE_UPGRADE "펌웨어 업그레이드" +#define D_CONSOLE "콘솔" +#define D_CONFIRM_RESTART "재시작" + +#define D_CONFIGURE_MODULE "모듈 설정" +#define D_CONFIGURE_WIFI "WiFi 설정" +#define D_CONFIGURE_MQTT "MQTT 설정" +#define D_CONFIGURE_DOMOTICZ "Domoticz 설정" +#define D_CONFIGURE_LOGGING "로그 설정" +#define D_CONFIGURE_OTHER "기타 설정" +#define D_CONFIRM_RESET_CONFIGURATION "설정 초기화 확인" +#define D_RESET_CONFIGURATION "설정 초기화" +#define D_BACKUP_CONFIGURATION "백업 설정" +#define D_RESTORE_CONFIGURATION "복원 설정" +#define D_MAIN_MENU "메인 메뉴" + +#define D_MODULE_PARAMETERS "모듈 상세" +#define D_MODULE_TYPE "모듈 타입" +#define D_PULLUP_ENABLE "No Button/Switch pull-up" +#define D_GPIO "GPIO" +#define D_SERIAL_IN "Serial In" +#define D_SERIAL_OUT "Serial Out" + +#define D_WIFI_PARAMETERS "Wifi 상세" +#define D_SCAN_FOR_WIFI_NETWORKS "Wifi 네트워크를 검색 중" +#define D_SCAN_DONE "검색 완료" +#define D_NO_NETWORKS_FOUND "발견된 네트워크가 없습니다" +#define D_REFRESH_TO_SCAN_AGAIN "검색 재시도" +#define D_DUPLICATE_ACCESSPOINT "중복된 AccessPoint" +#define D_SKIPPING_LOW_QUALITY "약한 네트워크 신호 무시" +#define D_RSSI "RSSI" +#define D_WEP "WEP" +#define D_WPA_PSK "WPA PSK" +#define D_WPA2_PSK "WPA2 PSK" +#define D_AP1_SSID "AP1 SSId" +#define D_AP1_PASSWORD "AP1 비밀번호" +#define D_AP2_SSID "AP2 SSId" +#define D_AP2_PASSWORD "AP2 비밀번호" + +#define D_MQTT_PARAMETERS "MQTT 상세" +#define D_CLIENT "클라이언트" +#define D_FULL_TOPIC "Full Topic" + +#define D_LOGGING_PARAMETERS "로그 상세" +#define D_SERIAL_LOG_LEVEL "시리얼 로그 레벨" +#define D_WEB_LOG_LEVEL "Web 로그 레벨" +#define D_SYS_LOG_LEVEL "Syslog 로그 레벨" +#define D_MORE_DEBUG "More debug" +#define D_SYSLOG_HOST "Syslog 호스트" +#define D_SYSLOG_PORT "Syslog 포트" +#define D_TELEMETRY_PERIOD "보고 주기" + +#define D_OTHER_PARAMETERS "기타 상세" +#define D_TEMPLATE "템플릿" +#define D_ACTIVATE "활성" +#define D_WEB_ADMIN_PASSWORD "Web Admin 비밀번호" +#define D_MQTT_ENABLE "MQTT 사용" +#define D_FRIENDLY_NAME "별칭" +#define D_BELKIN_WEMO "Belkin WeMo" +#define D_HUE_BRIDGE "Hue Bridge" +#define D_SINGLE_DEVICE "single device" +#define D_MULTI_DEVICE "multi device" + +#define D_CONFIGURE_TEMPLATE "템플릿 설정" +#define D_TEMPLATE_PARAMETERS "템플릿 상세" +#define D_TEMPLATE_NAME "이름" +#define D_BASE_TYPE "Based on" +#define D_TEMPLATE_FLAGS "옵션" +#define D_ALLOW_ADC0 "ADC0 입력" +#define D_ALLOW_PULLUP "User pull-up selection" + +#define D_SAVE_CONFIGURATION "설정 저장" +#define D_CONFIGURATION_SAVED "설정 저장 완료" +#define D_CONFIGURATION_RESET "설정 초기화" + +#define D_PROGRAM_VERSION "프로그램 버전" +#define D_BUILD_DATE_AND_TIME "빌드 날짜" +#define D_CORE_AND_SDK_VERSION "Core/SDK 버전" +#define D_FLASH_WRITE_COUNT "플래시 쓰기 횟수" +#define D_MAC_ADDRESS "MAC 주소" +#define D_MQTT_HOST "MQTT 호스트" +#define D_MQTT_PORT "MQTT 포트" +#define D_MQTT_CLIENT "MQTT 클라이언트" +#define D_MQTT_USER "MQTT 아이디" +#define D_MQTT_TOPIC "MQTT Topic" +#define D_MQTT_GROUP_TOPIC "MQTT Group Topic" +#define D_MQTT_FULL_TOPIC "MQTT Full Topic" +#define D_MDNS_DISCOVERY "mDNS Discovery" +#define D_MDNS_ADVERTISE "mDNS Advertise" +#define D_ESP_CHIP_ID "ESP Chip Id" +#define D_FLASH_CHIP_ID "Flash Chip Id" +#define D_FLASH_CHIP_SIZE "Flash 용량" +#define D_FREE_PROGRAM_SPACE "여유 프로그램 공간" + +#define D_UPGRADE_BY_WEBSERVER "웹 서버에서 업그레이드" +#define D_OTA_URL "OTA Url" +#define D_START_UPGRADE "업그레이드 시작" +#define D_UPGRADE_BY_FILE_UPLOAD "업로드 된 파일로 업그레이드" +#define D_UPLOAD_STARTED "업로드 시작됨" +#define D_UPGRADE_STARTED "업그레이드 시작됨" +#define D_UPLOAD_DONE "업그레이드 완료" +#define D_UPLOAD_ERR_1 "파일이 선택되지 않았습니다" +#define D_UPLOAD_ERR_2 "용량이 충분하지 않습니다" +#define D_UPLOAD_ERR_3 "Magic 바이트가 0xE9가 아닙니다" +#define D_UPLOAD_ERR_4 "플래시 프로그램이 실제 플래시 용량보다 큽니다" +#define D_UPLOAD_ERR_5 "업로드 버퍼가 일치하지 않습니다" +#define D_UPLOAD_ERR_6 "업로드 실패. 로그 3 사용" +#define D_UPLOAD_ERR_7 "업로드 중단" +#define D_UPLOAD_ERR_8 "파일이 유효하지 않습니다" +#define D_UPLOAD_ERR_9 "용량이 초과되었습니다" +#define D_UPLOAD_ERR_10 "RF chip 초기화 실패" +#define D_UPLOAD_ERR_11 "RF chip 삭제 실패" +#define D_UPLOAD_ERR_12 "RF chip 쓰기 실패" +#define D_UPLOAD_ERR_13 "RF 펌웨어 decode 실패" +#define D_UPLOAD_ERROR_CODE "업로드 에러 코드" + +#define D_ENTER_COMMAND "명령 입력" +#define D_ENABLE_WEBLOG_FOR_RESPONSE "응답이 있다면 Weblog 2를 사용" +#define D_NEED_USER_AND_PASSWORD "user=<아이디>&password=<비밀번호> 필요" + +// xdrv_01_mqtt.ino +#define D_FINGERPRINT "TLS 지문 확인..." +#define D_TLS_CONNECT_FAILED_TO "TLS 연결 실패" +#define D_RETRY_IN "재시도 중" +#define D_VERIFIED "지문 확인 완료" +#define D_INSECURE "유효하지 않은 지문으로 연결이 되지 않았습니다" +#define D_CONNECT_FAILED_TO "연결 실패" + +// xplg_wemohue.ino +#define D_MULTICAST_DISABLED "Multicast 사용 불가" +#define D_MULTICAST_REJOINED "Multicast (다시)가입됨" +#define D_MULTICAST_JOIN_FAILED "Multicast 가입 실패" +#define D_FAILED_TO_SEND_RESPONSE "요청 전송 실패" + +#define D_WEMO "WeMo" +#define D_WEMO_BASIC_EVENT "WeMo 기본 이벤트" +#define D_WEMO_EVENT_SERVICE "WeMo 이벤트 서비스" +#define D_WEMO_META_SERVICE "WeMo meta 서비스" +#define D_WEMO_SETUP "WeMo 설정" +#define D_RESPONSE_SENT "요청 전송됨" + +#define D_HUE "Hue" +#define D_HUE_BRIDGE_SETUP "Hue 설정" +#define D_HUE_API_NOT_IMPLEMENTED "Hue API가 포함되지 않음" +#define D_HUE_API "Hue API" +#define D_HUE_POST_ARGS "Hue POST args" +#define D_3_RESPONSE_PACKETS_SENT "3 요청 패킷이 전송됨" + +// xdrv_07_domoticz.ino +#define D_DOMOTICZ_PARAMETERS "Domoticz 상세" +#define D_DOMOTICZ_IDX "Idx" +#define D_DOMOTICZ_KEY_IDX "Key idx" +#define D_DOMOTICZ_SWITCH_IDX "스위치 idx" +#define D_DOMOTICZ_SENSOR_IDX "센서 idx" + #define D_DOMOTICZ_TEMP "온도" + #define D_DOMOTICZ_TEMP_HUM "온도,습도" + #define D_DOMOTICZ_TEMP_HUM_BARO "온도,습도,기압" + #define D_DOMOTICZ_POWER_ENERGY "전력,전력량" + #define D_DOMOTICZ_ILLUMINANCE "조도" + #define D_DOMOTICZ_COUNT "횟수/PM1" + #define D_DOMOTICZ_VOLTAGE "전압/PM2.5" + #define D_DOMOTICZ_CURRENT "전류/PM10" + #define D_DOMOTICZ_AIRQUALITY "공기질" +#define D_DOMOTICZ_UPDATE_TIMER "타이머 갱신" + +// xdrv_09_timers.ino +#define D_CONFIGURE_TIMER "타이머 설정" +#define D_TIMER_PARAMETERS "타이머 상세" +#define D_TIMER_ENABLE "타이머 사용" +#define D_TIMER_ARM "Arm" +#define D_TIMER_TIME "시간" +#define D_TIMER_DAYS "일" +#define D_TIMER_REPEAT "반복" +#define D_TIMER_OUTPUT "출력" +#define D_TIMER_ACTION "행동" + +// xdrv_10_knx.ino +#define D_CONFIGURE_KNX "KNX 설정" +#define D_KNX_PARAMETERS "KNX 상세" +#define D_KNX_GENERAL_CONFIG "일반" +#define D_KNX_PHYSICAL_ADDRESS "물리적 주소" +#define D_KNX_PHYSICAL_ADDRESS_NOTE "( KNX 네트워크 상에서 반드시 고유한 이름이어야 합니다 )" +#define D_KNX_ENABLE "KNX 사용" +#define D_KNX_GROUP_ADDRESS_TO_WRITE "그룹 주소로 데이타를 보냅니다" +#define D_ADD "추가" +#define D_DELETE "삭제" +#define D_REPLY "응답" +#define D_KNX_GROUP_ADDRESS_TO_READ "받은 데이터의 그룹 주소" +#define D_LOG_KNX "KNX: " +#define D_RECEIVED_FROM "다음에서 받음" +#define D_KNX_COMMAND_WRITE "쓰기" +#define D_KNX_COMMAND_READ "읽기" +#define D_KNX_COMMAND_OTHER "기타" +#define D_SENT_TO "다음으로 보내기" +#define D_KNX_WARNING "그룹 주소 ( 0 / 0 / 0 )은 예약되어 사용할 수 없습니다" +#define D_KNX_ENHANCEMENT "커뮤니케이션 강화" +#define D_KNX_TX_SLOT "KNX TX" +#define D_KNX_RX_SLOT "KNX RX" + +// xdrv_03_energy.ino +#define D_ENERGY_TODAY "금일 전력 사용량" +#define D_ENERGY_YESTERDAY "어제 전력 사용량" +#define D_ENERGY_TOTAL "총 전력 사용량" + +// xsns_05_ds18b20.ino +#define D_SENSOR_BUSY "센서가 사용 중" +#define D_SENSOR_CRC_ERROR "센서 CRC 에러" +#define D_SENSORS_FOUND "센서 발견" + +// xsns_06_dht.ino +#define D_TIMEOUT_WAITING_FOR "대기 시간 초과" +#define D_START_SIGNAL_LOW "시작 신호 낮음" +#define D_START_SIGNAL_HIGH "시작 신호 높음" +#define D_PULSE "pulse" +#define D_CHECKSUM_FAILURE "체크섬 실패" + +// xsns_07_sht1x.ino +#define D_SENSOR_DID_NOT_ACK_COMMAND "센서가 ACK 명령을 수행하지 않음" +#define D_SHT1X_FOUND "SHT1X 발견" + +// xsns_18_pms5003.ino +#define D_STANDARD_CONCENTRATION "CF-1 PM" // Standard Particle CF-1 Particle Matter +#define D_ENVIRONMENTAL_CONCENTRATION "PM" // Environmetal Particle Matter +#define D_PARTICALS_BEYOND "입자" + +// xsns_32_mpu6050.ino +#define D_AX_AXIS "Accel. X-Axis" +#define D_AY_AXIS "Accel. Y-Axis" +#define D_AZ_AXIS "Accel. Z-Axis" +#define D_GX_AXIS "Gyro X-Axis" +#define D_GY_AXIS "Gyro Y-Axis" +#define D_GZ_AXIS "Gyro Z-Axis" + +// xsns_34_hx711.ino +#define D_HX_CAL_REMOVE "중량 제거" +#define D_HX_CAL_REFERENCE "참조 중량 로드" +#define D_HX_CAL_DONE "교정됨" +#define D_HX_CAL_FAIL "교정 실패" +#define D_RESET_HX711 "스케일 초기화" +#define D_CONFIGURE_HX711 "스케일 설정" +#define D_HX711_PARAMETERS "스케일 상세" +#define D_ITEM_WEIGHT "아이템 중량" +#define D_REFERENCE_WEIGHT "참조 중량" +#define D_CALIBRATE "교정" +#define D_CALIBRATION "교정" + +//xsns_35_tx20.ino +#define D_TX20_WIND_DIRECTION "풍향" +#define D_TX20_WIND_SPEED "풍속" +#define D_TX20_WIND_SPEED_AVG "평균 풍속" +#define D_TX20_WIND_SPEED_MAX "최대 풍속" +#define D_TX20_NORTH "N" +#define D_TX20_EAST "E" +#define D_TX20_SOUTH "S" +#define D_TX20_WEST "W" + +//xsns_43_hre.ino +#define D_LOG_HRE "HRE: " + +// sonoff_template.h - keep them as short as possible to be able to fit them in GUI drop down box +#define D_SENSOR_NONE "없음" +#define D_SENSOR_USER "User" +#define D_SENSOR_DHT11 "DHT11" +#define D_SENSOR_AM2301 "AM2301" +#define D_SENSOR_SI7021 "SI7021" +#define D_SENSOR_DS18X20 "DS18x20" +#define D_SENSOR_I2C_SCL "I2C SCL" +#define D_SENSOR_I2C_SDA "I2C SDA" +#define D_SENSOR_WS2812 "WS2812" +#define D_SENSOR_DFR562 "MP3 Player" +#define D_SENSOR_IRSEND "IRsend" +#define D_SENSOR_SWITCH "Switch" // Suffix "1" +#define D_SENSOR_BUTTON "Button" // Suffix "1" +#define D_SENSOR_RELAY "Relay" // Suffix "1i" +#define D_SENSOR_LED "Led" // Suffix "1i" +#define D_SENSOR_PWM "PWM" // Suffix "1" +#define D_SENSOR_COUNTER "Counter" // Suffix "1" +#define D_SENSOR_IRRECV "IRrecv" +#define D_SENSOR_MHZ_RX "MHZ Rx" +#define D_SENSOR_MHZ_TX "MHZ Tx" +#define D_SENSOR_PZEM004_RX "PZEM004 Rx" +#define D_SENSOR_PZEM016_RX "PZEM016 Rx" +#define D_SENSOR_PZEM017_RX "PZEM017 Rx" +#define D_SENSOR_PZEM0XX_TX "PZEM0XX Tx" +#define D_SENSOR_SAIR_RX "SAir Rx" +#define D_SENSOR_SAIR_TX "SAir Tx" +#define D_SENSOR_SPI_CS "SPI CS" +#define D_SENSOR_SPI_DC "SPI DC" +#define D_SENSOR_BACKLIGHT "BkLight" +#define D_SENSOR_PMS5003 "PMS5003" +#define D_SENSOR_SDS0X1_RX "SDS0X1 Rx" +#define D_SENSOR_SDS0X1_TX "SDS0X1 Tx" +#define D_SENSOR_SBR_RX "SerBr Rx" +#define D_SENSOR_SBR_TX "SerBr Tx" +#define D_SENSOR_SR04_TRIG "SR04 Tri" +#define D_SENSOR_SR04_ECHO "SR04 Ech" +#define D_SENSOR_SDM120_TX "SDMx20 Tx" +#define D_SENSOR_SDM120_RX "SDMx20 Rx" +#define D_SENSOR_SDM630_TX "SDM630 Tx" +#define D_SENSOR_SDM630_RX "SDM630 Rx" +#define D_SENSOR_TM1638_CLK "TM16 CLK" +#define D_SENSOR_TM1638_DIO "TM16 DIO" +#define D_SENSOR_TM1638_STB "TM16 STB" +#define D_SENSOR_HX711_SCK "HX711 SCK" +#define D_SENSOR_HX711_DAT "HX711 DAT" +#define D_SENSOR_TX20_TX "TX20" +#define D_SENSOR_RFSEND "RFSend" +#define D_SENSOR_RFRECV "RFrecv" +#define D_SENSOR_TUYA_TX "Tuya Tx" +#define D_SENSOR_TUYA_RX "Tuya Rx" +#define D_SENSOR_MGC3130_XFER "MGC3130 Xfr" +#define D_SENSOR_MGC3130_RESET "MGC3130 Rst" +#define D_SENSOR_SSPI_MISO "SSPI MISO" +#define D_SENSOR_SSPI_MOSI "SSPI MOSI" +#define D_SENSOR_SSPI_SCLK "SSPI SCLK" +#define D_SENSOR_SSPI_CS "SSPI CS" +#define D_SENSOR_SSPI_DC "SSPI DC" +#define D_SENSOR_RF_SENSOR "RF Sensor" +#define D_SENSOR_AZ_RX "AZ Rx" +#define D_SENSOR_AZ_TX "AZ Tx" +#define D_SENSOR_MAX31855_CS "MX31855 CS" +#define D_SENSOR_MAX31855_CLK "MX31855 CLK" +#define D_SENSOR_MAX31855_DO "MX31855 DO" +#define D_SENSOR_NRG_SEL "HLWBL SEL" // Suffix "i" +#define D_SENSOR_NRG_CF1 "HLWBL CF1" +#define D_SENSOR_HLW_CF "HLW8012 CF" +#define D_SENSOR_HJL_CF "BL0937 CF" +#define D_SENSOR_MCP39F5_TX "MCP39F5 Tx" +#define D_SENSOR_MCP39F5_RX "MCP39F5 Rx" +#define D_SENSOR_MCP39F5_RST "MCP39F5 Rst" +#define D_SENSOR_CSE7766_TX "CSE7766 Tx" +#define D_SENSOR_CSE7766_RX "CSE7766 Rx" +#define D_SENSOR_PN532_TX "PN532 Tx" +#define D_SENSOR_PN532_RX "PN532 Rx" +#define D_SENSOR_SM16716_CLK "SM16716 CLK" +#define D_SENSOR_SM16716_DAT "SM16716 DAT" +#define D_SENSOR_SM16716_POWER "SM16716 PWR" +#define D_SENSOR_MY92X1_DI "MY92x1 DI" +#define D_SENSOR_MY92X1_DCKI "MY92x1 DCKI" +#define D_SENSOR_ARIRFRCV "ALux IrRcv" +#define D_SENSOR_TXD "Serial Tx" +#define D_SENSOR_RXD "Serial Rx" +#define D_SENSOR_ROTARY "Rotary" // Suffix "1A" +#define D_SENSOR_HRE_CLOCK "HRE Clock" +#define D_SENSOR_HRE_DATA "HRE Data" + +// Units +#define D_UNIT_AMPERE "A" +#define D_UNIT_CENTIMETER "cm" +#define D_UNIT_HERTZ "Hz" +#define D_UNIT_HOUR "시" +#define D_UNIT_GALLONS "gal" +#define D_UNIT_GALLONS_PER_MIN "g/m" +#define D_UNIT_INCREMENTS "inc" +#define D_UNIT_KILOGRAM "kg" +#define D_UNIT_KILOMETER_PER_HOUR "km/h" // or "km/h" +#define D_UNIT_KILOOHM "kOhm" +#define D_UNIT_KILOWATTHOUR "kWh" +#define D_UNIT_LUX "lx" +#define D_UNIT_MICROGRAM_PER_CUBIC_METER "ug/m3" +#define D_UNIT_MICROMETER "마이크로미터" +#define D_UNIT_MICROSECOND "마이크로초" +#define D_UNIT_MILLIAMPERE "mA" +#define D_UNIT_MILLIMETER "mm" +#define D_UNIT_MILLIMETER_MERCURY "mmHg" +#define D_UNIT_MILLISECOND "밀리초" +#define D_UNIT_MINUTE "분" +#define D_UNIT_PARTS_PER_BILLION "ppb" +#define D_UNIT_PARTS_PER_DECILITER "ppd" +#define D_UNIT_PARTS_PER_MILLION "ppm" +#define D_UNIT_PRESSURE "hPa" +#define D_UNIT_SECOND "초" +#define D_UNIT_SECTORS "섹터" +#define D_UNIT_VA "VA" +#define D_UNIT_VAR "VAr" +#define D_UNIT_VOLT "V" +#define D_UNIT_WATT "W" +#define D_UNIT_WATTHOUR "Wh" +#define D_UNIT_WATT_METER_QUADRAT "W/m²" + +// Log message prefix +#define D_LOG_APPLICATION "APP: " // Application +#define D_LOG_BRIDGE "BRG: " // Bridge +#define D_LOG_CONFIG "CFG: " // Settings +#define D_LOG_COMMAND "CMD: " // Command +#define D_LOG_DEBUG "DBG: " // Debug +#define D_LOG_DHT "DHT: " // DHT sensor +#define D_LOG_DOMOTICZ "DOM: " // Domoticz +#define D_LOG_DSB "DSB: " // DS18xB20 sensor +#define D_LOG_HTTP "HTP: " // HTTP webserver +#define D_LOG_I2C "I2C: " // I2C +#define D_LOG_IRR "IRR: " // Infra Red Received +#define D_LOG_LOG "LOG: " // Logging +#define D_LOG_MODULE "MOD: " // Module +#define D_LOG_MDNS "DNS: " // mDNS +#define D_LOG_MQTT "MQT: " // MQTT +#define D_LOG_OTHER "OTH: " // Other +#define D_LOG_RESULT "RSL: " // Result +#define D_LOG_RFR "RFR: " // RF Received +#define D_LOG_SERIAL "SER: " // Serial +#define D_LOG_SHT1 "SHT: " // SHT1x sensor +#define D_LOG_UPLOAD "UPL: " // Upload +#define D_LOG_UPNP "UPP: " // UPnP +#define D_LOG_WIFI "WIF: " // Wifi + +//SDM220 +#define D_PHASE_ANGLE "Phase Angle" +#define D_IMPORT_ACTIVE "Import Active" +#define D_EXPORT_ACTIVE "Export Active" +#define D_IMPORT_REACTIVE "Import Reactive" +#define D_EXPORT_REACTIVE "Export Reactive" +#define D_TOTAL_REACTIVE "Total Reactive" +#define D_UNIT_KWARH "kVArh" +#define D_UNIT_ANGLE "Deg" + +#endif // _LANGUAGE_KO_KO_H_ diff --git a/sonoff/language/nl-NL.h b/sonoff/language/nl-NL.h index a27c76720..dc78b1445 100644 --- a/sonoff/language/nl-NL.h +++ b/sonoff/language/nl-NL.h @@ -93,6 +93,7 @@ #define D_FALLBACK_TOPIC "Fallback Topic" #define D_FALSE "Onwaar" #define D_FILE "Bestand" +#define D_FLOW_RATE "Flow rate" #define D_FREE_MEMORY "Vrij geheugen" #define D_FREQUENCY "Frequentie" #define D_GAS "Gas" @@ -148,6 +149,7 @@ #define D_STOP "Stop" #define D_SUBNET_MASK "Subnet Masker" #define D_SUBSCRIBE_TO "Abonneer op" +#define D_UNSUBSCRIBE_FROM "Unsubscribe from" #define D_SUCCESSFUL "Gelukt" #define D_SUNRISE "Zonsopgang" #define D_SUNSET "Zonsondergang" @@ -155,6 +157,7 @@ #define D_TO "naar" #define D_TOGGLE "Toggle" // Wissel, Tuimel #define D_TOPIC "Topic" // Onderwerp +#define D_TOTAL_USAGE "Total Usage" #define D_TRANSMIT "Verzend" #define D_TRUE "Waar" #define D_TVOC "TVOC" @@ -219,7 +222,7 @@ // xdrv_02_webserver.ino #define D_NOSCRIPT "Zet JavaScript aan voor Tasmota" -#define D_MINIMAL_FIRMWARE_PLEASE_UPGRADE "MINIMAL firmware - opwaarderen" +#define D_MINIMAL_FIRMWARE_PLEASE_UPGRADE "MINIMAL firmware
opwaarderen" #define D_WEBSERVER_ACTIVE_ON "Webserver actief op" #define D_WITH_IP_ADDRESS "met IP adres" #define D_WEBSERVER_STOPPED "Webserver gestopt" @@ -289,6 +292,7 @@ #define D_OTHER_PARAMETERS "Overige parameters" #define D_TEMPLATE "Template" +#define D_ACTIVATE "Activate" #define D_WEB_ADMIN_PASSWORD "Web Admin Wachtwoord" #define D_MQTT_ENABLE "MQTT ingeschakeld" #define D_FRIENDLY_NAME "Beschrijvende naam" @@ -297,6 +301,14 @@ #define D_SINGLE_DEVICE "een apparaat" #define D_MULTI_DEVICE "meer apparaten" +#define D_CONFIGURE_TEMPLATE "Configure Template" +#define D_TEMPLATE_PARAMETERS "Template parameters" +#define D_TEMPLATE_NAME "Name" +#define D_BASE_TYPE "Based on" +#define D_TEMPLATE_FLAGS "Options" +#define D_ALLOW_ADC0 "ADC0 input" +#define D_ALLOW_PULLUP "User pull-up selection" + #define D_SAVE_CONFIGURATION "Bewaar configuratie" #define D_CONFIGURATION_SAVED "Configuratie opgeslagen" #define D_CONFIGURATION_RESET "Configuratie ge-reset" @@ -482,8 +494,12 @@ #define D_TX20_SOUTH "S" #define D_TX20_WEST "W" +//xsns_43_hre.ino +#define D_LOG_HRE "HRE: " + // sonoff_template.h - keep them as short as possible to be able to fit them in GUI drop down box #define D_SENSOR_NONE "Geen" +#define D_SENSOR_USER "Gebruiker" #define D_SENSOR_DHT11 "DHT11" #define D_SENSOR_AM2301 "AM2301" #define D_SENSOR_SI7021 "SI7021" @@ -565,12 +581,16 @@ #define D_SENSOR_TXD "Serial Tx" #define D_SENSOR_RXD "Serial Rx" #define D_SENSOR_ROTARY "Rotary" // Suffix "1A" +#define D_SENSOR_HRE_CLOCK "HRE Clock" +#define D_SENSOR_HRE_DATA "HRE Data" // Units #define D_UNIT_AMPERE "A" #define D_UNIT_CENTIMETER "cm" #define D_UNIT_HERTZ "Hz" #define D_UNIT_HOUR "h" +#define D_UNIT_GALLONS "gal" +#define D_UNIT_GALLONS_PER_MIN "g/m" #define D_UNIT_INCREMENTS "inc" #define D_UNIT_KILOGRAM "kg" #define D_UNIT_KILOMETER_PER_HOUR "km/h" // or "km/h" diff --git a/sonoff/language/pl-PL.h b/sonoff/language/pl-PL.h index cf68a65b4..20507fc87 100644 --- a/sonoff/language/pl-PL.h +++ b/sonoff/language/pl-PL.h @@ -93,6 +93,7 @@ #define D_FALLBACK_TOPIC "Zastępczy temat" #define D_FALSE "Fałsz" #define D_FILE "Plik" +#define D_FLOW_RATE "Flow rate" #define D_FREE_MEMORY "Wolna pamięć" #define D_FREQUENCY "Frequency" #define D_GAS "Gas" @@ -148,6 +149,7 @@ #define D_STOP "Stop" #define D_SUBNET_MASK "Maska podsieci" #define D_SUBSCRIBE_TO "Subskrybuj do" +#define D_UNSUBSCRIBE_FROM "Unsubscribe from" #define D_SUCCESSFUL "Powodzenie" #define D_SUNRISE "Wschód słońca" #define D_SUNSET "Zachód słońca" @@ -155,6 +157,7 @@ #define D_TO "do" #define D_TOGGLE "Przełącz" #define D_TOPIC "Temat" +#define D_TOTAL_USAGE "Total Usage" #define D_TRANSMIT "Wyślij" #define D_TRUE "Prawda" #define D_TVOC "TVOC" @@ -219,7 +222,7 @@ // xdrv_02_webserver.ino #define D_NOSCRIPT "Aby korzystać z Tasmota, włącz obsługę JavaScript" -#define D_MINIMAL_FIRMWARE_PLEASE_UPGRADE "Oprogramowanie MINIMAL - proszę uaktualnić" +#define D_MINIMAL_FIRMWARE_PLEASE_UPGRADE "Oprogramowanie MINIMAL
proszę uaktualnić" #define D_WEBSERVER_ACTIVE_ON "Aktywny serwer Web" #define D_WITH_IP_ADDRESS "z adresem IP" #define D_WEBSERVER_STOPPED "Serwer Web zatrzymany" @@ -289,6 +292,7 @@ #define D_OTHER_PARAMETERS "Inne parametry" #define D_TEMPLATE "Template" +#define D_ACTIVATE "Activate" #define D_WEB_ADMIN_PASSWORD "Hasło administratora Web" #define D_MQTT_ENABLE "MQTT aktywne" #define D_FRIENDLY_NAME "Twoja nazwa" @@ -297,6 +301,14 @@ #define D_SINGLE_DEVICE "single device" #define D_MULTI_DEVICE "multi device" +#define D_CONFIGURE_TEMPLATE "Configure Template" +#define D_TEMPLATE_PARAMETERS "Template parameters" +#define D_TEMPLATE_NAME "Name" +#define D_BASE_TYPE "Based on" +#define D_TEMPLATE_FLAGS "Options" +#define D_ALLOW_ADC0 "ADC0 input" +#define D_ALLOW_PULLUP "User pull-up selection" + #define D_SAVE_CONFIGURATION "Zapisz ustawienia" #define D_CONFIGURATION_SAVED "Ustawienia zapisane" #define D_CONFIGURATION_RESET "Ustawienia zresetowane" @@ -482,8 +494,12 @@ #define D_TX20_SOUTH "S" #define D_TX20_WEST "W" +//xsns_43_hre.ino +#define D_LOG_HRE "HRE: " + // sonoff_template.h - keep them as short as possible to be able to fit them in GUI drop down box #define D_SENSOR_NONE "Brak" +#define D_SENSOR_USER "User" #define D_SENSOR_DHT11 "DHT11" #define D_SENSOR_AM2301 "AM2301" #define D_SENSOR_SI7021 "SI7021" @@ -565,12 +581,16 @@ #define D_SENSOR_TXD "Serial Tx" #define D_SENSOR_RXD "Serial Rx" #define D_SENSOR_ROTARY "Rotary" // Suffix "1A" +#define D_SENSOR_HRE_CLOCK "HRE Clock" +#define D_SENSOR_HRE_DATA "HRE Data" // Units #define D_UNIT_AMPERE "A" #define D_UNIT_CENTIMETER "cm" #define D_UNIT_HERTZ "Hz" #define D_UNIT_HOUR "Godz" +#define D_UNIT_GALLONS "gal" +#define D_UNIT_GALLONS_PER_MIN "g/m" #define D_UNIT_INCREMENTS "inc" #define D_UNIT_KILOGRAM "kg" #define D_UNIT_KILOMETER_PER_HOUR "km/h" // or "km/h" diff --git a/sonoff/language/pt-BR.h b/sonoff/language/pt-BR.h index 4bc29d00f..433390fb6 100644 --- a/sonoff/language/pt-BR.h +++ b/sonoff/language/pt-BR.h @@ -93,6 +93,7 @@ #define D_FALLBACK_TOPIC "Tópico para retornar" #define D_FALSE "Falso" #define D_FILE "Arquivo" +#define D_FLOW_RATE "Flow rate" #define D_FREE_MEMORY "Memória livre" #define D_FREQUENCY "Frequência" #define D_GAS "Gás" @@ -148,6 +149,7 @@ #define D_STOP "Parar" #define D_SUBNET_MASK "Máscara sub rede" #define D_SUBSCRIBE_TO "Subescrever para" +#define D_UNSUBSCRIBE_FROM "Unsubscribe from" #define D_SUCCESSFUL "Successo" #define D_SUNRISE "Nascer do sol" #define D_SUNSET "Por do sol" @@ -155,6 +157,7 @@ #define D_TO "Para" #define D_TOGGLE "Inverter" #define D_TOPIC "Tópico" +#define D_TOTAL_USAGE "Total Usage" #define D_TRANSMIT "Transmitir" #define D_TRUE "Verdadeiro" #define D_TVOC "TVOC" @@ -219,7 +222,7 @@ // xdrv_02_webserver.ino #define D_NOSCRIPT "To use Tasmota, please enable JavaScript" -#define D_MINIMAL_FIRMWARE_PLEASE_UPGRADE "Firmware mínimo - Atualizar por favor" +#define D_MINIMAL_FIRMWARE_PLEASE_UPGRADE "Firmware mínimo
Atualizar por favor" #define D_WEBSERVER_ACTIVE_ON "Servidor WEB ativo em" #define D_WITH_IP_ADDRESS "com o endereço IP" #define D_WEBSERVER_STOPPED "Servidor WEB parou" @@ -289,6 +292,7 @@ #define D_OTHER_PARAMETERS "Outros parâmetros" #define D_TEMPLATE "Template" +#define D_ACTIVATE "Activate" #define D_WEB_ADMIN_PASSWORD "Senha de WEB Admin" #define D_MQTT_ENABLE "MQTT habilitado" #define D_FRIENDLY_NAME "Nome amigável" @@ -297,6 +301,14 @@ #define D_SINGLE_DEVICE "Dispositivo único" #define D_MULTI_DEVICE "Múltiplos dispositivos" +#define D_CONFIGURE_TEMPLATE "Configure Template" +#define D_TEMPLATE_PARAMETERS "Template parameters" +#define D_TEMPLATE_NAME "Name" +#define D_BASE_TYPE "Based on" +#define D_TEMPLATE_FLAGS "Options" +#define D_ALLOW_ADC0 "ADC0 input" +#define D_ALLOW_PULLUP "User pull-up selection" + #define D_SAVE_CONFIGURATION "Gravar configuração" #define D_CONFIGURATION_SAVED "Configuração gravada" #define D_CONFIGURATION_RESET "Reinicialização da configuração" @@ -482,8 +494,12 @@ #define D_TX20_SOUTH "S" #define D_TX20_WEST "W" +//xsns_43_hre.ino +#define D_LOG_HRE "HRE: " + // sonoff_template.h - keep them as short as possible to be able to fit them in GUI drop down box #define D_SENSOR_NONE "Nenhum" +#define D_SENSOR_USER "User" #define D_SENSOR_DHT11 "DHT11" #define D_SENSOR_AM2301 "AM2301" #define D_SENSOR_SI7021 "SI7021" @@ -565,12 +581,16 @@ #define D_SENSOR_TXD "Serial Tx" #define D_SENSOR_RXD "Serial Rx" #define D_SENSOR_ROTARY "Rotary" // Suffix "1A" +#define D_SENSOR_HRE_CLOCK "HRE Clock" +#define D_SENSOR_HRE_DATA "HRE Data" // Units #define D_UNIT_AMPERE "A" #define D_UNIT_CENTIMETER "cm" #define D_UNIT_HERTZ "Hz" #define D_UNIT_HOUR "H" +#define D_UNIT_GALLONS "gal" +#define D_UNIT_GALLONS_PER_MIN "g/m" #define D_UNIT_INCREMENTS "inc" #define D_UNIT_KILOGRAM "kg" #define D_UNIT_KILOMETER_PER_HOUR "km/h" // or "km/h" diff --git a/sonoff/language/pt-PT.h b/sonoff/language/pt-PT.h index 3ad605076..4240008b4 100644 --- a/sonoff/language/pt-PT.h +++ b/sonoff/language/pt-PT.h @@ -93,6 +93,7 @@ #define D_FALLBACK_TOPIC "Tópico para retornar" #define D_FALSE "Falso" #define D_FILE "Ficheiro" +#define D_FLOW_RATE "Flow rate" #define D_FREE_MEMORY "Memoria Livre" #define D_FREQUENCY "Frequency" #define D_GAS "Gás" @@ -148,6 +149,7 @@ #define D_STOP "Parar" #define D_SUBNET_MASK "Mascara sub rede" #define D_SUBSCRIBE_TO "Subescrever para" +#define D_UNSUBSCRIBE_FROM "Unsubscribe from" #define D_SUCCESSFUL "Successo" #define D_SUNRISE "Sunrise" #define D_SUNSET "Sunset" @@ -155,6 +157,7 @@ #define D_TO "para" #define D_TOGGLE "Pressionar" #define D_TOPIC "Tópico" +#define D_TOTAL_USAGE "Total Usage" #define D_TRANSMIT "Transmitir" #define D_TRUE "Verdadeiro" #define D_TVOC "TVOC" @@ -219,7 +222,7 @@ // xdrv_02_webserver.ino #define D_NOSCRIPT "To use Tasmota, please enable JavaScript" -#define D_MINIMAL_FIRMWARE_PLEASE_UPGRADE "MINIMO firmware - Atualizar Por favor" +#define D_MINIMAL_FIRMWARE_PLEASE_UPGRADE "MINIMO firmware
Atualizar Por favor" #define D_WEBSERVER_ACTIVE_ON "Servidor WEB ativo em" #define D_WITH_IP_ADDRESS "com o endereço IP" #define D_WEBSERVER_STOPPED "Servitor WEB parou" @@ -289,6 +292,7 @@ #define D_OTHER_PARAMETERS "Outros parametros" #define D_TEMPLATE "Template" +#define D_ACTIVATE "Activate" #define D_WEB_ADMIN_PASSWORD "Palavra Chave de WEB Admin" #define D_MQTT_ENABLE "MQTT habilitado" #define D_FRIENDLY_NAME "Nome amigável" @@ -297,6 +301,14 @@ #define D_SINGLE_DEVICE "dispositivo único" #define D_MULTI_DEVICE "multiplos dispositivos" +#define D_CONFIGURE_TEMPLATE "Configure Template" +#define D_TEMPLATE_PARAMETERS "Template parameters" +#define D_TEMPLATE_NAME "Name" +#define D_BASE_TYPE "Based on" +#define D_TEMPLATE_FLAGS "Options" +#define D_ALLOW_ADC0 "ADC0 input" +#define D_ALLOW_PULLUP "User pull-up selection" + #define D_SAVE_CONFIGURATION "Salvar configuração" #define D_CONFIGURATION_SAVED "Configuração guardada" #define D_CONFIGURATION_RESET "Reinicialização da configuração" @@ -482,8 +494,12 @@ #define D_TX20_SOUTH "S" #define D_TX20_WEST "W" +//xsns_43_hre.ino +#define D_LOG_HRE "HRE: " + // sonoff_template.h - keep them as short as possible to be able to fit them in GUI drop down box #define D_SENSOR_NONE "Nenhum" +#define D_SENSOR_USER "User" #define D_SENSOR_DHT11 "DHT11" #define D_SENSOR_AM2301 "AM2301" #define D_SENSOR_SI7021 "SI7021" @@ -565,12 +581,16 @@ #define D_SENSOR_TXD "Serial Tx" #define D_SENSOR_RXD "Serial Rx" #define D_SENSOR_ROTARY "Rotary" // Suffix "1A" +#define D_SENSOR_HRE_CLOCK "HRE Clock" +#define D_SENSOR_HRE_DATA "HRE Data" // Units #define D_UNIT_AMPERE "A" #define D_UNIT_CENTIMETER "cm" #define D_UNIT_HERTZ "Hz" #define D_UNIT_HOUR "Hr" +#define D_UNIT_GALLONS "gal" +#define D_UNIT_GALLONS_PER_MIN "g/m" #define D_UNIT_INCREMENTS "inc" #define D_UNIT_KILOGRAM "kg" #define D_UNIT_KILOMETER_PER_HOUR "km/h" // or "km/h" diff --git a/sonoff/language/ru-RU.h b/sonoff/language/ru-RU.h index 908e3f2c8..2c39bb456 100644 --- a/sonoff/language/ru-RU.h +++ b/sonoff/language/ru-RU.h @@ -93,6 +93,7 @@ #define D_FALLBACK_TOPIC "Топик обратной связи" #define D_FALSE "Ложно" #define D_FILE "Файл" +#define D_FLOW_RATE "Flow rate" #define D_FREE_MEMORY "Свободная память" #define D_FREQUENCY "Frequency" #define D_GAS "Газ" @@ -148,6 +149,7 @@ #define D_STOP "Стоп" #define D_SUBNET_MASK "Маска Подсети" #define D_SUBSCRIBE_TO "Подписаться на" +#define D_UNSUBSCRIBE_FROM "Unsubscribe from" #define D_SUCCESSFUL "Успешно" #define D_SUNRISE "Sunrise" #define D_SUNSET "Sunset" @@ -155,6 +157,7 @@ #define D_TO "до" #define D_TOGGLE "Переключить" #define D_TOPIC "Топик" +#define D_TOTAL_USAGE "Total Usage" #define D_TRANSMIT "Передать" #define D_TRUE "Истина" #define D_TVOC "TVOC" @@ -219,7 +222,7 @@ // xdrv_02_webserver.ino #define D_NOSCRIPT "To use Tasmota, please enable JavaScript" -#define D_MINIMAL_FIRMWARE_PLEASE_UPGRADE "Прошивка MINIMAL - пожалуйста обновите" +#define D_MINIMAL_FIRMWARE_PLEASE_UPGRADE "Прошивка MINIMAL
пожалуйста обновите" #define D_WEBSERVER_ACTIVE_ON "Веб-сервер активен" #define D_WITH_IP_ADDRESS "с IP-адресом" #define D_WEBSERVER_STOPPED "Веб-сервер остановлен" @@ -289,6 +292,7 @@ #define D_OTHER_PARAMETERS "Параметры Прочие" #define D_TEMPLATE "Template" +#define D_ACTIVATE "Activate" #define D_WEB_ADMIN_PASSWORD "Пароль Web администратора" #define D_MQTT_ENABLE "MQTT активен" #define D_FRIENDLY_NAME "Дружественное Имя" @@ -297,6 +301,14 @@ #define D_SINGLE_DEVICE "одиночное" #define D_MULTI_DEVICE "мульти" +#define D_CONFIGURE_TEMPLATE "Configure Template" +#define D_TEMPLATE_PARAMETERS "Template parameters" +#define D_TEMPLATE_NAME "Name" +#define D_BASE_TYPE "Based on" +#define D_TEMPLATE_FLAGS "Options" +#define D_ALLOW_ADC0 "ADC0 input" +#define D_ALLOW_PULLUP "User pull-up selection" + #define D_SAVE_CONFIGURATION "Сохранить конфигурацию" #define D_CONFIGURATION_SAVED "Конфигурация сохранена " #define D_CONFIGURATION_RESET "Конфигурация сброшена" @@ -482,8 +494,12 @@ #define D_TX20_SOUTH "S" #define D_TX20_WEST "W" +//xsns_43_hre.ino +#define D_LOG_HRE "HRE: " + // sonoff_template.h - keep them as short as possible to be able to fit them in GUI drop down box #define D_SENSOR_NONE "-нет-" +#define D_SENSOR_USER "User" #define D_SENSOR_DHT11 "DHT11" #define D_SENSOR_AM2301 "AM2301" #define D_SENSOR_SI7021 "SI7021" @@ -565,12 +581,16 @@ #define D_SENSOR_TXD "Serial Tx" #define D_SENSOR_RXD "Serial Rx" #define D_SENSOR_ROTARY "Rotary" // Suffix "1A" +#define D_SENSOR_HRE_CLOCK "HRE Clock" +#define D_SENSOR_HRE_DATA "HRE Data" // Units #define D_UNIT_AMPERE "А" #define D_UNIT_CENTIMETER "cm" #define D_UNIT_HERTZ "Hz" #define D_UNIT_HOUR "Ч" +#define D_UNIT_GALLONS "gal" +#define D_UNIT_GALLONS_PER_MIN "g/m" #define D_UNIT_INCREMENTS "inc" #define D_UNIT_KILOGRAM "kg" #define D_UNIT_KILOMETER_PER_HOUR "km/h" // or "km/h" diff --git a/sonoff/language/sk-SK.h b/sonoff/language/sk-SK.h index 42f398a99..a8134677b 100644 --- a/sonoff/language/sk-SK.h +++ b/sonoff/language/sk-SK.h @@ -75,6 +75,7 @@ #define D_COUNTER "Počítadlo" #define D_CURRENT "Prúd" // As in Voltage and Current #define D_DATA "Dáta" +#define D_FLOW_RATE "Flow rate" #define D_DARKLIGHT "Tmavý" #define D_DEBUG "Debug" #define D_DISABLED "Zablokované" @@ -148,6 +149,7 @@ #define D_STOP "Stop" #define D_SUBNET_MASK "Maska podsiete" #define D_SUBSCRIBE_TO "Prihlásiť do" +#define D_UNSUBSCRIBE_FROM "Unsubscribe from" #define D_SUCCESSFUL "úspešné." #define D_SUNRISE "Svitanie" #define D_SUNSET "Súmrak" @@ -155,6 +157,7 @@ #define D_TO "do" #define D_TOGGLE "Prepni" #define D_TOPIC "Topic" +#define D_TOTAL_USAGE "Total Usage" #define D_TRANSMIT "Odošli" #define D_TRUE "Pravda" #define D_TVOC "TVOC" @@ -219,7 +222,7 @@ // xdrv_02_webserver.ino #define D_NOSCRIPT "Pre používanie prostredia Tasmota povoľte JavaScript" -#define D_MINIMAL_FIRMWARE_PLEASE_UPGRADE "Firmware MINIMÁLNY - prosím aktualizujte" +#define D_MINIMAL_FIRMWARE_PLEASE_UPGRADE "Firmware MINIMÁLNY
prosím aktualizujte" #define D_WEBSERVER_ACTIVE_ON "Aktívny Web server" #define D_WITH_IP_ADDRESS "na IP adrese" #define D_WEBSERVER_STOPPED "Web server zastavený" @@ -289,6 +292,7 @@ #define D_OTHER_PARAMETERS "Ostatné nastavenia" #define D_TEMPLATE "Template" +#define D_ACTIVATE "Activate" #define D_WEB_ADMIN_PASSWORD "Heslo Web administrátora" #define D_MQTT_ENABLE "MQTT aktívne" #define D_FRIENDLY_NAME "Friendly Name" @@ -297,6 +301,14 @@ #define D_SINGLE_DEVICE "single device" #define D_MULTI_DEVICE "multi device" +#define D_CONFIGURE_TEMPLATE "Configure Template" +#define D_TEMPLATE_PARAMETERS "Template parameters" +#define D_TEMPLATE_NAME "Name" +#define D_BASE_TYPE "Based on" +#define D_TEMPLATE_FLAGS "Options" +#define D_ALLOW_ADC0 "ADC0 input" +#define D_ALLOW_PULLUP "User pull-up selection" + #define D_SAVE_CONFIGURATION "Ulož nastavenia" #define D_CONFIGURATION_SAVED "Nastavenia uložené" #define D_CONFIGURATION_RESET "Nastavenia resetované" @@ -482,8 +494,12 @@ #define D_TX20_SOUTH "J" #define D_TX20_WEST "Z" +//xsns_43_hre.ino +#define D_LOG_HRE "HRE: " + // sonoff_template.h - keep them as short as possible to be able to fit them in GUI drop down box #define D_SENSOR_NONE "Žiaden" +#define D_SENSOR_USER "User" #define D_SENSOR_DHT11 "DHT11" #define D_SENSOR_AM2301 "AM2301" #define D_SENSOR_SI7021 "SI7021" @@ -565,12 +581,16 @@ #define D_SENSOR_TXD "Serial Tx" #define D_SENSOR_RXD "Serial Rx" #define D_SENSOR_ROTARY "Rotary" // Suffix "1A" +#define D_SENSOR_HRE_CLOCK "HRE Clock" +#define D_SENSOR_HRE_DATA "HRE Data" // Units #define D_UNIT_AMPERE "A" #define D_UNIT_CENTIMETER "cm" #define D_UNIT_HERTZ "Hz" #define D_UNIT_HOUR "hod" +#define D_UNIT_GALLONS "gal" +#define D_UNIT_GALLONS_PER_MIN "g/m" #define D_UNIT_KILOGRAM "kg" #define D_UNIT_INCREMENTS "inc" #define D_UNIT_KILOMETER_PER_HOUR "km/h" // or "km/h" diff --git a/sonoff/language/sv-SE.h b/sonoff/language/sv-SE.h index 088238d37..786d5c766 100644 --- a/sonoff/language/sv-SE.h +++ b/sonoff/language/sv-SE.h @@ -93,6 +93,7 @@ #define D_FALLBACK_TOPIC "Reservämne" #define D_FALSE "Falskt" #define D_FILE "Fil" +#define D_FLOW_RATE "Flow rate" #define D_FREE_MEMORY "Ledigt minne" #define D_FREQUENCY "Frekvens" #define D_GAS "Gas" @@ -148,6 +149,7 @@ #define D_STOP "Stoppa" #define D_SUBNET_MASK "Nätmask" #define D_SUBSCRIBE_TO "Prenumera på" +#define D_UNSUBSCRIBE_FROM "Unsubscribe from" #define D_SUCCESSFUL "Lyckat" #define D_SUNRISE "Soluppgång" #define D_SUNSET "Solnedgång" @@ -155,6 +157,7 @@ #define D_TO "till" #define D_TOGGLE "Växla" #define D_TOPIC "Ämne" +#define D_TOTAL_USAGE "Total Usage" #define D_TRANSMIT "Sänd" #define D_TRUE "Sant" #define D_TVOC "TVOC" @@ -219,7 +222,7 @@ // xdrv_02_webserver.ino #define D_NOSCRIPT "För att använda Tasmota, aktivera JavaScript" -#define D_MINIMAL_FIRMWARE_PLEASE_UPGRADE "MINIMAL firmware - var god uppgradera" +#define D_MINIMAL_FIRMWARE_PLEASE_UPGRADE "MINIMAL firmware
var god uppgradera" #define D_WEBSERVER_ACTIVE_ON "Webbserver aktiv på" #define D_WITH_IP_ADDRESS "med IP-adress" #define D_WEBSERVER_STOPPED "Webbserver stoppad" @@ -289,6 +292,7 @@ #define D_OTHER_PARAMETERS "Andra parametrar" #define D_TEMPLATE "Template" +#define D_ACTIVATE "Activate" #define D_WEB_ADMIN_PASSWORD "Webbadmin-lösenord" #define D_MQTT_ENABLE "MQTT aktivera" #define D_FRIENDLY_NAME "Läsbart namn" @@ -297,6 +301,14 @@ #define D_SINGLE_DEVICE "soloenhet" #define D_MULTI_DEVICE "multienhet" +#define D_CONFIGURE_TEMPLATE "Configure Template" +#define D_TEMPLATE_PARAMETERS "Template parameters" +#define D_TEMPLATE_NAME "Name" +#define D_BASE_TYPE "Based on" +#define D_TEMPLATE_FLAGS "Options" +#define D_ALLOW_ADC0 "ADC0 input" +#define D_ALLOW_PULLUP "User pull-up selection" + #define D_SAVE_CONFIGURATION "Spara konfiguration" #define D_CONFIGURATION_SAVED "Konfiguration sparad" #define D_CONFIGURATION_RESET "Konfiguration nollställd" @@ -482,8 +494,12 @@ #define D_TX20_SOUTH "S" #define D_TX20_WEST "V" +//xsns_43_hre.ino +#define D_LOG_HRE "HRE: " + // sonoff_template.h - keep them as short as possible to be able to fit them in GUI drop down box #define D_SENSOR_NONE "Ingen" +#define D_SENSOR_USER "User" #define D_SENSOR_DHT11 "DHT11" #define D_SENSOR_AM2301 "AM2301" #define D_SENSOR_SI7021 "SI7021" @@ -565,12 +581,16 @@ #define D_SENSOR_TXD "Serial Tx" #define D_SENSOR_RXD "Serial Rx" #define D_SENSOR_ROTARY "Rotary" // Suffix "1A" +#define D_SENSOR_HRE_CLOCK "HRE Clock" +#define D_SENSOR_HRE_DATA "HRE Data" // Units #define D_UNIT_AMPERE "A" #define D_UNIT_CENTIMETER "cm" #define D_UNIT_HERTZ "Hz" #define D_UNIT_HOUR "Tim" +#define D_UNIT_GALLONS "gal" +#define D_UNIT_GALLONS_PER_MIN "g/m" #define D_UNIT_INCREMENTS "ink" #define D_UNIT_KILOGRAM "kg" #define D_UNIT_KILOMETER_PER_HOUR "km/h" // or "km/h" diff --git a/sonoff/language/tr-TR.h b/sonoff/language/tr-TR.h index 73ca99fb5..59cd95023 100755 --- a/sonoff/language/tr-TR.h +++ b/sonoff/language/tr-TR.h @@ -93,6 +93,7 @@ #define D_FALLBACK_TOPIC "Geri İletim Topiği" #define D_FALSE "False" #define D_FILE "Dosya" +#define D_FLOW_RATE "Flow rate" #define D_FREE_MEMORY "Boş Hafıza" #define D_FREQUENCY "Frekans" #define D_GAS "Gas" @@ -148,6 +149,7 @@ #define D_STOP "Durdur" #define D_SUBNET_MASK "Altağ Geçidi Maskesi" #define D_SUBSCRIBE_TO "Abone olunan" +#define D_UNSUBSCRIBE_FROM "Unsubscribe from" #define D_SUCCESSFUL "Başarıyla Tamamlandı" #define D_SUNRISE "Gün doğumu" #define D_SUNSET "Gün batımı" @@ -155,6 +157,7 @@ #define D_TO "den" #define D_TOGGLE "Geçiş Tuşu" #define D_TOPIC "Başlık" +#define D_TOTAL_USAGE "Total Usage" #define D_TRANSMIT "İletim" #define D_TRUE "True" #define D_TVOC "TVOC" @@ -219,7 +222,7 @@ // xdrv_02_webserver.ino #define D_NOSCRIPT "To use Tasmota, please enable JavaScript" -#define D_MINIMAL_FIRMWARE_PLEASE_UPGRADE "Donanım yazılımı çok düşük, lütfen yükseltin" +#define D_MINIMAL_FIRMWARE_PLEASE_UPGRADE "Donanım yazılımı çok düşük
lütfen yükseltin" #define D_WEBSERVER_ACTIVE_ON "Web sunucusu aktif" #define D_WITH_IP_ADDRESS "IP adres ile" #define D_WEBSERVER_STOPPED "Web sunucusu durdu" @@ -289,6 +292,7 @@ #define D_OTHER_PARAMETERS "Diğer parametreler" #define D_TEMPLATE "Template" +#define D_ACTIVATE "Activate" #define D_WEB_ADMIN_PASSWORD "Web Yönetici Şifresi" #define D_MQTT_ENABLE "MQTT aktif" #define D_FRIENDLY_NAME "Kullanıcı Dostu İsim" @@ -297,6 +301,14 @@ #define D_SINGLE_DEVICE "tekli cihaz" #define D_MULTI_DEVICE "çoklu cihaz" +#define D_CONFIGURE_TEMPLATE "Configure Template" +#define D_TEMPLATE_PARAMETERS "Template parameters" +#define D_TEMPLATE_NAME "Name" +#define D_BASE_TYPE "Based on" +#define D_TEMPLATE_FLAGS "Options" +#define D_ALLOW_ADC0 "ADC0 input" +#define D_ALLOW_PULLUP "User pull-up selection" + #define D_SAVE_CONFIGURATION "Ayarları Kaydet" #define D_CONFIGURATION_SAVED "Ayarlar kaydedildi" #define D_CONFIGURATION_RESET "Ayarlar resetlendi" @@ -482,8 +494,12 @@ #define D_TX20_SOUTH "S" #define D_TX20_WEST "W" +//xsns_43_hre.ino +#define D_LOG_HRE "HRE: " + // sonoff_template.h - keep them as short as possible to be able to fit them in GUI drop down box #define D_SENSOR_NONE "None" +#define D_SENSOR_USER "User" #define D_SENSOR_DHT11 "DHT11" #define D_SENSOR_AM2301 "AM2301" #define D_SENSOR_SI7021 "SI7021" @@ -565,11 +581,15 @@ #define D_SENSOR_TXD "Serial Tx" #define D_SENSOR_RXD "Serial Rx" #define D_SENSOR_ROTARY "Rotary" // Suffix "1A" +#define D_SENSOR_HRE_CLOCK "HRE Clock" +#define D_SENSOR_HRE_DATA "HRE Data" // Units #define D_UNIT_AMPERE "A" #define D_UNIT_CENTIMETER "cm" #define D_UNIT_HOUR "Hr" +#define D_UNIT_GALLONS "gal" +#define D_UNIT_GALLONS_PER_MIN "g/m" #define D_UNIT_INCREMENTS "inc" #define D_UNIT_KILOGRAM "kg" #define D_UNIT_KILOMETER_PER_HOUR "km/h" // or "km/h" diff --git a/sonoff/language/uk-UK.h b/sonoff/language/uk-UK.h index f6c080c1e..4cceb18a6 100644 --- a/sonoff/language/uk-UK.h +++ b/sonoff/language/uk-UK.h @@ -93,6 +93,7 @@ #define D_FALLBACK_TOPIC "Топік зворотнього зв'язку" #define D_FALSE "Помилково" #define D_FILE "Файл" +#define D_FLOW_RATE "Flow rate" #define D_FREE_MEMORY "Вільна память" #define D_FREQUENCY "Частота" #define D_GAS "Газ" @@ -148,6 +149,7 @@ #define D_STOP "Стоп" #define D_SUBNET_MASK "Маска Підмережі" #define D_SUBSCRIBE_TO "Підписатись на" +#define D_UNSUBSCRIBE_FROM "Unsubscribe from" #define D_SUCCESSFUL "Успішно" #define D_SUNRISE "Схід сонця" #define D_SUNSET "Захід сонця" @@ -155,6 +157,7 @@ #define D_TO "до" #define D_TOGGLE "Перекл." #define D_TOPIC "Топік" +#define D_TOTAL_USAGE "Total Usage" #define D_TRANSMIT "Передати" #define D_TRUE "Істина" #define D_TVOC "TVOC" @@ -219,7 +222,7 @@ // xdrv_02_webserver.ino #define D_NOSCRIPT "To use Tasmota, please enable JavaScript" -#define D_MINIMAL_FIRMWARE_PLEASE_UPGRADE "Прошивка MINIMAL - будь-ласка оновіть" +#define D_MINIMAL_FIRMWARE_PLEASE_UPGRADE "Прошивка MINIMAL
будь-ласка оновіть" #define D_WEBSERVER_ACTIVE_ON "Веб-сервер активний" #define D_WITH_IP_ADDRESS "з IP-адресом" #define D_WEBSERVER_STOPPED "Веб-сервер зупинений" @@ -289,6 +292,7 @@ #define D_OTHER_PARAMETERS "Параметри Інше" #define D_TEMPLATE "Template" +#define D_ACTIVATE "Activate" #define D_WEB_ADMIN_PASSWORD "Гасло Web адміністратора" #define D_MQTT_ENABLE "MQTT активний" #define D_FRIENDLY_NAME "Дружнє Ім'я" @@ -297,6 +301,14 @@ #define D_SINGLE_DEVICE "одиночне" #define D_MULTI_DEVICE "мульти" +#define D_CONFIGURE_TEMPLATE "Configure Template" +#define D_TEMPLATE_PARAMETERS "Template parameters" +#define D_TEMPLATE_NAME "Name" +#define D_BASE_TYPE "Based on" +#define D_TEMPLATE_FLAGS "Options" +#define D_ALLOW_ADC0 "ADC0 input" +#define D_ALLOW_PULLUP "User pull-up selection" + #define D_SAVE_CONFIGURATION "Зберегти конфігурацію" #define D_CONFIGURATION_SAVED "Конфігурація збережена " #define D_CONFIGURATION_RESET "Конфігурація скинута" @@ -482,8 +494,12 @@ #define D_TX20_SOUTH "S" #define D_TX20_WEST "W" +//xsns_43_hre.ino +#define D_LOG_HRE "HRE: " + // sonoff_template.h - keep them as short as possible to be able to fit them in GUI drop down box #define D_SENSOR_NONE "-відсутньо-" +#define D_SENSOR_USER "User" #define D_SENSOR_DHT11 "DHT11" #define D_SENSOR_AM2301 "AM2301" #define D_SENSOR_SI7021 "SI7021" @@ -565,12 +581,16 @@ #define D_SENSOR_TXD "Serial Tx" #define D_SENSOR_RXD "Serial Rx" #define D_SENSOR_ROTARY "Rotary" // Suffix "1A" +#define D_SENSOR_HRE_CLOCK "HRE Clock" +#define D_SENSOR_HRE_DATA "HRE Data" // Units #define D_UNIT_AMPERE "А" #define D_UNIT_CENTIMETER "cм" #define D_UNIT_HERTZ "Гц" #define D_UNIT_HOUR "Г" +#define D_UNIT_GALLONS "gal" +#define D_UNIT_GALLONS_PER_MIN "g/m" #define D_UNIT_INCREMENTS "inc" #define D_UNIT_KILOGRAM "kg" #define D_UNIT_KILOMETER_PER_HOUR "km/h" // or "km/h" diff --git a/sonoff/language/zh-CN.h b/sonoff/language/zh-CN.h index 646db7a91..9612b370a 100644 --- a/sonoff/language/zh-CN.h +++ b/sonoff/language/zh-CN.h @@ -65,7 +65,7 @@ #define D_BY "汉化: killadm 作者:" // Written by me #define D_BYTES "大小:" #define D_CELSIUS "摄氏" -#define D_CHANNEL "Channel" +#define D_CHANNEL "频道" #define D_CO2 "二氧化碳" #define D_CODE "代码" // Button code #define D_COLDLIGHT "冷" @@ -93,6 +93,7 @@ #define D_FALLBACK_TOPIC "回退主题" #define D_FALSE "False" #define D_FILE "文件:" +#define D_FLOW_RATE "Flow rate" #define D_FREE_MEMORY "空闲内存" #define D_FREQUENCY "频率" #define D_GAS "气体" @@ -132,7 +133,7 @@ #define D_PROGRAM_FLASH_SIZE "固件 Flash 大小" #define D_PROGRAM_SIZE "固件大小" #define D_PROJECT "项目:" -#define D_RAIN "Rain" +#define D_RAIN "降水量" #define D_RECEIVED "已接收" #define D_RESTART "重启" #define D_RESTARTING "正在重启" @@ -148,6 +149,7 @@ #define D_STOP "停止" #define D_SUBNET_MASK "子网掩码" #define D_SUBSCRIBE_TO "订阅" +#define D_UNSUBSCRIBE_FROM "退订" #define D_SUCCESSFUL "成功" #define D_SUNRISE "日出" #define D_SUNSET "日落" @@ -155,6 +157,7 @@ #define D_TO "to" #define D_TOGGLE "切换" #define D_TOPIC "主题" +#define D_TOTAL_USAGE "Total Usage" #define D_TRANSMIT "发送" #define D_TRUE "True" #define D_TVOC "TVOC" @@ -164,18 +167,18 @@ #define D_USER "用户名" #define D_UTC_TIME "UTC" #define D_UV_INDEX "紫外线指数" -#define D_UV_INDEX_1 "Low" -#define D_UV_INDEX_2 "Mid" -#define D_UV_INDEX_3 "High" -#define D_UV_INDEX_4 "Danger" +#define D_UV_INDEX_1 "低" +#define D_UV_INDEX_2 "中" +#define D_UV_INDEX_3 "高" +#define D_UV_INDEX_4 "危险" #define D_UV_INDEX_5 "BurnL1/2" #define D_UV_INDEX_6 "BurnL3" #define D_UV_INDEX_7 "OoR" #define D_UV_LEVEL "紫外线水平" -#define D_UV_POWER "UV Power" +#define D_UV_POWER "紫外线功率 " #define D_VERSION "版本" #define D_VOLTAGE "电压" -#define D_WEIGHT "Weight" +#define D_WEIGHT "重量" #define D_WARMLIGHT "暖" #define D_WEB_SERVER "Web Server" @@ -218,8 +221,8 @@ #define D_ERASED_SECTOR "擦除扇区" // webserver.ino -#define D_NOSCRIPT "To use Tasmota, please enable JavaScript" -#define D_MINIMAL_FIRMWARE_PLEASE_UPGRADE "当前是精简版固件 - 请升级" +#define D_NOSCRIPT "Tasmota要求浏览器支持 JavaScript" +#define D_MINIMAL_FIRMWARE_PLEASE_UPGRADE "当前是精简版固件
请升级" #define D_WEBSERVER_ACTIVE_ON "Web 服务器地址:" #define D_WITH_IP_ADDRESS "IP 地址:" #define D_WEBSERVER_STOPPED "Web 服务已停止" @@ -253,7 +256,7 @@ #define D_MODULE_PARAMETERS "模块设置" #define D_MODULE_TYPE "模块类型" -#define D_PULLUP_ENABLE "No Button/Switch pull-up" +#define D_PULLUP_ENABLE "没有按钮/开关上拉" #define D_GPIO "GPIO" #define D_SERIAL_IN "串口输入(RX)" #define D_SERIAL_OUT "串口输出(TX)" @@ -288,7 +291,8 @@ #define D_TELEMETRY_PERIOD "上报周期" #define D_OTHER_PARAMETERS "其他设置" -#define D_TEMPLATE "Template" +#define D_TEMPLATE "模板" +#define D_ACTIVATE "启用" #define D_WEB_ADMIN_PASSWORD "WEB 管理密码" #define D_MQTT_ENABLE "启用MQTT" #define D_FRIENDLY_NAME "昵称" @@ -297,6 +301,14 @@ #define D_SINGLE_DEVICE "单设备" #define D_MULTI_DEVICE "多设备" +#define D_CONFIGURE_TEMPLATE "模板配置" +#define D_TEMPLATE_PARAMETERS "模板参数" +#define D_TEMPLATE_NAME "名称" +#define D_BASE_TYPE "基于" +#define D_TEMPLATE_FLAGS "选项" +#define D_ALLOW_ADC0 "ADC0 输入" +#define D_ALLOW_PULLUP "用户上拉选择" + #define D_SAVE_CONFIGURATION "保存设置" #define D_CONFIGURATION_SAVED "设置已保存" #define D_CONFIGURATION_RESET "设置已重置" @@ -452,38 +464,42 @@ #define D_PARTICALS_BEYOND "颗粒物直径大于" // xsns_32_mpu6050.ino -#define D_AX_AXIS "Accel. X-Axis" -#define D_AY_AXIS "Accel. Y-Axis" -#define D_AZ_AXIS "Accel. Z-Axis" -#define D_GX_AXIS "Gyro X-Axis" -#define D_GY_AXIS "Gyro Y-Axis" -#define D_GZ_AXIS "Gyro Z-Axis" +#define D_AX_AXIS "加速度计X轴分量" +#define D_AY_AXIS "加速度计Y轴分量" +#define D_AZ_AXIS "加速度计Z轴分量" +#define D_GX_AXIS "绕X轴旋转的角速度" +#define D_GY_AXIS "绕Y轴旋转的角速度" +#define D_GZ_AXIS "绕Z轴旋转的角速度" // xsns_34_hx711.ino -#define D_HX_CAL_REMOVE "Remove weigth" -#define D_HX_CAL_REFERENCE "Load reference weigth" -#define D_HX_CAL_DONE "Calibrated" -#define D_HX_CAL_FAIL "Calibration failed" -#define D_RESET_HX711 "Reset Scale" -#define D_CONFIGURE_HX711 "Configure Scale" -#define D_HX711_PARAMETERS "Scale parameters" -#define D_ITEM_WEIGHT "Item weight" -#define D_REFERENCE_WEIGHT "Reference weigth" -#define D_CALIBRATE "Calibrate" -#define D_CALIBRATION "Calibration" +#define D_HX_CAL_REMOVE "去除重量" +#define D_HX_CAL_REFERENCE "加载参考重量" +#define D_HX_CAL_DONE "已校准" +#define D_HX_CAL_FAIL "校准失败" +#define D_RESET_HX711 "秤重置" +#define D_CONFIGURE_HX711 "秤配置" +#define D_HX711_PARAMETERS "秤参数" +#define D_ITEM_WEIGHT "物品中粮" +#define D_REFERENCE_WEIGHT "参考重量" +#define D_CALIBRATE "校准" +#define D_CALIBRATION "校准" //xsns_35_tx20.ino -#define D_TX20_WIND_DIRECTION "Wind Direction" -#define D_TX20_WIND_SPEED "Wind Speed" -#define D_TX20_WIND_SPEED_AVG "Wind Speed Avg" -#define D_TX20_WIND_SPEED_MAX "Wind Speed Max" -#define D_TX20_NORTH "N" -#define D_TX20_EAST "E" -#define D_TX20_SOUTH "S" -#define D_TX20_WEST "W" +#define D_TX20_WIND_DIRECTION "风向" +#define D_TX20_WIND_SPEED "风速" +#define D_TX20_WIND_SPEED_AVG "平均风速" +#define D_TX20_WIND_SPEED_MAX "最高风速" +#define D_TX20_NORTH "北" +#define D_TX20_EAST "东" +#define D_TX20_SOUTH "南" +#define D_TX20_WEST "西" + +//xsns_43_hre.ino +#define D_LOG_HRE "HRE: " // sonoff_template.h - keep them as short as possible to be able to fit them in GUI drop down box #define D_SENSOR_NONE "无" +#define D_SENSOR_USER "User" #define D_SENSOR_DHT11 "DHT11" #define D_SENSOR_AM2301 "AM2301" #define D_SENSOR_SI7021 "SI7021" @@ -565,14 +581,18 @@ #define D_SENSOR_TXD "Serial Tx" #define D_SENSOR_RXD "Serial Rx" #define D_SENSOR_ROTARY "Rotary" // Suffix "1A" +#define D_SENSOR_HRE_CLOCK "HRE Clock" +#define D_SENSOR_HRE_DATA "HRE Data" // Units #define D_UNIT_AMPERE "安" #define D_UNIT_CENTIMETER "厘米" #define D_UNIT_HOUR "时" +#define D_UNIT_GALLONS "gal" +#define D_UNIT_GALLONS_PER_MIN "g/m" #define D_UNIT_INCREMENTS "inc" -#define D_UNIT_KILOGRAM "kg" -#define D_UNIT_KILOMETER_PER_HOUR "km/h" // or "km/h" +#define D_UNIT_KILOGRAM "千克" +#define D_UNIT_KILOMETER_PER_HOUR "公里/时" // or "km/h" #define D_UNIT_KILOOHM "千欧" #define D_UNIT_KILOWATTHOUR "千瓦时" #define D_UNIT_LUX "勒克斯" @@ -580,8 +600,8 @@ #define D_UNIT_MICROMETER "微米" #define D_UNIT_MICROSECOND "微秒" #define D_UNIT_MILLIAMPERE "毫安" -#define D_UNIT_MILLIMETER "mm" -#define D_UNIT_MILLIMETER_MERCURY "mmHg" +#define D_UNIT_MILLIMETER "毫米" +#define D_UNIT_MILLIMETER_MERCURY "毫米汞柱" #define D_UNIT_MILLISECOND "毫秒" #define D_UNIT_MINUTE "分" #define D_UNIT_PARTS_PER_BILLION "ppb" @@ -590,13 +610,13 @@ #define D_UNIT_PRESSURE "百帕" #define D_UNIT_SECOND "秒" #define D_UNIT_SECTORS "扇区" -#define D_UNIT_VA "VA" -#define D_UNIT_VAR "VAr" +#define D_UNIT_VA "伏安" +#define D_UNIT_VAR "无功伏安" #define D_UNIT_VOLT "伏" #define D_UNIT_WATT "瓦" #define D_UNIT_WATTHOUR "瓦时" #define D_UNIT_HERTZ "赫兹" -#define D_UNIT_WATT_METER_QUADRAT "W/m²" +#define D_UNIT_WATT_METER_QUADRAT "瓦/平米" // Log message prefix #define D_LOG_APPLICATION "APP: " // Application @@ -624,13 +644,13 @@ #define D_LOG_WIFI "WIF: " // Wifi //SDM220 -#define D_PHASE_ANGLE "Phase Angle" -#define D_IMPORT_ACTIVE "Import Active" -#define D_EXPORT_ACTIVE "Export Active" -#define D_IMPORT_REACTIVE "Import Reactive" -#define D_EXPORT_REACTIVE "Export Reactive" -#define D_TOTAL_REACTIVE "Total Reactive" -#define D_UNIT_KWARH "kVArh" -#define D_UNIT_ANGLE "Deg" +#define D_PHASE_ANGLE "相位角" +#define D_IMPORT_ACTIVE "有功输入" +#define D_EXPORT_ACTIVE "有功输出" +#define D_IMPORT_REACTIVE "无功输入" +#define D_EXPORT_REACTIVE "无功输出" +#define D_TOTAL_REACTIVE "总无功功率" +#define D_UNIT_KWARH "千乏时" +#define D_UNIT_ANGLE "度" #endif // _LANGUAGE_ZH_CN_H_ diff --git a/sonoff/language/zh-TW.h b/sonoff/language/zh-TW.h index 22bec6b99..0a1f8ed03 100644 --- a/sonoff/language/zh-TW.h +++ b/sonoff/language/zh-TW.h @@ -93,6 +93,7 @@ #define D_FALLBACK_TOPIC "Fallback Topic" #define D_FALSE "False" #define D_FILE "文件:" +#define D_FLOW_RATE "Flow rate" #define D_FREE_MEMORY "可用記憶體" #define D_FREQUENCY "Frequency" #define D_GAS "氣體" @@ -148,6 +149,7 @@ #define D_STOP "停止" #define D_SUBNET_MASK "子網遮罩" #define D_SUBSCRIBE_TO "訂閱" +#define D_UNSUBSCRIBE_FROM "退訂" #define D_SUCCESSFUL "成功" #define D_SUNRISE "Sunrise" #define D_SUNSET "Sunset" @@ -155,6 +157,7 @@ #define D_TO "to" #define D_TOGGLE "切換" #define D_TOPIC "主題" +#define D_TOTAL_USAGE "Total Usage" #define D_TRANSMIT "發送" #define D_TRUE "True" #define D_TVOC "TVOC" @@ -219,7 +222,7 @@ // xdrv_02_webserver.ino #define D_NOSCRIPT "To use Tasmota, please enable JavaScript" -#define D_MINIMAL_FIRMWARE_PLEASE_UPGRADE "固件版本過低 - 請升級" +#define D_MINIMAL_FIRMWARE_PLEASE_UPGRADE "固件版本過低
請升級" #define D_WEBSERVER_ACTIVE_ON "Web服務器:" #define D_WITH_IP_ADDRESS "IP地址:" #define D_WEBSERVER_STOPPED "Web 服務器已停止" @@ -289,6 +292,7 @@ #define D_OTHER_PARAMETERS "其他設置" #define D_TEMPLATE "Template" +#define D_ACTIVATE "Activate" #define D_WEB_ADMIN_PASSWORD "WEB管理密碼" #define D_MQTT_ENABLE "啟用MQTT" #define D_FRIENDLY_NAME "昵稱" @@ -297,6 +301,14 @@ #define D_SINGLE_DEVICE "單設備" #define D_MULTI_DEVICE "多設備" +#define D_CONFIGURE_TEMPLATE "Configure Template" +#define D_TEMPLATE_PARAMETERS "Template parameters" +#define D_TEMPLATE_NAME "Name" +#define D_BASE_TYPE "Based on" +#define D_TEMPLATE_FLAGS "Options" +#define D_ALLOW_ADC0 "ADC0 input" +#define D_ALLOW_PULLUP "User pull-up selection" + #define D_SAVE_CONFIGURATION "保存設置" #define D_CONFIGURATION_SAVED "設置已保存" #define D_CONFIGURATION_RESET "設置已重置" @@ -482,8 +494,12 @@ #define D_TX20_SOUTH "S" #define D_TX20_WEST "W" +//xsns_43_hre.ino +#define D_LOG_HRE "HRE: " + // sonoff_template.h - keep them as short as possible to be able to fit them in GUI drop down box #define D_SENSOR_NONE "None" +#define D_SENSOR_USER "User" #define D_SENSOR_DHT11 "DHT11" #define D_SENSOR_AM2301 "AM2301" #define D_SENSOR_SI7021 "SI7021" @@ -565,12 +581,16 @@ #define D_SENSOR_TXD "Serial Tx" #define D_SENSOR_RXD "Serial Rx" #define D_SENSOR_ROTARY "Rotary" // Suffix "1A" +#define D_SENSOR_HRE_CLOCK "HRE Clock" +#define D_SENSOR_HRE_DATA "HRE Data" // Units #define D_UNIT_AMPERE "安" #define D_UNIT_CENTIMETER "cm" #define D_UNIT_HERTZ "Hz" #define D_UNIT_HOUR "時" +#define D_UNIT_GALLONS "gal" +#define D_UNIT_GALLONS_PER_MIN "g/m" #define D_UNIT_INCREMENTS "inc" #define D_UNIT_KILOGRAM "kg" #define D_UNIT_KILOMETER_PER_HOUR "km/h" // or "km/h" diff --git a/sonoff/my_user_config.h b/sonoff/my_user_config.h index 3029a3dc4..5ba994a4b 100644 --- a/sonoff/my_user_config.h +++ b/sonoff/my_user_config.h @@ -122,6 +122,7 @@ // -- MQTT - Telemetry ---------------------------- #define TELE_PERIOD 300 // [TelePeriod] Telemetry (0 = disable, 10 - 3600 seconds) +#define TELE_ON_POWER 0 // [SetOption59] send tele/STATE together with stat/RESULT (0 = Disable, 1 = Enable) // -- MQTT - Domoticz ----------------------------- #define DOMOTICZ_UPDATE_TIMER 0 // [DomoticzUpdateTimer] Send relay status (0 = disable, 1 - 3600 seconds) @@ -203,11 +204,12 @@ //#define MY_LANGUAGE de-DE // German in Germany //#define MY_LANGUAGE el-GR // Greek in Greece //#define MY_LANGUAGE en-GB // English in Great Britain. Enabled by Default -//#define MY_LANGUAGE es-AR // Spanish in Argentina +//#define MY_LANGUAGE es-ES // Spanish in Spain //#define MY_LANGUAGE fr-FR // French in France //#define MY_LANGUAGE he-HE // Hebrew in Israel //#define MY_LANGUAGE hu-HU // Hungarian in Hungary //#define MY_LANGUAGE it-IT // Italian in Italy +//#define MY_LANGUAGE ko-KO // Korean in Korea //#define MY_LANGUAGE nl-NL // Dutch in the Netherlands //#define MY_LANGUAGE pl-PL // Polish in Poland //#define MY_LANGUAGE pt-BR // Portuguese in Brazil @@ -228,16 +230,6 @@ // -- OTA ----------------------------------------- //#define USE_ARDUINO_OTA // Add optional support for Arduino OTA (+13k code) -/*-------------------------------------------------------------------------------------------*\ - * Select ONE of possible MQTT library types below -\*-------------------------------------------------------------------------------------------*/ - // Default MQTT driver for both non-TLS and TLS connections. Latest library version (20181016) does not block network if MQTT server is unavailable. -#define MQTT_LIBRARY_TYPE MQTT_PUBSUBCLIENT // Use PubSubClient library - // Alternative MQTT driver does not block network when MQTT server is unavailable. No TLS support -//#define MQTT_LIBRARY_TYPE MQTT_TASMOTAMQTT // Use TasmotaMqtt library (+4k4 (core 2.3.0), +14k4 (core 2.4.2 lwip2) code, +4k mem) - non-TLS only - // Alternative MQTT driver does not block network when MQTT server is unavailable. TLS should work but needs to be tested. -//#define MQTT_LIBRARY_TYPE MQTT_ARDUINOMQTT // Use arduino-mqtt (lwmqtt) library (+3k3 code, +2k mem) - // -- MQTT ---------------------------------------- #define MQTT_TELE_RETAIN 0 // Tele messages may send retain flag (0 = off, 1 = on) @@ -247,7 +239,7 @@ #define DOMOTICZ_OUT_TOPIC "domoticz/out" // Domoticz Output Topic // -- MQTT - Home Assistant Discovery ------------- -#define USE_HOME_ASSISTANT // Enable Home Assistant Discovery Support (+2k code) +#define USE_HOME_ASSISTANT // Enable Home Assistant Discovery Support (+7k code) #define HOME_ASSISTANT_DISCOVERY_PREFIX "homeassistant" // Home Assistant discovery prefix // -- MQTT - TLS ---------------------------------- @@ -278,6 +270,8 @@ // -- Rules --------------------------------------- #define USE_RULES // Add support for rules (+4k4 code) +// #define USE_EXPRESSION // Add support for expression evaluation in rules (+3k2 code, +64 bytes mem) +// #define SUPPORT_MQTT_EVENT // Support trigger event with MQTT subscriptions (+3k5 code) // -- Internal Analog input ----------------------- #define USE_ADC_VCC // Display Vcc in Power status. Disable for use as Analog input on selected devices @@ -287,7 +281,7 @@ //#define USE_DS18x20_LEGACY // Optional for more than one DS18x20 sensors with dynamic scan using library OneWire (+1k5 code) #define USE_DS18x20 // Optional for more than one DS18x20 sensors with id sort, single scan and read retry (+1k3 code) // #define W1_PARASITE_POWER // If using USE_DS18x20 then optimize for parasite powered sensors -// #define DS18B20_INTERNAL_PULLUP // Use INPUT_PULLUP internal pullup resistors for single DS18B20 +// #define DS18B20_INTERNAL_PULLUP // Use INPUT_PULLUP internal pullup resistors for single DS18B20 // -- I2C sensors --------------------------------- #define USE_I2C // I2C using library wire (+10k code, 0k2 mem, 124 iram) @@ -327,6 +321,7 @@ // #define USE_RTC_ADDR 0x68 // Default I2C address 0x68 // #define USE_MGC3130 // Enable MGC3130 Electric Field Effect Sensor (I2C address 0x42) (+2k7 code, 0k3 mem) // #define USE_MAX44009 // Enable MAX44009 Ambient Light sensor (I2C addresses 0x4A and 0x4B) (+0k8 code) +// #define USE_SCD30 // Enable Sensiron SCd30 CO2 sensor (I2C address 0x61) (+3k3 code) // #define USE_DISPLAY // Add I2C Display Support (+2k code) #define USE_DISPLAY_MODES1TO5 // Enable display mode 1 to 5 in addition to mode 0 @@ -420,6 +415,8 @@ #define USE_SM16716 // Add support for SM16716 RGB LED controller (+0k7 code) +//#define USE_HRE // Add support for Badger HR-E Water Meter (+1k4 code) + /*********************************************************************************************\ * Debug features are only supported in development branch \*********************************************************************************************/ diff --git a/sonoff/settings.h b/sonoff/settings.h index 1698c582e..329b152f4 100644 --- a/sonoff/settings.h +++ b/sonoff/settings.h @@ -20,62 +20,62 @@ #ifndef _SETTINGS_H_ #define _SETTINGS_H_ -#define PARAM8_SIZE 18 // Number of param bytes (SetOption) +const uint8_t PARAM8_SIZE = 18; // Number of param bytes (SetOption) typedef union { // Restricted by MISRA-C Rule 18.4 but so useful... uint32_t data; // Allow bit manipulation using SetOption struct { // SetOption0 .. SetOption31 - uint32_t save_state : 1; // bit 0 - uint32_t button_restrict : 1; // bit 1 - uint32_t value_units : 1; // bit 2 - uint32_t mqtt_enabled : 1; // bit 3 - uint32_t mqtt_response : 1; // bit 4 - uint32_t mqtt_power_retain : 1; // CMND_POWERRETAIN - uint32_t mqtt_button_retain : 1; // CMND_BUTTONRETAIN - uint32_t mqtt_switch_retain : 1; // CMND_SWITCHRETAIN - uint32_t temperature_conversion : 1; // bit 8 - uint32_t mqtt_sensor_retain : 1; // CMND_SENSORRETAIN - uint32_t mqtt_offline : 1; // bit 10 - uint32_t button_swap : 1; // bit 11 (v5.1.6) - uint32_t stop_flash_rotate : 1; // bit 12 (v5.2.0) - uint32_t button_single : 1; // bit 13 (v5.4.0) - uint32_t interlock : 1; // bit 14 (v5.6.0) - uint32_t pwm_control : 1; // bit 15 (v5.8.1) - uint32_t ws_clock_reverse : 1; // bit 16 (v5.8.1) - uint32_t decimal_text : 1; // bit 17 (v5.8.1) - uint32_t light_signal : 1; // bit 18 (v5.10.0c) - uint32_t hass_discovery : 1; // bit 19 (v5.11.1a) - uint32_t not_power_linked : 1; // bit 20 (v5.11.1f) - uint32_t no_power_on_check : 1; // bit 21 (v5.11.1i) - uint32_t mqtt_serial : 1; // bit 22 (v5.12.0f) - uint32_t mqtt_serial_raw : 1; // bit 23 (v6.1.1c) // Was rules_enabled until 5.14.0b - uint32_t pressure_conversion : 1; // bit 24 (v6.3.0.2) // Was rules_once until 5.14.0b - uint32_t knx_enabled : 1; // bit 25 (v5.12.0l) KNX - uint32_t device_index_enable : 1; // bit 26 (v5.13.1a) - uint32_t knx_enable_enhancement : 1; // bit 27 (v5.14.0a) KNX - uint32_t rf_receive_decimal : 1; // bit 28 (v6.0.0a) - uint32_t ir_receive_decimal : 1; // bit 29 (v6.0.0a) - uint32_t hass_light : 1; // bit 30 (v6.0.0b) - uint32_t global_state : 1; // bit 31 (v6.1.0) + uint32_t save_state : 1; // bit 0 - SetOption0 - Save power state and use after restart + uint32_t button_restrict : 1; // bit 1 - SetOption1 - Control button multipress + uint32_t value_units : 1; // bit 2 - SetOption2 - Add units to JSON status messages + uint32_t mqtt_enabled : 1; // bit 3 - SetOption3 - Control MQTT + uint32_t mqtt_response : 1; // bit 4 - SetOption4 - Switch between MQTT RESULT or COMMAND + uint32_t mqtt_power_retain : 1; // bit 5 - CMND_POWERRETAIN + uint32_t mqtt_button_retain : 1; // bit 6 - CMND_BUTTONRETAIN + uint32_t mqtt_switch_retain : 1; // bit 7 - CMND_SWITCHRETAIN + uint32_t temperature_conversion : 1; // bit 8 - SetOption8 - Switch between Celsius or Fahrenheit + uint32_t mqtt_sensor_retain : 1; // bit 9 - CMND_SENSORRETAIN + uint32_t mqtt_offline : 1; // bit 10 - SetOption10 - Control MQTT LWT message format + uint32_t button_swap : 1; // bit 11 (v5.1.6) - SetOption11 - Swap button single and double press functionality + uint32_t stop_flash_rotate : 1; // bit 12 (v5.2.0) - SetOption12 - Switch between dynamic or fixed slot flash save location + uint32_t button_single : 1; // bit 13 (v5.4.0) - SetOption13 - Support only single press to speed up button press recognition + uint32_t interlock : 1; // bit 14 (v5.6.0) - CMND_INTERLOCK + uint32_t pwm_control : 1; // bit 15 (v5.8.1) - SetOption15 - Switch between commands PWM or COLOR/DIMMER/CT/CHANNEL + uint32_t ws_clock_reverse : 1; // bit 16 (v5.8.1) - SetOption16 - Switch between clockwise or counter-clockwise + uint32_t decimal_text : 1; // bit 17 (v5.8.1) - SetOption17 - Switch between decimal or hexadecimal output + uint32_t light_signal : 1; // bit 18 (v5.10.0c) - SetOption18 - Pair light signal with CO2 sensor + uint32_t hass_discovery : 1; // bit 19 (v5.11.1a) - SetOption19 - Control Home Assistantautomatic discovery (See SetOption59) + uint32_t not_power_linked : 1; // bit 20 (v5.11.1f) - SetOption20 - Control power in relation to Dimmer/Color/Ct changes + uint32_t no_power_on_check : 1; // bit 21 (v5.11.1i) - SetOption21 - Show voltage even if powered off + uint32_t mqtt_serial : 1; // bit 22 (v5.12.0f) - CMND_SERIALSEND and CMND_SERIALLOG + uint32_t mqtt_serial_raw : 1; // bit 23 (v6.1.1c) - CMND_SERIALSEND3 + uint32_t pressure_conversion : 1; // bit 24 (v6.3.0.2) - SetOption24 - Switch between hPa or mmHg pressure unit + uint32_t knx_enabled : 1; // bit 25 (v5.12.0l) - CMND_KNX_ENABLED + uint32_t device_index_enable : 1; // bit 26 (v5.13.1a) - SetOption26 - Switch between POWER or POWER1 + uint32_t knx_enable_enhancement : 1; // bit 27 (v5.14.0a) - CMND_KNX_ENHANCED + uint32_t rf_receive_decimal : 1; // bit 28 (v6.0.0a) - SetOption28 - RF receive data format + uint32_t ir_receive_decimal : 1; // bit 29 (v6.0.0a) - SetOption29 - IR receive data format + uint32_t hass_light : 1; // bit 30 (v6.0.0b) - SetOption30 - Enforce HAss autodiscovery as light + uint32_t global_state : 1; // bit 31 (v6.1.0) - SetOption31 - Control link led blinking }; } SysBitfield; typedef union { // Restricted by MISRA-C Rule 18.4 but so useful... uint32_t data; // Allow bit manipulation using SetOption struct { // SetOption50 .. SetOption81 - uint32_t timers_enable : 1; // bit 0 (v6.1.1b) - uint32_t user_esp8285_enable : 1; // bit 1 (v6.1.1.14) - uint32_t time_append_timezone : 1; // bit 2 (v6.2.1.2) - uint32_t gui_hostname_ip : 1; // bit 3 (v6.2.1.20) - uint32_t tuya_apply_o20 : 1; // bit 4 (v6.3.0.4) - uint32_t mdns_enabled : 1; // bit 5 (v6.4.1.4) - SetOption55 - uint32_t use_wifi_scan : 1; // bit 6 (v6.3.0.10) - uint32_t use_wifi_rescan : 1; // bit 7 (v6.3.0.10) - uint32_t receive_raw : 1; // bit 8 (v6.3.0.11) - uint32_t hass_tele_on_power : 1; // bit 9 (v6.3.0.13) + uint32_t timers_enable : 1; // bit 0 (v6.1.1b) - CMND_TIMERS + uint32_t user_esp8285_enable : 1; // bit 1 (v6.1.1.14) - SetOption51 - Enable ESP8285 user GPIO's + uint32_t time_append_timezone : 1; // bit 2 (v6.2.1.2) - SetOption52 - Append timezone to JSON time + uint32_t gui_hostname_ip : 1; // bit 3 (v6.2.1.20) - SetOption53 - Show hostanme and IP address in GUI main menu + uint32_t tuya_apply_o20 : 1; // bit 4 (v6.3.0.4) - SetOption54 - Apply SetOption20 settings to Tuya device + uint32_t mdns_enabled : 1; // bit 5 (v6.4.1.4) - SetOption55 - Control mDNS service + uint32_t use_wifi_scan : 1; // bit 6 (v6.3.0.10) - SetOption56 - Scan wifi network at restart for configured AP's + uint32_t use_wifi_rescan : 1; // bit 7 (v6.3.0.10) - SetOption57 - Scan wifi network every 44 minutes for configured AP's + uint32_t receive_raw : 1; // bit 8 (v6.3.0.11) - SetOption58 - Add IR Raw data to JSON message + uint32_t hass_tele_on_power : 1; // bit 9 (v6.3.0.13) - SetOption59 - Send tele/%topic%/STATE in addition to stat/%topic%/RESULT uint32_t sleep_normal : 1; // bit 10 (v6.3.0.15) - SetOption60 - Enable normal sleep instead of dynamic sleep uint32_t button_switch_force_local : 1;// bit 11 (v6.3.0.16) - SetOption61 - Force local operation when button/switch topic is set - uint32_t no_pullup : 1; // bit 12 (v6.4.1.7) - SetOption62 - Force no pull-up (0 = (no)pull-up, 1 = no pull-up) + uint32_t no_hold_retain : 1; // bit 12 (v6.4.1.19) - SetOption62 - Don't use retain flag on HOLD messages uint32_t spare13 : 1; uint32_t spare14 : 1; uint32_t spare15 : 1; @@ -185,12 +185,12 @@ struct SYSCFG { unsigned long bootcount; // 00C */ struct SYSCFG { - uint16_t cfg_holder; // 000 v6 header - uint16_t cfg_size; // 002 + uint16_t cfg_holder; // 000 v6 header + uint16_t cfg_size; // 002 unsigned long save_flag; // 004 unsigned long version; // 008 - uint16_t bootcount; // 00C - uint16_t cfg_crc; // 00E + uint16_t bootcount; // 00C + uint16_t cfg_crc; // 00E SysBitfield flag; // 010 int16_t save_data; // 014 int8_t timezone; // 016 @@ -200,8 +200,8 @@ struct SYSCFG { uint8_t seriallog_level; // 09E uint8_t sta_config; // 09F uint8_t sta_active; // 0A0 - char sta_ssid[2][33]; // 0A1 - Keep together with sta_pwd as being copied as one chunck with reset 4/5 - char sta_pwd[2][65]; // 0E3 - Keep together with sta_ssid as being copied as one chunck with reset 4/5 + char sta_ssid[2][33]; // 0A1 - Keep together with sta_pwd as being copied as one chunck with reset 5 + char sta_pwd[2][65]; // 0E3 - Keep together with sta_ssid as being copied as one chunck with reset 5 char hostname[33]; // 165 char syslog_host[33]; // 186 uint8_t rule_stop; // 1A7 @@ -213,12 +213,12 @@ struct SYSCFG { uint8_t free_1D5[20]; // 1D5 Free since 5.12.0e - char mqtt_host[33]; // 1E9 - uint16_t mqtt_port; // 20A - char mqtt_client[33]; // 20C - char mqtt_user[33]; // 22D - char mqtt_pwd[33]; // 24E - char mqtt_topic[33]; // 26F + char mqtt_host[33]; // 1E9 - Keep together with below as being copied as one chunck with reset 6 + uint16_t mqtt_port; // 20A - Keep together + char mqtt_client[33]; // 20C - Keep together + char mqtt_user[33]; // 22D - Keep together + char mqtt_pwd[33]; // 24E - Keep together + char mqtt_topic[33]; // 26F - Keep together with above items as being copied as one chunck with reset 6 char button_topic[33]; // 290 char mqtt_grptopic[33]; // 2B1 uint8_t display_model; // 2D2 @@ -330,8 +330,9 @@ struct SYSCFG { uint8_t rgbwwTable[5]; // 71A uint8_t user_template_base; // 71F mytmplt user_template; // 720 29 bytes + uint8_t novasds_period; // 73D - uint8_t free_73D[87]; // 73D + uint8_t free_73D[86]; // 73E uint32_t drivers[3]; // 794 uint32_t monitors; // 7A0 @@ -396,7 +397,7 @@ struct XDRVMAILBOX { char *data; } XdrvMailbox; -#define MAX_RULES_FLAG 7 // Number of bits used in RulesBitfield (tricky I know...) +const uint8_t MAX_RULES_FLAG = 7; // Number of bits used in RulesBitfield (tricky I know...) typedef union { // Restricted by MISRA-C Rule 18.4 but so useful... uint16_t data; // Allow bit manipulation struct { diff --git a/sonoff/settings.ino b/sonoff/settings.ino index e15701e0b..1dd8f02b0 100644 --- a/sonoff/settings.ino +++ b/sonoff/settings.ino @@ -61,11 +61,15 @@ #define LONGITUDE 2.294442 // [Longitude] Your location to be used with sunrise and sunset #endif +#ifndef WORKING_PERIOD +#define WORKING_PERIOD 5 // Working period of the SDS Sensor, Takes a reading every X Minutes +#endif + /*********************************************************************************************\ * RTC memory \*********************************************************************************************/ -#define RTC_MEM_VALID 0xA55A +const uint16_t RTC_MEM_VALID = 0xA55A; uint32_t rtc_settings_crc = 0; @@ -164,16 +168,18 @@ extern "C" { extern "C" uint32_t _SPIFFS_end; // From libraries/EEPROM/EEPROM.cpp EEPROMClass -#define SPIFFS_END ((uint32_t)&_SPIFFS_end - 0x40200000) / SPI_FLASH_SEC_SIZE +const uint32_t SPIFFS_END = ((uint32_t)&_SPIFFS_end - 0x40200000) / SPI_FLASH_SEC_SIZE; // Version 4.2 config = eeprom area -#define SETTINGS_LOCATION SPIFFS_END // No need for SPIFFS as it uses EEPROM area +const uint32_t SETTINGS_LOCATION = SPIFFS_END; // No need for SPIFFS as it uses EEPROM area // Version 5.2 allow for more flash space -#define CFG_ROTATES 8 // Number of flash sectors used (handles uploads) +const uint8_t CFG_ROTATES = 8; // Number of flash sectors used (handles uploads) /*********************************************************************************************\ - * EEPROM support based on EEPROM library and tuned for Tasmota + * Optional EEPROM support based on EEPROM library and tuned for Tasmota \*********************************************************************************************/ +//#define USE_EEPROM +#ifdef USE_EEPROM uint32_t eeprom_sector = SPIFFS_END; uint8_t* eeprom_data = 0; @@ -301,12 +307,12 @@ void EepromEnd(void) eeprom_size = 0; eeprom_dirty = false; } - +#endif // USE_EEPROM /********************************************************************************************/ uint16_t settings_crc = 0; uint32_t settings_location = SETTINGS_LOCATION; -uint8_t *settings_buffer = NULL; +uint8_t *settings_buffer = nullptr; /********************************************************************************************/ /* @@ -333,9 +339,9 @@ void SetFlashModeDout(void) void SettingsBufferFree(void) { - if (settings_buffer != NULL) { + if (settings_buffer != nullptr) { free(settings_buffer); - settings_buffer = NULL; + settings_buffer = nullptr; } } @@ -368,7 +374,9 @@ void SettingsSaveAll(void) Settings.power = 0; } XsnsCall(FUNC_SAVE_BEFORE_RESTART); +#ifdef USE_EEPROM EepromCommit(); +#endif SettingsSave(0); } @@ -411,6 +419,7 @@ void SettingsSave(uint8_t rotate) Settings.cfg_size = sizeof(SYSCFG); Settings.cfg_crc = GetSettingsCrc(); +#ifdef USE_EEPROM if (SPIFFS_END == settings_location) { uint8_t* flash_buffer; flash_buffer = new uint8_t[SPI_FLASH_SEC_SIZE]; @@ -428,6 +437,10 @@ void SettingsSave(uint8_t rotate) ESP.flashEraseSector(settings_location); ESP.flashWrite(settings_location * SPI_FLASH_SEC_SIZE, (uint32*)&Settings, sizeof(SYSCFG)); } +#else + ESP.flashEraseSector(settings_location); + ESP.flashWrite(settings_location * SPI_FLASH_SEC_SIZE, (uint32*)&Settings, sizeof(SYSCFG)); +#endif // USE_EEPROM if (!stop_flash_rotate && rotate) { for (uint8_t i = 1; i < CFG_ROTATES; i++) { @@ -435,9 +448,8 @@ void SettingsSave(uint8_t rotate) delay(1); } } - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_CONFIG D_SAVED_TO_FLASH_AT " %X, " D_COUNT " %d, " D_BYTES " %d"), - settings_location, Settings.save_flag, sizeof(SYSCFG)); - AddLog(LOG_LEVEL_DEBUG); + + AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_CONFIG D_SAVED_TO_FLASH_AT " %X, " D_COUNT " %d, " D_BYTES " %d"), settings_location, Settings.save_flag, sizeof(SYSCFG)); settings_crc = Settings.cfg_crc; } @@ -457,13 +469,17 @@ void SettingsLoad(void) settings_location = 0; uint32_t flash_location = SETTINGS_LOCATION +1; + uint16_t cfg_holder = 0; for (uint8_t i = 0; i < CFG_ROTATES; i++) { flash_location--; ESP.flashRead(flash_location * SPI_FLASH_SEC_SIZE, (uint32*)&Settings, sizeof(SYSCFG)); bool valid = false; if (Settings.version > 0x06000000) { - valid = (Settings.cfg_crc == GetSettingsCrc()); + bool almost_valid = (Settings.cfg_crc == GetSettingsCrc()); + // Sometimes CRC on pages below FB, overwritten by OTA, is fine but Settings are still invalid. So check cfg_holder too + if (almost_valid && (0 == cfg_holder)) { cfg_holder = Settings.cfg_holder; } // At FB always active cfg_holder + valid = (cfg_holder == Settings.cfg_holder); } else { ESP.flashRead((flash_location -1) * SPI_FLASH_SEC_SIZE, (uint32*)&_SettingsH, sizeof(SYSCFGH)); valid = (Settings.cfg_holder == _SettingsH.cfg_holder); @@ -482,9 +498,7 @@ void SettingsLoad(void) } if (settings_location > 0) { ESP.flashRead(settings_location * SPI_FLASH_SEC_SIZE, (uint32*)&Settings, sizeof(SYSCFG)); - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_CONFIG D_LOADED_FROM_FLASH_AT " %X, " D_COUNT " %d"), - settings_location, Settings.save_flag); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_NONE, PSTR(D_LOG_CONFIG D_LOADED_FROM_FLASH_AT " %X, " D_COUNT " %lu"), settings_location, Settings.save_flag); } #ifndef FIRMWARE_MINIMAL @@ -516,8 +530,7 @@ void SettingsErase(uint8_t type) bool _serialoutput = (LOG_LEVEL_DEBUG_MORE <= seriallog_level); - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_APPLICATION D_ERASE " %d " D_UNIT_SECTORS), _sectorEnd - _sectorStart); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION D_ERASE " %d " D_UNIT_SECTORS), _sectorEnd - _sectorStart); for (uint32_t _sector = _sectorStart; _sector < _sectorEnd; _sector++) { result = ESP.flashEraseSector(_sector); @@ -587,6 +600,7 @@ void SettingsDefaultSet2(void) // Settings.flag.stop_flash_rotate = 0; Settings.save_data = SAVE_DATA; Settings.param[P_BOOT_LOOP_OFFSET] = BOOT_LOOP_OFFSET; + Settings.param[P_RGB_REMAP] = RGB_REMAP_RGBW; Settings.sleep = APP_SLEEP; if (Settings.sleep < 50) { Settings.sleep = 50; // Default to 50 for sleep, for now @@ -661,6 +675,7 @@ void SettingsDefaultSet2(void) Settings.flag.mqtt_button_retain = MQTT_BUTTON_RETAIN; Settings.flag.mqtt_switch_retain = MQTT_SWITCH_RETAIN; Settings.flag3.button_switch_force_local = MQTT_BUTTON_SWITCH_FORCE_LOCAL; + Settings.flag3.hass_tele_on_power = TELE_ON_POWER; // Settings.flag.mqtt_sensor_retain = 0; // Settings.flag.mqtt_offline = 0; // Settings.flag.mqtt_serial = 0; @@ -817,6 +832,8 @@ void SettingsDefaultSet2(void) Settings.rgbwwTable[j] = 255; } + Settings.novasds_period = WORKING_PERIOD; + memset(&Settings.drivers, 0xFF, 32); // Enable all possible monitors, displays, drivers and sensors } @@ -1054,6 +1071,12 @@ void SettingsDelta(void) if (Settings.version < 0x06040110) { ModuleDefault(WEMOS); } + if (Settings.version < 0x06040113) { + Settings.param[P_RGB_REMAP] = RGB_REMAP_RGBW; + } + if (Settings.version < 0x06050003) { + Settings.novasds_period = WORKING_PERIOD; + } Settings.version = VERSION; SettingsSave(1); diff --git a/sonoff/sonoff.h b/sonoff/sonoff.h index b54a32f3c..cd1659388 100644 --- a/sonoff/sonoff.h +++ b/sonoff/sonoff.h @@ -42,108 +42,109 @@ \*********************************************************************************************/ typedef unsigned long power_t; // Power (Relay) type -#define POWER_MASK 0xffffffffUL // Power (Relay) full mask +const uint32_t POWER_MASK = 0xffffffffUL; // Power (Relay) full mask + +/*********************************************************************************************\ + * Constants +\*********************************************************************************************/ + +// Changes to the following MAX_ defines will impact settings layout +const uint8_t MAX_SWITCHES = 8; // Max number of switches +const uint8_t MAX_RELAYS = 8; // Max number of relays +const uint8_t MAX_INTERLOCKS = 4; // Max number of interlock groups (MAX_RELAYS / 2) +const uint8_t MAX_LEDS = 4; // Max number of leds +const uint8_t MAX_KEYS = 4; // Max number of keys or buttons +const uint8_t MAX_PWMS = 5; // Max number of PWM channels +const uint8_t MAX_COUNTERS = 4; // Max number of counter sensors +const uint8_t MAX_TIMERS = 16; // Max number of Timers +const uint8_t MAX_PULSETIMERS = 8; // Max number of supported pulse timers +const uint8_t MAX_FRIENDLYNAMES = 4; // Max number of Friendly names +const uint8_t MAX_DOMOTICZ_IDX = 4; // Max number of Domoticz device, key and switch indices +const uint8_t MAX_DOMOTICZ_SNS_IDX = 12; // Max number of Domoticz sensors indices +const uint8_t MAX_KNX_GA = 10; // Max number of KNX Group Addresses to read that can be set +const uint8_t MAX_KNX_CB = 10; // Max number of KNX Group Addresses to write that can be set +const uint8_t MAX_XNRG_DRIVERS = 32; // Max number of allowed energy drivers +const uint8_t MAX_XDSP_DRIVERS = 32; // Max number of allowed display drivers +const uint8_t MAX_XDRV_DRIVERS = 96; // Max number of allowed driver drivers +const uint8_t MAX_XSNS_DRIVERS = 96; // Max number of allowed sensor drivers +const uint8_t MAX_RULE_MEMS = 5; // Max number of saved vars +const uint8_t MAX_RULE_SETS = 3; // Max number of rule sets of size 512 characters +const uint16_t MAX_RULE_SIZE = 512; // Max number of characters in rules + +const uint8_t MAX_FAN_SPEED = 4; // Max number of iFan02 fan speeds (0 .. 3) + +const char MQTT_TOKEN_PREFIX[] PROGMEM = "%prefix%"; // To be substituted by mqtt_prefix[x] +const char MQTT_TOKEN_TOPIC[] PROGMEM = "%topic%"; // To be substituted by mqtt_topic, mqtt_grptopic, mqtt_buttontopic, mqtt_switchtopic +const char WIFI_HOSTNAME[] = "%s-%04d"; // Expands to - + +const uint8_t CONFIG_FILE_SIGN = 0xA5; // Configuration file signature +const uint8_t CONFIG_FILE_XOR = 0x5A; // Configuration file xor (0 = No Xor) + +const uint32_t HLW_PREF_PULSE = 12530; // was 4975us = 201Hz = 1000W +const uint32_t HLW_UREF_PULSE = 1950; // was 1666us = 600Hz = 220V +const uint32_t HLW_IREF_PULSE = 3500; // was 1666us = 600Hz = 4.545A + +const uint8_t MQTT_RETRY_SECS = 10; // Minimum seconds to retry MQTT connection +const uint32_t GLOBAL_VALUES_VALID = 300; // Max number of seconds to keep last received values +const power_t APP_POWER = 0; // Default saved power state Off +const uint16_t WS2812_MAX_LEDS = 512; // Max number of LEDs + +const uint32_t PWM_RANGE = 1023; // 255..1023 needs to be devisible by 256 +//const uint16_t PWM_FREQ = 1000; // 100..1000 Hz led refresh +//const uint16_t PWM_FREQ = 910; // 100..1000 Hz led refresh (iTead value) +const uint16_t PWM_FREQ = 880; // 100..1000 Hz led refresh (BN-SZ01 value) +const uint16_t PWM_MAX = 4000; // [PWM_MAX] Maximum frequency - Default: 4000 +const uint16_t PWM_MIN = 100; // [PWM_MIN] Minimum frequency - Default: 100 + // For Dimmers use double of your mains AC frequecy (100 for 50Hz and 120 for 60Hz) + // For Controlling Servos use 50 and also set PWM_FREQ as 50 (DO NOT USE THESE VALUES FOR DIMMERS) +//#define PWM_LIGHTSCHEME0_IGNORE_SLEEP // Do not change sleep value for LightAnimate() scheme 0 + +const uint8_t DEFAULT_POWER_DELTA = 80; // Power change percentage +const uint16_t MAX_POWER_HOLD = 10; // Time in SECONDS to allow max agreed power +const uint16_t MAX_POWER_WINDOW = 30; // Time in SECONDS to disable allow max agreed power +const uint16_t SAFE_POWER_HOLD = 10; // Time in SECONDS to allow max unit safe power +const uint16_t SAFE_POWER_WINDOW = 30; // Time in MINUTES to disable allow max unit safe power +const uint8_t MAX_POWER_RETRY = 5; // Retry count allowing agreed power limit overflow + +const uint8_t STATES = 20; // Number of states per second using 50 mSec interval +const uint8_t IMMINENT_RESET_FACTOR = 10; // Factor to extent button hold time for imminent Reset to default 40 seconds using KEY_HOLD_TIME of 40 +const uint32_t BOOT_LOOP_TIME = 10; // Number of seconds to stop detecting boot loops +const uint16_t SYSLOG_TIMER = 600; // Seconds to restore syslog_level +const uint16_t SERIALLOG_TIMER = 600; // Seconds to disable SerialLog +const uint8_t OTA_ATTEMPTS = 5; // Number of times to try fetching the new firmware + +const uint16_t INPUT_BUFFER_SIZE = 520; // Max number of characters in (serial and http) command buffer +const uint16_t CMDSZ = 24; // Max number of characters in command +const uint16_t TOPSZ = 100; // Max number of characters in topic string +const uint16_t LOGSZ = 520; // Max number of characters in log +const uint16_t MIN_MESSZ = 893; // Min number of characters in MQTT message + +const uint8_t SENSOR_MAX_MISS = 5; // Max number of missed sensor reads before deciding it's offline + +#ifdef USE_MQTT_TLS + const uint16_t WEB_LOG_SIZE = 2000; // Max number of characters in weblog +#else + const uint16_t WEB_LOG_SIZE = 4000; // Max number of characters in weblog +#endif + +const uint8_t MAX_BACKLOG = 30; // Max number of commands in backlog +const uint32_t MIN_BACKLOG_DELAY = 2; // Minimal backlog delay in 0.1 seconds + +const uint32_t SOFT_BAUDRATE = 9600; // Default software serial baudrate +const uint32_t APP_BAUDRATE = 115200; // Default serial baudrate +const uint32_t SERIAL_POLLING = 100; // Serial receive polling in ms +const uint8_t MAX_STATUS = 11; // Max number of status lines + +const uint32_t DRIVER_BOOT_DELAY = 1; // Number of milliseconds to retard driver cycles during boot-up time to reduce overall CPU load whilst Wifi is connecting +const uint32_t LOOP_SLEEP_DELAY = 50; // Lowest number of milliseconds to go through the main loop using delay when needed /*********************************************************************************************\ * Defines \*********************************************************************************************/ -// Changes to the following MAX_ defines will impact settings layout -#define MAX_SWITCHES 8 // Max number of switches -#define MAX_RELAYS 8 // Max number of relays -#define MAX_INTERLOCKS 4 // Max number of interlock groups (MAX_RELAYS / 2) -#define MAX_LEDS 4 // Max number of leds -#define MAX_KEYS 4 // Max number of keys or buttons -#define MAX_PWMS 5 // Max number of PWM channels -#define MAX_COUNTERS 4 // Max number of counter sensors -#define MAX_TIMERS 16 // Max number of Timers -#define MAX_PULSETIMERS 8 // Max number of supported pulse timers -#define MAX_FRIENDLYNAMES 4 // Max number of Friendly names -#define MAX_DOMOTICZ_IDX 4 // Max number of Domoticz device, key and switch indices -#define MAX_DOMOTICZ_SNS_IDX 12 // Max number of Domoticz sensors indices -#define MAX_KNX_GA 10 // Max number of KNX Group Addresses to read that can be set -#define MAX_KNX_CB 10 // Max number of KNX Group Addresses to write that can be set -#define MAX_XNRG_DRIVERS 32 // Max number of allowed energy drivers -#define MAX_XDSP_DRIVERS 32 // Max number of allowed display drivers -#define MAX_XDRV_DRIVERS 96 // Max number of allowed driver drivers -#define MAX_XSNS_DRIVERS 96 // Max number of allowed sensor drivers -#define MAX_RULE_MEMS 5 // Max number of saved vars -#define MAX_RULE_SETS 3 // Max number of rule sets of size 512 characters -#define MAX_RULE_SIZE 512 // Max number of characters in rules - -// Changes to the following defines have no impact on settings layout #define MAX_RULE_TIMERS 8 // Max number of rule timers (4 bytes / timer) #define MAX_RULE_VARS 5 // Max number of rule variables (10 bytes / variable) -#define MAX_FAN_SPEED 4 // Max number of iFan02 fan speeds (0 .. 3) - -#define MQTT_TOKEN_PREFIX "%prefix%" // To be substituted by mqtt_prefix[x] -#define MQTT_TOKEN_TOPIC "%topic%" // To be substituted by mqtt_topic, mqtt_grptopic, mqtt_buttontopic, mqtt_switchtopic -#define MQTT_TOKEN_HOSTNAME "%hostname%" // To be substituted by mqtt_topic, mqtt_grptopic, mqtt_buttontopic, mqtt_switchtopic -#define MQTT_TOKEN_ID "%id%" // To be substituted by mqtt_topic, mqtt_grptopic, mqtt_buttontopic, mqtt_switchtopic - -#define WIFI_HOSTNAME "%s-%04d" // Expands to - - -#define CONFIG_FILE_SIGN 0xA5 // Configuration file signature -#define CONFIG_FILE_XOR 0x5A // Configuration file xor (0 = No Xor) - -#define HLW_PREF_PULSE 12530 // was 4975us = 201Hz = 1000W -#define HLW_UREF_PULSE 1950 // was 1666us = 600Hz = 220V -#define HLW_IREF_PULSE 3500 // was 1666us = 600Hz = 4.545A - -#define MQTT_RETRY_SECS 10 // Minimum seconds to retry MQTT connection -#define GLOBAL_VALUES_VALID 300 // Max number of seconds to keep last received values -#define APP_POWER 0 // Default saved power state Off -#define WS2812_MAX_LEDS 512 // Max number of LEDs - -#define PWM_RANGE 1023 // 255..1023 needs to be devisible by 256 -//#define PWM_FREQ 1000 // 100..1000 Hz led refresh -//#define PWM_FREQ 910 // 100..1000 Hz led refresh (iTead value) -#define PWM_FREQ 880 // 100..1000 Hz led refresh (BN-SZ01 value) -#define PWM_MAX 4000 // [PWM_MAX] Maximum frequency - Default: 4000 -#define PWM_MIN 100 // [PWM_MIN] Minimum frequency - Default: 100 - // For Dimmers use double of your mains AC frequecy (100 for 50Hz and 120 for 60Hz) - // For Controlling Servos use 50 and also set PWM_FREQ as 50 (DO NOT USE THESE VALUES FOR DIMMERS) - -#define DEFAULT_POWER_DELTA 80 // Power change percentage -#define MAX_POWER_HOLD 10 // Time in SECONDS to allow max agreed power -#define MAX_POWER_WINDOW 30 // Time in SECONDS to disable allow max agreed power -#define SAFE_POWER_HOLD 10 // Time in SECONDS to allow max unit safe power -#define SAFE_POWER_WINDOW 30 // Time in MINUTES to disable allow max unit safe power -#define MAX_POWER_RETRY 5 // Retry count allowing agreed power limit overflow - -#define STATES 20 // Number of states per second using 50 mSec interval -#define IMMINENT_RESET_FACTOR 10 // Factor to extent button hold time for imminent Reset to default 40 seconds using KEY_HOLD_TIME of 40 -#define BOOT_LOOP_TIME 10 // Number of seconds to stop detecting boot loops -#define SYSLOG_TIMER 600 // Seconds to restore syslog_level -#define SERIALLOG_TIMER 600 // Seconds to disable SerialLog -#define OTA_ATTEMPTS 5 // Number of times to try fetching the new firmware - -#define INPUT_BUFFER_SIZE 520 // Max number of characters in (serial and http) command buffer -#define CMDSZ 24 // Max number of characters in command -#define TOPSZ 100 // Max number of characters in topic string -#define LOGSZ 520 // Max number of characters in log -#define MIN_MESSZ 893 // Min number of characters in MQTT message - -#define SENSOR_MAX_MISS 5 // Max number of missed sensor reads before deciding it's offline - -#ifdef USE_MQTT_TLS - #define WEB_LOG_SIZE 2000 // Max number of characters in weblog -#else - #define WEB_LOG_SIZE 4000 // Max number of characters in weblog -#endif - -#define MAX_BACKLOG 30 // Max number of commands in backlog -#define MIN_BACKLOG_DELAY 2 // Minimal backlog delay in 0.1 seconds - -#define SOFT_BAUDRATE 9600 // Default software serial baudrate -#define APP_BAUDRATE 115200 // Default serial baudrate -#define SERIAL_POLLING 100 // Serial receive polling in ms -#define MAX_STATUS 11 // Max number of status lines - -#define DRIVER_BOOT_DELAY 1 // Number of milliseconds to retard driver cycles during boot-up time to reduce overall CPU load whilst Wifi is connecting -#define LOOP_SLEEP_DELAY 50 // Lowest number of milliseconds to go through the main loop using delay when needed - #define NO_EXTRA_4K_HEAP // Allocate 4k heap for WPS in ESP8166/Arduino core v2.4.2 (was always allocated in previous versions) /* @@ -170,6 +171,13 @@ typedef unsigned long power_t; // Power (Relay) type #define LT_SM16716 16 // Lights that use SM16716 will have this bit set in light_type +#define RGB_REMAP_RGBW 0 +#define RGB_REMAP_RBGW 6 +#define RGB_REMAP_GRBW 24 +#define RGB_REMAP_GBRW 30 +#define RGB_REMAP_BRGW 48 +#define RGB_REMAP_BGRW 54 + #define MQTT_PUBSUBCLIENT 1 // Mqtt PubSubClient library #define MQTT_TASMOTAMQTT 2 // Mqtt TasmotaMqtt library based on esp-mqtt-arduino - soon obsolete #define MQTT_ESPMQTTARDUINO 3 // Mqtt esp-mqtt-arduino library by Ingo Randolf - obsolete but define is present for debugging purposes @@ -211,7 +219,7 @@ enum GetDateAndTimeOptions { DT_LOCAL, DT_UTC, DT_RESTART, DT_ENERGY }; enum LoggingLevels {LOG_LEVEL_NONE, LOG_LEVEL_ERROR, LOG_LEVEL_INFO, LOG_LEVEL_DEBUG, LOG_LEVEL_DEBUG_MORE, LOG_LEVEL_ALL}; -enum WifiConfigOptions {WIFI_RESTART, WIFI_SMARTCONFIG, WIFI_MANAGER, WIFI_WPSCONFIG, WIFI_RETRY, WIFI_WAIT, WIFI_SERIAL, MAX_WIFI_OPTION}; +enum WifiConfigOptions {WIFI_RESTART, WIFI_SMARTCONFIG, WIFI_MANAGER, WIFI_WPSCONFIG, WIFI_RETRY, WIFI_WAIT, WIFI_SERIAL, WIFI_MANAGER_RESET_ONLY, MAX_WIFI_OPTION}; enum SwitchModeOptions {TOGGLE, FOLLOW, FOLLOW_INV, PUSHBUTTON, PUSHBUTTON_INV, PUSHBUTTONHOLD, PUSHBUTTONHOLD_INV, PUSHBUTTON_TOGGLE, MAX_SWITCH_OPTION}; @@ -229,7 +237,7 @@ enum ButtonStates { PRESSED, NOT_PRESSED }; enum Shortcuts { SC_CLEAR, SC_DEFAULT, SC_USER }; -enum SettingsParmaIndex {P_HOLD_TIME, P_MAX_POWER_RETRY, P_TUYA_DIMMER_ID, P_MDNS_DELAYED_START, P_BOOT_LOOP_OFFSET, P_MAX_PARAM8}; // Max is PARAM8_SIZE (18) - SetOption32 until SetOption49 +enum SettingsParmaIndex {P_HOLD_TIME, P_MAX_POWER_RETRY, P_TUYA_DIMMER_ID, P_MDNS_DELAYED_START, P_BOOT_LOOP_OFFSET, P_RGB_REMAP, P_MAX_PARAM8}; // Max is PARAM8_SIZE (18) - SetOption32 until SetOption49 enum DomoticzSensors {DZ_TEMP, DZ_TEMP_HUM, DZ_TEMP_HUM_BARO, DZ_POWER_ENERGY, DZ_ILLUMINANCE, DZ_COUNT, DZ_VOLTAGE, DZ_CURRENT, DZ_AIRQUALITY, DZ_MAX_SENSORS}; @@ -244,7 +252,7 @@ enum LightSchemes {LS_POWER, LS_WAKEUP, LS_CYCLEUP, LS_CYCLEDN, LS_RANDOM, LS_MA enum XsnsFunctions {FUNC_SETTINGS_OVERRIDE, FUNC_MODULE_INIT, FUNC_PRE_INIT, FUNC_INIT, FUNC_LOOP, FUNC_EVERY_50_MSECOND, FUNC_EVERY_100_MSECOND, FUNC_EVERY_200_MSECOND, FUNC_EVERY_250_MSECOND, FUNC_EVERY_SECOND, - FUNC_PREP_BEFORE_TELEPERIOD, FUNC_JSON_APPEND, FUNC_WEB_APPEND, FUNC_SAVE_BEFORE_RESTART, FUNC_COMMAND, + FUNC_PREP_BEFORE_TELEPERIOD, FUNC_JSON_APPEND, FUNC_WEB_SENSOR, FUNC_SAVE_BEFORE_RESTART, FUNC_COMMAND, FUNC_COMMAND_SENSOR, FUNC_COMMAND_DRIVER, FUNC_MQTT_SUBSCRIBE, FUNC_MQTT_INIT, FUNC_MQTT_DATA, FUNC_SET_POWER, FUNC_SET_DEVICE_POWER, FUNC_SHOW_SENSOR, FUNC_RULES_PROCESS, FUNC_SERIAL, FUNC_FREE_MEM, FUNC_BUTTON_PRESSED, diff --git a/sonoff/sonoff.ino b/sonoff/sonoff.ino index 34c422d20..e85a26af2 100755 --- a/sonoff/sonoff.ino +++ b/sonoff/sonoff.ino @@ -167,7 +167,6 @@ bool i2c_flg = false; // I2C configured bool spi_flg = false; // SPI configured bool soft_spi_flg = false; // Software SPI configured bool ntp_force_sync = false; // Force NTP sync -bool reset_web_log_flag = false; // Reset web console log myio my_module; // Active copy of Module GPIOs (17 x 8 bits) gpio_flag my_module_flag; // Active copy of Module GPIO flags StateBitfield global_state; // Global states (currently Wifi and Mqtt) (8 bits) @@ -189,23 +188,24 @@ char* Format(char* output, const char* input, int size) char *token; uint8_t digits = 0; - if (strstr(input, "%")) { + if (strstr(input, "%") != nullptr) { strlcpy(output, input, size); token = strtok(output, "%"); if (strstr(input, "%") == input) { output[0] = '\0'; } else { - token = strtok(NULL, ""); + token = strtok(nullptr, ""); } - if (token != NULL) { + if (token != nullptr) { digits = atoi(token); if (digits) { + char tmp[size]; if (strchr(token, 'd')) { - snprintf_P(output, size, PSTR("%s%c0%dd"), output, '%', digits); - snprintf_P(output, size, output, ESP.getChipId() & 0x1fff); // %04d - short chip ID in dec, like in hostname + snprintf_P(tmp, size, PSTR("%s%c0%dd"), output, '%', digits); + snprintf_P(output, size, tmp, ESP.getChipId() & 0x1fff); // %04d - short chip ID in dec, like in hostname } else { - snprintf_P(output, size, PSTR("%s%c0%dX"), output, '%', digits); - snprintf_P(output, size, output, ESP.getChipId()); // %06X - full chip ID in hex + snprintf_P(tmp, size, PSTR("%s%c0%dX"), output, '%', digits); + snprintf_P(output, size, tmp, ESP.getChipId()); // %06X - full chip ID in hex } } else { if (strchr(token, 'd')) { @@ -221,14 +221,14 @@ char* Format(char* output, const char* input, int size) char* GetOtaUrl(char *otaurl, size_t otaurl_size) { - if (strstr(Settings.ota_url, "%04d") != NULL) { // OTA url contains placeholder for chip ID + if (strstr(Settings.ota_url, "%04d") != nullptr) { // OTA url contains placeholder for chip ID snprintf(otaurl, otaurl_size, Settings.ota_url, ESP.getChipId() & 0x1fff); } - else if (strstr(Settings.ota_url, "%d") != NULL) { // OTA url contains placeholder for chip ID + else if (strstr(Settings.ota_url, "%d") != nullptr) { // OTA url contains placeholder for chip ID snprintf_P(otaurl, otaurl_size, Settings.ota_url, ESP.getChipId()); } else { - snprintf(otaurl, otaurl_size, Settings.ota_url); + strlcpy(otaurl, Settings.ota_url, otaurl_size); } return otaurl; } @@ -254,20 +254,21 @@ char* GetTopic_P(char *stopic, uint8_t prefix, char *topic, const char* subtopic fulltopic += F("_fb"); // cmnd/_fb } else { fulltopic = Settings.mqtt_fulltopic; - if ((0 == prefix) && (-1 == fulltopic.indexOf(F(MQTT_TOKEN_PREFIX)))) { - fulltopic += F("/" MQTT_TOKEN_PREFIX); // Need prefix for commands to handle mqtt topic loops + if ((0 == prefix) && (-1 == fulltopic.indexOf(FPSTR(MQTT_TOKEN_PREFIX)))) { + fulltopic += F("/"); + fulltopic += FPSTR(MQTT_TOKEN_PREFIX); // Need prefix for commands to handle mqtt topic loops } for (uint8_t i = 0; i < 3; i++) { if ('\0' == Settings.mqtt_prefix[i][0]) { snprintf_P(Settings.mqtt_prefix[i], sizeof(Settings.mqtt_prefix[i]), kPrefixes[i]); } } - fulltopic.replace(F(MQTT_TOKEN_PREFIX), Settings.mqtt_prefix[prefix]); - fulltopic.replace(F(MQTT_TOKEN_TOPIC), topic); - fulltopic.replace(F(MQTT_TOKEN_HOSTNAME), my_hostname); + fulltopic.replace(FPSTR(MQTT_TOKEN_PREFIX), Settings.mqtt_prefix[prefix]); + fulltopic.replace(FPSTR(MQTT_TOKEN_TOPIC), topic); + fulltopic.replace(F("%hostname%"), my_hostname); String token_id = WiFi.macAddress(); token_id.replace(":", ""); - fulltopic.replace(F(MQTT_TOKEN_ID), token_id); + fulltopic.replace(F("%id%"), token_id); } fulltopic.replace(F("#"), ""); fulltopic.replace(F("//"), "/"); @@ -278,7 +279,7 @@ char* GetTopic_P(char *stopic, uint8_t prefix, char *topic, const char* subtopic char* GetFallbackTopic_P(char *stopic, uint8_t prefix, const char* subtopic) { - return GetTopic_P(stopic, prefix +4, NULL, subtopic); + return GetTopic_P(stopic, prefix +4, nullptr, subtopic); } char* GetStateText(uint8_t state) @@ -431,6 +432,8 @@ uint16_t GetPulseTimer(uint8_t index) void MqttDataHandler(char* topic, uint8_t* data, unsigned int data_len) { + if (data_len > MQTT_MAX_PACKET_SIZE) { return; } // Do not allow more data than would be feasable within stack space + char *str; if (!strcmp(Settings.mqtt_prefix[0],Settings.mqtt_prefix[1])) { @@ -450,7 +453,7 @@ void MqttDataHandler(char* topic, uint8_t* data, unsigned int data_len) char command [CMDSZ]; char stemp1[TOPSZ]; char *p; - char *type = NULL; + char *type = nullptr; uint8_t lines = 1; bool jsflg = false; bool grpflg = false; @@ -459,7 +462,9 @@ void MqttDataHandler(char* topic, uint8_t* data, unsigned int data_len) uint16_t index; uint32_t address; +#ifdef USE_DEBUG_DRIVER ShowFreeMem(PSTR("MqttDataHandler")); +#endif strlcpy(topicBuf, topic, sizeof(topicBuf)); for (i = 0; i < data_len; i++) { @@ -471,14 +476,12 @@ void MqttDataHandler(char* topic, uint8_t* data, unsigned int data_len) if (topicBuf[0] != '/') { ShowSource(SRC_MQTT); } - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_RESULT D_RECEIVED_TOPIC " %s, " D_DATA_SIZE " %d, " D_DATA " %s"), - topicBuf, data_len, dataBuf); - AddLog(LOG_LEVEL_DEBUG_MORE); + AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_RESULT D_RECEIVED_TOPIC " %s, " D_DATA_SIZE " %d, " D_DATA " %s"), topicBuf, data_len, dataBuf); // if (LOG_LEVEL_DEBUG_MORE <= seriallog_level) { Serial.println(dataBuf); } if (XdrvMqttData(topicBuf, sizeof(topicBuf), dataBuf, sizeof(dataBuf))) { return; } - grpflg = (strstr(topicBuf, Settings.mqtt_grptopic) != NULL); + grpflg = (strstr(topicBuf, Settings.mqtt_grptopic) != nullptr); GetFallbackTopic_P(stemp1, CMND, ""); // Full Fallback topic = cmnd/DVES_xxxxxxxx_fb/ fallback_topic_flag = (!strncmp(topicBuf, stemp1, strlen(stemp1))); @@ -486,7 +489,7 @@ void MqttDataHandler(char* topic, uint8_t* data, unsigned int data_len) type = strrchr(topicBuf, '/'); // Last part of received topic is always the command (type) index = 1; - if (type != NULL) { + if (type != nullptr) { type++; for (i = 0; i < strlen(type); i++) { type[i] = toupper(type[i]); @@ -501,12 +504,10 @@ void MqttDataHandler(char* topic, uint8_t* data, unsigned int data_len) type[i] = '\0'; } - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_RESULT D_GROUP " %d, " D_INDEX " %d, " D_COMMAND " %s, " D_DATA " %s"), - grpflg, index, type, dataBuf); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_RESULT D_GROUP " %d, " D_INDEX " %d, " D_COMMAND " %s, " D_DATA " %s"), grpflg, index, type, dataBuf); - if (type != NULL) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_JSON_COMMAND "\":\"" D_JSON_ERROR "\"}")); + if (type != nullptr) { + Response_P(PSTR("{\"" D_JSON_COMMAND "\":\"" D_JSON_ERROR "\"}")); if (Settings.ledstate &0x02) { blinks++; } if (!strcmp(dataBuf,"?")) { data_len = 0; } @@ -524,13 +525,22 @@ void MqttDataHandler(char* topic, uint8_t* data, unsigned int data_len) int temp_payload = GetStateNumber(dataBuf); if (temp_payload > -1) { payload = temp_payload; } -// snprintf_P(log_data, sizeof(log_data), PSTR("RSLT: Payload %d, Payload16 %d"), payload, payload16); -// AddLog(LOG_LEVEL_DEBUG); +// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("RSLT: Payload %d, Payload16 %d"), payload, payload16); int command_code = GetCommandCode(command, sizeof(command), type, kTasmotaCommands); if (-1 == command_code) { - if (!XdrvCommand(grpflg, type, index, dataBuf, data_len, payload, payload16)) { - type = NULL; // Unknown command +// XdrvMailbox.valid = 1; + XdrvMailbox.index = index; + XdrvMailbox.data_len = data_len; + XdrvMailbox.payload16 = payload16; + XdrvMailbox.payload = payload; + XdrvMailbox.grpflg = grpflg; + XdrvMailbox.topic = type; + XdrvMailbox.data = dataBuf; + if (!XdrvCall(FUNC_COMMAND)) { + if (!XsnsCall(FUNC_COMMAND)) { + type = nullptr; // Unknown command + } } } else if (CMND_BACKLOG == command_code) { @@ -538,7 +548,7 @@ void MqttDataHandler(char* topic, uint8_t* data, unsigned int data_len) uint8_t bl_pointer = (!backlog_pointer) ? MAX_BACKLOG -1 : backlog_pointer; bl_pointer--; char *blcommand = strtok(dataBuf, ";"); - while ((blcommand != NULL) && (backlog_index != bl_pointer)) { + while ((blcommand != nullptr) && (backlog_index != bl_pointer)) { while(true) { blcommand = Trim(blcommand); if (!strncasecmp_P(blcommand, PSTR(D_CMND_BACKLOG), strlen(D_CMND_BACKLOG))) { @@ -552,14 +562,14 @@ void MqttDataHandler(char* topic, uint8_t* data, unsigned int data_len) backlog_index++; if (backlog_index >= MAX_BACKLOG) backlog_index = 0; } - blcommand = strtok(NULL, ";"); + blcommand = strtok(nullptr, ";"); } -// snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, D_JSON_APPENDED); +// Response_P(S_JSON_COMMAND_SVALUE, command, D_JSON_APPENDED); mqtt_data[0] = '\0'; } else { uint8_t blflag = (backlog_pointer == backlog_index); backlog_pointer = backlog_index; - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, blflag ? D_JSON_EMPTY : D_JSON_ABORTED); + Response_P(S_JSON_COMMAND_SVALUE, command, blflag ? D_JSON_EMPTY : D_JSON_ABORTED); } } else if (CMND_DELAY == command_code) { @@ -569,7 +579,7 @@ void MqttDataHandler(char* topic, uint8_t* data, unsigned int data_len) uint16_t bl_delay = 0; long bl_delta = TimePassedSince(backlog_delay); if (bl_delta < 0) { bl_delay = (bl_delta *-1) / 100; } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_NVALUE, command, bl_delay); + Response_P(S_JSON_COMMAND_NVALUE, command, bl_delay); } else if ((CMND_POWER == command_code) && (index > 0) && (index <= devices_present)) { if ((payload < 0) || (payload > 4)) { payload = 9; } @@ -592,7 +602,7 @@ void MqttDataHandler(char* topic, uint8_t* data, unsigned int data_len) if ((payload >= 0) && (payload < MAX_FAN_SPEED) && (payload != GetFanspeed())) { SetFanspeed(payload); } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_NVALUE, command, GetFanspeed()); + Response_P(S_JSON_COMMAND_NVALUE, command, GetFanspeed()); } else if (CMND_STATUS == command_code) { if ((payload < 0) || (payload > MAX_STATUS)) payload = 99; @@ -606,6 +616,11 @@ void MqttDataHandler(char* topic, uint8_t* data, unsigned int data_len) if (Settings.flag3.hass_tele_on_power) { MqttPublishPrefixTopic_P(TELE, PSTR(D_RSLT_STATE), MQTT_TELE_RETAIN); } +#ifdef USE_HOME_ASSISTANT + if (Settings.flag.hass_discovery) { + HAssPublishStatus(); + } +#endif // USE_HOME_ASSISTANT } else if (CMND_SLEEP == command_code) { if ((payload >= 0) && (payload < 251)) { @@ -613,7 +628,7 @@ void MqttDataHandler(char* topic, uint8_t* data, unsigned int data_len) sleep = payload; WiFiSetSleepMode(); } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_NVALUE_UNIT_NVALUE_UNIT, command, sleep, (Settings.flag.value_units) ? " " D_UNIT_MILLISECOND : "", Settings.sleep, (Settings.flag.value_units) ? " " D_UNIT_MILLISECOND : ""); + Response_P(S_JSON_COMMAND_NVALUE_UNIT_NVALUE_UNIT, command, sleep, (Settings.flag.value_units) ? " " D_UNIT_MILLISECOND : "", Settings.sleep, (Settings.flag.value_units) ? " " D_UNIT_MILLISECOND : ""); } else if ((CMND_UPGRADE == command_code) || (CMND_UPLOAD == command_code)) { // Check if the payload is numerically 1, and had no trailing chars. @@ -622,36 +637,36 @@ void MqttDataHandler(char* topic, uint8_t* data, unsigned int data_len) // We also need at least 3 chars to make a valid version number string. if (((1 == data_len) && (1 == payload)) || ((data_len >= 3) && NewerVersion(dataBuf))) { ota_state_flag = 3; - snprintf_P(mqtt_data, sizeof(mqtt_data), "{\"%s\":\"" D_JSON_VERSION " %s " D_JSON_FROM " %s\"}", command, my_version, GetOtaUrl(stemp1, sizeof(stemp1))); + Response_P(PSTR("{\"%s\":\"" D_JSON_VERSION " %s " D_JSON_FROM " %s\"}"), command, my_version, GetOtaUrl(stemp1, sizeof(stemp1))); } else { - snprintf_P(mqtt_data, sizeof(mqtt_data), "{\"%s\":\"" D_JSON_ONE_OR_GT "\"}", command, my_version); + Response_P(PSTR("{\"%s\":\"" D_JSON_ONE_OR_GT "\"}"), command, my_version); } } else if (CMND_OTAURL == command_code) { if ((data_len > 0) && (data_len < sizeof(Settings.ota_url))) { strlcpy(Settings.ota_url, (SC_DEFAULT == Shortcut(dataBuf)) ? OTA_URL : dataBuf, sizeof(Settings.ota_url)); } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, Settings.ota_url); + Response_P(S_JSON_COMMAND_SVALUE, command, Settings.ota_url); } else if (CMND_SERIALLOG == command_code) { if ((payload >= LOG_LEVEL_NONE) && (payload <= LOG_LEVEL_ALL)) { Settings.flag.mqtt_serial = 0; SetSeriallog(payload); } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_NVALUE_ACTIVE_NVALUE, command, Settings.seriallog_level, seriallog_level); + Response_P(S_JSON_COMMAND_NVALUE_ACTIVE_NVALUE, command, Settings.seriallog_level, seriallog_level); } else if (CMND_RESTART == command_code) { switch (payload) { case 1: restart_flag = 2; - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, D_JSON_RESTARTING); + Response_P(S_JSON_COMMAND_SVALUE, command, D_JSON_RESTARTING); break; case 99: AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_APPLICATION D_RESTARTING)); EspRestart(); break; default: - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, D_JSON_ONE_TO_RESTART); + Response_P(S_JSON_COMMAND_SVALUE, command, D_JSON_ONE_TO_RESTART); } } else if ((CMND_POWERONSTATE == command_code) && (my_module_type != MOTOR)) { @@ -670,28 +685,28 @@ void MqttDataHandler(char* topic, uint8_t* data, unsigned int data_len) } } } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_NVALUE, command, Settings.poweronstate); + Response_P(S_JSON_COMMAND_NVALUE, command, Settings.poweronstate); } else if ((CMND_PULSETIME == command_code) && (index > 0) && (index <= MAX_PULSETIMERS)) { if (data_len > 0) { Settings.pulse_timer[index -1] = payload16; // 0 - 65535 SetPulseTimer(index -1, payload16); } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_INDEX_NVALUE_ACTIVE_NVALUE, command, index, Settings.pulse_timer[index -1], GetPulseTimer(index -1)); + Response_P(S_JSON_COMMAND_INDEX_NVALUE_ACTIVE_NVALUE, command, index, Settings.pulse_timer[index -1], GetPulseTimer(index -1)); } else if (CMND_BLINKTIME == command_code) { if ((payload > 1) && (payload <= 3600)) { Settings.blinktime = payload; if (blink_timer > 0) { blink_timer = millis() + (100 * payload); } } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_NVALUE, command, Settings.blinktime); + Response_P(S_JSON_COMMAND_NVALUE, command, Settings.blinktime); } else if (CMND_BLINKCOUNT == command_code) { if (data_len > 0) { Settings.blinkcount = payload16; // 0 - 65535 if (blink_counter) blink_counter = Settings.blinkcount *2; } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_NVALUE, command, Settings.blinkcount); + Response_P(S_JSON_COMMAND_NVALUE, command, Settings.blinkcount); } else if (CMND_SAVEDATA == command_code) { if ((payload >= 0) && (payload <= 3600)) { @@ -702,7 +717,7 @@ void MqttDataHandler(char* topic, uint8_t* data, unsigned int data_len) if (Settings.save_data > 1) { snprintf_P(stemp1, sizeof(stemp1), PSTR(D_JSON_EVERY " %d " D_UNIT_SECOND), Settings.save_data); } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, (Settings.save_data > 1) ? stemp1 : GetStateText(Settings.save_data)); + Response_P(S_JSON_COMMAND_SVALUE, command, (Settings.save_data > 1) ? stemp1 : GetStateText(Settings.save_data)); } else if ((CMND_SENSOR == command_code) || (CMND_DRIVER == command_code)) { XdrvMailbox.index = index; @@ -713,9 +728,9 @@ void MqttDataHandler(char* topic, uint8_t* data, unsigned int data_len) XdrvMailbox.topic = command; XdrvMailbox.data = dataBuf; if (CMND_SENSOR == command_code) { - XsnsCall(FUNC_COMMAND); + XsnsCall(FUNC_COMMAND_SENSOR); } else { - XdrvCall(FUNC_COMMAND); + XdrvCall(FUNC_COMMAND_DRIVER); } } else if ((CMND_SETOPTION == command_code) && (index < 82)) { @@ -776,9 +791,6 @@ void MqttDataHandler(char* topic, uint8_t* data, unsigned int data_len) if (10 == pindex) { // SetOption60 enable or disable traditional sleep WiFiSetSleepMode(); // Update WiFi sleep mode accordingly } - if ((12 == pindex) && (my_module_flag.pullup)) { // SetOption62 change input pull-up - restart_flag = 2; // Only restart if module supports it - } } } else { // SetOption32 .. 49 @@ -793,67 +805,72 @@ void MqttDataHandler(char* topic, uint8_t* data, unsigned int data_len) } if ((payload >= param_low) && (payload <= param_high)) { Settings.param[pindex] = payload; + switch (pindex) { + case P_RGB_REMAP: + LightUpdateColorMapping(); + break; + } } } } if (ptype < 99) { if (2 == ptype) snprintf_P(stemp1, sizeof(stemp1), PSTR("%d"), Settings.param[pindex]); - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_INDEX_SVALUE, command, index, (2 == ptype) ? stemp1 : (1 == ptype) ? GetStateText(bitRead(Settings.flag3.data, pindex)) : GetStateText(bitRead(Settings.flag.data, pindex))); + Response_P(S_JSON_COMMAND_INDEX_SVALUE, command, index, (2 == ptype) ? stemp1 : (1 == ptype) ? GetStateText(bitRead(Settings.flag3.data, pindex)) : GetStateText(bitRead(Settings.flag.data, pindex))); } } else if (CMND_TEMPERATURE_RESOLUTION == command_code) { if ((payload >= 0) && (payload <= 3)) { Settings.flag2.temperature_resolution = payload; } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_NVALUE, command, Settings.flag2.temperature_resolution); + Response_P(S_JSON_COMMAND_NVALUE, command, Settings.flag2.temperature_resolution); } else if (CMND_HUMIDITY_RESOLUTION == command_code) { if ((payload >= 0) && (payload <= 3)) { Settings.flag2.humidity_resolution = payload; } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_NVALUE, command, Settings.flag2.humidity_resolution); + Response_P(S_JSON_COMMAND_NVALUE, command, Settings.flag2.humidity_resolution); } else if (CMND_PRESSURE_RESOLUTION == command_code) { if ((payload >= 0) && (payload <= 3)) { Settings.flag2.pressure_resolution = payload; } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_NVALUE, command, Settings.flag2.pressure_resolution); + Response_P(S_JSON_COMMAND_NVALUE, command, Settings.flag2.pressure_resolution); } else if (CMND_POWER_RESOLUTION == command_code) { if ((payload >= 0) && (payload <= 3)) { Settings.flag2.wattage_resolution = payload; } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_NVALUE, command, Settings.flag2.wattage_resolution); + Response_P(S_JSON_COMMAND_NVALUE, command, Settings.flag2.wattage_resolution); } else if (CMND_VOLTAGE_RESOLUTION == command_code) { if ((payload >= 0) && (payload <= 3)) { Settings.flag2.voltage_resolution = payload; } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_NVALUE, command, Settings.flag2.voltage_resolution); + Response_P(S_JSON_COMMAND_NVALUE, command, Settings.flag2.voltage_resolution); } else if (CMND_FREQUENCY_RESOLUTION == command_code) { if ((payload >= 0) && (payload <= 3)) { Settings.flag2.frequency_resolution = payload; } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_NVALUE, command, Settings.flag2.frequency_resolution); + Response_P(S_JSON_COMMAND_NVALUE, command, Settings.flag2.frequency_resolution); } else if (CMND_CURRENT_RESOLUTION == command_code) { if ((payload >= 0) && (payload <= 3)) { Settings.flag2.current_resolution = payload; } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_NVALUE, command, Settings.flag2.current_resolution); + Response_P(S_JSON_COMMAND_NVALUE, command, Settings.flag2.current_resolution); } else if (CMND_ENERGY_RESOLUTION == command_code) { if ((payload >= 0) && (payload <= 5)) { Settings.flag2.energy_resolution = payload; } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_NVALUE, command, Settings.flag2.energy_resolution); + Response_P(S_JSON_COMMAND_NVALUE, command, Settings.flag2.energy_resolution); } else if (CMND_WEIGHT_RESOLUTION == command_code) { if ((payload >= 0) && (payload <= 3)) { Settings.flag2.weight_resolution = payload; } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_NVALUE, command, Settings.flag2.weight_resolution); + Response_P(S_JSON_COMMAND_NVALUE, command, Settings.flag2.weight_resolution); } else if (CMND_MODULE == command_code) { if ((payload >= 0) && (payload <= MAXMODULE)) { @@ -869,23 +886,24 @@ void MqttDataHandler(char* topic, uint8_t* data, unsigned int data_len) } restart_flag = 2; } - uint8_t module = Settings.module; - if (USER_MODULE == Settings.module) { module = 0; } else { module++; } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_NVALUE_SVALUE, command, module, ModuleName().c_str()); + Response_P(S_JSON_COMMAND_NVALUE_SVALUE, command, ModuleNr(), ModuleName().c_str()); } else if (CMND_MODULES == command_code) { for (uint8_t i = 0; i <= MAXMODULE; i++) { if (!jsflg) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_MODULES "%d\":["), lines); + Response_P(PSTR("{\"" D_CMND_MODULES "%d\":["), lines); } else { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,"), mqtt_data); + ResponseAppend_P(PSTR(",")); } jsflg = true; uint8_t j = i; if (0 == i) { j = USER_MODULE; } else { j--; } - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s\"%d (%s)\""), mqtt_data, i, AnyModuleName(j).c_str()); - if ((strlen(mqtt_data) > (LOGSZ - TOPSZ)) || (i == MAXMODULE)) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s]}"), mqtt_data); + +// ResponseAppend_P(PSTR("\"%d (%s)\""), i, AnyModuleName(j).c_str()); +// if ((strlen(mqtt_data) > (LOGSZ - TOPSZ)) || (i == MAXMODULE)) { + + if ((ResponseAppend_P(PSTR("\"%d (%s)\""), i, AnyModuleName(j).c_str()) > (LOGSZ - TOPSZ)) || (i == MAXMODULE)) { + ResponseAppend_P(PSTR("]}")); MqttPublishPrefixTopic_P(RESULT_OR_STAT, type); jsflg = false; lines++; @@ -912,19 +930,18 @@ void MqttDataHandler(char* topic, uint8_t* data, unsigned int data_len) restart_flag = 2; } } - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{")); + Response_P(PSTR("{")); for (uint8_t i = 0; i < sizeof(Settings.my_gp); i++) { if (ValidGPIO(i, cmodule.io[i])) { - if (jsflg) snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,"), mqtt_data); + if (jsflg) { ResponseAppend_P(PSTR(",")); } jsflg = true; - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s\"" D_CMND_GPIO "%d\":\"%d (%s)\""), - mqtt_data, i, Settings.my_gp.io[i], GetTextIndexed(stemp1, sizeof(stemp1), Settings.my_gp.io[i], kSensorNames)); + ResponseAppend_P(PSTR("\"" D_CMND_GPIO "%d\":\"%d (%s)\""), i, Settings.my_gp.io[i], GetTextIndexed(stemp1, sizeof(stemp1), Settings.my_gp.io[i], kSensorNames)); } } if (jsflg) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s}"), mqtt_data); + ResponseAppend_P(PSTR("}")); } else { - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, D_JSON_NOT_SUPPORTED); + Response_P(S_JSON_COMMAND_SVALUE, command, D_JSON_NOT_SUPPORTED); } } else if (CMND_GPIOS == command_code) { @@ -935,14 +952,17 @@ void MqttDataHandler(char* topic, uint8_t* data, unsigned int data_len) midx = pgm_read_byte(kGpioNiceList + i); if (!GetUsedInModule(midx, cmodule.io)) { if (!jsflg) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_GPIOS "%d\":["), lines); + Response_P(PSTR("{\"" D_CMND_GPIOS "%d\":["), lines); } else { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,"), mqtt_data); + ResponseAppend_P(PSTR(",")); } jsflg = true; - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s\"%d (%s)\""), mqtt_data, midx, GetTextIndexed(stemp1, sizeof(stemp1), midx, kSensorNames)); - if ((strlen(mqtt_data) > (LOGSZ - TOPSZ)) || (i == sizeof(kGpioNiceList) -1)) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s]}"), mqtt_data); + +// ResponseAppend_P(PSTR("\"%d (%s)\""), midx, GetTextIndexed(stemp1, sizeof(stemp1), midx, kSensorNames)); +// if ((strlen(mqtt_data) > (LOGSZ - TOPSZ)) || (i == sizeof(kGpioNiceList) -1)) { + + if ((ResponseAppend_P(PSTR("\"%d (%s)\""), midx, GetTextIndexed(stemp1, sizeof(stemp1), midx, kSensorNames)) > (LOGSZ - TOPSZ)) || (i == sizeof(kGpioNiceList) -1)) { + ResponseAppend_P(PSTR("]}")); MqttPublishPrefixTopic_P(RESULT_OR_STAT, type); jsflg = false; lines++; @@ -954,71 +974,39 @@ void MqttDataHandler(char* topic, uint8_t* data, unsigned int data_len) else if (CMND_TEMPLATE == command_code) { // {"NAME":"Generic","GPIO":[17,254,29,254,7,254,254,254,138,254,139,254,254],"FLAG":1,"BASE":255} bool error = false; - if (!strstr(dataBuf, "{")) { // If no JSON it must be parameter - bool update = false; + + if (strstr(dataBuf, "{") == nullptr) { // If no JSON it must be parameter if ((payload > 0) && (payload <= MAXMODULE)) { ModuleDefault(payload -1); // Copy template module if (USER_MODULE == Settings.module) { restart_flag = 2; } } - else if (0 == payload) { // Copy current module with user configured GPIO - if (Settings.module < USER_MODULE) { + else if (0 == payload) { // Copy current template to user template + if (Settings.module != USER_MODULE) { ModuleDefault(Settings.module); - update = true; } } - if (USER_MODULE == Settings.module) { // Update with latest changes - update = true; - } - if (update) { - uint8_t src = 0; - for (uint8_t dst = 0; dst < sizeof(mycfgio); dst++) { - if (6 == dst) { src = 9; } - if (8 == dst) { src = 12; } - if (Settings.my_gp.io[src] > GPIO_NONE) { - if (Settings.user_template.gp.io[dst] != Settings.my_gp.io[src]) { - Settings.user_template.gp.io[dst] = Settings.my_gp.io[src]; - if (USER_MODULE == Settings.module) { restart_flag = 2; } - } + else if (255 == payload) { // Copy current module with user configured GPIO + if (Settings.module != USER_MODULE) { + ModuleDefault(Settings.module); + } + snprintf_P(Settings.user_template.name, sizeof(Settings.user_template.name), PSTR("Merged")); + uint8_t j = 0; + for (uint8_t i = 0; i < sizeof(mycfgio); i++) { + if (6 == i) { j = 9; } + if (8 == i) { j = 12; } + if (my_module.io[j] > GPIO_NONE) { + Settings.user_template.gp.io[i] = my_module.io[j]; } - src++; + j++; } } } - else if (data_len > 9) { // Workaround exception if empty JSON like {} - Needs checks - StaticJsonBuffer<350> jb; // 331 from https://arduinojson.org/v5/assistant/ - JsonObject& obj = jb.parseObject(dataBuf); - if (!obj.success()) { - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, D_JSON_INVALID_JSON); - error = true; - } else { - // All parameters are optional allowing for partial changes - const char* name = obj[D_JSON_NAME]; - if (name != nullptr) { - strlcpy(Settings.user_template.name, name, sizeof(Settings.user_template.name)); - } - if (obj[D_JSON_GPIO].success()) { - for (uint8_t i = 0; i < sizeof(mycfgio); i++) { - Settings.user_template.gp.io[i] = obj[D_JSON_GPIO][i] | 0; - } - } - if (obj[D_JSON_FLAG].success()) { - uint8_t flag = obj[D_JSON_FLAG] | 0; - memcpy(&Settings.user_template.flag, &flag, sizeof(gpio_flag)); - } - if (obj[D_JSON_BASE].success()) { - uint8_t base = obj[D_JSON_BASE]; - if ((0 == base) || (base >= MAXMODULE)) { base = 17; } else { base--; } - Settings.user_template_base = base; // Default WEMOS - } - - // Validate GPIO -// for (uint8_t i = 0; i < sizeof(mycfgio); i++) { - // For now do not allow non-user configurable GPIO -// if ((Settings.user_template.gp.io[i] > GPIO_FIX_START) && (Settings.user_template.gp.io[i] < GPIO_USER)) { -// Settings.user_template.gp.io[i] = GPIO_NONE; -// }; -// } + else if (data_len > 9) { // Workaround exception if empty JSON like {} - Needs checks + if (JsonTemplate(dataBuf)) { // Free 336 bytes StaticJsonBuffer stack space by moving code to function if (USER_MODULE == Settings.module) { restart_flag = 2; } + } else { + Response_P(S_JSON_COMMAND_SVALUE, command, D_JSON_INVALID_JSON); + error = true; } } if (!error) { TemplateJson(); } @@ -1028,16 +1016,16 @@ void MqttDataHandler(char* topic, uint8_t* data, unsigned int data_len) Settings.pwm_value[index -1] = payload; analogWrite(pin[GPIO_PWM1 + index -1], bitRead(pwm_inverted, index -1) ? Settings.pwm_range - payload : payload); } - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{")); + Response_P(PSTR("{")); MqttShowPWMState(); // Render the PWM status to MQTT - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s}"), mqtt_data); + ResponseAppend_P(PSTR("}")); } else if (CMND_PWMFREQUENCY == command_code) { if ((1 == payload) || ((payload >= PWM_MIN) && (payload <= PWM_MAX))) { Settings.pwm_frequency = (1 == payload) ? PWM_FREQ : payload; analogWriteFreq(Settings.pwm_frequency); // Default is 1000 (core_esp8266_wiring_pwm.c) } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_NVALUE, command, Settings.pwm_frequency); + Response_P(S_JSON_COMMAND_NVALUE, command, Settings.pwm_frequency); } else if (CMND_PWMRANGE == command_code) { if ((1 == payload) || ((payload > 254) && (payload < 1024))) { @@ -1049,7 +1037,7 @@ void MqttDataHandler(char* topic, uint8_t* data, unsigned int data_len) } analogWriteRange(Settings.pwm_range); // Default is 1023 (Arduino.h) } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_NVALUE, command, Settings.pwm_range); + Response_P(S_JSON_COMMAND_NVALUE, command, Settings.pwm_range); } else if ((CMND_COUNTER == command_code) && (index > 0) && (index <= MAX_COUNTERS)) { if ((data_len > 0) && (pin[GPIO_CNTR1 + index -1] < 99)) { @@ -1061,7 +1049,7 @@ void MqttDataHandler(char* topic, uint8_t* data, unsigned int data_len) Settings.pulse_counter[index -1] = payload32; } } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_INDEX_LVALUE, command, index, RtcSettings.pulse_counter[index -1]); + Response_P(S_JSON_COMMAND_INDEX_LVALUE, command, index, RtcSettings.pulse_counter[index -1]); } else if ((CMND_COUNTERTYPE == command_code) && (index > 0) && (index <= MAX_COUNTERS)) { if ((payload >= 0) && (payload <= 1) && (pin[GPIO_CNTR1 + index -1] < 99)) { @@ -1069,33 +1057,33 @@ void MqttDataHandler(char* topic, uint8_t* data, unsigned int data_len) RtcSettings.pulse_counter[index -1] = 0; Settings.pulse_counter[index -1] = 0; } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_INDEX_NVALUE, command, index, bitRead(Settings.pulse_counter_type, index -1)); + Response_P(S_JSON_COMMAND_INDEX_NVALUE, command, index, bitRead(Settings.pulse_counter_type, index -1)); } else if (CMND_COUNTERDEBOUNCE == command_code) { if ((data_len > 0) && (payload16 < 32001)) { Settings.pulse_counter_debounce = payload16; } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_NVALUE, command, Settings.pulse_counter_debounce); + Response_P(S_JSON_COMMAND_NVALUE, command, Settings.pulse_counter_debounce); } else if (CMND_BUTTONDEBOUNCE == command_code) { if ((payload > 39) && (payload < 1001)) { Settings.button_debounce = payload; } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_NVALUE, command, Settings.button_debounce); + Response_P(S_JSON_COMMAND_NVALUE, command, Settings.button_debounce); } else if (CMND_SWITCHDEBOUNCE == command_code) { if ((payload > 39) && (payload < 1001)) { Settings.switch_debounce = payload; } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_NVALUE, command, Settings.switch_debounce); + Response_P(S_JSON_COMMAND_NVALUE, command, Settings.switch_debounce); } else if (CMND_BAUDRATE == command_code) { - if (payload32 > 0) { + if (payload32 > 1200) { payload32 /= 1200; // Make it a valid baudrate baudrate = (1 == payload) ? APP_BAUDRATE : payload32 * 1200; SetSerialBaudrate(baudrate); } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_NVALUE, command, Settings.baudrate * 1200); + Response_P(S_JSON_COMMAND_NVALUE, command, Settings.baudrate * 1200); } else if ((CMND_SERIALSEND == command_code) && (index > 0) && (index <= 5)) { SetSeriallog(LOG_LEVEL_NONE); @@ -1117,7 +1105,7 @@ void MqttDataHandler(char* topic, uint8_t* data, unsigned int data_len) else if (5 == index) { SerialSendRaw(RemoveSpace(dataBuf)); // "AA004566" as hex values } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, D_JSON_DONE); + Response_P(S_JSON_COMMAND_SVALUE, command, D_JSON_DONE); } } else if (CMND_SERIALDELIMITER == command_code) { @@ -1130,7 +1118,7 @@ void MqttDataHandler(char* topic, uint8_t* data, unsigned int data_len) Settings.serial_delimiter = dataBuf[0]; } } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_NVALUE, command, Settings.serial_delimiter); + Response_P(S_JSON_COMMAND_NVALUE, command, Settings.serial_delimiter); } else if (CMND_SYSLOG == command_code) { if ((payload >= LOG_LEVEL_NONE) && (payload <= LOG_LEVEL_ALL)) { @@ -1138,19 +1126,19 @@ void MqttDataHandler(char* topic, uint8_t* data, unsigned int data_len) syslog_level = payload; syslog_timer = 0; } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_NVALUE_ACTIVE_NVALUE, command, Settings.syslog_level, syslog_level); + Response_P(S_JSON_COMMAND_NVALUE_ACTIVE_NVALUE, command, Settings.syslog_level, syslog_level); } else if (CMND_LOGHOST == command_code) { if ((data_len > 0) && (data_len < sizeof(Settings.syslog_host))) { strlcpy(Settings.syslog_host, (SC_DEFAULT == Shortcut(dataBuf)) ? SYS_LOG_HOST : dataBuf, sizeof(Settings.syslog_host)); } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, Settings.syslog_host); + Response_P(S_JSON_COMMAND_SVALUE, command, Settings.syslog_host); } else if (CMND_LOGPORT == command_code) { if (payload16 > 0) { Settings.syslog_port = (1 == payload16) ? SYS_LOG_PORT : payload16; } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_NVALUE, command, Settings.syslog_port); + Response_P(S_JSON_COMMAND_NVALUE, command, Settings.syslog_port); } else if ((CMND_IPADDRESS == command_code) && (index > 0) && (index <= 4)) { if (ParseIp(&address, dataBuf)) { @@ -1158,7 +1146,7 @@ void MqttDataHandler(char* topic, uint8_t* data, unsigned int data_len) // restart_flag = 2; } snprintf_P(stemp1, sizeof(stemp1), PSTR(" (%s)"), WiFi.localIP().toString().c_str()); - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_INDEX_SVALUE_SVALUE, command, index, IPAddress(Settings.ip_address[index -1]).toString().c_str(), (1 == index) ? stemp1:""); + Response_P(S_JSON_COMMAND_INDEX_SVALUE_SVALUE, command, index, IPAddress(Settings.ip_address[index -1]).toString().c_str(), (1 == index) ? stemp1:""); } else if ((CMND_NTPSERVER == command_code) && (index > 0) && (index <= 3)) { if ((data_len > 0) && (data_len < sizeof(Settings.ntp_server[0]))) { @@ -1169,7 +1157,7 @@ void MqttDataHandler(char* topic, uint8_t* data, unsigned int data_len) // restart_flag = 2; // Issue #3890 ntp_force_sync = true; } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_INDEX_SVALUE, command, index, Settings.ntp_server[index -1]); + Response_P(S_JSON_COMMAND_INDEX_SVALUE, command, index, Settings.ntp_server[index -1]); } else if (CMND_AP == command_code) { if ((payload >= 0) && (payload <= 2)) { @@ -1183,7 +1171,7 @@ void MqttDataHandler(char* topic, uint8_t* data, unsigned int data_len) } restart_flag = 2; } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_NVALUE_SVALUE, command, Settings.sta_active +1, Settings.sta_ssid[Settings.sta_active]); + Response_P(S_JSON_COMMAND_NVALUE_SVALUE, command, Settings.sta_active +1, Settings.sta_ssid[Settings.sta_active]); } else if ((CMND_SSID == command_code) && (index > 0) && (index <= 2)) { if ((data_len > 0) && (data_len < sizeof(Settings.sta_ssid[0]))) { @@ -1191,41 +1179,41 @@ void MqttDataHandler(char* topic, uint8_t* data, unsigned int data_len) Settings.sta_active = index -1; restart_flag = 2; } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_INDEX_SVALUE, command, index, Settings.sta_ssid[index -1]); + Response_P(S_JSON_COMMAND_INDEX_SVALUE, command, index, Settings.sta_ssid[index -1]); } else if ((CMND_PASSWORD == command_code) && (index > 0) && (index <= 2)) { - if ((data_len > 0) && (data_len < sizeof(Settings.sta_pwd[0]))) { + if ((data_len > 4 || SC_CLEAR == Shortcut(dataBuf) || SC_DEFAULT == Shortcut(dataBuf)) && (data_len < sizeof(Settings.sta_pwd[0]))) { strlcpy(Settings.sta_pwd[index -1], (SC_CLEAR == Shortcut(dataBuf)) ? "" : (SC_DEFAULT == Shortcut(dataBuf)) ? (1 == index) ? STA_PASS1 : STA_PASS2 : dataBuf, sizeof(Settings.sta_pwd[0])); Settings.sta_active = index -1; restart_flag = 2; - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_INDEX_SVALUE, command, index, Settings.sta_pwd[index -1]); + Response_P(S_JSON_COMMAND_INDEX_SVALUE, command, index, Settings.sta_pwd[index -1]); } else { - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_INDEX_ASTERIX, command, index); + Response_P(S_JSON_COMMAND_INDEX_ASTERIX, command, index); } } else if (CMND_HOSTNAME == command_code) { if (!grpflg && (data_len > 0) && (data_len < sizeof(Settings.hostname))) { strlcpy(Settings.hostname, (SC_DEFAULT == Shortcut(dataBuf)) ? WIFI_HOSTNAME : dataBuf, sizeof(Settings.hostname)); - if (strstr(Settings.hostname,"%")) { + if (strstr(Settings.hostname, "%") != nullptr) { strlcpy(Settings.hostname, WIFI_HOSTNAME, sizeof(Settings.hostname)); } restart_flag = 2; } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, Settings.hostname); + Response_P(S_JSON_COMMAND_SVALUE, command, Settings.hostname); } else if (CMND_WIFICONFIG == command_code) { if ((payload >= WIFI_RESTART) && (payload < MAX_WIFI_OPTION)) { Settings.sta_config = payload; wifi_state_flag = Settings.sta_config; snprintf_P(stemp1, sizeof(stemp1), kWifiConfig[Settings.sta_config]); - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_WIFICONFIG "\":\"%s " D_JSON_SELECTED "\"}"), stemp1); + Response_P(PSTR("{\"" D_CMND_WIFICONFIG "\":\"%s " D_JSON_SELECTED "\"}"), stemp1); if (WifiState() > WIFI_RESTART) { -// snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s after restart"), mqtt_data); +// ResponseAppend_P(PSTR(" after restart")); restart_flag = 2; } } else { snprintf_P(stemp1, sizeof(stemp1), kWifiConfig[Settings.sta_config]); - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_NVALUE_SVALUE, command, Settings.sta_config, stemp1); + Response_P(S_JSON_COMMAND_NVALUE_SVALUE, command, Settings.sta_config, stemp1); } } else if ((CMND_FRIENDLYNAME == command_code) && (index > 0) && (index <= MAX_FRIENDLYNAMES)) { @@ -1237,13 +1225,13 @@ void MqttDataHandler(char* topic, uint8_t* data, unsigned int data_len) } strlcpy(Settings.friendlyname[index -1], (SC_DEFAULT == Shortcut(dataBuf)) ? stemp1 : dataBuf, sizeof(Settings.friendlyname[index -1])); } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_INDEX_SVALUE, command, index, Settings.friendlyname[index -1]); + Response_P(S_JSON_COMMAND_INDEX_SVALUE, command, index, Settings.friendlyname[index -1]); } else if ((CMND_SWITCHMODE == command_code) && (index > 0) && (index <= MAX_SWITCHES)) { if ((payload >= 0) && (payload < MAX_SWITCH_OPTION)) { Settings.switchmode[index -1] = payload; } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_INDEX_NVALUE, command, index, Settings.switchmode[index-1]); + Response_P(S_JSON_COMMAND_INDEX_NVALUE, command, index, Settings.switchmode[index-1]); } else if (CMND_INTERLOCK == command_code) { // Interlock 0 - Off, Interlock 1 - On, Interlock 1,2 3,4 5,6,7 uint8_t max_relays = devices_present; @@ -1251,15 +1239,15 @@ void MqttDataHandler(char* topic, uint8_t* data, unsigned int data_len) if (max_relays > sizeof(Settings.interlock[0]) * 8) { max_relays = sizeof(Settings.interlock[0]) * 8; } if (max_relays > 1) { // Only interlock with more than 1 relay if (data_len > 0) { - if (strstr(dataBuf, ",")) { // Interlock entry + if (strstr(dataBuf, ",") != nullptr) { // Interlock entry for (uint8_t i = 0; i < MAX_INTERLOCKS; i++) { Settings.interlock[i] = 0; } // Reset current interlocks char *group; char *q; uint8_t group_index = 0; power_t relay_mask = 0; - for (group = strtok_r(dataBuf, " ", &q); group && group_index < MAX_INTERLOCKS; group = strtok_r(NULL, " ", &q)) { + for (group = strtok_r(dataBuf, " ", &q); group && group_index < MAX_INTERLOCKS; group = strtok_r(nullptr, " ", &q)) { char *str; - for (str = strtok_r(group, ",", &p); str; str = strtok_r(NULL, ",", &p)) { + for (str = strtok_r(group, ",", &p); str; str = strtok_r(nullptr, ",", &p)) { int pbit = atoi(str); if ((pbit > 0) && (pbit <= max_relays)) { // Only valid relays pbit--; @@ -1285,18 +1273,18 @@ void MqttDataHandler(char* topic, uint8_t* data, unsigned int data_len) } } } - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_INTERLOCK "\":\"%s\",\"" D_JSON_GROUPS "\":\""), GetStateText(Settings.flag.interlock)); + Response_P(PSTR("{\"" D_CMND_INTERLOCK "\":\"%s\",\"" D_JSON_GROUPS "\":\""), GetStateText(Settings.flag.interlock)); uint8_t anygroup = 0; for (uint8_t i = 0; i < MAX_INTERLOCKS; i++) { if (Settings.interlock[i]) { anygroup++; - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s%s"), mqtt_data, (anygroup > 1) ? " " : ""); + ResponseAppend_P(PSTR("%s"), (anygroup > 1) ? " " : ""); uint8_t anybit = 0; power_t mask = 1; for (uint8_t j = 0; j < max_relays; j++) { if (Settings.interlock[i] & mask) { anybit++; - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s%s%d"), mqtt_data, (anybit > 1) ? "," : "", j +1); + ResponseAppend_P(PSTR("%s%d"), (anybit > 1) ? "," : "", j +1); } mask <<= 1; } @@ -1304,13 +1292,13 @@ void MqttDataHandler(char* topic, uint8_t* data, unsigned int data_len) } if (!anygroup) { for (uint8_t j = 1; j <= max_relays; j++) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s%s%d"), mqtt_data, (j > 1) ? "," : "", j); + ResponseAppend_P(PSTR("%s%d"), (j > 1) ? "," : "", j); } } - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s\"}"), mqtt_data); + ResponseAppend_P(PSTR("\"}")); } else { Settings.flag.interlock = 0; - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, GetStateText(Settings.flag.interlock)); + Response_P(S_JSON_COMMAND_SVALUE, command, GetStateText(Settings.flag.interlock)); } } else if (CMND_TELEPERIOD == command_code) { @@ -1319,23 +1307,20 @@ void MqttDataHandler(char* topic, uint8_t* data, unsigned int data_len) if ((Settings.tele_period > 0) && (Settings.tele_period < 10)) Settings.tele_period = 10; // Do not allow periods < 10 seconds tele_period = Settings.tele_period; } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_NVALUE_UNIT, command, Settings.tele_period, (Settings.flag.value_units) ? " " D_UNIT_SECOND : ""); + Response_P(S_JSON_COMMAND_NVALUE_UNIT, command, Settings.tele_period, (Settings.flag.value_units) ? " " D_UNIT_SECOND : ""); } else if (CMND_RESET == command_code) { switch (payload) { case 1: restart_flag = 211; - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command , D_JSON_RESET_AND_RESTARTING); + Response_P(S_JSON_COMMAND_SVALUE, command , D_JSON_RESET_AND_RESTARTING); break; - case 2: - case 3: - case 4: - case 5: + case 2 ... 6: restart_flag = 210 + payload; - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_RESET "\":\"" D_JSON_ERASE ", " D_JSON_RESET_AND_RESTARTING "\"}")); + Response_P(PSTR("{\"" D_CMND_RESET "\":\"" D_JSON_ERASE ", " D_JSON_RESET_AND_RESTARTING "\"}")); break; default: - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, D_JSON_ONE_TO_RESET); + Response_P(S_JSON_COMMAND_SVALUE, command, D_JSON_ONE_TO_RESET); } } else if (CMND_TIMEZONE == command_code) { @@ -1345,9 +1330,9 @@ void MqttDataHandler(char* topic, uint8_t* data, unsigned int data_len) if (payload < 15) { p = strtok (dataBuf, ":"); if (p) { - p = strtok (NULL, ":"); + p = strtok (nullptr, ":"); if (p) { - Settings.timezone_minutes = strtol(p, NULL, 10); + Settings.timezone_minutes = strtol(p, nullptr, 10); if (Settings.timezone_minutes > 59) { Settings.timezone_minutes = 59; } } } @@ -1357,10 +1342,10 @@ void MqttDataHandler(char* topic, uint8_t* data, unsigned int data_len) ntp_force_sync = true; } if (99 == Settings.timezone) { - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_NVALUE, command, Settings.timezone); + Response_P(S_JSON_COMMAND_NVALUE, command, Settings.timezone); } else { snprintf_P(stemp1, sizeof(stemp1), PSTR("%+03d:%02d"), Settings.timezone, Settings.timezone_minutes); - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, stemp1); + Response_P(S_JSON_COMMAND_SVALUE, command, stemp1); } } else if ((CMND_TIMESTD == command_code) || (CMND_TIMEDST == command_code)) { @@ -1368,7 +1353,7 @@ void MqttDataHandler(char* topic, uint8_t* data, unsigned int data_len) uint8_t ts = 0; if (CMND_TIMEDST == command_code) { ts = 1; } if (data_len > 0) { - if (strstr(dataBuf, ",")) { // Process parameter entry + if (strstr(dataBuf, ",") != nullptr) { // Process parameter entry uint8_t tpos = 0; // Parameter index int value = 0; p = dataBuf; // Parameters like "1, 2,3 , 4 ,5, -120" or ",,,,,+240" @@ -1401,14 +1386,14 @@ void MqttDataHandler(char* topic, uint8_t* data, unsigned int data_len) ntp_force_sync = true; } } - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"%s\":{\"Hemisphere\":%d,\"Week\":%d,\"Month\":%d,\"Day\":%d,\"Hour\":%d,\"Offset\":%d}}"), + Response_P(PSTR("{\"%s\":{\"Hemisphere\":%d,\"Week\":%d,\"Month\":%d,\"Day\":%d,\"Hour\":%d,\"Offset\":%d}}"), command, Settings.tflag[ts].hemis, Settings.tflag[ts].week, Settings.tflag[ts].month, Settings.tflag[ts].dow, Settings.tflag[ts].hour, Settings.toffset[ts]); } else if (CMND_ALTITUDE == command_code) { if ((data_len > 0) && ((payload >= -30000) && (payload <= 30000))) { Settings.altitude = payload; } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_NVALUE, command, Settings.altitude); + Response_P(S_JSON_COMMAND_NVALUE, command, Settings.altitude); } else if (CMND_LEDPOWER == command_code) { if ((payload >= 0) && (payload <= 2)) { @@ -1425,7 +1410,7 @@ void MqttDataHandler(char* topic, uint8_t* data, unsigned int data_len) blinks = 0; SetLedPower(Settings.ledstate &8); } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, GetStateText(bitRead(Settings.ledstate, 3))); + Response_P(S_JSON_COMMAND_SVALUE, command, GetStateText(bitRead(Settings.ledstate, 3))); } else if (CMND_LEDSTATE == command_code) { if ((payload >= 0) && (payload < MAX_LED_OPTION)) { @@ -1435,22 +1420,22 @@ void MqttDataHandler(char* topic, uint8_t* data, unsigned int data_len) SetLedLink(0); } } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_NVALUE, command, Settings.ledstate); + Response_P(S_JSON_COMMAND_NVALUE, command, Settings.ledstate); } #ifdef USE_I2C else if ((CMND_I2CSCAN == command_code) && i2c_flg) { I2cScan(mqtt_data, sizeof(mqtt_data)); } #endif // USE_I2C - else type = NULL; // Unknown command + else type = nullptr; // Unknown command } - if (type == NULL) { + if (type == nullptr) { blinks = 201; snprintf_P(topicBuf, sizeof(topicBuf), PSTR(D_JSON_COMMAND)); - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_JSON_COMMAND "\":\"" D_JSON_UNKNOWN "\"}")); + Response_P(PSTR("{\"" D_JSON_COMMAND "\":\"" D_JSON_UNKNOWN "\"}")); type = (char*)topicBuf; } - if (mqtt_data[0] != '\0') MqttPublishPrefixTopic_P(RESULT_OR_STAT, type); + if (mqtt_data[0] != '\0') { MqttPublishPrefixTopic_P(RESULT_OR_STAT, type); } fallback_topic_flag = false; } @@ -1487,14 +1472,14 @@ bool SendKey(uint8_t key, uint8_t device, uint8_t state) } #ifdef USE_DOMOTICZ if (!(DomoticzSendKey(key, device, state, strlen(mqtt_data)))) { - MqttPublishDirect(stopic, (key) ? Settings.flag.mqtt_switch_retain : Settings.flag.mqtt_button_retain); + MqttPublishDirect(stopic, ((key) ? Settings.flag.mqtt_switch_retain : Settings.flag.mqtt_button_retain) && (state != 3 || !Settings.flag3.no_hold_retain)); } #else - MqttPublishDirect(stopic, (key) ? Settings.flag.mqtt_switch_retain : Settings.flag.mqtt_button_retain); + MqttPublishDirect(stopic, ((key) ? Settings.flag.mqtt_switch_retain : Settings.flag.mqtt_button_retain) && (state != 3 || !Settings.flag3.no_hold_retain)); #endif // USE_DOMOTICZ result = !Settings.flag3.button_switch_force_local; } else { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"%s%d\":{\"State\":%d}}"), (key) ? "Switch" : "Button", device, state); + Response_P(PSTR("{\"%s%d\":{\"State\":%d}}"), (key) ? "Switch" : "Button", device, state); result = XdrvRulesProcess(); } #ifdef USE_KNX @@ -1573,11 +1558,7 @@ void ExecuteCommandPower(uint8_t device, uint8_t state, int source) #ifdef USE_KNX KnxUpdatePowerState(device, power); #endif // USE_KNX - if (publish_power && Settings.flag3.hass_tele_on_power) { - mqtt_data[0] = '\0'; - MqttShowState(); - MqttPublishPrefixTopic_P(TELE, PSTR(D_RSLT_STATE), MQTT_TELE_RETAIN); - } + if (publish_power && Settings.flag3.hass_tele_on_power) { MqttPublishTeleState(); } if (device <= MAX_PULSETIMERS) { // Restart PulseTime if powered On SetPulseTimer(device -1, (((POWER_ALL_OFF_PULSETIME_ON == Settings.poweronstate) ? ~power : power) & mask) ? Settings.pulse_timer[device -1] : 0); } @@ -1619,23 +1600,27 @@ void StopAllPowerBlink(void) void ExecuteCommand(char *cmnd, int source) { - char stopic[CMDSZ]; - char svalue[INPUT_BUFFER_SIZE]; char *start; char *token; +#ifdef USE_DEBUG_DRIVER ShowFreeMem(PSTR("ExecuteCommand")); +#endif ShowSource(source); token = strtok(cmnd, " "); - if (token != NULL) { + if (token != nullptr) { start = strrchr(token, '/'); // Skip possible cmnd/sonoff/ preamble if (start) { token = start +1; } } - snprintf_P(stopic, sizeof(stopic), PSTR("/%s"), (token == NULL) ? "" : token); - token = strtok(NULL, ""); -// snprintf_P(svalue, sizeof(svalue), (token == NULL) ? "" : token); // Fails with command FullTopic home/%prefix%/%topic% as it processes %p of %prefix% - strlcpy(svalue, (token == NULL) ? "" : token, sizeof(svalue)); // Fixed 5.8.0b + uint16_t size = (token != nullptr) ? strlen(token) : 0; + char stopic[size +2]; // / + \0 + snprintf_P(stopic, sizeof(stopic), PSTR("/%s"), (token == nullptr) ? "" : token); + + token = strtok(nullptr, ""); + size = (token != nullptr) ? strlen(token) : 0; + char svalue[size +1]; + strlcpy(svalue, (token == nullptr) ? "" : token, sizeof(svalue)); // Fixed 5.8.0b MqttDataHandler(stopic, (uint8_t*)svalue, strlen(svalue)); } @@ -1662,19 +1647,19 @@ void PublishStatus(uint8_t payload) for (uint8_t i = 0; i < MAX_SWITCHES; i++) { snprintf_P(stemp2, sizeof(stemp2), PSTR("%s%s%d" ), stemp2, (i > 0 ? "," : ""), Settings.switchmode[i]); } - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_STATUS "\":{\"" D_CMND_MODULE "\":%d,\"" D_CMND_FRIENDLYNAME "\":[%s],\"" D_CMND_TOPIC "\":\"%s\",\"" D_CMND_BUTTONTOPIC "\":\"%s\",\"" D_CMND_POWER "\":%d,\"" D_CMND_POWERONSTATE "\":%d,\"" D_CMND_LEDSTATE "\":%d,\"" D_CMND_SAVEDATA "\":%d,\"" D_JSON_SAVESTATE "\":%d,\"" D_CMND_SWITCHTOPIC "\":\"%s\",\"" D_CMND_SWITCHMODE "\":[%s],\"" D_CMND_BUTTONRETAIN "\":%d,\"" D_CMND_SWITCHRETAIN "\":%d,\"" D_CMND_SENSORRETAIN "\":%d,\"" D_CMND_POWERRETAIN "\":%d}}"), - (USER_MODULE == Settings.module)?0:Settings.module +1, stemp, mqtt_topic, Settings.button_topic, power, Settings.poweronstate, Settings.ledstate, Settings.save_data, Settings.flag.save_state, Settings.switch_topic, stemp2, Settings.flag.mqtt_button_retain, Settings.flag.mqtt_switch_retain, Settings.flag.mqtt_sensor_retain, Settings.flag.mqtt_power_retain); + Response_P(PSTR("{\"" D_CMND_STATUS "\":{\"" D_CMND_MODULE "\":%d,\"" D_CMND_FRIENDLYNAME "\":[%s],\"" D_CMND_TOPIC "\":\"%s\",\"" D_CMND_BUTTONTOPIC "\":\"%s\",\"" D_CMND_POWER "\":%d,\"" D_CMND_POWERONSTATE "\":%d,\"" D_CMND_LEDSTATE "\":%d,\"" D_CMND_SAVEDATA "\":%d,\"" D_JSON_SAVESTATE "\":%d,\"" D_CMND_SWITCHTOPIC "\":\"%s\",\"" D_CMND_SWITCHMODE "\":[%s],\"" D_CMND_BUTTONRETAIN "\":%d,\"" D_CMND_SWITCHRETAIN "\":%d,\"" D_CMND_SENSORRETAIN "\":%d,\"" D_CMND_POWERRETAIN "\":%d}}"), + ModuleNr(), stemp, mqtt_topic, Settings.button_topic, power, Settings.poweronstate, Settings.ledstate, Settings.save_data, Settings.flag.save_state, Settings.switch_topic, stemp2, Settings.flag.mqtt_button_retain, Settings.flag.mqtt_switch_retain, Settings.flag.mqtt_sensor_retain, Settings.flag.mqtt_power_retain); MqttPublishPrefixTopic_P(option, PSTR(D_CMND_STATUS)); } if ((0 == payload) || (1 == payload)) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_STATUS D_STATUS1_PARAMETER "\":{\"" D_JSON_BAUDRATE "\":%d,\"" D_CMND_GROUPTOPIC "\":\"%s\",\"" D_CMND_OTAURL "\":\"%s\",\"" D_JSON_RESTARTREASON "\":\"%s\",\"" D_JSON_UPTIME "\":\"%s\",\"" D_JSON_STARTUPUTC "\":\"%s\",\"" D_CMND_SLEEP "\":%d,\"" D_JSON_BOOTCOUNT "\":%d,\"" D_JSON_SAVECOUNT "\":%d,\"" D_JSON_SAVEADDRESS "\":\"%X\"}}"), - baudrate, Settings.mqtt_grptopic, Settings.ota_url, GetResetReason().c_str(), GetUptime().c_str(), GetDateAndTime(DT_RESTART).c_str(), Settings.sleep, Settings.bootcount, Settings.save_flag, GetSettingsAddress()); + Response_P(PSTR("{\"" D_CMND_STATUS D_STATUS1_PARAMETER "\":{\"" D_JSON_BAUDRATE "\":%d,\"" D_CMND_GROUPTOPIC "\":\"%s\",\"" D_CMND_OTAURL "\":\"%s\",\"" D_JSON_RESTARTREASON "\":\"%s\",\"" D_JSON_UPTIME "\":\"%s\",\"" D_JSON_STARTUPUTC "\":\"%s\",\"" D_CMND_SLEEP "\":%d,\"" D_JSON_CONFIG_HOLDER "\":%d,\"" D_JSON_BOOTCOUNT "\":%d,\"" D_JSON_SAVECOUNT "\":%d,\"" D_JSON_SAVEADDRESS "\":\"%X\"}}"), + baudrate, Settings.mqtt_grptopic, Settings.ota_url, GetResetReason().c_str(), GetUptime().c_str(), GetDateAndTime(DT_RESTART).c_str(), Settings.sleep, Settings.cfg_holder, Settings.bootcount, Settings.save_flag, GetSettingsAddress()); MqttPublishPrefixTopic_P(option, PSTR(D_CMND_STATUS "1")); } if ((0 == payload) || (2 == payload)) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_STATUS D_STATUS2_FIRMWARE "\":{\"" D_JSON_VERSION "\":\"%s%s\",\"" D_JSON_BUILDDATETIME "\":\"%s\",\"" D_JSON_BOOTVERSION "\":%d,\"" D_JSON_COREVERSION "\":\"" ARDUINO_ESP8266_RELEASE "\",\"" D_JSON_SDKVERSION "\":\"%s\"}}"), + Response_P(PSTR("{\"" D_CMND_STATUS D_STATUS2_FIRMWARE "\":{\"" D_JSON_VERSION "\":\"%s%s\",\"" D_JSON_BUILDDATETIME "\":\"%s\",\"" D_JSON_BOOTVERSION "\":%d,\"" D_JSON_COREVERSION "\":\"" ARDUINO_ESP8266_RELEASE "\",\"" D_JSON_SDKVERSION "\":\"%s\"}}"), my_version, my_image, GetBuildDateAndTime().c_str(), ESP.getBootVersion(), ESP.getSdkVersion()); MqttPublishPrefixTopic_P(option, PSTR(D_CMND_STATUS "2")); } @@ -1684,27 +1669,27 @@ void PublishStatus(uint8_t payload) for (int8_t i = 0; i < PARAM8_SIZE; i++) { snprintf_P(stemp2, sizeof(stemp2), PSTR("%s%02X"), stemp2, Settings.param[i]); } - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_STATUS D_STATUS3_LOGGING "\":{\"" D_CMND_SERIALLOG "\":%d,\"" D_CMND_WEBLOG "\":%d,\"" D_CMND_SYSLOG "\":%d,\"" D_CMND_LOGHOST "\":\"%s\",\"" D_CMND_LOGPORT "\":%d,\"" D_CMND_SSID "\":[\"%s\",\"%s\"],\"" D_CMND_TELEPERIOD "\":%d,\"" D_JSON_RESOLUTION "\":\"%08X\",\"" D_CMND_SETOPTION "\":[\"%08X\",\"%s\",\"%08X\"]}}"), + Response_P(PSTR("{\"" D_CMND_STATUS D_STATUS3_LOGGING "\":{\"" D_CMND_SERIALLOG "\":%d,\"" D_CMND_WEBLOG "\":%d,\"" D_CMND_SYSLOG "\":%d,\"" D_CMND_LOGHOST "\":\"%s\",\"" D_CMND_LOGPORT "\":%d,\"" D_CMND_SSID "\":[\"%s\",\"%s\"],\"" D_CMND_TELEPERIOD "\":%d,\"" D_JSON_RESOLUTION "\":\"%08X\",\"" D_CMND_SETOPTION "\":[\"%08X\",\"%s\",\"%08X\"]}}"), Settings.seriallog_level, Settings.weblog_level, Settings.syslog_level, Settings.syslog_host, Settings.syslog_port, Settings.sta_ssid[0], Settings.sta_ssid[1], Settings.tele_period, Settings.flag2.data, Settings.flag.data, stemp2, Settings.flag3.data); MqttPublishPrefixTopic_P(option, PSTR(D_CMND_STATUS "3")); } if ((0 == payload) || (4 == payload)) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_STATUS D_STATUS4_MEMORY "\":{\"" D_JSON_PROGRAMSIZE "\":%d,\"" D_JSON_FREEMEMORY "\":%d,\"" D_JSON_HEAPSIZE "\":%d,\"" D_JSON_PROGRAMFLASHSIZE "\":%d,\"" D_JSON_FLASHSIZE "\":%d,\"" D_JSON_FLASHCHIPID "\":\"%06X\",\"" D_JSON_FLASHMODE "\":%d,\"" D_JSON_FEATURES "\":[\"%08X\",\"%08X\",\"%08X\",\"%08X\",\"%08X\"]}}"), + Response_P(PSTR("{\"" D_CMND_STATUS D_STATUS4_MEMORY "\":{\"" D_JSON_PROGRAMSIZE "\":%d,\"" D_JSON_FREEMEMORY "\":%d,\"" D_JSON_HEAPSIZE "\":%d,\"" D_JSON_PROGRAMFLASHSIZE "\":%d,\"" D_JSON_FLASHSIZE "\":%d,\"" D_JSON_FLASHCHIPID "\":\"%06X\",\"" D_JSON_FLASHMODE "\":%d,\"" D_JSON_FEATURES "\":[\"%08X\",\"%08X\",\"%08X\",\"%08X\",\"%08X\"]}}"), ESP.getSketchSize()/1024, ESP.getFreeSketchSpace()/1024, ESP.getFreeHeap()/1024, ESP.getFlashChipSize()/1024, ESP.getFlashChipRealSize()/1024, ESP.getFlashChipId(), ESP.getFlashChipMode(), LANGUAGE_LCID, feature_drv1, feature_drv2, feature_sns1, feature_sns2); MqttPublishPrefixTopic_P(option, PSTR(D_CMND_STATUS "4")); } if ((0 == payload) || (5 == payload)) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_STATUS D_STATUS5_NETWORK "\":{\"" D_CMND_HOSTNAME "\":\"%s\",\"" D_CMND_IPADDRESS "\":\"%s\",\"" D_JSON_GATEWAY "\":\"%s\",\"" D_JSON_SUBNETMASK "\":\"%s\",\"" D_JSON_DNSSERVER "\":\"%s\",\"" D_JSON_MAC "\":\"%s\",\"" D_CMND_WEBSERVER "\":%d,\"" D_CMND_WIFICONFIG "\":%d}}"), + Response_P(PSTR("{\"" D_CMND_STATUS D_STATUS5_NETWORK "\":{\"" D_CMND_HOSTNAME "\":\"%s\",\"" D_CMND_IPADDRESS "\":\"%s\",\"" D_JSON_GATEWAY "\":\"%s\",\"" D_JSON_SUBNETMASK "\":\"%s\",\"" D_JSON_DNSSERVER "\":\"%s\",\"" D_JSON_MAC "\":\"%s\",\"" D_CMND_WEBSERVER "\":%d,\"" D_CMND_WIFICONFIG "\":%d}}"), my_hostname, WiFi.localIP().toString().c_str(), IPAddress(Settings.ip_address[1]).toString().c_str(), IPAddress(Settings.ip_address[2]).toString().c_str(), IPAddress(Settings.ip_address[3]).toString().c_str(), WiFi.macAddress().c_str(), Settings.webserver, Settings.sta_config); MqttPublishPrefixTopic_P(option, PSTR(D_CMND_STATUS "5")); } if (((0 == payload) || (6 == payload)) && Settings.flag.mqtt_enabled) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_STATUS D_STATUS6_MQTT "\":{\"" D_CMND_MQTTHOST "\":\"%s\",\"" D_CMND_MQTTPORT "\":%d,\"" D_CMND_MQTTCLIENT D_JSON_MASK "\":\"%s\",\"" D_CMND_MQTTCLIENT "\":\"%s\",\"" D_CMND_MQTTUSER "\":\"%s\",\"MqttType\":%d,\"MAX_PACKET_SIZE\":%d,\"KEEPALIVE\":%d}}"), - Settings.mqtt_host, Settings.mqtt_port, Settings.mqtt_client, mqtt_client, Settings.mqtt_user, MqttLibraryType(), MQTT_MAX_PACKET_SIZE, MQTT_KEEPALIVE); + Response_P(PSTR("{\"" D_CMND_STATUS D_STATUS6_MQTT "\":{\"" D_CMND_MQTTHOST "\":\"%s\",\"" D_CMND_MQTTPORT "\":%d,\"" D_CMND_MQTTCLIENT D_JSON_MASK "\":\"%s\",\"" D_CMND_MQTTCLIENT "\":\"%s\",\"" D_CMND_MQTTUSER "\":\"%s\",\"" D_JSON_MQTT_COUNT "\":%d,\"MAX_PACKET_SIZE\":%d,\"KEEPALIVE\":%d}}"), + Settings.mqtt_host, Settings.mqtt_port, Settings.mqtt_client, mqtt_client, Settings.mqtt_user, MqttConnectCount(), MQTT_MAX_PACKET_SIZE, MQTT_KEEPALIVE); MqttPublishPrefixTopic_P(option, PSTR(D_CMND_STATUS "6")); } @@ -1715,10 +1700,10 @@ void PublishStatus(uint8_t payload) snprintf_P(stemp, sizeof(stemp), PSTR("\"%s\"" ), GetTimeZone().c_str()); } #if defined(USE_TIMERS) && defined(USE_SUNRISE) - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_STATUS D_STATUS7_TIME "\":{\"" D_JSON_UTC_TIME "\":\"%s\",\"" D_JSON_LOCAL_TIME "\":\"%s\",\"" D_JSON_STARTDST "\":\"%s\",\"" D_JSON_ENDDST "\":\"%s\",\"" D_CMND_TIMEZONE "\":%s,\"" D_JSON_SUNRISE "\":\"%s\",\"" D_JSON_SUNSET "\":\"%s\"}}"), + Response_P(PSTR("{\"" D_CMND_STATUS D_STATUS7_TIME "\":{\"" D_JSON_UTC_TIME "\":\"%s\",\"" D_JSON_LOCAL_TIME "\":\"%s\",\"" D_JSON_STARTDST "\":\"%s\",\"" D_JSON_ENDDST "\":\"%s\",\"" D_CMND_TIMEZONE "\":%s,\"" D_JSON_SUNRISE "\":\"%s\",\"" D_JSON_SUNSET "\":\"%s\"}}"), GetTime(0).c_str(), GetTime(1).c_str(), GetTime(2).c_str(), GetTime(3).c_str(), stemp, GetSun(0).c_str(), GetSun(1).c_str()); #else - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_STATUS D_STATUS7_TIME "\":{\"" D_JSON_UTC_TIME "\":\"%s\",\"" D_JSON_LOCAL_TIME "\":\"%s\",\"" D_JSON_STARTDST "\":\"%s\",\"" D_JSON_ENDDST "\":\"%s\",\"" D_CMND_TIMEZONE "\":%s}}"), + Response_P(PSTR("{\"" D_CMND_STATUS D_STATUS7_TIME "\":{\"" D_JSON_UTC_TIME "\":\"%s\",\"" D_JSON_LOCAL_TIME "\":\"%s\",\"" D_JSON_STARTDST "\":\"%s\",\"" D_JSON_ENDDST "\":\"%s\",\"" D_CMND_TIMEZONE "\":%s}}"), GetTime(0).c_str(), GetTime(1).c_str(), GetTime(2).c_str(), GetTime(3).c_str(), stemp); #endif // USE_TIMERS and USE_SUNRISE MqttPublishPrefixTopic_P(option, PSTR(D_CMND_STATUS "7")); @@ -1726,16 +1711,16 @@ void PublishStatus(uint8_t payload) if (energy_flg) { if ((0 == payload) || (9 == payload)) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_STATUS D_STATUS9_MARGIN "\":{\"" D_CMND_POWERDELTA "\":%d,\"" D_CMND_POWERLOW "\":%d,\"" D_CMND_POWERHIGH "\":%d,\"" D_CMND_VOLTAGELOW "\":%d,\"" D_CMND_VOLTAGEHIGH "\":%d,\"" D_CMND_CURRENTLOW "\":%d,\"" D_CMND_CURRENTHIGH "\":%d}}"), + Response_P(PSTR("{\"" D_CMND_STATUS D_STATUS9_MARGIN "\":{\"" D_CMND_POWERDELTA "\":%d,\"" D_CMND_POWERLOW "\":%d,\"" D_CMND_POWERHIGH "\":%d,\"" D_CMND_VOLTAGELOW "\":%d,\"" D_CMND_VOLTAGEHIGH "\":%d,\"" D_CMND_CURRENTLOW "\":%d,\"" D_CMND_CURRENTHIGH "\":%d}}"), Settings.energy_power_delta, Settings.energy_min_power, Settings.energy_max_power, Settings.energy_min_voltage, Settings.energy_max_voltage, Settings.energy_min_current, Settings.energy_max_current); MqttPublishPrefixTopic_P(option, PSTR(D_CMND_STATUS "9")); } } if ((0 == payload) || (8 == payload) || (10 == payload)) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_STATUS D_STATUS10_SENSOR "\":")); + Response_P(PSTR("{\"" D_CMND_STATUS D_STATUS10_SENSOR "\":")); MqttShowSensor(); - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s}"), mqtt_data); + ResponseAppend_P(PSTR("}")); if (8 == payload) { MqttPublishPrefixTopic_P(option, PSTR(D_CMND_STATUS "8")); } else { @@ -1744,9 +1729,9 @@ void PublishStatus(uint8_t payload) } if ((0 == payload) || (11 == payload)) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_STATUS D_STATUS11_STATUS "\":")); + Response_P(PSTR("{\"" D_CMND_STATUS D_STATUS11_STATUS "\":")); MqttShowState(); - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s}"), mqtt_data); + ResponseAppend_P(PSTR("}")); MqttPublishPrefixTopic_P(option, PSTR(D_CMND_STATUS "11")); } @@ -1754,55 +1739,62 @@ void PublishStatus(uint8_t payload) void MqttShowPWMState(void) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s\"" D_CMND_PWM "\":{"), mqtt_data); + ResponseAppend_P(PSTR("\"" D_CMND_PWM "\":{")); bool first = true; for (uint8_t i = 0; i < MAX_PWMS; i++) { if (pin[GPIO_PWM1 + i] < 99) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s%s\"" D_CMND_PWM "%d\":%d"), mqtt_data, first ? "" : ",", i+1, Settings.pwm_value[i]); + ResponseAppend_P(PSTR("%s\"" D_CMND_PWM "%d\":%d"), first ? "" : ",", i+1, Settings.pwm_value[i]); first = false; } } - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s}"), mqtt_data); + ResponseAppend_P(PSTR("}")); } void MqttShowState(void) { char stemp1[33]; - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s{\"" D_JSON_TIME "\":\"%s\",\"" D_JSON_UPTIME "\":\"%s\""), mqtt_data, GetDateAndTime(DT_LOCAL).c_str(), GetUptime().c_str()); + ResponseAppend_P(PSTR("{\"" D_JSON_TIME "\":\"%s\",\"" D_JSON_UPTIME "\":\"%s\""), GetDateAndTime(DT_LOCAL).c_str(), GetUptime().c_str()); #ifdef USE_ADC_VCC dtostrfd((double)ESP.getVcc()/1000, 3, stemp1); - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"" D_JSON_VCC "\":%s"), mqtt_data, stemp1); + ResponseAppend_P(PSTR(",\"" D_JSON_VCC "\":%s"), stemp1); #endif - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"SleepMode\":\"%s\",\"Sleep\":%u,\"LoadAvg\":%u"), - mqtt_data, GetTextIndexed(stemp1, sizeof(stemp1), Settings.flag3.sleep_normal, kSleepMode), sleep, loop_load_avg); + ResponseAppend_P(PSTR(",\"SleepMode\":\"%s\",\"Sleep\":%u,\"LoadAvg\":%u"), + GetTextIndexed(stemp1, sizeof(stemp1), Settings.flag3.sleep_normal, kSleepMode), sleep, loop_load_avg); for (uint8_t i = 0; i < devices_present; i++) { if (i == light_device -1) { LightState(1); } else { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"%s\":\"%s\""), mqtt_data, GetPowerDevice(stemp1, i +1, sizeof(stemp1), Settings.flag.device_index_enable), GetStateText(bitRead(power, i))); + ResponseAppend_P(PSTR(",\"%s\":\"%s\""), GetPowerDevice(stemp1, i +1, sizeof(stemp1), Settings.flag.device_index_enable), GetStateText(bitRead(power, i))); if (SONOFF_IFAN02 == my_module_type) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"" D_CMND_FANSPEED "\":%d"), mqtt_data, GetFanspeed()); + ResponseAppend_P(PSTR(",\"" D_CMND_FANSPEED "\":%d"), GetFanspeed()); break; } } } if (pwm_present) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,"), mqtt_data); + ResponseAppend_P(PSTR(",")); MqttShowPWMState(); } - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"" D_JSON_WIFI "\":{\"" D_JSON_AP "\":%d,\"" D_JSON_SSID "\":\"%s\",\"" D_JSON_BSSID "\":\"%s\",\"" D_JSON_CHANNEL "\":%d,\"" D_JSON_RSSI "\":%d}}"), - mqtt_data, Settings.sta_active +1, Settings.sta_ssid[Settings.sta_active], WiFi.BSSIDstr().c_str(), WiFi.channel(), WifiGetRssiAsQuality(WiFi.RSSI())); + ResponseAppend_P(PSTR(",\"" D_JSON_WIFI "\":{\"" D_JSON_AP "\":%d,\"" D_JSON_SSID "\":\"%s\",\"" D_JSON_BSSID "\":\"%s\",\"" D_JSON_CHANNEL "\":%d,\"" D_JSON_RSSI "\":%d,\"" D_JSON_LINK_COUNT "\":%d,\"" D_JSON_DOWNTIME "\":\"%s\"}}"), + Settings.sta_active +1, Settings.sta_ssid[Settings.sta_active], WiFi.BSSIDstr().c_str(), WiFi.channel(), WifiGetRssiAsQuality(WiFi.RSSI()), WifiLinkCount(), WifiDowntime().c_str()); +} + +void MqttPublishTeleState(void) +{ + mqtt_data[0] = '\0'; + MqttShowState(); + MqttPublishPrefixTopic_P(TELE, PSTR(D_RSLT_STATE), MQTT_TELE_RETAIN); } bool MqttShowSensor(void) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s{\"" D_JSON_TIME "\":\"%s\""), mqtt_data, GetDateAndTime(DT_LOCAL).c_str()); + ResponseAppend_P(PSTR("{\"" D_JSON_TIME "\":\"%s\""), GetDateAndTime(DT_LOCAL).c_str()); int json_data_start = strlen(mqtt_data); for (uint8_t i = 0; i < MAX_SWITCHES; i++) { #ifdef USE_TM1638 @@ -1811,20 +1803,20 @@ bool MqttShowSensor(void) if (pin[GPIO_SWT1 +i] < 99) { #endif // USE_TM1638 bool swm = ((FOLLOW_INV == Settings.switchmode[i]) || (PUSHBUTTON_INV == Settings.switchmode[i]) || (PUSHBUTTONHOLD_INV == Settings.switchmode[i])); - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"" D_JSON_SWITCH "%d\":\"%s\""), mqtt_data, i +1, GetStateText(swm ^ SwitchLastState(i))); + ResponseAppend_P(PSTR(",\"" D_JSON_SWITCH "%d\":\"%s\""), i +1, GetStateText(swm ^ SwitchLastState(i))); } } XsnsCall(FUNC_JSON_APPEND); bool json_data_available = (strlen(mqtt_data) - json_data_start); - if (strstr_P(mqtt_data, PSTR(D_JSON_PRESSURE))) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"" D_JSON_PRESSURE_UNIT "\":\"%s\""), mqtt_data, PressureUnit().c_str()); + if (strstr_P(mqtt_data, PSTR(D_JSON_PRESSURE)) != nullptr) { + ResponseAppend_P(PSTR(",\"" D_JSON_PRESSURE_UNIT "\":\"%s\""), PressureUnit().c_str()); } - if (strstr_P(mqtt_data, PSTR(D_JSON_TEMPERATURE))) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"" D_JSON_TEMPERATURE_UNIT "\":\"%c\""), mqtt_data, TempUnit()); + if (strstr_P(mqtt_data, PSTR(D_JSON_TEMPERATURE)) != nullptr) { + ResponseAppend_P(PSTR(",\"" D_JSON_TEMPERATURE_UNIT "\":\"%c\""), TempUnit()); } - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s}"), mqtt_data); + ResponseAppend_P(PSTR("}")); - if (json_data_available) XdrvCall(FUNC_SHOW_SENSOR); + if (json_data_available) { XdrvCall(FUNC_SHOW_SENSOR); } return json_data_available; } @@ -1839,8 +1831,7 @@ void PerformEverySecond(void) RtcRebootSave(); Settings.bootcount++; // Moved to here to stop flash writes during start-up - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_APPLICATION D_BOOT_COUNT " %d"), Settings.bootcount); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION D_BOOT_COUNT " %d"), Settings.bootcount); } if ((4 == uptime) && (SONOFF_IFAN02 == my_module_type)) { // Microcontroller needs 3 seconds before accepting commands @@ -1878,9 +1869,7 @@ void PerformEverySecond(void) if (tele_period >= Settings.tele_period) { tele_period = 0; - mqtt_data[0] = '\0'; - MqttShowState(); - MqttPublishPrefixTopic_P(TELE, PSTR(D_RSLT_STATE), MQTT_TELE_RETAIN); + MqttPublishTeleState(); mqtt_data[0] = '\0'; if (MqttShowSensor()) { @@ -1897,7 +1886,7 @@ void PerformEverySecond(void) if ((2 == RtcTime.minute) && latest_uptime_flag) { latest_uptime_flag = false; - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_JSON_TIME "\":\"%s\",\"" D_JSON_UPTIME "\":\"%s\"}"), GetDateAndTime(DT_LOCAL).c_str(), GetUptime().c_str()); + Response_P(PSTR("{\"" D_JSON_TIME "\":\"%s\",\"" D_JSON_UPTIME "\":\"%s\"}"), GetDateAndTime(DT_LOCAL).c_str(), GetUptime().c_str()); MqttPublishPrefixTopic_P(TELE, PSTR(D_RSLT_UPTIME)); } if ((3 == RtcTime.minute) && !latest_uptime_flag) latest_uptime_flag = true; @@ -2037,8 +2026,8 @@ void Every250mSeconds(void) #ifndef FIRMWARE_MINIMAL if (RtcSettings.ota_loader) { char *bch = strrchr(mqtt_data, '/'); // Only consider filename after last backslash prevent change of urls having "-" in it - char *pch = strrchr((bch != NULL) ? bch : mqtt_data, '-'); // Change from filename-DE.bin into filename-minimal.bin - char *ech = strrchr((bch != NULL) ? bch : mqtt_data, '.'); // Change from filename.bin into filename-minimal.bin + char *pch = strrchr((bch != nullptr) ? bch : mqtt_data, '-'); // Change from filename-DE.bin into filename-minimal.bin + char *ech = strrchr((bch != nullptr) ? bch : mqtt_data, '.'); // Change from filename.bin into filename-minimal.bin if (!pch) { pch = ech; } if (pch) { mqtt_data[pch - mqtt_data] = '\0'; @@ -2047,8 +2036,7 @@ void Every250mSeconds(void) } } #endif // FIRMWARE_MINIMAL - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_UPLOAD "%s"), mqtt_data); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_UPLOAD "%s"), mqtt_data); #if defined(ARDUINO_ESP8266_RELEASE_2_3_0) || defined(ARDUINO_ESP8266_RELEASE_2_4_0) || defined(ARDUINO_ESP8266_RELEASE_2_4_1) || defined(ARDUINO_ESP8266_RELEASE_2_4_2) ota_result = (HTTP_UPDATE_FAILED != ESPhttpUpdate.update(mqtt_data)); #else @@ -2059,8 +2047,7 @@ void Every250mSeconds(void) if (!ota_result) { #ifndef FIRMWARE_MINIMAL int ota_error = ESPhttpUpdate.getLastError(); -// snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_UPLOAD "Ota error %d"), ota_error); -// AddLog(LOG_LEVEL_DEBUG); +// AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_UPLOAD "Ota error %d"), ota_error); if ((HTTP_UE_TOO_LESS_SPACE == ota_error) || (HTTP_UE_BIN_FOR_WRONG_FLASH == ota_error)) { RtcSettings.ota_loader = 1; // Try minimal image next } @@ -2073,9 +2060,9 @@ void Every250mSeconds(void) ota_state_flag = 0; if (ota_result) { // SetFlashModeDout(); // Force DOUT for both ESP8266 and ESP8285 - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR(D_JSON_SUCCESSFUL ". " D_JSON_RESTARTING)); + Response_P(PSTR(D_JSON_SUCCESSFUL ". " D_JSON_RESTARTING)); } else { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR(D_JSON_FAILED " %s"), ESPhttpUpdate.getLastErrorString().c_str()); + Response_P(PSTR(D_JSON_FAILED " %s"), ESPhttpUpdate.getLastErrorString().c_str()); } restart_flag = 2; // Restart anyway to keep memory clean webserver MqttPublishPrefixTopic_P(STAT, PSTR(D_CMND_UPGRADE)); @@ -2105,14 +2092,28 @@ void Every250mSeconds(void) } } if (restart_flag && (backlog_pointer == backlog_index)) { - if ((214 == restart_flag) || (215 == restart_flag)) { - char storage[sizeof(Settings.sta_ssid) + sizeof(Settings.sta_pwd)]; - memcpy(storage, Settings.sta_ssid, sizeof(storage)); // Backup current SSIDs and Passwords - if (215 == restart_flag) { + if ((214 == restart_flag) || (215 == restart_flag) || (216 == restart_flag)) { + char storage_wifi[sizeof(Settings.sta_ssid) + + sizeof(Settings.sta_pwd)]; + char storage_mqtt[sizeof(Settings.mqtt_host) + + sizeof(Settings.mqtt_port) + + sizeof(Settings.mqtt_client) + + sizeof(Settings.mqtt_user) + + sizeof(Settings.mqtt_pwd) + + sizeof(Settings.mqtt_topic)]; + memcpy(storage_wifi, Settings.sta_ssid, sizeof(storage_wifi)); // Backup current SSIDs and Passwords + if (216 == restart_flag) { + memcpy(storage_mqtt, Settings.mqtt_host, sizeof(storage_mqtt)); // Backup mqtt host, port, client, username and password + } + if ((215 == restart_flag) || (216 == restart_flag)) { SettingsErase(0); // Erase all flash from program end to end of physical flash } SettingsDefault(); - memcpy(Settings.sta_ssid, storage, sizeof(storage)); // Restore current SSIDs and Passwords + memcpy(Settings.sta_ssid, storage_wifi, sizeof(storage_wifi)); // Restore current SSIDs and Passwords + if (216 == restart_flag) { + memcpy(Settings.mqtt_host, storage_mqtt, sizeof(storage_mqtt)); // Restore the mqtt host, port, client, username and password + strlcpy(Settings.mqtt_client, MQTT_CLIENT_ID, sizeof(Settings.mqtt_client)); // Set client to default + } restart_flag = 2; } else if (213 == restart_flag) { @@ -2172,8 +2173,7 @@ void ArduinoOTAInit(void) AriluxRfDisable(); // Prevent restart exception on Arilux Interrupt routine #endif // USE_ARILUX_RF if (Settings.flag.mqtt_enabled) { MqttDisconnect(); } - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_UPLOAD "Arduino OTA " D_UPLOAD_STARTED)); - AddLog(LOG_LEVEL_INFO); + AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_UPLOAD "Arduino OTA " D_UPLOAD_STARTED)); arduino_ota_triggered = true; arduino_ota_progress_dot_count = 0; delay(100); // Allow time for message xfer @@ -2204,22 +2204,19 @@ void ArduinoOTAInit(void) default: snprintf_P(error_str, sizeof(error_str), PSTR(D_UPLOAD_ERROR_CODE " %d"), error); } - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_UPLOAD "Arduino OTA %s. " D_RESTARTING), error_str); - AddLog(LOG_LEVEL_INFO); + AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_UPLOAD "Arduino OTA %s. " D_RESTARTING), error_str); EspRestart(); }); ArduinoOTA.onEnd([]() { if ((LOG_LEVEL_DEBUG <= seriallog_level)) { Serial.println(); } - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_UPLOAD "Arduino OTA " D_SUCCESSFUL ". " D_RESTARTING)); - AddLog(LOG_LEVEL_INFO); + AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_UPLOAD "Arduino OTA " D_SUCCESSFUL ". " D_RESTARTING)); EspRestart(); }); ArduinoOTA.begin(); - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_UPLOAD "Arduino OTA " D_ENABLED " " D_PORT " 8266")); - AddLog(LOG_LEVEL_INFO); + AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_UPLOAD "Arduino OTA " D_ENABLED " " D_PORT " 8266")); } #endif // USE_ARDUINO_OTA @@ -2228,7 +2225,8 @@ void ArduinoOTAInit(void) void SerialInput(void) { while (Serial.available()) { - yield(); +// yield(); + delay(0); serial_in_byte = Serial.read(); /*-------------------------------------------------------------------------------------------*\ @@ -2294,8 +2292,7 @@ void SerialInput(void) else if (!Settings.flag.mqtt_serial && (serial_in_byte == '\n')) { serial_in_buffer[serial_in_byte_counter] = 0; // Serial data completed seriallog_level = (Settings.seriallog_level < LOG_LEVEL_INFO) ? (uint8_t)LOG_LEVEL_INFO : Settings.seriallog_level; - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_COMMAND "%s"), serial_in_buffer); - AddLog(LOG_LEVEL_INFO); + AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_COMMAND "%s"), serial_in_buffer); ExecuteCommand(serial_in_buffer, SRC_SERIAL); serial_in_byte_counter = 0; serial_polling_window = 0; @@ -2307,13 +2304,13 @@ void SerialInput(void) if (Settings.flag.mqtt_serial && serial_in_byte_counter && (millis() > (serial_polling_window + SERIAL_POLLING))) { serial_in_buffer[serial_in_byte_counter] = 0; // Serial data completed if (!Settings.flag.mqtt_serial_raw) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_JSON_SERIALRECEIVED "\":\"%s\"}"), serial_in_buffer); + Response_P(PSTR("{\"" D_JSON_SERIALRECEIVED "\":\"%s\"}"), serial_in_buffer); } else { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_JSON_SERIALRECEIVED "\":\"")); + Response_P(PSTR("{\"" D_JSON_SERIALRECEIVED "\":\"")); for (int i = 0; i < serial_in_byte_counter; i++) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s%02x"), mqtt_data, serial_in_buffer[i]); + ResponseAppend_P(PSTR("%02x"), serial_in_buffer[i]); } - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s\"}"), mqtt_data); + ResponseAppend_P(PSTR("\"}")); } MqttPublishPrefixTopic_P(RESULT_OR_TELE, PSTR(D_JSON_SERIALRECEIVED)); // XdrvRulesProcess(); @@ -2337,17 +2334,23 @@ void GpioInit(void) baudrate = APP_BAUDRATE; } + for (uint8_t i = 0; i < sizeof(Settings.user_template.gp); i++) { + if ((Settings.user_template.gp.io[i] >= GPIO_SENSOR_END) && (Settings.user_template.gp.io[i] < GPIO_USER)) { + Settings.user_template.gp.io[i] = GPIO_USER; // Fix not supported sensor ids in template + } + } + myio def_gp; ModuleGpios(&def_gp); for (uint8_t i = 0; i < sizeof(Settings.my_gp); i++) { - if (Settings.my_gp.io[i] > GPIO_NONE) { + if ((Settings.my_gp.io[i] >= GPIO_SENSOR_END) && (Settings.my_gp.io[i] < GPIO_USER)) { + Settings.my_gp.io[i] = GPIO_NONE; // Fix not supported sensor ids in module + } + else if (Settings.my_gp.io[i] > GPIO_NONE) { my_module.io[i] = Settings.my_gp.io[i]; } if ((def_gp.io[i] > GPIO_NONE) && (def_gp.io[i] < GPIO_USER)) { my_module.io[i] = def_gp.io[i]; - if (USER_MODULE == Settings.module) { - Settings.my_gp.io[i] = def_gp.io[i]; // Copy user template settings - } } } my_module_flag = ModuleFlag(); @@ -2358,8 +2361,7 @@ void GpioInit(void) for (uint8_t i = 0; i < sizeof(my_module.io); i++) { mpin = ValidPin(i, my_module.io[i]); -// snprintf_P(log_data, sizeof(log_data), PSTR("DBG: gpio pin %d, mpin %d"), i, mpin); -// AddLog(LOG_LEVEL_DEBUG); +// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("DBG: gpio pin %d, mpin %d"), i, mpin); if (mpin) { if ((mpin >= GPIO_SWT1_NP) && (mpin < (GPIO_SWT1_NP + MAX_SWITCHES))) { @@ -2604,14 +2606,13 @@ void setup(void) Settings.module = SONOFF_BASIC; // Reset module to Sonoff Basic // Settings.last_module = SONOFF_BASIC; } - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_APPLICATION D_LOG_SOME_SETTINGS_RESET " (%d)"), RtcReboot.fast_reboot_count); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION D_LOG_SOME_SETTINGS_RESET " (%d)"), RtcReboot.fast_reboot_count); } } Format(mqtt_client, Settings.mqtt_client, sizeof(mqtt_client)); Format(mqtt_topic, Settings.mqtt_topic, sizeof(mqtt_topic)); - if (strstr(Settings.hostname, "%")) { + if (strstr(Settings.hostname, "%") != nullptr) { strlcpy(Settings.hostname, WIFI_HOSTNAME, sizeof(Settings.hostname)); snprintf_P(my_hostname, sizeof(my_hostname)-1, Settings.hostname, mqtt_topic, ESP.getChipId() & 0x1FFF); } else { @@ -2671,12 +2672,9 @@ void setup(void) } blink_powersave = power; - snprintf_P(log_data, sizeof(log_data), PSTR(D_PROJECT " %s %s " D_VERSION " %s%s-" ARDUINO_ESP8266_RELEASE), - PROJECT, Settings.friendlyname[0], my_version, my_image); - AddLog(LOG_LEVEL_INFO); + AddLog_P2(LOG_LEVEL_INFO, PSTR(D_PROJECT " %s %s " D_VERSION " %s%s-" ARDUINO_ESP8266_RELEASE), PROJECT, Settings.friendlyname[0], my_version, my_image); #ifdef FIRMWARE_MINIMAL - snprintf_P(log_data, sizeof(log_data), PSTR(D_WARNING_MINIMAL_VERSION)); - AddLog(LOG_LEVEL_INFO); + AddLog_P2(LOG_LEVEL_INFO, PSTR(D_WARNING_MINIMAL_VERSION)); #endif // FIRMWARE_MINIMAL RtcInit(); diff --git a/sonoff/sonoff_post.h b/sonoff/sonoff_post.h index 06bd3688b..10a466981 100644 --- a/sonoff/sonoff_post.h +++ b/sonoff/sonoff_post.h @@ -92,7 +92,8 @@ void KNX_CB_Action(message_t const &msg, void *arg); //#define USE_MPU6050 // Enable MPU6050 sensor (I2C address 0x68 AD0 low or 0x69 AD0 high) (+2k6 code) //#define USE_DS3231 // Enable DS3231 external RTC in case no Wifi is avaliable. See docs in the source file (+1k2 code) //#define USE_MGC3130 // Enable MGC3130 Electric Field Effect Sensor (I2C address 0x42) (+2k7 code, 0k3 mem) -//#define USE_MAX44009 // Enable MAX44009 Ambient Light sensor (I2C addresses 0x4A and 0x4B) (+0k8 code) +//#define USE_MAX44009 // Enable MAX44009 Ambient Light sensor (I2C addresses 0x4A and 0x4B) (+0k8 code) +#define USE_SCD30 // Enable Sensiron SCd30 CO2 sensor (I2C address 0x61) (+3k3 code) #define USE_MHZ19 // Add support for MH-Z19 CO2 sensor (+2k code) #define USE_SENSEAIR // Add support for SenseAir K30, K70 and S8 CO2 sensor (+2k3 code) #ifndef CO2_LOW @@ -139,6 +140,7 @@ void KNX_CB_Action(message_t const &msg, void *arg); #define USE_RF_SENSOR // Add support for RF sensor receiver (434MHz or 868MHz) (+0k8 code) // #define USE_THEO_V2 // Add support for decoding Theo V2 sensors as documented on https://sidweb.nl using 434MHz RF sensor receiver (+1k4 code) #define USE_ALECTO_V2 // Add support for decoding Alecto V2 sensors like ACH2010, WS3000 and DKW2012 using 868MHz RF sensor receiver (+1k7 code) +#define USE_HRE // Add support for Badger HR-E Water Meter (+1k4 code) #endif // FIRMWARE_SENSORS /*********************************************************************************************\ @@ -157,8 +159,6 @@ void KNX_CB_Action(message_t const &msg, void *arg); #ifndef USE_SMARTCONFIG #define USE_SMARTCONFIG // Add support for Wifi SmartConfig as initial wifi configuration tool (+23k code, +0.6k mem) #endif -#undef MQTT_LIBRARY_TYPE -#define MQTT_LIBRARY_TYPE MQTT_PUBSUBCLIENT // Use PubSubClient library #undef USE_ARDUINO_OTA // Disable support for Arduino OTA //#undef USE_DOMOTICZ // Disable Domoticz #undef USE_HOME_ASSISTANT // Disable Home Assistant @@ -198,6 +198,7 @@ void KNX_CB_Action(message_t const &msg, void *arg); #undef USE_TX20_WIND_SENSOR // Disable support for La Crosse TX20 anemometer #undef USE_RC_SWITCH // Disable support for RF transceiver using library RcSwitch #undef USE_RF_SENSOR // Disable support for RF sensor receiver (434MHz or 868MHz) (+0k8 code) +#undef USE_HRE // Disable support for Badger HR-E Water Meter (+1k4 code) #undef DEBUG_THEO // Disable debug code #undef USE_DEBUG_DRIVER // Disable debug code #endif // FIRMWARE_CLASSIC @@ -246,7 +247,9 @@ void KNX_CB_Action(message_t const &msg, void *arg); #define USE_SPI // Hardware SPI using GPIO12(MISO), GPIO13(MOSI) and GPIO14(CLK) in addition to two user selectable GPIOs(CS and DC) #define USE_DISPLAY_ILI9341 // [DisplayModel 4] Enable ILI9341 Tft 480x320 display (+19k code) +#ifndef ARDUINO_ESP8266_RELEASE_2_3_0 // There is not enough spare RAM with core 2.3.0 to support the following #define USE_DISPLAY_EPAPER_29 // [DisplayModel 5] Enable e-paper 2.9 inch display (+19k code) +#endif #undef USE_ARILUX_RF // Remove support for Arilux RF remote controller (-0k8 code, 252 iram (non 2.3.0)) #undef USE_RF_FLASH // Remove support for flashing the EFM8BB1 chip on the Sonoff RF Bridge. C2CK must be connected to GPIO4, C2D to GPIO5 on the PCB (-3k code) @@ -325,6 +328,7 @@ void KNX_CB_Action(message_t const &msg, void *arg); #undef USE_TX20_WIND_SENSOR // Disable support for La Crosse TX20 anemometer #undef USE_RC_SWITCH // Disable support for RF transceiver using library RcSwitch #undef USE_RF_SENSOR // Disable support for RF sensor receiver (434MHz or 868MHz) (+0k8 code) +#undef USE_HRE // Disable support for Badger HR-E Water Meter (+1k4 code) #undef DEBUG_THEO // Disable debug code #undef USE_DEBUG_DRIVER // Disable debug code #endif // FIRMWARE_BASIC @@ -390,6 +394,7 @@ void KNX_CB_Action(message_t const &msg, void *arg); #undef USE_TX20_WIND_SENSOR // Disable support for La Crosse TX20 anemometer #undef USE_RC_SWITCH // Disable support for RF transceiver using library RcSwitch #undef USE_RF_SENSOR // Disable support for RF sensor receiver (434MHz or 868MHz) (+0k8 code) +#undef USE_HRE // Disable support for Badger HR-E Water Meter (+1k4 code) #undef DEBUG_THEO // Disable debug code #undef USE_DEBUG_DRIVER // Disable debug code #endif // FIRMWARE_MINIMAL diff --git a/sonoff/sonoff_template.h b/sonoff/sonoff_template.h index 6d48cded2..b50c2184b 100644 --- a/sonoff/sonoff_template.h +++ b/sonoff/sonoff_template.h @@ -178,6 +178,8 @@ enum UserSelectablePins { GPIO_ROT1B, // Rotary switch1 B Pin GPIO_ROT2A, // Rotary switch2 A Pin GPIO_ROT2B, // Rotary switch2 B Pin + GPIO_HRE_CLOCK, // Clock/Power line for HR-E Water Meter + GPIO_HRE_DATA, // Data line for HR-E Water Meter GPIO_SENSOR_END }; // Programmer selectable GPIO functionality @@ -241,6 +243,7 @@ const char kSensorNames[] PROGMEM = D_SENSOR_CSE7766_TX "|" D_SENSOR_CSE7766_RX "|" D_SENSOR_ARIRFRCV "|" D_SENSOR_TXD "|" D_SENSOR_RXD "|" D_SENSOR_ROTARY "1a|" D_SENSOR_ROTARY "1b|" D_SENSOR_ROTARY "2a|" D_SENSOR_ROTARY "2b|" + D_SENSOR_HRE_CLOCK "|" D_SENSOR_HRE_DATA "|" ; /********************************************************************************************/ @@ -335,8 +338,10 @@ typedef struct MYCFGIO { uint8_t io[MAX_GPIO_PIN - MIN_FLASH_PINS]; } mycfgio; +#define GPIO_FLAG_USED 1 // Currently only one flag used + #define GPIO_FLAG_ADC0 1 // Allow ADC0 when define USE_ADC_VCC is disabled -#define GPIO_FLAG_PULLUP 2 // Allow input pull-up control using SetOption62 +#define GPIO_FLAG_SPARE01 2 // Allow input pull-up control using SetOption62 - Superseded by user template editing #define GPIO_FLAG_SPARE02 4 #define GPIO_FLAG_SPARE03 8 #define GPIO_FLAG_SPARE04 16 @@ -348,7 +353,7 @@ typedef union { uint8_t data; struct { uint8_t adc0 : 1; // Allow ADC0 when define USE_ADC_VCC is disabled - uint8_t pullup : 1; // Allow input pull-up control using SetOption62 + uint8_t spare01 : 1; uint8_t spare02 : 1; uint8_t spare03 : 1; uint8_t spare04 : 1; @@ -582,7 +587,11 @@ const uint8_t kGpioNiceList[] PROGMEM = { GPIO_ROT1B, // Rotary switch1 B Pin GPIO_ROT2A, // Rotary switch2 A Pin GPIO_ROT2B, // Rotary switch2 B Pin - GPIO_ARIRFRCV // AliLux RF Receive input + GPIO_ARIRFRCV, // AliLux RF Receive input +#ifdef USE_HRE + GPIO_HRE_CLOCK, + GPIO_HRE_DATA +#endif }; const uint8_t kModuleNiceList[MAXMODULE] PROGMEM = { @@ -974,7 +983,6 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { GPIO_USER, // GPIO15 D8 GPIO_USER, // GPIO16 D0 Wemos Wake GPIO_FLAG_ADC0 // ADC0 A0 Analog input -// + GPIO_FLAG_PULLUP // Allow input pull-up control }, { "Sonoff Dev", // Sonoff Dev (ESP8266) GPIO_KEY1, // GPIO00 E-FW Button @@ -1471,10 +1479,10 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { 0, 0 }, { "Shelly 1", // Shelly1 Open Source (ESP8266 - 2MB) - https://shelly.cloud/shelly1-open-source/ - GPIO_USER, // GPIO00 - Only to be used when Shelly is connected to 12V DC - GPIO_USER, // GPIO01 Serial RXD - Only to be used when Shelly is connected to 12V DC + 0, // GPIO00 - Can be changed to GPIO_USER, only if Shelly is powered with 12V DC + 0, // GPIO01 Serial RXD - Can be changed to GPIO_USER, only if Shelly is powered with 12V DC 0, - GPIO_USER, // GPIO03 Serial TXD - Only to be used when Shelly is connected to 12V DC + 0, // GPIO03 Serial TXD - Can be changed to GPIO_USER, only if Shelly is powered with 12V DC GPIO_REL1, // GPIO04 Relay (0 = Off, 1 = On) GPIO_SWT1_NP, // GPIO05 SW pin // GPIO06 (SD_CLK Flash) @@ -1503,7 +1511,7 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { GPIO_SWT2, // GPIO14 GPIO_MCP39F5_RST, // GPIO15 MCP39F501 Reset 0, - GPIO_FLAG_PULLUP // Allow input pull-up control + 0 }, { "Xiaomi Philips", // Xiaomi Philips bulb (ESP8266) 0, 0, 0, 0, 0, 0, @@ -1763,7 +1771,7 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { 0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285) 0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285) // GPIO11 (SD_CMD Flash) - GPIO_LED1, // GPIO12 Green LED - Link status + GPIO_LED1_INV, // GPIO12 Green LED - Link status GPIO_LED2, // GPIO13 Red LED - Power status 0, 0, 0, 0 }, diff --git a/sonoff/sonoff_version.h b/sonoff/sonoff_version.h index 2c221bd1b..3a8dc0eb8 100644 --- a/sonoff/sonoff_version.h +++ b/sonoff/sonoff_version.h @@ -20,11 +20,6 @@ #ifndef _SONOFF_VERSION_H_ #define _SONOFF_VERSION_H_ -#define VERSION 0x06040110 - -#define D_PROGRAMNAME "Sonoff-Tasmota" -#define D_AUTHOR "Theo Arends" -//#define D_WEBLINK "https://github.com/arendst/Sonoff-Tasmota" -#define D_WEBLINK "https://bit.ly/tasmota" +const uint32_t VERSION = 0x06050004; #endif // _SONOFF_VERSION_H_ diff --git a/sonoff/support.ino b/sonoff/support.ino index c728d28eb..1a222686c 100644 --- a/sonoff/support.ino +++ b/sonoff/support.ino @@ -28,7 +28,7 @@ uint32_t syslog_host_hash = 0; // Syslog host name hash Ticker tickerOSWatch; -#define OSWATCH_RESET_TIME 120 +const uint32_t OSWATCH_RESET_TIME = 120; static unsigned long oswatch_last_loop_time; uint8_t oswatch_blocked_loop = 0; @@ -47,8 +47,7 @@ void OsWatchTicker(void) unsigned long last_run = abs(t - oswatch_last_loop_time); #ifdef DEBUG_THEO - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_APPLICATION D_OSWATCH " FreeRam %d, rssi %d, last_run %d"), ESP.getFreeHeap(), WifiGetRssiAsQuality(WiFi.RSSI()), last_run); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION D_OSWATCH " FreeRam %d, rssi %d, last_run %d"), ESP.getFreeHeap(), WifiGetRssiAsQuality(WiFi.RSSI()), last_run); #endif // DEBUG_THEO if (last_run >= (OSWATCH_RESET_TIME * 1000)) { // AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_APPLICATION D_OSWATCH " " D_BLOCKED_LOOP ". " D_RESTARTING)); // Save iram space @@ -109,7 +108,7 @@ void* memchr(const void* ptr, int value, size_t num) return 0; } -// http://clc-wiki.net/wiki/C_standard_library:string.h:strspn +// http://clc-wiki.net/wiki/C_standard_library:string.h:strcspn // Get span until any character in string size_t strcspn(const char *str1, const char *str2) { @@ -124,6 +123,77 @@ size_t strcspn(const char *str1, const char *str2) } return ret; } + +// https://opensource.apple.com/source/Libc/Libc-583/stdlib/FreeBSD/strtoull.c +// Convert a string to an unsigned long long integer +#ifndef __LONG_LONG_MAX__ +#define __LONG_LONG_MAX__ 9223372036854775807LL +#endif +#ifndef ULLONG_MAX +#define ULLONG_MAX (__LONG_LONG_MAX__ * 2ULL + 1) +#endif + +unsigned long long strtoull(const char *__restrict nptr, char **__restrict endptr, int base) +{ + const char *s = nptr; + char c; + do { c = *s++; } while (isspace((unsigned char)c)); // Trim leading spaces + + int neg = 0; + if (c == '-') { // Set minus flag and/or skip sign + neg = 1; + c = *s++; + } else { + if (c == '+') { + c = *s++; + } + } + + if ((base == 0 || base == 16) && (c == '0') && (*s == 'x' || *s == 'X')) { // Set Hexadecimal + c = s[1]; + s += 2; + base = 16; + } + if (base == 0) { base = (c == '0') ? 8 : 10; } // Set Octal or Decimal + + unsigned long long acc = 0; + int any = 0; + if (base > 1 && base < 37) { + unsigned long long cutoff = ULLONG_MAX / base; + int cutlim = ULLONG_MAX % base; + for ( ; ; c = *s++) { + if (c >= '0' && c <= '9') + c -= '0'; + else if (c >= 'A' && c <= 'Z') + c -= 'A' - 10; + else if (c >= 'a' && c <= 'z') + c -= 'a' - 10; + else + break; + + if (c >= base) + break; + + if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim)) + any = -1; + else { + any = 1; + acc *= base; + acc += c; + } + } + if (any < 0) { + acc = ULLONG_MAX; // Range error + } + else if (any && neg) { + acc = -acc; + } + } + + if (endptr != nullptr) { *endptr = (char *)(any ? s - 1 : nptr); } + + return acc; +} #endif // ARDUINO_ESP8266_RELEASE_2_3_0 // Get span until single character in string @@ -140,48 +210,53 @@ size_t strchrspn(const char *str1, int character) char* subStr(char* dest, char* str, const char *delim, int index) { char *act; - char *sub = NULL; + char *sub = nullptr; char *ptr; int i; // Since strtok consumes the first arg, make a copy strncpy(dest, str, strlen(str)+1); - for (i = 1, act = dest; i <= index; i++, act = NULL) { + for (i = 1, act = dest; i <= index; i++, act = nullptr) { sub = strtok_r(act, delim, &ptr); - if (sub == NULL) break; + if (sub == nullptr) break; } sub = Trim(sub); return sub; } -double CharToDouble(char *str) +double CharToDouble(const char *str) { // simple ascii to double, because atof or strtod are too large char strbuf[24]; strlcpy(strbuf, str, sizeof(strbuf)); - char *pt; - double left = atoi(strbuf); + char *pt = strbuf; + while ((*pt != '\0') && isblank(*pt)) { pt++; } // Trim leading spaces + + signed char sign = 1; + if (*pt == '-') { sign = -1; } + if (*pt == '-' || *pt=='+') { pt++; } // Skip any sign + + double left = 0; + if (*pt != '.') { + left = atoi(pt); // Get left part + while (isdigit(*pt)) { pt++; } // Skip number + } + double right = 0; - short len = 0; - pt = strtok (strbuf, "."); - if (pt) { - pt = strtok (NULL, "."); - if (pt) { - right = atoi(pt); - len = strlen(pt); - double fac = 1; - while (len) { - fac /= 10.0; - len--; - } - // pow is also very large - //double fac=pow(10,-len); - right *= fac; + if (*pt == '.') { + pt++; + right = atoi(pt); // Decimal part + while (isdigit(*pt)) { + pt++; + right /= 10.0; } } + double result = left + right; - if (left < 0) { result = left - right; } + if (sign < 0) { + return -result; // Add negative sign + } return result; } @@ -196,6 +271,27 @@ int TextToInt(char *str) return strtol(str, &p, radix); } +char* ulltoa(unsigned long long value, char *str, int radix) +{ + char digits[64]; + char *dst = str; + int i = 0; + int n = 0; + +// if (radix < 2 || radix > 36) { radix = 10; } + + do { + n = value % radix; + digits[i++] = (n < 10) ? (char)n+'0' : (char)n-10+'A'; + value /= radix; + } while (value != 0); + + while (i > 0) { *dst++ = digits[--i]; } + + *dst = 0; + return str; +} + char* dtostrfd(double number, unsigned char prec, char *s) { if ((isnan(number)) || (isinf(number))) { // Fix for JSON output (https://stackoverflow.com/questions/1423081/json-left-out-infinity-and-nan-json-status-in-ecmascript) @@ -275,10 +371,23 @@ char* RemoveSpace(char* p) *write++ = ch; } } - *write = '\0'; +// *write = '\0'; // Removed 20190223 as it buffer overflows on no isspace found - no need either return p; } +char* LowerCase(char* dest, const char* source) +{ + char* write = dest; + const char* read = source; + char ch = '.'; + + while (ch != '\0') { + ch = *read++; + *write++ = tolower(ch); + } + return dest; +} + char* UpperCase(char* dest, const char* source) { char* write = dest; @@ -353,6 +462,14 @@ uint8_t Shortcut(const char* str) return result; } +bool ValidIpAddress(const char* str) +{ + const char* p = str; + + while (*p && ((*p == '.') || ((*p >= '0') && (*p <= '9')))) { p++; } + return (*p == '\0'); +} + bool ParseIp(uint32_t* addr, const char* str) { uint8_t *part = (uint8_t*)addr; @@ -360,9 +477,9 @@ bool ParseIp(uint32_t* addr, const char* str) *addr = 0; for (i = 0; i < 4; i++) { - part[i] = strtoul(str, NULL, 10); // Convert byte + part[i] = strtoul(str, nullptr, 10); // Convert byte str = strchr(str, '.'); - if (str == NULL || *str == '\0') { + if (str == nullptr || *str == '\0') { break; // No more separators, exit } str++; // Point to next character after separator @@ -405,7 +522,7 @@ bool NewerVersion(char* version_str) return false; // Bail if we can't duplicate. Assume bad. } // Loop through the version string, splitting on '.' seperators. - for (char *str = strtok_r(version_dup, ".", &str_ptr); str && i < sizeof(VERSION); str = strtok_r(NULL, ".", &str_ptr), i++) { + for (char *str = strtok_r(version_dup, ".", &str_ptr); str && i < sizeof(VERSION); str = strtok_r(nullptr, ".", &str_ptr), i++) { int field = atoi(str); // The fields in a version string can only range from 0-255. if ((field < 0) || (field > 255)) { @@ -640,8 +757,7 @@ void SetSerialBaudrate(int baudrate) Settings.baudrate = baudrate / 1200; if (Serial.baudRate() != baudrate) { if (seriallog_level) { - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_APPLICATION D_SET_BAUDRATE_TO " %d"), baudrate); - AddLog(LOG_LEVEL_INFO); + AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_APPLICATION D_SET_BAUDRATE_TO " %d"), baudrate); } delay(100); Serial.flush(); @@ -669,7 +785,7 @@ void SerialSendRaw(char *codes) int size = strlen(codes); while (size > 0) { - snprintf(stemp, sizeof(stemp), codes); + strlcpy(stemp, codes, sizeof(stemp)); code = strtol(stemp, &p, 16); Serial.write(code); size -= 2; @@ -690,15 +806,46 @@ void ShowSource(int source) { if ((source > 0) && (source < SRC_MAX)) { char stemp1[20]; - snprintf_P(log_data, sizeof(log_data), PSTR("SRC: %s"), GetTextIndexed(stemp1, sizeof(stemp1), source, kCommandSource)); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR("SRC: %s"), GetTextIndexed(stemp1, sizeof(stemp1), source, kCommandSource)); } } +/*********************************************************************************************\ + * Response data handling +\*********************************************************************************************/ + +int Response_P(const char* format, ...) // Content send snprintf_P char data +{ + // This uses char strings. Be aware of sending %% if % is needed + va_list args; + va_start(args, format); + int len = vsnprintf_P(mqtt_data, sizeof(mqtt_data), format, args); + va_end(args); + return len; +} + +int ResponseAppend_P(const char* format, ...) // Content send snprintf_P char data +{ + // This uses char strings. Be aware of sending %% if % is needed + va_list args; + va_start(args, format); + int mlen = strlen(mqtt_data); + int len = vsnprintf_P(mqtt_data + mlen, sizeof(mqtt_data) - mlen, format, args); + va_end(args); + return len + mlen; +} + /*********************************************************************************************\ * GPIO Module and Template management \*********************************************************************************************/ +uint8_t ModuleNr() +{ + // 0 = User module (255) + // 1 up = Template module 0 up + return (USER_MODULE == Settings.module) ? 0 : Settings.module +1; +} + String AnyModuleName(uint8_t index) { if (USER_MODULE == index) { @@ -720,7 +867,6 @@ void ModuleGpios(myio *gp) uint8_t src[sizeof(mycfgio)]; if (USER_MODULE == Settings.module) { -// src = Settings.user_template.gp; memcpy(&src, &Settings.user_template.gp, sizeof(mycfgio)); } else { memcpy_P(&src, &kModules[Settings.module].gp, sizeof(mycfgio)); @@ -769,35 +915,25 @@ void SetModuleType() uint8_t ValidPin(uint8_t pin, uint8_t gpio) { uint8_t result = gpio; - if ((pin > 5) && (pin < 12)) { - result = GPIO_NONE; // Disable all flash pins + + if (((pin > 5) && (pin < 9)) || (11 == pin)) { + result = GPIO_NONE; // Disable flash pins GPIO6, GPIO7, GPIO8 and GPIO11 } - if (Settings.flag3.user_esp8285_enable) { - if ((pin == 9) || (pin == 10)) { - result = gpio; // Allow optional flash pins - } + if ((WEMOS == Settings.module) && (!Settings.flag3.user_esp8285_enable)) { + if ((pin == 9) || (pin == 10)) { result = GPIO_NONE; } // Disable possible flash GPIO9 and GPIO10 } return result; } bool ValidGPIO(uint8_t pin, uint8_t gpio) { - bool result = false; - - if (USER_MODULE == Settings.module) { - result = (ValidPin(pin, gpio) > GPIO_NONE); // Allow any pin - } else { - result = (GPIO_USER == ValidPin(pin, gpio)); // Only allow GPIO_USER pins - } - return result; + return (GPIO_USER == ValidPin(pin, gpio)); // Only allow GPIO_USER pins } bool GetUsedInModule(uint8_t val, uint8_t *arr) { int offset = 0; - if (USER_MODULE == Settings.module) { return false; } - if (!val) { return false; } // None if ((val >= GPIO_KEY1) && (val < GPIO_KEY1 + MAX_KEYS)) { @@ -855,16 +991,41 @@ bool GetUsedInModule(uint8_t val, uint8_t *arr) return false; } +bool JsonTemplate(const char* dataBuf) +{ + StaticJsonBuffer<350> jb; // 331 from https://arduinojson.org/v5/assistant/ + JsonObject& obj = jb.parseObject(dataBuf); + if (!obj.success()) { return false; } + + // All parameters are optional allowing for partial changes + const char* name = obj[D_JSON_NAME]; + if (name != nullptr) { + strlcpy(Settings.user_template.name, name, sizeof(Settings.user_template.name)); + } + if (obj[D_JSON_GPIO].success()) { + for (uint8_t i = 0; i < sizeof(mycfgio); i++) { + Settings.user_template.gp.io[i] = obj[D_JSON_GPIO][i] | 0; + } + } + if (obj[D_JSON_FLAG].success()) { + uint8_t flag = obj[D_JSON_FLAG] | 0; + memcpy(&Settings.user_template.flag, &flag, sizeof(gpio_flag)); + } + if (obj[D_JSON_BASE].success()) { + uint8_t base = obj[D_JSON_BASE]; + if ((0 == base) || (base >= MAXMODULE)) { base = 17; } else { base--; } + Settings.user_template_base = base; // Default WEMOS + } + return true; +} + void TemplateJson() { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_JSON_NAME "\":\"%s\",\"" D_JSON_GPIO "\":["), Settings.user_template.name); + Response_P(PSTR("{\"" D_JSON_NAME "\":\"%s\",\"" D_JSON_GPIO "\":["), Settings.user_template.name); for (uint8_t i = 0; i < sizeof(Settings.user_template.gp); i++) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s%s%d"), mqtt_data, (i>0)?",":"", Settings.user_template.gp.io[i]); + ResponseAppend_P(PSTR("%s%d"), (i>0)?",":"", Settings.user_template.gp.io[i]); } -// snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s],\"" D_JSON_FLAG "\":%d,\"" D_JSON_BASE "\":\"%d (%s)\"}"), -// mqtt_data, Settings.user_template.flag, Settings.user_template_base +1, AnyModuleName(Settings.user_template_base).c_str()); - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s],\"" D_JSON_FLAG "\":%d,\"" D_JSON_BASE "\":%d}"), - mqtt_data, Settings.user_template.flag, Settings.user_template_base +1); + ResponseAppend_P(PSTR("],\"" D_JSON_FLAG "\":%d,\"" D_JSON_BASE "\":%d}"), Settings.user_template.flag, Settings.user_template_base +1); } /*********************************************************************************************\ @@ -935,7 +1096,7 @@ void SetNextTimeInterval(unsigned long& timer, const unsigned long step) \*********************************************************************************************/ #ifdef USE_I2C -#define I2C_RETRY_COUNTER 3 +const uint8_t I2C_RETRY_COUNTER = 3; uint32_t i2c_buffer = 0; @@ -1144,8 +1305,7 @@ bool I2cDevice(uint8_t addr) * Syslog * * Example: - * snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_LOG "Any value %d"), value); - * AddLog(LOG_LEVEL_DEBUG); + * AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_LOG "Any value %d"), value); * \*********************************************************************************************/ @@ -1159,7 +1319,7 @@ void SetSeriallog(uint8_t loglevel) #ifdef USE_WEBSERVER void GetLog(uint8_t idx, char** entry_pp, size_t* len_p) { - char* entry_p = NULL; + char* entry_p = nullptr; size_t len = 0; if (idx) { @@ -1187,8 +1347,9 @@ void Syslog(void) // Destroys log_data char syslog_preamble[64]; // Hostname + Id - if (syslog_host_hash != GetHash(Settings.syslog_host, strlen(Settings.syslog_host))) { - syslog_host_hash = GetHash(Settings.syslog_host, strlen(Settings.syslog_host)); + uint32_t current_hash = GetHash(Settings.syslog_host, strlen(Settings.syslog_host)); + if (syslog_host_hash != current_hash) { + syslog_host_hash = current_hash; WiFi.hostByName(Settings.syslog_host, syslog_host_addr); // If sleep enabled this might result in exception so try to do it once using hash } if (PortUdp.beginPacket(syslog_host_addr, Settings.syslog_port)) { @@ -1198,11 +1359,11 @@ void Syslog(void) memcpy(log_data, syslog_preamble, strlen(syslog_preamble)); PortUdp.write(log_data); PortUdp.endPacket(); + delay(1); // Add time for UDP handling (#5512) } else { syslog_level = 0; syslog_timer = SYSLOG_TIMER; - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_APPLICATION D_SYSLOG_HOST_NOT_FOUND ". " D_RETRY_IN " %d " D_UNIT_SECOND), SYSLOG_TIMER); - AddLog(LOG_LEVEL_INFO); + AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_APPLICATION D_SYSLOG_HOST_NOT_FOUND ". " D_RETRY_IN " %d " D_UNIT_SECOND), SYSLOG_TIMER); } } @@ -1252,6 +1413,16 @@ void AddLog_P(uint8_t loglevel, const char *formatP, const char *formatP2) AddLog(loglevel); } +void AddLog_P2(uint8_t loglevel, PGM_P formatP, ...) +{ + va_list arg; + va_start(arg, formatP); + vsnprintf_P(log_data, sizeof(log_data), formatP, arg); + va_end(arg); + + AddLog(loglevel); +} + void AddLogBuffer(uint8_t loglevel, uint8_t *buffer, int count) { snprintf_P(log_data, sizeof(log_data), PSTR("DMP:")); @@ -1268,6 +1439,5 @@ void AddLogSerial(uint8_t loglevel) void AddLogMissed(char *sensor, uint8_t misses) { - snprintf_P(log_data, sizeof(log_data), PSTR("SNS: %s missed %d"), sensor, SENSOR_MAX_MISS - misses); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR("SNS: %s missed %d"), sensor, SENSOR_MAX_MISS - misses); } diff --git a/sonoff/support_button.ino b/sonoff/support_button.ino index b0e6e695c..c0fe14bd2 100644 --- a/sonoff/support_button.ino +++ b/sonoff/support_button.ino @@ -50,12 +50,6 @@ void ButtonInvertFlag(uint8 button_bit) void ButtonInit(void) { - if (my_module_flag.pullup) { - if (Settings.flag3.no_pullup) { - key_no_pullup = 0xff; - } - } - buttons_found = 0; for (uint8_t i = 0; i < MAX_KEYS; i++) { if (pin[GPIO_KEY1 +i] < 99) { @@ -101,16 +95,16 @@ void ButtonHandler(void) uint16_t loops_per_second = 1000 / Settings.button_debounce; char scmnd[20]; - uint8_t maxdev = (devices_present > MAX_KEYS) ? MAX_KEYS : devices_present; - for (uint8_t button_index = 0; button_index < maxdev; button_index++) { +// uint8_t maxdev = (devices_present > MAX_KEYS) ? MAX_KEYS : devices_present; +// for (uint8_t button_index = 0; button_index < maxdev; button_index++) { + for (uint8_t button_index = 0; button_index < MAX_KEYS; button_index++) { button = NOT_PRESSED; button_present = 0; if (!button_index && ((SONOFF_DUAL == my_module_type) || (CH4 == my_module_type))) { button_present = 1; if (dual_button_code) { - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_APPLICATION D_BUTTON " " D_CODE " %04X"), dual_button_code); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION D_BUTTON " " D_CODE " %04X"), dual_button_code); button = PRESSED; if (0xF500 == dual_button_code) { // Button hold holdbutton[button_index] = (loops_per_second * Settings.param[P_HOLD_TIME] / 10) -1; @@ -136,14 +130,12 @@ void ButtonHandler(void) bool button_pressed = false; if ((PRESSED == button) && (NOT_PRESSED == lastbutton[button_index])) { - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_APPLICATION D_BUTTON "%d " D_LEVEL_10), button_index +1); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION D_BUTTON "%d " D_LEVEL_10), button_index +1); holdbutton[button_index] = loops_per_second; button_pressed = true; } if ((NOT_PRESSED == button) && (PRESSED == lastbutton[button_index])) { - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_APPLICATION D_BUTTON "%d " D_LEVEL_01), button_index +1); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION D_BUTTON "%d " D_LEVEL_01), button_index +1); if (!holdbutton[button_index]) { button_pressed = true; } // Do not allow within 1 second } if (button_pressed) { @@ -155,15 +147,13 @@ void ButtonHandler(void) else { if ((PRESSED == button) && (NOT_PRESSED == lastbutton[button_index])) { if (Settings.flag.button_single) { // Allow only single button press for immediate action - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_APPLICATION D_BUTTON "%d " D_IMMEDIATE), button_index +1); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION D_BUTTON "%d " D_IMMEDIATE), button_index +1); if (!SendKey(0, button_index +1, POWER_TOGGLE)) { // Execute Toggle command via MQTT if ButtonTopic is set ExecuteCommandPower(button_index +1, POWER_TOGGLE, SRC_BUTTON); // Execute Toggle command internally } } else { multipress[button_index] = (multiwindow[button_index]) ? multipress[button_index] +1 : 1; - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_APPLICATION D_BUTTON "%d " D_MULTI_PRESS " %d"), button_index +1, multipress[button_index]); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION D_BUTTON "%d " D_MULTI_PRESS " %d"), button_index +1, multipress[button_index]); multiwindow[button_index] = loops_per_second / 2; // 0.5 second multi press window } blinks = 201; diff --git a/sonoff/support_features.ino b/sonoff/support_features.ino index 31c449531..bde88738e 100644 --- a/sonoff/support_features.ino +++ b/sonoff/support_features.ino @@ -56,10 +56,10 @@ void GetFeatures(void) feature_drv1 |= 0x00000400; // xdrv_01_mqtt.ino #endif #if (MQTT_LIBRARY_TYPE == MQTT_TASMOTAMQTT) - feature_drv1 |= 0x00000800; // xdrv_01_mqtt.ino +// feature_drv1 |= 0x00000800; // xdrv_01_mqtt.ino #endif #if (MQTT_LIBRARY_TYPE == MQTT_ESPMQTTARDUINO) // Obsolete since 6.2.1.11 - feature_drv1 |= 0x00001000; // xdrv_01_mqtt.ino +// feature_drv1 |= 0x00001000; // xdrv_01_mqtt.ino #endif #ifdef MQTT_HOST_DISCOVERY feature_drv1 |= 0x00002000; // xdrv_01_mqtt.ino @@ -116,7 +116,7 @@ void GetFeatures(void) feature_drv1 |= 0x40000000; // support.ino #endif #if (MQTT_LIBRARY_TYPE == MQTT_ARDUINOMQTT) - feature_drv1 |= 0x80000000; // xdrv_01_mqtt.ino +// feature_drv1 |= 0x80000000; // xdrv_01_mqtt.ino #endif /*********************************************************************************************/ @@ -382,10 +382,14 @@ void GetFeatures(void) feature_sns2 |= 0x00100000; // xsns_40_pn532.ino #endif #ifdef USE_MAX44009 - feature_sns2 |= 0x00200000; -#endif -// feature_sns2 |= 0x00400000; -// feature_sns2 |= 0x00800000; + feature_sns2 |= 0x00200000; // xsns_41_max44009.ino +#endif +#ifdef USE_SCD30 + feature_sns2 |= 0x00400000; // xsns_42_scd30.ino +#endif +#ifdef USE_HRE + feature_sns2 |= 0x00800000; // xsns_43_hre.ino +#endif // feature_sns2 |= 0x01000000; // feature_sns2 |= 0x02000000; // feature_sns2 |= 0x04000000; diff --git a/sonoff/support_rotary.ino b/sonoff/support_rotary.ino index c8178586a..db88d8378 100644 --- a/sonoff/support_rotary.ino +++ b/sonoff/support_rotary.ino @@ -115,8 +115,7 @@ void RotaryHandler(void) if (t > 500) { t = 500; } - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_APPLICATION D_CMND_COLORTEMPERATURE " %d"), rotary_position - rotary_last_position); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION D_CMND_COLORTEMPERATURE " %d"), rotary_position - rotary_last_position); LightSetColorTemp((uint16_t)t); } else { int8_t d = Settings.light_dimmer; @@ -127,8 +126,7 @@ void RotaryHandler(void) if (d > 100) { d = 100; } - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_APPLICATION D_CMND_DIMMER " %d"), rotary_position - rotary_last_position); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION D_CMND_DIMMER " %d"), rotary_position - rotary_last_position); LightSetDimmer((uint8_t)d); Settings.light_dimmer = d; diff --git a/sonoff/support_rtc.ino b/sonoff/support_rtc.ino index 12a4d89ec..fd9575b32 100644 --- a/sonoff/support_rtc.ino +++ b/sonoff/support_rtc.ino @@ -22,10 +22,11 @@ * Timezone by Jack Christensen (https://github.com/JChristensen/Timezone) \*********************************************************************************************/ -#define SECS_PER_MIN ((uint32_t)(60UL)) -#define SECS_PER_HOUR ((uint32_t)(3600UL)) -#define SECS_PER_DAY ((uint32_t)(SECS_PER_HOUR * 24UL)) -#define MINS_PER_HOUR ((uint32_t)(60UL)) +const uint32_t SECS_PER_MIN = 60UL; +const uint32_t SECS_PER_HOUR = 3600UL; +const uint32_t SECS_PER_DAY = SECS_PER_HOUR * 24UL; +const uint32_t MINS_PER_HOUR = 60UL; + #define LEAP_YEAR(Y) (((1970+Y)>0) && !((1970+Y)%4) && (((1970+Y)%100) || !((1970+Y)%400))) extern "C" { @@ -43,7 +44,7 @@ uint32_t local_time = 0; uint32_t daylight_saving_time = 0; uint32_t standard_time = 0; uint32_t ntp_time = 0; -uint32_t midnight = 1451602800; +uint32_t midnight = 0; uint32_t restart_time = 0; int32_t time_timezone = 0; uint8_t midnight_now = 0; @@ -61,7 +62,7 @@ String GetBuildDateAndTime(void) // sscanf(mdate, "%s %d %d", bdt, &day, &year); // Not implemented in 2.3.0 and probably too much code uint8_t i = 0; - for (char *str = strtok_r(mdate, " ", &p); str && i < 3; str = strtok_r(NULL, " ", &p)) { + for (char *str = strtok_r(mdate, " ", &p); str && i < 3; str = strtok_r(nullptr, " ", &p)) { switch (i++) { case 0: // Month smonth = str; @@ -87,6 +88,23 @@ String GetTimeZone(void) return String(tz); // -03:45 } +String GetDuration(uint32_t time) +{ + char dt[16]; + + TIME_T ut; + BreakTime(time, ut); + + // "P128DT14H35M44S" - ISO8601:2004 - https://en.wikipedia.org/wiki/ISO_8601 Durations +// snprintf_P(dt, sizeof(dt), PSTR("P%dDT%02dH%02dM%02dS"), ut.days, ut.hour, ut.minute, ut.second); + + // "128 14:35:44" - OpenVMS + // "128T14:35:44" - Tasmota + snprintf_P(dt, sizeof(dt), PSTR("%dT%02d:%02d:%02d"), ut.days, ut.hour, ut.minute, ut.second); + + return String(dt); // 128T14:35:44 +} + String GetDT(uint32_t time) { // "2017-03-07T11:08:02" - ISO8601:2004 @@ -155,42 +173,26 @@ String GetTime(int type) return String(stime); // Thu Nov 01 11:41:02 2018 } +uint32_t UpTime(void) +{ + if (restart_time) { + return utc_time - restart_time; + } else { + return uptime; + } +} + +uint32_t MinutesUptime(void) +{ + return (UpTime() / 60); +} + String GetUptime(void) { - char dt[16]; - - TIME_T ut; - - if (restart_time) { - BreakTime(utc_time - restart_time, ut); - } else { - BreakTime(uptime, ut); - } - - // "P128DT14H35M44S" - ISO8601:2004 - https://en.wikipedia.org/wiki/ISO_8601 Durations -// snprintf_P(dt, sizeof(dt), PSTR("P%dDT%02dH%02dM%02dS"), ut.days, ut.hour, ut.minute, ut.second); - - // "128 14:35:44" - OpenVMS - // "128T14:35:44" - Tasmota - snprintf_P(dt, sizeof(dt), PSTR("%dT%02d:%02d:%02d"), ut.days, ut.hour, ut.minute, ut.second); - - return String(dt); // 128T14:35:44 + return GetDuration(UpTime()); } -uint32_t GetMinutesUptime(void) -{ - TIME_T ut; - - if (restart_time) { - BreakTime(utc_time - restart_time, ut); - } else { - BreakTime(uptime, ut); - } - - return (ut.days *1440) + (ut.hour *60) + ut.minute; -} - -uint32_t GetMinutesPastMidnight(void) +uint32_t MinutesPastMidnight(void) { uint32_t minutes = 0; @@ -322,6 +324,11 @@ uint32_t RuleToTime(TimeRule r, int yr) return t; } +uint32_t UtcTime(void) +{ + return utc_time; +} + uint32_t LocalTime(void) { return local_time; @@ -358,9 +365,7 @@ void RtcSecond(void) RtcTime.year = tmpTime.year + 1970; daylight_saving_time = RuleToTime(Settings.tflag[1], RtcTime.year); standard_time = RuleToTime(Settings.tflag[0], RtcTime.year); - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_APPLICATION "(" D_UTC_TIME ") %s, (" D_DST_TIME ") %s, (" D_STD_TIME ") %s"), - GetTime(0).c_str(), GetTime(2).c_str(), GetTime(3).c_str()); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION "(" D_UTC_TIME ") %s, (" D_DST_TIME ") %s, (" D_STD_TIME ") %s"), GetTime(0).c_str(), GetTime(2).c_str(), GetTime(3).c_str()); if (local_time < 1451602800) { // 2016-01-01 rules_flag.time_init = 1; } else { @@ -400,10 +405,17 @@ void RtcSecond(void) if (!Settings.energy_kWhtotal_time) { Settings.energy_kWhtotal_time = local_time; } } BreakTime(local_time, RtcTime); - if (!RtcTime.hour && !RtcTime.minute && !RtcTime.second && RtcTime.valid) { - midnight = local_time; - midnight_now = 1; + + if (RtcTime.valid) { + if (!midnight) { + midnight = local_time - (RtcTime.hour * 3600) - (RtcTime.minute * 60) - RtcTime.second; + } + if (!RtcTime.hour && !RtcTime.minute && !RtcTime.second) { + midnight = local_time; + midnight_now = 1; + } } + RtcTime.year += 1970; } diff --git a/sonoff/support_switch.ino b/sonoff/support_switch.ino index b820a8151..3eb927388 100644 --- a/sonoff/support_switch.ino +++ b/sonoff/support_switch.ino @@ -25,7 +25,7 @@ * Inspired by (https://github.com/OLIMEX/olimex-iot-firmware-esp8266/blob/master/olimex/user/user_switch2.c) \*********************************************************************************************/ -#define SWITCH_PROBE_INTERVAL 10 // Time in milliseconds between switch input probe +const uint8_t SWITCH_PROBE_INTERVAL = 10; // Time in milliseconds between switch input probe #include @@ -110,12 +110,6 @@ void SwitchProbe(void) void SwitchInit(void) { - if (my_module_flag.pullup) { - if (Settings.flag3.no_pullup) { - switch_no_pullup = 0xffff; - } - } - switches_found = 0; for (uint8_t i = 0; i < MAX_SWITCHES; i++) { lastwallswitch[i] = 1; // Init global to virtual switch state; diff --git a/sonoff/support_wifi.ino b/sonoff/support_wifi.ino index 90f0584b7..445c14c0b 100644 --- a/sonoff/support_wifi.ino +++ b/sonoff/support_wifi.ino @@ -22,15 +22,15 @@ \*********************************************************************************************/ #ifndef WIFI_RSSI_THRESHOLD -#define WIFI_RSSI_THRESHOLD 10 // Difference in dB between current network and scanned network +#define WIFI_RSSI_THRESHOLD 10 // Difference in dB between current network and scanned network #endif #ifndef WIFI_RESCAN_MINUTES -#define WIFI_RESCAN_MINUTES 44 // Number of minutes between wifi network rescan +#define WIFI_RESCAN_MINUTES 44 // Number of minutes between wifi network rescan #endif -#define WIFI_CONFIG_SEC 180 // seconds before restart -#define WIFI_CHECK_SEC 20 // seconds -#define WIFI_RETRY_OFFSET_SEC 20 // seconds +const uint8_t WIFI_CONFIG_SEC = 180; // seconds before restart +const uint8_t WIFI_CHECK_SEC = 20; // seconds +const uint8_t WIFI_RETRY_OFFSET_SEC = 20; // seconds /* // This worked for 2_5_0_BETA2 but fails since then. Waiting for a solution from core team (#4952) @@ -49,6 +49,9 @@ using namespace axTLS; */ #include // Wifi, MQTT, Ota, WifiManager +uint32_t wifi_last_event = 0; // Last wifi connection event +uint32_t wifi_downtime = 0; // Wifi down duration +uint16_t wifi_link_count = 0; // Number of wifi re-connect uint8_t wifi_counter; uint8_t wifi_retry_init; uint8_t wifi_retry; @@ -104,8 +107,7 @@ void WifiWpsStatusCallback(wps_cb_status status) if (WPS_CB_ST_SUCCESS == wps_result) { wifi_wps_disable(); } else { - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_WIFI D_WPS_FAILED_WITH_STATUS " %d"), wps_result); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_WIFI D_WPS_FAILED_WITH_STATUS " %d"), wps_result); wifi_config_counter = 2; } } @@ -171,9 +173,9 @@ void WifiConfig(uint8_t type) } #endif // USE_WPS #ifdef USE_WEBSERVER - else if (WIFI_MANAGER == wifi_config_type) { + else if (WIFI_MANAGER == wifi_config_type || WIFI_MANAGER_RESET_ONLY == wifi_config_type) { AddLog_P(LOG_LEVEL_INFO, S_LOG_WIFI, PSTR(D_WCFG_2_WIFIMANAGER " " D_ACTIVE_FOR_3_MINUTES)); - WifiManagerBegin(); + WifiManagerBegin(WIFI_MANAGER_RESET_ONLY == wifi_config_type); } #endif // USE_WEBSERVER } @@ -222,7 +224,8 @@ void WifiBegin(uint8_t flag, uint8_t channel) delay(200); WiFi.mode(WIFI_STA); // Disable AP mode WiFiSetSleepMode(); -// if (WiFi.getPhyMode() != WIFI_PHY_MODE_11N) { WiFi.setPhyMode(WIFI_PHY_MODE_11N); } +// if (WiFi.getPhyMode() != WIFI_PHY_MODE_11N) { WiFi.setPhyMode(WIFI_PHY_MODE_11N); } // B/G/N +// if (WiFi.getPhyMode() != WIFI_PHY_MODE_11G) { WiFi.setPhyMode(WIFI_PHY_MODE_11G); } // B/G if (!WiFi.getAutoConnect()) { WiFi.setAutoConnect(true); } // WiFi.setAutoReconnect(true); switch (flag) { @@ -243,9 +246,8 @@ void WifiBegin(uint8_t flag, uint8_t channel) } else { WiFi.begin(Settings.sta_ssid[Settings.sta_active], Settings.sta_pwd[Settings.sta_active]); } - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_WIFI D_CONNECTING_TO_AP "%d %s " D_IN_MODE " 11%c " D_AS " %s..."), + AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_WIFI D_CONNECTING_TO_AP "%d %s " D_IN_MODE " 11%c " D_AS " %s..."), Settings.sta_active +1, Settings.sta_ssid[Settings.sta_active], kWifiPhyMode[WiFi.getPhyMode() & 0x3], my_hostname); - AddLog(LOG_LEVEL_INFO); } void WifiBeginAfterScan() @@ -320,9 +322,8 @@ void WifiBeginAfterScan() break; } } - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_WIFI "Network %d, AP%c, SSId %s, Channel %d, BSSId %02X:%02X:%02X:%02X:%02X:%02X, RSSI %d, Encryption %d"), + AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_WIFI "Network %d, AP%c, SSId %s, Channel %d, BSSId %02X:%02X:%02X:%02X:%02X:%02X, RSSI %d, Encryption %d"), i, (known) ? (j) ? '2' : '1' : '-', ssid_scan.c_str(), chan_scan, bssid_scan[0], bssid_scan[1], bssid_scan[2], bssid_scan[3], bssid_scan[4], bssid_scan[5], rssi_scan, (sec_scan == ENC_TYPE_NONE) ? 0 : 1); - AddLog(LOG_LEVEL_DEBUG); delay(0); } WiFi.scanDelete(); // Clean up Ram @@ -339,13 +340,26 @@ void WifiBeginAfterScan() } } +uint16_t WifiLinkCount() +{ + return wifi_link_count; +} + +String WifiDowntime() +{ + return GetDuration(wifi_downtime); +} + void WifiSetState(uint8_t state) { if (state == global_state.wifi_down) { if (state) { rules_flag.wifi_connected = 1; + wifi_link_count++; + wifi_downtime += UpTime() - wifi_last_event; } else { rules_flag.wifi_disconnected = 1; + wifi_last_event = UpTime(); } } global_state.wifi_down = state ^1; @@ -473,8 +487,7 @@ void WifiCheck(uint8_t param) strlcpy(Settings.sta_pwd[0], WiFi.psk().c_str(), sizeof(Settings.sta_pwd[0])); } Settings.sta_active = 0; - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_WIFI D_WCFG_1_SMARTCONFIG D_CMND_SSID "1 %s"), Settings.sta_ssid[0]); - AddLog(LOG_LEVEL_INFO); + AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_WIFI D_WCFG_1_SMARTCONFIG D_CMND_SSID "1 %s"), Settings.sta_ssid[0]); } } if (!wifi_config_counter) { @@ -517,8 +530,7 @@ void WifiCheck(uint8_t param) // } else { // mdns_delayed_start = Settings.param[P_MDNS_DELAYED_START]; mdns_begun = (uint8_t)MDNS.begin(my_hostname); - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_MDNS "%s"), (mdns_begun) ? D_INITIALIZED : D_FAILED); - AddLog(LOG_LEVEL_INFO); + AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_MDNS "%s"), (mdns_begun) ? D_INITIALIZED : D_FAILED); // } } } diff --git a/sonoff/xdrv_01_webserver.ino b/sonoff/xdrv_01_webserver.ino index 8001e507e..771a010b1 100644 --- a/sonoff/xdrv_01_webserver.ino +++ b/sonoff/xdrv_01_webserver.ino @@ -28,18 +28,20 @@ #define XDRV_01 1 #ifndef WIFI_SOFT_AP_CHANNEL -#define WIFI_SOFT_AP_CHANNEL 1 // Soft Access Point Channel number between 1 and 11 as used by SmartConfig web GUI +#define WIFI_SOFT_AP_CHANNEL 1 // Soft Access Point Channel number between 1 and 11 as used by SmartConfig web GUI #endif -#define HTTP_REFRESH_TIME 2345 // milliseconds -#define HTTP_RESTART_RECONNECT_TIME 9000 // milliseconds -#define HTTP_OTA_RESTART_RECONNECT_TIME 20000 // milliseconds +const uint16_t CHUNKED_BUFFER_SIZE = 400; // Chunk buffer size (should be smaller than half mqtt_date size) + +const uint16_t HTTP_REFRESH_TIME = 2345; // milliseconds +#define HTTP_RESTART_RECONNECT_TIME 9000 // milliseconds +#define HTTP_OTA_RESTART_RECONNECT_TIME 20000 // milliseconds #include #include #ifdef USE_RF_FLASH -uint8_t *efm8bb1_update = NULL; +uint8_t *efm8bb1_update = nullptr; #endif // USE_RF_FLASH enum UploadTypes { UPL_TASMOTA, UPL_SETTINGS, UPL_EFM8BB1 }; @@ -49,16 +51,16 @@ const char HTTP_HEAD[] PROGMEM = "" "" "" - "{h} - {v}" + "%s - %s" ""; + "window.onload=u;"; const char HTTP_SCRIPT_ROOT[] PROGMEM = "function la(p){" @@ -75,24 +77,25 @@ const char HTTP_SCRIPT_ROOT[] PROGMEM = "a=p;" "clearTimeout(lt);" "}" - "if(x!=null){x.abort();}" // Abort if no response within 2 seconds (happens on restart 1) + "if(x!=null){x.abort();}" // Abort if no response within 2 seconds (happens on restart 1) "x=new XMLHttpRequest();" "x.onreadystatechange=function(){" "if(x.readyState==4&&x.status==200){" - "var s=x.responseText.replace(/{t}/g,\"\").replace(/{s}/g,\"\").replace(/{c}/g,\"%'>
\").replace(/{s}/g,\"
\").replace(/{c}/g,\"%%'>
hasArg("m") "x.send();" - "lt=setTimeout(la,{a});" // Settings.web_refresh + "lt=setTimeout(la,%d);" // Settings.web_refresh "}" "function lb(p){" - "la('?d='+p);" // ?d related to WebGetArg("d", tmp, sizeof(tmp)); + "la('&d='+p);" // &d related to WebGetArg("d", tmp, sizeof(tmp)); "}" "function lc(p){" - "la('?t='+p);" // ?t related to WebGetArg("t", tmp, sizeof(tmp)); - "}"; + "la('&t='+p);" // &t related to WebGetArg("t", tmp, sizeof(tmp)); + "}" + "window.onload=la();"; const char HTTP_SCRIPT_WIFI[] PROGMEM = "function c(l){" @@ -101,18 +104,16 @@ const char HTTP_SCRIPT_WIFI[] PROGMEM = "}"; const char HTTP_SCRIPT_RELOAD[] PROGMEM = - "setTimeout(function(){location.href='.';}," STR(HTTP_RESTART_RECONNECT_TIME) ");" - ""; + "setTimeout(function(){location.href='.';}," STR(HTTP_RESTART_RECONNECT_TIME) ");"; // Local OTA upgrade requires more time to complete cp: before web ui should be reloaded const char HTTP_SCRIPT_RELOAD_OTA[] PROGMEM = - "setTimeout(function(){location.href='.';}," STR(HTTP_OTA_RESTART_RECONNECT_TIME) ");" - ""; + "setTimeout(function(){location.href='.';}," STR(HTTP_OTA_RESTART_RECONNECT_TIME) ");"; const char HTTP_SCRIPT_CONSOL[] PROGMEM = - "var sn=0;" // Scroll position - "var id=0;" // Get most of weblog initially - "function l(p){" // Console log and command service + "var sn=0;" // Scroll position + "var id=0;" // Get most of weblog initially + "function l(p){" // Console log and command service "var c,o,t;" "clearTimeout(lt);" "o='';" @@ -123,13 +124,13 @@ const char HTTP_SCRIPT_CONSOL[] PROGMEM = "c.value='';" "t.scrollTop=sn;" "}" - "if(t.scrollTop>=sn){" // User scrolled back so no updates - "if(x!=null){x.abort();}" // Abort if no response within 2 seconds (happens on restart 1) + "if(t.scrollTop>=sn){" // User scrolled back so no updates + "if(x!=null){x.abort();}" // Abort if no response within 2 seconds (happens on restart 1) "x=new XMLHttpRequest();" "x.onreadystatechange=function(){" "if(x.readyState==4&&x.status==200){" "var z,d;" - "d=x.responseText.split(/\1/);" + "d=x.responseText.split(/}1/);" // Field separator "id=d.shift();" "if(d.shift()==0){t.value='';}" "z=d.shift();" @@ -138,63 +139,116 @@ const char HTTP_SCRIPT_CONSOL[] PROGMEM = "sn=t.scrollTop;" "}" "};" - "x.open('GET','ax?c2='+id+o,true);" + "x.open('GET','cs?c2='+id+o,true);" // Related to WebServer->hasArg("c2") and WebGetArg("c2", stmp, sizeof(stmp)) "x.send();" "}" - "lt=setTimeout(l,{a});" + "lt=setTimeout(l,%d);" "return false;" "}" - ""; -const char HTTP_SCRIPT_MODULE1[] PROGMEM = + "window.onload=l;"; + +const char HTTP_MODULE_TEMPLATE_REPLACE[] PROGMEM = + "}2%d'>%s (%d}3"; // }2 and }3 are used in below os.replace + +const char HTTP_SCRIPT_MODULE_TEMPLATE[] PROGMEM = "var os;" - "function sk(s,g){" // s = value, g = id and name - "var o=os.replace(/}1/g,\"
"); - uint8_t idx = 0; - for (uint8_t i = 0; i < 4; i++) { - if (idx > 0) { page += F(""); } - for (uint8_t j = 0; j < 4; j++) { - idx++; - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR(""), idx, idx); // ?k is related to WebGetArg("k", tmp, sizeof(tmp)); - page += mqtt_data; - } - } - page += F("
\").replace(/{m}/g,\"\").replace(/{e}/g,\"
\").replace(/{m}/g,\"\").replace(/{e}/g,\"
\").replace(/}2/g,\"\");" "eb('i').innerHTML=s;" "}" - ""; + "window.onload=i;"; -const char HTTP_HEAD_STYLE[] PROGMEM = +const char HTTP_HEAD_STYLE1[] PROGMEM = "" "" "" @@ -213,11 +268,12 @@ const char HTTP_HEAD_STYLE[] PROGMEM = #endif "
" #ifdef LANGUAGE_MODULE_NAME - "

" D_MODULE " {ha

" + "

" D_MODULE " %s

" #else - "

{ha " D_MODULE "

" + "

%s " D_MODULE "

" #endif - "

{h}

{j}
"; + "

%s

"; + const char HTTP_MSG_SLIDER1[] PROGMEM = "
" D_COLDLIGHT "" D_WARMLIGHT "
" "
"; @@ -226,82 +282,67 @@ const char HTTP_MSG_SLIDER2[] PROGMEM = "
"; const char HTTP_MSG_RSTRT[] PROGMEM = "
" D_DEVICE_WILL_RESTART "

"; -const char HTTP_BTN_MENU1[] PROGMEM = -#ifndef FIRMWARE_MINIMAL - "
" - "
" -#endif - "
" - "
"; -const char HTTP_BTN_RSTRT[] PROGMEM = - "
"; -const char HTTP_BTN_MENU_MODULE[] PROGMEM = - "
" - "
"; -const char HTTP_BTN_MENU4[] PROGMEM = - "
" - "
" - "
" - "
" - "
" - "
"; -const char HTTP_BTN_MAIN[] PROGMEM = - "

"; + const char HTTP_FORM_LOGIN[] PROGMEM = + "
" "
" - "
" D_USER "

" - "
" D_PASSWORD "

" + "

" D_USER "

" + "

" D_PASSWORD "

" "
" - "
"; -const char HTTP_BTN_CONF[] PROGMEM = - "

"; + "" + "
"; + +const char HTTP_FORM_TEMPLATE[] PROGMEM = + "
 " D_TEMPLATE_PARAMETERS " " + "
"; +const char HTTP_FORM_TEMPLATE_FLAG[] PROGMEM = + "

" // Keep close so do not use
+ "
 " D_TEMPLATE_FLAGS " 

" + "" D_ALLOW_ADC0 "
" + "

"; + const char HTTP_FORM_MODULE[] PROGMEM = - "
 " D_MODULE_PARAMETERS " " - "
" D_MODULE_TYPE " ({mt)

"; + "
 " D_MODULE_PARAMETERS " " + "" + "

" D_MODULE_TYPE " (%s)

" + "
"; -const char HTTP_FORM_MODULE_PULLUP[] PROGMEM = - "
" D_PULLUP_ENABLE "
"; - -const char HTTP_LNK_ITEM[] PROGMEM = - "
{v} ({w}) {i} {r}%
"; -const char HTTP_LNK_SCAN[] PROGMEM = - "
"; const char HTTP_FORM_WIFI[] PROGMEM = - "
 " D_WIFI_PARAMETERS " " - "
" D_AP1_SSID " (" STA_SSID1 ")

" - "
" D_AP1_PASSWORD "

" - "
" D_AP2_SSID " (" STA_SSID2 ")

" - "
" D_AP2_PASSWORD "

" - "
" D_HOSTNAME " (" WIFI_HOSTNAME ")

"; + "
 " D_WIFI_PARAMETERS " " + "" + "

" D_AP1_SSID " (" STA_SSID1 ")

" + "

" D_AP1_PASSWORD "

" + "

" D_AP2_SSID " (" STA_SSID2 ")

" + "

" D_AP2_PASSWORD "

" + "

" D_HOSTNAME " (%s)

"; + const char HTTP_FORM_LOG1[] PROGMEM = - "
 " D_LOGGING_PARAMETERS " "; + "
 " D_LOGGING_PARAMETERS " " + ""; const char HTTP_FORM_LOG2[] PROGMEM = - "
{b0 ({b1)

"; -const char HTTP_FORM_LOG3[] PROGMEM = - "
" D_SYSLOG_HOST " (" SYS_LOG_HOST ")

" - "
" D_SYSLOG_PORT " (" STR(SYS_LOG_PORT) ")

" - "
" D_TELEMETRY_PERIOD " (" STR(TELE_PERIOD) ")

"; + "

" D_SYSLOG_HOST " (" SYS_LOG_HOST ")

" + "

" D_SYSLOG_PORT " (" STR(SYS_LOG_PORT) ")

" + "

" D_TELEMETRY_PERIOD " (" STR(TELE_PERIOD) ")

"; + const char HTTP_FORM_OTHER[] PROGMEM = - "
 " D_OTHER_PARAMETERS " " - "
" D_TEMPLATE "

" - "
" D_WEB_ADMIN_PASSWORD "

" - "
" D_MQTT_ENABLE "
"; - const char HTTP_FORM_OTHER2[] PROGMEM = - "
" D_FRIENDLY_NAME " {1 ({2)

"; -#ifdef USE_EMULATION -const char HTTP_FORM_OTHER3a[] PROGMEM = - "
 " D_EMULATION " "; -const char HTTP_FORM_OTHER3b[] PROGMEM = - "
{3{4"; // Different id only used for labels -#endif // USE_EMULATION + "
 " D_OTHER_PARAMETERS " " + "" + "

" + "
 " D_TEMPLATE " " + "

" + "

" D_ACTIVATE "

" + "
" + "
" + "" D_WEB_ADMIN_PASSWORD "

" + "
" + "" D_MQTT_ENABLE "
" + "
"; + const char HTTP_FORM_END[] PROGMEM = - "
"; + "
" + "" + "
"; + const char HTTP_FORM_RST[] PROGMEM = "
" "
 " D_RESTORE_CONFIGURATION " "; @@ -309,51 +350,79 @@ const char HTTP_FORM_UPG[] PROGMEM = "
" "
 " D_UPGRADE_BY_WEBSERVER " " "
" - "
" D_OTA_URL "

" + "
" D_OTA_URL "

" "
" "


" "
 " D_UPGRADE_BY_FILE_UPLOAD " "; const char HTTP_FORM_RST_UPG[] PROGMEM = "
" "

" - "
" + "
" "
" "
" ""; + const char HTTP_FORM_CMND[] PROGMEM = "


" "
" "
" // "
" ""; + const char HTTP_TABLE100[] PROGMEM = - "
"; + "
"; + const char HTTP_COUNTER[] PROGMEM = "
"; + const char HTTP_END[] PROGMEM = - "
" - "" + "" "" "" ""; -const char HTTP_DEVICE_CONTROL[] PROGMEM = ""; // ?o is related to WebGetArg("o", tmp, sizeof(tmp)); -const char HTTP_DEVICE_STATE[] PROGMEM = "%s"; // {c} = %'>
"; // ?o is related to WebGetArg("o", tmp, sizeof(tmp)); +const char HTTP_DEVICE_STATE[] PROGMEM = "
"; // {c} = %'>
0) && (source < SRC_MAX)) { char stemp1[20]; - snprintf_P(log_data, sizeof(log_data), PSTR("SRC: %s from %s"), GetTextIndexed(stemp1, sizeof(stemp1), source, kCommandSource), WebServer->client().remoteIP().toString().c_str()); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR("SRC: %s from %s"), GetTextIndexed(stemp1, sizeof(stemp1), source, kCommandSource), WebServer->client().remoteIP().toString().c_str()); } } @@ -390,22 +462,21 @@ void StartWebserver(int type, IPAddress ipweb) if (!Settings.web_refresh) { Settings.web_refresh = HTTP_REFRESH_TIME; } if (!webserver_state) { if (!WebServer) { - WebServer = new ESP8266WebServer((HTTP_MANAGER==type) ? 80 : WEB_PORT); + WebServer = new ESP8266WebServer((HTTP_MANAGER == type || HTTP_MANAGER_RESET_ONLY == type) ? 80 : WEB_PORT); WebServer->on("/", HandleRoot); + WebServer->onNotFound(HandleNotFound); WebServer->on("/up", HandleUpgradeFirmware); WebServer->on("/u1", HandleUpgradeFirmwareStart); // OTA WebServer->on("/u2", HTTP_POST, HandleUploadDone, HandleUploadLoop); WebServer->on("/u2", HTTP_OPTIONS, HandlePreflightRequest); WebServer->on("/cs", HandleConsole); - WebServer->on("/ax", HandleAjaxConsoleRefresh); - WebServer->on("/ay", HandleAjaxStatusRefresh); WebServer->on("/cm", HandleHttpCommand); - WebServer->onNotFound(HandleNotFound); #ifndef FIRMWARE_MINIMAL WebServer->on("/cn", HandleConfiguration); WebServer->on("/md", HandleModuleConfiguration); WebServer->on("/wi", HandleWifiConfiguration); WebServer->on("/lg", HandleLoggingConfiguration); + WebServer->on("/tp", HandleTemplateConfiguration); WebServer->on("/co", HandleOtherConfiguration); WebServer->on("/dl", HandleBackupConfiguration); WebServer->on("/rs", HandleRestoreConfiguration); @@ -422,9 +493,7 @@ void StartWebserver(int type, IPAddress ipweb) WebServer->begin(); // Web server start } if (webserver_state != type) { - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_HTTP D_WEBSERVER_ACTIVE_ON " %s%s " D_WITH_IP_ADDRESS " %s"), - my_hostname, (mdns_begun) ? ".local" : "", ipweb.toString().c_str()); - AddLog(LOG_LEVEL_INFO); + AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_HTTP D_WEBSERVER_ACTIVE_ON " %s%s " D_WITH_IP_ADDRESS " %s"), my_hostname, (mdns_begun) ? ".local" : "", ipweb.toString().c_str()); } if (type) { webserver_state = type; } } @@ -438,7 +507,7 @@ void StopWebserver(void) } } -void WifiManagerBegin(void) +void WifiManagerBegin(bool reset_only) { // setup AP if (!global_state.wifi_down) { @@ -455,14 +524,14 @@ void WifiManagerBegin(void) int channel = WIFI_SOFT_AP_CHANNEL; if ((channel < 1) || (channel > 13)) { channel = 1; } - WiFi.softAP(my_hostname, NULL, channel); + WiFi.softAP(my_hostname, nullptr, channel); delay(500); // Without delay I've seen the IP address blank /* Setup the DNS server redirecting all the domains to the apIP */ DnsServer->setErrorReplyCode(DNSReplyCode::NoError); DnsServer->start(DNS_PORT, "*", WiFi.softAPIP()); - StartWebserver(HTTP_MANAGER, WiFi.softAPIP()); + StartWebserver((reset_only ? HTTP_MANAGER_RESET_ONLY : HTTP_MANAGER), WiFi.softAPIP()); } void PollDnsWebserver(void) @@ -473,291 +542,15 @@ void PollDnsWebserver(void) /*********************************************************************************************/ -void SetHeader(void) -{ - WebServer->sendHeader(F("Cache-Control"), F("no-cache, no-store, must-revalidate")); - WebServer->sendHeader(F("Pragma"), F("no-cache")); - WebServer->sendHeader(F("Expires"), F("-1")); -#ifndef ARDUINO_ESP8266_RELEASE_2_3_0 - WebServer->sendHeader(F("Access-Control-Allow-Origin"), F("*")); -#endif -} - bool WebAuthenticate(void) { - if (Settings.web_password[0] != 0) { + if (Settings.web_password[0] != 0 && HTTP_MANAGER_RESET_ONLY != webserver_state) { return WebServer->authenticate(WEB_USERNAME, Settings.web_password); } else { return true; } } -void ShowPage(String &page, bool auth) -{ - if (auth && (Settings.web_password[0] != 0) && !WebServer->authenticate(WEB_USERNAME, Settings.web_password)) { - return WebServer->requestAuthentication(); - } - - page.replace(F("{a}"), String(Settings.web_refresh)); - page.replace(F("{ha"), ModuleName()); - page.replace(F("{h}"), Settings.friendlyname[0]); - - String info = ""; - if (Settings.flag3.gui_hostname_ip) { - uint8_t more_ips = 0; - info += F("

"); info += my_hostname; - if (mdns_begun) { info += F(".local"); } - info += F(" ("); - if (static_cast(WiFi.localIP()) != 0) { - info += WiFi.localIP().toString(); - more_ips++; - } - if (static_cast(WiFi.softAPIP()) != 0) { - if (more_ips) { info += F(", "); } - info += WiFi.softAPIP().toString(); - } - info += F(")

"); - } - page.replace(F("{j}"), info); - - if (HTTP_MANAGER == webserver_state) { - if (WifiConfigCounter()) { - page.replace(F(""), FPSTR(HTTP_SCRIPT_COUNTER)); - page.replace(F(""), F("")); - page += FPSTR(HTTP_COUNTER); - } - } - page += FPSTR(HTTP_END); - page.replace(F("{mv"), my_version); - SetHeader(); - - ShowFreeMem(PSTR("ShowPage")); - - WebServer->send(200, FPSTR(HDR_CTYPE_HTML), page); -} - -void ShowPage(String &page) -{ - ShowPage(page, true); -} - -/*-------------------------------------------------------------------------------------------*/ - -void WebRestart(uint8_t type) -{ - // type 0 = restart - // type 1 = restart after config change - // type 2 = restart after config change with possible ip address change too - AddLog_P(LOG_LEVEL_DEBUG, S_LOG_HTTP, S_RESTART); - - String page = FPSTR(HTTP_HEAD); - page += FPSTR(HTTP_HEAD_STYLE); - - if (type) { - page.replace(F("{v}"), FPSTR(S_SAVE_CONFIGURATION)); - page += F("
" D_CONFIGURATION_SAVED "
"); - if (2 == type) { - page += F("
" D_TRYING_TO_CONNECT "
"); - } - page += F("
"); - } - else { - page.replace(F("{v}"), FPSTR(S_RESTART)); - } - - page += FPSTR(HTTP_MSG_RSTRT); - if (HTTP_MANAGER == webserver_state) { - webserver_state = HTTP_ADMIN; - } else { - page += FPSTR(HTTP_BTN_MAIN); - } - page.replace(F(""), FPSTR(HTTP_SCRIPT_RELOAD)); - ShowPage(page); - - ShowWebSource(SRC_WEBGUI); - restart_flag = 2; -} - -/*********************************************************************************************/ - -void HandleWifiLogin(void) -{ - String page = FPSTR(HTTP_HEAD); - page.replace(F("{v}"), FPSTR( D_CONFIGURE_WIFI )); - page += FPSTR(HTTP_HEAD_STYLE); - page += FPSTR(HTTP_FORM_LOGIN); - ShowPage(page, false); // false means show page no matter if the client has or has not credentials -} - -void HandleRoot(void) -{ - AddLog_P(LOG_LEVEL_DEBUG, S_LOG_HTTP, S_MAIN_MENU); - - if (CaptivePortal()) { return; } // If captive portal redirect instead of displaying the page. - - if ( WebServer->hasArg("rstrt") ) { - WebRestart(0); - return; - } - - if (HTTP_MANAGER == webserver_state) { -#ifndef FIRMWARE_MINIMAL - if ((Settings.web_password[0] != 0) && !(WebServer->hasArg("USER1")) && !(WebServer->hasArg("PASS1"))) { - HandleWifiLogin(); - } else { -/* - char tmp1[100]; - WebGetArg("USER1", tmp1, sizeof(tmp1)); - char tmp2[100]; - WebGetArg("PASS1", tmp2, sizeof(tmp2)); - if (!(Settings.web_password[0] != 0) || (!(!strcmp(tmp1, WEB_USERNAME) && !strcmp(tmp2, Settings.web_password)))) { -*/ - if (!(Settings.web_password[0] != 0) || ((WebServer->arg("USER1") == WEB_USERNAME ) && (WebServer->arg("PASS1") == Settings.web_password ))) { - HandleWifiConfiguration(); - } else { - // wrong user and pass - HandleWifiLogin(); - } - } -#endif // Not FIRMWARE_MINIMAL - } else { - char stemp[10]; - String page = FPSTR(HTTP_HEAD); - page.replace(F("{v}"), FPSTR(S_MAIN_MENU)); - page += FPSTR(HTTP_SCRIPT_ROOT); - page += FPSTR(HTTP_HEAD_STYLE); - page.replace(F(""), F("")); - - page += F("
"); - if (devices_present) { - if (light_type) { - if ((LST_COLDWARM == (light_type &7)) || (LST_RGBWC == (light_type &7))) { - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_MSG_SLIDER1, LightGetColorTemp()); - page += mqtt_data; - } - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_MSG_SLIDER2, Settings.light_dimmer); - page += mqtt_data; - } - page += FPSTR(HTTP_TABLE100); - page += F("
"); - if (SONOFF_IFAN02 == my_module_type) { - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_DEVICE_CONTROL, 36, 1, D_BUTTON_TOGGLE, ""); - page += mqtt_data; - for (uint8_t i = 0; i < MAX_FAN_SPEED; i++) { - snprintf_P(stemp, sizeof(stemp), PSTR("%d"), i); - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_DEVICE_CONTROL, 16, i +2, stemp, ""); - page += mqtt_data; - } - } else { - for (uint8_t idx = 1; idx <= devices_present; idx++) { - snprintf_P(stemp, sizeof(stemp), PSTR(" %d"), idx); - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_DEVICE_CONTROL, - 100 / devices_present, idx, (devices_present < 5) ? D_BUTTON_TOGGLE : "", (devices_present > 1) ? stemp : ""); - page += mqtt_data; - } - } - page += F("
%s%s
"); - } - if (SONOFF_BRIDGE == my_module_type) { - page += FPSTR(HTTP_TABLE100); - page += F("
"); - } - -#ifndef FIRMWARE_MINIMAL - mqtt_data[0] = '\0'; - XdrvCall(FUNC_WEB_ADD_MAIN_BUTTON); - XsnsCall(FUNC_WEB_ADD_MAIN_BUTTON); - page += String(mqtt_data); -#endif // Not FIRMWARE_MINIMAL - - if (HTTP_ADMIN == webserver_state) { - page += FPSTR(HTTP_BTN_MENU1); - page += FPSTR(HTTP_BTN_RSTRT); - } - ShowPage(page); - } -} - -void HandleAjaxStatusRefresh(void) -{ - if (!WebAuthenticate()) { return WebServer->requestAuthentication(); } - - char svalue[80]; - char tmp[100]; - - WebGetArg("o", tmp, sizeof(tmp)); - if (strlen(tmp)) { - ShowWebSource(SRC_WEBGUI); - uint8_t device = atoi(tmp); - if (SONOFF_IFAN02 == my_module_type) { - if (device < 2) { - ExecuteCommandPower(1, POWER_TOGGLE, SRC_IGNORE); - } else { - snprintf_P(svalue, sizeof(svalue), PSTR(D_CMND_FANSPEED " %d"), device -2); - ExecuteCommand(svalue, SRC_WEBGUI); - } - } else { - ExecuteCommandPower(device, POWER_TOGGLE, SRC_IGNORE); - } - } - WebGetArg("d", tmp, sizeof(tmp)); - if (strlen(tmp)) { - snprintf_P(svalue, sizeof(svalue), PSTR(D_CMND_DIMMER " %s"), tmp); - ExecuteWebCommand(svalue, SRC_WEBGUI); - } - WebGetArg("t", tmp, sizeof(tmp)); - if (strlen(tmp)) { - snprintf_P(svalue, sizeof(svalue), PSTR(D_CMND_COLORTEMPERATURE " %s"), tmp); - ExecuteWebCommand(svalue, SRC_WEBGUI); - } - WebGetArg("k", tmp, sizeof(tmp)); - if (strlen(tmp)) { - snprintf_P(svalue, sizeof(svalue), PSTR(D_CMND_RFKEY "%s"), tmp); - ExecuteWebCommand(svalue, SRC_WEBGUI); - } - - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{t}")); - XsnsCall(FUNC_WEB_APPEND); - if (D_DECIMAL_SEPARATOR[0] != '.') { - for (uint16_t i = 0; i < strlen(mqtt_data); i++) { - if ('.' == mqtt_data[i]) { - mqtt_data[i] = D_DECIMAL_SEPARATOR[0]; - } - } - } - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s"), mqtt_data); - if (devices_present) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s{t}"), mqtt_data); - uint8_t fsize = (devices_present < 5) ? 70 - (devices_present * 8) : 32; - if (SONOFF_IFAN02 == my_module_type) { - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_DEVICE_STATE, - mqtt_data, 36, (bitRead(power, 0)) ? "bold" : "normal", 54, GetStateText(bitRead(power, 0))); - uint8_t fanspeed = GetFanspeed(); - snprintf_P(svalue, sizeof(svalue), PSTR("%d"), fanspeed); - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_DEVICE_STATE, - mqtt_data, 64, (fanspeed) ? "bold" : "normal", 54, (fanspeed) ? svalue : GetStateText(0)); - } else { - for (uint8_t idx = 1; idx <= devices_present; idx++) { - snprintf_P(svalue, sizeof(svalue), PSTR("%d"), bitRead(power, idx -1)); - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_DEVICE_STATE, - mqtt_data, 100 / devices_present, (bitRead(power, idx -1)) ? "bold" : "normal", fsize, (devices_present < 5) ? GetStateText(bitRead(power, idx -1)) : svalue); - } - } - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s"), mqtt_data); - } - WebServer->send(200, FPSTR(HDR_CTYPE_HTML), mqtt_data); -} - bool HttpCheckPriviledgedAccess(bool autorequestauth = true) { if (HTTP_USER == webserver_state) { @@ -771,6 +564,433 @@ bool HttpCheckPriviledgedAccess(bool autorequestauth = true) return true; } +void WSHeaderSend(void) +{ + WebServer->sendHeader(F("Cache-Control"), F("no-cache, no-store, must-revalidate")); + WebServer->sendHeader(F("Pragma"), F("no-cache")); + WebServer->sendHeader(F("Expires"), F("-1")); +#ifndef ARDUINO_ESP8266_RELEASE_2_3_0 + WebServer->sendHeader(F("Access-Control-Allow-Origin"), F("*")); +#endif +} + +/********************************************************************************************** +* HTTP Content Page handler +**********************************************************************************************/ + +void WSSend(int code, int ctype, const String& content) +{ + char ct[25]; // strlen("application/octet-stream") +1 = Longest Content type string + WebServer->send(code, GetTextIndexed(ct, sizeof(ct), ctype, kContentTypes), content); +} + +/********************************************************************************************** +* HTTP Content Chunk handler +**********************************************************************************************/ + +void WSContentBegin(int code, int ctype) +{ + WebServer->client().flush(); + WSHeaderSend(); +#ifdef ARDUINO_ESP8266_RELEASE_2_3_0 + WebServer->sendHeader(F("Accept-Ranges"),F("none")); + WebServer->sendHeader(F("Transfer-Encoding"),F("chunked")); +#endif + WebServer->setContentLength(CONTENT_LENGTH_UNKNOWN); + WSSend(code, ctype, ""); // Signal start of chunked content + chunk_buffer = ""; +} + +void _WSContentSend(const String& content) // Low level sendContent for all core versions +{ + size_t len = content.length(); + +#ifdef ARDUINO_ESP8266_RELEASE_2_3_0 + const char * footer = "\r\n"; + char chunk_size[11]; + sprintf(chunk_size, "%x\r\n", len); + WebServer->sendContent(String() + chunk_size + content + footer); +#else + WebServer->sendContent(content); +#endif + +#ifdef USE_DEBUG_DRIVER + ShowFreeMem(PSTR("WSContentSend")); +#endif +// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("HTP: Chunk size %d"), len); +} + +void WSContentFlush() +{ + if (chunk_buffer.length() > 0) { + _WSContentSend(chunk_buffer); // Flush chunk buffer + chunk_buffer = ""; + } +} + +void _WSContentSendBuffer(void) +{ + int len = strlen(mqtt_data); + + if (0 == len) { // No content + return; + } + else if (len == sizeof(mqtt_data)) { + AddLog_P(LOG_LEVEL_INFO, PSTR("HTP: Content too large")); + } + else if (len < CHUNKED_BUFFER_SIZE) { // Append chunk buffer with small content + chunk_buffer += mqtt_data; + len = chunk_buffer.length(); + } + + if (len >= CHUNKED_BUFFER_SIZE) { // Either content or chunk buffer is oversize + WSContentFlush(); // Send chunk buffer before possible content oversize + } + if (strlen(mqtt_data) >= CHUNKED_BUFFER_SIZE) { // Content is oversize + _WSContentSend(mqtt_data); // Send content + } +} + +void WSContentSend_P(const char* formatP, ...) // Content send snprintf_P char data +{ + // This uses char strings. Be aware of sending %% if % is needed + va_list arg; + va_start(arg, formatP); + vsnprintf_P(mqtt_data, sizeof(mqtt_data), formatP, arg); + va_end(arg); + + _WSContentSendBuffer(); +} + +void WSContentSend_PD(const char* formatP, ...) // Content send snprintf_P char data checked for decimal separator +{ + // This uses char strings. Be aware of sending %% if % is needed + va_list arg; + va_start(arg, formatP); + int len = vsnprintf_P(mqtt_data, sizeof(mqtt_data), formatP, arg); + va_end(arg); + + if (D_DECIMAL_SEPARATOR[0] != '.') { + for (int i = 0; i < len; i++) { + if ('.' == mqtt_data[i]) { + mqtt_data[i] = D_DECIMAL_SEPARATOR[0]; + } + } + } + + _WSContentSendBuffer(); +} + +void WSContentStart_P(const char* title, bool auth) +{ + if (auth && (Settings.web_password[0] != 0) && !WebServer->authenticate(WEB_USERNAME, Settings.web_password)) { + return WebServer->requestAuthentication(); + } + + WSContentBegin(200, CT_HTML); + + if (title != nullptr) { + char ctitle[strlen_P(title) +1]; + strcpy_P(ctitle, title); // Get title from flash to RAM + WSContentSend_P(HTTP_HEAD, Settings.friendlyname[0], ctitle); + } +} + +void WSContentStart_P(const char* title) +{ + WSContentStart_P(title, true); +} + +void WSContentSendStyle_P(const char* style) +{ + if (WifiIsInManagerMode()) { + if (WifiConfigCounter()) { + WSContentSend_P(HTTP_SCRIPT_COUNTER); + } + } + WSContentSend_P(HTTP_HEAD_STYLE1); + WSContentSend_P(HTTP_HEAD_STYLE2); + if (style != nullptr) { + WSContentSend_P(style); + } + WSContentSend_P(HTTP_HEAD_STYLE3, ModuleName().c_str(), Settings.friendlyname[0]); + if (Settings.flag3.gui_hostname_ip) { + bool lip = (static_cast(WiFi.localIP()) != 0); + bool sip = (static_cast(WiFi.softAPIP()) != 0); + WSContentSend_P(PSTR("

%s%s (%s%s%s)

"), // sonoff.local (192.168.2.12, 192.168.4.1) + my_hostname, + (mdns_begun) ? ".local" : "", + (lip) ? WiFi.localIP().toString().c_str() : "", + (lip && sip) ? ", " : "", + (sip) ? WiFi.softAPIP().toString().c_str() : ""); + } + WSContentSend_P(PSTR("")); +} + +void WSContentSendStyle(void) +{ + WSContentSendStyle_P(nullptr); +} + +void WSContentButton(uint8_t title_index) +{ + char action[4]; + char title[32]; + + if (title_index <= BUTTON_RESET_CONFIGURATION) { + char confirm[64]; + WSContentSend_P(PSTR("

"), + GetTextIndexed(action, sizeof(action), title_index, kButtonAction), + GetTextIndexed(confirm, sizeof(confirm), title_index, kButtonConfirm), + (!title_index) ? "rst" : "non", + GetTextIndexed(title, sizeof(title), title_index, kButtonTitle)); + } else { + WSContentSend_P(PSTR("

"), + GetTextIndexed(action, sizeof(action), title_index, kButtonAction), + GetTextIndexed(title, sizeof(title), title_index, kButtonTitle)); + } +} + +void WSContentSpaceButton(uint8_t title_index) +{ + WSContentSend_P(PSTR("
")); // 5px padding + WSContentButton(title_index); +} + +void WSContentEnd(void) +{ + WSContentFlush(); // Flush chunk buffer + _WSContentSend(""); // Signal end of chunked content + WebServer->client().stop(); +} + +void WSContentStop(void) +{ + if (WifiIsInManagerMode()) { + if (WifiConfigCounter()) { + WSContentSend_P(HTTP_COUNTER); + } + } + WSContentSend_P(HTTP_END, my_version); + WSContentEnd(); +} + +/*********************************************************************************************/ + +void WebRestart(uint8_t type) +{ + // type 0 = restart + // type 1 = restart after config change + // type 2 = restart after config change with possible ip address change too + AddLog_P(LOG_LEVEL_DEBUG, S_LOG_HTTP, S_RESTART); + + bool reset_only = (HTTP_MANAGER_RESET_ONLY == webserver_state); + + WSContentStart_P((type) ? S_SAVE_CONFIGURATION : S_RESTART, !reset_only); + WSContentSend_P(HTTP_SCRIPT_RELOAD); + WSContentSendStyle(); + if (type) { + WSContentSend_P(PSTR("
" D_CONFIGURATION_SAVED "
")); + if (2 == type) { + WSContentSend_P(PSTR("
" D_TRYING_TO_CONNECT "
")); + } + WSContentSend_P(PSTR("
")); + } + WSContentSend_P(HTTP_MSG_RSTRT); + if (HTTP_MANAGER == webserver_state || reset_only) { + webserver_state = HTTP_ADMIN; + } else { + WSContentSpaceButton(BUTTON_MAIN); + } + WSContentStop(); + + ShowWebSource(SRC_WEBGUI); + restart_flag = 2; +} + +/*********************************************************************************************/ + +void HandleWifiLogin(void) +{ + WSContentStart_P(S_CONFIGURE_WIFI, false); // false means show page no matter if the client has or has not credentials + WSContentSendStyle(); + WSContentSend_P(HTTP_FORM_LOGIN); + + if (HTTP_MANAGER_RESET_ONLY == webserver_state) { + WSContentSpaceButton(BUTTON_RESTART); +#ifndef FIRMWARE_MINIMAL + WSContentSpaceButton(BUTTON_RESET_CONFIGURATION); +#endif // FIRMWARE_MINIMAL + } + + WSContentStop(); +} + +void HandleRoot(void) +{ + if (CaptivePortal()) { return; } // If captive portal redirect instead of displaying the page. + + if (WebServer->hasArg("rst")) { + WebRestart(0); + return; + } + + if (WifiIsInManagerMode()) { +#ifndef FIRMWARE_MINIMAL + if ((Settings.web_password[0] != 0) && !(WebServer->hasArg("USER1")) && !(WebServer->hasArg("PASS1")) && HTTP_MANAGER_RESET_ONLY != webserver_state) { + HandleWifiLogin(); + } else { + if (!(Settings.web_password[0] != 0) || (((WebServer->arg("USER1") == WEB_USERNAME ) && (WebServer->arg("PASS1") == Settings.web_password )) || HTTP_MANAGER_RESET_ONLY == webserver_state)) { + HandleWifiConfiguration(); + } else { + // wrong user and pass + HandleWifiLogin(); + } + } +#endif // Not FIRMWARE_MINIMAL + return; + } + + if (HandleRootStatusRefresh()) { + return; + } + + AddLog_P(LOG_LEVEL_DEBUG, S_LOG_HTTP, S_MAIN_MENU); + + char stemp[5]; + + WSContentStart_P(S_MAIN_MENU); + WSContentSend_P(HTTP_SCRIPT_ROOT, Settings.web_refresh); + WSContentSendStyle(); + + WSContentSend_P(PSTR("
")); + if (devices_present) { + if (light_type) { + if ((LST_COLDWARM == (light_type &7)) || (LST_RGBWC == (light_type &7))) { + WSContentSend_P(HTTP_MSG_SLIDER1, LightGetColorTemp()); + } + WSContentSend_P(HTTP_MSG_SLIDER2, Settings.light_dimmer); + } + WSContentSend_P(HTTP_TABLE100); + WSContentSend_P(PSTR("")); + if (SONOFF_IFAN02 == my_module_type) { + WSContentSend_P(HTTP_DEVICE_CONTROL, 36, 1, D_BUTTON_TOGGLE, ""); + for (uint8_t i = 0; i < MAX_FAN_SPEED; i++) { + snprintf_P(stemp, sizeof(stemp), PSTR("%d"), i); + WSContentSend_P(HTTP_DEVICE_CONTROL, 16, i +2, stemp, ""); + } + } else { + for (uint8_t idx = 1; idx <= devices_present; idx++) { + snprintf_P(stemp, sizeof(stemp), PSTR(" %d"), idx); + WSContentSend_P(HTTP_DEVICE_CONTROL, 100 / devices_present, idx, (devices_present < 5) ? D_BUTTON_TOGGLE : "", (devices_present > 1) ? stemp : ""); + } + } + WSContentSend_P(PSTR("")); + } + if (SONOFF_BRIDGE == my_module_type) { + WSContentSend_P(HTTP_TABLE100); + WSContentSend_P(PSTR("")); + uint8_t idx = 0; + for (uint8_t i = 0; i < 4; i++) { + if (idx > 0) { WSContentSend_P(PSTR("")); } + for (uint8_t j = 0; j < 4; j++) { + idx++; + WSContentSend_P(PSTR(""), idx, idx); // &k is related to WebGetArg("k", tmp, sizeof(tmp)); + } + } + WSContentSend_P(PSTR("")); + } + +#ifndef FIRMWARE_MINIMAL + XdrvCall(FUNC_WEB_ADD_MAIN_BUTTON); + XsnsCall(FUNC_WEB_ADD_MAIN_BUTTON); +#endif // Not FIRMWARE_MINIMAL + + if (HTTP_ADMIN == webserver_state) { +#ifdef FIRMWARE_MINIMAL + WSContentSpaceButton(BUTTON_FIRMWARE_UPGRADE); +#else + WSContentSpaceButton(BUTTON_CONFIGURATION); + WSContentButton(BUTTON_INFORMATION); + WSContentButton(BUTTON_FIRMWARE_UPGRADE); +#endif // Not FIRMWARE_MINIMAL + WSContentButton(BUTTON_CONSOLE); + WSContentButton(BUTTON_RESTART); + } + WSContentStop(); +} + +bool HandleRootStatusRefresh(void) +{ + if (!WebAuthenticate()) { + WebServer->requestAuthentication(); + return true; + } + + if (!WebServer->hasArg("m")) { // Status refresh requested + return false; + } + + char tmp[8]; // WebGetArg numbers only + char svalue[32]; // Command and number parameter + + WebGetArg("o", tmp, sizeof(tmp)); // 1 - 16 Device number for button Toggle or Fanspeed + if (strlen(tmp)) { + ShowWebSource(SRC_WEBGUI); + uint8_t device = atoi(tmp); + if (SONOFF_IFAN02 == my_module_type) { + if (device < 2) { + ExecuteCommandPower(1, POWER_TOGGLE, SRC_IGNORE); + } else { + snprintf_P(svalue, sizeof(svalue), PSTR(D_CMND_FANSPEED " %d"), device -2); + ExecuteCommand(svalue, SRC_WEBGUI); + } + } else { + ExecuteCommandPower(device, POWER_TOGGLE, SRC_IGNORE); + } + } + WebGetArg("d", tmp, sizeof(tmp)); // 0 - 100 Dimmer value + if (strlen(tmp)) { + snprintf_P(svalue, sizeof(svalue), PSTR(D_CMND_DIMMER " %s"), tmp); + ExecuteWebCommand(svalue, SRC_WEBGUI); + } + WebGetArg("t", tmp, sizeof(tmp)); // 153 - 500 Color temperature + if (strlen(tmp)) { + snprintf_P(svalue, sizeof(svalue), PSTR(D_CMND_COLORTEMPERATURE " %s"), tmp); + ExecuteWebCommand(svalue, SRC_WEBGUI); + } + WebGetArg("k", tmp, sizeof(tmp)); // 1 - 16 Pre defined RF keys + if (strlen(tmp)) { + snprintf_P(svalue, sizeof(svalue), PSTR(D_CMND_RFKEY "%s"), tmp); + ExecuteWebCommand(svalue, SRC_WEBGUI); + } + + WSContentBegin(200, CT_HTML); + WSContentSend_P(PSTR("{t}")); + XsnsCall(FUNC_WEB_SENSOR); + WSContentSend_P(PSTR("")); + + if (devices_present) { + WSContentSend_P(PSTR("{t}")); + uint8_t fsize = (devices_present < 5) ? 70 - (devices_present * 8) : 32; + if (SONOFF_IFAN02 == my_module_type) { + WSContentSend_P(HTTP_DEVICE_STATE, 36, (bitRead(power, 0)) ? "bold" : "normal", 54, GetStateText(bitRead(power, 0))); + uint8_t fanspeed = GetFanspeed(); + snprintf_P(svalue, sizeof(svalue), PSTR("%d"), fanspeed); + WSContentSend_P(HTTP_DEVICE_STATE, 64, (fanspeed) ? "bold" : "normal", 54, (fanspeed) ? svalue : GetStateText(0)); + } else { + for (uint8_t idx = 1; idx <= devices_present; idx++) { + snprintf_P(svalue, sizeof(svalue), PSTR("%d"), bitRead(power, idx -1)); + WSContentSend_P(HTTP_DEVICE_STATE, 100 / devices_present, (bitRead(power, idx -1)) ? "bold" : "normal", fsize, (devices_present < 5) ? GetStateText(bitRead(power, idx -1)) : svalue); + } + } + WSContentSend_P(PSTR("")); + } + WSContentEnd(); + + return true; +} + /*-------------------------------------------------------------------------------------------*/ #ifndef FIRMWARE_MINIMAL @@ -781,19 +1001,142 @@ void HandleConfiguration(void) AddLog_P(LOG_LEVEL_DEBUG, S_LOG_HTTP, S_CONFIGURATION); - String page = FPSTR(HTTP_HEAD); - page.replace(F("{v}"), FPSTR(S_CONFIGURATION)); - page += FPSTR(HTTP_HEAD_STYLE); - page += FPSTR(HTTP_BTN_MENU_MODULE); + WSContentStart_P(S_CONFIGURATION); + WSContentSendStyle(); + + WSContentButton(BUTTON_MODULE); + WSContentButton(BUTTON_WIFI); - mqtt_data[0] = '\0'; XdrvCall(FUNC_WEB_ADD_BUTTON); XsnsCall(FUNC_WEB_ADD_BUTTON); - page += String(mqtt_data); - page += FPSTR(HTTP_BTN_MENU4); - page += FPSTR(HTTP_BTN_MAIN); - ShowPage(page); + WSContentButton(BUTTON_LOGGING); + WSContentButton(BUTTON_OTHER); + WSContentButton(BUTTON_TEMPLATE); + + WSContentSpaceButton(BUTTON_RESET_CONFIGURATION); + WSContentButton(BUTTON_BACKUP); + WSContentButton(BUTTON_RESTORE); + + WSContentSpaceButton(BUTTON_MAIN); + WSContentStop(); +} + +/*-------------------------------------------------------------------------------------------*/ + +void HandleTemplateConfiguration(void) +{ + if (!HttpCheckPriviledgedAccess()) { return; } + + if (WebServer->hasArg("save")) { + TemplateSaveSettings(); + WebRestart(1); + return; + } + + char stemp[20]; // Template number and Sensor name + + if (WebServer->hasArg("m")) { + WSContentBegin(200, CT_PLAIN); + for (uint8_t i = 0; i < MAXMODULE; i++) { // "}2'%d'>%s (%d)}3" - "}2'0'>Sonoff Basic (1)}3" + uint8_t midx = pgm_read_byte(kModuleNiceList + i); + WSContentSend_P(HTTP_MODULE_TEMPLATE_REPLACE, midx, AnyModuleName(midx).c_str(), midx +1); + } + WSContentEnd(); + return; + } + + WebGetArg("t", stemp, sizeof(stemp)); // 0 - 69 Template number + if (strlen(stemp)) { + uint8_t module = atoi(stemp); + uint8_t module_save = Settings.module; + Settings.module = module; + myio cmodule; + ModuleGpios(&cmodule); + gpio_flag flag = ModuleFlag(); + Settings.module = module_save; + + WSContentBegin(200, CT_PLAIN); + WSContentSend_P(PSTR("%s}1"), AnyModuleName(module).c_str()); // NAME: Generic + for (uint8_t i = 0; i < sizeof(kGpioNiceList); i++) { // GPIO: }2'0'>None (0)}3}2'17'>Button1 (17)}3... + + if (1 == i) { + WSContentSend_P(HTTP_MODULE_TEMPLATE_REPLACE, 255, D_SENSOR_USER, 255); // }2'255'>User (255)}3 + } + + uint8_t midx = pgm_read_byte(kGpioNiceList + i); + WSContentSend_P(HTTP_MODULE_TEMPLATE_REPLACE, midx, GetTextIndexed(stemp, sizeof(stemp), midx, kSensorNames), midx); + } + + WSContentSend_P(PSTR("}1")); // Field separator + for (uint8_t i = 0; i < sizeof(cmodule); i++) { // 17,148,29,149,7,255,255,255,138,255,139,255,255 + if ((i < 6) || ((i > 8) && (i != 11))) { // Ignore flash pins GPIO06, 7, 8 and 11 + WSContentSend_P(PSTR("%s%d"), (i>0)?",":"", cmodule.io[i]); + } + } + WSContentSend_P(PSTR("}1%d}1%d"), flag, Settings.user_template_base); // FLAG: 1 BASE: 17 + WSContentEnd(); + return; + } + + AddLog_P(LOG_LEVEL_DEBUG, S_LOG_HTTP, S_CONFIGURE_TEMPLATE); + + WSContentStart_P(S_CONFIGURE_TEMPLATE); + WSContentSend_P(HTTP_SCRIPT_MODULE_TEMPLATE); + WSContentSend_P(HTTP_SCRIPT_TEMPLATE); + WSContentSendStyle(); + WSContentSend_P(HTTP_FORM_TEMPLATE); + WSContentSend_P(HTTP_TABLE100); + WSContentSend_P(PSTR("" D_TEMPLATE_NAME "" + "" D_BASE_TYPE "" + "" + "
")); + WSContentSend_P(HTTP_TABLE100); + for (uint8_t i = 0; i < 17; i++) { + if ((i < 6) || ((i > 8) && (i != 11))) { // Ignore flash pins GPIO06, 7, 8 and 11 + bool esp8285 = ((9==i)||(10==i)); + WSContentSend_P(PSTR("%s" D_GPIO "%d%s"), + (esp8285) ? "" : "", i, (esp8285) ? "" : "", (0==i) ? " style='width:200px'" : "", i, i); + } + } + WSContentSend_P(PSTR("")); + WSContentSend_P(HTTP_FORM_TEMPLATE_FLAG); + WSContentSend_P(HTTP_FORM_END); + WSContentSpaceButton(BUTTON_CONFIGURATION); + WSContentStop(); +} + +void TemplateSaveSettings(void) +{ + char tmp[sizeof(Settings.user_template.name)]; // WebGetArg NAME and GPIO/BASE/FLAG byte value + char webindex[5]; // WebGetArg name + char svalue[128]; // Template command string + + WebGetArg("s1", tmp, sizeof(tmp)); // NAME + snprintf_P(svalue, sizeof(svalue), PSTR(D_CMND_TEMPLATE " {\"" D_JSON_NAME "\":\"%s\",\"" D_JSON_GPIO "\":["), tmp); + + uint8_t j = 0; + for (uint8_t i = 0; i < sizeof(Settings.user_template.gp); i++) { + if (6 == i) { j = 9; } + if (8 == i) { j = 12; } + snprintf_P(webindex, sizeof(webindex), PSTR("g%d"), j); + WebGetArg(webindex, tmp, sizeof(tmp)); // GPIO + uint8_t gpio = atoi(tmp); + snprintf_P(svalue, sizeof(svalue), PSTR("%s%s%d"), svalue, (i>0)?",":"", gpio); + j++; + } + + uint8_t flag = 0; + for (uint8_t i = 0; i < GPIO_FLAG_USED; i++) { + snprintf_P(webindex, sizeof(webindex), PSTR("c%d"), i); + uint8_t state = WebServer->hasArg(webindex) << i; // FLAG + flag += state; + } + WebGetArg("g99", tmp, sizeof(tmp)); // BASE + uint8_t base = atoi(tmp) +1; + + snprintf_P(svalue, sizeof(svalue), PSTR("%s],\"" D_JSON_FLAG "\":%d,\"" D_JSON_BASE "\":%d}"), svalue, flag, base); + ExecuteWebCommand(svalue, SRC_WEBGUI); } /*-------------------------------------------------------------------------------------------*/ @@ -808,22 +1151,15 @@ void HandleModuleConfiguration(void) return; } - char stemp[20]; + char stemp[20]; // Sensor name uint8_t midx; myio cmodule; ModuleGpios(&cmodule); if (WebServer->hasArg("m")) { - String page = ""; -/* - for (uint8_t i = 0; i < MAXMODULE; i++) { // "}1'%d'>%s (%d)}2" - "}1'0'>Sonoff Basic (1)}2" - midx = pgm_read_byte(kModuleNiceList + i); - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SCRIPT_MODULE3, midx, AnyModuleName(midx).c_str(), midx +1); - page += mqtt_data; - } -*/ + WSContentBegin(200, CT_PLAIN); uint8_t vidx = 0; - for (uint8_t i = 0; i <= MAXMODULE; i++) { // "}1'%d'>%s (%d)}2" - "}1'255'>UserTemplate (0)}2" - "}1'0'>Sonoff Basic (1)}2" + for (uint8_t i = 0; i <= MAXMODULE; i++) { // "}2'%d'>%s (%d)}3" - "}2'255'>UserTemplate (0)}3" - "}2'0'>Sonoff Basic (1)}3" if (0 == i) { midx = USER_MODULE; vidx = 0; @@ -831,79 +1167,60 @@ void HandleModuleConfiguration(void) midx = pgm_read_byte(kModuleNiceList + i -1); vidx = midx +1; } - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SCRIPT_MODULE3, midx, AnyModuleName(midx).c_str(), vidx); - page += mqtt_data; + WSContentSend_P(HTTP_MODULE_TEMPLATE_REPLACE, midx, AnyModuleName(midx).c_str(), vidx); } - WebServer->send(200, FPSTR(HDR_CTYPE_PLAIN), page); + WSContentEnd(); return; } if (WebServer->hasArg("g")) { - String page = ""; + WSContentBegin(200, CT_PLAIN); for (uint8_t j = 0; j < sizeof(kGpioNiceList); j++) { midx = pgm_read_byte(kGpioNiceList + j); if (!GetUsedInModule(midx, cmodule.io)) { - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SCRIPT_MODULE3, midx, GetTextIndexed(stemp, sizeof(stemp), midx, kSensorNames), midx); - page += mqtt_data; + WSContentSend_P(HTTP_MODULE_TEMPLATE_REPLACE, midx, GetTextIndexed(stemp, sizeof(stemp), midx, kSensorNames), midx); } } - WebServer->send(200, FPSTR(HDR_CTYPE_PLAIN), page); + WSContentEnd(); return; } AddLog_P(LOG_LEVEL_DEBUG, S_LOG_HTTP, S_CONFIGURE_MODULE); - String page = FPSTR(HTTP_HEAD); - page.replace(F("{v}"), FPSTR(S_CONFIGURE_MODULE)); - page += FPSTR(HTTP_SCRIPT_MODULE1); - page.replace(F("}4"), String(Settings.module)); + WSContentStart_P(S_CONFIGURE_MODULE); + WSContentSend_P(HTTP_SCRIPT_MODULE_TEMPLATE); + WSContentSend_P(HTTP_SCRIPT_MODULE1, Settings.module); for (uint8_t i = 0; i < sizeof(cmodule); i++) { if (ValidGPIO(i, cmodule.io[i])) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("sk(%d,%d);"), my_module.io[i], i); // g0 - g16 - page += mqtt_data; + WSContentSend_P(PSTR("sk(%d,%d);"), my_module.io[i], i); // g0 - g16 } } - page += FPSTR(HTTP_SCRIPT_MODULE2); - page += FPSTR(HTTP_HEAD_STYLE); - page.replace(F(""), F("")); - page += FPSTR(HTTP_FORM_MODULE); - page.replace(F("{mt"), AnyModuleName(MODULE)); - - if (my_module_flag.pullup) { - page += FPSTR(HTTP_FORM_MODULE_PULLUP); - page.replace(F("{r1"), (Settings.flag3.no_pullup) ? F(" checked") : F("")); - } - - page += F("
"); + WSContentSend_P(HTTP_SCRIPT_MODULE2); + WSContentSendStyle(); + WSContentSend_P(HTTP_FORM_MODULE, AnyModuleName(MODULE).c_str()); for (uint8_t i = 0; i < sizeof(cmodule); i++) { if (ValidGPIO(i, cmodule.io[i])) { snprintf_P(stemp, 3, PINS_WEMOS +i*2); - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR(""), - (WEMOS==my_module_type)?stemp:"", i, (0==i)? D_SENSOR_BUTTON "1":(1==i)? D_SERIAL_OUT :(3==i)? D_SERIAL_IN :(9==i)? "ESP8285" :(10==i)? "ESP8285" :(12==i)? D_SENSOR_RELAY "1":(13==i)? D_SENSOR_LED "1i":(14==i)? D_SENSOR :"", i, i); - page += mqtt_data; + WSContentSend_P(PSTR(""), + (WEMOS==my_module_type)?stemp:"", i, (0==i)? D_SENSOR_BUTTON "1":(1==i)? D_SERIAL_OUT :(3==i)? D_SERIAL_IN :((9==i)||(10==i))? "ESP8285" :(12==i)? D_SENSOR_RELAY "1":(13==i)? D_SENSOR_LED "1i":(14==i)? D_SENSOR :"", i, i); } } - page += F("
%s " D_GPIO "%d %s
%s " D_GPIO "%d %s
"); - page += FPSTR(HTTP_FORM_END); - page += FPSTR(HTTP_BTN_CONF); - ShowPage(page); + WSContentSend_P(PSTR("")); + WSContentSend_P(HTTP_FORM_END); + WSContentSpaceButton(BUTTON_CONFIGURATION); + WSContentStop(); } void ModuleSaveSettings(void) { - char tmp[100]; - char stemp[TOPSZ]; + char tmp[8]; // WebGetArg numbers only + char webindex[5]; // WebGetArg name WebGetArg("g99", tmp, sizeof(tmp)); uint8_t new_module = (!strlen(tmp)) ? MODULE : atoi(tmp); Settings.last_module = Settings.module; Settings.module = new_module; SetModuleType(); - if (Settings.last_module == new_module) { - if (my_module_flag.pullup) { - Settings.flag3.no_pullup = WebServer->hasArg("b1"); - } - } myio cmodule; ModuleGpios(&cmodule); String gpios = ""; @@ -912,140 +1229,137 @@ void ModuleSaveSettings(void) Settings.my_gp.io[i] = GPIO_NONE; } else { if (ValidGPIO(i, cmodule.io[i])) { - snprintf_P(stemp, sizeof(stemp), PSTR("g%d"), i); - WebGetArg(stemp, tmp, sizeof(tmp)); + snprintf_P(webindex, sizeof(webindex), PSTR("g%d"), i); + WebGetArg(webindex, tmp, sizeof(tmp)); Settings.my_gp.io[i] = (!strlen(tmp)) ? 0 : atoi(tmp); gpios += F(", " D_GPIO ); gpios += String(i); gpios += F(" "); gpios += String(Settings.my_gp.io[i]); } } } - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_MODULE "%s " D_CMND_MODULE "%s"), ModuleName().c_str(), gpios.c_str()); - AddLog(LOG_LEVEL_INFO); + AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_MODULE "%s " D_CMND_MODULE "%s"), ModuleName().c_str(), gpios.c_str()); } /*-------------------------------------------------------------------------------------------*/ String htmlEscape(String s) { - s.replace("&", "&"); - s.replace("<", "<"); - s.replace(">", ">"); - s.replace("\"", """); - s.replace("'", "'"); - s.replace("/", "/"); - return s; + s.replace("&", "&"); + s.replace("<", "<"); + s.replace(">", ">"); + s.replace("\"", """); + s.replace("'", "'"); + s.replace("/", "/"); + return s; } void HandleWifiConfiguration(void) { - if (!HttpCheckPriviledgedAccess()) { return; } + if (!HttpCheckPriviledgedAccess(!WifiIsInManagerMode())) { return; } AddLog_P(LOG_LEVEL_DEBUG, S_LOG_HTTP, S_CONFIGURE_WIFI); - if (WebServer->hasArg("save")) { + if (WebServer->hasArg("save") && HTTP_MANAGER_RESET_ONLY != webserver_state) { WifiSaveSettings(); WebRestart(2); return; } - String page = FPSTR(HTTP_HEAD); - page.replace(F("{v}"), FPSTR(S_CONFIGURE_WIFI)); - page += FPSTR(HTTP_SCRIPT_WIFI); - page += FPSTR(HTTP_HEAD_STYLE); + WSContentStart_P(S_CONFIGURE_WIFI, !WifiIsInManagerMode()); + WSContentSend_P(HTTP_SCRIPT_WIFI); + WSContentSendStyle(); - if (WebServer->hasArg("scan")) { + if (HTTP_MANAGER_RESET_ONLY != webserver_state) { + if (WebServer->hasArg("scan")) { #ifdef USE_EMULATION - UdpDisconnect(); + UdpDisconnect(); #endif // USE_EMULATION - int n = WiFi.scanNetworks(); - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_WIFI D_SCAN_DONE)); + int n = WiFi.scanNetworks(); + AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_WIFI D_SCAN_DONE)); - if (0 == n) { - AddLog_P(LOG_LEVEL_DEBUG, S_LOG_WIFI, S_NO_NETWORKS_FOUND); - page += FPSTR(S_NO_NETWORKS_FOUND); - page += F(". " D_REFRESH_TO_SCAN_AGAIN "."); - } else { - //sort networks - int indices[n]; - for (int i = 0; i < n; i++) { - indices[i] = i; - } - - // RSSI SORT - for (int i = 0; i < n; i++) { - for (int j = i + 1; j < n; j++) { - if (WiFi.RSSI(indices[j]) > WiFi.RSSI(indices[i])) { - std::swap(indices[i], indices[j]); - } - } - } - - // remove duplicates ( must be RSSI sorted ) - if (remove_duplicate_access_points) { - String cssid; + if (0 == n) { + AddLog_P(LOG_LEVEL_DEBUG, S_LOG_WIFI, S_NO_NETWORKS_FOUND); + WSContentSend_P(S_NO_NETWORKS_FOUND); + WSContentSend_P(PSTR(". " D_REFRESH_TO_SCAN_AGAIN ".")); + } else { + //sort networks + int indices[n]; + for (int i = 0; i < n; i++) { + indices[i] = i; + } + + // RSSI SORT for (int i = 0; i < n; i++) { - if (-1 == indices[i]) { continue; } - cssid = WiFi.SSID(indices[i]); for (int j = i + 1; j < n; j++) { - if (cssid == WiFi.SSID(indices[j])) { - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_WIFI D_DUPLICATE_ACCESSPOINT " %s"), WiFi.SSID(indices[j]).c_str()); - AddLog(LOG_LEVEL_DEBUG); - indices[j] = -1; // set dup aps to index -1 + if (WiFi.RSSI(indices[j]) > WiFi.RSSI(indices[i])) { + std::swap(indices[i], indices[j]); } } } - } - //display networks in page - for (int i = 0; i < n; i++) { - if (-1 == indices[i]) { continue; } // skip dups - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_WIFI D_SSID " %s, " D_BSSID " %s, " D_CHANNEL " %d, " D_RSSI " %d"), WiFi.SSID(indices[i]).c_str(), WiFi.BSSIDstr(indices[i]).c_str(), WiFi.channel(indices[i]), WiFi.RSSI(indices[i])); - AddLog(LOG_LEVEL_DEBUG); - int quality = WifiGetRssiAsQuality(WiFi.RSSI(indices[i])); - - if (minimum_signal_quality == -1 || minimum_signal_quality < quality) { - String item = FPSTR(HTTP_LNK_ITEM); - String rssiQ; - rssiQ += quality; - item.replace(F("{v}"), htmlEscape(WiFi.SSID(indices[i]))); - item.replace(F("{w}"), String(WiFi.channel(indices[i]))); - item.replace(F("{r}"), rssiQ); - uint8_t auth = WiFi.encryptionType(indices[i]); - item.replace(F("{i}"), (ENC_TYPE_WEP == auth) ? F(D_WEP) : (ENC_TYPE_TKIP == auth) ? F(D_WPA_PSK) : (ENC_TYPE_CCMP == auth) ? F(D_WPA2_PSK) : (ENC_TYPE_AUTO == auth) ? F(D_AUTO) : F("")); - page += item; - delay(0); - } else { - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_WIFI D_SKIPPING_LOW_QUALITY)); + // remove duplicates ( must be RSSI sorted ) + if (remove_duplicate_access_points) { + String cssid; + for (int i = 0; i < n; i++) { + if (-1 == indices[i]) { continue; } + cssid = WiFi.SSID(indices[i]); + for (int j = i + 1; j < n; j++) { + if (cssid == WiFi.SSID(indices[j])) { + AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_WIFI D_DUPLICATE_ACCESSPOINT " %s"), WiFi.SSID(indices[j]).c_str()); + indices[j] = -1; // set dup aps to index -1 + } + } + } } + //display networks in page + for (int i = 0; i < n; i++) { + if (-1 == indices[i]) { continue; } // skip dups + AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_WIFI D_SSID " %s, " D_BSSID " %s, " D_CHANNEL " %d, " D_RSSI " %d"), WiFi.SSID(indices[i]).c_str(), WiFi.BSSIDstr(indices[i]).c_str(), WiFi.channel(indices[i]), WiFi.RSSI(indices[i])); + int quality = WifiGetRssiAsQuality(WiFi.RSSI(indices[i])); + + if (minimum_signal_quality == -1 || minimum_signal_quality < quality) { + uint8_t auth = WiFi.encryptionType(indices[i]); + WSContentSend_P(PSTR("
%s (%d) %s %d%%
"), + htmlEscape(WiFi.SSID(indices[i])).c_str(), + WiFi.channel(indices[i]), + (ENC_TYPE_WEP == auth) ? D_WEP : (ENC_TYPE_TKIP == auth) ? D_WPA_PSK : (ENC_TYPE_CCMP == auth) ? D_WPA2_PSK : (ENC_TYPE_AUTO == auth) ? D_AUTO : "", + quality + ); + delay(0); + } else { + AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_WIFI D_SKIPPING_LOW_QUALITY)); + } + + } + WSContentSend_P(PSTR("
")); } - page += "
"; + } else { + WSContentSend_P(PSTR("
")); } - } else { - page += FPSTR(HTTP_LNK_SCAN); + + // As WIFI_HOSTNAME may contain %s-%04d it cannot be part of HTTP_FORM_WIFI where it will exception + WSContentSend_P(HTTP_FORM_WIFI, Settings.sta_ssid[0], Settings.sta_ssid[1], WIFI_HOSTNAME, WIFI_HOSTNAME, Settings.hostname); + WSContentSend_P(HTTP_FORM_END); } - page += FPSTR(HTTP_FORM_WIFI); - page.replace(F("{h1"), Settings.hostname); - page.replace(F("{s1"), Settings.sta_ssid[0]); - page.replace(F("{s2"), Settings.sta_ssid[1]); - page += FPSTR(HTTP_FORM_END); - if (HTTP_MANAGER == webserver_state) { - page += FPSTR(HTTP_BTN_RSTRT); + if (WifiIsInManagerMode()) { + WSContentSpaceButton(BUTTON_RESTART); +#ifndef FIRMWARE_MINIMAL + WSContentSpaceButton(BUTTON_RESET_CONFIGURATION); +#endif // FIRMWARE_MINIMAL } else { - page += FPSTR(HTTP_BTN_CONF); + WSContentSpaceButton(BUTTON_CONFIGURATION); } -// ShowPage(page); - ShowPage(page, !(HTTP_MANAGER == webserver_state)); + WSContentStop(); } void WifiSaveSettings(void) { - char tmp[100]; + char tmp[sizeof(Settings.sta_pwd[0])]; // Max length is currently 65 WebGetArg("h", tmp, sizeof(tmp)); strlcpy(Settings.hostname, (!strlen(tmp)) ? WIFI_HOSTNAME : tmp, sizeof(Settings.hostname)); - if (strstr(Settings.hostname,"%")) { + if (strstr(Settings.hostname, "%") != nullptr) { strlcpy(Settings.hostname, WIFI_HOSTNAME, sizeof(Settings.hostname)); } WebGetArg("s1", tmp, sizeof(tmp)); @@ -1053,12 +1367,10 @@ void WifiSaveSettings(void) WebGetArg("s2", tmp, sizeof(tmp)); strlcpy(Settings.sta_ssid[1], (!strlen(tmp)) ? STA_SSID2 : tmp, sizeof(Settings.sta_ssid[1])); WebGetArg("p1", tmp, sizeof(tmp)); - strlcpy(Settings.sta_pwd[0], (!strlen(tmp)) ? "" : (strchr(tmp,'*')) ? Settings.sta_pwd[0] : tmp, sizeof(Settings.sta_pwd[0])); + strlcpy(Settings.sta_pwd[0], (!strlen(tmp)) ? "" : (strlen(tmp) < 5) ? Settings.sta_pwd[0] : tmp, sizeof(Settings.sta_pwd[0])); WebGetArg("p2", tmp, sizeof(tmp)); - strlcpy(Settings.sta_pwd[1], (!strlen(tmp)) ? "" : (strchr(tmp,'*')) ? Settings.sta_pwd[1] : tmp, sizeof(Settings.sta_pwd[1])); - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_WIFI D_CMND_HOSTNAME " %s, " D_CMND_SSID "1 %s, " D_CMND_SSID "2 %s"), - Settings.hostname, Settings.sta_ssid[0], Settings.sta_ssid[1]); - AddLog(LOG_LEVEL_INFO); + strlcpy(Settings.sta_pwd[1], (!strlen(tmp)) ? "" : (strlen(tmp) < 5) ? Settings.sta_pwd[1] : tmp, sizeof(Settings.sta_pwd[1])); + AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_WIFI D_CMND_HOSTNAME " %s, " D_CMND_SSID "1 %s, " D_CMND_SSID "2 %s"), Settings.hostname, Settings.sta_ssid[0], Settings.sta_ssid[1]); } /*-------------------------------------------------------------------------------------------*/ @@ -1075,58 +1387,40 @@ void HandleLoggingConfiguration(void) return; } - String page = FPSTR(HTTP_HEAD); - page.replace(F("{v}"), FPSTR(S_CONFIGURE_LOGGING)); - page += FPSTR(HTTP_HEAD_STYLE); - - page += FPSTR(HTTP_FORM_LOG1); + WSContentStart_P(S_CONFIGURE_LOGGING); + WSContentSendStyle(); + WSContentSend_P(HTTP_FORM_LOG1); + char stemp1[32]; + char stemp2[32]; + uint8_t dlevel[3] = { LOG_LEVEL_INFO, LOG_LEVEL_INFO, LOG_LEVEL_NONE }; for (uint8_t idx = 0; idx < 3; idx++) { - page += FPSTR(HTTP_FORM_LOG2); - switch (idx) { - case 0: - page.replace(F("{b0"), F(D_SERIAL_LOG_LEVEL)); - page.replace(F("{b1"), STR(SERIAL_LOG_LEVEL)); - page.replace(F("{b2"), F("ls")); - for (uint8_t i = LOG_LEVEL_NONE; i < LOG_LEVEL_ALL; i++) { - page.replace("{a" + String(i), (i == Settings.seriallog_level) ? F(" selected ") : F(" ")); - } - break; - case 1: - page.replace(F("{b0"), F(D_WEB_LOG_LEVEL)); - page.replace(F("{b1"), STR(WEB_LOG_LEVEL)); - page.replace(F("{b2"), F("lw")); - for (uint8_t i = LOG_LEVEL_NONE; i < LOG_LEVEL_ALL; i++) { - page.replace("{a" + String(i), (i == Settings.weblog_level) ? F(" selected ") : F(" ")); - } - break; - case 2: - page.replace(F("{b0"), F(D_SYS_LOG_LEVEL)); - page.replace(F("{b1"), STR(SYS_LOG_LEVEL)); - page.replace(F("{b2"), F("ll")); - for (uint8_t i = LOG_LEVEL_NONE; i < LOG_LEVEL_ALL; i++) { - page.replace("{a" + String(i), (i == Settings.syslog_level) ? F(" selected ") : F(" ")); - } - break; + uint8_t llevel = (0==idx)?Settings.seriallog_level:(1==idx)?Settings.weblog_level:Settings.syslog_level; + WSContentSend_P(PSTR("

%s (%s)

")); } - page += FPSTR(HTTP_FORM_LOG3); - page.replace(F("{l2"), Settings.syslog_host); - page.replace(F("{l3"), String(Settings.syslog_port)); - page.replace(F("{l4"), String(Settings.tele_period)); - page += FPSTR(HTTP_FORM_END); - page += FPSTR(HTTP_BTN_CONF); - ShowPage(page); + WSContentSend_P(HTTP_FORM_LOG2, Settings.syslog_host, Settings.syslog_port, Settings.tele_period); + WSContentSend_P(HTTP_FORM_END); + WSContentSpaceButton(BUTTON_CONFIGURATION); + WSContentStop(); } void LoggingSaveSettings(void) { - char tmp[100]; + char tmp[sizeof(Settings.syslog_host)]; // Max length is currently 33 - WebGetArg("ls", tmp, sizeof(tmp)); + WebGetArg("l0", tmp, sizeof(tmp)); Settings.seriallog_level = (!strlen(tmp)) ? SERIAL_LOG_LEVEL : atoi(tmp); - WebGetArg("lw", tmp, sizeof(tmp)); + WebGetArg("l1", tmp, sizeof(tmp)); Settings.weblog_level = (!strlen(tmp)) ? WEB_LOG_LEVEL : atoi(tmp); - WebGetArg("ll", tmp, sizeof(tmp)); + WebGetArg("l2", tmp, sizeof(tmp)); Settings.syslog_level = (!strlen(tmp)) ? SYS_LOG_LEVEL : atoi(tmp); syslog_level = Settings.syslog_level; syslog_timer = 0; @@ -1139,9 +1433,8 @@ void LoggingSaveSettings(void) if ((Settings.tele_period > 0) && (Settings.tele_period < 10)) { Settings.tele_period = 10; // Do not allow periods < 10 seconds } - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_LOG D_CMND_SERIALLOG " %d, " D_CMND_WEBLOG " %d, " D_CMND_SYSLOG " %d, " D_CMND_LOGHOST " %s, " D_CMND_LOGPORT " %d, " D_CMND_TELEPERIOD " %d"), + AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_LOG D_CMND_SERIALLOG " %d, " D_CMND_WEBLOG " %d, " D_CMND_SYSLOG " %d, " D_CMND_LOGHOST " %s, " D_CMND_LOGPORT " %d, " D_CMND_TELEPERIOD " %d"), Settings.seriallog_level, Settings.weblog_level, Settings.syslog_level, Settings.syslog_host, Settings.syslog_port, Settings.tele_period); - AddLog(LOG_LEVEL_INFO); } /*-------------------------------------------------------------------------------------------*/ @@ -1158,47 +1451,48 @@ void HandleOtherConfiguration(void) return; } - char stemp[40]; + WSContentStart_P(S_CONFIGURE_OTHER); + WSContentSendStyle(); - String page = FPSTR(HTTP_HEAD); - page.replace(F("{v}"), FPSTR(S_CONFIGURE_OTHER)); - page += FPSTR(HTTP_HEAD_STYLE); - page += FPSTR(HTTP_FORM_OTHER); TemplateJson(); - page.replace(F("{t1"), mqtt_data); - page.replace(F("{r1"), (Settings.flag.mqtt_enabled) ? F(" checked") : F("")); + char stemp[strlen(mqtt_data) +1]; + strlcpy(stemp, mqtt_data, sizeof(stemp)); // Get JSON template + WSContentSend_P(HTTP_FORM_OTHER, stemp, (USER_MODULE == Settings.module) ? " checked disabled" : "", (Settings.flag.mqtt_enabled) ? " checked" : ""); uint8_t maxfn = (devices_present > MAX_FRIENDLYNAMES) ? MAX_FRIENDLYNAMES : (!devices_present) ? 1 : devices_present; if (SONOFF_IFAN02 == my_module_type) { maxfn = 1; } for (uint8_t i = 0; i < maxfn; i++) { - page += FPSTR(HTTP_FORM_OTHER2); - page.replace(F("{1"), String(i +1)); - snprintf_P(stemp, sizeof(stemp), PSTR(FRIENDLY_NAME"%d"), i +1); - page.replace(F("{2"), (i) ? stemp : FRIENDLY_NAME); - page.replace(F("{3"), Settings.friendlyname[i]); + snprintf_P(stemp, sizeof(stemp), PSTR("%d"), i +1); + WSContentSend_P(PSTR("" D_FRIENDLY_NAME " %d (" FRIENDLY_NAME "%s)

"), + i +1, + (i) ? stemp : "", + i, i, + (i) ? stemp : "", + Settings.friendlyname[i]); } + #ifdef USE_EMULATION - page += FPSTR(HTTP_FORM_OTHER3a); + WSContentSend_P(PSTR("

 " D_EMULATION " 

")); // Keep close to Friendlynames so do not use
for (uint8_t i = 0; i < EMUL_MAX; i++) { - page += FPSTR(HTTP_FORM_OTHER3b); - page.replace(F("{1"), String(i)); - page.replace(F("{2"), (i == Settings.flag2.emulation) ? F(" checked") : F("")); - page.replace(F("{3"), (i == EMUL_NONE) ? F(D_NONE) : (i == EMUL_WEMO) ? F(D_BELKIN_WEMO) : F(D_HUE_BRIDGE)); - page.replace(F("{4"), (i == EMUL_NONE) ? F("") : (i == EMUL_WEMO) ? F(" " D_SINGLE_DEVICE) : F(" " D_MULTI_DEVICE)); + WSContentSend_P(PSTR("%s %s
"), // Different id only used for labels + i, i, + (i == Settings.flag2.emulation) ? " checked" : "", + GetTextIndexed(stemp, sizeof(stemp), i, kEmulationOptions), + (i == EMUL_NONE) ? "" : (i == EMUL_WEMO) ? D_SINGLE_DEVICE : D_MULTI_DEVICE); } - page += F("
"); - page += F("

"); + WSContentSend_P(PSTR("

")); #endif // USE_EMULATION - page += FPSTR(HTTP_FORM_END); - page += FPSTR(HTTP_BTN_CONF); - ShowPage(page); + + WSContentSend_P(HTTP_FORM_END); + WSContentSpaceButton(BUTTON_CONFIGURATION); + WSContentStop(); } void OtherSaveSettings(void) { char tmp[128]; - char stemp[TOPSZ]; - char stemp2[TOPSZ]; + char webindex[5]; + char friendlyname[sizeof(Settings.friendlyname[0])]; WebGetArg("p1", tmp, sizeof(tmp)); strlcpy(Settings.web_password, (!strlen(tmp)) ? "" : (strchr(tmp,'*')) ? Settings.web_password : tmp, sizeof(Settings.web_password)); @@ -1209,10 +1503,10 @@ void OtherSaveSettings(void) #endif // USE_EMULATION snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_OTHER D_MQTT_ENABLE " %s, " D_CMND_EMULATION " %d, " D_CMND_FRIENDLYNAME), GetStateText(Settings.flag.mqtt_enabled), Settings.flag2.emulation); for (uint8_t i = 0; i < MAX_FRIENDLYNAMES; i++) { - snprintf_P(stemp, sizeof(stemp), PSTR("a%d"), i +1); - WebGetArg(stemp, tmp, sizeof(tmp)); - snprintf_P(stemp2, sizeof(stemp2), PSTR(FRIENDLY_NAME"%d"), i +1); - strlcpy(Settings.friendlyname[i], (!strlen(tmp)) ? (i) ? stemp2 : FRIENDLY_NAME : tmp, sizeof(Settings.friendlyname[i])); + snprintf_P(webindex, sizeof(webindex), PSTR("a%d"), i); + WebGetArg(webindex, tmp, sizeof(tmp)); + snprintf_P(friendlyname, sizeof(friendlyname), PSTR(FRIENDLY_NAME"%d"), i +1); + strlcpy(Settings.friendlyname[i], (!strlen(tmp)) ? (i) ? friendlyname : FRIENDLY_NAME : tmp, sizeof(Settings.friendlyname[i])); snprintf_P(log_data, sizeof(log_data), PSTR("%s%s %s"), log_data, (i) ? "," : "", Settings.friendlyname[i]); } AddLog(LOG_LEVEL_INFO); @@ -1221,6 +1515,12 @@ void OtherSaveSettings(void) char svalue[128]; snprintf_P(svalue, sizeof(svalue), PSTR(D_CMND_TEMPLATE " %s"), tmp); ExecuteWebCommand(svalue, SRC_WEBGUI); + + if (WebServer->hasArg("t2")) { + snprintf_P(svalue, sizeof(svalue), PSTR(D_CMND_MODULE " 0")); + ExecuteWebCommand(svalue, SRC_WEBGUI); + } + } } @@ -1242,7 +1542,7 @@ void HandleBackupConfiguration(void) snprintf_P(attachment, sizeof(attachment), PSTR("attachment; filename=Config_%s_%s.dmp"), NoAlNumToUnderscore(friendlyname, Settings.friendlyname[0]), my_version); WebServer->sendHeader(F("Content-Disposition"), attachment); - WebServer->send(200, FPSTR(HDR_CTYPE_STREAM), ""); + WSSend(200, CT_STREAM, ""); uint16_t cfg_crc = Settings.cfg_crc; Settings.cfg_crc = GetSettingsCrc(); // Calculate crc (again) as it might be wrong when savedata = 0 (#3918) @@ -1272,22 +1572,20 @@ void HandleBackupConfiguration(void) void HandleResetConfiguration(void) { - if (!HttpCheckPriviledgedAccess()) { return; } - - char svalue[33]; + if (!HttpCheckPriviledgedAccess(!WifiIsInManagerMode())) { return; } AddLog_P(LOG_LEVEL_DEBUG, S_LOG_HTTP, S_RESET_CONFIGURATION); - String page = FPSTR(HTTP_HEAD); - page.replace(F("{v}"), FPSTR(S_RESET_CONFIGURATION)); - page += FPSTR(HTTP_HEAD_STYLE); - page += F("
" D_CONFIGURATION_RESET "
"); - page += FPSTR(HTTP_MSG_RSTRT); - page += FPSTR(HTTP_BTN_MAIN); - ShowPage(page); + WSContentStart_P(S_RESET_CONFIGURATION, !WifiIsInManagerMode()); + WSContentSendStyle(); + WSContentSend_P(PSTR("
" D_CONFIGURATION_RESET "
")); + WSContentSend_P(HTTP_MSG_RSTRT); + WSContentSpaceButton(BUTTON_MAIN); + WSContentStop(); - snprintf_P(svalue, sizeof(svalue), PSTR(D_CMND_RESET " 1")); - ExecuteWebCommand(svalue, SRC_WEBGUI); + char command[CMDSZ]; + snprintf_P(command, sizeof(command), PSTR(D_CMND_RESET " 1")); + ExecuteWebCommand(command, SRC_WEBGUI); } void HandleRestoreConfiguration(void) @@ -1296,14 +1594,12 @@ void HandleRestoreConfiguration(void) AddLog_P(LOG_LEVEL_DEBUG, S_LOG_HTTP, S_RESTORE_CONFIGURATION); - String page = FPSTR(HTTP_HEAD); - page.replace(F("{v}"), FPSTR(S_RESTORE_CONFIGURATION)); - page += FPSTR(HTTP_HEAD_STYLE); - page += FPSTR(HTTP_FORM_RST); - page += FPSTR(HTTP_FORM_RST_UPG); - page.replace(F("{r1"), F(D_RESTORE)); - page += FPSTR(HTTP_BTN_CONF); - ShowPage(page); + WSContentStart_P(S_RESTORE_CONFIGURATION); + WSContentSendStyle(); + WSContentSend_P(HTTP_FORM_RST); + WSContentSend_P(HTTP_FORM_RST_UPG, D_RESTORE); + WSContentSpaceButton(BUTTON_CONFIGURATION); + WSContentStop(); upload_error = 0; upload_file_type = UPL_SETTINGS; @@ -1321,114 +1617,91 @@ void HandleInformation(void) int freeMem = ESP.getFreeHeap(); - String page = FPSTR(HTTP_HEAD); - page.replace(F("{v}"), FPSTR(S_INFORMATION)); - page += FPSTR(HTTP_HEAD_STYLE); - // page += F("
 Information "); - - page += F(""); - page += F("
"); - + WSContentStart_P(S_INFORMATION); // Save 1k of code space replacing table html with javascript replace codes // }1 = // }2 = - String func = FPSTR(HTTP_SCRIPT_INFO_BEGIN); - func += F("
"); - func += F(D_PROGRAM_VERSION "}2"); func += my_version; func += my_image; - func += F("}1" D_BUILD_DATE_AND_TIME "}2"); func += GetBuildDateAndTime(); - func += F("}1" D_CORE_AND_SDK_VERSION "}2" ARDUINO_ESP8266_RELEASE "/"); func += String(ESP.getSdkVersion()); - func += F("}1" D_UPTIME "}2"); func += GetUptime(); - snprintf_P(stopic, sizeof(stopic), PSTR(" at 0x%X"), GetSettingsAddress()); - func += F("}1" D_FLASH_WRITE_COUNT "}2"); func += String(Settings.save_flag); func += stopic; - func += F("}1" D_BOOT_COUNT "}2"); func += String(Settings.bootcount); - func += F("}1" D_RESTART_REASON "}2"); func += GetResetReason(); + WSContentSend_P(HTTP_SCRIPT_INFO_BEGIN); + WSContentSend_P(PSTR("
")); + WSContentSend_P(PSTR(D_PROGRAM_VERSION "}2%s%s"), my_version, my_image); + WSContentSend_P(PSTR("}1" D_BUILD_DATE_AND_TIME "}2%s"), GetBuildDateAndTime().c_str()); + WSContentSend_P(PSTR("}1" D_CORE_AND_SDK_VERSION "}2" ARDUINO_ESP8266_RELEASE "/%s"), ESP.getSdkVersion()); + WSContentSend_P(PSTR("}1" D_UPTIME "}2%s"), GetUptime().c_str()); + WSContentSend_P(PSTR("}1" D_FLASH_WRITE_COUNT "}2%d at 0x%X"), Settings.save_flag, GetSettingsAddress()); + WSContentSend_P(PSTR("}1" D_BOOT_COUNT "}2%d"), Settings.bootcount); + WSContentSend_P(PSTR("}1" D_RESTART_REASON "}2%s"), GetResetReason().c_str()); uint8_t maxfn = (devices_present > MAX_FRIENDLYNAMES) ? MAX_FRIENDLYNAMES : devices_present; if (SONOFF_IFAN02 == my_module_type) { maxfn = 1; } for (uint8_t i = 0; i < maxfn; i++) { - func += F("}1" D_FRIENDLY_NAME " "); func += i +1; func += F("}2"); func += Settings.friendlyname[i]; + WSContentSend_P(PSTR("}1" D_FRIENDLY_NAME " %d}2%s"), i +1, Settings.friendlyname[i]); } - - func += F("}1}2 "); // Empty line - func += F("}1" D_AP); func += String(Settings.sta_active +1); - func += F(" " D_SSID " (" D_RSSI ")}2"); func += Settings.sta_ssid[Settings.sta_active]; func += F(" ("); func += WifiGetRssiAsQuality(WiFi.RSSI()); func += F("%)"); - func += F("}1" D_HOSTNAME "}2"); func += my_hostname; - if (mdns_begun) { func += F(".local"); } + WSContentSend_P(PSTR("}1}2 ")); // Empty line + WSContentSend_P(PSTR("}1" D_AP "%d " D_SSID " (" D_RSSI ")}2%s (%d%%)"), Settings.sta_active +1, Settings.sta_ssid[Settings.sta_active], WifiGetRssiAsQuality(WiFi.RSSI())); + WSContentSend_P(PSTR("}1" D_HOSTNAME "}2%s%s"), my_hostname, (mdns_begun) ? ".local" : ""); if (static_cast(WiFi.localIP()) != 0) { - func += F("}1" D_IP_ADDRESS "}2"); func += WiFi.localIP().toString(); - func += F("}1" D_GATEWAY "}2"); func += IPAddress(Settings.ip_address[1]).toString(); - func += F("}1" D_SUBNET_MASK "}2"); func += IPAddress(Settings.ip_address[2]).toString(); - func += F("}1" D_DNS_SERVER "}2"); func += IPAddress(Settings.ip_address[3]).toString(); - func += F("}1" D_MAC_ADDRESS "}2"); func += WiFi.macAddress(); + WSContentSend_P(PSTR("}1" D_IP_ADDRESS "}2%s"), WiFi.localIP().toString().c_str()); + WSContentSend_P(PSTR("}1" D_GATEWAY "}2%s"), IPAddress(Settings.ip_address[1]).toString().c_str()); + WSContentSend_P(PSTR("}1" D_SUBNET_MASK "}2%s"), IPAddress(Settings.ip_address[2]).toString().c_str()); + WSContentSend_P(PSTR("}1" D_DNS_SERVER "}2%s"), IPAddress(Settings.ip_address[3]).toString().c_str()); + WSContentSend_P(PSTR("}1" D_MAC_ADDRESS "}2%s"), WiFi.macAddress().c_str()); } if (static_cast(WiFi.softAPIP()) != 0) { - func += F("}1" D_AP " " D_IP_ADDRESS "}2"); func += WiFi.softAPIP().toString(); - func += F("}1" D_AP " " D_GATEWAY "}2"); func += WiFi.softAPIP().toString(); - func += F("}1" D_AP " " D_MAC_ADDRESS "}2"); func += WiFi.softAPmacAddress(); + WSContentSend_P(PSTR("}1" D_IP_ADDRESS "}2%s"), WiFi.softAPIP().toString().c_str()); + WSContentSend_P(PSTR("}1" D_GATEWAY "}2%s"), WiFi.softAPIP().toString().c_str()); + WSContentSend_P(PSTR("}1" D_MAC_ADDRESS "}2%s"), WiFi.softAPmacAddress().c_str()); } - - func += F("}1}2 "); // Empty line + WSContentSend_P(PSTR("}1}2 ")); // Empty line if (Settings.flag.mqtt_enabled) { - func += F("}1" D_MQTT_HOST "}2"); func += Settings.mqtt_host; - func += F("}1" D_MQTT_PORT "}2"); func += String(Settings.mqtt_port); - func += F("}1" D_MQTT_USER "}2"); func += Settings.mqtt_user; - func += F("}1" D_MQTT_CLIENT "}2"); func += mqtt_client; - func += F("}1" D_MQTT_TOPIC "}2"); func += Settings.mqtt_topic; - func += F("}1" D_MQTT_GROUP_TOPIC "}2"); func += Settings.mqtt_grptopic; - func += F("}1" D_MQTT_FULL_TOPIC "}2"); func += GetTopic_P(stopic, CMND, mqtt_topic, ""); - func += F("}1" D_MQTT " " D_FALLBACK_TOPIC "}2"); func += GetFallbackTopic_P(stopic, CMND, ""); + WSContentSend_P(PSTR("}1" D_MQTT_HOST "}2%s"), Settings.mqtt_host); + WSContentSend_P(PSTR("}1" D_MQTT_PORT "}2%d"), Settings.mqtt_port); + WSContentSend_P(PSTR("}1" D_MQTT_USER "}2%s"), Settings.mqtt_user); + WSContentSend_P(PSTR("}1" D_MQTT_CLIENT "}2%s"), mqtt_client); + WSContentSend_P(PSTR("}1" D_MQTT_TOPIC "}2%s"), Settings.mqtt_topic); + WSContentSend_P(PSTR("}1" D_MQTT_GROUP_TOPIC "}2%s"), Settings.mqtt_grptopic); + WSContentSend_P(PSTR("}1" D_MQTT_FULL_TOPIC "}2%s"), GetTopic_P(stopic, CMND, mqtt_topic, "")); + WSContentSend_P(PSTR("}1" D_MQTT " " D_FALLBACK_TOPIC "}2%s"), GetFallbackTopic_P(stopic, CMND, "")); } else { - func += F("}1" D_MQTT "}2" D_DISABLED); + WSContentSend_P(PSTR("}1" D_MQTT "}2" D_DISABLED)); } + WSContentSend_P(PSTR("}1}2 ")); // Empty line - func += F("}1}2 "); // Empty line - func += F("}1" D_EMULATION "}2"); #ifdef USE_EMULATION - if (EMUL_WEMO == Settings.flag2.emulation) { - func += F(D_BELKIN_WEMO); - } - else if (EMUL_HUE == Settings.flag2.emulation) { - func += F(D_HUE_BRIDGE); - } - else { - func += F(D_NONE); - } + WSContentSend_P(PSTR("}1" D_EMULATION "}2%s"), GetTextIndexed(stopic, sizeof(stopic), Settings.flag2.emulation, kEmulationOptions)); #else - func += F(D_DISABLED); + WSContentSend_P(PSTR("}1" D_EMULATION "}2" D_DISABLED)); #endif // USE_EMULATION - func += F("}1" D_MDNS_DISCOVERY "}2"); + #ifdef USE_DISCOVERY + WSContentSend_P(PSTR("}1" D_MDNS_DISCOVERY "}2%s"), (Settings.flag3.mdns_enabled) ? D_ENABLED : D_DISABLED); if (Settings.flag3.mdns_enabled) { - func += F(D_ENABLED); - func += F("}1" D_MDNS_ADVERTISE "}2"); #ifdef WEBSERVER_ADVERTISE - func += F(D_WEB_SERVER); + WSContentSend_P(PSTR("}1" D_MDNS_ADVERTISE "}2" D_WEB_SERVER)); #else - func += F(D_DISABLED); + WSContentSend_P(PSTR("}1" D_MDNS_ADVERTISE "}2" D_DISABLED)); #endif // WEBSERVER_ADVERTISE - } else { - func += F(D_DISABLED); } #else - func += F(D_DISABLED); + WSContentSend_P(PSTR("}1" D_MDNS_DISCOVERY "}2" D_DISABLED)); #endif // USE_DISCOVERY - func += F("}1}2 "); // Empty line - func += F("}1" D_ESP_CHIP_ID "}2"); func += String(ESP.getChipId()); - snprintf_P(stopic, sizeof(stopic), PSTR("0x%06X"), ESP.getFlashChipId()); - func += F("}1" D_FLASH_CHIP_ID "}2"); func += stopic; - func += F("}1" D_FLASH_CHIP_SIZE "}2"); func += String(ESP.getFlashChipRealSize() / 1024); func += F("kB"); - func += F("}1" D_PROGRAM_FLASH_SIZE "}2"); func += String(ESP.getFlashChipSize() / 1024); func += F("kB"); - func += F("}1" D_PROGRAM_SIZE "}2"); func += String(ESP.getSketchSize() / 1024); func += F("kB"); - func += F("}1" D_FREE_PROGRAM_SPACE "}2"); func += String(ESP.getFreeSketchSpace() / 1024); func += F("kB"); - func += F("}1" D_FREE_MEMORY "}2"); func += String(freeMem / 1024); func += F("kB"); - func += F("
"); - func += FPSTR(HTTP_SCRIPT_INFO_END); - page.replace(F(""), func); - page.replace(F(""), F("")); + WSContentSend_P(PSTR("}1}2 ")); // Empty line + WSContentSend_P(PSTR("}1" D_ESP_CHIP_ID "}2%d"), ESP.getChipId()); + WSContentSend_P(PSTR("}1" D_FLASH_CHIP_ID "}20x%06X"), ESP.getFlashChipId()); + WSContentSend_P(PSTR("}1" D_FLASH_CHIP_SIZE "}2%dkB"), ESP.getFlashChipRealSize() / 1024); + WSContentSend_P(PSTR("}1" D_PROGRAM_FLASH_SIZE "}2%dkB"), ESP.getFlashChipSize() / 1024); + WSContentSend_P(PSTR("}1" D_PROGRAM_SIZE "}2%dkB"), ESP.getSketchSize() / 1024); + WSContentSend_P(PSTR("}1" D_FREE_PROGRAM_SPACE "}2%dkB"), ESP.getFreeSketchSpace() / 1024); + WSContentSend_P(PSTR("}1" D_FREE_MEMORY "}2%dkB"), freeMem / 1024); + WSContentSend_P(PSTR("
")); - // page += F("
"); - page += FPSTR(HTTP_BTN_MAIN); - ShowPage(page); + WSContentSend_P(HTTP_SCRIPT_INFO_END); + WSContentSendStyle(); + // WSContentSend_P(PSTR("
 Information ")); + WSContentSend_P(PSTR("" + "
")); + // WSContentSend_P(PSTR("
")); + WSContentSpaceButton(BUTTON_MAIN); + WSContentStop(); } #endif // Not FIRMWARE_MINIMAL @@ -1440,15 +1713,12 @@ void HandleUpgradeFirmware(void) AddLog_P(LOG_LEVEL_DEBUG, S_LOG_HTTP, S_FIRMWARE_UPGRADE); - String page = FPSTR(HTTP_HEAD); - page.replace(F("{v}"), FPSTR(S_FIRMWARE_UPGRADE)); - page += FPSTR(HTTP_HEAD_STYLE); - page += FPSTR(HTTP_FORM_UPG); - page.replace(F("{o1"), Settings.ota_url); - page += FPSTR(HTTP_FORM_RST_UPG); - page.replace(F("{r1"), F(D_UPGRADE)); - page += FPSTR(HTTP_BTN_MAIN); - ShowPage(page); + WSContentStart_P(S_FIRMWARE_UPGRADE); + WSContentSendStyle(); + WSContentSend_P(HTTP_FORM_UPG, Settings.ota_url); + WSContentSend_P(HTTP_FORM_RST_UPG, D_UPGRADE); + WSContentSpaceButton(BUTTON_MAIN); + WSContentStop(); upload_error = 0; upload_file_type = UPL_TASMOTA; @@ -1458,29 +1728,28 @@ void HandleUpgradeFirmwareStart(void) { if (!HttpCheckPriviledgedAccess()) { return; } - char svalue[100]; + char command[sizeof(Settings.ota_url) + 10]; // OtaUrl AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_UPGRADE_STARTED)); WifiConfigCounter(); - char tmp[100]; - WebGetArg("o", tmp, sizeof(tmp)); - if (strlen(tmp)) { - snprintf_P(svalue, sizeof(svalue), PSTR(D_CMND_OTAURL " %s"), tmp); - ExecuteWebCommand(svalue, SRC_WEBGUI); + char otaurl[sizeof(Settings.ota_url)]; + WebGetArg("o", otaurl, sizeof(otaurl)); + if (strlen(otaurl)) { + snprintf_P(command, sizeof(command), PSTR(D_CMND_OTAURL " %s"), otaurl); + ExecuteWebCommand(command, SRC_WEBGUI); } - String page = FPSTR(HTTP_HEAD); - page.replace(F("{v}"), FPSTR(S_INFORMATION)); - page += FPSTR(HTTP_HEAD_STYLE); - page += F("
" D_UPGRADE_STARTED " ...
"); - page += FPSTR(HTTP_MSG_RSTRT); - page += FPSTR(HTTP_BTN_MAIN); - page.replace(F(""), FPSTR(HTTP_SCRIPT_RELOAD_OTA)); - ShowPage(page); + WSContentStart_P(S_INFORMATION); + WSContentSend_P(HTTP_SCRIPT_RELOAD_OTA); + WSContentSendStyle(); + WSContentSend_P(PSTR("
" D_UPGRADE_STARTED " ...
")); + WSContentSend_P(HTTP_MSG_RSTRT); + WSContentSpaceButton(BUTTON_MAIN); + WSContentStop(); - snprintf_P(svalue, sizeof(svalue), PSTR(D_CMND_UPGRADE " 1")); - ExecuteWebCommand(svalue, SRC_WEBGUI); + snprintf_P(command, sizeof(command), PSTR(D_CMND_UPGRADE " 1")); + ExecuteWebCommand(command, SRC_WEBGUI); } void HandleUploadDone(void) @@ -1495,46 +1764,36 @@ void HandleUploadDone(void) restart_flag = 0; MqttRetryCounter(0); - String page = FPSTR(HTTP_HEAD); - page.replace(F("{v}"), FPSTR(S_INFORMATION)); - page += FPSTR(HTTP_HEAD_STYLE); - page += F("
" D_UPLOAD " " D_UPLOAD " " D_FAILED "

"); - switch (upload_error) { - case 1: strncpy_P(error, PSTR(D_UPLOAD_ERR_1), sizeof(error)); break; - case 2: strncpy_P(error, PSTR(D_UPLOAD_ERR_2), sizeof(error)); break; - case 3: strncpy_P(error, PSTR(D_UPLOAD_ERR_3), sizeof(error)); break; - case 4: strncpy_P(error, PSTR(D_UPLOAD_ERR_4), sizeof(error)); break; - case 5: strncpy_P(error, PSTR(D_UPLOAD_ERR_5), sizeof(error)); break; - case 6: strncpy_P(error, PSTR(D_UPLOAD_ERR_6), sizeof(error)); break; - case 7: strncpy_P(error, PSTR(D_UPLOAD_ERR_7), sizeof(error)); break; - case 8: strncpy_P(error, PSTR(D_UPLOAD_ERR_8), sizeof(error)); break; - case 9: strncpy_P(error, PSTR(D_UPLOAD_ERR_9), sizeof(error)); break; + WSContentSend_P(PSTR("red'>" D_FAILED "


")); #ifdef USE_RF_FLASH - case 10: strncpy_P(error, PSTR(D_UPLOAD_ERR_10), sizeof(error)); break; - case 11: strncpy_P(error, PSTR(D_UPLOAD_ERR_11), sizeof(error)); break; - case 12: strncpy_P(error, PSTR(D_UPLOAD_ERR_12), sizeof(error)); break; - case 13: strncpy_P(error, PSTR(D_UPLOAD_ERR_13), sizeof(error)); break; + if (upload_error < 14) { +#else + if (upload_error < 10) { #endif - default: - snprintf_P(error, sizeof(error), PSTR(D_UPLOAD_ERROR_CODE " %d"), upload_error); + GetTextIndexed(error, sizeof(error), upload_error -1, kUploadErrors); + } else { + snprintf_P(error, sizeof(error), PSTR(D_UPLOAD_ERROR_CODE " %d"), upload_error); } - page += error; - snprintf_P(log_data, sizeof(log_data), PSTR(D_UPLOAD ": %s"), error); - AddLog(LOG_LEVEL_DEBUG); + WSContentSend_P(error); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_UPLOAD ": %s"), error); stop_flash_rotate = Settings.flag.stop_flash_rotate; } else { - page += F("green'>" D_SUCCESSFUL "
"); - page += FPSTR(HTTP_MSG_RSTRT); - page.replace(F(""), FPSTR(HTTP_SCRIPT_RELOAD_OTA)); // Refesh main web ui after OTA upgrade + WSContentSend_P(PSTR("green'>" D_SUCCESSFUL "
")); + WSContentSend_P(HTTP_MSG_RSTRT); ShowWebSource(SRC_WEBGUI); restart_flag = 2; // Always restart to re-enable disabled features during update } SettingsBufferFree(); - page += F("

"); - page += FPSTR(HTTP_BTN_MAIN); - ShowPage(page); + WSContentSend_P(PSTR("
")); + WSContentSpaceButton(BUTTON_MAIN); + WSContentStop(); } void HandleUploadLoop(void) @@ -1557,8 +1816,7 @@ void HandleUploadLoop(void) return; } SettingsSave(1); // Free flash for upload - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_UPLOAD D_FILE " %s ..."), upload.filename.c_str()); - AddLog(LOG_LEVEL_INFO); + AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_UPLOAD D_FILE " %s ..."), upload.filename.c_str()); if (UPL_SETTINGS == upload_file_type) { if (!SettingsBufferAlloc()) { upload_error = 2; // Not enough space @@ -1627,10 +1885,10 @@ void HandleUploadLoop(void) } #ifdef USE_RF_FLASH else if (UPL_EFM8BB1 == upload_file_type) { - if (efm8bb1_update != NULL) { // We have carry over data since last write, i. e. a start but not an end + if (efm8bb1_update != nullptr) { // We have carry over data since last write, i. e. a start but not an end ssize_t result = rf_glue_remnant_with_new_data_and_write(efm8bb1_update, upload.buf, upload.currentSize); free(efm8bb1_update); - efm8bb1_update = NULL; + efm8bb1_update = nullptr; if (result != 0) { upload_error = abs(result); // 2 = Not enough space, 8 = File invalid return; @@ -1649,7 +1907,7 @@ void HandleUploadLoop(void) // A remnant has been detected, allocate data for it plus a null termination byte size_t remnant_sz = upload.currentSize - result; efm8bb1_update = (uint8_t *) malloc(remnant_sz + 1); - if (efm8bb1_update == NULL) { + if (efm8bb1_update == nullptr) { upload_error = 2; // Not enough space - Unable to allocate memory to store new RF firmware return; } @@ -1717,8 +1975,7 @@ void HandleUploadLoop(void) } } if (!upload_error) { - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_UPLOAD D_SUCCESSFUL " %u bytes. " D_RESTARTING), upload.totalSize); - AddLog(LOG_LEVEL_INFO); + AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_UPLOAD D_SUCCESSFUL " %u bytes. " D_RESTARTING), upload.totalSize); } } else if (UPLOAD_FILE_ABORTED == upload.status) { restart_flag = 0; @@ -1736,7 +1993,7 @@ void HandlePreflightRequest(void) WebServer->sendHeader(F("Access-Control-Allow-Origin"), F("*")); WebServer->sendHeader(F("Access-Control-Allow-Methods"), F("GET, POST")); WebServer->sendHeader(F("Access-Control-Allow-Headers"), F("authorization")); - WebServer->send(200, FPSTR(HDR_CTYPE_HTML), ""); + WSSend(200, CT_HTML, ""); } /*-------------------------------------------------------------------------------------------*/ @@ -1745,29 +2002,27 @@ void HandleHttpCommand(void) { if (!HttpCheckPriviledgedAccess(false)) { return; } - char svalue[INPUT_BUFFER_SIZE]; // Large to serve Backlog - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_COMMAND)); uint8_t valid = 1; if (Settings.web_password[0] != 0) { - char tmp1[100]; + char tmp1[sizeof(Settings.web_password)]; WebGetArg("user", tmp1, sizeof(tmp1)); - char tmp2[100]; + char tmp2[sizeof(Settings.web_password)]; WebGetArg("password", tmp2, sizeof(tmp2)); if (!(!strcmp(tmp1, WEB_USERNAME) && !strcmp(tmp2, Settings.web_password))) { valid = 0; } } - String message = F("{\"" D_RSLT_WARNING "\":\""); + WSContentBegin(200, CT_JSON); if (valid) { uint8_t curridx = web_log_index; - WebGetArg("cmnd", svalue, sizeof(svalue)); - if (strlen(svalue)) { - ExecuteWebCommand(svalue, SRC_WEBCOMMAND); - + String svalue = WebServer->arg("cmnd"); + if (svalue.length() && (svalue.length() < INPUT_BUFFER_SIZE)) { + ExecuteWebCommand((char*)svalue.c_str(), SRC_WEBCOMMAND); if (web_log_index != curridx) { uint8_t counter = curridx; - message = F("{"); + WSContentSend_P(PSTR("{")); + bool cflg = false; do { char* tmp; size_t len; @@ -1776,27 +2031,28 @@ void HandleHttpCommand(void) // [14:49:36 MQTT: stat/wemos5/RESULT = {"POWER":"OFF"}] > [{"POWER":"OFF"}] char* JSON = (char*)memchr(tmp, '{', len); if (JSON) { // Is it a JSON message (and not only [15:26:08 MQT: stat/wemos5/POWER = O]) - if (message.length() > 1) { message += F(","); } size_t JSONlen = len - (JSON - tmp); - strlcpy(mqtt_data, JSON +1, JSONlen -2); - message += mqtt_data; + if (JSONlen > sizeof(mqtt_data)) { JSONlen = sizeof(mqtt_data); } + char stemp[JSONlen]; + strlcpy(stemp, JSON +1, JSONlen -2); + WSContentSend_P(PSTR("%s%s"), (cflg) ? "," : "", stemp); + cflg = true; } } counter++; if (!counter) counter++; // Skip 0 as it is not allowed } while (counter != web_log_index); - message += F("}"); + WSContentSend_P(PSTR("}")); } else { - message += F(D_ENABLE_WEBLOG_FOR_RESPONSE "\"}"); + WSContentSend_P(PSTR("{\"" D_RSLT_WARNING "\":\"" D_ENABLE_WEBLOG_FOR_RESPONSE "\"}")); } } else { - message += F(D_ENTER_COMMAND " cmnd=\"}"); + WSContentSend_P(PSTR("{\"" D_RSLT_WARNING "\":\"" D_ENTER_COMMAND " cmnd=\"}")); } } else { - message += F(D_NEED_USER_AND_PASSWORD "\"}"); + WSContentSend_P(PSTR("{\"" D_RSLT_WARNING "\":\"" D_NEED_USER_AND_PASSWORD "\"}")); } - SetHeader(); - WebServer->send(200, FPSTR(HDR_CTYPE_JSON), message); + WSContentEnd(); } /*-------------------------------------------------------------------------------------------*/ @@ -1805,40 +2061,38 @@ void HandleConsole(void) { if (!HttpCheckPriviledgedAccess()) { return; } + if (WebServer->hasArg("c2")) { // Console refresh requested + HandleConsoleRefresh(); + return; + } + AddLog_P(LOG_LEVEL_DEBUG, S_LOG_HTTP, S_CONSOLE); - String page = FPSTR(HTTP_HEAD); - page.replace(F("{v}"), FPSTR(S_CONSOLE)); - page += FPSTR(HTTP_HEAD_STYLE); - page.replace(F(""), FPSTR(HTTP_SCRIPT_CONSOL)); - page.replace(F(""), F("")); - page += FPSTR(HTTP_FORM_CMND); - page += FPSTR(HTTP_BTN_MAIN); - ShowPage(page); + WSContentStart_P(S_CONSOLE); + WSContentSend_P(HTTP_SCRIPT_CONSOL, Settings.web_refresh); + WSContentSendStyle(); + WSContentSend_P(HTTP_FORM_CMND); + WSContentSpaceButton(BUTTON_MAIN); + WSContentStop(); } -void HandleAjaxConsoleRefresh(void) +void HandleConsoleRefresh(void) { - if (!HttpCheckPriviledgedAccess()) { return; } - - char svalue[INPUT_BUFFER_SIZE]; // Large to serve Backlog bool cflg = true; uint8_t counter = 0; // Initial start, should never be 0 again - WebGetArg("c1", svalue, sizeof(svalue)); - if (strlen(svalue)) { - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_COMMAND "%s"), svalue); - AddLog(LOG_LEVEL_INFO); - ExecuteWebCommand(svalue, SRC_WEBCONSOLE); + String svalue = WebServer->arg("c1"); + if (svalue.length() && (svalue.length() < INPUT_BUFFER_SIZE)) { + AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_COMMAND "%s"), svalue.c_str()); + ExecuteWebCommand((char*)svalue.c_str(), SRC_WEBCONSOLE); } - WebGetArg("c2", svalue, sizeof(svalue)); - if (strlen(svalue)) { counter = atoi(svalue); } + char stmp[8]; + WebGetArg("c2", stmp, sizeof(stmp)); + if (strlen(stmp)) { counter = atoi(stmp); } - bool last_reset_web_log_flag = reset_web_log_flag; - // mqtt_data used as scratch space - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%d\1%d\1"), web_log_index, last_reset_web_log_flag); - String message = mqtt_data; + WSContentBegin(200, CT_PLAIN); + WSContentSend_P(PSTR("%d}1%d}1"), web_log_index, reset_web_log_flag); if (!reset_web_log_flag) { counter = 0; reset_web_log_flag = true; @@ -1853,28 +2107,25 @@ void HandleAjaxConsoleRefresh(void) size_t len; GetLog(counter, &tmp, &len); if (len) { - if (cflg) { - message += F("\n"); - } else { - cflg = true; - } - strlcpy(mqtt_data, tmp, len); - message += mqtt_data; // mqtt_data used as scratch space + if (len > sizeof(mqtt_data) -2) { len = sizeof(mqtt_data); } + char stemp[len +1]; + strlcpy(stemp, tmp, len); + WSContentSend_P(PSTR("%s%s"), (cflg) ? "\n" : "", stemp); + cflg = true; } counter++; - if (!counter) { counter++; } // Skip log index 0 as it is not allowed + if (!counter) { counter++; } // Skip log index 0 as it is not allowed } while (counter != web_log_index); } - message += F("\1"); - WebServer->send(200, FPSTR(HDR_CTYPE_XML), message); + WSContentSend_P(PSTR("}1")); + WSContentEnd(); } /********************************************************************************************/ void HandleNotFound(void) { -// snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_HTTP "Not fount (%s)"), WebServer->uri().c_str()); -// AddLog(LOG_LEVEL_DEBUG); +// AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP "Not fount (%s)"), WebServer->uri().c_str()); if (CaptivePortal()) { return; } // If captive portal redirect instead of displaying the error page. @@ -1885,40 +2136,30 @@ void HandleNotFound(void) } else #endif // USE_EMULATION { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR(D_FILE_NOT_FOUND "\n\nURI: %s\nMethod: %s\nArguments: %d\n"), - WebServer->uri().c_str(), (WebServer->method() == HTTP_GET) ? "GET" : "POST", WebServer->args()); + WSContentBegin(404, CT_PLAIN); + WSContentSend_P(PSTR(D_FILE_NOT_FOUND "\n\nURI: %s\nMethod: %s\nArguments: %d\n"), WebServer->uri().c_str(), (WebServer->method() == HTTP_GET) ? "GET" : "POST", WebServer->args()); for (uint8_t i = 0; i < WebServer->args(); i++) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s %s: %s\n"), mqtt_data, WebServer->argName(i).c_str(), WebServer->arg(i).c_str()); + WSContentSend_P(PSTR(" %s: %s\n"), WebServer->argName(i).c_str(), WebServer->arg(i).c_str()); } - SetHeader(); - WebServer->send(404, FPSTR(HDR_CTYPE_PLAIN), mqtt_data); + WSContentEnd(); } } /* Redirect to captive portal if we got a request for another domain. Return true in that case so the page handler do not try to handle the request again. */ bool CaptivePortal(void) { - if ((HTTP_MANAGER == webserver_state) && !ValidIpAddress(WebServer->hostHeader())) { + // Possible hostHeader: connectivitycheck.gstatic.com or 192.168.4.1 + if ((WifiIsInManagerMode()) && !ValidIpAddress(WebServer->hostHeader().c_str())) { AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_REDIRECTED)); WebServer->sendHeader(F("Location"), String("http://") + WebServer->client().localIP().toString(), true); - WebServer->send(302, FPSTR(HDR_CTYPE_PLAIN), ""); // Empty content inhibits Content-length header so we have to close the socket ourselves. + WSSend(302, CT_PLAIN, ""); // Empty content inhibits Content-length header so we have to close the socket ourselves. WebServer->client().stop(); // Stop is needed because we sent no content length return true; } return false; } -/** Is this an IP? */ -bool ValidIpAddress(String str) -{ - for (uint16_t i = 0; i < str.length(); i++) { - int c = str.charAt(i); - if (c != '.' && (c < '0' || c > '9')) { return false; } - } - return true; -} - /*********************************************************************************************/ String UrlEncode(const String& text) @@ -1957,90 +2198,76 @@ String UrlEncode(const String& text) int WebSend(char *buffer) { - /* [sonoff] POWER1 ON --> Sends http://sonoff/cm?cmnd=POWER1 ON - * [192.168.178.86:80,admin:joker] POWER1 ON --> Sends http://hostname:80/cm?user=admin&password=joker&cmnd=POWER1 ON - * [sonoff] /any/link/starting/with/a/slash.php?log=123 --> Sends http://sonoff/any/link/starting/with/a/slash.php?log=123 - * [sonoff,admin:joker] /any/link/starting/with/a/slash.php?log=123 --> Sends http://sonoff/any/link/starting/with/a/slash.php?log=123 - */ + // [sonoff] POWER1 ON --> Sends http://sonoff/cm?cmnd=POWER1 ON + // [192.168.178.86:80,admin:joker] POWER1 ON --> Sends http://hostname:80/cm?user=admin&password=joker&cmnd=POWER1 ON + // [sonoff] /any/link/starting/with/a/slash.php?log=123 --> Sends http://sonoff/any/link/starting/with/a/slash.php?log=123 + // [sonoff,admin:joker] /any/link/starting/with/a/slash.php?log=123 --> Sends http://sonoff/any/link/starting/with/a/slash.php?log=123 char *host; - char *port; char *user; char *password; char *command; - uint16_t nport = 80; int status = 1; // Wrong parameters // buffer = | [ 192.168.178.86 : 80 , admin : joker ] POWER1 ON | host = strtok_r(buffer, "]", &command); // host = | [ 192.168.178.86 : 80 , admin : joker |, command = | POWER1 ON | if (host && command) { - host = Trim(host); // host = |[ 192.168.178.86 : 80 , admin : joker| - host++; // host = | 192.168.178.86 : 80 , admin : joker| - Skip [ - host = strtok_r(host, ",", &user); // host = | 192.168.178.86 : 80 |, user = | admin : joker| - host = strtok_r(host, ":", &port); // host = | 192.168.178.86 |, port = | 80 | - host = Trim(host); // host = |192.168.178.86| - if (port) { - port = Trim(port); // port = |80| - nport = atoi(port); - } - if (user) { - user = strtok_r(user, ":", &password); // user = | admin |, password = | joker| - user = Trim(user); // user = |admin| - if (password) { password = Trim(password); } // password = |joker| - } + RemoveSpace(host); // host = |[192.168.178.86:80,admin:joker| + host++; // host = |192.168.178.86:80,admin:joker| - Skip [ + host = strtok_r(host, ",", &user); // host = |192.168.178.86:80|, user = |admin:joker| + String url = F("http://"); // url = |http://| + url += host; // url = |http://192.168.178.86:80| + command = Trim(command); // command = |POWER1 ON| or |/any/link/starting/with/a/slash.php?log=123| - - String nuri = ""; if (command[0] != '/') { - nuri = "/cm?"; - if (user && password) { - nuri += F("user="); - nuri += user; - nuri += F("&password="); - nuri += password; - nuri += F("&"); - } - nuri += F("cmnd="); - } - nuri += command; - String uri = UrlEncode(nuri); - - IPAddress host_ip; - if (WiFi.hostByName(host, host_ip)) { - WiFiClient client; - - bool connected = false; - uint8_t retry = 2; - while ((retry > 0) && !connected) { - --retry; - connected = client.connect(host_ip, nport); - if (connected) break; - } - - if (connected) { - String url = F("GET "); - url += uri; - url += F(" HTTP/1.1\r\nHost: "); -// url += IPAddress(host_ip).toString(); - url += host; // https://tools.ietf.org/html/rfc7230#section-5.4 (#4331) - if (port) { - url += F(":"); - url += port; + url += F("/cm?"); // url = |http://192.168.178.86/cm?| + if (user) { + user = strtok_r(user, ":", &password); // user = |admin|, password = |joker| + if (user && password) { + char userpass[128]; + snprintf_P(userpass, sizeof(userpass), PSTR("user=%s&password=%s&"), user, password); + url += userpass; // url = |http://192.168.178.86/cm?user=admin&password=joker&| } - url += F("\r\nConnection: close\r\n\r\n"); + } + url += F("cmnd="); // url = |http://192.168.178.86/cm?cmnd=| or |http://192.168.178.86/cm?user=admin&password=joker&cmnd=| + } + url += command; // url = |http://192.168.178.86/cm?cmnd=POWER1 ON| -//snprintf_P(log_data, sizeof(log_data), PSTR("DBG: Url |%s|"), url.c_str()); -//AddLog(LOG_LEVEL_DEBUG); +//AddLog_P2(LOG_LEVEL_DEBUG, PSTR("DBG: Uri |%s|"), url.c_str()); - client.print(url.c_str()); - client.flush(); - client.stop(); +#if defined(ARDUINO_ESP8266_RELEASE_2_3_0) || defined(ARDUINO_ESP8266_RELEASE_2_4_0) || defined(ARDUINO_ESP8266_RELEASE_2_4_1) || defined(ARDUINO_ESP8266_RELEASE_2_4_2) + HTTPClient http; + if (http.begin(UrlEncode(url))) { // UrlEncode(url) = |http://192.168.178.86/cm?cmnd=POWER1%20ON| +#else + WiFiClient http_client; + HTTPClient http; + if (http.begin(http_client, UrlEncode(url))) { // UrlEncode(url) = |http://192.168.178.86/cm?cmnd=POWER1%20ON| +#endif + int http_code = http.GET(); // Start connection and send HTTP header + if (http_code > 0) { // http_code will be negative on error + if (http_code == HTTP_CODE_OK || http_code == HTTP_CODE_MOVED_PERMANENTLY) { +/* + // Return received data to the user - Adds 900+ bytes to the code + String result = http.getString(); // File found at server - may need lot of ram or trigger out of memory! + uint16_t j = 0; + for (uint16_t i = 0; i < result.length(); i++) { + char text = result.charAt(i); + if (text > 31) { // Remove control characters like linefeed + mqtt_data[j++] = text; + if (j == sizeof(mqtt_data) -2) { break; } + } + } + mqtt_data[j] = '\0'; + MqttPublishPrefixTopic_P(RESULT_OR_STAT, PSTR(D_CMND_WEBSEND)); +*/ + } status = 0; // No error - Done } else { status = 2; // Connection failed } + http.end(); // Clean up connection data } else { - status = 3; // Host not found + status = 3; // Host not found or connection error } } return status; @@ -2064,33 +2291,33 @@ bool WebCommand(void) if (CMND_WEBSERVER == command_code) { if ((XdrvMailbox.payload >= 0) && (XdrvMailbox.payload <= 2)) { Settings.webserver = XdrvMailbox.payload; } if (Settings.webserver) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_WEBSERVER "\":\"" D_JSON_ACTIVE_FOR " %s " D_JSON_ON_DEVICE " %s " D_JSON_WITH_IP_ADDRESS " %s\"}"), + Response_P(PSTR("{\"" D_CMND_WEBSERVER "\":\"" D_JSON_ACTIVE_FOR " %s " D_JSON_ON_DEVICE " %s " D_JSON_WITH_IP_ADDRESS " %s\"}"), (2 == Settings.webserver) ? D_ADMIN : D_USER, my_hostname, WiFi.localIP().toString().c_str()); } else { - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, GetStateText(0)); + Response_P(S_JSON_COMMAND_SVALUE, command, GetStateText(0)); } } else if (CMND_WEBPASSWORD == command_code) { if ((XdrvMailbox.data_len > 0) && (XdrvMailbox.data_len < sizeof(Settings.web_password))) { strlcpy(Settings.web_password, (SC_CLEAR == Shortcut(XdrvMailbox.data)) ? "" : (SC_DEFAULT == Shortcut(XdrvMailbox.data)) ? WEB_PASSWORD : XdrvMailbox.data, sizeof(Settings.web_password)); - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, Settings.web_password); + Response_P(S_JSON_COMMAND_SVALUE, command, Settings.web_password); } else { - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_ASTERIX, command); + Response_P(S_JSON_COMMAND_ASTERIX, command); } } else if (CMND_WEBLOG == command_code) { if ((XdrvMailbox.payload >= LOG_LEVEL_NONE) && (XdrvMailbox.payload <= LOG_LEVEL_ALL)) { Settings.weblog_level = XdrvMailbox.payload; } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_NVALUE, command, Settings.weblog_level); + Response_P(S_JSON_COMMAND_NVALUE, command, Settings.weblog_level); } else if (CMND_WEBREFRESH == command_code) { if ((XdrvMailbox.payload > 999) && (XdrvMailbox.payload <= 10000)) { Settings.web_refresh = XdrvMailbox.payload; } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_NVALUE, command, Settings.web_refresh); + Response_P(S_JSON_COMMAND_NVALUE, command, Settings.web_refresh); } else if (CMND_WEBSEND == command_code) { if (XdrvMailbox.data_len > 0) { uint8_t result = WebSend(XdrvMailbox.data); char stemp1[20]; - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, GetTextIndexed(stemp1, sizeof(stemp1), result, kWebSendStatus)); + Response_P(S_JSON_COMMAND_SVALUE, command, GetTextIndexed(stemp1, sizeof(stemp1), result, kWebSendStatus)); } } #ifdef USE_EMULATION @@ -2099,7 +2326,7 @@ bool WebCommand(void) Settings.flag2.emulation = XdrvMailbox.payload; restart_flag = 2; } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_NVALUE, command, Settings.flag2.emulation); + Response_P(S_JSON_COMMAND_NVALUE, command, Settings.flag2.emulation); } #endif // USE_EMULATION else serviced = false; // Unknown command @@ -2119,7 +2346,7 @@ bool Xdrv01(uint8_t function) case FUNC_LOOP: PollDnsWebserver(); #ifdef USE_EMULATION - if (Settings.flag2.emulation) PollUdp(); + if (Settings.flag2.emulation) { PollUdp(); } #endif // USE_EMULATION break; case FUNC_COMMAND: diff --git a/sonoff/xdrv_02_mqtt.ino b/sonoff/xdrv_02_mqtt.ino index 8440b5cd6..b7daa1f34 100644 --- a/sonoff/xdrv_02_mqtt.ino +++ b/sonoff/xdrv_02_mqtt.ino @@ -19,42 +19,6 @@ #define XDRV_02 2 -/*********************************************************************************************\ - * Select ONE of possible MQTT library types below -\*********************************************************************************************/ -// Default MQTT driver for both non-TLS and TLS connections. Blocks network if MQTT server is unavailable. -//#define MQTT_LIBRARY_TYPE MQTT_PUBSUBCLIENT // Use PubSubClient library -// Alternative MQTT driver does not block network when MQTT server is unavailable. No TLS support -//#define MQTT_LIBRARY_TYPE MQTT_TASMOTAMQTT // Use TasmotaMqtt library (+4k4 (core 2.3.0), +14k4 (core 2.4.2 lwip2) code, +4k mem) - non-TLS only -// Alternative MQTT driver does not block network when MQTT server is unavailable. TLS should work but needs to be tested. -//#define MQTT_LIBRARY_TYPE MQTT_ARDUINOMQTT // Use arduino-mqtt (lwmqtt) library (+3k3 code, +2k mem) - -#if (MQTT_LIBRARY_TYPE == MQTT_ESPMQTTARDUINO) // Obsolete as of v6.2.1.11 -#undef MQTT_LIBRARY_TYPE -#define MQTT_LIBRARY_TYPE MQTT_ARDUINOMQTT -#endif - -/* -#if (MQTT_LIBRARY_TYPE == MQTT_TASMOTAMQTT) -#undef MQTT_LIBRARY_TYPE -#define MQTT_LIBRARY_TYPE MQTT_ARDUINOMQTT // Obsolete in near future -#endif -*/ - -#ifdef USE_MQTT_TLS - -#if (MQTT_LIBRARY_TYPE == MQTT_TASMOTAMQTT) -#undef MQTT_LIBRARY_TYPE -#endif - -#ifndef MQTT_LIBRARY_TYPE -#define MQTT_LIBRARY_TYPE MQTT_PUBSUBCLIENT // Use PubSubClient library as it only supports TLS -#endif - -#endif // USE_MQTT_TLS - -/*********************************************************************************************/ - #ifdef USE_MQTT_TLS #ifdef USE_MQTT_TLS_CA_CERT #include "sonoff_letsencrypt.h" // LetsEncrypt certificate @@ -73,6 +37,10 @@ const char kMqttCommands[] PROGMEM = D_CMND_MQTTUSER "|" D_CMND_MQTTPASSWORD "|" D_CMND_FULLTOPIC "|" D_CMND_PREFIX "|" D_CMND_GROUPTOPIC "|" D_CMND_TOPIC "|" D_CMND_PUBLISH "|" D_CMND_BUTTONTOPIC "|" D_CMND_SWITCHTOPIC "|" D_CMND_BUTTONRETAIN "|" D_CMND_SWITCHRETAIN "|" D_CMND_POWERRETAIN "|" D_CMND_SENSORRETAIN ; +IPAddress mqtt_host_addr; // MQTT host IP address +uint32_t mqtt_host_hash = 0; // MQTT host name hash + +uint16_t mqtt_connect_count = 0; // MQTT re-connect count uint16_t mqtt_retry_counter = 1; // MQTT connection retry counter uint8_t mqtt_initial_connection_state = 2; // MQTT connection messages state bool mqtt_connected = false; // MQTT virtual connection status @@ -85,11 +53,8 @@ bool mqtt_allowed = false; // MQTT enabled and parameters valid * void MqttDisconnect() * void MqttSubscribeLib(char *topic) * bool MqttPublishLib(const char* topic, bool retained) - * void MqttLoop() \*********************************************************************************************/ -#if (MQTT_LIBRARY_TYPE == MQTT_PUBSUBCLIENT) /***********************************************/ - #include // Max message size calculated by PubSubClient is (MQTT_MAX_PACKET_SIZE < 5 + 2 + strlen(topic) + plength) @@ -109,12 +74,18 @@ void MqttDisconnect(void) MqttClient.disconnect(); } -void MqttSubscribeLib(char *topic) +void MqttSubscribeLib(const char *topic) { MqttClient.subscribe(topic); MqttClient.loop(); // Solve LmacRxBlk:1 messages } +void MqttUnsubscribeLib(const char *topic) +{ + MqttClient.unsubscribe(topic); + MqttClient.loop(); // Solve LmacRxBlk:1 messages +} + bool MqttPublishLib(const char* topic, bool retained) { bool result = MqttClient.publish(topic, mqtt_data, retained); @@ -122,91 +93,6 @@ bool MqttPublishLib(const char* topic, bool retained) return result; } -void MqttLoop(void) -{ - MqttClient.loop(); -} - -#elif (MQTT_LIBRARY_TYPE == MQTT_TASMOTAMQTT) /**********************************************/ - -#include -TasmotaMqtt MqttClient; - -bool MqttIsConnected(void) -{ - return MqttClient.Connected(); -} - -void MqttDisconnect(void) -{ - MqttClient.Disconnect(); -} - -void MqttDisconnectedCb(void) -{ - MqttDisconnected(MqttClient.State()); // status codes are documented in file mqtt.h as tConnState -} - -void MqttSubscribeLib(char *topic) -{ - MqttClient.Subscribe(topic, 0); -} - -bool MqttPublishLib(const char* topic, bool retained) -{ - return MqttClient.Publish(topic, mqtt_data, strlen(mqtt_data), 0, retained); -} - -void MqttLoop(void) -{ -} - -#elif (MQTT_LIBRARY_TYPE == MQTT_ARDUINOMQTT) /**********************************************/ - -#include -MQTTClient MqttClient(MQTT_MAX_PACKET_SIZE); - -bool MqttIsConnected(void) -{ - return MqttClient.connected(); -} - -void MqttDisconnect(void) -{ - MqttClient.disconnect(); -} - -/* -void MqttMyDataCb(MQTTClient* client, char* topic, char* data, int data_len) -//void MqttMyDataCb(MQTTClient *client, char topic[], char data[], int data_len) -{ -// MqttDataHandler((char*)topic, (uint8_t*)data, data_len); -} -*/ - -void MqttMyDataCb(String &topic, String &data) -{ - MqttDataHandler((char*)topic.c_str(), (uint8_t*)data.c_str(), data.length()); -} - -void MqttSubscribeLib(char *topic) -{ - MqttClient.subscribe(topic, 0); -} - -bool MqttPublishLib(const char* topic, bool retained) -{ - return MqttClient.publish(topic, mqtt_data, strlen(mqtt_data), retained, 0); -} - -void MqttLoop(void) -{ - MqttClient.loop(); -// delay(10); -} - -#endif // MQTT_LIBRARY_TYPE - /*********************************************************************************************/ #ifdef USE_DISCOVERY @@ -217,8 +103,7 @@ void MqttDiscoverServer(void) int n = MDNS.queryService("mqtt", "tcp"); // Search for mqtt service - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_MDNS D_QUERY_DONE " %d"), n); - AddLog(LOG_LEVEL_INFO); + AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_MDNS D_QUERY_DONE " %d"), n); if (n > 0) { uint8_t i = 0; // If the hostname isn't set, use the first record found. @@ -232,37 +117,37 @@ void MqttDiscoverServer(void) snprintf_P(Settings.mqtt_host, sizeof(Settings.mqtt_host), MDNS.IP(i).toString().c_str()); Settings.mqtt_port = MDNS.port(i); - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_MDNS D_MQTT_SERVICE_FOUND " %s, " D_IP_ADDRESS " %s, " D_PORT " %d"), - MDNS.hostname(i).c_str(), Settings.mqtt_host, Settings.mqtt_port); - AddLog(LOG_LEVEL_INFO); + AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_MDNS D_MQTT_SERVICE_FOUND " %s, " D_IP_ADDRESS " %s, " D_PORT " %d"), MDNS.hostname(i).c_str(), Settings.mqtt_host, Settings.mqtt_port); } } #endif // MQTT_HOST_DISCOVERY #endif // USE_DISCOVERY -int MqttLibraryType(void) -{ - return (int)MQTT_LIBRARY_TYPE; -} - void MqttRetryCounter(uint8_t value) { mqtt_retry_counter = value; } -void MqttSubscribe(char *topic) +void MqttSubscribe(const char *topic) { - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_MQTT D_SUBSCRIBE_TO " %s"), topic); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_MQTT D_SUBSCRIBE_TO " %s"), topic); MqttSubscribeLib(topic); } +void MqttUnsubscribe(const char *topic) +{ + AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_MQTT D_UNSUBSCRIBE_FROM " %s"), topic); + MqttUnsubscribeLib(topic); +} + void MqttPublishDirect(const char* topic, bool retained) { char sretained[CMDSZ]; char slog_type[10]; +#ifdef USE_DEBUG_DRIVER ShowFreeMem(PSTR("MqttPublishDirect")); +#endif sretained[0] = '\0'; snprintf_P(slog_type, sizeof(slog_type), PSTR(D_LOG_RESULT)); @@ -284,8 +169,8 @@ void MqttPublishDirect(const char* topic, bool retained) snprintf_P(log_data, sizeof(log_data), PSTR("%s ..."), log_data); } snprintf_P(log_data, sizeof(log_data), PSTR("%s%s"), log_data, sretained); - AddLog(LOG_LEVEL_INFO); + if (Settings.ledstate &0x04) { blinks++; } @@ -349,17 +234,17 @@ void MqttPublishPowerState(uint8_t device) #endif // USE_DOMOTICZ snprintf_P(scommand, sizeof(scommand), PSTR(D_CMND_FANSPEED)); GetTopic_P(stopic, STAT, mqtt_topic, (Settings.flag.mqtt_response) ? scommand : S_RSLT_RESULT); - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_NVALUE, scommand, GetFanspeed()); + Response_P(S_JSON_COMMAND_NVALUE, scommand, GetFanspeed()); MqttPublish(stopic); } } else { GetPowerDevice(scommand, device, sizeof(scommand), Settings.flag.device_index_enable); GetTopic_P(stopic, STAT, mqtt_topic, (Settings.flag.mqtt_response) ? scommand : S_RSLT_RESULT); - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, scommand, GetStateText(bitRead(power, device -1))); + Response_P(S_JSON_COMMAND_SVALUE, scommand, GetStateText(bitRead(power, device -1))); MqttPublish(stopic); GetTopic_P(stopic, STAT, mqtt_topic, scommand); - snprintf_P(mqtt_data, sizeof(mqtt_data), GetStateText(bitRead(power, device -1))); + Response_P(GetStateText(bitRead(power, device -1))); MqttPublish(stopic, Settings.flag.mqtt_power_retain); } } @@ -371,7 +256,7 @@ void MqttPublishPowerBlinkState(uint8_t device) if ((device < 1) || (device > devices_present)) { device = 1; } - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"%s\":\"" D_JSON_BLINK " %s\"}"), + Response_P(PSTR("{\"%s\":\"" D_JSON_BLINK " %s\"}"), GetPowerDevice(scommand, device, sizeof(scommand), Settings.flag.device_index_enable), GetStateText(bitRead(blink_mask, device -1))); MqttPublishPrefixTopic_P(RESULT_OR_STAT, S_RSLT_POWER); @@ -379,14 +264,17 @@ void MqttPublishPowerBlinkState(uint8_t device) /*********************************************************************************************/ +uint16_t MqttConnectCount() +{ + return mqtt_connect_count; +} + void MqttDisconnected(int state) { mqtt_connected = false; mqtt_retry_counter = Settings.mqtt_retry; - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_MQTT D_CONNECT_FAILED_TO " %s:%d, rc %d. " D_RETRY_IN " %d " D_UNIT_SECOND), - Settings.mqtt_host, Settings.mqtt_port, state, mqtt_retry_counter); - AddLog(LOG_LEVEL_INFO); + AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_MQTT D_CONNECT_FAILED_TO " %s:%d, rc %d. " D_RETRY_IN " %d " D_UNIT_SECOND), Settings.mqtt_host, Settings.mqtt_port, state, mqtt_retry_counter); rules_flag.mqtt_disconnected = 1; } @@ -398,9 +286,10 @@ void MqttConnected(void) AddLog_P(LOG_LEVEL_INFO, S_LOG_MQTT, PSTR(D_CONNECTED)); mqtt_connected = true; mqtt_retry_counter = 0; + mqtt_connect_count++; GetTopic_P(stopic, TELE, mqtt_topic, S_LWT); - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR(D_ONLINE)); + Response_P(PSTR(D_ONLINE)); MqttPublish(stopic, true); // Satisfy iobroker (#299) @@ -409,7 +298,7 @@ void MqttConnected(void) GetTopic_P(stopic, CMND, mqtt_topic, PSTR("#")); MqttSubscribe(stopic); - if (strstr(Settings.mqtt_fulltopic, MQTT_TOKEN_TOPIC) != NULL) { + if (strstr_P(Settings.mqtt_fulltopic, MQTT_TOKEN_TOPIC) != nullptr) { GetTopic_P(stopic, CMND, Settings.mqtt_grptopic, PSTR("#")); MqttSubscribe(stopic); GetFallbackTopic_P(stopic, CMND, PSTR("#")); @@ -420,18 +309,17 @@ void MqttConnected(void) } if (mqtt_initial_connection_state) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_MODULE "\":\"%s\",\"" D_JSON_VERSION "\":\"%s%s\",\"" D_JSON_FALLBACKTOPIC "\":\"%s\",\"" D_CMND_GROUPTOPIC "\":\"%s\"}"), + Response_P(PSTR("{\"" D_CMND_MODULE "\":\"%s\",\"" D_JSON_VERSION "\":\"%s%s\",\"" D_JSON_FALLBACKTOPIC "\":\"%s\",\"" D_CMND_GROUPTOPIC "\":\"%s\"}"), ModuleName().c_str(), my_version, my_image, GetFallbackTopic_P(stopic, CMND, ""), Settings.mqtt_grptopic); MqttPublishPrefixTopic_P(TELE, PSTR(D_RSLT_INFO "1")); #ifdef USE_WEBSERVER if (Settings.webserver) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_JSON_WEBSERVER_MODE "\":\"%s\",\"" D_CMND_HOSTNAME "\":\"%s\",\"" D_CMND_IPADDRESS "\":\"%s\"}"), + Response_P(PSTR("{\"" D_JSON_WEBSERVER_MODE "\":\"%s\",\"" D_CMND_HOSTNAME "\":\"%s\",\"" D_CMND_IPADDRESS "\":\"%s\"}"), (2 == Settings.webserver) ? D_ADMIN : D_USER, my_hostname, WiFi.localIP().toString().c_str()); MqttPublishPrefixTopic_P(TELE, PSTR(D_RSLT_INFO "2")); } #endif // USE_WEBSERVER - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_JSON_RESTARTREASON "\":\"%s\"}"), - (GetResetReason() == "Exception") ? ESP.getResetInfo().c_str() : GetResetReason().c_str()); + Response_P(PSTR("{\"" D_JSON_RESTARTREASON "\":\"%s\"}"), (GetResetReason() == "Exception") ? ESP.getResetInfo().c_str() : GetResetReason().c_str()); MqttPublishPrefixTopic_P(TELE, PSTR(D_RSLT_INFO "3")); for (uint8_t i = 1; i <= devices_present; i++) { MqttPublishPowerState(i); @@ -470,9 +358,7 @@ bool MqttCheckTls(void) //#endif if (!EspClient.connect(Settings.mqtt_host, Settings.mqtt_port)) { - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_MQTT D_TLS_CONNECT_FAILED_TO " %s:%d. " D_RETRY_IN " %d " D_UNIT_SECOND), - Settings.mqtt_host, Settings.mqtt_port, mqtt_retry_counter); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_MQTT D_TLS_CONNECT_FAILED_TO " %s:%d. " D_RETRY_IN " %d " D_UNIT_SECOND), Settings.mqtt_host, Settings.mqtt_port, mqtt_retry_counter); } else { #ifdef USE_MQTT_TLS_CA_CERT unsigned char tls_ca_cert[] = MQTT_TLS_CA_CERT; @@ -542,62 +428,44 @@ void MqttReconnect(void) mqtt_retry_counter = Settings.mqtt_retry; global_state.mqtt_down = 1; - char *mqtt_user = NULL; - char *mqtt_pwd = NULL; + char *mqtt_user = nullptr; + char *mqtt_pwd = nullptr; if (strlen(Settings.mqtt_user) > 0) mqtt_user = Settings.mqtt_user; if (strlen(Settings.mqtt_pwd) > 0) mqtt_pwd = Settings.mqtt_pwd; GetTopic_P(stopic, TELE, mqtt_topic, S_LWT); - snprintf_P(mqtt_data, sizeof(mqtt_data), S_OFFLINE); + Response_P(S_OFFLINE); -//#ifdef ARDUINO_ESP8266_RELEASE_2_4_1 #ifdef USE_MQTT_TLS EspClient = WiFiClientSecure(); // Wifi Secure Client reconnect issue 4497 (https://github.com/esp8266/Arduino/issues/4497) #else EspClient = WiFiClient(); // Wifi Client reconnect issue 4497 (https://github.com/esp8266/Arduino/issues/4497) #endif -//#endif if (2 == mqtt_initial_connection_state) { // Executed once just after power on and wifi is connected #ifdef USE_MQTT_TLS if (!MqttCheckTls()) return; #endif // USE_MQTT_TLS -#if (MQTT_LIBRARY_TYPE == MQTT_TASMOTAMQTT) - MqttClient.InitConnection(Settings.mqtt_host, Settings.mqtt_port); - MqttClient.InitClient(mqtt_client, mqtt_user, mqtt_pwd, MQTT_KEEPALIVE); - MqttClient.InitLWT(stopic, mqtt_data, 1, true); - MqttClient.OnConnected(MqttConnected); - MqttClient.OnDisconnected(MqttDisconnectedCb); - MqttClient.OnData(MqttDataHandler); -#elif (MQTT_LIBRARY_TYPE == MQTT_ARDUINOMQTT) - MqttClient.begin(Settings.mqtt_host, Settings.mqtt_port, EspClient); - MqttClient.setWill(stopic, mqtt_data, true, 1); - MqttClient.setOptions(MQTT_KEEPALIVE, true, MQTT_TIMEOUT); -// MqttClient.onMessageAdvanced(MqttMyDataCb); - MqttClient.onMessage(MqttMyDataCb); -#endif - mqtt_initial_connection_state = 1; } -#if (MQTT_LIBRARY_TYPE == MQTT_PUBSUBCLIENT) MqttClient.setCallback(MqttDataHandler); MqttClient.setServer(Settings.mqtt_host, Settings.mqtt_port); +/* + // Skip MQTT host DNS lookup if not needed + uint32_t current_hash = GetHash(Settings.mqtt_host, strlen(Settings.mqtt_host)); + if (mqtt_host_hash != current_hash) { + mqtt_host_hash = current_hash; + WiFi.hostByName(Settings.mqtt_host, mqtt_host_addr); // Skips DNS lookup if mqtt_host is IP address string as from mDns + } + MqttClient.setServer(mqtt_host_addr, Settings.mqtt_port); +*/ if (MqttClient.connect(mqtt_client, mqtt_user, mqtt_pwd, stopic, 1, true, mqtt_data)) { MqttConnected(); } else { MqttDisconnected(MqttClient.state()); // status codes are documented here http://pubsubclient.knolleary.net/api.html#state } -#elif (MQTT_LIBRARY_TYPE == MQTT_TASMOTAMQTT) - MqttClient.Connect(); -#elif (MQTT_LIBRARY_TYPE == MQTT_ARDUINOMQTT) - if (MqttClient.connect(mqtt_client, mqtt_user, mqtt_pwd)) { - MqttConnected(); - } else { - MqttDisconnected(MqttClient.lastError()); // status codes are documented here https://github.com/256dpi/lwmqtt/blob/master/include/lwmqtt.h#L11 - } -#endif // MQTT_LIBRARY_TYPE } void MqttCheck(void) @@ -651,21 +519,21 @@ bool MqttCommand(void) strlcpy(Settings.mqtt_host, (SC_CLEAR == Shortcut(dataBuf)) ? "" : (SC_DEFAULT == Shortcut(dataBuf)) ? MQTT_HOST : dataBuf, sizeof(Settings.mqtt_host)); restart_flag = 2; } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, Settings.mqtt_host); + Response_P(S_JSON_COMMAND_SVALUE, command, Settings.mqtt_host); } else if (CMND_MQTTPORT == command_code) { if (payload16 > 0) { Settings.mqtt_port = (1 == payload16) ? MQTT_PORT : payload16; restart_flag = 2; } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_NVALUE, command, Settings.mqtt_port); + Response_P(S_JSON_COMMAND_NVALUE, command, Settings.mqtt_port); } else if (CMND_MQTTRETRY == command_code) { if ((payload >= MQTT_RETRY_SECS) && (payload < 32001)) { Settings.mqtt_retry = payload; mqtt_retry_counter = Settings.mqtt_retry; } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_NVALUE, command, Settings.mqtt_retry); + Response_P(S_JSON_COMMAND_NVALUE, command, Settings.mqtt_retry); } else if ((CMND_STATETEXT == command_code) && (index > 0) && (index <= 4)) { if ((data_len > 0) && (data_len < sizeof(Settings.state_text[0]))) { @@ -674,7 +542,7 @@ bool MqttCommand(void) } strlcpy(Settings.state_text[index -1], dataBuf, sizeof(Settings.state_text[0])); } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_INDEX_SVALUE, command, index, GetStateText(index -1)); + Response_P(S_JSON_COMMAND_INDEX_SVALUE, command, index, GetStateText(index -1)); } #ifdef USE_MQTT_TLS else if ((CMND_MQTTFINGERPRINT == command_code) && (index > 0) && (index <= 2)) { @@ -691,7 +559,7 @@ bool MqttCommand(void) for (uint8_t i = 0; i < sizeof(Settings.mqtt_fingerprint[index -1]); i++) { snprintf_P(fingerprint, sizeof(fingerprint), PSTR("%s%s%02X"), fingerprint, (i) ? " " : "", Settings.mqtt_fingerprint[index -1][i]); } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_INDEX_SVALUE, command, index, fingerprint); + Response_P(S_JSON_COMMAND_INDEX_SVALUE, command, index, fingerprint); } #endif else if (CMND_MQTTCLIENT == command_code) { @@ -699,22 +567,22 @@ bool MqttCommand(void) strlcpy(Settings.mqtt_client, (SC_DEFAULT == Shortcut(dataBuf)) ? MQTT_CLIENT_ID : dataBuf, sizeof(Settings.mqtt_client)); restart_flag = 2; } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, Settings.mqtt_client); + Response_P(S_JSON_COMMAND_SVALUE, command, Settings.mqtt_client); } else if (CMND_MQTTUSER == command_code) { if ((data_len > 0) && (data_len < sizeof(Settings.mqtt_user))) { strlcpy(Settings.mqtt_user, (SC_CLEAR == Shortcut(dataBuf)) ? "" : (SC_DEFAULT == Shortcut(dataBuf)) ? MQTT_USER : dataBuf, sizeof(Settings.mqtt_user)); restart_flag = 2; } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, Settings.mqtt_user); + Response_P(S_JSON_COMMAND_SVALUE, command, Settings.mqtt_user); } else if (CMND_MQTTPASSWORD == command_code) { if ((data_len > 0) && (data_len < sizeof(Settings.mqtt_pwd))) { strlcpy(Settings.mqtt_pwd, (SC_CLEAR == Shortcut(dataBuf)) ? "" : (SC_DEFAULT == Shortcut(dataBuf)) ? MQTT_PASS : dataBuf, sizeof(Settings.mqtt_pwd)); - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, Settings.mqtt_pwd); + Response_P(S_JSON_COMMAND_SVALUE, command, Settings.mqtt_pwd); restart_flag = 2; } else { - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_ASTERIX, command); + Response_P(S_JSON_COMMAND_ASTERIX, command); } } else if (CMND_FULLTOPIC == command_code) { @@ -723,13 +591,13 @@ bool MqttCommand(void) if (!strcmp(dataBuf, mqtt_client)) SetShortcut(dataBuf, SC_DEFAULT); strlcpy(stemp1, (SC_DEFAULT == Shortcut(dataBuf)) ? MQTT_FULLTOPIC : dataBuf, sizeof(stemp1)); if (strcmp(stemp1, Settings.mqtt_fulltopic)) { - snprintf_P(mqtt_data, sizeof(mqtt_data), (Settings.flag.mqtt_offline) ? S_OFFLINE : ""); + Response_P((Settings.flag.mqtt_offline) ? S_OFFLINE : ""); MqttPublishPrefixTopic_P(TELE, PSTR(D_LWT), true); // Offline or remove previous retained topic strlcpy(Settings.mqtt_fulltopic, stemp1, sizeof(Settings.mqtt_fulltopic)); restart_flag = 2; } } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, Settings.mqtt_fulltopic); + Response_P(S_JSON_COMMAND_SVALUE, command, Settings.mqtt_fulltopic); } else if ((CMND_PREFIX == command_code) && (index > 0) && (index <= 3)) { if ((data_len > 0) && (data_len < sizeof(Settings.mqtt_prefix[0]))) { @@ -738,21 +606,21 @@ bool MqttCommand(void) // if (Settings.mqtt_prefix[index -1][strlen(Settings.mqtt_prefix[index -1])] == '/') Settings.mqtt_prefix[index -1][strlen(Settings.mqtt_prefix[index -1])] = 0; restart_flag = 2; } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_INDEX_SVALUE, command, index, Settings.mqtt_prefix[index -1]); + Response_P(S_JSON_COMMAND_INDEX_SVALUE, command, index, Settings.mqtt_prefix[index -1]); } else if (CMND_PUBLISH == command_code) { if (data_len > 0) { char *mqtt_part = strtok(dataBuf, " "); if (mqtt_part) { - snprintf(stemp1, sizeof(stemp1), mqtt_part); - mqtt_part = strtok(NULL, " "); + strlcpy(stemp1, mqtt_part, sizeof(stemp1)); + mqtt_part = strtok(nullptr, " "); if (mqtt_part) { - snprintf(mqtt_data, sizeof(mqtt_data), mqtt_part); + strlcpy(mqtt_data, mqtt_part, sizeof(mqtt_data)); } else { mqtt_data[0] = '\0'; } MqttPublishDirect(stemp1, (index == 2)); -// snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, D_JSON_DONE); +// Response_P(S_JSON_COMMAND_SVALUE, command, D_JSON_DONE); mqtt_data[0] = '\0'; } } @@ -764,7 +632,7 @@ bool MqttCommand(void) strlcpy(Settings.mqtt_grptopic, (SC_DEFAULT == Shortcut(dataBuf)) ? MQTT_GRPTOPIC : dataBuf, sizeof(Settings.mqtt_grptopic)); restart_flag = 2; } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, Settings.mqtt_grptopic); + Response_P(S_JSON_COMMAND_SVALUE, command, Settings.mqtt_grptopic); } else if (CMND_TOPIC == command_code) { if (!grpflg && (data_len > 0) && (data_len < sizeof(Settings.mqtt_topic))) { @@ -772,13 +640,13 @@ bool MqttCommand(void) if (!strcmp(dataBuf, mqtt_client)) SetShortcut(dataBuf, SC_DEFAULT); strlcpy(stemp1, (SC_DEFAULT == Shortcut(dataBuf)) ? MQTT_TOPIC : dataBuf, sizeof(stemp1)); if (strcmp(stemp1, Settings.mqtt_topic)) { - snprintf_P(mqtt_data, sizeof(mqtt_data), (Settings.flag.mqtt_offline) ? S_OFFLINE : ""); + Response_P((Settings.flag.mqtt_offline) ? S_OFFLINE : ""); MqttPublishPrefixTopic_P(TELE, PSTR(D_LWT), true); // Offline or remove previous retained topic strlcpy(Settings.mqtt_topic, stemp1, sizeof(Settings.mqtt_topic)); restart_flag = 2; } } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, Settings.mqtt_topic); + Response_P(S_JSON_COMMAND_SVALUE, command, Settings.mqtt_topic); } else if (CMND_BUTTONTOPIC == command_code) { if (!grpflg && (data_len > 0) && (data_len < sizeof(Settings.button_topic))) { @@ -791,7 +659,7 @@ bool MqttCommand(void) default: strlcpy(Settings.button_topic, dataBuf, sizeof(Settings.button_topic)); } } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, Settings.button_topic); + Response_P(S_JSON_COMMAND_SVALUE, command, Settings.button_topic); } else if (CMND_SWITCHTOPIC == command_code) { if ((data_len > 0) && (data_len < sizeof(Settings.switch_topic))) { @@ -804,7 +672,7 @@ bool MqttCommand(void) default: strlcpy(Settings.switch_topic, dataBuf, sizeof(Settings.switch_topic)); } } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, Settings.switch_topic); + Response_P(S_JSON_COMMAND_SVALUE, command, Settings.switch_topic); } else if (CMND_BUTTONRETAIN == command_code) { if ((payload >= 0) && (payload <= 1)) { @@ -815,7 +683,7 @@ bool MqttCommand(void) } Settings.flag.mqtt_button_retain = payload; } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, GetStateText(Settings.flag.mqtt_button_retain)); + Response_P(S_JSON_COMMAND_SVALUE, command, GetStateText(Settings.flag.mqtt_button_retain)); } else if (CMND_SWITCHRETAIN == command_code) { if ((payload >= 0) && (payload <= 1)) { @@ -826,7 +694,7 @@ bool MqttCommand(void) } Settings.flag.mqtt_switch_retain = payload; } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, GetStateText(Settings.flag.mqtt_switch_retain)); + Response_P(S_JSON_COMMAND_SVALUE, command, GetStateText(Settings.flag.mqtt_switch_retain)); } else if (CMND_POWERRETAIN == command_code) { if ((payload >= 0) && (payload <= 1)) { @@ -839,7 +707,7 @@ bool MqttCommand(void) } Settings.flag.mqtt_power_retain = payload; } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, GetStateText(Settings.flag.mqtt_power_retain)); + Response_P(S_JSON_COMMAND_SVALUE, command, GetStateText(Settings.flag.mqtt_power_retain)); } else if (CMND_SENSORRETAIN == command_code) { if ((payload >= 0) && (payload <= 1)) { @@ -850,7 +718,7 @@ bool MqttCommand(void) } Settings.flag.mqtt_sensor_retain = payload; } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, GetStateText(Settings.flag.mqtt_sensor_retain)); + Response_P(S_JSON_COMMAND_SVALUE, command, GetStateText(Settings.flag.mqtt_sensor_retain)); } else serviced = false; // Unknown command @@ -868,17 +736,19 @@ bool MqttCommand(void) const char S_CONFIGURE_MQTT[] PROGMEM = D_CONFIGURE_MQTT; const char HTTP_BTN_MENU_MQTT[] PROGMEM = - "
"; + "

"; -const char HTTP_FORM_MQTT[] PROGMEM = - "
 " D_MQTT_PARAMETERS " 
" - "
" D_HOST " (" MQTT_HOST ")

" - "
" D_PORT " (" STR(MQTT_PORT) ")

" - "
" D_CLIENT " ({m0)

" - "
" D_USER " (" MQTT_USER ")

" - "
" D_PASSWORD "

" - "
" D_TOPIC " = %topic% (" MQTT_TOPIC ")

" - "
" D_FULL_TOPIC " (" MQTT_FULLTOPIC ")

"; +const char HTTP_FORM_MQTT1[] PROGMEM = + "
 " D_MQTT_PARAMETERS " " + "" + "

" D_HOST " (" MQTT_HOST ")

" + "

" D_PORT " (" STR(MQTT_PORT) ")

" + "

" D_CLIENT " (%s)

"; +const char HTTP_FORM_MQTT2[] PROGMEM = + "

" D_USER " (" MQTT_USER ")

" + "

" D_PASSWORD "

" + "

" D_TOPIC " = %%topic%% (%s)

" + "

" D_FULL_TOPIC " (%s)

"; void HandleMqttConfiguration(void) { @@ -892,23 +762,21 @@ void HandleMqttConfiguration(void) return; } - String page = FPSTR(HTTP_HEAD); - page.replace(F("{v}"), FPSTR(S_CONFIGURE_MQTT)); - page += FPSTR(HTTP_HEAD_STYLE); - - page += FPSTR(HTTP_FORM_MQTT); char str[sizeof(Settings.mqtt_client)]; - page.replace(F("{m0"), Format(str, MQTT_CLIENT_ID, sizeof(Settings.mqtt_client))); - page.replace(F("{m1"), Settings.mqtt_host); - page.replace(F("{m2"), String(Settings.mqtt_port)); - page.replace(F("{m3"), Settings.mqtt_client); - page.replace(F("{m4"), (Settings.mqtt_user[0] == '\0')?"0":Settings.mqtt_user); - page.replace(F("{m6"), Settings.mqtt_topic); - page.replace(F("{m7"), Settings.mqtt_fulltopic); - page += FPSTR(HTTP_FORM_END); - page += FPSTR(HTTP_BTN_CONF); - ShowPage(page); + WSContentStart_P(S_CONFIGURE_MQTT); + WSContentSendStyle(); + WSContentSend_P(HTTP_FORM_MQTT1, + Settings.mqtt_host, + Settings.mqtt_port, + Format(str, MQTT_CLIENT_ID, sizeof(str)), MQTT_CLIENT_ID, Settings.mqtt_client); + WSContentSend_P(HTTP_FORM_MQTT2, + (Settings.mqtt_user[0] == '\0') ? "0" : Settings.mqtt_user, + Format(str, MQTT_TOPIC, sizeof(str)), MQTT_TOPIC, Settings.mqtt_topic, + MQTT_FULLTOPIC, MQTT_FULLTOPIC, Settings.mqtt_fulltopic); + WSContentSend_P(HTTP_FORM_END); + WSContentSpaceButton(BUTTON_CONFIGURATION); + WSContentStop(); } void MqttSaveSettings(void) @@ -924,7 +792,7 @@ void MqttSaveSettings(void) strlcpy(stemp2, (!strlen(tmp)) ? MQTT_FULLTOPIC : tmp, sizeof(stemp2)); MakeValidMqtt(1,stemp2); if ((strcmp(stemp, Settings.mqtt_topic)) || (strcmp(stemp2, Settings.mqtt_fulltopic))) { - snprintf_P(mqtt_data, sizeof(mqtt_data), (Settings.flag.mqtt_offline) ? S_OFFLINE : ""); + Response_P((Settings.flag.mqtt_offline) ? S_OFFLINE : ""); MqttPublishPrefixTopic_P(TELE, S_LWT, true); // Offline or remove previous retained topic } strlcpy(Settings.mqtt_topic, stemp, sizeof(Settings.mqtt_topic)); @@ -938,10 +806,9 @@ void MqttSaveSettings(void) WebGetArg("mu", tmp, sizeof(tmp)); strlcpy(Settings.mqtt_user, (!strlen(tmp)) ? MQTT_USER : (!strcmp(tmp,"0")) ? "" : tmp, sizeof(Settings.mqtt_user)); WebGetArg("mp", tmp, sizeof(tmp)); - strlcpy(Settings.mqtt_pwd, (!strlen(tmp)) ? "" : (strchr(tmp,'*')) ? Settings.mqtt_pwd : tmp, sizeof(Settings.mqtt_pwd)); - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_MQTT D_CMND_MQTTHOST " %s, " D_CMND_MQTTPORT " %d, " D_CMND_MQTTCLIENT " %s, " D_CMND_MQTTUSER " %s, " D_CMND_TOPIC " %s, " D_CMND_FULLTOPIC " %s"), + strlcpy(Settings.mqtt_pwd, (!strlen(tmp)) ? "" : (!strcmp(tmp, D_ASTERISK_PWD)) ? Settings.mqtt_pwd : tmp, sizeof(Settings.mqtt_pwd)); + AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_MQTT D_CMND_MQTTHOST " %s, " D_CMND_MQTTPORT " %d, " D_CMND_MQTTCLIENT " %s, " D_CMND_MQTTUSER " %s, " D_CMND_TOPIC " %s, " D_CMND_FULLTOPIC " %s"), Settings.mqtt_host, Settings.mqtt_port, Settings.mqtt_client, Settings.mqtt_user, Settings.mqtt_topic, Settings.mqtt_fulltopic); - AddLog(LOG_LEVEL_INFO); } #endif // USE_WEBSERVER @@ -955,17 +822,17 @@ bool Xdrv02(uint8_t function) if (Settings.flag.mqtt_enabled) { switch (function) { + case FUNC_LOOP: + if (MqttIsConnected()) { MqttClient.loop(); } + break; #ifdef USE_WEBSERVER case FUNC_WEB_ADD_BUTTON: - strncat_P(mqtt_data, HTTP_BTN_MENU_MQTT, sizeof(mqtt_data) - strlen(mqtt_data) -1); + WSContentSend_P(HTTP_BTN_MENU_MQTT); break; case FUNC_WEB_ADD_HANDLER: WebServer->on("/" WEB_HANDLE_MQTT, HandleMqttConfiguration); break; #endif // USE_WEBSERVER - case FUNC_LOOP: - if (!global_state.mqtt_down) { MqttLoop(); } - break; case FUNC_COMMAND: result = MqttCommand(); break; diff --git a/sonoff/xdrv_03_energy.ino b/sonoff/xdrv_03_energy.ino index 62e445c91..c1c65eafe 100644 --- a/sonoff/xdrv_03_energy.ino +++ b/sonoff/xdrv_03_energy.ino @@ -199,37 +199,36 @@ void EnergyMarginCheck(void) energy_voltage_u = (uint16_t)(energy_voltage); energy_current_u = (uint16_t)(energy_current * 1000); -// snprintf_P(log_data, sizeof(log_data), PSTR("NRG: W %d, U %d, I %d"), energy_power_u, energy_voltage_u, energy_current_u); -// AddLog(LOG_LEVEL_DEBUG); +// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("NRG: W %d, U %d, I %d"), energy_power_u, energy_voltage_u, energy_current_u); - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{")); + Response_P(PSTR("{")); jsonflg = false; if (EnergyMargin(false, Settings.energy_min_power, energy_power_u, flag, energy_min_power_flag)) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s%s\"" D_CMND_POWERLOW "\":\"%s\""), mqtt_data, (jsonflg)?",":"", GetStateText(flag)); + ResponseAppend_P(PSTR("%s\"" D_CMND_POWERLOW "\":\"%s\""), (jsonflg)?",":"", GetStateText(flag)); jsonflg = true; } if (EnergyMargin(true, Settings.energy_max_power, energy_power_u, flag, energy_max_power_flag)) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s%s\"" D_CMND_POWERHIGH "\":\"%s\""), mqtt_data, (jsonflg)?",":"", GetStateText(flag)); + ResponseAppend_P(PSTR("%s\"" D_CMND_POWERHIGH "\":\"%s\""), (jsonflg)?",":"", GetStateText(flag)); jsonflg = true; } if (EnergyMargin(false, Settings.energy_min_voltage, energy_voltage_u, flag, energy_min_voltage_flag)) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s%s\"" D_CMND_VOLTAGELOW "\":\"%s\""), mqtt_data, (jsonflg)?",":"", GetStateText(flag)); + ResponseAppend_P(PSTR("%s\"" D_CMND_VOLTAGELOW "\":\"%s\""), (jsonflg)?",":"", GetStateText(flag)); jsonflg = true; } if (EnergyMargin(true, Settings.energy_max_voltage, energy_voltage_u, flag, energy_max_voltage_flag)) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s%s\"" D_CMND_VOLTAGEHIGH "\":\"%s\""), mqtt_data, (jsonflg)?",":"", GetStateText(flag)); + ResponseAppend_P(PSTR("%s\"" D_CMND_VOLTAGEHIGH "\":\"%s\""), (jsonflg)?",":"", GetStateText(flag)); jsonflg = true; } if (EnergyMargin(false, Settings.energy_min_current, energy_current_u, flag, energy_min_current_flag)) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s%s\"" D_CMND_CURRENTLOW "\":\"%s\""), mqtt_data, (jsonflg)?",":"", GetStateText(flag)); + ResponseAppend_P(PSTR("%s%s\"" D_CMND_CURRENTLOW "\":\"%s\""), (jsonflg)?",":"", GetStateText(flag)); jsonflg = true; } if (EnergyMargin(true, Settings.energy_max_current, energy_current_u, flag, energy_max_current_flag)) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s%s\"" D_CMND_CURRENTHIGH "\":\"%s\""), mqtt_data, (jsonflg)?",":"", GetStateText(flag)); + ResponseAppend_P(PSTR("%s%s\"" D_CMND_CURRENTHIGH "\":\"%s\""), (jsonflg)?",":"", GetStateText(flag)); jsonflg = true; } if (jsonflg) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s}"), mqtt_data); + ResponseAppend_P(PSTR("}")); MqttPublishPrefixTopic_P(TELE, PSTR(D_RSLT_MARGINS), MQTT_TELE_RETAIN); EnergyMqttShow(); } @@ -244,7 +243,7 @@ void EnergyMarginCheck(void) } else { energy_mplh_counter--; if (!energy_mplh_counter) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_JSON_MAXPOWERREACHED "\":\"%d%s\"}"), energy_power_u, (Settings.flag.value_units) ? " " D_UNIT_WATT : ""); + Response_P(PSTR("{\"" D_JSON_MAXPOWERREACHED "\":\"%d%s\"}"), energy_power_u, (Settings.flag.value_units) ? " " D_UNIT_WATT : ""); MqttPublishPrefixTopic_P(STAT, S_RSLT_WARNING); EnergyMqttShow(); ExecuteCommandPower(1, POWER_OFF, SRC_MAXPOWER); @@ -267,11 +266,11 @@ void EnergyMarginCheck(void) if (energy_mplr_counter) { energy_mplr_counter--; if (energy_mplr_counter) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_JSON_POWERMONITOR "\":\"%s\"}"), GetStateText(1)); + Response_P(PSTR("{\"" D_JSON_POWERMONITOR "\":\"%s\"}"), GetStateText(1)); MqttPublishPrefixTopic_P(RESULT_OR_STAT, PSTR(D_JSON_POWERMONITOR)); ExecuteCommandPower(1, POWER_ON, SRC_MAXPOWER); } else { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_JSON_MAXPOWERREACHEDRETRY "\":\"%s\"}"), GetStateText(0)); + Response_P(PSTR("{\"" D_JSON_MAXPOWERREACHEDRETRY "\":\"%s\"}"), GetStateText(0)); MqttPublishPrefixTopic_P(STAT, S_RSLT_WARNING); EnergyMqttShow(); } @@ -285,14 +284,14 @@ void EnergyMarginCheck(void) energy_daily_u = (uint16_t)(energy_daily * 1000); if (!energy_max_energy_state && (RtcTime.hour == Settings.energy_max_energy_start)) { energy_max_energy_state = 1; - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_JSON_ENERGYMONITOR "\":\"%s\"}"), GetStateText(1)); + Response_P(PSTR("{\"" D_JSON_ENERGYMONITOR "\":\"%s\"}"), GetStateText(1)); MqttPublishPrefixTopic_P(RESULT_OR_STAT, PSTR(D_JSON_ENERGYMONITOR)); ExecuteCommandPower(1, POWER_ON, SRC_MAXENERGY); } else if ((1 == energy_max_energy_state) && (energy_daily_u >= Settings.energy_max_energy)) { energy_max_energy_state = 2; dtostrfd(energy_daily, 3, mqtt_data); - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_JSON_MAXENERGYREACHED "\":\"%s%s\"}"), mqtt_data, (Settings.flag.value_units) ? " " D_UNIT_KILOWATTHOUR : ""); + Response_P(PSTR("{\"" D_JSON_MAXENERGYREACHED "\":\"%s%s\"}"), mqtt_data, (Settings.flag.value_units) ? " " D_UNIT_KILOWATTHOUR : ""); MqttPublishPrefixTopic_P(STAT, S_RSLT_WARNING); EnergyMqttShow(); ExecuteCommandPower(1, POWER_OFF, SRC_MAXENERGY); @@ -306,12 +305,12 @@ void EnergyMarginCheck(void) void EnergyMqttShow(void) { // {"Time":"2017-12-16T11:48:55","ENERGY":{"Total":0.212,"Yesterday":0.000,"Today":0.014,"Period":2.0,"Power":22.0,"Factor":1.00,"Voltage":213.6,"Current":0.100}} - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_JSON_TIME "\":\"%s\""), GetDateAndTime(DT_LOCAL).c_str()); + Response_P(PSTR("{\"" D_JSON_TIME "\":\"%s\""), GetDateAndTime(DT_LOCAL).c_str()); int tele_period_save = tele_period; tele_period = 2; EnergyShow(true); tele_period = tele_period_save; - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s}"), mqtt_data); + ResponseAppend_P(PSTR("}")); MqttPublishPrefixTopic_P(TELE, PSTR(D_RSLT_SENSOR), Settings.flag.mqtt_sensor_retain); energy_power_delta = 0; } @@ -395,6 +394,7 @@ bool EnergyCommand(void) Settings.energy_kWhtoday = energy_kWhtoday; RtcSettings.energy_kWhtoday = energy_kWhtoday; energy_daily = (float)energy_kWhtoday / 100000; + if (!RtcSettings.energy_kWhtotal && !energy_kWhtoday) { Settings.energy_kWhtotal_time = LocalTime(); } break; case 2: Settings.energy_kWhyesterday = lnum *100; @@ -403,7 +403,7 @@ bool EnergyCommand(void) RtcSettings.energy_kWhtotal = lnum *100; Settings.energy_kWhtotal = RtcSettings.energy_kWhtotal; energy_total = (float)(RtcSettings.energy_kWhtotal + energy_kWhtoday) / 100000; - if (!energy_total) { Settings.energy_kWhtotal_time = LocalTime(); } + Settings.energy_kWhtotal_time = (!energy_kWhtoday) ? LocalTime() : Midnight(); break; } } @@ -414,7 +414,7 @@ bool EnergyCommand(void) char energy_yesterday_chr[33]; dtostrfd((float)Settings.energy_kWhyesterday / 100000, Settings.flag2.energy_resolution, energy_yesterday_chr); - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"%s\":{\"" D_JSON_TOTAL "\":%s,\"" D_JSON_YESTERDAY "\":%s,\"" D_JSON_TODAY "\":%s}}"), + Response_P(PSTR("{\"%s\":{\"" D_JSON_TOTAL "\":%s,\"" D_JSON_YESTERDAY "\":%s,\"" D_JSON_TODAY "\":%s}}"), command, energy_total_chr, energy_yesterday_chr, energy_daily_chr); status_flag = true; } @@ -519,9 +519,9 @@ bool EnergyCommand(void) } if (Settings.flag.value_units) { - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_LVALUE_SPACE_UNIT, command, nvalue, GetTextIndexed(sunit, sizeof(sunit), unit, kUnitNames)); + Response_P(S_JSON_COMMAND_LVALUE_SPACE_UNIT, command, nvalue, GetTextIndexed(sunit, sizeof(sunit), unit, kUnitNames)); } else { - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_LVALUE, command, nvalue); + Response_P(S_JSON_COMMAND_LVALUE, command, nvalue); } } @@ -548,20 +548,20 @@ void EnergySnsInit(void) } #ifdef USE_WEBSERVER -const char HTTP_ENERGY_SNS1[] PROGMEM = "%s" +const char HTTP_ENERGY_SNS1[] PROGMEM = "{s}" D_VOLTAGE "{m}%s " D_UNIT_VOLT "{e}" "{s}" D_CURRENT "{m}%s " D_UNIT_AMPERE "{e}" "{s}" D_POWERUSAGE "{m}%s " D_UNIT_WATT "{e}"; -const char HTTP_ENERGY_SNS2[] PROGMEM = "%s" +const char HTTP_ENERGY_SNS2[] PROGMEM = "{s}" D_POWERUSAGE_APPARENT "{m}%s " D_UNIT_VA "{e}" "{s}" D_POWERUSAGE_REACTIVE "{m}%s " D_UNIT_VAR "{e}" "{s}" D_POWER_FACTOR "{m}%s{e}"; -const char HTTP_ENERGY_SNS3[] PROGMEM = "%s" +const char HTTP_ENERGY_SNS3[] PROGMEM = "{s}" D_FREQUENCY "{m}%s " D_UNIT_HERTZ "{e}"; -const char HTTP_ENERGY_SNS4[] PROGMEM = "%s" +const char HTTP_ENERGY_SNS4[] PROGMEM = "{s}" D_ENERGY_TODAY "{m}%s " D_UNIT_KILOWATTHOUR "{e}" "{s}" D_ENERGY_YESTERDAY "{m}%s " D_UNIT_KILOWATTHOUR "{e}" "{s}" D_ENERGY_TOTAL "{m}%s " D_UNIT_KILOWATTHOUR "{e}"; // {s} = , {m} = , {e} = @@ -637,13 +637,13 @@ void EnergyShow(bool json) } if (json) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"" D_RSLT_ENERGY "\":{\"" D_JSON_TOTAL_START_TIME "\":\"%s\",\"" D_JSON_TOTAL "\":%s,\"" D_JSON_YESTERDAY "\":%s,\"" D_JSON_TODAY "\":%s%s,\"" D_JSON_POWERUSAGE "\":%s"), - mqtt_data, GetDateAndTime(DT_ENERGY).c_str(), energy_total_chr, energy_yesterday_chr, energy_daily_chr, (show_energy_period) ? speriod : "", active_power_chr); + ResponseAppend_P(PSTR(",\"" D_RSLT_ENERGY "\":{\"" D_JSON_TOTAL_START_TIME "\":\"%s\",\"" D_JSON_TOTAL "\":%s,\"" D_JSON_YESTERDAY "\":%s,\"" D_JSON_TODAY "\":%s%s,\"" D_JSON_POWERUSAGE "\":%s"), + GetDateAndTime(DT_ENERGY).c_str(), energy_total_chr, energy_yesterday_chr, energy_daily_chr, (show_energy_period) ? speriod : "", active_power_chr); if (!energy_type_dc) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"" D_JSON_APPARENT_POWERUSAGE "\":%s,\"" D_JSON_REACTIVE_POWERUSAGE "\":%s,\"" D_JSON_POWERFACTOR "\":%s%s"), - mqtt_data, apparent_power_chr, reactive_power_chr, power_factor_chr, (!isnan(energy_frequency)) ? sfrequency : ""); + ResponseAppend_P(PSTR(",\"" D_JSON_APPARENT_POWERUSAGE "\":%s,\"" D_JSON_REACTIVE_POWERUSAGE "\":%s,\"" D_JSON_POWERFACTOR "\":%s%s"), + apparent_power_chr, reactive_power_chr, power_factor_chr, (!isnan(energy_frequency)) ? sfrequency : ""); } - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"" D_JSON_VOLTAGE "\":%s,\"" D_JSON_CURRENT "\":%s}"), mqtt_data, voltage_chr, current_chr); + ResponseAppend_P(PSTR(",\"" D_JSON_VOLTAGE "\":%s,\"" D_JSON_CURRENT "\":%s}"), voltage_chr, current_chr); #ifdef USE_DOMOTICZ if (show_energy_period) { // Only send if telemetry @@ -666,12 +666,12 @@ void EnergyShow(bool json) #endif // USE_KNX #ifdef USE_WEBSERVER } else { - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_ENERGY_SNS1, mqtt_data, voltage_chr, current_chr, active_power_chr); + WSContentSend_PD(HTTP_ENERGY_SNS1, voltage_chr, current_chr, active_power_chr); if (!energy_type_dc) { - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_ENERGY_SNS2, mqtt_data, apparent_power_chr, reactive_power_chr, power_factor_chr); - if (!isnan(energy_frequency)) { snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_ENERGY_SNS3, mqtt_data, frequency_chr); } + WSContentSend_PD(HTTP_ENERGY_SNS2, apparent_power_chr, reactive_power_chr, power_factor_chr); + if (!isnan(energy_frequency)) { WSContentSend_PD(HTTP_ENERGY_SNS3, frequency_chr); } } - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_ENERGY_SNS4, mqtt_data, energy_daily_chr, energy_yesterday_chr, energy_total_chr); + WSContentSend_PD(HTTP_ENERGY_SNS4, energy_daily_chr, energy_yesterday_chr, energy_total_chr); #endif // USE_WEBSERVER } } @@ -689,15 +689,15 @@ bool Xdrv03(uint8_t function) } else if (energy_flg) { switch (function) { + case FUNC_LOOP: + XnrgCall(FUNC_LOOP); + break; case FUNC_COMMAND: result = EnergyCommand(); break; case FUNC_SET_POWER: EnergySetPowerSteadyCounter(); break; - case FUNC_LOOP: - XnrgCall(FUNC_LOOP); - break; case FUNC_SERIAL: result = XnrgCall(FUNC_SERIAL); break; @@ -722,7 +722,7 @@ bool Xsns03(uint8_t function) EnergyShow(true); break; #ifdef USE_WEBSERVER - case FUNC_WEB_APPEND: + case FUNC_WEB_SENSOR: EnergyShow(false); break; #endif // USE_WEBSERVER diff --git a/sonoff/xdrv_04_light.ino b/sonoff/xdrv_04_light.ino index 0b027335b..7597415d6 100644 --- a/sonoff/xdrv_04_light.ino +++ b/sonoff/xdrv_04_light.ino @@ -56,7 +56,7 @@ #define XDRV_04 4 -#define WS2812_SCHEMES 7 // Number of additional WS2812 schemes supported by xdrv_ws2812.ino +const uint8_t WS2812_SCHEMES = 7; // Number of additional WS2812 schemes supported by xdrv_ws2812.ino enum LightCommands { CMND_COLOR, CMND_COLORTEMPERATURE, CMND_DIMMER, CMND_LED, CMND_LEDTABLE, CMND_FADE, @@ -70,23 +70,23 @@ const char kLightCommands[] PROGMEM = struct LRgbColor { uint8_t R, G, B; }; -#define MAX_FIXED_COLOR 12 +const uint8_t MAX_FIXED_COLOR = 12; const LRgbColor kFixedColor[MAX_FIXED_COLOR] PROGMEM = { 255,0,0, 0,255,0, 0,0,255, 228,32,0, 0,228,32, 0,32,228, 188,64,0, 0,160,96, 160,32,240, 255,255,0, 255,0,170, 255,255,255 }; struct LWColor { uint8_t W; }; -#define MAX_FIXED_WHITE 4 +const uint8_t MAX_FIXED_WHITE = 4; const LWColor kFixedWhite[MAX_FIXED_WHITE] PROGMEM = { 0, 255, 128, 32 }; struct LCwColor { uint8_t C, W; }; -#define MAX_FIXED_COLD_WARM 4 +const uint8_t MAX_FIXED_COLD_WARM = 4; const LCwColor kFixedColdWarm[MAX_FIXED_COLD_WARM] PROGMEM = { 0,0, 255,0, 0,255, 128,128 }; -uint8_t ledTable[] = { +const uint8_t ledTable[] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, @@ -109,6 +109,9 @@ uint8_t light_current_color[5]; uint8_t light_new_color[5]; uint8_t light_last_color[5]; uint8_t light_signal_color[5]; +uint8_t light_color_remap[5]; + +bool light_ct_rgb_linked; uint8_t light_wheel = 0; uint8_t light_subtype = 0; @@ -129,11 +132,11 @@ unsigned long strip_timer_counter = 0; // Bars and Gradient * Arilux LC11 Rf support stripped from RCSwitch library \*********************************************************************************************/ -#define ARILUX_RF_TIME_AVOID_DUPLICATE 1000 // Milliseconds +const uint32_t ARILUX_RF_TIME_AVOID_DUPLICATE = 1000; // Milliseconds -#define ARILUX_RF_MAX_CHANGES 51 // Pulses (sync + 2 x 24 bits) -#define ARILUX_RF_SEPARATION_LIMIT 4300 // Microseconds -#define ARILUX_RF_RECEIVE_TOLERANCE 60 // Percentage +const uint8_t ARILUX_RF_MAX_CHANGES = 51; // Pulses (sync + 2 x 24 bits) +const uint32_t ARILUX_RF_SEPARATION_LIMIT = 4300; // Microseconds +const uint32_t ARILUX_RF_RECEIVE_TOLERANCE = 60; // Percentage unsigned int arilux_rf_timings[ARILUX_RF_MAX_CHANGES]; @@ -202,8 +205,7 @@ void AriluxRfHandler(void) } uint16_t stored_hostcode = Settings.rf_code[1][6] << 8 | Settings.rf_code[1][7]; - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_RFR D_HOST D_CODE " 0x%04X, " D_RECEIVED " 0x%06X"), stored_hostcode, arilux_rf_received_value); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_RFR D_HOST D_CODE " 0x%04X, " D_RECEIVED " 0x%06X"), stored_hostcode, arilux_rf_received_value); if (hostcode == stored_hostcode) { char command[33]; @@ -403,8 +405,7 @@ void SM16716_Update(uint8_t duty_r, uint8_t duty_g, uint8_t duty_b) uint8_t sm16716_should_enable = (duty_r | duty_g | duty_b); if (!sm16716_enabled && sm16716_should_enable) { #ifdef D_LOG_SM16716 - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_SM16716 "turning color on")); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_SM16716 "turning color on")); #endif // D_LOG_SM16716 sm16716_enabled = 1; digitalWrite(sm16716_pin_sel, HIGH); @@ -415,26 +416,22 @@ void SM16716_Update(uint8_t duty_r, uint8_t duty_g, uint8_t duty_b) } else if (sm16716_enabled && !sm16716_should_enable) { #ifdef D_LOG_SM16716 - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_SM16716 "turning color off")); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_SM16716 "turning color off")); #endif // D_LOG_SM16716 sm16716_enabled = 0; digitalWrite(sm16716_pin_sel, LOW); } } #ifdef D_LOG_SM16716 - snprintf_P(log_data, sizeof(log_data), - PSTR(D_LOG_SM16716 "Update; rgb=%02x%02x%02x"), - duty_r, duty_g, duty_b); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_SM16716 "Update; rgb=%02x%02x%02x"), duty_r, duty_g, duty_b); #endif // D_LOG_SM16716 // send start bit SM16716_SendBit(1); - // send 24-bit rgb data SM16716_SendByte(duty_r); SM16716_SendByte(duty_g); SM16716_SendByte(duty_b); + // send a 'do it' pulse // (if multiple chips are chained, each one processes the 1st '1rgb' 25-bit block and // passes on the rest, right until the one starting with 0) @@ -451,10 +448,7 @@ bool SM16716_ModuleSelected(void) sm16716_pin_dat = pin[GPIO_SM16716_DAT]; sm16716_pin_sel = pin[GPIO_SM16716_SEL]; #ifdef D_LOG_SM16716 - snprintf_P(log_data, sizeof(log_data), - PSTR(D_LOG_SM16716 "ModuleSelected; clk_pin=%d, dat_pin=%d)"), - sm16716_pin_clk, sm16716_pin_dat); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_SM16716 "ModuleSelected; clk_pin=%d, dat_pin=%d)"), sm16716_pin_clk, sm16716_pin_dat); #endif // D_LOG_SM16716 return (sm16716_pin_clk < 99) && (sm16716_pin_dat < 99); } @@ -563,6 +557,39 @@ void LightInit(void) light_power = 0; light_update = 1; light_wakeup_active = 0; + + LightUpdateColorMapping(); +} + +void LightUpdateColorMapping(void) +{ + uint8_t param = Settings.param[P_RGB_REMAP] & 127; + if(param > 119){ + param = 0; + } + uint8_t tmp[] = {0,1,2,3,4}; + light_color_remap[0] = tmp[param / 24]; + for (uint8_t i = param / 24; i<4; ++i){ + tmp[i] = tmp[i+1]; + } + param = param % 24; + light_color_remap[1] = tmp[(param / 6)]; + for (uint8_t i = param / 6; i<3; ++i){ + tmp[i] = tmp[i+1]; + } + param = param % 6; + light_color_remap[2] = tmp[(param / 2)]; + for (uint8_t i = param / 2; i<2; ++i){ + tmp[i] = tmp[i+1]; + } + param = param % 2; + light_color_remap[3] = tmp[param]; + light_color_remap[4] = tmp[1-param]; + + light_ct_rgb_linked = !(Settings.param[P_RGB_REMAP] & 128); + + light_update = 1; + //AddLog_P2(LOG_LEVEL_DEBUG, PSTR("%d colors: %d %d %d %d %d") ,Settings.param[P_RGB_REMAP], light_color_remap[0],light_color_remap[1],light_color_remap[2],light_color_remap[3],light_color_remap[4]); } void LightSetColorTemp(uint16_t ct) @@ -584,9 +611,11 @@ void LightSetColorTemp(uint16_t ct) Settings.light_color[1] = (uint8_t)icold; } else if (LST_RGBWC == light_subtype) { - Settings.light_color[0] = 0; - Settings.light_color[1] = 0; - Settings.light_color[2] = 0; + if(light_ct_rgb_linked){ + Settings.light_color[0] = 0; + Settings.light_color[1] = 0; + Settings.light_color[2] = 0; + } Settings.light_color[3] = (uint8_t)icold; Settings.light_color[4] = (uint8_t)iwarm; } else { @@ -668,8 +697,7 @@ void LightSetSignal(uint16_t lo, uint16_t hi, uint16_t value) signal = 255; } } -// snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_DEBUG "Light signal %d"), signal); -// AddLog(LOG_LEVEL_DEBUG); +// AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "Light signal %d"), signal); light_signal_color[0] = signal; light_signal_color[1] = 255 - signal; light_signal_color[2] = 0; @@ -712,43 +740,42 @@ void LightState(uint8_t append) int16_t h,s,b; if (append) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,"), mqtt_data); + ResponseAppend_P(PSTR(",")); } else { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{")); + Response_P(PSTR("{")); } GetPowerDevice(scommand, light_device, sizeof(scommand), Settings.flag.device_index_enable); - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s\"%s\":\"%s\",\"" D_CMND_DIMMER "\":%d"), - mqtt_data, scommand, GetStateText(light_power), Settings.light_dimmer); + ResponseAppend_P(PSTR("\"%s\":\"%s\",\"" D_CMND_DIMMER "\":%d"), scommand, GetStateText(light_power), Settings.light_dimmer); if (light_subtype > LST_SINGLE) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"" D_CMND_COLOR "\":\"%s\""), mqtt_data, LightGetColor(0, scolor)); + ResponseAppend_P(PSTR(",\"" D_CMND_COLOR "\":\"%s\""), LightGetColor(0, scolor)); // Add status for HSB LightGetHsb(&hsb[0],&hsb[1],&hsb[2], false); // Scale these percentages up to the numbers expected by the client h = round(hsb[0] * 360); s = round(hsb[1] * 100); b = round(hsb[2] * 100); - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"" D_CMND_HSBCOLOR "\":\"%d,%d,%d\""), mqtt_data, h,s,b); + ResponseAppend_P(PSTR(",\"" D_CMND_HSBCOLOR "\":\"%d,%d,%d\""), h,s,b); // Add status for each channel - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"" D_CMND_CHANNEL "\":[" ), mqtt_data); + ResponseAppend_P(PSTR(",\"" D_CMND_CHANNEL "\":[" )); for (uint8_t i = 0; i < light_subtype; i++) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s%s%d" ), mqtt_data, (i > 0 ? "," : ""), light_current_color[i] * 100 / 255); + ResponseAppend_P(PSTR("%s%d" ), (i > 0 ? "," : ""), light_current_color[i] * 100 / 255); } - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s]" ), mqtt_data); + ResponseAppend_P(PSTR("]")); } if ((LST_COLDWARM == light_subtype) || (LST_RGBWC == light_subtype)) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"" D_CMND_COLORTEMPERATURE "\":%d"), mqtt_data, LightGetColorTemp()); + ResponseAppend_P(PSTR(",\"" D_CMND_COLORTEMPERATURE "\":%d"), LightGetColorTemp()); } if (append) { if (light_subtype >= LST_RGB) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"" D_CMND_SCHEME "\":%d"), mqtt_data, Settings.light_scheme); + ResponseAppend_P(PSTR(",\"" D_CMND_SCHEME "\":%d"), Settings.light_scheme); } if (LT_WS2812 == light_type) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"" D_CMND_WIDTH "\":%d"), mqtt_data, Settings.light_width); + ResponseAppend_P(PSTR(",\"" D_CMND_WIDTH "\":%d"), Settings.light_width); } - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"" D_CMND_FADE "\":\"%s\",\"" D_CMND_SPEED "\":%d,\"" D_CMND_LEDTABLE "\":\"%s\""), - mqtt_data, GetStateText(Settings.light_fade), Settings.light_speed, GetStateText(Settings.light_correction)); + ResponseAppend_P(PSTR(",\"" D_CMND_FADE "\":\"%s\",\"" D_CMND_SPEED "\":%d,\"" D_CMND_LEDTABLE "\":\"%s\""), + GetStateText(Settings.light_fade), Settings.light_speed, GetStateText(Settings.light_correction)); } else { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s}"), mqtt_data); + ResponseAppend_P(PSTR("}")); } } @@ -765,11 +792,7 @@ void LightPreparePower(void) #ifdef USE_DOMOTICZ DomoticzUpdatePowerState(light_device); #endif // USE_DOMOTICZ - if (Settings.flag3.hass_tele_on_power) { - mqtt_data[0] = '\0'; - MqttShowState(); - MqttPublishPrefixTopic_P(TELE, PSTR(D_RSLT_STATE), MQTT_TELE_RETAIN); - } + if (Settings.flag3.hass_tele_on_power) { MqttPublishTeleState(); } LightState(0); } @@ -896,7 +919,11 @@ void LightAnimate(void) } } else { +#ifdef PWM_LIGHTSCHEME0_IGNORE_SLEEP sleep = (LS_POWER == Settings.light_scheme) ? Settings.sleep : 0; // If no animation then use sleep as is +#else + sleep = 0; +#endif // PWM_LIGHTSCHEME0_IGNORE_SLEEP switch (Settings.light_scheme) { case LS_POWER: LightSetDimmer(Settings.light_dimmer); @@ -921,7 +948,7 @@ void LightAnimate(void) light_new_color[i] = light_current_color[i]; } } else { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_WAKEUP "\":\"" D_JSON_DONE "\"}")); + Response_P(PSTR("{\"" D_CMND_WAKEUP "\":\"" D_JSON_DONE "\"}")); MqttPublishPrefixTopic_P(TELE, PSTR(D_CMND_WAKEUP)); light_wakeup_active = 0; Settings.light_scheme = LS_POWER; @@ -947,10 +974,8 @@ void LightAnimate(void) } if ((Settings.light_scheme < LS_MAX) || !light_power) { - for (uint8_t i = 0; i < light_subtype; i++) { - if (light_last_color[i] != light_new_color[i]) { + if (memcmp(light_last_color, light_new_color, light_subtype)) { light_update = 1; - } } if (light_update) { light_update = 0; @@ -958,14 +983,23 @@ void LightAnimate(void) light_last_color[i] = light_new_color[i]; cur_col[i] = light_last_color[i]*Settings.rgbwwTable[i]/255; cur_col[i] = (Settings.light_correction) ? ledTable[cur_col[i]] : cur_col[i]; + } + + // color remapping + uint8_t orig_col[5]; + memcpy(orig_col, cur_col, sizeof(orig_col)); + for (uint8_t i = 0; i < 5; i++) { + cur_col[i] = orig_col[light_color_remap[i]]; + } + + for (uint8_t i = 0; i < light_subtype; i++) { if (light_type < LT_PWM6) { if (pin[GPIO_PWM1 +i] < 99) { if (cur_col[i] > 0xFC) { cur_col[i] = 0xFC; // Fix unwanted blinking and PWM watchdog errors for values close to pwm_range (H801, Arilux and BN-SZ01) } uint16_t curcol = cur_col[i] * (Settings.pwm_range / 255); -// snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_APPLICATION "Cur_Col%d %d, CurCol %d"), i, cur_col[i], curcol); -// AddLog(LOG_LEVEL_DEBUG); +// AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION "Cur_Col%d %d, CurCol %d"), i, cur_col[i], curcol); analogWrite(pin[GPIO_PWM1 +i], bitRead(pwm_inverted, i) ? Settings.pwm_range - curcol : curcol); } } @@ -993,8 +1027,7 @@ void LightAnimate(void) cur_col[i] = 0xFC; // Fix unwanted blinking and PWM watchdog errors for values close to pwm_range (H801, Arilux and BN-SZ01) } uint16_t curcol = cur_col[i] * (Settings.pwm_range / 255); -// snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_APPLICATION "Cur_Col%d %d, CurCol %d"), i, cur_col[i], curcol); -// AddLog(LOG_LEVEL_DEBUG); +// AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION "Cur_Col%d %d, CurCol %d"), i, cur_col[i], curcol); analogWrite(pin[GPIO_PWM1 +i-3], bitRead(pwm_inverted, i-3) ? Settings.pwm_range - curcol : curcol); } } @@ -1112,8 +1145,10 @@ void LightHsbToRgb(void) light_current_color[0] = (uint8_t)(r * 255.0f); light_current_color[1] = (uint8_t)(g * 255.0f); light_current_color[2] = (uint8_t)(b * 255.0f); - light_current_color[3] = 0; - light_current_color[4] = 0; + if(light_ct_rgb_linked){ + light_current_color[3] = 0; + light_current_color[4] = 0; + } } /********************************************************************************************/ @@ -1196,9 +1231,9 @@ bool LightColorEntry(char *buffer, uint8_t buffer_length) } memset(&light_entry_color, 0x00, sizeof(light_entry_color)); - if (strstr(buffer, ",")) { // Decimal entry + if (strstr(buffer, ",") != nullptr) { // Decimal entry int8_t i = 0; - for (str = strtok_r(buffer, ",", &p); str && i < 6; str = strtok_r(NULL, ",", &p)) { + for (str = strtok_r(buffer, ",", &p); str && i < 6; str = strtok_r(nullptr, ",", &p)) { if (i < 5) { light_entry_color[i++] = atoi(str); } @@ -1206,7 +1241,7 @@ bool LightColorEntry(char *buffer, uint8_t buffer_length) entry_type = 2; // Decimal } else if (((2 * light_subtype) == buffer_length) || (buffer_length > 3)) { // Hexadecimal entry - for (uint8_t i = 0; i < buffer_length / 2; i++) { + for (uint8_t i = 0; i < tmin((uint)(buffer_length / 2), sizeof(light_entry_color)); i++) { strlcpy(scolor, buffer + (i *2), 3); light_entry_color[i] = (uint8_t)strtol(scolor, &p, 16); } @@ -1283,7 +1318,7 @@ bool LightCommand(void) } } if (!valid_entry && (XdrvMailbox.index <= 2)) { - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, LightGetColor(0, scolor)); + Response_P(S_JSON_COMMAND_SVALUE, command, LightGetColor(0, scolor)); } if (XdrvMailbox.index >= 3) { scolor[0] = '\0'; @@ -1294,7 +1329,7 @@ bool LightCommand(void) snprintf_P(scolor, 25, PSTR("%s%02X"), scolor, Settings.ws_color[XdrvMailbox.index -3][i]); } } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_INDEX_SVALUE, command, XdrvMailbox.index, scolor); + Response_P(S_JSON_COMMAND_INDEX_SVALUE, command, XdrvMailbox.index, scolor); } } else if ((CMND_CHANNEL == command_code) && (XdrvMailbox.index > 0) && (XdrvMailbox.index <= light_subtype ) ) { @@ -1304,22 +1339,22 @@ bool LightCommand(void) LightSetColor(); coldim = true; } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_INDEX_NVALUE, command, XdrvMailbox.index, light_current_color[XdrvMailbox.index -1] * 100 / 255); + Response_P(S_JSON_COMMAND_INDEX_NVALUE, command, XdrvMailbox.index, light_current_color[XdrvMailbox.index -1] * 100 / 255); } else if ((CMND_HSBCOLOR == command_code) && ( light_subtype >= LST_RGB)) { bool validHSB = (XdrvMailbox.data_len > 0); if (validHSB) { uint16_t HSB[3]; - if (strstr(XdrvMailbox.data, ",")) { // Command with 3 comma separated parameters, Hue (0 0) && (XdrvMailbox.payload <= WS2812_MAX_LEDS)) { @@ -1378,25 +1413,25 @@ bool LightCommand(void) Ws2812Clear(); light_update = 1; } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_NVALUE, command, Settings.light_pixels); + Response_P(S_JSON_COMMAND_NVALUE, command, Settings.light_pixels); } else if ((CMND_ROTATION == command_code) && (LT_WS2812 == light_type)) { if ((XdrvMailbox.payload >= 0) && (XdrvMailbox.payload < Settings.light_pixels)) { Settings.light_rotation = XdrvMailbox.payload; } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_NVALUE, command, Settings.light_rotation); + Response_P(S_JSON_COMMAND_NVALUE, command, Settings.light_rotation); } else if ((CMND_WIDTH == command_code) && (LT_WS2812 == light_type) && (XdrvMailbox.index > 0) && (XdrvMailbox.index <= 4)) { if (1 == XdrvMailbox.index) { if ((XdrvMailbox.payload >= 0) && (XdrvMailbox.payload <= 4)) { Settings.light_width = XdrvMailbox.payload; } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_NVALUE, command, Settings.light_width); + Response_P(S_JSON_COMMAND_NVALUE, command, Settings.light_width); } else { if ((XdrvMailbox.payload > 0) && (XdrvMailbox.payload < 32)) { Settings.ws_width[XdrvMailbox.index -2] = XdrvMailbox.payload; } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_INDEX_NVALUE, command, XdrvMailbox.index, Settings.ws_width[XdrvMailbox.index -2]); + Response_P(S_JSON_COMMAND_INDEX_NVALUE, command, XdrvMailbox.index, Settings.ws_width[XdrvMailbox.index -2]); } } #endif // USE_WS2812 ************************************************************************ @@ -1416,13 +1451,9 @@ bool LightCommand(void) LightPowerOn(); strip_timer_counter = 0; // Publish state message for Hass - if (Settings.flag3.hass_tele_on_power) { - mqtt_data[0] = '\0'; - MqttShowState(); - MqttPublishPrefixTopic_P(TELE, PSTR(D_RSLT_STATE), MQTT_TELE_RETAIN); - } + if (Settings.flag3.hass_tele_on_power) { MqttPublishTeleState(); } } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_NVALUE, command, Settings.light_scheme); + Response_P(S_JSON_COMMAND_NVALUE, command, Settings.light_scheme); } else if (CMND_WAKEUP == command_code) { if ((XdrvMailbox.payload >= 0) && (XdrvMailbox.payload <= 100)) { @@ -1431,7 +1462,7 @@ bool LightCommand(void) light_wakeup_active = 3; Settings.light_scheme = LS_WAKEUP; LightPowerOn(); - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, D_JSON_STARTED); + Response_P(S_JSON_COMMAND_SVALUE, command, D_JSON_STARTED); } else if ((CMND_COLORTEMPERATURE == command_code) && ((LST_COLDWARM == light_subtype) || (LST_RGBWC == light_subtype))) { // ColorTemp if (option != '\0') { @@ -1447,7 +1478,7 @@ bool LightCommand(void) LightSetColorTemp(XdrvMailbox.payload); coldim = true; } else { - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_NVALUE, command, LightGetColorTemp()); + Response_P(S_JSON_COMMAND_NVALUE, command, LightGetColorTemp()); } } else if (CMND_DIMMER == command_code) { @@ -1462,7 +1493,7 @@ bool LightCommand(void) light_update = 1; coldim = true; } else { - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_NVALUE, command, Settings.light_dimmer); + Response_P(S_JSON_COMMAND_NVALUE, command, Settings.light_dimmer); } } else if (CMND_LEDTABLE == command_code) { @@ -1478,22 +1509,22 @@ bool LightCommand(void) } light_update = 1; } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, GetStateText(Settings.light_correction)); + Response_P(S_JSON_COMMAND_SVALUE, command, GetStateText(Settings.light_correction)); } else if (CMND_RGBWWTABLE == command_code) { bool validtable = (XdrvMailbox.data_len > 0); char scolor[25]; if (validtable) { - if (strstr(XdrvMailbox.data, ",")) { // Command with up to 5 comma separated parameters + if (strstr(XdrvMailbox.data, ",") != nullptr) { // Command with up to 5 comma separated parameters for (int i = 0; i < LST_RGBWC; i++) { char *substr; if (0 == i) { substr = strtok(XdrvMailbox.data, ","); } else { - substr = strtok(NULL, ","); + substr = strtok(nullptr, ","); } - if (substr != NULL) { + if (substr != nullptr) { Settings.rgbwwTable[i] = atoi(substr); } } @@ -1504,7 +1535,7 @@ bool LightCommand(void) for (uint8_t i = 0; i < LST_RGBWC; i++) { snprintf_P(scolor, 25, PSTR("%s%s%d"), scolor, (i > 0) ? "," : "", Settings.rgbwwTable[i]); } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_INDEX_SVALUE, command, XdrvMailbox.index, scolor); + Response_P(S_JSON_COMMAND_INDEX_SVALUE, command, XdrvMailbox.index, scolor); } else if (CMND_FADE == command_code) { switch (XdrvMailbox.payload) { @@ -1516,7 +1547,7 @@ bool LightCommand(void) Settings.light_fade ^= 1; break; } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, GetStateText(Settings.light_fade)); + Response_P(S_JSON_COMMAND_SVALUE, command, GetStateText(Settings.light_fade)); } else if (CMND_SPEED == command_code) { // 1 - fast, 20 - very slow if (('+' == option) && (Settings.light_speed > 1)) { @@ -1528,20 +1559,19 @@ bool LightCommand(void) if ((XdrvMailbox.payload > 0) && (XdrvMailbox.payload <= STATES)) { Settings.light_speed = XdrvMailbox.payload; } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_NVALUE, command, Settings.light_speed); + Response_P(S_JSON_COMMAND_NVALUE, command, Settings.light_speed); } else if (CMND_WAKEUPDURATION == command_code) { if ((XdrvMailbox.payload > 0) && (XdrvMailbox.payload < 3001)) { Settings.light_wakeup = XdrvMailbox.payload; light_wakeup_active = 0; } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_NVALUE, command, Settings.light_wakeup); + Response_P(S_JSON_COMMAND_NVALUE, command, Settings.light_wakeup); } else if (CMND_UNDOCA == command_code) { // Theos legacy status LightGetColor(1, scolor); scolor[6] = '\0'; // RGB only - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,%d,%d,%d,%d,%d"), - scolor, Settings.light_fade, Settings.light_correction, Settings.light_scheme, Settings.light_speed, Settings.light_width); + Response_P(PSTR("%s,%d,%d,%d,%d,%d"), scolor, Settings.light_fade, Settings.light_correction, Settings.light_scheme, Settings.light_speed, Settings.light_width); MqttPublishPrefixTopic_P(STAT, XdrvMailbox.topic); mqtt_data[0] = '\0'; } diff --git a/sonoff/xdrv_05_irremote.ino b/sonoff/xdrv_05_irremote.ino index 32a7d054b..8b6a0de1c 100644 --- a/sonoff/xdrv_05_irremote.ino +++ b/sonoff/xdrv_05_irremote.ino @@ -26,6 +26,8 @@ #include +enum IrErrors { IE_NO_ERROR, IE_INVALID_RAWDATA, IE_INVALID_JSON, IE_SYNTAX_IRSEND, IE_SYNTAX_IRHVAC }; + enum IrRemoteCommands { CMND_IRSEND, CMND_IRHVAC }; const char kIrRemoteCommands[] PROGMEM = D_CMND_IRSEND "|" D_CMND_IRHVAC ; @@ -42,19 +44,19 @@ enum IrHvacVendors { VNDR_TOSHIBA, VNDR_MITSUBISHI, VNDR_LG, VNDR_FUJITSU }; const char kIrHvacVendors[] PROGMEM = "Toshiba|Mitsubishi|LG|Fujitsu" ; // HVAC TOSHIBA_ -#define HVAC_TOSHIBA_HDR_MARK 4400 -#define HVAC_TOSHIBA_HDR_SPACE 4300 -#define HVAC_TOSHIBA_BIT_MARK 543 -#define HVAC_TOSHIBA_ONE_SPACE 1623 -#define HVAC_MISTUBISHI_ZERO_SPACE 472 -#define HVAC_TOSHIBA_RPT_MARK 440 -#define HVAC_TOSHIBA_RPT_SPACE 7048 // Above original iremote limit -#define HVAC_TOSHIBA_DATALEN 9 +const uint16_t HVAC_TOSHIBA_HDR_MARK = 4400; +const uint16_t HVAC_TOSHIBA_HDR_SPACE = 4300; +const uint16_t HVAC_TOSHIBA_BIT_MARK = 543; +const uint16_t HVAC_TOSHIBA_ONE_SPACE = 1623; +const uint16_t HVAC_MISTUBISHI_ZERO_SPACE = 472; +const uint16_t HVAC_TOSHIBA_RPT_MARK = 440; +const uint16_t HVAC_TOSHIBA_RPT_SPACE = 7048; // Above original iremote limit +const uint8_t HVAC_TOSHIBA_DATALEN = 9; // HVAC LG -#define HVAC_LG_DATALEN 7 +const uint8_t HVAC_LG_DATALEN = 7; -IRMitsubishiAC *mitsubir = NULL; +IRMitsubishiAC *mitsubir = nullptr; const char kFanSpeedOptions[] = "A12345S"; const char kHvacModeOptions[] = "HDCA"; @@ -66,7 +68,7 @@ const char kHvacModeOptions[] = "HDCA"; #include -IRsend *irsend = NULL; +IRsend *irsend = nullptr; bool irsend_active = false; void IrSendInit(void) @@ -79,18 +81,38 @@ void IrSendInit(void) #endif //USE_IR_HVAC } +char* IrUint64toHex(uint64_t value, char *str, uint16_t bits) +{ + ulltoa(value, str, 16); // Get 64bit value + + int fill = 8; + if ((bits > 3) && (bits < 65)) { + fill = bits / 4; // Max 16 + if (bits % 4) { fill++; } + } + int len = strlen(str); + fill -= len; + if (fill > 0) { + memmove(str + fill, str, len +1); + memset(str, '0', fill); + } + memmove(str + 2, str, strlen(str) +1); + str[0] = '0'; + str[1] = 'x'; + return str; +} + #ifdef USE_IR_RECEIVE /*********************************************************************************************\ * IR Receive \*********************************************************************************************/ -#define IR_RCV_SAVE_BUFFER 0 // 0 = do not use buffer, 1 = use buffer for decoding - -#define IR_TIME_AVOID_DUPLICATE 500 // Milliseconds +const bool IR_RCV_SAVE_BUFFER = false; // false = do not use buffer, true = use buffer for decoding +const uint32_t IR_TIME_AVOID_DUPLICATE = 500; // Milliseconds #include -IRrecv *irrecv = NULL; +IRrecv *irrecv = nullptr; unsigned long ir_lasttime = 0; @@ -107,16 +129,16 @@ void IrReceiveInit(void) void IrReceiveCheck(void) { char sirtype[14]; // Max is AIWA_RC_T501 - char stemp[16]; int8_t iridx = 0; decode_results results; if (irrecv->decode(&results)) { + char hvalue[64]; + IrUint64toHex(results.value, hvalue, results.bits); // Get 64bit value as hex 0x00123456 - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_IRR "Echo %d, RawLen %d, Overflow %d, Bits %d, Value %08X, Decode %d"), - irsend_active, results.rawlen, results.overflow, results.bits, results.value, results.decode_type); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_IRR "Echo %d, RawLen %d, Overflow %d, Bits %d, Value %s, Decode %d"), + irsend_active, results.rawlen, results.overflow, results.bits, hvalue, results.decode_type); unsigned long now = millis(); // if ((now - ir_lasttime > IR_TIME_AVOID_DUPLICATE) && (UNKNOWN != results.decode_type) && (results.bits > 0)) { @@ -124,27 +146,26 @@ void IrReceiveCheck(void) ir_lasttime = now; iridx = results.decode_type; - if ((iridx < 0) || (iridx > 14)) { - iridx = 0; // UNKNOWN - } + if ((iridx < 0) || (iridx > 14)) { iridx = 0; } // UNKNOWN + char svalue[64]; if (Settings.flag.ir_receive_decimal) { - snprintf_P(stemp, sizeof(stemp), PSTR("%u"), (uint32_t)results.value); + ulltoa(results.value, svalue, 10); } else { - snprintf_P(stemp, sizeof(stemp), PSTR("\"%lX\""), (uint32_t)results.value); + snprintf_P(svalue, sizeof(svalue), PSTR("\"%s\""), hvalue); } - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_JSON_IRRECEIVED "\":{\"" D_JSON_IR_PROTOCOL "\":\"%s\",\"" D_JSON_IR_BITS "\":%d,\"" D_JSON_IR_DATA "\":%s"), - GetTextIndexed(sirtype, sizeof(sirtype), iridx, kIrRemoteProtocols), results.bits, stemp); + Response_P(PSTR("{\"" D_JSON_IRRECEIVED "\":{\"" D_JSON_IR_PROTOCOL "\":\"%s\",\"" D_JSON_IR_BITS "\":%d,\"" D_JSON_IR_DATA "\":%s"), + GetTextIndexed(sirtype, sizeof(sirtype), iridx, kIrRemoteProtocols), results.bits, svalue); if (Settings.flag3.receive_raw) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"" D_JSON_IR_RAWDATA "\":["), mqtt_data); + ResponseAppend_P(PSTR(",\"" D_JSON_IR_RAWDATA "\":[")); uint16_t i; for (i = 1; i < results.rawlen; i++) { - if (i > 1) { snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,"), mqtt_data); } + if (i > 1) { ResponseAppend_P(PSTR(",")); } uint32_t usecs; for (usecs = results.rawbuf[i] * kRawTick; usecs > UINT16_MAX; usecs -= UINT16_MAX) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s%d,0,"), mqtt_data, UINT16_MAX); + ResponseAppend_P(PSTR("%d,0,"), UINT16_MAX); } - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s%d"), mqtt_data, usecs); + ResponseAppend_P(PSTR("%d"), usecs); if (strlen(mqtt_data) > sizeof(mqtt_data) - 40) { break; } // Quit if char string becomes too long } uint16_t extended_length = results.rawlen - 1; @@ -153,10 +174,10 @@ void IrReceiveCheck(void) // Add two extra entries for multiple larger than UINT16_MAX it is. extended_length += (usecs / (UINT16_MAX + 1)) * 2; } - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s],\"" D_JSON_IR_RAWDATA "Info\":[%d,%d,%d]"), mqtt_data, extended_length, i -1, results.overflow); + ResponseAppend_P(PSTR("],\"" D_JSON_IR_RAWDATA "Info\":[%d,%d,%d]"), extended_length, i -1, results.overflow); } - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s}}"), mqtt_data); + ResponseAppend_P(PSTR("}}")); MqttPublishPrefixTopic_P(RESULT_OR_TELE, PSTR(D_JSON_IRRECEIVED)); if (iridx) { @@ -182,7 +203,7 @@ void IrReceiveCheck(void) TOSHIBA ********************/ -bool IrHvacToshiba(const char *HVAC_Mode, const char *HVAC_FanMode, bool HVAC_Power, int HVAC_Temp) +uint8_t IrHvacToshiba(const char *HVAC_Mode, const char *HVAC_FanMode, bool HVAC_Power, int HVAC_Temp) { uint16_t rawdata[2 + 2 * 8 * HVAC_TOSHIBA_DATALEN + 2]; uint8_t data[HVAC_TOSHIBA_DATALEN] = {0xF2, 0x0D, 0x03, 0xFC, 0x01, 0x00, 0x00, 0x00, 0x00}; @@ -190,14 +211,14 @@ bool IrHvacToshiba(const char *HVAC_Mode, const char *HVAC_FanMode, bool HVAC_Po char *p; uint8_t mode; - if (HVAC_Mode == NULL) { + if (HVAC_Mode == nullptr) { p = (char *)kHvacModeOptions; // default HVAC_HOT } else { p = strchr(kHvacModeOptions, toupper(HVAC_Mode[0])); } if (!p) { - return true; + return IE_SYNTAX_IRHVAC; } data[6] = (p - kHvacModeOptions) ^ 0x03; // HOT = 0x03, DRY = 0x02, COOL = 0x01, AUTO = 0x00 @@ -205,14 +226,14 @@ bool IrHvacToshiba(const char *HVAC_Mode, const char *HVAC_FanMode, bool HVAC_Po data[6] = (uint8_t)0x07; // Turn OFF HVAC } - if (HVAC_FanMode == NULL) { + if (HVAC_FanMode == nullptr) { p = (char *)kFanSpeedOptions; // default FAN_SPEED_AUTO } else { p = strchr(kFanSpeedOptions, toupper(HVAC_FanMode[0])); } if (!p) { - return true; + return IE_SYNTAX_IRHVAC; } mode = p - kFanSpeedOptions + 1; if ((1 == mode) || (7 == mode)) { @@ -269,7 +290,7 @@ bool IrHvacToshiba(const char *HVAC_Mode, const char *HVAC_FanMode, bool HVAC_Po irsend->sendRaw(rawdata, i, 38); // interrupts(); - return false; + return IE_NO_ERROR; } @@ -277,35 +298,35 @@ bool IrHvacToshiba(const char *HVAC_Mode, const char *HVAC_FanMode, bool HVAC_Po MITSUBISHI ********************/ -bool IrHvacMitsubishi(const char *HVAC_Mode, const char *HVAC_FanMode, bool HVAC_Power, int HVAC_Temp) +uint8_t IrHvacMitsubishi(const char *HVAC_Mode, const char *HVAC_FanMode, bool HVAC_Power, int HVAC_Temp) { char *p; uint8_t mode; mitsubir->stateReset(); - if (HVAC_Mode == NULL) { + if (HVAC_Mode == nullptr) { p = (char *)kHvacModeOptions; // default HVAC_HOT } else { p = strchr(kHvacModeOptions, toupper(HVAC_Mode[0])); } if (!p) { - return true; + return IE_SYNTAX_IRHVAC; } mode = (p - kHvacModeOptions + 1) << 3; // HOT = 0x08, DRY = 0x10, COOL = 0x18, AUTO = 0x20 mitsubir->setMode(mode); mitsubir->setPower(HVAC_Power); - if (HVAC_FanMode == NULL) { + if (HVAC_FanMode == nullptr) { p = (char *)kFanSpeedOptions; // default FAN_SPEED_AUTO } else { p = strchr(kFanSpeedOptions, toupper(HVAC_FanMode[0])); } if (!p) { - return true; + return IE_SYNTAX_IRHVAC; } mode = p - kFanSpeedOptions; // AUTO = 0, SPEED = 1 .. 5, SILENT = 6 mitsubir->setFan(mode); @@ -314,11 +335,10 @@ bool IrHvacMitsubishi(const char *HVAC_Mode, const char *HVAC_FanMode, bool HVAC mitsubir->setVane(MITSUBISHI_AC_VANE_AUTO); mitsubir->send(); -// snprintf_P(log_data, sizeof(log_data), PSTR("IRHVAC: Mitsubishi Power %d, Mode %d, FanSpeed %d, Temp %d, VaneMode %d"), +// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("IRHVAC: Mitsubishi Power %d, Mode %d, FanSpeed %d, Temp %d, VaneMode %d"), // mitsubir->getPower(), mitsubir->getMode(), mitsubir->getFan(), mitsubir->getTemp(), mitsubir->getVane()); -// AddLog(LOG_LEVEL_DEBUG); - return false; + return IE_NO_ERROR; } @@ -326,7 +346,7 @@ bool IrHvacMitsubishi(const char *HVAC_Mode, const char *HVAC_FanMode, bool HVAC LG ********************/ -bool IrHvacLG(const char *HVAC_Mode, const char *HVAC_FanMode, bool HVAC_Power, int HVAC_Temp) +uint8_t IrHvacLG(const char *HVAC_Mode, const char *HVAC_FanMode, bool HVAC_Power, int HVAC_Temp) { uint32_t LG_Code; uint8_t data[HVAC_LG_DATALEN]; @@ -352,14 +372,14 @@ bool IrHvacLG(const char *HVAC_Mode, const char *HVAC_FanMode, bool HVAC_Power, else { // Set code for HVAC Mode - data[3] - if (HVAC_Mode == NULL) { + if (HVAC_Mode == nullptr) { p = (char *)kHvacModeOptions; // default HVAC_HOT } else { p = strchr(kHvacModeOptions, toupper(HVAC_Mode[0])); } if (!p) { - return true; + return IE_SYNTAX_IRHVAC; } mode = (p - kHvacModeOptions) ^ 0x03; // HOT = 0x03, DRY = 0x02, COOL = 0x01, AUTO = 0x00 switch (mode) { @@ -381,8 +401,7 @@ bool IrHvacLG(const char *HVAC_Mode, const char *HVAC_FanMode, bool HVAC_Power, hvacOn = true; } -// snprintf_P(log_data, sizeof(log_data), PSTR("IRHVAC: HvacMode %s, ModeVal %d, Code %d"), p, mode, data[3]); -// AddLog(LOG_LEVEL_DEBUG); +// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("IRHVAC: HvacMode %s, ModeVal %d, Code %d"), p, mode, data[3]); // Set code for HVAC temperature - data[4] if (HVAC_Temp > 30) { @@ -397,14 +416,14 @@ bool IrHvacLG(const char *HVAC_Mode, const char *HVAC_FanMode, bool HVAC_Power, data[4] = (uint8_t)(Temp - 15); // Set code for HVAC fan mode - data[5] - if (HVAC_FanMode == NULL) { + if (HVAC_FanMode == nullptr) { p = (char *)kFanSpeedOptions; // default FAN_SPEED_AUTO } else { p = strchr(kFanSpeedOptions, toupper(HVAC_FanMode[0])); } if (!p) { - return true; + return IE_SYNTAX_IRHVAC; } mode = p - kFanSpeedOptions; if ((mode == 0) || (mode > 3)) { @@ -414,8 +433,7 @@ bool IrHvacLG(const char *HVAC_Mode, const char *HVAC_FanMode, bool HVAC_Power, data[5] = (mode * 2) - 2; // Low = 0x00, Mid = 0x02, High = 0x04 } -// snprintf_P(log_data, sizeof(log_data), PSTR("IRHVAC: FanMode %s, ModeVal %d, Code %d"), p, mode, data[5]); -// AddLog(LOG_LEVEL_DEBUG); +// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("IRHVAC: FanMode %s, ModeVal %d, Code %d"), p, mode, data[5]); // Set CRC code - data[6] data[6] = (data[3] + data[4] + data[5]) & 0x0f; // CRC @@ -428,8 +446,7 @@ bool IrHvacLG(const char *HVAC_Mode, const char *HVAC_FanMode, bool HVAC_Power, } LG_Code = LG_Code + data[6]; -// snprintf_P(log_data, sizeof(log_data), PSTR("IRHVAC: LG_Code %d"), LG_Code); -// AddLog(LOG_LEVEL_DEBUG); +// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("IRHVAC: LG_Code %d"), LG_Code); // Send LG IR Code // noInterrupts(); @@ -437,7 +454,7 @@ bool IrHvacLG(const char *HVAC_Mode, const char *HVAC_FanMode, bool HVAC_Power, irsend->sendLG(LG_Code, 28); // interrupts(); - return false; + return IE_NO_ERROR; } @@ -445,12 +462,11 @@ bool IrHvacLG(const char *HVAC_Mode, const char *HVAC_FanMode, bool HVAC_Power, Fujitsu ********************/ -bool IrHvacFujitsu(const char *HVAC_Mode, const char *HVAC_FanMode, bool HVAC_Power, int HVAC_Temp) +uint8_t IrHvacFujitsu(const char *HVAC_Mode, const char *HVAC_FanMode, bool HVAC_Power, int HVAC_Temp) { const char kFujitsuHvacModeOptions[] = "HDCAF"; -// snprintf_P(log_data, sizeof(log_data), PSTR("FUJITSU: mode:%s, fan:%s, power:%u, temp:%u"), HVAC_Mode, HVAC_FanMode, HVAC_Power, HVAC_Temp); -// AddLog(LOG_LEVEL_DEBUG); +// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("FUJITSU: mode:%s, fan:%s, power:%u, temp:%u"), HVAC_Mode, HVAC_FanMode, HVAC_Power, HVAC_Temp); IRFujitsuAC ac(pin[GPIO_IRSEND]); @@ -459,7 +475,7 @@ bool IrHvacFujitsu(const char *HVAC_Mode, const char *HVAC_FanMode, bool HVAC_Po if (0 == HVAC_Power) { ac.off(); ac.send(); - return false; + return IE_NO_ERROR; } uint8_t modes[5] = {FUJITSU_AC_MODE_HEAT, FUJITSU_AC_MODE_DRY, FUJITSU_AC_MODE_COOL, FUJITSU_AC_MODE_AUTO, FUJITSU_AC_MODE_FAN}; @@ -468,32 +484,32 @@ bool IrHvacFujitsu(const char *HVAC_Mode, const char *HVAC_FanMode, bool HVAC_Po ac.setSwing(FUJITSU_AC_SWING_VERT); char *p; - if (NULL == HVAC_Mode) { + if (nullptr == HVAC_Mode) { p = (char *)kFujitsuHvacModeOptions; } else { p = strchr(kFujitsuHvacModeOptions, toupper(HVAC_Mode[0])); } if (!p) { - return true; + return IE_SYNTAX_IRHVAC; } ac.setMode(modes[p - kFujitsuHvacModeOptions]); - if (HVAC_FanMode == NULL) { + if (HVAC_FanMode == nullptr) { p = (char *)kFanSpeedOptions; // default FAN_SPEED_AUTO } else { p = strchr(kFanSpeedOptions, toupper(HVAC_FanMode[0])); } if (!p) { - return true; + return IE_SYNTAX_IRHVAC; } ac.setFanSpeed(fanModes[p - kFanSpeedOptions]); ac.setTemp(HVAC_Temp); ac.send(); - return false; + return IE_NO_ERROR; } #endif // USE_IR_HVAC @@ -514,7 +530,7 @@ bool IrSendCommand(void) { char command [CMDSZ]; bool serviced = true; - bool error = false; + uint8_t error = IE_NO_ERROR; int command_code = GetCommandCode(command, sizeof(command), XdrvMailbox.topic, kIrRemoteCommands); if (-1 == command_code) { @@ -522,95 +538,96 @@ bool IrSendCommand(void) } else if (CMND_IRSEND == command_code) { if (XdrvMailbox.data_len) { - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, D_JSON_DONE); + Response_P(S_JSON_COMMAND_SVALUE, command, D_JSON_DONE); - if (!strstr(XdrvMailbox.data, "{")) { // If no JSON it must be rawdata + if (strstr(XdrvMailbox.data, "{") == nullptr) { // If no JSON it must be rawdata // IRSend frequency, rawdata, rawdata ... char *p; char *str = strtok_r(XdrvMailbox.data, ", ", &p); - uint16_t freq = atoi(str); - if (!freq) { freq = 38000; } // Default to 38kHz - uint16_t count = 0; - char *q = p; - for (; *q; count += (*q++ == ',')); - if (count) { // At least two raw data values - count++; - uint16_t raw_array[count]; // It's safe to use stack for up to 240 packets (limited by mqtt_data length) - uint8_t i = 0; - for (str = strtok_r(NULL, ", ", &p); str && i < count; str = strtok_r(NULL, ", ", &p)) { - raw_array[i++] = strtoul(str, NULL, 0); // Allow decimal (5246996) and hexadecimal (0x501014) input - } + if (p == nullptr) { + error = IE_INVALID_RAWDATA; + } else { + uint16_t freq = atoi(str); + if (!freq) { freq = 38000; } // Default to 38kHz + uint16_t count = 0; + char *q = p; + for (; *q; count += (*q++ == ',')); + if (0 == count) { + error = IE_INVALID_RAWDATA; + } else { // At least two raw data values + count++; + uint16_t raw_array[count]; // It's safe to use stack for up to 240 packets (limited by mqtt_data length) + uint8_t i = 0; + for (str = strtok_r(nullptr, ", ", &p); str && i < count; str = strtok_r(nullptr, ", ", &p)) { + raw_array[i++] = strtoul(str, nullptr, 0); // Allow decimal (5246996) and hexadecimal (0x501014) input + } -// snprintf_P(log_data, sizeof(log_data), PSTR("IRS: Count %d, Freq %d, Arr[0] %d, Arr[count -1] %d"), -// count, freq, raw_array[0], raw_array[count -1]); -// AddLog(LOG_LEVEL_DEBUG); - - irsend_active = true; - irsend->sendRaw(raw_array, count, freq); - if (!count) { - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, D_JSON_FAILED); - } - } - else { - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, D_JSON_INVALID_RAWDATA); - } - } - else { - char dataBufUc[XdrvMailbox.data_len]; - UpperCase(dataBufUc, XdrvMailbox.data); - StaticJsonBuffer<128> jsonBuf; - JsonObject &root = jsonBuf.parseObject(dataBufUc); - if (!root.success()) { - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, D_JSON_INVALID_JSON); - } - else { - // IRsend { "protocol": "SAMSUNG", "bits": 32, "data": 551502015 } - char parm_uc[10]; - const char *protocol = root[UpperCase_P(parm_uc, PSTR(D_JSON_IR_PROTOCOL))]; - uint32_t bits = root[UpperCase_P(parm_uc, PSTR(D_JSON_IR_BITS))]; - uint32_t data = strtoul(root[UpperCase_P(parm_uc, PSTR(D_JSON_IR_DATA))], NULL, 0); - if (protocol && bits) { - char protocol_text[20]; - int protocol_code = GetCommandCode(protocol_text, sizeof(protocol_text), protocol, kIrRemoteProtocols); - - snprintf_P(log_data, sizeof(log_data), PSTR("IRS: protocol_text %s, protocol %s, bits %d, data %u (0x%lX), protocol_code %d"), - protocol_text, protocol, bits, data, data, protocol_code); - AddLog(LOG_LEVEL_DEBUG); +// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("IRS: Count %d, Freq %d, Arr[0] %d, Arr[count -1] %d"), count, freq, raw_array[0], raw_array[count -1]); irsend_active = true; - switch (protocol_code) { - case NEC: - irsend->sendNEC(data, (bits > NEC_BITS) ? NEC_BITS : bits); break; - case SONY: - irsend->sendSony(data, (bits > SONY_20_BITS) ? SONY_20_BITS : bits, 2); break; - case RC5: - irsend->sendRC5(data, bits); break; - case RC6: - irsend->sendRC6(data, bits); break; - case DISH: - irsend->sendDISH(data, (bits > DISH_BITS) ? DISH_BITS : bits); break; - case JVC: - irsend->sendJVC(data, (bits > JVC_BITS) ? JVC_BITS : bits, 1); break; - case SAMSUNG: - irsend->sendSAMSUNG(data, (bits > SAMSUNG_BITS) ? SAMSUNG_BITS : bits); break; - case PANASONIC: - irsend->sendPanasonic(bits, data); break; - default: - irsend_active = false; - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, D_JSON_PROTOCOL_NOT_SUPPORTED); + irsend->sendRaw(raw_array, count, freq); + if (!count) { + Response_P(S_JSON_COMMAND_SVALUE, command, D_JSON_FAILED); } } - else { - error = true; + } + } else { + char dataBufUc[XdrvMailbox.data_len]; + UpperCase(dataBufUc, XdrvMailbox.data); + RemoveSpace(dataBufUc); + if (strlen(dataBufUc) < 8) { + error = IE_INVALID_JSON; + } else { + StaticJsonBuffer<128> jsonBuf; + JsonObject &root = jsonBuf.parseObject(dataBufUc); + if (!root.success()) { + error = IE_INVALID_JSON; + } else { + // IRsend { "protocol": "SAMSUNG", "bits": 32, "data": 551502015 } + char parm_uc[10]; + const char *protocol = root[UpperCase_P(parm_uc, PSTR(D_JSON_IR_PROTOCOL))]; + uint16_t bits = root[UpperCase_P(parm_uc, PSTR(D_JSON_IR_BITS))]; + uint64_t data = strtoull(root[UpperCase_P(parm_uc, PSTR(D_JSON_IR_DATA))], nullptr, 0); + if (protocol && bits) { + char protocol_text[20]; + int protocol_code = GetCommandCode(protocol_text, sizeof(protocol_text), protocol, kIrRemoteProtocols); + + char dvalue[64]; + char hvalue[64]; + AddLog_P2(LOG_LEVEL_DEBUG, PSTR("IRS: protocol_text %s, protocol %s, bits %d, data %s (%s), protocol_code %d"), + protocol_text, protocol, bits, ulltoa(data, dvalue, 10), IrUint64toHex(data, hvalue, bits), protocol_code); + + irsend_active = true; + switch (protocol_code) { + case NEC: + irsend->sendNEC(data, (bits > NEC_BITS) ? NEC_BITS : bits); break; + case SONY: + irsend->sendSony(data, (bits > SONY_20_BITS) ? SONY_20_BITS : bits, 2); break; + case RC5: + irsend->sendRC5(data, bits); break; + case RC6: + irsend->sendRC6(data, bits); break; + case DISH: + irsend->sendDISH(data, (bits > DISH_BITS) ? DISH_BITS : bits); break; + case JVC: + irsend->sendJVC(data, (bits > JVC_BITS) ? JVC_BITS : bits, 1); break; + case SAMSUNG: + irsend->sendSAMSUNG(data, (bits > SAMSUNG_BITS) ? SAMSUNG_BITS : bits); break; + case PANASONIC: +// irsend->sendPanasonic(bits, data); break; + irsend->sendPanasonic64(data, bits); break; + default: + irsend_active = false; + Response_P(S_JSON_COMMAND_SVALUE, command, D_JSON_PROTOCOL_NOT_SUPPORTED); + } + } else { + error = IE_SYNTAX_IRSEND; + } } } } - } - else { - error = true; - } - if (error) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_IRSEND "\":\"" D_JSON_NO " " D_JSON_IR_PROTOCOL ", " D_JSON_IR_BITS " " D_JSON_OR " " D_JSON_IR_DATA "\"}")); + } else { + error = IE_SYNTAX_IRSEND; } } #ifdef USE_IR_HVAC @@ -624,49 +641,65 @@ bool IrSendCommand(void) if (XdrvMailbox.data_len) { char dataBufUc[XdrvMailbox.data_len]; UpperCase(dataBufUc, XdrvMailbox.data); - StaticJsonBuffer<164> jsonBufer; - JsonObject &root = jsonBufer.parseObject(dataBufUc); - if (!root.success()) { - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, D_JSON_INVALID_JSON); - } - else { - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, D_JSON_DONE); - HVAC_Vendor = root[D_JSON_IRHVAC_VENDOR]; - HVAC_Power = root[D_JSON_IRHVAC_POWER]; - HVAC_Mode = root[D_JSON_IRHVAC_MODE]; - HVAC_FanMode = root[D_JSON_IRHVAC_FANSPEED]; - HVAC_Temp = root[D_JSON_IRHVAC_TEMP]; + RemoveSpace(dataBufUc); + if (strlen(dataBufUc) < 8) { + error = IE_INVALID_JSON; + } else { + StaticJsonBuffer<164> jsonBufer; + JsonObject &root = jsonBufer.parseObject(dataBufUc); + if (!root.success()) { + error = IE_INVALID_JSON; + } else { + Response_P(S_JSON_COMMAND_SVALUE, command, D_JSON_DONE); + HVAC_Vendor = root[D_JSON_IRHVAC_VENDOR]; + HVAC_Power = root[D_JSON_IRHVAC_POWER]; + HVAC_Mode = root[D_JSON_IRHVAC_MODE]; + HVAC_FanMode = root[D_JSON_IRHVAC_FANSPEED]; + HVAC_Temp = root[D_JSON_IRHVAC_TEMP]; -// snprintf_P(log_data, sizeof(log_data), PSTR("IRHVAC: Received Vendor %s, Power %d, Mode %s, FanSpeed %s, Temp %d"), -// HVAC_Vendor, HVAC_Power, HVAC_Mode, HVAC_FanMode, HVAC_Temp); -// AddLog(LOG_LEVEL_DEBUG); + // AddLog_P2(LOG_LEVEL_DEBUG, PSTR("IRHVAC: Received Vendor %s, Power %d, Mode %s, FanSpeed %s, Temp %d"), HVAC_Vendor, HVAC_Power, HVAC_Mode, HVAC_FanMode, HVAC_Temp); - char vendor[20]; - int vendor_code = GetCommandCode(vendor, sizeof(vendor), HVAC_Vendor, kIrHvacVendors); - switch (vendor_code) { - case VNDR_TOSHIBA: - error = IrHvacToshiba(HVAC_Mode, HVAC_FanMode, HVAC_Power, HVAC_Temp); break; - case VNDR_MITSUBISHI: - error = IrHvacMitsubishi(HVAC_Mode, HVAC_FanMode, HVAC_Power, HVAC_Temp); break; - case VNDR_LG: - error = IrHvacLG(HVAC_Mode, HVAC_FanMode, HVAC_Power, HVAC_Temp); break; - case VNDR_FUJITSU: - error = IrHvacFujitsu(HVAC_Mode, HVAC_FanMode, HVAC_Power, HVAC_Temp); break; - default: - error = true; + char vendor[20]; + int vendor_code = GetCommandCode(vendor, sizeof(vendor), HVAC_Vendor, kIrHvacVendors); + switch (vendor_code) { + case VNDR_TOSHIBA: + error = IrHvacToshiba(HVAC_Mode, HVAC_FanMode, HVAC_Power, HVAC_Temp); break; + case VNDR_MITSUBISHI: + error = IrHvacMitsubishi(HVAC_Mode, HVAC_FanMode, HVAC_Power, HVAC_Temp); break; + case VNDR_LG: + error = IrHvacLG(HVAC_Mode, HVAC_FanMode, HVAC_Power, HVAC_Temp); break; + case VNDR_FUJITSU: + error = IrHvacFujitsu(HVAC_Mode, HVAC_FanMode, HVAC_Power, HVAC_Temp); break; + default: + error = IE_SYNTAX_IRHVAC; + } } } } else { - error = true; - } - if (error) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_IRHVAC "\":\"" D_JSON_WRONG " " D_JSON_IRHVAC_VENDOR ", " D_JSON_IRHVAC_MODE " " D_JSON_OR " " D_JSON_IRHVAC_FANSPEED "\"}")); + error = IE_SYNTAX_IRHVAC; } } #endif // USE_IR_HVAC else serviced = false; // Unknown command + switch (error) { + case IE_INVALID_RAWDATA: + Response_P(S_JSON_COMMAND_SVALUE, command, D_JSON_INVALID_RAWDATA); + break; + case IE_INVALID_JSON: + Response_P(S_JSON_COMMAND_SVALUE, command, D_JSON_INVALID_JSON); + break; + case IE_SYNTAX_IRSEND: + Response_P(PSTR("{\"" D_CMND_IRSEND "\":\"" D_JSON_NO " " D_JSON_IR_PROTOCOL ", " D_JSON_IR_BITS " " D_JSON_OR " " D_JSON_IR_DATA "\"}")); + break; +#ifdef USE_IR_HVAC + case IE_SYNTAX_IRHVAC: + Response_P(PSTR("{\"" D_CMND_IRHVAC "\":\"" D_JSON_WRONG " " D_JSON_IRHVAC_VENDOR ", " D_JSON_IRHVAC_MODE " " D_JSON_OR " " D_JSON_IRHVAC_FANSPEED "\"}")); + break; +#endif // USE_IR_HVAC + } + return serviced; } diff --git a/sonoff/xdrv_06_snfbridge.ino b/sonoff/xdrv_06_snfbridge.ino index c4b4d209b..eaf934043 100644 --- a/sonoff/xdrv_06_snfbridge.ino +++ b/sonoff/xdrv_06_snfbridge.ino @@ -23,7 +23,7 @@ #define XDRV_06 6 -#define SFB_TIME_AVOID_DUPLICATE 2000 // Milliseconds +const uint32_t SFB_TIME_AVOID_DUPLICATE = 2000; // Milliseconds enum SonoffBridgeCommands { CMND_RFSYNC, CMND_RFLOW, CMND_RFHIGH, CMND_RFHOST, CMND_RFCODE, CMND_RFKEY, CMND_RFRAW }; @@ -51,8 +51,8 @@ unsigned long sonoff_bridge_last_learn_time = 0; #include "ihx.h" #include "c2.h" -#define RF_RECORD_NO_START_FOUND -1 -#define RF_RECORD_NO_END_FOUND -2 +const ssize_t RF_RECORD_NO_START_FOUND = -1; +const ssize_t RF_RECORD_NO_END_FOUND = -2; ssize_t rf_find_hex_record_start(uint8_t *buf, size_t size) { @@ -98,7 +98,7 @@ ssize_t rf_glue_remnant_with_new_data_and_write(const uint8_t *remnant_data, uin glue_record_sz = strlen((const char *) remnant_data) + record_end; glue_buf = (uint8_t *) malloc(glue_record_sz); - if (glue_buf == NULL) { return -2; } // Not enough space + if (glue_buf == nullptr) { return -2; } // Not enough space // Assemble new glue buffer memcpy(glue_buf, remnant_data, strlen((const char *) remnant_data)); @@ -208,17 +208,17 @@ void SonoffBridgeReceivedRaw(void) if (0xB1 == serial_in_buffer[1]) { buckets = serial_in_buffer[2] << 1; } // Bucket sniffing - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_RFRAW "\":{\"" D_JSON_DATA "\":\"")); + Response_P(PSTR("{\"" D_CMND_RFRAW "\":{\"" D_JSON_DATA "\":\"")); for (int i = 0; i < serial_in_byte_counter; i++) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s%02X"), mqtt_data, serial_in_buffer[i]); + ResponseAppend_P(PSTR("%02X"), serial_in_buffer[i]); if (0xB1 == serial_in_buffer[1]) { if ((i > 3) && buckets) { buckets--; } if ((i < 3) || (buckets % 2) || (i == serial_in_byte_counter -2)) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s "), mqtt_data); + ResponseAppend_P(PSTR(" ")); } } } - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s\"}}"), mqtt_data); + ResponseAppend_P(PSTR("\"}}")); MqttPublishPrefixTopic_P(RESULT_OR_TELE, PSTR(D_CMND_RFRAW)); XdrvRulesProcess(); } @@ -228,7 +228,7 @@ void SonoffBridgeReceivedRaw(void) void SonoffBridgeLearnFailed(void) { sonoff_bridge_learn_active = 0; - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_INDEX_SVALUE, D_CMND_RFKEY, sonoff_bridge_learn_key, D_JSON_LEARN_FAILED); + Response_P(S_JSON_COMMAND_INDEX_SVALUE, D_CMND_RFKEY, sonoff_bridge_learn_key, D_JSON_LEARN_FAILED); MqttPublishPrefixTopic_P(RESULT_OR_STAT, PSTR(D_CMND_RFKEY)); } @@ -254,7 +254,7 @@ void SonoffBridgeReceived(void) for (uint8_t i = 0; i < 9; i++) { Settings.rf_code[sonoff_bridge_learn_key][i] = serial_in_buffer[i +1]; } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_INDEX_SVALUE, D_CMND_RFKEY, sonoff_bridge_learn_key, D_JSON_LEARNED); + Response_P(S_JSON_COMMAND_INDEX_SVALUE, D_CMND_RFKEY, sonoff_bridge_learn_key, D_JSON_LEARNED); MqttPublishPrefixTopic_P(RESULT_OR_STAT, PSTR(D_CMND_RFKEY)); } else { SonoffBridgeLearnFailed(); @@ -288,7 +288,7 @@ void SonoffBridgeReceived(void) } else { snprintf_P(stemp, sizeof(stemp), PSTR("\"%06X\""), received_id); } - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_JSON_RFRECEIVED "\":{\"" D_JSON_SYNC "\":%d,\"" D_JSON_LOW "\":%d,\"" D_JSON_HIGH "\":%d,\"" D_JSON_DATA "\":%s,\"" D_CMND_RFKEY "\":%s}}"), + Response_P(PSTR("{\"" D_JSON_RFRECEIVED "\":{\"" D_JSON_SYNC "\":%d,\"" D_JSON_LOW "\":%d,\"" D_JSON_HIGH "\":%d,\"" D_JSON_DATA "\":%s,\"" D_CMND_RFKEY "\":%s}}"), sync_time, low_time, high_time, stemp, rfkey); MqttPublishPrefixTopic_P(RESULT_OR_TELE, PSTR(D_JSON_RFRECEIVED)); XdrvRulesProcess(); @@ -470,7 +470,7 @@ bool SonoffBridgeCommand(void) } else { snprintf_P(stemp, sizeof(stemp), PSTR("\"#%X\""), code); } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_XVALUE, command, stemp); + Response_P(S_JSON_COMMAND_XVALUE, command, stemp); } else if ((CMND_RFKEY == command_code) && (XdrvMailbox.index > 0) && (XdrvMailbox.index <= 16)) { unsigned long now = millis(); @@ -478,11 +478,11 @@ bool SonoffBridgeCommand(void) sonoff_bridge_learn_active = 0; if (2 == XdrvMailbox.payload) { // Learn RF data SonoffBridgeLearn(XdrvMailbox.index); - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_INDEX_SVALUE, command, XdrvMailbox.index, D_JSON_START_LEARNING); + Response_P(S_JSON_COMMAND_INDEX_SVALUE, command, XdrvMailbox.index, D_JSON_START_LEARNING); } else if (3 == XdrvMailbox.payload) { // Unlearn RF data Settings.rf_code[XdrvMailbox.index][0] = 0; // Reset sync_time MSB - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_INDEX_SVALUE, command, XdrvMailbox.index, D_JSON_SET_TO_DEFAULT); + Response_P(S_JSON_COMMAND_INDEX_SVALUE, command, XdrvMailbox.index, D_JSON_SET_TO_DEFAULT); } else if (4 == XdrvMailbox.payload) { // Save RF data provided by RFSync, RfLow, RfHigh and last RfCode for (uint8_t i = 0; i < 6; i++) { @@ -491,7 +491,7 @@ bool SonoffBridgeCommand(void) Settings.rf_code[XdrvMailbox.index][6] = (sonoff_bridge_last_send_code >> 16) & 0xff; Settings.rf_code[XdrvMailbox.index][7] = (sonoff_bridge_last_send_code >> 8) & 0xff; Settings.rf_code[XdrvMailbox.index][8] = sonoff_bridge_last_send_code & 0xff; - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_INDEX_SVALUE, command, XdrvMailbox.index, D_JSON_SAVED); + Response_P(S_JSON_COMMAND_INDEX_SVALUE, command, XdrvMailbox.index, D_JSON_SAVED); } else if (5 == XdrvMailbox.payload) { // Show default or learned RF data uint8_t key = XdrvMailbox.index; uint8_t index = (0 == Settings.rf_code[key][0]) ? 0 : key; // Use default if sync_time MSB = 0 @@ -505,19 +505,19 @@ bool SonoffBridgeCommand(void) } else { code |= Settings.rf_code[index][8]; } - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"%s%d\":{\"" D_JSON_SYNC "\":%d,\"" D_JSON_LOW "\":%d,\"" D_JSON_HIGH "\":%d,\"" D_JSON_DATA "\":\"%06X\"}}"), + Response_P(PSTR("{\"%s%d\":{\"" D_JSON_SYNC "\":%d,\"" D_JSON_LOW "\":%d,\"" D_JSON_HIGH "\":%d,\"" D_JSON_DATA "\":\"%06X\"}}"), command, XdrvMailbox.index, sync_time, low_time, high_time, code); } else { if ((1 == XdrvMailbox.payload) || (0 == Settings.rf_code[XdrvMailbox.index][0])) { // Test sync_time MSB SonoffBridgeSend(0, XdrvMailbox.index); // Send default RF data - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_INDEX_SVALUE, command, XdrvMailbox.index, D_JSON_DEFAULT_SENT); + Response_P(S_JSON_COMMAND_INDEX_SVALUE, command, XdrvMailbox.index, D_JSON_DEFAULT_SENT); } else { SonoffBridgeSend(XdrvMailbox.index, 0); // Send learned RF data - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_INDEX_SVALUE, command, XdrvMailbox.index, D_JSON_LEARNED_SENT); + Response_P(S_JSON_COMMAND_INDEX_SVALUE, command, XdrvMailbox.index, D_JSON_LEARNED_SENT); } } } else { - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_INDEX_SVALUE, command, sonoff_bridge_learn_key, D_JSON_LEARNING_ACTIVE); + Response_P(S_JSON_COMMAND_INDEX_SVALUE, command, sonoff_bridge_learn_key, D_JSON_LEARNING_ACTIVE); } } else if (CMND_RFRAW == command_code) { @@ -548,7 +548,7 @@ bool SonoffBridgeCommand(void) sonoff_bridge_receive_raw_flag = 1; } } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, GetStateText(sonoff_bridge_receive_raw_flag)); + Response_P(S_JSON_COMMAND_SVALUE, command, GetStateText(sonoff_bridge_receive_raw_flag)); } else serviced = false; // Unknown command return serviced; diff --git a/sonoff/xdrv_07_domoticz.ino b/sonoff/xdrv_07_domoticz.ino index 2e4611246..21c191699 100644 --- a/sonoff/xdrv_07_domoticz.ino +++ b/sonoff/xdrv_07_domoticz.ino @@ -79,8 +79,7 @@ void MqttPublishDomoticzFanState() int fan_speed = GetFanspeed(); snprintf_P(svalue, sizeof(svalue), PSTR("%d"), fan_speed * 10); - snprintf_P(mqtt_data, sizeof(mqtt_data), DOMOTICZ_MESSAGE, - (int)Settings.domoticz_relay_idx[1], (0 == fan_speed) ? 0 : 2, svalue, DomoticzBatteryQuality(), DomoticzRssiQuality()); + Response_P(DOMOTICZ_MESSAGE, (int)Settings.domoticz_relay_idx[1], (0 == fan_speed) ? 0 : 2, svalue, DomoticzBatteryQuality(), DomoticzRssiQuality()); MqttPublish(domoticz_in_topic); fan_debounce = millis(); @@ -106,8 +105,7 @@ void MqttPublishDomoticzPowerState(uint8_t device) char svalue[8]; // Dimmer value snprintf_P(svalue, sizeof(svalue), PSTR("%d"), Settings.light_dimmer); - snprintf_P(mqtt_data, sizeof(mqtt_data), DOMOTICZ_MESSAGE, - (int)Settings.domoticz_relay_idx[device -1], (power & (1 << (device -1))) ? 1 : 0, (light_type) ? svalue : "", DomoticzBatteryQuality(), DomoticzRssiQuality()); + Response_P(DOMOTICZ_MESSAGE, (int)Settings.domoticz_relay_idx[device -1], (power & (1 << (device -1))) ? 1 : 0, (light_type) ? svalue : "", DomoticzBatteryQuality(), DomoticzRssiQuality()); MqttPublish(domoticz_in_topic); } } @@ -206,8 +204,7 @@ bool DomoticzMqttData(void) nvalue = domoticz["nvalue"]; } - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_DOMOTICZ "idx %d, nvalue %d"), idx, nvalue); - AddLog(LOG_LEVEL_DEBUG_MORE); + AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_DOMOTICZ "idx %d, nvalue %d"), idx, nvalue); if ((idx > 0) && (nvalue >= 0) && (nvalue <= 15)) { uint8_t maxdev = (devices_present > MAX_DOMOTICZ_IDX) ? MAX_DOMOTICZ_IDX : devices_present; @@ -275,8 +272,7 @@ bool DomoticzMqttData(void) return 1; } - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_DOMOTICZ D_RECEIVED_TOPIC " %s, " D_DATA " %s"), XdrvMailbox.topic, XdrvMailbox.data); - AddLog(LOG_LEVEL_DEBUG_MORE); + AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_DOMOTICZ D_RECEIVED_TOPIC " %s, " D_DATA " %s"), XdrvMailbox.topic, XdrvMailbox.data); domoticz_update_flag = 0; } @@ -303,31 +299,31 @@ bool DomoticzCommand(void) Settings.domoticz_relay_idx[XdrvMailbox.index -1] = XdrvMailbox.payload; restart_flag = 2; } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_DOMOTICZ_COMMAND_INDEX_LVALUE, command, XdrvMailbox.index, Settings.domoticz_relay_idx[XdrvMailbox.index -1]); + Response_P(S_JSON_DOMOTICZ_COMMAND_INDEX_LVALUE, command, XdrvMailbox.index, Settings.domoticz_relay_idx[XdrvMailbox.index -1]); } else if ((CMND_KEYIDX == command_code) && (XdrvMailbox.index > 0) && (XdrvMailbox.index <= MAX_DOMOTICZ_IDX)) { if (XdrvMailbox.payload >= 0) { Settings.domoticz_key_idx[XdrvMailbox.index -1] = XdrvMailbox.payload; } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_DOMOTICZ_COMMAND_INDEX_LVALUE, command, XdrvMailbox.index, Settings.domoticz_key_idx[XdrvMailbox.index -1]); + Response_P(S_JSON_DOMOTICZ_COMMAND_INDEX_LVALUE, command, XdrvMailbox.index, Settings.domoticz_key_idx[XdrvMailbox.index -1]); } else if ((CMND_SWITCHIDX == command_code) && (XdrvMailbox.index > 0) && (XdrvMailbox.index <= MAX_DOMOTICZ_IDX)) { if (XdrvMailbox.payload >= 0) { Settings.domoticz_switch_idx[XdrvMailbox.index -1] = XdrvMailbox.payload; } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_DOMOTICZ_COMMAND_INDEX_NVALUE, command, XdrvMailbox.index, Settings.domoticz_switch_idx[XdrvMailbox.index -1]); + Response_P(S_JSON_DOMOTICZ_COMMAND_INDEX_NVALUE, command, XdrvMailbox.index, Settings.domoticz_switch_idx[XdrvMailbox.index -1]); } else if ((CMND_SENSORIDX == command_code) && (XdrvMailbox.index > 0) && (XdrvMailbox.index <= DZ_MAX_SENSORS)) { if (XdrvMailbox.payload >= 0) { Settings.domoticz_sensor_idx[XdrvMailbox.index -1] = XdrvMailbox.payload; } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_DOMOTICZ_COMMAND_INDEX_NVALUE, command, XdrvMailbox.index, Settings.domoticz_sensor_idx[XdrvMailbox.index -1]); + Response_P(S_JSON_DOMOTICZ_COMMAND_INDEX_NVALUE, command, XdrvMailbox.index, Settings.domoticz_sensor_idx[XdrvMailbox.index -1]); } else if (CMND_UPDATETIMER == command_code) { if ((XdrvMailbox.payload >= 0) && (XdrvMailbox.payload < 3601)) { Settings.domoticz_update_timer = XdrvMailbox.payload; } - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_DOMOTICZ "%s\":%d}"), command, Settings.domoticz_update_timer); + Response_P(PSTR("{\"" D_CMND_DOMOTICZ "%s\":%d}"), command, Settings.domoticz_update_timer); } else serviced = false; // Unknown command } @@ -342,7 +338,7 @@ bool DomoticzSendKey(uint8_t key, uint8_t device, uint8_t state, uint8_t svalflg if (device <= MAX_DOMOTICZ_IDX) { if ((Settings.domoticz_key_idx[device -1] || Settings.domoticz_switch_idx[device -1]) && (svalflg)) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"command\":\"switchlight\",\"idx\":%d,\"switchcmd\":\"%s\"}"), + Response_P(PSTR("{\"command\":\"switchlight\",\"idx\":%d,\"switchcmd\":\"%s\"}"), (key) ? Settings.domoticz_switch_idx[device -1] : Settings.domoticz_key_idx[device -1], (state) ? (2 == state) ? "Toggle" : "On" : "Off"); MqttPublish(domoticz_in_topic); result = 1; @@ -377,14 +373,14 @@ uint8_t DomoticzHumidityState(char *hum) void DomoticzSensor(uint8_t idx, char *data) { if (Settings.domoticz_sensor_idx[idx]) { - char dmess[90]; + char dmess[100]; memcpy(dmess, mqtt_data, sizeof(dmess)); if (DZ_AIRQUALITY == idx) { - snprintf_P(mqtt_data, sizeof(dmess), PSTR("{\"idx\":%d,\"nvalue\":%s,\"Battery\":%d,\"RSSI\":%d}"), + Response_P(PSTR("{\"idx\":%d,\"nvalue\":%s,\"Battery\":%d,\"RSSI\":%d}"), Settings.domoticz_sensor_idx[idx], data, DomoticzBatteryQuality(), DomoticzRssiQuality()); } else { - snprintf_P(mqtt_data, sizeof(dmess), DOMOTICZ_MESSAGE, + Response_P(DOMOTICZ_MESSAGE, Settings.domoticz_sensor_idx[idx], 0, data, DomoticzBatteryQuality(), DomoticzRssiQuality()); } MqttPublish(domoticz_in_topic); @@ -431,20 +427,21 @@ void DomoticzSensorPowerEnergy(int power, char *energy) const char S_CONFIGURE_DOMOTICZ[] PROGMEM = D_CONFIGURE_DOMOTICZ; const char HTTP_BTN_MENU_DOMOTICZ[] PROGMEM = - "
"; + "

"; const char HTTP_FORM_DOMOTICZ[] PROGMEM = - "
 " D_DOMOTICZ_PARAMETERS " 
" - "
"; + "
 " D_DOMOTICZ_PARAMETERS " " + "" + "
"; const char HTTP_FORM_DOMOTICZ_RELAY[] PROGMEM = - "" - ""; + "" + ""; const char HTTP_FORM_DOMOTICZ_SWITCH[] PROGMEM = - ""; + ""; const char HTTP_FORM_DOMOTICZ_SENSOR[] PROGMEM = - ""; + ""; const char HTTP_FORM_DOMOTICZ_TIMER[] PROGMEM = - ""; + ""; void HandleDomoticzConfiguration(void) { @@ -460,35 +457,30 @@ void HandleDomoticzConfiguration(void) char stemp[32]; - String page = FPSTR(HTTP_HEAD); - page.replace(F("{v}"), FPSTR(S_CONFIGURE_DOMOTICZ)); - page += FPSTR(HTTP_HEAD_STYLE); - page += FPSTR(HTTP_FORM_DOMOTICZ); + WSContentStart_P(S_CONFIGURE_DOMOTICZ); + WSContentSendStyle(); + WSContentSend_P(HTTP_FORM_DOMOTICZ); for (int i = 0; i < MAX_DOMOTICZ_IDX; i++) { if (i < devices_present) { - page += FPSTR(HTTP_FORM_DOMOTICZ_RELAY); - page.replace("{2", String((int)Settings.domoticz_relay_idx[i])); - page.replace("{3", String((int)Settings.domoticz_key_idx[i])); + WSContentSend_P(HTTP_FORM_DOMOTICZ_RELAY, + i +1, i, i, Settings.domoticz_relay_idx[i], + i +1, i, i, Settings.domoticz_key_idx[i]); } if (pin[GPIO_SWT1 +i] < 99) { - page += FPSTR(HTTP_FORM_DOMOTICZ_SWITCH); - page.replace("{4", String((int)Settings.domoticz_switch_idx[i])); + WSContentSend_P(HTTP_FORM_DOMOTICZ_SWITCH, + i +1, i, i, Settings.domoticz_switch_idx[i]); } - page.replace("{1", String(i +1)); if ((SONOFF_IFAN02 == my_module_type) && (1 == i)) { break; } } for (int i = 0; i < DZ_MAX_SENSORS; i++) { - page += FPSTR(HTTP_FORM_DOMOTICZ_SENSOR); - page.replace("{1", String(i +1)); - page.replace("{2", GetTextIndexed(stemp, sizeof(stemp), i, kDomoticzSensors)); - page.replace("{5", String((int)Settings.domoticz_sensor_idx[i])); + WSContentSend_P(HTTP_FORM_DOMOTICZ_SENSOR, + i +1, GetTextIndexed(stemp, sizeof(stemp), i, kDomoticzSensors), i, i, Settings.domoticz_sensor_idx[i]); } - page += FPSTR(HTTP_FORM_DOMOTICZ_TIMER); - page.replace("{6", String((int)Settings.domoticz_update_timer)); - page += F("
" D_DOMOTICZ_IDX " {1
" D_DOMOTICZ_KEY_IDX " {1
" D_DOMOTICZ_IDX " %d
" D_DOMOTICZ_KEY_IDX " %d
" D_DOMOTICZ_SWITCH_IDX " {1
" D_DOMOTICZ_SWITCH_IDX " %d
" D_DOMOTICZ_SENSOR_IDX " {1 {2
" D_DOMOTICZ_SENSOR_IDX " %d %s
" D_DOMOTICZ_UPDATE_TIMER " (" STR(DOMOTICZ_UPDATE_TIMER) ")
" D_DOMOTICZ_UPDATE_TIMER " (" STR(DOMOTICZ_UPDATE_TIMER) ")
"); - page += FPSTR(HTTP_FORM_END); - page += FPSTR(HTTP_BTN_CONF); - ShowPage(page); + WSContentSend_P(HTTP_FORM_DOMOTICZ_TIMER, Settings.domoticz_update_timer); + WSContentSend_P(PSTR("")); + WSContentSend_P(HTTP_FORM_END); + WSContentSpaceButton(BUTTON_CONFIGURATION); + WSContentStop(); } void DomoticzSaveSettings(void) @@ -498,19 +490,19 @@ void DomoticzSaveSettings(void) char tmp[100]; for (uint8_t i = 0; i < MAX_DOMOTICZ_IDX; i++) { - snprintf_P(stemp, sizeof(stemp), PSTR("r%d"), i +1); + snprintf_P(stemp, sizeof(stemp), PSTR("r%d"), i); WebGetArg(stemp, tmp, sizeof(tmp)); Settings.domoticz_relay_idx[i] = (!strlen(tmp)) ? 0 : atoi(tmp); - snprintf_P(stemp, sizeof(stemp), PSTR("k%d"), i +1); + snprintf_P(stemp, sizeof(stemp), PSTR("k%d"), i); WebGetArg(stemp, tmp, sizeof(tmp)); Settings.domoticz_key_idx[i] = (!strlen(tmp)) ? 0 : atoi(tmp); - snprintf_P(stemp, sizeof(stemp), PSTR("s%d"), i +1); + snprintf_P(stemp, sizeof(stemp), PSTR("s%d"), i); WebGetArg(stemp, tmp, sizeof(tmp)); Settings.domoticz_switch_idx[i] = (!strlen(tmp)) ? 0 : atoi(tmp); } ssensor_indices[0] = '\0'; for (uint8_t i = 0; i < DZ_MAX_SENSORS; i++) { - snprintf_P(stemp, sizeof(stemp), PSTR("l%d"), i +1); + snprintf_P(stemp, sizeof(stemp), PSTR("l%d"), i); WebGetArg(stemp, tmp, sizeof(tmp)); Settings.domoticz_sensor_idx[i] = (!strlen(tmp)) ? 0 : atoi(tmp); snprintf_P(ssensor_indices, sizeof(ssensor_indices), PSTR("%s%s%d"), ssensor_indices, (strlen(ssensor_indices)) ? "," : "", Settings.domoticz_sensor_idx[i]); @@ -518,12 +510,11 @@ void DomoticzSaveSettings(void) WebGetArg("ut", tmp, sizeof(tmp)); Settings.domoticz_update_timer = (!strlen(tmp)) ? DOMOTICZ_UPDATE_TIMER : atoi(tmp); - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_DOMOTICZ D_CMND_IDX " %d,%d,%d,%d, " D_CMND_KEYIDX " %d,%d,%d,%d, " D_CMND_SWITCHIDX " %d,%d,%d,%d, " D_CMND_SENSORIDX " %s, " D_CMND_UPDATETIMER " %d"), + AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_DOMOTICZ D_CMND_IDX " %d,%d,%d,%d, " D_CMND_KEYIDX " %d,%d,%d,%d, " D_CMND_SWITCHIDX " %d,%d,%d,%d, " D_CMND_SENSORIDX " %s, " D_CMND_UPDATETIMER " %d"), Settings.domoticz_relay_idx[0], Settings.domoticz_relay_idx[1], Settings.domoticz_relay_idx[2], Settings.domoticz_relay_idx[3], Settings.domoticz_key_idx[0], Settings.domoticz_key_idx[1], Settings.domoticz_key_idx[2], Settings.domoticz_key_idx[3], Settings.domoticz_switch_idx[0], Settings.domoticz_switch_idx[1], Settings.domoticz_switch_idx[2], Settings.domoticz_switch_idx[3], ssensor_indices, Settings.domoticz_update_timer); - AddLog(LOG_LEVEL_INFO); } #endif // USE_WEBSERVER @@ -539,7 +530,7 @@ bool Xdrv07(uint8_t function) switch (function) { #ifdef USE_WEBSERVER case FUNC_WEB_ADD_BUTTON: - strncat_P(mqtt_data, HTTP_BTN_MENU_DOMOTICZ, sizeof(mqtt_data) - strlen(mqtt_data) -1); + WSContentSend_P(HTTP_BTN_MENU_DOMOTICZ); break; case FUNC_WEB_ADD_HANDLER: WebServer->on("/" WEB_HANDLE_DOMOTICZ, HandleDomoticzConfiguration); diff --git a/sonoff/xdrv_08_serial_bridge.ino b/sonoff/xdrv_08_serial_bridge.ino index ba83f11ec..0125591c1 100644 --- a/sonoff/xdrv_08_serial_bridge.ino +++ b/sonoff/xdrv_08_serial_bridge.ino @@ -24,17 +24,17 @@ #define XDRV_08 8 -#define SERIAL_BRIDGE_BUFFER_SIZE 130 +const uint8_t SERIAL_BRIDGE_BUFFER_SIZE = 130; #include enum SerialBridgeCommands { CMND_SSERIALSEND, CMND_SBAUDRATE }; const char kSerialBridgeCommands[] PROGMEM = D_CMND_SSERIALSEND "|" D_CMND_SBAUDRATE; -TasmotaSerial *SerialBridgeSerial = NULL; +TasmotaSerial *SerialBridgeSerial = nullptr; unsigned long serial_bridge_polling_window = 0; -char *serial_bridge_buffer = NULL; +char *serial_bridge_buffer = nullptr; int serial_bridge_in_byte_counter = 0; bool serial_bridge_active = true; bool serial_bridge_raw = false; @@ -68,13 +68,13 @@ void SerialBridgeInput(void) if (serial_bridge_in_byte_counter && (millis() > (serial_bridge_polling_window + SERIAL_POLLING))) { serial_bridge_buffer[serial_bridge_in_byte_counter] = 0; // Serial data completed if (!serial_bridge_raw) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_JSON_SSERIALRECEIVED "\":\"%s\"}"), serial_bridge_buffer); + Response_P(PSTR("{\"" D_JSON_SSERIALRECEIVED "\":\"%s\"}"), serial_bridge_buffer); } else { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_JSON_SSERIALRECEIVED "\":\"")); + Response_P(PSTR("{\"" D_JSON_SSERIALRECEIVED "\":\"")); for (int i = 0; i < serial_bridge_in_byte_counter; i++) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s%02x"), mqtt_data, serial_bridge_buffer[i]); + ResponseAppend_P(PSTR("%02x"), serial_bridge_buffer[i]); } - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s\"}"), mqtt_data); + ResponseAppend_P(PSTR("\"}")); } MqttPublishPrefixTopic_P(RESULT_OR_TELE, PSTR(D_JSON_SSERIALRECEIVED)); // XdrvRulesProcess(); @@ -137,25 +137,25 @@ bool SerialBridgeCommand(void) int size = strlen(XdrvMailbox.data); while (size > 0) { - snprintf(stemp, sizeof(stemp), codes); + strlcpy(stemp, codes, sizeof(stemp)); code = strtol(stemp, &p, 16); SerialBridgeSerial->write(code); // "AA004566" as hex values size -= 2; codes += 2; } } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, D_JSON_DONE); + Response_P(S_JSON_COMMAND_SVALUE, command, D_JSON_DONE); } } else if (CMND_SBAUDRATE == command_code) { char *p; int baud = strtol(XdrvMailbox.data, &p, 10); - if (baud > 0) { + if (baud >= 1200) { baud /= 1200; // Make it a valid baudrate Settings.sbaudrate = (1 == XdrvMailbox.payload) ? SOFT_BAUDRATE / 1200 : baud; SerialBridgeSerial->begin(Settings.sbaudrate * 1200); // Reinitialize serial port with new baud rate } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_NVALUE, command, Settings.sbaudrate * 1200); + Response_P(S_JSON_COMMAND_NVALUE, command, Settings.sbaudrate * 1200); } else serviced = false; // Unknown command @@ -172,12 +172,12 @@ bool Xdrv08(uint8_t function) if (serial_bridge_active) { switch (function) { - case FUNC_PRE_INIT: - SerialBridgeInit(); - break; case FUNC_LOOP: if (SerialBridgeSerial) { SerialBridgeInput(); } break; + case FUNC_PRE_INIT: + SerialBridgeInit(); + break; case FUNC_COMMAND: result = SerialBridgeCommand(); break; diff --git a/sonoff/xdrv_09_timers.ino b/sonoff/xdrv_09_timers.ino index 2fefe4d70..36941b9f1 100644 --- a/sonoff/xdrv_09_timers.ino +++ b/sonoff/xdrv_09_timers.ino @@ -232,7 +232,7 @@ String GetSun(uint8_t dawn) return String(stime); } -uint16_t GetSunMinutes(uint8_t dawn) +uint16_t SunMinutes(uint8_t dawn) { uint8_t hour[2]; uint8_t minute[2]; @@ -287,7 +287,7 @@ void TimerEverySecond(void) Settings.timer[i].arm = xtimer.repeat; #ifdef USE_RULES if (3 == xtimer.power) { // Blink becomes Rule disregarding device and allowing use of Backlog commands - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"Clock\":{\"Timer\":%d}}"), i +1); + Response_P(PSTR("{\"Clock\":{\"Timer\":%d}}"), i +1); XdrvRulesProcess(); } else #endif // USE_RULES @@ -325,11 +325,11 @@ void PrepShowTimer(uint8_t index) sign[0] = '-'; } } - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s\"" D_CMND_TIMER "%d\":{\"" D_JSON_TIMER_ARM "\":%d,\"" D_JSON_TIMER_MODE "\":%d,\"" D_JSON_TIMER_TIME "\":\"%s%02d:%02d\",\"" D_JSON_TIMER_WINDOW "\":%d,\"" D_JSON_TIMER_DAYS "\":\"%s\",\"" D_JSON_TIMER_REPEAT "\":%d%s,\"" D_JSON_TIMER_ACTION "\":%d}"), - mqtt_data, index, xtimer.arm, xtimer.mode, sign, hour, xtimer.time % 60, xtimer.window, days, xtimer.repeat, soutput, xtimer.power); + ResponseAppend_P(PSTR("\"" D_CMND_TIMER "%d\":{\"" D_JSON_TIMER_ARM "\":%d,\"" D_JSON_TIMER_MODE "\":%d,\"" D_JSON_TIMER_TIME "\":\"%s%02d:%02d\",\"" D_JSON_TIMER_WINDOW "\":%d,\"" D_JSON_TIMER_DAYS "\":\"%s\",\"" D_JSON_TIMER_REPEAT "\":%d%s,\"" D_JSON_TIMER_ACTION "\":%d}"), + index, xtimer.arm, xtimer.mode, sign, hour, xtimer.time % 60, xtimer.window, days, xtimer.repeat, soutput, xtimer.power); #else - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s\"" D_CMND_TIMER "%d\":{\"" D_JSON_TIMER_ARM "\":%d,\"" D_JSON_TIMER_TIME "\":\"%02d:%02d\",\"" D_JSON_TIMER_WINDOW "\":%d,\"" D_JSON_TIMER_DAYS "\":\"%s\",\"" D_JSON_TIMER_REPEAT "\":%d%s,\"" D_JSON_TIMER_ACTION "\":%d}"), - mqtt_data, index, xtimer.arm, xtimer.time / 60, xtimer.time % 60, xtimer.window, days, xtimer.repeat, soutput, xtimer.power); + ResponseAppend_P(PSTR("\"" D_CMND_TIMER "%d\":{\"" D_JSON_TIMER_ARM "\":%d,\"" D_JSON_TIMER_TIME "\":\"%02d:%02d\",\"" D_JSON_TIMER_WINDOW "\":%d,\"" D_JSON_TIMER_DAYS "\":\"%s\",\"" D_JSON_TIMER_REPEAT "\":%d%s,\"" D_JSON_TIMER_ACTION "\":%d}"), + index, xtimer.arm, xtimer.time / 60, xtimer.time % 60, xtimer.window, days, xtimer.repeat, soutput, xtimer.power); #endif // USE_SUNRISE } @@ -365,7 +365,7 @@ bool TimerCommand(void) StaticJsonBuffer<256> jsonBuffer; JsonObject& root = jsonBuffer.parseObject(dataBufUc); if (!root.success()) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_TIMER "%d\":\"" D_JSON_INVALID_JSON "\"}"), index); // JSON decode failed + Response_P(PSTR("{\"" D_CMND_TIMER "%d\":\"" D_JSON_INVALID_JSON "\"}"), index); // JSON decode failed error = 1; } else { @@ -385,9 +385,9 @@ bool TimerCommand(void) uint8_t sign = 0; char time_str[10]; - snprintf(time_str, sizeof(time_str), root[parm_uc]); + strlcpy(time_str, root[parm_uc], sizeof(time_str)); const char *substr = strtok(time_str, ":"); - if (substr != NULL) { + if (substr != nullptr) { if (strchr(substr, '-')) { sign = 1; substr++; @@ -396,8 +396,8 @@ bool TimerCommand(void) if (sign) { value += 12; } // Allow entering timer offset from -11:59 to -00:01 converted to 12:01 to 23:59 if (value > 23) { value = 23; } itime = value * 60; - substr = strtok(NULL, ":"); - if (substr != NULL) { + substr = strtok(nullptr, ":"); + if (substr != nullptr) { value = atoi(substr); if (value < 0) { value = 0; } if (value > 59) { value = 59; } @@ -439,16 +439,16 @@ bool TimerCommand(void) } #ifndef USE_RULES } else { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_TIMER "%d\":\"" D_JSON_TIMER_NO_DEVICE "\"}"), index); // No outputs defined so nothing to control + Response_P(PSTR("{\"" D_CMND_TIMER "%d\":\"" D_JSON_TIMER_NO_DEVICE "\"}"), index); // No outputs defined so nothing to control error = 1; } #endif } } if (!error) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{")); + Response_P(PSTR("{")); PrepShowTimer(index); - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s}"), mqtt_data); + ResponseAppend_P(PSTR("}")); } } else if (CMND_TIMERS == command_code) { @@ -461,21 +461,21 @@ bool TimerCommand(void) } } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, GetStateText(Settings.flag3.timers_enable)); + Response_P(S_JSON_COMMAND_SVALUE, command, GetStateText(Settings.flag3.timers_enable)); MqttPublishPrefixTopic_P(RESULT_OR_STAT, command); uint8_t jsflg = 0; uint8_t lines = 1; for (uint8_t i = 0; i < MAX_TIMERS; i++) { if (!jsflg) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_TIMERS "%d\":{"), lines++); + Response_P(PSTR("{\"" D_CMND_TIMERS "%d\":{"), lines++); } else { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,"), mqtt_data); + ResponseAppend_P(PSTR(",")); } jsflg++; PrepShowTimer(i +1); if (jsflg > 3) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s}}"), mqtt_data); + ResponseAppend_P(PSTR("}}")); MqttPublishPrefixTopic_P(RESULT_OR_STAT, PSTR(D_CMND_TIMERS)); jsflg = 0; } @@ -489,7 +489,7 @@ bool TimerCommand(void) } char lbuff[33]; dtostrfd(((double)Settings.longitude) /1000000, 6, lbuff); - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, lbuff); + Response_P(S_JSON_COMMAND_SVALUE, command, lbuff); } else if (CMND_LATITUDE == command_code) { if (XdrvMailbox.data_len) { @@ -497,7 +497,7 @@ bool TimerCommand(void) } char lbuff[33]; dtostrfd(((double)Settings.latitude) /1000000, 6, lbuff); - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, lbuff); + Response_P(S_JSON_COMMAND_SVALUE, command, lbuff); } #endif else serviced = false; // Unknown command @@ -517,9 +517,9 @@ bool TimerCommand(void) const char S_CONFIGURE_TIMER[] PROGMEM = D_CONFIGURE_TIMER; const char HTTP_BTN_MENU_TIMER[] PROGMEM = - "
"; + "

"; -const char HTTP_TIMER_SCRIPT[] PROGMEM = +const char HTTP_TIMER_SCRIPT1[] PROGMEM = "var pt=[],ct=99;" "function qs(s){" // Alias to save code space "return document.querySelector(s);" @@ -528,8 +528,9 @@ const char HTTP_TIMER_SCRIPT[] PROGMEM = "var o=document.createElement('option');" "o.textContent=i;" "q.appendChild(o);" - "}" + "}"; #ifdef USE_SUNRISE +const char HTTP_TIMER_SCRIPT2[] PROGMEM = "function gt(){" // Set hours and minutes according to mode "var m,p,q;" "m=qs('input[name=\"rd\"]:checked').value;" // Get mode @@ -537,7 +538,7 @@ const char HTTP_TIMER_SCRIPT[] PROGMEM = "if(m==0){" // Time is set "so(0);" // Hide offset span and allow Hour 00..23 "q=Math.floor(p/60);if(q<10){q='0'+q;}qs('#ho').value=q;" // Set hours - "q=p%60;if(q<10){q='0'+q;}qs('#mi').value=q;" // Set minutes + "q=p%%60;if(q<10){q='0'+q;}qs('#mi').value=q;" // Set minutes "}" "if((m==1)||(m==2)){" // Sunrise or sunset is set "so(1);" // Show offset span and allow Hour 00..11 @@ -545,7 +546,7 @@ const char HTTP_TIMER_SCRIPT[] PROGMEM = "if(q>=12){q-=12;qs('#dr').selectedIndex=1;}" // Negative offset "else{qs('#dr').selectedIndex=0;}" "if(q<10){q='0'+q;}qs('#ho').value=q;" // Set offset hours - "q=p%60;if(q<10){q='0'+q;}qs('#mi').value=q;" // Set offset minutes + "q=p%%60;if(q<10){q='0'+q;}qs('#mi').value=q;" // Set offset minutes "}" "}" "function so(b){" // Hide or show offset items @@ -558,8 +559,9 @@ const char HTTP_TIMER_SCRIPT[] PROGMEM = "qs('#dr').disabled='disabled';" "if(e<23){for(i=12;i<=23;i++){ce(i,o);}}" // Create hours select options "}" - "}" + "}"; #endif +const char HTTP_TIMER_SCRIPT3[] PROGMEM = "function st(){" // Save parameters to hidden area "var i,l,m,n,p,s;" "m=0;s=0;" @@ -570,7 +572,7 @@ const char HTTP_TIMER_SCRIPT[] PROGMEM = "m=qs('input[name=\"rd\"]:checked').value;" // Check mode "s|=(qs('input[name=\"rd\"]:checked').value<<29);" // Get mode #endif - "if(}1>0){" + "if(%d>0){" "i=qs('#d1').selectedIndex;if(i>=0){s|=(i<<23);}" // Get output "s|=(qs('#p1').selectedIndex<<27);" // Get action "}else{" @@ -587,14 +589,15 @@ const char HTTP_TIMER_SCRIPT[] PROGMEM = "s|=((qs('#mw').selectedIndex)&0x0F)<<11;" // Get window minutes "pt[ct]=s;" "eb('t0').value=pt.join();" // Save parameters from array to hidden area - "}" + "}"; +const char HTTP_TIMER_SCRIPT4[] PROGMEM = "function ot(t,e){" // Select tab and update elements "var i,n,o,p,q,s;" "if(ct<99){st();}" // Save changes "ct=t;" "o=document.getElementsByClassName('tl');" // Restore style to all tabs/buttons - "for(i=0;i>29)&3;eb('b'+p).checked=1;" // Set mode @@ -602,23 +605,29 @@ const char HTTP_TIMER_SCRIPT[] PROGMEM = #else "p=s&0x7FF;" // Get time "q=Math.floor(p/60);if(q<10){q='0'+q;}qs('#ho').value=q;" // Set hours - "q=p%60;if(q<10){q='0'+q;}qs('#mi').value=q;" // Set minutes + "q=p%%60;if(q<10){q='0'+q;}qs('#mi').value=q;" // Set minutes #endif "q=(s>>11)&0xF;if(q<10){q='0'+q;}qs('#mw').value=q;" // Set window minutes "for(i=0;i<7;i++){p=(s>>(16+i))&1;eb('w'+i).checked=p;}" // Set weekdays - "if(}1>0){" + "if(%d>0){" "p=(s>>23)&0xF;qs('#d1').value=p+1;" // Set output "p=(s>>27)&3;qs('#p1').selectedIndex=p;" // Set action "}" "p=(s>>15)&1;eb('r0').checked=p;" // Set repeat "p=(s>>31)&1;eb('a0').checked=p;" // Set arm - "}" + "}"; +const char HTTP_TIMER_SCRIPT5[] PROGMEM = "function it(){" // Initialize elements and select first tab "var b,i,o,s;" "pt=eb('t0').value.split(',').map(Number);" // Get parameters from hidden area to array - "s='';for(i=0;i<" STR(MAX_TIMERS) ";i++){b='';if(0==i){b=\" id='dP'\";}s+=\"\"}" + "s='';" + "for(i=0;i<%d;i++){" + "b='';" + "if(0==i){b=\" id='dP'\";}" + "s+=\"\"" + "}" "eb('bt').innerHTML=s;" // Create tabs - "if(}1>0){" // Create Output and Action drop down boxes + "if(%d>0){" // Create Output and Action drop down boxes "eb('oa').innerHTML=\"" D_TIMER_OUTPUT " " D_TIMER_ACTION " \";" "o=qs('#p1');ce('" D_OFF "',o);ce('" D_ON "',o);ce('" D_TOGGLE "',o);" // Create offset direction select options #ifdef USE_RULES @@ -628,50 +637,52 @@ const char HTTP_TIMER_SCRIPT[] PROGMEM = #endif "}else{" "eb('oa').innerHTML=\"" D_TIMER_ACTION " " D_RULE "\";" // No outputs but rule is allowed - "}" + "}"; +const char HTTP_TIMER_SCRIPT6[] PROGMEM = #ifdef USE_SUNRISE "o=qs('#dr');ce('+',o);ce('-',o);" // Create offset direction select options #endif "o=qs('#ho');for(i=0;i<=23;i++){ce((i<10)?('0'+i):i,o);}" // Create hours select options "o=qs('#mi');for(i=0;i<=59;i++){ce((i<10)?('0'+i):i,o);}" // Create minutes select options "o=qs('#mw');for(i=0;i<=15;i++){ce((i<10)?('0'+i):i,o);}" // Create window minutes select options - "o=qs('#d1');for(i=0;i<}1;i++){ce(i+1,o);}" // Create outputs + "o=qs('#d1');for(i=0;i<%d;i++){ce(i+1,o);}" // Create outputs "var a='" D_DAY3LIST "';" - "s='';for(i=0;i<7;i++){s+=\"\"+a.substring(i*3,(i*3)+3)+\"\"}" + "s='';for(i=0;i<7;i++){s+=\"\"+a.substring(i*3,(i*3)+3)+\" \"}" "eb('ds').innerHTML=s;" // Create weekdays "eb('dP').click();" // Get the element with id='dP' and click on it - "}"; + "}" + "window.onload=it;"; const char HTTP_TIMER_STYLE[] PROGMEM = - ".tl{float:left;border-radius:0;border:1px solid #fff;padding:1px;width:6.25%;}" -#ifdef USE_SUNRISE - "input[type='radio']{width:13px;height:24px;margin-top:-1px;margin-right:8px;vertical-align:middle;}" -#endif - ""; -const char HTTP_FORM_TIMER[] PROGMEM = + ".tl{float:left;border-radius:0;border:1px solid #f2f2f2;padding:1px;width:6.25%%;}"; // Border color needs to be the same as Fieldset background color from HTTP_HEAD_STYLE1 (transparent won't work) +const char HTTP_FORM_TIMER1[] PROGMEM = "
" " " D_TIMER_PARAMETERS " " "
" - "
" D_TIMER_ENABLE "


" + "
" D_TIMER_ENABLE "


" "



" "

" "
" - "" D_TIMER_ARM " " - "" D_TIMER_REPEAT "" + "" D_TIMER_ARM " " + "" D_TIMER_REPEAT "" "

" - "
" + "
"; #ifdef USE_SUNRISE - "
" +const char HTTP_FORM_TIMER3[] PROGMEM = + "
" "" D_TIMER_TIME "
" - "" D_SUNRISE " (}8)
" - "" D_SUNSET " (}9)
" + "" D_SUNRISE " (%s)
" + "" D_SUNSET " (%s)
" "
" + "

" "" - " " + " "; #else - "" D_TIMER_TIME " " +const char HTTP_FORM_TIMER3[] PROGMEM = + "" D_TIMER_TIME " "; #endif // USE_SUNRISE +const char HTTP_FORM_TIMER4[] PROGMEM = "" " " D_HOUR_MINUTE_SEPARATOR " " "" @@ -692,28 +703,30 @@ void HandleTimerConfiguration(void) return; } - String page = FPSTR(HTTP_HEAD); - page.replace(F("{v}"), FPSTR(S_CONFIGURE_TIMER)); - page += FPSTR(HTTP_TIMER_SCRIPT); - page += FPSTR(HTTP_HEAD_STYLE); - page.replace(F(""), FPSTR(HTTP_TIMER_STYLE)); - page += FPSTR(HTTP_FORM_TIMER); - page.replace(F("{e0"), (Settings.flag3.timers_enable) ? F(" checked") : F("")); - for (uint8_t i = 0; i < MAX_TIMERS; i++) { - if (i > 0) { page += F(","); } - page += String(Settings.timer[i].data); - } - page += FPSTR(HTTP_FORM_TIMER1); - page.replace(F("}1"), String(devices_present)); + WSContentStart_P(S_CONFIGURE_TIMER); + WSContentSend_P(HTTP_TIMER_SCRIPT1); #ifdef USE_SUNRISE - page.replace(F("}8"), GetSun(0)); // Add Sunrise - page.replace(F("}9"), GetSun(1)); // Add Sunset - page.replace(F("299"), String(100 + (strlen(D_SUNSET) *12))); // Fix string length to keep radios centered + WSContentSend_P(HTTP_TIMER_SCRIPT2); #endif // USE_SUNRISE - page += FPSTR(HTTP_FORM_END); - page += F(""); // Init elements and select first tab/button - page += FPSTR(HTTP_BTN_CONF); - ShowPage(page); + WSContentSend_P(HTTP_TIMER_SCRIPT3, devices_present); + WSContentSend_P(HTTP_TIMER_SCRIPT4, devices_present); + WSContentSend_P(HTTP_TIMER_SCRIPT5, MAX_TIMERS, devices_present); + WSContentSend_P(HTTP_TIMER_SCRIPT6, devices_present); + WSContentSendStyle_P(HTTP_TIMER_STYLE); + WSContentSend_P(HTTP_FORM_TIMER1, (Settings.flag3.timers_enable) ? " checked" : ""); + for (uint8_t i = 0; i < MAX_TIMERS; i++) { + WSContentSend_P(PSTR("%s%u"), (i > 0) ? "," : "", Settings.timer[i].data); + } + WSContentSend_P(HTTP_FORM_TIMER2); +#ifdef USE_SUNRISE + WSContentSend_P(HTTP_FORM_TIMER3, 100 + (strlen(D_SUNSET) *12), GetSun(0).c_str(), GetSun(1).c_str()); +#else + WSContentSend_P(HTTP_FORM_TIMER3); +#endif // USE_SUNRISE + WSContentSend_P(HTTP_FORM_TIMER4); + WSContentSend_P(HTTP_FORM_END); + WSContentSpaceButton(BUTTON_CONFIGURATION); + WSContentStop(); } void TimerSaveSettings(void) @@ -756,9 +769,9 @@ bool Xdrv09(uint8_t function) #ifdef USE_TIMERS_WEB case FUNC_WEB_ADD_BUTTON: #ifdef USE_RULES - strncat_P(mqtt_data, HTTP_BTN_MENU_TIMER, sizeof(mqtt_data) - strlen(mqtt_data) -1); + WSContentSend_P(HTTP_BTN_MENU_TIMER); #else - if (devices_present) { strncat_P(mqtt_data, HTTP_BTN_MENU_TIMER, sizeof(mqtt_data) - strlen(mqtt_data) -1); } + if (devices_present) { WSContentSend_P(HTTP_BTN_MENU_TIMER); } #endif // USE_RULES break; case FUNC_WEB_ADD_HANDLER: diff --git a/sonoff/xdrv_10_rules.ino b/sonoff/xdrv_10_rules.ino index 327c128dc..2a93ee86f 100644 --- a/sonoff/xdrv_10_rules.ino +++ b/sonoff/xdrv_10_rules.ino @@ -75,6 +75,8 @@ #define D_CMND_MULT "Mult" #define D_CMND_SCALE "Scale" #define D_CMND_CALC_RESOLUTION "CalcRes" +#define D_CMND_SUBSCRIBE "Subscribe" +#define D_CMND_UNSUBSCRIBE "Unsubscribe" #define D_JSON_INITIATED "Initiated" @@ -90,8 +92,33 @@ #define MAXIMUM_COMPARE_OPERATOR COMPARE_OPERATOR_SMALLER_EQUAL const char kCompareOperators[] PROGMEM = "=\0>\0<\0|\0==!=>=<="; -enum RulesCommands { CMND_RULE, CMND_RULETIMER, CMND_EVENT, CMND_VAR, CMND_MEM, CMND_ADD, CMND_SUB, CMND_MULT, CMND_SCALE, CMND_CALC_RESOLUTION }; -const char kRulesCommands[] PROGMEM = D_CMND_RULE "|" D_CMND_RULETIMER "|" D_CMND_EVENT "|" D_CMND_VAR "|" D_CMND_MEM "|" D_CMND_ADD "|" D_CMND_SUB "|" D_CMND_MULT "|" D_CMND_SCALE "|" D_CMND_CALC_RESOLUTION ; +#ifdef USE_EXPRESSION + #include // Import LinkedList library + + const char kExpressionOperators[] PROGMEM = "+-*/%^"; + #define EXPRESSION_OPERATOR_ADD 0 + #define EXPRESSION_OPERATOR_SUBTRACT 1 + #define EXPRESSION_OPERATOR_MULTIPLY 2 + #define EXPRESSION_OPERATOR_DIVIDEDBY 3 + #define EXPRESSION_OPERATOR_MODULO 4 + #define EXPRESSION_OPERATOR_POWER 5 + + const uint8_t kExpressionOperatorsPriorities[] PROGMEM = {1, 1, 2, 2, 3, 4}; + #define MAX_EXPRESSION_OPERATOR_PRIORITY 4 +#endif // USE_EXPRESSION + +enum RulesCommands { CMND_RULE, CMND_RULETIMER, CMND_EVENT, CMND_VAR, CMND_MEM, CMND_ADD, CMND_SUB, CMND_MULT, CMND_SCALE, CMND_CALC_RESOLUTION, CMND_SUBSCRIBE, CMND_UNSUBSCRIBE }; +const char kRulesCommands[] PROGMEM = D_CMND_RULE "|" D_CMND_RULETIMER "|" D_CMND_EVENT "|" D_CMND_VAR "|" D_CMND_MEM "|" D_CMND_ADD "|" D_CMND_SUB "|" D_CMND_MULT "|" D_CMND_SCALE "|" D_CMND_CALC_RESOLUTION "|" D_CMND_SUBSCRIBE "|" D_CMND_UNSUBSCRIBE ; + +#ifdef SUPPORT_MQTT_EVENT + #include // Import LinkedList library + typedef struct { + String Event; + String Topic; + String Key; + } MQTT_Subscription; + LinkedList subscriptions; +#endif //SUPPORT_MQTT_EVENT String rules_event_value; unsigned long rules_timer[MAX_RULE_TIMERS] = { 0 }; @@ -170,11 +197,11 @@ bool RulesRuleMatch(uint8_t rule_set, String &event, String &rule) } snprintf_P(stemp, sizeof(stemp), PSTR("%%TIME%%")); if (rule_param.startsWith(stemp)) { - rule_param = String(GetMinutesPastMidnight()); + rule_param = String(MinutesPastMidnight()); } snprintf_P(stemp, sizeof(stemp), PSTR("%%UPTIME%%")); if (rule_param.startsWith(stemp)) { - rule_param = String(GetMinutesUptime()); + rule_param = String(MinutesUptime()); } snprintf_P(stemp, sizeof(stemp), PSTR("%%TIMESTAMP%%")); if (rule_param.startsWith(stemp)) { @@ -183,15 +210,15 @@ bool RulesRuleMatch(uint8_t rule_set, String &event, String &rule) #if defined(USE_TIMERS) && defined(USE_SUNRISE) snprintf_P(stemp, sizeof(stemp), PSTR("%%SUNRISE%%")); if (rule_param.startsWith(stemp)) { - rule_param = String(GetSunMinutes(0)); + rule_param = String(SunMinutes(0)); } snprintf_P(stemp, sizeof(stemp), PSTR("%%SUNSET%%")); if (rule_param.startsWith(stemp)) { - rule_param = String(GetSunMinutes(1)); + rule_param = String(SunMinutes(1)); } #endif // USE_TIMERS and USE_SUNRISE rule_param.toUpperCase(); - snprintf(rule_svalue, sizeof(rule_svalue), rule_param.c_str()); + strlcpy(rule_svalue, rule_param.c_str(), sizeof(rule_svalue)); int temp_value = GetStateNumber(rule_svalue); if (temp_value > -1) { @@ -210,9 +237,8 @@ bool RulesRuleMatch(uint8_t rule_set, String &event, String &rule) double value = 0; const char* str_value = root[rule_task][rule_name]; -//snprintf_P(log_data, sizeof(log_data), PSTR("RUL: Task %s, Name %s, Value |%s|, TrigCnt %d, TrigSt %d, Source %s, Json %s"), +//AddLog_P2(LOG_LEVEL_DEBUG, PSTR("RUL: Task %s, Name %s, Value |%s|, TrigCnt %d, TrigSt %d, Source %s, Json %s"), // rule_task.c_str(), rule_name.c_str(), rule_svalue, rules_trigger_count[rule_set], bitRead(rules_triggers[rule_set], rules_trigger_count[rule_set]), event.c_str(), (str_value) ? str_value : "none"); -//AddLog(LOG_LEVEL_DEBUG); if (!root[rule_task][rule_name].success()) { return false; } // No value but rule_name is ok @@ -278,8 +304,7 @@ bool RuleSetProcess(uint8_t rule_set, String &event_saved) delay(0); // Prohibit possible loop software watchdog -//snprintf_P(log_data, sizeof(log_data), PSTR("RUL: Event = %s, Rule = %s"), event_saved.c_str(), Settings.rules[rule_set]); -//AddLog(LOG_LEVEL_DEBUG); +//AddLog_P2(LOG_LEVEL_DEBUG, PSTR("RUL: Event = %s, Rule = %s"), event_saved.c_str(), Settings.rules[rule_set]); String rules = Settings.rules[rule_set]; @@ -314,8 +339,7 @@ bool RuleSetProcess(uint8_t rule_set, String &event_saved) rules_event_value = ""; String event = event_saved; -//snprintf_P(log_data, sizeof(log_data), PSTR("RUL: Event |%s|, Rule |%s|, Command(s) |%s|"), event.c_str(), event_trigger.c_str(), commands.c_str()); -//AddLog(LOG_LEVEL_DEBUG); +//AddLog_P2(LOG_LEVEL_DEBUG, PSTR("RUL: Event |%s|, Rule |%s|, Command(s) |%s|"), event.c_str(), event_trigger.c_str(), commands.c_str()); if (RulesRuleMatch(rule_set, event, event_trigger)) { commands.trim(); @@ -332,21 +356,20 @@ bool RuleSetProcess(uint8_t rule_set, String &event_saved) snprintf_P(stemp, sizeof(stemp), PSTR("%%mem%d%%"), i +1); commands.replace(stemp, Settings.mems[i]); } - commands.replace(F("%time%"), String(GetMinutesPastMidnight())); - commands.replace(F("%uptime%"), String(GetMinutesUptime())); + commands.replace(F("%time%"), String(MinutesPastMidnight())); + commands.replace(F("%uptime%"), String(MinutesUptime())); commands.replace(F("%timestamp%"), GetDateAndTime(DT_LOCAL).c_str()); #if defined(USE_TIMERS) && defined(USE_SUNRISE) - commands.replace(F("%sunrise%"), String(GetSunMinutes(0))); - commands.replace(F("%sunset%"), String(GetSunMinutes(1))); + commands.replace(F("%sunrise%"), String(SunMinutes(0))); + commands.replace(F("%sunset%"), String(SunMinutes(1))); #endif // USE_TIMERS and USE_SUNRISE char command[commands.length() +1]; - snprintf(command, sizeof(command), commands.c_str()); + strlcpy(command, commands.c_str(), sizeof(command)); - snprintf_P(log_data, sizeof(log_data), PSTR("RUL: %s performs \"%s\""), event_trigger.c_str(), command); - AddLog(LOG_LEVEL_INFO); + AddLog_P2(LOG_LEVEL_INFO, PSTR("RUL: %s performs \"%s\""), event_trigger.c_str(), command); -// snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, D_CMND_RULE, D_JSON_INITIATED); +// Response_P(S_JSON_COMMAND_SVALUE, D_CMND_RULE, D_JSON_INITIATED); // MqttPublishPrefixTopic_P(RESULT_OR_STAT, PSTR(D_CMND_RULE)); ExecuteCommand(command, SRC_RULE); @@ -364,13 +387,14 @@ bool RulesProcessEvent(char *json_event) { bool serviced = false; +#ifdef USE_DEBUG_DRIVER ShowFreeMem(PSTR("RulesProcessEvent")); +#endif String event_saved = json_event; event_saved.toUpperCase(); -//snprintf_P(log_data, sizeof(log_data), PSTR("RUL: Event %s"), event_saved.c_str()); -//AddLog(LOG_LEVEL_DEBUG); +//AddLog_P2(LOG_LEVEL_DEBUG, PSTR("RUL: Event %s"), event_saved.c_str()); for (uint8_t i = 0; i < MAX_RULE_SETS; i++) { if (strlen(Settings.rules[i]) && bitRead(Settings.rule_enabled, i)) { @@ -490,8 +514,8 @@ void RulesEvery50ms(void) json_event[0] = '\0'; switch (i) { case 0: strncpy_P(json_event, PSTR("{\"System\":{\"Boot\":1}}"), sizeof(json_event)); break; - case 1: snprintf_P(json_event, sizeof(json_event), PSTR("{\"Time\":{\"Initialized\":%d}}"), GetMinutesPastMidnight()); break; - case 2: snprintf_P(json_event, sizeof(json_event), PSTR("{\"Time\":{\"Set\":%d}}"), GetMinutesPastMidnight()); break; + case 1: snprintf_P(json_event, sizeof(json_event), PSTR("{\"Time\":{\"Initialized\":%d}}"), MinutesPastMidnight()); break; + case 2: snprintf_P(json_event, sizeof(json_event), PSTR("{\"Time\":{\"Set\":%d}}"), MinutesPastMidnight()); break; case 3: strncpy_P(json_event, PSTR("{\"MQTT\":{\"Connected\":1}}"), sizeof(json_event)); break; case 4: strncpy_P(json_event, PSTR("{\"MQTT\":{\"Disconnected\":1}}"), sizeof(json_event)); break; case 5: strncpy_P(json_event, PSTR("{\"WIFI\":{\"Connected\":1}}"), sizeof(json_event)); break; @@ -520,7 +544,7 @@ void RulesEvery100ms(void) tele_period = tele_period_save; if (strlen(mqtt_data)) { mqtt_data[0] = '{'; // {"INA219":{"Voltage":4.494,"Current":0.020,"Power":0.089} - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s}"), mqtt_data); + ResponseAppend_P(PSTR("}")); RulesProcess(); } } @@ -534,7 +558,7 @@ void RulesEverySecond(void) if (RtcTime.valid) { if ((uptime > 60) && (RtcTime.minute != rules_last_minute)) { // Execute from one minute after restart every minute only once rules_last_minute = RtcTime.minute; - snprintf_P(json_event, sizeof(json_event), PSTR("{\"Time\":{\"Minute\":%d}}"), GetMinutesPastMidnight()); + snprintf_P(json_event, sizeof(json_event), PSTR("{\"Time\":{\"Minute\":%d}}"), MinutesPastMidnight()); RulesProcessEvent(json_event); } } @@ -562,6 +586,492 @@ void RulesTeleperiod(void) rules_teleperiod = 0; } +#ifdef SUPPORT_MQTT_EVENT +/********************************************************************************************/ +/* + * Rules: Process received MQTT message. + * If the message is in our subscription list, trigger an event with the value parsed from MQTT data + * Input: + * void - We are going to access XdrvMailbox data directly. + * Return: + * true - The message is consumed. + * false - The message is not in our list. + */ +bool RulesMqttData(void) +{ + bool serviced = false; + if (XdrvMailbox.data_len < 1 || XdrvMailbox.data_len > 128) { + return false; + } + String sTopic = XdrvMailbox.topic; + String sData = XdrvMailbox.data; + //AddLog_P2(LOG_LEVEL_DEBUG, PSTR("RUL: MQTT Topic %s, Event %s"), XdrvMailbox.topic, XdrvMailbox.data); + MQTT_Subscription event_item; + //Looking for matched topic + for (int index = 0; index < subscriptions.size(); index++) { + event_item = subscriptions.get(index); + + //AddLog_P2(LOG_LEVEL_DEBUG, PSTR("RUL: Match MQTT message Topic %s with subscription topic %s"), sTopic.c_str(), event_item.Topic.c_str()); + if (sTopic.startsWith(event_item.Topic)) { + //This topic is subscribed by us, so serve it + serviced = true; + String value; + if (event_item.Key.length() == 0) { //If did not specify Key + value = sData; + } else { //If specified Key, need to parse Key/Value from JSON data + StaticJsonBuffer<400> jsonBuf; + JsonObject& jsonData = jsonBuf.parseObject(sData); + String key1 = event_item.Key; + String key2; + if (!jsonData.success()) break; //Failed to parse JSON data, ignore this message. + int dot; + if ((dot = key1.indexOf('.')) > 0) { + key2 = key1.substring(dot+1); + key1 = key1.substring(0, dot); + if (!jsonData[key1][key2].success()) break; //Failed to get the key/value, ignore this message. + value = (const char *)jsonData[key1][key2]; + } else { + if (!jsonData[key1].success()) break; + value = (const char *)jsonData[key1]; + } + } + value.trim(); + //Create an new event. Cannot directly call RulesProcessEvent(). + snprintf_P(event_data, sizeof(event_data), PSTR("%s=%s"), event_item.Event.c_str(), value.c_str()); + } + } + return serviced; +} + +/********************************************************************************************/ +/* + * Subscribe a MQTT topic (with or without key) and assign an event name to it + * Command Subscribe format: + * Subscribe , [, ] + * This command will subscribe a and give it an event name . + * The optional parameter is for parse the specified key/value from MQTT message + * payload with JSON format. + * Subscribe + * Subscribe command without any parameter will list all topics currently subscribed. + * Input: + * data - A char buffer with all the parameters + * data_len - Length of the parameters + * Return: + * A string include subscribed event, topic and key. + */ +String RulesSubscribe(const char *data, int data_len) +{ + MQTT_Subscription subscription_item; + String events; + if (data_len > 0) { + char parameters[data_len+1]; + memcpy(parameters, data, data_len); + parameters[data_len] = '\0'; + String event_name, topic, key; + + char * pos = strtok(parameters, ","); + if (pos) { + event_name = Trim(pos); + pos = strtok(nullptr, ","); + if (pos) { + topic = Trim(pos); + pos = strtok(nullptr, ","); + if (pos) { + key = Trim(pos); + } + } + } + //AddLog_P2(LOG_LEVEL_DEBUG, PSTR("RUL: Subscribe command with parameters: %s, %s, %s."), event_name.c_str(), topic.c_str(), key.c_str()); + event_name.toUpperCase(); + if (event_name.length() > 0 && topic.length() > 0) { + //Search all subscriptions + for (int index=0; index < subscriptions.size(); index++) { + if (subscriptions.get(index).Event.equals(event_name)) { + //If find exists one, remove it. + String stopic = subscriptions.get(index).Topic + "/#"; + MqttUnsubscribe(stopic.c_str()); + subscriptions.remove(index); + break; + } + } + //Add "/#" to the topic + if (!topic.endsWith("#")) { + if (topic.endsWith("/")) { + topic.concat("#"); + } else { + topic.concat("/#"); + } + } + //AddLog_P2(LOG_LEVEL_DEBUG, PSTR("RUL: New topic: %s."), topic.c_str()); + //MQTT Subscribe + subscription_item.Event = event_name; + subscription_item.Topic = topic.substring(0, topic.length() - 2); //Remove "/#" so easy to match + subscription_item.Key = key; + subscriptions.add(subscription_item); + + MqttSubscribe(topic.c_str()); + events.concat(event_name + "," + topic + + (key.length()>0 ? "," : "") + + key); + } else { + events = D_JSON_WRONG_PARAMETERS; + } + } else { + //If did not specify the event name, list all subscribed event + for (int index=0; index < subscriptions.size(); index++) { + subscription_item = subscriptions.get(index); + events.concat(subscription_item.Event + "," + subscription_item.Topic + + (subscription_item.Key.length()>0 ? "," : "") + + subscription_item.Key + "; "); + } + } + return events; +} + +/********************************************************************************************/ +/* + * Unsubscribe specified MQTT event. If no event specified, Unsubscribe all. + * Command Unsubscribe format: + * Unsubscribe [] + * Input: + * data - Event name + * data_len - Length of the parameters + * Return: + * list all the events unsubscribed. + */ +String RulesUnsubscribe(const char * data, int data_len) +{ + MQTT_Subscription subscription_item; + String events; + if (data_len > 0) { + for (int index = 0; index < subscriptions.size(); index++) { + subscription_item = subscriptions.get(index); + if (subscription_item.Event.equalsIgnoreCase(data)) { + String stopic = subscription_item.Topic + "/#"; + MqttUnsubscribe(stopic.c_str()); + events = subscription_item.Event; + subscriptions.remove(index); + break; + } + } + } else { + //If did not specify the event name, unsubscribe all event + String stopic; + while (subscriptions.size() > 0) { + events.concat(subscriptions.get(0).Event + "; "); + stopic = subscriptions.get(0).Topic + "/#"; + MqttUnsubscribe(stopic.c_str()); + subscriptions.remove(0); + } + } + return events; +} +#endif // SUPPORT_MQTT_EVENT + +#ifdef USE_EXPRESSION +/********************************************************************************************/ +/* + * Parse a number value + * Input: + * pNumber - A char pointer point to a digit started string (guaranteed) + * value - Reference a double variable used to accept the result + * Output: + * pNumber - Pointer forward to next character after the number + * value - double type, the result value + * Return: + * true - succeed + * false - failed + */ +bool findNextNumber(char * &pNumber, double &value) +{ + bool bSucceed = false; + String sNumber = ""; + while (*pNumber) { + if (isdigit(*pNumber) || (*pNumber == '.')) { + sNumber += *pNumber; + pNumber++; + } else { + break; + } + } + if (sNumber.length() > 0) { + value = CharToDouble(sNumber.c_str()); + bSucceed = true; + } + return bSucceed; +} + +/********************************************************************************************/ +/* + * Parse a variable (like VAR1, MEM3) and get its value (double type) + * Input: + * pVarname - A char pointer point to a variable name string + * value - Reference a double variable used to accept the result + * Output: + * pVarname - Pointer forward to next character after the variable + * value - double type, the result value + * Return: + * true - succeed + * false - failed + */ +bool findNextVariableValue(char * &pVarname, double &value) +{ + bool succeed = true; + value = 0; + String sVarName = ""; + while (*pVarname) { + if (isalpha(*pVarname) || isdigit(*pVarname)) { + sVarName.concat(*pVarname); + pVarname++; + } else { + break; + } + } + sVarName.toUpperCase(); + if (sVarName.startsWith(F("VAR"))) { + int index = sVarName.substring(3).toInt(); + if (index > 0 && index <= MAX_RULE_VARS) { + value = CharToDouble(vars[index -1]); + } + } else if (sVarName.startsWith(F("MEM"))) { + int index = sVarName.substring(3).toInt(); + if (index > 0 && index <= MAX_RULE_MEMS) { + value = CharToDouble(Settings.mems[index -1]); + } + } else if (sVarName.equals(F("TIME"))) { + value = MinutesPastMidnight(); + } else if (sVarName.equals(F("UPTIME"))) { + value = MinutesUptime(); + } else if (sVarName.equals(F("UTCTIME"))) { + value = UtcTime(); + } else if (sVarName.equals(F("LOCALTIME"))) { + value = LocalTime(); +#if defined(USE_TIMERS) && defined(USE_SUNRISE) + } else if (sVarName.equals(F("SUNRISE"))) { + value = SunMinutes(0); + } else if (sVarName.equals(F("SUNSET"))) { + value = SunMinutes(1); +#endif + } else { + succeed = false; + } + + return succeed; +} + +/********************************************************************************************/ +/* + * Find next object in expression and evaluate it + * An object could be: + * - A float number start with a digit, like 0.787 + * - A variable name, like VAR1, MEM3 + * - An expression enclosed with a pair of round brackets, (.....) + * Input: + * pointer - A char pointer point to a place of the expression string + * value - Reference a double variable used to accept the result + * Output: + * pointer - Pointer forward to next character after next object + * value - double type, the result value + * Return: + * true - succeed + * false - failed + */ +bool findNextObjectValue(char * &pointer, double &value) +{ + bool bSucceed = false; + while (*pointer) + { + if (isspace(*pointer)) { //Skip leading spaces + pointer++; + continue; + } + if (isdigit(*pointer)) { //This object is a number + bSucceed = findNextNumber(pointer, value); + break; + } else if (isalpha(*pointer)) { //Should be a variable like VAR12, MEM1 + bSucceed = findNextVariableValue(pointer, value); + break; + } else if (*pointer == '(') { //It is a sub expression bracketed with () + pointer++; + char * sub_exp_start = pointer; //Find out the sub expression between a pair of parenthesis. "()" + unsigned int sub_exp_len = 0; + //Look for the matched closure parenthesis.")" + bool bFindClosures = false; + uint8_t matchClosures = 1; + while (*pointer) + { + if (*pointer == ')') { + matchClosures--; + if (matchClosures == 0) { + sub_exp_len = pointer - sub_exp_start; + bFindClosures = true; + break; + } + } else if (*pointer == '(') { + matchClosures++; + } + pointer++; + } + if (bFindClosures) { + value = evaluateExpression(sub_exp_start, sub_exp_len); + bSucceed = true; + } + break; + } else { //No number, no variable, no expression, then invalid object. + break; + } + } + return bSucceed; +} + +/********************************************************************************************/ +/* + * Find next operator in expression + * An operator could be: +, - , * , / , %, ^ + * Input: + * pointer - A char pointer point to a place of the expression string + * op - Reference to a variable used to accept the result + * Output: + * pointer - Pointer forward to next character after next operator + * op - The operator. 0, 1, 2, 3, 4, 5 + * Return: + * true - succeed + * false - failed + */ +bool findNextOperator(char * &pointer, int8_t &op) +{ + bool bSucceed = false; + while (*pointer) + { + if (isspace(*pointer)) { //Skip leading spaces + pointer++; + continue; + } + if (char *pch = strchr(kExpressionOperators, *pointer)) { //If it is an operator + op = (int8_t)(pch - kExpressionOperators); + pointer++; + bSucceed = true; + } + break; + } + return bSucceed; +} +/********************************************************************************************/ +/* + * Calculate a simple expression composed by 2 value and 1 operator, like 2 * 3 + * Input: + * pointer - A char pointer point to a place of the expression string + * value - Reference a double variable used to accept the result + * Output: + * pointer - Pointer forward to next character after next object + * value - double type, the result value + * Return: + * true - succeed + * false - failed + */ +double calculateTwoValues(double v1, double v2, uint8_t op) +{ + switch (op) + { + case EXPRESSION_OPERATOR_ADD: + return v1 + v2; + case EXPRESSION_OPERATOR_SUBTRACT: + return v1 - v2; + case EXPRESSION_OPERATOR_MULTIPLY: + return v1 * v2; + case EXPRESSION_OPERATOR_DIVIDEDBY: + return (0 == v2) ? 0 : (v1 / v2); + case EXPRESSION_OPERATOR_MODULO: + return (0 == v2) ? 0 : (int(v1) % int(v2)); + case EXPRESSION_OPERATOR_POWER: + return FastPrecisePow(v1, v2); + } + return 0; +} + +/********************************************************************************************/ +/* + * Parse and evaluate an expression. + * For example: "10 * ( MEM2 + 1) / 2" + * Right now, only support operators listed here: (order by priority) + * Priority 4: ^ (power) + * Priority 3: % (modulo, always get integer result) + * Priority 2: *, / + * Priority 1: +, - + * Input: + * expression - The expression to be evaluated + * len - Length of the expression + * Return: + * double - result. + * 0 - if the expression is invalid + * An example: + * MEM1 = 3, MEM2 = 6, VAR2 = 15, VAR10 = 80 + * At beginning, the expression might be complicated like: 3.14 * (MEM1 * (10 + VAR2 ^2) - 100) % 10 + VAR10 / (2 + MEM2) + * We are going to scan the whole expression, evaluate each object. + * Finally we will have a value list:. + * Order Object Value + * 0 3.14 3.14 + * 1 (MEM1 * (10 + VAR2 ^2) - 100) 605 + * 2 10 10 + * 3 VAR10 80 + * 4 (2 + MEM2) 8 + * And an operator list: + * Order Operator Priority + * 0 * 2 + * 1 % 3 + * 2 + 1 + * 3 / 2 + */ +double evaluateExpression(const char * expression, unsigned int len) +{ + char expbuf[len + 1]; + memcpy(expbuf, expression, len); + expbuf[len] = '\0'; + char * scan_pointer = expbuf; + + LinkedList object_values; + LinkedList operators; + int8_t op; + double va; + //Find and add the value of first object + if (findNextObjectValue(scan_pointer, va)) { + object_values.add(va); + } else { + return 0; + } + while (*scan_pointer) + { + if (findNextOperator(scan_pointer, op) + && *scan_pointer + && findNextObjectValue(scan_pointer, va)) + { + operators.add(op); + object_values.add(va); + } else { + //No operator followed or no more object after this operator, we done. + break; + } + } + + //Going to evaluate the whole expression + //Calculate by order of operator priorities. Looking for all operators with specified priority (from High to Low) + for (int8_t priority = MAX_EXPRESSION_OPERATOR_PRIORITY; priority>0; priority--) { + int index = 0; + while (index < operators.size()) { + if (priority == kExpressionOperatorsPriorities[(operators.get(index))]) { //need to calculate the operator first + //get current object value and remove the next object with current operator + va = calculateTwoValues(object_values.get(index), object_values.remove(index + 1), operators.remove(index)); + //Replace the current value with the result + object_values.set(index, va); + } else { + index++; + } + } + } + return object_values.get(0); +} +#endif //USE_EXPRESSION + bool RulesCommand(void) { char command[CMDSZ]; @@ -620,39 +1130,52 @@ bool RulesCommand(void) } else if ((CMND_RULETIMER == command_code) && (index > 0) && (index <= MAX_RULE_TIMERS)) { if (XdrvMailbox.data_len > 0) { +#ifdef USE_EXPRESSION + double timer_set = evaluateExpression(XdrvMailbox.data, XdrvMailbox.data_len); + rules_timer[index -1] = (timer_set > 0) ? millis() + (1000 * timer_set) : 0; +#else rules_timer[index -1] = (XdrvMailbox.payload > 0) ? millis() + (1000 * XdrvMailbox.payload) : 0; +#endif //USE_EXPRESSION } mqtt_data[0] = '\0'; for (uint8_t i = 0; i < MAX_RULE_TIMERS; i++) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s%c\"T%d\":%d"), mqtt_data, (i) ? ',' : '{', i +1, (rules_timer[i]) ? (rules_timer[i] - millis()) / 1000 : 0); + ResponseAppend_P(PSTR("%c\"T%d\":%d"), (i) ? ',' : '{', i +1, (rules_timer[i]) ? (rules_timer[i] - millis()) / 1000 : 0); } - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s}"), mqtt_data); + ResponseAppend_P(PSTR("}")); } else if (CMND_EVENT == command_code) { if (XdrvMailbox.data_len > 0) { strlcpy(event_data, XdrvMailbox.data, sizeof(event_data)); } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, D_JSON_DONE); + Response_P(S_JSON_COMMAND_SVALUE, command, D_JSON_DONE); } else if ((CMND_VAR == command_code) && (index > 0) && (index <= MAX_RULE_VARS)) { if (XdrvMailbox.data_len > 0) { +#ifdef USE_EXPRESSION + dtostrfd(evaluateExpression(XdrvMailbox.data, XdrvMailbox.data_len), Settings.flag2.calc_resolution, vars[index -1]); +#else strlcpy(vars[index -1], ('"' == XdrvMailbox.data[0]) ? "" : XdrvMailbox.data, sizeof(vars[index -1])); +#endif //USE_EXPRESSION bitSet(vars_event, index -1); } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_INDEX_SVALUE, command, index, vars[index -1]); + Response_P(S_JSON_COMMAND_INDEX_SVALUE, command, index, vars[index -1]); } else if ((CMND_MEM == command_code) && (index > 0) && (index <= MAX_RULE_MEMS)) { if (XdrvMailbox.data_len > 0) { +#ifdef USE_EXPRESSION + dtostrfd(evaluateExpression(XdrvMailbox.data, XdrvMailbox.data_len), Settings.flag2.calc_resolution, Settings.mems[index -1]); +#else strlcpy(Settings.mems[index -1], ('"' == XdrvMailbox.data[0]) ? "" : XdrvMailbox.data, sizeof(Settings.mems[index -1])); +#endif //USE_EXPRESSION bitSet(mems_event, index -1); } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_INDEX_SVALUE, command, index, Settings.mems[index -1]); + Response_P(S_JSON_COMMAND_INDEX_SVALUE, command, index, Settings.mems[index -1]); } else if (CMND_CALC_RESOLUTION == command_code) { if ((XdrvMailbox.payload >= 0) && (XdrvMailbox.payload <= 7)) { Settings.flag2.calc_resolution = XdrvMailbox.payload; } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_NVALUE, command, Settings.flag2.calc_resolution); + Response_P(S_JSON_COMMAND_NVALUE, command, Settings.flag2.calc_resolution); } else if ((CMND_ADD == command_code) && (index > 0) && (index <= MAX_RULE_VARS)) { if (XdrvMailbox.data_len > 0) { @@ -660,7 +1183,7 @@ bool RulesCommand(void) dtostrfd(tempvar, Settings.flag2.calc_resolution, vars[index -1]); bitSet(vars_event, index -1); } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_INDEX_SVALUE, command, index, vars[index -1]); + Response_P(S_JSON_COMMAND_INDEX_SVALUE, command, index, vars[index -1]); } else if ((CMND_SUB == command_code) && (index > 0) && (index <= MAX_RULE_VARS)) { if (XdrvMailbox.data_len > 0) { @@ -668,7 +1191,7 @@ bool RulesCommand(void) dtostrfd(tempvar, Settings.flag2.calc_resolution, vars[index -1]); bitSet(vars_event, index -1); } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_INDEX_SVALUE, command, index, vars[index -1]); + Response_P(S_JSON_COMMAND_INDEX_SVALUE, command, index, vars[index -1]); } else if ((CMND_MULT == command_code) && (index > 0) && (index <= MAX_RULE_VARS)) { if (XdrvMailbox.data_len > 0) { @@ -676,11 +1199,11 @@ bool RulesCommand(void) dtostrfd(tempvar, Settings.flag2.calc_resolution, vars[index -1]); bitSet(vars_event, index -1); } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_INDEX_SVALUE, command, index, vars[index -1]); + Response_P(S_JSON_COMMAND_INDEX_SVALUE, command, index, vars[index -1]); } else if ((CMND_SCALE == command_code) && (index > 0) && (index <= MAX_RULE_VARS)) { if (XdrvMailbox.data_len > 0) { - if (strstr(XdrvMailbox.data, ",")) { // Process parameter entry + if (strstr(XdrvMailbox.data, ",") != nullptr) { // Process parameter entry char sub_string[XdrvMailbox.data_len +1]; double valueIN = CharToDouble(subStr(sub_string, XdrvMailbox.data, ",", 1)); @@ -693,7 +1216,15 @@ bool RulesCommand(void) bitSet(vars_event, index -1); } } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_INDEX_SVALUE, command, index, vars[index -1]); + Response_P(S_JSON_COMMAND_INDEX_SVALUE, command, index, vars[index -1]); +#ifdef SUPPORT_MQTT_EVENT + } else if (CMND_SUBSCRIBE == command_code) { //MQTT Subscribe command. Subscribe , [, ] + String result = RulesSubscribe(XdrvMailbox.data, XdrvMailbox.data_len); + Response_P(S_JSON_COMMAND_SVALUE, command, result.c_str()); + } else if (CMND_UNSUBSCRIBE == command_code) { //MQTT Un-subscribe command. UnSubscribe + String result = RulesUnsubscribe(XdrvMailbox.data, XdrvMailbox.data_len); + Response_P(S_JSON_COMMAND_SVALUE, command, result.c_str()); +#endif //SUPPORT_MQTT_EVENT } else serviced = false; // Unknown command @@ -735,6 +1266,11 @@ bool Xdrv10(uint8_t function) case FUNC_RULES_PROCESS: result = RulesProcess(); break; +#ifdef SUPPORT_MQTT_EVENT + case FUNC_MQTT_DATA: + result = RulesMqttData(); + break; +#endif //SUPPORT_MQTT_EVENT } return result; } diff --git a/sonoff/xdrv_11_knx.ino b/sonoff/xdrv_11_knx.ino index 1dc380d21..ee7e8b291 100644 --- a/sonoff/xdrv_11_knx.ino +++ b/sonoff/xdrv_11_knx.ino @@ -247,11 +247,10 @@ void KNX_ADD_GA( uint8_t GAop, uint8_t GA_FNUM, uint8_t GA_AREA, uint8_t GA_FDEF Settings.knx_GA_registered++; - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_KNX D_ADD " GA #%d: %s " D_TO " %d/%d/%d"), + AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_KNX D_ADD " GA #%d: %s " D_TO " %d/%d/%d"), Settings.knx_GA_registered, device_param_ga[GAop-1], GA_FNUM, GA_AREA, GA_FDEF ); - AddLog(LOG_LEVEL_DEBUG); } @@ -297,9 +296,8 @@ void KNX_DEL_GA( uint8_t GAnum ) Settings.knx_GA_registered--; - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_KNX D_DELETE " GA #%d"), + AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_KNX D_DELETE " GA #%d"), GAnum ); - AddLog(LOG_LEVEL_DEBUG); } @@ -330,11 +328,10 @@ void KNX_ADD_CB( uint8_t CBop, uint8_t CB_FNUM, uint8_t CB_AREA, uint8_t CB_FDEF Settings.knx_CB_registered++; - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_KNX D_ADD " CB #%d: %d/%d/%d " D_TO " %s"), + AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_KNX D_ADD " CB #%d: %d/%d/%d " D_TO " %s"), Settings.knx_CB_registered, CB_FNUM, CB_AREA, CB_FDEF, device_param_cb[CBop-1] ); - AddLog(LOG_LEVEL_DEBUG); } @@ -387,8 +384,7 @@ void KNX_DEL_CB( uint8_t CBnum ) device_param[oldparam-1].CB_id = KNX_Empty; } - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_KNX D_DELETE " CB #%d"), CBnum ); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_KNX D_DELETE " CB #%d"), CBnum ); } @@ -445,8 +441,7 @@ bool KNX_CONFIG_NOT_MATCH(void) void KNXStart(void) { knx.start(nullptr); - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_KNX D_START)); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_KNX D_START)); } @@ -522,8 +517,7 @@ void KNX_INIT(void) if (KNX_CONFIG_NOT_MATCH()) { Settings.knx_GA_registered = 0; Settings.knx_CB_registered = 0; - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_KNX D_DELETE " " D_KNX_PARAMETERS )); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_KNX D_DELETE " " D_KNX_PARAMETERS)); } // Register Group Addresses to listen to @@ -555,22 +549,18 @@ void KNX_CB_Action(message_t const &msg, void *arg) if (msg.data_len == 1) { // COMMAND - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_KNX D_RECEIVED_FROM " %d.%d.%d " D_COMMAND " %s: %d " D_TO " %s"), - msg.received_on.ga.area, msg.received_on.ga.line, msg.received_on.ga.member, - (msg.ct == KNX_CT_WRITE) ? D_KNX_COMMAND_WRITE : (msg.ct == KNX_CT_READ) ? D_KNX_COMMAND_READ : D_KNX_COMMAND_OTHER, - msg.data[0], - device_param_cb[(chan->type)-1]); + tempchar[0] = msg.data[0]; + tempchar[1] = '\0'; } else { // VALUE float tempvar = knx.data_to_2byte_float(msg.data); dtostrfd(tempvar,2,tempchar); - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_KNX D_RECEIVED_FROM " %d.%d.%d " D_COMMAND " %s: %s " D_TO " %s"), - msg.received_on.ga.area, msg.received_on.ga.line, msg.received_on.ga.member, - (msg.ct == KNX_CT_WRITE) ? D_KNX_COMMAND_WRITE : (msg.ct == KNX_CT_READ) ? D_KNX_COMMAND_READ : D_KNX_COMMAND_OTHER, - tempchar, - device_param_cb[(chan->type)-1]); } - AddLog(LOG_LEVEL_INFO); + AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_KNX D_RECEIVED_FROM " %d.%d.%d " D_COMMAND " %s: %s " D_TO " %s"), + msg.received_on.ga.area, msg.received_on.ga.line, msg.received_on.ga.member, + (msg.ct == KNX_CT_WRITE) ? D_KNX_COMMAND_WRITE : (msg.ct == KNX_CT_READ) ? D_KNX_COMMAND_READ : D_KNX_COMMAND_OTHER, + tempchar, + device_param_cb[(chan->type)-1]); switch (msg.ct) { @@ -668,10 +658,9 @@ void KnxUpdatePowerState(uint8_t device, power_t state) knx.write_1bit(KNX_addr, device_param[device -1].last_state); } - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_KNX "%s = %d " D_SENT_TO " %d.%d.%d"), + AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_KNX "%s = %d " D_SENT_TO " %d.%d.%d"), device_param_ga[device -1], device_param[device -1].last_state, KNX_addr.ga.area, KNX_addr.ga.line, KNX_addr.ga.member); - AddLog(LOG_LEVEL_INFO); i = KNX_GA_Search(device, i + 1); } @@ -701,10 +690,9 @@ void KnxSendButtonPower(uint8_t key, uint8_t device, uint8_t state) knx.write_1bit(KNX_addr, !(state == 0)); } - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_KNX "%s = %d " D_SENT_TO " %d.%d.%d"), + AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_KNX "%s = %d " D_SENT_TO " %d.%d.%d"), device_param_ga[device + 7], !(state == 0), KNX_addr.ga.area, KNX_addr.ga.line, KNX_addr.ga.member); - AddLog(LOG_LEVEL_INFO); i = KNX_GA_Search(device + 8, i + 1); } @@ -733,10 +721,9 @@ void KnxSensor(uint8_t sensor_type, float value) knx.write_2byte_float(KNX_addr, value); } - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_KNX "%s " D_SENT_TO " %d.%d.%d "), + AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_KNX "%s " D_SENT_TO " %d.%d.%d "), device_param_ga[sensor_type -1], KNX_addr.ga.area, KNX_addr.ga.line, KNX_addr.ga.member); - AddLog(LOG_LEVEL_INFO); i = KNX_GA_Search(sensor_type, i+1); } @@ -752,20 +739,22 @@ void KnxSensor(uint8_t sensor_type, float value) const char S_CONFIGURE_KNX[] PROGMEM = D_CONFIGURE_KNX; const char HTTP_BTN_MENU_KNX[] PROGMEM = - "
"; + "

"; const char HTTP_FORM_KNX[] PROGMEM = - "
 " D_KNX_PARAMETERS " 
" + "
" + " " D_KNX_PARAMETERS " " + "" "
" "" D_KNX_PHYSICAL_ADDRESS " " - " . " - " . " - "" + " . " + " . " + "" "

" D_KNX_PHYSICAL_ADDRESS_NOTE "

" - "" D_KNX_ENABLE " " D_KNX_ENABLE "

" @@ -773,23 +762,23 @@ const char HTTP_FORM_KNX2[] PROGMEM = "
" "" D_KNX_GROUP_ADDRESS_TO_WRITE "
" - ""; const char HTTP_FORM_KNX_OPT[] PROGMEM = - ""; + ""; const char HTTP_FORM_KNX_GA[] PROGMEM = - " / " - " / " - " "; + " / " + " / " + " "; const char HTTP_FORM_KNX_ADD_BTN[] PROGMEM = - "

" - ""; + "

" + "
"; const char HTTP_FORM_KNX_ADD_TABLE_ROW[] PROGMEM = - "" - ""; + "" + ""; const char HTTP_FORM_KNX3[] PROGMEM = "
{optex} -> GAfnum / GAarea / GAfdef
%s -> %d / %d / %d

" @@ -797,11 +786,11 @@ const char HTTP_FORM_KNX3[] PROGMEM = "" D_KNX_GROUP_ADDRESS_TO_READ "
"; const char HTTP_FORM_KNX4[] PROGMEM = - "-> "; const char HTTP_FORM_KNX_ADD_TABLE_ROW2[] PROGMEM = - "GAfnum / GAarea / GAfdef -> {optex}" - ""; + "%d / %d / %d -> %s" + ""; void HandleKNXConfiguration(void) { @@ -870,70 +859,57 @@ void HandleKNXConfiguration(void) } - String page = FPSTR(HTTP_HEAD); - page.replace(F("{v}"), FPSTR(S_CONFIGURE_KNX)); - page += FPSTR(HTTP_HEAD_STYLE); - page.replace(F("340px"), F("530px")); - page += FPSTR(HTTP_FORM_KNX); + WSContentStart_P(S_CONFIGURE_KNX); + WSContentSend_P( + PSTR("function GAwarning()" + "{" + "var GA_FNUM=eb('GA_FNUM');" + "var GA_AREA=eb('GA_AREA');" + "var GA_FDEF=eb('GA_FDEF');" + "if(GA_FNUM!=null&&GA_FNUM.value=='0'&&GA_AREA.value=='0'&&GA_FDEF.value=='0'){" + "alert('" D_KNX_WARNING "');" + "}" + "}" + "function CBwarning()" + "{" + "var CB_FNUM=eb('CB_FNUM');" + "var CB_AREA=eb('CB_AREA');" + "var CB_FDEF=eb('CB_FDEF');" + "if(CB_FNUM!=null&&CB_FNUM.value=='0'&&CB_AREA.value=='0'&&CB_FDEF.value=='0'){" + "alert('" D_KNX_WARNING "');" + "}" + "}")); + WSContentSendStyle(); KNX_physs_addr.value = Settings.knx_physsical_addr; - page.replace(F("{kna"), String(KNX_physs_addr.pa.area)); - page.replace(F("{knl"), String(KNX_physs_addr.pa.line)); - page.replace(F("{knm"), String(KNX_physs_addr.pa.member)); - if ( Settings.flag.knx_enabled ) { page += F(" checked"); } - page += FPSTR(HTTP_FORM_KNX1); - if ( Settings.flag.knx_enable_enhancement ) { page += F(" checked"); } + WSContentSend_P(HTTP_FORM_KNX, KNX_physs_addr.pa.area, KNX_physs_addr.pa.line, KNX_physs_addr.pa.member); + if ( Settings.flag.knx_enabled ) { WSContentSend_P(PSTR(" checked")); } + WSContentSend_P(HTTP_FORM_KNX1); + if ( Settings.flag.knx_enable_enhancement ) { WSContentSend_P(PSTR(" checked")); } - page += FPSTR(HTTP_FORM_KNX2); + WSContentSend_P(HTTP_FORM_KNX2); for (uint8_t i = 0; i < KNX_MAX_device_param ; i++) { if ( device_param[i].show ) { - page += FPSTR(HTTP_FORM_KNX_OPT); - page.replace(F("{vop}"), String(device_param[i].type)); - page.replace(F("{nop}"), String(device_param_ga[i])); + WSContentSend_P(HTTP_FORM_KNX_OPT, device_param[i].type, device_param_ga[i]); } } - page += F(" -> "); - page += FPSTR(HTTP_FORM_KNX_GA); - page.replace(F("GAfnum"), F("GA_FNUM")); - page.replace(F("GAarea"), F("GA_AREA")); - page.replace(F("GAfdef"), F("GA_FDEF")); - page.replace(F("GAfnum"), F("GA_FNUM")); - page.replace(F("GAarea"), F("GA_AREA")); - page.replace(F("GAfdef"), F("GA_FDEF")); - page += FPSTR(HTTP_FORM_KNX_ADD_BTN); - page.replace(F("{btnval}"), String(1)); - if (Settings.knx_GA_registered < MAX_KNX_GA) { - page.replace(F("btndis"), F(" ")); - } - else - { - page.replace(F("btndis"), F("disabled")); - } - page.replace(F("fncbtnadd"), F("GAwarning")); + WSContentSend_P(PSTR(" -> ")); + WSContentSend_P(HTTP_FORM_KNX_GA, "GA_FNUM", "GA_FNUM", "GA_AREA", "GA_AREA", "GA_FDEF", "GA_FDEF"); + WSContentSend_P(HTTP_FORM_KNX_ADD_BTN, "GAwarning", (Settings.knx_GA_registered < MAX_KNX_GA) ? "" : "disabled", 1); for (uint8_t i = 0; i < Settings.knx_GA_registered ; ++i) { if ( Settings.knx_GA_param[i] ) { - page += FPSTR(HTTP_FORM_KNX_ADD_TABLE_ROW); - page.replace(F("{opval}"), String(i+1)); - page.replace(F("{optex}"), String(device_param_ga[Settings.knx_GA_param[i]-1])); KNX_addr.value = Settings.knx_GA_addr[i]; - page.replace(F("GAfnum"), String(KNX_addr.ga.area)); - page.replace(F("GAarea"), String(KNX_addr.ga.line)); - page.replace(F("GAfdef"), String(KNX_addr.ga.member)); + WSContentSend_P(HTTP_FORM_KNX_ADD_TABLE_ROW, device_param_ga[Settings.knx_GA_param[i]-1], KNX_addr.ga.area, KNX_addr.ga.line, KNX_addr.ga.member, i +1); } } - page += FPSTR(HTTP_FORM_KNX3); - page += FPSTR(HTTP_FORM_KNX_GA); - page.replace(F("GAfnum"), F("CB_FNUM")); - page.replace(F("GAarea"), F("CB_AREA")); - page.replace(F("GAfdef"), F("CB_FDEF")); - page.replace(F("GAfnum"), F("CB_FNUM")); - page.replace(F("GAarea"), F("CB_AREA")); - page.replace(F("GAfdef"), F("CB_FDEF")); - page += FPSTR(HTTP_FORM_KNX4); + WSContentSend_P(HTTP_FORM_KNX3); + WSContentSend_P(HTTP_FORM_KNX_GA, "CB_FNUM", "CB_FNUM", "CB_AREA", "CB_AREA", "CB_FDEF", "CB_FDEF"); + WSContentSend_P(HTTP_FORM_KNX4); + uint8_t j; for (uint8_t i = 0; i < KNX_MAX_device_param ; i++) { @@ -942,61 +918,24 @@ void HandleKNXConfiguration(void) if ( i == 8 ) { j = 0; } if ( device_param[j].show ) { - page += FPSTR(HTTP_FORM_KNX_OPT); - page.replace(F("{vop}"), String(device_param[i].type)); - page.replace(F("{nop}"), String(device_param_cb[i])); + WSContentSend_P(HTTP_FORM_KNX_OPT, device_param[i].type, device_param_cb[i]); } } - page += F(" "); - page += FPSTR(HTTP_FORM_KNX_ADD_BTN); - page.replace(F("{btnval}"), String(2)); - if (Settings.knx_CB_registered < MAX_KNX_CB) { - page.replace(F("btndis"), F(" ")); - } - else - { - page.replace(F("btndis"), F("disabled")); - } - page.replace(F("fncbtnadd"), F("CBwarning")); + WSContentSend_P(PSTR(" ")); + WSContentSend_P(HTTP_FORM_KNX_ADD_BTN, "CBwarning", (Settings.knx_CB_registered < MAX_KNX_CB) ? "" : "disabled", 2); for (uint8_t i = 0; i < Settings.knx_CB_registered ; ++i) { if ( Settings.knx_CB_param[i] ) { - page += FPSTR(HTTP_FORM_KNX_ADD_TABLE_ROW2); - page.replace(F("{opval}"), String(i+1)); - page.replace(F("{optex}"), String(device_param_cb[Settings.knx_CB_param[i]-1])); KNX_addr.value = Settings.knx_CB_addr[i]; - page.replace(F("GAfnum"), String(KNX_addr.ga.area)); - page.replace(F("GAarea"), String(KNX_addr.ga.line)); - page.replace(F("GAfdef"), String(KNX_addr.ga.member)); + WSContentSend_P(HTTP_FORM_KNX_ADD_TABLE_ROW2, KNX_addr.ga.area, KNX_addr.ga.line, KNX_addr.ga.member, device_param_cb[Settings.knx_CB_param[i]-1], i +1); } } - page += F("
"); - page += F("
"); - page += FPSTR(HTTP_BTN_CONF); - - page.replace( F(""), - F("function GAwarning()" - "{" - "var GA_FNUM = document.getElementById('GA_FNUM');" - "var GA_AREA = document.getElementById('GA_AREA');" - "var GA_FDEF = document.getElementById('GA_FDEF');" - "if ( GA_FNUM != null && GA_FNUM.value == '0' && GA_AREA.value == '0' && GA_FDEF.value == '0' ) {" - "alert('" D_KNX_WARNING "');" - "}" - "}" - "function CBwarning()" - "{" - "var CB_FNUM = document.getElementById('CB_FNUM');" - "var CB_AREA = document.getElementById('CB_AREA');" - "var CB_FDEF = document.getElementById('CB_FDEF');" - "if ( CB_FNUM != null && CB_FNUM.value == '0' && CB_AREA.value == '0' && CB_FDEF.value == '0' ) {" - "alert('" D_KNX_WARNING "');" - "}" - "}" - "") ); - ShowPage(page); + WSContentSend_P(PSTR("
")); + WSContentSend_P(HTTP_FORM_END); + WSContentSpaceButton(BUTTON_CONFIGURATION); + WSContentStop(); } } @@ -1009,9 +948,8 @@ void KNX_Save_Settings(void) Settings.flag.knx_enabled = WebServer->hasArg("b1"); Settings.flag.knx_enable_enhancement = WebServer->hasArg("b2"); - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_KNX D_ENABLED ": %d, " D_KNX_ENHANCEMENT ": %d"), + AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_KNX D_ENABLED ": %d, " D_KNX_ENHANCEMENT ": %d"), Settings.flag.knx_enabled, Settings.flag.knx_enable_enhancement ); - AddLog(LOG_LEVEL_DEBUG); stmp = WebServer->arg("area"); KNX_addr.pa.area = stmp.toInt(); @@ -1021,33 +959,29 @@ void KNX_Save_Settings(void) KNX_addr.pa.member = stmp.toInt(); Settings.knx_physsical_addr = KNX_addr.value; knx.physical_address_set( KNX_addr ); // Set Physical KNX Address of the device - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_KNX D_KNX_PHYSICAL_ADDRESS ": %d.%d.%d "), + AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_KNX D_KNX_PHYSICAL_ADDRESS ": %d.%d.%d "), KNX_addr.pa.area, KNX_addr.pa.line, KNX_addr.pa.member ); - AddLog(LOG_LEVEL_DEBUG); - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_KNX "GA: %d"), + AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_KNX "GA: %d"), Settings.knx_GA_registered ); - AddLog(LOG_LEVEL_DEBUG); for (uint8_t i = 0; i < Settings.knx_GA_registered ; ++i) { KNX_addr.value = Settings.knx_GA_addr[i]; - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_KNX "GA #%d: %s " D_TO " %d/%d/%d"), + AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_KNX "GA #%d: %s " D_TO " %d/%d/%d"), i+1, device_param_ga[Settings.knx_GA_param[i]-1], KNX_addr.ga.area, KNX_addr.ga.line, KNX_addr.ga.member ); - AddLog(LOG_LEVEL_DEBUG); + } - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_KNX "CB: %d"), + AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_KNX "CB: %d"), Settings.knx_CB_registered ); - AddLog(LOG_LEVEL_DEBUG); for (uint8_t i = 0; i < Settings.knx_CB_registered ; ++i) { KNX_addr.value = Settings.knx_CB_addr[i]; - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_KNX "CB #%d: %d/%d/%d " D_TO " %s"), + AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_KNX "CB #%d: %d/%d/%d " D_TO " %s"), i+1, KNX_addr.ga.area, KNX_addr.ga.line, KNX_addr.ga.member, device_param_cb[Settings.knx_CB_param[i]-1] ); - AddLog(LOG_LEVEL_DEBUG); } } @@ -1077,10 +1011,9 @@ bool KnxCommand(void) knx.write_1bit(KNX_addr, !(XdrvMailbox.payload == 0)); } - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_KNX "%s = %d " D_SENT_TO " %d.%d.%d"), + AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_KNX "%s = %d " D_SENT_TO " %d.%d.%d"), device_param_ga[index + KNX_SLOT1 -2], !(XdrvMailbox.payload == 0), KNX_addr.ga.area, KNX_addr.ga.line, KNX_addr.ga.member); - AddLog(LOG_LEVEL_INFO); i = KNX_GA_Search(index + KNX_SLOT1 -1, i + 1); } @@ -1106,10 +1039,9 @@ bool KnxCommand(void) knx.write_2byte_float(KNX_addr, tempvar); } - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_KNX "%s = %s " D_SENT_TO " %d.%d.%d"), + AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_KNX "%s = %s " D_SENT_TO " %d.%d.%d"), device_param_ga[index + KNX_SLOT1 -2], XdrvMailbox.data, KNX_addr.ga.area, KNX_addr.ga.line, KNX_addr.ga.member); - AddLog(LOG_LEVEL_INFO); i = KNX_GA_Search(index + KNX_SLOT1 -1, i + 1); } @@ -1155,7 +1087,7 @@ bool KnxCommand(void) else if (CMND_KNX_PA == command_code) { if (XdrvMailbox.data_len) { - if (strstr(XdrvMailbox.data, ".")) { // Process parameter entry + if (strstr(XdrvMailbox.data, ".") != nullptr) { // Process parameter entry char sub_string[XdrvMailbox.data_len]; int pa_area = atoi(subStr(sub_string, XdrvMailbox.data, ".", 1)); @@ -1182,7 +1114,7 @@ bool KnxCommand(void) else if ((CMND_KNX_GA == command_code) && (index > 0) && (index <= MAX_KNX_GA)) { if (XdrvMailbox.data_len) { - if (strstr(XdrvMailbox.data, ",")) { // Process parameter entry + if (strstr(XdrvMailbox.data, ",") != nullptr) { // Process parameter entry char sub_string[XdrvMailbox.data_len]; int ga_option = atoi(subStr(sub_string, XdrvMailbox.data, ",", 1)); @@ -1231,7 +1163,7 @@ bool KnxCommand(void) else if ((CMND_KNX_CB == command_code) && (index > 0) && (index <= MAX_KNX_CB)) { if (XdrvMailbox.data_len) { - if (strstr(XdrvMailbox.data, ",")) { // Process parameter entry + if (strstr(XdrvMailbox.data, ",") != nullptr) { // Process parameter entry char sub_string[XdrvMailbox.data_len]; int cb_option = atoi(subStr(sub_string, XdrvMailbox.data, ",", 1)); @@ -1292,22 +1224,22 @@ bool Xdrv11(uint8_t function) { bool result = false; switch (function) { + case FUNC_LOOP: + if (!global_state.wifi_down) { knx.loop(); } // Process knx events + break; case FUNC_PRE_INIT: KNX_INIT(); break; #ifdef USE_WEBSERVER #ifdef USE_KNX_WEB_MENU case FUNC_WEB_ADD_BUTTON: - strncat_P(mqtt_data, HTTP_BTN_MENU_KNX, sizeof(mqtt_data) - strlen(mqtt_data) -1); + WSContentSend_P(HTTP_BTN_MENU_KNX); break; case FUNC_WEB_ADD_HANDLER: WebServer->on("/kn", HandleKNXConfiguration); break; #endif // USE_KNX_WEB_MENU #endif // USE_WEBSERVER - case FUNC_LOOP: - if (!global_state.wifi_down) { knx.loop(); } // Process knx events - break; case FUNC_EVERY_50_MSECOND: if (toggle_inhibit) { toggle_inhibit--; diff --git a/sonoff/xdrv_12_home_assistant.ino b/sonoff/xdrv_12_home_assistant.ino index d815eacb2..406e6d451 100644 --- a/sonoff/xdrv_12_home_assistant.ino +++ b/sonoff/xdrv_12_home_assistant.ino @@ -44,38 +44,37 @@ const char HASS_DISCOVER_BUTTON_SWITCH[] PROGMEM = "\"pl_not_avail\":\"" D_OFFLINE "\""; // Offline const char HASS_DISCOVER_BUTTON_SWITCH_TOGGLE[] PROGMEM = - "%s,\"off_delay\":1"; // Hass has no support for TOGGLE, fake it by resetting to OFF after 1s + ",\"off_delay\":1"; // Hass has no support for TOGGLE, fake it by resetting to OFF after 1s const char HASS_DISCOVER_BUTTON_SWITCH_ONOFF[] PROGMEM = - "%s,\"frc_upd\":true," // In ON/OFF case, enable force_update to make automations work + ",\"frc_upd\":true," // In ON/OFF case, enable force_update to make automations work "\"pl_off\":\"%s\""; // OFF - const char HASS_DISCOVER_LIGHT_DIMMER[] PROGMEM = - "%s,\"bri_cmd_t\":\"%s\"," // cmnd/led2/Dimmer + ",\"bri_cmd_t\":\"%s\"," // cmnd/led2/Dimmer "\"bri_stat_t\":\"%s\"," // stat/led2/RESULT "\"bri_scl\":100," // 100% "\"on_cmd_type\":\"brightness\"," // power on (first), power on (last), no power on (brightness) "\"bri_val_tpl\":\"{{value_json." D_CMND_DIMMER "}}\""; const char HASS_DISCOVER_LIGHT_COLOR[] PROGMEM = - "%s,\"rgb_cmd_t\":\"%s2\"," // cmnd/led2/Color2 + ",\"rgb_cmd_t\":\"%s2\"," // cmnd/led2/Color2 "\"rgb_stat_t\":\"%s\"," // stat/led2/RESULT "\"rgb_val_tpl\":\"{{value_json." D_CMND_COLOR ".split(',')[0:3]|join(',')}}\""; const char HASS_DISCOVER_LIGHT_WHITE[] PROGMEM = - "%s,\"whit_val_cmd_t\":\"%s\"," // cmnd/led2/White + ",\"whit_val_cmd_t\":\"%s\"," // cmnd/led2/White "\"whit_val_stat_t\":\"%s\"," // stat/led2/RESULT "\"white_value_scale\":100," // (No abbreviation defined) "\"whit_val_tpl\":\"{{value_json.Channel[3]}}\""; const char HASS_DISCOVER_LIGHT_CT[] PROGMEM = - "%s,\"clr_temp_cmd_t\":\"%s\"," // cmnd/led2/CT + ",\"clr_temp_cmd_t\":\"%s\"," // cmnd/led2/CT "\"clr_temp_stat_t\":\"%s\"," // stat/led2/RESULT "\"clr_temp_val_tpl\":\"{{value_json." D_CMND_COLORTEMPERATURE "}}\""; const char HASS_DISCOVER_LIGHT_SCHEME[] PROGMEM = - "%s,\"fx_cmd_t\":\"%s\"," // cmnd/led2/Scheme + ",\"fx_cmd_t\":\"%s\"," // cmnd/led2/Scheme "\"fx_stat_t\":\"%s\"," // stat/led2/RESULT "\"fx_val_tpl\":\"{{value_json." D_CMND_SCHEME "}}\"," "\"fx_list\":[\"0\",\"1\",\"2\",\"3\",\"4\"]"; // string list with reference to scheme parameter. @@ -88,47 +87,47 @@ const char HASS_DISCOVER_SENSOR[] PROGMEM = "\"pl_not_avail\":\"" D_OFFLINE "\""; // Offline const char HASS_DISCOVER_SENSOR_TEMP[] PROGMEM = - "%s,\"unit_of_meas\":\"°%c\"," // °C / °F + ",\"unit_of_meas\":\"°%c\"," // °C / °F "\"val_tpl\":\"{{value_json['%s'].Temperature}}\""; // "SI7021-14":{"Temperature":null,"Humidity":null} -> {{ value_json['SI7021-14'].Temperature }} const char HASS_DISCOVER_SENSOR_HUM[] PROGMEM = - "%s,\"unit_of_meas\":\"%%\"," // % + ",\"unit_of_meas\":\"%%\"," // % "\"val_tpl\":\"{{value_json['%s'].Humidity}}\"," // "SI7021-14":{"Temperature":null,"Humidity":null} -> {{ value_json['SI7021-14'].Humidity }} "\"dev_cla\":\"humidity\""; // humidity const char HASS_DISCOVER_SENSOR_PRESS[] PROGMEM = - "%s,\"unit_of_meas\":\"%s\"," // PressureUnit() setting + ",\"unit_of_meas\":\"%s\"," // PressureUnit() setting "\"val_tpl\":\"{{value_json['%s'].Pressure}}\"," // "BME280":{"Temperature":19.7,"Humidity":27.8,"Pressure":990.1} -> {{ value_json['BME280'].Pressure }} "\"dev_cla\":\"pressure\""; // pressure //ENERGY const char HASS_DISCOVER_SENSOR_KWH[] PROGMEM = - "%s,\"unit_of_meas\":\"kWh\"," // kWh + ",\"unit_of_meas\":\"kWh\"," // kWh "\"val_tpl\":\"{{value_json['%s'].%s}}\""; // "ENERGY":{"TotalStartTime":null,"Total":null,"Yesterday":null,"Today":null,"Power":null,"ApparentPower":null,"ReactivePower":null,"Factor":null,"Voltage":null,"Current":null} -> {{ value_json['ENERGY'].Total/Yesterday/Today }} const char HASS_DISCOVER_SENSOR_WATT[] PROGMEM = - "%s,\"unit_of_meas\":\"W\"," // W + ",\"unit_of_meas\":\"W\"," // W "\"val_tpl\":\"{{value_json['%s'].%s}}\""; // "ENERGY":{"TotalStartTime":null,"Total":null,"Yesterday":null,"Today":null,"Power":null,"ApparentPower":null,"ReactivePower":null,"Factor":null,"Voltage":null,"Current":null} -> {{ value_json['ENERGY'].POWER }} const char HASS_DISCOVER_SENSOR_VOLTAGE[] PROGMEM = - "%s,\"unit_of_meas\":\"V\"," // V + ",\"unit_of_meas\":\"V\"," // V "\"val_tpl\":\"{{value_json['%s'].%s}}\""; // "ENERGY":{"TotalStartTime":null,"Total":null,"Yesterday":null,"Today":null,"Power":null,"ApparentPower":null,"ReactivePower":null,"Factor":null,"Voltage":null,"Current":null} -> {{ value_json['ENERGY'].Voltage }} const char HASS_DISCOVER_SENSOR_AMPERE[] PROGMEM = - "%s,\"unit_of_meas\":\"A\"," // A + ",\"unit_of_meas\":\"A\"," // A "\"val_tpl\":\"{{value_json['%s'].%s}}\""; // "ENERGY":{"TotalStartTime":null,"Total":null,"Yesterday":null,"Today":null,"Power":null,"ApparentPower":null,"ReactivePower":null,"Factor":null,"Voltage":null,"Current":null} -> {{ value_json['ENERGY'].Current }} const char HASS_DISCOVER_SENSOR_ANY[] PROGMEM = - "%s,\"unit_of_meas\":\" \"," // " " As unit of measurement to get a value graph in Hass + ",\"unit_of_meas\":\" \"," // " " As unit of measurement to get a value graph in Hass "\"val_tpl\":\"{{value_json['%s'].%s}}\""; // "COUNTER":{"C1":0} -> {{ value_json['COUNTER'].C1 }} const char HASS_DISCOVER_SENSOR_HASS_STATUS[] PROGMEM = - "%s,\"json_attributes_topic\":\"%s\"," + ",\"json_attributes_topic\":\"%s\"," "\"unit_of_meas\":\" \"," // " " As unit of measurement to get a value graph in Hass "\"val_tpl\":\"{{value_json['" D_JSON_RSSI "']}}\"";// "COUNTER":{"C1":0} -> {{ value_json['COUNTER'].C1 }} const char HASS_DISCOVER_DEVICE_INFO[] PROGMEM = - "%s,\"uniq_id\":\"%s\"," + ",\"uniq_id\":\"%s\"," "\"device\":{\"identifiers\":[\"%06X\"]," "\"name\":\"%s\"," "\"model\":\"%s\"," @@ -136,11 +135,11 @@ const char HASS_DISCOVER_DEVICE_INFO[] PROGMEM = "\"manufacturer\":\"Tasmota\"}"; const char HASS_DISCOVER_DEVICE_INFO_SHORT[] PROGMEM = - "%s,\"uniq_id\":\"%s\"," + ",\"uniq_id\":\"%s\"," "\"device\":{\"identifiers\":[\"%06X\"]}"; const char HASS_DISCOVER_TOPIC_PREFIX[] PROGMEM = - "%s, \"~\":\"%s\""; + ",\"~\":\"%s\""; uint8_t hass_init_step = 0; uint8_t hass_mode = 0; @@ -166,22 +165,24 @@ static void Shorten(char** s, char *prefix) } } -int try_snprintf_P(char *s, size_t n, const char *format, ... ) +void TryResponseAppend_P(const char *format, ... ) { va_list args; va_start(args, format); - int len = vsnprintf_P(NULL, 0, format, args); - if (len >= n) { - snprintf_P(log_data, sizeof(log_data), - PSTR("ERROR: MQTT discovery failed due to too long topic or friendly name. " - "Please shorten topic and friendly name. Failed to format(%u/%u):"), len, n); - AddLog(LOG_LEVEL_ERROR); + char dummy[2]; + int dlen = vsnprintf_P(dummy, 1, format, args); + + int mlen = strlen(mqtt_data); + int slen = sizeof(mqtt_data) -1 -mlen; + if (dlen >= slen) { + AddLog_P2(LOG_LEVEL_ERROR, PSTR("HASS: MQTT discovery failed due to too long topic or friendly name. " + "Please shorten topic and friendly name. Failed to format(%u/%u):"), dlen, slen); va_start(args, format); vsnprintf_P(log_data, sizeof(log_data), format, args); AddLog(LOG_LEVEL_ERROR); } else { va_start(args, format); - vsnprintf_P(s, n, format, args); + vsnprintf_P(mqtt_data + mlen, slen, format, args); } va_end(args); } @@ -202,7 +203,7 @@ void HAssAnnounceRelayLight(void) mqtt_data[0] = '\0'; // Clear retained message - // Clear "other" topic first in case the device has been reconfigured from ligth to switch or vice versa + // Clear "other" topic first in case the device has been reconfigured from light to switch or vice versa snprintf_P(unique_id, sizeof(unique_id), PSTR("%06X_%s_%d"), ESP.getChipId(), (is_topic_light) ? "RL" : "LI", i); snprintf_P(stopic, sizeof(stopic), PSTR(HOME_ASSISTANT_DISCOVERY_PREFIX "/%s/%s/config"), (is_topic_light) ? "switch" : "light", unique_id); @@ -234,30 +235,29 @@ void HAssAnnounceRelayLight(void) Shorten(&command_topic, prefix); Shorten(&state_topic, prefix); Shorten(&availability_topic, prefix); - try_snprintf_P(mqtt_data, sizeof(mqtt_data)-1, HASS_DISCOVER_RELAY, - name, command_topic, state_topic, value_template, Settings.state_text[0], Settings.state_text[1], availability_topic); - try_snprintf_P(mqtt_data, sizeof(mqtt_data)-1, HASS_DISCOVER_DEVICE_INFO_SHORT, mqtt_data, - unique_id, ESP.getChipId()); - try_snprintf_P(mqtt_data, sizeof(mqtt_data)-1, HASS_DISCOVER_TOPIC_PREFIX, mqtt_data, prefix); + + Response_P(HASS_DISCOVER_RELAY, name, command_topic, state_topic, value_template, Settings.state_text[0], Settings.state_text[1], availability_topic); + TryResponseAppend_P(HASS_DISCOVER_DEVICE_INFO_SHORT, unique_id, ESP.getChipId()); + TryResponseAppend_P(HASS_DISCOVER_TOPIC_PREFIX, prefix); if (is_light) { char *brightness_command_topic = stemp1; GetTopic_P(brightness_command_topic, CMND, mqtt_topic, D_CMND_DIMMER); Shorten(&brightness_command_topic, prefix); - try_snprintf_P(mqtt_data, sizeof(mqtt_data)-1, HASS_DISCOVER_LIGHT_DIMMER, mqtt_data, brightness_command_topic, state_topic); + TryResponseAppend_P(HASS_DISCOVER_LIGHT_DIMMER, brightness_command_topic, state_topic); if (light_subtype >= LST_RGB) { char *rgb_command_topic = stemp1; GetTopic_P(rgb_command_topic, CMND, mqtt_topic, D_CMND_COLOR); Shorten(&rgb_command_topic, prefix); - try_snprintf_P(mqtt_data, sizeof(mqtt_data)-1, HASS_DISCOVER_LIGHT_COLOR, mqtt_data, rgb_command_topic, state_topic); + TryResponseAppend_P(HASS_DISCOVER_LIGHT_COLOR, rgb_command_topic, state_topic); char *effect_command_topic = stemp1; GetTopic_P(effect_command_topic, CMND, mqtt_topic, D_CMND_SCHEME); Shorten(&effect_command_topic, prefix); - try_snprintf_P(mqtt_data, sizeof(mqtt_data)-1, HASS_DISCOVER_LIGHT_SCHEME, mqtt_data, effect_command_topic, state_topic); + TryResponseAppend_P(HASS_DISCOVER_LIGHT_SCHEME, effect_command_topic, state_topic); } if (LST_RGBW == light_subtype) { @@ -265,17 +265,17 @@ void HAssAnnounceRelayLight(void) GetTopic_P(white_temp_command_topic, CMND, mqtt_topic, D_CMND_WHITE); Shorten(&white_temp_command_topic, prefix); - try_snprintf_P(mqtt_data, sizeof(mqtt_data)-1, HASS_DISCOVER_LIGHT_WHITE, mqtt_data, white_temp_command_topic, state_topic); + TryResponseAppend_P(HASS_DISCOVER_LIGHT_WHITE, white_temp_command_topic, state_topic); } if ((LST_COLDWARM == light_subtype) || (LST_RGBWC == light_subtype)) { char *color_temp_command_topic = stemp1; GetTopic_P(color_temp_command_topic, CMND, mqtt_topic, D_CMND_COLORTEMPERATURE); Shorten(&color_temp_command_topic, prefix); - try_snprintf_P(mqtt_data, sizeof(mqtt_data)-1, HASS_DISCOVER_LIGHT_CT, mqtt_data, color_temp_command_topic, state_topic); + TryResponseAppend_P(HASS_DISCOVER_LIGHT_CT, color_temp_command_topic, state_topic); } } - try_snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s}"), mqtt_data); + TryResponseAppend_P(PSTR("}")); } MqttPublish(stopic, true); } @@ -315,15 +315,13 @@ void HAssAnnounceButtonSwitch(uint8_t device, char* topic, uint8_t present, uint FindPrefix(state_topic, availability_topic, prefix); Shorten(&state_topic, prefix); Shorten(&availability_topic, prefix); - try_snprintf_P(mqtt_data, sizeof(mqtt_data)-1, HASS_DISCOVER_BUTTON_SWITCH, - name, state_topic, Settings.state_text[toggle?2:1], availability_topic); - try_snprintf_P(mqtt_data, sizeof(mqtt_data)-1, HASS_DISCOVER_DEVICE_INFO_SHORT, mqtt_data, - unique_id, ESP.getChipId()); - if (strlen(prefix) > 0 ) try_snprintf_P(mqtt_data-1, sizeof(mqtt_data), HASS_DISCOVER_TOPIC_PREFIX, mqtt_data, prefix); - if (toggle) try_snprintf_P(mqtt_data, sizeof(mqtt_data)-1, HASS_DISCOVER_BUTTON_SWITCH_TOGGLE, mqtt_data); - else try_snprintf_P(mqtt_data, sizeof(mqtt_data)-1, HASS_DISCOVER_BUTTON_SWITCH_ONOFF, mqtt_data, Settings.state_text[0]); + Response_P(HASS_DISCOVER_BUTTON_SWITCH, name, state_topic, Settings.state_text[toggle?2:1], availability_topic); + TryResponseAppend_P(HASS_DISCOVER_DEVICE_INFO_SHORT, unique_id, ESP.getChipId()); + if (strlen(prefix) > 0 ) TryResponseAppend_P(HASS_DISCOVER_TOPIC_PREFIX, prefix); + if (toggle) TryResponseAppend_P(HASS_DISCOVER_BUTTON_SWITCH_TOGGLE); + else TryResponseAppend_P(HASS_DISCOVER_BUTTON_SWITCH_ONOFF, Settings.state_text[0]); - try_snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s}"), mqtt_data); + TryResponseAppend_P(PSTR("}")); } MqttPublish(stopic, true); } @@ -416,40 +414,30 @@ void HAssAnnounceSensor(const char* sensorname, const char* subsensortype) Shorten(&state_topic, prefix); Shorten(&availability_topic, prefix); - try_snprintf_P(mqtt_data, sizeof(mqtt_data)-1, HASS_DISCOVER_SENSOR, - name, state_topic, availability_topic); - try_snprintf_P(mqtt_data, sizeof(mqtt_data)-1, HASS_DISCOVER_DEVICE_INFO_SHORT, mqtt_data, - unique_id, ESP.getChipId()); - try_snprintf_P(mqtt_data, sizeof(mqtt_data)-1, HASS_DISCOVER_TOPIC_PREFIX, mqtt_data, prefix); + Response_P(HASS_DISCOVER_SENSOR, name, state_topic, availability_topic); + TryResponseAppend_P(HASS_DISCOVER_DEVICE_INFO_SHORT, unique_id, ESP.getChipId()); + TryResponseAppend_P(HASS_DISCOVER_TOPIC_PREFIX, prefix); if (!strcmp_P(subsensortype, PSTR(D_JSON_TEMPERATURE))) { - try_snprintf_P(mqtt_data, sizeof(mqtt_data)-1, HASS_DISCOVER_SENSOR_TEMP, - mqtt_data, TempUnit(), sensorname); + TryResponseAppend_P(HASS_DISCOVER_SENSOR_TEMP, TempUnit(), sensorname); } else if (!strcmp_P(subsensortype, PSTR(D_JSON_HUMIDITY))) { - try_snprintf_P(mqtt_data, sizeof(mqtt_data)-1, HASS_DISCOVER_SENSOR_HUM, - mqtt_data, sensorname); + TryResponseAppend_P(HASS_DISCOVER_SENSOR_HUM, sensorname); } else if (!strcmp_P(subsensortype, PSTR(D_JSON_PRESSURE))) { - try_snprintf_P(mqtt_data, sizeof(mqtt_data)-1, HASS_DISCOVER_SENSOR_PRESS, - mqtt_data, PressureUnit().c_str(), sensorname); + TryResponseAppend_P(HASS_DISCOVER_SENSOR_PRESS, PressureUnit().c_str(), sensorname); } else if (!strcmp_P(subsensortype, PSTR(D_JSON_TOTAL)) || !strcmp_P(subsensortype, PSTR(D_JSON_TODAY)) || !strcmp_P(subsensortype, PSTR(D_JSON_YESTERDAY))){ - try_snprintf_P(mqtt_data, sizeof(mqtt_data)-1, HASS_DISCOVER_SENSOR_KWH, - mqtt_data, sensorname, subsensortype); + TryResponseAppend_P(HASS_DISCOVER_SENSOR_KWH, sensorname, subsensortype); } else if (!strcmp_P(subsensortype, PSTR(D_JSON_POWERUSAGE))){ - try_snprintf_P(mqtt_data, sizeof(mqtt_data)-1, HASS_DISCOVER_SENSOR_WATT, - mqtt_data, sensorname, subsensortype); + TryResponseAppend_P(HASS_DISCOVER_SENSOR_WATT, sensorname, subsensortype); } else if (!strcmp_P(subsensortype, PSTR(D_JSON_VOLTAGE))){ - try_snprintf_P(mqtt_data, sizeof(mqtt_data)-1, HASS_DISCOVER_SENSOR_VOLTAGE, - mqtt_data, sensorname, subsensortype); + TryResponseAppend_P(HASS_DISCOVER_SENSOR_VOLTAGE, sensorname, subsensortype); } else if (!strcmp_P(subsensortype, PSTR(D_JSON_CURRENT))){ - try_snprintf_P(mqtt_data, sizeof(mqtt_data)-1, HASS_DISCOVER_SENSOR_AMPERE, - mqtt_data, sensorname, subsensortype); + TryResponseAppend_P(HASS_DISCOVER_SENSOR_AMPERE, sensorname, subsensortype); } else { - try_snprintf_P(mqtt_data, sizeof(mqtt_data)-1, HASS_DISCOVER_SENSOR_ANY, - mqtt_data, sensorname, subsensortype); + TryResponseAppend_P(HASS_DISCOVER_SENSOR_ANY, sensorname, subsensortype); } - try_snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s}"), mqtt_data); + TryResponseAppend_P(PSTR("}")); } MqttPublish(stopic, true); } @@ -479,16 +467,14 @@ void HAssAnnounceSensors(void) StaticJsonBuffer<500> jsonBuffer; JsonObject& root = jsonBuffer.parseObject(sensordata); if (!root.success()) { - snprintf_P(log_data, sizeof(log_data), PSTR("HASS: failed to parse '%s'"), sensordata); - AddLog(LOG_LEVEL_ERROR); + AddLog_P2(LOG_LEVEL_ERROR, PSTR("HASS: failed to parse '%s'"), sensordata); continue; } for (auto sensor : root) { const char* sensorname = sensor.key; JsonObject& sensors = sensor.value.as(); if (!sensors.success()) { - snprintf_P(log_data, sizeof(log_data), PSTR("HASS: failed to parse '%s'"), sensordata); - AddLog(LOG_LEVEL_ERROR); + AddLog_P2(LOG_LEVEL_ERROR, PSTR("HASS: failed to parse '%s'"), sensordata); continue; } for (auto subsensor : sensors) { @@ -511,7 +497,7 @@ void HAssAnnounceStatusSensor(void) mqtt_data[0] = '\0'; // Clear retained message // Clear or Set topic - snprintf_P(unique_id, sizeof(unique_id), PSTR("%06X_%s"), ESP.getChipId(), "status"); + snprintf_P(unique_id, sizeof(unique_id), PSTR("%06X_status"), ESP.getChipId()); snprintf_P(stopic, sizeof(stopic), PSTR(HOME_ASSISTANT_DISCOVERY_PREFIX "/sensor/%s/config"), unique_id); if (Settings.flag.hass_discovery) { @@ -520,34 +506,35 @@ void HAssAnnounceStatusSensor(void) char *state_topic = stemp1; char *availability_topic = stemp2; - snprintf_P(name, sizeof(name), PSTR("%s %s"), Settings.friendlyname[0], "status"); + snprintf_P(name, sizeof(name), PSTR("%s status"), Settings.friendlyname[0]); GetTopic_P(state_topic, TELE, mqtt_topic, PSTR(D_RSLT_HASS_STATE)); GetTopic_P(availability_topic, TELE, mqtt_topic, S_LWT); FindPrefix(state_topic, availability_topic, prefix); Shorten(&state_topic, prefix); Shorten(&availability_topic, prefix); - try_snprintf_P(mqtt_data, sizeof(mqtt_data)-1, HASS_DISCOVER_SENSOR, - name, state_topic, availability_topic); - try_snprintf_P(mqtt_data, sizeof(mqtt_data)-1, HASS_DISCOVER_SENSOR_HASS_STATUS, - mqtt_data, state_topic); - try_snprintf_P(mqtt_data, sizeof(mqtt_data)-1, HASS_DISCOVER_DEVICE_INFO, mqtt_data, - unique_id, ESP.getChipId(), + Response_P(HASS_DISCOVER_SENSOR, name, state_topic, availability_topic); + TryResponseAppend_P(HASS_DISCOVER_SENSOR_HASS_STATUS, state_topic); + TryResponseAppend_P(HASS_DISCOVER_DEVICE_INFO, unique_id, ESP.getChipId(), Settings.friendlyname[0], ModuleName().c_str(), my_version, my_image); - try_snprintf_P(mqtt_data, sizeof(mqtt_data)-1, HASS_DISCOVER_TOPIC_PREFIX, mqtt_data, prefix); - try_snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s}"), mqtt_data); + TryResponseAppend_P(HASS_DISCOVER_TOPIC_PREFIX, prefix); + TryResponseAppend_P(PSTR("}")); } MqttPublish(stopic, true); } void HAssPublishStatus(void) { - snprintf_P(mqtt_data, sizeof(mqtt_data), - PSTR("{\"" D_JSON_VERSION "\":\"%s%s\",\"" D_CMND_MODULE "\":\"%s\",\"" D_JSON_RESTARTREASON "\":\"%s\",\"" - D_JSON_UPTIME "\":\"%s\",\"" D_JSON_BOOTCOUNT "\":%d,\"" D_JSON_SAVECOUNT "\":%d,\"" - D_CMND_IPADDRESS "\":\"%s\",\"" D_JSON_RSSI "\":\"%d\",\"LoadAvg\":%lu}"), - my_version, my_image, ModuleName().c_str(), GetResetReason().c_str(), GetUptime().c_str(), Settings.bootcount, - Settings.save_flag, WiFi.localIP().toString().c_str(), WifiGetRssiAsQuality(WiFi.RSSI()), loop_load_avg); + Response_P(PSTR("{\"" D_JSON_VERSION "\":\"%s%s\",\"" D_JSON_BUILDDATETIME "\":\"%s\"," + "\"" D_JSON_COREVERSION "\":\"" ARDUINO_ESP8266_RELEASE "\",\"" D_JSON_SDKVERSION "\":\"%s\"," + "\"" D_CMND_MODULE "\":\"%s\",\"" D_JSON_RESTARTREASON "\":\"%s\",\"" D_JSON_UPTIME "\":\"%s\"," + "\"WiFi " D_JSON_LINK_COUNT "\":%d,\"WiFi " D_JSON_DOWNTIME "\":\"%s\",\"" D_JSON_MQTT_COUNT "\":%d," + "\"" D_JSON_BOOTCOUNT "\":%d,\"" D_JSON_SAVECOUNT "\":%d,\"" D_CMND_IPADDRESS "\":\"%s\"," + "\"" D_JSON_RSSI "\":\"%d\",\"LoadAvg\":%lu}"), + my_version, my_image, GetBuildDateAndTime().c_str(), ESP.getSdkVersion(), ModuleName().c_str(), + GetResetReason().c_str(), GetUptime().c_str(), WifiLinkCount(), WifiDowntime().c_str(), MqttConnectCount(), + Settings.bootcount, Settings.save_flag, WiFi.localIP().toString().c_str(), + WifiGetRssiAsQuality(WiFi.RSSI()), loop_load_avg); MqttPublishPrefixTopic_P(TELE, PSTR(D_RSLT_HASS_STATE)); } diff --git a/sonoff/xdrv_13_display.ino b/sonoff/xdrv_13_display.ino index 95822403e..3f40bdb84 100644 --- a/sonoff/xdrv_13_display.ino +++ b/sonoff/xdrv_13_display.ino @@ -22,11 +22,11 @@ #define XDRV_13 13 -#define DISPLAY_MAX_DRIVERS 16 // Max number of display drivers/models supported by xdsp_interface.ino -#define DISPLAY_MAX_COLS 44 // Max number of columns allowed with command DisplayCols -#define DISPLAY_MAX_ROWS 32 // Max number of lines allowed with command DisplayRows +const uint8_t DISPLAY_MAX_DRIVERS = 16; // Max number of display drivers/models supported by xdsp_interface.ino +const uint8_t DISPLAY_MAX_COLS = 44; // Max number of columns allowed with command DisplayCols +const uint8_t DISPLAY_MAX_ROWS = 32; // Max number of lines allowed with command DisplayRows -#define DISPLAY_LOG_ROWS 32 // Number of lines in display log buffer +const uint8_t DISPLAY_LOG_ROWS = 32; // Number of lines in display log buffer #define D_CMND_DISPLAY "Display" #define D_CMND_DISP_ADDRESS "Address" @@ -465,7 +465,7 @@ void DisplayText(void) break; default: // unknown escape - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("Unknown Escape")); + Response_P(PSTR("Unknown Escape")); goto exit; break; } @@ -503,9 +503,9 @@ void DisplayClearScreenBuffer(void) void DisplayFreeScreenBuffer(void) { - if (disp_screen_buffer != NULL) { + if (disp_screen_buffer != nullptr) { for (uint8_t i = 0; i < disp_screen_buffer_rows; i++) { - if (disp_screen_buffer[i] != NULL) { free(disp_screen_buffer[i]); } + if (disp_screen_buffer[i] != nullptr) { free(disp_screen_buffer[i]); } } free(disp_screen_buffer); disp_screen_buffer_cols = 0; @@ -518,16 +518,16 @@ void DisplayAllocScreenBuffer(void) if (!disp_screen_buffer_cols) { disp_screen_buffer_rows = Settings.display_rows; disp_screen_buffer = (char**)malloc(sizeof(*disp_screen_buffer) * disp_screen_buffer_rows); - if (disp_screen_buffer != NULL) { + if (disp_screen_buffer != nullptr) { for (uint8_t i = 0; i < disp_screen_buffer_rows; i++) { disp_screen_buffer[i] = (char*)malloc(sizeof(*disp_screen_buffer[i]) * (Settings.display_cols[0] +1)); - if (disp_screen_buffer[i] == NULL) { + if (disp_screen_buffer[i] == nullptr) { DisplayFreeScreenBuffer(); break; } } } - if (disp_screen_buffer != NULL) { + if (disp_screen_buffer != nullptr) { disp_screen_buffer_cols = Settings.display_cols[0] +1; DisplayClearScreenBuffer(); } @@ -562,9 +562,9 @@ void DisplayClearLogBuffer(void) void DisplayFreeLogBuffer(void) { - if (disp_log_buffer != NULL) { + if (disp_log_buffer != nullptr) { for (uint8_t i = 0; i < DISPLAY_LOG_ROWS; i++) { - if (disp_log_buffer[i] != NULL) { free(disp_log_buffer[i]); } + if (disp_log_buffer[i] != nullptr) { free(disp_log_buffer[i]); } } free(disp_log_buffer); disp_log_buffer_cols = 0; @@ -575,16 +575,16 @@ void DisplayAllocLogBuffer(void) { if (!disp_log_buffer_cols) { disp_log_buffer = (char**)malloc(sizeof(*disp_log_buffer) * DISPLAY_LOG_ROWS); - if (disp_log_buffer != NULL) { + if (disp_log_buffer != nullptr) { for (uint8_t i = 0; i < DISPLAY_LOG_ROWS; i++) { disp_log_buffer[i] = (char*)malloc(sizeof(*disp_log_buffer[i]) * (Settings.display_cols[0] +1)); - if (disp_log_buffer[i] == NULL) { + if (disp_log_buffer[i] == nullptr) { DisplayFreeLogBuffer(); break; } } } - if (disp_log_buffer != NULL) { + if (disp_log_buffer != nullptr) { disp_log_buffer_cols = Settings.display_cols[0] +1; DisplayClearLogBuffer(); } @@ -608,7 +608,7 @@ void DisplayLogBufferAdd(char* txt) char* DisplayLogBuffer(char temp_code) { - char* result = NULL; + char* result = nullptr; if (disp_log_buffer_cols) { if (disp_log_buffer_idx != disp_log_buffer_ptr) { result = disp_log_buffer[disp_log_buffer_ptr]; @@ -616,7 +616,7 @@ char* DisplayLogBuffer(char temp_code) if (DISPLAY_LOG_ROWS == disp_log_buffer_ptr) { disp_log_buffer_ptr = 0; } char *pch = strchr(result, '~'); // = 0x7E (~) Replace degrees character (276 octal) - if (pch != NULL) { result[pch - result] = temp_code; } + if (pch != nullptr) { result[pch - result] = temp_code; } } } return result; @@ -687,7 +687,7 @@ const char kSensorQuantity[] PROGMEM = D_JSON_CO2 "|" // ppm D_JSON_FREQUENCY ; // Hz -void DisplayJsonValue(const char *topic, const char* device, const char* mkey, const char* value) +void DisplayJsonValue(const char* topic, const char* device, const char* mkey, const char* value) { char quantity[TOPSZ]; char buffer[Settings.display_cols[0] +1]; @@ -695,11 +695,13 @@ void DisplayJsonValue(const char *topic, const char* device, const char* mkey, c char source[Settings.display_cols[0] - Settings.display_cols[1]]; char svalue[Settings.display_cols[1] +1]; +#ifdef USE_DEBUG_DRIVER ShowFreeMem(PSTR("DisplayJsonValue")); +#endif memset(spaces, 0x20, sizeof(spaces)); spaces[sizeof(spaces) -1] = '\0'; - snprintf_P(source, sizeof(source), PSTR("%s/%s%s"), topic, mkey, spaces); // pow1/Voltage + snprintf_P(source, sizeof(source), PSTR("%s%s%s%s"), topic, (strlen(topic))?"/":"", mkey, spaces); // pow1/Voltage or Voltage if topic is empty (local sensor) int quantity_code = GetCommandCode(quantity, sizeof(quantity), mkey, kSensorQuantity); if ((-1 == quantity_code) || !strcmp_P(mkey, S_RSLT_POWER)) { // Ok: Power, Not ok: POWER @@ -746,8 +748,7 @@ void DisplayJsonValue(const char *topic, const char* device, const char* mkey, c } snprintf_P(buffer, sizeof(buffer), PSTR("%s %s"), source, svalue); -// snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_DEBUG "mkey [%s], source [%s], value [%s], quantity_code %d, log_buffer [%s]"), mkey, source, value, quantity_code, buffer); -// AddLog(LOG_LEVEL_DEBUG); +// AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "mkey [%s], source [%s], value [%s], quantity_code %d, log_buffer [%s]"), mkey, source, value, quantity_code, buffer); DisplayLogBufferAdd(buffer); } @@ -777,8 +778,7 @@ void DisplayAnalyzeJson(char *topic, char *json) tempunit = root[D_JSON_TEMPERATURE_UNIT]; if (tempunit) { snprintf_P(disp_temp, sizeof(disp_temp), PSTR("%s"), tempunit); -// snprintf_P(log_data, sizeof(log_data), disp_temp); -// AddLog(LOG_LEVEL_DEBUG); +// AddLog_P2(LOG_LEVEL_DEBUG, disp_temp); } for (JsonObject::iterator it = root.begin(); it != root.end(); ++it) { @@ -829,12 +829,12 @@ void DisplayMqttSubscribe(void) ntopic[0] = '\0'; strlcpy(stopic, Settings.mqtt_fulltopic, sizeof(stopic)); char *tp = strtok(stopic, "/"); - while (tp != NULL) { - if (!strcmp_P(tp, PSTR(MQTT_TOKEN_PREFIX))) { + while (tp != nullptr) { + if (!strcmp_P(tp, MQTT_TOKEN_PREFIX)) { break; } strncat_P(ntopic, PSTR("+/"), sizeof(ntopic) - strlen(ntopic) -1); // Add single-level wildcards - tp = strtok(NULL, "/"); + tp = strtok(nullptr, "/"); } strncat(ntopic, Settings.mqtt_prefix[2], sizeof(ntopic) - strlen(ntopic) -1); // Subscribe to tele messages strncat_P(ntopic, PSTR("/#"), sizeof(ntopic) - strlen(ntopic) -1); // Add multi-level wildcard @@ -867,7 +867,9 @@ bool DisplayMqttData(void) void DisplayLocalSensor(void) { if ((Settings.display_mode &0x02) && (0 == tele_period)) { - DisplayAnalyzeJson(mqtt_topic, mqtt_data); + char no_topic[1] = { 0 }; +// DisplayAnalyzeJson(mqtt_topic, mqtt_data); // Add local topic + DisplayAnalyzeJson(no_topic, mqtt_data); // Discard any topic } } @@ -881,8 +883,7 @@ void DisplayInitDriver(void) { XdspCall(FUNC_DISPLAY_INIT_DRIVER); -// snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_DEBUG "Display model %d"), Settings.display_model); -// AddLog(LOG_LEVEL_DEBUG); +// AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "Display model %d"), Settings.display_model); if (Settings.display_model) { devices_present++; @@ -920,7 +921,7 @@ bool DisplayCommand(void) serviced = false; // Unknown command } else if (CMND_DISPLAY == command_code) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_DISPLAY "\":{\"" D_CMND_DISP_MODEL "\":%d,\"" D_CMND_DISP_MODE "\":%d,\"" D_CMND_DISP_DIMMER "\":%d,\"" + Response_P(PSTR("{\"" D_CMND_DISPLAY "\":{\"" D_CMND_DISP_MODEL "\":%d,\"" D_CMND_DISP_MODE "\":%d,\"" D_CMND_DISP_DIMMER "\":%d,\"" D_CMND_DISP_SIZE "\":%d,\"" D_CMND_DISP_FONT "\":%d,\"" D_CMND_DISP_ROTATE "\":%d,\"" D_CMND_DISP_REFRESH "\":%d,\"" D_CMND_DISP_COLS "\":[%d,%d],\"" D_CMND_DISP_ROWS "\":%d}}"), Settings.display_model, Settings.display_mode, Settings.display_dimmer, Settings.display_size, Settings.display_font, Settings.display_rotate, Settings.display_refresh, Settings.display_cols[0], Settings.display_cols[1], Settings.display_rows); @@ -935,7 +936,7 @@ bool DisplayCommand(void) Settings.display_model = last_display_model; } } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_DISPLAY_COMMAND_NVALUE, command, Settings.display_model); + Response_P(S_JSON_DISPLAY_COMMAND_NVALUE, command, Settings.display_model); } else if (CMND_DISP_MODE == command_code) { #ifdef USE_DISPLAY_MODES1TO5 @@ -963,7 +964,7 @@ bool DisplayCommand(void) } } #endif // USE_DISPLAY_MODES1TO5 - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_DISPLAY_COMMAND_NVALUE, command, Settings.display_mode); + Response_P(S_JSON_DISPLAY_COMMAND_NVALUE, command, Settings.display_mode); } else if (CMND_DISP_DIMMER == command_code) { if ((XdrvMailbox.payload >= 0) && (XdrvMailbox.payload <= 100)) { @@ -975,19 +976,19 @@ bool DisplayCommand(void) ExecuteCommandPower(disp_device, POWER_OFF, SRC_DISPLAY); } } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_DISPLAY_COMMAND_NVALUE, command, Settings.display_dimmer); + Response_P(S_JSON_DISPLAY_COMMAND_NVALUE, command, Settings.display_dimmer); } else if (CMND_DISP_SIZE == command_code) { if ((XdrvMailbox.payload > 0) && (XdrvMailbox.payload <= 4)) { Settings.display_size = XdrvMailbox.payload; } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_DISPLAY_COMMAND_NVALUE, command, Settings.display_size); + Response_P(S_JSON_DISPLAY_COMMAND_NVALUE, command, Settings.display_size); } else if (CMND_DISP_FONT == command_code) { if ((XdrvMailbox.payload > 0) && (XdrvMailbox.payload <= 4)) { Settings.display_font = XdrvMailbox.payload; } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_DISPLAY_COMMAND_NVALUE, command, Settings.display_font); + Response_P(S_JSON_DISPLAY_COMMAND_NVALUE, command, Settings.display_font); } else if (CMND_DISP_ROTATE == command_code) { if ((XdrvMailbox.payload >= 0) && (XdrvMailbox.payload < 4)) { @@ -1010,7 +1011,7 @@ bool DisplayCommand(void) #endif // USE_DISPLAY_MODES1TO5 } } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_DISPLAY_COMMAND_NVALUE, command, Settings.display_rotate); + Response_P(S_JSON_DISPLAY_COMMAND_NVALUE, command, Settings.display_rotate); } else if (CMND_DISP_TEXT == command_code) { mqtt_data[0] = '\0'; @@ -1025,23 +1026,23 @@ bool DisplayCommand(void) } #endif // USE_DISPLAY_MODES1TO5 } else { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("No Text")); + Response_P(PSTR("No Text")); } if (mqtt_data[0] == '\0') { - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_DISPLAY_COMMAND_VALUE, command, XdrvMailbox.data); + Response_P(S_JSON_DISPLAY_COMMAND_VALUE, command, XdrvMailbox.data); } } else if ((CMND_DISP_ADDRESS == command_code) && (XdrvMailbox.index > 0) && (XdrvMailbox.index <= 8)) { if ((XdrvMailbox.payload >= 0) && (XdrvMailbox.payload <= 255)) { Settings.display_address[XdrvMailbox.index -1] = XdrvMailbox.payload; } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_DISPLAY_COMMAND_INDEX_NVALUE, command, XdrvMailbox.index, Settings.display_address[XdrvMailbox.index -1]); + Response_P(S_JSON_DISPLAY_COMMAND_INDEX_NVALUE, command, XdrvMailbox.index, Settings.display_address[XdrvMailbox.index -1]); } else if (CMND_DISP_REFRESH == command_code) { if ((XdrvMailbox.payload >= 1) && (XdrvMailbox.payload <= 7)) { Settings.display_refresh = XdrvMailbox.payload; } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_DISPLAY_COMMAND_NVALUE, command, Settings.display_refresh); + Response_P(S_JSON_DISPLAY_COMMAND_NVALUE, command, Settings.display_refresh); } else if ((CMND_DISP_COLS == command_code) && (XdrvMailbox.index > 0) && (XdrvMailbox.index <= 2)) { if ((XdrvMailbox.payload > 0) && (XdrvMailbox.payload <= DISPLAY_MAX_COLS)) { @@ -1053,7 +1054,7 @@ bool DisplayCommand(void) } #endif // USE_DISPLAY_MODES1TO5 } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_DISPLAY_COMMAND_INDEX_NVALUE, command, XdrvMailbox.index, Settings.display_cols[XdrvMailbox.index -1]); + Response_P(S_JSON_DISPLAY_COMMAND_INDEX_NVALUE, command, XdrvMailbox.index, Settings.display_cols[XdrvMailbox.index -1]); } else if (CMND_DISP_ROWS == command_code) { if ((XdrvMailbox.payload > 0) && (XdrvMailbox.payload <= DISPLAY_MAX_ROWS)) { @@ -1063,7 +1064,7 @@ bool DisplayCommand(void) DisplayReAllocScreenBuffer(); #endif // USE_DISPLAY_MODES1TO5 } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_DISPLAY_COMMAND_NVALUE, command, Settings.display_rows); + Response_P(S_JSON_DISPLAY_COMMAND_NVALUE, command, Settings.display_rows); } else serviced = false; // Unknown command } diff --git a/sonoff/xdrv_14_mp3.ino b/sonoff/xdrv_14_mp3.ino index 4e55cddc5..5e74b7122 100644 --- a/sonoff/xdrv_14_mp3.ino +++ b/sonoff/xdrv_14_mp3.ino @@ -200,7 +200,7 @@ bool MP3PlayerCmd(void) { if (command_code == CMND_MP3_DEVICE) { MP3_CMD(MP3_CMD_DEVICE, XdrvMailbox.payload); } if (command_code == CMND_MP3_DAC) { MP3_CMD(MP3_CMD_DAC, XdrvMailbox.payload); } } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_MP3_COMMAND_NVALUE, command, XdrvMailbox.payload); + Response_P(S_JSON_MP3_COMMAND_NVALUE, command, XdrvMailbox.payload); break; case CMND_MP3_PLAY: case CMND_MP3_PAUSE: @@ -211,7 +211,7 @@ bool MP3PlayerCmd(void) { if (command_code == CMND_MP3_PAUSE) { MP3_CMD(MP3_CMD_PAUSE, 0); } if (command_code == CMND_MP3_STOP) { MP3_CMD(MP3_CMD_STOP, 0); } if (command_code == CMND_MP3_RESET) { MP3_CMD(MP3_CMD_RESET, 0); } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_MP3_COMMAND, command, XdrvMailbox.payload); + Response_P(S_JSON_MP3_COMMAND, command, XdrvMailbox.payload); break; default: // else for Unknown command diff --git a/sonoff/xdrv_15_pca9685.ino b/sonoff/xdrv_15_pca9685.ino index 14eaf8a07..e3ffbaa8e 100644 --- a/sonoff/xdrv_15_pca9685.ino +++ b/sonoff/xdrv_15_pca9685.ino @@ -45,8 +45,7 @@ void PCA9685_Detect(void) if (I2cValidRead8(&buffer, USE_PCA9685_ADDR, PCA9685_REG_MODE1)) { if (0x20 == buffer) { pca9685_detected = 1; - snprintf_P(log_data, sizeof(log_data), S_LOG_I2C_FOUND_AT, "PCA9685", USE_PCA9685_ADDR); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, S_LOG_I2C_FOUND_AT, "PCA9685", USE_PCA9685_ADDR); PCA9685_Reset(); // Reset the controller } } @@ -61,7 +60,7 @@ void PCA9685_Reset(void) PCA9685_SetPWM(pin,0,false); pca9685_pin_pwm_value[pin] = 0; } - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"PCA9685\":{\"RESET\":\"OK\"}}")); + Response_P(PSTR("{\"PCA9685\":{\"RESET\":\"OK\"}}")); } void PCA9685_SetPWMfreq(double freq) { @@ -101,7 +100,7 @@ void PCA9685_SetPWM(uint8_t pin, uint16_t pwm, bool inverted) { pca9685_pin_pwm_value[pin] = pwm; } -bool PCA9685_Command(void) +bool PCA9685_Command(void) { bool serviced = true; bool validpin = false; @@ -128,11 +127,11 @@ bool PCA9685_Command(void) uint16_t new_freq = atoi(subStr(sub_string, XdrvMailbox.data, ",", 2)); if ((new_freq >= 24) && (new_freq <= 1526)) { PCA9685_SetPWMfreq(new_freq); - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"PCA9685\":{\"PWMF\":%i, \"Result\":\"OK\"}}"),new_freq); + Response_P(PSTR("{\"PCA9685\":{\"PWMF\":%i, \"Result\":\"OK\"}}"),new_freq); return serviced; } } else { // No parameter was given for setfreq, so we return current setting - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"PCA9685\":{\"PWMF\":%i}}"),pca9685_freq); + Response_P(PSTR("{\"PCA9685\":{\"PWMF\":%i}}"),pca9685_freq); return serviced; } } @@ -142,20 +141,20 @@ bool PCA9685_Command(void) if (paramcount > 2) { if (!strcmp(subStr(sub_string, XdrvMailbox.data, ",", 3), "ON")) { PCA9685_SetPWM(pin, 4096, false); - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"PCA9685\":{\"PIN\":%i,\"PWM\":%i}}"),pin,4096); + Response_P(PSTR("{\"PCA9685\":{\"PIN\":%i,\"PWM\":%i}}"),pin,4096); serviced = true; return serviced; } if (!strcmp(subStr(sub_string, XdrvMailbox.data, ",", 3), "OFF")) { PCA9685_SetPWM(pin, 0, false); - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"PCA9685\":{\"PIN\":%i,\"PWM\":%i}}"),pin,0); + Response_P(PSTR("{\"PCA9685\":{\"PIN\":%i,\"PWM\":%i}}"),pin,0); serviced = true; return serviced; } uint16_t pwm = atoi(subStr(sub_string, XdrvMailbox.data, ",", 3)); if ((pin >= 0 && pin <= 15) && (pwm >= 0 && pwm <= 4096)) { PCA9685_SetPWM(pin, pwm, false); - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"PCA9685\":{\"PIN\":%i,\"PWM\":%i}}"),pin,pwm); + Response_P(PSTR("{\"PCA9685\":{\"PIN\":%i,\"PWM\":%i}}"),pin,pwm); serviced = true; return serviced; } @@ -167,12 +166,12 @@ bool PCA9685_Command(void) void PCA9685_OutputTelemetry(bool telemetry) { if (0 == pca9685_detected) { return; } // We do not do this if the PCA9685 has not been detected - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_JSON_TIME "\":\"%s\",\"PCA9685\": {"), GetDateAndTime(DT_LOCAL).c_str()); - snprintf_P(mqtt_data,sizeof(mqtt_data), PSTR("%s\"PWM_FREQ\":%i,"),mqtt_data,pca9685_freq); + Response_P(PSTR("{\"" D_JSON_TIME "\":\"%s\",\"PCA9685\": {"), GetDateAndTime(DT_LOCAL).c_str()); + ResponseAppend_P(PSTR("\"PWM_FREQ\":%i,"),pca9685_freq); for (uint8_t pin=0;pin<16;pin++) { - snprintf_P(mqtt_data,sizeof(mqtt_data), PSTR("%s\"PWM%i\":%i,"),mqtt_data,pin,pca9685_pin_pwm_value[pin]); + ResponseAppend_P(PSTR("\"PWM%i\":%i,"),pin,pca9685_pin_pwm_value[pin]); } - snprintf_P(mqtt_data,sizeof(mqtt_data),PSTR("%s\"END\":1}}"),mqtt_data); + ResponseAppend_P(PSTR("\"END\":1}}")); if (telemetry) { MqttPublishPrefixTopic_P(TELE, PSTR(D_RSLT_SENSOR), Settings.flag.mqtt_sensor_retain); } @@ -190,9 +189,9 @@ bool Xdrv15(uint8_t function) PCA9685_OutputTelemetry(true); } break; - case FUNC_COMMAND: + case FUNC_COMMAND_DRIVER: if (XDRV_15 == XdrvMailbox.index) { - PCA9685_Command(); + result = PCA9685_Command(); } break; default: diff --git a/sonoff/xdrv_16_tuyadimmer.ino b/sonoff/xdrv_16_tuyadimmer.ino index d2eca8383..d43e6397e 100644 --- a/sonoff/xdrv_16_tuyadimmer.ino +++ b/sonoff/xdrv_16_tuyadimmer.ino @@ -53,7 +53,7 @@ uint8_t tuya_cmd_checksum = 0; // Checksum of tuya command uint8_t tuya_data_len = 0; // Data lenght of command int8_t tuya_wifi_state = -2; // Keep MCU wifi-status in sync with WifiState() -char *tuya_buffer = NULL; // Serial receive buffer +char *tuya_buffer = nullptr; // Serial receive buffer int tuya_byte_counter = 0; // Index in serial receive buffer /*********************************************************************************************\ @@ -123,8 +123,7 @@ bool TuyaSetPower(void) if (source != SRC_SWITCH && TuyaSerial) { // ignore to prevent loop from pushing state from faceplate interaction - snprintf_P(log_data, sizeof(log_data), PSTR("TYA: SetDevicePower.rpower=%d"), rpower); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR("TYA: SetDevicePower.rpower=%d"), rpower); TuyaSendBool(TUYA_POWER_ID, rpower); @@ -146,16 +145,14 @@ void LightSerialDuty(uint8_t duty) duty = 25; // dimming acts odd below 25(10%) - this mirrors the threshold set on the faceplate itself } - snprintf_P(log_data, sizeof(log_data), PSTR( "TYA: Send Serial Packet Dim Value=%d (id=%d)"), duty, Settings.param[P_TUYA_DIMMER_ID]); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR( "TYA: Send Serial Packet Dim Value=%d (id=%d)"), duty, Settings.param[P_TUYA_DIMMER_ID]); TuyaSendValue(Settings.param[P_TUYA_DIMMER_ID], duty); } else { tuya_ignore_dim = false; // reset flag - snprintf_P(log_data, sizeof(log_data), PSTR( "TYA: Send Dim Level skipped due to 0 or already set. Value=%d"), duty); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR( "TYA: Send Dim Level skipped due to 0 or already set. Value=%d"), duty); } } @@ -164,8 +161,7 @@ void TuyaRequestState(void){ if(TuyaSerial) { // Get current status of MCU - snprintf_P(log_data, sizeof(log_data), "TYA: Request MCU state"); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P(LOG_LEVEL_DEBUG, PSTR("TYA: Request MCU state")); TuyaSendCmd(TUYA_CMD_QUERY_STATE); } @@ -197,8 +193,7 @@ void TuyaPacketProcess(void) case TUYA_CMD_STATE: if (tuya_buffer[5] == 5) { // on/off packet - snprintf_P(log_data, sizeof(log_data),PSTR("TYA: RX - %s State"),tuya_buffer[10]?"On":"Off"); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR("TYA: RX - %s State"),tuya_buffer[10]?"On":"Off"); if((power || Settings.light_dimmer > 0) && (power != tuya_buffer[10])) { ExecuteCommandPower(1, tuya_buffer[10], SRC_SWITCH); // send SRC_SWITCH? to use as flag to prevent loop from inbound states from faceplate interaction @@ -206,12 +201,10 @@ void TuyaPacketProcess(void) } else if (tuya_buffer[5] == 8) { // dim packet - snprintf_P(log_data, sizeof(log_data), PSTR("TYA: RX Dim State=%d"), tuya_buffer[13]); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR("TYA: RX Dim State=%d"), tuya_buffer[13]); if (!Settings.param[P_TUYA_DIMMER_ID]) { - snprintf_P(log_data, sizeof(log_data), PSTR("TYA: Autoconfiguring Dimmer ID %d"), tuya_buffer[6]); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR("TYA: Autoconfiguring Dimmer ID %d"), tuya_buffer[6]); Settings.param[P_TUYA_DIMMER_ID] = tuya_buffer[6]; } @@ -220,8 +213,7 @@ void TuyaPacketProcess(void) snprintf_P(scmnd, sizeof(scmnd), PSTR(D_CMND_DIMMER " %d"), tuya_new_dim ); - snprintf_P(log_data, sizeof(log_data), PSTR("TYA: Send CMND_DIMMER_STR=%s"), scmnd ); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR("TYA: Send CMND_DIMMER_STR=%s"), scmnd ); tuya_ignore_dim = true; ExecuteCommand(scmnd, SRC_SWITCH); @@ -292,13 +284,12 @@ void TuyaInit(void) Settings.param[P_TUYA_DIMMER_ID] = TUYA_DIMMER_ID; } tuya_buffer = (char*)(malloc(TUYA_BUFFER_SIZE)); - if (tuya_buffer != NULL) { + if (tuya_buffer != nullptr) { TuyaSerial = new TasmotaSerial(pin[GPIO_TUYA_RX], pin[GPIO_TUYA_TX], 2); if (TuyaSerial->begin(9600)) { if (TuyaSerial->hardwareSerial()) { ClaimSerial(); } // Get MCU Configuration - snprintf_P(log_data, sizeof(log_data), "TYA: Request MCU configuration"); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P(LOG_LEVEL_DEBUG, PSTR("TYA: Request MCU configuration")); TuyaSendCmd(TUYA_CMD_MCU_CONF); } @@ -364,8 +355,7 @@ void TuyaSerialInput(void) bool TuyaButtonPressed(void) { if (!XdrvMailbox.index && ((PRESSED == XdrvMailbox.payload) && (NOT_PRESSED == lastbutton[XdrvMailbox.index]))) { - snprintf_P(log_data, sizeof(log_data), PSTR("TYA: Reset GPIO triggered")); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P(LOG_LEVEL_DEBUG, PSTR("TYA: Reset GPIO triggered")); TuyaResetWifi(); return true; // Reset GPIO served here } @@ -387,8 +377,7 @@ void TuyaSetWifiLed(void){ break; } - snprintf_P(log_data, sizeof(log_data), "TYA: Set WiFi LED to state %d (%d)", wifi_state, WifiState()); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR("TYA: Set WiFi LED to state %d (%d)"), wifi_state, WifiState()); TuyaSendCmd(TUYA_CMD_WIFI_STATE, &wifi_state, 1); } @@ -404,15 +393,15 @@ bool Xdrv16(uint8_t function) if (TUYA_DIMMER == my_module_type) { switch (function) { + case FUNC_LOOP: + if (TuyaSerial) { TuyaSerialInput(); } + break; case FUNC_MODULE_INIT: result = TuyaModuleSelected(); break; case FUNC_INIT: TuyaInit(); break; - case FUNC_LOOP: - if (TuyaSerial) { TuyaSerialInput(); } - break; case FUNC_SET_DEVICE_POWER: result = TuyaSetPower(); break; diff --git a/sonoff/xdrv_17_rcswitch.ino b/sonoff/xdrv_17_rcswitch.ino index 7689f3d1c..8018eaa2d 100644 --- a/sonoff/xdrv_17_rcswitch.ino +++ b/sonoff/xdrv_17_rcswitch.ino @@ -49,8 +49,7 @@ void RfReceiveCheck(void) int protocol = mySwitch.getReceivedProtocol(); int delay = mySwitch.getReceivedDelay(); - snprintf_P(log_data, sizeof(log_data), PSTR("RFR: Data %lX (%u), Bits %d, Protocol %d, Delay %d"), data, data, bits, protocol, delay); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR("RFR: Data 0x%lX (%u), Bits %d, Protocol %d, Delay %d"), data, data, bits, protocol, delay); uint32_t now = millis(); if ((now - rf_lasttime > RF_TIME_AVOID_DUPLICATE) && (data > 0)) { @@ -60,9 +59,9 @@ void RfReceiveCheck(void) if (Settings.flag.rf_receive_decimal) { // SetOption28 (0 = hexadecimal, 1 = decimal) snprintf_P(stemp, sizeof(stemp), PSTR("%u"), (uint32_t)data); } else { - snprintf_P(stemp, sizeof(stemp), PSTR("\"%lX\""), (uint32_t)data); + snprintf_P(stemp, sizeof(stemp), PSTR("\"0x%lX\""), (uint32_t)data); } - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_JSON_RFRECEIVED "\":{\"" D_JSON_RF_DATA "\":%s,\"" D_JSON_RF_BITS "\":%d,\"" D_JSON_RF_PROTOCOL "\":%d,\"" D_JSON_RF_PULSE "\":%d}}"), + Response_P(PSTR("{\"" D_JSON_RFRECEIVED "\":{\"" D_JSON_RF_DATA "\":%s,\"" D_JSON_RF_BITS "\":%d,\"" D_JSON_RF_PROTOCOL "\":%d,\"" D_JSON_RF_PULSE "\":%d}}"), stemp, bits, protocol, delay); MqttPublishPrefixTopic_P(RESULT_OR_TELE, PSTR(D_JSON_RFRECEIVED)); XdrvRulesProcess(); @@ -108,7 +107,7 @@ bool RfSendCommand(void) if (root.success()) { // RFsend {"data":0x501014,"bits":24,"protocol":1,"repeat":10,"pulse":350} char parm_uc[10]; - data = strtoul(root[UpperCase_P(parm_uc, PSTR(D_JSON_RF_DATA))], NULL, 0); // Allow decimal (5246996) and hexadecimal (0x501014) input + data = strtoul(root[UpperCase_P(parm_uc, PSTR(D_JSON_RF_DATA))], nullptr, 0); // Allow decimal (5246996) and hexadecimal (0x501014) input bits = root[UpperCase_P(parm_uc, PSTR(D_JSON_RF_BITS))]; protocol = root[UpperCase_P(parm_uc, PSTR(D_JSON_RF_PROTOCOL))]; repeat = root[UpperCase_P(parm_uc, PSTR(D_JSON_RF_REPEAT))]; @@ -117,10 +116,10 @@ bool RfSendCommand(void) // RFsend data, bits, protocol, repeat, pulse char *p; uint8_t i = 0; - for (char *str = strtok_r(XdrvMailbox.data, ", ", &p); str && i < 5; str = strtok_r(NULL, ", ", &p)) { + for (char *str = strtok_r(XdrvMailbox.data, ", ", &p); str && i < 5; str = strtok_r(nullptr, ", ", &p)) { switch (i++) { case 0: - data = strtoul(str, NULL, 0); // Allow decimal (5246996) and hexadecimal (0x501014) input + data = strtoul(str, nullptr, 0); // Allow decimal (5246996) and hexadecimal (0x501014) input break; case 1: bits = atoi(str); @@ -146,7 +145,7 @@ bool RfSendCommand(void) if (!bits) { bits = 24; } // Default 24 bits if (data) { mySwitch.send(data, bits); - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_RFSEND "\":\"" D_JSON_DONE "\"}")); + Response_P(PSTR("{\"" D_CMND_RFSEND "\":\"" D_JSON_DONE "\"}")); } else { error = true; } @@ -154,7 +153,7 @@ bool RfSendCommand(void) error = true; } if (error) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_RFSEND "\":\"" D_JSON_NO " " D_JSON_RF_DATA ", " D_JSON_RF_BITS ", " D_JSON_RF_PROTOCOL ", " D_JSON_RF_REPEAT " " D_JSON_OR " " D_JSON_RF_PULSE "\"}")); + Response_P(PSTR("{\"" D_CMND_RFSEND "\":\"" D_JSON_NO " " D_JSON_RF_DATA ", " D_JSON_RF_BITS ", " D_JSON_RF_PROTOCOL ", " D_JSON_RF_REPEAT " " D_JSON_OR " " D_JSON_RF_PULSE "\"}")); } } else serviced = false; // Unknown command diff --git a/sonoff/xdrv_18_armtronix_dimmers.ino b/sonoff/xdrv_18_armtronix_dimmers.ino index a22a5a973..79645bdf9 100644 --- a/sonoff/xdrv_18_armtronix_dimmers.ino +++ b/sonoff/xdrv_18_armtronix_dimmers.ino @@ -58,13 +58,11 @@ void LightSerial2Duty(uint8_t duty1, uint8_t duty2) ArmtronixSerial->print("\nDimmer2:"); ArmtronixSerial->println(duty2); - snprintf_P(log_data, sizeof(log_data), PSTR( "ARM: Send Serial Packet Dim Values=%d,%d"), armtronix_dimState[0],armtronix_dimState[1]); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR("ARM: Send Serial Packet Dim Values=%d,%d"), armtronix_dimState[0],armtronix_dimState[1]); } else { armtronix_ignore_dim = false; - snprintf_P(log_data, sizeof(log_data), PSTR( "ARM: Send Dim Level skipped due to already set. Value=%d,%d"), armtronix_dimState[0],armtronix_dimState[1]); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR("ARM: Send Dim Level skipped due to already set. Value=%d,%d"), armtronix_dimState[0],armtronix_dimState[1]); } } @@ -73,8 +71,7 @@ void ArmtronixRequestState(void) { if (ArmtronixSerial) { // Get current status of MCU - snprintf_P(log_data, sizeof(log_data), "TYA: Request MCU state"); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P(LOG_LEVEL_DEBUG, PSTR("ARM: Request MCU state")); ArmtronixSerial->println("Status"); } @@ -123,8 +120,7 @@ void ArmtronixSerialInput(void) armtronix_ignore_dim = true; snprintf_P(scmnd, sizeof(scmnd), PSTR(D_CMND_CHANNEL "%d %d"),i+1, temp); ExecuteCommand(scmnd,SRC_SWITCH); - snprintf_P(log_data, sizeof(log_data), PSTR("ARM: Send CMND_CHANNEL=%s"), scmnd ); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR("ARM: Send CMND_CHANNEL=%s"), scmnd ); } commaIndex = answer.indexOf(',',commaIndex+1); } @@ -152,8 +148,7 @@ void ArmtronixSetWifiLed(void) break; } - snprintf_P(log_data, sizeof(log_data), "ARM: Set WiFi LED to state %d (%d)", wifi_state, WifiState()); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR("ARM: Set WiFi LED to state %d (%d)"), wifi_state, WifiState()); char state = '0' + ((wifi_state & 1) > 0); ArmtronixSerial->print("Setled:"); @@ -175,15 +170,15 @@ bool Xdrv18(uint8_t function) if (ARMTRONIX_DIMMERS == my_module_type) { switch (function) { + case FUNC_LOOP: + if (ArmtronixSerial) { ArmtronixSerialInput(); } + break; case FUNC_MODULE_INIT: result = ArmtronixModuleSelected(); break; case FUNC_INIT: ArmtronixInit(); break; - case FUNC_LOOP: - if (ArmtronixSerial) { ArmtronixSerialInput(); } - break; case FUNC_EVERY_SECOND: if (ArmtronixSerial) { if (armtronix_wifi_state!=WifiState()) { ArmtronixSetWifiLed(); } diff --git a/sonoff/xdrv_19_ps16dz_dimmer.ino b/sonoff/xdrv_19_ps16dz_dimmer.ino index baa4e5dfa..bcca6b0be 100644 --- a/sonoff/xdrv_19_ps16dz_dimmer.ino +++ b/sonoff/xdrv_19_ps16dz_dimmer.ino @@ -35,8 +35,8 @@ bool ps16dz_ignore_dim = false; // Flag to skip serial send to preven //uint64_t ps16dz_seq = 0; -char *ps16dz_tx_buffer = NULL; // Serial transmit buffer -char *ps16dz_rx_buffer = NULL; // Serial receive buffer +char *ps16dz_tx_buffer = nullptr; // Serial transmit buffer +char *ps16dz_rx_buffer = nullptr; // Serial receive buffer int ps16dz_byte_counter = 0; /*********************************************************************************************\ @@ -67,8 +67,7 @@ void PS16DZSendCommand(char type = 0, uint8_t value = 0) break; } - snprintf_P(log_data, sizeof(log_data), PSTR( "PSZ: Send serial command: %s"), ps16dz_tx_buffer ); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR("PSZ: Send serial command: %s"), ps16dz_tx_buffer ); PS16DZSerial->print(ps16dz_tx_buffer); PS16DZSerial->write(0x1B); @@ -109,8 +108,7 @@ void PS16DZSerialDuty(uint8_t duty) } else { ps16dz_ignore_dim = false; // reset flag - snprintf_P(log_data, sizeof(log_data), PSTR( "PSZ: Send Dim Level skipped due to 0 or already set. Value=%d"), duty); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR("PSZ: Send Dim Level skipped due to 0 or already set. Value=%d"), duty); } } @@ -137,9 +135,9 @@ bool PS16DZModuleSelected(void) void PS16DZInit(void) { ps16dz_tx_buffer = (char*)(malloc(PS16DZ_BUFFER_SIZE)); - if (ps16dz_tx_buffer != NULL) { + if (ps16dz_tx_buffer != nullptr) { ps16dz_rx_buffer = (char*)(malloc(PS16DZ_BUFFER_SIZE)); - if (ps16dz_rx_buffer != NULL) { + if (ps16dz_rx_buffer != nullptr) { PS16DZSerial = new TasmotaSerial(pin[GPIO_RXD], pin[GPIO_TXD], 2); if (PS16DZSerial->begin(19200)) { if (PS16DZSerial->hardwareSerial()) { ClaimSerial(); } @@ -165,50 +163,44 @@ void PS16DZSerialInput(void) } else { ps16dz_rx_buffer[ps16dz_byte_counter++] = 0x00; - snprintf_P(log_data, sizeof(log_data), PSTR("PSZ: command received: %s"), ps16dz_rx_buffer); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR("PSZ: command received: %s"), ps16dz_rx_buffer); if(!strncmp(ps16dz_rx_buffer+3, "UPDATE", 6) || !strncmp(ps16dz_rx_buffer+3, "RESULT", 6)) { char *end_str; char *string = ps16dz_rx_buffer+10; char* token = strtok_r(string, ",", &end_str); - while (token != NULL) { + while (token != nullptr) { char* end_token; char* token2 = strtok_r(token, ":", &end_token); - char* token3 = strtok_r(NULL, ":", &end_token); + char* token3 = strtok_r(nullptr, ":", &end_token); if(!strncmp(token2, "\"switch\"", 8)){ bool ps16dz_power = !strncmp(token3, "\"on\"", 4)?true:false; - snprintf_P(log_data, sizeof(log_data), PSTR("PSZ: power received: %s"), token3); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR("PSZ: power received: %s"), token3); if((power || Settings.light_dimmer > 0) && (power !=ps16dz_power)) { ExecuteCommandPower(1, ps16dz_power, SRC_SWITCH); // send SRC_SWITCH? to use as flag to prevent loop from inbound states from faceplate interaction } } else if(!strncmp(token2, "\"bright\"", 8)){ uint8_t ps16dz_bright = atoi(token3); - snprintf_P(log_data, sizeof(log_data), PSTR("PSZ: brightness received: %d"), ps16dz_bright); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR("PSZ: brightness received: %d"), ps16dz_bright); if(power && ps16dz_bright > 0 && ps16dz_bright != Settings.light_dimmer) { snprintf_P(scmnd, sizeof(scmnd), PSTR(D_CMND_DIMMER " %d"), ps16dz_bright ); - snprintf_P(log_data, sizeof(log_data), PSTR("PSZ: Send CMND_DIMMER_STR=%s"), scmnd ); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR("PSZ: Send CMND_DIMMER_STR=%s"), scmnd ); ps16dz_ignore_dim = true; ExecuteCommand(scmnd, SRC_SWITCH); } } else if(!strncmp(token2, "\"sequence\"", 10)){ - //ps16dz_seq = strtoull(token3+1, NULL, 10); - snprintf_P(log_data, sizeof(log_data), PSTR("PSZ: sequence received: %s"), token3); - AddLog(LOG_LEVEL_DEBUG); + //ps16dz_seq = strtoull(token3+1, nullptr, 10); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR("PSZ: sequence received: %s"), token3); } - token = strtok_r(NULL, ",", &end_str); + token = strtok_r(nullptr, ",", &end_str); } } else if(!strncmp(ps16dz_rx_buffer+3, "SETTING", 7)) { - snprintf_P(log_data, sizeof(log_data), PSTR("PSZ: Reset")); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P(LOG_LEVEL_DEBUG, PSTR("PSZ: Reset")); PS16DZResetWifi(); } memset(ps16dz_rx_buffer, 0, PS16DZ_BUFFER_SIZE); @@ -231,15 +223,15 @@ bool Xdrv19(uint8_t function) if (PS_16_DZ == my_module_type) { switch (function) { + case FUNC_LOOP: + if (PS16DZSerial) { PS16DZSerialInput(); } + break; case FUNC_MODULE_INIT: result = PS16DZModuleSelected(); break; case FUNC_INIT: PS16DZInit(); break; - case FUNC_LOOP: - if (PS16DZSerial) { PS16DZSerialInput(); } - break; case FUNC_SET_DEVICE_POWER: result = PS16DZSetPower(); break; diff --git a/sonoff/xdrv_99_debug.ino b/sonoff/xdrv_99_debug.ino index 113fc7ce4..e3e90a398 100644 --- a/sonoff/xdrv_99_debug.ino +++ b/sonoff/xdrv_99_debug.ino @@ -25,6 +25,8 @@ #endif // USE_DEBUG_DRIVER #endif // DEBUG_THEO +//#define USE_DEBUG_SETTING_NAMES + #ifdef USE_DEBUG_DRIVER /*********************************************************************************************\ * Virtual debugging support - Part1 @@ -148,13 +150,12 @@ void CpuLoadLoop(void) #if defined(F_CPU) && (F_CPU == 160000000L) int CPU_load = 100 - ( (CPU_loops*(1 + 30*sleep)) / (CPU_load_check *800) ); CPU_loops = CPU_loops / CPU_load_check; - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_DEBUG "FreeRam %d, CPU %d%%(160MHz), Loops/sec %d"), ESP.getFreeHeap(), CPU_load, CPU_loops); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "FreeRam %d, CPU %d%%(160MHz), Loops/sec %d"), ESP.getFreeHeap(), CPU_load, CPU_loops); #else int CPU_load = 100 - ( (CPU_loops*(1 + 30*sleep)) / (CPU_load_check *400) ); CPU_loops = CPU_loops / CPU_load_check; - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_DEBUG "FreeRam %d, CPU %d%%(80MHz), Loops/sec %d"), ESP.getFreeHeap(), CPU_load, CPU_loops); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "FreeRam %d, CPU %d%%(80MHz), Loops/sec %d"), ESP.getFreeHeap(), CPU_load, CPU_loops); #endif - AddLog(LOG_LEVEL_DEBUG); CPU_last_millis = CPU_last_loop_time; CPU_loops = 0; } @@ -176,12 +177,8 @@ void DebugFreeMem(void) { register uint32_t *sp asm("a1"); -// snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_DEBUG "FreeRam %d, FreeStack %d, UnmodifiedStack %d (%s)"), -// ESP.getFreeHeap(), 4 * (sp - g_cont.stack), cont_get_free_stack(&g_cont), XdrvMailbox.data); - - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_DEBUG "FreeRam %d, FreeStack %d (%s)"), - ESP.getFreeHeap(), 4 * (sp - g_cont.stack), XdrvMailbox.data); - AddLog(LOG_LEVEL_DEBUG); +// AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "FreeRam %d, FreeStack %d, UnmodifiedStack %d (%s)"), ESP.getFreeHeap(), 4 * (sp - g_cont.stack), cont_get_free_stack(&g_cont), XdrvMailbox.data); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "FreeRam %d, FreeStack %d (%s)"), ESP.getFreeHeap(), 4 * (sp - g_cont.stack), XdrvMailbox.data); } #else @@ -198,9 +195,7 @@ void DebugFreeMem(void) { register uint32_t *sp asm("a1"); - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_DEBUG "FreeRam %d, FreeStack %d (%s)"), - ESP.getFreeHeap(), 4 * (sp - g_pcont->stack), XdrvMailbox.data); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "FreeRam %d, FreeStack %d (%s)"), ESP.getFreeHeap(), 4 * (sp - g_pcont->stack), XdrvMailbox.data); } #endif // ARDUINO_ESP8266_RELEASE_2_x_x @@ -233,8 +228,7 @@ void DebugRtcDump(char* parms) uint16_t srow = strtol(parms, &p, 16) / CFG_COLS; uint16_t mrow = strtol(p, &p, 10); -// snprintf_P(log_data, sizeof(log_data), PSTR("Cnfg: Parms %s, Start row %d, rows %d"), parms, srow, mrow); -// AddLog(LOG_LEVEL_DEBUG); +// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("Cnfg: Parms %s, Start row %d, rows %d"), parms, srow, mrow); if (0 == mrow) { // Default only 8 lines mrow = 8; @@ -285,8 +279,7 @@ void DebugCfgDump(char* parms) uint16_t srow = strtol(parms, &p, 16) / CFG_COLS; uint16_t mrow = strtol(p, &p, 10); -// snprintf_P(log_data, sizeof(log_data), PSTR("Cnfg: Parms %s, Start row %d, rows %d"), parms, srow, mrow); -// AddLog(LOG_LEVEL_DEBUG); +// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("Cnfg: Parms %s, Start row %d, rows %d"), parms, srow, mrow); if (0 == mrow) { // Default only 8 lines mrow = 8; @@ -363,56 +356,38 @@ void DebugCfgPoke(char* parms) uint32_t ndata32 = (buffer[address +3] << 24) + (buffer[address +2] << 16) + (buffer[address +1] << 8) + buffer[address]; - snprintf_P(log_data, sizeof(log_data), PSTR("%03X: 0x%0LX (%lu) poked to 0x%0LX (%lu)"), address, data32, data32, ndata32, ndata32); - AddLog(LOG_LEVEL_INFO); + AddLog_P2(LOG_LEVEL_INFO, PSTR("%03X: 0x%0LX (%lu) poked to 0x%0LX (%lu)"), address, data32, data32, ndata32, ndata32); } +#ifdef USE_DEBUG_SETTING_NAMES void DebugCfgShow(uint8_t more) { uint8_t *SetAddr; SetAddr = (uint8_t *)&Settings; - snprintf_P(log_data, sizeof(log_data), PSTR("%03X: Hostname (%d) [%s]"), (uint8_t *)&Settings.hostname - SetAddr, sizeof(Settings.hostname)-1, Settings.hostname); - AddLog(LOG_LEVEL_INFO); - snprintf_P(log_data, sizeof(log_data), PSTR("%03X: SSids (%d) [%s], [%s]"), (uint8_t *)&Settings.sta_ssid - SetAddr, sizeof(Settings.sta_ssid[0])-1, Settings.sta_ssid[0], Settings.sta_ssid[1]); - AddLog(LOG_LEVEL_INFO); - snprintf_P(log_data, sizeof(log_data), PSTR("%03X: Friendlynames (%d) [%s], [%s], [%s], [%s]"), (uint8_t *)&Settings.friendlyname - SetAddr, sizeof(Settings.friendlyname[0])-1, Settings.friendlyname[0], Settings.friendlyname[1], Settings.friendlyname[2], Settings.friendlyname[3]); - AddLog(LOG_LEVEL_INFO); - snprintf_P(log_data, sizeof(log_data), PSTR("%03X: OTA Url (%d) [%s]"), (uint8_t *)&Settings.ota_url - SetAddr, sizeof(Settings.ota_url)-1, Settings.ota_url); - AddLog(LOG_LEVEL_INFO); - snprintf_P(log_data, sizeof(log_data), PSTR("%03X: StateText (%d) [%s], [%s], [%s], [%s]"), (uint8_t *)&Settings.state_text - SetAddr, sizeof(Settings.state_text[0])-1, Settings.state_text[0], Settings.state_text[1], Settings.state_text[2], Settings.state_text[3]); - AddLog(LOG_LEVEL_INFO); - snprintf_P(log_data, sizeof(log_data), PSTR("%03X: Syslog Host (%d) [%s]"), (uint8_t *)&Settings.syslog_host - SetAddr, sizeof(Settings.syslog_host)-1, Settings.syslog_host); - AddLog(LOG_LEVEL_INFO); - snprintf_P(log_data, sizeof(log_data), PSTR("%03X: NTP Servers (%d) [%s], [%s], [%s]"), (uint8_t *)&Settings.ntp_server - SetAddr, sizeof(Settings.ntp_server[0])-1, Settings.ntp_server[0], Settings.ntp_server[1], Settings.ntp_server[2]); - AddLog(LOG_LEVEL_INFO); - snprintf_P(log_data, sizeof(log_data), PSTR("%03X: MQTT Host (%d) [%s]"), (uint8_t *)&Settings.mqtt_host - SetAddr, sizeof(Settings.mqtt_host)-1, Settings.mqtt_host); - AddLog(LOG_LEVEL_INFO); - snprintf_P(log_data, sizeof(log_data), PSTR("%03X: MQTT Client (%d) [%s]"), (uint8_t *)&Settings.mqtt_client - SetAddr, sizeof(Settings.mqtt_client)-1, Settings.mqtt_client); - AddLog(LOG_LEVEL_INFO); - snprintf_P(log_data, sizeof(log_data), PSTR("%03X: MQTT User (%d) [%s]"), (uint8_t *)&Settings.mqtt_user - SetAddr, sizeof(Settings.mqtt_user)-1, Settings.mqtt_user); - AddLog(LOG_LEVEL_INFO); - snprintf_P(log_data, sizeof(log_data), PSTR("%03X: MQTT FullTopic (%d) [%s]"), (uint8_t *)&Settings.mqtt_fulltopic - SetAddr, sizeof(Settings.mqtt_fulltopic)-1, Settings.mqtt_fulltopic); - AddLog(LOG_LEVEL_INFO); - snprintf_P(log_data, sizeof(log_data), PSTR("%03X: MQTT Topic (%d) [%s]"), (uint8_t *)&Settings.mqtt_topic - SetAddr, sizeof(Settings.mqtt_topic)-1, Settings.mqtt_topic); - AddLog(LOG_LEVEL_INFO); - snprintf_P(log_data, sizeof(log_data), PSTR("%03X: MQTT GroupTopic (%d) [%s]"), (uint8_t *)&Settings.mqtt_grptopic - SetAddr, sizeof(Settings.mqtt_grptopic)-1, Settings.mqtt_grptopic); - AddLog(LOG_LEVEL_INFO); - snprintf_P(log_data, sizeof(log_data), PSTR("%03X: MQTT ButtonTopic (%d) [%s]"), (uint8_t *)&Settings.button_topic - SetAddr, sizeof(Settings.button_topic)-1, Settings.button_topic); - AddLog(LOG_LEVEL_INFO); - snprintf_P(log_data, sizeof(log_data), PSTR("%03X: MQTT SwitchTopic (%d) [%s]"), (uint8_t *)&Settings.switch_topic - SetAddr, sizeof(Settings.switch_topic)-1, Settings.switch_topic); - AddLog(LOG_LEVEL_INFO); - snprintf_P(log_data, sizeof(log_data), PSTR("%03X: MQTT Prefixes (%d) [%s], [%s], [%s]"), (uint8_t *)&Settings.mqtt_prefix - SetAddr, sizeof(Settings.mqtt_prefix[0])-1, Settings.mqtt_prefix[0], Settings.mqtt_prefix[1], Settings.mqtt_prefix[2]); - AddLog(LOG_LEVEL_INFO); + AddLog_P2(LOG_LEVEL_INFO, PSTR("%03X: Hostname (%d) [%s]"), (uint8_t *)&Settings.hostname - SetAddr, sizeof(Settings.hostname)-1, Settings.hostname); + AddLog_P2(LOG_LEVEL_INFO, PSTR("%03X: SSids (%d) [%s], [%s]"), (uint8_t *)&Settings.sta_ssid - SetAddr, sizeof(Settings.sta_ssid[0])-1, Settings.sta_ssid[0], Settings.sta_ssid[1]); + AddLog_P2(LOG_LEVEL_INFO, PSTR("%03X: Friendlynames (%d) [%s], [%s], [%s], [%s]"), (uint8_t *)&Settings.friendlyname - SetAddr, sizeof(Settings.friendlyname[0])-1, Settings.friendlyname[0], Settings.friendlyname[1], Settings.friendlyname[2], Settings.friendlyname[3]); + AddLog_P2(LOG_LEVEL_INFO, PSTR("%03X: OTA Url (%d) [%s]"), (uint8_t *)&Settings.ota_url - SetAddr, sizeof(Settings.ota_url)-1, Settings.ota_url); + AddLog_P2(LOG_LEVEL_INFO, PSTR("%03X: StateText (%d) [%s], [%s], [%s], [%s]"), (uint8_t *)&Settings.state_text - SetAddr, sizeof(Settings.state_text[0])-1, Settings.state_text[0], Settings.state_text[1], Settings.state_text[2], Settings.state_text[3]); + AddLog_P2(LOG_LEVEL_INFO, PSTR("%03X: Syslog Host (%d) [%s]"), (uint8_t *)&Settings.syslog_host - SetAddr, sizeof(Settings.syslog_host)-1, Settings.syslog_host); + AddLog_P2(LOG_LEVEL_INFO, PSTR("%03X: NTP Servers (%d) [%s], [%s], [%s]"), (uint8_t *)&Settings.ntp_server - SetAddr, sizeof(Settings.ntp_server[0])-1, Settings.ntp_server[0], Settings.ntp_server[1], Settings.ntp_server[2]); + AddLog_P2(LOG_LEVEL_INFO, PSTR("%03X: MQTT Host (%d) [%s]"), (uint8_t *)&Settings.mqtt_host - SetAddr, sizeof(Settings.mqtt_host)-1, Settings.mqtt_host); + AddLog_P2(LOG_LEVEL_INFO, PSTR("%03X: MQTT Client (%d) [%s]"), (uint8_t *)&Settings.mqtt_client - SetAddr, sizeof(Settings.mqtt_client)-1, Settings.mqtt_client); + AddLog_P2(LOG_LEVEL_INFO, PSTR("%03X: MQTT User (%d) [%s]"), (uint8_t *)&Settings.mqtt_user - SetAddr, sizeof(Settings.mqtt_user)-1, Settings.mqtt_user); + AddLog_P2(LOG_LEVEL_INFO, PSTR("%03X: MQTT FullTopic (%d) [%s]"), (uint8_t *)&Settings.mqtt_fulltopic - SetAddr, sizeof(Settings.mqtt_fulltopic)-1, Settings.mqtt_fulltopic); + AddLog_P2(LOG_LEVEL_INFO, PSTR("%03X: MQTT Topic (%d) [%s]"), (uint8_t *)&Settings.mqtt_topic - SetAddr, sizeof(Settings.mqtt_topic)-1, Settings.mqtt_topic); + AddLog_P2(LOG_LEVEL_INFO, PSTR("%03X: MQTT GroupTopic (%d) [%s]"), (uint8_t *)&Settings.mqtt_grptopic - SetAddr, sizeof(Settings.mqtt_grptopic)-1, Settings.mqtt_grptopic); + AddLog_P2(LOG_LEVEL_INFO, PSTR("%03X: MQTT ButtonTopic (%d) [%s]"), (uint8_t *)&Settings.button_topic - SetAddr, sizeof(Settings.button_topic)-1, Settings.button_topic); + AddLog_P2(LOG_LEVEL_INFO, PSTR("%03X: MQTT SwitchTopic (%d) [%s]"), (uint8_t *)&Settings.switch_topic - SetAddr, sizeof(Settings.switch_topic)-1, Settings.switch_topic); + AddLog_P2(LOG_LEVEL_INFO, PSTR("%03X: MQTT Prefixes (%d) [%s], [%s], [%s]"), (uint8_t *)&Settings.mqtt_prefix - SetAddr, sizeof(Settings.mqtt_prefix[0])-1, Settings.mqtt_prefix[0], Settings.mqtt_prefix[1], Settings.mqtt_prefix[2]); if (17 == more) { - snprintf_P(log_data, sizeof(log_data), PSTR("%03X: AP Passwords (%d) [%s], [%s]"), (uint8_t *)&Settings.sta_pwd - SetAddr, sizeof(Settings.sta_pwd[0])-1, Settings.sta_pwd[0], Settings.sta_pwd[1]); - AddLog(LOG_LEVEL_INFO); - snprintf_P(log_data, sizeof(log_data), PSTR("%03X: MQTT Password (%d) [%s]"), (uint8_t *)&Settings.mqtt_pwd - SetAddr, sizeof(Settings.mqtt_pwd)-1, Settings.mqtt_pwd); - AddLog(LOG_LEVEL_INFO); - snprintf_P(log_data, sizeof(log_data), PSTR("%03X: Web Password (%d) [%s]"), (uint8_t *)&Settings.web_password - SetAddr, sizeof(Settings.web_password)-1, Settings.web_password); - AddLog(LOG_LEVEL_INFO); + AddLog_P2(LOG_LEVEL_INFO, PSTR("%03X: AP Passwords (%d) [%s], [%s]"), (uint8_t *)&Settings.sta_pwd - SetAddr, sizeof(Settings.sta_pwd[0])-1, Settings.sta_pwd[0], Settings.sta_pwd[1]); + AddLog_P2(LOG_LEVEL_INFO, PSTR("%03X: MQTT Password (%d) [%s]"), (uint8_t *)&Settings.mqtt_pwd - SetAddr, sizeof(Settings.mqtt_pwd)-1, Settings.mqtt_pwd); + AddLog_P2(LOG_LEVEL_INFO, PSTR("%03X: Web Password (%d) [%s]"), (uint8_t *)&Settings.web_password - SetAddr, sizeof(Settings.web_password)-1, Settings.web_password); } } +#endif // USE_DEBUG_SETTING_NAMES void SetFlashMode(uint8_t mode) { @@ -443,42 +418,43 @@ bool DebugCommand(void) serviced = false; // Unknown command } else if (CMND_HELP == command_code) { - snprintf_P(log_data, sizeof(log_data), kDebugCommands); - AddLog(LOG_LEVEL_INFO); - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, D_JSON_DONE); + AddLog_P(LOG_LEVEL_INFO, kDebugCommands); + Response_P(S_JSON_COMMAND_SVALUE, command, D_JSON_DONE); } else if (CMND_RTCDUMP == command_code) { DebugRtcDump(XdrvMailbox.data); - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, D_JSON_DONE); + Response_P(S_JSON_COMMAND_SVALUE, command, D_JSON_DONE); } else if (CMND_CFGDUMP == command_code) { DebugCfgDump(XdrvMailbox.data); - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, D_JSON_DONE); + Response_P(S_JSON_COMMAND_SVALUE, command, D_JSON_DONE); } else if (CMND_CFGPEEK == command_code) { DebugCfgPeek(XdrvMailbox.data); - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, D_JSON_DONE); + Response_P(S_JSON_COMMAND_SVALUE, command, D_JSON_DONE); } else if (CMND_CFGPOKE == command_code) { DebugCfgPoke(XdrvMailbox.data); - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, D_JSON_DONE); + Response_P(S_JSON_COMMAND_SVALUE, command, D_JSON_DONE); } +#ifdef USE_DEBUG_SETTING_NAMES else if (CMND_CFGSHOW == command_code) { DebugCfgShow(XdrvMailbox.payload); - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, D_JSON_DONE); + Response_P(S_JSON_COMMAND_SVALUE, command, D_JSON_DONE); } +#endif // USE_DEBUG_SETTING_NAMES #ifdef USE_WEBSERVER else if (CMND_CFGXOR == command_code) { if (XdrvMailbox.data_len > 0) { config_xor_on_set = XdrvMailbox.payload; } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_NVALUE, command, config_xor_on_set); + Response_P(S_JSON_COMMAND_NVALUE, command, config_xor_on_set); } #endif // USE_WEBSERVER #ifdef DEBUG_THEO else if (CMND_EXCEPTION == command_code) { if (XdrvMailbox.data_len > 0) ExceptionTest(XdrvMailbox.payload); - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, D_JSON_DONE); + Response_P(S_JSON_COMMAND_SVALUE, command, D_JSON_DONE); } #endif // DEBUG_THEO else if (CMND_CPUCHECK == command_code) { @@ -486,26 +462,26 @@ bool DebugCommand(void) CPU_load_check = XdrvMailbox.payload; CPU_last_millis = CPU_last_loop_time; } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_NVALUE, command, CPU_load_check); + Response_P(S_JSON_COMMAND_NVALUE, command, CPU_load_check); } else if (CMND_FREEMEM == command_code) { if (XdrvMailbox.data_len > 0) { CPU_show_freemem = XdrvMailbox.payload; } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_NVALUE, command, CPU_show_freemem); + Response_P(S_JSON_COMMAND_NVALUE, command, CPU_show_freemem); } else if ((CMND_SETSENSOR == command_code) && (XdrvMailbox.index < MAX_XSNS_DRIVERS)) { if ((XdrvMailbox.payload >= 0) && XsnsPresent(XdrvMailbox.index)) { bitWrite(Settings.sensors[XdrvMailbox.index / 32], XdrvMailbox.index % 32, XdrvMailbox.payload &1); if (1 == XdrvMailbox.payload) { restart_flag = 2; } // To safely re-enable a sensor currently most sensor need to follow complete restart init cycle } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_XVALUE, command, XsnsGetSensors().c_str()); + Response_P(S_JSON_COMMAND_XVALUE, command, XsnsGetSensors().c_str()); } else if (CMND_FLASHMODE == command_code) { if ((XdrvMailbox.payload >= 0) && (XdrvMailbox.payload <= 3)) { SetFlashMode(XdrvMailbox.payload); } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_NVALUE, command, ESP.getFlashChipMode()); + Response_P(S_JSON_COMMAND_NVALUE, command, ESP.getFlashChipMode()); } else serviced = false; // Unknown command @@ -521,12 +497,12 @@ bool Xdrv99(uint8_t function) bool result = false; switch (function) { - case FUNC_PRE_INIT: - CPU_last_millis = millis(); - break; case FUNC_LOOP: CpuLoadLoop(); break; + case FUNC_PRE_INIT: + CPU_last_millis = millis(); + break; case FUNC_COMMAND: result = DebugCommand(); break; diff --git a/sonoff/xdrv_interface.ino b/sonoff/xdrv_interface.ino index 7c3a31c25..84f80062b 100644 --- a/sonoff/xdrv_interface.ino +++ b/sonoff/xdrv_interface.ino @@ -192,20 +192,6 @@ bool (* const xdrv_func_ptr[])(uint8_t) = { // Driver Function Pointers const uint8_t xdrv_present = sizeof(xdrv_func_ptr) / sizeof(xdrv_func_ptr[0]); // Number of drivers found -bool XdrvCommand(bool grpflg, char *type, uint16_t index, char *dataBuf, uint16_t data_len, int16_t payload, uint16_t payload16) -{ -// XdrvMailbox.valid = 1; - XdrvMailbox.index = index; - XdrvMailbox.data_len = data_len; - XdrvMailbox.payload16 = payload16; - XdrvMailbox.payload = payload; - XdrvMailbox.grpflg = grpflg; - XdrvMailbox.topic = type; - XdrvMailbox.data = dataBuf; - - return XdrvCall(FUNC_COMMAND); -} - bool XdrvMqttData(char *topicBuf, uint16_t stopicBuf, char *dataBuf, uint16_t sdataBuf) { XdrvMailbox.index = stopicBuf; @@ -221,13 +207,15 @@ bool XdrvRulesProcess(void) return XdrvCall(FUNC_RULES_PROCESS); } +#ifdef USE_DEBUG_DRIVER void ShowFreeMem(const char *where) { - char stemp[20]; + char stemp[30]; snprintf_P(stemp, sizeof(stemp), where); XdrvMailbox.data = stemp; XdrvCall(FUNC_FREE_MEM); } +#endif /*********************************************************************************************\ * Function call to all xdrv @@ -242,6 +230,7 @@ bool XdrvCall(uint8_t Function) result = xdrv_func_ptr[x](Function); if (result && ((FUNC_COMMAND == Function) || + (FUNC_COMMAND_DRIVER == Function) || (FUNC_MQTT_DATA == Function) || (FUNC_RULES_PROCESS == Function) || (FUNC_BUTTON_PRESSED == Function) || diff --git a/sonoff/xdsp_01_lcd.ino b/sonoff/xdsp_01_lcd.ino index 8a37342a3..c0877a859 100644 --- a/sonoff/xdsp_01_lcd.ino +++ b/sonoff/xdsp_01_lcd.ino @@ -127,7 +127,7 @@ bool LcdPrintLog(void) if (!disp_screen_buffer_cols) { DisplayAllocScreenBuffer(); } char* txt = DisplayLogBuffer('\337'); - if (txt != NULL) { + if (txt != nullptr) { uint8_t last_row = Settings.display_rows -1; for (uint8_t i = 0; i < last_row; i++) { @@ -138,8 +138,7 @@ bool LcdPrintLog(void) strlcpy(disp_screen_buffer[last_row], txt, disp_screen_buffer_cols); DisplayFillScreen(last_row); - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_DEBUG "[%s]"), disp_screen_buffer[last_row]); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "[%s]"), disp_screen_buffer[last_row]); lcd->setCursor(0, last_row); lcd->print(disp_screen_buffer[last_row]); diff --git a/sonoff/xdsp_02_ssd1306.ino b/sonoff/xdsp_02_ssd1306.ino index e7952b65e..8d8b696d7 100644 --- a/sonoff/xdsp_02_ssd1306.ino +++ b/sonoff/xdsp_02_ssd1306.ino @@ -141,7 +141,7 @@ void Ssd1306PrintLog(void) if (!disp_screen_buffer_cols) { DisplayAllocScreenBuffer(); } char* txt = DisplayLogBuffer('\370'); - if (txt != NULL) { + if (txt != nullptr) { uint8_t last_row = Settings.display_rows -1; oled->clearDisplay(); @@ -154,8 +154,7 @@ void Ssd1306PrintLog(void) strlcpy(disp_screen_buffer[last_row], txt, disp_screen_buffer_cols); DisplayFillScreen(last_row); - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_DEBUG "[%s]"), disp_screen_buffer[last_row]); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "[%s]"), disp_screen_buffer[last_row]); oled->println(disp_screen_buffer[last_row]); oled->display(); diff --git a/sonoff/xdsp_03_matrix.ino b/sonoff/xdsp_03_matrix.ino index 8af7c50c2..a77b5df1e 100644 --- a/sonoff/xdsp_03_matrix.ino +++ b/sonoff/xdsp_03_matrix.ino @@ -37,7 +37,7 @@ int16_t mtx_x = 0; int16_t mtx_y = 0; //char mtx_buffer[MTX_MAX_SCREEN_BUFFER]; -char *mtx_buffer = NULL; +char *mtx_buffer = nullptr; uint8_t mtx_mode = 0; uint8_t mtx_loop = 0; @@ -94,8 +94,7 @@ void MatrixScrollLeft(char* txt, int loop) // Horiz. position of text -- starts off right edge mtx_x = 8 * mtx_matrices; - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_DEBUG "[%s]"), txt); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "[%s]"), txt); disp_refresh = Settings.display_refresh; case 2: @@ -141,9 +140,9 @@ void MatrixScrollUp(char* txt, int loop) disp_refresh = Settings.display_refresh; strlcpy(tmpbuf, txt, sizeof(tmpbuf)); char *p = strtok(tmpbuf, separators); - while (p != NULL && wordcounter < 40) { + while (p != nullptr && wordcounter < 40) { words[wordcounter++] = p; - p = strtok(NULL, separators); + p = strtok(nullptr, separators); } for (uint8_t i = 0; i < mtx_matrices; i++) { matrix[i]->clear(); @@ -197,7 +196,7 @@ void MatrixInit(uint8_t mode) void MatrixInitDriver(void) { mtx_buffer = (char*)(malloc(MTX_MAX_SCREEN_BUFFER)); - if (mtx_buffer != NULL) { + if (mtx_buffer != nullptr) { if (!Settings.display_model) { if (I2cDevice(Settings.display_address[1])) { Settings.display_model = XDSP_03; @@ -227,7 +226,7 @@ void MatrixOnOff(void) void MatrixDrawStringAt(uint16_t x, uint16_t y, char *str, uint16_t color, uint8_t flag) { - snprintf(mtx_buffer, MTX_MAX_SCREEN_BUFFER, str); + strlcpy(mtx_buffer, str, MTX_MAX_SCREEN_BUFFER); mtx_mode = x &1; // Use x for selecting scroll up (0) or scroll left (1) mtx_loop = y &1; // Use y for selecting no loop (0) or loop (1) if (!mtx_state) { mtx_state = 1; } @@ -240,7 +239,7 @@ void MatrixDrawStringAt(uint16_t x, uint16_t y, char *str, uint16_t color, uint8 void MatrixPrintLog(uint8_t direction) { char* txt = (!mtx_done) ? DisplayLogBuffer('\370') : mtx_buffer; - if (txt != NULL) { + if (txt != nullptr) { if (!mtx_state) { mtx_state = 1; } if (!mtx_done) { @@ -261,8 +260,7 @@ void MatrixPrintLog(uint8_t direction) i++; } - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_APPLICATION "[%s]"), mtx_buffer); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION "[%s]"), mtx_buffer); mtx_done = 1; } diff --git a/sonoff/xdsp_04_ili9341.ino b/sonoff/xdsp_04_ili9341.ino index 6b6511c62..bf3c2729c 100644 --- a/sonoff/xdsp_04_ili9341.ino +++ b/sonoff/xdsp_04_ili9341.ino @@ -147,7 +147,7 @@ void Ili9341PrintLog(void) } char* txt = DisplayLogBuffer('\370'); - if (txt != NULL) { + if (txt != nullptr) { uint8_t size = Settings.display_size; uint16_t theight = size * TFT_FONT_HEIGTH; @@ -178,8 +178,7 @@ void Ili9341PrintLog(void) DisplayFillScreen(last_row); tft->print(disp_screen_buffer[last_row]); } - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_APPLICATION "[%s]"), txt); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION "[%s]"), txt); } } } diff --git a/sonoff/xdsp_05_epaper_29.ino b/sonoff/xdsp_05_epaper_29.ino index 50495a1db..c1daf8259 100644 --- a/sonoff/xdsp_05_epaper_29.ino +++ b/sonoff/xdsp_05_epaper_29.ino @@ -123,16 +123,14 @@ void EpdInitDriver(void) epd.sclk_pin = pin[GPIO_SPI_CLK]; // 14 epd.mosi_pin = pin[GPIO_SPI_MOSI]; // 13 EpdInitMode(); - snprintf_P(log_data, sizeof(log_data), PSTR("EPD: HardSPI CS %d, CLK %d, MOSI %d"), epd.cs_pin, epd.sclk_pin, epd.mosi_pin); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR("EPD: HardSPI CS %d, CLK %d, MOSI %d"), epd.cs_pin, epd.sclk_pin, epd.mosi_pin); } else if ((pin[GPIO_SSPI_CS] < 99) && (pin[GPIO_SSPI_SCLK] < 99) && (pin[GPIO_SSPI_MOSI] < 99)) { epd.cs_pin = pin[GPIO_SSPI_CS]; epd.sclk_pin = pin[GPIO_SSPI_SCLK]; epd.mosi_pin = pin[GPIO_SSPI_MOSI]; EpdInitMode(); - snprintf_P(log_data, sizeof(log_data), PSTR("EPD: SoftSPI CS %d, CLK %d, MOSI %d"), epd.cs_pin, epd.sclk_pin, epd.mosi_pin); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR("EPD: SoftSPI CS %d, CLK %d, MOSI %d"), epd.cs_pin, epd.sclk_pin, epd.mosi_pin); } } } @@ -202,7 +200,7 @@ void EpdPrintLog(void) } char* txt = DisplayLogBuffer('\040'); - if (txt != NULL) { + if (txt != nullptr) { uint8_t size = Settings.display_size; uint16_t theight = size * EPD_FONT_HEIGTH; @@ -221,8 +219,7 @@ void EpdPrintLog(void) EpdDrawStringAt(0, epd_scroll, disp_screen_buffer[last_row], COLORED, 0); // EpdDisplayFrame(); - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_APPLICATION "[%s]"), txt); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION "[%s]"), txt); } } } diff --git a/sonoff/xnrg_01_hlw8012.ino b/sonoff/xnrg_01_hlw8012.ino index 778b49b36..14c00d911 100644 --- a/sonoff/xnrg_01_hlw8012.ino +++ b/sonoff/xnrg_01_hlw8012.ino @@ -152,9 +152,8 @@ void HlwEvery200ms(void) } } unsigned long median = hlw_debug[(hlw_cf1_pulse_counter +1) / 2]; - snprintf_P(log_data, sizeof(log_data), PSTR("NRG: power %d, ui %d, cnt %d, smpl%s, sum %d, mean %d, median %d"), + AddLog_P2(LOG_LEVEL_DEBUG, PSTR("NRG: power %d, ui %d, cnt %d, smpl%s, sum %d, mean %d, median %d"), hlw_cf_power_pulse_length, hlw_select_ui_flag, hlw_cf1_pulse_counter, stemp, hlw_cf1_summed_pulse_length, cf1_pulse_length, median); - AddLog(LOG_LEVEL_DEBUG); #endif if (hlw_select_ui_flag == hlw_ui_flag) { diff --git a/sonoff/xnrg_02_cse7766.ino b/sonoff/xnrg_02_cse7766.ino index ba228bd03..17fda1f44 100644 --- a/sonoff/xnrg_02_cse7766.ino +++ b/sonoff/xnrg_02_cse7766.ino @@ -205,17 +205,17 @@ bool CseCommand(void) if (CMND_POWERSET == energy_command_code) { if (XdrvMailbox.data_len && power_cycle) { - Settings.energy_power_calibration = ((unsigned long)CharToDouble(XdrvMailbox.data) * power_cycle) / CSE_PREF; + Settings.energy_power_calibration = (unsigned long)(CharToDouble(XdrvMailbox.data) * power_cycle) / CSE_PREF; } } else if (CMND_VOLTAGESET == energy_command_code) { if (XdrvMailbox.data_len && voltage_cycle) { - Settings.energy_voltage_calibration = ((unsigned long)CharToDouble(XdrvMailbox.data) * voltage_cycle) / CSE_UREF; + Settings.energy_voltage_calibration = (unsigned long)(CharToDouble(XdrvMailbox.data) * voltage_cycle) / CSE_UREF; } } else if (CMND_CURRENTSET == energy_command_code) { if (XdrvMailbox.data_len && current_cycle) { - Settings.energy_current_calibration = ((unsigned long)CharToDouble(XdrvMailbox.data) * current_cycle) / 1000; + Settings.energy_current_calibration = (unsigned long)(CharToDouble(XdrvMailbox.data) * current_cycle) / 1000; } } else serviced = false; // Unknown command diff --git a/sonoff/xnrg_03_pzem004t.ino b/sonoff/xnrg_03_pzem004t.ino index a15d61ba1..b2c72bfa8 100644 --- a/sonoff/xnrg_03_pzem004t.ino +++ b/sonoff/xnrg_03_pzem004t.ino @@ -32,7 +32,7 @@ #include -TasmotaSerial *PzemSerial = NULL; +TasmotaSerial *PzemSerial = nullptr; #define PZEM_VOLTAGE (uint8_t)0xB0 #define RESP_VOLTAGE (uint8_t)0xA0 diff --git a/sonoff/xnrg_04_mcp39f501.ino b/sonoff/xnrg_04_mcp39f501.ino index d878d9e8b..5441a45ca 100644 --- a/sonoff/xnrg_04_mcp39f501.ino +++ b/sonoff/xnrg_04_mcp39f501.ino @@ -67,7 +67,7 @@ #define MCP_BUFFER_SIZE 60 #include -TasmotaSerial *McpSerial = NULL; +TasmotaSerial *McpSerial = nullptr; typedef struct mcp_cal_registers_type { uint16_t gain_current_rms; @@ -92,7 +92,7 @@ typedef struct mcp_cal_registers_type { uint16_t accumulation_interval; } mcp_cal_registers_type; -char *mcp_buffer = NULL; +char *mcp_buffer = nullptr; unsigned long mcp_window = 0; unsigned long mcp_kWhcounter = 0; uint32_t mcp_system_configuration = 0x03000000; @@ -652,12 +652,12 @@ int Xnrg04(uint8_t function) } else if (XNRG_04 == energy_flg) { switch (function) { - case FUNC_INIT: - McpSnsInit(); - break; case FUNC_LOOP: if (McpSerial) { McpSerialInput(); } break; + case FUNC_INIT: + McpSnsInit(); + break; case FUNC_EVERY_SECOND: if (McpSerial) { McpEverySecond(); } break; diff --git a/sonoff/xnrg_05_pzem_ac.ino b/sonoff/xnrg_05_pzem_ac.ino index 375b2e2cc..b4ecea288 100644 --- a/sonoff/xnrg_05_pzem_ac.ino +++ b/sonoff/xnrg_05_pzem_ac.ino @@ -49,8 +49,7 @@ void PzemAcEverySecond(void) AddLogBuffer(LOG_LEVEL_DEBUG_MORE, buffer, (buffer[2]) ? buffer[2] +5 : sizeof(buffer)); if (error) { - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_DEBUG "PzemAc response error %d"), error); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "PzemAc response error %d"), error); } else { // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 // 01 04 14 08 D1 00 6C 00 00 00 F4 00 00 00 26 00 00 01 F4 00 64 00 00 51 34 diff --git a/sonoff/xnrg_06_pzem_dc.ino b/sonoff/xnrg_06_pzem_dc.ino index 1c3713c8f..2bb2bc4a2 100644 --- a/sonoff/xnrg_06_pzem_dc.ino +++ b/sonoff/xnrg_06_pzem_dc.ino @@ -49,8 +49,7 @@ void PzemDcEverySecond(void) AddLogBuffer(LOG_LEVEL_DEBUG_MORE, buffer, (buffer[2]) ? buffer[2] +5 : sizeof(buffer)); if (error) { - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_DEBUG "PzemDc response error %d"), error); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "PzemDc response error %d"), error); } else { // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 // 01 04 10 05 40 00 0A 00 0D 00 00 00 02 00 00 00 00 00 00 D6 29 diff --git a/sonoff/xplg_wemohue.ino b/sonoff/xplg_wemohue.ino index ad3bdbef5..0dfcc2f5d 100644 --- a/sonoff/xplg_wemohue.ino +++ b/sonoff/xplg_wemohue.ino @@ -31,16 +31,21 @@ #include Ticker TickerMSearch; -bool udp_connected = false; - -char packet_buffer[UDP_BUFFER_SIZE]; // buffer to hold incoming UDP packet -IPAddress ipMulticast(239,255,255,250); // Simple Service Discovery Protocol (SSDP) -uint32_t port_multicast = 1900; // Multicast address and port - -bool udp_response_mutex = false; // M-Search response mutex to control re-entry IPAddress udp_remote_ip; // M-Search remote IP address uint16_t udp_remote_port; // M-Search remote port +bool udp_connected = false; +bool udp_response_mutex = false; // M-Search response mutex to control re-entry + +/*********************************************************************************************\ + * UPNP search targets +\*********************************************************************************************/ + +const char URN_BELKIN_DEVICE[] PROGMEM = "urn:belkin:device:**"; +const char UPNP_ROOTDEVICE[] PROGMEM = "upnp:rootdevice"; +const char SSDPSEARCH_ALL[] PROGMEM = "ssdpsearch:all"; +const char SSDP_ALL[] PROGMEM = "ssdp:all"; + /*********************************************************************************************\ * WeMo UPNP support routines \*********************************************************************************************/ @@ -50,12 +55,12 @@ const char WEMO_MSEARCH[] PROGMEM = "CACHE-CONTROL: max-age=86400\r\n" "DATE: Fri, 15 Apr 2016 04:56:29 GMT\r\n" "EXT:\r\n" - "LOCATION: http://{r1:80/setup.xml\r\n" + "LOCATION: http://%s:80/setup.xml\r\n" "OPT: \"http://schemas.upnp.org/upnp/1/0/\"; ns=01\r\n" "01-NLS: b9200ebb-736d-4b93-bf03-835149d13983\r\n" "SERVER: Unspecified, UPnP/1.0, Unspecified\r\n" - "ST: {r3\r\n" // type1 = urn:Belkin:device:**, type2 = upnp:rootdevice - "USN: uuid:{r2::{r3\r\n" // type1 = urn:Belkin:device:**, type2 = upnp:rootdevice + "ST: %s\r\n" // type1 = urn:Belkin:device:**, type2 = upnp:rootdevice + "USN: uuid:%s::%s\r\n" // type1 = urn:Belkin:device:**, type2 = upnp:rootdevice "X-User-Agent: redsonic\r\n" "\r\n"; @@ -81,23 +86,22 @@ void WemoRespondToMSearch(int echo_type) TickerMSearch.detach(); if (PortUdp.beginPacket(udp_remote_ip, udp_remote_port)) { - String response = FPSTR(WEMO_MSEARCH); - response.replace("{r1", WiFi.localIP().toString()); - response.replace("{r2", WemoUuid()); + char type[24]; if (1 == echo_type) { // type1 echo 1g & dot 2g - response.replace("{r3", F("urn:Belkin:device:**")); + strcpy_P(type, URN_BELKIN_DEVICE); } else { // type2 echo 2g (echo, plus, show) - response.replace("{r3", F("upnp:rootdevice")); + strcpy_P(type, UPNP_ROOTDEVICE); } - PortUdp.write(response.c_str()); + char response[400]; + snprintf_P(response, sizeof(response), WEMO_MSEARCH, WiFi.localIP().toString().c_str(), type, WemoUuid().c_str(), type); + PortUdp.write(response); PortUdp.endPacket(); snprintf_P(message, sizeof(message), PSTR(D_RESPONSE_SENT)); } else { snprintf_P(message, sizeof(message), PSTR(D_FAILED_TO_SEND_RESPONSE)); } - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_UPNP D_WEMO " " D_JSON_TYPE " %d, %s " D_TO " %s:%d"), + AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_UPNP D_WEMO " " D_JSON_TYPE " %d, %s " D_TO " %s:%d"), echo_type, message, udp_remote_ip.toString().c_str(), udp_remote_port); - AddLog(LOG_LEVEL_DEBUG); udp_response_mutex = false; } @@ -115,20 +119,20 @@ const char HUE_RESPONSE[] PROGMEM = "HOST: 239.255.255.250:1900\r\n" "CACHE-CONTROL: max-age=100\r\n" "EXT:\r\n" - "LOCATION: http://{r1:80/description.xml\r\n" + "LOCATION: http://%s:80/description.xml\r\n" "SERVER: Linux/3.14.0 UPnP/1.0 IpBridge/1.17.0\r\n" - "hue-bridgeid: {r2\r\n"; + "hue-bridgeid: %s\r\n"; const char HUE_ST1[] PROGMEM = "ST: upnp:rootdevice\r\n" - "USN: uuid:{r3::upnp:rootdevice\r\n" + "USN: uuid:%s::upnp:rootdevice\r\n" "\r\n"; const char HUE_ST2[] PROGMEM = - "ST: uuid:{r3\r\n" - "USN: uuid:{r3\r\n" + "ST: uuid:%s\r\n" + "USN: uuid:%s\r\n" "\r\n"; const char HUE_ST3[] PROGMEM = "ST: urn:schemas-upnp-org:device:basic:1\r\n" - "USN: uuid:{r3\r\n" + "USN: uuid:%s\r\n" "\r\n"; String HueBridgeId(void) @@ -160,35 +164,28 @@ void HueRespondToMSearch(void) TickerMSearch.detach(); if (PortUdp.beginPacket(udp_remote_ip, udp_remote_port)) { - String response1 = FPSTR(HUE_RESPONSE); - response1.replace("{r1", WiFi.localIP().toString()); - response1.replace("{r2", HueBridgeId()); + char response[320]; + snprintf_P(response, sizeof(response), HUE_RESPONSE, WiFi.localIP().toString().c_str(), HueBridgeId().c_str()); + int len = strlen(response); - String response = response1; - response += FPSTR(HUE_ST1); - response.replace("{r3", HueUuid()); - PortUdp.write(response.c_str()); + snprintf_P(response + len, sizeof(response) - len, HUE_ST1, HueUuid().c_str()); + PortUdp.write(response); PortUdp.endPacket(); - response = response1; - response += FPSTR(HUE_ST2); - response.replace("{r3", HueUuid()); - PortUdp.write(response.c_str()); + snprintf_P(response + len, sizeof(response) - len, HUE_ST2, HueUuid().c_str(), HueUuid().c_str()); + PortUdp.write(response); PortUdp.endPacket(); - response = response1; - response += FPSTR(HUE_ST3); - response.replace("{r3", HueUuid()); - PortUdp.write(response.c_str()); + snprintf_P(response + len, sizeof(response) - len, HUE_ST3, HueUuid().c_str()); + PortUdp.write(response); PortUdp.endPacket(); snprintf_P(message, sizeof(message), PSTR(D_3_RESPONSE_PACKETS_SENT)); } else { snprintf_P(message, sizeof(message), PSTR(D_FAILED_TO_SEND_RESPONSE)); } - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_UPNP D_HUE " %s " D_TO " %s:%d"), + AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_UPNP D_HUE " %s " D_TO " %s:%d"), message, udp_remote_ip.toString().c_str(), udp_remote_port); - AddLog(LOG_LEVEL_DEBUG); udp_response_mutex = false; } @@ -200,6 +197,7 @@ void HueRespondToMSearch(void) bool UdpDisconnect(void) { if (udp_connected) { + PortUdp.flush(); WiFiUDP::stopAll(); AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_UPNP D_MULTICAST_DISABLED)); udp_connected = false; @@ -210,7 +208,8 @@ bool UdpDisconnect(void) bool UdpConnect(void) { if (!udp_connected) { - if (PortUdp.beginMulticast(WiFi.localIP(), ipMulticast, port_multicast)) { + // Simple Service Discovery Protocol (SSDP) + if (PortUdp.beginMulticast(WiFi.localIP(), IPAddress(239,255,255,250), 1900)) { AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_UPNP D_MULTICAST_REJOINED)); udp_response_mutex = false; udp_connected = true; @@ -224,48 +223,53 @@ bool UdpConnect(void) void PollUdp(void) { - if (udp_connected && !udp_response_mutex) { + if (udp_connected) { if (PortUdp.parsePacket()) { + char packet_buffer[UDP_BUFFER_SIZE]; // buffer to hold incoming UDP/SSDP packet + int len = PortUdp.read(packet_buffer, UDP_BUFFER_SIZE -1); - if (len > 0) { - packet_buffer[len] = 0; - } - String request = packet_buffer; + packet_buffer[len] = 0; -// AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("UDP: Packet received")); -// AddLog_P(LOG_LEVEL_DEBUG_MORE, packet_buffer); + AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("UDP: Packet (%d)"), len); +// AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("\n%s"), packet_buffer); - if (request.indexOf("M-SEARCH") >= 0) { - request.toLowerCase(); - request.replace(" ", ""); - -// AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("UDP: M-SEARCH Packet received")); -// AddLog_P(LOG_LEVEL_DEBUG_MORE, request.c_str()); + if (devices_present && !udp_response_mutex && (strstr_P(packet_buffer, PSTR("M-SEARCH")) != nullptr)) { + udp_response_mutex = true; udp_remote_ip = PortUdp.remoteIP(); udp_remote_port = PortUdp.remotePort(); + +// AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("UDP: M-SEARCH Packet from %s:%d\n%s"), +// udp_remote_ip.toString().c_str(), udp_remote_port, packet_buffer); + + uint32_t response_delay = UDP_MSEARCH_SEND_DELAY + ((millis() &0x7) * 100); // 1500 - 2200 msec + + LowerCase(packet_buffer, packet_buffer); + RemoveSpace(packet_buffer); if (EMUL_WEMO == Settings.flag2.emulation) { - if (request.indexOf(F("urn:belkin:device:**")) > 0) { // type1 echo dot 2g, echo 1g's - udp_response_mutex = true; - TickerMSearch.attach_ms(UDP_MSEARCH_SEND_DELAY, WemoRespondToMSearch, 1); + if (strstr_P(packet_buffer, URN_BELKIN_DEVICE) != nullptr) { // type1 echo dot 2g, echo 1g's + TickerMSearch.attach_ms(response_delay, WemoRespondToMSearch, 1); + return; } - else if ((request.indexOf(F("upnp:rootdevice")) > 0) || // type2 Echo 2g (echo & echo plus) - (request.indexOf(F("ssdpsearch:all")) > 0) || - (request.indexOf(F("ssdp:all")) > 0)) { - udp_response_mutex = true; - TickerMSearch.attach_ms(UDP_MSEARCH_SEND_DELAY, WemoRespondToMSearch, 2); + else if ((strstr_P(packet_buffer, UPNP_ROOTDEVICE) != nullptr) || // type2 Echo 2g (echo & echo plus) + (strstr_P(packet_buffer, SSDPSEARCH_ALL) != nullptr) || + (strstr_P(packet_buffer, SSDP_ALL) != nullptr)) { + TickerMSearch.attach_ms(response_delay, WemoRespondToMSearch, 2); + return; + } + } else { + if ((strstr_P(packet_buffer, PSTR(":device:basic:1")) != nullptr) || + (strstr_P(packet_buffer, UPNP_ROOTDEVICE) != nullptr) || + (strstr_P(packet_buffer, SSDPSEARCH_ALL) != nullptr) || + (strstr_P(packet_buffer, SSDP_ALL) != nullptr)) { + TickerMSearch.attach_ms(response_delay, HueRespondToMSearch); + return; } } - else if ((EMUL_HUE == Settings.flag2.emulation) && - ((request.indexOf(F("urn:schemas-upnp-org:device:basic:1")) > 0) || - (request.indexOf(F("upnp:rootdevice")) > 0) || - (request.indexOf(F("ssdpsearch:all")) > 0) || - (request.indexOf(F("ssdp:all")) > 0))) { - udp_response_mutex = true; - TickerMSearch.attach_ms(UDP_MSEARCH_SEND_DELAY, HueRespondToMSearch); - } + udp_response_mutex = false; } } + delay(1); } } @@ -342,9 +346,9 @@ const char WEMO_METASERVICE_XML[] PROGMEM = const char WEMO_RESPONSE_STATE_SOAP[] PROGMEM = "" "" - "" - "{x1" - "" + "" + "%d" + "" "" "\r\n"; @@ -385,15 +389,20 @@ void HandleUpnpEvent(void) { AddLog_P(LOG_LEVEL_DEBUG, S_LOG_HTTP, PSTR(D_WEMO_BASIC_EVENT)); - String request = WebServer->arg(0); - String state_xml = FPSTR(WEMO_RESPONSE_STATE_SOAP); + char event[500]; + strlcpy(event, WebServer->arg(0).c_str(), sizeof(event)); + +// AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("\n%s"), event); + //differentiate get and set state - if (request.indexOf(F("SetBinaryState")) > 0) { + char state = 'G'; + if (strstr_P(event, PSTR("SetBinaryState")) != nullptr) { + state = 'S'; uint8_t power = POWER_TOGGLE; - if (request.indexOf(F("State>1 0) { + if (strstr_P(event, PSTR("State>10 0) { + else if (strstr_P(event, PSTR("State>0 0){ - state_xml.replace(F("Set"), F("Get")); - } - state_xml.replace("{x1", String(bitRead(power, devices_present -1))); - WebServer->send(200, FPSTR(HDR_CTYPE_XML), state_xml); + + snprintf_P(event, sizeof(event), WEMO_RESPONSE_STATE_SOAP, state, bitRead(power, devices_present -1), state); + WSSend(200, CT_XML, event); } void HandleUpnpService(void) { AddLog_P(LOG_LEVEL_DEBUG, S_LOG_HTTP, PSTR(D_WEMO_EVENT_SERVICE)); - WebServer->send(200, FPSTR(HDR_CTYPE_PLAIN), FPSTR(WEMO_EVENTSERVICE_XML)); + WSSend(200, CT_PLAIN, FPSTR(WEMO_EVENTSERVICE_XML)); } void HandleUpnpMetaService(void) { AddLog_P(LOG_LEVEL_DEBUG, S_LOG_HTTP, PSTR(D_WEMO_META_SERVICE)); - WebServer->send(200, FPSTR(HDR_CTYPE_PLAIN), FPSTR(WEMO_METASERVICE_XML)); + WSSend(200, CT_PLAIN, FPSTR(WEMO_METASERVICE_XML)); } void HandleUpnpSetupWemo(void) @@ -430,7 +437,7 @@ void HandleUpnpSetupWemo(void) setup_xml.replace("{x1", Settings.friendlyname[0]); setup_xml.replace("{x2", WemoUuid()); setup_xml.replace("{x3", WemoSerialnumber()); - WebServer->send(200, FPSTR(HDR_CTYPE_XML), setup_xml); + WSSend(200, CT_XML, setup_xml); } /*********************************************************************************************\ @@ -532,15 +539,14 @@ void HandleUpnpSetupHue(void) description_xml.replace("{x1", WiFi.localIP().toString()); description_xml.replace("{x2", HueUuid()); description_xml.replace("{x3", HueSerialnumber()); - WebServer->send(200, FPSTR(HDR_CTYPE_XML), description_xml); + WSSend(200, CT_XML, description_xml); } void HueNotImplemented(String *path) { - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_HTTP D_HUE_API_NOT_IMPLEMENTED " (%s)"), path->c_str()); - AddLog(LOG_LEVEL_DEBUG_MORE); + AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_HTTP D_HUE_API_NOT_IMPLEMENTED " (%s)"), path->c_str()); - WebServer->send(200, FPSTR(HDR_CTYPE_JSON), "{}"); + WSSend(200, CT_JSON, "{}"); } void HueConfigResponse(String *response) @@ -559,7 +565,7 @@ void HueConfig(String *path) { String response = ""; HueConfigResponse(&response); - WebServer->send(200, FPSTR(HDR_CTYPE_JSON), response); + WSSend(200, CT_JSON, response); } bool g_gotct = false; @@ -610,7 +616,7 @@ void HueGlobalConfig(String *path) response += F("},\"groups\":{},\"schedules\":{},\"config\":"); HueConfigResponse(&response); response += "}"; - WebServer->send(200, FPSTR(HDR_CTYPE_JSON), response); + WSSend(200, CT_JSON, response); } void HueAuthentication(String *path) @@ -618,7 +624,7 @@ void HueAuthentication(String *path) char response[38]; snprintf_P(response, sizeof(response), PSTR("[{\"success\":{\"username\":\"%s\"}}]"), GetHueUserId().c_str()); - WebServer->send(200, FPSTR(HDR_CTYPE_JSON), response); + WSSend(200, CT_JSON, response); } void HueLights(String *path) @@ -627,15 +633,16 @@ void HueLights(String *path) * http://sonoff/api/username/lights/1/state?1={"on":true,"hue":56100,"sat":254,"bri":254,"alert":"none","transitiontime":40} */ String response; - uint8_t device = 1; - uint16_t tmp = 0; + int code = 200; float bri = 0; float hue = 0; float sat = 0; + uint16_t tmp = 0; uint16_t ct = 0; bool resp = false; bool on = false; bool change = false; + uint8_t device = 1; uint8_t maxhue = (devices_present > MAX_FRIENDLYNAMES) ? MAX_FRIENDLYNAMES : devices_present; path->remove(0,path->indexOf("/lights")); // Remove until /lights @@ -651,7 +658,6 @@ void HueLights(String *path) } } response += "}"; - WebServer->send(200, FPSTR(HDR_CTYPE_JSON), response); } else if (path->endsWith("/state")) { // Got ID/state path->remove(0,8); // Remove /lights/ @@ -761,8 +767,6 @@ void HueLights(String *path) else { response = FPSTR(HUE_ERROR_JSON); } - - WebServer->send(200, FPSTR(HDR_CTYPE_JSON), response); } else if(path->indexOf("/lights/") >= 0) { // Got /lights/ID path->remove(0,8); // Remove /lights/ @@ -773,11 +777,12 @@ void HueLights(String *path) response += F("{\"state\":"); HueLightStatus1(device, &response); HueLightStatus2(device, &response); - WebServer->send(200, FPSTR(HDR_CTYPE_JSON), response); } else { - WebServer->send(406, FPSTR(HDR_CTYPE_JSON), "{}"); + response = "{}"; + code = 406; } + WSSend(code, CT_JSON, response); } void HueGroups(String *path) @@ -799,7 +804,7 @@ void HueGroups(String *path) response += F("}"); } - WebServer->send(200, FPSTR(HDR_CTYPE_JSON), response); + WSSend(200, CT_JSON, response); } void HandleHueApi(String *path) @@ -820,12 +825,10 @@ void HandleHueApi(String *path) path->remove(0, 4); // remove /api uint16_t apilen = path->length(); - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_HTTP D_HUE_API " (%s)"), path->c_str()); - AddLog(LOG_LEVEL_DEBUG_MORE); // HTP: Hue API (//lights/1/state) + AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_HTTP D_HUE_API " (%s)"), path->c_str()); // HTP: Hue API (//lights/1/state for (args = 0; args < WebServer->args(); args++) { String json = WebServer->arg(args); - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_HTTP D_HUE_POST_ARGS " (%s)"), json.c_str()); - AddLog(LOG_LEVEL_DEBUG_MORE); // HTP: Hue POST args ({"on":false}) + AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_HTTP D_HUE_POST_ARGS " (%s)"), json.c_str()); // HTP: Hue POST args ({"on":false}) } if (path->endsWith("/invalid/")) {} // Just ignore @@ -843,14 +846,16 @@ void HandleHueApi(String *path) void HueWemoAddHandlers(void) { - if (EMUL_WEMO == Settings.flag2.emulation) { - WebServer->on("/upnp/control/basicevent1", HTTP_POST, HandleUpnpEvent); - WebServer->on("/eventservice.xml", HandleUpnpService); - WebServer->on("/metainfoservice.xml", HandleUpnpMetaService); - WebServer->on("/setup.xml", HandleUpnpSetupWemo); - } - if (EMUL_HUE == Settings.flag2.emulation) { - WebServer->on("/description.xml", HandleUpnpSetupHue); + if (devices_present) { + if (EMUL_WEMO == Settings.flag2.emulation) { + WebServer->on("/upnp/control/basicevent1", HTTP_POST, HandleUpnpEvent); + WebServer->on("/eventservice.xml", HandleUpnpService); + WebServer->on("/metainfoservice.xml", HandleUpnpMetaService); + WebServer->on("/setup.xml", HandleUpnpSetupWemo); + } + if (EMUL_HUE == Settings.flag2.emulation) { + WebServer->on("/description.xml", HandleUpnpSetupHue); + } } } diff --git a/sonoff/xplg_ws2812.ino b/sonoff/xplg_ws2812.ino index ab4ba1c35..70eb005fa 100644 --- a/sonoff/xplg_ws2812.ino +++ b/sonoff/xplg_ws2812.ino @@ -24,35 +24,27 @@ #include +#if (USE_WS2812_CTYPE == NEO_GRB) + typedef NeoGrbFeature selectedNeoFeatureType; +#elif (USE_WS2812_CTYPE == NEO_BRG) + typedef NeoBrgFeature selectedNeoFeatureType; +#elif (USE_WS2812_CTYPE == NEO_RBG) + typedef NeoRbgFeature selectedNeoFeatureType; +#elif (USE_WS2812_CTYPE == NEO_RGBW) + typedef NeoRgbwFeature selectedNeoFeatureType; +#elif (USE_WS2812_CTYPE == NEO_GRBW) + typedef NeoGrbwFeature selectedNeoFeatureType; +#else // USE_WS2812_CTYPE + typedef NeoRgbFeature selectedNeoFeatureType; +#endif // USE_WS2812_CTYPE + + #ifdef USE_WS2812_DMA -#if (USE_WS2812_CTYPE == NEO_GRB) - NeoPixelBus *strip = NULL; -#elif (USE_WS2812_CTYPE == NEO_BRG) - NeoPixelBus *strip = NULL; -#elif (USE_WS2812_CTYPE == NEO_RBG) - NeoPixelBus *strip = NULL; -#elif (USE_WS2812_CTYPE == NEO_RGBW) - NeoPixelBus *strip = NULL; -#elif (USE_WS2812_CTYPE == NEO_GRBW) - NeoPixelBus *strip = NULL; -#else // USE_WS2812_CTYPE - NeoPixelBus *strip = NULL; -#endif // USE_WS2812_CTYPE + typedef Neo800KbpsMethod selectedNeoSpeedType; #else // USE_WS2812_DMA -#if (USE_WS2812_CTYPE == NEO_GRB) - NeoPixelBus *strip = NULL; -#elif (USE_WS2812_CTYPE == NEO_BRG) - NeoPixelBus *strip = NULL; -#elif (USE_WS2812_CTYPE == NEO_RBG) - NeoPixelBus *strip = NULL; -#elif (USE_WS2812_CTYPE == NEO_RGBW) - NeoPixelBus *strip = NULL; -#elif (USE_WS2812_CTYPE == NEO_GRBW) - NeoPixelBus *strip = NULL; -#else // USE_WS2812_CTYPE - NeoPixelBus *strip = NULL; -#endif // USE_WS2812_CTYPE + typedef NeoEsp8266BitBang800KbpsMethod selectedNeoSpeedType; #endif // USE_WS2812_DMA + NeoPixelBus *strip = nullptr; struct WsColor { uint8_t red, green, blue; @@ -170,7 +162,7 @@ void Ws2812Clock(void) Ws2812UpdateHand((RtcTime.second * 1000) / clksize, WS_SECOND); Ws2812UpdateHand((RtcTime.minute * 1000) / clksize, WS_MINUTE); - Ws2812UpdateHand(((RtcTime.hour % 12) * (5000 / clksize)) + ((RtcTime.minute * 1000) / (12 * clksize)), WS_HOUR); + Ws2812UpdateHand((((RtcTime.hour % 12) * 5000) + ((RtcTime.minute * 1000) / 12 )) / clksize, WS_HOUR); if (Settings.ws_color[WS_MARKER][WS_RED] + Settings.ws_color[WS_MARKER][WS_GREEN] + Settings.ws_color[WS_MARKER][WS_BLUE]) { for (uint8_t i = 0; i < 12; i++) { Ws2812UpdateHand((i * 5000) / clksize, WS_MARKER); @@ -305,33 +297,9 @@ void Ws2812Bars(uint8_t schemenr) void Ws2812Init(void) { #ifdef USE_WS2812_DMA -#if (USE_WS2812_CTYPE == NEO_GRB) - strip = new NeoPixelBus(WS2812_MAX_LEDS); // For Esp8266, the Pin is omitted and it uses GPIO3 due to DMA hardware use. -#elif (USE_WS2812_CTYPE == NEO_BRG) - strip = new NeoPixelBus(WS2812_MAX_LEDS); // For Esp8266, the Pin is omitted and it uses GPIO3 due to DMA hardware use. -#elif (USE_WS2812_CTYPE == NEO_RBG) - strip = new NeoPixelBus(WS2812_MAX_LEDS); // For Esp8266, the Pin is omitted and it uses GPIO3 due to DMA hardware use. -#elif (USE_WS2812_CTYPE == NEO_RGBW) - strip = new NeoPixelBus(WS2812_MAX_LEDS); // For Esp8266, the Pin is omitted and it uses GPIO3 due to DMA hardware use. -#elif (USE_WS2812_CTYPE == NEO_GRBW) - strip = new NeoPixelBus(WS2812_MAX_LEDS); // For Esp8266, the Pin is omitted and it uses GPIO3 due to DMA hardware use. -#else // USE_WS2812_CTYPE - strip = new NeoPixelBus(WS2812_MAX_LEDS); // For Esp8266, the Pin is omitted and it uses GPIO3 due to DMA hardware use. -#endif // USE_WS2812_CTYPE + strip = new NeoPixelBus(WS2812_MAX_LEDS); // For Esp8266, the Pin is omitted and it uses GPIO3 due to DMA hardware use. #else // USE_WS2812_DMA -#if (USE_WS2812_CTYPE == NEO_GRB) - strip = new NeoPixelBus(WS2812_MAX_LEDS, pin[GPIO_WS2812]); -#elif (USE_WS2812_CTYPE == NEO_BRG) - strip = new NeoPixelBus(WS2812_MAX_LEDS, pin[GPIO_WS2812]); -#elif (USE_WS2812_CTYPE == NEO_RBG) - strip = new NeoPixelBus(WS2812_MAX_LEDS, pin[GPIO_WS2812]); -#elif (USE_WS2812_CTYPE == NEO_RGBW) - strip = new NeoPixelBus(WS2812_MAX_LEDS, pin[GPIO_WS2812]); -#elif (USE_WS2812_CTYPE == NEO_GRBW) - strip = new NeoPixelBus(WS2812_MAX_LEDS, pin[GPIO_WS2812]); -#else // USE_WS2812_CTYPE - strip = new NeoPixelBus(WS2812_MAX_LEDS, pin[GPIO_WS2812]); -#endif // USE_WS2812_CTYPE + strip = new NeoPixelBus(WS2812_MAX_LEDS, pin[GPIO_WS2812]); #endif // USE_WS2812_DMA strip->Begin(); Ws2812Clear(); diff --git a/sonoff/xsns_01_counter.ino b/sonoff/xsns_01_counter.ino index d62885cc5..eadd9a4b9 100644 --- a/sonoff/xsns_01_counter.ino +++ b/sonoff/xsns_01_counter.ino @@ -36,8 +36,7 @@ void CounterUpdate(uint8_t index) RtcSettings.pulse_counter[index -1]++; } -// snprintf_P(log_data, sizeof(log_data), PSTR("CNTR: Interrupt %d"), index); -// AddLog(LOG_LEVEL_DEBUG); +// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("CNTR: Interrupt %d"), index); } } @@ -87,7 +86,7 @@ void CounterInit(void) #ifdef USE_WEBSERVER const char HTTP_SNS_COUNTER[] PROGMEM = - "%s{s}" D_COUNTER "%d{m}%s%s{e}"; // {s} = , {m} = , {e} = + "{s}" D_COUNTER "%d{m}%s%s{e}"; // {s} = , {m} = , {e} = #endif // USE_WEBSERVER void CounterShow(bool json) @@ -103,16 +102,16 @@ void CounterShow(bool json) dtostrfd((double)RtcSettings.pulse_counter[i] / 1000000, 6, counter); } else { dsxflg++; - dtostrfd(RtcSettings.pulse_counter[i], 0, counter); + snprintf_P(counter, sizeof(counter), PSTR("%lu"), RtcSettings.pulse_counter[i]); } if (json) { if (!header) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"COUNTER\":{"), mqtt_data); + ResponseAppend_P(PSTR(",\"COUNTER\":{")); stemp[0] = '\0'; } header++; - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s%s\"C%d\":%s"), mqtt_data, stemp, i +1, counter); + ResponseAppend_P(PSTR("%s\"C%d\":%s"), stemp, i +1, counter); strlcpy(stemp, ",", sizeof(stemp)); #ifdef USE_DOMOTICZ if ((0 == tele_period) && (1 == dsxflg)) { @@ -122,7 +121,7 @@ void CounterShow(bool json) #endif // USE_DOMOTICZ #ifdef USE_WEBSERVER } else { - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_COUNTER, mqtt_data, i +1, counter, (bitRead(Settings.pulse_counter_type, i)) ? " " D_UNIT_SECOND : ""); + WSContentSend_PD(HTTP_SNS_COUNTER, i +1, counter, (bitRead(Settings.pulse_counter_type, i)) ? " " D_UNIT_SECOND : ""); #endif // USE_WEBSERVER } } @@ -132,7 +131,7 @@ void CounterShow(bool json) } if (json) { if (header) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s}"), mqtt_data); + ResponseAppend_P(PSTR("}")); } } } @@ -153,7 +152,7 @@ bool Xsns01(uint8_t function) CounterShow(1); break; #ifdef USE_WEBSERVER - case FUNC_WEB_APPEND: + case FUNC_WEB_SENSOR: CounterShow(0); break; #endif // USE_WEBSERVER diff --git a/sonoff/xsns_02_analog.ino b/sonoff/xsns_02_analog.ino index e75160697..9c6c5074e 100644 --- a/sonoff/xsns_02_analog.ino +++ b/sonoff/xsns_02_analog.ino @@ -44,7 +44,7 @@ void AdcEvery250ms(void) if ((new_value < adc_last_value -10) || (new_value > adc_last_value +10)) { adc_last_value = new_value; uint16_t value = adc_last_value / 10; - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"ANALOG\":{\"A0div10\":%d}}"), (value > 99) ? 100 : value); + Response_P(PSTR("{\"ANALOG\":{\"A0div10\":%d}}"), (value > 99) ? 100 : value); XdrvRulesProcess(); } } @@ -55,10 +55,10 @@ void AdcShow(bool json) uint16_t analog = AdcRead(); if (json) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"ANALOG\":{\"A0\":%d}"), mqtt_data, analog); + ResponseAppend_P(PSTR(",\"ANALOG\":{\"A0\":%d}"), analog); #ifdef USE_WEBSERVER } else { - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_ANALOG, mqtt_data, "", 0, analog); + WSContentSend_PD(HTTP_SNS_ANALOG, "", 0, analog); #endif // USE_WEBSERVER } } @@ -82,7 +82,7 @@ bool Xsns02(uint8_t function) AdcShow(1); break; #ifdef USE_WEBSERVER - case FUNC_WEB_APPEND: + case FUNC_WEB_SENSOR: AdcShow(0); break; #endif // USE_WEBSERVER diff --git a/sonoff/xsns_04_snfsc.ino b/sonoff/xsns_04_snfsc.ino index 4d881bd01..54611fd0d 100644 --- a/sonoff/xsns_04_snfsc.ino +++ b/sonoff/xsns_04_snfsc.ino @@ -61,8 +61,7 @@ void SonoffScSend(const char *data) { Serial.write(data); Serial.write('\x1B'); - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_SERIAL D_TRANSMIT " %s"), data); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_SERIAL D_TRANSMIT " %s"), data); } void SonoffScInit(void) @@ -78,12 +77,11 @@ void SonoffScSerialInput(char *rcvstat) char *str; uint16_t value[5] = { 0 }; - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_SERIAL D_RECEIVED " %s"), rcvstat); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_SERIAL D_RECEIVED " %s"), rcvstat); if (!strncasecmp_P(rcvstat, PSTR("AT+UPDATE="), 10)) { int8_t i = -1; - for (str = strtok_r(rcvstat, ":", &p); str && i < 5; str = strtok_r(NULL, ":", &p)) { + for (str = strtok_r(rcvstat, ":", &p); str && i < 5; str = strtok_r(nullptr, ":", &p)) { value[i++] = atoi(str); } if (value[0] > 0) { @@ -107,7 +105,7 @@ void SonoffScSerialInput(char *rcvstat) #ifdef USE_WEBSERVER const char HTTP_SNS_SCPLUS[] PROGMEM = - "%s{s}" D_LIGHT "{m}%d%%{e}{s}" D_NOISE "{m}%d%%{e}{s}" D_AIR_QUALITY "{m}%d%%{e}"; // {s} = , {m} = , {e} = + "{s}" D_LIGHT "{m}%d%%{e}{s}" D_NOISE "{m}%d%%{e}{s}" D_AIR_QUALITY "{m}%d%%{e}"; // {s} = , {m} = , {e} = #endif // USE_WEBSERVER void SonoffScShow(bool json) @@ -122,8 +120,8 @@ void SonoffScShow(bool json) dtostrfd(h, Settings.flag2.humidity_resolution, humidity); if (json) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"SonoffSC\":{\"" D_JSON_TEMPERATURE "\":%s,\"" D_JSON_HUMIDITY "\":%s,\"" D_JSON_LIGHT "\":%d,\"" D_JSON_NOISE "\":%d,\"" D_JSON_AIRQUALITY "\":%d}"), - mqtt_data, temperature, humidity, sc_value[2], sc_value[3], sc_value[4]); + ResponseAppend_P(PSTR(",\"SonoffSC\":{\"" D_JSON_TEMPERATURE "\":%s,\"" D_JSON_HUMIDITY "\":%s,\"" D_JSON_LIGHT "\":%d,\"" D_JSON_NOISE "\":%d,\"" D_JSON_AIRQUALITY "\":%d}"), + temperature, humidity, sc_value[2], sc_value[3], sc_value[4]); #ifdef USE_DOMOTICZ if (0 == tele_period) { DomoticzTempHumSensor(temperature, humidity); @@ -142,9 +140,9 @@ void SonoffScShow(bool json) #ifdef USE_WEBSERVER } else { - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_TEMP, mqtt_data, "", temperature, TempUnit()); - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_HUM, mqtt_data, "", humidity); - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_SCPLUS, mqtt_data, sc_value[2], sc_value[3], sc_value[4]); + WSContentSend_PD(HTTP_SNS_TEMP, "", temperature, TempUnit()); + WSContentSend_PD(HTTP_SNS_HUM, "", humidity); + WSContentSend_PD(HTTP_SNS_SCPLUS, sc_value[2], sc_value[3], sc_value[4]); #endif // USE_WEBSERVER } } @@ -167,7 +165,7 @@ bool Xsns04(uint8_t function) SonoffScShow(1); break; #ifdef USE_WEBSERVER - case FUNC_WEB_APPEND: + case FUNC_WEB_SENSOR: SonoffScShow(0); break; #endif // USE_WEBSERVER diff --git a/sonoff/xsns_05_ds18b20.ino b/sonoff/xsns_05_ds18b20.ino index f5d4bd03d..d68664570 100644 --- a/sonoff/xsns_05_ds18b20.ino +++ b/sonoff/xsns_05_ds18b20.ino @@ -205,7 +205,7 @@ void Ds18b20Show(bool json) char temperature[33]; dtostrfd(ds18b20_temperature, Settings.flag2.temperature_resolution, temperature); if(json) { - snprintf_P(mqtt_data, sizeof(mqtt_data), JSON_SNS_TEMP, mqtt_data, ds18b20_types, temperature); + ResponseAppend_P(JSON_SNS_TEMP, ds18b20_types, temperature); #ifdef USE_DOMOTICZ if (0 == tele_period) { DomoticzSensor(DZ_TEMP, temperature); @@ -218,7 +218,7 @@ void Ds18b20Show(bool json) #endif // USE_KNX #ifdef USE_WEBSERVER } else { - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_TEMP, mqtt_data, ds18b20_types, temperature, TempUnit()); + WSContentSend_PD(HTTP_SNS_TEMP, ds18b20_types, temperature, TempUnit()); #endif // USE_WEBSERVER } } @@ -241,7 +241,7 @@ bool Xsns05(uint8_t function) Ds18b20Show(1); break; #ifdef USE_WEBSERVER - case FUNC_WEB_APPEND: + case FUNC_WEB_SENSOR: Ds18b20Show(0); break; #endif // USE_WEBSERVER diff --git a/sonoff/xsns_05_ds18x20.ino b/sonoff/xsns_05_ds18x20.ino index d8cbd7189..7a67f80a9 100644 --- a/sonoff/xsns_05_ds18x20.ino +++ b/sonoff/xsns_05_ds18x20.ino @@ -287,8 +287,7 @@ void Ds18x20Init(void) } } } - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_DSB D_SENSORS_FOUND " %d"), ds18x20_sensors); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_DSB D_SENSORS_FOUND " %d"), ds18x20_sensors); } void Ds18x20Convert(void) @@ -310,9 +309,6 @@ bool Ds18x20Read(uint8_t sensor) { uint8_t data[9]; int8_t sign = 1; - uint16_t temp12 = 0; - int16_t temp14 = 0; - float temp9 = 0.0; uint8_t index = ds18x20_sensor[sensor].index; if (ds18x20_sensor[index].valid) { ds18x20_sensor[index].valid--; } @@ -325,48 +321,47 @@ bool Ds18x20Read(uint8_t sensor) } if (OneWireCrc8(data)) { switch(ds18x20_sensor[index].address[0]) { - case DS18S20_CHIPID: - if (data[1] > 0x80) { - data[0] = (~data[0]) +1; - sign = -1; // App-Note fix possible sign error + case DS18S20_CHIPID: { + if (data[1] > 0x80) { + data[0] = (~data[0]) +1; + sign = -1; // App-Note fix possible sign error + } + float temp9 = (float)(data[0] >> 1) * sign; + ds18x20_sensor[index].temperature = ConvertTemp((temp9 - 0.25) + ((16.0 - data[6]) / 16.0)); + ds18x20_sensor[index].valid = SENSOR_MAX_MISS; + return true; } - if (data[0] & 1) { - temp9 = ((data[0] >> 1) + 0.5) * sign; - } else { - temp9 = (data[0] >> 1) * sign; - } - ds18x20_sensor[index].temperature = ConvertTemp((temp9 - 0.25) + ((16.0 - data[6]) / 16.0)); - ds18x20_sensor[index].valid = SENSOR_MAX_MISS; - return true; - case DS1822_CHIPID: - case DS18B20_CHIPID: - if (data[4] != 0x7F) { - data[4] = 0x7F; // Set resolution to 12-bit - OneWireReset(); - OneWireSelect(ds18x20_sensor[index].address); - OneWireWrite(W1_WRITE_SCRATCHPAD); - OneWireWrite(data[2]); // Th Register - OneWireWrite(data[3]); // Tl Register - OneWireWrite(data[4]); // Configuration Register - OneWireSelect(ds18x20_sensor[index].address); - OneWireWrite(W1_WRITE_EEPROM); // Save scratchpad to EEPROM + case DS1822_CHIPID: + case DS18B20_CHIPID: { + if (data[4] != 0x7F) { + data[4] = 0x7F; // Set resolution to 12-bit + OneWireReset(); + OneWireSelect(ds18x20_sensor[index].address); + OneWireWrite(W1_WRITE_SCRATCHPAD); + OneWireWrite(data[2]); // Th Register + OneWireWrite(data[3]); // Tl Register + OneWireWrite(data[4]); // Configuration Register + OneWireSelect(ds18x20_sensor[index].address); + OneWireWrite(W1_WRITE_EEPROM); // Save scratchpad to EEPROM #ifdef W1_PARASITE_POWER - w1_power_until = millis() + 10; // 10ms specified duration for EEPROM write + w1_power_until = millis() + 10; // 10ms specified duration for EEPROM write #endif + } + uint16_t temp12 = (data[1] << 8) + data[0]; + if (temp12 > 2047) { + temp12 = (~temp12) +1; + sign = -1; + } + ds18x20_sensor[index].temperature = ConvertTemp(sign * temp12 * 0.0625); // Divide by 16 + ds18x20_sensor[index].valid = SENSOR_MAX_MISS; + return true; } - temp12 = (data[1] << 8) + data[0]; - if (temp12 > 2047) { - temp12 = (~temp12) +1; - sign = -1; + case MAX31850_CHIPID: { + int16_t temp14 = (data[1] << 8) + (data[0] & 0xFC); + ds18x20_sensor[index].temperature = ConvertTemp(temp14 * 0.0625); // Divide by 16 + ds18x20_sensor[index].valid = SENSOR_MAX_MISS; + return true; } - ds18x20_sensor[index].temperature = ConvertTemp(sign * temp12 * 0.0625); // Divide by 16 - ds18x20_sensor[index].valid = SENSOR_MAX_MISS; - return true; - case MAX31850_CHIPID: - temp14 = (data[1] << 8) + (data[0] & 0xFC); - ds18x20_sensor[index].temperature = ConvertTemp(temp14 * 0.0625); // Divide by 16 - ds18x20_sensor[index].valid = SENSOR_MAX_MISS; - return true; } } } @@ -437,13 +432,13 @@ void Ds18x20Show(bool json) if (json) { if (1 == ds18x20_sensors) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"%s\":{\"" D_JSON_TEMPERATURE "\":%s}"), mqtt_data, ds18x20_types, temperature); + ResponseAppend_P(PSTR(",\"%s\":{\"" D_JSON_TEMPERATURE "\":%s}"), ds18x20_types, temperature); } else { char address[17]; for (uint8_t j = 0; j < 6; j++) { sprintf(address+2*j, "%02X", ds18x20_sensor[index].address[6-j]); // Skip sensor type and crc } - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"%s\":{\"" D_JSON_ID "\":\"%s\",\"" D_JSON_TEMPERATURE "\":%s}"), mqtt_data, ds18x20_types, address, temperature); + ResponseAppend_P(PSTR(",\"%s\":{\"" D_JSON_ID "\":\"%s\",\"" D_JSON_TEMPERATURE "\":%s}"), ds18x20_types, address, temperature); } #ifdef USE_DOMOTICZ if ((0 == tele_period) && (0 == i)) { @@ -457,7 +452,7 @@ void Ds18x20Show(bool json) #endif // USE_KNX #ifdef USE_WEBSERVER } else { - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_TEMP, mqtt_data, ds18x20_types, temperature, TempUnit()); + WSContentSend_PD(HTTP_SNS_TEMP, ds18x20_types, temperature, TempUnit()); #endif // USE_WEBSERVER } } @@ -484,7 +479,7 @@ bool Xsns05(uint8_t function) Ds18x20Show(1); break; #ifdef USE_WEBSERVER - case FUNC_WEB_APPEND: + case FUNC_WEB_SENSOR: Ds18x20Show(0); break; #endif // USE_WEBSERVER diff --git a/sonoff/xsns_05_ds18x20_legacy.ino b/sonoff/xsns_05_ds18x20_legacy.ino index 3f6474044..f02ee9e12 100644 --- a/sonoff/xsns_05_ds18x20_legacy.ino +++ b/sonoff/xsns_05_ds18x20_legacy.ino @@ -36,7 +36,7 @@ #include -OneWire *ds = NULL; +OneWire *ds = nullptr; uint8_t ds18x20_address[DS18X20_MAX_SENSORS][8]; uint8_t ds18x20_index[DS18X20_MAX_SENSORS]; @@ -126,11 +126,7 @@ bool Ds18x20Read(uint8_t sensor, float &t) data[0] = (~data[0]) +1; sign = -1; // App-Note fix possible sign error } - if (data[0] & 1) { - temp9 = ((data[0] >> 1) + 0.5) * sign; - } else { - temp9 = (data[0] >> 1) * sign; - } + temp9 = (float)(data[0] >> 1) * sign; t = ConvertTemp((temp9 - 0.25) + ((16.0 - data[6]) / 16.0)); break; case DS18B20_CHIPID: @@ -182,12 +178,12 @@ void Ds18x20Show(bool json) if (json) { if (!dsxflg) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"DS18x20\":{"), mqtt_data); + ResponseAppend_P(PSTR(",\"DS18x20\":{")); stemp[0] = '\0'; } dsxflg++; - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s%s\"DS%d\":{\"" D_JSON_TYPE "\":\"%s\",\"" D_JSON_ADDRESS "\":\"%s\",\"" D_JSON_TEMPERATURE "\":%s}"), - mqtt_data, stemp, i +1, ds18x20_types, Ds18x20Addresses(i).c_str(), temperature); + ResponseAppend_P(PSTR("%s\"DS%d\":{\"" D_JSON_TYPE "\":\"%s\",\"" D_JSON_ADDRESS "\":\"%s\",\"" D_JSON_TEMPERATURE "\":%s}"), + stemp, i +1, ds18x20_types, Ds18x20Addresses(i).c_str(), temperature); strlcpy(stemp, ",", sizeof(stemp)); #ifdef USE_DOMOTICZ if ((0 == tele_period) && (1 == dsxflg)) { @@ -202,14 +198,14 @@ void Ds18x20Show(bool json) #ifdef USE_WEBSERVER } else { snprintf_P(stemp, sizeof(stemp), PSTR("%s-%d"), ds18x20_types, i +1); - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_TEMP, mqtt_data, stemp, temperature, TempUnit()); + WSContentSend_PD(HTTP_SNS_TEMP, stemp, temperature, TempUnit()); #endif // USE_WEBSERVER } } } if (json) { if (dsxflg) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s}"), mqtt_data); + ResponseAppend_P(PSTR("}")); } } Ds18x20Search(); // Check for changes in sensors number @@ -237,7 +233,7 @@ bool Xsns05(uint8_t function) Ds18x20Show(1); break; #ifdef USE_WEBSERVER - case FUNC_WEB_APPEND: + case FUNC_WEB_SENSOR: Ds18x20Show(0); break; #endif // USE_WEBSERVER diff --git a/sonoff/xsns_06_dht.ino b/sonoff/xsns_06_dht.ino index 47993bea9..00bbf7f15 100644 --- a/sonoff/xsns_06_dht.ino +++ b/sonoff/xsns_06_dht.ino @@ -125,9 +125,8 @@ bool DhtRead(uint8_t sensor) uint8_t checksum = (dht_data[0] + dht_data[1] + dht_data[2] + dht_data[3]) & 0xFF; if (dht_data[4] != checksum) { - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_DHT D_CHECKSUM_FAILURE " %02X, %02X, %02X, %02X, %02X =? %02X"), + AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_DHT D_CHECKSUM_FAILURE " %02X, %02X, %02X, %02X, %02X =? %02X"), dht_data[0], dht_data[1], dht_data[2], dht_data[3], dht_data[4], checksum); - AddLog(LOG_LEVEL_DEBUG); return false; } @@ -214,7 +213,7 @@ void DhtShow(bool json) dtostrfd(Dht[i].h, Settings.flag2.humidity_resolution, humidity); if (json) { - snprintf_P(mqtt_data, sizeof(mqtt_data), JSON_SNS_TEMPHUM, mqtt_data, Dht[i].stype, temperature, humidity); + ResponseAppend_P(JSON_SNS_TEMPHUM, Dht[i].stype, temperature, humidity); #ifdef USE_DOMOTICZ if ((0 == tele_period) && (0 == i)) { DomoticzTempHumSensor(temperature, humidity); @@ -228,8 +227,8 @@ void DhtShow(bool json) #endif // USE_KNX #ifdef USE_WEBSERVER } else { - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_TEMP, mqtt_data, Dht[i].stype, temperature, TempUnit()); - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_HUM, mqtt_data, Dht[i].stype, humidity); + WSContentSend_PD(HTTP_SNS_TEMP, Dht[i].stype, temperature, TempUnit()); + WSContentSend_PD(HTTP_SNS_HUM, Dht[i].stype, humidity); #endif // USE_WEBSERVER } } @@ -255,7 +254,7 @@ bool Xsns06(uint8_t function) DhtShow(1); break; #ifdef USE_WEBSERVER - case FUNC_WEB_APPEND: + case FUNC_WEB_SENSOR: DhtShow(0); break; #endif // USE_WEBSERVER diff --git a/sonoff/xsns_07_sht1x.ino b/sonoff/xsns_07_sht1x.ino index 51351bdf5..12d7f4e79 100644 --- a/sonoff/xsns_07_sht1x.ino +++ b/sonoff/xsns_07_sht1x.ino @@ -194,7 +194,7 @@ void ShtShow(bool json) dtostrfd(sht_humidity, Settings.flag2.humidity_resolution, humidity); if (json) { - snprintf_P(mqtt_data, sizeof(mqtt_data), JSON_SNS_TEMPHUM, mqtt_data, sht_types, temperature, humidity); + ResponseAppend_P(JSON_SNS_TEMPHUM, sht_types, temperature, humidity); #ifdef USE_DOMOTICZ if (0 == tele_period) { DomoticzTempHumSensor(temperature, humidity); @@ -208,8 +208,8 @@ void ShtShow(bool json) #endif // USE_KNX #ifdef USE_WEBSERVER } else { - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_TEMP, mqtt_data, sht_types, temperature, TempUnit()); - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_HUM, mqtt_data, sht_types, humidity); + WSContentSend_PD(HTTP_SNS_TEMP, sht_types, temperature, TempUnit()); + WSContentSend_PD(HTTP_SNS_HUM, sht_types, humidity); #endif // USE_WEBSERVER } } @@ -236,7 +236,7 @@ bool Xsns07(uint8_t function) ShtShow(1); break; #ifdef USE_WEBSERVER - case FUNC_WEB_APPEND: + case FUNC_WEB_SENSOR: ShtShow(0); break; #endif // USE_WEBSERVER diff --git a/sonoff/xsns_08_htu21.ino b/sonoff/xsns_08_htu21.ino index 2120129de..c12a068c9 100644 --- a/sonoff/xsns_08_htu21.ino +++ b/sonoff/xsns_08_htu21.ino @@ -224,8 +224,7 @@ void HtuDetect(void) htu_delay_humidity = 23; } GetTextIndexed(htu_types, sizeof(htu_types), index, kHtuTypes); - snprintf_P(log_data, sizeof(log_data), S_LOG_I2C_FOUND_AT, htu_types, htu_address); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, S_LOG_I2C_FOUND_AT, htu_types, htu_address); } } @@ -255,7 +254,7 @@ void HtuShow(bool json) dtostrfd(htu_humidity, Settings.flag2.humidity_resolution, humidity); if (json) { - snprintf_P(mqtt_data, sizeof(mqtt_data), JSON_SNS_TEMPHUM, mqtt_data, htu_types, temperature, humidity); + ResponseAppend_P(JSON_SNS_TEMPHUM, htu_types, temperature, humidity); #ifdef USE_DOMOTICZ if (0 == tele_period) { DomoticzTempHumSensor(temperature, humidity); @@ -269,8 +268,8 @@ void HtuShow(bool json) #endif // USE_KNX #ifdef USE_WEBSERVER } else { - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_TEMP, mqtt_data, htu_types, temperature, TempUnit()); - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_HUM, mqtt_data, htu_types, humidity); + WSContentSend_PD(HTTP_SNS_TEMP, htu_types, temperature, TempUnit()); + WSContentSend_PD(HTTP_SNS_HUM, htu_types, humidity); #endif // USE_WEBSERVER } } @@ -296,7 +295,7 @@ bool Xsns08(uint8_t function) HtuShow(1); break; #ifdef USE_WEBSERVER - case FUNC_WEB_APPEND: + case FUNC_WEB_SENSOR: HtuShow(0); break; #endif // USE_WEBSERVER diff --git a/sonoff/xsns_09_bmp.ino b/sonoff/xsns_09_bmp.ino index 60e43c09c..881738745 100755 --- a/sonoff/xsns_09_bmp.ino +++ b/sonoff/xsns_09_bmp.ino @@ -61,7 +61,7 @@ uint8_t bmp_addresses[] = { BMP_ADDR1, BMP_ADDR2 }; uint8_t bmp_count = 0; uint8_t bmp_once = 1; -bmp_sensors_t *bmp_sensors = NULL; +bmp_sensors_t *bmp_sensors = nullptr; /*********************************************************************************************\ * BMP085 and BME180 @@ -99,7 +99,7 @@ typedef struct { uint16_t cal_ac6; } bmp180_cal_data_t; -bmp180_cal_data_t *bmp180_cal_data = NULL; +bmp180_cal_data_t *bmp180_cal_data = nullptr; bool Bmp180Calibration(uint8_t bmp_idx) { @@ -244,7 +244,7 @@ typedef struct { int8_t dig_H6; } Bme280CalibrationData_t; -Bme280CalibrationData_t *Bme280CalibrationData = NULL; +Bme280CalibrationData_t *Bme280CalibrationData = nullptr; bool Bmx280Calibrate(uint8_t bmp_idx) { @@ -344,7 +344,7 @@ void Bme280Read(uint8_t bmp_idx) #include -struct bme680_dev *gas_sensor = NULL; +struct bme680_dev *gas_sensor = nullptr; static void BmeDelayMs(uint32_t ms) { @@ -482,8 +482,7 @@ void BmpDetect(void) } if (success) { GetTextIndexed(bmp_sensors[bmp_count].bmp_name, sizeof(bmp_sensors[bmp_count].bmp_name), bmp_sensors[bmp_count].bmp_model, kBmpTypes); - snprintf_P(log_data, sizeof(log_data), S_LOG_I2C_FOUND_AT, bmp_sensors[bmp_count].bmp_name, bmp_sensors[bmp_count].bmp_address); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, S_LOG_I2C_FOUND_AT, bmp_sensors[bmp_count].bmp_name, bmp_sensors[bmp_count].bmp_address); bmp_count++; } } @@ -540,7 +539,7 @@ void BmpShow(bool json) float bmp_pressure = ConvertPressure(bmp_sensors[bmp_idx].bmp_pressure); char name[10]; - snprintf(name, sizeof(name), bmp_sensors[bmp_idx].bmp_name); + strlcpy(name, bmp_sensors[bmp_idx].bmp_name, sizeof(name)); if (bmp_count > 1) { snprintf_P(name, sizeof(name), PSTR("%s-%02X"), name, bmp_sensors[bmp_idx].bmp_address); // BMXXXX-XX } @@ -567,8 +566,7 @@ void BmpShow(bool json) char json_gas[40]; snprintf_P(json_gas, sizeof(json_gas), PSTR(",\"" D_JSON_GAS "\":%s"), gas_resistance); - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"%s\":{\"" D_JSON_TEMPERATURE "\":%s%s,\"" D_JSON_PRESSURE "\":%s%s%s}"), - mqtt_data, + ResponseAppend_P(PSTR(",\"%s\":{\"" D_JSON_TEMPERATURE "\":%s%s,\"" D_JSON_PRESSURE "\":%s%s%s}"), name, temperature, (bmp_sensors[bmp_idx].bmp_model >= 2) ? json_humidity : "", @@ -576,8 +574,8 @@ void BmpShow(bool json) (Settings.altitude != 0) ? json_sealevel : "", (bmp_sensors[bmp_idx].bmp_model >= 3) ? json_gas : ""); #else - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"%s\":{\"" D_JSON_TEMPERATURE "\":%s%s,\"" D_JSON_PRESSURE "\":%s%s}"), - mqtt_data, name, temperature, (bmp_sensors[bmp_idx].bmp_model >= 2) ? json_humidity : "", pressure, (Settings.altitude != 0) ? json_sealevel : ""); + ResponseAppend_P(PSTR(",\"%s\":{\"" D_JSON_TEMPERATURE "\":%s%s,\"" D_JSON_PRESSURE "\":%s%s}"), + name, temperature, (bmp_sensors[bmp_idx].bmp_model >= 2) ? json_humidity : "", pressure, (Settings.altitude != 0) ? json_sealevel : ""); #endif // USE_BME680 #ifdef USE_DOMOTICZ @@ -598,19 +596,20 @@ void BmpShow(bool json) #ifdef USE_WEBSERVER } else { - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_TEMP, mqtt_data, name, temperature, TempUnit()); + WSContentSend_PD(HTTP_SNS_TEMP, name, temperature, TempUnit()); if (bmp_sensors[bmp_idx].bmp_model >= 2) { - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_HUM, mqtt_data, name, humidity); + WSContentSend_PD(HTTP_SNS_HUM, name, humidity); } - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_PRESSURE, mqtt_data, name, pressure, PressureUnit().c_str()); + WSContentSend_PD(HTTP_SNS_PRESSURE, name, pressure, PressureUnit().c_str()); if (Settings.altitude != 0) { - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_SEAPRESSURE, mqtt_data, name, sea_pressure, PressureUnit().c_str()); + WSContentSend_PD(HTTP_SNS_SEAPRESSURE, name, sea_pressure, PressureUnit().c_str()); } #ifdef USE_BME680 if (bmp_sensors[bmp_idx].bmp_model >= 3) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s{s}%s " D_GAS "{m}%s " D_UNIT_KILOOHM "{e}"), mqtt_data, name, gas_resistance); + WSContentSend_PD(PSTR("{s}%s " D_GAS "{m}%s " D_UNIT_KILOOHM "{e}"), name, gas_resistance); } #endif // USE_BME680 + #endif // USE_WEBSERVER } } @@ -637,7 +636,7 @@ bool Xsns09(uint8_t function) BmpShow(1); break; #ifdef USE_WEBSERVER - case FUNC_WEB_APPEND: + case FUNC_WEB_SENSOR: BmpShow(0); break; #endif // USE_WEBSERVER diff --git a/sonoff/xsns_10_bh1750.ino b/sonoff/xsns_10_bh1750.ino index 5dd791397..5398422b7 100644 --- a/sonoff/xsns_10_bh1750.ino +++ b/sonoff/xsns_10_bh1750.ino @@ -65,8 +65,7 @@ void Bh1750Detect(void) Wire.write(BH1750_CONTINUOUS_HIGH_RES_MODE); if (!Wire.endTransmission()) { bh1750_type = 1; - snprintf_P(log_data, sizeof(log_data), S_LOG_I2C_FOUND_AT, bh1750_types, bh1750_address); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, S_LOG_I2C_FOUND_AT, bh1750_types, bh1750_address); break; } } @@ -93,7 +92,7 @@ void Bh1750Show(bool json) { if (bh1750_valid) { if (json) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"%s\":{\"" D_JSON_ILLUMINANCE "\":%d}"), mqtt_data, bh1750_types, bh1750_illuminance); + ResponseAppend_P(PSTR(",\"%s\":{\"" D_JSON_ILLUMINANCE "\":%d}"), bh1750_types, bh1750_illuminance); #ifdef USE_DOMOTICZ if (0 == tele_period) { DomoticzSensor(DZ_ILLUMINANCE, bh1750_illuminance); @@ -101,7 +100,7 @@ void Bh1750Show(bool json) #endif // USE_DOMOTICZ #ifdef USE_WEBSERVER } else { - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_ILLUMINANCE, mqtt_data, bh1750_types, bh1750_illuminance); + WSContentSend_PD(HTTP_SNS_ILLUMINANCE, bh1750_types, bh1750_illuminance); #endif // USE_WEBSERVER } } @@ -127,7 +126,7 @@ bool Xsns10(uint8_t function) Bh1750Show(1); break; #ifdef USE_WEBSERVER - case FUNC_WEB_APPEND: + case FUNC_WEB_SENSOR: Bh1750Show(0); break; #endif // USE_WEBSERVER diff --git a/sonoff/xsns_11_veml6070.ino b/sonoff/xsns_11_veml6070.ino index 276b90d9f..b6f50d05d 100644 --- a/sonoff/xsns_11_veml6070.ino +++ b/sonoff/xsns_11_veml6070.ino @@ -31,7 +31,7 @@ Version Date Action Description -------------------------------------------------------------------------------------------- - 1.0.0.3 20181006 fixed - missing "" around the UV Index text + 1.0.0.3 20181006 fixed - missing "" around the UV Index text - thanks to Lisa she had tested it on here mqtt system. -- 1.0.0.2 20180928 tests - same as in version 1.0.0.1 @@ -140,8 +140,7 @@ void Veml6070Detect(void) veml6070_type = 1; uint8_t veml_model = 0; GetTextIndexed(veml6070_name, sizeof(veml6070_name), veml_model, kVemlTypes); - snprintf_P(log_data, sizeof(log_data), S_LOG_I2C_FOUND_AT, "VEML6070", VEML6070_ADDR_L); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, S_LOG_I2C_FOUND_AT, "VEML6070", VEML6070_ADDR_L); } } @@ -156,13 +155,11 @@ void Veml6070UvTableInit(void) uv_risk_map[i] = ( (USE_VEML6070_RSET / VEML6070_TABLE_COEFFCIENT) / VEML6070_UV_MAX_DEFAULT ) * (i+1); } else { uv_risk_map[i] = ( (VEML6070_RSET_DEFAULT / VEML6070_TABLE_COEFFCIENT) / VEML6070_UV_MAX_DEFAULT ) * (i+1); - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_DEBUG "VEML6070 resistor error %d"), USE_VEML6070_RSET); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "VEML6070 resistor error %d"), USE_VEML6070_RSET); } #else uv_risk_map[i] = ( (VEML6070_RSET_DEFAULT / VEML6070_TABLE_COEFFCIENT) / VEML6070_UV_MAX_DEFAULT ) * (i+1); - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_DEBUG "VEML6070 resistor default used %d"), VEML6070_RSET_DEFAULT); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "VEML6070 resistor default used %d"), VEML6070_RSET_DEFAULT); #endif } } @@ -196,8 +193,7 @@ void Veml6070ModeCmd(bool mode_cmd) uint8_t status = Wire.endTransmission(); // action on status if (!status) { - snprintf_P(log_data, sizeof(log_data), S_LOG_I2C_FOUND_AT, "VEML6070 mode_cmd", VEML6070_ADDR_L); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, S_LOG_I2C_FOUND_AT, "VEML6070 mode_cmd", VEML6070_ADDR_L); } } @@ -241,8 +237,7 @@ double Veml6070UvRiskLevel(uint16_t uv_level) // out of range and much to high - it must be outerspace or sensor damaged snprintf_P(str_uvrisk_text, sizeof(str_uvrisk_text), D_UV_INDEX_7); return ( risk = 99 ); - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_DEBUG "VEML6070 out of range %d"), risk); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "VEML6070 out of range %d"), risk); } } @@ -261,11 +256,11 @@ double Veml6070UvPower(double uvrisk) #ifdef USE_WEBSERVER // {s} = , {m} = , {e} = #ifdef USE_VEML6070_SHOW_RAW - const char HTTP_SNS_UV_LEVEL[] PROGMEM = "%s{s}VEML6070 " D_UV_LEVEL "{m}%s " D_UNIT_INCREMENTS "{e}"; + const char HTTP_SNS_UV_LEVEL[] PROGMEM = "{s}VEML6070 " D_UV_LEVEL "{m}%s " D_UNIT_INCREMENTS "{e}"; #endif // USE_VEML6070_SHOW_RAW // different uv index level texts - const char HTTP_SNS_UV_INDEX[] PROGMEM = "%s{s}VEML6070 " D_UV_INDEX " {m}%s %s{e}"; - const char HTTP_SNS_UV_POWER[] PROGMEM = "%s{s}VEML6070 " D_UV_POWER "{m}%s " D_UNIT_WATT_METER_QUADRAT "{e}"; + const char HTTP_SNS_UV_INDEX[] PROGMEM = "{s}VEML6070 " D_UV_INDEX "{m}%s %s{e}"; + const char HTTP_SNS_UV_POWER[] PROGMEM = "{s}VEML6070 " D_UV_POWER "{m}%s " D_UNIT_WATT_METER_QUADRAT "{e}"; #endif // USE_WEBSERVER /********************************************************************************************/ @@ -282,11 +277,11 @@ void Veml6070Show(bool json) dtostrfd(uvpower, 3, str_uvpower); if (json) { #ifdef USE_VEML6070_SHOW_RAW - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"%s\":{\"" D_JSON_UV_LEVEL "\":%s,\"" D_JSON_UV_INDEX "\":%s,\"" D_JSON_UV_INDEX_TEXT "\":\"%s\",\"" D_JSON_UV_POWER "\":%s}"), - mqtt_data, veml6070_name, str_uvlevel, str_uvrisk, str_uvrisk_text, str_uvpower); + ResponseAppend_P(PSTR(",\"%s\":{\"" D_JSON_UV_LEVEL "\":%s,\"" D_JSON_UV_INDEX "\":%s,\"" D_JSON_UV_INDEX_TEXT "\":\"%s\",\"" D_JSON_UV_POWER "\":%s}"), + veml6070_name, str_uvlevel, str_uvrisk, str_uvrisk_text, str_uvpower); #else - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"%s\":{\"" D_JSON_UV_INDEX "\":%s,\"" D_JSON_UV_INDEX_TEXT "\":\"%s\",\"" D_JSON_UV_POWER "\":%s}"), - mqtt_data, veml6070_name, str_uvrisk, str_uvrisk_text, str_uvpower); + ResponseAppend_P(PSTR(",\"%s\":{\"" D_JSON_UV_INDEX "\":%s,\"" D_JSON_UV_INDEX_TEXT "\":\"%s\",\"" D_JSON_UV_POWER "\":%s}"), + veml6070_name, str_uvrisk, str_uvrisk_text, str_uvpower); #endif // USE_VEML6070_SHOW_RAW #ifdef USE_DOMOTICZ if (0 == tele_period) { DomoticzSensor(DZ_ILLUMINANCE, uvlevel); } @@ -294,10 +289,10 @@ void Veml6070Show(bool json) #ifdef USE_WEBSERVER } else { #ifdef USE_VEML6070_SHOW_RAW - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_UV_LEVEL, mqtt_data, str_uvlevel); + WSContentSend_PD(HTTP_SNS_UV_LEVEL, str_uvlevel); #endif // USE_VEML6070_SHOW_RAW - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_UV_INDEX, mqtt_data, str_uvrisk, str_uvrisk_text); - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_UV_POWER, mqtt_data, str_uvpower); + WSContentSend_PD(HTTP_SNS_UV_INDEX, str_uvrisk, str_uvrisk_text); + WSContentSend_PD(HTTP_SNS_UV_POWER, str_uvpower); #endif // USE_WEBSERVER } } @@ -315,7 +310,7 @@ bool Xsns11(uint8_t function) switch (function) { case FUNC_INIT: Veml6070Detect(); // 1[ms], detect and init the sensor - Veml6070UvTableInit(); // 1[ms], initalize the UV compare table only once + Veml6070UvTableInit(); // 1[ms], initalize the UV compare table only once break; case FUNC_EVERY_SECOND: Veml6070EverySecond(); // 10..15[ms], tested with OLED display, do all the actions needed to get all sensor values @@ -324,7 +319,7 @@ bool Xsns11(uint8_t function) Veml6070Show(1); break; #ifdef USE_WEBSERVER - case FUNC_WEB_APPEND: + case FUNC_WEB_SENSOR: Veml6070Show(0); break; #endif // USE_WEBSERVER diff --git a/sonoff/xsns_12_ads1115.ino b/sonoff/xsns_12_ads1115.ino index 51cbb6c43..d40b72849 100644 --- a/sonoff/xsns_12_ads1115.ino +++ b/sonoff/xsns_12_ads1115.ino @@ -164,13 +164,12 @@ void Ads1115Detect(void) for (uint8_t i = 0; i < sizeof(ads1115_addresses); i++) { if (!ads1115_found[i]) { ads1115_address = ads1115_addresses[i]; - if (I2cValidRead16(&buffer, ads1115_address, ADS1115_REG_POINTER_CONVERT) && + if (I2cValidRead16(&buffer, ads1115_address, ADS1115_REG_POINTER_CONVERT) && I2cValidRead16(&buffer, ads1115_address, ADS1115_REG_POINTER_CONFIG)) { Ads1115StartComparator(i, ADS1115_REG_CONFIG_MODE_CONTIN); ads1115_type = 1; ads1115_found[i] = 1; - snprintf_P(log_data, sizeof(log_data), S_LOG_I2C_FOUND_AT, "ADS1115", ads1115_address); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, S_LOG_I2C_FOUND_AT, "ADS1115", ads1115_address); } } } @@ -182,21 +181,20 @@ void Ads1115GetValues(uint8_t address) ads1115_address = address; for (uint8_t i = 0; i < 4; i++) { ads1115_values[i] = Ads1115GetConversion(i); - //snprintf_P(log_data, sizeof(log_data), "Logging ADS1115 %02x (%i) = %i", address, i, ads1115_values[i] ); - //AddLog(LOG_LEVEL_INFO); + //AddLog_P2(LOG_LEVEL_INFO, "Logging ADS1115 %02x (%i) = %i", address, i, ads1115_values[i] ); } ads1115_address = old_address; } void Ads1115toJSON(char *comma_j) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s%s{"), mqtt_data,comma_j); + ResponseAppend_P(PSTR("%s{"), comma_j); char *comma = (char*)""; for (uint8_t i = 0; i < 4; i++) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s%s\"A%d\":%d"), mqtt_data, comma, i, ads1115_values[i]); + ResponseAppend_P(PSTR("%s\"A%d\":%d"), comma, i, ads1115_values[i]); comma = (char*)","; } - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s}"), mqtt_data); + ResponseAppend_P(PSTR("}")); } void Ads1115toString(uint8_t address) @@ -205,7 +203,7 @@ void Ads1115toString(uint8_t address) snprintf_P(label, sizeof(label), "ADS1115(%02x)", address); for (uint8_t i = 0; i < 4; i++) { - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_ANALOG, mqtt_data, label, i, ads1115_values[i]); + WSContentSend_PD(HTTP_SNS_ANALOG, label, i, ads1115_values[i]); } } @@ -214,14 +212,13 @@ void Ads1115Show(bool json) if (!ads1115_type) { return; } if (json) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"ADS1115\":["), mqtt_data); + ResponseAppend_P(PSTR(",\"ADS1115\":[")); } char *comma = (char*)""; for (uint8_t t = 0; t < sizeof(ads1115_addresses); t++) { - //snprintf_P(log_data, sizeof(log_data), "Logging ADS1115 %02x", ads1115_addresses[t]); - //AddLog(LOG_LEVEL_INFO); + //AddLog_P2(LOG_LEVEL_INFO, "Logging ADS1115 %02x", ads1115_addresses[t]); if (ads1115_found[t]) { Ads1115GetValues(ads1115_addresses[t]); if (json) { @@ -237,7 +234,7 @@ void Ads1115Show(bool json) } if (json) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s]"), mqtt_data); + ResponseAppend_P(PSTR("]")); } } @@ -258,7 +255,7 @@ bool Xsns12(uint8_t function) Ads1115Show(1); break; #ifdef USE_WEBSERVER - case FUNC_WEB_APPEND: + case FUNC_WEB_SENSOR: Ads1115Show(0); break; #endif // USE_WEBSERVER diff --git a/sonoff/xsns_12_ads1115_i2cdev.ino b/sonoff/xsns_12_ads1115_i2cdev.ino index 2e0bd0ab7..eb5643c3e 100644 --- a/sonoff/xsns_12_ads1115_i2cdev.ino +++ b/sonoff/xsns_12_ads1115_i2cdev.ino @@ -90,8 +90,7 @@ void Ads1115Detect(void) adc0.setRate(ADS1115_RATE_860); adc0.setMode(ADS1115_MODE_CONTINUOUS); ads1115_type = 1; - snprintf_P(log_data, sizeof(log_data), S_LOG_I2C_FOUND_AT, "ADS1115", ads1115_address); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, S_LOG_I2C_FOUND_AT, "ADS1115", ads1115_address); break; } } @@ -100,7 +99,6 @@ void Ads1115Detect(void) void Ads1115Show(bool json) { if (ads1115_type) { - char stemp[10]; uint8_t dsxflg = 0; for (uint8_t i = 0; i < 4; i++) { @@ -108,21 +106,19 @@ void Ads1115Show(bool json) if (json) { if (!dsxflg ) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"ADS1115\":{"), mqtt_data); - stemp[0] = '\0'; + ResponseAppend_P(PSTR(",\"ADS1115\":{")); } + ResponseAppend_P(PSTR("%s\"A%d\":%d"), (dsxflg) ? "," : "", i, adc_value); dsxflg++; - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s%s\"A%d\":%d"), mqtt_data, stemp, i, adc_value); - strlcpy(stemp, ",", sizeof(stemp)); #ifdef USE_WEBSERVER } else { - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_ANALOG, mqtt_data, "ADS1115", i, adc_value); + WSContentSend_PD(HTTP_SNS_ANALOG, "ADS1115", i, adc_value); #endif // USE_WEBSERVER } } if (json) { if (dsxflg) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s}"), mqtt_data); + ResponseAppend_P(PSTR("}")); } } } @@ -145,7 +141,7 @@ bool Xsns12(uint8_t function) Ads1115Show(1); break; #ifdef USE_WEBSERVER - case FUNC_WEB_APPEND: + case FUNC_WEB_SENSOR: Ads1115Show(0); break; #endif // USE_WEBSERVER diff --git a/sonoff/xsns_13_ina219.ino b/sonoff/xsns_13_ina219.ino index 6b25e8bac..0dd7e5398 100644 --- a/sonoff/xsns_13_ina219.ino +++ b/sonoff/xsns_13_ina219.ino @@ -183,7 +183,7 @@ bool Ina219CommandSensor(void) Settings.ina219_mode = XdrvMailbox.payload; restart_flag = 2; } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_SENSOR_INDEX_NVALUE, XSNS_13, Settings.ina219_mode); + Response_P(S_JSON_SENSOR_INDEX_NVALUE, XSNS_13, Settings.ina219_mode); return serviced; } @@ -198,8 +198,7 @@ void Ina219Detect(void) ina219_address = ina219_addresses[i]; if (Ina219SetCalibration(Settings.ina219_mode)) { ina219_type = 1; - snprintf_P(log_data, sizeof(log_data), S_LOG_I2C_FOUND_AT, ina219_types, ina219_address); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, S_LOG_I2C_FOUND_AT, ina219_types, ina219_address); break; } } @@ -223,7 +222,7 @@ void Ina219EverySecond(void) } #ifdef USE_WEBSERVER -const char HTTP_SNS_INA219_DATA[] PROGMEM = "%s" +const char HTTP_SNS_INA219_DATA[] PROGMEM = "{s}INA219 " D_VOLTAGE "{m}%s " D_UNIT_VOLT "{e}" "{s}INA219 " D_CURRENT "{m}%s " D_UNIT_AMPERE "{e}" "{s}INA219 " D_POWERUSAGE "{m}%s " D_UNIT_WATT "{e}"; @@ -241,8 +240,8 @@ void Ina219Show(bool json) dtostrfd(ina219_current, Settings.flag2.current_resolution, current); if (json) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"%s\":{\"" D_JSON_VOLTAGE "\":%s,\"" D_JSON_CURRENT "\":%s,\"" D_JSON_POWERUSAGE "\":%s}"), - mqtt_data, ina219_types, voltage, current, power); + ResponseAppend_P(PSTR(",\"%s\":{\"" D_JSON_VOLTAGE "\":%s,\"" D_JSON_CURRENT "\":%s,\"" D_JSON_POWERUSAGE "\":%s}"), + ina219_types, voltage, current, power); #ifdef USE_DOMOTICZ if (0 == tele_period) { DomoticzSensor(DZ_VOLTAGE, voltage); @@ -251,7 +250,7 @@ void Ina219Show(bool json) #endif // USE_DOMOTICZ #ifdef USE_WEBSERVER } else { - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_INA219_DATA, mqtt_data, voltage, current, power); + WSContentSend_PD(HTTP_SNS_INA219_DATA, voltage, current, power); #endif // USE_WEBSERVER } } @@ -267,7 +266,7 @@ bool Xsns13(uint8_t function) if (i2c_flg) { switch (function) { - case FUNC_COMMAND: + case FUNC_COMMAND_SENSOR: if ((XSNS_13 == XdrvMailbox.index) && (ina219_type)) { result = Ina219CommandSensor(); } @@ -282,7 +281,7 @@ bool Xsns13(uint8_t function) Ina219Show(1); break; #ifdef USE_WEBSERVER - case FUNC_WEB_APPEND: + case FUNC_WEB_SENSOR: Ina219Show(0); break; #endif // USE_WEBSERVER diff --git a/sonoff/xsns_14_sht3x.ino b/sonoff/xsns_14_sht3x.ino index 531e93ceb..bdaa43e1a 100755 --- a/sonoff/xsns_14_sht3x.ino +++ b/sonoff/xsns_14_sht3x.ino @@ -86,8 +86,7 @@ void Sht3xDetect(void) if (Sht3xRead(t, h, sht3x_addresses[i])) { sht3x_sensors[sht3x_count].address = sht3x_addresses[i]; GetTextIndexed(sht3x_sensors[sht3x_count].types, sizeof(sht3x_sensors[sht3x_count].types), i, kShtTypes); - snprintf_P(log_data, sizeof(log_data), S_LOG_I2C_FOUND_AT, sht3x_sensors[sht3x_count].types, sht3x_sensors[sht3x_count].address); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, S_LOG_I2C_FOUND_AT, sht3x_sensors[sht3x_count].types, sht3x_sensors[sht3x_count].address); sht3x_count++; } } @@ -111,7 +110,7 @@ void Sht3xShow(bool json) snprintf_P(types, sizeof(types), PSTR("%s-0x%02X"), sht3x_sensors[i].types, sht3x_sensors[i].address); // "SHT3X-0xXX" if (json) { - snprintf_P(mqtt_data, sizeof(mqtt_data), JSON_SNS_TEMPHUM, mqtt_data, types, temperature, humidity); + ResponseAppend_P(JSON_SNS_TEMPHUM, types, temperature, humidity); #ifdef USE_DOMOTICZ if ((0 == tele_period) && (0 == i)) { // We want the same first sensor to report to Domoticz in case a read is missed DomoticzTempHumSensor(temperature, humidity); @@ -127,8 +126,8 @@ void Sht3xShow(bool json) #ifdef USE_WEBSERVER } else { - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_TEMP, mqtt_data, types, temperature, TempUnit()); - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_HUM, mqtt_data, types, humidity); + WSContentSend_PD(HTTP_SNS_TEMP, types, temperature, TempUnit()); + WSContentSend_PD(HTTP_SNS_HUM, types, humidity); #endif // USE_WEBSERVER } } @@ -153,7 +152,7 @@ bool Xsns14(uint8_t function) Sht3xShow(1); break; #ifdef USE_WEBSERVER - case FUNC_WEB_APPEND: + case FUNC_WEB_SENSOR: Sht3xShow(0); break; #endif // USE_WEBSERVER diff --git a/sonoff/xsns_15_mhz19.ino b/sonoff/xsns_15_mhz19.ino index 8558a9cd9..5978ba058 100644 --- a/sonoff/xsns_15_mhz19.ino +++ b/sonoff/xsns_15_mhz19.ino @@ -71,8 +71,8 @@ TasmotaSerial *MhzSerial; const char kMhzModels[] PROGMEM = "|B"; -const char ABC_ENABLED[] PROGMEM = "ABC is Enabled"; -const char ABC_DISABLED[] PROGMEM = "ABC is Enabled"; +const char ABC_ENABLED[] = "ABC is Enabled"; +const char ABC_DISABLED[] = "ABC is Disabled"; enum MhzCommands { MHZ_CMND_READPPM, MHZ_CMND_ABCENABLE, MHZ_CMND_ABCDISABLE, MHZ_CMND_ZEROPOINT, MHZ_CMND_RESET, MHZ_CMND_RANGE_1000, MHZ_CMND_RANGE_2000, MHZ_CMND_RANGE_3000, MHZ_CMND_RANGE_5000 }; const uint8_t kMhzCommands[][4] PROGMEM = { @@ -123,8 +123,7 @@ size_t MhzSendCmd(uint8_t command_id) memcpy_P(&mhz_send[6], kMhzCommands[command_id] + sizeof(uint16_t), sizeof(uint16_t)); mhz_send[8] = MhzCalculateChecksum(mhz_send); -// snprintf_P(log_data, sizeof(log_data), PSTR("Final MhzCommand: %x %x %x %x %x %x %x %x %x"),mhz_send[0],mhz_send[1],mhz_send[2],mhz_send[3],mhz_send[4],mhz_send[5],mhz_send[6],mhz_send[7],mhz_send[8]); -// AddLog(LOG_LEVEL_DEBUG); +// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("Final MhzCommand: %x %x %x %x %x %x %x %x %x"),mhz_send[0],mhz_send[1],mhz_send[2],mhz_send[3],mhz_send[4],mhz_send[5],mhz_send[6],mhz_send[7],mhz_send[8]); return MhzSerial->write(mhz_send, sizeof(mhz_send)); } @@ -277,42 +276,42 @@ bool MhzCommandSensor(void) case 0: Settings.SensorBits1.mhz19b_abc_disable = true; MhzSendCmd(MHZ_CMND_ABCDISABLE); - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_SENSOR_INDEX_SVALUE, XSNS_15, ABC_DISABLED); + Response_P(S_JSON_SENSOR_INDEX_SVALUE, XSNS_15, ABC_DISABLED); break; case 1: Settings.SensorBits1.mhz19b_abc_disable = false; MhzSendCmd(MHZ_CMND_ABCENABLE); - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_SENSOR_INDEX_SVALUE, XSNS_15, ABC_ENABLED); + Response_P(S_JSON_SENSOR_INDEX_SVALUE, XSNS_15, ABC_ENABLED); break; case 2: MhzSendCmd(MHZ_CMND_ZEROPOINT); - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_SENSOR_INDEX_SVALUE, XSNS_15, D_JSON_ZERO_POINT_CALIBRATION); + Response_P(S_JSON_SENSOR_INDEX_SVALUE, XSNS_15, D_JSON_ZERO_POINT_CALIBRATION); break; case 9: MhzSendCmd(MHZ_CMND_RESET); - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_SENSOR_INDEX_SVALUE, XSNS_15, D_JSON_RESET); + Response_P(S_JSON_SENSOR_INDEX_SVALUE, XSNS_15, D_JSON_RESET); break; case 1000: MhzSendCmd(MHZ_CMND_RANGE_1000); - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_SENSOR_INDEX_SVALUE, XSNS_15, D_JSON_RANGE_1000); + Response_P(S_JSON_SENSOR_INDEX_SVALUE, XSNS_15, D_JSON_RANGE_1000); break; case 2000: MhzSendCmd(MHZ_CMND_RANGE_2000); - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_SENSOR_INDEX_SVALUE, XSNS_15, D_JSON_RANGE_2000); + Response_P(S_JSON_SENSOR_INDEX_SVALUE, XSNS_15, D_JSON_RANGE_2000); break; case 3000: MhzSendCmd(MHZ_CMND_RANGE_3000); - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_SENSOR_INDEX_SVALUE, XSNS_15, D_JSON_RANGE_3000); + Response_P(S_JSON_SENSOR_INDEX_SVALUE, XSNS_15, D_JSON_RANGE_3000); break; case 5000: MhzSendCmd(MHZ_CMND_RANGE_5000); - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_SENSOR_INDEX_SVALUE, XSNS_15, D_JSON_RANGE_5000); + Response_P(S_JSON_SENSOR_INDEX_SVALUE, XSNS_15, D_JSON_RANGE_5000); break; default: if (!Settings.SensorBits1.mhz19b_abc_disable) { - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_SENSOR_INDEX_SVALUE, XSNS_15, ABC_ENABLED); + Response_P(S_JSON_SENSOR_INDEX_SVALUE, XSNS_15, ABC_ENABLED); } else { - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_SENSOR_INDEX_SVALUE, XSNS_15, ABC_DISABLED); + Response_P(S_JSON_SENSOR_INDEX_SVALUE, XSNS_15, ABC_DISABLED); } } @@ -343,7 +342,7 @@ void MhzShow(bool json) GetTextIndexed(model, sizeof(model), mhz_type -1, kMhzModels); if (json) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"%s\":{\"" D_JSON_MODEL "\":\"%s\",\"" D_JSON_CO2 "\":%d,\"" D_JSON_TEMPERATURE "\":%s}"), mqtt_data, types, model, mhz_last_ppm, temperature); + ResponseAppend_P(PSTR(",\"%s\":{\"" D_JSON_MODEL "\":\"%s\",\"" D_JSON_CO2 "\":%d,\"" D_JSON_TEMPERATURE "\":%s}"), types, model, mhz_last_ppm, temperature); #ifdef USE_DOMOTICZ if (0 == tele_period) { DomoticzSensor(DZ_AIRQUALITY, mhz_last_ppm); @@ -352,8 +351,8 @@ void MhzShow(bool json) #endif // USE_DOMOTICZ #ifdef USE_WEBSERVER } else { - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_CO2, mqtt_data, types, mhz_last_ppm); - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_TEMP, mqtt_data, types, temperature, TempUnit()); + WSContentSend_PD(HTTP_SNS_CO2, types, mhz_last_ppm); + WSContentSend_PD(HTTP_SNS_TEMP, types, temperature, TempUnit()); #endif // USE_WEBSERVER } } @@ -374,7 +373,7 @@ bool Xsns15(uint8_t function) case FUNC_EVERY_SECOND: MhzEverySecond(); break; - case FUNC_COMMAND: + case FUNC_COMMAND_SENSOR: if (XSNS_15 == XdrvMailbox.index) { result = MhzCommandSensor(); } @@ -383,7 +382,7 @@ bool Xsns15(uint8_t function) MhzShow(1); break; #ifdef USE_WEBSERVER - case FUNC_WEB_APPEND: + case FUNC_WEB_SENSOR: MhzShow(0); break; #endif // USE_WEBSERVER diff --git a/sonoff/xsns_16_tsl2561.ino b/sonoff/xsns_16_tsl2561.ino index ab923f2e8..af1d60d54 100644 --- a/sonoff/xsns_16_tsl2561.ino +++ b/sonoff/xsns_16_tsl2561.ino @@ -71,8 +71,7 @@ void Tsl2561Detect(void) if (!Tsl.id(id)) return; if (Tsl.on()) { tsl2561_type = 1; - snprintf_P(log_data, sizeof(log_data), S_LOG_I2C_FOUND_AT, tsl2561_types, Tsl.address(), id); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, S_LOG_I2C_FOUND_AT, tsl2561_types, Tsl.address(), id); } } } @@ -96,21 +95,21 @@ void Tsl2561EverySecond(void) #ifdef USE_WEBSERVER const char HTTP_SNS_TSL2561[] PROGMEM = - "%s{s}TSL2561 " D_ILLUMINANCE "{m}%u.%03u " D_UNIT_LUX "{e}"; // {s} = , {m} = , {e} = + "{s}TSL2561 " D_ILLUMINANCE "{m}%u.%03u " D_UNIT_LUX "{e}"; // {s} = , {m} = , {e} = #endif // USE_WEBSERVER void Tsl2561Show(bool json) { if (tsl2561_valid) { if (json) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"TSL2561\":{\"" D_JSON_ILLUMINANCE "\":%u.%03u}"), - mqtt_data, tsl2561_milliLux / 1000, tsl2561_milliLux % 1000); + ResponseAppend_P(PSTR(",\"TSL2561\":{\"" D_JSON_ILLUMINANCE "\":%u.%03u}"), + tsl2561_milliLux / 1000, tsl2561_milliLux % 1000); #ifdef USE_DOMOTICZ if (0 == tele_period) { DomoticzSensor(DZ_ILLUMINANCE, (tsl2561_milliLux + 500) / 1000); } #endif // USE_DOMOTICZ #ifdef USE_WEBSERVER } else { - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_TSL2561, mqtt_data, tsl2561_milliLux / 1000, tsl2561_milliLux % 1000); + WSContentSend_PD(HTTP_SNS_TSL2561, tsl2561_milliLux / 1000, tsl2561_milliLux % 1000); #endif // USE_WEBSERVER } } @@ -136,7 +135,7 @@ bool Xsns16(uint8_t function) Tsl2561Show(1); break; #ifdef USE_WEBSERVER - case FUNC_WEB_APPEND: + case FUNC_WEB_SENSOR: Tsl2561Show(0); break; #endif // USE_WEBSERVER diff --git a/sonoff/xsns_17_senseair.ino b/sonoff/xsns_17_senseair.ino index 4758b454b..d11195b50 100644 --- a/sonoff/xsns_17_senseair.ino +++ b/sonoff/xsns_17_senseair.ino @@ -70,19 +70,16 @@ void Senseair250ms(void) // Every 250 mSec if (data_ready) { uint8_t error = SenseairModbus->Receive16BitRegister(&value); if (error) { - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_DEBUG "SenseAir response error %d"), error); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "SenseAir response error %d"), error); } else { switch(senseair_read_state) { case 0: // 0x1A (26) READ_TYPE_LOW - S8: fe 04 02 01 77 ec 92 senseair_type = 2; - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_DEBUG "SenseAir type id low %04X"), value); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "SenseAir type id low %04X"), value); break; case 1: // 0x00 (0) READ_ERRORLOG - fe 04 02 00 00 ad 24 if (value) { - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_DEBUG "SenseAir error %04X"), value); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "SenseAir error %04X"), value); } break; case 2: // 0x03 (3) READ_CO2 - fe 04 02 06 2c af 59 @@ -98,13 +95,11 @@ void Senseair250ms(void) // Every 250 mSec case 5: // 0x1C (28) READ_RELAY_STATE - S8: fe 04 02 01 54 ad 4b - firmware version { bool relay_state = value >> 8 & 1; - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_DEBUG "SenseAir relay state %d"), relay_state); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "SenseAir relay state %d"), relay_state); break; } case 6: // 0x0A (10) READ_TEMP_ADJUSTMENT - S8: fe 84 02 f2 f1 - Illegal Data Address - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_DEBUG "SenseAir temp adjustment %d"), value); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "SenseAir temp adjustment %d"), value); break; } } @@ -154,20 +149,20 @@ void SenseairShow(bool json) GetTextIndexed(senseair_types, sizeof(senseair_types), senseair_type -1, kSenseairTypes); if (json) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"%s\":{\"" D_JSON_CO2 "\":%d"), mqtt_data, senseair_types, senseair_co2); + ResponseAppend_P(PSTR("%s,\"%s\":{\"" D_JSON_CO2 "\":%d"), senseair_types, senseair_co2); if (senseair_type != 2) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"" D_JSON_TEMPERATURE "\":%s,\"" D_JSON_HUMIDITY "\":%s"), mqtt_data, temperature, humidity); + ResponseAppend_P(PSTR("%s,\"" D_JSON_TEMPERATURE "\":%s,\"" D_JSON_HUMIDITY "\":%s"), temperature, humidity); } - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s}"), mqtt_data); + ResponseAppend_P(PSTR("}")); #ifdef USE_DOMOTICZ if (0 == tele_period) DomoticzSensor(DZ_AIRQUALITY, senseair_co2); #endif // USE_DOMOTICZ #ifdef USE_WEBSERVER } else { - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_CO2, mqtt_data, senseair_types, senseair_co2); + WSContentSend_PD(HTTP_SNS_CO2, senseair_types, senseair_co2); if (senseair_type != 2) { - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_TEMP, mqtt_data, senseair_types, temperature, TempUnit()); - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_HUM, mqtt_data, senseair_types, humidity); + WSContentSend_PD(HTTP_SNS_TEMP, senseair_types, temperature, TempUnit()); + WSContentSend_PD(HTTP_SNS_HUM, senseair_types, humidity); } #endif // USE_WEBSERVER } @@ -193,7 +188,7 @@ bool Xsns17(uint8_t function) SenseairShow(1); break; #ifdef USE_WEBSERVER - case FUNC_WEB_APPEND: + case FUNC_WEB_SENSOR: SenseairShow(0); break; #endif // USE_WEBSERVER diff --git a/sonoff/xsns_18_pms5003.ino b/sonoff/xsns_18_pms5003.ino index 82959ff88..e77eb0271 100644 --- a/sonoff/xsns_18_pms5003.ino +++ b/sonoff/xsns_18_pms5003.ino @@ -113,7 +113,7 @@ void PmsInit(void) } #ifdef USE_WEBSERVER -const char HTTP_PMS5003_SNS[] PROGMEM = "%s" +const char HTTP_PMS5003_SNS[] PROGMEM = // "{s}PMS5003 " D_STANDARD_CONCENTRATION " 1 " D_UNIT_MICROMETER "{m}%d " D_UNIT_MICROGRAM_PER_CUBIC_METER "{e}" // "{s}PMS5003 " D_STANDARD_CONCENTRATION " 2.5 " D_UNIT_MICROMETER "{m}%d " D_UNIT_MICROGRAM_PER_CUBIC_METER "{e}" // "{s}PMS5003 " D_STANDARD_CONCENTRATION " 10 " D_UNIT_MICROMETER "{m}%d " D_UNIT_MICROGRAM_PER_CUBIC_METER "{e}" @@ -132,7 +132,7 @@ void PmsShow(bool json) { if (pms_valid) { if (json) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"PMS5003\":{\"CF1\":%d,\"CF2.5\":%d,\"CF10\":%d,\"PM1\":%d,\"PM2.5\":%d,\"PM10\":%d,\"PB0.3\":%d,\"PB0.5\":%d,\"PB1\":%d,\"PB2.5\":%d,\"PB5\":%d,\"PB10\":%d}"), mqtt_data, + ResponseAppend_P(PSTR(",\"PMS5003\":{\"CF1\":%d,\"CF2.5\":%d,\"CF10\":%d,\"PM1\":%d,\"PM2.5\":%d,\"PM10\":%d,\"PB0.3\":%d,\"PB0.5\":%d,\"PB1\":%d,\"PB2.5\":%d,\"PB5\":%d,\"PB10\":%d}"), pms_data.pm10_standard, pms_data.pm25_standard, pms_data.pm100_standard, pms_data.pm10_env, pms_data.pm25_env, pms_data.pm100_env, pms_data.particles_03um, pms_data.particles_05um, pms_data.particles_10um, pms_data.particles_25um, pms_data.particles_50um, pms_data.particles_100um); @@ -145,7 +145,7 @@ void PmsShow(bool json) #endif // USE_DOMOTICZ #ifdef USE_WEBSERVER } else { - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_PMS5003_SNS, mqtt_data, + WSContentSend_PD(HTTP_PMS5003_SNS, // pms_data.pm10_standard, pms_data.pm25_standard, pms_data.pm100_standard, pms_data.pm10_env, pms_data.pm25_env, pms_data.pm100_env, pms_data.particles_03um, pms_data.particles_05um, pms_data.particles_10um, pms_data.particles_25um, pms_data.particles_50um, pms_data.particles_100um); @@ -174,7 +174,7 @@ bool Xsns18(uint8_t function) PmsShow(1); break; #ifdef USE_WEBSERVER - case FUNC_WEB_APPEND: + case FUNC_WEB_SENSOR: PmsShow(0); break; #endif // USE_WEBSERVER diff --git a/sonoff/xsns_19_mgs.ino b/sonoff/xsns_19_mgs.ino index 13ab99bd6..30b979eaa 100644 --- a/sonoff/xsns_19_mgs.ino +++ b/sonoff/xsns_19_mgs.ino @@ -42,8 +42,7 @@ bool MGSPrepare(void) { gas.begin(MGS_SENSOR_ADDR); if (!gas.isError()) { - snprintf_P(log_data, sizeof(log_data), S_LOG_I2C_FOUND_AT, "MultiGasSensor", MGS_SENSOR_ADDR); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, S_LOG_I2C_FOUND_AT, "MultiGasSensor", MGS_SENSOR_ADDR); return true; } else { return false; @@ -58,31 +57,31 @@ char* measure_gas(int gas_type, char* buffer) } #ifdef USE_WEBSERVER -const char HTTP_MGS_GAS[] PROGMEM = "%s{s}MGS %s{m}%s " D_UNIT_PARTS_PER_MILLION "{e}"; // {s} = , {m} = , {e} = +const char HTTP_MGS_GAS[] PROGMEM = "{s}MGS %s{m}%s " D_UNIT_PARTS_PER_MILLION "{e}"; // {s} = , {m} = , {e} = #endif // USE_WEBSERVER void MGSShow(bool json) { char buffer[33]; if (json) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"MGS\":{\"NH3\":%s"), mqtt_data, measure_gas(NH3, buffer)); - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"CO\":%s"), mqtt_data, measure_gas(CO, buffer)); - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"NO2\":%s"), mqtt_data, measure_gas(NO2, buffer)); - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"C3H8\":%s"), mqtt_data, measure_gas(C3H8, buffer)); - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"C4H10\":%s"), mqtt_data, measure_gas(C4H10, buffer)); - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"CH4\":%s"), mqtt_data, measure_gas(GAS_CH4, buffer)); - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"H2\":%s"), mqtt_data, measure_gas(H2, buffer)); - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"C2H5OH\":%s}"), mqtt_data, measure_gas(C2H5OH, buffer)); + ResponseAppend_P(PSTR(",\"MGS\":{\"NH3\":%s"), measure_gas(NH3, buffer)); + ResponseAppend_P(PSTR(",\"CO\":%s"), measure_gas(CO, buffer)); + ResponseAppend_P(PSTR(",\"NO2\":%s"), measure_gas(NO2, buffer)); + ResponseAppend_P(PSTR(",\"C3H8\":%s"), measure_gas(C3H8, buffer)); + ResponseAppend_P(PSTR(",\"C4H10\":%s"), measure_gas(C4H10, buffer)); + ResponseAppend_P(PSTR(",\"CH4\":%s"), measure_gas(GAS_CH4, buffer)); + ResponseAppend_P(PSTR(",\"H2\":%s"), measure_gas(H2, buffer)); + ResponseAppend_P(PSTR(",\"C2H5OH\":%s}"), measure_gas(C2H5OH, buffer)); #ifdef USE_WEBSERVER } else { - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_MGS_GAS, mqtt_data, "NH3", measure_gas(NH3, buffer)); - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_MGS_GAS, mqtt_data, "CO", measure_gas(CO, buffer)); - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_MGS_GAS, mqtt_data, "NO2", measure_gas(NO2, buffer)); - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_MGS_GAS, mqtt_data, "C3H8", measure_gas(C3H8, buffer)); - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_MGS_GAS, mqtt_data, "C4H10", measure_gas(C4H10, buffer)); - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_MGS_GAS, mqtt_data, "CH4", measure_gas(GAS_CH4, buffer)); - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_MGS_GAS, mqtt_data, "H2", measure_gas(H2, buffer)); - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_MGS_GAS, mqtt_data, "C2H5OH", measure_gas(C2H5OH, buffer)); + WSContentSend_PD(HTTP_MGS_GAS, "NH3", measure_gas(NH3, buffer)); + WSContentSend_PD(HTTP_MGS_GAS, "CO", measure_gas(CO, buffer)); + WSContentSend_PD(HTTP_MGS_GAS, "NO2", measure_gas(NO2, buffer)); + WSContentSend_PD(HTTP_MGS_GAS, "C3H8", measure_gas(C3H8, buffer)); + WSContentSend_PD(HTTP_MGS_GAS, "C4H10", measure_gas(C4H10, buffer)); + WSContentSend_PD(HTTP_MGS_GAS, "CH4", measure_gas(GAS_CH4, buffer)); + WSContentSend_PD(HTTP_MGS_GAS, "H2", measure_gas(H2, buffer)); + WSContentSend_PD(HTTP_MGS_GAS, "C2H5OH", measure_gas(C2H5OH, buffer)); #endif // USE_WEBSERVER } } @@ -108,7 +107,7 @@ bool Xsns19(uint8_t function) if (detected) MGSShow(1); break; #ifdef USE_WEBSERVER - case FUNC_WEB_APPEND: + case FUNC_WEB_SENSOR: if (detected) MGSShow(0); break; #endif // USE_WEBSERVER diff --git a/sonoff/xsns_20_novasds.ino b/sonoff/xsns_20_novasds.ino index 72843f169..e9d955af3 100644 --- a/sonoff/xsns_20_novasds.ino +++ b/sonoff/xsns_20_novasds.ino @@ -47,13 +47,11 @@ #define NOVA_SDS_DEVICE_ID 0xFFFF // NodaSDS all sensor response #endif - TasmotaSerial *NovaSdsSerial; uint8_t novasds_type = 1; uint8_t novasds_valid = 0; - struct sds011data { uint16_t pm100; uint16_t pm25; @@ -82,10 +80,9 @@ bool NovaSdsCommand(uint8_t byte1, uint8_t byte2, uint8_t byte3, uint16_t sensor for (uint8_t i = 2; i < 17; i++) { novasds_cmnd[17] += novasds_cmnd[i]; } - //~ snprintf_P(log_data, sizeof(log_data), PSTR("SDS: Send %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X"), + //~ AddLog_P2(LOG_LEVEL_DEBUG, PSTR("SDS: Send %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X"), //~ novasds_cmnd[0],novasds_cmnd[1],novasds_cmnd[2],novasds_cmnd[3],novasds_cmnd[4],novasds_cmnd[5],novasds_cmnd[6],novasds_cmnd[7],novasds_cmnd[8],novasds_cmnd[9], //~ novasds_cmnd[10],novasds_cmnd[11],novasds_cmnd[12],novasds_cmnd[13],novasds_cmnd[14],novasds_cmnd[15],novasds_cmnd[16],novasds_cmnd[17],novasds_cmnd[18]); - //~ AddLog(LOG_LEVEL_DEBUG); // send cmnd NovaSdsSerial->write(novasds_cmnd, sizeof(novasds_cmnd)); NovaSdsSerial->flush(); @@ -110,7 +107,7 @@ bool NovaSdsCommand(uint8_t byte1, uint8_t byte2, uint8_t byte3, uint16_t sensor NovaSdsSerial->readBytes(&recbuf[1], 9); AddLogBuffer(LOG_LEVEL_DEBUG_MORE, recbuf, sizeof(recbuf)); - if ( NULL != buffer ) { + if ( nullptr != buffer ) { // return data to buffer memcpy(buffer, recbuf, sizeof(recbuf)); } @@ -127,9 +124,9 @@ bool NovaSdsCommand(uint8_t byte1, uint8_t byte2, uint8_t byte3, uint16_t sensor void NovaSdsSetWorkPeriod(void) { // set sensor working period - NovaSdsCommand(NOVA_SDS_WORKING_PERIOD, NOVA_SDS_SET_MODE, WORKING_PERIOD, NOVA_SDS_DEVICE_ID, NULL); + NovaSdsCommand(NOVA_SDS_WORKING_PERIOD, NOVA_SDS_SET_MODE, Settings.novasds_period, NOVA_SDS_DEVICE_ID, nullptr); // set sensor report only on query - NovaSdsCommand(NOVA_SDS_REPORTING_MODE, NOVA_SDS_SET_MODE, NOVA_SDS_REPORT_QUERY, NOVA_SDS_DEVICE_ID, NULL); + NovaSdsCommand(NOVA_SDS_REPORTING_MODE, NOVA_SDS_SET_MODE, NOVA_SDS_REPORT_QUERY, NOVA_SDS_DEVICE_ID, nullptr); } bool NovaSdsReadData(void) @@ -163,7 +160,22 @@ void NovaSdsSecond(void) // Every second } } -/*********************************************************************************************/ +/*********************************************************************************************\ + * Command Sensor20 + * + * 1 .. 255 - Set working period in minutes +\*********************************************************************************************/ + +bool NovaSdsCommandSensor(void) +{ + if ((XdrvMailbox.payload > 0) && (XdrvMailbox.payload < 256)) { + Settings.novasds_period = XdrvMailbox.payload; + NovaSdsSetWorkPeriod(); + } + Response_P(S_JSON_SENSOR_INDEX_NVALUE, XSNS_20, Settings.novasds_period); + + return true; +} void NovaSdsInit(void) { @@ -181,7 +193,7 @@ void NovaSdsInit(void) } #ifdef USE_WEBSERVER -const char HTTP_SDS0X1_SNS[] PROGMEM = "%s" +const char HTTP_SDS0X1_SNS[] PROGMEM = "{s}SDS0X1 " D_ENVIRONMENTAL_CONCENTRATION " 2.5 " D_UNIT_MICROMETER "{m}%s " D_UNIT_MICROGRAM_PER_CUBIC_METER "{e}" "{s}SDS0X1 " D_ENVIRONMENTAL_CONCENTRATION " 10 " D_UNIT_MICROMETER "{m}%s " D_UNIT_MICROGRAM_PER_CUBIC_METER "{e}"; // {s} = , {m} = , {e} = #endif // USE_WEBSERVER @@ -196,7 +208,7 @@ void NovaSdsShow(bool json) char pm2_5[33]; dtostrfd(pm2_5f, 1, pm2_5); if (json) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"SDS0X1\":{\"PM2.5\":%s,\"PM10\":%s}"), mqtt_data, pm2_5, pm10); + ResponseAppend_P(PSTR(",\"SDS0X1\":{\"PM2.5\":%s,\"PM10\":%s}"), pm2_5, pm10); #ifdef USE_DOMOTICZ if (0 == tele_period) { DomoticzSensor(DZ_VOLTAGE, pm2_5); // PM2.5 @@ -205,7 +217,7 @@ void NovaSdsShow(bool json) #endif // USE_DOMOTICZ #ifdef USE_WEBSERVER } else { - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SDS0X1_SNS, mqtt_data, pm2_5, pm10); + WSContentSend_PD(HTTP_SDS0X1_SNS, pm2_5, pm10); #endif // USE_WEBSERVER } } @@ -227,11 +239,16 @@ bool Xsns20(uint8_t function) case FUNC_EVERY_SECOND: NovaSdsSecond(); break; + case FUNC_COMMAND_SENSOR: + if (XSNS_20 == XdrvMailbox.index) { + result = NovaSdsCommandSensor(); + } + break; case FUNC_JSON_APPEND: NovaSdsShow(1); break; #ifdef USE_WEBSERVER - case FUNC_WEB_APPEND: + case FUNC_WEB_SENSOR: NovaSdsShow(0); break; #endif // USE_WEBSERVER diff --git a/sonoff/xsns_21_sgp30.ino b/sonoff/xsns_21_sgp30.ino index 2f7bf4673..d8241f1d6 100644 --- a/sonoff/xsns_21_sgp30.ino +++ b/sonoff/xsns_21_sgp30.ino @@ -44,10 +44,8 @@ void Sgp30Update(void) // Perform every second to ensure proper operation of th if (!sgp30_type) { if (sgp.begin()) { sgp30_type = 1; -// snprintf_P(log_data, sizeof(log_data), PSTR("SGP: Serialnumber 0x%04X-0x%04X-0x%04X"), sgp.serialnumber[0], sgp.serialnumber[1], sgp.serialnumber[2]); -// AddLog(LOG_LEVEL_DEBUG); - snprintf_P(log_data, sizeof(log_data), S_LOG_I2C_FOUND_AT, "SGP30", 0x58); - AddLog(LOG_LEVEL_DEBUG); +// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("SGP: Serialnumber 0x%04X-0x%04X-0x%04X"), sgp.serialnumber[0], sgp.serialnumber[1], sgp.serialnumber[2]); + AddLog_P2(LOG_LEVEL_DEBUG, S_LOG_I2C_FOUND_AT, "SGP30", 0x58); } } else { if (!sgp.IAQmeasure()) return; // Measurement failed @@ -59,14 +57,13 @@ void Sgp30Update(void) // Perform every second to ensure proper operation of th uint16_t eCO2_base; if (!sgp.getIAQBaseline(&eCO2_base, &TVOC_base)) return; // Failed to get baseline readings -// snprintf_P(log_data, sizeof(log_data), PSTR("SGP: Baseline values eCO2 0x%04X, TVOC 0x%04X"), eCO2_base, TVOC_base); -// AddLog(LOG_LEVEL_DEBUG); +// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("SGP: Baseline values eCO2 0x%04X, TVOC 0x%04X"), eCO2_base, TVOC_base); } sgp30_ready = 1; } } -const char HTTP_SNS_SGP30[] PROGMEM = "%s" +const char HTTP_SNS_SGP30[] PROGMEM = "{s}SGP30 " D_ECO2 "{m}%d " D_UNIT_PARTS_PER_MILLION "{e}" // {s} = , {m} = , {e} = "{s}SGP30 " D_TVOC "{m}%d " D_UNIT_PARTS_PER_BILLION "{e}"; @@ -74,13 +71,13 @@ void Sgp30Show(bool json) { if (sgp30_ready) { if (json) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"SGP30\":{\"" D_JSON_ECO2 "\":%d,\"" D_JSON_TVOC "\":%d}"), mqtt_data, sgp.eCO2, sgp.TVOC); + ResponseAppend_P(PSTR(",\"SGP30\":{\"" D_JSON_ECO2 "\":%d,\"" D_JSON_TVOC "\":%d}"), sgp.eCO2, sgp.TVOC); #ifdef USE_DOMOTICZ if (0 == tele_period) DomoticzSensor(DZ_AIRQUALITY, sgp.eCO2); #endif // USE_DOMOTICZ #ifdef USE_WEBSERVER } else { - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_SGP30, mqtt_data, sgp.eCO2, sgp.TVOC); + WSContentSend_PD(HTTP_SNS_SGP30, sgp.eCO2, sgp.TVOC); #endif } } @@ -103,7 +100,7 @@ bool Xsns21(uint8_t function) Sgp30Show(1); break; #ifdef USE_WEBSERVER - case FUNC_WEB_APPEND: + case FUNC_WEB_SENSOR: Sgp30Show(0); break; #endif // USE_WEBSERVER diff --git a/sonoff/xsns_22_sr04.ino b/sonoff/xsns_22_sr04.ino index ee4939bba..f475790ae 100644 --- a/sonoff/xsns_22_sr04.ino +++ b/sonoff/xsns_22_sr04.ino @@ -28,11 +28,13 @@ * - https://www.dfrobot.com/wiki/index.php/Weather-proof_Ultrasonic_Sensor_SKU_:_SEN0207 \*********************************************************************************************/ +#define XSNS_22 22 + uint8_t sr04_echo_pin = 0; uint8_t sr04_trig_pin = 0; real64_t distance; -NewPing* sonar = NULL; +NewPing* sonar = nullptr; void Sr04Init(void) { @@ -43,7 +45,7 @@ void Sr04Init(void) #ifdef USE_WEBSERVER const char HTTP_SNS_DISTANCE[] PROGMEM = - "%s{s}SR04 " D_DISTANCE "{m}%s" D_UNIT_CENTIMETER "{e}"; // {s} = , {m} = , {e} = + "{s}SR04 " D_DISTANCE "{m}%s" D_UNIT_CENTIMETER "{e}"; // {s} = , {m} = , {e} = #endif // USE_WEBSERVER void Sr04Show(bool json) @@ -55,7 +57,7 @@ void Sr04Show(bool json) dtostrfd(distance, 3, distance_chr); if(json) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"SR04\":{\"" D_JSON_DISTANCE "\":%s}"), mqtt_data, distance_chr); + ResponseAppend_P(PSTR(",\"SR04\":{\"" D_JSON_DISTANCE "\":%s}"), distance_chr); #ifdef USE_DOMOTICZ if (0 == tele_period) { DomoticzSensor(DZ_COUNT, distance_chr); // Send distance as Domoticz Counter value @@ -63,7 +65,7 @@ void Sr04Show(bool json) #endif // USE_DOMOTICZ #ifdef USE_WEBSERVER } else { - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_DISTANCE, mqtt_data, distance_chr); + WSContentSend_PD(HTTP_SNS_DISTANCE, distance_chr); #endif // USE_WEBSERVER } } @@ -73,8 +75,6 @@ void Sr04Show(bool json) * Interface \*********************************************************************************************/ -#define XSNS_22 - bool Xsns22(uint8_t function) { bool result = false; @@ -88,7 +88,7 @@ bool Xsns22(uint8_t function) Sr04Show(1); break; #ifdef USE_WEBSERVER - case FUNC_WEB_APPEND: + case FUNC_WEB_SENSOR: Sr04Show(0); break; #endif // USE_WEBSERVER diff --git a/sonoff/xsns_23_sdm120.ino b/sonoff/xsns_23_sdm120.ino index ec4891183..8f0b6b74f 100644 --- a/sonoff/xsns_23_sdm120.ino +++ b/sonoff/xsns_23_sdm120.ino @@ -165,8 +165,7 @@ void SDM120250ms(void) // Every 250 mSec if (data_ready) { uint8_t error = SDM120_ModbusReceive(&value); if (error) { - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_DEBUG "SDM120 response error %d"), error); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "SDM120 response error %d"), error); } else { switch(sdm120_read_state) { case 0: @@ -261,7 +260,7 @@ void SDM120Init(void) } #ifdef USE_WEBSERVER -const char HTTP_SNS_SDM120_DATA[] PROGMEM = "%s" +const char HTTP_SNS_SDM120_DATA[] PROGMEM = "{s}SDM120 " D_VOLTAGE "{m}%s " D_UNIT_VOLT "{e}" "{s}SDM120 " D_CURRENT "{m}%s " D_UNIT_AMPERE "{e}" "{s}SDM120 " D_POWERUSAGE_ACTIVE "{m}%s " D_UNIT_WATT "{e}" @@ -315,11 +314,11 @@ void SDM120Show(bool json) #endif // USE_SDM220 if (json) { #ifdef USE_SDM220 - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"" D_RSLT_ENERGY "\":{\"" D_JSON_TOTAL "\":%s,\"" D_JSON_ACTIVE_POWERUSAGE "\":%s,\"" D_JSON_APPARENT_POWERUSAGE "\":%s,\"" D_JSON_REACTIVE_POWERUSAGE "\":%s,\"" D_JSON_FREQUENCY "\":%s,\"" D_JSON_POWERFACTOR "\":%s,\"" D_JSON_VOLTAGE "\":%s,\"" D_JSON_CURRENT "\":%s,\"" D_JSON_PHASE_ANGLE "\":%s,\"" D_JSON_IMPORT_ACTIVE "\":%s,\"" D_JSON_EXPORT_ACTIVE "\":%s,\"" D_JSON_IMPORT_REACTIVE "\":%s,\"" D_JSON_EXPORT_REACTIVE "\":%s,\"" D_JSON_TOTAL_REACTIVE "\":%s}"), - mqtt_data, energy_total, active_power, apparent_power, reactive_power, frequency, power_factor, voltage, current, phase_angle, import_active, export_active, import_reactive, export_reactive, total_reactive); + ResponseAppend_P(PSTR(",\"" D_RSLT_ENERGY "\":{\"" D_JSON_TOTAL "\":%s,\"" D_JSON_ACTIVE_POWERUSAGE "\":%s,\"" D_JSON_APPARENT_POWERUSAGE "\":%s,\"" D_JSON_REACTIVE_POWERUSAGE "\":%s,\"" D_JSON_FREQUENCY "\":%s,\"" D_JSON_POWERFACTOR "\":%s,\"" D_JSON_VOLTAGE "\":%s,\"" D_JSON_CURRENT "\":%s,\"" D_JSON_PHASE_ANGLE "\":%s,\"" D_JSON_IMPORT_ACTIVE "\":%s,\"" D_JSON_EXPORT_ACTIVE "\":%s,\"" D_JSON_IMPORT_REACTIVE "\":%s,\"" D_JSON_EXPORT_REACTIVE "\":%s,\"" D_JSON_TOTAL_REACTIVE "\":%s}"), + energy_total, active_power, apparent_power, reactive_power, frequency, power_factor, voltage, current, phase_angle, import_active, export_active, import_reactive, export_reactive, total_reactive); #else - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"" D_RSLT_ENERGY "\":{\"" D_JSON_TOTAL "\":%s,\"" D_JSON_ACTIVE_POWERUSAGE "\":%s,\"" D_JSON_APPARENT_POWERUSAGE "\":%s,\"" D_JSON_REACTIVE_POWERUSAGE "\":%s,\"" D_JSON_FREQUENCY "\":%s,\"" D_JSON_POWERFACTOR "\":%s,\"" D_JSON_VOLTAGE "\":%s,\"" D_JSON_CURRENT "\":%s}"), - mqtt_data, energy_total, active_power, apparent_power, reactive_power, frequency, power_factor, voltage, current); + ResponseAppend_P(PSTR(",\"" D_RSLT_ENERGY "\":{\"" D_JSON_TOTAL "\":%s,\"" D_JSON_ACTIVE_POWERUSAGE "\":%s,\"" D_JSON_APPARENT_POWERUSAGE "\":%s,\"" D_JSON_REACTIVE_POWERUSAGE "\":%s,\"" D_JSON_FREQUENCY "\":%s,\"" D_JSON_POWERFACTOR "\":%s,\"" D_JSON_VOLTAGE "\":%s,\"" D_JSON_CURRENT "\":%s}"), + energy_total, active_power, apparent_power, reactive_power, frequency, power_factor, voltage, current); #endif // USE_SDM220 #ifdef USE_DOMOTICZ if (0 == tele_period) { @@ -331,9 +330,9 @@ void SDM120Show(bool json) #ifdef USE_WEBSERVER } else { #ifdef USE_SDM220 - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_SDM120_DATA, mqtt_data, voltage, current, active_power, apparent_power, reactive_power, power_factor, frequency, energy_total, phase_angle,import_active,export_active,import_reactive,export_reactive,total_reactive); + WSContentSend_PD(HTTP_SNS_SDM120_DATA, voltage, current, active_power, apparent_power, reactive_power, power_factor, frequency, energy_total, phase_angle,import_active,export_active,import_reactive,export_reactive,total_reactive); #else - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_SDM120_DATA, mqtt_data, voltage, current, active_power, apparent_power, reactive_power, power_factor, frequency, energy_total); + WSContentSend_PD(HTTP_SNS_SDM120_DATA, voltage, current, active_power, apparent_power, reactive_power, power_factor, frequency, energy_total); #endif // USE_SDM220 #endif // USE_WEBSERVER } @@ -359,7 +358,7 @@ bool Xsns23(uint8_t function) SDM120Show(1); break; #ifdef USE_WEBSERVER - case FUNC_WEB_APPEND: + case FUNC_WEB_SENSOR: SDM120Show(0); break; #endif // USE_WEBSERVER diff --git a/sonoff/xsns_24_si1145.ino b/sonoff/xsns_24_si1145.ino index 85f2297aa..2a1c26cd5 100644 --- a/sonoff/xsns_24_si1145.ino +++ b/sonoff/xsns_24_si1145.ino @@ -310,14 +310,13 @@ void Si1145Update(void) if (!si1145_type) { if (Si1145Begin()) { si1145_type = 1; - snprintf_P(log_data, sizeof(log_data), S_LOG_I2C_FOUND_AT, "SI1145", SI114X_ADDR); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, S_LOG_I2C_FOUND_AT, "SI1145", SI114X_ADDR); } } } #ifdef USE_WEBSERVER -const char HTTP_SNS_SI1145[] PROGMEM = "%s" +const char HTTP_SNS_SI1145[] PROGMEM = "{s}SI1145 " D_ILLUMINANCE "{m}%d " D_UNIT_LUX "{e}" // {s} = , {m} = , {e} = "{s}SI1145 " D_INFRARED "{m}%d " D_UNIT_LUX "{e}" "{s}SI1145 " D_UV_INDEX "{m}%d.%d{e}"; @@ -330,14 +329,14 @@ void Si1145Show(bool json) uint16_t infrared = Si1145ReadIR(); uint16_t uvindex = Si1145ReadUV(); if (json) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"SI1145\":{\"" D_JSON_ILLUMINANCE "\":%d,\"" D_JSON_INFRARED "\":%d,\"" D_JSON_UV_INDEX "\":%d.%d}"), - mqtt_data, visible, infrared, uvindex /100, uvindex %100); + ResponseAppend_P(PSTR(",\"SI1145\":{\"" D_JSON_ILLUMINANCE "\":%d,\"" D_JSON_INFRARED "\":%d,\"" D_JSON_UV_INDEX "\":%d.%d}"), + visible, infrared, uvindex /100, uvindex %100); #ifdef USE_DOMOTICZ if (0 == tele_period) DomoticzSensor(DZ_ILLUMINANCE, visible); #endif // USE_DOMOTICZ #ifdef USE_WEBSERVER } else { - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_SI1145, mqtt_data, visible, infrared, uvindex /100, uvindex %100); + WSContentSend_PD(HTTP_SNS_SI1145, visible, infrared, uvindex /100, uvindex %100); #endif } } else { @@ -362,7 +361,7 @@ bool Xsns24(uint8_t function) Si1145Show(1); break; #ifdef USE_WEBSERVER - case FUNC_WEB_APPEND: + case FUNC_WEB_SENSOR: Si1145Show(0); break; #endif // USE_WEBSERVER diff --git a/sonoff/xsns_25_sdm630.ino b/sonoff/xsns_25_sdm630.ino index 41f83ec93..c71009ce4 100644 --- a/sonoff/xsns_25_sdm630.ino +++ b/sonoff/xsns_25_sdm630.ino @@ -155,8 +155,7 @@ void SDM630250ms(void) // Every 250 mSec if (data_ready) { uint8_t error = SDM630_ModbusReceive(&value); if (error) { - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_DEBUG "SDM630 response error %d"), error); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "SDM630 response error %d"), error); } else { switch(sdm630_read_state) { case 0: @@ -258,7 +257,7 @@ void SDM630Init(void) } #ifdef USE_WEBSERVER -const char HTTP_SNS_SDM630_DATA[] PROGMEM = "%s" +const char HTTP_SNS_SDM630_DATA[] PROGMEM = "{s}SDM630 " D_VOLTAGE "{m}%s/%s/%s " D_UNIT_VOLT "{e}" "{s}SDM630 " D_CURRENT "{m}%s/%s/%s " D_UNIT_AMPERE "{e}" "{s}SDM630 " D_POWERUSAGE_ACTIVE "{m}%s/%s/%s " D_UNIT_WATT "{e}" @@ -303,17 +302,17 @@ void SDM630Show(bool json) dtostrfd(sdm630_energy_total, Settings.flag2.energy_resolution, energy_total); if (json) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"" D_RSLT_ENERGY "\":{\"" D_JSON_TOTAL "\":%s,\"" + ResponseAppend_P(PSTR(",\"" D_RSLT_ENERGY "\":{\"" D_JSON_TOTAL "\":%s,\"" D_JSON_ACTIVE_POWERUSAGE "\":[%s,%s,%s],\"" D_JSON_REACTIVE_POWERUSAGE "\":[%s,%s,%s],\"" D_JSON_POWERFACTOR "\":[%s,%s,%s],\"" D_JSON_VOLTAGE "\":[%s,%s,%s],\"" D_JSON_CURRENT "\":[%s,%s,%s]}"), - mqtt_data, energy_total, active_power_l1, active_power_l2, active_power_l3, + energy_total, active_power_l1, active_power_l2, active_power_l3, reactive_power_l1, reactive_power_l2, reactive_power_l3, power_factor_l1, power_factor_l2, power_factor_l3, voltage_l1, voltage_l2, voltage_l3, current_l1, current_l2, current_l3); #ifdef USE_WEBSERVER } else { - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_SDM630_DATA, mqtt_data, + WSContentSend_PD(HTTP_SNS_SDM630_DATA, voltage_l1, voltage_l2, voltage_l3, current_l1, current_l2, current_l3, active_power_l1, active_power_l2, active_power_l3, reactive_power_l1, reactive_power_l2, reactive_power_l3, @@ -342,7 +341,7 @@ bool Xsns25(uint8_t function) SDM630Show(1); break; #ifdef USE_WEBSERVER - case FUNC_WEB_APPEND: + case FUNC_WEB_SENSOR: SDM630Show(0); break; #endif // USE_WEBSERVER diff --git a/sonoff/xsns_26_lm75ad.ino b/sonoff/xsns_26_lm75ad.ino index 31aba77b8..88769b3aa 100644 --- a/sonoff/xsns_26_lm75ad.ino +++ b/sonoff/xsns_26_lm75ad.ino @@ -58,8 +58,7 @@ void LM75ADDetect(void) if (I2cValidRead16(&buffer, lm75ad_address, LM75_THYST_REGISTER)) { if (buffer == 0x4B00) { lm75ad_type = 1; - snprintf_P(log_data, sizeof(log_data), S_LOG_I2C_FOUND_AT, "LM75AD", lm75ad_address); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, S_LOG_I2C_FOUND_AT, "LM75AD", lm75ad_address); break; } } @@ -86,13 +85,13 @@ void LM75ADShow(bool json) dtostrfd(t, Settings.flag2.temperature_resolution, temperature); if (json) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"LM75AD\":{\"" D_JSON_TEMPERATURE "\":%s}"), mqtt_data, temperature); + ResponseAppend_P(PSTR(",\"LM75AD\":{\"" D_JSON_TEMPERATURE "\":%s}"), temperature); #ifdef USE_DOMOTICZ if (0 == tele_period) DomoticzSensor(DZ_TEMP, temperature); #endif // USE_DOMOTICZ #ifdef USE_WEBSERVER } else { - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_TEMP, mqtt_data, "LM75AD", temperature, TempUnit()); + WSContentSend_PD(HTTP_SNS_TEMP, "LM75AD", temperature, TempUnit()); #endif // USE_WEBSERVER } } @@ -115,7 +114,7 @@ bool Xsns26(uint8_t function) LM75ADShow(1); break; #ifdef USE_WEBSERVER - case FUNC_WEB_APPEND: + case FUNC_WEB_SENSOR: LM75ADShow(0); break; #endif // USE_WEBSERVER diff --git a/sonoff/xsns_27_apds9960.ino b/sonoff/xsns_27_apds9960.ino index 90978db7f..7594a5322 100644 --- a/sonoff/xsns_27_apds9960.ino +++ b/sonoff/xsns_27_apds9960.ino @@ -77,7 +77,7 @@ volatile uint8_t recovery_loop_counter = 0; //count number of stateloops to swi bool APDS9960_overload = false; #ifdef USE_WEBSERVER -const char HTTP_APDS_9960_SNS[] PROGMEM = "%s" +const char HTTP_APDS_9960_SNS[] PROGMEM = "{s}" "Red" "{m}%s{e}" "{s}" "Green" "{m}%s{e}" "{s}" "Blue" "{m}%s{e}" @@ -1518,8 +1518,7 @@ int16_t readGesture(void) if (gesture_loop_counter == APDS9960_MAX_GESTURE_CYCLES){ // We will escape after a few loops disableGestureSensor(); // stop the sensor to prevent problems with power consumption/blocking and return to the main loop APDS9960_overload = true; // we report this as "long"-gesture - snprintf_P(log_data, sizeof(log_data), PSTR("Sensor overload")); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P(LOG_LEVEL_DEBUG, PSTR("Sensor overload")); } gesture_loop_counter += 1; /* Wait some time to collect next batch of FIFO data */ @@ -1794,33 +1793,32 @@ void handleGesture(void) { if (isGestureAvailable() ) { switch (readGesture()) { case DIR_UP: - snprintf_P(log_data, sizeof(log_data), PSTR("UP")); + AddLog_P(LOG_LEVEL_DEBUG, PSTR("UP")); snprintf_P(currentGesture, sizeof(currentGesture), PSTR("Up")); break; case DIR_DOWN: - snprintf_P(log_data, sizeof(log_data), PSTR("DOWN")); + AddLog_P(LOG_LEVEL_DEBUG, PSTR("DOWN")); snprintf_P(currentGesture, sizeof(currentGesture), PSTR("Down")); break; case DIR_LEFT: - snprintf_P(log_data, sizeof(log_data), PSTR("LEFT")); + AddLog_P(LOG_LEVEL_DEBUG, PSTR("LEFT")); snprintf_P(currentGesture, sizeof(currentGesture), PSTR("Left")); break; case DIR_RIGHT: - snprintf_P(log_data, sizeof(log_data), PSTR("RIGHT")); + AddLog_P(LOG_LEVEL_DEBUG, PSTR("RIGHT")); snprintf_P(currentGesture, sizeof(currentGesture), PSTR("Right")); break; default: if(APDS9960_overload) { - snprintf_P(log_data, sizeof(log_data), PSTR("LONG")); + AddLog_P(LOG_LEVEL_DEBUG, PSTR("LONG")); snprintf_P(currentGesture, sizeof(currentGesture), PSTR("Long")); } else{ - snprintf_P(log_data, sizeof(log_data), PSTR("NONE")); + AddLog_P(LOG_LEVEL_DEBUG, PSTR("NONE")); snprintf_P(currentGesture, sizeof(currentGesture), PSTR("None")); } } - AddLog(LOG_LEVEL_DEBUG); mqtt_data[0] = '\0'; if (MqttShowSensor()) { @@ -1876,7 +1874,7 @@ void APDS9960_loop(void) if (recovery_loop_counter == 1 && APDS9960_overload){ //restart sensor just before the end of recovery from long press enableGestureSensor(); APDS9960_overload = false; - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"Gesture\":\"On\"}")); + Response_P(PSTR("{\"Gesture\":\"On\"}")); MqttPublishPrefixTopic_P(RESULT_OR_TELE, mqtt_data); // only after the long break we report, that we are online again gesture_mode = 1; } @@ -1889,7 +1887,7 @@ void APDS9960_loop(void) { disableGestureSensor(); recovery_loop_counter = APDS9960_LONG_RECOVERY; // long pause after overload/long press - number of stateloops - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"Gesture\":\"Off\"}")); + Response_P(PSTR("{\"Gesture\":\"Off\"}")); MqttPublishPrefixTopic_P(RESULT_OR_TELE, mqtt_data); gesture_mode = 0; } @@ -1908,8 +1906,7 @@ bool APDS9960_detect(void) if (APDS9960type == APDS9960_CHIPID_1 || APDS9960type == APDS9960_CHIPID_2) { strcpy_P(APDS9960stype, PSTR("APDS9960")); - snprintf_P(log_data, sizeof(log_data), S_LOG_I2C_FOUND_AT, APDS9960stype, APDS9960_I2C_ADDR); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, S_LOG_I2C_FOUND_AT, APDS9960stype, APDS9960_I2C_ADDR); if (APDS9960_init()) { success = true; AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "APDS9960 initialized")); @@ -1919,12 +1916,10 @@ bool APDS9960_detect(void) } else { if (APDS9960type == APDS9930_CHIPID_1 || APDS9960type == APDS9930_CHIPID_2) { - snprintf_P(log_data, sizeof(log_data), PSTR("APDS9930 found at address 0x%x, unsupported chip"), APDS9960_I2C_ADDR); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR("APDS9930 found at address 0x%x, unsupported chip"), APDS9960_I2C_ADDR); } else{ - snprintf_P(log_data, sizeof(log_data), PSTR("APDS9960 not found at address 0x%x"), APDS9960_I2C_ADDR); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR("APDS9960 not found at address 0x%x"), APDS9960_I2C_ADDR); } } currentGesture[0] = '\0'; @@ -1964,17 +1959,17 @@ void APDS9960_show(bool json) sprintf (cct_chr, "%u", color_data.cct); if (json) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"%s\":{\"Red\":%s,\"Green\":%s,\"Blue\":%s,\"Ambient\":%s,\"CCT\":%s,\"Proximity\":%s}"), - mqtt_data, APDS9960stype, red_chr, green_chr, blue_chr, ambient_chr, cct_chr, prox_chr); + ResponseAppend_P(PSTR(",\"%s\":{\"Red\":%s,\"Green\":%s,\"Blue\":%s,\"Ambient\":%s,\"CCT\":%s,\"Proximity\":%s}"), + APDS9960stype, red_chr, green_chr, blue_chr, ambient_chr, cct_chr, prox_chr); #ifdef USE_WEBSERVER } else { - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_APDS_9960_SNS, mqtt_data, red_chr, green_chr, blue_chr, ambient_chr, cct_chr, prox_chr ); + WSContentSend_PD(HTTP_APDS_9960_SNS, red_chr, green_chr, blue_chr, ambient_chr, cct_chr, prox_chr ); #endif // USE_WEBSERVER } } else { if (json && (currentGesture[0] != '\0' )) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"%s\":{\"%s\":1}"), mqtt_data, APDS9960stype, currentGesture); + ResponseAppend_P(PSTR(",\"%s\":{\"%s\":1}"), APDS9960stype, currentGesture); currentGesture[0] = '\0'; } } @@ -2030,7 +2025,7 @@ bool APDS9960CommandSensor(void) } break; } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_SENSOR_INDEX_SVALUE, XSNS_27, GetStateText(gesture_mode)); + Response_P(S_JSON_SENSOR_INDEX_SVALUE, XSNS_27, GetStateText(gesture_mode)); return serviced; } @@ -2051,7 +2046,7 @@ bool Xsns27(uint8_t function) case FUNC_EVERY_50_MSECOND: APDS9960_loop(); break; - case FUNC_COMMAND: + case FUNC_COMMAND_SENSOR: if (XSNS_27 == XdrvMailbox.index) { result = APDS9960CommandSensor(); } @@ -2060,7 +2055,7 @@ bool Xsns27(uint8_t function) APDS9960_show(1); break; #ifdef USE_WEBSERVER - case FUNC_WEB_APPEND: + case FUNC_WEB_SENSOR: APDS9960_show(0); break; #endif // USE_WEBSERVER diff --git a/sonoff/xsns_28_tm1638.ino b/sonoff/xsns_28_tm1638.ino index 590432dfd..05e756966 100644 --- a/sonoff/xsns_28_tm1638.ino +++ b/sonoff/xsns_28_tm1638.ino @@ -215,7 +215,7 @@ bool Xsns28(uint8_t function) TmShow(1); break; #ifdef USE_WEBSERVER - case FUNC_WEB_APPEND: + case FUNC_WEB_SENSOR: TmShow(0); break; #endif // USE_WEBSERVER diff --git a/sonoff/xsns_29_mcp230xx.ino b/sonoff/xsns_29_mcp230xx.ino index 559b3e809..bef4e1738 100644 --- a/sonoff/xsns_29_mcp230xx.ino +++ b/sonoff/xsns_29_mcp230xx.ino @@ -81,7 +81,7 @@ void MCP230xx_CheckForIntCounter(void) { } } } - + void MCP230xx_CheckForIntRetainer(void) { uint8_t en = 0; for (uint8_t ca=0;ca<16;ca++) { @@ -210,15 +210,13 @@ void MCP230xx_Detect(void) if (I2cValidRead8(&buffer, USE_MCP230xx_ADDR, MCP230xx_IOCON)) { if (0x00 == buffer) { mcp230xx_type = 1; // We have a MCP23008 - snprintf_P(log_data, sizeof(log_data), S_LOG_I2C_FOUND_AT, "MCP23008", USE_MCP230xx_ADDR); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, S_LOG_I2C_FOUND_AT, "MCP23008", USE_MCP230xx_ADDR); mcp230xx_pincount = 8; MCP230xx_ApplySettings(); } else { if (0x80 == buffer) { mcp230xx_type = 2; // We have a MCP23017 - snprintf_P(log_data, sizeof(log_data), S_LOG_I2C_FOUND_AT, "MCP23017", USE_MCP230xx_ADDR); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, S_LOG_I2C_FOUND_AT, "MCP23017", USE_MCP230xx_ADDR); mcp230xx_pincount = 16; // Reset bank mode to 0 I2cWrite8(USE_MCP230xx_ADDR, MCP230xx_IOCON, 0x00); @@ -305,9 +303,8 @@ void MCP230xx_CheckForInterrupt(void) { break; } if (int_tele) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_JSON_TIME "\":\"%s\""), GetDateAndTime(DT_LOCAL).c_str()); - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"MCP230XX_INT\":{\"D%i\":%i,\"MS\":%lu}"), mqtt_data, intp+(mcp230xx_port*8), ((mcp230xx_intcap >> intp) & 0x01),millis_since_last_int); - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s}"), mqtt_data); + Response_P(PSTR("{\"" D_JSON_TIME "\":\"%s\",\"MCP230XX_INT\":{\"D%i\":%i,\"MS\":%lu}}"), + GetDateAndTime(DT_LOCAL).c_str(), intp+(mcp230xx_port*8), ((mcp230xx_intcap >> intp) & 0x01),millis_since_last_int); MqttPublishPrefixTopic_P(RESULT_OR_STAT, PSTR("MCP230XX_INT")); } if (int_event) { @@ -331,14 +328,14 @@ void MCP230xx_Show(bool json) if (json) { if (mcp230xx_type > 0) { // we have at least 8 pins uint8_t gpio = MCP230xx_readGPIO(0); - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"MCP230XX\":{\"D0\":%i,\"D1\":%i,\"D2\":%i,\"D3\":%i,\"D4\":%i,\"D5\":%i,\"D6\":%i,\"D7\":%i"), - mqtt_data,(gpio>>0)&1,(gpio>>1)&1,(gpio>>2)&1,(gpio>>3)&1,(gpio>>4)&1,(gpio>>5)&1,(gpio>>6)&1,(gpio>>7)&1); + ResponseAppend_P(PSTR(",\"MCP230XX\":{\"D0\":%i,\"D1\":%i,\"D2\":%i,\"D3\":%i,\"D4\":%i,\"D5\":%i,\"D6\":%i,\"D7\":%i"), + (gpio>>0)&1,(gpio>>1)&1,(gpio>>2)&1,(gpio>>3)&1,(gpio>>4)&1,(gpio>>5)&1,(gpio>>6)&1,(gpio>>7)&1); if (2 == mcp230xx_type) { gpio = MCP230xx_readGPIO(1); - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"D8\":%i,\"D9\":%i,\"D10\":%i,\"D11\":%i,\"D12\":%i,\"D13\":%i,\"D14\":%i,\"D15\":%i"), - mqtt_data,(gpio>>0)&1,(gpio>>1)&1,(gpio>>2)&1,(gpio>>3)&1,(gpio>>4)&1,(gpio>>5)&1,(gpio>>6)&1,(gpio>>7)&1); + ResponseAppend_P(PSTR(",\"D8\":%i,\"D9\":%i,\"D10\":%i,\"D11\":%i,\"D12\":%i,\"D13\":%i,\"D14\":%i,\"D15\":%i"), + (gpio>>0)&1,(gpio>>1)&1,(gpio>>2)&1,(gpio>>3)&1,(gpio>>4)&1,(gpio>>5)&1,(gpio>>6)&1,(gpio>>7)&1); } - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s%s"),mqtt_data,"}"); + ResponseAppend_P(PSTR("}")); } } } @@ -386,9 +383,9 @@ void MCP230xx_SetOutPin(uint8_t pin,uint8_t pinstate) { if (interlock && (pinmo == Settings.mcp230xx_config[pin+pinadd].pinmode)) { char stt1[4]; sprintf(stt1,ConvertNumTxt((portpins >> (pin+pinadd-(port*8))&1), pinmo)); - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"S29cmnd_D%i\":{\"COMMAND\":\"%s\",\"STATE\":\"%s\"},\"S29cmnd_D%i\":{\"STATE\":\"%s\"}}"),pin, cmnd, stt, pin+pinadd, stt1); + Response_P(PSTR("{\"S29cmnd_D%i\":{\"COMMAND\":\"%s\",\"STATE\":\"%s\"},\"S29cmnd_D%i\":{\"STATE\":\"%s\"}}"),pin, cmnd, stt, pin+pinadd, stt1); } else { - snprintf_P(mqtt_data, sizeof(mqtt_data), MCP230XX_CMND_RESPONSE, pin, cmnd, stt); + Response_P(MCP230XX_CMND_RESPONSE, pin, cmnd, stt); } } @@ -422,7 +419,7 @@ void MCP230xx_Reset(uint8_t pinmode) { uint8_t intmode = 3; if ((pinmode > 1) && (pinmode < 5)) { intmode = 0; } sprintf(intmodetxt,IntModeTxt(intmode)); - snprintf_P(mqtt_data, sizeof(mqtt_data), MCP230XX_SENSOR_RESPONSE,99,pinmode,pulluptxt,intmodetxt,""); + Response_P(MCP230XX_SENSOR_RESPONSE,99,pinmode,pulluptxt,intmodetxt,""); } bool MCP230xx_Command(void) { @@ -456,11 +453,11 @@ bool MCP230xx_Command(void) { uint8_t intpri = atoi(subStr(sub_string, XdrvMailbox.data, ",", 2)); if ((intpri >= 0) && (intpri <= 20)) { Settings.mcp230xx_int_prio = intpri; - snprintf_P(mqtt_data, sizeof(mqtt_data), MCP230XX_INTCFG_RESPONSE,"PRI",99,Settings.mcp230xx_int_prio); // "{\"MCP230xx_INT%s\":{\"D_%i\":%i}}"; + Response_P(MCP230XX_INTCFG_RESPONSE,"PRI",99,Settings.mcp230xx_int_prio); // "{\"MCP230xx_INT%s\":{\"D_%i\":%i}}"; return serviced; } } else { // No parameter was given for INTPRI so we return the current configured value - snprintf_P(mqtt_data, sizeof(mqtt_data), MCP230XX_INTCFG_RESPONSE,"PRI",99,Settings.mcp230xx_int_prio); // "{\"MCP230xx_INT%s\":{\"D_%i\":%i}}"; + Response_P(MCP230XX_INTCFG_RESPONSE,"PRI",99,Settings.mcp230xx_int_prio); // "{\"MCP230xx_INT%s\":{\"D_%i\":%i}}"; return serviced; } } @@ -471,11 +468,11 @@ bool MCP230xx_Command(void) { if ((inttim >= 0) && (inttim <= 3600)) { Settings.mcp230xx_int_timer = inttim; MCP230xx_CheckForIntCounter(); // update register on whether or not we should be counting interrupts - snprintf_P(mqtt_data, sizeof(mqtt_data), MCP230XX_INTCFG_RESPONSE,"TIMER",99,Settings.mcp230xx_int_timer); // "{\"MCP230xx_INT%s\":{\"D_%i\":%i}}"; + Response_P(MCP230XX_INTCFG_RESPONSE,"TIMER",99,Settings.mcp230xx_int_timer); // "{\"MCP230xx_INT%s\":{\"D_%i\":%i}}"; return serviced; } } else { // No parameter was given for INTTIM so we return the current configured value - snprintf_P(mqtt_data, sizeof(mqtt_data), MCP230XX_INTCFG_RESPONSE,"TIMER",99,Settings.mcp230xx_int_timer); // "{\"MCP230xx_INT%s\":{\"D_%i\":%i}}"; + Response_P(MCP230XX_INTCFG_RESPONSE,"TIMER",99,Settings.mcp230xx_int_timer); // "{\"MCP230xx_INT%s\":{\"D_%i\":%i}}"; return serviced; } } @@ -498,17 +495,16 @@ bool MCP230xx_Command(void) { if (Settings.mcp230xx_config[pin].int_count_en) { Settings.mcp230xx_config[pin].int_count_en=0; MCP230xx_CheckForIntCounter(); - snprintf_P(log_data, sizeof(log_data), PSTR("*** WARNING *** - Disabled INTCNT for pin D%i"),pin); - AddLog(LOG_LEVEL_INFO); + AddLog_P2(LOG_LEVEL_INFO, PSTR("*** WARNING *** - Disabled INTCNT for pin D%i"),pin); } - snprintf_P(mqtt_data, sizeof(mqtt_data), MCP230XX_INTCFG_RESPONSE,"DEF",pin,Settings.mcp230xx_config[pin].int_report_defer); // "{\"MCP230xx_INT%s\":{\"D_%i\":%i}}"; + Response_P(MCP230XX_INTCFG_RESPONSE,"DEF",pin,Settings.mcp230xx_config[pin].int_report_defer); // "{\"MCP230xx_INT%s\":{\"D_%i\":%i}}"; return serviced; } else { serviced=false; return serviced; } } else { - snprintf_P(mqtt_data, sizeof(mqtt_data), MCP230XX_INTCFG_RESPONSE,"DEF",pin,Settings.mcp230xx_config[pin].int_report_defer); // "{\"MCP230xx_INT%s\":{\"D_%i\":%i}}"; + Response_P(MCP230XX_INTCFG_RESPONSE,"DEF",pin,Settings.mcp230xx_config[pin].int_report_defer); // "{\"MCP230xx_INT%s\":{\"D_%i\":%i}}"; return serviced; } } @@ -537,27 +533,24 @@ bool MCP230xx_Command(void) { Settings.mcp230xx_config[pin].int_count_en=intcnt; if (Settings.mcp230xx_config[pin].int_report_defer) { Settings.mcp230xx_config[pin].int_report_defer=0; - snprintf_P(log_data, sizeof(log_data), PSTR("*** WARNING *** - Disabled INTDEF for pin D%i"),pin); - AddLog(LOG_LEVEL_INFO); + AddLog_P2(LOG_LEVEL_INFO, PSTR("*** WARNING *** - Disabled INTDEF for pin D%i"),pin); } if (Settings.mcp230xx_config[pin].int_report_mode < 3) { Settings.mcp230xx_config[pin].int_report_mode=3; - snprintf_P(log_data, sizeof(log_data), PSTR("*** WARNING *** - Disabled immediate interrupt/telemetry reporting for pin D%i"),pin); - AddLog(LOG_LEVEL_INFO); + AddLog_P2(LOG_LEVEL_INFO, PSTR("*** WARNING *** - Disabled immediate interrupt/telemetry reporting for pin D%i"),pin); } if ((Settings.mcp230xx_config[pin].int_count_en) && (!Settings.mcp230xx_int_timer)) { - snprintf_P(log_data, sizeof(log_data), PSTR("*** WARNING *** - INTCNT enabled for pin D%i but global INTTIMER is disabled!"),pin); - AddLog(LOG_LEVEL_INFO); + AddLog_P2(LOG_LEVEL_INFO, PSTR("*** WARNING *** - INTCNT enabled for pin D%i but global INTTIMER is disabled!"),pin); } MCP230xx_CheckForIntCounter(); // update register on whether or not we should be counting interrupts - snprintf_P(mqtt_data, sizeof(mqtt_data), MCP230XX_INTCFG_RESPONSE,"CNT",pin,Settings.mcp230xx_config[pin].int_count_en); // "{\"MCP230xx_INT%s\":{\"D_%i\":%i}}"; + Response_P(MCP230XX_INTCFG_RESPONSE,"CNT",pin,Settings.mcp230xx_config[pin].int_count_en); // "{\"MCP230xx_INT%s\":{\"D_%i\":%i}}"; return serviced; } else { serviced=false; return serviced; } } else { - snprintf_P(mqtt_data, sizeof(mqtt_data), MCP230XX_INTCFG_RESPONSE,"CNT",pin,Settings.mcp230xx_config[pin].int_count_en); // "{\"MCP230xx_INT%s\":{\"D_%i\":%i}}"; + Response_P(MCP230XX_INTCFG_RESPONSE,"CNT",pin,Settings.mcp230xx_config[pin].int_count_en); // "{\"MCP230xx_INT%s\":{\"D_%i\":%i}}"; return serviced; } } @@ -584,7 +577,7 @@ bool MCP230xx_Command(void) { uint8_t int_retain = atoi(subStr(sub_string, XdrvMailbox.data, ",", 3)); if ((int_retain >= 0) && (int_retain <= 1)) { Settings.mcp230xx_config[pin].int_retain_flag=int_retain; - snprintf_P(mqtt_data, sizeof(mqtt_data), MCP230XX_INTCFG_RESPONSE,"INT_RETAIN",pin,Settings.mcp230xx_config[pin].int_retain_flag); + Response_P(MCP230XX_INTCFG_RESPONSE,"INT_RETAIN",pin,Settings.mcp230xx_config[pin].int_retain_flag); MCP230xx_CheckForIntRetainer(); return serviced; } else { @@ -592,7 +585,7 @@ bool MCP230xx_Command(void) { return serviced; } } else { - snprintf_P(mqtt_data, sizeof(mqtt_data), MCP230XX_INTCFG_RESPONSE,"INT_RETAIN",pin,Settings.mcp230xx_config[pin].int_retain_flag); + Response_P(MCP230XX_INTCFG_RESPONSE,"INT_RETAIN",pin,Settings.mcp230xx_config[pin].int_retain_flag); return serviced; } } @@ -605,7 +598,7 @@ bool MCP230xx_Command(void) { } uint8_t pin = atoi(subStr(sub_string, XdrvMailbox.data, ",", 1)); - + if (pin < mcp230xx_pincount) { if (0 == pin) { if (!strcmp(subStr(sub_string, XdrvMailbox.data, ",", 1), "0")) validpin=true; @@ -625,10 +618,10 @@ bool MCP230xx_Command(void) { #ifdef USE_MCP230xx_OUTPUT uint8_t pinmod = Settings.mcp230xx_config[pin].pinmode; sprintf(pinstatustxtr,ConvertNumTxt(portdata>>(pin-(port*8))&1,pinmod)); - snprintf_P(mqtt_data, sizeof(mqtt_data), MCP230XX_SENSOR_RESPONSE,pin,pinmod,pulluptxtr,intmodetxt,pinstatustxtr); + Response_P(MCP230XX_SENSOR_RESPONSE,pin,pinmod,pulluptxtr,intmodetxt,pinstatustxtr); #else // not USE_MCP230xx_OUTPUT sprintf(pinstatustxtr,ConvertNumTxt(portdata>>(pin-(port*8))&1)); - snprintf_P(mqtt_data, sizeof(mqtt_data), MCP230XX_SENSOR_RESPONSE,pin,Settings.mcp230xx_config[pin].pinmode,pulluptxtr,intmodetxt,pinstatustxtr); + Response_P(MCP230XX_SENSOR_RESPONSE,pin,Settings.mcp230xx_config[pin].pinmode,pulluptxtr,intmodetxt,pinstatustxtr); #endif //USE_MCP230xx_OUTPUT return serviced; } @@ -688,7 +681,7 @@ bool MCP230xx_Command(void) { #else // not USE_MCP230xx_OUTPUT sprintf(pinstatustxtc,ConvertNumTxt(portdata>>(pin-(port*8))&1)); #endif // USE_MCP230xx_OUTPUT - snprintf_P(mqtt_data, sizeof(mqtt_data), MCP230XX_SENSOR_RESPONSE,pin,pinmode,pulluptxtc,intmodetxt,pinstatustxtc); + Response_P(MCP230XX_SENSOR_RESPONSE,pin,pinmode,pulluptxtc,intmodetxt,pinstatustxtc); return serviced; } } else { @@ -700,7 +693,7 @@ bool MCP230xx_Command(void) { #ifdef USE_MCP230xx_DISPLAYOUTPUT -const char HTTP_SNS_MCP230xx_OUTPUT[] PROGMEM = "%s{s}MCP230XX D%d{m}%s{e}"; // {s} = , {m} = , {e} = +const char HTTP_SNS_MCP230xx_OUTPUT[] PROGMEM = "{s}MCP230XX D%d{m}%s{e}"; // {s} = , {m} = , {e} = void MCP230xx_UpdateWebData(void) { uint8_t gpio1 = MCP230xx_readGPIO(0); @@ -713,7 +706,7 @@ void MCP230xx_UpdateWebData(void) { if (Settings.mcp230xx_config[pin].pinmode >= 5) { char stt[7]; sprintf(stt,ConvertNumTxt((gpio>>pin)&1,Settings.mcp230xx_config[pin].pinmode)); - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_MCP230xx_OUTPUT, mqtt_data, pin, stt); + WSContentSend_PD(HTTP_SNS_MCP230xx_OUTPUT, pin, stt); } } } @@ -736,14 +729,14 @@ void MCP230xx_OutputTelemetry(void) { } if (outputcount) { char stt[7]; - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_JSON_TIME "\":\"%s\",\"MCP230_OUT\": {"), GetDateAndTime(DT_LOCAL).c_str()); + Response_P(PSTR("{\"" D_JSON_TIME "\":\"%s\",\"MCP230_OUT\": {"), GetDateAndTime(DT_LOCAL).c_str()); for (uint8_t pinx = 0;pinx < mcp230xx_pincount;pinx++) { if (Settings.mcp230xx_config[pinx].pinmode >= 5) { sprintf(stt,ConvertNumTxt(((gpiototal>>pinx)&1),Settings.mcp230xx_config[pinx].pinmode)); - snprintf_P(mqtt_data,sizeof(mqtt_data), PSTR("%s\"OUT_D%i\":\"%s\","),mqtt_data,pinx,stt); + ResponseAppend_P(PSTR("\"OUT_D%i\":\"%s\","),pinx,stt); } } - snprintf_P(mqtt_data,sizeof(mqtt_data),PSTR("%s\"END\":1}}"),mqtt_data); + ResponseAppend_P(PSTR("\"END\":1}}")); MqttPublishPrefixTopic_P(TELE, PSTR(D_RSLT_SENSOR), Settings.flag.mqtt_sensor_retain); } } @@ -751,29 +744,29 @@ void MCP230xx_OutputTelemetry(void) { #endif // USE_MCP230xx_OUTPUT void MCP230xx_Interrupt_Counter_Report(void) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_JSON_TIME "\":\"%s\",\"MCP230_INTTIMER\": {"), GetDateAndTime(DT_LOCAL).c_str()); + Response_P(PSTR("{\"" D_JSON_TIME "\":\"%s\",\"MCP230_INTTIMER\": {"), GetDateAndTime(DT_LOCAL).c_str()); for (uint8_t pinx = 0;pinx < mcp230xx_pincount;pinx++) { if (Settings.mcp230xx_config[pinx].int_count_en) { // Counting is enabled for this pin so we add to report - snprintf_P(mqtt_data,sizeof(mqtt_data), PSTR("%s\"INTCNT_D%i\":%i,"),mqtt_data,pinx,mcp230xx_int_counter[pinx]); + ResponseAppend_P(PSTR("\"INTCNT_D%i\":%i,"),pinx,mcp230xx_int_counter[pinx]); mcp230xx_int_counter[pinx]=0; } } - snprintf_P(mqtt_data,sizeof(mqtt_data),PSTR("%s\"END\":1}}"),mqtt_data); + ResponseAppend_P(PSTR("\"END\":1}}")); MqttPublishPrefixTopic_P(TELE, PSTR(D_RSLT_SENSOR), Settings.flag.mqtt_sensor_retain); mcp230xx_int_sec_counter = 0; } void MCP230xx_Interrupt_Retain_Report(void) { uint16_t retainresult = 0; - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_JSON_TIME "\":\"%s\",\"MCP_INTRETAIN\": {"), GetDateAndTime(DT_LOCAL).c_str()); + Response_P(PSTR("{\"" D_JSON_TIME "\":\"%s\",\"MCP_INTRETAIN\": {"), GetDateAndTime(DT_LOCAL).c_str()); for (uint8_t pinx = 0;pinx < mcp230xx_pincount;pinx++) { - if (Settings.mcp230xx_config[pinx].int_retain_flag) { - snprintf_P(mqtt_data,sizeof(mqtt_data), PSTR("%s\"D%i\":%i,"),mqtt_data,pinx,mcp230xx_int_retainer[pinx]); + if (Settings.mcp230xx_config[pinx].int_retain_flag) { + ResponseAppend_P(PSTR("\"D%i\":%i,"),pinx,mcp230xx_int_retainer[pinx]); retainresult |= (((mcp230xx_int_retainer[pinx])&1) << pinx); mcp230xx_int_retainer[pinx]=0; } } - snprintf_P(mqtt_data,sizeof(mqtt_data),PSTR("%s\"Value\":%u}}"),mqtt_data,retainresult); + ResponseAppend_P(PSTR("\"Value\":%u}}"),retainresult); MqttPublishPrefixTopic_P(TELE, PSTR(D_RSLT_SENSOR), Settings.flag.mqtt_sensor_retain); } @@ -820,7 +813,7 @@ bool Xsns29(uint8_t function) case FUNC_JSON_APPEND: MCP230xx_Show(1); break; - case FUNC_COMMAND: + case FUNC_COMMAND_SENSOR: if (XSNS_29 == XdrvMailbox.index) { result = MCP230xx_Command(); } @@ -828,7 +821,7 @@ bool Xsns29(uint8_t function) #ifdef USE_WEBSERVER #ifdef USE_MCP230xx_OUTPUT #ifdef USE_MCP230xx_DISPLAYOUTPUT - case FUNC_WEB_APPEND: + case FUNC_WEB_SENSOR: MCP230xx_UpdateWebData(); break; #endif // USE_MCP230xx_DISPLAYOUTPUT diff --git a/sonoff/xsns_30_mpr121.ino b/sonoff/xsns_30_mpr121.ino index e9dbfad4f..6f23117c6 100644 --- a/sonoff/xsns_30_mpr121.ino +++ b/sonoff/xsns_30_mpr121.ino @@ -220,8 +220,7 @@ void Mpr121Init(struct mpr121 *pS) if (pS->connected[i]) { // Log sensor found - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_I2C "MPR121(%c) " D_FOUND_AT " 0x%X"), pS->id[i], pS->i2c_addr[i]); - AddLog(LOG_LEVEL_INFO); + AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_I2C "MPR121(%c) " D_FOUND_AT " 0x%X"), pS->id[i], pS->i2c_addr[i]); // Set thresholds for registers 0x41 - 0x5A (ExTTH and ExRTH) for (uint8_t j = 0; j < 13; j++) { @@ -283,12 +282,9 @@ void Mpr121Init(struct mpr121 *pS) // Check if sensor is running pS->running[i] = (0x00 != I2cRead8(pS->i2c_addr[i], MPR121_ECR_REG)); - if (pS->running[i]) { - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_I2C "MPR121%c: Running"), pS->id[i]); - } else { - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_I2C "MPR121%c: NOT Running"), pS->id[i]); - } - AddLog(LOG_LEVEL_INFO); + + AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_I2C "MPR121%c: %sRunning"), pS->id[i], (pS->running[i]) ? "" : "NOT"); + } else { // Make sure running is false @@ -299,8 +295,7 @@ void Mpr121Init(struct mpr121 *pS) // Display no sensor found message if (!(pS->connected[0] || pS->connected[1] || pS->connected[2] || pS->connected[3])) { - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_I2C "MPR121: No sensors found")); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_I2C "MPR121: No sensors found")); } } // void Mpr121Init(struct mpr121 *s) @@ -329,8 +324,7 @@ void Mpr121Show(struct mpr121 *pS, uint8_t function) // Read data if (!I2cValidRead16LE(&pS->current[i], pS->i2c_addr[i], MPR121_ELEX_REG)) { - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_I2C "MPR121%c: ERROR: Cannot read data!"), pS->id[i]); - AddLog(LOG_LEVEL_ERROR); + AddLog_P2(LOG_LEVEL_ERROR, PSTR(D_LOG_I2C "MPR121%c: ERROR: Cannot read data!"), pS->id[i]); Mpr121Init(pS); return; } @@ -339,9 +333,7 @@ void Mpr121Show(struct mpr121 *pS, uint8_t function) // Clear OVCF bit I2cWrite8(pS->i2c_addr[i], MPR121_ELEX_REG, 0x00); - snprintf_P(log_data, sizeof(log_data), - PSTR(D_LOG_I2C "MPR121%c: ERROR: Excess current detected! Fix circuits if it happens repeatedly! Soft-resetting MPR121 ..."), pS->id[i]); - AddLog(LOG_LEVEL_ERROR); + AddLog_P2(LOG_LEVEL_ERROR, PSTR(D_LOG_I2C "MPR121%c: ERROR: Excess current detected! Fix circuits if it happens repeatedly! Soft-resetting MPR121 ..."), pS->id[i]); Mpr121Init(pS); return; } @@ -351,7 +343,7 @@ void Mpr121Show(struct mpr121 *pS, uint8_t function) // Append sensor to JSON message string if (FUNC_JSON_APPEND == function) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"MPR121%c\":{"), mqtt_data, pS->id[i]); + ResponseAppend_P(PSTR(",\"MPR121%c\":{"), pS->id[i]); } // Loop through buttons for (uint8_t j = 0; j < 13; j++) { @@ -359,19 +351,19 @@ void Mpr121Show(struct mpr121 *pS, uint8_t function) // Add sensor, button and state to MQTT JSON message string if ((FUNC_EVERY_50_MSECOND == function) && (BITC(i, j) != BITP(i, j))) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"MPR121%c\":{\"Button%i\":%i}}"), pS->id[i], j, BITC(i, j)); + Response_P(PSTR("{\"MPR121%c\":{\"Button%i\":%i}}"), pS->id[i], j, BITC(i, j)); MqttPublishPrefixTopic_P(RESULT_OR_STAT, mqtt_data); } // Add buttons to web string #ifdef USE_WEBSERVER - if (FUNC_WEB_APPEND == function) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s{s}MPR121%c Button%d{m}%d{e}"), mqtt_data, pS->id[i], j, BITC(i, j)); + if (FUNC_WEB_SENSOR == function) { + WSContentSend_PD(PSTR("{s}MPR121%c Button%d{m}%d{e}"), pS->id[i], j, BITC(i, j)); } #endif // USE_WEBSERVER // Append JSON message string if (FUNC_JSON_APPEND == function) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s%s\"Button%i\":%i"), mqtt_data, (j > 0 ? "," : ""), j, BITC(i, j)); + ResponseAppend_P(PSTR("%s\"Button%i\":%i"), (j > 0 ? "," : ""), j, BITC(i, j)); } } // for-loop j @@ -380,7 +372,7 @@ void Mpr121Show(struct mpr121 *pS, uint8_t function) // Append JSON message string if (FUNC_JSON_APPEND == function) { - snprintf_P(mqtt_data, sizeof(mqtt_data), "%s}", mqtt_data); + ResponseAppend_P(PSTR("}")); } } // if->running } // for-loop i @@ -397,7 +389,7 @@ void Mpr121Show(struct mpr121 *pS, uint8_t function) * FUNC_INIT to initialize a driver, * FUNC_EVERY_50_MSECOND for near real-time operation, * FUNC_JSON_APPEND for telemetry data and - * FUNC_WEB_APPEND for displaying data in the Tasmota web-interface + * FUNC_WEB_SENSOR for displaying data in the Tasmota web-interface * * @param byte function Tasmota function ID. * @return bool ??? @@ -434,8 +426,8 @@ bool Xsns30(uint8_t function) #ifdef USE_WEBSERVER // Show sensor data on main web page - case FUNC_WEB_APPEND: - Mpr121Show(&mpr121, FUNC_WEB_APPEND); + case FUNC_WEB_SENSOR: + Mpr121Show(&mpr121, FUNC_WEB_SENSOR); break; #endif // USE_WEBSERVER } diff --git a/sonoff/xsns_31_ccs811.ino b/sonoff/xsns_31_ccs811.ino index 75dca5451..2624d0b8c 100644 --- a/sonoff/xsns_31_ccs811.ino +++ b/sonoff/xsns_31_ccs811.ino @@ -52,11 +52,9 @@ void CCS811Update(void) // Perform every n second sint8_t res = ccs.begin(CCS811_ADDRESS); if (!res) { CCS811_type = 1; - snprintf_P(log_data, sizeof(log_data), S_LOG_I2C_FOUND_AT, "CCS811", 0x5A); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, S_LOG_I2C_FOUND_AT, "CCS811", 0x5A); } else { - //snprintf_P(log_data, sizeof(log_data), "CCS811 init failed: %d",res); - //AddLog(LOG_LEVEL_DEBUG); + //AddLog_P2(LOG_LEVEL_DEBUG, "CCS811 init failed: %d",res); } } else { if (ccs.available()) { @@ -79,7 +77,7 @@ void CCS811Update(void) // Perform every n second } } -const char HTTP_SNS_CCS811[] PROGMEM = "%s" +const char HTTP_SNS_CCS811[] PROGMEM = "{s}CCS811 " D_ECO2 "{m}%d " D_UNIT_PARTS_PER_MILLION "{e}" // {s} = , {m} = , {e} = "{s}CCS811 " D_TVOC "{m}%d " D_UNIT_PARTS_PER_BILLION "{e}"; @@ -87,13 +85,13 @@ void CCS811Show(bool json) { if (CCS811_ready) { if (json) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"CCS811\":{\"" D_JSON_ECO2 "\":%d,\"" D_JSON_TVOC "\":%d}"), mqtt_data,eCO2,TVOC); + ResponseAppend_P(PSTR(",\"CCS811\":{\"" D_JSON_ECO2 "\":%d,\"" D_JSON_TVOC "\":%d}"), eCO2,TVOC); #ifdef USE_DOMOTICZ if (0 == tele_period) DomoticzSensor(DZ_AIRQUALITY, eCO2); #endif // USE_DOMOTICZ #ifdef USE_WEBSERVER } else { - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_CCS811, mqtt_data, eCO2, TVOC); + WSContentSend_PD(HTTP_SNS_CCS811, eCO2, TVOC); #endif } } @@ -116,7 +114,7 @@ bool Xsns31(uint8_t function) CCS811Show(1); break; #ifdef USE_WEBSERVER - case FUNC_WEB_APPEND: + case FUNC_WEB_SENSOR: CCS811Show(0); break; #endif // USE_WEBSERVER diff --git a/sonoff/xsns_32_mpu6050.ino b/sonoff/xsns_32_mpu6050.ino index 9556c5fe4..6ac8763bd 100644 --- a/sonoff/xsns_32_mpu6050.ino +++ b/sonoff/xsns_32_mpu6050.ino @@ -134,12 +134,12 @@ void MPU_6050Detect(void) mpu6050.setXGyroOffset(220); mpu6050.setYGyroOffset(76); mpu6050.setZGyroOffset(-85); - mpu6050.setZAccelOffset(1788); + mpu6050.setZAccelOffset(1788); if (MPU6050_dmp.devStatus == 0) { mpu6050.setDMPEnabled(true); MPU6050_dmp.packetSize = mpu6050.dmpGetFIFOPacketSize(); MPU_6050_found = true; - } + } #else mpu6050.initialize(); MPU_6050_found = mpu6050.testConnection(); @@ -150,18 +150,18 @@ void MPU_6050Detect(void) if (MPU_6050_found) { - snprintf_P(log_data, sizeof(log_data), S_LOG_I2C_FOUND_AT, D_SENSOR_MPU6050, MPU_6050_address); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, S_LOG_I2C_FOUND_AT, D_SENSOR_MPU6050, MPU_6050_address); } } #ifdef USE_WEBSERVER -const char HTTP_SNS_AX_AXIS[] PROGMEM = "%s{s}%s " D_AX_AXIS "{m}%s{e}"; // {s} = , {m} = , {e} = -const char HTTP_SNS_AY_AXIS[] PROGMEM = "%s{s}%s " D_AY_AXIS "{m}%s{e}"; // {s} = , {m} = , {e} = -const char HTTP_SNS_AZ_AXIS[] PROGMEM = "%s{s}%s " D_AZ_AXIS "{m}%s{e}"; // {s} = , {m} = , {e} = -const char HTTP_SNS_GX_AXIS[] PROGMEM = "%s{s}%s " D_GX_AXIS "{m}%s{e}"; // {s} = , {m} = , {e} = -const char HTTP_SNS_GY_AXIS[] PROGMEM = "%s{s}%s " D_GY_AXIS "{m}%s{e}"; // {s} = , {m} = , {e} = -const char HTTP_SNS_GZ_AXIS[] PROGMEM = "%s{s}%s " D_GZ_AXIS "{m}%s{e}"; // {s} = , {m} = , {e} = +const char HTTP_SNS_AXIS[] PROGMEM = + "{s}" D_SENSOR_MPU6050 " " D_AX_AXIS "{m}%s{e}" // {s} = , {m} = , {e} = + "{s}" D_SENSOR_MPU6050 " " D_AY_AXIS "{m}%s{e}" // {s} = , {m} = , {e} = + "{s}" D_SENSOR_MPU6050 " " D_AZ_AXIS "{m}%s{e}" // {s} = , {m} = , {e} = + "{s}" D_SENSOR_MPU6050 " " D_GX_AXIS "{m}%s{e}" // {s} = , {m} = , {e} = + "{s}" D_SENSOR_MPU6050 " " D_GY_AXIS "{m}%s{e}" // {s} = , {m} = , {e} = + "{s}" D_SENSOR_MPU6050 " " D_GZ_AXIS "{m}%s{e}"; // {s} = , {m} = , {e} = #endif // USE_WEBSERVER #define D_JSON_AXIS_AX "AccelXAxis" @@ -205,20 +205,15 @@ void MPU_6050Show(bool json) snprintf_P(json_axis_gy, sizeof(json_axis_gy), PSTR(",\"" D_JSON_AXIS_GY "\":%s"), axis_gy); char json_axis_gz[25]; snprintf_P(json_axis_gz, sizeof(json_axis_gz), PSTR(",\"" D_JSON_AXIS_GZ "\":%s"), axis_gz); - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"%s\":{\"" D_JSON_TEMPERATURE "\":%s%s%s%s%s%s%s}"), - mqtt_data, D_SENSOR_MPU6050, temperature, json_axis_ax, json_axis_ay, json_axis_az, json_axis_gx, json_axis_gy, json_axis_gz); + ResponseAppend_P(PSTR(",\"%s\":{\"" D_JSON_TEMPERATURE "\":%s%s%s%s%s%s%s}"), + D_SENSOR_MPU6050, temperature, json_axis_ax, json_axis_ay, json_axis_az, json_axis_gx, json_axis_gy, json_axis_gz); #ifdef USE_DOMOTICZ DomoticzSensor(DZ_TEMP, temperature); #endif // USE_DOMOTICZ #ifdef USE_WEBSERVER } else { - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_TEMP, mqtt_data, D_SENSOR_MPU6050, temperature, TempUnit()); - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_AX_AXIS, mqtt_data, D_SENSOR_MPU6050, axis_ax); - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_AY_AXIS, mqtt_data, D_SENSOR_MPU6050, axis_ay); - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_AZ_AXIS, mqtt_data, D_SENSOR_MPU6050, axis_az); - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_GX_AXIS, mqtt_data, D_SENSOR_MPU6050, axis_gx); - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_GY_AXIS, mqtt_data, D_SENSOR_MPU6050, axis_gy); - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_GZ_AXIS, mqtt_data, D_SENSOR_MPU6050, axis_gz); + WSContentSend_PD(HTTP_SNS_TEMP, D_SENSOR_MPU6050, temperature, TempUnit()); + WSContentSend_PD(HTTP_SNS_AXIS, axis_ax, axis_ay, axis_az, axis_gx, axis_gy, axis_gz); #endif // USE_WEBSERVER } } @@ -246,7 +241,7 @@ bool Xsns32(uint8_t function) MPU_6050Show(1); break; #ifdef USE_WEBSERVER - case FUNC_WEB_APPEND: + case FUNC_WEB_SENSOR: MPU_6050Show(0); MPU_6050PerformReading(); break; diff --git a/sonoff/xsns_33_ds3231.ino b/sonoff/xsns_33_ds3231.ino index 2e4586489..98afa0ab0 100644 --- a/sonoff/xsns_33_ds3231.ino +++ b/sonoff/xsns_33_ds3231.ino @@ -73,12 +73,11 @@ void DS3231Detect(void) { DS3231chipDetected = false; if (I2cValidRead(USE_RTC_ADDR, RTC_STATUS, 1)) { - snprintf_P(log_data, sizeof(log_data), S_LOG_I2C_FOUND_AT, "DS3231", USE_RTC_ADDR); + AddLog_P2(LOG_LEVEL_INFO, S_LOG_I2C_FOUND_AT, "DS3231", USE_RTC_ADDR); DS3231chipDetected = true; } else { - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_I2C "%s *NOT* " D_FOUND_AT " 0x%x"), "DS3231", USE_RTC_ADDR); + AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_I2C "DS3231 NOT " D_FOUND_AT " 0x%x"), USE_RTC_ADDR); } - AddLog(LOG_LEVEL_INFO); } /*----------------------------------------------------------------------* @@ -155,9 +154,8 @@ bool Xsns33(uint8_t function) RtcTime.year = tmpTime.year + 1970; daylight_saving_time = RuleToTime(Settings.tflag[1], RtcTime.year); standard_time = RuleToTime(Settings.tflag[0], RtcTime.year); - snprintf_P(log_data, sizeof(log_data), PSTR("Set time from DS3231 to RTC (" D_UTC_TIME ") %s, (" D_DST_TIME ") %s, (" D_STD_TIME ") %s"), + AddLog_P2(LOG_LEVEL_INFO, PSTR("Set time from DS3231 to RTC (" D_UTC_TIME ") %s, (" D_DST_TIME ") %s, (" D_STD_TIME ") %s"), GetTime(0).c_str(), GetTime(2).c_str(), GetTime(3).c_str()); - AddLog(LOG_LEVEL_INFO); if (local_time < 1451602800) { // 2016-01-01 rules_flag.time_init = 1; } else { @@ -165,9 +163,8 @@ bool Xsns33(uint8_t function) } } else if (!ds3231WriteStatus && DS3231chipDetected && utc_time > 1451602800 && abs(utc_time - ReadFromDS3231()) > 60) {//if time is valid and is drift from RTC in more that 60 second - snprintf_P(log_data, sizeof(log_data), PSTR("Write Time TO DS3231 from NTP (" D_UTC_TIME ") %s, (" D_DST_TIME ") %s, (" D_STD_TIME ") %s"), + AddLog_P2(LOG_LEVEL_INFO, PSTR("Write Time TO DS3231 from NTP (" D_UTC_TIME ") %s, (" D_DST_TIME ") %s, (" D_STD_TIME ") %s"), GetTime(0).c_str(), GetTime(2).c_str(), GetTime(3).c_str()); - AddLog(LOG_LEVEL_INFO); SetDS3231Time (utc_time); //update the DS3231 time ds3231WriteStatus = true; } diff --git a/sonoff/xsns_34_hx711.ino b/sonoff/xsns_34_hx711.ino index d9063b779..c1fd9c20e 100644 --- a/sonoff/xsns_34_hx711.ino +++ b/sonoff/xsns_34_hx711.ino @@ -128,7 +128,7 @@ void HxCalibrationStateTextJson(uint8_t msg_id) char cal_text[30]; hx_calibrate_msg = msg_id; - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_SENSOR_INDEX_SVALUE, XSNS_34, GetTextIndexed(cal_text, sizeof(cal_text), hx_calibrate_msg, kHxCalibrationStates)); + Response_P(S_JSON_SENSOR_INDEX_SVALUE, XSNS_34, GetTextIndexed(cal_text, sizeof(cal_text), hx_calibrate_msg, kHxCalibrationStates)); if (msg_id < 3) { MqttPublishPrefixTopic_P(RESULT_OR_STAT, PSTR("Sensor34")); } } @@ -162,11 +162,11 @@ bool HxCommand(void) switch (XdrvMailbox.payload) { case 1: // Reset scale HxReset(); - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_SENSOR_INDEX_SVALUE, XSNS_34, "Reset"); + Response_P(S_JSON_SENSOR_INDEX_SVALUE, XSNS_34, "Reset"); break; case 2: // Calibrate - if (strstr(XdrvMailbox.data, ",")) { - Settings.weight_reference = strtol(subStr(sub_string, XdrvMailbox.data, ",", 2), NULL, 10); + if (strstr(XdrvMailbox.data, ",") != nullptr) { + Settings.weight_reference = strtol(subStr(sub_string, XdrvMailbox.data, ",", 2), nullptr, 10); } hx_scale = 1; HxReset(); @@ -175,26 +175,26 @@ bool HxCommand(void) HxCalibrationStateTextJson(3); break; case 3: // WeightRef to user reference - if (strstr(XdrvMailbox.data, ",")) { - Settings.weight_reference = strtol(subStr(sub_string, XdrvMailbox.data, ",", 2), NULL, 10); + if (strstr(XdrvMailbox.data, ",") != nullptr) { + Settings.weight_reference = strtol(subStr(sub_string, XdrvMailbox.data, ",", 2), nullptr, 10); } show_parms = true; break; case 4: // WeightCal to user calculated value - if (strstr(XdrvMailbox.data, ",")) { - Settings.weight_calibration = strtol(subStr(sub_string, XdrvMailbox.data, ",", 2), NULL, 10); + if (strstr(XdrvMailbox.data, ",") != nullptr) { + Settings.weight_calibration = strtol(subStr(sub_string, XdrvMailbox.data, ",", 2), nullptr, 10); hx_scale = Settings.weight_calibration; } show_parms = true; break; case 5: // WeightMax - if (strstr(XdrvMailbox.data, ",")) { - Settings.weight_max = strtol(subStr(sub_string, XdrvMailbox.data, ",", 2), NULL, 10) / 1000; + if (strstr(XdrvMailbox.data, ",") != nullptr) { + Settings.weight_max = strtol(subStr(sub_string, XdrvMailbox.data, ",", 2), nullptr, 10) / 1000; } show_parms = true; break; case 6: // WeightItem - if (strstr(XdrvMailbox.data, ",")) { + if (strstr(XdrvMailbox.data, ",") != nullptr) { Settings.weight_item = (unsigned long)(CharToDouble(subStr(sub_string, XdrvMailbox.data, ",", 2)) * 10); } show_parms = true; @@ -206,7 +206,7 @@ bool HxCommand(void) if (show_parms) { char item[33]; dtostrfd((float)Settings.weight_item / 10, 1, item); - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"Sensor34\":{\"" D_JSON_WEIGHT_REF "\":%d,\"" D_JSON_WEIGHT_CAL "\":%d,\"" D_JSON_WEIGHT_MAX "\":%d,\"" D_JSON_WEIGHT_ITEM "\":%s}}"), + Response_P(PSTR("{\"Sensor34\":{\"" D_JSON_WEIGHT_REF "\":%d,\"" D_JSON_WEIGHT_CAL "\":%d,\"" D_JSON_WEIGHT_MAX "\":%d,\"" D_JSON_WEIGHT_ITEM "\":%s}}"), Settings.weight_reference, Settings.weight_calibration, Settings.weight_max * 1000, item); } @@ -321,11 +321,11 @@ void HxEvery100mSecond(void) } #ifdef USE_WEBSERVER -const char HTTP_HX711_WEIGHT[] PROGMEM = "%s" +const char HTTP_HX711_WEIGHT[] PROGMEM = "{s}HX711 " D_WEIGHT "{m}%s " D_UNIT_KILOGRAM "{e}"; // {s} = , {m} = , {e} = -const char HTTP_HX711_COUNT[] PROGMEM = "%s" +const char HTTP_HX711_COUNT[] PROGMEM = "{s}HX711 " D_COUNT "{m}%d{e}"; -const char HTTP_HX711_CAL[] PROGMEM = "%s" +const char HTTP_HX711_CAL[] PROGMEM = "{s}HX711 %s{m}{e}"; #endif // USE_WEBSERVER @@ -348,16 +348,16 @@ void HxShow(bool json) dtostrfd(weight, Settings.flag2.weight_resolution, weight_chr); if (json) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"HX711\":{\"" D_JSON_WEIGHT "\":%s%s}"), mqtt_data, weight_chr, scount); + ResponseAppend_P(PSTR(",\"HX711\":{\"" D_JSON_WEIGHT "\":%s%s}"), weight_chr, scount); #ifdef USE_WEBSERVER } else { - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_HX711_WEIGHT, mqtt_data, weight_chr); + WSContentSend_PD(HTTP_HX711_WEIGHT, weight_chr); if (count > 1) { - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_HX711_COUNT, mqtt_data, count); + WSContentSend_PD(HTTP_HX711_COUNT, count); } if (hx_calibrate_step) { char cal_text[30]; - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_HX711_CAL, mqtt_data, GetTextIndexed(cal_text, sizeof(cal_text), hx_calibrate_msg, kHxCalibrationStates)); + WSContentSend_PD(HTTP_HX711_CAL, GetTextIndexed(cal_text, sizeof(cal_text), hx_calibrate_msg, kHxCalibrationStates)); } #endif // USE_WEBSERVER } @@ -374,22 +374,22 @@ void HxShow(bool json) const char S_CONFIGURE_HX711[] PROGMEM = D_CONFIGURE_HX711; const char HTTP_BTN_MENU_MAIN_HX711[] PROGMEM = - "
"; + "

"; const char HTTP_BTN_MENU_HX711[] PROGMEM = - "
"; + "

"; const char HTTP_FORM_HX711[] PROGMEM = "
 " D_CALIBRATION " " "
" - "
" D_REFERENCE_WEIGHT " (" D_UNIT_KILOGRAM ")

" - "

" + "

" D_REFERENCE_WEIGHT " (" D_UNIT_KILOGRAM ")

" + "
" "
" "


" "
 " D_HX711_PARAMETERS " " "
" - "
" D_ITEM_WEIGHT " (" D_UNIT_KILOGRAM ")

"; + "

" D_ITEM_WEIGHT " (" D_UNIT_KILOGRAM ")

"; void HandleHxAction(void) { @@ -403,41 +403,38 @@ void HandleHxAction(void) return; } - char tmp[100]; + char stemp1[20]; if (WebServer->hasArg("reset")) { - snprintf_P(tmp, sizeof(tmp), PSTR("Sensor34 1")); // Reset - ExecuteWebCommand(tmp, SRC_WEBGUI); + snprintf_P(stemp1, sizeof(stemp1), PSTR("Sensor34 1")); // Reset + ExecuteWebCommand(stemp1, SRC_WEBGUI); HandleRoot(); // Return to main screen return; } if (WebServer->hasArg("calibrate")) { - WebGetArg("p1", tmp, sizeof(tmp)); - Settings.weight_reference = (!strlen(tmp)) ? 0 : (unsigned long)(CharToDouble(tmp) * 1000); + WebGetArg("p1", stemp1, sizeof(stemp1)); + Settings.weight_reference = (!strlen(stemp1)) ? 0 : (unsigned long)(CharToDouble(stemp1) * 1000); HxLogUpdates(); - snprintf_P(tmp, sizeof(tmp), PSTR("Sensor34 2")); // Start calibration - ExecuteWebCommand(tmp, SRC_WEBGUI); + snprintf_P(stemp1, sizeof(stemp1), PSTR("Sensor34 2")); // Start calibration + ExecuteWebCommand(stemp1, SRC_WEBGUI); HandleRoot(); // Return to main screen return; } - String page = FPSTR(HTTP_HEAD); - page.replace(F("{v}"), FPSTR(D_CONFIGURE_HX711)); - page += FPSTR(HTTP_HEAD_STYLE); - page += FPSTR(HTTP_FORM_HX711); - dtostrfd((float)Settings.weight_reference / 1000, 3, tmp); - page.replace("{1", String(tmp)); - dtostrfd((float)Settings.weight_item / 10000, 4, tmp); - page.replace("{2", String(tmp)); - - page += FPSTR(HTTP_FORM_END); - page += FPSTR(HTTP_BTN_CONF); - ShowPage(page); + WSContentStart_P(S_CONFIGURE_HX711); + WSContentSendStyle(); + dtostrfd((float)Settings.weight_reference / 1000, 3, stemp1); + char stemp2[20]; + dtostrfd((float)Settings.weight_item / 10000, 4, stemp2); + WSContentSend_P(HTTP_FORM_HX711, stemp1, stemp2); + WSContentSend_P(HTTP_FORM_END); + WSContentSpaceButton(BUTTON_CONFIGURATION); + WSContentStop(); } void HxSaveSettings(void) @@ -457,9 +454,7 @@ void HxLogUpdates(void) char weigth_item_chr[33]; dtostrfd((float)Settings.weight_item / 10000, 4, weigth_item_chr); - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_WIFI D_JSON_WEIGHT_REF " %s, " D_JSON_WEIGHT_ITEM " %s"), - weigth_ref_chr, weigth_item_chr); - AddLog(LOG_LEVEL_INFO); + AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_WIFI D_JSON_WEIGHT_REF " %s, " D_JSON_WEIGHT_ITEM " %s"), weigth_ref_chr, weigth_item_chr); } #endif // USE_HX711_GUI @@ -481,7 +476,7 @@ bool Xsns34(uint8_t function) case FUNC_EVERY_100_MSECOND: HxEvery100mSecond(); break; - case FUNC_COMMAND: + case FUNC_COMMAND_SENSOR: if (XSNS_34 == XdrvMailbox.index) { result = HxCommand(); } @@ -490,15 +485,15 @@ bool Xsns34(uint8_t function) HxShow(1); break; #ifdef USE_WEBSERVER - case FUNC_WEB_APPEND: + case FUNC_WEB_SENSOR: HxShow(0); break; #ifdef USE_HX711_GUI case FUNC_WEB_ADD_MAIN_BUTTON: - strncat_P(mqtt_data, HTTP_BTN_MENU_MAIN_HX711, sizeof(mqtt_data) - strlen(mqtt_data) -1); + WSContentSend_P(HTTP_BTN_MENU_MAIN_HX711); break; case FUNC_WEB_ADD_BUTTON: - strncat_P(mqtt_data, HTTP_BTN_MENU_HX711, sizeof(mqtt_data) - strlen(mqtt_data) -1); + WSContentSend_P(HTTP_BTN_MENU_HX711); break; case FUNC_WEB_ADD_HANDLER: WebServer->on("/" WEB_HANDLE_HX711, HandleHxAction); diff --git a/sonoff/xsns_35_tx20.ino b/sonoff/xsns_35_tx20.ino index bae2e9532..b5e8a2091 100644 --- a/sonoff/xsns_35_tx20.ino +++ b/sonoff/xsns_35_tx20.ino @@ -39,7 +39,7 @@ extern "C" { #ifdef USE_WEBSERVER -const char HTTP_SNS_TX20[] PROGMEM = "%s" +const char HTTP_SNS_TX20[] PROGMEM = "{s}TX20 " D_TX20_WIND_SPEED "{m}%s " D_UNIT_KILOMETER_PER_HOUR "{e}" "{s}TX20 " D_TX20_WIND_SPEED_AVG "{m}%s " D_UNIT_KILOMETER_PER_HOUR "{e}" "{s}TX20 " D_TX20_WIND_SPEED_MAX "{m}%s " D_UNIT_KILOMETER_PER_HOUR "{e}" @@ -182,11 +182,11 @@ void Tx20Show(bool json) GetTextIndexed(wind_direction_string, sizeof(wind_direction_string), tx20_wind_direction, kTx20Directions); if (json) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"TX20\":{\"Speed\":%s,\"SpeedAvg\":%s,\"SpeedMax\":%s,\"Direction\":\"%s\"}"), - mqtt_data, wind_speed_string, wind_speed_avg_string, wind_speed_max_string, wind_direction_string); + ResponseAppend_P(PSTR(",\"TX20\":{\"Speed\":%s,\"SpeedAvg\":%s,\"SpeedMax\":%s,\"Direction\":\"%s\"}"), + wind_speed_string, wind_speed_avg_string, wind_speed_max_string, wind_direction_string); #ifdef USE_WEBSERVER } else { - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_TX20, mqtt_data, wind_speed_string, wind_speed_avg_string, wind_speed_max_string, wind_direction_string); + WSContentSend_PD(HTTP_SNS_TX20, wind_speed_string, wind_speed_avg_string, wind_speed_max_string, wind_direction_string); #endif // USE_WEBSERVER } } @@ -211,7 +211,7 @@ bool Xsns35(uint8_t function) Tx20Show(1); break; #ifdef USE_WEBSERVER - case FUNC_WEB_APPEND: + case FUNC_WEB_SENSOR: Tx20Show(0); break; #endif // USE_WEBSERVER diff --git a/sonoff/xsns_36_mgc3130.ino b/sonoff/xsns_36_mgc3130.ino index 760330a8a..055126c6d 100644 --- a/sonoff/xsns_36_mgc3130.ino +++ b/sonoff/xsns_36_mgc3130.ino @@ -67,7 +67,7 @@ char MGC3130stype[8]; #ifdef USE_WEBSERVER -const char HTTP_MGC_3130_SNS[] PROGMEM = "%s" +const char HTTP_MGC_3130_SNS[] PROGMEM = "{s}" "%s" "{m}%s{e}" "{s}" "HwRev" "{m}%u.%u{e}" "{s}" "loaderVer" "{m}%u.%u{e}" @@ -501,13 +501,11 @@ bool MGC3130_detect(void) success = MGC3130_receiveMessage(); // This should read the firmware info if (success) { strcpy_P(MGC3130stype, PSTR("MGC3130")); - snprintf_P(log_data, sizeof(log_data), S_LOG_I2C_FOUND_AT, MGC3130stype, MGC3130_I2C_ADDR); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, S_LOG_I2C_FOUND_AT, MGC3130stype, MGC3130_I2C_ADDR); MGC3130_currentGesture[0] = '\0'; MGC3130_type = true; } else { - snprintf_P(log_data, sizeof(log_data), PSTR("MGC3130 did not respond at address 0x%x"), MGC3130_I2C_ADDR); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR("MGC3130 did not respond at address 0x%x"), MGC3130_I2C_ADDR); } return success; } @@ -531,8 +529,8 @@ void MGC3130_show(bool json) if (json) { if (MGC3130_mode == 3 && !MGC3130_triggeredByTouch) { if (MGC_data.out.systemInfo.positionValid && !(MGC_data.out.x == MGC3130_lastSentX && MGC_data.out.y == MGC3130_lastSentY && MGC_data.out.z == MGC3130_lastSentZ)) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"%s\":{\"X\":%u,\"Y\":%u,\"Z\":%u}"), - mqtt_data, MGC3130stype, MGC_data.out.x/64, MGC_data.out.y/64, (MGC_data.out.z-(uint16_t)MGC3130_MIN_ZVALUE)/64); + ResponseAppend_P(PSTR(",\"%s\":{\"X\":%u,\"Y\":%u,\"Z\":%u}"), + MGC3130stype, MGC_data.out.x/64, MGC_data.out.y/64, (MGC_data.out.z-(uint16_t)MGC3130_MIN_ZVALUE)/64); MGC3130_lastSentX = MGC_data.out.x; MGC3130_lastSentY = MGC_data.out.y; MGC3130_lastSentZ = MGC_data.out.z; @@ -542,7 +540,7 @@ void MGC3130_show(bool json) if (MGC3130_mode == 2) { if (MGC_data.out.systemInfo.airWheelValid && (MGC3130_rotValue != MGC3130_lastSentRotValue)) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"%s\":{\"AW\":%i}"), mqtt_data, MGC3130stype, MGC3130_rotValue); + ResponseAppend_P(PSTR(",\"%s\":{\"AW\":%i}"), MGC3130stype, MGC3130_rotValue); MGC3130_lastSentRotValue = MGC3130_rotValue; } } @@ -551,13 +549,13 @@ void MGC3130_show(bool json) if (millis() - MGC3130_touchTimeStamp > 220 ) { MGC3130_touchCounter = 1; } - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"%s\":{\"%s\":%u}"), mqtt_data, MGC3130stype, MGC3130_currentGesture, MGC3130_touchCounter); + ResponseAppend_P(PSTR(",\"%s\":{\"%s\":%u}"), MGC3130stype, MGC3130_currentGesture, MGC3130_touchCounter); MGC3130_currentGesture[0] = '\0'; MGC3130_touchTimeStamp = millis(); } #ifdef USE_WEBSERVER } else { - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_MGC_3130_SNS, mqtt_data, MGC3130stype, status_chr, hwRev[0], hwRev[1], loaderVersion[0], loaderVersion[1], loaderPlatform ); + WSContentSend_PD(HTTP_MGC_3130_SNS, MGC3130stype, status_chr, hwRev[0], hwRev[1], loaderVersion[0], loaderVersion[1], loaderPlatform ); #endif // USE_WEBSERVER } } @@ -615,7 +613,7 @@ bool Xsns36(uint8_t function) case FUNC_EVERY_50_MSECOND: MGC3130_loop(); break; - case FUNC_COMMAND: + case FUNC_COMMAND_SENSOR: if (XSNS_36 == XdrvMailbox.index) { result = MGC3130CommandSensor(); } @@ -624,7 +622,7 @@ bool Xsns36(uint8_t function) MGC3130_show(1); break; #ifdef USE_WEBSERVER - case FUNC_WEB_APPEND: + case FUNC_WEB_SENSOR: MGC3130_show(0); break; #endif // USE_WEBSERVER diff --git a/sonoff/xsns_37_rfsensor.ino b/sonoff/xsns_37_rfsensor.ino index 66a7688ce..aadcf01d9 100644 --- a/sonoff/xsns_37_rfsensor.ino +++ b/sonoff/xsns_37_rfsensor.ino @@ -56,7 +56,7 @@ typedef struct RawSignalStruct // Variabelen geplaatst in stru // Om legacy redenen zit de eerste puls in element 1. Element 0 wordt dus niet gebruikt. } raw_signal_t; -raw_signal_t *rfsns_raw_signal = NULL; +raw_signal_t *rfsns_raw_signal = nullptr; uint8_t rfsns_rf_bit; uint8_t rfsns_rf_port; uint8_t rfsns_any_sensor = 0; @@ -165,8 +165,8 @@ typedef struct { uint8_t volt; } theo_v2_t2_t; -theo_v2_t1_t *rfsns_theo_v2_t1 = NULL; -theo_v2_t2_t *rfsns_theo_v2_t2 = NULL; +theo_v2_t1_t *rfsns_theo_v2_t1 = nullptr; +theo_v2_t2_t *rfsns_theo_v2_t2 = nullptr; void RfSnsInitTheoV2(void) { @@ -251,9 +251,8 @@ void RfSnsAnalyzeTheov2(void) break; } - snprintf_P(log_data, sizeof(log_data), PSTR("RFS: TheoV2, ChkCalc %d, Chksum %d, id %d, Type %d, Ch %d, Volt %d, BattLo %d, Pld1 %d, Pld2 %d"), + AddLog_P2(LOG_LEVEL_DEBUG, PSTR("RFS: TheoV2, ChkCalc %d, Chksum %d, id %d, Type %d, Ch %d, Volt %d, BattLo %d, Pld1 %d, Pld2 %d"), chksum, Checksum, id, Type, Channel +1, Payload3, (Voltage & 0x80) >> 7, Payload1, Payload2); - AddLog(LOG_LEVEL_DEBUG); } void RfSnsTheoV2Show(bool json) @@ -269,16 +268,16 @@ void RfSnsTheoV2Show(bool json) if (rfsns_theo_v2_t1[i].time < LocalTime() - RFSNS_VALID_WINDOW) { if (json) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"%s\":{\"" D_JSON_RFRECEIVED "\":\"%s\",\"" D_JSON_VOLTAGE "\":%s}"), - mqtt_data, sensor, GetDT(rfsns_theo_v2_t1[i].time).c_str(), voltage); + ResponseAppend_P(PSTR(",\"%s\":{\"" D_JSON_RFRECEIVED "\":\"%s\",\"" D_JSON_VOLTAGE "\":%s}"), + sensor, GetDT(rfsns_theo_v2_t1[i].time).c_str(), voltage); } } else { char temperature[33]; dtostrfd(ConvertTemp((float)rfsns_theo_v2_t1[i].temp / 100), Settings.flag2.temperature_resolution, temperature); if (json) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"%s\":{\"" D_JSON_TEMPERATURE "\":%s,\"" D_JSON_ILLUMINANCE "\":%d,\"" D_JSON_VOLTAGE "\":%s}"), - mqtt_data, sensor, temperature, rfsns_theo_v2_t1[i].lux, voltage); + ResponseAppend_P(PSTR(",\"%s\":{\"" D_JSON_TEMPERATURE "\":%s,\"" D_JSON_ILLUMINANCE "\":%d,\"" D_JSON_VOLTAGE "\":%s}"), + sensor, temperature, rfsns_theo_v2_t1[i].lux, voltage); #ifdef USE_DOMOTICZ if ((0 == tele_period) && !sensor_once) { DomoticzSensor(DZ_TEMP, temperature); @@ -288,8 +287,8 @@ void RfSnsTheoV2Show(bool json) #endif // USE_DOMOTICZ #ifdef USE_WEBSERVER } else { - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_TEMP, mqtt_data, sensor, temperature, TempUnit()); - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_ILLUMINANCE, mqtt_data, sensor, rfsns_theo_v2_t1[i].lux); + WSContentSend_PD(HTTP_SNS_TEMP, sensor, temperature, TempUnit()); + WSContentSend_PD(HTTP_SNS_ILLUMINANCE, sensor, rfsns_theo_v2_t1[i].lux); #endif // USE_WEBSERVER } } @@ -306,8 +305,8 @@ void RfSnsTheoV2Show(bool json) if (rfsns_theo_v2_t2[i].time < LocalTime() - RFSNS_VALID_WINDOW) { if (json) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"%s\":{\"" D_JSON_RFRECEIVED" \":\"%s\",\"" D_JSON_VOLTAGE "\":%s}"), - mqtt_data, sensor, GetDT(rfsns_theo_v2_t2[i].time).c_str(), voltage); + ResponseAppend_P(PSTR(",\"%s\":{\"" D_JSON_RFRECEIVED" \":\"%s\",\"" D_JSON_VOLTAGE "\":%s}"), + sensor, GetDT(rfsns_theo_v2_t2[i].time).c_str(), voltage); } } else { float temp = ConvertTemp((float)rfsns_theo_v2_t2[i].temp / 100); @@ -318,8 +317,8 @@ void RfSnsTheoV2Show(bool json) dtostrfd(humi, Settings.flag2.humidity_resolution, humidity); if (json) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"%s\":{\"" D_JSON_TEMPERATURE "\":%s,\"" D_JSON_HUMIDITY "\":%s,\"" D_JSON_VOLTAGE "\":%s}"), - mqtt_data, sensor, temperature, humidity, voltage); + ResponseAppend_P(PSTR(",\"%s\":{\"" D_JSON_TEMPERATURE "\":%s,\"" D_JSON_HUMIDITY "\":%s,\"" D_JSON_VOLTAGE "\":%s}"), + sensor, temperature, humidity, voltage); if ((0 == tele_period) && !sensor_once) { #ifdef USE_DOMOTICZ DomoticzTempHumSensor(temperature, humidity); // @@ -332,8 +331,8 @@ void RfSnsTheoV2Show(bool json) } #ifdef USE_WEBSERVER } else { - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_TEMP, mqtt_data, sensor, temperature, TempUnit()); - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_HUM, mqtt_data, sensor, humidity); + WSContentSend_PD(HTTP_SNS_TEMP, sensor, temperature, TempUnit()); + WSContentSend_PD(HTTP_SNS_HUM, sensor, humidity); #endif // USE_WEBSERVER } } @@ -424,7 +423,7 @@ typedef struct { uint8_t wdir; } alecto_v2_t; -alecto_v2_t *rfsns_alecto_v2 = NULL; +alecto_v2_t *rfsns_alecto_v2 = nullptr; uint16_t rfsns_alecto_rain_base = 0; void RfSnsInitAlectoV2(void) @@ -507,9 +506,8 @@ void RfSnsAnalyzeAlectov2() rfsns_alecto_v2->wdir = data[8] & 0xf; } - snprintf_P(log_data, sizeof(log_data), PSTR("RFS: " D_ALECTOV2 ", ChkCalc %d, Chksum %d, rc %d, Temp %d, Hum %d, Rain %d, Wind %d, Gust %d, Dir %d, Factor %s"), + AddLog_P2(LOG_LEVEL_DEBUG, PSTR("RFS: " D_ALECTOV2 ", ChkCalc %d, Chksum %d, rc %d, Temp %d, Hum %d, Rain %d, Wind %d, Gust %d, Dir %d, Factor %s"), checksumcalc, checksum, rc, ((data[1] & 0x3) * 256 + data[2]) - 400, data[3], (data[6] * 256) + data[7], data[4], data[5], data[8] & 0xf, dtostrfd(factor, 3, buf1)); - AddLog(LOG_LEVEL_DEBUG); } void RfSnsAlectoResetRain(void) @@ -541,11 +539,11 @@ uint8_t RfSnsAlectoCRC8(uint8_t *addr, uint8_t len) } #ifdef USE_WEBSERVER -const char HTTP_SNS_ALECTOV2[] PROGMEM = "%s" +const char HTTP_SNS_ALECTOV2[] PROGMEM = "{s}" D_ALECTOV2 " " D_RAIN "{m}%s " D_UNIT_MILLIMETER "{e}" "{s}" D_ALECTOV2 " " D_TX20_WIND_SPEED "{m}%s " D_UNIT_KILOMETER_PER_HOUR "{e}" "{s}" D_ALECTOV2 " " D_TX20_WIND_SPEED_MAX "{m}%s " D_UNIT_KILOMETER_PER_HOUR "{e}"; -const char HTTP_SNS_ALECTOV2_WDIR[] PROGMEM = "%s" +const char HTTP_SNS_ALECTOV2_WDIR[] PROGMEM = "{s}" D_ALECTOV2 " " D_TX20_WIND_DIRECTION "{m}%s{e}"; #endif @@ -554,8 +552,7 @@ void RfSnsAlectoV2Show(bool json) if (rfsns_alecto_v2->time) { if (rfsns_alecto_v2->time < LocalTime() - RFSNS_VALID_WINDOW) { if (json) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"" D_ALECTOV2 "\":{\"" D_JSON_RFRECEIVED "\":\"%s\"}"), - mqtt_data, GetDT(rfsns_alecto_v2->time).c_str()); + ResponseAppend_P(PSTR(",\"" D_ALECTOV2 "\":{\"" D_JSON_RFRECEIVED "\":\"%s\"}"), GetDT(rfsns_alecto_v2->time).c_str()); } } else { float temp = ConvertTemp(rfsns_alecto_v2->temp); @@ -578,8 +575,8 @@ void RfSnsAlectoV2Show(bool json) } if (json) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"" D_ALECTOV2 "\":{\"" D_JSON_TEMPERATURE "\":%s,\"" D_JSON_HUMIDITY "\":%s,\"Rain\":%s,\"Wind\":%s,\"Gust\":%s%s}"), - mqtt_data, temperature, humidity, rain, wind, gust, (rfsns_alecto_v2->type) ? direction : ""); + ResponseAppend_P(PSTR(",\"" D_ALECTOV2 "\":{\"" D_JSON_TEMPERATURE "\":%s,\"" D_JSON_HUMIDITY "\":%s,\"Rain\":%s,\"Wind\":%s,\"Gust\":%s%s}"), + temperature, humidity, rain, wind, gust, (rfsns_alecto_v2->type) ? direction : ""); if (0 == tele_period) { #ifdef USE_DOMOTICZ // Use a rules to send data to Domoticz where also a local BMP280 is connected: @@ -590,11 +587,11 @@ void RfSnsAlectoV2Show(bool json) } #ifdef USE_WEBSERVER } else { - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_TEMP, mqtt_data, D_ALECTOV2, temperature, TempUnit()); - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_HUM, mqtt_data, D_ALECTOV2, humidity); - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_ALECTOV2, mqtt_data, rain, wind, gust); + WSContentSend_PD(HTTP_SNS_TEMP, D_ALECTOV2, temperature, TempUnit()); + WSContentSend_PD(HTTP_SNS_HUM, D_ALECTOV2, humidity); + WSContentSend_PD(HTTP_SNS_ALECTOV2, rain, wind, gust); if (rfsns_alecto_v2->type) { - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_ALECTOV2_WDIR, mqtt_data, wdir); + WSContentSend_PD(HTTP_SNS_ALECTOV2_WDIR, wdir); } #endif // USE_WEBSERVER } @@ -620,15 +617,14 @@ void RfSnsInit(void) pinMode(pin[GPIO_RF_SENSOR], INPUT); } else { free(rfsns_raw_signal); - rfsns_raw_signal = NULL; + rfsns_raw_signal = nullptr; } } } void RfSnsAnalyzeRawSignal(void) { - snprintf_P(log_data, sizeof(log_data), PSTR("RFS: Pulses %d"), (int)rfsns_raw_signal->Number); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR("RFS: Pulses %d"), (int)rfsns_raw_signal->Number); #ifdef USE_THEO_V2 RfSnsAnalyzeTheov2(); @@ -683,7 +679,7 @@ bool Xsns37(uint8_t function) RfSnsShow(1); break; #ifdef USE_WEBSERVER - case FUNC_WEB_APPEND: + case FUNC_WEB_SENSOR: RfSnsShow(0); break; #endif // USE_WEBSERVER diff --git a/sonoff/xsns_38_az7798.ino b/sonoff/xsns_38_az7798.ino index 3ec73085e..2aecab9a1 100644 --- a/sonoff/xsns_38_az7798.ino +++ b/sonoff/xsns_38_az7798.ino @@ -258,15 +258,15 @@ void AzShow(bool json) dtostrfd(az_humidity, Settings.flag2.humidity_resolution, humidity); if (json) { - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"%s\":{\"" D_JSON_CO2 "\":%d,\"" D_JSON_TEMPERATURE "\":%s,\"" D_JSON_HUMIDITY "\":%s}"), mqtt_data, ktype, az_co2, temperature, humidity); + ResponseAppend_P(PSTR(",\"%s\":{\"" D_JSON_CO2 "\":%d,\"" D_JSON_TEMPERATURE "\":%s,\"" D_JSON_HUMIDITY "\":%s}"), ktype, az_co2, temperature, humidity); #ifdef USE_DOMOTICZ if (0 == tele_period) DomoticzSensor(DZ_AIRQUALITY, az_co2); #endif // USE_DOMOTICZ #ifdef USE_WEBSERVER } else { - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_CO2, mqtt_data, ktype, az_co2); - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_TEMP, mqtt_data, ktype, temperature, TempUnit()); - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_HUM, mqtt_data, ktype, humidity); + WSContentSend_PD(HTTP_SNS_CO2, ktype, az_co2); + WSContentSend_PD(HTTP_SNS_TEMP, ktype, temperature, TempUnit()); + WSContentSend_PD(HTTP_SNS_HUM, ktype, humidity); #endif // USE_WEBSERVER } } @@ -291,7 +291,7 @@ bool Xsns38(uint8_t function) AzShow(1); break; #ifdef USE_WEBSERVER - case FUNC_WEB_APPEND: + case FUNC_WEB_SENSOR: AzShow(0); break; #endif // USE_WEBSERVER diff --git a/sonoff/xsns_39_max31855.ino b/sonoff/xsns_39_max31855.ino index 10630e171..fc43ecac1 100644 --- a/sonoff/xsns_39_max31855.ino +++ b/sonoff/xsns_39_max31855.ino @@ -101,7 +101,7 @@ int32_t MAX31855_ShiftIn(uint8_t Length){ digitalWrite(pin[GPIO_MAX31855CS], LOW); // CS = LOW -> Start SPI communication delayMicroseconds(1); // CS fall to output enable = max. 100ns - + for(uint8_t i = 0; i < Length; i++) { digitalWrite(pin[GPIO_MAX31855CLK], LOW); @@ -115,7 +115,7 @@ int32_t MAX31855_ShiftIn(uint8_t Length){ digitalWrite(pin[GPIO_MAX31855CS], HIGH); // CS = HIGH -> End SPI communication digitalWrite(pin[GPIO_MAX31855CLK], LOW); - return dataIn; + return dataIn; } void MAX31855_Show(bool Json){ @@ -125,8 +125,8 @@ void MAX31855_Show(bool Json){ dtostrfd(MAX31855_Result.ReferenceTemperature, Settings.flag2.temperature_resolution, referencetemp); if(Json){ - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"%s\":{\"" D_JSON_PROBETEMPERATURE "\":%s,\"" D_JSON_REFERENCETEMPERATURE "\":%s,\"" D_JSON_ERROR "\":%d}"), \ - mqtt_data, "MAX31855", probetemp, referencetemp, MAX31855_Result.ErrorCode); + ResponseAppend_P(PSTR(",\"MAX31855\":{\"" D_JSON_PROBETEMPERATURE "\":%s,\"" D_JSON_REFERENCETEMPERATURE "\":%s,\"" D_JSON_ERROR "\":%d}"), \ + probetemp, referencetemp, MAX31855_Result.ErrorCode); #ifdef USE_DOMOTICZ if (0 == tele_period) { DomoticzSensor(DZ_TEMP, probetemp); @@ -139,7 +139,7 @@ void MAX31855_Show(bool Json){ #endif // USE_KNX } else { #ifdef USE_WEBSERVER - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_TEMP, mqtt_data, "MAX31855", probetemp, TempUnit()); + WSContentSend_PD(HTTP_SNS_TEMP, "MAX31855", probetemp, TempUnit()); #endif // USE_WEBSERVER } } @@ -164,7 +164,7 @@ bool Xsns39(uint8_t function) MAX31855_Show(true); break; #ifdef USE_WEBSERVER - case FUNC_WEB_APPEND: + case FUNC_WEB_SENSOR: MAX31855_Show(false); break; #endif // USE_WEBSERVER diff --git a/sonoff/xsns_40_pn532.ino b/sonoff/xsns_40_pn532.ino index c1daef96e..491996327 100644 --- a/sonoff/xsns_40_pn532.ino +++ b/sonoff/xsns_40_pn532.ino @@ -76,8 +76,7 @@ void PN532_Init(void) PN532_setPassiveActivationRetries(0xFF); PN532_SAMConfig(); pn532_model = 1; - snprintf_P(log_data, sizeof(log_data),"NFC: PN532 NFC Reader detected (V%u.%u)",(ver>>16) & 0xFF, (ver>>8) & 0xFF); - AddLog(LOG_LEVEL_INFO); + AddLog_P2(LOG_LEVEL_INFO,"NFC: PN532 NFC Reader detected (V%u.%u)",(ver>>16) & 0xFF, (ver>>8) & 0xFF); } } } @@ -446,8 +445,7 @@ void PN532_ScanForTag(void) } if (mifareclassic_WriteDataBlock(1, card_data)) { erase_success = true; - snprintf_P(log_data, sizeof(log_data),"NFC: PN532 NFC - Erase success"); - AddLog(LOG_LEVEL_INFO); + AddLog_P(LOG_LEVEL_INFO, PSTR("NFC: PN532 NFC - Erase success")); memcpy(&card_datas,&card_data,sizeof(card_data)); // Cast block 1 to a string } } @@ -456,8 +454,7 @@ void PN532_ScanForTag(void) memcpy(&card_data,&pn532_newdata,sizeof(card_data)); if (mifareclassic_WriteDataBlock(1, card_data)) { set_success = true; - snprintf_P(log_data, sizeof(log_data),"NFC: PN532 NFC - Data write successful"); - AddLog(LOG_LEVEL_INFO); + AddLog_P(LOG_LEVEL_INFO, PSTR("NFC: PN532 NFC - Data write successful")); memcpy(&card_datas,&card_data,sizeof(card_data)); // Cast block 1 to a string } #else @@ -472,13 +469,11 @@ void PN532_ScanForTag(void) card_data[pn532_newdata_len] = '\0'; // Enforce null termination if (mifareclassic_WriteDataBlock(1, card_data)) { set_success = true; - snprintf_P(log_data, sizeof(log_data),"NFC: PN532 NFC - Data write successful"); - AddLog(LOG_LEVEL_INFO); + AddLog_P(LOG_LEVEL_INFO, PSTR("NFC: PN532 NFC - Data write successful")); memcpy(&card_datas,&card_data,sizeof(card_data)); // Cast block 1 to a string } } else { - snprintf_P(log_data, sizeof(log_data),"NFC: PN532 NFC - Data must be alphanumeric"); - AddLog(LOG_LEVEL_INFO); + AddLog_P(LOG_LEVEL_INFO, PSTR("NFC: PN532 NFC - Data must be alphanumeric")); } #endif // USE_PN532_DATA_RAW } @@ -489,14 +484,12 @@ void PN532_ScanForTag(void) switch (pn532_function) { case 0x01: if (!erase_success) { - snprintf_P(log_data, sizeof(log_data),"NFC: PN532 NFC - Erase fail - exiting erase mode"); - AddLog(LOG_LEVEL_INFO); + AddLog_P(LOG_LEVEL_INFO, PSTR("NFC: PN532 NFC - Erase fail - exiting erase mode")); } break; case 0x02: if (!set_success) { - snprintf_P(log_data, sizeof(log_data),"NFC: PN532 NFC - Write failed - exiting set mode"); - AddLog(LOG_LEVEL_INFO); + AddLog_P(LOG_LEVEL_INFO, PSTR("NFC: PN532 NFC - Write failed - exiting set mode")); } default: break; @@ -504,12 +497,12 @@ void PN532_ScanForTag(void) pn532_function = 0; #endif // USE_PN532_DATA_FUNCTION - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_JSON_TIME "\":\"%s\""), GetDateAndTime(DT_LOCAL).c_str()); + Response_P(PSTR("{\"" D_JSON_TIME "\":\"%s\""), GetDateAndTime(DT_LOCAL).c_str()); #ifdef USE_PN532_DATA_FUNCTION - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"PN532\":{\"UID\":\"%s\", \"DATA\":\"%s\"}}"), mqtt_data, uids, card_datas); + ResponseAppend_P(PSTR(",\"PN532\":{\"UID\":\"%s\", \"DATA\":\"%s\"}}"), uids, card_datas); #else - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"PN532\":{\"UID\":\"%s\"}}"), mqtt_data, uids); + ResponseAppend_P(PSTR(",\"PN532\":{\"UID\":\"%s\"}}"), uids); #endif // USE_PN532_DATA_FUNCTION MqttPublishPrefixTopic_P(TELE, PSTR(D_RSLT_SENSOR), Settings.flag.mqtt_sensor_retain); @@ -550,10 +543,8 @@ bool PN532_Command(void) UpperCase(XdrvMailbox.data,XdrvMailbox.data); if (!strcmp(subStr(sub_string, XdrvMailbox.data, ",", 1),"E")) { pn532_function = 1; // Block 1 of next card/tag will be reset to 0x00... - snprintf_P(log_data, sizeof(log_data),"NFC: PN532 NFC - Next scanned tag data block 1 will be erased"); - AddLog(LOG_LEVEL_INFO); - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_JSON_TIME "\":\"%s\""), GetDateAndTime(DT_LOCAL).c_str()); - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"PN532\":{\"COMMAND\":\"E\"\"}}"), mqtt_data); + AddLog_P(LOG_LEVEL_INFO, PSTR("NFC: PN532 NFC - Next scanned tag data block 1 will be erased")); + Response_P(PSTR("{\"" D_JSON_TIME "\":\"%s\",\"PN532\":{\"COMMAND\":\"E\"}}"), GetDateAndTime(DT_LOCAL).c_str()); return serviced; } if (!strcmp(subStr(sub_string, XdrvMailbox.data, ",", 1),"S")) { @@ -568,10 +559,8 @@ bool PN532_Command(void) memcpy(&pn532_newdata,&sub_string_tmp,pn532_newdata_len); pn532_newdata[pn532_newdata_len] = 0x00; // Null terminate the string pn532_function = 2; - snprintf_P(log_data, sizeof(log_data),"NFC: PN532 NFC - Next scanned tag data block 1 will be set to '%s'",pn532_newdata); - AddLog(LOG_LEVEL_INFO); - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_JSON_TIME "\":\"%s\""), GetDateAndTime(DT_LOCAL).c_str()); - snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"PN532\":{\"COMMAND\":\"S\"\"}}"), mqtt_data); + AddLog_P2(LOG_LEVEL_INFO, PSTR("NFC: PN532 NFC - Next scanned tag data block 1 will be set to '%s'"), pn532_newdata); + Response_P(PSTR("{\"" D_JSON_TIME "\":\"%s\",\"PN532\":{\"COMMAND\":\"S\"}}"), GetDateAndTime(DT_LOCAL).c_str()); return serviced; } } @@ -602,7 +591,7 @@ bool Xsns40(uint8_t function) case FUNC_EVERY_SECOND: break; #ifdef USE_PN532_DATA_FUNCTION - case FUNC_COMMAND: + case FUNC_COMMAND_SENSOR: if (XSNS_40 == XdrvMailbox.index) { result = PN532_Command(); } diff --git a/sonoff/xsns_41_max44009.ino b/sonoff/xsns_41_max44009.ino index 25d415222..891b36815 100644 --- a/sonoff/xsns_41_max44009.ino +++ b/sonoff/xsns_41_max44009.ino @@ -94,8 +94,7 @@ void Max4409Detect(void) Wire.write(MAX44009_CONTINUOUS_AUTO_MODE); if (0 == Wire.endTransmission()) { max44009_found = 1; - snprintf_P(log_data, sizeof(log_data), S_LOG_I2C_FOUND_AT, max44009_types, max44009_address); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, S_LOG_I2C_FOUND_AT, max44009_types, max44009_address); break; } } @@ -129,9 +128,7 @@ void Max4409Show(bool json) dtostrf(max44009_illuminance, sizeof(illum_str) -1, prec, illum_str); if (json) { - snprintf_P(mqtt_data, sizeof(mqtt_data), - PSTR("%s,\"%s\":{\"" D_JSON_ILLUMINANCE "\":%s}"), - mqtt_data, max44009_types, illum_str); + ResponseAppend_P(PSTR(",\"%s\":{\"" D_JSON_ILLUMINANCE "\":%s}"), max44009_types, illum_str); #ifdef USE_DOMOTICZ if (0 == tele_period) { DomoticzSensor(DZ_ILLUMINANCE, illum_str); @@ -140,8 +137,7 @@ void Max4409Show(bool json) #ifdef USE_WEBSERVER } else { // show integer value for lx on web-server - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_ILLUMINANCE, - mqtt_data, max44009_types, (int)max44009_illuminance); + WSContentSend_PD(HTTP_SNS_ILLUMINANCE, max44009_types, (int)max44009_illuminance); #endif // USE_WEBSERVER } } @@ -167,7 +163,7 @@ bool Xsns41(uint8_t function) Max4409Show(1); break; #ifdef USE_WEBSERVER - case FUNC_WEB_APPEND: + case FUNC_WEB_SENSOR: Max4409Show(0); break; #endif // USE_WEBSERVER diff --git a/sonoff/xsns_42_scd30.ino b/sonoff/xsns_42_scd30.ino new file mode 100644 index 000000000..44e23ea49 --- /dev/null +++ b/sonoff/xsns_42_scd30.ino @@ -0,0 +1,495 @@ +/* + xsns_42_scd30.ino - SC30 CO2 sensor support for Sonoff-Tasmota + + Copyright (C) 2019 Frogmore42 + + 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 . + +*/ +#ifdef USE_I2C +#ifdef USE_SCD30 + +#define XSNS_42 42 + +#define SCD30_MAX_MISSED_READS 3 +#define SONOFF_SCD30_STATE_NO_ERROR 0 +#define SONOFF_SCD30_STATE_ERROR_DATA_CRC 1 +#define SONOFF_SCD30_STATE_ERROR_READ_MEAS 2 +#define SONOFF_SCD30_STATE_ERROR_SOFT_RESET 3 +#define SONOFF_SCD30_STATE_ERROR_I2C_RESET 4 +#define SONOFF_SCD30_STATE_ERROR_UNKNOWN 5 + +#include "Arduino.h" +#include + +#define D_CMND_SCD30 "SCD30" + +const char S_JSON_SCD30_COMMAND_NVALUE[] PROGMEM = "{\"" D_CMND_SCD30 "%s\":%d}"; +const char S_JSON_SCD30_COMMAND_NFW_VALUE[] PROGMEM = "{\"" D_CMND_SCD30 "%s\":%d.%d}"; +const char S_JSON_SCD30_COMMAND[] PROGMEM = "{\"" D_CMND_SCD30 "%s\"}"; +const char kSCD30_Commands[] PROGMEM = "Alt|Auto|Cal|FW|Int|Pres|TOff"; + +/*********************************************************************************************\ + * enumerationsines +\*********************************************************************************************/ + +enum SCD30_Commands { // commands useable in console or rules + CMND_SCD30_ALTITUDE, + CMND_SCD30_AUTOMODE, + CMND_SCD30_CALIBRATE, + CMND_SCD30_FW, + CMND_SCD30_INTERVAL, + CMND_SCD30_PRESSURE, + CMND_SCD30_TEMPOFFSET +}; + + + +FrogmoreScd30 scd30; + +bool scd30Found = false; +bool scd30IsDataValid = false; +int scd30ErrorState = SONOFF_SCD30_STATE_NO_ERROR; +uint16_t scd30Interval_sec; +int scd30Loop_count = 0; +int scd30DataNotAvailable_count = 0; +int scd30GoodMeas_count = 0; +int scd30Reset_count = 0; +int scd30CrcError_count = 0; +int scd30Co2Zero_count = 0; +int i2cReset_count = 0; +uint16_t scd30_CO2 = 0; +uint16_t scd30_CO2EAvg = 0; +float scd30_Humid = 0.0; +float scd30_Temp = 0.0; + +bool Scd30Init() +{ + int error; + bool i2c_flg = ((pin[GPIO_I2C_SCL] < 99) && (pin[GPIO_I2C_SDA] < 99)); + if (i2c_flg) + { + uint8_t major = 0; + uint8_t minor = 0; + uint16_t interval_sec; + scd30.begin(); + error = scd30.getFirmwareVersion(&major, &minor); + if (error) + { +#ifdef SCD30_DEBUG + snprintf_P(log_data, sizeof(log_data), "SCD30: did not find an SCD30: 0x%lX", error); + AddLog(LOG_LEVEL_DEBUG); +#endif + return false; + } + else + { +#ifdef SCD30_DEBUG + snprintf_P(log_data, sizeof(log_data), "SCD30: found an SCD30: FW v%d.%d", major, minor); + AddLog(LOG_LEVEL_INFO); +#endif + } + + error = scd30.getMeasurementInterval(&scd30Interval_sec); + if (error) + { +#ifdef SCD30_DEBUG + snprintf_P(log_data, sizeof(log_data), "SCD30: error getMeasurementInterval: 0x%lX", error); + AddLog(LOG_LEVEL_ERROR); +#endif + return false; + } + + error = scd30.beginMeasuring(); + if (error) + { +#ifdef SCD30_DEBUG + snprintf_P(log_data, sizeof(log_data), "Error: Scd30BeginMeasuring: 0x%lX", error); + AddLog(LOG_LEVEL_ERROR); +#endif + return false; + } + + return true; + } +} + +// gets data from the sensor every 3 seconds or so to give the sensor time to gather new data +int Scd30Update() +{ + int error = 0; + int16_t delta = 0; + scd30Loop_count++; + + if (!scd30Found) + { + scd30Found = Scd30Init(); +#ifdef SCD30_DEBUG + snprintf_P(log_data, sizeof(log_data), "Scd30Update: found: %d ", scd30Found); + AddLog(LOG_LEVEL_INFO); +#endif + if (!scd30Found) + { +#ifdef SCD30_DEBUG + snprintf_P(log_data, sizeof(log_data), "Scd30Update: found: %d ", scd30Found); + AddLog(LOG_LEVEL_INFO); +#endif + return (ERROR_SCD30_NOT_FOUND_ERROR); + } + } + else + { + if (scd30Loop_count > (scd30Interval_sec - 1)) + { + switch (scd30ErrorState) + { + case SONOFF_SCD30_STATE_NO_ERROR: + { + error = scd30.readMeasurement(&scd30_CO2, &scd30_CO2EAvg, &scd30_Temp, &scd30_Humid); + switch (error) + { + case ERROR_SCD30_NO_ERROR: + scd30Loop_count = 0; + scd30IsDataValid = true; + scd30GoodMeas_count++; + break; + + case ERROR_SCD30_NO_DATA: + scd30DataNotAvailable_count++; + break; + + case ERROR_SCD30_CRC_ERROR: + scd30ErrorState = SONOFF_SCD30_STATE_ERROR_DATA_CRC; + scd30CrcError_count++; +#ifdef SCD30_DEBUG + snprintf_P(log_data, sizeof(log_data), "SCD30: CRC error, CRC error: %ld, CO2 zero: %ld, good: %ld, no data: %ld, sc30_reset: %ld, i2c_reset: %ld", scd30CrcError_count, scd30Co2Zero_count, scd30GoodMeas_count, scd30DataNotAvailable_count, scd30Reset_count, i2cReset_count); + AddLog(LOG_LEVEL_ERROR); +#endif + break; + + case ERROR_SCD30_CO2_ZERO: + scd30Co2Zero_count++; +#ifdef SCD30_DEBUG + snprintf_P(log_data, sizeof(log_data), "SCD30: CO2 zero, CRC error: %ld, CO2 zero: %ld, good: %ld, no data: %ld, sc30_reset: %ld, i2c_reset: %ld", scd30CrcError_count, scd30Co2Zero_count, scd30GoodMeas_count, scd30DataNotAvailable_count, scd30Reset_count, i2cReset_count); + AddLog(LOG_LEVEL_ERROR); +#endif + break; + + default: + { + scd30ErrorState = SONOFF_SCD30_STATE_ERROR_READ_MEAS; +#ifdef SCD30_DEBUG + snprintf_P(log_data, sizeof(log_data), "SCD30: Update: ReadMeasurement error: 0x%lX, counter: %ld", error, scd30Loop_count); + AddLog(LOG_LEVEL_ERROR); +#endif + return (error); + } + break; + } + } + break; + + case SONOFF_SCD30_STATE_ERROR_DATA_CRC: + { + //scd30IsDataValid = false; +#ifdef SCD30_DEBUG + snprintf_P(log_data, sizeof(log_data), "SCD30: in error state: %d, good: %ld, no data: %ld, sc30 reset: %ld, i2c reset: %ld", scd30ErrorState, scd30GoodMeas_count, scd30DataNotAvailable_count, scd30Reset_count, i2cReset_count); + AddLog(LOG_LEVEL_ERROR); + snprintf_P(log_data, sizeof(log_data), "SCD30: got CRC error, try again, counter: %ld", scd30Loop_count); + AddLog(LOG_LEVEL_ERROR); +#endif + scd30ErrorState = ERROR_SCD30_NO_ERROR; + } + break; + + case SONOFF_SCD30_STATE_ERROR_READ_MEAS: + { + //scd30IsDataValid = false; +#ifdef SCD30_DEBUG + snprintf_P(log_data, sizeof(log_data), "SCD30: in error state: %d, good: %ld, no data: %ld, sc30 reset: %ld, i2c reset: %ld", scd30ErrorState, scd30GoodMeas_count, scd30DataNotAvailable_count, scd30Reset_count, i2cReset_count); + AddLog(LOG_LEVEL_ERROR); + snprintf_P(log_data, sizeof(log_data), "SCD30: not answering, sending soft reset, counter: %ld", scd30Loop_count); + AddLog(LOG_LEVEL_ERROR); +#endif + scd30Reset_count++; + error = scd30.softReset(); + if (error) + { +#ifdef SCD30_DEBUG + snprintf_P(log_data, sizeof(log_data), "SCD30: resetting got error: 0x%lX", error); + AddLog(LOG_LEVEL_ERROR); +#endif + error >>= 8; + if (error == 4) + { + scd30ErrorState = SONOFF_SCD30_STATE_ERROR_SOFT_RESET; + } + else + { + scd30ErrorState = SONOFF_SCD30_STATE_ERROR_UNKNOWN; + } + } + else + { + scd30ErrorState = ERROR_SCD30_NO_ERROR; + } + } + break; + + case SONOFF_SCD30_STATE_ERROR_SOFT_RESET: + { + //scd30IsDataValid = false; +#ifdef SCD30_DEBUG + snprintf_P(log_data, sizeof(log_data), "SCD30: in error state: %d, good: %ld, no data: %ld, sc30 reset: %ld, i2c reset: %ld", scd30ErrorState, scd30GoodMeas_count, scd30DataNotAvailable_count, scd30Reset_count, i2cReset_count); + AddLog(LOG_LEVEL_ERROR); + snprintf_P(log_data, sizeof(log_data), "SCD30: clearing i2c bus"); + AddLog(LOG_LEVEL_ERROR); +#endif + i2cReset_count++; + error = scd30.clearI2CBus(); + if (error) + { + scd30ErrorState = SONOFF_SCD30_STATE_ERROR_I2C_RESET; +#ifdef SCD30_DEBUG + snprintf_P(log_data, sizeof(log_data), "SCD30: error clearing i2c bus: 0x%lX", error); + AddLog(LOG_LEVEL_ERROR); +#endif + } + else + { + scd30ErrorState = ERROR_SCD30_NO_ERROR; + } + } + break; + + default: + { + //scd30IsDataValid = false; +#ifdef SCD30_DEBUG + snprintf_P(log_data, sizeof(log_data), "SCD30: unknown error state: 0x%lX", scd30ErrorState); + AddLog(LOG_LEVEL_ERROR); +#endif + scd30ErrorState = SONOFF_SCD30_STATE_ERROR_SOFT_RESET; // try again + } + } + + if (scd30Loop_count > (SCD30_MAX_MISSED_READS * scd30Interval_sec)) + { + scd30IsDataValid = false; + } + } + } + return (ERROR_SCD30_NO_ERROR); +} + + +int Scd30GetCommand(int command_code, uint16_t *pvalue) +{ + switch (command_code) + { + case CMND_SCD30_ALTITUDE: + return scd30.getAltitudeCompensation(pvalue); + break; + + case CMND_SCD30_AUTOMODE: + return scd30.getCalibrationType(pvalue); + break; + + case CMND_SCD30_CALIBRATE: + return scd30.getForcedRecalibrationFactor(pvalue); + break; + + case CMND_SCD30_INTERVAL: + return scd30.getMeasurementInterval(pvalue); + break; + + case CMND_SCD30_PRESSURE: + return scd30.getAmbientPressure(pvalue); + break; + + case CMND_SCD30_TEMPOFFSET: + return scd30.getTemperatureOffset(pvalue); + break; + + default: + // else for Unknown command + break; + } +} + +int Scd30SetCommand(int command_code, uint16_t value) +{ + switch (command_code) + { + case CMND_SCD30_ALTITUDE: + return scd30.setAltitudeCompensation(value); + break; + + case CMND_SCD30_AUTOMODE: + return scd30.setCalibrationType(value); + break; + + case CMND_SCD30_CALIBRATE: + return scd30.setForcedRecalibrationFactor(value); + break; + + case CMND_SCD30_INTERVAL: + { + int error = scd30.setMeasurementInterval(value); + if (!error) + { + scd30Interval_sec = value; + } + + return error; + } + break; + + case CMND_SCD30_PRESSURE: + return scd30.setAmbientPressure(value); + break; + + case CMND_SCD30_TEMPOFFSET: + return scd30.setTemperatureOffset(value); + break; + + default: + // else for Unknown command + break; + } +} +/*********************************************************************************************\ + * Command Sensor92 +\*********************************************************************************************/ + +bool Scd30CommandSensor() +{ + char command[CMDSZ]; + bool serviced = true; + uint8_t prefix_len = strlen(D_CMND_SCD30); + + if (!strncasecmp_P(XdrvMailbox.topic, PSTR(D_CMND_SCD30), prefix_len)) { // prefix + int command_code = GetCommandCode(command, sizeof(command), XdrvMailbox.topic + prefix_len, kSCD30_Commands); + + switch (command_code) { + case CMND_SCD30_ALTITUDE: + case CMND_SCD30_AUTOMODE: + case CMND_SCD30_CALIBRATE: + case CMND_SCD30_INTERVAL: + case CMND_SCD30_PRESSURE: + case CMND_SCD30_TEMPOFFSET: + { + uint16_t value = 0; + if (XdrvMailbox.data_len > 0) + { + value = XdrvMailbox.payload16; + Scd30SetCommand(command_code, value); + } + else + { + Scd30GetCommand(command_code, &value); + } + + Response_P(S_JSON_SCD30_COMMAND_NVALUE, command, value); + } + break; + + case CMND_SCD30_FW: + { + uint8_t major = 0; + uint8_t minor = 0; + int error; + error = scd30.getFirmwareVersion(&major, &minor); + if (error) + { +#ifdef SCD30_DEBUG + snprintf_P(log_data, sizeof(log_data), "SCD30: error getting FW version: 0x%lX", error); + AddLog(LOG_LEVEL_ERROR); +#endif + serviced = false; + } + else + { + Response_P(S_JSON_SCD30_COMMAND_NFW_VALUE, command, major, minor); + } + } + break; + + default: + // else for Unknown command + serviced = false; + break; + } + } + return serviced; +} + +void Scd30Show(bool json) +{ + char humidity[10]; + char temperature[10]; + + if (scd30Found && scd30IsDataValid) + { + dtostrfd(scd30_Humid, Settings.flag2.humidity_resolution, humidity); + dtostrfd(ConvertTemp(scd30_Temp), Settings.flag2.temperature_resolution, temperature); + if (json) { + //ResponseAppend_P(PSTR(",\"SCD30\":{\"" D_JSON_CO2 "\":%d,\"" D_JSON_TEMPERATURE "\":%s,\"" D_JSON_HUMIDITY "\":%s}"), scd30_CO2, temperature, humidity); + ResponseAppend_P(PSTR(",\"SCD30\":{\"" D_JSON_CO2 "\":%d,\"" D_JSON_ECO2 "\":%d,\"" D_JSON_TEMPERATURE "\":%s,\"" D_JSON_HUMIDITY "\":%s}"), + scd30_CO2, scd30_CO2EAvg, temperature, humidity); +#ifdef USE_DOMOTICZ + if (0 == tele_period) DomoticzSensor(DZ_AIRQUALITY, scd30_CO2); +#endif // USE_DOMOTICZ +#ifdef USE_WEBSERVER + } else { + WSContentSend_PD(HTTP_SNS_CO2EAVG, "SCD30", scd30_CO2EAvg); + WSContentSend_PD(HTTP_SNS_CO2, "SCD30", scd30_CO2); + WSContentSend_PD(HTTP_SNS_TEMP, "SCD30", temperature, TempUnit()); + WSContentSend_PD(HTTP_SNS_HUM, "SCD30", humidity); +#endif // USE_WEBSERVER + } + } +} + +/*********************************************************************************************\ + * Interface +\*********************************************************************************************/ + +bool Xsns42(byte function) +{ + bool result = false; + + if (i2c_flg) { + switch (function) { + case FUNC_EVERY_SECOND: + Scd30Update(); + break; + case FUNC_COMMAND: + result = Scd30CommandSensor(); + break; + case FUNC_JSON_APPEND: + Scd30Show(1); + break; +#ifdef USE_WEBSERVER + case FUNC_WEB_SENSOR: + Scd30Show(0); + break; +#endif // USE_WEBSERVER + } + } + return result; +} + +#endif // USE_SCD30 +#endif // USE_I2C diff --git a/sonoff/xsns_43_hre.ino b/sonoff/xsns_43_hre.ino new file mode 100644 index 000000000..08181559f --- /dev/null +++ b/sonoff/xsns_43_hre.ino @@ -0,0 +1,288 @@ +/* + xsns_43_hre.ino - Badger HR-E Water Meter Encoder interface + + Copyright (C) 2019 Jon Little + + 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 . +*/ + +#ifdef USE_HRE +/*********************************************************************************************\ + * HR-E LCD Water meter register interface + * + * https://www.badgermeter.com/business-lines/utility/high-resolution-lcd-encoders-hr-e-lcd/ + * Source: Jon Little, https://github.com/burundiocibu/particle/blob/master/water_meter/src/HRE_Reader.cpp + * + * This code marches the bits out the data line as ASCII characters with the form + * KG44?Q45484=0444444V;RB000000022;IB018435683 + * where the RB...; is the miligalons used + * + * Note that this sensor takes a _long_ time to read. 62 bits * 4 ms/bit for the + * sync sequence plus 46 bytes * 40 ms/byte = 2088 ms minimum. If we aren't alligned + * to the sync sequence, it could be almost twice that. + * To keep from bogging the kernel down, we read 8 bits at a time on the 50 ms callback. + * It will take seconds to discover if the device is there. + * + * In lieu of an actual schematic to describe the electrical interface, here is a description: + * + * hre_clock_pin: drives the power/clock for the water meter through a 1k resister to + * the base of a pnp transistor + * hre_data_pin: is the data and has a 1 k pulldown + * + * The pnp transitor has the collector connected to the power/clock and is pulled up + * to +5 via a 1 k resistor. + * The emitter is connected to ground + * +\*********************************************************************************************/ + +#define XSNS_43 43 + +enum hre_states { + hre_idle, // Initial state, + hre_sync, // Start search for sync sequence + hre_syncing, // Searching for sync sequence + hre_read, // Start reading data block + hre_reading, // Reading data + hre_sleep, // Start sleeping + hre_sleeping // pausing before reading again +}; + +hre_states hre_state = hre_idle; + +float hre_usage = 0; // total water usage, in gal +float hre_rate = 0; // flow rate, in gal/min +uint32_t hre_usage_time = 0; // uptime associated with hre_usage and hre_rate + +int hre_read_errors = 0; // total number of read errors since boot +bool hre_good = false; + + +// The settling times here were determined using a single unit hooked to a scope +int hreReadBit() +{ + digitalWrite(pin[GPIO_HRE_CLOCK], HIGH); + delay(1); + int bit = digitalRead(pin[GPIO_HRE_DATA]); + digitalWrite(pin[GPIO_HRE_CLOCK], LOW); + delay(1); + return bit; +} + +// With the times in the HreReadBit routine, a characer will take +// 20 ms plus io time. +char hreReadChar(int &parity_errors) +{ + // start bit + hreReadBit(); + + unsigned ch=0; + int sum=0; + for (int i=0; i<7; i++) + { + int b = hreReadBit(); + ch |= b << i; + sum += b; + } + + // parity + if ( (sum & 0x1) != hreReadBit()) + parity_errors++; + + // stop bit + hreReadBit(); + + return ch; +} + +void hreInit(void) +{ + hre_read_errors = 0; + hre_good = false; + + pinMode(pin[GPIO_HRE_CLOCK], OUTPUT); + pinMode(pin[GPIO_HRE_DATA], INPUT); + + // Note that the level shifter inverts this line and we want to leave it + // high when not being read. + digitalWrite(pin[GPIO_HRE_CLOCK], LOW); + + hre_state = hre_sync; +} + + +void hreEvery50ms(void) +{ + static int sync_counter = 0; // Number of sync bit reads + static int sync_run = 0; // Number of consecutive '1's read + + static uint32_t curr_start = 0; // uptime when entered hre_reading for current read + static int read_counter = 0; // number of bytes in the current read + static int parity_errors = 0; // Number of parity errors in current read + static char buff[46]; // 8 char and a term + + static char ch; + static size_t i; + + switch (hre_state) + { + case hre_sync: + if (uptime < 10) + break; + sync_run = 0; + sync_counter = 0; + hre_state = hre_syncing; + AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_HRE "hre_state:hre_syncing")); + break; + + case hre_syncing: + // Find the header, a string of 62 '1's + // Since each bit taks 2 ms, we just read 20 bits at a time + for (int i=0; i<20; i++) + { + if (hreReadBit()) + sync_run++; + else + sync_run = 0; + if (sync_run == 62) + { + hre_state = hre_read; + break; + } + sync_counter++; + } + // If the meter doesn't get in sync within 1000 bits, give up for now + if (sync_counter > 1000) + { + hre_state = hre_sleep; + AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_HRE D_ERROR)); + } + break; + + // Start reading the data block + case hre_read: + AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_HRE "sync_run:%d, sync_counter:%d"), sync_run, sync_counter); + read_counter = 0; + parity_errors = 0; + curr_start = uptime; + memset(buff, 0, sizeof(buff)); + hre_state = hre_reading; + AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_HRE "hre_state:hre_reading")); + // So this is intended to fall through to the hre_reading section. + // it seems that if there is much of a delay between getting the sync + // bits and starting the read, the HRE won't output the message we + // are looking for... + + case hre_reading: + // Read two characters at a time... + buff[read_counter++] = hreReadChar(parity_errors); + buff[read_counter++] = hreReadChar(parity_errors); + + if (read_counter == 46) + { + AddLog_P2(LOG_LEVEL_DEBUG, PSTR(D_LOG_HRE "pe:%d, re:%d, buff:%s"), + parity_errors, hre_read_errors, buff); + if (parity_errors == 0) + { + float curr_usage; + curr_usage = 0.01 * atol(buff+24); // useage in gal + if (hre_usage_time) + { + double dt = 1.666e-2 * (curr_start - hre_usage_time); // dt in minutes + hre_rate = (curr_usage - hre_usage)/dt; // gallons/min + } + hre_usage = curr_usage; + hre_usage_time = curr_start; + hre_good = true; + + hre_state = hre_sleep; + } + else + { + hre_read_errors++; + hre_state = hre_sleep; + } + } + break; + + case hre_sleep: + hre_usage_time = curr_start; + hre_state = hre_sleeping; + AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_HRE "hre_state:hre_sleeping")); + + case hre_sleeping: + // If there isn't some delay between readings, rate calculations + // aren't as accurate. 27 seconds will give about a 30 second refresh rate + if (uptime - hre_usage_time >= 27) + hre_state = hre_sync; + } +} + +void hreShow(boolean json) +{ + if (!hre_good) + return; + + const char *id = "HRE"; + + char usage[16]; + char rate[16]; + dtostrfd(hre_usage, 2, usage); + dtostrfd(hre_rate, 3, rate); + + if (json) + { + ResponseAppend_P(JSON_SNS_GNGPM, id, usage, rate); +#ifdef USE_WEBSERVER + } + else + { + WSContentSend_PD(HTTP_SNS_GALLONS, id, usage); + WSContentSend_PD(HTTP_SNS_GPM, id, rate); +#endif // USE_WEBSERVER + } +} + + +/*********************************************************************************************\ + * Interface +\*********************************************************************************************/ +bool Xsns43(byte function) +{ + // If we don't have pins assigned give up quickly. + if (pin[GPIO_HRE_CLOCK] >= 99 || pin[GPIO_HRE_DATA] >= 99) + return false; + + switch (function) + { + case FUNC_INIT: + hreInit(); + break; + case FUNC_EVERY_50_MSECOND: + hreEvery50ms(); + break; + case FUNC_EVERY_SECOND: + break; + case FUNC_JSON_APPEND: + hreShow(1); + break; +#ifdef USE_WEBSERVER + case FUNC_WEB_SENSOR: + hreShow(0); + break; +#endif // USE_WEBSERVER + } + return false; +} + +#endif // USE_HRE diff --git a/sonoff/xsns_interface.ino b/sonoff/xsns_interface.ino index 589e95adb..fdb947bfb 100644 --- a/sonoff/xsns_interface.ino +++ b/sonoff/xsns_interface.ino @@ -305,13 +305,14 @@ bool XsnsCall(uint8_t Function) uint32_t profile_millis = millis() - profile_start_millis; if (profile_millis) { if (FUNC_EVERY_SECOND == Function) { - snprintf_P(log_data, sizeof(log_data), PSTR("PRF: At %08u XsnsCall %d to Sensor %d took %u mS"), uptime, Function, x, profile_millis); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR("PRF: At %08u XsnsCall %d to Sensor %d took %u mS"), uptime, Function, x, profile_millis); } } #endif // PROFILE_XSNS_SENSOR_EVERY_SECOND - if (result && (FUNC_COMMAND == Function)) { + if (result && ((FUNC_COMMAND == Function) || + (FUNC_COMMAND_SENSOR == Function) + )) { break; } #ifdef USE_DEBUG_DRIVER @@ -323,8 +324,7 @@ bool XsnsCall(uint8_t Function) uint32_t profile_millis = millis() - profile_start_millis; if (profile_millis) { if (FUNC_EVERY_SECOND == Function) { - snprintf_P(log_data, sizeof(log_data), PSTR("PRF: At %08u XsnsCall %d took %u mS"), uptime, Function, profile_millis); - AddLog(LOG_LEVEL_DEBUG); + AddLog_P2(LOG_LEVEL_DEBUG, PSTR("PRF: At %08u XsnsCall %d took %u mS"), uptime, Function, profile_millis); } } #endif // PROFILE_XSNS_EVERY_SECOND diff --git a/tools/decode-config.py b/tools/decode-config.py index f0779279a..161cc850d 100755 --- a/tools/decode-config.py +++ b/tools/decode-config.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -VER = '2.1.0020' +VER = '2.1.0023' """ decode-config.py - Backup/Restore Sonoff-Tasmota configuration data @@ -841,9 +841,53 @@ Setting_6_4_1_13.update ({ 'mhz19b_abc_disable': ('B', (0x717,1, 7), (None, None, ('Sensor', '"Sensor15 {}".format($)')) ), }, 0x717, (None, None, ('*', None)), (None, False) ), }) - +# ====================================================================== +Setting_6_4_1_16 = copy.deepcopy(Setting_6_4_1_13) +Setting_6_4_1_16.update({ + 'user_template_base': ('B', 0x71F, (None, None, ('Management', '"Template {}".format($)')), ('$ + 1','$ - 1') ), + 'user_template': ({ + 'name': ('15s', 0x720, (None, None, ('Management', '"Template {{\\\"NAME\\\":\\\"{}\\\"}}".format($)' )) ), + 'gpio00': ('B', 0x72F, (None, None, ('Management', '"Template {{\\\"GPIO\\\":[{},{},{},{},{},{},{},{},{},{},{},{},{}]}}".format(@["user_template"]["gpio00"],@["user_template"]["gpio01"],@["user_template"]["gpio02"],@["user_template"]["gpio03"],@["user_template"]["gpio04"],@["user_template"]["gpio05"],@["user_template"]["gpio09"],@["user_template"]["gpio10"],@["user_template"]["gpio12"],@["user_template"]["gpio13"],@["user_template"]["gpio14"],@["user_template"]["gpio15"],@["user_template"]["gpio16"])')) ), + 'gpio01': ('B', 0x730, (None, None, ('Management', None)) ), + 'gpio02': ('B', 0x731, (None, None, ('Management', None)) ), + 'gpio03': ('B', 0x732, (None, None, ('Management', None)) ), + 'gpio04': ('B', 0x733, (None, None, ('Management', None)) ), + 'gpio05': ('B', 0x734, (None, None, ('Management', None)) ), + 'gpio09': ('B', 0x735, (None, None, ('Management', None)) ), + 'gpio10': ('B', 0x736, (None, None, ('Management', None)) ), + 'gpio12': ('B', 0x737, (None, None, ('Management', None)) ), + 'gpio13': ('B', 0x738, (None, None, ('Management', None)) ), + 'gpio14': ('B', 0x739, (None, None, ('Management', None)) ), + 'gpio15': ('B', 0x73A, (None, None, ('Management', None)) ), + 'gpio16': ('B', 0x73B, (None, None, ('Management', None)) ), + 'flag': ({ + 'value': ('B', 0x73C , (None, None, ('Management', '"Template {{\\\"FLAG\\\":{}}}".format($)')) ), + 'adc0': ('B', (0x73C,1,0), (None, None, ('Management', None)) ), + 'pullup': ('B', (0x73C,1,1), (None, None, ('Management', None)) ), + }, 0x73C, (None, None, ('Management', None)) + ), + }, 0x720, (None, None, ('Management', None)) + ), +}) +# ====================================================================== +Setting_6_4_1_17 = copy.deepcopy(Setting_6_4_1_16) +Setting_6_4_1_17['flag3'][0].pop('no_pullup',None) +# ====================================================================== +Setting_6_4_1_18 = copy.deepcopy(Setting_6_4_1_17) +Setting_6_4_1_18['flag3'][0].update ({ + 'no_hold_retain': ('