Pyrrha-Platform / Pyrrha-Z

Next-generation firmware built on the Zephyr RTOS.
Apache License 2.0
2 stars 0 forks source link

WIP: Add LED Alerts #16

Open bpbradley opened 2 years ago

bpbradley commented 2 years ago

Closes #14

This PR will implement local alert processing. Until #15 is merged and led notifications are added, this is all that can be done.

bpbradley commented 2 years ago

Latest commits add the ability to override the led status directly. This would be used eventually by the bluetooth connected host to directly set the led color.

Instead of just allowing red / green / blue with 0/1/2 like the old firmware did, I am allowing any color to be set with a 24-bit hex value.

The override / release process should be thread safe, as access to the only variable which controls override is mutex guarded everywhere.

Right now, the alerts work exactly as the old system did -- an override takes precedence on the alert condition, and in the event of no override, an alert is generated locally by thresholding all the sensor values. In the locally generated alert, any over-threshold condition results in a solid RED led color.

Of course, this can be changed eventually, but I just reproduced the old behavior for now. It probably makes sense for there to be different alert colors, and perhaps for the led to blink (blinking will require a bit of a refactor, but that is expected).