Make Wormhole.timeoutMs uint32_t instead of uint16_t. Respect Wormhole.timeoutMs and timeout accordingly. Force the minimum timeout to 1000 ms.

This commit is contained in:
László Monda
2017-10-16 23:21:34 +02:00
parent ec456b9582
commit 40cbba1da1
3 changed files with 11 additions and 1 deletions

View File

@@ -339,6 +339,15 @@ static peripheral_descriptor_t const *get_active_peripheral(void)
{ {
milliseconds = BL_DEFAULT_PERIPHERAL_DETECT_TIMEOUT; milliseconds = BL_DEFAULT_PERIPHERAL_DETECT_TIMEOUT;
} }
if (IS_WORMHOLE_OPEN) {
milliseconds = Wormhole.timeoutMs;
}
if (milliseconds < BL_MIN_PERIPHERAL_DETECT_TIMEOUT) {
milliseconds = BL_MIN_PERIPHERAL_DETECT_TIMEOUT;
}
timeoutTicks = milliseconds * ticksPerMillisecond; timeoutTicks = milliseconds * ticksPerMillisecond;
// save how many ticks we're currently at before the detection loop starts // save how many ticks we're currently at before the detection loop starts

View File

@@ -22,7 +22,7 @@
typedef struct { typedef struct {
uint64_t magicNumber; uint64_t magicNumber;
uint8_t enumerationMode; uint8_t enumerationMode;
uint16_t timeoutMs; uint32_t timeoutMs;
} wormhole_t; } wormhole_t;
// Variables: // Variables:

View File

@@ -84,6 +84,7 @@
#define BL_DEFAULT_PERIPHERAL_DETECT_TIMEOUT 0 #define BL_DEFAULT_PERIPHERAL_DETECT_TIMEOUT 0
#else #else
#define BL_DEFAULT_PERIPHERAL_DETECT_TIMEOUT 5000 #define BL_DEFAULT_PERIPHERAL_DETECT_TIMEOUT 5000
#define BL_MIN_PERIPHERAL_DETECT_TIMEOUT 1000
#endif // DEBUG #endif // DEBUG
#define BL_FEATURE_POWERDOWN (0) #define BL_FEATURE_POWERDOWN (0)