Various fixes due to package updates
This commit is contained in:
parent
25abc446b0
commit
89160ed482
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
#include "Animation.h"
|
#include "Animation.h"
|
||||||
|
|
||||||
#include <FreeRTOS.h>
|
#include <freertos/FreeRTOS.h>
|
||||||
#include <freertos/semphr.h>
|
#include <freertos/semphr.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
class Fader
|
class Fader
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include <FreeRTOS.h>
|
#include <freertos/FreeRTOS.h>
|
||||||
#include <freertos/semphr.h>
|
#include <freertos/semphr.h>
|
||||||
|
|
||||||
#include "ChallengeResponse.h"
|
#include "ChallengeResponse.h"
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#include <HTTPResponse.hpp>
|
#include <HTTPResponse.hpp>
|
||||||
#include <HTTPServer.hpp>
|
#include <HTTPServer.hpp>
|
||||||
|
|
||||||
#include <FreeRTOS.h>
|
#include <freertos/FreeRTOS.h>
|
||||||
#include <freertos/semphr.h>
|
#include <freertos/semphr.h>
|
||||||
|
|
||||||
#include "ChallengeResponse.h"
|
#include "ChallengeResponse.h"
|
||||||
|
|
|
@ -9,14 +9,14 @@
|
||||||
; https://docs.platformio.org/page/projectconf.html
|
; https://docs.platformio.org/page/projectconf.html
|
||||||
|
|
||||||
[env:nodemcu-32s]
|
[env:nodemcu-32s]
|
||||||
platform = espressif32
|
platform = espressif32 @ 5.2.0
|
||||||
board = nodemcu-32s
|
board = nodemcu-32s
|
||||||
framework = arduino
|
framework = arduino
|
||||||
|
|
||||||
monitor_speed = 115200
|
monitor_speed = 115200
|
||||||
|
|
||||||
lib_deps =
|
lib_deps =
|
||||||
ESP32 Digital RGB LED Drivers
|
ESP32 Digital RGB LED Drivers @ 1.5.4
|
||||||
esp32_https_server
|
esp32_https_server @ 1.0.0
|
||||||
|
|
||||||
build_flags = -std=c++11
|
build_flags = -std=c++11
|
|
@ -115,13 +115,12 @@ void WebServer::handleColor(httpsserver::HTTPRequest *req, httpsserver::HTTPResp
|
||||||
|
|
||||||
httpsserver::ResourceParameters * params = req->getParams();
|
httpsserver::ResourceParameters * params = req->getParams();
|
||||||
|
|
||||||
if(!params->isRequestParameterSet("color")) {
|
std::string colorstr;
|
||||||
|
if(!params->getQueryParameter("color", colorstr)) {
|
||||||
error400(res, "Parameter 'color' not set.");
|
error400(res, "Parameter 'color' not set.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string colorstr = params->getRequestParameter("color");
|
|
||||||
|
|
||||||
Fader::Color color;
|
Fader::Color color;
|
||||||
std::string errorMessage;
|
std::string errorMessage;
|
||||||
if(!parseColor(colorstr, &color, &errorMessage)) {
|
if(!parseColor(colorstr, &color, &errorMessage)) {
|
||||||
|
@ -150,17 +149,18 @@ void WebServer::handleSetAnim(httpsserver::HTTPRequest *req, httpsserver::HTTPRe
|
||||||
|
|
||||||
httpsserver::ResourceParameters * params = req->getParams();
|
httpsserver::ResourceParameters * params = req->getParams();
|
||||||
|
|
||||||
if(!params->isRequestParameterSet("anim")) {
|
std::string animstr;
|
||||||
|
if(!params->getQueryParameter("anim", animstr)) {
|
||||||
error400(res, "Parameter 'anim' not set.");
|
error400(res, "Parameter 'anim' not set.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::istringstream animstr(params->getRequestParameter("anim"));
|
std::istringstream animstream(animstr);
|
||||||
|
|
||||||
uint32_t anim_id;
|
uint32_t anim_id;
|
||||||
animstr >> anim_id;
|
animstream >> anim_id;
|
||||||
|
|
||||||
if(animstr.bad() || animstr.fail()) {
|
if(animstream.bad() || animstream.fail()) {
|
||||||
error400(res, "Parameter 'anim' could not be parsed as number.");
|
error400(res, "Parameter 'anim' could not be parsed as number.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -203,16 +203,10 @@ void WebServer::handleText(httpsserver::HTTPRequest *req, httpsserver::HTTPRespo
|
||||||
|
|
||||||
httpsserver::ResourceParameters * params = req->getParams();
|
httpsserver::ResourceParameters * params = req->getParams();
|
||||||
|
|
||||||
if(!params->isRequestParameterSet("text")) {
|
|
||||||
error400(res, "Required parameter 'text' not set.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Fader::Color color;
|
Fader::Color color;
|
||||||
|
|
||||||
if(params->isRequestParameterSet("color")) {
|
std::string colorstr;
|
||||||
std::string colorstr = params->getRequestParameter("color");
|
if(params->getQueryParameter("color", colorstr)) {
|
||||||
|
|
||||||
std::string errorMessage;
|
std::string errorMessage;
|
||||||
if(!parseColor(colorstr, &color, &errorMessage)) {
|
if(!parseColor(colorstr, &color, &errorMessage)) {
|
||||||
error400(res, errorMessage);
|
error400(res, errorMessage);
|
||||||
|
@ -222,8 +216,14 @@ void WebServer::handleText(httpsserver::HTTPRequest *req, httpsserver::HTTPRespo
|
||||||
color = Fader::Color{0, 0, 0, 32};
|
color = Fader::Color{0, 0, 0, 32};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string text;
|
||||||
|
if(!params->getQueryParameter("text", text)) {
|
||||||
|
error400(res, "Required parameter 'text' not set.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Bitmap bmp;
|
Bitmap bmp;
|
||||||
Font::textToBitmap(params->getRequestParameter("text").c_str(), &bmp, color);
|
Font::textToBitmap(text.c_str(), &bmp, color);
|
||||||
|
|
||||||
WebServer::instance().m_animController->changeAnimation(
|
WebServer::instance().m_animController->changeAnimation(
|
||||||
std::unique_ptr<Animation>(
|
std::unique_ptr<Animation>(
|
||||||
|
@ -237,7 +237,7 @@ void WebServer::handleUpdate(httpsserver::HTTPRequest *req, httpsserver::HTTPRes
|
||||||
|
|
||||||
httpsserver::ResourceParameters * params = req->getParams();
|
httpsserver::ResourceParameters * params = req->getParams();
|
||||||
|
|
||||||
if(!params->isRequestParameterSet("content")) {
|
if(!params->isQueryParameterSet("content")) {
|
||||||
error400(res, "Send update image as 'content'.");
|
error400(res, "Send update image as 'content'.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -290,12 +290,12 @@ void WebServer::handleAuthTest(httpsserver::HTTPRequest *req, httpsserver::HTTPR
|
||||||
|
|
||||||
httpsserver::ResourceParameters * params = req->getParams();
|
httpsserver::ResourceParameters * params = req->getParams();
|
||||||
|
|
||||||
if(!params->isRequestParameterSet("response")) {
|
std::string response;
|
||||||
|
if(!params->getQueryParameter("response", response)) {
|
||||||
error400(res, "Parameter 'response' not set.");
|
error400(res, "Parameter 'response' not set.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string response = params->getRequestParameter("response");
|
|
||||||
bool result = WebServer::instance().m_cr.verify(response);
|
bool result = WebServer::instance().m_cr.verify(response);
|
||||||
|
|
||||||
if(result) {
|
if(result) {
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#include <WiFiMulti.h>
|
#include <WiFiMulti.h>
|
||||||
#include <SPIFFS.h>
|
#include <SPIFFS.h>
|
||||||
|
|
||||||
#include <FreeRTOS.h>
|
#include <freertos/FreeRTOS.h>
|
||||||
#include <freertos/semphr.h>
|
#include <freertos/semphr.h>
|
||||||
|
|
||||||
#include "WebServer.h"
|
#include "WebServer.h"
|
||||||
|
@ -193,6 +193,8 @@ static void ledFSM(void)
|
||||||
// UDP packet received -> transition to UDP state
|
// UDP packet received -> transition to UDP state
|
||||||
nextState = UDP;
|
nextState = UDP;
|
||||||
ledState = TRANSITION;
|
ledState = TRANSITION;
|
||||||
|
// ensure the correct animation plays after UDP transfers stop
|
||||||
|
animController.changeAnimation(loadSavedAnimation(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// change to last used animation after some time
|
// change to last used animation after some time
|
||||||
|
|
Loading…
Reference in a new issue