mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2026-06-15 12:26:33 +03:00
fix lint warning for C++20 volatile
This commit is contained in:
@@ -32,24 +32,24 @@ volatile unsigned long AnalogSensor::edgecnt[] = {0, 0, 0};
|
|||||||
void IRAM_ATTR AnalogSensor::freqIrq0() {
|
void IRAM_ATTR AnalogSensor::freqIrq0() {
|
||||||
portENTER_CRITICAL_ISR(&mux);
|
portENTER_CRITICAL_ISR(&mux);
|
||||||
if (micros() - edge[0] > 10) { // limit to 100kHz
|
if (micros() - edge[0] > 10) { // limit to 100kHz
|
||||||
edgecnt[0]++;
|
edgecnt[0] = edgecnt[0] + 1;
|
||||||
edge[0] = micros();
|
edge[0] = micros();
|
||||||
}
|
}
|
||||||
portEXIT_CRITICAL_ISR(&mux);
|
portEXIT_CRITICAL_ISR(&mux);
|
||||||
}
|
}
|
||||||
void IRAM_ATTR AnalogSensor::freqIrq1() {
|
void IRAM_ATTR AnalogSensor::freqIrq1() {
|
||||||
portENTER_CRITICAL_ISR(&mux);
|
portENTER_CRITICAL_ISR(&mux);
|
||||||
if (micros() - edge[1] > 10) { // limit to 100kHz
|
if (micros() - edge[1] > 10) { // limit to 100kHz
|
||||||
edgecnt[1]++;
|
edgecnt[1] = edgecnt[1] + 1;
|
||||||
edge[1] = micros();
|
edge[1] = micros();
|
||||||
}
|
}
|
||||||
portEXIT_CRITICAL_ISR(&mux);
|
portEXIT_CRITICAL_ISR(&mux);
|
||||||
}
|
}
|
||||||
void IRAM_ATTR AnalogSensor::freqIrq2() {
|
void IRAM_ATTR AnalogSensor::freqIrq2() {
|
||||||
portENTER_CRITICAL_ISR(&mux);
|
portENTER_CRITICAL_ISR(&mux);
|
||||||
if (micros() - edge[2] > 10) { // limit to 100kHz
|
if (micros() - edge[2] > 10) { // limit to 100kHz
|
||||||
edgecnt[2]++;
|
edgecnt[2] = edgecnt[2] + 1;
|
||||||
edge[2] = micros();
|
edge[2] = micros();
|
||||||
}
|
}
|
||||||
portEXIT_CRITICAL_ISR(&mux);
|
portEXIT_CRITICAL_ISR(&mux);
|
||||||
}
|
}
|
||||||
@@ -272,8 +272,10 @@ void AnalogSensor::reload(bool get_nvs) {
|
|||||||
sensor.set_value(0);
|
sensor.set_value(0);
|
||||||
publish_sensor(sensor);
|
publish_sensor(sensor);
|
||||||
attachInterrupt(sensor.gpio(), index == 0 ? freqIrq0 : index == 1 ? freqIrq1 : freqIrq2, FALLING);
|
attachInterrupt(sensor.gpio(), index == 0 ? freqIrq0 : index == 1 ? freqIrq1 : freqIrq2, FALLING);
|
||||||
lastedge[index] = edge[index] = micros();
|
unsigned long now = micros();
|
||||||
edgecnt[index] = 0;
|
edge[index] = now;
|
||||||
|
lastedge[index] = now;
|
||||||
|
edgecnt[index] = 0;
|
||||||
} else if (sensor.type() >= AnalogType::CNT_0 && sensor.type() <= AnalogType::CNT_2) {
|
} else if (sensor.type() >= AnalogType::CNT_0 && sensor.type() <= AnalogType::CNT_2) {
|
||||||
auto index = sensor.type() - AnalogType::CNT_0;
|
auto index = sensor.type() - AnalogType::CNT_0;
|
||||||
LOG_DEBUG("Counter %d on GPIO %02d", index, sensor.gpio());
|
LOG_DEBUG("Counter %d on GPIO %02d", index, sensor.gpio());
|
||||||
|
|||||||
Reference in New Issue
Block a user