Merge branch 'bugfix-2.0.x' of https://github.com/MarlinFirmware/Marlin into bugfix-2.0.x
This commit is contained in:
+31
-16
@@ -2115,6 +2115,15 @@
|
||||
*/
|
||||
//#define EMERGENCY_PARSER
|
||||
|
||||
/**
|
||||
* Realtime Reporting
|
||||
* Add support for commands S000 State, P000 Pause, and R000 Resume
|
||||
*/
|
||||
//#define REALTIME_REPORTING_COMMANDS
|
||||
#if ENABLED(REALTIME_REPORTING_COMMANDS)
|
||||
//#define FULL_REPORT_TO_HOST_FEATURE // Auto-report the machine status like Grbl CNC
|
||||
#endif
|
||||
|
||||
// Bad Serial-connections can miss a received command by sending an 'ok'
|
||||
// Therefore some clients abort after 30 seconds in a timeout.
|
||||
// Some other clients start sending commands while receiving a 'wait'.
|
||||
@@ -2189,6 +2198,12 @@
|
||||
//#define EVENT_GCODE_AFTER_TOOLCHANGE "G12X" // Extra G-code to run after tool-change
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Tool Sensors detect when tools have been picked up or dropped.
|
||||
* Requires the pins TOOL_SENSOR1_PIN, TOOL_SENSOR2_PIN, etc.
|
||||
*/
|
||||
//#define TOOL_SENSOR
|
||||
|
||||
/**
|
||||
* Retract and prime filament on tool-change to reduce
|
||||
* ooze and stringing and to get cleaner transitions.
|
||||
@@ -2665,22 +2680,22 @@
|
||||
* { <off_time[1..15]>, <hysteresis_end[-3..12]>, hysteresis_start[1..8] }
|
||||
*/
|
||||
#define CHOPPER_TIMING CHOPPER_DEFAULT_12V // All axes (override below)
|
||||
//#define CHOPPER_TIMING_X CHOPPER_DEFAULT_12V // For X Axes (override below)
|
||||
//#define CHOPPER_TIMING_X2 CHOPPER_DEFAULT_12V
|
||||
//#define CHOPPER_TIMING_Y CHOPPER_DEFAULT_12V // For Y Axes (override below)
|
||||
//#define CHOPPER_TIMING_Y2 CHOPPER_DEFAULT_12V
|
||||
//#define CHOPPER_TIMING_Z CHOPPER_DEFAULT_12V // For Z Axes (override below)
|
||||
//#define CHOPPER_TIMING_Z2 CHOPPER_DEFAULT_12V
|
||||
//#define CHOPPER_TIMING_Z3 CHOPPER_DEFAULT_12V
|
||||
//#define CHOPPER_TIMING_Z4 CHOPPER_DEFAULT_12V
|
||||
//#define CHOPPER_TIMING_E CHOPPER_DEFAULT_12V // For Extruders (override below)
|
||||
//#define CHOPPER_TIMING_E1 CHOPPER_DEFAULT_12V
|
||||
//#define CHOPPER_TIMING_E2 CHOPPER_DEFAULT_12V
|
||||
//#define CHOPPER_TIMING_E3 CHOPPER_DEFAULT_12V
|
||||
//#define CHOPPER_TIMING_E4 CHOPPER_DEFAULT_12V
|
||||
//#define CHOPPER_TIMING_E5 CHOPPER_DEFAULT_12V
|
||||
//#define CHOPPER_TIMING_E6 CHOPPER_DEFAULT_12V
|
||||
//#define CHOPPER_TIMING_E7 CHOPPER_DEFAULT_12V
|
||||
//#define CHOPPER_TIMING_X CHOPPER_TIMING // For X Axes (override below)
|
||||
//#define CHOPPER_TIMING_X2 CHOPPER_TIMING_X
|
||||
//#define CHOPPER_TIMING_Y CHOPPER_TIMING // For Y Axes (override below)
|
||||
//#define CHOPPER_TIMING_Y2 CHOPPER_TIMING_Y
|
||||
//#define CHOPPER_TIMING_Z CHOPPER_TIMING // For Z Axes (override below)
|
||||
//#define CHOPPER_TIMING_Z2 CHOPPER_TIMING_Z
|
||||
//#define CHOPPER_TIMING_Z3 CHOPPER_TIMING_Z
|
||||
//#define CHOPPER_TIMING_Z4 CHOPPER_TIMING_Z
|
||||
//#define CHOPPER_TIMING_E CHOPPER_TIMING // For Extruders (override below)
|
||||
//#define CHOPPER_TIMING_E1 CHOPPER_TIMING_E
|
||||
//#define CHOPPER_TIMING_E2 CHOPPER_TIMING_E
|
||||
//#define CHOPPER_TIMING_E3 CHOPPER_TIMING_E
|
||||
//#define CHOPPER_TIMING_E4 CHOPPER_TIMING_E
|
||||
//#define CHOPPER_TIMING_E5 CHOPPER_TIMING_E
|
||||
//#define CHOPPER_TIMING_E6 CHOPPER_TIMING_E
|
||||
//#define CHOPPER_TIMING_E7 CHOPPER_TIMING_E
|
||||
|
||||
/**
|
||||
* Monitor Trinamic drivers
|
||||
|
||||
@@ -322,7 +322,7 @@ void usb_task_init(void) {
|
||||
char *sptr;
|
||||
|
||||
// Patch in the filament diameter
|
||||
sprintf_P(diam, PSTR("%d"), (int)((DEFAULT_NOMINAL_FILAMENT_DIA) * 1000.0));
|
||||
itoa((int)((DEFAULT_NOMINAL_FILAMENT_DIA) * 1000), diam, 10);
|
||||
|
||||
// And copy it to the proper place, expanding it to unicode
|
||||
sptr = &diam[0];
|
||||
|
||||
@@ -85,8 +85,8 @@
|
||||
#define SDIO_CMD_PIN PD2
|
||||
|
||||
SD_HandleTypeDef hsd; // create SDIO structure
|
||||
// F4 support one dma for RX and another for TX.
|
||||
// But Marlin will never do read and write at same time, so we use always one dma for both.
|
||||
// F4 supports one DMA for RX and another for TX, but Marlin will never
|
||||
// do read and write at same time, so we use the same DMA for both.
|
||||
DMA_HandleTypeDef hdma_sdio;
|
||||
|
||||
/*
|
||||
@@ -274,7 +274,7 @@
|
||||
}
|
||||
|
||||
static bool SDIO_ReadWriteBlock_DMA(uint32_t block, const uint8_t *src, uint8_t *dst) {
|
||||
if(HAL_SD_GetCardState(&hsd) != HAL_SD_CARD_TRANSFER) return false;
|
||||
if (HAL_SD_GetCardState(&hsd) != HAL_SD_CARD_TRANSFER) return false;
|
||||
|
||||
TERN_(USE_WATCHDOG, HAL_watchdog_refresh());
|
||||
|
||||
@@ -296,10 +296,10 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32_t timeout = millis() + 500;
|
||||
millis_t timeout = millis() + 500;
|
||||
// Wait the transfer
|
||||
while (hsd.State != HAL_SD_STATE_READY) {
|
||||
if (millis() > timeout) {
|
||||
if (ELAPSED(millis(), timeout)) {
|
||||
HAL_DMA_Abort_IT(&hdma_sdio);
|
||||
HAL_DMA_DeInit(&hdma_sdio);
|
||||
return false;
|
||||
@@ -313,8 +313,7 @@
|
||||
HAL_DMA_DeInit(&hdma_sdio);
|
||||
|
||||
timeout = millis() + 500;
|
||||
while (HAL_SD_GetCardState(&hsd) != HAL_SD_CARD_TRANSFER)
|
||||
if (millis() > timeout) return false;
|
||||
while (HAL_SD_GetCardState(&hsd) != HAL_SD_CARD_TRANSFER) if (ELAPSED(millis(), timeout)) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -210,9 +210,7 @@
|
||||
#include "feature/fanmux.h"
|
||||
#endif
|
||||
|
||||
#if DO_SWITCH_EXTRUDER || ANY(SWITCHING_NOZZLE, PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER, ELECTROMAGNETIC_SWITCHING_TOOLHEAD, SWITCHING_TOOLHEAD)
|
||||
#include "module/tool_change.h"
|
||||
#endif
|
||||
#include "module/tool_change.h"
|
||||
|
||||
#if ENABLED(USE_CONTROLLER_FAN)
|
||||
#include "feature/controllerfan.h"
|
||||
@@ -731,6 +729,9 @@ void idle(TERN_(ADVANCED_PAUSE_FEATURE, bool no_stepper_sleep/*=false*/)) {
|
||||
// Return if setup() isn't completed
|
||||
if (marlin_state == MF_INITIALIZING) goto IDLE_DONE;
|
||||
|
||||
// TODO: Still causing errors
|
||||
(void)check_tool_sensor_stats(active_extruder, true);
|
||||
|
||||
// Handle filament runout sensors
|
||||
TERN_(HAS_FILAMENT_SENSOR, runout.run());
|
||||
|
||||
|
||||
@@ -112,9 +112,6 @@
|
||||
#define SIGN(a) ({__typeof__(a) _a = (a); (_a>0)-(_a<0);})
|
||||
#define IS_POWER_OF_2(x) ((x) && !((x) & ((x) - 1)))
|
||||
|
||||
#define MFNAN 999999.0f
|
||||
#define ISNAN(V) ((V) == MFNAN)
|
||||
|
||||
// Macros to constrain values
|
||||
#ifdef __cplusplus
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ bed_mesh_t z_values;
|
||||
* Extrapolate a single point from its neighbors
|
||||
*/
|
||||
static void extrapolate_one_point(const uint8_t x, const uint8_t y, const int8_t xdir, const int8_t ydir) {
|
||||
if (!ISNAN(z_values[x][y])) return;
|
||||
if (!isnan(z_values[x][y])) return;
|
||||
if (DEBUGGING(LEVELING)) {
|
||||
DEBUG_ECHOPGM("Extrapolate [");
|
||||
if (x < 10) DEBUG_CHAR(' ');
|
||||
@@ -63,12 +63,12 @@ static void extrapolate_one_point(const uint8_t x, const uint8_t y, const int8_t
|
||||
c1 = z_values[x1][y1], c2 = z_values[x2][y2];
|
||||
|
||||
// Treat far unprobed points as zero, near as equal to far
|
||||
if (ISNAN(a2)) a2 = 0.0;
|
||||
if (ISNAN(a1)) a1 = a2;
|
||||
if (ISNAN(b2)) b2 = 0.0;
|
||||
if (ISNAN(b1)) b1 = b2;
|
||||
if (ISNAN(c2)) c2 = 0.0;
|
||||
if (ISNAN(c1)) c1 = c2;
|
||||
if (isnan(a2)) a2 = 0.0;
|
||||
if (isnan(a1)) a1 = a2;
|
||||
if (isnan(b2)) b2 = 0.0;
|
||||
if (isnan(b1)) b1 = b2;
|
||||
if (isnan(c2)) c2 = 0.0;
|
||||
if (isnan(c1)) c1 = c2;
|
||||
|
||||
const float a = 2 * a1 - a2, b = 2 * b1 - b2, c = 2 * c1 - c2;
|
||||
|
||||
|
||||
@@ -132,7 +132,7 @@ void reset_bed_level() {
|
||||
bilinear_start.reset();
|
||||
bilinear_grid_spacing.reset();
|
||||
GRID_LOOP(x, y) {
|
||||
z_values[x][y] = MFNAN;
|
||||
z_values[x][y] = NAN;
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(x, y, 0));
|
||||
}
|
||||
#elif ABL_PLANAR
|
||||
@@ -177,7 +177,7 @@ void reset_bed_level() {
|
||||
LOOP_L_N(x, sx) {
|
||||
SERIAL_CHAR(' ');
|
||||
const float offset = fn(x, y);
|
||||
if (!ISNAN(offset)) {
|
||||
if (!isnan(offset)) {
|
||||
if (offset >= 0) SERIAL_CHAR('+');
|
||||
SERIAL_ECHO_F(offset, int(precision));
|
||||
}
|
||||
|
||||
@@ -97,7 +97,6 @@ public:
|
||||
static inline xy_int8_t probe_indexes(const xy_pos_t &xy) { return probe_indexes(xy.x, xy.y); }
|
||||
|
||||
static float calc_z0(const_float_t a0, const_float_t a1, const_float_t z1, const_float_t a2, const_float_t z2) {
|
||||
if (ISNAN(a0) || ISNAN(a1) || ISNAN(z1) || ISNAN(a2) || ISNAN(z2)) return MFNAN;
|
||||
const float delta_z = (z2 - z1) / (a2 - a1),
|
||||
delta_a = a0 - a1;
|
||||
return z1 + delta_a * delta_z;
|
||||
@@ -118,8 +117,7 @@ public:
|
||||
z2 = calc_z0(pos.x, x1, z_values[ind.x][ind.y+1], x2, z_values[ind.x+1][ind.y+1]),
|
||||
zf = calc_z0(pos.y, y1, z1, y2, z2);
|
||||
|
||||
|
||||
return ISNAN(zf) ? zf : z_offset + zf * factor;
|
||||
return z_offset + zf * factor;
|
||||
}
|
||||
|
||||
#if IS_CARTESIAN && DISABLED(SEGMENT_LEVELED_MOVES)
|
||||
|
||||
@@ -48,7 +48,7 @@ void unified_bed_leveling::report_current_mesh() {
|
||||
if (!leveling_is_valid()) return;
|
||||
SERIAL_ECHO_MSG(" G29 I999");
|
||||
GRID_LOOP(x, y)
|
||||
if (!ISNAN(z_values[x][y])) {
|
||||
if (!isnan(z_values[x][y])) {
|
||||
SERIAL_ECHO_START();
|
||||
SERIAL_ECHOPAIR(" M421 I", x, " J", y);
|
||||
SERIAL_ECHOLNPAIR_F_P(SP_Z_STR, z_values[x][y], 4);
|
||||
@@ -99,7 +99,7 @@ void unified_bed_leveling::reset() {
|
||||
|
||||
void unified_bed_leveling::invalidate() {
|
||||
set_bed_leveling_enabled(false);
|
||||
set_all_mesh_points_to_value(MFNAN);
|
||||
set_all_mesh_points_to_value(NAN);
|
||||
}
|
||||
|
||||
void unified_bed_leveling::set_all_mesh_points_to_value(const_float_t value) {
|
||||
@@ -116,7 +116,7 @@ void unified_bed_leveling::set_all_mesh_points_to_value(const_float_t value) {
|
||||
|
||||
void unified_bed_leveling::set_store_from_mesh(const bed_mesh_t &in_values, mesh_store_t &stored_values) {
|
||||
auto z_to_store = [](const_float_t z) {
|
||||
if (ISNAN(z)) return Z_STEPS_NAN;
|
||||
if (isnan(z)) return Z_STEPS_NAN;
|
||||
const int32_t z_scaled = TRUNC(z * mesh_store_scaling);
|
||||
if (z_scaled == Z_STEPS_NAN || !WITHIN(z_scaled, INT16_MIN, INT16_MAX))
|
||||
return Z_STEPS_NAN; // If Z is out of range, return our custom 'NaN'
|
||||
@@ -127,7 +127,7 @@ void unified_bed_leveling::set_all_mesh_points_to_value(const_float_t value) {
|
||||
|
||||
void unified_bed_leveling::set_mesh_from_store(const mesh_store_t &stored_values, bed_mesh_t &out_values) {
|
||||
auto store_to_z = [](const int16_t z_scaled) {
|
||||
return z_scaled == Z_STEPS_NAN ? MFNAN : z_scaled / mesh_store_scaling;
|
||||
return z_scaled == Z_STEPS_NAN ? NAN : z_scaled / mesh_store_scaling;
|
||||
};
|
||||
GRID_LOOP(x, y) out_values[x][y] = store_to_z(stored_values[x][y]);
|
||||
}
|
||||
@@ -211,7 +211,7 @@ void unified_bed_leveling::display_map(const int map_type) {
|
||||
if (lcd) {
|
||||
// TODO: Display on Graphical LCD
|
||||
}
|
||||
else if (ISNAN(f))
|
||||
else if (isnan(f))
|
||||
SERIAL_ECHOPGM_P(human ? PSTR(" . ") : PSTR("NAN"));
|
||||
else if (human || csv) {
|
||||
if (human && f >= 0.0) SERIAL_CHAR(f > 0 ? '+' : ' '); // Display sign also for positive numbers (' ' for 0)
|
||||
|
||||
@@ -196,7 +196,7 @@ public:
|
||||
#ifdef UBL_Z_RAISE_WHEN_OFF_MESH
|
||||
#define _UBL_OUTER_Z_RAISE UBL_Z_RAISE_WHEN_OFF_MESH
|
||||
#else
|
||||
#define _UBL_OUTER_Z_RAISE MFNAN
|
||||
#define _UBL_OUTER_Z_RAISE NAN
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -269,7 +269,7 @@ public:
|
||||
const float z2 = calc_z0(rx0, mesh_index_to_xpos(cx), z_values[cx][my], mesh_index_to_xpos(cx + 1), z_values[mx][my]);
|
||||
float z0 = calc_z0(ry0, mesh_index_to_ypos(cy), z1, mesh_index_to_ypos(cy + 1), z2);
|
||||
|
||||
if (ISNAN(z0)) { // if part of the Mesh is undefined, it will show up as MFNAN
|
||||
if (isnan(z0)) { // if part of the Mesh is undefined, it will show up as NAN
|
||||
z0 = 0.0; // in ubl.z_values[][] and propagate through the
|
||||
// calculations. If our correction is NAN, we throw it out
|
||||
// because part of the Mesh is undefined and we don't have the
|
||||
@@ -301,7 +301,7 @@ public:
|
||||
#endif
|
||||
|
||||
static inline bool mesh_is_valid() {
|
||||
GRID_LOOP(x, y) if (ISNAN(z_values[x][y])) return false;
|
||||
GRID_LOOP(x, y) if (isnan(z_values[x][y])) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -331,7 +331,7 @@ void unified_bed_leveling::G29() {
|
||||
// to invalidate the ENTIRE mesh, which can't be done with
|
||||
// find_closest_mesh_point (which only returns REAL points).
|
||||
if (closest.pos.x < 0) { invalidate_all = true; break; }
|
||||
z_values[closest.pos.x][closest.pos.y] = MFNAN;
|
||||
z_values[closest.pos.x][closest.pos.y] = NAN;
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(closest.pos, 0.0f));
|
||||
}
|
||||
}
|
||||
@@ -516,7 +516,7 @@ void unified_bed_leveling::G29() {
|
||||
if (cpos.x < 0) {
|
||||
// No more REAL INVALID mesh points to populate, so we ASSUME
|
||||
// user meant to populate ALL INVALID mesh points to value
|
||||
GRID_LOOP(x, y) if (ISNAN(z_values[x][y])) z_values[x][y] = param.C_constant;
|
||||
GRID_LOOP(x, y) if (isnan(z_values[x][y])) z_values[x][y] = param.C_constant;
|
||||
break; // No more invalid Mesh Points to populate
|
||||
}
|
||||
else {
|
||||
@@ -675,7 +675,7 @@ void unified_bed_leveling::adjust_mesh_to_mean(const bool cflag, const_float_t o
|
||||
float sum = 0;
|
||||
int n = 0;
|
||||
GRID_LOOP(x, y)
|
||||
if (!ISNAN(z_values[x][y])) {
|
||||
if (!isnan(z_values[x][y])) {
|
||||
sum += z_values[x][y];
|
||||
n++;
|
||||
}
|
||||
@@ -687,7 +687,7 @@ void unified_bed_leveling::adjust_mesh_to_mean(const bool cflag, const_float_t o
|
||||
//
|
||||
float sum_of_diff_squared = 0;
|
||||
GRID_LOOP(x, y)
|
||||
if (!ISNAN(z_values[x][y]))
|
||||
if (!isnan(z_values[x][y]))
|
||||
sum_of_diff_squared += sq(z_values[x][y] - mean);
|
||||
|
||||
SERIAL_ECHOLNPAIR("# of samples: ", n);
|
||||
@@ -698,7 +698,7 @@ void unified_bed_leveling::adjust_mesh_to_mean(const bool cflag, const_float_t o
|
||||
|
||||
if (cflag)
|
||||
GRID_LOOP(x, y)
|
||||
if (!ISNAN(z_values[x][y])) {
|
||||
if (!isnan(z_values[x][y])) {
|
||||
z_values[x][y] -= mean + offset;
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(x, y, z_values[x][y]));
|
||||
}
|
||||
@@ -709,7 +709,7 @@ void unified_bed_leveling::adjust_mesh_to_mean(const bool cflag, const_float_t o
|
||||
*/
|
||||
void unified_bed_leveling::shift_mesh_height() {
|
||||
GRID_LOOP(x, y)
|
||||
if (!ISNAN(z_values[x][y])) {
|
||||
if (!isnan(z_values[x][y])) {
|
||||
z_values[x][y] += param.C_constant;
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(x, y, z_values[x][y]));
|
||||
}
|
||||
@@ -1017,7 +1017,7 @@ void set_message_with_feedback(PGM_P const msg_P) {
|
||||
ui.refresh();
|
||||
|
||||
float new_z = z_values[lpos.x][lpos.y];
|
||||
if (ISNAN(new_z)) new_z = 0; // Invalid points begin at 0
|
||||
if (isnan(new_z)) new_z = 0; // Invalid points begin at 0
|
||||
new_z = FLOOR(new_z * 1000) * 0.001f; // Chop off digits after the 1000ths place
|
||||
|
||||
ui.ubl_mesh_edit_start(new_z);
|
||||
@@ -1227,7 +1227,7 @@ mesh_index_pair unified_bed_leveling::find_furthest_invalid_mesh_point() {
|
||||
mesh_index_pair farthest { -1, -1, -99999.99 };
|
||||
|
||||
GRID_LOOP(i, j) {
|
||||
if (!ISNAN(z_values[i][j])) continue; // Skip valid mesh points
|
||||
if (!isnan(z_values[i][j])) continue; // Skip valid mesh points
|
||||
|
||||
// Skip unreachable points
|
||||
if (!probe.can_reach(mesh_index_to_xpos(i), mesh_index_to_ypos(j)))
|
||||
@@ -1238,7 +1238,7 @@ mesh_index_pair unified_bed_leveling::find_furthest_invalid_mesh_point() {
|
||||
xy_int8_t nearby { -1, -1 };
|
||||
float d1, d2 = 99999.9f;
|
||||
GRID_LOOP(k, l) {
|
||||
if (ISNAN(z_values[k][l])) continue;
|
||||
if (isnan(z_values[k][l])) continue;
|
||||
|
||||
found_a_real = true;
|
||||
|
||||
@@ -1282,7 +1282,7 @@ mesh_index_pair unified_bed_leveling::find_furthest_invalid_mesh_point() {
|
||||
|
||||
static bool test_func(uint8_t i, uint8_t j, void *data) {
|
||||
find_closest_t *d = (find_closest_t*)data;
|
||||
if ( (d->type == (ISNAN(ubl.z_values[i][j]) ? INVALID : REAL))
|
||||
if ( (d->type == (isnan(ubl.z_values[i][j]) ? INVALID : REAL))
|
||||
|| (d->type == SET_IN_BITMAP && !d->done_flags->marked(i, j))
|
||||
) {
|
||||
// Found a Mesh Point of the specified type!
|
||||
@@ -1326,7 +1326,7 @@ mesh_index_pair unified_bed_leveling::find_closest_mesh_point_of_type(const Mesh
|
||||
float best_so_far = 99999.99f;
|
||||
|
||||
GRID_LOOP(i, j) {
|
||||
if ( (type == (ISNAN(z_values[i][j]) ? INVALID : REAL))
|
||||
if ( (type == (isnan(z_values[i][j]) ? INVALID : REAL))
|
||||
|| (type == SET_IN_BITMAP && !done_flags->marked(i, j))
|
||||
) {
|
||||
// Found a Mesh Point of the specified type!
|
||||
@@ -1367,12 +1367,12 @@ mesh_index_pair unified_bed_leveling::find_closest_mesh_point_of_type(const Mesh
|
||||
|
||||
bool unified_bed_leveling::smart_fill_one(const uint8_t x, const uint8_t y, const int8_t xdir, const int8_t ydir) {
|
||||
const float v = z_values[x][y];
|
||||
if (ISNAN(v)) { // A NAN...
|
||||
if (isnan(v)) { // A NAN...
|
||||
const int8_t dx = x + xdir, dy = y + ydir;
|
||||
const float v1 = z_values[dx][dy];
|
||||
if (!ISNAN(v1)) { // ...next to a pair of real values?
|
||||
if (!isnan(v1)) { // ...next to a pair of real values?
|
||||
const float v2 = z_values[dx + xdir][dy + ydir];
|
||||
if (!ISNAN(v2)) {
|
||||
if (!isnan(v2)) {
|
||||
z_values[x][y] = v1 < v2 ? v1 : v1 + v1 - v2;
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(x, y, z_values[x][y]));
|
||||
return true;
|
||||
@@ -1441,7 +1441,7 @@ void unified_bed_leveling::smart_fill_mesh() {
|
||||
TERN_(HAS_STATUS_MESSAGE, ui.status_printf_P(0, PSTR(S_FMT " 1/3"), GET_TEXT(MSG_LCD_TILTING_MESH)));
|
||||
|
||||
measured_z = probe.probe_at_point(points[0], PROBE_PT_RAISE, param.V_verbosity);
|
||||
if (ISNAN(measured_z))
|
||||
if (isnan(measured_z))
|
||||
abort_flag = true;
|
||||
else {
|
||||
measured_z -= get_z_correction(points[0]);
|
||||
@@ -1463,7 +1463,7 @@ void unified_bed_leveling::smart_fill_mesh() {
|
||||
#ifdef VALIDATE_MESH_TILT
|
||||
z2 = measured_z;
|
||||
#endif
|
||||
if (ISNAN(measured_z))
|
||||
if (isnan(measured_z))
|
||||
abort_flag = true;
|
||||
else {
|
||||
measured_z -= get_z_correction(points[1]);
|
||||
@@ -1483,7 +1483,7 @@ void unified_bed_leveling::smart_fill_mesh() {
|
||||
#ifdef VALIDATE_MESH_TILT
|
||||
z3 = measured_z;
|
||||
#endif
|
||||
if (ISNAN(measured_z))
|
||||
if (isnan(measured_z))
|
||||
abort_flag = true;
|
||||
else {
|
||||
measured_z -= get_z_correction(points[2]);
|
||||
@@ -1522,7 +1522,7 @@ void unified_bed_leveling::smart_fill_mesh() {
|
||||
|
||||
measured_z = probe.probe_at_point(rpos, parser.seen('E') ? PROBE_PT_STOW : PROBE_PT_RAISE, param.V_verbosity); // TODO: Needs error handling
|
||||
|
||||
abort_flag = ISNAN(measured_z);
|
||||
abort_flag = isnan(measured_z);
|
||||
|
||||
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||
if (DEBUGGING(LEVELING)) {
|
||||
@@ -1673,14 +1673,14 @@ void unified_bed_leveling::smart_fill_mesh() {
|
||||
|
||||
const float weight_scaled = weight_factor * _MAX(MESH_X_DIST, MESH_Y_DIST);
|
||||
|
||||
GRID_LOOP(jx, jy) if (!ISNAN(z_values[jx][jy])) SBI(bitmap[jx], jy);
|
||||
GRID_LOOP(jx, jy) if (!isnan(z_values[jx][jy])) SBI(bitmap[jx], jy);
|
||||
|
||||
xy_pos_t ppos;
|
||||
LOOP_L_N(ix, GRID_MAX_POINTS_X) {
|
||||
ppos.x = mesh_index_to_xpos(ix);
|
||||
LOOP_L_N(iy, GRID_MAX_POINTS_Y) {
|
||||
ppos.y = mesh_index_to_ypos(iy);
|
||||
if (ISNAN(z_values[ix][iy])) {
|
||||
if (isnan(z_values[ix][iy])) {
|
||||
// undefined mesh point at (ppos.x,ppos.y), compute weighted LSF from original valid mesh points.
|
||||
incremental_LSF_reset(&lsf_results);
|
||||
xy_pos_t rpos;
|
||||
|
||||
@@ -85,7 +85,7 @@
|
||||
|
||||
// Undefined parts of the Mesh in z_values[][] are NAN.
|
||||
// Replace NAN corrections with 0.0 to prevent NAN propagation.
|
||||
if (!ISNAN(z0)) end.z += z0;
|
||||
if (!isnan(z0)) end.z += z0;
|
||||
planner.buffer_segment(end, scaled_fr_mm_s, extruder);
|
||||
current_position = destination;
|
||||
return;
|
||||
@@ -150,7 +150,7 @@
|
||||
|
||||
// Undefined parts of the Mesh in z_values[][] are NAN.
|
||||
// Replace NAN corrections with 0.0 to prevent NAN propagation.
|
||||
if (ISNAN(z0)) z0 = 0.0;
|
||||
if (isnan(z0)) z0 = 0.0;
|
||||
|
||||
const float ry = mesh_index_to_ypos(icell.y);
|
||||
|
||||
@@ -198,7 +198,7 @@
|
||||
|
||||
// Undefined parts of the Mesh in z_values[][] are NAN.
|
||||
// Replace NAN corrections with 0.0 to prevent NAN propagation.
|
||||
if (ISNAN(z0)) z0 = 0.0;
|
||||
if (isnan(z0)) z0 = 0.0;
|
||||
|
||||
/**
|
||||
* Without this check, it's possible to generate a zero length move, as in the case where
|
||||
@@ -253,7 +253,7 @@
|
||||
|
||||
// Undefined parts of the Mesh in z_values[][] are NAN.
|
||||
// Replace NAN corrections with 0.0 to prevent NAN propagation.
|
||||
if (ISNAN(z0)) z0 = 0.0;
|
||||
if (isnan(z0)) z0 = 0.0;
|
||||
|
||||
if (!inf_normalized_flag) {
|
||||
on_axis_distance = use_x_dist ? rx - start.x : next_mesh_line_y - start.y;
|
||||
@@ -276,7 +276,7 @@
|
||||
|
||||
// Undefined parts of the Mesh in z_values[][] are NAN.
|
||||
// Replace NAN corrections with 0.0 to prevent NAN propagation.
|
||||
if (ISNAN(z0)) z0 = 0.0;
|
||||
if (isnan(z0)) z0 = 0.0;
|
||||
|
||||
if (!inf_normalized_flag) {
|
||||
on_axis_distance = use_x_dist ? next_mesh_line_x - start.x : ry - start.y;
|
||||
@@ -405,10 +405,10 @@
|
||||
z_x0y1 = z_values[icell.x ][icell.y+1], // z at lower right corner
|
||||
z_x1y1 = z_values[icell.x+1][icell.y+1]; // z at upper right corner
|
||||
|
||||
if (ISNAN(z_x0y0)) z_x0y0 = 0; // ideally activating planner.leveling_active (G29 A)
|
||||
if (ISNAN(z_x1y0)) z_x1y0 = 0; // should refuse if any invalid mesh points
|
||||
if (ISNAN(z_x0y1)) z_x0y1 = 0; // in order to avoid ISNAN tests per cell,
|
||||
if (ISNAN(z_x1y1)) z_x1y1 = 0; // thus guessing zero for undefined points
|
||||
if (isnan(z_x0y0)) z_x0y0 = 0; // ideally activating planner.leveling_active (G29 A)
|
||||
if (isnan(z_x1y0)) z_x1y0 = 0; // should refuse if any invalid mesh points
|
||||
if (isnan(z_x0y1)) z_x0y1 = 0; // in order to avoid isnan tests per cell,
|
||||
if (isnan(z_x1y1)) z_x1y1 = 0; // thus guessing zero for undefined points
|
||||
|
||||
const xy_pos_t pos = { mesh_index_to_xpos(icell.x), mesh_index_to_ypos(icell.y) };
|
||||
xy_pos_t cell = raw - pos;
|
||||
|
||||
@@ -34,29 +34,33 @@
|
||||
// External references
|
||||
extern bool wait_for_user, wait_for_heatup;
|
||||
|
||||
#if ENABLED(REALTIME_REPORTING_COMMANDS)
|
||||
// From motion.h, which cannot be included here
|
||||
void report_current_position_moving();
|
||||
void quickpause_stepper();
|
||||
void quickresume_stepper();
|
||||
#endif
|
||||
|
||||
class EmergencyParser {
|
||||
|
||||
public:
|
||||
|
||||
// Currently looking for: M108, M112, M410, M876
|
||||
enum State : char {
|
||||
// Currently looking for: M108, M112, M410, M876 S[0-9], S000, P000, R000
|
||||
enum State : uint8_t {
|
||||
EP_RESET,
|
||||
EP_N,
|
||||
EP_M,
|
||||
EP_M1,
|
||||
EP_M10,
|
||||
EP_M108,
|
||||
EP_M11,
|
||||
EP_M112,
|
||||
EP_M4,
|
||||
EP_M41,
|
||||
EP_M410,
|
||||
EP_M10, EP_M108,
|
||||
EP_M11, EP_M112,
|
||||
EP_M4, EP_M41, EP_M410,
|
||||
#if ENABLED(HOST_PROMPT_SUPPORT)
|
||||
EP_M8,
|
||||
EP_M87,
|
||||
EP_M876,
|
||||
EP_M876S,
|
||||
EP_M876SN,
|
||||
EP_M8, EP_M87, EP_M876, EP_M876S, EP_M876SN,
|
||||
#endif
|
||||
#if ENABLED(REALTIME_REPORTING_COMMANDS)
|
||||
EP_S, EP_S0, EP_S00, EP_GRBL_STATUS,
|
||||
EP_R, EP_R0, EP_R00, EP_GRBL_RESUME,
|
||||
EP_P, EP_P0, EP_P00, EP_GRBL_PAUSE,
|
||||
#endif
|
||||
EP_IGNORE // to '\n'
|
||||
};
|
||||
@@ -71,7 +75,6 @@ public:
|
||||
EmergencyParser() { enable(); }
|
||||
|
||||
FORCE_INLINE static void enable() { enabled = true; }
|
||||
|
||||
FORCE_INLINE static void disable() { enabled = false; }
|
||||
|
||||
FORCE_INLINE static void update(State &state, const uint8_t c) {
|
||||
@@ -79,21 +82,45 @@ public:
|
||||
case EP_RESET:
|
||||
switch (c) {
|
||||
case ' ': case '\n': case '\r': break;
|
||||
case 'N': state = EP_N; break;
|
||||
case 'M': state = EP_M; break;
|
||||
default: state = EP_IGNORE;
|
||||
case 'N': state = EP_N; break;
|
||||
case 'M': state = EP_M; break;
|
||||
#if ENABLED(REALTIME_REPORTING_COMMANDS)
|
||||
case 'S': state = EP_S; break;
|
||||
case 'P': state = EP_P; break;
|
||||
case 'R': state = EP_R; break;
|
||||
#endif
|
||||
default: state = EP_IGNORE;
|
||||
}
|
||||
break;
|
||||
|
||||
case EP_N:
|
||||
switch (c) {
|
||||
case '0' ... '9':
|
||||
case '-': case ' ': break;
|
||||
case 'M': state = EP_M; break;
|
||||
default: state = EP_IGNORE;
|
||||
case '-': case ' ': break;
|
||||
case 'M': state = EP_M; break;
|
||||
#if ENABLED(REALTIME_REPORTING_COMMANDS)
|
||||
case 'S': state = EP_S; break;
|
||||
case 'P': state = EP_P; break;
|
||||
case 'R': state = EP_R; break;
|
||||
#endif
|
||||
default: state = EP_IGNORE;
|
||||
}
|
||||
break;
|
||||
|
||||
#if ENABLED(REALTIME_REPORTING_COMMANDS)
|
||||
case EP_S: state = (c == '0') ? EP_S0 : EP_IGNORE; break;
|
||||
case EP_S0: state = (c == '0') ? EP_S00 : EP_IGNORE; break;
|
||||
case EP_S00: state = (c == '0') ? EP_GRBL_STATUS : EP_IGNORE; break;
|
||||
|
||||
case EP_R: state = (c == '0') ? EP_R0 : EP_IGNORE; break;
|
||||
case EP_R0: state = (c == '0') ? EP_R00 : EP_IGNORE; break;
|
||||
case EP_R00: state = (c == '0') ? EP_GRBL_RESUME : EP_IGNORE; break;
|
||||
|
||||
case EP_P: state = (c == '0') ? EP_P0 : EP_IGNORE; break;
|
||||
case EP_P0: state = (c == '0') ? EP_P00 : EP_IGNORE; break;
|
||||
case EP_P00: state = (c == '0') ? EP_GRBL_PAUSE : EP_IGNORE; break;
|
||||
#endif
|
||||
|
||||
case EP_M:
|
||||
switch (c) {
|
||||
case ' ': break;
|
||||
@@ -114,48 +141,34 @@ public:
|
||||
}
|
||||
break;
|
||||
|
||||
case EP_M10:
|
||||
state = (c == '8') ? EP_M108 : EP_IGNORE;
|
||||
break;
|
||||
|
||||
case EP_M11:
|
||||
state = (c == '2') ? EP_M112 : EP_IGNORE;
|
||||
break;
|
||||
|
||||
case EP_M4:
|
||||
state = (c == '1') ? EP_M41 : EP_IGNORE;
|
||||
break;
|
||||
|
||||
case EP_M41:
|
||||
state = (c == '0') ? EP_M410 : EP_IGNORE;
|
||||
break;
|
||||
case EP_M10: state = (c == '8') ? EP_M108 : EP_IGNORE; break;
|
||||
case EP_M11: state = (c == '2') ? EP_M112 : EP_IGNORE; break;
|
||||
case EP_M4: state = (c == '1') ? EP_M41 : EP_IGNORE; break;
|
||||
case EP_M41: state = (c == '0') ? EP_M410 : EP_IGNORE; break;
|
||||
|
||||
#if ENABLED(HOST_PROMPT_SUPPORT)
|
||||
case EP_M8:
|
||||
state = (c == '7') ? EP_M87 : EP_IGNORE;
|
||||
break;
|
||||
|
||||
case EP_M87:
|
||||
state = (c == '6') ? EP_M876 : EP_IGNORE;
|
||||
break;
|
||||
case EP_M8: state = (c == '7') ? EP_M87 : EP_IGNORE; break;
|
||||
case EP_M87: state = (c == '6') ? EP_M876 : EP_IGNORE; break;
|
||||
|
||||
case EP_M876:
|
||||
switch (c) {
|
||||
case ' ': break;
|
||||
case 'S': state = EP_M876S; break;
|
||||
default: state = EP_IGNORE; break;
|
||||
}
|
||||
break;
|
||||
case EP_M876:
|
||||
switch (c) {
|
||||
case ' ': break;
|
||||
case 'S': state = EP_M876S; break;
|
||||
default: state = EP_IGNORE; break;
|
||||
}
|
||||
break;
|
||||
|
||||
case EP_M876S:
|
||||
switch (c) {
|
||||
case ' ': break;
|
||||
case '0' ... '9':
|
||||
state = EP_M876SN;
|
||||
M876_reason = uint8_t(c - '0');
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case EP_M876S:
|
||||
switch (c) {
|
||||
case ' ': break;
|
||||
case '0' ... '9':
|
||||
state = EP_M876SN;
|
||||
M876_reason = (uint8_t)(c - '0');
|
||||
break;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
case EP_IGNORE:
|
||||
@@ -171,6 +184,11 @@ public:
|
||||
#if ENABLED(HOST_PROMPT_SUPPORT)
|
||||
case EP_M876SN: host_response_handler(M876_reason); break;
|
||||
#endif
|
||||
#if ENABLED(REALTIME_REPORTING_COMMANDS)
|
||||
case EP_GRBL_STATUS: report_current_position_moving(); break;
|
||||
case EP_GRBL_PAUSE: quickpause_stepper(); break;
|
||||
case EP_GRBL_RESUME: quickresume_stepper(); break;
|
||||
#endif
|
||||
default: break;
|
||||
}
|
||||
state = EP_RESET;
|
||||
|
||||
@@ -205,8 +205,8 @@ typedef struct {
|
||||
layer_height = MESH_TEST_LAYER_HEIGHT,
|
||||
prime_length = PRIME_LENGTH;
|
||||
|
||||
int16_t bed_temp = MESH_TEST_BED_TEMP,
|
||||
hotend_temp = MESH_TEST_HOTEND_TEMP;
|
||||
celsius_t bed_temp = MESH_TEST_BED_TEMP,
|
||||
hotend_temp = MESH_TEST_HOTEND_TEMP;
|
||||
|
||||
float nozzle = MESH_TEST_NOZZLE_SIZE,
|
||||
filament_diameter = DEFAULT_NOMINAL_FILAMENT_DIA,
|
||||
|
||||
@@ -105,7 +105,7 @@ void GcodeSuite::G35() {
|
||||
do_blocking_move_to_z(SUM_TERN(BLTOUCH_HS_MODE, Z_CLEARANCE_BETWEEN_PROBES, 7));
|
||||
const float z_probed_height = probe.probe_at_point(screws_tilt_adjust_pos[i], PROBE_PT_RAISE, 0, true);
|
||||
|
||||
if (ISNAN(z_probed_height)) {
|
||||
if (isnan(z_probed_height)) {
|
||||
SERIAL_ECHOPAIR("G35 failed at point ", i, " (");
|
||||
SERIAL_ECHOPGM_P((char *)pgm_read_ptr(&tramming_point_name[i]));
|
||||
SERIAL_CHAR(')');
|
||||
|
||||
@@ -217,9 +217,10 @@ public:
|
||||
* There's no extra effect if you have a fixed Z probe.
|
||||
*/
|
||||
G29_TYPE GcodeSuite::G29() {
|
||||
|
||||
TERN_(PROBE_MANUALLY, static) G29_State abl;
|
||||
|
||||
TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_PROBE));
|
||||
|
||||
reset_stepper_timeout();
|
||||
|
||||
const bool seenQ = EITHER(DEBUG_LEVELING_FEATURE, PROBE_MANUALLY) && parser.seen('Q');
|
||||
@@ -287,11 +288,11 @@ G29_TYPE GcodeSuite::G29() {
|
||||
G29_RETURN(false);
|
||||
}
|
||||
|
||||
const float rx = RAW_X_POSITION(parser.linearval('X', MFNAN)),
|
||||
ry = RAW_Y_POSITION(parser.linearval('Y', MFNAN));
|
||||
const float rx = RAW_X_POSITION(parser.linearval('X', NAN)),
|
||||
ry = RAW_Y_POSITION(parser.linearval('Y', NAN));
|
||||
int8_t i = parser.byteval('I', -1), j = parser.byteval('J', -1);
|
||||
|
||||
if (!ISNAN(rx) && !ISNAN(ry)) {
|
||||
if (!isnan(rx) && !isnan(ry)) {
|
||||
// Get nearest i / j from rx / ry
|
||||
i = (rx - bilinear_start.x + 0.5 * abl.gridSpacing.x) / abl.gridSpacing.x;
|
||||
j = (ry - bilinear_start.y + 0.5 * abl.gridSpacing.y) / abl.gridSpacing.y;
|
||||
@@ -608,7 +609,7 @@ G29_TYPE GcodeSuite::G29() {
|
||||
|
||||
// Outer loop is X with PROBE_Y_FIRST enabled
|
||||
// Outer loop is Y with PROBE_Y_FIRST disabled
|
||||
for (PR_OUTER_VAR = 0; PR_OUTER_VAR < PR_OUTER_SIZE && !ISNAN(abl.measured_z); PR_OUTER_VAR++) {
|
||||
for (PR_OUTER_VAR = 0; PR_OUTER_VAR < PR_OUTER_SIZE && !isnan(abl.measured_z); PR_OUTER_VAR++) {
|
||||
|
||||
int8_t inStart, inStop, inInc;
|
||||
|
||||
@@ -644,7 +645,7 @@ G29_TYPE GcodeSuite::G29() {
|
||||
|
||||
abl.measured_z = faux ? 0.001f * random(-100, 101) : probe.probe_at_point(abl.probePos, raise_after, abl.verbose_level);
|
||||
|
||||
if (ISNAN(abl.measured_z)) {
|
||||
if (isnan(abl.measured_z)) {
|
||||
set_bed_leveling_enabled(abl.reenable);
|
||||
break; // Breaks out of both loops
|
||||
}
|
||||
@@ -690,14 +691,14 @@ G29_TYPE GcodeSuite::G29() {
|
||||
// Retain the last probe position
|
||||
abl.probePos = points[i];
|
||||
abl.measured_z = faux ? 0.001 * random(-100, 101) : probe.probe_at_point(abl.probePos, raise_after, abl.verbose_level);
|
||||
if (ISNAN(abl.measured_z)) {
|
||||
if (isnan(abl.measured_z)) {
|
||||
set_bed_leveling_enabled(abl.reenable);
|
||||
break;
|
||||
}
|
||||
points[i].z = abl.measured_z;
|
||||
}
|
||||
|
||||
if (!abl.dryrun && !ISNAN(abl.measured_z)) {
|
||||
if (!abl.dryrun && !isnan(abl.measured_z)) {
|
||||
vector_3 planeNormal = vector_3::cross(points[0] - points[1], points[2] - points[1]).get_normal();
|
||||
if (planeNormal.z < 0) planeNormal *= -1;
|
||||
planner.bed_level_matrix = matrix_3x3::create_look_at(planeNormal);
|
||||
@@ -713,7 +714,7 @@ G29_TYPE GcodeSuite::G29() {
|
||||
// Stow the probe. No raise for FIX_MOUNTED_PROBE.
|
||||
if (probe.stow()) {
|
||||
set_bed_leveling_enabled(abl.reenable);
|
||||
abl.measured_z = MFNAN;
|
||||
abl.measured_z = NAN;
|
||||
}
|
||||
}
|
||||
#endif // !PROBE_MANUALLY
|
||||
@@ -736,7 +737,7 @@ G29_TYPE GcodeSuite::G29() {
|
||||
#endif
|
||||
|
||||
// Calculate leveling, print reports, correct the position
|
||||
if (!ISNAN(abl.measured_z)) {
|
||||
if (!isnan(abl.measured_z)) {
|
||||
#if ENABLED(AUTO_BED_LEVELING_BILINEAR)
|
||||
|
||||
if (!abl.dryrun) extrapolate_unprobed_bed_level();
|
||||
@@ -873,7 +874,7 @@ G29_TYPE GcodeSuite::G29() {
|
||||
|
||||
// Auto Bed Leveling is complete! Enable if possible.
|
||||
planner.leveling_active = !abl.dryrun || abl.reenable;
|
||||
} // !ISNAN(abl.measured_z)
|
||||
} // !isnan(abl.measured_z)
|
||||
|
||||
// Restore state after probing
|
||||
if (!faux) restore_feedrate_and_scaling();
|
||||
@@ -897,7 +898,10 @@ G29_TYPE GcodeSuite::G29() {
|
||||
|
||||
report_current_position();
|
||||
|
||||
G29_RETURN(ISNAN(abl.measured_z));
|
||||
TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_IDLE));
|
||||
|
||||
G29_RETURN(isnan(abl.measured_z));
|
||||
|
||||
}
|
||||
|
||||
#endif // HAS_ABL_NOT_UBL
|
||||
|
||||
@@ -60,6 +60,8 @@ inline void echo_not_entered(const char c) { SERIAL_CHAR(c); SERIAL_ECHOLNPGM("
|
||||
*/
|
||||
void GcodeSuite::G29() {
|
||||
|
||||
TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_PROBE));
|
||||
|
||||
static int mbl_probe_index = -1;
|
||||
|
||||
MeshLevelingState state = (MeshLevelingState)parser.byteval('S', (int8_t)MeshReport);
|
||||
@@ -187,6 +189,8 @@ void GcodeSuite::G29() {
|
||||
}
|
||||
|
||||
report_current_position();
|
||||
|
||||
TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_IDLE));
|
||||
}
|
||||
|
||||
#endif // MESH_BED_LEVELING
|
||||
|
||||
@@ -31,6 +31,17 @@
|
||||
#include "../../gcode.h"
|
||||
#include "../../../feature/bedlevel/bedlevel.h"
|
||||
|
||||
void GcodeSuite::G29() { ubl.G29(); }
|
||||
#if ENABLED(FULL_REPORT_TO_HOST_FEATURE)
|
||||
#include "../../../module/motion.h"
|
||||
#endif
|
||||
|
||||
void GcodeSuite::G29() {
|
||||
|
||||
TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_PROBE));
|
||||
|
||||
ubl.G29();
|
||||
|
||||
TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_IDLE));
|
||||
}
|
||||
|
||||
#endif // AUTO_BED_LEVELING_UBL
|
||||
|
||||
@@ -62,7 +62,7 @@ void GcodeSuite::M421() {
|
||||
SERIAL_ERROR_MSG(STR_ERR_MESH_XY);
|
||||
else {
|
||||
float &zval = ubl.z_values[ij.x][ij.y];
|
||||
zval = hasN ? MFNAN : parser.value_linear_units() + (hasQ ? zval : 0);
|
||||
zval = hasN ? NAN : parser.value_linear_units() + (hasQ ? zval : 0);
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(ij.x, ij.y, zval));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -211,6 +211,8 @@ void GcodeSuite::G28() {
|
||||
|
||||
TERN_(LASER_MOVE_G28_OFF, cutter.set_inline_enabled(false)); // turn off laser
|
||||
|
||||
TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_HOMING));
|
||||
|
||||
#if ENABLED(DUAL_X_CARRIAGE)
|
||||
bool IDEX_saved_duplication_state = extruder_duplication_enabled;
|
||||
DualXMode IDEX_saved_mode = dual_x_carriage_mode;
|
||||
@@ -479,6 +481,8 @@ void GcodeSuite::G28() {
|
||||
if (ENABLED(NANODLP_Z_SYNC) && (doZ || ENABLED(NANODLP_ALL_AXIS)))
|
||||
SERIAL_ECHOLNPGM(STR_Z_MOVE_COMP);
|
||||
|
||||
TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_IDLE));
|
||||
|
||||
#if HAS_L64XX
|
||||
// Set L6470 absolute position registers to counts
|
||||
// constexpr *might* move this to PROGMEM.
|
||||
|
||||
@@ -212,7 +212,7 @@ static bool probe_calibration_points(float z_pt[NPP + 1], const int8_t probe_poi
|
||||
if (!_7p_no_intermediates && !_7p_4_intermediates && !_7p_11_intermediates) { // probe the center
|
||||
const xy_pos_t center{0};
|
||||
z_pt[CEN] += calibration_probe(center, stow_after_each);
|
||||
if (ISNAN(z_pt[CEN])) return false;
|
||||
if (isnan(z_pt[CEN])) return false;
|
||||
}
|
||||
|
||||
if (_7p_calibration) { // probe extra center points
|
||||
@@ -223,7 +223,7 @@ static bool probe_calibration_points(float z_pt[NPP + 1], const int8_t probe_poi
|
||||
r = dcr * 0.1;
|
||||
const xy_pos_t vec = { cos(a), sin(a) };
|
||||
z_pt[CEN] += calibration_probe(vec * r, stow_after_each);
|
||||
if (ISNAN(z_pt[CEN])) return false;
|
||||
if (isnan(z_pt[CEN])) return false;
|
||||
}
|
||||
z_pt[CEN] /= float(_7p_2_intermediates ? 7 : probe_points);
|
||||
}
|
||||
@@ -248,7 +248,7 @@ static bool probe_calibration_points(float z_pt[NPP + 1], const int8_t probe_poi
|
||||
interpol = FMOD(rad, 1);
|
||||
const xy_pos_t vec = { cos(a), sin(a) };
|
||||
const float z_temp = calibration_probe(vec * r, stow_after_each);
|
||||
if (ISNAN(z_temp)) return false;
|
||||
if (isnan(z_temp)) return false;
|
||||
// split probe point to neighbouring calibration points
|
||||
z_pt[uint8_t(LROUND(rad - interpol + NPP - 1)) % NPP + 1] += z_temp * sq(cos(RADIANS(interpol * 90)));
|
||||
z_pt[uint8_t(LROUND(rad - interpol)) % NPP + 1] += z_temp * sq(sin(RADIANS(interpol * 90)));
|
||||
@@ -387,6 +387,8 @@ static float auto_tune_a() {
|
||||
*/
|
||||
void GcodeSuite::G33() {
|
||||
|
||||
TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_PROBE));
|
||||
|
||||
const int8_t probe_points = parser.intval('P', DELTA_CALIBRATION_DEFAULT_POINTS);
|
||||
if (!WITHIN(probe_points, 0, 10)) {
|
||||
SERIAL_ECHOLNPGM("?(P)oints implausible (0-10).");
|
||||
@@ -645,6 +647,8 @@ void GcodeSuite::G33() {
|
||||
while (((zero_std_dev < test_precision && iterations < 31) || iterations <= force_iterations) && zero_std_dev > calibration_precision);
|
||||
|
||||
ac_cleanup(TERN_(HAS_MULTI_HOTEND, old_tool_index));
|
||||
|
||||
TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_IDLE));
|
||||
}
|
||||
|
||||
#endif // DELTA_AUTO_CALIBRATION
|
||||
|
||||
@@ -229,7 +229,7 @@ void GcodeSuite::G34() {
|
||||
// Probing sanity check is disabled, as it would trigger even in normal cases because
|
||||
// current_position.z has been manually altered in the "dirty trick" above.
|
||||
const float z_probed_height = probe.probe_at_point(z_stepper_align.xy[iprobe], raise_after, 0, true, false);
|
||||
if (ISNAN(z_probed_height)) {
|
||||
if (isnan(z_probed_height)) {
|
||||
SERIAL_ECHOLNPGM("Probing failed");
|
||||
LCD_MESSAGEPGM(MSG_LCD_PROBING_FAILED);
|
||||
err_break = true;
|
||||
|
||||
@@ -113,7 +113,7 @@ void GcodeSuite::G76() {
|
||||
auto g76_probe = [](const TempSensorID sid, uint16_t &targ, const xy_pos_t &nozpos) {
|
||||
do_z_clearance(5.0); // Raise nozzle before probing
|
||||
const float measured_z = probe.probe_at_point(nozpos, PROBE_PT_STOW, 0, false); // verbose=0, probe_relative=false
|
||||
if (ISNAN(measured_z))
|
||||
if (isnan(measured_z))
|
||||
SERIAL_ECHOLNPGM("!Received NAN. Aborting.");
|
||||
else {
|
||||
SERIAL_ECHOLNPAIR_F("Measured: ", measured_z);
|
||||
@@ -208,7 +208,7 @@ void GcodeSuite::G76() {
|
||||
report_temps(next_temp_report);
|
||||
|
||||
const float measured_z = g76_probe(TSI_BED, target_bed, noz_pos_xyz);
|
||||
if (ISNAN(measured_z) || target_bed > BED_MAX_TARGET) break;
|
||||
if (isnan(measured_z) || target_bed > BED_MAX_TARGET) break;
|
||||
}
|
||||
|
||||
SERIAL_ECHOLNPAIR("Retrieved measurements: ", temp_comp.get_index());
|
||||
@@ -267,7 +267,7 @@ void GcodeSuite::G76() {
|
||||
if (timeout) break;
|
||||
|
||||
const float measured_z = g76_probe(TSI_PROBE, target_probe, noz_pos_xyz);
|
||||
if (ISNAN(measured_z) || target_probe > cali_info_init[TSI_PROBE].end_temp) break;
|
||||
if (isnan(measured_z) || target_probe > cali_info_init[TSI_PROBE].end_temp) break;
|
||||
}
|
||||
|
||||
SERIAL_ECHOLNPAIR("Retrieved measurements: ", temp_comp.get_index());
|
||||
|
||||
@@ -134,7 +134,7 @@ void GcodeSuite::M48() {
|
||||
|
||||
// Move to the first point, deploy, and probe
|
||||
const float t = probe.probe_at_point(test_position, raise_after, verbose_level);
|
||||
bool probing_good = !ISNAN(t);
|
||||
bool probing_good = !isnan(t);
|
||||
|
||||
if (probing_good) {
|
||||
randomSeed(millis());
|
||||
@@ -219,7 +219,7 @@ void GcodeSuite::M48() {
|
||||
const float pz = probe.probe_at_point(test_position, raise_after, 0);
|
||||
|
||||
// Break the loop if the probe fails
|
||||
probing_good = !ISNAN(pz);
|
||||
probing_good = !isnan(pz);
|
||||
if (!probing_good) break;
|
||||
|
||||
// Store the new sample
|
||||
|
||||
@@ -289,8 +289,10 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
|
||||
}
|
||||
#endif
|
||||
|
||||
// Handle a known G, M, or T
|
||||
// Handle a known command or reply "unknown command"
|
||||
|
||||
switch (parser.command_letter) {
|
||||
|
||||
case 'G': switch (parser.codenum) {
|
||||
|
||||
case 0: case 1: // G0: Fast Move, G1: Linear Move
|
||||
@@ -995,6 +997,10 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
|
||||
case 'D': D(parser.codenum); break; // Dn: Debug codes
|
||||
#endif
|
||||
|
||||
#if ENABLED(REALTIME_REPORTING_COMMANDS)
|
||||
case 'S': case 'P': case 'R': break; // Invalid S, P, R commands already filtered
|
||||
#endif
|
||||
|
||||
default:
|
||||
#if ENABLED(WIFI_CUSTOM_COMMAND)
|
||||
if (wifi_custom_command(parser.command_ptr)) break;
|
||||
@@ -1087,12 +1093,15 @@ void GcodeSuite::process_subcommands_now(char * gcode) {
|
||||
case IN_HANDLER:
|
||||
case IN_PROCESS:
|
||||
SERIAL_ECHO_MSG(STR_BUSY_PROCESSING);
|
||||
TERN_(FULL_REPORT_TO_HOST_FEATURE, report_current_position_moving());
|
||||
break;
|
||||
case PAUSED_FOR_USER:
|
||||
SERIAL_ECHO_MSG(STR_BUSY_PAUSED_FOR_USER);
|
||||
TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_HOLD));
|
||||
break;
|
||||
case PAUSED_FOR_INPUT:
|
||||
SERIAL_ECHO_MSG(STR_BUSY_PAUSED_FOR_INPUT);
|
||||
TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_HOLD));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
@@ -176,6 +176,8 @@
|
||||
const xyze_float_t diff = from_steppers - leveled;
|
||||
SERIAL_ECHOPGM("Diff: ");
|
||||
report_xyze(diff);
|
||||
|
||||
TERN_(FULL_REPORT_TO_HOST_FEATURE, report_current_grblstate_moving());
|
||||
}
|
||||
|
||||
#endif // M114_DETAIL
|
||||
@@ -211,4 +213,6 @@ void GcodeSuite::M114() {
|
||||
|
||||
TERN_(M114_LEGACY, planner.synchronize());
|
||||
report_current_position_projected();
|
||||
|
||||
TERN_(FULL_REPORT_TO_HOST_FEATURE, report_current_grblstate_moving());
|
||||
}
|
||||
|
||||
@@ -54,6 +54,7 @@ void GcodeSuite::G0_G1(TERN_(HAS_FAST_MOVES, const bool fast_move/*=false*/)) {
|
||||
| (parser.seen('Z') ? _BV(Z_AXIS) : 0) )
|
||||
#endif
|
||||
) {
|
||||
TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_RUNNING));
|
||||
|
||||
#ifdef G0_FEEDRATE
|
||||
feedRate_t old_feedrate;
|
||||
@@ -116,6 +117,9 @@ void GcodeSuite::G0_G1(TERN_(HAS_FAST_MOVES, const bool fast_move/*=false*/)) {
|
||||
planner.synchronize();
|
||||
SERIAL_ECHOLNPGM(STR_Z_MOVE_COMP);
|
||||
}
|
||||
TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_IDLE));
|
||||
#else
|
||||
TERN_(FULL_REPORT_TO_HOST_FEATURE, report_current_grblstate_moving());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -306,6 +306,8 @@ void plan_arc(
|
||||
void GcodeSuite::G2_G3(const bool clockwise) {
|
||||
if (MOTION_CONDITIONS) {
|
||||
|
||||
TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_RUNNING));
|
||||
|
||||
#if ENABLED(SF_ARC_FIX)
|
||||
const bool relative_mode_backup = relative_mode;
|
||||
relative_mode = true;
|
||||
@@ -364,6 +366,8 @@ void GcodeSuite::G2_G3(const bool clockwise) {
|
||||
}
|
||||
else
|
||||
SERIAL_ERROR_MSG(STR_ERR_ARC_ARGS);
|
||||
|
||||
TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_IDLE));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -106,8 +106,10 @@ void GCodeParser::reset() {
|
||||
|
||||
#endif
|
||||
|
||||
// Populate all fields by parsing a single line of GCode
|
||||
// 58 bytes of SRAM are used to speed up seen/value
|
||||
/**
|
||||
* Populate the command line state (command_letter, codenum, subcode, and string_arg)
|
||||
* by parsing a single line of GCode. 58 bytes of SRAM are used to speed up seen/value.
|
||||
*/
|
||||
void GCodeParser::parse(char *p) {
|
||||
|
||||
reset(); // No codes to report
|
||||
@@ -147,10 +149,12 @@ void GCodeParser::parse(char *p) {
|
||||
#define SIGNED_CODENUM 1
|
||||
#endif
|
||||
|
||||
// Bail if the letter is not G, M, or T
|
||||
// (or a valid parameter for the current motion mode)
|
||||
/**
|
||||
* Screen for good command letters. G, M, and T are always accepted.
|
||||
* With Motion Modes enabled any axis letter can come first.
|
||||
* With Realtime Reporting, commands S000, P000, and R000 are allowed.
|
||||
*/
|
||||
switch (letter) {
|
||||
|
||||
case 'G': case 'M': case 'T': TERN_(MARLIN_DEV_MODE, case 'D':)
|
||||
// Skip spaces to get the numeric part
|
||||
while (*p == ' ') p++;
|
||||
@@ -213,10 +217,10 @@ void GCodeParser::parse(char *p) {
|
||||
|
||||
#if ENABLED(GCODE_MOTION_MODES)
|
||||
#if ENABLED(ARC_SUPPORT)
|
||||
case 'I' ... 'J': case 'R':
|
||||
case 'I' ... 'J':
|
||||
if (motion_mode_codenum != 2 && motion_mode_codenum != 3) return;
|
||||
#endif
|
||||
case 'P' ... 'Q':
|
||||
case 'Q':
|
||||
if (motion_mode_codenum != 5) return;
|
||||
case 'X' ... 'Z': case 'E' ... 'F':
|
||||
if (motion_mode_codenum < 0) return;
|
||||
@@ -225,7 +229,24 @@ void GCodeParser::parse(char *p) {
|
||||
TERN_(USE_GCODE_SUBCODES, subcode = motion_mode_subcode);
|
||||
p--; // Back up one character to use the current parameter
|
||||
break;
|
||||
#endif // GCODE_MOTION_MODES
|
||||
#endif
|
||||
|
||||
#if ENABLED(REALTIME_REPORTING_COMMANDS)
|
||||
case 'P': case 'R': {
|
||||
if (letter == 'R') {
|
||||
#if ENABLED(GCODE_MOTION_MODES)
|
||||
if (ENABLED(ARC_SUPPORT) && !WITHIN(motion_mode_codenum, 2, 3)) return;
|
||||
#endif
|
||||
}
|
||||
else if (TERN0(GCODE_MOTION_MODES, motion_mode_codenum != 5)) return;
|
||||
} // fall-thru
|
||||
case 'S': {
|
||||
codenum = 0; // The only valid codenum is 0
|
||||
uint8_t digits = 0;
|
||||
while (*p++ == '0') digits++; // Count up '0' characters
|
||||
command_letter = (digits == 3) ? letter : '?'; // Three '0' digits is a good command
|
||||
} return; // No parameters needed, so return now
|
||||
#endif
|
||||
|
||||
default: return;
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ void GcodeSuite::G30() {
|
||||
|
||||
const ProbePtRaise raise_after = parser.boolval('E', true) ? PROBE_PT_STOW : PROBE_PT_NONE;
|
||||
const float measured_z = probe.probe_at_point(pos, raise_after, 1);
|
||||
if (!ISNAN(measured_z))
|
||||
if (!isnan(measured_z))
|
||||
SERIAL_ECHOLNPAIR("Bed X: ", pos.x, " Y: ", pos.y, " Z: ", measured_z);
|
||||
|
||||
restore_feedrate_and_scaling();
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
* version was tagged.
|
||||
*/
|
||||
#ifndef STRING_DISTRIBUTION_DATE
|
||||
#define STRING_DISTRIBUTION_DATE "2021-04-14"
|
||||
#define STRING_DISTRIBUTION_DATE "2021-04-18"
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
||||
@@ -684,12 +684,15 @@ void MarlinUI::draw_status_message(const bool blink) {
|
||||
|
||||
// If the remaining string doesn't completely fill the screen
|
||||
if (rlen < LCD_WIDTH) {
|
||||
lcd_put_wchar('.'); // Always at 1+ spaces left, draw a dot
|
||||
uint8_t chars = LCD_WIDTH - rlen; // Amount of space left in characters
|
||||
if (--chars) { // Draw a second dot if there's space
|
||||
lcd_put_wchar('.');
|
||||
if (--chars)
|
||||
lcd_put_u8str_max(status_message, chars); // Print a second copy of the message
|
||||
lcd_put_wchar(' '); // Always at 1+ spaces left, draw a space
|
||||
if (--chars) { // Draw a second space if there's room
|
||||
lcd_put_wchar(' ');
|
||||
if (--chars) { // Draw a third space if there's room
|
||||
lcd_put_wchar(' ');
|
||||
if (--chars)
|
||||
lcd_put_u8str_max(status_message, chars); // Print a second copy of the message
|
||||
}
|
||||
}
|
||||
}
|
||||
if (last_blink != blink) {
|
||||
@@ -1457,7 +1460,7 @@ void MarlinUI::draw_status_screen() {
|
||||
* Print Z values
|
||||
*/
|
||||
_ZLABEL(_LCD_W_POS, 1);
|
||||
if (!ISNAN(ubl.z_values[x_plot][y_plot]))
|
||||
if (!isnan(ubl.z_values[x_plot][y_plot]))
|
||||
lcd_put_u8str(ftostr43sign(ubl.z_values[x_plot][y_plot]));
|
||||
else
|
||||
lcd_put_u8str_P(PSTR(" -----"));
|
||||
@@ -1476,7 +1479,7 @@ void MarlinUI::draw_status_screen() {
|
||||
* Show the location value
|
||||
*/
|
||||
_ZLABEL(_LCD_W_POS, 3);
|
||||
if (!ISNAN(ubl.z_values[x_plot][y_plot]))
|
||||
if (!isnan(ubl.z_values[x_plot][y_plot]))
|
||||
lcd_put_u8str(ftostr43sign(ubl.z_values[x_plot][y_plot]));
|
||||
else
|
||||
lcd_put_u8str_P(PSTR(" -----"));
|
||||
|
||||
@@ -581,12 +581,15 @@ void MarlinUI::draw_status_message(const bool blink) {
|
||||
|
||||
// If the remaining string doesn't completely fill the screen
|
||||
if (rlen < LCD_WIDTH) {
|
||||
lcd.write('.'); // Always at 1+ spaces left, draw a dot
|
||||
uint8_t chars = LCD_WIDTH - rlen; // Amount of space left in characters
|
||||
if (--chars) { // Draw a second dot if there's space
|
||||
lcd.write('.');
|
||||
if (--chars)
|
||||
lcd_put_u8str_max(status_message, chars); // Print a second copy of the message
|
||||
lcd.write(' '); // Always at 1+ spaces left, draw a space
|
||||
if (--chars) { // Draw a second space if there's room
|
||||
lcd.write(' ');
|
||||
if (--chars) { // Draw a third space if there's room
|
||||
lcd.write(' ');
|
||||
if (--chars)
|
||||
lcd_put_u8str_max(status_message, chars); // Print a second copy of the message
|
||||
}
|
||||
}
|
||||
}
|
||||
if (last_blink != blink) {
|
||||
@@ -940,7 +943,7 @@ void MarlinUI::draw_status_screen() {
|
||||
// Show the location value
|
||||
lcd.setCursor(_LCD_W_POS, 3); lcd_put_u8str_P(PSTR("Z:"));
|
||||
|
||||
if (!ISNAN(ubl.z_values[x_plot][y_plot]))
|
||||
if (!isnan(ubl.z_values[x_plot][y_plot]))
|
||||
lcd.print(ftostr43sign(ubl.z_values[x_plot][y_plot]));
|
||||
else
|
||||
lcd_put_u8str_P(PSTR(" -----"));
|
||||
|
||||
@@ -569,7 +569,7 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
|
||||
|
||||
// Show the location value
|
||||
lcd_put_u8str_P(74, LCD_PIXEL_HEIGHT, Z_LBL);
|
||||
if (!ISNAN(ubl.z_values[x_plot][y_plot]))
|
||||
if (!isnan(ubl.z_values[x_plot][y_plot]))
|
||||
lcd_put_u8str(ftostr43sign(ubl.z_values[x_plot][y_plot]));
|
||||
else
|
||||
lcd_put_u8str_P(PSTR(" -----"));
|
||||
|
||||
@@ -959,13 +959,16 @@ void MarlinUI::draw_status_message(const bool blink) {
|
||||
|
||||
// If the remaining string doesn't completely fill the screen
|
||||
if (rlen < lcd_width) {
|
||||
lcd_put_wchar('.'); // Always at 1+ spaces left, draw a dot
|
||||
uint8_t chars = lcd_width - rlen; // Amount of space left in characters
|
||||
if (--chars) { // Draw a second dot if there's space
|
||||
lcd_put_wchar('.');
|
||||
if (--chars) { // Print a second copy of the message
|
||||
lcd_put_u8str_max(status_message, pixel_width - (rlen + 2) * (MENU_FONT_WIDTH));
|
||||
lcd_put_wchar(' '); // Always at 1+ spaces left, draw a space
|
||||
if (--chars) { // Draw a second space if there's room
|
||||
lcd_put_wchar(' ');
|
||||
if (--chars) { // Draw a third space if there's room
|
||||
lcd_put_wchar(' ');
|
||||
if (--chars) { // Print a second copy of the message
|
||||
lcd_put_u8str_max(status_message, pixel_width - (rlen + 2) * (MENU_FONT_WIDTH));
|
||||
lcd_put_wchar(' ');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -642,11 +642,14 @@ void ST7920_Lite_Status_Screen::draw_status_message() {
|
||||
|
||||
// If the remaining string doesn't completely fill the screen
|
||||
if (rlen < TEXT_MODE_LCD_WIDTH) {
|
||||
write_byte('.'); // Always at 1+ spaces left, draw a dot
|
||||
uint8_t chars = TEXT_MODE_LCD_WIDTH - rlen; // Amount of space left in characters
|
||||
if (--chars) { // Draw a second dot if there's space
|
||||
write_byte('.');
|
||||
if (--chars) write_str(str, chars); // Print a second copy of the message
|
||||
uint8_t chars = TEXT_MODE_LCD_WIDTH - rlen; // Amount of space left in characters
|
||||
write_byte(' '); // Always at 1+ spaces left, draw a space
|
||||
if (--chars) { // Draw a second space if there's room
|
||||
write_byte(' ');
|
||||
if (--chars) { // Draw a third space if there's room
|
||||
write_byte(' ');
|
||||
if (--chars) write_str(str, chars); // Print a second copy of the message
|
||||
}
|
||||
}
|
||||
}
|
||||
ui.advance_status_scroll();
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -72,20 +72,23 @@ void MKS_reset_settings() {
|
||||
}
|
||||
|
||||
xyz_pos_t position_before_pause;
|
||||
constexpr feedRate_t park_speed_xy = TERN(NOZZLE_PARK_FEATURE, NOZZLE_PARK_XY_FEEDRATE, 100),
|
||||
park_speed_z = TERN(NOZZLE_PARK_FEATURE, NOZZLE_PARK_Z_FEEDRATE, 5);
|
||||
|
||||
void MKS_pause_print_move() {
|
||||
queue.exhaust();
|
||||
position_before_pause = current_position;
|
||||
destination.z = _MIN(current_position.z + mks_park_pos.z, Z_MAX_POS);
|
||||
prepare_internal_move_to_destination(NOZZLE_PARK_Z_FEEDRATE);
|
||||
prepare_internal_move_to_destination(park_speed_z);
|
||||
destination.set(X_MIN_POS + mks_park_pos.x, Y_MIN_POS + mks_park_pos.y);
|
||||
prepare_internal_move_to_destination(NOZZLE_PARK_XY_FEEDRATE);
|
||||
prepare_internal_move_to_destination(park_speed_xy);
|
||||
}
|
||||
|
||||
void MKS_resume_print_move() {
|
||||
destination.set(position_before_pause.x, position_before_pause.y);
|
||||
prepare_internal_move_to_destination(NOZZLE_PARK_XY_FEEDRATE);
|
||||
prepare_internal_move_to_destination(park_speed_xy);
|
||||
destination.z = position_before_pause.z;
|
||||
prepare_internal_move_to_destination(NOZZLE_PARK_Z_FEEDRATE);
|
||||
prepare_internal_move_to_destination(park_speed_z);
|
||||
}
|
||||
|
||||
float z_offset_add = 0;
|
||||
|
||||
@@ -1271,7 +1271,7 @@ void GcodeSuite::M1002() {
|
||||
#endif
|
||||
|
||||
const uint8_t old_axis_relative = axis_relative;
|
||||
set_e_relative(true); // M83
|
||||
set_e_relative(); // M83
|
||||
{
|
||||
char buf[20];
|
||||
snprintf_P(buf, 20, PSTR("G1E%dF%d"), parser.intval('E'), parser.intval('F'));
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@
|
||||
namespace FTDI {
|
||||
void draw_adjuster_value(CommandProcessor& cmd, int16_t x, int16_t y, int16_t w, int16_t h, float value, progmem_str units, int8_t width, uint8_t precision) {
|
||||
char str[width + precision + 10 + (units ? strlen_P((const char*) units) : 0)];
|
||||
if (ISNAN(value))
|
||||
if (isnan(value))
|
||||
strcpy_P(str, PSTR("-"));
|
||||
else
|
||||
dtostrf(value, width, precision, str);
|
||||
|
||||
@@ -31,7 +31,7 @@ void BedMeshBase::_drawMesh(CommandProcessor &cmd, int16_t x, int16_t y, int16_t
|
||||
constexpr uint8_t cols = GRID_MAX_POINTS_X;
|
||||
|
||||
#define VALUE(X,Y) (func ? func(X,Y,data) : 0)
|
||||
#define ISVAL(X,Y) (func ? !ISNAN(VALUE(X,Y)) : true)
|
||||
#define ISVAL(X,Y) (func ? !isnan(VALUE(X,Y)) : true)
|
||||
#define HEIGHT(X,Y) (ISVAL(X,Y) ? (VALUE(X,Y) - val_min) * scale_z : 0)
|
||||
|
||||
// Compute the mean, min and max for the points
|
||||
|
||||
@@ -79,7 +79,7 @@ void BedMeshEditScreen::onExit() {
|
||||
|
||||
float BedMeshEditScreen::getHighlightedValue() {
|
||||
const float val = ExtUI::getMeshPoint(mydata.highlight);
|
||||
return (ISNAN(val) ? 0 : val) + mydata.zAdjustment;
|
||||
return (isnan(val) ? 0 : val) + mydata.zAdjustment;
|
||||
}
|
||||
|
||||
void BedMeshEditScreen::setHighlightedValue(float value) {
|
||||
|
||||
@@ -119,22 +119,22 @@ void lv_draw_acceleration_settings() {
|
||||
dtostrf(planner.settings.travel_acceleration, 1, 1, public_buf_l);
|
||||
lv_screen_menu_item_1_edit(scr, machine_menu.TravelAcceleration, PARA_UI_POS_X, PARA_UI_POS_Y * 3, event_handler, ID_ACCE_TRAVEL, 2, public_buf_l);
|
||||
|
||||
sprintf_P(public_buf_l, PSTR("%d"), (int)planner.settings.max_acceleration_mm_per_s2[X_AXIS]);
|
||||
itoa(planner.settings.max_acceleration_mm_per_s2[X_AXIS], public_buf_l, 10);
|
||||
lv_screen_menu_item_1_edit(scr, machine_menu.X_Acceleration, PARA_UI_POS_X, PARA_UI_POS_Y * 4, event_handler, ID_ACCE_X, 3, public_buf_l);
|
||||
|
||||
lv_big_button_create(scr, "F:/bmp_back70x40.bin", machine_menu.next, PARA_UI_TURN_PAGE_POS_X, PARA_UI_TURN_PAGE_POS_Y, event_handler, ID_ACCE_DOWN, true);
|
||||
}
|
||||
else {
|
||||
sprintf_P(public_buf_l, PSTR("%d"), (int)planner.settings.max_acceleration_mm_per_s2[Y_AXIS]);
|
||||
itoa(planner.settings.max_acceleration_mm_per_s2[Y_AXIS], public_buf_l, 10);
|
||||
lv_screen_menu_item_1_edit(scr, machine_menu.Y_Acceleration, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_ACCE_Y, 0, public_buf_l);
|
||||
|
||||
sprintf_P(public_buf_l, PSTR("%d"), (int)planner.settings.max_acceleration_mm_per_s2[Z_AXIS]);
|
||||
itoa(planner.settings.max_acceleration_mm_per_s2[Z_AXIS], public_buf_l, 10);
|
||||
lv_screen_menu_item_1_edit(scr, machine_menu.Z_Acceleration, PARA_UI_POS_X, PARA_UI_POS_Y * 2, event_handler, ID_ACCE_Z, 1, public_buf_l);
|
||||
|
||||
sprintf_P(public_buf_l, PSTR("%d"), (int)planner.settings.max_acceleration_mm_per_s2[E_AXIS]);
|
||||
itoa(planner.settings.max_acceleration_mm_per_s2[E_AXIS], public_buf_l, 10);
|
||||
lv_screen_menu_item_1_edit(scr, machine_menu.E0_Acceleration, PARA_UI_POS_X, PARA_UI_POS_Y * 3, event_handler, ID_ACCE_E0, 2, public_buf_l);
|
||||
|
||||
sprintf_P(public_buf_l, PSTR("%d"), (int)planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(1)]);
|
||||
itoa(planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(1)], public_buf_l, 10);
|
||||
lv_screen_menu_item_1_edit(scr, machine_menu.E1_Acceleration, PARA_UI_POS_X, PARA_UI_POS_Y * 4, event_handler, ID_ACCE_E1, 3, public_buf_l);
|
||||
|
||||
lv_big_button_create(scr, "F:/bmp_back70x40.bin", machine_menu.previous, PARA_UI_TURN_PAGE_POS_X, PARA_UI_TURN_PAGE_POS_Y, event_handler, ID_ACCE_UP, true);
|
||||
|
||||
@@ -92,22 +92,22 @@ void lv_draw_filament_settings() {
|
||||
scr = lv_screen_create(FILAMENT_SETTINGS_UI, machine_menu.FilamentConfTitle);
|
||||
|
||||
if (!uiCfg.para_ui_page) {
|
||||
sprintf_P(public_buf_l, PSTR("%d"), gCfgItems.filamentchange_load_length);
|
||||
itoa(gCfgItems.filamentchange_load_length, public_buf_l, 10);
|
||||
lv_screen_menu_item_1_edit(scr, machine_menu.InLength, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_FILAMENT_SET_IN_LENGTH, 0, public_buf_l);
|
||||
|
||||
sprintf_P(public_buf_l, PSTR("%d"), gCfgItems.filamentchange_load_speed);
|
||||
itoa(gCfgItems.filamentchange_load_speed, public_buf_l, 10);
|
||||
lv_screen_menu_item_1_edit(scr, machine_menu.InSpeed, PARA_UI_POS_X, PARA_UI_POS_Y * 2, event_handler, ID_FILAMENT_SET_IN_SPEED, 1, public_buf_l);
|
||||
|
||||
sprintf_P(public_buf_l, PSTR("%d"), gCfgItems.filamentchange_unload_length);
|
||||
itoa(gCfgItems.filamentchange_unload_length, public_buf_l, 10);
|
||||
lv_screen_menu_item_1_edit(scr, machine_menu.OutLength, PARA_UI_POS_X, PARA_UI_POS_Y * 3, event_handler, ID_FILAMENT_SET_OUT_LENGTH, 2, public_buf_l);
|
||||
|
||||
sprintf_P(public_buf_l, PSTR("%d"), gCfgItems.filamentchange_unload_speed);
|
||||
itoa(gCfgItems.filamentchange_unload_speed, public_buf_l, 10);
|
||||
lv_screen_menu_item_1_edit(scr, machine_menu.OutSpeed, PARA_UI_POS_X, PARA_UI_POS_Y * 4, event_handler, ID_FILAMENT_SET_OUT_SPEED, 3, public_buf_l);
|
||||
|
||||
lv_big_button_create(scr, "F:/bmp_back70x40.bin", machine_menu.next, PARA_UI_TURN_PAGE_POS_X, PARA_UI_TURN_PAGE_POS_Y, event_handler, ID_FILAMENT_SET_DOWN, true);
|
||||
}
|
||||
else {
|
||||
sprintf_P(public_buf_l, PSTR("%d"), gCfgItems.filament_limit_temp);
|
||||
itoa(gCfgItems.filament_limit_temp, public_buf_l, 10);
|
||||
lv_screen_menu_item_1_edit(scr, machine_menu.FilamentTemperature, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_FILAMENT_SET_TEMP, 0, public_buf_l);
|
||||
|
||||
lv_big_button_create(scr, "F:/bmp_back70x40.bin", machine_menu.previous, PARA_UI_TURN_PAGE_POS_X, PARA_UI_TURN_PAGE_POS_Y, event_handler, ID_FILAMENT_SET_UP, true);
|
||||
|
||||
@@ -77,17 +77,17 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
|
||||
void lv_draw_homing_sensitivity_settings() {
|
||||
scr = lv_screen_create(HOMING_SENSITIVITY_UI, machine_menu.HomingSensitivityConfTitle);
|
||||
|
||||
sprintf_P(public_buf_l, PSTR("%d"), TERN(X_SENSORLESS, stepperX.homing_threshold(), 0));
|
||||
itoa(TERN(X_SENSORLESS, stepperX.homing_threshold(), 0), public_buf_l, 10);
|
||||
lv_screen_menu_item_1_edit(scr, machine_menu.X_Sensitivity, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_SENSITIVITY_X, 0, public_buf_l);
|
||||
|
||||
sprintf_P(public_buf_l, PSTR("%d"), TERN(Y_SENSORLESS, stepperY.homing_threshold(), 0));
|
||||
itoa(TERN(Y_SENSORLESS, stepperY.homing_threshold(), 0), public_buf_l, 10);
|
||||
lv_screen_menu_item_1_edit(scr, machine_menu.Y_Sensitivity, PARA_UI_POS_X, PARA_UI_POS_Y * 2, event_handler, ID_SENSITIVITY_Y, 1, public_buf_l);
|
||||
|
||||
sprintf_P(public_buf_l, PSTR("%d"), TERN(Z_SENSORLESS, stepperZ.homing_threshold(), 0));
|
||||
itoa(TERN(Z_SENSORLESS, stepperZ.homing_threshold(), 0), public_buf_l, 10);
|
||||
lv_screen_menu_item_1_edit(scr, machine_menu.Z_Sensitivity, PARA_UI_POS_X, PARA_UI_POS_Y * 3, event_handler, ID_SENSITIVITY_Z, 2, public_buf_l);
|
||||
|
||||
#if Z2_SENSORLESS
|
||||
sprintf_P(public_buf_l, PSTR("%d"), TERN(Z2_SENSORLESS, stepperZ2.homing_threshold(), 0));
|
||||
itoa(TERN(Z2_SENSORLESS, stepperZ2.homing_threshold(), 0), public_buf_l, 10);
|
||||
lv_screen_menu_item_1_edit(scr, machine_menu.Z2_Sensitivity, PARA_UI_POS_X, PARA_UI_POS_Y * 4, event_handler, ID_SENSITIVITY_Z2, 3, public_buf_l);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -216,7 +216,7 @@ void lv_draw_ready_print() {
|
||||
|
||||
labelFan = lv_label_create(scr, 380, 80, nullptr);
|
||||
|
||||
sprintf_P(buf, PSTR("%d"), (int)thermalManager.degHotend(0));
|
||||
itoa(thermalManager.degHotend(0), buf, 10);
|
||||
lv_label_set_text(labelExt1, buf);
|
||||
lv_obj_align(labelExt1, buttonExt1, LV_ALIGN_CENTER, 0, LABEL_MOD_Y);
|
||||
sprintf_P(buf, PSTR("-> %d"), (int)thermalManager.degTargetHotend(0));
|
||||
@@ -224,7 +224,7 @@ void lv_draw_ready_print() {
|
||||
lv_obj_align(labelExt1Target, buttonExt1, LV_ALIGN_CENTER, 0, TARGET_LABEL_MOD_Y);
|
||||
|
||||
#if HAS_MULTI_EXTRUDER
|
||||
sprintf_P(buf, PSTR("%d"), (int)thermalManager.degHotend(1));
|
||||
itoa(thermalManager.degHotend(1), buf, 10);
|
||||
lv_label_set_text(labelExt2, buf);
|
||||
lv_obj_align(labelExt2, buttonExt2, LV_ALIGN_CENTER, 0, LABEL_MOD_Y);
|
||||
sprintf_P(buf, PSTR("-> %d"), (int)thermalManager.degTargetHotend(1));
|
||||
@@ -233,7 +233,7 @@ void lv_draw_ready_print() {
|
||||
#endif
|
||||
|
||||
#if HAS_HEATED_BED
|
||||
sprintf_P(buf, PSTR("%d"), (int)thermalManager.degBed());
|
||||
itoa(thermalManager.degBed(), buf, 10);
|
||||
lv_label_set_text(labelBed, buf);
|
||||
lv_obj_align(labelBed, buttonBedstate, LV_ALIGN_CENTER, 0, LABEL_MOD_Y);
|
||||
sprintf_P(buf, PSTR("-> %d"), (int)thermalManager.degTargetBed());
|
||||
|
||||
@@ -107,27 +107,27 @@ void lv_draw_tramming_pos_settings() {
|
||||
scr = lv_screen_create(MANUAL_LEVELING_POSIGION_UI, machine_menu.LevelingParaConfTitle);
|
||||
|
||||
if (!uiCfg.para_ui_page) {
|
||||
sprintf_P(public_buf_l, PSTR("%d"), gCfgItems.trammingPos[0].x);
|
||||
sprintf_P(buf2, PSTR("%d"), gCfgItems.trammingPos[0].y);
|
||||
itoa(gCfgItems.trammingPos[0].x, public_buf_l, 10);
|
||||
itoa(gCfgItems.trammingPos[0].y, buf2, 10);
|
||||
lv_screen_menu_item_2_edit(scr, leveling_menu.position1, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_MANUAL_POS_Y1, 0, buf2, ID_MANUAL_POS_X1, public_buf_l);
|
||||
|
||||
sprintf_P(public_buf_l, PSTR("%d"), gCfgItems.trammingPos[1].x);
|
||||
sprintf_P(buf2, PSTR("%d"), gCfgItems.trammingPos[1].y);
|
||||
itoa(gCfgItems.trammingPos[1].x, public_buf_l, 10);
|
||||
itoa(gCfgItems.trammingPos[1].y, buf2, 10);
|
||||
lv_screen_menu_item_2_edit(scr, leveling_menu.position2, PARA_UI_POS_X, PARA_UI_POS_Y * 2, event_handler, ID_MANUAL_POS_Y2, 1, buf2, ID_MANUAL_POS_X2, public_buf_l);
|
||||
|
||||
sprintf_P(public_buf_l, PSTR("%d"), gCfgItems.trammingPos[2].x);
|
||||
sprintf_P(buf2, PSTR("%d"), gCfgItems.trammingPos[2].y);
|
||||
itoa(gCfgItems.trammingPos[2].x, public_buf_l, 10);
|
||||
itoa(gCfgItems.trammingPos[2].y, buf2, 10);
|
||||
lv_screen_menu_item_2_edit(scr, leveling_menu.position3, PARA_UI_POS_X, PARA_UI_POS_Y * 3, event_handler, ID_MANUAL_POS_Y3, 2, buf2, ID_MANUAL_POS_X3, public_buf_l);
|
||||
|
||||
sprintf_P(public_buf_l, PSTR("%d"), gCfgItems.trammingPos[3].x);
|
||||
sprintf_P(buf2, PSTR("%d"), gCfgItems.trammingPos[3].y);
|
||||
itoa(gCfgItems.trammingPos[3].x, public_buf_l, 10);
|
||||
itoa(gCfgItems.trammingPos[3].y, buf2, 10);
|
||||
lv_screen_menu_item_2_edit(scr, leveling_menu.position4, PARA_UI_POS_X, PARA_UI_POS_Y * 4, event_handler, ID_MANUAL_POS_Y4, 3, buf2, ID_MANUAL_POS_X4, public_buf_l);
|
||||
|
||||
lv_big_button_create(scr, "F:/bmp_back70x40.bin", machine_menu.next, PARA_UI_TURN_PAGE_POS_X, PARA_UI_TURN_PAGE_POS_Y, event_handler, ID_MANUAL_POS_DOWN, true);
|
||||
}
|
||||
else {
|
||||
sprintf_P(public_buf_l, PSTR("%d"), gCfgItems.trammingPos[4].x);
|
||||
sprintf_P(buf2, PSTR("%d"), gCfgItems.trammingPos[4].y);
|
||||
itoa(gCfgItems.trammingPos[4].x, public_buf_l, 10);
|
||||
itoa(gCfgItems.trammingPos[4].y, buf2, 10);
|
||||
lv_screen_menu_item_2_edit(scr, leveling_menu.position4, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_MANUAL_POS_Y5, 0, buf2, ID_MANUAL_POS_X5, public_buf_l);
|
||||
|
||||
lv_big_button_create(scr, "F:/bmp_back70x40.bin", machine_menu.previous, PARA_UI_TURN_PAGE_POS_X, PARA_UI_TURN_PAGE_POS_Y, event_handler, ID_MANUAL_POS_UP, true);
|
||||
|
||||
@@ -421,7 +421,7 @@ namespace ExtUI {
|
||||
#if AXIS_IS_TMC(Z2)
|
||||
case Z2: return stepperZ2.getMilliamps();
|
||||
#endif
|
||||
default: return MFNAN;
|
||||
default: return NAN;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -451,7 +451,7 @@ namespace ExtUI {
|
||||
#if AXIS_IS_TMC(E7)
|
||||
case E7: return stepperE7.getMilliamps();
|
||||
#endif
|
||||
default: return MFNAN;
|
||||
default: return NAN;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -102,7 +102,7 @@ static int8_t bed_corner;
|
||||
/**
|
||||
* Select next corner coordinates
|
||||
*/
|
||||
static inline void _lcd_level_bed_corners_get_next_position() {
|
||||
static void _lcd_level_bed_corners_get_next_position() {
|
||||
|
||||
if (level_corners_3_points) {
|
||||
if (bed_corner >= available_points) bed_corner = 0; // Above max position -> move back to first corner
|
||||
@@ -268,7 +268,7 @@ static inline void _lcd_level_bed_corners_get_next_position() {
|
||||
ui.goto_screen(_lcd_draw_probing);
|
||||
do {
|
||||
ui.refresh(LCDVIEW_REDRAW_NOW);
|
||||
_lcd_draw_probing(); // update screen with # of good points
|
||||
_lcd_draw_probing(); // update screen with # of good points
|
||||
do_blocking_move_to_z(SUM_TERN(BLTOUCH_HS_MODE, current_position.z + LEVEL_CORNERS_Z_HOP, 7)); // clearance
|
||||
|
||||
_lcd_level_bed_corners_get_next_position(); // Select next corner coordinates
|
||||
@@ -308,7 +308,7 @@ static inline void _lcd_level_bed_corners_get_next_position() {
|
||||
|
||||
#else // !LEVEL_CORNERS_USE_PROBE
|
||||
|
||||
static inline void _lcd_goto_next_corner() {
|
||||
static void _lcd_goto_next_corner() {
|
||||
line_to_z(LEVEL_CORNERS_Z_HOP);
|
||||
|
||||
// Select next corner coordinates
|
||||
@@ -321,7 +321,7 @@ static inline void _lcd_level_bed_corners_get_next_position() {
|
||||
|
||||
#endif // !LEVEL_CORNERS_USE_PROBE
|
||||
|
||||
static inline void _lcd_level_bed_corners_homing() {
|
||||
static void _lcd_level_bed_corners_homing() {
|
||||
_lcd_draw_homing();
|
||||
if (!all_axes_homed()) return;
|
||||
#if ENABLED(LEVEL_CORNERS_USE_PROBE)
|
||||
|
||||
@@ -130,6 +130,7 @@ void menu_advanced_settings();
|
||||
#if ENABLED(TOOLCHANGE_MIGRATION_FEATURE)
|
||||
|
||||
#include "../../module/motion.h" // for active_extruder
|
||||
#include "../../gcode/queue.h"
|
||||
|
||||
void menu_toolchange_migration() {
|
||||
PGM_P const msg_migrate = GET_TEXT(MSG_TOOL_MIGRATION_SWAP);
|
||||
|
||||
@@ -105,8 +105,8 @@ void menu_configuration();
|
||||
|
||||
void _lcd_custom_menu_main_gcode(PGM_P const cmd) {
|
||||
queue.inject_P(cmd);
|
||||
TERN_(MAIN_MENU_ITEM_SCRIPT_AUDIBLE_FEEDBACK, ui.completion_feedback());
|
||||
TERN_(MAIN_MENU_ITEM_SCRIPT_RETURN, ui.return_to_status());
|
||||
TERN_(CUSTOM_MENU_MAIN_SCRIPT_AUDIBLE_FEEDBACK, ui.completion_feedback());
|
||||
TERN_(CUSTOM_MENU_MAIN_SCRIPT_RETURN, ui.return_to_status());
|
||||
}
|
||||
|
||||
void custom_menus_main() {
|
||||
|
||||
@@ -54,7 +54,7 @@ static bool probe_single_point() {
|
||||
z_measured[tram_index] = z_probed_height;
|
||||
move_to_tramming_wait_pos();
|
||||
|
||||
return !ISNAN(z_probed_height);
|
||||
return !isnan(z_probed_height);
|
||||
}
|
||||
|
||||
static void _menu_single_probe(const uint8_t point) {
|
||||
|
||||
@@ -505,7 +505,7 @@ void MenuItem_confirm::draw_select_screen(PGM_P const yes, PGM_P const no, const
|
||||
tft.set_background(COLOR_BACKGROUND);
|
||||
tft_string.set(Z_LBL);
|
||||
tft.add_text(0, MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string);
|
||||
tft_string.set(ISNAN(ubl.z_values[x_plot][y_plot]) ? "-----" : ftostr43sign(ubl.z_values[x_plot][y_plot]));
|
||||
tft_string.set(isnan(ubl.z_values[x_plot][y_plot]) ? "-----" : ftostr43sign(ubl.z_values[x_plot][y_plot]));
|
||||
tft_string.trim();
|
||||
tft.add_text(120 - tft_string.width(), MENU_TEXT_Y_OFFSET, COLOR_MENU_VALUE, tft_string);
|
||||
|
||||
|
||||
@@ -492,7 +492,7 @@ void MenuItem_confirm::draw_select_screen(PGM_P const yes, PGM_P const no, const
|
||||
tft.set_background(COLOR_BACKGROUND);
|
||||
tft_string.set(Z_LBL);
|
||||
tft.add_text(0, MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string);
|
||||
tft_string.set(ISNAN(ubl.z_values[x_plot][y_plot]) ? "-----" : ftostr43sign(ubl.z_values[x_plot][y_plot]));
|
||||
tft_string.set(isnan(ubl.z_values[x_plot][y_plot]) ? "-----" : ftostr43sign(ubl.z_values[x_plot][y_plot]));
|
||||
tft_string.trim();
|
||||
tft.add_text(96 - tft_string.width(), MENU_TEXT_Y_OFFSET, COLOR_MENU_VALUE, tft_string);
|
||||
|
||||
|
||||
@@ -492,7 +492,7 @@ void MenuItem_confirm::draw_select_screen(PGM_P const yes, PGM_P const no, const
|
||||
tft.set_background(COLOR_BACKGROUND);
|
||||
tft_string.set(Z_LBL);
|
||||
tft.add_text(0, MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string);
|
||||
tft_string.set(ISNAN(ubl.z_values[x_plot][y_plot]) ? "-----" : ftostr43sign(ubl.z_values[x_plot][y_plot]));
|
||||
tft_string.set(isnan(ubl.z_values[x_plot][y_plot]) ? "-----" : ftostr43sign(ubl.z_values[x_plot][y_plot]));
|
||||
tft_string.trim();
|
||||
tft.add_text(120 - tft_string.width(), MENU_TEXT_Y_OFFSET, COLOR_MENU_VALUE, tft_string);
|
||||
|
||||
|
||||
@@ -230,6 +230,50 @@ void report_current_position_projected() {
|
||||
stepper.report_a_position(planner.position);
|
||||
}
|
||||
|
||||
#if EITHER(FULL_REPORT_TO_HOST_FEATURE, REALTIME_REPORTING_COMMANDS)
|
||||
|
||||
M_StateEnum M_State_grbl = M_INIT;
|
||||
|
||||
/**
|
||||
* Output the current grbl compatible state to serial while moving
|
||||
*/
|
||||
void report_current_grblstate_moving() { SERIAL_ECHOLNPAIR("S_XYZ:", int(M_State_grbl)); }
|
||||
|
||||
/**
|
||||
* Output the current position (processed) to serial while moving
|
||||
*/
|
||||
void report_current_position_moving() {
|
||||
|
||||
get_cartesian_from_steppers();
|
||||
const xyz_pos_t lpos = cartes.asLogical();
|
||||
SERIAL_ECHOPAIR("X:", lpos.x, " Y:", lpos.y, " Z:", lpos.z, " E:", current_position.e);
|
||||
|
||||
stepper.report_positions();
|
||||
#if IS_SCARA
|
||||
scara_report_positions();
|
||||
#endif
|
||||
|
||||
report_current_grblstate_moving();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a Grbl-compatible state from the current marlin_state
|
||||
*/
|
||||
M_StateEnum grbl_state_for_marlin_state() {
|
||||
switch (marlin_state) {
|
||||
case MF_INITIALIZING: return M_INIT;
|
||||
case MF_SD_COMPLETE: return M_ALARM;
|
||||
case MF_WAITING: return M_IDLE;
|
||||
case MF_STOPPED: return M_END;
|
||||
case MF_RUNNING: return M_RUNNING;
|
||||
case MF_PAUSED: return M_HOLD;
|
||||
case MF_KILLED: return M_ERROR;
|
||||
default: return M_IDLE;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Run out the planner buffer and re-sync the current
|
||||
* position from the last-updated stepper positions.
|
||||
@@ -241,6 +285,20 @@ void quickstop_stepper() {
|
||||
sync_plan_position();
|
||||
}
|
||||
|
||||
#if ENABLED(REALTIME_REPORTING_COMMANDS)
|
||||
|
||||
void quickpause_stepper() {
|
||||
planner.quick_pause();
|
||||
//planner.synchronize();
|
||||
}
|
||||
|
||||
void quickresume_stepper() {
|
||||
planner.quick_resume();
|
||||
//planner.synchronize();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Set the planner/stepper positions directly from current_position with
|
||||
* no kinematic translation. Used for homing axes and cartesian/core syncing.
|
||||
|
||||
@@ -211,14 +211,49 @@ void report_real_position();
|
||||
void report_current_position();
|
||||
void report_current_position_projected();
|
||||
|
||||
#if EITHER(FULL_REPORT_TO_HOST_FEATURE, REALTIME_REPORTING_COMMANDS)
|
||||
#define HAS_GRBL_STATE 1
|
||||
/**
|
||||
* Machine states for GRBL or TinyG
|
||||
*/
|
||||
enum M_StateEnum : uint8_t {
|
||||
M_INIT = 0, // 0 machine is initializing
|
||||
M_RESET, // 1 machine is ready for use
|
||||
M_ALARM, // 2 machine is in alarm state (soft shut down)
|
||||
M_IDLE, // 3 program stop or no more blocks (M0, M1, M60)
|
||||
M_END, // 4 program end via M2, M30
|
||||
M_RUNNING, // 5 motion is running
|
||||
M_HOLD, // 6 motion is holding
|
||||
M_PROBE, // 7 probe cycle active
|
||||
M_CYCLING, // 8 machine is running (cycling)
|
||||
M_HOMING, // 9 machine is homing
|
||||
M_JOGGING, // 10 machine is jogging
|
||||
M_ERROR // 11 machine is in hard alarm state (shut down)
|
||||
};
|
||||
extern M_StateEnum M_State_grbl;
|
||||
M_StateEnum grbl_state_for_marlin_state();
|
||||
void report_current_grblstate_moving();
|
||||
void report_current_position_moving();
|
||||
|
||||
#if ENABLED(FULL_REPORT_TO_HOST_FEATURE)
|
||||
inline void set_and_report_grblstate(const M_StateEnum state) {
|
||||
M_State_grbl = state;
|
||||
report_current_grblstate_moving();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if ENABLED(REALTIME_REPORTING_COMMANDS)
|
||||
void quickpause_stepper();
|
||||
void quickresume_stepper();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void get_cartesian_from_steppers();
|
||||
void set_current_from_steppers_for_axis(const AxisEnum axis);
|
||||
|
||||
void quickstop_stepper();
|
||||
|
||||
/**
|
||||
* sync_plan_position
|
||||
*
|
||||
* Set the planner/stepper positions directly from current_position with
|
||||
* no kinematic translation. Used for homing axes and cartesian/core syncing.
|
||||
*/
|
||||
|
||||
@@ -207,7 +207,7 @@ skew_factor_t Planner::skew_factor; // Initialized by settings.load()
|
||||
|
||||
xyze_long_t Planner::position{0};
|
||||
|
||||
uint32_t Planner::cutoff_long;
|
||||
uint32_t Planner::acceleration_long_cutoff;
|
||||
|
||||
xyze_float_t Planner::previous_speed;
|
||||
float Planner::previous_nominal_speed_sqr;
|
||||
@@ -1650,6 +1650,24 @@ void Planner::quick_stop() {
|
||||
stepper.quick_stop();
|
||||
}
|
||||
|
||||
#if ENABLED(REALTIME_REPORTING_COMMANDS)
|
||||
|
||||
void Planner::quick_pause() {
|
||||
// Suspend until quick_resume is called
|
||||
// Don't empty buffers or queues
|
||||
const bool did_suspend = stepper.suspend();
|
||||
if (did_suspend)
|
||||
TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_HOLD));
|
||||
}
|
||||
|
||||
// Resume if suspended
|
||||
void Planner::quick_resume() {
|
||||
TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(grbl_state_for_marlin_state()));
|
||||
stepper.wake_up();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void Planner::endstop_triggered(const AxisEnum axis) {
|
||||
// Record stepper position and discard the current block
|
||||
stepper.endstop_triggered(axis);
|
||||
@@ -2271,23 +2289,22 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
|
||||
// Compute and limit the acceleration rate for the trapezoid generator.
|
||||
const float steps_per_mm = block->step_event_count * inverse_millimeters;
|
||||
uint32_t accel;
|
||||
if (!block->steps.a && !block->steps.b && !block->steps.c) {
|
||||
// convert to: acceleration steps/sec^2
|
||||
accel = CEIL(settings.retract_acceleration * steps_per_mm);
|
||||
TERN_(LIN_ADVANCE, block->use_advance_lead = false);
|
||||
if (!block->steps.a && !block->steps.b && !block->steps.c) { // Is this a retract / recover move?
|
||||
accel = CEIL(settings.retract_acceleration * steps_per_mm); // Convert to: acceleration steps/sec^2
|
||||
TERN_(LIN_ADVANCE, block->use_advance_lead = false); // No linear advance for simple retract/recover
|
||||
}
|
||||
else {
|
||||
#define LIMIT_ACCEL_LONG(AXIS,INDX) do{ \
|
||||
if (block->steps[AXIS] && max_acceleration_steps_per_s2[AXIS+INDX] < accel) { \
|
||||
const uint32_t comp = max_acceleration_steps_per_s2[AXIS+INDX] * block->step_event_count; \
|
||||
if (accel * block->steps[AXIS] > comp) accel = comp / block->steps[AXIS]; \
|
||||
const uint32_t max_possible = max_acceleration_steps_per_s2[AXIS+INDX] * block->step_event_count / block->steps[AXIS]; \
|
||||
NOMORE(accel, max_possible); \
|
||||
} \
|
||||
}while(0)
|
||||
|
||||
#define LIMIT_ACCEL_FLOAT(AXIS,INDX) do{ \
|
||||
if (block->steps[AXIS] && max_acceleration_steps_per_s2[AXIS+INDX] < accel) { \
|
||||
const float comp = (float)max_acceleration_steps_per_s2[AXIS+INDX] * (float)block->step_event_count; \
|
||||
if ((float)accel * (float)block->steps[AXIS] > comp) accel = comp / (float)block->steps[AXIS]; \
|
||||
const float max_possible = float(max_acceleration_steps_per_s2[AXIS+INDX]) * float(block->step_event_count) / float(block->steps[AXIS]); \
|
||||
NOMORE(accel, max_possible); \
|
||||
} \
|
||||
}while(0)
|
||||
|
||||
@@ -2336,7 +2353,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
|
||||
#endif
|
||||
|
||||
// Limit acceleration per axis
|
||||
if (block->step_event_count <= cutoff_long) {
|
||||
if (block->step_event_count <= acceleration_long_cutoff) {
|
||||
LIMIT_ACCEL_LONG(A_AXIS, 0);
|
||||
LIMIT_ACCEL_LONG(B_AXIS, 0);
|
||||
LIMIT_ACCEL_LONG(C_AXIS, 0);
|
||||
@@ -2352,7 +2369,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
|
||||
block->acceleration_steps_per_s2 = accel;
|
||||
block->acceleration = accel / steps_per_mm;
|
||||
#if DISABLED(S_CURVE_ACCELERATION)
|
||||
block->acceleration_rate = (uint32_t)(accel * (4096.0f * 4096.0f / (STEPPER_TIMER_RATE)));
|
||||
block->acceleration_rate = (uint32_t)(accel * (sq(4096.0f) / (STEPPER_TIMER_RATE)));
|
||||
#endif
|
||||
#if ENABLED(LIN_ADVANCE)
|
||||
if (block->use_advance_lead) {
|
||||
@@ -3020,7 +3037,7 @@ void Planner::reset_acceleration_rates() {
|
||||
max_acceleration_steps_per_s2[i] = settings.max_acceleration_mm_per_s2[i] * settings.axis_steps_per_mm[i];
|
||||
if (AXIS_CONDITION) NOLESS(highest_rate, max_acceleration_steps_per_s2[i]);
|
||||
}
|
||||
cutoff_long = 4294967295UL / highest_rate; // 0xFFFFFFFFUL
|
||||
acceleration_long_cutoff = 4294967295UL / highest_rate; // 0xFFFFFFFFUL
|
||||
TERN_(HAS_LINEAR_E_JERK, recalculate_max_e_jerk());
|
||||
}
|
||||
|
||||
|
||||
@@ -443,7 +443,7 @@ class Planner {
|
||||
/**
|
||||
* Limit where 64bit math is necessary for acceleration calculation
|
||||
*/
|
||||
static uint32_t cutoff_long;
|
||||
static uint32_t acceleration_long_cutoff;
|
||||
|
||||
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
|
||||
static float last_fade_z;
|
||||
@@ -873,6 +873,13 @@ class Planner {
|
||||
// a Full Shutdown is required, or when endstops are hit)
|
||||
static void quick_stop();
|
||||
|
||||
#if ENABLED(REALTIME_REPORTING_COMMANDS)
|
||||
// Force a quick pause of the machine (e.g., when a pause is required in the middle of move).
|
||||
// NOTE: Hard-stops will lose steps so encoders are highly recommended if using these!
|
||||
static void quick_pause();
|
||||
static void quick_resume();
|
||||
#endif
|
||||
|
||||
// Called when an endstop is triggered. Causes the machine to stop inmediately
|
||||
static void endstop_triggered(const AxisEnum axis);
|
||||
|
||||
|
||||
+10
-10
@@ -583,7 +583,7 @@ bool Probe::probe_down_to_z(const_float_t z, const_feedRate_t fr_mm_s) {
|
||||
* @details Used by probe_at_point to get the bed Z height at the current XY.
|
||||
* Leaves current_position.z at the height where the probe triggered.
|
||||
*
|
||||
* @return The Z position of the bed at the current XY or MFNAN on error.
|
||||
* @return The Z position of the bed at the current XY or NAN on error.
|
||||
*/
|
||||
float Probe::run_z_probe(const bool sanity_check/*=true*/) {
|
||||
DEBUG_SECTION(log_probe, "Probe::run_z_probe", DEBUGGING(LEVELING));
|
||||
@@ -617,11 +617,11 @@ float Probe::run_z_probe(const bool sanity_check/*=true*/) {
|
||||
#if TOTAL_PROBING == 2
|
||||
|
||||
// Attempt to tare the probe
|
||||
if (TERN0(PROBE_TARE, tare())) return MFNAN;
|
||||
if (TERN0(PROBE_TARE, tare())) return NAN;
|
||||
|
||||
// Do a first probe at the fast speed
|
||||
if (try_to_probe(PSTR("FAST"), z_probe_low_point, z_probe_fast_mm_s,
|
||||
sanity_check, Z_CLEARANCE_BETWEEN_PROBES) ) return MFNAN;
|
||||
sanity_check, Z_CLEARANCE_BETWEEN_PROBES) ) return NAN;
|
||||
|
||||
const float first_probe_z = current_position.z;
|
||||
|
||||
@@ -662,7 +662,7 @@ float Probe::run_z_probe(const bool sanity_check/*=true*/) {
|
||||
|
||||
// Probe downward slowly to find the bed
|
||||
if (try_to_probe(PSTR("SLOW"), z_probe_low_point, MMM_TO_MMS(Z_PROBE_FEEDRATE_SLOW),
|
||||
sanity_check, Z_CLEARANCE_MULTI_PROBE) ) return MFNAN;
|
||||
sanity_check, Z_CLEARANCE_MULTI_PROBE) ) return NAN;
|
||||
|
||||
TERN_(MEASURE_BACKLASH_WHEN_PROBING, backlash.measure_with_probe());
|
||||
|
||||
@@ -765,29 +765,29 @@ float Probe::probe_at_point(const_float_t rx, const_float_t ry, const ProbePtRai
|
||||
if (probe_relative) { // The given position is in terms of the probe
|
||||
if (!can_reach(npos)) {
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Position Not Reachable");
|
||||
return MFNAN;
|
||||
return NAN;
|
||||
}
|
||||
npos -= offset_xy; // Get the nozzle position
|
||||
}
|
||||
else if (!position_is_reachable(npos)) return MFNAN; // The given position is in terms of the nozzle
|
||||
else if (!position_is_reachable(npos)) return NAN; // The given position is in terms of the nozzle
|
||||
|
||||
// Move the probe to the starting XYZ
|
||||
do_blocking_move_to(npos, feedRate_t(XY_PROBE_FEEDRATE_MM_S));
|
||||
|
||||
float measured_z = MFNAN;
|
||||
float measured_z = NAN;
|
||||
if (!deploy()) measured_z = run_z_probe(sanity_check) + offset.z;
|
||||
if (!ISNAN(measured_z)) {
|
||||
if (!isnan(measured_z)) {
|
||||
const bool big_raise = raise_after == PROBE_PT_BIG_RAISE;
|
||||
if (big_raise || raise_after == PROBE_PT_RAISE)
|
||||
do_blocking_move_to_z(current_position.z + (big_raise ? 25 : Z_CLEARANCE_BETWEEN_PROBES), z_probe_fast_mm_s);
|
||||
else if (raise_after == PROBE_PT_STOW)
|
||||
if (stow()) measured_z = MFNAN; // Error on stow?
|
||||
if (stow()) measured_z = NAN; // Error on stow?
|
||||
|
||||
if (verbose_level > 2)
|
||||
SERIAL_ECHOLNPAIR("Bed X: ", LOGICAL_X_POSITION(rx), " Y: ", LOGICAL_Y_POSITION(ry), " Z: ", measured_z);
|
||||
}
|
||||
|
||||
if (ISNAN(measured_z)) {
|
||||
if (isnan(measured_z)) {
|
||||
stow();
|
||||
LCD_MESSAGEPGM(MSG_LCD_PROBING_FAILED);
|
||||
#if DISABLED(G29_RETRY_AND_RECOVER)
|
||||
|
||||
@@ -204,7 +204,7 @@ float segments_per_second = TERN(AXEL_TPARA, TPARA_SEGMENTS_PER_SECOND, SCARA_SE
|
||||
y = r * sin(RADIANS(a)),
|
||||
rho2 = L1_2 + L2_2 - 2.0f * L1 * L2 * cos(RADIANS(w));
|
||||
|
||||
cartes = robot_offset + xyz_pos_t({ x, y, SQRT(rho2 - x * x - y * y) });
|
||||
cartes = robot_offset + xyz_pos_t({ x, y, SQRT(rho2 - sq(x) - sq(y)) });
|
||||
}
|
||||
|
||||
// Home YZ together, then X (or all at once). Based on quick_home_xy & home_delta
|
||||
|
||||
@@ -900,8 +900,8 @@ void MarlinSettings::postprocess() {
|
||||
HOTEND_LOOP() {
|
||||
PIDCF_t pidcf = {
|
||||
#if DISABLED(PIDTEMP)
|
||||
MFNAN, MFNAN, MFNAN,
|
||||
MFNAN, MFNAN
|
||||
NAN, NAN, NAN,
|
||||
NAN, NAN
|
||||
#else
|
||||
PID_PARAM(Kp, e),
|
||||
unscalePID_i(PID_PARAM(Ki, e)),
|
||||
@@ -928,7 +928,7 @@ void MarlinSettings::postprocess() {
|
||||
|
||||
const PID_t bed_pid = {
|
||||
#if DISABLED(PIDTEMPBED)
|
||||
MFNAN, MFNAN, MFNAN
|
||||
NAN, NAN, NAN
|
||||
#else
|
||||
// Store the unscaled PID values
|
||||
thermalManager.temp_bed.pid.Kp,
|
||||
@@ -947,7 +947,7 @@ void MarlinSettings::postprocess() {
|
||||
|
||||
const PID_t chamber_pid = {
|
||||
#if DISABLED(PIDTEMPCHAMBER)
|
||||
MFNAN, MFNAN, MFNAN
|
||||
NAN, NAN, NAN
|
||||
#else
|
||||
// Store the unscaled PID values
|
||||
thermalManager.temp_chamber.pid.Kp,
|
||||
@@ -1786,7 +1786,7 @@ void MarlinSettings::postprocess() {
|
||||
PIDCF_t pidcf;
|
||||
EEPROM_READ(pidcf);
|
||||
#if ENABLED(PIDTEMP)
|
||||
if (!validating && !ISNAN(pidcf.Kp)) {
|
||||
if (!validating && !isnan(pidcf.Kp)) {
|
||||
// Scale PID values since EEPROM values are unscaled
|
||||
PID_PARAM(Kp, e) = pidcf.Kp;
|
||||
PID_PARAM(Ki, e) = scalePID_i(pidcf.Ki);
|
||||
@@ -1818,7 +1818,7 @@ void MarlinSettings::postprocess() {
|
||||
PID_t pid;
|
||||
EEPROM_READ(pid);
|
||||
#if ENABLED(PIDTEMPBED)
|
||||
if (!validating && !ISNAN(pid.Kp)) {
|
||||
if (!validating && !isnan(pid.Kp)) {
|
||||
// Scale PID values since EEPROM values are unscaled
|
||||
thermalManager.temp_bed.pid.Kp = pid.Kp;
|
||||
thermalManager.temp_bed.pid.Ki = scalePID_i(pid.Ki);
|
||||
@@ -1834,7 +1834,7 @@ void MarlinSettings::postprocess() {
|
||||
PID_t pid;
|
||||
EEPROM_READ(pid);
|
||||
#if ENABLED(PIDTEMPCHAMBER)
|
||||
if (!validating && !ISNAN(pid.Kp)) {
|
||||
if (!validating && !isnan(pid.Kp)) {
|
||||
// Scale PID values since EEPROM values are unscaled
|
||||
thermalManager.temp_chamber.pid.Kp = pid.Kp;
|
||||
thermalManager.temp_chamber.pid.Ki = scalePID_i(pid.Ki);
|
||||
|
||||
@@ -74,9 +74,9 @@ hotend_pid_t;
|
||||
#endif
|
||||
|
||||
#define PID_PARAM(F,H) _PID_##F(TERN(PID_PARAMS_PER_HOTEND, H, 0 & H)) // Always use 'H' to suppress warning
|
||||
#define _PID_Kp(H) TERN(PIDTEMP, Temperature::temp_hotend[H].pid.Kp, MFNAN)
|
||||
#define _PID_Ki(H) TERN(PIDTEMP, Temperature::temp_hotend[H].pid.Ki, MFNAN)
|
||||
#define _PID_Kd(H) TERN(PIDTEMP, Temperature::temp_hotend[H].pid.Kd, MFNAN)
|
||||
#define _PID_Kp(H) TERN(PIDTEMP, Temperature::temp_hotend[H].pid.Kp, NAN)
|
||||
#define _PID_Ki(H) TERN(PIDTEMP, Temperature::temp_hotend[H].pid.Ki, NAN)
|
||||
#define _PID_Kd(H) TERN(PIDTEMP, Temperature::temp_hotend[H].pid.Kd, NAN)
|
||||
#if ENABLED(PIDTEMP)
|
||||
#define _PID_Kc(H) TERN(PID_EXTRUSION_SCALING, Temperature::temp_hotend[H].pid.Kc, 1)
|
||||
#define _PID_Kf(H) TERN(PID_FAN_SCALING, Temperature::temp_hotend[H].pid.Kf, 0)
|
||||
@@ -631,7 +631,7 @@ class Temperature {
|
||||
//inline so that there is no performance decrease.
|
||||
//deg=degreeCelsius
|
||||
|
||||
FORCE_INLINE static float degHotend(const uint8_t E_NAME) {
|
||||
FORCE_INLINE static celsius_t degHotend(const uint8_t E_NAME) {
|
||||
return TERN0(HAS_HOTEND, temp_hotend[HOTEND_INDEX].celsius);
|
||||
}
|
||||
|
||||
@@ -736,7 +736,7 @@ class Temperature {
|
||||
#if ENABLED(SHOW_TEMP_ADC_VALUES)
|
||||
FORCE_INLINE static int16_t rawProbeTemp() { return temp_probe.raw; }
|
||||
#endif
|
||||
FORCE_INLINE static float degProbe() { return temp_probe.celsius; }
|
||||
FORCE_INLINE static celsius_t degProbe() { return temp_probe.celsius; }
|
||||
FORCE_INLINE static bool isProbeBelowTemp(const_float_t target_temp) { return temp_probe.celsius < target_temp; }
|
||||
FORCE_INLINE static bool isProbeAboveTemp(const_float_t target_temp) { return temp_probe.celsius > target_temp; }
|
||||
static bool wait_for_probe(const_float_t target_temp, bool no_wait_for_cooling=true);
|
||||
@@ -752,7 +752,7 @@ class Temperature {
|
||||
#if ENABLED(SHOW_TEMP_ADC_VALUES)
|
||||
FORCE_INLINE static int16_t rawChamberTemp() { return temp_chamber.raw; }
|
||||
#endif
|
||||
FORCE_INLINE static float degChamber() { return temp_chamber.celsius; }
|
||||
FORCE_INLINE static celsius_t degChamber() { return temp_chamber.celsius; }
|
||||
#if HAS_HEATED_CHAMBER
|
||||
FORCE_INLINE static celsius_t degTargetChamber() { return temp_chamber.target; }
|
||||
FORCE_INLINE static bool isHeatingChamber() { return temp_chamber.target > temp_chamber.celsius; }
|
||||
@@ -778,7 +778,7 @@ class Temperature {
|
||||
#if ENABLED(SHOW_TEMP_ADC_VALUES)
|
||||
FORCE_INLINE static int16_t rawCoolerTemp() { return temp_cooler.raw; }
|
||||
#endif
|
||||
FORCE_INLINE static float degCooler() { return temp_cooler.celsius; }
|
||||
FORCE_INLINE static celsius_t degCooler() { return temp_cooler.celsius; }
|
||||
#if HAS_COOLER
|
||||
FORCE_INLINE static celsius_t degTargetCooler() { return temp_cooler.target; }
|
||||
FORCE_INLINE static bool isLaserHeating() { return temp_cooler.target > temp_cooler.celsius; }
|
||||
|
||||
@@ -49,10 +49,14 @@
|
||||
bool toolchange_extruder_ready[EXTRUDERS];
|
||||
#endif
|
||||
|
||||
#if ENABLED(MAGNETIC_PARKING_EXTRUDER) || defined(EVENT_GCODE_AFTER_TOOLCHANGE) || (ENABLED(PARKING_EXTRUDER) && PARKING_EXTRUDER_SOLENOIDS_DELAY > 0)
|
||||
#if EITHER(MAGNETIC_PARKING_EXTRUDER, TOOL_SENSOR) || defined(EVENT_GCODE_AFTER_TOOLCHANGE) || (ENABLED(PARKING_EXTRUDER) && PARKING_EXTRUDER_SOLENOIDS_DELAY > 0)
|
||||
#include "../gcode/gcode.h"
|
||||
#endif
|
||||
|
||||
#if ENABLED(TOOL_SENSOR)
|
||||
#include "../lcd/marlinui.h"
|
||||
#endif
|
||||
|
||||
#if ENABLED(DUAL_X_CARRIAGE)
|
||||
#include "stepper.h"
|
||||
#endif
|
||||
@@ -147,11 +151,11 @@
|
||||
|
||||
#endif // SWITCHING_NOZZLE
|
||||
|
||||
inline void _line_to_current(const AxisEnum fr_axis, const float fscale=1) {
|
||||
void _line_to_current(const AxisEnum fr_axis, const float fscale=1) {
|
||||
line_to_current_position(planner.settings.max_feedrate_mm_s[fr_axis] * fscale);
|
||||
}
|
||||
inline void slow_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_axis, 0.5f); }
|
||||
inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_axis); }
|
||||
void slow_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_axis, 0.2f); }
|
||||
void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_axis, 0.5f); }
|
||||
|
||||
#if ENABLED(MAGNETIC_PARKING_EXTRUDER)
|
||||
|
||||
@@ -370,7 +374,7 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a
|
||||
DEBUG_POS("PE Tool-Change done.", current_position);
|
||||
parking_extruder_set_parked(false);
|
||||
}
|
||||
else if (do_solenoid_activation) { // && nomove == true
|
||||
else if (do_solenoid_activation) {
|
||||
// Deactivate current extruder solenoid
|
||||
pe_solenoid_set_pin_state(active_extruder, !PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE);
|
||||
// Engage new extruder magnetic field
|
||||
@@ -384,12 +388,117 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a
|
||||
|
||||
#if ENABLED(SWITCHING_TOOLHEAD)
|
||||
|
||||
inline void swt_lock(const bool locked=true) {
|
||||
const uint16_t swt_angles[2] = SWITCHING_TOOLHEAD_SERVO_ANGLES;
|
||||
MOVE_SERVO(SWITCHING_TOOLHEAD_SERVO_NR, swt_angles[locked ? 0 : 1]);
|
||||
// Return a bitmask of tool sensor states
|
||||
inline uint8_t poll_tool_sensor_pins() {
|
||||
return (0
|
||||
#if ENABLED(TOOL_SENSOR)
|
||||
#if PIN_EXISTS(TOOL_SENSOR1)
|
||||
| (READ(TOOL_SENSOR1_PIN) << 0)
|
||||
#endif
|
||||
#if PIN_EXISTS(TOOL_SENSOR2)
|
||||
| (READ(TOOL_SENSOR2_PIN) << 1)
|
||||
#endif
|
||||
#if PIN_EXISTS(TOOL_SENSOR3)
|
||||
| (READ(TOOL_SENSOR3_PIN) << 2)
|
||||
#endif
|
||||
#if PIN_EXISTS(TOOL_SENSOR4)
|
||||
| (READ(TOOL_SENSOR4_PIN) << 3)
|
||||
#endif
|
||||
#if PIN_EXISTS(TOOL_SENSOR5)
|
||||
| (READ(TOOL_SENSOR5_PIN) << 4)
|
||||
#endif
|
||||
#if PIN_EXISTS(TOOL_SENSOR6)
|
||||
| (READ(TOOL_SENSOR6_PIN) << 5)
|
||||
#endif
|
||||
#if PIN_EXISTS(TOOL_SENSOR7)
|
||||
| (READ(TOOL_SENSOR7_PIN) << 6)
|
||||
#endif
|
||||
#if PIN_EXISTS(TOOL_SENSOR8)
|
||||
| (READ(TOOL_SENSOR8_PIN) << 7)
|
||||
#endif
|
||||
#endif
|
||||
);
|
||||
}
|
||||
|
||||
void swt_init() { swt_lock(); }
|
||||
#if ENABLED(TOOL_SENSOR)
|
||||
|
||||
bool tool_sensor_disabled; // = false
|
||||
|
||||
uint8_t check_tool_sensor_stats(const uint8_t tool_index, const bool kill_on_error/*=false*/, const bool disable/*=false*/) {
|
||||
static uint8_t sensor_tries; // = 0
|
||||
for (;;) {
|
||||
if (poll_tool_sensor_pins() == _BV(tool_index)) {
|
||||
sensor_tries = 0;
|
||||
return tool_index;
|
||||
}
|
||||
else if (kill_on_error && (!tool_sensor_disabled || disable)) {
|
||||
sensor_tries++;
|
||||
if (sensor_tries > 10) kill(PSTR("Tool Sensor error"));
|
||||
safe_delay(5);
|
||||
}
|
||||
else {
|
||||
sensor_tries++;
|
||||
if (sensor_tries > 10) return -1;
|
||||
safe_delay(5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
inline void switching_toolhead_lock(const bool locked) {
|
||||
#ifdef SWITCHING_TOOLHEAD_SERVO_ANGLES
|
||||
const uint16_t swt_angles[2] = SWITCHING_TOOLHEAD_SERVO_ANGLES;
|
||||
MOVE_SERVO(SWITCHING_TOOLHEAD_SERVO_NR, swt_angles[locked ? 0 : 1]);
|
||||
#elif PIN_EXISTS(SWT_SOLENOID)
|
||||
OUT_WRITE(SWT_SOLENOID_PIN, locked);
|
||||
gcode.dwell(10);
|
||||
#else
|
||||
#error "No toolhead locking mechanism configured."
|
||||
#endif
|
||||
}
|
||||
|
||||
#include <bitset>
|
||||
|
||||
void swt_init() {
|
||||
switching_toolhead_lock(true);
|
||||
|
||||
#if ENABLED(TOOL_SENSOR)
|
||||
// Init tool sensors
|
||||
#if PIN_EXISTS(TOOL_SENSOR1)
|
||||
SET_INPUT_PULLUP(TOOL_SENSOR1_PIN);
|
||||
#endif
|
||||
#if PIN_EXISTS(TOOL_SENSOR2)
|
||||
SET_INPUT_PULLUP(TOOL_SENSOR2_PIN);
|
||||
#endif
|
||||
#if PIN_EXISTS(TOOL_SENSOR3)
|
||||
SET_INPUT_PULLUP(TOOL_SENSOR3_PIN);
|
||||
#endif
|
||||
#if PIN_EXISTS(TOOL_SENSOR4)
|
||||
SET_INPUT_PULLUP(TOOL_SENSOR4_PIN);
|
||||
#endif
|
||||
#if PIN_EXISTS(TOOL_SENSOR5)
|
||||
SET_INPUT_PULLUP(TOOL_SENSOR5_PIN);
|
||||
#endif
|
||||
#if PIN_EXISTS(TOOL_SENSOR6)
|
||||
SET_INPUT_PULLUP(TOOL_SENSOR6_PIN);
|
||||
#endif
|
||||
#if PIN_EXISTS(TOOL_SENSOR7)
|
||||
SET_INPUT_PULLUP(TOOL_SENSOR7_PIN);
|
||||
#endif
|
||||
#if PIN_EXISTS(TOOL_SENSOR8)
|
||||
SET_INPUT_PULLUP(TOOL_SENSOR8_PIN);
|
||||
#endif
|
||||
|
||||
if (check_tool_sensor_stats(0)) {
|
||||
ui.set_status_P("TC error");
|
||||
switching_toolhead_lock(false);
|
||||
while (check_tool_sensor_stats(0)) { /* nada */ }
|
||||
switching_toolhead_lock(true);
|
||||
}
|
||||
ui.set_status_P("TC Success");
|
||||
#endif
|
||||
}
|
||||
|
||||
inline void switching_toolhead_tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
|
||||
if (no_move) return;
|
||||
@@ -398,6 +507,8 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a
|
||||
const float placexpos = toolheadposx[active_extruder],
|
||||
grabxpos = toolheadposx[new_tool];
|
||||
|
||||
(void)check_tool_sensor_stats(active_extruder, true);
|
||||
|
||||
/**
|
||||
* 1. Move to switch position of current toolhead
|
||||
* 2. Unlock tool and drop it in the dock
|
||||
@@ -421,13 +532,14 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a
|
||||
DEBUG_SYNCHRONIZE();
|
||||
DEBUG_POS("Move Y SwitchPos + Security", current_position);
|
||||
|
||||
fast_line_to_current(Y_AXIS);
|
||||
slow_line_to_current(Y_AXIS);
|
||||
|
||||
// 2. Unlock tool and drop it in the dock
|
||||
TERN_(TOOL_SENSOR, tool_sensor_disabled = true);
|
||||
|
||||
planner.synchronize();
|
||||
DEBUG_ECHOLNPGM("(2) Unlock and Place Toolhead");
|
||||
swt_lock(false);
|
||||
switching_toolhead_lock(false);
|
||||
safe_delay(500);
|
||||
|
||||
current_position.y = SWITCHING_TOOLHEAD_Y_POS;
|
||||
@@ -440,7 +552,9 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a
|
||||
|
||||
current_position.y -= SWITCHING_TOOLHEAD_Y_CLEAR;
|
||||
DEBUG_POS("Move back Y clear", current_position);
|
||||
fast_line_to_current(Y_AXIS); // move away from docked toolhead
|
||||
slow_line_to_current(Y_AXIS); // move away from docked toolhead
|
||||
|
||||
(void)check_tool_sensor_stats(active_extruder);
|
||||
|
||||
// 3. Move to the new toolhead
|
||||
|
||||
@@ -457,7 +571,7 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a
|
||||
DEBUG_SYNCHRONIZE();
|
||||
DEBUG_POS("Move Y SwitchPos + Security", current_position);
|
||||
|
||||
fast_line_to_current(Y_AXIS);
|
||||
slow_line_to_current(Y_AXIS);
|
||||
|
||||
// 4. Grab and lock the new toolhead
|
||||
|
||||
@@ -472,14 +586,19 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a
|
||||
// Wait for move to finish, pause 0.2s, move servo, pause 0.5s
|
||||
planner.synchronize();
|
||||
safe_delay(200);
|
||||
swt_lock();
|
||||
|
||||
(void)check_tool_sensor_stats(new_tool, true, true);
|
||||
|
||||
switching_toolhead_lock(true);
|
||||
safe_delay(500);
|
||||
|
||||
current_position.y -= SWITCHING_TOOLHEAD_Y_CLEAR;
|
||||
DEBUG_POS("Move back Y clear", current_position);
|
||||
fast_line_to_current(Y_AXIS); // Move away from docked toolhead
|
||||
slow_line_to_current(Y_AXIS); // Move away from docked toolhead
|
||||
planner.synchronize(); // Always sync the final move
|
||||
|
||||
(void)check_tool_sensor_stats(new_tool, true, true);
|
||||
|
||||
DEBUG_POS("ST Tool-Change done.", current_position);
|
||||
}
|
||||
|
||||
@@ -928,13 +1047,15 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
|
||||
#endif
|
||||
|
||||
// First tool priming. To prime again, reboot the machine.
|
||||
#if BOTH(TOOLCHANGE_FILAMENT_SWAP, TOOLCHANGE_FS_PRIME_FIRST_USED)
|
||||
#if ENABLED(TOOLCHANGE_FS_PRIME_FIRST_USED)
|
||||
static bool first_tool_is_primed = false;
|
||||
if (new_tool == old_tool && !first_tool_is_primed && enable_first_prime) {
|
||||
tool_change_prime();
|
||||
first_tool_is_primed = true;
|
||||
toolchange_extruder_ready[old_tool] = true; // Primed and initialized
|
||||
TERN_(TOOLCHANGE_FS_INIT_BEFORE_SWAP, toolchange_extruder_ready[old_tool] = true); // Primed and initialized
|
||||
}
|
||||
#else
|
||||
constexpr bool first_tool_is_primed = true;
|
||||
#endif
|
||||
|
||||
if (new_tool != old_tool || TERN0(PARKING_EXTRUDER, extruder_parked)) { // PARKING_EXTRUDER may need to attach old_tool when homing
|
||||
@@ -970,12 +1091,10 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
|
||||
if (ENABLED(SINGLENOZZLE)) { active_extruder = new_tool; return; }
|
||||
}
|
||||
else {
|
||||
#if ENABLED(TOOLCHANGE_FS_PRIME_FIRST_USED)
|
||||
// For first new tool, change without unloading the old. 'Just prime/init the new'
|
||||
if (first_tool_is_primed)
|
||||
unscaled_e_move(-toolchange_settings.swap_length, MMM_TO_MMS(toolchange_settings.retract_speed));
|
||||
first_tool_is_primed = true; // The first new tool will be primed by toolchanging
|
||||
#endif
|
||||
// For first new tool, change without unloading the old. 'Just prime/init the new'
|
||||
if (first_tool_is_primed)
|
||||
unscaled_e_move(-toolchange_settings.swap_length, MMM_TO_MMS(toolchange_settings.retract_speed));
|
||||
TERN_(TOOLCHANGE_FS_PRIME_FIRST_USED, first_tool_is_primed = true); // The first new tool will be primed by toolchanging
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1053,8 +1172,11 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
|
||||
move_nozzle_servo(new_tool);
|
||||
#endif
|
||||
|
||||
// Set the new active extruder
|
||||
if (DISABLED(DUAL_X_CARRIAGE)) active_extruder = new_tool;
|
||||
IF_DISABLED(DUAL_X_CARRIAGE, active_extruder = new_tool); // Set the new active extruder
|
||||
|
||||
TERN_(TOOL_SENSOR, tool_sensor_disabled = false);
|
||||
|
||||
(void)check_tool_sensor_stats(active_extruder, true);
|
||||
|
||||
// The newly-selected extruder XYZ is actually at...
|
||||
DEBUG_ECHOLNPAIR("Offset Tool XYZ by { ", diff.x, ", ", diff.y, ", ", diff.z, " }");
|
||||
|
||||
@@ -79,10 +79,9 @@
|
||||
|
||||
#if ENABLED(PARKING_EXTRUDER)
|
||||
|
||||
#define PE_MAGNET_ON_STATE TERN_(PARKING_EXTRUDER_SOLENOIDS_INVERT, !)PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE
|
||||
|
||||
void pe_solenoid_set_pin_state(const uint8_t extruder_num, const uint8_t state);
|
||||
|
||||
#define PE_MAGNET_ON_STATE TERN_(PARKING_EXTRUDER_SOLENOIDS_INVERT, !)PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE
|
||||
inline void pe_solenoid_magnet_on(const uint8_t extruder_num) { pe_solenoid_set_pin_state(extruder_num, PE_MAGNET_ON_STATE); }
|
||||
inline void pe_solenoid_magnet_off(const uint8_t extruder_num) { pe_solenoid_set_pin_state(extruder_num, !PE_MAGNET_ON_STATE); }
|
||||
|
||||
@@ -115,6 +114,12 @@
|
||||
void swt_init();
|
||||
#endif
|
||||
|
||||
#if ENABLED(TOOL_SENSOR)
|
||||
uint8_t check_tool_sensor_stats(const uint8_t active_tool, const bool kill_on_error=false, const bool disable=false);
|
||||
#else
|
||||
inline uint8_t check_tool_sensor_stats(const uint8_t, const bool=false, const bool=false) { return 0; }
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Perform a tool-change, which may result in moving the
|
||||
* previous tool out of the way and the new tool into place.
|
||||
|
||||
@@ -89,13 +89,6 @@
|
||||
#define Z_CS_PIN 32
|
||||
#endif
|
||||
|
||||
#define Z2_STEP_PIN 36
|
||||
#define Z2_DIR_PIN 34
|
||||
#define Z2_ENABLE_PIN 30
|
||||
#ifndef Z2_CS_PIN
|
||||
#define Z2_CS_PIN 22
|
||||
#endif
|
||||
|
||||
#define E0_STEP_PIN 26
|
||||
#define E0_DIR_PIN 28
|
||||
#define E0_ENABLE_PIN 24
|
||||
@@ -103,18 +96,33 @@
|
||||
#define E0_CS_PIN 43
|
||||
#endif
|
||||
|
||||
#define E1_STEP_PIN 36
|
||||
#define E1_DIR_PIN 34
|
||||
#define E1_ENABLE_PIN 30
|
||||
#ifndef E1_CS_PIN
|
||||
#define E1_CS_PIN 22
|
||||
#endif
|
||||
|
||||
//
|
||||
// Temperature Sensors
|
||||
//
|
||||
#define TEMP_0_PIN 13
|
||||
#define TEMP_BED_PIN 14
|
||||
#if TEMP_SENSOR_BED
|
||||
#define TEMP_BED_PIN 14
|
||||
#else
|
||||
#define TEMP_1_PIN 14
|
||||
#endif
|
||||
#define TEMP_CHAMBER_PIN 15
|
||||
|
||||
//
|
||||
// Heaters / Fans
|
||||
//
|
||||
#define HEATER_0_PIN 10
|
||||
#define HEATER_BED_PIN 8
|
||||
#if TEMP_SENSOR_BED
|
||||
#define HEATER_BED_PIN 8
|
||||
#else
|
||||
#define HEATER_1_PIN 8
|
||||
#endif
|
||||
#define FAN_PIN 9
|
||||
#define FAN1_PIN 7
|
||||
#define FAN2_PIN 12
|
||||
@@ -186,9 +194,6 @@
|
||||
//#define Z2_HARDWARE_SERIAL Serial1
|
||||
//#define E0_HARDWARE_SERIAL Serial1
|
||||
//#define E1_HARDWARE_SERIAL Serial1
|
||||
//#define E2_HARDWARE_SERIAL Serial1
|
||||
//#define E3_HARDWARE_SERIAL Serial1
|
||||
//#define E4_HARDWARE_SERIAL Serial1
|
||||
|
||||
//
|
||||
// Software serial
|
||||
@@ -245,42 +250,6 @@
|
||||
#ifndef E1_SERIAL_RX_PIN
|
||||
#define E1_SERIAL_RX_PIN -1
|
||||
#endif
|
||||
#ifndef E2_SERIAL_TX_PIN
|
||||
#define E2_SERIAL_TX_PIN -1
|
||||
#endif
|
||||
#ifndef E2_SERIAL_RX_PIN
|
||||
#define E2_SERIAL_RX_PIN -1
|
||||
#endif
|
||||
#ifndef E3_SERIAL_TX_PIN
|
||||
#define E3_SERIAL_TX_PIN -1
|
||||
#endif
|
||||
#ifndef E3_SERIAL_RX_PIN
|
||||
#define E3_SERIAL_RX_PIN -1
|
||||
#endif
|
||||
#ifndef E4_SERIAL_TX_PIN
|
||||
#define E4_SERIAL_TX_PIN -1
|
||||
#endif
|
||||
#ifndef E4_SERIAL_RX_PIN
|
||||
#define E4_SERIAL_RX_PIN -1
|
||||
#endif
|
||||
#ifndef E5_SERIAL_TX_PIN
|
||||
#define E5_SERIAL_TX_PIN -1
|
||||
#endif
|
||||
#ifndef E5_SERIAL_RX_PIN
|
||||
#define E5_SERIAL_RX_PIN -1
|
||||
#endif
|
||||
#ifndef E6_SERIAL_TX_PIN
|
||||
#define E6_SERIAL_TX_PIN -1
|
||||
#endif
|
||||
#ifndef E6_SERIAL_RX_PIN
|
||||
#define E6_SERIAL_RX_PIN -1
|
||||
#endif
|
||||
#ifndef E7_SERIAL_TX_PIN
|
||||
#define E7_SERIAL_TX_PIN -1
|
||||
#endif
|
||||
#ifndef E7_SERIAL_RX_PIN
|
||||
#define E7_SERIAL_RX_PIN -1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//////////////////////////
|
||||
|
||||
@@ -38,17 +38,21 @@
|
||||
// USB Flash Drive support
|
||||
#define HAS_OTG_USB_HOST_SUPPORT
|
||||
|
||||
#define TP // Enable to define servo and probe pins
|
||||
#define M5_EXTENDER // The M5 extender is attached
|
||||
|
||||
//
|
||||
// Servos
|
||||
//
|
||||
#if ENABLED(TP)
|
||||
#define SERVO0_PIN PB11
|
||||
#endif
|
||||
#define SERVO0_PIN PB11 // BLTOUCH
|
||||
#define SOL0_PIN PC7 // Toolchanger
|
||||
|
||||
#define PS_ON_PIN PH6
|
||||
#if ENABLED(TOOL_SENSOR)
|
||||
#define TOOL_SENSOR1_PIN PH6
|
||||
#define TOOL_SENSOR2_PIN PI4
|
||||
//#define TOOL_SENSOR3_PIN PF4
|
||||
#else
|
||||
#define PS_ON_PIN PH6
|
||||
#endif
|
||||
|
||||
//
|
||||
// Trinamic Stallguard pins
|
||||
@@ -110,7 +114,7 @@
|
||||
#define Z4_STOP_PIN PF6 // M5 M3_STOP
|
||||
#endif
|
||||
|
||||
#if ENABLED(TP) && !defined(Z_MIN_PROBE_PIN)
|
||||
#ifndef Z_MIN_PROBE_PIN
|
||||
#define Z_MIN_PROBE_PIN PH11 // Z Probe must be PH11
|
||||
#endif
|
||||
|
||||
|
||||
@@ -3,6 +3,12 @@
|
||||
# Convenience script to apply customizations to CPP flags
|
||||
#
|
||||
Import("env")
|
||||
|
||||
# Detect that 'vscode init' is running
|
||||
from SCons.Script import COMMAND_LINE_TARGETS
|
||||
if "idedata" in COMMAND_LINE_TARGETS:
|
||||
env.Exit(0)
|
||||
|
||||
env.Append(CXXFLAGS=[
|
||||
"-Wno-register"
|
||||
#"-Wno-incompatible-pointer-types",
|
||||
|
||||
@@ -2,8 +2,13 @@
|
||||
# common-dependencies-post.py
|
||||
# Convenience script to add build flags for Marlin Enabled Features
|
||||
#
|
||||
|
||||
Import("env")
|
||||
|
||||
# Detect that 'vscode init' is running
|
||||
from SCons.Script import COMMAND_LINE_TARGETS
|
||||
if "idedata" in COMMAND_LINE_TARGETS:
|
||||
env.Exit(0)
|
||||
|
||||
Import("projenv")
|
||||
|
||||
def apply_board_build_flags():
|
||||
|
||||
@@ -2,6 +2,15 @@
|
||||
# common-dependencies.py
|
||||
# Convenience script to check dependencies and add libs and sources for Marlin Enabled Features
|
||||
#
|
||||
Import("env")
|
||||
|
||||
#print(env.Dump())
|
||||
|
||||
# Detect that 'vscode init' is running
|
||||
from SCons.Script import COMMAND_LINE_TARGETS
|
||||
if "idedata" in COMMAND_LINE_TARGETS:
|
||||
env.Exit(0)
|
||||
|
||||
import subprocess,os,re
|
||||
|
||||
PIO_VERSION_MIN = (5, 0, 3)
|
||||
@@ -31,10 +40,6 @@ except:
|
||||
from platformio.package.meta import PackageSpec
|
||||
from platformio.project.config import ProjectConfig
|
||||
|
||||
Import("env")
|
||||
|
||||
#print(env.Dump())
|
||||
|
||||
try:
|
||||
verbose = int(env.GetProjectOption('custom_verbose'))
|
||||
except:
|
||||
|
||||
@@ -1,6 +1,13 @@
|
||||
#
|
||||
# copy_marlin_variant_to_framework.py
|
||||
#
|
||||
Import("env")
|
||||
|
||||
# Detect that 'vscode init' is running
|
||||
from SCons.Script import COMMAND_LINE_TARGETS
|
||||
if "idedata" in COMMAND_LINE_TARGETS:
|
||||
env.Exit(0)
|
||||
|
||||
import os,shutil
|
||||
from SCons.Script import DefaultEnvironment
|
||||
from platformio import util
|
||||
|
||||
@@ -2,9 +2,15 @@
|
||||
# preflight-checks.py
|
||||
# Check for common issues prior to compiling
|
||||
#
|
||||
import os,re,sys
|
||||
Import("env")
|
||||
|
||||
# Detect that 'vscode init' is running
|
||||
from SCons.Script import COMMAND_LINE_TARGETS
|
||||
if "idedata" in COMMAND_LINE_TARGETS:
|
||||
env.Exit(0)
|
||||
|
||||
import os,re,sys
|
||||
|
||||
def get_envs_for_board(board):
|
||||
with open(os.path.join("Marlin", "src", "pins", "pins.h"), "r") as file:
|
||||
|
||||
|
||||
@@ -26,5 +26,12 @@ opt_set MOTHERBOARD BOARD_BTT_GTR_V1_0 SERIAL_PORT -1 \
|
||||
opt_enable TOOLCHANGE_FILAMENT_SWAP TOOLCHANGE_MIGRATION_FEATURE TOOLCHANGE_FS_INIT_BEFORE_SWAP TOOLCHANGE_FS_PRIME_FIRST_USED PID_PARAMS_PER_HOTEND
|
||||
exec_test $1 $2 "BigTreeTech GTR | 6 Extruders | Triple Z" "$3"
|
||||
|
||||
restore_configs
|
||||
opt_set MOTHERBOARD BOARD_BTT_GTR_V1_0 SERIAL_PORT -1 \
|
||||
EXTRUDERS 3 TEMP_SENSOR_1 1 TEMP_SENSOR_2 1 \
|
||||
SERVO_DELAY '{ 300, 300, 300 }'
|
||||
opt_enable SWITCHING_TOOLHEAD TOOL_SENSOR
|
||||
exec_test $1 $2 "BigTreeTech GTR | Switching Toolhead | Tool Sensors" "$3"
|
||||
|
||||
# clean up
|
||||
restore_configs
|
||||
|
||||
@@ -26,8 +26,8 @@ restore_configs
|
||||
opt_set MOTHERBOARD BOARD_MKS_SBASE \
|
||||
EXTRUDERS 2 TEMP_SENSOR_1 1 \
|
||||
NUM_SERVOS 2 SERVO_DELAY '{ 300, 300 }'
|
||||
opt_enable SWITCHING_NOZZLE SWITCHING_NOZZLE_E1_SERVO_NR ULTIMAKERCONTROLLER
|
||||
exec_test $1 $2 "MKS SBASE with SWITCHING_NOZZLE" "$3"
|
||||
opt_enable SWITCHING_NOZZLE SWITCHING_NOZZLE_E1_SERVO_NR ULTIMAKERCONTROLLER REALTIME_REPORTING_COMMANDS FULL_REPORT_TO_HOST_FEATURE
|
||||
exec_test $1 $2 "MKS SBASE with SWITCHING_NOZZLE, Grbl Realtime Report" "$3"
|
||||
|
||||
restore_configs
|
||||
opt_set MOTHERBOARD BOARD_RAMPS_14_RE_ARM_EEB \
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ extra_configs =
|
||||
# The 'common' values are used for most Marlin builds
|
||||
#
|
||||
[common]
|
||||
build_flags = -fmax-errors=5 -g3 -D__MARLIN_FIRMWARE__ -fmerge-constants -fno-signed-zeros -ffinite-math-only
|
||||
build_flags = -fmax-errors=5 -g3 -D__MARLIN_FIRMWARE__ -fmerge-constants
|
||||
extra_scripts =
|
||||
pre:buildroot/share/PlatformIO/scripts/common-dependencies.py
|
||||
pre:buildroot/share/PlatformIO/scripts/common-cxxflags.py
|
||||
|
||||
Reference in New Issue
Block a user