sanitize ISR IRAM_ATTR and global vars
This commit is contained in:
1 parent
c41d44bd7d
commit
69da95cd66
6 files changed
+31
-29
No files matched your search
+3
-1
@@ -317,7 +317,9 @@ void dp_drawPage(bool nextpage) {
|
||||
|
||||
#if (TIME_SYNC_INTERVAL)
|
||||
timeState = TimePulseTick ? ' ' : timeSetSymbols[timeSource];
|
||||
TimePulseTick = false;
|
||||
portENTER_CRITICAL(&mux);
|
||||
TimePulseTick = false; // flip global variable pulse ticker
|
||||
portEXIT_CRITICAL(&mux);
|
||||
time(&now);
|
||||
localtime_r(&now, &timeinfo);
|
||||
strftime(strftime_buf, sizeof(strftime_buf), "%c", &timeinfo);
|
||||
|
||||
+18
-24
@@ -48,37 +48,31 @@ Low priority numbers denote low priority tasks.
|
||||
-------------------------------------------------------------------------------
|
||||
0 displayIRQ -> display refresh -> 40ms (DISPLAYREFRESH_MS)
|
||||
1 ppsIRQ -> pps clock irq -> 1sec
|
||||
2 (unused)
|
||||
3 MatrixDisplayIRQ -> matrix mux cycle -> 0,5ms (MATRIX_DISPLAY_SCAN_US)
|
||||
|
||||
|
||||
// Interrupt routines
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
irqHandlerTask (Core 1), see irqhandler.cpp
|
||||
|
||||
fired by hardware
|
||||
DisplayIRQ -> esp32 timer 0
|
||||
CLOCKIRQ -> esp32 timer 1 or external GPIO (RTC_INT or GPS_INT)
|
||||
MatrixDisplayIRQ-> esp32 timer 3
|
||||
ButtonIRQ -> external GPIO
|
||||
PMUIRQ -> PMU chip GPIO
|
||||
|
||||
fired by software
|
||||
TIMESYNC_IRQ -> setTimeSyncIRQ() -> Ticker.h
|
||||
CYCLIC_IRQ -> setCyclicIRQ() -> Ticker.h
|
||||
SENDCYCLE_IRQ -> setSendIRQ() -> xTimer
|
||||
BME_IRQ -> setBMEIRQ() -> Ticker.h
|
||||
|
||||
ClockTask (Core 1), see timekeeper.cpp
|
||||
|
||||
fired by hardware
|
||||
CLOCKIRQ -> esp32 timer 1
|
||||
|
||||
|
||||
// External RTC timer (if present)
|
||||
-------------------------------------------------------------------------------
|
||||
triggers pps 1 sec impulse
|
||||
|
||||
|
||||
// Interrupt routines
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
ISRs fired by CPU or GPIO:
|
||||
DisplayIRQ <- esp32 timer 0
|
||||
CLOCKIRQ <- esp32 timer 1 or GPIO (RTC_INT or GPS_INT)
|
||||
MatrixDisplayIRQ<- esp32 timer 3
|
||||
ButtonIRQ <- GPIO <- Button
|
||||
PMUIRQ <- GPIO <- PMU chip
|
||||
|
||||
Application IRQs fired by software:
|
||||
TIMESYNC_IRQ <- setTimeSyncIRQ() <- Ticker.h
|
||||
CYCLIC_IRQ <- setCyclicIRQ() <- Ticker.h
|
||||
SENDCYCLE_IRQ <- setSendIRQ() <- xTimer
|
||||
BME_IRQ <- setBMEIRQ() <- Ticker.h
|
||||
|
||||
*/
|
||||
|
||||
// Basic Config
|
||||
|
||||
+6
-2
@@ -19,7 +19,9 @@ static const char TAG[] = __FILE__;
|
||||
// G = GPS / R = RTC / L = LORA / * = no sync / ? = never synced
|
||||
const char timeSetSymbols[] = {'G', 'R', 'L', '*', '?'};
|
||||
|
||||
DRAM_ATTR bool volatile TimePulseTick = false;
|
||||
portMUX_TYPE mux = portMUX_INITIALIZER_UNLOCKED;
|
||||
|
||||
DRAM_ATTR bool TimePulseTick = false;
|
||||
timesource_t timeSource = _unsynced;
|
||||
TaskHandle_t ClockTask = NULL;
|
||||
hw_timer_t *ppsIRQ = NULL;
|
||||
@@ -211,7 +213,9 @@ void IRAM_ATTR CLOCKIRQ(void) {
|
||||
// flip time pulse ticker, if needed
|
||||
#ifdef HAS_DISPLAY
|
||||
#if (defined GPS_INT || defined RTC_INT)
|
||||
TimePulseTick = !TimePulseTick; // flip pulse ticker
|
||||
portENTER_CRITICAL(&mux);
|
||||
TimePulseTick = !TimePulseTick; // flip global variable pulse ticker
|
||||
portEXIT_CRITICAL(&mux);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
Reference in new issue
Block a user