Merge from 2.3
This commit is contained in:
@@ -102,7 +102,7 @@ bool FrskyDeviceFirmwareUpdate::readBuffer(uint8_t * buffer, uint8_t count, uint
|
||||
{
|
||||
watchdogSuspend(timeout);
|
||||
|
||||
switch(module) {
|
||||
switch (module) {
|
||||
case INTERNAL_MODULE:
|
||||
{
|
||||
uint32_t elapsed = 0;
|
||||
@@ -177,8 +177,8 @@ const uint8_t * FrskyDeviceFirmwareUpdate::readFrame(uint32_t timeout)
|
||||
{
|
||||
RTOS_WAIT_MS(1);
|
||||
|
||||
switch(module) {
|
||||
#if defined(INTMODULE_USART) && !(defined(PCBXLITE) && !defined(PCBXLITES))
|
||||
switch (module) {
|
||||
#if defined(INTERNAL_MODULE_PXX2)
|
||||
case INTERNAL_MODULE:
|
||||
return readFullDuplexFrame(intmoduleFifo, timeout);
|
||||
#endif
|
||||
@@ -236,8 +236,8 @@ void FrskyDeviceFirmwareUpdate::sendFrame()
|
||||
}
|
||||
}
|
||||
|
||||
switch(module) {
|
||||
#if defined(INTMODULE_USART) && !(defined(PCBXLITE) && !defined(PCBXLITES))
|
||||
switch (module) {
|
||||
#if defined(INTERNAL_MODULE_PXX2)
|
||||
case INTERNAL_MODULE:
|
||||
return intmoduleSendBuffer(outputTelemetryBuffer.data, ptr - outputTelemetryBuffer.data);
|
||||
#endif
|
||||
@@ -332,10 +332,7 @@ const char * FrskyDeviceFirmwareUpdate::doFlashFirmware(const char * filename, P
|
||||
#endif
|
||||
|
||||
switch (module) {
|
||||
#if defined(INTMODULE_USART) && !(defined(PCBXLITE) && !defined(PCBXLITES))
|
||||
// on XLite we don't use TX + RX but the S.PORT line
|
||||
// this ifdef can be removed if we use .frsk instead of .frk
|
||||
// theorically it should be possible to use an ISRM module in an XLite
|
||||
#if defined(INTERNAL_MODULE_PXX2)
|
||||
case INTERNAL_MODULE:
|
||||
intmoduleSerialStart(57600, true, USART_Parity_No, USART_StopBits_1, USART_WordLength_8b);
|
||||
break;
|
||||
@@ -496,7 +493,7 @@ const char * FrskyDeviceFirmwareUpdate::flashFirmware(const char * filename, Pro
|
||||
progressHandler(getBasename(filename), STR_DEVICE_RESET, 0, 0);
|
||||
|
||||
/* wait 2s off */
|
||||
watchdogSuspend(2000);
|
||||
watchdogSuspend(1000 /*10s*/);
|
||||
RTOS_WAIT_MS(2000);
|
||||
|
||||
const char * result = doFlashFirmware(filename, progressHandler);
|
||||
@@ -512,12 +509,14 @@ const char * FrskyDeviceFirmwareUpdate::flashFirmware(const char * filename, Pro
|
||||
POPUP_INFORMATION(STR_FIRMWARE_UPDATE_SUCCESS);
|
||||
}
|
||||
|
||||
#if defined(HARDWARE_INTERNAL_MODULE)
|
||||
INTERNAL_MODULE_OFF();
|
||||
#endif
|
||||
EXTERNAL_MODULE_OFF();
|
||||
SPORT_UPDATE_POWER_OFF();
|
||||
|
||||
/* wait 2s off */
|
||||
watchdogSuspend(2000);
|
||||
watchdogSuspend(500 /*5s*/);
|
||||
RTOS_WAIT_MS(2000);
|
||||
telemetryClearFifo();
|
||||
|
||||
@@ -550,7 +549,7 @@ const char * FrskyChipFirmwareUpdate::waitAnswer(uint8_t & status)
|
||||
uint8_t buffer[12];
|
||||
for (uint8_t i = 0; i < sizeof(buffer); i++) {
|
||||
uint32_t retry = 0;
|
||||
while(1) {
|
||||
while (true) {
|
||||
if (telemetryGetByte(&buffer[i])) {
|
||||
if ((i == 0 && buffer[0] != 0x7F) ||
|
||||
(i == 1 && buffer[1] != 0xFE) ||
|
||||
@@ -573,6 +572,10 @@ const char * FrskyChipFirmwareUpdate::waitAnswer(uint8_t & status)
|
||||
|
||||
const char * FrskyChipFirmwareUpdate::startBootloader()
|
||||
{
|
||||
sportSendByte(0x03);
|
||||
RTOS_WAIT_MS(20);
|
||||
sportSendByte(0x02);
|
||||
RTOS_WAIT_MS(20);
|
||||
sportSendByte(0x01);
|
||||
|
||||
for (uint8_t i = 0; i < 30; i++)
|
||||
@@ -583,6 +586,7 @@ const char * FrskyChipFirmwareUpdate::startBootloader()
|
||||
sportSendByte(0x7F);
|
||||
}
|
||||
|
||||
RTOS_WAIT_MS(20);
|
||||
sportSendByte(0xFA);
|
||||
|
||||
/*for (uint8_t i=0; i < 30; i++)
|
||||
@@ -753,7 +757,7 @@ const char * FrskyChipFirmwareUpdate::flashFirmware(const char * filename, Progr
|
||||
|
||||
if (wait) {
|
||||
/* wait 2s off */
|
||||
watchdogSuspend(2000);
|
||||
watchdogSuspend(1000 /*10s*/);
|
||||
RTOS_WAIT_MS(2000);
|
||||
}
|
||||
|
||||
@@ -773,7 +777,7 @@ const char * FrskyChipFirmwareUpdate::flashFirmware(const char * filename, Progr
|
||||
}
|
||||
|
||||
/* wait 2s off */
|
||||
watchdogSuspend(2000);
|
||||
watchdogSuspend(1000 /*10s*/);
|
||||
RTOS_WAIT_MS(2000);
|
||||
|
||||
#if defined(HARDWARE_INTERNAL_MODULE)
|
||||
|
||||
Reference in New Issue
Block a user