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

Frames transmission rate minor fix #21

Open
arla03522 opened this issue Sep 18, 2024 · 1 comment
Open

Frames transmission rate minor fix #21

arla03522 opened this issue Sep 18, 2024 · 1 comment

Comments

@arla03522
Copy link

https://github.com/devcoons/iso15765-canbus/blob/f82f8ad978a54a65feb5be3b4271720fa166d00b/src/lib_iso15765.c#L835C3-L835C70
The value from the configuration should be used in own flow control only.
When transmitting data as a response the value received from the client should be used instead.
if ((ih->out.last_upd.n_cs + ih->config.stmin) > ih->clbs.get_ms())
->
if ((ih->out.last_upd.n_cs + ih->out.stmin) > ih->clbs.get_ms())

@arla03522
Copy link
Author

arla03522 commented Sep 18, 2024

The related problem is that the value received from the client may not be parsed correctly:

n_pdu->n_pci.st = dt[2U + offs];

As a workaround only:

uint8_t st = dt[2U + offs];
switch ( st )
{

case 0 ... 0x7F : // milliseconds range
{
  n_pdu->n_pci.st = st;
  break;
}

case 0xF1 ... 0xF9 : // microseconds range
{
  n_pdu->n_pci.st = 1; // use 1 ms constant
  break;
}

case 0x80 ... 0xF0 : // reserved range
case 0xFA ... 0xFF : // reserved range
default :
{
  n_pdu->n_pci.st = 100; // use 100 ms constant
  break;
}

}

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

1 participant