Fixed station handling

This commit is contained in:
Ollo 2023-09-16 13:44:30 +02:00
parent 69191e77b3
commit 489df6e33b
2 changed files with 13 additions and 16 deletions

View File

@ -233,12 +233,9 @@ fn send_package(ipaddress: String,
image: [0; IMAGE_SIZE_BYTE],
};
// Line::new(Point::new(0, 0), Point::new((IMAGE_WIDTH - 1) as i32, 0))
// .into_styled(PRIMITIVE_STYLE)
// .draw(&mut display)
// .unwrap();
render_weather(&mut display, data);
if (data.is_some()) {
render_weather(&mut display, data);
}
if strabaRes.failure == false {
let text_style = MonoTextStyle::new(&FONT_6X10, BinaryColor::On);
@ -274,7 +271,6 @@ fn send_package(ipaddress: String,
socket
.send_to(&package, ipaddress + ":4242")
.expect("couldn't send data");
println!("Packet sent");
}
fn help() {

View File

@ -137,17 +137,18 @@ pub fn fetch_data() -> NextDeparture {
let diff = next_departure.timestamp() - (seconds as i64);
println!("To {:} {:} (in {:} seconds)", stop.destinationLabel, txt_departure, diff );
if returnValue.outbound_station == "" {
if stop.destinationLabel.contains("Rheinau") && (diff < returnValue.outbound_diff) {
if stop.destinationLabel.contains("Rheinau") {
if (diff < returnValue.outbound_diff) {
returnValue.outbound_station = stop.destinationLabel;
returnValue.outbound_diff = diff;
} else if stop.destinationLabel.contains("Hochschule") ||
stop.destinationLabel.contains("Hauptbahnhof") ||
stop.destinationLabel.contains("nau") { // Schönau
if returnValue.inbound_station == "" && (diff < returnValue.inbound_diff) {
returnValue.inbound_station = stop.destinationLabel;
returnValue.inbound_diff = diff;
}
}
} else if stop.destinationLabel.contains("Hochschule") ||
stop.destinationLabel.contains("Hauptbahnhof") ||
stop.destinationLabel.contains("Schönau") {
if (diff < returnValue.inbound_diff) {
returnValue.inbound_station = stop.destinationLabel;
returnValue.inbound_diff = diff;
}
}
} else {