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