Merge branch 'master' into master
This commit is contained in:
commit
6744004387
@ -3,7 +3,6 @@ use str;
|
||||
use bit::BitIndex;
|
||||
use chrono_tz::Europe::Berlin;
|
||||
use chrono::{DateTime, NaiveDateTime, Utc, Timelike};
|
||||
use chrono::prelude::*;
|
||||
use std::time::{SystemTime, UNIX_EPOCH};
|
||||
use openweathermap::forecast::Weather;
|
||||
use substring::Substring;
|
||||
@ -20,6 +19,7 @@ use embedded_graphics::{
|
||||
use std::net::UdpSocket;
|
||||
use std::{env, thread};
|
||||
use std::io;
|
||||
use std::process::ExitCode;
|
||||
|
||||
use openweathermap::forecast::Forecast;
|
||||
use straba::NextDeparture;
|
||||
@ -348,14 +348,14 @@ fn check_connection(ipaddress: String) -> bool {
|
||||
return device_online;
|
||||
}
|
||||
|
||||
fn main() {
|
||||
fn main() -> ExitCode {
|
||||
let args: Vec<String> = env::args().collect();
|
||||
|
||||
match args.len() {
|
||||
// no arguments passed
|
||||
1 => {
|
||||
// show a help message
|
||||
help();
|
||||
return ExitCode::SUCCESS;
|
||||
}
|
||||
// one argument passed
|
||||
2 => {
|
||||
@ -365,7 +365,7 @@ fn main() {
|
||||
let mut device_online = check_connection(ip.to_string());
|
||||
if !device_online {
|
||||
println!("{} not online", ip);
|
||||
return
|
||||
return ExitCode::FAILURE;
|
||||
}
|
||||
|
||||
let receiver = openweathermap::init_forecast("Mannheim",
|
||||
@ -401,7 +401,7 @@ fn main() {
|
||||
}
|
||||
}
|
||||
|
||||
if (straba_res.request_time + 60) < seconds as i64 {
|
||||
if (straba_res.request_time + 50) < seconds as i64 {
|
||||
device_online = check_connection(ip.to_string());
|
||||
// request once a minute new data
|
||||
if device_online == true {
|
||||
@ -421,6 +421,7 @@ fn main() {
|
||||
_ => {
|
||||
// show a help message
|
||||
help();
|
||||
return ExitCode::SUCCESS;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user