From 9baff9659cdfda7b92f1bd5b5f1bea8dcdc0c6a2 Mon Sep 17 00:00:00 2001 From: ian Date: Sat, 12 Feb 2005 21:12:16 +0000 Subject: [PATCH] wip --- hostside/safety.c | 8 ++++++++ hostside/safety.h | 15 ++++++++++----- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/hostside/safety.c b/hostside/safety.c index a73bf2e..5969300 100644 --- a/hostside/safety.c +++ b/hostside/safety.c @@ -6,6 +6,14 @@ State safety_actual; +typedef struct TrackFollow TrackFollow; +struct TrackFollow { +}; + +void trackfollow_begin(TrackFollow*, SegmentIx begin, unsigned backwards, + Distance); + + void safety_train_changed(TrainIx trai) { State *s = &safety_actual; TrainState *tra = s->tras[trai]; diff --git a/hostside/safety.h b/hostside/safety.h index 1825811..f552218 100644 --- a/hostside/safety.h +++ b/hostside/safety.h @@ -10,14 +10,19 @@ typedef unsigned char Speed; /* non-negative, units of 4mm/s */ typedef struct { SegmentIx foredetect; - unsigned justarrived:1, reverse:1; + unsigned + justarrived:1, /* is stopped just after triggering foredetect segment */ + reverse:1; /* train is moving backwards wrt its own front and back */ Speed speed; } TrainState; typedef struct { - unsigned present_now:1, present_future:1, - detectable_now:1, detectable_future:1, - sideways:1, autostop:1; + unsigned + present_now:1, present_future:1, /* owning train is or will use space */ + detectable_now:1, detectable_future:1, /* owning train draws current */ + reverse:1, /* owning train's motion is (would be) backwards wrt track */ + sideways:1, /* for segment with points, points are set to `alternative' */ + autostop:1; /* owning train is slow and should stop on detection */ TrainIx owner; /*polarity?*/ } SegmentState; @@ -36,7 +41,7 @@ typedef struct { typedef struct { Speed maxspeed; int n_detections; - const Distance *detections; /* incremental distances from front */ + const Distance *detections; /* incremental distances from rear */ } TrainInfo; -- 2.30.2