Skip to content

Commit 51f0bab

Browse files
committed
Add error code NoCapableBootloader and check within 'begin'
1 parent 67e6208 commit 51f0bab

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

src/Arduino_Portenta_OTA.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,14 @@ bool Arduino_Portenta_OTA::isOtaCapable()
6565
Arduino_Portenta_OTA::Error Arduino_Portenta_OTA::begin()
6666
{
6767
Serial1.begin(115200);
68-
return (init() == false) ? Error::OtaStorageInit : Error::None;
68+
69+
if (!isOtaCapable())
70+
return Error::NoCapableBootloader;
71+
72+
if (!init())
73+
return Error::OtaStorageInit;
74+
75+
return Error::None;
6976
}
7077

7178
Arduino_Portenta_OTA::Error Arduino_Portenta_OTA::update()

src/Arduino_Portenta_OTA.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,13 @@ class Arduino_Portenta_OTA
6767
enum class Error : int
6868
{
6969
None = 0,
70-
NoOtaStorage = -1,
71-
OtaStorageInit = -2,
72-
OtaStorageOpen = -3,
73-
OtaHeaderLength = -4,
74-
OtaHeaderCrc = -5,
75-
OtaHeaterMagicNumber = -6,
70+
NoCapableBootloader = -1,
71+
NoOtaStorage = -2,
72+
OtaStorageInit = -3,
73+
OtaStorageOpen = -4,
74+
OtaHeaderLength = -5,
75+
OtaHeaderCrc = -6,
76+
OtaHeaterMagicNumber = -7,
7677
};
7778

7879
Arduino_Portenta_OTA(StorageTypePortenta const storage_type, uint32_t const data_offset);

0 commit comments

Comments
 (0)