Fix Hott telemetry timing issue
This commit is contained in:
parent
48c8802153
commit
5376dc4ce3
|
@ -423,16 +423,19 @@ static void hottCheckSerialData(uint32_t currentMicros)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void workAroundForHottTelemetryOnUsart(serialPort_t *instance, portMode_t mode) {
|
||||||
|
closeSerialPort(hottPort);
|
||||||
|
hottPort = openSerialPort(instance->identifier, FUNCTION_TELEMETRY_HOTT, NULL, HOTT_BAUDRATE, mode, SERIAL_NOT_INVERTED);
|
||||||
|
}
|
||||||
|
|
||||||
static void hottSendTelemetryData(void) {
|
static void hottSendTelemetryData(void) {
|
||||||
if (!hottIsSending) {
|
if (!hottIsSending) {
|
||||||
hottIsSending = true;
|
hottIsSending = true;
|
||||||
// FIXME temorary workaround for HoTT not working on Hardware serial ports due to hardware/softserial serial port initialisation differences
|
// FIXME temorary workaround for HoTT not working on Hardware serial ports due to hardware/softserial serial port initialisation differences
|
||||||
if ((portConfig->identifier == SERIAL_PORT_SOFTSERIAL1) || (portConfig->identifier == SERIAL_PORT_SOFTSERIAL2))
|
if ((portConfig->identifier == SERIAL_PORT_USART1) || (portConfig->identifier == SERIAL_PORT_USART2) || (portConfig->identifier == SERIAL_PORT_USART3))
|
||||||
serialSetMode(hottPort, MODE_TX);
|
workAroundForHottTelemetryOnUsart(hottPort, MODE_TX);
|
||||||
else {
|
else
|
||||||
closeSerialPort(hottPort);
|
serialSetMode(hottPort, MODE_TX);
|
||||||
hottPort = openSerialPort(portConfig->identifier, FUNCTION_TELEMETRY_HOTT, NULL, HOTT_BAUDRATE, MODE_TX, SERIAL_NOT_INVERTED);
|
|
||||||
}
|
|
||||||
hottMsgCrc = 0;
|
hottMsgCrc = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -440,14 +443,11 @@ static void hottSendTelemetryData(void) {
|
||||||
if (hottMsgRemainingBytesToSendCount == 0) {
|
if (hottMsgRemainingBytesToSendCount == 0) {
|
||||||
hottMsg = NULL;
|
hottMsg = NULL;
|
||||||
hottIsSending = false;
|
hottIsSending = false;
|
||||||
|
|
||||||
// FIXME temorary workaround for HoTT not working on Hardware serial ports due to hardware/softserial serial port initialisation differences
|
// FIXME temorary workaround for HoTT not working on Hardware serial ports due to hardware/softserial serial port initialisation differences
|
||||||
if ((portConfig->identifier == SERIAL_PORT_SOFTSERIAL1) || (portConfig->identifier == SERIAL_PORT_SOFTSERIAL2))
|
if ((portConfig->identifier == SERIAL_PORT_USART1) || (portConfig->identifier == SERIAL_PORT_USART2) || (portConfig->identifier == SERIAL_PORT_USART3))
|
||||||
serialSetMode(hottPort, MODE_RX);
|
workAroundForHottTelemetryOnUsart(hottPort, MODE_RX);
|
||||||
else {
|
else
|
||||||
closeSerialPort(hottPort);
|
serialSetMode(hottPort, MODE_RX);
|
||||||
hottPort = openSerialPort(portConfig->identifier, FUNCTION_TELEMETRY_HOTT, NULL, HOTT_BAUDRATE, MODE_RX, SERIAL_NOT_INVERTED);
|
|
||||||
}
|
|
||||||
flushHottRxBuffer();
|
flushHottRxBuffer();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue