From a90c7dbf64eafe10a2f8103420c9e222363b35a7 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 17 Sep 2017 04:28:25 -0500 Subject: [PATCH] Move M500-M503 to cpp --- Marlin/src/Marlin.cpp | 7 ----- .../gcode/eeprom/{M502.h => M500-M503.cpp} | 31 ++++++++++++++++++- Marlin/src/gcode/eeprom/M500.h | 28 ----------------- Marlin/src/gcode/eeprom/M501.h | 28 ----------------- Marlin/src/gcode/eeprom/M503.h | 28 ----------------- Marlin/src/gcode/gcode.cpp | 21 +++---------- 6 files changed, 34 insertions(+), 109 deletions(-) rename Marlin/src/gcode/eeprom/{M502.h => M500-M503.cpp} (64%) delete mode 100644 Marlin/src/gcode/eeprom/M500.h delete mode 100644 Marlin/src/gcode/eeprom/M501.h delete mode 100644 Marlin/src/gcode/eeprom/M503.h diff --git a/Marlin/src/Marlin.cpp b/Marlin/src/Marlin.cpp index 7cdc595f4..f0b5d971a 100644 --- a/Marlin/src/Marlin.cpp +++ b/Marlin/src/Marlin.cpp @@ -359,13 +359,6 @@ void quickstop_stepper() { SYNC_PLAN_POSITION_KINEMATIC(); } -#include "gcode/eeprom/M500.h" -#include "gcode/eeprom/M501.h" -#include "gcode/eeprom/M502.h" -#if DISABLED(DISABLE_M503) - #include "gcode/eeprom/M503.h" -#endif - #if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED) #include "gcode/config/M540.h" #endif diff --git a/Marlin/src/gcode/eeprom/M502.h b/Marlin/src/gcode/eeprom/M500-M503.cpp similarity index 64% rename from Marlin/src/gcode/eeprom/M502.h rename to Marlin/src/gcode/eeprom/M500-M503.cpp index 0482b60ff..2809e3498 100644 --- a/Marlin/src/gcode/eeprom/M502.h +++ b/Marlin/src/gcode/eeprom/M500-M503.cpp @@ -20,9 +20,38 @@ * */ +#include "../gcode.h" +#include "../../module/configuration_store.h" +#include "../../inc/MarlinConfig.h" + +/** + * M500: Store settings in EEPROM + */ +void GcodeSuite::M500() { + (void)settings.save(); +} + +/** + * M501: Read settings from EEPROM + */ +void GcodeSuite::M501() { + (void)settings.load(); +} + /** * M502: Revert to default settings */ -void gcode_M502() { +void GcodeSuite::M502() { (void)settings.reset(); } + +#if DISABLED(DISABLE_M503) + + /** + * M503: print settings currently in memory + */ + void GcodeSuite::M503() { + (void)settings.report(!parser.boolval('S', true)); + } + +#endif // !DISABLE_M503 diff --git a/Marlin/src/gcode/eeprom/M500.h b/Marlin/src/gcode/eeprom/M500.h deleted file mode 100644 index 122e1f099..000000000 --- a/Marlin/src/gcode/eeprom/M500.h +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * - * Based on Sprinter and grbl. - * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ - -/** - * M500: Store settings in EEPROM - */ -void gcode_M500() { - (void)settings.save(); -} diff --git a/Marlin/src/gcode/eeprom/M501.h b/Marlin/src/gcode/eeprom/M501.h deleted file mode 100644 index 5cae9e059..000000000 --- a/Marlin/src/gcode/eeprom/M501.h +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * - * Based on Sprinter and grbl. - * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ - -/** - * M501: Read settings from EEPROM - */ -void gcode_M501() { - (void)settings.load(); -} diff --git a/Marlin/src/gcode/eeprom/M503.h b/Marlin/src/gcode/eeprom/M503.h deleted file mode 100644 index fe1457461..000000000 --- a/Marlin/src/gcode/eeprom/M503.h +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * - * Based on Sprinter and grbl. - * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ - -/** - * M503: print settings currently in memory - */ -void gcode_M503() { - (void)settings.report(!parser.boolval('S', true)); -} diff --git a/Marlin/src/gcode/gcode.cpp b/Marlin/src/gcode/gcode.cpp index 5343f8f8d..205f01502 100644 --- a/Marlin/src/gcode/gcode.cpp +++ b/Marlin/src/gcode/gcode.cpp @@ -122,10 +122,6 @@ extern void gcode_M165(); extern void gcode_M350(); extern void gcode_M351(); extern void gcode_M355(); -extern void gcode_M500(); -extern void gcode_M501(); -extern void gcode_M502(); -extern void gcode_M503(); extern void gcode_M540(); extern void gcode_M605(); extern void gcode_M702(); @@ -633,20 +629,11 @@ void GcodeSuite::process_next_command() { case 428: M428(); break; // M428: Apply current_position to home_offset #endif - case 500: // M500: Store settings in EEPROM - gcode_M500(); - break; - case 501: // M501: Read settings from EEPROM - gcode_M501(); - break; - case 502: // M502: Revert to default settings - gcode_M502(); - break; - + case 500: M500(); break; // M500: Store settings in EEPROM + case 501: M501(); break; // M501: Read settings from EEPROM + case 502: M502(); break; // M502: Revert to default settings #if DISABLED(DISABLE_M503) - case 503: // M503: print settings currently in memory - gcode_M503(); - break; + case 503: M503(); break; // M503: print settings currently in memory #endif #if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)