newer version

This commit is contained in:
rusefi 2014-04-22 20:15:29 -05:00
parent bfec788027
commit 89850a25f0
53 changed files with 3637 additions and 3533 deletions

View File

@ -27,7 +27,7 @@
<option id="gnu.cpp.compiler.cygwin.exe.debug.option.optimization.level.598398831" name="Optimization Level" superClass="gnu.cpp.compiler.cygwin.exe.debug.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
<option id="gnu.cpp.compiler.cygwin.exe.debug.option.debugging.level.2019038432" name="Debug Level" superClass="gnu.cpp.compiler.cygwin.exe.debug.option.debugging.level" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
<option id="gnu.cpp.compiler.option.other.other.1220149077" name="Other flags" superClass="gnu.cpp.compiler.option.other.other" value="-c -fmessage-length=0" valueType="string"/>
<option id="gnu.cpp.compiler.option.include.paths.1280999160" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
<option id="gnu.cpp.compiler.option.include.paths.1280999160" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;/cygdrive/c/stuff/rusefi_sourceforge/unit_tests/&quot;"/>
<listOptionValue builtIn="false" value="&quot;/cygdrive/c/stuff/rusefi_sourceforge/unit_tests/test_basic_math&quot;"/>
<listOptionValue builtIn="false" value="&quot;/cygdrive/c/stuff/rusefi_sourceforge/unit_tests/test_data_structures&quot;"/>
@ -37,6 +37,7 @@
<listOptionValue builtIn="false" value="&quot;/cygdrive/c/stuff/rusefi_sourceforge/unit_tests/controllers_math&quot;"/>
<listOptionValue builtIn="false" value="&quot;/cygdrive/c/stuff/rusefi_sourceforge/unit_tests/controllers_sensors&quot;"/>
<listOptionValue builtIn="false" value="&quot;/cygdrive/c/stuff/rusefi_sourceforge/unit_tests/controllers_algo&quot;"/>
<listOptionValue builtIn="false" value="&quot;/cygdrive/c/stuff/rusefi_sourceforge/unit_tests/controllers_trigger&quot;"/>
<listOptionValue builtIn="false" value="&quot;/cygdrive/c/stuff/rusefi_sourceforge/unit_tests/util&quot;"/>
</option>
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.cygwin.1681941669" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input.cygwin"/>
@ -55,6 +56,7 @@
<listOptionValue builtIn="false" value="&quot;/cygdrive/c/stuff/rusefi_sourceforge/unit_tests/controllers_math&quot;"/>
<listOptionValue builtIn="false" value="&quot;/cygdrive/c/stuff/rusefi_sourceforge/unit_tests/controllers_sensors&quot;"/>
<listOptionValue builtIn="false" value="&quot;/cygdrive/c/stuff/rusefi_sourceforge/unit_tests/controllers_algo&quot;"/>
<listOptionValue builtIn="false" value="&quot;/cygdrive/c/stuff/rusefi_sourceforge/unit_tests/controllers_trigger&quot;"/>
<listOptionValue builtIn="false" value="&quot;/cygdrive/c/stuff/rusefi_sourceforge/unit_tests/util&quot;"/>
</option>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.cygwin.1693315995" superClass="cdt.managedbuild.tool.gnu.c.compiler.input.cygwin"/>
@ -68,6 +70,9 @@
</tool>
</toolChain>
</folderInfo>
<sourceEntries>
<entry excluding="controllers_trigger/trigger_central.c|controllers_trigger/rpm_calculator.c|controllers_trigger/main_trigger_callback.cpp" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
</sourceEntries>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
@ -113,6 +118,9 @@
</tool>
</toolChain>
</folderInfo>
<sourceEntries>
<entry excluding="controllers_trigger/trigger_central.c|controllers_trigger/rpm_calculator.c|controllers_trigger/main_trigger_callback.cpp" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
</sourceEntries>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
@ -137,5 +145,12 @@
</scannerConfigBuildInfo>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
<storageModule moduleId="refreshScope"/>
<storageModule moduleId="refreshScope" versionNumber="2">
<configuration configurationName="Release">
<resource resourceType="PROJECT" workspacePath="/unit_tests"/>
</configuration>
<configuration configurationName="Debug">
<resource resourceType="PROJECT" workspacePath="/unit_tests"/>
</configuration>
</storageModule>
</cproject>

View File

