Configuring the serial path actually does something now

This commit is contained in:
Jarno Rankinen 2023-03-20 20:55:20 +02:00
parent 545897211e
commit 2a76c9a413
2 changed files with 4 additions and 3 deletions

View File

@ -30,7 +30,7 @@ import (
var static embed.FS var static embed.FS
var ( var (
version = "0.0.24" version = "0.0.25"
device pingvin.Pingvin device pingvin.Pingvin
config Conf config Conf
usernamehash [32]byte usernamehash [32]byte

View File

@ -184,8 +184,9 @@ func readCsvLines(file string) [][]string {
// Create modbus.Handler, store it in p.handler, // Create modbus.Handler, store it in p.handler,
// connect the handler and create p.modbusclient (modbus.Client) // connect the handler and create p.modbusclient (modbus.Client)
func (p *Pingvin) createModbusClient(serial string) { func (p *Pingvin) createModbusClient(serial string) {
// TODO: read configuration from file, hardcoded for now // TODO: read configuration from file, mostly hardcoded for now
p.handler = modbus.NewRTUClientHandler("/dev/ttyS0") log.Println("Connecting to serial console on", serial)
p.handler = modbus.NewRTUClientHandler(serial)
p.handler.BaudRate = 19200 p.handler.BaudRate = 19200
p.handler.DataBits = 8 p.handler.DataBits = 8
p.handler.Parity = "N" p.handler.Parity = "N"