I have managed to solve this it looks like the CRC failure was down to an incompatible SPI Memory chip. I am now using
Brand Adesto Technologies
Mfr. Part No. AT25SF041-SSHD-B
RS Stock No.223-0562
and it seems to work very well now.
Especially if you take Martins recommendations below
@martinhjelmare said in OTA firmware updating is too slow..:
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);
}