Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send a negative value MCP2515 #111

Open
verygoodguy opened this issue Jul 7, 2024 · 1 comment
Open

Send a negative value MCP2515 #111

verygoodguy opened this issue Jul 7, 2024 · 1 comment

Comments

@verygoodguy
Copy link

Hi,
I'm using the struct
struct can_frame { canid_t can_id; /* 32 bit CAN_ID + EFF/RTR/ERR flags */ __u8 can_dlc; /* frame payload length in byte (0 .. CAN_MAX_DLEN) */ __u8 data[CAN_MAX_DLEN] __attribute__((aligned(8))); }; to send data to mi CAN bus network. Everything is ok but there is a semantic mistake when I try to send negative values.

Checking the struct it's a __u8 so it make sense the data I'm sending is not ok for the library. But how can I handle this situation?
Can anybody help me, please?

Best

@Gradar66
Copy link

Hi,

I'm using the struct

`struct can_frame {

canid_t can_id;  /* 32 bit CAN_ID + EFF/RTR/ERR flags */

__u8    can_dlc; /* frame payload length in byte (0 .. CAN_MAX_DLEN) */

__u8    data[CAN_MAX_DLEN] __attribute__((aligned(8)));

};` to send data to mi CAN bus network. Everything is ok but there is a semantic mistake when I try to send negative values.

Checking the struct it's a __u8 so it make sense the data I'm sending is not ok for the library. But how can I handle this situation?

Can anybody help me, please?

Best

Hi! Plz give you're code here.

in normal operation of the CAN bus of the car, there should not be such situations when you would need a negative value. describe specifically what you need to do! Let's say a negative number for Mazda is uint8_t 0-50 and this will be 0=-50 degrees Celsius, everything above 50 is 0-205 degrees.

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

No branches or pull requests

2 participants