iso15765-canbus icon indicating copy to clipboard operation
iso15765-canbus copied to clipboard

Frames transmission rate minor fix

Open arla03522 opened this issue 1 year ago • 1 comments

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 avatar Sep 18 '24 14:09 arla03522

The related problem is that the value received from the client may not be parsed correctly: https://github.com/devcoons/iso15765-canbus/blob/f82f8ad978a54a65feb5be3b4271720fa166d00b/src/lib_iso15765.c#L287

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;
}

}

arla03522 avatar Sep 18 '24 14:09 arla03522

fixed

devcoons avatar Nov 25 '24 19:11 devcoons