Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion meshtastic/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,11 @@ def onConnected(interface):
waitForAckNak = True
interface.getNode(args.dest, False).rebootOTA()

if args.enter_dfu:
closeNow = True
waitForAckNak = True
interface.getNode(args.dest, False).enterDFUMode()

if args.shutdown:
closeNow = True
waitForAckNak = True
Expand Down Expand Up @@ -1364,7 +1369,13 @@ def initParser():

group.add_argument(
"--reboot-ota",
help="Tell the destination node to reboot into factory firmware",
help="Tell the destination node to reboot into factory firmware (ESP32)",
action="store_true",
)

group.add_argument(
"--enter-dfu",
help="Tell the destination node to enter DFU mode (NRF52)",
action="store_true",
)

Expand Down
13 changes: 13 additions & 0 deletions meshtastic/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,19 @@ def rebootOTA(self, secs: int = 10):
onResponse = self.onAckNak
return self._sendAdmin(p, onResponse=onResponse)

def enterDFUMode(self):
"""Tell the node to enter DFU mode (NRF52)."""
p = admin_pb2.AdminMessage()
p.enter_dfu_mode_request = True
logging.info(f"Telling node to enable DFU mode")

# If sending to a remote node, wait for ACK/NAK
if self == self.iface.localNode:
onResponse = None
else:
onResponse = self.onAckNak
return self._sendAdmin(p, onResponse=onResponse)

def shutdown(self, secs: int = 10):
"""Tell the node to shutdown."""
p = admin_pb2.AdminMessage()
Expand Down