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

128 chan monitor (#7418)

Introduce 128x64 channels monitor
This commit is contained in:
3djc 2020-03-10 17:17:59 +01:00 committed by GitHub
parent ad188aa916
commit cf5e2b3fd5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 344 additions and 282 deletions

View file

@ -168,6 +168,7 @@ enum MainViews {
VIEW_OUTPUTS_BARS, VIEW_OUTPUTS_BARS,
VIEW_INPUTS, VIEW_INPUTS,
VIEW_TIMER2, VIEW_TIMER2,
VIEW_CHAN_MONITOR,
VIEW_COUNT VIEW_COUNT
}; };
#endif #endif

View file

@ -235,6 +235,9 @@ void pushMenuTextView(const char *filename);
void pushModelNotes(); void pushModelNotes();
void readModelNotes(); void readModelNotes();
void menuChannelsView(event_t event);
void menuChannelsViewCommon(event_t event);
#define CURSOR_MOVED_LEFT(event) (IS_ROTARY_LEFT(event) || EVT_KEY_MASK(event) == KEY_LEFT) #define CURSOR_MOVED_LEFT(event) (IS_ROTARY_LEFT(event) || EVT_KEY_MASK(event) == KEY_LEFT)
#define CURSOR_MOVED_RIGHT(event) (IS_ROTARY_RIGHT(event) || EVT_KEY_MASK(event) == KEY_RIGHT) #define CURSOR_MOVED_RIGHT(event) (IS_ROTARY_RIGHT(event) || EVT_KEY_MASK(event) == KEY_RIGHT)
@ -294,6 +297,7 @@ void drawProgressScreen(const char * title, const char * message, int num, int d
void drawSleepBitmap(); void drawSleepBitmap();
void drawVerticalScrollbar(coord_t x, coord_t y, coord_t h, uint16_t offset, uint16_t count, uint8_t visible); void drawVerticalScrollbar(coord_t x, coord_t y, coord_t h, uint16_t offset, uint16_t count, uint8_t visible);
void drawGauge(coord_t x, coord_t y, coord_t w, coord_t h, int32_t val, int32_t max);
void drawAlertBox(const char * title, const char * text, const char * action); void drawAlertBox(const char * title, const char * text, const char * action);
void showAlertBox(const char * title, const char * text, const char * action , uint8_t sound); void showAlertBox(const char * title, const char * text, const char * action , uint8_t sound);
@ -303,7 +307,7 @@ void showAlertBox(const char * title, const char * text, const char * action , u
#define IS_MAIN_VIEW_DISPLAYED() menuHandlers[0] == menuMainView #define IS_MAIN_VIEW_DISPLAYED() menuHandlers[0] == menuMainView
#define IS_TELEMETRY_VIEW_DISPLAYED() menuHandlers[0] == menuViewTelemetry #define IS_TELEMETRY_VIEW_DISPLAYED() menuHandlers[0] == menuViewTelemetry
#define IS_OTHER_VIEW_DISPLAYED() false #define IS_OTHER_VIEW_DISPLAYED() menuHandlers[0] == menuChannelsView
void editCurveRef(coord_t x, coord_t y, CurveRef & curve, event_t event, LcdFlags flags); void editCurveRef(coord_t x, coord_t y, CurveRef & curve, event_t event, LcdFlags flags);

View file

@ -114,8 +114,6 @@ void lcdDrawSizedText(coord_t x, coord_t y, const char * s, unsigned char len);
void lcdDrawTextAlignedLeft(coord_t y, const char * s); void lcdDrawTextAlignedLeft(coord_t y, const char * s);
void drawTimerWithMode(coord_t x, coord_t y, uint8_t index, LcdFlags att); void drawTimerWithMode(coord_t x, coord_t y, uint8_t index, LcdFlags att);
#define lcdDrawTextAlignedCenter(y, s) lcdDrawText((LCD_W-sizeof(s)*FW+FW+1)/2, y, s)
void lcdDrawHexNumber(coord_t x, coord_t y, uint32_t val, LcdFlags mode=0); void lcdDrawHexNumber(coord_t x, coord_t y, uint32_t val, LcdFlags mode=0);
void lcdDrawHexChar(coord_t x, coord_t y, uint8_t val, LcdFlags flags=0); void lcdDrawHexChar(coord_t x, coord_t y, uint8_t val, LcdFlags flags=0);

View file

@ -161,6 +161,18 @@ void menuModelCurveOne(event_t event)
POPUP_MENU_START(onCurveOneMenu); POPUP_MENU_START(onCurveOneMenu);
} }
break; break;
#if defined(NAVIGATION_X7)
case EVT_KEY_LONG(KEY_MENU):
pushMenu(menuChannelsView);
killEvents(event);
break;
#elif defined(NAVIGATION_XLITE)
case EVT_KEY_LONG(KEY_SHIFT):
pushMenu(menuChannelsView);
killEvents(event);
break;
#endif
} }
drawCurve(0); drawCurve(0);

View file

