Z-probe nr. states reduced to 1; 3; 5

This commit is contained in:
PavelSindler 2019-03-28 12:02:46 +01:00
parent 02faadf0b9
commit d22793f276
3 changed files with 20 additions and 14 deletions

View File

@ -21,7 +21,7 @@
#include "Configuration.h" #include "Configuration.h"
#include "pins.h" #include "pins.h"
#include "Timer.h" #include "Timer.h"
extern int mbl_z_probe_nr; extern uint8_t mbl_z_probe_nr;
#ifndef AT90USB #ifndef AT90USB
#define HardwareSerial_h // trick to disable the standard HWserial #define HardwareSerial_h // trick to disable the standard HWserial

View File

@ -167,7 +167,7 @@ CardReader card;
unsigned long PingTime = _millis(); unsigned long PingTime = _millis();
unsigned long NcTime; unsigned long NcTime;
int mbl_z_probe_nr = 3; //numer of Z measurements for each point in mesh bed leveling calibration uint8_t mbl_z_probe_nr = 3; //numer of Z measurements for each point in mesh bed leveling calibration
//used for PINDA temp calibration and pause print //used for PINDA temp calibration and pause print
#define DEFAULT_RETRACTION 1 #define DEFAULT_RETRACTION 1

View File

@ -6688,6 +6688,17 @@ static void mbl_mesh_set() {
eeprom_update_byte((uint8_t*)EEPROM_MBL_POINTS_NR, mesh_nr); eeprom_update_byte((uint8_t*)EEPROM_MBL_POINTS_NR, mesh_nr);
} }
static void mbl_probe_nr_set() {
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;
case 3: mbl_z_probe_nr = 5; break;
case 5: mbl_z_probe_nr = 1; break;
default: mbl_z_probe_nr = 3; break;
}
eeprom_update_byte((uint8_t*)EEPROM_MBL_PROBE_NR, mbl_z_probe_nr);
}
static void lcd_mesh_bed_leveling_settings() static void lcd_mesh_bed_leveling_settings()
{ {
@ -6695,25 +6706,20 @@ static void lcd_mesh_bed_leveling_settings()
uint8_t points_nr = eeprom_read_byte((uint8_t*)EEPROM_MBL_POINTS_NR); uint8_t points_nr = eeprom_read_byte((uint8_t*)EEPROM_MBL_POINTS_NR);
MENU_BEGIN(); MENU_BEGIN();
// leaving menu - this condition must be immediately before MENU_ITEM_BACK_P
if (((menu_item == menu_line) && menu_clicked && (lcd_encoder == menu_item)) || menu_leaving)
{
eeprom_update_byte((uint8_t*)EEPROM_MBL_PROBE_NR, (uint8_t)mbl_z_probe_nr);
}
MENU_ITEM_BACK_P(_T(MSG_SETTINGS)); MENU_ITEM_BACK_P(_T(MSG_SETTINGS));
if(points_nr == 3) MENU_ITEM_FUNCTION_P(_i("Mesh [3x3]"), mbl_mesh_set); 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); else MENU_ITEM_FUNCTION_P(_i("Mesh [7x7]"), mbl_mesh_set); ////MSG_MESH_7x7 c=18 r=0
MENU_ITEM_EDIT_int3_P(_i("Z-probe nr."), &mbl_z_probe_nr, 1, 5); 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
}
if (points_nr == 7) { if (points_nr == 7) {
if (magnet_elimination) MENU_ITEM_FUNCTION_P(_i("Magnets comp. [On]"), mbl_magnets_elimination_set); if (magnet_elimination) MENU_ITEM_FUNCTION_P(_i("Magnets comp. [On]"), mbl_magnets_elimination_set);
else MENU_ITEM_FUNCTION_P(_i("Magnets comp.[Off]"), mbl_magnets_elimination_set); else MENU_ITEM_FUNCTION_P(_i("Magnets comp.[Off]"), mbl_magnets_elimination_set);
} }
else menu_item_text_P(_i("Magnets comp.[N/A]")); else menu_item_text_P(_i("Magnets comp.[N/A]"));
MENU_END(); MENU_END();
/*if(menu_leaving)
{
eeprom_update_byte((uint8_t*)EEPROM_MBL_POINTS_NR, mbl_z_probe_nr);
}*/
//SETTINGS_MBL_MODE; //SETTINGS_MBL_MODE;
} }