From 1b65ab89716493924f6e8460724959162858d78f Mon Sep 17 00:00:00 2001 From: ahiuchingau <20424172+ahiuchingau@users.noreply.github.com> Date: Tue, 21 May 2024 14:25:19 -0400 Subject: [PATCH 1/2] make sure we are setting sensor id --- .../sensors/core/tasks/capacitive_driver.hpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/include/sensors/core/tasks/capacitive_driver.hpp b/include/sensors/core/tasks/capacitive_driver.hpp index 505a52e06..93c29653b 100644 --- a/include/sensors/core/tasks/capacitive_driver.hpp +++ b/include/sensors/core/tasks/capacitive_driver.hpp @@ -69,14 +69,19 @@ class FDC1004 { auto get_sensor_id() -> can::ids::SensorId { return sensor_id; } auto set_sensor_id(can::ids::SensorId _id) -> void { - if (using_both_sensors && 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(); + } } } From 64268c1cd1ce56ea97f210bc99ceb5925fe2a335 Mon Sep 17 00:00:00 2001 From: caila-marashaj Date: Thu, 1 Aug 2024 14:53:29 -0400 Subject: [PATCH 2/2] old use of shared_sensor --- include/sensors/core/tasks/capacitive_driver.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/sensors/core/tasks/capacitive_driver.hpp b/include/sensors/core/tasks/capacitive_driver.hpp index 93c29653b..ba3a6e508 100644 --- a/include/sensors/core/tasks/capacitive_driver.hpp +++ b/include/sensors/core/tasks/capacitive_driver.hpp @@ -72,7 +72,7 @@ class FDC1004 { if (sensor_id != _id) { // we should always update the sensor id sensor_id = _id; - if (shared_sensor) { + if (using_both_sensors) { // if we're sharing the sensor, then we need to update // the measure mode if (_id == can::ids::SensorId::S1) {