BIG ledstrip update
This commit is contained in:
Submodule components/TFT_eSPI updated: d27de95f6b...5731f928f6
Submodule components/arduino-esp32 updated: 8e447f5cd5...b0223be116
Submodule components/cpputils updated: e4176f9d0c...3cfb45a8ec
Submodule components/esp-gui-lib updated: bb27dd6d68...af7f8f3db0
Submodule components/espcpputils updated: a6ed293eab...1e0af13a52
Submodule components/espwifistack updated: 9d134d9f6c...dc31bacf98
@ -86,5 +86,5 @@ set(BOBBYCAR_BUILDFLAGS
|
||||
# -DFEATURE_WIRELESS_CONFIG
|
||||
-DFEATURE_LEDSTRIP
|
||||
-DPINS_LEDSTRIP=26
|
||||
-DLEDSTRIP_LENGTH=95
|
||||
-DLEDSTRIP_LENGTH=200
|
||||
)
|
||||
|
@ -144,6 +144,11 @@ struct LarsmModeModeAccessor : public RefAccessorSaveSettings<LarsmModeMode> { L
|
||||
struct LarsmModeIterationsAccessor : public RefAccessorSaveSettings<uint8_t> { uint8_t &getRef() const override { return settings.larsmMode.iterations; } };
|
||||
|
||||
#ifdef FEATURE_LEDSTRIP
|
||||
struct EnableLedAnimationAccessor : public RefAccessorSaveSettings<bool> { bool &getRef() const override { return settings.ledstrip.enableLedAnimation; } };
|
||||
struct EnableBrakeLightsAccessor : public RefAccessorSaveSettings<bool> { bool &getRef() const override { return settings.ledstrip.enableBrakeLights; } };
|
||||
struct LedsCountAccessor : public RefAccessorSaveSettings<int16_t> { int16_t &getRef() const override { return settings.ledstrip.ledsCount; } };
|
||||
struct CenterOffsetAccessor : public RefAccessorSaveSettings<int16_t> { int16_t &getRef() const override { return settings.ledstrip.centerOffset; } };
|
||||
struct SmallOffsetAccessor : public RefAccessorSaveSettings<int16_t> { int16_t &getRef() const override { return settings.ledstrip.smallOffset; } };
|
||||
struct BigOffsetAccessor : public RefAccessorSaveSettings<int16_t> { int16_t &getRef() const override { return settings.ledstrip.bigOffset; } };
|
||||
#endif
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ void initCloud()
|
||||
if (!cloudClient)
|
||||
return;
|
||||
|
||||
if (wifi_stack::get_sta_status() != wifi_stack::WiFiStaStatus::WL_CONNECTED)
|
||||
if (wifi_stack::get_sta_status() != wifi_stack::WiFiStaStatus::CONNECTED)
|
||||
return;
|
||||
|
||||
startCloud();
|
||||
@ -54,7 +54,7 @@ void handleCloud()
|
||||
if (espchrono::ago(lastStartTry) < 10s)
|
||||
return;
|
||||
|
||||
if (wifi_stack::get_sta_status() != wifi_stack::WiFiStaStatus::WL_CONNECTED)
|
||||
if (wifi_stack::get_sta_status() != wifi_stack::WiFiStaStatus::CONNECTED)
|
||||
return;
|
||||
|
||||
startCloud();
|
||||
@ -66,7 +66,7 @@ void handleCloud()
|
||||
return;
|
||||
|
||||
std::string rssi = "null";
|
||||
if (wifi_stack::get_sta_status() == wifi_stack::WiFiStaStatus::WL_CONNECTED)
|
||||
if (wifi_stack::get_sta_status() == wifi_stack::WiFiStaStatus::CONNECTED)
|
||||
if (const auto &result = wifi_stack::get_sta_ap_info(); result)
|
||||
rssi = std::to_string(result->rssi);
|
||||
|
||||
|
@ -1,8 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
// system includes
|
||||
#include <bitset>
|
||||
#include <memory>
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <randomutils.h>
|
||||
#include <esprandom.h>
|
||||
|
||||
// local includes
|
||||
#include "display.h"
|
||||
#include "actions/switchscreenaction.h"
|
||||
|
||||
@ -132,7 +138,7 @@ void GameOfLifeDisplay::initGrid()
|
||||
(*m_grid)[index(x,y)] = 0;
|
||||
else
|
||||
{
|
||||
if (random(3) == 1)
|
||||
if (cpputils::randomNumber<uint8_t>(4, espcpputils::esp_random_device{}) == 1)
|
||||
(*m_grid)[index(x,y)] = 1;
|
||||
else
|
||||
(*m_grid)[index(x,y)] = 0;
|
||||
|
@ -7,6 +7,8 @@
|
||||
// 3rdparty lib includes
|
||||
#include <espchrono.h>
|
||||
#include <fmt/core.h>
|
||||
#include <randomutils.h>
|
||||
#include <esprandom.h>
|
||||
|
||||
// local includes
|
||||
#include "menudisplay.h"
|
||||
@ -36,8 +38,8 @@ public:
|
||||
const auto now = espchrono::millis_clock::now();
|
||||
if (!m_nextUpdate || now >= *m_nextUpdate)
|
||||
{
|
||||
m_title = fmt::format("Dynamic text: {}", random(0, 100));
|
||||
m_nextUpdate = now + std::chrono::milliseconds{random(0, 1000)};
|
||||
m_title = fmt::format("Dynamic text: {}", cpputils::randomNumber<uint8_t>(100, espcpputils::esp_random_device{}));
|
||||
m_nextUpdate = now + std::chrono::milliseconds{cpputils::randomNumber<long>(100, 1000, espcpputils::esp_random_device{})};
|
||||
}
|
||||
|
||||
return m_title;
|
||||
@ -57,8 +59,8 @@ public:
|
||||
if (!m_nextUpdate || now >= *m_nextUpdate)
|
||||
{
|
||||
const auto count = std::size(default_4bit_palette);
|
||||
m_color = default_4bit_palette[random(0, count)];
|
||||
m_nextUpdate = now + std::chrono::milliseconds{random(0, 1000)};
|
||||
m_color = default_4bit_palette[cpputils::randomNumber<uint32_t>(count-1, espcpputils::esp_random_device{})];
|
||||
m_nextUpdate = now + std::chrono::milliseconds{cpputils::randomNumber<long>(100, 1000, espcpputils::esp_random_device{})};
|
||||
}
|
||||
|
||||
return m_color;
|
||||
@ -77,8 +79,9 @@ public:
|
||||
const auto now = espchrono::millis_clock::now();
|
||||
if (!m_nextUpdate || now >= *m_nextUpdate)
|
||||
{
|
||||
m_font = random(1, 5);
|
||||
m_nextUpdate = now + std::chrono::milliseconds{random(0, 1000)};
|
||||
constexpr const int fonts[] = { 2, 4 };
|
||||
m_font = fonts[cpputils::randomNumber<uint32_t>(std::size(fonts)-1, espcpputils::esp_random_device{})];
|
||||
m_nextUpdate = now + std::chrono::milliseconds{cpputils::randomNumber<long>(100, 1000, espcpputils::esp_random_device{})};
|
||||
}
|
||||
|
||||
return m_font;
|
||||
@ -101,7 +104,7 @@ public:
|
||||
m_icon = nullptr;
|
||||
else
|
||||
m_icon = &icons::lock;
|
||||
m_nextUpdate = now + std::chrono::milliseconds{random(0, 1000)};
|
||||
m_nextUpdate = now + std::chrono::milliseconds{cpputils::randomNumber<long>(100, 1000, espcpputils::esp_random_device{})};
|
||||
}
|
||||
|
||||
return m_icon;
|
||||
|
@ -13,6 +13,7 @@
|
||||
#ifdef FEATURE_LEDSTRIP
|
||||
#include "ledstrip.h"
|
||||
#endif
|
||||
#include "changevaluedisplay.h"
|
||||
|
||||
// forward declares
|
||||
namespace {
|
||||
@ -23,7 +24,49 @@ using namespace espgui;
|
||||
|
||||
namespace {
|
||||
#ifdef FEATURE_LEDSTRIP
|
||||
struct EnableLedAnimationAccessor : public RefAccessor<bool> { bool &getRef() const override { return enableLedAnimation; } };
|
||||
class LedstripMenu;
|
||||
|
||||
struct BlinkAnimationAccessor : public RefAccessor<int16_t> { int16_t &getRef() const override { return blinkAnimation; } };
|
||||
|
||||
using BlinkAnimationChangeScreen = makeComponent<
|
||||
ChangeValueDisplay<int16_t>,
|
||||
StaticText<TEXT_BLINKANIMATION>,
|
||||
BlinkAnimationAccessor,
|
||||
BackActionInterface<SwitchScreenAction<LedstripMenu>>,
|
||||
SwitchScreenAction<LedstripMenu>
|
||||
>;
|
||||
|
||||
using LedsCountChangeScreen = makeComponent<
|
||||
ChangeValueDisplay<int16_t>,
|
||||
StaticText<TEXT_LEDSCOUNT>,
|
||||
LedsCountAccessor,
|
||||
BackActionInterface<SwitchScreenAction<LedstripMenu>>,
|
||||
SwitchScreenAction<LedstripMenu>
|
||||
>;
|
||||
|
||||
using CenterOffsetChangeScreen = makeComponent<
|
||||
ChangeValueDisplay<int16_t>,
|
||||
StaticText<TEXT_CENTEROFFSET>,
|
||||
CenterOffsetAccessor,
|
||||
BackActionInterface<SwitchScreenAction<LedstripMenu>>,
|
||||
SwitchScreenAction<LedstripMenu>
|
||||
>;
|
||||
|
||||
using SmallOffsetChangeScreen = makeComponent<
|
||||
ChangeValueDisplay<int16_t>,
|
||||
StaticText<TEXT_SMALLOFFSET>,
|
||||
SmallOffsetAccessor,
|
||||
BackActionInterface<SwitchScreenAction<LedstripMenu>>,
|
||||
SwitchScreenAction<LedstripMenu>
|
||||
>;
|
||||
|
||||
using BigOffsetChangeScreen = makeComponent<
|
||||
ChangeValueDisplay<int16_t>,
|
||||
StaticText<TEXT_BIGOFFSET>,
|
||||
BigOffsetAccessor,
|
||||
BackActionInterface<SwitchScreenAction<LedstripMenu>>,
|
||||
SwitchScreenAction<LedstripMenu>
|
||||
>;
|
||||
|
||||
class LedstripMenu :
|
||||
public MenuDisplay,
|
||||
@ -35,6 +78,11 @@ public:
|
||||
{
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_LEDANIMATION>, ToggleBoolAction, CheckboxIcon, EnableLedAnimationAccessor>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BRAKELIGHTS>, ToggleBoolAction, CheckboxIcon, EnableBrakeLightsAccessor>>();
|
||||
constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_BLINKANIMATION, LedsCountAccessor>, SwitchScreenAction<BlinkAnimationChangeScreen>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_LEDSCOUNT, LedsCountAccessor>, SwitchScreenAction<LedsCountChangeScreen>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_CENTEROFFSET, CenterOffsetAccessor>, SwitchScreenAction<CenterOffsetChangeScreen>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_SMALLOFFSET, SmallOffsetAccessor>, SwitchScreenAction<SmallOffsetChangeScreen>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, TextWithValueHelper<TEXT_BIGOFFSET, BigOffsetAccessor>, SwitchScreenAction<BigOffsetChangeScreen>>>();
|
||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACK>, SwitchScreenAction<MainMenu>, StaticMenuItemIcon<&espgui::icons::back>>>();
|
||||
}
|
||||
};
|
||||
|
@ -1,7 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
// system includes
|
||||
#include <cstdint>
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <randomutils.h>
|
||||
#include <esprandom.h>
|
||||
|
||||
// local includes
|
||||
#include "display.h"
|
||||
#include "actions/switchscreenaction.h"
|
||||
|
||||
@ -74,8 +80,8 @@ private:
|
||||
};
|
||||
|
||||
PingPongDisplay::PingPongDisplay() :
|
||||
lpaddle_y(random(0, h - paddle_h)),
|
||||
rpaddle_y(random(0, h - paddle_h)),
|
||||
lpaddle_y(cpputils::randomNumber<uint8_t>(0, h - paddle_h, espcpputils::esp_random_device{})),
|
||||
rpaddle_y(cpputils::randomNumber<uint8_t>(0, h - paddle_h, espcpputils::esp_random_device{})),
|
||||
// ball is placed on the center of the left paddle
|
||||
ball_y(lpaddle_y + (paddle_h / 2))
|
||||
{
|
||||
@ -207,11 +213,11 @@ void PingPongDisplay::ball()
|
||||
|
||||
if (ball_dx == -1 && ball_x == paddle_w && ball_y + ball_h >= lpaddle_y && ball_y <= lpaddle_y + paddle_h) {
|
||||
ball_dx = ball_dx * -1;
|
||||
dly = random(5); // change speed of ball after paddle contact
|
||||
dly = cpputils::randomNumber<uint8_t>(5, espcpputils::esp_random_device{}); // change speed of ball after paddle contact
|
||||
calc_target_y();
|
||||
} else if (ball_dx == 1 && ball_x + ball_w == w - paddle_w && ball_y + ball_h >= rpaddle_y && ball_y <= rpaddle_y + paddle_h) {
|
||||
ball_dx = ball_dx * -1;
|
||||
dly = random(5); // change speed of ball after paddle contact
|
||||
dly = cpputils::randomNumber<uint8_t>(5, espcpputils::esp_random_device{}); // change speed of ball after paddle contact
|
||||
calc_target_y();
|
||||
} else if ((ball_dx == 1 && ball_x >= w) || (ball_dx == -1 && ball_x + ball_w < 0)) {
|
||||
dly = 5;
|
||||
|
@ -1,7 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
// system includes
|
||||
#include <cstdint>
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <randomutils.h>
|
||||
#include <esprandom.h>
|
||||
|
||||
// local includes
|
||||
#include "display.h"
|
||||
#include "actions/switchscreenaction.h"
|
||||
|
||||
@ -42,8 +48,8 @@ void SpiroDisplay::redraw()
|
||||
if (i == 0)
|
||||
{
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
n = random(2, 23);
|
||||
r = random(20, 100);
|
||||
n = cpputils::randomNumber<uint8_t>(2, 23, espcpputils::esp_random_device{});
|
||||
r = cpputils::randomNumber<uint8_t>(20, 100, espcpputils::esp_random_device{});
|
||||
colour = 0; //rainbow();
|
||||
}
|
||||
|
||||
@ -64,7 +70,7 @@ void SpiroDisplay::redraw()
|
||||
|
||||
if (i == (360 * n))
|
||||
{
|
||||
r = random(20, 100);//r = r / random(2,4);
|
||||
r = cpputils::randomNumber<uint8_t>(20, 100, espcpputils::esp_random_device{});//r = r / random(2,4);
|
||||
}
|
||||
|
||||
if (i >= (360 * n))
|
||||
|
@ -1,9 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
// system includes
|
||||
#include <cstdint>
|
||||
|
||||
#include <Arduino.h>
|
||||
// 3rdparty lib includes
|
||||
#include <randomutils.h>
|
||||
#include <esprandom.h>
|
||||
|
||||
// local includes
|
||||
#include "display.h"
|
||||
#include "actions/switchscreenaction.h"
|
||||
#include "globals.h"
|
||||
@ -36,10 +40,10 @@ private:
|
||||
};
|
||||
|
||||
StarfieldDisplay::StarfieldDisplay() :
|
||||
za(random(256)),
|
||||
zb(random(256)),
|
||||
zc(random(256)),
|
||||
zx(random(256))
|
||||
za(cpputils::randomNumber<uint8_t>(256, espcpputils::esp_random_device{})),
|
||||
zb(cpputils::randomNumber<uint8_t>(256, espcpputils::esp_random_device{})),
|
||||
zc(cpputils::randomNumber<uint8_t>(256, espcpputils::esp_random_device{})),
|
||||
zx(cpputils::randomNumber<uint8_t>(256, espcpputils::esp_random_device{}))
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -167,7 +167,7 @@ void StatusDisplay::redraw()
|
||||
tft.setTextFont(2);
|
||||
|
||||
const auto staStatus = wifi_stack::get_sta_status();
|
||||
if (staStatus == wifi_stack::WiFiStaStatus::WL_CONNECTED)
|
||||
if (staStatus == wifi_stack::WiFiStaStatus::CONNECTED)
|
||||
{
|
||||
if (const auto result = wifi_stack::get_sta_ap_info(); result)
|
||||
{
|
||||
@ -191,7 +191,7 @@ showStaStatus:
|
||||
|
||||
m_labelLimit0.redraw(fmt::format("{}A", controllers.front.command.left.iMotMax));
|
||||
|
||||
if (staStatus == wifi_stack::WiFiStaStatus::WL_CONNECTED)
|
||||
if (staStatus == wifi_stack::WiFiStaStatus::CONNECTED)
|
||||
{
|
||||
if (const auto result = wifi_stack::get_ip_info(TCPIP_ADAPTER_IF_STA); result)
|
||||
m_labelIpAddress.redraw(wifi_stack::toString(result->ip));
|
||||
|
@ -6,18 +6,21 @@
|
||||
|
||||
// local includes
|
||||
#include "globals.h"
|
||||
#include "cpputils.h"
|
||||
#include "espchrono.h"
|
||||
|
||||
namespace {
|
||||
bool enableLedAnimation{false};
|
||||
|
||||
std::array<CRGB, LEDSTRIP_LENGTH> leds;
|
||||
std::vector<CRGB> leds;
|
||||
uint8_t gHue = 0;
|
||||
|
||||
int16_t blinkAnimation = 0;
|
||||
|
||||
void showDefaultLedstrip();
|
||||
|
||||
void initLedStrip()
|
||||
{
|
||||
FastLED.addLeds<NEOPIXEL, PINS_LEDSTRIP>(std::begin(leds), leds.size())
|
||||
leds.resize(settings.ledstrip.ledsCount);
|
||||
FastLED.addLeds<NEOPIXEL, PINS_LEDSTRIP>(&*std::begin(leds), leds.size())
|
||||
.setCorrection(TypicalSMD5050);
|
||||
}
|
||||
|
||||
@ -25,47 +28,63 @@ void updateLedStrip()
|
||||
{
|
||||
EVERY_N_MILLISECONDS( 20 ) { gHue++; }
|
||||
|
||||
if (settings.ledstrip.enableBrakeLights)
|
||||
if (cpputils::is_in(blinkAnimation, 1, 2, 3))
|
||||
{
|
||||
float avgPwm{};
|
||||
for (const Controller &controller : controllers)
|
||||
std::fill(std::begin(leds), std::end(leds), CRGB{0, 0, 0});
|
||||
|
||||
if (espchrono::millis_clock::now().time_since_epoch() % 750ms < 375ms)
|
||||
{
|
||||
avgPwm +=
|
||||
controller.command.left.pwm * (controller.invertLeft ? -1 : 1) +
|
||||
controller.command.right.pwm * (controller.invertRight ? -1 : 1);
|
||||
auto color = CRGB{255, 255, 0};
|
||||
const auto center = (std::begin(leds) + (leds.size() / 2) + settings.ledstrip.centerOffset);
|
||||
|
||||
if (blinkAnimation != 2)
|
||||
std::fill(center - settings.ledstrip.bigOffset, center - settings.ledstrip.smallOffset, color);
|
||||
if (blinkAnimation != 1)
|
||||
std::fill(center + settings.ledstrip.smallOffset, center + settings.ledstrip.bigOffset, color);
|
||||
}
|
||||
avgPwm /= 4;
|
||||
|
||||
if (avgPwm < -1.f)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (settings.ledstrip.enableBrakeLights)
|
||||
{
|
||||
auto color = avgSpeedKmh < -0.1f ? CRGB{255, 255, 255} : CRGB{255, 0, 0};
|
||||
constexpr auto kleinerOffset = 4;
|
||||
constexpr auto grosserOffset = 10;
|
||||
float avgPwm{};
|
||||
for (const Controller &controller : controllers)
|
||||
{
|
||||
avgPwm +=
|
||||
controller.command.left.pwm * (controller.invertLeft ? -1 : 1) +
|
||||
controller.command.right.pwm * (controller.invertRight ? -1 : 1);
|
||||
}
|
||||
avgPwm /= 4;
|
||||
|
||||
const auto center = std::begin(leds) + (leds.size() / 2) + 1;
|
||||
if (avgPwm < -1.f)
|
||||
{
|
||||
auto color = avgSpeedKmh < -0.1f ? CRGB{255, 255, 255} : CRGB{255, 0, 0};
|
||||
|
||||
std::fill(std::begin(leds), std::end(leds), CRGB{0, 0, 0});
|
||||
std::fill(center - grosserOffset, center - kleinerOffset, color);
|
||||
std::fill(center + kleinerOffset, center + grosserOffset, color);
|
||||
const auto center = (std::begin(leds) + (leds.size() / 2) + settings.ledstrip.centerOffset);
|
||||
|
||||
std::fill(std::begin(leds), std::end(leds), CRGB{0, 0, 0});
|
||||
std::fill(center - settings.ledstrip.bigOffset, center - settings.ledstrip.smallOffset, color);
|
||||
std::fill(center + settings.ledstrip.smallOffset, center + settings.ledstrip.bigOffset, color);
|
||||
}
|
||||
else
|
||||
{
|
||||
showDefaultLedstrip();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
showDefaultLedstrip();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
showDefaultLedstrip();
|
||||
}
|
||||
|
||||
FastLED.show();
|
||||
}
|
||||
|
||||
void showDefaultLedstrip()
|
||||
{
|
||||
if (enableLedAnimation)
|
||||
if (settings.ledstrip.enableLedAnimation)
|
||||
{
|
||||
fadeToBlackBy(std::begin(leds), leds.size(), 20);
|
||||
fadeToBlackBy(&*std::begin(leds), leds.size(), 20);
|
||||
|
||||
uint8_t dothue = 0;
|
||||
for (int i = 0; i < 8; i++)
|
||||
|
@ -215,7 +215,12 @@ constexpr Settings::LarsmMode defaultLarsmMode {
|
||||
|
||||
#ifdef FEATURE_LEDSTRIP
|
||||
constexpr Settings::Ledstrip defaultLedstrip {
|
||||
.enableBrakeLights = true
|
||||
.enableLedAnimation = true,
|
||||
.enableBrakeLights = true,
|
||||
.ledsCount = LEDSTRIP_LENGTH,
|
||||
.centerOffset = 1,
|
||||
.smallOffset = 4,
|
||||
.bigOffset = 10
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -149,7 +149,12 @@ struct Settings
|
||||
|
||||
#ifdef FEATURE_LEDSTRIP
|
||||
struct Ledstrip {
|
||||
bool enableLedAnimation;
|
||||
bool enableBrakeLights;
|
||||
int16_t ledsCount;
|
||||
int16_t centerOffset;
|
||||
int16_t smallOffset;
|
||||
int16_t bigOffset;
|
||||
} ledstrip;
|
||||
#endif
|
||||
|
||||
@ -236,7 +241,12 @@ void Settings::executeForEveryCommonSetting(T &&callable)
|
||||
#endif
|
||||
|
||||
#ifdef FEATURE_LEDSTRIP
|
||||
callable("enableLedAnimat", ledstrip.enableLedAnimation);
|
||||
callable("enableBrakeLigh", ledstrip.enableBrakeLights);
|
||||
callable("ledsCount", ledstrip.ledsCount);
|
||||
callable("centerOffset", ledstrip.centerOffset);
|
||||
callable("smallOffset", ledstrip.smallOffset);
|
||||
callable("bigOffset", ledstrip.bigOffset);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@ void pushStats()
|
||||
statistics::bmsCurrent.push_back(bms::current);
|
||||
statistics::bmsPower.push_back(bms::power);
|
||||
#endif
|
||||
if (wifi_stack::get_sta_status() == wifi_stack::WiFiStaStatus::WL_CONNECTED)
|
||||
if (wifi_stack::get_sta_status() == wifi_stack::WiFiStaStatus::CONNECTED)
|
||||
{
|
||||
if (const auto &result = wifi_stack::get_sta_ap_info(); result)
|
||||
statistics::rssi.push_back(result->rssi);
|
||||
|
@ -236,6 +236,11 @@ constexpr char TEXT_SETITERATIONS[] = "Set iterations";
|
||||
constexpr char TEXT_LEDSTRIP[] = "Ledstrip";
|
||||
constexpr char TEXT_LEDANIMATION[] = "LED Animation";
|
||||
constexpr char TEXT_BRAKELIGHTS[] = "Brake Lights";
|
||||
constexpr char TEXT_BLINKANIMATION[] = "Blink animation";
|
||||
constexpr char TEXT_LEDSCOUNT[] = "LEDs Count";
|
||||
constexpr char TEXT_CENTEROFFSET[] = "Center Offset";
|
||||
constexpr char TEXT_SMALLOFFSET[] = "Small Offset";
|
||||
constexpr char TEXT_BIGOFFSET[] = "Big Offset";
|
||||
//constexpr char TEXT_BACK[] = "Back";
|
||||
|
||||
//ModesSettingsMenu
|
||||
|
@ -13,9 +13,9 @@ namespace {
|
||||
wifi_stack::config wifi_create_config()
|
||||
{
|
||||
return wifi_stack::config {
|
||||
.wifiEnabled = settings.wifiSettings.wifiEnabled,
|
||||
.hostname = deviceName,
|
||||
.sta = {
|
||||
.enabled = settings.wifiSettings.wifiEnabled,
|
||||
.wifis = std::array<wifi_stack::wifi_entry, 10> {
|
||||
wifi_stack::wifi_entry { .ssid = stringSettings.wifis[0].ssid, .key = stringSettings.wifis[0].key },
|
||||
wifi_stack::wifi_entry { .ssid = stringSettings.wifis[1].ssid, .key = stringSettings.wifis[1].key },
|
||||
|
@ -45,7 +45,7 @@ public:
|
||||
std::string text() const override
|
||||
{
|
||||
std::string text = "SSID: ";
|
||||
if (wifi_stack::get_sta_status() == wifi_stack::WiFiStaStatus::WL_CONNECTED)
|
||||
if (wifi_stack::get_sta_status() == wifi_stack::WiFiStaStatus::CONNECTED)
|
||||
if (const auto &result = wifi_stack::get_sta_ap_info(); result)
|
||||
text += std::string_view{reinterpret_cast<const char*>(result->ssid)};
|
||||
return text;
|
||||
@ -57,7 +57,7 @@ public:
|
||||
std::string text() const override
|
||||
{
|
||||
std::string text = "BSSID: ";
|
||||
if (wifi_stack::get_sta_status() == wifi_stack::WiFiStaStatus::WL_CONNECTED)
|
||||
if (wifi_stack::get_sta_status() == wifi_stack::WiFiStaStatus::CONNECTED)
|
||||
if (const auto &result = wifi_stack::get_sta_ap_info(); result)
|
||||
text += wifi_stack::toString(wifi_stack::mac_t{result->bssid});
|
||||
return text;
|
||||
@ -69,7 +69,7 @@ public:
|
||||
std::string text() const override
|
||||
{
|
||||
std::string text = "RSSI: ";
|
||||
if (wifi_stack::get_sta_status() == wifi_stack::WiFiStaStatus::WL_CONNECTED)
|
||||
if (wifi_stack::get_sta_status() == wifi_stack::WiFiStaStatus::CONNECTED)
|
||||
if (const auto &result = wifi_stack::get_sta_ap_info(); result)
|
||||
text += fmt::format("{}dB", result->rssi);
|
||||
return text;
|
||||
@ -81,7 +81,7 @@ public:
|
||||
std::string text() const override
|
||||
{
|
||||
std::string text = "encryptionType: ";
|
||||
if (wifi_stack::get_sta_status() == wifi_stack::WiFiStaStatus::WL_CONNECTED)
|
||||
if (wifi_stack::get_sta_status() == wifi_stack::WiFiStaStatus::CONNECTED)
|
||||
if (const auto &result = wifi_stack::get_sta_ap_info(); result)
|
||||
text += wifi_stack::toString(result->authmode);
|
||||
return text;
|
||||
@ -93,7 +93,7 @@ public:
|
||||
std::string text() const override
|
||||
{
|
||||
std::string text = "pairwiseCipher: ";
|
||||
if (wifi_stack::get_sta_status() == wifi_stack::WiFiStaStatus::WL_CONNECTED)
|
||||
if (wifi_stack::get_sta_status() == wifi_stack::WiFiStaStatus::CONNECTED)
|
||||
if (const auto &result = wifi_stack::get_sta_ap_info(); result)
|
||||
text += wifi_stack::toString(result->pairwise_cipher);
|
||||
return text;
|
||||
@ -105,7 +105,7 @@ public:
|
||||
std::string text() const override
|
||||
{
|
||||
std::string text = "groupCipher: ";
|
||||
if (wifi_stack::get_sta_status() == wifi_stack::WiFiStaStatus::WL_CONNECTED)
|
||||
if (wifi_stack::get_sta_status() == wifi_stack::WiFiStaStatus::CONNECTED)
|
||||
if (const auto &result = wifi_stack::get_sta_ap_info(); result)
|
||||
text += wifi_stack::toString(result->group_cipher);
|
||||
return text;
|
||||
@ -117,7 +117,7 @@ public:
|
||||
std::string text() const override
|
||||
{
|
||||
std::string text = "ip: ";
|
||||
if (wifi_stack::get_sta_status() == wifi_stack::WiFiStaStatus::WL_CONNECTED)
|
||||
if (wifi_stack::get_sta_status() == wifi_stack::WiFiStaStatus::CONNECTED)
|
||||
if (const auto result = wifi_stack::get_ip_info(TCPIP_ADAPTER_IF_STA); result)
|
||||
text += wifi_stack::toString(result->ip);
|
||||
return text;
|
||||
@ -129,7 +129,7 @@ public:
|
||||
std::string text() const override
|
||||
{
|
||||
std::string text = "netmask: ";
|
||||
if (wifi_stack::get_sta_status() == wifi_stack::WiFiStaStatus::WL_CONNECTED)
|
||||
if (wifi_stack::get_sta_status() == wifi_stack::WiFiStaStatus::CONNECTED)
|
||||
if (const auto result = wifi_stack::get_ip_info(TCPIP_ADAPTER_IF_STA); result)
|
||||
text += wifi_stack::toString(result->netmask);
|
||||
return text;
|
||||
@ -141,7 +141,7 @@ public:
|
||||
std::string text() const override
|
||||
{
|
||||
std::string text = "gateway: ";
|
||||
if (wifi_stack::get_sta_status() == wifi_stack::WiFiStaStatus::WL_CONNECTED)
|
||||
if (wifi_stack::get_sta_status() == wifi_stack::WiFiStaStatus::CONNECTED)
|
||||
if (const auto result = wifi_stack::get_ip_info(TCPIP_ADAPTER_IF_STA); result)
|
||||
text += wifi_stack::toString(result->gw);
|
||||
return text;
|
||||
@ -153,7 +153,7 @@ public:
|
||||
std::string text() const override
|
||||
{
|
||||
std::string text = "ipv6: ";
|
||||
if (wifi_stack::get_sta_status() == wifi_stack::WiFiStaStatus::WL_CONNECTED)
|
||||
if (wifi_stack::get_sta_status() == wifi_stack::WiFiStaStatus::CONNECTED)
|
||||
{
|
||||
esp_ip6_addr_t addr;
|
||||
if (const auto result = esp_netif_get_ip6_linklocal(wifi_stack::esp_netifs[ESP_IF_WIFI_STA], &addr); result == ESP_OK)
|
||||
@ -168,7 +168,7 @@ public:
|
||||
std::string text() const override
|
||||
{
|
||||
std::string text = "ipv6: ";
|
||||
if (wifi_stack::get_sta_status() == wifi_stack::WiFiStaStatus::WL_CONNECTED)
|
||||
if (wifi_stack::get_sta_status() == wifi_stack::WiFiStaStatus::CONNECTED)
|
||||
{
|
||||
esp_ip6_addr_t addr;
|
||||
if (const auto result = esp_netif_get_ip6_global(wifi_stack::esp_netifs[ESP_IF_WIFI_STA], &addr); result == ESP_OK)
|
||||
@ -183,7 +183,7 @@ public:
|
||||
std::string text() const override
|
||||
{
|
||||
std::string text = "dns0: ";
|
||||
if (wifi_stack::get_sta_status() == wifi_stack::WiFiStaStatus::WL_CONNECTED)
|
||||
if (wifi_stack::get_sta_status() == wifi_stack::WiFiStaStatus::CONNECTED)
|
||||
if (const ip_addr_t *dns_ip = dns_getserver(0))
|
||||
text += wifi_stack::toString(*dns_ip);
|
||||
return text;
|
||||
@ -195,7 +195,7 @@ public:
|
||||
std::string text() const override
|
||||
{
|
||||
std::string text = "dns1: ";
|
||||
if (wifi_stack::get_sta_status() == wifi_stack::WiFiStaStatus::WL_CONNECTED)
|
||||
if (wifi_stack::get_sta_status() == wifi_stack::WiFiStaStatus::CONNECTED)
|
||||
if (const ip_addr_t *dns_ip = dns_getserver(1))
|
||||
text += wifi_stack::toString(*dns_ip);
|
||||
return text;
|
||||
@ -207,7 +207,7 @@ public:
|
||||
std::string text() const override
|
||||
{
|
||||
std::string text = "dns2: ";
|
||||
if (wifi_stack::get_sta_status() == wifi_stack::WiFiStaStatus::WL_CONNECTED)
|
||||
if (wifi_stack::get_sta_status() == wifi_stack::WiFiStaStatus::CONNECTED)
|
||||
if (const ip_addr_t *dns_ip = dns_getserver(2))
|
||||
text += wifi_stack::toString(*dns_ip);
|
||||
return text;
|
||||
|
@ -162,6 +162,12 @@ CONFIG_ARDUINO_SELECTIVE_SPI=y
|
||||
CONFIG_ARDUINO_SELECTIVE_Wire=y
|
||||
# end of Arduino Configuration
|
||||
|
||||
#
|
||||
# ESP Gui settings
|
||||
#
|
||||
CONFIG_ESPGUI_MENUDISPLAY_ROWS=10
|
||||
# end of ESP Gui settings
|
||||
|
||||
#
|
||||
# Simple Async HTTP Request
|
||||
#
|
||||
|
Reference in New Issue
Block a user