помогите со скетчам

drimer
Offline
Зарегистрирован: 27.06.2015

есть код

#include <SoftwareSerial.h>
#include <Wire.h>
#include <OneWire.h>
#include <EEPROM.h>
byte _d18x2x1Addr[8]={0x28, 0x96, 0x31, 0x1, 0x0, 0x0, 0x80, 0x57};

SoftwareSerial Serial100(2, 3);

OneWire  _ow2(2);
long _nextionSaveDataVAL_P0_E6;
long _nextionSaveDataVAL_P0_E14;
long _nextionSaveDataVAL_P0_E17;
long _nextionSaveDataPCO_P0_E18;
struct _nextionLissenStruct{
char code;
String result;
long number;
};
_nextionLissenStruct _nextionTempLissen;
struct _I2CRealRimeClockTime
{
 byte seconds = 0;
 byte minutes = 0;
 byte Hours = 0;
 byte weekday = 0;
 byte day = 0;
 byte month = 0;
 byte year = 0;
 unsigned long startTime = 0;
 float temper = 0.0;
};
_I2CRealRimeClockTime _RTC1;
bool _gtv1 = 0;
bool _gtv2 = 0;
int _gtv3;
unsigned long _d18x2x1Tti = 0UL;
float _d18x2x1O = 0.00;
bool _changeNumber12_Out = 0;
long _changeNumber12_OLV;
float _RTCTempO1 = 0.00;
bool _nextionGetValue11_outputValue;
long _nextionGetValue11_StartTime;
bool _nextionGetValue11_isNU = 0;
bool _nextionSetAttr5_isNU = 0;
bool _nextionSetAttr5_oldState = 0;
bool _RTCST_Ost3 = 0;
long _nextionGetValue12_outputValue;
long _nextionGetValue12_StartTime;
bool _nextionGetValue12_isNU = 0;
bool _nextionSetAttr2_isNU = 0;
bool _nextionSetAttr2_oldState = 0;
long _nextionGetValue1_outputValue;
long _nextionGetValue1_StartTime;
bool _nextionGetValue1_isNU = 0;
bool _SEEPR5OSN = 0;
String _RTC1_GetTime2_StrOut;
long _nextionGetValue4_outputValue;
long _nextionGetValue4_StartTime;
bool _nextionGetValue4_isNU = 0;
bool _RTCST_Ost2 = 0;
long _nextionGetValue7_outputValue;
long _nextionGetValue7_StartTime;
bool _nextionGetValue7_isNU = 0;
bool _changeNumber2_Out = 0;
long _changeNumber2_OLV;
bool _changeNumber9_Out = 0;
long _changeNumber9_OLV;
bool _RTCST_Ost5 = 0;
bool _SEEPR1OSN = 0;
bool _changeNumber5_Out = 0;
long _changeNumber5_OLV;
bool _SEEPR4OSN = 0;
long _nextionGetValue6_outputValue;
long _nextionGetValue6_StartTime;
bool _nextionGetValue6_isNU = 0;
bool _RTCAlO1 = 0;
bool _changeNumber8_Out = 0;
long _changeNumber8_OLV;
bool _changeNumber7_Out = 0;
long _changeNumber7_OLV;
bool _RTCAlO2 = 0;
bool _trgs1 = 0;
bool _nextionGetValue10_outputValue;
long _nextionGetValue10_StartTime;
bool _nextionGetValue10_isNU = 0;
bool _changeNumber10_Out = 0;
int _changeNumber10_OLV;
String _RTC1_GetTime1_StrOut;
bool _changeNumber13_Out = 0;
long _changeNumber13_OLV;
bool _nextionSetAttr1_isNU = 0;
bool _nextionSetAttr1_oldState = 0;
bool _nextionGetValue13_outputValue;
long _nextionGetValue13_StartTime;
bool _nextionGetValue13_isNU = 0;
long _nextionGetValue3_outputValue;
long _nextionGetValue3_StartTime;
bool _nextionGetValue3_isNU = 0;
bool _nextionSetAttr3_isNU = 0;
bool _nextionSetAttr3_oldState = 0;
bool _RTCST_Ost1 = 0;
bool _changeNumber1_Out = 0;
long _changeNumber1_OLV;
bool _RTCST_Ost4 = 0;
bool _changeString1_ChOut = 0;
String _changeString1_OLV;
bool _changeNumber4_Out = 0;
long _changeNumber4_OLV;
bool _trgs2 = 0;
long _nextionGetValue2_outputValue;
long _nextionGetValue2_StartTime;
bool _nextionGetValue2_isNU = 0;
bool _SEEPR3OSN = 0;
bool _changeString2_ChOut = 0;
String _changeString2_OLV;
long _nextionGetValue5_outputValue;
long _nextionGetValue5_StartTime;
bool _nextionGetValue5_isNU = 0;
long _nextionGetValue9_outputValue;
long _nextionGetValue9_StartTime;
bool _nextionGetValue9_isNU = 0;
bool _changeNumber6_Out = 0;
long _changeNumber6_OLV;
bool _changeNumber3_Out = 0;
long _changeNumber3_OLV;
bool _SEEPR2OSN = 0;
bool _nextionSetAttr4_isNU = 0;
bool _nextionSetAttr4_oldState = 0;
long _nextionGetValue8_outputValue;
long _nextionGetValue8_StartTime;
bool _nextionGetValue8_isNU = 0;
bool _changeNumber11_Out = 0;
int _changeNumber11_OLV;
void setup()
{
Wire.begin();
delay(10);
if(((readByteFromEEPROM(0, 0, 0x0))) != 153) {
(updateByteToEEPROM(0, 0, 0x0, (153)));
(updateLongToEEPROM(1, 0, 0x0, (0)));
(updateLongToEEPROM(5, 0, 0x0, (0)));
(updateLongToEEPROM(9, 0, 0x0, (0)));
(updateLongToEEPROM(13, 0, 0x0, (0)));
(updateLongToEEPROM(17, 0, 0x0, (25)));
}
Wire.beginTransmission(68);
Wire.write(0x0E);
Wire.write(B00000000);
Wire.write(B10001000);
Wire.endTransmission();
_RTC1.startTime = millis() - 1000;
Serial100.begin(9600);
pinMode(4, OUTPUT);
pinMode(4, OUTPUT);
pinMode(1, OUTPUT);

nextionSendCommand("", 100);
nextionSendCommand("page 0", 100);
_nextionGetValue1_StartTime = millis();
_nextionGetValue2_StartTime = millis();
_nextionGetValue3_StartTime = millis();
_nextionGetValue4_StartTime = millis();
_nextionGetValue5_StartTime = millis();
_nextionGetValue6_StartTime = millis();
_nextionGetValue7_StartTime = millis();
_nextionGetValue8_StartTime = millis();
_nextionGetValue9_StartTime = millis();
_nextionGetValue10_StartTime = millis();
_nextionGetValue11_StartTime = millis();
_nextionGetValue12_StartTime = millis();
_nextionGetValue13_StartTime = millis();
}
void loop()
{String _tempVariable_String;
long _tempVariable_long;
int _tempVariable_int;

//Плата:1
//Наименование:плата часов и установки часов
if(_isTimer(_nextionGetValue2_StartTime, 1000)){ _nextionGetValue2_StartTime = millis(); _nextionGetValue2_isNU = 1; }
if (nextionAskPageNamper(100) == 1) {if(_nextionGetValue2_isNU){_tempVariable_String = "get page1.n4.val";
_nextionTempLissen = nextionSendCommand(_tempVariable_String.c_str(), 100);
 if(_nextionTempLissen.code = 'q') {_nextionGetValue2_outputValue = _nextionTempLissen.number;};
_nextionGetValue2_isNU = 0;}}else {_nextionGetValue2_isNU = 0;}
if (_changeNumber1_Out) {_changeNumber1_Out = 0;} else {_tempVariable_long = _nextionGetValue2_outputValue;
if (_tempVariable_long != _changeNumber1_OLV) {_changeNumber1_OLV = _tempVariable_long; _changeNumber1_Out = 1;}
}
 if (_changeNumber1_Out)
{ if (!(_RTCST_Ost5))
{set3231Date(0x68, &_RTC1, -1, -1, -1, -1, -1, (_nextionGetValue2_outputValue), -1);
get3231Date(0x68, &_RTC1);
_RTCST_Ost5 = 1;
}}
 else
{ _RTCST_Ost5 = 0;}
get3231Date(0x68, &_RTC1);
_RTC1_GetTime1_StrOut = ( _convertRealTimeClockNumberToString(_RTC1.day))+
String("-")+
( _convertRealTimeClockNumberToString(_RTC1.month))+
String("-")+
(String("20") +( _convertRealTimeClockNumberToString (_RTC1.year)));
_tempVariable_String = _RTC1_GetTime1_StrOut;
if (_changeString1_ChOut) {_changeString1_ChOut = 0;} else {if (!((_tempVariable_String.compareTo(_changeString1_OLV))==0)) {_changeString1_OLV = _tempVariable_String; _changeString1_ChOut = 1;}}
if (_changeString1_ChOut) { if (! _nextionSetAttr2_oldState ) {_nextionSetAttr2_oldState = 1; _nextionSetAttr2_isNU = 1; _nextionSaveDataVAL_P0_E17 =  0 ;}} else {_nextionSetAttr2_oldState = 0;}
if (nextionAskPageNamper(100) == 0) {if (_nextionSetAttr2_isNU) {_tempVariable_String = String("page0.t1.val=") + String(_nextionSaveDataVAL_P0_E17);
nextionSendCommand(_tempVariable_String.c_str(), 100);
_nextionSetAttr2_isNU = 0; }} else {_nextionSetAttr2_isNU = 1; }
if(_isTimer(_nextionGetValue1_StartTime, 1000)){ _nextionGetValue1_StartTime = millis(); _nextionGetValue1_isNU = 1; }
if (nextionAskPageNamper(100) == 1) {if(_nextionGetValue1_isNU){_tempVariable_String = "get page1.n3.val";
_nextionTempLissen = nextionSendCommand(_tempVariable_String.c_str(), 100);
 if(_nextionTempLissen.code = 'q') {_nextionGetValue1_outputValue = _nextionTempLissen.number;};
_nextionGetValue1_isNU = 0;}}else {_nextionGetValue1_isNU = 0;}
if (_changeNumber2_Out) {_changeNumber2_Out = 0;} else {_tempVariable_long = _nextionGetValue1_outputValue;
if (_tempVariable_long != _changeNumber2_OLV) {_changeNumber2_OLV = _tempVariable_long; _changeNumber2_Out = 1;}
}
 if (_changeNumber2_Out)
{ if (!(_RTCST_Ost4))
{set3231Date(0x68, &_RTC1, -1, -1, -1, -1, (_nextionGetValue1_outputValue), -1, -1);
get3231Date(0x68, &_RTC1);
_RTCST_Ost4 = 1;
}}
 else
{ _RTCST_Ost4 = 0;}
get3231Date(0x68, &_RTC1);
_RTC1_GetTime2_StrOut = ( _convertRealTimeClockNumberToString(_RTC1.Hours))+
String(":")+
( _convertRealTimeClockNumberToString(_RTC1.minutes))+
String(":")+
( _convertRealTimeClockNumberToString(_RTC1.seconds));
_tempVariable_String = _RTC1_GetTime2_StrOut;
if (_changeString2_ChOut) {_changeString2_ChOut = 0;} else {if (!((_tempVariable_String.compareTo(_changeString2_OLV))==0)) {_changeString2_OLV = _tempVariable_String; _changeString2_ChOut = 1;}}
if (_changeString2_ChOut) { if (! _nextionSetAttr1_oldState ) {_nextionSetAttr1_oldState = 1; _nextionSetAttr1_isNU = 1; _nextionSaveDataPCO_P0_E18 =  0 ;}} else {_nextionSetAttr1_oldState = 0;}
if (nextionAskPageNamper(100) == 0) {if (_nextionSetAttr1_isNU) {_tempVariable_String = String("page0.bt2.pco=") + String(_nextionSaveDataPCO_P0_E18);
nextionSendCommand(_tempVariable_String.c_str(), 100);
_tempVariable_String = "ref bt2";
nextionSendCommand(_tempVariable_String.c_str(), 100);  
_nextionSetAttr1_isNU = 0; }} else {_nextionSetAttr1_isNU = 1; }
if(_isTimer(_nextionGetValue5_StartTime, 1000)){ _nextionGetValue5_StartTime = millis(); _nextionGetValue5_isNU = 1; }
if (nextionAskPageNamper(100) == 1) {if(_nextionGetValue5_isNU){_tempVariable_String = "get page1.n2.val";
_nextionTempLissen = nextionSendCommand(_tempVariable_String.c_str(), 100);
 if(_nextionTempLissen.code = 'q') {_nextionGetValue5_outputValue = _nextionTempLissen.number;};
_nextionGetValue5_isNU = 0;}}else {_nextionGetValue5_isNU = 0;}
if (_changeNumber3_Out) {_changeNumber3_Out = 0;} else {_tempVariable_long = _nextionGetValue5_outputValue;
if (_tempVariable_long != _changeNumber3_OLV) {_changeNumber3_OLV = _tempVariable_long; _changeNumber3_Out = 1;}
}
 if (_changeNumber3_Out)
{ if (!(_RTCST_Ost3))
{set3231Date(0x68, &_RTC1, -1, -1, -1, (_nextionGetValue5_outputValue), -1, -1, -1);
get3231Date(0x68, &_RTC1);
_RTCST_Ost3 = 1;
}}
 else
{ _RTCST_Ost3 = 0;}
if(_isTimer(_nextionGetValue3_StartTime, 1000)){ _nextionGetValue3_StartTime = millis(); _nextionGetValue3_isNU = 1; }
if (nextionAskPageNamper(100) == 1) {if(_nextionGetValue3_isNU){_tempVariable_String = "get page1.n0.val";
_nextionTempLissen = nextionSendCommand(_tempVariable_String.c_str(), 100);
 if(_nextionTempLissen.code = 'q') {_nextionGetValue3_outputValue = _nextionTempLissen.number;};
_nextionGetValue3_isNU = 0;}}else {_nextionGetValue3_isNU = 0;}
if (_changeNumber4_Out) {_changeNumber4_Out = 0;} else {_tempVariable_long = _nextionGetValue3_outputValue;
if (_tempVariable_long != _changeNumber4_OLV) {_changeNumber4_OLV = _tempVariable_long; _changeNumber4_Out = 1;}
}
 if (_changeNumber4_Out)
{ if (!(_RTCST_Ost2))
{set3231Date(0x68, &_RTC1, -1, -1, (_nextionGetValue3_outputValue), -1, -1, -1, -1);
get3231Date(0x68, &_RTC1);
_RTCST_Ost2 = 1;
}}
 else
{ _RTCST_Ost2 = 0;}
if(_isTimer(_nextionGetValue4_StartTime, 1000)){ _nextionGetValue4_StartTime = millis(); _nextionGetValue4_isNU = 1; }
if (nextionAskPageNamper(100) == 1) {if(_nextionGetValue4_isNU){_tempVariable_String = "get page1.n1.val";
_nextionTempLissen = nextionSendCommand(_tempVariable_String.c_str(), 100);
 if(_nextionTempLissen.code = 'q') {_nextionGetValue4_outputValue = _nextionTempLissen.number;};
_nextionGetValue4_isNU = 0;}}else {_nextionGetValue4_isNU = 0;}
if (_changeNumber5_Out) {_changeNumber5_Out = 0;} else {_tempVariable_long = _nextionGetValue4_outputValue;
if (_tempVariable_long != _changeNumber5_OLV) {_changeNumber5_OLV = _tempVariable_long; _changeNumber5_Out = 1;}
}
 if (_changeNumber5_Out)
{ if (!(_RTCST_Ost1))
{set3231Date(0x68, &_RTC1, -1, (_nextionGetValue4_outputValue), -1, -1, -1, -1, -1);
get3231Date(0x68, &_RTC1);
_RTCST_Ost1 = 1;
}}
 else
{ _RTCST_Ost1 = 0;}

//Плата:2
//Наименование:установка таймера
if(_isTimer(_nextionGetValue7_StartTime, 1000)){ _nextionGetValue7_StartTime = millis(); _nextionGetValue7_isNU = 1; }
if (nextionAskPageNamper(100) == 2) {if(_nextionGetValue7_isNU){_tempVariable_String = "get page2.n0.val";
_nextionTempLissen = nextionSendCommand(_tempVariable_String.c_str(), 100);
 if(_nextionTempLissen.code = 'q') {_nextionGetValue7_outputValue = _nextionTempLissen.number;};
_nextionGetValue7_isNU = 0;}}else {_nextionGetValue7_isNU = 0;}
if (_changeNumber6_Out) {_changeNumber6_Out = 0;} else {_tempVariable_long = _nextionGetValue7_outputValue;
if (_tempVariable_long != _changeNumber6_OLV) {_changeNumber6_OLV = _tempVariable_long; _changeNumber6_Out = 1;}
}
if(_changeNumber6_Out){ if(!_SEEPR1OSN){(updateLongToEEPROM(1, 0, 0x0, (_nextionGetValue7_outputValue)));
_SEEPR1OSN=1;} }else{ if(_SEEPR1OSN){_SEEPR1OSN=0;}}
if(_isTimer(_nextionGetValue6_StartTime, 1000)){ _nextionGetValue6_StartTime = millis(); _nextionGetValue6_isNU = 1; }
if (nextionAskPageNamper(100) == 2) {if(_nextionGetValue6_isNU){_tempVariable_String = "get page2.n1.val";
_nextionTempLissen = nextionSendCommand(_tempVariable_String.c_str(), 100);
 if(_nextionTempLissen.code = 'q') {_nextionGetValue6_outputValue = _nextionTempLissen.number;};
_nextionGetValue6_isNU = 0;}}else {_nextionGetValue6_isNU = 0;}
if (_changeNumber7_Out) {_changeNumber7_Out = 0;} else {_tempVariable_long = _nextionGetValue6_outputValue;
if (_tempVariable_long != _changeNumber7_OLV) {_changeNumber7_OLV = _tempVariable_long; _changeNumber7_Out = 1;}
}
if(_changeNumber7_Out){ if(!_SEEPR2OSN){(updateLongToEEPROM(5, 0, 0x0, (_nextionGetValue6_outputValue)));
_SEEPR2OSN=1;} }else{ if(_SEEPR2OSN){_SEEPR2OSN=0;}}
if(_isTimer(_nextionGetValue10_StartTime, 1000)){ _nextionGetValue10_StartTime = millis(); _nextionGetValue10_isNU = 1; }
if (nextionAskPageNamper(100) == 0) {if(_nextionGetValue10_isNU){_tempVariable_String = "get page0.bt0.val";
_nextionTempLissen = nextionSendCommand(_tempVariable_String.c_str(), 100);
 if(_nextionTempLissen.code = 'q') {_nextionGetValue10_outputValue = _nextionTempLissen.number;};
_nextionGetValue10_isNU = 0;}}else {_nextionGetValue10_isNU = 0;}
 if (_nextionGetValue10_outputValue)
{
get3231Date(0x68, &_RTC1);
_RTCAlO2 = 1;
if (_RTC1.Hours != ((readLongFromEEPROM(9, 0, 0x0)))) { _RTCAlO2 = 0;}
if (_RTC1.minutes != ((readLongFromEEPROM(13, 0, 0x0)))) { _RTCAlO2 = 0;}
 } else {_RTCAlO2 = 0;}
_gtv1 = _RTCAlO2;
 if (_nextionGetValue10_outputValue)
{
get3231Date(0x68, &_RTC1);
_RTCAlO1 = 1;
if (_RTC1.Hours != ((readLongFromEEPROM(1, 0, 0x0)))) { _RTCAlO1 = 0;}
if (_RTC1.minutes != ((readLongFromEEPROM(5, 0, 0x0)))) { _RTCAlO1 = 0;}
 } else {_RTCAlO1 = 0;}
_gtv2 = _RTCAlO1;
if(_gtv2) _trgs1 = 1;
if(_gtv1) _trgs1 = 0;
digitalWrite(4, _trgs1);
if(_isTimer(_nextionGetValue8_StartTime, 1000)){ _nextionGetValue8_StartTime = millis(); _nextionGetValue8_isNU = 1; }
if (nextionAskPageNamper(100) == 2) {if(_nextionGetValue8_isNU){_tempVariable_String = "get page2.n1.val";
_nextionTempLissen = nextionSendCommand(_tempVariable_String.c_str(), 100);
 if(_nextionTempLissen.code = 'q') {_nextionGetValue8_outputValue = _nextionTempLissen.number;};
_nextionGetValue8_isNU = 0;}}else {_nextionGetValue8_isNU = 0;}
if (_changeNumber8_Out) {_changeNumber8_Out = 0;} else {_tempVariable_long = _nextionGetValue8_outputValue;
if (_tempVariable_long != _changeNumber8_OLV) {_changeNumber8_OLV = _tempVariable_long; _changeNumber8_Out = 1;}
}
if(_changeNumber8_Out){ if(!_SEEPR3OSN){(updateLongToEEPROM(9, 0, 0x0, (_nextionGetValue8_outputValue)));
_SEEPR3OSN=1;} }else{ if(_SEEPR3OSN){_SEEPR3OSN=0;}}
if(_isTimer(_nextionGetValue9_StartTime, 1000)){ _nextionGetValue9_StartTime = millis(); _nextionGetValue9_isNU = 1; }
if (nextionAskPageNamper(100) == 2) {if(_nextionGetValue9_isNU){_tempVariable_String = "get page2.n3.val";
_nextionTempLissen = nextionSendCommand(_tempVariable_String.c_str(), 100);
 if(_nextionTempLissen.code = 'q') {_nextionGetValue9_outputValue = _nextionTempLissen.number;};
_nextionGetValue9_isNU = 0;}}else {_nextionGetValue9_isNU = 0;}
if (_changeNumber9_Out) {_changeNumber9_Out = 0;} else {_tempVariable_long = _nextionGetValue9_outputValue;
if (_tempVariable_long != _changeNumber9_OLV) {_changeNumber9_OLV = _tempVariable_long; _changeNumber9_Out = 1;}
}
if(_changeNumber9_Out){ if(!_SEEPR4OSN){(updateLongToEEPROM(13, 0, 0x0, (_nextionGetValue9_outputValue)));
_SEEPR4OSN=1;} }else{ if(_SEEPR4OSN){_SEEPR4OSN=0;}}

//Плата:3
//Наименование:термодатчик
get3231Date(0x68, &_RTC1);
_RTCTempO1 = _RTC1.temper;
if (_changeNumber11_Out) {_changeNumber11_Out = 0;} else {_tempVariable_int = (int(_RTCTempO1));
if (_tempVariable_int != _changeNumber11_OLV) {_changeNumber11_OLV = _tempVariable_int; _changeNumber11_Out = 1;}
}
if (_changeNumber11_Out) { if (! _nextionSetAttr5_oldState ) {_nextionSetAttr5_oldState = 1; _nextionSetAttr5_isNU = 1; _nextionSaveDataVAL_P0_E6 =  (int(_RTCTempO1)) ;}} else {_nextionSetAttr5_oldState = 0;}
if (nextionAskPageNamper(100) == 0) {if (_nextionSetAttr5_isNU) {_tempVariable_String = String("page0.n7.val=") + String(_nextionSaveDataVAL_P0_E6);
nextionSendCommand(_tempVariable_String.c_str(), 100);
_nextionSetAttr5_isNU = 0; }} else {_nextionSetAttr5_isNU = 1; }
if(_isTimer(_d18x2x1Tti, 1000)) {
_d18x2x1Tti = millis();
_d18x2x1O=  _readDS18_ow2(_d18x2x1Addr, 0);}
_gtv3 = (int((_d18x2x1O)));
if (_changeNumber10_Out) {_changeNumber10_Out = 0;} else {_tempVariable_int = (int((_d18x2x1O)));
if (_tempVariable_int != _changeNumber10_OLV) {_changeNumber10_OLV = _tempVariable_int; _changeNumber10_Out = 1;}
}
if (_changeNumber10_Out) { if (! _nextionSetAttr4_oldState ) {_nextionSetAttr4_oldState = 1; _nextionSetAttr4_isNU = 1; _nextionSaveDataVAL_P0_E14 =  (int((_d18x2x1O))) ;}} else {_nextionSetAttr4_oldState = 0;}
if (nextionAskPageNamper(100) == 0) {if (_nextionSetAttr4_isNU) {_tempVariable_String = String("page0.n1.val=") + String(_nextionSaveDataVAL_P0_E14);
nextionSendCommand(_tempVariable_String.c_str(), 100);
_nextionSetAttr4_isNU = 0; }} else {_nextionSetAttr4_isNU = 1; }

//Плата:4
//Наименование:помпа
if(_isTimer(_nextionGetValue11_StartTime, 1000)){ _nextionGetValue11_StartTime = millis(); _nextionGetValue11_isNU = 1; }
if (nextionAskPageNamper(100) == 0) {if(_nextionGetValue11_isNU){_tempVariable_String = "get page0.bt1.val";
_nextionTempLissen = nextionSendCommand(_tempVariable_String.c_str(), 100);
 if(_nextionTempLissen.code = 'q') {_nextionGetValue11_outputValue = _nextionTempLissen.number;};
_nextionGetValue11_isNU = 0;}}else {_nextionGetValue11_isNU = 0;}
digitalWrite(4, _nextionGetValue11_outputValue);

//Плата:5
//Наименование:терморегулятор
if(_isTimer(_nextionGetValue12_StartTime, 1000)){ _nextionGetValue12_StartTime = millis(); _nextionGetValue12_isNU = 1; }
if (nextionAskPageNamper(100) == 0) {if(_nextionGetValue12_isNU){_tempVariable_String = "get page0.n1.val";
_nextionTempLissen = nextionSendCommand(_tempVariable_String.c_str(), 100);
 if(_nextionTempLissen.code = 'q') {_nextionGetValue12_outputValue = _nextionTempLissen.number;};
_nextionGetValue12_isNU = 0;}}else {_nextionGetValue12_isNU = 0;}
if (_changeNumber12_Out) {_changeNumber12_Out = 0;} else {_tempVariable_long = _nextionGetValue12_outputValue;
if (_tempVariable_long != _changeNumber12_OLV) {_changeNumber12_OLV = _tempVariable_long; _changeNumber12_Out = 1;}
}
if(_changeNumber12_Out){ if(!_SEEPR5OSN){(updateLongToEEPROM(17, 0, 0x0, (_nextionGetValue12_outputValue)));
_SEEPR5OSN=1;} }else{ if(_SEEPR5OSN){_SEEPR5OSN=0;}}
if (_changeNumber13_Out) {_changeNumber13_Out = 0;} else {_tempVariable_long = (readLongFromEEPROM(17, 0, 0x0));
if (_tempVariable_long != _changeNumber13_OLV) {_changeNumber13_OLV = _tempVariable_long; _changeNumber13_Out = 1;}
}
if (_changeNumber13_Out) { if (! _nextionSetAttr3_oldState ) {_nextionSetAttr3_oldState = 1; _nextionSetAttr3_isNU = 1; _nextionSaveDataVAL_P0_E14 =  (readLongFromEEPROM(17, 0, 0x0)) ;}} else {_nextionSetAttr3_oldState = 0;}
if (nextionAskPageNamper(100) == 0) {if (_nextionSetAttr3_isNU) {_tempVariable_String = String("page0.n1.val=") + String(_nextionSaveDataVAL_P0_E14);
nextionSendCommand(_tempVariable_String.c_str(), 100);
_nextionSetAttr3_isNU = 0; }} else {_nextionSetAttr3_isNU = 1; }
if((_gtv3) <= (((readLongFromEEPROM(17, 0, 0x0)))-(1))) _trgs2 = 1;
if((_gtv3) >= ((readLongFromEEPROM(17, 0, 0x0)))) _trgs2 = 0;
if(_isTimer(_nextionGetValue13_StartTime, 1000)){ _nextionGetValue13_StartTime = millis(); _nextionGetValue13_isNU = 1; }
if (nextionAskPageNamper(100) == 0) {if(_nextionGetValue13_isNU){_tempVariable_String = "get page0.bt2.val";
_nextionTempLissen = nextionSendCommand(_tempVariable_String.c_str(), 100);
 if(_nextionTempLissen.code = 'q') {_nextionGetValue13_outputValue = _nextionTempLissen.number;};
_nextionGetValue13_isNU = 0;}}else {_nextionGetValue13_isNU = 0;}
digitalWrite(1, ( (_nextionGetValue13_outputValue) && (_trgs2) ));

}
bool _isTimer(unsigned long startTime, unsigned long period )
  {
  unsigned long currentTime;
currentTime = millis();
if (currentTime>= startTime) {return (currentTime>=(startTime + period));} else {return (currentTime >=(4294967295-startTime+period));}
  }
