mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-26 22:22:16 +03:00
257 Median filter added to ultasonic
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
//=================Firmeare=================
|
||||
#define FIRMWARE_NAME "esp8266-iotm"
|
||||
#define FIRMWARE_VERSION 256
|
||||
#define FIRMWARE_VERSION 257
|
||||
#define FLASH_4MB true
|
||||
|
||||
//=================System===================
|
||||
|
||||
@@ -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, "");
|
||||
|
||||
Reference in New Issue
Block a user