mirror of https://github.com/rusefi/rusefi-1.git
Merge remote-tracking branch 'origin/master' into master
This commit is contained in:
commit
b54c1f13de
|
@ -1 +1 @@
|
|||
Subproject commit fbd6f482af0c3764f55749e29722372b2b2e3b36
|
||||
Subproject commit e7cdad3d1a041caea83729fd2c709fd963fb40b0
|
|
@ -1,4 +1,4 @@
|
|||
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on hellen_cypress_gen_config.bat integration/rusefi_config.txt Thu Feb 25 02:57:29 UTC 2021
|
||||
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on hellen_cypress_gen_config.bat integration/rusefi_config.txt Sun Feb 28 23:58:13 UTC 2021
|
||||
// by class com.rusefi.output.CHeaderConsumer
|
||||
// begin
|
||||
#pragma once
|
||||
|
@ -3864,4 +3864,4 @@ struct persistent_config_s {
|
|||
typedef struct persistent_config_s persistent_config_s;
|
||||
|
||||
// end
|
||||
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on hellen_cypress_gen_config.bat integration/rusefi_config.txt Thu Feb 25 02:57:29 UTC 2021
|
||||
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on hellen_cypress_gen_config.bat integration/rusefi_config.txt Sun Feb 28 23:58:13 UTC 2021
|
||||
|
|
|
@ -1242,7 +1242,7 @@
|
|||
#define showHumanReadableWarning_offset 976
|
||||
#define showSdCardWarning_offset 76
|
||||
#define SIGNATURE_BOARD hellen_cypress
|
||||
#define SIGNATURE_DATE 2021.02.25
|
||||
#define SIGNATURE_DATE 2021.02.28
|
||||
#define SIGNATURE_HASH 1039053165
|
||||
#define silentTriggerError_offset 1464
|
||||
#define slowAdcAlpha_offset 2088
|
||||
|
@ -1577,7 +1577,7 @@
|
|||
#define ts_show_spi true
|
||||
#define ts_show_trigger_comparator false
|
||||
#define ts_show_tunerstudio_port true
|
||||
#define TS_SIGNATURE "rusEFI 2021.02.25.hellen_cypress.1039053165"
|
||||
#define TS_SIGNATURE "rusEFI 2021.02.28.hellen_cypress.1039053165"
|
||||
#define TS_SINGLE_WRITE_COMMAND 'W'
|
||||
#define TS_SINGLE_WRITE_COMMAND_char W
|
||||
#define TS_TEST_COMMAND 't' // 0x74
|
||||
|
|
|
@ -163,6 +163,7 @@
|
|||
#endif
|
||||
|
||||
#define EFI_INTERNAL_ADC TRUE
|
||||
#define EFI_USE_FAST_ADC TRUE
|
||||
|
||||
#define EFI_NARROW_EGO_AVERAGING FALSE
|
||||
|
||||
|
|
|
@ -169,9 +169,6 @@ void setBoardConfigurationOverrides(void) {
|
|||
engineConfiguration->injectionMode = IM_SIMULTANEOUS;//IM_BATCH;// IM_SEQUENTIAL;
|
||||
}
|
||||
|
||||
void setAdcChannelOverrides(void) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Board-specific SD card configuration code overrides. Needed by bootloader code.
|
||||
* @todo Add your board-specific code, if any.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on kinetis_gen_config.bat integration/rusefi_config.txt Thu Feb 25 02:57:25 UTC 2021
|
||||
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on kinetis_gen_config.bat integration/rusefi_config.txt Sun Feb 28 23:58:11 UTC 2021
|
||||
// by class com.rusefi.output.CHeaderConsumer
|
||||
// begin
|
||||
#pragma once
|
||||
|
@ -3859,4 +3859,4 @@ struct persistent_config_s {
|
|||
typedef struct persistent_config_s persistent_config_s;
|
||||
|
||||
// end
|
||||
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on kinetis_gen_config.bat integration/rusefi_config.txt Thu Feb 25 02:57:25 UTC 2021
|
||||
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on kinetis_gen_config.bat integration/rusefi_config.txt Sun Feb 28 23:58:11 UTC 2021
|
||||
|
|
|
@ -1226,7 +1226,7 @@
|
|||
#define showHumanReadableWarning_offset 976
|
||||
#define showSdCardWarning_offset 76
|
||||
#define SIGNATURE_BOARD kin
|
||||
#define SIGNATURE_DATE 2021.02.25
|
||||
#define SIGNATURE_DATE 2021.02.28
|
||||
#define SIGNATURE_HASH 3259727249
|
||||
#define silentTriggerError_offset 1464
|
||||
#define slowAdcAlpha_offset 2088
|
||||
|
@ -1561,7 +1561,7 @@
|
|||
#define ts_show_spi true
|
||||
#define ts_show_trigger_comparator true
|
||||
#define ts_show_tunerstudio_port true
|
||||
#define TS_SIGNATURE "rusEFI 2021.02.25.kin.3259727249"
|
||||
#define TS_SIGNATURE "rusEFI 2021.02.28.kin.3259727249"
|
||||
#define TS_SINGLE_WRITE_COMMAND 'W'
|
||||
#define TS_SINGLE_WRITE_COMMAND_char W
|
||||
#define TS_TEST_COMMAND 't' // 0x74
|
||||
|
|
|
@ -144,6 +144,8 @@
|
|||
#define EFI_INTERNAL_ADC TRUE
|
||||
#endif
|
||||
|
||||
#define EFI_USE_FAST_ADC TRUE
|
||||
|
||||
#define EFI_NARROW_EGO_AVERAGING FALSE
|
||||
|
||||
#ifndef EFI_CAN_SUPPORT
|
||||
|
|
|
@ -77,7 +77,3 @@ void setBoardConfigurationOverrides(void) {
|
|||
|
||||
void setSdCardConfigurationOverrides(void) {
|
||||
}
|
||||
|
||||
void setAdcChannelOverrides(void) {
|
||||
}
|
||||
|
||||
|
|
|
@ -248,9 +248,6 @@ void setBoardConfigurationOverrides(void) {
|
|||
engineConfiguration->injectionMode = IM_SIMULTANEOUS;//IM_BATCH;// IM_SEQUENTIAL;
|
||||
}
|
||||
|
||||
void setAdcChannelOverrides(void) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Board-specific SD card configuration code overrides. Needed by bootloader code.
|
||||
* @todo Add your board-specific code, if any.
|
||||
|
|
|
@ -78,6 +78,3 @@ void setBoardConfigurationOverrides(void) {
|
|||
engineConfiguration->is_enabled_spi_2 = false;
|
||||
engineConfiguration->is_enabled_spi_3 = false;
|
||||
}
|
||||
|
||||
void setAdcChannelOverrides(void) {
|
||||
}
|
||||
|
|
|
@ -27,19 +27,3 @@ void setSerialConfigurationOverrides(void) {
|
|||
*/
|
||||
void setSdCardConfigurationOverrides(void) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Board-specific ADC channel configuration code overrides.
|
||||
* @todo Add your board-specific code, if any.
|
||||
*/
|
||||
void setAdcChannelOverrides(void) {
|
||||
}
|
||||
|
||||
// TODO: fix analog inputs so we don't need these stubs
|
||||
float getVoltage(const char*, adc_channel_e) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
float getVoltageDivided(const char*, adc_channel_e) {
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,14 +1,6 @@
|
|||
#include "hal.h"
|
||||
#include "stm32_gpio.h"
|
||||
|
||||
/**
|
||||
* @brief Board-specific ADC channel configuration code overrides.
|
||||
* @todo Add your board-specific code, if any.
|
||||
*/
|
||||
void setAdcChannelOverrides(void) {
|
||||
}
|
||||
|
||||
|
||||
#define PROMETHEUS_LED 13
|
||||
|
||||
// BLIIINK!!!!!!!!!!
|
||||
|
|
|
@ -32,9 +32,6 @@
|
|||
#undef EFI_USB_SERIAL
|
||||
#define EFI_USB_SERIAL FALSE
|
||||
|
||||
#undef MMC_CARD_SPI
|
||||
#define MMC_CARD_SPI SPID1
|
||||
|
||||
#define ADC_CHANNEL_VREF ADC_CHANNEL_IN14
|
||||
|
||||
#undef PRIMARY_UART_DMA_MODE
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
|
||||
#include "efilib.h"
|
||||
|
||||
#if USE_ADC3_VBATT_HACK
|
||||
|
||||
static ADCConversionGroup adcConvGroup = { FALSE, 1, nullptr, nullptr,
|
||||
0,
|
||||
ADC_CR2_SWSTART,
|
||||
|
@ -51,3 +53,5 @@ void proteusAdcHack()
|
|||
|
||||
vbattSampleProteus = sum / efi::size(samples);
|
||||
}
|
||||
|
||||
#endif /* USE_ADC3_VBATT_HACK */
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
# List of all the board related files.
|
||||
BOARDCPPSRC = $(PROJECT_DIR)/config/boards/proteus/board_configuration.cpp \
|
||||
$(PROJECT_DIR)/config/boards/proteus/adc_hack.cpp
|
||||
|
||||
BOARDINC = $(PROJECT_DIR)/config/boards/proteus
|
||||
|
||||
# Target processor details
|
||||
ifeq ($(PROJECT_CPU),ARCH_STM32F4)
|
||||
else
|
||||
ifeq ($(PROJECT_CPU),ARCH_STM32F7)
|
||||
PROTEUS_LEGACY = TRUE
|
||||
endif
|
||||
|
||||
|
@ -17,8 +17,13 @@ DDEFS += -DEFI_ICU_INPUTS=FALSE -DHAL_TRIGGER_USE_PAL=TRUE
|
|||
DDEFS += -DEFI_LOGIC_ANALYZER=FALSE
|
||||
# todo: refactor HAL_VSS_USE_PAL
|
||||
DDEFS += -DHAL_VSS_USE_PAL=TRUE
|
||||
DDEFS += -DSTM32_ADC_USE_ADC3=TRUE
|
||||
DDEFS += -DEFI_SOFTWARE_KNOCK=TRUE
|
||||
|
||||
# This stuff doesn't work on H7 yet
|
||||
ifneq ($(PROJECT_CPU),ARCH_STM32H7)
|
||||
DDEFS += -DSTM32_ADC_USE_ADC3=TRUE
|
||||
DDEFS += -DEFI_SOFTWARE_KNOCK=TRUE
|
||||
endif
|
||||
|
||||
DDEFS += -DEFI_CONSOLE_TX_BRAIN_PIN=GPIO_UNASSIGNED -DEFI_CONSOLE_RX_BRAIN_PIN=GPIO_UNASSIGNED
|
||||
|
||||
# We are running on Proteus hardware!
|
||||
|
|
|
@ -226,9 +226,6 @@ void setBoardConfigurationOverrides(void) {
|
|||
engineConfiguration->injectionMode = IM_SIMULTANEOUS;
|
||||
}
|
||||
|
||||
void setAdcChannelOverrides(void) {
|
||||
}
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* c-basic-indent: 4
|
||||
|
|
|
@ -31,10 +31,3 @@ void setSerialConfigurationOverrides(void) {
|
|||
*/
|
||||
void setSdCardConfigurationOverrides(void) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Board-specific ADC channel configuration code overrides.
|
||||
* @todo Add your board-specific code, if any.
|
||||
*/
|
||||
void setAdcChannelOverrides(void) {
|
||||
}
|
||||
|
|
|
@ -180,13 +180,6 @@ bool mmc_lld_is_write_protected(MMCDriver *mmcp)
|
|||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Board-specific ADC channel configuration code overrides.
|
||||
* @todo Add your board-specific code, if any.
|
||||
*/
|
||||
void setAdcChannelOverrides(void) {
|
||||
}
|
||||
|
||||
#define STATUS_LED_PIN 8
|
||||
#define STATUS_LED_PORT GPIOG
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on config/boards/subaru_eg33/config/gen_config.sh integration/rusefi_config.txt Thu Feb 25 02:57:30 UTC 2021
|
||||
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on config/boards/subaru_eg33/config/gen_config.sh integration/rusefi_config.txt Sun Feb 28 23:58:15 UTC 2021
|
||||
// by class com.rusefi.output.CHeaderConsumer
|
||||
// begin
|
||||
#pragma once
|
||||
|
@ -3864,4 +3864,4 @@ struct persistent_config_s {
|
|||
typedef struct persistent_config_s persistent_config_s;
|
||||
|
||||
// end
|
||||
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on config/boards/subaru_eg33/config/gen_config.sh integration/rusefi_config.txt Thu Feb 25 02:57:30 UTC 2021
|
||||
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on config/boards/subaru_eg33/config/gen_config.sh integration/rusefi_config.txt Sun Feb 28 23:58:15 UTC 2021
|
||||
|
|
|
@ -1242,7 +1242,7 @@
|
|||
#define showHumanReadableWarning_offset 976
|
||||
#define showSdCardWarning_offset 76
|
||||
#define SIGNATURE_BOARD subaru_eg33_f7
|
||||
#define SIGNATURE_DATE 2021.02.25
|
||||
#define SIGNATURE_DATE 2021.02.28
|
||||
#define SIGNATURE_HASH 3175160971
|
||||
#define silentTriggerError_offset 1464
|
||||
#define slowAdcAlpha_offset 2088
|
||||
|
@ -1577,7 +1577,7 @@
|
|||
#define ts_show_spi true
|
||||
#define ts_show_trigger_comparator false
|
||||
#define ts_show_tunerstudio_port false
|
||||
#define TS_SIGNATURE "rusEFI 2021.02.25.subaru_eg33_f7.3175160971"
|
||||
#define TS_SIGNATURE "rusEFI 2021.02.28.subaru_eg33_f7.3175160971"
|
||||
#define TS_SINGLE_WRITE_COMMAND 'W'
|
||||
#define TS_SINGLE_WRITE_COMMAND_char W
|
||||
#define TS_TEST_COMMAND 't' // 0x74
|
||||
|
|
|
@ -33,6 +33,10 @@
|
|||
/* do not use serial device for console */
|
||||
#undef TS_SERIAL_DEVICE
|
||||
|
||||
/* Knock detection */
|
||||
#undef EFI_HIP_9011
|
||||
#define EFI_HIP_9011 TRUE
|
||||
|
||||
#undef BOARD_TLE6240_COUNT
|
||||
#define BOARD_TLE6240_COUNT 1
|
||||
|
||||
|
@ -84,8 +88,7 @@
|
|||
#undef EFI_FUEL_PUMP
|
||||
#define EFI_FUEL_PUMP TRUE
|
||||
|
||||
#undef MMC_CARD_SPI
|
||||
#define MMC_CARD_SPI SPID1
|
||||
#define EFI_SDC_DEVICE SDCD2
|
||||
|
||||
#define ADC_CHANNEL_VREF ADC_CHANNEL_IN14
|
||||
|
||||
|
|
|
@ -193,6 +193,8 @@
|
|||
#define EFI_INTERNAL_ADC TRUE
|
||||
#endif
|
||||
|
||||
#define EFI_USE_FAST_ADC TRUE
|
||||
|
||||
#define EFI_NARROW_EGO_AVERAGING TRUE
|
||||
|
||||
#ifndef EFI_CAN_SUPPORT
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#undef EFI_INTERNAL_FLASH
|
||||
#define EFI_INTERNAL_FLASH FALSE
|
||||
#undef EFI_USE_FAST_ADC
|
||||
#define EFI_USE_FAST_ADC FALSE
|
||||
|
||||
#undef EFI_MC33816
|
||||
#define EFI_MC33816 FALSE
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "tunerstudio_io.h"
|
||||
#include "bluetooth.h"
|
||||
#include "engine_configuration.h"
|
||||
#include "thread_priority.h"
|
||||
|
||||
#if EFI_BLUETOOTH_SETUP
|
||||
|
||||
|
@ -289,7 +290,7 @@ void bluetoothStart(ts_channel_s *btChan, bluetooth_module_e moduleType, const c
|
|||
commands[numCommands++] = cmdPin;
|
||||
|
||||
// create a thread to execute these commands later
|
||||
btThread = chThdCreateStatic(btThreadStack, sizeof(btThreadStack), NORMALPRIO, (tfunc_t)btThreadEntryPoint, NULL);
|
||||
btThread = chThdCreateStatic(btThreadStack, sizeof(btThreadStack), PRIO_CONSOLE, (tfunc_t)btThreadEntryPoint, NULL);
|
||||
|
||||
btProcessIsStarted = true;
|
||||
}
|
||||
|
|
|
@ -87,6 +87,7 @@
|
|||
#include "status_loop.h"
|
||||
#include "mmc_card.h"
|
||||
#include "perf_trace.h"
|
||||
#include "thread_priority.h"
|
||||
|
||||
#include "signature.h"
|
||||
|
||||
|
@ -907,7 +908,7 @@ void startTunerStudioConnectivity(void) {
|
|||
addConsoleAction("bluetooth_cancel", bluetoothCancel);
|
||||
#endif /* EFI_BLUETOOTH_SETUP */
|
||||
|
||||
chThdCreateStatic(tunerstudioThreadStack, sizeof(tunerstudioThreadStack), NORMALPRIO, (tfunc_t)tsThreadEntryPoint, NULL);
|
||||
chThdCreateStatic(tunerstudioThreadStack, sizeof(tunerstudioThreadStack), PRIO_CONSOLE, (tfunc_t)tsThreadEntryPoint, NULL);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include "os_util.h"
|
||||
#include "tunerstudio.h"
|
||||
#include "connector_uart_dma.h"
|
||||
#include "thread_priority.h"
|
||||
|
||||
#if EFI_SIMULATOR
|
||||
#include "rusEfiFunctionalTest.h"
|
||||
|
@ -265,6 +266,6 @@ void startConsole(Logging *sharedLogger, CommandHandler console_line_callback_p)
|
|||
#endif /* EFI_CONSOLE_SERIAL_DEVICE || EFI_CONSOLE_UART_DEVICE */
|
||||
|
||||
#if !defined(EFI_CONSOLE_NO_THREAD)
|
||||
chThdCreateStatic(consoleThreadStack, sizeof(consoleThreadStack), NORMALPRIO, (tfunc_t)consoleThreadEntryPoint, NULL);
|
||||
chThdCreateStatic(consoleThreadStack, sizeof(consoleThreadStack), PRIO_CONSOLE, (tfunc_t)consoleThreadEntryPoint, NULL);
|
||||
#endif /* EFI_CONSOLE_NO_THREAD */
|
||||
}
|
||||
|
|
|
@ -83,6 +83,7 @@
|
|||
#include "dc_motor.h"
|
||||
#include "dc_motors.h"
|
||||
#include "pid_auto_tune.h"
|
||||
#include "thread_priority.h"
|
||||
|
||||
#if defined(HAS_OS_ACCESS)
|
||||
#error "Unexpected OS ACCESS HERE"
|
||||
|
@ -651,7 +652,7 @@ struct EtbImpl final : public EtbController {
|
|||
static EtbImpl etbControllers[ETB_COUNT];
|
||||
|
||||
struct EtbThread final : public PeriodicController<512> {
|
||||
EtbThread() : PeriodicController("ETB", NORMALPRIO + 3, ETB_LOOP_FREQUENCY) {}
|
||||
EtbThread() : PeriodicController("ETB", PRIO_ETB, ETB_LOOP_FREQUENCY) {}
|
||||
|
||||
void PeriodicTask(efitick_t) override {
|
||||
// Simply update all controllers
|
||||
|
|
|
@ -16,13 +16,14 @@
|
|||
#include "can_dash.h"
|
||||
#include "obd2.h"
|
||||
#include "can_sensor.h"
|
||||
#include "thread_priority.h"
|
||||
|
||||
EXTERN_ENGINE;
|
||||
|
||||
extern CanSensorBase* cansensors_head;
|
||||
|
||||
CanWrite::CanWrite()
|
||||
: PeriodicController("CAN TX", NORMALPRIO, 50)
|
||||
: PeriodicController("CAN TX", PRIO_CAN_TX, 50)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit cf106b65555d3dce3ca16424fdc18606f01355d9
|
||||
Subproject commit ab8c24564f40162b08599831b03eec3568a9c953
|
|
@ -1,2 +1,2 @@
|
|||
#pragma once
|
||||
#define VCS_DATE 20210225
|
||||
#define VCS_DATE 20210228
|
||||
|
|
|
@ -94,9 +94,6 @@ RpmCalculator::RpmCalculator() :
|
|||
#endif /* EFI_PROD_CODE */
|
||||
// todo: reuse assignRpmValue() method which needs PASS_ENGINE_PARAMETER_SUFFIX
|
||||
// which we cannot provide inside this parameter-less constructor. need a solution for this minor mess
|
||||
|
||||
// we need this initial to have not_running at first invocation
|
||||
lastRpmEventTimeNt = (efitick_t) DEEP_IN_THE_PAST_SECONDS * NT_PER_SECOND;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -118,11 +115,15 @@ bool RpmCalculator::checkIfSpinning(efitick_t nowNt) const {
|
|||
* note that the result of this subtraction could be negative, that would happen if
|
||||
* we have a trigger event between the time we've invoked 'getTimeNow' and here
|
||||
*/
|
||||
bool noRpmEventsForTooLong = nowNt - lastRpmEventTimeNt >= NT_PER_SECOND * NO_RPM_EVENTS_TIMEOUT_SECS; // Anything below 60 rpm is not running
|
||||
|
||||
// Anything below 60 rpm is not running
|
||||
bool noRpmEventsForTooLong = lastTdcTimer.getElapsedSeconds(nowNt) > NO_RPM_EVENTS_TIMEOUT_SECS;
|
||||
|
||||
/**
|
||||
* Also check if there were no trigger events
|
||||
*/
|
||||
bool noTriggerEventsForTooLong = nowNt - engine->triggerCentral.triggerState.previousShaftEventTimeNt >= NT_PER_SECOND;
|
||||
bool noTriggerEventsForTooLong = engine->triggerCentral.getTimeSinceTriggerEvent(nowNt) >= 1;
|
||||
|
||||
if (noRpmEventsForTooLong || noTriggerEventsForTooLong) {
|
||||
return false;
|
||||
}
|
||||
|
@ -252,8 +253,9 @@ void rpmShaftPositionCallback(trigger_event_e ckpSignalType,
|
|||
if (index == 0) {
|
||||
bool hadRpmRecently = rpmState->checkIfSpinning(nowNt);
|
||||
|
||||
float periodSeconds = engine->rpmCalculator.lastTdcTimer.getElapsedSecondsAndReset(nowNt);
|
||||
|
||||
if (hadRpmRecently) {
|
||||
int32_t diffNt = (int32_t)(nowNt - rpmState->lastRpmEventTimeNt);
|
||||
/**
|
||||
* Four stroke cycle is two crankshaft revolutions
|
||||
*
|
||||
|
@ -261,22 +263,21 @@ void rpmShaftPositionCallback(trigger_event_e ckpSignalType,
|
|||
* and each revolution of crankshaft consists of two engine cycles revolutions
|
||||
*
|
||||
*/
|
||||
if (diffNt == 0) {
|
||||
if (periodSeconds == 0) {
|
||||
rpmState->setRpmValue(NOISY_RPM);
|
||||
rpmState->rpmRate = 0;
|
||||
} else {
|
||||
int mult = (int)getEngineCycle(engine->getOperationMode(PASS_ENGINE_PARAMETER_SIGNATURE)) / 360;
|
||||
float rpm = 60.0 * NT_PER_SECOND * mult / diffNt;
|
||||
float rpm = 60 * mult / periodSeconds;
|
||||
|
||||
auto rpmDelta = rpm - rpmState->previousRpmValue;
|
||||
rpmState->rpmRate = rpmDelta / (mult * 1e-6 * NT2US(diffNt));
|
||||
rpmState->rpmRate = rpmDelta / (mult * periodSeconds);
|
||||
|
||||
rpmState->setRpmValue(rpm > UNREALISTIC_RPM ? NOISY_RPM : rpm);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
rpmState->onNewEngineCycle();
|
||||
rpmState->lastRpmEventTimeNt = nowNt;
|
||||
}
|
||||
|
||||
|
||||
|
@ -363,16 +364,13 @@ void tdcMarkCallback(
|
|||
* @return Current crankshaft angle, 0 to 720 for four-stroke
|
||||
*/
|
||||
float getCrankshaftAngleNt(efitick_t timeNt DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||
efitick_t timeSinceZeroAngleNt = timeNt
|
||||
- engine->rpmCalculator.lastRpmEventTimeNt;
|
||||
float timeSinceZeroAngle = engine->rpmCalculator.lastTdcTimer.getElapsedSeconds(timeNt);
|
||||
|
||||
/**
|
||||
* even if we use 'getOneDegreeTimeUs' macros here, it looks like the
|
||||
* compiler is not smart enough to figure out that "A / ( B / C)" could be optimized into
|
||||
* "A * C / B" in order to replace a slower division with a faster multiplication.
|
||||
*/
|
||||
int rpm = GET_RPM();
|
||||
return rpm == 0 ? NAN : timeSinceZeroAngleNt / getOneDegreeTimeNt(rpm);
|
||||
|
||||
float oneDegreeSeconds = (60.0f / 360) / rpm;
|
||||
|
||||
return rpm == 0 ? NAN : timeSinceZeroAngle / oneDegreeSeconds;
|
||||
}
|
||||
|
||||
void initRpmCalculator(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include "globalaccess.h"
|
||||
#include "scheduler.h"
|
||||
#include "stored_value_sensor.h"
|
||||
#include "timer.h"
|
||||
|
||||
// we use this value in case of noise on trigger input lines
|
||||
#define NOISY_RPM -1
|
||||
|
@ -113,7 +114,8 @@ public:
|
|||
* NaN while engine is not spinning
|
||||
*/
|
||||
volatile floatus_t oneDegreeUs = NAN;
|
||||
volatile efitick_t lastRpmEventTimeNt = 0;
|
||||
|
||||
Timer lastTdcTimer;
|
||||
|
||||
// RPM rate of change, in RPM per second
|
||||
float rpmRate = 0;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Thu Feb 25 02:57:02 UTC 2021
|
||||
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Sun Feb 28 23:57:45 UTC 2021
|
||||
// by class com.rusefi.output.CHeaderConsumer
|
||||
// begin
|
||||
#pragma once
|
||||
|
@ -3864,4 +3864,4 @@ struct persistent_config_s {
|
|||
typedef struct persistent_config_s persistent_config_s;
|
||||
|
||||
// end
|
||||
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Thu Feb 25 02:57:02 UTC 2021
|
||||
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Sun Feb 28 23:57:45 UTC 2021
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Thu Feb 25 02:57:02 UTC 2021
|
||||
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Sun Feb 28 23:57:45 UTC 2021
|
||||
|
||||
// by class com.rusefi.output.FileFsioSettingsConsumer
|
||||
FSIO_SETTING_FANONTEMPERATURE = 1000,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Thu Feb 25 02:57:02 UTC 2021
|
||||
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Sun Feb 28 23:57:45 UTC 2021
|
||||
|
||||
// by class com.rusefi.output.FileFsioSettingsConsumer
|
||||
case FSIO_SETTING_FANONTEMPERATURE:
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Thu Feb 25 02:57:02 UTC 2021
|
||||
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Sun Feb 28 23:57:45 UTC 2021
|
||||
|
||||
// by class com.rusefi.output.FileFsioSettingsConsumer
|
||||
static LENameOrdinalPair lefanOnTemperature(FSIO_SETTING_FANONTEMPERATURE, "cfg_fanOnTemperature");
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Thu Feb 25 02:57:02 UTC 2021
|
||||
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Sun Feb 28 23:57:45 UTC 2021
|
||||
|
||||
// by class com.rusefi.output.FileFsioSettingsConsumer
|
||||
case FSIO_SETTING_FANONTEMPERATURE:
|
||||
|
|
|
@ -1239,7 +1239,7 @@
|
|||
#define showHumanReadableWarning_offset 976
|
||||
#define showSdCardWarning_offset 76
|
||||
#define SIGNATURE_BOARD all
|
||||
#define SIGNATURE_DATE 2021.02.25
|
||||
#define SIGNATURE_DATE 2021.02.28
|
||||
#define SIGNATURE_HASH 2140302013
|
||||
#define silentTriggerError_offset 1464
|
||||
#define slowAdcAlpha_offset 2088
|
||||
|
@ -1574,7 +1574,7 @@
|
|||
#define ts_show_spi true
|
||||
#define ts_show_trigger_comparator false
|
||||
#define ts_show_tunerstudio_port true
|
||||
#define TS_SIGNATURE "rusEFI 2021.02.25.all.2140302013"
|
||||
#define TS_SIGNATURE "rusEFI 2021.02.28.all.2140302013"
|
||||
#define TS_SINGLE_WRITE_COMMAND 'W'
|
||||
#define TS_SINGLE_WRITE_COMMAND_char W
|
||||
#define TS_TEST_COMMAND 't' // 0x74
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
//
|
||||
|
||||
#define SIGNATURE_BOARD all
|
||||
#define SIGNATURE_DATE 2021.02.25
|
||||
#define SIGNATURE_DATE 2021.02.28
|
||||
#define SIGNATURE_HASH 2140302013
|
||||
#define TS_SIGNATURE "rusEFI 2021.02.25.all.2140302013"
|
||||
#define TS_SIGNATURE "rusEFI 2021.02.28.all.2140302013"
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
//
|
||||
|
||||
#define SIGNATURE_BOARD frankenso_na6
|
||||
#define SIGNATURE_DATE 2021.02.25
|
||||
#define SIGNATURE_DATE 2021.02.28
|
||||
#define SIGNATURE_HASH 4226303790
|
||||
#define TS_SIGNATURE "rusEFI 2021.02.25.frankenso_na6.4226303790"
|
||||
#define TS_SIGNATURE "rusEFI 2021.02.28.frankenso_na6.4226303790"
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
//
|
||||
|
||||
#define SIGNATURE_BOARD hellen72
|
||||
#define SIGNATURE_DATE 2021.02.25
|
||||
#define SIGNATURE_DATE 2021.02.28
|
||||
#define SIGNATURE_HASH 96926268
|
||||
#define TS_SIGNATURE "rusEFI 2021.02.25.hellen72.96926268"
|
||||
#define TS_SIGNATURE "rusEFI 2021.02.28.hellen72.96926268"
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
//
|
||||
|
||||
#define SIGNATURE_BOARD hellen_cypress
|
||||
#define SIGNATURE_DATE 2021.02.25
|
||||
#define SIGNATURE_DATE 2021.02.28
|
||||
#define SIGNATURE_HASH 1039053165
|
||||
#define TS_SIGNATURE "rusEFI 2021.02.25.hellen_cypress.1039053165"
|
||||
#define TS_SIGNATURE "rusEFI 2021.02.28.hellen_cypress.1039053165"
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
//
|
||||
|
||||
#define SIGNATURE_BOARD kin
|
||||
#define SIGNATURE_DATE 2021.02.25
|
||||
#define SIGNATURE_DATE 2021.02.28
|
||||
#define SIGNATURE_HASH 3259727249
|
||||
#define TS_SIGNATURE "rusEFI 2021.02.25.kin.3259727249"
|
||||
#define TS_SIGNATURE "rusEFI 2021.02.28.kin.3259727249"
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
//
|
||||
|
||||
#define SIGNATURE_BOARD mre_f4
|
||||
#define SIGNATURE_DATE 2021.02.25
|
||||
#define SIGNATURE_DATE 2021.02.28
|
||||
#define SIGNATURE_HASH 1364465751
|
||||
#define TS_SIGNATURE "rusEFI 2021.02.25.mre_f4.1364465751"
|
||||
#define TS_SIGNATURE "rusEFI 2021.02.28.mre_f4.1364465751"
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
//
|
||||
|
||||
#define SIGNATURE_BOARD mre_f7
|
||||
#define SIGNATURE_DATE 2021.02.25
|
||||
#define SIGNATURE_DATE 2021.02.28
|
||||
#define SIGNATURE_HASH 1364465751
|
||||
#define TS_SIGNATURE "rusEFI 2021.02.25.mre_f7.1364465751"
|
||||
#define TS_SIGNATURE "rusEFI 2021.02.28.mre_f7.1364465751"
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
//
|
||||
|
||||
#define SIGNATURE_BOARD prometheus_405
|
||||
#define SIGNATURE_DATE 2021.02.25
|
||||
#define SIGNATURE_DATE 2021.02.28
|
||||
#define SIGNATURE_HASH 1829005451
|
||||
#define TS_SIGNATURE "rusEFI 2021.02.25.prometheus_405.1829005451"
|
||||
#define TS_SIGNATURE "rusEFI 2021.02.28.prometheus_405.1829005451"
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
//
|
||||
|
||||
#define SIGNATURE_BOARD prometheus_469
|
||||
#define SIGNATURE_DATE 2021.02.25
|
||||
#define SIGNATURE_DATE 2021.02.28
|
||||
#define SIGNATURE_HASH 1829005451
|
||||
#define TS_SIGNATURE "rusEFI 2021.02.25.prometheus_469.1829005451"
|
||||
#define TS_SIGNATURE "rusEFI 2021.02.28.prometheus_469.1829005451"
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
//
|
||||
|
||||
#define SIGNATURE_BOARD proteus_f4
|
||||
#define SIGNATURE_DATE 2021.02.25
|
||||
#define SIGNATURE_DATE 2021.02.28
|
||||
#define SIGNATURE_HASH 413377170
|
||||
#define TS_SIGNATURE "rusEFI 2021.02.25.proteus_f4.413377170"
|
||||
#define TS_SIGNATURE "rusEFI 2021.02.28.proteus_f4.413377170"
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
//
|
||||
|
||||
#define SIGNATURE_BOARD proteus_f7
|
||||
#define SIGNATURE_DATE 2021.02.25
|
||||
#define SIGNATURE_DATE 2021.02.28
|
||||
#define SIGNATURE_HASH 413377170
|
||||
#define TS_SIGNATURE "rusEFI 2021.02.25.proteus_f7.413377170"
|
||||
#define TS_SIGNATURE "rusEFI 2021.02.28.proteus_f7.413377170"
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
//
|
||||
|
||||
#define SIGNATURE_BOARD subaru_eg33_f7
|
||||
#define SIGNATURE_DATE 2021.02.25
|
||||
#define SIGNATURE_DATE 2021.02.28
|
||||
#define SIGNATURE_HASH 3175160971
|
||||
#define TS_SIGNATURE "rusEFI 2021.02.25.subaru_eg33_f7.3175160971"
|
||||
#define TS_SIGNATURE "rusEFI 2021.02.28.subaru_eg33_f7.3175160971"
|
||||
|
|
|
@ -34,11 +34,6 @@ void setFlatInjectorLag(float value DECLARE_CONFIG_PARAMETER_SUFFIX);
|
|||
*/
|
||||
#define getOneDegreeTimeUs(rpm) (1000000.0f * 60 / 360 / (rpm))
|
||||
|
||||
/**
|
||||
* @return float, time needed to rotate crankshaft by one degree, in native clicks.
|
||||
*/
|
||||
#define getOneDegreeTimeNt(rpm) (US2NT(1000000) * 60.0f / 360 / (rpm))
|
||||
|
||||
floatms_t getCrankshaftRevolutionTimeMs(int rpm);
|
||||
floatms_t getEngineCycleDuration(int rpm DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "perf_trace.h"
|
||||
#include "thread_controller.h"
|
||||
#include "software_knock.h"
|
||||
#include "thread_priority.h"
|
||||
|
||||
#if EFI_SOFTWARE_KNOCK
|
||||
|
||||
|
@ -162,7 +163,7 @@ void startKnockSampling(uint8_t cylinderIndex) {
|
|||
|
||||
class KnockThread : public ThreadController<256> {
|
||||
public:
|
||||
KnockThread() : ThreadController("knock", NORMALPRIO - 10) {}
|
||||
KnockThread() : ThreadController("knock", PRIO_KNOCK_PROCESS) {}
|
||||
void ThreadTask() override;
|
||||
};
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
#include "allsensors.h"
|
||||
#include "vehicle_speed.h"
|
||||
#include "thread_priority.h"
|
||||
|
||||
EXTERN_ENGINE;
|
||||
|
||||
|
@ -29,7 +30,7 @@ uint8_t sb = 0;
|
|||
bool clear_ser_buffer = false;
|
||||
|
||||
SerialRead::SerialRead()
|
||||
: ThreadController("AUX Serial RX", NORMALPRIO) {
|
||||
: ThreadController("AUX Serial RX", PRIO_AUX_SERIAL) {
|
||||
}
|
||||
|
||||
void SerialRead::ThreadTask() {
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
/**
|
||||
* @file thread_priority.h
|
||||
* @brief This file sets the thread priority for the threads running on rusEFI
|
||||
*
|
||||
* @date February 27, 2021
|
||||
* @author Matthew Kennedy, (c) 2021
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
// ADC and ETB get highest priority - not much else actually runs the engine
|
||||
#define PRIO_ADC (NORMALPRIO + 10)
|
||||
#define PRIO_ETB (NORMALPRIO + 9)
|
||||
|
||||
// GPIO chips should be fast and go right back to sleep, plus can be timing sensitive
|
||||
#define PRIO_GPIOCHIP (NORMALPRIO + 8)
|
||||
|
||||
// TX higher priority than RX because the ECU is generally the one transmitting the highest priority messages
|
||||
#define PRIO_CAN_TX (NORMALPRIO + 7)
|
||||
#define PRIO_CAN_RX (NORMALPRIO + 6)
|
||||
|
||||
// Less critical harware
|
||||
#define PRIO_SERVO (NORMALPRIO + 5)
|
||||
#define PRIO_STEPPER (NORMALPRIO + 5)
|
||||
#define PRIO_CJ125 (NORMALPRIO + 5)
|
||||
|
||||
// Console thread
|
||||
#define PRIO_CONSOLE (NORMALPRIO + 1)
|
||||
|
||||
// Less important things
|
||||
#define PRIO_MMC (NORMALPRIO - 1)
|
||||
|
||||
// These can get starved without too much adverse effect
|
||||
#define PRIO_AUX_SERIAL NORMALPRIO
|
||||
#define PRIO_KNOCK_PROCESS (NORMALPRIO - 10)
|
||||
#define PRIO_HIP9011 (NORMALPRIO - 10)
|
|
@ -36,6 +36,7 @@
|
|||
#include "engine_controller.h"
|
||||
#include "maf.h"
|
||||
#include "perf_trace.h"
|
||||
#include "thread_priority.h"
|
||||
|
||||
static NO_CACHE adcsample_t slowAdcSampleBuf[ADC_BUF_DEPTH_SLOW * ADC_MAX_CHANNELS_COUNT];
|
||||
static NO_CACHE adcsample_t fastAdcSampleBuf[ADC_BUF_DEPTH_FAST * ADC_MAX_CHANNELS_COUNT];
|
||||
|
@ -166,6 +167,7 @@ static ADCConversionGroup adcgrpcfgSlow = {
|
|||
|
||||
AdcDevice slowAdc(&adcgrpcfgSlow, slowAdcSampleBuf, ARRAY_SIZE(slowAdcSampleBuf));
|
||||
|
||||
#if EFI_USE_FAST_ADC
|
||||
void adc_callback_fast(ADCDriver *adcp);
|
||||
|
||||
static ADCConversionGroup adcgrpcfgFast = {
|
||||
|
@ -214,7 +216,6 @@ static ADCConversionGroup adcgrpcfgFast = {
|
|||
|
||||
AdcDevice fastAdc(&adcgrpcfgFast, fastAdcSampleBuf, ARRAY_SIZE(fastAdcSampleBuf));
|
||||
|
||||
#if HAL_USE_GPT
|
||||
static void fast_adc_callback(GPTDriver*) {
|
||||
#if EFI_INTERNAL_ADC
|
||||
/*
|
||||
|
@ -240,7 +241,7 @@ static void fast_adc_callback(GPTDriver*) {
|
|||
fastAdc.conversionCount++;
|
||||
#endif /* EFI_INTERNAL_ADC */
|
||||
}
|
||||
#endif /* HAL_USE_GPT */
|
||||
#endif // EFI_USE_FAST_ADC
|
||||
|
||||
static float mcuTemperature;
|
||||
|
||||
|
@ -259,7 +260,7 @@ int getInternalAdcValue(const char *msg, adc_channel_e hwChannel) {
|
|||
|
||||
#endif /* EFI_ENABLE_MOCK_ADC */
|
||||
|
||||
|
||||
#if EFI_USE_FAST_ADC
|
||||
if (adcHwChannelEnabled[hwChannel] == ADC_FAST) {
|
||||
int internalIndex = fastAdc.internalAdcIndexByHardwareIndex[hwChannel];
|
||||
// todo if ADC_BUF_DEPTH_FAST EQ 1
|
||||
|
@ -267,6 +268,8 @@ int getInternalAdcValue(const char *msg, adc_channel_e hwChannel) {
|
|||
int value = getAvgAdcValue(internalIndex, fastAdc.samples, ADC_BUF_DEPTH_FAST, fastAdc.size());
|
||||
return value;
|
||||
}
|
||||
#endif // EFI_USE_FAST_ADC
|
||||
|
||||
if (adcHwChannelEnabled[hwChannel] != ADC_SLOW) {
|
||||
// todo: make this not happen during hardware continuous integration
|
||||
warning(CUSTOM_OBD_WRONG_ADC_MODE, "ADC is off [%s] index=%d", msg, hwChannel);
|
||||
|
@ -275,21 +278,25 @@ int getInternalAdcValue(const char *msg, adc_channel_e hwChannel) {
|
|||
return slowAdc.getAdcValueByHwChannel(hwChannel);
|
||||
}
|
||||
|
||||
#if HAL_USE_GPT
|
||||
#if EFI_USE_FAST_ADC
|
||||
static GPTConfig fast_adc_config = {
|
||||
GPT_FREQ_FAST,
|
||||
fast_adc_callback,
|
||||
0, 0
|
||||
};
|
||||
#endif /* HAL_USE_GPT */
|
||||
#endif /* EFI_USE_FAST_ADC */
|
||||
|
||||
adc_channel_mode_e getAdcMode(adc_channel_e hwChannel) {
|
||||
if (slowAdc.isHwUsed(hwChannel)) {
|
||||
return ADC_SLOW;
|
||||
}
|
||||
|
||||
#if EFI_USE_FAST_ADC
|
||||
if (fastAdc.isHwUsed(hwChannel)) {
|
||||
return ADC_FAST;
|
||||
}
|
||||
#endif // EFI_USE_FAST_ADC
|
||||
|
||||
return ADC_OFF;
|
||||
}
|
||||
|
||||
|
@ -368,6 +375,7 @@ adc_channel_e AdcDevice::getAdcHardwareIndexByInternalIndex(int index) const {
|
|||
}
|
||||
|
||||
static void printFullAdcReport(Logging *logger) {
|
||||
#if EFI_USE_FAST_ADC
|
||||
scheduleMsg(logger, "fast %d slow %d", fastAdc.conversionCount, slowAdc.conversionCount);
|
||||
|
||||
for (int index = 0; index < fastAdc.size(); index++) {
|
||||
|
@ -389,6 +397,7 @@ static void printFullAdcReport(Logging *logger) {
|
|||
scheduleLogging(logger);
|
||||
}
|
||||
}
|
||||
#endif // EFI_USE_FAST_ADC
|
||||
|
||||
for (int index = 0; index < slowAdc.size(); index++) {
|
||||
appendMsgPrefix(logger);
|
||||
|
@ -436,7 +445,7 @@ int getSlowAdcCounter() {
|
|||
class SlowAdcController : public PeriodicController<256> {
|
||||
public:
|
||||
SlowAdcController()
|
||||
: PeriodicController("ADC", NORMALPRIO + 5, SLOW_ADC_RATE)
|
||||
: PeriodicController("ADC", PRIO_ADC, SLOW_ADC_RATE)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -492,8 +501,15 @@ void addChannel(const char *name, adc_channel_e setting, adc_channel_mode_e mode
|
|||
|
||||
adcHwChannelEnabled[setting] = mode;
|
||||
|
||||
AdcDevice& dev = (mode == ADC_SLOW) ? slowAdc : fastAdc;
|
||||
dev.enableChannelAndPin(name, setting);
|
||||
AdcDevice* dev = &slowAdc;
|
||||
|
||||
#if EFI_USE_FAST_ADC
|
||||
if (mode == ADC_FAST) {
|
||||
dev = &fastAdc;
|
||||
}
|
||||
#endif
|
||||
|
||||
dev->enableChannelAndPin(name, setting);
|
||||
}
|
||||
|
||||
void removeChannel(const char *name, adc_channel_e setting) {
|
||||
|
@ -504,6 +520,9 @@ void removeChannel(const char *name, adc_channel_e setting) {
|
|||
adcHwChannelEnabled[setting] = ADC_OFF;
|
||||
}
|
||||
|
||||
// Weak link a stub so that every board doesn't have to implement this function
|
||||
__attribute__((weak)) void setAdcChannelOverrides() { }
|
||||
|
||||
static void configureInputs(void) {
|
||||
memset(adcHwChannelEnabled, 0, sizeof(adcHwChannelEnabled));
|
||||
|
||||
|
@ -581,14 +600,12 @@ void initAdcInputs() {
|
|||
// Start the slow ADC thread
|
||||
slowAdcController.Start();
|
||||
|
||||
#if EFI_USE_FAST_ADC
|
||||
fastAdc.init();
|
||||
/*
|
||||
* Initializes the PWM driver.
|
||||
*/
|
||||
#if HAL_USE_GPT
|
||||
|
||||
gptStart(EFI_INTERNAL_FAST_ADC_GPT, &fast_adc_config);
|
||||
gptStartContinuous(EFI_INTERNAL_FAST_ADC_GPT, GPT_PERIOD_FAST);
|
||||
#endif /* HAL_USE_GPT */
|
||||
#endif // EFI_USE_FAST_ADC
|
||||
|
||||
addConsoleActionI("adc", (VoidInt) printAdcValue);
|
||||
#else
|
||||
|
@ -602,4 +619,15 @@ void printFullAdcReportIfNeeded(Logging *logger) {
|
|||
printFullAdcReport(logger);
|
||||
}
|
||||
|
||||
#endif /* HAL_USE_ADC */
|
||||
#else /* not HAL_USE_ADC */
|
||||
|
||||
__attribute__((weak)) float getVoltageDivided(const char*, adc_channel_e DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// voltage in MCU universe, from zero to VDD
|
||||
__attribute__((weak)) float getVoltage(const char*, adc_channel_e DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "string.h"
|
||||
#include "mpu_util.h"
|
||||
#include "engine.h"
|
||||
#include "thread_priority.h"
|
||||
|
||||
EXTERN_ENGINE;
|
||||
|
||||
|
@ -83,7 +84,7 @@ static const CANConfig *canConfig = &canConfig500;
|
|||
class CanRead final : public ThreadController<UTILITY_THREAD_STACK_SIZE> {
|
||||
public:
|
||||
CanRead()
|
||||
: ThreadController("CAN RX", NORMALPRIO)
|
||||
: ThreadController("CAN RX", PRIO_CAN_RX)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include "gpio/drv8860.h"
|
||||
#include "pin_repository.h"
|
||||
#include "os_util.h"
|
||||
#include "thread_priority.h"
|
||||
|
||||
#if (BOARD_DRV8860_COUNT > 0)
|
||||
|
||||
|
@ -225,7 +226,7 @@ int drv8860_init(void * data) {
|
|||
|
||||
if (!drv_task_ready) {
|
||||
chThdCreateStatic(drv8860_thread_1_wa, sizeof(drv8860_thread_1_wa),
|
||||
NORMALPRIO + 1, drv8860_driver_thread, NULL);
|
||||
PRIO_GPIOCHIP, drv8860_driver_thread, NULL);
|
||||
drv_task_ready = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "gpio/mc33810.h"
|
||||
#include "pin_repository.h"
|
||||
#include "os_util.h"
|
||||
#include "thread_priority.h"
|
||||
|
||||
#if (BOARD_MC33810_COUNT > 0)
|
||||
|
||||
|
@ -498,7 +499,7 @@ int mc33810_init(void * data)
|
|||
|
||||
if (!drv_task_ready) {
|
||||
chThdCreateStatic(mc33810_thread_1_wa, sizeof(mc33810_thread_1_wa),
|
||||
NORMALPRIO + 1, mc33810_driver_thread, NULL);
|
||||
PRIO_GPIOCHIP, mc33810_driver_thread, NULL);
|
||||
drv_task_ready = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "gpio/gpio_ext.h"
|
||||
#include "gpio/mc33972.h"
|
||||
#include "pin_repository.h"
|
||||
#include "thread_priority.h"
|
||||
|
||||
#if (BOARD_MC33972_COUNT > 0)
|
||||
|
||||
|
@ -304,7 +305,7 @@ static int mc33972_init(void * data)
|
|||
|
||||
if (!drv_task_ready) {
|
||||
chThdCreateStatic(mc33972_thread_1_wa, sizeof(mc33972_thread_1_wa),
|
||||
NORMALPRIO + 1, mc33972_driver_thread, NULL);
|
||||
PRIO_GPIOCHIP, mc33972_driver_thread, NULL);
|
||||
drv_task_ready = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "gpio/tle6240.h"
|
||||
#include "pin_repository.h"
|
||||
#include "os_util.h"
|
||||
#include "thread_priority.h"
|
||||
|
||||
#if (BOARD_TLE6240_COUNT > 0)
|
||||
|
||||
|
@ -450,7 +451,7 @@ static int tle6240_init(void * data)
|
|||
|
||||
if (!drv_task_ready) {
|
||||
chThdCreateStatic(tle6240_thread_1_wa, sizeof(tle6240_thread_1_wa),
|
||||
NORMALPRIO + 1, tle6240_driver_thread, NULL);
|
||||
PRIO_GPIOCHIP, tle6240_driver_thread, NULL);
|
||||
drv_task_ready = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include "pin_repository.h"
|
||||
#include "os_util.h"
|
||||
#include "voltage.h"
|
||||
#include "thread_priority.h"
|
||||
|
||||
EXTERN_ENGINE_CONFIGURATION;
|
||||
|
||||
|
@ -1199,7 +1200,7 @@ static int tle8888_init(void * data)
|
|||
|
||||
/* start thread */
|
||||
chip->thread = chThdCreateStatic(chip->thread_wa, sizeof(chip->thread_wa),
|
||||
NORMALPRIO + 1, tle8888_driver_thread, chip);
|
||||
PRIO_GPIOCHIP, tle8888_driver_thread, chip);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ extern "C" {
|
|||
* 11 to program 64 bits per step
|
||||
*/
|
||||
// Warning, flashdata_t must be unsigned!!!
|
||||
#if defined(STM32F4XX) || defined(STM32F7XX)
|
||||
#if defined(STM32F4XX) || defined(STM32F7XX) || defined(STM32H7XX)
|
||||
#define FLASH_CR_PSIZE_MASK FLASH_CR_PSIZE_0 | FLASH_CR_PSIZE_1
|
||||
#if ((STM32_VDD >= 270) && (STM32_VDD <= 360))
|
||||
#define FLASH_CR_PSIZE_VALUE FLASH_CR_PSIZE_1
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "status_loop.h"
|
||||
#include "buffered_writer.h"
|
||||
#include "null_device.h"
|
||||
#include "thread_priority.h"
|
||||
|
||||
#include "rtc_helper.h"
|
||||
|
||||
|
@ -55,7 +56,6 @@ static int totalSyncCounter = 0;
|
|||
* on't re-read SD card spi device after boot - it could change mid transaction (TS thread could preempt),
|
||||
* which will cause disaster (usually multiple-unlock of the same mutex in UNLOCK_SD_SPI)
|
||||
*/
|
||||
|
||||
spi_device_e mmcSpiDevice = SPI_NONE;
|
||||
|
||||
#define LOG_INDEX_FILENAME "index.txt"
|
||||
|
@ -78,6 +78,7 @@ spi_device_e mmcSpiDevice = SPI_NONE;
|
|||
|
||||
static THD_WORKING_AREA(mmcThreadStack, 3 * UTILITY_THREAD_STACK_SIZE); // MMC monitor thread
|
||||
|
||||
#if HAL_USE_MMC_SPI
|
||||
/**
|
||||
* MMC driver instance.
|
||||
*/
|
||||
|
@ -86,10 +87,15 @@ MMCDriver MMCD1;
|
|||
/* MMC/SD over SPI driver configuration.*/
|
||||
static MMCConfig mmccfg = { NULL, &mmc_ls_spicfg, &mmc_hs_spicfg };
|
||||
|
||||
#define LOCK_SD_SPI lockSpi(mmcSpiDevice)
|
||||
#define UNLOCK_SD_SPI unlockSpi(mmcSpiDevice)
|
||||
|
||||
#endif /* HAL_USE_MMC_SPI */
|
||||
|
||||
/**
|
||||
* fatfs MMC/SPI
|
||||
*/
|
||||
static FATFS MMC_FS;
|
||||
static NO_CACHE FATFS MMC_FS;
|
||||
|
||||
static LoggingWithStorage logger("mmcCard");
|
||||
|
||||
|
@ -138,7 +144,6 @@ static void sdStatistics(void) {
|
|||
}
|
||||
|
||||
static void incLogFileName(void) {
|
||||
LOCK_SD_SPI;
|
||||
memset(&FDCurrFile, 0, sizeof(FIL)); // clear the memory
|
||||
FRESULT err = f_open(&FDCurrFile, LOG_INDEX_FILENAME, FA_READ); // This file has the index for next log file name
|
||||
|
||||
|
@ -170,7 +175,6 @@ static void incLogFileName(void) {
|
|||
f_write(&FDCurrFile, (void*)data, strlen(data), &result);
|
||||
f_close(&FDCurrFile);
|
||||
scheduleMsg(&logger, "Done %d", logFileIndex);
|
||||
UNLOCK_SD_SPI;
|
||||
}
|
||||
|
||||
static void prepareLogFileName(void) {
|
||||
|
@ -200,13 +204,11 @@ static void prepareLogFileName(void) {
|
|||
* so that we can later append to that file
|
||||
*/
|
||||
static void createLogFile(void) {
|
||||
LOCK_SD_SPI;
|
||||
memset(&FDLogFile, 0, sizeof(FIL)); // clear the memory
|
||||
prepareLogFileName();
|
||||
|
||||
FRESULT err = f_open(&FDLogFile, logName, FA_OPEN_ALWAYS | FA_WRITE); // Create new file
|
||||
if (err != FR_OK && err != FR_EXIST) {
|
||||
UNLOCK_SD_SPI;
|
||||
sdStatus = SD_STATE_OPEN_FAILED;
|
||||
warning(CUSTOM_ERR_SD_MOUNT_FAILED, "SD: mount failed");
|
||||
printError("FS mount failed", err); // else - show error
|
||||
|
@ -215,7 +217,6 @@ static void createLogFile(void) {
|
|||
|
||||
err = f_lseek(&FDLogFile, f_size(&FDLogFile)); // Move to end of the file to append data
|
||||
if (err) {
|
||||
UNLOCK_SD_SPI;
|
||||
sdStatus = SD_STATE_SEEK_FAILED;
|
||||
warning(CUSTOM_ERR_SD_SEEK_FAILED, "SD: seek failed");
|
||||
printError("Seek error", err);
|
||||
|
@ -223,7 +224,6 @@ static void createLogFile(void) {
|
|||
}
|
||||
f_sync(&FDLogFile);
|
||||
setSdCardReady(true); // everything Ok
|
||||
UNLOCK_SD_SPI;
|
||||
}
|
||||
|
||||
static void removeFile(const char *pathx) {
|
||||
|
@ -231,10 +231,8 @@ static void removeFile(const char *pathx) {
|
|||
scheduleMsg(&logger, "Error: No File system is mounted");
|
||||
return;
|
||||
}
|
||||
LOCK_SD_SPI;
|
||||
f_unlink(pathx);
|
||||
|
||||
UNLOCK_SD_SPI;
|
||||
f_unlink(pathx);
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -262,14 +260,12 @@ static void listDirectory(const char *path) {
|
|||
scheduleMsg(&logger, "Error: No File system is mounted");
|
||||
return;
|
||||
}
|
||||
LOCK_SD_SPI;
|
||||
|
||||
DIR dir;
|
||||
FRESULT res = f_opendir(&dir, path);
|
||||
|
||||
if (res != FR_OK) {
|
||||
scheduleMsg(&logger, "Error opening directory %s", path);
|
||||
UNLOCK_SD_SPI;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -297,7 +293,6 @@ static void listDirectory(const char *path) {
|
|||
// (fno.fdate >> 5) & 15, fno.fdate & 31, (fno.ftime >> 11), (fno.ftime >> 5) & 63, fno.fsize,
|
||||
// fno.fname);
|
||||
}
|
||||
UNLOCK_SD_SPI;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -310,8 +305,16 @@ static void mmcUnMount(void) {
|
|||
}
|
||||
f_close(&FDLogFile); // close file
|
||||
f_sync(&FDLogFile); // sync ALL
|
||||
|
||||
#if HAL_USE_MMC_SPI
|
||||
mmcDisconnect(&MMCD1); // Brings the driver in a state safe for card removal.
|
||||
mmcStop(&MMCD1); // Disables the MMC peripheral.
|
||||
UNLOCK_SD_SPI;
|
||||
#endif
|
||||
#ifdef EFI_SDC_DEVICE
|
||||
sdcDisconnect(&EFI_SDC_DEVICE);
|
||||
sdcStop(&EFI_SDC_DEVICE);
|
||||
#endif
|
||||
f_mount(NULL, 0, 0); // FATFS: Unregister work area prior to discard it
|
||||
memset(&FDLogFile, 0, sizeof(FIL)); // clear FDLogFile
|
||||
setSdCardReady(false); // status = false
|
||||
|
@ -343,6 +346,7 @@ void onUsbConnectedNotifyMmcI() {
|
|||
|
||||
#endif /* HAL_USE_USB_MSD */
|
||||
|
||||
#if HAL_USE_MMC_SPI
|
||||
/*
|
||||
* Attempts to initialize the MMC card.
|
||||
* Returns a BaseBlockDevice* corresponding to the SD card if successful, otherwise nullptr.
|
||||
|
@ -376,9 +380,32 @@ static BaseBlockDevice* initializeMmcBlockDevice() {
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
UNLOCK_SD_SPI;
|
||||
return (BaseBlockDevice*)&MMCD1;
|
||||
return reinterpret_cast<BaseBlockDevice*>(&MMCD1);
|
||||
}
|
||||
#endif /* HAL_USE_MMC_SPI */
|
||||
|
||||
// Some ECUs are wired for SDIO/SDMMC instead of SPI
|
||||
#ifdef EFI_SDC_DEVICE
|
||||
static const SDCConfig sdcConfig = {
|
||||
SDC_MODE_4BIT
|
||||
};
|
||||
|
||||
static BaseBlockDevice* initializeMmcBlockDevice() {
|
||||
if (!CONFIG(isSdCardEnabled)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
sdcStart(&EFI_SDC_DEVICE, &sdcConfig);
|
||||
sdStatus = SD_STATE_CONNECTING;
|
||||
if (sdcConnect(&EFI_SDC_DEVICE) != HAL_SUCCESS) {
|
||||
sdStatus = SD_STATE_NOT_CONNECTED;
|
||||
warning(CUSTOM_OBD_MMC_ERROR, "Can't connect or mount MMC/SD");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return reinterpret_cast<BaseBlockDevice*>(&EFI_SDC_DEVICE);
|
||||
}
|
||||
#endif /* EFI_SDC_DEVICE */
|
||||
|
||||
// Initialize and mount the SD card.
|
||||
// Returns true if the filesystem was successfully mounted for writing.
|
||||
|
@ -435,7 +462,6 @@ struct SdLogBufferWriter final : public BufferedWriter<512> {
|
|||
|
||||
totalLoggedBytes += count;
|
||||
|
||||
LOCK_SD_SPI;
|
||||
FRESULT err = f_write(&FDLogFile, buffer, count, &bytesWritten);
|
||||
|
||||
if (bytesWritten != count) {
|
||||
|
@ -443,7 +469,6 @@ struct SdLogBufferWriter final : public BufferedWriter<512> {
|
|||
|
||||
// Close file and unmount volume
|
||||
mmcUnMount();
|
||||
UNLOCK_SD_SPI;
|
||||
failed = true;
|
||||
return 0;
|
||||
} else {
|
||||
|
@ -460,7 +485,6 @@ struct SdLogBufferWriter final : public BufferedWriter<512> {
|
|||
}
|
||||
}
|
||||
|
||||
UNLOCK_SD_SPI;
|
||||
return bytesWritten;
|
||||
}
|
||||
};
|
||||
|
@ -514,7 +538,7 @@ void initMmcCard(void) {
|
|||
chBSemObjectInit(&usbConnectedSemaphore, true);
|
||||
#endif
|
||||
|
||||
chThdCreateStatic(mmcThreadStack, sizeof(mmcThreadStack), LOWPRIO, (tfunc_t)(void*) MMCmonThread, NULL);
|
||||
chThdCreateStatic(mmcThreadStack, sizeof(mmcThreadStack), PRIO_MMC, (tfunc_t)(void*) MMCmonThread, NULL);
|
||||
|
||||
addConsoleAction("sdinfo", sdStatistics);
|
||||
addConsoleActionS("ls", listDirectory);
|
||||
|
|
|
@ -23,10 +23,6 @@ void readLogFileContent(char *buffer, short fileId, short offset, short length);
|
|||
void handleTsR(TsChannelBase* tsChannel, char *input);
|
||||
void handleTsW(TsChannelBase* tsChannel, char *input);
|
||||
|
||||
extern spi_device_e mmcSpiDevice;
|
||||
#define LOCK_SD_SPI lockSpi(mmcSpiDevice)
|
||||
#define UNLOCK_SD_SPI unlockSpi(mmcSpiDevice)
|
||||
|
||||
extern "C"
|
||||
#endif
|
||||
void onUsbConnectedNotifyMmcI(void);
|
||||
|
|
|
@ -164,12 +164,10 @@ void handleTsR(TsChannelBase* tsChannel, char *input) {
|
|||
#endif // EFI_SIMULATOR
|
||||
|
||||
#if EFI_FILE_LOGGING
|
||||
LOCK_SD_SPI;
|
||||
DIR dir;
|
||||
FRESULT res = f_opendir(&dir, ROOT_DIR);
|
||||
if (res != FR_OK) {
|
||||
scheduleMsg(&sharedLogger, "Error opening directory");
|
||||
UNLOCK_SD_SPI;
|
||||
} else {
|
||||
int index = 0;
|
||||
while (true) {
|
||||
|
@ -203,7 +201,6 @@ void handleTsR(TsChannelBase* tsChannel, char *input) {
|
|||
}
|
||||
|
||||
}
|
||||
UNLOCK_SD_SPI;
|
||||
}
|
||||
|
||||
#endif // EFI_FILE_LOGGING
|
||||
|
@ -227,10 +224,8 @@ void handleTsR(TsChannelBase* tsChannel, char *input) {
|
|||
#endif // EFI_SIMULATOR
|
||||
|
||||
#if EFI_FILE_LOGGING
|
||||
LOCK_SD_SPI;
|
||||
got = 0;
|
||||
f_read(&uploading, (void*) &buffer[2], TRANSFER_SIZE, (UINT*) &got);
|
||||
UNLOCK_SD_SPI;
|
||||
#endif // EFI_FILE_LOGGING
|
||||
|
||||
tsChannel->sendResponse(TS_CRC, buffer, 2 + got);
|
||||
|
@ -281,7 +276,6 @@ void handleTsW(TsChannelBase* tsChannel, char *input) {
|
|||
#endif // EFI_SIMULATOR
|
||||
|
||||
#if EFI_FILE_LOGGING
|
||||
LOCK_SD_SPI;
|
||||
DIR dir;
|
||||
FRESULT res = f_opendir(&dir, ROOT_DIR);
|
||||
if (res != FR_OK) {
|
||||
|
@ -304,7 +298,6 @@ void handleTsW(TsChannelBase* tsChannel, char *input) {
|
|||
}
|
||||
}
|
||||
}
|
||||
UNLOCK_SD_SPI;
|
||||
#endif // EFI_FILE_LOGGING
|
||||
|
||||
sendOkResponse(tsChannel, TS_CRC);
|
||||
|
@ -340,14 +333,11 @@ void handleTsW(TsChannelBase* tsChannel, char *input) {
|
|||
#endif // EFI_SIMULATOR
|
||||
|
||||
#if EFI_FILE_LOGGING
|
||||
LOCK_SD_SPI;
|
||||
|
||||
DIR dir;
|
||||
FRESULT res = f_opendir(&dir, ROOT_DIR);
|
||||
|
||||
if (res != FR_OK) {
|
||||
scheduleMsg(&sharedLogger, "Error opening directory");
|
||||
UNLOCK_SD_SPI;
|
||||
} else {
|
||||
memset(&uploading, 0, sizeof(FIL)); // clear the memory
|
||||
while (true) {
|
||||
|
@ -366,7 +356,6 @@ void handleTsW(TsChannelBase* tsChannel, char *input) {
|
|||
}
|
||||
}
|
||||
}
|
||||
UNLOCK_SD_SPI;
|
||||
}
|
||||
|
||||
#endif // EFI_FILE_LOGGING
|
||||
|
|
|
@ -13,8 +13,20 @@
|
|||
#define HAL_USE_USB EFI_USB_SERIAL
|
||||
#define HAL_USE_SERIAL_USB EFI_USB_SERIAL
|
||||
|
||||
// If EFI_FILE_LOGGING, enable MMC SPI driver
|
||||
#define HAL_USE_MMC_SPI EFI_FILE_LOGGING
|
||||
// If EFI_FILE_LOGGING and SDC, enable SDIO/SDMMC driver
|
||||
#if defined(EFI_SDC_DEVICE) && EFI_FILE_LOGGING
|
||||
#define HAL_USE_SDC TRUE
|
||||
#define FATFS_HAL_DEVICE EFI_SDC_DEVICE
|
||||
#else
|
||||
#define HAL_USE_SDC FALSE
|
||||
#endif
|
||||
|
||||
// If EFI_FILE_LOGGING but not SDC, use SPI instead
|
||||
#if !defined(EFI_SDC_DEVICE) && EFI_FILE_LOGGING
|
||||
#define HAL_USE_MMC_SPI TRUE
|
||||
#else
|
||||
#define HAL_USE_MMC_SPI FALSE
|
||||
#endif
|
||||
|
||||
// If USB and File logging, enable USB Mass Storage & community
|
||||
#define HAL_USE_USB_MSD (EFI_FILE_LOGGING && EFI_USB_SERIAL)
|
||||
|
|
|
@ -15,6 +15,30 @@
|
|||
#include "flash_int.h"
|
||||
#include <string.h>
|
||||
|
||||
#ifdef STM32H7XX
|
||||
// Use bank 2 on H7
|
||||
#define FLASH_CR FLASH->CR2
|
||||
#define FLASH_SR FLASH->SR2
|
||||
#define FLASH_KEYR FLASH->KEYR2
|
||||
|
||||
// I have no idea why ST changed the register name from STRT -> START
|
||||
#define FLASH_CR_STRT FLASH_CR_START
|
||||
|
||||
#undef FLASH_BASE
|
||||
// This is the start of the second bank, since H7 sector numbers are bank relative
|
||||
#define FLASH_BASE 0x08100000
|
||||
|
||||
// QW bit supercedes the older BSY bit
|
||||
#define intFlashWaitWhileBusy() { while (FLASH_SR & FLASH_SR_QW) {} }
|
||||
#else
|
||||
#define FLASH_CR FLASH->CR
|
||||
#define FLASH_SR FLASH->SR
|
||||
#define FLASH_KEYR FLASH->KEYR
|
||||
|
||||
// Wait for the flash operation to finish
|
||||
#define intFlashWaitWhileBusy() { while (FLASH->SR & FLASH_SR_BSY) {} }
|
||||
#endif
|
||||
|
||||
flashaddr_t intFlashSectorBegin(flashsector_t sector) {
|
||||
flashaddr_t address = FLASH_BASE;
|
||||
while (sector > 0) {
|
||||
|
@ -35,11 +59,6 @@ flashsector_t intFlashSectorAt(flashaddr_t address) {
|
|||
return sector;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Wait for the flash operation to finish.
|
||||
*/
|
||||
#define intFlashWaitWhileBusy() { while (FLASH->SR & FLASH_SR_BSY) {} }
|
||||
|
||||
/**
|
||||
* @brief Unlock the flash memory for write access.
|
||||
* @return HAL_SUCCESS Unlock was successful.
|
||||
|
@ -47,15 +66,15 @@ flashsector_t intFlashSectorAt(flashaddr_t address) {
|
|||
*/
|
||||
static bool intFlashUnlock(void) {
|
||||
/* Check if unlock is really needed */
|
||||
if (!(FLASH->CR & FLASH_CR_LOCK))
|
||||
if (!(FLASH_CR & FLASH_CR_LOCK))
|
||||
return HAL_SUCCESS;
|
||||
|
||||
/* Write magic unlock sequence */
|
||||
FLASH->KEYR = 0x45670123;
|
||||
FLASH->KEYR = 0xCDEF89AB;
|
||||
FLASH_KEYR = 0x45670123;
|
||||
FLASH_KEYR = 0xCDEF89AB;
|
||||
|
||||
/* Check if unlock was successful */
|
||||
if (FLASH->CR & FLASH_CR_LOCK)
|
||||
if (FLASH_CR & FLASH_CR_LOCK)
|
||||
return HAL_FAILED;
|
||||
return HAL_SUCCESS;
|
||||
}
|
||||
|
@ -63,7 +82,7 @@ static bool intFlashUnlock(void) {
|
|||
/**
|
||||
* @brief Lock the flash memory for write access.
|
||||
*/
|
||||
#define intFlashLock() { FLASH->CR |= FLASH_CR_LOCK; }
|
||||
#define intFlashLock() { FLASH_CR |= FLASH_CR_LOCK; }
|
||||
|
||||
int intFlashSectorErase(flashsector_t sector) {
|
||||
/* Unlock flash for write access */
|
||||
|
@ -74,8 +93,8 @@ int intFlashSectorErase(flashsector_t sector) {
|
|||
intFlashWaitWhileBusy();
|
||||
|
||||
/* Setup parallelism before any program/erase */
|
||||
FLASH->CR &= ~FLASH_CR_PSIZE_MASK;
|
||||
FLASH->CR |= FLASH_CR_PSIZE_VALUE;
|
||||
FLASH_CR &= ~FLASH_CR_PSIZE_MASK;
|
||||
FLASH_CR |= FLASH_CR_PSIZE_VALUE;
|
||||
|
||||
/* Start deletion of sector.
|
||||
* SNB(4:1) is defined as:
|
||||
|
@ -87,31 +106,35 @@ int intFlashSectorErase(flashsector_t sector) {
|
|||
* ...
|
||||
* 10111 sector 23 (the end of 2nd bank, 2Mb border)
|
||||
* others not allowed */
|
||||
#ifndef FLASH_CR_SNB_4
|
||||
FLASH->CR &= ~(FLASH_CR_SNB_0 | FLASH_CR_SNB_1 | FLASH_CR_SNB_2 | FLASH_CR_SNB_3);
|
||||
#ifndef FLASH_CR_SNB_3
|
||||
FLASH_CR &= ~(FLASH_CR_SNB_0 | FLASH_CR_SNB_1 | FLASH_CR_SNB_2);
|
||||
#elif !defined(FLASH_CR_SNB_4)
|
||||
FLASH_CR &= ~(FLASH_CR_SNB_0 | FLASH_CR_SNB_1 | FLASH_CR_SNB_2 | FLASH_CR_SNB_3);
|
||||
#else
|
||||
FLASH->CR &= ~(FLASH_CR_SNB_0 | FLASH_CR_SNB_1 | FLASH_CR_SNB_2 | FLASH_CR_SNB_3 | FLASH_CR_SNB_4);
|
||||
FLASH_CR &= ~(FLASH_CR_SNB_0 | FLASH_CR_SNB_1 | FLASH_CR_SNB_2 | FLASH_CR_SNB_3 | FLASH_CR_SNB_4);
|
||||
#endif
|
||||
if (sector & 0x1)
|
||||
FLASH->CR |= FLASH_CR_SNB_0;
|
||||
FLASH_CR |= FLASH_CR_SNB_0;
|
||||
if (sector & 0x2)
|
||||
FLASH->CR |= FLASH_CR_SNB_1;
|
||||
FLASH_CR |= FLASH_CR_SNB_1;
|
||||
if (sector & 0x4)
|
||||
FLASH->CR |= FLASH_CR_SNB_2;
|
||||
FLASH_CR |= FLASH_CR_SNB_2;
|
||||
#ifdef FLASH_CR_SNB_4
|
||||
if (sector & 0x8)
|
||||
FLASH->CR |= FLASH_CR_SNB_3;
|
||||
FLASH_CR |= FLASH_CR_SNB_3;
|
||||
#endif
|
||||
#ifdef FLASH_CR_SNB_4
|
||||
if (sector & 0x10)
|
||||
FLASH->CR |= FLASH_CR_SNB_4;
|
||||
FLASH_CR |= FLASH_CR_SNB_4;
|
||||
#endif
|
||||
FLASH->CR |= FLASH_CR_SER;
|
||||
FLASH->CR |= FLASH_CR_STRT;
|
||||
FLASH_CR |= FLASH_CR_SER;
|
||||
FLASH_CR |= FLASH_CR_STRT;
|
||||
|
||||
/* Wait until it's finished. */
|
||||
intFlashWaitWhileBusy();
|
||||
|
||||
/* Sector erase flag does not clear automatically. */
|
||||
FLASH->CR &= ~FLASH_CR_SER;
|
||||
FLASH_CR &= ~FLASH_CR_SER;
|
||||
|
||||
/* Lock flash again */
|
||||
intFlashLock()
|
||||
|
@ -187,6 +210,61 @@ int intFlashRead(flashaddr_t address, char* buffer, size_t size) {
|
|||
return FLASH_RETURN_SUCCESS;
|
||||
}
|
||||
|
||||
#ifdef STM32H7XX
|
||||
int intFlashWrite(flashaddr_t address, const char* buffer, size_t size) {
|
||||
/* Unlock flash for write access */
|
||||
if (intFlashUnlock() == HAL_FAILED)
|
||||
return FLASH_RETURN_NO_PERMISSION;
|
||||
|
||||
/* Wait for any busy flags */
|
||||
intFlashWaitWhileBusy();
|
||||
|
||||
/* Setup parallelism before program */
|
||||
FLASH_CR &= ~FLASH_CR_PSIZE_MASK;
|
||||
FLASH_CR |= FLASH_CR_PSIZE_VALUE;
|
||||
|
||||
// Round up to the next number of full 32 byte words
|
||||
size_t flashWordCount = (size - 1) / 32 + 1;
|
||||
|
||||
// Read units of flashdata_t from the buffer, writing to flash
|
||||
const flashdata_t* pRead = (const flashdata_t*)buffer;
|
||||
flashdata_t* pWrite = (flashdata_t*)address;
|
||||
|
||||
for (size_t word = 0; word < flashWordCount; word++) {
|
||||
/* Enter flash programming mode */
|
||||
FLASH_CR |= FLASH_CR_PG;
|
||||
|
||||
// Flush pipelines
|
||||
__ISB();
|
||||
__DSB();
|
||||
|
||||
// Write 32 bytes
|
||||
for (size_t i = 0; i < 8; i++) {
|
||||
*pWrite++ = *pRead++;
|
||||
}
|
||||
|
||||
// Flush pipelines
|
||||
__ISB();
|
||||
__DSB();
|
||||
|
||||
/* Wait for completion */
|
||||
intFlashWaitWhileBusy();
|
||||
|
||||
/* Exit flash programming mode */
|
||||
FLASH_CR &= ~FLASH_CR_PG;
|
||||
|
||||
// Flush pipelines
|
||||
__ISB();
|
||||
__DSB();
|
||||
}
|
||||
|
||||
/* Lock flash again */
|
||||
intFlashLock();
|
||||
|
||||
return FLASH_RETURN_SUCCESS;
|
||||
}
|
||||
|
||||
#else // not STM32H7XX
|
||||
static void intFlashWriteData(flashaddr_t address, const flashdata_t data) {
|
||||
/* Enter flash programming mode */
|
||||
FLASH->CR |= FLASH_CR_PG;
|
||||
|
@ -276,5 +354,6 @@ int intFlashWrite(flashaddr_t address, const char* buffer, size_t size) {
|
|||
|
||||
return FLASH_RETURN_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* EFI_INTERNAL_FLASH */
|
||||
|
|
|
@ -314,7 +314,6 @@
|
|||
#define STM32_USB_OTG2_IRQ_PRIORITY 14
|
||||
#define STM32_USB_OTG1_RX_FIFO_SIZE 512
|
||||
#define STM32_USB_OTG2_RX_FIFO_SIZE 1024
|
||||
#define STM32_USB_OTG_THREAD_PRIO LOWPRIO
|
||||
#define STM32_USB_OTG_THREAD_STACK_SIZE 1024
|
||||
#define STM32_USB_OTGFIFO_FILL_BASEPRI 0
|
||||
|
||||
|
|
|
@ -17,8 +17,10 @@ void portInitAdc() {
|
|||
// Init slow ADC
|
||||
adcStart(&ADCD1, NULL);
|
||||
|
||||
#if EFI_USE_FAST_ADC
|
||||
// Init fast ADC (MAP sensor)
|
||||
adcStart(&ADCD2, NULL);
|
||||
#endif
|
||||
|
||||
// Enable internal temperature reference
|
||||
adcSTM32EnableTSVREFE(); // Internal temperature sensor
|
||||
|
|
|
@ -750,8 +750,6 @@
|
|||
/* Port-specific settings (override port settings defaulted in chcore.h). */
|
||||
/*===========================================================================*/
|
||||
|
||||
#define CORTEX_VTOR_INIT 0x00200000U
|
||||
|
||||
/**
|
||||
* @brief Sleep at idle.
|
||||
* @details This option enables call to __WFI() from idle thread to save power.
|
||||
|
|
|
@ -145,13 +145,17 @@
|
|||
* SDC driver system settings.
|
||||
*/
|
||||
#define STM32_SDC_USE_SDMMC1 FALSE
|
||||
#define STM32_SDC_USE_SDMMC2 TRUE
|
||||
#define STM32_SDC_SDMMC_UNALIGNED_SUPPORT TRUE
|
||||
#define STM32_SDC_SDMMC_WRITE_TIMEOUT 1000
|
||||
#define STM32_SDC_SDMMC_READ_TIMEOUT 1000
|
||||
#define STM32_SDC_SDMMC_CLOCK_DELAY 10
|
||||
#define STM32_SDC_SDMMC1_DMA_STREAM STM32_DMA_STREAM_ID(2, 3)
|
||||
#define STM32_SDC_SDMMC2_DMA_STREAM STM32_DMA_STREAM_ID(2, 0)
|
||||
#define STM32_SDC_SDMMC1_DMA_PRIORITY 3
|
||||
#define STM32_SDC_SDMMC2_DMA_PRIORITY 3
|
||||
#define STM32_SDC_SDMMC1_IRQ_PRIORITY 9
|
||||
#define STM32_SDC_SDMMC2_IRQ_PRIORITY 9
|
||||
|
||||
#include "mcuconf_common_f4_f7.h"
|
||||
|
||||
|
|
|
@ -76,6 +76,12 @@
|
|||
#define STM32_HSE_BYPASS
|
||||
#endif /* EFI_USE_OSC */
|
||||
|
||||
/*
|
||||
* Board voltages.
|
||||
* Required for performance limits calculation.
|
||||
*/
|
||||
#define STM32_VDD 330U
|
||||
|
||||
/*
|
||||
* MCU type as defined in the ST header.
|
||||
*/
|
||||
|
|
|
@ -31,6 +31,8 @@
|
|||
#define _CHIBIOS_RT_CONF_
|
||||
#define _CHIBIOS_RT_CONF_VER_6_1_
|
||||
|
||||
#include "chconf_common.h"
|
||||
|
||||
/*===========================================================================*/
|
||||
/**
|
||||
* @name System timers settings
|
||||
|
@ -38,8 +40,6 @@
|
|||
*/
|
||||
/*===========================================================================*/
|
||||
|
||||
#include "chconf_common.h"
|
||||
|
||||
/**
|
||||
* @brief System time counter resolution.
|
||||
* @note Allowed values are 16, 32 or 64 bits.
|
||||
|
@ -54,7 +54,7 @@
|
|||
* setting also defines the system tick time unit.
|
||||
*/
|
||||
#if !defined(CH_CFG_ST_FREQUENCY)
|
||||
#define CH_CFG_ST_FREQUENCY 10000
|
||||
#define CH_CFG_ST_FREQUENCY 1000
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -308,7 +308,7 @@
|
|||
* @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS.
|
||||
*/
|
||||
#if !defined(CH_CFG_USE_DYNAMIC)
|
||||
#define CH_CFG_USE_DYNAMIC TRUE
|
||||
#define CH_CFG_USE_DYNAMIC FALSE
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
@ -329,7 +329,7 @@
|
|||
* @note Requires @p CH_CFG_USE_SEMAPHORES.
|
||||
*/
|
||||
#if !defined(CH_CFG_USE_MAILBOXES)
|
||||
#define CH_CFG_USE_MAILBOXES TRUE
|
||||
#define CH_CFG_USE_MAILBOXES FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -340,7 +340,7 @@
|
|||
* @note The default is @p TRUE.
|
||||
*/
|
||||
#if !defined(CH_CFG_USE_MEMCORE)
|
||||
#define CH_CFG_USE_MEMCORE TRUE
|
||||
#define CH_CFG_USE_MEMCORE FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -369,7 +369,7 @@
|
|||
* @note Mutexes are recommended.
|
||||
*/
|
||||
#if !defined(CH_CFG_USE_HEAP)
|
||||
#define CH_CFG_USE_HEAP TRUE
|
||||
#define CH_CFG_USE_HEAP FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -380,7 +380,7 @@
|
|||
* @note The default is @p TRUE.
|
||||
*/
|
||||
#if !defined(CH_CFG_USE_MEMPOOLS)
|
||||
#define CH_CFG_USE_MEMPOOLS TRUE
|
||||
#define CH_CFG_USE_MEMPOOLS FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -391,7 +391,7 @@
|
|||
* @note The default is @p TRUE.
|
||||
*/
|
||||
#if !defined(CH_CFG_USE_OBJ_FIFOS)
|
||||
#define CH_CFG_USE_OBJ_FIFOS TRUE
|
||||
#define CH_CFG_USE_OBJ_FIFOS FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -402,7 +402,7 @@
|
|||
* @note The default is @p TRUE.
|
||||
*/
|
||||
#if !defined(CH_CFG_USE_PIPES)
|
||||
#define CH_CFG_USE_PIPES TRUE
|
||||
#define CH_CFG_USE_PIPES FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -413,7 +413,7 @@
|
|||
* @note The default is @p TRUE.
|
||||
*/
|
||||
#if !defined(CH_CFG_USE_OBJ_CACHES)
|
||||
#define CH_CFG_USE_OBJ_CACHES TRUE
|
||||
#define CH_CFG_USE_OBJ_CACHES FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -424,7 +424,7 @@
|
|||
* @note The default is @p TRUE.
|
||||
*/
|
||||
#if !defined(CH_CFG_USE_DELEGATES)
|
||||
#define CH_CFG_USE_DELEGATES TRUE
|
||||
#define CH_CFG_USE_DELEGATES FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -435,7 +435,7 @@
|
|||
* @note The default is @p TRUE.
|
||||
*/
|
||||
#if !defined(CH_CFG_USE_JOBS)
|
||||
#define CH_CFG_USE_JOBS TRUE
|
||||
#define CH_CFG_USE_JOBS FALSE
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
@ -455,7 +455,7 @@
|
|||
* @note The default is @p FALSE.
|
||||
*/
|
||||
#if !defined(CH_CFG_USE_FACTORY)
|
||||
#define CH_CFG_USE_FACTORY TRUE
|
||||
#define CH_CFG_USE_FACTORY FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -471,42 +471,42 @@
|
|||
* @brief Enables the registry of generic objects.
|
||||
*/
|
||||
#if !defined(CH_CFG_FACTORY_OBJECTS_REGISTRY)
|
||||
#define CH_CFG_FACTORY_OBJECTS_REGISTRY TRUE
|
||||
#define CH_CFG_FACTORY_OBJECTS_REGISTRY FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables factory for generic buffers.
|
||||
*/
|
||||
#if !defined(CH_CFG_FACTORY_GENERIC_BUFFERS)
|
||||
#define CH_CFG_FACTORY_GENERIC_BUFFERS TRUE
|
||||
#define CH_CFG_FACTORY_GENERIC_BUFFERS FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables factory for semaphores.
|
||||
*/
|
||||
#if !defined(CH_CFG_FACTORY_SEMAPHORES)
|
||||
#define CH_CFG_FACTORY_SEMAPHORES TRUE
|
||||
#define CH_CFG_FACTORY_SEMAPHORES FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables factory for mailboxes.
|
||||
*/
|
||||
#if !defined(CH_CFG_FACTORY_MAILBOXES)
|
||||
#define CH_CFG_FACTORY_MAILBOXES TRUE
|
||||
#define CH_CFG_FACTORY_MAILBOXES FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables factory for objects FIFOs.
|
||||
*/
|
||||
#if !defined(CH_CFG_FACTORY_OBJ_FIFOS)
|
||||
#define CH_CFG_FACTORY_OBJ_FIFOS TRUE
|
||||
#define CH_CFG_FACTORY_OBJ_FIFOS FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables factory for Pipes.
|
||||
*/
|
||||
#if !defined(CH_CFG_FACTORY_PIPES) || defined(__DOXYGEN__)
|
||||
#define CH_CFG_FACTORY_PIPES TRUE
|
||||
#define CH_CFG_FACTORY_PIPES FALSE
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
@ -568,7 +568,7 @@
|
|||
* @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
|
||||
*/
|
||||
#if !defined(CH_DBG_TRACE_MASK)
|
||||
#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_NONE
|
||||
#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -591,7 +591,7 @@
|
|||
* @p panic_msg variable set to @p NULL.
|
||||
*/
|
||||
#if !defined(CH_DBG_ENABLE_STACK_CHECK)
|
||||
#define CH_DBG_ENABLE_STACK_CHECK FALSE
|
||||
#define CH_DBG_ENABLE_STACK_CHECK TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -602,8 +602,9 @@
|
|||
*
|
||||
* @note The default is @p FALSE.
|
||||
*/
|
||||
// see also CH_DBG_STACK_FILL_VALUE
|
||||
#if !defined(CH_DBG_FILL_THREADS)
|
||||
#define CH_DBG_FILL_THREADS FALSE
|
||||
#define CH_DBG_FILL_THREADS TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -616,7 +617,7 @@
|
|||
* tickless mode.
|
||||
*/
|
||||
#if !defined(CH_DBG_THREADS_PROFILING)
|
||||
#define CH_DBG_THREADS_PROFILING FALSE
|
||||
#define CH_DBG_THREADS_PROFILING TRUE
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
@ -696,6 +697,7 @@
|
|||
*/
|
||||
#define CH_CFG_SYSTEM_HALT_HOOK(reason) { \
|
||||
/* System halt code here.*/ \
|
||||
chDbgPanic3(reason, __FILE__, __LINE__); \
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1 +1,22 @@
|
|||
/**
|
||||
* @file mpu_util.cpp
|
||||
*
|
||||
* @date Feb 26, 2021
|
||||
* @author Matthew Kennedy, (c) 2021
|
||||
*/
|
||||
|
||||
#include "flash_int.h"
|
||||
|
||||
size_t flashSectorSize(flashsector_t sector) {
|
||||
// All sectors on H7 are 128k
|
||||
return 128 * 1024;
|
||||
}
|
||||
|
||||
uintptr_t getFlashAddrFirstCopy() {
|
||||
return 0x08100000;
|
||||
}
|
||||
|
||||
uintptr_t getFlashAddrSecondCopy() {
|
||||
// Second copy is one sector past the first
|
||||
return getFlashAddrFirstCopy() + 128 * 1024;
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "cj125.h"
|
||||
#include "pwm_generator_logic.h"
|
||||
#include "rpm_calculator.h"
|
||||
#include "thread_priority.h"
|
||||
|
||||
EXTERN_ENGINE;
|
||||
|
||||
|
@ -647,7 +648,7 @@ void initCJ125(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
|||
addConsoleAction("cj125_restart", cjRestart);
|
||||
addConsoleAction("cj125_calibrate", cjStartCalibration);
|
||||
|
||||
chThdCreateStatic(cj125ThreadStack, sizeof(cj125ThreadStack), LOWPRIO, (tfunc_t)(void*) cjThread, NULL);
|
||||
chThdCreateStatic(cj125ThreadStack, sizeof(cj125ThreadStack), PRIO_CJ125, (tfunc_t)(void*) cjThread, NULL);
|
||||
#endif /* ! EFI_UNIT_TEST */
|
||||
}
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
#include "hip9011.h"
|
||||
#include "adc_inputs.h"
|
||||
#include "perf_trace.h"
|
||||
#include "thread_priority.h"
|
||||
|
||||
#include "engine_controller.h"
|
||||
|
||||
|
@ -55,11 +56,6 @@
|
|||
|
||||
static NamedOutputPin intHold(PROTOCOL_HIP_NAME);
|
||||
|
||||
extern uint32_t lastExecutionCount;
|
||||
|
||||
uint32_t hipLastExecutionCount;
|
||||
|
||||
|
||||
class Hip9011Hardware : public Hip9011HardwareInterface {
|
||||
void sendSyncCommand(unsigned char command) override;
|
||||
void sendCommand(unsigned char command) override;
|
||||
|
@ -190,7 +186,7 @@ void setHip9011FrankensoPinout(void) {
|
|||
// CONFIG(hip9011CsPin) = GPIOD_0; // rev 0.1
|
||||
|
||||
CONFIG(isHip9011Enabled) = true;
|
||||
engineConfiguration->hip9011PrescalerAndSDO = _8MHZ_PRESCALER; // 8MHz chip
|
||||
engineConfiguration->hip9011PrescalerAndSDO = HIP_8MHZ_PRESCALER; // 8MHz chip
|
||||
CONFIG(is_enabled_spi_2) = true;
|
||||
// todo: convert this to rusEfi, hardware-independent enum
|
||||
#if EFI_PROD_CODE
|
||||
|
@ -260,9 +256,6 @@ void intHoldCallback(trigger_event_e ckpEventType, uint32_t index, efitick_t edg
|
|||
// todo: schedule this based on closest trigger event, same as ignition works
|
||||
scheduleByAngle(&startTimer[structIndex], edgeTimestamp, engineConfiguration->knockDetectionWindowStart,
|
||||
&startIntegration);
|
||||
#if EFI_PROD_CODE
|
||||
hipLastExecutionCount = lastExecutionCount;
|
||||
#endif /* EFI_PROD_CODE */
|
||||
scheduleByAngle(&endTimer[structIndex], edgeTimestamp, engineConfiguration->knockDetectionWindowEnd,
|
||||
&endIntegration);
|
||||
}
|
||||
|
@ -315,29 +308,14 @@ void hipAdcCallback(adcsample_t adcValue) {
|
|||
}
|
||||
|
||||
static void hipStartupCode(void) {
|
||||
// D[4:1] = 0000 : 4 MHz
|
||||
// D[4:1] = 0001 : 5 MHz
|
||||
// D[4:1] = 0010 : 6 MHz
|
||||
// D[4:1] = 0011 ; 8 MHz
|
||||
// D[4:1] = 0100 ; 10 MHz
|
||||
// D[4:1] = 0101 ; 12 MHz
|
||||
// D[4:1] = 0110 : 16 MHz
|
||||
// D[4:1] = 0111 : 20 MHz
|
||||
// D[4:1] = 1000 : 24 MHz
|
||||
|
||||
|
||||
// 0 for 4MHz
|
||||
// 6 for 8 MHz
|
||||
instance.currentPrescaler = engineConfiguration->hip9011PrescalerAndSDO;
|
||||
instance.hardware->sendSyncCommand(SET_PRESCALER_CMD + instance.currentPrescaler);
|
||||
|
||||
instance.hardware->sendSyncCommand(SET_PRESCALER_CMD(instance.currentPrescaler));
|
||||
|
||||
// '0' for channel #1
|
||||
instance.hardware->sendSyncCommand(SET_CHANNEL_CMD + 0);
|
||||
instance.hardware->sendSyncCommand(SET_CHANNEL_CMD(0));
|
||||
|
||||
// band index depends on cylinder bore
|
||||
instance.hardware->sendSyncCommand(SET_BAND_PASS_CMD + instance.currentBandIndex);
|
||||
|
||||
instance.hardware->sendSyncCommand(SET_BAND_PASS_CMD(instance.currentBandIndex));
|
||||
|
||||
if (instance.correctResponsesCount == 0) {
|
||||
warning(CUSTOM_OBD_KNOCK_PROCESSOR, "TPIC/HIP does not respond");
|
||||
|
@ -345,7 +323,7 @@ static void hipStartupCode(void) {
|
|||
|
||||
if (CONFIG(useTpicAdvancedMode)) {
|
||||
// enable advanced mode for digital integrator output
|
||||
instance.hardware->sendSyncCommand(SET_ADVANCED_MODE);
|
||||
instance.hardware->sendSyncCommand(SET_ADVANCED_MODE_CMD);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -431,7 +409,7 @@ void initHip9011(Logging *sharedLogger) {
|
|||
addConsoleActionI("set_hip_prescalerandsdo", setPrescalerAndSDO);
|
||||
addConsoleActionF("set_knock_threshold", setKnockThresh);
|
||||
addConsoleActionI("set_max_knock_sub_deg", setMaxKnockSubDeg);
|
||||
chThdCreateStatic(hipThreadStack, sizeof(hipThreadStack), NORMALPRIO, (tfunc_t)(void*) hipThread, NULL);
|
||||
chThdCreateStatic(hipThreadStack, sizeof(hipThreadStack), PRIO_HIP9011, (tfunc_t)(void*) hipThread, NULL);
|
||||
}
|
||||
|
||||
#endif /* EFI_HIP_9011 */
|
||||
|
|
|
@ -8,9 +8,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
// 0b01110001
|
||||
#define SET_ADVANCED_MODE 0x71
|
||||
|
||||
#define HIP_THREAD_PERIOD 100
|
||||
|
||||
void initHip9011(Logging *sharedLogger);
|
||||
|
|
|
@ -85,20 +85,19 @@ void HIP9011::handleValue(int rpm DEFINE_PARAM_SUFFIX(DEFINE_HIP_PARAMS)) {
|
|||
int gainIndex = getHip9011GainIndex(FORWARD_HIP_PARAMS);
|
||||
int bandIndex = getBandIndex(FORWARD_HIP_PARAMS);
|
||||
|
||||
|
||||
if (currentGainIndex != gainIndex) {
|
||||
currentGainIndex = gainIndex;
|
||||
setStateAndCommand(SET_GAIN_CMD + gainIndex);
|
||||
setStateAndCommand(SET_GAIN_CMD(gainIndex));
|
||||
|
||||
} else if (currentIntergratorIndex != integratorIndex) {
|
||||
currentIntergratorIndex = integratorIndex;
|
||||
setStateAndCommand(SET_INTEGRATOR_CMD + integratorIndex);
|
||||
setStateAndCommand(SET_INTEGRATOR_CMD(integratorIndex));
|
||||
} else if (currentBandIndex != bandIndex) {
|
||||
currentBandIndex = bandIndex;
|
||||
setStateAndCommand(SET_BAND_PASS_CMD + bandIndex);
|
||||
setStateAndCommand(SET_BAND_PASS_CMD(bandIndex));
|
||||
} else if (currentPrescaler != prescalerIndex) {
|
||||
currentPrescaler = prescalerIndex;
|
||||
setStateAndCommand(SET_PRESCALER_CMD + prescalerIndex);
|
||||
setStateAndCommand(SET_PRESCALER_CMD(prescalerIndex));
|
||||
|
||||
} else {
|
||||
state = READY_TO_INTEGRATE;
|
||||
|
|
|
@ -99,20 +99,35 @@ float getHIP9011Band(DEFINE_HIP_PARAMS);
|
|||
int getBandIndex(DEFINE_HIP_PARAMS);
|
||||
int getHip9011GainIndex(DEFINE_HIP_PARAMS);
|
||||
|
||||
// 0b01000000
|
||||
#define SET_PRESCALER_CMD 0x40
|
||||
// 0b010x.xxxx
|
||||
#define SET_PRESCALER_CMD(v) (0x40 | ((v) & 0x1f))
|
||||
// 0b1110.000x
|
||||
#define SET_CHANNEL_CMD(v) (0xE0 | ((v) & 0x01))
|
||||
// 0b00xx.xxxx
|
||||
#define SET_BAND_PASS_CMD(v) (0x00 | ((v) & 0x3f))
|
||||
// 0b10xx.xxxx
|
||||
#define SET_GAIN_CMD(v) (0x80 | ((v) & 0x3f))
|
||||
// 0b110x.xxxx
|
||||
#define SET_INTEGRATOR_CMD(v) (0xC0 | ((v) & 0x1f))
|
||||
// 0b0111.0001
|
||||
#define SET_ADVANCED_MODE_CMD (0x71)
|
||||
|
||||
// 0b11100000
|
||||
#define SET_CHANNEL_CMD 0xE0
|
||||
|
||||
// 0b11000000
|
||||
#define SET_INTEGRATOR_CMD 0xC0
|
||||
|
||||
// 0b00000000
|
||||
#define SET_BAND_PASS_CMD 0x0
|
||||
|
||||
// 0b10000000
|
||||
#define SET_GAIN_CMD 0x80
|
||||
|
||||
#define _8MHZ_PRESCALER 6
|
||||
// D[4:1] = 0000 : 4 MHz
|
||||
#define HIP_4MHZ_PRESCALER (0x0 << 1)
|
||||
// D[4:1] = 0001 : 5 MHz
|
||||
#define HIP_5MHZ_PRESCALER (0x1 << 1)
|
||||
// D[4:1] = 0010 : 6 MHz
|
||||
#define HIP_6MHZ_PRESCALER (0x2 << 1)
|
||||
// D[4:1] = 0011 ; 8 MHz
|
||||
#define HIP_8MHZ_PRESCALER (0x3 << 1)
|
||||
// D[4:1] = 0100 ; 10 MHz
|
||||
#define HIP_10MHZ_PRESCALER (0x4 << 1)
|
||||
// D[4:1] = 0101 ; 12 MHz
|
||||
#define HIP_12MHZ_PRESCALER (0x5 << 1)
|
||||
// D[4:1] = 0110 : 16 MHz
|
||||
#define HIP_16MHZ_PRESCALER (0x6 << 1)
|
||||
// D[4:1] = 0111 : 20 MHz
|
||||
#define HIP_20MHZ_PRESCALER (0x7 << 1)
|
||||
// D[4:1] = 1000 : 24 MHz
|
||||
#define HIP_24MHZ_PRESCALER (0x8 << 1)
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#if EFI_SERVO || EFI_SIMULATOR
|
||||
#include "servo.h"
|
||||
#include "pin_repository.h"
|
||||
#include "thread_priority.h"
|
||||
|
||||
EXTERN_ENGINE;
|
||||
|
||||
|
@ -63,7 +64,7 @@ void initServo(void) {
|
|||
pins[i].initPin("servo", p);
|
||||
}
|
||||
|
||||
chThdCreateStatic(servoThreadStack, sizeof(servoThreadStack), NORMALPRIO, (tfunc_t)(void*) seThread, NULL);
|
||||
chThdCreateStatic(servoThreadStack, sizeof(servoThreadStack), PRIO_SERVO, (tfunc_t)(void*) seThread, NULL);
|
||||
}
|
||||
#endif /* EFI_SERVO */
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include "engine_controller.h"
|
||||
#include "adc_inputs.h"
|
||||
#include "sensor.h"
|
||||
#include "thread_priority.h"
|
||||
|
||||
EXTERN_ENGINE;
|
||||
|
||||
|
@ -149,7 +150,7 @@ void StepperMotor::ThreadTask() {
|
|||
}
|
||||
}
|
||||
|
||||
StepperMotor::StepperMotor() : ThreadController("stepper", NORMALPRIO) {}
|
||||
StepperMotor::StepperMotor() : ThreadController("stepper", PRIO_STEPPER) {}
|
||||
|
||||
int StepperMotor::getTargetPosition() const {
|
||||
return m_targetPosition;
|
||||
|
|
Binary file not shown.
|
@ -33,12 +33,12 @@ enable2ndByteCanID = false
|
|||
|
||||
[MegaTune]
|
||||
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
||||
signature = "rusEFI 2021.02.25.all.2140302013"
|
||||
signature = "rusEFI 2021.02.28.all.2140302013"
|
||||
|
||||
[TunerStudio]
|
||||
queryCommand = "S"
|
||||
versionInfo = "V" ; firmwave version for title bar.
|
||||
signature = "rusEFI 2021.02.25.all.2140302013" ; signature is expected to be 7 or more characters.
|
||||
signature = "rusEFI 2021.02.28.all.2140302013" ; signature is expected to be 7 or more characters.
|
||||
|
||||
[Constants]
|
||||
; new packet serial format with CRC
|
||||
|
@ -77,7 +77,7 @@ enable2ndByteCanID = false
|
|||
|
||||
; see PAGE_0_SIZE in C source code
|
||||
; CONFIG_DEFINITION_START
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Thu Feb 25 02:57:02 UTC 2021
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Sun Feb 28 23:57:45 UTC 2021
|
||||
|
||||
pageSize = 20000
|
||||
page = 1
|
||||
|
|
|
@ -33,12 +33,12 @@ enable2ndByteCanID = false
|
|||
|
||||
[MegaTune]
|
||||
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
||||
signature = "rusEFI 2021.02.25.frankenso_na6.4226303790"
|
||||
signature = "rusEFI 2021.02.28.frankenso_na6.4226303790"
|
||||
|
||||
[TunerStudio]
|
||||
queryCommand = "S"
|
||||
versionInfo = "V" ; firmwave version for title bar.
|
||||
signature = "rusEFI 2021.02.25.frankenso_na6.4226303790" ; signature is expected to be 7 or more characters.
|
||||
signature = "rusEFI 2021.02.28.frankenso_na6.4226303790" ; signature is expected to be 7 or more characters.
|
||||
|
||||
[Constants]
|
||||
; new packet serial format with CRC
|
||||
|
@ -77,7 +77,7 @@ enable2ndByteCanID = false
|
|||
|
||||
; see PAGE_0_SIZE in C source code
|
||||
; CONFIG_DEFINITION_START
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Thu Feb 25 02:57:11 UTC 2021
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Sun Feb 28 23:57:54 UTC 2021
|
||||
|
||||
pageSize = 20000
|
||||
page = 1
|
||||
|
|
|
@ -33,12 +33,12 @@ enable2ndByteCanID = false
|
|||
|
||||
[MegaTune]
|
||||
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
||||
signature = "rusEFI 2021.02.25.hellen72.96926268"
|
||||
signature = "rusEFI 2021.02.28.hellen72.96926268"
|
||||
|
||||
[TunerStudio]
|
||||
queryCommand = "S"
|
||||
versionInfo = "V" ; firmwave version for title bar.
|
||||
signature = "rusEFI 2021.02.25.hellen72.96926268" ; signature is expected to be 7 or more characters.
|
||||
signature = "rusEFI 2021.02.28.hellen72.96926268" ; signature is expected to be 7 or more characters.
|
||||
|
||||
[Constants]
|
||||
; new packet serial format with CRC
|
||||
|
@ -77,7 +77,7 @@ enable2ndByteCanID = false
|
|||
|
||||
; see PAGE_0_SIZE in C source code
|
||||
; CONFIG_DEFINITION_START
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Thu Feb 25 02:57:04 UTC 2021
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Sun Feb 28 23:57:47 UTC 2021
|
||||
|
||||
pageSize = 20000
|
||||
page = 1
|
||||
|
|
|
@ -33,12 +33,12 @@ enable2ndByteCanID = false
|
|||
|
||||
[MegaTune]
|
||||
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
||||
signature = "rusEFI 2021.02.25.hellen_cypress.1039053165"
|
||||
signature = "rusEFI 2021.02.28.hellen_cypress.1039053165"
|
||||
|
||||
[TunerStudio]
|
||||
queryCommand = "S"
|
||||
versionInfo = "V" ; firmwave version for title bar.
|
||||
signature = "rusEFI 2021.02.25.hellen_cypress.1039053165" ; signature is expected to be 7 or more characters.
|
||||
signature = "rusEFI 2021.02.28.hellen_cypress.1039053165" ; signature is expected to be 7 or more characters.
|
||||
|
||||
[Constants]
|
||||
; new packet serial format with CRC
|
||||
|
@ -77,7 +77,7 @@ enable2ndByteCanID = false
|
|||
|
||||
; see PAGE_0_SIZE in C source code
|
||||
; CONFIG_DEFINITION_START
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on hellen_cypress_gen_config.bat integration/rusefi_config.txt Thu Feb 25 02:57:29 UTC 2021
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on hellen_cypress_gen_config.bat integration/rusefi_config.txt Sun Feb 28 23:58:13 UTC 2021
|
||||
|
||||
pageSize = 20000
|
||||
page = 1
|
||||
|
|
|
@ -33,12 +33,12 @@ enable2ndByteCanID = false
|
|||
|
||||
[MegaTune]
|
||||
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
||||
signature = "rusEFI 2021.02.25.kin.3259727249"
|
||||
signature = "rusEFI 2021.02.28.kin.3259727249"
|
||||
|
||||
[TunerStudio]
|
||||
queryCommand = "S"
|
||||
versionInfo = "V" ; firmwave version for title bar.
|
||||
signature = "rusEFI 2021.02.25.kin.3259727249" ; signature is expected to be 7 or more characters.
|
||||
signature = "rusEFI 2021.02.28.kin.3259727249" ; signature is expected to be 7 or more characters.
|
||||
|
||||
[Constants]
|
||||
; new packet serial format with CRC
|
||||
|
@ -77,7 +77,7 @@ enable2ndByteCanID = false
|
|||
|
||||
; see PAGE_0_SIZE in C source code
|
||||
; CONFIG_DEFINITION_START
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on kinetis_gen_config.bat integration/rusefi_config.txt Thu Feb 25 02:57:25 UTC 2021
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on kinetis_gen_config.bat integration/rusefi_config.txt Sun Feb 28 23:58:11 UTC 2021
|
||||
|
||||
pageSize = 19972
|
||||
page = 1
|
||||
|
|
|
@ -33,12 +33,12 @@ enable2ndByteCanID = false
|
|||
|
||||
[MegaTune]
|
||||
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
||||
signature = "rusEFI 2021.02.25.mre_f4.1364465751"
|
||||
signature = "rusEFI 2021.02.28.mre_f4.1364465751"
|
||||
|
||||
[TunerStudio]
|
||||
queryCommand = "S"
|
||||
versionInfo = "V" ; firmwave version for title bar.
|
||||
signature = "rusEFI 2021.02.25.mre_f4.1364465751" ; signature is expected to be 7 or more characters.
|
||||
signature = "rusEFI 2021.02.28.mre_f4.1364465751" ; signature is expected to be 7 or more characters.
|
||||
|
||||
[Constants]
|
||||
; new packet serial format with CRC
|
||||
|
@ -77,7 +77,7 @@ enable2ndByteCanID = false
|
|||
|
||||
; see PAGE_0_SIZE in C source code
|
||||
; CONFIG_DEFINITION_START
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Thu Feb 25 02:57:09 UTC 2021
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Sun Feb 28 23:57:52 UTC 2021
|
||||
|
||||
pageSize = 20000
|
||||
page = 1
|
||||
|
|
|
@ -33,12 +33,12 @@ enable2ndByteCanID = false
|
|||
|
||||
[MegaTune]
|
||||
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
||||
signature = "rusEFI 2021.02.25.mre_f7.1364465751"
|
||||
signature = "rusEFI 2021.02.28.mre_f7.1364465751"
|
||||
|
||||
[TunerStudio]
|
||||
queryCommand = "S"
|
||||
versionInfo = "V" ; firmwave version for title bar.
|
||||
signature = "rusEFI 2021.02.25.mre_f7.1364465751" ; signature is expected to be 7 or more characters.
|
||||
signature = "rusEFI 2021.02.28.mre_f7.1364465751" ; signature is expected to be 7 or more characters.
|
||||
|
||||
[Constants]
|
||||
; new packet serial format with CRC
|
||||
|
@ -77,7 +77,7 @@ enable2ndByteCanID = false
|
|||
|
||||
; see PAGE_0_SIZE in C source code
|
||||
; CONFIG_DEFINITION_START
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Thu Feb 25 02:57:07 UTC 2021
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Sun Feb 28 23:57:49 UTC 2021
|
||||
|
||||
pageSize = 20000
|
||||
page = 1
|
||||
|
|
|
@ -33,12 +33,12 @@ enable2ndByteCanID = false
|
|||
|
||||
[MegaTune]
|
||||
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
||||
signature = "rusEFI 2021.02.25.prometheus_405.1829005451"
|
||||
signature = "rusEFI 2021.02.28.prometheus_405.1829005451"
|
||||
|
||||
[TunerStudio]
|
||||
queryCommand = "S"
|
||||
versionInfo = "V" ; firmwave version for title bar.
|
||||
signature = "rusEFI 2021.02.25.prometheus_405.1829005451" ; signature is expected to be 7 or more characters.
|
||||
signature = "rusEFI 2021.02.28.prometheus_405.1829005451" ; signature is expected to be 7 or more characters.
|
||||
|
||||
[Constants]
|
||||
; new packet serial format with CRC
|
||||
|
@ -77,7 +77,7 @@ enable2ndByteCanID = false
|
|||
|
||||
; see PAGE_0_SIZE in C source code
|
||||
; CONFIG_DEFINITION_START
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Thu Feb 25 02:57:15 UTC 2021
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Sun Feb 28 23:57:59 UTC 2021
|
||||
|
||||
pageSize = 20000
|
||||
page = 1
|
||||
|
|
|
@ -33,12 +33,12 @@ enable2ndByteCanID = false
|
|||
|
||||
[MegaTune]
|
||||
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
||||
signature = "rusEFI 2021.02.25.prometheus_469.1829005451"
|
||||
signature = "rusEFI 2021.02.28.prometheus_469.1829005451"
|
||||
|
||||
[TunerStudio]
|
||||
queryCommand = "S"
|
||||
versionInfo = "V" ; firmwave version for title bar.
|
||||
signature = "rusEFI 2021.02.25.prometheus_469.1829005451" ; signature is expected to be 7 or more characters.
|
||||
signature = "rusEFI 2021.02.28.prometheus_469.1829005451" ; signature is expected to be 7 or more characters.
|
||||
|
||||
[Constants]
|
||||
; new packet serial format with CRC
|
||||
|
@ -77,7 +77,7 @@ enable2ndByteCanID = false
|
|||
|
||||
; see PAGE_0_SIZE in C source code
|
||||
; CONFIG_DEFINITION_START
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Thu Feb 25 02:57:13 UTC 2021
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Sun Feb 28 23:57:56 UTC 2021
|
||||
|
||||
pageSize = 20000
|
||||
page = 1
|
||||
|
|
|
@ -33,12 +33,12 @@ enable2ndByteCanID = false
|
|||
|
||||
[MegaTune]
|
||||
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
||||
signature = "rusEFI 2021.02.25.proteus_f4.413377170"
|
||||
signature = "rusEFI 2021.02.28.proteus_f4.413377170"
|
||||
|
||||
[TunerStudio]
|
||||
queryCommand = "S"
|
||||
versionInfo = "V" ; firmwave version for title bar.
|
||||
signature = "rusEFI 2021.02.25.proteus_f4.413377170" ; signature is expected to be 7 or more characters.
|
||||
signature = "rusEFI 2021.02.28.proteus_f4.413377170" ; signature is expected to be 7 or more characters.
|
||||
|
||||
[Constants]
|
||||
; new packet serial format with CRC
|
||||
|
@ -77,7 +77,7 @@ enable2ndByteCanID = false
|
|||
|
||||
; see PAGE_0_SIZE in C source code
|
||||
; CONFIG_DEFINITION_START
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Thu Feb 25 02:57:19 UTC 2021
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Sun Feb 28 23:58:07 UTC 2021
|
||||
|
||||
pageSize = 20000
|
||||
page = 1
|
||||
|
|
|
@ -33,12 +33,12 @@ enable2ndByteCanID = false
|
|||
|
||||
[MegaTune]
|
||||
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
||||
signature = "rusEFI 2021.02.25.proteus_f7.413377170"
|
||||
signature = "rusEFI 2021.02.28.proteus_f7.413377170"
|
||||
|
||||
[TunerStudio]
|
||||
queryCommand = "S"
|
||||
versionInfo = "V" ; firmwave version for title bar.
|
||||
signature = "rusEFI 2021.02.25.proteus_f7.413377170" ; signature is expected to be 7 or more characters.
|
||||
signature = "rusEFI 2021.02.28.proteus_f7.413377170" ; signature is expected to be 7 or more characters.
|
||||
|
||||
[Constants]
|
||||
; new packet serial format with CRC
|
||||
|
@ -77,7 +77,7 @@ enable2ndByteCanID = false
|
|||
|
||||
; see PAGE_0_SIZE in C source code
|
||||
; CONFIG_DEFINITION_START
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Thu Feb 25 02:57:17 UTC 2021
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Sun Feb 28 23:58:03 UTC 2021
|
||||
|
||||
pageSize = 20000
|
||||
page = 1
|
||||
|
|
|
@ -33,12 +33,12 @@ enable2ndByteCanID = false
|
|||
|
||||
[MegaTune]
|
||||
; https://rusefi.com/forum/viewtopic.php?p=36201#p36201
|
||||
signature = "rusEFI 2021.02.25.subaru_eg33_f7.3175160971"
|
||||
signature = "rusEFI 2021.02.28.subaru_eg33_f7.3175160971"
|
||||
|
||||
[TunerStudio]
|
||||
queryCommand = "S"
|
||||
versionInfo = "V" ; firmwave version for title bar.
|
||||
signature = "rusEFI 2021.02.25.subaru_eg33_f7.3175160971" ; signature is expected to be 7 or more characters.
|
||||
signature = "rusEFI 2021.02.28.subaru_eg33_f7.3175160971" ; signature is expected to be 7 or more characters.
|
||||
|
||||
[Constants]
|
||||
; new packet serial format with CRC
|
||||
|
@ -77,7 +77,7 @@ enable2ndByteCanID = false
|
|||
|
||||
; see PAGE_0_SIZE in C source code
|
||||
; CONFIG_DEFINITION_START
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on config/boards/subaru_eg33/config/gen_config.sh integration/rusefi_config.txt Thu Feb 25 02:57:30 UTC 2021
|
||||
; this section was generated automatically by rusEfi tool ConfigDefinition.jar based on config/boards/subaru_eg33/config/gen_config.sh integration/rusefi_config.txt Sun Feb 28 23:58:15 UTC 2021
|
||||
|
||||
pageSize = 20000
|
||||
page = 1
|
||||
|
|
|
@ -58,4 +58,16 @@ public class ProteusAnalogTest extends RusefiTestBase {
|
|||
// 100% duty -> failed TPS (voltage too high)
|
||||
setIdlePositionAndAssertTps(98, 0);
|
||||
}
|
||||
|
||||
void assertSensorValue(Sensor sensor, double expected) {
|
||||
double actual = SensorCentral.getInstance().getValue(sensor);
|
||||
assertEquals(expected, actual, 0.5);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUnconnectedInputs() {
|
||||
// CLT/IAT inputs should float at ~5 volts
|
||||
assertSensorValue(Sensor.rawClt, 5.0);
|
||||
assertSensorValue(Sensor.rawIat, 5.0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.rusefi.config.generated;
|
||||
|
||||
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Thu Feb 25 02:57:02 UTC 2021
|
||||
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh integration/rusefi_config.txt Sun Feb 28 23:57:45 UTC 2021
|
||||
|
||||
// by class com.rusefi.output.FileJavaFieldsConsumer
|
||||
import com.rusefi.config.*;
|
||||
|
@ -1478,7 +1478,7 @@ public class Fields {
|
|||
public static final char TS_SD_R_COMMAND = 'r';
|
||||
public static final char TS_SD_W_COMMAND = 'w';
|
||||
public static final char TS_SET_LOGGER_SWITCH = 'l';
|
||||
public static final String TS_SIGNATURE = "rusEFI 2021.02.25.all.2140302013";
|
||||
public static final String TS_SIGNATURE = "rusEFI 2021.02.28.all.2140302013";
|
||||
public static final char TS_SINGLE_WRITE_COMMAND = 'W';
|
||||
public static final int TT_TT_1_16 = 50;
|
||||
public static final int TT_TT_2JZ_1_12 = 29;
|
||||
|
|
|
@ -118,6 +118,10 @@ public enum Sensor {
|
|||
|
||||
tuneCrc16("tune crc16", SensorCategory.STATUS, FieldType.UINT16, 244, 0, 5),
|
||||
|
||||
// Raw sensors
|
||||
rawClt("raw CLT", SensorCategory.SENSOR_INPUTS, FieldType.INT16, 238, 1.0 / PACK_MULT_VOLTAGE, 0, 5, "volts"),
|
||||
rawIat("raw IAT", SensorCategory.SENSOR_INPUTS, FieldType.INT16, 240, 1.0 / PACK_MULT_VOLTAGE, 0, 5, "volts"),
|
||||
|
||||
// Synthetic (console only) channels
|
||||
ETB_CONTROL_QUALITY("ETB metric", SensorCategory.SNIFFING, "", 100),
|
||||
;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<roms>
|
||||
|
||||
<!-- was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh Thu Feb 25 02:57:03 UTC 2021 -->
|
||||
<!-- was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.sh Sun Feb 28 23:57:46 UTC 2021 -->
|
||||
|
||||
<rom>
|
||||
<romid>
|
||||
|
|
|
@ -37,40 +37,32 @@
|
|||
<table class="info-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Pin Number</th>
|
||||
<th>Firmware ID</th>
|
||||
<th>Type</th>
|
||||
<th>Typical Function</th>
|
||||
<th>Pigtail Color</th>
|
||||
<th class="pin-header">Pin Number</th>
|
||||
<th class="id-header">Firmware ID</th>
|
||||
<th class="type-header">Type</th>
|
||||
<th class="function-header">Typical Function</th>
|
||||
<th class="color-header">Pigtail Color</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
<h2>Full Pinout Table</h2>
|
||||
<table class="pinout-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Pin Number</th>
|
||||
<th>Firmware ID</th>
|
||||
<th>Type</th>
|
||||
<th>Typical Function</th>
|
||||
<th>Pigtail Color</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
</tbody>
|
||||
</table>
|
||||
<br/>
|
||||
<br/>
|
||||
<br/>
|
||||
<br/>
|
||||
<div class="table-wrapper">
|
||||
<table class="pinout-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="pin-header">Pin Number</th>
|
||||
<th class="id-header">Firmware ID</th>
|
||||
<th class="type-header">Type</th>
|
||||
<th class="function-header">Typical Function</th>
|
||||
<th class="color-header">Pigtail Color</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue