Dataype Overflow
bool CheckSensorAlive(Sensor *sensor) {
static uint32_t current_time_stamp;
// assuming the timestamp of sensors is also uint32_t and would be updated every time the sensor got new data
if (current_time_stamp - sensor->time_stamp > SENSOR_STILL_ALIVE_TIME)
return false;
current_time_stamp += SENSOR_UPDATE_RATE;
return true;
}bool CheckSensorAlive(Sensor *sensor) {
static uint32_t current_time_stamp;
// assuming the timestamp of sensors is also uint32_t and would be updated every time the sensor got new data
if (current_time_stamp > SENSOR_STILL_ALIVE_TIME + sensor->time_stamp)
return false;
current_time_stamp += SENSOR_UPDATE_RATE;
return true;
}Last updated