JAndrassy / ArduinoOTA

Arduino library to upload sketch over network to Arduino board with WiFi or Ethernet libraries
GNU Lesser General Public License v2.1
435 stars 89 forks source link

call function before flash #187

Closed hedva92 closed 1 year ago

hedva92 commented 1 year ago

Would it be possible to implement a method that would call some predefined function before flashing the firmware? Something like save variable values ​​to external memory (or etc), when this function ended, the firmware would be flashed. Ty

JAndrassy commented 1 year ago

it is not in the examples, but there is onStart and beforeApply

 ArduinoOTA.onStart([]() {watchdogStop();});
 ArduinoOTA.beforeApply(shutdown);
void shutdown() {
  eventsSave();
  statsSave();
}