Fix Hott telemetry timing issue

This commit is contained in:
Pierre-A 2015-10-22 17:02:44 +02:00
parent 48c8802153
commit 5376dc4ce3
1 changed files with 13 additions and 13 deletions

View File

@ -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))
workAroundForHottTelemetryOnUsart(hottPort, MODE_TX);
else
serialSetMode(hottPort, MODE_TX); serialSetMode(hottPort, MODE_TX);
else {
closeSerialPort(hottPort);
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))
workAroundForHottTelemetryOnUsart(hottPort, MODE_RX);
else
serialSetMode(hottPort, MODE_RX); serialSetMode(hottPort, MODE_RX);
else {
closeSerialPort(hottPort);
hottPort = openSerialPort(portConfig->identifier, FUNCTION_TELEMETRY_HOTT, NULL, HOTT_BAUDRATE, MODE_RX, SERIAL_NOT_INVERTED);
}
flushHottRxBuffer(); flushHottRxBuffer();
return; return;
} }