Fixed conflict with force_z, added P flags
This commit is contained in:
parent
487c7d63e1
commit
7214584723
|
|
@ -173,6 +173,7 @@ void manage_inactivity(bool ignore_stepper_queue=false);
|
||||||
#define enable_z() poweron_z()
|
#define enable_z() poweron_z()
|
||||||
#define disable_z() poweroff_z()
|
#define disable_z() poweroff_z()
|
||||||
#else
|
#else
|
||||||
|
extern bool bEnableForce_z; // Used by ultralcd stealth toggle
|
||||||
void init_force_z();
|
void init_force_z();
|
||||||
void check_force_z();
|
void check_force_z();
|
||||||
void enable_force_z();
|
void enable_force_z();
|
||||||
|
|
|
||||||
|
|
@ -8230,30 +8230,53 @@ Sigma_Exit:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#endif // TMC2130_SERVICE_CODES_M910_M918
|
#endif // TMC2130_SERVICE_CODES_M910_M918
|
||||||
/*!
|
/*!
|
||||||
### M914 - Set TMC2130 normal mode <a href="https://reprap.org/wiki/G-code#M914:_Set_TMC2130_normal_mode">M914: Set TMC2130 normal mode</a>
|
### M914 - Set TMC2130 normal mode <a href="https://reprap.org/wiki/G-code#M914:_Set_TMC2130_normal_mode">M914: Set TMC2130 normal mode</a>
|
||||||
|
Updates EEPROM only if "P" is given, otherwise temporary (lasts until reset or motor idle timeout)
|
||||||
|
#### Usage
|
||||||
|
|
||||||
|
M914 [P]
|
||||||
|
|
||||||
|
#### Parameters
|
||||||
|
- `P` - Make the mode change permanent (write to EEPROM)
|
||||||
*/
|
*/
|
||||||
#ifdef TMC2130
|
#ifdef TMC2130
|
||||||
case 914:
|
case 914:
|
||||||
{
|
{
|
||||||
printf_P(_n("tmc2130mode/smm/eep: %d %d %d\n"),tmc2130_mode,SilentModeMenu,eeprom_read_byte((uint8_t*)EEPROM_SILENT));
|
if (code_seen('P'))
|
||||||
if (tmc2130_mode != TMC2130_MODE_NORMAL)
|
{
|
||||||
|
eeprom_update_byte((unsigned char *)EEPROM_SILENT, SILENT_MODE_NORMAL);
|
||||||
|
SilentModeMenu = SILENT_MODE_NORMAL;
|
||||||
|
}
|
||||||
|
//printf_P(_n("tmc2130mode/smm/eep: %d %d %d %d"),tmc2130_mode,SilentModeMenu,eeprom_read_byte((uint8_t*)EEPROM_SILENT), bEnableForce_z);
|
||||||
|
if (tmc2130_mode != TMC2130_MODE_NORMAL)
|
||||||
{
|
{
|
||||||
tmc2130_mode = TMC2130_MODE_NORMAL;
|
tmc2130_mode = TMC2130_MODE_NORMAL;
|
||||||
update_mode_profile();
|
update_mode_profile();
|
||||||
tmc2130_init(TMCInitParams(false, FarmOrUserECool()));
|
tmc2130_init(TMCInitParams(false, FarmOrUserECool()));
|
||||||
printf_P(_n("tmc2130mode/smm/eep: %d %d %d\n"),tmc2130_mode,SilentModeMenu,eeprom_read_byte((uint8_t*)EEPROM_SILENT));
|
//printf_P(_n("tmc2130mode/smm/eep: %d %d %d\n"),tmc2130_mode,SilentModeMenu,eeprom_read_byte((uint8_t*)EEPROM_SILENT));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
### M915 - Set TMC2130 silent mode <a href="https://reprap.org/wiki/G-code#M915:_Set_TMC2130_silent_mode">M915: Set TMC2130 silent mode</a>
|
### M915 - Set TMC2130 silent mode <a href="https://reprap.org/wiki/G-code#M915:_Set_TMC2130_silent_mode">M915: Set TMC2130 silent mode</a>
|
||||||
Not active in default, only if `TMC2130_SERVICE_CODES_M910_M918` is defined in source code.
|
Updates EEPROM only if "P" is given, otherwise temporary (lasts until reset or motor idle timeout)
|
||||||
|
#### Usage
|
||||||
|
|
||||||
|
M915 [P]
|
||||||
|
|
||||||
|
#### Parameters
|
||||||
|
- `P` - Make the mode change permanent (write to EEPROM)
|
||||||
*/
|
*/
|
||||||
case 915:
|
case 915:
|
||||||
{
|
{
|
||||||
printf_P(_n("tmc2130mode/smm/eep: %d %d %d\n"),tmc2130_mode,SilentModeMenu,eeprom_read_byte((uint8_t*)EEPROM_SILENT));
|
if (code_seen('P'))
|
||||||
|
{
|
||||||
|
eeprom_update_byte((unsigned char *)EEPROM_SILENT, SILENT_MODE_STEALTH);
|
||||||
|
SilentModeMenu = SILENT_MODE_STEALTH;
|
||||||
|
}
|
||||||
|
//printf_P(_n("tmc2130mode/smm/eep: %d %d %d %d"),tmc2130_mode,SilentModeMenu,eeprom_read_byte((uint8_t*)EEPROM_SILENT), bEnableForce_z);
|
||||||
if (tmc2130_mode != TMC2130_MODE_SILENT)
|
if (tmc2130_mode != TMC2130_MODE_SILENT)
|
||||||
{ // This is basically the equivalent of force_high_power_mode for silent mode.
|
{ // This is basically the equivalent of force_high_power_mode for silent mode.
|
||||||
st_synchronize();
|
st_synchronize();
|
||||||
|
|
@ -8261,7 +8284,7 @@ Sigma_Exit:
|
||||||
tmc2130_mode = TMC2130_MODE_SILENT;
|
tmc2130_mode = TMC2130_MODE_SILENT;
|
||||||
update_mode_profile();
|
update_mode_profile();
|
||||||
tmc2130_init(TMCInitParams(false, FarmOrUserECool()));
|
tmc2130_init(TMCInitParams(false, FarmOrUserECool()));
|
||||||
printf_P(_n("tmc2130mode/smm/eep: %d %d %d\n"),tmc2130_mode,SilentModeMenu,eeprom_read_byte((uint8_t*)EEPROM_SILENT));
|
//printf_P(_n("tmc2130mode/smm/eep: %d %d %d\n"),tmc2130_mode,SilentModeMenu,eeprom_read_byte((uint8_t*)EEPROM_SILENT));
|
||||||
st_reset_timer();
|
st_reset_timer();
|
||||||
sei();
|
sei();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4218,16 +4218,25 @@ static void mmu_reset()
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TMC2130
|
#ifdef TMC2130
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef PSU_Delta // This setup changes to "stealth" mode on timeout, need to check for that.
|
||||||
|
#define SILENT_DESYNC_IF if (bDesync && bEnableForce_z)
|
||||||
|
#else
|
||||||
|
#define SILENT_DESYNC_IF if (bDesync)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#define SETTINGS_SILENT_MODE \
|
#define SETTINGS_SILENT_MODE \
|
||||||
do\
|
do\
|
||||||
{\
|
{\
|
||||||
if(!farm_mode)\
|
if(!farm_mode)\
|
||||||
{\
|
{\
|
||||||
/* M914/5 do not update eeprom, only tmc2130_mode */\
|
/* M914/5 do not update SilentModeMenu, only tmc2130_mode */\
|
||||||
bool bDesync = tmc2130_mode ^ eeprom_read_byte((uint8_t*)EEPROM_SILENT);\
|
bool bDesync = tmc2130_mode ^ eeprom_read_byte((uint8_t*)EEPROM_SILENT);\
|
||||||
if (SilentModeMenu == SILENT_MODE_NORMAL) \
|
if (SilentModeMenu == SILENT_MODE_NORMAL) \
|
||||||
{\
|
{\
|
||||||
if (bDesync)\
|
SILENT_DESYNC_IF\
|
||||||
MENU_ITEM_TOGGLE_P(_T(MSG_MODE), PSTR("M915"), lcd_silent_mode_set);\
|
MENU_ITEM_TOGGLE_P(_T(MSG_MODE), PSTR("M915"), lcd_silent_mode_set);\
|
||||||
else\
|
else\
|
||||||
MENU_ITEM_TOGGLE_P(_T(MSG_MODE), _T(MSG_NORMAL), lcd_silent_mode_set);\
|
MENU_ITEM_TOGGLE_P(_T(MSG_MODE), _T(MSG_NORMAL), lcd_silent_mode_set);\
|
||||||
|
|
@ -4238,7 +4247,7 @@ do\
|
||||||
MENU_ITEM_TOGGLE_P(_T(MSG_MODE), PSTR("M914") , lcd_silent_mode_set);\
|
MENU_ITEM_TOGGLE_P(_T(MSG_MODE), PSTR("M914") , lcd_silent_mode_set);\
|
||||||
else\
|
else\
|
||||||
MENU_ITEM_TOGGLE_P(_T(MSG_MODE), _T(MSG_STEALTH), lcd_silent_mode_set);\
|
MENU_ITEM_TOGGLE_P(_T(MSG_MODE), _T(MSG_STEALTH), lcd_silent_mode_set);\
|
||||||
}\
|
}\
|
||||||
if (SilentModeMenu == SILENT_MODE_NORMAL)\
|
if (SilentModeMenu == SILENT_MODE_NORMAL)\
|
||||||
{\
|
{\
|
||||||
if (lcd_crash_detect_enabled()) MENU_ITEM_TOGGLE_P(_T(MSG_CRASHDETECT), _T(MSG_ON), crash_mode_switch);\
|
if (lcd_crash_detect_enabled()) MENU_ITEM_TOGGLE_P(_T(MSG_CRASHDETECT), _T(MSG_ON), crash_mode_switch);\
|
||||||
|
|
@ -5618,15 +5627,24 @@ static void lcd_tune_menu()
|
||||||
#ifdef TMC2130
|
#ifdef TMC2130
|
||||||
if(!farm_mode)
|
if(!farm_mode)
|
||||||
{
|
{
|
||||||
|
bool bDesync = tmc2130_mode ^ eeprom_read_byte((uint8_t*)EEPROM_SILENT);
|
||||||
if (SilentModeMenu == SILENT_MODE_NORMAL) {
|
if (SilentModeMenu == SILENT_MODE_NORMAL) {
|
||||||
MENU_ITEM_TOGGLE_P(_T(MSG_MODE), _T(MSG_NORMAL), lcd_silent_mode_set);
|
SILENT_DESYNC_IF {
|
||||||
|
MENU_ITEM_TOGGLE_P(_T(MSG_MODE), PSTR("M915"), lcd_silent_mode_set);
|
||||||
|
} else {
|
||||||
|
MENU_ITEM_TOGGLE_P(_T(MSG_MODE), _T(MSG_NORMAL), lcd_silent_mode_set);
|
||||||
|
}
|
||||||
if (lcd_crash_detect_enabled()) {
|
if (lcd_crash_detect_enabled()) {
|
||||||
MENU_ITEM_TOGGLE_P(_T(MSG_CRASHDETECT), _T(MSG_ON), crash_mode_switch);
|
MENU_ITEM_TOGGLE_P(_T(MSG_CRASHDETECT), _T(MSG_ON), crash_mode_switch);
|
||||||
} else {
|
} else {
|
||||||
MENU_ITEM_TOGGLE_P(_T(MSG_CRASHDETECT), _T(MSG_OFF), crash_mode_switch);
|
MENU_ITEM_TOGGLE_P(_T(MSG_CRASHDETECT), _T(MSG_OFF), crash_mode_switch);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
MENU_ITEM_TOGGLE_P(_T(MSG_MODE), _T(MSG_STEALTH), lcd_silent_mode_set);
|
if (bDesync) {
|
||||||
|
MENU_ITEM_TOGGLE_P(_T(MSG_MODE), PSTR("M914") , lcd_silent_mode_set);
|
||||||
|
} else {
|
||||||
|
MENU_ITEM_TOGGLE_P(_T(MSG_MODE), _T(MSG_STEALTH), lcd_silent_mode_set);
|
||||||
|
}
|
||||||
MENU_ITEM_TOGGLE_P(_T(MSG_CRASHDETECT), NULL, lcd_crash_mode_info);
|
MENU_ITEM_TOGGLE_P(_T(MSG_CRASHDETECT), NULL, lcd_crash_mode_info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue