secondary LED added
This commit is contained in:
parent
cad13b72a1
commit
6604d3f694
@ -38,5 +38,6 @@ void rgb_set_color(uint16_t hue);
|
||||
void blink_LED(uint16_t set_color, uint16_t set_blinkduration);
|
||||
void ledLoop(void *parameter);
|
||||
void switch_LED(uint8_t state);
|
||||
void switch_LED1(uint8_t state);
|
||||
|
||||
#endif
|
@ -131,7 +131,8 @@ void refreshtheDisplay() {
|
||||
|
||||
uint8_t msgWaiting;
|
||||
char timeState, buff[16];
|
||||
const time_t t = myTZ.toLocal(now()); // note: call now() here *before* locking mutex!
|
||||
const time_t t =
|
||||
myTZ.toLocal(now()); // note: call now() here *before* locking mutex!
|
||||
|
||||
// block i2c bus access
|
||||
if (I2C_MUTEX_LOCK()) {
|
||||
|
@ -20,7 +20,8 @@
|
||||
#define EXT_POWER_ON 0
|
||||
#define EXT_POWER_OFF 1
|
||||
|
||||
#define HAS_LED (12) // on board LED
|
||||
#define HAS_LED (2) // on board green LED
|
||||
#define HAS_LED1 (12) // on board red LED
|
||||
//#define HAS_BUTTON (0) // on board button -> don't use, is same as RTC_INT!
|
||||
|
||||
// Pins for I2C interface of OLED Display
|
||||
|
20
src/led.cpp
20
src/led.cpp
@ -107,6 +107,26 @@ void switch_LED(uint8_t state) {
|
||||
#endif
|
||||
}
|
||||
|
||||
void switch_LED1(uint8_t state) {
|
||||
#if (HAS_LED1 != NOT_A_PIN)
|
||||
if (state == LED_ON) {
|
||||
// switch LED on
|
||||
#ifdef LED1_ACTIVE_LOW
|
||||
digitalWrite(HAS_LED1, LOW);
|
||||
#else
|
||||
digitalWrite(HAS_LED1, HIGH);
|
||||
#endif
|
||||
} else if (state == LED_OFF) {
|
||||
// switch LED off
|
||||
#ifdef LED1_ACTIVE_LOW
|
||||
digitalWrite(HAS_LED1, HIGH);
|
||||
#else
|
||||
digitalWrite(HAS_LED1, LOW);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void blink_LED(uint16_t set_color, uint16_t set_blinkduration) {
|
||||
#if (HAS_LED != NOT_A_PIN) || defined(HAS_RGB_LED)
|
||||
LEDColor = set_color; // set color for RGB LED
|
||||
|
@ -195,7 +195,11 @@ void setup() {
|
||||
#if (HAS_LED != NOT_A_PIN)
|
||||
pinMode(HAS_LED, OUTPUT);
|
||||
strcat_P(features, " LED");
|
||||
// switch on power LED if we have 2 LEDs, else use it for status
|
||||
#if (HAS_LED1 != NOT_A_PIN)
|
||||
pinMode(HAS_LED1, OUTPUT);
|
||||
strcat_P(features, " LED1");
|
||||
#endif
|
||||
// use LED for power display if we have additional RGB LED, else for status
|
||||
#ifdef HAS_RGB_LED
|
||||
switch_LED(LED_ON);
|
||||
strcat_P(features, " RGB");
|
||||
|
@ -130,8 +130,10 @@ void IRAM_ATTR CLOCKIRQ(void) {
|
||||
xTaskNotifyFromISR(ClockTask, uint32_t(now()), eSetBits,
|
||||
&xHigherPriorityTaskWoken);
|
||||
|
||||
#ifdef HAS_DISPLAY
|
||||
#if (defined GPS_INT || defined RTC_INT)
|
||||
TimePulseTick = !TimePulseTick; // flip pulse ticker
|
||||
#endif
|
||||
#endif
|
||||
|
||||
portEXIT_CRITICAL_ISR(&mux);
|
||||
@ -213,6 +215,7 @@ void clock_loop(void *taskparameter) { // ClockTask
|
||||
|
||||
#define nextmin(t) (t + DCF77_FRAME_SIZE + 1) // next minute
|
||||
|
||||
static bool led1_state = false;
|
||||
uint32_t printtime;
|
||||
time_t t = *((time_t *)taskparameter), last_printtime = 0; // UTC time seconds
|
||||
TickType_t startTime;
|
||||
@ -243,6 +246,14 @@ void clock_loop(void *taskparameter) { // ClockTask
|
||||
|
||||
last_printtime = t;
|
||||
|
||||
#ifdef HAS_LED1
|
||||
if (led1_state)
|
||||
switch_LED1(LED_OFF);
|
||||
else
|
||||
switch_LED1(LED_ON);
|
||||
led1_state = !led1_state;
|
||||
#endif
|
||||
|
||||
#if defined HAS_IF482
|
||||
|
||||
vTaskDelayUntil(&startTime, txDelay); // wait until moment to fire
|
||||
|
Loading…
Reference in New Issue
Block a user