src/main.cpp
/**************************************************************************************************************************/
// loop runs continuously and handles main state machine:
/**************************************************************************************************************************/
loop runs continuously and handles main state machine.
loop runs continuously and handles main state machine .
void loop() {
  if(millis() - myStateMachineTimers.timerOne >= INTERVAL_ONE){
    myStateMachineTimers.timerOne = millis();
    updateDisplaySettings();
  }
  if(millis() - myStateMachineTimers.timerTwo >= INTERVAL_TWO){
    myStateMachineTimers.timerTwo = millis();
    updateDisplayFixedItems();
  }
  if(millis() - myStateMachineTimers.timerThree >= INTERVAL_THREE){
    myStateMachineTimers.timerThree = millis();
    updateDisplayFrames();
  }
  if(firstBoot || millis() - myStateMachineTimers.timerFour >= INTERVAL_FOUR){
    firstBoot = false;
    myStateMachineTimers.timerFour = millis();
    getAndParseCryptoPrice();
    getAndParseWeather();
  }
  if(scrollWeatherDataFlag && millis() - scrollWeatherDataTimer >= weatherScrollInterval){
    scrollWeatherDataTimer = millis();
    scrollWeatherDataDuringFrame();
    weatherDataPosition++;
  }
  if(buttonOnePressed){
    buttonOnePressed = false;
    Serial2.write('\x0C');
    Serial2.println("BUTTON ONE PRESSED");
    delay(2000);
  }
  if(buttonTwoPressed){
    buttonTwoPressed = false;
    Serial2.write('\x0C');
    Serial2.println("BUTTON TWO PRESSED");
    delay(2000);
  }
}
void loop ( ) { if ( millis ( ) - myStateMachineTimers . timerOne >= INTERVAL_ONE ) { myStateMachineTimers . timerOne = millis ( ) ; updateDisplaySettings ( ) ; } if ( millis ( ) - myStateMachineTimers . timerTwo >= INTERVAL_TWO ) { myStateMachineTimers . timerTwo = millis ( ) ; updateDisplayFixedItems ( ) ; } if ( millis ( ) - myStateMachineTimers . timerThree >= INTERVAL_THREE ) { myStateMachineTimers . timerThree = millis ( ) ; updateDisplayFrames ( ) ; } if ( firstBoot || millis ( ) - myStateMachineTimers . timerFour >= INTERVAL_FOUR ) { firstBoot = false ; myStateMachineTimers . timerFour = millis ( ) ; getAndParseCryptoPrice ( ) ; getAndParseWeather ( ) ; } if ( scrollWeatherDataFlag && millis ( ) - scrollWeatherDataTimer >= weatherScrollInterval ) { scrollWeatherDataTimer = millis ( ) ; scrollWeatherDataDuringFrame ( ) ; weatherDataPosition ++ ; } if ( buttonOnePressed ) { buttonOnePressed = false ; Serial2 . write ( ' \x0C ' ) ; Serial2 . println ( " " ) ; delay ( 2000 ) ; } if ( buttonTwoPressed ) { buttonTwoPressed = false ; Serial2 . write ( ' \x0C ' ) ; Serial2 . println ( " " ) ; delay ( 2000 ) ; } }
loop runs continuously and handles main state machine:
loop runs continuously and handles main state machine :
//update display settings //update display fixed items //update display frames //update crypto prices //for scroll items - we must handle in main loop to avoid delays //scrollWeatherDataFlag = false; //hardware test for button one //clear the VFD //hardware test for button two //clear the VFD