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

Inflight parameters modification using Rotary Encoder on v4 (not finished yet).

This commit is contained in:
bsongis 2012-02-18 08:58:05 +00:00
parent 9997b8c599
commit 33e30b8fef
10 changed files with 92 additions and 36 deletions

View file

@ -95,9 +95,9 @@ struct FrskyHubData {
uint16_t gpsLongitude_ap; uint16_t gpsLongitude_ap;
uint16_t gpsLatitude_ap; uint16_t gpsLatitude_ap;
uint16_t gpsCourse_ap; uint16_t gpsCourse_ap;
uint32_t pilotLatitude; // 2 spares reused uint32_t pilotLatitude; // 2 spares reused
uint32_t pilotLongitude; // 2 spares reused uint32_t pilotLongitude; // 2 spares reused
uint16_t baroAltitude_bp; // spare reused uint16_t baroAltitude_bp; // spare reused
uint16_t gpsLongitudeEW; // East/West uint16_t gpsLongitudeEW; // East/West
uint16_t gpsLatitudeNS; // North/South uint16_t gpsLatitudeNS; // North/South
int16_t accelX; // 1/256th gram (-8g ~ +8g) int16_t accelX; // 1/256th gram (-8g ~ +8g)
@ -109,7 +109,8 @@ struct FrskyHubData {
// 17 spares // 17 spares
uint16_t volts_bp; uint16_t volts_bp;
uint16_t volts_ap; uint16_t volts_ap;
uint16_t maxGpsSpeed; // spare reused // end of FrSky Hub data
uint16_t maxGpsSpeed;
}; };
#elif defined(WS_HOW_HIGH) #elif defined(WS_HOW_HIGH)

View file

@ -208,9 +208,9 @@ void lcd_outdez8(uint8_t x, uint8_t y, int8_t val)
lcd_outdezAtt(x, y, val); lcd_outdezAtt(x, y, val);
} }
void lcd_outdezAtt(uint8_t x, uint8_t y, int16_t val, uint8_t mode) void lcd_outdezAtt(uint8_t x, uint8_t y, int16_t val, uint8_t flags)
{ {
lcd_outdezNAtt(x, y, val, mode); lcd_outdezNAtt(x, y, val, flags);
} }
// TODO use doxygen style comments here // TODO use doxygen style comments here
@ -301,6 +301,14 @@ void lcd_outdezNAtt(uint8_t x, uint8_t y, int16_t val, uint8_t flags, uint8_t le
// TODO we could change the '-' to have one pixel removed at its left // TODO we could change the '-' to have one pixel removed at its left
if (neg) { lcd_putcAtt(x, y, '-', flags); lcd_plot(x, y+3); } if (neg) { lcd_putcAtt(x, y, '-', flags); lcd_plot(x, y+3); }
#ifdef NAVIGATION_RE1
if (flags & SURROUNDED) {
xn = lcd_lastPos - x + 2;
if (!neg) { x+=FW; xn-=FW; }
lcd_rect(x-1, y-1, xn, 9, BLINK_ON_PHASE ? DOTTED : ~DOTTED);
}
#endif
} }
void lcd_mask(uint8_t *p, uint8_t mask, uint8_t att) void lcd_mask(uint8_t *p, uint8_t mask, uint8_t att)

View file

@ -225,6 +225,17 @@ void menuMainView(uint8_t event)
instantTrimSwLock = true; instantTrimSwLock = true;
trim2OfsSwLock = true; trim2OfsSwLock = true;
break; break;
#ifdef NAVIGATION_RE1
case EVT_KEY_LONG(BTN_RE1):
if (s_inflight_value && !s_warning) {
s_warning = s_inflight_label;
break;
}
// no break
case EVT_KEY_BREAK(BTN_RE1):
s_warning = NULL;
break;
#endif
} }
bool trimSw = isFunctionActive(FUNC_INSTANT_TRIM); bool trimSw = isFunctionActive(FUNC_INSTANT_TRIM);
@ -575,5 +586,11 @@ void menuMainView(uint8_t event)
// lcd_outdezNAtt(33+11*FW, FH*6, s_timerVal_10ms[1], LEADING0, 2); // 1/100s // lcd_outdezNAtt(33+11*FW, FH*6, s_timerVal_10ms[1], LEADING0, 2); // 1/100s
} }
#ifdef NAVIGATION_RE1
if (s_warning) {
displayBox();
}
#endif
theFile.DisplayProgressBar(20*FW+1); theFile.DisplayProgressBar(20*FW+1);
} }

View file

@ -465,19 +465,39 @@ void pushMenu(MenuFuncP newMenu)
(*newMenu)(EVT_ENTRY); (*newMenu)(EVT_ENTRY);
} }
const pm_char * s_warning = 0;
void displayBox()
{
lcd_filled_rect(10, 16, 108, 40, SOLID, WHITE);
lcd_rect(10, 16, 108, 40);
lcd_puts(16, 3*FH, s_warning);
// could be a place for a s_warning_info
}
#ifdef NAVIGATION_RE1 #ifdef NAVIGATION_RE1
void * s_inflight_value; int8_t *s_inflight_value = NULL;
int16_t s_inflight_min; int16_t s_inflight_min;
int16_t s_inflight_max; int16_t s_inflight_max;
int16_t s_inflight_shift;
const pm_char *s_inflight_label; 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) void checkInFlightIncDecModel(uint8_t event, int8_t *value, int16_t i_min, int16_t i_max, int8_t i_shift, const pm_char *label)
{ {
s_inflight_value = value; *value = i_shift + checkIncDecModel(event, (*value)-i_shift, i_min, i_max);
s_inflight_min = i_min;
s_inflight_max = i_max; if (event == EVT_KEY_LONG(BTN_RE1)) {
s_inflight_label = label; if (value == s_inflight_value) {
s_inflight_flags = flags; s_inflight_value = NULL;
}
else {
s_inflight_value = value;
s_inflight_min = i_min;
s_inflight_max = i_max;
s_inflight_shift = i_shift;
s_inflight_label = label;
}
}
} }
#endif #endif

View file

@ -107,6 +107,18 @@ int8_t checkIncDecGen(uint8_t event, int8_t i_val, int8_t i_min, int8_t i_max);
#define CHECK_INCDEC_GENVAR( event, var, min, max) \ #define CHECK_INCDEC_GENVAR( event, var, min, max) \
var = checkIncDecGen(event,var,min,max) var = checkIncDecGen(event,var,min,max)
#ifdef NAVIGATION_RE1
extern int8_t *s_inflight_value;
#define INFLIGHT(val) (s_inflight_value==&val ? SURROUNDED : 0)
void checkInFlightIncDecModel(uint8_t event, int8_t *value, int16_t i_min, int16_t i_max, int8_t i_shift, const pm_char *label);
#define CHECK_INFLIGHT_INCDEC_MODELVAR(event, var, imin, imax, ishift, label) \
checkInFlightIncDecModel(event, &var, imin, imax, ishift, label)
#else
#define INFLIGHT(val) 0
#define CHECK_INFLIGHT_INCDEC_MODELVAR(event, var, min, max, shift, label) \
var = shift+checkIncDecModel(event,var-shift,min,max)
#endif
// Menus related stuff ... // Menus related stuff ...
#ifdef NAVIGATION_RE1 #ifdef NAVIGATION_RE1
extern int8_t m_posVert; extern int8_t m_posVert;
@ -148,4 +160,8 @@ if (!check_submenu_simple(event,lines_count-1)) return;
TITLE(title); \ TITLE(title); \
SIMPLE_SUBMENU_NOTITLE(lines_count) SIMPLE_SUBMENU_NOTITLE(lines_count)
extern const pm_char * s_warning;
// TODO macro for s_warning
void displayBox();
#endif #endif

View file

