Implemented enter (Uf2 usb) DFU mode admin message on NRF52 (#3045)

* Added enter DFU mode admin message

* Trunk
This commit is contained in:
Ben Meadors 2023-12-27 14:26:40 -06:00 committed by GitHub
parent 2b7eb1e489
commit dbac2b1cad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 3 deletions

@ -1 +1 @@
Subproject commit 8e84c2f95fcc7f0e88a80645d3a88812adbda841 Subproject commit 4a1d3766e888d3dd7d1acda817083295fb054c92

View File

@ -77,7 +77,7 @@ extern int heltec_version;
// This will suppress the current delay and instead try to run ASAP. // This will suppress the current delay and instead try to run ASAP.
extern bool runASAP; extern bool runASAP;
void nrf52Setup(), esp32Setup(), nrf52Loop(), esp32Loop(), rp2040Setup(), clearBonds(); void nrf52Setup(), esp32Setup(), nrf52Loop(), esp32Loop(), rp2040Setup(), clearBonds(), enterDfuMode();
meshtastic_DeviceMetadata getDeviceMetadata(); meshtastic_DeviceMetadata getDeviceMetadata();

View File

@ -131,7 +131,7 @@ typedef struct _meshtastic_AdminMessage {
bool get_node_remote_hardware_pins_request; bool get_node_remote_hardware_pins_request;
/* Respond with the mesh's nodes with their available gpio pins for RemoteHardware module use */ /* Respond with the mesh's nodes with their available gpio pins for RemoteHardware module use */
meshtastic_NodeRemoteHardwarePinsResponse get_node_remote_hardware_pins_response; meshtastic_NodeRemoteHardwarePinsResponse get_node_remote_hardware_pins_response;
/* Enter (serial) DFU mode /* Enter (UF2) DFU mode
Only implemented on NRF52 currently */ Only implemented on NRF52 currently */
bool enter_dfu_mode_request; bool enter_dfu_mode_request;
/* Set the owner for this node */ /* Set the owner for this node */

View File

@ -188,6 +188,13 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
reboot(DEFAULT_REBOOT_SECONDS); reboot(DEFAULT_REBOOT_SECONDS);
break; break;
} }
case meshtastic_AdminMessage_enter_dfu_mode_request_tag: {
LOG_INFO("Client is requesting to enter DFU mode.\n");
#ifdef ARCH_NRF52
enterDfuMode();
#endif
break;
}
#ifdef ARCH_PORTDUINO #ifdef ARCH_PORTDUINO
case meshtastic_AdminMessage_exit_simulator_tag: case meshtastic_AdminMessage_exit_simulator_tag:
LOG_INFO("Exiting simulator\n"); LOG_INFO("Exiting simulator\n");

View File

@ -1,4 +1,5 @@
#include "configuration.h" #include "configuration.h"
#include <Adafruit_TinyUSB.h>
#include <Adafruit_nRFCrypto.h> #include <Adafruit_nRFCrypto.h>
#include <SPI.h> #include <SPI.h>
#include <Wire.h> #include <Wire.h>
@ -214,4 +215,9 @@ void clearBonds()
nrf52Bluetooth->setup(); nrf52Bluetooth->setup();
} }
nrf52Bluetooth->clearBonds(); nrf52Bluetooth->clearBonds();
}
void enterDfuMode()
{
enterUf2Dfu();
} }