Upload files to "/"
This commit is contained in:
70
config.h
Normal file
70
config.h
Normal file
@@ -0,0 +1,70 @@
|
||||
#ifndef CONFIG_H
|
||||
#define CONFIG_H
|
||||
|
||||
// ============================================================
|
||||
// ESP32 Serial Logger - Configuration
|
||||
// ESP-WROOM-32D DevKitC V4
|
||||
// ============================================================
|
||||
|
||||
// --- WiFi Configuration ---
|
||||
#define WIFI_SSID "YourSSID"
|
||||
#define WIFI_PASSWORD "YourPassword"
|
||||
#define WIFI_AP_SSID "ESP32_Logger"
|
||||
#define WIFI_AP_PASSWORD "12345678"
|
||||
#define WIFI_CONNECT_TIMEOUT 15000 // ms
|
||||
|
||||
// --- Serial2 (UART2) Pin Configuration ---
|
||||
#define SERIAL2_TX_PIN 17 // GPIO17
|
||||
#define SERIAL2_RX_PIN 16 // GPIO16
|
||||
|
||||
// --- Serial2 Default Settings ---
|
||||
#define DEFAULT_BAUD_RATE 115200
|
||||
#define DEFAULT_RX_BUFFER 4096
|
||||
|
||||
// --- HSPI SD Card Pin Configuration ---
|
||||
#define SD_HSPI_CLK 14
|
||||
#define SD_HSPI_MISO 26 // Remapped from GPIO12 (strapping pin)
|
||||
#define SD_HSPI_MOSI 13
|
||||
#define SD_HSPI_CS 15
|
||||
|
||||
// --- FreeRTOS Task Priorities ---
|
||||
#define TASK_PRIORITY_SERIAL 5 // Highest - must not miss data
|
||||
#define TASK_PRIORITY_SD_LOG 3 // Medium-high - buffered writes
|
||||
#define TASK_PRIORITY_WEB 2 // Medium - user interface
|
||||
#define TASK_PRIORITY_NTP 1 // Lowest - periodic sync
|
||||
|
||||
// --- FreeRTOS Task Stack Sizes ---
|
||||
#define TASK_STACK_SERIAL 4096
|
||||
#define TASK_STACK_SD_LOG 8192
|
||||
#define TASK_STACK_WEB 8192
|
||||
#define TASK_STACK_NTP 4096
|
||||
|
||||
// --- Queue Configuration ---
|
||||
#define QUEUE_SD_SIZE 512
|
||||
#define QUEUE_WEB_SIZE 256
|
||||
#define QUEUE_TX_SIZE 64
|
||||
|
||||
// --- Logging Configuration ---
|
||||
#define LOG_LINE_MAX_LEN 512
|
||||
#define SD_WRITE_INTERVAL 1000 // Flush to SD every N ms
|
||||
#define LOG_DIR "/logs"
|
||||
#define CSV_HEADER "Timestamp,Direction,Data\r\n"
|
||||
|
||||
// --- NTP Configuration ---
|
||||
#define NTP_SERVER "pool.ntp.org"
|
||||
#define NTP_GMT_OFFSET 32400 // KST = UTC+9 (9*3600)
|
||||
#define NTP_DAYLIGHT_OFFSET 0
|
||||
|
||||
// --- WebSocket Configuration ---
|
||||
#define WS_PORT 81
|
||||
#define WS_MAX_CLIENTS 4
|
||||
|
||||
// --- Log Entry Structure ---
|
||||
struct LogEntry {
|
||||
char timestamp[24]; // "2025-01-15 10:30:45.123"
|
||||
char direction; // 'R' for RX, 'T' for TX
|
||||
char data[LOG_LINE_MAX_LEN];
|
||||
uint16_t dataLen;
|
||||
};
|
||||
|
||||
#endif // CONFIG_H
|
||||
Reference in New Issue
Block a user