revision logic clean-up

only:alphax-2chan
This commit is contained in:
rusefi 2023-08-08 19:48:52 -04:00
parent 4c85d8196b
commit 11c04e1f9d
3 changed files with 15 additions and 11 deletions

View File

@ -90,21 +90,22 @@ void boardOnConfigurationChange(engine_configuration_s * /*previousConfiguration
#include "hellen_leds_144.cpp"
void setBoardConfigOverrides() {
// todo: do we need this conditional on boardId or not really?
setHellenMegaEnPin();
// todo: make this conditional on 2chan revision
static OutputPin alphaEn;
alphaEn.initPin("a-EN", H144_OUT_IO3);
alphaEn.setValue(1);
static bool isMegaModuleRevision() {
int16_t hellenBoardId = engine->engineState.hellenBoardId;
return hellenBoardId != BOARD_ID_2chan_b && hellenBoardId != BOARD_ID_2chan_c && hellenBoardId != BOARD_ID_2chan_d;
}
void setBoardConfigOverrides() {
setupVbatt();
int16_t hellenBoardId = engine->engineState.hellenBoardId;
// rev.D uses SPI1 pins for CAN2, but rev.E and later uses mega-module meaning SPI1 for SD-card
if (hellenBoardId != BOARD_ID_2chan_d) {
if (isMegaModuleRevision()) {
setHellenSdCardSpi1();
configureHellenMegaAccCS2Pin();
setHellenMegaEnPin(H144_OUT_IO3);
} else {
setHellenEnPin(H144_OUT_IO3);
}
setDefaultHellenAtPullUps();
@ -124,8 +125,7 @@ void setBoardDefaultConfiguration() {
setIgnitionPins();
int16_t hellenBoardId = engine->engineState.hellenBoardId;
if (hellenBoardId == BOARD_ID_2chan_e || hellenBoardId == BOARD_ID_2chan_f) {
// todo: flip that condition to check for "if not old board"
if (isMegaModuleRevision()) {
setHellenMMbaro();
engineConfiguration->map.sensor.hwChannel = H144_IN_MAP3; // On-board MAP
engineConfiguration->map.sensor.type = MT_MPXH6400;

View File

@ -21,7 +21,7 @@ void setHellenEnPin(Gpio pin) {
static bool initialized = false;
if (!initialized) {
initialized = true;
megaEn.initPin("mm-EN", pin);
megaEn.initPin("EN", pin);
megaEn.setValue(1);
}
}

View File

@ -11,9 +11,13 @@
#define BOARD_ID_154hyundai_c 10
#define BOARD_ID_154hyundai_d 201
#define BOARD_ID_2chan_b 3
#define BOARD_ID_2chan_c 5
#define BOARD_ID_2chan_d 107
// mega-module starts here
#define BOARD_ID_2chan_e 112
#define BOARD_ID_2chan_f 115
#define BOARD_ID_2chan_g 210
#define BOARD_ID_4chan_d 103
#define BOARD_ID_4chan_e 105