Working tree changes 2024-08-03 01:00
All checks were successful
Test project build / Build (push) Successful in 1m13s
All checks were successful
Test project build / Build (push) Successful in 1m13s
This commit is contained in:
parent
2b4a98a221
commit
0f2bd55538
@ -87,17 +87,33 @@
|
||||
on:change={onChangePre}
|
||||
/>
|
||||
<span class="input-group-text">px</span>
|
||||
|
||||
{#if $printerMeta !== undefined}
|
||||
{@const headSide = labelProps.printDirection == "left" ? labelProps.size.height : labelProps.size.width}
|
||||
{#if headSide > $printerMeta.printheadPixels}
|
||||
<span class="input-group-text text-warning" title="Label size is too big for your printer ({headSide} > {$printerMeta.printheadPixels})">
|
||||
<FaIcon icon="warning" />
|
||||
</span>
|
||||
{/if}
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<div class="input-group flex-nowrap input-group-sm mb-3">
|
||||
<span class="input-group-text">Print from</span>
|
||||
<select class="form-select" bind:value={labelProps.printDirection} on:change={onChangePre}>
|
||||
<option value="left">Left</option>
|
||||
<option value="top">Top</option>
|
||||
<option value="left"
|
||||
>{#if $printerMeta?.printDirection === "left"}✔{/if} Left</option
|
||||
>
|
||||
<option value="top"
|
||||
>{#if $printerMeta?.printDirection === "top"}✔{/if} Top</option
|
||||
>
|
||||
</select>
|
||||
{#if $printerMeta !== undefined && $printerMeta.printDirection !== labelProps.printDirection }
|
||||
<span class="input-group-text text-warning" title="Recommended direction for your printer is {labelProps.printDirection}" >
|
||||
<FaIcon icon="warning"/>
|
||||
{#if $printerMeta !== undefined && $printerMeta.printDirection !== labelProps.printDirection}
|
||||
<span
|
||||
class="input-group-text text-warning"
|
||||
title="Recommended direction for your printer is {labelProps.printDirection}"
|
||||
>
|
||||
<FaIcon icon="warning" />
|
||||
</span>
|
||||
{/if}
|
||||
</div>
|
||||
|
@ -27,6 +27,7 @@
|
||||
let labelType: LabelType = LabelType.WithGaps;
|
||||
let statusTimer: NodeJS.Timeout | undefined = undefined;
|
||||
let error: string = "";
|
||||
let taskVer = $printerClient?.getPrintTaskVersion();
|
||||
|
||||
const disconnected = derived(connectionState, ($connectionState) => $connectionState !== "connected");
|
||||
|
||||
@ -107,7 +108,7 @@
|
||||
onClosed();
|
||||
});
|
||||
|
||||
const taskVer = $printerClient?.getPrintTaskVersion();
|
||||
|
||||
|
||||
if (taskVer !== undefined) {
|
||||
console.log(`Detected print task version: ${ProtocolVersion[taskVer]}`);
|
||||
@ -179,13 +180,13 @@
|
||||
</div>
|
||||
|
||||
<div class="input-group flex-nowrap input-group-sm">
|
||||
<span class="input-group-text">Density</span>
|
||||
<input class="form-control" type="number" min="1" max="6" bind:value={density} />
|
||||
<span class="input-group-text">Copies</span>
|
||||
<input class="form-control" type="number" min="1" bind:value={quantity} />
|
||||
</div>
|
||||
|
||||
<div class="input-group flex-nowrap input-group-sm">
|
||||
<span class="input-group-text">Quantity</span>
|
||||
<input class="form-control" type="number" min="1" bind:value={quantity} />
|
||||
<span class="input-group-text">Density</span>
|
||||
<input class="form-control" type="number" min="1" max="6" bind:value={density} />
|
||||
</div>
|
||||
|
||||
<div class="input-group input-group-sm">
|
||||
@ -205,11 +206,11 @@
|
||||
<div class="input-group input-group-sm">
|
||||
<span class="input-group-text">Print task version</span>
|
||||
<select class="form-select" bind:value={printTaskVersion}>
|
||||
<option value={ProtocolVersion.V1} disabled>V1 - NOT IMPLEMENTED</option>
|
||||
<option value={ProtocolVersion.V2} disabled>V2 - NOT IMPLEMENTED</option>
|
||||
<option value={ProtocolVersion.V3}>V3 - D110</option>
|
||||
<option value={ProtocolVersion.V4}>V4 - B1</option>
|
||||
<option value={ProtocolVersion.V5} disabled>V5 - NOT IMPLEMENTED</option>
|
||||
<option value={ProtocolVersion.V1} disabled>{#if taskVer === ProtocolVersion.V1}✔{/if} V1 - NOT IMPLEMENTED</option>
|
||||
<option value={ProtocolVersion.V2} disabled>{#if taskVer === ProtocolVersion.V2}✔{/if} V2 - NOT IMPLEMENTED</option>
|
||||
<option value={ProtocolVersion.V3}>{#if taskVer === ProtocolVersion.V3}✔{/if} V3 - D110</option>
|
||||
<option value={ProtocolVersion.V4}>{#if taskVer === ProtocolVersion.V4}✔{/if} V4 - B1</option>
|
||||
<option value={ProtocolVersion.V5} disabled>{#if taskVer === ProtocolVersion.V5}✔{/if} V5 - NOT IMPLEMENTED</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
|
@ -41,6 +41,10 @@
|
||||
await $printerClient.abstraction.setSoundEnabled(SoundSettingsItemType.BluetoothConnectionSound, false);
|
||||
await $printerClient.abstraction.setSoundEnabled(SoundSettingsItemType.PowerSound, false);
|
||||
};
|
||||
|
||||
const fetchInfo = async () => {
|
||||
await $printerClient.fetchPrinterInfo()
|
||||
};
|
||||
</script>
|
||||
|
||||
<div class="input-group flex-nowrap justify-content-end">
|
||||
@ -79,6 +83,7 @@
|
||||
<button class="btn btn-sm btn-primary" on:click={stopHeartbeat}>Heartbeat off</button>
|
||||
<button class="btn btn-sm btn-primary" on:click={soundOn}>Sound on</button>
|
||||
<button class="btn btn-sm btn-primary" on:click={soundOff}>Sound off</button>
|
||||
<button class="btn btn-sm btn-primary" on:click={fetchInfo}>Fetch info again</button>
|
||||
</div>
|
||||
<span class="input-group-text">{$connectedPrinterName}</span>
|
||||
{:else}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -12,10 +12,11 @@
|
||||
"private": false,
|
||||
"scripts": {
|
||||
"clean-build": "yarn clean && yarn build",
|
||||
"build": "tsc",
|
||||
"test": "yarn build && node dist/test.js",
|
||||
"build": "tsc --build",
|
||||
"test": "yarn build && node utils/test.mjs",
|
||||
"parse-dump": "yarn build && node utils/parse-dump.mjs",
|
||||
"clean": "node clean-dist.mjs",
|
||||
"gen-printers-list": "node utils/gen-printers-list.js > src/printer_models.ts"
|
||||
"gen-printer-models": "node utils/gen-printer-models.js > src/printer_models.ts"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^20.14.2",
|
||||
|
@ -3,6 +3,7 @@ import {
|
||||
BatteryChargeLevel,
|
||||
ConnectResult,
|
||||
getPrintTaskVersion,
|
||||
LabelType,
|
||||
NiimbotPacket,
|
||||
ProtocolVersion,
|
||||
} from "../packets";
|
||||
@ -24,6 +25,7 @@ export interface PrinterInfo {
|
||||
mac?: string;
|
||||
charge?: BatteryChargeLevel;
|
||||
autoShutdownTime?: AutoShutdownTime;
|
||||
labelType?: LabelType;
|
||||
}
|
||||
|
||||
export abstract class NiimbotAbstractClient extends TypedEventTarget<ClientEventMap> {
|
||||
@ -83,6 +85,7 @@ export abstract class NiimbotAbstractClient extends TypedEventTarget<ClientEvent
|
||||
this.info.mac = await this.abstraction.getPrinterBluetoothMacAddress();
|
||||
this.info.charge = await this.abstraction.getBatteryChargeLevel();
|
||||
this.info.autoShutdownTime = await this.abstraction.getAutoShutDownTime();
|
||||
this.info.labelType = await this.abstraction.getLabelType();
|
||||
this.dispatchTypedEvent("printerinfofetched", new PrinterInfoFetchedEvent(this.info));
|
||||
return this.info;
|
||||
}
|
||||
|
@ -34,6 +34,7 @@ export enum ResponseCommandId {
|
||||
Invalid = -1,
|
||||
In_NotSupported = 0x00,
|
||||
In_Connect = 0xc2,
|
||||
In_AntiFake = 0x0c,
|
||||
In_HeartbeatAdvanced1 = 0xdd,
|
||||
In_HeartbeatBasic = 0xde,
|
||||
In_HeartbeatUnknown = 0xdf,
|
||||
|
@ -67,14 +67,13 @@ export enum PrinterModel {
|
||||
B11 = "B11",
|
||||
B50 = "B50",
|
||||
ET10 = "ET10",
|
||||
}
|
||||
};
|
||||
|
||||
export interface PrinterModelMeta {
|
||||
model: PrinterModel;
|
||||
id: [number, ...number[]];
|
||||
dpi: number;
|
||||
printDirection: PrintDirection;
|
||||
maxPrintWidth: number;
|
||||
printheadPixels: number;
|
||||
paperTypes: number[];
|
||||
}
|
||||
@ -85,7 +84,6 @@ export const modelsLibrary: PrinterModelMeta[] = [
|
||||
id: [272],
|
||||
dpi: 203,
|
||||
printDirection: "top",
|
||||
maxPrintWidth: 75,
|
||||
printheadPixels: 576,
|
||||
paperTypes: [LT.WithGaps, LT.Black, LT.Continuous, LT.Transparent],
|
||||
},
|
||||
@ -94,7 +92,6 @@ export const modelsLibrary: PrinterModelMeta[] = [
|
||||
id: [53250],
|
||||
dpi: 203,
|
||||
printDirection: "top",
|
||||
maxPrintWidth: 107,
|
||||
printheadPixels: 832,
|
||||
paperTypes: [LT.WithGaps, LT.Black],
|
||||
},
|
||||
@ -103,7 +100,6 @@ export const modelsLibrary: PrinterModelMeta[] = [
|
||||
id: [3586],
|
||||
dpi: 203,
|
||||
printDirection: "left",
|
||||
maxPrintWidth: 15,
|
||||
printheadPixels: 120,
|
||||
paperTypes: [LT.WithGaps, LT.HeatShrinkTube, LT.Transparent, LT.BlackMarkGap],
|
||||
},
|
||||
@ -112,7 +108,6 @@ export const modelsLibrary: PrinterModelMeta[] = [
|
||||
id: [4609],
|
||||
dpi: 300,
|
||||
printDirection: "top",
|
||||
maxPrintWidth: 50,
|
||||
printheadPixels: 591,
|
||||
paperTypes: [LT.WithGaps, LT.Black, LT.Transparent],
|
||||
},
|
||||
@ -121,7 +116,6 @@ export const modelsLibrary: PrinterModelMeta[] = [
|
||||
id: [5632],
|
||||
dpi: 203,
|
||||
printDirection: "top",
|
||||
maxPrintWidth: 77,
|
||||
printheadPixels: 600,
|
||||
paperTypes: [LT.WithGaps, LT.Black, LT.Transparent],
|
||||
},
|
||||
@ -130,7 +124,6 @@ export const modelsLibrary: PrinterModelMeta[] = [
|
||||
id: [785],
|
||||
dpi: 300,
|
||||
printDirection: "top",
|
||||
maxPrintWidth: 50,
|
||||
printheadPixels: 591,
|
||||
paperTypes: [LT.WithGaps, LT.Black, LT.Continuous, LT.Transparent],
|
||||
},
|
||||
@ -139,7 +132,6 @@ export const modelsLibrary: PrinterModelMeta[] = [
|
||||
id: [3585],
|
||||
dpi: 203,
|
||||
printDirection: "left",
|
||||
maxPrintWidth: 15,
|
||||
printheadPixels: 120,
|
||||
paperTypes: [LT.WithGaps, LT.Transparent, LT.BlackMarkGap, LT.HeatShrinkTube],
|
||||
},
|
||||
@ -148,7 +140,6 @@ export const modelsLibrary: PrinterModelMeta[] = [
|
||||
id: [528],
|
||||
dpi: 300,
|
||||
printDirection: "left",
|
||||
maxPrintWidth: 15,
|
||||
printheadPixels: 178,
|
||||
paperTypes: [LT.WithGaps, LT.Transparent],
|
||||
},
|
||||
@ -157,7 +148,6 @@ export const modelsLibrary: PrinterModelMeta[] = [
|
||||
id: [784],
|
||||
dpi: 300,
|
||||
printDirection: "top",
|
||||
maxPrintWidth: 50,
|
||||
printheadPixels: 567,
|
||||
paperTypes: [LT.WithGaps, LT.Transparent, LT.Continuous, LT.Black],
|
||||
},
|
||||
@ -166,7 +156,6 @@ export const modelsLibrary: PrinterModelMeta[] = [
|
||||
id: [2305],
|
||||
dpi: 203,
|
||||
printDirection: "left",
|
||||
maxPrintWidth: 15,
|
||||
printheadPixels: 120,
|
||||
paperTypes: [LT.WithGaps, LT.Transparent],
|
||||
},
|
||||
@ -175,7 +164,6 @@ export const modelsLibrary: PrinterModelMeta[] = [
|
||||
id: [2320],
|
||||
dpi: 203,
|
||||
printDirection: "left",
|
||||
maxPrintWidth: 15,
|
||||
printheadPixels: 120,
|
||||
paperTypes: [LT.WithGaps, LT.Transparent],
|
||||
},
|
||||
@ -184,7 +172,6 @@ export const modelsLibrary: PrinterModelMeta[] = [
|
||||
id: [4608],
|
||||
dpi: 300,
|
||||
printDirection: "top",
|
||||
maxPrintWidth: 50,
|
||||
printheadPixels: 591,
|
||||
paperTypes: [LT.WithGaps, LT.Transparent, LT.Black, LT.BlackMarkGap],
|
||||
},
|
||||
@ -193,7 +180,6 @@ export const modelsLibrary: PrinterModelMeta[] = [
|
||||
id: [2817],
|
||||
dpi: 203,
|
||||
printDirection: "top",
|
||||
maxPrintWidth: 50,
|
||||
printheadPixels: 400,
|
||||
paperTypes: [LT.WithGaps, LT.Black, LT.Transparent],
|
||||
},
|
||||
@ -202,7 +188,6 @@ export const modelsLibrary: PrinterModelMeta[] = [
|
||||
id: [4867],
|
||||
dpi: 203,
|
||||
printDirection: "top",
|
||||
maxPrintWidth: 82,
|
||||
printheadPixels: 656,
|
||||
paperTypes: [LT.WithGaps, LT.Black, LT.Transparent],
|
||||
},
|
||||
@ -211,7 +196,6 @@ export const modelsLibrary: PrinterModelMeta[] = [
|
||||
id: [2818],
|
||||
dpi: 203,
|
||||
printDirection: "top",
|
||||
maxPrintWidth: 50,
|
||||
printheadPixels: 400,
|
||||
paperTypes: [LT.WithGaps, LT.Black, LT.Transparent],
|
||||
},
|
||||
@ -220,7 +204,6 @@ export const modelsLibrary: PrinterModelMeta[] = [
|
||||
id: [4866],
|
||||
dpi: 203,
|
||||
printDirection: "top",
|
||||
maxPrintWidth: 82,
|
||||
printheadPixels: 656,
|
||||
paperTypes: [LT.WithGaps, LT.Black, LT.Transparent],
|
||||
},
|
||||
@ -229,7 +212,6 @@ export const modelsLibrary: PrinterModelMeta[] = [
|
||||
id: [4865],
|
||||
dpi: 203,
|
||||
printDirection: "top",
|
||||
maxPrintWidth: 82,
|
||||
printheadPixels: 656,
|
||||
paperTypes: [LT.WithGaps, LT.Black, LT.Transparent],
|
||||
},
|
||||
@ -238,7 +220,6 @@ export const modelsLibrary: PrinterModelMeta[] = [
|
||||
id: [4864],
|
||||
dpi: 203,
|
||||
printDirection: "top",
|
||||
maxPrintWidth: 82,
|
||||
printheadPixels: 656,
|
||||
paperTypes: [LT.WithGaps, LT.Black, LT.Transparent],
|
||||
},
|
||||
@ -247,7 +228,6 @@ export const modelsLibrary: PrinterModelMeta[] = [
|
||||
id: [2561],
|
||||
dpi: 203,
|
||||
printDirection: "left",
|
||||
maxPrintWidth: 25,
|
||||
printheadPixels: 192,
|
||||
paperTypes: [LT.WithGaps, LT.Transparent],
|
||||
},
|
||||
@ -256,7 +236,6 @@ export const modelsLibrary: PrinterModelMeta[] = [
|
||||
id: [2053],
|
||||
dpi: 300,
|
||||
printDirection: "top",
|
||||
maxPrintWidth: 75,
|
||||
printheadPixels: 851,
|
||||
paperTypes: [LT.WithGaps],
|
||||
},
|
||||
@ -265,7 +244,6 @@ export const modelsLibrary: PrinterModelMeta[] = [
|
||||
id: [777],
|
||||
dpi: 203,
|
||||
printDirection: "top",
|
||||
maxPrintWidth: 50,
|
||||
printheadPixels: 384,
|
||||
paperTypes: [LT.WithGaps, LT.Black, LT.Continuous, LT.Transparent],
|
||||
},
|
||||
@ -274,7 +252,6 @@ export const modelsLibrary: PrinterModelMeta[] = [
|
||||
id: [769],
|
||||
dpi: 203,
|
||||
printDirection: "top",
|
||||
maxPrintWidth: 50,
|
||||
printheadPixels: 384,
|
||||
paperTypes: [LT.WithGaps, LT.Black, LT.Transparent],
|
||||
},
|
||||
@ -283,7 +260,6 @@ export const modelsLibrary: PrinterModelMeta[] = [
|
||||
id: [514],
|
||||
dpi: 203,
|
||||
printDirection: "left",
|
||||
maxPrintWidth: 15,
|
||||
printheadPixels: 96,
|
||||
paperTypes: [LT.WithGaps, LT.Transparent],
|
||||
},
|
||||
@ -292,7 +268,6 @@ export const modelsLibrary: PrinterModelMeta[] = [
|
||||
id: [2054],
|
||||
dpi: 300,
|
||||
printDirection: "top",
|
||||
maxPrintWidth: 75,
|
||||
printheadPixels: 851,
|
||||
paperTypes: [LT.WithGaps, LT.Transparent, LT.Black],
|
||||
},
|
||||
@ -301,7 +276,6 @@ export const modelsLibrary: PrinterModelMeta[] = [
|
||||
id: [513],
|
||||
dpi: 203,
|
||||
printDirection: "left",
|
||||
maxPrintWidth: 15,
|
||||
printheadPixels: 96,
|
||||
paperTypes: [LT.WithGaps, LT.Transparent],
|
||||
},
|
||||
@ -310,7 +284,6 @@ export const modelsLibrary: PrinterModelMeta[] = [
|
||||
id: [1024],
|
||||
dpi: 300,
|
||||
printDirection: "left",
|
||||
maxPrintWidth: 80,
|
||||
printheadPixels: 697,
|
||||
paperTypes: [LT.PvcTag],
|
||||
},
|
||||
@ -319,7 +292,6 @@ export const modelsLibrary: PrinterModelMeta[] = [
|
||||
id: [1026],
|
||||
dpi: 300,
|
||||
printDirection: "left",
|
||||
maxPrintWidth: 87,
|
||||
printheadPixels: 662,
|
||||
paperTypes: [LT.PvcTag],
|
||||
},
|
||||
@ -328,7 +300,6 @@ export const modelsLibrary: PrinterModelMeta[] = [
|
||||
id: [261],
|
||||
dpi: 203,
|
||||
printDirection: "top",
|
||||
maxPrintWidth: 75,
|
||||
printheadPixels: 576,
|
||||
paperTypes: [LT.WithGaps, LT.Black, LT.Transparent],
|
||||
},
|
||||
@ -337,7 +308,6 @@ export const modelsLibrary: PrinterModelMeta[] = [
|
||||
id: [776],
|
||||
dpi: 203,
|
||||
printDirection: "top",
|
||||
maxPrintWidth: 50,
|
||||
printheadPixels: 384,
|
||||
paperTypes: [LT.WithGaps, LT.Black, LT.Transparent],
|
||||
},
|
||||
@ -346,7 +316,6 @@ export const modelsLibrary: PrinterModelMeta[] = [
|
||||
id: [1025],
|
||||
dpi: 300,
|
||||
printDirection: "left",
|
||||
maxPrintWidth: 87,
|
||||
printheadPixels: 662,
|
||||
paperTypes: [LT.PvcTag],
|
||||
},
|
||||
@ -355,7 +324,6 @@ export const modelsLibrary: PrinterModelMeta[] = [
|
||||
id: [4096],
|
||||
dpi: 203,
|
||||
printDirection: "top",
|
||||
maxPrintWidth: 50,
|
||||
printheadPixels: 384,
|
||||
paperTypes: [LT.WithGaps, LT.Black, LT.Transparent],
|
||||
},
|
||||
@ -364,7 +332,6 @@ export const modelsLibrary: PrinterModelMeta[] = [
|
||||
id: [256],
|
||||
dpi: 203,
|
||||
printDirection: "top",
|
||||
maxPrintWidth: 75,
|
||||
printheadPixels: 600,
|
||||
paperTypes: [LT.Black, LT.WithGaps, LT.Continuous],
|
||||
},
|
||||
@ -373,7 +340,6 @@ export const modelsLibrary: PrinterModelMeta[] = [
|
||||
id: [771, 775],
|
||||
dpi: 203,
|
||||
printDirection: "top",
|
||||
maxPrintWidth: 50,
|
||||
printheadPixels: 384,
|
||||
paperTypes: [LT.WithGaps, LT.Continuous, LT.Transparent, LT.Black],
|
||||
},
|
||||
@ -382,7 +348,6 @@ export const modelsLibrary: PrinterModelMeta[] = [
|
||||
id: [2051],
|
||||
dpi: 300,
|
||||
printDirection: "top",
|
||||
maxPrintWidth: 75,
|
||||
printheadPixels: 851,
|
||||
paperTypes: [LT.WithGaps, LT.Transparent],
|
||||
},
|
||||
@ -391,7 +356,6 @@ export const modelsLibrary: PrinterModelMeta[] = [
|
||||
id: [1792],
|
||||
dpi: 203,
|
||||
printDirection: "left",
|
||||
maxPrintWidth: 15,
|
||||
printheadPixels: 96,
|
||||
paperTypes: [LT.WithGaps, LT.Transparent],
|
||||
},
|
||||
@ -400,7 +364,6 @@ export const modelsLibrary: PrinterModelMeta[] = [
|
||||
id: [2050],
|
||||
dpi: 300,
|
||||
printDirection: "top",
|
||||
maxPrintWidth: 75,
|
||||
printheadPixels: 851,
|
||||
paperTypes: [LT.WithGaps],
|
||||
},
|
||||
@ -409,7 +372,6 @@ export const modelsLibrary: PrinterModelMeta[] = [
|
||||
id: [2049],
|
||||
dpi: 300,
|
||||
printDirection: "top",
|
||||
maxPrintWidth: 75,
|
||||
printheadPixels: 851,
|
||||
paperTypes: [LT.WithGaps, LT.Transparent],
|
||||
},
|
||||
@ -418,7 +380,6 @@ export const modelsLibrary: PrinterModelMeta[] = [
|
||||
id: [51460],
|
||||
dpi: 203,
|
||||
printDirection: "top",
|
||||
maxPrintWidth: 50,
|
||||
printheadPixels: 384,
|
||||
paperTypes: [LT.WithGaps, LT.Black, LT.Continuous, LT.Perforated],
|
||||
},
|
||||
@ -427,7 +388,6 @@ export const modelsLibrary: PrinterModelMeta[] = [
|
||||
id: [51461],
|
||||
dpi: 203,
|
||||
printDirection: "top",
|
||||
maxPrintWidth: 50,
|
||||
printheadPixels: 384,
|
||||
paperTypes: [LT.WithGaps, LT.Black, LT.Continuous, LT.Perforated],
|
||||
},
|
||||
@ -436,7 +396,6 @@ export const modelsLibrary: PrinterModelMeta[] = [
|
||||
id: [256],
|
||||
dpi: 203,
|
||||
printDirection: "top",
|
||||
maxPrintWidth: 75,
|
||||
printheadPixels: 576,
|
||||
paperTypes: [LT.WithGaps, LT.Black, LT.Continuous, LT.Transparent],
|
||||
},
|
||||
@ -445,7 +404,6 @@ export const modelsLibrary: PrinterModelMeta[] = [
|
||||
id: [2816],
|
||||
dpi: 203,
|
||||
printDirection: "top",
|
||||
maxPrintWidth: 50,
|
||||
printheadPixels: 400,
|
||||
paperTypes: [LT.WithGaps, LT.Black, LT.Transparent],
|
||||
},
|
||||
@ -454,7 +412,6 @@ export const modelsLibrary: PrinterModelMeta[] = [
|
||||
id: [51458],
|
||||
dpi: 203,
|
||||
printDirection: "top",
|
||||
maxPrintWidth: 50,
|
||||
printheadPixels: 384,
|
||||
paperTypes: [LT.WithGaps, LT.Black, LT.Continuous, LT.Perforated],
|
||||
},
|
||||
@ -463,7 +420,6 @@ export const modelsLibrary: PrinterModelMeta[] = [
|
||||
id: [2304, 2305],
|
||||
dpi: 203,
|
||||
printDirection: "left",
|
||||
maxPrintWidth: 15,
|
||||
printheadPixels: 96,
|
||||
paperTypes: [LT.WithGaps, LT.Transparent],
|
||||
},
|
||||
@ -472,7 +428,6 @@ export const modelsLibrary: PrinterModelMeta[] = [
|
||||
id: [768],
|
||||
dpi: 203,
|
||||
printDirection: "top",
|
||||
maxPrintWidth: 50,
|
||||
printheadPixels: 384,
|
||||
paperTypes: [LT.WithGaps, LT.Black, LT.Continuous, LT.Transparent],
|
||||
},
|
||||
@ -481,7 +436,6 @@ export const modelsLibrary: PrinterModelMeta[] = [
|
||||
id: [2560],
|
||||
dpi: 203,
|
||||
printDirection: "left",
|
||||
maxPrintWidth: 25,
|
||||
printheadPixels: 192,
|
||||
paperTypes: [LT.WithGaps, LT.Transparent],
|
||||
},
|
||||
@ -490,7 +444,6 @@ export const modelsLibrary: PrinterModelMeta[] = [
|
||||
id: [512],
|
||||
dpi: 203,
|
||||
printDirection: "left",
|
||||
maxPrintWidth: 14,
|
||||
printheadPixels: 120,
|
||||
paperTypes: [LT.WithGaps, LT.Transparent],
|
||||
},
|
||||
@ -499,7 +452,6 @@ export const modelsLibrary: PrinterModelMeta[] = [
|
||||
id: [273],
|
||||
dpi: 203,
|
||||
printDirection: "top",
|
||||
maxPrintWidth: 75,
|
||||
printheadPixels: 616,
|
||||
paperTypes: [LT.WithGaps, LT.Black, LT.Transparent],
|
||||
},
|
||||
@ -508,7 +460,6 @@ export const modelsLibrary: PrinterModelMeta[] = [
|
||||
id: [274],
|
||||
dpi: 203,
|
||||
printDirection: "top",
|
||||
maxPrintWidth: 75,
|
||||
printheadPixels: 600,
|
||||
paperTypes: [LT.WithGaps, LT.Transparent],
|
||||
},
|
||||
@ -517,7 +468,6 @@ export const modelsLibrary: PrinterModelMeta[] = [
|
||||
id: [51715],
|
||||
dpi: 203,
|
||||
printDirection: "top",
|
||||
maxPrintWidth: 50,
|
||||
printheadPixels: 384,
|
||||
paperTypes: [LT.WithGaps, LT.Black, LT.Continuous, LT.Perforated],
|
||||
},
|
||||
@ -526,7 +476,6 @@ export const modelsLibrary: PrinterModelMeta[] = [
|
||||
id: [51714],
|
||||
dpi: 203,
|
||||
printDirection: "top",
|
||||
maxPrintWidth: 50,
|
||||
printheadPixels: 384,
|
||||
paperTypes: [LT.WithGaps, LT.Black, LT.Continuous, LT.Perforated],
|
||||
},
|
||||
@ -535,7 +484,6 @@ export const modelsLibrary: PrinterModelMeta[] = [
|
||||
id: [51717],
|
||||
dpi: 203,
|
||||
printDirection: "top",
|
||||
maxPrintWidth: 50,
|
||||
printheadPixels: 384,
|
||||
paperTypes: [LT.WithGaps, LT.Black, LT.Continuous, LT.Perforated],
|
||||
},
|
||||
@ -544,7 +492,6 @@ export const modelsLibrary: PrinterModelMeta[] = [
|
||||
id: [51718],
|
||||
dpi: 300,
|
||||
printDirection: "top",
|
||||
maxPrintWidth: 50,
|
||||
printheadPixels: 567,
|
||||
paperTypes: [LT.WithGaps, LT.Black, LT.Continuous, LT.Perforated],
|
||||
},
|
||||
@ -553,7 +500,6 @@ export const modelsLibrary: PrinterModelMeta[] = [
|
||||
id: [256, 260, 262],
|
||||
dpi: 203,
|
||||
printDirection: "top",
|
||||
maxPrintWidth: 75,
|
||||
printheadPixels: 576,
|
||||
paperTypes: [LT.WithGaps, LT.Black, LT.Continuous, LT.Transparent],
|
||||
},
|
||||
@ -562,7 +508,6 @@ export const modelsLibrary: PrinterModelMeta[] = [
|
||||
id: [52993],
|
||||
dpi: 203,
|
||||
printDirection: "top",
|
||||
maxPrintWidth: 75,
|
||||
printheadPixels: 600,
|
||||
paperTypes: [LT.WithGaps, LT.Black, LT.Continuous, LT.Transparent],
|
||||
},
|
||||
@ -571,7 +516,6 @@ export const modelsLibrary: PrinterModelMeta[] = [
|
||||
id: [3584],
|
||||
dpi: 203,
|
||||
printDirection: "left",
|
||||
maxPrintWidth: 15,
|
||||
printheadPixels: 120,
|
||||
paperTypes: [LT.WithGaps, LT.Transparent, LT.BlackMarkGap, LT.HeatShrinkTube],
|
||||
},
|
||||
@ -580,7 +524,6 @@ export const modelsLibrary: PrinterModelMeta[] = [
|
||||
id: [512],
|
||||
dpi: 203,
|
||||
printDirection: "left",
|
||||
maxPrintWidth: 15,
|
||||
printheadPixels: 96,
|
||||
paperTypes: [LT.WithGaps, LT.Transparent],
|
||||
},
|
||||
@ -589,7 +532,6 @@ export const modelsLibrary: PrinterModelMeta[] = [
|
||||
id: [51457],
|
||||
dpi: 203,
|
||||
printDirection: "top",
|
||||
maxPrintWidth: 50,
|
||||
printheadPixels: 384,
|
||||
paperTypes: [LT.WithGaps, LT.Black, LT.Continuous, LT.Perforated, LT.Transparent],
|
||||
},
|
||||
@ -598,7 +540,6 @@ export const modelsLibrary: PrinterModelMeta[] = [
|
||||
id: [51713],
|
||||
dpi: 203,
|
||||
printDirection: "top",
|
||||
maxPrintWidth: 50,
|
||||
printheadPixels: 400,
|
||||
paperTypes: [LT.WithGaps, LT.Black, LT.Continuous, LT.Perforated],
|
||||
},
|
||||
@ -607,7 +548,6 @@ export const modelsLibrary: PrinterModelMeta[] = [
|
||||
id: [5376],
|
||||
dpi: 203,
|
||||
printDirection: "top",
|
||||
maxPrintWidth: 200,
|
||||
printheadPixels: 1600,
|
||||
paperTypes: [LT.Continuous],
|
||||
},
|
||||
|
@ -1,31 +0,0 @@
|
||||
// import { NiimbotPacket, Utils } from ".";
|
||||
|
||||
// const data = Uint8Array.of(0xF0, 0x10);
|
||||
// const result = ImageEncoder.indexPixels(data);
|
||||
|
||||
// console.log(Utils.bufToHex(result));
|
||||
// // 00 00 00 0E
|
||||
|
||||
|
||||
// const canvas = createCanvas(16, 8);
|
||||
// const ctx = canvas.getContext("2d");
|
||||
// ctx.fillStyle = "white";
|
||||
// ctx.fillRect(0, 0, canvas.width, canvas.height);
|
||||
|
||||
// ctx.fillStyle = "black";
|
||||
// ctx.fillRect(0, 0, 1, 1);
|
||||
// ctx.fillRect(canvas.width-1, 0, 1, 1);
|
||||
// ctx.fillRect(1, 1, 3, 1);
|
||||
// ctx.fillRect(1, 3, 1, 1);
|
||||
|
||||
// const data = ImageEncoder.encodeCanvas(canvas, "top");
|
||||
// data.rowsData.forEach(e => console.log(e))
|
||||
// console.log("")
|
||||
// ImageEncoder.encodeCanvasV2(canvas, "top");
|
||||
|
||||
|
||||
// 55 55 d3 03 00 9f 01 4e aa aa 55 55 e4 01 01 e4 aa aa 55 55 e4 01 01 e4 aa aa
|
||||
// const data = Uint8Array.from([0x55, 0x55, 0xd3, 0x03, 0x00, 0x9f, 0x01, 0x4e, 0xaa, 0xaa, 0x55, 0x55, 0xe4, 0x01, 0x01, 0xe4, 0xaa, 0xaa, 0x55, 0x55, 0xe4, 0x01, 0x01, 0xe4, 0xaa, 0xaa]);
|
||||
// console.log(Utils.bufToHex(data));
|
||||
|
||||
// NiimbotPacket.fromBytesMultiPacket(data);
|
@ -9,6 +9,20 @@ export class Utils {
|
||||
return arr.map((n) => Utils.numberToHex(n)).join(separator);
|
||||
}
|
||||
|
||||
public static hexToBuf(str: string): Uint8Array {
|
||||
const match = str.match(/[\da-f]{2}/gi);
|
||||
|
||||
if (!match) {
|
||||
return new Uint8Array();
|
||||
}
|
||||
|
||||
return new Uint8Array(
|
||||
match.map((h) => {
|
||||
return parseInt(h, 16);
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
public static dataViewToNumberArray(dw: DataView): number[] {
|
||||
const a: number[] = [];
|
||||
for (let i = 0; i < dw.byteLength; i++) {
|
||||
|
Reference in New Issue
Block a user