Merge branch '2.4' into owpr-gpstopbaricon

This commit is contained in:
olliw42
2021-05-19 07:43:42 +02:00
7 changed files with 31 additions and 35 deletions
+1 -1
View File
@@ -101,7 +101,7 @@ inline void lcdSetColor(uint16_t color)
lcdColorTable[CUSTOM_COLOR_INDEX] = color; lcdColorTable[CUSTOM_COLOR_INDEX] = color;
} }
#define COLOR(index) (lcdColorTable[ unsigned(index) & 0xFF ] << 16u) #define COLOR(index) ((uint32_t)lcdColorTable[ unsigned(index) & 0xFF ] << 16u)
#define ALARM_COLOR COLOR(ALARM_COLOR_INDEX) #define ALARM_COLOR COLOR(ALARM_COLOR_INDEX)
#define BARGRAPH1_COLOR COLOR(BARGRAPH1_COLOR_INDEX) #define BARGRAPH1_COLOR COLOR(BARGRAPH1_COLOR_INDEX)
+12 -13
View File
@@ -35,7 +35,7 @@ void MainViewHorizontalSlider::paint(BitmapBuffer * dc)
} }
// The square // The square
x = width() - TRIM_SQUARE_SIZE - divRoundClosest((width() - TRIM_SQUARE_SIZE) * (value + RESX), 2 * RESX); x = divRoundClosest((width() - TRIM_SQUARE_SIZE) * (value + RESX), 2 * RESX);
drawTrimSquare(dc, x, 0, TRIM_BGCOLOR); drawTrimSquare(dc, x, 0, TRIM_BGCOLOR);
} }
@@ -58,19 +58,18 @@ void MainView6POS::paint(BitmapBuffer * dc)
void MainViewVerticalSlider::paint(BitmapBuffer * dc) void MainViewVerticalSlider::paint(BitmapBuffer * dc)
{ {
uint8_t slidersTick = height() / 5; // The ticks
// The ticks int delta = (height() - TRIM_SQUARE_SIZE) / SLIDER_TICKS_COUNT;
int delta = (height() - TRIM_SQUARE_SIZE) / slidersTick; coord_t y = TRIM_SQUARE_SIZE / 2;
coord_t y = TRIM_SQUARE_SIZE / 2; for (uint8_t i = 0; i <= SLIDER_TICKS_COUNT; i++) {
for (uint8_t i = 0; i <= slidersTick; i++) { if (i == 0 || i == SLIDER_TICKS_COUNT / 2 || i == SLIDER_TICKS_COUNT)
if (i == 0 || i == slidersTick / 2 || i == slidersTick) dc->drawSolidHorizontalLine(2, y, 13, DEFAULT_COLOR);
dc->drawSolidHorizontalLine(2, y, 13, DEFAULT_COLOR); else
else dc->drawSolidHorizontalLine(4, y, 9, DEFAULT_COLOR);
dc->drawSolidHorizontalLine(4, y, 9, DEFAULT_COLOR); y += delta;
y += delta; }
}
// The square // The square
y = height() - TRIM_SQUARE_SIZE - divRoundClosest((height() - TRIM_SQUARE_SIZE) * (value + RESX), 2 * RESX); y = divRoundClosest((height() - TRIM_SQUARE_SIZE) * (-value + RESX), 2 * RESX);
drawTrimSquare(dc, 0, y, TRIM_BGCOLOR); drawTrimSquare(dc, 0, y, TRIM_BGCOLOR);
} }
+5 -5
View File
@@ -387,8 +387,7 @@ void ModelTelemetryPage::editSensor(FormWindow * window, uint8_t index)
void ModelTelemetryPage::build(FormWindow * window, int8_t focusSensorIndex) void ModelTelemetryPage::build(FormWindow * window, int8_t focusSensorIndex)
{ {
FormGridLayout grid; FormGridLayout grid;
grid.spacer(8); grid.spacer(PAGE_PADDING);
grid.setLabelWidth(170);
this->window = window; this->window = window;
@@ -470,7 +469,7 @@ void ModelTelemetryPage::build(FormWindow * window, int8_t focusSensorIndex)
} }
// Autodiscover button // Autodiscover button
auto discover = new TextButton(window, grid.getFieldSlot(2, 0), STR_DISCOVER_SENSORS); auto discover = new TextButton(window, grid.getFieldSlot(2, 0), (allowNewSensors) ? STR_STOP_DISCOVER_SENSORS : STR_DISCOVER_SENSORS);
discover->setPressHandler([=]() { discover->setPressHandler([=]() {
allowNewSensors = !allowNewSensors; allowNewSensors = !allowNewSensors;
if (allowNewSensors) { if (allowNewSensors) {
@@ -509,14 +508,15 @@ void ModelTelemetryPage::build(FormWindow * window, int8_t focusSensorIndex)
grid.nextLine(); grid.nextLine();
} }
// restore aligned layout
grid.setLabelWidth(PAGE_LABEL_WIDTH);
// Ignore instance button // Ignore instance button
grid.setLabelWidth(170);
new StaticText(window, grid.getLabelSlot(true), STR_IGNORE_INSTANCE); new StaticText(window, grid.getLabelSlot(true), STR_IGNORE_INSTANCE);
new CheckBox(window, grid.getFieldSlot(), GET_SET_DEFAULT(g_model.ignoreSensorIds)); new CheckBox(window, grid.getFieldSlot(), GET_SET_DEFAULT(g_model.ignoreSensorIds));
grid.nextLine(); grid.nextLine();
// Vario // Vario
grid.setLabelWidth(100);
new Subtitle(window, grid.getLineSlot(), STR_VARIO); new Subtitle(window, grid.getLineSlot(), STR_VARIO);
grid.nextLine(); grid.nextLine();
new StaticText(window, grid.getLabelSlot(true), STR_SOURCE); new StaticText(window, grid.getLabelSlot(true), STR_SOURCE);
+7 -12
View File
@@ -152,11 +152,11 @@ void RadioHardwarePage::build(FormWindow * window)
{ {
FormGridLayout grid; FormGridLayout grid;
#if LCD_W > LCD_H #if LCD_W > LCD_H
grid.setLabelWidth(130); grid.setLabelWidth(180);
#else #else
grid.setLabelWidth(100); grid.setLabelWidth(130);
#endif #endif
grid.spacer(6); grid.spacer(PAGE_PADDING);
// Calibration // Calibration
new StaticText(window, grid.getLabelSlot(), STR_INPUTS, 0, FONT(BOLD)); new StaticText(window, grid.getLabelSlot(), STR_INPUTS, 0, FONT(BOLD));
@@ -233,15 +233,10 @@ void RadioHardwarePage::build(FormWindow * window)
}); });
grid.nextLine(); grid.nextLine();
} }
#if LCD_W > LCD_H
grid.setLabelWidth(180);
#else
grid.setLabelWidth(130);
#endif
// Bat calibration // Bat calibration
new StaticText(window, grid.getLabelSlot(), STR_BATT_CALIB); new StaticText(window, grid.getLabelSlot(), STR_BATT_CALIB);
auto batCal = new NumberEdit(window, grid.getFieldSlot(), -127, 127, GET_SET_DEFAULT(g_eeGeneral.txVoltageCalibration)); auto batCal = new NumberEdit(window, grid.getFieldSlot(1,0), -127, 127, GET_SET_DEFAULT(g_eeGeneral.txVoltageCalibration));
batCal->setDisplayHandler([](BitmapBuffer * dc, LcdFlags flags, int32_t value) { batCal->setDisplayHandler([](BitmapBuffer * dc, LcdFlags flags, int32_t value) {
dc->drawNumber(FIELD_PADDING_LEFT, FIELD_PADDING_TOP, getBatteryVoltage(), flags | PREC2, 0, nullptr, "V"); dc->drawNumber(FIELD_PADDING_LEFT, FIELD_PADDING_TOP, getBatteryVoltage(), flags | PREC2, 0, nullptr, "V");
}); });
@@ -250,14 +245,14 @@ void RadioHardwarePage::build(FormWindow * window)
// RTC Batt display // RTC Batt display
new StaticText(window, grid.getLabelSlot(), STR_RTC_BATT); new StaticText(window, grid.getLabelSlot(), STR_RTC_BATT);
new DynamicNumber<uint16_t>(window, grid.getFieldSlot(), [] { new DynamicNumber<uint16_t>(window, grid.getFieldSlot(1,0), [] {
return getRTCBatteryVoltage(); return getRTCBatteryVoltage();
}, PREC2, nullptr, "V"); }, PREC2, nullptr, "V");
grid.nextLine(); grid.nextLine();
// RTC Batt check enable // RTC Batt check enable
new StaticText(window, grid.getLabelSlot(), STR_RTC_CHECK); new StaticText(window, grid.getLabelSlot(), STR_RTC_CHECK);
new CheckBox(window, grid.getFieldSlot(), GET_SET_INVERTED(g_eeGeneral.disableRtcWarning )); new CheckBox(window, grid.getFieldSlot(1,0), GET_SET_INVERTED(g_eeGeneral.disableRtcWarning ));
grid.nextLine(); grid.nextLine();
#if defined(CROSSFIRE) && SPORT_MAX_BAUDRATE < 400000 #if defined(CROSSFIRE) && SPORT_MAX_BAUDRATE < 400000
@@ -301,7 +296,7 @@ void RadioHardwarePage::build(FormWindow * window)
// ADC filter // ADC filter
new StaticText(window, grid.getLabelSlot(), STR_JITTER_FILTER); new StaticText(window, grid.getLabelSlot(), STR_JITTER_FILTER);
new CheckBox(window, grid.getFieldSlot(), GET_SET_INVERTED(g_eeGeneral.jitterFilter)); new CheckBox(window, grid.getFieldSlot(1,0), GET_SET_INVERTED(g_eeGeneral.jitterFilter));
grid.nextLine(); grid.nextLine();
// Debugs // Debugs
+3 -1
View File
@@ -376,6 +376,7 @@ void RadioSetupPage::build(FormWindow * window)
grid.nextLine(); grid.nextLine();
#endif #endif
#if defined(INTERNAL_GPS)
// GPS // GPS
{ {
new Subtitle(window, grid.getLabelSlot(), STR_GPS); new Subtitle(window, grid.getLabelSlot(), STR_GPS);
@@ -383,7 +384,7 @@ void RadioSetupPage::build(FormWindow * window)
// Timezone // Timezone
new StaticText(window, grid.getLabelSlot(true), STR_TIMEZONE); new StaticText(window, grid.getLabelSlot(true), STR_TIMEZONE);
new NumberEdit(window, grid.getFieldSlot(2, 0), -12, 12, GET_SET_DEFAULT(g_eeGeneral.timezone)); new NumberEdit(window, grid.getFieldSlot(), -12, 12, GET_SET_DEFAULT(g_eeGeneral.timezone));
grid.nextLine(); grid.nextLine();
// Adjust RTC (from telemetry) // Adjust RTC (from telemetry)
@@ -396,6 +397,7 @@ void RadioSetupPage::build(FormWindow * window)
new Choice(window, grid.getFieldSlot(), STR_GPSFORMAT, 0, 1, GET_SET_DEFAULT(g_eeGeneral.gpsFormat)); new Choice(window, grid.getFieldSlot(), STR_GPSFORMAT, 0, 1, GET_SET_DEFAULT(g_eeGeneral.gpsFormat));
grid.nextLine(); grid.nextLine();
} }
#endif
#if defined(PXX2) #if defined(PXX2)
// Owner ID // Owner ID
@@ -40,7 +40,7 @@ void SelectFabCarousel::addButton(uint8_t icon, const char* title,
coord_t x_pos = pageWidth * buttons;// + SELECT_BUTTON_BORDER / 2; coord_t x_pos = pageWidth * buttons;// + SELECT_BUTTON_BORDER / 2;
buttons++; buttons++;
auto button = new SelectFabButton(this, x_pos, y_pos, icon, title, pressHandler); /*auto button =*/ new SelectFabButton(this, x_pos, y_pos, icon, title, pressHandler);
setInnerWidth(pageWidth * buttons); setInnerWidth(pageWidth * buttons);
// y_pos += button->width() + SELECT_BUTTON_BORDER; // y_pos += button->width() + SELECT_BUTTON_BORDER;
@@ -300,8 +300,8 @@ void ViewMainDecoration::createTrims()
VERTICAL_SLIDERS_HEIGHT VERTICAL_SLIDERS_HEIGHT
}; };
trims[TRIMS_LV] = new MainViewVerticalTrim(this, r, 2); trims[TRIMS_LV] = new MainViewVerticalTrim(this, r, 1);
trims[TRIMS_RV] = new MainViewVerticalTrim(this, r, 1); trims[TRIMS_RV] = new MainViewVerticalTrim(this, r, 2);
} }
void ViewMainDecoration::createFlightMode() void ViewMainDecoration::createFlightMode()