Skip to content

Commit 4833a0c

Browse files
committed
cleanup after merge
1 parent 9a4443e commit 4833a0c

File tree

6 files changed

+53
-90
lines changed

6 files changed

+53
-90
lines changed

Marlin/Configuration_adv.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4398,13 +4398,13 @@
43984398
// Use hardware reset for MMU if a pin is defined for it
43994399
//#define MMU2_RST_PIN 23
44004400

4401-
// Enable if the MMU2 has 12V stepper motors (MMU2 Firmware 1.0.2 and up)
4402-
// (MMU2/MMU2S only)
4403-
//#define MMU2_MODE_12V
4401+
#if HAS_PRUSA_MMU2
4402+
// Enable if the MMU2 has 12V stepper motors (MMU2 Firmware 1.0.2 and up)
4403+
//#define MMU2_MODE_12V
44044404

4405-
// G-code to execute when MMU2 F.I.N.D.A. probe detects filament runout
4406-
//(MMU2/MMU2S only)
4407-
#define MMU2_FILAMENT_RUNOUT_SCRIPT "M600"
4405+
// G-code to execute when MMU2 F.I.N.D.A. probe detects filament runout
4406+
#define MMU2_FILAMENT_RUNOUT_SCRIPT "M600"
4407+
#endif
44084408

44094409
// Add an LCD menu for MMU2/MMU2S/MMU3
44104410
//#define MMU_MENUS

Marlin/src/gcode/feature/prusa_MMU2/M704_M705_M706_M707_M708_M709.cpp renamed to Marlin/src/gcode/feature/prusa_MMU2/M704-M709.cpp

Lines changed: 42 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* Marlin 3D Printer Firmware
3-
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
3+
* Copyright (c) 2024 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
44
*
55
* Based on Sprinter and grbl.
66
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
@@ -47,7 +47,7 @@ static void gcodes_M704_M705_M706(uint16_t gcode) {
4747
}
4848

