Skip to content

Commit

Permalink
Feature/fan speed adjustment print (#1051)
Browse files Browse the repository at this point in the history
* add custom action for LED Strip

* allow fanspeed adjustment during print
  • Loading branch information
UnchartedBull authored Oct 6, 2020
1 parent e9d13e7 commit 51a32ee
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 17 deletions.
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

0 comments on commit 51a32ee

Please sign in to comment.