Adjusted mutex lock and delay for modbus

This commit is contained in:
Emanuele Trabattoni
2025-07-24 16:18:42 +02:00
parent 07dd200de8
commit cdbc904bec
11 changed files with 130 additions and 80 deletions

View File

@@ -34,7 +34,7 @@ namespace drivers
const uint8_t c_respHeaderSize = 3;
const uint8_t c_respCrcSize = 2;
const uint16_t c_minDelay = 10;
const uint32_t c_minDelay = 500;
typedef struct
{
@@ -62,9 +62,8 @@ namespace drivers
MODBUS &operator=(const MODBUS &) = delete;
// Get transaction lock
std::unique_lock<std::mutex> getLock() {
return std::unique_lock<std::mutex>(m_mutex);
}
std::unique_lock<std::mutex> getLock();
std::mutex &getMutex();
// Func 0x01
const bool readCoils(const uint8_t device, const uint16_t reg, const uint16_t num, std::vector<bool> &coils);