From 6d7c1925b0f9b8ca267d947822d730297d425020 Mon Sep 17 00:00:00 2001 From: Harald Barth Date: Sun, 1 Aug 2021 11:56:12 +0200 Subject: [PATCH] only pragma -O3 critical functions --- DCCWaveform.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/DCCWaveform.cpp b/DCCWaveform.cpp index df88e5d..1521dfc 100644 --- a/DCCWaveform.cpp +++ b/DCCWaveform.cpp @@ -17,7 +17,7 @@ * You should have received a copy of the GNU General Public License * along with CommandStation. If not, see . */ - #pragma GCC optimize ("-O3") + #include #include "DCCWaveform.h" @@ -58,6 +58,8 @@ void DCCWaveform::loop(bool ackManagerActive) { progTrack.checkPowerOverload(ackManagerActive); } +#pragma GCC push_options +#pragma GCC optimize ("-O3") void DCCWaveform::interruptHandler() { // call the timer edge sensitive actions for progtrack and maintrack // member functions would be cleaner but have more overhead @@ -79,7 +81,7 @@ void DCCWaveform::interruptHandler() { else if (progTrack.ackPending) progTrack.checkAck(); } - +#pragma GCC push_options // An instance of this class handles the DCC transmissions for one track. (main or prog) // Interrupts are marshalled via the statics. @@ -197,6 +199,8 @@ const bool DCCWaveform::signalTransform[]={ /* WAVE_LOW_0 -> */ LOW, /* WAVE_PENDING (should not happen) -> */ LOW}; +#pragma GCC push_options +#pragma GCC optimize ("-O3") void DCCWaveform::interrupt2() { // calculate the next bit to be sent: // set state WAVE_MID_1 for a 1=bit @@ -252,7 +256,7 @@ void DCCWaveform::interrupt2() { } } } - +#pragma GCC pop_options // Wait until there is no packet pending, then make this pending @@ -306,6 +310,8 @@ byte DCCWaveform::getAck() { return(0); // pending set off but not detected means no ACK. } +#pragma GCC push_options +#pragma GCC optimize ("-O3") void DCCWaveform::checkAck() { // This function operates in interrupt() time so must be fast and can't DIAG if (sentResetsSincePacket > 6) { //ACK timeout @@ -355,3 +361,4 @@ void DCCWaveform::checkAck() { } ackPulseStart=0; // We have detected a too-short or too-long pulse so ignore and wait for next leading edge } +#pragma GCC pop_options