diff --git a/include/sensors/core/tasks/capacitive_driver.hpp b/include/sensors/core/tasks/capacitive_driver.hpp index 58ab83fbf..408d45342 100644 --- a/include/sensors/core/tasks/capacitive_driver.hpp +++ b/include/sensors/core/tasks/capacitive_driver.hpp @@ -79,14 +79,19 @@ class FDC1004 { auto get_sensor_id() -> can::ids::SensorId { return sensor_id; } auto set_sensor_id(can::ids::SensorId _id) -> void { - if (shared_sensor && sensor_id != _id) { - if (_id == can::ids::SensorId::S1) { - measure_mode = fdc1004::MeasureConfigMode::TWO; - } else { - measure_mode = fdc1004::MeasureConfigMode::ONE; - } + if (sensor_id != _id) { + // we should always update the sensor id sensor_id = _id; - update_capacitance_configuration(); + if (shared_sensor) { + // if we're sharing the sensor, then we need to update + // the measure mode + if (_id == can::ids::SensorId::S1) { + measure_mode = fdc1004::MeasureConfigMode::TWO; + } else { + measure_mode = fdc1004::MeasureConfigMode::ONE; + } + update_capacitance_configuration(); + } } }