letscontrolit / ESPEasy

Easy MultiSensor device based on ESP8266/ESP32
http://www.espeasy.com
Other
3.25k stars 2.2k forks source link

Brainstorming NeoPixel with 8x8 Display #3958

Closed fly74 closed 2 years ago

fly74 commented 2 years ago

As like in issue discussed, we could make this display more usable when we could put some pixel map to the flash to use it easily from rule to show maybe arrow, stop or other signs.

@TD-er @tonhuisman

fly74 commented 2 years ago

neopixelall,0,0,0 // Turn all off neopixel,1,20,0,0 // First pixel red neopixelline,2,12,0,20,0 // Pixel 2..12 green neopixelline,17,21,0,0,20 // Pixel 17..21 blue

look like this:

IMG_1399

Left/bottom is the first pixel of each panel.

fly74 commented 2 years ago
  • Why is your Tile Matrix height set to 2? Is there another display, in a separate case, below this display?

Only height set to 2 shows the C from ABC text.

BMP works with set to 1.

tonhuisman commented 2 years ago

Your settings are not matching the geometry, please adjust to: Matrix:

Tile:

fly74 commented 2 years ago

please adjust to: Screenshot 2022-03-12 174325

IMG_1400

BMP still mirrored. °|°

tonhuisman commented 2 years ago

I'm on to something, most likely a bug in my code 😅, working on it 👍

fly74 commented 2 years ago

I'm on to something, most likely a bug in my code 😅, working on it 👍

:) with a horizontal flip bmp it works

tonhuisman commented 2 years ago

Well, the intent is to have it working as 'designed' 😃

Updated builds: ESP_Easy_mega_20220312_custom_ESP32_4M316k.zip ESP_Easy_mega_20220312_custom_ESP8266_4M1M.zip

You should save the settings at least once after installing this update, because of a small change in settings structure.

fly74 commented 2 years ago

@tonhuisman What should I say. My settings works perfectly. Max brightness works and cannot be overruled by a command. Text and bmp are shown correctly. And at least the bmp load to display is very fast. No effect of painting pixels.

@TD-er so how can we get it in the normal esp32 build?

@tonhuisman perfect work !!👍👌

tonhuisman commented 2 years ago

~Well,~ I have to do a pull request first for this plugin, but I don't want to include it in the P116 PR as that is already overloaded. But this plugin really needs the AdafruitGFX_helper module, so I'm already thinking of creating a separate PR for that. It's on TD-er to decide when to merge those PR's, and he usually has good suggestions for (code) improvements, but he's a bit occupied with moving back to his rebuilt house, atm. That should be clearing up in a week or 2, I expect.

fly74 commented 2 years ago

An now the cherry. Can we load a bmp to tft as background and write text over it?

Yes, if you only supply the foreground color, the background will become transparent, so writing on top of an image will overlay as expected. But updating data, like time or temperature, will become a mess, as the previous content isn't overwritten, that's why a txtfull subcommand is available that also expects/applies a bg-color.

So back to this one. I ordered a 240x240 at first. The thing with temperatures over a background picture. Could we render the picture with new values to display it?

tonhuisman commented 2 years ago

Sure, you can reload the image as often as you like, and then write any text overlaying that, I'll share a sample when at the laptop again.

tonhuisman commented 2 years ago

I've created a small set of rules with an example to be used on a TFT equiped ESP:

on Rules#Timer=1 do
  st77xx,bmp,10,0,day_bg.bmp
  st77xx,txc,white // single color = transparent
  st77xx,txs,2 // Text size 2
  st77xx,txz,30,10,"%sysday_0%-%sysmonth_0%-%sysyear% %systm_hm%"
  st77xx,txz,160,110,"[BME#Temperature]{D}C"
  st77xx,txz,135,135,"RH [BME#Humidity]%"
  st77xx,txz,70,205,"[BME#Pressure] mBar"
endon

on System#Boot do
  loopTimerSet,1,60 // Every 60 seconds timer 1 fires
endon

(The bmp used is a bit smaller than the 240x240 display, that's why I've used a left-offset of 10. Numbers are dummy, date/time is real.) Could be made a lot smarter, of course, like switching to a night background after sunset, and back to the day bg after sunrise, and only update if any of the data values is different.

