4 mb version

This commit is contained in:
Dmitry Borisenko
2020-12-13 00:59:56 +03:00
parent e9820efff9
commit 9a7f6c5b05
51 changed files with 273 additions and 3 deletions

BIN
data/edit.htm.gz Normal file

Binary file not shown.

View File

@@ -0,0 +1 @@
0;analog-adc;id;fillgauge;Сенсоры;Аналоговый;order;gol;map[0,1024,0,100];c[1]

View File

@@ -0,0 +1 @@
0;bme280-hum;id;anydataHum;Сенсоры;Влажность;order;addr[0x76];c[1]

View File

@@ -0,0 +1 @@
0;bme280-press;id;anydataPress;Сенсоры;Давление;order;addr[0x76];c[1]

View File

@@ -0,0 +1 @@
0;bme280-temp;id;anydataTemp;Сенсоры;Температура;order;addr[0x76];c[1]

View File

@@ -0,0 +1 @@
0;bmp280-press;id;anydataPress;Сенсоры;Давление;order;addr[0x76];c[1]

View File

@@ -0,0 +1 @@
0;bmp280-temp;id;anydataTemp;Сенсоры;Температура;order;addr[0x76];c[1]

1
data/items/button-in.txt Normal file
View File

@@ -0,0 +1 @@
0;button-in;id;toggle;Кнопки;Освещение;order;pin;db[20]

View File

@@ -0,0 +1 @@
0;button-out;id;toggle;Кнопки;Освещение;order;pin;inv[1]

View File

@@ -0,0 +1 @@
0;button-out;id;toggle;Кнопки;Освещение;order

View File

@@ -0,0 +1 @@
0;button-out;id;toggle;Кнопки;Освещение;order;pin

View File

@@ -0,0 +1 @@
0;count-down;id;anydata;Таймер;Обратный#отчет;order

View File

@@ -0,0 +1 @@
0;dallas-temp;id;anydataTemp;Сенсоры;Температура;order;sal;index[0];int[10]

1
data/items/dht11-hum.txt Normal file
View File

@@ -0,0 +1 @@
0;dht-hum;id;anydataHum;Сенсоры;Влажность;order;thd;type[dht11];c[1]

View File

@@ -0,0 +1 @@
0;dht-temp;id;anydataTemp;Сенсоры;Температура;order;thd;type[dht11];c[1]

1
data/items/dht22-hum.txt Normal file
View File

@@ -0,0 +1 @@
0;dht-hum;id;anydataHum;Сенсоры;Влажность;order;thd;type[dht22];c[1]

View File

@@ -0,0 +1 @@
0;dht-temp;id;anydataTemp;Сенсоры;Температура;order;thd;type[dht22];c[1]

View File

@@ -0,0 +1 @@
0;impuls-out;id;na;na;na;order;pin

View File

@@ -0,0 +1 @@
0;inoutput;id;inputDigit;Ввод;Введите#цифру;order

View File

@@ -0,0 +1 @@
0;inoutput;id;inputTime;Ввод;Введите#время;order

1
data/items/logging.txt Normal file
View File

@@ -0,0 +1 @@
0;logging;id;chart;Графики;История;order;val[any];int[60];cnt[100]

1
data/items/modbus.txt Normal file
View File

@@ -0,0 +1 @@
0;modbus;id;anydata;Modbus;Регистр;order;addr[1];reg[0];c[1]

View File

@@ -0,0 +1 @@
0;inoutput;id;anydata;Вывод;Сигнализация;order

1
data/items/pwm-out.txt Normal file
View File

@@ -0,0 +1 @@
0;pwm-out;id;range;Ползунки;Яркость;order;pin

View File

@@ -0,0 +1 @@
0;button-out;id;toggle;Кнопки;Освещение;order;type[UART]

View File

@@ -0,0 +1 @@
0;inoutput;id;anydata;Вывод;Вывод#uart;order

View File

@@ -0,0 +1 @@
0;ultrasonic-cm;id;anydata;Сенсоры;Расстояние;order;cin;map[0,500,0,100];c[1];int[10]

1
data/items/uptime.txt Normal file
View File

@@ -0,0 +1 @@
0;uptime;id;anydataTime;Системные;%name%#uptime;order

5
data/presets/1.c.txt Normal file
View File

@@ -0,0 +1,5 @@
0;dallas-temp;temp;anydataTemp;Термостат;Температура;1;pin[2];index[0];int[10]
0;logging;log;chart;Термостат;История;2;val[temp];int[60];cnt[100]
0;inoutput;inputU;inputDigit;Термостат;Верхний#порог;3
0;inoutput;inputL;inputDigit;Термостат;Нижний#порог;4
0;button-out;button;toggle;Термостат;Нагрев;5;pin[12]

8
data/presets/1.s.txt Normal file
View File

@@ -0,0 +1,8 @@
temp > inputU
button 0
telegram нагрев#выключен 1
end
temp < inputL
button 1
telegram нагрев#включен 1
end

12
data/presets/2.c.txt Normal file
View File

