Fixed checkCrsfTelemetryState

This commit is contained in:
Martin Budden 2016-11-15 12:39:20 +00:00
parent c987f268b7
commit e4997353c8
1 changed files with 16 additions and 7 deletions

View File

@ -391,16 +391,25 @@ void configureCrsfTelemetryPort(void)
bool checkCrsfTelemetryState(void)
{
const bool newTelemetryEnabled = telemetryDetermineEnabledState(portSharing);
if (newTelemetryEnabled == crsfTelemetryEnabled) {
if (serialPortConfig && telemetryCheckRxPortShared(serialPortConfig)) {
if (!crsfTelemetryEnabled && telemetrySharedPort != NULL) {
serialPort = telemetrySharedPort;
crsfTelemetryEnabled = true;
return true;
}
return false;
}
if (newTelemetryEnabled) {
configureCrsfTelemetryPort();
} else {
freeCrsfTelemetryPort();
const bool newTelemetryEnabled = telemetryDetermineEnabledState(portSharing);
if (newTelemetryEnabled == crsfTelemetryEnabled) {
return false;
}
if (newTelemetryEnabled) {
configureCrsfTelemetryPort();
} else {
freeCrsfTelemetryPort();
}
return true;
}
return true;
}
int getCrsfFrame(uint8_t *frame, crsfFrameType_e frameType)