Skip to content

Instantly share code, notes, and snippets.

@gguuss
Created July 10, 2018 23:54
Show Gist options
  • Save gguuss/9f725356c16e451b715cc553fef794c1 to your computer and use it in GitHub Desktop.
Save gguuss/9f725356c16e451b715cc553fef794c1 to your computer and use it in GitHub Desktop.
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