Skip to content

Commit

Permalink
Remove reset the range sensor state
Browse files Browse the repository at this point in the history
You do not need to reset the sensor state if it has become a fail (it has become a fault for a reason). One example of a real error: due to the incorrect path to the device file, the sensor state became fail, after that, during initialization, this state was reset and when trying to read data from this sensor, the program terminated with SEGFAULT.
  • Loading branch information
danielsheh02 authored and iakov committed Sep 27, 2024
1 parent 62b038a commit 391bee5
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions trikControl/src/rangeSensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,9 @@ RangeSensor::Status RangeSensor::status() const

void RangeSensor::init()
{
if (mState.isFailed()) {
mState.resetFailure();
if (!mState.isFailed()) {
QMetaObject::invokeMethod(mSensorWorker.data(), &RangeSensorWorker::init);
}

QMetaObject::invokeMethod(mSensorWorker.data(), &RangeSensorWorker::init);
}

int RangeSensor::read()
Expand Down

0 comments on commit 391bee5

Please sign in to comment.