Working tree changes 2024-08-09 01:00
All checks were successful
Test project build / Build (push) Successful in 1m15s

This commit is contained in:
Bot 2024-08-09 01:00:01 +03:00 committed by multimote
parent 356e0a9c56
commit 4a4bc2184e
5 changed files with 17 additions and 3 deletions

View File

@ -45,6 +45,10 @@
const fetchInfo = async () => {
await $printerClient.fetchPrinterInfo()
};
const reset = async () => {
await $printerClient.abstraction.printerReset()
};
</script>
<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={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={reset}>Reset</button>
</div>
<span class="input-group-text">{$printerMeta?.model ?? $connectedPrinterName}</span>
{:else}

View File

@ -8,9 +8,6 @@ import {
PacketReceivedEvent,
PacketSentEvent,
PrinterInfoFetchedEvent,
// PacketParsedEvent,
RawPacketReceivedEvent,
RawPacketSentEvent,
RequestCommandId,
ResponseCommandId,
Utils,

View File

@ -281,6 +281,11 @@ export class Abstraction {
await this.send(PacketGenerator.setSoundSettings(soundType, value));
}
/** Clear settings */
public async printerReset(): Promise<void> {
await this.send(PacketGenerator.printerReset());
}
public async print(
protoVersion: ProtocolVersion,
image: EncodedImage,

View File

@ -15,6 +15,7 @@ export enum RequestCommandId {
PrinterInfo = 0x40, // See PrinterInfoType
PrinterConfig = 0xaf,
PrinterStatusData = 0xa5,
PrinterReset = 0x28,
PrintQuantity = 0x15,
PrintStart = 0x01,
PrintStatus = 0xa3,
@ -58,6 +59,7 @@ export enum ResponseCommandId {
In_PrinterInfoSoftWareVersion = 0x49,
In_PrinterInfoArea = 0x4f,
In_PrinterStatusData = 0xb5,
In_PrinterReset = 0x38,
In_PrintStatus = 0xb3,
In_PrintError = 0xdb, // For example, sent on SetPageSize when page print is not started
In_PrintQuantity = 0x16,

View File

@ -153,6 +153,11 @@ export class PacketGenerator {
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.