Skip to content

Commit 40cbba1

Browse files
committed
Make Wormhole.timeoutMs uint32_t instead of uint16_t. Respect Wormhole.timeoutMs and timeout accordingly. Force the minimum timeout to 1000 ms.
1 parent ec456b9 commit 40cbba1

3 files changed

Lines changed: 11 additions & 1 deletion

File tree

src/bootloader/src/bl_main.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,15 @@ static peripheral_descriptor_t const *get_active_peripheral(void)
339339
{
340340
milliseconds = BL_DEFAULT_PERIPHERAL_DETECT_TIMEOUT;
341341
}
342+
343+
if (IS_WORMHOLE_OPEN) {
344+
milliseconds = Wormhole.timeoutMs;
345+
}
346+
347+
if (milliseconds < BL_MIN_PERIPHERAL_DETECT_TIMEOUT) {
348+
milliseconds = BL_MIN_PERIPHERAL_DETECT_TIMEOUT;
349+
}
350+
342351
timeoutTicks = milliseconds * ticksPerMillisecond;
343352

344353
// save how many ticks we're currently at before the detection loop starts

src/bootloader/wormhole.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
typedef struct {
2323
uint64_t magicNumber;
2424
uint8_t enumerationMode;
25-
uint16_t timeoutMs;
25+
uint32_t timeoutMs;
2626
} wormhole_t;
2727

2828
// Variables:

targets/MK22F51212/src/bootloader_config.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@
8484
#define BL_DEFAULT_PERIPHERAL_DETECT_TIMEOUT 0
8585
#else
8686
#define BL_DEFAULT_PERIPHERAL_DETECT_TIMEOUT 5000
87+
#define BL_MIN_PERIPHERAL_DETECT_TIMEOUT 1000
8788
#endif // DEBUG
8889

8990
#define BL_FEATURE_POWERDOWN (0)

0 commit comments

Comments
 (0)