Build system improvements and bug fixes (#1129)
* Assets: recompile * Makefile: add debug_other to main makefile * Github: stop compilation if compiled assets not in sync with assets sources * Assets: recompile * Makefile: correct debug_other rule. Bt: prevent on system start hook from waiting for bt service * Power, FuriHal: gauge self check report * Loader: move on system start hook call to the beginning
This commit is contained in:
@@ -189,6 +189,8 @@ static void bt_cli_print_usage() {
|
||||
}
|
||||
|
||||
static void bt_cli(Cli* cli, string_t args, void* context) {
|
||||
furi_record_open("bt");
|
||||
|
||||
string_t cmd;
|
||||
string_init(cmd);
|
||||
BtSettings bt_settings;
|
||||
@@ -235,16 +237,15 @@ static void bt_cli(Cli* cli, string_t args, void* context) {
|
||||
}
|
||||
|
||||
string_clear(cmd);
|
||||
furi_record_close("bt");
|
||||
}
|
||||
|
||||
void bt_on_system_start() {
|
||||
#ifdef SRV_CLI
|
||||
Cli* cli = furi_record_open("cli");
|
||||
furi_record_open("bt");
|
||||
cli_add_command(cli, "bt", CliCommandFlagDefault, bt_cli, NULL);
|
||||
furi_record_close("bt");
|
||||
furi_record_close("cli");
|
||||
#else
|
||||
UNUSED(bt_cli);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@@ -455,18 +455,17 @@ void loader_update_menu() {
|
||||
}
|
||||
|
||||
int32_t loader_srv(void* p) {
|
||||
FURI_LOG_I(TAG, "Starting");
|
||||
FURI_LOG_I(TAG, "Executing system start hooks");
|
||||
for(size_t i = 0; i < FLIPPER_ON_SYSTEM_START_COUNT; i++) {
|
||||
FLIPPER_ON_SYSTEM_START[i]();
|
||||
}
|
||||
|
||||
FURI_LOG_I(TAG, "Starting");
|
||||
loader_instance = loader_alloc();
|
||||
|
||||
loader_build_menu();
|
||||
loader_build_submenu();
|
||||
|
||||
// Call on start hooks
|
||||
for(size_t i = 0; i < FLIPPER_ON_SYSTEM_START_COUNT; i++) {
|
||||
FLIPPER_ON_SYSTEM_START[i]();
|
||||
}
|
||||
|
||||
FURI_LOG_I(TAG, "Started");
|
||||
|
||||
furi_record_create("loader", loader_instance);
|
||||
|
26
applications/power/power_service/power.c
Executable file → Normal file
26
applications/power/power_service/power.c
Executable file → Normal file
@@ -12,14 +12,19 @@ void power_draw_battery_callback(Canvas* canvas, void* context) {
|
||||
furi_assert(context);
|
||||
Power* power = context;
|
||||
canvas_draw_icon(canvas, 0, 1, &I_Battery_26x8);
|
||||
canvas_draw_box(canvas, 2, 3, (power->info.charge + 4) / 5, 4);
|
||||
if(power->state == PowerStateCharging) {
|
||||
canvas_set_bitmap_mode(canvas, 1);
|
||||
canvas_set_color(canvas, ColorWhite);
|
||||
canvas_draw_icon(canvas, 8, 0, &I_Charging_lightning_mask_9x10);
|
||||
canvas_set_color(canvas, ColorBlack);
|
||||
canvas_draw_icon(canvas, 8, 0, &I_Charging_lightning_9x10);
|
||||
canvas_set_bitmap_mode(canvas, 0);
|
||||
|
||||
if(power->info.gauge_is_ok) {
|
||||
canvas_draw_box(canvas, 2, 3, (power->info.charge + 4) / 5, 4);
|
||||
if(power->state == PowerStateCharging) {
|
||||
canvas_set_bitmap_mode(canvas, 1);
|
||||
canvas_set_color(canvas, ColorWhite);
|
||||
canvas_draw_icon(canvas, 8, 0, &I_Charging_lightning_mask_9x10);
|
||||
canvas_set_color(canvas, ColorBlack);
|
||||
canvas_draw_icon(canvas, 8, 0, &I_Charging_lightning_9x10);
|
||||
canvas_set_bitmap_mode(canvas, 0);
|
||||
}
|
||||
} else {
|
||||
canvas_draw_box(canvas, 8, 4, 8, 2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,6 +124,7 @@ static void power_check_charging_state(Power* power) {
|
||||
static bool power_update_info(Power* power) {
|
||||
PowerInfo info;
|
||||
|
||||
info.gauge_is_ok = furi_hal_power_gauge_is_ok();
|
||||
info.charge = furi_hal_power_get_pct();
|
||||
info.health = furi_hal_power_get_bat_health_pct();
|
||||
info.capacity_remaining = furi_hal_power_get_battery_remaining_capacity();
|
||||
@@ -140,6 +146,10 @@ static bool power_update_info(Power* power) {
|
||||
}
|
||||
|
||||
static void power_check_low_battery(Power* power) {
|
||||
if(!power->info.gauge_is_ok) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Check battery charge and vbus voltage
|
||||
if((power->info.charge == 0) && (power->info.voltage_vbus < 4.0f) &&
|
||||
power->show_low_bat_level_message) {
|
||||
|
@@ -29,6 +29,8 @@ typedef struct {
|
||||
} PowerEvent;
|
||||
|
||||
typedef struct {
|
||||
bool gauge_is_ok;
|
||||
|
||||
float current_charger;
|
||||
float current_gauge;
|
||||
|
||||
|
Reference in New Issue
Block a user