hiding 8888 mess under the rug

making LPS25 one step more available to Hellen
This commit is contained in:
rusefillc 2021-05-14 10:54:40 -04:00
parent 1d10fbc7a8
commit 08de271407
5 changed files with 31 additions and 20 deletions

View File

@ -224,17 +224,7 @@ void Engine::periodicSlowCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
standardAirCharge = getStandardAirCharge(PASS_ENGINE_PARAMETER_SIGNATURE);
#if (BOARD_TLE8888_COUNT > 0)
static efitick_t tle8888CrankingResetTime = 0;
if (CONFIG(useTLE8888_cranking_hack) && ENGINE(rpmCalculator).isCranking()) {
efitick_t nowNt = getTimeNowNt();
if (nowNt - tle8888CrankingResetTime > MS2NT(300)) {
tle8888_req_init();
// let's reset TLE8888 every 300ms while cranking since that's the best we can do to deal with undervoltage reset
// PS: oh yes, it's a horrible design! Please suggest something better!
tle8888CrankingResetTime = nowNt;
}
}
tle8888startup();
#endif
#if EFI_DYNO_VIEW
@ -243,10 +233,10 @@ void Engine::periodicSlowCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
slowCallBackWasInvoked = true;
#if HW_PROTEUS
void baroUpdate();
baroUpdate();
#endif
#if EFI_PROD_CODE
void baroLps25Update();
baroLps25Update();
#endif // EFI_PROD_CODE
#if ANALOG_HW_CHECK_MODE
efiAssertVoid(OBD_PCM_Processor_Fault, isAdcChannelValid(CONFIG(clt).adcChannel), "No CLT setting");

View File

@ -18,8 +18,9 @@ public:
bool init(brain_pin_e scl, brain_pin_e sda);
expected<float> readPressureKpa();
// todo: make this private and get getter?
bool m_hasInit = false;
private:
BitbangI2c m_i2c;
bool m_hasInit = false;
};

View File

@ -20,8 +20,9 @@
#include "drivers/gpio/mc33810.h"
#include "drivers/gpio/tle8888.h"
#include "drivers/gpio/drv8860.h"
#include "engine.h"
EXTERN_CONFIG;
EXTERN_ENGINE;
#if (BOARD_TLE6240_COUNT > 0)
// todo: migrate to TS or board config
@ -238,6 +239,21 @@ void initSmartGpio() {
gpiochips_init();
}
void tle8888startup() {
tle8888startup();
static efitick_t tle8888CrankingResetTime = 0;
if (CONFIG(useTLE8888_cranking_hack) && ENGINE(rpmCalculator).isCranking()) {
efitick_t nowNt = getTimeNowNt();
if (nowNt - tle8888CrankingResetTime > MS2NT(300)) {
tle8888_req_init();
// let's reset TLE8888 every 300ms while cranking since that's the best we can do to deal with undervoltage reset
// PS: oh yes, it's a horrible design! Please suggest something better!
tle8888CrankingResetTime = nowNt;
}
}
}
void stopSmartCsPins() {
#if (BOARD_TLE8888_COUNT > 0)
efiSetPadUnused(activeConfiguration.tle8888_cs);

View File

@ -25,3 +25,5 @@ void initSmartGpio(void);
void startSmartCsPins(void);
void stopSmartCsPins(void);
void tle8888startup(void);

View File

@ -20,8 +20,10 @@ void initBaro(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
}
}
void baroUpdate() {
void baroLps25Update() {
#if EFI_PROD_CODE
if (device.m_hasInit) {
sensor.update();
#endif
}
#endif // EFI_PROD_CODE
}