mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-22 10:16:30 +00:00
ed300L support
This commit is contained in:
parent
257dd18796
commit
61b97350da
@ -1508,9 +1508,9 @@ chknext:
|
|||||||
lp=GetNumericResult(lp,OPER_EQU,&fvar2,0);
|
lp=GetNumericResult(lp,OPER_EQU,&fvar2,0);
|
||||||
SCRIPT_SKIP_SPACES
|
SCRIPT_SKIP_SPACES
|
||||||
fvar=fvar1;
|
fvar=fvar1;
|
||||||
if ((*opp=='<' && fvar1<fvar2) ||
|
if ((*opp=='<' && fvar1<fvar2) ||
|
||||||
(*opp=='>' && fvar1>fvar2) ||
|
(*opp=='>' && fvar1>fvar2) ||
|
||||||
(*opp=='=' && fvar1==fvar2))
|
(*opp=='=' && fvar1==fvar2))
|
||||||
{
|
{
|
||||||
if (*lp!='<' && *lp!='>' && *lp!='=' && *lp!=')' && *lp!=SCRIPT_EOL) {
|
if (*lp!='<' && *lp!='>' && *lp!='=' && *lp!=')' && *lp!=SCRIPT_EOL) {
|
||||||
float fvar3;
|
float fvar3;
|
||||||
@ -1759,13 +1759,18 @@ chknext:
|
|||||||
float fvar3;
|
float fvar3;
|
||||||
lp=GetNumericResult(lp,OPER_EQU,&fvar3,0);
|
lp=GetNumericResult(lp,OPER_EQU,&fvar3,0);
|
||||||
fvar=SML_SetBaud(fvar1,fvar3);
|
fvar=SML_SetBaud(fvar1,fvar3);
|
||||||
} else {
|
} else if (fvar2==1) {
|
||||||
char str[SCRIPT_MAXSSIZE];
|
char str[SCRIPT_MAXSSIZE];
|
||||||
lp=GetStringResult(lp,OPER_EQU,str,0);
|
lp=GetStringResult(lp,OPER_EQU,str,0);
|
||||||
fvar=SML_Write(fvar1,str);
|
fvar=SML_Write(fvar1,str);
|
||||||
|
} else {
|
||||||
|
#ifdef ED300L
|
||||||
|
fvar=SML_Status(fvar1);
|
||||||
|
#else
|
||||||
|
fvar=0;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
lp++;
|
lp++;
|
||||||
fvar=0;
|
|
||||||
len=0;
|
len=0;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -901,6 +901,11 @@ uint8_t dchars[16];
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef ED300L
|
||||||
|
uint8_t sml_status[MAX_METERS];
|
||||||
|
uint8_t g_mindex;
|
||||||
|
#endif
|
||||||
|
|
||||||
// skip sml entries
|
// skip sml entries
|
||||||
uint8_t *skip_sml(uint8_t *cp,int16_t *res) {
|
uint8_t *skip_sml(uint8_t *cp,int16_t *res) {
|
||||||
uint8_t len,len1,type;
|
uint8_t len,len1,type;
|
||||||
@ -933,6 +938,14 @@ double dval;
|
|||||||
|
|
||||||
// scan for values
|
// scan for values
|
||||||
// check status
|
// check status
|
||||||
|
#ifdef ED300L
|
||||||
|
unsigned char *cpx=cp-5;
|
||||||
|
// decode OBIS 0180 amd extract direction info
|
||||||
|
if (*cp==0x64 && *cpx==0 && *(cpx+1)==0x01 && *(cpx+2)==0x08 && *(cpx+3)==0) {
|
||||||
|
sml_status[g_mindex]=*(cp+3);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
cp=skip_sml(cp,&result);
|
cp=skip_sml(cp,&result);
|
||||||
// check time
|
// check time
|
||||||
cp=skip_sml(cp,&result);
|
cp=skip_sml(cp,&result);
|
||||||
@ -941,6 +954,7 @@ double dval;
|
|||||||
// check scaler
|
// check scaler
|
||||||
cp=skip_sml(cp,&result);
|
cp=skip_sml(cp,&result);
|
||||||
scaler=result;
|
scaler=result;
|
||||||
|
|
||||||
// get value
|
// get value
|
||||||
type=*cp&0x70;
|
type=*cp&0x70;
|
||||||
len=*cp&0x0f;
|
len=*cp&0x0f;
|
||||||
@ -1033,6 +1047,15 @@ double dval;
|
|||||||
} else if (scaler==3) {
|
} else if (scaler==3) {
|
||||||
dval*=1000;
|
dval*=1000;
|
||||||
}
|
}
|
||||||
|
#ifdef ED300L
|
||||||
|
// decode current power OBIS 00 0F 07 00
|
||||||
|
if (*cpx==0x00 && *(cpx+1)==0x0f && *(cpx+2)==0x07 && *(cpx+3)==0) {
|
||||||
|
if (sml_status[g_mindex]&0x20) {
|
||||||
|
// and invert sign on solar feed
|
||||||
|
dval*=-1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
return dval;
|
return dval;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1465,6 +1488,9 @@ void SML_Decode(uint8_t index) {
|
|||||||
if (found) {
|
if (found) {
|
||||||
// matches, get value
|
// matches, get value
|
||||||
mp++;
|
mp++;
|
||||||
|
#ifdef ED300L
|
||||||
|
g_mindex=mindex;
|
||||||
|
#endif
|
||||||
if (*mp=='#') {
|
if (*mp=='#') {
|
||||||
// get string value
|
// get string value
|
||||||
mp++;
|
mp++;
|
||||||
@ -2061,6 +2087,17 @@ uint32_t SML_SetBaud(uint32_t meter, uint32_t br) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t SML_Status(uint32_t meter) {
|
||||||
|
if (meter<1 || meter>meters_used) return 0;
|
||||||
|
meter--;
|
||||||
|
#ifdef ED300L
|
||||||
|
return sml_status[meter];
|
||||||
|
#else
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
uint32_t SML_Write(uint32_t meter,char *hstr) {
|
uint32_t SML_Write(uint32_t meter,char *hstr) {
|
||||||
if (meter<1 || meter>meters_used) return 0;
|
if (meter<1 || meter>meters_used) return 0;
|
||||||
meter--;
|
meter--;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user