Make tests pass

This commit is contained in:
Daniel Öster 2025-08-31 15:08:45 +03:00
parent 0e904f9465
commit 7c72526946
2 changed files with 10 additions and 13 deletions

View file

@ -92,7 +92,6 @@ bool init_CAN() {
const uint32_t errorCode = ACAN_ESP32::can.begin(*settingsespcan); const uint32_t errorCode = ACAN_ESP32::can.begin(*settingsespcan);
if (errorCode == 0) { if (errorCode == 0) {
native_can_initialized = true; native_can_initialized = true;
#ifdef DEBUG_LOG
logging.println("Native Can ok"); logging.println("Native Can ok");
logging.print("Bit Rate prescaler: "); logging.print("Bit Rate prescaler: ");
logging.println(settingsespcan->mBitRatePrescaler); logging.println(settingsespcan->mBitRatePrescaler);
@ -112,12 +111,9 @@ bool init_CAN() {
logging.print("Sample point: "); logging.print("Sample point: ");
logging.print(settingsespcan->samplePointFromBitStart()); logging.print(settingsespcan->samplePointFromBitStart());
logging.println("%"); logging.println("%");
#endif // DEBUG_LOG
} else { } else {
#ifdef DEBUG_LOG
logging.print("Error Native Can: 0x"); logging.print("Error Native Can: 0x");
logging.println(errorCode, HEX); logging.println(errorCode, HEX);
#endif // DEBUG_LOG
return false; return false;
} }
} }
@ -233,9 +229,9 @@ void transmit_can_frame_to_interface(const CAN_frame* tx_frame, int interface) {
} }
print_can_frame(*tx_frame, frameDirection(MSG_TX)); print_can_frame(*tx_frame, frameDirection(MSG_TX));
#ifdef LOG_CAN_TO_SD if (datalayer.system.info.CAN_SD_logging_active) {
add_can_frame_to_buffer(*tx_frame, frameDirection(MSG_TX)); add_can_frame_to_buffer(*tx_frame, frameDirection(MSG_TX));
#endif }
switch (interface) { switch (interface) {
case CAN_NATIVE: { case CAN_NATIVE: {
@ -398,13 +394,13 @@ void map_can_frame_to_variable(CAN_frame* rx_frame, CAN_Interface interface) {
print_can_frame(*rx_frame, frameDirection(MSG_RX)); print_can_frame(*rx_frame, frameDirection(MSG_RX));
} }
#ifdef LOG_CAN_TO_SD if (datalayer.system.info.CAN_SD_logging_active) {
if (interface != if (interface !=
CANFD_NATIVE) { //Avoid printing twice due to receive_frame_canfd_addon sending to both FD interfaces CANFD_NATIVE) { //Avoid printing twice due to receive_frame_canfd_addon sending to both FD interfaces
//TODO: This check can be removed later when refactored to use inline functions for logging //TODO: This check can be removed later when refactored to use inline functions for logging
add_can_frame_to_buffer(*rx_frame, frameDirection(MSG_RX)); add_can_frame_to_buffer(*rx_frame, frameDirection(MSG_RX));
} }
#endif }
// Send the frame to all the receivers registered for this interface. // Send the frame to all the receivers registered for this interface.
auto receivers = can_receivers.equal_range(interface); auto receivers = can_receivers.equal_range(interface);

View file

@ -1,6 +1,7 @@
#ifndef PREFERENCES #ifndef PREFERENCES
#define PREFERENCES #define PREFERENCES
#include <WString.h>
#include <stdint.h> #include <stdint.h>
class Preferences { class Preferences {