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
90a669a7
Commit
90a669a7
authored
Jun 30, 2011
by
Pavel Semerad
Browse files
added channel_speed for all channels; throttle channel can be applied only for forward side
parent
7cc13ac8
Changes
7
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
90a669a7
*0.4.0 ()
use steering trim when dual-ESC steering
added channel_speed for all channels, throttle channel can be applied only
for forward side
*0.3.2 (27 Jun 2011)
added option throttle brake cut of to be able to drive forward only
...
...
MANUAL.txt
View file @
90a669a7
...
...
@@ -20,7 +20,7 @@ You can backup your original firmware and config, use tabs "PROGRAM MEMORY" and
Global characteristics:
=======================
- 1
5
models memory (for 6-channel firmware, for 3-channel it is little more
- 1
4
models memory (for 6-channel firmware, for 3-channel it is little more
and for 8-channel little less)
> numbers 10-19 will show with Right-Arrow
> numbers 20-29 will show with Left-Arrow
...
...
@@ -75,14 +75,19 @@ Standard menu:
> menu TRIM will blink
> set subtrims for each channel
> press ENTER/BACK to end this submenu
-
Steering
speed
-
channel
speed
> choose menu D/R and press ENTER-long
> menu D/R wil blink
> now only channel 1 can be selected
> turn wheel left to show left arrow - this represents Turn speed 1-100%
> turn wheel right to show right arrow - this represents Return speed 1-100%
100% means no delay
1% means above 4s delay end to end
> select channel
> for channels 1 and 2 (steering and throttle)
- turn wheel left to show left arrow
- this represents Turn speed or throttle speed
- turn wheel right to show right arrow
- this represents Return speed or
"throttle speed only for forward" (OFF/ON)
> select required speed 1...100%
- 100% means no delay
- 1% means above 4s delay end to end
- mixes 4WS, DIG, throttle brake cut-off (for boats with forward-only
throttle), Multi-Position (to set arbitrary up to 8 positions)
> choose menu EPOINT and press ENTER-long
...
...
@@ -255,6 +260,7 @@ DIG - DIG throttle mix -100...100%
MPO - Multi-POsition, switches position up/down
SST - steering speed turn 1...100%
SSR - steering speed return 1...100%
CSn - channel speed for channel "n" 1...100%
...
...
calc.c
View file @
90a669a7
...
...
@@ -143,7 +143,7 @@ static s16 expo(s16 inval, s8 exp) {
// apply steering speed
static
u
16
steering_speed
(
s16
val
,
u8
channel
)
{
static
s
16
steering_speed
(
s16
val
,
u8
channel
)
{
s16
last
=
last_value
[
channel
-
1
];
s16
delta
=
val
-
last
;
s16
delta2
=
0
;
...
...
@@ -220,6 +220,41 @@ static u16 steering_speed(s16 val, u8 channel) {
}
// apply servo speed
static
s16
channel_speed
(
s16
val
,
u8
channel
)
{
s16
last
=
last_value
[
channel
-
1
];
s16
delta
=
val
-
last
;
s16
max_delta
;
u8
speed
=
cm
.
speed
[
channel
-
1
];
// for DIG channel use throttle speed
if
(
channel
==
cm
.
channel_DIG
)
speed
=
cm
.
thspd
;
if
(
!
delta
)
return
val
;
// no change from previous val
if
(
speed
==
100
)
return
val
;
// max speed
// special handling for "throttle only for forward"
if
(
cm
.
thspd_onlyfwd
&&
(
channel
==
2
||
channel
==
cm
.
channel_DIG
))
{
if
(
val
>=
0
&&
!
cm
.
brake_off
)
return
val
;
// at brake side
if
(
delta
>
0
)
return
val
;
// not forwarding
if
(
last
>
0
&&
!
cm
.
brake_off
)
{
// apply speed only from centre to forward
last
=
0
;
delta
=
val
;
}
}
max_delta
=
PPM
(
1000
)
/
2
/
(
100
-
speed
);
if
(
delta
<
0
)
{
if
(
max_delta
<
-
delta
)
val
=
last
-
max_delta
;
}
else
{
if
(
max_delta
<
delta
)
val
=
last
+
max_delta
;
}
return
val
;
}
...
...
@@ -261,7 +296,7 @@ static void calc_loop(void) {
channel_params
(
1
,
steering_speed
(
val
,
1
));
channel_params
(
cm
.
channel_4WS
,
steering_speed
(
val2
,
cm
.
channel_4WS
));
steering_speed
(
val2
,
cm
.
channel_4WS
));
}
}
else
{
...
...
@@ -276,12 +311,14 @@ static void calc_loop(void) {
}
// return back value from steering wheel to allow to use
// steering speed
val2
=
last_value
[
0
];
last_value
[
0
]
=
last_ch1
;
val
=
steering_speed
(
val
,
1
);
if
(
val
<
PPM
(
-
500
))
val
=
PPM
(
-
500
);
else
if
(
val
>
PPM
(
500
))
val
=
PPM
(
500
);
// save steering value for steering speed
last_ch1
=
val
;
last_value
[
0
]
=
val2
;
// set DIG mix
DIG_mix
=
-
val
;
// minus, because 100 will reduce channel 1
menu_DIG_mix
=
(
s8
)(
DIG_mix
/
PPM
(
5
));
...
...
@@ -328,7 +365,7 @@ static void calc_loop(void) {
val
=
dualrate
(
val
,
(
u8
)(
val
<
0
?
cm
.
dr_forward
:
cm
.
dr_back
));
if
(
!
cm
.
channel_DIG
)
{
if
(
cm
.
brake_off
)
val
=
val
*
2
+
PPM
(
500
);
channel_params
(
2
,
val
);
channel_params
(
2
,
channel_speed
(
val
,
2
)
);
}
else
{
// DIG mixing
...
...
@@ -345,8 +382,8 @@ static void calc_loop(void) {
val
=
val
*
2
+
PPM
(
500
);
val2
=
val2
*
2
+
PPM
(
500
);
}
channel_params
(
2
,
val
);
channel_params
(
cm
.
channel_DIG
,
val2
);
channel_params
(
2
,
channel_speed
(
val
,
2
)
);
channel_params
(
cm
.
channel_DIG
,
channel_speed
(
val2
,
cm
.
channel_DIG
)
);
}
...
...
@@ -354,9 +391,9 @@ static void calc_loop(void) {
// channels 3-8, exclude mixed channels in the future
for
(
i
=
3
,
bit
=
0
b100
;
i
<=
MAX_CHANNELS
;
i
++
,
bit
<<=
1
)
{
// check if channel was already mixed before
// check if channel was already mixed before
(4WS, DIG)
if
(
menu_channels_mixed
&
bit
)
continue
;
channel_params
(
i
,
menu_channel3_8
[
i
-
3
]
*
PPM
(
5
));
channel_params
(
i
,
channel_speed
(
menu_channel3_8
[
i
-
3
]
*
PPM
(
5
)
,
i
)
);
}
...
...
config.c
View file @
90a669a7
...
...
@@ -107,14 +107,15 @@ void config_model_set_default(void) {
cm
.
expo_forward
=
0
;
cm
.
expo_back
=
0
;
cm
.
abs_type
=
0
;
cm
.
channel_4WS
=
0
;
cm
.
brake_off
=
0
;
cm
.
thspd_onlyfwd
=
0
;
cm
.
channel_4WS
=
0
;
cm
.
channel_DIG
=
0
;
cm
.
channel_MP
=
0
;
cm
.
multi_position
[
0
]
=
-
100
;
memset
(
&
cm
.
multi_position
[
1
],
(
u8
)
MULTI_POSITION_END
,
NUM_MULTI_POSITION
-
1
);
cm
.
stspd_turn
=
100
;
memset
(
&
cm
.
speed
[
0
],
100
,
MAX_CHANNELS
)
;
cm
.
stspd_return
=
100
;
memcpy
(
&
cm
.
key_mapping
,
&
default_key_mapping
,
sizeof
(
config_key_mapping_s
));
}
...
...
config.h
View file @
90a669a7
...
...
@@ -111,8 +111,8 @@ typedef struct {
// change MAGIC number when changing model config
// also add code to setting default values
// 2
4
+ 22(keys) + channels *
3
bytes
#define CONFIG_MODEL_MAGIC (0xf
b
20 | (MAX_CHANNELS - 1))
// 2
3
+ 22(keys) + channels *
4
bytes
#define CONFIG_MODEL_MAGIC (0xf
a
20 | (MAX_CHANNELS - 1))
typedef
struct
{
u8
name
[
3
];
u8
reverse
;
// bit for each channel
...
...
@@ -130,12 +130,15 @@ typedef struct {
#define expo_forward expo[1]
#define expo_back expo[2]
u8
abs_type
:
2
;
u8
channel_4WS
:
4
;
// channel for 4WS mix or 0 when off
u8
brake_off
:
1
;
// don't use brake side of throttle
u8
thspd_onlyfwd
:
1
;
// throttle speed only at forward side
u8
channel_4WS
:
4
;
// channel for 4WS mix or 0 when off
u8
channel_DIG
:
4
;
// channel for DIG mix or 0 when off
u8
channel_MP
:
4
;
// channel for MultiPosition or 0 when off
s8
multi_position
[
NUM_MULTI_POSITION
];
// values for MultiPosition
u8
stspd_turn
;
// steering speed turn
u8
speed
[
MAX_CHANNELS
];
// reduce speed of servo
#define stspd_turn speed[0]
#define thspd speed[1]
u8
stspd_return
;
// steering speed return
config_key_mapping_s
key_mapping
;
}
config_model_s
;
...
...
menu.c
View file @
90a669a7
...
...
@@ -568,14 +568,22 @@ static void menu_dualrate(void) {
// set servo speed
static
void
sf_speed
(
u8
channel
,
u8
change
)
{
u8
*
addr
=
menu_adc_direction
?
&
cm
.
stspd_return
:
&
cm
.
stspd_turn
;
if
(
change
)
*
addr
=
(
u8
)
menu_change_val
(
*
addr
,
1
,
100
,
SPEED_FAST
,
0
);
lcd_char_num3
(
*
addr
);
u8
*
addr
=
&
cm
.
speed
[
channel
];
u8
thfwdonly
=
(
u8
)(
channel
==
1
&&
menu_adc_direction
?
1
:
0
);
if
(
channel
==
0
&&
menu_adc_direction
)
addr
=
&
cm
.
stspd_return
;
if
(
change
)
{
if
(
thfwdonly
)
// throttle forward only setting
cm
.
thspd_onlyfwd
^=
1
;
else
*
addr
=
(
u8
)
menu_change_val
(
*
addr
,
1
,
100
,
SPEED_FAST
,
0
);
}
if
(
thfwdonly
)
lcd_chars
(
cm
.
thspd_onlyfwd
?
"OFF"
:
"ON "
);
else
lcd_char_num3
(
*
addr
);
}
static
void
menu_speed
(
void
)
{
lcd_set_blink
(
LMENU
,
LB_SPC
);
lcd_segment
(
LS_SYM_PERCENT
,
LS_ON
);
menu_channel
(
1
,
0x
1
,
0
,
sf_speed
);
menu_channel
(
MAX_CHANNELS
,
0x
3
,
0
,
sf_speed
);
lcd_segment
(
LS_SYM_PERCENT
,
LS_OFF
);
lcd_set_blink
(
LMENU
,
LB_OFF
);
}
...
...
menu_popup.c
View file @
90a669a7
...
...
@@ -164,45 +164,59 @@ static const et_functions_s et_functions[] = {
SUBTRIM_MAX
,
0
,
SUBTRIM_FAST
,
NULL
,
NULL
,
NULL
},
{
21
,
"ST3"
,
LM_TRIM
,
EF_BLINK
,
3
,
&
cm
.
subtrim
[
2
],
-
SUBTRIM_MAX
,
SUBTRIM_MAX
,
0
,
SUBTRIM_FAST
,
NULL
,
NULL
,
NULL
},
{
27
,
"SST"
,
LM_DR
,
EF_BLINK
|
EF_LEFT
|
EF_PERCENT
,
1
,
&
cm
.
stspd_turn
,
1
,
100
,
100
,
SPEED_FAST
,
NULL
,
NULL
,
NULL
},
{
28
,
"SSR"
,
LM_DR
,
EF_BLINK
|
EF_RIGHT
|
EF_PERCENT
,
1
,
&
cm
.
stspd_return
,
1
,
100
,
100
,
SPEED_FAST
,
NULL
,
NULL
,
NULL
},
{
29
,
"CS2"
,
LM_DR
,
EF_BLINK
|
EF_RIGHT
|
EF_PERCENT
,
1
,
&
cm
.
thspd
,
1
,
100
,
100
,
SPEED_FAST
,
NULL
,
NULL
,
NULL
},
{
30
,
"CS3"
,
LM_DR
,
EF_BLINK
|
EF_RIGHT
|
EF_PERCENT
,
1
,
&
cm
.
speed
[
2
],
1
,
100
,
100
,
SPEED_FAST
,
NULL
,
NULL
,
NULL
},
#if MAX_CHANNELS >= 4
{
14
,
"CH4"
,
0
,
EF_NONE
,
4
,
&
menu_channel4
,
-
100
,
100
,
0
,
CHANNEL_FAST
,
NULL
,
NULL
,
NULL
},
{
22
,
"ST4"
,
LM_TRIM
,
EF_BLINK
,
4
,
&
cm
.
subtrim
[
3
],
-
SUBTRIM_MAX
,
SUBTRIM_MAX
,
0
,
SUBTRIM_FAST
,
NULL
,
NULL
,
NULL
},
{
31
,
"CS4"
,
LM_DR
,
EF_BLINK
|
EF_RIGHT
|
EF_PERCENT
,
1
,
&
cm
.
speed
[
3
],
1
,
100
,
100
,
SPEED_FAST
,
NULL
,
NULL
,
NULL
},
#if MAX_CHANNELS >= 5
{
15
,
"CH5"
,
0
,
EF_NONE
,
5
,
&
menu_channel5
,
-
100
,
100
,
0
,
CHANNEL_FAST
,
NULL
,
NULL
,
NULL
},
{
23
,
"ST5"
,
LM_TRIM
,
EF_BLINK
,
5
,
&
cm
.
subtrim
[
4
],
-
SUBTRIM_MAX
,
SUBTRIM_MAX
,
0
,
SUBTRIM_FAST
,
NULL
,
NULL
,
NULL
},
{
32
,
"CS5"
,
LM_DR
,
EF_BLINK
|
EF_RIGHT
|
EF_PERCENT
,
1
,
&
cm
.
speed
[
4
],
1
,
100
,
100
,
SPEED_FAST
,
NULL
,
NULL
,
NULL
},
#if MAX_CHANNELS >= 6
{
16
,
"CH6"
,
0
,
EF_NONE
,
6
,
&
menu_channel6
,
-
100
,
100
,
0
,
CHANNEL_FAST
,
NULL
,
NULL
,
NULL
},
{
24
,
"ST6"
,
LM_TRIM
,
EF_BLINK
,
6
,
&
cm
.
subtrim
[
5
],
-
SUBTRIM_MAX
,
SUBTRIM_MAX
,
0
,
SUBTRIM_FAST
,
NULL
,
NULL
,
NULL
},
{
33
,
"CS6"
,
LM_DR
,
EF_BLINK
|
EF_RIGHT
|
EF_PERCENT
,
1
,
&
cm
.
speed
[
5
],
1
,
100
,
100
,
SPEED_FAST
,
NULL
,
NULL
,
NULL
},
#if MAX_CHANNELS >= 7
{
17
,
"CH7"
,
0
,
EF_NONE
,
7
,
&
menu_channel7
,
-
100
,
100
,
0
,
CHANNEL_FAST
,
NULL
,
NULL
,
NULL
},
{
25
,
"ST7"
,
LM_TRIM
,
EF_BLINK
,
7
,
&
cm
.
subtrim
[
6
],
-
SUBTRIM_MAX
,
SUBTRIM_MAX
,
0
,
SUBTRIM_FAST
,
NULL
,
NULL
,
NULL
},
{
34
,
"CS7"
,
LM_DR
,
EF_BLINK
|
EF_RIGHT
|
EF_PERCENT
,
1
,
&
cm
.
speed
[
6
],
1
,
100
,
100
,
SPEED_FAST
,
NULL
,
NULL
,
NULL
},
#if MAX_CHANNELS >= 8
{
18
,
"CH8"
,
0
,
EF_NONE
,
8
,
&
menu_channel8
,
-
100
,
100
,
0
,
CHANNEL_FAST
,
NULL
,
NULL
,
NULL
},
{
26
,
"ST8"
,
LM_TRIM
,
EF_BLINK
,
8
,
&
cm
.
subtrim
[
7
],
-
SUBTRIM_MAX
,
SUBTRIM_MAX
,
0
,
SUBTRIM_FAST
,
NULL
,
NULL
,
NULL
},
{
35
,
"CS8"
,
LM_DR
,
EF_BLINK
|
EF_RIGHT
|
EF_PERCENT
,
1
,
&
cm
.
speed
[
7
],
1
,
100
,
100
,
SPEED_FAST
,
NULL
,
NULL
,
NULL
},
#endif
#endif
#endif
#endif
#endif
{
29
,
"4WS"
,
LM_EPO
,
EF_BLINK
|
EF_PERCENT
|
EF_NOCHANNEL
,
4
,
{
36
,
"4WS"
,
LM_EPO
,
EF_BLINK
|
EF_PERCENT
|
EF_NOCHANNEL
,
4
,
&
menu_4WS_mix
,
-
100
,
100
,
0
,
MIX_FAST
,
NULL
,
NULL
,
NULL
},
{
3
0
,
"DIG"
,
LM_EPO
,
EF_BLINK
|
EF_PERCENT
|
EF_NOCHANNEL
,
L7_D
,
{
3
7
,
"DIG"
,
LM_EPO
,
EF_BLINK
|
EF_PERCENT
|
EF_NOCHANNEL
,
L7_D
,
&
menu_DIG_mix
,
-
100
,
100
,
0
,
MIX_FAST
,
NULL
,
NULL
,
NULL
},
{
27
,
"SST"
,
LM_DR
,
EF_BLINK
|
EF_LEFT
|
EF_PERCENT
,
1
,
&
cm
.
stspd_turn
,
1
,
100
,
100
,
SPEED_FAST
,
NULL
,
NULL
,
NULL
},
{
28
,
"SSR"
,
LM_DR
,
EF_BLINK
|
EF_RIGHT
|
EF_PERCENT
,
1
,
&
cm
.
stspd_return
,
1
,
100
,
100
,
SPEED_FAST
,
NULL
,
NULL
,
NULL
},
{
31
,
"MPO"
,
0
,
EF_LIST
,
0
,
&
menu_MP_index
,
{
38
,
"MPO"
,
0
,
EF_LIST
,
0
,
&
menu_MP_index
,
0
,
NUM_MULTI_POSITION
-
1
,
0
,
1
,
set_MP
,
show_MP
,
NULL
},
};
#define ET_FUNCTIONS_SIZE (sizeof(et_functions) / sizeof(et_functions_s))
...
...
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