File tree Expand file tree Collapse file tree 3 files changed +14
-2
lines changed
Expand file tree Collapse file tree 3 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -180,7 +180,7 @@ void ArduinoOTAClass::_onRx(){
180180 nonce_md5.add (String (micros ()));
181181 nonce_md5.calculate ();
182182 _nonce = nonce_md5.toString ();
183-
183+
184184 char auth_req[38 ];
185185 sprintf (auth_req, " AUTH %s" , _nonce.c_str ());
186186 _udp_ota->append ((const char *)auth_req, strlen (auth_req));
@@ -326,4 +326,8 @@ void ArduinoOTAClass::handle() {
326326 }
327327}
328328
329+ int ArduinoOTAClass::getCommand () {
330+ return _cmd;
331+ }
332+
329333ArduinoOTAClass ArduinoOTA;
Original file line number Diff line number Diff line change @@ -40,6 +40,7 @@ class ArduinoOTAClass
4040 void onProgress (THandlerFunction_Progress fn);
4141 void begin ();
4242 void handle ();
43+ int getCommand (); // get update command type after OTA started- either U_FLASH or U_SPIFFS
4344
4445 private:
4546 int _port;
Original file line number Diff line number Diff line change @@ -27,7 +27,14 @@ void setup() {
2727 // ArduinoOTA.setPassword((const char *)"123");
2828
2929 ArduinoOTA.onStart ([]() {
30- Serial.println (" Start" );
30+ String type;
31+ if (ArduinoOTA.getCommand () == U_FLASH)
32+ type = " sketch" ;
33+ else // U_SPIFFS
34+ type = " filesystem" ;
35+
36+ // NOTE: if updating SPIFFS this would be the place to unmount SPIFFS using SPIFFS.end()
37+ Serial.println (" Start updating " + type);
3138 });
3239 ArduinoOTA.onEnd ([]() {
3340 Serial.println (" \n End" );
You can’t perform that action at this time.
0 commit comments