mirror of
https://github.com/whowechina/geki_pico.git
synced 2025-03-01 15:30:37 +01:00
Fix cache crosstalk
This commit is contained in:
parent
c4cedde58b
commit
5c6411c847
@ -1821,10 +1821,8 @@ static bool dataReady()
|
|||||||
// measurement)
|
// measurement)
|
||||||
uint16_t vl53l1x_readContinuousMillimeters()
|
uint16_t vl53l1x_readContinuousMillimeters()
|
||||||
{
|
{
|
||||||
static uint16_t cached = 0;
|
|
||||||
|
|
||||||
while (!dataReady()) {
|
while (!dataReady()) {
|
||||||
return cached;
|
return INSTANCE.result.range_mm;
|
||||||
}
|
}
|
||||||
|
|
||||||
readResults();
|
readResults();
|
||||||
@ -1838,8 +1836,7 @@ uint16_t vl53l1x_readContinuousMillimeters()
|
|||||||
getRangingData();
|
getRangingData();
|
||||||
write_reg(SYSTEM__INTERRUPT_CLEAR, 0x01); // sys_interrupt_clear_range
|
write_reg(SYSTEM__INTERRUPT_CLEAR, 0x01); // sys_interrupt_clear_range
|
||||||
|
|
||||||
cached = INSTANCE.result.range_mm;
|
return INSTANCE.result.range_mm;
|
||||||
return cached;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// "Setup ranges after the first one in low power auto mode by turning off
|
// "Setup ranges after the first one in low power auto mode by turning off
|
||||||
|
Loading…
x
Reference in New Issue
Block a user