From 9907c08308d460ea138a887ca9c05d4d84bd0f3c Mon Sep 17 00:00:00 2001 From: Matthew Kennedy Date: Wed, 13 Mar 2024 03:59:06 -0400 Subject: [PATCH] bootloader tolerates missing pins --- firmware/bootloader/bootloader_main.cpp | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/firmware/bootloader/bootloader_main.cpp b/firmware/bootloader/bootloader_main.cpp index 630f17ac9a..4d908f73c3 100644 --- a/firmware/bootloader/bootloader_main.cpp +++ b/firmware/bootloader/bootloader_main.cpp @@ -27,14 +27,26 @@ protected: auto greenPort = getBrainPinPort(green); auto greenPin = getBrainPinIndex(green); - palSetPad(yellowPort, yellowPin); - palSetPad(bluePort, bluePin); - palSetPad(greenPort, greenPin); + if (yellowPort) { + palSetPad(yellowPort, yellowPin); + } + if (bluePort) { + palSetPad(bluePort, bluePin); + } + if (greenPort) { + palSetPad(greenPort, greenPin); + } while (true) { - palTogglePad(yellowPort, yellowPin); - palTogglePad(bluePort, bluePin); - palTogglePad(greenPort, greenPin); + if (yellowPort) { + palTogglePad(yellowPort, yellowPin); + } + if (bluePort) { + palTogglePad(bluePort, bluePin); + } + if (greenPort) { + palTogglePad(greenPort, greenPin); + } // blink 3 times faster if Dual Bank is not enabled chThdSleepMilliseconds(isFlashDualBank() ? 250 : 80); }