Commit 15d2d069 authored by Nelso Jost's avatar Nelso Jost

FIX: build test with meteorolog command

parent 9229f58c
...@@ -10,3 +10,5 @@ Session.vim ...@@ -10,3 +10,5 @@ Session.vim
get-pip.py* get-pip.py*
pid_* pid_*
__pycache__ __pycache__
*.sublime-project
*.sublime-workspace
\ No newline at end of file
...@@ -28,14 +28,15 @@ const int chipSelect = 4; ...@@ -28,14 +28,15 @@ const int chipSelect = 4;
void REPL_ARDUINO(REPL * repl); void REPL_ARDUINO(REPL * repl);
void REPL_METEOROLOG(REPL * repl); void REPL_METEOROLOG(REPL * repl);
//typedef struct
//{ typedef struct
//REPL * repl; {
//float interval; REPL * repl;
//String command; float interval;
//} METEORLOG_args; String command;
} METEOROLOG_args;
//void meteorolog_callback(METEOROLOG_args * args); void meteorolog_callback(METEOROLOG_args * args);
REPL_COMMAND commands[] =\ REPL_COMMAND commands[] =\
...@@ -72,8 +73,8 @@ void setup() ...@@ -72,8 +73,8 @@ void setup()
repl.log("\n[ERROR] Unable to initialize SD card."); repl.log("\n[ERROR] Unable to initialize SD card.");
} }
pinMode(PIN_BUTTON, INPUT); // pinMode(PIN_BUTTON, INPUT);
timer_button.attach(0.1, toggle_led); // timer_button.attach(0.1, toggle_led);
} }
...@@ -99,7 +100,6 @@ void toggle_led() ...@@ -99,7 +100,6 @@ void toggle_led()
} }
void REPL_ARDUINO(REPL * repl) void REPL_ARDUINO(REPL * repl)
{ {
Serial.println(); Serial.println();
...@@ -115,28 +115,30 @@ void REPL_ARDUINO(REPL * repl) ...@@ -115,28 +115,30 @@ void REPL_ARDUINO(REPL * repl)
void REPL_METEOROLOG(REPL * repl) void REPL_METEOROLOG(REPL * repl)
{ {
METEOROLOG_args * args = new METEOROLOG_args; METEOROLOG_args * args = new METEOROLOG_args;
float interval = repl->get_arg(1).toFloat(); args->interval = repl->get_arg(1).toFloat();
//args->command = repl->get_arg(2); args->command = repl->get_arg(2);
args->repl = repl;
if (interval == 0) if (args->interval == 0)
{ {
timer_meteorolog.detach(); timer_meteorolog.detach();
repl->log("\n[INFO] Deactivated meteorolog timer."); repl->log("\n[INFO] Deactivated meteorolog timer.");
} }
else else
{ {
timer_meteorolog.attach(interval, meteorolog_callback, repl); timer_meteorolog.attach(args->interval, meteorolog_callback, args);
repl->log("\n[INFO] Activated meteorolog timer with " + repl->log("\n[INFO] Activated meteorolog timer with " +
String(interval) + " s interval."); String(args->interval) + " s interval.");
meteorolog_callback(repl); meteorolog_callback(args);
} }
} }
void meteorolog_callback(REPL * repl) void meteorolog_callback(METEOROLOG_args * args)
{ {
Sd2Card sd_card; Sd2Card sd_card;
SdVolume sd_volume; SdVolume sd_volume;
REPL * repl = args->repl;
//repl->log("\n[INFO] Performing datalog.."); //repl->log("\n[INFO] Performing datalog..");
...@@ -160,8 +162,8 @@ void meteorolog_callback(REPL * repl) ...@@ -160,8 +162,8 @@ void meteorolog_callback(REPL * repl)
String arduino_response; String arduino_response;
Serial.println(); Serial.println();
arduinoSerial.print(repl->get_arg(2)); arduinoSerial.print(args->command);
repl->log("\n[INFO] Sent command '" + repl->get_arg(2) + "' to arduino."); repl->log("\n[INFO] Sent command '" + args->command + "' to arduino.");
delay(1500); delay(1500);
while (arduinoSerial.available()) while (arduinoSerial.available())
{ {
......
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