#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <Encoder.h>
#include <EEPROM.h>
LiquidCrystal_I2C _lcd1(0x27, 16, 2);
int _dispTempLength1=0;
boolean _isNeedClearDisp1;
struct UB_171563729
{
String ubo_136218795 = "";
bool ubo_240660080 = 0;
bool ubo_157914509 = 0;
bool _gtv1 = 0;
bool _gtv2 = 0;
bool _count1I = 0;
unsigned long _count1_Value = 0UL;
bool _gen1I = 0;
bool _gen1O = 0;
unsigned long _gen1P = 0UL;
bool _trgs1 = 0;
bool _trgs2 = 0;
bool _trgs3 = 0;
}
;
UB_171563729 UB_171563729_Instance1;
long UB_171563729_ubi_108673896 = 0L;
long UB_171563729_ubi_91013910 = 0L;
bool UB_171563729_ubi_197128335 = 0;
bool UB_171563729_ubi_79516391 = 0;
bool Zero;
bool Key;
bool Menu;
bool Short;
bool Long;
int PIN;
bool Plus;
bool Minus;
Encoder myEnc(2 , 3);
long newPosition;
long oldPosition= -999;
bool oldkey;
bool K_FL;
unsigned long oldtime;
unsigned long deltatime;
unsigned long keytime;
unsigned long detect;
struct _poligonInexes
{
int minIndex;
int maxIndex;
}
;
int _Poligon_InArray_1[158] = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 48, 49, 50, 51, 53, 54, 56, 57, 58, 60, 62, 63, 65, 67, 68, 70, 72, 74, 76, 78, 80, 83, 85, 87, 90, 92, 95, 98, 100, 103, 106, 109, 112, 115, 119, 122, 125, 129, 133, 137, 141, 145, 149, 153, 158, 162, 167, 172, 177, 182, 187, 192, 198, 204, 210, 216, 222, 228, 235, 241, 248, 255, 263, 270, 278, 286, 294, 302, 310, 319, 327, 336, 345, 354, 364, 373, 383, 393, 403, 413, 424, 434, 445, 456, 467, 478, 489, 500, 512, 523, 534, 546, 557, 569, 581, 592, 604, 615, 627, 639, 650, 661, 673, 684, 695, 706, 728, 738, 749, 759, 769, 779, 788};
int _Poligon_OutArray_1[158] = {273, 249, 232, 219, 209, 201, 194, 188, 182, 178, 173, 169, 166, 163, 160, 157, 154, 152, 149, 147, 145, 143, 141, 140, 138, 136, 135, 133, 132, 130, 129, 128, 127, 125, 124, 123, 122, 121, 120, 119, 118, 117, 116, 115, 114, 113, 112, 111, 110, 109, 108, 107, 106, 105, 104, 103, 102, 101, 100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 6, 5, 4, 3, 2, 1, 0};
const int _menuParametrsArray[] PROGMEM = {1, 0, 0, 3, 4, 0, 0, 0, 0, 0, 7, 0, 25, 26, 13, 14, 2, 0, 0, 7, 8, 0, 0, 0, 0, 0, 10, 0, 30, 16, 14, 14, 3, 0, 0, 5, 5, 1, 0, 0, 0, 0, 4, 0, 20, 21, 13, 14, 4, 0, 0, 6, 6, 1, 0, 0, 0, 0, 8, 0, 27, 16, 14, 14, 5, 4, 1, 0, 0, 3, 2, 6, 1, 4, 2, 0, 15, 16, 17, 13, 6, 4, 3, 0, 0, 4, 4, 1, 1, 4, 6, 0, 23, 16, 24, 13, 7, 0, 0, 9, 9, 2, 0, 0, 0, 0, 1, 0, 11, 12, 13, 14, 8, 0, 0, 10, 10, 2, 0, 0, 0, 0, 5, 0, 22, 16, 14, 14, 9, 4, 4, 0, 0, 7, 5, 7, 1, 4, 9, 0, 28, 16, 29, 13, 10, 4, 2, 0, 0, 8, 3, 7, 1, 4, 3, 0, 18, 16, 19, 13};
int _menuValueArray_int[4];
const int _menuConstantValuesArray_int[] PROGMEM = {1, 99, 59, 10, 23, 20, 0};
const char _flprogMenuNameString1[] PROGMEM = "ЧАСЫ";
const char _flprogMenuNameString2[] PROGMEM = "Редактирование температуры";
const char _flprogMenuNameString3[] PROGMEM = "Редактирование минут";
const char _flprogMenuNameString4[] PROGMEM = "Температура";
const char _flprogMenuNameString5[] PROGMEM = "минуты";
const char _flprogMenuNameString6[] PROGMEM = "Редактирование гестерезиса";
const char _flprogMenuNameString7[] PROGMEM = "Voda";
const char _flprogMenuNameString8[] PROGMEM = "Гестерезис";
const char _flprogMenuNameString9[] PROGMEM = "Редактирование часов";
const char _flprogMenuNameString10[] PROGMEM = "Vrevy";
const char _flprogMenuNameString11[] PROGMEM = ">chasy";
const char _flprogMenuNameString12[] PROGMEM = "Minuty";
const char _flprogMenuNameString13[] PROGMEM = "1";
const char _flprogMenuNameString14[] PROGMEM = "0";
const char _flprogMenuNameString15[] PROGMEM = "<Temperatura>";
const char _flprogMenuNameString16[] PROGMEM = "--";
const char _flprogMenuNameString17[] PROGMEM = "2";
const char _flprogMenuNameString18[] PROGMEM = "<Minuty>";
const char _flprogMenuNameString19[] PROGMEM = "5";
const char _flprogMenuNameString20[] PROGMEM = ">Temperatura";
const char _flprogMenuNameString21[] PROGMEM = "Gesterezis";
const char _flprogMenuNameString22[] PROGMEM = ">Minuty";
const char _flprogMenuNameString23[] PROGMEM = "<Gesterezis>";
const char _flprogMenuNameString24[] PROGMEM = "3";
const char _flprogMenuNameString25[] PROGMEM = ">Voda";
const char _flprogMenuNameString26[] PROGMEM = "Vremy";
const char _flprogMenuNameString27[] PROGMEM = ">Gesterezis";
const char _flprogMenuNameString28[] PROGMEM = "<Chasy>";
const char _flprogMenuNameString29[] PROGMEM = "4";
const char _flprogMenuNameString30[] PROGMEM = ">Vremy";
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, _flprogMenuNameString27, _flprogMenuNameString28, _flprogMenuNameString29, _flprogMenuNameString30};
struct _menuItemStricture
{
int startInArrayIndex;
}
;
struct _menuMainStricture
{
int startIndex;
int stopIndex;
bool isSwitchMenuAroundRing;
_menuItemStricture currentItem;
}
;
_menuItemStricture _MenuItems[10];
_menuMainStricture _MainMenus[1];
bool _gtv1;
bool _gtv2;
bool _gtv3;
bool _gtv4;
bool _gtv5;
long _gtv6;
bool _gtv7;
bool _gtv8;
String _gtv9;
String _gtv10;
String _gtv11;
String _gtv12;
bool _gtv13;
bool _gtv15;
bool _gtv16;
bool _gtv17;
bool _trgrt5 = 0;
bool _trgrt5I = 0;
bool _tim1I = 0;
bool _tim1O = 0;
unsigned long _tim1P = 0UL;
int _disp1oldLength = 0;
bool _trgrt2 = 0;
bool _trgrt2I = 0;
int _disp7oldLength = 0;
int _disp3oldLength = 0;
bool _tim2I = 0;
bool _tim2O = 0;
unsigned long _tim2P = 0UL;
bool _tim3I = 0;
bool _tim3O = 0;
unsigned long _tim3P = 0UL;
int _disp6oldLength = 0;
bool _tim6I = 0;
bool _tim6O = 0;
unsigned long _tim6P = 0UL;
bool _trgs2 = 0;
String _MenuBlock_66013880_ASO_1;
String _MenuBlock_66013880_ASO_2;
String _MenuBlock_66013880_ASO_3;
String _MenuBlock_66013880_ASO_4;
String _MenuBlock_66013880_MNO;
String _MenuBlock_66013880_VNO;
bool _MenuBlock_66013880_OEIS = 0;
bool _MenuBlock_66013880_OMUIS = 0;
bool _MenuBlock_66013880_OMDIS = 0;
bool _MenuBlock_66013880_OEMIS = 0;
bool _MenuBlock_66013880_OExFMIS = 0;
bool _MenuBlock_66013880_OVUIS = 0;
bool _MenuBlock_66013880_OVDIS = 0;
bool _MenuBlock_66013880_AMMO = 0;
bool _bounseInputD6S = 0;
bool _bounseInputD6O = 0;
unsigned long _bounseInputD6P = 0UL;
String _swi2;
int _disp5oldLength = 0;
bool _gen1I = 0;
bool _gen1O = 0;
unsigned long _gen1P = 0UL;
bool _bounseInputD9S = 0;
bool _bounseInputD9O = 0;
unsigned long _bounseInputD9P = 0UL;
int _convertStringToNamberOutput_1 = 0;
bool _trgrt1 = 0;
bool _trgrt1I = 0;
int _disp8oldLength = 0;
bool _trgrt3 = 0;
bool _trgrt3I = 0;
int _disp2oldLength = 0;
bool _bounseInputD8S = 0;
bool _bounseInputD8O = 0;
unsigned long _bounseInputD8P = 0UL;
bool _trgrt4 = 0;
bool _trgrt4I = 0;
bool _trgs1 = 0;
bool _gen2I = 0;
bool _gen2O = 0;
unsigned long _gen2P = 0UL;
int _disp4oldLength = 0;
String _mux1;
bool _tempVariable_bool;
String _tempVariable_String;
int _tempVariable_int;
void setup()
{
pinMode(6, INPUT_PULLUP);
pinMode(8, INPUT_PULLUP);
pinMode(9, INPUT_PULLUP);
pinMode(7, OUTPUT);
digitalWrite(7, 0);
pinMode(12, OUTPUT);
digitalWrite(12, 0);
Wire.begin();
delay(10);
if(((readByteFromEEPROM(0, 0, 0x0))) != 201)
{
(updateByteToEEPROM(0, 0, 0x0, (201)));
(updateIntegerToEEPROM(1, 0, 0x0, (50)));
(updateIntegerToEEPROM(3, 0, 0x0, (0)));
(updateIntegerToEEPROM(5, 0, 0x0, (2)));
(updateIntegerToEEPROM(7, 0, 0x0, (0)));
}
_lcd1.init();
_lcd1.backlight();
_bounseInputD8O = digitalRead(8);
_bounseInputD6O = digitalRead(6);
_bounseInputD9O = digitalRead(9);
oldkey=false;
oldtime=0;
_MenuItems[0].startInArrayIndex = 0;
_MenuItems[1].startInArrayIndex = 16;
_MenuItems[2].startInArrayIndex = 32;
_MenuItems[3].startInArrayIndex = 48;
_MenuItems[4].startInArrayIndex = 64;
_MenuItems[5].startInArrayIndex = 80;
_MenuItems[6].startInArrayIndex = 96;
_MenuItems[7].startInArrayIndex = 112;
_MenuItems[8].startInArrayIndex = 128;
_MenuItems[9].startInArrayIndex = 144;
_MainMenus[0].startIndex = 1;
_MainMenus[0].isSwitchMenuAroundRing = 1;
_MainMenus[0].stopIndex = 2;
_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));
}
void loop()
{
if (_isNeedClearDisp1)
{
_lcd1.clear();
_isNeedClearDisp1= 0;
}
bool _bounceInputTmpD9 = (digitalRead (9));
if (_bounseInputD9S)
{
if (millis() >= (_bounseInputD9P + 40))
{
_bounseInputD9O= _bounceInputTmpD9;
_bounseInputD9S=0;
}
}
else
{
if (_bounceInputTmpD9 != _bounseInputD9O)
{
_bounseInputD9S=1;
_bounseInputD9P = millis();
}
}
bool _bounceInputTmpD6 = (digitalRead (6));
if (_bounseInputD6S)
{
if (millis() >= (_bounseInputD6P + 40))
{
_bounseInputD6O= _bounceInputTmpD6;
_bounseInputD6S=0;
}
}
else
{
if (_bounceInputTmpD6 != _bounseInputD6O)
{
_bounseInputD6S=1;
_bounseInputD6P = millis();
}
}
bool _bounceInputTmpD8 = (digitalRead (8));
if (_bounseInputD8S)
{
if (millis() >= (_bounseInputD8P + 40))
{
_bounseInputD8O= _bounceInputTmpD8;
_bounseInputD8S=0;
}
}
else
{
if (_bounceInputTmpD8 != _bounseInputD8O)
{
_bounseInputD8S=1;
_bounseInputD8P = millis();
}
}
//Плата:1
//Наименование:старт
if (!(0))
{
if (! _gen1I)
{
_gen1I = 1;
_gen1O = 1;
_gen1P = millis();
}
}
else
{
_gen1I = 0 ;
_gen1O= 0;
}
if (_gen1I && _gen1O) _gen1O = !(_isTimer(_gen1P , 2000));
_gtv1 = _gen1O;
if (_gtv1)
{
_dispTempLength1 = (String("MOY PROEKT")).length();
if (_disp1oldLength > _dispTempLength1)
{
_isNeedClearDisp1 = 1;
}
_disp1oldLength = _dispTempLength1;
_lcd1.setCursor(int((16 - _dispTempLength1)/2), 0);
_lcd1.print(String("MOY PROEKT"));
}
else
{
if (_disp1oldLength > 0)
{
_isNeedClearDisp1 = 1;
_disp1oldLength = 0;
}
}
if (_gtv1)
{
_dispTempLength1 = (String(" ")).length();
if (_disp2oldLength > _dispTempLength1)
{
_isNeedClearDisp1 = 1;
}
_disp2oldLength = _dispTempLength1;
_lcd1.setCursor(int((16 - _dispTempLength1)/2), 1);
_lcd1.print(String(" "));
}
else
{
if (_disp2oldLength > 0)
{
_isNeedClearDisp1 = 1;
_disp2oldLength = 0;
}
}
//Плата:2
//Наименование:плата энкодера
Zero = 0;
Key = !(_bounseInputD6O);
Menu = _gtv7;
newPosition = myEnc.read();
if (newPosition != oldPosition)
{
oldPosition = newPosition;
}
if (Zero == 1)
{
myEnc.write(0);
}
PIN= newPosition/4;
if (Key !=oldkey)
{
oldkey = Key;
if (Key)
{
Short = 0;
Long = 0;
K_FL=1;
oldtime=millis();
}
else
{
if (K_FL)
{
Short=1;
keytime=millis();
K_FL=0;
}
}
}
if ((Key)and (!Long) and (K_FL))
{
if ((millis()-oldtime)>= 600)
{
Long = 1;
keytime=millis();
K_FL=0;
}
}
if ((Short)or(Long))
{
deltatime=millis()-keytime;
if (deltatime> 100)
{
Short =0;
Long =0;
K_FL=0;
}
}
//Вычисление плюса и минуса
if(Menu)
{
if(newPosition>=4)
{
Plus=1;
myEnc.write(0);
}
if(newPosition<=-4)
{
Minus=1;
myEnc.write(0);
}
if(newPosition>-3&&newPosition<3)
{
Plus=0;
Minus=0;
}
}
_gtv3 = Minus;
_gtv2 = Plus;
_gtv6 = PIN;
_gtv4 = Long;
_gtv5 = Short;
//Плата:3
//Наименование:плата меню
if (((_gtv4) && (!(_gtv7))))
{
if (_trgrt3I)
{
_trgrt3 = 0;
}
else
{
_trgrt3 = 1;
_trgrt3I = 1;
}
}
else
{
_trgrt3 = 0;
_trgrt3I = 0;
}
;
if (((_gtv4) && (_gtv7) && (_gtv8)))
{
if (_trgrt4I)
{
_trgrt4 = 0;
}
else
{
_trgrt4 = 1;
_trgrt4I = 1;
}
}
else
{
_trgrt4 = 0;
_trgrt4I = 0;
}
;
if(_trgrt3) _trgs1 = 1;
if(_trgrt4) _trgs1 = 0;
if (_trgs1)
{
_tempVariable_bool = 1;
if (! _MenuBlock_66013880_OEIS)
{
_MenuBlock_66013880_OEIS = 1;
}
_tempVariable_int = pgm_read_byte(&_menuParametrsArray[((_MainMenus[0].currentItem).startInArrayIndex)+10]);
_MenuBlock_66013880_MNO = _readStringFromProgmem ((char*)pgm_read_word(&(_flprogMenuStringsArray[_tempVariable_int - 1])));
_MenuBlock_66013880_VNO = _menuOutputValueString (0);
_MenuBlock_66013880_AMMO = (pgm_read_byte(&_menuParametrsArray[((_MainMenus[0].currentItem).startInArrayIndex)+5])) == 0;
_tempVariable_int = pgm_read_byte(&_menuParametrsArray[(((_MainMenus[0]).currentItem).startInArrayIndex) +12]);
if(_tempVariable_int == 0)
{
_MenuBlock_66013880_ASO_1 = "";
}
else
{
_MenuBlock_66013880_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_66013880_ASO_2 = "";
}
else
{
_MenuBlock_66013880_ASO_2 = _readStringFromProgmem ((char*)pgm_read_word(&(_flprogMenuStringsArray[_tempVariable_int - 1])));
}
_tempVariable_int = pgm_read_byte(&_menuParametrsArray[(((_MainMenus[0]).currentItem).startInArrayIndex) +14]);
if(_tempVariable_int == 0)
{
_MenuBlock_66013880_ASO_3 = "";
}
else
{
_MenuBlock_66013880_ASO_3 = _readStringFromProgmem ((char*)pgm_read_word(&(_flprogMenuStringsArray[_tempVariable_int - 1])));
}
_tempVariable_int = pgm_read_byte(&_menuParametrsArray[(((_MainMenus[0]).currentItem).startInArrayIndex) +15]);
if(_tempVariable_int == 0)
{
_MenuBlock_66013880_ASO_4 = "";
}
else
{
_MenuBlock_66013880_ASO_4 = _readStringFromProgmem ((char*)pgm_read_word(&(_flprogMenuStringsArray[_tempVariable_int - 1])));
}
}
else
{
_tempVariable_bool = 0;
if (_MenuBlock_66013880_OEIS)
{
_MenuBlock_66013880_OEIS = 0;
}
_MenuBlock_66013880_AMMO = 0;
_MenuBlock_66013880_ASO_1 = "";
_MenuBlock_66013880_ASO_2 = "";
_MenuBlock_66013880_ASO_3 = "";
_MenuBlock_66013880_ASO_4 = "";
_MenuBlock_66013880_MNO = "";
_MenuBlock_66013880_VNO = "";
}
if(((_gtv2) && (((_gtv12).equals(String("0"))))))
{
if (! _MenuBlock_66013880_OMUIS)
{
_MenuBlock_66013880_OMUIS = 1;
if(_tempVariable_bool)
{
_menuUpEvents(0);
}
}
}
else
{
_MenuBlock_66013880_OMUIS = 0;
}
if(((_gtv3) && (((_gtv12).equals(String("0"))))))
{
if (! _MenuBlock_66013880_OMDIS)
{
_MenuBlock_66013880_OMDIS = 1;
if(_tempVariable_bool)
{
_menuDownEvents(0);
}
}
}
else
{
_MenuBlock_66013880_OMDIS = 0;
}
if(_gtv5)
{
if (! _MenuBlock_66013880_OEMIS)
{
_MenuBlock_66013880_OEMIS = 1;
if(_tempVariable_bool)
{
_menuEnterTheMenuEvents (0);
}
}
}
else
{
_MenuBlock_66013880_OEMIS = 0;
}
if(_gtv4)
{
if (! _MenuBlock_66013880_OExFMIS)
{
_MenuBlock_66013880_OExFMIS = 1;
if(_tempVariable_bool)
{
_menuExitFromMenuEvents (0);
}
}
}
else
{
_MenuBlock_66013880_OExFMIS = 0;
}
if(((_gtv2) && (!(((_gtv12).equals(String("0")))))))
{
if (! _MenuBlock_66013880_OVUIS)
{
_MenuBlock_66013880_OVUIS = 1;
if(_tempVariable_bool)
{
_valueUpEvents(0);
_menuUpdateToEEpromItems();
}
}
}
else
{
_MenuBlock_66013880_OVUIS = 0;
}
if(((_gtv3) && (!(((_gtv12).equals(String("0")))))))
{
if (! _MenuBlock_66013880_OVDIS)
{
_MenuBlock_66013880_OVDIS = 1;
if(_tempVariable_bool)
{
_valueDownEvents(0);
_menuUpdateToEEpromItems();
}
}
}
else
{
_MenuBlock_66013880_OVDIS = 0;
}
if (_MenuBlock_66013880_AMMO)
{
if (_tim3I)
{
if (_isTimer(_tim3P, 200))
{
_tim3O = 1;
}
}
else
{
_tim3I =1;
_tim3P = millis();
}
}
else
{
_tim3O = 0;
_tim3I = 0;
}
_gtv8 = _tim3O;
_gtv12 = _MenuBlock_66013880_ASO_4;
_gtv11 = _MenuBlock_66013880_ASO_3;
_gtv10 = _MenuBlock_66013880_ASO_2;
_gtv9 = _MenuBlock_66013880_ASO_1;
if (_trgs1)
{
if (_tim1I)
{
if (_isTimer(_tim1P, 500))
{
_tim1O = 1;
}
}
else
{
_tim1I =1;
_tim1P = millis();
}
}
else
{
_tim1O = 0;
_tim1I = 0;
}
if(_tim1O)
{
_tim2O = 1;
_tim2I = 1;
}
else
{
if(_tim2I)
{
_tim2I = 0;
_tim2P = millis();
}
else
{
if (_tim2O)
{
if (_isTimer(_tim2P, 500)) _tim2O = 0;
}
}
}
_gtv7 = _tim2O;
//Плата:4
//Наименование:дисплеи
_tempVariable_String = _gtv11;
_convertStringToNamberOutput_1 = strtol(_tempVariable_String.c_str(),NULL,10);
if((_convertStringToNamberOutput_1) == 0)
{
_mux1 = String(" ");
}
if((_convertStringToNamberOutput_1) == 1)
{
_mux1 = _gtv10;
}
if((_convertStringToNamberOutput_1) == 2)
{
_mux1 = (String((_menuValueArray_int[0]), DEC));
}
if((_convertStringToNamberOutput_1) == 3)
{
_mux1 = (String((_menuValueArray_int[2]), DEC));
}
if((_convertStringToNamberOutput_1) == 4)
{
_mux1 = (String((_menuValueArray_int[3]), DEC));
}
if((_convertStringToNamberOutput_1) == 5)
{
_mux1 = (String((_menuValueArray_int[1]), DEC));
}
_gtv16 = ((!(_gtv1)) && (_gtv7));
if (((!(_gtv1)) && (_gtv7)))
{
_dispTempLength1 = ((_gtv9)).length();
if (_disp5oldLength > _dispTempLength1)
{
_isNeedClearDisp1 = 1;
}
_disp5oldLength = _dispTempLength1;
_lcd1.setCursor(0, 0);
_lcd1.print((_gtv9));
}
else
{
if (_disp5oldLength > 0)
{
_isNeedClearDisp1 = 1;
_disp5oldLength = 0;
}
}
if (((!(_gtv1)) && (_gtv7)))
{
_dispTempLength1 = ((_mux1)).length();
if (_disp6oldLength > _dispTempLength1)
{
_isNeedClearDisp1 = 1;
}
_disp6oldLength = _dispTempLength1;
_lcd1.setCursor(0, 1);
_lcd1.print((_mux1));
}
else
{
if (_disp6oldLength > 0)
{
_isNeedClearDisp1 = 1;
_disp6oldLength = 0;
}
}
//Плата:5
//Наименование:терморкгулятор
if (!(((_gtv1) || (_gtv16))))
{
_dispTempLength1 = ((((String("t")) + (String("=")) + ((String((_poligon(((analogRead (0))), _Poligon_InArray_1, _Poligon_OutArray_1, 158)), DEC))) + (String("C"))))).length();
if (_disp8oldLength > _dispTempLength1)
{
_isNeedClearDisp1 = 1;
}
_disp8oldLength = _dispTempLength1;
_lcd1.setCursor(0, 0);
_lcd1.print((((String("t")) + (String("=")) + ((String((_poligon(((analogRead (0))), _Poligon_InArray_1, _Poligon_OutArray_1, 158)), DEC))) + (String("C")))));
}
else
{
if (_disp8oldLength > 0)
{
_isNeedClearDisp1 = 1;
_disp8oldLength = 0;
}
}
if (!(((_gtv1) || (_gtv16))))
{
_dispTempLength1 = ((((String("t")) + (String("=")) + ((String((_menuValueArray_int[0]), DEC))) + (String("C"))))).length();
if (_disp7oldLength > _dispTempLength1)
{
_isNeedClearDisp1 = 1;
}
_disp7oldLength = _dispTempLength1;
_lcd1.setCursor(11, 0);
_lcd1.print((((String("t")) + (String("=")) + ((String((_menuValueArray_int[0]), DEC))) + (String("C")))));
}
else
{
if (_disp7oldLength > 0)
{
_isNeedClearDisp1 = 1;
_disp7oldLength = 0;
}
}
if (((_poligon(((analogRead (0))), _Poligon_InArray_1, _Poligon_OutArray_1, 158))) == ((_menuValueArray_int[0])))
{
if (_trgrt2I)
{
_trgrt2 = 0;
}
else
{
_trgrt2 = 1;
_trgrt2I = 1;
}
}
else
{
_trgrt2 = 0;
_trgrt2I = 0;
}
;
if (((_poligon(((analogRead (0))), _Poligon_InArray_1, _Poligon_OutArray_1, 158))) <= (((_menuValueArray_int[0]))-((_menuValueArray_int[2]))))
{
if (_trgrt1I)
{
_trgrt1 = 0;
}
else
{
_trgrt1 = 1;
_trgrt1I = 1;
}
}
else
{
_trgrt1 = 0;
_trgrt1I = 0;
}
;
if(_trgrt1) _trgs2 = 1;
if(_trgrt2) _trgs2 = 0;
_gtv13 = _trgs2;
//Плата:6
UB_171563729_ubi_108673896 = (_menuValueArray_int[3]);
UB_171563729_ubi_91013910 = (_menuValueArray_int[1]);
UB_171563729_ubi_197128335 = !(_bounseInputD8O);
UB_171563729_ubi_79516391 = !(_bounseInputD9O);
_func_UB_171563729(&UB_171563729_Instance1, UB_171563729_ubi_108673896, UB_171563729_ubi_91013910, UB_171563729_ubi_197128335, UB_171563729_ubi_79516391);
_gtv15 = UB_171563729_Instance1.ubo_157914509;
_gtv17 = UB_171563729_Instance1.ubo_240660080;
if(UB_171563729_Instance1.ubo_240660080)
{
_swi2=String("on");
}
else
{
_swi2=String("off");
}
if (!(((_gtv1) || (_gtv16))))
{
_dispTempLength1 = ((_swi2)).length();
if (_disp4oldLength > _dispTempLength1)
{
_isNeedClearDisp1 = 1;
}
_disp4oldLength = _dispTempLength1;
_lcd1.setCursor(0, 1);
_lcd1.print((_swi2));
}
else
{
if (_disp4oldLength > 0)
{
_isNeedClearDisp1 = 1;
_disp4oldLength = 0;
}
}
if (!(((_gtv1) || (_gtv16))))
{
_dispTempLength1 = ((UB_171563729_Instance1.ubo_136218795)).length();
if (_disp3oldLength > _dispTempLength1)
{
_isNeedClearDisp1 = 1;
}
_disp3oldLength = _dispTempLength1;
_lcd1.setCursor(5, 1);
_lcd1.print((UB_171563729_Instance1.ubo_136218795));
}
else
{
if (_disp3oldLength > 0)
{
_isNeedClearDisp1 = 1;
_disp3oldLength = 0;
}
}
if (_gtv15)
{
if (_trgrt5I)
{
_trgrt5 = 0;
}
else
{
_trgrt5 = 1;
_trgrt5I = 1;
}
}
else
{
_trgrt5 = 0;
_trgrt5I = 0;
}
;
if(_trgrt5)
{
_tim6O = 1;
_tim6I = 1;
}
else
{
if(_tim6I)
{
_tim6I = 0;
_tim6P = millis();
}
else
{
if (_tim6O)
{
if (_isTimer(_tim6P, 15000)) _tim6O = 0;
}
}
}
if (_tim6O)
{
if (! _gen2I)
{
_gen2I = 1;
_gen2O = 1;
_gen2P = millis();
}
}
else
{
_gen2I = 0 ;
_gen2O= 0;
}
if (_gen2I)
{
if (_isTimer (_gen2P , 3000))
{
_gen2P = millis();
_gen2O = ! _gen2O;
}
}
digitalWrite(12, _gen2O);
digitalWrite(7, ((_gtv17) && (_gtv13)));
}
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)
{
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)
{
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 == 4)
{
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 == 4)
{
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]).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]).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 == 4)
{
return _convertNamber(itemType, convFormat, valIndex, indexMax, indexMin);
}
return "";
}
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]))));
}
String _convertNamber(int itemType, int convFormat, int valIndex, int indexMax, int indexMin)
{
if (itemType== 4)
{
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);
}
}
}
int _poligon(int value, int intArray[], int outArray[], int arraySize)
{
struct _poligonInexes indexes;
indexes = _getPoligonIndexes(value, intArray, arraySize);
return map(value, intArray[indexes.minIndex], intArray[indexes.maxIndex], outArray[indexes.minIndex], outArray[indexes.maxIndex]);
}
struct _poligonInexes _getPoligonIndexes(int value, int array[], int arraySize)
{
struct _poligonInexes result;
int i;
result.minIndex = 0;
result.maxIndex = 0;
for (i = 0; i < arraySize; i++)
{
if (array [result.minIndex] > array[i])
{
result.minIndex = i;
}
if (array [result.maxIndex] < array[i])
{
result.maxIndex = i;
}
}
for (i = 0; i < arraySize; i++)
{
if ((array [i] >= value) && (array [result.maxIndex] > array[i]))
{
result.maxIndex = i;
}
}
if (result.maxIndex==0)
{
result.minIndex = 0;
result.maxIndex=1;
}
else
{
result.minIndex = result.maxIndex -1;
}
return result;
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);
}
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));
}
void _func_UB_171563729(struct UB_171563729 *_ubInstans, long ubi_108673896, long ubi_91013910, bool ubi_197128335, bool ubi_79516391)
{
String ubo_136218795 = _ubInstans->ubo_136218795;
bool ubo_240660080 = _ubInstans->ubo_240660080;
bool ubo_157914509 = _ubInstans->ubo_157914509;
bool _gtv1 = _ubInstans->_gtv1;
bool _gtv2 = _ubInstans->_gtv2;
bool _count1I = _ubInstans->_count1I;
unsigned long _count1_Value = _ubInstans->_count1_Value;
bool _gen1I = _ubInstans->_gen1I;
bool _gen1O = _ubInstans->_gen1O;
unsigned long _gen1P = _ubInstans->_gen1P;
bool _trgs1 = _ubInstans->_trgs1;
bool _trgs2 = _ubInstans->_trgs2;
bool _trgs3 = _ubInstans->_trgs3;
if(ubi_197128335) _trgs1 = 1;
if(((_gtv1) || (ubi_79516391))) _trgs1 = 0;
if(_trgs1) _trgs3 = 1;
if(ubi_79516391) _trgs3 = 0;
if (_trgs1)
{
if (! _gen1I)
{
_gen1I = 1;
_gen1O = 1;
_gen1P = millis();
}
}
else
{
_gen1I = 0 ;
_gen1O= 0;
}
if (_gen1I)
{
if (_isTimer (_gen1P , 500))
{
_gen1P = millis();
_gen1O = ! _gen1O;
}
}
if (ubi_79516391)
{
_count1_Value = 0;
}
else
{
if (_gen1O)
{
if (! _count1I)
{
_count1I = 1;
_count1_Value = _count1_Value + 1;
}
}
else
{
_count1I = 0;
}
}
_gtv1 = ((((ubi_108673896)*(3600))+((ubi_91013910)*(60)))-(_count1_Value)) == (0);
ubo_157914509 = ((((((ubi_108673896)*(3600))+((ubi_91013910)*(60)))-(_count1_Value)) == (0)) && (_trgs3));
if(_trgs1) _trgs2 = 1;
if(((_gtv1) || (((_gtv1) || (ubi_79516391))))) _trgs2 = 0;
ubo_240660080 = _trgs2;
ubo_136218795 = (((String(((((ubi_108673896)*(3600))+((ubi_91013910)*(60)))-(_count1_Value))/(3600), DEC))) + (String(":")) + ((String(((((((ubi_108673896)*(3600))+((ubi_91013910)*(60)))-(_count1_Value)) % (3600)))/(60), DEC))) + (String(":")) + ((String((((((((ubi_108673896)*(3600))+((ubi_91013910)*(60)))-(_count1_Value)) % (3600))) % (60)), DEC))));
_ubInstans->ubo_136218795 = ubo_136218795;
_ubInstans->ubo_240660080 = ubo_240660080;
_ubInstans->ubo_157914509 = ubo_157914509;
_ubInstans->_gtv1 = _gtv1;
_ubInstans->_gtv2 = _gtv2;
_ubInstans->_count1I = _count1I;
_ubInstans->_count1_Value = _count1_Value;
_ubInstans->_gen1I = _gen1I;
_ubInstans->_gen1O = _gen1O;
_ubInstans->_gen1P = _gen1P;
_ubInstans->_trgs1 = _trgs1;
_ubInstans->_trgs2 = _trgs2;
_ubInstans->_trgs3 = _trgs3;
}