Prusa MINI Firmware overview
babystep.h
Go to the documentation of this file.
1 /**
2  * Marlin 3D Printer Firmware
3  * Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4  *
5  * Based on Sprinter and grbl.
6  * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
7  *
8  * This program is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  *
21  */
22 #pragma once
23 
24 #include "../inc/MarlinConfigPre.h"
25 
26 #if IS_CORE || EITHER(BABYSTEP_XY, I2C_POSITION_ENCODERS)
27  #define BS_TODO_AXIS(A) A
28 #else
29  #define BS_TODO_AXIS(A) 0
30 #endif
31 
32 #if ENABLED(BABYSTEP_DISPLAY_TOTAL)
33  #if ENABLED(BABYSTEP_XY)
34  #define BS_TOTAL_AXIS(A) A
35  #else
36  #define BS_TOTAL_AXIS(A) 0
37  #endif
38 #endif
39 
40 class Babystep {
41 public:
42  static volatile int16_t steps[BS_TODO_AXIS(Z_AXIS) + 1];
43  static int16_t accum; // Total babysteps in current edit
44 
45  #if ENABLED(BABYSTEP_DISPLAY_TOTAL)
46  static int16_t axis_total[BS_TOTAL_AXIS(Z_AXIS) + 1]; // Total babysteps since G28
47  static inline void reset_total(const AxisEnum axis) {
48  if (true
49  #if ENABLED(BABYSTEP_XY)
50  && axis == Z_AXIS
51  #endif
52  ) axis_total[BS_TOTAL_AXIS(axis)] = 0;
53  }
54  #endif
55 
56  static void add_steps(const AxisEnum axis, const int16_t distance);
57  static void add_mm(const AxisEnum axis, const float &mm);
58  static void task();
59 private:
60  static void step_axis(const AxisEnum axis);
61 };
62 
63 extern Babystep babystep;
g29_auto.gcode
list gcode
Definition: g29_auto.py:44
stepper
Stepper stepper
Definition: stepper.cpp:82
babystep
Babystep babystep
AxisEnum
AxisEnum
Definition: types.h:36
BS_TODO_AXIS
#define BS_TODO_AXIS(A)
Definition: babystep.h:29
Babystep::accum
static int16_t accum
Definition: babystep.h:43
babystep.h
LOOP_XYZ
#define LOOP_XYZ(VAR)
Definition: types.h:60
planner_settings_t::axis_steps_per_mm
float axis_steps_per_mm[XYZE_N]
Definition: planner.h:181
Babystep::steps
static volatile int16_t steps[BS_TODO_AXIS(Z_AXIS)+1]
Definition: babystep.h:42
axis_known_position
uint8_t axis_known_position
Definition: motion.cpp:91
uint8_t
const uint8_t[]
Definition: 404_html.c:3
Babystep::task
static void task()
Z_AXIS
Definition: types.h:39
Babystep
Definition: babystep.h:40
Babystep::add_mm
static void add_mm(const AxisEnum axis, const float &mm)
Planner::settings
static planner_settings_t settings
Definition: planner.h:251
Babystep::add_steps
static void add_steps(const AxisEnum axis, const int16_t distance)
ENABLED
#define ENABLED(V...)
Definition: macros.h:177
planner
Planner planner
Definition: planner.cpp:111