mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-05 03:21:42 +00:00
Fix Solenoid Resource object creation. Fixes artf4758.
Change-Id: I8b40d6606d7091fa6e8bf95b75f820e6b524ae06
This commit is contained in:
committed by
Peter Johnson
parent
bc0c895619
commit
ec69c6a866
@@ -10,10 +10,6 @@
|
||||
|
||||
#include <sstream>
|
||||
|
||||
std::unique_ptr<Resource> SolenoidBase::m_allocated =
|
||||
std::make_unique<Resource>(solenoid_kNumDO7_0Elements *
|
||||
kSolenoidChannels);
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* Uses the default PCM ID of 0
|
||||
@@ -52,7 +48,7 @@ DoubleSolenoid::DoubleSolenoid(uint8_t moduleNumber, uint32_t forwardChannel,
|
||||
return;
|
||||
}
|
||||
Resource::CreateResourceObject(
|
||||
m_allocated, solenoid_kNumDO7_0Elements * kSolenoidChannels);
|
||||
m_allocated, m_maxModules * m_maxPorts);
|
||||
|
||||
buf << "Solenoid " << m_forwardChannel << " (Module: " << m_moduleNumber
|
||||
<< ")";
|
||||
|
||||
@@ -38,8 +38,7 @@ Solenoid::Solenoid(uint8_t moduleNumber, uint32_t channel)
|
||||
wpi_setWPIErrorWithContext(ChannelIndexOutOfRange, buf.str());
|
||||
return;
|
||||
}
|
||||
Resource::CreateResourceObject(m_allocated, kSolenoidChannels * 63);
|
||||
|
||||
Resource::CreateResourceObject(m_allocated, m_maxModules * m_maxPorts);
|
||||
buf << "Solenoid " << m_channel << " (Module: " << m_moduleNumber << ")";
|
||||
if (m_allocated->Allocate(m_moduleNumber * kSolenoidChannels + m_channel,
|
||||
buf.str()) ==
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
#include "SolenoidBase.h"
|
||||
|
||||
void* SolenoidBase::m_ports[m_maxModules][m_maxPorts];
|
||||
std::unique_ptr<Resource> SolenoidBase::m_allocated;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user