Merge pull request #1419 from Pierre-A/fix_HottTelemetry_timing

Fix Hott telemetry timing issue
This commit is contained in:
Dominic Clifton 2015-10-29 21:31:37 +00:00
commit d252a796e5
1 changed files with 13 additions and 7 deletions

View File

@ -423,13 +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) {
if (!hottIsSending) {
hottIsSending = true;
// FIXME temorary workaround for HoTT not working on Hardware serial ports due to hardware/softserial serial port initialisation differences
//serialSetMode(hottPort, MODE_TX);
closeSerialPort(hottPort);
hottPort = openSerialPort(portConfig->identifier, FUNCTION_TELEMETRY_HOTT, NULL, HOTT_BAUDRATE, MODE_TX, SERIAL_NOT_INVERTED);
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);
hottMsgCrc = 0;
return;
}
@ -437,11 +443,11 @@ static void hottSendTelemetryData(void) {
if (hottMsgRemainingBytesToSendCount == 0) {
hottMsg = NULL;
hottIsSending = false;
// FIXME temorary workaround for HoTT not working on Hardware serial ports due to hardware/softserial serial port initialisation differences
//serialSetMode(hottPort, MODE_RX);
closeSerialPort(hottPort);
hottPort = openSerialPort(portConfig->identifier, FUNCTION_TELEMETRY_HOTT, NULL, HOTT_BAUDRATE, MODE_RX, SERIAL_NOT_INVERTED);
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);
flushHottRxBuffer();
return;
}