chiark / gitweb /
do not confuse ourselves if new plan includes existing moving motion
authorian <ian>
Sat, 24 May 2008 01:55:16 +0000 (01:55 +0000)
committerian <ian>
Sat, 24 May 2008 01:55:16 +0000 (01:55 +0000)
hostside/safety.c

index 6b9ca7922871fcf0f898fa3949df641a1959e9c7..289fac377a448214248791281b8ae8eedb010f6d 100644 (file)
@@ -893,12 +893,15 @@ ErrorCode predict(Train *tra, struct timeval tnow, unsigned flags,
 
     /* install the new plan, if any */
     if (seg->motion_newplan) {
-      if (!seg->now_present) {
+      if (seg->motion_newplan == seg->motion) {
+       /* excellent, already doing it */
+      } else if (!seg->now_present) {
        MovPosComb target= movpos_change_intent(seg->motion_newplan);
        ec= movpos_change(seg, target, -1, seg->motion_newplan);
        assert(!ec);
        /* motion is updated by movpos_change */
       } else {
+       /* we'll do it later, then */
        seg->motion= seg->motion_newplan;
       }
       seg->motion_newplan= 0;