Created
July 10, 2018 23:54
-
-
Save gguuss/9f725356c16e451b715cc553fef794c1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void loop(void) { | |
unsigned long currTime = millis(); | |
if (!booted){ | |
bootLoop(); | |
} | |
if (hasStrip){ | |
blinkyLoop(moveConfig ); | |
} | |
// Serial command interface | |
//cliLoop(); | |
// Update configuration | |
if (backoff()) { | |
int newConfig = getHexConfig(); | |
if (newConfig != moveConfig) { | |
configChange = true; // TODO: tihs moves to version | |
} | |
if (newConfig != -1){ | |
resetBackoff(); | |
moveConfig = newConfig; | |
Serial.println("Device config now: " + String(newConfig)); | |
blinkyLoop(newConfig); | |
} | |
lastConfig = currTime; | |
} | |
// Update position | |
if (configChange) { | |
processConfig(moveConfig); | |
configChange = false; // remove to continuously process config | |
} else { | |
// Wait for sensor input to change | |
if (rangeWait) { | |
waitForEcho(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment