Skip to content

Commit

Permalink
Merge branch 'master' into nms/tunerstudio-command-x14-cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
mck1117 authored Aug 5, 2024
2 parents 618530e + 6ba19ac commit a1555ae
Show file tree
Hide file tree
Showing 255 changed files with 9,235 additions and 10,431 deletions.
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ err.txt
log.txt
*.rusefi_binary
*.msq
gitversion.h
gitversion.h.gen
gitversion.h*
engine_modules_generated.h*
modules_list_generated.h*

# Eclipse
.metadata/
Expand Down
18 changes: 18 additions & 0 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [
"EFI_PROD_CODE",
"EFI_SIMULATOR"
],
"compilerPath": "/usr/bin/clang",
"cStandard": "c17",
"intelliSenseMode": "linux-clang-x64"
}
],
"version": 4
}
1 change: 1 addition & 0 deletions firmware/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ or
- Add EGT values to CAN broadcast format #398
- Add options to enable/disable optional CAN frames (cams, EGT so far)
- Add 1-5-4-8-3-7-2-6 and 1-6-5-10-2-7-3-8-4-9 firing orders
- Console command `set_sensor_mock` now accepts a sensor by name, instead of index. Example: `set_sensor_mock CLT 85.5`

### Fixed
- Improve performance with Lua CAN reception of a high volume of frames
Expand Down
4 changes: 4 additions & 0 deletions firmware/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ endif

include $(PROJECT_DIR)/hw_layer/mass_storage/mass_storage.mk
include $(PROJECT_DIR)/common.mk
include $(PROJECT_DIR)/controllers/modules/modules.mk

ifeq ($(USE_OPENBLT),yes)
# Reserve start of flash for OpenBLT
Expand Down Expand Up @@ -239,6 +240,7 @@ CPPSRC = \
$(HW_LAYER_DRIVERS_CORE_CPP) \
$(HW_LAYER_DRIVERS_CPP) \
$(CONSOLE_SRC_CPP) \
$(MODULES_CPPSRC) \
$(RUSEFI_LIB_CPP) \
rusefi.cpp \
main.cpp
Expand Down Expand Up @@ -275,6 +277,7 @@ INCDIR = \
$(PCH_DIR) \
$(BOARDINC) \
$(ALLINC) \
$(MODULES_INC) \
$(TESTINC) \
$(CHIBIOS)/os/various \
$(RUSEFI_LIB_INC) \
Expand Down Expand Up @@ -360,6 +363,7 @@ include $(RULESFILE)
include $(PROJECT_DIR)/rusefi_pch.mk
include $(PROJECT_DIR)/fome_generated.mk
include $(PROJECT_DIR)/gitversion.mk
include $(PROJECT_DIR)/controllers/modules/modules_header_gen.mk

.PHONY: CLEAN_RULE_HOOK CLEAN_PCH_HOOK CLEAN_BUNDLE_HOOK

Expand Down
1 change: 1 addition & 0 deletions firmware/bootloader/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@ include $(RULESFILE)
include $(PROJECT_DIR)/rusefi_pch.mk
include $(PROJECT_DIR)/fome_generated.mk
include $(PROJECT_DIR)/gitversion.mk
include $(PROJECT_DIR)/controllers/modules/modules_header_gen.mk

.PHONY: CLEAN_RULE_HOOK CLEAN_PCH_HOOK CLEAN_BUNDLE_HOOK

Expand Down
2 changes: 1 addition & 1 deletion firmware/config/boards/atlas/prepend.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
! All commands should complete effectively instantly.
#define TS_BLOCK_READ_TIMEOUT 250

#define BLOCKING_FACTOR 1390
#define BLOCKING_FACTOR 1500
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const char * getBoardSpecificPinName(brain_pin_e brainPin) {
case Gpio::D12: return "Radiator Fan";
case Gpio::D14: return "3W - IDLE";
case Gpio::D9: return "3S - A/C Fan 94-95";
case Gpio::E12: return "Digital 1";
case Gpio::E5: return "1H - Ignition 2 & 3";
case Gpio::F11: return "1M - VSS";
case Gpio::F12: return "2J - Boost Control";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,12 @@ pins:
id: C6
class: outputs
ts_name: ETB EN

- pin: D1
id: E12
class: event_inputs
ts_name: Digital 1
function: Digital Input



Expand Down
2 changes: 1 addition & 1 deletion firmware/config/boards/nucleo_f429/board.mk
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ DDEFS += -DLED_CRITICAL_ERROR_BRAIN_PIN=Gpio::B14

# Enable ethernet
LWIP = yes
DDEFS += -DEFI_ETHERNET=TRUE
include $(PROJECT_DIR)/controllers/modules/ethernet_console/ethernet_console.mk

# This is an F429!
IS_STM32F429 = yes
Expand Down
2 changes: 1 addition & 1 deletion firmware/config/boards/nucleo_f767/board.mk
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ DDEFS += -DLED_CRITICAL_ERROR_BRAIN_PIN=Gpio::B14

# Enable ethernet
LWIP = yes
DDEFS += -DEFI_ETHERNET=TRUE
include $(PROJECT_DIR)/controllers/modules/ethernet_console/ethernet_console.mk

DDEFS += -DFIRMWARE_ID=\"nucleo_f767\"
DDEFS += -DDEFAULT_ENGINE_TYPE=MINIMAL_PINS
2 changes: 1 addition & 1 deletion firmware/config/boards/nucleo_f767/prepend.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
#define BLOCKING_FACTOR 1390
#define BLOCKING_FACTOR 1500
2 changes: 1 addition & 1 deletion firmware/config/boards/nucleo_h743/board.mk
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ DDEFS += -DLED_CRITICAL_ERROR_BRAIN_PIN=Gpio::B14

# Enable ethernet
LWIP = yes
DDEFS += -DEFI_ETHERNET=TRUE
include $(PROJECT_DIR)/controllers/modules/ethernet_console/ethernet_console.mk

DDEFS += -DFIRMWARE_ID=\"nucleo_h743\"
DDEFS += -DDEFAULT_ENGINE_TYPE=MINIMAL_PINS
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/config/boards/proteus/prepend.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@
#define show_Proteus_presets true

#define LUA_SCRIPT_SIZE 12000
#define BLOCKING_FACTOR 1390
#define BLOCKING_FACTOR 1500
3 changes: 0 additions & 3 deletions firmware/config/engines/bmw_m73_mre.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,6 @@ void setEngineBMW_M73_microRusEfi() {
// do I have VR wires flipped?
engineConfiguration->trigger.type = trigger_type_e::TT_60_2_VW;

//set tps_min 891
engineConfiguration->tpsMin = 891;
//set tps_max 177
engineConfiguration->tpsMax = 177;

}
55 changes: 1 addition & 54 deletions firmware/config/engines/custom_engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,39 +28,6 @@
#include "scheduler.h"
#endif /* EFI_PROD_CODE */

#if EFI_PROD_CODE
static int periodIndex = 0;

static OutputPin testPin;
static scheduling_s testScheduling;

static int test557[] = {5, 5, 10, 10, 20, 20, 50, 50, 100, 100, 200, 200, 500, 500, 500, 500};
#define TEST_LEN 16

efitimeus_t testTime;

static void toggleTestAndScheduleNext(void *) {
testPin.toggle();
periodIndex = (periodIndex + 1) % TEST_LEN;
testTime += test557[periodIndex];
engine->executor.scheduleByTimestamp("test", &testScheduling, testTime, &toggleTestAndScheduleNext);
}

/**
* https://github.com/rusefi/rusefi/issues/557 common rail / direct injection scheduling control test
*/
void runSchedulingPrecisionTestIfNeeded(void) {
if (!isBrainPinValid(engineConfiguration->test557pin)) {
return;
}

testPin.initPin("test", engineConfiguration->test557pin);
testPin.setValue(0);
testTime = getTimeNowUs();
toggleTestAndScheduleNext(/*unused*/ nullptr);
}
#endif /* EFI_PROD_CODE */

void setDiscoveryPdm() {
}

Expand Down Expand Up @@ -129,21 +96,6 @@ void setFrankensoConfiguration() {

setAlgorithm(LM_SPEED_DENSITY);

#if EFI_PWM_TESTER
engineConfiguration->injectionPins[4] = Gpio::C8; // #5
engineConfiguration->injectionPins[5] = Gpio::D10; // #6
engineConfiguration->injectionPins[6] = Gpio::D9;
engineConfiguration->injectionPins[7] = Gpio::D11;
engineConfiguration->injectionPins[8] = Gpio::D0;
engineConfiguration->injectionPins[9] = Gpio::B11;
engineConfiguration->injectionPins[10] = Gpio::C7;
engineConfiguration->injectionPins[11] = Gpio::E4;

/**
* We want to initialize all outputs for test
*/
engineConfiguration->cylindersCount = 12;
#else /* EFI_PWM_TESTER */
engineConfiguration->injectionPins[4] = Gpio::Unassigned;
engineConfiguration->injectionPins[5] = Gpio::Unassigned;
engineConfiguration->injectionPins[6] = Gpio::Unassigned;
Expand All @@ -158,7 +110,6 @@ void setFrankensoConfiguration() {
engineConfiguration->ignitionPins[2] = Gpio::C9;
// set_ignition_pin 4 PE10
engineConfiguration->ignitionPins[3] = Gpio::E10;
#endif /* EFI_PWM_TESTER */

// todo: 8.2 or 10k?
engineConfiguration->vbattDividerCoeff = ((float) (10 + 33)) / 10 * 2;
Expand Down Expand Up @@ -218,10 +169,8 @@ void setFrankensoBoardTestConfiguration() {
// set engine_type 58
void setEtbTestConfiguration() {
// VAG test ETB
// set tps_min 54
engineConfiguration->tpsMin = 54;
// by the way this ETB has default position of ADC=74 which is about 4%
// set tps_max 540
engineConfiguration->tpsMax = 540;

// yes, 30K - that's a test configuration
Expand Down Expand Up @@ -359,10 +308,8 @@ void setTle8888TestConfiguration() {
engineConfiguration->etb_iTermMax = 300;

// VAG test ETB, no divider on red board - direct 3v TPS sensor
// set tps_min 332
engineConfiguration->tpsMin = 332;
// by the way this ETB has default position of ADC=74 which is about 4%
// set tps_max 540
engineConfiguration->tpsMax = 799;
}

Expand Down Expand Up @@ -587,7 +534,7 @@ void proteusBoardTest() {
#endif // HW_PROTEUS

void mreBCM() {
for (int i = 0; i < MAX_CYLINDER_COUNT;i++) {
for (int i = 0; i < MAX_CYLINDER_COUNT; i++) {
engineConfiguration->ignitionPins[i] = Gpio::Unassigned;
engineConfiguration->injectionPins[i] = Gpio::Unassigned;
}
Expand Down
1 change: 0 additions & 1 deletion firmware/config/engines/custom_engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

#include "engine_configuration.h"
void setFrankensoConfiguration();
void runSchedulingPrecisionTestIfNeeded(void);
void setDiscoveryPdm();
void setFrankensoBoardTestConfiguration();
void setEtbTestConfiguration();
Expand Down
22 changes: 11 additions & 11 deletions firmware/config/engines/mazda_miata_vvt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,11 +201,19 @@ static const float mafTransferKgH[MAF_TRANSFER_SIZE] = {
350.00
};

template <typename TSrc, typename TDst, size_t NSrc, size_t NDest>
constexpr void copyArrayPartial(TDst (&dest)[NDest], const TSrc (&src)[NSrc]) {
static_assert(NDest >= NSrc, "Source array must be larger than destination.");

for (size_t i = 0; i < NSrc; i++) {
dest[i] = src[i];
}
}

static void setMAFTransferFunction() {
memcpy(config->mafDecoding, mafTransferKgH, sizeof(mafTransferKgH));
memcpy(config->mafDecodingBins, mafTransferVolts, sizeof(mafTransferVolts));
for (int i = MAF_TRANSFER_SIZE;i<MAF_DECODING_COUNT;i++) {
copyArrayPartial(config->mafDecoding, mafTransferKgH);
copyArrayPartial(config->mafDecodingBins, mafTransferVolts);
for (int i = MAF_TRANSFER_SIZE; i < MAF_DECODING_COUNT; i++) {
config->mafDecodingBins[i] = config->mafDecodingBins[MAF_TRANSFER_SIZE - 1] + i * 0.01;
config->mafDecoding[i] = config->mafDecoding[MAF_TRANSFER_SIZE - 1];
}
Expand Down Expand Up @@ -342,9 +350,7 @@ static void setCommonMazdaNB() {
// Sensors

// TPS
// set tps_min 90
engineConfiguration->tpsMin = 100; // convert 12to10 bit (ADC/4)
// set tps_max 540
engineConfiguration->tpsMax = 650; // convert 12to10 bit (ADC/4)

// CLT/IAT
Expand Down Expand Up @@ -621,10 +627,7 @@ static void setMiataNB2_MRE_common() {
// disabled for now since only allowed with ETB
// engineConfiguration->throttlePedalPositionAdcChannel = EFI_ADC_7;

// set tps_min 90
engineConfiguration->tpsMin = 90;

// set tps_max 540
engineConfiguration->tpsMax = 870;

// 0.3#4 has wrong R139? TODO: fix that custom board to match proper value!!!
Expand Down Expand Up @@ -849,10 +852,7 @@ void setMiataNB2_Hellen72() {
setMazdaMiataEngineNB2Defaults();
strcpy(engineConfiguration->vehicleName, "H72 test");


// set tps_min 90
engineConfiguration->tpsMin = 110; // convert 12to10 bit (ADC/4)

}

void setMiataNB2_Hellen72_36() {
Expand Down
2 changes: 1 addition & 1 deletion firmware/config/engines/vw_b6.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ static inline void commonPassatB6() {
engineConfiguration->disableEtbWhenEngineStopped = true;


for (int i = 4; i < MAX_CYLINDER_COUNT;i++) {
for (int i = 4; i < MAX_CYLINDER_COUNT; i++) {
engineConfiguration->injectionPins[i] = Gpio::Unassigned;
engineConfiguration->ignitionPins[i] = Gpio::Unassigned;
}
Expand Down
6 changes: 2 additions & 4 deletions firmware/config/stm32f4ems/efifeatures.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@

#define EFI_TEXT_LOGGING TRUE

#define EFI_PWM_TESTER FALSE

#define EFI_ACTIVE_CONFIGURATION_IN_FLASH FALSE

#ifndef EFI_MC33816
Expand Down Expand Up @@ -268,10 +266,10 @@
#define EFI_USE_COMPRESSED_INI_MSD
#define ENABLE_PERF_TRACE TRUE

#if EFI_ETHERNET
#if MODULE_ETHERNET_CONSOLE
// F4 ethernet needs some extra space
#define LUA_USER_HEAP 40000
#else // EFI_ETHERNET
#else // MODULE_ETHERNET_CONSOLE
#define LUA_USER_HEAP 50000
#endif
#else
Expand Down
2 changes: 1 addition & 1 deletion firmware/console/binary/bluetooth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ static void runCommands(SerialTsChannelBase* tsChannel) {
return;
}

efiPrintf("Restarting at %d", baudRates[baudIdx].rate);
efiPrintf("Restarting at %lu", baudRates[baudIdx].rate);
tsChannel->start(baudRates[baudIdx].rate);
chThdSleepMilliseconds(10); // safety

Expand Down
2 changes: 1 addition & 1 deletion firmware/console/binary/live_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ const engine_state_s* getLiveData(size_t) {

template<>
const tps_accel_state_s* getLiveData(size_t) {
return &engine->tpsAccelEnrichment;
return &engine->module<TpsAccelEnrichment>().unmock();
}

template<>
Expand Down
2 changes: 1 addition & 1 deletion firmware/console/binary/trigger_scope.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ const BigBufferHandle& triggerScopeGetBuffer() {

// Start the next sample once we've read out this one
if (isRunning) {
engine->executor.scheduleByTimestampNt("trigger scope", &restartTimer, getTimeNowNt() + MS2NT(10), startSampling);
engine->scheduler.schedule("trigger scope", &restartTimer, getTimeNowNt() + MS2NT(10), startSampling);
}

return buffer;
Expand Down
Loading

0 comments on commit a1555ae

Please sign in to comment.