diff --git a/.github/workflows/build-firmware.yml b/.github/workflows/build-firmware.yml index a7709912..9ea8a96c 100644 --- a/.github/workflows/build-firmware.yml +++ b/.github/workflows/build-firmware.yml @@ -35,7 +35,7 @@ jobs: pip install --upgrade platformio - name: Build test atmel - run: platformio run -e megaatmega2560 -e megaatmega2561 + run: platformio run -e megaatmega2560 -e megaatmega2560-6-3 -e megaatmega2560-8-1 -e megaatmega2561 - name: Build test teensy run: platformio run -e teensy35 -e teensy36 -e teensy41 diff --git a/platformio.ini b/platformio.ini index 645243a7..1e71bca4 100644 --- a/platformio.ini +++ b/platformio.ini @@ -20,15 +20,19 @@ test_build_src = yes debug_tool = simavr test_ignore = test_table3d_native +;This environment is the same as the above, however compiles for 6 channels of fuel and 3 channels of ignition +[env:megaatmega2560-6-3] +extends = env:megaatmega2560 +build_flags = -DUSE_LIBDIVIDE -O3 -ffast-math -fshort-enums -funroll-loops -Wall -Wextra -std=c99 -DINJ_CHANNELS=6 -DIGN_CHANNELS=3 + +;As the above, however compiles for 8 channels of fuel and only a single ignition channel +[env:megaatmega2560-8-1] +extends = env:megaatmega2560 +build_flags = -DUSE_LIBDIVIDE -O3 -ffast-math -fshort-enums -funroll-loops -Wall -Wextra -std=c99 -DINJ_CHANNELS=8 -DIGN_CHANNELS=1 + [env:megaatmega2561] -platform=atmelavr +extends = env:megaatmega2560 board=ATmega2561 -framework=arduino -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 diff --git a/speeduino/comms_legacy.cpp b/speeduino/comms_legacy.cpp index 82ffa430..093aa88f 100644 --- a/speeduino/comms_legacy.cpp +++ b/speeduino/comms_legacy.cpp @@ -674,7 +674,7 @@ void sendValues(uint16_t offset, uint16_t packetLength, byte cmd, Stream &target #if defined(secondarySerial_AVAILABLE) if (&targetPort == &secondarySerial) { - //CAN serial + //Using Secondary serial, check if selected protocol requires the echo back of the command if( (configPage9.secondarySerialProtocol == SECONDARY_SERIAL_PROTO_GENERIC_FIXED) || (configPage9.secondarySerialProtocol == SECONDARY_SERIAL_PROTO_GENERIC_INI) || (configPage9.secondarySerialProtocol == SECONDARY_SERIAL_PROTO_REALDASH)) { if (cmd == 0x30) diff --git a/speeduino/globals.h b/speeduino/globals.h index a97647d6..a60515e1 100644 --- a/speeduino/globals.h +++ b/speeduino/globals.h @@ -34,13 +34,17 @@ #define BOARD_MAX_DIGITAL_PINS 54 //digital pins +1 #define BOARD_MAX_IO_PINS 70 //digital pins + analog channels + 1 #define BOARD_MAX_ADC_PINS 15 //Number of analog pins -#ifndef LED_BUILTIN - #define LED_BUILTIN 13 -#endif + #ifndef LED_BUILTIN + #define LED_BUILTIN 13 + #endif #define CORE_AVR #define BOARD_H "board_avr2560.h" - #define INJ_CHANNELS 4 - #define IGN_CHANNELS 5 + #ifndef INJ_CHANNELS + #define INJ_CHANNELS 4 + #endif + #ifndef IGN_CHANNELS + #define IGN_CHANNELS 5 + #endif #if defined(__AVR_ATmega2561__) //This is a workaround to avoid having to change all the references to higher ADC channels. We simply define the channels (Which don't exist on the 2561) as being the same as A0-A7 diff --git a/speeduino/init.cpp b/speeduino/init.cpp index 9bd3d616..96e0cc1e 100644 --- a/speeduino/init.cpp +++ b/speeduino/init.cpp @@ -3665,11 +3665,11 @@ void changeHalfToFullSync(void) fuelSchedule6.pStartFunction = openInjector6; fuelSchedule6.pEndFunction = closeInjector6; #endif -#if INJ_CHANNELS >= 6 +#if INJ_CHANNELS >= 7 fuelSchedule7.pStartFunction = openInjector7; fuelSchedule7.pEndFunction = closeInjector7; #endif -#if INJ_CHANNELS >= 6 +#if INJ_CHANNELS >= 8 fuelSchedule8.pStartFunction = openInjector8; fuelSchedule8.pEndFunction = closeInjector8; #endif diff --git a/speeduino/scheduler.cpp b/speeduino/scheduler.cpp index 47d8f524..bd3b13fe 100644 --- a/speeduino/scheduler.cpp +++ b/speeduino/scheduler.cpp @@ -995,6 +995,7 @@ void ignitionSchedule1Interrupt(void) //Most ARM chips can simply call a functio ignitionScheduleISR(ignitionSchedule1); } +#if IGN_CHANNELS >= 2 #if defined(CORE_AVR) //AVR chips use the ISR for this ISR(TIMER5_COMPB_vect) //cppcheck-suppress misra-c2012-8.2 #else @@ -1003,7 +1004,9 @@ void ignitionSchedule2Interrupt(void) //Most ARM chips can simply call a functio { ignitionScheduleISR(ignitionSchedule2); } +#endif +#if IGN_CHANNELS >= 3 #if defined(CORE_AVR) //AVR chips use the ISR for this ISR(TIMER5_COMPC_vect) //cppcheck-suppress misra-c2012-8.2 #else @@ -1012,7 +1015,9 @@ void ignitionSchedule3Interrupt(void) //Most ARM chips can simply call a functio { ignitionScheduleISR(ignitionSchedule3); } +#endif +#if IGN_CHANNELS >= 4 #if defined(CORE_AVR) //AVR chips use the ISR for this ISR(TIMER4_COMPA_vect) //cppcheck-suppress misra-c2012-8.2 #else @@ -1021,7 +1026,9 @@ void ignitionSchedule4Interrupt(void) //Most ARM chips can simply call a functio { ignitionScheduleISR(ignitionSchedule4); } +#endif +#if IGN_CHANNELS >= 5 #if defined(CORE_AVR) //AVR chips use the ISR for this ISR(TIMER4_COMPC_vect) //cppcheck-suppress misra-c2012-8.2 #else @@ -1030,6 +1037,7 @@ void ignitionSchedule5Interrupt(void) //Most ARM chips can simply call a functio { ignitionScheduleISR(ignitionSchedule5); } +#endif #if IGN_CHANNELS >= 6 #if defined(CORE_AVR) //AVR chips use the ISR for this