avoid lambda to simplify source code
This commit is contained in:
1 parent
6cd99768ae
commit
03dc8f2a13
6 files changed
+143
-126
No files matched your search
+6
-5
@@ -57,11 +57,12 @@ DecodedFrameValue DbcDecoder::Decode(const DecodeDatabase &database,
|
||||
else
|
||||
decoded.rawValue = unsignedValue;
|
||||
|
||||
decoded.physicalValue =
|
||||
std::visit([&signal](auto rawValue) {
|
||||
return (static_cast<double>(rawValue) * signal.factor) + signal.offset;
|
||||
},
|
||||
decoded.rawValue);
|
||||
double numericValue;
|
||||
if (const auto *signedValue = std::get_if<std::int64_t>(&decoded.rawValue))
|
||||
numericValue = static_cast<double>(*signedValue);
|
||||
else
|
||||
numericValue = static_cast<double>(std::get<std::uint64_t>(decoded.rawValue));
|
||||
decoded.physicalValue = numericValue * signal.factor + signal.offset;
|
||||
decoded.valid = true;
|
||||
|
||||
result.signals.push_back(decoded);
|
||||
|
||||
Reference in new issue
Block a user