mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-04 02:09:30 +02:00
Fix compiler warnings for led_handler
This commit is contained in:
parent
7210e9fbe1
commit
715d269f61
2 changed files with 12 additions and 9 deletions
|
@ -30,7 +30,6 @@ led_color led_get_color() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void LED::exe(void) {
|
void LED::exe(void) {
|
||||||
static bool test_all_colors = true;
|
|
||||||
// Don't run too often
|
// Don't run too often
|
||||||
if (!timer.elapsed()) {
|
if (!timer.elapsed()) {
|
||||||
return;
|
return;
|
||||||
|
@ -93,7 +92,6 @@ void LED::classic_run(void) {
|
||||||
|
|
||||||
void LED::flow_run(void) {
|
void LED::flow_run(void) {
|
||||||
// Determine how bright the LED should be
|
// Determine how bright the LED should be
|
||||||
bool power_positive;
|
|
||||||
int16_t power_W = datalayer.battery.status.active_power_W;
|
int16_t power_W = datalayer.battery.status.active_power_W;
|
||||||
if (power_W < -50) {
|
if (power_W < -50) {
|
||||||
// Discharging
|
// Discharging
|
||||||
|
@ -178,7 +176,7 @@ void LED::rainbow_run(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Assemble the color
|
// Assemble the color
|
||||||
uint32_t color = (static_cast<uint32_t>(r) << 16) | (static_cast<uint32_t>(g) << 8) | b;
|
//uint32_t color = (static_cast<uint32_t>(r) << 16) | (static_cast<uint32_t>(g) << 8) | b;
|
||||||
pixels.setPixelColor(0, pixels.Color(r, g, b)); // RGB
|
pixels.setPixelColor(0, pixels.Color(r, g, b)); // RGB
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,14 +13,19 @@ class LED {
|
||||||
led_color color = led_color::GREEN;
|
led_color color = led_color::GREEN;
|
||||||
|
|
||||||
LED()
|
LED()
|
||||||
: mode(led_mode::CLASSIC),
|
: pixels(1, LED_PIN, NEO_GRB + NEO_KHZ800),
|
||||||
max_brightness(LED_MAX_BRIGHTNESS),
|
max_brightness(LED_MAX_BRIGHTNESS),
|
||||||
pixels(1, LED_PIN, NEO_GRB + NEO_KHZ800),
|
brightness(LED_MAX_BRIGHTNESS),
|
||||||
|
mode(led_mode::CLASSIC),
|
||||||
|
state(LED_NORMAL),
|
||||||
timer(LED_EXECUTION_FREQUENCY) {}
|
timer(LED_EXECUTION_FREQUENCY) {}
|
||||||
|
|
||||||
LED(led_mode mode)
|
LED(led_mode mode)
|
||||||
: mode(mode),
|
: pixels(1, LED_PIN, NEO_GRB + NEO_KHZ800),
|
||||||
max_brightness(LED_MAX_BRIGHTNESS),
|
max_brightness(LED_MAX_BRIGHTNESS),
|
||||||
pixels(1, LED_PIN, NEO_GRB + NEO_KHZ800),
|
brightness(LED_MAX_BRIGHTNESS),
|
||||||
|
mode(mode),
|
||||||
|
state(LED_NORMAL),
|
||||||
timer(LED_EXECUTION_FREQUENCY) {}
|
timer(LED_EXECUTION_FREQUENCY) {}
|
||||||
|
|
||||||
void exe(void);
|
void exe(void);
|
||||||
|
@ -30,7 +35,7 @@ class LED {
|
||||||
Adafruit_NeoPixel pixels;
|
Adafruit_NeoPixel pixels;
|
||||||
uint8_t max_brightness;
|
uint8_t max_brightness;
|
||||||
uint8_t brightness;
|
uint8_t brightness;
|
||||||
led_mode mode = led_mode::CLASSIC;
|
led_mode mode;
|
||||||
led_state state = LED_NORMAL;
|
led_state state = LED_NORMAL;
|
||||||
MyTimer timer;
|
MyTimer timer;
|
||||||
|
|
||||||
|
@ -46,4 +51,4 @@ void led_init(void);
|
||||||
void led_exe(void);
|
void led_exe(void);
|
||||||
led_color led_get_color(void);
|
led_color led_get_color(void);
|
||||||
|
|
||||||
#endif
|
#endif // LED_H_
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue