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:
あく
2022-04-19 02:09:11 +03:00
committed by GitHub
parent 703844dd69
commit 1623134a82
10 changed files with 89 additions and 32 deletions

View File

@@ -21,6 +21,9 @@ typedef struct {
volatile uint8_t insomnia;
volatile uint8_t deep_insomnia;
volatile uint8_t suppress_charge;
uint8_t gauge_initialized;
uint8_t charger_initialized;
} FuriHalPower;
static volatile FuriHalPower furi_hal_power = {
@@ -84,6 +87,29 @@ void furi_hal_power_init() {
FURI_LOG_I(TAG, "Init OK");
}
bool furi_hal_power_gauge_is_ok() {
bool ret = true;
BatteryStatus battery_status;
OperationStatus operation_status;
furi_hal_i2c_acquire(&furi_hal_i2c_handle_power);
if(bq27220_get_battery_status(&furi_hal_i2c_handle_power, &battery_status) == BQ27220_ERROR ||
bq27220_get_operation_status(&furi_hal_i2c_handle_power, &operation_status) ==
BQ27220_ERROR) {
ret = false;
} else {
ret &= battery_status.BATTPRES;
ret &= operation_status.INITCOMP;
ret &= (cedv.design_cap == bq27220_get_design_capacity(&furi_hal_i2c_handle_power));
}
furi_hal_i2c_release(&furi_hal_i2c_handle_power);
return ret;
}
uint16_t furi_hal_power_insomnia_level() {
return furi_hal_power.insomnia;
}
@@ -315,10 +341,9 @@ void furi_hal_power_dump_state() {
} else {
// Operation status register
printf(
"bq27220: CALMD: %d, SEC0: %d, SEC1: %d, EDV2: %d, VDQ: %d, INITCOMP: %d, SMTH: %d, BTPINT: %d, CFGUPDATE: %d\r\n",
"bq27220: CALMD: %d, SEC: %d, EDV2: %d, VDQ: %d, INITCOMP: %d, SMTH: %d, BTPINT: %d, CFGUPDATE: %d\r\n",
operation_status.CALMD,
operation_status.SEC0,
operation_status.SEC1,
operation_status.SEC,
operation_status.EDV2,
operation_status.VDQ,
operation_status.INITCOMP,