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
a50328ca
Commit
a50328ca
authored
Jun 27, 2011
by
Pavel Semerad
Browse files
added MultiPosition "mix"
parent
944ee5bd
Changes
8
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
a50328ca
*0.3.2 ()
*0.3.2 (
27 Jun 2011
)
added option throttle brake cut of to be able to drive forward only
vehicles (boats)
added MultiPosition settable to channel
*0.3.1 (26 Jun 2011)
...
...
MANUAL.txt
View file @
a50328ca
...
...
@@ -83,7 +83,8 @@ Standard menu:
> 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
- mixes 4WS, DIG, throttle brake cut-off (for boats with forward-only throttle)
- 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
> menu EPOINT will blink
> select one of mixes 4WS (4), DIG (d) or brake cut-off (b)
...
...
@@ -97,6 +98,11 @@ Standard menu:
100% means 100% reduce on rear steering/throttle (eg. no steering)
-100% means 100% reduce on front steering/throttle (eg. no steering)
> for 4WS press ENTER and select crab (CRB) or no-crab (NOC)
for Multi-Position:
> press ENTER and choose channel for this mix or OFF
> press ENTER and set channel value for first position
> press ENTER and set channel value for second position or END
> ... up to eight position
for brake cut-off:
> ser OFF or CUT
- Key mapping specific for each model:
...
...
@@ -110,8 +116,8 @@ Standard menu:
-----
steps of settings of trims (1 2 3 and D/R):
- sequence:
function -> buttons -> step -> reverse -> opposite_reset -> previous_val
id: % % V V V blinking % blinking
function -> buttons -> step -> reverse -> opposite_reset -> previous_val
-> rotate
id: % % V V V blinking % blinking
% V blinking
- function: selected function listed at the end of manual
- buttons:
MOM - momentary, hold left/right trim key to get end values,
...
...
@@ -122,7 +128,7 @@ Standard menu:
centre/reset value
END - long press of trim key will set to coresponding end value
- step: select trim step for one trim key press (1, 2, ... 100, 200),
not available when buttons MOM
not available when buttons MOM
or fuction is list of items (MPO)
- reverse:
NOR - no change
REV - swap left/right trim keys
...
...
@@ -130,10 +136,14 @@ Standard menu:
NOO - no change
ORS - when trim key is pressed and value is at opposite
side of centre/reset, set value to centre/reset,
- previous_val: available only when buttons MOM
- previous_val: available only when buttons MOM or fuction is list of
items (MPO)
NPV - no change
PRV - instead of setting value to centre/reset when key is released,
it is set to previous value, which was active before key press
- rotate: available only if fuction is list of items (MPO)
NOR - no rotate
ROT - rotate from max item to 1.item and back
-----
steps of setting of keys (C b E 1< 1> 2< 2> 3< 3> d< d>):
- sequence:
...
...
@@ -242,6 +252,7 @@ CHn - change channel "n" value in range -100...100
STn - subtrim of channel "n"
4WS - 4 wheel steering mix -100...100%
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%
...
...
@@ -260,4 +271,6 @@ 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
return to previous val key setting)
MPO - Multi-POsition, switches position up (at END back to 1.)
MPR - Multi-Position Reset, switches position to first one
TODO
View file @
a50328ca
add multi-position
select channel
for each positions set from range -100%..100%
max number of positions -> 8
settable to keys and trims
? not so smooth servo travel
...
...
config.c
View file @
a50328ca
...
...
@@ -111,7 +111,9 @@ void config_model_set_default(void) {
cm
.
brake_off
=
0
;
cm
.
channel_DIG
=
0
;
cm
.
channel_MP
=
0
;
memset
(
cm
.
multi_position
,
(
u8
)
MULTI_POSITION_END
,
NUM_MULTI_POSITION
);
cm
.
multi_position
[
0
]
=
-
100
;
memset
(
&
cm
.
multi_position
[
1
],
(
u8
)
MULTI_POSITION_END
,
NUM_MULTI_POSITION
-
1
);
cm
.
stspd_turn
=
100
;
cm
.
stspd_return
=
100
;
memcpy
(
&
cm
.
key_mapping
,
&
default_key_mapping
,
sizeof
(
config_key_mapping_s
));
...
...
menu.c
View file @
a50328ca
...
...
@@ -42,6 +42,7 @@ u8 menu_channels_mixed; // channel with 1 here will not be set from
s8
menu_4WS_mix
;
// mix -100..100
_Bool
menu_4WS_crab
;
// when 1, crab steering
s8
menu_DIG_mix
;
// mix -100..100
u8
menu_MP_index
;
// index of MultiPosition channel
...
...
@@ -104,13 +105,16 @@ void menu_load_model(void) {
// set values of channels >= 3 to default left state,
// for channels mapped to some trims/keys, it will next be set
// to corresponding centre/reset value
for
(
i
=
0
;
i
<
=
MAX_CHANNELS
-
3
;
i
++
)
for
(
i
=
0
;
i
<
MAX_CHANNELS
-
2
;
i
++
)
menu_channel3_8
[
i
]
=
-
100
;
// set 4WS
and DIG
to defaults
// set 4WS
, DIG, MP
to defaults
menu_4WS_mix
=
0
;
menu_4WS_crab
=
0
;
menu_DIG_mix
=
0
;
menu_MP_index
=
0
;
if
(
cm
.
channel_MP
)
menu_channel3_8
[
cm
.
channel_MP
-
3
]
=
cm
.
multi_position
[
0
];
// set state of buttons to do initialize
menu_buttons_initialize
();
...
...
menu.h
View file @
a50328ca
...
...
@@ -65,6 +65,7 @@ extern u8 menu_channels_mixed; // channel with 1 here will not be set from
extern
s8
menu_4WS_mix
;
// mix -100..100
extern
_Bool
menu_4WS_crab
;
// when 1, crab steering
extern
s8
menu_DIG_mix
;
// mix -100..100
extern
u8
menu_MP_index
;
// index of MultiPosition channel
...
...
menu_mix.c
View file @
a50328ca
...
...
@@ -140,6 +140,73 @@ static u8 mix_DIG(u8 val_id, u8 action) {
}
static
u8
mix_MultiPosition
(
u8
val_id
,
u8
action
)
{
u8
id
=
val_id
;
s8
val
;
if
(
action
==
1
)
{
// change value
if
(
id
==
1
)
{
// channel number/off
val
=
cm
.
channel_MP
;
if
(
!
val
)
val
=
2
;
val
=
(
u8
)
menu_change_val
(
val
,
2
,
MAX_CHANNELS
,
1
,
1
);
if
(
val
==
2
)
cm
.
channel_MP
=
0
;
else
cm
.
channel_MP
=
val
;
}
else
{
// position value + END state (END not for first position)
val
=
cm
.
multi_position
[
id
-
2
];
if
(
val
==
MULTI_POSITION_END
)
val
=
-
101
;
val
=
(
s8
)
menu_change_val
(
val
,
id
==
2
?
-
100
:
-
101
,
100
,
CHANNEL_FAST
,
0
);
if
(
val
==
-
101
)
{
// set all from this to END value
memset
(
&
cm
.
multi_position
[
id
-
2
],
(
u8
)
MULTI_POSITION_END
,
NUM_MULTI_POSITION
+
2
-
id
);
}
else
cm
.
multi_position
[
id
-
2
]
=
val
;
}
}
else
if
(
action
==
2
)
{
// select next value
if
(
cm
.
channel_MP
)
{
if
(
id
==
1
)
id
=
2
;
else
if
(
cm
.
multi_position
[
id
-
2
]
==
MULTI_POSITION_END
||
++
id
>
(
NUM_MULTI_POSITION
+
1
))
id
=
1
;
}
// allow forcing channel value
if
(
id
>
1
&&
cm
.
channel_MP
)
{
menu_force_value_channel
=
cm
.
channel_MP
;
}
else
menu_force_value_channel
=
0
;
}
// set forced value
if
(
menu_force_value_channel
)
{
val
=
cm
.
multi_position
[
id
-
2
];
if
(
val
==
MULTI_POSITION_END
)
val
=
-
100
;
}
// show value
lcd_7seg
(
L7_P
);
if
(
id
==
1
)
{
// channel number/OFF
if
(
!
cm
.
channel_MP
)
lcd_chars
(
"OFF"
);
else
lcd_char_num3
(
cm
.
channel_MP
);
}
else
{
// position value
val
=
cm
.
multi_position
[
id
-
2
];
if
(
val
==
MULTI_POSITION_END
)
lcd_chars
(
"END"
);
else
lcd_char_num3
(
val
);
menu_force_value
=
val
*
PPM
(
5
);
}
return
id
;
}
static
u8
mix_brake_off
(
u8
val_id
,
u8
action
)
{
u8
id
=
val_id
;
u8
val
;
...
...
@@ -169,6 +236,7 @@ typedef u8 (*mix_func_t)(u8 val_id, u8 action);
static
const
mix_func_t
menu_funcs
[]
=
{
mix_4WS
,
mix_DIG
,
mix_MultiPosition
,
mix_brake_off
,
};
#define MAX_MENU_IDS (sizeof(menu_funcs) / sizeof(void *))
...
...
@@ -203,6 +271,7 @@ void menu_mix(void) {
}
else
{
// change menu-id
menu_force_value_channel
=
0
;
if
(
btn
(
BTN_ROT_L
))
{
if
(
menu_id
)
menu_id
--
;
else
menu_id
=
MAX_MENU_IDS
-
1
;
...
...
@@ -246,6 +315,7 @@ void menu_mix(void) {
}
}
menu_force_value_channel
=
0
;
key_beep
();
lcd_set_blink
(
LMENU
,
LB_OFF
);
config_model_save
();
...
...
menu_popup.c
View file @
a50328ca
...
...
@@ -114,6 +114,29 @@ static void show_trim2(s16 val) {
lcd_char_num2_lbl
((
s8
)
val
,
"FNB"
);
}
// multi-position show and set value
static
void
show_MP
(
s16
val
)
{
lcd_7seg
(
cm
.
channel_MP
);
// show also selected channel
lcd_char_num3
(
cm
.
multi_position
[
menu_MP_index
]);
}
static
void
set_MP
(
s16
*
aval
,
u8
rotate
)
{
// if END value selected, return it back to previous
if
(
cm
.
multi_position
[
*
aval
]
==
MULTI_POSITION_END
)
{
if
(
rotate
)
{
if
(
!
menu_MP_index
)
{
// rotated left through 0, find right value
while
(
cm
.
multi_position
[
*
aval
]
==
MULTI_POSITION_END
)
(
*
aval
)
--
;
}
else
*
aval
=
0
;
// rotated right, return to 0
}
else
(
*
aval
)
--
;
// no rotate, return back to previous index
}
// set value of channel
if
(
cm
.
channel_MP
)
menu_channel3_8
[
cm
.
channel_MP
-
3
]
=
cm
.
multi_position
[
*
aval
];
}
static
const
et_functions_s
et_functions
[]
=
{
{
0
,
"OFF"
,
0
,
EF_NONE
,
0
,
NULL
,
0
,
0
,
0
,
0
,
NULL
,
NULL
},
...
...
@@ -179,6 +202,8 @@ static const et_functions_s et_functions[] = {
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
,
0
,
NUM_MULTI_POSITION
-
1
,
0
,
1
,
set_MP
,
show_MP
,
NULL
},
};
#define ET_FUNCTIONS_SIZE (sizeof(et_functions) / sizeof(et_functions_s))
...
...
@@ -619,6 +644,34 @@ static void kf_4ws(u8 *id, u8 *param, u8 flags, s16 *prev_val) {
}
}
// switch multi-position to next index
static
void
kf_multi_position
(
u8
*
id
,
u8
*
param
,
u8
flags
,
s16
*
prev_val
)
{
if
(
++
menu_MP_index
>=
NUM_MULTI_POSITION
||
cm
.
multi_position
[
menu_MP_index
]
==
MULTI_POSITION_END
)
menu_MP_index
=
0
;
if
(
cm
.
channel_MP
)
menu_channel3_8
[
cm
.
channel_MP
-
3
]
=
cm
.
multi_position
[
menu_MP_index
];
if
(
flags
&
FF_SHOW
)
{
if
(
!
menu_MP_index
)
BEEP_RESET
;
lcd_7seg
(
cm
.
channel_MP
);
lcd_segment
(
LS_SYM_CHANNEL
,
LS_ON
);
lcd_char_num3
(
cm
.
multi_position
[
menu_MP_index
]);
}
}
static
void
kf_multi_position_reset
(
u8
*
id
,
u8
*
param
,
u8
flags
,
s16
*
pv
)
{
menu_MP_index
=
0
;
if
(
cm
.
channel_MP
)
menu_channel3_8
[
cm
.
channel_MP
-
3
]
=
cm
.
multi_position
[
0
];
if
(
flags
&
FF_SHOW
)
{
BEEP_RESET
;
lcd_7seg
(
cm
.
channel_MP
);
lcd_segment
(
LS_SYM_CHANNEL
,
LS_ON
);
lcd_char_num3
(
cm
.
multi_position
[
0
]);
}
}
...
...
@@ -649,6 +702,8 @@ static const key_functions_s key_functions[] = {
#endif
{
13
,
"4WS"
,
KF_2STATE
,
kf_4ws
,
NULL
},
{
14
,
"DIG"
,
KF_2STATE
,
kf_set_switch
,
NULL
},
{
15
,
"MPO"
,
KF_NONE
,
kf_multi_position
,
NULL
},
{
16
,
"MPR"
,
KF_NONE
,
kf_multi_position_reset
,
NULL
},
};
#define KEY_FUNCTIONS_SIZE (sizeof(key_functions) / sizeof(key_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