Skip to content

Commit

Permalink
CAN logic update
Browse files Browse the repository at this point in the history
  • Loading branch information
Dragon-Knight committed Oct 10, 2023
1 parent 41c0704 commit 2e2616e
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions include/CANLogic.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ namespace CANLib

can_frame.initialized = true;
can_frame.function_id = CAN_FUNC_EVENT_OK;
can_frame.data[0] = TrunkHood::driver2.GetState();
can_frame.raw_data_length = 2;

return CAN_RESULT_CAN_FRAME;
});
Expand Down Expand Up @@ -165,6 +167,8 @@ namespace CANLib

can_frame.initialized = true;
can_frame.function_id = CAN_FUNC_EVENT_OK;
can_frame.data[0] = TrunkHood::driver1.GetState();
can_frame.raw_data_length = 2;

return CAN_RESULT_CAN_FRAME;
});
Expand All @@ -189,20 +193,20 @@ namespace CANLib
})
.RegisterFunctionToggle([](can_frame_t &can_frame, can_error_t &error) -> can_result_t
{
/*
TrunkHood::driver1.ActionInvert();
Outputs::outObj.SetToggle(1);

can_frame.initialized = true;
can_frame.function_id = CAN_FUNC_EVENT_OK;
*/
can_frame.data[0] = Outputs::outObj.GetState(1);
can_frame.raw_data_length = 2;

return CAN_RESULT_CAN_FRAME;
});


obj_leftdoor_control.RegisterFunctionAction([](can_frame_t &can_frame, can_error_t &error) -> can_result_t
{
// Action
Outputs::outObj.SetOn(2, 1000);

can_frame.initialized = true;
can_frame.function_id = CAN_FUNC_EVENT_OK;
Expand All @@ -213,7 +217,7 @@ namespace CANLib

obj_rightdoor_control.RegisterFunctionAction([](can_frame_t &can_frame, can_error_t &error) -> can_result_t
{
// Action
Outputs::outObj.SetOn(3, 1000);

can_frame.initialized = true;
can_frame.function_id = CAN_FUNC_EVENT_OK;
Expand Down Expand Up @@ -241,12 +245,12 @@ namespace CANLib
})
.RegisterFunctionToggle([](can_frame_t &can_frame, can_error_t &error) -> can_result_t
{
/*
TrunkHood::driver1.ActionInvert();
Outputs::outObj.SetToggle(4);

can_frame.initialized = true;
can_frame.function_id = CAN_FUNC_EVENT_OK;
*/
can_frame.data[0] = Outputs::outObj.GetState(4);
can_frame.raw_data_length = 2;

return CAN_RESULT_CAN_FRAME;
});
Expand All @@ -270,12 +274,12 @@ namespace CANLib
})
.RegisterFunctionToggle([](can_frame_t &can_frame, can_error_t &error) -> can_result_t
{
/*
TrunkHood::driver1.ActionInvert();
Outputs::outObj.SetToggle(5);

can_frame.initialized = true;
can_frame.function_id = CAN_FUNC_EVENT_OK;
*/
can_frame.data[0] = Outputs::outObj.GetState(5);
can_frame.raw_data_length = 2;

return CAN_RESULT_CAN_FRAME;
});
Expand All @@ -300,12 +304,12 @@ namespace CANLib
})
.RegisterFunctionToggle([](can_frame_t &can_frame, can_error_t &error) -> can_result_t
{
/*
TrunkHood::driver1.ActionInvert();
Outputs::outObj.SetToggle(6);

can_frame.initialized = true;
can_frame.function_id = CAN_FUNC_EVENT_OK;
*/
can_frame.data[0] = Outputs::outObj.GetState(6);
can_frame.raw_data_length = 2;

return CAN_RESULT_CAN_FRAME;
});
Expand Down

0 comments on commit 2e2616e

Please sign in to comment.