mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2026-06-09 18:19:36 +00:00
add volatile, as they are ISR-written outside the main loop
This commit is contained in:
@@ -26,8 +26,8 @@ std::vector<uint8_t> AnalogSensor::exclude_types_;
|
||||
|
||||
#ifndef EMSESP_STANDALONE
|
||||
portMUX_TYPE mux = portMUX_INITIALIZER_UNLOCKED;
|
||||
unsigned long AnalogSensor::edge[] = {0, 0, 0};
|
||||
unsigned long AnalogSensor::edgecnt[] = {0, 0, 0};
|
||||
volatile unsigned long AnalogSensor::edge[] = {0, 0, 0};
|
||||
volatile unsigned long AnalogSensor::edgecnt[] = {0, 0, 0};
|
||||
|
||||
void IRAM_ATTR AnalogSensor::freqIrq0() {
|
||||
portENTER_CRITICAL_ISR(&mux);
|
||||
|
||||
@@ -210,8 +210,8 @@ class AnalogSensor {
|
||||
static void IRAM_ATTR freqIrq0();
|
||||
static void IRAM_ATTR freqIrq1();
|
||||
static void IRAM_ATTR freqIrq2();
|
||||
static unsigned long edge[3];
|
||||
static unsigned long edgecnt[3];
|
||||
static volatile unsigned long edge[3]; // written from freqIrqN() ISRs, read from the main measure() loop (partly outside the critical section)
|
||||
static volatile unsigned long edgecnt[3]; // written from freqIrqN() ISRs, read from the main measure() loop (partly outside the critical section)
|
||||
unsigned long lastedge[3] = {0, 0, 0};
|
||||
#endif
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user