Api Symbols: replace asserts with checks

merge ofw commit
This commit is contained in:
MX
2024-03-25 13:53:32 +03:00
parent 81a16e5a28
commit 585b7f963d
565 changed files with 3544 additions and 2691 deletions

View File

@@ -48,7 +48,7 @@ void power_cli_3v3(Cli* cli, FuriString* args) {
}
}
static void power_cli_command_print_usage() {
static void power_cli_command_print_usage(void) {
printf("Usage:\r\n");
printf("power <cmd> <args>\r\n");
printf("Cmd list:\r\n");
@@ -106,7 +106,7 @@ void power_cli(Cli* cli, FuriString* args, void* context) {
furi_string_free(cmd);
}
void power_on_system_start() {
void power_on_system_start(void) {
#ifdef SRV_CLI
Cli* cli = furi_record_open(RECORD_CLI);

View File

@@ -4,7 +4,7 @@
extern "C" {
#endif
void power_on_system_start();
void power_on_system_start(void);
#ifdef __cplusplus
}

View File

@@ -232,7 +232,7 @@ static ViewPort* power_battery_view_port_alloc(Power* power) {
return battery_view_port;
}
Power* power_alloc() {
Power* power_alloc(void) {
Power* power = malloc(sizeof(Power));
// Records

View File

@@ -5,6 +5,8 @@
#include <update_util/update_operation.h>
void power_off(Power* power) {
furi_check(power);
furi_hal_power_off();
// Notify user if USB is plugged
view_dispatcher_send_to_front(power->view_dispatcher);
@@ -20,13 +22,16 @@ void power_reboot(PowerBootMode mode) {
furi_hal_rtc_set_boot_mode(FuriHalRtcBootModeDfu);
} else if(mode == PowerBootModeUpdateStart) {
furi_hal_rtc_set_boot_mode(FuriHalRtcBootModePreUpdate);
} else {
furi_crash();
}
furi_hal_power_reset();
}
void power_get_info(Power* power, PowerInfo* info) {
furi_assert(power);
furi_assert(info);
furi_check(power);
furi_check(info);
furi_mutex_acquire(power->api_mtx, FuriWaitForever);
memcpy(info, &power->info, sizeof(power->info));
@@ -34,12 +39,12 @@ void power_get_info(Power* power, PowerInfo* info) {
}
FuriPubSub* power_get_pubsub(Power* power) {
furi_assert(power);
furi_check(power);
return power->event_pubsub;
}
bool power_is_battery_healthy(Power* power) {
furi_assert(power);
furi_check(power);
bool is_healthy = false;
furi_mutex_acquire(power->api_mtx, FuriWaitForever);
is_healthy = power->info.health > POWER_BATTERY_HEALTHY_LEVEL;
@@ -48,7 +53,7 @@ bool power_is_battery_healthy(Power* power) {
}
void power_enable_low_battery_level_notification(Power* power, bool enable) {
furi_assert(power);
furi_check(power);
furi_mutex_acquire(power->api_mtx, FuriWaitForever);
power->show_low_bat_level_message = enable;
furi_mutex_release(power->api_mtx);

View File

@@ -62,7 +62,7 @@ static bool power_off_input_callback(InputEvent* event, void* context) {
return true;
}
PowerOff* power_off_alloc() {
PowerOff* power_off_alloc(void) {
PowerOff* power_off = malloc(sizeof(PowerOff));
power_off->view = view_alloc();

View File

@@ -11,7 +11,7 @@ typedef enum {
#include <gui/view.h>
PowerOff* power_off_alloc();
PowerOff* power_off_alloc(void);
void power_off_free(PowerOff* power_off);

View File

@@ -21,7 +21,7 @@ static void power_unplug_usb_draw_callback(Canvas* canvas, void* _model) {
canvas, 64, 32, AlignCenter, AlignCenter, "It's now safe to unplug\nthe USB cable");
}
PowerUnplugUsb* power_unplug_usb_alloc() {
PowerUnplugUsb* power_unplug_usb_alloc(void) {
PowerUnplugUsb* power_unplug_usb = malloc(sizeof(PowerUnplugUsb));
power_unplug_usb->view = view_alloc();

View File

@@ -4,7 +4,7 @@ typedef struct PowerUnplugUsb PowerUnplugUsb;
#include <gui/view.h>
PowerUnplugUsb* power_unplug_usb_alloc();
PowerUnplugUsb* power_unplug_usb_alloc(void);
void power_unplug_usb_free(PowerUnplugUsb* power_unplug_usb);