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:
@@ -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
|
||||||
|
|||||||
@@ -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:
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user