From b3f82b55fb2ac1c11eebd0b8ea99a3dbac56df4a Mon Sep 17 00:00:00 2001 From: Amir Saeid Date: Sat, 28 Mar 2020 19:21:01 +0000 Subject: Fix the way transition progress is calculated --- src/bin/main.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/bin/main.rs') diff --git a/src/bin/main.rs b/src/bin/main.rs index 0de2709..fc96325 100644 --- a/src/bin/main.rs +++ b/src/bin/main.rs @@ -36,8 +36,14 @@ fn main() { loop { let utc: DateTime = Utc::now(); match calc_sunrise_and_set(utc, latitude, longitude) { - Ok(ss) => sctd::set_temp(sctd::get_temp(utc, &ss, latitude, longitude) as u32), - Err(e) => println!("Error calculating sunrise and sunset: {:?}", e), + Ok(ss) => { + let temp = sctd::get_temp(utc, &ss, latitude, longitude) as u32; + println!("setting temprature to: {}", temp); + sctd::set_temp(temp); + } + Err(e) => { + println!("Error calculating sunrise and sunset: {:?}", e); + } } thread::sleep(Duration::from_secs(300)); } -- cgit v1.2.3