File tree Expand file tree Collapse file tree 1 file changed +19
-6
lines changed Expand file tree Collapse file tree 1 file changed +19
-6
lines changed Original file line number Diff line number Diff line change @@ -13,15 +13,28 @@ void setup()
13
13
14
14
Serial.println (" *****OTA from SD*****" );
15
15
Arduino_OTA_Portenta_SD ota (SD_OFFSET, 10240 );
16
- ota.begin ();
16
+ Arduino_OTA_Portenta::Error ota_err = Arduino_OTA_Portenta::Error::None;
17
+
18
+ Serial.println (" Initializing OTA storage" );
19
+ if ((ota_err = ota.begin ()) != Arduino_OTA_Portenta::Error::None)
20
+ {
21
+ Serial.print (" ota.begin() failed with error code " );
22
+ Serial.println ((int )ota_err);
23
+ return ;
24
+ }
25
+
26
+ /* This functions set's the precise length of update binary, in this case of OTA_Usage_Portenta.ino.PORTENTA_H7_M7.bin */
17
27
ota.setUpdateLen (131728 );
18
28
19
- pinMode (LEDB, OUTPUT);
20
- digitalWrite (LEDB, LOW);
21
- delay (5000 );
22
- digitalWrite (LEDB, HIGH);
29
+ Serial.println (" Storing parameters for firmware update in bootloader accessible non-volatile memory" );
30
+ if ((ota_err = ota.update ()) != Arduino_OTA_Portenta::Error::None)
31
+ {
32
+ Serial.print (" ota.update() failed with error code " );
33
+ Serial.println ((int )ota_err);
34
+ return ;
35
+ }
23
36
24
- ota. update ( );
37
+ Serial. println ( " Performing a reset after which the bootloader will update the firmware. " );
25
38
ota.reset ();
26
39
}
27
40
You can’t perform that action at this time.
0 commit comments