Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
co2ampel
ampel-firmware
Commits
3d479e99
Commit
3d479e99
authored
Apr 17, 2021
by
Eric Duminil
Browse files
Int callback
parent
72c2ef74
Changes
5
Hide whitespace changes
Inline
Side-by-side
ampel-firmware/co2_sensor.cpp
View file @
3d479e99
...
@@ -71,11 +71,11 @@ namespace sensor {
...
@@ -71,11 +71,11 @@ namespace sensor {
Serial
.
print
(
F
(
"Auto-calibration is "
));
Serial
.
print
(
F
(
"Auto-calibration is "
));
Serial
.
println
(
config
::
auto_calibrate_sensor
?
"ON."
:
"OFF."
);
Serial
.
println
(
config
::
auto_calibrate_sensor
?
"ON."
:
"OFF."
);
sensor_commands
::
defineCallback
(
"co2"
,
setCO2forDebugging
,
" 1500 (Sets co2 level, for debugging purposes)"
);
sensor_commands
::
define
Int
Callback
(
"co2"
,
setCO2forDebugging
,
" 1500 (Sets co2 level, for debugging purposes)"
);
sensor_commands
::
defineCallback
(
"timer"
,
setTimer
,
" 30 (Sets measurement interval, in s)"
);
sensor_commands
::
define
Int
Callback
(
"timer"
,
setTimer
,
" 30 (Sets measurement interval, in s)"
);
sensor_commands
::
defineCallback
(
"calibrate"
,
calibrateSensorToSpecificPPM
,
sensor_commands
::
define
Int
Callback
(
"calibrate"
,
calibrateSensorToSpecificPPM
,
" 600 (Starts calibration process, to given ppm)"
);
" 600 (Starts calibration process, to given ppm)"
);
sensor_commands
::
defineCallback
(
"calibrate!"
,
calibrateSensorRightNow
,
" 600 (Calibrates right now, to given ppm)"
);
sensor_commands
::
define
Int
Callback
(
"calibrate!"
,
calibrateSensorRightNow
,
" 600 (Calibrates right now, to given ppm)"
);
}
}
//NOTE: should timer deviation be used to adjust measurement_timestep?
//NOTE: should timer deviation be used to adjust measurement_timestep?
...
...
ampel-firmware/csv_writer.cpp
View file @
3d479e99
...
@@ -117,7 +117,7 @@ namespace csv_writer {
...
@@ -117,7 +117,7 @@ namespace csv_writer {
showFilesystemContent
();
showFilesystemContent
();
Serial
.
println
();
Serial
.
println
();
sensor_commands
::
defineCallback
(
"csv"
,
setCSVinterval
,
" 60 (Sets CSV writing interval, in s)"
);
sensor_commands
::
define
Int
Callback
(
"csv"
,
setCSVinterval
,
" 60 (Sets CSV writing interval, in s)"
);
// sensor_commands::defineCallback("format_filesystem", FS_LIB.format);
// sensor_commands::defineCallback("format_filesystem", FS_LIB.format);
}
}
...
...
ampel-firmware/mqtt.cpp
View file @
3d479e99
...
@@ -36,7 +36,7 @@ namespace mqtt {
...
@@ -36,7 +36,7 @@ namespace mqtt {
// mqttClient.setSocketTimeout(config::mqtt_timeout); //NOTE: somehow doesn't seem to have any effect on connect()
// mqttClient.setSocketTimeout(config::mqtt_timeout); //NOTE: somehow doesn't seem to have any effect on connect()
mqttClient
.
setServer
(
config
::
mqtt_server
,
config
::
mqtt_port
);
mqttClient
.
setServer
(
config
::
mqtt_server
,
config
::
mqtt_port
);
sensor_commands
::
defineCallback
(
"mqtt"
,
setMQTTinterval
,
" 60 (Sets MQTT sending interval, in s)"
);
sensor_commands
::
define
Int
Callback
(
"mqtt"
,
setMQTTinterval
,
" 60 (Sets MQTT sending interval, in s)"
);
}
}
void
publish
(
const
String
&
timestamp
,
int16_t
co2
,
float
temperature
,
float
humidity
)
{
void
publish
(
const
String
&
timestamp
,
int16_t
co2
,
float
temperature
,
float
humidity
)
{
...
...
ampel-firmware/sensor_commands.cpp
View file @
3d479e99
...
@@ -16,7 +16,7 @@ namespace sensor_commands {
...
@@ -16,7 +16,7 @@ namespace sensor_commands {
Callback
callbacks
[
MAX_CALLBACKS
];
Callback
callbacks
[
MAX_CALLBACKS
];
void
defineCallback
(
const
char
*
name
,
void
(
*
function
)(
int32_t
),
const
char
*
doc
)
{
void
define
Int
Callback
(
const
char
*
name
,
void
(
*
function
)(
int32_t
),
const
char
*
doc
)
{
if
(
callbacks_count
<
MAX_CALLBACKS
)
{
if
(
callbacks_count
<
MAX_CALLBACKS
)
{
callbacks
[
callbacks_count
]
=
Callback
(
name
,
function
,
doc
);
callbacks
[
callbacks_count
]
=
Callback
(
name
,
function
,
doc
);
callbacks_count
++
;
callbacks_count
++
;
...
...
ampel-firmware/sensor_commands.h
View file @
3d479e99
...
@@ -9,5 +9,5 @@
...
@@ -9,5 +9,5 @@
namespace
sensor_commands
{
namespace
sensor_commands
{
void
run
(
const
char
*
command
);
void
run
(
const
char
*
command
);
//TODO: Add defineIntCallback?
//TODO: Add defineIntCallback?
void
defineCallback
(
const
char
*
command
,
void
(
*
function
)(
int32_t
),
const
char
*
doc
);
void
define
Int
Callback
(
const
char
*
command
,
void
(
*
function
)(
int32_t
),
const
char
*
doc
);
}
}
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