Skip to content

Commit

Permalink
tease out a little extra data about how much data the sensor collected
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanthecoder committed Feb 8, 2024
1 parent cb4e03c commit 672baed
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion include/sensors/core/tasks/pressure_driver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,13 @@ class MMR920C04 {
}

void send_accumulated_pressure_data(uint32_t message_index) {
can_client.send_can_message(
can::ids::NodeId::host,
can::messages::ReadFromSensorResponse{
.message_index = pressure_buffer_index,
.sensor = can::ids::SensorType::pressure,
.sensor_id = sensor_id,
.sensor_data = 9999});
for (int i = 0; i < pressure_buffer_index; i++) {
// send over buffer adn then clear buffer values
can_client.send_can_message(
Expand All @@ -295,7 +302,7 @@ class MMR920C04 {
.sensor_id = sensor_id,
.sensor_data =
mmr920C04::reading_to_fixed_point((*p_buff)[i])});

if (i%10 == 0) { vTaskDelay(100); } // slow it down so the can buffer doesn't choke
(*p_buff)[i] = 0;
}
}
Expand Down

0 comments on commit 672baed

Please sign in to comment.