Add Stark CANFD native support

This commit is contained in:
Daniel Öster 2024-08-12 14:14:27 +03:00
parent 88bab500a5
commit d16144ae0d
3 changed files with 14 additions and 20 deletions

View file

@ -887,9 +887,6 @@ void transmit_can(CAN_frame* tx_frame, int interface) {
} }
ESP32Can.CANWriteFrame(&frame); ESP32Can.CANWriteFrame(&frame);
break; break;
case CANFD_NATIVE:
//TODO for stark
break;
case CAN_ADDON_MCP2515: { case CAN_ADDON_MCP2515: {
#ifdef DUAL_CAN #ifdef DUAL_CAN
//Struct with ACAN2515 library format, needed to use the MCP2515 library for CAN2 //Struct with ACAN2515 library format, needed to use the MCP2515 library for CAN2
@ -906,6 +903,7 @@ void transmit_can(CAN_frame* tx_frame, int interface) {
set_event(EVENT_INTERFACE_MISSING, interface); set_event(EVENT_INTERFACE_MISSING, interface);
#endif //DUAL_CAN #endif //DUAL_CAN
} break; } break;
case CANFD_NATIVE:
case CAN_ADDON_FD_MCP2518: { case CAN_ADDON_FD_MCP2518: {
#ifdef CAN_FD #ifdef CAN_FD
CANFDMessage MCP2518Frame; CANFDMessage MCP2518Frame;

View file

@ -48,9 +48,9 @@
//#define INTERLOCK_REQUIRED //Nissan LEAF specific setting, if enabled requires both high voltage conenctors to be seated before starting //#define INTERLOCK_REQUIRED //Nissan LEAF specific setting, if enabled requires both high voltage conenctors to be seated before starting
//#define CONTACTOR_CONTROL //Enable this line to have pins 25,32,33 handle automatic precharge/contactor+/contactor- closing sequence //#define CONTACTOR_CONTROL //Enable this line to have pins 25,32,33 handle automatic precharge/contactor+/contactor- closing sequence
//#define PWM_CONTACTOR_CONTROL //Enable this line to use PWM logic for contactors, which lower power consumption and heat generation //#define PWM_CONTACTOR_CONTROL //Enable this line to use PWM logic for contactors, which lower power consumption and heat generation
//#define DUAL_CAN //Enable this line to activate an isolated secondary CAN Bus using add-on MCP2515 controller (Needed for some inverters / double battery) //#define DUAL_CAN //Enable this line to activate an isolated secondary CAN Bus using add-on MCP2515 chip (Needed for some inverters / double battery)
//#define CAN_FD //Enable this line to activate an isolated secondary CAN-FD bus using add-on MCP2517FD controller (Needed for some batteries) //#define CAN_FD //Enable this line to activate an isolated secondary CAN-FD bus using add-on MCP2518FD chip / Native CANFD on Stark board
//#define USE_CANFD_INTERFACE_AS_CLASSIC_CAN // Enable this line if you intend to use the CANFD add-on chip as normal CAN //#define USE_CANFD_INTERFACE_AS_CLASSIC_CAN // Enable this line if you intend to use the CANFD as normal CAN
//#define SERIAL_LINK_RECEIVER //Enable this line to receive battery data over RS485 pins from another Lilygo (This LilyGo interfaces with inverter) //#define SERIAL_LINK_RECEIVER //Enable this line to receive battery data over RS485 pins from another Lilygo (This LilyGo interfaces with inverter)
//#define SERIAL_LINK_TRANSMITTER //Enable this line to send battery data over RS485 pins to another Lilygo (This LilyGo interfaces with battery) //#define SERIAL_LINK_TRANSMITTER //Enable this line to send battery data over RS485 pins to another Lilygo (This LilyGo interfaces with battery)
#define WEBSERVER //Enable this line to enable WiFi, and to run the webserver. See USER_SETTINGS.cpp for the Wifi settings. #define WEBSERVER //Enable this line to enable WiFi, and to run the webserver. See USER_SETTINGS.cpp for the Wifi settings.

View file

@ -212,28 +212,24 @@ String settings_processor(const String& var) {
} }
const char* getCANInterfaceName(CAN_Interface interface) { const char* getCANInterfaceName(CAN_Interface interface) {
#ifdef HW_LILYGO
switch (interface) { switch (interface) {
case CAN_NATIVE: case CAN_NATIVE:
return "CAN"; return "CAN";
case CANFD_NATIVE:
#ifdef USE_CANFD_INTERFACE_AS_CLASSIC_CAN
return "CAN-FD Native (Classic CAN)";
#else
return "CAN-FD Native";
#endif
case CAN_ADDON_MCP2515: case CAN_ADDON_MCP2515:
return "Add-on CAN via GPIO MCP2515"; return "Add-on CAN via GPIO MCP2515";
case CAN_ADDON_FD_MCP2518: case CAN_ADDON_FD_MCP2518:
#ifdef USE_CANFD_INTERFACE_AS_CLASSIC_CAN
return "Add-on CAN-FD via GPIO MCP2518 (Classic CAN)";
#else
return "Add-on CAN-FD via GPIO MCP2518"; return "Add-on CAN-FD via GPIO MCP2518";
#endif
default: default:
return "UNKNOWN"; return "UNKNOWN";
} }
#endif
#ifdef HW_STARK
switch (interface) {
case CAN_NATIVE:
return "CAN";
case CAN_ADDON_MCP2515:
return "CAN_ADDON_MCP2515";
case CAN_ADDON_FD_MCP2518:
return "CAN_ADDON_FD_MCP2518";
default:
return "UNKNOWN";
}
#endif
} }