Skip to content

Commit

Permalink
Update DeviceConnection.java
Browse files Browse the repository at this point in the history
- waitingTime calculation bug fixed (data length was always zero - that caused problems with image printing)
- removed unnecessary floating-point arithmetic in waitingTime calculation
  • Loading branch information
lumber1000 authored Mar 15, 2021
1 parent d21867a commit 4b48c8b
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ public void send(int addWaitingTime) throws EscPosConnectionException {
try {
this.stream.write(this.data);
this.stream.flush();
this.data = new byte[0];

int waitingTime = addWaitingTime + (int) Math.floor(this.data.length / 16f);
int waitingTime = addWaitingTime + this.data.length / 16;
this.data = new byte[0];
if(waitingTime > 0) {
Thread.sleep(waitingTime);
}
Expand Down

0 comments on commit 4b48c8b

Please sign in to comment.