Skip to content

Commit e224dde

Browse files
committed
rename ControlTask -> PressureTask
1 parent d97e118 commit e224dde

File tree

9 files changed

+43
-42
lines changed

9 files changed

+43
-42
lines changed

stm32-modules/include/vacuum-module/firmware/firmware_tasks.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ constexpr uint8_t SYSTEM_TASK_PRIORITY = 1;
2121
constexpr size_t UI_STACK_SIZE = 256;
2222
constexpr uint8_t UI_TASK_PRIORITY = 1;
2323

24-
constexpr size_t CONTROL_STACK_SIZE = 256;
25-
constexpr uint8_t CONTROL_TASK_PRIORITY = 1;
24+
constexpr size_t PRESSURE_STACK_SIZE = 256;
25+
constexpr uint8_t PRESSURE_TASK_PRIORITY = 1;
2626
} // namespace tasks

stm32-modules/include/vacuum-module/firmware/control_policy.hpp renamed to stm32-modules/include/vacuum-module/firmware/pressure_policy.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
#include "i2c_comms.hpp"
66
#include "systemwide.h"
77

8-
namespace control_policy {
8+
namespace pressure_policy {
99
using namespace i2c::hardware;
1010

11-
class ControlPolicy {
11+
class PressurePolicy {
1212
public:
13-
ControlPolicy(I2C *i2c) : i2c_comms{i2c} {}
13+
PressurePolicy(I2C *i2c) : i2c_comms{i2c} {}
1414

1515
template <size_t Len>
1616
auto i2c_write(uint8_t device_address, uint8_t register_address,
@@ -24,4 +24,4 @@ class ControlPolicy {
2424
private:
2525
I2C *i2c_comms;
2626
};
27-
} // namespace control_policy
27+
} // namespace pressure_policy

stm32-modules/include/vacuum-module/vacuum-module/messages.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,6 @@ using SystemMessage =
122122

123123
using UIMessage = ::std::variant<std::monostate, SetStatusBarStateMessage>;
124124

125-
using ControlMessage = ::std::variant<std::monostate>;
125+
using PressureMessage = ::std::variant<std::monostate>;
126126

127127
}; // namespace messages

stm32-modules/include/vacuum-module/vacuum-module/control_task.hpp renamed to stm32-modules/include/vacuum-module/vacuum-module/pressure_task.hpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,40 +5,40 @@
55
#include "core/ack_cache.hpp"
66
#include "core/queue_aggregator.hpp"
77
#include "core/version.hpp"
8-
#include "firmware/control_policy.hpp"
8+
#include "firmware/pressure_policy.hpp"
99
#include "vacuum-module/errors.hpp"
1010
#include "vacuum-module/messages.hpp"
1111
#include "vacuum-module/tasks.hpp"
1212
#include "hal/message_queue.hpp"
1313
#include "messages.hpp"
1414

15-
namespace control_task {
15+
namespace pressure_task {
1616
template <typename P>
1717
concept PressureControlPolicy = requires(P p) {
1818
{ p.sleep_ms(1) };
1919
};
2020

21-
using ControlPolicy = control_policy::ControlPolicy;
22-
using Message = messages::ControlMessage;
21+
using PressurePolicy = pressure_policy::PressurePolicy;
22+
using Message = messages::PressureMessage;
2323
using Error = errors::ErrorCode;
2424

2525
template <template <class> class QueueImpl>
2626
requires MessageQueue<QueueImpl<Message>, Message>
27-
class ControlTask {
27+
class PressureTask {
2828
private:
2929
using Queue = QueueImpl<Message>;
3030
using Aggregator = typename tasks::Tasks<QueueImpl>::QueueAggregator;
3131
using Queues = typename tasks::Tasks<QueueImpl>;
3232

3333
public:
34-
explicit ControlTask(Queue& q, Aggregator* aggregator, ControlPolicy* policy)
34+
explicit PressureTask(Queue& q, Aggregator* aggregator, PressurePolicy* policy)
3535
: _message_queue(q),
3636
_task_registry(aggregator) {}
37-
ControlTask(const ControlTask& other) = delete;
38-
auto operator=(const ControlTask& other) -> ControlTask& = delete;
39-
ControlTask(ControlTask&& other) noexcept = delete;
40-
auto operator=(ControlTask&& other) noexcept -> ControlTask& = delete;
41-
~ControlTask() = default;
37+
PressureTask(const PressureTask& other) = delete;
38+
auto operator=(const PressureTask& other) -> PressureTask& = delete;
39+
PressureTask(PressureTask&& other) noexcept = delete;
40+
auto operator=(PressureTask&& other) noexcept -> PressureTask& = delete;
41+
~PressureTask() = default;
4242

4343
auto provide_aggregator(Aggregator* aggregator) {
4444
_task_registry = aggregator;
@@ -93,4 +93,4 @@ class ControlTask {
9393
bool _initialized{false};
9494
};
9595

96-
} // namespace control_task
96+
} // namespace pressure_task

stm32-modules/include/vacuum-module/vacuum-module/tasks.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ struct Tasks {
1717
using SystemQueue = QueueImpl<messages::SystemMessage>;
1818
// Message queue for UI task
1919
using UIQueue = QueueImpl<messages::UIMessage>;
20-
// Message queue for Control task
21-
using ControlQueue = QueueImpl<messages::ControlMessage>;
20+
// Message queue for Pressure task
21+
using PressureQueue = QueueImpl<messages::PressureMessage>;
2222

2323
// Central aggregator
2424
using QueueAggregator =
25-
queue_aggregator::QueueAggregator<HostCommsQueue, SystemQueue, UIQueue, ControlQueue>;
25+
queue_aggregator::QueueAggregator<HostCommsQueue, SystemQueue, UIQueue, PressureQueue>;
2626

2727
// Addresses
2828
static constexpr size_t HostCommsAddress =
@@ -31,8 +31,8 @@ struct Tasks {
3131
QueueAggregator::template get_queue_idx<SystemQueue>();
3232
static constexpr size_t UIAddress =
3333
QueueAggregator::template get_queue_idx<UIQueue>();
34-
static constexpr size_t ControlAddress =
35-
QueueAggregator::template get_queue_idx<ControlQueue>();
34+
static constexpr size_t PressureAddress =
35+
QueueAggregator::template get_queue_idx<PressureQueue>();
3636
};
3737

3838
}; // namespace tasks

stm32-modules/vacuum-module/firmware/CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ set(VENT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/vent")
1616
set(PUMP_DIR "${CMAKE_CURRENT_SOURCE_DIR}/pump")
1717
set(ATMOSPHERE_PS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/atmosphere-pressure-sensor")
1818
set(VACUUM_PS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/vacuum-pressure-sensor")
19+
set(PRESSURE_CONTROL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/pressure_task")
1920

2021
# Add source files that should be checked by clang-tidy here
2122
set(${TARGET_MODULE_NAME}_FW_LINTABLE_SRCS
@@ -31,8 +32,8 @@ set(${TARGET_MODULE_NAME}_FW_LINTABLE_SRCS
3132
${PUMP_DIR}/pump_policy.cpp
3233
${ATMOSPHERE_PS_DIR}/atmosphere_pressure_sensor_policy.cpp
3334
${VACUUM_PS_DIR}/vacuum_pressure_sensor_policy.cpp
34-
${CONTROL_DIR}/freertos_control_task.cpp
35-
${CONTROL_DIR}/control_policy.cpp
35+
${PRESSURE_CONTROL_DIR}/freertos_pressure_task.cpp
36+
${PRESSURE_CONTROL_DIR}/pressure_policy.cpp
3637
)
3738

3839
# Add source files that should NOT be checked by clang-tidy here

stm32-modules/vacuum-module/firmware/main.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
using EntryPoint = std::function<void(tasks::FirmwareTasks::QueueAggregator *)>;
2222
using EntryPointUI = std::function<void(tasks::FirmwareTasks::QueueAggregator *,
2323
i2c::hardware::I2C *)>;
24-
using EntryPointControl = std::function<void(tasks::FirmwareTasks::QueueAggregator *,
24+
using EntryPointPressure = std::function<void(tasks::FirmwareTasks::QueueAggregator *,
2525
i2c::hardware::I2C *)>;
2626

2727
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
@@ -31,7 +31,7 @@ static auto host_comms_entry = EntryPoint(host_comms_control_task::run);
3131
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
3232
static auto system_task_entry = EntryPoint(system_control_task::run);
3333
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
34-
static auto control_task_entry = EntryPointControl(pressure_control_task::run);
34+
static auto pressure_task_entry = EntryPointPressure(pressure_control_task::run);
3535

3636
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
3737
static auto host_comms_task =
@@ -46,9 +46,9 @@ static auto system_task =
4646
ot_utils::freertos_task::FreeRTOSTask<tasks::SYSTEM_STACK_SIZE, EntryPoint>(
4747
system_task_entry);
4848
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
49-
static auto control_task =
50-
ot_utils::freertos_task::FreeRTOSTask<tasks::CONTROL_STACK_SIZE, EntryPointControl>(
51-
control_task_entry);
49+
static auto pressure_task =
50+
ot_utils::freertos_task::FreeRTOSTask<tasks::PRESSURE_STACK_SIZE, EntryPointPressure>(
51+
pressure_task_entry);
5252

5353
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
5454
static auto aggregator = tasks::FirmwareTasks::QueueAggregator();
@@ -73,7 +73,7 @@ auto main() -> int {
7373
system_task.start(tasks::SYSTEM_TASK_PRIORITY, "System", &aggregator);
7474
host_comms_task.start(tasks::COMMS_TASK_PRIORITY, "Comms", &aggregator);
7575
ui_task.start(tasks::UI_TASK_PRIORITY, "UI", &aggregator, &i2c2_comms);
76-
control_task.start(tasks::CONTROL_TASK_PRIORITY, "Control", &aggregator, &i2c2_comms);
76+
pressure_task.start(tasks::PRESSURE_TASK_PRIORITY, "Pressure", &aggregator, &i2c2_comms);
7777

7878
vTaskStartScheduler();
7979
return 0;

stm32-modules/vacuum-module/firmware/control_task/freertos_control_task.cpp renamed to stm32-modules/vacuum-module/firmware/pressure_task/freertos_pressure_task.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,24 @@
44
#include "firmware/firmware_tasks.hpp"
55
#include "firmware/freertos_tasks.hpp"
66
#include "firmware/i2c_comms.hpp"
7-
#include "firmware/control_policy.hpp"
8-
#include "vacuum-module/control_task.hpp"
7+
#include "firmware/pressure_policy.hpp"
8+
#include "vacuum-module/pressure_task.hpp"
99
#include "task.h"
1010

1111
namespace pressure_control_task {
12-
using namespace control_policy;
12+
using namespace pressure_policy;
1313

1414
enum class Notifications : uint8_t {
1515
INCOMING_MESSAGE = 1,
1616
};
1717

1818
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
19-
static tasks::FirmwareTasks::ControlQueue
19+
static tasks::FirmwareTasks::PressureQueue
2020
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
21-
_queue(static_cast<uint8_t>(Notifications::INCOMING_MESSAGE), "Control Queue");
21+
_queue(static_cast<uint8_t>(Notifications::INCOMING_MESSAGE), "Pressure Queue");
2222

2323
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
24-
static auto _top_task = control_task::ControlTask(_queue, nullptr, nullptr);
24+
static auto _top_task = pressure_task::PressureTask(_queue, nullptr, nullptr);
2525

2626
auto run(tasks::FirmwareTasks::QueueAggregator* aggregator,
2727
i2c::hardware::I2C* i2c1_comms) -> void {
@@ -30,7 +30,7 @@ auto run(tasks::FirmwareTasks::QueueAggregator* aggregator,
3030
aggregator->register_queue(_queue);
3131
_top_task.provide_aggregator(aggregator);
3232

33-
auto policy = ControlPolicy(i2c1_comms);
33+
auto policy = PressurePolicy(i2c1_comms);
3434
while (true) {
3535
_top_task.run_once(policy);
3636
}
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
#include "firmware/control_policy.hpp"
1+
#include "firmware/pressure_policy.hpp"
22

33
#include <cstdint>
44

55
#include "FreeRTOS.h"
66
#include "projdefs.h"
77
#include "task.h"
88

9-
using namespace control_policy;
9+
using namespace pressure_policy;
1010

1111

1212
// NOLINTNEXTLINE(readability-convert-member-functions-to-static)
13-
auto ControlPolicy::sleep_ms(uint32_t ms) -> void {
13+
auto PressurePolicy::sleep_ms(uint32_t ms) -> void {
1414
vTaskDelay(pdMS_TO_TICKS(ms));
1515
}

0 commit comments

Comments
 (0)