Skip to content

Commit

Permalink
Merge pull request #3282 from jbrazio/bugfix/m104-timer-wont-start
Browse files Browse the repository at this point in the history
M104 not starting the print timer
  • Loading branch information
thinkyhead committed Mar 30, 2016
2 parents 5f32184 + 187c183 commit 8bf5f7c
Showing 1 changed file with 20 additions and 15 deletions.
35 changes: 20 additions & 15 deletions Marlin/Marlin_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4086,16 +4086,21 @@ inline void gcode_M104() {
if (setTargetedHotend(104)) return;
if (DEBUGGING(DRYRUN)) return;

// Start hook must happen before setTargetHotend()
print_job_start();

if (code_seen('S')) {
float temp = code_value();
setTargetHotend(temp, target_extruder);
#if ENABLED(DUAL_X_CARRIAGE)
if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && target_extruder == 0)
setTargetHotend1(temp == 0.0 ? 0.0 : temp + duplicate_extruder_temp_offset);
#endif

if (temp > degHotend(target_extruder)) LCD_MESSAGEPGM(MSG_HEATING);
}

print_job_stop();
if (print_job_stop()) LCD_MESSAGEPGM(WELCOME_MSG);
}

#if HAS_TEMP_0 || HAS_TEMP_BED || ENABLED(HEATER_0_USES_MAX6675)
Expand Down Expand Up @@ -4220,12 +4225,12 @@ inline void gcode_M105() {
inline void gcode_M109() {
bool no_wait_for_cooling = true;

// Start hook must happen before setTargetHotend()
print_job_start();

if (setTargetedHotend(109)) return;
if (DEBUGGING(DRYRUN)) return;

// Start hook must happen before setTargetHotend()
print_job_start();

no_wait_for_cooling = code_seen('S');
if (no_wait_for_cooling || code_seen('R')) {
float temp = code_value();
Expand Down Expand Up @@ -7698,17 +7703,6 @@ bool print_job_start(millis_t t /* = 0 */) {
return true;
}

/**
* Output the print job timer in seconds
*
* @return the number of seconds
*/
millis_t print_job_timer() {
if (!print_job_start_ms) return 0;
return (((print_job_stop_ms > print_job_start_ms)
? print_job_stop_ms : millis()) - print_job_start_ms) / 1000;
}

/**
* Check if the running print job has finished and stop the timer
*
Expand All @@ -7727,3 +7721,14 @@ bool print_job_stop(bool force /* = false */) {
print_job_stop_ms = millis();
return true;
}

/**
* Output the print job timer in seconds
*
* @return the number of seconds
*/
millis_t print_job_timer() {
if (!print_job_start_ms) return 0;
return (((print_job_stop_ms > print_job_start_ms)
? print_job_stop_ms : millis()) - print_job_start_ms) / 1000;
}

0 comments on commit 8bf5f7c

Please sign in to comment.