update docs
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
- [Timer](timer.md)
|
||||
- [Icons](icons.md)
|
||||
- [Sounds](sounds.md)
|
||||
- [Hidden features](dev.md)
|
||||
|
||||
- API
|
||||
- [MQTT/HTTP](api.md)
|
||||
|
||||
@@ -45,4 +45,4 @@ Here's an example JSON object to display the text "Hello, AWTRIX Light!" with th
|
||||
|
||||
## Delete a custom app
|
||||
To delete a custom app simply send a empty payload/body to the same topic/url.
|
||||
You can also use [this API](api?id=addremove-and-rearange-apps)
|
||||
You can also use [this API](api?id=addremove-and-rearange-apps)
|
||||
15
docs/dev.md
Normal file
15
docs/dev.md
Normal file
@@ -0,0 +1,15 @@
|
||||
# Hidden Features
|
||||
|
||||
Ok, now they are no longer hidden :).
|
||||
This section contains small setting options that the majority of users do not change or change very rarely and therefore saved the effort of creating an elaborate settings interface.
|
||||
|
||||
Create a `dev.json` in your filemanager.
|
||||
|
||||
## JSON Properties
|
||||
|
||||
The JSON object has the following properties:
|
||||
|
||||
| Key | Type | Description | Default |
|
||||
| --- | ---- | ----------- | ------- |
|
||||
| `bootsound` | string | Uses a custom melodie from the MELODIES folder | standart |
|
||||
| `uppercase` | boolean | Print every character in uppercase | true |
|
||||
@@ -18,5 +18,6 @@ Hold down the middle button for 2s to exit the current menu and to save your set
|
||||
| `WEEKDAY` | Allows selection of start of week. |
|
||||
| `TEMP` | Allows selection of temperature system (°C or °F). |
|
||||
| `APPS` | Allows to enable or disable internal apps |
|
||||
| `SOUND` | Allows to enable or disable sound output |
|
||||
| `UPDATE` | Check and download new firmware if available. |
|
||||
|
||||
|
||||
@@ -51,6 +51,11 @@ void loadDevSettings()
|
||||
BOOT_SOUND = doc["bootsound"].as<String>();
|
||||
}
|
||||
|
||||
if (doc.containsKey("bootsound"))
|
||||
{
|
||||
UPPERCASE_LETTERS = doc["uppercase"].as<bool>();
|
||||
}
|
||||
|
||||
file.close();
|
||||
}
|
||||
|
||||
|
||||
@@ -37,83 +37,6 @@ void saveHandler()
|
||||
webRequest->send(200);
|
||||
}
|
||||
|
||||
void handleAPIRequest()
|
||||
{
|
||||
WebServerClass *webRequest = mws.getRequest();
|
||||
String url = webRequest->uri();
|
||||
url.replace("/api", "");
|
||||
if (webRequest->method() == HTTP_POST)
|
||||
{
|
||||
String body = webRequest->arg("plain");
|
||||
const char *bodyPtr = body.c_str();
|
||||
webRequest->send(200);
|
||||
if (url == "/notify")
|
||||
{
|
||||
if (body[0] != '{' || body[strlen(bodyPtr) - 1] != '}')
|
||||
{
|
||||
webRequest->send(400, "text/plain", "Invalid payload format");
|
||||
return;
|
||||
}
|
||||
DisplayManager.generateNotification(bodyPtr);
|
||||
}
|
||||
|
||||
else if (url == "/timer")
|
||||
{
|
||||
DisplayManager.gererateTimer(bodyPtr);
|
||||
}
|
||||
|
||||
else if (url == "/notify/dismiss")
|
||||
{
|
||||
DisplayManager.dismissNotify();
|
||||
}
|
||||
|
||||
else if (url == "/apps")
|
||||
{
|
||||
DisplayManager.updateAppVector(bodyPtr);
|
||||
}
|
||||
|
||||
else if (url == "/switch")
|
||||
{
|
||||
DisplayManager.switchToApp(bodyPtr);
|
||||
}
|
||||
|
||||
else if (url == "/settings")
|
||||
{
|
||||
DisplayManager.setNewSettings(bodyPtr);
|
||||
}
|
||||
|
||||
else if (url == "/nextapp")
|
||||
{
|
||||
DisplayManager.nextApp();
|
||||
}
|
||||
|
||||
else if (url == "/previousapp")
|
||||
{
|
||||
DisplayManager.previousApp();
|
||||
}
|
||||
|
||||
else if (url.startsWith("/custom"))
|
||||
{
|
||||
String topic_str = url.substring(MQTT_PREFIX.length() + 7);
|
||||
DisplayManager.generateCustomPage(topic_str, bodyPtr);
|
||||
}
|
||||
else
|
||||
{
|
||||
webRequest->send(400);
|
||||
}
|
||||
}
|
||||
else if (webRequest->method() == HTTP_GET)
|
||||
{
|
||||
if (url == "/stats")
|
||||
{
|
||||
webRequest->sendContent(DisplayManager.getStat());
|
||||
}
|
||||
else
|
||||
{
|
||||
webRequest->send(400);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ServerManager_::setup()
|
||||
{
|
||||
@@ -153,8 +76,6 @@ void ServerManager_::setup()
|
||||
mws.addHTML(custom_html, "icon_html");
|
||||
mws.addCSS(custom_css);
|
||||
mws.addJavascript(custom_script);
|
||||
mws.addOptionBox("General");
|
||||
mws.addOption("Uppercase letters", UPPERCASE_LETTERS);
|
||||
mws.addHandler("/save", HTTP_POST, saveHandler);
|
||||
mws.addHandler("/api/notify", HTTP_POST, []()
|
||||
{DisplayManager.generateNotification(mws.webserver->arg("plain").c_str()); mws.webserver->send(200,"OK"); });
|
||||
@@ -266,7 +187,6 @@ void ServerManager_::loadSettings()
|
||||
NET_SN = doc["Subnet"].as<String>();
|
||||
NET_PDNS = doc["Primary DNS"].as<String>();
|
||||
NET_SDNS = doc["Secondary DNS"].as<String>();
|
||||
UPPERCASE_LETTERS = doc["Uppercase letters"];
|
||||
file.close();
|
||||
DisplayManager.applyAllSettings();
|
||||
Serial.println(F("Configuration loaded"));
|
||||
|
||||
Reference in New Issue
Block a user