Bluetooth flash firmware started
This commit is contained in:
@@ -463,3 +463,36 @@ void Bluetooth::wakeup()
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void Bluetooth::flashFirmware(const char * filename)
|
||||
{
|
||||
state = BLUETOOTH_STATE_FLASH_FIRMWARE;
|
||||
|
||||
pausePulses();
|
||||
|
||||
drawProgressScreen(getBasename(filename), "Device reset...", 0, 0);
|
||||
|
||||
/* wait 2s off */
|
||||
watchdogSuspend(2000);
|
||||
RTOS_WAIT_MS(2000);
|
||||
|
||||
const char * result = nullptr;
|
||||
|
||||
AUDIO_PLAY(AU_SPECIAL_SOUND_BEEP1 );
|
||||
BACKLIGHT_ENABLE();
|
||||
|
||||
if (result) {
|
||||
POPUP_WARNING(STR_FIRMWARE_UPDATE_ERROR);
|
||||
SET_WARNING_INFO(result, strlen(result), 0);
|
||||
}
|
||||
else {
|
||||
POPUP_INFORMATION(STR_FIRMWARE_UPDATE_SUCCESS);
|
||||
}
|
||||
|
||||
/* wait 2s off */
|
||||
watchdogSuspend(2000);
|
||||
RTOS_WAIT_MS(2000);
|
||||
|
||||
state = BLUETOOTH_STATE_OFF;
|
||||
resumePulses();
|
||||
}
|
||||
@@ -40,7 +40,7 @@ enum BluetoothStates {
|
||||
BLUETOOTH_STATE_CONNECT_SENT,
|
||||
BLUETOOTH_STATE_CONNECTED,
|
||||
BLUETOOTH_STATE_DISCONNECTED,
|
||||
BLUETOOTH_STATE_FIRMWARE_UGRADE
|
||||
BLUETOOTH_STATE_FLASH_FIRMWARE
|
||||
};
|
||||
|
||||
#define LEN_BLUETOOTH_ADDR 16
|
||||
@@ -63,6 +63,7 @@ class Bluetooth
|
||||
void forwardTelemetry(const uint8_t * packet);
|
||||
void receiveTrainer();
|
||||
void wakeup();
|
||||
void flashFirmware(const char * filename);
|
||||
|
||||
volatile uint8_t state;
|
||||
char localAddr[LEN_BLUETOOTH_ADDR+1];
|
||||
|
||||
+3
-3
@@ -1166,14 +1166,14 @@ int cliBlueTooth(const char ** argv)
|
||||
if (!strncmp(argv[1], "AT", 2) || !strncmp(argv[1], "TTM", 3)) {
|
||||
char command[32];
|
||||
strAppend(strAppend(command, argv[1]), "\r\n");
|
||||
bluetoothWriteString(command);
|
||||
char * line = bluetoothReadline();
|
||||
bluetooth.writeString(command);
|
||||
char * line = bluetooth.readline();
|
||||
serialPrint("<BT %s", line);
|
||||
}
|
||||
else if (toInt(argv, 1, &baudrate) > 0) {
|
||||
if (baudrate > 0) {
|
||||
bluetoothInit(baudrate);
|
||||
char * line = bluetoothReadline();
|
||||
char * line = bluetooth.readline();
|
||||
serialPrint("<BT %s", line);
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user