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

When sorting the issues I found a graphic from Martin in #1945 which was

not implemented. What do you think of it?
This commit is contained in:
bsongis 2015-07-17 11:14:31 +02:00
parent a480c6ce87
commit 4ad6ea8190
4 changed files with 41 additions and 21 deletions

View file

@ -53,6 +53,7 @@ void displayScrollbar(coord_t x, coord_t y, coord_t h, uint16_t offset, uint16_t
void displayMenuBar(const MenuItem *menu, int index);
void displayProgressBar(const char *label);
void updateProgressBar(int num, int den);
void drawGauge(coord_t x, coord_t y, coord_t w, coord_t h, int32_t val, int32_t max);
extern coord_t scrollbar_X;
#define SET_SCROLLBAR_X(x) scrollbar_X = (x);

View file

@ -650,11 +650,9 @@ void onExpoMixMenu(const char *result)
void displayHeaderChannelName(uint8_t ch)
{
uint8_t len = zlen(g_model.limitData[ch-1].name, sizeof(g_model.limitData[ch-1].name));
uint8_t len = zlen(g_model.limitData[ch].name, sizeof(g_model.limitData[ch].name));
if (len) {
lcd_putc(17*FW, 0, ' ');
lcd_putsnAtt(lcdNextPos, 0, g_model.limitData[ch-1].name, len, ZCHAR);
lcd_putc(lcdNextPos, 0, ' ');
lcd_putsnAtt(70, 1, g_model.limitData[ch].name, len, ZCHAR|SMLSIZE);
}
}
@ -833,10 +831,33 @@ void menuModelExpoMix(uint8_t expo, uint8_t event)
break;
}
lcd_outdezAtt(FW*max(sizeof(TR_MENUINPUTS), sizeof(TR_MIXER))+FW+FW/2, 0, getExpoMixCount(expo));
lcd_puts(FW*max(sizeof(TR_MENUINPUTS), sizeof(TR_MIXER))+FW+FW/2, 0, expo ? STR_MAX(MAX_EXPOS) : STR_MAX(MAX_MIXERS));
if (expo) {
lcd_outdezAtt(FW*sizeof(TR_MENUINPUTS)+FW+FW/2, 0, getExpoMixCount(true));
lcd_puts(FW*sizeof(TR_MENUINPUTS)+FW+FW/2, 0, STR_MAX(MAX_EXPOS));
SIMPLE_MENU(expo ? STR_MENUINPUTS : STR_MIXER, menuTabModel, expo ? e_InputsAll : e_MixAll, s_maxLines);
// Value
uint8_t index = expoAddress(s_currIdx)->chn;
lcd_outdezAtt(120, 2, calcRESXto1000(anas[index]), PREC1|TINSIZE);
SIMPLE_MENU(STR_MENUINPUTS, menuTabModel, e_InputsAll, s_maxLines);
// Gauge
drawGauge(120, 1, 58, 6, anas[index], 1024);
}
else {
lcd_outdezAtt(FW*sizeof(TR_MIXER)+FW+FW/2, 0, getExpoMixCount(false));
lcd_puts(FW*sizeof(TR_MIXER)+FW+FW/2, 0, STR_MAX(MAX_MIXERS));
// Value
uint8_t index = mixAddress(s_currIdx)->destCh;
displayHeaderChannelName(index);
lcd_outdezAtt(120, 2, calcRESXto1000(ex_chans[index]), PREC1|TINSIZE);
SIMPLE_MENU(STR_MIXER, menuTabModel, e_MixAll, s_maxLines);
// Gauge
drawGauge(120, 1, 58, 6, ex_chans[index], 1024);
}
sub = m_posVert;
s_currCh = 0;
@ -880,10 +901,6 @@ void menuModelExpoMix(uint8_t expo, uint8_t event)
}
}
else {
if (attr) {
displayHeaderChannelName(ch);
}
if (mixCnt > 0) lcd_putsiAtt(FW, y, STR_VMLTPX2, md->mltpx, 0);
putsMixerSource(MIX_LINE_SRC_POS, y, md->srcRaw, 0);
@ -932,9 +949,6 @@ void menuModelExpoMix(uint8_t expo, uint8_t event)
}
else {
putsChn(0, y, ch, attr); // show CHx
if (attr) {
displayHeaderChannelName(ch);
}
}
if (s_copyMode == MOVE_MODE && s_copySrcCh == ch) {
lcd_rect(expo ? EXPO_LINE_SELECT_POS : 22, y-1, expo ? (LCD_W-EXPO_LINE_SELECT_POS) : (LCD_W-22), 9, DOTTED);

View file

@ -117,18 +117,12 @@ void menuChannelsView(uint8_t event)
#endif
// Gauge
lcd_rect(x+LCD_W/2-3-wbar-ofs, y, wbar+1, 6);
#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
uint8_t len = limit((uint8_t)1, uint8_t((abs(val) * wbar/2 + lim/2) / lim), uint8_t(wbar/2));
uint8_t x0 = (val>0) ? x+LCD_W/2-ofs-3-wbar/2 : x+LCD_W/2-ofs-2-wbar/2-len;
lcd_hline(x0, y+1, len);
lcd_hline(x0, y+2, len);
lcd_hline(x0, y+3, len);
lcd_hline(x0, y+4, len);
drawGauge(x+LCD_W/2-3-wbar-ofs, y, wbar, 6, val, lim);
ch++;
}

View file

@ -124,6 +124,17 @@ void updateProgressBar(int num, int den)
}
}
void drawGauge(coord_t x, coord_t y, coord_t w, coord_t h, int32_t val, int32_t max)
{
lcd_rect(x, y, w+1, h);
drawFilledRect(x+1, y+1, w-1, 4, SOLID, ERASE);
coord_t len = limit((uint8_t)1, uint8_t((abs(val) * w/2 + max/2) / max), uint8_t(w/2));
coord_t x0 = (val>0) ? x+w/2 : x+1+w/2-len;
for (coord_t i=h-2; i>0; i--) {
lcd_hline(x0, y+i, len);
}
}
void title(const pm_char * s)
{
lcd_putsAtt(0, 0, s, INVERS);