Add Model

This commit is contained in:
fvanroie 2021-04-24 04:41:13 +02:00
parent 84e0e45b90
commit 2fdf8d4e47
17 changed files with 42 additions and 2 deletions

View File

@ -1,2 +1,16 @@
/* MIT License - Copyright (c) 2019-2021 Francis Van Roie
For full license information read the LICENSE file in the project folder */
#include "device.h"
namespace dev {
const char* BaseDevice::get_model()
{
#ifdef HASP_MODEL
return HASP_MODEL;
#else
return PIOENV;
#endif
}
} // namespace dev

View File

@ -41,6 +41,7 @@ class BaseDevice {
{
return "";
}
const char* get_model();
virtual void init()
{}

View File

@ -37,14 +37,17 @@ const char* Esp32Device::get_hostname()
{
return _hostname.c_str();
}
void Esp32Device::set_hostname(const char* hostname)
{
_hostname = hostname;
}
const char* Esp32Device::get_core_version()
{
return esp_get_idf_version(); // == ESP.getSdkVersion();
}
const char* Esp32Device::get_chip_model()
{
esp_chip_info_t chip_info;

View File

@ -926,8 +926,10 @@ void dispatch_output_statusupdate(const char*, const char*)
haspGetVersion(buffer, sizeof(buffer));
dispatch_get_idle_state(hasp_sleep_state, topic);
snprintf_P(data, sizeof(data), PSTR("{\"node\":\"%s\",\"idle\":\"%s\",\"version\":\"%s\",\"uptime\":%lu,"),
haspDevice.get_hostname(), topic, buffer, long(millis() / 1000)); // \"status\":\"available\",
snprintf_P(data, sizeof(data),
PSTR("{\"node\":\"%s\",\"model\":\"%s\",\"idle\":\"%s\",\"version\":\"%s\",\"uptime\":%lu,"),
haspDevice.get_hostname(), haspDevice.get_model(), topic, buffer,
(unsigned long)(millis() / 1000)); // \"status\":\"available\",
#if HASP_USE_WIFI > 0 || HASP_USE_ETHERNET > 0
network_get_statusupdate(buffer, sizeof(buffer));

View File

@ -528,6 +528,9 @@ void webHandleInfo()
httpMessage += haspDevice.get_hostname();
httpMessage += F("</h1><hr>");
httpMessage += F("<b>HASP Model: </b>");
httpMessage += haspDevice.get_model();
/* HASP Stats */
httpMessage += F("<b>HASP Version: </b>");
{

View File

@ -6,6 +6,8 @@ extra_scripts =
tools/linux_build_extra.py
build_flags =
${env.build_flags}
-D HASP_MODEL="MacOS X"
; ----- Monitor
-D TFT_WIDTH=240
-D TFT_HEIGHT=320

View File

@ -12,6 +12,7 @@ board = esp32dev
build_flags =
${env.build_flags}
${esp32.build_flags}
-D HASP_MODEL="Arduitouch"
;region -- TFT_eSPI build options ------------------------
${lcd.lolin24}

View File

@ -12,6 +12,7 @@ build_flags =
${env.build_flags}
${esp32.build_flags}
${esp32.vspi} ; Use VSPI hardware SPI bus
-D HASP_MODEL="ESP32-Touchdown"
;region -- TFT_eSPI build options ------------------------
-D USER_SETUP_LOADED=1

View File

@ -11,6 +11,7 @@ board = esp32dev
build_flags =
${env.build_flags}
${esp32.build_flags}
-D HASP_MODEL="FreeTouchDeck"
;region -- TFT_eSPI build options ------------------------
-D USER_SETUP_LOADED=1

View File

@ -12,6 +12,8 @@ board = featheresp32
build_flags =
${env.build_flags}
${esp32.build_flags}
-D HASP_MODEL="Featherwing 2.4"
;region -- TFT_eSPI build options ------------------------
${lcd.featherwing-24}
-D TFT_MISO=19

View File

@ -12,6 +12,8 @@ board = featheresp32
build_flags =
${env.build_flags}
${esp32.build_flags}
-D HASP_MODEL="Featherwing 3.5"
;region -- TFT_eSPI build options ------------------------
${lcd.featherwing-35}
-D TFT_MISO=19

View File

@ -17,6 +17,7 @@ build_flags =
${env.build_flags}
${esp32.build_flags}
${esp32.ps_ram}
-D HASP_MODEL="Lanbon L8"
;region -- TFT_eSPI build options ------------------------
${lcd.st7789v}

View File

@ -17,6 +17,7 @@ build_flags =
${env.build_flags}
${esp32.build_flags}
${esp32.ps_ram}
-D HASP_MODEL="M5Stack core2"
;region -- TFT_eSPI build options ------------------------
${lcd.m5stack}

View File

@ -17,6 +17,7 @@ build_flags =
${env.build_flags}
${esp32.build_flags}
${esp32.ps_ram}
-D HASP_MODEL="TTGO Lilygo Pi"
;region -- TFT_eSPI build options ------------------------
-D ILI9481_DRIVER=1

View File

@ -13,6 +13,7 @@ build_flags =
${env.build_flags}
${esp32.build_flags}
${esp32.ps_ram}
-D HASP_MODEL="WT32-SC01"
;region -- TFT_eSPI build options ------------------------
${lcd.wt32-sc01}

View File

@ -5,6 +5,8 @@ extra_scripts =
tools/linux_build_extra.py
build_flags =
${env.build_flags}
-D HASP_MODEL="Posix Linux"
; ----- Monitor
-D TFT_WIDTH=240
-D TFT_HEIGHT=320

View File

@ -5,6 +5,8 @@ extra_scripts =
tools/windows_build_extra.py
build_flags =
${env.build_flags}
-D HASP_MODEL="Windows"
; ----- Monitor
-D TFT_WIDTH=240
-D TFT_HEIGHT=320