Revert "debug channels cleanup"

This reverts commit 3b0d033dcd.
This commit is contained in:
Matthew Kennedy 2023-09-13 15:40:21 -07:00
parent 900bc092de
commit 7ff224da12
4 changed files with 36 additions and 1 deletions

View File

@ -731,6 +731,11 @@ DcHardware *getdcHardware();
tle8888PostState(); tle8888PostState();
#endif /* BOARD_TLE8888_COUNT */ #endif /* BOARD_TLE8888_COUNT */
break; break;
case DBG_LOGIC_ANALYZER:
#if EFI_LOGIC_ANALYZER
reportLogicAnalyzerToTS();
#endif /* EFI_LOGIC_ANALYZER */
break;
default: default:
; ;
} }

View File

@ -273,7 +273,7 @@ typedef enum __attribute__ ((__packed__)) {
DBG_UNUSED_42 = 42, DBG_UNUSED_42 = 42,
DBG_43 = 43, DBG_43 = 43,
DBG_DYNO_VIEW = 44, DBG_DYNO_VIEW = 44,
DBG_45 = 45, DBG_LOGIC_ANALYZER = 45,
DBG_46 = 46, DBG_46 = 46,
DBG_TCU = 47, DBG_TCU = 47,
DBG_LUA = 48, DBG_LUA = 48,

View File

@ -257,4 +257,33 @@ void stopLogicAnalyzerPins() {
} }
} }
template <typename TFreq>
static void getChannelFreqAndDuty(int index, float& duty, TFreq& freq) {
if (readers[index].line == 0) {
duty = 0.0;
freq = 0;
} else {
float high = getSignalOnTime(index);
float period = getSignalPeriodMs(index);
if (period != 0) {
duty = (high * 1000.0f) /(period * 10.0f);
freq = (int)(1 / (period / 1000.0f));
} else {
duty = 0.0;
freq = 0;
}
}
}
void reportLogicAnalyzerToTS() {
#if EFI_TUNER_STUDIO
getChannelFreqAndDuty(0, engine->outputChannels.debugFloatField1, engine->outputChannels.debugIntField1);
getChannelFreqAndDuty(1, engine->outputChannels.debugFloatField2, engine->outputChannels.debugIntField2);
getChannelFreqAndDuty(2, engine->outputChannels.debugFloatField3, engine->outputChannels.debugIntField3);
getChannelFreqAndDuty(3, engine->outputChannels.debugFloatField4, engine->outputChannels.debugIntField4);
#endif
}
#endif /* EFI_LOGIC_ANALYZER */ #endif /* EFI_LOGIC_ANALYZER */

View File

@ -18,6 +18,7 @@ void startLogicAnalyzerPins();
void stopLogicAnalyzerPins(); void stopLogicAnalyzerPins();
void printWave(Logging *logging); void printWave(Logging *logging);
void showWaveInfo(void); void showWaveInfo(void);
void reportLogicAnalyzerToTS(void);
void waTriggerEventListener(trigger_event_e ckpSignalType, uint32_t index, efitick_t edgeTimestamp); void waTriggerEventListener(trigger_event_e ckpSignalType, uint32_t index, efitick_t edgeTimestamp);