Merge remote-tracking branch 'origin/master' into master

This commit is contained in:
rusefillc 2021-04-23 15:44:20 -04:00
commit 466e0da406
11 changed files with 69 additions and 25 deletions

View File

@ -13,10 +13,15 @@ ifeq ($(PROJECT_CPU),ARCH_STM32F4)
IS_STM32F429 = yes
endif
# Override DEFAULT_ENGINE_TYPE
# Set this if you want a default engine type other than normal Proteus
ifeq ($(DEFAULT_ENGINE_TYPE),)
DEFAULT_ENGINE_TYPE = -DDEFAULT_ENGINE_TYPE=PROTEUS_DEFAULTS
endif
DDEFS += -DEFI_USE_OSC=TRUE
DDEFS += -DLED_CRITICAL_ERROR_BRAIN_PIN=GPIOE_3
DDEFS += -DFIRMWARE_ID=\"proteus\" -DDEFAULT_ENGINE_TYPE=PROTEUS_DEFAULTS
DDEFS += -DFIRMWARE_ID=\"proteus\" $(DEFAULT_ENGINE_TYPE)
DDEFS += -DEFI_ICU_INPUTS=FALSE -DHAL_TRIGGER_USE_PAL=TRUE
DDEFS += -DEFI_LOGIC_ANALYZER=FALSE
# todo: refactor HAL_VSS_USE_PAL

View File

@ -2,7 +2,7 @@
export PROJECT_BOARD=proteus
export PROJECT_CPU=ARCH_STM32F4
export EXTRA_PARAMS="-DVR_HW_CHECK_MODE=TRUE -DHW_CHECK_ALWAYS_STIMULATE=TRUE -DHW_CHECK_SPARK_FSIO=TRUE -DSHORT_BOARD_NAME=proteus_f4"
export EXTRA_PARAMS="-DVR_HW_CHECK_MODE=TRUE -DHW_CHECK_MODE=TRUE -DHW_CHECK_SD=TRUE -DHW_CHECK_ALWAYS_STIMULATE=TRUE -DHW_CHECK_SPARK_FSIO=TRUE -DSHORT_BOARD_NAME=proteus_f4"
export DEFAULT_ENGINE_TYPE=-DDEFAULT_ENGINE_TYPE=PROTEUS_QC_TEST_BOARD

View File

@ -2,8 +2,7 @@
export PROJECT_BOARD=proteus
export PROJECT_CPU=ARCH_STM32F7
export EXTRA_PARAMS="-DVR_HW_CHECK_MODE=TRUE -DHW_CHECK_ALWAYS_STIMULATE=TRUE -DHW_CHECK_SPARK_FSIO=TRUE -DSHORT_BOARD_NAME=proteus_f7"
export EXTRA_PARAMS="-DVR_HW_CHECK_MODE=TRUE -DHW_CHECK_MODE=TRUE -DHW_CHECK_SD=TRUE -DHW_CHECK_ALWAYS_STIMULATE=TRUE -DHW_CHECK_SPARK_FSIO=TRUE -DSHORT_BOARD_NAME=proteus_f7"
export DEFAULT_ENGINE_TYPE=-DDEFAULT_ENGINE_TYPE=PROTEUS_QC_TEST_BOARD

View File

@ -24,6 +24,10 @@ void mreBoardOldTest(DECLARE_CONFIG_PARAMETER_SIGNATURE);
void mreBoardNewTest(DECLARE_CONFIG_PARAMETER_SIGNATURE);
void mreBCM(DECLARE_CONFIG_PARAMETER_SIGNATURE);
/**
* PROTEUS_QC_TEST_BOARD
* set engine_type 42
*/
void proteusBoardTest(DECLARE_CONFIG_PARAMETER_SIGNATURE);
void setTest33816EngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE);

View File

