Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(gripper): capacitive sensor task should use correct sensor ID #781

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading