update 2.0.x
This commit is contained in:
@@ -130,7 +130,7 @@ void GcodeSuite::G35() {
|
||||
// Calculate adjusts
|
||||
LOOP_S_L_N(i, 1, G35_PROBE_COUNT) {
|
||||
const float diff = z_measured[0] - z_measured[i],
|
||||
adjust = abs(diff) < 0.001f ? 0 : diff / threads_factor[(screw_thread - 30) / 10];
|
||||
adjust = ABS(diff) < 0.001f ? 0 : diff / threads_factor[(screw_thread - 30) / 10];
|
||||
|
||||
const int full_turns = trunc(adjust);
|
||||
const float decimal_part = adjust - float(full_turns);
|
||||
@@ -138,8 +138,8 @@ void GcodeSuite::G35() {
|
||||
|
||||
SERIAL_ECHOPGM("Turn ");
|
||||
SERIAL_ECHOPGM_P((char *)pgm_read_ptr(&tramming_point_name[i]));
|
||||
SERIAL_ECHOPAIR(" ", (screw_thread & 1) == (adjust > 0) ? "CCW" : "CW", " by ", abs(full_turns), " turns");
|
||||
if (minutes) SERIAL_ECHOPAIR(" and ", abs(minutes), " minutes");
|
||||
SERIAL_ECHOPAIR(" ", (screw_thread & 1) == (adjust > 0) ? "CCW" : "CW", " by ", ABS(full_turns), " turns");
|
||||
if (minutes) SERIAL_ECHOPAIR(" and ", ABS(minutes), " minutes");
|
||||
if (ENABLED(REPORT_TRAMMING_MM)) SERIAL_ECHOPAIR(" (", -diff, "mm)");
|
||||
SERIAL_EOL();
|
||||
}
|
||||
|
||||
@@ -217,6 +217,8 @@ public:
|
||||
* There's no extra effect if you have a fixed Z probe.
|
||||
*/
|
||||
G29_TYPE GcodeSuite::G29() {
|
||||
DEBUG_SECTION(log_G29, "G29", DEBUGGING(LEVELING));
|
||||
|
||||
TERN_(PROBE_MANUALLY, static) G29_State abl;
|
||||
|
||||
TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_PROBE));
|
||||
@@ -227,11 +229,7 @@ G29_TYPE GcodeSuite::G29() {
|
||||
|
||||
// G29 Q is also available if debugging
|
||||
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||
const uint8_t old_debug_flags = marlin_debug_flags;
|
||||
if (seenQ) marlin_debug_flags |= MARLIN_DEBUG_LEVELING;
|
||||
DEBUG_SECTION(log_G29, "G29", DEBUGGING(LEVELING));
|
||||
if (DEBUGGING(LEVELING)) log_machine_info();
|
||||
marlin_debug_flags = old_debug_flags;
|
||||
if (seenQ || DEBUGGING(LEVELING)) log_machine_info();
|
||||
if (DISABLED(PROBE_MANUALLY) && seenQ) G29_RETURN(false);
|
||||
#endif
|
||||
|
||||
@@ -365,6 +363,8 @@ G29_TYPE GcodeSuite::G29() {
|
||||
#if ABL_USES_GRID
|
||||
|
||||
xy_probe_feedrate_mm_s = MMM_TO_MMS(parser.linearval('S', XY_PROBE_FEEDRATE));
|
||||
if (!xy_probe_feedrate_mm_s) xy_probe_feedrate_mm_s = PLANNER_XY_FEEDRATE();
|
||||
NOLESS(xy_probe_feedrate_mm_s, planner.settings.min_feedrate_mm_s);
|
||||
|
||||
const float x_min = probe.min_x(), x_max = probe.max_x(),
|
||||
y_min = probe.min_y(), y_max = probe.max_y();
|
||||
@@ -472,10 +472,8 @@ G29_TYPE GcodeSuite::G29() {
|
||||
// Query G29 status
|
||||
if (abl.verbose_level || seenQ) {
|
||||
SERIAL_ECHOPGM("Manual G29 ");
|
||||
if (g29_in_progress) {
|
||||
SERIAL_ECHOPAIR("point ", _MIN(abl.abl_probe_index + 1, abl.abl_points));
|
||||
SERIAL_ECHOLNPAIR(" of ", abl.abl_points);
|
||||
}
|
||||
if (g29_in_progress)
|
||||
SERIAL_ECHOLNPAIR("point ", _MIN(abl.abl_probe_index + 1, abl.abl_points), " of ", abl.abl_points);
|
||||
else
|
||||
SERIAL_ECHOLNPGM("idle");
|
||||
}
|
||||
|
||||
@@ -42,6 +42,9 @@
|
||||
#include "../../../lcd/extui/ui_api.h"
|
||||
#endif
|
||||
|
||||
#define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE)
|
||||
#include "../../../core/debug_out.h"
|
||||
|
||||
// Save 130 bytes with non-duplication of PSTR
|
||||
inline void echo_not_entered(const char c) { SERIAL_CHAR(c); SERIAL_ECHOLNPGM(" not entered."); }
|
||||
|
||||
@@ -59,6 +62,16 @@ inline void echo_not_entered(const char c) { SERIAL_CHAR(c); SERIAL_ECHOLNPGM("
|
||||
* S5 Reset and disable mesh
|
||||
*/
|
||||
void GcodeSuite::G29() {
|
||||
DEBUG_SECTION(log_G29, "G29", true);
|
||||
|
||||
// G29 Q is also available if debugging
|
||||
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||
const bool seenQ = parser.seen_test('Q');
|
||||
if (seenQ || DEBUGGING(LEVELING)) {
|
||||
log_machine_info();
|
||||
if (seenQ) return;
|
||||
}
|
||||
#endif
|
||||
|
||||
TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_PROBE));
|
||||
|
||||
|
||||
@@ -31,6 +31,13 @@
|
||||
#include "../../module/temperature.h"
|
||||
#endif
|
||||
|
||||
#ifdef MAPLE_STM32F1
|
||||
// these are enums on the F1...
|
||||
#define INPUT_PULLDOWN INPUT_PULLDOWN
|
||||
#define INPUT_ANALOG INPUT_ANALOG
|
||||
#define OUTPUT_OPEN_DRAIN OUTPUT_OPEN_DRAIN
|
||||
#endif
|
||||
|
||||
void protected_pin_err() {
|
||||
SERIAL_ERROR_MSG(STR_ERR_PROTECTED_PIN);
|
||||
}
|
||||
@@ -55,13 +62,20 @@ void GcodeSuite::M42() {
|
||||
|
||||
if (!parser.boolval('I') && pin_is_protected(pin)) return protected_pin_err();
|
||||
|
||||
bool avoidWrite = false;
|
||||
if (parser.seenval('M')) {
|
||||
switch (parser.value_byte()) {
|
||||
case 0: pinMode(pin, INPUT); break;
|
||||
case 0: pinMode(pin, INPUT); avoidWrite = true; break;
|
||||
case 1: pinMode(pin, OUTPUT); break;
|
||||
case 2: pinMode(pin, INPUT_PULLUP); break;
|
||||
case 2: pinMode(pin, INPUT_PULLUP); avoidWrite = true; break;
|
||||
#ifdef INPUT_PULLDOWN
|
||||
case 3: pinMode(pin, INPUT_PULLDOWN); break;
|
||||
case 3: pinMode(pin, INPUT_PULLDOWN); avoidWrite = true; break;
|
||||
#endif
|
||||
#ifdef INPUT_ANALOG
|
||||
case 4: pinMode(pin, INPUT_ANALOG); avoidWrite = true; break;
|
||||
#endif
|
||||
#ifdef OUTPUT_OPEN_DRAIN
|
||||
case 5: pinMode(pin, OUTPUT_OPEN_DRAIN); break;
|
||||
#endif
|
||||
default: SERIAL_ECHOLNPGM("Invalid Pin Mode"); return;
|
||||
}
|
||||
@@ -99,8 +113,22 @@ void GcodeSuite::M42() {
|
||||
}
|
||||
#endif
|
||||
|
||||
pinMode(pin, OUTPUT);
|
||||
if (avoidWrite) {
|
||||
SERIAL_ECHOLNPGM("?Cannot write to INPUT");
|
||||
return;
|
||||
}
|
||||
|
||||
// An OUTPUT_OPEN_DRAIN should not be changed to normal OUTPUT (STM32)
|
||||
// Use M42 Px M1/5 S0/1 to set the output type and then set value
|
||||
#ifndef OUTPUT_OPEN_DRAIN
|
||||
pinMode(pin, OUTPUT);
|
||||
#endif
|
||||
extDigitalWrite(pin, pin_status);
|
||||
|
||||
#ifdef ARDUINO_ARCH_STM32
|
||||
// A simple I/O will be set to 0 by analogWrite()
|
||||
if (pin_status <= 1) return;
|
||||
#endif
|
||||
analogWrite(pin, pin_status);
|
||||
}
|
||||
|
||||
|
||||
@@ -783,6 +783,10 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
|
||||
case 250: M250(); break; // M250: Set LCD contrast
|
||||
#endif
|
||||
|
||||
#if HAS_LCD_BRIGHTNESS
|
||||
case 256: M256(); break; // M256: Set LCD brightness
|
||||
#endif
|
||||
|
||||
#if ENABLED(EXPERIMENTAL_I2CBUS)
|
||||
case 260: M260(); break; // M260: Send data to an i2c slave
|
||||
case 261: M261(); break; // M261: Request data from an i2c slave
|
||||
|
||||
@@ -191,6 +191,7 @@
|
||||
* M226 - Wait until a pin is in a given state: "M226 P<pin> S<state>" (Requires DIRECT_PIN_CONTROL)
|
||||
* M240 - Trigger a camera to take a photograph. (Requires PHOTO_GCODE)
|
||||
* M250 - Set LCD contrast: "M250 C<contrast>" (0-63). (Requires LCD support)
|
||||
* M256 - Set LCD brightness: "M256 B<brightness>" (0-255). (Requires an LCD with brightness control)
|
||||
* M260 - i2c Send Data (Requires EXPERIMENTAL_I2CBUS)
|
||||
* M261 - i2c Request Data (Requires EXPERIMENTAL_I2CBUS)
|
||||
* M280 - Set servo position absolute: "M280 P<index> S<angle|µs>". (Requires servos)
|
||||
@@ -818,6 +819,10 @@ private:
|
||||
static void M250();
|
||||
#endif
|
||||
|
||||
#if HAS_LCD_BRIGHTNESS
|
||||
static void M256();
|
||||
#endif
|
||||
|
||||
#if ENABLED(EXPERIMENTAL_I2CBUS)
|
||||
static void M260();
|
||||
static void M261();
|
||||
|
||||
37
Marlin/src/gcode/lcd/M256.cpp
Normal file
37
Marlin/src/gcode/lcd/M256.cpp
Normal file
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
#if HAS_LCD_BRIGHTNESS
|
||||
|
||||
#include "../gcode.h"
|
||||
#include "../../lcd/marlinui.h"
|
||||
|
||||
/**
|
||||
* M256: Set the LCD brightness
|
||||
*/
|
||||
void GcodeSuite::M256() {
|
||||
if (parser.seenval('B')) ui.set_brightness(parser.value_int());
|
||||
SERIAL_ECHOLNPAIR("LCD Brightness: ", ui.brightness);
|
||||
}
|
||||
|
||||
#endif // HAS_LCD_BRIGHTNESS
|
||||
@@ -35,13 +35,13 @@
|
||||
* M73 P25 ; Set progress to 25%
|
||||
*/
|
||||
void GcodeSuite::M73() {
|
||||
if (parser.seen('P'))
|
||||
if (parser.seenval('P'))
|
||||
ui.set_progress((PROGRESS_SCALE) > 1
|
||||
? parser.value_float() * (PROGRESS_SCALE)
|
||||
: parser.value_byte()
|
||||
);
|
||||
#if BOTH(LCD_SET_PROGRESS_MANUALLY, USE_M73_REMAINING_TIME)
|
||||
if (parser.seen('R')) ui.set_remaining_time(60 * parser.value_ulong());
|
||||
if (parser.seenval('R')) ui.set_remaining_time(60 * parser.value_ulong());
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
#include "../gcode.h"
|
||||
|
||||
#if ENABLED(TFT_LVGL_UI)
|
||||
#if HAS_TFT_LVGL_UI
|
||||
#include "../../lcd/extui/mks_ui/draw_touch_calibration.h"
|
||||
#else
|
||||
#include "../../lcd/menu/menu.h"
|
||||
@@ -37,7 +37,7 @@
|
||||
*/
|
||||
void GcodeSuite::M995() {
|
||||
|
||||
#if ENABLED(TFT_LVGL_UI)
|
||||
#if HAS_TFT_LVGL_UI
|
||||
lv_draw_touch_calibration_screen();
|
||||
#else
|
||||
ui.goto_screen(touch_screen_calibration);
|
||||
|
||||
Reference in New Issue
Block a user