auto-sync
This commit is contained in:
parent
ce10888b8e
commit
2d64490724
|
@ -286,6 +286,9 @@ void prepareVoidConfiguration(engine_configuration_s *activeConfiguration) {
|
|||
boardConfiguration->clutchUpPin = GPIO_UNASSIGNED;
|
||||
boardConfiguration->clutchUpPinMode = PI_PULLUP;
|
||||
|
||||
boardConfiguration->gps_rx_pin = GPIO_UNASSIGNED;
|
||||
boardConfiguration->gps_tx_pin = GPIO_UNASSIGNED;
|
||||
|
||||
for (int i = 0;i < INJECTION_PIN_COUNT;i++) {
|
||||
boardConfiguration->injectionPins[i] = GPIO_UNASSIGNED;
|
||||
}
|
||||
|
@ -743,8 +746,8 @@ void setDefaultConfiguration(DECLARE_ENGINE_PARAMETER_F) {
|
|||
|
||||
engineConfiguration->isAlternatorControlEnabled = true;
|
||||
|
||||
boardConfiguration->gps_rx_pin = GPIOB_7;
|
||||
boardConfiguration->gps_tx_pin = GPIOB_6;
|
||||
// boardConfiguration->gps_rx_pin = GPIOB_7;
|
||||
// boardConfiguration->gps_tx_pin = GPIOB_6;
|
||||
|
||||
boardConfiguration->triggerInputPins[0] = GPIOC_6;
|
||||
boardConfiguration->triggerInputPins[1] = GPIOA_5;
|
||||
|
|
|
@ -106,7 +106,7 @@ static void showEthInfo(void) {
|
|||
static char pinNameBuffer[16];
|
||||
|
||||
scheduleMsg(&logger, "pedal=%f %d/%d @", getPedalPosition(), engineConfiguration->pedalPositionMin, engineConfiguration->pedalPositionMax,
|
||||
getPinNameByAdcChannel(engineConfiguration->pedalPositionChannel, pinNameBuffer));
|
||||
getPinNameByAdcChannel("etb", engineConfiguration->pedalPositionChannel, pinNameBuffer));
|
||||
|
||||
scheduleMsg(&logger, "TPS=%f", getTPS());
|
||||
|
||||
|
|
|
@ -248,10 +248,14 @@ void initPeriodicEvents(DECLARE_ENGINE_PARAMETER_F) {
|
|||
periodicFastCallback(PASS_ENGINE_PARAMETER_F);
|
||||
}
|
||||
|
||||
char * getPinNameByAdcChannel(adc_channel_e hwChannel, char *buffer) {
|
||||
char * getPinNameByAdcChannel(const char *msg, adc_channel_e hwChannel, char *buffer) {
|
||||
#if HAL_USE_ADC || defined(__DOXYGEN__)
|
||||
strcpy((char*) buffer, portname(getAdcChannelPort(hwChannel)));
|
||||
itoa10(&buffer[2], getAdcChannelPin(hwChannel));
|
||||
if (hwChannel == EFI_ADC_NONE) {
|
||||
strcpy(buffer, "NONE");
|
||||
} else {
|
||||
strcpy((char*) buffer, portname(getAdcChannelPort(msg, hwChannel)));
|
||||
itoa10(&buffer[2], getAdcChannelPin(hwChannel));
|
||||
}
|
||||
#else
|
||||
strcpy(buffer, "NONE");
|
||||
#endif
|
||||
|
@ -278,7 +282,7 @@ static void printAnalogChannelInfoExt(const char *name, adc_channel_e hwChannel,
|
|||
|
||||
float voltage = adcVoltage * dividerCoeff;
|
||||
scheduleMsg(&logger, "%s ADC%d %s %s adc=%f/input=%fv/divider=%f", name, hwChannel, getAdcMode(hwChannel),
|
||||
getPinNameByAdcChannel(hwChannel, pinNameBuffer), adcVoltage, voltage, dividerCoeff);
|
||||
getPinNameByAdcChannel(name, hwChannel, pinNameBuffer), adcVoltage, voltage, dividerCoeff);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -510,7 +514,7 @@ static void initConfigActions(void) {
|
|||
// todo: move this logic somewhere else?
|
||||
static void getKnockInfo(void) {
|
||||
adc_channel_e hwChannel = engineConfiguration->externalKnockSenseAdc;
|
||||
scheduleMsg(&logger, "externalKnockSenseAdc on ADC", getPinNameByAdcChannel(hwChannel, pinNameBuffer));
|
||||
scheduleMsg(&logger, "externalKnockSenseAdc on ADC", getPinNameByAdcChannel("knock", hwChannel, pinNameBuffer));
|
||||
|
||||
engine->printKnockState();
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#include "engine_configuration.h"
|
||||
#include "engine.h"
|
||||
|
||||
char * getPinNameByAdcChannel(adc_channel_e hwChannel, char *buffer);
|
||||
char * getPinNameByAdcChannel(const char *msg, adc_channel_e hwChannel, char *buffer);
|
||||
void initPeriodicEvents(DECLARE_ENGINE_PARAMETER_F);
|
||||
void initEngineContoller(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_S);
|
||||
void commonInitEngineController(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_S);
|
||||
|
|
|
@ -244,7 +244,7 @@ static void showLine(lcd_line_e line, int screenY) {
|
|||
lcdPrintf(getIgnition_mode_e(engineConfiguration->ignitionMode));
|
||||
return;
|
||||
case LL_TPS:
|
||||
getPinNameByAdcChannel(engineConfiguration->tpsAdcChannel, buffer);
|
||||
getPinNameByAdcChannel("tps", engineConfiguration->tpsAdcChannel, buffer);
|
||||
|
||||
lcdPrintf("Throttle %s %f%%", buffer, getTPS());
|
||||
return;
|
||||
|
@ -252,7 +252,7 @@ static void showLine(lcd_line_e line, int screenY) {
|
|||
lcdPrintf("Battery %fv", getVBatt(PASS_ENGINE_PARAMETER_F));
|
||||
return;
|
||||
case LL_KNOCK:
|
||||
getPinNameByAdcChannel(engineConfiguration->hipOutputChannel, buffer);
|
||||
getPinNameByAdcChannel("hip", engineConfiguration->hipOutputChannel, buffer);
|
||||
lcdPrintf("Knock %s %fv", buffer, engine->knockVolts);
|
||||
return;
|
||||
|
||||
|
|
|
@ -385,7 +385,7 @@ static void printThermistor(const char *msg, ThermistorConf *config, ThermistorM
|
|||
thermistor_conf_s *tc = &config->config;
|
||||
|
||||
scheduleMsg(&logger, "%s volts=%f Celsius=%f sensorR=%f on channel %d", msg, voltage, t, r, adcChannel);
|
||||
scheduleMsg(&logger, "@%s", getPinNameByAdcChannel(adcChannel, pinNameBuffer));
|
||||
scheduleMsg(&logger, "@%s", getPinNameByAdcChannel(msg, adcChannel, pinNameBuffer));
|
||||
scheduleMsg(&logger, "C=%f/R=%f C=%f/R=%f C=%f/R=%f",
|
||||
tc->tempC_1, tc->resistance_1,
|
||||
tc->tempC_2, tc->resistance_2,
|
||||
|
@ -403,7 +403,7 @@ static void printTPSInfo(void) {
|
|||
return;
|
||||
}
|
||||
|
||||
ioportid_t port = getAdcChannelPort(engineConfiguration->tpsAdcChannel);
|
||||
ioportid_t port = getAdcChannelPort("tps", engineConfiguration->tpsAdcChannel);
|
||||
int pin = getAdcChannelPin(engineConfiguration->tpsAdcChannel);
|
||||
|
||||
scheduleMsg(&logger, "tps min (closed) %d/max (full) %d v=%f @%s%d", engineConfiguration->tpsMin, engineConfiguration->tpsMax,
|
||||
|
|
|
@ -149,7 +149,7 @@ static void showHipInfo(void) {
|
|||
scheduleMsg(logger, "hip %fv/last=%f@%s/max=%f spiCount=%d adv=%d",
|
||||
engine->knockVolts,
|
||||
getVoltage("hipinfo", engineConfiguration->hipOutputChannel),
|
||||
getPinNameByAdcChannel(engineConfiguration->hipOutputChannel, pinNameBuffer),
|
||||
getPinNameByAdcChannel("hip", engineConfiguration->hipOutputChannel, pinNameBuffer),
|
||||
hipValueMax,
|
||||
spiCount, boardConfiguration->useTpicAdvancedMode);
|
||||
scheduleMsg(logger, "mosi=%s", hwPortname(getMosiPin(hipSpiDevice)));
|
||||
|
|
|
@ -297,7 +297,7 @@ adc_channel_e getAdcChannel(brain_pin_e pin) {
|
|||
}
|
||||
}
|
||||
|
||||
ioportid_t getAdcChannelPort(adc_channel_e hwChannel) {
|
||||
ioportid_t getAdcChannelPort(const char *msg, adc_channel_e hwChannel) {
|
||||
// todo: replace this with an array :)
|
||||
switch (hwChannel) {
|
||||
case ADC_CHANNEL_IN0:
|
||||
|
@ -333,7 +333,7 @@ ioportid_t getAdcChannelPort(adc_channel_e hwChannel) {
|
|||
case ADC_CHANNEL_IN15:
|
||||
return GPIOC;
|
||||
default:
|
||||
firmwareError(OBD_PCM_Processor_Fault, "Unknown hw channel %d", hwChannel);
|
||||
firmwareError(OBD_PCM_Processor_Fault, "Unknown hw channel %d [%s]", hwChannel, msg);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
@ -390,7 +390,7 @@ int getAdcChannelPin(adc_channel_e hwChannel) {
|
|||
}
|
||||
|
||||
static void initAdcHwChannel(adc_channel_e hwChannel) {
|
||||
ioportid_t port = getAdcChannelPort(hwChannel);
|
||||
ioportid_t port = getAdcChannelPort("adc", hwChannel);
|
||||
int pin = getAdcChannelPin(hwChannel);
|
||||
|
||||
initAdcPin(port, pin, "hw");
|
||||
|
@ -461,7 +461,7 @@ static void printFullAdcReport(Logging *logger) {
|
|||
appendMsgPrefix(logger);
|
||||
|
||||
adc_channel_e hwIndex = slowAdc.getAdcHardwareIndexByInternalIndex(index);
|
||||
ioportid_t port = getAdcChannelPort(hwIndex);
|
||||
ioportid_t port = getAdcChannelPort("print", hwIndex);
|
||||
int pin = getAdcChannelPin(hwIndex);
|
||||
|
||||
int adcValue = slowAdc.getAdcValueByIndex(index);
|
||||
|
@ -511,7 +511,7 @@ static void addChannel(const char *name, adc_channel_e setting, adc_channel_mode
|
|||
return;
|
||||
}
|
||||
if (adcHwChannelEnabled[setting] != ADC_OFF) {
|
||||
getPinNameByAdcChannel(setting, errorMsgBuff);
|
||||
getPinNameByAdcChannel(name, setting, errorMsgBuff);
|
||||
firmwareError(OBD_PCM_Processor_Fault, "ADC mapping error: input %s for %s already used by %s?", errorMsgBuff, name, adcHwChannelUsage[setting]);
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ const char * getAdcMode(adc_channel_e hwChannel);
|
|||
int getAdcChannelPin(adc_channel_e hwChannel);
|
||||
void initAdcInputs(bool boardTestMode);
|
||||
void adc_callback_fast(ADCDriver *adcp, adcsample_t *buffer, size_t n);
|
||||
ioportid_t getAdcChannelPort(adc_channel_e hwChannel);
|
||||
ioportid_t getAdcChannelPort(const char *msg, adc_channel_e hwChannel);
|
||||
adc_channel_e getAdcChannel(brain_pin_e pin);
|
||||
void doSlowAdc(void);
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ extern AdcDevice fastAdc;
|
|||
|
||||
static void processAdcPin(AdcDevice *adc, int index) {
|
||||
adc_channel_e hwIndex = adc->getAdcHardwareIndexByInternalIndex(index);
|
||||
ioportid_t port = getAdcChannelPort(hwIndex);
|
||||
ioportid_t port = getAdcChannelPort("test", hwIndex);
|
||||
int pin = getAdcChannelPin(hwIndex);
|
||||
|
||||
int copy = stepCoutner;
|
||||
|
|
Loading…
Reference in New Issue