Browse Source

Update M48 command in the status line (#14816)

pull/1/head
Acenotass 5 years ago
committed by Scott Lahteine
parent
commit
4af9908764
  1. 52
      Marlin/src/gcode/calibrate/M48.cpp
  2. 3
      Marlin/src/lcd/language/language_en.h
  3. 1
      Marlin/src/lcd/language/language_ru.h

52
Marlin/src/gcode/calibrate/M48.cpp

@ -123,45 +123,47 @@ void GcodeSuite::M48() {
randomSeed(millis()); randomSeed(millis());
for (uint8_t n = 0; n < n_samples; n++) { for (uint8_t n = 0; n < n_samples; n++) {
#if HAS_SPI_LCD
// Display M48 progress in the status bar
ui.status_printf_P(0, PSTR(MSG_M48_POINT ": %d/%d"), int(n + 1), int(n_samples));
#endif
if (n_legs) { if (n_legs) {
const int dir = (random(0, 10) > 5.0) ? -1 : 1; // clockwise or counter clockwise const int dir = (random(0, 10) > 5.0) ? -1 : 1; // clockwise or counter clockwise
float angle = random(0, 360); float angle = random(0, 360);
const float radius = random( const float radius = random(
#if ENABLED(DELTA) #if ENABLED(DELTA)
(int) (0.1250000000 * (DELTA_PRINTABLE_RADIUS)), int(0.1250000000 * (DELTA_PRINTABLE_RADIUS)),
(int) (0.3333333333 * (DELTA_PRINTABLE_RADIUS)) int(0.3333333333 * (DELTA_PRINTABLE_RADIUS))
#else #else
(int) 5.0, (int) (0.125 * _MIN(X_BED_SIZE, Y_BED_SIZE)) int(5), int(0.125 * _MIN(X_BED_SIZE, Y_BED_SIZE))
#endif #endif
); );
if (verbose_level > 3) { if (verbose_level > 3) {
SERIAL_ECHOPAIR("Starting radius: ", radius); SERIAL_ECHOPAIR("Start radius:", radius, " angle:", angle, " dir:");
SERIAL_ECHOPAIR(" angle: ", angle); if (dir > 0) SERIAL_CHAR('C');
SERIAL_ECHOPGM(" Direction: "); SERIAL_ECHOLNPGM("CW");
if (dir > 0) SERIAL_ECHOPGM("Counter-");
SERIAL_ECHOLNPGM("Clockwise");
} }
for (uint8_t l = 0; l < n_legs - 1; l++) { for (uint8_t l = 0; l < n_legs - 1; l++) {
float delta_angle; float delta_angle;
if (schizoid_flag) if (schizoid_flag) {
// The points of a 5 point star are 72 degrees apart. We need to // The points of a 5 point star are 72 degrees apart. We need to
// skip a point and go to the next one on the star. // skip a point and go to the next one on the star.
delta_angle = dir * 2.0 * 72.0; delta_angle = dir * 2.0 * 72.0;
}
else else {
// If we do this line, we are just trying to move further // If we do this line, we are just trying to move further
// around the circle. // around the circle.
delta_angle = dir * (float) random(25, 45); delta_angle = dir * (float) random(25, 45);
}
angle += delta_angle; angle += delta_angle;
while (angle > 360.0) angle -= 360.0; // We probably do not need to keep the angle between 0 and 2*PI, but the
while (angle > 360.0) // We probably do not need to keep the angle between 0 and 2*PI, but the // Arduino documentation says the trig functions should not be given values
angle -= 360.0; // Arduino documentation says the trig functions should not be given values while (angle < 0.0) angle += 360.0; // outside of this range. It looks like they behave correctly with
while (angle < 0.0) // outside of this range. It looks like they behave correctly with // numbers outside of the range, but just to be safe we clamp them.
angle += 360.0; // numbers outside of the range, but just to be safe we clamp them.
X_current = X_probe_location - (X_PROBE_OFFSET_FROM_EXTRUDER) + cos(RADIANS(angle)) * radius; X_current = X_probe_location - (X_PROBE_OFFSET_FROM_EXTRUDER) + cos(RADIANS(angle)) * radius;
Y_current = Y_probe_location - (Y_PROBE_OFFSET_FROM_EXTRUDER) + sin(RADIANS(angle)) * radius; Y_current = Y_probe_location - (Y_PROBE_OFFSET_FROM_EXTRUDER) + sin(RADIANS(angle)) * radius;
@ -175,18 +177,14 @@ void GcodeSuite::M48() {
while (!position_is_reachable_by_probe(X_current, Y_current)) { while (!position_is_reachable_by_probe(X_current, Y_current)) {
X_current *= 0.8; X_current *= 0.8;
Y_current *= 0.8; Y_current *= 0.8;
if (verbose_level > 3) { if (verbose_level > 3)
SERIAL_ECHOPAIR("Pulling point towards center:", X_current); SERIAL_ECHOLNPAIR("Moving inward: X", X_current, " Y", Y_current);
SERIAL_ECHOLNPAIR(", ", Y_current);
}
} }
#endif #endif
if (verbose_level > 3) {
SERIAL_ECHOPGM("Going to:"); if (verbose_level > 3)
SERIAL_ECHOPAIR(" X", X_current); SERIAL_ECHOLNPAIR("Going to: X", X_current, " Y", Y_current, " Z", current_position[Z_AXIS]);
SERIAL_ECHOPAIR(" Y", Y_current);
SERIAL_ECHOLNPAIR(" Z", current_position[Z_AXIS]);
}
do_blocking_move_to_xy(X_current, Y_current); do_blocking_move_to_xy(X_current, Y_current);
} // n_legs loop } // n_legs loop
} // n_legs } // n_legs
@ -220,7 +218,7 @@ void GcodeSuite::M48() {
if (verbose_level > 0) { if (verbose_level > 0) {
if (verbose_level > 1) { if (verbose_level > 1) {
SERIAL_ECHO(n + 1); SERIAL_ECHO(n + 1);
SERIAL_ECHOPAIR(" of ", (int)n_samples); SERIAL_ECHOPAIR(" of ", int(n_samples));
SERIAL_ECHOPAIR_F(": z: ", sample_set[n], 3); SERIAL_ECHOPAIR_F(": z: ", sample_set[n], 3);
if (verbose_level > 2) { if (verbose_level > 2) {
SERIAL_ECHOPAIR_F(" mean: ", mean, 4); SERIAL_ECHOPAIR_F(" mean: ", mean, 4);

3
Marlin/src/lcd/language/language_en.h

@ -256,6 +256,9 @@
#ifndef MSG_M48_TEST #ifndef MSG_M48_TEST
#define MSG_M48_TEST _UxGT("M48 Probe Test") #define MSG_M48_TEST _UxGT("M48 Probe Test")
#endif #endif
#ifndef MSG_M48_POINT
#define MSG_M48_POINT _UxGT("M48 Point")
#endif
#ifndef MSG_M48_DEVIATION #ifndef MSG_M48_DEVIATION
#define MSG_M48_DEVIATION _UxGT("Deviation") #define MSG_M48_DEVIATION _UxGT("Deviation")
#endif #endif

1
Marlin/src/lcd/language/language_ru.h

@ -86,6 +86,7 @@
#define MSG_M48_TEST _UxGT("Проверка датчика Z") #define MSG_M48_TEST _UxGT("Проверка датчика Z")
#define MSG_M48_DEVIATION _UxGT("Отклонение") #define MSG_M48_DEVIATION _UxGT("Отклонение")
#define MSG_M48_POINT _UxGT("Точка")
// TODO: IDEX Menu // TODO: IDEX Menu
#define MSG_OFFSETS_MENU _UxGT("Размещение сопел") #define MSG_OFFSETS_MENU _UxGT("Размещение сопел")

Loading…
Cancel
Save