mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-21 07:15:18 +03:00
Eliminated more unnecessary calls.
This commit is contained in:
parent
032f3b501b
commit
9bf762e9e8
2 changed files with 9 additions and 6 deletions
|
@ -518,6 +518,7 @@ bool processRx(timeUs_t currentTimeUs)
|
||||||
{
|
{
|
||||||
static bool armedBeeperOn = false;
|
static bool armedBeeperOn = false;
|
||||||
static bool airmodeIsActivated;
|
static bool airmodeIsActivated;
|
||||||
|
static bool sharedPortTelemetryEnabled = false;
|
||||||
|
|
||||||
if (!calculateRxChannelsAndUpdateFailsafe(currentTimeUs)) {
|
if (!calculateRxChannelsAndUpdateFailsafe(currentTimeUs)) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -775,14 +776,18 @@ bool processRx(timeUs_t currentTimeUs)
|
||||||
|
|
||||||
#ifdef USE_TELEMETRY
|
#ifdef USE_TELEMETRY
|
||||||
if (feature(FEATURE_TELEMETRY)) {
|
if (feature(FEATURE_TELEMETRY)) {
|
||||||
if ((!isModeActivationConditionPresent(BOXTELEMETRY) && ARMING_FLAG(ARMED)) ||
|
bool enableSharedPortTelemetry = (!isModeActivationConditionPresent(BOXTELEMETRY) && ARMING_FLAG(ARMED)) || (isModeActivationConditionPresent(BOXTELEMETRY) && IS_RC_MODE_ACTIVE(BOXTELEMETRY));
|
||||||
(isModeActivationConditionPresent(BOXTELEMETRY) && IS_RC_MODE_ACTIVE(BOXTELEMETRY))) {
|
if (enableSharedPortTelemetry && !sharedPortTelemetryEnabled) {
|
||||||
|
|
||||||
mspSerialReleaseSharedTelemetryPorts();
|
mspSerialReleaseSharedTelemetryPorts();
|
||||||
} else {
|
telemetryCheckState();
|
||||||
|
|
||||||
|
sharedPortTelemetryEnabled = true;
|
||||||
|
} else if (!enableSharedPortTelemetry && sharedPortTelemetryEnabled) {
|
||||||
// the telemetry state must be checked immediately so that shared serial ports are released.
|
// the telemetry state must be checked immediately so that shared serial ports are released.
|
||||||
telemetryCheckState();
|
telemetryCheckState();
|
||||||
mspSerialAllocatePorts();
|
mspSerialAllocatePorts();
|
||||||
|
|
||||||
|
sharedPortTelemetryEnabled = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -202,8 +202,6 @@ static void taskCalculateAltitude(timeUs_t currentTimeUs)
|
||||||
#ifdef USE_TELEMETRY
|
#ifdef USE_TELEMETRY
|
||||||
static void taskTelemetry(timeUs_t currentTimeUs)
|
static void taskTelemetry(timeUs_t currentTimeUs)
|
||||||
{
|
{
|
||||||
telemetryCheckState();
|
|
||||||
|
|
||||||
if (!cliMode && feature(FEATURE_TELEMETRY)) {
|
if (!cliMode && feature(FEATURE_TELEMETRY)) {
|
||||||
telemetryProcess(currentTimeUs);
|
telemetryProcess(currentTimeUs);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue