OTA firmware updating is too slow..
-
just as an update, here the link to tekkas 'old' MySController with the old bootloader: https://forum.mysensors.org/topic/838/windows-gui-controller-for-mysensors/2
-
I implemented a check for firmware update message in my modified SenseBenderMicro sketch, and alternative behavior in the loop if FW update is ongoing. This doesn't solve the problem of dropped messages, but could be good to speed up the update and don't waste time on sensor updates.
void loop() { if (fwUpdateOngoing) { fwUpdateOngoing = false; fwUpdateOngoing = wait(OTA_WAIT_PERIOD, C_STREAM, ST_FIRMWARE_RESPONSE); } else { normalFlow(); } } void normalFlow() { // Short delay to allow buttons to properly settle sleep(5); int buttonValue = digitalRead(BUTTON_PIN); measureCount ++; sendBattery ++; bool forceTransmit = false; transmission_occured = false; #ifndef MY_OTA_FIRMWARE_FEATURE if ((measureCount == 5) && highfreq) { clock_prescale_set(clock_div_8); // Switch to 1Mhz for the reminder of the sketch, save power. highfreq = false; } #endif if (measureCount > FORCE_TRANSMIT_INTERVAL) { // force a transmission forceTransmit = true; measureCount = 0; } sendTempHumidityMeasurements(forceTransmit); if (buttonValue != oldValue) { // Send in the new buttonValue send(msg.set(buttonValue==HIGH ? 0 : 1)); oldValue = buttonValue; transmission_occured = true; } #ifdef MY_OTA_FIRMWARE_FEATURE if (transmission_occured) { fwUpdateOngoing = wait(OTA_WAIT_PERIOD, C_STREAM, ST_FIRMWARE_RESPONSE); } #endif sleep(digitalPinToInterrupt(BUTTON_PIN), CHANGE, MEASURE_INTERVAL); } -
I implemented a check for firmware update message in my modified SenseBenderMicro sketch, and alternative behavior in the loop if FW update is ongoing. This doesn't solve the problem of dropped messages, but could be good to speed up the update and don't waste time on sensor updates.
void loop() { if (fwUpdateOngoing) { fwUpdateOngoing = false; fwUpdateOngoing = wait(OTA_WAIT_PERIOD, C_STREAM, ST_FIRMWARE_RESPONSE); } else { normalFlow(); } } void normalFlow() { // Short delay to allow buttons to properly settle sleep(5); int buttonValue = digitalRead(BUTTON_PIN); measureCount ++; sendBattery ++; bool forceTransmit = false; transmission_occured = false; #ifndef MY_OTA_FIRMWARE_FEATURE if ((measureCount == 5) && highfreq) { clock_prescale_set(clock_div_8); // Switch to 1Mhz for the reminder of the sketch, save power. highfreq = false; } #endif if (measureCount > FORCE_TRANSMIT_INTERVAL) { // force a transmission forceTransmit = true; measureCount = 0; } sendTempHumidityMeasurements(forceTransmit); if (buttonValue != oldValue) { // Send in the new buttonValue send(msg.set(buttonValue==HIGH ? 0 : 1)); oldValue = buttonValue; transmission_occured = true; } #ifdef MY_OTA_FIRMWARE_FEATURE if (transmission_occured) { fwUpdateOngoing = wait(OTA_WAIT_PERIOD, C_STREAM, ST_FIRMWARE_RESPONSE); } #endif sleep(digitalPinToInterrupt(BUTTON_PIN), CHANGE, MEASURE_INTERVAL); }This post is deleted! -
This post is deleted!
-
This post is deleted!
-
I implemented a check for firmware update message in my modified SenseBenderMicro sketch, and alternative behavior in the loop if FW update is ongoing. This doesn't solve the problem of dropped messages, but could be good to speed up the update and don't waste time on sensor updates.
void loop() { if (fwUpdateOngoing) { fwUpdateOngoing = false; fwUpdateOngoing = wait(OTA_WAIT_PERIOD, C_STREAM, ST_FIRMWARE_RESPONSE); } else { normalFlow(); } } void normalFlow() { // Short delay to allow buttons to properly settle sleep(5); int buttonValue = digitalRead(BUTTON_PIN); measureCount ++; sendBattery ++; bool forceTransmit = false; transmission_occured = false; #ifndef MY_OTA_FIRMWARE_FEATURE if ((measureCount == 5) && highfreq) { clock_prescale_set(clock_div_8); // Switch to 1Mhz for the reminder of the sketch, save power. highfreq = false; } #endif if (measureCount > FORCE_TRANSMIT_INTERVAL) { // force a transmission forceTransmit = true; measureCount = 0; } sendTempHumidityMeasurements(forceTransmit); if (buttonValue != oldValue) { // Send in the new buttonValue send(msg.set(buttonValue==HIGH ? 0 : 1)); oldValue = buttonValue; transmission_occured = true; } #ifdef MY_OTA_FIRMWARE_FEATURE if (transmission_occured) { fwUpdateOngoing = wait(OTA_WAIT_PERIOD, C_STREAM, ST_FIRMWARE_RESPONSE); } #endif sleep(digitalPinToInterrupt(BUTTON_PIN), CHANGE, MEASURE_INTERVAL); }Sorry to revive this old topic but I didn't find any other one that covered this topic.
I started implementing FOTA in all my nodes and was finding some low speeds as described on this topic. I then implemented the checks proposed by @martinhjelmare and they certainly helped :grinning: , although they are not yet perfect.
As I said I didn't other topics covering how to avoid the node from doing anything else while the FOTA is in place, not did I find any other examples on this web nor in the github mysensors examples folder.
Is this the only way to do this, or is there any other better way around since this was published?
-
@manutremo please share your method so we can all benefit :)
-
If I recall I tried that, I seem to remember it only works for the sensebender board? Perhaps I'm mistaken though, it was over 1 year ago. @tekka, can you confirm?
-
If I recall I tried that, I seem to remember it only works for the sensebender board? Perhaps I'm mistaken though, it was over 1 year ago. @tekka, can you confirm?