2026-04-14 17:20:45 +00:00
|
|
|
|
# badges
|
|
|
|
|
|
|
2026-04-18 10:19:58 +00:00
|
|
|
|
TinyGo badge firmware for multiple hardware targets (GopherBadge, NiceBadge, GoBadge/PyBadge).
|
|
|
|
|
|
|
|
|
|
|
|
## Hardware targets
|
|
|
|
|
|
|
|
|
|
|
|
| Target | Build tag | Resolution |
|
|
|
|
|
|
|--------|-----------|------------|
|
|
|
|
|
|
| GopherBadge | `gopher_badge` | 320×240 |
|
|
|
|
|
|
| NiceBadge | `nicenano` | 240×135 |
|
|
|
|
|
|
| GoBadge / PyBadge | `pybadge` | 160×128 |
|
|
|
|
|
|
|
|
|
|
|
|
## Generating logo.bin
|
|
|
|
|
|
|
|
|
|
|
|
The badge firmware embeds a `logo.bin` file displayed at boot (`showLogoBin` in `badge.go`).
|
|
|
|
|
|
Use the `logogen` command to convert any image to the required hex format.
|
|
|
|
|
|
|
|
|
|
|
|
### Setup
|
|
|
|
|
|
|
|
|
|
|
|
```sh
|
|
|
|
|
|
cd cmd/logogen
|
|
|
|
|
|
go mod download
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
### Usage
|
|
|
|
|
|
|
|
|
|
|
|
```sh
|
|
|
|
|
|
# By target name
|
|
|
|
|
|
go run . -size nicebadge -image tinygo
|
|
|
|
|
|
go run . -size gopherbadge -image gopherconeu
|
|
|
|
|
|
go run . -size gobadge -image golab
|
|
|
|
|
|
|
|
|
|
|
|
# By explicit resolution
|
|
|
|
|
|
go run . -size 320x240 -image /path/to/logo.jpg
|
|
|
|
|
|
|
|
|
|
|
|
# Write directly to the project root logo.bin
|
|
|
|
|
|
go run . -size nicebadge -image tinygo -output ../../logo.bin
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
### Flags
|
|
|
|
|
|
|
|
|
|
|
|
| Flag | Default | Description |
|
|
|
|
|
|
|------|---------|-------------|
|
|
|
|
|
|
| `-size` | *(required)* | Target name (`nicebadge`, `gopherbadge`, `gobadge`, `pybadge`) or explicit resolution (`320x240`) |
|
|
|
|
|
|
| `-image` | *(required)* | File path (relative or absolute) or short name |
|
|
|
|
|
|
| `-output` | `logo.bin` | Output file |
|
|
|
|
|
|
| `-images-dir` | `images` | Directory with source images |
|
|
|
|
|
|
| `-cache-dir` | `cache` | Directory for cached `.bin` files |
|
|
|
|
|
|
|
|
|
|
|
|
### Adding images
|
|
|
|
|
|
|
|
|
|
|
|
Place source images inside `cmd/logogen/images/`:
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
cmd/logogen/images/
|
|
|
|
|
|
tinygo.jpg ← source image for short name "tinygo"
|
|
|
|
|
|
tinygo_240x135.png ← predefined variant for nicebadge (skip resize)
|
|
|
|
|
|
tinygo_320x240.png ← predefined variant for gopherbadge (skip resize)
|
|
|
|
|
|
gopherconeu.jpg
|
|
|
|
|
|
golab.png
|
|
|
|
|
|
...
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
**Resolution priority** for a given short name + target:
|
|
|
|
|
|
|
|
|
|
|
|
1. `<name>_<WxH>.png` / `.jpg` — predefined resized variant, used as-is (no resize)
|
|
|
|
|
|
2. `<name>.png` / `.jpg` / `.jpeg` — base image, resized with BiLinear interpolation
|
|
|
|
|
|
3. Cache hit (`cache/<name>_<WxH>.bin`) — skips all image processing on repeat runs
|
|
|
|
|
|
|
|
|
|
|
|
Generated `.bin` files in `cache/` are gitignored.
|