-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add optional support for WS2812 RGB LED, fixes #106 #178
base: master
Are you sure you want to change the base?
Conversation
100b1f9
to
861e456
Compare
multigeiger/status_led.cpp
Outdated
if(radiation > 1.0) { | ||
col = red; | ||
} else | ||
if(radiation > 0.2) { | ||
col = yellow; | ||
} else | ||
if(radiation > 0.01) { | ||
col = green; | ||
} else { | ||
col = black; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just hardcoded some values for now. Final thresholds to be discussed / defined.
multigeiger/status_led.cpp
Outdated
void indicate(float radiation, unsigned int indication) { | ||
// do nothing | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Due to this dummy we do not need lots of preprocessor boilerplate code at each place where we call indicate().
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There could be also serial output here (if there is no LED / LED is switched off).
06391ab
to
afb6995
Compare
b3d5503
to
d98c9de
Compare
rebased on master, fixed some led init issue. on my hw it still shows wrong colors, maybe a hw issue. |
specific indexes in the LED color time sequence are used for: - dark separator indicates "start of sequence" (also used for LED init and re-init) - color according to indications (3bits encoded via RGB color) (can be extended to show up to 32 indication bits) (dark if there is nothing to indicate) - white separator indicates "start of radiation display" (also works as LED test, white = R on + G on + B on) - color according to radiation (repeated, displayed most of the time) dark (unusually low / 0) green (normal) yellow (more than normal) red (much more than normal)
needs to be done by iotwebconf config item.
Just had a quick view. This looks quite complex for a simple LED alarm (if that was the case) - and I admit I don't remember what we discussed a year ago 😄 Proposition:
CO2 color example:
|
The reason why it looks complex is that it is not only indicating one value (radiation), but also some more state infos from. So I implemented a small state machine to signal more information serially. Some color computation like you showed for co2 might be useful. I'll try it as soon as my led shows the colors I want. |
specific indexes in the LED color time sequence are used for:
dark separator indicates "start of sequence"
(also used for LED init and re-init)
color according to indications (3bits encoded via RGB color)
(can be extended to show up to 32 indication bits)
white separator indicates "start of radiation display"
(also works as LED test, white = R on + G on + B on)
color according to radiation (repeated, displayed most of the time)
dark (unusually low / 0)
green (normal)
yellow (more than normal)
red (much more than normal)
Still working on this, do not merge yet.