Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ build_flags = -D BUILD_GIT='"${sysenv.TRAVIS_TAG}"'
-fno-exceptions
-lstdc++-nox
-DPIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY_LOW_FLASH
-DPUYA_SUPPORT=1
-DCORE_2_5_0


Expand Down
35 changes: 32 additions & 3 deletions src/Misc.ino
Original file line number Diff line number Diff line change
Expand Up @@ -1122,10 +1122,9 @@ String getSystemLibraryString() {
result += F(", LWIP: ");
result += getLWIPversion();
#endif
#ifdef PUYASUPPORT
if (puyaSupport()) {
result += F(" PUYA support");
#endif

}
return result;
}

Expand All @@ -1147,6 +1146,36 @@ String getLWIPversion() {
}
#endif

bool puyaSupport() {
bool supported = false;
#ifdef PUYA_SUPPORT
// New support starting core 2.5.0
if (PUYA_SUPPORT) supported = true;
#endif
#ifdef PUYASUPPORT
// Old patch
supported = true;
#endif
return supported;
}

uint8_t getFlashChipVendorId() {
#ifdef PUYA_SUPPORT
return ESP.getFlashChipVendorId();
#else
#if defined(ESP8266)
uint32_t flashChipId = ESP.getFlashChipId();
return (flashChipId & 0x000000ff);
#else
return 0xFF; // Not an existing function for ESP32
#endif
#endif
}

bool flashChipVendorPuya() {
uint8_t vendorId = getFlashChipVendorId();
return vendorId == 0x85; // 0x146085 PUYA
}



Expand Down
14 changes: 6 additions & 8 deletions src/WebServer.ino
Original file line number Diff line number Diff line change
Expand Up @@ -6167,18 +6167,16 @@ void handle_sysinfo() {
TXBuffer += F("Vendor: ");
TXBuffer += formatToHex(flashChipId & 0xFF);

#ifdef PUYASUPPORT
if (ESP.flashIsPuya()) {
TXBuffer += F(" (PUYA, supported)");
}
#else
if ((flashChipId & 0x000000ff) == 0x85) // 0x146085 PUYA
if (flashChipVendorPuya())
{
TXBuffer += F(" (PUYA");
TXBuffer += F(HTML_SYMBOL_WARNING);
if (puyaSupport()) {
TXBuffer += F(", supported");
} else {
TXBuffer += F(HTML_SYMBOL_WARNING);
}
TXBuffer += ')';
}
#endif
TXBuffer += F(" Device: ");
uint32_t flashDevice = (flashChipId & 0xFF00) | ((flashChipId >> 16) & 0xFF);
TXBuffer += formatToHex(flashDevice);
Expand Down