Compare commits
	
		
			No commits in common. "f3120905fe141bcdfa5a81784ece7843190c51ed" and "addc90d8568760bab370e646c4b3c9d9eac9fbb8" have entirely different histories.
		
	
	
		
			f3120905fe
			...
			addc90d856
		
	
		
| @ -176,19 +176,14 @@ void logic_loop() { | ||||
| 
 | ||||
|       int line = 0; | ||||
|       for (JsonVariant departure : departures["departures"].as<JsonArray>()) { | ||||
|         display.setCursor(MAIN_X, MAIN_Y + (CY + 3) * line); | ||||
|         display.printf("%2s %-15.15s ", | ||||
|           departure["symbol"].as<const char*>(), | ||||
|           departure["direction"].as<const char *>() | ||||
|         ); | ||||
|         if (departure["leaving"].as<String>().equals("sofort")) { | ||||
|           int16_t x = display.getCursorX(); | ||||
|           int16_t y = display.getCursorY(); | ||||
|           display.drawBitmap(x + 6 * CX - tiny_train_dims[0], y, tiny_train[0], tiny_train_dims[0], tiny_train_dims[1], COLOR_TEXT); | ||||
|         } else { | ||||
|           display.printf("%6s", departure["leaving"].as<const char*>()); | ||||
|         } | ||||
|         const char *directionStr = departure["direction"].as<const char *>(); | ||||
| 
 | ||||
|         display.setCursor(MAIN_X, MAIN_Y + (CY + 3) * line); | ||||
|         display.printf("%2s %-15.15s %6s", | ||||
|           departure["symbol"].as<const char*>(), | ||||
|           directionStr, | ||||
|           departure["leaving"].as<const char*>() | ||||
|         ); | ||||
|         line++; | ||||
|       } | ||||
|        | ||||
|  | ||||
							
								
								
									
										9
									
								
								main.go
									
									
									
									
									
								
							
							
						
						
									
										9
									
								
								main.go
									
									
									
									
									
								
							| @ -1,6 +1,5 @@ | ||||
| package main | ||||
| 
 | ||||
| import "cmp" | ||||
| import "encoding/json" | ||||
| import "errors" | ||||
| import "fmt" | ||||
| @ -98,7 +97,6 @@ func (c KVVEFAClient) BuildRequest(stopId string) (*http.Request, error) { | ||||
| 	form.Set("useRealtime", "1") | ||||
| 	form.Set("limit", "10") | ||||
| 	form.Set("mode", "direct") | ||||
| 	form.Set("useRealtime", "1") | ||||
| 	form.Set("outputFormat", "json") | ||||
| 	body := strings.NewReader(form.Encode()) | ||||
| 
 | ||||
| @ -181,7 +179,6 @@ type Departure struct { | ||||
| 	Symbol    string `json:"symbol"` | ||||
| 	Direction string `json:"direction"` | ||||
| 	Leaving   string `json:"leaving"` | ||||
| 	Countdown int | ||||
| } | ||||
| 
 | ||||
| func ParseDepartures(response DMResponse, allowedPlatform *string) (Departures, error) { | ||||
| @ -226,14 +223,9 @@ func ParseDepartures(response DMResponse, allowedPlatform *string) (Departures, | ||||
| 			d.ServingLine.Symbol, | ||||
| 			direction, | ||||
| 			leaving, | ||||
| 			countdown, | ||||
| 		}) | ||||
| 	} | ||||
| 
 | ||||
| 	slices.SortFunc(ds, func(a Departure, b Departure) int { | ||||
| 		return cmp.Compare(a.Countdown, b.Countdown) | ||||
| 	}) | ||||
| 
 | ||||
| 	return Departures{ds}, nil | ||||
| } | ||||
| 
 | ||||
| @ -273,7 +265,6 @@ func main() { | ||||
| 		} | ||||
| 
 | ||||
| 		c := efaClients[(efaClient.Add(1) - 1) % uint64(len(efaClients))] | ||||
| 		log.Print(c.GetName()) | ||||
| 		ds, err := FetchDepartures(c, stopId) | ||||
| 		if err != nil { | ||||
| 			http.Error(w, err.Error(), http.StatusInternalServerError) | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user