float _convertDS18x2xData(byte type_s, byte data[12])
{
  int16_t raw = (data[1] << 8) | data[0];
  if (type_s)
  {
  raw = raw << 3;
  if (data[7] == 0x10) { raw = (raw & 0xFFF0) + 12 - data[6]; }
  }
else
  {
   byte cfg = (data[4] & 0x60);
   if (cfg == 0x00) raw = raw & ~7;   else if (cfg == 0x20) raw = raw & ~3;  else if (cfg == 0x40) raw = raw & ~1;
  }
return  (float)raw / 16.0;
}
float _readDS18_ow2(byte addr[8], byte type_s)
{  byte data[12];
byte i;
_ow2.reset();
_ow2.select(addr);
_ow2.write(0xBE);
for ( i = 0; i < 9; i++) {
 data[i] = _ow2.read();}
_ow2.reset();
_ow2.select(addr);
_ow2.write(0x44, 1);
return _convertDS18x2xData(type_s, data);}struct _nextionLissenStruct nextionSendCommand(const char* cmd, byte port )
{
while (Serial100.available()){Serial100.read(); }
Serial100.print(cmd);
Serial100.write(0xFF);
Serial100.write(0xFF);
Serial100.write(0xFF);
return nextionListen(port);
}
struct _nextionLissenStruct nextionListen( byte port )
{
byte _bite;
byte _end = 0xff;
byte cmd[100];
int index = 0;
_nextionLissenStruct temp;
temp.result = "";
temp.code = 'z';
temp.number = 0;
int countEnd = 0;
delay(50);
long startTime = millis();
while(! (countEnd==3)) {
while(Serial100.available()>0){
if(Serial100.available()>0){
_bite = Serial100.read();
cmd[index] = _bite;
 index++;
if(_bite == _end){countEnd++;}
if(countEnd == 3){break;}
}}
if(_isTimer(startTime, 100)) {return temp;}
}
  switch (cmd[0]) {
  case 0x66:
  temp.code = 'f';
  temp.result = String(cmd[1], DEC);
    return temp;
    break;
  case 0x70:
      temp.code = 'p';
    for (int i = 1; i < index - 3; i++) {
    temp.result += char(cmd[i]);}
    return temp;
    break;
 case 0x71:
      temp.code = 'q';
    temp.number = (cmd[4] << 24) | (cmd[3] << 16) | (cmd[2] << 8) | (cmd[1]);
    return temp;
    break;
  default:
    return temp;
    break;
  }    
  return temp;
}
int nextionAskPageNamper(byte port)
{
int result;
_nextionLissenStruct temp;
temp =  nextionSendCommand("sendme",port);
  if((temp.code == 'f')&&(temp.result != "")){result = temp.result.toInt();} else {result = -1;}
return result;
}
 byte readByteFromEEPROM(int addres, byte bitAddres, byte chipAddres)
{
return EEPROM.read(addres);
}
void updateByteToEEPROM(int addres, byte bitAddres, byte chipAddres, byte value)
{
return EEPROM.update(addres, value);
}
 long readLongFromEEPROM(int addres, byte bitAddres, byte chipAddres)
{
byte x[4];
for(byte i = 0; i < 4; i++) { x[i] = readByteFromEEPROM( (addres+i),  bitAddres,  chipAddres);}
long *y = (long *)&x;
return y[0];
}
 void updateLongToEEPROM(int addres, byte bitAddres, byte chipAddres, long value)
{
byte *x = (byte *)&value;
for(byte i = 0; i < 4; i++) {updateByteToEEPROM( (addres+i),  bitAddres,  chipAddres, x[i]);}
}
byte decToBcd(byte val)
 {
   return ( (val/10*16) + (val%10) );
 }
