Managed to implement some stuff, need to rewrite reading from DTU

This commit is contained in:
TraYali 2024-03-17 21:33:21 +01:00
parent f3f1aa3903
commit 9c3ed916b5
10 changed files with 90 additions and 27 deletions

View file

@ -9,8 +9,10 @@
#include "port.h"
#include "portParameters.h"
Port::Port(modbus_t *modbus_context, uint16_t portStartAddress) {
Port::Port(std::shared_ptr<modbus_t*> modbus_context, std::mutex *modbus_context_mutex, uint16_t portStartAddress) {
this->modbus_context = modbus_context;
this->modbus_context_mutex = modbus_context_mutex;
this->portStartAddress = portStartAddress;
this->populateParameters();
@ -51,7 +53,7 @@ void Port::populateParameters() {
void Port::updateParameters() {
std::vector<std::shared_ptr<PortParameter>>::iterator parametersIterator{this->parameters.begin()};
while (parametersIterator != this->parameters.end()) {
parametersIterator->get()->updateValue(this->modbus_context, this->portStartAddress);
parametersIterator->get()->updateValue(this->modbus_context, this->modbus_context_mutex, this->portStartAddress);
parametersIterator++;
}
}