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

View File

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