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

Ensure that telemetry state is always updated after initialising

telemetry so that providers can configure the telemetry port as
applicable.
This commit is contained in:
Dominic Clifton 2014-04-07 21:38:50 +01:00
parent 8138bc8cf3
commit 6b1a6332b9
2 changed files with 8 additions and 3 deletions

View file

@ -180,8 +180,7 @@ void annexCode(void)
LED0_OFF; LED0_OFF;
if (f.ARMED) if (f.ARMED)
LED0_ON; LED0_ON;
// This will switch to/from 9600 or 115200 baud depending on state. Of course, it should only do it on changes. With telemetry_softserial>0 telemetry is always enabled, also see updateTelemetryState()
if (feature(FEATURE_TELEMETRY))
checkTelemetryState(); checkTelemetryState();
} }

View file

@ -26,6 +26,8 @@ void initTelemetry(void)
core.telemport = &(softSerialPorts[1].port); core.telemport = &(softSerialPorts[1].port);
else else
core.telemport = core.mainport; core.telemport = core.mainport;
checkTelemetryState();
} }
static bool telemetryEnabled = false; static bool telemetryEnabled = false;
@ -71,6 +73,10 @@ void freeTelemetryPort(void) {
void checkTelemetryState(void) void checkTelemetryState(void)
{ {
if (!feature(FEATURE_TELEMETRY)) {
return;
}
bool telemetryCurrentlyEnabled = isTelemetryEnabled(); bool telemetryCurrentlyEnabled = isTelemetryEnabled();
if (!shouldChangeTelemetryStateNow(telemetryCurrentlyEnabled)) { if (!shouldChangeTelemetryStateNow(telemetryCurrentlyEnabled)) {