Skip to content

Commit

Permalink
fix settings, feedrate, add axis inversion (UnchartedBull#1676)
Browse files Browse the repository at this point in the history
  • Loading branch information
UnchartedBull authored and pciavald committed May 12, 2021
1 parent de0f152 commit de8250c
Show file tree
Hide file tree
Showing 10 changed files with 134 additions and 15 deletions.
60 changes: 60 additions & 0 deletions helper/config.schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ const configSchema = {
'printTimeGenius',
'psuControl',
'tpLinkSmartPlug',
'tasmota',
'tasmotaMqtt',
],
properties: {
displayLayerProgress: {
Expand Down Expand Up @@ -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: {
Expand All @@ -223,6 +263,7 @@ const configSchema = {
required: [
'customActions',
'fileSorting',
'invertAxisControl',
'pollingInterval',
'touchscreen',
'turnScreenOffWhileSleeping',
Expand Down Expand Up @@ -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',
Expand Down
2 changes: 2 additions & 0 deletions src/app/app.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
};
Expand Down
5 changes: 5 additions & 0 deletions src/app/config/config.default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 6 additions & 0 deletions src/app/config/config.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ interface TasmotaMqttPlugin extends Plugin {
interface OctoDash {
customActions: CustomAction[];
fileSorting: FileSorting;
invertAxisControl: InvertAxisControl;
pollingInterval: number;
touchscreen: boolean;
turnScreenOffWhileSleeping: boolean;
Expand Down Expand Up @@ -126,3 +127,8 @@ interface Window {
fullscreen: boolean;
backgroundColor: string;
}
interface InvertAxisControl {
x: boolean;
y: boolean;
z: boolean;
}
12 changes: 12 additions & 0 deletions src/app/config/config.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
2 changes: 1 addition & 1 deletion src/app/print-control/print-control.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@
-
</div>
</div>
<span class="print-control__adjust__name">Feedrate</span>
<span class="print-control__adjust__name">Speed</span>
</td>
</tr>
</table>
Expand Down
12 changes: 3 additions & 9 deletions src/app/services/printer/printer.octoprint.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down
45 changes: 40 additions & 5 deletions src/app/settings/settings.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -352,6 +358,35 @@
<span class="settings__checkbox-descriptor" i18n="@@always-circular">Always use circular progress bar</span>
</div>
<br />
<span class="settings__heading-2">Invert Axis Control</span>
<div
class="settings__checkbox-container settings__checkbox-container__space-right"
(click)="config.octodash.invertAxisControl.x = !config.octodash.invertAxisControl.x"
>
<span class="settings__checkbox">
<span class="settings__checkbox-checked" *ngIf="config.octodash.invertAxisControl.x"></span>
</span>
<span class="settings__checkbox-descriptor">X</span>
</div>
<div
class="settings__checkbox-container settings__checkbox-container__space-right"
(click)="config.octodash.invertAxisControl.y = !config.octodash.invertAxisControl.y"
>
<span class="settings__checkbox">
<span class="settings__checkbox-checked" *ngIf="config.octodash.invertAxisControl.y"></span>
</span>
<span class="settings__checkbox-descriptor">Y</span>
</div>
<div
class="settings__checkbox-container"
(click)="config.octodash.invertAxisControl.z = !config.octodash.invertAxisControl.z"
>
<span class="settings__checkbox">
<span class="settings__checkbox-checked" *ngIf="config.octodash.invertAxisControl.z"></span>
</span>
<span class="settings__checkbox-descriptor">Z</span>
</div>

<span class="settings__heading-2" i18n="@@octodash-files">Files</span>
<table class="settings__files">
<tr>
Expand Down Expand Up @@ -648,12 +683,12 @@
required
[disabled]="!config.plugins.tasmotaMqtt.enabled"
/>
<label for="tasmotaMqtt-relayN" class="settings__input-label">RelayN</label>
<label for="tasmotaMqtt-relayNumber" class="settings__input-label">Relay Number</label>
<input
type="number"
id="tasmotaMqtt-relayN"
id="tasmotaMqtt-relayNumber"
class="settings__input"
name="tasmotaMqtt-relayN"
name="tasmotaMqtt-relayNumber"
style="width: 44.94vw"
[(ngModel)]="config.plugins.tasmotaMqtt.relayNumber"
[disabled]="!config.plugins.tasmotaMqtt.enabled"
Expand Down
4 changes: 4 additions & 0 deletions src/app/settings/settings.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,10 @@
cursor: pointer;
overflow: visible;

&__space-right {
margin-right: 14vw;
}

&-disabled {
opacity: 0.5;
}
Expand Down
1 change: 1 addition & 0 deletions src/app/settings/settings.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export class SettingsComponent implements OnInit, OnDestroy {
this.settingsCredits.nativeElement,
];
}, 400);
console.log(this.config);
}

public ngOnDestroy(): void {
Expand Down

0 comments on commit de8250c

Please sign in to comment.