bitbank2 / Print2BLE

MacOS app which allows drag and drop of images to BLE thermal printers
Apache License 2.0
70 stars 11 forks source link

Fails to build and to start on MacOS 13 Ventura #12

Closed rpilotte closed 1 year ago

rpilotte commented 1 year ago

Debug fails with

2022-11-17 22:08:09.379362+0100 Print2BLE[76575:1578471] ** Assertion failure in _NSTrackingAreaViewHelper trackingAreaHelper(NSView *)(), winTrackingAreas.m:168 2022-11-17 22:08:09.379625+0100 Print2BLE[76575:1578471] Failed to set (contentViewController) user defined inspected property on (NSWindow): _trackingAreaHelper not allocated yet!

I am discovering XCode and ObjectiveC and can only report.

bitbank2 commented 1 year ago

Thanks for pointing this out. I'm able to reproduce the issue, but have no idea how to fix it :(

bitbank2 commented 1 year ago

I just pushed a fix for this problem - please give it a try.

rpilotte commented 1 year ago

It's building now. Thanks. But, I have the same problem as with the Arduino library: only the top part of the picture is printing on the MX06 cat printer. Feed is working fine.

bitbank2 commented 1 year ago

It may be the BLE write method. I tried speeding things up by writing without response, but packets can get lost. Try changing it to writing with response. It will be slower, but more reliable.

leolobato commented 1 year ago

I did some investigation and turns our the issue is flow control, but asking to write with response doesn't work because the printer's characteristic does not support it:

(lldb) p (BOOL)self.myChar.properties & CBCharacteristicPropertyWrite
(unsigned long) $1 = 0
(lldb) p self.myChar.properties
(CBCharacteristicProperties) $4 = CBCharacteristicPropertyWriteWithoutResponse

So the quick solution here was to sleep for 0.1 second instead of writing waiting for a response. I just opened a pull request with the fix.

Hope it also fixes this issue on other printers!