From a7e4832b7a7170a5b9c61945cadb71d55d9bbf86 Mon Sep 17 00:00:00 2001 From: Siwat Sirichai Date: Tue, 8 Oct 2024 23:24:02 +0700 Subject: [PATCH 1/6] prepare env --- platformio.ini | 3 ++- src/main.cpp | 17 +++++------------ src/main.hpp | 6 ++++-- 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/platformio.ini b/platformio.ini index 8a2dbea..37f48db 100644 --- a/platformio.ini +++ b/platformio.ini @@ -13,4 +13,5 @@ platform = espressif32 board = wt32-eth01 framework = arduino lib_deps = siwats/ESPMegaPROR3@^2.9.5 -monitor_speed = 115200 \ No newline at end of file +monitor_speed = 115200 +build_flags = -DCORE_DEBUG_LEVEL=0 -DSW_VERSION='"walkway-1.0.0"' -DBOARD_MODEL='"ESPMegaPRO R3.3c"' \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index 67c98cd..947ece6 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4,18 +4,6 @@ ESPMegaPRO espmega = ESPMegaPRO(); void setup() { - // Initialize both displayports - INTERNAL_DISPLAY_UART.begin(INTERNAL_DISPLAY_BAUDRATE); - ESP_LOGI("OS", "Starting Initialization"); - INTERNAL_DISPLAY_UART.write(0xFF); - INTERNAL_DISPLAY_UART.write(0xFF); - INTERNAL_DISPLAY_UART.write(0xFF); - INTERNAL_DISPLAY_UART.print("rest"); - INTERNAL_DISPLAY_UART.write(0xFF); - INTERNAL_DISPLAY_UART.write(0xFF); - INTERNAL_DISPLAY_UART.write(0xFF); - // Wait for the display to reset - vTaskDelay(1000 / portTICK_PERIOD_MS); // Initialize the ESPMegaPRO ESP_LOGV("OS", "Initializing ESPMegaPRO"); espmega.begin(); @@ -54,3 +42,8 @@ void loop() { espmega.loop(); } + +void input_callback(uint8_t pin, uint8_t state) +{ + +} \ No newline at end of file diff --git a/src/main.hpp b/src/main.hpp index e661088..4152763 100644 --- a/src/main.hpp +++ b/src/main.hpp @@ -2,5 +2,7 @@ #include #include -#define INTERNAL_DISPLAY_UART Serial -#define INTERNAL_DISPLAY_BAUDRATE 115200 \ No newline at end of file +void setup(); +void loop(); + +void input_callback(uint8_t pin, uint8_t state); \ No newline at end of file From 410821e898094bd7738cb08e2632eb4801598a03 Mon Sep 17 00:00:00 2001 From: Siwat Sirichai Date: Tue, 8 Oct 2024 23:28:31 +0700 Subject: [PATCH 2/6] initial firmware r1 --- src/main.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 947ece6..dc43884 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -29,9 +29,6 @@ void setup() // Enable Web Server ESP_LOGV("OS", "Enabling Web Server"); espmega.enableWebServer(80); - - ESP_LOGV("OS", "Initializing Internal Display"); - espmega.enableInternalDisplay(&INTERNAL_DISPLAY_UART); // Register all cards with iot ESP_LOGV("OS", "Registering Cards with IoT"); espmega.iot->registerCard(0); @@ -45,5 +42,5 @@ void loop() void input_callback(uint8_t pin, uint8_t state) { - + espmega.outputs.toggleState(pin); } \ No newline at end of file From 36280ae2e32c3cecab68e90b872779c0a00ffaf5 Mon Sep 17 00:00:00 2001 From: Siwat Sirichai Date: Fri, 11 Oct 2024 22:09:14 +0700 Subject: [PATCH 3/6] library update --- platformio.ini | 2 +- src/main.cpp | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/platformio.ini b/platformio.ini index 37f48db..4f159e2 100644 --- a/platformio.ini +++ b/platformio.ini @@ -12,6 +12,6 @@ platform = espressif32 board = wt32-eth01 framework = arduino -lib_deps = siwats/ESPMegaPROR3@^2.9.5 +lib_deps = siwats/ESPMegaPROR3@^2.9.7 monitor_speed = 115200 build_flags = -DCORE_DEBUG_LEVEL=0 -DSW_VERSION='"walkway-1.0.0"' -DBOARD_MODEL='"ESPMegaPRO R3.3c"' \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index dc43884..b89333e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -18,8 +18,9 @@ void setup() ESP_LOGD("OS", "Binding Ethernet Interface"); espmega.iot->bindEthernetInterface(Ð); // Connect to Network - ESP_LOGV("OS", "Connecting to Network"); + ESP_LOGV("OS", "Loading Network Config"); espmega.iot->loadNetworkConfig(); + ESP_LOGV("OS", "Connecting to Network"); espmega.iot->connectNetwork(); // Connect to the MQTT Broker ESP_LOGV("OS", "Connecting to MQTT Broker"); @@ -42,5 +43,6 @@ void loop() void input_callback(uint8_t pin, uint8_t state) { + if(state!=1) return; espmega.outputs.toggleState(pin); } \ No newline at end of file From d4c3fb6f2dc9c3ad61f69ca8c95606ec8b1c50c4 Mon Sep 17 00:00:00 2001 From: Siwat Sirichai Date: Sun, 13 Oct 2024 23:34:03 +0700 Subject: [PATCH 4/6] update framework and enable display --- .vscode/settings.json | 59 +++++++++++++++++++++++++++++++++++++++++++ platformio.ini | 2 +- src/main.cpp | 4 +++ 3 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..d2e3661 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,59 @@ +{ + "C_Cpp_Runner.msvcBatchPath": "", + "C_Cpp_Runner.cCompilerPath": "gcc", + "C_Cpp_Runner.cppCompilerPath": "g++", + "C_Cpp_Runner.debuggerPath": "gdb", + "C_Cpp_Runner.cStandard": "", + "C_Cpp_Runner.cppStandard": "", + "C_Cpp_Runner.useMsvc": false, + "C_Cpp_Runner.warnings": [ + "-Wall", + "-Wextra", + "-Wpedantic", + "-Wshadow", + "-Wformat=2", + "-Wcast-align", + "-Wconversion", + "-Wsign-conversion", + "-Wnull-dereference" + ], + "C_Cpp_Runner.msvcWarnings": [ + "/W4", + "/permissive-", + "/w14242", + "/w14287", + "/w14296", + "/w14311", + "/w14826", + "/w44062", + "/w44242", + "/w14905", + "/w14906", + "/w14263", + "/w44265", + "/w14928" + ], + "C_Cpp_Runner.enableWarnings": true, + "C_Cpp_Runner.warningsAsError": false, + "C_Cpp_Runner.compilerArgs": [], + "C_Cpp_Runner.linkerArgs": [], + "C_Cpp_Runner.includePaths": [], + "C_Cpp_Runner.includeSearch": [ + "*", + "**/*" + ], + "C_Cpp_Runner.excludeSearch": [ + "**/build", + "**/build/**", + "**/.*", + "**/.*/**", + "**/.vscode", + "**/.vscode/**" + ], + "C_Cpp_Runner.useAddressSanitizer": false, + "C_Cpp_Runner.useUndefinedSanitizer": false, + "C_Cpp_Runner.useLeakSanitizer": false, + "C_Cpp_Runner.showCompilationTime": false, + "C_Cpp_Runner.useLinkTimeOptimization": false, + "C_Cpp_Runner.msvcSecureNoWarnings": false +} \ No newline at end of file diff --git a/platformio.ini b/platformio.ini index 4f159e2..65da1a6 100644 --- a/platformio.ini +++ b/platformio.ini @@ -12,6 +12,6 @@ platform = espressif32 board = wt32-eth01 framework = arduino -lib_deps = siwats/ESPMegaPROR3@^2.9.7 +lib_deps = siwats/ESPMegaPROR3@^2.9.8 monitor_speed = 115200 build_flags = -DCORE_DEBUG_LEVEL=0 -DSW_VERSION='"walkway-1.0.0"' -DBOARD_MODEL='"ESPMegaPRO R3.3c"' \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index b89333e..2888249 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -34,6 +34,10 @@ void setup() ESP_LOGV("OS", "Registering Cards with IoT"); espmega.iot->registerCard(0); espmega.iot->registerCard(1); + // Enable Display + espmega.enableInternalDisplay(&Serial); + espmega.display->bindInputCard(&espmega.inputs); + espmega.display->bindOutputCard(&espmega.outputs); } void loop() From e3f0bec2fbdf4d3e833cce25d037a54420e3cc9c Mon Sep 17 00:00:00 2001 From: Siwat Sirichai Date: Mon, 3 Mar 2025 12:06:51 +0700 Subject: [PATCH 5/6] change env to default --- .gitignore | 1 + platformio.ini | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 89cc49c..4de822f 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ .vscode/c_cpp_properties.json .vscode/launch.json .vscode/ipch +.DS_Store diff --git a/platformio.ini b/platformio.ini index 65da1a6..4b5ab7e 100644 --- a/platformio.ini +++ b/platformio.ini @@ -8,7 +8,7 @@ ; Please visit documentation for the other options and examples ; https://docs.platformio.org/page/projectconf.html -[env:wt32-eth01] +[env:default] platform = espressif32 board = wt32-eth01 framework = arduino From f033ce883fb7ab7e9ff6e22c3f215483d8f79bb7 Mon Sep 17 00:00:00 2001 From: Siwat Sirichai Date: Tue, 4 Mar 2025 17:02:05 +0700 Subject: [PATCH 6/6] add input registration --- src/main.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index 2888249..14119d7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -8,6 +8,8 @@ void setup() ESP_LOGV("OS", "Initializing ESPMegaPRO"); espmega.begin(); espmega.inputs.preloadInputBuffer(); + // Initialize Inputs + espmega.inputs.registerCallback(&input_callback); // Initialize IoT Modules ESP_LOGV("OS", "Initializing IoT Modules"); espmega.setTimezone("ICT-7");