mirror of https://github.com/arendst/Tasmota.git
Merge pull request #8782 from gemu2015/sml-fix
fix sml counter irq mode
This commit is contained in:
commit
ad46af6d54
|
@ -49,6 +49,7 @@
|
||||||
#define SPECIAL_SS
|
#define SPECIAL_SS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#undef TMSBSIZ
|
||||||
#define TMSBSIZ 256
|
#define TMSBSIZ 256
|
||||||
|
|
||||||
// addresses a bug in meter DWS74
|
// addresses a bug in meter DWS74
|
||||||
|
@ -1785,6 +1786,7 @@ struct SML_COUNTER {
|
||||||
uint32_t sml_cnt_last_ts;
|
uint32_t sml_cnt_last_ts;
|
||||||
uint32_t sml_counter_ltime;
|
uint32_t sml_counter_ltime;
|
||||||
uint16_t sml_debounce;
|
uint16_t sml_debounce;
|
||||||
|
uint8_t sml_cnt_updated;
|
||||||
|
|
||||||
#ifdef ANALOG_OPTO_SENSOR
|
#ifdef ANALOG_OPTO_SENSOR
|
||||||
int16_t ana_curr;
|
int16_t ana_curr;
|
||||||
|
@ -1813,7 +1815,8 @@ void SML_CounterUpd(uint8_t index) {
|
||||||
sml_counters[index].sml_counter_ltime=millis();
|
sml_counters[index].sml_counter_ltime=millis();
|
||||||
if (ltime>sml_counters[index].sml_debounce) {
|
if (ltime>sml_counters[index].sml_debounce) {
|
||||||
RtcSettings.pulse_counter[index]++;
|
RtcSettings.pulse_counter[index]++;
|
||||||
InjektCounterValue(sml_counters[index].sml_cnt_old_state,RtcSettings.pulse_counter[index]);
|
sml_counters[index].sml_cnt_updated=1;
|
||||||
|
//InjektCounterValue(sml_counters[index].sml_cnt_old_state,RtcSettings.pulse_counter[index]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// rising edge
|
// rising edge
|
||||||
|
@ -2310,6 +2313,13 @@ uint32_t ctime=millis();
|
||||||
if (cindex==1) SetDBGLed(meter_desc_p[meters].srcpin,DEBUG_CNT_LED2);
|
if (cindex==1) SetDBGLed(meter_desc_p[meters].srcpin,DEBUG_CNT_LED2);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (sml_counters[cindex].sml_cnt_updated) {
|
||||||
|
InjektCounterValue(sml_counters[cindex].sml_cnt_old_state,RtcSettings.pulse_counter[cindex]);
|
||||||
|
sml_counters[cindex].sml_cnt_updated=0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
cindex++;
|
cindex++;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue