Skip to content

Commit

Permalink
XiaoBLE: Skip boot js when pulling pin D1 high
Browse files Browse the repository at this point in the history
  • Loading branch information
ssievert42 committed Jan 25, 2025
1 parent 5f4db2b commit 69b381e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions boards/XIAOBLE.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
# The board should automatically disconnect after copying is finished, and reboot into Espruino,
# which turns on the red led for a short time after starting up.

# If you accidentally put some stuff in .boot0 that prevents you from interacting with Espruino:
# Pull pin D1 to 3.3 V / high (important: make sure you use 3.3 V; higher voltages may cause damage) and reset the board,
# by either pressing the reset button or cutting the power and powering it up again.
# This behaviour is archived by configuring pin D1 as BTN1.

import pinutils
info = {
"name": "Seeed Xiao BLE",
Expand Down Expand Up @@ -87,6 +92,7 @@
"LED1": {"pin": "D11"},
"LED2": {"pin": "D13"},
"LED3": {"pin": "D12"},
"BTN1": {"pin": "D1", "pinstate" : "IN_PULLDOWN"},
"BAT": {
"pin_charging": "D23",
"pin_voltage": "D32",
Expand Down
7 changes: 7 additions & 0 deletions src/jsflash.c
Original file line number Diff line number Diff line change
Expand Up @@ -1381,6 +1381,9 @@ bool jsfLoadBootCodeFromFlash(bool isReset) {
#else
if (!(jshPinGetValue(BTN1_PININDEX)==BTN1_ONSTATE))
#endif
#endif
#if defined(XIAOBLE)
if (!(jshPinGetValue(BTN1_PININDEX)==BTN1_ONSTATE))
#endif
if (jsiStatus & JSIS_FIRST_BOOT) {
JsVar *code = jsfReadFile(jsfNameFromString(".bootPowerOn"),0,0);
Expand All @@ -1398,6 +1401,10 @@ bool jsfLoadBootCodeFromFlash(bool isReset) {
if (!(jshPinGetValue(BTN1_PININDEX)==BTN1_ONSTATE &&
(jsiStatus & JSIS_FIRST_BOOT)))
#endif
#endif
#if defined(XIAOBLE)
if (!(jshPinGetValue(BTN1_PININDEX)==BTN1_ONSTATE &&
(jsiStatus & JSIS_FIRST_BOOT)))
#endif
{
char filename[7] = ".bootX";
Expand Down

0 comments on commit 69b381e

Please sign in to comment.