aboutsummaryrefslogtreecommitdiffstats
path: root/low-can-binding/can
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2019-12-15 13:35:42 +0100
committerRomain Forlot <romain.forlot@iot.bzh>2020-01-09 16:25:36 +0100
commit05e0dcd47f5cbe62de594c801f1c460622847716 (patch)
tree7c38ad9fbde74dacbbc2ec529111149395a57cf5 /low-can-binding/can
parent334dbd3813551cb6d5e6dfb9d6625d9519caee2d (diff)
format: remove uneeded brackets.
Change-Id: I0689d62e32b9b60059adc2d4be78fa3b2581441c Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'low-can-binding/can')
-rw-r--r--low-can-binding/can/can-decoder.cpp19
1 files changed, 3 insertions, 16 deletions
diff --git a/low-can-binding/can/can-decoder.cpp b/low-can-binding/can/can-decoder.cpp
index 15341b1c..3f05fd53 100644
--- a/low-can-binding/can/can-decoder.cpp
+++ b/low-can-binding/can/can-decoder.cpp
@@ -65,11 +65,9 @@ int decoder_t::handle_sign(const signal_t& signal, std::vector<uint8_t>& data_si
case sign_t::TWOS_COMPLEMENT:
//complement only until end_bit
data_signal[0] = ((data_signal[0] ^ mask) & mask);
- if(data_signal.size() > 1) {
- for(int i=1; i < data_signal.size(); i++) {
+ if(data_signal.size() > 1)
+ for(int i=1; i < data_signal.size(); i++)
data_signal[i] = data_signal[i] ^ 0xFF;
- }
- }
if(signal.get_sign() == sign_t::TWOS_COMPLEMENT)
data_signal[data_signal.size() - 1] = static_cast<uint8_t>(data_signal[data_signal.size() - 1] + 1);
break;
@@ -213,9 +211,7 @@ openxc_DynamicField decoder_t::decode_ascii(signal_t& signal, std::shared_ptr<me
std::string ret_s = "";
openxc_DynamicField openxc_bytes = decode_bytes(signal,message,send);
if(!openxc_bytes.has_bytes_value)
- {
AFB_ERROR("Error no bytes value to translate to ascii");
- }
ret_s = converter_t::to_ascii(openxc_bytes.bytes_value,openxc_bytes.length_array);
openxc_DynamicField ret = build_DynamicField(ret_s);
return ret;
@@ -230,9 +226,7 @@ openxc_DynamicField decoder_t::decode_date(signal_t& signal, std::shared_ptr<mes
// Don't send if they is no changes
if ((signal.get_last_value() == value && !signal.get_send_same()) || !*send )
- {
*send = false;
- }
signal.set_last_value(value);
return decoded_value;
@@ -246,10 +240,7 @@ openxc_DynamicField decoder_t::decode_time(signal_t& signal, std::shared_ptr<mes
openxc_DynamicField decoded_value = build_DynamicField(value);
// Don't send if they is no changes
- if ((signal.get_last_value() == value && !signal.get_send_same()) || !*send )
- {
- *send = false;
- }
+ *send = (signal.get_last_value() == value && !signal.get_send_same()) || !*send ? false : true;
signal.set_last_value(value);
return decoded_value;
@@ -278,9 +269,7 @@ openxc_DynamicField decoder_t::decode_noop(signal_t& signal, std::shared_ptr<mes
// Don't send if they is no changes
if ((signal.get_last_value() == value && !signal.get_send_same()) || !*send )
- {
*send = false;
- }
signal.set_last_value(value);
return decoded_value;
@@ -369,9 +358,7 @@ openxc_DynamicField decoder_t::decode_state(signal_t& signal, std::shared_ptr<me
// Don't send if they is no changes
if ((signal.get_last_value() == value && !signal.get_send_same()) || !*send )
- {
*send = false;
- }
signal.set_last_value(value);