void set3231Date(int addres, struct _I2CRealRimeClockTime *timeStruct, byte sec, byte  minut, byte hou, byte dat, byte mo, byte ye, byte daW)
{
  byte temp;

  Wire.beginTransmission(addres);
  Wire.write(0x00);
  if (sec < 0) {
    temp = timeStruct -> seconds;
  } else {
    temp = sec;
  }
  Wire.write(decToBcd(temp));
  if (minut < 0) {
    temp = timeStruct -> minutes;
  } else {
    temp = minut;
  }
  Wire.write(decToBcd(temp));
  if (hou < 0) {
    temp = timeStruct -> Hours;
  } else {
    temp = hou;
  }
  Wire.write(decToBcd(temp));
  if (daW < 0) {
    temp = timeStruct -> weekday;
  } else {
    temp = daW;
  }
  Wire.write(decToBcd(temp));
  if (dat < 0) {
    temp = timeStruct -> day;
  } else {
    temp = dat;
  }
  Wire.write(decToBcd(temp));
  if (mo < 0) {
    temp = timeStruct -> month;
  } else {
    temp = mo;
  }
  Wire.write(decToBcd(temp));
  if (ye < 0) {
    temp = timeStruct -> year;
  } else {
    temp = ye;
  }
  Wire.write(decToBcd(temp));
  Wire.endTransmission();
  timeStruct ->startTime = millis() - 1000;
}
void get3231Date(int addres, struct _I2CRealRimeClockTime *timeStruct)
{
  if (!(_isTimer ((timeStruct ->startTime), 250))) {
    return;
  }
  Wire.beginTransmission( addres);
  Wire.write(0x00);
  Wire.endTransmission();
  Wire.requestFrom(addres, 7);
  if (Wire.available()) {
    byte  seconds = Wire.read();
    byte minutes = Wire.read();
    byte hours   = Wire.read();
    byte day     = Wire.read();
    byte date    = Wire.read();
    byte month   = Wire.read();
    byte year    = Wire.read();
    timeStruct -> seconds = (((seconds & B11110000) >> 4) * 10 + (seconds & B00001111));
    timeStruct -> minutes = (((minutes & B11110000) >> 4) * 10 + (minutes & B00001111));
    timeStruct -> Hours = (((hours & B00110000) >> 4) * 10 + (hours & B00001111));
    timeStruct -> weekday = (day & B00000111);
    timeStruct -> day    = (((date & B00110000) >> 4) * 10 + (date & B00001111));
    timeStruct -> month   = (((month & B00010000) >> 4) * 10 + (month & B00001111));
    timeStruct -> year    = (((year & B11110000) >> 4) * 10 + (year & B00001111));
  }  
  byte tMSB, tLSB;
  float result;
  Wire.beginTransmission(addres);
  Wire.write(0x11);
  Wire.endTransmission();
  Wire.requestFrom(addres, 2);
  if (Wire.available()) {
    tMSB = Wire.read();
    tLSB = Wire.read();
    result = (tMSB & B01111111);
    result += ( (tLSB >> 6) * 0.25 );
    timeStruct -> temper  = result;
  }
 timeStruct ->startTime = millis();
}
String _convertRealTimeClockNumberToString(byte value)
{
  if (value > 9) {
    return String(value, DEC);
  }
  return (String("0") + String(value, DEC));
}

 и есть ошибки

