and nothing else. command speed 1 then speed 0
should now own X12 too but does not
-bugs
on decel done, should replan train location to release future
segments no longer required
to reproduce: put shinkansen nose car at A6 (home location)
and nothing else. command speed 126 then 0
+bugs
resolution algorithm is fundamentally incorrect as it
depends on always detecting both ends of the train
also apparently on detecting all of the middle ?!
static void decel_done(TimeoutEvent *toev) {
Train *tra= (void*)((char*)toev - offsetof(Train, speed.decel));
+ struct timeval tnow;
+ ErrorCode ec;
+
tra->speed.speed= tra->speedcurve[tra->speed.step];
+
DPRINTF(speed,core, "decel_done %s step %d speed %f\n",
tra->pname, tra->speed.step, tra->speed.speed);
+ mgettimeofday(&tnow);
+
+ ec= predict(tra,tnow, PREDF_OLDPLAN, 0,0, 0, 0,(char*)"deceleration done");
+ assert(!ec);
}
static const SpeedRange *stop_info(Train *tra, double speed) {
if (left_to_go <= 0) {
DPRINTF(speed,query, "current? decel-done\n");
- toev_stop(&tra->speed.decel);
- decel_done(&tra->speed.decel);
+ /* we don't cancel the timeout because we need the callback to lay out
+ * the train again at the lower speed */
return tra->speed.speed;
}