Finish removing infinite loop
This commit is contained in:
parent
8d95a9367d
commit
e326eee89a
1 changed files with 4 additions and 2 deletions
|
@ -303,7 +303,7 @@ public class MovementFacade
|
||||||
int upTravelCounter = 0;
|
int upTravelCounter = 0;
|
||||||
motorDirectionDown();
|
motorDirectionDown();
|
||||||
motorOn();
|
motorOn();
|
||||||
for(downTravelCounter = 0; downTravelCounter < Integer.MAX_VALUE; downTravelCounter++)
|
for(downTravelCounter = 0; downTravelCounter < TIMEOUT; downTravelCounter++)
|
||||||
{
|
{
|
||||||
try{ Thread.sleep(POLL_WAIT); } catch(Exception e){ ErrorLogging.logError(e); }
|
try{ Thread.sleep(POLL_WAIT); } catch(Exception e){ ErrorLogging.logError(e); }
|
||||||
if(lowerLimit.isOn())
|
if(lowerLimit.isOn())
|
||||||
|
@ -314,12 +314,13 @@ public class MovementFacade
|
||||||
}
|
}
|
||||||
motorOff();
|
motorOff();
|
||||||
if(lowerLimit.isOff()) ErrorLogging.logError("DEBUG: False positive on findDistance down!");
|
if(lowerLimit.isOff()) ErrorLogging.logError("DEBUG: False positive on findDistance down!");
|
||||||
|
if(downTravelCounter == TIMEOUT) throw new Exception("Failed GPIO initialisation!");
|
||||||
|
|
||||||
ErrorLogging.logError("DEBUG: Down travel count: " + downTravelCounter);
|
ErrorLogging.logError("DEBUG: Down travel count: " + downTravelCounter);
|
||||||
|
|
||||||
motorDirectionUp();
|
motorDirectionUp();
|
||||||
motorOn();
|
motorOn();
|
||||||
for(upTravelCounter = 0; upTravelCounter < Integer.MAX_VALUE; upTravelCounter++)
|
for(upTravelCounter = 0; upTravelCounter < TIMEOUT; upTravelCounter++)
|
||||||
{
|
{
|
||||||
try{ Thread.sleep(POLL_WAIT); } catch(Exception e){ ErrorLogging.logError(e); }
|
try{ Thread.sleep(POLL_WAIT); } catch(Exception e){ ErrorLogging.logError(e); }
|
||||||
if(upperLimit.isOn())
|
if(upperLimit.isOn())
|
||||||
|
@ -330,6 +331,7 @@ public class MovementFacade
|
||||||
}
|
}
|
||||||
motorOff();
|
motorOff();
|
||||||
if(upperLimit.isOff()) ErrorLogging.logError("DEBUG: False positive on findDistance up!");
|
if(upperLimit.isOff()) ErrorLogging.logError("DEBUG: False positive on findDistance up!");
|
||||||
|
if(upTravelCounter == TIMEOUT) throw new Exception("Failed GPIO initialisation!");
|
||||||
|
|
||||||
ErrorLogging.logError("DEBUG: Up travel count: " + downTravelCounter);
|
ErrorLogging.logError("DEBUG: Up travel count: " + downTravelCounter);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue