Hello there,
I am experiencing “flashing failed” when I try to flash my photon after having registered a handler for the Reset and OTA.
My Photon needs to save a sensed humidity + a timestamp in the flash:
class EepromHandler{
public:
static void onResetOrOTA(uint32_t averageHumidity){
auto currentTimeStamp = Time.now();
EEPROM.put(EEPROM_ADDR_LAST_AVG_HUMIDITY, averageHumidity);
EEPROM.put(EEPROM_ADDR_LAST_AVG_HUM_TIMESTAMP, currentTimeStamp);
Particle.publish("onResetOrOTA()", String("EEPROM Write:")+toString(averageHumidity)+String(", ")+toString(currentTimeStamp));
}
};
void onResetOrOTA(){ EepromHandler::onResetOrOTA(getAverageHumidity()); }
void setup() {
System.on(reset+firmware_update, onResetOrOTA); // register callback
}
When flashing, the Web IDE first says “Request is taking unusually long…” and then “flashing failed”.
I also tried first reading the last saved timestamp from the eeprom and write the new timestmap only if the difference between it and the one already in eeprom is greater than, say 15 minutes. In this particular case, the very first time fails, whilst the subsequent tries are all sucessful, because the write is not executed anymore.
Is this a known issue, am I doing something wrong or is this a problem in the framework firmware?