Too much flash needed for program: is there a method to "slim down" the code ? #283
-
|
Hi all, some details about the problem. I'm writing fw for some old https://kmpelectronics.eu/shop/prodino-ethernet/ boards. This boards are arduino leonard cpu and W5500 ethernet chip and some other useful things such as opto-insulator on 4 input and 4 rele and their driver. Currently a custom protocol is implemented and i'd like to move on mqtt + Home Assistant integration. Using arduino-home-assistant I've developed a first fw version that implement a device with 4 switch and all has been very straightforward and very elegant in code. Then I've added 3 sensors number and the code to read 3 DS18B20 termometers, again very simple in code, but the flash needed has overcame the size of the arduino leonardo's flash (no debug): Using this definitions: has changed nothing. Is there some technique or "trick" to strip down the flash required? Thanks a lot |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
You need to define this constants elsewhere not in your header file. For example, if you're using PlatformIO, add them to your build_flags. |
Beta Was this translation helpful? Give feedback.
You need to define this constants elsewhere not in your header file. For example, if you're using PlatformIO, add them to your build_flags.
Why? For it to be processed it needs to be imported into the relevant file. You'd need to edit the library for that. Otherwise, declare them in the tools you use to build like the example above.