flashypepo / micropython_dps310

GNU General Public License v3.0
0 stars 0 forks source link

wait_for_temp, wait_for_pressure do not work #1

Open pbljung opened 4 months ago

pbljung commented 4 months ago

The loop condition is always true so it returns immediately regardless of _temp_ready and _pressure_ready.

fix loop condition

    #while self._pressure_ready is False:
        #sleep(0.001)

    while self._pressure_ready == 0:
        utime.sleep_ms(1)

sample test code

 dps.pressure_oversample_count = SampleCount.COUNT_64
 dps.pressure_rate = Rate.RATE_64_HZ
 dps.temperature_oversample_count = SampleCount.COUNT_1
 dps.temperature_rate = Rate.RATE_64_HZ

 for i in range(100):
     dps.wait_temperature_ready()
     t=dps.temperature  
     dps.wait_pressure_ready()
     p=dps.pressure
flashypepo commented 3 months ago

@pbljung : Thanks for mentioning the issue. Good point! I'll need to setup the hardware and will look into it. For the record: all code is from Jose D. Montoya, I only added two entries in tables. However, I'm glad you might have found the (real) bug.