Commit 6e522d4e authored by Eric Duminil's avatar Eric Duminil
Browse files

Simpler log

parent 591e2082
...@@ -5,6 +5,7 @@ namespace sensor_commands { ...@@ -5,6 +5,7 @@ namespace sensor_commands {
const uint8_t MAX_COMMAND_SIZE = 30; const uint8_t MAX_COMMAND_SIZE = 30;
uint8_t callbacks_count = 0; uint8_t callbacks_count = 0;
//TODO: Add example? Add description?
struct Callback { struct Callback {
Callback(const char *s = 0, void (*f)(int32_t) = 0) : Callback(const char *s = 0, void (*f)(int32_t) = 0) :
name(s), function(f) { name(s), function(f) {
...@@ -57,22 +58,19 @@ namespace sensor_commands { ...@@ -57,22 +58,19 @@ namespace sensor_commands {
} }
void listAvailableCallbacks() { void listAvailableCallbacks() {
Serial.println("DEBUG - Available commands :"); Serial.println(F("Message not supported. Doing nothing. Available commands :"));
for (uint8_t i = 0; i < callbacks_count; i++) { for (uint8_t i = 0; i < callbacks_count; i++) {
Serial.print(" "); Serial.print(" ");
Serial.println(callbacks[i].name); Serial.print(callbacks[i].name);
Serial.println(" 1234");
} }
led_effects::showKITTWheel(color::red, 1); led_effects::showKITTWheel(color::red, 1);
Serial.println(F("Message not supported. Doing nothing."));
} }
void run(const char *command) { void run(const char *command) {
char function_name[MAX_COMMAND_SIZE]; char function_name[MAX_COMMAND_SIZE];
int32_t parameter; int32_t parameter;
if (parseCommand(command, function_name, parameter)) { parseCommand(command, function_name, parameter);
listAvailableCallbacks();
return;
}
for (uint8_t i = 0; i < callbacks_count; i++) { for (uint8_t i = 0; i < callbacks_count; i++) {
if (!strcmp(function_name, callbacks[i].name)) { if (!strcmp(function_name, callbacks[i].name)) {
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "config.h" #include "config.h"
#include "util.h" #include "util.h"
#include "co2_sensor.h" #include "co2_sensor.h"
#include "sensor_commands.h"
#ifdef AMPEL_CSV #ifdef AMPEL_CSV
# include "csv_writer.h" # include "csv_writer.h"
#endif #endif
......
Markdown is supported
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