1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-26 17:55:19 +03:00

[firmware][gui] Extended limits fixes, issue #4447 (#4453)

* [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:
Max Paperno 2017-02-15 10:25:40 -05:00 committed by Bertrand Songis
parent fb49d1197d
commit 7762bac360
9 changed files with 302 additions and 318 deletions

View file

@ -232,8 +232,8 @@ void menuModelSetup(event_t event)
for (int j=0; j<=k; j++) { for (int j=0; j<=k; j++) {
if (mstate_tab[j+HEADER_LINE] == HIDDEN_ROW) { if (mstate_tab[j+HEADER_LINE] == HIDDEN_ROW) {
if (++k >= (int)DIM(mstate_tab)) { if (++k >= (int)DIM(mstate_tab)) {
return; return;
} }
} }
} }
#endif #endif
@ -331,7 +331,7 @@ void menuModelSetup(event_t event)
timer->persistent = editChoice(MODEL_SETUP_2ND_COLUMN, y, STR_PERSISTENT, STR_VPERSISTENT, timer->persistent, 0, 2, attr, event); timer->persistent = editChoice(MODEL_SETUP_2ND_COLUMN, y, STR_PERSISTENT, STR_VPERSISTENT, timer->persistent, 0, 2, attr, event);
break; break;
} }
#else #else // AVR
case ITEM_MODEL_TIMER1: case ITEM_MODEL_TIMER1:
case ITEM_MODEL_TIMER2: case ITEM_MODEL_TIMER2:
case ITEM_MODEL_TIMER1_MINUTE_BEEP: case ITEM_MODEL_TIMER1_MINUTE_BEEP:
@ -1062,7 +1062,12 @@ void menuModelSetup(event_t event)
void menuModelFailsafe(event_t event) void menuModelFailsafe(event_t event)
{ {
uint8_t ch = 8 * (menuVerticalPosition / 8); uint8_t ch = 8 * (menuVerticalPosition / 8);
uint8_t channelStart = g_model.moduleData[g_moduleIdx].channelsStart; const uint8_t channelStart = g_model.moduleData[g_moduleIdx].channelsStart;
const int lim = (g_model.extendedLimits ? (512 * LIMIT_EXT_PERCENT / 100) : 512) * 2;
uint8_t wbar = LCD_W - FW * 4 - FWNUM * 4;
#if defined(PPM_UNIT_PERCENT_PREC1)
wbar -= 6;
#endif
if (event == EVT_KEY_LONG(KEY_ENTER)) { if (event == EVT_KEY_LONG(KEY_ENTER)) {
killEvents(event); killEvents(event);
@ -1090,85 +1095,70 @@ void menuModelFailsafe(event_t event)
SIMPLE_SUBMENU_NOTITLE(NUM_CHANNELS(g_moduleIdx)); SIMPLE_SUBMENU_NOTITLE(NUM_CHANNELS(g_moduleIdx));
const uint8_t SLIDER_W = 90; lcdDrawTextAlignedCenter(0, FAILSAFESET);
lcdDrawTextAlignedCenter(0*FH, FAILSAFESET);
lcdInvertLine(0); lcdInvertLine(0);
unsigned int lim = g_model.extendedLimits ? 640*2 : 512*2; const coord_t x = 1;
coord_t x = 1;
// Channels // Channels
for (uint8_t line=0; line<8; line++) { for (uint8_t line=0; line<8; line++) {
coord_t y = 9+line*7; const coord_t y = 9+line*7;
int32_t channelValue = channelOutputs[ch+channelStart]; const int32_t channelValue = channelOutputs[ch+channelStart];
int32_t failsafeValue = 0; int32_t failsafeValue = g_model.moduleData[g_moduleIdx].failsafeChannels[ch];
bool failsafeEditable = false;
if (ch < NUM_CHANNELS(g_moduleIdx)) { //Channel
failsafeValue = g_model.moduleData[g_moduleIdx].failsafeChannels[ch]; putsChn(x+1, y, ch+1, SMLSIZE);
failsafeEditable = true;
}
if (failsafeEditable) { // Value
//Channel LcdFlags flags = TINSIZE;
putsChn(x+1, y, ch+1, SMLSIZE); if (menuVerticalPosition == ch) {
flags |= INVERS;
// Value if (s_editMode) {
LcdFlags flags = TINSIZE; if (failsafeValue == FAILSAFE_CHANNEL_HOLD || failsafeValue == FAILSAFE_CHANNEL_NOPULSE) {
if (menuVerticalPosition == ch) { s_editMode = 0;
flags |= INVERS; }
if (s_editMode) { else {
if (failsafeValue == FAILSAFE_CHANNEL_HOLD || failsafeValue == FAILSAFE_CHANNEL_NOPULSE) { flags |= BLINK;
s_editMode = 0; CHECK_INCDEC_MODELVAR(event, g_model.moduleData[g_moduleIdx].failsafeChannels[ch], -lim, +lim);
}
else {
flags |= BLINK;
CHECK_INCDEC_MODELVAR(event, g_model.moduleData[g_moduleIdx].failsafeChannels[ch], -lim, +lim);
}
} }
} }
#if defined(PPM_UNIT_PERCENT_PREC1)
uint8_t wbar = SLIDER_W-6;
#else
uint8_t wbar = SLIDER_W;
#endif
uint8_t xValue = x+LCD_W-4-wbar;
if (failsafeValue == FAILSAFE_CHANNEL_HOLD) {
lcdDrawText(xValue, y, STR_HOLD, RIGHT|flags);
failsafeValue = 0;
}
else if (failsafeValue == FAILSAFE_CHANNEL_NOPULSE) {
lcdDrawText(xValue, y, STR_NONE, RIGHT|flags);
failsafeValue = 0;
}
else {
#if defined(PPM_UNIT_US)
lcdDrawNumber(xValue, y, PPM_CH_CENTER(ch)+failsafeValue/2, RIGHT|flags);
#elif defined(PPM_UNIT_PERCENT_PREC1)
lcdDrawNumber(xValue, y, calcRESXto1000(failsafeValue), RIGHT|PREC1|flags);
#else
lcdDrawNumber(xValue, y, calcRESXto1000(failsafeValue)/10, RIGHT|flags);
#endif
}
// Gauge
#if !defined(PCBX7) // X7 LCD doesn't like too many horizontal lines
lcdDrawRect(x+LCD_W-3-wbar, y, wbar+1, 6);
#endif
unsigned int lenChannel = limit((uint8_t)1, uint8_t((abs(channelValue) * wbar/2 + lim/2) / lim), uint8_t(wbar/2));
unsigned int lenFailsafe = limit((uint8_t)1, uint8_t((abs(failsafeValue) * wbar/2 + lim/2) / lim), uint8_t(wbar/2));
coord_t xChannel = (channelValue>0) ? x+LCD_W-3-wbar/2 : x+LCD_W-2-wbar/2-lenChannel;
coord_t xFailsafe = (failsafeValue>0) ? x+LCD_W-3-wbar/2 : x+LCD_W-2-wbar/2-lenFailsafe;
lcdDrawHorizontalLine(xChannel, y+1, lenChannel, DOTTED, 0);
lcdDrawHorizontalLine(xChannel, y+2, lenChannel, DOTTED, 0);
lcdDrawSolidHorizontalLine(xFailsafe, y+3, lenFailsafe);
lcdDrawSolidHorizontalLine(xFailsafe, y+4, lenFailsafe);
} }
ch++;
uint8_t xValue = x+LCD_W-4-wbar;
if (failsafeValue == FAILSAFE_CHANNEL_HOLD) {
lcdDrawText(xValue, y, STR_HOLD, RIGHT|flags);
failsafeValue = 0;
}
else if (failsafeValue == FAILSAFE_CHANNEL_NOPULSE) {
lcdDrawText(xValue, y, STR_NONE, RIGHT|flags);
failsafeValue = 0;
}
else {
#if defined(PPM_UNIT_US)
lcdDrawNumber(xValue, y, PPM_CH_CENTER(ch)+failsafeValue/2, RIGHT|flags);
#elif defined(PPM_UNIT_PERCENT_PREC1)
lcdDrawNumber(xValue, y, calcRESXto1000(failsafeValue), RIGHT|PREC1|flags);
#else
lcdDrawNumber(xValue, y, calcRESXto1000(failsafeValue)/10, RIGHT|flags);
#endif
}
// Gauge
#if !defined(PCBX7) // X7 LCD doesn't like too many horizontal lines
lcdDrawRect(x+LCD_W-3-wbar, y, wbar+1, 6);
#endif
const uint8_t lenChannel = limit<uint8_t>(1, (abs(channelValue) * wbar/2 + lim/2) / lim, wbar/2);
const uint8_t lenFailsafe = limit<uint8_t>(1, (abs(failsafeValue) * wbar/2 + lim/2) / lim, wbar/2);
const coord_t xChannel = (channelValue>0) ? x+LCD_W-3-wbar/2 : x+LCD_W-2-wbar/2-lenChannel;
const coord_t xFailsafe = (failsafeValue>0) ? x+LCD_W-3-wbar/2 : x+LCD_W-2-wbar/2-lenFailsafe;
lcdDrawHorizontalLine(xChannel, y+1, lenChannel, DOTTED, 0);
lcdDrawHorizontalLine(xChannel, y+2, lenChannel, DOTTED, 0);
lcdDrawSolidHorizontalLine(xFailsafe, y+3, lenFailsafe);
lcdDrawSolidHorizontalLine(xFailsafe, y+4, lenFailsafe);
if (++ch >= NUM_CHANNELS(g_moduleIdx))
break;
} }
} }
#endif #endif

View file

@ -2,7 +2,7 @@
* Copyright (C) OpenTX * Copyright (C) OpenTX
* *
* Based on code named * 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 * er9x - http://code.google.com/p/er9x
* gruvin9x - http://code.google.com/p/gruvin9x * gruvin9x - http://code.google.com/p/gruvin9x
* *
@ -101,11 +101,11 @@ void menuChannelsView(event_t event)
#endif #endif
// Gauge // Gauge
// #ifdef MIXERS_MONITOR // uint16_t lim = (g_model.extendedLimits ? (512 * LIMIT_EXT_PERCENT / 100) : 512) * 2;
// uint16_t lim = mixersView ? 512*2*2 : (g_model.extendedLimits ? 640*2 : 512*2); //#ifdef MIXERS_MONITOR
// #else // if (mixersView)
// uint16_t lim = g_model.extendedLimits ? 640*2 : 512*2; // lim = 512 * 2 * 2;
// #endif //#endif
// TODO ? drawGauge(x+LCD_W/2-3-wbar-ofs, y, wbar, 6, val, lim); // TODO ? drawGauge(x+LCD_W/2-3-wbar-ofs, y, wbar, 6, val, lim);
ch++; ch++;

View file

@ -495,10 +495,11 @@ void menuMainView(event_t event)
x0 = i<4 ? LCD_W/4+2 : LCD_W*3/4-2; x0 = i<4 ? LCD_W/4+2 : LCD_W*3/4-2;
y0 = 38+(i%4)*5; y0 = 38+(i%4)*5;
uint16_t lim = g_model.extendedLimits ? 640*2 : 512*2; const uint16_t lim = (g_model.extendedLimits ? 512 * uint8_t(LIMIT_EXT_PERCENT / 100) : 512) * 2;
int8_t len = (abs(val) * WBAR2 + lim/2) / lim; int8_t len = (abs(val) * WBAR2 + lim/2) / lim;
if (len>WBAR2) len = WBAR2; // prevent bars from going over the end - comment for debugging if (len>WBAR2)
len = WBAR2; // prevent bars from going over the end - comment for debugging
lcdDrawHorizontalLine(x0-WBAR2, y0, WBAR2*2+1, DOTTED); lcdDrawHorizontalLine(x0-WBAR2, y0, WBAR2*2+1, DOTTED);
lcdDrawSolidVerticalLine(x0, y0-2,5 ); lcdDrawSolidVerticalLine(x0, y0-2,5 );
if (val > 0) if (val > 0)

View file

@ -990,10 +990,19 @@ void menuModelSetup(event_t event)
void menuModelFailsafe(event_t event) void menuModelFailsafe(event_t event)
{ {
static bool longNames = false; static uint8_t maxNameLen = 4;
bool newLongNames = false; static int8_t lastModel = g_eeGeneral.currModel;
const coord_t barH = (LCD_H - FH) / 8 - 1;
const int lim = (g_model.extendedLimits ? (512 * LIMIT_EXT_PERCENT / 100) : 512) * 2;
const uint8_t channelStart = g_model.moduleData[g_moduleIdx].channelsStart;
uint8_t ch = 0; uint8_t ch = 0;
uint8_t channelStart = g_model.moduleData[g_moduleIdx].channelsStart; uint8_t cols = 1;
uint8_t colW = LCD_W;
if (lastModel != g_eeGeneral.currModel) {
lastModel = g_eeGeneral.currModel;
maxNameLen = 4;
}
if (event == EVT_KEY_LONG(KEY_ENTER)) { if (event == EVT_KEY_LONG(KEY_ENTER)) {
killEvents(event); killEvents(event);
@ -1020,102 +1029,98 @@ void menuModelFailsafe(event_t event)
} }
SIMPLE_SUBMENU_NOTITLE(NUM_CHANNELS(g_moduleIdx)); SIMPLE_SUBMENU_NOTITLE(NUM_CHANNELS(g_moduleIdx));
SET_SCROLLBAR_X(0);
#define COL_W (LCD_W/2)
const uint8_t SLIDER_W = 64;
if (NUM_CHANNELS(g_moduleIdx) > 8) { if (NUM_CHANNELS(g_moduleIdx) > 8) {
cols = 2;
colW = LCD_W / cols - 1;
// Column separator // Column separator
lcdDrawSolidVerticalLine(LCD_W/2, FH, LCD_H-FH); lcdDrawSolidVerticalLine(colW, FH, LCD_H - FH);
} }
lcdDrawTextAlignedCenter(0*FH, FAILSAFESET); lcdDrawTextAlignedCenter(0, FAILSAFESET);
lcdInvertLine(0); lcdInvertLine(0);
unsigned int lim = g_model.extendedLimits ? 640*2 : 512*2; coord_t x = colW;
for (uint8_t col = 0; col < cols; col++) {
for (uint8_t col=0; col<2; col++) { coord_t y = FH + 1;
coord_t x = col*COL_W+1; for (uint8_t line = 0; line < 8; line++) {
const int32_t channelValue = channelOutputs[ch+channelStart];
// Channels int32_t failsafeValue = g_model.moduleData[g_moduleIdx].failsafeChannels[8*col+line];
for (uint8_t line=0; line<8; line++) { uint8_t lenLabel = ZLEN(g_model.limitData[ch+channelStart].name);
coord_t y = 9+line*7; uint8_t barW = colW - FW * maxNameLen - FWNUM * 3; // default bar width
int32_t channelValue = channelOutputs[ch+channelStart];
int32_t failsafeValue = 0;
bool failsafeEditable = false;
uint8_t ofs = (col ? 0 : 1);
if (ch < NUM_CHANNELS(g_moduleIdx)) {
failsafeValue = g_model.moduleData[g_moduleIdx].failsafeChannels[8*col+line];
failsafeEditable = true;
}
if (failsafeEditable) {
// Channel name if present, number if not
uint8_t lenLabel = ZLEN(g_model.limitData[ch+channelStart].name);
if (lenLabel > 4) {
newLongNames = longNames = true;
}
if (lenLabel > 0)
lcdDrawSizedText(x+1-ofs, y, g_model.limitData[ch+channelStart].name, sizeof(g_model.limitData[ch+channelStart].name), ZCHAR | SMLSIZE);
else
putsChn(x+1-ofs, y, ch+1, SMLSIZE);
// Value
LcdFlags flags = TINSIZE;
if (menuVerticalPosition == ch) {
flags |= INVERS;
if (s_editMode) {
if (failsafeValue == FAILSAFE_CHANNEL_HOLD || failsafeValue == FAILSAFE_CHANNEL_NOPULSE) {
s_editMode = 0;
}
else {
flags |= BLINK;
CHECK_INCDEC_MODELVAR(event, g_model.moduleData[g_moduleIdx].failsafeChannels[8*col+line], -lim, +lim);
}
}
}
#if defined(PPM_UNIT_PERCENT_PREC1) #if defined(PPM_UNIT_PERCENT_PREC1)
uint8_t wbar = (longNames ? SLIDER_W-16 : SLIDER_W-6); barW -= FWNUM + 1;
#else
uint8_t wbar = (longNames ? SLIDER_W-10 : SLIDER_W);
#endif #endif
barW += (barW % 2);
uint8_t xValue = x+COL_W-4-wbar-ofs; // Channel name if present, number if not
if (failsafeValue == FAILSAFE_CHANNEL_HOLD) { if (lenLabel > 0) {
lcdDrawText(xValue, y, STR_HOLD, RIGHT|flags); if (lenLabel > maxNameLen)
failsafeValue = 0; maxNameLen = lenLabel;
} lcdDrawSizedText(x - colW, y, g_model.limitData[ch+channelStart].name, sizeof(g_model.limitData[ch+channelStart].name), ZCHAR | SMLSIZE);
else if (failsafeValue == FAILSAFE_CHANNEL_NOPULSE) { }
lcdDrawText(xValue, y, STR_NONE, RIGHT|flags); else {
failsafeValue = 0; putsChn(x - colW, y, ch+1, SMLSIZE);
}
else {
#if defined(PPM_UNIT_US)
lcdDrawNumber(xValue, y, PPM_CH_CENTER(ch)+failsafeValue/2, RIGHT|flags);
#elif defined(PPM_UNIT_PERCENT_PREC1)
lcdDrawNumber(xValue, y, calcRESXto1000(failsafeValue), RIGHT|PREC1|flags);
#else
lcdDrawNumber(xValue, y, calcRESXto1000(failsafeValue)/10, RIGHT|flags);
#endif
}
// Gauge
lcdDrawRect(x+COL_W-3-wbar-ofs, y, wbar+1, 6);
unsigned int lenChannel = limit((uint8_t)1, uint8_t((abs(channelValue) * wbar/2 + lim/2) / lim), uint8_t(wbar/2));
unsigned int lenFailsafe = limit((uint8_t)1, uint8_t((abs(failsafeValue) * wbar/2 + lim/2) / lim), uint8_t(wbar/2));
coord_t xChannel = (channelValue>0) ? x+COL_W-ofs-3-wbar/2 : x+COL_W-ofs-2-wbar/2-lenChannel;
coord_t xFailsafe = (failsafeValue>0) ? x+COL_W-ofs-3-wbar/2 : x+COL_W-ofs-2-wbar/2-lenFailsafe;
lcdDrawHorizontalLine(xChannel, y+1, lenChannel, DOTTED, 0);
lcdDrawHorizontalLine(xChannel, y+2, lenChannel, DOTTED, 0);
lcdDrawSolidHorizontalLine(xFailsafe, y+3, lenFailsafe);
lcdDrawSolidHorizontalLine(xFailsafe, y+4, lenFailsafe);
} }
ch++;
}
}
longNames = newLongNames; // Value
LcdFlags flags = TINSIZE;
if (menuVerticalPosition == ch) {
flags |= INVERS;
if (s_editMode) {
if (failsafeValue == FAILSAFE_CHANNEL_HOLD || failsafeValue == FAILSAFE_CHANNEL_NOPULSE) {
s_editMode = 0;
}
else {
flags |= BLINK;
CHECK_INCDEC_MODELVAR(event, g_model.moduleData[g_moduleIdx].failsafeChannels[8*col+line], -lim, +lim);
}
}
}
const coord_t xValue = x - barW;
if (failsafeValue == FAILSAFE_CHANNEL_HOLD) {
lcdDrawText(xValue, y, STR_HOLD, RIGHT|flags);
failsafeValue = 0;
}
else if (failsafeValue == FAILSAFE_CHANNEL_NOPULSE) {
lcdDrawText(xValue, y, STR_NONE, RIGHT|flags);
failsafeValue = 0;
}
else {
#if defined(PPM_UNIT_US)
lcdDrawNumber(xValue, y, PPM_CH_CENTER(ch)+failsafeValue/2, RIGHT|flags);
#elif defined(PPM_UNIT_PERCENT_PREC1)
lcdDrawNumber(xValue, y, calcRESXto1000(failsafeValue), RIGHT|PREC1|flags);
#else
lcdDrawNumber(xValue, y, calcRESXto1000(failsafeValue)/10, RIGHT|flags);
#endif
}
// Gauge
lcdDrawRect(x - barW, y, barW - 1, barH);
barW = barW / 2 - 1;
const coord_t lenChannel = limit<uint8_t>(1, (abs(channelValue) * barW + lim / 2) / lim, barW);
const coord_t lenFailsafe = limit<uint8_t>(1, (abs(failsafeValue) * barW + lim / 2) / lim, barW);
const coord_t barX = x - barW - 2;
const coord_t xChannel = (channelValue >= 0) ? barX : barX - lenChannel + 1;
const coord_t xFailsafe = (failsafeValue > 0) ? barX : barX - lenFailsafe + 1;
lcdDrawHorizontalLine(xChannel, y+1, lenChannel, DOTTED, 0);
lcdDrawHorizontalLine(xChannel, y+2, lenChannel, DOTTED, 0);
lcdDrawSolidHorizontalLine(xFailsafe, y+3, lenFailsafe);
lcdDrawSolidHorizontalLine(xFailsafe, y+4, lenFailsafe);
if (++ch >= NUM_CHANNELS(g_moduleIdx))
break;
y += barH + 1;
} // channels
x += colW + 2;
} // columns
} }

View file

@ -2,7 +2,7 @@
* Copyright (C) OpenTX * Copyright (C) OpenTX
* *
* Based on code named * 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 * er9x - http://code.google.com/p/er9x
* gruvin9x - http://code.google.com/p/gruvin9x * gruvin9x - http://code.google.com/p/gruvin9x
* *
@ -23,12 +23,11 @@
void menuChannelsView(event_t event) void menuChannelsView(event_t event)
{ {
static bool longNames = false; static bool longNames = false;
bool newLongNames = false;
static bool secondPage = false; static bool secondPage = false;
#ifdef MIXERS_MONITOR
static bool mixersView = false; static bool mixersView = false;
#endif uint8_t ch = 0;
uint8_t ch; uint8_t wbar = (longNames ? 54 : 64);
int16_t limits = 512 * 2;
switch(event) switch(event)
{ {
@ -48,69 +47,56 @@ void menuChannelsView(event_t event)
if (secondPage) if (secondPage)
ch = 16; ch = 16;
else
ch = 0;
#ifdef MIXERS_MONITOR
if (mixersView) 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 else
#endif lcdDrawTextAlignedCenter(0, CHANNELS_MONITOR);
lcdDrawTextAlignedCenter(0*FH, CHANNELS_MONITOR);
lcdInvertLine(0); lcdInvertLine(0);
// Column separator // Column separator
lcdDrawSolidVerticalLine(LCD_W/2, FH, LCD_H-FH); lcdDrawSolidVerticalLine(LCD_W/2, FH, LCD_H-FH);
for (uint8_t col=0; col<2; col++) { for (uint8_t col=0; col < 2; col++) {
const uint8_t x = col * LCD_W / 2 + 1;
uint8_t x = col*LCD_W/2+1; const uint8_t ofs = (col ? 0 : 1);
// Channels // Channels
for (uint8_t line=0; line<8; line++) { for (uint8_t line=0; line < 8; line++) {
uint8_t y = 9+line*7; const uint8_t y = 9 + line * 7;
#ifdef MIXERS_MONITOR const int32_t val = mixersView ? ex_chans[ch] : channelOutputs[ch];
int32_t val = (mixersView) ? ex_chans[ch] : channelOutputs[ch]; const uint8_t lenLabel = ZLEN(g_model.limitData[ch].name);
#else
int32_t val = channelOutputs[ch];
#endif
uint8_t ofs = (col ? 0 : 1);
// Channel name if present, number if not // Channel name if present, number if not
uint8_t lenLabel = ZLEN(g_model.limitData[ch].name); if (lenLabel > 0) {
if (lenLabel > 4) { if (lenLabel > 4)
newLongNames = longNames = true; longNames = true;
}
if (lenLabel > 0)
lcdDrawSizedText(x+1-ofs, y, g_model.limitData[ch].name, sizeof(g_model.limitData[ch].name), ZCHAR | SMLSIZE); 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); putsChn(x+1-ofs, y, ch+1, SMLSIZE);
}
// Value // Value
#if defined(PPM_UNIT_US) #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); lcdDrawNumber(x+LCD_W/2-3-wbar-ofs, y+1, PPM_CH_CENTER(ch)+val/2, TINSIZE|RIGHT);
#elif defined(PPM_UNIT_PERCENT_PREC1) #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); lcdDrawNumber(x+LCD_W/2-3-wbar-ofs, y+1, calcRESXto1000(val), PREC1|TINSIZE|RIGHT);
#else #else
uint8_t wbar = (longNames ? 54 : 64);
lcdDrawNumber(x+LCD_W/2-3-wbar-ofs, y+1, calcRESXto1000(val)/10, TINSIZE|RIGHT); lcdDrawNumber(x+LCD_W/2-3-wbar-ofs, y+1, calcRESXto1000(val)/10, TINSIZE|RIGHT);
#endif #endif
// Gauge // Gauge
#ifdef MIXERS_MONITOR drawGauge(x+LCD_W/2-3-wbar-ofs, y, wbar, 6, val, limits);
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);
ch++; ++ch;
} }
} }
longNames = newLongNames;
} }

View file

@ -284,14 +284,14 @@ bool menuModelMixOne(event_t event)
#define MIX_LINE_NAME_FM_POS 390 #define MIX_LINE_NAME_FM_POS 390
#define MIX_LINE_SELECT_POS 50 #define MIX_LINE_SELECT_POS 50
#define MIX_LINE_SELECT_WIDTH (LCD_W-MIX_LINE_SELECT_POS-15) #define MIX_LINE_SELECT_WIDTH (LCD_W-MIX_LINE_SELECT_POS-15)
#define MIX_STATUS_MARGIN_LEFT MENUS_MARGIN_LEFT + 45
#define MIX_STATUS_ICON_MIXER MENUS_MARGIN_LEFT + 185
#define MIX_STATUS_ICON_TO MENUS_MARGIN_LEFT + 205
#define MIX_STATUS_ICON_OUTPUT MENUS_MARGIN_LEFT + 240
#define MIX_STATUS_OUT_NAME MENUS_MARGIN_LEFT + 265
#define MIX_STATUS_OUT_BAR MENUS_MARGIN_LEFT + 320
#define MIX_STATUS_BAR_W 130 #define MIX_STATUS_BAR_W 130
#define MIX_STATUS_BAR_H 13 #define MIX_STATUS_BAR_H 13
#define MIX_STATUS_CHAN_BAR MENUS_MARGIN_LEFT + 45
#define MIX_STATUS_ICON_MIXER MIX_STATUS_CHAN_BAR + 140
#define MIX_STATUS_ICON_TO MIX_STATUS_ICON_MIXER + 20
#define MIX_STATUS_ICON_OUTPUT MIX_STATUS_ICON_TO + 35
#define MIX_STATUS_OUT_NAME MIX_STATUS_ICON_OUTPUT + 25
#define MIX_STATUS_OUT_BAR LCD_W - MENUS_MARGIN_LEFT - MIX_STATUS_BAR_W
void lineMixSurround(coord_t y, LcdFlags flags=CURVE_AXIS_COLOR) void lineMixSurround(coord_t y, LcdFlags flags=CURVE_AXIS_COLOR)
{ {
@ -372,13 +372,16 @@ void displayMixLine(coord_t y, MixData *md)
void displayMixStatus(uint8_t channel) void displayMixStatus(uint8_t channel)
{ {
lcdDrawNumber(MENUS_MARGIN_LEFT, MENU_FOOTER_TOP, channel + 1, MENU_TITLE_COLOR, 0, "CH", NULL); lcdDrawNumber(MENUS_MARGIN_LEFT, MENU_FOOTER_TOP, channel + 1, MENU_TITLE_COLOR, 0, "CH", NULL);
drawSingleMixerBar(MIX_STATUS_MARGIN_LEFT, MENU_FOOTER_TOP + 4, MIX_STATUS_BAR_W, MIX_STATUS_BAR_H, channel); drawSingleMixerBar(MIX_STATUS_CHAN_BAR, MENU_FOOTER_TOP + 4, MIX_STATUS_BAR_W, MIX_STATUS_BAR_H, channel);
lcd->drawBitmap(MIX_STATUS_ICON_MIXER, MENU_FOOTER_TOP, mixerSetupMixerBitmap); lcd->drawBitmap(MIX_STATUS_ICON_MIXER, MENU_FOOTER_TOP, mixerSetupMixerBitmap);
lcd->drawBitmap(MIX_STATUS_ICON_TO, MENU_FOOTER_TOP, mixerSetupToBitmap); lcd->drawBitmap(MIX_STATUS_ICON_TO, MENU_FOOTER_TOP, mixerSetupToBitmap);
lcd->drawBitmap(MIX_STATUS_ICON_OUTPUT, MENU_FOOTER_TOP, mixerSetupOutputBitmap); lcd->drawBitmap(MIX_STATUS_ICON_OUTPUT, MENU_FOOTER_TOP, mixerSetupOutputBitmap);
lcdDrawSizedText(MIX_STATUS_OUT_NAME, MENU_FOOTER_TOP, g_model.limitData[channel].name, sizeof(g_model.limitData[channel].name), MENU_TITLE_COLOR | LEFT | ZCHAR); if (g_model.limitData[channel].name[0] == '\0')
lcdDrawNumber(MIX_STATUS_OUT_NAME, MENU_FOOTER_TOP, channel + 1, MENU_TITLE_COLOR, 0, "CH", NULL);
else
lcdDrawSizedText(MIX_STATUS_OUT_NAME, MENU_FOOTER_TOP, g_model.limitData[channel].name, sizeof(g_model.limitData[channel].name), MENU_TITLE_COLOR | LEFT | ZCHAR);
drawSingleOutputBar(MIX_STATUS_OUT_BAR, MENU_FOOTER_TOP + 4, MIX_STATUS_BAR_W, MIX_STATUS_BAR_H, channel); drawSingleOutputBar(MIX_STATUS_OUT_BAR, MENU_FOOTER_TOP + 4, MIX_STATUS_BAR_W, MIX_STATUS_BAR_H, channel);
} }

View file

@ -904,7 +904,9 @@ bool menuModelSetup(event_t event)
bool menuModelFailsafe(event_t event) bool menuModelFailsafe(event_t event)
{ {
uint8_t ch = 0; uint8_t ch = 0;
uint8_t channelStart = g_model.moduleData[g_moduleIdx].channelsStart; const uint8_t channelStart = g_model.moduleData[g_moduleIdx].channelsStart;
const int lim = (g_model.extendedLimits ? (512 * LIMIT_EXT_PERCENT / 100) : 512) * 2;
const uint8_t SLIDER_W = 128;
if (event == EVT_KEY_LONG(KEY_ENTER)) { if (event == EVT_KEY_LONG(KEY_ENTER)) {
killEvents(event); killEvents(event);
@ -933,82 +935,71 @@ bool menuModelFailsafe(event_t event)
SIMPLE_SUBMENU_WITH_OPTIONS("FAILSAFE", ICON_STATS_ANALOGS, NUM_CHANNELS(g_moduleIdx), OPTION_MENU_NO_SCROLLBAR); SIMPLE_SUBMENU_WITH_OPTIONS("FAILSAFE", ICON_STATS_ANALOGS, NUM_CHANNELS(g_moduleIdx), OPTION_MENU_NO_SCROLLBAR);
drawStringWithIndex(50, 3+FH, "Module", g_moduleIdx+1, MENU_TITLE_COLOR); drawStringWithIndex(50, 3+FH, "Module", g_moduleIdx+1, MENU_TITLE_COLOR);
#define COL_W (LCD_W/2)
const uint8_t SLIDER_W = 128;
unsigned int lim = g_model.extendedLimits ? 640*2 : 512*2;
for (uint8_t col=0; col<2; col++) { for (uint8_t col=0; col<2; col++) {
for (uint8_t line=0; line<8; line++) { for (uint8_t line=0; line<8; line++) {
coord_t x = col*(LCD_W/2); coord_t x = col*(LCD_W/2);
coord_t y = MENU_CONTENT_TOP - FH + line*(FH+4); const coord_t y = MENU_CONTENT_TOP - FH + line*(FH+4);
int32_t channelValue = channelOutputs[ch+channelStart]; const int32_t channelValue = channelOutputs[ch+channelStart];
int32_t failsafeValue = 0; int32_t failsafeValue = g_model.moduleData[g_moduleIdx].failsafeChannels[8*col+line];
bool failsafeEditable = false;
if (ch < NUM_CHANNELS(g_moduleIdx)) { // Channel name if present, number if not
failsafeValue = g_model.moduleData[g_moduleIdx].failsafeChannels[8*col+line]; if (g_model.limitData[ch+channelStart].name[0] != '\0') {
failsafeEditable = true; putsChn(x+MENUS_MARGIN_LEFT, y-3, ch+1, TINSIZE);
lcdDrawSizedText(x+MENUS_MARGIN_LEFT, y+5, g_model.limitData[ch+channelStart].name, sizeof(g_model.limitData[ch+channelStart].name), ZCHAR|SMLSIZE);
}
else {
putsChn(x+MENUS_MARGIN_LEFT, y, ch+1, 0);
} }
if (failsafeEditable) { // Value
// Channel name if present, number if not LcdFlags flags = RIGHT;
uint8_t lenLabel = ZLEN(g_model.limitData[ch+channelStart].name); if (menuVerticalPosition == ch) {
if (lenLabel > 0) { flags |= INVERS;
putsChn(x+MENUS_MARGIN_LEFT, y-3, ch+1, TINSIZE); if (s_editMode) {
lcdDrawSizedText(x+MENUS_MARGIN_LEFT, y+5, g_model.limitData[ch+channelStart].name, sizeof(g_model.limitData[ch+channelStart].name), ZCHAR|SMLSIZE); if (failsafeValue == FAILSAFE_CHANNEL_HOLD || failsafeValue == FAILSAFE_CHANNEL_NOPULSE) {
} s_editMode = 0;
else { }
putsChn(x+MENUS_MARGIN_LEFT, y, ch+1, 0); else {
} flags |= BLINK;
CHECK_INCDEC_MODELVAR(event, g_model.moduleData[g_moduleIdx].failsafeChannels[8*col+line], -lim, +lim);
// Value
LcdFlags flags = RIGHT;
if (menuVerticalPosition == ch) {
flags |= INVERS;
if (s_editMode) {
if (failsafeValue == FAILSAFE_CHANNEL_HOLD || failsafeValue == FAILSAFE_CHANNEL_NOPULSE) {
s_editMode = 0;
}
else {
flags |= BLINK;
CHECK_INCDEC_MODELVAR(event, g_model.moduleData[g_moduleIdx].failsafeChannels[8*col+line], -lim, +lim);
}
} }
} }
x += COL_W-4-MENUS_MARGIN_LEFT-SLIDER_W;
if (failsafeValue == FAILSAFE_CHANNEL_HOLD) {
lcdDrawText(x, y+2, "HOLD", flags|SMLSIZE);
failsafeValue = 0;
}
else if (failsafeValue == FAILSAFE_CHANNEL_NOPULSE) {
lcdDrawText(x, y+2, "NONE", flags|SMLSIZE);
failsafeValue = 0;
}
else {
#if defined(PPM_UNIT_US)
lcdDrawNumber(x, y, PPM_CH_CENTER(ch)+failsafeValue/2, flags);
#elif defined(PPM_UNIT_PERCENT_PREC1)
lcdDrawNumber(x, y, calcRESXto1000(failsafeValue), PREC1|flags);
#else
lcdDrawNumber(x, y, calcRESXto1000(failsafeValue)/10, flags);
#endif
}
// Gauge
x += 4;
lcdDrawRect(x, y+3, SLIDER_W+1, 12);
unsigned int lenChannel = limit((uint8_t)1, uint8_t((abs(channelValue) * SLIDER_W/2 + lim/2) / lim), uint8_t(SLIDER_W/2));
unsigned int lenFailsafe = limit((uint8_t)1, uint8_t((abs(failsafeValue) * SLIDER_W/2 + lim/2) / lim), uint8_t(SLIDER_W/2));
x += SLIDER_W/2;
coord_t xChannel = (channelValue>0) ? x : x+1-lenChannel;
coord_t xFailsafe = (failsafeValue>0) ? x : x+1-lenFailsafe;
lcdDrawSolidFilledRect(xChannel, y+4, lenChannel, 5, TEXT_COLOR);
lcdDrawSolidFilledRect(xFailsafe, y+9, lenFailsafe, 5, ALARM_COLOR);
} }
ch++;
x += (LCD_W/2)-4-MENUS_MARGIN_LEFT-SLIDER_W;
if (failsafeValue == FAILSAFE_CHANNEL_HOLD) {
lcdDrawText(x, y+2, "HOLD", flags|SMLSIZE);
failsafeValue = 0;
}
else if (failsafeValue == FAILSAFE_CHANNEL_NOPULSE) {
lcdDrawText(x, y+2, "NONE", flags|SMLSIZE);
failsafeValue = 0;
}
else {
#if defined(PPM_UNIT_US)
lcdDrawNumber(x, y, PPM_CH_CENTER(ch)+failsafeValue/2, flags);
#elif defined(PPM_UNIT_PERCENT_PREC1)
lcdDrawNumber(x, y, calcRESXto1000(failsafeValue), PREC1|flags);
#else
lcdDrawNumber(x, y, calcRESXto1000(failsafeValue)/10, flags);
#endif
}
// Gauge
x += 4;
lcdDrawRect(x, y+3, SLIDER_W+1, 12);
const coord_t lenChannel = limit((uint8_t)1, uint8_t((abs(channelValue) * SLIDER_W/2 + lim/2) / lim), uint8_t(SLIDER_W/2));
const coord_t lenFailsafe = limit((uint8_t)1, uint8_t((abs(failsafeValue) * SLIDER_W/2 + lim/2) / lim), uint8_t(SLIDER_W/2));
x += SLIDER_W/2;
const coord_t xChannel = (channelValue>0) ? x : x+1-lenChannel;
const coord_t xFailsafe = (failsafeValue>0) ? x : x+1-lenFailsafe;
lcdDrawSolidFilledRect(xChannel, y+4, lenChannel, 5, TEXT_COLOR);
lcdDrawSolidFilledRect(xFailsafe, y+9, lenFailsafe, 5, ALARM_COLOR);
if (++ch >= NUM_CHANNELS(g_moduleIdx))
break;
} }
} }

View file

@ -30,6 +30,8 @@
#define Y_MIXBAR 28 #define Y_MIXBAR 28
#define LEG_COLORBOX 15 #define LEG_COLORBOX 15
#define VIEW_CHANNELS_LIMIT_PCT (g_model.extendedLimits ? LIMIT_EXT_PERCENT : 100)
bool menuChannelsMonitor(event_t event, uint8_t page); bool menuChannelsMonitor(event_t event, uint8_t page);
bool menuLogicalSwitches(event_t); bool menuLogicalSwitches(event_t);
@ -53,7 +55,7 @@ uint8_t lastMonitorPage = 0;
uint16_t posOnBar(int16_t value_to100) uint16_t posOnBar(int16_t value_to100)
{ {
return divRoundClosest((value_to100 + (g_model.extendedLimits ? 150 : 100)) * COLUMN_SIZE, (g_model.extendedLimits ? 150 : 100) * 2); return divRoundClosest((value_to100 + VIEW_CHANNELS_LIMIT_PCT) * COLUMN_SIZE, VIEW_CHANNELS_LIMIT_PCT * 2);
} }
void drawOutputBarLimits(coord_t left, coord_t right, coord_t y) void drawOutputBarLimits(coord_t left, coord_t right, coord_t y)
@ -70,17 +72,19 @@ void drawOutputBarLimits(coord_t left, coord_t right, coord_t y)
void drawSingleMixerBar(coord_t x, coord_t y, coord_t w, coord_t h, uint8_t channel) void drawSingleMixerBar(coord_t x, coord_t y, coord_t w, coord_t h, uint8_t channel)
{ {
int16_t chanVal = calcRESXto100(ex_chans[channel]); int16_t chanVal = calcRESXto100(ex_chans[channel]);
int16_t displayVal = chanVal; const int16_t displayVal = chanVal;
chanVal = limit<int16_t>(-100, chanVal, 100);
// this could be handled nicer, but slower, by checking actual range for this mixer
chanVal = limit<int16_t>(-VIEW_CHANNELS_LIMIT_PCT, chanVal, VIEW_CHANNELS_LIMIT_PCT);
lcdDrawSolidFilledRect(x, y, w, h, BARGRAPH_BGCOLOR); lcdDrawSolidFilledRect(x, y, w, h, BARGRAPH_BGCOLOR);
if (chanVal > 0) { if (chanVal > 0) {
lcdDrawSolidFilledRect(x + w / 2, y, divRoundClosest(chanVal * w, 200), h, BARGRAPH2_COLOR); lcdDrawSolidFilledRect(x + w / 2, y, divRoundClosest(chanVal * w, VIEW_CHANNELS_LIMIT_PCT * 2), h, BARGRAPH2_COLOR);
lcdDrawNumber(x - 10 + w / 2, y - 2, displayVal, SMLSIZE | TEXT_COLOR | RIGHT, 0, NULL, "%"); lcdDrawNumber(x - 10 + w / 2, y - 2, displayVal, SMLSIZE | TEXT_COLOR | RIGHT, 0, NULL, "%");
} }
else if (chanVal < 0) { else if (chanVal < 0) {
uint16_t endpoint = x + w / 2; const uint16_t endpoint = x + w / 2;
uint16_t size = divRoundClosest(-chanVal * w, 200); const uint16_t size = divRoundClosest(-chanVal * w, VIEW_CHANNELS_LIMIT_PCT * 2);
lcdDrawSolidFilledRect(endpoint - size, y, size, h, BARGRAPH2_COLOR); lcdDrawSolidFilledRect(endpoint - size, y, size, h, BARGRAPH2_COLOR);
lcdDrawNumber(x + 10 + w / 2, y - 2, displayVal, SMLSIZE | TEXT_COLOR, 0, NULL, "%"); lcdDrawNumber(x + 10 + w / 2, y - 2, displayVal, SMLSIZE | TEXT_COLOR, 0, NULL, "%");
} }
@ -93,16 +97,16 @@ void drawSingleOutputBar(coord_t x, coord_t y, coord_t w, coord_t h, uint8_t cha
int16_t chanVal = calcRESXto100(channelOutputs[channel]); int16_t chanVal = calcRESXto100(channelOutputs[channel]);
int16_t displayVal = chanVal; int16_t displayVal = chanVal;
chanVal = limit<int16_t>(-100, chanVal, 100); chanVal = limit<int16_t>(-VIEW_CHANNELS_LIMIT_PCT, chanVal, VIEW_CHANNELS_LIMIT_PCT);
lcdDrawSolidFilledRect(x, y, w, h, BARGRAPH_BGCOLOR); lcdDrawSolidFilledRect(x, y, w, h, BARGRAPH_BGCOLOR);
if (chanVal > 0) { if (chanVal > 0) {
lcdDrawSolidFilledRect(x + w / 2, y, divRoundClosest(chanVal * w, 200), h, BARGRAPH1_COLOR); lcdDrawSolidFilledRect(x + w / 2, y, divRoundClosest(chanVal * w, VIEW_CHANNELS_LIMIT_PCT * 2), h, BARGRAPH1_COLOR);
lcdDrawNumber(x - 10 + w / 2, y - 2, displayVal, SMLSIZE | TEXT_COLOR | RIGHT, 0, NULL, "%"); lcdDrawNumber(x - 10 + w / 2, y - 2, displayVal, SMLSIZE | TEXT_COLOR | RIGHT, 0, NULL, "%");
} }
else if (chanVal < 0) { else if (chanVal < 0) {
uint16_t endpoint = x + w / 2; uint16_t endpoint = x + w / 2;
uint16_t size = divRoundClosest(-chanVal * w, 200); uint16_t size = divRoundClosest(-chanVal * w, VIEW_CHANNELS_LIMIT_PCT * 2);
lcdDrawSolidFilledRect(endpoint - size, y, size, h, BARGRAPH1_COLOR); lcdDrawSolidFilledRect(endpoint - size, y, size, h, BARGRAPH1_COLOR);
lcdDrawNumber(x + 10 + w / 2, y - 2, displayVal, SMLSIZE | TEXT_COLOR, 0, NULL, "%"); lcdDrawNumber(x + 10 + w / 2, y - 2, displayVal, SMLSIZE | TEXT_COLOR, 0, NULL, "%");
} }
@ -113,40 +117,46 @@ void drawSingleOutputBar(coord_t x, coord_t y, coord_t w, coord_t h, uint8_t cha
void drawComboOutputBar(coord_t x, coord_t y, coord_t w, coord_t h, uint8_t channel) void drawComboOutputBar(coord_t x, coord_t y, coord_t w, coord_t h, uint8_t channel)
{ {
char chanString[] = "Ch32 "; char chanString[] = "Ch32 ";
uint16_t limits = (g_model.extendedLimits ? 300 : 200);
int16_t chanVal = calcRESXto100(channelOutputs[channel]); int16_t chanVal = calcRESXto100(channelOutputs[channel]);
LimitData * ld = limitAddress(channel); LimitData * ld = limitAddress(channel);
int usValue = PPM_CH_CENTER(channel) + channelOutputs[channel] / 2;
const uint16_t limPos = ld ? posOnBar(calcRESXto100(ld->offset)) : 0;
uint16_t valPos;
strAppendSigned(&chanString[2], channel + 1, 2); strAppendSigned(&chanString[2], channel + 1, 2);
lcdDrawText(x, y, chanString, SMLSIZE | TEXT_COLOR | LEFT); lcdDrawText(x, y, chanString, SMLSIZE | TEXT_COLOR | LEFT);
lcdDrawSizedText(x + 45, y, g_model.limitData[channel].name, sizeof(g_model.limitData[channel].name), SMLSIZE | TEXT_COLOR | LEFT | ZCHAR); lcdDrawSizedText(x + 45, y, g_model.limitData[channel].name, sizeof(g_model.limitData[channel].name), SMLSIZE | TEXT_COLOR | LEFT | ZCHAR);
int usValue = PPM_CH_CENTER(channel) + channelOutputs[channel] / 2;
lcdDrawNumber(x + w, y, usValue, SMLSIZE | TEXT_COLOR | RIGHT, 0, NULL, STR_US); lcdDrawNumber(x + w, y, usValue, SMLSIZE | TEXT_COLOR | RIGHT, 0, NULL, STR_US);
lcdDrawSolidFilledRect(x, y + Y_OUTBAR, w, h, BARGRAPH_BGCOLOR); lcdDrawSolidFilledRect(x, y + Y_OUTBAR, w, h, BARGRAPH_BGCOLOR);
lcd->drawSolidVerticalLine(x + posOnBar(calcRESXto100(ld->offset)), y + Y_OUTBAR, h, MAINVIEW_GRAPHICS_COLOR); lcd->drawSolidVerticalLine(x + limPos, y + Y_OUTBAR, h, MAINVIEW_GRAPHICS_COLOR);
if (chanVal > 0) if (chanVal > 0)
lcdDrawNumber(x - 10 + w / 2, y + h, chanVal, SMLSIZE | TEXT_COLOR | RIGHT, 0, NULL, "%"); lcdDrawNumber(x - 10 + w / 2, y + h, chanVal, SMLSIZE | TEXT_COLOR | RIGHT, 0, NULL, "%");
else else
lcdDrawNumber(x + 10 + w / 2, y + h, chanVal, SMLSIZE | TEXT_COLOR, 0, NULL, "%"); lcdDrawNumber(x + 10 + w / 2, y + h, chanVal, SMLSIZE | TEXT_COLOR, 0, NULL, "%");
chanVal = limit<int16_t>(-limits / 2, chanVal, limits / 2); chanVal = limit<int16_t>(-VIEW_CHANNELS_LIMIT_PCT, chanVal, VIEW_CHANNELS_LIMIT_PCT);
if (posOnBar(chanVal) > posOnBar(calcRESXto100(ld->offset))) { valPos = posOnBar(chanVal);
lcdDrawSolidFilledRect(x + posOnBar(calcRESXto100(ld->offset)), y + Y_OUTBAR, posOnBar(chanVal) - posOnBar(calcRESXto100(ld->offset)), h, BARGRAPH1_COLOR);
if (valPos > limPos) {
lcdDrawSolidFilledRect(x + limPos, y + Y_OUTBAR, valPos - limPos, h, BARGRAPH1_COLOR);
} }
else if (posOnBar(chanVal) < posOnBar(calcRESXto100(ld->offset))) { else if (valPos < limPos) {
uint16_t endpoint = x + posOnBar(calcRESXto100(ld->offset)); uint16_t endpoint = x + limPos;
uint16_t size = posOnBar(calcRESXto100(ld->offset)) - posOnBar(chanVal); uint16_t size = limPos - valPos;
lcdDrawSolidFilledRect(endpoint - size, y + Y_OUTBAR, size, h, BARGRAPH1_COLOR); lcdDrawSolidFilledRect(endpoint - size, y + Y_OUTBAR, size, h, BARGRAPH1_COLOR);
} }
drawOutputBarLimits(x + posOnBar(-100 + ld->min / 10), x + posOnBar(100 + ld->max / 10), y + Y_OUTBAR); if (ld)
drawOutputBarLimits(x + posOnBar(-100 + ld->min / 10), x + posOnBar(100 + ld->max / 10), y + Y_OUTBAR);
#if defined(OVERRIDE_CHANNEL_FUNCTION) #if defined(OVERRIDE_CHANNEL_FUNCTION)
if (safetyCh[channel] != OVERRIDE_CHANNEL_UNDEFINED) lcd->drawBitmap(x - X_OFFSET + 7, y + 7, chanMonLockedBitmap); if (safetyCh[channel] != OVERRIDE_CHANNEL_UNDEFINED)
lcd->drawBitmap(x - X_OFFSET + 7, y + 7, chanMonLockedBitmap);
#endif #endif
if (ld->revert) lcd->drawBitmap(x - X_OFFSET + 7, y + 25, chanMonInvertedBitmap); if (ld && ld->revert)
lcd->drawBitmap(x - X_OFFSET + 7, y + 25, chanMonInvertedBitmap);
lcd->drawSolidVerticalLine(x + w / 2, y + Y_OUTBAR, h, TEXT_COLOR); lcd->drawSolidVerticalLine(x + w / 2, y + Y_OUTBAR, h, TEXT_COLOR);
} }
@ -167,13 +177,11 @@ bool menuChannelsMonitor(event_t event, uint8_t page)
drawChannelsMonitorLegend(x, STR_MONITOR_MIXER_DESC, BARGRAPH2_COLOR); drawChannelsMonitorLegend(x, STR_MONITOR_MIXER_DESC, BARGRAPH2_COLOR);
x = X_OFFSET; x = X_OFFSET;
for (uint8_t i = 0; i < 4; i++, channel++, y += ROW_HEIGHT) { for (uint8_t i = 0; i < 8; i++, channel++, y += ROW_HEIGHT) {
drawComboOutputBar(x, y, COLUMN_SIZE, BAR_HEIGHT, channel); if (i == 4) {
drawSingleMixerBar(x, y + Y_MIXBAR + 1, COLUMN_SIZE, BAR_HEIGHT, channel); x = 1 + LCD_W / 2 + X_OFFSET;
} y = Y_OFFSET;
x = 1 + LCD_W / 2 + X_OFFSET; }
y = Y_OFFSET;
for (uint8_t i = 0; i < 4; i++, channel++, y += ROW_HEIGHT) {
drawComboOutputBar(x, y, COLUMN_SIZE, BAR_HEIGHT, channel); drawComboOutputBar(x, y, COLUMN_SIZE, BAR_HEIGHT, channel);
drawSingleMixerBar(x, y + Y_MIXBAR + 1, COLUMN_SIZE, BAR_HEIGHT, channel); drawSingleMixerBar(x, y + Y_MIXBAR + 1, COLUMN_SIZE, BAR_HEIGHT, channel);
} }

View file

@ -161,12 +161,12 @@ void onMixesMenu(const char * result)
#define MIX_LINE_FM_POS 13*FW+3 #define MIX_LINE_FM_POS 13*FW+3
#define MIX_LINE_DELAY_POS 24*FW+3 #define MIX_LINE_DELAY_POS 24*FW+3
#define MIX_LINE_NAME_POS LCD_W-LEN_EXPOMIX_NAME*FW-MENUS_SCROLLBAR_WIDTH #define MIX_LINE_NAME_POS LCD_W-LEN_EXPOMIX_NAME*FW-MENUS_SCROLLBAR_WIDTH
#define MIX_HDR_GAUGE_POS_X 127
void displayHeaderChannelName(uint8_t ch) void displayHeaderChannelName(uint8_t ch)
{ {
uint8_t len = zlen(g_model.limitData[ch].name, sizeof(g_model.limitData[ch].name)); if (g_model.limitData[ch].name[0] != '\0') {
if (len) { lcdDrawSizedText(MIX_HDR_GAUGE_POS_X - FWNUM * 5 - 1, 1, g_model.limitData[ch].name, ZLEN(g_model.limitData[ch].name), ZCHAR|SMLSIZE|RIGHT);
lcdDrawSizedText(80, 1, g_model.limitData[ch].name, len, ZCHAR|SMLSIZE);
} }
} }
@ -393,7 +393,7 @@ void menuModelMixAll(event_t event)
if (!s_currCh) { if (!s_currCh) {
displayHeaderChannelName(index); displayHeaderChannelName(index);
#if LCD_W >= 212 #if LCD_W >= 212
lcdDrawNumber(127, 2, calcRESXto1000(ex_chans[index]), PREC1|TINSIZE|RIGHT); lcdDrawNumber(MIX_HDR_GAUGE_POS_X, 2, calcRESXto1000(ex_chans[index]), PREC1|TINSIZE|RIGHT);
#endif #endif
} }
@ -402,7 +402,7 @@ void menuModelMixAll(event_t event)
#if LCD_W >= 212 #if LCD_W >= 212
// Gauge // Gauge
if (!s_currCh) { if (!s_currCh) {
drawGauge(127, 1, 58, 6, ex_chans[index], 1024); drawGauge(MIX_HDR_GAUGE_POS_X, 1, 58, 6, ex_chans[index], 2048);
} }
#endif #endif