PeteKnight:
Hello Pete,
I cannot go forward in my project. I need your support.
The code is so long more than 32000 characters therefore I cannot upload one.
I will divide to two section.
Thank you for your effort.
Pucz
#define BLYNK_TEMPLATE_ID "TMPxxxxxxxxxxx"
#define BLYNK_DEVICE_NAME "Heat Pump"
#define BLYNK_FIRMWARE_VERSION "0.1.0"
#include "DHT.h"
#include <arduino.h>
#include <WiFi.h>
#include <EEPROM.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#include "HardwareSerial.h"
#include "Nextion.h"
#include <NTPClient.h>
#include <WiFiUdp.h>
WiFiUDP ntpUDP;
const char* ssid = "TP-Link_93EA_EXT";
const char* password = "xxxxxxxxxx";
NTPClient timeClient(ntpUDP);
#define BLYNK_PRINT Serial
#define APP_DEBUG
#define nexSerial Serial2
#include "BlynkEdgent.h"
#define RX1_pin 14 (csatlakozó 6-os láb)
#define TX1_pin 26
#define RX2_pin 16
#define TX2_pin 17
#define LED1 32 // WIFI Yellow
//#define LED2 33 // WIFI Blue
#define EEPROM_SIZE 100
#define ONE_WIRE_BUS 25
#define TEMPERATURE_PRECISION 8
#define BAUD_RATE 115200
#define Relay2 2
#define Relay3 4
#define Relay4 15
#define WaterCleaner 5
#define RoomSensor 14
DHT dht(27, DHT11);
DHT dht1(18, DHT11);
HardwareSerial DebugDisplay(1);
HardwareSerial Display(2);
unsigned long previousMillis = 0;
unsigned long previousMillis1 = 0;
unsigned long previousMillis2 = 0;
unsigned long previousMillis3 = 0;
unsigned int HeaterPumpHyst=5000;
bool debug = 0;
bool heaterbit = 1;
bool mudbit = 1;
bool bubbit = 1;
bool exchangerbit=1;
bool BufferHeating=0;
bool BufferUseable=0;
bool trigger1=1;
bool togglebit=0;
bool OP1pic=0;
bool OP2pic=0;
bool OP3pic=0;
bool OP4pic=0;
bool OP5pic=0;
bool OP6pic=0;
bool OP7pic=0;
bool OP8pic=0;
bool manubit=0;
bool manuTherm=0;
bool TimeToEnergyCollection=0;
byte TankTempMin=26;
byte Days=0;
byte DaysCnt=0;
byte BubbleCtrl=0;
float HeatPumpOut = 0;
float HeatPumpIn = 0;
float HeatExchangerOut = 0;
float HeatExchangerIn = 0;
float TankTemp = 70;
float WaterForward = 0;
float WaterReturn = 0;
byte ErrorCnt=0;
byte SensorCounter=0;
String formattedDate;
String dayStamp;
String dayStampMemo;
String timeStamp;
String Hour1;
String Minute1;
byte Hour=0;
byte Min=0;
byte JIT_val=0;
int HourMin;
int TM1_Begin_Hour_min;
int TM1_End_Hour_min;
int TM2_Begin_Hour_min;
int TM2_End_Hour_min;
int TM3_Begin_Hour_min;
int TM3_End_Hour_min;
int TM4_Begin_Hour_min;
int TM4_End_Hour_min;
int TM5_Begin_Hour_min;
int TM5_End_Hour_min;
String RtcTime="Time:";
String RtcDate="Date:";
byte i,n;
byte actualForm=4;
byte present = 0;
byte data[13];
int temp;
int temp3;
byte slider_value = 0;
byte Button0;
byte Button1;
float internalTemp[10];
float internalHumi[10];
byte intCnt=0;
float intTemp=0;
float intHumi=0;
float externalTemp[10];
float externalHumi[10];
byte extCnt=0;
float extTemp=0;
float extHumi=0;
char puffer[10] = {0};
byte cntr; //Loop counter.
bool Toggle;
bool AutoManual=1;
bool HEPump=0;
bool FHPump=0;
byte TM1_Begin_Hour;
byte TM1_Begin_Min;
byte TM1_End_Hour;
byte TM1_End_Min;
int TM2_Begin_Hour;
int TM2_Begin_Min;
int TM2_End_Hour;
int TM2_End_Min;
int TM3_Begin_Hour;
int TM3_Begin_Min;
int TM3_End_Hour;
int TM3_End_Min;
int TM4_Begin_Hour;
int TM4_Begin_Min;
int TM4_End_Hour;
int TM4_End_Min;
int TM5_Begin_Hour;
int TM5_Begin_Min;
int TM5_End_Hour;
int TM5_End_Min;
int SliderValue[13] = {0};
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
DeviceAddress devices[10];
int devicesFound = 0;
NexPicture p0 = NexPicture(1, 1 , "p0");
NexPicture p5 = NexPicture(1, 30, "p5");
NexProgressBar jx0 = NexProgressBar(0, 1, "j0");
NexProgressBar jx1 = NexProgressBar(0, 2, "j1");
NexProgressBar jx2 = NexProgressBar(0, 3, "j2");
NexProgressBar jy1 = NexProgressBar(1, 33, "j0");
NexPage page0 = NexPage(0, 0, "page0");
NexPage page1 = NexPage(1, 0, "page1");
NexPage page2 = NexPage(2, 0, "page2");
NexPage page3 = NexPage(3, 0, "page3");
NexText t0 = NexText(1, 3, "t0"); // TankTemp
NexText t1 = NexText(1, 2, "t1"); // HeatExchangerOut
NexText t2 = NexText(1, 4, "t2"); // WaterForward
NexText t3 = NexText(1, 5, "t3"); // WaterReturn
NexText t8 = NexText(1, 16, "t8"); // Date
NexText t9 = NexText(1, 17, "t9"); // Time
NexText t10 = NexText(1, 24, "t10"); // HeatPumpOut
NexText t11 = NexText(1, 25, "t11"); // HeatExchangerIn
NexText t12 = NexText(1, 26, "t12"); // HeatPumpIn
NexText OT = NexText(1, 27, "OT");
NexText IT = NexText(1, 28, "IT");
NexDSButton thermo = NexDSButton(1, 28, "thermo");
NexDSButton FHSW = NexDSButton(1, 8, "FHSW");
NexDSButton AM = NexDSButton(1, 28, "AM");
NexButton BS = NexButton(1, 21, "BS");
NexButton BW = NexButton(1, 22, "BW");
NexWaveform s0 = NexWaveform(1, 15, "s0");
NexSlider h0 = NexSlider(2, 1, "h0");
NexSlider h1 = NexSlider(2, 3, "h1");
NexSlider h2 = NexSlider(2, 5, "h2");
NexSlider h3 = NexSlider(2, 6, "h3");
NexSlider h4 = NexSlider(2, 7, "h4");
NexSlider h5 = NexSlider(2, 8, "h5");
NexSlider h6 = NexSlider(2, 9, "h6");
NexSlider h7 = NexSlider(2, 10, "h7");
NexSlider h8 = NexSlider(2, 11, "h8");
NexSlider h9 = NexSlider(2, 12, "h9");
NexSlider h10 = NexSlider(2, 22, "h10");
NexSlider h11 = NexSlider(2, 27, "h11");
NexSlider h12 = NexSlider(2, 28, "h12");
NexSlider h13 = NexSlider(2, 46, "h13");
NexSlider NAP = NexSlider(4, 31, "NAP");
NexNumber n0=NexNumber(2, 2, "n0");
NexText t0_2 = NexText(2, 26, "KH");
NexText t1_2 = NexText(2, 27, "TH");
NexText t2_2 = NexText(2, 23, "EG");
NexText t3_2 = NexText(2, 25, "PI");
//-------------------Page 3 --------------------------------------------
NexRadio CB1 = NexRadio(3, 15, "CB1");
NexCheckbox CX = NexCheckbox(3, 11, "CX");
NexProgressBar JB2 = NexProgressBar(3, 9, "JB2");
NexProgressBar JB1 = NexProgressBar(3, 5, "JB1");
NexProgressBar JIT = NexProgressBar(3, 1, "JIT");
//-------------------Page 4 --------------------------------------------
NexHotspot ENT = NexHotspot(4, 29, "ENT");
NexNumber RBT = NexNumber(4, 30, "RBT");
NexText TM1 = NexText(4, 9, "TM1");
NexText TM2 = NexText(4, 10, "TM2");
NexText TM3 = NexText(4, 12, "TM3");
NexText TM4 = NexText(4, 13, "TM4");
NexText TM5 = NexText(4, 16, "TM5");
NexTouch *nex_listen_list[] =
{
&h0,
&h1,
&h2,
&h3,
&h4,
&h5,
&h6,
&h7,
&h8,
&h9,
&h10,
&h11,
&h12,
&h13,
&NAP,
&BS,
&BW,
&AM,
&FHSW,
&CB1,
&CX,
&ENT,
&thermo,
NULL
};
//-----------------------------------------------------------------------------
void Read_Sensor()
{
SensorCounter++;
if(debug){Serial.print(" Requesting temperatures...");}
sensors.requestTemperatures(); // Send the command to get temperatures
if(debug){Serial.println("DONE");}
if(devicesFound<6)
{
if(debug){Serial.println("Some sensor didn't found");}
}
switch (SensorCounter) {
case 1:
HeatPumpOut=sensors.getTempCByIndex(0);Blynk.virtualWrite(V108, HeatPumpOut);
DHT_Internal();Blynk.virtualWrite(V113, intTemp);
if(debug){Serial.print("HeatPumpOut=");Serial.println(HeatPumpOut);}
itoa(HeatPumpOut, puffer, 10);
t10.setText(puffer);
s0.addValue(0, 20 + HeatPumpOut * 5 );
break;
case 2:
HeatPumpIn=sensors.getTempCByIndex(1);Blynk.virtualWrite(V109, HeatPumpIn);
if(debug){Serial.print("HeatPumpIn=");Serial.println(HeatPumpIn);}
itoa(HeatPumpIn, puffer, 10);
t12.setText(puffer);
break;
case 3:
HeatExchangerOut=sensors.getTempCByIndex(2);Blynk.virtualWrite(V110, HeatExchangerOut);
if(debug){Serial.print("HeatExchangerOut=");Serial.println(HeatExchangerOut);}
itoa(HeatExchangerOut, puffer, 10);
t1.setText(puffer);
DHT_External();Blynk.virtualWrite(V114, extTemp);
break;
case 4:
HeatExchangerIn=sensors.getTempCByIndex(3);Blynk.virtualWrite(V111, HeatExchangerIn);
if(debug){Serial.print("HeatExchangerIn=");Serial.println(HeatExchangerIn);}
itoa(HeatExchangerIn, puffer, 10);
t11.setText(puffer);
break;
case 5:
TankTemp=sensors.getTempCByIndex(4);Blynk.virtualWrite(V112, TankTemp);
if(debug){Serial.print("TankTemp=");Serial.println(TankTemp);}
itoa(TankTemp, puffer, 10);
t0.setText(puffer);
break;
case 6:
WaterForward=sensors.getTempCByIndex(5);Blynk.virtualWrite(V101,WaterForward);
if(debug){Serial.print("WaterForward=");Serial.println(WaterForward);}
itoa(WaterForward, puffer, 10);
t2.setText(puffer);
break;
case 7:
WaterReturn=sensors.getTempCByIndex(6);Blynk.virtualWrite(V102,WaterReturn);
if(debug){Serial.print("WaterReturn=");Serial.println(WaterReturn);}
itoa(WaterReturn, puffer, 10);
t3.setText(puffer);SensorCounter=0;
break;
}
}
void printAddress(DeviceAddress deviceAddress)
{
for (uint8_t i = 0; i < 8; i++)
{
// zero pad the address if necessary
if (deviceAddress[i] < 16) Serial.print("0");
Serial.print(deviceAddress[i], HEX);
}
}
String printTemperature(DeviceAddress deviceAddress)
{
float tempC = sensors.getTempC(deviceAddress);
if (tempC < 10)
return "0" + (String)tempC;
else
return (String)tempC;
}
void printResolution(DeviceAddress deviceAddress)
{
Serial.print("Resolution: ");
Serial.print(sensors.getResolution(deviceAddress));
Serial.println();
}
void printData(DeviceAddress deviceAddress)
{
Serial.print("Device Address: ");
printAddress(deviceAddress);
Serial.print(" ");
printTemperature(deviceAddress);
Serial.println();
}
void DHT_External()
{
float h = dht.readHumidity();
// Read temperature as Celsius (the default)
float t = dht.readTemperature();
if(t>-20 && t<50){extTemp=t;extHumi=h;}
if(debug)
{
if(debug){
Serial.print("External Temperature = ");
Serial.println(extTemp);
Serial.print("External Humidity = ");
Serial.println(extHumi);}
}
}
void DHT_Internal()
{
float h = dht1.readHumidity();
// Read temperature as Celsius (the default)
float t = dht1.readTemperature();
if(t>-20 && t<50){intTemp=t;intHumi=h;}
if(debug)
{
Serial.print("Internal Temperature = ");
Serial.println(intTemp);
Serial.print("Internal Humidity = ");
Serial.println(intHumi);
}
}
// ----- Sliders position memorize ------
void h0PopCallback(void *ptr)
{
char temp[10] = {0};
uint32_t number = 0;
dbSerialPrintln("h0PopCallback");
h0.getValue(&number);
slider_value=number;
if(debug){Serial.print("H1 Slider value is: ");}
if(debug){Serial.println(slider_value);}
SliderValue[0]=slider_value;
EEPROM.write( 0 , slider_value );
EEPROM.commit();exchangerbit=1;
}
void h1PopCallback(void *ptr)
{
char temp[10] = {0};
uint32_t number = 0;
dbSerialPrintln("h1PopCallback");
h1.getValue(&number);
slider_value=number;
if(debug){Serial.print("H1 Slider value is: ");}
if(debug){Serial.println(slider_value);}
SliderValue[1]=slider_value;
EEPROM.write( 1 , slider_value );
EEPROM.commit();exchangerbit=1;
}
void h2PopCallback(void *ptr)
{
char temp[10] = {0};
uint32_t number = 0;
dbSerialPrintln("h2PopCallback");
h2.getValue(&number);
slider_value=number;
if(debug){Serial.print("H2 Slider value is: ");}
if(debug){Serial.println(slider_value);}
SliderValue[2]=slider_value;
EEPROM.write( 2 , slider_value );
EEPROM.commit();exchangerbit=1;
}
void h3PopCallback(void *ptr)
{
char temp[10] = {0};
uint32_t number = 0;
dbSerialPrintln("h3PopCallback");
h3.getValue(&number);
if(debug){Serial.print("H3 Slider value is: ");}
if(debug){Serial.println(slider_value);}
SliderValue[3]=slider_value;
EEPROM.write( 3 , slider_value );
EEPROM.commit();exchangerbit=1;
}
void h4PopCallback(void *ptr)
{
char temp[10] = {0};
uint32_t number = 0;
dbSerialPrintln("h4PopCallback");
h4.getValue(&number);
slider_value=number;
if(debug){Serial.print("H4 Slider value is: ");}
if(debug){Serial.println(slider_value);}
SliderValue[4]=slider_value;
EEPROM.write( 4 , slider_value );
EEPROM.commit();exchangerbit=1;
}
void h5PopCallback(void *ptr)
{
char temp[10] = {0};
uint32_t number = 0;
dbSerialPrintln("h5PopCallback");
h5.getValue(&number);
slider_value=number;
if(debug){Serial.print("H5 Slider value is: ");}
if(debug){Serial.println(slider_value);}
SliderValue[5]=slider_value;
EEPROM.write( 5 , slider_value );
EEPROM.commit();exchangerbit=1;
}
void h6PopCallback(void *ptr)
{
char temp[10] = {0};
uint32_t number = 0;
dbSerialPrintln("h6PopCallback");
h6.getValue(&number);
slider_value=number;
if(debug){Serial.print("H6 Slider value is: ");}
if(debug){Serial.println(slider_value);}
SliderValue[6]=slider_value;
EEPROM.write( 6 , slider_value );
EEPROM.commit();exchangerbit=1;
}
void h7PopCallback(void *ptr)
{
char temp[10] = {0};
uint32_t number = 0;
dbSerialPrintln("h7PopCallback");
h7.getValue(&number);
slider_value=number;
if(debug){Serial.print("H7 Slider value is: ");}
if(debug){Serial.println(slider_value);}
SliderValue[7]=slider_value;
EEPROM.write( 7 , slider_value );
EEPROM.commit();exchangerbit=1;
}
void h8PopCallback(void *ptr)
{
char temp[10] = {0};
uint32_t number = 0;
dbSerialPrintln("h8PopCallback");
h8.getValue(&number);
slider_value=number;
if(debug){Serial.print("H8 Slider value is: ");}
if(debug){Serial.println(slider_value);}
SliderValue[8]=slider_value;
EEPROM.write( 8 , slider_value );
EEPROM.commit();exchangerbit=1;
}
void h9PopCallback(void *ptr)
{
char temp[10] = {0};
uint32_t number = 0;
dbSerialPrintln("h9PopCallback");
h9.getValue(&number);
slider_value=number;
if(debug){Serial.print("H9 Slider value is: ");}
if(debug){Serial.println(slider_value);}
SliderValue[9]=slider_value;
EEPROM.write( 9 , slider_value );
EEPROM.commit();exchangerbit=1;
}
void h10PopCallback(void *ptr)
{
char temp[10] = {0};
uint32_t number = 0;
dbSerialPrintln("h10PopCallback");
h10.getValue(&number);
slider_value=number;
if(debug){Serial.print("H10 Slider value is: ");}
if(debug){Serial.println(slider_value);}
SliderValue[10]=slider_value;
EEPROM.write( 10 , slider_value );
EEPROM.commit();
}
void h11PopCallback(void *ptr)
{
char temp[10] = {0};
uint32_t number = 0;
dbSerialPrintln("h11PopCallback");
h11.getValue(&number);
slider_value=number;
if(debug){Serial.print("H11 Slider value is: ");}
if(debug){Serial.println(slider_value);}
SliderValue[11]=slider_value;
EEPROM.write( 11 , slider_value );
EEPROM.commit();
}
void h12PopCallback(void *ptr)
{
char temp[10] = {0};
uint32_t number = 0;
dbSerialPrintln("h12PopCallback");
h12.getValue(&number);
slider_value=number;
if(debug){Serial.print("H12 Slider value is: ");}
if(debug){Serial.println(slider_value + 11);}
SliderValue[12]=slider_value;
EEPROM.write( 12 , slider_value);
EEPROM.commit();
}
void h13PopCallback(void *ptr)
{
char temp[10] = {0};
uint32_t number = 0;
dbSerialPrintln("h13PopCallback");
h13.getValue(&number);
slider_value=number;
if(debug){Serial.print("H13 Slider value is: ");}
if(debug){Serial.println(slider_value);}
SliderValue[13]=slider_value;
EEPROM.write( 14 , slider_value);
EEPROM.commit();
}
void NAPPopCallback(void *ptr)
{
char temp[10] = {0};
uint32_t number = 0;
dbSerialPrintln("NAPPopCallback");
NAP.getValue(&number);
slider_value=number;
if(debug){Serial.print("NAP Slider value is: ");}
if(debug){Serial.println(slider_value);}
Days=slider_value;
EEPROM.write( 13 , slider_value );
EEPROM.commit();
}
void FHSWPopCallback(void *ptr)
{
uint16_t len;
uint32_t number = 0;
FHSW.getValue(&number);
Button0=number;
dbSerialPrintln(Button0);
if(Button0!=0)
{
FHPump=1;
digitalWrite(Relay2, HIGH);
}
else
{
FHPump=0;
digitalWrite(Relay2, LOW);
}
}
void BSPopCallback(void *ptr)
{
Serial.println("------- Display Setup Screen ------");
if(OP6pic){sendCommand("OP6.pic=39");Serial.println("Eljött az energia gyűjtés ideje");}else{sendCommand("OP6.pic=40");Serial.println("Energia gyűjtés ciklus vége");}
exchangerbit=1;
}
void BWPopCallback(void *ptr)
{
if(debug){Serial.println("------- Display Water cleaner ------");}
if(digitalRead(Relay4)){sendCommand("CB1.val=1");}else{sendCommand("CB1.val=0");}
if(digitalRead(WaterCleaner)){sendCommand("CX.val=1");}else{sendCommand("CX.val=0");}
}
void AMPopCallback(void *ptr)
{
uint16_t len;
uint32_t number = 0;
Serial.println("---------------------------------------------------------");
AM.getValue(&number);
dbSerialPrintln(number);
if(number>0)
{
Serial.println("---- AUTOMANUAL = 1 ----------------------------------");
AutoManual=1;
}
else
{
AutoManual=0;
Serial.println("---- AUTOMANUAL = 0 ----------------------------------");
}
}
void CB1PopCallback(void *ptr)
{
uint32_t number = 0;
dbSerialPrintln("Kompresszort bekapcsolása/kikapcsolása");
CB1.getValue(&number);
if(number==1)
{
digitalWrite(WaterCleaner,HIGH);sendCommand("CB1.val=1");Blynk.virtualWrite(V107,255);manubit=1;
}
else
{
digitalWrite(WaterCleaner,LOW);sendCommand("CB1.val=0");Blynk.virtualWrite(V107,LOW);manubit=0;
}
}
void thermoPopCallback(void *ptr)
{
uint32_t number = 0;
dbSerialPrintln("Szobatermosztát bekapcsolása/kikapcsolása");
thermo.getValue(&number);
manuTherm=number;
if(number==1)
{
Blynk.virtualWrite(V115,255);
}
else
{
Blynk.virtualWrite(V115,LOW);
}
}
void CXPopCallback(void *ptr)
{
uint32_t number = 0;
bool memory = 0;
dbSerialPrintln("Iszap vagy buborékoltatás váltószelep");
CX.getValue(&number);
if(number==0)
{
digitalWrite(Relay4,LOW);sendCommand("CX.val=0");Blynk.virtualWrite(V106,LOW);
}
else
{
digitalWrite(Relay4,HIGH);sendCommand("CX.val=1");Blynk.virtualWrite(V106,255);
}
}
void ENTPopCallback(void *ptr)
{
char text_char[11];
TM1.getText(text_char, 11);
String BubbTM1=text_char;
int splitT = BubbTM1.indexOf("-");
String TM1_Begin = BubbTM1.substring(0, splitT);
String TM1_End = BubbTM1.substring(splitT+1, splitT+6);
splitT = TM1_Begin.indexOf(":");
TM1_Begin_Hour = TM1_Begin.substring(0, splitT).toInt();
TM1_Begin_Min = TM1_Begin.substring(splitT+1, splitT+3).toInt();
splitT = TM1_End.indexOf(":");
TM1_End_Hour = TM1_End.substring(0, splitT).toInt();
TM1_End_Min = TM1_End.substring(splitT+1, splitT+3).toInt();
if(debug){Serial.print(TM1_Begin_Hour);Serial.print("H");Serial.print(TM1_Begin_Min);Serial.print(" -> ");Serial.print(TM1_End_Hour);Serial.print("H");Serial.println(TM1_End_Min);}
EEPROM.write(20,TM1_Begin_Hour);
EEPROM.write(22,TM1_Begin_Min);
EEPROM.write(24,TM1_End_Hour);
EEPROM.write(26,TM1_End_Min);
TM2.getText(text_char, 11);
String BubbTM2=text_char;
splitT = BubbTM2.indexOf("-");
String TM2_Begin = BubbTM2.substring(0, splitT);
String TM2_End = BubbTM2.substring(splitT+1, splitT+6);
splitT = TM2_Begin.indexOf(":");
TM2_Begin_Hour = TM2_Begin.substring(0, splitT).toInt();
TM2_Begin_Min = TM2_Begin.substring(splitT+1, splitT+3).toInt();
TM2_End_Hour = TM2_End.substring(0, splitT).toInt();
TM2_End_Min = TM2_End.substring(splitT+1, splitT+3).toInt();
EEPROM.write(28,TM2_Begin_Hour);
EEPROM.write(30,TM2_Begin_Min);
EEPROM.write(32,TM2_End_Hour);
EEPROM.write(34,TM2_End_Min);
TM3.getText(text_char, 11);
String BubbTM3=text_char;
splitT = BubbTM3.indexOf("-");
String TM3_Begin = BubbTM3.substring(0, splitT);
String TM3_End = BubbTM3.substring(splitT+1, splitT+6);
splitT = TM3_Begin.indexOf(":");
TM3_Begin_Hour = TM3_Begin.substring(0, splitT).toInt();
TM3_Begin_Min = TM3_Begin.substring(splitT+1, splitT+3).toInt();
TM3_End_Hour = TM3_End.substring(0, splitT).toInt();
TM3_End_Min = TM3_End.substring(splitT+1, splitT+3).toInt();
EEPROM.write(36,TM3_Begin_Hour);
EEPROM.write(38,TM3_Begin_Min);
EEPROM.write(40,TM3_End_Hour);
EEPROM.write(42,TM3_End_Min);
TM4.getText(text_char, 11);
String BubbTM4=text_char;
splitT = BubbTM4.indexOf("-");
String TM4_Begin = BubbTM4.substring(0, splitT);
String TM4_End = BubbTM4.substring(splitT+1, splitT+6);
splitT = TM4_Begin.indexOf(":");
TM4_Begin_Hour = TM4_Begin.substring(0, splitT).toInt();
TM4_Begin_Min = TM4_Begin.substring(splitT+1, splitT+3).toInt();
TM4_End_Hour = TM4_End.substring(0, splitT).toInt();
TM4_End_Min = TM4_End.substring(splitT+1, splitT+3).toInt();
EEPROM.write(44,TM4_Begin_Hour);
EEPROM.write(46,TM4_Begin_Min);
EEPROM.write(48,TM4_End_Hour);
EEPROM.write(50,TM4_End_Min);
TM5.getText(text_char, 11);
String BubbTM5=text_char;
splitT = BubbTM5.indexOf("-");
String TM5_Begin = BubbTM5.substring(0, splitT);
String TM5_End = BubbTM5.substring(splitT+1, splitT+6);
splitT = TM5_Begin.indexOf(":");
TM5_Begin_Hour = TM5_Begin.substring(0, splitT).toInt();
TM5_Begin_Min = TM5_Begin.substring(splitT+1, splitT+3).toInt();
TM5_End_Hour = TM5_End.substring(0, splitT).toInt();
TM5_End_Min = TM5_End.substring(splitT+1, splitT+3).toInt();
EEPROM.write(52,TM5_Begin_Hour);
EEPROM.write(54,TM5_Begin_Min);
EEPROM.write(56,TM5_End_Hour);
EEPROM.write(58,TM5_End_Min);EEPROM.commit();
}
void Bubble_Control()
{
switch (BubbleCtrl) {
case 1:
digitalWrite(WaterCleaner,HIGH);
break;
case 2:
digitalWrite(WaterCleaner,LOW);
break;
case 3:
break;
case 4:
break;
case 5:
break;
case 6:
BubbleCtrl=0;
break;
//-----------------------
default:
break;
}
}
void SliderMemo()
{
char temp[10] = {0};
uint32_t number = 0;
h0.getValue(&number);
slider_value=number;
if(debug){Serial.print("H1 Slider value is: ");}
if(debug){Serial.println(slider_value);}
SliderValue[0]=slider_value;
EEPROM.write( 0 , slider_value );
EEPROM.commit();exchangerbit=1;
h1.getValue(&number);
slider_value=number;
if(debug){Serial.print("H1 Slider value is: ");}
if(debug){Serial.println(slider_value);}
SliderValue[1]=slider_value;
EEPROM.write( 1 , slider_value );
EEPROM.commit();exchangerbit=1;
dbSerialPrintln("h2PopCallback");
h2.getValue(&number);
slider_value=number;
if(debug){Serial.print("H2 Slider value is: ");}
if(debug){Serial.println(slider_value);}
SliderValue[2]=slider_value;
EEPROM.write( 2 , slider_value );
EEPROM.commit();exchangerbit=1;
dbSerialPrintln("h3PopCallback");
h3.getValue(&number);
if(debug){Serial.print("H3 Slider value is: ");}
if(debug){Serial.println(slider_value);}
SliderValue[3]=slider_value;
EEPROM.write( 3 , slider_value );
EEPROM.commit();exchangerbit=1;
dbSerialPrintln("h4PopCallback");
h4.getValue(&number);
slider_value=number;
if(debug){Serial.print("H4 Slider value is: ");}
if(debug){Serial.println(slider_value);}
SliderValue[4]=slider_value;
EEPROM.write( 4 , slider_value );
EEPROM.commit();exchangerbit=1;
dbSerialPrintln("h5PopCallback");
h5.getValue(&number);
slider_value=number;
if(debug){Serial.print("H5 Slider value is: ");}
if(debug){Serial.println(slider_value);}
SliderValue[5]=slider_value;
EEPROM.write( 5 , slider_value );
EEPROM.commit();exchangerbit=1;
dbSerialPrintln("h6PopCallback");
h6.getValue(&number);
slider_value=number;
if(debug){Serial.print("H6 Slider value is: ");}
if(debug){Serial.println(slider_value);}
SliderValue[6]=slider_value;
EEPROM.write( 6 , slider_value );
EEPROM.commit();exchangerbit=1;
dbSerialPrintln("h7PopCallback");
h7.getValue(&number);
slider_value=number;
if(debug){Serial.print("H7 Slider value is: ");}
if(debug){Serial.println(slider_value);}
SliderValue[7]=slider_value;
EEPROM.write( 7 , slider_value );
EEPROM.commit();exchangerbit=1;
dbSerialPrintln("h8PopCallback");
h8.getValue(&number);
slider_value=number;
if(debug){Serial.print("H8 Slider value is: ");}
if(debug){Serial.println(slider_value);}
SliderValue[8]=slider_value;
EEPROM.write( 8 , slider_value );
EEPROM.commit();exchangerbit=1;
dbSerialPrintln("h9PopCallback");
h9.getValue(&number);
slider_value=number;
if(debug){Serial.print("H9 Slider value is: ");}
if(debug){Serial.println(slider_value);}
SliderValue[9]=slider_value;
EEPROM.write( 9 , slider_value );
EEPROM.commit();exchangerbit=1;
dbSerialPrintln("h10PopCallback");
h10.getValue(&number);
slider_value=number;
if(debug){Serial.print("H10 Slider value is: ");}
if(debug){Serial.println(slider_value);}
SliderValue[10]=slider_value;
EEPROM.write( 10 , slider_value );
EEPROM.commit();
dbSerialPrintln("h11PopCallback");
h11.getValue(&number);
slider_value=number;
if(debug){Serial.print("H11 Slider value is: ");}
if(debug){Serial.println(slider_value);}
SliderValue[11]=slider_value;
EEPROM.write( 11 , slider_value );
EEPROM.commit();
dbSerialPrintln("h12PopCallback");
h12.getValue(&number);
slider_value=number;
if(debug){Serial.print("H12 Slider value is: ");}
if(debug){Serial.println(slider_value + 11);}
SliderValue[12]=slider_value;
EEPROM.write( 12 , slider_value);
EEPROM.commit();
dbSerialPrintln("NAPPopCallback");
NAP.getValue(&number);
slider_value=number;
if(debug){Serial.print("NAP Slider value is: ");}
if(debug){Serial.println(slider_value);}
Days=slider_value;
EEPROM.write( 13 , slider_value );
EEPROM.commit();
dbSerialPrintln("h13PopCallback");
h13.getValue(&number);
slider_value=number;
if(debug){Serial.print("H13 Slider value is: ");}
if(debug){Serial.println(slider_value);}
SliderValue[13]=slider_value;
EEPROM.write( 14 , slider_value);
EEPROM.commit();
}
void AllTempRefresh()
{
sensors.requestTemperatures(); // Send the command to get temperatures
HeatPumpOut=sensors.getTempCByIndex(0);Blynk.virtualWrite(V108, HeatPumpOut);
HeatPumpIn=sensors.getTempCByIndex(1);Blynk.virtualWrite(V109, HeatPumpIn);
HeatExchangerOut=sensors.getTempCByIndex(2);Blynk.virtualWrite(V110, HeatExchangerOut);
HeatExchangerIn=sensors.getTempCByIndex(3);Blynk.virtualWrite(V111, HeatExchangerIn);
TankTemp=sensors.getTempCByIndex(4);Blynk.virtualWrite(V112, TankTemp);
WaterForward=sensors.getTempCByIndex(5);Blynk.virtualWrite(V101,WaterForward);
WaterReturn=sensors.getTempCByIndex(6);Blynk.virtualWrite(V102,WaterReturn);
DHT_Internal();Blynk.virtualWrite(V113, intTemp);
DHT_External();Blynk.virtualWrite(V114, extTemp);
}