console usability: engine sniffer jitter fix #780

This commit is contained in:
rusefi 2019-05-02 18:42:59 -04:00
parent 63b7ee7496
commit 762feb1b03
9 changed files with 56 additions and 29 deletions

View File

@ -1,4 +1,4 @@
// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Thu May 02 11:21:08 EDT 2019 // this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Thu May 02 18:19:27 EDT 2019
// begin // begin
#ifndef ENGINE_CONFIGURATION_GENERATED_H_ #ifndef ENGINE_CONFIGURATION_GENERATED_H_
#define ENGINE_CONFIGURATION_GENERATED_H_ #define ENGINE_CONFIGURATION_GENERATED_H_
@ -754,13 +754,16 @@ typedef struct {
bool pauseEtbControl : 1; bool pauseEtbControl : 1;
/** /**
offset 144 bit 28 */ offset 144 bit 28 */
bool unused_board_984_28 : 1; bool alignEngineSnifferAtTDC : 1;
/** /**
offset 144 bit 29 */ offset 144 bit 29 */
bool unused_board_984_29 : 1; bool unused_board_984_29 : 1;
/** /**
offset 144 bit 30 */ offset 144 bit 30 */
bool unused_board_984_30 : 1; bool unused_board_984_30 : 1;
/**
offset 144 bit 31 */
bool unused_board_984_31 : 1;
/** /**
* offset 148 * offset 148
*/ */
@ -2716,4 +2719,4 @@ typedef struct {
#endif #endif
// end // end
// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Thu May 02 11:21:08 EDT 2019 // this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Thu May 02 18:19:27 EDT 2019

View File

@ -53,6 +53,8 @@
#define afterCrankingIACtaperDuration_offset_hex 808 #define afterCrankingIACtaperDuration_offset_hex 808
#define alFIn_offset 1540 #define alFIn_offset 1540
#define alFIn_offset_hex 604 #define alFIn_offset_hex 604
#define alignEngineSnifferAtTDC_offset 744
#define alignEngineSnifferAtTDC_offset_hex 2e8
#define alternatorControl_dFactor_offset 1744 #define alternatorControl_dFactor_offset 1744
#define alternatorControl_dFactor_offset_hex 6d0 #define alternatorControl_dFactor_offset_hex 6d0
#define alternatorControl_iFactor_offset 1740 #define alternatorControl_iFactor_offset 1740
@ -1750,12 +1752,12 @@
#define unused_bit_1472_29_offset_hex 5b8 #define unused_bit_1472_29_offset_hex 5b8
#define unused_bit_1472_30_offset 1464 #define unused_bit_1472_30_offset 1464
#define unused_bit_1472_30_offset_hex 5b8 #define unused_bit_1472_30_offset_hex 5b8
#define unused_board_984_28_offset 744
#define unused_board_984_28_offset_hex 2e8
#define unused_board_984_29_offset 744 #define unused_board_984_29_offset 744
#define unused_board_984_29_offset_hex 2e8 #define unused_board_984_29_offset_hex 2e8
#define unused_board_984_30_offset 744 #define unused_board_984_30_offset 744
#define unused_board_984_30_offset_hex 2e8 #define unused_board_984_30_offset_hex 2e8
#define unused_board_984_31_offset 744
#define unused_board_984_31_offset_hex 2e8
#define unusedAlignMaf_offset 557 #define unusedAlignMaf_offset 557
#define unusedAlignMaf_offset_hex 22d #define unusedAlignMaf_offset_hex 22d
#define unusedAnotherOne_offset 744 #define unusedAnotherOne_offset 744

View File

@ -807,6 +807,6 @@ int getRusEfiVersion(void) {
if (initBootloader() != 0) if (initBootloader() != 0)
return 123; return 123;
#endif /* EFI_BOOTLOADER_INCLUDE_CODE */ #endif /* EFI_BOOTLOADER_INCLUDE_CODE */
return 20190501; return 20190502;
} }
#endif /* EFI_UNIT_TEST */ #endif /* EFI_UNIT_TEST */

View File

@ -298,6 +298,9 @@ static char rpmBuffer[_MAX_FILLER];
*/ */
static void onTdcCallback(void) { static void onTdcCallback(void) {
itoa10(rpmBuffer, GET_RPM()); itoa10(rpmBuffer, GET_RPM());
#if EFI_ENGINE_SNIFFER
waveChart.startDataCollection();
#endif
addEngineSnifferEvent(TOP_DEAD_CENTER_MESSAGE, (char* ) rpmBuffer); addEngineSnifferEvent(TOP_DEAD_CENTER_MESSAGE, (char* ) rpmBuffer);
} }

View File

@ -12,6 +12,7 @@
#include <global.h> #include <global.h>
#include "scheduler.h" #include "scheduler.h"
// see TOP_DEAD_CENTER_MESSAGE in rusEfi console source code
#define TOP_DEAD_CENTER_MESSAGE "r" #define TOP_DEAD_CENTER_MESSAGE "r"
#define WC_DOWN "d" #define WC_DOWN "d"

View File

@ -40,7 +40,7 @@
#include "rfiutil.h" #include "rfiutil.h"
#include "histogram.h" #include "histogram.h"
static histogram_s engineSnifferHisto; static histogram_s engineSnifferHisto;
#endif #endif /* EFI_HISTOGRAMS */
EXTERN_ENGINE EXTERN_ENGINE
; ;
@ -56,6 +56,8 @@ extern uint32_t maxLockedDuration;
#define WAVE_LOGGING_SIZE 35000 #define WAVE_LOGGING_SIZE 35000
#endif #endif
static char WAVE_LOGGING_BUFFER[WAVE_LOGGING_SIZE] CCM_OPTIONAL;
int waveChartUsedSize; int waveChartUsedSize;
//#define DEBUG_WAVE 1 //#define DEBUG_WAVE 1
@ -79,6 +81,15 @@ static void resetNow(void) {
} }
#endif #endif
WaveChart::WaveChart() {
}
void WaveChart::init() {
logging.initLoggingExt("wave chart", WAVE_LOGGING_BUFFER, sizeof(WAVE_LOGGING_BUFFER));
isInitialized = true;
reset();
}
void WaveChart::reset() { void WaveChart::reset() {
#if DEBUG_WAVE #if DEBUG_WAVE
scheduleSimpleMsg(&debugLogging, "reset while at ", counter); scheduleSimpleMsg(&debugLogging, "reset while at ", counter);
@ -86,10 +97,13 @@ void WaveChart::reset() {
resetLogging(&logging); resetLogging(&logging);
counter = 0; counter = 0;
startTimeNt = 0; startTimeNt = 0;
collectingData = false;
appendPrintf(&logging, "wave_chart%s", DELIMETER); appendPrintf(&logging, "wave_chart%s", DELIMETER);
} }
static char WAVE_LOGGING_BUFFER[WAVE_LOGGING_SIZE] CCM_OPTIONAL; void WaveChart::startDataCollection() {
collectingData = true;
}
bool WaveChart::isStartedTooLongAgo() { bool WaveChart::isStartedTooLongAgo() {
/** /**
@ -134,18 +148,6 @@ void WaveChart::publishIfFull() {
} }
} }
WaveChart::WaveChart() {
isInitialized = false;
startTimeNt = 0;
counter = 0;
}
void WaveChart::init() {
logging.initLoggingExt("wave chart", WAVE_LOGGING_BUFFER, sizeof(WAVE_LOGGING_BUFFER));
isInitialized = true;
reset();
}
void WaveChart::publish() { void WaveChart::publish() {
appendPrintf(&logging, DELIMETER); appendPrintf(&logging, DELIMETER);
waveChartUsedSize = loggingSize(&logging); waveChartUsedSize = loggingSize(&logging);
@ -169,16 +171,23 @@ void WaveChart::addEvent3(const char *name, const char * msg) {
} }
if (skipUntilEngineCycle != 0 && ENGINE(rpmCalculator.getRevolutionCounter()) < skipUntilEngineCycle) if (skipUntilEngineCycle != 0 && ENGINE(rpmCalculator.getRevolutionCounter()) < skipUntilEngineCycle)
return; return;
#if EFI_SIMULATOR
// todo: add UI control to enable this for firmware if desired
// CONFIG(alignEngineSnifferAtTDC) &&
if (!collectingData) {
return;
}
#endif
efiAssertVoid(CUSTOM_ERR_6651, name!=NULL, "WC: NULL name"); efiAssertVoid(CUSTOM_ERR_6651, name!=NULL, "WC: NULL name");
#if EFI_PROD_CODE #if EFI_PROD_CODE
efiAssertVoid(CUSTOM_ERR_6652, getCurrentRemainingStack() > 32, "lowstck#2c"); efiAssertVoid(CUSTOM_ERR_6652, getCurrentRemainingStack() > 32, "lowstck#2c");
#endif #endif /* EFI_PROD_CODE */
efiAssertVoid(CUSTOM_ERR_6653, isInitialized, "chart not initialized"); efiAssertVoid(CUSTOM_ERR_6653, isInitialized, "chart not initialized");
#if DEBUG_WAVE #if DEBUG_WAVE
scheduleSimpleMsg(&debugLogging, "current", chart->counter); scheduleSimpleMsg(&debugLogging, "current", chart->counter);
#endif #endif /* DEBUG_WAVE */
if (isFull()) { if (isFull()) {
return; return;
} }

View File

@ -23,6 +23,7 @@ public:
void init(); void init();
void addEvent3(const char *name, const char *msg); void addEvent3(const char *name, const char *msg);
void reset(); void reset();
void startDataCollection();
void publishIfFull(); void publishIfFull();
void publish(); void publish();
bool isFull(); bool isFull();
@ -30,9 +31,14 @@ public:
private: private:
Logging logging; Logging logging;
char timeBuffer[10]; char timeBuffer[10];
uint32_t counter; uint32_t counter = 0;
efitime_t startTimeNt; /**
volatile int isInitialized; * We want to avoid visual jitter thus we want the left edge to be aligned
* https://github.com/rusefi/rusefi/issues/780
*/
bool collectingData = false;
efitime_t startTimeNt = 0;
volatile int isInitialized = false;
}; };
void initWaveChart(WaveChart *chart); void initWaveChart(WaveChart *chart);

View File

@ -599,9 +599,10 @@ bit is_enabled_spi_2
bit useTPSBasedVeTable bit useTPSBasedVeTable
bit is_enabled_spi_4 bit is_enabled_spi_4
bit pauseEtbControl bit pauseEtbControl
bit unused_board_984_28 bit alignEngineSnifferAtTDC
bit unused_board_984_29 bit unused_board_984_29
bit unused_board_984_30 bit unused_board_984_30
bit unused_board_984_31
brain_input_pin_e[LOGIC_ANALYZER_CHANNEL_COUNT iterate] logicAnalyzerPins; brain_input_pin_e[LOGIC_ANALYZER_CHANNEL_COUNT iterate] logicAnalyzerPins;
pin_output_mode_e mainRelayPinMode; pin_output_mode_e mainRelayPinMode;

View File

@ -1,6 +1,6 @@
package com.rusefi.config; package com.rusefi.config;
// this file was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Thu May 02 11:21:08 EDT 2019 // this file was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Thu May 02 18:19:27 EDT 2019
public class Fields { public class Fields {
public static final int accelerometerSpiDevice_offset = 2736; public static final int accelerometerSpiDevice_offset = 2736;
public static final int acCutoffHighRpm_offset = 1498; public static final int acCutoffHighRpm_offset = 1498;
@ -36,6 +36,7 @@ public class Fields {
public static final int afterCrankingIACtaperDuration_offset_hex = 808; public static final int afterCrankingIACtaperDuration_offset_hex = 808;
public static final int alFIn_offset = 1540; public static final int alFIn_offset = 1540;
public static final int alFIn_offset_hex = 604; public static final int alFIn_offset_hex = 604;
public static final int alignEngineSnifferAtTDC_offset = 744;
public static final int alternatorControl_dFactor_offset = 1744; public static final int alternatorControl_dFactor_offset = 1744;
public static final int alternatorControl_iFactor_offset = 1740; public static final int alternatorControl_iFactor_offset = 1740;
public static final int alternatorControl_maxValue_offset = 1754; public static final int alternatorControl_maxValue_offset = 1754;
@ -1128,9 +1129,9 @@ public class Fields {
public static final int unused_1484_bit_21_offset = 1476; public static final int unused_1484_bit_21_offset = 1476;
public static final int unused_bit_1472_29_offset = 1464; public static final int unused_bit_1472_29_offset = 1464;
public static final int unused_bit_1472_30_offset = 1464; public static final int unused_bit_1472_30_offset = 1464;
public static final int unused_board_984_28_offset = 744;
public static final int unused_board_984_29_offset = 744; public static final int unused_board_984_29_offset = 744;
public static final int unused_board_984_30_offset = 744; public static final int unused_board_984_30_offset = 744;
public static final int unused_board_984_31_offset = 744;
public static final int unusedAlignMaf_offset = 557; public static final int unusedAlignMaf_offset = 557;
public static final int unusedAnotherOne_offset = 744; public static final int unusedAnotherOne_offset = 744;
public static final int unusedAtBoardConfigurationEnd_offset = 972; public static final int unusedAtBoardConfigurationEnd_offset = 972;
@ -1486,9 +1487,10 @@ public class Fields {
public static final Field USETPSBASEDVETABLE = Field.create("USETPSBASEDVETABLE", 744, FieldType.BIT, 25); public static final Field USETPSBASEDVETABLE = Field.create("USETPSBASEDVETABLE", 744, FieldType.BIT, 25);
public static final Field IS_ENABLED_SPI_4 = Field.create("IS_ENABLED_SPI_4", 744, FieldType.BIT, 26); public static final Field IS_ENABLED_SPI_4 = Field.create("IS_ENABLED_SPI_4", 744, FieldType.BIT, 26);
public static final Field PAUSEETBCONTROL = Field.create("PAUSEETBCONTROL", 744, FieldType.BIT, 27); public static final Field PAUSEETBCONTROL = Field.create("PAUSEETBCONTROL", 744, FieldType.BIT, 27);
public static final Field UNUSED_BOARD_984_28 = Field.create("UNUSED_BOARD_984_28", 744, FieldType.BIT, 28); public static final Field ALIGNENGINESNIFFERATTDC = Field.create("ALIGNENGINESNIFFERATTDC", 744, FieldType.BIT, 28);
public static final Field UNUSED_BOARD_984_29 = Field.create("UNUSED_BOARD_984_29", 744, FieldType.BIT, 29); public static final Field UNUSED_BOARD_984_29 = Field.create("UNUSED_BOARD_984_29", 744, FieldType.BIT, 29);
public static final Field UNUSED_BOARD_984_30 = Field.create("UNUSED_BOARD_984_30", 744, FieldType.BIT, 30); public static final Field UNUSED_BOARD_984_30 = Field.create("UNUSED_BOARD_984_30", 744, FieldType.BIT, 30);
public static final Field UNUSED_BOARD_984_31 = Field.create("UNUSED_BOARD_984_31", 744, FieldType.BIT, 31);
public static final Field LOGICANALYZERPINS1 = Field.create("LOGICANALYZERPINS1", 748, FieldType.INT8, brain_input_pin_e); public static final Field LOGICANALYZERPINS1 = Field.create("LOGICANALYZERPINS1", 748, FieldType.INT8, brain_input_pin_e);
public static final Field LOGICANALYZERPINS2 = Field.create("LOGICANALYZERPINS2", 749, FieldType.INT8, brain_input_pin_e); public static final Field LOGICANALYZERPINS2 = Field.create("LOGICANALYZERPINS2", 749, FieldType.INT8, brain_input_pin_e);
public static final Field LOGICANALYZERPINS3 = Field.create("LOGICANALYZERPINS3", 750, FieldType.INT8, brain_input_pin_e); public static final Field LOGICANALYZERPINS3 = Field.create("LOGICANALYZERPINS3", 750, FieldType.INT8, brain_input_pin_e);