mirror of
https://github.com/NaitLee/Cat-Printer.git
synced 2025-05-15 14:50:26 -07:00
Workaround paper feeding for MX05/MX06;
Better Models code, categorized; Follow up newer Bleak, handle “no powered Bluetooth adapters”
This commit is contained in:
parent
4fa145459b
commit
08a67f7b5a
9
TODO
9
TODO
@ -7,17 +7,16 @@ Note: not ordered. do whatever I/you want
|
||||
+ Make error notice short while let users see detailed help/manual for what-to-do
|
||||
+ Even better CUPS/IPP support
|
||||
+ Even better frontend, language-friendly text printing
|
||||
+ Tcl/Tk frontend. More in dev-diary.txt, July 7th.
|
||||
+ Make a build guide for android:
|
||||
Summary the hacks to p4a, bleak p4a recipe, p4a webview bootstrap, and AdvancedWebView
|
||||
+ Tcl/Tk frontend. More in dev-diary.txt, July 7th 2022.
|
||||
+ Try to implement enough without more dependencies
|
||||
+ More funny "languages" (now there's lolcat; I think the next is 文言)
|
||||
+ Arch Linux package / AUR, package for other distros
|
||||
+ Service for other init systems (a systemd unit file is there)
|
||||
+ ...
|
||||
|
||||
? Optimize PF2 text printing? It seems a bit slow (in bit processing).
|
||||
? Use something else as server part of backend? This can boost things up, and build some (essential) image manipulation in, quicker. And strip some way-too-big Python libs away (for smaller Windows/Android dist).
|
||||
? Optimize PF2 text printing? It seems a bit slow (in bit processing)
|
||||
? Fix feeding command for MX05/MX06
|
||||
? Use something else as server part of backend? This can boost things up, and build some (essential) image manipulation in, quicker. And strip some way-too-big Python libs away (for smaller Windows/Android dist)
|
||||
? Built-in PostScript (Even if very basic)
|
||||
? Data compression for GB03 alike. Optional
|
||||
? Plugin, for including community features (that involves usefulness but also bloatness)
|
||||
|
@ -196,3 +196,11 @@ But hey, in this rewrite some algorithm practial overhead was removed, thus much
|
||||
|
||||
In main.js the event handler was reworked too. No more double event dispatches.
|
||||
Thanks to this, another image processing performance problem is fixed.
|
||||
|
||||
YEAR 2023
|
||||
|
||||
APRIL
|
||||
|
||||
2nd
|
||||
|
||||
Anniversary days to Cat-Printer! Thank all of you! Keep it up!
|
||||
|
@ -462,7 +462,11 @@ class PrinterDriver(Commander):
|
||||
def _finish(self):
|
||||
self.end_lattice()
|
||||
self.set_speed(8)
|
||||
self.feed_paper(128)
|
||||
if self.model.problem_feeding:
|
||||
for _ in range(128):
|
||||
self.draw_bitmap(bytes(self.model.paper_width // 8))
|
||||
else:
|
||||
self.feed_paper(128)
|
||||
self.get_device_state()
|
||||
self.flush()
|
||||
|
||||
|
@ -8,20 +8,24 @@ License CC0-1.0-only: https://directory.fsf.org/wiki/License:CC0
|
||||
class Model():
|
||||
''' A printer model
|
||||
`paper_width`: pixels per line for the model/paper
|
||||
`is_new`: some models can use compressed data. the algorithm isn't implemented in Cat-Printer yet, but should be no harm.
|
||||
`is_new_kind`: some models have new "start print" command and can understand compressed data.
|
||||
the algorithm isn't implemented in Cat-Printer yet, but this should be no harm.
|
||||
`problem_feeding`: didn't yet figure out MX05/MX06 bad behavior giving feed command, use workaround for them
|
||||
'''
|
||||
paper_width: int
|
||||
is_new_kind: bool
|
||||
def __init__(self, width, is_new):
|
||||
self.paper_width = width
|
||||
self.is_new_kind = is_new
|
||||
paper_width: int = 384
|
||||
is_new_kind: bool = False
|
||||
problem_feeding: bool = False
|
||||
|
||||
Models = {
|
||||
'YT01': Model(384, False),
|
||||
'MX05': Model(384, False),
|
||||
'MX06': Model(384, False),
|
||||
'GB01': Model(384, False),
|
||||
'GB02': Model(384, False),
|
||||
'GB03': Model(384, True),
|
||||
'GT01': Model(384, False),
|
||||
}
|
||||
Models = {}
|
||||
|
||||
# all known supported models
|
||||
for name in 'GB01 GB02 GB03 GT01 MX05 MX06 YT01'.split(' '):
|
||||
Models[name] = Model()
|
||||
|
||||
# that can receive compressed data
|
||||
for name in 'GB03'.split(' '):
|
||||
Models[name].is_new_kind = True
|
||||
|
||||
# that have problem giving feed command
|
||||
for name in 'MX05 MX06'.split(' '):
|
||||
Models[name].problem_feeding = True
|
||||
|
@ -924,6 +924,7 @@ class Main {
|
||||
error_details.name === 'org.freedesktop.DBus.Error.UnknownObject' ||
|
||||
error_details.name === 'org.bluez.Error.NotReady' ||
|
||||
error_details.details.includes('not turned on') ||
|
||||
error_details.details.includes('No powered Bluetooth adapter') ||
|
||||
error_details.details.includes('WinError -2147020577')
|
||||
) Notice.warn('please-enable-bluetooth');
|
||||
else if (
|
||||
|
Loading…
x
Reference in New Issue
Block a user