Skip to content

Migrate images to Wikimedia, default to ILI9341_2, refresh image layout#3

Open
haxorthematrix wants to merge 1 commit into
ThomDyson:mainfrom
haxorthematrix:wikipedia-images-and-microusb-layout
Open

Migrate images to Wikimedia, default to ILI9341_2, refresh image layout#3
haxorthematrix wants to merge 1 commit into
ThomDyson:mainfrom
haxorthematrix:wikipedia-images-and-microusb-layout

Conversation

@haxorthematrix

Copy link
Copy Markdown

Summary

  • Image source migrated to Wikimedia Commons. Cornell's BirdNET image gallery (the https://birdnet.cornell.edu/files/2019/09/... URLs) has been taken down — every URL in the old data/birds.csv now returns 404. This PR regenerates the CSV against the Wikipedia REST API: 984 of 986 species are mapped to Wikimedia thumbnails at the 330px fixed width. The two remaining species (Moltoni's warbler, Olive sparrow) have no JPG illustration on their English Wikipedia article and keep placeholder URLs.
  • Default display driver flipped to ILI9341_2_DRIVER in platformio.ini — correct for the original micro-USB ESP32-2432S028R CYD variant — and the TFT_RGB_ORDER=TFT_BGR line (which was only needed by the ST7789 path) is removed. The README's variant-swap step is updated to match.
  • Bird-detail screen rendering refresh. src/main.cpp now uses TJpgDec.getFsJpgSize() to read each cached JPG's actual dimensions and picks the smallest power-of-2 scale (1, 1/2, 1/4, 1/8) that fits a 200×180 canvas, then draws the result centered. The canvas is background-cleared on every cycle (previously only on the no-image fallback path), so swapping between landscape, square, and portrait thumbnails no longer leaves stale pixels at the edges. TMLabel is repositioned right of the wider image canvas and vertically centered with the image; RSLabel shifts with it.
  • README updated with new sections covering the Wikipedia migration, the 330px width / TJpgDec scale interaction, and the new on-screen layout.
  • .gitignore added for .pio/, .vscode/, and local birds.csv.*-backup artifacts.

Why 330px?

Wikimedia only serves thumbnails at a fixed allow-list of widths ({60, 120, 250, 330, 500, ...}). 330 was chosen because TJpg_Decoder's setJpgScale(2) renders it to ~165px wide — large enough to fill most of the 200×180 canvas without overflowing, and small enough that very tall portrait crops can still down-scale to 1/4 if needed.

Test plan

  • Builds clean against espressif32 6.11.0 with the bundled framework-arduinoespressif32 3.20017.241212
  • Firmware flashes and boots on an ESP32-2432S028R (micro-USB) using ILI9341_2_DRIVER
  • LittleFS image with the regenerated CSV uploads via pio run -t uploadfs
  • On-device verification: ~165px-wide images render and center correctly for landscape, square, and portrait Wikipedia thumbnails; background clears between rotations; no edge ghosting
  • TMLabel ("X minutes ago") is vertically centered with the image and does not overlap it
  • Reviewer test: confirm behavior on a USB-C CYD variant after manually flipping to ST7789_DRIVER per the updated README step 3

🤖 Generated with Claude Code

Cornell's BirdNET image gallery (https://birdnet.cornell.edu/files/2019/09/...)
was removed at some point, so every URL in data/birds.csv now returns 404.
This regenerates the CSV against the Wikipedia REST API (984 / 986 species
mapped; Moltoni's warbler and Olive sparrow have no JPG illustration on the
English Wikipedia and keep placeholder URLs). All URLs use Wikimedia's
fixed-width thumbnail pattern at 330px.

Defaults the platformio.ini display driver to ILI9341_2_DRIVER (the
original micro-USB ESP32-2432S028R CYD variant) and removes the
TFT_RGB_ORDER=TFT_BGR override that was needed only for the ST7789 path.
The README's variant-swap instructions are updated to match.

Bird-detail screen rendering now:
  - Reads the cached JPG's dimensions via TJpgDec.getFsJpgSize() and picks
    the smallest power-of-2 scale that fits a 200x180 image canvas, then
    centers the result inside that canvas.
  - Background-clears the canvas on every cycle (previously only on the
    no-image fallback path), so swapping between landscape, square, and
    portrait Wikipedia thumbnails no longer leaves stale pixels.
  - Repositions TMLabel / RSLabel right of the wider image canvas and
    vertically centers TMLabel with the image.

Adds a .gitignore for .pio/, .vscode/, and the local birds.csv.*-backup
artifacts produced during the image-source migration.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@ThomDyson

Copy link
Copy Markdown
Owner

Thanks for this. It'll take me a couple of days to get to processing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants