1
0
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:
tychovrahe 2025-05-15 09:14:02 +02:00 committed by kopecdav
parent 378b81b663
commit b97d05247c
4 changed files with 10 additions and 14 deletions

View File

@ -49,20 +49,10 @@ void prodtest_pm_hibernate(cli_t* cli) {
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()) {
cli_error(cli, CLI_ERROR, "Failed to hibernate.");
return;
}
cli_trace(cli, "Device is powered externally, hibernation is not possible.");
cli_ok(cli, "");
}
void prodtest_pm_suspend(cli_t* cli) {
@ -343,6 +333,8 @@ void prodtest_pm_precharge(cli_t* cli) {
// fall slightly.
float precharge_voltage_V = 3.45f;
// Disable SoC limit and enable charging
pm_set_soc_limit(100);
pm_charging_enable();
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) {
// Target achieved
cli_trace(cli, "Battery voltage reached the target voltage.");
pm_charging_disable();
break;
}
systick_delay_ms(500);
}
cli_ok(cli, "");

View File

@ -339,6 +339,7 @@ int main(void) {
#ifdef USE_RGB_LED
if (ticks_expired(led_start_deadline) && !g_rgbled_control_disabled) {
g_rgbled_control_disabled = true;
rgb_led_set_color(0);
}
#endif

View File

@ -97,7 +97,7 @@ void pm_control_suspend() {
#ifdef USE_STORAGE_HWKEY
secure_aes_deinit();
#endif
#ifdef USE_TROPIC
#if defined(USE_TROPIC) && !defined(BOOTLOADER)
tropic_deinit();
#endif
#ifdef USE_OPTIGA
@ -216,7 +216,7 @@ void pm_control_suspend() {
optiga_init_and_configure();
#endif
#endif
#ifdef USE_TROPIC
#if defined(USE_TROPIC) && !defined(BOOTLOADER)
tropic_init();
#endif
#ifdef USE_BLE

View File

@ -115,10 +115,10 @@ pm_status_t pm_init(bool inherit_state) {
// Enable charging by default to max current
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->charging_current_max_limit_ma = PM_BATTERY_CHARGING_CURRENT_MAX;
// Poll until fuel_gauge is initialized and first PMIC & WLC measurements
// propagates into power_monitor.