-->
Page 3 of 4

Re: Example of featured sketch wanted

PostPosted: Thu Oct 11, 2018 7:48 am
by rudy
Now I just need to understand how to make homie accepting messages for variable setting (e.g. light on/off).


That was as far as I got. Trying to understand the structure. I did get it, but have since forgotten.

Re: Example of featured sketch wanted

PostPosted: Thu Oct 11, 2018 9:32 am
by technerdchris
btidey wrote:Now for new projects I don't start with a blank sheet, I just copy a previous project, delete any specific application routines, and add on the new stuff.


grhhm wrote:Sounds like a perfect code reuse.
Can you share your base, please?


Actually, this is not good practice at all. Proper "code reuse" is to use version control and "check out" the reused code individually for each project. And then when it is updated, all the projects benefit from the upgrade. And all the projects break if the code is bad. :)

I worked at a company which essentially had an embedded OS which they copied from one to the next. These branched remarkably by the teams. One was transmit equipment and the other receive. What a person would think are the "same OS" were tweaked far beyond reuse between the teams.

I do not do enough embedded programming to follow best practice, so I copy old work, make copious comments, date things a lot, and save old versions along the way.

:) Chris

Re: Example of featured sketch wanted

PostPosted: Fri Oct 12, 2018 11:46 am
by grhhm
grhhm wrote:Now I just need to understand how to make homie accepting messages for variable setting (e.g. light on/off).


Finally, got it. The hint is buried in Homie convention. Homie reports status to the broker under topic:
homie/kitchen-light/light/power

However, to set the settable parameter the following topic to be sent to the broker:
homie/kitchen-light/light/power/set

Changing in initial configuration base of the topic from homie/ to anything else stop the MQTT subscription of remote device.

Next challenge: How to split the flash to have enough space for OTA? Where the OTA image is stored before burning into flash? What's minimal size of Flash needed if the bin-image is about 410kB?

Re: Example of featured sketch wanted

PostPosted: Fri Oct 12, 2018 3:25 pm
by martinayotte
grhhm wrote:Where the OTA image is stored before burning into flash?

Nowhere ! it is burned on the flash while binary stream comes in, chunk after chunk ...