Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Semerád Pavel
gt3b
Commits
f9841221
Commit
f9841221
authored
Apr 13, 2012
by
Pavel Semerad
Browse files
3-pos switch in place of CH3 button is now working
parent
24156959
Changes
6
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
f9841221
...
...
@@ -14,6 +14,7 @@
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
3-pos switch instead of CH3 button now works
*0.4.1 (17 Aug 2011)
...
...
MANUAL.txt
View file @
f9841221
...
...
@@ -289,8 +289,8 @@ CHn - switch channel "n" value from one end value to opposite end
value. There is special handling for CH3 button. When using
3-position switch instead of CH3 button and momentary is
selected for this button, then centre 3-pos value will also
be detected and set to servo (
but this was not tested y
et
,
I wouldn't do this modification to my radio).
be detected and set to servo (
use 1K resistor to GND to g
et
middle state)
CnR - reset value of channel "n" to centre
4WS - switch crab (CRB) no-crab (NOC) for 4 wheel steering
DIG - switch DIG mix between -100 and 100 (more useable when using
...
...
input.c
View file @
f9841221
...
...
@@ -194,8 +194,10 @@ static void read_keys(void) {
// read actual keys status
buttons1
=
read_key_matrix
();
// add CH3 button
if
(
adc_ch3_last
<
50
)
buttons1
|=
BTN_CH3
;
// add CH3 button, middle state will be only in buttons_state,
// not in buttons
if
(
adc_ch3_last
<=
BTN_CH3_LOW
)
buttons1
|=
BTN_CH3
;
else
if
(
adc_ch3_last
<
BTN_CH3_HIGH
)
buttons1
|=
BTN_CH3_MID
;
// combine last 3 readed buttons
buttons_state
|=
buttons1
&
buttons2
&
buttons3
;
...
...
input.h
View file @
f9841221
...
...
@@ -45,6 +45,7 @@
#define BTN_END 0x0400
#define BTN_CH3 0x0800
#define BTN_CH3_MID 0x1000
#define BTN_ROT_L 0x4000
#define BTN_ROT_R 0x8000
...
...
@@ -53,6 +54,11 @@
#define BTN_ALL 0xffff
// limits for BTN_CH3_MID
#define BTN_CH3_LOW 256
#define BTN_CH3_HIGH 768
// variables representing pressed buttons
extern
volatile
u16
buttons_state
;
// actual state of buttons
extern
volatile
u16
buttons
;
// pressed buttons (must be cleared by SW)
...
...
menu.c
View file @
f9841221
...
...
@@ -820,6 +820,10 @@ void menu_init(void) {
// read model config from eeprom
menu_load_model
();
// wait for at least 3 buttons reads to initialize default servo values
// with stable keys (for example CH3_MID)
while
(
time_sec
==
0
&&
time_5ms
<
10
)
pause
();
// and main loop
menu_loop
();
}
...
...
menu_popup.c
View file @
f9841221
...
...
@@ -839,6 +839,10 @@ static u8 menu_popup_key(u8 key_id) {
static
@
near
u8
ch3_has_middle
;
// set to 1 if ch3 has middle state
u8
state
;
// new button state
u8
value_showed
=
0
;
u16
btnx_orig
=
btnx
;
// for CH3 button add MIDDLE state also
if
(
key_id
==
0
)
btnx
|=
BTN_CH3_MID
;
while
(
1
)
{
// set actual state of btnx to buttons_state_last
...
...
@@ -848,16 +852,16 @@ static u8 menu_popup_key(u8 key_id) {
// check button
flags
=
FF_NONE
;
state
=
MBS_RELEASED
;
if
(
btns
(
btnx
))
{
flags
|=
FF_ON
;
state
=
MBS_PRESSED
;
}
if
(
key_id
==
0
&&
adc_ch3_last
>
256
&&
adc_ch3_last
<
768
)
{
if
(
key_id
==
0
&&
btns
(
BTN_CH3_MID
))
{
// special check for CH3 button middle
flags
|=
FF_MID
;
state
=
MBS_MIDDLE
;
ch3_has_middle
=
1
;
}
else
if
(
btns
(
btnx_orig
))
{
flags
|=
FF_ON
;
state
=
MBS_PRESSED
;
}
if
(
km
->
reverse
)
flags
|=
FF_REVERSE
;
if
(
ch3_has_middle
)
flags
|=
FF_HAS_MID
;
if
(
km
->
previous_val
)
flags
|=
FF_PREVIOUS
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment