Working tree changes 2024-08-09 01:00
All checks were successful
Test project build / Build (push) Successful in 1m15s
All checks were successful
Test project build / Build (push) Successful in 1m15s
This commit is contained in:
parent
356e0a9c56
commit
4a4bc2184e
@ -45,6 +45,10 @@
|
|||||||
const fetchInfo = async () => {
|
const fetchInfo = async () => {
|
||||||
await $printerClient.fetchPrinterInfo()
|
await $printerClient.fetchPrinterInfo()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const reset = async () => {
|
||||||
|
await $printerClient.abstraction.printerReset()
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="input-group flex-nowrap justify-content-end">
|
<div class="input-group flex-nowrap justify-content-end">
|
||||||
@ -84,6 +88,7 @@
|
|||||||
<button class="btn btn-sm btn-primary" on:click={soundOn}>Sound on</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={soundOff}>Sound off</button>
|
||||||
<button class="btn btn-sm btn-primary" on:click={fetchInfo}>Fetch info again</button>
|
<button class="btn btn-sm btn-primary" on:click={fetchInfo}>Fetch info again</button>
|
||||||
|
<button class="btn btn-sm btn-primary" on:click={reset}>Reset</button>
|
||||||
</div>
|
</div>
|
||||||
<span class="input-group-text">{$printerMeta?.model ?? $connectedPrinterName}</span>
|
<span class="input-group-text">{$printerMeta?.model ?? $connectedPrinterName}</span>
|
||||||
{:else}
|
{:else}
|
||||||
|
@ -8,9 +8,6 @@ import {
|
|||||||
PacketReceivedEvent,
|
PacketReceivedEvent,
|
||||||
PacketSentEvent,
|
PacketSentEvent,
|
||||||
PrinterInfoFetchedEvent,
|
PrinterInfoFetchedEvent,
|
||||||
// PacketParsedEvent,
|
|
||||||
RawPacketReceivedEvent,
|
|
||||||
RawPacketSentEvent,
|
|
||||||
RequestCommandId,
|
RequestCommandId,
|
||||||
ResponseCommandId,
|
ResponseCommandId,
|
||||||
Utils,
|
Utils,
|
||||||
|
@ -281,6 +281,11 @@ export class Abstraction {
|
|||||||
await this.send(PacketGenerator.setSoundSettings(soundType, value));
|
await this.send(PacketGenerator.setSoundSettings(soundType, value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Clear settings */
|
||||||
|
public async printerReset(): Promise<void> {
|
||||||
|
await this.send(PacketGenerator.printerReset());
|
||||||
|
}
|
||||||
|
|
||||||
public async print(
|
public async print(
|
||||||
protoVersion: ProtocolVersion,
|
protoVersion: ProtocolVersion,
|
||||||
image: EncodedImage,
|
image: EncodedImage,
|
||||||
|
@ -15,6 +15,7 @@ export enum RequestCommandId {
|
|||||||
PrinterInfo = 0x40, // See PrinterInfoType
|
PrinterInfo = 0x40, // See PrinterInfoType
|
||||||
PrinterConfig = 0xaf,
|
PrinterConfig = 0xaf,
|
||||||
PrinterStatusData = 0xa5,
|
PrinterStatusData = 0xa5,
|
||||||
|
PrinterReset = 0x28,
|
||||||
PrintQuantity = 0x15,
|
PrintQuantity = 0x15,
|
||||||
PrintStart = 0x01,
|
PrintStart = 0x01,
|
||||||
PrintStatus = 0xa3,
|
PrintStatus = 0xa3,
|
||||||
@ -58,6 +59,7 @@ export enum ResponseCommandId {
|
|||||||
In_PrinterInfoSoftWareVersion = 0x49,
|
In_PrinterInfoSoftWareVersion = 0x49,
|
||||||
In_PrinterInfoArea = 0x4f,
|
In_PrinterInfoArea = 0x4f,
|
||||||
In_PrinterStatusData = 0xb5,
|
In_PrinterStatusData = 0xb5,
|
||||||
|
In_PrinterReset = 0x38,
|
||||||
In_PrintStatus = 0xb3,
|
In_PrintStatus = 0xb3,
|
||||||
In_PrintError = 0xdb, // For example, sent on SetPageSize when page print is not started
|
In_PrintError = 0xdb, // For example, sent on SetPageSize when page print is not started
|
||||||
In_PrintQuantity = 0x16,
|
In_PrintQuantity = 0x16,
|
||||||
|
@ -153,6 +153,11 @@ export class PacketGenerator {
|
|||||||
ResponseCommandId.In_PrintError
|
ResponseCommandId.In_PrintError
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
public static printerReset(): NiimbotPacket {
|
||||||
|
return new NiimbotPacket(RequestCommandId.PrinterReset, [1], [
|
||||||
|
ResponseCommandId.In_PrinterReset,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* B1 behavior: after {@link pageEnd} paper stops at printhead position, on {@link printEnd} paper moved further.
|
* B1 behavior: after {@link pageEnd} paper stops at printhead position, on {@link printEnd} paper moved further.
|
||||||
|
Reference in New Issue
Block a user