Convert the endstop/homing configs to mm and mm/sec
authorJim Morris <morris@wolfman.com>
Tue, 6 Aug 2013 10:25:30 +0000 (03:25 -0700)
committerJim Morris <morris@wolfman.com>
Tue, 6 Aug 2013 10:25:30 +0000 (03:25 -0700)
update sample configs
Old config values in steps and steps/sec will still be accepted

ConfigSamples/Smoothieboard.Rostock/config
ConfigSamples/Smoothieboard/config
src/modules/tools/endstops/Endstops.cpp
src/modules/tools/endstops/Endstops.h

index 7f17114..7a5123e 100644 (file)
@@ -23,7 +23,7 @@ arm_radius                                   124.0            # this is the hori
 planner_queue_size                           64               # Size of the planning queue, must be a power of 2. 128 seems to be the maximum.
 acceleration                                 3000             # Acceleration in mm/second/second.
 acceleration_ticks_per_second                1000             # Number of times per second the speed is updated
-junction_deviation                           0.05             # Similar to the old "max_jerk", in millimeters, see : https://github.com/grbl/grbl/blob/master/planner.c#L409 
+junction_deviation                           0.05             # Similar to the old "max_jerk", in millimeters, see : https://github.com/grbl/grbl/blob/master/planner.c#L409
                                                               # and https://github.com/grbl/grbl/wiki/Configuring-Grbl-v0.8 . Lower values mean being more careful, higher values means being faster and have more jerk
 
 # Stepper module configuration
@@ -114,20 +114,20 @@ gamma_max_endstop                            1.29^            #
 gamma_homing_direction                       home_to_max      #
 gamma_max                                    300              #
 
-alpha_fast_homing_rate                       3000              # rates in steps/second 
-beta_fast_homing_rate                        3000              #
-gamma_fast_homing_rate                       3000              #
-alpha_slow_homing_rate                       1000              # 
-beta_slow_homing_rate                        1000              #
-gamma_slow_homing_rate                       1000              
+alpha_fast_homing_rate                       200              # homing feedrates in mm/second
+beta_fast_homing_rate                        200              #
+gamma_fast_homing_rate                       200              #
+alpha_slow_homing_rate                       20               #
+beta_slow_homing_rate                        20               #
+gamma_slow_homing_rate                       20
 
-alpha_homing_retract                         500               #
-beta_homing_retract                          500               #
-gamma_homing_retract                         500               #
+alpha_homing_retract                         5                 # retract/bounce distance after homing in mm
+beta_homing_retract                          5                 #
+gamma_homing_retract                         5                 #
 
-alpha_trim                                   0                 # software trim for alpha stepper endstop (in steps)
-beta_trim                                    0                 # software trim for beta stepper endstop (in steps)
-gamma_trim                                   0                 # software trim for gamma stepper endstop (in steps)
+alpha_trim                                   0                 # software trim for alpha stepper endstop (in mm)
+beta_trim                                    0                 # software trim for beta stepper endstop (in mm)
+gamma_trim                                   0                 # software trim for gamma stepper endstop (in mm)
 
 # Pause button
 pause_button_enable                          true             #
index 94ca4d2..bad5c05 100644 (file)
@@ -13,7 +13,7 @@ gamma_steps_per_mm                           1600             # Steps per mm for
 planner_queue_size                           64               # Size of the planning queue, must be a power of 2. 128 seems to be the maximum.
 acceleration                                 3000             # Acceleration in mm/second/second.
 acceleration_ticks_per_second                1000             # Number of times per second the speed is updated
-junction_deviation                           0.05             # Similar to the old "max_jerk", in millimeters, see : https://github.com/grbl/grbl/blob/master/planner.c#L409 
+junction_deviation                           0.05             # Similar to the old "max_jerk", in millimeters, see : https://github.com/grbl/grbl/blob/master/planner.c#L409
                                                               # and https://github.com/grbl/grbl/wiki/Configuring-Grbl-v0.8 . Lower values mean being more careful, higher values means being faster and have more jerk
 
 # Stepper module configuration
@@ -111,35 +111,35 @@ gamma_homing_direction                       home_to_min      #
 gamma_min                                    0                #
 gamma_max                                    200              #
 
-alpha_fast_homing_rate                       3000              # rates in steps/second 
-beta_fast_homing_rate                        3000              # depends on steps/mm setting above
-gamma_fast_homing_rate                       30000             # "
-alpha_slow_homing_rate                       1000              # "
-beta_slow_homing_rate                        1000              # "
-gamma_slow_homing_rate                       10000              
+alpha_fast_homing_rate_mm_s                  50               # feedrates in mm/second
+beta_fast_homing_rate_mm_s                   50               # "
+gamma_fast_homing_rate_mm_s                  4                # "
+alpha_slow_homing_rate_mm_s                  25               # "
+beta_slow_homing_rate_mm_s                   25               # "
+gamma_slow_homing_rate_mm_s                  2                # "
 
-alpha_homing_retract                         500               # "
-beta_homing_retract                          500               # "
-gamma_homing_retract                         5000              # "
+alpha_homing_retract_mm                      5                # distance in mm
+beta_homing_retract_mm                       5                # "
+gamma_homing_retract_mm                      1                # "
 
 # Pause button
 pause_button_enable                          true             #
 
 # Panel
 panel.enable                                 false             # set to true to enable the panel code
-panel.lcd                                    smoothiepanel     # set type of panel also viki_lcd, i2c_lcd is a generic i2c panel, panelolu2 
+panel.lcd                                    smoothiepanel     # set type of panel also viki_lcd, i2c_lcd is a generic i2c panel, panelolu2
 panel.encoder_a_pin                          1.22!^            # encoder pin
 panel.encoder_b_pin                          1.23!^            # encoder pin
 
 # Example for reprap discount GLCD
-# on glcd EXP1 is to left and EXP2 is to right, pin 1 is bottom left, pin 2 is top left etc. 
+# on glcd EXP1 is to left and EXP2 is to right, pin 1 is bottom left, pin 2 is top left etc.
 # +5v is EXP1 pin 10, Gnd is EXP1 pin 9
 #panel.lcd                                   reprap_discount_glcd     #
 #panel.spi_channel                           0                 # spi channel to use  ; GLCD EXP1 Pins 3,5 (MOSI, SCLK)
 #panel.spi_cs_pin                            0.16              # spi chip select     ; GLCD EXP1 Pin 4
 #panel.encoder_a_pin                         1.22!^            # encoder pin         ; GLCD EXP2 Pin 3
 #panel.encoder_b_pin                         1.23!^            # encoder pin         ; GLCD EXP2 Pin 5
-#panel.click_button_pin                      1.30!^            # click button        ; GLCD EXP1 Pin 2 
+#panel.click_button_pin                      1.30!^            # click button        ; GLCD EXP1 Pin 2
 #panel.buzz_pin                              1.31              # pin for buzzer      ; GLCD EXP1 Pin 1
 #panel.button_pause_pin                      2.11^             # kill/pause          ; GLCD EXP2 Pin 8
 
