diff --git a/platformio.ini b/platformio.ini index 1a3f364..80d8549 100644 --- a/platformio.ini +++ b/platformio.ini @@ -8,12 +8,17 @@ ; Please visit documentation for the other options and examples ; https://docs.platformio.org/page/projectconf.html -[env:m5stack-atom] +[env] platform = espressif32 -board = m5stack-atom framework = arduino lib_deps = ttlappalainen/NMEA2000-library @ ^4.17.2 ttlappalainen/NMEA2000_esp32 @ ^1.0.3 ttlappalainen/NMEA0183 @ ^1.7.1 bblanchon/ArduinoJson@^6.18.5 + +[env:m5stack-atom] +board = m5stack-atom +lib_deps = + ${env.lib_deps} +build_flags= -D BOARD_M5ATOM diff --git a/src/index_html.h b/src/index_html.h index 416336c..ad15ab7 100644 --- a/src/index_html.h +++ b/src/index_html.h @@ -4,62 +4,13 @@ const char indexHTML[] PROGMEM = R"=====(
-#include// This will automatically choose right CAN library and create suitable NMEA2000 object @@ -32,6 +39,7 @@ #include "BoatData.h" + #define ENABLE_DEBUG_LOG 0 // Debug log, set to 1 to enable AIS forward on USB-Serial / 2 for ADC voltage to support calibration #define UDP_Forwarding 0 // Set to 1 for forwarding AIS from serial2 to UDP brodcast #define HighTempAlarm 12 // Alarm level for fridge temperature (higher) @@ -141,14 +149,15 @@ void debug_log(char* str) { #endif } -void Ereignis_Index() // Wenn "http:// /" aufgerufen wurde +void web_index() // Wenn "http:// /" aufgerufen wurde { webserver.send(200, "text/html", indexHTML); //dann Index Webseite senden } -void Ereignis_js() // Wenn "http:// /gauge.min.js" aufgerufen wurde +void js_reset() // Wenn "http:// /gauge.min.js" aufgerufen wurde { - webserver.send(200, "text/html", gauge); // dann gauge.min.js senden + Serial.println("Reset Button"); + ESP.restart(); } @@ -169,10 +178,10 @@ void setup() { // Init USB serial port Serial.begin(115200); - + Serial.println("Starting..."); // Init AIS serial port 2 - Serial2.begin(baudrate, rs_config); - NMEA0183.Begin(&Serial2, 3, baudrate); + //Serial2.begin(baudrate, rs_config); + //NMEA0183.Begin(&Serial2, 3, baudrate); if (WLAN_CLIENT == 1) { Serial.println("Start WLAN Client"); // WiFi Mode Client @@ -183,7 +192,7 @@ void setup() { while (WiFi.status() != WL_CONNECTED && wifi_retry < 20) { // Check connection, try 10 seconds wifi_retry++; - delay(500); + delay(5000); Serial.print("."); } } @@ -218,8 +227,8 @@ void setup() { // Start Web Server - webserver.on("/", Ereignis_Index); - webserver.on("/gauge.min.js", Ereignis_js); + webserver.on("/", web_index); + webserver.on("/api/reset", js_reset); webserver.onNotFound(handleNotFound); webserver.begin(); @@ -485,7 +494,7 @@ void loop() { WiFi.mode(WIFI_OFF); WiFi.mode(WIFI_STA); WiFi.begin(CL_ssid, CL_password); - delay(100); + delay(1000); } if (wifi_retry >= 5) { Serial.println("\nReboot"); // Did not work -> restart ESP32