Commit 26be26de authored by Pavel Semerad's avatar Pavel Semerad
Browse files

added lap count functions

parent 24edf8ab
......@@ -5,6 +5,7 @@
CH3 key set default to OFF
added DGR key function to reset DIG mix to centre
added posibility to select DIG instead of channel number at MultiPosition
added lap count functions assignable to keys
*0.4.0 (18 Jul 2011)
......
......@@ -233,6 +233,16 @@ Global setup menu:
to default values
Main screens:
=============
- changeable by rotate encoder:
model name
battery voltage
lap count - identified by "%" sign
Return to original (and modified) firmware:
===========================================
......@@ -281,4 +291,6 @@ DIG - switch DIG mix between -100 and 100 (more useable when using
DGR - reset DIG mix to centre
MPO - Multi-POsition, switches position up (at END back to 1.)
MPR - Multi-Position Reset, switches position to first one
LCI - increment lap count
LCR - set lap count to zero
......@@ -48,6 +48,11 @@ u8 menu_MP_index; // index of MultiPosition channel
//
u8 menu_lap_count; // lap count
// flags for wakeup after each ADC measure
_Bool menu_wants_adc;
......@@ -172,9 +177,6 @@ void menu_stop(void) {
// show main screen (model number and name/battery/...)
#define MS_NAME 0
#define MS_BATTERY 1
#define MS_MAX 2
static void main_screen(u8 item) {
lcd_segment(LS_SYM_MODELNO, LS_ON);
lcd_segment(LS_SYM_CHANNEL, LS_OFF);
......@@ -205,6 +207,12 @@ static void main_screen(u8 item) {
lcd_char_num3(bat_val);
menu_wants_adc = 1;
}
else if (item == MS_LAP_COUNT) {
lcd_segment(LS_SYM_DOT, LS_OFF);
lcd_segment(LS_SYM_VOLTS, LS_OFF);
lcd_segment(LS_SYM_PERCENT, LS_ON);
lcd_char_num3(menu_lap_count);
}
lcd_update();
}
......@@ -728,14 +736,15 @@ static void select_menu(void) {
// ****************** MAIN LOOP and init *********************************
// main menu loop, shows main screen and handle keys
u8 menu_main_screen;
static void menu_loop(void) {
u8 item = MS_NAME;
menu_main_screen = MS_NAME;
lcd_clear();
while (1) {
if (!menu_check_keys) {
main_screen(item);
main_screen(menu_main_screen);
btnra();
menu_stop();
}
......@@ -771,11 +780,11 @@ static void menu_loop(void) {
// rotate encoder - change model name/battery/...
else if (btn(BTN_ROT_ALL)) {
if (btn(BTN_ROT_L)) {
if (item) item--;
else item = MS_MAX - 1;
if (menu_main_screen) menu_main_screen--;
else menu_main_screen = MS_MAX - 1;
}
else {
if (++item >= MS_MAX) item = 0;
if (++menu_main_screen >= MS_MAX) menu_main_screen = 0;
}
}
}
......
......@@ -68,6 +68,9 @@ extern s8 menu_DIG_mix; // mix -100..100
extern u8 menu_MP_index; // index of MultiPosition channel
//
extern u8 menu_lap_count; // lap count
......@@ -112,6 +115,11 @@ extern void menu_mix(void);
extern void menu_key_mapping(void);
extern void menu_key_mapping_prepare(void);
extern void menu_buttons_initialize(void);
extern u8 menu_main_screen;
#define MS_NAME 0
#define MS_BATTERY 1
#define MS_LAP_COUNT 2
#define MS_MAX 3
#endif
......
......@@ -705,6 +705,16 @@ static void kf_multi_position_reset(u8 *id, u8 *param, u8 flags, s16 *pv) {
}
}
// lap counter
static void kf_lap_count(u8 *id, u8 *param, u8 flags, s16 *pv) {
menu_lap_count++;
menu_main_screen = MS_LAP_COUNT;
}
static void kf_lap_count_reset(u8 *id, u8 *param, u8 flags, s16 *pv) {
menu_lap_count = 0;
menu_main_screen = MS_LAP_COUNT;
}
......@@ -738,6 +748,8 @@ static const key_functions_s key_functions[] = {
{ 16, "MPO", KF_NONE, kf_multi_position, NULL },
{ 17, "MPR", KF_NONE, kf_multi_position_reset, NULL },
{ 15, "DGR", KF_NONE, kf_reset, "DIG" },
{ 18, "LCI", KF_NOSHOW, kf_lap_count, NULL },
{ 19, "LCR", KF_NOSHOW, kf_lap_count_reset, NULL },
};
#define KEY_FUNCTIONS_SIZE (sizeof(key_functions) / sizeof(key_functions_s))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment