Commit f684e9ae authored by Pavel Semerad's avatar Pavel Semerad
Browse files

version 0.3.0; corected NPV/PRV; changed RES->ORS; ignore long key press when...

version 0.3.0; corected NPV/PRV; changed RES->ORS; ignore long key press when momentary popup; set default key states corrected;
parent d8d78e3f
......@@ -6,7 +6,7 @@
momentary trims/keys now sets value only when state of buttons changed
(previously it always forced value to reflect button state), so it is
possible to map momentary and non-momentary keys to the same
channel/mix value
channel/mix value, also value is showed when changed
added possibility for momentary trims and 2-state keys to return not
to centre/left, but to previous value which was active before button
press
......
......@@ -122,7 +122,7 @@ Standard menu:
REV - swap left/right trim keys
- opposite_reset: not available when buttons MOM
NOO - no change
RES - when trim key is pressed and value is at opposite
ORS - when trim key is pressed and value is at opposite
side of centre/reset, set value to centre/reset,
- previous_val: available only when buttons MOM
NPV - no change
......
......@@ -54,6 +54,8 @@ _Bool menu_wants_adc;
_Bool menu_battery_low;
// raw battery ADC value for check to battery low
u16 battery_low_raw;
// don't stop main loop and check keys
u8 menu_check_keys;
......@@ -712,14 +714,16 @@ static void menu_loop(void) {
lcd_clear();
while (1) {
main_screen(item);
btnra();
menu_stop();
if (!menu_check_keys) {
main_screen(item);
btnra();
menu_stop();
// don't wanted in submenus, will be set back in main_screen()
menu_wants_adc = 0;
// don't wanted in submenus, will be set back in main_screen()
menu_wants_adc = 0;
}
else menu_check_keys = 0;
check_keys:
// Enter long key - global/calibrate/key-test
if (btnl(BTN_ENTER)) {
if (adc_steering_ovs > (CALIB_ST_MID_HIGH << ADC_OVS_SHIFT))
......@@ -737,11 +741,11 @@ static void menu_loop(void) {
// electronic trims
else if (menu_electronic_trims())
goto check_keys;
menu_check_keys = 1;
// buttons (CH3, Back, End)
else if (menu_buttons())
goto check_keys;
menu_check_keys = 1;
// rotate encoder - change model name/battery/...
else if (btn(BTN_ROT_ALL)) {
......
......@@ -81,6 +81,8 @@ extern _Bool menu_wants_adc;
extern _Bool menu_battery_low;
// raw battery ADC value for check to battery low
extern u16 battery_low_raw;
// don't stop main loop and check keys
extern u8 menu_check_keys;
......
......@@ -48,7 +48,7 @@ static const u8 *trim_buttons[] = {
// 7seg: 1 2 3 d
// chars:
// function
// OFF (NOR/REV) (NOO/RES) (NPV/PRV)
// OFF (NOR/REV) (NOO/ORS) (NPV/PRV)
// other -> buttons
// MOM -> reverse -> prev_val
// NOL/RPT/RES/END -> step -> reverse -> opp_reset
......@@ -149,13 +149,13 @@ static u8 km_trim(u8 trim_id, u8 val_id, u8 action) {
lcd_segment(LS_SYM_VOLTS, LS_ON);
break;
case 5:
lcd_chars(etm->opposite_reset ? "RES" : "NOO");
lcd_chars(etm->opposite_reset ? "ORS" : "NOO");
lcd_segment(LS_SYM_PERCENT, LS_OFF);
lcd_segment(LS_SYM_VOLTS, LS_ON);
lcd_segment_blink(LS_SYM_VOLTS, LB_SPC);
break;
case 6:
lcd_chars(etm->previous_val ? "NPV" : "PRV");
lcd_chars(etm->previous_val ? "PRV" : "NPV");
lcd_segment(LS_SYM_PERCENT, LS_ON);
lcd_segment(LS_SYM_VOLTS, LS_OFF);
lcd_segment_blink(LS_SYM_PERCENT, LB_SPC);
......@@ -314,7 +314,7 @@ static u8 km_key(u8 key_id, u8 val_id, u8 action) {
break;
case 4:
// previous_val
lcd_chars(km->previous_val ? "NPV" : "PRV");
lcd_chars(km->previous_val ? "PRV" : "NPV");
lcd_segment(LS_SYM_PERCENT, LS_ON);
lcd_segment(LS_SYM_VOLTS, LS_OFF);
lcd_segment_blink(LS_SYM_PERCENT, LB_SPC);
......@@ -333,7 +333,7 @@ static u8 km_key(u8 key_id, u8 val_id, u8 action) {
break;
case 7:
// previous_val_long
lcd_chars(km->previous_val_long ? "NPV" : "PRV");
lcd_chars(km->previous_val_long ? "PRV" : "NPV");
lcd_segment(LS_SYM_PERCENT, LS_ON);
lcd_segment(LS_SYM_VOLTS, LS_OFF);
lcd_segment_blink(LS_SYM_PERCENT, LB_SPC);
......
......@@ -49,6 +49,7 @@ static @near u8 menu_buttons_state[NUM_KEYS + 2 * NUM_TRIMS];
// set state of buttons to do initialize
void menu_buttons_initialize(void) {
memset(menu_buttons_state, MBS_INITIALIZE, NUM_KEYS + 2 * NUM_TRIMS);
menu_check_keys = 1;
}
......@@ -310,7 +311,7 @@ static u8 menu_popup_et(u8 trim_id) {
// sleep 5s, and if no button was changed during, end this screen
delay_time = POPUP_DELAY * 200;
while (delay_time && !buttons &&
while (delay_time && !(buttons & ~btn_lr) &&
(buttons_state == buttons_state_last))
delay_time = delay_menu(delay_time);
......@@ -730,10 +731,11 @@ static u8 menu_popup_key(u8 key_id) {
// call function to set value and show it
flags |= FF_SHOW;
kf->func(kf->name, kf->param, flags, pv);
lcd_update();
// sleep 5s, and if no button was changed during, end this screen
delay_time = POPUP_DELAY * 200;
while (delay_time && !buttons &&
while (delay_time && !(buttons & ~btnx) &&
(buttons_state == buttons_state_last))
delay_time = delay_menu(delay_time);
......
......@@ -21,7 +21,7 @@
#define _VERSION_INCLUDED
#define VERSION "021"
#define VERSION "030"
#endif
......
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