C:\Users\виктор\Desktop\akva\akva.ino: In function 'void loop()':

C:\Users\виктор\Desktop\akva\akva.ino:188:34: warning: suggest parentheses around assignment used as truth value [-Wparentheses]

C:\Users\виктор\Desktop\akva\akva.ino:216:34: warning: suggest parentheses around assignment used as truth value [-Wparentheses]

C:\Users\виктор\Desktop\akva\akva.ino:246:34: warning: suggest parentheses around assignment used as truth value [-Wparentheses]

C:\Users\виктор\Desktop\akva\akva.ino:262:34: warning: suggest parentheses around assignment used as truth value [-Wparentheses]

C:\Users\виктор\Desktop\akva\akva.ino:278:34: warning: suggest parentheses around assignment used as truth value [-Wparentheses]

C:\Users\виктор\Desktop\akva\akva.ino:297:34: warning: suggest parentheses around assignment used as truth value [-Wparentheses]

C:\Users\виктор\Desktop\akva\akva.ino:307:34: warning: suggest parentheses around assignment used as truth value [-Wparentheses]

C:\Users\виктор\Desktop\akva\akva.ino:317:34: warning: suggest parentheses around assignment used as truth value [-Wparentheses]

C:\Users\виктор\Desktop\akva\akva.ino:341:34: warning: suggest parentheses around assignment used as truth value [-Wparentheses]

