Move M500-M503 to cpp

This commit is contained in:
Scott Lahteine 2017-09-17 04:28:25 -05:00
parent aab5489962
commit a90c7dbf64
6 changed files with 34 additions and 109 deletions

View file

@ -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

View file

@ -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

View file

@ -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();
}

View file

@ -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();
}

View file

@ -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));
}

View file

@ -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)