Merge pull request #4388 from prusa3d/vintagepc/tmc-mode-query

Add Q parameter to M91[4/5]
This commit is contained in:
3d-gussner 2023-09-14 09:13:55 +02:00 committed by GitHub
commit 5f605012eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 30 additions and 20 deletions

View File

@ -8130,11 +8130,13 @@ Sigma_Exit:
Updates EEPROM only if "P" is given, otherwise temporary (lasts until reset or motor idle timeout) Updates EEPROM only if "P" is given, otherwise temporary (lasts until reset or motor idle timeout)
#### Usage #### Usage
M914 [ P | R ] M914 [ P | R | Q ]
#### Parameters #### Parameters
- `P` - Make the mode change permanent (write to EEPROM) - `P` - Make the mode change permanent (write to EEPROM)
- `R` - Revert to EEPROM value - `R` - Revert to EEPROM value
- `Q` - Print effective silent/normal status. (Does not report override)
*/ */
/*! /*!
@ -8142,30 +8144,38 @@ Sigma_Exit:
Updates EEPROM only if "P" is given, otherwise temporary (lasts until reset or motor idle timeout) Updates EEPROM only if "P" is given, otherwise temporary (lasts until reset or motor idle timeout)
#### Usage #### Usage
M915 [ P | R ] M915 [ P | R | Q]
#### Parameters #### Parameters
- `P` - Make the mode change permanent (write to EEPROM) - `P` - Make the mode change permanent (write to EEPROM)
- `R` - Revert to EEPROM value - `R` - Revert to EEPROM value
- `Q` - Print effective silent/normal status. (Does not report override)
*/ */
#ifdef TMC2130 #ifdef TMC2130
case 914: case 914:
case 915: case 915:
{ {
uint8_t newMode = (mcode_in_progress==914) ? TMC2130_MODE_NORMAL : TMC2130_MODE_SILENT; uint8_t newMode = (mcode_in_progress==914) ? TMC2130_MODE_NORMAL : TMC2130_MODE_SILENT;
//printf_P(_n("tmc2130mode/smm/eep: %d %d %d %d"),tmc2130_mode,SilentModeMenu,eeprom_read_byte((uint8_t*)EEPROM_SILENT), bEnableForce_z); //printf_P(_n("tmc2130mode/smm/eep: %d %d %d %d"),tmc2130_mode,SilentModeMenu,eeprom_read_byte((uint8_t*)EEPROM_SILENT), bEnableForce_z);
if (code_seen('R')) if (code_seen('R'))
{ {
newMode = eeprom_read_byte((uint8_t*)EEPROM_SILENT); newMode = eeprom_read_byte((uint8_t*)EEPROM_SILENT);
} }
else if (code_seen('P')) else if (code_seen('P'))
{ {
uint8_t newMenuMode = (mcode_in_progress==914) ? SILENT_MODE_NORMAL : SILENT_MODE_STEALTH; uint8_t newMenuMode = (mcode_in_progress==914) ? SILENT_MODE_NORMAL : SILENT_MODE_STEALTH;
eeprom_update_byte((unsigned char *)EEPROM_SILENT, newMenuMode); eeprom_update_byte((unsigned char *)EEPROM_SILENT, newMenuMode);
SilentModeMenu = newMenuMode; SilentModeMenu = newMenuMode;
//printf_P(_n("tmc2130mode/smm/eep: %d %d %d %d"),tmc2130_mode,SilentModeMenu,eeprom_read_byte((uint8_t*)EEPROM_SILENT), bEnableForce_z); //printf_P(_n("tmc2130mode/smm/eep: %d %d %d %d"),tmc2130_mode,SilentModeMenu,eeprom_read_byte((uint8_t*)EEPROM_SILENT), bEnableForce_z);
} }
else if (code_seen('Q'))
{
printf_P(PSTR("%S: %S\n"), _O(MSG_MODE),
tmc2130_mode == TMC2130_MODE_NORMAL ?
_O(MSG_NORMAL) : _O(MSG_SILENT)
);
}
if (tmc2130_mode != newMode if (tmc2130_mode != newMode
#ifdef PSU_Delta #ifdef PSU_Delta
|| !bEnableForce_z || !bEnableForce_z