Adjusted mutex lock and delay for modbus
This commit is contained in:
@@ -146,7 +146,7 @@ const uint8_t digitalIO::getInNum()
|
||||
void digitalIO::writeLocal(const uint8_t ch, const bool value)
|
||||
{
|
||||
uint8_t retries(0);
|
||||
while (retries++ < maxRetries)
|
||||
while (retries++ < c_maxRetries)
|
||||
{
|
||||
if (m_localOuts.setOut(ch, value))
|
||||
{
|
||||
@@ -166,7 +166,7 @@ void digitalIO::writeLocalPort(const std::vector<bool> &values)
|
||||
if (values[i])
|
||||
decValue |= High << i;
|
||||
}
|
||||
while (retries++ < maxRetries)
|
||||
while (retries++ < c_maxRetries)
|
||||
{
|
||||
if (m_localOuts.setPort(decValue))
|
||||
{
|
||||
@@ -182,7 +182,7 @@ void digitalIO::writeRemote(const uint8_t ch, const bool value)
|
||||
uint8_t retries(0);
|
||||
const uint8_t selectedRemote(floor(ch / (float)remoteIO::CH_MAX));
|
||||
const uint8_t selectedChannel(ch % remoteIO::CH_MAX);
|
||||
while (retries++ < maxRetries)
|
||||
while (retries++ < c_maxRetries)
|
||||
{
|
||||
if (m_remotes[selectedRemote].setOut((remoteIO::channel_t)selectedChannel, value))
|
||||
{
|
||||
@@ -196,7 +196,7 @@ void digitalIO::writeRemote(const uint8_t ch, const bool value)
|
||||
void digitalIO::writeRemotePort(const std::vector<bool> &values)
|
||||
{
|
||||
uint8_t retries(0);
|
||||
while (retries++ < maxRetries)
|
||||
while (retries++ < c_maxRetries)
|
||||
{
|
||||
bool ok(true);
|
||||
for (uint8_t i(0); i < values.size(); i += remoteIO::CH_MAX)
|
||||
@@ -228,7 +228,7 @@ const bool digitalIO::readLocalOut(const uint8_t ch)
|
||||
{
|
||||
bool value(false);
|
||||
uint8_t retries(0);
|
||||
while (retries++ < maxRetries)
|
||||
while (retries++ < c_maxRetries)
|
||||
{
|
||||
if (m_localOuts.readOut(ch, value))
|
||||
{
|
||||
@@ -256,7 +256,7 @@ const std::vector<bool> digitalIO::readLocalOutPort()
|
||||
uint8_t retries(0);
|
||||
uint8_t state(0);
|
||||
std::vector<bool> values(getLocalOutNum());
|
||||
while (retries++ < maxRetries)
|
||||
while (retries++ < c_maxRetries)
|
||||
{
|
||||
if (m_localOuts.readPort(state))
|
||||
{
|
||||
@@ -279,7 +279,7 @@ const bool digitalIO::readRemoteIn(const uint8_t ch)
|
||||
const uint8_t selectedRemote(floor(ch / 8.0f));
|
||||
const uint8_t selectedChannel(ch % remoteIO::CH_MAX);
|
||||
bool value;
|
||||
while (retries++ < maxRetries)
|
||||
while (retries++ < c_maxRetries)
|
||||
{
|
||||
if (m_remotes[selectedRemote].getIn((remoteIO::channel_t)selectedChannel, value))
|
||||
{
|
||||
@@ -297,7 +297,7 @@ const bool digitalIO::readRemoteOut(const uint8_t ch)
|
||||
const uint8_t selectedRemote(floor(ch / (float)remoteIO::CH_MAX));
|
||||
const uint8_t selectedChannel(ch % remoteIO::CH_MAX);
|
||||
bool value;
|
||||
while (retries++ < maxRetries)
|
||||
while (retries++ < c_maxRetries)
|
||||
{
|
||||
if (m_remotes[selectedRemote].getOut((remoteIO::channel_t)selectedChannel, value))
|
||||
{
|
||||
@@ -314,7 +314,7 @@ const std::vector<bool> digitalIO::readRemoteInPort()
|
||||
uint8_t retries(0);
|
||||
std::vector<bool> values;
|
||||
values.reserve(getRemoteInNum());
|
||||
while (retries++ < maxRetries)
|
||||
while (retries++ < c_maxRetries)
|
||||
{
|
||||
bool ok(true);
|
||||
for (uint8_t i(0); i < getRemoteInNum(); i += remoteIO::CH_MAX)
|
||||
@@ -343,7 +343,7 @@ const std::vector<bool> digitalIO::readRemoteOutPort()
|
||||
uint8_t retries(0);
|
||||
std::vector<bool> values;
|
||||
values.reserve(getRemoteOutNum());
|
||||
while (retries++ < maxRetries)
|
||||
while (retries++ < c_maxRetries)
|
||||
{
|
||||
bool ok(true);
|
||||
for (uint8_t i(0); i < getRemoteOutNum(); i += remoteIO::CH_MAX)
|
||||
|
||||
Reference in New Issue
Block a user