LUA code and EGT makes ECU to hang fix #5889

This commit is contained in:
rusefillc 2024-01-30 17:39:50 -05:00
parent fc45a93b23
commit 324378f252
5 changed files with 18 additions and 7 deletions

View File

@ -690,11 +690,10 @@ void updateTunerStudioState() {
tsOutputChannels->checkEngine = hasErrorCodes();
#if EFI_MAX_31855
for (int i = 0; i < EGT_CHANNEL_COUNT; i++)
for (int i = 0; i < EGT_CHANNEL_COUNT; i++) {
// todo: migrate to SensorType framework!
tsOutputChannels->egt[i] = getMax31855EgtValue(i);
#endif /* EFI_MAX_31855 */
tsOutputChannels->egt[i] = engine->currentEgtValue[i];
}
updateWarningCodes();

View File

@ -32,6 +32,7 @@
#include "fan_control.h"
#include "ac_control.h"
#include "vr_pwm.h"
#include "max31855.h"
#if EFI_MC33816
#include "mc33816.h"
#endif // EFI_MC33816
@ -160,6 +161,9 @@ void Engine::periodicSlowCallback() {
updateVrThresholdPwm();
updateGppwm();
#if EFI_MAX_31855
grabEgtValues();
#endif /* EFI_MAX_31855 */
engine->engineModules.apply_all([](auto & m) { m.onSlowCallback(); });

View File

@ -298,6 +298,8 @@ public:
void updateTriggerWaveform();
bool isRunningPwmTest = false;
// todo: encapsulate
uint16_t currentEgtValue[EGT_CHANNEL_COUNT];
/**
* are we running any kind of functional test? this affect

View File

@ -101,7 +101,7 @@ static uint32_t readEgtPacket(int egtChannel) {
#define GET_TEMPERATURE_C(x) (((x) >> 18) / 4)
uint16_t getMax31855EgtValue(int egtChannel) {
static uint16_t getMax31855EgtValue(int egtChannel) {
uint32_t packet = readEgtPacket(egtChannel);
max_32855_code code = getResultCode(packet);
if (code != MC_OK) {
@ -158,4 +158,11 @@ void initMax31855(spi_device_e device, egt_cs_array_t max31855_cs) {
}
}
void grabEgtValues() {
for (int i = 0; i < EGT_CHANNEL_COUNT; i++) {
// todo: migrate to SensorType framework!
engine->currentEgtValue[i] = getMax31855EgtValue(i);
}
}
#endif /* EFI_MAX_31855 */

View File

@ -14,5 +14,4 @@
void initMax31855(spi_device_e device, egt_cs_array_t max31855_cs);
#endif /* HAL_USE_SPI */
uint16_t getMax31855EgtValue(int egtChannel);
void grabEgtValues();