index bf1a45c..537c99c 100644 (file)
@@ -44,25 +44,41 @@ void Endstops::on_config_reload(void* argument){
     this->pins[3].from_string(         this->kernel->config->value(alpha_max_endstop_checksum          )->by_default("nc" )->as_string())->as_input();
     this->pins[4].from_string(         this->kernel->config->value(beta_max_endstop_checksum           )->by_default("nc" )->as_string())->as_input();
     this->pins[5].from_string(         this->kernel->config->value(gamma_max_endstop_checksum          )->by_default("nc" )->as_string())->as_input();
-    this->fast_rates[0]             =  this->kernel->config->value(alpha_fast_homing_rate_checksum     )->by_default(500  )->as_number();
-    this->fast_rates[1]             =  this->kernel->config->value(beta_fast_homing_rate_checksum      )->by_default(500  )->as_number();
-    this->fast_rates[2]             =  this->kernel->config->value(gamma_fast_homing_rate_checksum     )->by_default(5    )->as_number();
-    this->slow_rates[0]             =  this->kernel->config->value(alpha_slow_homing_rate_checksum     )->by_default(100  )->as_number();
-    this->slow_rates[1]             =  this->kernel->config->value(beta_slow_homing_rate_checksum      )->by_default(100  )->as_number();
-    this->slow_rates[2]             =  this->kernel->config->value(gamma_slow_homing_rate_checksum     )->by_default(5    )->as_number();
-    this->retract_steps[0]          =  this->kernel->config->value(alpha_homing_retract_checksum       )->by_default(30   )->as_number();
-    this->retract_steps[1]          =  this->kernel->config->value(beta_homing_retract_checksum        )->by_default(30   )->as_number();
-    this->retract_steps[2]          =  this->kernel->config->value(gamma_homing_retract_checksum       )->by_default(10   )->as_number();
-    this->trim[0]                   =  this->kernel->config->value(alpha_trim_checksum                 )->by_default(0   )->as_number();
-    this->trim[1]                   =  this->kernel->config->value(beta_trim_checksum                  )->by_default(0   )->as_number();
-    this->trim[2]                   =  this->kernel->config->value(gamma_trim_checksum                 )->by_default(0   )->as_number();
-    this->debounce_count            =  this->kernel->config->value(endstop_debounce_count_checksum     )->by_default(100  )->as_number();
-
-    // we need to know steps per mm for M206, TODO should probably use them for all settings
+
+    // we need to know steps per mm for M206, also use them for all settings
     this->steps_per_mm[0]           =  this->kernel->config->value(alpha_steps_per_mm_checksum         )->as_number();
     this->steps_per_mm[1]           =  this->kernel->config->value(beta_steps_per_mm_checksum          )->as_number();
     this->steps_per_mm[2]           =  this->kernel->config->value(gamma_steps_per_mm_checksum         )->as_number();
 
+    this->fast_rates[0]             =  this->kernel->config->value(alpha_fast_homing_rate_checksum     )->by_default(4000 )->as_number();
+    this->fast_rates[1]             =  this->kernel->config->value(beta_fast_homing_rate_checksum      )->by_default(4000 )->as_number();
+    this->fast_rates[2]             =  this->kernel->config->value(gamma_fast_homing_rate_checksum     )->by_default(6400 )->as_number();
+    this->slow_rates[0]             =  this->kernel->config->value(alpha_slow_homing_rate_checksum     )->by_default(2000 )->as_number();
+    this->slow_rates[1]             =  this->kernel->config->value(beta_slow_homing_rate_checksum      )->by_default(2000 )->as_number();
+    this->slow_rates[2]             =  this->kernel->config->value(gamma_slow_homing_rate_checksum     )->by_default(3200 )->as_number();
+    this->retract_steps[0]          =  this->kernel->config->value(alpha_homing_retract_checksum       )->by_default(400  )->as_number();
+    this->retract_steps[1]          =  this->kernel->config->value(beta_homing_retract_checksum        )->by_default(400  )->as_number();
+    this->retract_steps[2]          =  this->kernel->config->value(gamma_homing_retract_checksum       )->by_default(1600 )->as_number();
+
+    // newer mm based config values override the old ones, convert to steps/mm and steps, defaults to what was set in the older config settings above
+    this->fast_rates[0]=    this->kernel->config->value(alpha_fast_homing_rate_mm_checksum )->by_default(this->fast_rates[0]  / steps_per_mm[0])->as_number() * steps_per_mm[0];
+    this->fast_rates[1]=    this->kernel->config->value(beta_fast_homing_rate_mm_checksum  )->by_default(this->fast_rates[1]  / steps_per_mm[1])->as_number() * steps_per_mm[1];
+    this->fast_rates[2]=    this->kernel->config->value(gamma_fast_homing_rate_mm_checksum )->by_default(this->fast_rates[2]  / steps_per_mm[2])->as_number() * steps_per_mm[2];
+    this->slow_rates[0]=    this->kernel->config->value(alpha_slow_homing_rate_mm_checksum )->by_default(this->slow_rates[0]  / steps_per_mm[0])->as_number() * steps_per_mm[0];
+    this->slow_rates[1]=    this->kernel->config->value(beta_slow_homing_rate_mm_checksum  )->by_default(this->slow_rates[1]  / steps_per_mm[1])->as_number() * steps_per_mm[1];
+    this->slow_rates[2]=    this->kernel->config->value(gamma_slow_homing_rate_mm_checksum )->by_default(this->slow_rates[2]  / steps_per_mm[2])->as_number() * steps_per_mm[2];
+    this->retract_steps[0]= this->kernel->config->value(alpha_homing_retract_mm_checksum   )->by_default(this->retract_steps[0]/steps_per_mm[0])->as_number() * steps_per_mm[0];
+    this->retract_steps[1]= this->kernel->config->value(beta_homing_retract_mm_checksum    )->by_default(this->retract_steps[1]/steps_per_mm[1])->as_number() * steps_per_mm[1];
+    this->retract_steps[2]= this->kernel->config->value(gamma_homing_retract_mm_checksum   )->by_default(this->retract_steps[2]/steps_per_mm[2])->as_number() * steps_per_mm[2];
+
+    // endstop trim used by deltas to do soft adjusting, in mm, convert to steps
+    this->trim[0]         = this->kernel->config->value(alpha_trim_checksum                )->by_default(0  )->as_number() * steps_per_mm[0];
+    this->trim[1]         = this->kernel->config->value(beta_trim_checksum                 )->by_default(0  )->as_number() * steps_per_mm[0];
+    this->trim[2]         = this->kernel->config->value(gamma_trim_checksum                )->by_default(0  )->as_number() * steps_per_mm[0];
+
+    this->debounce_count  = this->kernel->config->value(endstop_debounce_count_checksum    )->by_default(100)->as_number();
+
+
     // get homing direction and convert to boolean where true is home to min, and false is home to max
     int home_dir                    = get_checksum(this->kernel->config->value(alpha_homing_direction_checksum)->by_default("home_to_min")->as_string());
     this->home_direction[0]         = home_dir != home_to_max_checksum;
index 4ed3742..7d2b15d 100644 (file)
@@ -38,6 +38,7 @@
 #define beta_trim_checksum               CHECKSUM("beta_trim")
 #define gamma_trim_checksum              CHECKSUM("gamma_trim")
 
+// these values are in steps and should be deprecated
 #define alpha_fast_homing_rate_checksum  CHECKSUM("alpha_fast_homing_rate")
 #define beta_fast_homing_rate_checksum   CHECKSUM("beta_fast_homing_rate")
 #define gamma_fast_homing_rate_checksum  CHECKSUM("gamma_fast_homing_rate")
 #define gamma_homing_retract_checksum    CHECKSUM("gamma_homing_retract")
 #define endstop_debounce_count_checksum  CHECKSUM("endstop_debounce_count")
 
+// same as above but in user friendly mm/s and mm
+#define alpha_fast_homing_rate_mm_checksum  CHECKSUM("alpha_fast_homing_rate_mm_s")
+#define beta_fast_homing_rate_mm_checksum   CHECKSUM("beta_fast_homing_rate_mm_s")
+#define gamma_fast_homing_rate_mm_checksum  CHECKSUM("gamma_fast_homing_rate_mm_s")
+
+#define alpha_slow_homing_rate_mm_checksum  CHECKSUM("alpha_slow_homing_rate_mm_s")
+#define beta_slow_homing_rate_mm_checksum   CHECKSUM("beta_slow_homing_rate_mm_s")
+#define gamma_slow_homing_rate_mm_checksum  CHECKSUM("gamma_slow_homing_rate_mm_s")
+
+#define alpha_homing_retract_mm_checksum    CHECKSUM("alpha_homing_retract_mm")
+#define beta_homing_retract_mm_checksum     CHECKSUM("beta_homing_retract_mm")
+#define gamma_homing_retract_mm_checksum    CHECKSUM("gamma_homing_retract_mm")
+
+#define endstop_debounce_count_checksum  CHECKSUM("endstop_debounce_count")
+
 #define alpha_homing_direction_checksum  CHECKSUM("alpha_homing_direction")
 #define beta_homing_direction_checksum   CHECKSUM("beta_homing_direction")
 #define gamma_homing_direction_checksum  CHECKSUM("gamma_homing_direction")