File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -95,6 +95,7 @@ ArduinoIoTCloudTCP::ArduinoIoTCloudTCP()
9595, _ota_img_sha256{" Inv." }
9696, _ota_url{" " }
9797, _ota_req{false }
98+ , _ask_user_before_executing_ota{false }
9899#endif /* OTA_ENABLED */
99100{
100101
@@ -506,7 +507,9 @@ ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_Connected()
506507
507508 if (_ota_req)
508509 {
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) {
510513 /* Clear the error flag. */
511514 _ota_error = static_cast <int >(OTAError::None);
512515 /* Clear the request flag. */
Original file line number Diff line number Diff line change @@ -89,7 +89,7 @@ class ArduinoIoTCloudTCP: public ArduinoIoTCloudClass
8989 */
9090 void onOTARequestCb (otaConfirmationStatus cb) {
9191 _get_ota_confirmation = cb;
92- _automatic_ota = false ;
92+ _ask_user_before_executing_ota = true ;
9393 }
9494#endif
9595
@@ -142,7 +142,7 @@ class ArduinoIoTCloudTCP: public ArduinoIoTCloudClass
142142 String _ota_img_sha256;
143143 String _ota_url;
144144 bool _ota_req;
145- bool _automatic_ota = true ;
145+ bool _ask_user_before_executing_ota ;
146146#endif /* OTA_ENABLED */
147147
148148 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