Skip to content

Commit

Permalink
Nvk/alicat coda flow meters rs485 modbus arrakis mk4 serial fix (#308)
Browse files Browse the repository at this point in the history
* fixing blueprint for Arrakis MK4
  • Loading branch information
nkrasko authored May 2, 2024
1 parent 251f71c commit 5838717
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ STOP_BITS_CONFIG = 'stop_bits'
PARITY_CONFIG = 'parity'

local CONNECTION = {}
local SERIAL_OPTIONS = {}
local TTY

function main()
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 5838717

Please sign in to comment.