Merge branch 'master' of https://github.com/rusefi/rusefi
This commit is contained in:
commit
1330c79c86
|
@ -9,6 +9,7 @@
|
|||
#ifndef AUDI_AAN_H_
|
||||
#define AUDI_AAN_H_
|
||||
|
||||
#include "global.h"
|
||||
#if EFI_ENGINE_AUDI_AAN
|
||||
|
||||
#endif /* EFI_ENGINE_AUDI_AAN */
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
#ifndef SNOW_BLOWER_H_
|
||||
#define SNOW_BLOWER_H_
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#if EFI_ENGINE_SNOW_BLOWER
|
||||
|
||||
#endif /* EFI_ENGINE_SNOW_BLOWER */
|
||||
|
|
|
@ -17,18 +17,12 @@
|
|||
#include <chprintf.h>
|
||||
static MemoryStream warningStream;
|
||||
static MemoryStream firmwareErrorMessageStream;
|
||||
extern OutputPin communicationPin;
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* EFI_SIMULATOR || EFI_PROD_CODE */
|
||||
|
||||
#define WARNING_BUFFER_SIZE 80
|
||||
static char warningBuffer[WARNING_BUFFER_SIZE];
|
||||
static bool isWarningStreamInitialized = false;
|
||||
|
||||
|
||||
|
||||
|
||||
#if EFI_HD44780_LCD || defined(__DOXYGEN__)
|
||||
#include "lcd_HD44780.h"
|
||||
#endif /* EFI_HD44780_LCD */
|
||||
|
@ -95,15 +89,18 @@ void addWarningCode(obd_code_e code) {
|
|||
engine->engineState.lastErrorCode = code;
|
||||
}
|
||||
|
||||
// todo: look into chsnprintf
|
||||
// todo: move to some util file & reuse for 'firmwareError' method
|
||||
void printToStream(MemoryStream *stream, const char *fmt, va_list ap) {
|
||||
stream->eos = 0; // reset
|
||||
chvprintf((BaseSequentialStream *) stream, fmt, ap);
|
||||
stream->buffer[stream->eos] = 0;
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
int unitTestWarningCounter = 0;
|
||||
|
||||
#endif /* EFI_SIMULATOR || EFI_PROD_CODE */
|
||||
|
||||
int warningCounter = 0;
|
||||
|
||||
/**
|
||||
* OBD_PCM_Processor_Fault is the general error code for now
|
||||
|
@ -141,7 +138,7 @@ bool warning(obd_code_e code, const char *fmt, ...) {
|
|||
append(&logger, DELIMETER);
|
||||
scheduleLogging(&logger);
|
||||
#else
|
||||
warningCounter++;
|
||||
unitTestWarningCounter++;
|
||||
printf("unit_test_warning: ");
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
|
@ -199,6 +196,7 @@ void firmwareError(obd_code_e code, const char *fmt, ...) {
|
|||
strncpy((char*) errorMessageBuffer, fmt, sizeof(errorMessageBuffer) - 1);
|
||||
errorMessageBuffer[sizeof(errorMessageBuffer) - 1] = 0; // just to be sure
|
||||
} else {
|
||||
// todo: look into chsnprintf once on Chibios 3
|
||||
firmwareErrorMessageStream.eos = 0; // reset
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
|
|
|
@ -181,7 +181,7 @@ void rpmShaftPositionCallback(trigger_event_e ckpSignalType,
|
|||
efitick_t nowNt = getTimeNowNt();
|
||||
engine->m.beforeRpmCb = GET_TIMESTAMP();
|
||||
#if EFI_PROD_CODE
|
||||
efiAssertVoid(getRemainingStack(chThdSelf()) > 256, "lowstck#2z");
|
||||
efiAssertVoid(getRemainingStack(chThdGetSelfX()) > 256, "lowstck#2z");
|
||||
#endif
|
||||
|
||||
#if EFI_SENSOR_CHART || defined(__DOXYGEN__)
|
||||
|
|
|
@ -170,7 +170,7 @@ void hwHandleShaftSignal(trigger_event_e signal) {
|
|||
if (triggerReentraint > maxTriggerReentraint)
|
||||
maxTriggerReentraint = triggerReentraint;
|
||||
triggerReentraint++;
|
||||
efiAssertVoid(getRemainingStack(chThdSelf()) > 128, "lowstck#8");
|
||||
efiAssertVoid(getRemainingStack(chThdGetSelfX()) > 128, "lowstck#8");
|
||||
engine->triggerCentral.handleShaftSignal(signal PASS_ENGINE_PARAMETER);
|
||||
triggerReentraint--;
|
||||
triggerDuration = GET_TIMESTAMP() - triggerHanlderEntryTime;
|
||||
|
|
|
@ -483,7 +483,7 @@ static TriggerState initState CCM_OPTIONAL;
|
|||
void TriggerShape::initializeTriggerShape(Logging *logger DECLARE_ENGINE_PARAMETER_S) {
|
||||
const trigger_config_s *triggerConfig = &engineConfiguration->trigger;
|
||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
||||
efiAssertVoid(getRemainingStack(chThdSelf()) > 256, "init t");
|
||||
efiAssertVoid(getRemainingStack(chThdGetSelfX()) > 256, "init t");
|
||||
scheduleMsg(logger, "initializeTriggerShape(%s/%d)", getTrigger_type_e(triggerConfig->type), (int) triggerConfig->type);
|
||||
#endif
|
||||
|
||||
|
@ -676,7 +676,7 @@ static void onFindIndex(TriggerState *state) {
|
|||
uint32_t findTriggerZeroEventIndex(TriggerState *state, TriggerShape * shape,
|
||||
trigger_config_s const*triggerConfig DECLARE_ENGINE_PARAMETER_S) {
|
||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
||||
efiAssert(getRemainingStack(chThdSelf()) > 128, "findPos", -1);
|
||||
efiAssert(getRemainingStack(chThdGetSelfX()) > 128, "findPos", -1);
|
||||
#endif
|
||||
isInitializingTrigger = true;
|
||||
errorDetection.clear();
|
||||
|
|
|
@ -44,7 +44,7 @@ TriggerShape::TriggerShape() :
|
|||
|
||||
void TriggerShape::calculateTriggerSynchPoint(TriggerState *state DECLARE_ENGINE_PARAMETER_S) {
|
||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
||||
efiAssertVoid(getRemainingStack(chThdSelf()) > 256, "calc s");
|
||||
efiAssertVoid(getRemainingStack(chThdGetSelfX()) > 256, "calc s");
|
||||
#endif
|
||||
trigger_config_s const*triggerConfig = &engineConfiguration->trigger;
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
#include "main.h"
|
||||
#include "lis302dl.h"
|
||||
//#include "lis302dl.h"
|
||||
|
||||
void initAccelerometer(DECLARE_ENGINE_PARAMETER_F) {
|
||||
|
||||
|
|
|
@ -148,7 +148,7 @@ AdcDevice fastAdc(&adcgrpcfg_fast);
|
|||
|
||||
void doSlowAdc(void) {
|
||||
|
||||
efiAssertVoid(getRemainingStack(chThdSelf())> 32, "lwStAdcSlow");
|
||||
efiAssertVoid(getRemainingStack(chThdGetSelfX())> 32, "lwStAdcSlow");
|
||||
|
||||
#if EFI_INTERNAL_ADC
|
||||
|
||||
|
@ -156,19 +156,19 @@ void doSlowAdc(void) {
|
|||
will be executed in parallel to the current PWM cycle and will
|
||||
terminate before the next PWM cycle.*/
|
||||
slowAdc.conversionCount++;
|
||||
chSysLockFromIsr()
|
||||
chSysLockFromISR()
|
||||
;
|
||||
if (ADC_SLOW_DEVICE.state != ADC_READY &&
|
||||
ADC_SLOW_DEVICE.state != ADC_COMPLETE &&
|
||||
ADC_SLOW_DEVICE.state != ADC_ERROR) {
|
||||
// todo: why and when does this happen? firmwareError(OBD_PCM_Processor_Fault, "ADC slow not ready?");
|
||||
slowAdc.errorsCount++;
|
||||
chSysUnlockFromIsr()
|
||||
chSysUnlockFromISR()
|
||||
;
|
||||
return;
|
||||
}
|
||||
adcStartConversionI(&ADC_SLOW_DEVICE, &adcgrpcfgSlow, slowAdc.samples, ADC_BUF_DEPTH_SLOW);
|
||||
chSysUnlockFromIsr()
|
||||
chSysUnlockFromISR()
|
||||
;
|
||||
#endif
|
||||
}
|
||||
|
@ -179,7 +179,7 @@ static void pwmpcb_slow(PWMDriver *pwmp) {
|
|||
}
|
||||
|
||||
static void pwmpcb_fast(PWMDriver *pwmp) {
|
||||
efiAssertVoid(getRemainingStack(chThdSelf())> 32, "lwStAdcFast");
|
||||
efiAssertVoid(getRemainingStack(chThdGetSelfX())> 32, "lwStAdcFast");
|
||||
#if EFI_INTERNAL_ADC
|
||||
(void) pwmp;
|
||||
|
||||
|
@ -188,19 +188,19 @@ static void pwmpcb_fast(PWMDriver *pwmp) {
|
|||
* will be executed in parallel to the current PWM cycle and will
|
||||
* terminate before the next PWM cycle.
|
||||
*/
|
||||
chSysLockFromIsr()
|
||||
chSysLockFromISR()
|
||||
;
|
||||
if (ADC_FAST_DEVICE.state != ADC_READY &&
|
||||
ADC_FAST_DEVICE.state != ADC_COMPLETE &&
|
||||
ADC_FAST_DEVICE.state != ADC_ERROR) {
|
||||
fastAdc.errorsCount++;
|
||||
// todo: when? why? firmwareError(OBD_PCM_Processor_Fault, "ADC fast not ready?");
|
||||
chSysUnlockFromIsr()
|
||||
chSysUnlockFromISR()
|
||||
;
|
||||
return;
|
||||
}
|
||||
adcStartConversionI(&ADC_FAST_DEVICE, &adcgrpcfg_fast, fastAdc.samples, ADC_BUF_DEPTH_FAST);
|
||||
chSysUnlockFromIsr()
|
||||
chSysUnlockFromISR()
|
||||
;
|
||||
fastAdc.conversionCount++;
|
||||
#endif
|
||||
|
@ -483,7 +483,7 @@ static void setAdcDebugReporting(int value) {
|
|||
static void adc_callback_slow(ADCDriver *adcp, adcsample_t *buffer, size_t n) {
|
||||
(void) buffer;
|
||||
(void) n;
|
||||
efiAssertVoid(getRemainingStack(chThdSelf()) > 128, "lowstck#9c");
|
||||
efiAssertVoid(getRemainingStack(chThdGetSelfX()) > 128, "lowstck#9c");
|
||||
/* Note, only in the ADC_COMPLETE state because the ADC driver fires
|
||||
* an intermediate callback when the buffer is half full. */
|
||||
if (adcp->state == ADC_COMPLETE) {
|
||||
|
|
|
@ -102,9 +102,10 @@ void appendFast(Logging *logging, const char *text) {
|
|||
logging->linePointer += extraLen;
|
||||
}
|
||||
|
||||
// todo: look into chsnprintf once on Chibios 3
|
||||
static void vappendPrintfI(Logging *logging, const char *fmt, va_list arg) {
|
||||
intermediateLoggingBuffer.eos = 0; // reset
|
||||
efiAssertVoid(getRemainingStack(chThdSelf()) > 128, "lowstck#1b");
|
||||
efiAssertVoid(getRemainingStack(chThdGetSelfX()) > 128, "lowstck#1b");
|
||||
chvprintf((BaseSequentialStream *) &intermediateLoggingBuffer, fmt, arg);
|
||||
intermediateLoggingBuffer.buffer[intermediateLoggingBuffer.eos] = 0; // need to terminate explicitly
|
||||
append(logging, (char *) intermediateLoggingBufferData);
|
||||
|
@ -114,7 +115,7 @@ static void vappendPrintfI(Logging *logging, const char *fmt, va_list arg) {
|
|||
* this method acquires system lock to guard the shared intermediateLoggingBuffer memory stream
|
||||
*/
|
||||
void vappendPrintf(Logging *logging, const char *fmt, va_list arg) {
|
||||
efiAssertVoid(getRemainingStack(chThdSelf()) > 128, "lowstck#5b");
|
||||
efiAssertVoid(getRemainingStack(chThdGetSelfX()) > 128, "lowstck#5b");
|
||||
if (!intermediateLoggingBufferInited) {
|
||||
firmwareError(CUSTOM_ERR_6532, "intermediateLoggingBufferInited not inited!");
|
||||
return;
|
||||
|
@ -127,7 +128,7 @@ void vappendPrintf(Logging *logging, const char *fmt, va_list arg) {
|
|||
}
|
||||
|
||||
void appendPrintf(Logging *logging, const char *fmt, ...) {
|
||||
efiAssertVoid(getRemainingStack(chThdSelf()) > 128, "lowstck#4");
|
||||
efiAssertVoid(getRemainingStack(chThdGetSelfX()) > 128, "lowstck#4");
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
vappendPrintf(logging, fmt, ap);
|
||||
|
@ -252,7 +253,7 @@ void resetLogging(Logging *logging) {
|
|||
* This method should only be invoked on main thread because only the main thread can write to the console
|
||||
*/
|
||||
void printMsg(Logging *logger, const char *fmt, ...) {
|
||||
efiAssertVoid(getRemainingStack(chThdSelf()) > 128, "lowstck#5o");
|
||||
efiAssertVoid(getRemainingStack(chThdGetSelfX()) > 128, "lowstck#5o");
|
||||
// resetLogging(logging); // I guess 'reset' is not needed here?
|
||||
appendMsgPrefix(logger);
|
||||
|
||||
|
|
|
@ -5,8 +5,8 @@ UTILSRC = $(PROJECT_DIR)/util/crc.c \
|
|||
$(PROJECT_DIR)/util/histogram.c
|
||||
|
||||
UTILSRC_CPP = $(PROJECT_DIR)/util/cyclic_buffer.cpp \
|
||||
$(PROJECT_DIR)/console_util/datalogging.cpp \
|
||||
$(PROJECT_DIR)/console_util/loggingcentral.cpp \
|
||||
$(PROJECT_DIR)/util/datalogging.cpp \
|
||||
$(PROJECT_DIR)/util/loggingcentral.cpp \
|
||||
$(PROJECT_DIR)/util/listener_array.cpp \
|
||||
$(PROJECT_DIR)/util/cli_registry.cpp \
|
||||
$(PROJECT_DIR)/util/efilib.cpp \
|
||||
|
|
|
@ -18,11 +18,11 @@
|
|||
extern int timeNow;
|
||||
extern EnginePins enginePins;
|
||||
extern EventQueue schedulingQueue;
|
||||
extern int warningCounter;
|
||||
extern int unitTestWarningCounter;
|
||||
|
||||
EngineTestHelper::EngineTestHelper(engine_type_e engineType) : engine (&persistentConfig) {
|
||||
ec = &persistentConfig.engineConfiguration;
|
||||
warningCounter = 0;
|
||||
unitTestWarningCounter = 0;
|
||||
|
||||
schedulingQueue.clear();
|
||||
enginePins.reset();
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
extern int timeNow;
|
||||
extern float unitTestValue;
|
||||
extern float testMafValue;
|
||||
extern int warningCounter;
|
||||
extern int unitTestWarningCounter;
|
||||
extern bool printTriggerDebug;
|
||||
extern float actualSynchGap;
|
||||
|
||||
|
@ -1240,7 +1240,7 @@ void testMissedSpark299(void) {
|
|||
engineConfiguration->isIgnitionEnabled = true;
|
||||
engineConfiguration->isInjectionEnabled = false;
|
||||
|
||||
assertEqualsM("warningCounter#0", 4, warningCounter);
|
||||
assertEqualsM("warningCounter#0", 4, unitTestWarningCounter);
|
||||
|
||||
timeNow += MS2US(20);
|
||||
eth.firePrimaryTriggerRise();
|
||||
|
@ -1311,5 +1311,5 @@ void testMissedSpark299(void) {
|
|||
eth.firePrimaryTriggerFall();
|
||||
schedulingQueue.executeAll(timeNow);
|
||||
|
||||
assertEqualsM("warningCounter#1", 5, warningCounter);
|
||||
assertEqualsM("warningCounter#1", 5, unitTestWarningCounter);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue