From 77c3d7d7f7b7e7a6d7664c7c4d39acf2c33c6d30 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Wed, 7 Mar 2018 16:47:20 +0100 Subject: [PATCH] Review and document lcd_adjust_bed_reset() lcd_goto_menu() usage. --- Firmware/ultralcd.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 917479c3..228fd763 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -2389,6 +2389,14 @@ static void lcd_babystep_z() { static void lcd_adjust_bed(); +/** + * @brief adjust bed reset menu item function + * + * To be used as MENU_ITEM(function,...) inside lcd_adjust_bed submenu. In such case lcd_goto_menu usage + * is correct and doesn't break menuStack. + * Because we did not leave the menu, the menuData did not reset. + * Force refresh of the bed leveling data. + */ static void lcd_adjust_bed_reset() { eeprom_update_byte((unsigned char*)EEPROM_BED_CORRECTION_VALID, 1); @@ -2396,9 +2404,7 @@ static void lcd_adjust_bed_reset() eeprom_update_byte((unsigned char*)EEPROM_BED_CORRECTION_RIGHT, 0); eeprom_update_byte((unsigned char*)EEPROM_BED_CORRECTION_FRONT, 0); eeprom_update_byte((unsigned char*)EEPROM_BED_CORRECTION_REAR , 0); - lcd_goto_menu(lcd_adjust_bed, 0, false); - // Because we did not leave the menu, the menuData did not reset. - // Force refresh of the bed leveling data. + lcd_goto_menu(lcd_adjust_bed, 0, false); //doesn't break menuStack menuData.adjustBed.status = 0; }