We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ecd9916 commit 8c91fa9Copy full SHA for 8c91fa9
src/sensors/Sensor.h
@@ -16,7 +16,14 @@ class Sensor : public SensorClass {
16
}
17
18
float value()
19
- {
+ {
20
+ if (_format == PEVENT) {
21
+ if (_value > 0) {
22
+ _value = 0;
23
+ return 1;
24
+ }
25
+ return 0;
26
27
return _value;
28
29
@@ -39,9 +46,11 @@ class Sensor : public SensorClass {
39
46
40
47
String toString()
41
48
{
42
- if (_format == PEVENT && (_value > 0)) {
43
- _value = 0;
44
- return (String)("Event detected\n");
49
50
+ if (value()) {
51
+ return (String)("Event detected\n");
52
53
+ return (String)("");
45
54
55
return (String)("Data value: " + String(_value, 3) + "\n");
56
0 commit comments