C:\Users\виктор\Desktop\akva\akva.ino:351:34: warning: suggest parentheses around assignment used as truth value [-Wparentheses]

C:\Users\виктор\Desktop\akva\akva.ino:387:34: warning: suggest parentheses around assignment used as truth value [-Wparentheses]

C:\Users\виктор\Desktop\akva\akva.ino:396:34: warning: suggest parentheses around assignment used as truth value [-Wparentheses]

C:\Users\виктор\Desktop\akva\akva.ino:415:34: warning: suggest parentheses around assignment used as truth value [-Wparentheses]

C:\Users\виктор\Desktop\akva\akva.ino: In function '_nextionLissenStruct nextionListen(byte)':

C:\Users\виктор\Desktop\akva\akva.ino:502:27: warning: left shift count >= width of type

C:\Users\виктор\Desktop\akva\akva.ino:502:44: warning: left shift count >= width of type
куда скобки круглые ставить нада ?

andycat
andycat аватар
Offline
Зарегистрирован: 07.09.2017

ошибка в хз какой строке :(

 

http://arduino.ru/forum/obshchii/vstavka-programmnogo-koda-v-temukomment...

 

noisefault
Offline
Зарегистрирован: 24.09.2018

жутковатый скетч :)

вы сами понимаете как он работает и что делает?

