Просмотр исходного кода

Update position for UBL non-segmented activate/deactivate

Scott Lahteine 7 лет назад
Родитель
Сommit
e05c825a05
1 измененных файлов: 15 добавлений и 1 удалений
  1. 15
    1
      Marlin/src/feature/bedlevel/bedlevel.cpp

+ 15
- 1
Marlin/src/feature/bedlevel/bedlevel.cpp Просмотреть файл

99
           planner.unapply_leveling(current_position);
99
           planner.unapply_leveling(current_position);
100
         }
100
         }
101
       #else
101
       #else
102
-        planner.leveling_active = enable;                    // just flip the bit, current_position will be wrong until next move.
102
+        // UBL equivalents for apply/unapply_leveling
103
+        #if ENABLED(SKEW_CORRECTION)
104
+          float pos[XYZ] = { current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS] };
105
+          planner.skew(pos[X_AXIS], pos[Y_AXIS], pos[Z_AXIS]);
106
+        #else
107
+          const float (&pos)[XYZE] = current_position;
108
+        #endif
109
+        if (planner.leveling_active) {
110
+          current_position[Z_AXIS] += ubl.get_z_correction(pos[X_AXIS], pos[Y_AXIS], pos[Z_AXIS]);
111
+          planner.leveling_active = false;
112
+        }
113
+        else {
114
+          planner.leveling_active = true;
115
+          current_position[Z_AXIS] -= ubl.get_z_correction(pos[X_AXIS], pos[Y_AXIS], pos[Z_AXIS]);
116
+        }
103
       #endif
117
       #endif
104
 
118
 
105
     #else // OLDSCHOOL_ABL
119
     #else // OLDSCHOOL_ABL

Загрузка…
Отмена
Сохранить