From de8250c2038d588032444c4c07a3babb191e77a2 Mon Sep 17 00:00:00 2001 From: Timon G Date: Thu, 8 Apr 2021 15:25:41 -0700 Subject: [PATCH] fix settings, feedrate, add axis inversion (#1676) --- helper/config.schema.js | 60 +++++++++++++++++++ src/app/app.service.ts | 2 + src/app/config/config.default.ts | 5 ++ src/app/config/config.model.ts | 6 ++ src/app/config/config.service.ts | 12 ++++ .../print-control.component.html | 2 +- .../printer/printer.octoprint.service.ts | 12 +--- src/app/settings/settings.component.html | 45 ++++++++++++-- src/app/settings/settings.component.scss | 4 ++ src/app/settings/settings.component.ts | 1 + 10 files changed, 134 insertions(+), 15 deletions(-) diff --git a/helper/config.schema.js b/helper/config.schema.js index 9f2a47654..186545555 100644 --- a/helper/config.schema.js +++ b/helper/config.schema.js @@ -117,6 +117,8 @@ const configSchema = { 'printTimeGenius', 'psuControl', 'tpLinkSmartPlug', + 'tasmota', + 'tasmotaMqtt', ], properties: { displayLayerProgress: { @@ -215,6 +217,44 @@ const configSchema = { }, }, }, + tasmota: { + $id: '#/properties/plugins/properties/tasmota', + type: 'object', + required: ['enabled', 'ip', 'index'], + properties: { + enabled: { + $id: '#/properties/plugins/properties/tasmota/properties/enabled', + type: 'boolean', + }, + ip: { + $id: '#/properties/plugins/properties/tasmota/properties/ip', + type: 'string', + }, + index: { + $id: '#/properties/plugins/properties/tasmota/properties/index', + type: ['number', 'null'], + }, + }, + }, + tasmotaMqtt: { + $id: '#/properties/plugins/properties/tasmotaMqtt', + type: 'object', + required: ['enabled', 'topic', 'relayNumber'], + properties: { + enabled: { + $id: '#/properties/plugins/properties/tasmotaMqtt/properties/enabled', + type: 'boolean', + }, + topic: { + $id: '#/properties/plugins/properties/tasmotaMqtt/properties/topic', + type: 'string', + }, + relayNumber: { + $id: '#/properties/plugins/properties/tasmotaMqtt/properties/relayNumber', + type: ['number', 'null'], + }, + }, + }, }, }, octodash: { @@ -223,6 +263,7 @@ const configSchema = { required: [ 'customActions', 'fileSorting', + 'invertAxisControl', 'pollingInterval', 'touchscreen', 'turnScreenOffWhileSleeping', @@ -284,6 +325,25 @@ const configSchema = { }, }, }, + invertAxisControl: { + $id: '#/properties/octodash/properties/invertAxisControl', + type: 'object', + required: ['x', 'y', 'z'], + properties: { + x: { + $id: '#/properties/octodash/properties/invertAxisControl/properties/x', + type: 'boolean', + }, + y: { + $id: '#/properties/octodash/properties/invertAxisControl/properties/y', + type: 'boolean', + }, + z: { + $id: '#/properties/octodash/properties/invertAxisControl/properties/z', + type: 'boolean', + }, + }, + }, pollingInterval: { $id: '#/properties/octodash/properties/pollingInterval', type: 'integer', diff --git a/src/app/app.service.ts b/src/app/app.service.ts index 41fe98258..52fa92781 100644 --- a/src/app/app.service.ts +++ b/src/app/app.service.ts @@ -45,6 +45,8 @@ export class AppService { (config.octodash.screenSleepCommand = 'xset dpms force standby'), ".octodash should have required property 'screenWakeupCommand'": config => (config.octodash.screenWakeupCommand = 'xset s off && xset -dpms && xset s noblank'), + ".octodash should have required property 'invertAxisControl'": config => + (config.octodash.invertAxisControl = { x: false, y: false, z: false }), ".printer should have required property 'disableExtruderGCode'": config => (config.printer.disableExtruderGCode = 'M18 E'), }; diff --git a/src/app/config/config.default.ts b/src/app/config/config.default.ts index c653cfcaf..67c4175be 100644 --- a/src/app/config/config.default.ts +++ b/src/app/config/config.default.ts @@ -113,6 +113,11 @@ export const defaultConfig: Config = { attribute: 'name', order: 'asc', }, + invertAxisControl: { + x: false, + y: false, + z: false, + }, pollingInterval: 2000, touchscreen: true, turnScreenOffWhileSleeping: false, diff --git a/src/app/config/config.model.ts b/src/app/config/config.model.ts index 61e7010f8..5e05c39bb 100644 --- a/src/app/config/config.model.ts +++ b/src/app/config/config.model.ts @@ -93,6 +93,7 @@ interface TasmotaMqttPlugin extends Plugin { interface OctoDash { customActions: CustomAction[]; fileSorting: FileSorting; + invertAxisControl: InvertAxisControl; pollingInterval: number; touchscreen: boolean; turnScreenOffWhileSleeping: boolean; @@ -126,3 +127,8 @@ interface Window { fullscreen: boolean; backgroundColor: string; } +interface InvertAxisControl { + x: boolean; + y: boolean; + z: boolean; +} diff --git a/src/app/config/config.service.ts b/src/app/config/config.service.ts index 14b2956eb..eafde9400 100644 --- a/src/app/config/config.service.ts +++ b/src/app/config/config.service.ts @@ -300,4 +300,16 @@ export class ConfigService { public getShowExtruderControl(): boolean { return this.config.octodash.showExtruderControl; } + + public isXAxisInverted(): boolean { + return this.config.octodash.invertAxisControl.x; + } + + public isYAxisInverted(): boolean { + return this.config.octodash.invertAxisControl.y; + } + + public isZAxisInverted(): boolean { + return this.config.octodash.invertAxisControl.z; + } } diff --git a/src/app/print-control/print-control.component.html b/src/app/print-control/print-control.component.html index d150ef0f1..773bcacdb 100644 --- a/src/app/print-control/print-control.component.html +++ b/src/app/print-control/print-control.component.html @@ -165,7 +165,7 @@ - - Feedrate + Speed diff --git a/src/app/services/printer/printer.octoprint.service.ts b/src/app/services/printer/printer.octoprint.service.ts index 641879f7c..d24941fa4 100644 --- a/src/app/services/printer/printer.octoprint.service.ts +++ b/src/app/services/printer/printer.octoprint.service.ts @@ -58,9 +58,9 @@ export class PrinterOctoprintService implements PrinterService { public jog(x: number, y: number, z: number): void { const jogPayload: JogCommand = { command: 'jog', - x, - y, - z, + x: this.configService.isXAxisInverted() ? x * -1 : x, + y: this.configService.isYAxisInverted() ? y * -1 : y, + z: this.configService.isZAxisInverted() ? z * -1 : z, speed: z !== 0 ? this.configService.getZSpeed() * 60 : this.configService.getXYSpeed() * 60, }; this.http @@ -106,9 +106,6 @@ export class PrinterOctoprintService implements PrinterService { } public setFeedrate(feedrate: number): void { - if (feedrate === 100) { - return; - } const feedrateCommand: FeedrateCommand = { command: 'feedrate', factor: feedrate, @@ -120,9 +117,6 @@ export class PrinterOctoprintService implements PrinterService { } public setFlowrate(flowrate: number): void { - if (flowrate === 100) { - return; - } const flowrateCommand: FeedrateCommand = { command: 'flowrate', factor: flowrate, diff --git a/src/app/settings/settings.component.html b/src/app/settings/settings.component.html index 217ef25b5..048a40e78 100644 --- a/src/app/settings/settings.component.html +++ b/src/app/settings/settings.component.html @@ -313,7 +313,10 @@ class="settings__checkbox-container" [ngClass]="{ 'settings__checkbox-container-disabled': !( - config.plugins.psuControl.enabled || config.plugins.tpLinkSmartPlug.enabled || config.plugins.tasmota.enabled || config.plugins.tasmotaMqtt.enabled + config.plugins.psuControl.enabled || + config.plugins.tpLinkSmartPlug.enabled || + config.plugins.tasmota.enabled || + config.plugins.tasmotaMqtt.enabled ) }" (click)="config.octodash.turnOnPrinterWhenExitingSleep = !config.octodash.turnOnPrinterWhenExitingSleep" @@ -323,7 +326,10 @@ class="settings__checkbox-checked" [ngClass]="{ 'settings__checkbox-checked-disabled': !( - config.plugins.psuControl.enabled || config.plugins.tpLinkSmartPlug.enabled || config.plugins.tasmota.enabled || config.plugins.tasmotaMqtt.enabled + config.plugins.psuControl.enabled || + config.plugins.tpLinkSmartPlug.enabled || + config.plugins.tasmota.enabled || + config.plugins.tasmotaMqtt.enabled ) }" *ngIf="config.octodash.turnOnPrinterWhenExitingSleep" @@ -352,6 +358,35 @@ Always use circular progress bar
+ Invert Axis Control +
+ + + + X +
+
+ + + + Y +
+
+ + + + Z +
+ Files @@ -648,12 +683,12 @@ required [disabled]="!config.plugins.tasmotaMqtt.enabled" /> - +