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

Harleyg321 feature/temp control #523

Merged
merged 9 commits into from
Mar 30, 2020
Merged
Show file tree
Hide file tree
Changes from 8 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
7 changes: 6 additions & 1 deletion sample.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@
"printer": {
"name": "NAME HERE",
"xySpeed": 100,
"zSpeed": 5
"zSpeed": 5,
"defaultTemperatureFanSpeed": {
"hotend": 200,
"heatbed": 60,
"fan": 100
}
},
"filament": {
"density": 0,
Expand Down
126 changes: 8 additions & 118 deletions src/app/app.service.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';

import { ConfigOld } from './config/config.old';
import { Config, ConfigService } from './config/config.service';
import { ConfigService } from './config/config.service';
import { NotificationService } from './notification/notification.service';

@Injectable({
Expand Down Expand Up @@ -35,129 +34,20 @@ export class AppService {
}
}

this.updateError = [
".filament should have required property 'feedLength'",
".filament should have required property 'feedSpeed'",
". should have required property 'plugins'",
".octodash.customActions[0] should have required property 'confirm'",
".octodash.customActions[0] should have required property 'exit'",
".octodash.customActions[1] should have required property 'confirm'",
".octodash.customActions[1] should have required property 'exit'",
".octodash.customActions[2] should have required property 'confirm'",
".octodash.customActions[2] should have required property 'exit'",
".octodash.customActions[3] should have required property 'confirm'",
".octodash.customActions[3] should have required property 'exit'",
".octodash.customActions[4] should have required property 'confirm'",
".octodash.customActions[4] should have required property 'exit'",
".octodash.customActions[5] should have required property 'confirm'",
".octodash.customActions[5] should have required property 'exit'",
".octodash should have required property 'fileSorting'",
".octodash should have required property 'pollingInterval'",
".octodash should have required property 'turnScreenOffWhileSleeping'",
];
this.updateError = [".printer should have required property 'defaultTemperatureFanSpeed'"];
}

// If the errors can be automatically fixed return true here
public autoFixError(): boolean {
// TODO: remove ConfigOld after release
const configOld = (Object.assign({}, this.configService.getCurrentConfig()) as object) as ConfigOld;
const config: Config = {
octoprint: {
accessToken: configOld.octoprint.accessToken,
url: configOld.octoprint.url,
},
printer: {
name: configOld.printer.name,
xySpeed: configOld.printer.xySpeed,
zSpeed: configOld.printer.zSpeed,
},
filament: {
density: configOld.filament.density,
thickness: configOld.filament.thickness,
feedLength: 470,
feedSpeed: 100,
},
plugins: {
displayLayerProgress: {
enabled: true,
},
enclosure: {
enabled: true,
ambientSensorID: configOld.octodash.temperatureSensor.ambient,
filament1SensorID: null,
filament2SensorID: null,
},
filamentManager: {
enabled: true,
},
preheatButton: {
enabled: true,
},
printTimeGenius: {
enabled: true,
},
psuControl: {
enabled: false,
turnOnPSUWhenExitingSleep: false,
},
},
octodash: {
customActions: [
{
icon: 'home',
command: 'G28',
color: '#dcdde1',
confirm: false,
exit: false,
},
{
icon: 'ruler-vertical',
command: 'G29',
color: '#44bd32',
confirm: false,
exit: false,
},
{
icon: 'fire-alt',
command: 'M140 S50; M104 S185',
color: '#e1b12c',
confirm: false,
exit: true,
},
{
icon: 'snowflake',
command: 'M140 S0; M104 S0',
color: '#0097e6',
confirm: false,
exit: true,
},
{
icon: 'redo-alt',
command: '[!RELOAD]',
color: '#7f8fa6',
confirm: true,
exit: false,
},
{
icon: 'skull',
command: '[!KILL]',
color: '#e84118',
confirm: true,
exit: false,
},
],
fileSorting: {
attribute: 'name',
order: 'asc',
},
pollingInterval: configOld.octoprint.apiInterval,
touchscreen: configOld.octodash.touchscreen,
turnScreenOffWhileSleeping: configOld.octodash.turnScreenOffSleep,
},
let config = this.configService.getCurrentConfig();
config.printer.defaultTemperatureFanSpeed = {
hotend: 200,
heatbed: 60,
fan: 100,
};
this.configService.saveConfig(config);
this.configService.updateConfig();
return false;
return true;
}

private checkUpdate(): void {
Expand Down
5 changes: 2 additions & 3 deletions src/app/bottom-bar/bottom-bar.component.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.bottom-bar {
position: absolute;
bottom: 4.5vh;
bottom: 2.5vh;
left: 2vw;
width: calc(100% - 5.6vw);

Expand All @@ -14,7 +14,7 @@
&-icon {
width: 2.5vw;
display: inline-block;
margin-bottom: -.8vh;
margin-bottom: -0.8vh;
margin-right: 1vw;
}
}
Expand All @@ -29,7 +29,6 @@
}
}


@keyframes blinker {
20% {
opacity: 1;
Expand Down
46 changes: 0 additions & 46 deletions src/app/config/config.old.ts

This file was deleted.

41 changes: 40 additions & 1 deletion src/app/config/config.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ export class ConfigService {
errors.push(`${error.dataPath === '' ? '.' : error.dataPath} ${error.message}`);
}
});
console.error(errors);
return errors;
}

