🚸 Fix missing "echo:" in some reports (#27794)

This commit is contained in:
Andrew 2025-04-15 18:36:27 -04:00 committed by GitHub
parent 1242e875aa
commit f149e14d1a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 71 additions and 66 deletions

View file

@ -172,4 +172,46 @@ void MarlinEthernet::check() {
}
}
void say_ethernet() { SERIAL_ECHOPGM(" Ethernet "); }
void MarlinEthernet::ETH0_report(const bool forReplay/*=true*/) {
say_ethernet();
SERIAL_ECHO_TERNARY(ethernet.hardware_enabled, "port ", "en", "dis", "abled.\n");
if (ethernet.hardware_enabled) {
say_ethernet();
SERIAL_ECHO_TERNARY(ethernet.have_telnet_client, "client ", "en", "dis", "abled.\n");
}
else
SERIAL_ECHOLNPGM("Send 'M552 S1' to enable.");
}
void MarlinEthernet::MAC_report(const bool forReplay/*=true*/) {
if (!forReplay) SERIAL_ECHO_START();
SERIAL_ECHOPGM("MAC: ");
if (ethernet.hardware_enabled) {
uint8_t mac[6];
Ethernet.MACAddress(mac);
for (uint8_t i = 0; i < 6; ++i) {
if (mac[i] < 0x10) SERIAL_CHAR('0');
SERIAL_PRINT(mac[i], PrintBase::Hex);
if (i < 5) SERIAL_CHAR(':');
}
}
else
SERIAL_ECHOPGM("Disabled");
SERIAL_EOL();
}
// Display current values when the link is active,
// otherwise show the stored values
void MarlinEthernet::ip_report(const uint16_t cmd, FSTR_P const post, const IPAddress &ipo, const bool forReplay/*=true*/) {
if (!forReplay) SERIAL_ECHO_START();
SERIAL_ECHO(F(" M"), cmd, C(' '));
for (uint8_t i = 0; i < 4; ++i) {
SERIAL_ECHO(ipo[i]);
if (i < 3) SERIAL_CHAR('.');
}
SERIAL_ECHOLN(F(" ; "), post);
}
#endif // HAS_ETHERNET

View file

