Updated rebased files to new submodules
This commit is contained in:
@ -18,7 +18,7 @@ namespace {
|
|||||||
|
|
||||||
void sendState(const std::string& state)
|
void sendState(const std::string& state)
|
||||||
{
|
{
|
||||||
if (const auto error = espnow::send_espnow_message(fmt::format("{}:{}:{}", state, espchrono::utc_clock::now().time_since_epoch().count(), configs.anhaenger_id.value)); error != ESP_OK)
|
if (const auto error = espnow::send_espnow_message(fmt::format("{}:{}:{}", state, espchrono::utc_clock::now().time_since_epoch().count(), configs.anhaenger_id.value())); error != ESP_OK)
|
||||||
{
|
{
|
||||||
ESP_LOGE(TAG, "Error sending blinker message: %s", esp_err_to_name(error));
|
ESP_LOGE(TAG, "Error sending blinker message: %s", esp_err_to_name(error));
|
||||||
}
|
}
|
||||||
@ -33,7 +33,7 @@ namespace bobbyblinker {
|
|||||||
|
|
||||||
void handle_blinker()
|
void handle_blinker()
|
||||||
{
|
{
|
||||||
if (!configs.espnow.syncBlink.value)
|
if (!configs.espnow.syncBlink.value())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const bool blinker_state = (cpputils::is_in(blinkAnimation, LEDSTRIP_OVERWRITE_BLINKLEFT, LEDSTRIP_OVERWRITE_BLINKRIGHT, LEDSTRIP_OVERWRITE_BLINKBOTH));
|
const bool blinker_state = (cpputils::is_in(blinkAnimation, LEDSTRIP_OVERWRITE_BLINKLEFT, LEDSTRIP_OVERWRITE_BLINKRIGHT, LEDSTRIP_OVERWRITE_BLINKBOTH));
|
||||||
@ -58,7 +58,7 @@ namespace bobbyblinker {
|
|||||||
blinker_last_time_sent = std::nullopt;
|
blinker_last_time_sent = std::nullopt;
|
||||||
sendState("BLINKOFF");
|
sendState("BLINKOFF");
|
||||||
}
|
}
|
||||||
if (configs.ledstrip.enableBrakeLights.value && espchrono::ago(*brake_last_time_sent) > 500ms)
|
if (configs.ledstrip.enableBrakeLights.value() && espchrono::ago(*brake_last_time_sent) > 500ms)
|
||||||
{
|
{
|
||||||
float avgPwm{};
|
float avgPwm{};
|
||||||
for (const Controller &controller: controllers) {
|
for (const Controller &controller: controllers) {
|
||||||
|
@ -47,13 +47,13 @@ constexpr const char TAG[] = "BUTTONS";
|
|||||||
return Button(BobbyButton::Up2);
|
return Button(BobbyButton::Up2);
|
||||||
if (configs.dpadMappingDown2.value() == button)
|
if (configs.dpadMappingDown2.value() == button)
|
||||||
return Button(BobbyButton::Down2);
|
return Button(BobbyButton::Down2);
|
||||||
if (configs.dpadMappingExtra1.value == button)
|
if (configs.dpadMappingExtra1.value() == button)
|
||||||
return Button(BobbyButton::Extra1);
|
return Button(BobbyButton::Extra1);
|
||||||
if (configs.dpadMappingExtra2.value == button)
|
if (configs.dpadMappingExtra2.value() == button)
|
||||||
return Button(BobbyButton::Extra2);
|
return Button(BobbyButton::Extra2);
|
||||||
if (configs.dpadMappingExtra3.value == button)
|
if (configs.dpadMappingExtra3.value() == button)
|
||||||
return Button(BobbyButton::Extra3);
|
return Button(BobbyButton::Extra3);
|
||||||
if (configs.dpadMappingExtra4.value == button)
|
if (configs.dpadMappingExtra4.value() == button)
|
||||||
return Button(BobbyButton::Extra4);
|
return Button(BobbyButton::Extra4);
|
||||||
|
|
||||||
ESP_LOGW(TAG, "unknown raw button %hhu", button);
|
ESP_LOGW(TAG, "unknown raw button %hhu", button);
|
||||||
|
@ -56,8 +56,8 @@ std::array<bool, 16> Helper<OUT1, OUT2, IN1, IN2, IN3, IN4>::read()
|
|||||||
pinMode(IN3, INPUT_PULLUP);
|
pinMode(IN3, INPUT_PULLUP);
|
||||||
pinMode(IN4, INPUT_PULLUP);
|
pinMode(IN4, INPUT_PULLUP);
|
||||||
|
|
||||||
if (configs.buttonReadDelay.value != 0) {
|
if (configs.buttonReadDelay.value() != 0) {
|
||||||
delayMicroseconds(configs.buttonReadDelay.value);
|
delayMicroseconds(configs.buttonReadDelay.value());
|
||||||
} else {
|
} else {
|
||||||
vPortYield();
|
vPortYield();
|
||||||
}
|
}
|
||||||
@ -74,8 +74,8 @@ std::array<bool, 16> Helper<OUT1, OUT2, IN1, IN2, IN3, IN4>::read()
|
|||||||
pinMode(IN3, INPUT_PULLDOWN);
|
pinMode(IN3, INPUT_PULLDOWN);
|
||||||
pinMode(IN4, INPUT_PULLDOWN);
|
pinMode(IN4, INPUT_PULLDOWN);
|
||||||
|
|
||||||
if (configs.buttonReadDelay.value != 0) {
|
if (configs.buttonReadDelay.value() != 0) {
|
||||||
delayMicroseconds(configs.buttonReadDelay.value);
|
delayMicroseconds(configs.buttonReadDelay.value());
|
||||||
} else {
|
} else {
|
||||||
vPortYield();
|
vPortYield();
|
||||||
}
|
}
|
||||||
@ -96,8 +96,8 @@ std::array<bool, 16> Helper<OUT1, OUT2, IN1, IN2, IN3, IN4>::read()
|
|||||||
pinMode(IN3, INPUT_PULLUP);
|
pinMode(IN3, INPUT_PULLUP);
|
||||||
pinMode(IN4, INPUT_PULLUP);
|
pinMode(IN4, INPUT_PULLUP);
|
||||||
|
|
||||||
if (configs.buttonReadDelay.value != 0) {
|
if (configs.buttonReadDelay.value() != 0) {
|
||||||
delayMicroseconds(configs.buttonReadDelay.value);
|
delayMicroseconds(configs.buttonReadDelay.value());
|
||||||
} else {
|
} else {
|
||||||
vPortYield();
|
vPortYield();
|
||||||
}
|
}
|
||||||
@ -114,8 +114,8 @@ std::array<bool, 16> Helper<OUT1, OUT2, IN1, IN2, IN3, IN4>::read()
|
|||||||
pinMode(IN3, INPUT_PULLDOWN);
|
pinMode(IN3, INPUT_PULLDOWN);
|
||||||
pinMode(IN4, INPUT_PULLDOWN);
|
pinMode(IN4, INPUT_PULLDOWN);
|
||||||
|
|
||||||
if (configs.buttonReadDelay.value != 0) {
|
if (configs.buttonReadDelay.value() != 0) {
|
||||||
delayMicroseconds(configs.buttonReadDelay.value);
|
delayMicroseconds(configs.buttonReadDelay.value());
|
||||||
} else {
|
} else {
|
||||||
vPortYield();
|
vPortYield();
|
||||||
}
|
}
|
||||||
@ -177,7 +177,7 @@ void update()
|
|||||||
|
|
||||||
const auto now = espchrono::millis_clock::now();
|
const auto now = espchrono::millis_clock::now();
|
||||||
|
|
||||||
const std::chrono::milliseconds dpadDebounce{configs.dpadDebounce.value};
|
const std::chrono::milliseconds dpadDebounce{configs.dpadDebounce.value()};
|
||||||
|
|
||||||
for (auto i = 0; i < newState.size(); i++)
|
for (auto i = 0; i < newState.size(); i++)
|
||||||
if (lastState[i] != newState[i] && now - debounce[i] > dpadDebounce)
|
if (lastState[i] != newState[i] && now - debounce[i] > dpadDebounce)
|
||||||
|
@ -270,31 +270,31 @@ public:
|
|||||||
ConfigWrapperLegacy<uint8_t> dpadDebounce {25, DoReset, {}, "dpadDebounce" };
|
ConfigWrapperLegacy<uint8_t> dpadDebounce {25, DoReset, {}, "dpadDebounce" };
|
||||||
ConfigWrapperLegacy<uint16_t> buttonReadDelay {1, DoReset, {}, "buttonDelay" };
|
ConfigWrapperLegacy<uint16_t> buttonReadDelay {1, DoReset, {}, "buttonDelay" };
|
||||||
|
|
||||||
ConfigWrapper<uint8_t> dpadMappingLeft {INPUT_MAPPING_NONE, DoReset, {}, "dpadMapLeft" };
|
ConfigWrapperLegacy<uint8_t> dpadMappingLeft {INPUT_MAPPING_NONE, DoReset, {}, "dpadMapLeft" };
|
||||||
ConfigWrapper<uint8_t> dpadMappingRight {INPUT_MAPPING_NONE, DoReset, {}, "dpadMapRight" };
|
ConfigWrapperLegacy<uint8_t> dpadMappingRight {INPUT_MAPPING_NONE, DoReset, {}, "dpadMapRight" };
|
||||||
ConfigWrapper<uint8_t> dpadMappingUp {INPUT_MAPPING_NONE, DoReset, {}, "dpadMapUp" };
|
ConfigWrapperLegacy<uint8_t> dpadMappingUp {INPUT_MAPPING_NONE, DoReset, {}, "dpadMapUp" };
|
||||||
ConfigWrapper<uint8_t> dpadMappingDown {INPUT_MAPPING_NONE, DoReset, {}, "dpadMapDown" };
|
ConfigWrapperLegacy<uint8_t> dpadMappingDown {INPUT_MAPPING_NONE, DoReset, {}, "dpadMapDown" };
|
||||||
ConfigWrapper<uint8_t> dpadMappingProfile0{INPUT_MAPPING_NONE, DoReset, {}, "dpadMapProfile0" };
|
ConfigWrapperLegacy<uint8_t> dpadMappingProfile0{INPUT_MAPPING_NONE, DoReset, {}, "dpadMapProfile0" };
|
||||||
ConfigWrapper<uint8_t> dpadMappingProfile1{INPUT_MAPPING_NONE, DoReset, {}, "dpadMapProfile1" };
|
ConfigWrapperLegacy<uint8_t> dpadMappingProfile1{INPUT_MAPPING_NONE, DoReset, {}, "dpadMapProfile1" };
|
||||||
ConfigWrapper<uint8_t> dpadMappingProfile2{INPUT_MAPPING_NONE, DoReset, {}, "dpadMapProfile2" };
|
ConfigWrapperLegacy<uint8_t> dpadMappingProfile2{INPUT_MAPPING_NONE, DoReset, {}, "dpadMapProfile2" };
|
||||||
ConfigWrapper<uint8_t> dpadMappingProfile3{INPUT_MAPPING_NONE, DoReset, {}, "dpadMapProfile3" };
|
ConfigWrapperLegacy<uint8_t> dpadMappingProfile3{INPUT_MAPPING_NONE, DoReset, {}, "dpadMapProfile3" };
|
||||||
ConfigWrapper<uint8_t> dpadMappingLeft2 {INPUT_MAPPING_NONE, DoReset, {}, "dpadMapLeft2" };
|
ConfigWrapperLegacy<uint8_t> dpadMappingLeft2 {INPUT_MAPPING_NONE, DoReset, {}, "dpadMapLeft2" };
|
||||||
ConfigWrapper<uint8_t> dpadMappingRight2 {INPUT_MAPPING_NONE, DoReset, {}, "dpadMapRight2" };
|
ConfigWrapperLegacy<uint8_t> dpadMappingRight2 {INPUT_MAPPING_NONE, DoReset, {}, "dpadMapRight2" };
|
||||||
ConfigWrapper<uint8_t> dpadMappingUp2 {INPUT_MAPPING_NONE, DoReset, {}, "dpadMapUp2" };
|
ConfigWrapperLegacy<uint8_t> dpadMappingUp2 {INPUT_MAPPING_NONE, DoReset, {}, "dpadMapUp2" };
|
||||||
ConfigWrapper<uint8_t> dpadMappingDown2 {INPUT_MAPPING_NONE, DoReset, {}, "dpadMapDown2" };
|
ConfigWrapperLegacy<uint8_t> dpadMappingDown2 {INPUT_MAPPING_NONE, DoReset, {}, "dpadMapDown2" };
|
||||||
ConfigWrapper<uint8_t> dpadMappingExtra1 {INPUT_MAPPING_NONE, DoReset, {}, "dpadMapExtra1" };
|
ConfigWrapperLegacy<uint8_t> dpadMappingExtra1 {INPUT_MAPPING_NONE, DoReset, {}, "dpadMapExtra1" };
|
||||||
ConfigWrapper<uint8_t> dpadMappingExtra2 {INPUT_MAPPING_NONE, DoReset, {}, "dpadMapExtra2" };
|
ConfigWrapperLegacy<uint8_t> dpadMappingExtra2 {INPUT_MAPPING_NONE, DoReset, {}, "dpadMapExtra2" };
|
||||||
ConfigWrapper<uint8_t> dpadMappingExtra3 {INPUT_MAPPING_NONE, DoReset, {}, "dpadMapExtra3" };
|
ConfigWrapperLegacy<uint8_t> dpadMappingExtra3 {INPUT_MAPPING_NONE, DoReset, {}, "dpadMapExtra3" };
|
||||||
ConfigWrapper<uint8_t> dpadMappingExtra4 {INPUT_MAPPING_NONE, DoReset, {}, "dpadMapExtra4" };
|
ConfigWrapperLegacy<uint8_t> dpadMappingExtra4 {INPUT_MAPPING_NONE, DoReset, {}, "dpadMapExtra4" };
|
||||||
|
|
||||||
ConfigWrapper<BobbyQuickActions> quickActionLeft2{ BobbyQuickActions::BLINK_LEFT, DoReset, {}, "quickActleft2" };
|
ConfigWrapperLegacy<BobbyQuickActions> quickActionLeft2{ BobbyQuickActions::BLINK_LEFT, DoReset, {}, "quickActleft2" };
|
||||||
ConfigWrapper<BobbyQuickActions> quickActionRight2{ BobbyQuickActions::BLINK_RIGHT, DoReset, {}, "quickActright2" };
|
ConfigWrapperLegacy<BobbyQuickActions> quickActionRight2{ BobbyQuickActions::BLINK_RIGHT, DoReset, {}, "quickActright2" };
|
||||||
ConfigWrapper<BobbyQuickActions> quickActionUp2{ BobbyQuickActions::NONE, DoReset, {}, "quickActup2" };
|
ConfigWrapperLegacy<BobbyQuickActions> quickActionUp2{ BobbyQuickActions::NONE, DoReset, {}, "quickActup2" };
|
||||||
ConfigWrapper<BobbyQuickActions> quickActionDown2{ BobbyQuickActions::HANDBREMSE, DoReset, {}, "quickActdown2" };
|
ConfigWrapperLegacy<BobbyQuickActions> quickActionDown2{ BobbyQuickActions::HANDBREMSE, DoReset, {}, "quickActdown2" };
|
||||||
ConfigWrapper<BobbyQuickActions> quickActionExtra1{ BobbyQuickActions::NONE, DoReset, {}, "quickActextra1" };
|
ConfigWrapperLegacy<BobbyQuickActions> quickActionExtra1{ BobbyQuickActions::NONE, DoReset, {}, "quickActextra1" };
|
||||||
ConfigWrapper<BobbyQuickActions> quickActionExtra2{ BobbyQuickActions::NONE, DoReset, {}, "quickActextra2" };
|
ConfigWrapperLegacy<BobbyQuickActions> quickActionExtra2{ BobbyQuickActions::NONE, DoReset, {}, "quickActextra2" };
|
||||||
ConfigWrapper<BobbyQuickActions> quickActionExtra3{ BobbyQuickActions::NONE, DoReset, {}, "quickActextra3" };
|
ConfigWrapperLegacy<BobbyQuickActions> quickActionExtra3{ BobbyQuickActions::NONE, DoReset, {}, "quickActextra3" };
|
||||||
ConfigWrapper<BobbyQuickActions> quickActionExtra4{ BobbyQuickActions::NONE, DoReset, {}, "quickActextra4" };
|
ConfigWrapperLegacy<BobbyQuickActions> quickActionExtra4{ BobbyQuickActions::NONE, DoReset, {}, "quickActextra4" };
|
||||||
|
|
||||||
std::array<WirelessDoorsConfig, 5> wireless_door_configs {
|
std::array<WirelessDoorsConfig, 5> wireless_door_configs {
|
||||||
WirelessDoorsConfig { "door_id0", "door_token0" },
|
WirelessDoorsConfig { "door_id0", "door_token0" },
|
||||||
@ -465,7 +465,7 @@ public:
|
|||||||
ConfiguredFeatureFlag esp_now {"featureEspNow", false, false, "espnow"};
|
ConfiguredFeatureFlag esp_now {"featureEspNow", false, false, "espnow"};
|
||||||
} feature;
|
} feature;
|
||||||
|
|
||||||
ConfigWrapper<uint16_t> anhaenger_id {0, DoReset, {}, "anhaenger_id" };
|
ConfigWrapperLegacy<uint16_t> anhaenger_id {0, DoReset, {}, "anhaenger_id" };
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
ConfigWrapperLegacy<bool> bleEnabled {true, DoReset, {}, "bleEnabled" };
|
ConfigWrapperLegacy<bool> bleEnabled {true, DoReset, {}, "bleEnabled" };
|
||||||
|
Reference in New Issue
Block a user