Skip to content

pixpaper-213-m: rpi5: add Open-EP virtual pet for the RPi5 e-paper - #5

Closed
lc-wang wants to merge 2 commits into
open-ep:masterfrom
lc-wang:master
Closed

lc-wang wants to merge 2 commits into
open-ep:masterfrom
lc-wang:master

Conversation

@lc-wang

@lc-wang lc-wang commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds Open-EP Pet, a Tamagotchi-style virtual pet for the 2.13" mono
PixPaper (RPi5), running in both landscape (250×122) and portrait (122×250)
on the existing clean partial-refresh path. It has a Japanese UI and a
pixel-art puppy with idle animations and reactions to the on-screen buttons.

Features

  • Two orientations — landscape and portrait; orientation only changes the
    logical→RAM coordinate map in fb_set() (portrait is a true 90° rotation).
  • Japanese UI — title, stat labels (空腹/元気/気分) and buttons
    (エサ/あそぶ/そうじ) drawn from a tiny embedded 1-bit CJK bitmap font that
    holds only the glyphs actually used.
  • Pixel-art puppy — 7 expression frames (idle, blink, happy, sad, eat,
    look, surprised), height-normalised so every expression is the same size.
  • Liveliness — idle gesture scheduler (blink / double-blink / look / sway /
    yawn / heart) plus a startle + action animation on Feed / Play / Clean, and a
    sleep state with Zzz after a while idle.
  • Input — keyboard (f/p/c/q) or a self-running auto demo.

Files

File What
pixpaper-213-m-test-rpi5-pet.c the pet app (UI, stat bars, gesture scheduler, actions, input)
jpfont.h / jpfont_gen.py embedded Japanese bitmap font + its generator (Noto Sans CJK)
petsprite.h / sprite_gen.py / dog*.png puppy sprite frames + generator + source art
pet_auto.gif portrait auto-demo preview

Build & run (on the RPi5; needs libgpiod v2)

gcc -O2 -o pet pixpaper-213-m-test-rpi5-pet.c -lgpiod

./pet                 # landscape, interactive
./pet portrait        # portrait
./pet auto            # self-running demo (e.g. ./pet auto portrait)
# keys: f=Feed  p=Play  c=Clean  q=quit

jpfont.h and petsprite.h are committed, so no Python is needed to build.
Regenerate them after changing the UI text or the dog*.png art:

python3 jpfont_gen.py        # -> jpfont.h    (needs Noto Sans CJK)
python3 sprite_gen.py --emit # -> petsprite.h (needs the dog*.png)

A virtual pet for the 2.13" mono pixpaper,
running in both landscape and portrait on the clean partial-refresh path.
It has a Japanese UI and a pixel-art puppy with idle animations and
reactions to the on-screen buttons.

Build (on the RPi5; needs libgpiod v2):

    gcc -O2 -o pet pixpaper-213-m-test-rpi5-pet.c -lgpiod

jpfont.h and petsprite.h are committed, so no Python is needed to build.
To regenerate them after changing the UI text or the dog*.png art:

    python3 jpfont_gen.py        # -> jpfont.h   (needs Noto Sans CJK)
    python3 sprite_gen.py --emit # -> petsprite.h (needs the dog*.png)

Run:

    ./pet                 landscape, interactive
    ./pet portrait        portrait orientation
    ./pet auto            self-running demo (also used when stdin is not a
                          tty); combine, e.g. ./pet auto portrait

    keys: f = Feed, p = Play, c = Clean, q = quit

Signed-off-by: LiangCheng Wang <zaq14760@gmail.com>
@lc-wang
lc-wang requested a review from wigcheng June 23, 2026 09:28
@lc-wang lc-wang closed this Jun 24, 2026
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.

1 participant