Curve names used instead of CV<X> when available

This commit is contained in:
Bertrand Songis
2016-01-14 23:13:26 +01:00
parent 0dd15ebbab
commit a1883db889
37 changed files with 114 additions and 108 deletions
+8 -8
View File
@@ -638,7 +638,7 @@ void putsVBat(coord_t x, coord_t y, LcdFlags att)
putsVolts(x, y, g_vbat100mV, att);
}
void putsStrIdx(coord_t x, coord_t y, const pm_char *str, uint8_t idx, LcdFlags att)
void drawStringWithIndex(coord_t x, coord_t y, const pm_char *str, uint8_t idx, LcdFlags att)
{
lcdDrawText(x, y, str, att & ~LEADING0);
lcdDrawNumber(lcdNextPos, y, idx, att|LEFT, 2);
@@ -653,13 +653,13 @@ void putsMixerSource(coord_t x, coord_t y, uint8_t idx, LcdFlags att)
else if (idx <= MIXSRC_LAST_LOGICAL_SWITCH)
putsSwitches(x, y, SWSRC_SW1+idx-MIXSRC_SW1, att);
else if (idx < MIXSRC_CH1)
putsStrIdx(x, y, STR_PPM_TRAINER, idx-MIXSRC_FIRST_TRAINER+1, att);
drawStringWithIndex(x, y, STR_PPM_TRAINER, idx-MIXSRC_FIRST_TRAINER+1, att);
else if (idx <= MIXSRC_LAST_CH) {
putsStrIdx(x, y, STR_CH, idx-MIXSRC_CH1+1, att);
drawStringWithIndex(x, y, STR_CH, idx-MIXSRC_CH1+1, att);
}
#if defined(GVARS) || !defined(PCBSTD)
else if (idx <= MIXSRC_LAST_GVAR)
putsStrIdx(x, y, STR_GV, idx-MIXSRC_GVAR1+1, att);
drawStringWithIndex(x, y, STR_GV, idx-MIXSRC_GVAR1+1, att);
#endif
else if (idx < MIXSRC_FIRST_TELEM) {
lcdDrawTextAtIndex(x, y, STR_VSRCRAW, idx-MIXSRC_Rud+1-(MIXSRC_SW1-MIXSRC_THR)-NUM_LOGICAL_SWITCH-NUM_TRAINER-NUM_CHNOUT-MAX_GVARS, att);
@@ -687,7 +687,7 @@ void putsModelName(coord_t x, coord_t y, char *name, uint8_t id, LcdFlags att)
uint8_t len = sizeof(g_model.header.name);
while (len>0 && !name[len-1]) --len;
if (len==0) {
putsStrIdx(x, y, STR_MODEL, id+1, att|LEADING0);
drawStringWithIndex(x, y, STR_MODEL, id+1, att|LEADING0);
}
else {
lcdDrawSizedText(x, y, name, sizeof(g_model.header.name), ZCHAR|att);
@@ -704,7 +704,7 @@ void putsSwitches(coord_t x, coord_t y, int8_t idx, LcdFlags att)
}
#if defined(CPUARM) && defined(FLIGHT_MODES)
if (idx >= SWSRC_FIRST_FLIGHT_MODE) {
return putsStrIdx(x, y, STR_FP, idx-SWSRC_FIRST_FLIGHT_MODE, att);
return drawStringWithIndex(x, y, STR_FP, idx-SWSRC_FIRST_FLIGHT_MODE, att);
}
#endif
return lcdDrawTextAtIndex(x, y, STR_VSWITCHES, idx, att);
@@ -718,11 +718,11 @@ void putsFlightMode(coord_t x, coord_t y, int8_t idx, LcdFlags att)
if (att & CONDENSED)
lcdDrawNumber(x+FW*1, y, idx-1, (att & ~CONDENSED), 1);
else
putsStrIdx(x, y, STR_FP, idx-1, att);
drawStringWithIndex(x, y, STR_FP, idx-1, att);
}
#endif
void putsCurve(coord_t x, coord_t y, int8_t idx, LcdFlags att)
void drawCurveName(coord_t x, coord_t y, int8_t idx, LcdFlags att)
{
if (idx < 0) {
lcdDrawChar(x-3, y, '!', att);
+2 -2
View File
@@ -167,12 +167,12 @@ void lcdDrawNumber(coord_t x, coord_t y, lcdint_t val, LcdFlags mode, uint8_t le
void lcdDrawNumber(coord_t x, coord_t y, lcdint_t val, LcdFlags mode=0);
void lcdDraw8bitsNumber(coord_t x, coord_t y, int8_t val);
void putsStrIdx(coord_t x, coord_t y, const pm_char *str, uint8_t idx, LcdFlags att=0);
void drawStringWithIndex(coord_t x, coord_t y, const pm_char *str, uint8_t idx, LcdFlags att=0);
void putsModelName(coord_t x, coord_t y, char *name, uint8_t id, LcdFlags att);
void putsSwitches(coord_t x, coord_t y, int8_t swtch, LcdFlags att=0);
void putsMixerSource(coord_t x, coord_t y, uint8_t idx, LcdFlags att=0);
void putsFlightMode(coord_t x, coord_t y, int8_t idx, LcdFlags att=0);
void putsCurve(coord_t x, coord_t y, int8_t idx, LcdFlags att=0);
void drawCurveName(coord_t x, coord_t y, int8_t idx, LcdFlags att=0);
void putsTimerMode(coord_t x, coord_t y, int8_t mode, LcdFlags att=0);
void putsTrimMode(coord_t x, coord_t y, uint8_t phase, uint8_t idx, LcdFlags att);
#if defined(ROTARY_ENCODERS)
+1 -1
View File
@@ -44,7 +44,7 @@ void menuGeneralDiagAna(uint8_t event)
#else
coord_t y = MENU_HEADER_HEIGHT + 1 + (i/2)*FH;
uint8_t x = i&1 ? 64+5 : 0;
putsStrIdx(x, y, PSTR("A"), i+1);
drawStringWithIndex(x, y, PSTR("A"), i+1);
lcdDrawChar(lcdNextPos, y, ':');
#endif
lcdDrawHexNumber(x+3*FW-1, y, anaIn(i));
+2 -2
View File
@@ -238,7 +238,7 @@ void menuModelCurvesAll(uint8_t event)
uint8_t attr = (sub == k ? INVERS : 0);
#if defined(GVARS) && defined(PCBSTD)
if (k >= MAX_CURVES) {
putsStrIdx(0, y, STR_GV, k-MAX_CURVES+1);
drawStringWithIndex(0, y, STR_GV, k-MAX_CURVES+1);
if (GVAR_SELECTED()) {
if (attr && s_editMode>0) attr |= BLINK;
lcdDrawNumber(10*FW, y, GVAR_VALUE(k-MAX_CURVES, -1), attr);
@@ -248,7 +248,7 @@ void menuModelCurvesAll(uint8_t event)
else
#endif
{
putsStrIdx(0, y, STR_CV, k+1, attr);
drawStringWithIndex(0, y, STR_CV, k+1, attr);
}
}
@@ -140,7 +140,7 @@ void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFu
#if defined(GVARS)
else if (func == FUNC_ADJUST_GVAR) {
maxParam = MAX_GVARS-1;
putsStrIdx(lcdNextPos, y, STR_GV, CFN_GVAR_INDEX(cfn)+1, attr);
drawStringWithIndex(lcdNextPos, y, STR_GV, CFN_GVAR_INDEX(cfn)+1, attr);
#if defined(CPUARM)
if (active) CFN_GVAR_INDEX(cfn) = checkIncDec(event, CFN_GVAR_INDEX(cfn), 0, maxParam, eeFlags);
#else
@@ -262,7 +262,7 @@ void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFu
val_displayed = (val_displayed > 250 ? 0 : 251);
}
if (val_displayed > 250) {
putsStrIdx(MODEL_CUSTOM_FUNC_3RD_COLUMN, y, STR_GV, val_displayed-250, attr);
drawStringWithIndex(MODEL_CUSTOM_FUNC_3RD_COLUMN, y, STR_GV, val_displayed-250, attr);
}
else {
lcdDrawNumber(MODEL_CUSTOM_FUNC_3RD_COLUMN, y, val_displayed+PROMPT_CUSTOM_BASE, attr|LEFT);
@@ -309,7 +309,7 @@ void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFu
break;
case FUNC_ADJUST_GVAR_GVAR:
val_max = MAX_GVARS-1;
putsStrIdx(MODEL_CUSTOM_FUNC_3RD_COLUMN, y, STR_GV, val_displayed+1, attr);
drawStringWithIndex(MODEL_CUSTOM_FUNC_3RD_COLUMN, y, STR_GV, val_displayed+1, attr);
break;
default: // FUNC_ADJUST_GVAR_INC
val_max = 1;
+1 -1
View File
@@ -150,7 +150,7 @@ void menuModelPhaseOne(uint8_t event)
uint8_t posHorz = menuHorizontalPosition;
if (attr && posHorz > 0 && s_currIdx==0) posHorz++;
putsStrIdx(INDENT_WIDTH, y, STR_GV, idx+1);
drawStringWithIndex(INDENT_WIDTH, y, STR_GV, idx+1);
editName(4*FW, y, g_model.gvars[idx].name, LEN_GVAR_NAME, event, posHorz==0 ? attr : 0);
+4 -4
View File
@@ -307,7 +307,7 @@ void menuModelExpoOne(uint8_t event)
case EXPO_FIELD_CURVE:
lcd_putsLeft(y, STR_CURVE);
if (ed->curveMode!=MODE_EXPO || ed->curveParam==0) {
putsCurve(EXPO_ONE_2ND_COLUMN-3*FW, y, ed->curveParam, attr);
drawCurveName(EXPO_ONE_2ND_COLUMN-3*FW, y, ed->curveParam, attr);
if (attr) {
CHECK_INCDEC_MODELVAR_ZERO(event, ed->curveParam, CURVE_BASE+MAX_CURVES-1);
if (ed->curveParam) ed->curveMode = MODE_CURVE;
@@ -532,7 +532,7 @@ void menuModelMixOne(uint8_t event)
lcd_putsColumnLeft(COLUMN_X, y, STR_CURVE);
int8_t curveParam = md2->curveParam;
if (md2->curveMode == MODE_CURVE) {
putsCurve(COLUMN_X+MIXES_2ND_COLUMN, y, curveParam, attr);
drawCurveName(COLUMN_X+MIXES_2ND_COLUMN, y, curveParam, attr);
if (attr) {
if (event==EVT_KEY_LONG(KEY_ENTER) && (curveParam<0 || curveParam>=CURVE_BASE)){
s_curveChan = (curveParam<0 ? -curveParam-1 : curveParam-CURVE_BASE);
@@ -666,7 +666,7 @@ void displayMixInfos(coord_t y, MixData *md)
{
if (md->curveParam) {
if (md->curveMode == MODE_CURVE)
putsCurve(MIX_LINE_CURVE_POS, y, md->curveParam);
drawCurveName(MIX_LINE_CURVE_POS, y, md->curveParam);
else
displayGVar(MIX_LINE_CURVE_POS+3*FW, y, md->curveParam, -100, 100);
}
@@ -693,7 +693,7 @@ void displayMixLine(coord_t y, MixData *md)
void displayExpoInfos(coord_t y, ExpoData *ed)
{
if (ed->curveMode == MODE_CURVE)
putsCurve(EXPO_LINE_EXPO_POS-3*FW, y, ed->curveParam);
drawCurveName(EXPO_LINE_EXPO_POS-3*FW, y, ed->curveParam);
else
displayGVar(EXPO_LINE_EXPO_POS, y, ed->curveParam, -100, 100);
+2 -2
View File
@@ -179,7 +179,7 @@ void menuModelSetup(uint8_t event)
{
unsigned int timerIdx = (k>=ITEM_MODEL_TIMER3 ? 2 : (k>=ITEM_MODEL_TIMER2 ? 1 : 0));
TimerData * timer = &g_model.timers[timerIdx];
putsStrIdx(0*FW, y, STR_TIMER, timerIdx+1);
drawStringWithIndex(0*FW, y, STR_TIMER, timerIdx+1);
putsTimerMode(MODEL_SETUP_2ND_COLUMN, y, timer->mode, menuHorizontalPosition==0 ? attr : 0);
putsTimer(MODEL_SETUP_2ND_COLUMN+5*FW-2+5*FWNUM+1, y, timer->start, menuHorizontalPosition==1 ? attr : 0, menuHorizontalPosition==2 ? attr : 0);
if (attr && (editMode>0 || p1valdiff)) {
@@ -269,7 +269,7 @@ void menuModelSetup(uint8_t event)
timer->countdownBeep = editCheckBox(timer->countdownBeep, MODEL_SETUP_2ND_COLUMN, y, STR_BEEPCOUNTDOWN, attr, event);
}
else {
putsStrIdx(0*FW, y, STR_TIMER, k>=ITEM_MODEL_TIMER2 ? 2 : 1);
drawStringWithIndex(0*FW, y, STR_TIMER, k>=ITEM_MODEL_TIMER2 ? 2 : 1);
putsTimerMode(MODEL_SETUP_2ND_COLUMN, y, timer->mode, menuHorizontalPosition==0 ? attr : 0);
putsTimer(MODEL_SETUP_2ND_COLUMN+5*FW-2+5*FWNUM+1, y, timer->start, menuHorizontalPosition==1 ? attr : 0, menuHorizontalPosition==2 ? attr : 0);
if (attr && (editMode>0 || p1valdiff)) {
+3 -3
View File
@@ -436,7 +436,7 @@ void menuModelSensor(uint8_t event)
case SENSOR_FIELD_PARAM4:
{
putsStrIdx(0, y, NO_INDENT(STR_SOURCE), k-SENSOR_FIELD_PARAM1+1);
drawStringWithIndex(0, y, NO_INDENT(STR_SOURCE), k-SENSOR_FIELD_PARAM1+1);
int8_t & source = sensor->calc.sources[k-SENSOR_FIELD_PARAM1];
if (attr) {
source = checkIncDec(event, source, -MAX_SENSORS, MAX_SENSORS, EE_MODEL|NO_INCDEC_MARKS, isSensorAvailable);
@@ -854,7 +854,7 @@ void menuModelTelemetry(uint8_t event)
case ITEM_TELEMETRY_SCREEN_LABEL4:
{
uint8_t screenIndex = TELEMETRY_CURRENT_SCREEN(k);
putsStrIdx(0*FW, y, STR_SCREEN, screenIndex+1);
drawStringWithIndex(0*FW, y, STR_SCREEN, screenIndex+1);
TelemetryScreenType oldScreenType = TELEMETRY_SCREEN_TYPE(screenIndex);
TelemetryScreenType newScreenType = (TelemetryScreenType)selectMenuItem(TELEM_SCRTYPE_COL, y, PSTR(""), STR_VTELEMSCREENTYPE, oldScreenType, 0, TELEMETRY_SCREEN_TYPE_MAX, (menuHorizontalPosition==0 ? attr : 0), event);
if (newScreenType != oldScreenType) {
@@ -866,7 +866,7 @@ void menuModelTelemetry(uint8_t event)
#else
{
uint8_t screenIndex = (k < ITEM_TELEMETRY_SCREEN_LABEL2 ? 1 : 2);
putsStrIdx(0*FW, y, STR_SCREEN, screenIndex);
drawStringWithIndex(0*FW, y, STR_SCREEN, screenIndex);
#if defined(GAUGES)
bool screenType = g_model.frsky.screensType & screenIndex;
if (screenType != (bool)selectMenuItem(TELEM_SCRTYPE_COL, y, PSTR(""), STR_VTELEMSCREENTYPE, screenType, 0, 1, attr, event))
+2 -2
View File
@@ -110,7 +110,7 @@ NOINLINE uint8_t getRssiAlarmValue(uint8_t alarm)
#if !defined(CPUARM)
void displayVoltageScreenLine(uint8_t y, uint8_t index)
{
putsStrIdx(0, y, STR_A, index+1, 0);
drawStringWithIndex(0, y, STR_A, index+1, 0);
if (TELEMETRY_STREAMING()) {
putsTelemetryChannelValue(3*FW+6*FW+4, y-FH, index+TELEM_A1-1, frskyData.analog[index].value, DBLSIZE);
lcdDrawChar(12*FW-1, y-FH, '<'); putsTelemetryChannelValue(17*FW, y-FH, index+TELEM_A1-1, frskyData.analog[index].min, NO_UNIT);
@@ -333,7 +333,7 @@ bool displayNumbersTelemetryScreen(FrSkyScreenData & screen)
coord_t pos[] = {0, 65, 130};
if (field >= MIXSRC_FIRST_TIMER && field <= MIXSRC_LAST_TIMER && i!=3) {
// there is not enough space on LCD for displaying "Tmr1" or "Tmr2" and still see the - sign, we write "T1" or "T2" instead
putsStrIdx(pos[j], 1+FH+2*FH*i, "T", field-MIXSRC_FIRST_TIMER+1, 0);
drawStringWithIndex(pos[j], 1+FH+2*FH*i, "T", field-MIXSRC_FIRST_TIMER+1, 0);
}
else if (field >= MIXSRC_FIRST_TELEM && isGPSSensor(1+(field-MIXSRC_FIRST_TELEM)/3) && telemetryItems[(field-MIXSRC_FIRST_TELEM)/3].isAvailable()) {
// we don't display GPS name, no space for it
+2 -2
View File
@@ -158,7 +158,7 @@ int16_t editGVarFieldValue(coord_t x, coord_t y, int16_t value, int16_t min, int
else {
value = (int16_t) GV_CALC_VALUE_IDX_POS(idx-1, delta);
}
putsStrIdx(x, y, STR_GV, idx, attr);
drawStringWithIndex(x, y, STR_GV, idx, attr);
}
else {
lcdDrawNumber(x, y, value, attr);
@@ -198,7 +198,7 @@ int16_t editGVarFieldValue(coord_t x, coord_t y, int16_t value, int16_t min, int
value = (int16_t) GV_CALC_VALUE_IDX_POS(idx, delta);
idx++;
}
putsStrIdx(x, y, STR_GV, idx, attr);
drawStringWithIndex(x, y, STR_GV, idx, attr);
}
else {
lcdDrawNumber(x, y, value, attr);