#include #include #include #include "DisplayHelper.h" #include "WiFiManagerHelper.h" #include "main.h" #include #define SCREEN_WIDTH 128 // OLED display width, in pixels #define SCREEN_HEIGHT 64 // OLED display height, in pixels #define OLED_RESET -1 // Reset pin # (or -1 if sharing Arduino reset pin) #define SCREEN_ADDRESS 0x3C // If not work please scan the bus #define OLED_SDA 14 // D6 #define OLED_SCL 12 // D5 // Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET); Adafruit_SSD1306 *display; // Mode for command station operation // Remove conflicting definition, use extern from main.h // Mode currentMode = MODE_OFF; // Create web server instance on port 80 ESP8266WebServer server(80); // HTML content for welcome page const char* welcome_html = R"HTML( Welcome to ESP8266 DCC Command Station

Welcome!

This is your ESP8266 DCC Command Station.

Configure WiFi, manage XpressNet, and control your layout from here.

For documentation, see XpressNet Commands and Hardware Setup.

)HTML"; void handleWelcome() { server.send(200, "text/html", welcome_html); } void setup() { Serial.begin(115200); delay(100); Serial.println("[DEBUG] Serial started at 115200 baud"); displayInit(); Serial.println("[DEBUG] OLED display initialized"); setupWiFiManager(); server.on("/", handleWelcome); server.begin(); Serial.println("[DEBUG] Web server started"); } void loop() { server.handleClient(); delay(1000); }