G20/21 and M149 support, and code_value() refactor
This is an update of MarlinDev PR #196. G20/21: support for switching input units between millimeters and inches. M149: support for changing input temperature units. In support of these changes, code_value() and code_value_short() are replaced with an array of functions which handle converting to the proper types and/or units.
This commit is contained in:
		
				
					committed by
					
						
						Scott Lahteine
					
				
			
			
				
	
			
			
			
						parent
						
							a569e89775
						
					
				
				
					commit
					16212432c9
				
			@@ -217,6 +217,9 @@ enum AxisEnum {NO_AXIS = -1, X_AXIS = 0, A_AXIS = 0, Y_AXIS = 1, B_AXIS = 1, Z_A
 | 
			
		||||
 | 
			
		||||
#define _AXIS(AXIS) AXIS ##_AXIS
 | 
			
		||||
 | 
			
		||||
typedef enum { LINEARUNIT_MM = 0, LINEARUNIT_INCH = 1 } LinearUnit;
 | 
			
		||||
typedef enum { TEMPUNIT_C = 0, TEMPUNIT_K = 1, TEMPUNIT_F = 2 } TempUnit;
 | 
			
		||||
 | 
			
		||||
void enable_all_steppers();
 | 
			
		||||
void disable_all_steppers();
 | 
			
		||||
 | 
			
		||||
@@ -288,9 +291,20 @@ extern bool axis_homed[3]; // axis[n].is_homed
 | 
			
		||||
 | 
			
		||||
// GCode support for external objects
 | 
			
		||||
bool code_seen(char);
 | 
			
		||||
float code_value();
 | 
			
		||||
float code_value_float();
 | 
			
		||||
unsigned long code_value_ulong();
 | 
			
		||||
long code_value_long();
 | 
			
		||||
int16_t code_value_short();
 | 
			
		||||
int code_value_int();
 | 
			
		||||
uint16_t code_value_ushort();
 | 
			
		||||
uint8_t code_value_byte();
 | 
			
		||||
bool code_value_bool();
 | 
			
		||||
float code_value_linear_units();
 | 
			
		||||
float code_value_per_axis_unit(int axis);
 | 
			
		||||
float code_value_axis_units(int axis);
 | 
			
		||||
float code_value_temp_abs();
 | 
			
		||||
float code_value_temp_diff();
 | 
			
		||||
millis_t code_value_millis();
 | 
			
		||||
millis_t code_value_millis_from_seconds();
 | 
			
		||||
 | 
			
		||||
#if ENABLED(DELTA)
 | 
			
		||||
  extern float delta[3];
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user