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

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
*/
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

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