From: ian Date: Thu, 24 Apr 2008 19:09:05 +0000 (+0000) Subject: wip actual debugging X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ijackson/git?a=commitdiff_plain;h=07ce4f507d297c22841313189d78554be966e3c2;p=trains.git wip actual debugging --- diff --git a/hostside/README.commands b/hostside/README.commands index 74c368a..c4e60c8 100644 --- a/hostside/README.commands +++ b/hostside/README.commands @@ -55,6 +55,7 @@ POSSIBLY-ASYNCHRONOUS REPORTING OF MESSAGES TO/FROM (MASTER) PIC U< movpos point U< movpos position moving U< movpos position stable + may be ? for unknown U< debug : U< info : diff --git a/hostside/TODO b/hostside/TODO index 566d1ea..288da9c 100644 --- a/hostside/TODO +++ b/hostside/TODO @@ -1,6 +1,11 @@ +bugs + see fixme in movpos.c + also startup resolve crashes due to findhead_nextseg returning -1 + want to document commands [!]movfeat and speed stop all trains command ? + stop and turn off calmly when ^D optional but maybe before can test: wiring to gui display diff --git a/hostside/analyse-speeds b/hostside/analyse-speeds index 4df9ef9..22e5d5f 100755 --- a/hostside/analyse-speeds +++ b/hostside/analyse-speeds @@ -127,7 +127,7 @@ perl <$o.table.tmp >>$o.record.tmp -ne ' $steps= $nxt-1; die "'$train': expected 126 steps, found $steps\n" unless $steps==126; - for ($step=0; $step<$nxt; $step++) { + for ($step=1; $step<$nxt; $step++) { printf "train %s step %d=%f\n", "'$train'", $step, $speed[$step] or die $!; diff --git a/hostside/errorcodes.h.gen b/hostside/errorcodes.h.gen index 64784a0..c5d5cbc 100755 --- a/hostside/errorcodes.h.gen +++ b/hostside/errorcodes.h.gen @@ -33,7 +33,7 @@ extern $decl; $decl= { \\ END ." ".(join ", \\\n ", map { - '"'.(lc).'"'; + '"'.$_.'"'; } @f).< 1debug movpos/change : confirm point:1... +debug movpos/point : confirm A5 n=1 maxdelay=2147483647 (res: n=1 deadline=[t+]-1) +debug movpos/point : newdeadline=t+-8589933 allow_failure=1 + pt_enqueue +debug movpos/point : pt_enqueue=OK +movpos A5 position ? moving +debug movpos/change : confirm => OK + conf=resv=0; /* If CDU is charged we can do one thing right away */ @@ -334,7 +348,7 @@ static ErrorCode point_confirm(Change *chg, Segment *move, * it back if it doesn't work. */ - if (n_motions >= r->n_motions) + if (n_motions > r->n_motions) return EC_MovFeatReservationInapplicable; assert(n_motions <= r->n_motions); if (maxdelay_ms == -1) { diff --git a/hostside/record.c b/hostside/record.c index b2e1e53..ab504e4 100644 --- a/hostside/record.c +++ b/hostside/record.c @@ -191,7 +191,7 @@ void record_train_home(Train *tra, int backw, Segment *seg) { void record_train_step_speed(Train *tra, int step, double speed) { if (step<1 || step>SPEEDSTEPS) - record_yyerror("speed step out of range 0..127"); + record_yyerror("speed step out of range 0..126"); tra->speedcurve[step]= speed; } @@ -434,6 +434,7 @@ static void parse_file(const char *why) { f= fopen(filename,"r"); if (!f) diee("config: cannot open %s: %s", why, filename); record_yyrestart(f); + record_yylineno= 0; r= record_yyparse(); assert(!r); /* we're supposed to call yyerror which dies */ } diff --git a/hostside/safety.h b/hostside/safety.h index 09eb2b1..f00292d 100644 --- a/hostside/safety.h +++ b/hostside/safety.h @@ -57,7 +57,7 @@ struct Train { int n_speedregimes; SpeedRange *speedregimes; - float speedcurve[SPEEDSTEPS]; + float speedcurve[SPEEDSTEPS+1]; }; struct Segment { diff --git a/hostside/x.gdb b/hostside/x.gdb index a260c70..a162012 100644 --- a/hostside/x.gdb +++ b/hostside/x.gdb @@ -6,7 +6,7 @@ set args -s/dev/ttyUSB0 shinkansen.speeds.record homes.record break vdie break nmra_errchk_fail -break safety_problem +break predict_problem #break resolve.c:337 run