File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -375,6 +375,11 @@ def onConnected(interface):
375375 waitForAckNak = True
376376 interface .getNode (args .dest , False ).rebootOTA ()
377377
378+ if args .enter_dfu :
379+ closeNow = True
380+ waitForAckNak = True
381+ interface .getNode (args .dest , False ).enterDFUMode ()
382+
378383 if args .shutdown :
379384 closeNow = True
380385 waitForAckNak = True
@@ -1364,7 +1369,13 @@ def initParser():
13641369
13651370 group .add_argument (
13661371 "--reboot-ota" ,
1367- help = "Tell the destination node to reboot into factory firmware" ,
1372+ help = "Tell the destination node to reboot into factory firmware (ESP32)" ,
1373+ action = "store_true" ,
1374+ )
1375+
1376+ group .add_argument (
1377+ "--enter-dfu" ,
1378+ help = "Tell the destination node to enter DFU mode (NRF52)" ,
13681379 action = "store_true" ,
13691380 )
13701381
Original file line number Diff line number Diff line change @@ -571,6 +571,19 @@ def rebootOTA(self, secs: int = 10):
571571 onResponse = self .onAckNak
572572 return self ._sendAdmin (p , onResponse = onResponse )
573573
574+ def enterDFUMode (self ):
575+ """Tell the node to enter DFU mode (NRF52)."""
576+ p = admin_pb2 .AdminMessage ()
577+ p .enter_dfu_mode_request = True
578+ logging .info (f"Telling node to enable DFU mode" )
579+
580+ # If sending to a remote node, wait for ACK/NAK
581+ if self == self .iface .localNode :
582+ onResponse = None
583+ else :
584+ onResponse = self .onAckNak
585+ return self ._sendAdmin (p , onResponse = onResponse )
586+
574587 def shutdown (self , secs : int = 10 ):
575588 """Tell the node to shutdown."""
576589 p = admin_pb2 .AdminMessage ()
You can’t perform that action at this time.
0 commit comments