mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-27 05:06:44 +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)
|
#if defined(STM32F4xx)
|
||||||
uint8_t * mac_p = nullptr;
|
uint8_t * mac_p = nullptr;
|
||||||
|
#if HASP_USE_ETHERNET > 0
|
||||||
#if USE_BUILTIN_ETHERNET > 0
|
#if USE_BUILTIN_ETHERNET > 0
|
||||||
mac_p = Ethernet.MACAddress();
|
mac_p = Ethernet.MACAddress();
|
||||||
for(uint8_t i = 0; i < 6; i++) mac[i] = *(mac_p + i);
|
for(uint8_t i = 0; i < 6; i++) mac[i] = *(mac_p + i);
|
||||||
#else
|
#else
|
||||||
Ethernet.macAddress(mac);
|
Ethernet.macAddress(mac);
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
WiFi.macAddress(mac);
|
WiFi.macAddress(mac);
|
||||||
#endif
|
#endif
|
||||||
@ -298,3 +300,37 @@ String halFormatBytes(size_t bytes)
|
|||||||
output += "B";
|
output += "B";
|
||||||
return output;
|
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);
|
String halGetMacAddress(int start, const char * seperator);
|
||||||
uint16_t halGetCpuFreqMHz(void);
|
uint16_t halGetCpuFreqMHz(void);
|
||||||
String halFormatBytes(size_t bytes);
|
String halFormatBytes(size_t bytes);
|
||||||
|
String halDisplayDriverName(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
@ -208,7 +208,7 @@ void mqtt_send_statusupdate()
|
|||||||
#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}"),
|
||||||
tftDriverName().c_str(), (TFT_WIDTH), (TFT_HEIGHT));
|
halDisplayDriverName().c_str(), (TFT_WIDTH), (TFT_HEIGHT));
|
||||||
strcat(data, buffer);
|
strcat(data, buffer);
|
||||||
}
|
}
|
||||||
mqtt_send_state(F("statusupdate"), data);
|
mqtt_send_state(F("statusupdate"), data);
|
||||||
|
@ -80,7 +80,7 @@ void TASMO_TELE_JSON()
|
|||||||
haspGetPage(), (HASP_NUM_PAGES));
|
haspGetPage(), (HASP_NUM_PAGES));
|
||||||
strcat(data, buffer);
|
strcat(data, buffer);
|
||||||
snprintf_P(buffer, sizeof(buffer), PSTR("\"tftDriver\":\"%s\",\"tftWidth\":%u,\"tftHeight\":%u}"),
|
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);
|
strcat(data, buffer);
|
||||||
}
|
}
|
||||||
slave.sendJSON((char*)data);
|
slave.sendJSON((char*)data);
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
#include "ArduinoJson.h"
|
#include "ArduinoJson.h"
|
||||||
#include "ArduinoLog.h"
|
#include "ArduinoLog.h"
|
||||||
|
|
||||||
|
#ifndef USE_FSMC
|
||||||
|
|
||||||
#include "TFT_eSPI.h"
|
#include "TFT_eSPI.h"
|
||||||
|
|
||||||
#include "hasp_tft.h"
|
#include "hasp_tft.h"
|
||||||
@ -24,40 +27,6 @@ void tftLoop()
|
|||||||
void tftStop()
|
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)
|
void tftOffsetInfo(uint8_t pin, uint8_t x_offset, uint8_t y_offset)
|
||||||
{
|
{
|
||||||
if(x_offset != 0) {
|
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
|
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);
|
Log.verbose(F("TFT: Resolution : %ix%i"), tftSetup.tft_width, tftSetup.tft_height);
|
||||||
} else if(tftSetup.tft_driver == 0xE9D)
|
} else if(tftSetup.tft_driver == 0xE9D)
|
||||||
Log.verbose(F("Driver = ePaper"));
|
Log.verbose(F("Driver = ePaper"));
|
||||||
@ -205,3 +174,5 @@ int8_t getPinName(int8_t pin)
|
|||||||
return -1; // Invalid pin
|
return -1; // Invalid pin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#ifndef HASP_TFT_H
|
#ifndef HASP_TFT_H
|
||||||
#define HASP_TFT_H
|
#define HASP_TFT_H
|
||||||
|
|
||||||
|
#ifndef USE_FSMC
|
||||||
|
|
||||||
#include "TFT_eSPI.h"
|
#include "TFT_eSPI.h"
|
||||||
|
|
||||||
void tftSetup(TFT_eSPI & screen);
|
void tftSetup(TFT_eSPI & screen);
|
||||||
@ -8,6 +10,7 @@ void tftLoop(void);
|
|||||||
void tftStop(void);
|
void tftStop(void);
|
||||||
|
|
||||||
void tftShowConfig(TFT_eSPI & tft);
|
void tftShowConfig(TFT_eSPI & tft);
|
||||||
String tftDriverName();
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
Loading…
x
Reference in New Issue
Block a user