Skip to content

Commit

Permalink
migrations: Migrate obsolete PM phase switching modes to "automatic"
Browse files Browse the repository at this point in the history
  • Loading branch information
MattiasTF committed Nov 26, 2024
1 parent 509e66a commit 570bc37
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions software/src/config_migrations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -778,6 +778,35 @@ static const ConfigMigration migrations[] = {
}
},
#endif

#if BUILD_IS_WARP() || BUILD_IS_WARP2() || BUILD_IS_WARP3() || BUILD_IS_ENERGY_MANAGER()
{
#if BUILD_IS_WARP() || BUILD_IS_WARP2() || BUILD_IS_WARP3()
2, 6, 2,
#elif BUILD_IS_ENERGY_MANAGER()
2, 2, 1,
#else // EMv2? SEB?
0, 0, 0,
#endif
// Changes
// - PM phase switching modes 1phase, 3phase and PV1+Fast3 have been removed, change to automatic
[](){
// - PM phase switching modes 1phase, 3phase and PV1+Fast3 have been removed, change to automatic
{
StaticJsonDocument<512> pm_cfg;

if (read_config_file("power_manager/config", pm_cfg)) {
uint32_t phase_switching_mode = pm_cfg["phase_switching_mode"].as<uint32_t>();

if (phase_switching_mode != 0 && phase_switching_mode != 3) { // Not automatic or external (EVCC)
pm_cfg["phase_switching_mode"] = 0; // Set to automatic
write_config_file("power_manager/config", pm_cfg);
}
}
}
}
},
#endif
};

bool prepare_migrations()
Expand Down

0 comments on commit 570bc37

Please sign in to comment.