@ -376,11 +376,18 @@ class CommunicationBlinkingTask : public PeriodicTimerController {
setAllLeds(0);
} else if (counter % 2 == 0) {
enginePins.communicationLedPin.setValue(0);
#if HW_CHECK_MODE
// we have to do anything possible to help users notice FACTORY MODE
enginePins.errorLedPin.setValue(1);
enginePins.runningLedPin.setValue(1);
#endif // HW_CHECK_MODE
#if HW_CHECK_SD
extern int totalLoggedBytes;
if (totalLoggedBytes > 2000) {
enginePins.communicationLedPin.setValue(1);
}
#endif // HW_CHECK_SD
//#if HW_CHECK_MODE
// // we have to do anything possible to help users notice FACTORY MODE
// enginePins.errorLedPin.setValue(1);
// enginePins.runningLedPin.setValue(1);
//#endif // HW_CHECK_MODE
if (!lowVBatt) {
enginePins.warningLedPin.setValue(0);
}
@ -411,11 +418,11 @@ class CommunicationBlinkingTask : public PeriodicTimerController {
}
enginePins.communicationLedPin.setValue(1);
#if HW_CHECK_MODE
// we have to do anything possible to help users notice FACTORY MODE
enginePins.errorLedPin.setValue(0);
enginePins.runningLedPin.setValue(0);
#endif // HW_CHECK_MODE
//#if HW_CHECK_MODE
// // we have to do anything possible to help users notice FACTORY MODE
// enginePins.errorLedPin.setValue(0);
// enginePins.runningLedPin.setValue(0);
//#endif // HW_CHECK_MODE
#if EFI_ENGINE_CONTROL
if (lowVBatt || isTriggerErrorNow() || isIgnitionTimingError()) {

View File

@ -1,2 +1,2 @@
#pragma once
#define VCS_DATE 20210421
#define VCS_DATE 20210423

View File

@ -162,7 +162,14 @@ static persisted_configuration_state_e doReadConfiguration(flashaddr_t address)
*/
static persisted_configuration_state_e readConfiguration() {
efiAssert(CUSTOM_ERR_ASSERT, getCurrentRemainingStack() > EXPECTED_REMAINING_STACK, "read f", PC_ERROR);
#if HW_CHECK_MODE
persisted_configuration_state_e result = PC_OK;
resetConfigurationExt(DEFAULT_ENGINE_TYPE PASS_ENGINE_PARAMETER_SUFFIX);
#else // HW_CHECK_MODE
persisted_configuration_state_e result = doReadConfiguration(getFlashAddrFirstCopy());
if (result != PC_OK) {
efiPrintf("Reading second configuration copy");
result = doReadConfiguration(getFlashAddrSecondCopy());
@ -180,6 +187,7 @@ static persisted_configuration_state_e readConfiguration() {
*/
applyNonPersistentConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE);
}
#endif // HW_CHECK_MODE
// we can only change the state after the CRC check
engineConfiguration->byFirmwareVersion = getRusEfiVersion();
memset(persistentState.persistentConfiguration.warning_message , 0, ERROR_BUFFER_SIZE);

View File

@ -23,6 +23,7 @@
#include "engine_math.h"
#include "local_version_holder.h"
#include "trigger_simulator.h"
#include "trigger_emulator_algo.h"
#include "rpm_calculator.h"
#include "tooth_logger.h"
@ -108,6 +109,7 @@ void hwHandleVvtCamSignal(trigger_value_e front, efitick_t nowNt, int index DECL
extern ioportid_t criticalErrorLedPort;
extern ioportmask_t criticalErrorLedPin;
for (int i = 0 ; i < 100 ; i++) {
// turning pin ON and busy-waiting a bit
palWritePad(criticalErrorLedPort, criticalErrorLedPin, 1);
@ -286,20 +288,22 @@ int maxTriggerReentraint = 0;
uint32_t triggerDuration;
uint32_t triggerMaxDuration = 0;
/**
* this method is invoked only by real hardware call-backs
*/
void hwHandleShaftSignal(trigger_event_e signal, efitick_t timestamp) {
ScopePerf perf(PE::HandleShaftSignal);
// Don't accept trigger input in case of some problems
if (!engine->limpManager.allowTriggerInput()) {
return;
}
#if VR_HW_CHECK_MODE
// some boards do not have hardware VR input LEDs which makes such boards harder to validate
// from experience we know that assembly mistakes happen and quality control is required
extern ioportid_t criticalErrorLedPort;
extern ioportmask_t criticalErrorLedPin;
#if HW_CHECK_ALWAYS_STIMULATE
disableTriggerStimulator();
#endif // HW_CHECK_ALWAYS_STIMULATE
for (int i = 0 ; i < 100 ; i++) {
// turning pin ON and busy-waiting a bit
palWritePad(criticalErrorLedPort, criticalErrorLedPin, 1);
@ -308,6 +312,22 @@ void hwHandleShaftSignal(trigger_event_e signal, efitick_t timestamp) {
palWritePad(criticalErrorLedPort, criticalErrorLedPin, 0);
#endif // VR_HW_CHECK_MODE
handleShaftSignal(signal, timestamp);
}
/**
* this method is invoked by both real hardware and self-stimulator
*/
void handleShaftSignal(trigger_event_e signal, efitick_t timestamp) {
ScopePerf perf(PE::HandleShaftSignal);
// Don't accept trigger input in case of some problems
if (!engine->limpManager.allowTriggerInput()) {
return;
}
#if EFI_TOOTH_LOGGER
// Log to the Tunerstudio tooth logger
// We want to do this before anything else as we

View File

@ -84,6 +84,7 @@ public:
};
void triggerInfo(void);
void handleShaftSignal(trigger_event_e signal, efitick_t timestamp);
void hwHandleShaftSignal(trigger_event_e signal, efitick_t timestamp);
void hwHandleVvtCamSignal(trigger_value_e front, efitick_t timestamp, int index DECLARE_ENGINE_PARAMETER_SUFFIX);

View File

@ -63,7 +63,7 @@ void TriggerEmulatorHelper::handleEmulatorCallback(PwmConfig *state, int stateIn
trigger_event_e event = (currentValue ? riseEvents : fallEvents)[i];
hwHandleShaftSignal(event, stamp);
handleShaftSignal(event, stamp);
}
}
}

View File

@ -50,7 +50,7 @@ EXTERN_ENGINE;
// at about 20Hz we write about 2Kb per second, looks like we flush once every ~2 seconds
#define F_SYNC_FREQUENCY 10
static int totalLoggedBytes = 0;
int totalLoggedBytes = 0;
static int fileCreatedCounter = 0;
static int writeCounter = 0;
static int totalWritesCounter = 0;