Closed Avataar120 closed 1 year ago
Few more infos : If I make a G1 move, the display shows correctly the position of the head in MPos, sometimes not.
As soon as I send a M2 command, display goes back to 0, 0, Z (which are exactly the values in WCO) However ? command reports correctly the position of the machine in MPos
It seems that sometimes, display is showing WCO position ... But not due to OLED.cpp code ...
For M2 command, it's 100% reproductable due to gc_wco_changed(); in GCODE.cpp
This is an issue with Lightburn as it sends a M2 command after each jog / manual move
Other evidence of MPos / WCO ... During a homing sequence (that I limit to XY with $H=XY for instance), MPOS Z=7.50, WCO Z=4.2 You can see on the video that very briefly, Z value is switching from 7.5 to 4.2 when limit switch is hit
https://github.com/bdring/FluidNC/assets/12379002/e4a4b887-3b54-458e-8b77-219c8b9e96b5
I think I have found the bug.
If you want me to try an hotfix, you can just give me the modif and I test it right away !
Oops, there is a bug in the above
diff --git a/FluidNC/src/OLED.cpp b/FluidNC/src/OLED.cpp
index ec7c9a50..aa2d377d 100644
--- a/FluidNC/src/OLED.cpp
+++ b/FluidNC/src/OLED.cpp
@@ -205,9 +205,7 @@ void OLED::parse_numbers(std::string s, float* nums, int maxnums) {
} while (nextpos != std::string::npos);
}
-float* OLED::parse_axes(std::string s) {
- static float axes[MAX_N_AXIS];
-
+void OLED::parse_axes(std::string s, float* axes) {
size_t pos = 0;
size_t nextpos = -1;
size_t axis = 0;
@@ -219,7 +217,6 @@ float* OLED::parse_axes(std::string s) {
}
pos = nextpos + 1;
} while (nextpos != std::string::npos);
- return axes;
}
void OLED::parse_status_report() {
@@ -234,9 +231,9 @@ void OLED::parse_status_report() {
bool probe = false;
bool limits[MAX_N_AXIS] = { false };
- float* axes;
- bool isMpos = false;
- _filename = "";
+ float axes[MAX_N_AXIS];
+ bool isMpos = false;
+ _filename = "";
// ... handle it
while (nextpos != std::string::npos) {
@@ -249,13 +246,13 @@ void OLED::parse_status_report() {
auto value = field.substr(colon + 1);
if (tag == "MPos") {
// x,y,z,...
- axes = parse_axes(value);
+ parse_axes(value, axes);
isMpos = true;
continue;
}
if (tag == "WPos") {
// x,y,z...
- axes = parse_axes(value);
+ parse_axes(value, axes);
isMpos = false;
continue;
}
@@ -305,7 +302,10 @@ void OLED::parse_status_report() {
}
if (tag == "WCO") {
// x,y,z,...
- auto wcos = parse_axes(value);
+ // We do not use the WCO values because the DROs show whichever
+ // position is in the status report
+ // float wcos[MAX_N_AXIS];
+ // auto wcos = parse_axes(value, wcos);
continue;
}
if (tag == "Ov") {
diff --git a/FluidNC/src/OLED.h b/FluidNC/src/OLED.h
index c9937ba8..25e59969 100644
--- a/FluidNC/src/OLED.h
+++ b/FluidNC/src/OLED.h
@@ -53,8 +53,8 @@ private:
void parse_AP();
void parse_BT();
- float* parse_axes(std::string s);
- void parse_numbers(std::string s, float* nums, int maxnums);
+ void parse_axes(std::string s, float* axes);
+ void parse_numbers(std::string s, float* nums, int maxnums);
void show_limits(bool probe, const bool* limits);
void show_state();
I deleted the bad patch and added a good one.
Working like a charm ! You are the best :)
Controller Board
Own design
Machine Description
K40 with Z bed
Input Circuits
Configuration file
Startup Messages
User Interface Software
Fluidterm or Lightburn
What happened?
After a HOME procedure, I move the head by entering G0 X3, G0 X6, G0 X9, ... Sometimes, position is correctly reported on the OLED display But most of the time, display is showing the good position then goes back to X = 0, Y= 0, Z = 0, A = 0 or only one axis is correct all the others are at 0 (see the little video attached) Note : when 0 0 0 0 is displayed, if I enter ? command, position is correctly reported
In addition, when a hard swicth is hit (see end of the video), system goes to Alarm then goes back to Idle (this time consistent with ? result) I was expecting to stay in Alarm until ESP32 reset
https://github.com/bdring/FluidNC/assets/12379002/9e8d3e35-7d71-4936-b076-ada38e31eaab
Other Information
No response