mirror of
https://github.com/opentx/opentx.git
synced 2025-07-15 12:25:12 +03:00
Refactoring to have globals splitted from opentx.h for easier includes (#7511)
This commit is contained in:
parent
ebe33693b4
commit
d90ac28cc1
10 changed files with 119 additions and 104 deletions
|
@ -22,8 +22,6 @@
|
||||||
#define _BUZZER_H_
|
#define _BUZZER_H_
|
||||||
|
|
||||||
#if defined(BUZZER)
|
#if defined(BUZZER)
|
||||||
extern uint8_t g_beepCnt;
|
|
||||||
extern uint8_t beepAgain;
|
|
||||||
extern uint8_t beepAgainOrig;
|
extern uint8_t beepAgainOrig;
|
||||||
extern uint8_t beepOn;
|
extern uint8_t beepOn;
|
||||||
extern bool warble;
|
extern bool warble;
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include "dataconstants.h"
|
#include "dataconstants.h"
|
||||||
#include "definitions.h"
|
#include "definitions.h"
|
||||||
#include "bitfield.h"
|
#include "bitfield.h"
|
||||||
|
#include "globals.h"
|
||||||
|
|
||||||
#if defined(PCBTARANIS)
|
#if defined(PCBTARANIS)
|
||||||
#define N_TARANIS_FIELD(x)
|
#define N_TARANIS_FIELD(x)
|
||||||
|
@ -483,8 +484,6 @@ PACK(struct ModuleData {
|
||||||
* Model structure
|
* Model structure
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef uint16_t BeepANACenter;
|
|
||||||
|
|
||||||
#if LEN_BITMAP_NAME > 0
|
#if LEN_BITMAP_NAME > 0
|
||||||
#define MODEL_HEADER_BITMAP_FIELD NOBACKUP(char bitmap[LEN_BITMAP_NAME]);
|
#define MODEL_HEADER_BITMAP_FIELD NOBACKUP(char bitmap[LEN_BITMAP_NAME]);
|
||||||
#else
|
#else
|
||||||
|
|
97
radio/src/globals.h
Normal file
97
radio/src/globals.h
Normal file
|
@ -0,0 +1,97 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) OpenTX
|
||||||
|
*
|
||||||
|
* Based on code named
|
||||||
|
* th9x - http://code.google.com/p/th9x
|
||||||
|
* er9x - http://code.google.com/p/er9x
|
||||||
|
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||||
|
*
|
||||||
|
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License version 2 as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _GLOBALS_H_
|
||||||
|
#define _GLOBALS_H_
|
||||||
|
|
||||||
|
#include "definitions.h"
|
||||||
|
#include "dataconstants.h"
|
||||||
|
|
||||||
|
PACK(struct GlobalData {
|
||||||
|
uint8_t unexpectedShutdown:1;
|
||||||
|
uint8_t externalAntennaEnabled:1;
|
||||||
|
uint8_t authenticationCount:2;
|
||||||
|
uint8_t upgradeModulePopup:1;
|
||||||
|
uint8_t internalModuleVersionChecked:1;
|
||||||
|
uint8_t spare:2;
|
||||||
|
});
|
||||||
|
|
||||||
|
extern GlobalData globalData;
|
||||||
|
|
||||||
|
extern uint16_t sessionTimer;
|
||||||
|
extern uint16_t s_timeCumThr;
|
||||||
|
extern uint16_t s_timeCum16ThrP;
|
||||||
|
|
||||||
|
#if defined(OVERRIDE_CHANNEL_FUNCTION)
|
||||||
|
#define OVERRIDE_CHANNEL_UNDEFINED -4096
|
||||||
|
extern safetych_t safetyCh[MAX_OUTPUT_CHANNELS];
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern uint8_t trimsCheckTimer;
|
||||||
|
extern uint8_t trimsDisplayTimer;
|
||||||
|
extern uint8_t trimsDisplayMask;
|
||||||
|
extern uint16_t maxMixerDuration;
|
||||||
|
|
||||||
|
extern uint8_t requiredSpeakerVolume;
|
||||||
|
|
||||||
|
enum MainRequest {
|
||||||
|
REQUEST_SCREENSHOT,
|
||||||
|
REQUEST_FLIGHT_RESET,
|
||||||
|
};
|
||||||
|
|
||||||
|
extern uint8_t mainRequestFlags;
|
||||||
|
|
||||||
|
#define DELAY_POS_MARGIN 3
|
||||||
|
typedef int16_t delayval_t;
|
||||||
|
PACK(struct SwOn {
|
||||||
|
uint16_t delay:14; // max = 2550
|
||||||
|
uint8_t activeMix:1;
|
||||||
|
uint8_t activeExpo:1;
|
||||||
|
int16_t now; // timer trigger source -> off, abs, stk, stk%, sw/!sw, !m_sw/!m_sw
|
||||||
|
int16_t prev;
|
||||||
|
});
|
||||||
|
|
||||||
|
extern SwOn swOn[MAX_MIXERS];
|
||||||
|
extern int32_t act[MAX_MIXERS];
|
||||||
|
|
||||||
|
// static variables used in evalFlightModeMixes - moved here so they don't interfere with the stack
|
||||||
|
// It's also easier to initialize them here.
|
||||||
|
extern int8_t virtualInputsTrims[MAX_INPUTS];
|
||||||
|
|
||||||
|
extern int16_t anas [MAX_INPUTS];
|
||||||
|
extern int16_t trims[NUM_TRIMS];
|
||||||
|
extern int32_t chans[MAX_OUTPUT_CHANNELS];
|
||||||
|
extern int16_t ex_chans[MAX_OUTPUT_CHANNELS]; // Outputs (before LIMITS) of the last perMain
|
||||||
|
extern int16_t channelOutputs[MAX_OUTPUT_CHANNELS];
|
||||||
|
|
||||||
|
typedef uint16_t BeepANACenter;
|
||||||
|
extern BeepANACenter bpanaCenter;
|
||||||
|
|
||||||
|
extern uint8_t s_mixer_first_run_done;
|
||||||
|
|
||||||
|
extern int16_t calibratedAnalogs[NUM_CALIBRATED_ANALOGS];
|
||||||
|
|
||||||
|
extern uint8_t g_beepCnt;
|
||||||
|
extern uint8_t beepAgain;
|
||||||
|
extern uint16_t lightOffCounter;
|
||||||
|
extern uint8_t flashCounter;
|
||||||
|
extern uint8_t mixWarning;
|
||||||
|
|
||||||
|
#endif
|
|
@ -1018,10 +1018,6 @@ bool menuModelSetup(event_t event)
|
||||||
uint8_t moduleType = checkIncDec(event, g_model.moduleData[INTERNAL_MODULE].type, MODULE_TYPE_NONE, MODULE_TYPE_MAX, EE_MODEL, isInternalModuleAvailable);
|
uint8_t moduleType = checkIncDec(event, g_model.moduleData[INTERNAL_MODULE].type, MODULE_TYPE_NONE, MODULE_TYPE_MAX, EE_MODEL, isInternalModuleAvailable);
|
||||||
if (checkIncDec_Ret) {
|
if (checkIncDec_Ret) {
|
||||||
setModuleType(INTERNAL_MODULE, moduleType);
|
setModuleType(INTERNAL_MODULE, moduleType);
|
||||||
#if defined(ACCESS_LIB)
|
|
||||||
// the module will reset on mode switch, we need to reset the authentication counter
|
|
||||||
globalData.authenticationCount = 0;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (isModuleXJT(INTERNAL_MODULE)) {
|
else if (isModuleXJT(INTERNAL_MODULE)) {
|
||||||
|
@ -1034,6 +1030,7 @@ bool menuModelSetup(event_t event)
|
||||||
}
|
}
|
||||||
else if (isModulePXX2(INTERNAL_MODULE)) {
|
else if (isModulePXX2(INTERNAL_MODULE)) {
|
||||||
g_model.moduleData[INTERNAL_MODULE].subType = checkIncDec(event, g_model.moduleData[INTERNAL_MODULE].subType, 0, MODULE_SUBTYPE_ISRM_PXX2_ACCST_D16, EE_MODEL);
|
g_model.moduleData[INTERNAL_MODULE].subType = checkIncDec(event, g_model.moduleData[INTERNAL_MODULE].subType, 0, MODULE_SUBTYPE_ISRM_PXX2_ACCST_D16, EE_MODEL);
|
||||||
|
resetAccessAuthenticationCount();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -50,10 +50,7 @@ bool menuRadioPowerMeter(event_t event)
|
||||||
lcdDrawCenteredText(LCD_H/2, STR_STOPPING);
|
lcdDrawCenteredText(LCD_H/2, STR_STOPPING);
|
||||||
lcdRefresh();
|
lcdRefresh();
|
||||||
moduleState[g_moduleIdx].readModuleInformation(&reusableBuffer.moduleSetup.pxx2.moduleInformation, PXX2_HW_INFO_TX_ID, PXX2_HW_INFO_TX_ID);
|
moduleState[g_moduleIdx].readModuleInformation(&reusableBuffer.moduleSetup.pxx2.moduleInformation, PXX2_HW_INFO_TX_ID, PXX2_HW_INFO_TX_ID);
|
||||||
#if defined(ACCESS_LIB)
|
resetAccessAuthenticationCount();
|
||||||
// the module will reset on mode switch, we need to reset the authentication counter
|
|
||||||
globalData.authenticationCount = 0;
|
|
||||||
#endif
|
|
||||||
/* wait 1s to resume normal operation before leaving */
|
/* wait 1s to resume normal operation before leaving */
|
||||||
watchdogSuspend(500 /*5s*/);
|
watchdogSuspend(500 /*5s*/);
|
||||||
RTOS_WAIT_MS(1000);
|
RTOS_WAIT_MS(1000);
|
||||||
|
|
|
@ -58,10 +58,7 @@ bool menuRadioSpectrumAnalyser(event_t event)
|
||||||
lcdRefresh();
|
lcdRefresh();
|
||||||
if (isModulePXX2(g_moduleIdx)) {
|
if (isModulePXX2(g_moduleIdx)) {
|
||||||
moduleState[g_moduleIdx].readModuleInformation(&reusableBuffer.moduleSetup.pxx2.moduleInformation, PXX2_HW_INFO_TX_ID, PXX2_HW_INFO_TX_ID);
|
moduleState[g_moduleIdx].readModuleInformation(&reusableBuffer.moduleSetup.pxx2.moduleInformation, PXX2_HW_INFO_TX_ID, PXX2_HW_INFO_TX_ID);
|
||||||
#if defined(ACCESS_LIB)
|
resetAccessAuthenticationCount();
|
||||||
// the module will reset on mode switch, we need to reset the authentication counter
|
|
||||||
globalData.authenticationCount = 0;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else if (isModuleMultimodule(g_moduleIdx)) {
|
else if (isModuleMultimodule(g_moduleIdx)) {
|
||||||
if (reusableBuffer.spectrumAnalyser.moduleOFF)
|
if (reusableBuffer.spectrumAnalyser.moduleOFF)
|
||||||
|
|
|
@ -901,9 +901,7 @@ void evalMixes(uint8_t tick10ms)
|
||||||
|
|
||||||
static uint16_t fp_act[MAX_FLIGHT_MODES] = {0};
|
static uint16_t fp_act[MAX_FLIGHT_MODES] = {0};
|
||||||
static uint16_t delta = 0;
|
static uint16_t delta = 0;
|
||||||
static ACTIVE_PHASES_TYPE flightModesFade = 0;
|
static uint16_t flightModesFade = 0;
|
||||||
|
|
||||||
LS_RECURSIVE_EVALUATION_RESET();
|
|
||||||
|
|
||||||
uint8_t fm = getFlightMode();
|
uint8_t fm = getFlightMode();
|
||||||
|
|
||||||
|
@ -915,7 +913,7 @@ void evalMixes(uint8_t tick10ms)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
uint8_t fadeTime = max(g_model.flightModeData[lastFlightMode].fadeOut, g_model.flightModeData[fm].fadeIn);
|
uint8_t fadeTime = max(g_model.flightModeData[lastFlightMode].fadeOut, g_model.flightModeData[fm].fadeIn);
|
||||||
ACTIVE_PHASES_TYPE transitionMask = ((ACTIVE_PHASES_TYPE)1 << lastFlightMode) + ((ACTIVE_PHASES_TYPE)1 << fm);
|
uint16_t transitionMask = (0x01u << lastFlightMode) + (0x01u << fm);
|
||||||
if (fadeTime) {
|
if (fadeTime) {
|
||||||
flightModesFade |= transitionMask;
|
flightModesFade |= transitionMask;
|
||||||
delta = (MAX_ACT / 10) / fadeTime;
|
delta = (MAX_ACT / 10) / fadeTime;
|
||||||
|
@ -945,15 +943,13 @@ void evalMixes(uint8_t tick10ms)
|
||||||
if (flightModesFade) {
|
if (flightModesFade) {
|
||||||
memclear(sum_chans512, sizeof(sum_chans512));
|
memclear(sum_chans512, sizeof(sum_chans512));
|
||||||
for (uint8_t p=0; p<MAX_FLIGHT_MODES; p++) {
|
for (uint8_t p=0; p<MAX_FLIGHT_MODES; p++) {
|
||||||
LS_RECURSIVE_EVALUATION_RESET();
|
if (flightModesFade & (0x01 << p)) {
|
||||||
if (flightModesFade & ((ACTIVE_PHASES_TYPE)1 << p)) {
|
|
||||||
mixerCurrentFlightMode = p;
|
mixerCurrentFlightMode = p;
|
||||||
evalFlightModeMixes(p==fm ? e_perout_mode_normal : e_perout_mode_inactive_flight_mode, p==fm ? tick10ms : 0);
|
evalFlightModeMixes(p==fm ? e_perout_mode_normal : e_perout_mode_inactive_flight_mode, p==fm ? tick10ms : 0);
|
||||||
for (uint8_t i=0; i<MAX_OUTPUT_CHANNELS; i++)
|
for (uint8_t i=0; i<MAX_OUTPUT_CHANNELS; i++)
|
||||||
sum_chans512[i] += (chans[i] >> 4) * fp_act[p];
|
sum_chans512[i] += (chans[i] >> 4) * fp_act[p];
|
||||||
weight += fp_act[p];
|
weight += fp_act[p];
|
||||||
}
|
}
|
||||||
LS_RECURSIVE_EVALUATION_RESET();
|
|
||||||
}
|
}
|
||||||
assert(weight);
|
assert(weight);
|
||||||
mixerCurrentFlightMode = fm;
|
mixerCurrentFlightMode = fm;
|
||||||
|
@ -994,7 +990,7 @@ void evalMixes(uint8_t tick10ms)
|
||||||
if (tick10ms && flightModesFade) {
|
if (tick10ms && flightModesFade) {
|
||||||
uint16_t tick_delta = delta * tick10ms;
|
uint16_t tick_delta = delta * tick10ms;
|
||||||
for (uint8_t p=0; p<MAX_FLIGHT_MODES; p++) {
|
for (uint8_t p=0; p<MAX_FLIGHT_MODES; p++) {
|
||||||
ACTIVE_PHASES_TYPE flightModeMask = ((ACTIVE_PHASES_TYPE)1 << p);
|
uint16_t flightModeMask = (0x01 << p);
|
||||||
if (flightModesFade & flightModeMask) {
|
if (flightModesFade & flightModeMask) {
|
||||||
if (p == fm) {
|
if (p == fm) {
|
||||||
if (MAX_ACT - fp_act[p] > tick_delta)
|
if (MAX_ACT - fp_act[p] > tick_delta)
|
||||||
|
|
|
@ -21,14 +21,12 @@
|
||||||
#ifndef _OPENTX_H_
|
#ifndef _OPENTX_H_
|
||||||
#define _OPENTX_H_
|
#define _OPENTX_H_
|
||||||
|
|
||||||
#include <inttypes.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <stddef.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <math.h>
|
|
||||||
#include "definitions.h"
|
#include "definitions.h"
|
||||||
#include "opentx_types.h"
|
#include "opentx_types.h"
|
||||||
#include "debounce.h"
|
#include "debounce.h"
|
||||||
|
#include "globals.h"
|
||||||
|
#include "opentx_helpers.h"
|
||||||
|
|
||||||
#if defined(SIMU)
|
#if defined(SIMU)
|
||||||
#include "targets/simu/simpgmspace.h"
|
#include "targets/simu/simpgmspace.h"
|
||||||
|
@ -502,7 +500,6 @@ void logicalSwitchesReset();
|
||||||
|
|
||||||
void evalLogicalSwitches(bool isCurrentFlightmode=true);
|
void evalLogicalSwitches(bool isCurrentFlightmode=true);
|
||||||
void logicalSwitchesCopyState(uint8_t src, uint8_t dst);
|
void logicalSwitchesCopyState(uint8_t src, uint8_t dst);
|
||||||
#define LS_RECURSIVE_EVALUATION_RESET()
|
|
||||||
|
|
||||||
#if defined(PCBTARANIS) || defined(PCBHORUS)
|
#if defined(PCBTARANIS) || defined(PCBHORUS)
|
||||||
void getSwitchesPosition(bool startup);
|
void getSwitchesPosition(bool startup);
|
||||||
|
@ -547,34 +544,8 @@ bool setTrimValue(uint8_t phase, uint8_t idx, int trim);
|
||||||
|
|
||||||
#include "gvars.h"
|
#include "gvars.h"
|
||||||
|
|
||||||
extern uint16_t sessionTimer;
|
|
||||||
extern uint16_t s_timeCumThr;
|
|
||||||
extern uint16_t s_timeCum16ThrP;
|
|
||||||
|
|
||||||
#if defined(OVERRIDE_CHANNEL_FUNCTION)
|
|
||||||
#define OVERRIDE_CHANNEL_UNDEFINED -4096
|
|
||||||
extern safetych_t safetyCh[MAX_OUTPUT_CHANNELS];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern uint8_t trimsCheckTimer;
|
|
||||||
extern uint8_t trimsDisplayTimer;
|
|
||||||
extern uint8_t trimsDisplayMask;
|
|
||||||
|
|
||||||
void flightReset(uint8_t check=true);
|
void flightReset(uint8_t check=true);
|
||||||
|
|
||||||
PACK(struct GlobalData {
|
|
||||||
uint8_t unexpectedShutdown:1;
|
|
||||||
uint8_t externalAntennaEnabled:1;
|
|
||||||
uint8_t authenticationCount:2;
|
|
||||||
uint8_t upgradeModulePopup:1;
|
|
||||||
uint8_t internalModuleVersionChecked:1;
|
|
||||||
uint8_t spare:2;
|
|
||||||
});
|
|
||||||
|
|
||||||
extern GlobalData globalData;
|
|
||||||
|
|
||||||
extern uint16_t maxMixerDuration;
|
|
||||||
|
|
||||||
#define DURATION_MS_PREC2(x) ((x)/20)
|
#define DURATION_MS_PREC2(x) ((x)/20)
|
||||||
|
|
||||||
#if defined(THRTRACE)
|
#if defined(THRTRACE)
|
||||||
|
@ -723,14 +694,9 @@ extern const char vers_stamp[];
|
||||||
const char * getOtherVersion(char * buffer);
|
const char * getOtherVersion(char * buffer);
|
||||||
|
|
||||||
#define g_blinkTmr10ms (*(uint8_t*)&g_tmr10ms)
|
#define g_blinkTmr10ms (*(uint8_t*)&g_tmr10ms)
|
||||||
extern uint8_t g_beepCnt;
|
|
||||||
|
|
||||||
#include "trainer.h"
|
#include "trainer.h"
|
||||||
|
|
||||||
extern int32_t chans[MAX_OUTPUT_CHANNELS];
|
|
||||||
extern int16_t ex_chans[MAX_OUTPUT_CHANNELS]; // Outputs (before LIMITS) of the last perMain
|
|
||||||
extern int16_t channelOutputs[MAX_OUTPUT_CHANNELS];
|
|
||||||
|
|
||||||
int expo(int x, int k);
|
int expo(int x, int k);
|
||||||
|
|
||||||
inline void getMixSrcRange(const int source, int16_t & valMin, int16_t & valMax, LcdFlags * flags = 0)
|
inline void getMixSrcRange(const int source, int16_t & valMin, int16_t & valMax, LcdFlags * flags = 0)
|
||||||
|
@ -829,33 +795,15 @@ int16_t applyLimits(uint8_t channel, int32_t value);
|
||||||
void evalInputs(uint8_t mode);
|
void evalInputs(uint8_t mode);
|
||||||
uint16_t anaIn(uint8_t chan);
|
uint16_t anaIn(uint8_t chan);
|
||||||
|
|
||||||
extern int16_t calibratedAnalogs[NUM_CALIBRATED_ANALOGS];
|
|
||||||
|
|
||||||
#define FLASH_DURATION 20 /*200ms*/
|
#define FLASH_DURATION 20 /*200ms*/
|
||||||
|
|
||||||
extern uint8_t beepAgain;
|
|
||||||
extern uint16_t lightOffCounter;
|
|
||||||
extern uint8_t flashCounter;
|
|
||||||
extern uint8_t mixWarning;
|
|
||||||
|
|
||||||
FlightModeData * flightModeAddress(uint8_t idx);
|
FlightModeData * flightModeAddress(uint8_t idx);
|
||||||
ExpoData * expoAddress(uint8_t idx);
|
ExpoData * expoAddress(uint8_t idx);
|
||||||
MixData * mixAddress(uint8_t idx);
|
MixData * mixAddress(uint8_t idx);
|
||||||
LimitData * limitAddress(uint8_t idx);
|
LimitData * limitAddress(uint8_t idx);
|
||||||
LogicalSwitchData * lswAddress(uint8_t idx);
|
LogicalSwitchData * lswAddress(uint8_t idx);
|
||||||
|
|
||||||
// static variables used in evalFlightModeMixes - moved here so they don't interfere with the stack
|
|
||||||
// It's also easier to initialize them here.
|
|
||||||
extern int8_t virtualInputsTrims[MAX_INPUTS];
|
|
||||||
|
|
||||||
extern int16_t anas [MAX_INPUTS];
|
|
||||||
extern int16_t trims[NUM_TRIMS];
|
|
||||||
extern BeepANACenter bpanaCenter;
|
|
||||||
|
|
||||||
extern uint8_t s_mixer_first_run_done;
|
|
||||||
|
|
||||||
void applyDefaultTemplate();
|
void applyDefaultTemplate();
|
||||||
|
|
||||||
void instantTrim();
|
void instantTrim();
|
||||||
void evalTrims();
|
void evalTrims();
|
||||||
void copyTrimsToOffset(uint8_t ch);
|
void copyTrimsToOffset(uint8_t ch);
|
||||||
|
@ -863,20 +811,6 @@ void copySticksToOffset(uint8_t ch);
|
||||||
void copyMinMaxToOutputs(uint8_t ch);
|
void copyMinMaxToOutputs(uint8_t ch);
|
||||||
void moveTrimsToOffsets();
|
void moveTrimsToOffsets();
|
||||||
|
|
||||||
typedef uint16_t ACTIVE_PHASES_TYPE;
|
|
||||||
#define DELAY_POS_MARGIN 3
|
|
||||||
typedef int16_t delayval_t;
|
|
||||||
PACK(struct SwOn {
|
|
||||||
uint16_t delay:14; // max = 2550
|
|
||||||
uint8_t activeMix:1;
|
|
||||||
uint8_t activeExpo:1;
|
|
||||||
int16_t now; // timer trigger source -> off, abs, stk, stk%, sw/!sw, !m_sw/!m_sw
|
|
||||||
int16_t prev;
|
|
||||||
});
|
|
||||||
|
|
||||||
extern SwOn swOn[MAX_MIXERS];
|
|
||||||
extern int32_t act[MAX_MIXERS];
|
|
||||||
|
|
||||||
#if defined(BOLD_FONT)
|
#if defined(BOLD_FONT)
|
||||||
inline bool isExpoActive(uint8_t expo)
|
inline bool isExpoActive(uint8_t expo)
|
||||||
{
|
{
|
||||||
|
@ -1050,15 +984,6 @@ void setMFP();
|
||||||
void clearMFP();
|
void clearMFP();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern uint8_t requiredSpeakerVolume;
|
|
||||||
|
|
||||||
enum MainRequest {
|
|
||||||
REQUEST_SCREENSHOT,
|
|
||||||
REQUEST_FLIGHT_RESET,
|
|
||||||
};
|
|
||||||
|
|
||||||
extern uint8_t mainRequestFlags;
|
|
||||||
|
|
||||||
void checkBattery();
|
void checkBattery();
|
||||||
void opentxClose(uint8_t shutdown=true);
|
void opentxClose(uint8_t shutdown=true);
|
||||||
void opentxInit();
|
void opentxInit();
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include "opentx_helpers.h"
|
#include "opentx_helpers.h"
|
||||||
#include "telemetry/telemetry.h"
|
#include "telemetry/telemetry.h"
|
||||||
#include "storage/storage.h"
|
#include "storage/storage.h"
|
||||||
|
#include "globals.h"
|
||||||
|
|
||||||
#if defined(MULTIMODULE)
|
#if defined(MULTIMODULE)
|
||||||
#include "telemetry/multi.h"
|
#include "telemetry/multi.h"
|
||||||
|
@ -534,6 +535,14 @@ inline void setDefaultPpmFrameLength(uint8_t moduleIdx)
|
||||||
g_model.moduleData[moduleIdx].ppm.frameLength = 4 * max<int>(0, g_model.moduleData[moduleIdx].channelsCount);
|
g_model.moduleData[moduleIdx].ppm.frameLength = 4 * max<int>(0, g_model.moduleData[moduleIdx].channelsCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline void resetAccessAuthenticationCount()
|
||||||
|
{
|
||||||
|
#if defined(ACCESS_LIB)
|
||||||
|
// the module will reset on mode switch, we need to reset the authentication counter
|
||||||
|
globalData.authenticationCount = 0;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
inline void setModuleType(uint8_t moduleIdx, uint8_t moduleType)
|
inline void setModuleType(uint8_t moduleIdx, uint8_t moduleType)
|
||||||
{
|
{
|
||||||
ModuleData & moduleData = g_model.moduleData[moduleIdx];
|
ModuleData & moduleData = g_model.moduleData[moduleIdx];
|
||||||
|
@ -544,6 +553,8 @@ inline void setModuleType(uint8_t moduleIdx, uint8_t moduleType)
|
||||||
moduleData.sbus.refreshRate = -31;
|
moduleData.sbus.refreshRate = -31;
|
||||||
else if (moduleData.type == MODULE_TYPE_PPM)
|
else if (moduleData.type == MODULE_TYPE_PPM)
|
||||||
setDefaultPpmFrameLength(moduleIdx);
|
setDefaultPpmFrameLength(moduleIdx);
|
||||||
|
else
|
||||||
|
resetAccessAuthenticationCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
extern bool isExternalAntennaEnabled();
|
extern bool isExternalAntennaEnabled();
|
||||||
|
|
|
@ -308,9 +308,7 @@ static void enablePulsesInternalModule(uint8_t protocol)
|
||||||
#if defined(PXX2)
|
#if defined(PXX2)
|
||||||
case PROTOCOL_CHANNELS_PXX2_HIGHSPEED:
|
case PROTOCOL_CHANNELS_PXX2_HIGHSPEED:
|
||||||
intmoduleSerialStart(PXX2_HIGHSPEED_BAUDRATE, true, USART_Parity_No, USART_StopBits_1, USART_WordLength_8b);
|
intmoduleSerialStart(PXX2_HIGHSPEED_BAUDRATE, true, USART_Parity_No, USART_StopBits_1, USART_WordLength_8b);
|
||||||
#if defined(HARDWARE_INTERNAL_MODULE) && defined(INTERNAL_MODULE_PXX2) && defined(ACCESS_LIB)
|
resetAccessAuthenticationCount();
|
||||||
globalData.authenticationCount = 0;
|
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue