auto-sync
This commit is contained in:
parent
3eb79bd3cf
commit
e41a60a669
|
@ -335,13 +335,13 @@ static void showFuelInfo(void) {
|
|||
|
||||
static THD_WORKING_AREA(lcdThreadStack, UTILITY_THREAD_STACK_SIZE);
|
||||
|
||||
static void lcdThread(void) {
|
||||
static void lcdThread(Engine *engine) {
|
||||
chRegSetThreadName("lcd");
|
||||
while (true) {
|
||||
#if EFI_HD44780_LCD
|
||||
updateHD44780lcd(&engine);
|
||||
updateHD44780lcd(engine);
|
||||
#endif
|
||||
chThdSleepMilliseconds(boardConfiguration->lcdThreadPeriod);
|
||||
chThdSleepMilliseconds(engine->engineConfiguration->bc.lcdThreadPeriod);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -349,9 +349,9 @@ static THD_WORKING_AREA(tsThreadStack, UTILITY_THREAD_STACK_SIZE);
|
|||
|
||||
#if EFI_TUNER_STUDIO
|
||||
|
||||
void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels) {
|
||||
void updateTunerStudioState(Engine *engine, TunerStudioOutputChannels *tsOutputChannels) {
|
||||
#if EFI_SHAFT_POSITION_INPUT
|
||||
int rpm = getRpm();
|
||||
int rpm = getRpmE(engine);
|
||||
#else
|
||||
int rpm = 0;
|
||||
#endif
|
||||
|
@ -360,7 +360,7 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels) {
|
|||
float coolant = getCoolantTemperature(engineConfiguration2);
|
||||
float intake = getIntakeAirTemperature(engineConfiguration2);
|
||||
|
||||
float engineLoad = getEngineLoad();
|
||||
float engineLoad = getEngineLoadT(engine);
|
||||
float baseFuelMs = getBaseTableFuel(engineConfiguration, (int) rpm, engineLoad);
|
||||
|
||||
tsOutputChannels->rpm = rpm;
|
||||
|
@ -394,20 +394,19 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels) {
|
|||
#endif
|
||||
tsOutputChannels->tCharge = getTCharge(rpm, tps, coolant, intake);
|
||||
tsOutputChannels->sparkDwell = getSparkDwellMs(rpm);
|
||||
tsOutputChannels->pulseWidthMs = getRunningFuel(baseFuelMs, &engine, rpm);
|
||||
tsOutputChannels->crankingFuelMs = getCrankingFuel(&engine);
|
||||
tsOutputChannels->pulseWidthMs = getRunningFuel(baseFuelMs, engine, rpm);
|
||||
tsOutputChannels->crankingFuelMs = getCrankingFuel(engine);
|
||||
}
|
||||
|
||||
extern TunerStudioOutputChannels tsOutputChannels;
|
||||
#endif /* EFI_TUNER_STUDIO */
|
||||
|
||||
static void tsStatusThread(void *arg) {
|
||||
(void)arg;
|
||||
static void tsStatusThread(Engine *engine) {
|
||||
chRegSetThreadName("tuner s");
|
||||
while (true) {
|
||||
#if EFI_TUNER_STUDIO
|
||||
// sensor state for EFI Analytics Tuner Studio
|
||||
updateTunerStudioState(&tsOutputChannels);
|
||||
updateTunerStudioState(engine, &tsOutputChannels);
|
||||
#endif /* EFI_TUNER_STUDIO */
|
||||
chThdSleepMilliseconds(boardConfiguration->tunerStudioThreadPeriod);
|
||||
}
|
||||
|
@ -437,10 +436,10 @@ void initStatusLoop(void) {
|
|||
|
||||
}
|
||||
|
||||
void startStatusThreads(void) {
|
||||
void startStatusThreads(Engine *engine) {
|
||||
// todo: refactoring needed, this file should probably be split into pieces
|
||||
chThdCreateStatic(lcdThreadStack, sizeof(lcdThreadStack), NORMALPRIO, (tfunc_t) lcdThread, (void*) NULL);
|
||||
chThdCreateStatic(tsThreadStack, sizeof(tsThreadStack), NORMALPRIO, (tfunc_t) tsStatusThread, (void*) NULL);
|
||||
chThdCreateStatic(lcdThreadStack, sizeof(lcdThreadStack), NORMALPRIO, (tfunc_t) lcdThread, engine);
|
||||
chThdCreateStatic(tsThreadStack, sizeof(tsThreadStack), NORMALPRIO, (tfunc_t) tsStatusThread, engine);
|
||||
}
|
||||
|
||||
void setFullLog(int value) {
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
void updateDevConsoleState(Engine *engine);
|
||||
void printSensors(Engine *engine);
|
||||
void printState(Engine *engine, int currentCkpEventCounter);
|
||||
void startStatusThreads(Engine *engine);
|
||||
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
@ -24,7 +25,6 @@ extern "C"
|
|||
void initStatusLoop(void);
|
||||
bool getFullLog(void);
|
||||
void setFullLog(int value);
|
||||
void startStatusThreads(void);
|
||||
void sayOsHello(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -9,6 +9,10 @@
|
|||
#define TUNERSTUDIO_H_
|
||||
|
||||
#include "tunerstudio_configuration.h"
|
||||
#include "engine.h"
|
||||
|
||||
void updateTunerStudioState(Engine *engine, TunerStudioOutputChannels *tsOutputChannels);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -16,7 +20,6 @@ extern "C" {
|
|||
|
||||
void startTunerStudioConnectivity(void);
|
||||
void syncTunerStudioCopy(void);
|
||||
void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels);
|
||||
void tunerStudioWriteCrcPacket(const uint8_t command, const void *buf, const uint16_t size);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -182,7 +182,7 @@ void runRusEfi(void) {
|
|||
#if EFI_ENGINE_EMULATOR
|
||||
initEngineEmulator(boardConfiguration);
|
||||
#endif
|
||||
startStatusThreads();
|
||||
startStatusThreads(&engine);
|
||||
|
||||
print("Running main loop\r\n");
|
||||
main_loop_started = TRUE;
|
||||
|
|
|
@ -101,6 +101,10 @@ void addConsoleActionFF(const char *token, VoidFloatFloat callback) {
|
|||
doAddAction(token, FLOAT_FLOAT_PARAMETER, (Void) callback, NULL);
|
||||
}
|
||||
|
||||
void addConsoleActionFFP(const char *token, VoidFloatFloatVoidPtr callback, void *param) {
|
||||
doAddAction(token, FLOAT_FLOAT_PARAMETER_P, (Void) callback, param);
|
||||
}
|
||||
|
||||
static int getParameterCount(action_type_e parameterType) {
|
||||
switch (parameterType) {
|
||||
case NO_PARAMETER:
|
||||
|
|
|
@ -50,8 +50,11 @@ typedef void (*Void)(void);
|
|||
typedef void (*VoidInt)(int);
|
||||
typedef void (*VoidFloat)(float);
|
||||
typedef void (*VoidFloatFloat)(float, float);
|
||||
typedef void (*VoidFloatFloatVoidPtr)(float, float, void*);
|
||||
typedef void (*VoidIntInt)(int, int);
|
||||
|
||||
typedef void (*VoidCharPtr)(const char *);
|
||||
typedef void (*VoidCharPtrVoidPtr)(const char *, void*);
|
||||
|
||||
typedef void (*VoidCharPtrCharPtr)(const char *, const char *);
|
||||
typedef void (*VoidCharPtrCharPtrVoidPtr)(const char *, const char *, void*);
|
||||
|
@ -73,8 +76,12 @@ void addConsoleActionP(const char *token, VoidPtr callback, void *param);
|
|||
void addConsoleActionI(const char *token, VoidInt callback);
|
||||
void addConsoleActionII(const char *token, VoidIntInt callback);
|
||||
void addConsoleActionF(const char *token, VoidFloat callback);
|
||||
|
||||
void addConsoleActionFF(const char *token, VoidFloatFloat callback);
|
||||
void addConsoleActionFFP(const char *token, VoidFloatFloatVoidPtr callback, void *param);
|
||||
|
||||
void addConsoleActionS(const char *token, VoidCharPtr callback);
|
||||
void addConsoleActionSP(const char *token, VoidCharPtrVoidPtr callback);
|
||||
|
||||
void addConsoleActionSS(const char *token, VoidCharPtrCharPtr callback);
|
||||
void addConsoleActionSSP(const char *token, VoidCharPtrCharPtrVoidPtr callback, void *param);
|
||||
|
|
|
@ -94,7 +94,7 @@ void rusEfiFunctionalTest(void) {
|
|||
|
||||
initTriggerCentral(&engine);
|
||||
|
||||
startStatusThreads();
|
||||
startStatusThreads(&engine);
|
||||
startTunerStudioConnectivity();
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue