mirror of
https://github.com/opentx/opentx.git
synced 2025-07-23 16:25:16 +03:00
renamed g_ppmInXXX into ppmInputXXX
g_ppmIns -> ppmInput g_ppmInputValidityTimer -> ppmInputValidityTimer
This commit is contained in:
parent
3049ff768e
commit
ebae27272e
9 changed files with 26 additions and 26 deletions
|
@ -108,7 +108,7 @@ return main_thread_error;
|
|||
|
||||
#ifdef SETTRAINER_IMPORT
|
||||
#undef SETTRAINER_IMPORT
|
||||
ppmInValid = 100;
|
||||
g_ppmIns[inputNumber] = LIMIT< ::int16_t>(-512, value, 512);
|
||||
ppmInputValidityTimer = 100;
|
||||
ppmInput[inputNumber] = LIMIT< ::int16_t>(-512, value, 512);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -97,15 +97,15 @@ void menuGeneralTrainer(uint8_t event)
|
|||
for (uint8_t i=0; i<4; i++) {
|
||||
uint8_t x = (i*TRAINER_CALIB_POS+16)*FW/2;
|
||||
#if defined (PPM_UNIT_PERCENT_PREC1)
|
||||
lcd_outdezAtt(x, MENU_HEADER_HEIGHT+1+6*FH, (g_ppmIns[i]-g_eeGeneral.trainer.calib[i])*2, PREC1);
|
||||
lcd_outdezAtt(x, MENU_HEADER_HEIGHT+1+6*FH, (ppmInput[i]-g_eeGeneral.trainer.calib[i])*2, PREC1);
|
||||
#else
|
||||
lcd_outdezAtt(x, MENU_HEADER_HEIGHT+1+6*FH, (g_ppmIns[i]-g_eeGeneral.trainer.calib[i])/5, 0);
|
||||
lcd_outdezAtt(x, MENU_HEADER_HEIGHT+1+6*FH, (ppmInput[i]-g_eeGeneral.trainer.calib[i])/5, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (attr) {
|
||||
if (event==EVT_KEY_LONG(KEY_ENTER)){
|
||||
memcpy(g_eeGeneral.trainer.calib, g_ppmIns, sizeof(g_eeGeneral.trainer.calib));
|
||||
memcpy(g_eeGeneral.trainer.calib, ppmInput, sizeof(g_eeGeneral.trainer.calib));
|
||||
eeDirty(EE_GENERAL);
|
||||
AUDIO_WARNING1();
|
||||
}
|
||||
|
|
|
@ -99,15 +99,15 @@ void menuGeneralTrainer(uint8_t event)
|
|||
for (int i=0; i<4; i++) {
|
||||
uint8_t x = (i*TRAINER_CALIB_POS+16)*FW/2;
|
||||
#if defined (PPM_UNIT_PERCENT_PREC1)
|
||||
lcd_outdezAtt(x, MENU_HEADER_HEIGHT+1+6*FH, (g_ppmIns[i]-g_eeGeneral.trainer.calib[i])*2, PREC1);
|
||||
lcd_outdezAtt(x, MENU_HEADER_HEIGHT+1+6*FH, (ppmInput[i]-g_eeGeneral.trainer.calib[i])*2, PREC1);
|
||||
#else
|
||||
lcd_outdezAtt(x, MENU_HEADER_HEIGHT+1+6*FH, (g_ppmIns[i]-g_eeGeneral.trainer.calib[i])/5, 0);
|
||||
lcd_outdezAtt(x, MENU_HEADER_HEIGHT+1+6*FH, (ppmInput[i]-g_eeGeneral.trainer.calib[i])/5, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (attr) {
|
||||
if (event==EVT_KEY_LONG(KEY_ENTER)){
|
||||
memcpy(g_eeGeneral.trainer.calib, g_ppmIns, sizeof(g_eeGeneral.trainer.calib));
|
||||
memcpy(g_eeGeneral.trainer.calib, ppmInput, sizeof(g_eeGeneral.trainer.calib));
|
||||
eeDirty(EE_GENERAL);
|
||||
AUDIO_WARNING1();
|
||||
}
|
||||
|
|
|
@ -293,7 +293,7 @@ getvalue_t getValue(mixsrc_t i)
|
|||
else if (i<MIXSRC_SW1) return getSwitch(SWSRC_THR+i-MIXSRC_THR) ? 1024 : -1024;
|
||||
#endif
|
||||
else if (i<=MIXSRC_LAST_LOGICAL_SWITCH) return getSwitch(SWSRC_FIRST_LOGICAL_SWITCH+i-MIXSRC_FIRST_LOGICAL_SWITCH) ? 1024 : -1024;
|
||||
else if (i<=MIXSRC_LAST_TRAINER) { int16_t x = g_ppmIns[i-MIXSRC_FIRST_TRAINER]; if (i<MIXSRC_FIRST_TRAINER+NUM_CAL_PPM) { x-= g_eeGeneral.trainer.calib[i-MIXSRC_FIRST_TRAINER]; } return x*2; }
|
||||
else if (i<=MIXSRC_LAST_TRAINER) { int16_t x = ppmInput[i-MIXSRC_FIRST_TRAINER]; if (i<MIXSRC_FIRST_TRAINER+NUM_CAL_PPM) { x-= g_eeGeneral.trainer.calib[i-MIXSRC_FIRST_TRAINER]; } return x*2; }
|
||||
else if (i<=MIXSRC_LAST_CH) return ex_chans[i-MIXSRC_CH1];
|
||||
|
||||
#if defined(GVARS)
|
||||
|
@ -460,7 +460,7 @@ void evalInputs(uint8_t mode)
|
|||
TrainerMix* td = &g_eeGeneral.trainer.mix[ch];
|
||||
if (td->mode) {
|
||||
uint8_t chStud = td->srcChn;
|
||||
int32_t vStud = (g_ppmIns[chStud]- g_eeGeneral.trainer.calib[chStud]);
|
||||
int32_t vStud = (ppmInput[chStud]- g_eeGeneral.trainer.calib[chStud]);
|
||||
vStud *= td->studWeight;
|
||||
vStud /= 50;
|
||||
switch (td->mode) {
|
||||
|
|
|
@ -155,7 +155,7 @@ void per10ms()
|
|||
#endif
|
||||
|
||||
if (trimsCheckTimer) trimsCheckTimer--;
|
||||
if (g_ppmInputValidityTimer) g_ppmInputValidityTimer--;
|
||||
if (ppmInputValidityTimer) ppmInputValidityTimer--;
|
||||
|
||||
#if defined(CPUARM)
|
||||
if (trimsDisplayTimer)
|
||||
|
|
|
@ -87,7 +87,7 @@ void processSbusFrame(uint8_t *sbus, int16_t *pulses, uint32_t size)
|
|||
inputbits >>= SBUS_CH_BITS;
|
||||
}
|
||||
|
||||
g_ppmInputValidityTimer = PPM_IN_VALID_TIMEOUT;
|
||||
ppmInputValidityTimer = PPM_IN_VALID_TIMEOUT;
|
||||
}
|
||||
|
||||
void processSbusInput()
|
||||
|
@ -108,7 +108,7 @@ void processSbusInput()
|
|||
else {
|
||||
if (SbusIndex) {
|
||||
if ((uint16_t) (getTmr2MHz() - SbusTimer) > SBUS_FRAME_GAP_DELAY) {
|
||||
processSbusFrame(SbusFrame, g_ppmIns, SbusIndex);
|
||||
processSbusFrame(SbusFrame, ppmInput, SbusIndex);
|
||||
SbusIndex = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1019,7 +1019,7 @@ TEST(Trainer, UnpluggedTest)
|
|||
g_model.mixData[0].weight = 100;
|
||||
g_model.mixData[0].delayUp = DELAY_STEP*5;
|
||||
g_model.mixData[0].delayDown = DELAY_STEP*5;
|
||||
g_ppmInputValidityTimer = 0;
|
||||
g_ppmIns[0] = 1024;
|
||||
ppmInputValidityTimer = 0;
|
||||
ppmInput[0] = 1024;
|
||||
CHECK_DELAY(0, 5000);
|
||||
}
|
||||
|
|
|
@ -36,8 +36,8 @@
|
|||
|
||||
#include "trainer_input.h"
|
||||
|
||||
int16_t g_ppmIns[NUM_TRAINER];
|
||||
uint8_t g_ppmInputValidityTimer;
|
||||
int16_t ppmInput[NUM_TRAINER];
|
||||
uint8_t ppmInputValidityTimer;
|
||||
|
||||
|
||||
#if defined(CPUARM)
|
||||
|
@ -53,14 +53,14 @@ void checkTrainerSignalWarning()
|
|||
|
||||
static uint8_t ppmInputValidState = PPM_IN_IS_NOT_USED;
|
||||
|
||||
if(g_ppmInputValidityTimer && (ppmInputValidState == PPM_IN_IS_NOT_USED)) {
|
||||
if(ppmInputValidityTimer && (ppmInputValidState == PPM_IN_IS_NOT_USED)) {
|
||||
ppmInputValidState = PPM_IN_IS_VALID;
|
||||
}
|
||||
else if (!g_ppmInputValidityTimer && (ppmInputValidState == PPM_IN_IS_VALID)) {
|
||||
else if (!ppmInputValidityTimer && (ppmInputValidState == PPM_IN_IS_VALID)) {
|
||||
ppmInputValidState = PPM_IN_INVALID;
|
||||
AUDIO_TRAINER_LOST();
|
||||
}
|
||||
else if (g_ppmInputValidityTimer && (ppmInputValidState == PPM_IN_INVALID)) {
|
||||
else if (ppmInputValidityTimer && (ppmInputValidState == PPM_IN_INVALID)) {
|
||||
ppmInputValidState = PPM_IN_IS_VALID;
|
||||
AUDIO_TRAINER_BACK();
|
||||
}
|
||||
|
|
|
@ -40,13 +40,13 @@
|
|||
#include "myeeprom.h"
|
||||
|
||||
// Trainer input channels
|
||||
extern int16_t g_ppmIns[NUM_TRAINER];
|
||||
extern int16_t ppmInput[NUM_TRAINER];
|
||||
|
||||
// Timer gets decremented in per10ms()
|
||||
#define PPM_IN_VALID_TIMEOUT 100 // 1s
|
||||
extern uint8_t g_ppmInputValidityTimer;
|
||||
extern uint8_t ppmInputValidityTimer;
|
||||
|
||||
#define IS_TRAINER_INPUT_VALID() (g_ppmInputValidityTimer != 0)
|
||||
#define IS_TRAINER_INPUT_VALID() (ppmInputValidityTimer != 0)
|
||||
|
||||
#if defined(CPUARM)
|
||||
void checkTrainerSignalWarning();
|
||||
|
@ -63,7 +63,7 @@ inline void captureTrainerPulses(uint16_t capture)
|
|||
uint16_t val = (uint16_t)(capture - lastCapt) / 2;
|
||||
lastCapt = capture;
|
||||
|
||||
// We process g_ppmInsright here to make servo movement as smooth as possible
|
||||
// We process ppmInput right here to make servo movement as smooth as possible
|
||||
// while under trainee control
|
||||
//
|
||||
// G: Prioritize reset pulse. (Needed when less than 16 incoming pulses)
|
||||
|
@ -74,8 +74,8 @@ inline void captureTrainerPulses(uint16_t capture)
|
|||
else {
|
||||
if ((channelNumber > 0) && (channelNumber <= NUM_TRAINER)) {
|
||||
if (val>800 && val<2200) {
|
||||
g_ppmInputValidityTimer = PPM_IN_VALID_TIMEOUT;
|
||||
g_ppmIns[channelNumber++ - 1] =
|
||||
ppmInputValidityTimer = PPM_IN_VALID_TIMEOUT;
|
||||
ppmInput[channelNumber++ - 1] =
|
||||
//+-500 != 512, but close enough.
|
||||
(int16_t)(val - 1500)*(g_eeGeneral.PPM_Multiplier+10)/10;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue