Skip to content

Commit 40da8bb

Browse files
committed
Macros to compile on ESP8266
1 parent 77acca1 commit 40da8bb

3 files changed

Lines changed: 11 additions & 3 deletions

File tree

src/ProcessScheduler/Config.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
#include <Arduino.h>
55

66
/* Uncomment this to allow Exception Handling functionality */
7-
#define _PROCESS_EXCEPTION_HANDLING
7+
//#define _PROCESS_EXCEPTION_HANDLING
88

99
/* Uncomment this to allow the scheduler to interrupt long running processes */
1010
// This requires _PROCESS_EXCEPTION_HANDLING to also be enabled
11-
#define _PROCESS_TIMEOUT_INTERRUPTS
11+
//#define _PROCESS_TIMEOUT_INTERRUPTS
1212

1313
/* Uncomment this to allow Process timing statistics functionality */
1414
#define _PROCESS_STATISTICS

src/ProcessScheduler/Includes.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,8 @@ typedef enum ProcessWarning
7878
#error "'_PROCESS_EXCEPTION_HANDLING' is not supported on the ESP8266."
7979
#endif
8080

81+
82+
#if defined(_PROCESS_TIMEOUT_INTERRUPTS) && !defined(_PROCESS_EXCEPTION_HANDLING)
83+
#error "'_PROCESS_TIMEOUT_INTERRUPTS' requires enabling `_PROCESS_EXCEPTION_HANDLING`"
84+
#endif
8185
#endif

src/ProcessScheduler/Scheduler.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@
22
#include "Process.h"
33

44
Process *Scheduler::_active = NULL;
5+
6+
#ifdef _PROCESS_EXCEPTION_HANDLING
57
jmp_buf Scheduler::_env = {};
8+
#endif
69

10+
#ifdef _PROCESS_TIMEOUT_INTERRUPTS
711
ISR(TIMER0_COMPA_vect)
812
{
913
if (Scheduler::getActive()) { // routine is running
@@ -12,7 +16,7 @@ ISR(TIMER0_COMPA_vect)
1216
longjmp(Scheduler::_env, LONGJMP_ISR_CODE);
1317
}
1418
}
15-
19+
#endif
1620

1721
Scheduler::Scheduler()
1822
: _pLevels{}

0 commit comments

Comments
 (0)