mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[hal] Fix sim not working with automatic PD type and default module (#3707)
This commit is contained in:
@@ -30,6 +30,19 @@ extern "C" {
|
||||
HAL_PowerDistributionHandle HAL_InitializePowerDistribution(
|
||||
int32_t module, HAL_PowerDistributionType type,
|
||||
const char* allocationLocation, int32_t* status) {
|
||||
if (type == HAL_PowerDistributionType_kAutomatic) {
|
||||
if (module != HAL_DEFAULT_POWER_DISTRIBUTION_MODULE) {
|
||||
*status = PARAMETER_OUT_OF_RANGE;
|
||||
hal::SetLastError(
|
||||
status, "Automatic PowerDistributionType must have default module");
|
||||
return HAL_kInvalidHandle;
|
||||
}
|
||||
|
||||
// TODO Make this not matter
|
||||
type = HAL_PowerDistributionType_kCTRE;
|
||||
module = 0;
|
||||
}
|
||||
|
||||
if (!HAL_CheckPowerDistributionModule(module, type)) {
|
||||
*status = PARAMETER_OUT_OF_RANGE;
|
||||
hal::SetLastError(status, fmt::format("Invalid pdp module {}", module));
|
||||
|
||||
Reference in New Issue
Block a user