diff --git a/include/common/core/sensor_buffer.hpp b/include/common/core/sensor_buffer.hpp index 6e255dc36..ea4aabd85 100644 --- a/include/common/core/sensor_buffer.hpp +++ b/include/common/core/sensor_buffer.hpp @@ -1,6 +1,5 @@ #pragma once #ifndef SENSOR_BUFF_SIZE -#define SENSOR_BUFFER_SIZE 0 -#else +#define SENSOR_BUFF_SIZE 1 +#endif constexpr size_t SENSOR_BUFFER_SIZE = SENSOR_BUFF_SIZE; -#endif \ No newline at end of file diff --git a/include/sensors/core/tasks/pressure_driver.hpp b/include/sensors/core/tasks/pressure_driver.hpp index e313dce6c..13ce583fc 100644 --- a/include/sensors/core/tasks/pressure_driver.hpp +++ b/include/sensors/core/tasks/pressure_driver.hpp @@ -2,6 +2,18 @@ #include +// Not my favorite way to check this, but if we don't have access +// to vTaskDelay during host compilation so just dummy the function +template +requires std::is_integral_v +static void _hardware_delay(T ticks) { +#ifndef INC_TASK_H + std::ignore = ticks; +#else + vTaskDelay(ticks); +#endif +} + #include "can/core/can_writer_task.hpp" #include "can/core/ids.hpp" #include "can/core/messages.hpp" @@ -292,7 +304,8 @@ class MMR920 { for (int i = 0; i < static_cast(SENSOR_BUFFER_SIZE); i++) { // send over buffer and then clear buffer values // NOLINTNEXTLINE(div-by-zero) - int current_index = (i + sensor_buffer_index) % static_cast(SENSOR_BUFFER_SIZE); + int current_index = (i + sensor_buffer_index) % + static_cast(SENSOR_BUFFER_SIZE); can_client.send_can_message( can::ids::NodeId::host, @@ -304,7 +317,7 @@ class MMR920 { (*sensor_buffer).at(current_index))}); if (i % 10 == 0) { // slow it down so the can buffer doesn't choke - vTaskDelay(50); + _hardware_delay(50); } (*sensor_buffer).at(current_index) = 0; }