Bluetooth flash firmware continued
This commit is contained in:
@@ -490,6 +490,8 @@ void Bluetooth::sendBootloaderCommand(uint8_t command, const uint8_t * data, uin
|
|||||||
|
|
||||||
uint8_t Bluetooth::read(uint8_t * data, uint8_t size, uint32_t timeout)
|
uint8_t Bluetooth::read(uint8_t * data, uint8_t size, uint32_t timeout)
|
||||||
{
|
{
|
||||||
|
watchdogSuspend(timeout / 10);
|
||||||
|
|
||||||
uint8_t len = 0;
|
uint8_t len = 0;
|
||||||
while (len < size) {
|
while (len < size) {
|
||||||
uint32_t elapsed = 0;
|
uint32_t elapsed = 0;
|
||||||
@@ -500,6 +502,7 @@ uint8_t Bluetooth::read(uint8_t * data, uint8_t size, uint32_t timeout)
|
|||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
data[len++] = byte;
|
||||||
}
|
}
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
@@ -528,8 +531,7 @@ void Bluetooth::flashFirmware(const char * filename)
|
|||||||
|
|
||||||
pausePulses();
|
pausePulses();
|
||||||
|
|
||||||
bluetoothInit(BLUETOOTH_BOOTLOADER_BAUDRATE, true);
|
bluetoothInit(BLUETOOTH_BOOTLOADER_BAUDRATE, false); /* go to bootloader mode */
|
||||||
bluetoothDisable(); /* go to bootloader mode */
|
|
||||||
|
|
||||||
drawProgressScreen(getBasename(filename), "Bluetooth reset...", 0, 0);
|
drawProgressScreen(getBasename(filename), "Bluetooth reset...", 0, 0);
|
||||||
|
|
||||||
|
|||||||
@@ -89,7 +89,10 @@ void bluetoothInit(uint32_t baudrate, bool enable)
|
|||||||
bluetoothWriteState = BLUETOOTH_WRITE_IDLE;
|
bluetoothWriteState = BLUETOOTH_WRITE_IDLE;
|
||||||
|
|
||||||
if (enable) {
|
if (enable) {
|
||||||
GPIO_ResetBits(BT_EN_GPIO, BT_EN_GPIO_PIN); // open bluetooth
|
GPIO_ResetBits(BT_EN_GPIO, BT_EN_GPIO_PIN);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
GPIO_SetBits(BT_EN_GPIO, BT_EN_GPIO_PIN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user