File tree 2 files changed +6
-3
lines changed
2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -95,6 +95,7 @@ ArduinoIoTCloudTCP::ArduinoIoTCloudTCP()
95
95
, _ota_img_sha256{" Inv." }
96
96
, _ota_url{" " }
97
97
, _ota_req{false }
98
+ , _ask_user_before_executing_ota{false }
98
99
#endif /* OTA_ENABLED */
99
100
{
100
101
@@ -506,7 +507,9 @@ ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_Connected()
506
507
507
508
if (_ota_req)
508
509
{
509
- if (_automatic_ota || (_get_ota_confirmation != nullptr && _get_ota_confirmation ())) {
510
+ bool const ota_execution_allowed_by_user = (_get_ota_confirmation != nullptr && _get_ota_confirmation ());
511
+ bool const perform_ota_now = ota_execution_allowed_by_user || !_ask_user_before_executing_ota;
512
+ if (perform_ota_now) {
510
513
/* Clear the error flag. */
511
514
_ota_error = static_cast <int >(OTAError::None);
512
515
/* Clear the request flag. */
Original file line number Diff line number Diff line change @@ -89,7 +89,7 @@ class ArduinoIoTCloudTCP: public ArduinoIoTCloudClass
89
89
*/
90
90
void onOTARequestCb (otaConfirmationStatus cb) {
91
91
_get_ota_confirmation = cb;
92
- _automatic_ota = false ;
92
+ _ask_user_before_executing_ota = true ;
93
93
}
94
94
#endif
95
95
@@ -142,7 +142,7 @@ class ArduinoIoTCloudTCP: public ArduinoIoTCloudClass
142
142
String _ota_img_sha256;
143
143
String _ota_url;
144
144
bool _ota_req;
145
- bool _automatic_ota = true ;
145
+ bool _ask_user_before_executing_ota ;
146
146
#endif /* OTA_ENABLED */
147
147
148
148
inline String getTopic_shadowout () { return ( getThingId ().length () == 0 ) ? String (" " ) : String (" /a/t/" + getThingId () + " /shadow/o" ); }
You can’t perform that action at this time.
0 commit comments