diff --git a/platformio.ini b/platformio.ini index 44cc0871..5bb1782a 100644 --- a/platformio.ini +++ b/platformio.ini @@ -28,20 +28,25 @@ build_unflags = -Os build_flags = -DUSE_LIBDIVIDE -O3 -ffast-math -Wall -Wextra -std=c99 lib_deps = EEPROM, Time test_build_src = yes +test_ignore = test_table3d_native [env:teensy35] ;platform=teensy platform=https://github.com/platformio/platform-teensy.git board=teensy35 framework=arduino -lib_deps = EEPROM, FlexCAN, Time +lib_deps = EEPROM, FlexCAN_T4, Time +test_build_src = yes +test_ignore = test_table3d_native [env:teensy36] ;platform=teensy platform=https://github.com/platformio/platform-teensy.git board=teensy36 framework=arduino -lib_deps = EEPROM, FlexCAN, Time +lib_deps = EEPROM, FlexCAN_T4, Time +test_build_src = yes +test_ignore = test_table3d_native [env:teensy41] ;platform=teensy @@ -49,6 +54,8 @@ platform=https://github.com/platformio/platform-teensy.git board=teensy41 framework=arduino lib_deps = EEPROM, FlexCAN_T4, Time +test_build_src = yes +test_ignore = test_table3d_native ;Not currently working ;[env:LaunchPad_tm4c1294ncpdt] diff --git a/speeduino/SD_logger.h b/speeduino/SD_logger.h index 22a2b1f0..9c244617 100644 --- a/speeduino/SD_logger.h +++ b/speeduino/SD_logger.h @@ -8,6 +8,7 @@ #else #include "SdFat.h" #endif +#include "logger.h" //#include #include "RingBuf.h" diff --git a/speeduino/SD_logger.ino b/speeduino/SD_logger.ino index bc22327a..21fc382a 100644 --- a/speeduino/SD_logger.ino +++ b/speeduino/SD_logger.ino @@ -173,6 +173,9 @@ void readSDSectors(uint8_t* buffer, uint32_t sectorNumber, uint16_t sectorCount) sd.card()->readSectors(sectorNumber, buffer, sectorCount); } +// Forward declare +void writeSDLogHeader(); + void beginSDLogging() { if(SD_status == SD_STATUS_READY) @@ -217,6 +220,10 @@ void endSDLogging() } } +// Forward declare +void checkForSDStart(); +void checkForSDStop(); + void writeSDLogEntry() { //Check if we're already running a log diff --git a/speeduino/canBroadcast.ino b/speeduino/canBroadcast.ino index b0a42fbd..37d51b6e 100644 --- a/speeduino/canBroadcast.ino +++ b/speeduino/canBroadcast.ino @@ -10,6 +10,9 @@ This is for handling the data broadcasted to various CAN dashes and instrument c #if defined(NATIVE_CAN_AVAILABLE) #include "globals.h" +// Forward declare +void DashMessage(uint16_t DashMessageID); + void sendBMWCluster() { DashMessage(CAN_BMW_DME1); diff --git a/speeduino/globals.h b/speeduino/globals.h index e5de07cd..cf4da72d 100644 --- a/speeduino/globals.h +++ b/speeduino/globals.h @@ -28,7 +28,6 @@ #include "table2d.h" #include "table3d.h" #include -#include "logger.h" #include "src/FastCRC/FastCRC.h" #if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) || defined(__AVR_ATmega2561__) diff --git a/speeduino/init.ino b/speeduino/init.ino index e02cfcd5..48a97802 100644 --- a/speeduino/init.ino +++ b/speeduino/init.ino @@ -94,9 +94,13 @@ void initialiseAll(void) } } #endif - + + // Unit tests should be independent of any stored configuration on the board! +#if !defined(UNIT_TEST) loadConfig(); doUpdates(); //Check if any data items need updating (Occurs with firmware updates) +#endif + //Always start with a clean slate on the bootloader capabilities level //This should be 0 until we hear otherwise from the 16u2 diff --git a/speeduino/logger.h b/speeduino/logger.h index 194c710d..6a93e49b 100644 --- a/speeduino/logger.h +++ b/speeduino/logger.h @@ -10,6 +10,7 @@ #define LOGGER_H #include +#include "globals.h" // Needed for FPU_MAX_SIZE #ifndef UNIT_TEST // Scope guard for unit testing #define LOG_ENTRY_SIZE 125 /**< The size of the live data packet. This MUST match ochBlockSize setting in the ini file */ diff --git a/test/test_misc/tests_init.cpp b/test/test_misc/tests_init.cpp index ae1d0ec3..c2d68683 100644 --- a/test/test_misc/tests_init.cpp +++ b/test/test_misc/tests_init.cpp @@ -1,7 +1,6 @@ -#include -#include #include -#include +#include "globals.h" +#include "init.h" #include "tests_init.h" @@ -121,7 +120,6 @@ void test_initialisation_outputs_PWM_idle(void) configPage6.iacChannels = 1; configPage6.iacAlgorithm = 2; - writeAllConfig(); //Have to save config here to prevent initialiseAll() from overwriting it initialiseAll(); //Run the main initialise function bool isIdlePWM = (configPage6.iacAlgorithm > 0) && ((configPage6.iacAlgorithm <= 3) || (configPage6.iacAlgorithm == 6)); @@ -152,6 +150,10 @@ void test_initialisation_outputs_VVT(void) TEST_ASSERT_EQUAL_MESSAGE(OUTPUT, getPinMode(pinVVT_2), "VVT2"); } +#if !defined(NOT_A_PIN) +#define NOT_A_PIN 0 +#endif + uint8_t getPinMode(uint8_t pin) { uint8_t bit = digitalPinToBitMask(pin); diff --git a/test/test_misc2/tests_maths.cpp b/test/test_misc2/tests_maths.cpp index a2893c84..db7c885d 100644 --- a/test/test_misc2/tests_maths.cpp +++ b/test/test_misc2/tests_maths.cpp @@ -131,6 +131,15 @@ void test_maths_div100_S16(void) void test_maths_div100_S32(void) { //Check both the signed and unsigned results +#if defined(__arm__) + TEST_ASSERT_EQUAL_INT32(1000000L, div100((int)100000000L)); + TEST_ASSERT_EQUAL_INT32(0, div100((int)0)); + TEST_ASSERT_EQUAL_INT32(0, div100((int)50)); + + TEST_ASSERT_EQUAL_INT32(-1000000L, div100((int)-100000000L)); + TEST_ASSERT_EQUAL_INT32(0, div100((int)-50)); + TEST_ASSERT_EQUAL_INT32(-1, div100((int)-120)); +#else TEST_ASSERT_EQUAL_INT32(1000000L, div100((int32_t)100000000L)); TEST_ASSERT_EQUAL_INT32(0, div100((int32_t)0)); TEST_ASSERT_EQUAL_INT32(0, div100((int32_t)50)); @@ -138,4 +147,5 @@ void test_maths_div100_S32(void) TEST_ASSERT_EQUAL_INT32(-1000000L, div100((int32_t)-100000000L)); TEST_ASSERT_EQUAL_INT32(0, div100((int32_t)-50)); TEST_ASSERT_EQUAL_INT32(-1, div100((int32_t)-120)); +#endif }