Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
NodeManager_BME280_EasyPCB
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SmartHome
NodeManager_BME280_EasyPCB
Commits
7ad3d6c5
Commit
7ad3d6c5
authored
8 years ago
by
user2684
Browse files
Options
Downloads
Patches
Plain Diff
Add option to retrieve the latest value of a sensor #104
parent
cec50cca
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
NodeManager.cpp
+12
-0
12 additions, 0 deletions
NodeManager.cpp
NodeManager.h
+5
-0
5 additions, 0 deletions
NodeManager.h
README.md
+12
-0
12 additions, 0 deletions
README.md
with
29 additions
and
0 deletions
NodeManager.cpp
+
12
−
0
View file @
7ad3d6c5
...
...
@@ -152,6 +152,9 @@ void Sensor::setForceUpdate(int value) {
void
Sensor
::
setValueType
(
int
value
)
{
_value_type
=
value
;
}
int
Sensor
::
getValueType
()
{
return
_value_type
;
}
void
Sensor
::
setFloatPrecision
(
int
value
)
{
_float_precision
=
value
;
}
...
...
@@ -178,6 +181,15 @@ void Sensor::setInterruptPin(int value) {
int
Sensor
::
getInterruptPin
()
{
return
_interrupt_pin
;
}
int
Sensor
::
getValueInt
()
{
return
_last_value_int
;
}
float
Sensor
::
getValueFloat
()
{
return
_last_value_float
;
}
char
*
Sensor
::
getValueString
()
{
return
_last_value_string
;
}
// present the sensor to the gateway and controller
void
Sensor
::
presentation
()
{
...
...
This diff is collapsed.
Click to expand it.
NodeManager.h
+
5
−
0
View file @
7ad3d6c5
...
...
@@ -345,6 +345,7 @@ class Sensor {
void
setForceUpdate
(
int
value
);
// the value type of this sensor (default: TYPE_INTEGER)
void
setValueType
(
int
value
);
int
getValueType
();
// for float values, set the float precision (default: 2)
void
setFloatPrecision
(
int
value
);
// optionally sleep interval in milliseconds before sending each message to the radio network (default: 0)
...
...
@@ -362,6 +363,10 @@ class Sensor {
// manually turn the power off
void
powerOff
();
#endif
// get the latest recorded value from the sensor
int
getValueInt
();
float
getValueFloat
();
char
*
getValueString
();
// define what to do at each stage of the sketch
virtual
void
before
();
virtual
void
presentation
();
...
...
This diff is collapsed.
Click to expand it.
README.md
+
12
−
0
View file @
7ad3d6c5
...
...
@@ -343,12 +343,16 @@ The following methods are available for all the sensors:
~~~
c
// where the sensor is attached to (default: not set)
void
setPin
(
int
value
);
int
getPin
();
// child_id of this sensor (default: not set)
void
setChildId
(
int
value
);
int
getChildId
();
// presentation of this sensor (default: S_CUSTOM)
void
setPresentation
(
int
value
);
int
getPresentation
();
// type of this sensor (default: V_CUSTOM)
void
setType
(
int
value
);
int
getType
();
// description of the sensor (default: '')
void
setDescription
(
char
*
value
);
// set this to true if you want destination node to send ack back to this node (default: false)
...
...
@@ -365,10 +369,14 @@ The following methods are available for all the sensors:
void
setForceUpdate
(
int
value
);
// the value type of this sensor (default: TYPE_INTEGER)
void
setValueType
(
int
value
);
int
getValueType
();
// for float values, set the float precision (default: 2)
void
setFloatPrecision
(
int
value
);
// optionally sleep interval in milliseconds before sending each message to the radio network (default: 0)
void
setSleepBetweenSend
(
int
value
);
// set the interrupt pin the sensor is attached to so its loop() will be executed only upon that interrupt (default: -1)
void
setInterruptPin
(
int
value
);
int
getInterruptPin
();
#if POWER_MANAGER == 1
// to save battery the sensor can be optionally connected to two pins which will act as vcc and ground and activated on demand
void
setPowerPins
(
int
ground_pin
,
int
vcc_pin
,
long
wait
=
0
);
...
...
@@ -379,6 +387,10 @@ The following methods are available for all the sensors:
// manually turn the power off
void
powerOff
();
#endif
// get the latest value from the sensor
int
getValueInt
();
float
getValueFloat
();
char
*
getValueString
();
~~~
### Sensor's specific configuration
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment