Add experimental menu to HW_setup

This commit is contained in:
Alex Voinea 2020-07-29 11:23:24 +03:00
parent a95feb56d9
commit ec6a20971e
No known key found for this signature in database
GPG Key ID: F5034E7CFCF2F973
4 changed files with 37 additions and 9 deletions

View File

@ -8569,14 +8569,6 @@ Sigma_Exit:
}
break;
/*!
### M666 - Enter experimental menu
Only used by Prusa
*/
case 666:
menu_submenu(lcd_experimental_menu);
break;
/*!
### M999 - Restart after being stopped <a href="https://reprap.org/wiki/G-code#M999:_Restart_after_being_stopped_by_error">M999: Restart after being stopped by error</a>
@todo Usually doesn't work. Should be fixed or removed. Most of the time, if `Stopped` it set, the print fails and is unrecoverable.

View File

@ -359,6 +359,8 @@ static_assert(sizeof(Sheets) == EEPROM_SHEETS_SIZEOF, "Sizeof(Sheets) is not EEP
| ^ | ^ | ^ | 00h 0 | ^ | LCD backlight mode: __Dim__ | ^ | ^
| 0x0D30 3376 | uint16 | EEPROM_BACKLIGHT_TIMEOUT | 01 00 - ff ff | 0a 00h 65535 | LCD backlight timeout: __10__ seconds | LCD menu | D3 Ax0d30 C2
| 0x0D2C 3372 | float | EEPROM_UVLO_LA_K | ??? | ff ff ff ffh | Power panic saved Linear Advanced K value | ??? | D3 Ax0d2c C4
| 0x0D2B 3371 | uint8 | EEPROM_ALTFAN_OVERRIDE | 0-1 | 00h | ALTFAN override | LCD menu | D3 Ax0d2b C1
| 0x0D2A 3370 | uint8 | EEPROM_EXPERIMENTAL_VISIBILITY | 0-1 | 00h | Experimental menu visibility | LCD menu | D3 Ax0d2a C1
| Address begin | Bit/Type | Name | Valid values | Default/FactoryReset | Description | Gcode/Function| Debug code
@ -562,9 +564,10 @@ static Sheets * const EEPROM_Sheets_base = (Sheets*)(EEPROM_SHEETS_BASE);
#define EEPROM_UVLO_LA_K (EEPROM_BACKLIGHT_TIMEOUT-4) // float
#define EEPROM_ALTFAN_OVERRIDE (EEPROM_UVLO_LA_K-1) //uint8
#define EEPROM_EXPERIMENTAL_VISIBILITY (EEPROM_ALTFAN_OVERRIDE-1) //uint8
//This is supposed to point to last item to allow EEPROM overrun check. Please update when adding new items.
#define EEPROM_LAST_ITEM EEPROM_ALTFAN_OVERRIDE
#define EEPROM_LAST_ITEM EEPROM_EXPERIMENTAL_VISIBILITY
// !!!!!
// !!!!! this is end of EEPROM section ... all updates MUST BE inserted before this mark !!!!!
// !!!!!

View File

@ -2113,6 +2113,7 @@ static void lcd_support_menu()
bool is_flash_air; // 1byte
uint8_t ip[4]; // 4bytes
char ip_str[3*4+3+1]; // 16bytes
uint8_t experimental_menu_visibility;
} _menu_data_t;
static_assert(sizeof(menu_data)>= sizeof(_menu_data_t),"_menu_data_t doesn't fit into menu_data");
_menu_data_t* _md = (_menu_data_t*)&(menu_data[0]);
@ -2126,6 +2127,14 @@ static void lcd_support_menu()
sprintf_P(_md->ip_str, PSTR("%d.%d.%d.%d"),
_md->ip[0], _md->ip[1],
_md->ip[2], _md->ip[3]);
_md->experimental_menu_visibility = eeprom_read_byte((uint8_t *)EEPROM_EXPERIMENTAL_VISIBILITY);
if (_md->experimental_menu_visibility == EEPROM_EMPTY_VALUE)
{
_md->experimental_menu_visibility = 0;
eeprom_update_byte((uint8_t *)EEPROM_EXPERIMENTAL_VISIBILITY, _md->experimental_menu_visibility);
}
} else if (_md->is_flash_air &&
_md->ip[0] == 0 && _md->ip[1] == 0 &&
_md->ip[2] == 0 && _md->ip[3] == 0 &&
@ -2210,6 +2219,12 @@ static void lcd_support_menu()
MENU_ITEM_SUBMENU_P(_i("Voltages"), lcd_menu_voltages);////MSG_MENU_VOLTAGES c=18 r=1
#endif //defined VOLT_BED_PIN || defined VOLT_PWR_PIN
if (_md->experimental_menu_visibility)
{
MENU_ITEM_SUBMENU_P(PSTR("Experimental"), lcd_experimental_menu);
}
#ifdef DEBUG_BUILD
MENU_ITEM_SUBMENU_P(PSTR("Debug"), lcd_menu_debug);////c=18 r=1
#endif /* DEBUG_BUILD */
@ -8997,6 +9012,13 @@ void menu_lcd_longpress_func(void)
lcd_quick_feedback();
return;
}
if (menu_menu == lcd_hw_setup_menu)
{
// only toggle the experimental menu visibility flag
lcd_quick_feedback();
lcd_experimental_toggle();
return;
}
// explicitely listed menus which are allowed to rise the move-z or live-adj-z functions
// The lists are not the same for both functions, so first decide which function is to be performed
@ -9161,6 +9183,16 @@ void lcd_crash_detect_disable()
}
#endif
void lcd_experimental_toggle()
{
uint8_t oldVal = eeprom_read_byte((uint8_t *)EEPROM_EXPERIMENTAL_VISIBILITY);
if (oldVal == EEPROM_EMPTY_VALUE)
oldVal = 0;
else
oldVal = !oldVal;
eeprom_update_byte((uint8_t *)EEPROM_EXPERIMENTAL_VISIBILITY, oldVal);
}
void lcd_experimental_menu()
{
MENU_BEGIN();

View File

@ -257,6 +257,7 @@ enum class WizState : uint8_t
void lcd_wizard(WizState state);
extern void lcd_experimental_toggle();
extern void lcd_experimental_menu();
#endif //ULTRALCD_H