Commit 0a1e5083 authored by Pavel Semerad's avatar Pavel Semerad
Browse files

added poweron beep, repaired inactivity alarm

parent 6d6d7422
......@@ -7,6 +7,7 @@
after poweron, if steering or throttle are not in center dead zone,
show calibration screen, because recalibration will be probably
needed
added poweron beep, can be set ON/OFF in global config
*0.4.1 (17 Aug 2011)
......
......@@ -227,6 +227,7 @@ Global setup menu:
2 dead zone for throttle 0...50
b key beep OFF/ON
C center/reset beep OFF/ON
P poweron beep OFF/ON
d long press key delay 100...1000 miliseconds
r + ALL global reset - change to YES to set global configuration
and all models to default values
......
......@@ -6,7 +6,6 @@ CALC - calc at end of SYNC signal
without PPM pulse, after that activate CALC
- maybe constant length servo pulse
beep at startup - switchable at global config
check inactivity as compare to previous value and not center value
shut-off low-battery beeping
......
......@@ -54,6 +54,7 @@ u8 config_global_set_default(void) {
cg.inactivity_alarm = 0;
cg.key_beep = 1;
cg.reset_beep = 1;
cg.poweron_beep = 1;
cg.unused = 0;
// set calibrate values only when they are out of limits
......
......@@ -52,7 +52,8 @@ typedef struct {
u8 inactivity_alarm:4; // time (min) of inactivity warning
u8 key_beep:1; // beep on key press
u8 reset_beep:1; // beep on center/reset value
u8 unused:2;
u8 poweron_beep:1; // beep on power on
u8 unused:1;
} config_global_s;
extern config_global_s config_global;
......
......@@ -756,7 +756,7 @@ static void menu_loop(void) {
// Enter long key - global/calibrate/key-test
if (btnl(BTN_ENTER)) {
if (adc_steering_ovs > (CALIB_ST_MID_HIGH << ADC_OVS_SHIFT))
menu_calibrate();
menu_calibrate(0);
else if (adc_steering_ovs < (CALIB_ST_LOW_MID << ADC_OVS_SHIFT))
menu_key_test();
else menu_global_setup();
......@@ -804,9 +804,13 @@ void menu_init(void) {
adc_steering_last < (cg.calib_steering_mid - cg.steering_dead_zone) ||
adc_steering_last > (cg.calib_steering_mid + cg.steering_dead_zone) ||
adc_throttle_last < (cg.calib_throttle_mid - cg.throttle_dead_zone) ||
adc_throttle_last > (cg.calib_throttle_mid + cg.throttle_dead_zone))
menu_calibrate();
adc_throttle_last > (cg.calib_throttle_mid + cg.throttle_dead_zone)) {
menu_calibrate(1);
btnra();
}
else if (cg.poweron_beep) beep(30);
apply_global_config();
reset_inactivity_timer();
// read model config from eeprom, but not awake CALC yet
menu_load_model();
......
......@@ -92,7 +92,7 @@ extern u8 menu_check_keys;
// internal functions, used in split menu files
extern void menu_stop(void);
extern void menu_calibrate(void);
extern void menu_calibrate(u8 at_poweron);
extern void menu_key_test(void);
extern void menu_global_setup(void);
extern s16 menu_change_val(s16 val, s16 min, s16 max, u8 amount_fast, u8 rotate);
......
......@@ -189,6 +189,18 @@ static void gs_reset_beep(u8 change) {
}
static void gs_poweron_beep(u8 change) {
if (change == 0xff) {
lcd_set(L7SEG, LB_EMPTY);
return;
}
if (change) cg.poweron_beep ^= 1;
lcd_7seg(L7_P);
if (cg.poweron_beep) lcd_chars("ON ");
else lcd_chars("OFF");
}
static void gs_long_press_delay(u8 change) {
u8 *addr = &cg.long_press_delay;
if (change == 0xff) {
......@@ -277,6 +289,7 @@ static const global_setup_t gs_config[] = {
gs_throttle_dead,
gs_key_beep,
gs_reset_beep,
gs_poweron_beep,
gs_long_press_delay,
gs_reset_all,
gs_reset_model_all,
......
......@@ -31,7 +31,7 @@
// calibrate menu
void menu_calibrate(void) {
void menu_calibrate(u8 at_poweron) {
u8 channel = 1;
u16 last_val = 0xffff;
u16 val;
......@@ -44,7 +44,8 @@ void menu_calibrate(void) {
// cleanup screen and disable possible low bat warning
buzzer_off();
key_beep();
if (at_poweron) buzzer_on(30, 30, 2);
else key_beep();
menu_battery_low = 0; // it will be set automatically again
backlight_set_default(BACKLIGHT_MAX);
backlight_on();
......
......@@ -44,7 +44,7 @@ void timer_init(void) {
TIM2_ARRL = lo8(TIMER_1MS - 1);
TIM2_CR1 = 0b00000101; // URS-overflow, enable
inactivity = cg.inactivity_alarm * 60;
inactivity = 60; // default value before set to global one
}
......@@ -155,7 +155,8 @@ void delay_menu_always(u8 len_s) {
// inactivity timer reset
void reset_inactivity_timer(void) {
if (!inactivity) buzzer_off(); // stop beeping when applied previously
// stop beeping when applied previously
if (cg.inactivity_alarm && !inactivity) buzzer_off();
inactivity = cg.inactivity_alarm * 60;
}
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