diff --git a/data_esp/items/items.txt b/data_esp/items/items.txt index 4da9efd9..1fb5d5ea 100644 --- a/data_esp/items/items.txt +++ b/data_esp/items/items.txt @@ -39,4 +39,5 @@ 0;sensor;anyid;anydata;Сенсоры;Параметр;1;c[1];int[10];type[AHTX0_temp];addr[0x76] 0;sensor;anyid;anydata;Сенсоры;Параметр;1;c[1];int[10];type[AHTX0_hum];addr[0x76]* 0;LCD2004;lcdid;anydata;Вывод;IP;1;addr[0x27];k[16,2];int[10];c[0,0];val[ip]* +0;disp1637;dispid;anydata;Вывод;f;1;pin[12,13];int[10];index[0];c[4];k[0];val[1234]* 0;sensor;anyid;anydata;Сенсоры;Параметр;1;c[1];int[10];type[type1];addr[0x76]* \ No newline at end of file diff --git a/data_esp/set.device.json.gz b/data_esp/set.device.json.gz index 329723f7..25e68a28 100644 Binary files a/data_esp/set.device.json.gz and b/data_esp/set.device.json.gz differ diff --git a/src/items/vSensorTM1637.cpp b/src/items/vSensorTM1637.cpp index 48dfaaeb..33c13215 100644 --- a/src/items/vSensorTM1637.cpp +++ b/src/items/vSensorTM1637.cpp @@ -9,7 +9,7 @@ #include -LiquidCrystal_I2C *LCDI2C; +LiquidCrystal_I2C *LCDI2C2; SensorTM1637::SensorTM1637(String key, unsigned long interval, unsigned int x, unsigned int y, String val, String descr) { _key = key; @@ -27,15 +27,15 @@ SensorTM1637::~SensorTM1637() {} void SensorTM1637::printBlankStr(int strSize){ String tmpStr = ""; for(int i=0; isetCursor(_x, _y); - LCDI2C->print(tmpStr); + LCDI2C2->setCursor(_x, _y); + LCDI2C2->print(tmpStr); } void SensorTM1637::execute(String command) { - if (command == "noBacklight") LCDI2C->noBacklight(); - else if (command == "backlight") LCDI2C->backlight(); - else if (command == "noDisplay") LCDI2C->noDisplay(); - else if (command == "display") LCDI2C->display(); + if (command == "noBacklight") LCDI2C2->noBacklight(); + else if (command == "backlight") LCDI2C2->backlight(); + else if (command == "noDisplay") LCDI2C2->noDisplay(); + else if (command == "display") LCDI2C2->display(); else if (command == "x") { printBlankStr(_prevStrSize); String par = sCmd.next(); @@ -68,14 +68,14 @@ void SensorTM1637::loop() { } void SensorTM1637::writeTM1637() { - if (LCDI2C != nullptr) { + if (LCDI2C2 != nullptr) { printBlankStr(_prevStrSize); String tmpStr = getValue(_val); if (tmpStr == "no value") tmpStr = _val; if (_descr != "none") tmpStr = _descr + " " + tmpStr; - LCDI2C->setCursor(_x, _y); - LCDI2C->print(tmpStr); + LCDI2C2->setCursor(_x, _y); + LCDI2C2->print(tmpStr); _prevStrSize = tmpStr.length(); } @@ -108,11 +108,11 @@ void TM1637() { int w = selectFromMarkerToMarker(k, ",", 0).toInt(); //количество столбцов int h = selectFromMarkerToMarker(k, ",", 1).toInt(); //количество строк - if (LCDI2C == nullptr) { //инициализации экрана еще не было - LCDI2C = new LiquidCrystal_I2C(hexStringToUint8(addr), w, h);//hexStringToUint8(addr), w, h); - if(LCDI2C != nullptr) { - LCDI2C->init(); - LCDI2C->backlight(); + if (LCDI2C2 == nullptr) { //инициализации экрана еще не было + LCDI2C2 = new LiquidCrystal_I2C(hexStringToUint8(addr), w, h);//hexStringToUint8(addr), w, h); + if(LCDI2C2 != nullptr) { + LCDI2C2->init(); + LCDI2C2->backlight(); } }