Commit a7ed9d7e authored by Nelso Jost's avatar Nelso Jost

FIX arduino trim() line

parent bd3b45ff
......@@ -2,7 +2,7 @@ include ../utils/platformio/Makefile
INOPROJECT = meteorolog
BAUD = 9600
BAUD = 115200
BOARD = uno
monitor: qtmonitor
......
......@@ -8,7 +8,7 @@
#include "mysensors.h"
#include "boardcommands.h"
#define BAUDRATE 9600
#define BAUDRATE 115200
String stream_line;
......@@ -25,6 +25,6 @@ void loop()
if (Serial.available())
{
stream_line = Serial.readString();
Serial.println(execute_board_command(stream_line));
Serial.println(execute_board_command(stream_line.trim()));
}
}
......@@ -56,16 +56,11 @@ RTC_DS1307 rtc;
String read_RTC_DS1307()
{
//if (!rtc.isrunning())
//{
//return String("<RTC_DS1307_not_found>");
//}
return get_datetime_str(rtc.now());
if (rtc.isrunning())
{
return get_datetime_str(rtc.now());
}
else
{
return String("<RTC_DS1307_not_found>");
}
}
String get_datetime_str(DateTime dt)
......
......@@ -23,9 +23,11 @@
#define ARDUINO_TX D1 // (soft RX)
#define ARDUINO_RX D2 // (soft TX)
#define ARDUINO_BAUDRATE 115200
const int chipSelect = 4;
void REPL_ARDUINO(REPL * repl);
void REPL_METEOROLOG(REPL * repl);
......@@ -38,10 +40,12 @@ typedef struct
String board_hash;
} METEOROLOG_args;
void meteorolog_callback(METEOROLOG_args * args);
void sd_datalog(String datalog, REPL * repl);
void server_datalog(String datalog, REPL * repl);
REPL_COMMAND commands[] =\
{
ALLCMD_REPL_GPIO,
......@@ -51,7 +55,7 @@ REPL_COMMAND commands[] =\
{"arduino", REPL_ARDUINO, "arduino <command>",
"Send command to Arduino via software serial."},
{"meteorolog", REPL_METEOROLOG, "meteorolog <interval> <command>",
{"meteorolog", REPL_METEOROLOG, "meteorolog <interval_secs> <arduino_command>",
"Activate meterolog timer on given interval (seconds)."},
{NULL}
......@@ -69,7 +73,7 @@ SoftwareSerial arduinoSerial(ARDUINO_TX, ARDUINO_RX); // RX, TX
void setup()
{
Serial.begin(BAUDRATE);
arduinoSerial.begin(9600);
arduinoSerial.begin(ARDUINO_BAUDRATE);
if (!SD.begin(chipSelect))
{
......@@ -199,4 +203,6 @@ void server_datalog(String datalog, REPL * repl)
String response = String("POST emm/api/post/rawsensordata HTTP/1.1\r\n") + \
"Host: dados.cta.if.ufrgs.br" + \
"Content-type: Application/JSON";
// TODO: IMPLEMENT HTML CLIENT REST API
}
......@@ -16,7 +16,7 @@
"Print WiFi connection status (debug)."}
#define CMD_REPL_WIFICONNECT {\
"wificonnect", REPL_WIFICONNECT, "wificonnect <ssid> <password>" \
"wificonnect", REPL_WIFICONNECT, "wificonnect <ssid> <password>", \
"Connect to a wifi network. If successful (threshold 10 sec), " \
"it will autoconnect if board reseted."}
......
......@@ -15,8 +15,8 @@ install-pip:
sudo python get-pip.py && rm get-pip.py
install-platformio:
which pip || $(MAKE) install-pip
sudo pip install platformio
which pip2 || $(MAKE) install-pip
sudo pip2 install platformio
sudo usermod -a -G dialout $$USER
wget https://raw.githubusercontent.com/platformio/platformio/develop/scripts/99-platformio-udev.rules
sudo mv -v 99-platformio-udev.rules /etc/udev/rules.d
......
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