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
778eee54
Commit
778eee54
authored
Apr 11, 2012
by
Pavel Semerad
Browse files
global config to set last 4 or 1 values used when calculating servo signals
parent
f14afd7a
Changes
6
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
778eee54
...
...
@@ -3,7 +3,8 @@
minimum battery voltage set to 2V for those experimenting with 1S cell
PPM length shortened to "NUM_CHANNELS x 2ms + 5ms" to send new data
to receiver as soon as possible
ADC measuring every 1ms, averaging last 4 samples when used
ADC measuring every 1ms, averaging last 4 samples when used,
globally settable to use last 4/1 values
at poweron, if steering or throttle are not in center dead zone,
beep 3 times
added poweron beep, can be set ON/OFF in global config
...
...
MANUAL.txt
View file @
778eee54
...
...
@@ -225,6 +225,7 @@ Global setup menu:
for values greater than 120%
1 dead zone for steering 0...50
2 dead zone for throttle 0...50
o use last 4 or 1 ADC values OVS/LST
b key beep OFF/ON
C center/reset beep OFF/ON
P poweron beep OFF/ON
...
...
calc.c
View file @
778eee54
...
...
@@ -265,12 +265,25 @@ static void calc_loop(void) {
s16
val
,
val2
;
u8
i
,
bit
;
s16
DIG_mix
;
u16
adc_steering
,
adc_throttle
;
// last 4 or 1 ADC values
while
(
1
)
{
DIG_mix
=
menu_DIG_mix
*
PPM
(
5
);
// to -5000..5000 range
// set used ADC values
if
(
cg
.
adc_ovs_last
)
{
// last value
adc_steering
=
adc_steering_last
<<
ADC_OVS_SHIFT
;
adc_throttle
=
adc_throttle_last
<<
ADC_OVS_SHIFT
;
}
else
{
// oversampled last 4 values
adc_steering
=
adc_steering_ovs
;
adc_throttle
=
adc_throttle_ovs
;
}
// steering
val
=
channel_calib
(
adc_steering
_ovs
,
val
=
channel_calib
(
adc_steering
,
cg
.
calib_steering_left
<<
ADC_OVS_SHIFT
,
cg
.
calib_steering_mid
<<
ADC_OVS_SHIFT
,
cg
.
calib_steering_right
<<
ADC_OVS_SHIFT
,
...
...
@@ -330,7 +343,7 @@ static void calc_loop(void) {
// throttle
val
=
channel_calib
(
adc_throttle
_ovs
,
val
=
channel_calib
(
adc_throttle
,
cg
.
calib_throttle_fwd
<<
ADC_OVS_SHIFT
,
cg
.
calib_throttle_mid
<<
ADC_OVS_SHIFT
,
cg
.
calib_throttle_bck
<<
ADC_OVS_SHIFT
,
...
...
config.c
View file @
778eee54
...
...
@@ -55,7 +55,7 @@ u8 config_global_set_default(void) {
cg
.
key_beep
=
1
;
cg
.
reset_beep
=
1
;
cg
.
poweron_beep
=
1
;
cg
.
unused
=
0
;
cg
.
adc_ovs_last
=
0
;
// use oversampled value in CALC
// set calibrate values only when they are out of limits
cc
|=
check_val
(
&
cg
.
calib_steering_left
,
0
,
CALIB_ST_LOW_MID
,
0
);
...
...
config.h
View file @
778eee54
...
...
@@ -53,7 +53,7 @@ typedef struct {
u8
key_beep
:
1
;
// beep on key press
u8
reset_beep
:
1
;
// beep on center/reset value
u8
poweron_beep
:
1
;
// beep on power on
u8
unused
:
1
;
u8
adc_ovs_last
:
1
;
// use oversampled (0) or last (1) value in CALC
}
config_global_s
;
extern
config_global_s
config_global
;
...
...
menu_global.c
View file @
778eee54
...
...
@@ -237,6 +237,18 @@ static void gs_throttle_dead(u8 change) {
}
static
void
gs_adc_ovs_last
(
u8
change
)
{
if
(
change
==
0xff
)
{
lcd_set
(
L7SEG
,
LB_EMPTY
);
return
;
}
if
(
change
)
cg
.
adc_ovs_last
^=
1
;
lcd_7seg
(
L7_O
);
if
(
cg
.
adc_ovs_last
)
lcd_chars
(
"LST"
);
else
lcd_chars
(
"OVS"
);
}
static
_Bool
gs_reset_flag
;
static
void
gs_reset_all
(
u8
change
)
{
if
(
change
==
0xff
)
{
...
...
@@ -287,6 +299,7 @@ static const global_setup_t gs_config[] = {
gs_endpoint_max
,
gs_steering_dead
,
gs_throttle_dead
,
gs_adc_ovs_last
,
gs_key_beep
,
gs_reset_beep
,
gs_poweron_beep
,
...
...
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