Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7eeff6e211 | ||
|
|
cb87b8ccc6 | ||
|
|
b1db99ee8b | ||
|
|
cc8e766247 | ||
|
|
69e7a647eb | ||
|
|
5a839bce7a | ||
|
|
02a2a5d7fa | ||
|
|
cd6136e4c2 |
@@ -1,3 +1,4 @@
|
||||
*.out
|
||||
app
|
||||
notes/
|
||||
flightwall.conf
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
[submodule "external/rpi-rgb-led-matrix"]
|
||||
path = external/rpi-rgb-led-matrix
|
||||
url = https://github.com/hzeller/rpi-rgb-led-matrix.git
|
||||
[submodule "external/dump1090"]
|
||||
path = external/dump1090
|
||||
url = https://github.com/flightaware/dump1090
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <string>
|
||||
#include <ctime>
|
||||
#include <unistd.h>
|
||||
#include <vector>
|
||||
|
||||
@@ -39,34 +40,17 @@ private:
|
||||
FrameCanvas *offscreen = nullptr;
|
||||
|
||||
std::vector<Text> display_text;
|
||||
Text flight_operator = {"", 0, 14, 0, WHITE};
|
||||
Text flight_number = {"", 0, 21, 0, WHITE};
|
||||
Text altitude = {"FT", 41, 0, 0, WHITE};
|
||||
Text speed = {"KTS", 41, 7, 0, WHITE};
|
||||
Text track = {"DEG", 41, 14, 0, WHITE};
|
||||
Text vertical_speed = {"VS", 41, 21, 0, WHITE};
|
||||
Text flight_operator = {"", 1, 14, 0, WHITE};
|
||||
Text flight_number = {"", 1, 21, 0, WHITE};
|
||||
Text altitude = {"", 40, -2, 0, WHITE};
|
||||
Text speed = {"", 40, 5, 0, WHITE};
|
||||
Text track = {"", 40, 14, 0, WHITE};
|
||||
Text vertical_speed = {"", 40, 21, 0, WHITE};
|
||||
|
||||
const char *ga_logo_path = "";
|
||||
const char *ufo_logo_path = "";
|
||||
std::vector<uint8_t> ga_logo;
|
||||
std::vector<uint8_t> ufo_logo;
|
||||
const uint8_t *current_logo = nullptr;
|
||||
|
||||
TrackedAircraft *current_aircraft;
|
||||
|
||||
static std::vector<uint8_t> load_logo(const char *path) {
|
||||
std::vector<uint8_t> data;
|
||||
if (!path || !*path) {
|
||||
return data;
|
||||
}
|
||||
std::ifstream f(path, std::ios::binary);
|
||||
data.assign(std::istreambuf_iterator<char>(f), {});
|
||||
if (data.size() != LOGO_SIZE * LOGO_SIZE * 3) {
|
||||
data.clear();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
static const uint8_t *find_logo(const std::string &code) {
|
||||
for (int i = 0; i < LOGO_COUNT; i++) {
|
||||
if (code == LOGOS[i].code) {
|
||||
@@ -88,6 +72,22 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
static constexpr int DAY_BRIGHTNESS = 50;
|
||||
static constexpr int NIGHT_BRIGHTNESS = 10;
|
||||
static constexpr int NIGHT_START_HOUR = 22;
|
||||
static constexpr int NIGHT_END_HOUR = 9;
|
||||
|
||||
void update_brightness() {
|
||||
time_t now = time(nullptr);
|
||||
struct tm local;
|
||||
localtime_r(&now, &local);
|
||||
bool night = local.tm_hour >= NIGHT_START_HOUR || local.tm_hour < NIGHT_END_HOUR;
|
||||
uint8_t target = night ? NIGHT_BRIGHTNESS : DAY_BRIGHTNESS;
|
||||
if (canvas->brightness() != target) {
|
||||
canvas->SetBrightness(target);
|
||||
}
|
||||
}
|
||||
|
||||
static bool parseColor(Color *c, const char *str) {
|
||||
return sscanf(str, "%hhu,%hhu,%hhu", &c->r, &c->g, &c->b) == 3;
|
||||
}
|
||||
@@ -119,7 +119,7 @@ public:
|
||||
|
||||
LEDMatrix(TrackedAircraft *t) {
|
||||
matrix_options.cols = 64;
|
||||
matrix_options.brightness = 50;
|
||||
matrix_options.brightness = DAY_BRIGHTNESS;
|
||||
runtime_opt.gpio_slowdown = 2;
|
||||
|
||||
// load font from bdf file
|
||||
@@ -136,21 +136,19 @@ public:
|
||||
offscreen = canvas->CreateFrameCanvas();
|
||||
|
||||
display_text = {
|
||||
{"ALT", 24, 0, 0, WHITE},
|
||||
{"SPD", 24, 7, 0, WHITE},
|
||||
{"TRK", 24, 14, 0, WHITE},
|
||||
{"FPM", 24, 21, 0, WHITE},
|
||||
{"ALT", 21, -2, 0, WHITE},
|
||||
{"SPD", 21, 5, 0, WHITE},
|
||||
{"TRK", 21, 14, 0, WHITE},
|
||||
{"VS", 27, 21, 0, WHITE},
|
||||
};
|
||||
|
||||
ga_logo = load_logo(ga_logo_path);
|
||||
ufo_logo = load_logo(ufo_logo_path);
|
||||
|
||||
current_aircraft = t;
|
||||
}
|
||||
|
||||
~LEDMatrix() { delete canvas; }
|
||||
|
||||
void draw_display_text() {
|
||||
update_brightness();
|
||||
offscreen->Clear();
|
||||
draw_logo(1, 1);
|
||||
for (Text t : display_text) {
|
||||
@@ -181,15 +179,15 @@ public:
|
||||
if (op == "N") {
|
||||
flight_operator.text = "GA";
|
||||
flight_number.text = num.substr(0, 4);
|
||||
current_logo = ga_logo.empty() ? nullptr : ga_logo.data();
|
||||
current_logo = find_logo("GA");
|
||||
|
||||
// if other flight number
|
||||
} else {
|
||||
flight_operator.text = op;
|
||||
flight_number.text = num.substr(0, 4);
|
||||
current_logo = find_logo(op);
|
||||
if (!current_logo && !ufo_logo.empty()) {
|
||||
current_logo = ufo_logo.data();
|
||||
if (!current_logo) {
|
||||
current_logo = find_logo("UFO");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,69 @@
|
||||
## Raspberry Pi setup
|
||||
|
||||
Hardware: an RTL-SDR dongle plugged into the Pi, and the LED matrix wired through the
|
||||
[rpi-rgb-led-matrix](https://github.com/hzeller/rpi-rgb-led-matrix) adapter board.
|
||||
|
||||
On a fresh Raspberry Pi OS / DietPi install:
|
||||
|
||||
```
|
||||
git clone --recurse-submodules https://gitea.dylanbenzi.com/dylan/flightwall
|
||||
cd flightwall
|
||||
sudo ./setup.sh
|
||||
```
|
||||
|
||||
`setup.sh` asks for your latitude, longitude and timezone (saved to `flightwall.conf`), then:
|
||||
|
||||
- installs build dependencies and lighttpd
|
||||
- builds dump1090-fa (pinned submodule in `external/dump1090`) and the FlightWall app
|
||||
- installs three systemd services, enabled on boot:
|
||||
- `flightwall-dump1090` - the ADS-B receiver (SBS output on port 30003)
|
||||
- `flightwall-web` - the dump1090 map / status UI at `http://<pi-ip>:8080`
|
||||
- `flightwall` - the LED display
|
||||
- disables any existing dump1090 / dump1090-fa / readsb service so they don't fight over the dongle
|
||||
- blacklists the DVB kernel drivers that claim the RTL-SDR and the onboard sound module,
|
||||
sets `dtparam=audio=off`, and adds `isolcpus=3` to `cmdline.txt` (4+ core Pis)
|
||||
|
||||
If it reports that the boot config changed, run `sudo reboot`.
|
||||
|
||||
### Configuration
|
||||
|
||||
Edit `flightwall.conf` (created on first setup, not tracked by git):
|
||||
|
||||
| Key | Meaning |
|
||||
| -------------------- | ------------------------------------------------------- |
|
||||
| `LAT`, `LON` | your location, decimal degrees |
|
||||
| `TIMEZONE` | used for day/night brightness |
|
||||
| `SBS_IP`, `SBS_PORT` | where the app reads SBS-1 data (default local dump1090) |
|
||||
| `STALE_SECONDS` | drop aircraft not seen for this long |
|
||||
| `WEB_PORT` | port of the web UI |
|
||||
| `DUMP1090_ARGS` | extra dump1090 flags, e.g. `"--gain 40"` |
|
||||
|
||||
Apply changes with `sudo ./setup.sh` (re-runnable). For `LAT`, `LON`, `SBS_*`, `STALE_SECONDS`
|
||||
or `DUMP1090_ARGS` only, `sudo systemctl restart flightwall-dump1090 flightwall` is enough.
|
||||
|
||||
To update: `git pull --recurse-submodules && sudo ./setup.sh`.
|
||||
|
||||
### Useful commands
|
||||
|
||||
```
|
||||
journalctl -u flightwall -f
|
||||
journalctl -u flightwall-dump1090 -f
|
||||
sudo systemctl restart flightwall
|
||||
nc 127.0.0.1 30003 # raw SBS-1 stream
|
||||
```
|
||||
|
||||
## Development
|
||||
|
||||
### To clone
|
||||
|
||||
`git clone --recurse-submodules `https://gitea.dylanbenzi.com/dylan/flightwall`
|
||||
`git clone --recurse-submodules https://gitea.dylanbenzi.com/dylan/flightwall`
|
||||
|
||||
`git submodule update --init --recursive`
|
||||
|
||||
### To add logos
|
||||
|
||||
Add logo to assets/logos/native_art, 16x16 png named by ICAO
|
||||
|
||||
Re-generate logos with:
|
||||
|
||||
`python logo16.py in --out out --native native_art`
|
||||
|
||||
@@ -157,6 +157,8 @@ def main():
|
||||
help="brightness floor (0-255) for non-black pixels so dark logos stay visible; 0 disables")
|
||||
p.add_argument("--colors", type=int, default=0, help="quantize to N colours (0 = off); try 6-8")
|
||||
p.add_argument("--c-header", action="store_true", help="also write logos.h")
|
||||
p.add_argument("--native", type=Path,
|
||||
help="folder of finished 16x16 pixel art (e.g. UFO.png, GA.png) copied in unchanged, no processing")
|
||||
p.add_argument("--only", nargs="*", help="only these codes")
|
||||
a = p.parse_args()
|
||||
|
||||
@@ -180,6 +182,16 @@ def main():
|
||||
items.append((code, im))
|
||||
print(f"ok {code}")
|
||||
|
||||
if a.native:
|
||||
for f in sorted(x for x in a.native.iterdir() if x.suffix.lower() == ".png"):
|
||||
im = Image.open(f).convert("RGB")
|
||||
if im.size != (a.size, a.size):
|
||||
sys.exit(f"{f.name}: native art must be exactly {a.size}x{a.size}, got {im.size}")
|
||||
code = f.stem.upper()
|
||||
items = [(c, i) for c, i in items if c != code] + [(code, im)]
|
||||
im.save(a.out / "png" / f"{code}.png")
|
||||
print(f"ok {code} (native)")
|
||||
|
||||
S = a.size
|
||||
# atlas: magic, size(u8), count(u16), then per entry: 4-byte code + RGB888
|
||||
with open(a.out / "atlas.bin", "wb") as fh:
|
||||
|
||||
@@ -42,6 +42,9 @@ static const uint8_t LOGO_VIR[768] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
static const uint8_t LOGO_VOI[768] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 255, 255, 255, 255, 255, 255, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 15, 15, 255, 255, 255, 255, 255, 255, 16, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 17, 21, 228, 255, 255, 228, 255, 255, 13, 17, 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 216, 255, 255, 216, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 99, 122, 150, 109, 128, 150, 98, 120, 150, 155, 228, 255, 155, 228, 255, 99, 127, 150, 110, 136, 150, 104, 135, 150, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 87, 133, 150, 255, 255, 255, 198, 255, 254, 72, 193, 255, 72, 193, 255, 201, 255, 254, 255, 255, 255, 82, 109, 150, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 14, 16, 16, 16, 12, 15, 2, 0, 0, 106, 123, 150, 211, 239, 255, 169, 201, 255, 78, 178, 242, 79, 169, 245, 167, 216, 241, 208, 255, 254, 113, 143, 150, 2, 0, 0, 14, 17, 10, 15, 15, 16, 15, 15, 15, 255, 255, 255, 255, 255, 255, 254, 211, 255, 254, 204, 255, 228, 106, 212, 176, 0, 170, 165, 0, 148, 2, 4, 0, 5, 0, 0, 130, 204, 0, 128, 237, 0, 212, 255, 95, 255, 254, 177, 255, 254, 195, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 254, 210, 255, 254, 205, 255, 224, 112, 217, 170, 0, 172, 156, 6, 158, 0, 150, 0, 0, 0, 4, 124, 208, 3, 121, 234, 0, 206, 254, 103, 255, 254, 181, 255, 254, 195, 255, 255, 255, 255, 255, 255, 15, 15, 15, 14, 16, 16, 17, 11, 14, 0, 0, 0, 150, 97, 139, 255, 181, 254, 222, 138, 209, 155, 6, 157, 156, 0, 166, 214, 221, 135, 255, 254, 154, 140, 150, 85, 0, 0, 0, 14, 18, 10, 15, 15, 16, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 150, 108, 143, 255, 255, 255, 255, 183, 251, 169, 0, 175, 165, 0, 180, 255, 254, 177, 255, 255, 242, 144, 150, 93, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 150, 102, 146, 150, 109, 145, 150, 100, 144, 227, 113, 220, 227, 108, 223, 148, 150, 97, 126, 150, 74, 131, 150, 87, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 254, 205, 255, 254, 205, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 11, 14, 254, 211, 255, 254, 211, 255, 18, 12, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 19, 14, 255, 255, 255, 255, 255, 255, 14, 19, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 255, 255, 255, 255, 255, 255, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
static const uint8_t LOGO_VXP[768] = {70, 0, 175, 83, 0, 221, 84, 0, 209, 84, 0, 211, 84, 0, 211, 84, 0, 211, 79, 7, 211, 92, 0, 206, 110, 0, 195, 67, 26, 219, 0, 166, 243, 0, 255, 252, 16, 112, 231, 104, 0, 200, 81, 5, 220, 70, 0, 175, 82, 0, 219, 84, 0, 211, 84, 0, 211, 84, 0, 211, 84, 0, 211, 81, 2, 212, 108, 0, 199, 93, 0, 208, 0, 203, 247, 0, 255, 252, 0, 195, 244, 31, 99, 239, 76, 18, 223, 88, 0, 208, 84, 0, 211, 82, 0, 219, 84, 0, 209, 84, 0, 211, 84, 0, 211, 81, 2, 212, 89, 0, 211, 115, 0, 195, 33, 79, 229, 0, 255, 252, 0, 234, 255, 93, 9, 247, 131, 0, 242, 103, 0, 199, 90, 0, 201, 82, 0, 218, 84, 0, 211, 84, 0, 209, 84, 0, 211, 84, 0, 211, 81, 3, 210, 97, 0, 206, 100, 0, 203, 0, 192, 247, 0, 255, 252, 25, 117, 255, 129, 0, 238, 74, 0, 150, 0, 0, 0, 0, 0, 0, 56, 0, 150, 98, 0, 245, 83, 0, 207, 84, 0, 211, 84, 0, 211, 81, 2, 212, 97, 0, 207, 51, 47, 220, 0, 255, 252, 0, 222, 248, 94, 7, 253, 94, 0, 174, 0, 0, 0, 0, 0, 0, 46, 0, 150, 49, 0, 188, 72, 0, 219, 86, 0, 215, 84, 0, 211, 84, 0, 211, 84, 0, 211, 79, 7, 211, 102, 0, 206, 30, 88, 222, 0, 255, 252, 3, 157, 255, 134, 0, 150, 0, 0, 0, 0, 0, 150, 48, 0, 255, 66, 0, 255, 117, 24, 204, 101, 19, 194, 73, 0, 221, 84, 0, 210, 84, 0, 211, 84, 0, 211, 84, 0, 211, 78, 0, 208, 112, 0, 239, 57, 18, 186, 0, 255, 210, 0, 255, 216, 25, 25, 150, 140, 0, 238, 204, 119, 62, 255, 252, 0, 255, 252, 0, 187, 109, 62, 48, 0, 254, 90, 6, 205, 84, 0, 211, 84, 0, 211, 83, 0, 207, 95, 0, 238, 56, 0, 150, 0, 0, 0, 150, 0, 120, 0, 138, 255, 0, 255, 252, 95, 234, 99, 255, 234, 0, 217, 57, 65, 113, 0, 185, 81, 0, 216, 81, 0, 216, 84, 0, 211, 84, 0, 211, 84, 0, 211, 83, 0, 207, 94, 0, 236, 60, 0, 150, 0, 0, 0, 0, 0, 150, 255, 92, 3, 255, 252, 0, 0, 234, 255, 0, 234, 255, 0, 78, 255, 51, 0, 242, 82, 0, 218, 84, 0, 211, 84, 0, 211, 84, 0, 211, 84, 0, 211, 84, 0, 211, 83, 2, 204, 60, 0, 255, 136, 44, 153, 150, 148, 0, 0, 16, 0, 150, 35, 38, 114, 0, 255, 19, 117, 251, 0, 255, 240, 0, 255, 252, 13, 114, 228, 104, 0, 200, 79, 7, 211, 84, 0, 211, 84, 0, 211, 89, 6, 203, 53, 0, 251, 162, 83, 96, 255, 252, 0, 254, 156, 51, 0, 0, 185, 0, 0, 0, 67, 0, 150, 111, 0, 215, 125, 0, 253, 80, 28, 249, 72, 19, 223, 88, 0, 207, 84, 0, 211, 84, 0, 211, 84, 0, 211, 84, 2, 206, 62, 0, 240, 129, 44, 150, 255, 252, 0, 255, 216, 0, 117, 14, 234, 30, 0, 255, 0, 0, 0, 0, 0, 0, 42, 0, 150, 74, 0, 150, 85, 0, 200, 82, 0, 218, 84, 0, 209, 84, 0, 211, 84, 0, 211, 84, 0, 211, 85, 3, 207, 52, 0, 245, 63, 0, 243, 240, 175, 0, 255, 252, 0, 194, 111, 88, 48, 0, 255, 34, 0, 181, 6, 0, 7, 0, 0, 0, 56, 0, 150, 98, 0, 245, 83, 0, 207, 84, 0, 211, 84, 0, 209, 84, 0, 211, 84, 0, 211, 84, 2, 208, 69, 0, 227, 24, 0, 255, 150, 62, 143, 255, 252, 0, 255, 222, 0, 102, 8, 230, 48, 0, 255, 48, 0, 255, 68, 0, 223, 85, 0, 212, 84, 0, 211, 84, 0, 209, 82, 0, 219, 84, 0, 211, 84, 0, 211, 84, 0, 211, 84, 0, 209, 89, 3, 206, 42, 0, 255, 70, 0, 230, 255, 192, 0, 255, 252, 0, 255, 192, 0, 176, 98, 95, 100, 17, 194, 69, 0, 225, 84, 0, 209, 82, 0, 219, 70, 0, 175, 83, 0, 221, 84, 0, 209, 84, 0, 211, 84, 0, 211, 84, 0, 211, 89, 6, 203, 71, 0, 231, 30, 0, 255, 109, 23, 175, 233, 159, 0, 255, 252, 0, 184, 102, 69, 42, 0, 255, 93, 6, 212, 70, 0, 175};
|
||||
static const uint8_t LOGO_WJA[768] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 150, 145, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 188, 181, 0, 221, 208, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 150, 145, 0, 150, 141, 0, 150, 145, 0, 248, 239, 0, 195, 188, 0, 150, 145, 0, 170, 160, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 150, 141, 0, 255, 252, 0, 215, 207, 0, 189, 182, 0, 206, 199, 0, 255, 252, 0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 150, 145, 0, 150, 141, 0, 0, 0, 0, 198, 191, 0, 224, 221, 0, 223, 215, 0, 240, 226, 0, 248, 239, 0, 150, 141, 0, 150, 141, 0, 150, 145, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 193, 186, 0, 181, 175, 0, 231, 223, 0, 255, 252, 0, 150, 127, 0, 231, 217, 0, 202, 185, 0, 150, 138, 0, 150, 141, 0, 14, 13, 0, 177, 167, 0, 253, 244, 0, 204, 197, 0, 195, 188, 0, 150, 141, 0, 0, 0, 0, 231, 212, 0, 244, 218, 0, 178, 155, 0, 150, 131, 0, 150, 131, 0, 16, 16, 2, 0, 4, 4, 0, 0, 0, 0, 0, 0, 150, 141, 0, 239, 225, 0, 188, 181, 0, 219, 211, 0, 195, 184, 0, 0, 0, 8, 78, 150, 0, 106, 150, 17, 64, 150, 39, 39, 150, 37, 32, 150, 32, 52, 150, 28, 62, 150, 25, 89, 184, 12, 0, 6, 0, 150, 127, 0, 254, 245, 0, 188, 186, 0, 201, 194, 0, 255, 252, 0, 150, 145, 0, 0, 0, 16, 45, 150, 32, 63, 164, 25, 66, 150, 24, 71, 150, 17, 77, 151, 18, 74, 150, 20, 85, 166, 51, 12, 150, 0, 150, 109, 0, 252, 243, 0, 193, 186, 0, 229, 221, 0, 236, 228, 0, 150, 145, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 83, 150, 21, 75, 156, 19, 71, 150, 19, 71, 150, 17, 73, 150, 38, 38, 150, 0, 138, 150, 0, 239, 219, 0, 204, 197, 0, 240, 232, 0, 165, 159, 0, 11, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 69, 150, 24, 82, 170, 21, 77, 153, 26, 61, 150, 0, 99, 150, 0, 250, 224, 0, 234, 226, 0, 236, 228, 0, 150, 145, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 150, 19, 71, 150, 17, 67, 150, 16, 70, 150, 26, 61, 150, 0, 150, 134, 0, 150, 138, 0, 173, 167, 0, 211, 204, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 8, 21, 18, 71, 150, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 59, 150, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
static const uint8_t LOGO_BBQ[768] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 175, 180, 192, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 175, 180, 192, 0, 0, 0, 0, 0, 0, 0, 0, 0, 105, 110, 122, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 175, 180, 192, 0, 0, 0, 105, 110, 122, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 175, 180, 192, 0, 0, 0, 0, 0, 0, 0, 0, 0, 105, 110, 122, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 140, 90, 35, 140, 90, 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 215, 35, 35, 215, 35, 35, 215, 35, 35, 215, 35, 35, 215, 35, 35, 215, 35, 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 215, 35, 35, 255, 150, 140, 215, 35, 35, 215, 35, 35, 215, 35, 35, 215, 35, 35, 215, 35, 35, 215, 35, 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 215, 35, 35, 255, 150, 140, 215, 35, 35, 215, 35, 35, 215, 35, 35, 215, 35, 35, 215, 35, 35, 215, 35, 35, 215, 35, 35, 215, 35, 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 205, 208, 218, 255, 140, 0, 255, 215, 40, 255, 140, 0, 205, 208, 218, 255, 140, 0, 255, 215, 40, 255, 140, 0, 205, 208, 218, 205, 208, 218, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 215, 35, 35, 255, 150, 140, 215, 35, 35, 215, 35, 35, 215, 35, 35, 215, 35, 35, 215, 35, 35, 215, 35, 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 215, 35, 35, 215, 35, 35, 215, 35, 35, 215, 35, 35, 215, 35, 35, 215, 35, 35, 215, 35, 35, 215, 35, 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 215, 35, 35, 215, 35, 35, 215, 35, 35, 215, 35, 35, 215, 35, 35, 215, 35, 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 215, 35, 35, 215, 35, 35, 215, 35, 35, 215, 35, 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 150, 158, 172, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 150, 158, 172, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 150, 158, 172, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 150, 158, 172, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 150, 158, 172, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 150, 158, 172, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
static const uint8_t LOGO_GA[768] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 200, 0, 255, 200, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 200, 0, 255, 200, 0, 240, 240, 245, 240, 240, 245, 240, 240, 245, 240, 240, 245, 240, 240, 245, 240, 240, 245, 240, 240, 245, 240, 240, 245, 0, 0, 0, 0, 0, 0, 150, 160, 175, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 200, 0, 255, 200, 0, 240, 240, 245, 240, 240, 245, 240, 240, 245, 240, 240, 245, 240, 240, 245, 240, 240, 245, 240, 240, 245, 240, 240, 245, 0, 0, 0, 0, 0, 0, 150, 160, 175, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 200, 0, 255, 200, 0, 0, 0, 0, 0, 0, 0, 150, 160, 175, 0, 0, 0, 0, 0, 0, 0, 0, 0, 150, 160, 175, 0, 0, 0, 0, 0, 0, 0, 0, 0, 150, 160, 175, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 200, 0, 255, 200, 0, 255, 200, 0, 255, 200, 0, 150, 160, 175, 255, 200, 0, 30, 40, 60, 30, 40, 60, 30, 40, 60, 255, 200, 0, 255, 200, 0, 150, 160, 175, 150, 160, 175, 0, 0, 0, 0, 0, 0, 255, 200, 0, 255, 200, 0, 255, 200, 0, 255, 200, 0, 255, 200, 0, 255, 200, 0, 255, 200, 0, 255, 200, 0, 255, 200, 0, 255, 200, 0, 255, 200, 0, 255, 200, 0, 150, 160, 175, 150, 160, 175, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 200, 0, 255, 200, 0, 255, 200, 0, 255, 200, 0, 255, 200, 0, 255, 200, 0, 255, 200, 0, 255, 200, 0, 255, 200, 0, 255, 200, 0, 255, 200, 0, 150, 160, 175, 150, 160, 175, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 150, 160, 175, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 150, 160, 175, 0, 0, 0, 0, 0, 0, 0, 0, 0, 150, 160, 175, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 150, 160, 175, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 150, 160, 175, 0, 0, 0, 0, 0, 0, 0, 0, 0, 150, 160, 175, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 150, 160, 175, 150, 160, 175, 150, 160, 175, 0, 0, 0, 0, 0, 0, 150, 160, 175, 150, 160, 175, 150, 160, 175, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
static const uint8_t LOGO_UFO[768] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 216, 255, 222, 160, 238, 166, 160, 238, 166, 160, 238, 166, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 160, 238, 166, 160, 238, 166, 160, 238, 166, 160, 238, 166, 160, 238, 166, 160, 238, 166, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 160, 238, 166, 71, 151, 76, 160, 238, 166, 160, 238, 166, 71, 151, 76, 160, 238, 166, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 105, 108, 120, 71, 151, 76, 71, 151, 76, 71, 151, 76, 160, 238, 166, 71, 151, 76, 71, 151, 76, 181, 188, 200, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 133, 136, 144, 182, 187, 201, 105, 108, 120, 182, 187, 201, 105, 108, 120, 182, 187, 201, 105, 108, 120, 133, 136, 144, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 133, 136, 144, 133, 136, 144, 133, 136, 144, 154, 155, 164, 154, 155, 164, 133, 136, 144, 133, 136, 144, 133, 136, 144, 133, 136, 144, 133, 136, 144, 133, 136, 144, 133, 136, 144, 0, 0, 0, 0, 0, 0, 0, 0, 0, 217, 220, 228, 181, 188, 202, 133, 136, 144, 154, 155, 164, 154, 155, 164, 133, 136, 144, 133, 136, 144, 133, 136, 144, 133, 136, 144, 133, 136, 144, 133, 136, 144, 133, 136, 144, 133, 136, 144, 133, 136, 144, 0, 0, 0, 0, 0, 0, 217, 220, 228, 181, 188, 202, 217, 220, 228, 181, 188, 202, 181, 188, 202, 217, 220, 228, 181, 188, 202, 181, 188, 202, 217, 220, 228, 181, 188, 202, 181, 188, 202, 217, 220, 228, 181, 188, 202, 217, 220, 228, 0, 0, 0, 0, 0, 0, 0, 0, 0, 181, 188, 202, 217, 220, 228, 181, 188, 202, 181, 188, 202, 217, 220, 228, 181, 188, 202, 181, 188, 202, 217, 220, 228, 181, 188, 202, 181, 188, 202, 217, 220, 228, 181, 188, 202, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 105, 108, 120, 105, 108, 120, 105, 108, 120, 105, 108, 120, 105, 108, 120, 105, 108, 120, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 71, 151, 76, 255, 255, 255, 105, 108, 120, 105, 108, 120, 105, 108, 120, 105, 108, 120, 255, 255, 255, 71, 151, 76, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 160, 238, 166, 160, 238, 166, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 160, 238, 166, 160, 238, 166, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 71, 151, 76, 160, 238, 166, 160, 238, 166, 71, 151, 76, 160, 238, 166, 160, 238, 166, 71, 151, 76, 160, 238, 166, 160, 238, 166, 71, 151, 76, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 160, 238, 166, 160, 238, 166, 71, 151, 76, 71, 151, 76, 160, 238, 166, 160, 238, 166, 71, 151, 76, 71, 151, 76, 160, 238, 166, 160, 238, 166, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 71, 151, 76, 160, 238, 166, 71, 151, 76, 71, 151, 76, 160, 238, 166, 160, 238, 166, 160, 238, 166, 160, 238, 166, 71, 151, 76, 71, 151, 76, 160, 238, 166, 71, 151, 76, 0, 0, 0, 0, 0, 0};
|
||||
|
||||
struct LogoEntry { const char *code; const uint8_t *rgb; };
|
||||
static const LogoEntry LOGOS[] = {
|
||||
@@ -85,5 +88,8 @@ static const LogoEntry LOGOS[] = {
|
||||
{"VOI", LOGO_VOI},
|
||||
{"VXP", LOGO_VXP},
|
||||
{"WJA", LOGO_WJA},
|
||||
{"BBQ", LOGO_BBQ},
|
||||
{"GA", LOGO_GA},
|
||||
{"UFO", LOGO_UFO},
|
||||
};
|
||||
static const int LOGO_COUNT = 40;
|
||||
static const int LOGO_COUNT = 43;
|
||||
|
||||
@@ -160,6 +160,18 @@
|
||||
"WJA": {
|
||||
"png": "png/WJA.png",
|
||||
"index": 39
|
||||
},
|
||||
"BBQ": {
|
||||
"png": "png/BBQ.png",
|
||||
"index": 40
|
||||
},
|
||||
"GA": {
|
||||
"png": "png/GA.png",
|
||||
"index": 41
|
||||
},
|
||||
"UFO": {
|
||||
"png": "png/UFO.png",
|
||||
"index": 42
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@ Speed notes (rpi-rgb-led-matrix):
|
||||
- Draw into an offscreen canvas and SwapOnVSync() so you never show a half-drawn frame.
|
||||
- Don't pre-apply gamma: the library's luminance correction (on by default) handles it.
|
||||
"""
|
||||
import re
|
||||
import struct
|
||||
from pathlib import Path
|
||||
from PIL import Image
|
||||
@@ -31,15 +32,23 @@ def load_atlas(path="out/atlas.bin"):
|
||||
|
||||
|
||||
LOGOS = load_atlas()
|
||||
FALLBACK = Image.open("fallback.png").convert("RGB") # your unidentified/GA icon
|
||||
UFO = LOGOS["UFO"] # unidentified: no callsign, or a prefix we have no logo for
|
||||
GA = LOGOS["GA"] # general aviation: US tail numbers
|
||||
|
||||
# US N-number: N + 1-5 digits + up to 2 letters (N123AB, N7, N99999). Doesn't match airline callsigns.
|
||||
N_NUMBER = re.compile(r"^N\d{1,5}[A-Z]{0,2}$")
|
||||
|
||||
|
||||
def logo_for(callsign: str) -> Image.Image:
|
||||
# Airline callsigns are a 3-letter ICAO prefix + digits (DAL1234). N-numbers (N123AB) -> fallback.
|
||||
prefix = callsign[:3].upper()
|
||||
if len(callsign) > 3 and callsign[3].isdigit() and prefix.isalpha():
|
||||
return LOGOS.get(prefix, FALLBACK)
|
||||
return FALLBACK
|
||||
def logo_for(callsign) -> Image.Image:
|
||||
cs = (callsign or "").strip().upper()
|
||||
if not cs:
|
||||
return UFO
|
||||
if N_NUMBER.match(cs):
|
||||
return GA
|
||||
# Airline callsign = 3-letter ICAO prefix + flight number (DAL1234)
|
||||
if len(cs) > 3 and cs[:3].isalpha() and cs[3].isdigit():
|
||||
return LOGOS.get(cs[:3], UFO)
|
||||
return UFO
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
|
After Width: | Height: | Size: 203 B |
|
After Width: | Height: | Size: 182 B |
|
After Width: | Height: | Size: 696 B |
|
After Width: | Height: | Size: 203 B |
|
After Width: | Height: | Size: 182 B |
|
After Width: | Height: | Size: 696 B |
|
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 42 KiB |
@@ -0,0 +1,2 @@
|
||||
SUBSYSTEM=="usb", ATTRS{idVendor}=="0bda", ATTRS{idProduct}=="2832", GROUP="plugdev", MODE="0660"
|
||||
SUBSYSTEM=="usb", ATTRS{idVendor}=="0bda", ATTRS{idProduct}=="2838", GROUP="plugdev", MODE="0660"
|
||||
@@ -0,0 +1,16 @@
|
||||
[Unit]
|
||||
Description=dump1090-fa ADS-B receiver (FlightWall)
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
User=dump1090
|
||||
EnvironmentFile=__INSTALL_DIR__/flightwall.conf
|
||||
RuntimeDirectory=flightwall-dump1090
|
||||
RuntimeDirectoryMode=0755
|
||||
ExecStart=/usr/local/bin/flightwall-dump1090 --device-type rtlsdr --net --quiet --lat ${LAT} --lon ${LON} --write-json %t/flightwall-dump1090 $DUMP1090_ARGS
|
||||
Restart=on-failure
|
||||
RestartSec=10
|
||||
Nice=-5
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -0,0 +1,12 @@
|
||||
[Unit]
|
||||
Description=dump1090 web UI (FlightWall)
|
||||
After=flightwall-dump1090.service
|
||||
|
||||
[Service]
|
||||
User=www-data
|
||||
ExecStart=/usr/sbin/lighttpd -D -f /etc/flightwall/lighttpd.conf
|
||||
Restart=on-failure
|
||||
RestartSec=5
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -0,0 +1,14 @@
|
||||
[Unit]
|
||||
Description=FlightWall LED display
|
||||
After=network.target flightwall-dump1090.service
|
||||
Wants=flightwall-dump1090.service
|
||||
|
||||
[Service]
|
||||
EnvironmentFile=__INSTALL_DIR__/flightwall.conf
|
||||
WorkingDirectory=__INSTALL_DIR__
|
||||
ExecStart=__INSTALL_DIR__/app --lat ${LAT} --lon ${LON} --ip ${SBS_IP} --port ${SBS_PORT} --stale ${STALE_SECONDS}
|
||||
Restart=always
|
||||
RestartSec=3
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -0,0 +1,23 @@
|
||||
server.modules = ("mod_alias", "mod_setenv")
|
||||
server.port = __WEB_PORT__
|
||||
server.document-root = "/usr/local/share/flightwall/html"
|
||||
server.errorlog = "/dev/stderr"
|
||||
server.stat-cache-engine = "disable"
|
||||
index-file.names = ("index.html")
|
||||
|
||||
alias.url = ("/data/" => "/run/flightwall-dump1090/")
|
||||
|
||||
setenv.add-response-header = ("Cache-Control" => "no-cache")
|
||||
|
||||
mimetype.assign = (
|
||||
".html" => "text/html",
|
||||
".css" => "text/css",
|
||||
".js" => "application/javascript",
|
||||
".json" => "application/json",
|
||||
".geojson" => "application/json",
|
||||
".png" => "image/png",
|
||||
".gif" => "image/gif",
|
||||
".svg" => "image/svg+xml",
|
||||
".ico" => "image/x-icon",
|
||||
".txt" => "text/plain"
|
||||
)
|
||||
@@ -0,0 +1,8 @@
|
||||
LAT=0
|
||||
LON=0
|
||||
TIMEZONE=America/New_York
|
||||
SBS_IP=127.0.0.1
|
||||
SBS_PORT=30003
|
||||
STALE_SECONDS=60
|
||||
WEB_PORT=8080
|
||||
DUMP1090_ARGS=""
|
||||
@@ -0,0 +1,140 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
if [ "$(id -u)" -ne 0 ]; then
|
||||
echo "Run as root: sudo ./setup.sh" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
CONF="$DIR/flightwall.conf"
|
||||
OWNER="$(stat -c %U "$DIR")"
|
||||
REBOOT=0
|
||||
|
||||
as_owner() {
|
||||
if [ "$OWNER" = "root" ]; then
|
||||
"$@"
|
||||
else
|
||||
runuser -u "$OWNER" -- "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
set_conf() {
|
||||
sed -i -E "s|^$1=.*|$1=$2|" "$CONF"
|
||||
}
|
||||
|
||||
echo "==> Configuration"
|
||||
[ -f "$CONF" ] || as_owner cp "$DIR/flightwall.conf.example" "$CONF"
|
||||
. "$CONF"
|
||||
|
||||
is_unset() { [ -z "${1:-}" ] || [ "$1" = "0" ]; }
|
||||
|
||||
if is_unset "$LAT" || is_unset "$LON"; then
|
||||
if [ ! -t 0 ]; then
|
||||
echo "Set LAT and LON in $CONF, then re-run." >&2
|
||||
exit 1
|
||||
fi
|
||||
read -rp "Latitude (e.g. 33.6407): " LAT
|
||||
read -rp "Longitude (e.g. -84.4277): " LON
|
||||
current_tz="$(timedatectl show -p Timezone --value 2>/dev/null || echo "$TIMEZONE")"
|
||||
read -rp "Timezone [$current_tz]: " tz
|
||||
TIMEZONE="${tz:-$current_tz}"
|
||||
set_conf LAT "$LAT"
|
||||
set_conf LON "$LON"
|
||||
set_conf TIMEZONE "$TIMEZONE"
|
||||
fi
|
||||
|
||||
num='^-?[0-9]+(\.[0-9]+)?$'
|
||||
if ! [[ "$LAT" =~ $num && "$LON" =~ $num ]]; then
|
||||
echo "LAT/LON in $CONF must be decimal degrees." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! timedatectl list-timezones | grep -qx "$TIMEZONE"; then
|
||||
echo "Unknown TIMEZONE '$TIMEZONE' in $CONF (see: timedatectl list-timezones)." >&2
|
||||
exit 1
|
||||
fi
|
||||
timedatectl set-timezone "$TIMEZONE"
|
||||
|
||||
echo "==> Packages"
|
||||
lighttpd_preinstalled=0
|
||||
dpkg -s lighttpd >/dev/null 2>&1 && lighttpd_preinstalled=1
|
||||
apt-get update
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y \
|
||||
build-essential git pkg-config python3 \
|
||||
librtlsdr-dev libusb-1.0-0-dev libncurses-dev lighttpd
|
||||
if [ "$lighttpd_preinstalled" -eq 0 ]; then
|
||||
systemctl disable --now lighttpd 2>/dev/null || true
|
||||
fi
|
||||
|
||||
echo "==> Building"
|
||||
as_owner git -C "$DIR" submodule update --init --recursive
|
||||
as_owner make -C "$DIR/external/dump1090" -j"$(nproc)" \
|
||||
RTLSDR=yes BLADERF=no HACKRF=no LIMESDR=no SOAPYSDR=no \
|
||||
CPPFLAGS="-Wno-error=format-truncation" dump1090
|
||||
as_owner make -C "$DIR" -j"$(nproc)" app
|
||||
|
||||
echo "==> Installing"
|
||||
install -m 755 "$DIR/external/dump1090/dump1090" /usr/local/bin/flightwall-dump1090
|
||||
rm -rf /usr/local/share/flightwall/html
|
||||
mkdir -p /usr/local/share/flightwall /etc/flightwall
|
||||
cp -r "$DIR/external/dump1090/public_html" /usr/local/share/flightwall/html
|
||||
sed "s|__WEB_PORT__|$WEB_PORT|" "$DIR/deploy/lighttpd.conf" > /etc/flightwall/lighttpd.conf
|
||||
|
||||
getent group plugdev >/dev/null || groupadd --system plugdev
|
||||
id dump1090 >/dev/null 2>&1 ||
|
||||
useradd --system --no-create-home --shell /usr/sbin/nologin -G plugdev dump1090
|
||||
install -m 644 "$DIR/deploy/99-flightwall-rtlsdr.rules" /etc/udev/rules.d/
|
||||
udevadm control --reload-rules && udevadm trigger
|
||||
|
||||
for unit in flightwall flightwall-dump1090 flightwall-web; do
|
||||
sed "s|__INSTALL_DIR__|$DIR|g" "$DIR/deploy/$unit.service" > "/etc/systemd/system/$unit.service"
|
||||
done
|
||||
|
||||
for svc in dump1090 dump1090-fa dump1090-mutability readsb; do
|
||||
if systemctl cat "$svc.service" >/dev/null 2>&1; then
|
||||
echo "Disabling existing $svc service"
|
||||
systemctl disable --now "$svc.service" || true
|
||||
fi
|
||||
done
|
||||
|
||||
echo "==> Hardware"
|
||||
cat > /etc/modprobe.d/flightwall.conf <<'EOF'
|
||||
blacklist snd_bcm2835
|
||||
blacklist dvb_usb_rtl28xxu
|
||||
blacklist rtl2832
|
||||
blacklist rtl2830
|
||||
EOF
|
||||
modprobe -r dvb_usb_rtl28xxu rtl2832 rtl2830 2>/dev/null || true
|
||||
|
||||
for boot in /boot/firmware /boot; do
|
||||
[ -f "$boot/cmdline.txt" ] && break
|
||||
done
|
||||
|
||||
if [ -f "$boot/cmdline.txt" ] && [ "$(nproc --all)" -ge 4 ] &&
|
||||
! grep -q 'isolcpus=' "$boot/cmdline.txt"; then
|
||||
sed -i -E '1 s/[[:space:]]*$/ isolcpus=3/' "$boot/cmdline.txt"
|
||||
REBOOT=1
|
||||
fi
|
||||
|
||||
if [ -f "$boot/config.txt" ]; then
|
||||
if grep -qE '^dtparam=audio=on' "$boot/config.txt"; then
|
||||
sed -i -E 's/^dtparam=audio=on/dtparam=audio=off/' "$boot/config.txt"
|
||||
REBOOT=1
|
||||
elif ! grep -qE '^dtparam=audio=off' "$boot/config.txt"; then
|
||||
echo "dtparam=audio=off" >> "$boot/config.txt"
|
||||
REBOOT=1
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "==> Services"
|
||||
systemctl daemon-reload
|
||||
systemctl enable flightwall-dump1090 flightwall-web flightwall
|
||||
systemctl restart flightwall-dump1090 flightwall-web flightwall
|
||||
|
||||
ip="$(hostname -I | awk '{print $1}')"
|
||||
echo
|
||||
echo "Done. Web UI: http://${ip:-<pi-ip>}:$WEB_PORT"
|
||||
if [ "$REBOOT" -eq 1 ]; then
|
||||
echo "Boot config changed (isolcpus / audio). Reboot to apply: sudo reboot"
|
||||
fi
|
||||