Pending refactor tweaks
This commit is contained in:
		
							parent
							
								
									9c218381c5
								
							
						
					
					
						commit
						d63e0f6d98
					
				| @ -70,10 +70,7 @@ void print_bin(const uint16_t val) { | |||||||
| 
 | 
 | ||||||
| void print_xyz(PGM_P const prefix, PGM_P const suffix, const float &x, const float &y, const float &z) { | void print_xyz(PGM_P const prefix, PGM_P const suffix, const float &x, const float &y, const float &z) { | ||||||
|   serialprintPGM(prefix); |   serialprintPGM(prefix); | ||||||
|   SERIAL_CHAR('('); |   SERIAL_ECHOPAIR(" " MSG_X, x, " " MSG_Y, y, " " MSG_Z, z); | ||||||
|   SERIAL_ECHO(x); |  | ||||||
|   SERIAL_ECHOPAIR(", ", y, ", ", z); |  | ||||||
|   SERIAL_CHAR(')'); |  | ||||||
|   if (suffix) serialprintPGM(suffix); else SERIAL_EOL(); |   if (suffix) serialprintPGM(suffix); else SERIAL_EOL(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -35,7 +35,7 @@ | |||||||
| 
 | 
 | ||||||
| Babystep babystep; | Babystep babystep; | ||||||
| 
 | 
 | ||||||
| volatile int16_t Babystep::todo[BS_TODO_AXIS(Z_AXIS) + 1]; | volatile int16_t Babystep::steps[BS_TODO_AXIS(Z_AXIS) + 1]; | ||||||
| 
 | 
 | ||||||
| #if HAS_LCD_MENU || ENABLED(EXTENSIBLE_UI) | #if HAS_LCD_MENU || ENABLED(EXTENSIBLE_UI) | ||||||
|   int16_t Babystep::accum; |   int16_t Babystep::accum; | ||||||
| @ -45,10 +45,10 @@ volatile int16_t Babystep::todo[BS_TODO_AXIS(Z_AXIS) + 1]; | |||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| void Babystep::step_axis(const AxisEnum axis) { | void Babystep::step_axis(const AxisEnum axis) { | ||||||
|   const int16_t curTodo = todo[BS_TODO_AXIS(axis)]; // get rid of volatile for performance
 |   const int16_t curTodo = steps[BS_TODO_AXIS(axis)]; // get rid of volatile for performance
 | ||||||
|   if (curTodo) { |   if (curTodo) { | ||||||
|     stepper.babystep((AxisEnum)axis, curTodo > 0); |     stepper.babystep((AxisEnum)axis, curTodo > 0); | ||||||
|     if (curTodo > 0) todo[BS_TODO_AXIS(axis)]--; else todo[BS_TODO_AXIS(axis)]++; |     if (curTodo > 0) steps[BS_TODO_AXIS(axis)]--; else steps[BS_TODO_AXIS(axis)]++; | ||||||
|   } |   } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -94,30 +94,30 @@ void Babystep::add_steps(const AxisEnum axis, const int16_t distance) { | |||||||
|         case CORE_AXIS_1: // X on CoreXY and CoreXZ, Y on CoreYZ
 |         case CORE_AXIS_1: // X on CoreXY and CoreXZ, Y on CoreYZ
 | ||||||
|           BSA_ENABLE(CORE_AXIS_1); |           BSA_ENABLE(CORE_AXIS_1); | ||||||
|           BSA_ENABLE(CORE_AXIS_2); |           BSA_ENABLE(CORE_AXIS_2); | ||||||
|           todo[CORE_AXIS_1] += distance * 2; |           steps[CORE_AXIS_1] += distance * 2; | ||||||
|           todo[CORE_AXIS_2] += distance * 2; |           steps[CORE_AXIS_2] += distance * 2; | ||||||
|           break; |           break; | ||||||
|         case CORE_AXIS_2: // Y on CoreXY, Z on CoreXZ and CoreYZ
 |         case CORE_AXIS_2: // Y on CoreXY, Z on CoreXZ and CoreYZ
 | ||||||
|           BSA_ENABLE(CORE_AXIS_1); |           BSA_ENABLE(CORE_AXIS_1); | ||||||
|           BSA_ENABLE(CORE_AXIS_2); |           BSA_ENABLE(CORE_AXIS_2); | ||||||
|           todo[CORE_AXIS_1] += CORESIGN(distance * 2); |           steps[CORE_AXIS_1] += CORESIGN(distance * 2); | ||||||
|           todo[CORE_AXIS_2] -= CORESIGN(distance * 2); |           steps[CORE_AXIS_2] -= CORESIGN(distance * 2); | ||||||
|           break; |           break; | ||||||
|         case NORMAL_AXIS: // Z on CoreXY, Y on CoreXZ, X on CoreYZ
 |         case NORMAL_AXIS: // Z on CoreXY, Y on CoreXZ, X on CoreYZ
 | ||||||
|         default: |         default: | ||||||
|           BSA_ENABLE(NORMAL_AXIS); |           BSA_ENABLE(NORMAL_AXIS); | ||||||
|           todo[NORMAL_AXIS] += distance; |           steps[NORMAL_AXIS] += distance; | ||||||
|           break; |           break; | ||||||
|       } |       } | ||||||
|     #elif CORE_IS_XZ || CORE_IS_YZ |     #elif CORE_IS_XZ || CORE_IS_YZ | ||||||
|       // Only Z stepping needs to be handled here
 |       // Only Z stepping needs to be handled here
 | ||||||
|       BSA_ENABLE(CORE_AXIS_1); |       BSA_ENABLE(CORE_AXIS_1); | ||||||
|       BSA_ENABLE(CORE_AXIS_2); |       BSA_ENABLE(CORE_AXIS_2); | ||||||
|       todo[CORE_AXIS_1] += CORESIGN(distance * 2); |       steps[CORE_AXIS_1] += CORESIGN(distance * 2); | ||||||
|       todo[CORE_AXIS_2] -= CORESIGN(distance * 2); |       steps[CORE_AXIS_2] -= CORESIGN(distance * 2); | ||||||
|     #else |     #else | ||||||
|       BSA_ENABLE(Z_AXIS); |       BSA_ENABLE(Z_AXIS); | ||||||
|       todo[Z_AXIS] += distance; |       steps[Z_AXIS] += distance; | ||||||
|     #endif |     #endif | ||||||
|   #else |   #else | ||||||
|     #if ENABLED(BABYSTEP_XY) |     #if ENABLED(BABYSTEP_XY) | ||||||
| @ -125,7 +125,7 @@ void Babystep::add_steps(const AxisEnum axis, const int16_t distance) { | |||||||
|     #else |     #else | ||||||
|       BSA_ENABLE(Z_AXIS); |       BSA_ENABLE(Z_AXIS); | ||||||
|     #endif |     #endif | ||||||
|     todo[BS_TODO_AXIS(axis)] += distance; |     steps[BS_TODO_AXIS(axis)] += distance; | ||||||
|   #endif |   #endif | ||||||
|   #if ENABLED(BABYSTEP_ALWAYS_AVAILABLE) |   #if ENABLED(BABYSTEP_ALWAYS_AVAILABLE) | ||||||
|     gcode.reset_stepper_timeout(); |     gcode.reset_stepper_timeout(); | ||||||
|  | |||||||
| @ -40,19 +40,25 @@ | |||||||
| 
 | 
 | ||||||
| class Babystep { | class Babystep { | ||||||
| public: | public: | ||||||
|   static volatile int16_t todo[BS_TODO_AXIS(Z_AXIS) + 1]; |   static volatile int16_t steps[BS_TODO_AXIS(Z_AXIS) + 1]; | ||||||
|  | 
 | ||||||
|   #if HAS_LCD_MENU || ENABLED(EXTENSIBLE_UI) |   #if HAS_LCD_MENU || ENABLED(EXTENSIBLE_UI) | ||||||
|  | 
 | ||||||
|     static int16_t accum;                                     // Total babysteps in current edit
 |     static int16_t accum;                                     // Total babysteps in current edit
 | ||||||
|  | 
 | ||||||
|     #if ENABLED(BABYSTEP_DISPLAY_TOTAL) |     #if ENABLED(BABYSTEP_DISPLAY_TOTAL) | ||||||
|       static int16_t axis_total[BS_TOTAL_AXIS(Z_AXIS) + 1];   // Total babysteps since G28
 |       static int16_t axis_total[BS_TOTAL_AXIS(Z_AXIS) + 1];   // Total babysteps since G28
 | ||||||
|       static inline void reset_total(const AxisEnum axis) { |       static inline void reset_total(const AxisEnum axis) { | ||||||
|         #if ENABLED(BABYSTEP_XY) |         if (true | ||||||
|           if (axis == Z_AXIS) |           #if ENABLED(BABYSTEP_XY) | ||||||
|         #endif |             && axis == Z_AXIS | ||||||
|             axis_total[BS_TOTAL_AXIS(axis)] = 0; |           #endif | ||||||
|  |         ) axis_total[BS_TOTAL_AXIS(axis)] = 0; | ||||||
|       } |       } | ||||||
|     #endif |     #endif | ||||||
|  | 
 | ||||||
|   #endif |   #endif | ||||||
|  | 
 | ||||||
|   static void add_steps(const AxisEnum axis, const int16_t distance); |   static void add_steps(const AxisEnum axis, const int16_t distance); | ||||||
|   static void add_mm(const AxisEnum axis, const float &mm); |   static void add_mm(const AxisEnum axis, const float &mm); | ||||||
|   static void task(); |   static void task(); | ||||||
|  | |||||||
| @ -43,6 +43,12 @@ | |||||||
| 
 | 
 | ||||||
| #include "../inc/MarlinConfig.h" | #include "../inc/MarlinConfig.h" | ||||||
| 
 | 
 | ||||||
|  | #include "planner.h" | ||||||
|  | #include "stepper/indirection.h" | ||||||
|  | #ifdef __AVR__ | ||||||
|  |   #include "speed_lookuptable.h" | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
| // Disable multiple steps per ISR
 | // Disable multiple steps per ISR
 | ||||||
| //#define DISABLE_MULTI_STEPPING
 | //#define DISABLE_MULTI_STEPPING
 | ||||||
| 
 | 
 | ||||||
| @ -217,16 +223,6 @@ | |||||||
| //
 | //
 | ||||||
| // Stepper class definition
 | // Stepper class definition
 | ||||||
| //
 | //
 | ||||||
| 
 |  | ||||||
| #include "stepper/indirection.h" |  | ||||||
| 
 |  | ||||||
| #ifdef __AVR__ |  | ||||||
|   #include "speed_lookuptable.h" |  | ||||||
| #endif |  | ||||||
| 
 |  | ||||||
| #include "planner.h" |  | ||||||
| #include "../core/language.h" |  | ||||||
| 
 |  | ||||||
| class Stepper { | class Stepper { | ||||||
| 
 | 
 | ||||||
|   public: |   public: | ||||||
|  | |||||||
| @ -16,7 +16,9 @@ set -e | |||||||
| # Test MESH_BED_LEVELING feature, with LCD | # Test MESH_BED_LEVELING feature, with LCD | ||||||
| # | # | ||||||
| restore_configs | restore_configs | ||||||
| opt_enable SPINDLE_FEATURE MESH_BED_LEVELING G26_MESH_VALIDATION MESH_G28_REST_ORIGIN LCD_BED_LEVELING MESH_EDIT_MENU ULTIMAKERCONTROLLER | opt_enable SPINDLE_FEATURE ULTIMAKERCONTROLLER LCD_BED_LEVELING \ | ||||||
|  |            MESH_BED_LEVELING ENABLE_LEVELING_FADE_HEIGHT MESH_G28_REST_ORIGIN \ | ||||||
|  |            G26_MESH_VALIDATION MESH_EDIT_MENU | ||||||
| exec_test $1 $2 "Spindle, MESH_BED_LEVELING, and LCD" | exec_test $1 $2 "Spindle, MESH_BED_LEVELING, and LCD" | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user