Reducing code duplication

This commit is contained in:
rusefillc 2023-12-02 13:59:57 -05:00
parent 8f637b9f2c
commit 83b184077c
14 changed files with 20 additions and 14 deletions

View File

@ -75,7 +75,7 @@ void boardOnConfigurationChange(engine_configuration_s * /*previousConfiguration
alphaCamPullDown.setValue(engineConfiguration->boardUseCamPullDown);
}
#include "hellen_leds_144.cpp"
static bool isMegaModuleRevision() {
int16_t hellenBoardId = engine->engineState.hellenBoardId;

View File

@ -126,7 +126,7 @@ void boardOnConfigurationChange(engine_configuration_s * /*previousConfiguration
alphaD5PullDown.setValue(engineConfiguration->boardUseD5PullDown);
}
#include "hellen_leds_144.cpp"
void setBoardConfigOverrides() {
setHellenVbatt();

View File

@ -12,6 +12,9 @@
#include "hellen_meta.h"
#include "defaults.h"
// mm176 matches mm144 in terms of LED pinout
#include "hellen_leds_144.cpp"
static OutputPin alphaTachPullUp;
static OutputPin alphaTempPullUp;
static OutputPin alphaCrankPPullUp;
@ -122,8 +125,6 @@ void boardOnConfigurationChange(engine_configuration_s * /*previousConfiguration
//alphaD5PullDown.setValue(engineConfiguration->boardUseD5PullDown);
}
#include "hellen_leds_144.cpp"
void setBoardConfigOverrides() {
setHellenVbatt();

View File

@ -12,6 +12,9 @@
#include "hellen_meta.h"
#include "defaults.h"
// mm176 matches mm144 in terms of LED pinout
#include "hellen_leds_144.cpp"
static OutputPin alphaTachPullUp;
static OutputPin alphaTempPullUp;
static OutputPin alphaCrankPPullUp;
@ -128,8 +131,6 @@ void boardOnConfigurationChange(engine_configuration_s * /*previousConfiguration
//alphaD5PullDown.setValue(engineConfiguration->boardUseD5PullDown);
}
#include "hellen_leds_144.cpp"
void setBoardConfigOverrides() {
setHellenVbatt();

View File

@ -10,4 +10,5 @@ PRIMARY_COMMUNICATION_PORT_USART2=-DEFI_CONSOLE_TX_BRAIN_PIN=Gpio::D6 -DEFI_CONS
DDEFS += -DHELLEN_BOARD_ID_PIN_1=Gpio::F0 -DHELLEN_BOARD_ID_PIN_2=Gpio::F1
BOARDCPPSRC += $(BOARDS_DIR)/hellen/hellen_leds_144.cpp
include $(BOARDS_DIR)/hellen/hellen-common.mk

View File

@ -60,7 +60,7 @@ static void setupDefaultSensorInputs() {
engineConfiguration->iat.adcChannel = H144_IN_IAT;
}
#include "hellen_leds_144.cpp"
void setBoardConfigOverrides() {
setHellenVbatt();

View File

@ -45,7 +45,7 @@ void onBoardStandBy() {
hellenBoardStandBy();
}
#include "hellen_leds_144.cpp"
void setBoardConfigOverrides() {
setHellenMegaEnPin();

View File

@ -50,7 +50,7 @@ static void setupDefaultSensorInputs() {
engineConfiguration->iat.adcChannel = H144_IN_IAT;
}
#include "hellen_leds_144.cpp"
void setBoardConfigOverrides() {
setHellenVbatt();

View File

@ -54,8 +54,6 @@ static void setupDefaultSensorInputs() {
engineConfiguration->iat.adcChannel = H144_IN_IAT;
}
#include "hellen_leds_144.cpp"
void setBoardConfigOverrides() {
setHellenVbatt();
setHellenSdCardSpi3();

View File

@ -47,7 +47,7 @@ static void setupDefaultSensorInputs() {
engineConfiguration->iat.adcChannel = H144_IN_IAT;
}
#include "hellen_leds_144.cpp"
static bool isFirstInvocation = true;

View File

@ -49,7 +49,7 @@ static void setupDefaultSensorInputs() {
engineConfiguration->iat.adcChannel = H144_IN_IAT;
}
#include "hellen_leds_144.cpp"
void setBoardConfigOverrides() {
setHellenVbatt();

View File

@ -50,7 +50,7 @@ static void setupDefaultSensorInputs() {
engineConfiguration->iat.adcChannel = H144_IN_IAT;
}
#include "hellen_leds_144.cpp"
void setBoardConfigOverrides() {
setHellenVbatt();

View File

@ -1,3 +1,6 @@
#include "pch.h"
#include "hellen_meta.h"
Gpio getCommsLedPin() {
return H144_LED3_BLUE;
}

View File

@ -1,3 +1,5 @@
// original mcu176 (not mm-mcu176)
Gpio getCommsLedPin() {
return Gpio::H10; // blue
}