#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <EEPROM.h>
LiquidCrystal_I2C _lcd1(0x33, 20, 4);
int _dispTempLength1=0;
boolean _isNeedClearDisp1;
LiquidCrystal_I2C _lcd2(0x27, 20, 4);
int _dispTempLength2=0;
boolean _isNeedClearDisp2;
bool _FreeLog2_IArr[2];
bool _FreeLog2_Q1_StArr[] = {1, 1};
bool T_77490550_2;
bool R_77490550_2;
bool Q_77490550_2;
bool flag_77490550_2;
bool En_100557512_2;
int FreeRAM_100557512_2;
const int _menuParametrsArray[] PROGMEM = {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 2, 0, 0, 5, 11, 0, 0, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 0, 26, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 0, 0, 0, 5, 3, 5, 0, 0, 2, 6, 1, 1, 4, 7, 0, 20, 21, 6, 3, 3, 0, 0, 2, 4, 1, 1, 4, 5, 0, 17, 18, 7, 3, 8, 0, 0, 2, 7, 1, 1, 4, 10, 0, 24, 25, 8, 3, 6, 0, 0, 2, 3, 10, 1, 4, 8, 0, 22, 23, 9, 3, 2, 0, 0, 2, 3, 1, 1, 4, 3, 0, 15, 16, 10, 3, 1, 0, 0, 2, 2, 8, 1, 4, 1, 0, 0, 14, 11, 0, 0, 12, 13, 2, 0, 0, 0, 0, 11, 0, 0, 0, 12, 3, 4, 0, 0, 11, 5, 9, 1, 4, 6, 0, 0, 19, 13, 3, 7, 0, 0, 11, 3, 1, 1, 4, 9, 0, 0, 0};
int _menuValueArray_int[8];
const int _menuConstantValuesArray_int[] PROGMEM = {1, 2, 300, 30, 85, 15, 10, 0, -10, 5};
const char _flprogMenuNameString1[] PROGMEM = "Progriv";
const char _flprogMenuNameString2[] PROGMEM = "Generator";
const char _flprogMenuNameString3[] PROGMEM = "Return to LINE";
const char _flprogMenuNameString4[] PROGMEM = "ATS - System";
const char _flprogMenuNameString5[] PROGMEM = "Starter - PAUSE";
const char _flprogMenuNameString6[] PROGMEM = "temp";
const char _flprogMenuNameString7[] PROGMEM = "Starter - RUN";
const char _flprogMenuNameString8[] PROGMEM = "GEN start-up";
const char _flprogMenuNameString9[] PROGMEM = "time";
const char _flprogMenuNameString10[] PROGMEM = "Starter - BLOCKED";
const char _flprogMenuNameString11[] PROGMEM = "menu progreva";
const char _flprogMenuNameString12[] PROGMEM = "work MOTOhours";
const char _flprogMenuNameString13[] PROGMEM = "Temperature&press";
const char _flprogMenuNameString14[] PROGMEM = "0-off|1-temp|2-time";
const char _flprogMenuNameString15[] PROGMEM = "*Delay return toLINE";
const char _flprogMenuNameString16[] PROGMEM = "*MIN 1sec*MAX 300sec";
const char _flprogMenuNameString17[] PROGMEM = "*Starter pause(time)";
const char _flprogMenuNameString18[] PROGMEM = "*MIN 1sec*MAX 30sec";
const char _flprogMenuNameString19[] PROGMEM = "min -10 max 85";
const char _flprogMenuNameString20[] PROGMEM = "*starter work(time)";
const char _flprogMenuNameString21[] PROGMEM = "*MIN 1sec*MAX 15sec";
const char _flprogMenuNameString22[] PROGMEM = "*Start-up time delay";
const char _flprogMenuNameString23[] PROGMEM = "*MIN 5sec*MAX 300sec";
const char _flprogMenuNameString24[] PROGMEM = "*Number of attempts";
const char _flprogMenuNameString25[] PROGMEM = "*MIN 1 *MAX 10";
const char _flprogMenuNameString26[] PROGMEM = "narabotka godyn";
const char* const _flprogMenuStringsArray[] PROGMEM = { _flprogMenuNameString1, _flprogMenuNameString2, _flprogMenuNameString3, _flprogMenuNameString4, _flprogMenuNameString5, _flprogMenuNameString6, _flprogMenuNameString7, _flprogMenuNameString8, _flprogMenuNameString9, _flprogMenuNameString10, _flprogMenuNameString11, _flprogMenuNameString12, _flprogMenuNameString13, _flprogMenuNameString14, _flprogMenuNameString15, _flprogMenuNameString16, _flprogMenuNameString17, _flprogMenuNameString18, _flprogMenuNameString19, _flprogMenuNameString20, _flprogMenuNameString21, _flprogMenuNameString22, _flprogMenuNameString23, _flprogMenuNameString24, _flprogMenuNameString25, _flprogMenuNameString26};
struct _menuItemStricture
{
int startInArrayIndex;
}
;
struct _menuMainStricture
{
String tempString;
int startIndex;
int stopIndex;
bool isSwitchMenuAroundRing;
_menuItemStricture currentItem;
}
;
_menuItemStricture _MenuItems[13];
_menuMainStricture _MainMenus[1];
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;
}
;
_I2CRealRimeClockTime _RTC1;
bool _bounseInput25S = 0;
bool _bounseInput25O = 0;
unsigned long _bounseInput25P = 0UL;
String _Terminal_91363471;
bool _mkb2C1xP1 = 0;
bool _mkb2C1xP2 = 0;
bool _mkb2C1xP3 = 0;
bool _mkb2C1xP4 = 0;
bool _mkb2C2xP1 = 0;
bool _mkb2C2xP2 = 0;
bool _mkb2C2xP3 = 0;
bool _mkb2C2xP4 = 0;
bool _mkb2C3xP1 = 0;
bool _mkb2C3xP2 = 0;
bool _mkb2C3xP3 = 0;
bool _mkb2C3xP4 = 0;
bool _mkb2C4xP1 = 0;
bool _mkb2C4xP2 = 0;
bool _mkb2C4xP3 = 0;
bool _mkb2C4xP4 = 0;
int _disp8oldLength = 0;
bool _k1 = 0;
bool _gen2I = 0;
bool _gen2O = 0;
unsigned long _gen2P = 0UL;
bool _kgen1 = 0;
bool _kRtrg1rtrg2 = 0;
bool _kRtrg1rtrg2In = 0;
bool _kRtrg1 = 0;
int _disp2oldLength = 0;
bool _k12 = 0;
String _Terminal_83519677;
int _disp9oldLength = 0;
bool _tim8I = 0;
bool _tim8O = 0;
unsigned long _tim8P = 0UL;
bool _ktim7 = 0;
bool _k9 = 0;
bool _k10 = 0;
int _disp6oldLength = 0;
bool _bounseInput26S = 0;
bool _bounseInput26O = 0;
unsigned long _bounseInput26P = 0UL;
bool _k16 = 0;
bool _tim7I = 0;
bool _tim7O = 0;
unsigned long _tim7P = 0UL;
bool _ktim1 = 0;
bool _tim6I = 0;
bool _tim6O = 0;
unsigned long _tim6P = 0UL;
bool _ktim5 = 0;
int _disp7oldLength = 0;
bool _changeNumber2_Out = 0;
byte _changeNumber2_OLV;
bool _k8 = 0;
bool _k13 = 0;
bool _k4 = 0;
bool _comp1 = 0;
bool _MenuBlock_190419232_AMO_242574068 = 0;
bool _MenuBlock_190419232_AMO_259274609 = 0;
bool _MenuBlock_190419232_AMO_208369156 = 0;
bool _MenuBlock_190419232_AMO_76417757 = 0;
String _MenuBlock_190419232_ASO_1;
String _MenuBlock_190419232_ASO_2;
String _MenuBlock_190419232_MNO;
String _MenuBlock_190419232_VNO;
bool _MenuBlock_190419232_OEIS = 0;
bool _MenuBlock_190419232_ORIS = 0;
bool _MenuBlock_190419232_OMUIS = 0;
bool _MenuBlock_190419232_OMDIS = 0;
bool _MenuBlock_190419232_OEMIS = 0;
bool _MenuBlock_190419232_OExFMIS = 0;
bool _MenuBlock_190419232_OVUIS = 0;
bool _MenuBlock_190419232_OVDIS = 0;
bool _MenuBlock_190419232_IDI_0 = 0;
bool _MenuBlock_190419232_IDI_1 = 0;
bool _MenuBlock_190419232_IDI_2 = 0;
bool _MenuBlock_190419232_IDI_3 = 0;
bool _MenuBlock_190419232_IDI_4 = 0;
bool _MenuBlock_190419232_IDI_5 = 0;
bool _MenuBlock_190419232_IDI_6 = 0;
bool _MenuBlock_190419232_IDI_7 = 0;
bool _MenuBlock_190419232_IDI_8 = 0;
bool _MenuBlock_190419232_IDI_9 = 0;
bool _MenuBlock_190419232_BackspaceIOS = 0;
bool _comp2 = 0;
bool _bounseInput24S = 0;
bool _bounseInput24O = 0;
unsigned long _bounseInput24P = 0UL;
bool _count1I = 0;
unsigned long _count1_Value = 0UL;
int _disp12oldLength = 0;
bool _dms1Q0 = 0;
bool _dms1Q1 = 0;
bool _dms1Q2 = 0;
String _Terminal_75228380;
bool _k11 = 0;
int _disp13oldLength = 0;
int _disp4oldLength = 0;
bool _bounseInput28S = 0;
bool _bounseInput28O = 0;
unsigned long _bounseInput28P = 0UL;
bool _tim3I = 0;
bool _tim3O = 0;
unsigned long _tim3P = 0UL;
bool _ktim4 = 0;
bool _bounse2S = 0;
bool _bounse2O = 0;
unsigned long _bounse2P = 0UL;
bool _k7 = 0;
int _disp11oldLength = 0;
int _disp15oldLength = 0;
bool _tim1I = 0;
bool _tim1O = 0;
unsigned long _tim1P = 0UL;
bool _ktim2 = 0;
bool _bounseInput27S = 0;
bool _bounseInput27O = 0;
unsigned long _bounseInput27P = 0UL;
bool _tim2I = 0;
bool _tim2O = 0;
unsigned long _tim2P = 0UL;
bool _ktim3 = 0;
bool _k14 = 0;
bool _bounseInput29S = 0;
bool _bounseInput29O = 0;
unsigned long _bounseInput29P = 0UL;
int _disp10oldLength = 0;
bool _k15 = 0;
bool _FreeLog2_Q1 = 0;
bool _k5 = 0;
int _disp3oldLength = 0;
bool _k3 = 0;
String _RTC1_GetTime2_StrOut;
byte _RTC1_GetTime2_MinOut = 0;
byte _RTC1_GetTime2_SecOut = 0;
int _disp5oldLength = 0;
bool _k6 = 0;
int _Terminal_267138007;
long _convertStringToNamberOutput_5 = 0L;
bool _SEEPR2OSN = 0;
String _Terminal_167380666;
bool _k2 = 0;
int _disp1oldLength = 0;
bool _count3I = 0;
int _count3_Value = 0;
bool _tim4I = 0;
bool _tim4O = 0;
unsigned long _tim4P = 0UL;
bool _ktim6 = 0;
bool _tempVariable_bool;
String _tempVariable_String;
byte _tempVariable_byte;
int _tempVariable_int;
void setup()
{
pinMode(26, INPUT_PULLUP);
pinMode(27, INPUT_PULLUP);
pinMode(28, INPUT_PULLUP);
pinMode(33, OUTPUT);
digitalWrite(33, 0);
pinMode(29, INPUT_PULLUP);
pinMode(32, OUTPUT);
digitalWrite(32, 0);
pinMode(34, OUTPUT);
digitalWrite(34, 0);
pinMode(30, OUTPUT);
digitalWrite(30, 0);
pinMode(31, OUTPUT);
digitalWrite(31, 0);
pinMode(35, OUTPUT);
digitalWrite(35, 0);
pinMode(25, INPUT_PULLUP);
pinMode(24, INPUT_PULLUP);
Wire.begin();
delay(10);
if(((readByteFromEEPROM(0, 0, 0x0))) != 162)
{
(updateByteToEEPROM(0, 0, 0x0, (162)));
(updateIntegerToEEPROM(1, 0, 0x0, (2)));
(updateIntegerToEEPROM(3, 0, 0x0, (10)));
(updateIntegerToEEPROM(5, 0, 0x0, (4)));
(updateIntegerToEEPROM(7, 0, 0x0, (10)));
(updateIntegerToEEPROM(9, 0, 0x0, (5)));
(updateIntegerToEEPROM(11, 0, 0x0, (10)));
(updateIntegerToEEPROM(13, 0, 0x0, (30)));
(updateIntegerToEEPROM(15, 0, 0x0, (5)));
}
Wire.beginTransmission(68);
Wire.write(0x0E);
Wire.write(B00000000);
Wire.write(B10001000);
Wire.endTransmission();
_RTC1.startTime = millis() - 1000;
_lcd1.init();
_lcd1.backlight();
_lcd2.init();
_lcd2.backlight();
_bounseInput26O = digitalRead(26);
_bounseInput27O = digitalRead(27);
_bounseInput28O = digitalRead(28);
_bounseInput29O = digitalRead(29);
_bounseInput25O = digitalRead(25);
_bounseInput24O = digitalRead(24);
pinMode(40, INPUT_PULLUP);
pinMode(41, INPUT_PULLUP);
pinMode(42, INPUT_PULLUP);
pinMode(43, INPUT_PULLUP);
pinMode(36, OUTPUT);
digitalWrite(36, HIGH);
pinMode(37, OUTPUT);
digitalWrite(37, HIGH);
pinMode(38, OUTPUT);
digitalWrite(38, HIGH);
pinMode(39, OUTPUT);
digitalWrite(39, HIGH);
_MenuItems[0].startInArrayIndex = 0;
_MenuItems[1].startInArrayIndex = 14;
_MenuItems[2].startInArrayIndex = 28;
_MenuItems[3].startInArrayIndex = 42;
_MenuItems[4].startInArrayIndex = 56;
_MenuItems[5].startInArrayIndex = 70;
_MenuItems[6].startInArrayIndex = 84;
_MenuItems[7].startInArrayIndex = 98;
_MenuItems[8].startInArrayIndex = 112;
_MenuItems[9].startInArrayIndex = 126;
_MenuItems[10].startInArrayIndex = 140;
_MenuItems[11].startInArrayIndex = 154;
_MenuItems[12].startInArrayIndex = 168;
_MainMenus[0].tempString = "";
_MainMenus[0].startIndex = 1;
_MainMenus[0].isSwitchMenuAroundRing = 1;
_MainMenus[0].stopIndex = 4;
_MainMenus[0].currentItem = _MenuItems[0];
_menuValueArray_int[0] = (readIntegerFromEEPROM(1, 0, 0x0));
_menuValueArray_int[1] = (readIntegerFromEEPROM(3, 0, 0x0));
_menuValueArray_int[2] = (readIntegerFromEEPROM(5, 0, 0x0));
_menuValueArray_int[3] = (readIntegerFromEEPROM(7, 0, 0x0));
_menuValueArray_int[4] = (readIntegerFromEEPROM(9, 0, 0x0));
_menuValueArray_int[5] = (readIntegerFromEEPROM(11, 0, 0x0));
_menuValueArray_int[6] = (readIntegerFromEEPROM(13, 0, 0x0));
_menuValueArray_int[7] = (readIntegerFromEEPROM(15, 0, 0x0));
}
void loop()
{
if (_isNeedClearDisp1)
{
_lcd1.clear();
_isNeedClearDisp1= 0;
}
if (_isNeedClearDisp2)
{
_lcd2.clear();
_isNeedClearDisp2= 0;
}
bool _bounceInputTmp26 = (digitalRead (26));
if (_bounseInput26S)
{
if (millis() >= (_bounseInput26P + 40))
{
_bounseInput26O= _bounceInputTmp26;
_bounseInput26S=0;
}
}
else
{
if (_bounceInputTmp26 != _bounseInput26O)
{
_bounseInput26S=1;
_bounseInput26P = millis();
}
}
bool _bounceInputTmp27 = (digitalRead (27));
if (_bounseInput27S)
{
if (millis() >= (_bounseInput27P + 40))
{
_bounseInput27O= _bounceInputTmp27;
_bounseInput27S=0;
}
}
else
{
if (_bounceInputTmp27 != _bounseInput27O)
{
_bounseInput27S=1;
_bounseInput27P = millis();
}
}
bool _bounceInputTmp28 = (digitalRead (28));
if (_bounseInput28S)
{
if (millis() >= (_bounseInput28P + 40))
{
_bounseInput28O= _bounceInputTmp28;
_bounseInput28S=0;
}
}
else
{
if (_bounceInputTmp28 != _bounseInput28O)
{
_bounseInput28S=1;
_bounseInput28P = millis();
}
}
bool _bounceInputTmp29 = (digitalRead (29));
if (_bounseInput29S)
{
if (millis() >= (_bounseInput29P + 40))
{
_bounseInput29O= _bounceInputTmp29;
_bounseInput29S=0;
}
}
else
{
if (_bounceInputTmp29 != _bounseInput29O)
{
_bounseInput29S=1;
_bounseInput29P = millis();
}
}
bool _bounceInputTmp25 = (digitalRead (25));
if (_bounseInput25S)
{
if (millis() >= (_bounseInput25P + 40))
{
_bounseInput25O= _bounceInputTmp25;
_bounseInput25S=0;
}
}
else
{
if (_bounceInputTmp25 != _bounseInput25O)
{
_bounseInput25S=1;
_bounseInput25P = millis();
}
}
bool _bounceInputTmp24 = (digitalRead (24));
if (_bounseInput24S)
{
if (millis() >= (_bounseInput24P + 40))
{
_bounseInput24O= _bounceInputTmp24;
_bounseInput24S=0;
}
}
else
{
if (_bounceInputTmp24 != _bounseInput24O)
{
_bounseInput24S=1;
_bounseInput24P = millis();
}
}
//Плата:1
//Наименование:Входи/виходи
_k1 = (((!_k5)) &&(_k3));
_k2 = (((((!_k5)) &&(_k4))) &&((!_k11)));
digitalWrite (30, (((((((!_k5)) &&(_k1))) &&((!_k2)))) &&((!_k9))));
if(((_menuValueArray_int[0]) == 0))
{
_dms1Q0 = (((((((!_k5)) &&(_k2))) &&((!_k1)))) &&((!_k9)));
}
else
{
_dms1Q0 = 0;
}
if(((_menuValueArray_int[0]) == 1))
{
_dms1Q1 = (((((((!_k5)) &&(_k2))) &&((!_k1)))) &&((!_k9)));
}
else
{
_dms1Q1 = 0;
}
if(((_menuValueArray_int[0]) == 2))
{
_dms1Q2 = (((((((!_k5)) &&(_k2))) &&((!_k1)))) &&((!_k9)));
}
else
{
_dms1Q2 = 0;
}
if (1)
{
_dispTempLength1 = (((String((((_menuValueArray_int[6]))*(1000)), DEC)))).length();
if (_disp6oldLength > _dispTempLength1)
{
_isNeedClearDisp1 = 1;
}
_disp6oldLength = _dispTempLength1;
_lcd1.setCursor(9, 0);
_lcd1.print(((String((((_menuValueArray_int[6]))*(1000)), DEC))));
}
else
{
if (_disp6oldLength > 0)
{
_isNeedClearDisp1 = 1;
_disp6oldLength = 0;
}
}
if (_dms1Q2)
{
if (_tim8I)
{
if (_isTimer(_tim8P, (((_menuValueArray_int[6]))*(1000))))
{
_tim8O = 1;
}
}
else
{
_tim8I =1;
_tim8P = millis();
}
}
else
{
_tim8O = 0;
_tim8I = 0;
}
if(_tim8O)
{
_ktim7 = 1;
}
else
{
_ktim7 = 0;
}
digitalWrite (31, ((((_dms1Q1) &&(_comp2))) || (((_dms1Q2) &&(_ktim7))) || (_dms1Q0)));
if (1)
{
_dispTempLength1 = ((String(""))).length();
if (_disp15oldLength > _dispTempLength1)
{
_isNeedClearDisp1 = 1;
}
_disp15oldLength = _dispTempLength1;
_lcd1.setCursor(0, 0);
_lcd1.print((String("")));
}
else
{
if (_disp15oldLength > 0)
{
_isNeedClearDisp1 = 1;
_disp15oldLength = 0;
}
}
if (_ktim7)
{
_dispTempLength1 = (String("kt7 on")).length();
if (_disp8oldLength > _dispTempLength1)
{
_isNeedClearDisp1 = 1;
}
_disp8oldLength = _dispTempLength1;
_lcd1.setCursor(0, 3);
_lcd1.print(String("kt7 on"));
}
else
{
if (_disp8oldLength > 0)
{
_isNeedClearDisp1 = 1;
_disp8oldLength = 0;
}
}
if(((map(((analogRead (0))), (115), (953), (80), (-24))))>=((_menuValueArray_int[3])))
{
_comp2 = 1;
}
else
{
_comp2 = 0;
}
_k5 = _bounseInput28O;
_k3 = (!_bounseInput26O);
_k4 = (!_bounseInput27O);
_k6 = ((_kgen1) &&((!_comp1)));
digitalWrite (33, (((!_k5)) &&(_k6)));
_k7 = (((!_bounseInput29O)) || (_kRtrg1));
if (((_k3) || (_k4)))
{
if (_kRtrg1rtrg2In)
{
_kRtrg1rtrg2 = 0;
}
else
{
_kRtrg1rtrg2 = 1;
_kRtrg1rtrg2In = 1;
}
}
else
{
_kRtrg1rtrg2 = 0;
_kRtrg1rtrg2In = 0;
}
;
_kRtrg1 = _kRtrg1rtrg2;
_k8 = (((!_k5)) &&(_ktim2));
digitalWrite (32, (((((!_k5)) &&((!_k8)))) &&((!_k9))));
_k9 = ((_comp1) || (_k5));
digitalWrite (34, _k9);
_k10 = (((!_k5)) &&(_k6));
digitalWrite (35, _k10);
_k14 = 1;
_k12 = (!_bounseInput25O);
//Плата:2
//Наименование:Запуск генератора
//Комментарии:Запуск генератора , якщо пропало електропостачання в лінії електропередач
if ((((!_k5)) &&((!_k3))))
{
if (_tim7I)
{
if (_isTimer(_tim7P, (((_menuValueArray_int[5]))*(1000))))
{
_tim7O = 1;
}
}
else
{
_tim7I =1;
_tim7P = millis();
}
}
else
{
_tim7O = 0;
_tim7I = 0;
}
if(_tim7O)
{
_ktim1 = 1;
}
else
{
_ktim1 = 0;
}
if ((((((!_k5)) &&(_ktim1))) &&((!_k4))))
{
if (! _gen2I)
{
_gen2I = 1;
_gen2O = 1;
_gen2P = millis();
}
}
else
{
_gen2I = 0 ;
_gen2O= 0;
}
if (_gen2I)
{
if (_gen2O)
{
if (_isTimer(_gen2P , (((_menuValueArray_int[4]))*(1000))))
{
_gen2P = millis();
_gen2O = 0;
}
}
else
{
if (_isTimer(_gen2P , (((_menuValueArray_int[2]))*(1000))))
{
_gen2P = millis();
_gen2O = 1;
}
}
}
if(_gen2O)
{
_kgen1 = 1;
}
else
{
_kgen1 = 0;
}
if (_k7)
{
_count3_Value = 0;
}
else
{
if ((((!_k5)) &&(_kgen1)))
{
if (! _count3I)
{
_count3I = 1;
if(_count3_Value < ((_menuValueArray_int[7])))
{
_count3_Value = _count3_Value + 1;
}
}
}
else
{
_count3I = 0;
}
}
if(((_menuValueArray_int[7]))==(_count3_Value))
{
_comp1 = 1;
}
else
{
_comp1 = 0;
}
//Плата:3
//Наименование:Зупинка генератора
//Комментарии:При відновленні електропостачання та перехід на лінію
if (_k3)
{
if (_tim1I)
{
if (_isTimer(_tim1P, (((_menuValueArray_int[1]))*(1000))))
{
_tim1O = 1;
}
}
else
{
_tim1I =1;
_tim1P = millis();
}
}
else
{
_tim1O = 0;
_tim1I = 0;
}
if(_tim1O)
{
_ktim2 = 1;
}
else
{
_ktim2 = 0;
}
T_77490550_2 = _ktim2;
R_77490550_2 = _k7;
if(R_77490550_2) Q_77490550_2 = 0;
if(T_77490550_2 && !R_77490550_2 && !flag_77490550_2)
{
Q_77490550_2 = !Q_77490550_2;
flag_77490550_2 = 1;
}
if(!T_77490550_2 && flag_77490550_2) flag_77490550_2 = 0;
_k11 = Q_77490550_2;
if (_k7)
{
if (_tim2I)
{
if (_isTimer(_tim2P, 7000))
{
_tim2O = 1;
}
}
else
{
_tim2I =1;
_tim2P = millis();
}
}
else
{
_tim2O = 0;
_tim2I = 0;
}
if(_tim2O)
{
_ktim3 = 1;
}
else
{
_ktim3 = 0;
}
if (_k7)
{
if (_tim3I)
{
if (_isTimer(_tim3P, 15000))
{
_tim3O = 1;
}
}
else
{
_tim3I =1;
_tim3P = millis();
}
}
else
{
_tim3O = 0;
_tim3I = 0;
}
if(_tim3O)
{
_ktim4 = 1;
}
else
{
_ktim4 = 0;
}
if (_k7)
{
if (_tim4I)
{
if (_isTimer(_tim4P, 10000))
{
_tim4O = 1;
}
}
else
{
_tim4I =1;
_tim4P = millis();
}
}
else
{
_tim4O = 0;
_tim4I = 0;
}
if(_tim4O)
{
_ktim6 = 1;
}
else
{
_ktim6 = 0;
}
get3231Date(0x68, &_RTC1);
_RTC1_GetTime2_StrOut = (_convertRealTimeClockNumberToString(_RTC1.day))+
String("-")+
(_convertRealTimeClockNumberToString(_RTC1.month))+
String("-")+
(String("20") +(_convertRealTimeClockNumberToString (_RTC1.year)))+
String(", ")+
(_convertRealTimeClockNumberToString(_RTC1.Hours))+
String(":")+
(_convertRealTimeClockNumberToString(_RTC1.minutes))+
String(":")+
(_convertRealTimeClockNumberToString(_RTC1.seconds));
_RTC1_GetTime2_MinOut = _RTC1.minutes;
_RTC1_GetTime2_SecOut = _RTC1.seconds;
//Плата:4
//Наименование:Menu
digitalWrite(36, 0);
_mkb2C1xP1 = ! (digitalRead(40));
_mkb2C1xP2 = ! (digitalRead(41));
_mkb2C1xP3 = ! (digitalRead(42));
_mkb2C1xP4 = ! (digitalRead(43));
digitalWrite(36, 1);
digitalWrite(37, 0);
_mkb2C2xP1 = ! (digitalRead(40));
_mkb2C2xP2 = ! (digitalRead(41));
_mkb2C2xP3 = ! (digitalRead(42));
_mkb2C2xP4 = ! (digitalRead(43));
digitalWrite(37, 1);
digitalWrite(38, 0);
_mkb2C3xP1 = ! (digitalRead(40));
_mkb2C3xP2 = ! (digitalRead(41));
_mkb2C3xP3 = ! (digitalRead(42));
_mkb2C3xP4 = ! (digitalRead(43));
digitalWrite(38, 1);
digitalWrite(39, 0);
_mkb2C4xP1 = ! (digitalRead(40));
_mkb2C4xP2 = ! (digitalRead(41));
_mkb2C4xP3 = ! (digitalRead(42));
_mkb2C4xP4 = ! (digitalRead(43));
digitalWrite(39, 1);
if (_mkb2C4xP1)
{
if (_tim6I)
{
if (_isTimer(_tim6P, 4000))
{
_tim6O = 1;
}
}
else
{
_tim6I =1;
_tim6P = millis();
}
}
else
{
_tim6O = 0;
_tim6I = 0;
}
if(_tim6O)
{
_ktim5 = 1;
}
else
{
_ktim5 = 0;
}
if (_k14)
{
_tempVariable_bool = 1;
if (! _MenuBlock_190419232_OEIS)
{
_MenuBlock_190419232_OEIS = 1;
(_MainMenus[0]).tempString = "";
}
_tempVariable_int = pgm_read_byte(&_menuParametrsArray[((_MainMenus[0].currentItem).startInArrayIndex)+10]);
_MenuBlock_190419232_MNO = _readStringFromProgmem ((char*)pgm_read_word(&(_flprogMenuStringsArray[_tempVariable_int - 1])));
_MenuBlock_190419232_VNO = _menuOutputValueString (0);
_MenuBlock_190419232_AMO_242574068 = pgm_read_byte(&_menuParametrsArray[(_MainMenus[0].currentItem).startInArrayIndex]) == 1;
_MenuBlock_190419232_AMO_259274609 = pgm_read_byte(&_menuParametrsArray[(_MainMenus[0].currentItem).startInArrayIndex]) == 10;
_MenuBlock_190419232_AMO_208369156 = pgm_read_byte(&_menuParametrsArray[(_MainMenus[0].currentItem).startInArrayIndex]) == 3;
_MenuBlock_190419232_AMO_76417757 = pgm_read_byte(&_menuParametrsArray[(_MainMenus[0].currentItem).startInArrayIndex]) == 4;
_tempVariable_int = pgm_read_byte(&_menuParametrsArray[(((_MainMenus[0]).currentItem).startInArrayIndex) +12]);
if(_tempVariable_int == 0)
{
_MenuBlock_190419232_ASO_1 = "";
}
else
{
_MenuBlock_190419232_ASO_1 = _readStringFromProgmem ((char*)pgm_read_word(&(_flprogMenuStringsArray[_tempVariable_int - 1])));
}
_tempVariable_int = pgm_read_byte(&_menuParametrsArray[(((_MainMenus[0]).currentItem).startInArrayIndex) +13]);
if(_tempVariable_int == 0)
{
_MenuBlock_190419232_ASO_2 = "";
}
else
{
_MenuBlock_190419232_ASO_2 = _readStringFromProgmem ((char*)pgm_read_word(&(_flprogMenuStringsArray[_tempVariable_int - 1])));
}
}
else
{
_tempVariable_bool = 0;
if (_MenuBlock_190419232_OEIS)
{
_MenuBlock_190419232_OEIS = 0;
_menuUpdateToEEpromItems();
}
_MenuBlock_190419232_AMO_242574068 = 0;
_MenuBlock_190419232_AMO_259274609 = 0;
_MenuBlock_190419232_AMO_208369156 = 0;
_MenuBlock_190419232_AMO_76417757 = 0;
_MenuBlock_190419232_ASO_1 = "";
_MenuBlock_190419232_ASO_2 = "";
_MenuBlock_190419232_MNO = "";
_MenuBlock_190419232_VNO = "";
}
if(_ktim4)
{
if (!_MenuBlock_190419232_ORIS)
{
_MenuBlock_190419232_ORIS = 1;
if(_tempVariable_bool)
{
_MainMenus[0].currentItem = _MenuItems[0];
_menuUpdateToEEpromItems();
(_MainMenus[0]).tempString = "";
}
}
}
else
{
_MenuBlock_190419232_ORIS = 0;
}
if(_mkb2C3xP4)
{
if (! _MenuBlock_190419232_OMUIS)
{
_MenuBlock_190419232_OMUIS = 1;
if(_tempVariable_bool)
{
_menuUpEvents(0);
_menuUpdateToEEpromItems();
}
}
}
else
{
_MenuBlock_190419232_OMUIS = 0;
}
if(_mkb2C4xP4)
{
if (! _MenuBlock_190419232_OMDIS)
{
_MenuBlock_190419232_OMDIS = 1;
if(_tempVariable_bool)
{
_menuDownEvents(0);
_menuUpdateToEEpromItems();
}
}
}
else
{
_MenuBlock_190419232_OMDIS = 0;
}
if(_mkb2C4xP3)
{
if (! _MenuBlock_190419232_OEMIS)
{
_MenuBlock_190419232_OEMIS = 1;
if(_tempVariable_bool)
{
_menuEnterTheMenuEvents (0);
_menuUpdateToEEpromItems();
}
}
}
else
{
_MenuBlock_190419232_OEMIS = 0;
}
if(_mkb2C4xP1)
{
if (! _MenuBlock_190419232_OExFMIS)
{
_MenuBlock_190419232_OExFMIS = 1;
if(_tempVariable_bool)
{
_menuExitFromMenuEvents (0);
_menuUpdateToEEpromItems();
}
}
}
else
{
_MenuBlock_190419232_OExFMIS = 0;
}
if(_mkb2C1xP4)
{
if (! _MenuBlock_190419232_OVUIS)
{
_MenuBlock_190419232_OVUIS = 1;
if(_tempVariable_bool)
{
_valueUpEvents(0);
}
}
}
else
{
_MenuBlock_190419232_OVUIS = 0;
}
if(_mkb2C2xP4)
{
if (! _MenuBlock_190419232_OVDIS)
{
_MenuBlock_190419232_OVDIS = 1;
if(_tempVariable_bool)
{
_valueDownEvents(0);
}
}
}
else
{
_MenuBlock_190419232_OVDIS = 0;
}
if(_ktim5)
{
if (_tempVariable_bool)
{
(_MainMenus[0]).currentItem = _MenuItems[0];
_menuUpdateToEEpromItems();
(_MainMenus[0]).tempString = "";
}
}
if(_mkb2C4xP2)
{
if (! _MenuBlock_190419232_IDI_0)
{
_MenuBlock_190419232_IDI_0 = 1;
if(_tempVariable_bool)
{
_menuDirectInputKeyPressEvents(0, '0');
}
}
}
else
{
_MenuBlock_190419232_IDI_0 = 0;
}
if(_mkb2C1xP1)
{
if (! _MenuBlock_190419232_IDI_1)
{
_MenuBlock_190419232_IDI_1 = 1;
if(_tempVariable_bool)
{
_menuDirectInputKeyPressEvents(0, '1');
}
}
}
else
{
_MenuBlock_190419232_IDI_1 = 0;
}
if(_mkb2C1xP2)
{
if (! _MenuBlock_190419232_IDI_2)
{
_MenuBlock_190419232_IDI_2 = 1;
if(_tempVariable_bool)
{
_menuDirectInputKeyPressEvents(0, '2');
}
}
}
else
{
_MenuBlock_190419232_IDI_2 = 0;
}
if(_mkb2C1xP3)
{
if (! _MenuBlock_190419232_IDI_3)
{
_MenuBlock_190419232_IDI_3 = 1;
if(_tempVariable_bool)
{
_menuDirectInputKeyPressEvents(0, '3');
}
}
}
else
{
_MenuBlock_190419232_IDI_3 = 0;
}
if(_mkb2C2xP1)
{
if (! _MenuBlock_190419232_IDI_4)
{
_MenuBlock_190419232_IDI_4 = 1;
if(_tempVariable_bool)
{
_menuDirectInputKeyPressEvents(0, '4');
}
}
}
else
{
_MenuBlock_190419232_IDI_4 = 0;
}
if(_mkb2C2xP2)
{
if (! _MenuBlock_190419232_IDI_5)
{
_MenuBlock_190419232_IDI_5 = 1;
if(_tempVariable_bool)
{
_menuDirectInputKeyPressEvents(0, '5');
}
}
}
else
{
_MenuBlock_190419232_IDI_5 = 0;
}
if(_mkb2C2xP3)
{
if (! _MenuBlock_190419232_IDI_6)
{
_MenuBlock_190419232_IDI_6 = 1;
if(_tempVariable_bool)
{
_menuDirectInputKeyPressEvents(0, '6');
}
}
}
else
{
_MenuBlock_190419232_IDI_6 = 0;
}
if(_mkb2C3xP1)
{
if (! _MenuBlock_190419232_IDI_7)
{
_MenuBlock_190419232_IDI_7 = 1;
if(_tempVariable_bool)
{
_menuDirectInputKeyPressEvents(0, '7');
}
}
}
else
{
_MenuBlock_190419232_IDI_7 = 0;
}
if(_mkb2C3xP2)
{
if (! _MenuBlock_190419232_IDI_8)
{
_MenuBlock_190419232_IDI_8 = 1;
if(_tempVariable_bool)
{
_menuDirectInputKeyPressEvents(0, '8');
}
}
}
else
{
_MenuBlock_190419232_IDI_8 = 0;
}
if(_mkb2C3xP3)
{
if (! _MenuBlock_190419232_IDI_9)
{
_MenuBlock_190419232_IDI_9 = 1;
if(_tempVariable_bool)
{
_menuDirectInputKeyPressEvents(0, '9');
}
}
}
else
{
_MenuBlock_190419232_IDI_9 = 0;
}
if((!_bounseInput24O))
{
if (! _MenuBlock_190419232_BackspaceIOS)
{
_MenuBlock_190419232_BackspaceIOS = 1;
if(_tempVariable_bool)
{
_menuDirectInputKeyPressEvents(0, '<');
}
}
}
else
{
_MenuBlock_190419232_BackspaceIOS = 0;
}
if (_k14)
{
_dispTempLength2 = ((_MenuBlock_190419232_MNO)).length();
if (_disp7oldLength > _dispTempLength2)
{
_isNeedClearDisp2 = 1;
}
_disp7oldLength = _dispTempLength2;
_lcd2.setCursor(int((20 - _dispTempLength2)/2), 0);
_lcd2.print((_MenuBlock_190419232_MNO));
}
else
{
if (_disp7oldLength > 0)
{
_isNeedClearDisp2 = 1;
_disp7oldLength = 0;
}
}
if (_k14)
{
_dispTempLength2 = ((_MenuBlock_190419232_ASO_2)).length();
if (_disp11oldLength > _dispTempLength2)
{
_isNeedClearDisp2 = 1;
}
_disp11oldLength = _dispTempLength2;
_lcd2.setCursor(int((20 - _dispTempLength2)/2), 3);
_lcd2.print((_MenuBlock_190419232_ASO_2));
}
else
{
if (_disp11oldLength > 0)
{
_isNeedClearDisp2 = 1;
_disp11oldLength = 0;
}
}
if (_k14)
{
_dispTempLength2 = ((_MenuBlock_190419232_ASO_1)).length();
if (_disp10oldLength > _dispTempLength2)
{
_isNeedClearDisp2 = 1;
}
_disp10oldLength = _dispTempLength2;
_lcd2.setCursor(int((20 - _dispTempLength2)/2), 2);
_lcd2.print((_MenuBlock_190419232_ASO_1));
}
else
{
if (_disp10oldLength > 0)
{
_isNeedClearDisp2 = 1;
_disp10oldLength = 0;
}
}
if (_k14)
{
_dispTempLength2 = ((_MenuBlock_190419232_VNO)).length();
if (_disp9oldLength > _dispTempLength2)
{
_isNeedClearDisp2 = 1;
}
_disp9oldLength = _dispTempLength2;
_lcd2.setCursor(int((20 - _dispTempLength2)/2), 1);
_lcd2.print((_MenuBlock_190419232_VNO));
}
else
{
if (_disp9oldLength > 0)
{
_isNeedClearDisp2 = 1;
_disp9oldLength = 0;
}
}
_k15 = _MenuBlock_190419232_AMO_76417757;
_k13 = _MenuBlock_190419232_AMO_208369156;
_k16 = _MenuBlock_190419232_AMO_242574068;
if (_k15)
{
_dispTempLength2 = ((((String("*Temp ")) + (String(" ENGINE ")) + ((String((map(((analogRead (0))), (115), (953), (80), (-24))), DEC)))))).length();
if (_disp13oldLength > _dispTempLength2)
{
_isNeedClearDisp2 = 1;
}
_disp13oldLength = _dispTempLength2;
_lcd2.setCursor(0, 2);
_lcd2.print((((String("*Temp ")) + (String(" ENGINE ")) + ((String((map(((analogRead (0))), (115), (953), (80), (-24))), DEC))))));
}
else
{
if (_disp13oldLength > 0)
{
_isNeedClearDisp2 = 1;
_disp13oldLength = 0;
}
}
if (_k15)
{
_dispTempLength2 = ((((String("*Temp ")) + (String("OUTSIDE ")) + ((String((map(((analogRead (1))), (0), (1023), (80), (-24))), DEC)))))).length();
if (_disp1oldLength > _dispTempLength2)
{
_isNeedClearDisp2 = 1;
}
_disp1oldLength = _dispTempLength2;
_lcd2.setCursor(0, 3);
_lcd2.print((((String("*Temp ")) + (String("OUTSIDE ")) + ((String((map(((analogRead (1))), (0), (1023), (80), (-24))), DEC))))));
}
else
{
if (_disp1oldLength > 0)
{
_isNeedClearDisp2 = 1;
_disp1oldLength = 0;
}
}
if (_k15)
{
_dispTempLength2 = ((((String("*Press ")) + (String("OUTSIDE ")) + ((String((map(((analogRead (2))), (0), (1023), (100), (1))), DEC)))))).length();
if (_disp3oldLength > _dispTempLength2)
{
_isNeedClearDisp2 = 1;
}
_disp3oldLength = _dispTempLength2;
_lcd2.setCursor(0, 1);
_lcd2.print((((String("*Press ")) + (String("OUTSIDE ")) + ((String((map(((analogRead (2))), (0), (1023), (100), (1))), DEC))))));
}
else
{
if (_disp3oldLength > 0)
{
_isNeedClearDisp2 = 1;
_disp3oldLength = 0;
}
}
if (_k13)
{
_dispTempLength2 = (((String(((_count1_Value)/(6UL)), DEC)))).length();
if (_disp12oldLength > _dispTempLength2)
{
_isNeedClearDisp2 = 1;
}
_disp12oldLength = _dispTempLength2;
_lcd2.setCursor(int((20 - _dispTempLength2)/2), 3);
_lcd2.print(((String(((_count1_Value)/(6UL)), DEC))));
}
else
{
if (_disp12oldLength > 0)
{
_isNeedClearDisp2 = 1;
_disp12oldLength = 0;
}
}
if (((_k16) &&(_k9)))
{
_dispTempLength2 = (String("ALARM")).length();
if (_disp4oldLength > _dispTempLength2)
{
_isNeedClearDisp2 = 1;
}
_disp4oldLength = _dispTempLength2;
_lcd2.setCursor(int((20 - _dispTempLength2)/2), 1);
_lcd2.print(String("ALARM"));
}
else
{
if (_disp4oldLength > 0)
{
_isNeedClearDisp2 = 1;
_disp4oldLength = 0;
}
}
En_100557512_2 = _k16;
if (En_100557512_2)
{
extern int __bss_end;
extern int *__brkval;
if((int)__brkval == 0)
{
FreeRAM_100557512_2 = ((int)&FreeRAM_100557512_2) - ((int)&__bss_end);
}
else
{
FreeRAM_100557512_2 = ((int)&FreeRAM_100557512_2) - ((int)__brkval);
}
}
if (_k16)
{
_dispTempLength2 = (((String(FreeRAM_100557512_2, DEC)))).length();
if (_disp5oldLength > _dispTempLength2)
{
_isNeedClearDisp2 = 1;
}
_disp5oldLength = _dispTempLength2;
_lcd2.setCursor(int((20 - _dispTempLength2)/2), 2);
_lcd2.print(((String(FreeRAM_100557512_2, DEC))));
}
else
{
if (_disp5oldLength > 0)
{
_isNeedClearDisp2 = 1;
_disp5oldLength = 0;
}
}
if (_k16)
{
_dispTempLength2 = ((_RTC1_GetTime2_StrOut)).length();
if (_disp2oldLength > _dispTempLength2)
{
_isNeedClearDisp2 = 1;
}
_disp2oldLength = _dispTempLength2;
_lcd2.setCursor(int((20 - _dispTempLength2)/2), 3);
_lcd2.print((_RTC1_GetTime2_StrOut));
}
else
{
if (_disp2oldLength > 0)
{
_isNeedClearDisp2 = 1;
_disp2oldLength = 0;
}
}
//Плата:5
//Наименование:Напрацювання мотогодин
bool _bounceTmpD2 = _k4;
if (_bounse2S)
{
if (millis() >= (_bounse2P + 40))
{
_bounse2O= _bounceTmpD2;
_bounse2S=0;
}
}
else
{
if (_bounceTmpD2 != _bounse2O)
{
_bounse2S=1;
_bounse2P = millis();
}
}
if (_changeNumber2_Out)
{
_changeNumber2_Out = 0;
}
else
{
_tempVariable_byte = _RTC1_GetTime2_SecOut;
if (_tempVariable_byte != _changeNumber2_OLV)
{
_changeNumber2_OLV = _tempVariable_byte;
_changeNumber2_Out = 1;
}
}
_FreeLog2_IArr[0] = _bounse2O;
_FreeLog2_IArr[1] = _changeNumber2_Out;
_FreeLog2_Q1 = _checkFreeLogicBlockOutput(_FreeLog2_IArr, 2, _FreeLog2_Q1_StArr, 2);
if (0)
{
_count1_Value = (readUnsignedLongFromEEPROM(17, 0, 0x0));
}
else
{
if (_ktim6)
{
_count1_Value = 0;
}
else
{
if (_FreeLog2_Q1)
{
if (! _count1I)
{
_count1I = 1;
_count1_Value = _count1_Value + 1;
}
}
else
{
_count1I = 0;
}
}
}
_Terminal_75228380 = (String(((_count1_Value)/(6UL)), DEC));
if(1)
{
if(!_SEEPR2OSN)
{
(updateUnsignedLongToEEPROM(17, 0, 0x0, (_count1_Value)));
_SEEPR2OSN=1;
}
}
else
{
if(_SEEPR2OSN)
{
_SEEPR2OSN=0;
}
}
//Плата:6
_Terminal_267138007 = (map(((analogRead (0))), (115), (953), (80), (-24)));
_tempVariable_String = ((String("*Temp ")) + (String(" ENGINE ")) + ((String((map(((analogRead (0))), (115), (953), (80), (-24))), DEC))));
_convertStringToNamberOutput_5 = strtol(_tempVariable_String.c_str(),NULL,10);
_Terminal_83519677 = ((String("*Temp ")) + (String(" ENGINE ")) + ((String((map(((analogRead (0))), (115), (953), (80), (-24))), DEC))));
_Terminal_91363471 = ((String("*Temp ")) + (String("OUTSIDE ")) + ((String((map(((analogRead (1))), (0), (1023), (80), (-24))), DEC))));
_Terminal_167380666 = ((String("*Press ")) + (String("OUTSIDE ")) + ((String((map(((analogRead (2))), (0), (1023), (100), (1))), DEC))));
//Плата:7
//Наименование:Нереалізоване
//Комментарии:Те що потрібно доробити в майбутньому для версії 2.0
}
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));
}
}
String _readStringFromProgmem (char *string)
{
String result = String("");
while (pgm_read_byte(string)!='\0')
{
result=result+ char(pgm_read_byte(string));
string++;
}
return result;
}
void _menuUpEvents (int menuIndex)
{
(_MainMenus[menuIndex]).tempString = "";
int tempIndex = pgm_read_byte(&_menuParametrsArray[((_MainMenus[menuIndex]).currentItem).startInArrayIndex]);
int parIndex = pgm_read_byte(&_menuParametrsArray[ (((_MainMenus[menuIndex]).currentItem).startInArrayIndex)+5]);
int parentStartIndex;
int parentStopIndex;
if (parIndex == 0)
{
parentStartIndex = (_MainMenus[menuIndex]).startIndex;
parentStopIndex =(_MainMenus[menuIndex]).stopIndex;
}
else
{
parentStartIndex = pgm_read_byte(&_menuParametrsArray[((_MenuItems[parIndex - 1]).startInArrayIndex)+3]);
parentStopIndex = pgm_read_byte(&_menuParametrsArray[((_MenuItems[parIndex-1]).startInArrayIndex)+4]);
}
if (tempIndex == parentStartIndex)
{
if((_MainMenus[menuIndex]).isSwitchMenuAroundRing)
{
(_MainMenus[menuIndex]).currentItem = _MenuItems[parentStopIndex -1];
return;
}
else
{
return;
}
}
(_MainMenus[menuIndex]).currentItem = _MenuItems[tempIndex - 2];
return;
}
void _menuDownEvents (int menuIndex)
{
(_MainMenus[menuIndex]).tempString = "";
int tempIndex = pgm_read_byte(&_menuParametrsArray[((_MainMenus[menuIndex]).currentItem).startInArrayIndex]);
int parIndex = pgm_read_byte(&_menuParametrsArray[(((_MainMenus[menuIndex]).currentItem).startInArrayIndex)+5]);
int parentStartIndex;
int parentStopIndex;
if (parIndex == 0)
{
parentStartIndex = (_MainMenus[menuIndex]).startIndex;
parentStopIndex =(_MainMenus[menuIndex]).stopIndex;
}
else
{
parentStartIndex = pgm_read_byte(&_menuParametrsArray[((_MenuItems[parIndex-1]).startInArrayIndex)+3]);
parentStopIndex = pgm_read_byte(&_menuParametrsArray[((_MenuItems[parIndex-1]).startInArrayIndex)+4]);
}
if (tempIndex == parentStopIndex)
{
if((_MainMenus[menuIndex]).isSwitchMenuAroundRing)
{
(_MainMenus[menuIndex]).currentItem = _MenuItems[parentStartIndex -1];
return;
}
else
{
return;
}
}
(_MainMenus[menuIndex]).currentItem = _MenuItems[tempIndex];
return;
}
void _valueUpEvents (int menuIndex)
{
int valIndex = pgm_read_byte(&_menuParametrsArray[(((_MainMenus[menuIndex]).currentItem).startInArrayIndex)+2]);
int itemType = pgm_read_byte(&_menuParametrsArray[(((_MainMenus[menuIndex]).currentItem).startInArrayIndex)+1]);
int indexMax = pgm_read_byte(&_menuParametrsArray[(((_MainMenus[menuIndex]).currentItem).startInArrayIndex)+6]);
int indexStep = pgm_read_byte(&_menuParametrsArray[(((_MainMenus[menuIndex]).currentItem).startInArrayIndex)+8]);
if (itemType == 3)
{
if (! indexMax == 0)
{
if (! (int(pgm_read_word(&_menuConstantValuesArray_int[indexMax -1])) > int(_menuValueArray_int[valIndex -1])))
{
return;
}
}
_menuValueArray_int[valIndex -1] = _menuValueArray_int[valIndex -1] + (pgm_read_word(&_menuConstantValuesArray_int[indexStep -1]));
}
}
void _valueDownEvents (int menuIndex)
{
int valIndex = pgm_read_byte(&_menuParametrsArray[(((_MainMenus[menuIndex]).currentItem).startInArrayIndex)+2]);
int itemType = pgm_read_byte(&_menuParametrsArray[(((_MainMenus[menuIndex]).currentItem).startInArrayIndex)+1]);
int indexMin = pgm_read_byte(&_menuParametrsArray[(((_MainMenus[menuIndex]).currentItem).startInArrayIndex)+7]);
int indexStep = pgm_read_byte(&_menuParametrsArray[(((_MainMenus[menuIndex]).currentItem).startInArrayIndex)+8]);
if (itemType == 3)
{
if (! indexMin == 0)
{
if (! ((int(pgm_read_word(&_menuConstantValuesArray_int[indexMin - 1]))) < int(_menuValueArray_int[valIndex - 1])))
{
return;
}
}
_menuValueArray_int[valIndex - 1] = _menuValueArray_int[valIndex - 1] - (pgm_read_word(&_menuConstantValuesArray_int[indexStep - 1]));
}
}
void _menuEnterTheMenuEvents (int menuIndex)
{
int itemType = pgm_read_byte(&_menuParametrsArray[(((_MainMenus[menuIndex]).currentItem).startInArrayIndex)+1]);
if(!(itemType == 0))
{
return;
}
int tempIndex = pgm_read_byte(&_menuParametrsArray[((_MainMenus[menuIndex]).currentItem).startInArrayIndex]);
int newIndex = pgm_read_byte(&_menuParametrsArray[((_MenuItems[tempIndex - 1]).startInArrayIndex)+3]);
if(newIndex == 0)
{
return;
}
(_MainMenus[menuIndex]).tempString = "";
(_MainMenus[menuIndex]).currentItem = _MenuItems[newIndex - 1];
return;
}
void _menuExitFromMenuEvents (int menuIndex)
{
int parIndex = pgm_read_byte(&_menuParametrsArray[(((_MainMenus[menuIndex]).currentItem).startInArrayIndex)+5]);
if(parIndex == 0)
{
return;
}
(_MainMenus[menuIndex]).tempString = "";
(_MainMenus[menuIndex]).currentItem = _MenuItems[parIndex - 1];
return;
}
String _menuOutputValueString (int menuIndex)
{
int itemType = pgm_read_byte(&_menuParametrsArray[ (((_MainMenus[menuIndex]).currentItem).startInArrayIndex)+1]);
int valueStrIndex = pgm_read_byte(&_menuParametrsArray[(((_MainMenus[menuIndex]).currentItem).startInArrayIndex)+11]);
if(itemType == 0)
{
if(valueStrIndex == 0)
{
return "";
}
}
int valIndex = pgm_read_byte(&_menuParametrsArray[(((_MainMenus[menuIndex]).currentItem).startInArrayIndex)+2]);
int indexMin = pgm_read_byte(&_menuParametrsArray[(((_MainMenus[menuIndex]).currentItem).startInArrayIndex)+7]);
int indexMax = pgm_read_byte(&_menuParametrsArray[(((_MainMenus[menuIndex]).currentItem).startInArrayIndex)+6]);
if(valIndex == 0)
{
return "";
}
int convFormat = pgm_read_byte(&_menuParametrsArray[(((_MainMenus[menuIndex]).currentItem).startInArrayIndex)+9]);
if(itemType == 3)
{
return _convertNamber(itemType, convFormat, valIndex, indexMax, indexMin);
}
return "";
}
void _menuDirectInputKeyPressEvents(int menuIndex, char inputSymbol)
{
int valIndex = pgm_read_byte(&_menuParametrsArray[(((_MainMenus[menuIndex]).currentItem).startInArrayIndex)+2]);
int temp;
if(valIndex == 0)
{
return;
}
int itemType = pgm_read_byte(&_menuParametrsArray[(((_MainMenus[menuIndex]).currentItem).startInArrayIndex)+1]);
if(itemType == 5)
{
return;
}
if(inputSymbol == '<')
{
temp = ((_MainMenus[menuIndex]).tempString).length();
if(temp == 0)
{
return;
}
else
{
if(temp == 1)
{
(_MainMenus[menuIndex]).tempString ="";
}
else
{
(_MainMenus[menuIndex]).tempString = ((_MainMenus[menuIndex]).tempString).substring(0, temp - 1);
}
}
}
else
{
(_MainMenus[menuIndex]).tempString = (_MainMenus[menuIndex]).tempString + inputSymbol;
}
if(itemType == 3)
{
_menuValueArray_int[valIndex - 1] = (((_MainMenus[menuIndex]).tempString)).toInt();
temp = pgm_read_byte(&_menuParametrsArray[(((_MainMenus[menuIndex]).currentItem).startInArrayIndex)+6]);
if (temp != 0)
{
if ((_menuValueArray_int[valIndex - 1]) > (pgm_read_word(&_menuConstantValuesArray_int[temp - 1])))
{
_menuValueArray_int[valIndex - 1] = (pgm_read_word(&_menuConstantValuesArray_int[temp - 1]));(_MainMenus[menuIndex]).tempString = "";
}
}
}
}
void _menuUpdateToEEpromItems()
{
(updateIntegerToEEPROM(1, 0, 0x0, ((_menuValueArray_int[0]))));
(updateIntegerToEEPROM(3, 0, 0x0, ((_menuValueArray_int[1]))));
(updateIntegerToEEPROM(5, 0, 0x0, ((_menuValueArray_int[2]))));
(updateIntegerToEEPROM(7, 0, 0x0, ((_menuValueArray_int[3]))));
(updateIntegerToEEPROM(9, 0, 0x0, ((_menuValueArray_int[4]))));
(updateIntegerToEEPROM(11, 0, 0x0, ((_menuValueArray_int[5]))));
(updateIntegerToEEPROM(13, 0, 0x0, ((_menuValueArray_int[6]))));
(updateIntegerToEEPROM(15, 0, 0x0, ((_menuValueArray_int[7]))));
}
String _convertNamber(int itemType, int convFormat, int valIndex, int indexMax, int indexMin)
{
if (itemType== 3)
{
if (convFormat == 4)
{
return String((_menuValueArray_int[valIndex - 1 ]),DEC);
}
if (convFormat == 5)
{
return String((_menuValueArray_int[valIndex - 1]),HEX);
}
if (convFormat == 6)
{
return String((_menuValueArray_int[valIndex -1]),BIN);
}
}
return "";
}
bool _checkFreeLogicBlockOutput(bool inArray[], int inArraySize, bool stArray[], int stArraySize)
{
int inIndex = 0;
bool result = 1;
for (int i = 0; i < stArraySize; i = i + 1)
{
if (!(inArray[inIndex] == stArray[i]))
{
result = 0;
}
inIndex ++;
if (inIndex == inArraySize)
{
if (result)
{
return 1;
}
else
{
result = 1;
}
inIndex = 0;
}
}
return 0;
}
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);
}
int readIntegerFromEEPROM(int addres, byte bitAddres, byte chipAddres)
{
byte hight = readByteFromEEPROM(addres, bitAddres, chipAddres);
byte low = readByteFromEEPROM((addres+1), bitAddres, chipAddres);
return word(hight, low);
}
void updateIntegerToEEPROM(int addres, byte bitAddres, byte chipAddres, int value)
{
updateByteToEEPROM(addres, bitAddres, chipAddres, highByte(value));
updateByteToEEPROM((addres+1), bitAddres, chipAddres, lowByte(value));
}
unsigned long readUnsignedLongFromEEPROM(int addres, byte bitAddres, byte chipAddres)
{
byte x[4];
for(byte i = 0; i < 4; i++)
{
x[i] = readByteFromEEPROM((addres+i), bitAddres, chipAddres);
}
unsigned long *y = (unsigned long *)&x;
return y[0];
}
void updateUnsignedLongToEEPROM(int addres, byte bitAddres, byte chipAddres, unsigned long value)
{
byte *x = (byte *)&value;
for(byte i = 0; i < 4; i++)
{
updateByteToEEPROM((addres+i), bitAddres, chipAddres, x[i]);
}
}
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));
}
timeStruct ->startTime = millis();
}
String _convertRealTimeClockNumberToString(byte value)
{
if (value > 9)
{
return String(value, DEC);
}
return (String("0") + String(value, DEC));
}