And that could look like this: IMG_20220313_144713 (Hardest part was fitting the 150 kB bmp file on the rather small storage of the ESP32 🤔, so I cheated and used an ESP8266 🤣)

fly74 commented 2 years ago

A really good solution. Where is the filesystem stored, SPIFFS?

Can we make a custom partition table without OTA to use more space for the filesystem for a few pics? Or can we load the pics from a HTTP link?

Screenshot 2022-03-13 193318

How fast is the repaint?

tonhuisman commented 2 years ago

The filesystem is indeed in the SPIFFS partition (both the SPIFFS and the LittleFS filesystems, on builds named LittleFS, are using that space, the partition is just always called SPIFFS). The 2 OTA partitions are used alternately when updating via OTA, so that space can't be used for anything else.

A possible solution is to use a MAX build, on an ESP32 with 16 MB flash, that can have a 1, 2 or 8 MB filesystem, or use a build (and hardware) that includes a SD-card, as the files are read from SD if not found on the internal filesystem. My ESP with SD-card wouldn't cooperate, so haven't been able to test that yet 🤔

Work has been done in PR #3640 to read configuration from a remote location, and I expect to be able to use that feature to read a file via http, after it is merged.

fly74 commented 2 years ago

Work has been done in PR #3640 to read configuration from a remote location, and I expect to be able to use that feature to read a file via http, after it is merged.

That would be good. I have an apache who can serve the pics with no limits.

fly74 commented 2 years ago

I know the sense of the 2 OTA partition, but I could live without OTA and only updating with serial in this case. Could we make a non OTA ESP32 build and SPIFFS extended from the 2nd OTA partition?

@TD-er @tonhuisman

tonhuisman commented 2 years ago

I've cobbled up a ESP32_4M2M_NO_OTA configuration, that uses this partition table, having 2MB local storage: Screenshot - 13_03_2022 , 21_59_47

I'll test it a bit more, as I've seen unstable behavior using 2MB SPIFFS on an ESP32, so maybe I'll have to switch to LittleFS. That's a wipe/reconfigure operation 😯

