save some memory by using shrink_to_fit on the homing arrays
authorJim Morris <morris@wolfman.com>
Wed, 11 Apr 2018 18:28:28 +0000 (19:28 +0100)
committerJim Morris <morris@wolfman.com>
Wed, 11 Apr 2018 18:28:28 +0000 (19:28 +0100)
src/modules/tools/endstops/Endstops.cpp

index 3a8fca1..07b4ff2 100644 (file)
@@ -202,6 +202,9 @@ bool Endstops::load_old_config()
     // if no pins defined then disable the module
     if(endstops.empty()) return false;
 
+    homing_axis.shrink_to_fit();
+    endstops.shrink_to_fit();
+
     get_global_configs();
 
     if(limit_enabled) {
@@ -362,6 +365,10 @@ bool Endstops::load_config()
         }
     }
 
+    // saves some memory
+    homing_axis.shrink_to_fit();
+    endstops.shrink_to_fit();
+
     // sets some endstop global configs applicable to all endstops
     get_global_configs();