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

FIX: build test with meteorolog command

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