Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd4e1603

Browse files
committed
Added more signal type class (3 classes for now).
1 parent11426cc commitd4e1603

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

‎src/parser/dbclineparser.cpp‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,12 +161,15 @@ bool DbcLineParser::ParseSignalLine(SignalDescriptor_t* sig, const std::string&
161161

162162
// get info about factor or offset double nature
163163
sig->IsDoubleSig =false;
164+
sig->IsSimpleSig =false;
164165

165166
// for enabling double conversation the factor or offset
166167
// substring must have dot ('.') character
167168
if (valpart[3].find_first_of('.') != std::string::npos ||
168169
valpart[4].find_first_of('.') != std::string::npos)
170+
{
169171
sig->IsDoubleSig =true;
172+
}
170173

171174
// factor = double;
172175
// offset = double;
@@ -193,6 +196,12 @@ bool DbcLineParser::ParseSignalLine(SignalDescriptor_t* sig, const std::string&
193196
sig->Signed = (valpart[2].find('-') == -1) ?0 :1;
194197

195198
sig->Type =GetSigType(sig);
199+
200+
// mark all simple signals to make using them easier
201+
if (!sig->IsDoubleSig && (sig->Factor ==1) && (sig->Offset ==0))
202+
{
203+
sig->IsSimpleSig =true;
204+
}
196205
}
197206

198207
if (tailpart.size() ==3)

‎src/types/message.h‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,21 @@ typedef struct
3838

3939
uint8_t LengthBit;
4040

41+
// By next two fields any signal can be strictly related to one of
42+
// 3 signal type:
43+
// 1 double based scaled value (IsDoubleSig == true)
44+
// 2 integer based scaled value (IsDoubleSig == false && IsSimpleSig == false)
45+
// 3 simple (IsDoubleSig == false && IsSimpleSig == true)
46+
4147
// this flag shows when factor (or offset) is double
4248
// it is used when *_from_S and _to_S macros is generated
4349
bool IsDoubleSig;
4450

51+
// this flag shows if the signal has factor = 1 and offset = 0
52+
// to reject any sigfloat or "toS"/"fromS" operations
53+
// this only when : IsDoubleSig == true || ((s.Factor != 1) || (s.Offset != 0)
54+
bool IsSimpleSig;
55+
4556
double Factor;
4657

4758
double Offset;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp