InstaxBLE
InstaxBLE copied to clipboard
Instax Mini Link 3 compatibility issue
Thank you for your wonderful repository.
Recently, I bought Instax Mini Link 3 and I tested this repo to print images from my computer. However, it does not work. My printer just blinking yellow light. According to manual, this means 'film is jammed'. (However, it is not jammed really because I can print image from my smartphone application.)
So, I captured packets between Instax Link app and Instax Mini Link 3. I do not have previous version of Instax printer, but it seems same until the image download sequences.
And I found differences after PRINT_IMAGE_DOWNLOAD_END.
Current version of InstaxBLE send PRINT_IMAGE packet after the end of image download.
But in case of Mini Link 3, it sends packet beginning with 0x30 0x03 (LED_PATTERN_SETTINGS_DOUBLE) between PRINT_IMAGE_DOWNLOAD_END and PRINT_IMAGE.
(Full content is here: https://pastebin.com/8zYqZAry)
Is there any references or something similar about Instax Printer opcode? If it exists, I want to make this repository compatible with Mini Link 3.
Thanks again
Before I take a look at the log (thanks for that!) my first question is always the same: are you sure you enabled printing in the script? By default the image will be send over, but the actual PRINT command will not be send (to prevent accidental prints during testing). See this part of the readme. It sounds like you might have, but just asking to make sure ;) On my Link Mini the yellow light comes on when the image is sent, but printing is not enabled; it's basically a "something unexpected happened" signal.
To answer your last question; there isn't any official documentation for the opcodes. The whole script is based on reverse engineering the mobile app, which don't offer much info besides some variable names.
As this script was a side project I have limited time to work on it, but I'd love to make sure we get it to work with the Link Mini 3!
Thank you for your response.
First, I solved problem that I previously described. And LED_PATTERN_SETTINGS_DOUBLE was not related to printing.
In conlusion, there was a problem in my test code. I just copied and pasted test code from README.
But this code disconnects before download complete. So I append sleep(300) to wait for download sequences.
Below is my test code.
instax = InstaxBLE(device_name="INSTAX")
instax.connect()
instax.enable_printing() # allow printing
instax.print_image("image.jpg") # print image
sleep(300)
instax.disconnect() # all done, disconnect
However, I faced to another problem.
When I execute the above code, progress stucks at Img packets left to send: 20 (or 30).
So, I edited max_size_kb=105 to max_size_kb=55 in print_image. (Line 376, 380)
(55 is a number I arbitrarily chose.)
Then, it works successfully without any problem.
In the other words, I can print my own image from my computer :)
By the way, I want to print my image in best quality and find origin of problem.
In my opinion, it seems there are some bugs in resizing algorithm.
When I tested above, size of my original image is 3.5MB, and resized image is 104,738B. (I saved resized image from save_img_with_quality)
However, body of sent packet is Ab\x00\x0f\x10\x00\x02\x00\x00\x00\x00\x01\xc1\xc2\xb7.
And this mean the size of image that sent is 115,138B which is greater than 105kB.
It is why the progress stucks I think.
Also, I checked value of len(imgData) in below code using debugger, and its value is 115138.
# Line 383-385, print_image in InstaxBLE
self.packetsForPrinting = [
self.create_packet(EventType.PRINT_IMAGE_DOWNLOAD_START, b'\x02\x00\x00\x00' + pack('>I', len(imgData)))
]
I think it is some kind of overhead, and its size is 10400. But I do not know meaning of this number and how to handle it. Is there any idea about this? Or that I missed something?
Thanks again
-
Ah so the yellow light was indeed the 'something went wrong' message: the printer would only receive part of the commands before the script would disconnect, leaving the printer in an error state. It just wasn't for the reason I thought it might be. The built-in example (when you run
instaxBLE.pydirectly) already had this pause, but I never realized it was missing from the example in the readme. I've updated those, thanks. -
Not a problem, but I wonder what
LED_PATTERN_SETTINGS_DOUBLEactually is for, as I never used it in my scripts. -
I also wonder if the Link 3 needs some other settings, like how the Link 2 was different from the Link. If you look in Types.py you'll see a
PrinterSettingsobject. Currently we get the requested image size from the printer and use that to determine the printer model but maybe this is overlapping with one of the existing models, even though the actual image we're sending can be made larger.
Could you try running instax.get_printer_info() and note what details it shows?
By the way, check out the first comment in issue #18. Maybe you can use it to find the right values for your maximum image size.
I figured the Instax app must have been updated since they released the Link 3, and do see some differences. One thing I'd be interested in is determine what printer we are using based on the model number (instead of the image size).
I'd love to improve InstaxBLE (make sure we support all printers, replacing the hard sleep() with a nicer threading system #11 ) but reverse engineering the app and implementing these things takes a huge amount of (unpaid) time which I can't always afford.
Thank you for your repsonse. And #11 #18 is very helpful to me!
Below is result of instax.get_printer_info()
Printer details:
Model: Instax Mini Link
Photos left: 6/10
Battery level: 95%
Charging: False
Required image size: 600x800px
MTU: 244
But I think there is no significant difference between PrinterSettings and this.
Now I am finding about maximum size of image from packets currently.