BT Flash timeout increased
This commit is contained in:
@@ -47,7 +47,7 @@ void Bluetooth::write(const uint8_t * data, uint8_t length)
|
||||
TRACE_NOCRLF("BT>");
|
||||
for (int i=0; i<length; i++) {
|
||||
TRACE_NOCRLF(" %02X", data[i]);
|
||||
if (btTxFifo.isFull()) {
|
||||
while (btTxFifo.isFull()) {
|
||||
if (!bluetoothIsWriting())
|
||||
bluetoothWriteWakeup();
|
||||
RTOS_WAIT_MS(1);
|
||||
@@ -491,13 +491,13 @@ uint8_t Bluetooth::bootloaderChecksum(uint8_t command, const uint8_t * data, uin
|
||||
return sum;
|
||||
}
|
||||
|
||||
uint8_t Bluetooth::read(uint8_t * data, uint8_t size, uint8_t timeout)
|
||||
uint8_t Bluetooth::read(uint8_t * data, uint8_t size, uint32_t timeout)
|
||||
{
|
||||
watchdogSuspend(timeout / 10);
|
||||
|
||||
uint8_t len = 0;
|
||||
while (len < size) {
|
||||
uint8_t elapsed = 0;
|
||||
uint32_t elapsed = 0;
|
||||
uint8_t byte;
|
||||
while (!btRxFifo.pop(byte)) {
|
||||
if (elapsed++ >= timeout) {
|
||||
@@ -513,7 +513,7 @@ uint8_t Bluetooth::read(uint8_t * data, uint8_t size, uint8_t timeout)
|
||||
#define BLUETOOTH_ACK 0xCC
|
||||
#define BLUETOOTH_NACK 0x33
|
||||
|
||||
const char * Bluetooth::bootloaderWaitCommandResponse(uint8_t timeout)
|
||||
const char * Bluetooth::bootloaderWaitCommandResponse(uint32_t timeout)
|
||||
{
|
||||
uint8_t response[2];
|
||||
if (read(response, sizeof(response), timeout) != sizeof(response)) {
|
||||
|
||||
@@ -65,7 +65,7 @@ class Bluetooth
|
||||
|
||||
protected:
|
||||
void pushByte(uint8_t byte);
|
||||
uint8_t read(uint8_t * data, uint8_t size, uint8_t timeout=100/*ms*/);
|
||||
uint8_t read(uint8_t * data, uint8_t size, uint32_t timeout=1000/*ms*/);
|
||||
void write(const uint8_t * data, uint8_t length);
|
||||
void appendTrainerByte(uint8_t data);
|
||||
void processTrainerFrame(const uint8_t * buffer);
|
||||
@@ -76,7 +76,7 @@ class Bluetooth
|
||||
uint8_t bootloaderChecksum(uint8_t command, const uint8_t * data, uint8_t size);
|
||||
void bootloaderSendCommand(uint8_t command, const void *data = nullptr, uint8_t size = 0);
|
||||
void bootloaderSendCommandResponse(uint8_t response);
|
||||
const char * bootloaderWaitCommandResponse(uint8_t timeout=100/*ms*/);
|
||||
const char * bootloaderWaitCommandResponse(uint32_t timeout=1000/*ms*/);
|
||||
const char * bootloaderWaitResponseData(uint8_t *data, uint8_t size);
|
||||
const char * bootloaderSetAutoBaud();
|
||||
const char * bootloaderReadStatus(uint8_t &status);
|
||||
|
||||
@@ -1801,6 +1801,7 @@ void opentxInit()
|
||||
sdInit();
|
||||
|
||||
#if defined(AUTOUPDATE)
|
||||
sportStopSendByteLoop();
|
||||
if (f_stat(AUTOUPDATE_FILENAME, nullptr) == FR_OK) {
|
||||
FrSkyFirmwareInformation information;
|
||||
if (readFirmwareInformation(AUTOUPDATE_FILENAME, information) == nullptr) {
|
||||
|
||||
@@ -642,6 +642,7 @@ void telemetryPortSetDirectionInput(void);
|
||||
void telemetryPortSetDirectionOutput(void);
|
||||
void sportSendByte(uint8_t byte);
|
||||
void sportSendByteLoop(uint8_t byte);
|
||||
void sportStopSendByteLoop();
|
||||
void sportSendBuffer(const uint8_t * buffer, uint32_t count);
|
||||
uint8_t telemetryGetByte(uint8_t * byte);
|
||||
void telemetryClearFifo();
|
||||
|
||||
@@ -103,6 +103,12 @@ void sportSendByte(uint8_t byte)
|
||||
USART_SendData(TELEMETRY_USART, byte);
|
||||
}
|
||||
|
||||
void sportStopSendByteLoop()
|
||||
{
|
||||
DMA_Cmd(TELEMETRY_DMA_Stream_TX, DISABLE);
|
||||
DMA_DeInit(TELEMETRY_DMA_Stream_TX);
|
||||
}
|
||||
|
||||
void sportSendByteLoop(uint8_t byte)
|
||||
{
|
||||
telemetryPortSetDirectionOutput();
|
||||
|
||||
Reference in New Issue
Block a user