Skip to content

Commit f4fbfea

Browse files
authored
Add spindle speed to DROs and disable GCode sync (#289)
* ApplicationControls: add spindle speed to DRO * GCodeSync: remove unreliable code
1 parent ab3a606 commit f4fbfea

File tree

4 files changed

+19
-13
lines changed

4 files changed

+19
-13
lines changed

src/application/ApplicationSettings.qml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ LocalSettings {
5757
setValue("dro.showOffsets", false, false);
5858
setValue("dro.showVelocity", true, false);
5959
setValue("dro.showDistanceToGo", true, false);
60+
setValue("dro.showSpindleSpeed", true, false);
6061
setValue("preview.enable", false, false);
6162
setValue("preview.showMachineLimits", true, false);
6263
setValue("preview.showProgram", true, false);

src/applicationcontrols/AbstractDigitalReadOut.qml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ ApplicationItem {
4747
property bool distanceToGoVisible: settings.initialized && settings.values.dro.showDistanceToGo
4848
property int positionFeedback: _ready ? status.config.positionFeedback : ApplicationStatus.ActualPositionFeedback
4949
property int positionOffset: _ready ? status.config.positionOffset : ApplicationStatus.RelativePositionOffset
50+
property double spindleSpeed: _ready ? Math.abs(status.motion.spindleSpeed) : 0.0
51+
property int spindleDirection: _ready ? status.motion.spindleDirection: 0
52+
property bool spindleSpeedVisible: _ready && settings.initialized ? settings.values.dro.showSpindleSpeed && status.ui.spindlePlusVisible : false
5053

5154
readonly property bool _ready: status.synced
5255
readonly property var _axisNames: helper.ready ? helper.axisNames : ["x", "y", "z", "a"]

src/applicationcontrols/DigitalReadOut.qml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,18 @@ AbstractDigitalReadOut {
245245
active: true
246246
visible: !droRect.offsetsVisible && distanceToGoVisible
247247
}
248+
249+
Loader {
250+
sourceComponent: textLine
251+
onLoaded: {
252+
item.title = qsTr("S:")
253+
item.type = Qt.binding(function() { return droRect.spindleDirection === 1 ? "" : (droRect.spindleDirection === -1 ? "" : ""); });
254+
item.homed = false;
255+
item.value = Qt.binding(function() { return droRect.spindleSpeed; });
256+
}
257+
active: true
258+
visible: !droRect.offsetsVisible && spindleSpeedVisible
259+
}
248260
}
249261

250262
ColumnLayout {

src/pathview/GCodeSync.qml

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ Item {
3535
|| status.task.execState === ApplicationStatus.TaskDone) : false
3636
readonly property string file: status.synced ? status.task.file : ""
3737
property int lastLine: 1
38+
property string lastFile: ""
3839
readonly property bool ready: status.synced
3940

4041
onCurrentLineChanged: updateLine()
@@ -45,22 +46,11 @@ Item {
4546
return;
4647
}
4748

48-
if (d.lastLine > d.currentLine) {
49-
for (var line = 1; line <= d.lastLine; ++line) {
50-
model.setData(file, line, false, GCodeProgramModel.ExecutedRole);
51-
model.setData(file, line, false, GCodeProgramModel.ActiveRole);
52-
}
53-
d.lastLine = d.currentLine;
54-
}
55-
56-
for (line = d.lastLine; line < d.currentLine; ++line) {
57-
model.setData(file, line, true, GCodeProgramModel.ExecutedRole);
58-
model.setData(file, line, false, GCodeProgramModel.ActiveRole);
59-
}
60-
49+
model.setData(d.lastFile, d.lastLine, false, GCodeProgramModel.ActiveRole)
6150
model.setData(file, currentLine, true, GCodeProgramModel.ActiveRole);
6251

6352
d.lastLine = d.currentLine;
53+
d.lastFile = d.file;
6454
}
6555
}
6656
}

0 commit comments

Comments
 (0)