mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-24 11:46:34 +00:00
Move DriverName from tft to hal
This commit is contained in:
parent
34cec107c1
commit
5cef5aba36
@ -247,12 +247,14 @@ String halGetMacAddress(int start, const char * seperator)
|
||||
|
||||
#if defined(STM32F4xx)
|
||||
uint8_t * mac_p = nullptr;
|
||||
#if HASP_USE_ETHERNET > 0
|
||||
#if USE_BUILTIN_ETHERNET > 0
|
||||
mac_p = Ethernet.MACAddress();
|
||||
for(uint8_t i = 0; i < 6; i++) mac[i] = *(mac_p + i);
|
||||
#else
|
||||
Ethernet.macAddress(mac);
|
||||
#endif
|
||||
#endif
|
||||
#else
|
||||
WiFi.macAddress(mac);
|
||||
#endif
|
||||
@ -297,4 +299,38 @@ String halFormatBytes(size_t bytes)
|
||||
}
|
||||
output += "B";
|
||||
return output;
|
||||
}
|
||||
|
||||
String halDisplayDriverName()
|
||||
{
|
||||
#if defined(ILI9341_DRIVER)
|
||||
return F("ILI9341");
|
||||
#elif defined(ST7735_DRIVER)
|
||||
return F("ST7735");
|
||||
#elif defined(ILI9163_DRIVER)
|
||||
return F("ILI9163");
|
||||
#elif defined(S6D02A1_DRIVER)
|
||||
return F("S6D02A1");
|
||||
#elif defined(ST7796_DRIVER)
|
||||
return F("ST7796");
|
||||
#elif defined(ILI9486_DRIVER)
|
||||
return F("ILI9486");
|
||||
#elif defined(ILI9481_DRIVER)
|
||||
return F("ILI9481");
|
||||
#elif defined(ILI9488_DRIVER)
|
||||
return F("ILI9488");
|
||||
#elif defined(HX8357D_DRIVER)
|
||||
return F("HX8357D");
|
||||
#elif defined(EPD_DRIVER)
|
||||
return F("EPD");
|
||||
#elif defined(ST7789_DRIVER)
|
||||
return F("ST7789");
|
||||
#elif defined(R61581_DRIVER)
|
||||
return F("R61581");
|
||||
#elif defined(ST7789_2_DRIVER)
|
||||
return F("ST7789_2");
|
||||
#elif defined(RM68140_DRIVER)
|
||||
return F("RM68140");
|
||||
#endif
|
||||
return F("Unknown");
|
||||
}
|
@ -13,5 +13,6 @@ String halGetChipModel();
|
||||
String halGetMacAddress(int start, const char * seperator);
|
||||
uint16_t halGetCpuFreqMHz(void);
|
||||
String halFormatBytes(size_t bytes);
|
||||
String halDisplayDriverName(void);
|
||||
|
||||
#endif
|
@ -208,7 +208,7 @@ void mqtt_send_statusupdate()
|
||||
#endif
|
||||
|
||||
snprintf_P(buffer, sizeof(buffer), PSTR("\"tftDriver\":\"%s\",\"tftWidth\":%u,\"tftHeight\":%u}"),
|
||||
tftDriverName().c_str(), (TFT_WIDTH), (TFT_HEIGHT));
|
||||
halDisplayDriverName().c_str(), (TFT_WIDTH), (TFT_HEIGHT));
|
||||
strcat(data, buffer);
|
||||
}
|
||||
mqtt_send_state(F("statusupdate"), data);
|
||||
|
@ -80,7 +80,7 @@ void TASMO_TELE_JSON()
|
||||
haspGetPage(), (HASP_NUM_PAGES));
|
||||
strcat(data, buffer);
|
||||
snprintf_P(buffer, sizeof(buffer), PSTR("\"tftDriver\":\"%s\",\"tftWidth\":%u,\"tftHeight\":%u}"),
|
||||
tftDriverName().c_str(), (TFT_WIDTH), (TFT_HEIGHT));
|
||||
halDisplayDriverName().c_str(), (TFT_WIDTH), (TFT_HEIGHT));
|
||||
strcat(data, buffer);
|
||||
}
|
||||
slave.sendJSON((char*)data);
|
||||
|
@ -1,5 +1,8 @@
|
||||
#include "ArduinoJson.h"
|
||||
#include "ArduinoLog.h"
|
||||
|
||||
#ifndef USE_FSMC
|
||||
|
||||
#include "TFT_eSPI.h"
|
||||
|
||||
#include "hasp_tft.h"
|
||||
@ -24,40 +27,6 @@ void tftLoop()
|
||||
void tftStop()
|
||||
{}
|
||||
|
||||
String tftDriverName()
|
||||
{
|
||||
#if defined(ILI9341_DRIVER)
|
||||
return F("ILI9341");
|
||||
#elif defined(ST7735_DRIVER)
|
||||
return F("ST7735");
|
||||
#elif defined(ILI9163_DRIVER)
|
||||
return F("ILI9163");
|
||||
#elif defined(S6D02A1_DRIVER)
|
||||
return F("S6D02A1");
|
||||
#elif defined(ST7796_DRIVER)
|
||||
return F("ST7796");
|
||||
#elif defined(ILI9486_DRIVER)
|
||||
return F("ILI9486");
|
||||
#elif defined(ILI9481_DRIVER)
|
||||
return F("ILI9481");
|
||||
#elif defined(ILI9488_DRIVER)
|
||||
return F("ILI9488");
|
||||
#elif defined(HX8357D_DRIVER)
|
||||
return F("HX8357D");
|
||||
#elif defined(EPD_DRIVER)
|
||||
return F("EPD");
|
||||
#elif defined(ST7789_DRIVER)
|
||||
return F("ST7789");
|
||||
#elif defined(R61581_DRIVER)
|
||||
return F("R61581");
|
||||
#elif defined(ST7789_2_DRIVER)
|
||||
return F("ST7789_2");
|
||||
#elif defined(RM68140_DRIVER)
|
||||
return F("RM68140");
|
||||
#endif
|
||||
return F("Unknown");
|
||||
}
|
||||
|
||||
void tftOffsetInfo(uint8_t pin, uint8_t x_offset, uint8_t y_offset)
|
||||
{
|
||||
if(x_offset != 0) {
|
||||
@ -101,7 +70,7 @@ void tftShowConfig(TFT_eSPI & tft)
|
||||
|
||||
if(tftSetup.tft_driver != 0xE9D) // For ePaper displays the size is defined in the sketch
|
||||
{
|
||||
Log.verbose(F("TFT: Driver : %s"), tftDriverName().c_str()); // tftSetup.tft_driver);
|
||||
Log.verbose(F("TFT: Driver : %s"),halDisplayDriverName().c_str()); // tftSetup.tft_driver);
|
||||
Log.verbose(F("TFT: Resolution : %ix%i"), tftSetup.tft_width, tftSetup.tft_height);
|
||||
} else if(tftSetup.tft_driver == 0xE9D)
|
||||
Log.verbose(F("Driver = ePaper"));
|
||||
@ -205,3 +174,5 @@ int8_t getPinName(int8_t pin)
|
||||
return -1; // Invalid pin
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -1,6 +1,8 @@
|
||||
#ifndef HASP_TFT_H
|
||||
#define HASP_TFT_H
|
||||
|
||||
#ifndef USE_FSMC
|
||||
|
||||
#include "TFT_eSPI.h"
|
||||
|
||||
void tftSetup(TFT_eSPI & screen);
|
||||
@ -8,6 +10,7 @@ void tftLoop(void);
|
||||
void tftStop(void);
|
||||
|
||||
void tftShowConfig(TFT_eSPI & tft);
|
||||
String tftDriverName();
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
Loading…
x
Reference in New Issue
Block a user