diff --git a/src/dev/device.h b/src/dev/device.h
index 3e49d271..4f6ae713 100644
--- a/src/dev/device.h
+++ b/src/dev/device.h
@@ -37,7 +37,7 @@ class BaseDevice {
{
return "";
}
- virtual const char* get_display_driver()
+ virtual const char* get_chip_model()
{
return "";
}
diff --git a/src/dev/esp32/esp32.cpp b/src/dev/esp32/esp32.cpp
index ede2dbdb..837a6bad 100644
--- a/src/dev/esp32/esp32.cpp
+++ b/src/dev/esp32/esp32.cpp
@@ -43,11 +43,34 @@ void Esp32Device::set_hostname(const char* hostname)
}
const char* Esp32Device::get_core_version()
{
- return ESP.getSdkVersion();
+ return esp_get_idf_version(); // == ESP.getSdkVersion();
}
-const char* Esp32Device::get_display_driver()
+const char* Esp32Device::get_chip_model()
{
- return Utilities::tft_driver_name().c_str();
+ esp_chip_info_t chip_info;
+ esp_chip_info(&chip_info);
+
+ // model = chip_info.cores;
+ // model += F("core ");
+ switch(chip_info.model) {
+ case CHIP_ESP32:
+ return "ESP32";
+
+#ifdef CHIP_ESP32S2
+ case CHIP_ESP32S2:
+ return "ESP32-S2";
+#endif
+
+#ifdef CHIP_ESP32S3
+ case CHIP_ESP32S3:
+ return "ESP32-S3";
+#endif
+
+ default:
+ return "Unknown ESP32";
+ }
+ // model += F(" rev");
+ // model += chip_info.revision;
}
void Esp32Device::set_backlight_pin(uint8_t pin)
diff --git a/src/dev/esp32/esp32.h b/src/dev/esp32/esp32.h
index 90f7485a..7c2b6797 100644
--- a/src/dev/esp32/esp32.h
+++ b/src/dev/esp32/esp32.h
@@ -30,7 +30,7 @@ class Esp32Device : public BaseDevice {
const char* get_hostname();
void set_hostname(const char*);
const char* get_core_version();
- const char* get_display_driver();
+ const char* get_chip_model();
void set_backlight_pin(uint8_t pin) override;
void set_backlight_level(uint8_t val) override;
diff --git a/src/dev/esp8266/esp8266.cpp b/src/dev/esp8266/esp8266.cpp
index bcd9a850..7435133e 100644
--- a/src/dev/esp8266/esp8266.cpp
+++ b/src/dev/esp8266/esp8266.cpp
@@ -42,9 +42,9 @@ const char* Esp8266Device::get_core_version()
return ESP.getCoreVersion().c_str();
}
-const char* Esp8266Device::get_display_driver()
+const char* Esp8266Device::get_chip_model()
{
- return Utilities::tft_driver_name().c_str();
+ return "ESP8266";
}
void Esp8266Device::set_backlight_pin(uint8_t pin)
diff --git a/src/dev/esp8266/esp8266.h b/src/dev/esp8266/esp8266.h
index 458add99..460cb264 100644
--- a/src/dev/esp8266/esp8266.h
+++ b/src/dev/esp8266/esp8266.h
@@ -32,7 +32,7 @@ class Esp8266Device : public BaseDevice {
const char* get_hostname();
void set_hostname(const char*);
const char* get_core_version();
- const char* get_display_driver();
+ const char* get_chip_model();
void set_backlight_pin(uint8_t pin) override;
void set_backlight_level(uint8_t val) override;
diff --git a/src/dev/posix/hasp_posix.cpp b/src/dev/posix/hasp_posix.cpp
index 1515b315..8884861a 100644
--- a/src/dev/posix/hasp_posix.cpp
+++ b/src/dev/posix/hasp_posix.cpp
@@ -15,51 +15,53 @@
namespace dev {
-PosixDevice::PosixDevice() {
- struct utsname uts;
+PosixDevice::PosixDevice()
+{
+ struct utsname uts;
- if (uname(&uts) < 0) {
- LOG_ERROR(0,"uname() error");
- _hostname = "localhost";
- _core_version = "unknown";
- } else {
+ if(uname(&uts) < 0) {
+ LOG_ERROR(0, "uname() error");
+ _hostname = "localhost";
+ _core_version = "unknown";
+ _chip_model = "unknown";
+ } else {
// LOG_VERBOSE(0,"Sysname: %s", uts.sysname);
// LOG_VERBOSE(0,"Nodename: %s", uts.nodename);
// LOG_VERBOSE(0,"Release: %s", uts.release);
// LOG_VERBOSE(0,"Version: %s", uts.version);
// LOG_VERBOSE(0,"Machine: %s", uts.machine);
- char version[128];
- snprintf(version, sizeof(version), "%s %s", uts.sysname, uts.release);
- _core_version = version;
- _hostname = uts.nodename;
- }
-
- _backlight_power = 1;
- _backlight_level = 100;
+ char version[128];
+ snprintf(version, sizeof(version), "%s %s", uts.sysname, uts.release);
+ _core_version = version;
+ _chip_model = uts.machine;
+ _hostname = uts.nodename;
}
+ _backlight_power = 1;
+ _backlight_level = 100;
+}
+
void PosixDevice::reboot()
{}
void PosixDevice::show_info()
{
- struct utsname uts;
+ struct utsname uts;
- if (uname(&uts) < 0) {
- LOG_ERROR(0,"uname() error");
- } else {
- LOG_VERBOSE(0,"Sysname: %s", uts.sysname);
- LOG_VERBOSE(0,"Nodename: %s", uts.nodename);
- LOG_VERBOSE(0,"Release: %s", uts.release);
- LOG_VERBOSE(0,"Version: %s", uts.version);
- LOG_VERBOSE(0,"Machine: %s", uts.machine);
- }
+ if(uname(&uts) < 0) {
+ LOG_ERROR(0, "uname() error");
+ } else {
+ LOG_VERBOSE(0, "Sysname: %s", uts.sysname);
+ LOG_VERBOSE(0, "Nodename: %s", uts.nodename);
+ LOG_VERBOSE(0, "Release: %s", uts.release);
+ LOG_VERBOSE(0, "Version: %s", uts.version);
+ LOG_VERBOSE(0, "Machine: %s", uts.machine);
+ }
LOG_VERBOSE(0, "Processor : %s", "unknown");
LOG_VERBOSE(0, "CPU freq. : %i MHz", 0);
}
-
const char* PosixDevice::get_hostname()
{
return _hostname.c_str();
@@ -74,9 +76,9 @@ const char* PosixDevice::get_core_version()
{
return _core_version.c_str();
}
-const char* PosixDevice::get_display_driver()
+const char* PosixDevice::get_chip_model()
{
- return "SDL2";
+ return _chip_model.c_str();
}
void PosixDevice::set_backlight_pin(uint8_t pin)
@@ -89,8 +91,7 @@ void PosixDevice::set_backlight_level(uint8_t level)
uint8_t new_level = level >= 0 ? level : 0;
new_level = new_level <= 100 ? new_level : 100;
- if(_backlight_level != new_level)
- {
+ if(_backlight_level != new_level) {
_backlight_level = new_level;
update_backlight();
}
@@ -121,7 +122,7 @@ void PosixDevice::update_backlight()
// monitor.sdl_refr_qry = true;
// monitor_sdl_refr(NULL);
// const lv_area_t area = {1,1,0,0};
- //monitor_flush(NULL,&area,NULL);
+ // monitor_flush(NULL,&area,NULL);
}
size_t PosixDevice::get_free_max_block()
diff --git a/src/dev/posix/hasp_posix.h b/src/dev/posix/hasp_posix.h
index 687aa8ea..962bd45d 100644
--- a/src/dev/posix/hasp_posix.h
+++ b/src/dev/posix/hasp_posix.h
@@ -7,8 +7,7 @@
#include
MCU Model: ");
- httpMessage += halGetChipModel();
+ httpMessage += haspDevice.get_chip_model();
httpMessage += F("
CPU Frequency: ");
httpMessage += String(haspDevice.get_cpu_frequency());
httpMessage += F("MHz");
@@ -670,7 +670,7 @@ void webHandleInfo()
// httpMessage += String(ESP.getSdkVersion());
//#else
httpMessage += F("
Core version: ");
- httpMessage += halGetCoreVersion();
+ httpMessage += haspDevice.get_core_version();
//#endif
httpMessage += F("
Last Reset: ");
httpMessage += halGetResetInfo();