@ -51,7 +51,7 @@ void menuModelFailsafe(event_t event)
SIMPLE_SUBMENU_NOTITLE(sentModuleChannels(g_moduleIdx)); SIMPLE_SUBMENU_NOTITLE(sentModuleChannels(g_moduleIdx));
lcdDrawTextAlignedCenter(0, TR_FAILSAFESET); lcdDrawText(LCD_W / 2, 0, STR_FAILSAFESET, CENTERED);
lcdInvertLine(0); lcdInvertLine(0);
for (uint8_t i=0; i<NUM_BODY_LINES; i++) { for (uint8_t i=0; i<NUM_BODY_LINES; i++) {

View file

@ -72,6 +72,17 @@ enum ExposFields {
void menuModelExpoOne(event_t event) void menuModelExpoOne(event_t event)
{ {
#if defined(NAVIGATION_X7)
if (event == EVT_KEY_LONG(KEY_MENU)) {
pushMenu(menuChannelsView);
killEvents(event);
}
#elif defined(NAVIGATION_XLITE)
if (event == EVT_KEY_LONG(KEY_SHIFT)) {
pushMenu(menuChannelsView);
killEvents(event);
}
#endif
ExpoData * ed = expoAddress(s_currIdx); ExpoData * ed = expoAddress(s_currIdx);
drawSource(PSIZE(TR_MENUINPUTS)*FW+FW, 0, MIXSRC_FIRST_INPUT+ed->chn, 0); drawSource(PSIZE(TR_MENUINPUTS)*FW+FW, 0, MIXSRC_FIRST_INPUT+ed->chn, 0);

View file

@ -85,6 +85,17 @@ void drawOffsetBar(uint8_t x, uint8_t y, MixData * md)
void menuModelMixOne(event_t event) void menuModelMixOne(event_t event)
{ {
#if defined(NAVIGATION_X7)
if (event == EVT_KEY_LONG(KEY_MENU)) {
pushMenu(menuChannelsView);
killEvents(event);
}
#elif defined(NAVIGATION_XLITE)
if (event == EVT_KEY_LONG(KEY_SHIFT)) {
pushMenu(menuChannelsView);
killEvents(event);
}
#endif
MixData * md2 = mixAddress(s_currIdx) ; MixData * md2 = mixAddress(s_currIdx) ;
putsChn(PSIZE(TR_MIXES)*FW+FW, 0, md2->destCh+1,0); putsChn(PSIZE(TR_MIXES)*FW+FW, 0, md2->destCh+1,0);

View file

@ -179,7 +179,7 @@ void menuFirstCalib(event_t event)
chainMenu(menuMainView); chainMenu(menuMainView);
} }
else { else {
lcdDrawTextAlignedCenter(0*FH, TR_MENUCALIBRATION); lcdDrawText(LCD_W / 2, 0, STR_MENUCALIBRATION, CENTERED);
lcdInvertLine(0); lcdInvertLine(0);
menuCommonCalib(event); menuCommonCalib(event);
} }

View file

@ -20,7 +20,30 @@
#include "opentx.h" #include "opentx.h"
void menuChannelsView(event_t event) constexpr coord_t CHANNEL_NAME_OFFSET = 1;
constexpr coord_t CHANNEL_VALUE_OFFSET = CHANNEL_NAME_OFFSET + 42;
constexpr coord_t CHANNEL_GAUGE_OFFSET = CHANNEL_VALUE_OFFSET;
constexpr coord_t CHANNEL_BAR_WIDTH = 70;
constexpr coord_t CHANNEL_PROPERTIES_OFFSET = CHANNEL_GAUGE_OFFSET + CHANNEL_BAR_WIDTH + 2;
#if defined(NAVIGATION_X7)
#define EVT_KEY_PREVIOUS_VIEW EVT_KEY_LONG(KEY_PAGE)
#define EVT_KEY_NEXT_VIEW EVT_KEY_BREAK(KEY_PAGE)
#define EVT_KEY_NEXT_PAGE EVT_ROTARY_RIGHT
#define EVT_KEY_PREVIOUS_PAGE EVT_ROTARY_LEFT
#elif defined(NAVIGATION_XLITE)
#define EVT_KEY_PREVIOUS_VIEW EVT_KEY_BREAK(KEY_UP)
#define EVT_KEY_NEXT_VIEW EVT_KEY_BREAK(KEY_DOWN)
#define EVT_KEY_NEXT_PAGE EVT_KEY_BREAK(KEY_RIGHT)
#define EVT_KEY_PREVIOUS_PAGE EVT_KEY_BREAK(KEY_LEFT)
#else
#define EVT_KEY_PREVIOUS_VIEW EVT_KEY_BREAK(KEY_UP)
#define EVT_KEY_NEXT_VIEW EVT_KEY_BREAK(KEY_DOWN)
#define EVT_KEY_NEXT_PAGE EVT_KEY_BREAK(KEY_RIGHT)
#define EVT_KEY_PREVIOUS_PAGE EVT_KEY_BREAK(KEY_LEFT)
#endif
void menuChannelsViewCommon(event_t event)
{ {
bool newLongNames = false; bool newLongNames = false;
@ -31,13 +54,79 @@ void menuChannelsView(event_t event)
memclear(&reusableBuffer.viewChannels, sizeof(reusableBuffer.viewChannels)); memclear(&reusableBuffer.viewChannels, sizeof(reusableBuffer.viewChannels));
break; break;
case EVT_KEY_FIRST(KEY_ENTER):
reusableBuffer.viewChannels.mixersView = !reusableBuffer.viewChannels.mixersView;
break;
}
ch = 8 * (g_eeGeneral.view / ALTERNATE_VIEW);
// Screen title
lcdDrawText(LCD_W / 2, 0, reusableBuffer.viewChannels.mixersView ? STR_MIXERS_MONITOR : STR_CHANNELS_MONITOR, CENTERED);
lcdInvertLine(0);
int16_t limits = 512 * 2;
// Channels
for (uint8_t line = 0; line < 8; line++) {
LimitData * ld = limitAddress(ch);
const uint8_t y = 9 + line * 7;
const int32_t val = reusableBuffer.viewChannels.mixersView ? ex_chans[ch] : channelOutputs[ch];
const uint8_t lenLabel = ZLEN(g_model.limitData[ch].name);
// Channel name if present, number if not
if (lenLabel > 0) {
if (lenLabel > 4)
reusableBuffer.viewChannels.longNames = true;
lcdDrawSizedText(CHANNEL_NAME_OFFSET, y, g_model.limitData[ch].name, sizeof(g_model.limitData[ch].name), ZCHAR | SMLSIZE);
}
else {
putsChn(CHANNEL_NAME_OFFSET, y, ch + 1, SMLSIZE);
}
// Value
#if defined(PPM_UNIT_US)
lcdDrawNumber(CHANNEL_VALUE_OFFSET, y + 1, PPM_CH_CENTER(ch) + val / 2, TINSIZE | RIGHT);
#elif defined(PPM_UNIT_PERCENT_PREC1)
lcdDrawNumber(CHANNEL_VALUE_OFFSET, y + 1, calcRESXto1000(val), PREC1 | TINSIZE | RIGHT);
#else
lcdDrawNumber(CHANNEL_VALUE_OFFSET, y + 1, calcRESXto1000(val) / 10, TINSIZE | RIGHT);
#endif
// Gauge
drawGauge(CHANNEL_GAUGE_OFFSET, y, CHANNEL_BAR_WIDTH, 6, val, limits);
if (!reusableBuffer.viewChannels.mixersView) {
// Properties
#if defined(OVERRIDE_CHANNEL_FUNCTION)
if (safetyCh[ch] != OVERRIDE_CHANNEL_UNDEFINED)
lcdDrawText(CHANNEL_PROPERTIES_OFFSET, y, "OVR", TINSIZE);
else
#endif
if (ld && ld->revert) {
lcdDrawText(CHANNEL_PROPERTIES_OFFSET, y, "INV", TINSIZE);
}
}
++ch;
}
reusableBuffer.viewChannels.longNames = newLongNames;
}
void menuChannelsView(event_t event)
{
switch (event) {
case EVT_KEY_BREAK(KEY_EXIT): case EVT_KEY_BREAK(KEY_EXIT):
popMenu(); popMenu();
break; break;
case EVT_KEY_FIRST(KEY_RIGHT): case EVT_KEY_NEXT_PAGE:
case EVT_KEY_FIRST(KEY_LEFT): g_eeGeneral.view = (g_eeGeneral.view + (4 * ALTERNATE_VIEW) + ALTERNATE_VIEW) % (4 * ALTERNATE_VIEW);
reusableBuffer.viewChannels.secondPage = !reusableBuffer.viewChannels.secondPage; break;
case EVT_KEY_PREVIOUS_PAGE:
g_eeGeneral.view = (g_eeGeneral.view + (4 * ALTERNATE_VIEW) - ALTERNATE_VIEW) % (4 * ALTERNATE_VIEW);
break; break;
case EVT_KEY_FIRST(KEY_ENTER): case EVT_KEY_FIRST(KEY_ENTER):
@ -45,67 +134,5 @@ void menuChannelsView(event_t event)
break; break;
} }
if (reusableBuffer.viewChannels.secondPage) menuChannelsViewCommon(event);
ch = 16;
else
ch = 0;
if (reusableBuffer.viewChannels.mixersView) {
lcdDrawTextAlignedCenter(0, TR_MIXERS_MONITOR);
}
else {
lcdDrawTextAlignedCenter(0, TR_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;
// Channels
for (uint8_t line=0; line<8; line++) {
uint8_t y = 9+line*7;
int32_t val = (reusableBuffer.viewChannels.mixersView) ? ex_chans[ch] : channelOutputs[ch];
uint8_t ofs = (col ? 0 : 1);
// Channel name if present, number if not
uint8_t lenLabel = ZLEN(g_model.limitData[ch].name);
if (lenLabel > 4) {
newLongNames = reusableBuffer.viewChannels.longNames = true;
}
if (lenLabel > 0)
lcdDrawSizedText(x+1-ofs, y, g_model.limitData[ch].name, sizeof(g_model.limitData[ch].name), ZCHAR | SMLSIZE);
else
putsChn(x+1-ofs, y, ch+1, SMLSIZE);
// Value
#if defined(PPM_UNIT_US)
uint8_t wbar = (reusableBuffer.viewChannels.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 = (reusableBuffer.viewChannels.longNames ? 48 : 58);
lcdDrawNumber(x+LCD_W/2-3-wbar-ofs, y+1, calcRESXto1000(val), PREC1|TINSIZE|RIGHT);
#else
uint8_t wbar = (reusableBuffer.viewChannels.longNames ? 54 : 64);
lcdDrawNumber(x+LCD_W/2-3-wbar-ofs, y+1, calcRESXto1000(val)/10, TINSIZE|RIGHT);
#endif
// Gauge
// uint16_t lim = (g_model.extendedLimits ? (512 * (long)LIMIT_EXT_PERCENT / 100) : 512) * 2;
//#ifdef MIXERS_MONITOR
// if (mixersView)
// lim = 512 * 2 * 2;
//#endif
// TODO ? drawGauge(x+LCD_W/2-3-wbar-ofs, y, wbar, 6, val, lim);
ch++;
}
}
reusableBuffer.viewChannels.longNames = newLongNames;
} }

View file

@ -56,7 +56,7 @@ void drawExternalAntennaAndRSSI()
{ {
#if defined(INTERNAL_MODULE_PXX1) && defined(EXTERNAL_ANTENNA) #if defined(INTERNAL_MODULE_PXX1) && defined(EXTERNAL_ANTENNA)
if (isModuleXJT(INTERNAL_MODULE) && isExternalAntennaEnabled()) { if (isModuleXJT(INTERNAL_MODULE) && isExternalAntennaEnabled()) {
lcdDrawText(VBATT_X-1, VBATT_Y+8, "E", TINSIZE); lcdDrawText(VBATT_X - 1, VBATT_Y + 8, "E", TINSIZE);
} }
#endif #endif
@ -75,10 +75,10 @@ void drawExternalAntennaAndRSSI()
void drawPotsBars() void drawPotsBars()
{ {
// Optimization by Mike Blandford // Optimization by Mike Blandford
for (uint8_t x=LCD_W/2 - (NUM_POTS+NUM_SLIDERS-1) * 5 / 2, i=NUM_STICKS; i<NUM_STICKS+NUM_POTS+NUM_SLIDERS; x+=5, i++) { for (uint8_t x = LCD_W / 2 - (NUM_POTS + NUM_SLIDERS - 1) * 5 / 2, i = NUM_STICKS; i < NUM_STICKS + NUM_POTS + NUM_SLIDERS; x += 5, i++) {
if (IS_POT_SLIDER_AVAILABLE(i)) { if (IS_POT_SLIDER_AVAILABLE(i)) {
uint8_t len = ((calibratedAnalogs[i]+RESX)*BAR_HEIGHT/(RESX*2))+1l; // calculate once per loop uint8_t len = ((calibratedAnalogs[i] + RESX) * BAR_HEIGHT / (RESX * 2)) + 1l; // calculate once per loop
V_BAR(x, LCD_H-8, len); V_BAR(x, LCD_H - 8, len);
} }
} }
} }
@ -100,16 +100,16 @@ void doMainScreenGraphics()
void displayTrims(uint8_t phase) void displayTrims(uint8_t phase)
{ {
for (uint8_t i=0; i<4; i++) { for (uint8_t i = 0; i < 4; i++) {
static coord_t x[4] = {TRIM_LH_X, TRIM_LV_X, TRIM_RV_X, TRIM_RH_X}; static coord_t x[4] = {TRIM_LH_X, TRIM_LV_X, TRIM_RV_X, TRIM_RH_X};
static uint8_t vert[4] = {0,1,1,0}; static uint8_t vert[4] = {0, 1, 1, 0};
coord_t xm, ym; coord_t xm, ym;
uint8_t stickIndex = CONVERT_MODE(i); uint8_t stickIndex = CONVERT_MODE(i);
xm = x[stickIndex]; xm = x[stickIndex];
uint8_t att = ROUND; uint8_t att = ROUND;
int16_t val = getTrimValue(phase, i); int16_t val = getTrimValue(phase, i);
if(getRawTrimValue(phase, i).mode == TRIM_MODE_NONE) if (getRawTrimValue(phase, i).mode == TRIM_MODE_NONE)
continue; continue;
int16_t dir = val; int16_t dir = val;
@ -117,11 +117,11 @@ void displayTrims(uint8_t phase)
if (val < TRIM_MIN || val > TRIM_MAX) { if (val < TRIM_MIN || val > TRIM_MAX) {
exttrim = true; exttrim = true;
} }
if (val < -(TRIM_LEN+1)*4) { if (val < -(TRIM_LEN + 1) * 4) {
val = -(TRIM_LEN+1); val = -(TRIM_LEN + 1);
} }
else if (val > (TRIM_LEN+1)*4) { else if (val > (TRIM_LEN + 1) * 4) {
val = TRIM_LEN+1; val = TRIM_LEN + 1;
} }
else { else {
val /= 4; val /= 4;
@ -129,65 +129,65 @@ void displayTrims(uint8_t phase)
if (vert[i]) { if (vert[i]) {
ym = 31; ym = 31;
lcdDrawSolidVerticalLine(xm, ym-TRIM_LEN, TRIM_LEN*2); lcdDrawSolidVerticalLine(xm, ym - TRIM_LEN, TRIM_LEN * 2);
if (i!=2 || !g_model.thrTrim) { if (i != 2 || !g_model.thrTrim) {
lcdDrawSolidVerticalLine(xm-1, ym-1, 3); lcdDrawSolidVerticalLine(xm - 1, ym - 1, 3);
lcdDrawSolidVerticalLine(xm+1, ym-1, 3); lcdDrawSolidVerticalLine(xm + 1, ym - 1, 3);
} }
ym -= val; ym -= val;
lcdDrawFilledRect(xm-3, ym-3, 7, 7, SOLID, att|ERASE); lcdDrawFilledRect(xm - 3, ym - 3, 7, 7, SOLID, att | ERASE);
if (dir >= 0) { if (dir >= 0) {
lcdDrawSolidHorizontalLine(xm-1, ym-1, 3); lcdDrawSolidHorizontalLine(xm - 1, ym - 1, 3);
} }
if (dir <= 0) { if (dir <= 0) {
lcdDrawSolidHorizontalLine(xm-1, ym+1, 3); lcdDrawSolidHorizontalLine(xm - 1, ym + 1, 3);
} }
if (exttrim) { if (exttrim) {
lcdDrawSolidHorizontalLine(xm-1, ym, 3); lcdDrawSolidHorizontalLine(xm - 1, ym, 3);
} }
if (g_model.displayTrims != DISPLAY_TRIMS_NEVER && dir != 0) { if (g_model.displayTrims != DISPLAY_TRIMS_NEVER && dir != 0) {
if (g_model.displayTrims == DISPLAY_TRIMS_ALWAYS || (trimsDisplayTimer > 0 && (trimsDisplayMask & (1<<i)))) { if (g_model.displayTrims == DISPLAY_TRIMS_ALWAYS || (trimsDisplayTimer > 0 && (trimsDisplayMask & (1 << i)))) {
lcdDrawNumber(dir>0 ? 12 : 40, xm-2, -abs(dir), TINSIZE|VERTICAL); lcdDrawNumber(dir > 0 ? 12 : 40, xm - 2, -abs(dir), TINSIZE | VERTICAL);
} }
} }
} }
else { else {
ym = 60; ym = 60;
lcdDrawSolidHorizontalLine(xm-TRIM_LEN, ym, TRIM_LEN*2); lcdDrawSolidHorizontalLine(xm - TRIM_LEN, ym, TRIM_LEN * 2);
lcdDrawSolidHorizontalLine(xm-1, ym-1, 3); lcdDrawSolidHorizontalLine(xm - 1, ym - 1, 3);
lcdDrawSolidHorizontalLine(xm-1, ym+1, 3); lcdDrawSolidHorizontalLine(xm - 1, ym + 1, 3);
xm += val; xm += val;
lcdDrawFilledRect(xm-3, ym-3, 7, 7, SOLID, att|ERASE); lcdDrawFilledRect(xm - 3, ym - 3, 7, 7, SOLID, att | ERASE);
if (dir >= 0) { if (dir >= 0) {
lcdDrawSolidVerticalLine(xm+1, ym-1, 3); lcdDrawSolidVerticalLine(xm + 1, ym - 1, 3);
} }
if (dir <= 0) { if (dir <= 0) {
lcdDrawSolidVerticalLine(xm-1, ym-1, 3); lcdDrawSolidVerticalLine(xm - 1, ym - 1, 3);
} }
if (exttrim) { if (exttrim) {
lcdDrawSolidVerticalLine(xm, ym-1, 3); lcdDrawSolidVerticalLine(xm, ym - 1, 3);
} }
if (g_model.displayTrims != DISPLAY_TRIMS_NEVER && dir != 0) { if (g_model.displayTrims != DISPLAY_TRIMS_NEVER && dir != 0) {
if (g_model.displayTrims == DISPLAY_TRIMS_ALWAYS || (trimsDisplayTimer > 0 && (trimsDisplayMask & (1<<i)))) { if (g_model.displayTrims == DISPLAY_TRIMS_ALWAYS || (trimsDisplayTimer > 0 && (trimsDisplayMask & (1 << i)))) {
lcdDrawNumber((stickIndex==0 ? (dir>0 ? TRIM_LH_POS : TRIM_LH_NEG) : (dir>0 ? TRIM_RH_POS : TRIM_RH_NEG)), ym-2, -abs(dir), TINSIZE); lcdDrawNumber((stickIndex == 0 ? (dir > 0 ? TRIM_LH_POS : TRIM_LH_NEG) : (dir > 0 ? TRIM_RH_POS : TRIM_RH_NEG)), ym - 2, -abs(dir), TINSIZE);
} }
} }
} }
lcdDrawSquare(xm-3, ym-3, 7, att); lcdDrawSquare(xm - 3, ym - 3, 7, att);
} }
} }
void displayBattVoltage() void displayBattVoltage()
{ {
#if defined(BATTGRAPH) #if defined(BATTGRAPH)
putsVBat(VBATT_X-8, VBATT_Y+1, RIGHT); putsVBat(VBATT_X - 8, VBATT_Y + 1, RIGHT);
lcdDrawSolidFilledRect(VBATT_X-25, VBATT_Y+9, 21, 5); lcdDrawSolidFilledRect(VBATT_X - 25, VBATT_Y + 9, 21, 5);
lcdDrawSolidVerticalLine(VBATT_X-4, VBATT_Y+10, 3); lcdDrawSolidVerticalLine(VBATT_X - 4, VBATT_Y + 10, 3);
uint8_t count = GET_TXBATT_BARS(20); uint8_t count = GET_TXBATT_BARS(20);
for (uint8_t i=0; i<count; i+=2) for (uint8_t i = 0; i < count; i += 2)
lcdDrawSolidVerticalLine(VBATT_X-24+i, VBATT_Y+10, 3); lcdDrawSolidVerticalLine(VBATT_X - 24 + i, VBATT_Y + 10, 3);
if (!IS_TXBATT_WARNING() || BLINK_ON_PHASE) if (!IS_TXBATT_WARNING() || BLINK_ON_PHASE)
lcdDrawSolidFilledRect(VBATT_X-26, VBATT_Y, 24, 15); lcdDrawSolidFilledRect(VBATT_X - 26, VBATT_Y, 24, 15);
#else #else
LcdFlags att = (IS_TXBATT_WARNING() ? BLINK|INVERS : 0) | BIGSIZE; LcdFlags att = (IS_TXBATT_WARNING() ? BLINK|INVERS : 0) | BIGSIZE;
putsVBat(VBATT_X-1, VBATT_Y, att|NO_UNIT); putsVBat(VBATT_X-1, VBATT_Y, att|NO_UNIT);
@ -206,7 +206,7 @@ void displayVoltageOrAlarm()
} }
} }
#else #else
#define displayVoltageOrAlarm() displayBattVoltage() #define displayVoltageOrAlarm() displayBattVoltage()
#endif #endif
#if defined(NAVIGATION_X7) #if defined(NAVIGATION_X7)
@ -240,7 +240,7 @@ void displayVoltageOrAlarm()
#define EVT_KEY_STATISTICS EVT_KEY_LONG(KEY_UP) #define EVT_KEY_STATISTICS EVT_KEY_LONG(KEY_UP)
#endif #endif
void onMainViewMenu(const char *result) void onMainViewMenu(const char * result)
{ {
if (result == STR_RESET_TIMER1) { if (result == STR_RESET_TIMER1) {
timerReset(0); timerReset(0);
@ -281,28 +281,28 @@ void onMainViewMenu(const char *result)
void drawSmallSwitch(coord_t x, coord_t y, int width, unsigned int index) void drawSmallSwitch(coord_t x, coord_t y, int width, unsigned int index)
{ {
if (SWITCH_EXISTS(index)) { if (SWITCH_EXISTS(index)) {
int val = getValue(MIXSRC_FIRST_SWITCH+index); int val = getValue(MIXSRC_FIRST_SWITCH + index);
if (val >= 0) { if (val >= 0) {
lcdDrawSolidHorizontalLine(x, y, width); lcdDrawSolidHorizontalLine(x, y, width);
lcdDrawSolidHorizontalLine(x, y+2, width); lcdDrawSolidHorizontalLine(x, y + 2, width);
y += 4; y += 4;
if (val > 0) { if (val > 0) {
lcdDrawSolidHorizontalLine(x, y, width); lcdDrawSolidHorizontalLine(x, y, width);
lcdDrawSolidHorizontalLine(x, y+2, width); lcdDrawSolidHorizontalLine(x, y + 2, width);
y += 4; y += 4;
} }
} }
lcdDrawChar(width==5 ? x+1 : x, y, 'A'+index, SMLSIZE); lcdDrawChar(width == 5 ? x + 1 : x, y, 'A' + index, SMLSIZE);
y += 7; y += 7;
if (val <= 0) { if (val <= 0) {
lcdDrawSolidHorizontalLine(x, y, width); lcdDrawSolidHorizontalLine(x, y, width);
lcdDrawSolidHorizontalLine(x, y+2, width); lcdDrawSolidHorizontalLine(x, y + 2, width);
if (val < 0) { if (val < 0) {
lcdDrawSolidHorizontalLine(x, y+4, width); lcdDrawSolidHorizontalLine(x, y + 4, width);
lcdDrawSolidHorizontalLine(x, y+6, width); lcdDrawSolidHorizontalLine(x, y + 6, width);
} }
} }
} }
@ -320,25 +320,20 @@ void menuMainView(event_t event)
killEvents(KEY_DOWN); killEvents(KEY_DOWN);
break; break;
/* TODO if timer2 is OFF, it's possible to use this timer2 as in er9x... /* TODO if timer2 is OFF, it's possible to use this timer2 as in er9x...
case EVT_KEY_BREAK(KEY_MENU): case EVT_KEY_BREAK(KEY_MENU):
if (view_base == VIEW_TIMER2) { if (view_base == VIEW_TIMER2) {
Timer2_running = !Timer2_running; Timer2_running = !Timer2_running;
AUDIO_KEY_PRESS(); AUDIO_KEY_PRESS();
} }
break; break;
*/ */
case EVT_KEY_NEXT_PAGE: case EVT_KEY_NEXT_PAGE:
case EVT_KEY_PREVIOUS_PAGE: case EVT_KEY_PREVIOUS_PAGE:
if (view_base <= VIEW_INPUTS) { if (view_base == VIEW_INPUTS)
if (view_base == VIEW_INPUTS) g_eeGeneral.view ^= ALTERNATE_VIEW;
g_eeGeneral.view ^= ALTERNATE_VIEW; else
else g_eeGeneral.view = (g_eeGeneral.view + (4*ALTERNATE_VIEW) + ((event==EVT_KEY_PREVIOUS_PAGE) ? -ALTERNATE_VIEW : ALTERNATE_VIEW)) % (4*ALTERNATE_VIEW);
g_eeGeneral.view = (g_eeGeneral.view + (4*ALTERNATE_VIEW) + ((event==EVT_KEY_PREVIOUS_PAGE) ? -ALTERNATE_VIEW : ALTERNATE_VIEW)) % (4*ALTERNATE_VIEW);
storageDirty(EE_GENERAL);
AUDIO_KEY_PRESS();
}
break; break;
case EVT_KEY_CONTEXT_MENU: case EVT_KEY_CONTEXT_MENU:
@ -379,12 +374,13 @@ void menuMainView(event_t event)
case EVT_KEY_PREVIOUS_VIEW: case EVT_KEY_PREVIOUS_VIEW:
case EVT_KEY_NEXT_VIEW: case EVT_KEY_NEXT_VIEW:
// TODO try to split those 2 cases on 9X // TODO try to split those 2 cases on 9X
g_eeGeneral.view = (event == EVT_KEY_PREVIOUS_VIEW ? (view_base == VIEW_COUNT-1 ? 0 : view_base+1) : (view_base == 0 ? VIEW_COUNT-1 : view_base-1)); g_eeGeneral.view = (event == EVT_KEY_PREVIOUS_VIEW ? (view_base == VIEW_COUNT - 1 ? 0 : view_base + 1) : (view_base == 0 ? VIEW_COUNT - 1 : view_base -
1));
storageDirty(EE_GENERAL); storageDirty(EE_GENERAL);
break; break;
#else #else
case EVT_KEY_NEXT_VIEW: case EVT_KEY_NEXT_VIEW:
g_eeGeneral.view = (view_base == 0 ? VIEW_COUNT-1 : view_base-1); g_eeGeneral.view = (view_base == 0 ? VIEW_COUNT - 1 : view_base - 1);
storageDirty(EE_GENERAL); storageDirty(EE_GENERAL);
break; break;
#endif #endif
@ -410,53 +406,34 @@ void menuMainView(event_t event)
break; break;
} }
{ switch (view_base) {
// Flight Mode Name case VIEW_CHAN_MONITOR:
uint8_t mode = mixerCurrentFlightMode; menuChannelsViewCommon(event);
lcdDrawSizedText(PHASE_X, PHASE_Y, g_model.flightModeData[mode].name, sizeof(g_model.flightModeData[mode].name), ZCHAR|PHASE_FLAGS); break;
// Model Name case VIEW_OUTPUTS_VALUES:
putsModelName(MODELNAME_X, MODELNAME_Y, g_model.header.name, g_eeGeneral.currModel, BIGSIZE); case VIEW_OUTPUTS_BARS:
// scroll bar
lcdDrawHorizontalLine(38, 34, 54, DOTTED);
lcdDrawSolidHorizontalLine(38 + (g_eeGeneral.view / ALTERNATE_VIEW) * 13, 34, 13, SOLID);
for (uint8_t i=0; i<8; i++) {
uint8_t x0, y0;
uint8_t chan = 8 * (g_eeGeneral.view / ALTERNATE_VIEW) + i;
int16_t val = channelOutputs[chan];
// Main Voltage (or alarm if any) if (view_base == VIEW_OUTPUTS_VALUES) {
displayVoltageOrAlarm(); x0 = (i % 4 * 9 + 3) * FW / 2;
y0 = i / 4 * FH + 40;
// Timer 1
drawTimerWithMode(125, 2*FH, 0, RIGHT | DBLSIZE);
// Trims sliders
displayTrims(mode);
// RSSI gauge / external antenna
drawExternalAntennaAndRSSI();
}
if (view_base < VIEW_INPUTS) {
// scroll bar
lcdDrawHorizontalLine(38, 34, 54, DOTTED);
lcdDrawSolidHorizontalLine(38 + (g_eeGeneral.view / ALTERNATE_VIEW) * 13, 34, 13, SOLID);
for (uint8_t i=0; i<8; i++) {
uint8_t x0,y0;
uint8_t chan = 8*(g_eeGeneral.view / ALTERNATE_VIEW) + i;
int16_t val = channelOutputs[chan];
switch (view_base) {
case VIEW_OUTPUTS_VALUES:
x0 = (i%4*9+3)*FW/2;
y0 = i/4*FH+40;
#if defined(PPM_UNIT_US) #if defined(PPM_UNIT_US)
lcdDrawNumber(x0+4*FW , y0, PPM_CH_CENTER(chan)+val/2, RIGHT); lcdDrawNumber(x0 + 4 * FW, y0, PPM_CH_CENTER(chan) + val / 2, RIGHT);
#elif defined(PPM_UNIT_PERCENT_PREC1) #elif defined(PPM_UNIT_PERCENT_PREC1)
lcdDrawNumber(x0+4*FW , y0, calcRESXto1000(val), RIGHT|PREC1); lcdDrawNumber(x0 + 4 * FW, y0, calcRESXto1000(val), RIGHT | PREC1);
#else #else
lcdDrawNumber(x0+4*FW , y0, calcRESXto1000(val)/10, RIGHT); // G: Don't like the decimal part* lcdDrawNumber(x0+4*FW , y0, calcRESXto1000(val)/10, RIGHT); // G: Don't like the decimal part*
#endif #endif
break; }
else {
case VIEW_OUTPUTS_BARS: constexpr coord_t WBAR2 = (50/2);
#define WBAR2 (50/2)
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;
@ -473,99 +450,121 @@ void menuMainView(event_t event)
x0 -= len; x0 -= len;
lcdDrawSolidHorizontalLine(x0, y0+1, len); lcdDrawSolidHorizontalLine(x0, y0+1, len);
lcdDrawSolidHorizontalLine(x0, y0-1, len); lcdDrawSolidHorizontalLine(x0, y0-1, len);
break; }
} }
} break;
}
else if (view_base == VIEW_INPUTS) {
if (view == VIEW_INPUTS) {
// Sticks + Pots
doMainScreenGraphics();
// Switches case VIEW_TIMER2:
drawTimerWithMode(87, 5 * FH, 1, RIGHT | DBLSIZE);
break;
case VIEW_INPUTS:
if (view == VIEW_INPUTS) {
// Sticks + Pots
doMainScreenGraphics();
// Switches
#if defined(PCBX9LITES) #if defined(PCBX9LITES)
static const uint8_t x[NUM_SWITCHES-2] = {2*FW-2, 2*FW-2, 17*FW+1, 2*FW-2, 17*FW+1}; static const uint8_t x[NUM_SWITCHES-2] = {2*FW-2, 2*FW-2, 17*FW+1, 2*FW-2, 17*FW+1};
static const uint8_t y[NUM_SWITCHES-2] = {4*FH+1, 5*FH+1, 5*FH+1, 6*FH+1, 6*FH+1}; static const uint8_t y[NUM_SWITCHES-2] = {4*FH+1, 5*FH+1, 5*FH+1, 6*FH+1, 6*FH+1};
for (int i=0; i<NUM_SWITCHES - 2; ++i) { for (int i=0; i<NUM_SWITCHES - 2; ++i) {
if (SWITCH_EXISTS(i)) { if (SWITCH_EXISTS(i)) {
getvalue_t val = getValue(MIXSRC_FIRST_SWITCH + i); getvalue_t val = getValue(MIXSRC_FIRST_SWITCH + i);
getvalue_t sw = ((val < 0) ? 3 * i + 1 : ((val == 0) ? 3 * i + 2 : 3 * i + 3)); getvalue_t sw = ((val < 0) ? 3 * i + 1 : ((val == 0) ? 3 * i + 2 : 3 * i + 3));
drawSwitch(x[i], y[i], sw, 0, false); drawSwitch(x[i], y[i], sw, 0, false);
} }
} }
drawSmallSwitch(29, 5*FH+1, 4, SW_SF); drawSmallSwitch(29, 5*FH+1, 4, SW_SF);
drawSmallSwitch(16*FW+1, 5*FH+1, 4, SW_SG); drawSmallSwitch(16*FW+1, 5*FH+1, 4, SW_SG);
#elif defined(PCBX9LITE) #elif defined(PCBX9LITE)
static const uint8_t x[NUM_SWITCHES] = {2*FW-2, 2*FW-2, 16*FW+1, 2*FW-2, 16*FW+1}; static const uint8_t x[NUM_SWITCHES] = {2 * FW - 2, 2 * FW - 2, 16 * FW + 1, 2 * FW - 2, 16 * FW + 1};
static const uint8_t y[NUM_SWITCHES] = {4*FH+1, 5*FH+1, 5*FH+1, 6*FH+1, 6*FH+1}; static const uint8_t y[NUM_SWITCHES] = {4 * FH + 1, 5 * FH + 1, 5 * FH + 1, 6 * FH + 1, 6 * FH + 1};
for (int i=0; i<NUM_SWITCHES; ++i) { for (int i = 0; i < NUM_SWITCHES; ++i) {
if (SWITCH_EXISTS(i)) { if (SWITCH_EXISTS(i)) {
getvalue_t val = getValue(MIXSRC_FIRST_SWITCH + i); getvalue_t val = getValue(MIXSRC_FIRST_SWITCH + i);
getvalue_t sw = ((val < 0) ? 3 * i + 1 : ((val == 0) ? 3 * i + 2 : 3 * i + 3)); getvalue_t sw = ((val < 0) ? 3 * i + 1 : ((val == 0) ? 3 * i + 2 : 3 * i + 3));
drawSwitch(x[i], y[i], sw, 0, false); drawSwitch(x[i], y[i], sw, 0, false);
} }
} }
#elif defined(PCBXLITES) #elif defined(PCBXLITES)
static const uint8_t x[NUM_SWITCHES] = {2*FW-2, 16*FW+1, 2*FW-2, 16*FW+1, 2*FW-2, 16*FW+1}; static const uint8_t x[NUM_SWITCHES] = {2*FW-2, 16*FW+1, 2*FW-2, 16*FW+1, 2*FW-2, 16*FW+1};
static const uint8_t y[NUM_SWITCHES] = {4*FH+1, 4*FH+1, 6*FH+1, 6*FH+1, 5*FH+1, 5*FH+1}; static const uint8_t y[NUM_SWITCHES] = {4*FH+1, 4*FH+1, 6*FH+1, 6*FH+1, 5*FH+1, 5*FH+1};
for (int i=0; i<NUM_SWITCHES; ++i) { for (int i=0; i<NUM_SWITCHES; ++i) {
if (SWITCH_EXISTS(i)) { if (SWITCH_EXISTS(i)) {
getvalue_t val = getValue(MIXSRC_FIRST_SWITCH + i); getvalue_t val = getValue(MIXSRC_FIRST_SWITCH + i);
getvalue_t sw = ((val < 0) ? 3 * i + 1 : ((val == 0) ? 3 * i + 2 : 3 * i + 3)); getvalue_t sw = ((val < 0) ? 3 * i + 1 : ((val == 0) ? 3 * i + 2 : 3 * i + 3));
drawSwitch(x[i], y[i], sw, 0, false); drawSwitch(x[i], y[i], sw, 0, false);
} }
} }
#elif defined(PCBTARANIS) #elif defined(PCBTARANIS)
uint8_t switches = min(NUM_SWITCHES, 6); uint8_t switches = min(NUM_SWITCHES, 6);
for (int i=0; i<switches; ++i) { for (int i = 0; i < switches; ++i) {
if (SWITCH_EXISTS(i)) { if (SWITCH_EXISTS(i)) {
uint8_t x = 2*FW-2, y = 4*FH+i*FH+1; uint8_t x = 2 * FW - 2, y = 4 * FH + i * FH + 1;
if (i >= switches/2) { if (i >= switches / 2) {
x = 16*FW+1; x = 16 * FW + 1;
y -= (switches/2)*FH; y -= (switches / 2) * FH;
}
getvalue_t val = getValue(MIXSRC_FIRST_SWITCH + i);
getvalue_t sw = ((val < 0) ? 3 * i + 1 : ((val == 0) ? 3 * i + 2 : 3 * i + 3));
drawSwitch(x, y, sw, 0, false);
} }
getvalue_t val = getValue(MIXSRC_FIRST_SWITCH+i);
getvalue_t sw = ((val < 0) ? 3*i+1 : ((val == 0) ? 3*i+2 : 3*i+3));
drawSwitch(x, y, sw, 0, false);
} }
}
#else #else
// The ID0 3-POS switch is merged with the TRN switch // The ID0 3-POS switch is merged with the TRN switch
for (uint8_t i=SWSRC_THR; i<=SWSRC_TRN; i++) { for (uint8_t i=SWSRC_THR; i<=SWSRC_TRN; i++) {
int8_t sw = (i == SWSRC_TRN ? (switchState(SW_ID0) ? SWSRC_ID0 : (switchState(SW_ID1) ? SWSRC_ID1 : SWSRC_ID2)) : i); int8_t sw = (i == SWSRC_TRN ? (switchState(SW_ID0) ? SWSRC_ID0 : (switchState(SW_ID1) ? SWSRC_ID1 : SWSRC_ID2)) : i);
uint8_t x = 2*FW-2, y = i*FH+1; uint8_t x = 2*FW-2, y = i*FH+1;
if (i >= SWSRC_AIL) { if (i >= SWSRC_AIL) {
x = 17*FW-1; x = 17*FW-1;
y -= 3*FH; y -= 3*FH;
}
drawSwitch(x, y, sw, getSwitch(i) ? INVERS : 0, false);
} }
drawSwitch(x, y, sw, getSwitch(i) ? INVERS : 0, false);
}
#endif #endif
}
else {
// Logical Switches
uint8_t index = 0;
uint8_t y = LCD_H-20;
for (uint8_t line=0; line<2; line++) {
for (uint8_t column=0; column<MAX_LOGICAL_SWITCHES/2; column++) {
int8_t len = getSwitch(SWSRC_SW1+index) ? 10 : 1;
uint8_t x = (16 + 3*column);
lcdDrawSolidVerticalLine(x-1, y-len, len);
lcdDrawSolidVerticalLine(x, y-len, len);
index++;
}
y += 12;
} }
} else {
} // Logical Switches
else { uint8_t index = 0;
// Timer2 uint8_t y = LCD_H - 20;
drawTimerWithMode(87, 5*FH, 1, RIGHT | DBLSIZE); for (uint8_t line = 0; line < 2; line++) {
for (uint8_t column = 0; column < MAX_LOGICAL_SWITCHES / 2; column++) {
int8_t len = getSwitch(SWSRC_SW1 + index) ? 10 : 1;
uint8_t x = (16 + 3 * column);
lcdDrawSolidVerticalLine(x - 1, y - len, len);
lcdDrawSolidVerticalLine(x, y - len, len);
index++;
}
y += 12;
}
}
break;
} }
// And ! in case of unexpected shutdown if (view_base != VIEW_CHAN_MONITOR) {
if (isAsteriskDisplayed()) { // Flight Mode Name
lcdDrawChar(REBOOT_X, 0 * FH, '!', INVERS); uint8_t mode = mixerCurrentFlightMode;
lcdDrawSizedText(PHASE_X, PHASE_Y, g_model.flightModeData[mode].name, sizeof(g_model.flightModeData[mode].name), ZCHAR | PHASE_FLAGS);
// Model Name
putsModelName(MODELNAME_X, MODELNAME_Y, g_model.header.name, g_eeGeneral.currModel, BIGSIZE);
// Main Voltage (or alarm if any)
displayVoltageOrAlarm();
// Timer 1
drawTimerWithMode(125, 2 * FH, 0, RIGHT | DBLSIZE);
// Trims sliders
displayTrims(mode);
// RSSI gauge / external antenna
drawExternalAntennaAndRSSI();
// And ! in case of unexpected shutdown
if (isAsteriskDisplayed()) {
lcdDrawChar(REBOOT_X, 0 * FH, '!', INVERS);
}
} }
#if defined(GVARS) #if defined(GVARS)
@ -573,13 +572,14 @@ void menuMainView(event_t event)
gvarDisplayTimer--; gvarDisplayTimer--;
warningText = STR_GLOBAL_VAR; warningText = STR_GLOBAL_VAR;
drawMessageBox(warningText); drawMessageBox(warningText);
lcdDrawSizedText(16, 5*FH, g_model.gvars[gvarLastChanged].name, LEN_GVAR_NAME, ZCHAR); lcdDrawSizedText(16, 5 * FH, g_model.gvars[gvarLastChanged].name, LEN_GVAR_NAME, ZCHAR);
lcdDrawText(16+6*FW, 5*FH, "[", BOLD); lcdDrawText(16 + 6 * FW, 5 * FH, "[", BOLD);
drawGVarValue(lcdLastRightPos, 5*FH, gvarLastChanged, GVAR_VALUE(gvarLastChanged, getGVarFlightMode(mixerCurrentFlightMode, gvarLastChanged)), LEFT|BOLD); drawGVarValue(lcdLastRightPos, 5 * FH, gvarLastChanged, GVAR_VALUE(gvarLastChanged, getGVarFlightMode(mixerCurrentFlightMode, gvarLastChanged)),
LEFT | BOLD);
if (g_model.gvars[gvarLastChanged].unit) { if (g_model.gvars[gvarLastChanged].unit) {
lcdDrawText(lcdLastRightPos, 5*FH, "%", BOLD); lcdDrawText(lcdLastRightPos, 5 * FH, "%", BOLD);
} }
lcdDrawText(lcdLastRightPos, 5*FH, "]", BOLD); lcdDrawText(lcdLastRightPos, 5 * FH, "]", BOLD);
warningText = nullptr; warningText = nullptr;
} }
#endif #endif
@ -587,7 +587,7 @@ void menuMainView(event_t event)
#if defined(DSM2) #if defined(DSM2)
if (moduleState[0].mode == MODULE_MODE_BIND) { if (moduleState[0].mode == MODULE_MODE_BIND) {
// Issue 98 // Issue 98
lcdDrawText(15*FW, 0, "BIND", 0); lcdDrawText(15 * FW, 0, "BIND", 0);
} }
#endif #endif
} }

View file

@ -65,6 +65,17 @@ void drawVerticalScrollbar(coord_t x, coord_t y, coord_t h, uint16_t offset, uin
lcdDrawVerticalLine(x, y + yofs, yhgt, SOLID, FORCE); lcdDrawVerticalLine(x, y + yofs, yhgt, SOLID, FORCE);
} }
void drawGauge(coord_t x, coord_t y, coord_t w, coord_t h, int32_t val, int32_t max)
{
lcdDrawRect(x, y, w+1, h);
lcdDrawFilledRect(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--) {
lcdDrawSolidHorizontalLine(x0, y+i, len);
}
}
void title(const char * s) void title(const char * s)
{ {
lcdDrawText(0, 0, s, INVERS); lcdDrawText(0, 0, s, INVERS);

View file

@ -111,8 +111,6 @@ void lcdDrawText(coord_t x, coord_t y, const char * s);
void lcdDrawSizedText(coord_t x, coord_t y, const char * s, unsigned char len); void lcdDrawSizedText(coord_t x, coord_t y, const char * s, unsigned char len);
void lcdDrawTextAlignedLeft(coord_t y, const char * s); void lcdDrawTextAlignedLeft(coord_t y, const char * s);
#define lcdDrawTextAlignedCenter(y, s) lcdDrawText((LCD_W-sizeof(s)*FW+FW+1)/2, y, s)
void lcdDrawHexNumber(coord_t x, coord_t y, uint32_t val, LcdFlags mode=0); void lcdDrawHexNumber(coord_t x, coord_t y, uint32_t val, LcdFlags mode=0);
void lcdDrawNumber(coord_t x, coord_t y, int32_t val, LcdFlags mode, uint8_t len); void lcdDrawNumber(coord_t x, coord_t y, int32_t val, LcdFlags mode, uint8_t len);
void lcdDrawNumber(coord_t x, coord_t y, int32_t val, LcdFlags mode=0); void lcdDrawNumber(coord_t x, coord_t y, int32_t val, LcdFlags mode=0);

View file

@ -80,7 +80,7 @@ void menuModelFailsafe(event_t event)
} }
} }
lcdDrawTextAlignedCenter(0, TR_FAILSAFESET); lcdDrawText(LCD_W / 2, 0, STR_FAILSAFESET, CENTERED);
lcdInvertLine(0); lcdInvertLine(0);
coord_t x = colW; coord_t x = colW;

View file

@ -202,7 +202,7 @@ void menuFirstCalib(event_t event)
chainMenu(menuMainView); chainMenu(menuMainView);
} }
else { else {
lcdDrawTextAlignedCenter(0*FH, TR_MENUCALIBRATION); lcdDrawText(LCD_W / 2, 0, STR_MENUCALIBRATION, CENTERED);
lcdInvertLine(0); lcdInvertLine(0);
menuCommonCalib(event); menuCommonCalib(event);
} }

