1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-25 17:25:20 +03:00

There was a little more fixed to do when telemetry was not eanbled.

Tested arm/disarm/arm/disarm with telemetry on and off, all working now.

See #155.
This commit is contained in:
Dominic Clifton 2014-11-08 01:11:10 +00:00
parent 2c8b3af88d
commit 2461973dd6
5 changed files with 40 additions and 4 deletions

View file

@ -299,10 +299,12 @@ void mwDisarm(void)
DISABLE_ARMING_FLAG(ARMED);
#ifdef TELEMETRY
// the telemetry state must be checked immediately so that shared serial ports are released.
checkTelemetryState();
if (isSerialPortFunctionShared(FUNCTION_TELEMETRY, FUNCTION_MSP)) {
mspReset(&masterConfig.serialConfig);
if (feature(FEATURE_TELEMETRY)) {
// the telemetry state must be checked immediately so that shared serial ports are released.
checkTelemetryState();
if (isSerialPortFunctionShared(FUNCTION_TELEMETRY, FUNCTION_MSP)) {
mspReset(&masterConfig.serialConfig);
}
}
#endif
}
@ -317,6 +319,15 @@ void mwArm(void)
if (!ARMING_FLAG(PREVENT_ARMING)) {
ENABLE_ARMING_FLAG(ARMED);
headFreeModeHold = heading;
#ifdef TELEMETRY
if (feature(FEATURE_TELEMETRY)) {
serialPort_t *sharedTelemetryAndMspPort = findSharedSerialPort(FUNCTION_TELEMETRY, FUNCTION_MSP);
if (sharedTelemetryAndMspPort) {
mspReleasePortIfAllocated(sharedTelemetryAndMspPort);
}
}
#endif
return;
}
}