Commit graph

113 commits

Author SHA1 Message Date
bunnie
a421b7abfa replace watchdog hack with an atomicbool; reset cam on setup
This patch replaces the watchdog thread with a spin-wait on
an atomicbool that is set by the IRQ handler once an IRQ
triggers. This is a much cleaner, lower-overhead way to handle
the time out.

This patch also puts the camera setup into a retry loop, and
by default on setup it does a hardware reset of the display
subsystem (this includes the OLED screen). This hopefully
gives the subsystem a much better chance of recovering from
the camera being in a scrambled state. The working theory
for why the camera might get scrambled is that it assumes
it is a sole I2C device, and when its init sequence is
interrupted by other devices handling requests it does
not handle this situation gracefully.
2026-05-29 00:08:02 +08:00
bunnie
db60bca7fb fix formatting 2026-05-27 13:30:13 +08:00
bunnie
d325f80e31 gate camera wdt behind a feature flag
not needed in all scenarios
2026-05-27 13:19:11 +08:00
bunnie
f0c80a17fa adjust camera wakeup params 2026-05-26 02:22:01 +08:00
bunnie
a4316e2aa7 add dry-run api to gfx
dry-runs are useful for warming up "hot paths" in UI code
to improve latency. This is specifically a feature for tuning
interactions on systems that have swap memory.
2026-05-24 00:45:13 +08:00
bunnie
9232b87139 fix camera inconsistent start issue
on first boot, camera may not always start (some boards it never starts)
it always starts on a second prompting

the issue is related to the relevant code being swapped out, it seems;
i think an event fires and gets missed in the fray of all the data
being swapped in from off-chip storage.

this patch:

- re-orders the pipe warming and system bring-up
- adds a watchdog thread that ensures the camera interrupt fires,
and if it does not, issues a manual camera interrupt to kick
start the system

This greatly improves the reliability of first-start success. Across
several trials on many units i had only one misfire - not sure what
it was, can't reproduce, but this is much better than the roughly
80-90% misfire rate I was seeing before.

ship it.
2026-05-18 17:51:32 +08:00
bunnie
351830c7d0 implementation side of non-blocking dimming 2026-05-05 23:54:51 +08:00
bunnie
6a7caff54c improve display boot stability
an instance of the SPI interface timing out was observed on boot.
It's rare, but it happens.

This wraps those early calls with a retry loop and then
fail to reboot in case something really goes wrong.

Assisted-by: qwen3.6:27b (local)
2026-04-26 17:32:05 +08:00
bunnie
4d1dc33ef1 add a diffusive transition option to the graphics library
makes changing between bitmaps less jarring
2026-04-23 15:14:27 +08:00
bunnie
a40eba8199 fix hosted mode warnings 2026-04-22 12:07:49 +08:00
bunnie
8f16270efa fix handling of orientation inputs 2026-04-22 03:05:00 +08:00
bunnie
d020bda4be ignore accelerometer "keys" in video loop 2026-04-22 01:22:18 +08:00
bunnie
2ec739e54e fix orientation flipping during QR scan mode
turns out you don't just flip everything all the time! when
you flip the board upside down, the camera also flips. so then
you end up with a flipped image which is super-confusing.

however, the overlay text needs to flip. so this adds the
cases to handle that.
2026-04-21 01:21:51 +08:00
bunnie
0c23c5e5bc add eternal-scan feature
this is useful for aligning factory test features
2026-04-13 00:03:42 +08:00
bunnie
1ce29e80fa add ability to flip rendering of sh1107 screen
this allows a device to be flipped upside-down and have
the screen track orientation
2026-04-07 00:36:39 +08:00
bunnie
2f9a7cd723 reset the udma block for the camera on every frame
improves stability across multiple captures
2026-04-03 01:53:13 +08:00
bunnie
4f9584ec9e cleanup qr code capture behavior
goes to blank screen after capture instead of previous ui state
also cleans up transitions between camera and run mode
2026-04-02 03:47:46 +08:00
bunnie
e3408f5346 fix more emulated modes 2026-03-31 01:18:53 +08:00
bunnie
3993a0dc88 'fix' for timeout issue on SPIM during display writes
occassionally the hardware block just goes unresponsive. the
'fix' is to reset it, and then re-initialize the interface.

