void sta_startup(void) { sta_goto(Sta_Flush); }
static void sta_goto(StartupState new_state) {
+ SEG_IV;
+
toev_stop(&sta_toev);
sta_toev.callback= timedout_onward;
sta_toev.duration= -1;
case Sta_Ping: break;
case Sta_Fault: break;
case Sta_Settling: enco_pic_off(&piob); break;
- case Sta_Resolving: enco_pic_on(&piob); break;
- case Sta_Run: persist_install(); retransmit_start(); break;
+ case Sta_Resolving:
+ FOR_SEG seg->res_detect= 0;
+ enco_pic_on(&piob);
+ break;
+ case Sta_Run:
+ if (resolve_failed)
+ /* in this case, we get stuck - user has to power cycle the layout */
+ return;
+ persist_install();
+ retransmit_start();
+ break;
}
if (piob.l) serial_transmit(&piob);
{ abort(); }
void on_pic_detect1(const PicInsnInfo *pii, const PicInsn *pi, int segn) {
+ Segment *seg;
if (segn >= NUM_SEGMENTS) die("PIC sent detect @#%d out of range",segn);
- if (sta_state < Sta_Run) {
+
+ seg= &segments[segn];
+
+ switch (sta_state) {
+ case Sta_Flush:
+ case Sta_Off:
+ case Sta_Ping:
+ case Sta_Fault:
+ case Sta_Settling:
oprintf(UPO, "warning fixme ignored non-Run detection @%s\n",
info_segments[segn].pname);
- return;
+ break;
+ case Sta_Resolving: seg->res_detect= 1; break;
+ case Sta_Run: safety_notify_detection(seg); break;
}
- safety_notify_detection(&segments[segn]);
}
/*---------- fixme move these to where they want to go ----------*/