Skip to content

Commit 150bc4d

Browse files
authored
Merge pull request #48 from andycb/v1_2Qa
Fix some issues that came up during the QA pass.
2 parents 37cb1a6 + 629f97d commit 150bc4d

File tree

9 files changed

+26
-17
lines changed

9 files changed

+26
-17
lines changed

src/electronApp/angularApp/components/about/about.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
<br>
1111
<br>
12-
<span>Copyright (c) 2020 Andy Bradford</span>
12+
<span>Copyright (c) 2020-2021 Andy Bradford</span>
1313

1414
<br>
1515
<br>

src/electronApp/angularApp/components/print/print.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export class PrintComponent implements OnInit {
7777
this.ErrorMessage = null;
7878

7979
ErrorLogger.Trace("PrintComponent::uploadFile - Storing file");
80-
await this.printerService.StoreFileAsync(path)
80+
await this.printerService.StoreFileAsync(path).Promise;
8181

8282
ErrorLogger.Trace("PrintComponent::uploadFile - Printing file");
8383
await this.printerService.PrintFileAsync(event[0].name);

src/electronApp/angularApp/components/status/status.component.css

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717

1818
.button-row {
1919
display: flex;
20-
align-items: center;
21-
justify-content: space-around;
20+
align-items: left;
21+
}
22+
23+
.button-row button {
24+
margin-right: 5px;
25+
width: 36px;
2226
}

src/electronApp/angularApp/components/status/status.component.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,23 +63,23 @@
6363

6464
<tr>
6565
<th>Control</th>
66-
<td>
66+
<td class="controlButtons">
6767
<div class="button-row">
6868
<div *ngIf="PrintStateLoaded">
6969
<div *ngIf="PrintPaused; then printPausedBlock else printRunningBlock"></div>
7070
<ng-template #printPausedBlock>
71-
<button disabled={{!IsPrinting}} mat-flat-button (click)="ResumePrinting()">
71+
<button disabled={{!IsPrinting}} (click)="ResumePrinting()">
7272
<mat-icon aria-label="Resume Print">play_arrow</mat-icon>
7373
</button>
7474
</ng-template>
7575

7676
<ng-template #printRunningBlock>
77-
<button disabled={{!IsPrinting}} mat-flat-button (click)="PausePrinting()">
77+
<button disabled={{!IsPrinting}} mat-stroked-button (click)="PausePrinting()">
7878
<mat-icon aria-label="Pause Print">pause</mat-icon>
7979
</button>
8080
</ng-template>
8181
</div>
82-
<button disabled={{!IsPrinting}} mat-flat-button (click)="OpenStopPrintingDialog()">
82+
<button disabled={{!IsPrinting}} mat-stroked-button (click)="OpenStopPrintingDialog()">
8383
<mat-icon aria-label="Stop Print">stop</mat-icon>
8484
</button>
8585
</div>

src/electronApp/angularApp/components/status/status.component.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,9 @@ export class StatusComponent implements OnInit {
173173
/**
174174
* Pauses the printing.
175175
*/
176-
public PausePrinting(): void {
176+
public async PausePrinting(): Promise<void> {
177177
try {
178-
this.printerService.PausePrintingAsync();
178+
await this.printerService.PausePrintingAsync();
179179
} catch (error) {
180180
ErrorLogger.NonFatalError(error);
181181
}
@@ -184,9 +184,9 @@ export class StatusComponent implements OnInit {
184184
/**
185185
* Resumes the printing.
186186
*/
187-
public ResumePrinting(): void {
187+
public async ResumePrinting(): Promise<void> {
188188
try {
189-
this.printerService.ResumePrintingAsync();
189+
await this.printerService.ResumePrintingAsync();
190190
} catch (error) {
191191
ErrorLogger.NonFatalError(error);
192192
}

src/electronApp/angularApp/components/stop-printing-confirmation-dialog/stop-printing-confirmation-dialog.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ <h1 mat-dialog-title>Stop Printing</h1>
44
<div mat-dialog-content>Are you sure you want to stop printing?</div>
55

66
<mat-dialog-actions align="end">
7-
<button (click)="Cancel()" mat-button mat-dialog-close>Cancel</button>
8-
<button (click)="StopPrintingAsync()" mat-button cdkFocusInitial>Stop Printing</button>
7+
<button (click)="StopPrintingAsync()" mat-button>Stop Printing</button>
8+
<button (click)="Cancel()" mat-button mat-dialog-close cdkFocusInitial>Cancel</button>
99
</mat-dialog-actions>
1010
</div>

src/electronApp/angularApp/components/stop-printing-confirmation-dialog/stop-printing-confirmation-dialog.component.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,11 @@ export class StopPrintingConfirmationDialogComponent implements OnInit {
3232
*/
3333
public async StopPrintingAsync(): Promise<any> {
3434
try {
35-
this.printerService.StopPrintingAsync();
35+
await this.printerService.StopPrintingAsync();
3636
} catch (error) {
3737
ErrorLogger.NonFatalError(error);
3838
}
39+
3940
this.dialog.close();
4041
}
4142

src/electronApp/printerSdk/printer.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { PrinterCamera } from './printerCamera'
77
import { PrinterStatus, FirmwareVersionResponse, TemperatureResponse, IPrinterResponse, PrinterDebugMonitor } from './entities';
88
import { MachineCommands } from './machineCommands';
99
import { PromiseWithProgress } from '../core/PromiseWithProgress'
10+
import { ErrorLogger } from 'electronApp/core';
1011

1112
/**
1213
* Represents the printer.
@@ -258,6 +259,7 @@ export class Printer {
258259
});
259260

260261
// Start a transfer
262+
ErrorLogger.Trace("Starting file transfer");
261263
let message = '~' + MachineCommands.BeginWriteToSdCard + ' ' + modelBytes.length + ' 0:/user/' + fileName;
262264
this.SendToPrinter(message);
263265
await this.WaitForPrinterAck(MachineCommands.BeginWriteToSdCard);
@@ -295,7 +297,6 @@ export class Printer {
295297
dataSize = actualLength;
296298
}
297299

298-
299300
// Always start each packet with four bytes
300301
const bufferToSend = Buffer.alloc(this.packetSizeBytes + 16);
301302
bufferToSend.writeUInt16LE(0x5a, 0);
@@ -327,6 +328,7 @@ export class Printer {
327328
this.SendToPrinter('');
328329

329330
// Tell the printer that we have finished the file transfer
331+
ErrorLogger.Trace("Ending file transfer");
330332
message = '~' + MachineCommands.EndWriteToSdCard;
331333

332334
this.SendToPrinter(message);

src/electronApp/printerSdk/printerResponseReader.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,11 @@ export class PrinterResponseReader
187187
case MachineCommands.BeginWriteToSdCard:
188188
case MachineCommands.EndWriteToSdCard:
189189
case MachineCommands.PrintFileFromSd:
190+
case MachineCommands.StopPrinting:
191+
case MachineCommands.PausePrinting:
190192
return null;
191193
default:
192-
throw new Error();
194+
throw new Error("Unknown command cannot be mapped to a return value");
193195
}
194196
}
195197
}

0 commit comments

Comments
 (0)