This commit is contained in:
admin committed 2026-09-11 13:44:38 +07:00
1 parent 4c68deb6bb
commit 21168d8820
3 files changed
+43 -6

No files matched your search

+31
View File
@@ -87,14 +87,45 @@ void setup() {
Serial.print(F("Node ID: "));
Serial.println(NODE_ID);
#if OLED_ENABLED
// Khởi tạo màn hình OLED
Serial.println(F("[SETUP] Initializing OLED..."));
bool oledOk = false;
try {
oledOk = oledDisplay.begin();
if (oledOk) {
oledDisplay.showBootScreen(NODE_ID);
delay(2000); // Hiển thị màn hình boot 2 giây
} else {
Serial.println(F("[SETUP] OLED init failed, continuing without display"));
}
} catch (...) {
Serial.println(F("[SETUP] OLED init exception, continuing without display"));
oledOk = false;
}
#endif
Serial.println(F("[SETUP] Initializing radar..."));
radar.begin(RadarSerial, RADAR_RX_PIN, RADAR_TX_PIN, RADAR_BAUD_RATE,
NODE_ID, DEBUG_RADAR_RAW);
#if !DIAGNOSTIC_MODE
#if OLED_ENABLED
if (oledOk) oledDisplay.showWiFiConnecting(WIFI_SSID);
#endif
Serial.println(F("[SETUP] Starting WiFi..."));
webServer.begin(WIFI_SSID, WIFI_PASSWORD);
#if OLED_ENABLED
if (oledOk) oledDisplay.showWiFiConnected(WiFi.localIP());
#endif
#else
Serial.println(F("DIAGNOSTIC_MODE=1: Wi-Fi/web server disabled. Serial-only output."));
#if OLED_ENABLED
if (oledOk) oledDisplay.showDiagnosticMode();
#endif
#endif
Serial.println(F("[SETUP] Setup complete!"));
}
void loop() {