Skip to content

Commit

Permalink
got scheduler to blink status led
Browse files Browse the repository at this point in the history
  • Loading branch information
vegano1 committed Jan 5, 2024
1 parent 2b6c2ef commit 2d3ba85
Show file tree
Hide file tree
Showing 22 changed files with 620 additions and 2,007 deletions.
4 changes: 1 addition & 3 deletions hepa-uv/core/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
function(target_hepauv_core TARGET)
target_sources(${TARGET} PUBLIC
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/can_tasks.cpp
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/tasks.cpp
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/tasks_g.cpp
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/tasks_z.cpp)
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/tasks.cpp)
target_include_directories(${TARGET} PUBLIC ${CMAKE_CURRENT_FUNCTION_LIST_DIR})
target_link_libraries(${TARGET} PUBLIC common-core)
target_include_directories(${TARGET} INTERFACE ${CMAKE_SOURCE_DIR}/cpp-utils/include)
Expand Down
49 changes: 2 additions & 47 deletions hepa-uv/core/can_tasks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,11 @@
using namespace can::dispatch;

static auto& main_queues = hepauv_tasks::get_main_queues();
static auto& z_queues = hepauv_tasks::z_tasks::get_queues();
static auto& g_queues = hepauv_tasks::g_tasks::get_queues();

auto can_sender_queue = freertos_message_queue::FreeRTOSMessageQueue<
can::message_writer_task::TaskMessage>{};

/** The parsed message handler */
static auto can_motor_handler =
can::message_handlers::motor::MotorHandler{z_queues};
static auto can_move_group_handler =
can::message_handlers::move_group::MoveGroupHandler{z_queues};
static auto can_motion_handler =
can::message_handlers::motion::MotionHandler{z_queues};
static auto can_brushed_motor_handler =
can::message_handlers::motor::BrushedMotorHandler{g_queues};
static auto can_brushed_motion_handler =
can::message_handlers::motion::BrushedMotionHandler{g_queues};
static auto can_brushed_move_group_handler =
can::message_handlers::move_group::BrushedMoveGroupHandler{g_queues};
static auto gripper_info_handler =
gripper_info::GripperInfoMessageHandler{main_queues, main_queues};
static auto sensor_handler = sensors::handlers::SensorHandler{main_queues};
Expand All @@ -51,24 +37,6 @@ static auto eeprom_dispatch_target =
can::messages::ReadFromEEPromRequest>{
eeprom_message_handler};

static auto motor_dispatch_target =
can_task::MotorDispatchTarget{can_motor_handler};

static auto motion_group_dispatch_target =
can_task::MoveGroupDispatchTarget{can_move_group_handler};

static auto motion_dispatch_target =
can_task::MotionControllerDispatchTarget{can_motion_handler};

static auto brushed_motor_dispatch_target =
can_task::BrushedMotorDispatchTarget{can_brushed_motor_handler};

static auto brushed_motion_dispatch_target =
can_task::BrushedMotionDispatchTarget{can_brushed_motion_handler};

static auto brushed_motion_group_dispatch_target =
can_task::BrushedMoveGroupDispatchTarget{can_brushed_move_group_handler};

static auto gripper_info_dispatch_target =
can_task::GripperInfoDispatchTarget{gripper_info_handler};

Expand All @@ -86,18 +54,6 @@ struct CheckForNodeId {
}
};

CheckForNodeId check_for_z{.node_id = can::ids::NodeId::gripper_z};

CheckForNodeId check_for_g{.node_id = can::ids::NodeId::gripper_g};

static auto dispatcher_z = can::dispatch::Dispatcher(
check_for_z, motor_dispatch_target, motion_group_dispatch_target,
motion_dispatch_target);

static auto dispatcher_g = can::dispatch::Dispatcher(
check_for_g, brushed_motion_dispatch_target, brushed_motor_dispatch_target,
brushed_motion_group_dispatch_target);

