Naming and coding style convention, new linter tool. (#945)
* Makefile, Scripts: new linter * About: remove ID from IC * Firmware: remove double define for DIVC/DIVR * Scripts: check folder names too. Docker: replace syntax check with make lint. * Reformat Sources and Migrate to new file naming convention * Docker: symlink clang-format-12 to clang-format * Add coding style guide
This commit is contained in:
33
applications/power_observer/power_observer.c
Normal file
33
applications/power_observer/power_observer.c
Normal file
@@ -0,0 +1,33 @@
|
||||
#include <furi.h>
|
||||
#include <furi_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_srv(void* p) {
|
||||
NotificationApp* notifications = furi_record_open("notification");
|
||||
|
||||
const float overconsumption_limit = 0.03f;
|
||||
|
||||
while(true) {
|
||||
float current = -furi_hal_power_get_battery_current(FuriHalPowerICFuelGauge);
|
||||
|
||||
if(current >= overconsumption_limit) {
|
||||
notification_message_block(notifications, &sequence_overconsumption);
|
||||
}
|
||||
|
||||
delay(1000);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user