@@ -0,0 +1,12 @@
0;dallas-temp;temp;anydataTemp;Термостат;Температура;1;pin[2];index[0];int[60]
0;logging;log;chart;Термостат;История;2;val[temp];int[10];cnt[100]
0;inoutput;threshold;inputDigitTemp;Термостат;Заданная#температура;3
0;button-out;heater;toggle;Термостат;Нагреватель;7;pin[12]
0;inoutput;time1;inputTimeClock;Расписание;Утренний#период;8
0;inoutput;threshold1;inputDigitTemp;Расписание;Температура;9
0;inoutput;time2;inputTimeClock;Расписание;Дневной#период;10
0;inoutput;threshold2;inputDigitTemp;Расписание;Температура;11
0;inoutput;time3;inputTimeClock;Расписание;Вечерний#период;12
0;inoutput;threshold3;inputDigitTemp;Расписание;Температура;13
0;inoutput;time4;inputTimeClock;Расписание;Ночной#период;14
0;inoutput;threshold4;inputDigitTemp;Расписание;Температура;15

18
data/presets/2.s.txt Normal file
View File

@@ -0,0 +1,18 @@
temp > threshold+-2
heater 0
end
temp < threshold+-2
heater 1
end
timenow = time1
threshold threshold1
end
timenow = time2
threshold threshold2
end
timenow = time3
threshold threshold3
end
timenow = time4
threshold threshold4
end

5
data/presets/3.c.txt Normal file
View File

@@ -0,0 +1,5 @@
0;dht-hum;hum;anydataHum;Теплица;Влажность;1;pin[2];type[dht11];c[1]
0;logging;log;chart;Теплица;История;2;val[hum];int[60];cnt[100]
0;inoutput;inputU;inputDigit;Теплица;Верхний#порог;3
0;inoutput;inputL;inputDigit;Теплица;Нижний#порог;4
0;button-out;button;toggle;Теплица;Полив;5;pin[12]

8
data/presets/3.s.txt Normal file
View File

@@ -0,0 +1,8 @@
hum > inputU
button 0
telegram полив#выключен 1
end
hum < inputL
button 1
telegram полив#включен 1
end

4
data/presets/4.c.txt Normal file
View File

@@ -0,0 +1,4 @@
0;button-out;button1;toggle;Реле;Освещение;1;pin[12]
0;button-out;button2;toggle;Реле;Освещение;2;pin[13]
0;inoutput;T1;inputTime;Реле;Введите#время#включения;3
0;inoutput;T2;inputTime;Реле;Введите#время#выключения;4

8
data/presets/4.s.txt Normal file
View File

@@ -0,0 +1,8 @@
timenow = T1
button1 1
button2 0
end
timenow = T2
button1 0
button2 1
end

7
data/presets/5.c.txt Normal file
View File

@@ -0,0 +1,7 @@
0;button-out;button-out-1;toggle;Кнопки;Выключить#все;1
0;button-out;button-out-2;toggle;Кнопки;Гостинная;2;pin[12]
0;button-out;button-out-3;toggle;Кнопки;Спальня;3;pin[13]
0;button-out;button-out-4;toggle;Кнопки;Прихожая;4;pin[14]
0;pwm-out;pwm-out-5;range;Кнопки;Яркость;5;pin[15]
0;pwm-out;pwm-out-6;range;Кнопки;Яркость;6;pin[16]
0;inoutput;output-text-7;anydata;Кнопки;Статус;7

16
data/presets/5.s.txt Normal file
View File

@@ -0,0 +1,16 @@
button-out-1 = 1
button-out-2 1
button-out-3 1
button-out-4 1
pwm-out-5 200
pwm-out-6 800
output-text-7 включено
end
button-out-1 = 0
button-out-2 0
button-out-3 0
button-out-4 0
pwm-out-5 800
pwm-out-6 200
output-text-7 выключено
end

3
data/presets/6.c.txt Normal file
View File

@@ -0,0 +1,3 @@
0;button-out;button;toggle;Таймер;Освещение;1;pin[12]
0;count-down;count;anydata;Таймер;Обратный#отчет;2
0;inoutput;input;inputDigit;Таймер;Введите#цифру;3

6
data/presets/6.s.txt Normal file
View File

@@ -0,0 +1,6 @@
button = 1
count input
end
count = 0
button 0
end

4
data/presets/7.c.txt Normal file
View File

@@ -0,0 +1,4 @@
0;inoutput;text;anydataAlarm;Сигнализация;Движение:;1
0;inoutput;time;anydataTime;Сигнализация;Время:;2
0;button-in;sensor;na;na;na;3;pin[0];db[20]
0;button-out;reset;toggle;Сигнализация;Сбросить;4

10
data/presets/7.s.txt Normal file
View File

@@ -0,0 +1,10 @@
sensor = 1
text обнаружено
time %date%
telegram text обнаружено#движение 1
end
reset = 1
text не#обнаружено
time %date%
reset 0
end

4
data/presets/8.c.txt Normal file
View File

