-
Notifications
You must be signed in to change notification settings - Fork 3
Multiple Changes #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
1f8f84c
51369fa
8a15a14
8ed7c40
f69678f
f640435
5a26482
cabcd3b
9d53ea6
a8cd787
f75a1ef
1fe1859
35888ff
be1d083
e51a546
daf8a8b
fc787fd
c9453ea
0eabf74
a5be10d
a43de5c
418a7fa
5ad3d7a
6ab3507
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -258,4 +258,7 @@ paket-files/ | |
|
|
||
| # Python Tools for Visual Studio (PTVS) | ||
| __pycache__/ | ||
| *.pyc | ||
| *.pyc | ||
|
|
||
|
|
||
| tmp/* | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,5 @@ | ||
| # ConfigTool | ||
| ESP32 and ESP8266 Arduino library for easy saving and storing config variables. | ||
|
|
||
| Arduino or ESP8266 libraryy for easy saving and storing config variables. | ||
| Also has a handler to edit them via a webserver. | ||
|
|
||
| See [this example](https://github.com/Tvde1/ConfigTool/blob/master/examples/ConfigTool/ConfigTool.ino). | ||
| Handler to edit config via a webserver added in simple layout. | ||
| Each config variables can be hidden fully or its value. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,106 @@ | ||
| /** | ||
| * WebServer for ConfigTool. | ||
| */ | ||
|
|
||
| #include <ConfigTool.h> | ||
|
|
||
| #if defined(ARDUINO_ARCH_ESP8266) //ESP8266 | ||
| #include <ESP8266WiFi.h> | ||
| #include <ESP8266WebServer.h> | ||
| #include <ESP8266mDNS.h> | ||
| #define MDNS_NAME "esp8266" | ||
| #elif defined(ARDUINO_ARCH_ESP32) //ESP32 | ||
| #include <WiFi.h> | ||
| #include <WiFiClient.h> | ||
| #include <WebServer.h> | ||
| #include <ESPmDNS.h> | ||
| #define MDNS_NAME "esp32" | ||
| #endif | ||
|
|
||
| const char* ssid = "<ssid>"; | ||
| const char* password = "<pwd>"; | ||
|
|
||
| String config_String_1 = "Default"; | ||
| String config_String_2 = "Test"; | ||
| int config_int_1 = 100; | ||
| int config_int_2 = 200; | ||
| bool config_bool_F = false; | ||
| bool config_bool_T = true; | ||
| IPAddress config_IP_1 = IPAddress(192,168,1,99); | ||
|
|
||
| ConfigTool configTool; | ||
| WebServer server(80); | ||
|
|
||
| void initVariables() { | ||
| configTool.addVariable("String1", &config_String_1); | ||
| configTool.addVariable("String2", &config_String_2, false, true); | ||
| configTool.addVariable("int___1", &config_int_1); | ||
| configTool.addVariable("int___2", &config_int_2, true); | ||
| configTool.addVariable("bool__F", &config_bool_F); | ||
| configTool.addVariable("bool__T", &config_bool_T); | ||
| configTool.addVariable("bool__X", &config_bool_T, false, true); | ||
| configTool.addVariable("IP____1", &config_IP_1); | ||
| } | ||
|
|
||
|
|
||
| void handleRoot() { | ||
| server.send(200, "text/plain", "hello from esp!"); | ||
| } | ||
|
|
||
| void handleNotFound() { | ||
| String message = "File Not Found\n\n"; | ||
| message += "URI: "; | ||
| message += server.uri(); | ||
| message += "\nMethod: "; | ||
| message += (server.method() == HTTP_GET) ? "GET" : "POST"; | ||
| message += "\nArguments: "; | ||
| message += server.args(); | ||
| message += "\n"; | ||
| for (uint8_t i = 0; i < server.args(); i++) { | ||
| message += " " + server.argName(i) + ": " + server.arg(i) + "\n"; | ||
| } | ||
| server.send(404, "text/plain", message); | ||
| } | ||
|
|
||
| void setup(){ | ||
| Serial.begin(115200); | ||
| Serial.println("Setup begin"); | ||
|
|
||
| initVariables(); | ||
| configTool.load(); | ||
|
|
||
| WiFi.mode(WIFI_STA); | ||
| Serial.print("MAC: "); | ||
| Serial.println(WiFi.macAddress()); | ||
|
|
||
| WiFi.begin(ssid, password); | ||
| Serial.println(""); | ||
|
|
||
| // Wait for connection | ||
| while (WiFi.status() != WL_CONNECTED) { | ||
| delay(500); | ||
| Serial.print("."); | ||
| } | ||
| Serial.println(""); | ||
| Serial.print("Connected to "); | ||
| Serial.println(ssid); | ||
| Serial.print("IP address: "); | ||
| Serial.println(WiFi.localIP()); | ||
|
|
||
| if (MDNS.begin(MDNS_NAME)) { | ||
| Serial.println("MDNS responder started"); | ||
| } | ||
|
|
||
| server.on("/", handleRoot); | ||
|
|
||
| server.on("/config", configTool.getWebHandler(&server)); | ||
|
|
||
| server.onNotFound(handleNotFound); | ||
|
|
||
| server.begin(); | ||
| Serial.println("HTTP server started"); | ||
| } | ||
|
|
||
| void loop(void) { | ||
| server.handleClient(); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| # main class | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This for an IDE? |
||
| ConfigTool KEYWORD1 | ||
|
|
||
| # structs for variables | ||
| BaseVar KEYWORD3 | ||
| ConfigVar KEYWORD3 | ||
|
|
||
| # public functions of ConfigTool | ||
| load KEYWORD2 | ||
| save KEYWORD2 | ||
| reset KEYWORD2 | ||
| addVariable KEYWORD2 | ||
| getWebHandler KEYWORD2 | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,9 +1,10 @@ | ||||||
| name=ConfigTool | ||||||
| version=1.0 | ||||||
| author=Tvde1 | ||||||
| maintainer=Tvde1 | ||||||
| version=1.1 | ||||||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
It's quite a big change. Maybe use 2.0
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I also noticed the version is |
||||||
| author=Tvde1,gerdlanger | ||||||
| maintainer=gerdlanger | ||||||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
I very much appreciate the effort you have put in so it's very fair you are listed as author but I think that I should still be listed as the maintainer. I promise I'm not gonna abandon this library anytime soon :) |
||||||
| sentence=Save config variable and edit them online. | ||||||
| paragraph=No more hardcoding. This library will save and load config variables and you can edit them at an endpoint you choose. | ||||||
| category=Data Storage | ||||||
| url=https://github.com/Tvde1/ConfigTool | ||||||
| includes=ConfigTool.h | ||||||
| url=https://github.com/gerdlanger/ConfigTool | ||||||
| includes=ConfigTool.h | ||||||
| architectures=esp32,esp8266 | ||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add a comment for why this is added