Various fixes due to package updates

This commit is contained in:
Thomas Kolb 2023-07-28 20:33:01 +02:00
parent 25abc446b0
commit 89160ed482
7 changed files with 31 additions and 27 deletions

View File

@ -4,7 +4,7 @@
#include "Animation.h"
#include <FreeRTOS.h>
#include <freertos/FreeRTOS.h>
#include <freertos/semphr.h>

View File

@ -2,6 +2,8 @@
#include <vector>
#include <cstdint>
class Fader
{
public:

View File

@ -2,7 +2,7 @@
#include <string>
#include <FreeRTOS.h>
#include <freertos/FreeRTOS.h>
#include <freertos/semphr.h>
#include "ChallengeResponse.h"

View File

@ -4,7 +4,7 @@
#include <HTTPResponse.hpp>
#include <HTTPServer.hpp>
#include <FreeRTOS.h>
#include <freertos/FreeRTOS.h>
#include <freertos/semphr.h>
#include "ChallengeResponse.h"

View File

@ -9,14 +9,14 @@
; https://docs.platformio.org/page/projectconf.html
[env:nodemcu-32s]
platform = espressif32
platform = espressif32 @ 5.2.0
board = nodemcu-32s
framework = arduino
monitor_speed = 115200
lib_deps =
ESP32 Digital RGB LED Drivers
esp32_https_server
ESP32 Digital RGB LED Drivers @ 1.5.4
esp32_https_server @ 1.0.0
build_flags = -std=c++11
build_flags = -std=c++11

View File

@ -115,13 +115,12 @@ void WebServer::handleColor(httpsserver::HTTPRequest *req, httpsserver::HTTPResp
httpsserver::ResourceParameters * params = req->getParams();
if(!params->isRequestParameterSet("color")) {
std::string colorstr;
if(!params->getQueryParameter("color", colorstr)) {
error400(res, "Parameter 'color' not set.");
return;
}
std::string colorstr = params->getRequestParameter("color");
Fader::Color color;
std::string errorMessage;
if(!parseColor(colorstr, &color, &errorMessage)) {
@ -150,17 +149,18 @@ void WebServer::handleSetAnim(httpsserver::HTTPRequest *req, httpsserver::HTTPRe
httpsserver::ResourceParameters * params = req->getParams();
if(!params->isRequestParameterSet("anim")) {
std::string animstr;
if(!params->getQueryParameter("anim", animstr)) {
error400(res, "Parameter 'anim' not set.");
return;
}
std::istringstream animstr(params->getRequestParameter("anim"));
std::istringstream animstream(animstr);
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.");
return;
}
@ -203,16 +203,10 @@ void WebServer::handleText(httpsserver::HTTPRequest *req, httpsserver::HTTPRespo
httpsserver::ResourceParameters * params = req->getParams();
if(!params->isRequestParameterSet("text")) {
error400(res, "Required parameter 'text' not set.");
return;
}
Fader::Color color;
if(params->isRequestParameterSet("color")) {
std::string colorstr = params->getRequestParameter("color");
std::string colorstr;
if(params->getQueryParameter("color", colorstr)) {
std::string errorMessage;
if(!parseColor(colorstr, &color, &errorMessage)) {
error400(res, errorMessage);
@ -222,8 +216,14 @@ void WebServer::handleText(httpsserver::HTTPRequest *req, httpsserver::HTTPRespo
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;
Font::textToBitmap(params->getRequestParameter("text").c_str(), &bmp, color);
Font::textToBitmap(text.c_str(), &bmp, color);
WebServer::instance().m_animController->changeAnimation(
std::unique_ptr<Animation>(
@ -237,7 +237,7 @@ void WebServer::handleUpdate(httpsserver::HTTPRequest *req, httpsserver::HTTPRes
httpsserver::ResourceParameters * params = req->getParams();
if(!params->isRequestParameterSet("content")) {
if(!params->isQueryParameterSet("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();
if(!params->isRequestParameterSet("response")) {
std::string response;
if(!params->getQueryParameter("response", response)) {
error400(res, "Parameter 'response' not set.");
return;
}
std::string response = params->getRequestParameter("response");
bool result = WebServer::instance().m_cr.verify(response);
if(result) {

View File

@ -6,7 +6,7 @@
#include <WiFiMulti.h>
#include <SPIFFS.h>
#include <FreeRTOS.h>
#include <freertos/FreeRTOS.h>
#include <freertos/semphr.h>
#include "WebServer.h"
@ -193,6 +193,8 @@ static void ledFSM(void)
// UDP packet received -> transition to UDP state
nextState = UDP;
ledState = TRANSITION;
// ensure the correct animation plays after UDP transfers stop
animController.changeAnimation(loadSavedAnimation(), false);
}
// change to last used animation after some time