View file

@ -61,11 +61,7 @@ void menuChannelsView(event_t event)
else if (g_model.extendedLimits) else if (g_model.extendedLimits)
limits *= LIMIT_EXT_PERCENT / 100; limits *= LIMIT_EXT_PERCENT / 100;
if (reusableBuffer.viewChannels.mixersView) lcdDrawText(LCD_W / 2, 0, reusableBuffer.viewChannels.mixersView ? STR_MIXERS_MONITOR : STR_CHANNELS_MONITOR, CENTERED);
lcdDrawTextAlignedCenter(0, TR_MIXERS_MONITOR);
else
lcdDrawTextAlignedCenter(0, TR_CHANNELS_MONITOR);
lcdInvertLine(0); lcdInvertLine(0);
// Column separator // Column separator

View file

@ -59,14 +59,6 @@ bool menuTextView(event_t event)
lcd->drawTextMaxWidth(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP + i * FH, reusableBuffer.viewText.lines[i], 0, LCD_W - 2 * MENUS_MARGIN_LEFT); lcd->drawTextMaxWidth(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP + i * FH, reusableBuffer.viewText.lines[i], 0, LCD_W - 2 * MENUS_MARGIN_LEFT);
} }
#if 0
char * title = s_text_file;
#if defined(SIMU)
if (!strncmp(title, "./", 2)) title += 2;
#endif
lcdDrawTextAlignedCenter(MENU_FOOTER_TOP, title, HEADER_COLOR);
#endif
drawVerticalScrollbar(LCD_W-5, 50, 195, menuVerticalOffset, lines_count, NUM_BODY_LINES); drawVerticalScrollbar(LCD_W-5, 50, 195, menuVerticalOffset, lines_count, NUM_BODY_LINES);
return true; return true;

View file

@ -71,6 +71,7 @@ set(GUI_SRC
radio_diaganas.cpp radio_diaganas.cpp
view_telemetry.cpp view_telemetry.cpp
view_about.cpp view_about.cpp
view_channels.cpp
) )
if(GVARS) if(GVARS)