I kept the app1 partition for now, with a minimal size (4k), as I'm unsure how it would respond if I left out the otadata and app1 partitions, I'll test that later if I have some more time available (and a less annoying ESP32 board that doesn't need 'hand-holding' (pull GPIO-0 to gnd) to initiate the flash process 😞, this one, could be caused by me selecting the cheaper CH9102X usb-serial chip).

tonhuisman commented 2 years ago

So I took a little time, and now re-flashed it using a single app partition and using LittleFS: 😄

(Updated partitioning, see below)

fly74 commented 2 years ago

I think it's a good idea to have a no OTA build version with more space for the filesystem, maybe we can include it to the normal build process. @TD-er

fly74 commented 2 years ago

on Rules#Timer=1 do st77xx,bmp,10,0,day_bg.bmp st77xx,txc,white // single color = transparent st77xx,txs,2 // Text size 2 st77xx,txz,30,10,"%sysday_0%-%sysmonth_0%-%sysyear% %systm_hm%" st77xx,txz,160,110,"[BME#Temperature]{D}C" st77xx,txz,135,135,"RH [BME#Humidity]%" st77xx,txz,70,205,"[BME#Pressure] mBar" endon

on System#Boot do loopTimerSet,1,60 // Every 60 seconds timer 1 fires endon

@tonhuisman Received my TFT today, but I need the NO-OTA bin for tests with the ESP32, can you provide it?

tonhuisman commented 2 years ago

⚠️ Dragons ahead! ⚠️ You can try this test-build, but no guarantee that this is the final partitioning layout (we may decide to enlarge the code partition in favor of the LittleFS storage), as when the partitioning changes, the ESP will 'loose' all its settings and files (you can backup before you overwrite and restore afterward), and no guarantee that it will even make it into the mega branch of ESPEasy, that's not decided yet. ⚠️

I've squeezed another 124 kB of storage from the free space at the end of the layout, so it is actually ~2.1 MB of storage. Same set of plugins as in previous test-builds.

ESP_Easy_mega_20220314_custom_ESP32_4M2M_NO_OTA_LittleFS-factory.zip

This .bin file should be flashed starting at address 0x0 (and not 0x10000) ⚠️

~(NB: I'm having some trouble getting my, probably wonky, ESP32 MiniKit module to boot properly. Sometimes it does, and the next couple of times it doesn't boot 😞)~ Solved by using a different USB cable, the voltage regulator on this unit is a very marginal one, causing frustrating issues like this. If the voltage drops a little over the cable, it won't boot 👎

Now it's running again, I'm able to get the partitioning map: Screenshot - 14_03_2022 , 22_41_07

fly74 commented 2 years ago

@tonhuisman Thank you. Nice playground. No fake data 😂 image

image

fly74 commented 2 years ago

But definitively we need bigger displays.

tonhuisman commented 2 years ago

But definitively we need bigger displays.

On Ali Express you should be able to find bigger displays, like this 4.0" ILI9486 SPI device (there are several suppliers, pick your preferred cost/shipping options), and that display is supported by P095, TFT ILI9xxx, included in the test-build 😉 Also available with XPT2046 resistive touchscreen, again, supported by a matching plugin, P099, in ESPEasy 😺 P095 has the same graphics commands available, including the bmp subcommand, but with a different trigger, like tft, ili9341, ili9486 etc., to avoid you to prefix the commands with the taskname.

fly74 commented 2 years ago

@tonhuisman Hi Ton, I need the custom build with neopixel and 7 segment plugin, can u make it? I soldered a combo with neopixel and a 7seg and now I realized that it is not in :(

fly74 commented 2 years ago

image

tonhuisman commented 2 years ago

Custom builds, including P073 (7DGT) and P131 (NeoPixel Matrix): ESP_Easy_mega_20220404_custom_ESP8266_4M1M.zip ESP_Easy_mega_20220404_custom_ESP32_4M316k.zip

fly74 commented 2 years ago

@tonhuisman you're great 👍.

image

fly74 commented 2 years ago

@tonhuisman is it possible to add a 0.5 font scaling to have 2 lines at one 8x8 neopixel with a 4 pixel font?

TD-er commented 2 years ago

@tonhuisman is it possible to add a 0.5 font scaling to have 2 lines at one 8x8 neopixel with a 4 pixel font?

How do you want to represent a 4 pixel font? For example for the letter e or number 3 you need already 5 pixels height. Width needs also at least 5 pixels for letters like "W", "M" and you need a whitespace between the letters too. I think the absolute minimum for a font is 5x5 pixels (+1 pixel to separate characters), but then you already have to make a lot of compromises.

fly74 commented 2 years ago

No a simple font like in 7 segment plugin with 3 pixel hight would be enough. Maybe to show 4 numbers in a square. If you know what I mean.

tonhuisman commented 2 years ago

a 0.5 font scaling to have 2 lines at one 8x8 neopixel with a 4 pixel font?

That is going to be quite hard, as the scaling factor is an integer variable, and normally text is written using a font, but also needs some white-space between the lines to have readable characters (though that's 'fixable' using different colors). So you would end up with 4 pixel high font, making it ~nearly~ impossible to have readable characters.

What you need is a neopixel matrix with smaller size LEDs, and a smaller pixel pitch, similar to this ~Adafruit matrix display (you can select different display sizes and pixel pitches).~ (that's not a NeoPixel matrix 😞) this is a NeoPixel display though not really small

fly74 commented 2 years ago

Okay. That's clear. It was just a thought 💭.

fly74 commented 2 years ago

@tonhuisman is the neopixel-bmp-thing in the new release ESP_Easy_mega_20220427_normal_ESP32_4M316k.bin included?

I think the no-ota build is only necessary for the TFT plugin with space for big bmp's. The neopixel only needs small bmp's.

tonhuisman commented 2 years ago

No, that's not merged yet, as then this issue would have been automatically closed by GH. But the plugin will be available in the display and max builds only (and I intend to include it in the neopixel builds once plugin P128 (NeoPixelFX), introducing these builds, is merged), or you can enable it in a custom build when compiling locally.

I expect that the NO_OTA build will not be used much, indeed, but it is still nice to have when bigger bitmaps need to be displayed.

fly74 commented 2 years ago

No, that's not merged yet, as then this issue would have been automatically closed by GH. But the plugin will be available in the display and max builds only (and I intend to include it in the neopixel builds once plugin P128 (NeoPixelFX), introducing these builds, is merged), or you can enable it in a custom build when compiling locally.

I expect that the NO_OTA build will not be used much, indeed, but it is still nice to have when bigger bitmaps need to be displayed.

Ok, @tonhuisman , let me know when it is in the official downloadable build. thx.

fly74 commented 2 years ago

@tonhuisman Hi Ton, ESP_Easy_mega_20220616_neopixel_ESP32_4M316k results in: Screenshot 2022-06-16 232453

Did I understand the relasenotes wrong that the plugin from our testbuild is in the neopixel build?

TD-er commented 2 years ago

Not sure if that's the same PR as you mention, but it seems to be that the PR is still open: https://github.com/letscontrolit/ESPEasy/pull/3990

At least you didn't need to download 600+ MB this release ;)

tonhuisman commented 2 years ago

P131 is not released yet, only P128, for 'fancy' effects using Neopixel stripes, is in that build, besides the Normal plugins. I'll provide a neopixel build, from that branch, on Friday, first need some sleep 😃.

tonhuisman commented 2 years ago

As promised the NeoPixel builds from PR3990, including the NeoPixel Matrix display (P131). ESP32 and EXP32s2: (4M316k builds only) ESP_Easy_mega_20220617_neopixel_ESP32_PR3990.zip (~3.5 MB) ESP8266: (1M and 4M builds, 4M needs LIMIT_BUILD_SIZE to be set, so is missing some features and logging, similar to TEST builds) ESP_Easy_mega_20220617_neopixel_ESP8266_PR3990.zip (~1.6 MB)

fly74 commented 2 years ago

Still no luck with ESP_Easy_mega_20220617_neopixel_ESP32_4M316k

"Plugin 131 not included in build" :/

tonhuisman commented 2 years ago

I have initially uploaded builds that did not include the plugin, as I had not yet added it to the NEOPIXEL build config, and about 20 minutes later I corrected that to the current downloads. Did you by chance get that initial download? Then re-downloading should fix that, sorry.

fly74 commented 2 years ago

You're right, I used the link from the GIT HUB mail. The new file works, but after reboot it shows "ES" on a 2 module config. Despite the rule "On System#Boot" to show a black bmp. The events from the network switching the pics correctly.

tonhuisman commented 2 years ago

Ah 😅, that's the new Splash-screen setting, you can turn that off on the device configuration page. I'll disable that 'feature' by default for this plugin, as it doesn't sound useful for this type of display.

fly74 commented 2 years ago

😅 Mmh, I think default splashscreen off would be a good thing. So everything looks fine. Is this build automatically generated with the next official builds?

tonhuisman commented 2 years ago

I'm still working on a text-scroll feature, like available in 7DGT and MAX7219 dotmatrix displays (that somewhat resembles the NeoMatrix display), but progress is slow at the moment.

Not sure when this plugin will be merged, but you can create your own from the PR branch, or download from the PR' Actions build after each commit, as I've now included it in the NeoPixel build config.

fly74 commented 2 years ago

I think I will wait until it's ready to be merged.

tonhuisman commented 2 years ago

@fly74 I've updated the plugin code with horizontal-scroll feature now, maybe you can test that too?

NEOPIXEL Builds, including P073 7DGT ESP32 and ESP32-S2 (4M316k) ESP_Easy_mega_20220716_neopixel_ESP32_4M316k_PR3990_7dgt.zip

ESP8266 (4M1M only) ESP_Easy_mega_20220716_neopixel_ESP8266_4M1M_PR3990_7dgt.zip


NB: In my searches I've also found a display with very small NeoPixels on it, the M5Stack NeoFlash Hat (designed for M5StickC, but works on any ESP). Unfortunately, this device is EOL, but some suppliers might still have some in stock. It is only 187 pixels, causing some characters in the font to be drawn incomplete (the ones that hang 'below' the baseline, like y, p, g, q, j, etc), but most other characters are drawn fully. Haven't tested with other fonts yet, but most likely they won't fit very well. Also I haven't found a way to connect multiple of these displays in sequence, the soldering pads are very* small. With the scroll feature implemented, I'm at least able to display ESPEasy completely on it (only ESP fits without scroll), and also on the 4 tile 8x8 matrices display now 😃

fly74 commented 2 years ago

@tonhuisman Hi ton, we're on tour at the moment. But sure I'll test it if I back. 👍🤓

fly74 commented 2 years ago

@tonhuisman m5 is really nice. But it's not a ws2818b chain or is it?