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

feat(color): show FM name and number in GV edit page #4767

Merged
merged 1 commit into from
Mar 24, 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
23 changes: 15 additions & 8 deletions radio/src/gui/colorlcd/model_gvars.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,19 @@
#define GVAR_H (GVAR_VAL_H * 2)
#endif

void getFMExtName(char* dest, int8_t idx)
{
getFlightModeString(dest, idx);

FlightModeData* fmData = &g_model.flightModeData[idx - 1];
int userNameLen = zlen(fmData->name, LEN_FLIGHT_MODE_NAME);

if (userNameLen > 0) {
char* s = strAppend(dest + strlen(dest), ":", 1);
strAppend(s, fmData->name, LEN_FLIGHT_MODE_NAME);
}
}

class GVarStyle
{
public:
Expand Down Expand Up @@ -337,7 +350,7 @@ class GVarEditWindow : public Page
if (lastGVar > GVAR_MAX) {
uint8_t fm = lastGVar - GVAR_MAX - 1;
if (fm >= curFM) fm++;
getFlightModeString(label + strlen(label), fm + 1);
getFMExtName(label + strlen(label), fm + 1);
} else {
strcat(label, getGVarValue(index, lastGVar, 0).c_str());
}
Expand Down Expand Up @@ -505,13 +518,7 @@ class GVarEditWindow : public Page
fmData = &g_model.flightModeData[flightMode];

if (modelFMEnabled()) {
getFlightModeString(flightModeName, flightMode + 1);

int userNameLen = zlen(fmData->name, LEN_FLIGHT_MODE_NAME);

if (userNameLen > 0) {
strcpy(flightModeName, fmData->name);
}
getFMExtName(flightModeName, flightMode + 1);
new StaticText(line, rect_t{}, flightModeName, 0, COLOR_THEME_PRIMARY1);
} else {
new StaticText(line, rect_t{}, STR_VALUE, 0, COLOR_THEME_PRIMARY1);
Expand Down