Simplify serial port redirect (#13234)
This commit is contained in:
@@ -33,17 +33,11 @@
|
||||
#include "../../gcode/queue.h"
|
||||
#endif
|
||||
|
||||
#if ADD_PORT_ARG
|
||||
#define CHAT_PORT command_queue_port[cmd_queue_index_r]
|
||||
#else
|
||||
#define CHAT_PORT
|
||||
#endif
|
||||
|
||||
/**
|
||||
* M500: Store settings in EEPROM
|
||||
*/
|
||||
void GcodeSuite::M500() {
|
||||
(void)settings.save(CHAT_PORT);
|
||||
(void)settings.save();
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onStoreSettings();
|
||||
#endif
|
||||
@@ -53,11 +47,7 @@ void GcodeSuite::M500() {
|
||||
* M501: Read settings from EEPROM
|
||||
*/
|
||||
void GcodeSuite::M501() {
|
||||
(void)settings.load(
|
||||
#if ENABLED(EEPROM_SETTINGS)
|
||||
CHAT_PORT
|
||||
#endif
|
||||
);
|
||||
(void)settings.load();
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onLoadSettings();
|
||||
#endif
|
||||
@@ -67,7 +57,7 @@ void GcodeSuite::M501() {
|
||||
* M502: Revert to default settings
|
||||
*/
|
||||
void GcodeSuite::M502() {
|
||||
(void)settings.reset(CHAT_PORT);
|
||||
(void)settings.reset();
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onFactoryReset();
|
||||
#endif
|
||||
@@ -79,12 +69,7 @@ void GcodeSuite::M502() {
|
||||
* M503: print settings currently in memory
|
||||
*/
|
||||
void GcodeSuite::M503() {
|
||||
(void)settings.report(
|
||||
parser.seen('S') && !parser.value_bool()
|
||||
#if NUM_SERIAL > 1
|
||||
, command_queue_port[cmd_queue_index_r]
|
||||
#endif
|
||||
);
|
||||
(void)settings.report(parser.boolval('S', true));
|
||||
}
|
||||
|
||||
#endif // !DISABLE_M503
|
||||
@@ -94,7 +79,7 @@ void GcodeSuite::M502() {
|
||||
* M504: Validate EEPROM Contents
|
||||
*/
|
||||
void GcodeSuite::M504() {
|
||||
if (settings.validate(CHAT_PORT))
|
||||
SERIAL_ECHO_MSG_P(command_queue_port[cmd_queue_index_r], "EEPROM OK");
|
||||
if (settings.validate())
|
||||
SERIAL_ECHO_MSG("EEPROM OK");
|
||||
}
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user