From 5838717d8a1a1248c9e51b11b7dff828b10eb6e5 Mon Sep 17 00:00:00 2001 From: "Nikolay V. Krasko" Date: Thu, 2 May 2024 19:31:05 +0400 Subject: [PATCH] Nvk/alicat coda flow meters rs485 modbus arrakis mk4 serial fix (#308) * fixing blueprint for Arrakis MK4 --- .../firmware.lua | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/flow_meters/alicat_coda_flow_meters_rs485_modbus_arrakis_mk4/firmware.lua b/flow_meters/alicat_coda_flow_meters_rs485_modbus_arrakis_mk4/firmware.lua index 39a67d71..0699628b 100755 --- a/flow_meters/alicat_coda_flow_meters_rs485_modbus_arrakis_mk4/firmware.lua +++ b/flow_meters/alicat_coda_flow_meters_rs485_modbus_arrakis_mk4/firmware.lua @@ -9,6 +9,7 @@ STOP_BITS_CONFIG = 'stop_bits' PARITY_CONFIG = 'parity' local CONNECTION = {} +local SERIAL_OPTIONS = {} local TTY function main() @@ -49,16 +50,19 @@ function tty_init() return nil, 'not_configured' else CONNECTION = { - port = port, address = tonumber(address), - baudrate = tonumber(baud_rate), - stop_bits = tostring(stop_bits), + read_timeout = 1000, + } + + SERIAL_OPTIONS = { + baud_rate = tonumber(baud_rate), parity = tostring(parity), + stop_bits = tostring(stop_bits), data_bits = 8, read_timeout = 1000, } - TTY = modbusrtu.new(port, CONNECTION) + TTY = modbusrtu.new(port, SERIAL_OPTIONS) if TTY then return TTY, nil