Commit 9ef67ec9 authored by Pavel Semerad's avatar Pavel Semerad
Browse files

added key function BLS to shutup battery low beeper

parent 0235b13f
......@@ -10,6 +10,8 @@
added poweron beep, can be set ON/OFF in global config
inactivity timer compares ADC values with previous ones, so now
it will activate when radio is not center callibrated also
added key function BLS to shutup battery low beeper, by default is
assigned to END-long
*0.4.1 (17 Aug 2011)
......
......@@ -295,4 +295,5 @@ 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
BLS - battery low shutup, stop beeping, predefined to END-long
......@@ -6,8 +6,6 @@ CALC - calc at end of SYNC signal
without PPM pulse, after that activate CALC
- maybe constant length servo pulse
shut-off low-battery beeping
timer
- up/down/lap
- ignore lap button after press for 3 seconds to eliminate double clicks
......
......@@ -76,7 +76,7 @@ static const config_key_mapping_s default_key_mapping = {
{
{ 0, 0, 0, 0, 0, 0, 0, 0 }, // CH3 to nothing
{ 0, 0, 0, 0, 0, 0, 0, 0 }, // BACK to nothing
{ 0, 0, 0, 0, 0, 0, 0, 0 } // END to nothing
{ 0, 0, 0, 0, 20, 0, 0, 0 } // END-long to battery low shutup
},
// trims: function, reverse, step, buttons
{
......
......@@ -147,12 +147,14 @@ static void show_model_number(u8 model) {
// menu stop - checks low battery
_Bool battery_low_shutup;
void menu_stop(void) {
static _Bool battery_low_on;
stop();
// low_bat is disabled in calibrate, key-test and global menus,
// check it by buzzer_running
if (menu_battery_low && !buzzer_running) battery_low_on = 0;
if (menu_battery_low && !buzzer_running && !battery_low_shutup)
battery_low_on = 0;
if (battery_low_on == menu_battery_low) return; // no change
// battery low status changed
......
......@@ -83,6 +83,7 @@ extern u8 menu_lap_count; // lap count
extern _Bool menu_wants_adc;
// flag low battery voltage
extern _Bool menu_battery_low;
extern _Bool battery_low_shutup; // stop bat low beeping
// raw battery ADC value for check to battery low
extern u16 battery_low_raw;
// don't stop main loop and check keys
......
......@@ -310,6 +310,7 @@ void menu_global_setup(void) {
buzzer_off();
key_beep();
menu_battery_low = 0; // it will be set automatically again
battery_low_shutup = 0;
backlight_set_default(BACKLIGHT_MAX);
backlight_on();
lcd_clear();
......
......@@ -728,6 +728,12 @@ static void kf_lap_count_reset(u8 *id, u8 *param, u8 flags, s16 *pv) {
menu_main_screen = MS_LAP_COUNT;
}
// shut up battery low beeper
static void kf_battery_low_shutup(u8 *id, u8 *param, u8 flags, s16 *pv) {
battery_low_shutup = 1;
buzzer_off();
}
......@@ -763,6 +769,7 @@ static const key_functions_s key_functions[] = {
{ 15, "DGR", KF_NONE, kf_reset, "DIG" },
{ 18, "LCI", KF_NOSHOW, kf_lap_count, NULL },
{ 19, "LCR", KF_NOSHOW, kf_lap_count_reset, NULL },
{ 20, "BLS", KF_NOSHOW, kf_battery_low_shutup, NULL }, // default END-long
};
#define KEY_FUNCTIONS_SIZE (sizeof(key_functions) / sizeof(key_functions_s))
......
......@@ -47,6 +47,7 @@ void menu_calibrate(u8 at_poweron) {
if (at_poweron) buzzer_on(30, 30, 2);
else key_beep();
menu_battery_low = 0; // it will be set automatically again
battery_low_shutup = 0;
backlight_set_default(BACKLIGHT_MAX);
backlight_on();
lcd_clear();
......@@ -223,6 +224,7 @@ void menu_key_test(void) {
buzzer_off();
key_beep();
menu_battery_low = 0; // it will be set automatically again
battery_low_shutup = 0;
// do full screen blink
lcd_set_full_on();
......
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