Skip to content

Commit

Permalink
Add GPIOViewer library and link from Pins module
Browse files Browse the repository at this point in the history
index.js: support url to own IP

pio.ini: add GPIOViewer library

main.cpp: include declare and run GPIOViewer

SysModPins: add link to GPIOViewer

SysModules: adjust loop to allow for check on newConnection
  • Loading branch information
ewoudwijma committed Apr 5, 2024
1 parent 0314b55 commit cfd428c
Show file tree
Hide file tree
Showing 6 changed files with 953 additions and 941 deletions.
5 changes: 4 additions & 1 deletion data/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -880,7 +880,10 @@ function changeHTML(variable, commandJson, rowNr = UINT8_MAX) {
}
else if (node.className == "url") { //url links
node.innerText = "🔍";
node.setAttribute('href', commandJson.value);
if (commandJson.value.includes("<ip>"))
node.setAttribute('href', commandJson.value.replace("<ip>", "http://" + window.location.hostname));
else
node.setAttribute('href', commandJson.value);
}
else if (node.className == "canvas")
console.log("not called anymore");
Expand Down
2 changes: 1 addition & 1 deletion platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ lib_deps =
${ESPAsyncWebServer.lib_deps}
https://github.com/bblanchon/ArduinoJson.git#v7.0.3
; https://github.com/Jason2866/ESP32_Show_Info.git

thelastoutpostworkshop/GPIOViewer @ ^1.0.7



Expand Down
2 changes: 2 additions & 0 deletions src/Sys/SysModPins.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ void SysModPins::setup() {
ui->initCheckBox(parentVar, "pin19", true, false, updateGPIO);
#endif
// ui->initCheckBox(parentVar, "pin33", true);

ui->initURL(parentVar, "gpioViewer", "<ip>:8080", true);
}

void SysModPins::loop1s() {
Expand Down
11 changes: 6 additions & 5 deletions src/SysModules.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ void SysModules::setup() {
}

void SysModules::loop() {
if (newConnection) {
newConnection = false;
isConnected = true;
connectedChanged();
}

// bool oneSec = false;
bool tenSec = false;
// if (millis() - oneSecondMillis >= 1000) {
Expand Down Expand Up @@ -109,11 +115,6 @@ void SysModules::loop() {
// module->codeSizeManager();
}
}
if (newConnection) {
newConnection = false;
isConnected = true;
connectedChanged();
}

}

Expand Down
Loading

0 comments on commit cfd428c

Please sign in to comment.