Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
NodeManager_BMP280_Stamp
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_BMP280_Stamp
Commits
09f53f69
Commit
09f53f69
authored
7 years ago
by
Wolfgang Gaar
Committed by
user2684
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Allow to set power savings mode of BH1750 light level sensor (#197)
parent
83814b81
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
NodeManager.cpp
+10
-0
10 additions, 0 deletions
NodeManager.cpp
NodeManager.h
+2
-0
2 additions, 0 deletions
NodeManager.h
README.md
+7
-1
7 additions, 1 deletion
README.md
with
19 additions
and
1 deletion
NodeManager.cpp
+
10
−
0
View file @
09f53f69
...
@@ -1568,6 +1568,10 @@ SensorBH1750::SensorBH1750(NodeManager* node_manager, int child_id): Sensor(node
...
@@ -1568,6 +1568,10 @@ SensorBH1750::SensorBH1750(NodeManager* node_manager, int child_id): Sensor(node
_lightSensor
=
new
BH1750
();
_lightSensor
=
new
BH1750
();
}
}
void
SensorBH1750
::
setMode
(
uint8_t
mode
)
{
_lightSensor
->
configure
(
mode
);
}
// what to do during before
// what to do during before
void
SensorBH1750
::
onBefore
()
{
void
SensorBH1750
::
onBefore
()
{
_lightSensor
->
begin
();
_lightSensor
->
begin
();
...
@@ -1596,6 +1600,12 @@ void SensorBH1750::onReceive(const MyMessage & message) {
...
@@ -1596,6 +1600,12 @@ void SensorBH1750::onReceive(const MyMessage & message) {
// what to do when receiving a remote message
// what to do when receiving a remote message
void
SensorBH1750
::
onProcess
(
Request
&
request
)
{
void
SensorBH1750
::
onProcess
(
Request
&
request
)
{
int
function
=
request
.
getFunction
();
switch
(
function
)
{
case
101
:
setMode
(
request
.
getValueInt
());
break
;
default:
return
;
}
_send
(
_msg_service
.
set
(
function
));
}
}
...
...
This diff is collapsed.
Click to expand it.
NodeManager.h
+
2
−
0
View file @
09f53f69
...
@@ -972,6 +972,8 @@ class SensorDs18b20: public Sensor {
...
@@ -972,6 +972,8 @@ class SensorDs18b20: public Sensor {
class
SensorBH1750
:
public
Sensor
{
class
SensorBH1750
:
public
Sensor
{
public:
public:
SensorBH1750
(
NodeManager
*
node_manager
,
int
child_id
);
SensorBH1750
(
NodeManager
*
node_manager
,
int
child_id
);
// [101] set sensor reading mode, e.g. BH1750_ONE_TIME_HIGH_RES_MODE
void
setMode
(
uint8_t
mode
);
// define what to do at each stage of the sketch
// define what to do at each stage of the sketch
void
onBefore
();
void
onBefore
();
void
onSetup
();
void
onSetup
();
...
...
This diff is collapsed.
Click to expand it.
README.md
+
7
−
1
View file @
09f53f69
...
@@ -685,6 +685,12 @@ Each sensor class can expose additional methods.
...
@@ -685,6 +685,12 @@ Each sensor class can expose additional methods.
DeviceAddress
*
getDeviceAddress
();
DeviceAddress
*
getDeviceAddress
();
~~~
~~~
*
SensorBH1750
~~~
c
// [101] set sensor reading mode, e.g. BH1750_ONE_TIME_HIGH_RES_MODE
void
setMode
(
uint8_t
mode
);
~~~
*
SensorBME280 / SensorBMP085 / SensorBMP280
*
SensorBME280 / SensorBMP085 / SensorBMP280
~~~
c
~~~
c
// [101] define how many pressure samples to keep track of for calculating the forecast (default: 5)
// [101] define how many pressure samples to keep track of for calculating the forecast (default: 5)
...
@@ -1412,4 +1418,4 @@ v1.6:
...
@@ -1412,4 +1418,4 @@ v1.6:
*
SensorMQ now depends on its own module
*
SensorMQ now depends on its own module
*
Added automatic off capability (safeguard) to SensorDigitalOutput
*
Added automatic off capability (safeguard) to SensorDigitalOutput
*
Any sensor can now access all NodeManager's functions
*
Any sensor can now access all NodeManager's functions
*
DHT sensor now using MySensors' DHT library
*
DHT sensor now using MySensors' DHT library
\ No newline at end of file
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