@ -25,6 +25,8 @@
#include <NativeEthernet.h>
#endif
#include "../HAL/shared/Marduino.h"
// Teensy 4.1 uses internal MAC Address
class MarlinEthernet {
@ -34,6 +36,10 @@ class MarlinEthernet {
static EthernetClient telnetClient;
static void init();
static void check();
static void ETH0_report(const bool forReplay=true);
static void MAC_report(const bool forReplay=true);
static void ip_report(const uint16_t cmd, FSTR_P const post, const IPAddress &ipo, const bool forReplay=true);
};
extern MarlinEthernet ethernet;

View file

@ -78,10 +78,10 @@
TERN_(MARLIN_SMALL_BUILD, return);
if (!forReplay) {
report_heading(forReplay, F(STR_FILAMENT_SETTINGS), false);
report_heading(false, F(STR_FILAMENT_SETTINGS), false);
if (!parser.volumetric_enabled) SERIAL_ECHOPGM(" (Disabled):");
SERIAL_EOL();
report_echo_start(forReplay);
report_echo_start(false);
}
#if EXTRUDERS == 1
@ -231,7 +231,7 @@ void GcodeSuite::M203_report(const bool forReplay/*=true*/) {
#if ENABLED(DISTINCT_E_FACTORS)
for (uint8_t i = 0; i < E_STEPPERS; ++i) {
if (!forReplay) SERIAL_ECHO_START();
report_echo_start(forReplay);
SERIAL_ECHOLNPGM_P(
PSTR(" M203 T"), i
, SP_E_STR, VOLUMETRIC_UNIT(planner.settings.max_feedrate_mm_s[E_AXIS_N(i)])

View file

@ -28,44 +28,6 @@
#include "../../../core/serial.h"
#include "../../gcode.h"
void say_ethernet() { SERIAL_ECHOPGM(" Ethernet "); }
void ETH0_report() {
say_ethernet();
SERIAL_ECHO_TERNARY(ethernet.hardware_enabled, "port ", "en", "dis", "abled.\n");
if (ethernet.hardware_enabled) {
say_ethernet();
SERIAL_ECHO_TERNARY(ethernet.have_telnet_client, "client ", "en", "dis", "abled.\n");
}
else
SERIAL_ECHOLNPGM("Send 'M552 S1' to enable.");
}
void MAC_report() {
uint8_t mac[6];
if (ethernet.hardware_enabled) {
Ethernet.MACAddress(mac);
SERIAL_ECHOPGM(" MAC: ");
for (uint8_t i = 0; i < 6; ++i) {
if (mac[i] < 16) SERIAL_CHAR('0');
SERIAL_PRINT(mac[i], PrintBase::Hex);
if (i < 5) SERIAL_CHAR(':');
}
}
SERIAL_EOL();
}
// Display current values when the link is active,
// otherwise show the stored values
void ip_report(const uint16_t cmd, FSTR_P const post, const IPAddress &ipo) {
SERIAL_CHAR('M'); SERIAL_ECHO(cmd); SERIAL_CHAR(' ');
for (uint8_t i = 0; i < 4; ++i) {
SERIAL_ECHO(ipo[i]);
if (i < 3) SERIAL_CHAR('.');
}
SERIAL_ECHOLN(F(" ; "), post);
}
/**
* M552: Set IP address, enable/disable network interface
*
@ -92,13 +54,13 @@ void GcodeSuite::M552() {
}
}
const bool nopar = !seenS && !seenP;
if (nopar || seenS) ETH0_report();
if (nopar || seenS) ethernet.ETH0_report();
if (nopar || seenP) M552_report();
}
void GcodeSuite::M552_report() {
void GcodeSuite::M552_report(const bool forReplay/*=true*/) {
TERN_(MARLIN_SMALL_BUILD, return);
ip_report(552, F("ip address"), Ethernet.linkStatus() == LinkON ? Ethernet.localIP() : ethernet.ip);
ethernet.ip_report(552, F("ip address"), Ethernet.linkStatus() == LinkON ? Ethernet.localIP() : ethernet.ip, forReplay);
}
/**
@ -111,9 +73,9 @@ void GcodeSuite::M553() {
M553_report();
}
void GcodeSuite::M553_report() {
void GcodeSuite::M553_report(const bool forReplay/*=true*/) {
TERN_(MARLIN_SMALL_BUILD, return);
ip_report(553, F("subnet mask"), Ethernet.linkStatus() == LinkON ? Ethernet.subnetMask() : ethernet.subnet);
ethernet.ip_report(553, F("subnet mask"), Ethernet.linkStatus() == LinkON ? Ethernet.subnetMask() : ethernet.subnet, forReplay);
}
/**
@ -126,9 +88,9 @@ void GcodeSuite::M554() {
M554_report();
}
void GcodeSuite::M554_report() {
void GcodeSuite::M554_report(const bool forReplay/*=true*/) {
TERN_(MARLIN_SMALL_BUILD, return);
ip_report(554, F("gateway"), Ethernet.linkStatus() == LinkON ? Ethernet.gatewayIP() : ethernet.gateway);
ethernet.ip_report(554, F("gateway"), Ethernet.linkStatus() == LinkON ? Ethernet.gatewayIP() : ethernet.gateway, forReplay);
}
#endif // HAS_ETHERNET

View file

@ -29,7 +29,7 @@
void GcodeSuite::M592_report(const bool forReplay/*=true*/) {
TERN_(MARLIN_SMALL_BUILD, return);
report_heading(forReplay, F(STR_NONLINEAR_EXTRUSION));
report_heading_etc(forReplay, F(STR_NONLINEAR_EXTRUSION));
SERIAL_ECHOLNPGM(" M592 A", stepper.ne.A, " B", stepper.ne.B, " C", stepper.ne.C);
}

View file

@ -64,7 +64,6 @@ void GcodeSuite::M603_report(const bool forReplay/*=true*/) {
TERN_(MARLIN_SMALL_BUILD, return);
report_heading(forReplay, F(STR_FILAMENT_LOAD_UNLOAD));
#if EXTRUDERS == 1
report_echo_start(forReplay);
SERIAL_ECHOPGM(" M603 L", LINEAR_UNIT(fc_settings[0].load_length), " U", LINEAR_UNIT(fc_settings[0].unload_length), " ;");

View file

@ -160,7 +160,7 @@ void GcodeSuite::M569_report(const bool forReplay/*=true*/) {
report_heading(forReplay, F(STR_DRIVER_STEPPING_MODE));
auto say_M569 = [](const bool forReplay, FSTR_P const etc=nullptr, const bool eol=false) {
if (!forReplay) SERIAL_ECHO_START();
report_echo_start(forReplay);
SERIAL_ECHOPGM(" M569 S1");
if (etc) SERIAL_ECHO(C(' '), etc);
if (eol) SERIAL_EOL();

View file

@ -1137,11 +1137,11 @@ private:
#if HAS_ETHERNET
static void M552();
static void M552_report();
static void M552_report(const bool forReplay=true);
static void M553();
static void M553_report();
static void M553_report(const bool forReplay=true);
static void M554();
static void M554_report();
static void M554_report(const bool forReplay=true);
#endif
#if HAS_STEALTHCHOP

View file

@ -88,10 +88,11 @@ void GcodeSuite::M423() {
void GcodeSuite::M423_report(const bool forReplay/*=true*/) {
TERN_(MARLIN_SMALL_BUILD, return);
report_heading(forReplay, F("X-Twist Correction"));
report_heading_etc(forReplay, F("X-Twist Correction"));
SERIAL_ECHOLNPGM(" M423 A", xatc.start, " I", xatc.spacing);
for (uint8_t x = 0; x < XATC_MAX_POINTS; ++x) {
const float z = xatc.z_offset[x];
report_echo_start(forReplay);
SERIAL_ECHOPGM(" M423 X", x, " Z");
serial_offset(isnan(z) ? 0 : z);
SERIAL_EOL();

View file

@ -37,7 +37,7 @@ void GcodeSuite::M86_report(const bool forReplay/*=true*/) {
TERN_(MARLIN_SMALL_BUILD, return);
hotend_idle_settings_t &c = hotend_idle.cfg;
report_heading(forReplay, F("Hotend Idle Timeout"));
report_heading_etc(forReplay, F("Hotend Idle Timeout"));
SERIAL_ECHOLNPGM(" M86"
#if HAS_HEATED_BED
" B", c.bed_target,

View file

@ -190,11 +190,6 @@
#pragma pack(push, 1) // No padding between variables
#if HAS_ETHERNET
void ETH0_report();
void MAC_report();
#endif
#define _EN_ITEM(N) , E##N
#define _EN1_ITEM(N) , E##N:1
@ -4210,11 +4205,11 @@ void MarlinSettings::reset() {
#if HAS_ETHERNET
CONFIG_ECHO_HEADING("Ethernet");
if (!forReplay) ETH0_report();
CONFIG_ECHO_START(); SERIAL_ECHO_SP(2); MAC_report();
CONFIG_ECHO_START(); SERIAL_ECHO_SP(2); gcode.M552_report();
CONFIG_ECHO_START(); SERIAL_ECHO_SP(2); gcode.M553_report();
CONFIG_ECHO_START(); SERIAL_ECHO_SP(2); gcode.M554_report();
if (!forReplay) ethernet.ETH0_report(false);
ethernet.MAC_report(forReplay);
gcode.M552_report(forReplay);
gcode.M553_report(forReplay);
gcode.M554_report(forReplay);
#endif
TERN_(HAS_MULTI_LANGUAGE, gcode.M414_report(forReplay));