diff --git a/Firmware/mesh_bed_calibration.cpp b/Firmware/mesh_bed_calibration.cpp index 62bcca3c..006cc487 100644 --- a/Firmware/mesh_bed_calibration.cpp +++ b/Firmware/mesh_bed_calibration.cpp @@ -3129,6 +3129,11 @@ void mbl_settings_init() { } } +//parameter ix: index of mesh bed leveling point in X-axis (for meas_points == 7 is valid range from 0 to 6; for meas_points == 3 is valid range from 0 to 2 ) +//parameter iy: index of mesh bed leveling point in Y-axis (for meas_points == 7 is valid range from 0 to 6; for meas_points == 3 is valid range from 0 to 2 ) +//parameter meas_points: number of mesh bed leveling points in one axis; currently designed and tested for values 3 and 7 +//parameter zigzag: false if ix is considered 0 on left side of bed and ix rises with rising X coordinate; true if ix is considered 0 on the right side of heatbed for odd iy values (zig zag mesh bed leveling movements) +//function returns true if point is considered valid (typicaly in safe distance from magnet or another object which inflences PINDA measurements) bool mbl_point_measurement_valid(uint8_t ix, uint8_t iy, uint8_t meas_points, bool zigzag) { //"human readable" heatbed plan //magnet proximity influence Z coordinate measurements significantly (40 - 100 um) @@ -3138,13 +3143,14 @@ bool mbl_point_measurement_valid(uint8_t ix, uint8_t iy, uint8_t meas_points, bo uint8_t valid_points_mask[7] = { //[X_MAX,Y_MAX] - 0b1111111, - 0b1111111, - 0b1110111, - 0b1111011, - 0b1110111, - 0b1111111, - 0b1111111, + //0123456 + 0b1111111,//6 + 0b1111111,//5 + 0b1110111,//4 + 0b1111011,//3 + 0b1110111,//2 + 0b1111111,//1 + 0b1111111,//0 //[0,0] }; if (meas_points == 3) { diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 5128c77a..017df6a9 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -6675,20 +6675,20 @@ static void lcd_tune_menu() MENU_END(); } -static void mbl_magnets_elimination_set() { +static void mbl_magnets_elimination_toggle() { bool magnet_elimination = (eeprom_read_byte((uint8_t*)EEPROM_MBL_MAGNET_ELIMINATION) > 0); magnet_elimination = !magnet_elimination; eeprom_update_byte((uint8_t*)EEPROM_MBL_MAGNET_ELIMINATION, (uint8_t)magnet_elimination); } -static void mbl_mesh_set() { +static void mbl_mesh_toggle() { uint8_t mesh_nr = eeprom_read_byte((uint8_t*)EEPROM_MBL_POINTS_NR); if(mesh_nr == 3) mesh_nr = 7; else mesh_nr = 3; eeprom_update_byte((uint8_t*)EEPROM_MBL_POINTS_NR, mesh_nr); } -static void mbl_probe_nr_set() { +static void mbl_probe_nr_toggle() { mbl_z_probe_nr = eeprom_read_byte((uint8_t*)EEPROM_MBL_PROBE_NR); switch (mbl_z_probe_nr) { case 1: mbl_z_probe_nr = 3; break; @@ -6707,16 +6707,16 @@ static void lcd_mesh_bed_leveling_settings() MENU_BEGIN(); MENU_ITEM_BACK_P(_T(MSG_SETTINGS)); - if(points_nr == 3) MENU_ITEM_FUNCTION_P(_i("Mesh [3x3]"), mbl_mesh_set); ////MSG_MESH_3x3 c=18 r=0 - else MENU_ITEM_FUNCTION_P(_i("Mesh [7x7]"), mbl_mesh_set); ////MSG_MESH_7x7 c=18 r=0 + if(points_nr == 3) MENU_ITEM_FUNCTION_P(_i("Mesh [3x3]"), mbl_mesh_toggle); ////MSG_MESH_3x3 c=18 r=0 + else MENU_ITEM_FUNCTION_P(_i("Mesh [7x7]"), mbl_mesh_toggle); ////MSG_MESH_7x7 c=18 r=0 switch (mbl_z_probe_nr) { - case 1: MENU_ITEM_FUNCTION_P(_i("Z-probe nr. [1]"), mbl_probe_nr_set); break; ////MSG_Z_PROBE_NR_1 c=18 r=0 - case 5: MENU_ITEM_FUNCTION_P(_i("Z-probe nr. [5]"), mbl_probe_nr_set); break; ////MSG_Z_PROBE_NR_1 c=18 r=0 - default: MENU_ITEM_FUNCTION_P(_i("Z-probe nr. [3]"), mbl_probe_nr_set); break; ////MSG_Z_PROBE_NR_1 c=18 r=0 + case 1: MENU_ITEM_FUNCTION_P(_i("Z-probe nr. [1]"), mbl_probe_nr_toggle); break; ////MSG_Z_PROBE_NR_1 c=18 r=0 + case 5: MENU_ITEM_FUNCTION_P(_i("Z-probe nr. [5]"), mbl_probe_nr_toggle); break; ////MSG_Z_PROBE_NR_1 c=18 r=0 + default: MENU_ITEM_FUNCTION_P(_i("Z-probe nr. [3]"), mbl_probe_nr_toggle); break; ////MSG_Z_PROBE_NR_1 c=18 r=0 } if (points_nr == 7) { - if (magnet_elimination) MENU_ITEM_FUNCTION_P(_i("Magnets comp. [On]"), mbl_magnets_elimination_set); ////MSG_MAGNETS_COMP_ON c=18 r=0 - else MENU_ITEM_FUNCTION_P(_i("Magnets comp.[Off]"), mbl_magnets_elimination_set); ////MSG_MAGNETS_COMP_OFF c=18 r=0 + if (magnet_elimination) MENU_ITEM_FUNCTION_P(_i("Magnets comp. [On]"), mbl_magnets_elimination_toggle); ////MSG_MAGNETS_COMP_ON c=18 r=0 + else MENU_ITEM_FUNCTION_P(_i("Magnets comp.[Off]"), mbl_magnets_elimination_toggle); ////MSG_MAGNETS_COMP_OFF c=18 r=0 } else menu_item_text_P(_i("Magnets comp.[N/A]")); ////MSG_MAGNETS_COMP_NA c=18 r=0 MENU_END();