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

add global option rotate_reverse for GT3C rotate encoder

parent 7b9183f5
......@@ -7,6 +7,8 @@
added BRK button function to override throttle and apply full brake
big internal changes handling different menus, key mapping uses
2-char option identification instead of various symbols
added global option rotate_reverse to switch direction of rotate
endoder at GT3C
*0.4.2 (13 Apr 2012)
added global setting to disable center/reset value beep
......
......@@ -304,6 +304,8 @@ Global setup menu:
poweron beep P_N/P_Y
poweron not-centered warn C_N/C_Y
d long press key delay 100...1000 miliseconds
H setting of hardware features
reverse rotate encoder E_N/E_Y (No/Yes) - for GT3C
r global or all models reset
all configs (global+model) G_N/G_Y (No/Yes)
all models M_N/M_Y (No/Yes
......
global option to reverse rotate encoder
- just generate opposite buttons than now
selectable frame length with constant frame/constant sync
- global option to choose constant frame/constant sync (9ms..)
- global option to set frame/sync length (3ms..)
......
......@@ -59,13 +59,13 @@ u8 config_global_set_default(void) {
cg.reset_beep = 1;
cg.poweron_beep = 1;
cg.poweron_warn = 0;
cg.rotate_reverse = 0; // not-reversed
cg.timer1_type = 0; // OFF
cg.timer2_type = 0;
cg.timer1_alarm = 0; // OFF
cg.timer2_alarm = 0;
cg.unused1 = 0;
cg.unused2 = 0;
cg.unused3 = 0;
cg.unused4 = 0;
......
......@@ -57,7 +57,7 @@ typedef struct {
u8 timer1_type:3; // type of timer
u8 timer2_type:3;
u8 poweron_warn:1; // beep 3 times when not-centered poweron
u8 unused1:1;
u8 rotate_reverse:1; // reverse rotate encoder sense
u8 timer1_alarm; // alarm of timer
u8 timer2_alarm;
u16 unused2; // reserve
......
......@@ -276,16 +276,19 @@ static void read_keys(void) {
if (encoder_timer) encoder_timer--;
if (TIM1_CNTRL) {
// encoder changed
u16 btn;
if ((s8)TIM1_CNTRL >= 0) {
// left
buttons |= BTN_ROT_L;
if (encoder_timer) buttons_long |= BTN_ROT_L;
if (cg.rotate_reverse) btn = BTN_ROT_R;
else btn = BTN_ROT_L;
}
else {
// right
buttons |= BTN_ROT_R;
if (encoder_timer) buttons_long |= BTN_ROT_R;
if (cg.rotate_reverse) btn = BTN_ROT_L;
else btn = BTN_ROT_R;
}
buttons |= btn;
if (encoder_timer) buttons_long |= btn;
// set it back to default value
TIM1_CNTRL = 0;
// init timer
......
......@@ -270,6 +270,35 @@ static void gs_long_press_delay(u8 action) {
}
// hardware settings
static void gs_hardware(u8 action) {
// change value
if (action == MLA_CHG) {
switch (menu_set) {
case 0:
cg.rotate_reverse ^= 1;
break;
}
}
// select next value
else if (action == MLA_NEXT) {
if (++menu_set > 0) menu_set = 0;
}
// show values
lcd_7seg(L7_H);
lcd_char(LCHR2, ' ');
menu_blink &= (u8)~(MCB_CHR1 | MCB_CHR2); // only last char will blink
switch (menu_set) {
case 0:
lcd_char(LCHR1, 'E');
lcd_char(LCHR3, (u8)(cg.rotate_reverse ? 'Y' : 'N'));
break;
}
}
// reset global or all models
static void gs_config_reset(u8 action) {
// change value
......@@ -313,6 +342,7 @@ static const menu_list_t gs_config[] = {
gs_adc,
gs_beep,
gs_long_press_delay,
gs_hardware,
gs_config_reset,
};
#define GS_CONFIG_SIZE (sizeof(gs_config) / sizeof(u8 *))
......
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