Replace 'const float &' with 'const_float_t' (#21505)

This commit is contained in:
Scott Lahteine
2021-04-01 17:59:57 -05:00
committed by GitHub
parent 600ef1e47c
commit 62f37669dc
79 changed files with 376 additions and 366 deletions

View File

@@ -289,7 +289,7 @@ void scroll_screen(const uint8_t limit, const bool is_menu) {
#if HAS_LINE_TO_Z
void line_to_z(const float &z) {
void line_to_z(const_float_t z) {
current_position.z = z;
line_to_current_position(manual_feedrate_mm_s.z);
}

View File

@@ -40,7 +40,7 @@ typedef void (*selectFunc_t)();
#define SS_DEFAULT SS_CENTER
#if HAS_MARLINUI_U8GLIB && EITHER(BABYSTEP_ZPROBE_GFX_OVERLAY, MESH_EDIT_GFX_OVERLAY)
void _lcd_zoffset_overlay_gfx(const float zvalue);
void _lcd_zoffset_overlay_gfx(const_float_t zvalue);
#endif
#if ENABLED(BABYSTEP_ZPROBE_OFFSET) && Z_PROBE_OFFSET_RANGE_MIN >= -9 && Z_PROBE_OFFSET_RANGE_MAX <= 9
@@ -212,11 +212,7 @@ void _lcd_draw_homing();
#define HAS_LINE_TO_Z ANY(DELTA, PROBE_MANUALLY, MESH_BED_LEVELING, LEVEL_BED_CORNERS)
#if HAS_LINE_TO_Z
void line_to_z(const float &z);
#endif
#if HAS_MARLINUI_U8GLIB && EITHER(BABYSTEP_ZPROBE_GFX_OVERLAY, MESH_EDIT_GFX_OVERLAY)
void _lcd_zoffset_overlay_gfx(const float zvalue);
void line_to_z(const_float_t z);
#endif
#if ENABLED(PROBE_OFFSET_WIZARD)

View File

@@ -86,7 +86,7 @@ void _man_probe_pt(const xy_pos_t &xy) {
ui.goto_screen(_lcd_calibrate_homing);
}
void _goto_tower_a(const float &a) {
void _goto_tower_a(const_float_t a) {
xy_pos_t tower_vec = { cos(RADIANS(a)), sin(RADIANS(a)) };
_man_probe_pt(tower_vec * delta_calibration_radius());
}

View File

@@ -77,8 +77,8 @@ template<typename NAME>
class TMenuEditItem : MenuEditItemBase {
private:
typedef typename NAME::type_t type_t;
static inline float scale(const float value) { return NAME::scale(value); }
static inline float unscale(const float value) { return NAME::unscale(value); }
static inline float scale(const_float_t value) { return NAME::scale(value); }
static inline float unscale(const_float_t value) { return NAME::unscale(value); }
static const char* to_string(const int32_t value) { return NAME::strfunc(unscale(value)); }
static void load(void *ptr, const int32_t value) { *((type_t*)ptr) = unscale(value); }
public:
@@ -114,9 +114,9 @@ class TMenuEditItem : MenuEditItemBase {
#define DEFINE_MENU_EDIT_ITEM_TYPE(NAME, TYPE, STRFUNC, SCALE, V...) \
struct MenuEditItemInfo_##NAME { \
typedef TYPE type_t; \
static inline float scale(const float value) { return value * (SCALE) + (V+0); } \
static inline float unscale(const float value) { return value / (SCALE) + (V+0); } \
static inline const char* strfunc(const float value) { return STRFUNC(_DOFIX(TYPE,value)); } \
static inline float scale(const_float_t value) { return value * (SCALE) + (V+0); } \
static inline float unscale(const_float_t value) { return value / (SCALE) + (V+0); } \
static inline const char* strfunc(const_float_t value) { return STRFUNC(_DOFIX(TYPE,value)); } \
}; \
typedef TMenuEditItem<MenuEditItemInfo_##NAME> MenuItem_##NAME

View File

@@ -149,7 +149,7 @@ void lcd_move_z() { _lcd_move_xyz(GET_TEXT(MSG_MOVE_Z), Z_AXIS); }
screenFunc_t _manual_move_func_ptr;
void _goto_manual_move(const float scale) {
void _goto_manual_move(const_float_t scale) {
ui.defer_status_screen();
ui.manual_move.menu_scale = scale;
ui.goto_screen(_manual_move_func_ptr);

View File

@@ -58,14 +58,14 @@ inline void z_clearance_move() {
);
}
void set_offset_and_go_back(const float &z) {
void set_offset_and_go_back(const_float_t z) {
probe.offset.z = z;
SET_SOFT_ENDSTOP_LOOSE(false);
TERN_(HAS_LEVELING, set_bed_leveling_enabled(leveling_was_active));
ui.goto_previous_screen_no_defer();
}
void _goto_manual_move_z(const float scale) {
void _goto_manual_move_z(const_float_t scale) {
ui.manual_move.menu_scale = scale;
ui.goto_screen(lcd_move_z);
}

View File

@@ -92,7 +92,7 @@ void _lcd_mesh_fine_tune(PGM_P const msg) {
// Init mesh editing and go to the fine tuning screen (ubl.fine_tune_mesh)
// To capture encoder events UBL will also call ui.capture and ui.release.
//
void MarlinUI::ubl_mesh_edit_start(const float &initial) {
void MarlinUI::ubl_mesh_edit_start(const_float_t initial) {
TERN_(HAS_GRAPHICAL_TFT, clear_lcd());
mesh_edit_accumulator = initial;
goto_screen([]{ _lcd_mesh_fine_tune(GET_TEXT(MSG_MESH_EDIT_Z)); });