mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-30 03:49:13 +03:00
251 fixed ultrasonic bug
This commit is contained in:
@@ -43,7 +43,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "h4",
|
"type": "h4",
|
||||||
"title": "LittleFS version: 250"
|
"title": "LittleFS version: 251"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "hr"
|
"type": "hr"
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
//=================Firmeare=================
|
//=================Firmeare=================
|
||||||
#define FIRMWARE_NAME "esp8266-iotm"
|
#define FIRMWARE_NAME "esp8266-iotm"
|
||||||
#define FIRMWARE_VERSION 250
|
#define FIRMWARE_VERSION 251
|
||||||
#define FLASH_4MB true
|
#define FLASH_4MB true
|
||||||
|
|
||||||
//=================System===================
|
//=================System===================
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
|
||||||
#include "Class/LineParsing.h"
|
#include "Class/LineParsing.h"
|
||||||
#include "Global.h"
|
#include "Global.h"
|
||||||
#include "items/SensorConvertingClass.h"
|
#include "items/SensorConvertingClass.h"
|
||||||
@@ -11,6 +12,8 @@ class SensorUltrasonic : public SensorConvertingClass {
|
|||||||
sensorReadingMap += _key + ",";
|
sensorReadingMap += _key + ",";
|
||||||
String trig = selectFromMarkerToMarker(_pin, ",", 0);
|
String trig = selectFromMarkerToMarker(_pin, ",", 0);
|
||||||
String echo = selectFromMarkerToMarker(_pin, ",", 1);
|
String echo = selectFromMarkerToMarker(_pin, ",", 1);
|
||||||
|
pinMode(trig.toInt(), OUTPUT);
|
||||||
|
pinMode(echo.toInt(), INPUT);
|
||||||
jsonWriteStr(configOptionJson, _key + "_trig", trig);
|
jsonWriteStr(configOptionJson, _key + "_trig", trig);
|
||||||
jsonWriteStr(configOptionJson, _key + "_echo", echo);
|
jsonWriteStr(configOptionJson, _key + "_echo", echo);
|
||||||
jsonWriteStr(configOptionJson, _key + "_map", _map);
|
jsonWriteStr(configOptionJson, _key + "_map", _map);
|
||||||
@@ -34,7 +37,7 @@ class SensorUltrasonic : public SensorConvertingClass {
|
|||||||
float valueFl = this->correction(key, value);
|
float valueFl = this->correction(key, value);
|
||||||
eventGen(key, "");
|
eventGen(key, "");
|
||||||
jsonWriteStr(configLiveJson, key, String(valueFl));
|
jsonWriteStr(configLiveJson, key, String(valueFl));
|
||||||
publishStatus(key, String(valueFl));
|
publishStatus(key, String(valueFl));
|
||||||
Serial.println("I sensor '" + key + "' data: " + String(valueFl));
|
Serial.println("I sensor '" + key + "' data: " + String(valueFl));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user