Cosmetics again ...

This commit is contained in:
Bertrand Songis
2016-08-24 20:39:22 +02:00
parent a95f9b7dde
commit b69c2aa41c
48 changed files with 246 additions and 279 deletions
+14 -13
View File
@@ -131,7 +131,7 @@ bool menuModelSensor(event_t event)
lcdDrawNumber(lcdNextPos, 3, s_currIdx+1, MENU_TITLE_COLOR|LEFT);
drawSensorCustomValue(50, 3+FH, s_currIdx, getValue(MIXSRC_FIRST_TELEM+3*s_currIdx), MENU_TITLE_COLOR|LEFT);
for (unsigned int i=0; i<NUM_BODY_LINES+1; i++) {
for (uint8_t i=0; i<NUM_BODY_LINES+1; i++) {
coord_t y = MENU_CONTENT_TOP - FH - 2 + i*FH;
int k = i + menuVerticalOffset;
@@ -153,7 +153,7 @@ bool menuModelSensor(event_t event)
case SENSOR_FIELD_TYPE:
lcdDrawText(MENUS_MARGIN_LEFT, y, NO_INDENT(STR_TYPE));
sensor->type = selectMenuItem(SENSOR_2ND_COLUMN, y, STR_VSENSORTYPES, sensor->type, 0, 1, attr, event);
sensor->type = editChoice(SENSOR_2ND_COLUMN, y, STR_VSENSORTYPES, sensor->type, 0, 1, attr, event);
if (attr && checkIncDec_Ret) {
sensor->instance = 0;
if (sensor->type == TELEM_TYPE_CALCULATED) {
@@ -183,7 +183,7 @@ bool menuModelSensor(event_t event)
}
else {
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_FORMULA);
sensor->formula = selectMenuItem(SENSOR_2ND_COLUMN, y, STR_VFORMULAS, sensor->formula, 0, TELEM_FORMULA_LAST, attr, event);
sensor->formula = editChoice(SENSOR_2ND_COLUMN, y, STR_VFORMULAS, sensor->formula, 0, TELEM_FORMULA_LAST, attr, event);
if (attr && checkIncDec_Ret) {
sensor->param = 0;
if (sensor->formula == TELEM_FORMULA_CELL) {
@@ -204,7 +204,7 @@ bool menuModelSensor(event_t event)
case SENSOR_FIELD_UNIT:
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_UNIT);
// TODO flash saving with selectMenuItem where I copied those 2 lines?
// TODO flash saving with editChoice where I copied those 2 lines?
lcdDrawTextAtIndex(SENSOR_2ND_COLUMN, y, STR_VTELEMUNIT, sensor->unit, attr);
if (attr) {
CHECK_INCDEC_MODELVAR_ZERO(event, sensor->unit, UNIT_MAX);
@@ -219,7 +219,7 @@ bool menuModelSensor(event_t event)
case SENSOR_FIELD_PRECISION:
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_PRECISION);
sensor->prec = selectMenuItem(SENSOR_2ND_COLUMN, y, STR_VPREC, sensor->prec, 0, 2, attr, event);
sensor->prec = editChoice(SENSOR_2ND_COLUMN, y, STR_VPREC, sensor->prec, 0, 2, attr, event);
if (attr && checkIncDec_Ret) {
telemetryItems[s_currIdx].clear();
}
@@ -247,7 +247,7 @@ bool menuModelSensor(event_t event)
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_CURRENTSENSOR);
drawSource(SENSOR_2ND_COLUMN, y, sensor->consumption.source ? MIXSRC_FIRST_TELEM+3*(sensor->consumption.source-1) : 0, attr);
if (attr) {
sensor->consumption.source = checkIncDec(event, sensor->consumption.source, 0, MAX_TELEMETRY_SENSORS, EE_MODEL|NO_INCDEC_MARKS, isTelemetryFieldAvailable);
sensor->consumption.source = checkIncDec(event, sensor->consumption.source, 0, MAX_TELEMETRY_SENSORS, EE_MODEL|NO_INCDEC_MARKS, isSensorAvailable);
}
break;
}
@@ -255,7 +255,7 @@ bool menuModelSensor(event_t event)
lcdDrawText(MENUS_MARGIN_LEFT, y, NO_INDENT(STR_SOURCE));
drawSource(SENSOR_2ND_COLUMN, y, sensor->consumption.source ? MIXSRC_FIRST_TELEM+3*(sensor->consumption.source-1) : 0, attr);
if (attr) {
sensor->consumption.source = checkIncDec(event, sensor->consumption.source, 0, MAX_TELEMETRY_SENSORS, EE_MODEL|NO_INCDEC_MARKS, isTelemetryFieldComparisonAvailable);
sensor->consumption.source = checkIncDec(event, sensor->consumption.source, 0, MAX_TELEMETRY_SENSORS, EE_MODEL|NO_INCDEC_MARKS, isSensorAvailable);
}
break;
}
@@ -283,7 +283,7 @@ bool menuModelSensor(event_t event)
if (sensor->type == TELEM_TYPE_CALCULATED) {
if (sensor->formula == TELEM_FORMULA_CELL) {
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_CELLINDEX);
sensor->cell.index = selectMenuItem(SENSOR_2ND_COLUMN, y, STR_VCELLINDEX, sensor->cell.index, 0, 8, attr, event);
sensor->cell.index = editChoice(SENSOR_2ND_COLUMN, y, STR_VCELLINDEX, sensor->cell.index, 0, 8, attr, event);
break;
}
else if (sensor->formula == TELEM_FORMULA_DIST) {
@@ -348,6 +348,9 @@ bool menuModelSensor(event_t event)
case SENSOR_FIELD_PERSISTENT:
lcdDrawText(MENUS_MARGIN_LEFT, y, NO_INDENT(STR_PERSISTENT));
sensor->persistent = editCheckBox(sensor->persistent, SENSOR_2ND_COLUMN, y, attr, event);
if (checkIncDec_Ret && !sensor->persistent) {
sensor->persistentValue = 0;
}
break;
case SENSOR_FIELD_LOGS:
@@ -359,13 +362,12 @@ bool menuModelSensor(event_t event)
break;
}
}
return true;
}
void onSensorMenu(const char *result)
void onSensorMenu(const char * result)
{
int index = menuVerticalPosition - ITEM_TELEMETRY_SENSOR1;
uint8_t index = menuVerticalPosition - ITEM_TELEMETRY_SENSOR1;
if (index < MAX_TELEMETRY_SENSORS) {
if (result == STR_EDIT) {
@@ -409,7 +411,7 @@ bool menuModelTelemetryFrsky(event_t event)
MENU(STR_MENUTELEMETRY, MODEL_ICONS, menuTabModel, MENU_MODEL_TELEMETRY_FRSKY, ITEM_TELEMETRY_MAX, { TELEMETRY_TYPE_ROWS RSSI_ROWS SENSORS_ROWS VARIO_ROWS });
for (int i=0; i<NUM_BODY_LINES; i++) {
for (uint8_t i=0; i<NUM_BODY_LINES; i++) {
coord_t y = MENU_CONTENT_TOP + i*FH;
int k = i + menuVerticalOffset;
for (int j=0; j<=k; j++) {
@@ -583,6 +585,5 @@ bool menuModelTelemetryFrsky(event_t event)
#endif
}
}
return true;
}