Skip to content

Commit

Permalink
fix(gripper): capacitive sensor task should use correct sensor ID (#781)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahiuchingau authored Aug 1, 2024
1 parent 9928142 commit 97885c9
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions include/sensors/core/tasks/capacitive_driver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 (using_both_sensors) {
// 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();
}
}
}

Expand Down

0 comments on commit 97885c9

Please sign in to comment.