No description
  • Go 96.4%
  • Shell 2.3%
  • Dockerfile 1.3%
Find a file
Daniel Esteban a97a2d0326 fix
2026-08-09 11:55:44 +02:00
.claude added sending BLE messages 2026-06-04 19:24:14 +02:00
.vscode added sending BLE messages 2026-06-04 19:24:14 +02:00
cmd fix 2026-04-25 17:32:25 +02:00
docker fix 2026-04-25 17:36:01 +02:00
.gitignore added cmd to generate logo images 2026-04-18 12:19:58 +02:00
accel3d.go almost everything working for nicebadge 2026-04-17 18:43:42 +02:00
accel3d_gopherbadge.go almost everything working for nicebadge 2026-04-17 18:43:42 +02:00
accel3d_pybadge.go added files 2026-04-14 19:21:59 +02:00
adventure.go updated adventure and schedule 2026-06-04 14:44:45 +02:00
adventure_map.md added sending BLE messages 2026-06-04 19:24:14 +02:00
badge.go added sending BLE messages 2026-06-04 19:24:14 +02:00
ble.go added sending BLE messages 2026-06-04 19:24:14 +02:00
ble_stub.go added sending BLE messages 2026-06-04 19:24:14 +02:00
data.go updated adventure and schedule 2026-06-04 14:44:45 +02:00
defs_default.go added sending BLE messages 2026-06-04 19:24:14 +02:00
defs_gopherbadge.go added sending BLE messages 2026-06-04 19:24:14 +02:00
defs_nicebadge.go added sending BLE messages 2026-06-04 19:24:14 +02:00
defs_pybadge.go fix 2026-08-09 11:55:44 +02:00
docker-compose.badge.yml fix 2026-04-25 17:20:12 +02:00
Dockerfile ifix:x 2026-04-25 17:07:19 +02:00
Dockerfile.server fix 2026-04-25 08:26:11 +02:00
game_colors.go almost everything working for nicebadge 2026-04-17 18:43:42 +02:00
gameoflife.go almost everything working for nicebadge 2026-04-17 18:43:42 +02:00
go.mod added sending BLE messages 2026-06-04 19:24:14 +02:00
go.sum added sending BLE messages 2026-06-04 19:24:14 +02:00
info.go added bootloader option to menu 2026-04-28 17:54:19 +02:00
info_pybadge.go added bootloader option to menu 2026-04-28 17:54:19 +02:00
leds.go almost everything working for nicebadge 2026-04-17 18:43:42 +02:00
LICENSE Initial commit 2026-04-14 17:20:45 +00:00
logo.bin added images for logo, minor fixes 2026-04-21 22:18:18 +02:00
main.go added sending BLE messages 2026-06-04 19:24:14 +02:00
menu.go added sending BLE messages 2026-06-04 19:24:14 +02:00
messages.go added sending BLE messages 2026-06-04 19:24:14 +02:00
music.go added files 2026-04-14 19:21:59 +02:00
pacman.go changes 2026-04-21 21:51:05 +02:00
rand.go added files 2026-04-14 19:21:59 +02:00
README.md Added GTO trajectory based on https://github.com/tinygo-org/tinybench/ 2026-05-16 15:31:27 +02:00
reflex.go changes 2026-04-21 21:51:05 +02:00
schedule.go added files 2026-04-14 19:21:59 +02:00
snake.go almost everything working for nicebadge 2026-04-17 18:43:42 +02:00
trajectory.go improved GTO trajectory 2026-05-17 09:15:20 +02:00
trajectory_disabled.go fix 2026-08-09 11:55:44 +02:00

badges

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

Menu options

The main menu lists the available modes for each hardware target. The options shown depend on what is defined in menuOptions inside each defs_{board}.go file — simply add or remove a constant from that slice to control which entries appear.

Constant Label Description
modeBadge Badge Shows the personalised badge screen (name, titles, QR code, logo)
modeInfo Info Show QR for quick access to info and tutorials about the board
modeSchedule GopherCon Schedule Browse the conference schedule and mark favourite talks
modeAdventure GopherCon Adventure Text adventure set at the conference
modeLEDs Rainbow LEDs Neopixel LED animations
modeAccelerometer Accelerometer Live 3-axis accelerometer visualisation (hardware with LIS3DH only)
modeMusic Music! Play melodies via the buzzer
modeGameSnake Snake Classic snake game
modeGameLife Game of Life Conway's Game of Life simulation
modeGameColors Color Game Colour-matching reaction game
modeGameReflex Reflex Reaction-time tester
modeGamePacman Pac-Man Pac-Man arcade game
modeEnterBootloader Enter Bootloader Reboots into UF2 bootloader mode for flashing new firmware (NiceBadge only)
modeTrajectory GTO Trajectory Real-world GTO→lunar spacecraft trajectory simulation drawn pixel-by-pixel (NiceBadge only)

Customising per board

Each board's defs_{board}.go file contains a menuOptions slice that controls the order and visibility of menu entries:

// defs_nicebadge.go
var menuOptions = []int8{
    modeBadge,
    modeSchedule,
    modeMusic,
    modeGameSnake,
    modeInfo,
    modeEnterBootloader, // remove this line to hide the option
}

Entries not listed in menuOptions are simply not shown in the menu — no other code changes are needed.


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

cd cmd/logogen
go mod download

Usage

# 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.