agittins / bermuda

Bermuda Bluetooth/BLE Triangulation / Trilateration for HomeAssistant
MIT License
208 stars 6 forks source link

Add null and non-positive time checks in calculate_data #181

Closed skrashevich closed 1 month ago

skrashevich commented 1 month ago

In the calculate_data function within the init.py, two additional checks have been incorporated into the processing loop. The first check skips the iteration if the hist_stamp[i] is None, avoiding errors when accessing uninitialized data. The second check ensures the iteration is skipped if the time difference delta_t is zero or negative, which helps prevent division by zero errors when calculating velocity. These improvements enhance the reliability of the data calculation function by preventing potential crashes and errors during execution.