🚨 Fixes build error for esp-idf
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
class MDNSService : public StatefulService<MDNSSettings> {
|
||||
private:
|
||||
FSPersistence<MDNSSettings> _persistence;
|
||||
bool _started;
|
||||
bool _started {false};
|
||||
|
||||
void reconfigureMDNS();
|
||||
void startMDNS();
|
||||
|
||||
@@ -161,7 +161,7 @@ class GestureSensor {
|
||||
|
||||
gesture_t getGesture() { return msg.gesture; }
|
||||
|
||||
gesture_t const takeGesture() {
|
||||
gesture_t takeGesture() {
|
||||
const auto g = msg.gesture;
|
||||
msg.gesture = eGestureNone;
|
||||
return g;
|
||||
|
||||
@@ -69,7 +69,7 @@ class Peripherals : public StatefulService<PeripheralsConfiguration> {
|
||||
|
||||
float angleZ();
|
||||
|
||||
gesture_t const takeGesture();
|
||||
gesture_t takeGesture();
|
||||
|
||||
float leftDistance();
|
||||
float rightDistance();
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
#include <IPAddress.h>
|
||||
#include <ArduinoJson.h>
|
||||
#include <utils/json_utils.h>
|
||||
#include <utils/string_utils.h>
|
||||
#include <utils/ip_utils.h>
|
||||
#include <template/state_result.h>
|
||||
|
||||
@@ -96,7 +95,7 @@ class APSettings {
|
||||
case AP_MODE_NEVER: break;
|
||||
default: newSettings.provisionMode = AP_MODE_DISCONNECTED;
|
||||
}
|
||||
newSettings.ssid = root["ssid"] | format(FACTORY_AP_SSID);
|
||||
newSettings.ssid = root["ssid"] | FACTORY_AP_SSID;
|
||||
newSettings.password = root["password"] | FACTORY_AP_PASSWORD;
|
||||
newSettings.channel = root["channel"] | FACTORY_AP_CHANNEL;
|
||||
newSettings.ssidHidden = root["ssid_hidden"] | FACTORY_AP_SSID_HIDDEN;
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
#include <ArduinoJson.h>
|
||||
#include <utils/json_utils.h>
|
||||
#include <utils/string_utils.h>
|
||||
#include <template/state_result.h>
|
||||
#include <filesystem.h>
|
||||
|
||||
@@ -111,10 +110,10 @@ class MDNSSettings {
|
||||
}
|
||||
|
||||
if (settings.services.empty()) {
|
||||
mdns_service_t httpService = {.service = "http", .protocol = "tcp", .port = 80};
|
||||
mdns_service_t httpService = {.service = "http", .protocol = "tcp", .port = 80, .txtRecords = {}};
|
||||
settings.services.push_back(httpService);
|
||||
|
||||
mdns_service_t wsService = {.service = "ws", .protocol = "tcp", .port = 80};
|
||||
mdns_service_t wsService = {.service = "ws", .protocol = "tcp", .port = 80, .txtRecords = {}};
|
||||
settings.services.push_back(wsService);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#include <ArduinoJson.h>
|
||||
#include <utils/json_utils.h>
|
||||
#include <utils/ip_utils.h>
|
||||
#include <utils/string_utils.h>
|
||||
#include <template/state_result.h>
|
||||
|
||||
#ifndef FACTORY_WIFI_SSID
|
||||
@@ -82,15 +81,19 @@ typedef struct {
|
||||
} wifi_settings_t;
|
||||
|
||||
inline wifi_settings_t createDefaultWiFiSettings() {
|
||||
return wifi_settings_t {.ssid = FACTORY_WIFI_SSID,
|
||||
.password = FACTORY_WIFI_PASSWORD,
|
||||
.staticIPConfig = false,
|
||||
.localIP = INADDR_NONE,
|
||||
.gatewayIP = INADDR_NONE,
|
||||
.subnetMask = INADDR_NONE,
|
||||
.dnsIP1 = INADDR_NONE,
|
||||
.dnsIP2 = INADDR_NONE,
|
||||
.available = false};
|
||||
return wifi_settings_t {
|
||||
.ssid = FACTORY_WIFI_SSID,
|
||||
.bssid = {0},
|
||||
.channel = -1,
|
||||
.password = FACTORY_WIFI_PASSWORD,
|
||||
.staticIPConfig = false,
|
||||
.localIP = INADDR_NONE,
|
||||
.gatewayIP = INADDR_NONE,
|
||||
.subnetMask = INADDR_NONE,
|
||||
.dnsIP1 = INADDR_NONE,
|
||||
.dnsIP2 = INADDR_NONE,
|
||||
.available = false,
|
||||
};
|
||||
}
|
||||
|
||||
class WiFiSettings {
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
constexpr static const char* PLATFORM = "esp32";
|
||||
|
||||
static String getRandom() { return String(random(2147483647), HEX); }
|
||||
|
||||
static String getUniqueId() {
|
||||
uint8_t mac[6];
|
||||
esp_read_mac(mac, ESP_MAC_WIFI_STA);
|
||||
char macStr[13] = {0};
|
||||
sprintf(macStr, "%02x%02x%02x%02x%02x%02x", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
|
||||
return String(macStr);
|
||||
}
|
||||
|
||||
static String replaceEach(String value, String pattern, String (*generateReplacement)()) {
|
||||
while (true) {
|
||||
int index = value.indexOf(pattern);
|
||||
if (index == -1) {
|
||||
break;
|
||||
}
|
||||
value = value.substring(0, index) + generateReplacement() + value.substring(index + pattern.length());
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
static String format(String value) {
|
||||
value = replaceEach(value, "#{random}", getRandom);
|
||||
value.replace("#{unique_id}", getUniqueId());
|
||||
value.replace("#{platform}", PLATFORM);
|
||||
return value;
|
||||
}
|
||||
@@ -3,9 +3,8 @@
|
||||
static const char *TAG = "MDNSService";
|
||||
|
||||
MDNSService::MDNSService()
|
||||
: endpoint(MDNSSettings::read, MDNSSettings::update, this),
|
||||
_persistence(MDNSSettings::read, MDNSSettings::update, this, MDNS_SETTINGS_FILE),
|
||||
_started(false) {
|
||||
: _persistence(MDNSSettings::read, MDNSSettings::update, this, MDNS_SETTINGS_FILE),
|
||||
endpoint(MDNSSettings::read, MDNSSettings::update, this) {
|
||||
addUpdateHandler([&](const String &originId) { reconfigureMDNS(); }, false);
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ void MotionService::handleWalkGait(JsonVariant &root, int originId) {
|
||||
|
||||
void MotionService::handleMode(JsonVariant &root, int originId) {
|
||||
MOTION_STATE mode = static_cast<MOTION_STATE>(root.as<int>());
|
||||
ESP_LOGV("MotionService", "Mode %d", mode);
|
||||
ESP_LOGV("MotionService", "Mode %d", static_cast<int>(mode));
|
||||
switch (mode) {
|
||||
case MOTION_STATE::REST: setState(&restState); break;
|
||||
case MOTION_STATE::STAND: setState(&standState); break;
|
||||
|
||||
@@ -4,9 +4,9 @@ namespace Camera {
|
||||
|
||||
static const char *const TAG = "CameraService";
|
||||
|
||||
static const char *_STREAM_CONTENT_TYPE = "multipart/x-mixed-replace;boundary=" PART_BOUNDARY;
|
||||
static const char *_STREAM_BOUNDARY = "\r\n--" PART_BOUNDARY "\r\n";
|
||||
static const char *_STREAM_PART = "Content-Type: image/jpeg\r\nContent-Length: %u\r\n\r\n";
|
||||
static constexpr const char *_STREAM_CONTENT_TYPE = "multipart/x-mixed-replace;boundary=" PART_BOUNDARY;
|
||||
static constexpr const char *_STREAM_BOUNDARY = "\r\n--" PART_BOUNDARY "\r\n";
|
||||
static constexpr const char *_STREAM_PART = "Content-Type: image/jpeg\r\nContent-Length: %u\r\n\r\n";
|
||||
|
||||
SemaphoreHandle_t cameraMutex = xSemaphoreCreateMutex();
|
||||
|
||||
|
||||
@@ -152,7 +152,7 @@ float Peripherals::angleZ() {
|
||||
#endif
|
||||
}
|
||||
|
||||
gesture_t const Peripherals::takeGesture() {
|
||||
gesture_t Peripherals::takeGesture() {
|
||||
return
|
||||
#if FT_ENABLED(USE_PAJ7620U2)
|
||||
_gesture.takeGesture();
|
||||
|
||||
@@ -4,9 +4,6 @@ namespace system_service {
|
||||
|
||||
static const char *TAG = "SystemService";
|
||||
|
||||
static JsonDocument analyticsDoc;
|
||||
static char analyticsMessage[MAX_ESP_ANALYTICS_SIZE];
|
||||
|
||||
esp_err_t handleReset(PsychicRequest *request) {
|
||||
reset();
|
||||
return request->reply(200);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#include <wifi_service.h>
|
||||
|
||||
WiFiService::WiFiService()
|
||||
: endpoint(WiFiSettings::read, WiFiSettings::update, this),
|
||||
_persistence(WiFiSettings::read, WiFiSettings::update, this, WIFI_SETTINGS_FILE) {
|
||||
: _persistence(WiFiSettings::read, WiFiSettings::update, this, WIFI_SETTINGS_FILE),
|
||||
endpoint(WiFiSettings::read, WiFiSettings::update, this) {
|
||||
addUpdateHandler([&](const String &originId) { reconfigureWiFiConnection(); }, false);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user