🎨 Misc. cleanup, comments
This commit is contained in:
parent
2690bb1bc2
commit
d7b7b570c7
@ -290,6 +290,9 @@ G29_TYPE GcodeSuite::G29() {
|
|||||||
ry = RAW_Y_POSITION(parser.linearval('Y', NAN));
|
ry = RAW_Y_POSITION(parser.linearval('Y', NAN));
|
||||||
int8_t i = parser.byteval('I', -1), j = parser.byteval('J', -1);
|
int8_t i = parser.byteval('I', -1), j = parser.byteval('J', -1);
|
||||||
|
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
|
||||||
|
|
||||||
if (!isnan(rx) && !isnan(ry)) {
|
if (!isnan(rx) && !isnan(ry)) {
|
||||||
// Get nearest i / j from rx / ry
|
// Get nearest i / j from rx / ry
|
||||||
i = (rx - bilinear_start.x + 0.5 * abl.gridSpacing.x) / abl.gridSpacing.x;
|
i = (rx - bilinear_start.x + 0.5 * abl.gridSpacing.x) / abl.gridSpacing.x;
|
||||||
@ -297,6 +300,9 @@ G29_TYPE GcodeSuite::G29() {
|
|||||||
LIMIT(i, 0, (GRID_MAX_POINTS_X) - 1);
|
LIMIT(i, 0, (GRID_MAX_POINTS_X) - 1);
|
||||||
LIMIT(j, 0, (GRID_MAX_POINTS_Y) - 1);
|
LIMIT(j, 0, (GRID_MAX_POINTS_Y) - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
|
||||||
if (WITHIN(i, 0, (GRID_MAX_POINTS_X) - 1) && WITHIN(j, 0, (GRID_MAX_POINTS_Y) - 1)) {
|
if (WITHIN(i, 0, (GRID_MAX_POINTS_X) - 1) && WITHIN(j, 0, (GRID_MAX_POINTS_Y) - 1)) {
|
||||||
set_bed_leveling_enabled(false);
|
set_bed_leveling_enabled(false);
|
||||||
z_values[i][j] = rz;
|
z_values[i][j] = rz;
|
||||||
|
@ -2762,7 +2762,10 @@ void HMI_Prepare() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAS_HOTEND || HAS_HEATED_BED
|
#if HAS_HOTEND || HAS_HEATED_BED
|
||||||
case PREPARE_CASE_COOL: thermalManager.cooldown(); break;
|
case PREPARE_CASE_COOL:
|
||||||
|
thermalManager.cooldown();
|
||||||
|
ui.reset_status();
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
case PREPARE_CASE_LANG:
|
case PREPARE_CASE_LANG:
|
||||||
|
@ -79,7 +79,7 @@ uint8_t TouchButtons::read_buttons() {
|
|||||||
|
|
||||||
#if ENABLED(TOUCH_SCREEN_CALIBRATION)
|
#if ENABLED(TOUCH_SCREEN_CALIBRATION)
|
||||||
const calibrationState state = touch_calibration.get_calibration_state();
|
const calibrationState state = touch_calibration.get_calibration_state();
|
||||||
if (state >= CALIBRATION_TOP_LEFT && state <= CALIBRATION_BOTTOM_RIGHT) {
|
if (WITHIN(state, CALIBRATION_TOP_LEFT, CALIBRATION_BOTTOM_RIGHT)) {
|
||||||
if (touch_calibration.handleTouch(x, y)) ui.refresh();
|
if (touch_calibration.handleTouch(x, y)) ui.refresh();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -593,9 +593,6 @@ void _O2 Endstops::report_states() {
|
|||||||
|
|
||||||
} // Endstops::report_states
|
} // Endstops::report_states
|
||||||
|
|
||||||
// The following routines are called from an ISR context. It could be the temperature ISR, the
|
|
||||||
// endstop ISR or the Stepper ISR.
|
|
||||||
|
|
||||||
#if HAS_DELTA_SENSORLESS_PROBING
|
#if HAS_DELTA_SENSORLESS_PROBING
|
||||||
#define __ENDSTOP(AXIS, ...) AXIS ##_MAX
|
#define __ENDSTOP(AXIS, ...) AXIS ##_MAX
|
||||||
#define _ENDSTOP_PIN(AXIS, ...) AXIS ##_MAX_PIN
|
#define _ENDSTOP_PIN(AXIS, ...) AXIS ##_MAX_PIN
|
||||||
@ -607,13 +604,18 @@ void _O2 Endstops::report_states() {
|
|||||||
#endif
|
#endif
|
||||||
#define _ENDSTOP(AXIS, MINMAX) __ENDSTOP(AXIS, MINMAX)
|
#define _ENDSTOP(AXIS, MINMAX) __ENDSTOP(AXIS, MINMAX)
|
||||||
|
|
||||||
// Check endstops - Could be called from Temperature ISR!
|
/**
|
||||||
|
* Called from interrupt context by the Endstop ISR or Stepper ISR!
|
||||||
|
* Read endstops to get their current states, register hits for all
|
||||||
|
* axes moving in the direction of their endstops, and abort moves.
|
||||||
|
*/
|
||||||
void Endstops::update() {
|
void Endstops::update() {
|
||||||
|
|
||||||
#if !ENDSTOP_NOISE_THRESHOLD
|
#if !ENDSTOP_NOISE_THRESHOLD // If not debouncing...
|
||||||
if (!abort_enabled()) return;
|
if (!abort_enabled()) return; // ...and not enabled, exit.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Macros to update / copy the live_state
|
||||||
#define UPDATE_ENDSTOP_BIT(AXIS, MINMAX) SET_BIT_TO(live_state, _ENDSTOP(AXIS, MINMAX), (READ(_ENDSTOP_PIN(AXIS, MINMAX)) != _ENDSTOP_INVERTING(AXIS, MINMAX)))
|
#define UPDATE_ENDSTOP_BIT(AXIS, MINMAX) SET_BIT_TO(live_state, _ENDSTOP(AXIS, MINMAX), (READ(_ENDSTOP_PIN(AXIS, MINMAX)) != _ENDSTOP_INVERTING(AXIS, MINMAX)))
|
||||||
#define COPY_LIVE_STATE(SRC_BIT, DST_BIT) SET_BIT_TO(live_state, DST_BIT, TEST(live_state, SRC_BIT))
|
#define COPY_LIVE_STATE(SRC_BIT, DST_BIT) SET_BIT_TO(live_state, DST_BIT, TEST(live_state, SRC_BIT))
|
||||||
|
|
||||||
@ -1107,6 +1109,7 @@ void Endstops::update() {
|
|||||||
|
|
||||||
#if ENABLED(SPI_ENDSTOPS)
|
#if ENABLED(SPI_ENDSTOPS)
|
||||||
|
|
||||||
|
// Called from idle() to read Trinamic stall states
|
||||||
bool Endstops::tmc_spi_homing_check() {
|
bool Endstops::tmc_spi_homing_check() {
|
||||||
bool hit = false;
|
bool hit = false;
|
||||||
#if X_SPI_SENSORLESS
|
#if X_SPI_SENSORLESS
|
||||||
|
@ -2346,13 +2346,9 @@ uint32_t Stepper::block_phase_isr() {
|
|||||||
#endif
|
#endif
|
||||||
#endif // LASER_POWER_INLINE
|
#endif // LASER_POWER_INLINE
|
||||||
|
|
||||||
// At this point, we must ensure the movement about to execute isn't
|
// If the endstop is already pressed, endstop interrupts won't invoke
|
||||||
// trying to force the head against a limit switch. If using interrupt-
|
// endstop_triggered and the move will grind. So check here for a
|
||||||
// driven change detection, and already against a limit then no call to
|
// triggered endstop, which marks the block for discard on the next ISR.
|
||||||
// the endstop_triggered method will be done and the movement will be
|
|
||||||
// done against the endstop. So, check the limits here: If the movement
|
|
||||||
// is against the limits, the block will be marked as to be killed, and
|
|
||||||
// on the next call to this ISR, will be discarded.
|
|
||||||
endstops.update();
|
endstops.update();
|
||||||
|
|
||||||
#if ENABLED(Z_LATE_ENABLE)
|
#if ENABLED(Z_LATE_ENABLE)
|
||||||
|
@ -271,9 +271,8 @@ void CardReader::selectByName(SdFile dir, const char * const match) {
|
|||||||
* good addition.
|
* good addition.
|
||||||
*/
|
*/
|
||||||
void CardReader::printListing(
|
void CardReader::printListing(
|
||||||
SdFile parent
|
SdFile parent, const char * const prepend
|
||||||
OPTARG(LONG_FILENAME_HOST_SUPPORT, const bool includeLongNames/*=false*/)
|
OPTARG(LONG_FILENAME_HOST_SUPPORT, const bool includeLongNames/*=false*/)
|
||||||
, const char * const prepend/*=nullptr*/
|
|
||||||
OPTARG(LONG_FILENAME_HOST_SUPPORT, const char * const prependLong/*=nullptr*/)
|
OPTARG(LONG_FILENAME_HOST_SUPPORT, const char * const prependLong/*=nullptr*/)
|
||||||
) {
|
) {
|
||||||
dir_t p;
|
dir_t p;
|
||||||
@ -283,61 +282,47 @@ void CardReader::printListing(
|
|||||||
size_t lenPrepend = prepend ? strlen(prepend) + 1 : 0;
|
size_t lenPrepend = prepend ? strlen(prepend) + 1 : 0;
|
||||||
// Allocate enough stack space for the full path including / separator
|
// Allocate enough stack space for the full path including / separator
|
||||||
char path[lenPrepend + FILENAME_LENGTH];
|
char path[lenPrepend + FILENAME_LENGTH];
|
||||||
if (prepend) {
|
if (prepend) { strcpy(path, prepend); path[lenPrepend - 1] = '/'; }
|
||||||
strcpy(path, prepend);
|
|
||||||
path[lenPrepend - 1] = '/';
|
|
||||||
}
|
|
||||||
char* dosFilename = path + lenPrepend;
|
char* dosFilename = path + lenPrepend;
|
||||||
createFilename(dosFilename, p);
|
createFilename(dosFilename, p);
|
||||||
|
|
||||||
// Get a new directory object using the full path
|
// Get a new directory object using the full path
|
||||||
// and dive recursively into it.
|
// and dive recursively into it.
|
||||||
SdFile child; // child.close() in destructor
|
SdFile child; // child.close() in destructor
|
||||||
if (child.open(&parent, dosFilename, O_READ))
|
if (child.open(&parent, dosFilename, O_READ)) {
|
||||||
#if ENABLED(LONG_FILENAME_HOST_SUPPORT)
|
#if ENABLED(LONG_FILENAME_HOST_SUPPORT)
|
||||||
if (includeLongNames) {
|
if (includeLongNames) {
|
||||||
size_t lenPrependLong = prependLong ? strlen(prependLong) + 1 : 0;
|
size_t lenPrependLong = prependLong ? strlen(prependLong) + 1 : 0;
|
||||||
// Allocate enough stack space for the full long path including / separator
|
// Allocate enough stack space for the full long path including / separator
|
||||||
char pathLong[lenPrependLong + strlen(longFilename) + 1];
|
char pathLong[lenPrependLong + strlen(longFilename) + 1];
|
||||||
if (prependLong) {
|
if (prependLong) { strcpy(pathLong, prependLong); pathLong[lenPrependLong - 1] = '/'; }
|
||||||
strcpy(pathLong, prependLong);
|
|
||||||
pathLong[lenPrependLong - 1] = '/';
|
|
||||||
}
|
|
||||||
strcpy(pathLong + lenPrependLong, longFilename);
|
strcpy(pathLong + lenPrependLong, longFilename);
|
||||||
printListing(child, true, path, pathLong);
|
printListing(child, path, true, pathLong);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
printListing(child, false, path);
|
printListing(child, path);
|
||||||
#else
|
#else
|
||||||
printListing(child, path);
|
printListing(child, path);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
SERIAL_ECHO_MSG(STR_SD_CANT_OPEN_SUBDIR, dosFilename);
|
SERIAL_ECHO_MSG(STR_SD_CANT_OPEN_SUBDIR, dosFilename);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (is_dir_or_gcode(p)) {
|
else if (is_dir_or_gcode(p)) {
|
||||||
if (prepend) {
|
if (prepend) { SERIAL_ECHO(prepend); SERIAL_CHAR('/'); }
|
||||||
SERIAL_ECHO(prepend);
|
|
||||||
SERIAL_CHAR('/');
|
|
||||||
}
|
|
||||||
SERIAL_ECHO(createFilename(filename, p));
|
SERIAL_ECHO(createFilename(filename, p));
|
||||||
SERIAL_CHAR(' ');
|
SERIAL_CHAR(' ');
|
||||||
#if ENABLED(LONG_FILENAME_HOST_SUPPORT)
|
|
||||||
if (!includeLongNames)
|
|
||||||
#endif
|
|
||||||
SERIAL_ECHOLN(p.fileSize);
|
|
||||||
#if ENABLED(LONG_FILENAME_HOST_SUPPORT)
|
|
||||||
else {
|
|
||||||
SERIAL_ECHO(p.fileSize);
|
SERIAL_ECHO(p.fileSize);
|
||||||
|
#if ENABLED(LONG_FILENAME_HOST_SUPPORT)
|
||||||
|
if (includeLongNames) {
|
||||||
SERIAL_CHAR(' ');
|
SERIAL_CHAR(' ');
|
||||||
if (prependLong) {
|
if (prependLong) { SERIAL_ECHO(prependLong); SERIAL_CHAR('/'); }
|
||||||
SERIAL_ECHO(prependLong);
|
SERIAL_ECHO(longFilename[0] ? longFilename : "???");
|
||||||
SERIAL_CHAR('/');
|
|
||||||
}
|
|
||||||
SERIAL_ECHOLN(longFilename[0] ? longFilename : "???");
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
SERIAL_EOL();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -348,7 +333,7 @@ void CardReader::printListing(
|
|||||||
void CardReader::ls(TERN_(LONG_FILENAME_HOST_SUPPORT, bool includeLongNames/*=false*/)) {
|
void CardReader::ls(TERN_(LONG_FILENAME_HOST_SUPPORT, bool includeLongNames/*=false*/)) {
|
||||||
if (flag.mounted) {
|
if (flag.mounted) {
|
||||||
root.rewind();
|
root.rewind();
|
||||||
printListing(root OPTARG(LONG_FILENAME_HOST_SUPPORT, includeLongNames));
|
printListing(root, nullptr OPTARG(LONG_FILENAME_HOST_SUPPORT, includeLongNames));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -336,9 +336,8 @@ private:
|
|||||||
static void selectByIndex(SdFile dir, const uint8_t index);
|
static void selectByIndex(SdFile dir, const uint8_t index);
|
||||||
static void selectByName(SdFile dir, const char * const match);
|
static void selectByName(SdFile dir, const char * const match);
|
||||||
static void printListing(
|
static void printListing(
|
||||||
SdFile parent
|
SdFile parent, const char * const prepend
|
||||||
OPTARG(LONG_FILENAME_HOST_SUPPORT, const bool includeLongNames=false)
|
OPTARG(LONG_FILENAME_HOST_SUPPORT, const bool includeLongNames=false)
|
||||||
, const char * const prepend=nullptr
|
|
||||||
OPTARG(LONG_FILENAME_HOST_SUPPORT, const char * const prependLong=nullptr)
|
OPTARG(LONG_FILENAME_HOST_SUPPORT, const char * const prependLong=nullptr)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user