@ -10,7 +10,7 @@ PROJECT_DIR = ../firmware
ifeq ($(USE_OPT),)
# -O2 is needed for mingw, without it there is a linking issue to isnanf?!?!
#USE_OPT = $(RFLAGS) -O2 -fgnu89-inline -ggdb -fomit-frame-pointer -falign-functions=16 -std=gnu99 -Werror-implicit-function-declaration -Werror -Wno-error=pointer-sign -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=sign-compare -Wno-error=unused-parameter -Wno-error=missing-field-initializers
USE_OPT = -c -Wall -O2
USE_OPT = -c -Wall -O0 -ggdb -g3
endif
# C specific options here (added to USE_OPT).
@ -86,13 +86,19 @@ CSRC = $(UTILSRC) \
$(CONTROLLERS_MATH_SRC) \
$(CONTROLLERS_SENSORS_SRC) \
$(ENGINES_SRC) \
$(PROJECT_DIR)/controllers/trigger/trigger_mazda.c \
$(PROJECT_DIR)/controllers/trigger/trigger_structure.c \
$(TEST_SRC_C)
# C++ sources that can be compiled in ARM or THUMB mode depending on the global
# setting.
CPPSRC = $(UTILSRC_CPP) \
$(CONTROLLERS_ALGO_SRC_CPP) \
$(PROJECT_DIR)/controllers/trigger/trigger_chrysler.cpp \
$(PROJECT_DIR)/controllers/trigger/trigger_gm.cpp \
$(PROJECT_DIR)/controllers/trigger/trigger_decoder.cpp \
$(ENGINES_SRC_CPP) \
$(CONTROLLERS_MATH_SRC_CPP) \
$(TEST_SRC_CPP) \
main.cpp
@ -125,6 +131,7 @@ INCDIR = . \
$(PROJECT_DIR)/controllers/sensors \
$(PROJECT_DIR)/controllers/algo \
$(PROJECT_DIR)/controllers/math \
$(PROJECT_DIR)/controllers/trigger \
$(PROJECT_DIR)/ext_algo \
test_data_structures \
test_basic_math

View File

@ -15,7 +15,6 @@ float getVoltage(int channel) {
return 0;
}
int getAdcValue(int channel) {
return 0;
}

View File

@ -10,4 +10,11 @@
#define EFI_CLI_SUPPORT FALSE
#define EFI_SUPPORT_FORD_ASPIRE TRUE
#define EFI_SUPPORT_DODGE_NEON TRUE
#define EFI_SUPPORT_1995_FORD_INLINE_6 TRUE
#define EFI_SUPPORT_FORD_FIESTA TRUE
#define EFI_SUPPORT_NISSAN_PRIMERA TRUE
#endif /* EFIFEATURES_H_ */

View File

@ -11,11 +11,7 @@
#include <time.h>
#include <string.h>
#define EFI_SUPPORT_FORD_ASPIRE TRUE
#define EFI_SUPPORT_DODGE_NEON TRUE
#define EFI_SUPPORT_1995_FORD_INLINE_6 TRUE
#define EFI_SUPPORT_FORD_FIESTA TRUE
#define EFI_SUPPORT_NISSAN_PRIMERA TRUE
#include "efitime.h"
#define TRUE 1
#define FALSE 0

View File

