33#include <avr/pgmspace.h>
38#include "LedUpdateState.h"
76 current_backl_brightness = 0;
77 current_console_brightness = 0;
78 current_flood_brightness = 0;
87 uint16_t current_backl_brightness;
88 uint16_t current_console_brightness;
89 uint16_t current_flood_brightness;
101 if (newValue == current_backl_brightness)
return;
102 int scale = map(newValue, 0, 65535, 0, 255);
104 target.nscale8_video(scale);
105 CRGB target2 = NVIS_CGRB_GREEN_A;
106 target2.nscale8_video(scale);
107 current_backl_brightness = newValue;
110 for (
int i = 0; i < n; i++) {
114 if (led.role == LED_INSTR_BL) {
117 if (led.role == LED_INSTR_BL_CGRB) {
132 if (newValue == current_console_brightness)
return;
133 int scale = map(newValue, 0, 65535, 0, 255);
135 target.nscale8_video(scale);
136 current_console_brightness = newValue;
139 for (
int i = 0; i < n; i++) {
143 if (led.role == LED_CONSOLE_BL) {
159 for (
int i = 0; i < n; i++) {
163 if (led.role == role) {
177 if (newValue == current_flood_brightness)
return;
178 current_flood_brightness = newValue;
180 uint8_t scale = map(newValue, 0, 65535, 0, 255);
182 CRGB target = NVIS_WHITE;
183 target.nscale8_video(scale);
186 for (
int i = 0; i < n; i++) {
190 if (led.role == LED_FLOOD) {
208 for (
int i = 0; i < panelLedCount; i++) {
209 ledArray[startIndex + i] = NVIS_BLACK;
213 current_backl_brightness = 0;
214 current_console_brightness = 0;
215 current_flood_brightness = 0;
void setUpdateFlag(bool requireUpdate)
Sets the LED update flag in an atomic operation.
static LedUpdateState * getInstance()
Gets the singleton instance of the LedUpdateState class.
virtual const Led * getLedTable() const
Gets the LED table for this panel.
void setAllLightsOff()
Turns off all lights in this panel, irrespective of their role, and resets brightness state.
void setInstrLights(uint16_t newValue, const CRGB &color=NVIS_GREEN_A)
Set the color of all instrument backlight LEDs.
virtual int getLedCount() const
Gets the number of LEDs in this panel.
void setFloodlights(uint16_t newValue)
Sets the brightness of floodlight LEDs.
Panel()
Protected constructor to prevent direct instantiation.
virtual CRGB * getLedStrip() const
Gets the LED strip for this panel.
virtual int getStartIndex() const
Gets the start index of this panel on the LED strip.
void setConsoleLights(uint16_t newValue, const CRGB &color=NVIS_GREEN_A)
Sets the color of all console backlight LEDs.
void setIndicatorColor(LedRole role, const CRGB &color)
Sets the color of LEDs with a specific role.