random progress & method rename

This commit is contained in:
rusefillc 2022-04-16 17:35:59 -04:00
parent b9769f59cc
commit 07f210a82b
5 changed files with 25 additions and 11 deletions

View File

@ -213,7 +213,11 @@ const void * getStructAddr(live_data_e structId) {
case LDS_trigger_central:
return static_cast<trigger_central_s*>(&engine->triggerCentral);
case LDS_trigger_state:
#if EFI_SHAFT_POSITION_INPUT
return static_cast<trigger_state_s*>(&engine->triggerCentral.triggerState);
#else
return nullptr;
#endif // EFI_SHAFT_POSITION_INPUT
case LDS_wall_fuel_state:
return static_cast<wall_fuel_state_s*>(&engine->injectionEvents.elements[0].wallFuel);
case LDS_idle_state:
@ -429,7 +433,7 @@ static void handleTestCommand(TsChannelBase* tsChannel) {
tsChannel->write((const uint8_t*)testOutputBuffer, strlen(testOutputBuffer));
if (hasFirmwareError()) {
const char* error = getFirmwareError();
const char* error = getCriticalErrorMessage();
chsnprintf(testOutputBuffer, sizeof(testOutputBuffer), "error=%s\r\n", error);
tsChannel->write((const uint8_t*)testOutputBuffer, strlen(testOutputBuffer));
}
@ -810,7 +814,7 @@ int TunerStudio::handleCrcCommand(TsChannelBase* tsChannel, char *data, int inco
break;
#endif /* ENABLE_PERF_TRACE */
case TS_GET_CONFIG_ERROR: {
const char* configError = getFirmwareError();
const char* configError = getCriticalErrorMessage();
#if HW_CHECK_MODE
// analog input errors are returned as firmware error in QC mode
if (!hasFirmwareError()) {

View File

@ -261,7 +261,7 @@ void updateDevConsoleState(void) {
#if EFI_PROD_CODE
// todo: unify with simulator!
if (hasFirmwareError()) {
efiPrintf("%s error: %s", CRITICAL_PREFIX, getFirmwareError());
efiPrintf("%s error: %s", CRITICAL_PREFIX, getCriticalErrorMessage());
warningEnabled = false;
return;
}
@ -723,6 +723,8 @@ void updateTunerStudioState() {
// header
tsOutputChannels->tsConfigVersion = TS_FILE_VERSION;
#if EFI_SHAFT_POSITION_INPUT
// offset 0
tsOutputChannels->RPMValue = rpm;
auto instantRpm = engine->triggerCentral.triggerState.getInstantRpm();
@ -747,6 +749,9 @@ void updateTunerStudioState() {
tsOutputChannels->totalTriggerErrorCounter = engine->triggerCentral.triggerState.totalTriggerErrorCounter;
tsOutputChannels->orderingErrorCounter = engine->triggerCentral.triggerState.orderingErrorCounter;
#endif // EFI_SHAFT_POSITION_INPUT
// 68
// 140
#if EFI_ENGINE_CONTROL
@ -820,6 +825,7 @@ void updateTunerStudioState() {
tsOutputChannels->maxTriggerReentrant = maxTriggerReentrant;
#endif /* EFI_CLOCK_LOCKS */
#if EFI_SHAFT_POSITION_INPUT
tsOutputChannels->triggerPrimaryFall = engine->triggerCentral.getHwEventCounter((int)SHAFT_PRIMARY_FALLING);
tsOutputChannels->triggerPrimaryRise = engine->triggerCentral.getHwEventCounter((int)SHAFT_PRIMARY_RISING);
@ -828,6 +834,7 @@ void updateTunerStudioState() {
tsOutputChannels->triggerVvtRise = engine->triggerCentral.vvtEventRiseCounter[0];
tsOutputChannels->triggerVvtFall = engine->triggerCentral.vvtEventFallCounter[0];
#endif // EFI_SHAFT_POSITION_INPUT
switch (engineConfiguration->debugMode) {
@ -847,8 +854,10 @@ void updateTunerStudioState() {
tsOutputChannels->debugFloatField3 = icuRisingCallbackCounter + icuFallingCallbackCounter;
#endif /* EFI_PROD_CODE */
#if EFI_SHAFT_POSITION_INPUT
tsOutputChannels->debugIntField4 = engine->triggerCentral.triggerState.currentCycle.eventCount[0];
tsOutputChannels->debugIntField5 = engine->triggerCentral.triggerState.currentCycle.eventCount[1];
#endif // EFI_SHAFT_POSITION_INPUT
// debugFloatField6 used
// no one uses shaft so far tsOutputChannels->debugFloatField3 = engine->triggerCentral.getHwEventCounter((int)SHAFT_3RD_RISING);
@ -879,7 +888,9 @@ void updateTunerStudioState() {
break;
case DBG_INSTANT_RPM:
{
#if EFI_SHAFT_POSITION_INPUT
tsOutputChannels->debugFloatField2 = instantRpm / Sensor::getOrZero(SensorType::Rpm);
#endif // EFI_SHAFT_POSITION_INPUT
tsOutputChannels->mostRecentTimeBetweenSparkEvents = engine->mostRecentTimeBetweenSparkEvents;
tsOutputChannels->mostRecentTimeBetweenIgnitionEvents = engine->mostRecentTimeBetweenIgnitionEvents;

View File

@ -22,7 +22,7 @@ bool hasFirmwareErrorFlag = false;
const char *dbg_panic_file;
int dbg_panic_line;
const char* getFirmwareError(void) {
const char* getCriticalErrorMessage(void) {
return criticalErrorMessageBuffer;
}
@ -218,12 +218,12 @@ void firmwareError(obd_code_e code, const char *fmt, ...) {
va_end(ap);
}
int size = strlen((char*)criticalErrorMessageBuffer);
int errorMessageSize = strlen((char*)criticalErrorMessageBuffer);
static char versionBuffer[32];
chsnprintf(versionBuffer, sizeof(versionBuffer), " %d@%s", getRusEfiVersion(), FIRMWARE_ID);
if (size + strlen(versionBuffer) < sizeof(criticalErrorMessageBuffer)) {
strcpy((char*)(criticalErrorMessageBuffer) + size, versionBuffer);
if (errorMessageSize + strlen(versionBuffer) < sizeof(criticalErrorMessageBuffer)) {
strcpy((char*)(criticalErrorMessageBuffer) + errorMessageSize, versionBuffer);
}
#else

View File

@ -37,8 +37,7 @@ extern bool hasFirmwareErrorFlag;
#define hasFirmwareError() hasFirmwareErrorFlag
// todo: rename to getCriticalErrorMessage
const char* getFirmwareError(void);
const char* getCriticalErrorMessage(void);
const char* getWarningMessage(void);
// todo: better place for this shared declaration?

View File

@ -281,7 +281,7 @@ void updateHD44780lcd(void) {
}
const char * message = hasFirmwareErrorFlag ? getFirmwareError() : getWarningMessage();
const char * message = hasFirmwareErrorFlag ? getCriticalErrorMessage() : getWarningMessage();
memcpy(buffer, message, engineConfiguration->HD44780width);
buffer[engineConfiguration->HD44780width] = 0;
lcd_HD44780_set_position(engineConfiguration->HD44780height - 1, 0);
@ -309,7 +309,7 @@ void updateHD44780lcd(void) {
// lcd_HD44780_print_string(buffer);
//
// if (hasFirmwareError()) {
// memcpy(buffer, getFirmwareError(), LCD_WIDTH);
// memcpy(buffer, getCriticalErrorMessage(), LCD_WIDTH);
// buffer[LCD_WIDTH] = 0;
// lcd_HD44780_set_position(1, 0);
// lcd_HD44780_print_string(buffer);