36 lines
922 B
C++
36 lines
922 B
C++
#include "leds.h"
|
|
#include <Arduino.h>
|
|
#include <Elog.h>
|
|
#include "../tools/tools.h"
|
|
#include <tools/log.h>
|
|
|
|
extern ActiveErrors active_errors;
|
|
extern WaterData water_data;
|
|
|
|
void display_task(void* parameter)
|
|
{
|
|
LOG(ELOG_LEVEL_DEBUG, "Starting display tasks");
|
|
while (true) {
|
|
if (!is_error(active_errors)) {
|
|
// We have no error, refresh status display and wait half a second
|
|
ledcWrite(LED_GREEN, 255);
|
|
ledcWrite(LED_RED, 0);
|
|
} else {
|
|
ledcWrite(LED_RED, LED_RED_HIGH);
|
|
ledcWrite(LED_GREEN, 0);
|
|
}
|
|
delay(250);
|
|
}
|
|
}
|
|
|
|
|
|
// Setup pin modes etc.
|
|
void led_setup() {
|
|
pinMode(LED_RED, OUTPUT);
|
|
pinMode(LED_GREEN, OUTPUT);
|
|
|
|
ledcAttach(LED_RED, LED_PWM_FREQUENCY, LED_PWM_RESOLUTION);
|
|
ledcAttach(LED_GREEN, LED_PWM_FREQUENCY, LED_PWM_RESOLUTION);
|
|
ledcWrite(LED_RED, LED_RED_HIGH);
|
|
ledcWrite(LED_GREEN, 255);
|
|
} |