@@ -46,6 +46,7 @@ def __init__(self, name):
46
46
"topics" : [],
47
47
"ota_check" : True ,
48
48
"fwfile" : None ,
49
+ "fwf_re" : True ,
49
50
"loglevel" : "INFO" ,
50
51
"service_logger" : True ,
51
52
}
@@ -73,6 +74,7 @@ def __init__(self, name):
73
74
74
75
self ._ota_check = False
75
76
self ._fwfile = None
77
+ self ._fwf_re = None
76
78
self ._log_idx = None
77
79
self ._reset_causes = {
78
80
machine .PWRON_RESET : "POWER ON" ,
@@ -323,9 +325,14 @@ async def do_action(self, action, service):
323
325
_ota_service ._new_sha_check = True
324
326
if self ._fwfile :
325
327
if self ._fwfile != _ota_params ["fwfile" ]:
326
- if self .log :
327
- self .log .info ("No new OTA update" )
328
- return
328
+ if not self ._fwf_re :
329
+ if self .log :
330
+ self .log .info ("No new OTA update" )
331
+ return
332
+ elif not _ota_params ["fwfile" ].endswith (self ._fwfile ):
333
+ if self .log :
334
+ self .log .info ("No new OTA update" )
335
+ return
329
336
else :
330
337
self ._fwfile = _ota_params ["fwfile" ]
331
338
if _ota_service ._comp_sha_ota (_ota_params ["sha" ]):
@@ -623,6 +630,7 @@ async def task(
623
630
topics = [],
624
631
ota_check = True ,
625
632
fwfile = None ,
633
+ fwf_re = True ,
626
634
log = None ,
627
635
loglevel = "INFO" ,
628
636
service_logger = False ,
@@ -632,7 +640,8 @@ async def task(
632
640
for top in topics :
633
641
self ._topics .add (top )
634
642
self ._ota_check = ota_check
635
- self ._fwfile = fwfile
643
+ self ._fwfile = aioctl .getenv ("FWFILE" , fwfile )
644
+ self ._fwf_re = fwf_re
636
645
if isinstance (self ._SERVICE_TOPIC , str ):
637
646
self ._TASK_TOPIC = self ._TASK_TOPIC .format (client_id ).encode ("utf-8" )
638
647
self ._SERVICE_TOPIC = self ._SERVICE_TOPIC .format (client_id ).encode ("utf-8" )
0 commit comments