Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/fan speed adjustment print #1051

Merged
merged 3 commits into from
Oct 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/app/print-control/print-control.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -117,51 +117,51 @@
<div class="print-control__adjust__controller">
<div
class="print-control__adjust__controller-increase"
(click)="changeFeedrate(1)"
(click)="changeFanSpeed(1)"
matRipple
[matRippleUnbounded]="false"
>
+
</div>
<div class="print-control__adjust__controller-value">
{{ feedrate }}
{{ fanSpeed }}
<span class="print-control__adjust__controller-value-unit">%</span>
</div>
<div
class="print-control__adjust__controller-decrease"
(click)="changeFeedrate(-1)"
(click)="changeFanSpeed(-1)"
matRipple
[matRippleUnbounded]="false"
>
-
</div>
</div>
<span class="print-control__adjust__name">Feedrate</span>
<span class="print-control__adjust__name">Fan Speed</span>
</td>
<td class="print-control__adjust__change-parameter">
<div class="print-control__adjust__controller">
<div
class="print-control__adjust__controller-increase"
(click)="changeFlowrate(1)"
(click)="changeFeedrate(1)"
matRipple
[matRippleUnbounded]="false"
>
+
</div>
<div class="print-control__adjust__controller-value">
{{ flowrate }}
{{ feedrate }}
<span class="print-control__adjust__controller-value-unit">%</span>
</div>
<div
class="print-control__adjust__controller-decrease"
(click)="changeFlowrate(-1)"
(click)="changeFeedrate(-1)"
matRipple
[matRippleUnbounded]="false"
>
-
</div>
</div>
<span class="print-control__adjust__name">Flowrate</span>
<span class="print-control__adjust__name">Feedrate</span>
</td>
</tr>
</table>
Expand Down
27 changes: 18 additions & 9 deletions src/app/print-control/print-control.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { take } from 'rxjs/operators';
import { ConfigService } from '../config/config.service';

import { Job, JobService, JobStatus } from '../job.service';
import { DisplayLayerProgressAPI, LayerProgressService } from '../plugin-service/layer-progress.service';
import { PrinterService, PrinterStatusAPI } from '../printer.service';

@Component({
Expand All @@ -21,18 +22,19 @@ export class PrintControlComponent implements OnInit, OnDestroy {

public temperatureHotend: number;
public temperatureHeatbed: number;
public fanSpeed: number;
public feedrate: number;
public flowrate: number;
public zOffset: number;

public constructor(
private jobService: JobService,
private printerService: PrinterService,
private displayLayerProgressService: LayerProgressService,
private configService: ConfigService,
) {
this.temperatureHotend = 0;
this.temperatureHeatbed = 0;
this.flowrate = 100;
this.fanSpeed = 0;
this.feedrate = 100;
this.zOffset = 0;
}
Expand Down Expand Up @@ -152,6 +154,13 @@ export class PrintControlComponent implements OnInit, OnDestroy {
this.temperatureHotend = printerStatus.nozzle.set;
this.temperatureHeatbed = printerStatus.heatbed.set;
});

this.displayLayerProgressService
.getObservable()
.pipe(take(1))
.subscribe((layerProgress: DisplayLayerProgressAPI): void => {
this.fanSpeed = Number(layerProgress.fanSpeed);
});
}

public changeTemperatureHotend(value: number): void {
Expand Down Expand Up @@ -190,14 +199,14 @@ export class PrintControlComponent implements OnInit, OnDestroy {
}
}

public changeFlowrate(value: number): void {
public changeFanSpeed(value: number): void {
if (this.showControls) {
this.flowrate += value;
if (this.flowrate < 75) {
this.flowrate = 75;
this.fanSpeed += value;
if (this.fanSpeed < 0) {
this.fanSpeed = 0;
}
if (this.flowrate > 125) {
this.flowrate = 125;
if (this.fanSpeed > 100) {
this.fanSpeed = 100;
}
}
}
Expand All @@ -207,7 +216,7 @@ export class PrintControlComponent implements OnInit, OnDestroy {
this.printerService.setTemperatureHotend(this.temperatureHotend);
this.printerService.setTemperatureHeatbed(this.temperatureHeatbed);
this.printerService.setFeedrate(this.feedrate);
this.printerService.setFlowrate(this.flowrate);
this.printerService.setFanSpeed(this.fanSpeed);
this.hideControlOverlay(event);
}
}
Expand Down