Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
arduino-block-course
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Stefan Gehr
arduino-block-course
Commits
f259e6c9
Commit
f259e6c9
authored
Oct 13, 2022
by
Mario Engelmann
Browse files
Options
Downloads
Patches
Plain Diff
function 3 in 1
parent
94037e8d
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
solarpump/temperature.ino
+133
-92
133 additions, 92 deletions
solarpump/temperature.ino
with
133 additions
and
92 deletions
solarpump/temperature.ino
+
133
−
92
View file @
f259e6c9
...
...
@@ -39,6 +39,48 @@ UPDATESTATE t1up(float* temp) {
return
SUCCESS
;
}
struct
temperatureSensor
{
float
tempValue
;
uint32_t
prevTime
;
uint32_t
currentTime
;
uint32_t
errorTime
;
DHT
sensorClass
;
};
temperatureSensor
t1down
{
0.0
,
0
,
0
,
0
,
DHT
(
T1DOWN
,
DHT11
)
};
temperatureSensor
t2up
{
0.0
,
0
,
0
,
0
,
DHT
(
T2UP
,
DHT11
)
};
temperatureSensor
t2down
{
0.0
,
0
,
0
,
0
,
DHT
(
T2DOWN
,
DHT11
)
};
UPDATESTATE
temperatureSensor
(
temperatureSensor
&
sensor
)
{
sensor
.
currentTime
=
millis
();
if
(
sensor
.
currentTime
-
sensor
.
prevTime
<
TEMPUPDATETIME
)
{
return
UNCHANGED
;
}
float
tmpTemperature
=
sensor
.
sensorClass
.
readTemperature
();
if
(
isnan
(
tmpTemperature
))
{
if
(
sensor
.
errorTime
)
{
if
(
sensor
.
currentTime
-
sensor
.
errorTime
>
ERRORTIME
)
{
return
LONG_TIME_ERROR
;
}
}
else
{
return
ERROR
;
}
}
sensor
.
tempValue
=
tmpTemperature
;
sensor
.
errorTime
=
0
;
sensor
.
prevTime
=
sensor
.
currentTime
;
return
SUCCESS
;
}
// DOWN temperature for solar system 1
static
DHT
dhtT1down
(
T1DOWN
,
DHT11
);
UPDATESTATE
t1down
(
float
*
temp
)
{
...
...
@@ -127,4 +169,3 @@ void temperatureBegin(void) {
dhtT2up
.
begin
();
dhtT2down
.
begin
();
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Stefan Gehr
@oz73ifuv
mentioned in commit
4abf1c75
·
Oct 13, 2022
mentioned in commit
4abf1c75
mentioned in commit 4abf1c753ad4c2afdc4840213549bd2662fd4132
Toggle commit list
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