@ -99,19 +99,11 @@ const MenuFuncP_PROGMEM menuTabModel[] PROGMEM = {
#endif #endif
}; };
const pm_char * s_warning = 0;
const pm_char * s_warning_info;
uint8_t s_warning_info_len;
// uint8_t s_warning_info_att not needed now
uint8_t s_confirmation = 0;
void displayBox() const pm_char * s_warning_info;
{ uint8_t s_warning_info_len;
lcd_filled_rect(10, 16, 108, 40, SOLID, WHITE); // uint8_t s_warning_info_att not needed now
lcd_rect(10, 16, 108, 40); uint8_t s_confirmation = 0;
lcd_puts(16, 3*FH, s_warning);
// could be a place for a s_warning_info
}
void displayPopup(const pm_char * pstr) void displayPopup(const pm_char * pstr)
{ {
@ -1603,20 +1595,15 @@ void menuProcLimits(uint8_t event)
} }
break; break;
case 1: case 1:
lcd_outdezAtt( 12*FW, y, (int8_t)(ld->min-100), attr); lcd_outdezAtt(12*FW, y, (int8_t)(ld->min-100), attr | INFLIGHT(ld->min));
if (active) { if (active) {
ld->min -= 100; CHECK_INFLIGHT_INCDEC_MODELVAR(event, ld->min, -limit, limit, +100, STR_MINLIMIT);
CHECK_INCDEC_MODELVAR( event, ld->min, -limit, limit);
ld->min += 100;
// CHECK_INFLIGHT_INCDEC(ld->min, -125, 125, PSTR("Min Limit"), EE_MODEL);
} }
break; break;
case 2: case 2:
lcd_outdezAtt( 17*FW, y, (int8_t)(ld->max+100), attr); lcd_outdezAtt(17*FW, y, (int8_t)(ld->max+100), attr | INFLIGHT(ld->max));
if (active) { if (active) {
ld->max += 100; CHECK_INFLIGHT_INCDEC_MODELVAR(event, ld->max, -limit, limit, -100, STR_MAXLIMIT);
CHECK_INCDEC_MODELVAR( event, ld->max, -limit, limit);
ld->max -= 100;
} }
break; break;
case 3: case 3:

View file

@ -273,4 +273,6 @@ const pm_char STR_SYNCMENU[] PROGMEM = TR_SYNCMENU;
#if defined(NAVIGATION_RE1) #if defined(NAVIGATION_RE1)
const pm_char STR_BACK[] PROGMEM = TR_BACK; const pm_char STR_BACK[] PROGMEM = TR_BACK;
const pm_char STR_MINLIMIT[] PROGMEM = TR_MINLIMIT;
const pm_char STR_MAXLIMIT[] PROGMEM = TR_MAXLIMIT;
#endif #endif

View file

@ -327,5 +327,6 @@ extern const pm_char STR_RXNUM[];
extern const pm_char STR_SYNCMENU[]; extern const pm_char STR_SYNCMENU[];
extern const pm_char STR_BACK[]; extern const pm_char STR_BACK[];
#define LEN_BACK PSIZE(TR_BACK) #define LEN_BACK PSIZE(TR_BACK)
extern const pm_char STR_MINLIMIT[];
extern const pm_char STR_MAXLIMIT[];
#endif #endif

View file

@ -298,3 +298,5 @@
#define TR_RXNUM "RxNum" #define TR_RXNUM "RxNum"
#define TR_SYNCMENU "Sync [MENU]" #define TR_SYNCMENU "Sync [MENU]"
#define TR_BACK "Back" #define TR_BACK "Back"
#define TR_MINLIMIT "Min Limit"
#define TR_MAXLIMIT "Max Limit"

View file

@ -298,3 +298,5 @@
#define TR_RXNUM "RxNum" #define TR_RXNUM "RxNum"
#define TR_SYNCMENU "Sync [MENU]" #define TR_SYNCMENU "Sync [MENU]"
#define TR_BACK "Back" #define TR_BACK "Back"
#define TR_MINLIMIT "Min Limit"
#define TR_MAXLIMIT "Max Limit"