Skip to content

Detect breaks task#15

Open
Temberlane wants to merge 3 commits intomainfrom
DetectBreaksTask
Open

Detect breaks task#15
Temberlane wants to merge 3 commits intomainfrom
DetectBreaksTask

Conversation

@Temberlane
Copy link

used interupts instead of pooling the data

@Temberlane Temberlane requested a review from toxoscorp January 14, 2025 18:19
Copy link
Member

@toxoscorp toxoscorp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you tested if your code works (I don't see why it wouldn't. I just want to make sure). I added a couple of comment and also I don't remember exactly but is the interrupt called only on state change (from breaking to no breaking and other way around) ? If so, you should add a message when it disable the break too since right now you're only sending it when the break is pressed.


// Sending the brake signal through CAN
if (brake_pressed) {
brakeMsg.standardMessageID = 0x123; // Brake message ID
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest to add this message to UOSM-core

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

void brakes_callback(uint gpio, uint32_t events) {
bool brake_pressed = (events & GPIO_IRQ_EDGE_RISE);
data_aggregator_set_breaks_pressed(brake_pressed);
iCommsMessage_t brakeMsg;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in UOSM-core there is function to create CAN message directly. Those are the standard in our code currently but in the end it does the same thing (IComms_CreateMessage) feel free to look at it and change your function if you want

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Temberlane Temberlane self-assigned this Jan 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants