Compare commits
6 commits
Author | SHA1 | Date | |
---|---|---|---|
f033ce883f | |||
e3f0bec2fb | |||
d4c3fb6f2d | |||
36280ae2e3 | |||
410821e898 | |||
a7e4832b7a |
5 changed files with 82 additions and 21 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -3,3 +3,4 @@
|
||||||
.vscode/c_cpp_properties.json
|
.vscode/c_cpp_properties.json
|
||||||
.vscode/launch.json
|
.vscode/launch.json
|
||||||
.vscode/ipch
|
.vscode/ipch
|
||||||
|
.DS_Store
|
||||||
|
|
59
.vscode/settings.json
vendored
Normal file
59
.vscode/settings.json
vendored
Normal file
|
@ -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
|
||||||
|
}
|
|
@ -8,9 +8,10 @@
|
||||||
; Please visit documentation for the other options and examples
|
; Please visit documentation for the other options and examples
|
||||||
; https://docs.platformio.org/page/projectconf.html
|
; https://docs.platformio.org/page/projectconf.html
|
||||||
|
|
||||||
[env:wt32-eth01]
|
[env:default]
|
||||||
platform = espressif32
|
platform = espressif32
|
||||||
board = wt32-eth01
|
board = wt32-eth01
|
||||||
framework = arduino
|
framework = arduino
|
||||||
lib_deps = siwats/ESPMegaPROR3@^2.9.5
|
lib_deps = siwats/ESPMegaPROR3@^2.9.8
|
||||||
monitor_speed = 115200
|
monitor_speed = 115200
|
||||||
|
build_flags = -DCORE_DEBUG_LEVEL=0 -DSW_VERSION='"walkway-1.0.0"' -DBOARD_MODEL='"ESPMegaPRO R3.3c"'
|
30
src/main.cpp
30
src/main.cpp
|
@ -4,22 +4,12 @@ ESPMegaPRO espmega = ESPMegaPRO();
|
||||||
|
|
||||||
void setup()
|
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
|
// Initialize the ESPMegaPRO
|
||||||
ESP_LOGV("OS", "Initializing ESPMegaPRO");
|
ESP_LOGV("OS", "Initializing ESPMegaPRO");
|
||||||
espmega.begin();
|
espmega.begin();
|
||||||
espmega.inputs.preloadInputBuffer();
|
espmega.inputs.preloadInputBuffer();
|
||||||
|
// Initialize Inputs
|
||||||
|
espmega.inputs.registerCallback(&input_callback);
|
||||||
// Initialize IoT Modules
|
// Initialize IoT Modules
|
||||||
ESP_LOGV("OS", "Initializing IoT Modules");
|
ESP_LOGV("OS", "Initializing IoT Modules");
|
||||||
espmega.setTimezone("ICT-7");
|
espmega.setTimezone("ICT-7");
|
||||||
|
@ -30,8 +20,9 @@ void setup()
|
||||||
ESP_LOGD("OS", "Binding Ethernet Interface");
|
ESP_LOGD("OS", "Binding Ethernet Interface");
|
||||||
espmega.iot->bindEthernetInterface(Ð);
|
espmega.iot->bindEthernetInterface(Ð);
|
||||||
// Connect to Network
|
// Connect to Network
|
||||||
ESP_LOGV("OS", "Connecting to Network");
|
ESP_LOGV("OS", "Loading Network Config");
|
||||||
espmega.iot->loadNetworkConfig();
|
espmega.iot->loadNetworkConfig();
|
||||||
|
ESP_LOGV("OS", "Connecting to Network");
|
||||||
espmega.iot->connectNetwork();
|
espmega.iot->connectNetwork();
|
||||||
// Connect to the MQTT Broker
|
// Connect to the MQTT Broker
|
||||||
ESP_LOGV("OS", "Connecting to MQTT Broker");
|
ESP_LOGV("OS", "Connecting to MQTT Broker");
|
||||||
|
@ -41,16 +32,23 @@ void setup()
|
||||||
// Enable Web Server
|
// Enable Web Server
|
||||||
ESP_LOGV("OS", "Enabling Web Server");
|
ESP_LOGV("OS", "Enabling Web Server");
|
||||||
espmega.enableWebServer(80);
|
espmega.enableWebServer(80);
|
||||||
|
|
||||||
ESP_LOGV("OS", "Initializing Internal Display");
|
|
||||||
espmega.enableInternalDisplay(&INTERNAL_DISPLAY_UART);
|
|
||||||
// Register all cards with iot
|
// Register all cards with iot
|
||||||
ESP_LOGV("OS", "Registering Cards with IoT");
|
ESP_LOGV("OS", "Registering Cards with IoT");
|
||||||
espmega.iot->registerCard(0);
|
espmega.iot->registerCard(0);
|
||||||
espmega.iot->registerCard(1);
|
espmega.iot->registerCard(1);
|
||||||
|
// Enable Display
|
||||||
|
espmega.enableInternalDisplay(&Serial);
|
||||||
|
espmega.display->bindInputCard(&espmega.inputs);
|
||||||
|
espmega.display->bindOutputCard(&espmega.outputs);
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
{
|
{
|
||||||
espmega.loop();
|
espmega.loop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void input_callback(uint8_t pin, uint8_t state)
|
||||||
|
{
|
||||||
|
if(state!=1) return;
|
||||||
|
espmega.outputs.toggleState(pin);
|
||||||
|
}
|
|
@ -2,5 +2,7 @@
|
||||||
#include <ESPMegaProOS.hpp>
|
#include <ESPMegaProOS.hpp>
|
||||||
#include <ETH.h>
|
#include <ETH.h>
|
||||||
|
|
||||||
#define INTERNAL_DISPLAY_UART Serial
|
void setup();
|
||||||
#define INTERNAL_DISPLAY_BAUDRATE 115200
|
void loop();
|
||||||
|
|
||||||
|
void input_callback(uint8_t pin, uint8_t state);
|
Loading…
Add table
Add a link
Reference in a new issue