Sync
This commit is contained in:
@@ -78,21 +78,24 @@ int main(void)
|
||||
LOG_WRN("BLE not enabled");
|
||||
#endif
|
||||
|
||||
|
||||
#if IS_ENABLED(CONFIG_LOG)
|
||||
#if IS_ENABLED(CONFIG_BATT_MGMT)
|
||||
k_sleep(K_MSEC(100));
|
||||
int32_t batt_mv;
|
||||
int batt_rc = batt_mgmt_measure_vddh_mv(BATT_MGMT_OVERSAMPLING_16X, &batt_mv);
|
||||
k_sleep(K_SECONDS(1));
|
||||
batt_mgmt_info_t batt_info;
|
||||
int batt_rc = batt_mgmt_get_info(&batt_info);
|
||||
if (batt_rc == 0) {
|
||||
LOG_INF("Battery after boot: %d mV", batt_mv);
|
||||
LOG_INF("Battery after 1s: %d mV, %u%%, level=%u, state=%s (%d)",
|
||||
batt_info.voltage_mv,
|
||||
batt_info.percent,
|
||||
batt_info.level,
|
||||
battery_state_to_str(batt_info.state),
|
||||
batt_info.state);
|
||||
} else {
|
||||
LOG_WRN("Battery measurement after boot failed: %d", batt_rc);
|
||||
LOG_WRN("Battery info read failed: %d", batt_rc);
|
||||
}
|
||||
#endif // CONFIG_BATT_MGMT
|
||||
#endif // CONFIG_LOG
|
||||
|
||||
k_sleep(K_SECONDS(1));
|
||||
batt_mgmt_state_t batt_state = batt_mgmt_get_battery_state();
|
||||
LOG_INF("Battery state after 1s: %s (%d)", battery_state_to_str(batt_state), batt_state);
|
||||
#endif
|
||||
for (;;) {
|
||||
int32_t rem_ms = k_sleep(K_FOREVER);
|
||||
LOG_WRN("main woke unexpectedly (remaining=%d ms)", rem_ms);
|
||||
|
||||
Reference in New Issue
Block a user