Fixed compiling of other configurations

This commit is contained in:
2021-06-28 14:38:03 +02:00
parent 56ebbe8055
commit 27ae2aba21
6 changed files with 28 additions and 20 deletions

View File

@ -10,6 +10,7 @@
#include "changevaluedisplay.h"
#include "displays/updatedisplay.h"
//#include "esputils.h"
#include "buttons.h"
namespace {
#ifdef FEATURE_WEBSERVER
@ -80,7 +81,7 @@ void initWebserver()
if (const auto *textInterface = constCurrentDisplay->asTextInterface())
{
HtmlTag h2Tag{"h2", response};
response->print(textInterface->text());
response->print(textInterface->text().c_str());
}
if (const auto *menuDisplay = constCurrentDisplay->asMenuDisplay())
@ -97,7 +98,7 @@ void initWebserver()
response->print("><a href=\"/triggerItem?index=");
response->print(i);
response->print("\">");
response->print(menuItem.text());
response->print(menuItem.text().c_str());
response->print("</a></li>");
i++;
@ -106,7 +107,7 @@ void initWebserver()
else if (const auto *changeValueDisplay = constCurrentDisplay->asChangeValueDisplayInterface())
{
response->print("<form action=\"/setValue\" method=\"GET\">");
response->print("<input type=\"number\" name=\"value\" value=\"" + std::to_string(changeValueDisplay->shownValue()) + "\" />");
response->print(("<input type=\"number\" name=\"value\" value=\"" + std::to_string(changeValueDisplay->shownValue()) + "\" />").c_str());
response->print("<button type=\"submit\">Update</button>");
response->print("</form>");
}

View File

@ -67,7 +67,7 @@ void UpdateDisplay::initScreen()
tft.setTextFont(4);
tft.setTextColor(TFT_YELLOW);
tft.drawString(m_title, 5, 5, 4);
tft.drawString(m_title.c_str(), 5, 5, 4);
tft.fillRect(0, 34, tft.width(), 3, TFT_WHITE);

View File

@ -8,8 +8,8 @@
#include "buttons.h"
namespace {
namespace dpad5wire
{
namespace dpad5wire {
#ifdef FEATURE_DPAD_5WIRESW
class State : public std::array<bool, 8>
{
public:
@ -95,7 +95,6 @@ State Helper<OUT, IN1, IN2, IN3, IN4>::read()
return result;
}
#ifdef FEATURE_DPAD_5WIRESW
Helper<PINS_DPAD_5WIRESW_OUT, PINS_DPAD_5WIRESW_IN1, PINS_DPAD_5WIRESW_IN2, PINS_DPAD_5WIRESW_IN3, PINS_DPAD_5WIRESW_IN4> helper;
State lastState;
millis_t debounceUp, debounceDown, debounceConfirm, debounceBack, debounceProfile0, debounceProfile1, debounceProfile2, debounceProfile3;
@ -170,5 +169,6 @@ void update()
lastState = newState;
}
#endif
}
}
} // namespace dpad5wire
} // namespace

View File

@ -5,7 +5,7 @@
#include <HardwareSerial.h>
#include "bobbycar-protocol/bobbycar-common.h"
#include "bobbycar-protocol/bobbycar-serial.h"
#include "types.h"
@ -13,13 +13,15 @@ namespace {
class FeedbackParser
{
public:
FeedbackParser(const std::reference_wrapper<HardwareSerial> &serial, bool &feedbackValid, Feedback &feedback) :
FeedbackParser(const std::reference_wrapper<HardwareSerial> &serial, bool &feedbackValid, bobbycar::protocol::serial::Feedback &feedback) :
m_serial{serial}, m_feedbackValid{feedbackValid}, m_feedback{feedback}
{
}
void update()
{
using namespace bobbycar::protocol::serial;
// Check for new data availability in the Serial buffer
while (m_serial.get().available())
{
@ -83,6 +85,6 @@ private:
millis_t m_lastFeedback{millis()};
const std::reference_wrapper<HardwareSerial> &m_serial;
bool &m_feedbackValid;
Feedback &m_feedback, m_newFeedback;
bobbycar::protocol::serial::Feedback &m_feedback, m_newFeedback;
};
}

View File

@ -14,14 +14,13 @@ void initOta()
{
ArduinoOTA
.onStart([]() {
std::to_string type;
if (ArduinoOTA.getCommand() == U_FLASH)
type = "sketch";
else if (ArduinoOTA.getCommand() == U_SPIFFS) // U_SPIFFS
type = "filesystem";
else
type = "unknown";
std::string type;
switch (ArduinoOTA.getCommand())
{
case U_FLASH: type = "sketch"; break;
case U_SPIFFS: type = "filesystem"; break;
default: type = "unknown";
}
switchScreenImpl<UpdateDisplay>("Updating " + type);
})
.onEnd([]() {

View File

@ -10,7 +10,12 @@
#include <WiFi.h>
#include <WString.h>
#ifdef FEATURE_CAN
#include "bobbycar-protocol/bobbycar-can.h"
#endif
#ifdef FEATURE_SERIAL
#include "bobbycar-protocol/bobbycar-serial.h"
#endif
#include "display.h"
#include "globals.h"
@ -257,6 +262,7 @@ void fixCommonParams()
void sendCommands()
{
#ifdef FEATURE_SERIAL
using namespace bobbycar::protocol::serial;
for (Controller &controller : controllers)
{
controller.command.start = Command::VALID_HEADER;