feat: use any source for expo/weight/offset (#5220)

Co-authored-by: philmoz <phil.a.mitchell@gmail.com>
Co-authored-by: 3djc <3djc@gh.com>
Co-authored-by: elecpower <elecpower@users.noreply.github.com>
This commit is contained in:
philmoz
2024-07-26 20:51:21 +10:00
committed by GitHub
co-authored by philmoz 3djc elecpower
parent 326c58a7fd
commit 4b917b762c
87 changed files with 2751 additions and 1671 deletions
+20 -2
View File
@@ -380,7 +380,7 @@ char *getCurveString(char *dest, int idx)
char *s = dest;
if (idx < 0) {
*s++ = '!';
*s++ = '-';
idx = -idx;
}
@@ -429,6 +429,24 @@ char *getValueOrGVarString(char *dest, size_t len, gvar_t value, gvar_t vmin,
formatNumberAsString(dest, len, value, flags, 0, nullptr, suffix);
return dest;
}
char *getValueOrSrcVarString(char *dest, size_t len, gvar_t value, gvar_t vmin,
gvar_t vmax, LcdFlags flags, const char *suffix,
gvar_t offset, bool usePPMUnit)
{
SourceNumVal v;
v.rawValue = value;
if (v.isSource) {
const char* s = getSourceString(v.value);
strncpy(dest, s, len);
} else {
v.value += offset;
if (usePPMUnit && g_eeGeneral.ppmunit == PPM_US)
v.value = v.value * 128 / 25;
formatNumberAsString(dest, len, v.value, flags, 0, nullptr, suffix);
}
return dest;
}
#endif
char *getFlightModeString(char *dest, int8_t idx)
@@ -640,7 +658,7 @@ char *getSourceString(char (&destRef)[L], mixsrc_t idx)
if (idx < 0) {
idx = -idx;
dest[0] = '!';
dest[0] = '-';
dest += 1;
dest_len -= 1;
}