Skip to content

Commit a29388c

Browse files
authored
Merge pull request dalathegreat#2492 from jonny5532/feature/2can-and-stark-dual-fd
Testing: Stark 2xFD + 3rd battery
2 parents 0268c12 + 8fa3a88 commit a29388c

2 files changed

Lines changed: 19 additions & 20 deletions

File tree

‎Software/src/devboard/hal/hw_stark.h‎

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -57,17 +57,10 @@ class StarkHal : public Esp32Hal {
5757
virtual gpio_num_t MCP2517_INT() { return GPIO_NUM_35; }
5858
virtual uint32_t MCP2517_FREQ() { return 40000000; }
5959

60-
// CAN_ADDON
61-
// SCK input of MCP2515
62-
virtual gpio_num_t MCP2515_SCK() { return GPIO_NUM_14; }
63-
// SDI input of MCP2515
64-
virtual gpio_num_t MCP2515_MOSI() { return GPIO_NUM_12; }
65-
// SDO output of MCP2515
66-
virtual gpio_num_t MCP2515_MISO() { return GPIO_NUM_34; }
67-
// CS input of MCP2515
68-
virtual gpio_num_t MCP2515_CS() { return GPIO_NUM_15; }
69-
// INT output of MCP2515
70-
virtual gpio_num_t MCP2515_INT() { return GPIO_NUM_13; }
60+
// MCP2518FD add-on via the GPIO pins
61+
// SPI Bus is shared with the 1st interface, only INT and CS pins are needed
62+
virtual gpio_num_t MCP2517_CS2() { return GPIO_NUM_12; }
63+
virtual gpio_num_t MCP2517_INT2() { return GPIO_NUM_14; }
7164

7265
// Contactor handling
7366
virtual gpio_num_t POSITIVE_CONTACTOR_PIN() { return GPIO_NUM_32; }
@@ -79,7 +72,7 @@ class StarkHal : public Esp32Hal {
7972
return GPIO_NUM_25;
8073
}
8174
virtual gpio_num_t SECOND_BATTERY_CONTACTORS_PIN() { return GPIO_NUM_19; }
82-
virtual gpio_num_t TRIPLE_BATTERY_CONTACTORS_PIN() { return GPIO_NUM_NC; }
75+
virtual gpio_num_t TRIPLE_BATTERY_CONTACTORS_PIN() { return GPIO_NUM_15; }
8376
virtual gpio_num_t BMS_POWER() {
8477
if (user_selected_gpioopt5 == GPIOOPT5::BMS_POWER_25) {
8578
return GPIO_NUM_25;
@@ -117,9 +110,11 @@ class StarkHal : public Esp32Hal {
117110
case comm_interface::CanFdNative:
118111
return "CAN FD 2 (Native)";
119112
case comm_interface::CanAddonMcp2515:
120-
return "MCP2515 (GPIO add-on)";
113+
return "";
121114
case comm_interface::CanFdAddonMcp2518:
122115
return "";
116+
case comm_interface::CanFdAddonMcp2518_2:
117+
return "MCP2518FD (GPIO add-on)";
123118
case comm_interface::Modbus:
124119
return "Modbus";
125120
case comm_interface::RS485:

‎Software/src/devboard/webserver/settings_html.cpp‎

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -999,15 +999,8 @@ const char* getCANInterfaceName(CAN_Interface interface) {
999999
%GPIOOPT1%
10001000
</select>
10011001
)rawliteral"
1002-
#define CANFD2ASCAN_SETTING \
1003-
R"rawliteral(
1004-
<label>Use CanFD2 as classic CAN: </label>
1005-
<input type='checkbox' name='CANFD2ASCAN' value='on' %CANFD2ASCAN%
1006-
title="When enabled, CAN-FD channel will operate as normal 500kbps CAN" />
1007-
)rawliteral"
10081002
#else
10091003
#define GPIOOPT1_SETTING ""
1010-
#define CANFD2ASCAN_SETTING ""
10111004
#endif
10121005

10131006
#ifdef HW_LILYGO
@@ -1070,6 +1063,17 @@ const char* getCANInterfaceName(CAN_Interface interface) {
10701063
#define GPIOOPT6_SETTING ""
10711064
#endif
10721065

1066+
#if defined(HW_LILYGO2CAN) || defined(HW_STARK)
1067+
#define CANFD2ASCAN_SETTING \
1068+
R"rawliteral(
1069+
<label>Use CanFD2 as classic CAN: </label>
1070+
<input type='checkbox' name='CANFD2ASCAN' value='on' %CANFD2ASCAN%
1071+
title="When enabled, CAN-FD channel will operate as normal 500kbps CAN" />
1072+
)rawliteral"
1073+
#else
1074+
#define CANFD2ASCAN_SETTING ""
1075+
#endif
1076+
10731077
#define SETTINGS_HTML_SCRIPTS \
10741078
R"rawliteral(
10751079
<script>

0 commit comments

Comments
 (0)