global.h


1
/*
2
 * strings.h
3
 * strings for IoT temperature-control
4
 * for configuration of user-data
5
 * author Creator P.Rebesky
6
 * Copyright (©): 2023 by Peter Rebesky
7
 * This code can use in private cases only. Every business or companies using of this codes or codes parts is required an approval of us (me)
8
 * Every private use can exchange some parts of code or modify some code-lines. This code can change for private use only.
9
 * This software is basicly owned by Peter Rebesky and any comercial using is forbidden without approval of us (me).
10
 *
11
 */
12
13
#ifndef GLOBAL_H_
14
#define GLOBAL_H_
15
16
#define OLED_CONNECT
17
18
#define _oneWireBus 13
19
#define _ADJUST_HTTP 1000
20
#define _ADJUST_HTTPS  982
21
#define _YEAR 0
22
#define _MONTH 1
23
#define _DAY 2
24
#define _HOUR 3
25
#define _MINUTE 4
26
#define _SECOND 5
27
#define _MESZ 0  // summer-time = 1 else winter-time = 0
28
#define _UTCOFFSET 3600
29
#define _BoardTaster 0
30
#define _TimeOf2021 1609459260
31
#define _OLED_TIME_WAIT 10
32
33
int _date_time[6]; //[_YEAR][_MONTH][_DAY][_HOUR][_MINUTE][_SECOND]
34
int _act_date_time[6]; //[_YEAR][_MONTH][_DAY][_HOUR][_MINUTE][_SECOND]
35
uint32_t _timestamp = 0;
36
uint32_t _previousMillis = 0;
37
uint32_t _secondMillis  =0;
38
uint _secAdjust=1000;
39
int _oledDisplayWait=0;
40
int _httpMarker = 0;
41
//int  _VCC = 0;
42
bool _sendingOK=false;
43
float _pressure;
44
float _temperature1=-127;
45
float _temperature2=-127;
46
float _temperature3=-127;
47
float _temperature4=-127;
48
int _numberOfSensors=0;
49
int _showTemperature=0;
50
//uint32_t _humidity;
51
String _argument;
52
String _argumentValue = "0";
53
String _transmitResult;
54
//int x=0;
55
//char temp[20];
56
//String _debugString;
57
58
 String Version = "Build 1.04 15.02.2023";
59
 const PROGMEM char *_typeVersion = "Temp V1.04";
60
 const PROGMEM char *_impressum = "P. Rebesky";
61
62
 const char wiFiHostname[ ] = "ESP_Temperature";
63
 const char HTTP_ANSWER[] = "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n";
64
 const char HTTP_ANSWERJSON[] = "HTTP/1.1 200 OK\r\nAccess-Control-Allow-Origin: *\r\nContent-Type: text/json\r\n\r\n"; //header of http with mixed content, only for JSON
65
 const char HTTP_HEAD_IoT[] = "<!DOCTYPE HTML>\r\n<html>\r\n<head><meta charset=\"UTF-8\"><meta name=\"viewport\"content=\"width=300\",\"initial-scale=1\"/>";
66
 const char HTTP_HEAD_REFRESH[] = "<!DOCTYPE HTML>\r\n<html>\r\n<head><meta charset=\"UTF-8\"><meta name=\"viewport\"content=\"width=300\",\"initial-scale=1\"/><meta http-equiv=\"refresh\" content=\"92\">";
67
 const char HTTP_BODYSTYLE[] = "<style>body{text-align: center;font-family:verdana;}input{color:blue;width:90%;text-align:center;border-style:none;font-size:120%;}.field{border:4px solid lightblue;text-align:center;background-color:white;border-radius:18px;}@media only screen and (min-width:950px){.field {width:400px;display:inline-block;}}</style></head>";
68
 const char HTTP_SETUP_BUTTON[] = "<hr><p><form action=\"/setup\"><button type=\"submit\">Einstellungen</button></form></p>";
69
 const char HTTP_DIV_FIELD[] = "<div class=\"field\">";
70
 const char HTTP_TEXT_END[] ="</div></html>\n";
71
 const byte DaysPerMonth[] = {31,28,31,30,31,30,31,31,30,31,30,31};
72
 const char PROGMEM HTTP_JS_SCRIPT[] = "<script>setInterval('set()',1000);function wval(id,wt){if(document.getElementById(id))document.getElementById(id).value=wt;}function setW(wte){ret=JSON.parse(wte);document.getElementById('time').value=ret['ti'];wval('temp1',(ret['t1']).toFixed(2)+' °C');wval('temp2',(ret['t2']).toFixed(2)+' °C');wval('temp3',(ret['t3']).toFixed(2)+' °C');wval('temp4',(ret['t4']).toFixed(2)+' °C');}function set(act='refresh'){var xml=new XMLHttpRequest();xml.onreadystatechange=function(){if(this.readyState==4&&this.status==200){setW(this.responseText);}};xml.open('GET','/'+act);xml.send();}</script></html>";
73
 
74
 #endif // GLOBAL_H_