Workaround for HoTT and softserial.
This commit is contained in:
parent
2d8f65448d
commit
cbd1817f6c
|
@ -58,6 +58,8 @@
|
||||||
|
|
||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
|
|
||||||
|
#include "build_config.h"
|
||||||
|
|
||||||
#ifdef TELEMETRY
|
#ifdef TELEMETRY
|
||||||
|
|
||||||
#include "common/axis.h"
|
#include "common/axis.h"
|
||||||
|
@ -108,6 +110,8 @@ static telemetryConfig_t *telemetryConfig;
|
||||||
static HOTT_GPS_MSG_t hottGPSMessage;
|
static HOTT_GPS_MSG_t hottGPSMessage;
|
||||||
static HOTT_EAM_MSG_t hottEAMMessage;
|
static HOTT_EAM_MSG_t hottEAMMessage;
|
||||||
|
|
||||||
|
static bool useSoftserialRxFailureWorkaround = false;
|
||||||
|
|
||||||
static void initialiseEAMMessage(HOTT_EAM_MSG_t *msg, size_t size)
|
static void initialiseEAMMessage(HOTT_EAM_MSG_t *msg, size_t size)
|
||||||
{
|
{
|
||||||
memset(msg, 0, size);
|
memset(msg, 0, size);
|
||||||
|
@ -266,6 +270,10 @@ void configureHoTTTelemetryPort(void)
|
||||||
// FIXME only need to do this if the port is shared
|
// FIXME only need to do this if the port is shared
|
||||||
previousPortMode = hottPort->mode;
|
previousPortMode = hottPort->mode;
|
||||||
previousBaudRate = hottPort->baudRate;
|
previousBaudRate = hottPort->baudRate;
|
||||||
|
|
||||||
|
if (hottPort->identifier == SERIAL_PORT_SOFTSERIAL1 || hottPort->identifier == SERIAL_PORT_SOFTSERIAL2) {
|
||||||
|
useSoftserialRxFailureWorkaround = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -342,12 +350,24 @@ static void flushHottRxBuffer(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void hottCheckSerialData(uint32_t currentMicros) {
|
static void hottCheckSerialData(uint32_t currentMicros)
|
||||||
|
{
|
||||||
static bool lookingForRequest = true;
|
static bool lookingForRequest = true;
|
||||||
|
|
||||||
uint8_t bytesWaiting = serialTotalBytesWaiting(hottPort);
|
uint8_t bytesWaiting = serialTotalBytesWaiting(hottPort);
|
||||||
|
|
||||||
|
if (useSoftserialRxFailureWorkaround) {
|
||||||
|
// FIXME The 0x80 is being read as 0x00 - softserial timing/syncronisation problem somewhere.
|
||||||
|
if (!bytesWaiting) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t incomingByte = serialRead(hottPort);
|
||||||
|
processBinaryModeRequest(incomingByte);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (bytesWaiting <= 1) {
|
if (bytesWaiting <= 1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue