rusEFI
The most advanced open source ECU
Enumerations | Functions | Variables
sensor_chart.cpp File Reference

Detailed Description

Date
Dec 20, 2013
Author
Andrey Belomutskiy, (c) 2012-2020

Definition in file sensor_chart.cpp.

Enumerations

enum class  ScState { PreArm , Armed , Logging , Full }
 

Functions

void scAddData (float angle, float value)
 
void initSensorChart (void)
 
void publishSensorChartIfFull ()
 

Variables

static char LOGGING_BUFFER[SC_BUFFER_SIZE] CCM_OPTIONAL
 
static Logging scLogging ("analog chart", LOGGING_BUFFER, sizeof(LOGGING_BUFFER))
 
static int initialized = false
 
static ScState state = ScState::PreArm
 
static uint32_t lastRevCount = 0
 

Enumeration Type Documentation

◆ ScState

enum ScState
strong
Enumerator
PreArm 
Armed 
Logging 
Full 

Definition at line 22 of file sensor_chart.cpp.

22  {
23  PreArm,
24  Armed,
25  Logging,
26  Full
27 };

Function Documentation

◆ initSensorChart()

void initSensorChart ( void  )

Definition at line 76 of file sensor_chart.cpp.

76  {
77 #if EFI_SIMULATOR
78  printf("initSensorChart\n");
79 #endif
80 
81  initialized = true;
82 }
static int initialized
printf("\n")

Referenced by commonInitEngineController().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ publishSensorChartIfFull()

void publishSensorChartIfFull ( )

Definition at line 84 of file sensor_chart.cpp.

84  {
85  if (state != ScState::Full) {
86  return;
87  }
88 
89  scLogging.appendPrintf(LOG_DELIMITER);
91 
93 }
void appendPrintf(const char *fmt,...)
Definition: datalogging.cpp:80
void scheduleLogging(Logging *logging)
static Logging scLogging("analog chart", LOGGING_BUFFER, sizeof(LOGGING_BUFFER))
static ScState state

Referenced by printOverallStatus().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ scAddData()

void scAddData ( float  angle,
float  value 
)

Definition at line 32 of file sensor_chart.cpp.

32  {
33 #if EFI_TEXT_LOGGING
34  if (!initialized) {
35  return; // this is possible because of initialization sequence
36  }
37 
38  // Don't log if we need a flush
39  if (state == ScState::Full) {
40  return;
41  }
42 
43  auto currentRev = getRevolutionCounter();
44 
45  if (state == ScState::PreArm) {
46  // nothing to do - we just need to grab the rev counter once so we can detect a change
48  } else if (state == ScState::Armed) {
49  // If armed, wait for a NEW revolution to start
50  if (lastRevCount != currentRev) {
52 
53  // Reset logging and append header
54  scLogging.reset();
55  scLogging.appendPrintf(PROTOCOL_ANALOG_CHART LOG_DELIMITER);
56  }
57  } else if (state == ScState::Logging) {
58  // If running and the revolution idx changes, terminate logging and wait for flush
59  if (lastRevCount != currentRev) {
61  }
62  }
63 
64  lastRevCount = currentRev;
65 
66  if (state == ScState::Logging) {
67  if (scLogging.remainingSize() > 100) {
68  scLogging.appendPrintf( "%.2f|%.2f|", angle, value);
69  } else {
71  }
72  }
73 #endif /* EFI_TEXT_LOGGING */
74 }
size_t remainingSize() const
Definition: datalogging.h:45
void reset()
static uint32_t lastRevCount

Referenced by onFastAdcComplete(), rpmShaftPositionCallback(), and InstantRpmCalculator::updateInstantRpm().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ CCM_OPTIONAL

char LOGGING_BUFFER [SC_BUFFER_SIZE] CCM_OPTIONAL
static

Definition at line 16 of file sensor_chart.cpp.

◆ initialized

int initialized = false
static

Definition at line 20 of file sensor_chart.cpp.

Referenced by configureHellenCanTerminator(), initSensorChart(), and scAddData().

◆ lastRevCount

uint32_t lastRevCount = 0
static

Definition at line 30 of file sensor_chart.cpp.

Referenced by scAddData().

◆ scLogging

Logging scLogging("analog chart", LOGGING_BUFFER, sizeof(LOGGING_BUFFER)) ( "analog chart"  ,
LOGGING_BUFFER  ,
sizeof(LOGGING_BUFFER)   
)
static

◆ state

ScState state = ScState::PreArm
static

Go to the source code of this file.