Skip to content

Commit

Permalink
fix modulus error during batch send
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanthecoder committed Oct 15, 2024
1 parent a512869 commit 3cc1b99
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion include/sensors/core/tasks/capacitive_driver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,8 @@ class FDC1004 {
}
for (uint8_t i = 0; i < data_len; i++) {
data.at(i) = convert_to_fixed_point(
(*sensor_buffer).at(sensor_buffer_index_start + i),
(*sensor_buffer)
.at((sensor_buffer_index_start + i) % SENSOR_BUFFER_SIZE),
S15Q16_RADIX);
}
auto response = can::messages::BatchReadFromSensorResponse{
Expand Down
7 changes: 5 additions & 2 deletions include/sensors/core/tasks/pressure_driver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,8 +328,11 @@ class MMR920 {
return;
}
for (uint8_t i = 0; i < data_len; i++) {
data.at(i) = mmr920::reading_to_fixed_point(
(*sensor_buffer).at(sensor_buffer_index_start + i));
batch_response_message.sensor_data.at(i) =
mmr920::reading_to_fixed_point(
(*sensor_buffer)
.at((sensor_buffer_index_start + i) %
SENSOR_BUFFER_SIZE));
}
auto response = can::messages::BatchReadFromSensorResponse{
.message_index = message_index,
Expand Down

0 comments on commit 3cc1b99

Please sign in to comment.