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
e826d15f
Commit
e826d15f
authored
8 years ago
by
user2684
Browse files
Options
Downloads
Patches
Plain Diff
For SENSOR_MOTION, pull up is wrongly set to HIGH in registerSensor() #27
parent
32098eac
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
NodeManagerTemplate/NodeManager.cpp
+10
-3
10 additions, 3 deletions
NodeManagerTemplate/NodeManager.cpp
NodeManagerTemplate/NodeManager.h
+4
-0
4 additions, 0 deletions
NodeManagerTemplate/NodeManager.h
NodeManagerTemplate/config.h
+1
-1
1 addition, 1 deletion
NodeManagerTemplate/config.h
with
15 additions
and
4 deletions
NodeManagerTemplate/NodeManager.cpp
+
10
−
3
View file @
e826d15f
...
...
@@ -704,14 +704,18 @@ void SensorSwitch::setMode(int value) {
int
SensorSwitch
::
getMode
()
{
return
_mode
;
}
// setter/getter
void
SensorSwitch
::
setDebounce
(
int
value
)
{
_debounce
=
value
;
}
// setter/getter
void
SensorSwitch
::
setTriggerTime
(
int
value
)
{
_trigger_time
=
value
;
}
void
SensorSwitch
::
setInitial
(
int
value
)
{
_initial
=
value
;
}
int
SensorSwitch
::
getInitial
()
{
return
_initial
;
}
// what do to during setup
void
SensorSwitch
::
onBefore
()
{
...
...
@@ -763,6 +767,8 @@ SensorMotion::SensorMotion(int child_id, int pin): SensorSwitch(child_id,pin) {
setPresentation
(
S_MOTION
);
// capture only when it triggers
setMode
(
RISING
);
// set initial value to LOW
setInitial
(
LOW
);
}
/*
...
...
@@ -1013,7 +1019,8 @@ int NodeManager::registerSensor(int sensor_type, int pin, int child_id) {
else
if
(
sensor_type
==
SENSOR_DOOR
)
index
=
registerSensor
(
new
SensorDoor
(
child_id
,
pin
));
else
if
(
sensor_type
==
SENSOR_MOTION
)
index
=
registerSensor
(
new
SensorMotion
(
child_id
,
pin
));
// set an interrupt on the pin and activate internal pull up
setInterrupt
(
pin
,((
SensorSwitch
*
)
get
(
index
))
->
getMode
(),
HIGH
);
SensorSwitch
*
sensor
=
(
SensorSwitch
*
)
get
(
index
);
setInterrupt
(
pin
,
sensor
->
getMode
(),
sensor
->
getInitial
());
return
index
;
}
#endif
...
...
This diff is collapsed.
Click to expand it.
NodeManagerTemplate/NodeManager.h
+
4
−
0
View file @
e826d15f
...
...
@@ -496,6 +496,9 @@ class SensorSwitch: public Sensor {
void
setDebounce
(
int
value
);
// time to wait in milliseconds after a change is detected to allow the signal to be restored to its normal value (default: 0)
void
setTriggerTime
(
int
value
);
// Set initial value on the interrupt pin (default: HIGH)
void
setInitial
(
int
value
);
int
getInitial
();
// define what to do at each stage of the sketch
void
onBefore
();
void
onLoop
();
...
...
@@ -504,6 +507,7 @@ class SensorSwitch: public Sensor {
int
_debounce
=
0
;
int
_trigger_time
=
0
;
int
_mode
=
CHANGE
;
int
_initial
=
HIGH
;
};
/*
...
...
This diff is collapsed.
Click to expand it.
NodeManagerTemplate/config.h
+
1
−
1
View file @
e826d15f
...
...
@@ -6,7 +6,7 @@
*/
#define SKETCH_NAME "NodeManagerTemplate"
#define SKETCH_VERSION "1.
2
"
#define SKETCH_VERSION "1.
3-dev
"
/**********************************
* MySensors 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