257 Median filter added to ultasonic

This commit is contained in:
Dmitry Borisenko
2020-10-12 01:30:24 +03:00
parent a1eb94c4b3
commit d9556f5b31
8 changed files with 80 additions and 39 deletions

View File

@@ -2,7 +2,7 @@
//=================Firmeare=================
#define FIRMWARE_NAME "esp8266-iotm"
#define FIRMWARE_VERSION 256
#define FIRMWARE_VERSION 257
#define FLASH_4MB true
//=================System===================

View File

@@ -4,6 +4,9 @@
#include "Class/LineParsing.h"
#include "Global.h"
#include "items/SensorConvertingClass.h"
#include "GyverFilters.h"
GMedian<6, int> testFilter;
class SensorUltrasonic : public SensorConvertingClass {
public:
@@ -33,6 +36,8 @@ class SensorUltrasonic : public SensorConvertingClass {
long duration_ = pulseIn(echo, HIGH, 30000); // 3000 µs = 50cm // 30000 µs = 5 m
value = duration_ / 29 / 2;
value = testFilter.filtered(value);
value = this->mapping(key, value);
float valueFl = this->correction(key, value);
eventGen(key, "");