mirror of
https://github.com/Genaker/LoraSA.git
synced 2026-03-28 17:42:59 +01:00
use serial hardware for json logs
This commit is contained in:
22
src/main.cpp
22
src/main.cpp
@@ -217,7 +217,17 @@ uint64_t scan_start_time = 0;
|
||||
#endif
|
||||
|
||||
// log data via serial console, JSON format:
|
||||
// #define LOG_DATA_JSON true
|
||||
#define LOG_DATA_JSON true
|
||||
|
||||
// Define which UART port to use (0, 1, or 2)
|
||||
#define SERIAL_PORT 1
|
||||
|
||||
// Define which pins to use
|
||||
#define TX_PIN 12
|
||||
#define RX_PIN 16 // not used
|
||||
|
||||
// Create HardwareSerial instance (UART 1 or 2)
|
||||
HardwareSerial SerialPort(SERIAL_PORT);
|
||||
|
||||
// #define WEB_SERVER true
|
||||
|
||||
@@ -620,7 +630,7 @@ void logToSerialTask(void *parameter)
|
||||
doc["value"] = String(highest_value_scanned);
|
||||
|
||||
serializeJson(doc, jsonOutput);
|
||||
Serial.println(jsonOutput);
|
||||
SerialPort.println(jsonOutput);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -677,6 +687,14 @@ void readConfigFile()
|
||||
void setup(void)
|
||||
{
|
||||
|
||||
#ifdef LOG_DATA_JSON
|
||||
Serial.begin(115200);
|
||||
|
||||
// Initialize custom Serial port
|
||||
// Parameters: baud rate, serial config, RX pin, TX pin
|
||||
SerialPort.begin(115200, SERIAL_8N1, RX_PIN, TX_PIN);
|
||||
#endif
|
||||
|
||||
#ifdef LILYGO
|
||||
setupBoards(); // true for disable U8g2 display library
|
||||
delay(500);
|
||||
|
||||
Reference in New Issue
Block a user