From 40fec62a19e9c4a7decb516b2d6581baab2be3cb Mon Sep 17 00:00:00 2001 From: Alex Janka Date: Sat, 3 Sep 2022 12:48:09 +1000 Subject: [PATCH] messages --- src/main.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main.rs b/src/main.rs index e3bc281..9d8f477 100644 --- a/src/main.rs +++ b/src/main.rs @@ -91,16 +91,19 @@ fn main() { let parity = 'N'; let data_bit = 8; let stop_bit = 2; + println!("Connecting to device on {}", args.serial_port); let mut modbus = Modbus::new_rtu(&args.serial_port, baud, parity, data_bit, stop_bit) - .expect("could not create modbus device"); + .expect("Could not create modbus device"); modbus .set_slave(DEVICE_ID) - .expect("could not set client device"); - modbus.connect().expect("could not connect"); + .expect("Could not set client device"); + modbus + .connect() + .expect("Could not connect to client device"); let mut data: [u16; 5] = [0; 5]; modbus .read_registers(0x0000, 5, &mut data) - .expect("couldnt read registers"); + .expect("Could not read registers"); println!("voltage scaling (whole term): {}", get_floating(data[0])); println!( "voltage scaling (fractional term): {}",