Skip to content

Commit cdee2c5

Browse files
authored
Add LED indication for button handling in Yellow's U-Boot (#3536)
With #3523 as inspiration, it might be useful to wait for buttons to be released, e.g. in case when they become stuck. Also indicate the button operation (wipe, boot files removal, UMS) has been handled by turning on the yellow LED.
1 parent 7e7612f commit cdee2c5

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

buildroot-external/board/raspberrypi/yellow/uboot-boot64.ush

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,29 @@ test -n "${MACHINE_ID}" || setenv BOOT_CONDITION "systemd.condition-first-boot=t
2323
# HassOS bootargs
2424
setenv bootargs_hassos "zram.enabled=1 zram.num_devices=3 rootwait systemd.machine_id=${MACHINE_ID} cgroup_enable=memory fsck.repair=yes ${BOOT_CONDITION}"
2525

26+
setenv confirm_reset_handled ' \
27+
led usr on; \
28+
echo "Waiting for red button to be released";
29+
while gpio input GPIO27; do sleep 0.5; done;'
30+
2631
# Red Button pressed?
2732
if gpio input GPIO27; then
2833
sleep 1
2934
# ... and Blue Button Pressed?
3035
if gpio input GPIO26; then
3136
echo "Boot wipe has been pressed, deleting boot files to trigger USB boot..."
37+
run confirm_reset_handled
3238
fatrm ${devtype} ${devnum}:1 /start4.elf
3339
reset
3440
fi
3541
# Red still pressed?
3642
if gpio input GPIO27; then
3743
echo "Device wipe button has been pressed, setting wipe flag..."
44+
run confirm_reset_handled
3845
setenv bootargs_hassos "${bootargs_hassos} haos.wipe=1"
3946
fi
4047
elif gpio input GPIO26; then
48+
led usr on
4149
ums 0 ${devtype} ${devnum}
4250
fi
4351

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
11
CONFIG_CMD_USB_MASS_STORAGE=y
2+
3+
CONFIG_LED=y
4+
CONFIG_LED_GPIO=y
5+
CONFIG_CMD_LED=y

0 commit comments

Comments
 (0)