mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-24 01:31:46 +00:00
[sim] Add initialized flag for all solenoids on a PCM (#2897)
This allows much easier/faster checking for whether any solenoid has been initialized on a particular PCM.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2017-2019 FIRST. All Rights Reserved. */
|
||||
/* Copyright (c) 2017-2020 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
@@ -25,6 +25,7 @@ void PCMData::ResetData() {
|
||||
solenoidInitialized[i].Reset(false);
|
||||
solenoidOutput[i].Reset(false);
|
||||
}
|
||||
anySolenoidInitialized.Reset(false);
|
||||
compressorInitialized.Reset(false);
|
||||
compressorOn.Reset(false);
|
||||
closedLoopEnabled.Reset(true);
|
||||
@@ -43,6 +44,7 @@ HAL_SIMDATAVALUE_DEFINE_CAPI_CHANNEL(HAL_Bool, HALSIM, PCMSolenoidInitialized,
|
||||
SimPCMData, solenoidInitialized)
|
||||
HAL_SIMDATAVALUE_DEFINE_CAPI_CHANNEL(HAL_Bool, HALSIM, PCMSolenoidOutput,
|
||||
SimPCMData, solenoidOutput)
|
||||
DEFINE_CAPI(HAL_Bool, AnySolenoidInitialized, anySolenoidInitialized)
|
||||
DEFINE_CAPI(HAL_Bool, CompressorInitialized, compressorInitialized)
|
||||
DEFINE_CAPI(HAL_Bool, CompressorOn, compressorOn)
|
||||
DEFINE_CAPI(HAL_Bool, ClosedLoopEnabled, closedLoopEnabled)
|
||||
|
||||
@@ -15,6 +15,7 @@ namespace hal {
|
||||
class PCMData {
|
||||
HAL_SIMDATAVALUE_DEFINE_NAME(SolenoidInitialized)
|
||||
HAL_SIMDATAVALUE_DEFINE_NAME(SolenoidOutput)
|
||||
HAL_SIMDATAVALUE_DEFINE_NAME(AnySolenoidInitialized)
|
||||
HAL_SIMDATAVALUE_DEFINE_NAME(CompressorInitialized)
|
||||
HAL_SIMDATAVALUE_DEFINE_NAME(CompressorOn)
|
||||
HAL_SIMDATAVALUE_DEFINE_NAME(ClosedLoopEnabled)
|
||||
@@ -37,6 +38,8 @@ class PCMData {
|
||||
SimDataValue<HAL_Bool, HAL_MakeBoolean, GetSolenoidOutputName,
|
||||
GetSolenoidOutputDefault>
|
||||
solenoidOutput[kNumSolenoidChannels];
|
||||
SimDataValue<HAL_Bool, HAL_MakeBoolean, GetAnySolenoidInitializedName>
|
||||
anySolenoidInitialized{false};
|
||||
SimDataValue<HAL_Bool, HAL_MakeBoolean, GetCompressorInitializedName>
|
||||
compressorInitialized{false};
|
||||
SimDataValue<HAL_Bool, HAL_MakeBoolean, GetCompressorOnName> compressorOn{
|
||||
|
||||
Reference in New Issue
Block a user