Merge pull request #353 from Mit4el/ver4dev

upd Ble
This commit is contained in:
2023-10-29 10:48:16 +07:00
committed by GitHub
2 changed files with 31 additions and 11 deletions

View File

@@ -18,7 +18,7 @@ private:
// описание параметров передаваемых из настроек датчика из веба
String _MAC;
String _sensor;
int timeRecv;
public:
String whoIAm(/*String &mac, String &sens*/)
{
@@ -31,11 +31,11 @@ public:
{
if (_sensor == "last")
{
int valInt = extBLEdata[_sensor].as<int>();
timeRecv = extBLEdata[_sensor].as<int>();
char *s;
s = TimeToString(millis() / 1000 - valInt / 1000);
s = TimeToString(millis() / 1000 - timeRecv / 1000);
value.isDecimal = 0;
if (valInt > 0)
if (timeRecv > 0)
{
value.valS = s;
}
@@ -82,6 +82,25 @@ public:
return str;
}
void doByInterval()
{
if (_sensor == "last")
{
char *s;
s = TimeToString(millis() / 1000 - timeRecv / 1000);
value.isDecimal = 0;
if (timeRecv > 0)
{
value.valS = s;
}
else
{
value.valS = "";
}
regEvent(value.valS, _id);
}
}
BleSens(String parameters) : IoTItem(parameters)
{
_MAC = jsonReadStr(parameters, "MAC");

View File

@@ -23,6 +23,7 @@
"page": "Сенсоры",
"descr": "",
"needSave": 0,
"int": 30,
"global": 0,
"round": 1,
"MAC": "",
@@ -48,7 +49,7 @@
"moduleDesc": "Позволяет получить данные с Bluetooth часов и термометров Mijia, Xiaomi, Cleargrass, ...",
"propInfo": {
"round": "Округление после запятой.",
"int": "Интервал сканирования BLE окружения (BleScan) / В BleSens не используется, там обновляется по мене сканирования/поступления",
"int": "Интервал сканирования BLE окружения (BleScan) / В BleSens темп обновления времнени поступления данных, сами даные обновляются по мене сканирования/поступления",
"scanDuration": "Длительность сканирования ",
"filter": "Позволяет установить фильтр по параметру передаваемому датчиком. Влияет только на вывод лога при debug=1, что бы было легче найти датчики, если много устройств в эфире",
"MAC": "MAC адрес беспроводного датчика",
@@ -59,27 +60,27 @@
"usedLibs": {
"esp32_4mb": [
"https://github.com/h2zero/NimBLE-Arduino.git",
"https://github.com/avaksru/decoder.git"
"https://github.com/Mit4el/decoder.git"
],
"esp32_16mb": [
"https://github.com/h2zero/NimBLE-Arduino.git",
"https://github.com/avaksru/decoder.git"
"https://github.com/Mit4el/decoder.git"
],
"esp32_4mb3f": [
"https://github.com/h2zero/NimBLE-Arduino.git",
"https://github.com/avaksru/decoder.git"
"https://github.com/Mit4el/decoder.git"
],
"esp32cam_4mb": [
"https://github.com/h2zero/NimBLE-Arduino.git",
"https://github.com/avaksru/decoder.git"
"https://github.com/Mit4el/decoder.git"
],
"esp32s3_16mb": [
"https://github.com/h2zero/NimBLE-Arduino.git",
"https://github.com/avaksru/decoder.git"
"https://github.com/Mit4el/decoder.git"
],
"esp32c3m_4mb": [
"https://github.com/h2zero/NimBLE-Arduino.git",
"https://github.com/avaksru/decoder.git"
"https://github.com/Mit4el/decoder.git"
]
}
}