fix esp8266 core status message

This commit is contained in:
arovak 2021-03-22 01:05:03 +01:00
parent 7e588181b8
commit 68406b2a9b
3 changed files with 7 additions and 5 deletions

View File

@ -39,7 +39,7 @@ void Esp8266Device::set_hostname(const char* hostname)
const char* Esp8266Device::get_core_version() const char* Esp8266Device::get_core_version()
{ {
return ESP.getCoreVersion().c_str(); return _core_version.c_str();
} }
const char* Esp8266Device::get_chip_model() const char* Esp8266Device::get_chip_model()

View File

@ -19,6 +19,7 @@ class Esp8266Device : public BaseDevice {
_hostname = "plate"; _hostname = "plate";
_backlight_power = 1; _backlight_power = 1;
_backlight_level = 100; _backlight_level = 100;
_core_version = ESP.getCoreVersion().c_str();
#ifdef TFT_BCKL #ifdef TFT_BCKL
_backlight_pin = TFT_BCKL; _backlight_pin = TFT_BCKL;
#else #else
@ -49,6 +50,7 @@ class Esp8266Device : public BaseDevice {
private: private:
std::string _hostname; std::string _hostname;
std::string _core_version;
uint8_t _backlight_pin; uint8_t _backlight_pin;
uint8_t _backlight_level; uint8_t _backlight_level;

View File

@ -1050,10 +1050,10 @@ void dispatch_output_statusupdate(const char*, const char*)
(HASP_NUM_PAGES)); (HASP_NUM_PAGES));
strcat(data, buffer); strcat(data, buffer);
#if defined(ARDUINO_ARCH_ESP8266) // #if defined(ARDUINO_ARCH_ESP8266)
snprintf_P(buffer, sizeof(buffer), PSTR("\"espVcc\":%.2f,"), (float)ESP.getVcc() / 1000); // snprintf_P(buffer, sizeof(buffer), PSTR("\"espVcc\":%.2f,"), (float)ESP.getVcc() / 1000);
strcat(data, buffer); // strcat(data, buffer);
#endif // #endif
snprintf_P(buffer, sizeof(buffer), PSTR("\"tftDriver\":\"%s\",\"tftWidth\":%u,\"tftHeight\":%u}"), snprintf_P(buffer, sizeof(buffer), PSTR("\"tftDriver\":\"%s\",\"tftWidth\":%u,\"tftHeight\":%u}"),
haspTft.get_tft_model(), (TFT_WIDTH), (TFT_HEIGHT)); haspTft.get_tft_model(), (TFT_WIDTH), (TFT_HEIGHT));