diff options
author | SG <who.just.the.doctor@gmail.com> | 2021-08-02 14:15:24 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-02 14:15:24 +0300 |
commit | 95f44f4d332f2e2f2c8eff7e206fc06e5674f230 (patch) | |
tree | d2f38cc7934078a73f5a41ab4c8563d75af9604d /applications/power-observer | |
parent | 35c441f031204a89a418a151e7f159c6cfc92a49 (diff) |
[FL-1625] Overcurrent monitoring. Cli command for external 3.3v dcdc control. (#615)
* Apps: power observer for overcurrent monitoring
* Power: cli command for enable\disable externat 3.3v dcdc
Co-authored-by: あく <alleteam@gmail.com>
Diffstat (limited to 'applications/power-observer')
-rw-r--r-- | applications/power-observer/power-observer.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/applications/power-observer/power-observer.c b/applications/power-observer/power-observer.c new file mode 100644 index 00000000..5a411eca --- /dev/null +++ b/applications/power-observer/power-observer.c @@ -0,0 +1,33 @@ +#include <furi.h> +#include <api-hal.h> +#include <notification/notification-messages.h> + +const NotificationMessage message_green_110 = { + .type = NotificationMessageTypeLedGreen, + .data.led.value = 110, +}; + +static const NotificationSequence sequence_overconsumption = { + &message_green_110, + &message_red_255, + &message_delay_100, + NULL, +}; + +int32_t power_observer(void* p) { + NotificationApp* notifications = furi_record_open("notification"); + + const float overconsumption_limit = 0.03f; + + while(true) { + float current = -api_hal_power_get_battery_current(ApiHalPowerICFuelGauge); + + if(current >= overconsumption_limit) { + notification_message_block(notifications, &sequence_overconsumption); + } + + delay(1000); + } + + return 0; +}
\ No newline at end of file |