Skip to content
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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

CoOre
Copy link

@CoOre CoOre commented Jul 20, 2019

Работает на порте 8080
Сильно не пинайте, опыт на C++ минимальный

* шаблон/отправщик страницы
*/
void responseHtml(String out, String title = "AlexGyver Lamp", int code = 200){
String html;

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);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
http.send(200, "text/json", out);
http.send(200, "application/json", out);

Comment on lines +160 to +166
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 += "}";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Думаю, стоит использовать библиотеку для сериализации, например, вот эту

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants