Commit 3d479e99 authored by Eric Duminil's avatar Eric Duminil
Browse files

Int callback

parent 72c2ef74
...@@ -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::defineIntCallback("co2", setCO2forDebugging, " 1500 (Sets co2 level, for debugging purposes)");
sensor_commands::defineCallback("timer", setTimer, " 30 (Sets measurement interval, in s)"); sensor_commands::defineIntCallback("timer", setTimer, " 30 (Sets measurement interval, in s)");
sensor_commands::defineCallback("calibrate", calibrateSensorToSpecificPPM, sensor_commands::defineIntCallback("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::defineIntCallback("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?
......
...@@ -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::defineIntCallback("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);
} }
......
...@@ -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::defineIntCallback("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) {
......
...@@ -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 defineIntCallback(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++;
......
...@@ -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 defineIntCallback(const char *command, void (*function)(int32_t), const char *doc);
} }
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment