Inflight parameters modification.

Last Telemetry parameters still displayed even if NO DATA (after something has been received)
This commit is contained in:
bsongis
2012-02-19 23:08:01 +00:00
parent 6cd32e7bd6
commit f71eb46023
5 changed files with 43 additions and 15 deletions
+1 -1
View File
@@ -52,7 +52,7 @@ uint8_t frskyRxBuffer[FRSKY_RX_PACKET_SIZE]; // Receive buffer. 9 bytes (full
uint8_t frskyTxBuffer[FRSKY_TX_PACKET_SIZE]; // Ditto for transmit buffer
uint8_t frskyTxBufferCount = 0;
uint8_t FrskyRxBufferReady = 0;
uint8_t frskyStreaming = 0;
int8_t frskyStreaming = -1;
uint8_t frskyUsrStreaming = 0;
FrskyData frskyTelemetry[2];
+1 -1
View File
@@ -128,7 +128,7 @@ extern uint8_t barsThresholds[BAR_MAX-3];
#endif
// Global Fr-Sky telemetry data variables
extern uint8_t frskyStreaming; // >0 (true) == data is streaming in. 0 = nodata detected for some time
extern int8_t frskyStreaming; // >0 (true) == data is streaming in. 0 = nodata detected for some time
extern uint8_t frskyUsrStreaming;
#define SEND_MODEL_ALARMS 6
+14 -2
View File
@@ -197,6 +197,11 @@ void menuMainView(uint8_t event)
if(s_timerState[0]==TMR_BEEPING) {
s_timerState[0] = TMR_STOPPED;
}
#ifdef NAVIGATION_RE1
else if (s_warning) {
s_warning = NULL;
}
#endif
else if (view == e_timer2) {
resetTimer(1);
}
@@ -227,8 +232,10 @@ void menuMainView(uint8_t event)
break;
#ifdef NAVIGATION_RE1
case EVT_KEY_LONG(BTN_RE1):
killEvents(event);
if (s_inflight_value && !s_warning) {
s_warning = s_inflight_label;
s_editMode = 1;
break;
}
// no break
@@ -247,7 +254,7 @@ void menuMainView(uint8_t event)
trim2OfsSwLock = trimSw;
#ifdef FRSKY
if (view_base == e_telemetry && frskyStreaming && view > ALTERNATE_VIEW) {
if (view_base == e_telemetry && frskyStreaming >= 0 && view > ALTERNATE_VIEW) {
putsModelName(0, 0, g_model.name, g_eeGeneral.currModel, 0);
uint8_t att = (g_vbat100mV < g_eeGeneral.vBatWarn ? BLINK : 0);
putsVBat(14*FW,0,att);
@@ -381,7 +388,7 @@ void menuMainView(uint8_t event)
}
#if defined(FRSKY)
else if (view_base == e_telemetry) {
if (frskyStreaming) {
if (frskyStreaming >= 0) {
uint8_t y0, x0, blink;
if (view == e_telemetry+ALTERNATE_VIEW) {
@@ -587,8 +594,13 @@ void menuMainView(uint8_t event)
}
#ifdef NAVIGATION_RE1
check_rotary_encoder();
if (s_warning) {
if (p1valdiff) {
*s_inflight_value = s_inflight_shift + checkIncDecModel(event, (*s_inflight_value)-s_inflight_shift, s_inflight_min, s_inflight_max);
}
displayBox();
lcd_outdezAtt(16, 4*FH, (int8_t)(*s_inflight_value-s_inflight_shift), LEFT);
}
#endif
+25 -11
View File
@@ -150,6 +150,23 @@ bool check_submenu_simple(uint8_t event, uint8_t maxrow)
return check_simple(event, 0, 0, 0, maxrow);
}
#ifdef NAVIGATION_RE1
void check_rotary_encoder()
{
// check rotary encoder 1 if changed -> cursor down/up
static int16_t re1valprev;
p1valdiff = 0;
scrollRE = re1valprev - g_rotenc[0];
if (scrollRE) {
re1valprev = g_rotenc[0];
if (s_editMode > 0) {
p1valdiff = -scrollRE;
scrollRE = 0;
}
}
}
#endif
#define SCROLL_TH 64
#define SCROLL_POT1_TH 32
@@ -165,17 +182,7 @@ bool check(uint8_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTa
int8_t maxcol = MAXCOL(m_posVert);
#ifdef NAVIGATION_RE1
// check rotary encoder 1 if changed -> cursor down/up
static int16_t re1valprev;
p1valdiff = 0;
scrollRE = re1valprev - g_rotenc[0];
if (scrollRE) {
re1valprev = g_rotenc[0];
if (s_editMode > 0) {
p1valdiff = -scrollRE;
scrollRE = 0;
}
}
check_rotary_encoder();
if (m_posVert < 0 && (event==EVT_KEY_FIRST(BTN_RE1) || event==EVT_KEY_FIRST(KEY_MENU))) {
popMenu();
killEvents(event);
@@ -444,6 +451,9 @@ void popMenu()
void chainMenu(MenuFuncP newMenu)
{
#ifdef NAVIGATION_RE1
s_warning = NULL;
#endif
g_menuStack[g_menuStackPtr] = newMenu;
(*newMenu)(EVT_ENTRY);
AUDIO_MENUS();
@@ -451,6 +461,10 @@ void chainMenu(MenuFuncP newMenu)
void pushMenu(MenuFuncP newMenu)
{
#ifdef NAVIGATION_RE1
s_warning = NULL;
#endif
g_menuPos[g_menuStackPtr] = m_posVert;
g_menuStackPtr++;
+2
View File
@@ -109,10 +109,12 @@ int8_t checkIncDecGen(uint8_t event, int8_t i_val, int8_t i_min, int8_t i_max);
#ifdef NAVIGATION_RE1
extern int8_t *s_inflight_value;
extern const pm_char *s_inflight_label;
#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)
void check_rotary_encoder();
#else
#define INFLIGHT(val) 0
#define CHECK_INFLIGHT_INCDEC_MODELVAR(event, var, min, max, shift, label) \