source
Rozdíly
Zde můžete vidět rozdíly mezi vybranou verzí a aktuální verzí dané stránky.
Obě strany předchozí revizePředchozí verzeNásledující verze | Předchozí verze | ||
source [2013/08/29 23:11] – mypower_cz | source [2016/04/22 21:34] (aktuální) – upraveno mimo DokuWiki 127.0.0.1 | ||
---|---|---|---|
Řádek 3: | Řádek 3: | ||
===== Info ===== | ===== Info ===== | ||
- | Tato verze je pracovní a nemusí být plně funkční. | + | Verze 2.04 |
+ | ===== Kompilace projektu ===== | ||
+ | |||
+ | **Pozor: Pro kompilaci je potřeba použít [[https:// | ||
+ | |||
+ | V nových verzích se můžete setkat s chybou | ||
+ | |||
+ | microlog2: | ||
+ | |||
+ | nebo | ||
+ | |||
+ | microlog2: | ||
===== Notes ===== | ===== Notes ===== | ||
- | * přidáno manuální ovládání 16ti digitálních výstupů | + | * přidána podpora pro datum a čas, synchronizováno |
+ | * čítač sekund byl změněn na uint32_t | ||
+ | * mapa eprom byla přesunuta z kódu na [[mod: | ||
+ | |||
+ | * [[http:// | ||
===== Download ===== | ===== Download ===== | ||
Řádek 19: | Řádek 34: | ||
// ---[ INFO ]---------------------------------------- | // ---[ INFO ]---------------------------------------- | ||
- | // MyPower.CZ Microlog | + | // Program: MyPower.CZ |
- | // Version 2 | + | // License: free for non-commercial use |
- | // Date: 08/2013 | + | // Details: info@mypower.cz |
- | + | ||
- | // created by MyPower.CZ | + | |
- | // Licence: free for non-commercial use | + | |
// ---[ VERSION ]------------------------------------- | // ---[ VERSION ]------------------------------------- | ||
- | #define MPWMicroLogVersion | + | #define MPWMicroLogVersion |
// ---[ INCLUDE ]------------------------------------- | // ---[ INCLUDE ]------------------------------------- | ||
Řádek 54: | Řádek 66: | ||
// [....... LED .....][.not used.][........... RELE .............] | // [....... LED .....][.not used.][........... RELE .............] | ||
byte DPINmap[16] | byte DPINmap[16] | ||
- | uint16_t DPINstatus = 0x0000; | + | uint16_t DPINstatus |
+ | // < | ||
+ | uint16_t DPINlogicmask = (B00000000 << 8) | B00000011; | ||
// ---[ MODS ]---------------------------------------- | // ---[ MODS ]---------------------------------------- | ||
Řádek 73: | Řádek 87: | ||
// mod WebServer | // mod WebServer | ||
- | #define modWebServer | + | #define modWebServer |
- | #define modWebServerPort 80 // default: 80 | + | #define modWebServerPort |
// mod Display | // mod Display | ||
- | #define modDisplay | + | #define modDisplay |
- | #define modDisplayType | + | #define modDisplayType |
+ | |||
+ | // mod DisplayEmulation | ||
+ | #define modDisplayEmulation | ||
+ | // 0=display pripojen - zobrazeni na fyzickem displayi i na www rozhrani | ||
// --------------------------------------------------- | // --------------------------------------------------- | ||
Řádek 84: | Řádek 102: | ||
byte lxLed=0; | byte lxLed=0; | ||
byte lxTime=0; | byte lxTime=0; | ||
- | long lxSeconds=0; | + | uint32_t |
- | long lxSendIndex=0; | + | uint32_t |
byte lxHttpOk=0; | byte lxHttpOk=0; | ||
byte lxHttpErrors=0; | byte lxHttpErrors=0; | ||
Řádek 118: | Řádek 136: | ||
#define xpinOPTsampleG2 | #define xpinOPTsampleG2 | ||
#define xpinOPTsampleG3 | #define xpinOPTsampleG3 | ||
- | |||
- | // ---------------------------------------------------- | ||
- | |||
- | // EEPROM | ||
- | // 0 - 40 PIN0 CONF (41 bytes struct tPinConf) | ||
- | // 41 - 81 PIN1 CONF | ||
- | // 82 - 122 PIN2 CONF | ||
- | // 123 - 163 PIN3 CONF | ||
- | // 164 - 204 PIN4 CONF | ||
- | // 205 - 245 PIN5 CONF | ||
- | // 246 - 286 PIN6 CONF | ||
- | // 287 - 327 PIN7 CONF | ||
- | // 328 - 368 PIN8 CONF | ||
- | // 369 - 409 PIN9 CONF | ||
- | // 410 - 450 PIN10 CONF | ||
- | // 451 - 491 PIN11 CONF | ||
- | // 492 - 532 PIN12 CONF | ||
- | // 533 - 573 PIN13 CONF | ||
- | // 574 - 614 PIN14 CONF | ||
- | // 615 - 656 PIN15 CONF | ||
- | // 657 - 683 DeviceConf | ||
- | // 684 - 2047 Display program | ||
- | // 2048 - 2067 DPIN Name 0 (char [20]) | ||
- | // 2068 - 2087 DPIN Name 1 | ||
- | // 2088 - 2107 DPIN Name 2 | ||
- | // 2008 - 2127 DPIN Name 3 | ||
- | // 2028 - 2147 DPIN Name 4 | ||
- | // 2048 - 2167 DPIN Name 5 | ||
- | // 2068 - 2187 DPIN Name 6 | ||
- | // 2088 - 2207 DPIN Name 7 | ||
- | // 2008 - 2227 DPIN Name 8 | ||
- | // 2028 - 2247 DPIN Name 9 | ||
- | // 2048 - 2267 DPIN Name 10 | ||
- | // 2068 - 2287 DPIN Name 11 | ||
- | // 2088 - 2307 DPIN Name 12 | ||
- | // 2008 - 2327 DPIN Name 13 | ||
- | // 2028 - 2347 DPIN Name 14 | ||
- | // 2048 - 2367 DPIN Name 15 | ||
- | // 2368 ... FREE | ||
struct tPinConf { | struct tPinConf { | ||
Řádek 168: | Řádek 147: | ||
}; | }; | ||
- | #define xComStatusNop | + | #define xComStatusNop |
- | #define xComStatusASchanged | + | #define xComStatusASchanged |
- | #define xComStatusDSchanged | + | #define xComStatusDSchanged |
+ | #define xComStatusIsLastDayInMonth | ||
+ | #define xComStatusIsDST | ||
+ | |||
+ | #define xComStatusXXDaysMonthMask | ||
+ | #define xComStatus28DaysMonth | ||
+ | #define xComStatus29DaysMonth | ||
+ | #define xComStatus30DaysMonth | ||
+ | #define xComStatus31DaysMonth | ||
+ | |||
+ | struct tMpwAccess { | ||
+ | byte xComStatus; | ||
+ | uint16_t mpwremoteDateYear; | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | signed long mpwremoteTimeS; | ||
+ | uint32_t mpwremoteCheckedAtS; | ||
+ | uint32_t mpwlogintimeS; | ||
+ | uint32_t mpwDeviceId; | ||
+ | uint32_t mpwAccessId; | ||
+ | } xMpwAccess; | ||
- | struct | + | struct |
+ | int xyear, xmonth, xday, xhour, xminute, xsecond; | ||
+ | | ||
#define xdcOptBuiltIn | #define xdcOptBuiltIn | ||
Řádek 209: | Řádek 212: | ||
char * _lcdweblbuf1=NULL; | char * _lcdweblbuf1=NULL; | ||
tDispStats * _lcdwebdispstats=NULL; | tDispStats * _lcdwebdispstats=NULL; | ||
+ | |||
+ | #if (modDisplayEmulation == 0) | ||
#include < | #include < | ||
LiquidCrystal lcd(8, 9, 14, 5, 6, 7); | LiquidCrystal lcd(8, 9, 14, 5, 6, 7); | ||
+ | void lcdClear() { lcd.clear(); | ||
+ | void lcdInit() { lcd.begin(16, | ||
+ | #else | ||
+ | void lcdClear() { } | ||
+ | void lcdInit() { lcdClear(); } | ||
+ | #endif | ||
+ | |||
void lcdPrintRight(char * str) { int x=16-strlen(str); | void lcdPrintRight(char * str) { int x=16-strlen(str); | ||
void lcdPrintCenter(char * str) { int x=8-(strlen(str)/ | void lcdPrintCenter(char * str) { int x=8-(strlen(str)/ | ||
Řádek 216: | Řádek 228: | ||
void lcdPrintAt(char * str,int x) { | void lcdPrintAt(char * str,int x) { | ||
int ix=strlen(str); | int ix=strlen(str); | ||
- | void lcdClear() { lcd.clear(); } | + | // int ix=strlen(str);for (int i=0; |
void lcdClearLine() { int i; for (i=0; | void lcdClearLine() { int i; for (i=0; | ||
void lcdPrintLine(int y) { | void lcdPrintLine(int y) { | ||
if ((_lcdweblbuf0!=NULL) && (_lcdweblbuf1!=NULL)) | if ((_lcdweblbuf0!=NULL) && (_lcdweblbuf1!=NULL)) | ||
{ char * p=_lcdweblbuf0; | { char * p=_lcdweblbuf0; | ||
- | else { lcd.setCursor(0, | + | else { |
- | void lcdInit() { lcd.begin(16, | + | #if (modDisplayEmulation == 0) |
+ | | ||
+ | #endif | ||
+ | } } | ||
#endif | #endif | ||
Řádek 247: | Řádek 263: | ||
#if (modSerialLog == 1) | #if (modSerialLog == 1) | ||
- | XLog(sn1); | + | XLog(sn1); |
- | XLog(MPWMicroLogVersion); | + | |
#if (modMyPowerLog == 1) | #if (modMyPowerLog == 1) | ||
- | xMpwAccess.mpwtimeAtMS=0; | + | xMpwAccess.mpwremoteDateYear=0; |
+ | xMpwAccess.mpwremoteDateMonth=0; | ||
+ | xMpwAccess.mpwremoteDateDay=0; | ||
+ | xMpwAccess.mpwremoteDateWeek=0; | ||
+ | xMpwAccess.mpwremoteDateDayOfWeek=0; | ||
+ | xMpwAccess.mpwremoteTimeS=-1; | ||
+ | xMpwAccess.mpwremoteCheckedAtS=0; | ||
+ | xMpwAccess.mpwlogintimeS=0; | ||
+ | xMpwAccess.mpwDeviceId=0; | ||
+ | xMpwAccess.mpwAccessId=0; | ||
xMpwAccess.xComStatus=xComStatusNop; | xMpwAccess.xComStatus=xComStatusNop; | ||
- | XLog(" | + | char cx[50]=" |
#endif | #endif | ||
+ | |||
#if (modDisplay == 1) | #if (modDisplay == 1) | ||
- | XLog(" | + | char ccx[50]=""; |
+ | #if (modDisplayEmulation == 1 ) | ||
+ | sprintf(ccx," | ||
+ | #else | ||
+ | sprintf(ccx," | ||
#endif | #endif | ||
+ | XLog(ccx); | ||
+ | #endif | ||
+ | |||
#endif | #endif | ||
Řádek 268: | Řádek 301: | ||
DPINResetHW(); | DPINResetHW(); | ||
- | pinMode(10, OUTPUT); | + | pinMode(53, OUTPUT); |
int xret=0; | int xret=0; | ||
Řádek 318: | Řádek 351: | ||
server.begin(); | server.begin(); | ||
#if modSerialLog == 1 | #if modSerialLog == 1 | ||
- | char c[30]=""; | + | char c[30]=""; |
#endif | #endif | ||
#endif | #endif | ||
Řádek 408: | Řádek 441: | ||
if (lxHttpOk==2) xsi=xsr; | if (lxHttpOk==2) xsi=xsr; | ||
if (xsi<30) xsi=30; | if (xsi<30) xsi=30; | ||
- | long qlxSendIndex=lxSeconds; | + | uint32_t |
if ((lxSendIndex+xsi< | if ((lxSendIndex+xsi< | ||
{ | { | ||
Řádek 427: | Řádek 460: | ||
client.write((byte*)xtext, | client.write((byte*)xtext, | ||
- | //struct tMpwAccess { unsigned long mpwtime; unsigned long mpwtimeAtMS; | + | |
- | + | ||
- | | + | |
if (islogin) | if (islogin) | ||
Řádek 441: | Řádek 472: | ||
} | } | ||
- | sprintf(xtext," | + | sprintf(xtext," |
client.write((byte*)xtext, | client.write((byte*)xtext, | ||
sprintf(xtext," | sprintf(xtext," | ||
Řádek 461: | Řádek 492: | ||
if (isvalid) | if (isvalid) | ||
{ | { | ||
- | sprintf(xtext," | + | |
- | | + | char smax10k[30]=""; |
+ | // | ||
+ | sprintf(xtext," | ||
client.write((byte*)xtext, | client.write((byte*)xtext, | ||
xtext[0]=0; | xtext[0]=0; | ||
Řádek 542: | Řádek 575: | ||
void ParseHTTPResult(char * xtext) { | void ParseHTTPResult(char * xtext) { | ||
- | xMpwAccess.mpwtimeAtMS=millis(); | ||
- | if (strcmp(xtext," | ||
#if modSerialLog == 1 | #if modSerialLog == 1 | ||
XLog2(xtext,"# | XLog2(xtext,"# | ||
#endif | #endif | ||
+ | if (strcmp(xtext," | ||
+ | if (strncmp(xtext," | ||
+ | } | ||
+ | |||
+ | void ParseQID(char * xtext) { | ||
+ | if (xMpwAccess.mpwlogintimeS==0) xMpwAccess.mpwlogintimeS=lxSeconds; | ||
+ | char * p=strchr(xtext,' | ||
+ | if (p!=NULL) | ||
+ | { | ||
+ | p[0]=0; | ||
+ | xMpwAccess.mpwDeviceId=atol(xtext); | ||
+ | p++; | ||
+ | char * px=strchr(p,' | ||
+ | if (px!=NULL) | ||
+ | { | ||
+ | px[0]=0; | ||
+ | px++; | ||
+ | xMpwAccess.mpwAccessId=atol(p); | ||
+ | if (strlen(px)==20) | ||
+ | { | ||
+ | char c[30]=""; | ||
+ | strncpy(c, | ||
+ | strncpy(c, | ||
+ | strncpy(c, | ||
+ | strncpy(c, | ||
+ | strncpy(c, | ||
+ | strncpy(c, | ||
+ | strncpy(c, | ||
+ | strncpy(c, | ||
+ | strncpy(c, | ||
+ | strncpy(c, | ||
+ | |||
+ | if (xisdst==1) | ||
+ | xMpwAccess.xComStatus|=xComStatusIsDST; | ||
+ | else | ||
+ | xMpwAccess.xComStatus& | ||
+ | |||
+ | if (xdaysinmonth==xMpwAccess.mpwremoteDateDay) | ||
+ | xMpwAccess.xComStatus|=xComStatusIsLastDayInMonth; | ||
+ | else | ||
+ | xMpwAccess.xComStatus& | ||
+ | | ||
+ | xMpwAccess.xComStatus& | ||
+ | if (xdaysinmonth==28) xMpwAccess.xComStatus|=xComStatus28DaysMonth; | ||
+ | if (xdaysinmonth==29) xMpwAccess.xComStatus|=xComStatus29DaysMonth; | ||
+ | if (xdaysinmonth==30) xMpwAccess.xComStatus|=xComStatus30DaysMonth; | ||
+ | if (xdaysinmonth==31) xMpwAccess.xComStatus|=xComStatus31DaysMonth; | ||
+ | | ||
+ | xMpwAccess.mpwremoteTimeS=(xhour*3600)+(xminute*60)+(xsecond); | ||
+ | xMpwAccess.mpwremoteCheckedAtS=lxSeconds; | ||
+ | } | ||
+ | } | ||
+ | | ||
+ | } | ||
+ | |||
+ | / | ||
+ | char xstr[50]=""; | ||
+ | tMpwDateTime xMpwDateTime; | ||
+ | GetCurrentDateTime(& | ||
+ | FormatDateTimeStr(xstr, | ||
+ | Serial.println(xstr); | ||
+ | */ | ||
} | } | ||
#endif | #endif | ||
+ | |||
+ | |||
+ | |||
+ | void FormatDateTimeStr(char * xstr, char * xfmt, struct tMpwDateTime * xMpwDateTime, | ||
+ | { | ||
+ | xstr[0]=0; | ||
+ | while (strlen(xfmt)> | ||
+ | { | ||
+ | char ch=xfmt[0]; | ||
+ | char cout[20]=""; | ||
+ | if (ch==' | ||
+ | if (ch==' | ||
+ | if (ch==' | ||
+ | if (ch==' | ||
+ | if (ch==' | ||
+ | if (ch==' | ||
+ | if (ch==' | ||
+ | if (ch==' | ||
+ | if (ch==' | ||
+ | if (ch==' | ||
+ | if (ch==' | ||
+ | if (ch==' | ||
+ | { cout[0]=ch; | ||
+ | | ||
+ | xfmt++; | ||
+ | if (strlen(xstr)+strlen(cout)< | ||
+ | } | ||
+ | } | ||
+ | |||
+ | int GetCurrentDateTime_DaysInMonth() | ||
+ | { | ||
+ | int xret=28; | ||
+ | int xst=xMpwAccess.xComStatus& | ||
+ | if (xst==xComStatus28DaysMonth) xret=28; else | ||
+ | if (xst==xComStatus29DaysMonth) xret=29; else | ||
+ | if (xst==xComStatus30DaysMonth) xret=30; else | ||
+ | if (xst==xComStatus31DaysMonth) xret=31; | ||
+ | return xret; | ||
+ | } | ||
+ | |||
+ | void GetCurrentDateTime(struct tMpwDateTime * xMpwDateTime) | ||
+ | { | ||
+ | if (xMpwAccess.mpwremoteCheckedAtS> | ||
+ | { | ||
+ | xMpwDateTime-> | ||
+ | xMpwDateTime-> | ||
+ | xMpwDateTime-> | ||
+ | uint32_t xtime=lxSeconds-xMpwAccess.mpwremoteCheckedAtS+xMpwAccess.mpwremoteTimeS; | ||
+ | if (xtime> | ||
+ | { | ||
+ | int xdaysover=xtime/ | ||
+ | int xtimeover=xtime%86400UL; | ||
+ | |||
+ | if (xdaysover> | ||
+ | { | ||
+ | xMpwDateTime-> | ||
+ | xMpwDateTime-> | ||
+ | xMpwDateTime-> | ||
+ | } | ||
+ | else | ||
+ | { | ||
+ | int xdaysinmonth=GetCurrentDateTime_DaysInMonth(); | ||
+ | for (int i=0; | ||
+ | { | ||
+ | if (xMpwDateTime-> | ||
+ | xMpwDateTime-> | ||
+ | else | ||
+ | { | ||
+ | xMpwDateTime-> | ||
+ | if (xMpwDateTime-> | ||
+ | xMpwDateTime-> | ||
+ | else | ||
+ | { | ||
+ | xMpwDateTime-> | ||
+ | xMpwDateTime-> | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | | ||
+ | xtime=xtimeover; | ||
+ | } | ||
+ | xMpwDateTime-> | ||
+ | int xmod=(xtime%3600); | ||
+ | xMpwDateTime-> | ||
+ | xMpwDateTime-> | ||
+ | } | ||
+ | else | ||
+ | { | ||
+ | uint32_t xtime=lxSeconds; | ||
+ | xMpwDateTime-> | ||
+ | xMpwDateTime-> | ||
+ | xMpwDateTime-> | ||
+ | xMpwDateTime-> | ||
+ | signed long xmod=((xtime%86400L)%3600); | ||
+ | xMpwDateTime-> | ||
+ | xMpwDateTime-> | ||
+ | } | ||
+ | } | ||
+ | |||
+ | |||
+ | |||
+ | |||
void FlashError(byte xcount) | void FlashError(byte xcount) | ||
Řádek 680: | Řádek 876: | ||
#define xDPinSetStatus | #define xDPinSetStatus | ||
- | void WebServer_pf(char * xstr,signed long * xsl,int * xsl10000) { | + | void WebServer_pf(char * xstr,signed long * xsl,int * xsl10k) { |
- | int im; *xsl=0;*xsl10000=0; char * p=xstr; char * p10k=p; | + | int im; *xsl=0;*xsl10k=0; char * p=xstr; char * p10k=p; |
for (int i=0; | for (int i=0; | ||
boolean hm=(p[0]==' | boolean hm=(p[0]==' | ||
for (int i=0; | for (int i=0; | ||
im=strlen(p10k); | im=strlen(p10k); | ||
- | for (int i=0; | + | for (int i=0; |
- | *xsl10000+=(p10k[i]-' | + | *xsl10k+=(p10k[i]-' |
if (hm) *xsl=0-*xsl; | if (hm) *xsl=0-*xsl; | ||
+ | if (hm) *xsl10k=0-*xsl10k; | ||
} | } | ||
Řádek 1018: | Řádek 1215: | ||
if (strcmp(xstr," | if (strcmp(xstr," | ||
if (strcmp(xstr," | if (strcmp(xstr," | ||
- | if (strcmp(xstr," | + | if (strcmp(xstr," |
+ | if (strcmp(xstr," | ||
if (strcmp(xstr," | if (strcmp(xstr," | ||
} | } | ||
Řádek 1049: | Řádek 1247: | ||
byte qsaction=(xmode>> | byte qsaction=(xmode>> | ||
if (c == ' | if (c == ' | ||
- | client.write(" | + | client.write(" |
+ | if (qsaction==xACTep) | ||
+ | { | ||
+ | client.write(" | ||
+ | sprintf(xln," | ||
+ | client.write((byte*)xln, | ||
+ | client.write(" | ||
+ | client.write(" | ||
+ | } | ||
+ | else | ||
+ | client.write(" | ||
if (qmode==xWEBpins) { | if (qmode==xWEBpins) { | ||
for (int ain = 0; ain < NUM_ANALOG_INPUTS; | for (int ain = 0; ain < NUM_ANALOG_INPUTS; | ||
Řádek 1066: | Řádek 1274: | ||
(int)lxHttpErrors, | (int)lxHttpErrors, | ||
client.write((byte*)xln, | client.write((byte*)xln, | ||
- | sprintf(xln," | + | sprintf(xln," |
client.write((byte*)xln, | client.write((byte*)xln, | ||
sprintf(xln, | sprintf(xln, | ||
(int)E2END, | (int)E2END, | ||
client.write((byte*)xln, | client.write((byte*)xln, | ||
- | sprintf(xln," | + | sprintf(xln," |
NETmac[0], | NETmac[0], | ||
client.write((byte*)xln, | client.write((byte*)xln, | ||
Řádek 1086: | Řádek 1294: | ||
client.write((byte*)xln, | client.write((byte*)xln, | ||
} | } | ||
- | sprintf(xln," | + | sprintf(xln," |
+ | client.write((byte*)xln, | ||
+ | client.write(" | ||
+ | for (int i=0; | ||
+ | { | ||
+ | int qb=DPINmap[i]; | ||
+ | sprintf(xln," | ||
+ | if (i<16) strcat(xln,"," | ||
+ | client.write((byte*)xln, | ||
+ | } | ||
+ | sprintf(xln,"/ | ||
+ | client.write((byte*)xln, | ||
+ | |||
+ | char xstr[30]=""; | ||
+ | tMpwDateTime xMpwDateTime; | ||
+ | GetCurrentDateTime(& | ||
+ | FormatDateTimeStr(xstr, | ||
+ | |||
+ | |||
+ | sprintf(xln," | ||
+ | (int)xMpwAccess.mpwremoteDateMonth, | ||
+ | (int)xMpwAccess.mpwremoteDateDay, | ||
+ | (signed long)xMpwAccess.mpwremoteTimeS, | ||
+ | xMpwAccess.mpwremoteCheckedAtS, | ||
+ | xMpwAccess.mpwlogintimeS, | ||
+ | xMpwAccess.mpwDeviceId, | ||
+ | xMpwAccess.mpwAccessId, | ||
+ | (int)xMpwAccess.xComStatus, | ||
+ | (int)xMpwAccess.mpwremoteDateWeek, | ||
+ | (int)xMpwAccess.mpwremoteDateDayOfWeek, | ||
+ | (unsigned long)(lxSeconds-xMpwAccess.mpwremoteCheckedAtS)); | ||
client.write((byte*)xln, | client.write((byte*)xln, | ||
+ | | ||
} | } | ||
else | else | ||
Řádek 1111: | Řádek 1350: | ||
client.write((byte*)xln, | client.write((byte*)xln, | ||
} | } | ||
- | sprintf(xln," | + | sprintf(xln," |
client.write((byte*)xln, | client.write((byte*)xln, | ||
} | } | ||
Řádek 1129: | Řádek 1368: | ||
else | else | ||
{ | { | ||
- | sprintf(xln," | + | |
- | pconf.xmin10000, | + | char smax10k[30]=""; |
+ | | ||
client.write((byte*)xln, | client.write((byte*)xln, | ||
xln[0]=0; | xln[0]=0; | ||
Řádek 1275: | Řádek 1515: | ||
else | else | ||
# | # | ||
+ | if (qsaction==xACTep) | ||
+ | { | ||
+ | sprintf(xln," | ||
+ | client.write((byte*)xln, | ||
+ | unsigned long xsum=0; | ||
+ | char s[20]=""; | ||
+ | for (int i=0; | ||
+ | { | ||
+ | if ((i& | ||
+ | { | ||
+ | sprintf(xln," | ||
+ | client.write((byte*)xln, | ||
+ | } | ||
+ | int v=EEPROM.read(i); | ||
+ | sprintf(xln," | ||
+ | int xi=i& | ||
+ | s[xi]=((v> | ||
+ | s[xi+1]=0; | ||
+ | client.write((byte*)xln, | ||
+ | xsum=(((xsum>> | ||
+ | if ((i& | ||
+ | { | ||
+ | sprintf(xln," | ||
+ | client.write((byte*)xln, | ||
+ | s[0]=0; | ||
+ | } | ||
+ | else client.write(" | ||
+ | } | ||
+ | if (s[0]!=0) | ||
+ | { | ||
+ | sprintf(xln," | ||
+ | client.write((byte*)xln, | ||
+ | s[0]=0; | ||
+ | } | ||
+ | sprintf(xln," | ||
+ | client.write((byte*)xln, | ||
+ | } | ||
+ | else | ||
if (qmode==xWEBcfg) | if (qmode==xWEBcfg) | ||
{ | { | ||
Řádek 1618: | Řádek 1896: | ||
xvar-> | xvar-> | ||
xvar-> | xvar-> | ||
- | DisplayFillVarByPinValue(xpin, | + | |
+ | if ( (xvar-> | ||
+ | DisplayFillVarByTimeVar(xvar); | ||
+ | else | ||
+ | | ||
+ | | ||
} | } | ||
else | else | ||
Řádek 1736: | Řádek 2019: | ||
tDispVar xvar; | tDispVar xvar; | ||
DisplayFillVarByPinValue(xpin,& | DisplayFillVarByPinValue(xpin,& | ||
- | signed long xval=xvar.xval; | + | //signed long xval=xvar.xval; |
- | int xval10k=xvar.xval10000; | + | //int xval10k=xvar.xval10000; |
- | sprintf(xret," | + | sprint10k(xret, |
+ | //sprintf(xret," | ||
} | } | ||
Řádek 1799: | Řádek 2083: | ||
{ | { | ||
if (c==' | if (c==' | ||
+ | if (c==' | ||
if ((c> | if ((c> | ||
c='#'; | c='#'; | ||
Řádek 1835: | Řádek 2120: | ||
{ | { | ||
char pxval[50]=""; | char pxval[50]=""; | ||
- | | + | |
- | char *xsc=qsc; | + | |
- | signed long xval=xvar->xval; | + | |
- | int xval10k=xvar-> | + | |
- | while (xval> | + | |
{ | { | ||
- | if (xsc[1]==0) break; | + | |
- | int64 xq,xr; word xmod; | + | } |
- | i64x10k2int10k(& | + | else |
- | i64divW(& | + | { |
- | i64int10k2x10k(& | + | char qsc[]=" |
- | xsc++; | + | char *xsc=qsc; |
+ | signed long xval=xvar-> | ||
+ | int xval10k=xvar-> | ||
+ | |||
+ | if (xdecs==0xFE) | ||
+ | { | ||
+ | sprintf(pxval," | ||
+ | } | ||
+ | else | ||
+ | { | ||
+ | while (xval> | ||
+ | { | ||
+ | | ||
+ | int64 xq,xr; word xmod; | ||
+ | i64x10k2int10k(& | ||
+ | i64divW(& | ||
+ | i64int10k2x10k(& | ||
+ | xsc++; | ||
+ | } | ||
+ | sprint10k(pxval, | ||
+ | // sprintf(pxval," | ||
+ | DisplayCorrectDecs(pxval, | ||
+ | if ((xsc[0]!=' | ||
+ | } | ||
} | } | ||
- | sprintf(pxval," | ||
- | DisplayCorrectDecs(pxval, | ||
- | if ((xsc[0]!=' | ||
for (int cc=0; | for (int cc=0; | ||
if (ix< | if (ix< | ||
Řádek 1865: | Řádek 2166: | ||
hasvar=(c==' | hasvar=(c==' | ||
if ((!hasvar) && (ix< | if ((!hasvar) && (ix< | ||
+ | } | ||
+ | } | ||
+ | |||
+ | |||
+ | void DisplayFillVarByTimeVar(struct tDispVar * xvar) | ||
+ | { | ||
+ | char px[30]=""; | ||
+ | DisplayGetValueByTimeVar(px, | ||
+ | xvar-> | ||
+ | xvar-> | ||
+ | } | ||
+ | |||
+ | |||
+ | void DisplayGetValueByTimeVar(char * xbuf,char * xvarname, | ||
+ | { | ||
+ | xbuf[0]=0; | ||
+ | if ((xvarname[0]==' | ||
+ | { | ||
+ | if (strlen(xvarname)> | ||
+ | { | ||
+ | char xfmt[5]=""; | ||
+ | tMpwDateTime xMpwDateTime; | ||
+ | FormatDateTimeStr(xbuf, | ||
+ | } | ||
} | } | ||
} | } | ||
Řádek 2129: | Řádek 2454: | ||
+ | // -- [MATH10k] ------------------------------------------------- | ||
+ | |||
+ | boolean isnegative10k(signed long xval, int x10k) { | ||
+ | boolean xret=(xval< | ||
+ | } | ||
+ | |||
+ | void sprint10k(char * xret, signed long xval, int x10k) { | ||
+ | char xsgn[5]=""; | ||
+ | if (xval<0) xval=-xval; if (x10k<0) x10k=-x10k; | ||
+ | sprintf(xret," | ||
+ | } | ||
// -- [MATH64] ------------------------------------------------- | // -- [MATH64] ------------------------------------------------- | ||
Řádek 2210: | Řádek 2546: | ||
word xmod=0; | word xmod=0; | ||
signed long qval=(((unsigned long)qret.lh)<< | signed long qval=(((unsigned long)qret.lh)<< | ||
- | *xval=msf? | + | *xval=msf? |
+ | xint64-> | ||
} | } | ||
void i64x10k2int10k(struct int64 * xret, signed long xval, int x10k) { | void i64x10k2int10k(struct int64 * xret, signed long xval, int x10k) { | ||
int64 q1;int64 q2; | int64 q1;int64 q2; | ||
- | boolean msf=((xval)< | + | /* boolean msf=((xval)< |
+ | if (msf) xval=-(xval); | ||
q2.ll=(x10k)& | q2.ll=(x10k)& | ||
i64addS(xret, | i64addS(xret, | ||
Řádek 2222: | Řádek 2560: | ||
void i64x10k2int10kH(struct int64 * xret, signed long xval, int x10k) { | void i64x10k2int10kH(struct int64 * xret, signed long xval, int x10k) { | ||
int64 q1;int64 q2; | int64 q1;int64 q2; | ||
- | boolean msf=((xval)< | + | /* boolean msf=((xval)< |
+ | if (msf) xval=-(xval); | ||
q2.ll=(x10k/ | q2.ll=(x10k/ | ||
i64addS(xret, | i64addS(xret, | ||
Řádek 2273: | Řádek 2612: | ||
void DPINUpdateHW() { | void DPINUpdateHW() { | ||
+ | uint16_t dstat=DPINstatus^DPINlogicmask; | ||
for (int i=0; | for (int i=0; | ||
- | if ((xdpin> | + | if ((xdpin> |
} | } | ||
} | } | ||
Řádek 2282: | Řádek 2622: | ||
if ((xdpin> | if ((xdpin> | ||
} | } | ||
+ | DPINUpdateHW(); | ||
} | } | ||
+ | |||
</ | </ |
source.1377810678.txt.gz · Poslední úprava: 2013/08/30 05:11 (upraveno mimo DokuWiki)