Battery-Emulator/Software/src/include.h
2025-01-02 22:43:31 +01:00

66 lines
1.9 KiB
C

#ifndef INCLUDE_H_
#define INCLUDE_H_
#include <Arduino.h>
#include <Preferences.h>
#include <stdint.h>
#include "../USER_SETTINGS.h"
#include "system_settings.h"
#include "devboard/hal/hal.h"
#include "devboard/safety/safety.h"
#include "devboard/utils/logging.h"
#include "devboard/utils/time_meas.h"
#include "devboard/utils/types.h"
#include "battery/BATTERIES.h"
#include "charger/CHARGERS.h"
#include "inverter/INVERTERS.h"
/* - ERROR CHECKS BELOW, DON'T TOUCH - */
#if !defined(HW_CONFIGURED)
#error You must select a target hardware in the USER_SERTTINGS.h file!
#endif
#ifdef USE_CANFD_INTERFACE_AS_CLASSIC_CAN
#if !defined(CANFD_ADDON)
// Check that user did not try to use classic CAN over FD, without FD component
#error PLEASE ENABLE CANFD_ADDON TO USE CLASSIC CAN OVER CANFD INTERFACE
#endif
#endif
#ifdef MODBUS_INVERTER_SELECTED
#if defined(SERIAL_LINK_RECEIVER) || defined(SERIAL_LINK_TRANSMITTER)
// Check that Dual LilyGo via RS485 option isn't enabled, this collides with Modbus!
#error MODBUS CANNOT BE USED IN DOUBLE LILYGO SETUPS! CHECK USER SETTINGS!
#endif
#endif
#ifdef RS485_INVERTER_SELECTED
#if defined(SERIAL_LINK_RECEIVER) || defined(SERIAL_LINK_TRANSMITTER)
// Check that Dual LilyGo via RS485 option isn't enabled, this collides with Modbus!
#error RS485 CANNOT BE USED IN DOUBLE LILYGO SETUPS! CHECK USER SETTINGS!
#endif
#endif
#ifdef HW_LILYGO
#ifdef PERIODIC_BMS_RESET
#if defined(CAN_ADDON) || defined(CANFD_ADDON) || defined(CHADEMO_BATTERY)
//Check that BMS reset is not used at the same time as Chademo and CAN addons
#error BMS RESET CANNOT BE USED AT SAME TIME AS CAN-ADDONS / CHADMEO! NOT ENOUGH GPIO!
#endif
#endif
#endif
#ifndef BATTERY_SELECTED
#error No battery selected! Choose one from the USER_SETTINGS.h file
#endif
#if defined(LOG_CAN_TO_SD) || defined(LOG_TO_SD)
#if !defined(HW_LILYGO)
#error The SD card logging feature is only available on LilyGo hardware
#endif
#endif
#endif