Eliminated more unnecessary calls.

This commit is contained in:
mikeller 2018-05-10 02:11:41 +12:00
parent 032f3b501b
commit 9bf762e9e8
2 changed files with 9 additions and 6 deletions

View File

@ -518,6 +518,7 @@ bool processRx(timeUs_t currentTimeUs)
{
static bool armedBeeperOn = false;
static bool airmodeIsActivated;
static bool sharedPortTelemetryEnabled = false;
if (!calculateRxChannelsAndUpdateFailsafe(currentTimeUs)) {
return false;
@ -775,14 +776,18 @@ bool processRx(timeUs_t currentTimeUs)
#ifdef USE_TELEMETRY
if (feature(FEATURE_TELEMETRY)) {
if ((!isModeActivationConditionPresent(BOXTELEMETRY) && ARMING_FLAG(ARMED)) ||
(isModeActivationConditionPresent(BOXTELEMETRY) && IS_RC_MODE_ACTIVE(BOXTELEMETRY))) {
bool enableSharedPortTelemetry = (!isModeActivationConditionPresent(BOXTELEMETRY) && ARMING_FLAG(ARMED)) || (isModeActivationConditionPresent(BOXTELEMETRY) && IS_RC_MODE_ACTIVE(BOXTELEMETRY));
if (enableSharedPortTelemetry && !sharedPortTelemetryEnabled) {
mspSerialReleaseSharedTelemetryPorts();
} else {
telemetryCheckState();
sharedPortTelemetryEnabled = true;
} else if (!enableSharedPortTelemetry && sharedPortTelemetryEnabled) {
// the telemetry state must be checked immediately so that shared serial ports are released.
telemetryCheckState();
mspSerialAllocatePorts();
sharedPortTelemetryEnabled = false;
}
}
#endif

View File

@ -202,8 +202,6 @@ static void taskCalculateAltitude(timeUs_t currentTimeUs)
#ifdef USE_TELEMETRY
static void taskTelemetry(timeUs_t currentTimeUs)
{
telemetryCheckState();
if (!cliMode && feature(FEATURE_TELEMETRY)) {
telemetryProcess(currentTimeUs);
}