/** Dispatcher to the various handlers */
static auto main_dispatcher = can::dispatch::Dispatcher(
[](uint32_t arbitration_id) -> bool {
Expand All @@ -108,9 +64,8 @@ static auto main_dispatcher = can::dispatch::Dispatcher(
(node_id == can::ids::NodeId::gripper_z) ||
(node_id == can::ids::NodeId::gripper_g));
},
dispatcher_z, dispatcher_g, system_dispatch_target,
gripper_info_dispatch_target, eeprom_dispatch_target,
sensor_dispatch_target);
system_dispatch_target, gripper_info_dispatch_target,
eeprom_dispatch_target, sensor_dispatch_target);

auto static reader_message_buffer =
freertos_message_buffer::FreeRTOSMessageBuffer<1024>{};
Expand Down
13 changes: 1 addition & 12 deletions hepa-uv/core/tasks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,9 @@ static auto eeprom_data_rev_update_builder =
*/
void hepauv_tasks::start_tasks(
can::bus::CanBus& can_bus,
brushed_motor::BrushedMotor<lms::GearBoxConfig>& grip_motor,
i2c::hardware::I2CBase& i2c2, i2c::hardware::I2CBase& i2c3,
sensors::hardware::SensorHardwareBase& sensor_hardware,
eeprom::hardware_iface::EEPromHardwareIface& eeprom_hw_iface,
motor_hardware_task::MotorHardwareTask& zmh_tsk,
motor_hardware_task::MotorHardwareTask& gmh_tsk) {
eeprom::hardware_iface::EEPromHardwareIface& eeprom_hw_iface) {
auto& can_writer = can_task::start_writer(can_bus);
can_task::start_reader(can_bus);
tasks.can_writer = &can_writer;
Expand Down Expand Up @@ -118,14 +115,6 @@ void hepauv_tasks::start_tasks(
&capacitive_sensor_task_front.get_queue();
queues.capacitive_sensor_queue_rear =
&capacitive_sensor_task_rear.get_queue();

g_tasks::start_task(grip_motor, tasks, queues, tail_accessor);

z_tasks::get_queues().set_queue(&can_writer.get_queue());
g_tasks::get_queues().set_queue(&can_writer.get_queue());

zmh_tsk.start_task();
gmh_tsk.start_task();
}

hepauv_tasks::QueueClient::QueueClient(can::ids::NodeId this_fw)
Expand Down
102 changes: 0 additions & 102 deletions hepa-uv/core/tasks_g.cpp

This file was deleted.

113 changes: 0 additions & 113 deletions hepa-uv/core/tasks_z.cpp

This file was deleted.

6 changes: 1 addition & 5 deletions hepa-uv/firmware/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ set(REVISIONS hepa-rev1)
# Add source files that should be checked by clang-tidy here
set(HEPAUV_FW_LINTABLE_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/freertos_idle_timer_task.cpp
${CMAKE_CURRENT_SOURCE_DIR}/interfaces_grip_motor.cpp
${CMAKE_CURRENT_SOURCE_DIR}/interfaces_z_motor.cpp
${CMAKE_CURRENT_SOURCE_DIR}/eeprom_keys.cpp
${COMMON_EXECUTABLE_DIR}/system/iwdg.cpp
${CAN_FW_DIR}/hal_can_bus.cpp
Expand All @@ -27,9 +25,7 @@ set(HEPAUV_FW_NON_LINTABLE_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/clocking.c
${CMAKE_CURRENT_SOURCE_DIR}/utility_gpio.c
${CMAKE_CURRENT_SOURCE_DIR}/can.c
${CMAKE_CURRENT_SOURCE_DIR}/motor_hardware_g.c
${CMAKE_CURRENT_SOURCE_DIR}/motor_hardware_z.c
${CMAKE_CURRENT_SOURCE_DIR}/motor_hardware_shared.c
${CMAKE_CURRENT_SOURCE_DIR}/led_hardware.c
${CMAKE_CURRENT_SOURCE_DIR}/i2c_setup.c
${COMMON_EXECUTABLE_DIR}/errors/errors.c
${COMMON_EXECUTABLE_DIR}/system/app_update.c
Expand Down
Loading

0 comments on commit 2d3ba85

Please sign in to comment.