auto-sync

This commit is contained in:
rusEfi 2015-01-01 14:03:40 -06:00
parent 89d26d3d6f
commit 05f2fd89a3
12 changed files with 19 additions and 195 deletions

View File

@ -90,7 +90,7 @@ include $(CHIBIOS)/os/various/fatfs_bindings/fatfs.mk
include console/tunerstudio/tunerstudio.mk
include ext/ext.mk
include hw_layer/hw_layer.mk
include emulation/emulation.mk
include emulation/development.mk
include controllers/controllers.mk
include $(PROJECT_DIR)/util/util.mk

View File

@ -1,12 +1,10 @@
CONTROLLERSSRC = \
controllers/ignition_central.c \
$(PROJECT_DIR)/controllers/error_handling.c
CONTROLLERS_SRC_CPP = $(PROJECT_DIR)/controllers/settings.cpp \
controllers/electronic_throttle.cpp \
controllers/map_averaging.cpp \
controllers/map_multiplier_thread.cpp \
controllers/flash_main.cpp \
controllers/injector_central.cpp \
controllers/idle_thread.cpp \

View File

@ -31,12 +31,10 @@
#include "rpm_calculator.h"
#include "signal_executor.h"
#include "main_trigger_callback.h"
#include "map_multiplier_thread.h"
#include "io_pins.h"
#include "flash_main.h"
#include "tunerstudio.h"
#include "injector_central.h"
#include "ignition_central.h"
#include "rfiutil.h"
#include "engine_math.h"
#include "wave_analyzer.h"

View File

@ -1,44 +0,0 @@
/**
* @file ignition_central.c
* @brief TODO
*
* @date Nov 15, 2013
* @author Andrey Belomutskiy, (c) 2012-2014
*
* This file is part of rusEfi - see http://rusefi.com
*
* rusEfi is free software; you can redistribute it and/or modify it under the terms of
* the GNU General Public License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* rusEfi is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with this program.
* If not, see <http://www.gnu.org/licenses/>.
*/
#include "main.h"
#if EFI_ENGINE_CONTROL || defined(__DOXYGEN__)
#include "ignition_central.h"
#include "io_pins.h"
#include "signal_executor.h"
#include "main_trigger_callback.h"
#include "engine_configuration.h"
#include "efiGpio.h"
extern engine_configuration_s *engineConfiguration;
extern board_configuration_s *boardConfiguration;
void initIgnitionCentral(void) {
for (int i = 0; i < engineConfiguration->cylindersCount; i++) {
io_pin_e pin = (io_pin_e)((int)SPARKOUT_1_OUTPUT + i);
outputPinRegisterExt2(getPinName(pin), pin, boardConfiguration->ignitionPins[i], &boardConfiguration->ignitionPinMode);
}
}
#endif

View File

@ -1,25 +0,0 @@
/**
* @file ignition_central.h
* @brief TODO
*
* @date Nov 15, 2013
* @author Andrey Belomutskiy, (c) 2012-2014
*/
#ifndef IGNITION_CENTRAL_H_
#define IGNITION_CENTRAL_H_
#include "signal_executor.h"
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
void initIgnitionCentral(void);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* IGNITION_CENTRAL_H_ */

View File

@ -20,7 +20,7 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
// todo: merge with ignition_central and rename this file?
// todo: this file?
#include "main.h"
@ -43,6 +43,14 @@ static bool_t isRunningBench = false;
static int is_injector_enabled[MAX_INJECTOR_COUNT];
void initIgnitionCentral(void) {
for (int i = 0; i < engineConfiguration->cylindersCount; i++) {
io_pin_e pin = (io_pin_e)((int)SPARKOUT_1_OUTPUT + i);
outputPinRegisterExt2(getPinName(pin), pin, boardConfiguration->ignitionPins[i], &boardConfiguration->ignitionPinMode);
}
}
bool_t isRunningBenchTest(void) {
return isRunningBench;
}

View File

@ -14,6 +14,7 @@
#include "engine.h"
void initInjectorCentral(Engine *engine);
void initIgnitionCentral(void);
bool_t isRunningBenchTest(void);
int isInjectorEnabled(int cylinderId);
void assertCylinderId(int cylinderId, const char *msg);

View File

