1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-26 01:35:21 +03:00

Bsongis/xlite ixjt flash broken (#6739)

XLite IXJT flash fix
This commit is contained in:
Bertrand Songis 2019-09-11 12:32:49 +02:00 committed by GitHub
parent 472f2a8c55
commit 6366d6bc9d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -96,12 +96,12 @@ void FrskyDeviceFirmwareUpdate::processFrame(const uint8_t * frame)
} }
} }
#if defined(PCBHORUS)
bool FrskyDeviceFirmwareUpdate::readBuffer(uint8_t * buffer, uint8_t count, uint32_t timeout) bool FrskyDeviceFirmwareUpdate::readBuffer(uint8_t * buffer, uint8_t count, uint32_t timeout)
{ {
watchdogSuspend(timeout); watchdogSuspend(timeout);
switch(module) { switch(module) {
#if defined(INTMODULE_USART)
case INTERNAL_MODULE: case INTERNAL_MODULE:
{ {
uint32_t elapsed = 0; uint32_t elapsed = 0;
@ -118,7 +118,6 @@ bool FrskyDeviceFirmwareUpdate::readBuffer(uint8_t * buffer, uint8_t count, uint
} }
break; break;
} }
#endif
default: default:
break; break;
@ -126,6 +125,7 @@ bool FrskyDeviceFirmwareUpdate::readBuffer(uint8_t * buffer, uint8_t count, uint
return true; return true;
} }
#endif
const uint8_t * FrskyDeviceFirmwareUpdate::readFullDuplexFrame(ModuleFifo & fifo, uint32_t timeout) const uint8_t * FrskyDeviceFirmwareUpdate::readFullDuplexFrame(ModuleFifo & fifo, uint32_t timeout)
{ {
@ -177,7 +177,7 @@ const uint8_t * FrskyDeviceFirmwareUpdate::readFrame(uint32_t timeout)
RTOS_WAIT_MS(1); RTOS_WAIT_MS(1);
switch(module) { switch(module) {
#if defined(INTMODULE_USART) #if defined(INTMODULE_USART) && !(defined(PCBXLITE) && !defined(PCBXLITES))
case INTERNAL_MODULE: case INTERNAL_MODULE:
return readFullDuplexFrame(intmoduleFifo, timeout); return readFullDuplexFrame(intmoduleFifo, timeout);
#endif #endif
@ -236,7 +236,7 @@ void FrskyDeviceFirmwareUpdate::sendFrame()
} }
switch(module) { switch(module) {
#if defined(INTMODULE_USART) #if defined(INTMODULE_USART) && !(defined(PCBXLITE) && !defined(PCBXLITES))
case INTERNAL_MODULE: case INTERNAL_MODULE:
return intmoduleSendBuffer(outputTelemetryBuffer.data, ptr - outputTelemetryBuffer.data); return intmoduleSendBuffer(outputTelemetryBuffer.data, ptr - outputTelemetryBuffer.data);
#endif #endif
@ -288,6 +288,11 @@ const char * FrskyDeviceFirmwareUpdate::sendReqVersion()
return "Version request failed"; return "Version request failed";
} }
// X12S / X10 IXJT = use TX + RX @ 38400 bauds with BOOTCMD pin inverted
// X10 / X10 ISRM = use TX + RX @ 57600 bauds (no BOOTCMD)
// X9D / X9D+ / X9E / XLite IXJT = use S.PORT @ 57600 bauds
// XLite PRO / X9Lite / X9D+ 2019 ISRM = use TX + RX @ 57600 bauds
const char * FrskyDeviceFirmwareUpdate::doFlashFirmware(const char * filename) const char * FrskyDeviceFirmwareUpdate::doFlashFirmware(const char * filename)
{ {
FIL file; FIL file;
@ -305,7 +310,8 @@ const char * FrskyDeviceFirmwareUpdate::doFlashFirmware(const char * filename)
f_close(&file); f_close(&file);
return "Format error"; return "Format error";
} }
} else { }
else {
#if defined(PCBHORUS) #if defined(PCBHORUS)
information.productId = FIRMWARE_ID_XJT; information.productId = FIRMWARE_ID_XJT;
#endif #endif
@ -324,7 +330,10 @@ const char * FrskyDeviceFirmwareUpdate::doFlashFirmware(const char * filename)
#endif #endif
switch (module) { switch (module) {
#if defined(INTMODULE_USART) #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
case INTERNAL_MODULE: case INTERNAL_MODULE:
intmoduleSerialStart(57600, true); intmoduleSerialStart(57600, true);
break; break;