Expand Down Expand Up @@ -219,6 +220,18 @@ export class ConfigService {
public getDefaultSortingOrder(): 'asc' | 'dsc' {
return this.config.octodash.fileSorting.order;
}

public getDefaultHotendTemperature(): number {
return this.config.printer.defaultTemperatureFanSpeed.hotend;
}

public getDefaultHeatbedTemperature(): number {
return this.config.printer.defaultTemperatureFanSpeed.heatbed;
}

public getDefaultFanSpeed(): number {
return this.config.printer.defaultTemperatureFanSpeed.fan;
}
}

export interface Config {
Expand All @@ -242,6 +255,13 @@ interface Printer {
name: string;
xySpeed: number;
zSpeed: number;
defaultTemperatureFanSpeed: DefaultTemperatureFanSpeed;
}

interface DefaultTemperatureFanSpeed {
hotend: number;
heatbed: number;
fan: number;
}

interface Filament {
Expand Down Expand Up @@ -322,7 +342,7 @@ const schema = {
printer: {
$id: '#/properties/printer',
type: 'object',
required: ['name', 'xySpeed', 'zSpeed'],
required: ['name', 'xySpeed', 'zSpeed', 'defaultTemperatureFanSpeed'],
properties: {
name: {
$id: '#/properties/printer/properties/name',
Expand All @@ -337,6 +357,25 @@ const schema = {
$id: '#/properties/printer/properties/zSpeed',
type: 'integer',
},
defaultTemperatureFanSpeed: {
$id: '#/properties/printer/properties/defaultTemperatureFanSpeed',
type: 'object',
required: ['hotend', 'heatbed', 'fan'],
properties: {
hotend: {
$id: '#/properties/printer/properties/defaultTemperatureFanSpeed/hotend',
type: 'integer',
},
heatbed: {
$id: '#/properties/printer/properties/defaultTemperatureFanSpeed/heatbed',
type: 'integer',
},
fan: {
$id: '#/properties/printer/properties/defaultTemperatureFanSpeed/fan',
type: 'integer',
},
},
},
},
},
filament: {
Expand Down
5 changes: 5 additions & 0 deletions src/app/config/no-config/no-config.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ export class NoConfigComponent implements OnInit {
name: '',
xySpeed: 150,
zSpeed: 5,
defaultTemperatureFanSpeed: {
hotend: 200,
heatbed: 60,
fan: 100,
},
},
filament: {
thickness: 1.75,
Expand Down
5 changes: 2 additions & 3 deletions src/app/main-menu/main-menu.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,11 @@
&__settings-icon {
width: 7vw;
float: right;
padding: 5vh 2vw;
padding: 5vh 2vw 0;
margin-top: -15.5vh;
}

&__options {

margin-top: 3vw;
margin-left: 5vw;
width: 90vw;
Expand All @@ -40,7 +39,7 @@

&__1 {
width: 15.5vw;
margin-bottom: -.7vw;
margin-bottom: -0.7vw;
}

&__2 {
Expand Down
Loading