[wpilib] PowerDistribution: Add module type getter (#3948)

This commit is contained in:
Peter Johnson
2022-01-21 15:46:44 -08:00
committed by GitHub
parent 2f9a600de2
commit 5548a37465
3 changed files with 26 additions and 0 deletions

View File

@@ -152,6 +152,20 @@ public class PowerDistribution implements Sendable, AutoCloseable {
return m_module;
}
/**
* Gets the module type for this power distribution object.
*
* @return The module type
*/
public ModuleType getType() {
int type = PowerDistributionJNI.getType(m_handle);
if (type == PowerDistributionJNI.REV_TYPE) {
return ModuleType.kRev;
} else {
return ModuleType.kCTRE;
}
}
/**
* Gets whether the PDH switchable channel is turned on or off. Returns false with the CTRE PDP.
*