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

fix settings, feedrate, add axis inversion #1676

Merged
merged 1 commit into from
Apr 8, 2021
Merged
Show file tree
Hide file tree
Changes from all 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
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
7 changes: 7 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 All @@ -115,3 +116,9 @@ interface FileSorting {
attribute: 'name' | 'date' | 'size';
order: 'asc' | 'dsc';
}

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 @@ -296,4 +296,16 @@ export class ConfigService {
public getScreenWakeupCommand(): string {
return this.config.octodash.screenWakeupCommand;
}

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 @@ -312,7 +312,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 @@ -322,7 +325,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 @@ -351,6 +357,35 @@
<span class="settings__checkbox-descriptor">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">Files</span>
<table class="settings__files">
<tr>
Expand Down Expand Up @@ -647,12 +682,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