File tree 3 files changed +14
-2
lines changed
3 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -180,7 +180,7 @@ void ArduinoOTAClass::_onRx(){
180
180
nonce_md5.add (String (micros ()));
181
181
nonce_md5.calculate ();
182
182
_nonce = nonce_md5.toString ();
183
-
183
+
184
184
char auth_req[38 ];
185
185
sprintf (auth_req, " AUTH %s" , _nonce.c_str ());
186
186
_udp_ota->append ((const char *)auth_req, strlen (auth_req));
@@ -326,4 +326,8 @@ void ArduinoOTAClass::handle() {
326
326
}
327
327
}
328
328
329
+ int ArduinoOTAClass::getCommand () {
330
+ return _cmd;
331
+ }
332
+
329
333
ArduinoOTAClass ArduinoOTA;
Original file line number Diff line number Diff line change @@ -40,6 +40,7 @@ class ArduinoOTAClass
40
40
void onProgress (THandlerFunction_Progress fn);
41
41
void begin ();
42
42
void handle ();
43
+ int getCommand (); // get update command type after OTA started- either U_FLASH or U_SPIFFS
43
44
44
45
private:
45
46
int _port;
Original file line number Diff line number Diff line change @@ -27,7 +27,14 @@ void setup() {
27
27
// ArduinoOTA.setPassword((const char *)"123");
28
28
29
29
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);
31
38
});
32
39
ArduinoOTA.onEnd ([]() {
33
40
Serial.println (" \n End" );
You can’t perform that action at this time.
0 commit comments