auto-sync

This commit is contained in:
rusEfi 2017-01-06 11:02:49 -05:00
parent eade0c0367
commit 13e255cb50
11 changed files with 44 additions and 33 deletions

View File

@ -27,7 +27,9 @@
EXTERN_ENGINE;
#if !EFI_UNIT_TEST || defined(__DOXYGEN__)
extern TunerStudioOutputChannels tsOutputChannels;
#endif
static ign_Map3D_t advanceMap("advance");
static ign_Map3D_t iatAdvanceCorrectionMap("iat corr");
@ -83,8 +85,10 @@ static angle_t getRunningAdvance(int rpm, float engineLoad DECLARE_ENGINE_PARAME
iatCorrection = iatAdvanceCorrectionMap.getValue((float) rpm, engine->engineState.iat);
}
if (engineConfiguration->debugMode == DBG_TIMING) {
#if !EFI_UNIT_TEST || defined(__DOXYGEN__)
tsOutputChannels.debugFloatField1 = iatCorrection;
tsOutputChannels.debugFloatField2 = engine->engineState.cltTimingCorrection;
#endif
}
float result = advanceMap.getValue((float) rpm, engineLoad)

View File

@ -55,10 +55,10 @@ static LEElementPool evalPool(evalPoolElements, LE_EVAL_POOL_SIZE);
#define SYS_ELEMENT_POOL_SIZE 128
#define UD_ELEMENT_POOL_SIZE 128
static LEElement sysElements[SYS_ELEMENT_POOL_SIZE];
static LEElement sysElements[SYS_ELEMENT_POOL_SIZE] CCM_OPTIONAL;
LEElementPool sysPool(sysElements, SYS_ELEMENT_POOL_SIZE);
static LEElement userElements[UD_ELEMENT_POOL_SIZE];
static LEElement userElements[UD_ELEMENT_POOL_SIZE] CCM_OPTIONAL;
LEElementPool userPool(userElements, UD_ELEMENT_POOL_SIZE);
static LEElement * fsioLogics[LE_COMMAND_COUNT] CCM_OPTIONAL;

View File

