cleanup
This commit is contained in:
+3
-2
@@ -43,8 +43,9 @@ fn main () {
|
||||
match action {
|
||||
"on" => pin_switch_on(),
|
||||
"off" => pin_switch_off(),
|
||||
"status" => println!("Inverter status: {}" , if pin_status() == 0 { "off" } else { "on" }),
|
||||
"test" => pin_test(&config),
|
||||
&_ => println!("So far only the parameters 'on', 'off' and 'test' are supported.")
|
||||
_ => println!("So far only the parameters 'on', 'off', status and 'test' are supported.")
|
||||
}
|
||||
}
|
||||
else { // no command line parameter set; check for voltages and switch the inverter accordingly
|
||||
@@ -101,7 +102,7 @@ fn get_current_voltage (config: &Config) -> f32 {
|
||||
}
|
||||
|
||||
let db_connection = sqlite::open(&config.database).unwrap();
|
||||
let query = format!("SELECT data FROM '{device}' ORDER BY date DESC, time DESC LIMIT 1;", device = &config.device_name_voltage);
|
||||
let query = format!("SELECT data FROM '{device}' ORDER BY date DESC, time DESC LIMIT 1;", device = config.device_name_voltage);
|
||||
|
||||
let _ = db_connection.iterate(query, |pairs | {
|
||||
let data = pairs.get(0).unwrap().1.unwrap();
|
||||
|
||||
Reference in New Issue
Block a user