Commit 266ebf4e authored by Pavel Semerad's avatar Pavel Semerad
Browse files

added option throttle brake cut-off

parent 0a6339ee
*0.3.2 ()
added option throttle brake cut of to be able to drive forward only
vehicles (boats)
*0.3.1 (26 Jun 2011)
DIG mix can be set to channel 1 to have dual-ESC steering (boat, tank, ...)
......
......@@ -83,19 +83,22 @@ 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
- 4WS and DIG mixes
- mixes 4WS, DIG, throttle brake cut-off (for boats with forward-only throttle)
> choose menu EPOINT and press ENTER-long
> menu EPOINT will blink
> select one of mixes 4WS (4) or DIG (d)
> press ENTER and choose channel for this mix or OFF
- for dual-ESC steering (boat, tank, ...) select DIG channel 1 and
with D/R reduce required ESC travel (at 100% it will go to contra
to allow steering at place)
> press ENTER and set mix in range -100...0...100 %
0% is default and means both channel have same max steering/throttle
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)
> select one of mixes 4WS (4), DIG (d) or brake cut-off (b)
for mixes 4WS, DIG:
> press ENTER and choose channel for this mix or OFF
- for dual-ESC steering (boat, tank, ...) select DIG channel 1 and
with D/R reduce required ESC travel (at 100% it will go to contra
to allow steering at place)
> press ENTER and set mix in range -100...0...100 %
0% is default and means both channel have same max steering/throttle
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 brake cut-off:
> ser OFF or CUT
- Key mapping specific for each model:
> choose menu REV and press ENTER-long
> menu REV will blink
......
......@@ -274,7 +274,7 @@ static void calc_loop(void) {
menu_DIG_mix = (s8)(DIG_mix / PPM(5));
// set it 2 times more to have contra ESC steering, it can be
// reduced by D/R setting
DIG_mix *= 2;
if (!cm.brake_off) DIG_mix *= 2;
}
......@@ -286,6 +286,7 @@ static void calc_loop(void) {
cg.calib_throttle_mid << ADC_OVS_SHIFT,
cg.calib_throttle_bck << ADC_OVS_SHIFT,
cg.throttle_dead_zone << ADC_OVS_SHIFT);
if (cm.brake_off && val > 0) val = 0; // throttle brake cut off
val = expo(val, (u8)(val < 0 ? cm.expo_forward : cm.expo_back));
if (cm.abs_type) {
// apply selected ABS
......@@ -312,8 +313,10 @@ static void calc_loop(void) {
}
}
val = dualrate(val, (u8)(val < 0 ? cm.dr_forward : cm.dr_back));
if (!cm.channel_DIG)
if (!cm.channel_DIG) {
if (cm.brake_off) val = val * 2 + PPM(500);
channel_params(2, val);
}
else {
// DIG mixing
val2 = val;
......@@ -325,6 +328,10 @@ static void calc_loop(void) {
// reduce rear throttle
val2 = (s16)((s32)val2 * (PPM(500) - DIG_mix) / PPM(500));
if (cm.brake_off) {
val = val * 2 + PPM(500);
val2 = val2 * 2 + PPM(500);
}
channel_params(2, val);
channel_params(cm.channel_DIG, val2);
}
......
......@@ -108,6 +108,7 @@ void config_model_set_default(void) {
cm.expo_back = 0;
cm.abs_type = 0;
cm.channel_4WS = 0;
cm.brake_off = 0;
cm.channel_DIG = 0;
cm.channel_MP = 0;
memset(cm.multi_position, (u8)MULTI_POSITION_END, NUM_MULTI_POSITION);
......
......@@ -122,6 +122,7 @@ typedef struct {
s8 expo[3]; // steering/forward/back
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 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
......
......@@ -140,13 +140,36 @@ static u8 mix_DIG(u8 val_id, u8 action) {
}
static u8 mix_brake_off(u8 val_id, u8 action) {
u8 id = val_id;
u8 val;
if (action == 1) {
// change value
cm.brake_off ^= 1;
}
else if (action == 2) {
// select next value
id = 1; // only one item
}
// show value
lcd_7seg(L7_B);
lcd_chars(cm.brake_off ? "CUT" : "OFF");
return id;
}
typedef u8 (*mix_func_t)(u8 val_id, u8 action);
static const mix_func_t menu_funcs[] = {
mix_4WS, mix_DIG
mix_4WS,
mix_DIG,
mix_brake_off,
};
#define MAX_MENU_IDS (sizeof(menu_funcs) / sizeof(void *))
......
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