M5stack display support (experimental)

This commit is contained in:
Klaus K Wilting 2020-04-05 18:19:39 +02:00
parent 07d5b18cc1
commit 70d836d2f6
4 changed files with 30 additions and 28 deletions

View File

@ -45,7 +45,7 @@ description = Paxcounter is a device for metering passenger flows in realtime. I
[common]
; for release_version use max. 10 chars total, use any decimal format like "a.b.c"
release_version = 1.9.983
release_version = 1.9.984
; DEBUG LEVEL: For production run set to 0, otherwise device will leak RAM while running!
; 0=None, 1=Error, 2=Warn, 3=Info, 4=Debug, 5=Verbose
debug_level = 3
@ -59,11 +59,10 @@ upload_speed = 115200
lib_deps_lora =
MCCI LoRaWAN LMIC library@>=3.1.0 ; MCCI LMIC by Terrill Moore
lib_deps_display =
;ss_oled@4.1.2 ; simple and small OLED lib by Larry Bank
https://github.com/bitbank2/ss_oled.git
BitBang_I2C@2.0.1
ss_oled@4.1.2 ; simple and small OLED lib by Larry Bank
BitBang_I2C@2.0.2
QRCode@>=0.0.1
TFT_eSPI@>=2.1.9
TFT_eSPI@>=2.2.0
lib_deps_matrix_display =
Ultrathin_LED_Matrix@>=1.0.0
lib_deps_rgbled =

View File

@ -70,7 +70,7 @@ void dp_setup(int contrast) {
tft.init();
tft.setRotation(MY_DISPLAY_FLIP ? true : false);
tft.setRotation(MY_DISPLAY_FLIP ? 3 : 1);
tft.invertDisplay(MY_DISPLAY_INVERT ? true : false);
tft.setTextColor(MY_DISPLAY_FGCOLOR, MY_DISPLAY_BGCOLOR);
@ -433,23 +433,26 @@ void dp_printf(uint16_t x, uint16_t y, uint8_t font, uint8_t inv,
#if (HAS_DISPLAY) == 1
oledWriteString(&ssoled, 0, x, y, temp, font, inv, false);
#elif (HAS_DISPLAY) == 2
uint8_t myfont;
uint8_t tft_font, font_vScale;
// map font oled -> tft
switch (font) {
case MY_FONT_SMALL:
myfont = 6;
case MY_FONT_STRETCHED: // 16x16 on OLED
case MY_FONT_LARGE: // 16x32 on OLED
tft_font = 4; // 26px
font_vScale = 26;
break;
case MY_FONT_NORMAL:
case MY_FONT_LARGE:
myfont = 8;
break;
case MY_FONT_STRETCHED:
myfont = 16;
case MY_FONT_SMALL: // 6x8 on OLED
case MY_FONT_NORMAL: // 8x8 on OLED
tft_font = 2; // 16px
font_vScale = 16;
break;
default:
myfont = 8;
tft_font = 2; // 16px
font_vScale = 16;
}
tft.drawString(temp, x * tft.textWidth("_", font) / myfont,
y * tft.fontHeight(font), font);
tft.setCursor(x, y * font_vScale, tft_font);
tft.printf(temp);
#endif
if (temp != loc_buf) {

View File

@ -64,14 +64,14 @@
#define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red
#define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
//#define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
#define LOAD_FONT2 // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters
#define LOAD_FONT4 // Font 4. Medium 26 pixel high font, needs ~5848 bytes in FLASH, 96 characters
#define LOAD_FONT6 // Font 6. Large 48 pixel font, needs ~2666 bytes in FLASH, only characters 1234567890:-.apm
#define LOAD_FONT7 // Font 7. 7 segment 48 pixel font, needs ~2438 bytes in FLASH, only characters 1234567890:-.
#define LOAD_FONT8 // Font 8. Large 75 pixel font needs ~3256 bytes in FLASH, only characters 1234567890:-.
//#define LOAD_FONT6 // Font 6. Large 48 pixel font, needs ~2666 bytes in FLASH, only characters 1234567890:-.apm
//#define LOAD_FONT7 // Font 7. 7 segment 48 pixel font, needs ~2438 bytes in FLASH, only characters 1234567890:-.
//#define LOAD_FONT8 // Font 8. Large 75 pixel font needs ~3256 bytes in FLASH, only characters 1234567890:-.
//#define LOAD_FONT8N // Font 8. Alternative to Font 8 above, slightly narrower, so 3 digits fit a 160 pixel TFT
#define LOAD_GFXFF // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts
//#define LOAD_GFXFF // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts
#define SMOOTH_FONT
#define SPI_FREQUENCY 40000000

View File

@ -65,14 +65,14 @@
#define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red
#define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
//#define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
#define LOAD_FONT2 // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters
#define LOAD_FONT4 // Font 4. Medium 26 pixel high font, needs ~5848 bytes in FLASH, 96 characters
#define LOAD_FONT6 // Font 6. Large 48 pixel font, needs ~2666 bytes in FLASH, only characters 1234567890:-.apm
#define LOAD_FONT7 // Font 7. 7 segment 48 pixel font, needs ~2438 bytes in FLASH, only characters 1234567890:-.
#define LOAD_FONT8 // Font 8. Large 75 pixel font needs ~3256 bytes in FLASH, only characters 1234567890:-.
//#define LOAD_FONT6 // Font 6. Large 48 pixel font, needs ~2666 bytes in FLASH, only characters 1234567890:-.apm
//#define LOAD_FONT7 // Font 7. 7 segment 48 pixel font, needs ~2438 bytes in FLASH, only characters 1234567890:-.
//#define LOAD_FONT8 // Font 8. Large 75 pixel font needs ~3256 bytes in FLASH, only characters 1234567890:-.
//#define LOAD_FONT8N // Font 8. Alternative to Font 8 above, slightly narrower, so 3 digits fit a 160 pixel TFT
#define LOAD_GFXFF // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts
//#define LOAD_GFXFF // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts
#define SMOOTH_FONT
#define SPI_FREQUENCY 40000000