From 3d68d1859ebbf5f5fdc2f6c1ab4d85b682a45571 Mon Sep 17 00:00:00 2001 From: Josh Stewart Date: Tue, 4 Oct 2016 12:50:09 +1100 Subject: [PATCH] Compatibility for the Mega2561 --- scheduler.ino | 12 ++++++------ speeduino.ino | 4 ++++ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/scheduler.ino b/scheduler.ino index d5cb64fe..cbd0df66 100644 --- a/scheduler.ino +++ b/scheduler.ino @@ -287,7 +287,7 @@ ISR(TIMER3_COMPB_vect, ISR_NOBLOCK) //fuelSchedule2 } } -#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) //AVR chips use the ISR for this +#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) || defined(__AVR_ATmega2561__) //AVR chips use the ISR for this ISR(TIMER3_COMPC_vect, ISR_NOBLOCK) //fuelSchedule3 #elif defined (CORE_TEENSY) && defined (__MK20DX256__) void timer3compareCinterrupt() //Most ARM chips can simply call a function @@ -308,7 +308,7 @@ void timer3compareCinterrupt() //Most ARM chips can simply call a function } } -#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) //AVR chips use the ISR for this +#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) || defined(__AVR_ATmega2561__) //AVR chips use the ISR for this ISR(TIMER4_COMPB_vect, ISR_NOBLOCK) //fuelSchedule4 #elif defined (CORE_TEENSY) && defined (__MK20DX256__) void timer4compareBinterrupt() //Most ARM chips can simply call a function @@ -329,7 +329,7 @@ void timer4compareBinterrupt() //Most ARM chips can simply call a function } } -#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) //AVR chips use the ISR for this +#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) || defined(__AVR_ATmega2561__) //AVR chips use the ISR for this ISR(TIMER5_COMPA_vect, ISR_NOBLOCK) //ignitionSchedule1 #elif defined (CORE_TEENSY) && defined (__MK20DX256__) void timer5compareAinterrupt() //Most ARM chips can simply call a function @@ -353,7 +353,7 @@ void timer5compareAinterrupt() //Most ARM chips can simply call a function } } -#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) //AVR chips use the ISR for this +#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) || defined(__AVR_ATmega2561__) //AVR chips use the ISR for this ISR(TIMER5_COMPB_vect, ISR_NOBLOCK) //ignitionSchedule2 #elif defined (CORE_TEENSY) && defined (__MK20DX256__) void timer5compareBinterrupt() //Most ARM chips can simply call a function @@ -377,7 +377,7 @@ void timer5compareBinterrupt() //Most ARM chips can simply call a function } } -#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) //AVR chips use the ISR for this +#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) || defined(__AVR_ATmega2561__) //AVR chips use the ISR for this ISR(TIMER5_COMPC_vect, ISR_NOBLOCK) //ignitionSchedule3 #elif defined (CORE_TEENSY) && defined (__MK20DX256__) void timer5compareCinterrupt() //Most ARM chips can simply call a function @@ -401,7 +401,7 @@ void timer5compareCinterrupt() //Most ARM chips can simply call a function } } -#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) //AVR chips use the ISR for this +#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) || defined(__AVR_ATmega2561__) //AVR chips use the ISR for this ISR(TIMER4_COMPA_vect, ISR_NOBLOCK) //ignitionSchedule4 #elif defined (CORE_TEENSY) && defined (__MK20DX256__) void timer4compareAinterrupt() //Most ARM chips can simply call a function diff --git a/speeduino.ino b/speeduino.ino index 2b728250..ffeebc5d 100644 --- a/speeduino.ino +++ b/speeduino.ino @@ -150,7 +150,9 @@ volatile bool fpPrimed = false; //Tracks whether or not the fuel pump priming ha void setup() { Serial.begin(115200); +#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) //ATmega2561 does not have Serial3 if (configPage1.canEnable) { Serial3.begin(115200); } +#endif //Setup the dummy fuel and ignition tables //dummyFuelTable(&fuelTable); @@ -754,6 +756,7 @@ void loop() command(); } } +#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) //ATmega2561 does not have Serial3 //if Can interface is enabled then check for serial3 requests. if (configPage1.canEnable) { @@ -765,6 +768,7 @@ void loop() } } } +#endif // if (configPage1.displayType && (mainLoopCount & 255) == 1) { updateDisplay();} //Displays currently disabled