@ -1,85 +0,0 @@
/*
* @brief dead code
*
*
* map_multiplier.cpp
*
* @date Jul 23, 2013
* @author Andrey Belomutskiy, (c) 2012-2014
*/
#include "main.h"
#include "map_multiplier_thread.h"
#include "map_adjuster.h"
#include "rpm_calculator.h"
#include "main_trigger_callback.h"
#include "allsensors.h"
#include "engine_math.h"
#include "engine.h"
extern engine_configuration_s *engineConfiguration;
static Logging logger;
EXTERN_ENGINE;
static THD_WORKING_AREA(maThreadStack, UTILITY_THREAD_STACK_SIZE);
static void mapCallback(int rpm, float key, float value) {
Logging *logging = &logger;
appendPrintf(logging, "msg%s", DELIMETER);
appendPrintf(logging, "map_adjusted: ");
appendPrintf(logging, "%d", rpm);
appendPrintf(logging, " ");
appendPrintf(logging, "%d", 100 * key);
appendPrintf(logging, " ");
appendPrintf(logging, "%d", 100 * value);
appendMsgPostfix(logging);
scheduleLogging(logging);
}
static int timeAtNotRunning = 0;
static int isNewState = TRUE;
static void maThread(int param) {
chRegSetThreadName("map adjustment");
while (TRUE) {
chThdSleepMilliseconds(100);
systime_t now = chTimeNow();
//todo? if (!isRunning()) {
// timeAtNotRunning = now;
// continue;
// }
int wasNotRunningRecently = overflowDiff(now, timeAtNotRunning) < 60 * CH_FREQUENCY;
if (!wasNotRunningRecently)
continue;
if (isNewState)
scheduleMsg(&logger, "starting fuel map adjustment at %d", now);
isNewState = FALSE;
// ideally this should be atomic, but hopefully it's good enough
int rpm = getRpm();
float load = getEngineLoadT(PASS_ENGINE_PARAMETER);
float afr = getAfr();
addAfr(rpm, load, afr);
int total = runMapAdjustments(mapCallback);
if (total > 0) {
// scheduleSimpleMsg(&logger, "map adjusted for maf ", 100 * key);
}
}
}
void initMapAdjusterThread(void) {
initLogging(&logger, "Map self learning thread");
initMapAdjuster();
chThdCreateStatic(maThreadStack, sizeof(maThreadStack), NORMALPRIO, (tfunc_t)maThread, NULL);
}

View File

@ -1,15 +0,0 @@
/**
* @file map_multiplier.h
* @brief dead code
*
*
* @date Jul 23, 2013
* @author Andrey Belomutskiy, (c) 2012-2014
*/
#ifndef MAP_MULTIPLIER_H_
#define MAP_MULTIPLIER_H_
void initMapAdjusterThread(void);
#endif /* MAP_MULTIPLIER_H_ */

View File

@ -114,19 +114,19 @@ static msg_t ivThread(int param) {
// spiExchange(driver, 1, tx_buff, rx_buff);
// BAND_PASS_CMD
tx_buff[0] = 0b00000000 | (40 & 0x3F);
tx_buff[0] = 0x0 | (40 & 0x3F);
spiExchange(driver, 1, tx_buff, rx_buff);
// Set the gain
tx_buff[0] = 0b10000000 | (49 & 0x3F);
// Set the gain 0b10000000
tx_buff[0] = 0x80 | (49 & 0x3F);
spiExchange(driver, 1, tx_buff, rx_buff);
// Set the integration time constant
tx_buff[0] = 0b11000000 | (31 & 0x1F);
// Set the integration time constant 0b11000000
tx_buff[0] = 0xC0 | (31 & 0x1F);
spiExchange(driver, 1, tx_buff, rx_buff);
// SET_ADVANCED_MODE
tx_buff[0] = 0b01110001;
// SET_ADVANCED_MODE 0b01110001
tx_buff[0] = 0x71;
spiExchange(driver, 1, tx_buff, rx_buff);
spiUnselect(driver);

View File

@ -2469,12 +2469,6 @@
<file>
<name>$PROJ_DIR$\..\controllers\idle_thread.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\controllers\ignition_central.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\controllers\ignition_central.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\controllers\injector_central.cpp</name>
</file>
@ -2499,12 +2493,6 @@
<file>
<name>$PROJ_DIR$\..\controllers\map_averaging.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\controllers\map_multiplier_thread.cpp</name>
</file>
<file>
<name>$PROJ_DIR$\..\controllers\map_multiplier_thread.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\controllers\obd2viaCAN.c</name>
</file>
@ -2692,7 +2680,7 @@
<name>$PROJ_DIR$\..\hw_layer\io_pins.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\hw_layer\max31855.c</name>
<name>$PROJ_DIR$\..\hw_layer\max31855.cpp</name>
</file>
<file>
<name>$PROJ_DIR$\..\hw_layer\max31855.h</name>