-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
P021 state based extension #5085
base: mega
Are you sure you want to change the base?
P021 state based extension #5085
Conversation
Reworking the code. I saw quite some useful comments and lacking some time to fix it in a rush. |
OK, I have no idea what values I have been looking at when concluding it would save 10k+.... |
I just cancel your build job and after the release build has finished, I will resume your GH Actions build |
I just updated this PR to include merged I made right after the release build. |
I will only try to reduce memory usage. With the memory reduction all builds are successful. I tested the plugin with and without reduced build size on a ESP32. I am not sure if tests on ESP8266 are required for a merge to mega. If such tests are required I need some time to arrange a test setup. Most of my spare modules are ESP32 and ESP32-C3. This weekend I will most time far away from my keyboard. |
It's good to know if all is working as intended on an ESP8266, but if it already works fine on an ESP32, then most of the time it won't be problematic on an ESP8266. This plugin is not directly related to CPU performance or available memory, so not too much to worry about. |
The most important thing to keep in mind is that you should only add new features of existing plugins to ESP32-builds and only to ESP8266 when it isn't a regular build (thus only custom builds should be able to run those new features. As you've seen yourself, it is really hard to make it all fit again and it has taken me about 20 - 24 hours of work last week to gain these extra few kBytes of space in the build size of ESP8266. Like I've mentioned before a number of times, I have spent many 100's of hours in the past to make it all fit on ESP8266 and I don't think I should keep doing this as it will result in hours lost which could have been spent on new features, bug fixes, etc. Espressif already declared the ESP8266 as deprecated about 5 years ago, so we should just consider the ESP8266 as "feature frozen" for regular builds like "collection X" or "normal" etc. |
Sorry I am late in reply. Other stuff to do outside ESPeasy. Problem with my changes to P021 was the fact I refactored it a lot to fit the new functionality. This makes it quite difficult to get the same memory footprint by "disabling" the new stuff. Is there a way to detect the ESP8266 builds to restrict the functionality even more? We could at least disable all options on the setup page and cut out the associated control part too. Would make documentation a bit more difficult as documented features are not available... Discussion started with an new plugin fitting my timing related requirements. Suggestion was to add them to P021. Indeed it was a nice challenge to get it combined with backwards compatibility, but at the cost of some memory. We can still decide to create a new plugin and leave P021 unaltered. It will duplicate functionality, but the new plugin can be left out of all ESP8266 code. With additional savings by cutting functionality on ESP8266 I think it is wise to do some testing with this code on a 8266 too. For now the optimized code is tested on ESP32 only. Please advise how to continue. |
Currently all builds succeed, because we where able to (again) reduce the ESP8266 builds by a few kB (though I think we're close to rock-bottom now). I'd leave the new functionality in P021, and not create a new plugin. |
I think you should add a separate define which will then be used only within the P021 code. #ifndef LIMIT_BUILD_SIZE
#define FEATURE_P021_EXTRAS 1
#else
#define FEATURE_P021_EXTRAS 0
#endif And this could then be used as wrapper for all these extra features like this: #if (FEATURE_P021_EXTRAS)
....
#endif In the documentation you could add some asterisk next to the title of some feature which is only included in non-limited builds. |
I updated the code to remove new functionality on builds with limited flash sizes. Still to determine how to switch this on for all affected builds. Documentation is also updated to mark the unavailable parameters. Functionality is hand-tested for full & limited variants on ESP32. |
I could not spend much time on this plugin for some time. Meanwhile the plugin is working for more than a week to control my floor heating pump without problems. Can somebody review the logic to switch the additional functionality on/off and advise on a final configuration? I am missing some experience in managing multiple build options. Probably we should left all esp8266 versions without new functionality and enable it on the other hardware. |
Found a bug introduced due to the memory optimizations. I missed a condition check due to which extending the active phase after input became inactive was not working. I did manual testing on ESP8266 (Wemos D1) and ESP32. Software has been running for weeks at my place without issues except for not extending the active phase as described above. To be reviewed is the selection of the code size and supported functionality. For now it depends on LIMIT_BUILD_SIZE. |
As discussed previously I reworked P021 to support my floor heating pump functionality. This should be a backwards compatible upgrade from previous versions. I tried to make it as flexible as possible by adding several configuration options. Documentation is updated accordingly.