Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(bw): tidy up Radio Setup menu #4939

Merged
merged 6 commits into from
May 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions radio/src/gui/128x64/gui.h
Original file line number Diff line number Diff line change
@@ -39,8 +39,6 @@
#define HEADER_LINE_COLUMNS 0,
#endif

#define drawFieldLabel(x, y, str) lcdDrawTextAlignedLeft(y, str)

#define NUM_BODY_LINES (LCD_LINES-1)
#define TEXT_VIEWER_LINES NUM_BODY_LINES
#define MENU_HEADER_HEIGHT FH
@@ -65,11 +63,19 @@ typedef int choice_t;

choice_t editChoice(coord_t x, coord_t y, const char *label,
const char *const *values, choice_t value, choice_t min,
choice_t max, LcdFlags attr, event_t event,
IsValueAvailable isValueAvailable = nullptr);
choice_t max, LcdFlags attr, event_t event);
choice_t editChoice(coord_t x, coord_t y, const char *label,
const char *const *values, choice_t value, choice_t min,
choice_t max, LcdFlags attr, event_t event, coord_t lblX);
choice_t editChoice(coord_t x, coord_t y, const char *label,
const char *const *values, choice_t value, choice_t min,
choice_t max, LcdFlags attr, event_t event, coord_t lblX,
IsValueAvailable isValueAvailable);

uint8_t editCheckBox(uint8_t value, coord_t x, coord_t y, const char *label,
LcdFlags attr, event_t event);
uint8_t editCheckBox(uint8_t value, coord_t x, coord_t y, const char *label,
LcdFlags attr, event_t event, coord_t lblX);

swsrc_t editSwitch(coord_t x, coord_t y, swsrc_t value, LcdFlags attr,
event_t event);
@@ -111,7 +117,7 @@ void editName(coord_t x, coord_t y, char *name, uint8_t size, event_t event,

void editSingleName(coord_t x, coord_t y, const char *label, char *name,
uint8_t size, event_t event, uint8_t active,
uint8_t old_editMode);
uint8_t old_editMode, coord_t lblX = 0);

uint8_t editDelay(coord_t y, event_t event, uint8_t attr, const char * str, uint8_t delay, uint8_t prec);

5 changes: 5 additions & 0 deletions radio/src/gui/128x64/lcd.cpp
Original file line number Diff line number Diff line change
@@ -371,6 +371,11 @@ void lcdDrawTextAlignedLeft(coord_t y, const char * s)
lcdDrawText(0, y, s);
}

void lcdDrawTextIndented(coord_t y, const char * s)
{
lcdDrawText(INDENT_WIDTH, y, s);
}

#if !defined(BOOT)
void lcdDrawTextAtIndex(coord_t x, coord_t y, const char *const *s,uint8_t idx, LcdFlags flags)
{
4 changes: 3 additions & 1 deletion radio/src/gui/128x64/lcd.h
Original file line number Diff line number Diff line change
@@ -27,8 +27,9 @@
#include "board.h"

#define BOX_WIDTH 23
#define CENTER
#define CENTER_OFS 0
#define OFS_CHECKTRIMS CENTER_OFS+(9*FW)
#define INDENT_WIDTH (FW/2)

#define FW 6
#define FWNUM 5
@@ -102,6 +103,7 @@ void lcdDrawSizedText(coord_t x, coord_t y, const char * s, unsigned char len, L
void lcdDrawText(coord_t x, coord_t y, const char * s);
void lcdDrawSizedText(coord_t x, coord_t y, const char * s, unsigned char len);
void lcdDrawTextAlignedLeft(coord_t y, const char * s);
void lcdDrawTextIndented(coord_t y, const char * s);
void drawTimerWithMode(coord_t x, coord_t y, uint8_t index, LcdFlags att);

void lcdDrawHexNumber(coord_t x, coord_t y, uint32_t val, LcdFlags mode=0);
4 changes: 2 additions & 2 deletions radio/src/gui/128x64/menu_model.cpp
Original file line number Diff line number Diff line change
@@ -62,9 +62,9 @@ uint8_t editNameCursorPos = 0;

void editSingleName(coord_t x, coord_t y, const char* label, char* name,
uint8_t size, event_t event, uint8_t active,
uint8_t old_editMode)
uint8_t old_editMode, coord_t lblX)
{
lcdDrawTextAlignedLeft(y, label);
lcdDrawText(lblX, y, label);
editName(x, y, name, size, event, active, 0, old_editMode);
}

2 changes: 1 addition & 1 deletion radio/src/gui/128x64/model_curve_edit.cpp
Original file line number Diff line number Diff line change
@@ -99,7 +99,7 @@ void menuModelCurveOne(event_t event)
menuVerticalPosition == 0, 0, old_editMode);

// Curve type
lcdDrawTextAlignedLeft(3 * FH + 1, NO_INDENT(STR_TYPE));
lcdDrawTextAlignedLeft(3 * FH + 1, STR_TYPE);
LcdFlags attr = (menuVerticalPosition == 1 ? (s_editMode > 0 ? INVERS | BLINK : INVERS) : 0);
lcdDrawTextAtIndex(INDENT_WIDTH, 4 * FH + 1, STR_CURVE_TYPES, crv.type, attr);
if (attr) {
2 changes: 1 addition & 1 deletion radio/src/gui/128x64/model_flightmodes.cpp
Original file line number Diff line number Diff line change
@@ -263,7 +263,7 @@ void menuModelFlightModesAll(event_t event)

if (menuVerticalOffset != MAX_FLIGHT_MODES-(LCD_LINES-2)) return;

lcdDrawTextAlignedLeft((LCD_LINES-1)*FH+1, STR_CHECKTRIMS);
lcdDrawText(CENTER_OFS, (LCD_LINES-1)*FH+1, STR_CHECKTRIMS);
drawFlightMode(OFS_CHECKTRIMS, (LCD_LINES-1)*FH+1, mixerCurrentFlightMode+1);
if (sub==MAX_FLIGHT_MODES && !trimsCheckTimer) {
lcdInvertLastLine();
2 changes: 1 addition & 1 deletion radio/src/gui/128x64/model_mix_edit.cpp
Original file line number Diff line number Diff line change
@@ -182,7 +182,7 @@ void menuModelMixOne(event_t event)
break;

case MIX_FIELD_WARNING:
drawFieldLabel(MIXES_2ND_COLUMN, y, STR_MIXWARNING);
lcdDrawTextAlignedLeft(y, STR_MIXWARNING);
if (md2->mixWarn)
lcdDrawNumber(MIXES_2ND_COLUMN, y, md2->mixWarn, attr|LEFT);
else
Loading