Skip to content

Commit 731202e

Browse files
init WS2812 LED from main setup(), more logging
1 parent 59da93b commit 731202e

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

multigeiger/multigeiger.ino

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ static Switches switches;
4343
void setup() {
4444
bool isLoraBoard = init_hwtest();
4545
setup_log(DEFAULT_LOG_LEVEL);
46+
setup_status_LED();
4647
setup_display(isLoraBoard);
4748
setup_switches(isLoraBoard);
4849
switches = read_switches(); // only read DIP switches once at boot time

multigeiger/status_led.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
#include <NeoPixelBus.h>
66

7+
#include "log.h"
78
#include "status_led.h"
89

910
#define PIXEL_COUNT 1
@@ -18,7 +19,7 @@ RgbColor black(0, 0, 0);
1819

1920
static NeoPixelBus<NeoRgbFeature, Neo800KbpsMethod> LEDs(PIXEL_COUNT, PIXEL_PIN);
2021

21-
static RgbColor last_col = black;
22+
static RgbColor last_col;
2223

2324
static void set_LED(RgbColor col) {
2425
if (col == last_col)
@@ -29,7 +30,7 @@ static void set_LED(RgbColor col) {
2930
last_col = col;
3031
}
3132

32-
static void init_LED(void) {
33+
void setup_status_LED(void) {
3334
LEDs.Begin(); // all LEDs off
3435
LEDs.Show();
3536
last_col = black; // consistency sw state == hw state
@@ -65,9 +66,10 @@ void indicate(float radiation, unsigned int indication) {
6566
RgbColor col;
6667
static int index = 0; // index counting modulo COLOR_SEQUENCE_LENGTH
6768

69+
log(INFO, "LED index: %d, radiation: %f", index, radiation);
70+
6871
switch (index) {
6972
case 0: // show a fixed dark separator after LED init
70-
init_LED(); // (re-)init the LED
7173
col = black;
7274
break;
7375
case 1:

multigeiger/status_led.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,5 @@
1313
// indicate radiation and special indications via a color time sequence.
1414
// you should call this in regular time intervals [e.g. 1s].
1515
void indicate(float radiation, unsigned int indication);
16+
17+
void setup_status_LED(void);

0 commit comments

Comments
 (0)