Author SHA1 Message Date
Paul Brinkmeier 8189157608 fixup! fixup! fixup! Add install nix and build container steps
Build container / build-container (push) Failing after 9s
2025-04-23 12:25:37 +02:00
Paul Brinkmeier 3f9cee98f4 fixup! fixup! Add install nix and build container steps 2025-04-23 12:20:48 +02:00
Paul Brinkmeier 0c8a48cd41 fixup! Add install nix and build container steps
Build container / build-container (push) Failing after 1m18s
2025-04-23 12:20:34 +02:00
Paul Brinkmeier 09bdd39fd8 Add install nix and build container steps
Build container / build-container (push) Failing after 20s
2025-04-23 12:19:13 +02:00
Paul Brinkmeier 9506864c2d Set runs-on
Gitea Actions Demo / build-container (push) Successful in 8s
2025-04-23 12:12:19 +02:00
Paul Brinkmeier aca227bdc6 fixup! Init CI
Gitea Actions Demo / build-container (push) Has been cancelled
2025-04-23 12:10:21 +02:00
Paul Brinkmeier 1020564f8f Init CI 2025-04-23 12:08:46 +02:00
10 changed files with 155 additions and 339 deletions
+16
View File
@@ -0,0 +1,16 @@
name: Build container
on: [push]
jobs:
build-container:
runs-on: ubuntu-22.04
steps:
- name: Checkout repo
uses: actions/checkout@v4
- run: ls -l
- name: Install Nix
uses: cachix/install-nix-action@v31
with:
enable_kvm: false
- name: Build container
run: nix build .#docker
- run: find result/*
-32
View File
@@ -1,32 +0,0 @@
name: Build image
on:
push:
tags:
- 'v*'
jobs:
build-image:
container:
image: catthehacker/ubuntu:act-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
# Required for installing nix
- name: Install sudo
run: apt-get update && apt-get install -y sudo
- name: Install Nix
uses: cachix/install-nix-action@v31
with:
enable_kvm: false
- name: Get image meta
run: nix build .#image-meta -o image-meta
- name: Version check
run: |
VERSION=$(cat image-meta/version)
[ "$GITHUB_REF_NAME" = v"$VERSION" ]
- name: Build image
run: nix build .#image -o image.tar.gz
- run: docker login -u paul -p "$PASSWORD" git.pbrinkmeier.de
env:
PASSWORD: "${{ secrets.REGISTRY_PASSWORD }}"
- run: docker load < image.tar.gz
- run: docker image push $(cat image-meta/name)
-1
View File
@@ -1,4 +1,3 @@
result result
vrnp vrnp
main
*.swp *.swp
Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

-14
View File
@@ -81,17 +81,3 @@ static const uint8_t PROGMEM spinny[][8] = {
0x00, 0x00,
}, },
}; };
static const uint16_t PROGMEM tiny_train_dims[] = {24, 9, 1};
static const uint8_t PROGMEM tiny_train[][27] = {
{
0x00, 0x04, 0x00,
0x00, 0x02, 0x00,
0x01, 0xff, 0xfe,
0x00, 0xa4, 0x94,
0x01, 0x24, 0x92,
0x01, 0x24, 0x92,
0x03, 0xfc, 0xff,
0x03, 0xff, 0xff,
0x01, 0xb0, 0x36,
},
};
+80 -97
View File
@@ -1,68 +1,37 @@
#include <ArduinoJson.h> #include <ArduinoJson.h>
#include <Adafruit_GFX.h>
#include <Adafruit_ST7735.h>
#include <ESP8266WiFi.h> #include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
#include <SPI.h> #include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <ESP8266HTTPClient.h>
#include <WiFiClientSecureBearSSL.h> #include <WiFiClientSecureBearSSL.h>
#include "bitmaps.h" #include "bitmaps.h"
#include "wifi_credentials.h" #include "wifi_credentials.h"
#define TFT_CS D8 // Screen stuff
#define TFT_DC D4 #define SCREEN_WIDTH 128 // OLED display width, in pixels
#define TFT_RESET D3 #define SCREEN_HEIGHT 64 // OLED display height, in pixels
#define OLED_RESET -1 // Reset pin # (or -1 if sharing Arduino reset pin)
#define SCREEN_ADDRESS 0x3C
// Button stuff // Button stuff
#define BUTTON_PIN D6 #define BUTTON_PIN D6
// Display stuff
#define FRAME_DELAY 80 #define FRAME_DELAY 80
#define COLOR_BG (rgb(0, 0, 0))
#define COLOR_DIVIDER (rgb(0xff, 0x60, 0x0d))
#define COLOR_TEXT (rgb(0xff, 0x60, 0x0d))
// Layout
#define WIDTH 160
#define HEIGHT 128
#define CX 6
#define CY 8
#define MARGIN_LEFT 5
#define MARGIN_RIGHT 5
#define MAIN_X MARGIN_LEFT
#define MAIN_Y 9
#define MAIN_WIDTH (WIDTH - 2 * MARGIN_LEFT)
#define MAIN_HEIGHT (8 * CY)
#define CLOCK_X MARGIN_LEFT
#define CLOCK_Y 113
#define STATUS_X 95
#define STATUS_Y CLOCK_Y
#define STATUS_WIDTH (10 * CX)
#define STATUS_HEIGHT CY
// Peripherals // Peripherals
Adafruit_ST7735 display(TFT_CS, TFT_DC, TFT_RESET); Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
// App state // App state
typedef enum { enum {
CONNECTING, CONNECTING,
SHOWING_DEPARTURES SHOWING_DEPARTURES
} State; } state = CONNECTING;
State state = CONNECTING;
State previous_state = state;
int frame = 0; int frame = 0;
// Use this variable to trigger state enter effects
int state_changed = 1;
int buttonPushed = false; int buttonPushed = false;
JsonDocument departures; JsonDocument departures;
@@ -70,41 +39,38 @@ void ICACHE_RAM_ATTR onButtonFalling() {
buttonPushed = true; buttonPushed = true;
} }
uint16_t rgb(uint16_t r, uint16_t g, uint16_t b) {
// Color layout: RRRRRGGGGGGBBBBB (5, 6, 5)
return ((b >> 3) & 0b11111) << 11 | ((g >> 2) & 0b111111) << 5 | ((r >> 3) & 0b11111);
}
void drawLayout() {
display.fillScreen(COLOR_BG);
display.drawFastHLine(5, 4, 150, COLOR_DIVIDER);
display.drawFastHLine(5, 109, 150, COLOR_DIVIDER);
display.drawFastHLine(5, 123, 150, COLOR_DIVIDER);
display.setCursor(CLOCK_X, CLOCK_Y);
display.print("13:12");
}
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
Serial.println("serial init"); // SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally
display.initR(); if(!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {
display.setSPISpeed(40000000); Serial.println("SSD1306 allocation failed");
display.setRotation(3); for(;;); // Don't proceed, loop forever
Serial.println("display initialized"); }
Serial.printf("display dimensions: %" PRId16 "x%" PRId16 "\n", display.width(), display.height()); Serial.println("SSD1306 initialized");
display.clearDisplay();
display.setTextSize(1);
display.setTextColor(COLOR_TEXT);
drawLayout();
WiFi.begin(WIFI_SSID, WIFI_PASSWORD); WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
pinMode(BUTTON_PIN, INPUT_PULLUP); pinMode(BUTTON_PIN, INPUT_PULLUP);
attachInterrupt(BUTTON_PIN, onButtonFalling, FALLING); attachInterrupt(BUTTON_PIN, onButtonFalling, FALLING);
display.setTextColor(SSD1306_INVERSE);
display.setTextSize(1);
display.setCursor(0, 0);
display.printf("Connecting to\n%s\n", WIFI_SSID);
display.display();
/*
display.print(" 5 Mannheim sofort\n"
"26 Kirchheim 9 min\n"
" 5 Weinheim 20:13");
*/
} }
#define QUERY_STRING "stop_id=de:08221:1225&platform=A" void drawSpinner(int frame) {
display.fillRect(120, 56, spinny_dims[0], spinny_dims[1], SSD1306_BLACK);
display.drawBitmap(120, 56, spinny[frame % spinny_dims[2]], spinny_dims[0], spinny_dims[1], SSD1306_WHITE);
}
// TODO: Error handling // TODO: Error handling
String fetchDepartures() { String fetchDepartures() {
@@ -112,10 +78,11 @@ String fetchDepartures() {
https->setInsecure(); https->setInsecure();
HTTPClient client; HTTPClient client;
if (!client.begin(*https, "vrnp.beany.club", 443, "/departures?" QUERY_STRING)) { if (!client.begin(*https, "vrnp.beany.club", 443, "/departures?stop_id=de:08221:1225&platform=A")) {
display.fillScreen(COLOR_BG); display.clearDisplay();
display.setCursor(0, 0); display.setCursor(0, 0);
display.print("begin failed"); display.print("begin failed");
display.display();
for (;;); for (;;);
} }
@@ -123,9 +90,10 @@ String fetchDepartures() {
client.addHeader("Accept", "application/json"); client.addHeader("Accept", "application/json");
int statusCode = client.GET(); int statusCode = client.GET();
if (statusCode != 200) { if (statusCode != 200) {
display.fillScreen(COLOR_BG); display.clearDisplay();
display.setCursor(0, 0); display.setCursor(0, 0);
display.printf("http non-ok: %d\n", statusCode); display.printf("http non-ok: %d\n", statusCode);
display.display();
for (;;); for (;;);
} }
@@ -133,29 +101,20 @@ String fetchDepartures() {
} }
void loop() { void loop() {
if (state != previous_state) {
state_changed = 1;
previous_state = state;
}
logic_loop();
frame++;
state_changed = 0;
}
void logic_loop() {
switch (state) { switch (state) {
case CONNECTING: { case CONNECTING: {
if (WiFi.status() != WL_CONNECTED) { if (WiFi.status() != WL_CONNECTED) {
display.fillRect(STATUS_X, STATUS_Y, STATUS_WIDTH, STATUS_HEIGHT, COLOR_BG); drawSpinner(frame++);
display.setCursor(STATUS_X, STATUS_Y); display.display();
display.printf(" connect %c", "|/-\\"[frame % 4]);
delay(FRAME_DELAY); delay(FRAME_DELAY);
return; return;
} }
display.fillRect(STATUS_X, STATUS_Y, STATUS_WIDTH, STATUS_HEIGHT, COLOR_BG); display.clearDisplay();
display.setCursor(STATUS_X, STATUS_Y); display.fillRect(0, 56, 128, 8, SSD1306_INVERSE);
display.print(" fetching"); display.setCursor(0, 56);
display.print("requesting departures");
display.display();
String departuresRaw = fetchDepartures(); String departuresRaw = fetchDepartures();
deserializeJson(departures, departuresRaw); deserializeJson(departures, departuresRaw);
@@ -171,24 +130,48 @@ void logic_loop() {
return; return;
} }
display.fillRect(STATUS_X, STATUS_Y, STATUS_WIDTH, STATUS_HEIGHT, COLOR_BG); /*
display.fillRect(MAIN_X, MAIN_Y, MAIN_WIDTH, MAIN_HEIGHT, COLOR_BG); if (buttonPushed) {
buttonPushed = false;
delay(FRAME_DELAY);
return;
}
*/
int line = 0; // Marquee effect for direction strings longer than 11 characters
// Neither particularly efficient nor legible
// (This could use some love)
int availableWidth = 11;
display.clearDisplay();
display.setCursor(0, 0);
for (JsonVariant departure : departures["departures"].as<JsonArray>()) { for (JsonVariant departure : departures["departures"].as<JsonArray>()) {
const char *directionStr = departure["direction"].as<const char *>(); const char *directionStr = departure["direction"].as<const char *>();
display.setCursor(MAIN_X, MAIN_Y + (CY + 3) * line); char buf[128] = {0};
display.printf("%2s %-15.15s %6s", const char *dirStart;
if (strlen(directionStr) <= availableWidth || (strlen(directionStr) + 3 + availableWidth) > 127) {
dirStart = directionStr;
} else {
memcpy(buf, directionStr, strlen(directionStr));
memcpy(buf + strlen(directionStr), " ", 3);
memcpy(buf + strlen(directionStr) + 3, directionStr, availableWidth);
buf[strlen(directionStr) + 3 + availableWidth] = '\0';
dirStart = buf + frame % (strlen(directionStr) + 3);
}
display.printf("%2s %-11.11s %6s\n",
departure["symbol"].as<const char*>(), departure["symbol"].as<const char*>(),
directionStr, dirStart,
departure["leaving"].as<const char*>() departure["leaving"].as<const char*>()
); );
line++;
} }
display.display();
delay(25000); frame++;
state = CONNECTING; delay(500);
return; return;
} }
} }
-1
View File
@@ -43,4 +43,3 @@ def generate_bitmap_from_gif(file: Path, fd):
if __name__ == "__main__": if __name__ == "__main__":
generate_bitmap_from_gif(Path("./animations/spinny.gif"), sys.stdout) generate_bitmap_from_gif(Path("./animations/spinny.gif"), sys.stdout)
generate_bitmap_from_gif(Path("./animations/tiny_train.gif"), sys.stdout)
Generated
-34
View File
@@ -1,23 +1,5 @@
{ {
"nodes": { "nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"gitignore": { "gitignore": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@@ -56,25 +38,9 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"flake-utils": "flake-utils",
"gitignore": "gitignore", "gitignore": "gitignore",
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs"
} }
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
} }
}, },
"root": "root", "root": "root",
+38 -44
View File
@@ -3,58 +3,52 @@
inputs = { inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
gitignore = { gitignore = {
url = "github:hercules-ci/gitignore.nix"; url = "github:hercules-ci/gitignore.nix";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
}; };
outputs = { self, nixpkgs, flake-utils, gitignore }: flake-utils.lib.eachDefaultSystem (system: outputs = { self, nixpkgs, gitignore }:
let let
pkgs = import nixpkgs { inherit system; }; system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
vrnp-static = pkgs.buildGoModule { vrnp-static = pkgs.buildGoModule {
pname = "vrnp"; pname = "vrnp";
version = "0.0.5"; version = "0.0.4";
vendorHash = null; vendorHash = null;
# For building the package, we use only the files not ignored by Git as inputs. # For building the package, we use only the files not ignored by Git as inputs.
# Also, flake.nix and flake.lock are not included to avoid annoying rebuilds when # Also, flake.nix and flake.lock are not included to avoid annoying rebuilds when
# working on them. # working on them.
src = pkgs.lib.cleanSourceWith { src = pkgs.lib.cleanSourceWith {
src = gitignore.lib.gitignoreSource ./.; src = gitignore.lib.gitignoreSource ./.;
filter = path: type: builtins.baseNameOf path != "flake.nix" && builtins.baseNameOf path != "flake.lock"; filter = path: type: builtins.baseNameOf path != "flake.nix" && builtins.baseNameOf path != "flake.lock";
};
# Avoid linking against libc
CGO_ENABLED = 0;
};
in {
devShell.${system} = pkgs.mkShellNoCC {
packages = [
pkgs.go
(pkgs.python3.withPackages (ps: with ps; [ pillow ]))
];
};
packages.${system} = {
default = vrnp-static;
docker = pkgs.dockerTools.buildImage {
name = "git.pbrinkmeier.de/paul/vrnp";
tag = vrnp-static.version;
copyToRoot = pkgs.buildEnv {
name = "vrnp-root";
paths = [ vrnp-static pkgs.cacert ];
pathsToLink = [ "/bin" "/etc" ];
}; };
config.Cmd = [ "${vrnp-static}/bin/vrnp" ];
# Avoid linking against libc
CGO_ENABLED = 0;
}; };
in { };
devShell = pkgs.mkShell { };
packages = [
pkgs.go
(pkgs.python3.withPackages (ps: with ps; [ pillow ]))
];
};
packages = {
default = vrnp-static;
image-meta = pkgs.runCommand "image-meta" {} ''
mkdir -p $out
echo -n ${vrnp-static.version} > $out/version
echo -n git.pbrinkmeier.de/paul/vrnp:${vrnp-static.version} > $out/name
'';
image = pkgs.dockerTools.buildImage {
name = "git.pbrinkmeier.de/paul/vrnp";
tag = vrnp-static.version;
copyToRoot = pkgs.buildEnv {
name = "vrnp-root";
paths = [ vrnp-static pkgs.cacert ];
pathsToLink = [ "/bin" "/etc" ];
};
config.Cmd = [ "${vrnp-static}/bin/vrnp" ];
};
};
}
);
} }
+21 -116
View File
@@ -8,9 +8,7 @@ import "net/http"
import "net/url" import "net/url"
import "os" import "os"
import "slices" import "slices"
import "strings"
import "strconv" import "strconv"
import "sync/atomic"
import "time" import "time"
// JSON unmarshaling types for departure monitor API // JSON unmarshaling types for departure monitor API
@@ -45,110 +43,28 @@ type DMDateTime struct {
Minute string `json:"minute"` Minute string `json:"minute"`
} }
type EFAClient interface { func FetchDepartures(stopId string) (DMResponse, error) {
GetName() string
BuildRequest(string) (*http.Request, error)
}
type VRNEFAClient struct {
}
func (c VRNEFAClient) GetName() string {
return "VRN"
}
func (c VRNEFAClient) BuildRequest(stopId string) (*http.Request, error) {
// Create request object // Create request object
req, err := http.NewRequest("GET", "https://www.vrn.de/mngvrn/XML_DM_REQUEST", nil) req, err := http.NewRequest("GET", "https://www.vrn.de/mngvrn/XML_DM_REQUEST", nil)
if err != nil {
return nil, err
}
// Configure our request
query := url.Values{}
query.Set("coordOutputFormat", "EPSG:4326")
query.Set("depType", "stopEvents")
query.Set("includeCompleteStopSeq", "0")
query.Set("limit", "10")
query.Set("locationServerActive", "0")
query.Set("mode", "direct")
query.Set("name_dm", stopId)
query.Set("outputFormat", "json")
query.Set("type_dm", "stop")
query.Set("useOnlyStops", "1")
query.Set("useRealtime", "1")
req.URL.RawQuery = query.Encode()
return req, nil
}
type KVVEFAClient struct {
}
func (c KVVEFAClient) GetName() string {
return "KVV"
}
func (c KVVEFAClient) BuildRequest(stopId string) (*http.Request, error) {
form := url.Values{}
form.Set("action", "XSLT_DM_REQUEST")
form.Set("name_dm", stopId)
form.Set("type_dm", "stop")
form.Set("useRealtime", "1")
form.Set("limit", "10")
form.Set("mode", "direct")
form.Set("outputFormat", "json")
body := strings.NewReader(form.Encode())
req, err := http.NewRequest("POST", "https://www.kvv.de/tunnelEfaDirect.php", body)
if err != nil {
return nil, err
}
req.Header.Set("User-Agent", "coolio/1.0")
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
return req, nil
}
type BwegtEFAClient struct {
}
func (c BwegtEFAClient) GetName() string {
return "bwegt"
}
func (c BwegtEFAClient) BuildRequest(stopId string) (*http.Request, error) {
// Create request object
req, err := http.NewRequest("GET", "https://www.bwegt.de/bwegt-efa/XML_DM_REQUEST", nil)
if err != nil {
return nil, err
}
// Configure our request
query := url.Values{}
query.Set("coordOutputFormat", "EPSG:4326")
query.Set("depType", "stopEvents")
query.Set("includeCompleteStopSeq", "0")
query.Set("limit", "10")
query.Set("locationServerActive", "0")
query.Set("mode", "direct")
query.Set("name_dm", stopId)
query.Set("outputFormat", "json")
query.Set("type_dm", "stop")
query.Set("useOnlyStops", "1")
query.Set("useRealtime", "1")
req.URL.RawQuery = query.Encode()
return req, nil
}
func FetchDepartures(c EFAClient, stopId string) (DMResponse, error) {
req, err := c.BuildRequest(stopId)
if err != nil { if err != nil {
return DMResponse{}, err return DMResponse{}, err
} }
// Configure our request
query := url.Values{}
query.Set("coordOutputFormat", "EPSG:4326")
query.Set("depType", "stopEvents")
query.Set("includeCompleteStopSeq", "0")
query.Set("limit", "10")
query.Set("locationServerActive", "0")
query.Set("mode", "direct")
query.Set("name_dm", stopId)
query.Set("outputFormat", "json")
query.Set("type_dm", "stop")
query.Set("useOnlyStops", "1")
query.Set("useRealtime", "1")
req.URL.RawQuery = query.Encode()
// Send the request, wait max 10 seconds // Send the request, wait max 10 seconds
client := http.Client{ client := http.Client{
Timeout: 10 * time.Second, Timeout: 10 * time.Second,
@@ -201,12 +117,6 @@ func ParseDepartures(response DMResponse, allowedPlatform *string) (Departures,
return Departures{}, errors.New("could not parse countdown") return Departures{}, errors.New("could not parse countdown")
} }
matchesPlatform := allowedPlatform == nil || d.Platform == *allowedPlatform
isInThePast := countdown < 0
if !matchesPlatform || isInThePast {
continue
}
if countdown == 0 { if countdown == 0 {
leaving = "sofort" leaving = "sofort"
} }
@@ -218,6 +128,10 @@ func ParseDepartures(response DMResponse, allowedPlatform *string) (Departures,
leaving = fmt.Sprintf("%02s:%02s", dt.Hour, dt.Minute) leaving = fmt.Sprintf("%02s:%02s", dt.Hour, dt.Minute)
} }
if allowedPlatform != nil && d.Platform != *allowedPlatform {
continue
}
ds = append(ds, Departure{ ds = append(ds, Departure{
d.Platform, d.Platform,
d.ServingLine.Symbol, d.ServingLine.Symbol,
@@ -235,14 +149,6 @@ func main() {
panic("Required environment variable VRNP_PASSWORD is not set") panic("Required environment variable VRNP_PASSWORD is not set")
} }
// Use round-robin to send incoming requests to different servers
var efaClient atomic.Uint64
efaClients := []EFAClient{
BwegtEFAClient{},
VRNEFAClient{},
KVVEFAClient{},
}
http.HandleFunc("/departures", func(w http.ResponseWriter, r *http.Request) { http.HandleFunc("/departures", func(w http.ResponseWriter, r *http.Request) {
user, pass, ok := r.BasicAuth() user, pass, ok := r.BasicAuth()
if !(ok && user == "admin" && pass == password) { if !(ok && user == "admin" && pass == password) {
@@ -264,8 +170,7 @@ func main() {
platform = &query["platform"][0] platform = &query["platform"][0]
} }
c := efaClients[(efaClient.Add(1) - 1) % uint64(len(efaClients))] ds, err := FetchDepartures(stopId)
ds, err := FetchDepartures(c, stopId)
if err != nil { if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError) http.Error(w, err.Error(), http.StatusInternalServerError)
return return