auto-sync
This commit is contained in:
parent
7e4b4c6633
commit
8fb73ff94a
|
@ -29,6 +29,8 @@ void setFrankenso_01_LCD(board_configuration_s *boardConfiguration) {
|
||||||
|
|
||||||
static void setHondaAccordConfigurationCommon(engine_configuration_s *engineConfiguration, board_configuration_s *boardConfiguration) {
|
static void setHondaAccordConfigurationCommon(engine_configuration_s *engineConfiguration, board_configuration_s *boardConfiguration) {
|
||||||
engineConfiguration->map.sensor.sensorType = MT_DENSO183;
|
engineConfiguration->map.sensor.sensorType = MT_DENSO183;
|
||||||
|
boardConfiguration->isFastAdcEnabled = true;
|
||||||
|
|
||||||
|
|
||||||
engineConfiguration->ignitionMode = IM_ONE_COIL;
|
engineConfiguration->ignitionMode = IM_ONE_COIL;
|
||||||
engineConfiguration->injectionMode = IM_BATCH;
|
engineConfiguration->injectionMode = IM_BATCH;
|
||||||
|
|
|
@ -156,11 +156,11 @@ void setDefaultConfiguration(engine_configuration_s *engineConfiguration, board_
|
||||||
|
|
||||||
// set_cranking_fuel_max 6 40
|
// set_cranking_fuel_max 6 40
|
||||||
engineConfiguration->crankingSettings.coolantTempMaxC = 40; // 6ms at 40C
|
engineConfiguration->crankingSettings.coolantTempMaxC = 40; // 6ms at 40C
|
||||||
engineConfiguration->crankingSettings.fuelAtMaxTempMs = 6;
|
engineConfiguration->crankingSettings.fuelAtMaxTempMs = 24;
|
||||||
|
|
||||||
// set_cranking_fuel_min 6 -40
|
// set_cranking_fuel_min 6 -40
|
||||||
engineConfiguration->crankingSettings.coolantTempMinC = -40; // 6ms at -40C
|
engineConfiguration->crankingSettings.coolantTempMinC = -40; // 6ms at -40C
|
||||||
engineConfiguration->crankingSettings.fuelAtMinTempMs = 6;
|
engineConfiguration->crankingSettings.fuelAtMinTempMs = 24;
|
||||||
|
|
||||||
engineConfiguration->analogInputDividerCoefficient = 2;
|
engineConfiguration->analogInputDividerCoefficient = 2;
|
||||||
|
|
||||||
|
@ -229,6 +229,7 @@ void setDefaultConfiguration(engine_configuration_s *engineConfiguration, board_
|
||||||
|
|
||||||
engineConfiguration->globalFuelCorrection = 1;
|
engineConfiguration->globalFuelCorrection = 1;
|
||||||
|
|
||||||
|
boardConfiguration->isFastAdcEnabled = false;
|
||||||
engineConfiguration->map.sensor.sensorType = MT_MPX4250;
|
engineConfiguration->map.sensor.sensorType = MT_MPX4250;
|
||||||
|
|
||||||
engineConfiguration->baroSensor.sensorType = MT_CUSTOM;
|
engineConfiguration->baroSensor.sensorType = MT_CUSTOM;
|
||||||
|
|
|
@ -142,7 +142,11 @@ static void fanRelayControl(void) {
|
||||||
Overflow64Counter halTime;
|
Overflow64Counter halTime;
|
||||||
|
|
||||||
uint64_t getTimeNowUs(void) {
|
uint64_t getTimeNowUs(void) {
|
||||||
return halTime.get(hal_lld_get_counter_value(), false) / (CORE_CLOCK / 1000000);
|
return getTimeNowNt() / (CORE_CLOCK / 1000000);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t getTimeNowNt(void) {
|
||||||
|
return halTime.get(hal_lld_get_counter_value(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
//uint64_t getHalTimer(void) {
|
//uint64_t getHalTimer(void) {
|
||||||
|
|
|
@ -37,11 +37,16 @@ extern "C"
|
||||||
/**
|
/**
|
||||||
* 64-bit counter of microseconds (1/1 000 000 of a second) since MCU reset
|
* 64-bit counter of microseconds (1/1 000 000 of a second) since MCU reset
|
||||||
*
|
*
|
||||||
* By using 64 bit, we can achive a very precise timestamp which does not overflow.
|
* By using 64 bit, we can achieve a very precise timestamp which does not overflow.
|
||||||
* The primary implementation counts the number of CPU cycles from MCU reset.
|
* The primary implementation counts the number of CPU cycles from MCU reset.
|
||||||
*/
|
*/
|
||||||
uint64_t getTimeNowUs(void);
|
uint64_t getTimeNowUs(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 64-bit counter CPU cycles since MCU reset
|
||||||
|
*/
|
||||||
|
uint64_t getTimeNowNt(void);
|
||||||
|
|
||||||
uint64_t getHalTimer(void);
|
uint64_t getHalTimer(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -61,7 +61,7 @@ static uint64_t getNextSwitchTimeUs(PwmConfig *state) {
|
||||||
#if DEBUG_PWM
|
#if DEBUG_PWM
|
||||||
scheduleMsg(&logger, "start=%d timeToSwitch=%d", state->safe.start, timeToSwitch);
|
scheduleMsg(&logger, "start=%d timeToSwitch=%d", state->safe.start, timeToSwitch);
|
||||||
#endif
|
#endif
|
||||||
return state->safe.startUs + timeToSwitchUs;
|
return NT2US(state->safe.startNt) + timeToSwitchUs;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PwmConfig::handleCycleStart() {
|
void PwmConfig::handleCycleStart() {
|
||||||
|
@ -74,7 +74,7 @@ void PwmConfig::handleCycleStart() {
|
||||||
/**
|
/**
|
||||||
* period length has changed - we need to reset internal state
|
* period length has changed - we need to reset internal state
|
||||||
*/
|
*/
|
||||||
safe.startUs = getTimeNowUs();
|
safe.startNt = getTimeNowNt();
|
||||||
safe.iteration = 0;
|
safe.iteration = 0;
|
||||||
safe.periodUs = periodUs;
|
safe.periodUs = periodUs;
|
||||||
#if DEBUG_PWM
|
#if DEBUG_PWM
|
||||||
|
|
|
@ -26,7 +26,7 @@ typedef struct {
|
||||||
/**
|
/**
|
||||||
* Start time of current iteration
|
* Start time of current iteration
|
||||||
*/
|
*/
|
||||||
uint64_t startUs;
|
uint64_t startNt;
|
||||||
int phaseIndex;
|
int phaseIndex;
|
||||||
} pwm_config_safe_state_s;
|
} pwm_config_safe_state_s;
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@
|
||||||
</option>
|
</option>
|
||||||
<option>
|
<option>
|
||||||
<name>MemFile</name>
|
<name>MemFile</name>
|
||||||
<state></state>
|
<state>$TOOLKIT_DIR$\CONFIG\debugger\ST\STM32F407VG.ddf</state>
|
||||||
</option>
|
</option>
|
||||||
<option>
|
<option>
|
||||||
<name>RunToEnable</name>
|
<name>RunToEnable</name>
|
||||||
|
@ -117,7 +117,7 @@
|
||||||
</option>
|
</option>
|
||||||
<option>
|
<option>
|
||||||
<name>FlashLoadersV3</name>
|
<name>FlashLoadersV3</name>
|
||||||
<state>$TOOLKIT_DIR$\config\flashloader\</state>
|
<state>$TOOLKIT_DIR$\config\flashloader\ST\FlashSTM32F4xxx.board</state>
|
||||||
</option>
|
</option>
|
||||||
<option>
|
<option>
|
||||||
<name>OCImagesSuppressCheck1</name>
|
<name>OCImagesSuppressCheck1</name>
|
||||||
|
@ -1145,7 +1145,7 @@
|
||||||
</option>
|
</option>
|
||||||
<option>
|
<option>
|
||||||
<name>CCCpuClockEdit</name>
|
<name>CCCpuClockEdit</name>
|
||||||
<state>72.0</state>
|
<state>168</state>
|
||||||
</option>
|
</option>
|
||||||
<option>
|
<option>
|
||||||
<name>CCSwoClockAuto</name>
|
<name>CCSwoClockAuto</name>
|
||||||
|
|
|
@ -40,6 +40,14 @@ extern "C"
|
||||||
// todo: access some existing configuration field
|
// todo: access some existing configuration field
|
||||||
#define CORE_CLOCK 168000000
|
#define CORE_CLOCK 168000000
|
||||||
|
|
||||||
|
// 168 ticks in microsecond
|
||||||
|
#define US_TO_NT_MULTIPLIER 168
|
||||||
|
|
||||||
|
#define US2NT(x) ((x)*US_TO_NT_MULTIPLIER)
|
||||||
|
|
||||||
|
#define NT2US(x) ((x) / US_TO_NT_MULTIPLIER)
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* number of SysClock ticks in one ms
|
* number of SysClock ticks in one ms
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -15,6 +15,12 @@
|
||||||
#include "datalogging.h"
|
#include "datalogging.h"
|
||||||
#include "efitime.h"
|
#include "efitime.h"
|
||||||
|
|
||||||
|
#define US_TO_NT_MULTIPLIER 100
|
||||||
|
|
||||||
|
#define US2NT(x) (US_TO_NT_MULTIPLIER * (x))
|
||||||
|
|
||||||
|
#define NT2US(x) ((x) / US_TO_NT_MULTIPLIER)
|
||||||
|
|
||||||
#ifndef GLOBAL_FT_H_
|
#ifndef GLOBAL_FT_H_
|
||||||
#define GLOBAL_FT_H_
|
#define GLOBAL_FT_H_
|
||||||
|
|
||||||
|
|
|
@ -197,6 +197,10 @@ void chDbgPanic3(const char *msg, const char * file, int line) {
|
||||||
onFatalError(msg, file, line);
|
onFatalError(msg, file, line);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint64_t getTimeNowNt(void) {
|
||||||
|
return getTimeNowUs() * US_TO_NT_MULTIPLIER;
|
||||||
|
}
|
||||||
|
|
||||||
uint64_t getTimeNowUs(void) {
|
uint64_t getTimeNowUs(void) {
|
||||||
return chTimeNow() * (1000000 / CH_FREQUENCY);
|
return chTimeNow() * (1000000 / CH_FREQUENCY);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue