abbterra: fix RTU setup on slow radio links (433 MHz)
reachableChanged(true) never fires within the nymea setup timeout when the RTU link is slow (e.g. 433 MHz radio relay). Add a fallback: trigger initialize() immediately if master is already connected (QTimer::singleShot 500 ms), and also on master::connectedChanged. The existing reachableChanged path is kept for TCP-style RTU adapters. Bump to 1.15.0+etm5. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
5d87de1814
commit
a068d5a2cd
@ -11,6 +11,7 @@
|
|||||||
#include "plugininfo.h"
|
#include "plugininfo.h"
|
||||||
|
|
||||||
#include <QLoggingCategory>
|
#include <QLoggingCategory>
|
||||||
|
#include <QTimer>
|
||||||
#include <QtMath>
|
#include <QtMath>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
@ -332,6 +333,20 @@ void IntegrationPluginAbbterra::setupRtuThing(ThingSetupInfo *info)
|
|||||||
const quint16 slaveId = static_cast<quint16>(thing->paramValue(terraAcRtuThingSlaveIdParamTypeId).toUInt());
|
const quint16 slaveId = static_cast<quint16>(thing->paramValue(terraAcRtuThingSlaveIdParamTypeId).toUInt());
|
||||||
AbbTerraModbusRtuConnection *connection = new AbbTerraModbusRtuConnection(master, slaveId, thing);
|
AbbTerraModbusRtuConnection *connection = new AbbTerraModbusRtuConnection(master, slaveId, thing);
|
||||||
|
|
||||||
|
// reachableChanged(true) may never fire on slow radio links (e.g. 433 MHz)
|
||||||
|
// before the setup timeout expires, so we also trigger initialize() as soon
|
||||||
|
// as the master port is open.
|
||||||
|
if (master->connected()) {
|
||||||
|
QTimer::singleShot(500, connection, [connection]() {
|
||||||
|
connection->initialize();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
connect(master, &ModbusRtuMaster::connectedChanged, connection, [connection](bool connected) {
|
||||||
|
if (connected) {
|
||||||
|
connection->initialize();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
connect(connection, &AbbTerraModbusRtuConnection::reachableChanged, thing, [this, thing, connection](bool reachable) {
|
connect(connection, &AbbTerraModbusRtuConnection::reachableChanged, thing, [this, thing, connection](bool reachable) {
|
||||||
if (reachable) {
|
if (reachable) {
|
||||||
connection->initialize();
|
connection->initialize();
|
||||||
|
|||||||
8
debian/changelog
vendored
8
debian/changelog
vendored
@ -1,3 +1,11 @@
|
|||||||
|
etm-powersync-plugins-modbus (1.15.0+etm5) trixie; urgency=medium
|
||||||
|
|
||||||
|
* abbterra: fix RTU setup on slow radio links — trigger initialize() on
|
||||||
|
master connectedChanged, not only on reachableChanged (which never fires
|
||||||
|
within setup timeout over 433 MHz).
|
||||||
|
|
||||||
|
-- ETM-Schurig SARL <contact@etm-schurig.eu> Tue, 24 Jun 2026 10:00:00 +0200
|
||||||
|
|
||||||
etm-powersync-plugins-modbus (1.15.0+etm4) trixie; urgency=medium
|
etm-powersync-plugins-modbus (1.15.0+etm4) trixie; urgency=medium
|
||||||
|
|
||||||
* Correction modbus registers.
|
* Correction modbus registers.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user