I suspect this has to do with the UDMA silently dropping transactions
when there's too much contention on the bus.
2026-03-30 23:34:25 +08:00
bunnie
73021cb2ed add brightness setting function 2026-03-23 18:33:43 +08:00
bunnie
d4933e96a4 make baochip boot logo drawing optional in the kernel driver 2026-03-23 17:23:58 +08:00
bunnie
4f37317427 add bitmap rendering API for baosec targets 2026-03-23 14:52:00 +08:00
bunnie
3035143172 fix hosted mode 2026-03-06 21:26:22 +08:00
bunnie
017ab2a5fd report QR code when test code is scanned 2026-03-06 19:18:05 +08:00
bunnie
3f869ca389 bump utralib version for publication 2026-01-29 19:12:00 +08:00
bunnie
b2cf705c59 bump ticktimer version to drop susres dependency 2026-01-28 20:53:57 +08:00
bunnie
c2640458f5 fix hosted mode and warnings 2026-01-28 15:21:39 +08:00
bunnie
5a3319ae57 optimize camera frame rate
it's now around 30Hz.
2026-01-27 22:06:18 +08:00
bunnie
e329ebeb1d oem-baosec-lite support to bao-video
remap pwm lock output. This reduces power consumption in
camera mode by removing an I/O conflict with the keyboard
scanner.
2026-01-24 23:51:22 +08:00
bunnie
fba011db3a commit version bump so that we may publish our packages 2026-01-08 03:04:19 +08:00
bunnie
cabfbde7f2 cleanup false positive warnings in latest rustc 2026-01-06 13:41:54 +08:00
bunnie
e676ccbed8 cleanup dead code warnings found by latest rustc 2026-01-06 13:41:04 +08:00
bunnie
444d7b310e re-enable keyboard bouncer inside bao-video hosted mode 2025-12-24 13:14:48 +08:00
bunnie
d874c3e5c2 commit for version bump 2025-12-16 02:02:37 +08:00
bunnie
e1cde0328c cleanup broken alt-target builds 2025-12-16 01:07:35 +08:00
bunnie
8269f9f759 update apis to accommodate power savings mode 2025-12-11 02:10:25 +08:00
bunnie
0ada90fec5 fix power consumption on camera
mclk wasn't stopping correctly, causing lots of leakage power.
2025-12-11 02:03:43 +08:00
bunnie
c9d513599c fix hosted mode 2025-12-08 01:41:44 +08:00
bunnie
772c818908 reduce power from camera 2025-12-08 01:09:12 +08:00
bunnie
c813aa1b92 add hook on bao-video to handle the qr_render case 2025-12-07 19:01:00 +08:00
bunnie
3b1784d346 make screen panic messages somewhat more useful
some panic messages are hundreds of characters long, most of them
are path hashes or paths to crates that are less useful.

truncate any panic messages to the last set of displayable
characters, so that the "most useful" portion (e.g. file name
and line number) are always visible in a panic.
2025-11-28 18:41:53 +08:00
bunnie
106f7153a1 filter key presses through the video layer
the video layer is the "traffic cop" managing when modals
get focus. This patch creates a feed from the video layer
that listers to subscribe to that filters out key presses
destined for modals.
2025-11-28 18:40:56 +08:00
bunnie
84a083017c gate off incompatible features for hosted mode 2025-11-27 22:11:13 +08:00
bunnie
80eba30099 use screen real estate a bit more efficiently on panic 2025-11-27 17:57:41 +08:00
bunnie
1f9ab022f2 implement on-demand QR code scanning 2025-11-27 16:50:47 +08:00
bunnie
54f476edd3 fixup hosted mode emulation for baosec 2025-11-08 04:20:30 +08:00
bunnie
308529bd75 cleanup warning 2025-11-08 03:51:42 +08:00
bunnie
60f1b90acb fixup apis 2025-10-30 04:14:48 +08:00
bunnie
0003921eb1 disable preemption during video capture
the camirq is a perfectly good source of preemption,
and xous will run other threads when the handler is finished.

having both natural timer preemption and camera preemption running
at the sime time seems unnecessary and hurts performance.
2025-10-26 13:37:31 +08:00
bunnie
f68cc0ba83 reorder some bao-video operation for a cleaner init sequence 2025-10-25 22:55:23 +08:00