mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-06-27 02:12:35 +00:00
fix(core/prodtest): fix power off led signalization
[no changelog]
This commit is contained in:
parent
378b81b663
commit
b97d05247c
@ -49,20 +49,10 @@ void prodtest_pm_hibernate(cli_t* cli) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state.usb_connected || state.wireless_connected) {
|
|
||||||
cli_error(
|
|
||||||
cli, CLI_ERROR,
|
|
||||||
"Exteranl power source is connected, hibernation is not possible");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!pm_hibernate()) {
|
if (!pm_hibernate()) {
|
||||||
cli_error(cli, CLI_ERROR, "Failed to hibernate.");
|
cli_error(cli, CLI_ERROR, "Failed to hibernate.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
cli_trace(cli, "Device is powered externally, hibernation is not possible.");
|
|
||||||
cli_ok(cli, "");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void prodtest_pm_suspend(cli_t* cli) {
|
void prodtest_pm_suspend(cli_t* cli) {
|
||||||
@ -343,6 +333,8 @@ void prodtest_pm_precharge(cli_t* cli) {
|
|||||||
// fall slightly.
|
// fall slightly.
|
||||||
float precharge_voltage_V = 3.45f;
|
float precharge_voltage_V = 3.45f;
|
||||||
|
|
||||||
|
// Disable SoC limit and enable charging
|
||||||
|
pm_set_soc_limit(100);
|
||||||
pm_charging_enable();
|
pm_charging_enable();
|
||||||
|
|
||||||
cli_trace(cli, "Precharging the device...");
|
cli_trace(cli, "Precharging the device...");
|
||||||
@ -377,8 +369,11 @@ void prodtest_pm_precharge(cli_t* cli) {
|
|||||||
if (report.battery_voltage_v >= precharge_voltage_V) {
|
if (report.battery_voltage_v >= precharge_voltage_V) {
|
||||||
// Target achieved
|
// Target achieved
|
||||||
cli_trace(cli, "Battery voltage reached the target voltage.");
|
cli_trace(cli, "Battery voltage reached the target voltage.");
|
||||||
|
pm_charging_disable();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
systick_delay_ms(500);
|
||||||
}
|
}
|
||||||
|
|
||||||
cli_ok(cli, "");
|
cli_ok(cli, "");
|
||||||
|
@ -339,6 +339,7 @@ int main(void) {
|
|||||||
|
|
||||||
#ifdef USE_RGB_LED
|
#ifdef USE_RGB_LED
|
||||||
if (ticks_expired(led_start_deadline) && !g_rgbled_control_disabled) {
|
if (ticks_expired(led_start_deadline) && !g_rgbled_control_disabled) {
|
||||||
|
g_rgbled_control_disabled = true;
|
||||||
rgb_led_set_color(0);
|
rgb_led_set_color(0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -97,7 +97,7 @@ void pm_control_suspend() {
|
|||||||
#ifdef USE_STORAGE_HWKEY
|
#ifdef USE_STORAGE_HWKEY
|
||||||
secure_aes_deinit();
|
secure_aes_deinit();
|
||||||
#endif
|
#endif
|
||||||
#ifdef USE_TROPIC
|
#if defined(USE_TROPIC) && !defined(BOOTLOADER)
|
||||||
tropic_deinit();
|
tropic_deinit();
|
||||||
#endif
|
#endif
|
||||||
#ifdef USE_OPTIGA
|
#ifdef USE_OPTIGA
|
||||||
@ -216,7 +216,7 @@ void pm_control_suspend() {
|
|||||||
optiga_init_and_configure();
|
optiga_init_and_configure();
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#ifdef USE_TROPIC
|
#if defined(USE_TROPIC) && !defined(BOOTLOADER)
|
||||||
tropic_init();
|
tropic_init();
|
||||||
#endif
|
#endif
|
||||||
#ifdef USE_BLE
|
#ifdef USE_BLE
|
||||||
|
@ -115,10 +115,10 @@ pm_status_t pm_init(bool inherit_state) {
|
|||||||
|
|
||||||
// Enable charging by default to max current
|
// Enable charging by default to max current
|
||||||
drv->charging_enabled = true;
|
drv->charging_enabled = true;
|
||||||
pm_charging_set_max_current(PM_BATTERY_CHARGING_CURRENT_MAX);
|
|
||||||
|
|
||||||
// Set default SOC limit
|
// Set default SOC limit and max charging current limit
|
||||||
drv->soc_limit = 100;
|
drv->soc_limit = 100;
|
||||||
|
drv->charging_current_max_limit_ma = PM_BATTERY_CHARGING_CURRENT_MAX;
|
||||||
|
|
||||||
// Poll until fuel_gauge is initialized and first PMIC & WLC measurements
|
// Poll until fuel_gauge is initialized and first PMIC & WLC measurements
|
||||||
// propagates into power_monitor.
|
// propagates into power_monitor.
|
||||||
|
Loading…
Reference in New Issue
Block a user