From 23ca8ff42c61daa36c55a85c565facd98994d7a0 Mon Sep 17 00:00:00 2001 From: joshua-8 Date: Sun, 11 Dec 2022 01:15:21 -0500 Subject: [PATCH] add app 3 --- src/src.ino | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/src.ino b/src/src.ino index 67f8bdb..e2fc08d 100644 --- a/src/src.ino +++ b/src/src.ino @@ -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" @@ -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 @@ -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();