Add gcode.cpp, motion.*, queue.* - Apply to some G-codes.

This commit is contained in:
Scott Lahteine
2017-09-07 22:33:16 -05:00
parent 4231faf779
commit 722786966a
42 changed files with 1898 additions and 1370 deletions

View File

@ -20,23 +20,35 @@
*
*/
#include "../gcode.h"
#include "../../module/temperature.h"
#include "../../module/motion.h"
#include "../../module/planner.h"
#include "../../lcd/ultralcd.h"
#if ENABLED(PRINTJOB_TIMER_AUTOSTART)
#include "../../module/printcounter.h"
#endif
/**
* M104: Set hot end temperature
*/
void gcode_M104() {
if (get_target_extruder_from_command(104)) return;
void GcodeSuite::M104() {
if (get_target_extruder_from_command()) return;
if (DEBUGGING(DRYRUN)) return;
const uint8_t e = target_extruder;
#if ENABLED(SINGLENOZZLE)
if (target_extruder != active_extruder) return;
if (e != active_extruder) return;
#endif
if (parser.seenval('S')) {
const int16_t temp = parser.value_celsius();
thermalManager.setTargetHotend(temp, target_extruder);
thermalManager.setTargetHotend(temp, e);
#if ENABLED(DUAL_X_CARRIAGE)
if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && target_extruder == 0)
if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && e == 0)
thermalManager.setTargetHotend(temp ? temp + duplicate_extruder_temp_offset : 0, 1);
#endif
@ -53,8 +65,8 @@ void gcode_M104() {
}
#endif
if (parser.value_celsius() > thermalManager.degHotend(target_extruder))
lcd_status_printf_P(0, PSTR("E%i %s"), target_extruder + 1, MSG_HEATING);
if (parser.value_celsius() > thermalManager.degHotend(e))
lcd_status_printf_P(0, PSTR("E%i %s"), e + 1, MSG_HEATING);
}
#if ENABLED(AUTOTEMP)

View File

@ -24,7 +24,7 @@
* M105: Read hot end and bed temperature
*/
void gcode_M105() {
if (get_target_extruder_from_command(105)) return;
if (gcode.get_target_extruder_from_command()) return;
#if HAS_TEMP_HOTEND || HAS_TEMP_BED
SERIAL_PROTOCOLPGM(MSG_OK);

View File

@ -20,6 +20,20 @@
*
*/
#include "../gcode.h"
#include "../../module/temperature.h"
#include "../../module/planner.h"
#include "../../lcd/ultralcd.h"
#include "../../Marlin.h"
#if ENABLED(PRINTJOB_TIMER_AUTOSTART)
#include "../../module/printcounter.h"
#endif
#if ENABLED(DUAL_X_CARRIAGE)
#include "../../module/motion.h"
#endif
/**
* M109: Sxxx Wait for extruder(s) to reach temperature. Waits only when heating.
* Rxxx Wait for extruder(s) to reach temperature. Waits when heating and cooling.
@ -32,9 +46,9 @@
#define MIN_COOLING_SLOPE_TIME 60
#endif
void gcode_M109() {
void GcodeSuite::M109() {
if (get_target_extruder_from_command(109)) return;
if (get_target_extruder_from_command()) return;
if (DEBUGGING(DRYRUN)) return;
#if ENABLED(SINGLENOZZLE)

View File

@ -20,6 +20,8 @@
*
*/
#include "../gcode.h"
#ifndef MIN_COOLING_SLOPE_DEG_BED
#define MIN_COOLING_SLOPE_DEG_BED 1.50
#endif
@ -63,7 +65,7 @@ void gcode_M190() {
KEEPALIVE_STATE(NOT_BUSY);
#endif
target_extruder = active_extruder; // for print_heaterstates
gcode.target_extruder = active_extruder; // for print_heaterstates
#if ENABLED(PRINTER_EVENT_LEDS)
const float start_temp = thermalManager.degBed();
@ -95,7 +97,7 @@ void gcode_M190() {
}
idle();
refresh_cmd_timeout(); // to prevent stepper_inactive_time from running out
gcode.refresh_cmd_timeout(); // to prevent stepper_inactive_time from running out
const float temp = thermalManager.degBed();

View File

@ -20,6 +20,9 @@
*
*/
#include "../gcode.h"
#include "../../module/temperature.h"
/**
* M303: PID relay autotune
*
@ -28,7 +31,7 @@
* C<cycles>
* U<bool> with a non-zero value will apply the result to current settings
*/
void gcode_M303() {
void GcodeSuite::M303() {
#if HAS_PID_HEATING
const int e = parser.intval('E'), c = parser.intval('C', 5);
const bool u = parser.boolval('U');