|
@@ -22,21 +22,24 @@
|
22
|
22
|
|
23
|
23
|
#include "../gcode.h"
|
24
|
24
|
#include "../../module/configuration_store.h"
|
|
25
|
+#include "../../core/serial.h"
|
25
|
26
|
#include "../../inc/MarlinConfig.h"
|
26
|
27
|
|
27
|
28
|
#if NUM_SERIAL > 1
|
28
|
29
|
#include "../../gcode/queue.h"
|
29
|
30
|
#endif
|
30
|
31
|
|
|
32
|
+#if ADD_PORT_ARG
|
|
33
|
+ #define CHAT_PORT command_queue_port[cmd_queue_index_r]
|
|
34
|
+#else
|
|
35
|
+ #define CHAT_PORT
|
|
36
|
+#endif
|
|
37
|
+
|
31
|
38
|
/**
|
32
|
39
|
* M500: Store settings in EEPROM
|
33
|
40
|
*/
|
34
|
41
|
void GcodeSuite::M500() {
|
35
|
|
- (void)settings.save(
|
36
|
|
- #if ENABLED(EEPROM_CHITCHAT) && NUM_SERIAL > 1
|
37
|
|
- command_queue_port[cmd_queue_index_r]
|
38
|
|
- #endif
|
39
|
|
- );
|
|
42
|
+ (void)settings.save(CHAT_PORT);
|
40
|
43
|
}
|
41
|
44
|
|
42
|
45
|
/**
|
|
@@ -44,8 +47,8 @@ void GcodeSuite::M500() {
|
44
|
47
|
*/
|
45
|
48
|
void GcodeSuite::M501() {
|
46
|
49
|
(void)settings.load(
|
47
|
|
- #if ENABLED(EEPROM_SETTINGS) && ENABLED(EEPROM_CHITCHAT) && NUM_SERIAL > 1
|
48
|
|
- command_queue_port[cmd_queue_index_r]
|
|
50
|
+ #if ENABLED(EEPROM_SETTINGS)
|
|
51
|
+ CHAT_PORT
|
49
|
52
|
#endif
|
50
|
53
|
);
|
51
|
54
|
}
|
|
@@ -54,11 +57,7 @@ void GcodeSuite::M501() {
|
54
|
57
|
* M502: Revert to default settings
|
55
|
58
|
*/
|
56
|
59
|
void GcodeSuite::M502() {
|
57
|
|
- (void)settings.reset(
|
58
|
|
- #if ENABLED(EEPROM_CHITCHAT) && NUM_SERIAL > 1
|
59
|
|
- command_queue_port[cmd_queue_index_r]
|
60
|
|
- #endif
|
61
|
|
- );
|
|
60
|
+ (void)settings.reset(CHAT_PORT);
|
62
|
61
|
}
|
63
|
62
|
|
64
|
63
|
#if DISABLED(DISABLE_M503)
|
|
@@ -67,8 +66,9 @@ void GcodeSuite::M502() {
|
67
|
66
|
* M503: print settings currently in memory
|
68
|
67
|
*/
|
69
|
68
|
void GcodeSuite::M503() {
|
70
|
|
- (void)settings.report(parser.seen('S') && !parser.value_bool()
|
71
|
|
- #if ADD_PORT_ARG
|
|
69
|
+ (void)settings.report(
|
|
70
|
+ parser.seen('S') && !parser.value_bool()
|
|
71
|
+ #if NUM_SERIAL > 1
|
72
|
72
|
, command_queue_port[cmd_queue_index_r]
|
73
|
73
|
#endif
|
74
|
74
|
);
|
|
@@ -81,9 +81,9 @@ void GcodeSuite::M502() {
|
81
|
81
|
* M504: Validate EEPROM Contents
|
82
|
82
|
*/
|
83
|
83
|
void GcodeSuite::M504() {
|
84
|
|
- if (settings.validate()) {
|
85
|
|
- SERIAL_ECHO_START();
|
86
|
|
- SERIAL_ECHOLNPGM("EEPROM OK");
|
|
84
|
+ if (settings.validate(CHAT_PORT)) {
|
|
85
|
+ SERIAL_ECHO_START_P(command_queue_port[cmd_queue_index_r]);
|
|
86
|
+ SERIAL_ECHOLNPGM_P(command_queue_port[cmd_queue_index_r], "EEPROM OK");
|
87
|
87
|
}
|
88
|
88
|
}
|
89
|
89
|
#endif
|