Skip to content

Commit 4c2377f

Browse files
authored
fix SensorStateUpdate (#418)
After a reboot of the tracker the optional sensor did show up on the server too. This is because a sensor packet was sent from all sensors including empty and unknown. This should hopefully fix the issue. It is a fast fix. It probably would be better to move all this check to sensor, and if the sensor has a chang set the flag, and reset the flag if the function gets called.
1 parent 913a330 commit 4c2377f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/network/connection.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -514,9 +514,11 @@ void Connection::maybeRequestFeatureFlags() {
514514
}
515515

516516
bool Connection::isSensorStateUpdated(int i, std::unique_ptr<Sensor>& sensor) {
517-
return m_AckedSensorState[i] != sensor->getSensorState()
518-
|| m_AckedSensorCalibration[i] != sensor->hasCompletedRestCalibration()
519-
|| m_AckedSensorConfigData[i] != sensor->getSensorConfigData();
517+
return (m_AckedSensorState[i] != sensor->getSensorState()
518+
|| m_AckedSensorCalibration[i] != sensor->hasCompletedRestCalibration()
519+
|| m_AckedSensorConfigData[i] != sensor->getSensorConfigData())
520+
&& sensor->getSensorType() != SensorTypeID::Unknown
521+
&& sensor->getSensorType() != SensorTypeID::Empty;
520522
}
521523

522524
void Connection::searchForServer() {

0 commit comments

Comments
 (0)