Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/fome-tech/fome-fw
Browse files Browse the repository at this point in the history
  • Loading branch information
mck1117 committed Jul 22, 2024
2 parents 3f24500 + bd80855 commit b364748
Show file tree
Hide file tree
Showing 38 changed files with 86 additions and 115 deletions.
4 changes: 0 additions & 4 deletions firmware/config/boards/prometheus/efifeatures.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,6 @@

#undef CONSOLE_MODE_SWITCH_PORT

//!!!!!!!!!!!!!!!
//#undef EFI_INTERNAL_ADC
//#define EFI_INTERNAL_ADC FALSE

#undef ADC_VCC
#define ADC_VCC 3.275f

Expand Down
2 changes: 1 addition & 1 deletion firmware/controllers/algo/obd_error_codes.h
Original file line number Diff line number Diff line change
Expand Up @@ -2109,7 +2109,7 @@ enum class ObdCode : uint16_t {
CUSTOM_ERR_6728 = 6728,
CUSTOM_ARTIFICIAL_MISFIRE = 6729,

CUSTOM_INSTANT_MAP_DECODING = 6899,
CUSTOM_ERR_6899 = 6899,
STACK_USAGE_COMMUNICATION = 6900,
STACK_USAGE_MIL = 6901,
// not used CUSTOM_6902 = 6902,
Expand Down
2 changes: 1 addition & 1 deletion firmware/controllers/date_stamp.h
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#pragma once
#define VCS_DATE 20240717
#define VCS_DATE 20240722
5 changes: 0 additions & 5 deletions firmware/controllers/engine_cycle/map_averaging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,6 @@ void mapAveragingAdcCallback(float instantVoltage) {

SensorResult mapResult = getMapAvg(currentMapAverager).submit(instantVoltage);

if (!mapResult) {
// hopefully this warning is not too much CPU consumption for fast ADC callback
warning(ObdCode::CUSTOM_INSTANT_MAP_DECODING, "Invalid MAP at %f", instantVoltage);
}

float instantMap = mapResult.value_or(0);
#if EFI_TUNER_STUDIO
engine->outputChannels.instantMAPValue = instantMap;
Expand Down
60 changes: 20 additions & 40 deletions firmware/hw_layer/adc/adc_inputs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,30 +234,22 @@ void AdcDevice::enableChannel(adc_channel_e hwChannel) {
return;
}

int logicChannel = channelCount++;

/* TODO: following is correct for STM32 ADC1/2.
* ADC3 has another input to gpio mapping
* and should be handled separately */
size_t channelAdcIndex = hwChannel - EFI_ADC_0;

internalAdcIndexByHardwareIndex[hwChannel] = logicChannel;
hardwareIndexByIndernalAdcIndex[logicChannel] = hwChannel;
if (logicChannel < 6) {
m_hwConfig->sqr3 |= channelAdcIndex << (5 * logicChannel);
} else if (logicChannel < 12) {
m_hwConfig->sqr2 |= channelAdcIndex << (5 * (logicChannel - 6));
} else if (logicChannel < 18) {
m_hwConfig->sqr1 |= channelAdcIndex << (5 * (logicChannel - 12));
// hwChannel = which external pin are we using
// adcChannelIndex = which ADC channel are we using
// adcIndex = which index does that get in sampling order
size_t adcChannelIndex = hwChannel - EFI_ADC_0;
size_t adcIndex = channelCount++;

internalAdcIndexByHardwareIndex[hwChannel] = adcIndex;
hardwareIndexByIndernalAdcIndex[adcIndex] = hwChannel;

if (adcIndex < 6) {
m_hwConfig->sqr3 |= adcChannelIndex << (5 * adcIndex);
} else if (adcIndex < 12) {
m_hwConfig->sqr2 |= adcChannelIndex << (5 * (adcIndex - 6));
} else if (adcIndex < 18) {
m_hwConfig->sqr1 |= adcChannelIndex << (5 * (adcIndex - 12));
}
#if ADC_MAX_CHANNELS_COUNT > 16
else if (logicChannel < 24) {
m_hwConfig->sqr4 |= channelAdcIndex << (5 * (logicChannel - 18));
}
else if (logicChannel < 30) {
m_hwConfig->sqr5 |= channelAdcIndex << (5 * (logicChannel - 24));
}
#endif /* ADC_MAX_CHANNELS_COUNT */
}

adc_channel_e AdcDevice::getAdcHardwareIndexByInternalIndex(int index) const {
Expand Down Expand Up @@ -340,27 +332,17 @@ void removeFastAdcChannel(const char *name, adc_channel_e setting) {
// Weak link a stub so that every board doesn't have to implement this function
__attribute__((weak)) void setAdcChannelOverrides() { }

static void configureInputs() {
memset(adcHwChannelEnabled, 0, sizeof(adcHwChannelEnabled));
static CCM_OPTIONAL SlowAdcController slowAdcController;

/**
* order of analog channels here is totally random and has no meaning
* we also have some weird implementation with internal indices - that all has no meaning, it's just a random implementation
* which does not mean anything.
*/
void initAdcInputs() {
efiPrintf("initAdcInputs()");

memset(adcHwChannelEnabled, 0, sizeof(adcHwChannelEnabled));

addFastAdcChannel("MAP", engineConfiguration->map.sensor.hwChannel);
addFastAdcChannel("AUXF#1", engineConfiguration->auxFastSensor1_adcChannel);

setAdcChannelOverrides();
}

static CCM_OPTIONAL SlowAdcController slowAdcController;

void initAdcInputs() {
efiPrintf("initAdcInputs()");

configureInputs();

#if EFI_INTERNAL_ADC
portInitAdc();
Expand All @@ -376,8 +358,6 @@ void initAdcInputs() {
#endif // EFI_USE_FAST_ADC

addConsoleActionI("adc", (VoidInt) printAdcValue);
#else
efiPrintf("ADC disabled");
#endif
}

Expand Down
2 changes: 1 addition & 1 deletion firmware/hw_layer/ports/stm32/stm32_adc_v2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ static bool readBatch(adcsample_t* convertedSamples) {
bool readSlowAnalogInputs(adcsample_t* convertedSamples) {
bool result = true;

result &= readBatch(convertedSamples, 0);
result &= readBatch(convertedSamples);

#ifdef ADC_MUX_PIN
muxControl.setValue(1);
Expand Down
4 changes: 2 additions & 2 deletions firmware/tunerstudio/generated/fome_alphax-2chan.ini
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ enable2ndByteCanID = false

[MegaTune]
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
signature = "rusEFI (FOME) master.2024.07.21.alphax-2chan.1055407544"
signature = "rusEFI (FOME) master.2024.07.22.alphax-2chan.1055407544"

[TunerStudio]
queryCommand = "S"
versionInfo = "V" ; firmware version for title bar.
signature= "rusEFI (FOME) master.2024.07.21.alphax-2chan.1055407544" ; signature is expected to be 7 or more characters.
signature= "rusEFI (FOME) master.2024.07.22.alphax-2chan.1055407544" ; signature is expected to be 7 or more characters.

; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
useLegacyFTempUnits = false
Expand Down
4 changes: 2 additions & 2 deletions firmware/tunerstudio/generated/fome_alphax-4chan.ini
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ enable2ndByteCanID = false

[MegaTune]
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
signature = "rusEFI (FOME) master.2024.07.21.alphax-4chan.3022012377"
signature = "rusEFI (FOME) master.2024.07.22.alphax-4chan.3022012377"

[TunerStudio]
queryCommand = "S"
versionInfo = "V" ; firmware version for title bar.
signature= "rusEFI (FOME) master.2024.07.21.alphax-4chan.3022012377" ; signature is expected to be 7 or more characters.
signature= "rusEFI (FOME) master.2024.07.22.alphax-4chan.3022012377" ; signature is expected to be 7 or more characters.

; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
useLegacyFTempUnits = false
Expand Down
4 changes: 2 additions & 2 deletions firmware/tunerstudio/generated/fome_alphax-8chan.ini
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ enable2ndByteCanID = false

[MegaTune]
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
signature = "rusEFI (FOME) master.2024.07.21.alphax-8chan.3432724768"
signature = "rusEFI (FOME) master.2024.07.22.alphax-8chan.3432724768"

[TunerStudio]
queryCommand = "S"
versionInfo = "V" ; firmware version for title bar.
signature= "rusEFI (FOME) master.2024.07.21.alphax-8chan.3432724768" ; signature is expected to be 7 or more characters.
signature= "rusEFI (FOME) master.2024.07.22.alphax-8chan.3432724768" ; signature is expected to be 7 or more characters.

; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
useLegacyFTempUnits = false
Expand Down
4 changes: 2 additions & 2 deletions firmware/tunerstudio/generated/fome_atlas.ini
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ enable2ndByteCanID = false

[MegaTune]
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
signature = "rusEFI (FOME) master.2024.07.21.atlas.1717813964"
signature = "rusEFI (FOME) master.2024.07.22.atlas.1717813964"

[TunerStudio]
queryCommand = "S"
versionInfo = "V" ; firmware version for title bar.
signature= "rusEFI (FOME) master.2024.07.21.atlas.1717813964" ; signature is expected to be 7 or more characters.
signature= "rusEFI (FOME) master.2024.07.22.atlas.1717813964" ; signature is expected to be 7 or more characters.

; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
useLegacyFTempUnits = false
Expand Down
4 changes: 2 additions & 2 deletions firmware/tunerstudio/generated/fome_core48.ini
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ enable2ndByteCanID = false

[MegaTune]
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
signature = "rusEFI (FOME) master.2024.07.21.core48.82391562"
signature = "rusEFI (FOME) master.2024.07.22.core48.82391562"

[TunerStudio]
queryCommand = "S"
versionInfo = "V" ; firmware version for title bar.
signature= "rusEFI (FOME) master.2024.07.21.core48.82391562" ; signature is expected to be 7 or more characters.
signature= "rusEFI (FOME) master.2024.07.22.core48.82391562" ; signature is expected to be 7 or more characters.

; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
useLegacyFTempUnits = false
Expand Down
4 changes: 2 additions & 2 deletions firmware/tunerstudio/generated/fome_core8.ini
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ enable2ndByteCanID = false

[MegaTune]
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
signature = "rusEFI (FOME) master.2024.07.21.core8.596654025"
signature = "rusEFI (FOME) master.2024.07.22.core8.596654025"

[TunerStudio]
queryCommand = "S"
versionInfo = "V" ; firmware version for title bar.
signature= "rusEFI (FOME) master.2024.07.21.core8.596654025" ; signature is expected to be 7 or more characters.
signature= "rusEFI (FOME) master.2024.07.22.core8.596654025" ; signature is expected to be 7 or more characters.

; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
useLegacyFTempUnits = false
Expand Down
4 changes: 2 additions & 2 deletions firmware/tunerstudio/generated/fome_f407-discovery.ini
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ enable2ndByteCanID = false

[MegaTune]
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
signature = "rusEFI (FOME) master.2024.07.21.f407-discovery.4210670367"
signature = "rusEFI (FOME) master.2024.07.22.f407-discovery.4210670367"

[TunerStudio]
queryCommand = "S"
versionInfo = "V" ; firmware version for title bar.
signature= "rusEFI (FOME) master.2024.07.21.f407-discovery.4210670367" ; signature is expected to be 7 or more characters.
signature= "rusEFI (FOME) master.2024.07.22.f407-discovery.4210670367" ; signature is expected to be 7 or more characters.

; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
useLegacyFTempUnits = false
Expand Down
4 changes: 2 additions & 2 deletions firmware/tunerstudio/generated/fome_f429-discovery.ini
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ enable2ndByteCanID = false

[MegaTune]
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
signature = "rusEFI (FOME) master.2024.07.21.f429-discovery.464992895"
signature = "rusEFI (FOME) master.2024.07.22.f429-discovery.464992895"

[TunerStudio]
queryCommand = "S"
versionInfo = "V" ; firmware version for title bar.
signature= "rusEFI (FOME) master.2024.07.21.f429-discovery.464992895" ; signature is expected to be 7 or more characters.
signature= "rusEFI (FOME) master.2024.07.22.f429-discovery.464992895" ; signature is expected to be 7 or more characters.

; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
useLegacyFTempUnits = false
Expand Down
4 changes: 2 additions & 2 deletions firmware/tunerstudio/generated/fome_frankenso_na6.ini
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ enable2ndByteCanID = false

[MegaTune]
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
signature = "rusEFI (FOME) master.2024.07.21.frankenso_na6.971365045"
signature = "rusEFI (FOME) master.2024.07.22.frankenso_na6.971365045"

[TunerStudio]
queryCommand = "S"
versionInfo = "V" ; firmware version for title bar.
signature= "rusEFI (FOME) master.2024.07.21.frankenso_na6.971365045" ; signature is expected to be 7 or more characters.
signature= "rusEFI (FOME) master.2024.07.22.frankenso_na6.971365045" ; signature is expected to be 7 or more characters.

; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
useLegacyFTempUnits = false
Expand Down
4 changes: 2 additions & 2 deletions firmware/tunerstudio/generated/fome_harley81.ini
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ enable2ndByteCanID = false

[MegaTune]
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
signature = "rusEFI (FOME) master.2024.07.21.harley81.2451702277"
signature = "rusEFI (FOME) master.2024.07.22.harley81.2451702277"

[TunerStudio]
queryCommand = "S"
versionInfo = "V" ; firmware version for title bar.
signature= "rusEFI (FOME) master.2024.07.21.harley81.2451702277" ; signature is expected to be 7 or more characters.
signature= "rusEFI (FOME) master.2024.07.22.harley81.2451702277" ; signature is expected to be 7 or more characters.

; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
useLegacyFTempUnits = false
Expand Down
4 changes: 2 additions & 2 deletions firmware/tunerstudio/generated/fome_hellen-gm-e67.ini
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ enable2ndByteCanID = false

[MegaTune]
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
signature = "rusEFI (FOME) master.2024.07.21.hellen-gm-e67.1927156908"
signature = "rusEFI (FOME) master.2024.07.22.hellen-gm-e67.1927156908"

[TunerStudio]
queryCommand = "S"
versionInfo = "V" ; firmware version for title bar.
signature= "rusEFI (FOME) master.2024.07.21.hellen-gm-e67.1927156908" ; signature is expected to be 7 or more characters.
signature= "rusEFI (FOME) master.2024.07.22.hellen-gm-e67.1927156908" ; signature is expected to be 7 or more characters.

; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
useLegacyFTempUnits = false
Expand Down
4 changes: 2 additions & 2 deletions firmware/tunerstudio/generated/fome_hellen-honda-k.ini
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ enable2ndByteCanID = false

[MegaTune]
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
signature = "rusEFI (FOME) master.2024.07.21.hellen-honda-k.3914324717"
signature = "rusEFI (FOME) master.2024.07.22.hellen-honda-k.3914324717"

[TunerStudio]
queryCommand = "S"
versionInfo = "V" ; firmware version for title bar.
signature= "rusEFI (FOME) master.2024.07.21.hellen-honda-k.3914324717" ; signature is expected to be 7 or more characters.
signature= "rusEFI (FOME) master.2024.07.22.hellen-honda-k.3914324717" ; signature is expected to be 7 or more characters.

; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
useLegacyFTempUnits = false
Expand Down
4 changes: 2 additions & 2 deletions firmware/tunerstudio/generated/fome_hellen-nb1.ini
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ enable2ndByteCanID = false

[MegaTune]
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
signature = "rusEFI (FOME) master.2024.07.21.hellen-nb1.3968871363"
signature = "rusEFI (FOME) master.2024.07.22.hellen-nb1.3968871363"

[TunerStudio]
queryCommand = "S"
versionInfo = "V" ; firmware version for title bar.
signature= "rusEFI (FOME) master.2024.07.21.hellen-nb1.3968871363" ; signature is expected to be 7 or more characters.
signature= "rusEFI (FOME) master.2024.07.22.hellen-nb1.3968871363" ; signature is expected to be 7 or more characters.

; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
useLegacyFTempUnits = false
Expand Down
4 changes: 2 additions & 2 deletions firmware/tunerstudio/generated/fome_hellen121nissan.ini
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ enable2ndByteCanID = false

[MegaTune]
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
signature = "rusEFI (FOME) master.2024.07.21.hellen121nissan.2622195593"
signature = "rusEFI (FOME) master.2024.07.22.hellen121nissan.2622195593"

[TunerStudio]
queryCommand = "S"
versionInfo = "V" ; firmware version for title bar.
signature= "rusEFI (FOME) master.2024.07.21.hellen121nissan.2622195593" ; signature is expected to be 7 or more characters.
signature= "rusEFI (FOME) master.2024.07.22.hellen121nissan.2622195593" ; signature is expected to be 7 or more characters.

; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
useLegacyFTempUnits = false
Expand Down
4 changes: 2 additions & 2 deletions firmware/tunerstudio/generated/fome_hellen121vag.ini
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ enable2ndByteCanID = false

[MegaTune]
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
signature = "rusEFI (FOME) master.2024.07.21.hellen121vag.810059866"
signature = "rusEFI (FOME) master.2024.07.22.hellen121vag.810059866"

[TunerStudio]
queryCommand = "S"
versionInfo = "V" ; firmware version for title bar.
signature= "rusEFI (FOME) master.2024.07.21.hellen121vag.810059866" ; signature is expected to be 7 or more characters.
signature= "rusEFI (FOME) master.2024.07.22.hellen121vag.810059866" ; signature is expected to be 7 or more characters.

; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
useLegacyFTempUnits = false
Expand Down
4 changes: 2 additions & 2 deletions firmware/tunerstudio/generated/fome_hellen128.ini
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ enable2ndByteCanID = false

[MegaTune]
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
signature = "rusEFI (FOME) master.2024.07.21.hellen128.2602916824"
signature = "rusEFI (FOME) master.2024.07.22.hellen128.2602916824"

[TunerStudio]
queryCommand = "S"
versionInfo = "V" ; firmware version for title bar.
signature= "rusEFI (FOME) master.2024.07.21.hellen128.2602916824" ; signature is expected to be 7 or more characters.
signature= "rusEFI (FOME) master.2024.07.22.hellen128.2602916824" ; signature is expected to be 7 or more characters.

; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
useLegacyFTempUnits = false
Expand Down
4 changes: 2 additions & 2 deletions firmware/tunerstudio/generated/fome_hellen154hyundai.ini
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ enable2ndByteCanID = false

[MegaTune]
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
signature = "rusEFI (FOME) master.2024.07.21.hellen154hyundai.265452345"
signature = "rusEFI (FOME) master.2024.07.22.hellen154hyundai.265452345"

[TunerStudio]
queryCommand = "S"
versionInfo = "V" ; firmware version for title bar.
signature= "rusEFI (FOME) master.2024.07.21.hellen154hyundai.265452345" ; signature is expected to be 7 or more characters.
signature= "rusEFI (FOME) master.2024.07.22.hellen154hyundai.265452345" ; signature is expected to be 7 or more characters.

; TS will try to use legacy temp units in some cases, showing "deg F" on a CLT gauge that's actually deg C
useLegacyFTempUnits = false
Expand Down
Loading

0 comments on commit b364748

Please sign in to comment.