Moved FEATURE_OTA into config-system
This commit is contained in:
@ -38,7 +38,6 @@ set(BOBBYCAR_BUILDFLAGS
|
||||
# -DFEATURE_SERIAL
|
||||
# -DFEATURE_MOSFETS
|
||||
-DFEATURE_WEBSERVER
|
||||
-DFEATURE_OTA
|
||||
# -DFEATURE_BLUETOOTH
|
||||
# -DFEATURE_BMS
|
||||
# -DFEATURE_GAMETRAK
|
||||
|
@ -38,7 +38,6 @@ set(BOBBYCAR_BUILDFLAGS
|
||||
# -DFEATURE_SERIAL
|
||||
# -DFEATURE_MOSFETS
|
||||
-DFEATURE_WEBSERVER
|
||||
-DFEATURE_OTA
|
||||
# -DFEATURE_BLUETOOTH
|
||||
# -DFEATURE_BMS
|
||||
# -DFEATURE_GAMETRAK
|
||||
|
@ -38,7 +38,6 @@ set(BOBBYCAR_BUILDFLAGS
|
||||
# -DFEATURE_SERIAL
|
||||
-DFEATURE_MOSFETS
|
||||
-DFEATURE_WEBSERVER
|
||||
-DFEATURE_OTA
|
||||
# -DFEATURE_BLUETOOTH
|
||||
# -DFEATURE_BMS
|
||||
# -DFEATURE_GAMETRAK
|
||||
|
@ -16,6 +16,7 @@ add_definitions(
|
||||
)
|
||||
|
||||
set(BOBBYCAR_BUILDFLAGS
|
||||
<<<<<<< HEAD
|
||||
-DFEATURE_ADC_IN
|
||||
-DPINS_GAS=34
|
||||
-DPINS_BREMS=35
|
||||
@ -74,6 +75,69 @@ set(BOBBYCAR_BUILDFLAGS
|
||||
# -DSWITCH_BLINK
|
||||
# -DFEATURE_IS_MIR_EGAL_OB_DER_WEBSERVER_KORREKT_ARBEITET
|
||||
-DFEATURE_ESPNOW
|
||||
=======
|
||||
# Pins
|
||||
-DPINS_GAS=34
|
||||
-DPINS_BREMS=35
|
||||
# -DPINS_RX1=4
|
||||
# -DPINS_TX1=5
|
||||
# -DPINS_RX2=22
|
||||
# -DPINS_TX2=23
|
||||
# -DPINS_MOSFET0=18
|
||||
# -DPINS_MOSFET1=19
|
||||
# -DPINS_MOSFET2=21
|
||||
# -DPINS_GAMETRAKX=34
|
||||
# -DPINS_GAMETRAKY=39
|
||||
# -DPINS_GAMETRAKDIST=36
|
||||
-DPINS_LEDBACKLIGHT=23
|
||||
-DPINS_LEDSTRIP=33
|
||||
|
||||
# Config flags
|
||||
-DFEATURE_ADC_IN
|
||||
-DFEATURE_CAN
|
||||
# -DFEATURE_SERIAL
|
||||
# -DFEATURE_MOSFETS
|
||||
# -DFEATURE_WEBSERVER
|
||||
# -DFEATURE_BLUETOOTH
|
||||
# -DFEATURE_BMS
|
||||
# -DFEATURE_GAMETRAK
|
||||
# -DFEATURE_POWERSUPPLY
|
||||
# -DFEATURE_LEDBACKLIGHT
|
||||
# -DFEATURE_ESPNOW
|
||||
|
||||
-DLEDBACKLIGHT_INVERTED
|
||||
# -DLEDSTRIP_WRONG_DIRECTION
|
||||
# -DHEAP_LRGST_CRASH_TEXT_FIX
|
||||
|
||||
# Default values
|
||||
-DDEFAULT_SWAPSCREENBYTES=false
|
||||
-DDEFAULT_INVERTFRONTLEFT=false
|
||||
-DDEFAULT_INVERTFRONTRIGHT=true
|
||||
-DDEFAULT_INVERTBACKLEFT=false
|
||||
-DDEFAULT_INVERTBACKRIGHT=true
|
||||
-DDEFAULT_WHEELDIAMETER=200
|
||||
-DDEFAULT_IMOTMAX=3
|
||||
-DDEFAULT_IDCMAX=4
|
||||
-DDEFAULT_NMOTMAX=2000
|
||||
-DDEFAULT_FIELDWEAKMAX=1
|
||||
-DDEFAULT_FIELDADVMAX=40
|
||||
|
||||
# DPAD
|
||||
-DFEATURE_DPAD_5WIRESW_2OUT
|
||||
-DPINS_DPAD_5WIRESW_OUT1=18
|
||||
-DPINS_DPAD_5WIRESW_OUT2=19
|
||||
-DPINS_DPAD_5WIRESW_IN1=4
|
||||
-DPINS_DPAD_5WIRESW_IN2=5
|
||||
-DPINS_DPAD_5WIRESW_IN3=27
|
||||
# -DFEATURE_DPAD_6WIRESW
|
||||
# -DPINS_DPAD_6WIRESW_OUT=4
|
||||
# -DPINS_DPAD_6WIRESW_IN1=5
|
||||
# -DPINS_DPAD_6WIRESW_IN2=27
|
||||
# -DPINS_DPAD_6WIRESW_IN3=18
|
||||
# -DPINS_DPAD_6WIRESW_IN4=19
|
||||
# -DPINS_DPAD_6WIRESW_IN5=26
|
||||
# -DFEATURE_GSCHISSENE_DIODE
|
||||
>>>>>>> 6934614 (Moved FEATURE_OTA into config-system)
|
||||
)
|
||||
|
||||
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/ignore/lockscreen_plugin.cmake")
|
||||
|
@ -38,7 +38,6 @@ set(BOBBYCAR_BUILDFLAGS
|
||||
# -DFEATURE_SERIAL
|
||||
# -DFEATURE_MOSFETS
|
||||
-DFEATURE_WEBSERVER
|
||||
-DFEATURE_OTA
|
||||
# -DFEATURE_BLUETOOTH
|
||||
# -DFEATURE_BMS
|
||||
# -DFEATURE_GAMETRAK
|
||||
|
@ -38,7 +38,6 @@ set(BOBBYCAR_BUILDFLAGS
|
||||
# -DFEATURE_SERIAL
|
||||
# -DFEATURE_MOSFETS
|
||||
# -DFEATURE_WEBSERVER
|
||||
# -DFEATURE_OTA
|
||||
# -DFEATURE_BLUETOOTH
|
||||
# -DFEATURE_BMS
|
||||
# -DFEATURE_GAMETRAK
|
||||
|
@ -38,7 +38,6 @@ set(BOBBYCAR_BUILDFLAGS
|
||||
# -DFEATURE_SERIAL
|
||||
# -DFEATURE_MOSFETS
|
||||
-DFEATURE_WEBSERVER
|
||||
-DFEATURE_OTA
|
||||
# -DFEATURE_BLUETOOTH
|
||||
# -DFEATURE_BMS
|
||||
# -DFEATURE_GAMETRAK
|
||||
|
@ -189,9 +189,7 @@ struct EnableLedstripStVOFrontlight : public NewSettingsAccessor<bool> { ConfigW
|
||||
struct AnimationMultiplierAccessor : public NewSettingsAccessor<int16_t> { ConfigWrapper<int16_t> &getConfig() const override { return configs.ledstrip.animationMultiplier; } };
|
||||
struct LedstripBrightnessAccessor : public NewSettingsAccessor<uint8_t> { ConfigWrapper<uint8_t> &getConfig() const override { return configs.ledstrip.brightness; } };
|
||||
struct LedstripEnableBlinkAnimationAccessor : public NewSettingsAccessor<bool> { ConfigWrapper<bool> &getConfig() const override { return configs.ledstrip.enableAnimBlink; } };
|
||||
#ifdef FEATURE_OTA
|
||||
struct LedstripOtaAnimationAccessor : public NewSettingsAccessor<OtaAnimationModes> { ConfigWrapper<OtaAnimationModes> &getConfig() const override { return configs.ledstrip.otaMode; } };
|
||||
#endif
|
||||
struct LedstripEnableVisualizeBlinkAnimationAccessor : public NewSettingsAccessor<bool> { ConfigWrapper<bool> &getConfig() const override { return configs.ledstrip.enableVisualizeBlink; } };
|
||||
|
||||
// Battery
|
||||
|
@ -16,8 +16,6 @@
|
||||
#include "globals.h"
|
||||
#include "newsettings.h"
|
||||
|
||||
#ifdef FEATURE_OTA
|
||||
|
||||
namespace buildserver {
|
||||
|
||||
uint16_t count_available_buildserver()
|
||||
@ -271,4 +269,3 @@ namespace buildserver {
|
||||
}
|
||||
} // namespace SelectBuild
|
||||
} // namespace buildserver
|
||||
#endif
|
||||
|
@ -6,7 +6,6 @@
|
||||
#include <asynchttprequest.h>
|
||||
#include <delayedconstruction.h>
|
||||
|
||||
#ifdef FEATURE_OTA
|
||||
namespace buildserver {
|
||||
|
||||
uint16_t count_available_buildserver();
|
||||
@ -48,4 +47,3 @@ namespace SelectBuild {
|
||||
bool get_request_running();
|
||||
} // namespace SelectBuild
|
||||
} // namespace buildserver
|
||||
#endif
|
||||
|
@ -8,11 +8,9 @@
|
||||
#include "esptexthelpers.h"
|
||||
#include "displays/menus/settingsmenu.h"
|
||||
|
||||
#ifdef FEATURE_OTA
|
||||
#include <espasyncota.h>
|
||||
#include <esp_ota_ops.h>
|
||||
#include "fmt/core.h"
|
||||
#endif
|
||||
|
||||
namespace {
|
||||
constexpr char TEXT_ABOUT[] = "About";
|
||||
@ -23,17 +21,13 @@ class CurrentVersionText : public virtual espgui::TextInterface
|
||||
public:
|
||||
std::string text() const override
|
||||
{
|
||||
#ifdef FEATURE_OTA
|
||||
if (const esp_app_desc_t *app_desc = esp_ota_get_app_description())
|
||||
{
|
||||
return fmt::format("Version: {}", app_desc->version);
|
||||
}
|
||||
#endif
|
||||
return "Version: 1.0";
|
||||
return "Version: Unkown";
|
||||
};
|
||||
};
|
||||
|
||||
constexpr char TEXT_VERSION[] = "Version: 1.0";
|
||||
} // namespace
|
||||
|
||||
AboutMenu::AboutMenu()
|
||||
|
@ -166,9 +166,8 @@ LedstripMenu::LedstripMenu()
|
||||
if (!simplified) { constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_STVO_FRONTLENGTH, LedsStVOFrontLengthAccessor>, espgui::SwitchScreenAction<StVOLengthChangeScreen>>>(); }
|
||||
|
||||
constructMenuItem<makeComponent<MenuItem, espgui::StaticText<TEXT_BLINKANIMATION>, espgui::SwitchScreenAction<LedstripSelectBlinkMenu>>>();
|
||||
#ifdef FEATURE_OTA
|
||||
if (!simplified) { constructMenuItem<makeComponent<MenuItem, espgui::StaticText<TEXT_LEDSTRIP_CHANGE_OTA_ANIM>, espgui::SwitchScreenAction<LedstripOtaAnimationChangeMenu>>>(); }
|
||||
#endif
|
||||
if (configs.feature.ota.value)
|
||||
if (!simplified) { constructMenuItem<makeComponent<MenuItem, espgui::StaticText<TEXT_LEDSTRIP_CHANGE_OTA_ANIM>, espgui::SwitchScreenAction<LedstripOtaAnimationChangeMenu>>>(); }
|
||||
constructMenuItem<makeComponent<MenuItem, espgui::StaticText<TEXT_ANIMATION_MULTIPLIER>, espgui::SwitchScreenAction<AnimationMultiplierChangeScreen>>>();
|
||||
if (!simplified) { constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_LEDSCOUNT, LedsCountAccessor>, espgui::SwitchScreenAction<LedsCountChangeScreen>>>(); }
|
||||
if (!simplified) { constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_CENTEROFFSET, CenterOffsetAccessor>, espgui::SwitchScreenAction<CenterOffsetChangeScreen>>>(); }
|
||||
|
@ -10,7 +10,6 @@
|
||||
#include "utils.h"
|
||||
#include "ledstripmenu.h"
|
||||
|
||||
#ifdef FEATURE_OTA
|
||||
namespace {
|
||||
constexpr char TEXT_BLINKANIMATION[] = "Blink animation";
|
||||
constexpr char TEXT_OTAANIM_NONE[] = "None";
|
||||
@ -47,4 +46,3 @@ void LedstripOtaAnimationChangeMenu::back()
|
||||
{
|
||||
espgui::switchScreen<LedstripMenu>();
|
||||
}
|
||||
#endif
|
||||
|
@ -3,7 +3,6 @@
|
||||
// local includes
|
||||
#include "displays/bobbymenudisplay.h"
|
||||
|
||||
#ifdef FEATURE_OTA
|
||||
class LedstripOtaAnimationChangeMenu : public BobbyMenuDisplay
|
||||
{
|
||||
public:
|
||||
@ -12,4 +11,3 @@ public:
|
||||
std::string text() const override;
|
||||
void back() override;
|
||||
};
|
||||
#endif
|
||||
|
@ -39,9 +39,7 @@
|
||||
#include "icons/settings.h"
|
||||
#include "icons/lock.h"
|
||||
#include "icons/demos.h"
|
||||
#ifdef FEATURE_OTA
|
||||
#include "icons/update.h"
|
||||
#endif
|
||||
#include "icons/neopixel.h"
|
||||
#include "icons/poweroff.h"
|
||||
#include "icons/reboot.h"
|
||||
@ -104,9 +102,8 @@ MainMenu::MainMenu()
|
||||
if (SHOWITEM) { constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_GARAGE>, SwitchScreenAction<GarageMenu>>>(); }
|
||||
}
|
||||
#endif
|
||||
#ifdef FEATURE_OTA
|
||||
if (SHOWITEM) { constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_UPDATE>, SwitchScreenAction<OtaMenu>, StaticMenuItemIcon<&bobbyicons::update>>>(); }
|
||||
#endif
|
||||
if (configs.feature.ota.value)
|
||||
if (SHOWITEM) { constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_UPDATE>, SwitchScreenAction<OtaMenu>, StaticMenuItemIcon<&bobbyicons::update>>>(); }
|
||||
if (SHOWITEM) { constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_GRAPHS>, SwitchScreenAction<GraphsMenu>, StaticMenuItemIcon<&bobbyicons::graph>>>(); }
|
||||
#if defined(FEATURE_CAN) && defined(FEATURE_POWERSUPPLY)
|
||||
if (SHOWITEM) { constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_POWERSUPPLY>, SwitchScreenAction<PowerSupplyDisplay>>>(); }
|
||||
|
@ -15,7 +15,6 @@
|
||||
#include "displays/menus/mainmenu.h"
|
||||
#include "displays/updatedisplay.h"
|
||||
|
||||
#ifdef FEATURE_OTA
|
||||
namespace {
|
||||
constexpr char TEXT_UPDATE[] = "Update";
|
||||
constexpr char TEXT_UPDATENOW[] = "Update now";
|
||||
@ -44,4 +43,3 @@ void OtaMenu::back()
|
||||
{
|
||||
espgui::switchScreen<MainMenu>();
|
||||
}
|
||||
#endif
|
||||
|
@ -1,4 +1,3 @@
|
||||
#ifdef FEATURE_OTA
|
||||
#include "selectbuildserverbranch.h"
|
||||
|
||||
// 3rd party includes
|
||||
@ -164,4 +163,3 @@ void SelectBuildserverBranchMenu::buildMenuRequestError(std::string error)
|
||||
item.setTitle(error);
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACK>, SwitchScreenAction<OtaMenu>, StaticMenuItemIcon<&espgui::icons::back>>>();
|
||||
}
|
||||
#endif
|
||||
|
@ -3,8 +3,6 @@
|
||||
// local includes
|
||||
#include "displays/bobbymenudisplay.h"
|
||||
|
||||
#ifdef FEATURE_OTA
|
||||
|
||||
class SelectBuildserverBranchMenu : public BobbyMenuDisplay
|
||||
{
|
||||
using Base = espgui::MenuDisplay;
|
||||
@ -17,5 +15,3 @@ public:
|
||||
void update() override;
|
||||
void back() override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -15,8 +15,6 @@
|
||||
#include "utils.h"
|
||||
#include "newsettings.h"
|
||||
|
||||
#ifdef FEATURE_OTA
|
||||
|
||||
using namespace buildserver::SelectBuild;
|
||||
|
||||
namespace {
|
||||
@ -84,4 +82,3 @@ void SelectBuildServerMenu::back()
|
||||
{
|
||||
espgui::switchScreen<OtaMenu>();
|
||||
}
|
||||
#endif
|
||||
|
@ -5,8 +5,6 @@
|
||||
// local includes
|
||||
#include "displays/bobbymenudisplay.h"
|
||||
|
||||
#ifdef FEATURE_OTA
|
||||
|
||||
class SelectBuildServerMenu : public BobbyMenuDisplay
|
||||
{
|
||||
public:
|
||||
@ -16,4 +14,3 @@ public:
|
||||
|
||||
void back() override;
|
||||
};
|
||||
#endif
|
||||
|
@ -15,7 +15,6 @@
|
||||
#include "globals.h"
|
||||
#include "newsettings.h"
|
||||
|
||||
#ifdef FEATURE_OTA
|
||||
#define MESSAGE(text) constructMenuItem<makeComponent<MenuItem, StaticText<text>, DefaultFont, StaticColor<TFT_RED>, DummyAction>>()
|
||||
|
||||
using namespace espgui;
|
||||
@ -151,4 +150,3 @@ void SelectBuildMenu::back()
|
||||
{
|
||||
switchScreen<OtaMenu>();
|
||||
}
|
||||
#endif
|
||||
|
@ -3,8 +3,6 @@
|
||||
// local includes
|
||||
#include "displays/bobbymenudisplay.h"
|
||||
|
||||
#ifdef FEATURE_OTA
|
||||
|
||||
class SelectBuildMenu : public BobbyMenuDisplay
|
||||
{
|
||||
using Base = BobbyMenuDisplay;
|
||||
@ -21,4 +19,3 @@ private:
|
||||
void buildMenuFromJson();
|
||||
void buildMenuRequestError(std::string error);
|
||||
};
|
||||
#endif
|
||||
|
@ -96,9 +96,8 @@ SettingsMenu::SettingsMenu()
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_CLOUDSETTINGS>, SwitchScreenAction<CloudSettingsMenu>>>();
|
||||
if (configs.feature.udpcloud.value)
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_UDPCLOUDSETTINGS>, SwitchScreenAction<UdpCloudSettingsMenu>>>();
|
||||
#ifdef FEATURE_OTA
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_SELECTBUILDSERVERMENU>, SwitchScreenAction<SelectBuildServerMenu>, StaticMenuItemIcon<&bobbyicons::update>>>();
|
||||
#endif
|
||||
if (configs.feature.ota.value)
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_SELECTBUILDSERVERMENU>, SwitchScreenAction<SelectBuildServerMenu>, StaticMenuItemIcon<&bobbyicons::update>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_TIME>, SwitchScreenAction<TimeSettingsMenu>, StaticMenuItemIcon<&bobbyicons::time>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_MODESSETTINGS>, SwitchScreenAction<ModesSettingsMenu>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_CONTROLLERHARDWARESETTINGS>, SwitchScreenAction<ControllerHardwareSettingsMenu>, StaticMenuItemIcon<&bobbyicons::hardware>>>();
|
||||
|
@ -10,10 +10,8 @@
|
||||
// 3rdparty lib includes
|
||||
#include <tftinstance.h>
|
||||
#include <screenmanager.h>
|
||||
#ifdef FEATURE_OTA
|
||||
#include <espasyncota.h>
|
||||
#include <esp_ota_ops.h>
|
||||
#endif
|
||||
|
||||
// local includes
|
||||
#include "globals.h"
|
||||
@ -21,7 +19,6 @@
|
||||
#include "displays/menus/otamenu.h"
|
||||
#include "newsettings.h"
|
||||
|
||||
#ifdef FEATURE_OTA
|
||||
void UpdateDisplay::initScreen()
|
||||
{
|
||||
Base::initScreen();
|
||||
@ -118,4 +115,3 @@ void UpdateDisplay::buttonPressed(espgui::Button button)
|
||||
default:;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -7,7 +7,6 @@
|
||||
// local includes
|
||||
#include "bobbydisplay.h"
|
||||
|
||||
#ifdef FEATURE_OTA
|
||||
class UpdateDisplay : public BobbyDisplay
|
||||
{
|
||||
using Base = BobbyDisplay;
|
||||
@ -28,4 +27,3 @@ private:
|
||||
|
||||
espgui::Label m_newVersionLabel{20, 275};
|
||||
};
|
||||
#endif
|
||||
|
@ -200,9 +200,7 @@ void showAnimation()
|
||||
{
|
||||
if (configs.ledstrip.enableLedAnimation.value
|
||||
&& !simplified
|
||||
#ifdef FEATURE_OTA
|
||||
&& !(asyncOtaTaskStarted && configs.ledstrip.otaMode.value != OtaAnimationModes::None)
|
||||
#endif
|
||||
)
|
||||
{
|
||||
switch (configs.ledstrip.animationType.value)
|
||||
@ -214,20 +212,17 @@ void showAnimation()
|
||||
default: showDefaultLedstrip();
|
||||
}
|
||||
}
|
||||
#ifdef FEATURE_OTA
|
||||
else if (asyncOtaTaskStarted && configs.ledstrip.otaMode.value != OtaAnimationModes::None)
|
||||
{
|
||||
// show ota animation
|
||||
showOtaAnimation();
|
||||
}
|
||||
#endif
|
||||
else
|
||||
{
|
||||
std::fill(std::begin(leds), std::end(leds), CRGB{0, 0, 0});
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef FEATURE_OTA
|
||||
void showOtaAnimation()
|
||||
{
|
||||
std::fill(std::begin(leds), std::end(leds), CRGB{0,0,0});
|
||||
@ -256,7 +251,6 @@ void showOtaAnimation()
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void showBetterRainbow()
|
||||
{
|
||||
|
@ -45,9 +45,7 @@ void showAnimation();
|
||||
void showBetterRainbow();
|
||||
void showSpeedSyncAnimation();
|
||||
void showCustomColor();
|
||||
#ifdef FEATURE_OTA
|
||||
void showOtaAnimation();
|
||||
#endif
|
||||
|
||||
void initLedStrip();
|
||||
void updateLedStrip();
|
||||
|
@ -314,6 +314,7 @@ public:
|
||||
ConfigWrapper<bool> dnsannounce {false, DoReset, {}, "f_dnsannounce" };
|
||||
ConfigWrapper<bool> ntp {false, DoReset, {}, "f_ntp" };
|
||||
ConfigWrapper<bool> ble {false, DoReset, {}, "f_ble" };
|
||||
ConfigWrapper<bool> ota {false, DoReset, {}, "f_ota" };
|
||||
ConfigWrapper<bool> gschissene_diode {false, DoReset, {}, "f_gschissDiode" };
|
||||
} feature;
|
||||
|
||||
@ -614,6 +615,7 @@ public:
|
||||
x(feature.dnsannounce) \
|
||||
x(feature.ntp) \
|
||||
x(feature.ble) \
|
||||
x(feature.ota) \
|
||||
x(feature.gschissene_diode)
|
||||
//x(bleSettings.bleEnabled)
|
||||
|
||||
@ -625,7 +627,8 @@ public:
|
||||
x(feature.cloud) \
|
||||
x(feature.dnsannounce) \
|
||||
x(feature.ntp) \
|
||||
x(feature.ble)
|
||||
x(feature.ble) \
|
||||
x(feature.ota)
|
||||
//x(feature.gschisseneDiode)
|
||||
|
||||
template<typename T>
|
||||
|
@ -6,7 +6,9 @@
|
||||
// 3rdparty lib includes
|
||||
#include <espwifistack.h>
|
||||
|
||||
#ifdef FEATURE_OTA
|
||||
// local includes
|
||||
#include "globals.h"
|
||||
|
||||
cpputils::DelayedConstruction<EspAsyncOta> asyncOta;
|
||||
bool asyncOtaTaskStarted{};
|
||||
|
||||
@ -26,6 +28,9 @@ void handleOta()
|
||||
|
||||
tl::expected<void, std::string> triggerOta(std::string_view url)
|
||||
{
|
||||
if (!configs.feature.ota.value)
|
||||
return tl::make_unexpected("OTA is not enabled!");
|
||||
|
||||
ESP_LOGI(TAG, "%.*s", url.size(), url.data());
|
||||
|
||||
if (!asyncOta)
|
||||
@ -49,4 +54,3 @@ tl::expected<void, std::string> triggerOta(std::string_view url)
|
||||
|
||||
return {};
|
||||
}
|
||||
#endif
|
||||
|
@ -1,18 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
// 3rdparty lib includes
|
||||
#ifdef FEATURE_OTA
|
||||
#include <espasyncota.h>
|
||||
#endif
|
||||
#include <delayedconstruction.h>
|
||||
|
||||
// local includes
|
||||
|
||||
#ifdef FEATURE_OTA
|
||||
extern cpputils::DelayedConstruction<EspAsyncOta> asyncOta;
|
||||
extern bool asyncOtaTaskStarted;
|
||||
|
||||
void initOta();
|
||||
void handleOta();
|
||||
tl::expected<void, std::string> triggerOta(std::string_view url);
|
||||
#endif
|
||||
|
@ -45,9 +45,7 @@
|
||||
#ifdef FEATURE_SERIAL
|
||||
#include "serial_bobby.h"
|
||||
#endif
|
||||
#ifdef FEATURE_OTA
|
||||
#include "ota.h"
|
||||
#endif
|
||||
#include "ble_bobby.h"
|
||||
#ifdef FEATURE_WEBSERVER
|
||||
#include "webserver.h"
|
||||
@ -108,9 +106,7 @@ BobbySchedulerTask schedulerTasksArr[] {
|
||||
#ifdef FEATURE_SERIAL
|
||||
BobbySchedulerTask { "serial", initSerial, updateSerial, 50ms },
|
||||
#endif
|
||||
#ifdef FEATURE_OTA
|
||||
BobbySchedulerTask { "ota", initOta, handleOta, 50ms },
|
||||
#endif
|
||||
BobbySchedulerTask { "ble", initBle, handleBle, 100ms },
|
||||
#ifdef FEATURE_WEBSERVER
|
||||
BobbySchedulerTask { "webserver", initWebserver, handleWebserver, 100ms },
|
||||
|
@ -20,9 +20,7 @@
|
||||
// local includes
|
||||
#include "webserver_lock.h"
|
||||
#include "webserver_displaycontrol.h"
|
||||
#ifdef FEATURE_OTA
|
||||
#include "webserver_ota.h"
|
||||
#endif
|
||||
#include "webserver_settings.h"
|
||||
#include "webserver_newsettings.h"
|
||||
#include "webserver_dumpnvs.h"
|
||||
@ -74,11 +72,9 @@ void initWebserver()
|
||||
httpd_uri_t { .uri = "/triggerItem", .method = HTTP_GET, .handler = webserver_triggerItem_handler, .user_ctx = NULL },
|
||||
httpd_uri_t { .uri = "/setValue", .method = HTTP_GET, .handler = webserver_setValue_handler, .user_ctx = NULL },
|
||||
httpd_uri_t { .uri = "/reboot", .method = HTTP_GET, .handler = webserver_reboot_handler, .user_ctx = NULL },
|
||||
#ifdef FEATURE_OTA
|
||||
httpd_uri_t { .uri = "/ota", .method = HTTP_GET, .handler = webserver_ota_handler, .user_ctx = NULL },
|
||||
httpd_uri_t { .uri = "/otaPercent", .method = HTTP_GET, .handler = webserver_ota_percentage_handler, .user_ctx = NULL },
|
||||
httpd_uri_t { .uri = "/triggerOta", .method = HTTP_GET, .handler = webserver_trigger_ota_handler, .user_ctx = NULL },
|
||||
#endif
|
||||
httpd_uri_t { .uri = "/settings", .method = HTTP_GET, .handler = webserver_settings_handler, .user_ctx = NULL },
|
||||
httpd_uri_t { .uri = "/saveSettings", .method = HTTP_GET, .handler = webserver_saveSettings_handler, .user_ctx = NULL },
|
||||
httpd_uri_t { .uri = "/newSettings", .method = HTTP_GET, .handler = webserver_newSettings_handler, .user_ctx = NULL },
|
||||
|
@ -181,10 +181,7 @@ esp_err_t webserver_root_handler(httpd_req_t *req)
|
||||
{
|
||||
HtmlTag pTag{"p", body};
|
||||
body += "<b>Display control</b> - "
|
||||
#ifdef FEATURE_OTA
|
||||
"<a href=\"/ota\">Update</a> - "
|
||||
#endif
|
||||
|
||||
"<a href=\"/settings\">Settings</a> - "
|
||||
"<a href=\"/newSettings\">New Settings</a> - "
|
||||
"<a href=\"/dumpnvs\">Dump NVS</a>";
|
||||
|
@ -38,9 +38,7 @@ typename std::enable_if<
|
||||
!std::is_same<T, espchrono::minutes32>::value &&
|
||||
!std::is_same<T, espchrono::DayLightSavingMode>::value &&
|
||||
!std::is_same<T, UnifiedModelMode>::value
|
||||
#ifdef FEATURE_OTA
|
||||
&& !std::is_same<T, OtaAnimationModes>::value
|
||||
#endif
|
||||
, bool>::type
|
||||
showInputForSetting(std::string_view key, T value, JsonObject &body)
|
||||
{
|
||||
@ -120,8 +118,6 @@ showInputForSetting(std::string_view key, T value, JsonObject &body)
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef FEATURE_OTA
|
||||
|
||||
template<typename T>
|
||||
typename std::enable_if<
|
||||
std::is_same<T, OtaAnimationModes>::value
|
||||
@ -131,7 +127,6 @@ showInputForSetting(std::string_view key, T value, JsonObject &body)
|
||||
body[key] = int(value);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
esp_err_t webserver_dump_nvs_handler(httpd_req_t *req)
|
||||
{
|
||||
|
@ -317,9 +317,7 @@ esp_err_t webserver_newSettings_handler(httpd_req_t *req)
|
||||
{
|
||||
HtmlTag pTag{"p", body};
|
||||
body += "<a href=\"/\">Display control</a> - "
|
||||
#ifdef FEATURE_OTA
|
||||
"<a href=\"/ota\">Update</a> - "
|
||||
#endif
|
||||
"<a href=\"/settings\">Settings</a> - "
|
||||
"<b>New Settings</b> - "
|
||||
"<a href=\"/dumpnvs\">Dump NVS</a>";
|
||||
|
@ -17,14 +17,12 @@
|
||||
#include <espstrutils.h>
|
||||
|
||||
// local includes
|
||||
#ifdef FEATURE_OTA
|
||||
#include "ota.h"
|
||||
#endif
|
||||
#include "webserver_lock.h"
|
||||
#include "globals.h"
|
||||
#include "newsettings.h"
|
||||
|
||||
#if defined(FEATURE_WEBSERVER) && defined(FEATURE_OTA)
|
||||
#ifdef FEATURE_WEBSERVER
|
||||
using namespace std::chrono_literals;
|
||||
using esphttpdutils::HtmlTag;
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
#endif
|
||||
#include <esp_err.h>
|
||||
|
||||
#if defined(FEATURE_WEBSERVER) && defined(FEATURE_OTA)
|
||||
#ifdef FEATURE_WEBSERVER
|
||||
esp_err_t webserver_ota_handler(httpd_req_t *req);
|
||||
esp_err_t webserver_ota_percentage_handler(httpd_req_t *req);
|
||||
esp_err_t webserver_trigger_ota_handler(httpd_req_t *req);
|
||||
|
@ -142,9 +142,7 @@ esp_err_t webserver_settings_handler(httpd_req_t *req)
|
||||
{
|
||||
HtmlTag pTag{"p", body};
|
||||
body += "<a href=\"/\">Display control</a> - "
|
||||
#ifdef FEATURE_OTA
|
||||
"<a href=\"/ota\">Update</a> - "
|
||||
#endif
|
||||
"<b>Settings</b> - "
|
||||
"<a href=\"/newSettings\">New Settings</a> - "
|
||||
"<a href=\"/dumpnvs\">Dump NVS</a>";
|
||||
|
Reference in New Issue
Block a user