@@ -0,0 +1,4 @@
0;button-in;sensor;na;na;na;1;pin[0];db[20]
0;button-out;light;toggle;Освещение;Освещение;2;pin[13]
0;count-down;count;anydata;Освещение;Обратный#отчет;3
0;inoutput;period;inputDigit;Освещение;Период#включения;4

7
data/presets/8.s.txt Normal file
View File

@@ -0,0 +1,7 @@
sensor = 1
light 1
count period
end
count = 0
light 0
end

2
data/presets/9.c.txt Normal file
View File

@@ -0,0 +1,2 @@
0;button-out;light;toggle;Кнопки;Освещение;1;pin[13]
0;button-in;switch;na;na;na;2;pin[0];db[20]

3
data/presets/9.s.txt Normal file
View File

@@ -0,0 +1,3 @@
switch = 1
light change
end

View File

@@ -2,7 +2,7 @@
//===========Firmware=============================================================================================================================================
#define FIRMWARE_VERSION 272
#define FLASH_SIZE_1MB true
//#define FLASH_SIZE_1MB true
#ifdef ESP8266
#ifdef FLASH_SIZE_1MB
#define FIRMWARE_NAME "esp8266-1mb"

View File

@@ -0,0 +1,41 @@
#pragma once
#include "Global.h"
#include <Arduino.h>
#include "GyverFilters.h"
class SensorAnalog;
typedef std::vector<SensorAnalog> MySensorAnalogVector;
class SensorAnalog {
public:
SensorAnalog(String key, unsigned long interval, unsigned int adcPin, int map1, int map2, int map3, int map4, float c);
~SensorAnalog();
void loop();
void readAnalog();
private:
unsigned long currentMillis;
unsigned long prevMillis;
unsigned long difference;
unsigned long _interval;
String _key;
unsigned int _adcPin;
int _map1;
int _map2;
int _map3;
int _map4;
float _c;
};
extern MySensorAnalogVector* mySensorAnalog;
extern void analogAdc();

View File

@@ -18,6 +18,7 @@ void itemsListInit() {
delChoosingItems();
},
nullptr);
#ifdef FLASH_SIZE_1MB
myNotAsyncActions->add(
do_addItem, [&](void*) {

View File

@@ -59,8 +59,8 @@ void upgrade_firmware(int type) {
String devconfig_ForUpdate;
String configSetup_ForUpdate;
scenario_ForUpdate = readFile(String(DEVICE_SCENARIO_FILE), 4000);
devconfig_ForUpdate = readFile(String(DEVICE_CONFIG_FILE), 4000);
scenario_ForUpdate = readFile(String(DEVICE_SCENARIO_FILE), 4096);
devconfig_ForUpdate = readFile(String(DEVICE_CONFIG_FILE), 4096);
configSetup_ForUpdate = configSetupJson;
if (type == 1) { //only build

View File

@@ -0,0 +1,71 @@
#include "items/vSensorAnalog.h"
#include "Class/LineParsing.h"
#include "Global.h"
#include "BufferExecute.h"
#include <Arduino.h>
SensorAnalog::SensorAnalog(String key, unsigned long interval, unsigned int adcPin, int map1, int map2, int map3, int map4, float c) {
_interval = interval * 1000;
_key = key;
_adcPin = _adcPin;
_map1 = map1;
_map2 = map2;
_map3 = map3;
_map4 = map4;
_c = c;
}
SensorAnalog::~SensorAnalog() {}
void SensorAnalog::loop() {
currentMillis = millis();
difference = currentMillis - prevMillis;
if (difference >= _interval) {
prevMillis = millis();
readAnalog();
}
}
void SensorAnalog::readAnalog() {
int value;
#ifdef ESP32
int pinInt = pin.toInt();
value = analogRead(pinInt);
#endif
#ifdef ESP8266
value = analogRead(A0);
#endif
value = map(value, _map1, _map2, _map3, _map4);
float valueFloat = value * _c;
eventGen2(_key, String(valueFloat));
jsonWriteStr(configLiveJson, _key, String(valueFloat));
publishStatus(_key, String(valueFloat));
SerialPrint("I", "Sensor", "'" + _key + "' data: " + String(valueFloat));
}
MySensorAnalogVector* mySensorAnalog = nullptr;
void analogAdc() {
myLineParsing.update();
String interval = myLineParsing.gint();
String pin = myLineParsing.gpin();
String key = myLineParsing.gkey();
String map = myLineParsing.gmap();
String c = myLineParsing.gc();
myLineParsing.clear();
int map1 = selectFromMarkerToMarker(map, ",", 0).toInt();
int map2 = selectFromMarkerToMarker(map, ",", 1).toInt();
int map3 = selectFromMarkerToMarker(map, ",", 2).toInt();
int map4 = selectFromMarkerToMarker(map, ",", 3).toInt();
static bool firstTime = true;
if (firstTime) mySensorAnalog = new MySensorAnalogVector();
firstTime = false;
mySensorAnalog->push_back(SensorAnalog(key, interval.toInt(), pin.toInt(), map1, map2, map3, map4, c.toFloat()));
}