Working tree changes 2024-08-22 01:00
All checks were successful
Test project build / Build (push) Successful in 1m14s
All checks were successful
Test project build / Build (push) Successful in 1m14s
This commit is contained in:
parent
14de9bccdb
commit
75e22d2f2c
@ -146,7 +146,7 @@ export class NiimbotBluetoothClient extends NiimbotAbstractClient {
|
||||
if (this.channel === undefined) {
|
||||
throw new Error("Channel is closed");
|
||||
}
|
||||
await Utils.sleep(10); // https://github.com/MultiMote/niimblue/issues/5
|
||||
await Utils.sleep(this.packetIntervalMs); // https://github.com/MultiMote/niimblue/issues/5
|
||||
await this.channel.writeValueWithoutResponse(data);
|
||||
this.dispatchTypedEvent("rawpacketsent", new RawPacketSentEvent(data));
|
||||
};
|
||||
|
@ -32,6 +32,7 @@ export abstract class NiimbotAbstractClient extends TypedEventTarget<ClientEvent
|
||||
public readonly abstraction: Abstraction;
|
||||
protected info: PrinterInfo = {};
|
||||
private heartbeatTimer?: NodeJS.Timeout;
|
||||
protected packetIntervalMs: number = 10;
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
@ -135,6 +136,10 @@ export abstract class NiimbotAbstractClient extends TypedEventTarget<ClientEvent
|
||||
|
||||
return getPrintTaskVersion(meta.model);
|
||||
}
|
||||
|
||||
public setPacketInterval(milliseconds: number) {
|
||||
this.packetIntervalMs = milliseconds;
|
||||
}
|
||||
}
|
||||
|
||||
export * from "./events";
|
||||
|
@ -170,7 +170,7 @@ export class NiimbotSerialClient extends NiimbotAbstractClient {
|
||||
if (this.writer === undefined) {
|
||||
throw new Error("Port is not writable");
|
||||
}
|
||||
await Utils.sleep(10); // https://github.com/MultiMote/niimblue/issues/5
|
||||
await Utils.sleep(this.packetIntervalMs); // https://github.com/MultiMote/niimblue/issues/5
|
||||
await this.writer.write(data);
|
||||
this.dispatchTypedEvent("rawpacketsent", new RawPacketSentEvent(data));
|
||||
};
|
||||
|
Reference in New Issue
Block a user