Support legacy baud
This commit is contained in:
parent
469e7d3430
commit
cfc9a8d0c7
8
main.go
8
main.go
@ -273,6 +273,7 @@ func treatLine(line []byte) (key string, horodate *time.Time, data []byte, err e
|
|||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
var legacyMode = flag.Bool("legacy-mode", false, "Assume teleinformation in legacy mode")
|
||||||
var influxScheme = flag.String("influx-scheme", "http", "Scheme to use to contact InfluxDB")
|
var influxScheme = flag.String("influx-scheme", "http", "Scheme to use to contact InfluxDB")
|
||||||
var influxHost = flag.String("influx-host", "localhost", "Host where lives InfluxDB")
|
var influxHost = flag.String("influx-host", "localhost", "Host where lives InfluxDB")
|
||||||
var influxPort = flag.Uint("influx-port", 8086, "Port where InfluxDB is accessible")
|
var influxPort = flag.Uint("influx-port", 8086, "Port where InfluxDB is accessible")
|
||||||
@ -287,9 +288,14 @@ func main() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
serialSpeed := 9600
|
||||||
|
if *legacyMode {
|
||||||
|
serialSpeed = 1200
|
||||||
|
}
|
||||||
|
|
||||||
config := &serial.Config{
|
config := &serial.Config{
|
||||||
Name: flag.Args()[0],
|
Name: flag.Args()[0],
|
||||||
Baud: 9600,
|
Baud: serialSpeed,
|
||||||
Size: 7,
|
Size: 7,
|
||||||
Parity: serial.ParityNone,
|
Parity: serial.ParityNone,
|
||||||
StopBits: 1,
|
StopBits: 1,
|
||||||
|
Loading…
Reference in New Issue
Block a user