[X10] New radio supported!
This commit is contained in:
Bertrand Songis
2017-02-04 10:42:50 +01:00
committed by GitHub
parent ebee591990
commit 40ece81de2
79 changed files with 1947 additions and 1370 deletions
+20 -17
View File
@@ -520,7 +520,7 @@ int8_t getMovedSource(GET_MOVED_SOURCE_PARAMS)
static int16_t sourcesStates[NUM_STICKS+NUM_POTS+NUM_SLIDERS+NUM_MOUSE_ANALOGS];
if (result == 0) {
for (uint8_t i=0; i<NUM_STICKS+NUM_POTS+NUM_SLIDERS; i++) {
if (abs(calibratedStick[i] - sourcesStates[i]) > 512) {
if (abs(calibratedAnalogs[i] - sourcesStates[i]) > 512) {
result = MIXSRC_Rud+i;
break;
}
@@ -536,7 +536,7 @@ int8_t getMovedSource(GET_MOVED_SOURCE_PARAMS)
#if defined(VIRTUAL_INPUTS)
memcpy(inputsStates, anas, sizeof(inputsStates));
#endif
memcpy(sourcesStates, calibratedStick, sizeof(sourcesStates));
memcpy(sourcesStates, calibratedAnalogs, sizeof(sourcesStates));
}
s_move_last_time = get_tmr10ms();
@@ -1116,15 +1116,15 @@ void checkTHR()
// no other information available at the moment, and good enough to my option (otherwise too much exceptions...)
#if defined(MODULE_ALWAYS_SEND_PULSES)
int16_t v = calibratedStick[thrchn];
int16_t v = calibratedAnalogs[thrchn];
if (v<=THRCHK_DEADBAND-1024 || g_model.disableThrottleWarning || pwrCheck()==e_power_off || keyDown()) {
startupWarningState = STARTUP_WARNING_THROTTLE+1;
}
else {
calibratedStick[thrchn] = -1024;
calibratedAnalogs[thrchn] = -1024;
#if !defined(VIRTUAL_INPUTS)
if (thrchn < NUM_STICKS) {
rawAnas[thrchn] = anas[thrchn] = calibratedStick[thrchn];
rawAnas[thrchn] = anas[thrchn] = calibratedAnalogs[thrchn];
}
#endif
RAISE_ALERT(STR_THROTTLEWARN, STR_THROTTLENOTIDLE, STR_PRESSANYKEYTOSKIP, AU_THROTTLE_ALERT);
@@ -1138,7 +1138,7 @@ void checkTHR()
evalInputs(e_perout_mode_notrainer); // let do evalInputs do the job
int16_t v = calibratedStick[thrchn];
int16_t v = calibratedAnalogs[thrchn];
if (v <= THRCHK_DEADBAND-1024) {
return; // prevent warning if throttle input OK
}
@@ -1157,7 +1157,7 @@ void checkTHR()
evalInputs(e_perout_mode_notrainer); // let do evalInputs do the job
v = calibratedStick[thrchn];
v = calibratedAnalogs[thrchn];
#if defined(PWR_BUTTON_DELAY)
uint32_t pwr_check = pwrCheck();
@@ -1371,7 +1371,7 @@ uint8_t checkTrim(event_t event)
}
#if !defined(SIMU)
uint16_t s_anaFilt[NUMBER_ANALOG];
uint16_t s_anaFilt[NUM_ANALOGS];
#endif
#if defined(SIMU)
@@ -1387,8 +1387,8 @@ uint16_t BandGap;
#endif
#if defined(JITTER_MEASURE)
JitterMeter<uint16_t> rawJitter[NUMBER_ANALOG];
JitterMeter<uint16_t> avgJitter[NUMBER_ANALOG];
JitterMeter<uint16_t> rawJitter[NUM_ANALOGS];
JitterMeter<uint16_t> avgJitter[NUM_ANALOGS];
tmr10ms_t jitterResetTime = 0;
#endif
@@ -1440,7 +1440,7 @@ void getADC()
#if defined(JITTER_MEASURE)
if (JITTER_MEASURE_ACTIVE() && jitterResetTime < get_tmr10ms()) {
// reset jitter measurement every second
for (uint32_t x=0; x<NUMBER_ANALOG; x++) {
for (uint32_t x=0; x<NUM_ANALOGS; x++) {
rawJitter[x].reset();
avgJitter[x].reset();
}
@@ -1452,7 +1452,7 @@ void getADC()
adcRead();
DEBUG_TIMER_STOP(debugTimerAdcRead);
for (uint8_t x=0; x<NUMBER_ANALOG; x++) {
for (uint8_t x=0; x<NUM_ANALOGS; x++) {
uint16_t v = getAnalogValue(x) >> (1 - ANALOG_SCALE);
#if defined(VIRTUAL_INPUTS)
@@ -1706,9 +1706,9 @@ void doMixerCalculations()
}
else {
#if defined(VIRTUAL_INPUTS)
val = RESX + calibratedStick[g_model.thrTraceSrc == 0 ? THR_STICK : g_model.thrTraceSrc+NUM_STICKS-1];
val = RESX + calibratedAnalogs[g_model.thrTraceSrc == 0 ? THR_STICK : g_model.thrTraceSrc+NUM_STICKS-1];
#else
val = RESX + (g_model.thrTraceSrc == 0 ? rawAnas[THR_STICK] : calibratedStick[g_model.thrTraceSrc+NUM_STICKS-1]);
val = RESX + (g_model.thrTraceSrc == 0 ? rawAnas[THR_STICK] : calibratedAnalogs[g_model.thrTraceSrc+NUM_STICKS-1]);
#endif
}
@@ -1822,7 +1822,7 @@ uint8_t calcStickScroll( uint8_t index )
if ( ( g_eeGeneral.stickMode & 1 ) == 0 )
index ^= 3;
value = calibratedStick[index] / 128;
value = calibratedAnalogs[index] / 128;
direction = value > 0 ? 0x80 : 0;
if (value < 0)
value = -value; // (abs)
@@ -2522,7 +2522,7 @@ void opentxInit(OPENTX_INIT_ARGS)
setSticksGain(g_eeGeneral.sticksGain);
#endif
#if defined(BLUETOOTH)
#if defined(PCBSKY9X) && defined(BLUETOOTH)
btInit();
#endif
@@ -2531,7 +2531,10 @@ void opentxInit(OPENTX_INIT_ARGS)
loadFontCache();
#endif
if (g_eeGeneral.backlightMode != e_backlight_mode_off) backlightOn(); // on Tx start turn the light on
if (g_eeGeneral.backlightMode != e_backlight_mode_off) {
// on Tx start turn the light on
backlightOn();
}
if (!unexpectedShutdown) {
opentxStart();