mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[hal,wpilib] Change Power Distribution usage reporting to Instances (#7465)
LabVIEW doesn't appear to report PDP. This should reduce the number of Unknowns in the parsed UsageReporting.
This commit is contained in:
@@ -39,7 +39,14 @@ PowerDistribution::PowerDistribution() {
|
||||
m_module = HAL_GetPowerDistributionModuleNumber(m_handle, &status);
|
||||
FRC_ReportError(status, "Module {}", m_module);
|
||||
|
||||
HAL_Report(HALUsageReporting::kResourceType_PDP, m_module + 1);
|
||||
if (HAL_GetPowerDistributionType(m_handle, &status) ==
|
||||
HAL_PowerDistributionType::HAL_PowerDistributionType_kCTRE) {
|
||||
HAL_Report(HALUsageReporting::kResourceType_PDP,
|
||||
HALUsageReporting::kPDP_CTRE);
|
||||
} else {
|
||||
HAL_Report(HALUsageReporting::kResourceType_PDP,
|
||||
HALUsageReporting::kPDP_REV);
|
||||
}
|
||||
wpi::SendableRegistry::AddLW(this, "PowerDistribution", m_module);
|
||||
}
|
||||
|
||||
@@ -54,7 +61,13 @@ PowerDistribution::PowerDistribution(int module, ModuleType moduleType) {
|
||||
m_module = HAL_GetPowerDistributionModuleNumber(m_handle, &status);
|
||||
FRC_ReportError(status, "Module {}", module);
|
||||
|
||||
HAL_Report(HALUsageReporting::kResourceType_PDP, m_module + 1);
|
||||
if (moduleType == ModuleType::kCTRE) {
|
||||
HAL_Report(HALUsageReporting::kResourceType_PDP,
|
||||
HALUsageReporting::kPDP_CTRE);
|
||||
} else {
|
||||
HAL_Report(HALUsageReporting::kResourceType_PDP,
|
||||
HALUsageReporting::kPDP_REV);
|
||||
}
|
||||
wpi::SendableRegistry::AddLW(this, "PowerDistribution", m_module);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user