fix standalone building

This commit is contained in:
proddy
2021-10-19 17:40:12 +02:00
parent 752530a381
commit 48cedbd0fb
6 changed files with 55 additions and 21 deletions

View File

@@ -30,7 +30,9 @@
#include <iostream>
#define IPAddress std::string
// #define IPAddress std::string
#define IPAddress String
#define ICACHE_FLASH_ATTR
#define ICACHE_RAM_ATTR
#define os_event_t void

View File

@@ -48,7 +48,7 @@ class DummySettings {
String localIP = "";
String gatewayIP = "";
String subnetMask = "";
String staticIPConfig = "";
bool staticIPConfig = false;
String dnsIP1 = "";
String dnsIP2 = "";
String board_profile = "CUSTOM";

0
lib_standalone/ESPmDNS.h Normal file
View File

View File

@@ -158,9 +158,12 @@ class WiFiClass {
return 0;
};
void disconnect(bool v){};
char * getHostname() {
return nullptr;
}
char * localIP() {
return nullptr;
}
@@ -173,15 +176,22 @@ class ETHClass {
};
void setHostname(const char * s){};
char * getHostname() {
return nullptr;
}
char * localIP() {
return nullptr;
}
int linkSpeed() {
return 100;
}
bool config(IPAddress local_ip, IPAddress gateway, IPAddress subnet, IPAddress dns1, IPAddress dns2) {
return false;
}
};

View File

@@ -23,6 +23,7 @@
#include "test/test.h"
#endif
#ifndef EMSESP_STANDALONE
#ifdef ESP_IDF_VERSION_MAJOR // IDF 4+
#if CONFIG_IDF_TARGET_ESP32 // ESP32/PICO-D4
#include "../esp32/rom/rtc.h"
@@ -36,6 +37,7 @@
#else // ESP32 Before IDF 4.0
#include "../rom/rtc.h"
#endif
#endif
namespace emsesp {
@@ -1057,25 +1059,43 @@ bool System::command_restart(const char * value, const int8_t id) {
}
const std::string System::reset_reason(uint8_t cpu) {
#ifndef EMSESP_STANDALONE
switch (rtc_get_reset_reason(cpu)) {
case 1: return ("Power on reset");
case 1:
return ("Power on reset");
// case 2 :reset pin not on esp32
case 3: return ("Software reset");
case 4: return ("Legacy watch dog reset");
case 5: return ("Deep sleep reset");
case 6: return ("Reset by SDIO");
case 7: return ("Timer group0 watch dog reset");
case 8: return ("Timer group1 watch dog reset");
case 9: return ("RTC watch dog reset");
case 10: return ("Intrusion reset CPU");
case 11: return ("Timer group reset CPU");
case 12: return ("Software reset CPU");
case 13: return ("RTC watch dog reset: CPU");
case 14: return ("APP CPU reseted by PRO CPU");
case 15: return ("Brownout reset");
case 16: return ("RTC watch dog reset: CPU+RTC");
default: break;
case 3:
return ("Software reset");
case 4:
return ("Legacy watch dog reset");
case 5:
return ("Deep sleep reset");
case 6:
return ("Reset by SDIO");
case 7:
return ("Timer group0 watch dog reset");
case 8:
return ("Timer group1 watch dog reset");
case 9:
return ("RTC watch dog reset");
case 10:
return ("Intrusion reset CPU");
case 11:
return ("Timer group reset CPU");
case 12:
return ("Software reset CPU");
case 13:
return ("RTC watch dog reset: CPU");
case 14:
return ("APP CPU reseted by PRO CPU");
case 15:
return ("Brownout reset");
case 16:
return ("RTC watch dog reset: CPU+RTC");
default:
break;
}
#endif
return ("Unkonwn");
}

View File

@@ -141,6 +141,7 @@ void WebStatusService::webStatusService(AsyncWebServerRequest * request) {
// start the multicast UDP service so EMS-ESP is discoverable via .local
void WebStatusService::mDNS_start() {
#ifndef EMSESP_STANDALONE
if (!MDNS.begin(EMSESP::system_.hostname().c_str())) {
EMSESP::logger().warning(F("Failed to start mDNS responder service"));
return;
@@ -153,6 +154,7 @@ void WebStatusService::mDNS_start() {
MDNS.addServiceTxt("http", "tcp", "version", EMSESP_APP_VERSION);
MDNS.addServiceTxt("http", "tcp", "address", address_s.c_str());
#endif
EMSESP::logger().info(F("mDNS responder service started"));
}