Thread Management:
Changed MeasurementThread to inherit from QThread instead of QObject
Added proper thread cleanup in reconnect_device()
Added checks for thread existence before attempting operations
Error Handling:
Added more robust error handling around thread operations
Ensured proper cleanup of resources during reconnection attempts
Added checks for thread running state before attempting to stop it
Initialization:
Explicitly initialized thread variables to None
Added proper null checks before accessing thread methods
Device Reconnection:
Improved the reconnection flow with better cleanup
Added status messages to keep user informed
(D)