mirror of
https://github.com/opentx/opentx.git
synced 2025-07-21 15:25:17 +03:00
Another 100bytes flash saved + 16bytes RAM in LIMITS menu.
This commit is contained in:
parent
a5fef987df
commit
26f1a5706b
3 changed files with 35 additions and 23 deletions
11
src/lcd.h
11
src/lcd.h
|
@ -43,6 +43,7 @@
|
|||
|
||||
/* lcd common flags */
|
||||
#define BLINK 0x01
|
||||
#define SURROUNDED 0x40
|
||||
|
||||
/* lcd text flags */
|
||||
#define INVERS 0x02
|
||||
|
@ -58,13 +59,9 @@
|
|||
/* lcd outdez flags */
|
||||
#define UNSIGN 0x08
|
||||
#define LEADING0 0x10
|
||||
#define SPARE1 0x20
|
||||
#define SPARE2 0x30
|
||||
#define SPARE3 0x40
|
||||
#define PREC1 0x50
|
||||
#define PREC2 0x60
|
||||
#define PREC3 0x70
|
||||
#define MODE(flags) (-4 + ((int8_t)(flags & 0x70) >> 4))
|
||||
#define PREC1 0x20
|
||||
#define PREC2 0x30
|
||||
#define MODE(flags) ((((int8_t)(flags) & 0x30) - 0x10) >> 4)
|
||||
#define LEFT 0x80 /* align left */
|
||||
|
||||
/* line, rect, square flags */
|
||||
|
|
|
@ -464,3 +464,20 @@ void pushMenu(MenuFuncP newMenu)
|
|||
g_menuStack[g_menuStackPtr] = newMenu;
|
||||
(*newMenu)(EVT_ENTRY);
|
||||
}
|
||||
|
||||
#ifdef NAVIGATION_RE1
|
||||
void * s_inflight_value;
|
||||
int16_t s_inflight_min;
|
||||
int16_t s_inflight_max;
|
||||
const pm_char *s_inflight_label
|
||||
uint8_t s_inflight_flags;
|
||||
|
||||
void checkInflightIncDec(void *value, int16_t i_min, int16_t i_max, const pm_char *label, uint8_t flags)
|
||||
{
|
||||
s_inflight_value = value;
|
||||
s_inflight_min = i_min;
|
||||
s_inflight_max = i_max;
|
||||
s_inflight_label = label;
|
||||
s_inflight_flags = flags;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1556,8 +1556,6 @@ void menuProcLimits(uint8_t event)
|
|||
{
|
||||
MENU(STR_MENULIMITS, menuTabModel, e_Limits, NUM_CHNOUT+2, {0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3/*, 0*/});
|
||||
|
||||
static bool swVal[NUM_CHNOUT];
|
||||
|
||||
int8_t sub = m_posVert - 1;
|
||||
|
||||
for (uint8_t i=0; i<7; i++) {
|
||||
|
@ -1578,10 +1576,15 @@ void menuProcLimits(uint8_t event)
|
|||
|
||||
LimitData *ld = limitaddress(k) ;
|
||||
int16_t v = (ld->revert) ? -ld->offset : ld->offset;
|
||||
if((g_chans512[k] - v) > 50) swVal[k] = (true==ld->revert);// Switch to raw inputs? - remove trim!
|
||||
if((g_chans512[k] - v) < -50) swVal[k] = (false==ld->revert);
|
||||
putsChn(0,y,k+1,0);
|
||||
lcd_putcAtt(12*FW+FW/2, y, (swVal[k] ? 127 : 126),0); //'<' : '>'
|
||||
|
||||
char swVal = '-'; // '-', '<', '>'
|
||||
if((g_chans512[k] - v) > 50) swVal = (ld->revert ? 127 : 126); // Switch to raw inputs? - remove trim!
|
||||
if((g_chans512[k] - v) < -50) swVal = (ld->revert ? 126 : 127);
|
||||
putsChn(0, y, k+1, 0);
|
||||
lcd_putcAtt(12*FW+5, y, swVal, 0);
|
||||
|
||||
int8_t limit = (g_model.extendedLimits ? 125 : 100);
|
||||
|
||||
for (uint8_t j=0; j<4; j++) {
|
||||
uint8_t attr = ((sub==k && m_posHorz==j) ? ((s_editMode>0) ? BLINK : INVERS) : 0);
|
||||
uint8_t active = (attr && (s_editMode>0 || p1valdiff)) ;
|
||||
|
@ -1600,24 +1603,19 @@ void menuProcLimits(uint8_t event)
|
|||
}
|
||||
break;
|
||||
case 1:
|
||||
lcd_outdezAtt( 12*FW, y, (int8_t)(ld->min-100), attr);
|
||||
lcd_outdezAtt( 12*FW, y, (int8_t)(ld->min-100), attr);
|
||||
if (active) {
|
||||
ld->min -= 100;
|
||||
if(g_model.extendedLimits)
|
||||
CHECK_INCDEC_MODELVAR( event, ld->min, -125,125);
|
||||
else
|
||||
CHECK_INCDEC_MODELVAR( event, ld->min, -100,100);
|
||||
CHECK_INCDEC_MODELVAR( event, ld->min, -limit, limit);
|
||||
ld->min += 100;
|
||||
// CHECK_INFLIGHT_INCDEC(ld->min, -125, 125, PSTR("Min Limit"), EE_MODEL);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
lcd_outdezAtt( 17*FW, y, (int8_t)(ld->max+100), attr);
|
||||
lcd_outdezAtt( 17*FW, y, (int8_t)(ld->max+100), attr);
|
||||
if (active) {
|
||||
ld->max += 100;
|
||||
if(g_model.extendedLimits)
|
||||
CHECK_INCDEC_MODELVAR( event, ld->max, -125,125);
|
||||
else
|
||||
CHECK_INCDEC_MODELVAR( event, ld->max, -100,100);
|
||||
CHECK_INCDEC_MODELVAR( event, ld->max, -limit, limit);
|
||||
ld->max -= 100;
|
||||
}
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue