mirror of https://github.com/arendst/Tasmota.git
commit
9785a7997c
|
@ -26,31 +26,28 @@
|
||||||
|
|
||||||
#define XSNS_53 53
|
#define XSNS_53 53
|
||||||
|
|
||||||
// Baudrate des D0 Ausgangs, sollte bei den meisten Zählern 9600 sein
|
// default baudrate of D0 output
|
||||||
#define SML_BAUDRATE 9600
|
#define SML_BAUDRATE 9600
|
||||||
|
|
||||||
// sende dies alle N Sekunden, für Zähler die erst auf Anforderung etwas senden
|
// send this every N seconds (for meters that only send data on demand)
|
||||||
//#define SML_SEND_SEQ
|
//#define SML_SEND_SEQ
|
||||||
|
|
||||||
// debug counter input to led for counter1 and 2
|
// debug counter input to led for counter1 and 2
|
||||||
//#define DEBUG_CNT_LED1 2
|
//#define DEBUG_CNT_LED1 2
|
||||||
//#define DEBUG_CNT_LED1 2
|
//#define DEBUG_CNT_LED1 2
|
||||||
|
|
||||||
// use analog optical counter sensor with AD Converter ADS1115
|
// use analog optical counter sensor with AD Converter ADS1115 (not yet)
|
||||||
//#define ANALOG_OPTO_SENSOR
|
//#define ANALOG_OPTO_SENSOR
|
||||||
// fototransistor mit pullup an A0, A1 des ADS1115 A3 and +3.3V
|
// fototransistor with pullup at A0, A1 of ADS1115 A3 and +3.3V
|
||||||
// die pegel und die verstärkung können dann automatisch kalibriert werden
|
// level and amplification are automatically set
|
||||||
|
|
||||||
|
|
||||||
// support für mehr als 2 Meter mit spezieller Tasmota Serial Version
|
|
||||||
// dazu muss der modifizierte Treiber => TasmotaSerial-2.3.1 ebenfalls kopiert werden
|
|
||||||
|
|
||||||
#include <TasmotaSerial.h>
|
#include <TasmotaSerial.h>
|
||||||
|
|
||||||
// use special no wait serial driver
|
// use special no wait serial driver
|
||||||
#define SPECIAL_SS
|
#define SPECIAL_SS
|
||||||
|
|
||||||
// addresse a bug in meter DWS74
|
// addresses a bug in meter DWS74
|
||||||
//#define DWS74_BUG
|
//#define DWS74_BUG
|
||||||
|
|
||||||
// max 23 chars
|
// max 23 chars
|
||||||
|
@ -1666,6 +1663,14 @@ struct SML_COUNTER {
|
||||||
} sml_counters[MAX_COUNTERS];
|
} sml_counters[MAX_COUNTERS];
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef ARDUINO_ESP8266_RELEASE_2_3_0 // Fix core 2.5.x ISR not in IRAM Exception
|
||||||
|
void SML_CounterUpd(uint8_t index) ICACHE_RAM_ATTR;
|
||||||
|
void SML_CounterUpd1(void) ICACHE_RAM_ATTR;
|
||||||
|
void SML_CounterUpd2(void) ICACHE_RAM_ATTR;
|
||||||
|
void SML_CounterUpd3(void) ICACHE_RAM_ATTR;
|
||||||
|
void SML_CounterUpd4(void) ICACHE_RAM_ATTR;
|
||||||
|
#endif // ARDUINO_ESP8266_RELEASE_2_3_0
|
||||||
|
|
||||||
void SML_CounterUpd(uint8_t index) {
|
void SML_CounterUpd(uint8_t index) {
|
||||||
uint32_t ltime=millis()-sml_counters[index].sml_counter_ltime;
|
uint32_t ltime=millis()-sml_counters[index].sml_counter_ltime;
|
||||||
sml_counters[index].sml_counter_ltime=millis();
|
sml_counters[index].sml_counter_ltime=millis();
|
||||||
|
@ -1732,14 +1737,14 @@ void SML_Init(void) {
|
||||||
lp+=2;
|
lp+=2;
|
||||||
meters_used=strtol(lp,0,10);
|
meters_used=strtol(lp,0,10);
|
||||||
section=1;
|
section=1;
|
||||||
uint32_t mlen=METER_DEF_SIZE;
|
uint32_t mlen=0;
|
||||||
for (uint32_t cnt=0;cnt<METER_DEF_SIZE;cnt++) {
|
for (uint32_t cnt=0;cnt<METER_DEF_SIZE-1;cnt++) {
|
||||||
if (lp[cnt]=='#') {
|
if (lp[cnt]=='\n' && lp[cnt+1]=='#') {
|
||||||
mlen=cnt+3;
|
mlen=cnt+3;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (mlen==METER_DEF_SIZE) return; // missing end #
|
if (mlen==0) return; // missing end #
|
||||||
script_meter=(uint8_t*)calloc(mlen,1);
|
script_meter=(uint8_t*)calloc(mlen,1);
|
||||||
if (!script_meter) return;
|
if (!script_meter) return;
|
||||||
tp=script_meter;
|
tp=script_meter;
|
||||||
|
@ -1747,7 +1752,7 @@ void SML_Init(void) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (*lp=='#') {
|
if (!*lp || *lp=='#' || *lp=='>') {
|
||||||
if (*(tp-1)=='|') *(tp-1)=0;
|
if (*(tp-1)=='|') *(tp-1)=0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue