- Реализовать собственный блок данных (полученный из ModbusSequentialDatablock), переопределив функцию setValues, но это перехватывает как 06.05.15.16, так и команды и вызовы setValues в потоке обновления, поскольку я не могу распознать, какая функция Modbus была получена.
- Реализовать собственный фреймворк (полученный из ModbusRtuFramer), но в этом случае я часто получаю неполные кадры:
def processIncomingPacket(self, data, callback, unit, **kwargs):
res = super().processIncomingPacket(data, callback, unit, **kwargs)
# the device address is in the first byte of the raw data
device = int(data[0])
# the function code is in the second byte of the raw data
function = int(data[1])
# the address is always in the same position: for single register the
# meaning is absolute address, for multiple registers the meaning is
# starting address
address = (int(data[2]) * 256) + int(data[3]) #
Подробнее здесь: https://stackoverflow.com/questions/792 ... n-function
Мобильная версия