-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
512 bytes limit for png and gif on new 32x32 panel from Ali Express #50
Comments
Note: tried chaning the png_chunks = self._splitIntoChunks(png_data, 4096) 4096 to 512 or 256 and I got the same result... no difference |
I did a build on Windows, just to see if there is something wrong with my rPi3 build and I get the same problem - as soon as the PNG/GIF is bigger than 512 bytes it doesn't want to upload. But on windows I get an actual error when using bigger files than 512: 11.10.2024 02:04:36 :: DEBUG :: idotmatrix.connectionManager :: sending message(s) to device |
More investigation... In the method _createPayloads as soon as the whole payload that is created extends 512 bytes I get the error. |
Found a github repository https://github.com/8none1/idotmatrix Won't be closing this issue until someone fixes it. |
Hi @TomCat666 you're right. This still is an ongoing issue. However, I am still not able to work as much for this project as I wanted to. I'll mark your issue and will look into it :) |
only difference I can see from what https://github.com/8none1/idotmatrix generated is in the size field of the headers field "total payload size inc headers over all chunks " for the example 18 animated gif (raw gif size is 5599 bytes 0x15df https://github.com/8none1/idotmatrix/blob/main/assets_test/downloads/NEWGIFS2/18.GIF) eg chunk0 "ff 15 00 00" while this library uses "ef 15 00 00" diff idotmatrix_controller.log python3-idotmatrix.log
2c2
< 1010010000ff1500009c841fd505000d
---
> 1010010000ef1500009c841fd505000d
261c261
< ef05010002ff1500009c841fd505000d
---
> ef05010002ef1500009c841fd505000d
Here are the logs (formatted into 16 byte lines) But I cant make either upload this 18.GIF Ill re-enable bluetooth logging and see the app is doing (in a few days, if I get time) |
Typical. I upload the example 18.gif to my phone and sent it to the idotmatrix, and guess what it doesn't display via the app either!! (yes its 32x32 which matches my device) |
@ellensp I have committed some updates to the idotmatrix-libary as well as bumping the library version in this repository. Simply run "create_venv.sh" again and check if it is working now. There is some upper timeout for GIFs. Maybe someone can figure this out. At least my bigger demo gifs with around 6 to 8kb are working now. Please see also issue #32 which also is about gifs not working correctly. |
Update: seems it still works unreliable. Worked even after reboot and now it isn't working properly anmore. Damn china stuff :D |
Doesn't seem to work at all here for GIF's bigger than 512 bytes still.... I got the other library working nicely now though. The author added the reset (delete) command which I need to call every 20 or so gif uploads so the device is reset (only takes a fraction of a second). If I don't do that then it looses connection after a while (china stuff :) ). Now it is running non-stop 24/7 without any hiccups. |
@TomCat666 okay, I will look into this again :) should be fixable. No idea currently what exactly the problem is though. |
can you provide a example or two that never works |
All 3 examples provided uploaded to my 32x32 iDotMatrix display without issues using the python3-idotmatrix-client Ie the following commands all worked fine. (your address will be different) Make sure you updated the idotmatrix library to 0.0.7
|
Ahh, that was it. After updating it is working now. Thank you ! |
Hi. gifs are working fine in 0.0.7, but I have a problem with PNGs. no matter what, only PNG I got working was demo_32.png - yellow duck. I tried upload.Processed and uploadUnprocessed. demo_16.png does come trhough to the display but only if sent Unprocessed, and it comes scrambled - image unusable, just trying to think of the reason for this behavior. I did not get working any of my own PNGs, no matter how resized, resampled, stripped of alpha, etc, none worked. Filesize is no indicator too, as demo_16 is pretty smal and it still fails. Does anybody have any idea? my files: -rw-r--r-- 1 pi pi 1.3K Jun 21 2019 ./images/10n.png
-rw-r--r-- 1 pi pi 734 Nov 19 23:39 ./images/10n_r.png
-rw-r--r-- 1 pi pi 259 Nov 19 23:19 ./images/demo_16.png
-rw-r--r-- 1 pi pi 430 Nov 19 23:19 ./images/demo_32.png
-rw-r--r-- 1 pi pi 1.4K Nov 19 23:19 ./images/demo_512.png
-rw-r--r-- 1 pi pi 520 Nov 19 23:19 ./images/demo_64.png error is still the same: |
After patching the client to accept a command line that made sense diff --git a/core/cmd.py b/core/cmd.py
index aad3381..0b1086d 100644
--- a/core/cmd.py
+++ b/core/cmd.py
@@ -520,15 +520,15 @@ class CMD:
await image.setMode(
mode=1,
)
- if args.set_image:
+ if args.image:
if args.process_image:
await image.uploadProcessed(
- file_path=args.set_image,
+ file_path=args.image,
pixel_size=int(args.process_image),
)
else:
await image.uploadUnprocessed(
- file_path=args.set_image,
+ file_path=args.image,
)
async def gif(self, args): using python app.py --address 0E:81:B3:86:B3:54 --image ./images/demo_32.png produces 439 bytes of data to send.
using python app.py --address 0E:81:B3:86:B3:54 --image ./images/demo_16.png --process-image 32
|
Only using GIF's for now and after testing PNG's same problem here. There are cheap 64x64 LED panels now available which seem to use the same protocol and app... anyone tried those yet? |
The library needs to transmit smaller blocks in https://github.com/derkalle4/python3-idotmatrix-library/blob/main/idotmatrix/modules/image.py#L123 replace line 123
with chunks = self._splitIntoChunks(data, 512)
for chunk in chunks:
await self.conn.send(data=chunk) so far its worked on every test image I've done, up scaling from 16x16 though is a blur and not very nice After other have confirmed this works, will formalize a PR to get this corrected |
@ellensp for me, it does not. I might have an error somewhere else, but I cant find it - might be in the script I use to send PNG, but I cant see there a reason for this irregular behavior. import asyncio
from idotmatrix import ConnectionManager
import sys
import logging
async def main():
conn = ConnectionManager()
await conn.connectByAddress("97:2F:37:66:D5:98")
from idotmatrix import Image
image = Image()
await image.setMode(1)
await image.uploadProcessed(sys.argv[1], 32)
#await image.uploadUnprocessed(sys.argv[1])
if __name__ == "__main__":
try:
asyncio.run(main())
except KeyboardInterrupt:
quit() and the result is the same, only duck with 32x32 size works. pi@rpi0w:~/idotmatrix $ ./my-venv/bin/python png.py ./images/demo_16.png
20.11.2024 08:56:09 :: DEBUG :: asyncio :: Using selector: EpollSelector
20.11.2024 08:56:11 :: INFO :: idotmatrix.connectionManager :: connected to 97:2F:37:66:D5:98
20.11.2024 08:56:11 :: DEBUG :: idotmatrix.connectionManager :: sending message(s) to device
20.11.2024 08:56:11 :: DEBUG :: PIL.PngImagePlugin :: STREAM b'IHDR' 16 13
20.11.2024 08:56:11 :: DEBUG :: PIL.PngImagePlugin :: STREAM b'pHYs' 41 9
20.11.2024 08:56:11 :: DEBUG :: PIL.PngImagePlugin :: STREAM b'IDAT' 62 181
20.11.2024 08:56:11 :: DEBUG :: idotmatrix.connectionManager :: sending message(s) to device
20.11.2024 08:56:11 :: ERROR :: idotmatrix.modules.image :: could not upload processed image: [org.bluez.Error.Failed] Failed to initiate write
pi@rpi0w:~/idotmatrix $ ./my-venv/bin/python png.py ./images/demo_32.png
20.11.2024 08:56:19 :: DEBUG :: asyncio :: Using selector: EpollSelector
20.11.2024 08:56:20 :: INFO :: idotmatrix.connectionManager :: connected to 97:2F:37:66:D5:98
20.11.2024 08:56:20 :: DEBUG :: idotmatrix.connectionManager :: sending message(s) to device
20.11.2024 08:56:21 :: DEBUG :: PIL.PngImagePlugin :: STREAM b'IHDR' 16 13
20.11.2024 08:56:21 :: DEBUG :: PIL.PngImagePlugin :: STREAM b'pHYs' 41 9
20.11.2024 08:56:21 :: DEBUG :: PIL.PngImagePlugin :: STREAM b'IDAT' 62 352
20.11.2024 08:56:21 :: DEBUG :: idotmatrix.connectionManager :: sending message(s) to device
pi@rpi0w:~/idotmatrix $ ./my-venv/bin/python png.py ./images/demo_64.png
20.11.2024 08:56:27 :: DEBUG :: asyncio :: Using selector: EpollSelector
20.11.2024 08:56:29 :: INFO :: idotmatrix.connectionManager :: connected to 97:2F:37:66:D5:98
20.11.2024 08:56:29 :: DEBUG :: idotmatrix.connectionManager :: sending message(s) to device
20.11.2024 08:56:29 :: DEBUG :: PIL.PngImagePlugin :: STREAM b'IHDR' 16 13
20.11.2024 08:56:29 :: DEBUG :: PIL.PngImagePlugin :: STREAM b'pHYs' 41 9
20.11.2024 08:56:29 :: DEBUG :: PIL.PngImagePlugin :: STREAM b'IDAT' 62 442
20.11.2024 08:56:29 :: DEBUG :: idotmatrix.connectionManager :: sending message(s) to device
20.11.2024 08:56:29 :: ERROR :: idotmatrix.modules.image :: could not upload processed image: [org.bluez.Error.Failed] Failed to initiate write
|
you have not updated the library code. should have multiple sending message(s) lines as most images exceed 512 bytes your lib is in something like my-venv/lib/python3.12/site-packages/idotmatrix/modules/image.py I just created your script and here is my log (a few extra debug statements than you will have) python png.py ./images/demo_64.png 20.11.2024 21:20:17 :: DEBUG :: asyncio :: Using selector: EpollSelector |
dammit, I updated the wrong lib, outside of venv. now it works, with all the ducks and any other images. Thank you! |
I have found the odd few images that still will not upload, unknown as to why. another limit somewhere probably. |
I have one on the way. |
64x64 arrived today. haven't tested every option. uploading the demo.gif works but can't set the demo images.
|
Hi all, I got another 64 Pixel display about half a year ago and it worked exactly the same like my 32 pixel display. Just another brand where each LED pixel is visible (no plastic diffusor in front). Is it the same app? Maybe there are some differences. |
Ordered the 64x64 one with diffusor. If GIF loading works it is enough for me... :) |
Hi, Was playing around with this. First of all: thanks for this project; it saved me from installing the app on my phone. However I am experiencing the same problems on Windows. I'm even getting:
when trying to set a scrolling text beyond length "hello12". However, the I suggest:
|
Hello, I can also confirm that splitting the data into chuncks worked for me too. Thanks |
Thanks for the feedback. Will look into improving this :) |
The only image I have managed to write to the display is |
Hello
I have a problem with a new 32x32 panel I bought from AliExpress:
https://www.aliexpress.com/item/1005006130862334.html?spm=a2g0o.order_list.order_list_main.29.6c191802RhNszc
For some reason only png and gif files that are smaller than 512 bytes work on it. If I send bigger png's then I get black screen, if I send bigger gif animations then it goes directly to the default animations on the device. Don't know what to do but as soon as the file is bigger than 512 bytes I can't send anything. Clocks, countdowns, score panel, etc. all work fine.
Note: All animations from the iDotMatrix app and everything there works fine, so there is a problem somewhere else when sending data, I think.
Also I can import the same gif animations from photos to the iDotMatrix APP and it will display them perfectly, so definetly not a size problem on the device. But it is such a shitty APP ... I would love to be able to just use my rPI and send the gif's to the device in random order with a simple bash script.
The text was updated successfully, but these errors were encountered: