Add battery level reporting (Kconfig-gated) and display orientation
Build and push server image / build-and-push (push) Successful in 32s

Battery (firmware + server, disabled by default): new battery.c reads
a 2x200k voltage divider via ADC oneshot with curve-fitting calibration
(the ESP32-C6's scheme), maps through a piecewise LiPo discharge curve,
and restores the pin to button duty after each read -- the settled
XIAO ESP32-C6 design shares the back button's GPIO0/A0, time-shared per
wake. Skipped entirely when on mains (a 2x100k VBUS divider into a
spare digital pin -- the 5V pin is dead on battery power, so presence =
mains, where the charging voltage would read misleadingly full) or when
the reading is implausible. The manage overlay gains a battery region
(static outline glyph + "NN%", below the manage QR, all menu levels),
and the device POSTs to the new /frame/battery endpoint after a
successful fetch; the server stores percent + as-of timestamp, exposed
via /api/queue and shown in the web UI. FRAME_BATTERY_ADC_GPIO /
FRAME_VBUS_SENSE_GPIO default to -1 (fully inert on the dev board);
compile-verified both disabled and enabled, hardware bring-up deferred
until the ordered XIAO + batteries arrive.

Orientation (server-side only): new config setting + web UI dropdown
(landscape / portrait / landscape_flipped / portrait_flipped). Photos
are composed/cropped at the logical hanging shape (portrait crops at
480x800, so face-aware crops match how the frame actually hangs), then
rotated losslessly into the panel's native 800x480 byte layout after
dithering -- the device never knows. Face-label anchors are transformed
through the same rotation (logical_to_native()) so they stay attached
to faces on rotated frames. Known documented limitation: the on-device
manage overlay still renders in native orientation, so it appears
sideways on a portrait-hung frame (QRs scan at any rotation; text reads
sideways).
This commit is contained in:
2026-07-19 22:11:14 -04:00
parent 86d5852f8e
commit 015993af00
17 changed files with 593 additions and 42 deletions
+33
View File
@@ -155,4 +155,37 @@ menu "ESPresso Frame Configuration"
FRAME_COMBO_SOFT_RESET_HOLD_MS so the two tiers can't be
confused for each other.
config FRAME_BATTERY_ADC_GPIO
int "Battery voltage-divider ADC GPIO (-1 to disable)"
default -1
range -1 6
help
GPIO wired to the midpoint of a 2x200k voltage divider from
BAT+ to GND (halving the battery voltage into ADC range --
the wiring Seeed documents for the XIAO ESP32-C6's A0).
Must be GPIO 0-6, the ESP32-C6's only ADC-capable pins. The
settled XIAO design shares this with the back button's pin
(0): a high-impedance divider coexists fine with the
button's pull-up and deep-sleep wake, and the firmware
time-shares the pin (brief ADC read once per wake, restored
to button duty right after). -1 (the default) disables
battery reporting entirely -- correct for boards with no
battery wired, like the DevKitC-1 dev board.
config FRAME_VBUS_SENSE_GPIO
int "USB-power (VBUS) sense GPIO (-1 to disable)"
default -1
range -1 23
depends on FRAME_BATTERY_ADC_GPIO >= 0
help
GPIO wired to the midpoint of a 2x100k divider from the 5V
pin (which only carries voltage when USB is plugged in --
it's dead on battery power) -- a plain digital high/low
"on mains" signal, no ADC needed. The divider is required:
raw 5V exceeds the 3.3V pin limit. When on mains, the
battery indicator is hidden and no battery report is sent
(the charging voltage would read misleadingly full). -1
disables mains detection -- the indicator then shows
whenever the battery reading is plausible.
endmenu