random code inspired by Ola
This commit is contained in:
parent
392c3a1d0c
commit
957b0e19c1
|
@ -678,8 +678,6 @@ void initEngineContoller(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX)
|
|||
initPwmTester();
|
||||
#endif /* EFI_PWM_TESTER */
|
||||
|
||||
initMalfunctionCentral();
|
||||
|
||||
#if EFI_ALTERNATOR_CONTROL
|
||||
initAlternatorCtrl(sharedLogger PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
#endif /* EFI_ALTERNATOR_CONTROL */
|
||||
|
|
|
@ -24,7 +24,7 @@ static int find_position(obd_code_e e_code) // Search if code is present
|
|||
return -1; // -1 if code not found
|
||||
}
|
||||
|
||||
void initMalfunctionCentral(void) {
|
||||
void clearWarnings(void) {
|
||||
error_codes_set.count = 0;
|
||||
}
|
||||
|
||||
|
@ -40,15 +40,16 @@ void removeError(obd_code_e errorCode) {
|
|||
if (pos >= 0) {
|
||||
for (int t = pos; t < error_codes_set.count; t++) // shift all right elements to one pos left
|
||||
error_codes_set.error_codes[t] = error_codes_set.error_codes[t + 1];
|
||||
error_codes_set.error_codes[--error_codes_set.count] = (obd_code_e)0; // place 0
|
||||
error_codes_set.error_codes[--error_codes_set.count] = (obd_code_e)0; // place 0
|
||||
}
|
||||
}
|
||||
|
||||
void setError(bool isError, obd_code_e errorCode) {
|
||||
if (isError)
|
||||
if (isError) {
|
||||
addError(errorCode);
|
||||
else
|
||||
} else {
|
||||
removeError(errorCode);
|
||||
}
|
||||
}
|
||||
|
||||
void getErrorCodes(error_codes_set_s * copy) {
|
||||
|
|
|
@ -6,27 +6,18 @@
|
|||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
#ifndef MALFUNCTION_CENTRAL_H_
|
||||
#define MALFUNCTION_CENTRAL_H_
|
||||
#pragma once
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#include "obd_error_codes.h"
|
||||
|
||||
#define MAX_ERROR_CODES_COUNT 10
|
||||
|
||||
typedef struct {
|
||||
int count;
|
||||
int count = 0;
|
||||
obd_code_e error_codes[MAX_ERROR_CODES_COUNT];
|
||||
} error_codes_set_s;
|
||||
|
||||
void initMalfunctionCentral(void);
|
||||
|
||||
/**
|
||||
* @brief Adds an error code into the set of current errors.
|
||||
* The error code is placed into the fixed-size data structure if it fits into it.
|
||||
|
@ -42,15 +33,10 @@ void removeError(obd_code_e errorCode);
|
|||
|
||||
void setError(bool isError, obd_code_e errorCode);
|
||||
|
||||
void clearWarnings(void);
|
||||
/**
|
||||
* @brief Copies the current set of errors into the specified buffer
|
||||
*/
|
||||
void getErrorCodes(error_codes_set_s * buffer);
|
||||
|
||||
bool hasErrorCodes(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* MALFUNCTION_CENTRAL_H_ */
|
||||
|
|
|
@ -39,8 +39,10 @@
|
|||
#include "tps.h"
|
||||
|
||||
#if EFI_PROD_CODE
|
||||
#include "cj125.h"
|
||||
#include "rusefi.h"
|
||||
#include "mpu_util.h"
|
||||
#include "malfunction_central.h"
|
||||
#endif /* EFI_PROD_CODE */
|
||||
|
||||
#if (BOARD_TLE8888_COUNT > 0)
|
||||
|
@ -293,7 +295,9 @@ static void handleCommandX14(uint16_t index) {
|
|||
void executeTSCommand(uint16_t subsystem, uint16_t index) {
|
||||
scheduleMsg(logger, "IO test subsystem=%d index=%d", subsystem, index);
|
||||
|
||||
if (subsystem == 0x12) {
|
||||
if (subsystem == 0x11) {
|
||||
clearWarnings();
|
||||
} else if (subsystem == 0x12) {
|
||||
doRunSpark(index, "300", "4", "400", "3");
|
||||
} else if (subsystem == 0x13) {
|
||||
doRunFuel(index, "300", "4", "400", "3");
|
||||
|
@ -309,6 +313,8 @@ void executeTSCommand(uint16_t subsystem, uint16_t index) {
|
|||
#if EFI_IDLE_CONTROL
|
||||
startIdleBench();
|
||||
#endif
|
||||
} else if (subsystem == 0x18) {
|
||||
cjCalibrate();
|
||||
} else if (subsystem == 0x20 && index == 0x3456) {
|
||||
// call to pit
|
||||
setCallFromPitStop(30000);
|
||||
|
|
Loading…
Reference in New Issue