Move axis_homed, axis_known_position to motion.*
This commit is contained in:
parent
946cf8b453
commit
44f2a82a56
9 changed files with 31 additions and 31 deletions
|
@ -160,17 +160,6 @@
|
||||||
|
|
||||||
bool Running = true;
|
bool Running = true;
|
||||||
|
|
||||||
/**
|
|
||||||
* axis_homed
|
|
||||||
* Flags that each linear axis was homed.
|
|
||||||
* XYZ on cartesian, ABC on delta, ABZ on SCARA.
|
|
||||||
*
|
|
||||||
* axis_known_position
|
|
||||||
* Flags that the position is known in each linear axis. Set when homed.
|
|
||||||
* Cleared whenever a stepper powers off, potentially losing its position.
|
|
||||||
*/
|
|
||||||
uint8_t axis_homed, axis_known_position; // = 0
|
|
||||||
|
|
||||||
#if ENABLED(TEMPERATURE_UNITS_SUPPORT)
|
#if ENABLED(TEMPERATURE_UNITS_SUPPORT)
|
||||||
TempUnit input_temp_units = TEMPUNIT_C;
|
TempUnit input_temp_units = TEMPUNIT_C;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -189,12 +189,6 @@ extern bool Running;
|
||||||
inline bool IsRunning() { return Running; }
|
inline bool IsRunning() { return Running; }
|
||||||
inline bool IsStopped() { return !Running; }
|
inline bool IsStopped() { return !Running; }
|
||||||
|
|
||||||
extern uint8_t axis_homed, axis_known_position;
|
|
||||||
|
|
||||||
constexpr uint8_t xyz_bits = _BV(X_AXIS) | _BV(Y_AXIS) | _BV(Z_AXIS);
|
|
||||||
FORCE_INLINE bool all_axes_homed() { return (axis_homed & xyz_bits) == xyz_bits; }
|
|
||||||
FORCE_INLINE bool all_axes_known() { return (axis_known_position & xyz_bits) == xyz_bits; }
|
|
||||||
|
|
||||||
extern volatile bool wait_for_heatup;
|
extern volatile bool wait_for_heatup;
|
||||||
|
|
||||||
#if HAS_RESUME_CONTINUE
|
#if HAS_RESUME_CONTINUE
|
||||||
|
|
|
@ -28,7 +28,6 @@
|
||||||
#include "../../module/motion.h"
|
#include "../../module/motion.h"
|
||||||
#include "../../lcd/ultralcd.h"
|
#include "../../lcd/ultralcd.h"
|
||||||
#include "../../libs/buzzer.h"
|
#include "../../libs/buzzer.h"
|
||||||
#include "../../Marlin.h" // for axis_homed
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* M206: Set Additional Homing Offset (X Y Z). SCARA aliases T=X, P=Y
|
* M206: Set Additional Homing Offset (X Y Z). SCARA aliases T=X, P=Y
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
* location: <http://www.gnu.org/licenses/>. *
|
* location: <http://www.gnu.org/licenses/>. *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "../../Marlin.h"
|
#include "../../inc/MarlinConfigPre.h"
|
||||||
|
|
||||||
#if ENABLED(EXTENSIBLE_UI)
|
#if ENABLED(EXTENSIBLE_UI)
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@ namespace UI {
|
||||||
// Machine was killed, reinit SysTick so we are able to compute time without ISRs
|
// Machine was killed, reinit SysTick so we are able to compute time without ISRs
|
||||||
if (currTimeHI == 0) {
|
if (currTimeHI == 0) {
|
||||||
// Get the last time the Arduino time computed (from CMSIS) and convert it to SysTick
|
// Get the last time the Arduino time computed (from CMSIS) and convert it to SysTick
|
||||||
currTimeHI = (uint32_t)((GetTickCount() * (uint64_t)(F_CPU/8000)) >> 24);
|
currTimeHI = (uint32_t)((GetTickCount() * (uint64_t)(F_CPU / 8000)) >> 24);
|
||||||
|
|
||||||
// Reinit the SysTick timer to maximize its period
|
// Reinit the SysTick timer to maximize its period
|
||||||
SysTick->LOAD = SysTick_LOAD_RELOAD_Msk; // get the full range for the systick timer
|
SysTick->LOAD = SysTick_LOAD_RELOAD_Msk; // get the full range for the systick timer
|
||||||
|
@ -136,7 +136,7 @@ namespace UI {
|
||||||
#else
|
#else
|
||||||
|
|
||||||
// TODO: Implement for AVR
|
// TODO: Implement for AVR
|
||||||
uint32_t safe_millis() { return millis(); }
|
FORCE_INLINE uint32_t safe_millis() { return millis(); }
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -399,6 +399,7 @@ namespace UI {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(JUNCTION_DEVIATION)
|
#if ENABLED(JUNCTION_DEVIATION)
|
||||||
|
|
||||||
float getJunctionDeviation_mm() {
|
float getJunctionDeviation_mm() {
|
||||||
return planner.junction_deviation_mm;
|
return planner.junction_deviation_mm;
|
||||||
}
|
}
|
||||||
|
@ -407,13 +408,15 @@ namespace UI {
|
||||||
planner.junction_deviation_mm = clamp(value, 0.01, 0.3);
|
planner.junction_deviation_mm = clamp(value, 0.01, 0.3);
|
||||||
planner.recalculate_max_e_jerk();
|
planner.recalculate_max_e_jerk();
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
float getAxisMaxJerk_mm_s(const axis_t axis) {
|
float getAxisMaxJerk_mm_s(const axis_t axis) {
|
||||||
return planner.max_jerk[axis];
|
return planner.max_jerk[axis];
|
||||||
}
|
}
|
||||||
|
|
||||||
float getAxisMaxJerk_mm_s(const extruder_t extruder) {
|
float getAxisMaxJerk_mm_s(const extruder_t extruder) {
|
||||||
return planner.max_jerk[E_AXIS];
|
return planner.max_jerk[E_AXIS];
|
||||||
}
|
}
|
||||||
|
|
||||||
void setAxisMaxJerk_mm_s(const float value, const axis_t axis) {
|
void setAxisMaxJerk_mm_s(const float value, const axis_t axis) {
|
||||||
|
|
|
@ -188,7 +188,7 @@
|
||||||
//
|
//
|
||||||
void _lcd_level_bed_continue() {
|
void _lcd_level_bed_continue() {
|
||||||
defer_return_to_status = true;
|
defer_return_to_status = true;
|
||||||
axis_homed = 0;
|
set_all_unhomed();
|
||||||
lcd_goto_screen(_lcd_level_bed_homing);
|
lcd_goto_screen(_lcd_level_bed_homing);
|
||||||
enqueue_and_echo_commands_P(PSTR("G28"));
|
enqueue_and_echo_commands_P(PSTR("G28"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -502,7 +502,7 @@ void _lcd_ubl_output_map_lcd() {
|
||||||
*/
|
*/
|
||||||
void _lcd_ubl_output_map_lcd_cmd() {
|
void _lcd_ubl_output_map_lcd_cmd() {
|
||||||
if (!all_axes_known()) {
|
if (!all_axes_known()) {
|
||||||
axis_homed = 0;
|
set_all_unhomed();
|
||||||
enqueue_and_echo_commands_P(PSTR("G28"));
|
enqueue_and_echo_commands_P(PSTR("G28"));
|
||||||
}
|
}
|
||||||
lcd_goto_screen(_lcd_ubl_map_homing);
|
lcd_goto_screen(_lcd_ubl_map_homing);
|
||||||
|
|
|
@ -73,7 +73,7 @@ void recalc_delta_settings() {
|
||||||
delta_diagonal_rod_2_tower[B_AXIS] = sq(delta_diagonal_rod + drt[B_AXIS]);
|
delta_diagonal_rod_2_tower[B_AXIS] = sq(delta_diagonal_rod + drt[B_AXIS]);
|
||||||
delta_diagonal_rod_2_tower[C_AXIS] = sq(delta_diagonal_rod + drt[C_AXIS]);
|
delta_diagonal_rod_2_tower[C_AXIS] = sq(delta_diagonal_rod + drt[C_AXIS]);
|
||||||
update_software_endstops(Z_AXIS);
|
update_software_endstops(Z_AXIS);
|
||||||
axis_homed = 0;
|
set_all_unhomed();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -68,6 +68,17 @@ XYZ_CONSTS(float, max_length, MAX_LENGTH);
|
||||||
XYZ_CONSTS(float, home_bump_mm, HOME_BUMP_MM);
|
XYZ_CONSTS(float, home_bump_mm, HOME_BUMP_MM);
|
||||||
XYZ_CONSTS(signed char, home_dir, HOME_DIR);
|
XYZ_CONSTS(signed char, home_dir, HOME_DIR);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* axis_homed
|
||||||
|
* Flags that each linear axis was homed.
|
||||||
|
* XYZ on cartesian, ABC on delta, ABZ on SCARA.
|
||||||
|
*
|
||||||
|
* axis_known_position
|
||||||
|
* Flags that the position is known in each linear axis. Set when homed.
|
||||||
|
* Cleared whenever a stepper powers off, potentially losing its position.
|
||||||
|
*/
|
||||||
|
uint8_t axis_homed, axis_known_position; // = 0
|
||||||
|
|
||||||
// Relative Mode. Enable with G91, disable with G90.
|
// Relative Mode. Enable with G91, disable with G90.
|
||||||
bool relative_mode; // = false;
|
bool relative_mode; // = false;
|
||||||
|
|
||||||
|
|
|
@ -26,9 +26,7 @@
|
||||||
* High-level motion commands to feed the planner
|
* High-level motion commands to feed the planner
|
||||||
* Some of these methods may migrate to the planner class.
|
* Some of these methods may migrate to the planner class.
|
||||||
*/
|
*/
|
||||||
|
#pragma once
|
||||||
#ifndef MOTION_H
|
|
||||||
#define MOTION_H
|
|
||||||
|
|
||||||
#include "../inc/MarlinConfig.h"
|
#include "../inc/MarlinConfig.h"
|
||||||
|
|
||||||
|
@ -36,6 +34,14 @@
|
||||||
#include "../module/scara.h"
|
#include "../module/scara.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Axis homed and known-position states
|
||||||
|
extern uint8_t axis_homed, axis_known_position;
|
||||||
|
constexpr uint8_t xyz_bits = _BV(X_AXIS) | _BV(Y_AXIS) | _BV(Z_AXIS);
|
||||||
|
FORCE_INLINE bool all_axes_homed() { return (axis_homed & xyz_bits) == xyz_bits; }
|
||||||
|
FORCE_INLINE bool all_axes_known() { return (axis_known_position & xyz_bits) == xyz_bits; }
|
||||||
|
FORCE_INLINE void set_all_unhomed() { axis_homed = 0; }
|
||||||
|
FORCE_INLINE void set_all_unknown() { axis_known_position = 0; }
|
||||||
|
|
||||||
// Error margin to work around float imprecision
|
// Error margin to work around float imprecision
|
||||||
constexpr float slop = 0.0001;
|
constexpr float slop = 0.0001;
|
||||||
|
|
||||||
|
@ -359,5 +365,3 @@ void homeaxis(const AxisEnum axis);
|
||||||
#if HAS_M206_COMMAND
|
#if HAS_M206_COMMAND
|
||||||
void set_home_offset(const AxisEnum axis, const float v);
|
void set_home_offset(const AxisEnum axis, const float v);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // MOTION_H
|
|
||||||
|
|
Reference in a new issue