Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add LED indication for button handling in Yellow's U-Boot #3536

Merged
merged 1 commit into from
Aug 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions buildroot-external/board/raspberrypi/yellow/uboot-boot64.ush
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,29 @@ test -n "${MACHINE_ID}" || setenv BOOT_CONDITION "systemd.condition-first-boot=t
# HassOS bootargs
setenv bootargs_hassos "zram.enabled=1 zram.num_devices=3 rootwait systemd.machine_id=${MACHINE_ID} cgroup_enable=memory fsck.repair=yes ${BOOT_CONDITION}"

setenv confirm_reset_handled ' \
led usr on; \
echo "Waiting for red button to be released";
while gpio input GPIO27; do sleep 0.5; done;'

# Red Button pressed?
if gpio input GPIO27; then
sleep 1
# ... and Blue Button Pressed?
if gpio input GPIO26; then
echo "Boot wipe has been pressed, deleting boot files to trigger USB boot..."
run confirm_reset_handled
fatrm ${devtype} ${devnum}:1 /start4.elf
reset
fi
# Red still pressed?
if gpio input GPIO27; then
echo "Device wipe button has been pressed, setting wipe flag..."
run confirm_reset_handled
setenv bootargs_hassos "${bootargs_hassos} haos.wipe=1"
fi
elif gpio input GPIO26; then
led usr on
ums 0 ${devtype} ${devnum}
fi

Expand Down
4 changes: 4 additions & 0 deletions buildroot-external/board/raspberrypi/yellow/uboot.config
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
CONFIG_CMD_USB_MASS_STORAGE=y

CONFIG_LED=y
CONFIG_LED_GPIO=y
CONFIG_CMD_LED=y