-
Notifications
You must be signed in to change notification settings - Fork 168
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
Веб-морда для лампы #7
base: master
Are you sure you want to change the base?
Conversation
* шаблон/отправщик страницы | ||
*/ | ||
void responseHtml(String out, String title = "AlexGyver Lamp", int code = 200){ | ||
String html; |
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.
Не очень удобно читать, да и поддерживать, думаю. Может, можно в файл вынести и сюда как-то при сборке подставлять?
out += "\"on\":\"" + String(ONflag) + "\""; | ||
out += "}"; | ||
|
||
http.send(200, "text/json", out); |
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.
http.send(200, "text/json", out); | |
http.send(200, "application/json", out); |
out += "{"; | ||
out += "\"currentMode\":\"" + String(currentMode) + "\","; | ||
out += "\"brightness\":\"" + String(modes[currentMode].brightness) + "\","; | ||
out += "\"speed\":\"" + String(modes[currentMode].speed) + "\","; | ||
out += "\"scale\":\"" + String(modes[currentMode].scale) + "\","; | ||
out += "\"on\":\"" + String(ONflag) + "\""; | ||
out += "}"; |
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.
Думаю, стоит использовать библиотеку для сериализации, например, вот эту
Работает на порте 8080
Сильно не пинайте, опыт на C++ минимальный