Added elekstube env to examples in platformio.ini
Added support for raw 16bpp RGB565 images. Upload /0.bin etc. See https://github.com/neptune2/EleksTube-IPS-Retro-Nixie-Digits for how to get the original digits.
This commit is contained in:
parent
625e04d208
commit
52b60fd6a6
@ -15,6 +15,7 @@
|
||||
default_envs = nodemcuv2, esp01_1m_full, esp32dev, esp32_eth
|
||||
|
||||
# Single binaries (uncomment your board)
|
||||
; default_envs = elekstube_ips
|
||||
; default_envs = nodemcuv2
|
||||
; default_envs = esp01_1m_full
|
||||
; default_envs = esp07
|
||||
|
@ -33,6 +33,7 @@ private:
|
||||
}
|
||||
|
||||
uint16_t output_buffer[TFT_HEIGHT][TFT_WIDTH];
|
||||
|
||||
|
||||
// These BMP functions are stolen directly from the TFT_SPIFFS_BMP example in the TFT_eSPI library.
|
||||
// Unfortunately, they aren't part of the library itself, so I had to copy them.
|
||||
@ -40,6 +41,34 @@ private:
|
||||
|
||||
//// BEGIN STOLEN CODE
|
||||
|
||||
bool drawBin(const char *filename) {
|
||||
fs::File bmpFS;
|
||||
|
||||
|
||||
// Open requested file on SD card
|
||||
bmpFS = WLED_FS.open(filename, "r");
|
||||
|
||||
if (!bmpFS)
|
||||
{
|
||||
Serial.print(F("File not found: "));
|
||||
Serial.println(filename);
|
||||
return(false);
|
||||
}
|
||||
|
||||
bool oldSwapBytes = getSwapBytes();
|
||||
setSwapBytes(true);
|
||||
|
||||
bmpFS.read((uint8_t *) output_buffer,64800);
|
||||
|
||||
pushImage(0, 0, 135, 240, (uint16_t *)output_buffer);
|
||||
|
||||
setSwapBytes(oldSwapBytes);
|
||||
|
||||
bmpFS.close();
|
||||
|
||||
return(true);
|
||||
}
|
||||
|
||||
bool drawBmp(const char *filename) {
|
||||
fs::File bmpFS;
|
||||
|
||||
@ -48,7 +77,8 @@ private:
|
||||
|
||||
if (!bmpFS)
|
||||
{
|
||||
Serial.println(F("File not found"));
|
||||
Serial.print(F("File not found: "));
|
||||
Serial.println(filename);
|
||||
return(false);
|
||||
}
|
||||
|
||||
@ -148,7 +178,12 @@ public:
|
||||
// Filenames are no bigger than "255.bmp\0"
|
||||
char file_name[10];
|
||||
sprintf(file_name, "/%d.bmp", digits[digit]);
|
||||
drawBmp(file_name);
|
||||
if (WLED_FS.exists(file_name)) {
|
||||
drawBmp(file_name);
|
||||
} else {
|
||||
sprintf(file_name, "/%d.bin", digits[digit]);
|
||||
drawBin(file_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user