auto-sync

This commit is contained in:
rusEfi 2017-01-12 09:02:19 -05:00
parent 8c2734479f
commit 5e7d9127db
3 changed files with 13 additions and 5 deletions

View File

@ -57,7 +57,7 @@ static void ensureInitialized(WaveReader *reader) {
static void waAnaWidthCallback(WaveReader *reader) { static void waAnaWidthCallback(WaveReader *reader) {
efitick_t nowUs = getTimeNowUs(); efitick_t nowUs = getTimeNowUs();
reader->eventCounter++; reader->riseEventCounter++;
reader->lastActivityTimeUs = nowUs; reader->lastActivityTimeUs = nowUs;
addEngineSniffferEvent(reader->name, WC_UP); addEngineSniffferEvent(reader->name, WC_UP);
@ -70,7 +70,7 @@ static void waAnaWidthCallback(WaveReader *reader) {
void WaveReader::onFallEvent() { void WaveReader::onFallEvent() {
efitick_t nowUs = getTimeNowUs(); efitick_t nowUs = getTimeNowUs();
eventCounter++; fallEventCounter++;
lastActivityTimeUs = nowUs; lastActivityTimeUs = nowUs;
addEngineSniffferEvent(name, WC_DOWN); addEngineSniffferEvent(name, WC_DOWN);
@ -140,7 +140,7 @@ WaveReader::WaveReader() {
hw = NULL; hw = NULL;
last_wave_high_widthUs = 0; last_wave_high_widthUs = 0;
name = NULL; name = NULL;
eventCounter = 0; fallEventCounter = riseEventCounter = 0;
currentRevolutionCounter = 0; currentRevolutionCounter = 0;
prevTotalOnTimeUs = 0; prevTotalOnTimeUs = 0;
totalOnTimeAccumulatorUs = 0; totalOnTimeAccumulatorUs = 0;
@ -254,6 +254,10 @@ void printWave(Logging *logging) {
reportWave(logging, 1); reportWave(logging, 1);
} }
void showWaveInfo(void) {
scheduleMsg(logger, "logic input #1: %d/%d", readers[0].fallEventCounter, readers[0].riseEventCounter);
}
void initWaveAnalyzer(Logging *sharedLogger) { void initWaveAnalyzer(Logging *sharedLogger) {
logger = sharedLogger; logger = sharedLogger;
if (hasFirmwareError()) { if (hasFirmwareError()) {
@ -265,6 +269,8 @@ void initWaveAnalyzer(Logging *sharedLogger) {
addTriggerEventListener(waTriggerEventListener, "wave analyzer", engine); addTriggerEventListener(waTriggerEventListener, "wave analyzer", engine);
addConsoleAction("waveinfo", showWaveInfo);
addConsoleActionII("set_logic_input_mode", setWaveModeSilent); addConsoleActionII("set_logic_input_mode", setWaveModeSilent);
chThdCreateStatic(waThreadStack, sizeof(waThreadStack), NORMALPRIO, (tfunc_t)waThread, NULL); chThdCreateStatic(waThreadStack, sizeof(waThreadStack), NORMALPRIO, (tfunc_t)waThread, NULL);

View File

@ -30,7 +30,8 @@ public:
digital_input_s *hw; digital_input_s *hw;
const char *name; const char *name;
volatile int eventCounter; volatile int fallEventCounter;
volatile int riseEventCounter;
int currentRevolutionCounter; int currentRevolutionCounter;
@ -60,6 +61,7 @@ public:
void initWaveAnalyzer(Logging *sharedLogger); void initWaveAnalyzer(Logging *sharedLogger);
void printWave(Logging *logging); void printWave(Logging *logging);
void showWaveInfo(void);
#endif #endif

View File

@ -249,5 +249,5 @@ int getRusEfiVersion(void) {
return 123; // this is here to make the compiler happy about the unused array return 123; // this is here to make the compiler happy about the unused array
if (UNUSED_CCM_SIZE[0] * 0 != 0) if (UNUSED_CCM_SIZE[0] * 0 != 0)
return 3211; // this is here to make the compiler happy about the unused array return 3211; // this is here to make the compiler happy about the unused array
return 20170111; return 20170112;
} }