File tree Expand file tree Collapse file tree 4 files changed +13
-4
lines changed
Expand file tree Collapse file tree 4 files changed +13
-4
lines changed Original file line number Diff line number Diff line change 141141#define MIN_DISTANCE_TO_END 30 /*in m //FIXME Confirm how far from the end of the tube we need to stop */
142142
143143#define MAX_RUN_TIME 30000000 /* in microseconds, TODO get the real number */
144+ #define MAX_CRAWL_TIME 30000000 /* in microseconds, TODO get the real number */
144145
145146
146147
Original file line number Diff line number Diff line change @@ -156,5 +156,6 @@ int initTimerData() {
156156 data -> timers -> startTime = 0 ;
157157 data -> timers -> lastRetro = 0 ;
158158 for (i = 0 ; i < NUM_RETROS ; i ++ ) data -> timers -> lastRetros [i ] = 0 ;
159+ data -> timers -> crawlTimer = 0 ;
159160 return 0 ;
160161}
Original file line number Diff line number Diff line change @@ -352,6 +352,11 @@ stateTransition_t * stoppedAction() {
352352}
353353
354354stateTransition_t * crawlAction () {
355+
356+ // Start crawl timer
357+ if (data -> timers -> crawlTimer == 0 ){
358+ data -> timers -> crawlTimer = getuSTimestamp ();
359+ }
355360 data -> state = 8 ;
356361 /* Check IMD status */
357362 if (!getIMDStatus ()) {
@@ -379,11 +384,12 @@ stateTransition_t * crawlAction() {
379384 return findTransition (stateMachine .currState , RUN_FAULT_NAME );
380385 }
381386
382- if (getuSTimestamp () - data -> timers -> startTime > MAX_RUN_TIME ){
383- return findTransition (stateMachine .currState , RUN_FAULT_NAME );
384- }
385-
386387 // CHECK TRANSITION CRITERIA
388+
389+ if (getuSTimestamp () - data -> timers -> crawlTimer > MAX_CRAWL_TIME ){
390+ return findTransition (stateMachine .currState , BRAKING_NAME );
391+ }
392+
387393 if (data -> flags -> shouldStop ){
388394 return findTransition (stateMachine .currState , BRAKING_NAME );
389395 }
Original file line number Diff line number Diff line change @@ -76,6 +76,7 @@ typedef struct timers_t {
7676 uint64_t oldRetro ;
7777 uint64_t lastRetro ;
7878 uint64_t lastRetros [NUM_RETROS ];
79+ uint64_t crawlTimer ;
7980} timers_t ;
8081
8182
You can’t perform that action at this time.
0 commit comments