diff --git a/firmware/console/binary/tunerstudio.cpp b/firmware/console/binary/tunerstudio.cpp index b4fb93cf70..d56184c84e 100644 --- a/firmware/console/binary/tunerstudio.cpp +++ b/firmware/console/binary/tunerstudio.cpp @@ -323,7 +323,9 @@ static void handleCrc32Check(TsChannelBase *tsChannel, ts_response_format_e mode const char* start = getWorkingPageAddr() + offset; - uint32_t crc = SWAP_UINT32(crc32(start, count)); + uint32_t crc = crc32(start, count); + // do not pass function as macro parameter that would cause same code to be invoked 4 times! + crc = SWAP_UINT32(crc); tsChannel->sendResponse(mode, (const uint8_t *) &crc, 4); } diff --git a/firmware/controllers/can/can_dash.cpp b/firmware/controllers/can/can_dash.cpp index 2d0a439acc..1bbbb15b0c 100644 --- a/firmware/controllers/can/can_dash.cpp +++ b/firmware/controllers/can/can_dash.cpp @@ -155,7 +155,9 @@ void canMazdaRX8(CanCycle cycle) { float kph = getVehicleSpeed(); - msg.setShortValue(SWAP_UINT16(GET_RPM() * 4), 0); + int rpm = GET_RPM(); + // do not pass function as macro parameter that would cause same code to be invoked 4 times! + msg.setShortValue(SWAP_UINT16(rpm * 4), 0); msg.setShortValue(0xFFFF, 2); msg.setShortValue(SWAP_UINT16((int )(100 * kph + 10000)), 4); msg.setShortValue(0, 6);