Skip to content

Commit

Permalink
add app 3
Browse files Browse the repository at this point in the history
  • Loading branch information
joshua-8 committed Dec 11, 2022
1 parent 20edeb1 commit 23ca8ff
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions src/src.ino
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#define MOCK_FUNCTIONS // uncomment to make update_fsm call mock functions
#endif

#define APPLICATION 1 // 0=display the speed, 1==display the time, 2==IR and watchdog test
#define APPLICATION 3 // 0=display the speed, 1==display the time, 2==IR and watchdog test, 3== both 1 and 2

#include "clock_time.h"
#include "font.h"
Expand Down Expand Up @@ -103,7 +103,7 @@ void setup()
runAllTests(); // runAllTests never exits
#endif

#if APPLICATION == 1
#if ((APPLICATION == 1) || (APPLICATION == 3))
leds[0] = CRGB(0, 0, 255);
FastLED.show();
getStartTime(); // takes a few seconds to connect to wifi and get the time
Expand Down Expand Up @@ -167,6 +167,23 @@ void loop()
}
#endif

#if APPLICATION == 3
char text[20];
if (most_recent_ir_angle == -1 || micros() - last_ir_micros > 10000000) { // show time if no ir angle or it's been 10 seconds
most_recent_ir_angle = -1;
clearDisplay();
char* text = getCurrentTime();
printString(text, -millis() / 60, CHSV(millis() / 10, 255, 245), CRGB(0, 0, 0), staged_image, image_width);
} else { // show text
clearDisplay();
sprintf(text, "1600");
printString(text, most_recent_ir_angle - 15, CHSV(millis() / 10, 255, 255), CRGB(0, 0, 0), staged_image, image_width);
if (most_recent_ir_angle > 110) {
delay(300); // causes watchdog timer to reboot the MCU
}
}
#endif

staged_image_new = true;

petWatchdog();
Expand Down

0 comments on commit 23ca8ff

Please sign in to comment.