Commit 082a9422 authored by Pavel Semerad's avatar Pavel Semerad
Browse files

added globally settable long-press delay

parent e12b819d
*0.3.0 ()
added globally settable key long-press delay
*0.2.0 (9 Jun 2011)
added 4WS mix
......
......@@ -188,6 +188,7 @@ Global setup menu:
1 dead zone for steering 0...50
2 dead zone for throttle 0...50
b key beep OFF/ON
d long press key delay 100...1000ms
r + ALL global reset - change to YES to set global configuration
and all models to default values
r + MOD all models reset - change to YES to set all models
......
add multi-position
select channel
for each positions set from range -100%..100%
? max number of positions
settable to keys and trims
trims
longer beep at centre
short pause at centre, ignore the same key for some time
2-state keys
add possibility of set value/return to previous value
add DIG as key function, also for SWItch allow set reverse
trims
longer beep at centre
short pause at centre, ignore the same key for some time
when momentary, add possibility return to previous value
MOMentary trims/keys
change value only when state of button change
globally settable long-press time for all keys
add multi-position
select channel
for each positions set from range -100%..100%
max number of positions -> 8
settable to keys and trims
? not so smooth servo travel
......
......@@ -50,6 +50,7 @@ u8 config_global_set_default(void) {
cg.battery_calib = 672;
cg.battery_low = 92; // 9.2 V
cg.endpoint_max = 120;
cg.long_press_delay = (1000 / 5); // 1sec
cg.inactivity_alarm = 0;
cg.key_beep = 1;
......
......@@ -31,7 +31,7 @@
// change MAGIC number when changing global config
// also add code to setting default values
// 28 bytes
#define CONFIG_GLOBAL_MAGIC 0xfb04
#define CONFIG_GLOBAL_MAGIC 0xfa05
typedef struct {
u8 steering_dead_zone;
u8 throttle_dead_zone;
......@@ -47,7 +47,8 @@ typedef struct {
u8 model; // selected model
u16 battery_calib; // raw ADC value for 10 Volts
u8 battery_low; // low battery threshold in .1 Volts
u8 endpoint_max;
u8 endpoint_max; // max allowed endpoint value (def 120%)
u8 long_press_delay; // long press delay in 5ms steps
u8 inactivity_alarm:4; // time (min) of inactivity warning
u8 key_beep:1;
} config_global_s;
......
......@@ -30,7 +30,6 @@
// autorepeat/long press times in 5ms steps
#define BTN_AUTOREPEAT_DELAY (500 / 5)
#define BTN_AUTOREPEAT_RATE (70 / 5)
#define BTN_LONG_PRESS_DELAY (1000 / 5)
#define ENCODER_FAST_THRESHOLD 10
......@@ -218,7 +217,7 @@ static void read_keys(void) {
// last not pressed
if (bs) {
// now pressed, set long press delay
buttons_timer[i] = BTN_LONG_PRESS_DELAY;
buttons_timer[i] = cg.long_press_delay;
}
// do nothing for now not pressed
}
......
......@@ -177,6 +177,18 @@ static void gs_key_beep(u8 change) {
}
static void gs_long_press_delay(u8 change) {
u8 *addr = &cg.long_press_delay;
if (change == 0xff) {
lcd_set(L7SEG, LB_EMPTY);
return;
}
if (change) *addr = (u8)menu_change_val(*addr, 20, 200, 5, 0);
lcd_7seg(L7_D);
lcd_char_num3(*addr * 5);
}
static void gs_steering_dead(u8 change) {
u8 *addr = &cg.steering_dead_zone;
if (change == 0xff) {
......@@ -252,6 +264,7 @@ static const global_setup_t gs_config[] = {
gs_steering_dead,
gs_throttle_dead,
gs_key_beep,
gs_long_press_delay,
gs_reset_all,
gs_reset_model_all,
};
......
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