Almost done trapezioidal model

This commit is contained in:
eddyem
2025-04-11 22:14:43 +03:00
parent 33d7800a62
commit 89d67fd95c
5 changed files with 246 additions and 27 deletions

View File

@@ -78,7 +78,7 @@ static int calc(moveparam_t *x, double t){
T1 = t + ticks_need * time_tick;
}
}
state = ST_CONSTSPEED;
state = ST_MOVE;
Xlast0 = curparams.coord;
if(target.speed > Min.speed) movingstage = STAGE_NORMALSPEED;
else movingstage = STAGE_MINSPEED;
@@ -87,7 +87,7 @@ static int calc(moveparam_t *x, double t){
return TRUE;
}
static void stop(){
static void stop(double _U_ t){
T0 = -1.;
curparams.accel = 0.;
curparams.speed = 0.;
@@ -104,7 +104,7 @@ static movestate_t proc(moveparam_t *next, double t){
else{ if(curparams.coord > target.coord) ooops = TRUE; }
if(ooops){
DBG("OOOps! We are (%g) over target (%g) -> stop", curparams.coord, target.coord);
stop();
stop(t);
if(next) *next = curparams;
return state;
}
@@ -120,7 +120,7 @@ static movestate_t proc(moveparam_t *next, double t){
}
if(fabs(curparams.coord - target.coord) < coord_tolerance){ // we are at place
DBG("OK, we are in place");
stop();
stop(t);
}
if(next) *next = curparams;
return state;