diff --git a/include/FSMGlobals.h b/include/FSMGlobals.h index 5cf1a94..eb1d0d8 100644 --- a/include/FSMGlobals.h +++ b/include/FSMGlobals.h @@ -39,6 +39,7 @@ typedef struct { uint8_t resumeStateIdx = 0; //!< Index of the state that should be resumed upon reboot uint8_t menuMainPointerIdx = 0; //!< MenuMain: Index of the menu cursor + uint8_t prideFlagModeIdx = 1; //!< DisplayPrideFlag: Mode selector uint8_t animRainbowIdx = 0; //!< AnimateRainbow: Mode selector uint8_t animSnakeIdx = 0; //!< AnimateSnake: Mode selector diff --git a/include/FSMState.h b/include/FSMState.h index 97aff12..f4ad10c 100644 --- a/include/FSMState.h +++ b/include/FSMState.h @@ -216,7 +216,7 @@ struct AnimateSnake : public FSMState { }; /** - * @brief Displays pusling color + * @brief Displays pulsing color */ struct AnimateHeartbeat : public FSMState { uint32_t tick = 0; diff --git a/lib/EFLed/EFLed.cpp b/lib/EFLed/EFLed.cpp index fe02eed..bcb7356 100644 --- a/lib/EFLed/EFLed.cpp +++ b/lib/EFLed/EFLed.cpp @@ -61,7 +61,7 @@ void EFLedClass::init() { this->init(EFLED_MAX_BRIGHTNESS_DEFAULT); } -void EFLedClass::init(const uint8_t max_brightness) { +void EFLedClass::init(const uint8_t absolute_max_brightness) { for (uint8_t i = 0; i < EFLED_TOTAL_NUM; i++) { this->led_data[i] = CRGB::Black; } @@ -71,7 +71,7 @@ void EFLedClass::init(const uint8_t max_brightness) { FastLED.addLeds(this->led_data, EFLED_TOTAL_NUM); LOGF_DEBUG("(EFLed) Added new WS2812B: %d LEDs @ PIN %d\r\n", EFLED_TOTAL_NUM, EFLED_PIN_LED_DATA); - this->max_brightness = max_brightness; + this->max_brightness = absolute_max_brightness; FastLED.setBrightness(this->max_brightness); LOGF_DEBUG("(EFLed) Set max_brightness=%d\r\n", this->max_brightness) diff --git a/lib/EFLed/EFLed.h b/lib/EFLed/EFLed.h index 5f0f4d4..6bfb030 100644 --- a/lib/EFLed/EFLed.h +++ b/lib/EFLed/EFLed.h @@ -97,10 +97,10 @@ class EFLedClass { * @brief Initializes this EFLed instance. Creates internal data structures, * resets FastLED library and initializes power circuit. * - * @param max_brightness Maximum raw brightness (0-255) the LEDs will + * @param absolute_max_brightness Maximum raw brightness (0-255) the LEDs will * be allowed to be set to. */ - void init(const uint8_t max_brightness); + void init(const uint8_t absolute_max_brightness); /** * @brief Enables the +5V power domain diff --git a/lib/EFTouch/EFTouch.h b/lib/EFTouch/EFTouch.h index 78b3763..7c028cd 100644 --- a/lib/EFTouch/EFTouch.h +++ b/lib/EFTouch/EFTouch.h @@ -35,8 +35,8 @@ #define EFTOUCH_PIN_TOUCH_NOSE 1 #define EFTOUCH_CALIBRATE_NUM_SAMPLES 10 -#define EFTOUCH_SHORTPRESS_DURATION_MS 500 -#define EFTOUCH_LONGPRESS_DURATION_MS 2000 +#define EFTOUCH_SHORTPRESS_DURATION_MS 450 +#define EFTOUCH_LONGPRESS_DURATION_MS 1800 /** * @brief Driver for touch sensors diff --git a/src/main.cpp b/src/main.cpp index 487fba8..52278fe 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -32,7 +32,6 @@ #include #include #include -#include #include #include "FSM.h" @@ -41,6 +40,8 @@ // Global objects and states constexpr unsigned int INTERVAL_BATTERY_CHECK = 60000; +// Initalizing the board with a brightness above 49 can cause stability issues! +constexpr uint8_t ABSOLUTE_MAX_BRIGHTNESS = 45; FSM fsm(10); EFBoardPowerState pwrstate; @@ -115,7 +116,7 @@ void _softBrownOutHandler() { EFBoard.disableWifi(); EFLed.clear(); EFLed.enablePower(); - EFLed.setBrightnessPercent(50); + EFLed.setBrightnessPercent(40); // Soft brown out can only be cleared by board reset but can escalate to hard brown out while (1) { @@ -166,18 +167,18 @@ void bootupAnimation() { delay(100); // Origin point. Power-Button is 11, 25. Make it originate from where the hand is - constexpr int16_t pwrX = -20; - constexpr int16_t pwrY = 26; + constexpr int16_t pwrX = -30; + constexpr int16_t pwrY = 16; uint8_t hue = 120; // Green for (uint16_t n = 0; n < 30; n++) { - uint16_t n_scaled = n * 8; + uint16_t n_scaled = n * 7; for (uint8_t i = 0; i < EFLED_TOTAL_NUM; i++) { int16_t dx = EFLedClass::getLEDPosition(i).x - pwrX; int16_t dy = EFLedClass::getLEDPosition(i).y - pwrY; float distance = sqrt(dx * dx + dy * dy); - float intensity = wave_function(distance, n_scaled / 2 - 60, n_scaled * 2 + 20, 1.0); + float intensity = wave_function(distance, n_scaled / 2 - 30, n_scaled * 2 + 20, 1.0); intensity = intensity * intensity; // sharpen wave // energy front @@ -188,23 +189,23 @@ void bootupAnimation() { delay(15); } EFLed.clear(); - delay(200); + delay(400); // dragon awakens ;-) EFLed.setDragonEye(CRGB(10,0, 0)); - delay(50); + delay(60); EFLed.setDragonEye(CRGB(50,0, 0)); delay(80); EFLed.setDragonEye(CRGB(100,0, 0)); delay(150); EFLed.setDragonEye(CRGB(200,0, 0)); - delay(600); + delay(700); EFLed.setDragonEye(CRGB(100,0, 0)); - delay(100); + delay(80); EFLed.setDragonEye(CRGB(50,0, 0)); - delay(100); - EFLed.setDragonEye(CRGB(10,0, 0)); delay(80); + EFLed.setDragonEye(CRGB(10,0, 0)); + delay(60); EFLed.setDragonNose(CRGB::Black); delay(200); } @@ -215,7 +216,7 @@ void bootupAnimation() { void setup() { // Init board EFBoard.setup(); - EFLed.init(30); + EFLed.init(ABSOLUTE_MAX_BRIGHTNESS); bootupAnimation(); // Touchy stuff diff --git a/src/states/AnimateHeartbeat.cpp b/src/states/AnimateHeartbeat.cpp index 7cea360..1f4cc5e 100644 --- a/src/states/AnimateHeartbeat.cpp +++ b/src/states/AnimateHeartbeat.cpp @@ -34,7 +34,7 @@ bool AnimateHeartbeat::shouldBeRemembered() { } const unsigned int AnimateHeartbeat::getTickRateMs() { - return 70; + return 60; } void AnimateHeartbeat::entry() {