* [firmware][gui] Adjust custom failsafe (and some channel display) ranges for proper extended limits (fixes #4447). This also fixes some display issues in *x64 GUIs when adjusting failsafe settings and cleans up code in those functions. * [firmware][gui] Fix 480x272 channel output progress bars to show full extended limits; Fix alignment issues on all 212x & 480x gui mixes screens with custom channel names; Streamline some channel outputs display code. * Fix AVR build.
This commit is contained in:
committed by
Bertrand Songis
parent
fb49d1197d
commit
7762bac360
@@ -2,7 +2,7 @@
|
||||
* Copyright (C) OpenTX
|
||||
*
|
||||
* Based on code named
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* er9x - http://code.google.com/p/er9x
|
||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||
*
|
||||
@@ -23,12 +23,11 @@
|
||||
void menuChannelsView(event_t event)
|
||||
{
|
||||
static bool longNames = false;
|
||||
bool newLongNames = false;
|
||||
static bool secondPage = false;
|
||||
#ifdef MIXERS_MONITOR
|
||||
static bool mixersView = false;
|
||||
#endif
|
||||
uint8_t ch;
|
||||
uint8_t ch = 0;
|
||||
uint8_t wbar = (longNames ? 54 : 64);
|
||||
int16_t limits = 512 * 2;
|
||||
|
||||
switch(event)
|
||||
{
|
||||
@@ -48,69 +47,56 @@ void menuChannelsView(event_t event)
|
||||
|
||||
if (secondPage)
|
||||
ch = 16;
|
||||
else
|
||||
ch = 0;
|
||||
|
||||
#ifdef MIXERS_MONITOR
|
||||
if (mixersView)
|
||||
lcdDrawTextAlignedCenter(0*FH, MIXERS_MONITOR);
|
||||
limits *= 2; // this could be handled nicer, but slower, by checking actual range for this mixer
|
||||
else if (g_model.extendedLimits)
|
||||
limits *= LIMIT_EXT_PERCENT / 100;
|
||||
|
||||
if (mixersView)
|
||||
lcdDrawTextAlignedCenter(0, MIXERS_MONITOR);
|
||||
else
|
||||
#endif
|
||||
lcdDrawTextAlignedCenter(0*FH, CHANNELS_MONITOR);
|
||||
lcdDrawTextAlignedCenter(0, CHANNELS_MONITOR);
|
||||
|
||||
lcdInvertLine(0);
|
||||
|
||||
// Column separator
|
||||
lcdDrawSolidVerticalLine(LCD_W/2, FH, LCD_H-FH);
|
||||
|
||||
for (uint8_t col=0; col<2; col++) {
|
||||
|
||||
uint8_t x = col*LCD_W/2+1;
|
||||
for (uint8_t col=0; col < 2; col++) {
|
||||
const uint8_t x = col * LCD_W / 2 + 1;
|
||||
const uint8_t ofs = (col ? 0 : 1);
|
||||
|
||||
// Channels
|
||||
for (uint8_t line=0; line<8; line++) {
|
||||
uint8_t y = 9+line*7;
|
||||
#ifdef MIXERS_MONITOR
|
||||
int32_t val = (mixersView) ? ex_chans[ch] : channelOutputs[ch];
|
||||
#else
|
||||
int32_t val = channelOutputs[ch];
|
||||
#endif
|
||||
uint8_t ofs = (col ? 0 : 1);
|
||||
for (uint8_t line=0; line < 8; line++) {
|
||||
const uint8_t y = 9 + line * 7;
|
||||
const int32_t val = mixersView ? ex_chans[ch] : channelOutputs[ch];
|
||||
const uint8_t lenLabel = ZLEN(g_model.limitData[ch].name);
|
||||
|
||||
// Channel name if present, number if not
|
||||
uint8_t lenLabel = ZLEN(g_model.limitData[ch].name);
|
||||
if (lenLabel > 4) {
|
||||
newLongNames = longNames = true;
|
||||
}
|
||||
|
||||
if (lenLabel > 0)
|
||||
if (lenLabel > 0) {
|
||||
if (lenLabel > 4)
|
||||
longNames = true;
|
||||
lcdDrawSizedText(x+1-ofs, y, g_model.limitData[ch].name, sizeof(g_model.limitData[ch].name), ZCHAR | SMLSIZE);
|
||||
else
|
||||
}
|
||||
else {
|
||||
putsChn(x+1-ofs, y, ch+1, SMLSIZE);
|
||||
}
|
||||
|
||||
// Value
|
||||
#if defined(PPM_UNIT_US)
|
||||
uint8_t wbar = (longNames ? 54 : 64);
|
||||
lcdDrawNumber(x+LCD_W/2-3-wbar-ofs, y+1, PPM_CH_CENTER(ch)+val/2, TINSIZE|RIGHT);
|
||||
#elif defined(PPM_UNIT_PERCENT_PREC1)
|
||||
uint8_t wbar = (longNames ? 48 : 58);
|
||||
wbar -= 6;
|
||||
lcdDrawNumber(x+LCD_W/2-3-wbar-ofs, y+1, calcRESXto1000(val), PREC1|TINSIZE|RIGHT);
|
||||
#else
|
||||
uint8_t wbar = (longNames ? 54 : 64);
|
||||
lcdDrawNumber(x+LCD_W/2-3-wbar-ofs, y+1, calcRESXto1000(val)/10, TINSIZE|RIGHT);
|
||||
#endif
|
||||
|
||||
// Gauge
|
||||
#ifdef MIXERS_MONITOR
|
||||
uint16_t lim = mixersView ? 512*2*2 : (g_model.extendedLimits ? 640*2 : 512*2);
|
||||
#else
|
||||
uint16_t lim = g_model.extendedLimits ? 640*2 : 512*2;
|
||||
#endif
|
||||
drawGauge(x+LCD_W/2-3-wbar-ofs, y, wbar, 6, val, lim);
|
||||
drawGauge(x+LCD_W/2-3-wbar-ofs, y, wbar, 6, val, limits);
|
||||
|
||||
ch++;
|
||||
++ch;
|
||||
}
|
||||
}
|
||||
|
||||
longNames = newLongNames;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user