4949
/**
50-
* ### M704 - Preload to MMU <a href="https://reprap.org/wiki/G-code#M704:_Preload_to_MMU">M704: Preload to MMU</a>
50+
* ### M704 - Preload to MMU
5151
* #### Usage
5252
*
5353
* M704 [ P ]
@@ -60,7 +60,7 @@ void GcodeSuite::M704() {
6060
}
6161

6262
/**
63-
* ### M705 - Eject filament <a href="https://reprap.org/wiki/G-code#M705:_Eject_filament">M705: Eject filament</a>
63+
* ### M705 - Eject filament
6464
* #### Usage
6565
*
6666
* M705 [ P ]
@@ -73,7 +73,7 @@ void GcodeSuite::M705() {
7373
}
7474

7575
/*!
76-
* ### M706 - Cut filament <a href="https://reprap.org/wiki/G-code#M706:_Cut_filament">M706: Cut filament</a>
76+
* ### M706 - Cut filament
7777
* #### Usage
7878
*
7979
* M706 [ P ]
@@ -86,7 +86,7 @@ void GcodeSuite::M706() {
8686
}
8787

8888
/**
89-
* ### M707 - Read from MMU register <a href="https://reprap.org/wiki/G-code#M707:_Read_from_MMU_register">M707: Read from MMU register</a>
89+
* ### M707 - Read from MMU register
9090
* #### Usage
9191
*
9292
* M707 [ A ]
@@ -102,16 +102,14 @@ void GcodeSuite::M706() {
102102
*
103103
*/
104104
void GcodeSuite::M707() {
105-
if (mmu3.enabled() ) {
106-
if (parser.seenval('A') ) {
107-
char *address = parser.stringval('A');
108-
mmu3.readRegister(uint8_t(strtol(address, NULL, 16)));
109-
}
105+
if (mmu3.enabled() && parser.seenval('A')) {
106+
char *address = parser.value_string();
107+
mmu3.readRegister(uint8_t(strtol(address, NULL, 16)));
110108
}
111109
}
112110

113111
/**
114-
* ### M708 - Write to MMU register <a href="https://reprap.org/wiki/G-code#M708:_Write_to_MMU_register">M707: Write to MMU register</a>
112+
* ### M708 - Write to MMU register
115113
* #### Usage
116114
*
117115
* M708 [ A | X ]
@@ -126,24 +124,18 @@ void GcodeSuite::M707() {
126124
* Does nothing if A parameter is missing or if MMU is not enabled.
127125
*/
128126
void GcodeSuite::M708() {
129-
if (mmu3.enabled() ) {
130-
uint8_t addr = 0;
131-
if (parser.seenval('A') ) {
132-
char *address = parser.stringval('A');
133-
addr = uint8_t(strtol(address, NULL, 16));
134-
}
135-
uint16_t data = 0;
136-
if (parser.seenval('X') ) {
137-
data = parser.ushortval('X', 0);
138-
}
127+
if (mmu3.enabled() && parser.seenval('A')) {
128+
char *address = parser.value_string();
129+
const uint8_t addr = uint8_t(strtol(address, NULL, 16));
139130
if (addr) {
131+
const uint16_t data = parser.ushortval('X', 0);
140132
mmu3.writeRegister(addr, data);
141133
}
142134
}
143135
}
144136

145137
/**
146-
* ### M709 - MMU power & reset <a href="https://reprap.org/wiki/G-code#M709:_MMU_power_&_reset">M709: MMU power & reset</a>
138+
* ### M709 - MMU power & reset
147139
* The MK3S cannot not power off the MMU, but we can en- and disable the MMU.
148140
*
149141
* The new state of the MMU is stored in printer's EEPROM.
@@ -167,14 +159,14 @@ void GcodeSuite::M708() {
167159
*/
168160
void GcodeSuite::M709() {
169161
if (parser.seenval('S')) {
170-
switch (parser.byteval('S', -1)) {
171-
case 0: mmu3.stop(); break;
172-
case 1: mmu3.start(); break;
173-
default: break;
174-
}
162+
if (parser.value_bool())
163+
mmu3.start();
164+
else
165+
mmu3.stop();
175166
}
167+
176168
if (mmu3.enabled() && parser.seenval('X')) {
177-
switch (parser.byteval('X', -1)) {
169+
switch (parser.value_byte()) {
178170
case 0: mmu3.reset(MMU3::MMU3::Software); break;
179171
case 1: mmu3.reset(MMU3::MMU3::ResetPin); break;
180172
case 42: mmu3.reset(MMU3::MMU3::EraseEEPROM); break;
@@ -184,4 +176,26 @@ void GcodeSuite::M709() {
184176
mmu3.status();
185177
}
186178

179+
/**
180+
* Report for M503.
181+
* TODO: Report MMU3 G-code settings here, status via a different G-code.
182+
*/
183+
void GcodeSuite::MMU3_report() {
184+
report_heading(forReplay, F("MMU3 Operational Stats"));
185+
SERIAL_ECHOPGM(" MMU "); serialprintln_onoff(mmu3.mmu_hw_enabled);
186+
SERIAL_ECHOPGM(" Stealth Mode "); serialprintln_onoff(mmu3.stealth_mode);
187+
#if ENABLED(MMU_HAS_CUTTER)
188+
SERIAL_ECHOPGM(" Cutter ");
189+
serialprintln_onoff(mmu3.cutter_mode != 0);
190+
#endif
191+
SERIAL_ECHOPGM(" SpoolJoin "); serialprintln_onoff(spooljoin.enabled);
192+
SERIAL_ECHOLNPGM(" Tool Changes ", MMU3::operation_statistics.tool_change_counter);
193+
SERIAL_ECHOLNPGM(" Total Tool Changes ", MMU3::operation_statistics.tool_change_total_counter);
194+
SERIAL_ECHOLNPGM(" Fails ", MMU3::operation_statistics.fail_num);
195+
SERIAL_ECHOLNPGM(" Total Fails ", MMU3::operation_statistics.fail_total_num);
196+
SERIAL_ECHOLNPGM(" Load Fails ", MMU3::operation_statistics.load_fail_num);
197+
SERIAL_ECHOLNPGM(" Total Load Fails ", MMU3::operation_statistics.load_fail_total_num);
198+
SERIAL_ECHOLNPGM(" Power Fails ", mmu3.tmcFailures());
199+
}
200+
187201
#endif // HAS_PRUSA_MMU3

Marlin/src/gcode/gcode.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1177,6 +1177,7 @@ class GcodeSuite {
11771177
static void M707();
11781178
static void M708();
11791179
static void M709();
1180+
static void MMU3_report();
11801181
#endif
11811182

11821183
#if ENABLED(GCODE_REPEAT_MARKERS)

Marlin/src/gcode/gcode_d.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ void GcodeSuite::D(const int16_t dcode) {
141141
}
142142
else {
143143
//while (len--) {
144-
// // TODO: Read bytes from EEPROM
144+
//// TODO: Read bytes from EEPROM
145145
// print_hex_byte(eeprom_read_byte(adr++));
146146
//}
147147
SERIAL_EOL();
@@ -162,7 +162,7 @@ void GcodeSuite::D(const int16_t dcode) {
162162
}
163163
else {
164164
//while (len--) {
165-
// // TODO: Read bytes from FLASH
165+
//// TODO: Read bytes from FLASH
166166
// print_hex_byte(flash_read_byte(adr++));
167167
//}
168168
SERIAL_EOL();

Marlin/src/module/settings.cpp

Lines changed: 2 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -4150,60 +4150,9 @@ void MarlinSettings::reset() {
41504150
TERN_(MPCTEMP, gcode.M306_report(forReplay));
41514151

41524152
//
4153-
// MMU
4153+
// MMU3
41544154
//
4155-
#if HAS_PRUSA_MMU3
4156-
CONFIG_ECHO_HEADING("MMU3 Operational Stats");
4157-
4158-
CONFIG_ECHO_START(); SERIAL_ECHO_SP(2);
4159-
SERIAL_ECHOPGM("MMU ");
4160-
serialprintln_onoff(mmu3.mmu_hw_enabled);
4161-
4162-
CONFIG_ECHO_START(); SERIAL_ECHO_SP(2);
4163-
SERIAL_ECHOPGM("Stealth Mode ");
4164-
serialprintln_onoff(mmu3.stealth_mode);
4165-
4166-
CONFIG_ECHO_START(); SERIAL_ECHO_SP(2);
4167-
SERIAL_ECHOPGM("Cutter ");
4168-
#if ENABLED(MMU_HAS_CUTTER)
4169-
serialprintln_onoff(mmu3.cutter_mode != 0);
4170-
#else
4171-
SERIAL_ECHOLNPGM("Disabled");
4172-
#endif
4173-
4174-
CONFIG_ECHO_START(); SERIAL_ECHO_SP(2);
4175-
SERIAL_ECHOPGM("SpoolJoin ");
4176-
serialprintln_onoff(spooljoin.enabled);
4177-
4178-
CONFIG_ECHO_START(); SERIAL_ECHO_SP(2);
4179-
SERIAL_ECHOPGM("Tool Changes ");
4180-
SERIAL_ECHOLN(MMU3::operation_statistics.tool_change_counter);
4181-
4182-
CONFIG_ECHO_START(); SERIAL_ECHO_SP(2);
4183-
SERIAL_ECHOPGM("Total Tool Changes ");
4184-
SERIAL_ECHOLN(MMU3::operation_statistics.tool_change_total_counter);
4185-
4186-
CONFIG_ECHO_START(); SERIAL_ECHO_SP(2);
4187-
SERIAL_ECHOPGM("Fails ");
4188-
SERIAL_ECHOLN(MMU3::operation_statistics.fail_num);
4189-
4190-
CONFIG_ECHO_START(); SERIAL_ECHO_SP(2);
4191-
SERIAL_ECHOPGM("Total Fails ");
4192-
SERIAL_ECHOLN(MMU3::operation_statistics.fail_total_num);
4193-
4194-
CONFIG_ECHO_START(); SERIAL_ECHO_SP(2);
4195-
SERIAL_ECHOPGM("Load Fails ");
4196-
SERIAL_ECHOLN(MMU3::operation_statistics.load_fail_num);
4197-
4198-
CONFIG_ECHO_START(); SERIAL_ECHO_SP(2);
4199-
SERIAL_ECHOPGM("Total Load Fails ");
4200-
SERIAL_ECHOLN(MMU3::operation_statistics.load_fail_total_num);
4201-
4202-
CONFIG_ECHO_START(); SERIAL_ECHO_SP(2);
4203-
SERIAL_ECHOPGM("Power Fails ");
4204-
SERIAL_ECHOLN(mmu3.tmcFailures());
4205-
4206-
#endif
4155+
TERN_(HAS_PRUSA_MMU3, gcode.MMU3_report(forReplay));
42074156
}
42084157

42094158
#endif // !DISABLE_M503

Marlin/src/sd/usb_flashdrive/lib-uhs2/settings.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
* Web : https://www.circuitsathome.com
2323
* e-mail : support@circuitsathome.com
2424
*/
25-
2625
#pragma once
2726

2827
#include "../../../inc/MarlinConfig.h"

0 commit comments

Comments
 (0)