|
@@ -32,6 +32,19 @@
|
32
|
32
|
#define DEBUG_OUT ENABLED(L6470_CHITCHAT)
|
33
|
33
|
#include "../../../core/debug_out.h"
|
34
|
34
|
|
|
35
|
+static void jiggle_axis(const char axis_char, const float &min, const float &max, const float &rate) {
|
|
36
|
+ char gcode_string[30], str1[11], str2[11];
|
|
37
|
+
|
|
38
|
+ // Turn the motor(s) both directions
|
|
39
|
+ sprintf_P(gcode_string, PSTR("G0 %c%s F%s"), axis_char, dtostrf(min, 1, 3, str1), dtostrf(rate, 1, 3, str2));
|
|
40
|
+ process_subcommands_now(gcode_string);
|
|
41
|
+
|
|
42
|
+ sprintf_P(gcode_string, PSTR("G0 %c%s F%s"), axis_char, dtostrf(max, 1, 3, str1), str2);
|
|
43
|
+ process_subcommands_now(gcode_string);
|
|
44
|
+
|
|
45
|
+ planner.synchronize();
|
|
46
|
+}
|
|
47
|
+
|
35
|
48
|
/**
|
36
|
49
|
*
|
37
|
50
|
* M916: Increase KVAL_HOLD until thermal warning
|
|
@@ -85,14 +98,11 @@ void GcodeSuite::M916() {
|
85
|
98
|
|
86
|
99
|
DEBUG_ECHOLNPAIR("feedrate = ", final_feedrate);
|
87
|
100
|
|
88
|
|
- planner.synchronize(); // wait for all current movement commands to complete
|
|
101
|
+ planner.synchronize(); // Wait for moves to finish
|
89
|
102
|
|
90
|
103
|
for (j = 0; j < driver_count; j++)
|
91
|
|
- L6470.get_status(axis_index[j]); // clear out any pre-existing error flags
|
|
104
|
+ L6470.get_status(axis_index[j]); // Clear out error flags
|
92
|
105
|
|
93
|
|
- char temp_axis_string[] = " ";
|
94
|
|
- temp_axis_string[0] = axis_mon[0][0]; // need to have a string for use within sprintf format section
|
95
|
|
- char gcode_string[80];
|
96
|
106
|
uint16_t status_composite = 0;
|
97
|
107
|
|
98
|
108
|
DEBUG_ECHOLNPGM(".\n.");
|
|
@@ -104,15 +114,8 @@ void GcodeSuite::M916() {
|
104
|
114
|
for (j = 0; j < driver_count; j++)
|
105
|
115
|
L6470.set_param(axis_index[j], L6470_KVAL_HOLD, kval_hold);
|
106
|
116
|
|
107
|
|
- // turn the motor(s) both directions
|
108
|
|
- sprintf_P(gcode_string, PSTR("G0 %s%4.3f F%4.3f"), temp_axis_string, position_min, final_feedrate);
|
109
|
|
- process_subcommands_now(gcode_string);
|
110
|
|
-
|
111
|
|
- sprintf_P(gcode_string, PSTR("G0 %s%4.3f F%4.3f"), temp_axis_string, position_max, final_feedrate);
|
112
|
|
- process_subcommands_now(gcode_string);
|
113
|
|
-
|
114
|
|
- // get the status after the motors have stopped
|
115
|
|
- planner.synchronize();
|
|
117
|
+ // Turn the motor(s) both directions
|
|
118
|
+ jiggle_axis(axis_mon[0][0], position_min, position_max, final_feedrate);
|
116
|
119
|
|
117
|
120
|
status_composite = 0; // clear out the old bits
|
118
|
121
|
|
|
@@ -201,12 +204,9 @@ void GcodeSuite::M917() {
|
201
|
204
|
|
202
|
205
|
DEBUG_ECHOLNPAIR("feedrate = ", final_feedrate);
|
203
|
206
|
|
204
|
|
- planner.synchronize(); // wait for all current movement commands to complete
|
|
207
|
+ planner.synchronize(); // Wait for moves to finish
|
205
|
208
|
for (j = 0; j < driver_count; j++)
|
206
|
|
- L6470.get_status(axis_index[j]); // clear out any pre-existing error flags
|
207
|
|
- char temp_axis_string[] = " ";
|
208
|
|
- temp_axis_string[0] = axis_mon[0][0]; // need to have a string for use within sprintf format section
|
209
|
|
- char gcode_string[80];
|
|
209
|
+ L6470.get_status(axis_index[j]); // Clear out error flags
|
210
|
210
|
uint16_t status_composite = 0;
|
211
|
211
|
uint8_t test_phase = 0;
|
212
|
212
|
// 0 - decreasing OCD - exit when OCD warning occurs (ignore STALL)
|
|
@@ -225,13 +225,7 @@ void GcodeSuite::M917() {
|
225
|
225
|
DEBUG_ECHOPAIR("STALL threshold : ", (stall_th_val + 1) * 31.25);
|
226
|
226
|
DEBUG_ECHOLNPAIR(" OCD threshold : ", (ocd_th_val + 1) * 375);
|
227
|
227
|
|
228
|
|
- sprintf_P(gcode_string, PSTR("G0 %s%4.3f F%4.3f"), temp_axis_string, position_min, final_feedrate);
|
229
|
|
- process_subcommands_now(gcode_string);
|
230
|
|
-
|
231
|
|
- sprintf_P(gcode_string, PSTR("G0 %s%4.3f F%4.3f"), temp_axis_string, position_max, final_feedrate);
|
232
|
|
- process_subcommands_now(gcode_string);
|
233
|
|
-
|
234
|
|
- planner.synchronize();
|
|
228
|
+ jiggle_axis(axis_mon[0][0], position_min, position_max, final_feedrate);
|
235
|
229
|
|
236
|
230
|
status_composite = 0; // clear out the old bits
|
237
|
231
|
|
|
@@ -500,30 +494,19 @@ void GcodeSuite::M918() {
|
500
|
494
|
float feedrate_inc = final_feedrate / 10, // start at 1/10 of max & go up by 1/10 per step)
|
501
|
495
|
current_feedrate = 0;
|
502
|
496
|
|
503
|
|
- planner.synchronize(); // wait for all current movement commands to complete
|
|
497
|
+ planner.synchronize(); // Wait for moves to finish
|
504
|
498
|
|
505
|
499
|
for (j = 0; j < driver_count; j++)
|
506
|
|
- L6470.get_status(axis_index[j]); // clear all error flags
|
|
500
|
+ L6470.get_status(axis_index[j]); // Clear all error flags
|
507
|
501
|
|
508
|
|
- char temp_axis_string[2];
|
509
|
|
- temp_axis_string[0] = axis_mon[0][0]; // need to have a string for use within sprintf format section
|
510
|
|
- temp_axis_string[1] = '\n';
|
511
|
|
-
|
512
|
|
- char gcode_string[80];
|
513
|
502
|
uint16_t status_composite = 0;
|
514
|
|
- DEBUG_ECHOLNPGM(".\n.\n."); // make the feedrate prints easier to see
|
|
503
|
+ DEBUG_ECHOLNPGM(".\n.\n."); // Make the feedrate prints easier to see
|
515
|
504
|
|
516
|
505
|
do {
|
517
|
506
|
current_feedrate += feedrate_inc;
|
518
|
507
|
DEBUG_ECHOLNPAIR("...feedrate = ", current_feedrate);
|
519
|
508
|
|
520
|
|
- sprintf_P(gcode_string, PSTR("G0 %s%4.3f F%4.3f"), temp_axis_string, position_min, current_feedrate);
|
521
|
|
- process_subcommands_now(gcode_string);
|
522
|
|
-
|
523
|
|
- sprintf_P(gcode_string, PSTR("G0 %s%4.3f F%4.3f"), temp_axis_string, position_max, current_feedrate);
|
524
|
|
- process_subcommands_now(gcode_string);
|
525
|
|
-
|
526
|
|
- planner.synchronize();
|
|
509
|
+ jiggle_axis(axis_mon[0][0], position_min, position_max, current_feedrate);
|
527
|
510
|
|
528
|
511
|
for (j = 0; j < driver_count; j++) {
|
529
|
512
|
axis_status[j] = (~L6470.get_status(axis_index[j])) & 0x0800; // bits of interest are all active low
|