@ -13,6 +13,7 @@
#include <stdarg.h>
#include "main.h"
#include "error_handling.h"
extern "C"
{
@ -28,10 +29,10 @@ extern "C"
#include "test_signal_executor.h"
#include "test_util.h"
#include "engine_configuration.h"
#include "test_trigger_decoder.h"
#include "engine_math.h"
}
#include "test_trigger_decoder.h"
static engine_configuration_s ec;
engine_configuration_s *engineConfiguration = &ec;
@ -40,8 +41,12 @@ static float absF(float value) {
return value > 0 ? value : -value;
}
uint64_t getTimeNowUs(void) {
return 0;
}
void assertEqualsM(char *msg, float expected, float actual) {
if (isnan(actual) && !isnan(expected)) {
if (cisnan(actual) && !cisnan(expected)) {
printf("Unexpected: %s %.4f while expected %.4f\r\n", msg, actual, expected);
exit(-1);
}
@ -86,6 +91,7 @@ static engine_configuration2_s ec2;
engine_configuration2_s *engineConfiguration2 = &ec2;
int main(void) {
testOverflow64Counter();
testInterpolate3d();
testFindIndex();
testInterpolate2d();
@ -111,15 +117,16 @@ int main(void) {
testPinHelper();
testSetTableValue();
printf("Success 20130319\r\n");
printf("Success 20130422\r\n");
// resizeMap();
return EXIT_SUCCESS;
}
void warning(char *msg, float value) {
printf("Warning: %s %f\r\n", msg, value);
int warning(obd_code_e code, const char *fmt, ...) {
printf("Warning: %s\r\n", fmt);
}
void firmwareError(const char *fmt, ...) {

View File

@ -11,16 +11,20 @@
#include <stdio.h>
#include <math.h>
#include "error_handling.h"
#ifdef __cplusplus
extern "C"
{
#endif
#include "efilib.h"
#define CH_FREQUENCY 1000
#include "global.h"
#include "error_handling.h"
#include "efilib.h"
#include "efitime.h"
#include "boards.h"
#include "engines.h"

View File

@ -1,6 +1,7 @@
junction controllers_algo ..\firmware\controllers\algo
junction controllers_math ..\firmware\controllers\math
junction controllers_trigger ..\firmware\controllers\trigger
junction engines ..\firmware\config\engines
junction controllers_sensors ..\firmware\controllers\sensors
junction util ..\firmware\util

View File

@ -1,14 +1,15 @@
TEST_SRC_C = boards.c \
test_data_structures/test_engine_math.c \
test_event_registry.c \
test_basic_math/test_find_index.c \
test_basic_math/test_interpolation_3d.c \
test_fuel_map.c \
test_idle_controller.c \
test_trigger_decoder.c \
test_sensors.c \
test_signal_executor.c
test_sensors.c
TEST_SRC_CPP = test_util.cpp \
test_data_structures/test_event_registry.cpp \
test_trigger_decoder.cpp \
test_fuel_map.cpp \
test_signal_executor.cpp
TEST_SRC_CPP = test_util.cpp

View File

@ -8,6 +8,15 @@
#ifndef TEST_EVENT_REGISTRY_H_
#define TEST_EVENT_REGISTRY_H_
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
void testEventRegistry(void);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* TEST_EVENT_REGISTRY_H_ */

View File

@ -8,8 +8,17 @@
#ifndef TEST_FUEL_MAP_H_
#define TEST_FUEL_MAP_H_
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
void testFuelMap(void);
void testAngleResolver(void);
void testPinHelper(void);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* TEST_FUEL_MAP_H_ */

View File

@ -7,11 +7,11 @@
#include "main.h"
#include "thermistors.h"
#include "map.h"
#include "allsensors.h"
static ThermistorConf tc;
static void testMapDecoding() {
static void testMapDecoding(void) {
assertEqualsM("denso 0 volts", -6.64, getMAPValueHonda_Denso183(0));
assertEquals(31.244, getMAPValueHonda_Denso183(1));
@ -19,9 +19,26 @@ static void testMapDecoding() {
assertEquals(58.4, getMAPValueMPX_4250(1));
}
void testTpsRateOfChange(void) {
print("************************************************** testTpsRateOfChange\r\n");
saveTpsState(0, 0);
saveTpsState(CH_FREQUENCY, 50);
assertEquals(50, getTpsRateOfChange());
saveTpsState(2 * CH_FREQUENCY, 50);
assertEquals(0, getTpsRateOfChange());
saveTpsState(3 * CH_FREQUENCY, 75);
assertEquals(25, getTpsRateOfChange());
}
void testSensors(void) {
print("************************************************** testSensors\r\n");
testMapDecoding();
testTpsRateOfChange();
setThermistorConfiguration(&tc, 32, 9500, 75, 2100, 120, 1000);
prepareThermistorCurve(&tc);

View File

@ -8,6 +8,16 @@
#ifndef TEST_SIGNAL_EXECUTOR_H_
#define TEST_SIGNAL_EXECUTOR_H_
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
void testSignalExecutor(void);
int getRevolutionCounter(void);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* TEST_SIGNAL_EXECUTOR_H_ */

View File

@ -16,10 +16,26 @@
#include "eficonsole_logic.h"
#include "nmea.h"
#include "efilib2.h"
static cyclic_buffer sb;
void testOverflow64Counter(void) {
print("*************************************** testOverflow64Counter\r\n");
Overflow64Counter o;
assertEquals(0, o.get());
o.offer(10);
assertEquals(10, o.get());
o.offer(20);
assertEquals(20, o.get());
o.offer(0); // overflow
assertEquals(4294967296, o.get());
}
void testCyclicBuffer(void) {
print("*************************************** testCyclicBuffer\r\n");

View File

@ -16,6 +16,7 @@ extern "C"
void testCyclicBuffer(void);
void testOverflow64Counter(void);
void testHistogram(void);
void testMalfunctionCentral(void);
void testConsoleLogic(void);

View File

@ -97,7 +97,7 @@ CSRC = ${PORTSRC} \
${TESTSRC} \
${HALSRC} \
${PLATFORMSRC} \
$(TRIGGERSRC) \
$(TRIGGER_SRC) \
$(SYSTEMSRC) \
$(CONSOLESRC) \
$(CONSOLEUTILSRC) \
@ -110,16 +110,18 @@ CSRC = ${PORTSRC} \
${CHIBIOS}/os/various/memstreams.c \
$(UTILSRC) \
simulator/rusEfiFunctionalTest.c \
$(PROJECT_DIR)/controllers/settings.c \
simulator/boards.c \
$(PROJECT_DIR)/emulation/analog_chart.c \
main.c
# C++ sources that can be compiled in ARM or THUMB mode depending on the global
# setting.
CPPSRC = $(UTILSRC_CPP) \
$(CONTROLLERS_ALGO_SRC_CPP) \
$(CONTROLLERSSRC_CPP) \
$(PROJECT_DIR)/controllers/settings.cpp \
$(TRIGGER_SRC_CPP) \
$(SYSTEMSRC_CPP) \
$(CONTROLLERS_MATH_SRC_CPP) \
$(ENGINES_SRC_CPP) \
$(TEST_SRC_CPP)
# C sources to be compiled in ARM mode regardless of the global setting.
@ -157,6 +159,7 @@ $(PORTINC) $(KERNINC) $(TESTINC) \
$(PROJECT_DIR)/controllers/sensors \
$(PROJECT_DIR)/controllers/system \
$(PROJECT_DIR)/hw_layer/algo \
$(PROJECT_DIR)/emulation \
$(PROJECT_DIR)/controllers/algo \
$(PROJECT_DIR)/controllers/math \
$(PROJECT_DIR)/controllers/math \

View File

@ -1,31 +1,2 @@
#include "global.h"
#include "boards.h"
#include "eficonsole.h"
#include "efilib.h"
#include "datalogging.h"
#include "error_handling.h"
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
void printToWin32Console(char *p);
int systicks2ms(int systicks);
// todo: move somewhere else?
void lockAnyContext(void);
void unlockAnyContext(void);
#ifdef __cplusplus
}
#endif /* __cplusplus */
/**
* number of SysClock ticks in one ms
*/
#define TICKS_IN_MS (CH_FREQUENCY / 1000)
#define hal_lld_get_counter_value() 0

View File

@ -16,8 +16,17 @@
#define EFI_CONSOLE_UART_DEVICE (&testStream)
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
//float getVoltageDivided(int);
int getAdcValue(int channel);
void initFakeBoard(void);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* BOARDS_FT_H_ */

View File

@ -8,6 +8,17 @@
#ifndef EFIFEATURES_H_
#define EFIFEATURES_H_
#define EFI_SIMULATOR TRUE
#define EFI_SUPPORT_DODGE_NEON TRUE
#define EFI_SUPPORT_FORD_ASPIRE TRUE
#define EFI_SUPPORT_FORD_FIESTA TRUE
#define EFI_SUPPORT_NISSAN_PRIMERA TRUE
#define EFI_SUPPORT_1995_FORD_INLINE_6 TRUE
#define EFI_SIGNAL_EXECUTOR_SLEEP TRUE
#define EFI_WAVE_CHART TRUE
#endif /* EFIFEATURES_H_ */

View File

@ -22,14 +22,15 @@
#include "trigger_emulator_algo.h"
#include "main_trigger_callback.h"
#include "allsensors.h"
#include "analog_chart.h"
extern WaveChart waveChart;
static engine_configuration_s ec;
static persistent_config_s config;
static engine_configuration2_s ec2;
engine_configuration_s * engineConfiguration = &ec;
engine_configuration_s * engineConfiguration = &config.engineConfiguration;
board_configuration_s *boardConfiguration = &config.boardConfiguration;
engine_configuration2_s *engineConfiguration2 = &ec2;
void setOutputPinValue(io_pin_e pin, int logicValue) {
@ -79,12 +80,14 @@ void rusEfiFunctionalTest(void) {
initStatusLoop();
resetConfigurationExt(FORD_ASPIRE_1996, engineConfiguration, engineConfiguration2);
resetConfigurationExt(FORD_ASPIRE_1996, engineConfiguration, engineConfiguration2, boardConfiguration);
initThermistors();
initAlgo();
initRpmCalculator();
initAnalogChart();
initTriggerEmulatorLogic(triggerEmulatorCallback);
initMainEventListener();
@ -96,7 +99,7 @@ void rusEfiFunctionalTest(void) {
void printPendingMessages(void) {
printPending();
if (getFullLog()) {
printSensors();
printState(getCrankEventCounter());
finishStatusLine();
publishChartIfFull(&waveChart);
}
@ -144,12 +147,11 @@ void onFatalError(const char *msg, char * file, int line) {
exit(-1);
}
int warning(const char *fmt, ...) {
int warning(obd_code_e code, const char *fmt, ...) {
printf("Warning: %s\r\n", fmt);
return 0;
}
void firmwareError(const char *fmt, ...) {
fatal3((char*)fmt, __FILE__, __LINE__);
}
@ -158,6 +160,15 @@ int hasFatalError(void) {
return false;
}
int getVersion(void) {
void chDbgPanic3(const char *msg, char * file, int line) {
onFatalError(msg, file, line);
}
uint64_t getTimeNowUs(void) {
return chTimeNow() * (1000000 / CH_FREQUENCY);
}
int getRusEfiVersion(void) {
return 239;
}

View File

@ -1,2 +1,2 @@
int getVersion(void);
int getRusEfiVersion(void);