@ -30,14 +30,15 @@ public:
void unregister();
#if EFI_PROD_CODE || defined(__DOXYGEN__)
ioportid_t port;
int pin;
uint8_t pin;
#endif /* EFI_PROD_CODE */
int8_t currentLogicValue;
// 4 byte pointer is a bit of a memory waste here
pin_output_mode_e *modePtr;
/**
* we track current pin status so that we do not touch the actual hardware if we want to write new pin bit
* which is same as current pin value. This maybe helps in case of status leds, but maybe it's a total over-engineering
*/
int currentLogicValue;
};
class NamedOutputPin : public OutputPin {
@ -48,6 +49,7 @@ public:
* @return true if pin was stopped
*/
bool stop();
// todo: char pointer is a bit of a memory waste here, we can reduce RAM usage by software-based getName() method
const char *name;
};
@ -56,9 +58,10 @@ public:
InjectorOutputPin();
void reset();
efitimeus_t overlappingScheduleOffTime;
int injectorIndex;
// todo: implement this via address manipulation to reduce memory usage
int8_t injectorIndex;
bool cancelNextTurningInjectorOff;
int overlappingCounter;
int8_t overlappingCounter;
};
class IgnitionOutputPin : public NamedOutputPin {

View File

@ -408,12 +408,14 @@ static ALWAYS_INLINE void handleFuel(const bool limitedFuel, uint32_t trgEventIn
}
}
static histogram_s mainLoopHisto;
#if EFI_HISTOGRAMS || defined(__DOXYGEN__)
static histogram_s mainLoopHistogram;
#endif /* EFI_HISTOGRAMS */
void showMainHistogram(void) {
#if EFI_PROD_CODE || defined(__DOXYGEN__)
printHistogram(logger, &mainLoopHisto);
#endif
#if EFI_HISTOGRAMS || defined(__DOXYGEN__)
printHistogram(logger, &mainLoopHistogram);
#endif /* EFI_HISTOGRAMS */
}
#if EFI_PROD_CODE || defined(__DOXYGEN__)
@ -512,10 +514,10 @@ void mainTriggerCallback(trigger_event_e ckpSignalType, uint32_t trgEventIndex D
* For spark we schedule both start of coil charge and actual spark based on trigger angle
*/
handleSpark(limitedSpark, trgEventIndex, rpm PASS_ENGINE_PARAMETER);
#if (EFI_HISTOGRAMS && EFI_PROD_CODE) || defined(__DOXYGEN__)
#if EFI_HISTOGRAMS || defined(__DOXYGEN__)
int diff = hal_lld_get_counter_value() - beforeCallback;
if (diff > 0)
hsAdd(&mainLoopHisto, diff);
hsAdd(&mainLoopHistogram, diff);
#endif /* EFI_HISTOGRAMS */
if (trgEventIndex == 0) {
@ -559,7 +561,7 @@ void initMainEventListener(Logging *sharedLogger, Engine *engine) {
#endif
#if EFI_HISTOGRAMS || defined(__DOXYGEN__)
initHistogram(&mainLoopHisto, "main callback");
initHistogram(&mainLoopHistogram, "main callback");
#endif /* EFI_HISTOGRAMS */
addTriggerEventListener(mainTriggerCallback, "main loop", engine);

View File

@ -36,7 +36,9 @@ WaveChart waveChart;
EXTERN_ENGINE;
static histogram_s triggerCallback;
#if EFI_HISTOGRAMS || defined(__DOXYGEN__)
static histogram_s triggerCallbackHistogram;
#endif /* EFI_HISTOGRAMS */
static Logging *logger;
@ -286,19 +288,19 @@ void TriggerCentral::handleShaftSignal(trigger_event_e signal DECLARE_ENGINE_PAR
}
}
#if EFI_HISTOGRAMS && EFI_PROD_CODE
#if EFI_HISTOGRAMS || defined(__DOXYGEN__)
int afterCallback = hal_lld_get_counter_value();
int diff = afterCallback - beforeCallback;
// this counter is only 32 bits so it overflows every minute, let's ignore the value in case of the overflow for simplicity
if (diff > 0) {
hsAdd(&triggerCallback, diff);
hsAdd(&triggerCallbackHistogram, diff);
}
#endif /* EFI_HISTOGRAMS */
}
void printAllCallbacksHistogram(void) {
#if EFI_PROD_CODE
printHistogram(logger, &triggerCallback);
#if EFI_HISTOGRAMS || defined(__DOXYGEN__)
printHistogram(logger, &triggerCallbackHistogram);
#endif
}
@ -501,7 +503,7 @@ float getTriggerDutyCycle(int index) {
#endif
static void resetRunningTriggerCounters() {
#if !EFI_UNIT_TEST
#if !EFI_UNIT_TEST || defined(__DOXYGEN__)
engine->triggerCentral.resetCounters();
triggerInfo();
#endif
@ -511,18 +513,18 @@ void initTriggerCentral(Logging *sharedLogger, Engine *engine) {
logger = sharedLogger;
strcpy((char*) shaft_signal_msg_index, "x_");
#if EFI_ENGINE_SNIFFER
#if EFI_ENGINE_SNIFFER || defined(__DOXYGEN__)
initWaveChart(&waveChart);
#endif /* EFI_ENGINE_SNIFFER */
#if EFI_PROD_CODE || EFI_SIMULATOR
#if EFI_PROD_CODE || EFI_SIMULATOR || defined(__DOXYGEN__)
addConsoleAction("triggerinfo", triggerInfo);
addConsoleAction("trigger_shape_info", triggerShapeInfo);
addConsoleAction("reset_trigger", resetRunningTriggerCounters);
#endif
#if EFI_HISTOGRAMS
initHistogram(&triggerCallback, "all callbacks");
#if EFI_HISTOGRAMS || defined(__DOXYGEN__)
initHistogram(&triggerCallbackHistogram, "all callbacks");
#endif /* EFI_HISTOGRAMS */
}

View File

@ -84,9 +84,9 @@ static single_wave_s waves[PWM_PHASE_MAX_WAVE_PER_PWM] = { single_wave_s(pinStat
single_wave_s(pinStates3) };
static single_wave_s sr[PWM_PHASE_MAX_WAVE_PER_PWM] = { waves[0], waves[1], waves[2] };
static float swtchTms[PWM_PHASE_MAX_COUNT];
static float switchTimesBuffer[PWM_PHASE_MAX_COUNT];
PwmConfig triggerSignal(swtchTms, sr);
PwmConfig triggerSignal(switchTimesBuffer, sr);
#define DO_NOT_STOP 999999999

View File

@ -240,14 +240,14 @@ void chDbgStackOverflowPanic(Thread *otp) {
chDbgPanic3(panicMessage, __FILE__, __LINE__);
}
static char UNUSED_RAM_SIZE[11100];
static char UNUSED_RAM_SIZE[25100];
static char UNUSED_CCM_SIZE[16500] CCM_OPTIONAL;
static char UNUSED_CCM_SIZE[9500] CCM_OPTIONAL;
int getRusEfiVersion(void) {
if (UNUSED_RAM_SIZE[0] != 0)
return 123; // this is here to make the compiler happy about the unused array
if (UNUSED_CCM_SIZE[0] * 0 != 0)
return 3211; // this is here to make the compiler happy about the unused array
return 20170102;
return 20170105;
}

View File

@ -35,7 +35,7 @@
static Logging * logging;
static int consoleActionCount = 0;
static TokenCallback consoleActions[CONSOLE_MAX_ACTIONS];
static TokenCallback consoleActions[CONSOLE_MAX_ACTIONS] CCM_OPTIONAL;
#define SECURE_LINE_PREFIX "sec!"
#define SECURE_LINE_PREFIX_LENGTH 4
@ -152,7 +152,7 @@ static int getParameterCount(action_type_e parameterType) {
* @brief This function prints out a list of all available commands
*/
void helpCommand(void) {
#if EFI_PROD_CODE
#if EFI_PROD_CODE || defined(__DOXYGEN__)
if (isBoardTestMode()) {
printBoardTestState();
return;

View File

@ -13,7 +13,7 @@
#include "histogram.h"
#include "main.h"
#if EFI_HISTOGRAMS
#if EFI_HISTOGRAMS || EFI_UNIT_TEST
#define H_ACCURACY 0.05
#define H_CONFIDENCE 0.8

View File

@ -18,7 +18,7 @@
#define EFI_FSIO TRUE
#define EFI_HISTOGRAMS TRUE
#define EFI_HISTOGRAMS FALSE
#define CONSOLE_MAX_ACTIONS 128

View File

@ -48,7 +48,7 @@
#define EFI_ANALOG_SENSORS TRUE
#define EFI_SENSOR_CHART TRUE
#define EFI_HISTOGRAMS TRUE
#define EFI_HISTOGRAMS FALSE
#define EFI_TUNER_STUDIO TRUE