Skip to content

Commit

Permalink
brkpedalramp renamed to regenramp because it ramps all regen activity…
Browse files Browse the repository at this point in the history
… now

Increased slip and amplitude filter constant to 4 again
  • Loading branch information
jsphuebner committed Sep 26, 2019
1 parent 3c80aa1 commit 28a8987
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 13 deletions.
4 changes: 2 additions & 2 deletions include/project/param_prj.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#define VER 4.54.R
#define VER 4.55.R

/* Entries must be ordered as follows:
1. Saveable parameters (id != 0)
Expand Down Expand Up @@ -83,7 +83,7 @@
PARAM_ENTRY(CAT_THROTTLE,ampmin, "%", 0, 100, 10, 4 ) \
PARAM_ENTRY(CAT_THROTTLE,slipstart, "%", 10, 100, 50, 90 ) \
PARAM_ENTRY(CAT_REGEN, brknompedal, "%", -100, 0, -50, 38 ) \
PARAM_ENTRY(CAT_REGEN, brkpedalramp,"%/10ms", 1, 100, 100, 68 ) \
PARAM_ENTRY(CAT_REGEN, regenramp, "%/10ms", 1, 100, 100, 68 ) \
PARAM_ENTRY(CAT_REGEN, brknom, "%", 0, 100, 30, 19 ) \
PARAM_ENTRY(CAT_REGEN, brkmax, "%", -100, 0, -30, 49 ) \
PARAM_ENTRY(CAT_REGEN, brkrampstr, "Hz", 0, 400, 10, 39 ) \
Expand Down
2 changes: 1 addition & 1 deletion include/project/throttle.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class Throttle
static s32fp speedkp;
static int speedflt;
static s32fp idleThrotLim;
static s32fp brkPedalRamp;
static s32fp regenRamp;
static s32fp throttleRamp;
static int bmslimhigh;
static int bmslimlow;
Expand Down
4 changes: 2 additions & 2 deletions src/project/pwmgeneration-sine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@ void PwmGeneration::SetTorquePercent(s32fp torque)

ampnomLocal = MIN(ampnomLocal, FP_FROMINT(100));
//anticipate sudden changes by filtering
ampnom = IIRFILTER(ampnom, ampnomLocal, 3);
fslip = IIRFILTER(fslip, fslipspnt, 3);
ampnom = IIRFILTER(ampnom, ampnomLocal, 4);
fslip = IIRFILTER(fslip, fslipspnt, 4);
Param::Set(Param::ampnom, ampnom);
Param::Set(Param::fslipspnt, fslip);

Expand Down
2 changes: 1 addition & 1 deletion src/project/stm32_sine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@ extern void parm_Change(Param::PARAM_NUM paramNum)
Throttle::potmax[1] = Param::GetInt(Param::pot2max);
Throttle::brknom = Param::Get(Param::brknom);
Throttle::brknompedal = Param::Get(Param::brknompedal);
Throttle::brkPedalRamp = Param::Get(Param::brkpedalramp);
Throttle::regenRamp = Param::Get(Param::regenramp);
Throttle::brkmax = Param::Get(Param::brkmax);
Throttle::throtmax = Param::Get(Param::throtmax);
Throttle::idleSpeed = Param::GetInt(Param::idlespeed);
Expand Down
18 changes: 11 additions & 7 deletions src/project/throttle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ int Throttle::speedFiltered;
s32fp Throttle::idleThrotLim;
s32fp Throttle::potnomFiltered;
s32fp Throttle::throtmax;
s32fp Throttle::brkPedalRamp;
s32fp Throttle::brkRamped;
s32fp Throttle::regenRamp;
s32fp Throttle::throttleRamp;
s32fp Throttle::throttleRamped;
int Throttle::bmslimhigh;
Expand Down Expand Up @@ -121,15 +120,20 @@ s32fp Throttle::CalcThrottle(int potval, int pot2val, bool brkpedal)
}
}

if (potnom > throttleRamped)
if (potnom >= throttleRamped)
{
throttleRamped = RAMPUP(throttleRamped, potnom, throttleRamp);
potnom = throttleRamped; // FP_MUL(throttleRamped, throtmax) / 100;
potnom = throttleRamped;
}
else
else if (potnom < throttleRamped && potnom > 0)
{
throttleRamped = potnom; //No ramping from high throttle to low throttle
}
else //potnom < throttleRamped && potnom <= 0
{
throttleRamped = RAMPDOWN(throttleRamped, potnom, throttleRamp);
potnom = throttleRamped; // FP_MUL(throttleRamped, throtmax) / 100;
throttleRamped = MIN(0, throttleRamped); //start ramping at 0
throttleRamped = RAMPDOWN(throttleRamped, potnom, regenRamp);
potnom = throttleRamped;
}

potnom = MIN(potnom, throtmax);
Expand Down

0 comments on commit 28a8987

Please sign in to comment.