Comments (20)
I've added the Web settings.
Also noticed with modbus enabled it takes up 17kb of heap memory, and 13 when disabled. We need to try and bring that back. I haven't looked into all the code yet.
from ems-esp32.
How exactly do you compare the heap usage? Build the firmware from dev
and from feat_modbus
and compare System -> System Memory -> Heap? Or is there a better way?
I suspect that the data I allocate in modbus_entity_parameters.cpp
is not stored in Flash (as I thought it would) if it takes up 13kB of heap memory even when disabled.
There are other optimizations I can do (e.g. I register 4 modbus workers each for all ems devices, this could be changed to use ANY_SERVER
and ANY_FUNCTION_CODE
wildcards)
from ems-esp32.
yes, I actually use a python script for memory profiling but you can also use the WebUI or just read the "free mem" from the JSON output of http://ems-esp.local/api/system
The Modbus is a great feature and easily fits on modern ESP32s like the S3, but it will struggle on 4MB variants. We just need to find ways to reduce the amount of heap memory if Modbus isn't been used. When it's enabled it's fine as that is the price to pay for a new module/feature.
I see the object ModbusServerTCPasync
instantiated as default but this can't be the main culprit, something else is eating the memory, even when it's disabled.
from ems-esp32.
could you possibly instantiate ModbusServerTCPasync
from within Modbus::start()
and just use static pointers? This may save on heap memory.
Also check that LOCAL_LOG_LEVEL
is not set, unless EMSESP_DEBUG is.
I'm working on a new C++ Factory class so we can try this as a hot-pluggable module. Could you describe which integration points you have with EMS-ESP? I see the start() but you have nothing in the loop() ?
from ems-esp32.
dev has 190KB free heap, feat_modbus with Modbus disabled and using the Michael's change to static Modbus * modbus_
is 177KB so we're still eating up 13KB of memory even if not using Modbus. We need to bring this down before accepting into the dev branch. Can you see what you can do @mheyse ?
from ems-esp32.
from ems-esp32.
The design pattern is that Modbus should allocate as little to no heap memory if the service is not enabled. So something is still lurking in the headerfiles and eating up the heap during runtime (not static, progmem/flash). I still suspect it's the creation of the ModbusServerTCPasync object in modbus.cpp
- see if you can turn that into a pointer and new
-it when it needs to be created.
from ems-esp32.
from ems-esp32.
that's probably it - missed that. The modbus_register_mappings
list and tag_to_type
map. Is there a way to populate both these in the start() function using static_ptr? Also watch out for that Serial.print() in the start() function - sending Serial on a live EMS-ESP can cause havok since we're spoofing the UART for the EMS bus.
even better is to make it dynamic, like we do with HA MQTT Discovery so the modbus registry's are only created when a valid ems device entity is found.
from ems-esp32.
FYI, I submitted another PR addressing the memory iasues: #1770
from ems-esp32.
thanks, I'll take a look and run some more benchmarking. I've been out the last weeks. I still need to fix the Web settings right?
from ems-esp32.
from ems-esp32.
Related Issues (20)
- Add fan/ventilation speed support for Bosch compress 3800i/IVT Vent 402 HOT 1
- "manual defrost" on heat pump unexpected behaviour HOT 2
- Dump all supported EMS Telegrams HOT 1
- Status …Loading… HOT 6
- No Temp displayed on HMC 310, HC2 Control Mode is not editable HOT 6
- Improvement: Add holiday mode to bosch compress 3800i ew HOT 21
- Remove OTA feature HOT 3
- Automation Homeassistant - boiler disinfection HOT 2
- Platform mqtt does not generate unique IDs. For ID boiler_hysteresis_on_temperature and ID boiler_hysteresis_off_temperature HOT 3
- WebUI data missing on Firefox HOT 8
- boiler.nrgtotal with spikes and wrong value after update HOT 8
- Worcester-Bosch Greenstar Summer Mode temp value upper limit too low HOT 9
- Modbus UI not working correctly HOT 2
- No HTTP interface "ERR_CONNECTION_TIMED_OUT" HOT 1
- [emsesp] remotetemp timeout hc0, stop sending roomtemperature to thermostat HOT 14
- EMS bus disconnected HOT 2
- Connection problems HOT 1
- Feature: external modules HOT 2
- change “hc1 selected room temperature” in cooling mode not possible HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ems-esp32.