Merge branch 'next' of https://github.com/opentx/opentx into kilrah/Switch_and_pot_warnings
Conflicts: companion/src/firmwares/opentx/opentxeeprom.cpp radio/src/gui/menu_model.cpp radio/src/opentx.cpp radio/src/telemetry/frsky.cpp radio/src/translations.cpp radio/src/translations.h radio/src/translations/cz.h.txt radio/src/translations/de.h.txt radio/src/translations/en.h radio/src/translations/es.h.txt radio/src/translations/fr.h.txt radio/src/translations/it.h.txt radio/src/translations/pl.h.txt radio/src/translations/pt.h.txt radio/src/translations/se.h.txt
This commit is contained in:
+131
-20
@@ -62,7 +62,7 @@ LanguagePack * languagePacks[] = {
|
||||
&itLanguagePack,
|
||||
&plLanguagePack,
|
||||
&ptLanguagePack,
|
||||
&skLanguagePack,
|
||||
&skLanguagePack,
|
||||
&seLanguagePack,
|
||||
NULL
|
||||
};
|
||||
@@ -75,7 +75,7 @@ enum EnumTabDiag {
|
||||
e_Vers,
|
||||
e_Keys,
|
||||
e_Ana,
|
||||
IF_PCBSKY9X(e_Hardware)
|
||||
IF_CPUARM(e_Hardware)
|
||||
e_Calib
|
||||
};
|
||||
|
||||
@@ -95,7 +95,7 @@ const MenuFuncP_PROGMEM menuTabDiag[] PROGMEM = {
|
||||
menuGeneralVersion,
|
||||
menuGeneralDiagKeys,
|
||||
menuGeneralDiagAna,
|
||||
IF_PCBSKY9X(menuGeneralHardware)
|
||||
IF_CPUARM(menuGeneralHardware)
|
||||
menuGeneralCalib
|
||||
};
|
||||
|
||||
@@ -258,7 +258,7 @@ void menuGeneralSetup(uint8_t event)
|
||||
|
||||
case ITEM_SETUP_TIME:
|
||||
lcd_putsLeft(y, STR_TIME);
|
||||
lcd_putc(RADIO_SETUP_TIME_COLUMN-1, y, ':'); lcd_putc(RADIO_SETUP_TIME_COLUMN+3*FW-4, y, ':');
|
||||
lcd_putc(RADIO_SETUP_TIME_COLUMN+1, y, ':'); lcd_putc(RADIO_SETUP_TIME_COLUMN+3*FW-2, y, ':');
|
||||
for (uint8_t j=0; j<3; j++) {
|
||||
uint8_t rowattr = (m_posHorz==j ? attr : 0);
|
||||
switch (j) {
|
||||
@@ -1065,13 +1065,14 @@ void menuGeneralDiagKeys(uint8_t event)
|
||||
lcd_puts(14*FW, 3*FH, STR_VTRIM);
|
||||
|
||||
for(uint8_t i=0; i<9; i++) {
|
||||
uint8_t y = i*FH; //+FH;
|
||||
#if !defined(PCBTARANIS)
|
||||
if(i>(SW_ID0-SW_BASE)) y-=FH; //overwrite ID0
|
||||
uint8_t y = i*FH-FH;
|
||||
if(i==(SW_ID0-SW_BASE)) continue; //ignore ID0
|
||||
putsSwitches(8*FW, y, i+1, 0); //ohne off,on
|
||||
displayKeyState(11*FW+2, y, (EnumKeys)(SW_BASE+i));
|
||||
#endif
|
||||
|
||||
#else
|
||||
uint8_t y = i*FH;
|
||||
#endif
|
||||
if (i<8) {
|
||||
y = i/2*FH+FH*4;
|
||||
lcd_img(14*FW, y, sticks, i/2, 0);
|
||||
@@ -1113,7 +1114,7 @@ void menuGeneralDiagAna(uint8_t event)
|
||||
uint8_t y = 1+FH+(i/2)*FH;
|
||||
uint8_t x = i&1 ? 64+5 : 0;
|
||||
putsStrIdx(x, y, PSTR("A"), i+1);
|
||||
lcd_putc(x+2*FWNUM, y, ':');
|
||||
lcd_putc(lcdNextPos, y, ':');
|
||||
lcd_outhex4(x+3*FW-1, y, anaIn(i));
|
||||
lcd_outdez8(x+10*FW-1, y, (int16_t)calibratedStick[CONVERT_MODE(i)]*25/256);
|
||||
}
|
||||
@@ -1165,7 +1166,48 @@ void menuGeneralDiagAna(uint8_t event)
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(PCBSKY9X)
|
||||
#if defined(PCBTARANIS)
|
||||
enum menuGeneralHwItems {
|
||||
ITEM_SETUP_HW_POT1,
|
||||
ITEM_SETUP_HW_POT2,
|
||||
ITEM_SETUP_HW_UART3_MODE,
|
||||
ITEM_SETUP_HW_MAX
|
||||
};
|
||||
|
||||
#define HW_SETTINGS_COLUMN 15*FW
|
||||
|
||||
void menuGeneralHardware(uint8_t event)
|
||||
{
|
||||
MENU(STR_HARDWARE, menuTabDiag, e_Hardware, ITEM_SETUP_HW_MAX+1, {0});
|
||||
|
||||
uint8_t sub = m_posVert - 1;
|
||||
|
||||
for (uint8_t i=0; i<ITEM_SETUP_HW_MAX; i++) {
|
||||
uint8_t y = 1 + 1*FH + i*FH;
|
||||
uint8_t attr = (sub == i ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0);
|
||||
switch(i) {
|
||||
case ITEM_SETUP_HW_POT1:
|
||||
case ITEM_SETUP_HW_POT2:
|
||||
{
|
||||
int idx = i - ITEM_SETUP_HW_POT1;
|
||||
uint8_t mask = (1<<idx);
|
||||
uint8_t potType = selectMenuItem(HW_SETTINGS_COLUMN, y, i==ITEM_SETUP_HW_POT1 ? STR_POT1TYPE : STR_POT2TYPE, STR_POTTYPES, (g_eeGeneral.potsType & mask) >> idx, 0, 1, attr, event);
|
||||
if (potType)
|
||||
g_eeGeneral.potsType |= mask;
|
||||
else
|
||||
g_eeGeneral.potsType &= ~mask;
|
||||
break;
|
||||
}
|
||||
|
||||
case ITEM_SETUP_HW_UART3_MODE:
|
||||
g_eeGeneral.hw_uartMode = selectMenuItem(HW_SETTINGS_COLUMN, y, STR_UART3MODE, STR_UART3MODES, g_eeGeneral.hw_uartMode, 0, 2, attr, event);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#elif defined(PCBSKY9X)
|
||||
enum menuGeneralHwItems {
|
||||
ITEM_SETUP_HW_OPTREX_DISPLAY,
|
||||
ITEM_SETUP_HW_STICKS_GAINS_LABELS,
|
||||
@@ -1238,19 +1280,48 @@ void menuGeneralHardware(uint8_t event)
|
||||
}
|
||||
#endif
|
||||
|
||||
#define XPOT_DELTA 5
|
||||
|
||||
void menuCommonCalib(uint8_t event)
|
||||
{
|
||||
for (uint8_t i=0; i<NUM_STICKS+NUM_POTS; i++) { //get low and high vals for sticks and trims
|
||||
for (uint8_t i=0; i<NUM_STICKS+NUM_POTS; i++) { // get low and high vals for sticks and trims
|
||||
int16_t vt = anaIn(i);
|
||||
reusableBuffer.calib.loVals[i] = min(vt, reusableBuffer.calib.loVals[i]);
|
||||
reusableBuffer.calib.hiVals[i] = max(vt, reusableBuffer.calib.hiVals[i]);
|
||||
#if defined(PCBTARANIS)
|
||||
if(i >= NUM_STICKS && i < NUM_STICKS+NUM_POTS-2) {
|
||||
#else
|
||||
if (i >= NUM_STICKS) {
|
||||
#endif
|
||||
if (i >= POT1 && i <= POT_LAST) {
|
||||
reusableBuffer.calib.midVals[i] = (reusableBuffer.calib.hiVals[i] + reusableBuffer.calib.loVals[i]) / 2;
|
||||
#if defined(PCBTARANIS)
|
||||
uint8_t idx = i - POT1;
|
||||
int count = reusableBuffer.calib.xpotsCalib[idx].stepsCount;
|
||||
if (IS_MULTIPOS_POT(i) && count <= POTS_POS_COUNT) {
|
||||
if (reusableBuffer.calib.xpotsCalib[idx].lastCount == 0 || vt < reusableBuffer.calib.xpotsCalib[idx].lastPosition - XPOT_DELTA || vt > reusableBuffer.calib.xpotsCalib[idx].lastPosition + XPOT_DELTA) {
|
||||
reusableBuffer.calib.xpotsCalib[idx].lastPosition = vt;
|
||||
reusableBuffer.calib.xpotsCalib[idx].lastCount = 1;
|
||||
}
|
||||
else {
|
||||
if (reusableBuffer.calib.xpotsCalib[idx].lastCount < 255) reusableBuffer.calib.xpotsCalib[idx].lastCount++;
|
||||
}
|
||||
if (reusableBuffer.calib.xpotsCalib[idx].lastCount == 8/*80ms*/) {
|
||||
int16_t position = reusableBuffer.calib.xpotsCalib[idx].lastPosition;
|
||||
bool found = false;
|
||||
for (int j=0; j<count; j++) {
|
||||
if (position >= reusableBuffer.calib.xpotsCalib[idx].steps[j]-XPOT_DELTA && position <= reusableBuffer.calib.xpotsCalib[idx].steps[j]+XPOT_DELTA) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
if (count < POTS_POS_COUNT) {
|
||||
reusableBuffer.calib.xpotsCalib[idx].steps[count] = position;
|
||||
}
|
||||
else {
|
||||
g_eeGeneral.potsType &= !(1<<idx);
|
||||
}
|
||||
reusableBuffer.calib.xpotsCalib[idx].stepsCount += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1284,6 +1355,12 @@ void menuCommonCalib(uint8_t event)
|
||||
reusableBuffer.calib.loVals[i] = 15000;
|
||||
reusableBuffer.calib.hiVals[i] = -15000;
|
||||
reusableBuffer.calib.midVals[i] = anaIn(i);
|
||||
#if defined(PCBTARANIS)
|
||||
if (i<NUM_XPOTS) {
|
||||
reusableBuffer.calib.xpotsCalib[i].stepsCount = 0;
|
||||
reusableBuffer.calib.xpotsCalib[i].lastCount = 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1294,17 +1371,37 @@ void menuCommonCalib(uint8_t event)
|
||||
lcd_putsLeft(3*FH, STR_MENUWHENDONE);
|
||||
|
||||
for (uint8_t i=0; i<NUM_STICKS+NUM_POTS; i++) {
|
||||
if (abs(reusableBuffer.calib.loVals[i]-reusableBuffer.calib.hiVals[i])>50) {
|
||||
g_eeGeneral.calibMid[i] = reusableBuffer.calib.midVals[i];
|
||||
if (abs(reusableBuffer.calib.loVals[i]-reusableBuffer.calib.hiVals[i]) > 50) {
|
||||
g_eeGeneral.calib[i].mid = reusableBuffer.calib.midVals[i];
|
||||
int16_t v = reusableBuffer.calib.midVals[i] - reusableBuffer.calib.loVals[i];
|
||||
g_eeGeneral.calibSpanNeg[i] = v - v/STICK_TOLERANCE;
|
||||
g_eeGeneral.calib[i].spanNeg = v - v/STICK_TOLERANCE;
|
||||
v = reusableBuffer.calib.hiVals[i] - reusableBuffer.calib.midVals[i];
|
||||
g_eeGeneral.calibSpanPos[i] = v - v/STICK_TOLERANCE;
|
||||
g_eeGeneral.calib[i].spanPos = v - v/STICK_TOLERANCE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 3:
|
||||
#if defined(PCBTARANIS)
|
||||
for (uint8_t i=POT1; i<=POT_LAST; i++) {
|
||||
int idx = i - POT1;
|
||||
int count = reusableBuffer.calib.xpotsCalib[idx].stepsCount;
|
||||
if (IS_MULTIPOS_POT(i) && count > 1 && count <= POTS_POS_COUNT) {
|
||||
for (int j=0; j<count; j++) {
|
||||
for (int k=j+1; k<count; k++) {
|
||||
if (reusableBuffer.calib.xpotsCalib[idx].steps[k] < reusableBuffer.calib.xpotsCalib[idx].steps[j]) {
|
||||
swap(reusableBuffer.calib.xpotsCalib[idx].steps[j], reusableBuffer.calib.xpotsCalib[idx].steps[k]);
|
||||
}
|
||||
}
|
||||
}
|
||||
StepsCalibData * calib = (StepsCalibData *) &g_eeGeneral.calib[i];
|
||||
calib->count = count - 1;
|
||||
for (int j=0; j<calib->count; j++) {
|
||||
calib->steps[j] = (reusableBuffer.calib.xpotsCalib[idx].steps[j+1] + reusableBuffer.calib.xpotsCalib[idx].steps[j]) >> 5;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
g_eeGeneral.chkSum = evalChkSum();
|
||||
eeDirty(EE_GENERAL);
|
||||
reusableBuffer.calib.state = 4;
|
||||
@@ -1316,8 +1413,22 @@ void menuCommonCalib(uint8_t event)
|
||||
}
|
||||
|
||||
doMainScreenGraphics();
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
drawPotsBars();
|
||||
for (int i=POT1; i<=POT_LAST; i++) {
|
||||
uint8_t steps = 0;
|
||||
if (reusableBuffer.calib.state == 2) {
|
||||
steps = reusableBuffer.calib.xpotsCalib[i-POT1].stepsCount;
|
||||
}
|
||||
else if (IS_MULTIPOS_POT(i)) {
|
||||
StepsCalibData * calib = (StepsCalibData *) &g_eeGeneral.calib[i];
|
||||
steps = calib->count + 1;
|
||||
}
|
||||
if (steps > 0 && steps <= POTS_POS_COUNT) {
|
||||
lcd_outdezAtt(LCD_W/2-2+(i-POT1)*5, LCD_H-6, steps, TINSIZE);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -769,7 +769,12 @@ void editName(uint8_t x, uint8_t y, char *name, uint8_t size, uint8_t event, uin
|
||||
lcd_putsLeft(y, STR_NAME);
|
||||
#endif
|
||||
|
||||
lcd_putsnAtt(x, y, name, size, ZCHAR | ((active && s_editMode <= 0) ? INVERS : 0));
|
||||
uint8_t mode = 0;
|
||||
if (active) {
|
||||
if (s_editMode <= 0) mode = INVERS+FIXEDWIDTH;
|
||||
else mode = FIXEDWIDTH;
|
||||
}
|
||||
lcd_putsnAtt(x, y, name, size, ZCHAR | mode);
|
||||
|
||||
if (active) {
|
||||
uint8_t cur = editNameCursorPos;
|
||||
@@ -832,7 +837,7 @@ void editName(uint8_t x, uint8_t y, char *name, uint8_t size, uint8_t event, uin
|
||||
name[cur] = v;
|
||||
eeDirty(EE_MODEL);
|
||||
}
|
||||
lcd_putcAtt(x+editNameCursorPos*FW, y, idx2char(v), INVERS);
|
||||
lcd_putcAtt(x+editNameCursorPos*FW, y, idx2char(v), INVERS+FIXEDWIDTH);
|
||||
}
|
||||
else {
|
||||
cur = 0;
|
||||
@@ -1061,7 +1066,7 @@ void menuModelSetup(uint8_t event)
|
||||
div_t qr = div(timer->start, 60);
|
||||
switch (m_posHorz) {
|
||||
case 0:
|
||||
CHECK_INCDEC_MODELVAR(event, timer->mode, -2*(MAX_PSWITCH+NUM_CSW), TMR_VAROFS-1+2*(MAX_PSWITCH+NUM_CSW));
|
||||
CHECK_INCDEC_MODELVAR(event, timer->mode, -2*(NUM_PSWITCH+NUM_CSW), TMR_VAROFS-1+2*(NUM_PSWITCH+NUM_CSW));
|
||||
break;
|
||||
case 1:
|
||||
CHECK_INCDEC_MODELVAR_ZERO(event, qr.quot, 59);
|
||||
@@ -1113,7 +1118,7 @@ void menuModelSetup(uint8_t event)
|
||||
break;
|
||||
|
||||
case ITEM_MODEL_TRIM_INC:
|
||||
g_model.trimInc = selectMenuItem(MODEL_SETUP_2ND_COLUMN, y, STR_TRIMINC, STR_VTRIMINC, g_model.trimInc, 0, 4, attr, event);
|
||||
g_model.trimInc = selectMenuItem(MODEL_SETUP_2ND_COLUMN, y, STR_TRIMINC, STR_VTRIMINC, g_model.trimInc, -2, 2, attr, event);
|
||||
break;
|
||||
|
||||
case ITEM_MODEL_THROTTLE_REVERSED:
|
||||
@@ -1910,7 +1915,7 @@ void menuModelFlightModesAll(uint8_t event)
|
||||
}
|
||||
else {
|
||||
putsSwitches((5+LEN_FP_NAME)*FW+FW/2, y, p->swtch, attr);
|
||||
if (active) CHECK_INCDEC_MODELSWITCH(event, p->swtch, -MAX_SWITCH, MAX_SWITCH);
|
||||
if (active) CHECK_INCDEC_MODELSWITCH(event, p->swtch, -NUM_SWITCH, NUM_SWITCH);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -2958,7 +2963,7 @@ void menuModelExpoOne(uint8_t event)
|
||||
{
|
||||
#if defined(PCBTARANIS)
|
||||
case EXPO_FIELD_INPUT_NAME:
|
||||
editSingleName(EXPO_ONE_2ND_COLUMN, y, "Input Name", g_model.inputNames[ed->chn], sizeof(g_model.inputNames[ed->chn]), event, attr);
|
||||
editSingleName(EXPO_ONE_2ND_COLUMN, y, STR_INPUTNAME, g_model.inputNames[ed->chn], sizeof(g_model.inputNames[ed->chn]), event, attr);
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -3384,8 +3389,8 @@ void displayHeaderChannelName(uint8_t ch)
|
||||
uint8_t len = zlen(g_model.limitData[ch-1].name, sizeof(g_model.limitData[ch-1].name));
|
||||
if (len) {
|
||||
lcd_putc(17*FW, 0, ' ');
|
||||
lcd_putsnAtt(18*FW, 0, g_model.limitData[ch-1].name, len, ZCHAR);
|
||||
lcd_putc(18*FW+len*FW, 0, ' ');
|
||||
lcd_putsnAtt(lcdNextPos, 0, g_model.limitData[ch-1].name, len, ZCHAR);
|
||||
lcd_putc(lcdNextPos, 0, ' ');
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -3627,9 +3632,9 @@ void menuModelExpoMix(uint8_t expo, uint8_t event)
|
||||
|
||||
if (mixCnt > 0) lcd_putsiAtt(FW, y, STR_VMLTPX2, md->mltpx, 0);
|
||||
|
||||
putsMixerSource(MIX_LINE_SRC_POS, y, md->srcRaw, isMixActive(i) ? BOLD : 0);
|
||||
putsMixerSource(MIX_LINE_SRC_POS, y, md->srcRaw, 0);
|
||||
|
||||
gvarWeightItem(MIX_LINE_WEIGHT_POS, y, md, attr, event);
|
||||
gvarWeightItem(MIX_LINE_WEIGHT_POS, y, md, attr | (isMixActive(i) ? BOLD : 0), event);
|
||||
|
||||
#if LCD_W >= 212
|
||||
displayFlightModes(EXPO_LINE_FM_POS, y, md->phases);
|
||||
@@ -3820,8 +3825,10 @@ enum LimitsItems {
|
||||
#define MIN_MAX_DISPLAY(x) CONVERT_US_MIN_MAX(x)
|
||||
#undef MIN_MAX_ATTR
|
||||
#define MIN_MAX_ATTR attr
|
||||
#else
|
||||
#elif defined(CPUARM)
|
||||
#define MIN_MAX_DISPLAY(x) (x)
|
||||
#else
|
||||
#define MIN_MAX_DISPLAY(x) ((int8_t)(x))
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
@@ -4365,7 +4372,7 @@ void menuModelCustomSwitchOne(uint8_t event)
|
||||
case CSW_FIELD_ANDSW:
|
||||
lcd_putsLeft(y, STR_AND_SWITCH);
|
||||
putsSwitches(CSWONE_2ND_COLUMN, y, cs->andsw, attr);
|
||||
if (attr) CHECK_INCDEC_MODELVAR(event, cs->andsw, -MAX_SWITCH, MAX_SWITCH);
|
||||
if (attr) CHECK_INCDEC_MODELVAR(event, cs->andsw, -NUM_SWITCH, NUM_SWITCH);
|
||||
break;
|
||||
case CSW_FIELD_DURATION:
|
||||
lcd_putsLeft(y, STR_DURATION);
|
||||
@@ -5008,11 +5015,13 @@ void menuModelCustomFunctions(uint8_t event)
|
||||
break;
|
||||
|
||||
case 3:
|
||||
if (sd->swtch && (CFN_FUNC(sd) <= FUNC_INSTANT_TRIM
|
||||
if (sd->swtch && (CFN_FUNC(sd) <= FUNC_INSTANT_TRIM || CFN_FUNC(sd) == FUNC_RESET
|
||||
#if defined(GVARS)
|
||||
// TODO #define
|
||||
|| CFN_FUNC(sd) >= FUNC_ADJUST_GV1
|
||||
#endif
|
||||
#if defined(CPUARM)
|
||||
// TODO #define
|
||||
|| CFN_FUNC(sd) == FUNC_VOLUME
|
||||
#endif
|
||||
)) {
|
||||
@@ -5242,6 +5251,9 @@ enum menuModelTelemetryItems {
|
||||
#endif
|
||||
ITEM_TELEMETRY_USR_VOLTAGE_SOURCE,
|
||||
ITEM_TELEMETRY_USR_CURRENT_SOURCE,
|
||||
#if defined(FAS_OFFSET) || !defined(CPUM64)
|
||||
ITEM_TELEMETRY_FAS_OFFSET,
|
||||
#endif
|
||||
#if defined(CPUARM)
|
||||
ITEM_TELEMTETRY_PERSISTENT_MAH,
|
||||
#endif
|
||||
@@ -5322,9 +5334,15 @@ enum menuModelTelemetryItems {
|
||||
#define VARIO_RANGE_ROWS 3
|
||||
#endif
|
||||
|
||||
#if defined(FAS_OFFSET) || !defined(CPUM64)
|
||||
#define IF_FAS_OFFSET(x) x,
|
||||
#else
|
||||
#define IF_FAS_OFFSET(x)
|
||||
#endif
|
||||
|
||||
void menuModelTelemetry(uint8_t event)
|
||||
{
|
||||
MENU(STR_MENUTELEMETRY, menuTabModel, e_Telemetry, ITEM_TELEMETRY_MAX+1, {0, CHANNEL_ROWS CHANNEL_ROWS RSSI_ROWS USRDATA_LINES 0, 0, IF_CPUARM(0) IF_VARIO(LABEL(Vario)) IF_VARIO(0) IF_VARIO(VARIO_RANGE_ROWS) CASE_PCBTARANIS(LABEL(TopBar)) CASE_PCBTARANIS(0) SCREEN_TYPE_ROWS, 2, 2, 2, 2, SCREEN_TYPE_ROWS, 2, 2, 2, 2, IF_CPUARM(SCREEN_TYPE_ROWS) IF_CPUARM(2) IF_CPUARM(2) IF_CPUARM(2) IF_CPUARM(2) });
|
||||
MENU(STR_MENUTELEMETRY, menuTabModel, e_Telemetry, ITEM_TELEMETRY_MAX+1, {0, CHANNEL_ROWS CHANNEL_ROWS RSSI_ROWS USRDATA_LINES 0, 0, IF_FAS_OFFSET(0) IF_CPUARM(0) IF_VARIO(LABEL(Vario)) IF_VARIO(0) IF_VARIO(VARIO_RANGE_ROWS) CASE_PCBTARANIS(LABEL(TopBar)) CASE_PCBTARANIS(0) SCREEN_TYPE_ROWS, 2, 2, 2, 2, SCREEN_TYPE_ROWS, 2, 2, 2, 2, IF_CPUARM(SCREEN_TYPE_ROWS) IF_CPUARM(2) IF_CPUARM(2) IF_CPUARM(2) IF_CPUARM(2) });
|
||||
|
||||
uint8_t sub = m_posVert - 1;
|
||||
|
||||
@@ -5478,8 +5496,12 @@ void menuModelTelemetry(uint8_t event)
|
||||
|
||||
case ITEM_TELEMETRY_USR_BLADES:
|
||||
lcd_putsLeft(y, STR_BLADES);
|
||||
lcd_outdezAtt(TELEM_COL2+FWNUM, y, 2+g_model.frsky.blades, attr);
|
||||
if (attr) CHECK_INCDEC_MODELVAR_ZERO(event, g_model.frsky.blades, 3);
|
||||
lcd_outdezAtt(TELEM_COL2+FWNUM, y, 1+g_model.frsky.blades, attr);
|
||||
#if defined(CPUARM)
|
||||
if (attr) CHECK_INCDEC_MODELVAR(event, g_model.frsky.blades, MIN_BLADES, MAX_BLADES);
|
||||
#else
|
||||
if (attr) CHECK_INCDEC_MODELVAR_ZERO(event, g_model.frsky.blades, MAX_BLADES);
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -5494,6 +5516,16 @@ void menuModelTelemetry(uint8_t event)
|
||||
lcd_putsiAtt(TELEM_COL2, y, STR_VOLTSRC, g_model.frsky.currentSource, attr);
|
||||
if (attr) CHECK_INCDEC_MODELVAR_ZERO(event, g_model.frsky.currentSource, 3);
|
||||
break;
|
||||
|
||||
#if defined(FAS_OFFSET) || !defined(CPUM64)
|
||||
case ITEM_TELEMETRY_FAS_OFFSET:
|
||||
lcd_putsLeft(y, STR_FAS_OFFSET);
|
||||
lcd_outdezAtt(TELEM_COL2, y, g_model.frsky.fasOffset, attr|LEFT|PREC1);
|
||||
lcd_outdezAtt(TELEM_COL2+6*FW, y, frskyData.hub.current, LEFT|PREC1);
|
||||
lcd_putc(TELEM_COL2+8*FW, y, 'A');
|
||||
if (attr) g_model.frsky.fasOffset = checkIncDec(event, g_model.frsky.fasOffset, -15, 15, EE_MODEL);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
case ITEM_TELEMTETRY_PERSISTENT_MAH:
|
||||
@@ -5625,18 +5657,14 @@ void menuModelTelemetry(uint8_t event)
|
||||
lineIndex = k-ITEM_TELEMETRY_SCREEN_LINE5;
|
||||
}
|
||||
|
||||
#if 0
|
||||
putsStrIdx(0, y, PSTR(INDENT"Line"), lineIndex+1, m_posHorz<0 ? attr : 0);
|
||||
#endif
|
||||
|
||||
#if defined(GAUGES)
|
||||
if (IS_BARS_SCREEN(screenIndex)) {
|
||||
FrSkyBarData & bar = g_model.frsky.screens[screenIndex].bars[lineIndex];
|
||||
uint8_t barSource = bar.source;
|
||||
lcd_putsiAtt(TELEM_COL1, y, STR_VTELEMCHNS, barSource, m_posHorz==0 ? attr : 0);
|
||||
if (barSource) {
|
||||
putsTelemetryChannel(TELEM_BARS_COLMIN, y, barSource-1, convertTelemValue(barSource, bar.barMin), (m_posHorz==1 ? attr : 0) | LEFT);
|
||||
putsTelemetryChannel(TELEM_BARS_COLMAX, y, barSource-1, convertTelemValue(barSource, 255-bar.barMax), (m_posHorz==2 ? attr : 0) | LEFT);
|
||||
putsTelemetryChannel(TELEM_BARS_COLMIN, y, barSource-1, convertBarTelemValue(barSource, bar.barMin), (m_posHorz==1 ? attr : 0) | LEFT);
|
||||
putsTelemetryChannel(TELEM_BARS_COLMAX, y, barSource-1, convertBarTelemValue(barSource, 255-bar.barMax), (m_posHorz==2 ? attr : 0) | LEFT);
|
||||
}
|
||||
else if (attr) {
|
||||
MOVE_CURSOR_FROM_HERE();
|
||||
@@ -5647,14 +5675,14 @@ void menuModelTelemetry(uint8_t event)
|
||||
bar.source = checkIncDecModel(event, barSource, 0, TELEM_DISPLAY_MAX);
|
||||
if (checkIncDec_Ret) {
|
||||
bar.barMin = 0;
|
||||
bar.barMax = 255-maxTelemValue(bar.source);
|
||||
bar.barMax = 255 - maxBarTelemValue(bar.source);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
bar.barMin = checkIncDec(event, bar.barMin, 0, 254-bar.barMax, EE_MODEL|NO_INCDEC_MARKS);
|
||||
break;
|
||||
case 2:
|
||||
bar.barMax = 255 - checkIncDec(event, 255-bar.barMax, bar.barMin+1, maxTelemValue(barSource), EE_MODEL|NO_INCDEC_MARKS);
|
||||
bar.barMax = 255 - checkIncDec(event, 255-bar.barMax, bar.barMin+1, maxBarTelemValue(barSource), EE_MODEL|NO_INCDEC_MARKS);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
+19
-6
@@ -232,13 +232,13 @@ int16_t checkIncDec(uint8_t event, int16_t val, int16_t i_min, int16_t i_max, ui
|
||||
if (event == EVT_KEY_LONG(KEY_ENTER) && i_max > SWSRC_ON) {
|
||||
s_editMode = !s_editMode;
|
||||
if (newval > SWSRC_ON)
|
||||
newval -= (MAX_SWITCH+1);
|
||||
newval -= (NUM_SWITCH+1);
|
||||
else if (newval > 0)
|
||||
newval += (MAX_SWITCH+1);
|
||||
newval += (NUM_SWITCH+1);
|
||||
else if (newval < SWSRC_OFF)
|
||||
newval += (MAX_SWITCH+1);
|
||||
newval += (NUM_SWITCH+1);
|
||||
else if (newval < 0)
|
||||
newval -= (MAX_SWITCH+1);
|
||||
newval -= (NUM_SWITCH+1);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -976,7 +976,7 @@ int8_t switchMenuItem(uint8_t x, uint8_t y, int8_t value, LcdFlags attr, uint8_t
|
||||
{
|
||||
lcd_putsColumnLeft(x, y, STR_SWITCH);
|
||||
putsSwitches(x, y, value, attr);
|
||||
if (attr) CHECK_INCDEC_MODELSWITCH(event, value, -MAX_SWITCH, MAX_SWITCH);
|
||||
if (attr) CHECK_INCDEC_MODELSWITCH(event, value, -NUM_SWITCH, NUM_SWITCH);
|
||||
return value;
|
||||
}
|
||||
|
||||
@@ -1263,7 +1263,20 @@ bool isSwitchAvailable(int16_t swtch)
|
||||
swtch = -swtch;
|
||||
}
|
||||
|
||||
if (swtch>=SWSRC_FIRST_CSW && swtch<=SWSRC_LAST_CSW) {
|
||||
#if defined(PCBTARANIS)
|
||||
if (swtch >= SWSRC_P11 && swtch <= SWSRC_P26) {
|
||||
int index = (swtch - SWSRC_P11) / POTS_POS_COUNT;
|
||||
if (g_eeGeneral.potsType & (1<<index)) {
|
||||
StepsCalibData * calib = (StepsCalibData *) &g_eeGeneral.calib[POT1+index];
|
||||
return (calib->count >= ((swtch - SWSRC_P11) % POTS_POS_COUNT));
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (swtch >= SWSRC_FIRST_CSW && swtch <= SWSRC_LAST_CSW) {
|
||||
CustomSwData * cs = cswAddress(swtch-SWSRC_FIRST_CSW);
|
||||
return (cs->func != CS_OFF);
|
||||
}
|
||||
|
||||
@@ -120,9 +120,9 @@
|
||||
void drawPotsBars()
|
||||
{
|
||||
// Optimization by Mike Blandford
|
||||
uint8_t x, y, len ; // declare temporary variables
|
||||
for (x=LCD_W/2-5, y=NUM_STICKS; y<NUM_STICKS+NUM_POTS; x+=5, y++) {
|
||||
len = ((calibratedStick[y]+RESX)*BAR_HEIGHT/(RESX*2))+1l; // calculate once per loop
|
||||
uint8_t x, i, len ; // declare temporary variables
|
||||
for (x=LCD_W/2-5, i=NUM_STICKS; i<NUM_STICKS+NUM_POTS; x+=5, i++) {
|
||||
len = ((calibratedStick[i]+RESX)*BAR_HEIGHT/(RESX*2))+1l; // calculate once per loop
|
||||
V_BAR(x, LCD_H-8, len)
|
||||
}
|
||||
}
|
||||
@@ -318,7 +318,7 @@ void displayTopBar()
|
||||
/* RTC time */
|
||||
struct gtm t;
|
||||
gettime(&t);
|
||||
lcd_putcAtt(BAR_TIME_X-1, BAR_Y+1, ':', BLINK);
|
||||
lcd_putcAtt(BAR_TIME_X+1, BAR_Y+1, ':', BLINK);
|
||||
lcd_outdezNAtt(BAR_TIME_X+1, BAR_Y+1, t.tm_hour, LEADING0, 2);
|
||||
lcd_outdezNAtt(BAR_TIME_X+3*FWNUM-1, BAR_Y+1, t.tm_min, LEADING0, 2);
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ void displayRssiLine()
|
||||
if (TELEMETRY_STREAMING()) {
|
||||
lcd_hline(0, 55, 212, 0); // separator
|
||||
uint8_t rssi = min((uint8_t)99, frskyData.rssi[0].value);
|
||||
lcd_putsLeft(STATUS_BAR_Y, STR_RX); lcd_outdezNAtt(4*FW, STATUS_BAR_Y, rssi, LEADING0, 2);
|
||||
lcd_putsn(0, STATUS_BAR_Y, STR_RX, 2); lcd_outdezNAtt(4*FW, STATUS_BAR_Y, rssi, LEADING0, 2);
|
||||
lcd_rect(25, 57, 78, 7);
|
||||
lcd_filled_rect(26, 58, 19*rssi/25, 5, (rssi < getRssiAlarmValue(0)) ? DOTTED : SOLID);
|
||||
}
|
||||
@@ -100,9 +100,9 @@ void displayGpsTime()
|
||||
{
|
||||
uint8_t att = (TELEMETRY_STREAMING() ? LEFT|LEADING0 : LEFT|LEADING0|BLINK);
|
||||
lcd_outdezNAtt(CENTER_OFS+6*FW+5, STATUS_BAR_Y, frskyData.hub.hour, att, 2);
|
||||
lcd_putcAtt(CENTER_OFS+8*FW+2, STATUS_BAR_Y, ':', att);
|
||||
lcd_putcAtt(CENTER_OFS+8*FW+4, STATUS_BAR_Y, ':', att);
|
||||
lcd_outdezNAtt(CENTER_OFS+9*FW+2, STATUS_BAR_Y, frskyData.hub.min, att, 2);
|
||||
lcd_putcAtt(CENTER_OFS+11*FW-1, STATUS_BAR_Y, ':', att);
|
||||
lcd_putcAtt(CENTER_OFS+11*FW+1, STATUS_BAR_Y, ':', att);
|
||||
lcd_outdezNAtt(CENTER_OFS+12*FW-1, STATUS_BAR_Y, frskyData.hub.sec, att, 2);
|
||||
lcd_status_line();
|
||||
}
|
||||
@@ -214,8 +214,8 @@ void menuTelemetryFrsky(uint8_t event)
|
||||
for (int8_t i=3; i>=0; i--) {
|
||||
FrSkyBarData & bar = screen.bars[i];
|
||||
uint8_t source = bar.source;
|
||||
getvalue_t barMin = convertTelemValue(source, bar.barMin);
|
||||
getvalue_t barMax = convertTelemValue(source, 255-bar.barMax);
|
||||
getvalue_t barMin = convertBarTelemValue(source, bar.barMin);
|
||||
getvalue_t barMax = convertBarTelemValue(source, 255-bar.barMax);
|
||||
if (source && barMax > barMin) {
|
||||
uint8_t y = barHeight+6+i*(barHeight+6);
|
||||
lcd_putsiAtt(0, y+barHeight-5, STR_VTELEMCHNS, source, 0);
|
||||
@@ -234,7 +234,7 @@ void menuTelemetryFrsky(uint8_t event)
|
||||
threshold = g_model.frsky.channels[source-TELEM_A1].alarms_value[0];
|
||||
#if defined(FRSKY_HUB)
|
||||
else
|
||||
threshold = convertTelemValue(source, barsThresholds[source-TELEM_ALT]);
|
||||
threshold = convertBarTelemValue(source, barsThresholds[source-TELEM_ALT]);
|
||||
#endif
|
||||
|
||||
if (threshold) {
|
||||
|
||||
Reference in New Issue
Block a user