b707
Offline
Зарегистрирован: 26.05.2017

drimer, вы тоже за 3 года на форуме не научились код в сообщения правильно вставлять? - или ваш ник взломан?

Вставьте код как положено, иначе 100%. что никто в нем разбираться не станет. Даже при правильной вставке шансы невелики - уж больно длинная простыня

drimer
Offline
Зарегистрирован: 27.06.2015

в етой строке где ошибка

if (_nextionTempLissen.code = 'q')

а то пишет

C:\Users\виктор\Desktop\akva\akva.ino:193:40: warning: suggest parentheses around assignment used as truth value [-Wparentheses]

wdrakula
wdrakula аватар
Offline
Зарегистрирован: 15.03.2016

drimer пишет:

в етой строке

Хотя мне больше нравится "в ентой".

drimer пишет:

 ...где ошибка

в ДНК ... "=" и "==" это разные операторы

b707
Offline
Зарегистрирован: 26.05.2017

Дракула - к чему вдруг такая "доброта" к ущербным? :)

sadman41
Offline
Зарегистрирован: 19.10.2016

Сдается мне, что это FLProg...

DIYMan
DIYMan аватар
Offline
Зарегистрирован: 23.11.2015

sadman41 пишет:

Сдается мне, что это FLProg...

Судя по борьбе с миллис - он самый:

  unsigned long currentTime;
currentTime = millis();
if (currentTime>= startTime) {return (currentTime>=(startTime + period));} else {return (currentTime >=(4294967295-startTime+period));}

Руки бы поотрывал :)

drimer
Offline
Зарегистрирован: 27.06.2015

да flprog

DIYMan
DIYMan аватар
Offline
Зарегистрирован: 23.11.2015

drimer пишет:

да flprog

К автору сего кривого поделия обращайся.