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
77fd1278
Commit
77fd1278
authored
Oct 14, 2022
by
Mario Engelmann
Browse files
Options
Downloads
Patches
Plain Diff
mostly comments
parent
0c588721
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
solarpump/solarpump.ino
+2
-2
2 additions, 2 deletions
solarpump/solarpump.ino
solarpump/soundFiles.h
+4
-2
4 additions, 2 deletions
solarpump/soundFiles.h
solarpump/temperature.ino
+17
-2
17 additions, 2 deletions
solarpump/temperature.ino
with
23 additions
and
6 deletions
solarpump/solarpump.ino
+
2
−
2
View file @
77fd1278
...
...
@@ -145,7 +145,7 @@ void displayLight(bool turnOn) {
lcd
.
backlight
();
prevMillis
=
millis
();
curState
=
true
;
// turn off after lightMillis ms
// turn off after lightMillis
(30 000
ms
)
}
else
if
(
curState
&&
millis
()
-
prevMillis
>
lightMillis
)
{
lcd
.
noBacklight
();
curState
=
false
;
...
...
This diff is collapsed.
Click to expand it.
solarpump/soundFiles.h
+
4
−
2
View file @
77fd1278
#ifndef SOUNDFILES_H
#define SOUNDFILES_H
// index for the sound files for mp3 module TDB380
// the files are .mp3 instead of .wav
/*
* index for the sound files for mp3 module TDB380
* the files are .mp3 instead of .wav
*/
#define SOUND_NULL 33 // A033.wav
#define SOUND_EIN 1 // A001.wav
#define SOUND_EINS 44 // A044.wav
...
...
This diff is collapsed.
Click to expand it.
solarpump/temperature.ino
+
17
−
2
View file @
77fd1278
...
...
@@ -4,25 +4,39 @@
#include
<DHT.h>
/* No new valid temperature for < 60 seconds? I sleep.
* No new valid temperature for > 60 seconds? REAL PROBLEM! */
* No new valid temperature for > 60 seconds? REAL PROBLEM!
*/
const
uint32_t
ERRORTIME
=
10000
;
// Update the temperature only every second
const
uint32_t
TEMPUPDATETIME
=
1000
;
// UP temperature for solar system 1
/*
* UP temperature for solar system 1
* 1. update only after a second (TEMPUPDATETIME) otherwise return UNCHANGED
* 2. get temperature from temperatur sensor check for errors
* 3. return ERROR if error occured first time
* 4. if error occurred longer than 10 s (ERRORTIME) return LONG_TIME_ERROR
* 5. update temperatur, time variables and return SUCCESS
* function below work the same, except that they use another
* temperature sensor library
*/
static
OneWire
oneWireT1up
(
T1UP
);
static
DallasTemperature
dallasTemps
(
&
oneWireT1up
);
UPDATESTATE
t1up
(
float
*
temp
)
{
static
uint32_t
prevMillis
=
0
;
static
uint32_t
errorStartMillis
=
0
;
uint32_t
curMillis
=
millis
();
// only update once a second
if
(
curMillis
-
prevMillis
<
TEMPUPDATETIME
)
{
return
UNCHANGED
;
}
// get temperature from sensor
dallasTemps
.
requestTemperatures
();
float
tempC
=
dallasTemps
.
getTempCByIndex
(
0
);
// check if error occured
if
(
tempC
==
DEVICE_DISCONNECTED_C
)
{
if
(
errorStartMillis
)
{
// check if error occurred longer than some seconds (10s)
if
(
curMillis
-
errorStartMillis
>
ERRORTIME
)
{
return
LONG_TIME_ERROR
;
}
...
...
@@ -32,6 +46,7 @@ UPDATESTATE t1up(float* temp) {
return
ERROR
;
}
// update temperature and time variables
*
temp
=
tempC
;
errorStartMillis
=
0
;
prevMillis
=
curMillis
;
...
...
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