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