Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Käppler
ampel-firmware
Commits
9b11a49b
Commit
9b11a49b
authored
4 years ago
by
Eric Duminil
Browse files
Options
Download
Email Patches
Plain Diff
reset() refactor
parent
316d13bc
master
dev/calibnightmode
dev/configbreathing
dev/debugcalib
dev/fixstartup
dev/sensorstates
develop
refactor/calibration
No related merge requests found
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
co2_sensor.cpp
+2
-6
co2_sensor.cpp
co2_sensor.h
+1
-0
co2_sensor.h
led_effects.cpp
+11
-6
led_effects.cpp
led_effects.h
+1
-0
led_effects.h
mqtt.cpp
+1
-2
mqtt.cpp
util.cpp
+8
-0
util.cpp
util.h
+3
-0
util.h
with
27 additions
and
14 deletions
+27
-14
co2_sensor.cpp
+
2
-
6
View file @
9b11a49b
...
...
@@ -70,7 +70,7 @@ namespace sensor {
Serial
.
println
(
config
::
auto_calibrate_sensor
?
"ON."
:
"OFF."
);
}
//NOTE: should time offset be used to
rese
t measurement_timestep?
//NOTE: should time offset be used to
adjus
t measurement_timestep?
void
checkTimerDeviation
()
{
static
int32_t
previous_measurement_at
=
0
;
int32_t
now
=
millis
();
...
...
@@ -124,11 +124,7 @@ namespace sensor {
scd30
.
setForcedRecalibrationFactor
(
config
::
co2_calibration_level
);
Serial
.
println
(
F
(
" Done!"
));
Serial
.
println
(
F
(
"Sensor calibrated."
));
Serial
.
println
(
F
(
"Sensor will now restart."
));
LedEffects
::
showKITTWheel
(
color
::
green
,
5
);
//TODO: Add LEDs off and move to util::reset()
FS_LIB
.
end
();
ESP
.
restart
();
resetAmpel
();
}
void
logToSerial
()
{
...
...
This diff is collapsed.
Click to expand it.
co2_sensor.h
+
1
-
0
View file @
9b11a49b
...
...
@@ -6,6 +6,7 @@
#include
"src/lib/SparkFun_SCD30_Arduino_Library/src/SparkFun_SCD30_Arduino_Library.h"
// From: http://librarymanager/All#SparkFun_SCD30
#include
"config.h"
#include
"led_effects.h"
#include
"util.h"
#include
"csv_writer.h"
// To close filesystem before restart.
#include
<Wire.h>
...
...
This diff is collapsed.
Click to expand it.
led_effects.cpp
+
11
-
6
View file @
9b11a49b
...
...
@@ -38,7 +38,7 @@ namespace counter {
uint16_t
wheel_offset
=
0
;
uint16_t
kitt_offset
=
0
;
uint16_t
breathing_offset
=
0
;
}
// namespace counter
}
namespace
LedEffects
{
//On-board LED on D4, aka GPIO02
...
...
@@ -56,18 +56,23 @@ namespace LedEffects {
digitalWrite
(
ONBOARD_LED_PIN
,
LOW
);
}
void
LEDsOff
()
{
pixels
.
clear
();
pixels
.
show
();
onBoardLEDOff
();
}
void
setupRing
()
{
pixels
.
begin
();
pixels
.
setBrightness
(
config
::
max_brightness
);
pixels
.
clear
();
LEDsOff
();
}
void
toggleNightMode
()
{
config
::
night_mode
=
!
config
::
night_mode
;
if
(
config
::
night_mode
)
{
Serial
.
println
(
F
(
"NIGHT MODE!"
));
pixels
.
clear
();
pixels
.
show
();
LEDsOff
();
}
else
{
Serial
.
println
(
F
(
"DAY MODE!"
));
}
...
...
This diff is collapsed.
Click to expand it.
led_effects.h
+
1
-
0
View file @
9b11a49b
...
...
@@ -22,6 +22,7 @@ namespace LedEffects {
void
onBoardLEDOff
();
void
onBoardLEDOn
();
void
toggleNightMode
();
void
LEDsOff
();
void
setupRing
();
void
redAlert
();
...
...
This diff is collapsed.
Click to expand it.
mqtt.cpp
+
1
-
2
View file @
9b11a49b
...
...
@@ -162,8 +162,7 @@ namespace mqtt {
}
else
if
(
messageString
==
"local_ip"
)
{
sendInfoAboutLocalNetwork
();
}
else
if
(
messageString
==
"reset"
)
{
FS_LIB
.
end
();
ESP
.
restart
();
resetAmpel
();
}
else
{
LedEffects
::
showKITTWheel
(
color
::
red
,
1
);
Serial
.
println
(
F
(
"Message not supported. Doing nothing."
));
...
...
This diff is collapsed.
Click to expand it.
util.cpp
+
8
-
0
View file @
9b11a49b
...
...
@@ -38,6 +38,14 @@ namespace ntp {
}
}
void
resetAmpel
()
{
Serial
.
print
(
"Resetting"
);
FS_LIB
.
end
();
LedEffects
::
LEDsOff
();
delay
(
1000
);
ESP
.
restart
();
}
uint32_t
max_loop_duration
=
0
;
//FIXME: Remove every instance of Strings, to avoid heap fragmentation problems. (Start: "Free heap space : 17104 bytes")
...
...
This diff is collapsed.
Click to expand it.
util.h
+
3
-
0
View file @
9b11a49b
...
...
@@ -3,6 +3,7 @@
#include
<Arduino.h>
#include
"config.h"
#include
"wifi_util.h"
// To get MAC
#include
"csv_writer.h"
// To close filesystem before reset
#include
<WiFiUdp.h>
//required for NTP
#include
"src/lib/NTPClient-master/NTPClient.h"
// NTP
...
...
@@ -27,4 +28,6 @@ namespace ntp {
extern
uint32_t
max_loop_duration
;
const
extern
String
SENSOR_ID
;
void
resetAmpel
();
#endif
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Snippets