console usability: engine sniffer jitter fix #780

This commit is contained in:
rusefi 2019-05-02 18:42:59 -04:00
parent f02207735a
commit f534fd0e67
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
#ifndef ENGINE_CONFIGURATION_GENERATED_H_
#define ENGINE_CONFIGURATION_GENERATED_H_
@ -754,13 +754,16 @@ typedef struct {
bool pauseEtbControl : 1;
/**
offset 144 bit 28 */
bool unused_board_984_28 : 1;
bool alignEngineSnifferAtTDC : 1;
/**
offset 144 bit 29 */
bool unused_board_984_29 : 1;
/**
offset 144 bit 30 */
bool unused_board_984_30 : 1;
/**
offset 144 bit 31 */
bool unused_board_984_31 : 1;
/**
* offset 148
*/
@ -2716,4 +2719,4 @@ typedef struct {
#endif
// 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 alFIn_offset 1540
#define alFIn_offset_hex 604
#define alignEngineSnifferAtTDC_offset 744
#define alignEngineSnifferAtTDC_offset_hex 2e8
#define alternatorControl_dFactor_offset 1744
#define alternatorControl_dFactor_offset_hex 6d0
#define alternatorControl_iFactor_offset 1740
@ -1750,12 +1752,12 @@
#define unused_bit_1472_29_offset_hex 5b8
#define unused_bit_1472_30_offset 1464
#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_hex 2e8
#define unused_board_984_30_offset 744
#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_hex 22d
#define unusedAnotherOne_offset 744

View File

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

View File

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

View File

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

View File

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

View File

@ -23,6 +23,7 @@ public:
void init();
void addEvent3(const char *name, const char *msg);
void reset();
void startDataCollection();
void publishIfFull();
void publish();
bool isFull();
@ -30,9 +31,14 @@ public:
private:
Logging logging;
char timeBuffer[10];
uint32_t counter;
efitime_t startTimeNt;
volatile int isInitialized;
uint32_t counter = 0;
/**
* 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);

View File

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

View File

@ -1,6 +1,6 @@
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 static final int accelerometerSpiDevice_offset = 2736;
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 alFIn_offset = 1540;
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_iFactor_offset = 1740;
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_bit_1472_29_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_30_offset = 744;
public static final int unused_board_984_31_offset = 744;
public static final int unusedAlignMaf_offset = 557;
public static final int unusedAnotherOne_offset = 744;
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 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 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_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 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);