A few small fixes
| @@ -41,6 +41,7 @@ private: | ||||
|  | ||||
|   //// BEGIN STOLEN CODE | ||||
|  | ||||
|   // Draw directly from file stored in RGB565 format | ||||
|   bool drawBin(const char *filename) { | ||||
|     fs::File bmpFS; | ||||
|  | ||||
| @@ -55,14 +56,25 @@ private: | ||||
|       return(false); | ||||
|     } | ||||
|  | ||||
|     bool oldSwapBytes = getSwapBytes(); | ||||
|     setSwapBytes(true); | ||||
|     size_t sz = bmpFS.size(); | ||||
|     if (sz <= 64800) | ||||
|     { | ||||
|       bool oldSwapBytes = getSwapBytes(); | ||||
|       setSwapBytes(true); | ||||
|  | ||||
|     bmpFS.read((uint8_t *) output_buffer,64800); | ||||
|       int16_t h = sz / (135 * 2); | ||||
|  | ||||
|     pushImage(0, 0,  135, 240, (uint16_t *)output_buffer); | ||||
|       //draw img that is shorter than 240pix into the center | ||||
|       int16_t y = (height() - h) /2; | ||||
|  | ||||
|     setSwapBytes(oldSwapBytes); | ||||
|       bmpFS.read((uint8_t *) output_buffer,sz); | ||||
|  | ||||
|       if (!realtimeMode || realtimeOverride) strip.service(); | ||||
|  | ||||
|       pushImage(0, y, 135, h, (uint16_t *)output_buffer); | ||||
|  | ||||
|       setSwapBytes(oldSwapBytes); | ||||
|     } | ||||
|  | ||||
|     bmpFS.close(); | ||||
|  | ||||
|   | ||||
| Before Width: | Height: | Size: 84 KiB | 
| Before Width: | Height: | Size: 84 KiB | 
| Before Width: | Height: | Size: 84 KiB | 
| Before Width: | Height: | Size: 84 KiB | 
| Before Width: | Height: | Size: 84 KiB | 
| Before Width: | Height: | Size: 84 KiB | 
| Before Width: | Height: | Size: 84 KiB | 
| Before Width: | Height: | Size: 84 KiB | 
| Before Width: | Height: | Size: 84 KiB | 
| Before Width: | Height: | Size: 84 KiB | 
| @@ -5,7 +5,7 @@ It enables running all WLED effects on the background SK6812 lighting, while dis | ||||
| Code is largely based on https://github.com/SmittyHalibut/EleksTubeHAX by Mark Smith! | ||||
|  | ||||
| Supported: | ||||
| - Display with custom bitmaps from filesystem | ||||
| - Display with custom bitmaps or raw RGB565 images (.bin) from filesystem | ||||
| - Background lighting | ||||
| - Power button | ||||
| - RTC (with RTC usermod) | ||||
| @@ -14,8 +14,18 @@ Supported: | ||||
| Not supported: | ||||
| - 3 navigation buttons, on-device setup | ||||
|  | ||||
| Your images must be exactly 135 pixels wide and 1-240 pixels high. | ||||
|  | ||||
| ## Installation  | ||||
|  | ||||
| Compile and upload to clock using the `elekstube_ips` PlatformIO environment | ||||
| Once uploaded (the clock can be flashed like any ESP32 module), go to `[WLED-IP]/edit` and upload the 0-9.bmp files from the bmp folder. | ||||
| Use LED pin 12, relay pin 27 and button pin 34. | ||||
| Once uploaded (the clock can be flashed like any ESP32 module), go to `[WLED-IP]/edit` and upload the 0-9.bin files from [here](https://github.com/Aircoookie/NixieThemes/tree/master/themes/RealisticNixie/bin). | ||||
| You can find more clockfaces in the [NixieThemes](https://github.com/Aircoookie/NixieThemes/) repo. | ||||
| Use LED pin 12, relay pin 27 and button pin 34. | ||||
|  | ||||
| ## Use of RGB565 images | ||||
|  | ||||
| Binary 16-bit per pixel RGB565 format `.bin` images are now supported. This has the benefit of only using 2/3rds of the file size a `.bmp` has. | ||||
| The drawback is that this format cannot be handled by common image programs and that an extra conversion step is needed. | ||||
| You can use https://lvgl.io/tools/imageconverter to convert your .bmp to a .bin file (settings `True color` and `Binary RGB565`) | ||||
| Thank you to @RedNax67 for adding .bin support. | ||||
 cschwinne
					cschwinne