[X9D] Navigation reworked
This commit is contained in:
@@ -180,7 +180,7 @@ void menuGeneralSetup(uint8_t event)
|
||||
lcd_putsLeft(y, STR_DATE);
|
||||
lcd_putc(RADIO_SETUP_DATE_COLUMN, y, '-'); lcd_putc(RADIO_SETUP_DATE_COLUMN+3*FW-1, y, '-');
|
||||
for (uint8_t j=0; j<3; j++) {
|
||||
uint8_t rowattr = (m_posHorz==j) ? attr : 0;
|
||||
uint8_t rowattr = (m_posHorz<0 || m_posHorz==j) ? attr : 0;
|
||||
switch (j) {
|
||||
case 0:
|
||||
lcd_outdezAtt(RADIO_SETUP_DATE_COLUMN, y, t.tm_year+1900, rowattr);
|
||||
@@ -210,7 +210,7 @@ void menuGeneralSetup(uint8_t event)
|
||||
lcd_putsLeft(y, STR_TIME);
|
||||
lcd_putc(RADIO_SETUP_TIME_COLUMN-1, y, ':'); lcd_putc(RADIO_SETUP_TIME_COLUMN+3*FW-4, y, ':');
|
||||
for (uint8_t j=0; j<3; j++) {
|
||||
uint8_t rowattr = (m_posHorz==j) ? attr : 0;
|
||||
uint8_t rowattr = (m_posHorz<0 || m_posHorz==j) ? attr : 0;
|
||||
switch (j) {
|
||||
case 0:
|
||||
lcd_outdezNAtt(RADIO_SETUP_TIME_COLUMN, y, t.tm_hour, rowattr|LEADING0, 2);
|
||||
@@ -235,7 +235,7 @@ void menuGeneralSetup(uint8_t event)
|
||||
case ITEM_SETUP_BATT_RANGE:
|
||||
lcd_putsLeft(y, STR_BATTERY_RANGE);
|
||||
lcd_putc(g_eeGeneral.vBatMin >= 10 ? RADIO_SETUP_2ND_COLUMN+2*FW+FWNUM-1 : RADIO_SETUP_2ND_COLUMN+2*FW+FWNUM-FW/2, y, '-');
|
||||
putsVolts(RADIO_SETUP_2ND_COLUMN, y, 90+g_eeGeneral.vBatMin, (m_posHorz==0 ? attr : 0)|LEFT|NO_UNIT);
|
||||
putsVolts(RADIO_SETUP_2ND_COLUMN, y, 90+g_eeGeneral.vBatMin, (m_posHorz<=0 ? attr : 0)|LEFT|NO_UNIT);
|
||||
putsVolts(RADIO_SETUP_2ND_COLUMN+4*FW-2, y, 120+g_eeGeneral.vBatMax, (m_posHorz!=0 ? attr : 0)|LEFT|NO_UNIT);
|
||||
if (attr && s_editMode>0) {
|
||||
if (m_posHorz==0)
|
||||
@@ -762,7 +762,7 @@ void menuGeneralTrainer(uint8_t event)
|
||||
uint8_t chan = channel_order(i);
|
||||
volatile TrainerMix *td = &g_eeGeneral.trainer.mix[chan-1];
|
||||
|
||||
putsMixerSource(0, y, chan, 0);
|
||||
putsMixerSource(0, y, chan, (m_posVert==i && m_posHorz<0) ? INVERS : 0);
|
||||
|
||||
for (uint8_t j=0; j<3; j++) {
|
||||
|
||||
@@ -881,7 +881,7 @@ void menuGeneralDiagAna(uint8_t event)
|
||||
{
|
||||
#if defined(PCBSKY9X) && !defined(REVA)
|
||||
#define ANAS_ITEMS_COUNT 4
|
||||
#elif defined(CPUARM)
|
||||
#elif defined(PCBSKY9X)
|
||||
#define ANAS_ITEMS_COUNT 3
|
||||
#else
|
||||
#define ANAS_ITEMS_COUNT 2
|
||||
@@ -919,12 +919,12 @@ void menuGeneralDiagAna(uint8_t event)
|
||||
uint32_t batCalV = ((uint32_t)adcBatt*1390 + (10*(int32_t)adcBatt*g_eeGeneral.vBatCalib)/8) / BandGap;
|
||||
lcd_outdezNAtt(LEN_CALIB_FIELDS*FW+4*FW, 6*FH-2, batCalV, PREC2|(m_posVert==1 ? INVERS : 0));
|
||||
#elif defined(PCBX9D)
|
||||
lcd_putsLeft(5*FH+1, STR_BATT_CALIB);
|
||||
lcd_putsLeft(6*FH+1, STR_BATT_CALIB);
|
||||
static uint32_t adcBatt;
|
||||
adcBatt = ((adcBatt * 7) + anaIn(8)) / 8; // running average, sourced directly (to avoid unending debate :P)
|
||||
uint32_t batCalV = ( adcBatt + adcBatt*(g_eeGeneral.vBatCalib)/128 ) * BATT_SCALE;
|
||||
batCalV >>= 11;
|
||||
putsVolts(LEN_CALIB_FIELDS*FW+4*FW, 5*FH+1, batCalV, (m_posVert==1 ? INVERS : 0));
|
||||
putsVolts(LEN_CALIB_FIELDS*FW+4*FW, 6*FH+1, batCalV, (m_posVert==1 ? INVERS : 0));
|
||||
#else
|
||||
lcd_putsLeft(6*FH-2, STR_BATT_CALIB);
|
||||
putsVolts(LEN_CALIB_FIELDS*FW+4*FW, 6*FH-2, g_vbat100mV, (m_posVert==1 ? INVERS : 0));
|
||||
@@ -937,7 +937,7 @@ void menuGeneralDiagAna(uint8_t event)
|
||||
if (m_posVert==2) CHECK_INCDEC_GENVAR(event, g_eeGeneral.currentCalib, -49, 49);
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
#if defined(PCBSKY9X)
|
||||
lcd_putsLeft(7*FH+1, STR_TEMP_CALIB);
|
||||
putsTelemetryValue(LEN_CALIB_FIELDS*FW+4*FW, 7*FH+1, getTemperature(), UNIT_DEGREES, (m_posVert==3 ? INVERS : 0)) ;
|
||||
if (m_posVert==3) CHECK_INCDEC_GENVAR(event, g_eeGeneral.temperatureCalib, -100, 100);
|
||||
|
||||
+8
-1
@@ -416,7 +416,7 @@ void lcd_outdezNAtt(xcoord_t x, uint8_t y, lcdint_t val, LcdFlags flags, uint8_t
|
||||
flags &= ~PREC2; // TODO not needed but removes 20bytes, could be improved for sure, check asm
|
||||
if (dblsize) {
|
||||
xn = x;
|
||||
if(c>='1' && c<='3') ln++;
|
||||
if (c>='1' && c<='3') ln++;
|
||||
uint8_t tn = (qr.quot) % 10;
|
||||
if (tn==2 || tn==4) {
|
||||
if (c=='4') { xn++; }
|
||||
@@ -427,6 +427,13 @@ void lcd_outdezNAtt(xcoord_t x, uint8_t y, lcdint_t val, LcdFlags flags, uint8_t
|
||||
x -= 3;
|
||||
xn = x+1;
|
||||
}
|
||||
else if (tinsize) {
|
||||
x--;
|
||||
lcd_plot(x-1, y+4);
|
||||
if ((flags&INVERS) && ((~flags & BLINK) || BLINK_ON_PHASE))
|
||||
lcd_vline(x, y, 8);
|
||||
x--;
|
||||
}
|
||||
else {
|
||||
x--;
|
||||
lcd_plot(x, y+6);
|
||||
|
||||
+51
-21
@@ -213,7 +213,7 @@ int8_t checkIncDecGen(uint8_t event, int8_t i_val, int8_t i_min, int8_t i_max)
|
||||
}
|
||||
#endif
|
||||
|
||||
bool check_simple(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTabSize, maxrow_t maxrow)
|
||||
bool check_simple(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTabSize, vertpos_t maxrow)
|
||||
{
|
||||
return check(event, curr, menuTab, menuTabSize, 0, 0, maxrow);
|
||||
}
|
||||
@@ -231,14 +231,14 @@ void title(const pm_char * s)
|
||||
#define SCROLL_TH 64
|
||||
#define SCROLL_POT1_TH 32
|
||||
|
||||
#define MAXCOL(row) (horTab ? pgm_read_byte(horTab+min(row, (maxrow_t)horTabMax)) : (const uint8_t)0)
|
||||
#define MAXCOL(row) (horTab ? pgm_read_byte(horTab+min(row, (vertpos_t)horTabMax)) : (const uint8_t)0)
|
||||
#define INC(val, min, max) if (val<max) {val++;} else {val=min;}
|
||||
#define DEC(val, min, max) if (val>min) {val--;} else {val=max;}
|
||||
|
||||
bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTabSize, const pm_uint8_t *horTab, uint8_t horTabMax, maxrow_t maxrow)
|
||||
bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTabSize, const pm_uint8_t *horTab, uint8_t horTabMax, vertpos_t maxrow)
|
||||
{
|
||||
maxrow_t l_posVert = m_posVert;
|
||||
uint8_t l_posHorz = m_posHorz;
|
||||
vertpos_t l_posVert = m_posVert;
|
||||
horzpos_t l_posHorz = m_posHorz;
|
||||
|
||||
uint8_t maxcol = MAXCOL(l_posVert);
|
||||
|
||||
@@ -371,11 +371,11 @@ bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t
|
||||
if (s_editMode<=0) {
|
||||
if (scrollUD) {
|
||||
l_posVert = limit((int8_t)0, (int8_t)(l_posVert - scrollUD), (int8_t)maxrow);
|
||||
l_posHorz = min(l_posHorz, MAXCOL(l_posVert));
|
||||
l_posHorz = min((uint8_t)l_posHorz, MAXCOL(l_posVert));
|
||||
}
|
||||
|
||||
if (scrollLR && l_posVert>0) {
|
||||
l_posHorz = limit((int8_t)0, (int8_t)(l_posHorz - scrollLR), (int8_t)maxcol);
|
||||
l_posHorz = limit((int8_t)0, (int8_t)((uint8_t)l_posHorz - scrollLR), (int8_t)maxcol);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -383,7 +383,7 @@ bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t
|
||||
{
|
||||
case EVT_ENTRY:
|
||||
l_posVert = POS_VERT_INIT;
|
||||
l_posHorz = 0;
|
||||
l_posHorz = POS_HORZ_INIT;
|
||||
#if defined(ROTARY_ENCODER_NAVIGATION)
|
||||
if (menuTab) {
|
||||
s_editMode = EDIT_MODE_INIT;
|
||||
@@ -401,7 +401,14 @@ bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if defined(ROTARY_ENCODER_NAVIGATION) || defined(PCBX9D)
|
||||
#if defined(PCBX9D)
|
||||
case EVT_ROTARY_BREAK:
|
||||
if (s_editMode > 1) break;
|
||||
if (m_posHorz < 0 && maxcol > 0) {
|
||||
l_posHorz = 0;
|
||||
break;
|
||||
}
|
||||
#elif defined(ROTARY_ENCODER_NAVIGATION)
|
||||
case EVT_ROTARY_BREAK:
|
||||
if (s_editMode > 1) break;
|
||||
#endif
|
||||
@@ -440,12 +447,16 @@ bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t
|
||||
break;
|
||||
}
|
||||
#if defined(PCBX9D)
|
||||
if (l_posHorz >= 0 && maxcol > 0) {
|
||||
l_posHorz = POS_HORZ_INIT;
|
||||
}
|
||||
else
|
||||
{
|
||||
uint8_t posVertInit = POS_VERT_INIT;
|
||||
if (s_pgOfs != 0 || l_posHorz != 0 || l_posVert != posVertInit) {
|
||||
if (s_pgOfs != 0 || l_posVert != posVertInit) {
|
||||
s_pgOfs = 0;
|
||||
l_posVert = posVertInit;
|
||||
l_posHorz = 0;
|
||||
l_posHorz = POS_HORZ_INIT;
|
||||
}
|
||||
else {
|
||||
popMenu();
|
||||
@@ -474,11 +485,16 @@ bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t
|
||||
if (!horTab || s_editMode>0) break;
|
||||
#endif
|
||||
|
||||
#if defined(ROTARY_ENCODER_NAVIGATION) || defined(PCBX9D)
|
||||
#if defined(PCBX9D)
|
||||
CASE_EVT_ROTARY_MOVE_RIGHT
|
||||
if (s_editMode != 0) break;
|
||||
if (l_posHorz >= 0) {
|
||||
INC(l_posHorz, 0, maxcol);
|
||||
break;
|
||||
}
|
||||
#elif defined(ROTARY_ENCODER_NAVIGATION)
|
||||
CASE_EVT_ROTARY_MOVE_RIGHT
|
||||
if (s_editMode != 0) break;
|
||||
// TODO s_editMode test is duplicated
|
||||
// TODO could be written in a smarter way!
|
||||
if (l_posHorz < maxcol) {
|
||||
l_posHorz++;
|
||||
break;
|
||||
@@ -508,7 +524,12 @@ bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t
|
||||
#if defined(ROTARY_ENCODER_NAVIGATION) || defined(PCBX9D)
|
||||
s_editMode = 0; // if we go down, we must be in this mode
|
||||
#endif
|
||||
|
||||
#if defined(PCBX9D)
|
||||
l_posHorz = POS_HORZ_INIT;
|
||||
#else
|
||||
l_posHorz = min(l_posHorz, MAXCOL(l_posVert));
|
||||
#endif
|
||||
break;
|
||||
|
||||
#if !defined(PCBX9D)
|
||||
@@ -520,9 +541,15 @@ bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t
|
||||
if (!horTab || s_editMode>0) break;
|
||||
#endif
|
||||
|
||||
#if defined(ROTARY_ENCODER_NAVIGATION) || defined(PCBX9D)
|
||||
#if defined(PCBX9D)
|
||||
CASE_EVT_ROTARY_MOVE_LEFT
|
||||
if (s_editMode != 0) break;
|
||||
if (l_posHorz >= 0) {
|
||||
DEC(l_posHorz, 0, maxcol);
|
||||
break;
|
||||
}
|
||||
#elif defined(ROTARY_ENCODER_NAVIGATION)
|
||||
CASE_EVT_ROTARY_MOVE_LEFT
|
||||
// TODO could be written in a smarter way!
|
||||
if (s_editMode != 0) break;
|
||||
if (l_posHorz > 0) {
|
||||
l_posHorz--;
|
||||
@@ -556,9 +583,12 @@ bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t
|
||||
s_editMode = 0; // if we go up, we must be in this mode
|
||||
#endif
|
||||
|
||||
l_posHorz = min(l_posHorz, MAXCOL(l_posVert));
|
||||
#if defined(PCBX9D)
|
||||
l_posHorz = POS_HORZ_INIT;
|
||||
#else
|
||||
l_posHorz = min((uint8_t)l_posHorz, MAXCOL(l_posVert));
|
||||
#endif
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
uint8_t max = menuTab ? LCD_LINES-1 : LCD_LINES-2;
|
||||
@@ -573,8 +603,8 @@ bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t
|
||||
MenuFuncP g_menuStack[5];
|
||||
uint8_t g_menuPos[4];
|
||||
uint8_t g_menuStackPtr = 0;
|
||||
maxrow_t m_posVert;
|
||||
uint8_t m_posHorz;
|
||||
vertpos_t m_posVert;
|
||||
horzpos_t m_posHorz;
|
||||
|
||||
void popMenu()
|
||||
{
|
||||
@@ -582,7 +612,7 @@ void popMenu()
|
||||
|
||||
g_menuStackPtr = g_menuStackPtr-1;
|
||||
AUDIO_KEYPAD_UP();
|
||||
m_posHorz = 0;
|
||||
m_posHorz = POS_HORZ_INIT;
|
||||
m_posVert = g_menuPos[g_menuStackPtr];
|
||||
(*g_menuStack[g_menuStackPtr])(EVT_ENTRY_UP);
|
||||
}
|
||||
|
||||
+17
-13
@@ -162,22 +162,24 @@ int8_t checkIncDecGen(uint8_t event, int8_t i_val, int8_t i_min, int8_t i_max);
|
||||
|
||||
// Menus related stuff ...
|
||||
#if defined(SDCARD)
|
||||
#define maxrow_t uint16_t
|
||||
#define vertpos_t uint16_t
|
||||
#else
|
||||
#define maxrow_t uint8_t
|
||||
#define vertpos_t uint8_t
|
||||
#endif
|
||||
|
||||
extern maxrow_t m_posVert;
|
||||
extern uint8_t m_posHorz;
|
||||
|
||||
#if defined(PCBX9D)
|
||||
typedef uint8_t & check_event_t;
|
||||
typedef uint8_t & check_event_t;
|
||||
#define horzpos_t int8_t
|
||||
#else
|
||||
typedef uint8_t check_event_t;
|
||||
typedef uint8_t check_event_t;
|
||||
#define horzpos_t uint8_t
|
||||
#endif
|
||||
|
||||
bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTabSize, const pm_uint8_t *subTab, uint8_t subTabMax, maxrow_t maxrow);
|
||||
bool check_simple(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTabSize, maxrow_t maxrow);
|
||||
extern vertpos_t m_posVert;
|
||||
extern horzpos_t m_posHorz;
|
||||
|
||||
bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTabSize, const pm_uint8_t *subTab, uint8_t subTabMax, vertpos_t maxrow);
|
||||
bool check_simple(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTabSize, vertpos_t maxrow);
|
||||
bool check_submenu_simple(check_event_t event, uint8_t maxrow);
|
||||
|
||||
typedef void (*MenuFuncP_PROGMEM)(uint8_t event);
|
||||
@@ -310,11 +312,13 @@ void menuChannelsMonitor(uint8_t event);
|
||||
#endif
|
||||
|
||||
#if defined(PCBX9D)
|
||||
#define POS_VERT_INIT (menuTab ? (MAXCOL((uint16_t)1) == 255 ? 2 : 1) : 0)
|
||||
#define EDIT_MODE_INIT 0 // TODO enum
|
||||
#define POS_VERT_INIT (menuTab ? (MAXCOL((uint16_t)1) == 255 ? 2 : 1) : 0)
|
||||
#define POS_HORZ_INIT -1
|
||||
#define EDIT_MODE_INIT 0 // TODO enum
|
||||
#else
|
||||
#define POS_VERT_INIT 0
|
||||
#define EDIT_MODE_INIT -1
|
||||
#define POS_VERT_INIT 0
|
||||
#define POS_HORZ_INIT 0
|
||||
#define EDIT_MODE_INIT -1
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
+78
-46
@@ -833,8 +833,8 @@ void menuModelSetup(uint8_t event)
|
||||
}
|
||||
else {
|
||||
putsStrIdx(0*FW, y, STR_TIMER, k>=ITEM_MODEL_TIMER2 ? 2 : 1);
|
||||
putsTmrMode(MODEL_SETUP_2ND_COLUMN, y, timer->mode, m_posHorz==0 ? attr : 0);
|
||||
putsTime(MODEL_SETUP_2ND_COLUMN+5*FW-2+5*FWNUM+1, y, timer->start, m_posHorz==1 ? attr : 0, m_posHorz==2 ? attr : 0);
|
||||
putsTmrMode(MODEL_SETUP_2ND_COLUMN, y, timer->mode, m_posHorz<=0 ? attr : 0);
|
||||
putsTime(MODEL_SETUP_2ND_COLUMN+5*FW-2+5*FWNUM+1, y, timer->start, (m_posHorz<0 || m_posHorz==1) ? attr : 0, (m_posHorz<0 || m_posHorz==2) ? attr : 0);
|
||||
if (attr && (editMode>0 || p1valdiff)) {
|
||||
div_t qr = div(timer->start, 60);
|
||||
switch (m_posHorz) {
|
||||
@@ -954,7 +954,7 @@ void menuModelSetup(uint8_t event)
|
||||
case ITEM_MODEL_BEEP_CENTER:
|
||||
lcd_putsLeft(y, STR_BEEPCTR);
|
||||
for (uint8_t i=0; i<NUM_STICKS+NUM_POTS+NUM_ROTARY_ENCODERS; i++)
|
||||
lcd_putsiAtt(MODEL_SETUP_2ND_COLUMN+i*FW, y, STR_RETA123, i, ((m_posHorz==i) && attr) ? BLINK|INVERS : ((g_model.beepANACenter & ((BeepANACenter)1<<i)) ? INVERS : 0 ) );
|
||||
lcd_putsiAtt(MODEL_SETUP_2ND_COLUMN+i*FW, y, STR_RETA123, i, ((m_posHorz==i) && attr) ? BLINK|INVERS : (((g_model.beepANACenter & ((BeepANACenter)1<<i)) || (attr && m_posHorz<0)) ? INVERS : 0 ) );
|
||||
if (attr) {
|
||||
if((event==EVT_KEY_BREAK(KEY_ENTER)) || p1valdiff) {
|
||||
s_editMode = 0;
|
||||
@@ -971,7 +971,7 @@ void menuModelSetup(uint8_t event)
|
||||
lcd_putsLeft(y, NO_INDENT(STR_PROTO));
|
||||
#endif
|
||||
|
||||
lcd_putsiAtt(MODEL_SETUP_2ND_COLUMN, y, STR_VPROTOS, protocol, m_posHorz==0 ? attr : 0);
|
||||
lcd_putsiAtt(MODEL_SETUP_2ND_COLUMN, y, STR_VPROTOS, protocol, m_posHorz<=0 ? attr : 0);
|
||||
|
||||
#if defined(PCBSKY9X)
|
||||
lcd_putsAtt(MODEL_SETUP_2ND_COLUMN+4*FW+3, y, STR_CH, m_posHorz==1 ? attr : 0);
|
||||
@@ -980,9 +980,9 @@ void menuModelSetup(uint8_t event)
|
||||
lcd_outdezAtt(lcdLastPos + FW+1, y, g_model.ppmSCH+NUM_PORT1_CHANNELS, LEFT | (m_posHorz==2 ? attr : 0));
|
||||
#else
|
||||
if (IS_PPM_PROTOCOL(protocol)) {
|
||||
lcd_putsiAtt(MODEL_SETUP_2ND_COLUMN+7*FW, y, STR_NCHANNELS, g_model.ppmNCH+2, m_posHorz==1 ? attr : 0);
|
||||
lcd_putsiAtt(MODEL_SETUP_2ND_COLUMN+7*FW, y, STR_NCHANNELS, g_model.ppmNCH+2, m_posHorz!=0 ? attr : 0);
|
||||
}
|
||||
else if (attr && m_posHorz != 0 /* TODO avoid it on stock with another macro*/) {
|
||||
else if (attr && m_posHorz > 0 /* TODO avoid it on stock with another macro*/) {
|
||||
REPEAT_LAST_CURSOR_MOVE();
|
||||
}
|
||||
#endif
|
||||
@@ -1023,10 +1023,10 @@ void menuModelSetup(uint8_t event)
|
||||
case ITEM_MODEL_PPM2_PROTOCOL:
|
||||
lcd_putsLeft(y, PSTR("Port2"));
|
||||
lcd_putsiAtt(MODEL_SETUP_2ND_COLUMN, y, STR_VPROTOS, 0, 0);
|
||||
lcd_putsAtt(MODEL_SETUP_2ND_COLUMN+4*FW+3, y, STR_CH, m_posHorz==0 ? attr : 0);
|
||||
lcd_outdezAtt(lcdLastPos, y, g_model.ppm2SCH+1, LEFT | (m_posHorz==0 ? attr : 0));
|
||||
lcd_putsAtt(MODEL_SETUP_2ND_COLUMN+4*FW+3, y, STR_CH, m_posHorz<=0 ? attr : 0);
|
||||
lcd_outdezAtt(lcdLastPos, y, g_model.ppm2SCH+1, LEFT | (m_posHorz<=0 ? attr : 0));
|
||||
lcd_putc(lcdLastPos, y, '-');
|
||||
lcd_outdezAtt(lcdLastPos + FW+1, y, g_model.ppm2SCH+8+(g_model.ppm2NCH*2), LEFT | (m_posHorz==1 ? attr : 0));
|
||||
lcd_outdezAtt(lcdLastPos + FW+1, y, g_model.ppm2SCH+8+(g_model.ppm2NCH*2), LEFT | (m_posHorz!=0 ? attr : 0));
|
||||
if (attr && (editMode>0 || p1valdiff)) {
|
||||
switch (m_posHorz) {
|
||||
case 0:
|
||||
@@ -1046,10 +1046,10 @@ void menuModelSetup(uint8_t event)
|
||||
if (IS_PPM_PROTOCOL(protocol)) {
|
||||
lcd_putsLeft( y, STR_PPMFRAME);
|
||||
lcd_puts(MODEL_SETUP_2ND_COLUMN+3*FW, y, STR_MS);
|
||||
lcd_outdezAtt(MODEL_SETUP_2ND_COLUMN, y, (int16_t)g_model.ppmFrameLength*5 + 225, (m_posHorz==0 ? attr : 0) | PREC1|LEFT);
|
||||
lcd_outdezAtt(MODEL_SETUP_2ND_COLUMN, y, (int16_t)g_model.ppmFrameLength*5 + 225, (m_posHorz<=0 ? attr : 0) | PREC1|LEFT);
|
||||
lcd_putc(MODEL_SETUP_2ND_COLUMN+8*FW+2, y, 'u');
|
||||
lcd_outdezAtt(MODEL_SETUP_2ND_COLUMN+8*FW+2, y, (g_model.ppmDelay*50)+300, m_posHorz==1 ? attr : 0);
|
||||
lcd_putcAtt(MODEL_SETUP_2ND_COLUMN+10*FW, y, g_model.pulsePol ? '+' : '-', m_posHorz==2 ? attr : 0);
|
||||
lcd_outdezAtt(MODEL_SETUP_2ND_COLUMN+8*FW+2, y, (g_model.ppmDelay*50)+300, (m_posHorz < 0 || m_posHorz==1) ? attr : 0);
|
||||
lcd_putcAtt(MODEL_SETUP_2ND_COLUMN+10*FW, y, g_model.pulsePol ? '+' : '-', (m_posHorz < 0 || m_posHorz==2) ? attr : 0);
|
||||
|
||||
if (attr && (editMode>0 || p1valdiff)) {
|
||||
switch (m_posHorz) {
|
||||
@@ -1072,7 +1072,7 @@ void menuModelSetup(uint8_t event)
|
||||
}
|
||||
|
||||
lcd_putsLeft(y, STR_RXNUM);
|
||||
lcd_outdezNAtt(MODEL_SETUP_2ND_COLUMN-3*FW, y, g_model.modelId, (m_posHorz==0 ? attr : 0) | LEADING0|LEFT, 2);
|
||||
lcd_outdezNAtt(MODEL_SETUP_2ND_COLUMN-3*FW, y, g_model.modelId, (m_posHorz<=0 ? attr : 0) | LEADING0|LEFT, 2);
|
||||
if (attr && (m_posHorz==0 && (editMode>0 || p1valdiff))) {
|
||||
CHECK_INCDEC_MODELVAR_ZERO(event, g_model.modelId, 99);
|
||||
#if defined(CPUARM)
|
||||
@@ -1088,7 +1088,7 @@ void menuModelSetup(uint8_t event)
|
||||
checkModelIdUnique(g_eeGeneral.currModel);
|
||||
#endif
|
||||
|
||||
lcd_putsAtt(MODEL_SETUP_2ND_COLUMN, y, STR_SYNCMENU, (m_posHorz==1 ? attr : 0));
|
||||
lcd_putsAtt(MODEL_SETUP_2ND_COLUMN, y, STR_SYNCMENU, (m_posHorz!=0 ? attr : 0));
|
||||
if (attr && m_posHorz==1) {
|
||||
s_editMode = 0;
|
||||
if (event==EVT_KEY_LONG(KEY_ENTER)) {
|
||||
@@ -1305,10 +1305,10 @@ void menuModelPhasesAll(uint8_t event)
|
||||
|
||||
PhaseData *p = phaseaddress(i);
|
||||
|
||||
putsFlightPhase(0, y, i+1, (getFlightPhase()==i ? BOLD : 0));
|
||||
putsFlightPhase(0, y, k+1, (getFlightPhase()==k ? BOLD : 0) | ((sub==k && m_posHorz<0) ? INVERS : 0));
|
||||
|
||||
for (uint8_t j=0; j<ITEM_PHASES_COUNT; j++) {
|
||||
uint8_t posHorz = m_posHorz;
|
||||
horzpos_t posHorz = m_posHorz;
|
||||
if (i==0 && posHorz > 0) { posHorz += 2; }
|
||||
uint8_t attr = ((sub==k && posHorz==j) ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0);
|
||||
uint8_t active = (attr && (s_editMode>0 || p1valdiff)) ;
|
||||
@@ -1738,6 +1738,9 @@ void menuModelCurveOne(uint8_t event)
|
||||
|
||||
switch(event) {
|
||||
case EVT_ENTRY:
|
||||
#if defined(PCBX9D)
|
||||
m_posHorz = 0;
|
||||
#endif
|
||||
s_editMode = 1;
|
||||
break;
|
||||
CASE_EVT_ROTARY_BREAK
|
||||
@@ -2769,7 +2772,11 @@ void menuModelLimits(uint8_t event)
|
||||
int8_t limit = (g_model.extendedLimits ? 125 : 100);
|
||||
#endif
|
||||
|
||||
#if defined(PCBX9D)
|
||||
putsChn(0, y, k+1, (sub==k && m_posHorz < 0) ? INVERS : 0);
|
||||
#else
|
||||
putsChn(0, y, k+1, 0);
|
||||
#endif
|
||||
|
||||
for (uint8_t j=0; j<ITEM_LIMITS_COUNT; j++) {
|
||||
uint8_t attr = ((sub==k && m_posHorz==j) ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0);
|
||||
@@ -2937,7 +2944,7 @@ void menuModelGVars(uint8_t event)
|
||||
for (uint8_t i=0; i<MAX_GVARS; i++) {
|
||||
uint8_t y = 1 + 3*FH + i*FH;
|
||||
|
||||
putsStrIdx(0, y, STR_GV, i+1);
|
||||
putsStrIdx(0, y, STR_GV, i+1, (sub==i && m_posHorz<0) ? INVERS : 0);
|
||||
|
||||
for (uint8_t j=0; j<1+MAX_PHASES; j++) {
|
||||
uint8_t attr = ((sub==i && m_posHorz==j) ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0);
|
||||
@@ -3205,7 +3212,7 @@ void menuModelCustomSwitches(uint8_t event)
|
||||
|
||||
// CSW name
|
||||
uint8_t sw = SWSRC_SW1+k;
|
||||
putsSwitches(0, y, sw, getSwitch(sw, 0) ? BOLD : 0);
|
||||
putsSwitches(0, y, sw, (getSwitch(sw, 0) ? BOLD : 0) | ((sub==k && m_posHorz<0) ? INVERS : 0));
|
||||
|
||||
// CSW func
|
||||
lcd_putsiAtt(CSW_1ST_COLUMN, y, STR_VCSWFUNC, cs->func, m_posHorz==0 ? attr : 0);
|
||||
@@ -3310,14 +3317,17 @@ void menuModelCustomSwitches(uint8_t event)
|
||||
#endif
|
||||
|
||||
#if LCD_W >= 212
|
||||
#define MODEL_CUSTOM_FUNC_2ND_COLUMN (6*FW-2)
|
||||
#define MODEL_CUSTOM_FUNC_3RD_COLUMN (20*FW+2)
|
||||
#define MODEL_CUSTOM_FUNC_4TH_COLUMN (29*FW)
|
||||
#define MODEL_CUSTOM_FUNC_1ST_COLUMN (5+4*FW)
|
||||
#define MODEL_CUSTOM_FUNC_2ND_COLUMN (10*FW)
|
||||
#define MODEL_CUSTOM_FUNC_3RD_COLUMN (24*FW)
|
||||
#define MODEL_CUSTOM_FUNC_4TH_COLUMN (34*FW-3)
|
||||
#elif defined(GRAPHICS)
|
||||
#define MODEL_CUSTOM_FUNC_1ST_COLUMN (3)
|
||||
#define MODEL_CUSTOM_FUNC_2ND_COLUMN (5*FW-2)
|
||||
#define MODEL_CUSTOM_FUNC_3RD_COLUMN (15*FW+2)
|
||||
#define MODEL_CUSTOM_FUNC_4TH_COLUMN (20*FW)
|
||||
#else
|
||||
#define MODEL_CUSTOM_FUNC_1ST_COLUMN (3)
|
||||
#define MODEL_CUSTOM_FUNC_2ND_COLUMN (5*FW-2)
|
||||
#define MODEL_CUSTOM_FUNC_3RD_COLUMN (15*FW+2)
|
||||
#define MODEL_CUSTOM_FUNC_4TH_COLUMN (18*FW+2)
|
||||
@@ -3341,14 +3351,18 @@ void menuModelCustomFunctions(uint8_t event)
|
||||
for (uint8_t i=0; i<LCD_LINES-1; i++) {
|
||||
y = 1 + (i+1)*FH;
|
||||
k = i+s_pgOfs;
|
||||
if(k==NUM_CFN) break;
|
||||
|
||||
#if LCD_W >= 212
|
||||
putsStrIdx(0, y, PSTR("CF"), k+1, (sub==k && m_posHorz<0) ? INVERS : 0);
|
||||
#endif
|
||||
|
||||
CustomFnData *sd = &g_model.funcSw[k];
|
||||
for (uint8_t j=0; j<4; j++) {
|
||||
uint8_t attr = ((sub==k && m_posHorz==j) ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0);
|
||||
uint8_t active = (attr && (s_editMode>0 || p1valdiff));
|
||||
switch (j) {
|
||||
case 0:
|
||||
putsSwitches(3, y, sd->swtch, attr | ((activeFnSwitches & ((MASK_FUNC_TYPE)1 << k)) ? BOLD : 0));
|
||||
putsSwitches(MODEL_CUSTOM_FUNC_1ST_COLUMN, y, sd->swtch, attr | ((activeFnSwitches & ((MASK_FUNC_TYPE)1 << k)) ? BOLD : 0));
|
||||
if (active || AUTOSWITCH_ENTER_LONG()) CHECK_INCDEC_MODELSWITCH(event, sd->swtch, SWSRC_FIRST, SWSRC_LAST);
|
||||
break;
|
||||
|
||||
@@ -3426,7 +3440,11 @@ void menuModelCustomFunctions(uint8_t event)
|
||||
#endif
|
||||
#if defined(CPUARM) && defined(SDCARD)
|
||||
else if (CFN_FUNC(sd) == FUNC_PLAY_TRACK || CFN_FUNC(sd) == FUNC_BACKGND_MUSIC) {
|
||||
uint8_t x = (CFN_FUNC(sd) == FUNC_PLAY_TRACK ? MODEL_CUSTOM_FUNC_2ND_COLUMN + FW + FW*strlen(TR_PLAY_TRACK) : MODEL_CUSTOM_FUNC_3RD_COLUMN);
|
||||
#if LCD_W >= 212
|
||||
xcoord_t x = MODEL_CUSTOM_FUNC_3RD_COLUMN;
|
||||
#else
|
||||
xcoord_t x = (CFN_FUNC(sd) == FUNC_PLAY_TRACK ? MODEL_CUSTOM_FUNC_2ND_COLUMN + FW + FW*strlen(TR_PLAY_TRACK) : MODEL_CUSTOM_FUNC_3RD_COLUMN);
|
||||
#endif
|
||||
if (ZLEN(sd->param.name))
|
||||
lcd_putsnAtt(x, y, sd->param.name, sizeof(sd->param.name), attr);
|
||||
else
|
||||
@@ -3659,14 +3677,24 @@ enum menuModelTelemetryItems {
|
||||
|
||||
#ifdef FRSKY
|
||||
#if LCD_W >= 212
|
||||
#define TELEM_COL2 14*FW
|
||||
#define TELEM_COL3 29*FW
|
||||
#elif defined(TRANSLATIONS_FR) || defined(TRANSLATIONS_CZ)
|
||||
#define TELEM_COL2 (9*FW)
|
||||
#define TELEM_COL1 (7*FW)
|
||||
#define TELEM_COL2 (15*FW)
|
||||
#define TELEM_COL3 (23*FW)
|
||||
#define TELEM_BARS_COLMIN (3*FW+56)
|
||||
#define TELEM_BARS_COLMAX (20*FW-3)
|
||||
#else
|
||||
#define TELEM_COL2 (8*FW)
|
||||
#define TELEM_COL1 INDENT_WIDTH
|
||||
#if defined(TRANSLATIONS_FR) || defined(TRANSLATIONS_CZ)
|
||||
#define TELEM_COL2 (9*FW)
|
||||
#else
|
||||
#define TELEM_COL2 (8*FW)
|
||||
#endif
|
||||
#define TELEM_BARS_COLMIN (56-3*FW)
|
||||
#define TELEM_BARS_COLMAX (14*FW-3)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
void menuModelTelemetry(uint8_t event)
|
||||
{
|
||||
MENU(STR_MENUTELEMETRY, menuTabModel, e_Telemetry, ITEM_TELEMETRY_MAX+1, {0, (uint8_t)-1, 1, 0, 2, 2, (uint8_t)-1, 1, 0, 2, 2, (uint8_t)-1, 1, 1, USRDATA_LINES 0, 0, IF_VARIO((uint8_t)-1) IF_VARIO(0) IF_VARIO(3) 0, 2, 2, 2, 2, 0, 2, 2, 2, IF_CPUARM(2) IF_CPUARM(0) IF_CPUARM(2) IF_CPUARM(2) IF_CPUARM(2) 2 });
|
||||
@@ -3704,8 +3732,8 @@ void menuModelTelemetry(uint8_t event)
|
||||
case ITEM_TELEMETRY_A1_RANGE:
|
||||
case ITEM_TELEMETRY_A2_RANGE:
|
||||
lcd_putsLeft(y, STR_RANGE);
|
||||
putsTelemetryChannel(TELEM_COL2, y, dest, 255-channel.offset, (m_posHorz==0 ? attr : 0)|NO_UNIT|LEFT);
|
||||
lcd_putsiAtt(lcdLastPos, y, STR_VTELEMUNIT, channel.type, m_posHorz==1 ? attr : 0);
|
||||
putsTelemetryChannel(TELEM_COL2, y, dest, 255-channel.offset, (m_posHorz<=0 ? attr : 0)|NO_UNIT|LEFT);
|
||||
lcd_putsiAtt(lcdLastPos, y, STR_VTELEMUNIT, channel.type, m_posHorz!=0 ? attr : 0);
|
||||
if (attr && (s_editMode>0 || p1valdiff)) {
|
||||
if (m_posHorz == 0) {
|
||||
uint16_t ratio = checkIncDec(event, channel.ratio, 0, 256, EE_MODEL);
|
||||
@@ -3741,9 +3769,9 @@ void menuModelTelemetry(uint8_t event)
|
||||
{
|
||||
uint8_t j = ((k==ITEM_TELEMETRY_A1_ALARM1 || k==ITEM_TELEMETRY_A2_ALARM1) ? 0 : 1);
|
||||
lcd_putsLeft(y, STR_ALARM);
|
||||
lcd_putsiAtt(TELEM_COL2, y, STR_VALARM, ALARM_LEVEL(ch, j), m_posHorz==0 ? attr : 0);
|
||||
lcd_putsiAtt(TELEM_COL2+4*FW, y, STR_VALARMFN, ALARM_GREATER(ch, j), m_posHorz==1 ? attr : 0);
|
||||
putsTelemetryChannel(TELEM_COL2+6*FW, y, dest, channel.alarms_value[j], (m_posHorz==2 ? attr : 0) | LEFT);
|
||||
lcd_putsiAtt(TELEM_COL2, y, STR_VALARM, ALARM_LEVEL(ch, j), m_posHorz<=0 ? attr : 0);
|
||||
lcd_putsiAtt(TELEM_COL2+4*FW, y, STR_VALARMFN, ALARM_GREATER(ch, j), (m_posHorz<0 || m_posHorz==1) ? attr : 0);
|
||||
putsTelemetryChannel(TELEM_COL2+6*FW, y, dest, channel.alarms_value[j], ((m_posHorz<0 || m_posHorz==2) ? attr : 0) | LEFT);
|
||||
|
||||
if (attr && (s_editMode>0 || p1valdiff)) {
|
||||
uint8_t t;
|
||||
@@ -3775,9 +3803,9 @@ void menuModelTelemetry(uint8_t event)
|
||||
case ITEM_TELEMETRY_RSSI_ALARM2: {
|
||||
uint8_t j = k-ITEM_TELEMETRY_RSSI_ALARM1;
|
||||
lcd_putsLeft(y, STR_ALARM);
|
||||
lcd_putsiAtt(TELEM_COL2, y, STR_VALARM, ((2+j+g_model.frsky.rssiAlarms[j].level)%4), m_posHorz==0 ? attr : 0);
|
||||
lcd_putsiAtt(TELEM_COL2, y, STR_VALARM, ((2+j+g_model.frsky.rssiAlarms[j].level)%4), m_posHorz<=0 ? attr : 0);
|
||||
lcd_putc(TELEM_COL2+4*FW, y, '<');
|
||||
lcd_outdezNAtt(TELEM_COL2+6*FW, y, getRssiAlarmValue(j), LEFT|(m_posHorz==1 ? attr : 0), 3);
|
||||
lcd_outdezNAtt(TELEM_COL2+6*FW, y, getRssiAlarmValue(j), LEFT|(m_posHorz!=0 ? attr : 0), 3);
|
||||
|
||||
if (attr && (s_editMode>0 || p1valdiff)) {
|
||||
switch (m_posHorz) {
|
||||
@@ -3835,13 +3863,13 @@ void menuModelTelemetry(uint8_t event)
|
||||
|
||||
case ITEM_TELEMETRY_VARIO_RANGE:
|
||||
lcd_putsLeft(y, STR_LIMIT);
|
||||
lcd_outdezAtt(TELEM_COL2, y, -10+g_model.frsky.varioMin, (m_posHorz==0 ? attr : 0)|LEFT);
|
||||
lcd_outdezAtt(TELEM_COL2, y, -10+g_model.frsky.varioMin, (m_posHorz<=0 ? attr : 0)|LEFT);
|
||||
if (g_model.frsky.varioCenterMin == -16)
|
||||
lcd_putsAtt(TELEM_COL2+4*FW-2, y, STR_OFF, m_posHorz==1 ? attr : 0);
|
||||
else
|
||||
lcd_outdezAtt(TELEM_COL2+7*FW-2, y, -5+g_model.frsky.varioCenterMin, (m_posHorz==1 ? attr : 0)|PREC1);
|
||||
lcd_outdezAtt(TELEM_COL2+10*FW, y, 5+g_model.frsky.varioCenterMax, (m_posHorz==2 ? attr : 0)|PREC1);
|
||||
lcd_outdezAtt(TELEM_COL2+13*FW+2, y, 10+g_model.frsky.varioMax, (m_posHorz==3 ? attr : 0));
|
||||
lcd_outdezAtt(TELEM_COL2+7*FW-2, y, -5+g_model.frsky.varioCenterMin, ((m_posHorz<0 || m_posHorz==1) ? attr : 0)|PREC1);
|
||||
lcd_outdezAtt(TELEM_COL2+10*FW, y, 5+g_model.frsky.varioCenterMax, ((m_posHorz<0 || m_posHorz==2) ? attr : 0)|PREC1);
|
||||
lcd_outdezAtt(TELEM_COL2+13*FW+2, y, 10+g_model.frsky.varioMax, ((m_posHorz<0 || m_posHorz==3) ? attr : 0));
|
||||
if (attr && (s_editMode>0 || p1valdiff)) {
|
||||
switch (m_posHorz) {
|
||||
case 0:
|
||||
@@ -3863,7 +3891,6 @@ void menuModelTelemetry(uint8_t event)
|
||||
|
||||
case ITEM_TELEMETRY_SCREEN_LABEL1:
|
||||
case ITEM_TELEMETRY_SCREEN_LABEL2:
|
||||
|
||||
#if defined(CPUARM)
|
||||
case ITEM_TELEMETRY_SCREEN_LABEL3:
|
||||
{
|
||||
@@ -3917,16 +3944,21 @@ void menuModelTelemetry(uint8_t event)
|
||||
screenIndex = 1;
|
||||
lineIndex = k-ITEM_TELEMETRY_SCREEN_LINE5;
|
||||
}
|
||||
|
||||
#if LCD_W >= 212
|
||||
putsStrIdx(0, y, PSTR(INDENT"Line"), lineIndex+1, m_posHorz<0 ? attr : 0);
|
||||
#endif
|
||||
|
||||
if (IS_BARS_SCREEN(screenIndex)) {
|
||||
FrSkyBarData & bar = g_model.frsky.screens[screenIndex].bars[lineIndex];
|
||||
uint8_t barSource = bar.source;
|
||||
lcd_putsiAtt(INDENT_WIDTH, y, STR_VTELEMCHNS, barSource, m_posHorz==0 ? attr : 0);
|
||||
lcd_putsiAtt(TELEM_COL1, y, STR_VTELEMCHNS, barSource, m_posHorz==0 ? attr : 0);
|
||||
if (barSource) {
|
||||
putsTelemetryChannel(56-3*FW, y, barSource-1, convertTelemValue(barSource, bar.barMin), (m_posHorz==1 ? attr : 0) | LEFT);
|
||||
putsTelemetryChannel(14*FW-3, y, barSource-1, convertTelemValue(barSource, 255-bar.barMax), (m_posHorz==2 ? attr : 0) | LEFT);
|
||||
putsTelemetryChannel(TELEM_BARS_COLMIN, y, barSource-1, convertTelemValue(barSource, bar.barMin), (m_posHorz==1 ? attr : 0) | LEFT);
|
||||
putsTelemetryChannel(TELEM_BARS_COLMAX, y, barSource-1, convertTelemValue(barSource, 255-bar.barMax), (m_posHorz==2 ? attr : 0) | LEFT);
|
||||
}
|
||||
else {
|
||||
if (attr) m_posHorz = 0;
|
||||
if (attr && m_posHorz>=0) m_posHorz = 0;
|
||||
}
|
||||
if (attr && (s_editMode>0 || p1valdiff)) {
|
||||
switch (m_posHorz) {
|
||||
@@ -3951,7 +3983,7 @@ void menuModelTelemetry(uint8_t event)
|
||||
uint8_t cellAttr = (m_posHorz==c ? attr : 0);
|
||||
uint8_t & value = g_model.frsky.screens[screenIndex].lines[lineIndex].sources[c];
|
||||
#if defined(PCBX9D)
|
||||
uint8_t pos[] = {INDENT_WIDTH, TELEM_COL2, TELEM_COL3};
|
||||
uint8_t pos[] = {TELEM_COL1, TELEM_COL2, TELEM_COL3};
|
||||
#else
|
||||
uint8_t pos[] = {INDENT_WIDTH, TELEM_COL2};
|
||||
#endif
|
||||
|
||||
+16
-16
@@ -48,44 +48,44 @@ void menuChannelsMonitor(uint8_t event)
|
||||
lcd_putsCenter(0*FH, CHANNELS_MONITOR);
|
||||
lcd_invert_line(0);
|
||||
|
||||
// Column separator
|
||||
lcd_vline(LCD_W/2+1, FH, LCD_H-FH);
|
||||
|
||||
uint8_t ch = 0;
|
||||
|
||||
for (uint8_t col=0; col<2; col++) {
|
||||
|
||||
uint8_t x = col*LCD_W/2+1;
|
||||
|
||||
// Column separator
|
||||
if (col == 1)
|
||||
lcd_vline(x-1, FH, LCD_H-FH);
|
||||
|
||||
// Channels
|
||||
for (uint8_t line=0; line<8; line++) {
|
||||
uint8_t y = 9+line*7;
|
||||
int16_t val = g_chans512[ch];
|
||||
int32_t val = g_chans512[ch];
|
||||
uint8_t ofs = (col ? 0 : 1);
|
||||
|
||||
// Channel name if present, number if not
|
||||
if (*g_model.limitData[ch].name != '\0')
|
||||
uint8_t lenLabel = zlen(g_model.limitData[ch].name, sizeof(g_model.limitData[ch].name));
|
||||
if (lenLabel > 0)
|
||||
lcd_putsnAtt(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);
|
||||
}
|
||||
lcd_outdezNAtt(x+18+37-ofs, y+1, calcRESXto1000(val), PREC1 | TINSIZE);
|
||||
|
||||
#define WBAR 48
|
||||
uint8_t wbar = (lenLabel > 4 ? 48 : 58);
|
||||
|
||||
lcd_rect(x+18+37-ofs, y, WBAR+2, 6);
|
||||
// Value
|
||||
lcd_outdezNAtt(x+LCD_W/2-3-wbar-ofs, y+1, calcRESXto1000(val), PREC1 | TINSIZE);
|
||||
|
||||
// Gauge
|
||||
lcd_rect(x+LCD_W/2-3-wbar-ofs, y, wbar+1, 6);
|
||||
uint16_t lim = g_model.extendedLimits ? 640*2 : 512*2;
|
||||
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+19+WBAR/2 : x+19+WBAR/2-len;
|
||||
x0 = x0 + 37 - ofs;
|
||||
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);
|
||||
ch++;
|
||||
|
||||
#undef WBAR
|
||||
ch++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user