Skip to content

Commit

Permalink
preheat plugin integration. closes #151
Browse files Browse the repository at this point in the history
  • Loading branch information
UnchartedBull committed Oct 8, 2019
1 parent fe06af5 commit 871a48d
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 3 deletions.
1 change: 1 addition & 0 deletions scripts/install-no-autostart.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ dependencies="libgtk-3-0 libnotify4 libnss3 libxss1 libxtst6 xdg-utils libatspi2

echo "Installing OctoPrint Plugins"
~/OctoPrint/venv/bin/pip install -q "https://github.com/OllisGit/OctoPrint-DisplayLayerProgress/releases/latest/download/master.zip"
~/OctoPrint/venv/bin/pip install -q "https://github.com/marian42/octoprint-preheat/archive/master.zip"
if [[ $* == *--ptg* ]]
then
~/OctoPrint/venv/bin/pip install -q "https://github.com/eyal0/OctoPrint-PrintTimeGenius/archive/master.zip"
Expand Down
1 change: 1 addition & 0 deletions scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ dependencies="libgtk-3-0 libnotify4 libnss3 libxss1 libxtst6 xdg-utils libatspi2

echo "Installing OctoPrint Plugins"
~/OctoPrint/venv/bin/pip install -q "https://github.com/OllisGit/OctoPrint-DisplayLayerProgress/releases/latest/download/master.zip"
~/OctoPrint/venv/bin/pip install -q "https://github.com/marian42/octoprint-preheat/archive/master.zip"
if [[ $* == *--ptg* ]]
then
~/OctoPrint/venv/bin/pip install -q "https://github.com/eyal0/OctoPrint-PrintTimeGenius/archive/master.zip"
Expand Down
3 changes: 1 addition & 2 deletions src/app/job-status/job-status.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@
{{ job.filamentAmount }}g
</span>
<span class="job-info__print-details-finish-state">
<!-- TODO Once Filament Manager is up and working-->
<!-- - 1250g filament left after print -->
<!-- TODO Once Filament Manager is up and working either display costs here or filament left-->
filament will be used
</span>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/app/job-status/job-status.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class JobStatusComponent implements OnInit, OnDestroy {
}

public preheat(): void {
this.notificationService.setError('Operation not yet supported', 'sorry about that one ... will come in the future!');
this.jobService.preheat();
}

public cancelLoadedFile(): void {
Expand Down
15 changes: 15 additions & 0 deletions src/app/job.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,21 @@ export class JobService {
);
}

public preheat(): void {
if (this.httpPOSTRequest) {
this.httpPOSTRequest.unsubscribe();
}
const preheatPayload: JobCommand = {
command: 'preheat'
};
this.httpPOSTRequest = this.http.post(this.configService.getURL('plugin/preheat'), preheatPayload, this.configService.getHTTPHeaders())
.subscribe(
() => null, (error: HttpErrorResponse) => {
this.notificationService.setError('Can\'t preheat printer!', error.message);
}
);
}

private calculateEndTime(duration: number): string {
const date = new Date();
date.setSeconds(date.getSeconds() + duration);
Expand Down

0 comments on commit 871a48d

Please sign in to comment.