Browse Source

Move M500-M503 to cpp

pull/1/head
Scott Lahteine 7 years ago
parent
commit
a90c7dbf64
  1. 7
      Marlin/src/Marlin.cpp
  2. 31
      Marlin/src/gcode/eeprom/M500-M503.cpp
  3. 28
      Marlin/src/gcode/eeprom/M500.h
  4. 28
      Marlin/src/gcode/eeprom/M501.h
  5. 28
      Marlin/src/gcode/eeprom/M503.h
  6. 21
      Marlin/src/gcode/gcode.cpp

7
Marlin/src/Marlin.cpp

@ -359,13 +359,6 @@ void quickstop_stepper() {
SYNC_PLAN_POSITION_KINEMATIC(); 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) #if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
#include "gcode/config/M540.h" #include "gcode/config/M540.h"
#endif #endif

31
Marlin/src/gcode/eeprom/M502.h → 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 * M502: Revert to default settings
*/ */
void gcode_M502() { void GcodeSuite::M502() {
(void)settings.reset(); (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

28
Marlin/src/gcode/eeprom/M500.h

@ -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 <http://www.gnu.org/licenses/>.
*
*/
/**
* M500: Store settings in EEPROM
*/
void gcode_M500() {
(void)settings.save();
}

28
Marlin/src/gcode/eeprom/M501.h

@ -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 <http://www.gnu.org/licenses/>.
*
*/
/**
* M501: Read settings from EEPROM
*/
void gcode_M501() {
(void)settings.load();
}

28
Marlin/src/gcode/eeprom/M503.h

@ -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 <http://www.gnu.org/licenses/>.
*
*/
/**
* M503: print settings currently in memory
*/
void gcode_M503() {
(void)settings.report(!parser.boolval('S', true));
}

21
Marlin/src/gcode/gcode.cpp

@ -122,10 +122,6 @@ extern void gcode_M165();
extern void gcode_M350(); extern void gcode_M350();
extern void gcode_M351(); extern void gcode_M351();
extern void gcode_M355(); 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_M540();
extern void gcode_M605(); extern void gcode_M605();
extern void gcode_M702(); extern void gcode_M702();
@ -633,20 +629,11 @@ void GcodeSuite::process_next_command() {
case 428: M428(); break; // M428: Apply current_position to home_offset case 428: M428(); break; // M428: Apply current_position to home_offset
#endif #endif
case 500: // M500: Store settings in EEPROM case 500: M500(); break; // M500: Store settings in EEPROM
gcode_M500(); case 501: M501(); break; // M501: Read settings from EEPROM
break; case 502: M502(); break; // M502: Revert to default settings
case 501: // M501: Read settings from EEPROM
gcode_M501();
break;
case 502: // M502: Revert to default settings
gcode_M502();
break;
#if DISABLED(DISABLE_M503) #if DISABLED(DISABLE_M503)
case 503: // M503: print settings currently in memory case 503: M503(); break; // M503: print settings currently in memory
gcode_M503();
break;
#endif #endif
#if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED) #if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)

Loading…
Cancel
Save