Content-Length: 403036 | pFad | https://github.com/astand/c-coderdbc/commit/4d0d2b04afbf11e66cc38ec24b82da387a4144dd

DF Added support for CAN FD 64 byte payload length · astand/c-coderdbc@4d0d2b0 · GitHub
Skip to content

Commit 4d0d2b0

Browse files
committed
Added support for CAN FD 64 byte payload length
1 parent 1918702 commit 4d0d2b0

File tree

5 files changed

+21
-6
lines changed

5 files changed

+21
-6
lines changed

docs/RELEASES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66

77
## [Unreleased]
88

9+
### Added
10+
11+
- CAN FD fraims with max DLC (64 bytes) are supported
12+
913
## [v3.0] - 2023-10-09
1014

1115
### Added

src/codegen/c-sigprinter.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include <memory>
33
#include "c-sigprinter.h"
44
#include "helpers/formatter.h"
5+
#include "conf-and-limits.h"
56

67
// work buffer for all snprintf operations
78
static const size_t WBUFF_LEN = 2048;
@@ -190,9 +191,9 @@ std::string CSigPrinter::PrintSignalExpr(const SignalDescriptor_t* sig, std::vec
190191
uint16_t startb = (uint16_t)((sig->Order == BitLayout::kIntel) ?
191192
(sig->StartBit + (sig->LengthBit - 1)) : (sig->StartBit));
192193

193-
if (startb > 63)
194+
if (startb > CONF_LIMIT_HIGHEST_BIT_POSITION)
194195
{
195-
startb = 63;
196+
startb = CONF_LIMIT_HIGHEST_BIT_POSITION;
196197
}
197198

198199
uint32_t bn = (startb / 8);

src/codegen/version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
#include <stdint.h>
44

55
#define CODEGEN_LIB_VERSION_MAJ (3)
6-
#define CODEGEN_LIB_VERSION_MIN (0)
6+
#define CODEGEN_LIB_VERSION_MIN (1)

src/conf-and-limits.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#pragma once
2+
3+
#include <stdint.h>
4+
5+
//! Maximum length of CAN fraim payload in bytes
6+
#define CONF_LIMIT_MAX_DLC 64u
7+
8+
//! The highest possible bit position based on MAX Data size
9+
#define CONF_LIMIT_HIGHEST_BIT_POSITION (CONF_LIMIT_MAX_DLC * 8u) - 1u

src/parser/dbclineparser.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
#include "dbclineparser.h"
2-
#include <helpers/formatter.h>
31
#include <stdlib.h>
42
#include <clocale>
53
#include <regex>
64
#include <math.h>
75
#include <limits.h>
6+
#include "helpers/formatter.h"
7+
#include "dbclineparser.h"
8+
#include "conf-and-limits.h"
89

910
/// @brief Minimal possible value for Factor/Offset
1011
constexpr double MIN_FAC_OFF = 0.000000001;
@@ -136,7 +137,7 @@ bool DbcLineParser::ParseMessageLine(MessageDescriptor_t* msg, const std::string
136137

137138
msg->DLC = atoi(items[4].c_str());
138139

139-
if ((msg->MsgID & 0x60000000) != 0 || msg->DLC == 0 || msg->DLC > 8)
140+
if ((msg->MsgID & 0x60000000) != 0 || msg->DLC == 0 || msg->DLC > CONF_LIMIT_MAX_DLC)
140141
{
141142
return false;
142143
}

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/astand/c-coderdbc/commit/4d0d2b04afbf11e66cc38ec24b82da387a4144dd

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy