ESP8266 hardware info

* basic HW info, similar to ESP32
* minor stability improvement for 8266
This commit is contained in:
Frank
2023-01-11 13:58:21 +01:00
parent 1406d2546b
commit 94032af61d
3 changed files with 53 additions and 1 deletions

View File

@@ -30,6 +30,15 @@
#else // for 8266
#include <Esp.h>
#include <user_interface.h>
#include <core_esp8266_features.h>
#include <core_version.h>
#include <spi_vendors.h>
#include <flash_utils.h>
#include <memory>
#include <cont.h>
#include <coredecls.h>
#endif
// end WLEDMM
@@ -839,7 +848,21 @@ void serializeInfo(JsonObject root)
#else // for 8266
root[F("e32core0code")] = (int)ESP.getResetInfoPtr()->reason;
root[F("e32core0text")] = F("");
root[F("e32core0text")] = ESP.getResetReason();
root[F("e32model")] = F("ESP8266 (id 0x") + String(ESP.getChipId(), 16) + String(") "); // can only be "ESP8266EX" or "ESP8285"
root[F("e32cores")] = 1;
root[F("e32speed")] = ESP.getCpuFreqMHz();
root[F("e32flash")] = int((ESP.getFlashChipRealSize()/1024)/1024);
root[F("e32flashspeed")] = int(ESP.getFlashChipSpeed()/1000000);
root[F("e32flashmode")] = int(ESP.getFlashChipMode());
switch (ESP.getFlashChipMode()) {
case FM_QIO: root[F("e32flashtext")] = F(" (QIO)"); break;
case FM_QOUT: root[F("e32flashtext")] = F(" (QOUT)");break;
case FM_DIO: root[F("e32flashtext")] = F(" (DIO)"); break;
case FM_DOUT: root[F("e32flashtext")] = F(" (DOUT)");break;
default: root[F("e32flashtext")] = F(" (other)"); break;
}
#endif
// end WLEDMM

View File

@@ -276,6 +276,8 @@ void WLED::setup()
#endif
Serial.begin(115200);
if (!Serial) delay(1000); // WLEDMM make sure that Serial has initalized
#if !ARDUINO_USB_CDC_ON_BOOT
Serial.setTimeout(50); // this causes troubles on new MCUs that have a "virtual" USB Serial (HWCDC)
#else
@@ -346,6 +348,29 @@ void WLED::setup()
#endif
#else
// WLEDMM: more info for 8266
DEBUG_PRINTLN();
DEBUG_PRINTF("CPU: ESP8266 (id 0x%08X)", ESP.getChipId());
DEBUG_PRINT(F(", ")); DEBUG_PRINT(ESP.getCpuFreqMHz()); DEBUG_PRINTLN(F("MHz."));
USER_PRINT(F("CPU Last Restart Reason = "));
USER_PRINT((int)ESP.getResetInfoPtr()->reason); USER_PRINT(F(" -> "));
USER_PRINTLN(ESP.getResetInfo());
DEBUG_PRINT(F("FLASH: ")); DEBUG_PRINT((ESP.getFlashChipRealSize()/1024)/1024);
DEBUG_PRINT(F("MB, Mode ")); DEBUG_PRINT((int)ESP.getFlashChipMode());
#ifdef WLED_DEBUG
switch (ESP.getFlashChipMode()) {
// missing: Octal modes
case FM_QIO: DEBUG_PRINT(F(" (QIO)")); break;
case FM_QOUT: DEBUG_PRINT(F(" (QOUT)"));break;
case FM_DIO: DEBUG_PRINT(F(" (DIO)")); break;
case FM_DOUT: DEBUG_PRINT(F(" (DOUT)"));break;
default: break;
}
#endif
DEBUG_PRINT(F(", speed ")); DEBUG_PRINT(ESP.getFlashChipSpeed()/1000000);DEBUG_PRINTLN(F("MHz."));
USER_PRINTLN();
DEBUG_PRINT(F("esp8266 "));
DEBUG_PRINTLN(ESP.getCoreVersion());
#endif

View File

@@ -458,7 +458,11 @@ WLED_GLOBAL byte macroDoublePress[WLED_MAX_BUTTONS] _INIT({0});
// Security CONFIG
WLED_GLOBAL bool otaLock _INIT(false); // prevents OTA firmware updates without password. ALWAYS enable if system exposed to any public networks
WLED_GLOBAL bool wifiLock _INIT(false); // prevents access to WiFi settings when OTA lock is enabled
#ifdef ARDUINO_ARCH_ESP32
WLED_GLOBAL bool aOtaEnabled _INIT(true); // ArduinoOTA allows easy updates directly from the IDE. Careful, it does not auto-disable when OTA lock is on
#else
WLED_GLOBAL bool aOtaEnabled _INIT(false); // WLEDMM: start with OTA disabled, as it seems to be unstable on 8266
#endif
WLED_GLOBAL char settingsPIN[5] _INIT(""); // PIN for settings pages
WLED_GLOBAL bool correctPIN _INIT(true);
WLED_GLOBAL unsigned long lastEditTime _INIT(0);