Fix P15 clone print failures (empty labels / power-off crash)#13
Merged
Fix P15 clone print failures (empty labels / power-off crash)#13
Conversation
Pristar P15 (and likely other clones) powers off when printing because: 1. MTU notification (220) overrides the profile's packet size from 95 to 217, overwhelming the printer's application buffer. The official Marklife app forces device-specific sizes on every tick, ignoring MTU for P15 devices. 2. FlowController.reset() cleared hasRealCredits before each print job, causing starvation recovery to bypass credit-based flow control for the first few packets — even when the printer actively sends credits via CX. 3. Starvation recovery timeout was 30ms vs the official app's 1000ms, blasting packets far too aggressively when credits aren't flowing. Changes: - Cap MTU-derived packet size at profile's explicit packetSize - Preserve hasRealCredits across reset (connection property, not per-job) - Increase starvation timeout from 30ms to 1000ms to match official app
The decompiled app uses a configurable dataPacketDelay (30ms for P15 and most devices) between BLE writes. Our packetDelayMs option existed in the type but was never wired into the send loop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
packetSize: 95but an MTU notification of 220 was overriding it to 217. Clones with smaller application-level buffers either crash (Pristar P15 powers off) or silently truncate each write, losing ~56% of image data and producing blank labels. The official Marklife app forces device-specific sizes on every tick, ignoring MTU for P15/P12 devices.hasRealCreditsacross print jobs.FlowController.reset()was clearing this flag before each job, causing starvation recovery to bypass credit-based flow control for the first few packets — even when the printer actively sends credits via CX.dataPacketDelay.Context
Reported by a user with a Pristar P15 (clone of Marklife P15). Device discovers and connects fine, but at 100% print progress the printer powers off and the frontend shows a timeout. Debug log showed
mtu=220 packet=217overriding the profile's 95-byte packet size.