diff --git a/src/AmbientLightingThread.h b/src/AmbientLightingThread.h index e3ac447cd4e..e29644e6b61 100644 --- a/src/AmbientLightingThread.h +++ b/src/AmbientLightingThread.h @@ -94,9 +94,9 @@ class AmbientLightingThread : public concurrency::OSThread pinMode(RGBLED_BLUE, OUTPUT); #endif #ifdef HAS_NEOPIXEL - pixels.begin(); // Initialise the pixel(s) - pixels.clear(); // Set all pixel colors to 'off' - pixels.setBrightness(0); //moduleConfig.ambient_lighting.current + pixels.begin(); // Initialise the pixel(s) + pixels.clear(); // Set all pixel colors to 'off' + pixels.setBrightness(0); // moduleConfig.ambient_lighting.current #if defined(ESP32) if (_neoPixelApbLock == nullptr) { esp_err_t err = esp_pm_lock_create(ESP_PM_APB_FREQ_MAX, 0, "neopixel", &_neoPixelApbLock); @@ -113,7 +113,10 @@ class AmbientLightingThread : public concurrency::OSThread #endif } - bool isFlashlightModeActive() const { return _flashlightOverrideActive; } + bool isFlashlightModeActive() const + { + return _flashlightOverrideActive; + } void setFlashlightMode(bool enabled) { @@ -127,13 +130,16 @@ class AmbientLightingThread : public concurrency::OSThread // if (moduleConfig.ambient_lighting.led_state) { // setLighting(); // } else { - setLightingOff(nullptr); + setLightingOff(nullptr); // } } } #if HAS_SOS - bool isSOSModeActive() const { return _sosOverrideActive; } + bool isSOSModeActive() const + { + return _sosOverrideActive; + } void setSOSMode(bool enabled) { @@ -178,10 +184,25 @@ class AmbientLightingThread : public concurrency::OSThread showNotificationMarquee(); return 16; } +#if defined(GAT562) + _bootMarqueeDone = true; + _standbyBreathingActive = true; + showBreathingWhite(); +#else setLightingOff(NULL); _bootMarqueeDone = true; +#endif + } + +#if defined(GAT562) + if (_standbyBreathingActive) { + if (millis() - _lastMarqueeCall > 200) { + showBreathingWhite(); + } + return 30; } #endif +#endif #if defined(HAS_NCP5623) || defined(HAS_LP5562) if ((_type == ScanI2C::NCP5623 || _type == ScanI2C::LP5562) && moduleConfig.ambient_lighting.led_state) { #endif @@ -203,8 +224,10 @@ class AmbientLightingThread : public concurrency::OSThread ScanI2C::DeviceType _type = ScanI2C::DeviceType::NONE; uint32_t _bootEffectUntil = millis() + 3200; bool _bootMarqueeDone = false; + bool _standbyBreathingActive = false; bool _ledOff = false; bool _flashlightOverrideActive = false; + uint32_t _lastMarqueeCall = 0; #if HAS_SOS bool _sosOverrideActive = false; uint8_t _sosPatternIndex = 0; @@ -275,11 +298,14 @@ class AmbientLightingThread : public concurrency::OSThread #endif return 0; } - + protected: void showNotificationMarquee() { #ifdef HAS_NEOPIXEL +#if defined(GAT562) + _lastMarqueeCall = millis(); +#endif static uint16_t marqueeStep = 0; const uint16_t hue = (marqueeStep * 2048U) & 0xFFFF; const uint8_t maxBrightness = 255; @@ -292,7 +318,7 @@ class AmbientLightingThread : public concurrency::OSThread pixels.setPixelColor(head, Adafruit_NeoPixel::ColorHSV(hue, 255, 255)); pixels.setPixelColor(tail, Adafruit_NeoPixel::ColorHSV(hue, 255, 96)); #else - pixels.setPixelColor(0, Adafruit_NeoPixel::ColorHSV(hue, 255, 255)); + pixels.setPixelColor(0, Adafruit_NeoPixel::ColorHSV(hue, 255, 255)); #endif acquireNeoPixelClockLock(); pixels.show(); @@ -301,6 +327,24 @@ class AmbientLightingThread : public concurrency::OSThread #endif } +#if defined(GAT562) && defined(HAS_NEOPIXEL) + void showBreathingWhite() + { + const uint16_t breathPeriodMs = 2000; + const uint8_t maxBrightness = 30; + const uint32_t now = millis(); + const uint16_t phase = (now % breathPeriodMs) * 512UL / breathPeriodMs; + const uint16_t breathValue = phase < 256 ? phase : 511 - phase; + const uint8_t brightness = ((uint32_t)breathValue * maxBrightness) / 255; + + pixels.setBrightness(brightness); + pixels.fill(pixels.Color(255, 255, 255), 0, NEOPIXEL_COUNT); + acquireNeoPixelClockLock(); + pixels.show(); + releaseNeoPixelClockLock(); + } +#endif + #if HAS_SOS && defined(HAS_NEOPIXEL) void handleSOSBlink() { @@ -350,7 +394,7 @@ class AmbientLightingThread : public concurrency::OSThread 200, 200, // dot 200, 200, // dot 200, 200, // dot - 0, 1000, // cycle gap + 0, 1000, // cycle gap }; #endif diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index c1833b18427..18d2a939acb 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -807,7 +807,7 @@ void NodeDB::initConfigIntervals() #endif #if defined(GAT562) - config.display.screen_on_secs = 10; + config.display.screen_on_secs = 30; #endif }