Merge remote-tracking branch 'upstream/next' into internalPPM_2306
Conflicts: radio/src/gui/Taranis/menu_model_setup.cpp radio/src/myeeprom.h radio/src/opentx.h
This commit is contained in:
+28
-7
@@ -57,6 +57,10 @@ PCB = 9X
|
||||
# PCB revision
|
||||
PCBREV =
|
||||
|
||||
# LCD
|
||||
# Values: DEFAULT, ST7565P, ST7565R, ERC12864FSF, ST7920
|
||||
LCD = DEFAULT
|
||||
|
||||
# Enable JETI-Telemetry or FrSky Telemetry reception on UART0
|
||||
# For this option you need to modify your hardware!
|
||||
# More information at [insertURLhere]
|
||||
@@ -443,7 +447,12 @@ ifeq ($(PCB), $(filter $(PCB), STD 9X 9XR))
|
||||
ifeq ($(AUDIO), YES)
|
||||
CPPDEFS += -DAUDIO
|
||||
CPPSRC += audio_avr.cpp
|
||||
BUZZER = NO
|
||||
else
|
||||
BUZZER = YES
|
||||
endif
|
||||
|
||||
ifeq ($(BUZZER), YES)
|
||||
CPPDEFS += -DBUZZER
|
||||
CPPSRC += buzzer.cpp
|
||||
endif
|
||||
@@ -517,7 +526,12 @@ ifeq ($(PCB), $(filter $(PCB), STD128 9X128 9XR128))
|
||||
ifeq ($(AUDIO), YES)
|
||||
CPPDEFS += -DAUDIO
|
||||
CPPSRC += audio_avr.cpp
|
||||
BUZZER = NO
|
||||
else
|
||||
BUZZER = YES
|
||||
endif
|
||||
|
||||
ifeq ($(BUZZER), YES)
|
||||
CPPDEFS += -DBUZZER
|
||||
CPPSRC += buzzer.cpp
|
||||
endif
|
||||
@@ -579,7 +593,12 @@ ifeq ($(PCB), $(filter $(PCB), 9X2561))
|
||||
ifeq ($(AUDIO), YES)
|
||||
CPPDEFS += -DAUDIO
|
||||
CPPSRC += audio_avr.cpp
|
||||
BUZZER = NO
|
||||
else
|
||||
BUZZER = YES
|
||||
endif
|
||||
|
||||
ifeq ($(BUZZER), YES)
|
||||
CPPDEFS += -DBUZZER
|
||||
CPPSRC += buzzer.cpp
|
||||
endif
|
||||
@@ -680,13 +699,7 @@ ifeq ($(PCB), MEGA2560)
|
||||
BITMAPS += bitmaps/9X/splash.lbm bitmaps/9X/asterisk.lbm bitmaps/9X/about.lbm
|
||||
GUIGENERALSRC += gui/$(GUIDIRECTORY)/menu_general_diagkeys.cpp gui/$(GUIDIRECTORY)/menu_general_diaganas.cpp
|
||||
|
||||
# LCD driver
|
||||
# Values: ST7565P(default), ST7565R
|
||||
LCD = ST7565P
|
||||
ifeq ($(LCD), ST7565R)
|
||||
CPPDEFS += -DLCD_ST7565R
|
||||
endif
|
||||
EXTRABOARDSRC = targets/common_avr/adc_driver.cpp targets/stock/lcd_driver.cpp targets/common_avr/telemetry_driver.cpp
|
||||
EXTRABOARDSRC = targets/common_avr/adc_driver.cpp targets/stock/lcd_driver.cpp targets/common_avr/telemetry_driver.cpp
|
||||
|
||||
ifeq ($(SDCARD), YES)
|
||||
EXTRABOARDSRC += $(FATFSDIR)/ff.c $(FATFSDIR)/fattime.c $(FATFSDIR)/option/ccsbcs.c targets/gruvin9x/diskio.cpp
|
||||
@@ -1071,6 +1084,14 @@ ifeq ($(TURNIGY_TRANSMITTER_FIX), YES)
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(LCD), ST7565R)
|
||||
CPPDEFS += -DLCD_ST7565R
|
||||
else ifeq ($(LCD), ERC12864FSF)
|
||||
CPPDEFS += -DLCD_ERC12864FSF
|
||||
else ifeq ($(LCD), ST7920)
|
||||
CPPDEFS += -DLCD_ST7920
|
||||
endif
|
||||
|
||||
ifeq ($(AUTOSWITCH), YES)
|
||||
CPPDEFS += -DAUTOSWITCH
|
||||
endif
|
||||
|
||||
+46
-5
@@ -37,6 +37,7 @@
|
||||
#ifndef BUZZER_H
|
||||
#define BUZZER_H
|
||||
|
||||
#if defined(BUZZER)
|
||||
extern uint8_t g_beepCnt;
|
||||
extern uint8_t beepAgain;
|
||||
extern uint8_t beepAgainOrig;
|
||||
@@ -45,23 +46,31 @@ extern bool warble;
|
||||
extern bool warbleC;
|
||||
#if defined(HAPTIC)
|
||||
extern uint8_t hapticTick;
|
||||
#endif
|
||||
#endif /* HAPTIC */
|
||||
#endif /* BUZZER */
|
||||
|
||||
#if defined(BUZZER)
|
||||
|
||||
#if defined(CPUARM) && !defined(SIMU)
|
||||
inline void _beep(uint8_t b)
|
||||
{
|
||||
buzzerSound(b);
|
||||
}
|
||||
#else
|
||||
#else /* CPUARM && !SIMU */
|
||||
inline void _beep(uint8_t b)
|
||||
{
|
||||
g_beepCnt = b;
|
||||
}
|
||||
#endif
|
||||
#endif /* CPUARM && !SIMU */
|
||||
|
||||
void beep(uint8_t val);
|
||||
#else /* BUZZER */
|
||||
#define beep(...)
|
||||
#endif /* BUZZER */
|
||||
|
||||
#if !defined(AUDIO)
|
||||
|
||||
#if defined(BUZZER)
|
||||
#if defined(VOICE)
|
||||
#define AUDIO_TADA() PUSH_SYSTEM_PROMPT(AU_TADA)
|
||||
#define AUDIO_BYE()
|
||||
@@ -100,6 +109,34 @@ void beep(uint8_t val);
|
||||
#define AUDIO_PLAY(p) beep(3)
|
||||
|
||||
#define IS_AUDIO_BUSY() (g_beepCnt || beepAgain || beepOn)
|
||||
#else /* BUZZER */
|
||||
#define AUDIO_TADA()
|
||||
#define AUDIO_BYE()
|
||||
#define AUDIO_TX_BATTERY_LOW()
|
||||
#define AUDIO_INACTIVITY()
|
||||
#define AUDIO_ERROR_MESSAGE(e)
|
||||
#define AUDIO_TIMER_MINUTE(t)
|
||||
#define AUDIO_TIMER_30()
|
||||
#define AUDIO_TIMER_20()
|
||||
#define AUDIO_KEYPAD_UP()
|
||||
#define AUDIO_KEYPAD_DOWN()
|
||||
#define AUDIO_MENUS()
|
||||
#define AUDIO_WARNING2()
|
||||
#define AUDIO_WARNING1()
|
||||
#define AUDIO_ERROR()
|
||||
#define AUDIO_MIX_WARNING(x)
|
||||
#define AUDIO_POT_MIDDLE()
|
||||
#define AUDIO_TIMER_LT10(m, x)
|
||||
#define AUDIO_TIMER_00(m)
|
||||
#define AUDIO_VARIO_UP()
|
||||
#define AUDIO_VARIO_DOWN()
|
||||
#define AUDIO_TRIM(event, f)
|
||||
#define AUDIO_TRIM_MIDDLE(f)
|
||||
#define AUDIO_TRIM_END(f)
|
||||
#define AUDIO_PLAY(p)
|
||||
#define IS_AUDIO_BUSY() false
|
||||
#endif /* BUZZER */
|
||||
|
||||
#define AUDIO_RESET()
|
||||
#define AUDIO_FLUSH()
|
||||
|
||||
@@ -109,9 +146,10 @@ void beep(uint8_t val);
|
||||
#define PLAY_LOGICAL_SWITCH_OFF(sw)
|
||||
#define PLAY_LOGICAL_SWITCH_ON(sw)
|
||||
#define START_SILENCE_PERIOD()
|
||||
#endif
|
||||
#endif /* !AUDIO */
|
||||
|
||||
#if !defined(CPUARM)
|
||||
#if defined(BUZZER)
|
||||
inline void BUZZER_HEARTBEAT()
|
||||
{
|
||||
if (g_beepCnt) {
|
||||
@@ -145,6 +183,9 @@ inline void BUZZER_HEARTBEAT()
|
||||
buzzerOff();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#else // BUZZER
|
||||
#define BUZZER_HEARTBEAT()
|
||||
#endif // BUZZER
|
||||
#endif // CPUARM
|
||||
|
||||
#endif
|
||||
|
||||
@@ -526,49 +526,21 @@ PACK(typedef struct { // Swash Ring data
|
||||
}) SwashRingData_v215;
|
||||
|
||||
PACK(typedef struct {
|
||||
ModelHeader header;
|
||||
TimerData_v215 timers[2];
|
||||
uint8_t protocol:3;
|
||||
uint8_t thrTrim:1; // Enable Throttle Trim
|
||||
int8_t ppmNCH:4;
|
||||
uint8_t trimInc:3; // Trim Increments
|
||||
uint8_t disableThrottleWarning:1;
|
||||
uint8_t pulsePol:1;
|
||||
uint8_t extendedLimits:1;
|
||||
uint8_t extendedTrims:1;
|
||||
uint8_t throttleReversed:1;
|
||||
int8_t ppmDelay;
|
||||
BeepANACenter beepANACenter; // 1<<0->A1.. 1<<6->A7
|
||||
MixData_v215 mixData[MAX_MIXERS];
|
||||
LimitData_v215 limitData[NUM_CHNOUT];
|
||||
ExpoData_v215 expoData[32];
|
||||
|
||||
int16_t curves[16];
|
||||
int8_t points[NUM_POINTS];
|
||||
|
||||
LogicalSwitchData_v215 logicalSw[NUM_LOGICAL_SWITCH];
|
||||
CustomFunctionData_v215 customFn[32];
|
||||
SwashRingData_v215 swashR;
|
||||
FlightModeData_v215 flightModeData[MAX_FLIGHT_MODES];
|
||||
|
||||
int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5ms increments
|
||||
uint8_t thrTraceSrc;
|
||||
|
||||
swarnstate_t switchWarningState;
|
||||
|
||||
char gvar_names[5][LEN_GVAR_NAME];
|
||||
|
||||
FrSkyData_v215 frsky;
|
||||
|
||||
MODELDATA_EXTRA
|
||||
|
||||
}) ModelData_v215;
|
||||
int8_t rfProtocol;
|
||||
uint8_t channelsStart;
|
||||
int8_t channelsCount; // 0=8 channels
|
||||
uint8_t failsafeMode;
|
||||
int16_t failsafeChannels[NUM_CHNOUT];
|
||||
int8_t ppmDelay;
|
||||
int8_t ppmFrameLength;
|
||||
uint8_t ppmPulsePol;
|
||||
}) ModuleData_v216;
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
#define MODELDATA_EXTRA_216 \
|
||||
uint8_t externalModule; \
|
||||
uint8_t trainerMode; \
|
||||
ModuleData moduleData[NUM_MODULES+1]; \
|
||||
ModuleData_v216 moduleData[NUM_MODULES+1]; \
|
||||
char curveNames[MAX_CURVES][6]; \
|
||||
ScriptData_v216 scriptsData[MAX_SCRIPTS]; \
|
||||
char inputNames[MAX_INPUTS][LEN_INPUT_NAME]; \
|
||||
@@ -578,14 +550,27 @@ PACK(typedef struct {
|
||||
#elif defined(PCBSKY9X)
|
||||
#define MODELDATA_EXTRA_216 \
|
||||
uint8_t externalModule; \
|
||||
ModuleData moduleData[NUM_MODULES+1]; \
|
||||
ModuleData_v216 moduleData[NUM_MODULES+1]; \
|
||||
uint8_t nPotsToWarn; \
|
||||
int8_t potPosition[NUM_POTS]; \
|
||||
uint8_t rxBattAlarms[2];
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
PACK(typedef struct {
|
||||
ModelHeader header;
|
||||
char name[LEN_MODEL_NAME];
|
||||
uint8_t modelId;
|
||||
char bitmap[LEN_BITMAP_NAME];
|
||||
}) ModelHeader_v216;
|
||||
#else
|
||||
PACK(typedef struct {
|
||||
char name[LEN_MODEL_NAME];
|
||||
uint8_t modelId;
|
||||
}) ModelHeader_v216;
|
||||
#endif
|
||||
|
||||
PACK(typedef struct {
|
||||
ModelHeader_v216 header;
|
||||
TimerData_v216 timers[2];
|
||||
AVR_FIELD(uint8_t protocol:3)
|
||||
ARM_FIELD(uint8_t telemetryProtocol:3)
|
||||
@@ -885,433 +870,6 @@ int16_t ConvertGVAR_215_to_216(int16_t var)
|
||||
return var;
|
||||
}
|
||||
|
||||
void ConvertModel_215_to_216(ModelData &model)
|
||||
{
|
||||
// Virtual inputs added instead of Expo/DR
|
||||
// LUA scripts added
|
||||
// GVARS: now 9 GVARS, popup param added
|
||||
// Curves: structure changed, 32 curves
|
||||
// Limits: min and max with PREC1
|
||||
// Custom Functions: play repeat * 5
|
||||
// Logical Switches: better precision for x when A comes from telemetry
|
||||
// Main View: altitude in top bar
|
||||
// Mixes: GVARS in weight moved from 512 to 4096 and -512 to -4096, because GVARS may be used in limits [-1250:1250]
|
||||
// Switches: two 6-pos pots added, REa added to Sky9x
|
||||
|
||||
assert(sizeof(ModelData_v215) <= sizeof(ModelData));
|
||||
|
||||
ModelData_v215 oldModel;
|
||||
memcpy(&oldModel, &model, sizeof(oldModel));
|
||||
ModelData_v216 &newModel = *(ModelData_v216*)&model;
|
||||
memset(&newModel, 0, sizeof(ModelData_v216));
|
||||
|
||||
char name[LEN_MODEL_NAME+1];
|
||||
zchar2str(name, oldModel.header.name, LEN_MODEL_NAME);
|
||||
TRACE("Model %s conversion from v215 to v216", name);
|
||||
|
||||
memcpy(&newModel.header, &oldModel.header, sizeof(newModel.header));
|
||||
for (uint8_t i=0; i<2; i++) {
|
||||
TimerData_v216 & timer = newModel.timers[i];
|
||||
if (oldModel.timers[i].mode >= TMRMODE_COUNT)
|
||||
timer.mode = TMRMODE_COUNT + ConvertSwitch_215_to_216(oldModel.timers[i].mode - TMRMODE_COUNT + 1) - 1;
|
||||
else
|
||||
timer.mode = oldModel.timers[i].mode;
|
||||
timer.start = oldModel.timers[i].start;
|
||||
timer.minuteBeep = oldModel.timers[i].minuteBeep;
|
||||
timer.persistent = oldModel.timers[i].persistent;
|
||||
timer.countdownBeep = oldModel.timers[i].countdownBeep;
|
||||
timer.value = oldModel.timers[i].value;
|
||||
}
|
||||
newModel.thrTrim = oldModel.thrTrim;
|
||||
newModel.trimInc = oldModel.trimInc - 2;
|
||||
newModel.disableThrottleWarning = oldModel.disableThrottleWarning;
|
||||
newModel.extendedLimits = oldModel.extendedLimits;
|
||||
newModel.extendedTrims = oldModel.extendedTrims;
|
||||
newModel.throttleReversed = oldModel.throttleReversed;
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
newModel.beepANACenter = (oldModel.beepANACenter & 0x3f) | ((oldModel.beepANACenter & 0xc0) << 1);
|
||||
#else
|
||||
newModel.beepANACenter = oldModel.beepANACenter;
|
||||
#endif
|
||||
|
||||
for (uint8_t i=0; i<64; i++) {
|
||||
MixData_v216 * mix = &newModel.mixData[i];
|
||||
MixData_v215 * oldMix = &oldModel.mixData[i];
|
||||
#if defined(PCBTARANIS)
|
||||
mix->destCh = oldMix->destCh;
|
||||
mix->flightModes = oldMix->flightModes;
|
||||
mix->mltpx = oldMix->mltpx;
|
||||
if (oldMix->carryTrim == TRIM_OFF) mix->carryTrim = TRIM_OFF;
|
||||
mix->weight = ConvertGVAR_215_to_216(oldMix->weight);
|
||||
mix->swtch = ConvertSwitch_215_to_216(oldMix->swtch);
|
||||
if (oldMix->curveMode==0/*differential*/) {
|
||||
mix->curve.type = CURVE_REF_DIFF;
|
||||
mix->curve.value = oldMix->curveParam;
|
||||
}
|
||||
else if (oldMix->curveParam <= 6) {
|
||||
mix->curve.type = CURVE_REF_FUNC;
|
||||
mix->curve.value = oldMix->curveParam;
|
||||
}
|
||||
else {
|
||||
mix->curve.type = CURVE_REF_CUSTOM;
|
||||
mix->curve.value = oldMix->curveParam - 6;
|
||||
}
|
||||
mix->mixWarn = oldMix->mixWarn;
|
||||
mix->delayUp = oldMix->delayUp;
|
||||
mix->delayDown = oldMix->delayDown;
|
||||
mix->speedUp = oldMix->speedUp;
|
||||
mix->speedDown = oldMix->speedDown;
|
||||
mix->srcRaw = oldMix->srcRaw;
|
||||
if (mix->srcRaw > 4 || oldMix->noExpo)
|
||||
mix->srcRaw = ConvertSource_215_to_216(mix->srcRaw);
|
||||
mix->offset = ConvertGVAR_215_to_216(oldMix->offset);
|
||||
memcpy(mix->name, oldMix->name, LEN_EXPOMIX_NAME);
|
||||
if (!GV_IS_GV_VALUE(mix->weight, 500, 500) && !GV_IS_GV_VALUE(mix->offset, 500, 500)) {
|
||||
mix->offset = divRoundClosest(mix->offset * mix->weight, 100);
|
||||
}
|
||||
#else
|
||||
mix->destCh = oldMix->destCh;
|
||||
mix->mixWarn = oldMix->mixWarn;
|
||||
mix->flightModes = oldMix->flightModes;
|
||||
mix->curveMode = oldMix->curveMode;
|
||||
mix->noExpo = oldMix->noExpo;
|
||||
mix->carryTrim = oldMix->carryTrim;
|
||||
mix->mltpx = oldMix->mltpx;
|
||||
mix->weight = oldMix->weight;
|
||||
mix->swtch = ConvertSwitch_215_to_216(oldMix->swtch);
|
||||
mix->curveParam = oldMix->curveParam;
|
||||
mix->delayUp = oldMix->delayUp;
|
||||
mix->delayDown = oldMix->delayDown;
|
||||
mix->speedUp = oldMix->speedUp;
|
||||
mix->speedDown = oldMix->speedDown;
|
||||
mix->srcRaw = ConvertSource_215_to_216(oldMix->srcRaw);
|
||||
mix->offset = oldMix->offset;
|
||||
memcpy(mix->name, oldMix->name, LEN_EXPOMIX_NAME);
|
||||
#endif
|
||||
}
|
||||
for (uint8_t i=0; i<32; i++) {
|
||||
#if defined(PCBTARANIS)
|
||||
newModel.limitData[i].min = 10 * oldModel.limitData[i].min;
|
||||
newModel.limitData[i].max = 10 * oldModel.limitData[i].max;
|
||||
#else
|
||||
newModel.limitData[i].min = oldModel.limitData[i].min;
|
||||
newModel.limitData[i].max = oldModel.limitData[i].max;
|
||||
#endif
|
||||
newModel.limitData[i].ppmCenter = oldModel.limitData[i].ppmCenter;
|
||||
newModel.limitData[i].offset = oldModel.limitData[i].offset;
|
||||
newModel.limitData[i].symetrical = oldModel.limitData[i].symetrical;
|
||||
newModel.limitData[i].revert = oldModel.limitData[i].revert;
|
||||
#if defined(PCBTARANIS)
|
||||
memcpy(newModel.limitData[i].name, oldModel.limitData[i].name, LEN_CHANNEL_NAME);
|
||||
#endif
|
||||
}
|
||||
#if defined(PCBTARANIS)
|
||||
int indexes[NUM_STICKS] = { 0, 0, 0, 0 };
|
||||
#endif
|
||||
for (uint8_t i=0; i<32; i++) {
|
||||
ExpoData_v216 * expo = &newModel.expoData[i];
|
||||
ExpoData_v215 * oldExpo = &oldModel.expoData[i];
|
||||
if (oldExpo->mode) {
|
||||
#if defined(PCBTARANIS)
|
||||
uint8_t chn = oldExpo->chn;
|
||||
if (!oldExpo->swtch && !oldExpo->flightModes) {
|
||||
indexes[chn] = -1;
|
||||
}
|
||||
else if (indexes[chn] != -1) {
|
||||
indexes[chn] = i+1;
|
||||
}
|
||||
for (uint8_t j=chn+1; j<NUM_STICKS; j++) {
|
||||
indexes[j] = i+1;
|
||||
}
|
||||
expo->srcRaw = MIXSRC216_Rud+chn;
|
||||
expo->chn = chn;
|
||||
expo->mode = oldExpo->mode;
|
||||
expo->swtch = ConvertSwitch_215_to_216(oldExpo->swtch);
|
||||
expo->flightModes = oldExpo->flightModes;
|
||||
expo->weight = oldExpo->weight;
|
||||
memcpy(expo->name, oldExpo->name, LEN_EXPOMIX_NAME);
|
||||
if (oldExpo->curveMode==0/*expo*/) {
|
||||
if (oldExpo->curveParam) {
|
||||
expo->curve.type = CURVE_REF_EXPO;
|
||||
expo->curve.value = oldExpo->curveParam;
|
||||
}
|
||||
}
|
||||
else if (oldExpo->curveParam <= 6) {
|
||||
expo->curve.type = CURVE_REF_FUNC;
|
||||
expo->curve.value = oldExpo->curveParam;
|
||||
}
|
||||
else {
|
||||
expo->curve.type = CURVE_REF_CUSTOM;
|
||||
expo->curve.value = oldExpo->curveParam - 6;
|
||||
}
|
||||
#else
|
||||
expo->mode = oldExpo->mode;
|
||||
expo->chn = oldExpo->chn;
|
||||
expo->curveMode = oldExpo->curveMode;
|
||||
expo->swtch = oldExpo->swtch;
|
||||
expo->flightModes = oldExpo->flightModes;
|
||||
expo->weight = oldExpo->weight;
|
||||
memcpy(expo->name, oldExpo->name, LEN_EXPOMIX_NAME);
|
||||
expo->curveParam = oldExpo->curveParam;
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
#if defined(PCBTARANIS)
|
||||
for (int i=NUM_STICKS-1; i>=0; i--) {
|
||||
int idx = indexes[i];
|
||||
if (idx >= 0) {
|
||||
ExpoData_v216 * expo = &newModel.expoData[idx];
|
||||
memmove(expo+1, expo, (MAX_EXPOS-(idx+1))*sizeof(ExpoData_v216));
|
||||
memclear(expo, sizeof(ExpoData_v216));
|
||||
expo->srcRaw = MIXSRC216_Rud + i;
|
||||
expo->chn = i;
|
||||
expo->weight = 100;
|
||||
expo->curve.type = CURVE_REF_EXPO;
|
||||
expo->mode = 3;
|
||||
}
|
||||
for (int c=0; c<4; c++) {
|
||||
newModel.inputNames[i][c] = char2idx(STR_VSRCRAW[2+STR_VSRCRAW[0]*(i+1)+c]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
for (uint8_t i=0; i<16; i++) {
|
||||
#if defined(PCBTARANIS)
|
||||
int8_t *cur = &oldModel.points[i==0 ? 0 : 5*i+oldModel.curves[i-1]];
|
||||
int8_t *nxt = &oldModel.points[5+5*i+oldModel.curves[i]];
|
||||
uint8_t size = nxt - cur;
|
||||
if ((size & 1) == 0) {
|
||||
newModel.curves[i].type = CURVE_TYPE_CUSTOM;
|
||||
newModel.curves[i].points = (size / 2) - 4;
|
||||
}
|
||||
else {
|
||||
newModel.curves[i].points = size-5;
|
||||
}
|
||||
#else
|
||||
newModel.curves[i] = oldModel.curves[i];
|
||||
#endif
|
||||
}
|
||||
for (uint16_t i=0; i<512; i++) {
|
||||
newModel.points[i] = oldModel.points[i];
|
||||
}
|
||||
for (uint8_t i=0; i<32; i++) {
|
||||
LogicalSwitchData_v216 & sw = newModel.logicalSw[i];
|
||||
sw.func = oldModel.logicalSw[i].func;
|
||||
if (sw.func >= LS_FUNC_VEQUAL) sw.func += 1;
|
||||
if (sw.func >= LS_FUNC_RANGE) sw.func += 1;
|
||||
if (sw.func >= LS_FUNC_EDGE) sw.func += 1;
|
||||
sw.v1 = oldModel.logicalSw[i].v1;
|
||||
sw.v2 = oldModel.logicalSw[i].v2;
|
||||
sw.delay = oldModel.logicalSw[i].delay * 5;
|
||||
sw.duration = oldModel.logicalSw[i].duration * 5;
|
||||
sw.andsw = ConvertSwitch_215_to_216(oldModel.logicalSw[i].andsw);
|
||||
uint8_t cstate = lswFamily(sw.func);
|
||||
if (cstate == LS_FAMILY_BOOL) {
|
||||
sw.v1 = ConvertSwitch_215_to_216(sw.v1);
|
||||
sw.v2 = ConvertSwitch_215_to_216(sw.v2);
|
||||
}
|
||||
else if (cstate == LS_FAMILY_OFS || cstate == LS_FAMILY_COMP || cstate == LS_FAMILY_DIFF) {
|
||||
sw.v1 = ConvertSource_215_to_216(sw.v1);
|
||||
if (cstate == LS_FAMILY_OFS || cstate == LS_FAMILY_DIFF) {
|
||||
if ((uint8_t)sw.v1 >= MIXSRC216_FIRST_TELEM) {
|
||||
switch ((uint8_t)sw.v1) {
|
||||
case MIXSRC216_FIRST_TELEM + TELEM216_TIMER1-1:
|
||||
case MIXSRC216_FIRST_TELEM + TELEM216_TIMER2-1:
|
||||
sw.v2 = (sw.v2+128) * 3;
|
||||
break;
|
||||
case MIXSRC216_FIRST_TELEM + TELEM216_ALT-1:
|
||||
case MIXSRC216_FIRST_TELEM + TELEM216_GPSALT-1:
|
||||
case MIXSRC216_FIRST_TELEM + TELEM216_MIN_ALT-1:
|
||||
case MIXSRC216_FIRST_TELEM + TELEM216_MAX_ALT-1:
|
||||
sw.v2 = (sw.v2+128) * 8 - 500;
|
||||
break;
|
||||
case MIXSRC216_FIRST_TELEM + TELEM216_RPM-1:
|
||||
case MIXSRC216_FIRST_TELEM + TELEM216_MAX_RPM-1:
|
||||
sw.v2 = (sw.v2+128) * 50;
|
||||
break;
|
||||
case MIXSRC216_FIRST_TELEM + TELEM216_T1-1:
|
||||
case MIXSRC216_FIRST_TELEM + TELEM216_T2-1:
|
||||
case MIXSRC216_FIRST_TELEM + TELEM216_MAX_T1-1:
|
||||
case MIXSRC216_FIRST_TELEM + TELEM216_MAX_T2-1:
|
||||
sw.v2 = (sw.v2+128) + 30;
|
||||
break;
|
||||
case MIXSRC216_FIRST_TELEM + TELEM216_CELL-1:
|
||||
case MIXSRC216_FIRST_TELEM + TELEM216_HDG-1:
|
||||
sw.v2 = (sw.v2+128) * 2;
|
||||
break;
|
||||
case MIXSRC216_FIRST_TELEM + TELEM216_DIST-1:
|
||||
case MIXSRC216_FIRST_TELEM + TELEM216_MAX_DIST-1:
|
||||
sw.v2 = (sw.v2+128) * 8;
|
||||
break;
|
||||
case MIXSRC216_FIRST_TELEM + TELEM216_CURRENT-1:
|
||||
case MIXSRC216_FIRST_TELEM + TELEM216_POWER-1:
|
||||
sw.v2 = (sw.v2+128) * 5;
|
||||
break;
|
||||
case MIXSRC216_FIRST_TELEM + TELEM216_CONSUMPTION-1:
|
||||
sw.v2 = (sw.v2+128) * 20;
|
||||
break;
|
||||
default:
|
||||
sw.v2 += 128;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (cstate == LS_FAMILY_COMP) {
|
||||
sw.v2 = ConvertSource_215_to_216(sw.v2);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (uint8_t i=0; i<32; i++) {
|
||||
CustomFunctionData & fn = newModel.customFn[i];
|
||||
fn.swtch = ConvertSwitch_215_to_216(oldModel.customFn[i].swtch);
|
||||
fn.func = oldModel.customFn[i].func;
|
||||
if (fn.func <= 15) {
|
||||
fn.all.param = fn.func;
|
||||
fn.func = FUNC_OVERRIDE_CHANNEL;
|
||||
}
|
||||
else if (fn.func <= 20) {
|
||||
fn.all.param = fn.func - 16;
|
||||
fn.func = FUNC_TRAINER;
|
||||
}
|
||||
else if (fn.func == 21) {
|
||||
fn.func = FUNC_INSTANT_TRIM;
|
||||
}
|
||||
else if (fn.func == 22) {
|
||||
fn.func = FUNC_PLAY_SOUND;
|
||||
}
|
||||
#if defined(PCBSKY9X)
|
||||
else if (fn.func == 23) {
|
||||
fn.func = FUNC_HAPTIC;
|
||||
}
|
||||
#endif
|
||||
else if (fn.func == 23+IS_PCBSKY9X) {
|
||||
fn.func = FUNC_RESET;
|
||||
}
|
||||
else if (fn.func == 24+IS_PCBSKY9X) {
|
||||
fn.func = FUNC_VARIO;
|
||||
}
|
||||
else if (fn.func == 25+IS_PCBSKY9X) {
|
||||
fn.func = FUNC_PLAY_TRACK;
|
||||
}
|
||||
else if (fn.func == 26+IS_PCBSKY9X) {
|
||||
fn.func = FUNC_PLAY_VALUE;
|
||||
}
|
||||
else if (fn.func == 27+IS_PCBSKY9X) {
|
||||
fn.func = FUNC_LOGS;
|
||||
}
|
||||
else if (fn.func == 28+IS_PCBSKY9X) {
|
||||
fn.func = FUNC_VOLUME;
|
||||
}
|
||||
else if (fn.func == 29+IS_PCBSKY9X) {
|
||||
fn.func = FUNC_BACKLIGHT;
|
||||
}
|
||||
else if (fn.func == 30+IS_PCBSKY9X) {
|
||||
fn.func = FUNC_BACKGND_MUSIC;
|
||||
}
|
||||
else if (fn.func == 31+IS_PCBSKY9X) {
|
||||
fn.func = FUNC_BACKGND_MUSIC_PAUSE;
|
||||
}
|
||||
else {
|
||||
fn.all.param = fn.func - 32 - IS_PCBSKY9X;
|
||||
fn.all.mode = oldModel.customFn[i].mode;
|
||||
fn.func = FUNC_ADJUST_GVAR;
|
||||
}
|
||||
|
||||
fn.active = oldModel.customFn[i].active;
|
||||
if (HAS_REPEAT_PARAM(fn.func)) {
|
||||
fn.active *= 5;
|
||||
}
|
||||
|
||||
if (fn.func == FUNC_PLAY_TRACK || fn.func == FUNC_BACKGND_MUSIC) {
|
||||
memcpy(fn.play.name, oldModel.customFn[i].param.name, 8);
|
||||
}
|
||||
else {
|
||||
fn.all.val = oldModel.customFn[i].param.composite.val;
|
||||
}
|
||||
if (fn.func == FUNC_PLAY_VALUE || fn.func == FUNC_VOLUME || (IS_ADJUST_GV_FUNC(fn.func) && fn.all.mode == FUNC_ADJUST_GVAR_SOURCE)) {
|
||||
#if defined(PCBTARANIS)
|
||||
fn.all.val = ConvertSource_215_to_216(fn.all.val, true);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
newModel.swashR = oldModel.swashR;
|
||||
newModel.swashR.collectiveSource = ConvertSource_215_to_216(newModel.swashR.collectiveSource);
|
||||
|
||||
for (uint8_t i=0; i<9; i++) {
|
||||
if (i==0 || oldModel.flightModeData[i].swtch) {
|
||||
memcpy(&newModel.flightModeData[i], &oldModel.flightModeData[i], sizeof(oldModel.flightModeData[i])); // the last 4 gvars will remain blank
|
||||
newModel.flightModeData[i].swtch = ConvertSwitch_215_to_216(oldModel.flightModeData[i].swtch);
|
||||
#if defined(PCBTARANIS)
|
||||
for (uint8_t t=0; t<4; t++) {
|
||||
int trim = oldModel.flightModeData[i].trim[t];
|
||||
if (trim > 500) {
|
||||
trim -= 501;
|
||||
if (trim >= i)
|
||||
trim += 1;
|
||||
newModel.flightModeData[i].trim[t].mode = 2*trim;
|
||||
newModel.flightModeData[i].trim[t].value = 0;
|
||||
}
|
||||
else {
|
||||
newModel.flightModeData[i].trim[t].mode = 2*i;
|
||||
newModel.flightModeData[i].trim[t].value = trim;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
newModel.thrTraceSrc = oldModel.thrTraceSrc;
|
||||
#if defined(PCBTARANIS)
|
||||
// S3 added
|
||||
if (newModel.thrTraceSrc >= THROTTLE_SOURCE_S3)
|
||||
newModel.thrTraceSrc += 1;
|
||||
#endif
|
||||
newModel.switchWarningState = oldModel.switchWarningState >> 1;
|
||||
newModel.switchWarningEnable = (oldModel.switchWarningState & 0x01) ? 0xFF : 0;
|
||||
for (uint8_t i=0; i<5; i++) {
|
||||
memcpy(newModel.gvars[i].name, oldModel.gvar_names[i], LEN_GVAR_NAME);
|
||||
}
|
||||
|
||||
memcpy(&newModel.frsky, &oldModel.frsky, 2*sizeof(FrSkyChannelData));
|
||||
// gap for A3-A4
|
||||
memcpy(((uint8_t *)&newModel.frsky) + 4*sizeof(FrSkyChannelData), ((uint8_t *)&oldModel.frsky) + 2*sizeof(FrSkyChannelData), sizeof(oldModel.frsky) - 2*sizeof(FrSkyChannelData));
|
||||
// A3 and A4 introduced
|
||||
if (newModel.frsky.voltsSource >= FRSKY_VOLTS_SOURCE_A3)
|
||||
newModel.frsky.voltsSource += 2;
|
||||
if (newModel.frsky.currentSource >= FRSKY_CURRENT_SOURCE_A3)
|
||||
newModel.frsky.currentSource += 2;
|
||||
|
||||
for (int i=0; i<3; i++) {
|
||||
if (newModel.frsky.screensType & (1<<i)) {
|
||||
// gauges
|
||||
for (int j=0; j<4; j++) {
|
||||
// uint8_t & source = newModel.frsky.screens[i].bars[j].source;
|
||||
// source = ConvertTelemetrySource_215_to_216(source);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// numbers
|
||||
for (int j=0; j<4; j++) {
|
||||
for (int k=0; k<NUM_LINE_ITEMS; k++) {
|
||||
// uint8_t & source = newModel.frsky.screens[i].lines[j].sources[k];
|
||||
// source = ConvertTelemetrySource_215_to_216(source);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
newModel.externalModule = oldModel.externalModule;
|
||||
newModel.trainerMode = oldModel.trainerMode;
|
||||
memcpy(newModel.curveNames, oldModel.curveNames, sizeof(newModel.curveNames));
|
||||
#endif
|
||||
|
||||
memcpy(newModel.moduleData, oldModel.moduleData, sizeof(newModel.moduleData));
|
||||
}
|
||||
|
||||
int ConvertGVar_216_to_217(int value)
|
||||
{
|
||||
if (value < -4096 + 9)
|
||||
@@ -1340,7 +898,12 @@ void ConvertModel_216_to_217(ModelData &model)
|
||||
zchar2str(name, oldModel.header.name, LEN_MODEL_NAME);
|
||||
TRACE("Model %s conversion from v216 to v217", name);
|
||||
|
||||
memcpy(&newModel.header, &oldModel.header, sizeof(newModel.header));
|
||||
newModel.header.modelId[0] = oldModel.header.modelId;
|
||||
memcpy(newModel.header.name, oldModel.header.name, LEN_MODEL_NAME);
|
||||
#if defined(PCBTARANIS)
|
||||
memcpy(newModel.header.bitmap, oldModel.header.bitmap, LEN_BITMAP_NAME);
|
||||
#endif
|
||||
|
||||
for (uint8_t i=0; i<2; i++) {
|
||||
TimerData & timer = newModel.timers[i];
|
||||
if (oldModel.timers[i].mode >= TMRMODE_COUNT)
|
||||
@@ -1463,8 +1026,23 @@ void ConvertModel_216_to_217(ModelData &model)
|
||||
memcpy(newModel.gvars, oldModel.gvars, sizeof(newModel.gvars));
|
||||
|
||||
memcpy(&newModel.frsky.rssiAlarms, &oldModel.frsky.rssiAlarms, sizeof(newModel.frsky.rssiAlarms));
|
||||
newModel.externalModule = oldModel.externalModule;
|
||||
memcpy(newModel.moduleData, oldModel.moduleData, sizeof(newModel.moduleData));
|
||||
|
||||
for (int i=0; i<NUM_MODULES+1; i++) {
|
||||
newModel.moduleData[i].type = 0;
|
||||
newModel.moduleData[i].rfProtocol = oldModel.moduleData[i].rfProtocol;
|
||||
newModel.moduleData[i].channelsStart = oldModel.moduleData[i].channelsStart;
|
||||
newModel.moduleData[i].channelsCount = oldModel.moduleData[i].channelsCount;
|
||||
newModel.moduleData[i].failsafeMode = oldModel.moduleData[i].failsafeMode;
|
||||
for (int j=0; j<NUM_CHNOUT; j++) {
|
||||
newModel.moduleData[i].failsafeChannels[j] = oldModel.moduleData[i].failsafeChannels[j];
|
||||
}
|
||||
newModel.moduleData[i].ppmDelay = oldModel.moduleData[i].ppmDelay;
|
||||
newModel.moduleData[i].ppmFrameLength = oldModel.moduleData[i].ppmFrameLength;
|
||||
newModel.moduleData[i].ppmPulsePol = oldModel.moduleData[i].ppmPulsePol;
|
||||
}
|
||||
|
||||
newModel.moduleData[EXTERNAL_MODULE].type = oldModel.externalModule;
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
newModel.trainerMode = oldModel.trainerMode;
|
||||
// TODO memcpy(newModel.scriptsData, oldModel.scriptsData, sizeof(newModel.scriptsData));
|
||||
@@ -1480,11 +1058,6 @@ void ConvertModel(int id, int version)
|
||||
{
|
||||
loadModel(id);
|
||||
|
||||
if (version == 215) {
|
||||
version = 216;
|
||||
ConvertModel_215_to_216(g_model);
|
||||
}
|
||||
|
||||
if (version == 216) {
|
||||
version = 217;
|
||||
ConvertModel_216_to_217(g_model);
|
||||
@@ -1501,10 +1074,7 @@ bool eeConvert()
|
||||
{
|
||||
const char *msg = NULL;
|
||||
|
||||
if (g_eeGeneral.version == 215) {
|
||||
msg = PSTR("EEprom Data v215");
|
||||
}
|
||||
else if (g_eeGeneral.version == 216) {
|
||||
if (g_eeGeneral.version == 216) {
|
||||
msg = PSTR("EEprom Data v216");
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -256,7 +256,7 @@ void menuGeneralSetup(uint8_t event)
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
#else
|
||||
#elif defined(BUZZER)
|
||||
case ITEM_SETUP_BUZZER_MODE:
|
||||
g_eeGeneral.beepMode = selectMenuItem(RADIO_SETUP_2ND_COLUMN, y, STR_SPEAKER, STR_VBEEPMODE, g_eeGeneral.beepMode, -2, 1, attr, event);
|
||||
#if defined(FRSKY)
|
||||
|
||||
@@ -112,7 +112,7 @@ void menuModelSetup(uint8_t event)
|
||||
{
|
||||
#if defined(CPUARM)
|
||||
#define IF_EXTERNAL_MODULE_XJT(x) (IS_MODULE_XJT(EXTERNAL_MODULE) ? (uint8_t)x : HIDDEN_ROW)
|
||||
#define IF_EXTERNAL_MODULE_ON(x) (g_model.externalModule == MODULE_TYPE_NONE ? HIDDEN_ROW : (uint8_t)(x))
|
||||
#define IF_EXTERNAL_MODULE_ON(x) (g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_NONE ? HIDDEN_ROW : (uint8_t)(x))
|
||||
#define IS_D8_RX(x) (g_model.moduleData[x].rfProtocol == RF_PROTO_D8)
|
||||
#define EXTERNAL_MODULE_CHANNELS_ROWS() IF_EXTERNAL_MODULE_ON(IS_MODULE_DSM2(EXTERNAL_MODULE) ? (uint8_t)0 : (uint8_t)1)
|
||||
#define EXTERNAL_MODULE_SETTINGS_ROWS() (IS_MODULE_XJT(EXTERNAL_MODULE) && IS_D8_RX(EXTERNAL_MODULE)) ? (uint8_t)1 : (IS_MODULE_PPM(EXTERNAL_MODULE) || IS_MODULE_XJT(EXTERNAL_MODULE) || IS_MODULE_DSM2(EXTERNAL_MODULE)) ? (uint8_t)2 : HIDDEN_ROW
|
||||
@@ -495,7 +495,7 @@ void menuModelSetup(uint8_t event)
|
||||
|
||||
case ITEM_MODEL_EXTERNAL_MODULE_MODE:
|
||||
lcd_putsLeft(y, STR_MODE);
|
||||
lcd_putsiAtt(MODEL_SETUP_2ND_COLUMN, y, STR_TARANIS_PROTOCOLS, g_model.externalModule, m_posHorz==0 ? attr : 0);
|
||||
lcd_putsiAtt(MODEL_SETUP_2ND_COLUMN, y, STR_TARANIS_PROTOCOLS, g_model.moduleData[EXTERNAL_MODULE].type, m_posHorz==0 ? attr : 0);
|
||||
if (IS_MODULE_XJT(EXTERNAL_MODULE))
|
||||
lcd_putsiAtt(MODEL_SETUP_2ND_COLUMN+5*FW, y, STR_XJT_PROTOCOLS, 1+g_model.moduleData[EXTERNAL_MODULE].rfProtocol, m_posHorz==1 ? attr : 0);
|
||||
else if (IS_MODULE_DSM2(EXTERNAL_MODULE))
|
||||
@@ -503,11 +503,11 @@ void menuModelSetup(uint8_t event)
|
||||
if (attr && (editMode>0 || p1valdiff)) {
|
||||
switch (m_posHorz) {
|
||||
case 0:
|
||||
g_model.externalModule = checkIncDec(event, g_model.externalModule, MODULE_TYPE_NONE, MODULE_TYPE_COUNT-1, EE_MODEL, isModuleAvailable);
|
||||
g_model.moduleData[EXTERNAL_MODULE].type = checkIncDec(event, g_model.moduleData[EXTERNAL_MODULE].type, MODULE_TYPE_NONE, MODULE_TYPE_COUNT-1, EE_MODEL, isModuleAvailable);
|
||||
if (checkIncDec_Ret) {
|
||||
g_model.moduleData[EXTERNAL_MODULE].rfProtocol = 0;
|
||||
g_model.moduleData[EXTERNAL_MODULE].channelsStart = 0;
|
||||
if (g_model.externalModule == MODULE_TYPE_PPM)
|
||||
if (g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_PPM)
|
||||
g_model.moduleData[EXTERNAL_MODULE].channelsCount = 0;
|
||||
else
|
||||
g_model.moduleData[EXTERNAL_MODULE].channelsCount = MAX_EXTERNAL_MODULE_CHANNELS();
|
||||
@@ -548,7 +548,7 @@ void menuModelSetup(uint8_t event)
|
||||
break;
|
||||
case 1:
|
||||
CHECK_INCDEC_MODELVAR(event, moduleData.channelsCount, -4, min<int8_t>(MAX_CHANNELS(moduleIdx), 32-8-moduleData.channelsStart));
|
||||
if ((k == ITEM_MODEL_EXTERNAL_MODULE_CHANNELS && g_model.externalModule == MODULE_TYPE_PPM)) {
|
||||
if ((k == ITEM_MODEL_EXTERNAL_MODULE_CHANNELS && g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_PPM)) {
|
||||
SET_DEFAULT_PPM_FRAME_LENGTH(moduleIdx);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -194,8 +194,7 @@ void menuModelSetup(uint8_t event)
|
||||
#define IF_INTERNAL_MODULE_ON(x) (g_model.internalModule == MODULE_TYPE_NONE ? HIDDEN_ROW : (uint8_t)(x))
|
||||
#else
|
||||
#define IF_INTERNAL_MODULE_ON(x) (g_model.moduleData[INTERNAL_MODULE].rfProtocol == RF_PROTO_OFF ? HIDDEN_ROW : (uint8_t)(x))
|
||||
#endif
|
||||
#define IF_EXTERNAL_MODULE_ON(x) (g_model.externalModule == MODULE_TYPE_NONE ? HIDDEN_ROW : (uint8_t)(x))
|
||||
#define IF_EXTERNAL_MODULE_ON(x) (g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_NONE ? HIDDEN_ROW : (uint8_t)(x))
|
||||
#define IF_TRAINER_ON(x) (g_model.trainerMode == TRAINER_MODE_SLAVE ? (uint8_t)(x) : HIDDEN_ROW)
|
||||
#define IF_EXTERNAL_MODULE_XJT(x) (IS_MODULE_XJT(EXTERNAL_MODULE) ? (uint8_t)x : HIDDEN_ROW)
|
||||
#define IS_D8_RX(x) (g_model.moduleData[x].rfProtocol == RF_PROTO_D8)
|
||||
@@ -643,7 +642,7 @@ void menuModelSetup(uint8_t event)
|
||||
|
||||
case ITEM_MODEL_EXTERNAL_MODULE_MODE:
|
||||
lcd_putsLeft(y, STR_MODE);
|
||||
lcd_putsiAtt(MODEL_SETUP_2ND_COLUMN, y, STR_TARANIS_PROTOCOLS, g_model.externalModule, m_posHorz==0 ? attr : 0);
|
||||
lcd_putsiAtt(MODEL_SETUP_2ND_COLUMN, y, STR_TARANIS_PROTOCOLS, g_model.moduleData[EXTERNAL_MODULE].type, m_posHorz==0 ? attr : 0);
|
||||
if (IS_MODULE_XJT(EXTERNAL_MODULE))
|
||||
lcd_putsiAtt(MODEL_SETUP_2ND_COLUMN+5*FW, y, STR_XJT_PROTOCOLS, 1+g_model.moduleData[EXTERNAL_MODULE].rfProtocol, m_posHorz==1 ? attr : 0);
|
||||
else if (IS_MODULE_DSM2(EXTERNAL_MODULE))
|
||||
@@ -651,11 +650,11 @@ void menuModelSetup(uint8_t event)
|
||||
if (attr && s_editMode>0) {
|
||||
switch (m_posHorz) {
|
||||
case 0:
|
||||
g_model.externalModule = checkIncDec(event, g_model.externalModule, MODULE_TYPE_NONE, MODULE_TYPE_COUNT-1, EE_MODEL, isModuleAvailable);
|
||||
g_model.moduleData[EXTERNAL_MODULE].type = checkIncDec(event, g_model.moduleData[EXTERNAL_MODULE].type, MODULE_TYPE_NONE, MODULE_TYPE_COUNT-1, EE_MODEL, isModuleAvailable);
|
||||
if (checkIncDec_Ret) {
|
||||
g_model.moduleData[EXTERNAL_MODULE].rfProtocol = 0;
|
||||
g_model.moduleData[EXTERNAL_MODULE].channelsStart = 0;
|
||||
if (g_model.externalModule == MODULE_TYPE_PPM)
|
||||
if (g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_PPM)
|
||||
g_model.moduleData[EXTERNAL_MODULE].channelsCount = 0;
|
||||
else
|
||||
g_model.moduleData[EXTERNAL_MODULE].channelsCount = MAX_EXTERNAL_MODULE_CHANNELS();
|
||||
@@ -697,12 +696,7 @@ void menuModelSetup(uint8_t event)
|
||||
break;
|
||||
case 1:
|
||||
CHECK_INCDEC_MODELVAR(event, moduleData.channelsCount, -4, min<int8_t>(MAX_CHANNELS(moduleIdx), 32-8-moduleData.channelsStart));
|
||||
#if defined(TARANIS_INTERNAL_PPM)
|
||||
if ((k == ITEM_MODEL_EXTERNAL_MODULE_CHANNELS && g_model.externalModule == MODULE_TYPE_PPM) || (k == ITEM_MODEL_INTERNAL_MODULE_CHANNELS && g_model.internalModule == MODULE_TYPE_PPM) || (k == ITEM_MODEL_TRAINER_CHANNELS)) {
|
||||
SET_DEFAULT_PPM_FRAME_LENGTH(moduleIdx);
|
||||
}
|
||||
#else
|
||||
if ((k == ITEM_MODEL_EXTERNAL_MODULE_CHANNELS && g_model.externalModule == MODULE_TYPE_PPM) || (k == ITEM_MODEL_TRAINER_CHANNELS)) {
|
||||
if ((k == ITEM_MODEL_EXTERNAL_MODULE_CHANNELS && g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_PPM) || (k == ITEM_MODEL_TRAINER_CHANNELS)) {
|
||||
SET_DEFAULT_PPM_FRAME_LENGTH(moduleIdx);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -128,7 +128,7 @@ enum menuModelTelemetryItems {
|
||||
#define SCREEN_TYPE_ROWS 0
|
||||
#endif
|
||||
#define VARIO_RANGE_ROWS 3
|
||||
#define TELEMETRY_TYPE_ROWS (g_model.moduleData[INTERNAL_MODULE].rfProtocol == RF_PROTO_OFF && g_model.externalModule == MODULE_TYPE_PPM) ? (uint8_t)0 : HIDDEN_ROW,
|
||||
#define TELEMETRY_TYPE_ROWS (g_model.moduleData[INTERNAL_MODULE].rfProtocol == RF_PROTO_OFF && g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_PPM) ? (uint8_t)0 : HIDDEN_ROW,
|
||||
|
||||
#if defined(LUA)
|
||||
#define TELEMETRY_SCREEN_LINE(x) ((TELEMETRY_SCREEN_TYPE(x) == TELEMETRY_SCREEN_TYPE_NONE || TELEMETRY_SCREEN_TYPE(x) == TELEMETRY_SCREEN_TYPE_SCRIPT) ? HIDDEN_ROW : (uint8_t)2)
|
||||
|
||||
+7
-25
@@ -409,32 +409,18 @@ enum BeeperMode {
|
||||
#define FAILSAFE_CHANNEL_HOLD 2000
|
||||
#define FAILSAFE_CHANNEL_NOPULSE 2001
|
||||
|
||||
#if defined(PCBSKY9X) && defined(REVX)
|
||||
PACK(typedef struct {
|
||||
int8_t rfProtocol;
|
||||
uint8_t type:4;
|
||||
int8_t rfProtocol:4;
|
||||
uint8_t channelsStart;
|
||||
int8_t channelsCount; // 0=8 channels
|
||||
uint8_t failsafeMode;
|
||||
int16_t failsafeChannels[NUM_CHNOUT];
|
||||
int8_t ppmDelay;
|
||||
int8_t ppmFrameLength;
|
||||
int8_t ppmDelay:6;
|
||||
uint8_t ppmPulsePol:1;
|
||||
uint8_t ppmOutputType:1; // false = open drain, true = push pull
|
||||
uint8_t spare:6;
|
||||
}) ModuleData;
|
||||
#else
|
||||
PACK(typedef struct {
|
||||
int8_t rfProtocol;
|
||||
uint8_t channelsStart;
|
||||
int8_t channelsCount; // 0=8 channels
|
||||
uint8_t failsafeMode;
|
||||
int16_t failsafeChannels[NUM_CHNOUT];
|
||||
int8_t ppmDelay;
|
||||
uint8_t ppmOutputType:1; // false = open drain, true = push pull
|
||||
int8_t ppmFrameLength;
|
||||
uint8_t ppmPulsePol:1;
|
||||
uint8_t spare:7;
|
||||
}) ModuleData;
|
||||
#endif
|
||||
|
||||
#define SET_DEFAULT_PPM_FRAME_LENGTH(idx) g_model.moduleData[idx].ppmFrameLength = 4 * max((int8_t)0, g_model.moduleData[idx].channelsCount)
|
||||
|
||||
@@ -467,11 +453,7 @@ PACK(typedef struct {
|
||||
};
|
||||
#define IS_TRAINER_EXTERNAL_MODULE() (g_model.trainerMode == TRAINER_MODE_MASTER_SBUS_EXTERNAL_MODULE || g_model.trainerMode == TRAINER_MODE_MASTER_CPPM_EXTERNAL_MODULE)
|
||||
#define MODELDATA_BITMAP char bitmap[LEN_BITMAP_NAME];
|
||||
#if defined(TARANIS_INTERNAL_PPM)
|
||||
#define MODELDATA_EXTRA uint8_t externalModule:3; uint8_t internalModule:3; uint8_t trainerMode:3; uint8_t potsWarnMode:2; ModuleData moduleData[NUM_MODULES+1]; char curveNames[MAX_CURVES][6]; ScriptData scriptsData[MAX_SCRIPTS]; char inputNames[MAX_INPUTS][LEN_INPUT_NAME]; uint8_t potsWarnEnabled; int8_t potsWarnPosition[NUM_POTS];
|
||||
#else
|
||||
#define MODELDATA_EXTRA uint8_t externalModule:3; uint8_t trainerMode:3; uint8_t potsWarnMode:2; ModuleData moduleData[NUM_MODULES+1]; char curveNames[MAX_CURVES][6]; ScriptData scriptsData[MAX_SCRIPTS]; char inputNames[MAX_INPUTS][LEN_INPUT_NAME]; uint8_t potsWarnEnabled; int8_t potsWarnPosition[NUM_POTS];
|
||||
#endif
|
||||
#define MODELDATA_EXTRA uint8_t spare:3; uint8_t trainerMode:3; uint8_t potsWarnMode:2; ModuleData moduleData[NUM_MODULES+1]; char curveNames[MAX_CURVES][6]; ScriptData scriptsData[MAX_SCRIPTS]; char inputNames[MAX_INPUTS][LEN_INPUT_NAME]; uint8_t potsWarnEnabled; int8_t potsWarnPosition[NUM_POTS];
|
||||
#elif defined(PCBSKY9X)
|
||||
enum ModuleIndex {
|
||||
EXTERNAL_MODULE,
|
||||
@@ -479,7 +461,7 @@ PACK(typedef struct {
|
||||
TRAINER_MODULE
|
||||
};
|
||||
#define MODELDATA_BITMAP
|
||||
#define MODELDATA_EXTRA uint8_t externalModule:3; uint8_t spare:3; uint8_t potsWarnMode:2; ModuleData moduleData[NUM_MODULES+1]; uint8_t potsWarnEnabled; int8_t potsWarnPosition[NUM_POTS]; uint8_t rxBattAlarms[2];
|
||||
#define MODELDATA_EXTRA uint8_t spare:6; uint8_t potsWarnMode:2; ModuleData moduleData[NUM_MODULES+1]; uint8_t potsWarnEnabled; int8_t potsWarnPosition[NUM_POTS]; uint8_t rxBattAlarms[2];
|
||||
#else
|
||||
#define MODELDATA_BITMAP
|
||||
#define MODELDATA_EXTRA
|
||||
@@ -2048,7 +2030,7 @@ enum ModuleTypes {
|
||||
MODULE_TYPE_COUNT
|
||||
};
|
||||
|
||||
#define IS_PULSES_EXTERNAL_MODULE() (g_model.externalModule != MODULE_TYPE_NONE)
|
||||
#define IS_PULSES_EXTERNAL_MODULE() (g_model.moduleData[EXTERNAL_MODULE].type != MODULE_TYPE_NONE)
|
||||
|
||||
enum FailsafeModes {
|
||||
FAILSAFE_NOT_SET,
|
||||
|
||||
@@ -417,7 +417,7 @@ void modelDefault(uint8_t id)
|
||||
#endif
|
||||
|
||||
#if defined(PCBSKY9X)
|
||||
g_model.externalModule = MODULE_TYPE_PPM;
|
||||
g_model.moduleData[EXTERNAL_MODULE].type = MODULE_TYPE_PPM;
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
|
||||
+10
-12
@@ -470,7 +470,7 @@ extern void boardInit();
|
||||
#define IS_MODULE_XJT(idx) ((idx==INTERNAL_MODULE || g_model.externalModule==MODULE_TYPE_XJT) && (g_model.moduleData[idx].rfProtocol != RF_PROTO_OFF))
|
||||
#endif
|
||||
#if defined(DSM2)
|
||||
#define IS_MODULE_DSM2(idx) (idx==EXTERNAL_MODULE && g_model.externalModule==MODULE_TYPE_DSM2)
|
||||
#define IS_MODULE_DSM2(idx) (idx==EXTERNAL_MODULE && g_model.moduleData[EXTERNAL_MODULE].type==MODULE_TYPE_DSM2)
|
||||
#else
|
||||
#define IS_MODULE_DSM2(idx) (false)
|
||||
#endif
|
||||
@@ -482,17 +482,17 @@ extern void boardInit();
|
||||
#define MAX_EXTERNAL_MODULE_CHANNELS() ((g_model.externalModule == MODULE_TYPE_XJT) ? maxChannelsXJT[1+g_model.moduleData[1].rfProtocol] : maxChannelsModules[g_model.externalModule])
|
||||
#define MAX_CHANNELS(idx) (idx==INTERNAL_MODULE ? MAX_INTERNAL_MODULE_CHANNELS() : (idx==EXTERNAL_MODULE ? MAX_EXTERNAL_MODULE_CHANNELS() : MAX_TRAINER_CHANNELS()))
|
||||
#elif defined(PCBSKY9X) && !defined(REVA) && !defined(REVX)
|
||||
#define IS_MODULE_PPM(idx) (idx==TRAINER_MODULE || idx==EXTRA_MODULE || (idx==EXTERNAL_MODULE && g_model.externalModule==MODULE_TYPE_PPM))
|
||||
#define IS_MODULE_XJT(idx) (idx==EXTERNAL_MODULE && g_model.externalModule==MODULE_TYPE_XJT)
|
||||
#define IS_MODULE_DSM2(idx) (idx==EXTERNAL_MODULE && g_model.externalModule==MODULE_TYPE_DSM2)
|
||||
#define MAX_EXTERNAL_MODULE_CHANNELS() ((g_model.externalModule == MODULE_TYPE_XJT) ? maxChannelsXJT[1+g_model.moduleData[0].rfProtocol] : maxChannelsModules[g_model.externalModule])
|
||||
#define IS_MODULE_PPM(idx) (idx==TRAINER_MODULE || idx==EXTRA_MODULE || (idx==EXTERNAL_MODULE && g_model.moduleData[EXTERNAL_MODULE].type==MODULE_TYPE_PPM))
|
||||
#define IS_MODULE_XJT(idx) (idx==EXTERNAL_MODULE && g_model.moduleData[EXTERNAL_MODULE].type==MODULE_TYPE_XJT)
|
||||
#define IS_MODULE_DSM2(idx) (idx==EXTERNAL_MODULE && g_model.moduleData[EXTERNAL_MODULE].type==MODULE_TYPE_DSM2)
|
||||
#define MAX_EXTERNAL_MODULE_CHANNELS() ((g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_XJT) ? maxChannelsXJT[1+g_model.moduleData[0].rfProtocol] : maxChannelsModules[g_model.moduleData[EXTERNAL_MODULE].type])
|
||||
#define MAX_EXTRA_MODULE_CHANNELS() (0) // Only PPM
|
||||
#define MAX_CHANNELS(idx) (idx==EXTERNAL_MODULE ? MAX_EXTERNAL_MODULE_CHANNELS() : (idx==EXTRA_MODULE ? MAX_EXTRA_MODULE_CHANNELS() : MAX_TRAINER_CHANNELS()))
|
||||
#else
|
||||
#define IS_MODULE_PPM(idx) (idx==TRAINER_MODULE || (idx==EXTERNAL_MODULE && g_model.externalModule==MODULE_TYPE_PPM))
|
||||
#define IS_MODULE_XJT(idx) (idx==EXTERNAL_MODULE && g_model.externalModule==MODULE_TYPE_XJT)
|
||||
#define IS_MODULE_DSM2(idx) (idx==EXTERNAL_MODULE && g_model.externalModule==MODULE_TYPE_DSM2)
|
||||
#define MAX_EXTERNAL_MODULE_CHANNELS() ((g_model.externalModule == MODULE_TYPE_XJT) ? maxChannelsXJT[1+g_model.moduleData[EXTERNAL_MODULE].rfProtocol] : maxChannelsModules[g_model.externalModule])
|
||||
#define IS_MODULE_PPM(idx) (idx==TRAINER_MODULE || (idx==EXTERNAL_MODULE && g_model.moduleData[EXTERNAL_MODULE].type==MODULE_TYPE_PPM))
|
||||
#define IS_MODULE_XJT(idx) (idx==EXTERNAL_MODULE && g_model.moduleData[EXTERNAL_MODULE].type==MODULE_TYPE_XJT)
|
||||
#define IS_MODULE_DSM2(idx) (idx==EXTERNAL_MODULE && g_model.moduleData[EXTERNAL_MODULE].type==MODULE_TYPE_DSM2)
|
||||
#define MAX_EXTERNAL_MODULE_CHANNELS() ((g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_XJT) ? maxChannelsXJT[1+g_model.moduleData[EXTERNAL_MODULE].rfProtocol] : maxChannelsModules[g_model.moduleData[EXTERNAL_MODULE].type])
|
||||
#define MAX_CHANNELS(idx) (idx==EXTERNAL_MODULE ? MAX_EXTERNAL_MODULE_CHANNELS() : MAX_TRAINER_CHANNELS())
|
||||
#endif
|
||||
|
||||
@@ -567,7 +567,7 @@ enum BaseCurves {
|
||||
#if defined(PCBTARANIS)
|
||||
#define SPLASH_NEEDED() (g_eeGeneral.splashMode != 3)
|
||||
#elif defined(CPUARM)
|
||||
#define SPLASH_NEEDED() (g_model.externalModule != MODULE_TYPE_DSM2 && !g_eeGeneral.splashMode)
|
||||
#define SPLASH_NEEDED() (g_model.moduleData[EXTERNAL_MODULE].type != MODULE_TYPE_DSM2 && !g_eeGeneral.splashMode)
|
||||
#else
|
||||
#define SPLASH_NEEDED() (!IS_DSM2_PROTOCOL(g_model.protocol) && !g_eeGeneral.splashMode)
|
||||
#endif
|
||||
@@ -1459,9 +1459,7 @@ enum AUDIO_SOUNDS {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(BUZZER)
|
||||
#include "buzzer.h"
|
||||
#endif
|
||||
|
||||
#if defined(PCBSTD) && defined(VOICE)
|
||||
#include "targets/stock/voice.h"
|
||||
|
||||
@@ -73,7 +73,7 @@ void setupPulses(unsigned int port)
|
||||
|
||||
default:
|
||||
port = EXTERNAL_MODULE; // ensure it's external module only
|
||||
switch (g_model.externalModule) {
|
||||
switch (g_model.moduleData[EXTERNAL_MODULE].type) {
|
||||
case MODULE_TYPE_PPM:
|
||||
required_protocol = PROTO_PPM;
|
||||
break;
|
||||
|
||||
@@ -48,7 +48,7 @@ inline void boardInit()
|
||||
DDRE = 0b00000010; PORTE = 0b11111100; // 7:N/A, 6:N/A, 5:RENC1_B, 4:RENC1_A, 3:N/A, 2:N/A, 1:TELEM_TX, 0:TELEM_RX
|
||||
DDRF = 0b00000000; PORTF = 0b11111111; // 7-0:Trim switch inputs
|
||||
DDRG = 0b00000000; PORTG = 0b11111111; // 7:N/A, 6:N/A, 5:N/A, 4:N/A, 3:N/A, 2:TCut_SW, 1:Gear_SW, 0: RudDr_SW
|
||||
DDRH = 0b00011000; PORTH = 0b11110110; // 7:N/A, 6:RFPw, 5:JackPres, 4:HoldPw, 3:Speaker, 2:N/A, 1:N/A, 0:Haptic
|
||||
DDRH = 0b00011000; PORTH = 0b11110110; // 7:N/A, 6:RF_Activated, 5:DSC_Activated, 4:Hold_Power, 3:Speaker, 2:N/A, 1:N/A, 0:Haptic
|
||||
DDRJ = 0b00000000; PORTJ = 0b11111111; // 7:N/A, 6:N/A, 5:N/A, 4:N/A, 3:N/A, 2:N/A, 1:RENC2_push, 0:RENC1_push
|
||||
DDRK = 0b00000000; PORTK = 0b00000000; // Analogic input (no pull-ups)
|
||||
DDRL = 0b00000000; PORTL = 0b11111111; // 7:TRN_SW 6:EleDR_SW, 5:ESC, 4:MENU 3:Keyb_Left, 2:Keyb_Right, 1:Keyb_Up, 0:Keyb_Down
|
||||
@@ -98,7 +98,7 @@ uint8_t pwrCheck()
|
||||
|
||||
void pwrOff()
|
||||
{
|
||||
PORTH = 0xEF; // PortH-4 set to 0
|
||||
PORTH &= ~0x10; // PortH-4 set to 0
|
||||
}
|
||||
|
||||
FORCEINLINE uint8_t keyDown()
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
#define PAUSE_PPMIN_INTERRUPT() TIMSK3 &= ~(1<<ICIE3)
|
||||
#define RESUME_PPMIN_INTERRUPT() TIMSK3 |= (1<<ICIE3)
|
||||
|
||||
#define SLAVE_MODE() ~PINH & (1<<INP_H_RF_POW)
|
||||
#define SLAVE_MODE() ~PINH & (1<<INP_H_RF_Activated)
|
||||
#define JACK_PPM_OUT() PORTB |= (1<<OUT_B_SIM_CTL)
|
||||
#define JACK_PPM_IN() PORTB &= ~(1<<OUT_B_SIM_CTL)
|
||||
#define __BACKLIGHT_ON PORTC |= (1<<OUT_C_LIGHT)
|
||||
@@ -133,9 +133,9 @@ void sdPoll10ms(void);
|
||||
# define INP_D_I2C_SDA 0
|
||||
# define INP_E_TELEM_RX 1
|
||||
# define OUT_E_TELEM_TX 0
|
||||
# define INP_H_RF_POW 6
|
||||
//#define INP_H_ 5 //reserved JACKPRES
|
||||
//#define INP_H_ 4 //reserved HOLDPWR
|
||||
# define INP_H_RF_Activated 6
|
||||
//#define INP_H_ 5 //reserved DSC_Activated, for pwrCheck()
|
||||
//#define INP_H_ 4 //reserved Hold_Power, for pwrCheck()
|
||||
# define OUT_H_Speaker 3
|
||||
# define OUT_H_HAPTIC 0
|
||||
|
||||
|
||||
@@ -706,28 +706,26 @@ char *findTrueFileName(const char *path)
|
||||
char fname[_MAX_FNAME];
|
||||
char ext[_MAX_EXT];
|
||||
_splitpath(path, drive, dir, fname, ext);
|
||||
std::string fileName = std::string(fname) + "." + std::string(ext);
|
||||
std::string fileName = std::string(fname) + std::string(ext);
|
||||
std::string dirName = std::string(drive) + std::string(dir);
|
||||
if (dir) {
|
||||
// TRACE("\tsearching for: %s", fileName.c_str());
|
||||
WIN32_FIND_DATA ffd;
|
||||
HANDLE hFind = FindFirstFile(dirName.c_str(), &ffd);
|
||||
if (INVALID_HANDLE_VALUE != hFind) {
|
||||
do {
|
||||
if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY == 0) {
|
||||
// TRACE("comparing with: %s", ffd.cFileName);
|
||||
if (!strcasecmp(fileName.c_str(), ffd.cFileName)) {
|
||||
strcpy(result, dirName.c_str());
|
||||
strcat(result, "/");
|
||||
strcat(result, ffd.cFileName);
|
||||
TRACE("\tfound: %s", ffd.cFileName);
|
||||
fileMap.insert(filemap_t:: value_type(path, result));
|
||||
return result;
|
||||
}
|
||||
std::string searchName = dirName + "*";
|
||||
// TRACE("\tsearching for: %s", fileName.c_str());
|
||||
WIN32_FIND_DATA ffd;
|
||||
HANDLE hFind = FindFirstFile(searchName.c_str(), &ffd);
|
||||
if (INVALID_HANDLE_VALUE != hFind) {
|
||||
do {
|
||||
if (!(ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
|
||||
//TRACE("comparing with: %s", ffd.cFileName);
|
||||
if (!strcasecmp(fileName.c_str(), ffd.cFileName)) {
|
||||
strcpy(result, dirName.c_str());
|
||||
strcat(result, ffd.cFileName);
|
||||
TRACE("\tfound: %s", ffd.cFileName);
|
||||
fileMap.insert(filemap_t:: value_type(path, result));
|
||||
return result;
|
||||
}
|
||||
}
|
||||
while (FindNextFile(hFind, &ffd) != 0);
|
||||
}
|
||||
while (FindNextFile(hFind, &ffd) != 0);
|
||||
}
|
||||
#else
|
||||
strcpy(result, path);
|
||||
|
||||
@@ -36,18 +36,11 @@
|
||||
|
||||
#include "opentx.h"
|
||||
|
||||
#define delay_1us() _delay_us(1)
|
||||
#define delay_2us() _delay_us(2)
|
||||
void delay_1_5us(uint16_t ms)
|
||||
{
|
||||
for (uint16_t i=0; i<ms; i++) delay_1us();
|
||||
}
|
||||
|
||||
void lcdSendCtl(uint8_t val)
|
||||
{
|
||||
PORTC_LCD_CTRL &= ~(1<<OUT_C_LCD_CS1);
|
||||
#ifdef LCD_MULTIPLEX
|
||||
DDRA = 0xFF; // set LCD_DAT pins to output
|
||||
#if defined(LCD_MULTIPLEX)
|
||||
DDRA = 0xFF; //Set LCD_DAT pins to output
|
||||
#endif
|
||||
PORTC_LCD_CTRL &= ~(1<<OUT_C_LCD_A0);
|
||||
PORTC_LCD_CTRL &= ~(1<<OUT_C_LCD_RnW);
|
||||
@@ -55,27 +48,28 @@ void lcdSendCtl(uint8_t val)
|
||||
PORTC_LCD_CTRL |= (1<<OUT_C_LCD_E);
|
||||
PORTC_LCD_CTRL &= ~(1<<OUT_C_LCD_E);
|
||||
PORTC_LCD_CTRL |= (1<<OUT_C_LCD_A0);
|
||||
#ifdef LCD_MULTIPLEX
|
||||
DDRA = 0x00; // set LCD_DAT pins to input
|
||||
#if defined(LCD_MULTIPLEX)
|
||||
DDRA = 0x00; //Set LCD_DAT pins to input
|
||||
#endif
|
||||
PORTC_LCD_CTRL |= (1<<OUT_C_LCD_CS1);
|
||||
}
|
||||
|
||||
#if defined(PCBSTD) && defined(VOICE)
|
||||
volatile uint8_t LcdLock ;
|
||||
#define LCD_LOCK() LcdLock = 1
|
||||
#define LCD_UNLOCK() LcdLock = 0
|
||||
volatile uint8_t LcdLock ;
|
||||
#define LCD_LOCK() LcdLock = 1
|
||||
#define LCD_UNLOCK() LcdLock = 0
|
||||
#else
|
||||
#define LCD_LOCK()
|
||||
#define LCD_UNLOCK()
|
||||
#define LCD_LOCK()
|
||||
#define LCD_UNLOCK()
|
||||
#endif
|
||||
|
||||
const static pm_uchar lcdInitSequence[] PROGMEM =
|
||||
{
|
||||
#ifdef LCD_ST7565R
|
||||
//ST7565 eq. : KS0713, SED1565, S6B1713, SPLC501C, NT7532 /34 /38, TL03245
|
||||
#if defined(LCD_ST7565R)
|
||||
0xE2, //Initialize the internal functions
|
||||
0xAE, //DON = 0: display OFF
|
||||
0xA0, //ADC = 0: normal direction(SEG132->SEG1)
|
||||
0xA0, //ADC = 0: normal direction (SEG132->SEG1)
|
||||
0xA6, //REV = 0: non-reverse display
|
||||
0xA4, //EON = 0: normal display. non-entire
|
||||
0xA2, //Select LCD bias
|
||||
@@ -85,11 +79,11 @@ const static pm_uchar lcdInitSequence[] PROGMEM =
|
||||
0x81, //Set reference voltage Mode
|
||||
0x22, //24 SV5 SV4 SV3 SV2 SV1 SV0 = 0x18
|
||||
0xAF, //DON = 1: display ON
|
||||
0x60 //sets the display start line to zero
|
||||
#elif LCD_ERC12864FSF
|
||||
0x60 //Set the display start line to zero
|
||||
#elif defined(LCD_ERC12864FSF)
|
||||
0xE2, //Initialize the internal functions
|
||||
0xAE, //DON = 0: display OFF
|
||||
0xA1, //ADC = 1: reverse direction(SEG132->SEG1)
|
||||
0xA1, //ADC = 1: reverse direction (SEG132->SEG1)
|
||||
0xA6, //REV = 0: non-reverse display
|
||||
0xA4, //EON = 0: normal display. non-entire
|
||||
0xA3, //Select LCD bias
|
||||
@@ -99,7 +93,13 @@ const static pm_uchar lcdInitSequence[] PROGMEM =
|
||||
0x81, //Set reference voltage Mode
|
||||
0x2D, //24 SV5 SV4 SV3 SV2 SV1 SV0
|
||||
0xAF //DON = 1: display ON
|
||||
#else
|
||||
#elif defined(LCD_ST7920)
|
||||
0x30, //Set 8-bit interface
|
||||
0x36, //Repeat with graphics bit set to ON
|
||||
0x0C, //Display ON, cursor and blink OFF
|
||||
0x01, //Clear display, reset address
|
||||
0x06 //Display ON, no cursor
|
||||
#else //ST7565P (default 9x LCD)
|
||||
0xE2, //Initialize the internal functions
|
||||
0xAE, //DON = 0: display OFF
|
||||
0xA1, //ADC = 1: reverse direction(SEG132->SEG1)
|
||||
@@ -117,18 +117,22 @@ const static pm_uchar lcdInitSequence[] PROGMEM =
|
||||
|
||||
inline void lcdInit()
|
||||
{
|
||||
// /home/thus/txt/datasheets/lcd/KS0713.pdf
|
||||
// ~/txt/flieger/ST7565RV17.pdf from http://www.glyn.de/content.asp?wdid=132&sid=
|
||||
|
||||
LCD_LOCK();
|
||||
PORTC_LCD_CTRL &= ~(1<<OUT_C_LCD_RES); //LCD_RES
|
||||
delay_2us();
|
||||
PORTC_LCD_CTRL |= (1<<OUT_C_LCD_RES); // f524 sbi 0x15, 2 IOADR-PORTC_LCD_CTRL; 21 1
|
||||
delay_1_5us(1500);
|
||||
PORTC_LCD_CTRL &= ~(1<<OUT_C_LCD_RES); //LCD reset
|
||||
_delay_us(2);
|
||||
PORTC_LCD_CTRL |= (1<<OUT_C_LCD_RES); //LCD normal operation
|
||||
#if defined(LCD_ST7920)
|
||||
_delay_ms(40);
|
||||
#else
|
||||
_delay_us(1500);
|
||||
#endif
|
||||
for (uint8_t i=0; i<DIM(lcdInitSequence); i++) {
|
||||
lcdSendCtl(pgm_read_byte(&lcdInitSequence[i])) ;
|
||||
#if defined(LCD_ST7920)
|
||||
_delay_us(80);
|
||||
#endif
|
||||
}
|
||||
#ifdef LCD_ERC12864FSF
|
||||
#if defined(LCD_ERC12864FSF)
|
||||
g_eeGeneral.contrast = 0x2D;
|
||||
#else
|
||||
g_eeGeneral.contrast = 0x22;
|
||||
@@ -138,29 +142,67 @@ inline void lcdInit()
|
||||
|
||||
void lcdSetRefVolt(uint8_t val)
|
||||
{
|
||||
#if !defined(LCD_ST7920) // No contrast setting for ST7920
|
||||
LCD_LOCK();
|
||||
lcdSendCtl(0x81);
|
||||
lcdSendCtl(val);
|
||||
LCD_UNLOCK();
|
||||
#endif
|
||||
}
|
||||
|
||||
void lcdRefresh()
|
||||
{
|
||||
LCD_LOCK();
|
||||
uint8_t *p=displayBuf;
|
||||
for(uint8_t y=0; y < 8; y++) {
|
||||
|
||||
#ifdef LCD_ST7565R
|
||||
#if defined(LCD_ST7920)
|
||||
uint8_t x_addr = 0;
|
||||
uint8_t y_addr = 0;
|
||||
uint16_t line_offset = 0;
|
||||
uint8_t col_offset = 0;
|
||||
uint16_t byte_offset = 0;
|
||||
uint8_t bit_count = 0;
|
||||
for (uint8_t y=0; y<64; y++) {
|
||||
x_addr = 0;
|
||||
//Convert coordinates to weirdly-arranged 128x64 screen (the ST7920 is mapped for 256x32 displays)
|
||||
if (y > 31) {
|
||||
y_addr = y - 32; //Because there are only 31 addressable lines in the ST7920
|
||||
x_addr += 8; //so we overflow x (7 visible bytes per line) to reach the bottom half
|
||||
}
|
||||
else {
|
||||
y_addr = y;
|
||||
}
|
||||
lcdSendCtl( 0x80 | y_addr ); //Set Vertical Address
|
||||
_delay_us(49);
|
||||
lcdSendCtl( 0x80 | x_addr ); //Set Horizontal Address
|
||||
_delay_us(49);
|
||||
PORTC_LCD_CTRL |= (1<<OUT_C_LCD_A0); //HIGH RS and LOW RW will put the LCD to
|
||||
PORTC_LCD_CTRL &= ~(1<<OUT_C_LCD_RnW); //Write data register mode
|
||||
bit_count = y & 0x07; //Count from 0 bis 7 -> 0=0, 1=1..7=7, 8=0, 9=1...
|
||||
col_offset = 1 << bit_count; //Build a value for a AND operation with the vorrect bitposition
|
||||
line_offset = ( y / 8 ) * 128; //On the ST7565 there are 8 lines with each 128 bytes width
|
||||
for (coord_t x=0; x<16; x++) { //Walk through 16 bytes form left to right (128 Pixel)
|
||||
byte_offset = line_offset + ( x * 8 ); //Calculate the position of the first byte im array
|
||||
// adressing the bytes sequential and shift the bits at the correct position, afterwards a OR operation to get all bits in one byte
|
||||
// the position of the LSB is the left-most position of the byte to the ST7920
|
||||
PORTA_LCD_DAT = (((displayBuf[byte_offset] & col_offset) >> bit_count) << 7) | (((displayBuf[byte_offset + 1] & col_offset) >> bit_count) << 6) | (((displayBuf[byte_offset + 2] & col_offset) >> bit_count ) << 5) | (((displayBuf[byte_offset + 3] & col_offset) >> bit_count ) << 4) | (((displayBuf[byte_offset + 4] & col_offset) >> bit_count ) << 3) | (((displayBuf[byte_offset + 5] & col_offset) >> bit_count ) << 2) | (((displayBuf[byte_offset + 6] & col_offset) >> bit_count ) << 1) | (((displayBuf[byte_offset + 7] & col_offset) >> bit_count ) << 0);
|
||||
PORTC_LCD_CTRL |= (1<<OUT_C_LCD_E);
|
||||
_delay_us(8);
|
||||
PORTC_LCD_CTRL &= ~(1<<OUT_C_LCD_E);
|
||||
_delay_us(49);
|
||||
}
|
||||
}
|
||||
#else //All other LCD
|
||||
uint8_t * p = displayBuf;
|
||||
for (uint8_t y=0; y < 8; y++) {
|
||||
#if defined(LCD_ST7565R)
|
||||
lcdSendCtl(0x01);
|
||||
#else
|
||||
lcdSendCtl(0x04);
|
||||
#endif
|
||||
|
||||
lcdSendCtl(0x10); //column addr 0
|
||||
lcdSendCtl( y | 0xB0); //page addr y
|
||||
lcdSendCtl(0x10); // Column addr 0
|
||||
lcdSendCtl( y | 0xB0); //Page addr y
|
||||
PORTC_LCD_CTRL &= ~(1<<OUT_C_LCD_CS1);
|
||||
#ifdef LCD_MULTIPLEX
|
||||
DDRA = 0xFF; // set LCD_DAT pins to output
|
||||
#if defined(LCD_MULTIPLEX)
|
||||
DDRA = 0xFF; // Set LCD_DAT pins to output
|
||||
#endif
|
||||
PORTC_LCD_CTRL |= (1<<OUT_C_LCD_A0);
|
||||
PORTC_LCD_CTRL &= ~(1<<OUT_C_LCD_RnW);
|
||||
@@ -172,7 +214,6 @@ void lcdRefresh()
|
||||
PORTC_LCD_CTRL |= (1<<OUT_C_LCD_A0);
|
||||
PORTC_LCD_CTRL |= (1<<OUT_C_LCD_CS1);
|
||||
}
|
||||
#endif
|
||||
LCD_UNLOCK();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -367,7 +367,7 @@ void telemetryWakeup()
|
||||
}
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
if ((g_model.moduleData[INTERNAL_MODULE].rfProtocol != RF_PROTO_OFF || g_model.externalModule == MODULE_TYPE_XJT) && FRSKY_BAD_ANTENNA()) {
|
||||
if ((g_model.moduleData[INTERNAL_MODULE].rfProtocol != RF_PROTO_OFF || g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_XJT) && FRSKY_BAD_ANTENNA()) {
|
||||
AUDIO_SWR_RED();
|
||||
POPUP_WARNING(STR_ANTENNAPROBLEM);
|
||||
SCHEDULE_NEXT_ALARMS_CHECK(10/*seconds*/);
|
||||
|
||||
@@ -504,7 +504,7 @@ void frskyUpdateCells(void);
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
#define MODEL_TELEMETRY_PROTOCOL() ((g_model.moduleData[INTERNAL_MODULE].rfProtocol == RF_PROTO_OFF && g_model.externalModule == MODULE_TYPE_PPM) ? g_model.telemetryProtocol : PROTOCOL_FRSKY_SPORT)
|
||||
#define MODEL_TELEMETRY_PROTOCOL() ((g_model.moduleData[INTERNAL_MODULE].rfProtocol == RF_PROTO_OFF && g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_PPM) ? g_model.telemetryProtocol : PROTOCOL_FRSKY_SPORT)
|
||||
#elif defined(CPUARM)
|
||||
#define MODEL_TELEMETRY_PROTOCOL() g_model.telemetryProtocol
|
||||
#endif
|
||||
|
||||
@@ -35,8 +35,8 @@
|
||||
*/
|
||||
/* Formatting octal codes available in TR_ strings:
|
||||
* \037\x -sets LCD x-coord (x value in octal)
|
||||
* \n -newline
|
||||
* \t -horizontal tab (ARM only)
|
||||
* \036 -newline
|
||||
* \035 -horizontal tab (ARM only)
|
||||
* \001 to \034 -extended spacing (value * FW/2)
|
||||
* \0 -ends current string
|
||||
*/
|
||||
|
||||
@@ -32,8 +32,8 @@
|
||||
*/
|
||||
/* Formatting octal codes available in TR_ strings:
|
||||
* \037\x -sets LCD x-coord (x value in octal)
|
||||
* \n -newline
|
||||
* \t -horizontal tab (ARM only)
|
||||
* \036 -newline
|
||||
* \035 -horizontal tab (ARM only)
|
||||
* \001 to \034 -extended spacing (value * FW/2)
|
||||
* \0 -ends current string
|
||||
*/
|
||||
@@ -106,8 +106,13 @@
|
||||
#define LEN_TARANIS_PROTOCOLS "\004"
|
||||
#define TR_TARANIS_PROTOCOLS "AUS\0""PPM\0""XJT\0""DSM2"
|
||||
|
||||
#define LEN_XJT_PROTOCOLS "\004"
|
||||
#define TR_XJT_PROTOCOLS "AUS\0""X16\0""D8\0 ""LR12"
|
||||
#if defined(MODULE_D16_EU_ONLY_SUPPORT)
|
||||
#define LEN_XJT_PROTOCOLS "\006"
|
||||
#define TR_XJT_PROTOCOLS "AUS\0 ""D16-EU"
|
||||
#else
|
||||
#define LEN_XJT_PROTOCOLS "\004"
|
||||
#define TR_XJT_PROTOCOLS "AUS\0""X16\0""D8\0 ""LR12"
|
||||
#endif
|
||||
|
||||
#define LEN_DSM_PROTOCOLS "\004"
|
||||
#define TR_DSM_PROTOCOLS "LP45""DSM2""DSMX"
|
||||
@@ -512,7 +517,7 @@
|
||||
#define TR_RESERVE_VSRCRAW "[--]"
|
||||
#define TR_EXTRA_VSRCRAW "Batt""Time" TR_RESERVE_VSRCRAW TR_RESERVE_VSRCRAW TR_RESERVE_VSRCRAW TR_RESERVE_VSRCRAW TR_RESERVE_VSRCRAW "Tmr1""Tmr2""Tmr3"
|
||||
#else
|
||||
#define TR_EXTRA_VSRCRAVTELEMUNITW
|
||||
#define TR_EXTRA_VSRCRAW
|
||||
#endif
|
||||
|
||||
#define TR_VSRCRAW "---\0" TR_STICKS_VSRCRAW TR_POTS_VSRCRAW TR_ROTARY_ENCODERS "MAX\0" TR_CYC_VSRCRAW TR_TRIMS_VSRCRAW TR_SW_VSRCRAW TR_EXTRA_VSRCRAW
|
||||
@@ -653,7 +658,7 @@
|
||||
#define TR_CV "KV"
|
||||
#define TR_GV "GV"
|
||||
#define TR_ACHANNEL TR("A\004gemessen","A\004Kanal gemessen =>") //9XR-Pro
|
||||
#define TR_RANGE TR(INDENT"Bereich",INDENT"Messbereich") //9XR-Pro
|
||||
#define TR_RANGE TR(INDENT"Bereich", INDENT "Reichweite") // 9XR-Pro
|
||||
#define TR_BAR "Streifen"
|
||||
#define TR_ALARM INDENT"Alarm"
|
||||
#define TR_USRDATA "Daten berechnen aus"
|
||||
|
||||
@@ -45,8 +45,8 @@
|
||||
|
||||
/* Formatting octal codes available in TR_ strings:
|
||||
* \037\x -sets LCD x-coord (x value in octal)
|
||||
* \n -newline
|
||||
* \t -horizontal tab (ARM only)
|
||||
* \036 -newline
|
||||
* \035 -horizontal tab (ARM only)
|
||||
* \001 to \034 -extended spacing (value * FW/2)
|
||||
* \0 -ends current string
|
||||
*/
|
||||
|
||||
@@ -35,8 +35,8 @@
|
||||
*/
|
||||
/* Formatting octal codes available in TR_ strings:
|
||||
* \037\x -sets LCD x-coord (x value in octal)
|
||||
* \n -newline
|
||||
* \t -horizontal tab (ARM only)
|
||||
* \036 -newline
|
||||
* \035 -horizontal tab (ARM only)
|
||||
* \001 to \034 -extended spacing (value * FW/2)
|
||||
* \0 -ends current string
|
||||
*/
|
||||
|
||||
@@ -35,8 +35,8 @@
|
||||
*/
|
||||
/* Formatting octal codes available in TR_ strings:
|
||||
* \037\x -sets LCD x-coord (x value in octal)
|
||||
* \n -newline
|
||||
* \t -horizontal tab (ARM only)
|
||||
* \036 -newline
|
||||
* \035 -horizontal tab (ARM only)
|
||||
* \001 to \034 -extended spacing (value * FW/2)
|
||||
* \0 -ends current string
|
||||
*/
|
||||
|
||||
@@ -32,8 +32,8 @@
|
||||
*/
|
||||
/* Formatting octal codes available in TR_ strings:
|
||||
* \037\x -sets LCD x-coord (x value in octal)
|
||||
* \n -newline
|
||||
* \t -horizontal tab (ARM only)
|
||||
* \036 -newline
|
||||
* \035 -horizontal tab (ARM only)
|
||||
* \001 to \034 -extended spacing (value * FW/2)
|
||||
* \0 -ends current string
|
||||
*/
|
||||
|
||||
@@ -35,8 +35,8 @@
|
||||
*/
|
||||
/* Formatting octal codes available in TR_ strings:
|
||||
* \037\x -sets LCD x-coord (x value in octal)
|
||||
* \n -newline
|
||||
* \t -horizontal tab (ARM only)
|
||||
* \036 -newline
|
||||
* \035 -horizontal tab (ARM only)
|
||||
* \001 to \034 -extended spacing (value * FW/2)
|
||||
* \0 -ends current string
|
||||
*/
|
||||
|
||||
@@ -47,8 +47,8 @@
|
||||
|
||||
/* Formatting octal codes available in TR_ strings:
|
||||
* \037\x -sets LCD x-coord (x value in octal)
|
||||
* \n -newline
|
||||
* \t -horizontal tab (ARM only)
|
||||
* \036 -newline
|
||||
* \035 -horizontal tab (ARM only)
|
||||
* \001 to \034 -extended spacing (value * FW/2)
|
||||
* \0 -ends current string
|
||||
*/
|
||||
|
||||
@@ -35,8 +35,8 @@
|
||||
*/
|
||||
/* Formatting octal codes available in TR_ strings:
|
||||
* \037\x -sets LCD x-coord (x value in octal)
|
||||
* \n -newline
|
||||
* \t -horizontal tab (ARM only)
|
||||
* \036 -newline
|
||||
* \035 -horizontal tab (ARM only)
|
||||
* \001 to \034 -extended spacing (value * FW/2)
|
||||
* \0 -ends current string
|
||||
*/
|
||||
|
||||
@@ -35,8 +35,8 @@
|
||||
*/
|
||||
/* Formatting octal codes available in TR_ strings:
|
||||
* \037\x -sets LCD x-coord (x value in octal)
|
||||
* \n -newline
|
||||
* \t -horizontal tab (ARM only)
|
||||
* \036 -newline
|
||||
* \035 -horizontal tab (ARM only)
|
||||
* \001 to \034 -extended spacing (value * FW/2)
|
||||
* \0 -ends current string
|
||||
*/
|
||||
|
||||
+1
-1
@@ -141,7 +141,7 @@ void varioWakeup()
|
||||
}
|
||||
#endif
|
||||
|
||||
#else // defined(AUDIO)
|
||||
#elif defined(BUZZER) // && !defined(AUDIO)
|
||||
|
||||
int8_t verticalSpeed = limit((int16_t)-100, (int16_t)(frskyData.hub.varioSpeed/10), (int16_t)+100);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user