Merge ConformingHostMessages (PR#2822)

This commit is contained in:
Richard Wackerbarth 2015-12-07 16:12:46 -06:00
commit ae4acc42ec
3 changed files with 91 additions and 73 deletions

View file

@ -351,6 +351,10 @@ extern uint8_t active_extruder;
extern void digipot_i2c_init(); extern void digipot_i2c_init();
#endif #endif
#if HAS_TEMP_0 || HAS_TEMP_BED || ENABLED(HEATER_0_USES_MAX6675)
void print_heaterstates();
#endif
extern void calculate_volumetric_multipliers(); extern void calculate_volumetric_multipliers();
#endif //MARLIN_H #endif //MARLIN_H

View file

@ -288,7 +288,6 @@ static millis_t stepper_inactive_time = DEFAULT_STEPPER_DEACTIVE_TIME * 1000L;
millis_t print_job_start_ms = 0; ///< Print job start time millis_t print_job_start_ms = 0; ///< Print job start time
millis_t print_job_stop_ms = 0; ///< Print job stop time millis_t print_job_stop_ms = 0; ///< Print job stop time
static uint8_t target_extruder; static uint8_t target_extruder;
bool no_wait_for_cooling = true;
bool target_direction; bool target_direction;
#if ENABLED(AUTO_BED_LEVELING_FEATURE) #if ENABLED(AUTO_BED_LEVELING_FEATURE)
@ -3803,14 +3802,9 @@ inline void gcode_M104() {
} }
} }
/**
* M105: Read hot end and bed temperature
*/
inline void gcode_M105() {
if (setTargetedHotend(105)) return;
#if HAS_TEMP_0 || HAS_TEMP_BED || ENABLED(HEATER_0_USES_MAX6675) #if HAS_TEMP_0 || HAS_TEMP_BED || ENABLED(HEATER_0_USES_MAX6675)
SERIAL_PROTOCOLPGM(MSG_OK);
void print_heaterstates() {
#if HAS_TEMP_0 || ENABLED(HEATER_0_USES_MAX6675) #if HAS_TEMP_0 || ENABLED(HEATER_0_USES_MAX6675)
SERIAL_PROTOCOLPGM(" T:"); SERIAL_PROTOCOLPGM(" T:");
SERIAL_PROTOCOL_F(degHotend(target_extruder), 1); SERIAL_PROTOCOL_F(degHotend(target_extruder), 1);
@ -3823,6 +3817,7 @@ inline void gcode_M105() {
SERIAL_PROTOCOLPGM(" /"); SERIAL_PROTOCOLPGM(" /");
SERIAL_PROTOCOL_F(degTargetBed(), 1); SERIAL_PROTOCOL_F(degTargetBed(), 1);
#endif #endif
#if EXTRUDERS > 1
for (int8_t e = 0; e < EXTRUDERS; ++e) { for (int8_t e = 0; e < EXTRUDERS; ++e) {
SERIAL_PROTOCOLPGM(" T"); SERIAL_PROTOCOLPGM(" T");
SERIAL_PROTOCOL(e); SERIAL_PROTOCOL(e);
@ -3831,19 +3826,8 @@ inline void gcode_M105() {
SERIAL_PROTOCOLPGM(" /"); SERIAL_PROTOCOLPGM(" /");
SERIAL_PROTOCOL_F(degTargetHotend(e), 1); SERIAL_PROTOCOL_F(degTargetHotend(e), 1);
} }
#else // !HAS_TEMP_0 && !HAS_TEMP_BED
SERIAL_ERROR_START;
SERIAL_ERRORLNPGM(MSG_ERR_NO_THERMISTORS);
#endif #endif
#if HAS_TEMP_BED
SERIAL_PROTOCOLPGM(" @:");
#ifdef EXTRUDER_WATTS
SERIAL_PROTOCOL((EXTRUDER_WATTS * getHeaterPower(target_extruder)) / 127);
SERIAL_PROTOCOLCHAR('W');
#else
SERIAL_PROTOCOL(getHeaterPower(target_extruder));
#endif
SERIAL_PROTOCOLPGM(" B@:"); SERIAL_PROTOCOLPGM(" B@:");
#ifdef BED_WATTS #ifdef BED_WATTS
SERIAL_PROTOCOL((BED_WATTS * getHeaterPower(-1)) / 127); SERIAL_PROTOCOL((BED_WATTS * getHeaterPower(-1)) / 127);
@ -3851,7 +3835,27 @@ inline void gcode_M105() {
#else #else
SERIAL_PROTOCOL(getHeaterPower(-1)); SERIAL_PROTOCOL(getHeaterPower(-1));
#endif #endif
#endif
SERIAL_PROTOCOLPGM(" @:");
#ifdef EXTRUDER_WATTS
SERIAL_PROTOCOL((EXTRUDER_WATTS * getHeaterPower(target_extruder)) / 127);
SERIAL_PROTOCOLCHAR('W');
#else
SERIAL_PROTOCOL(getHeaterPower(target_extruder));
#endif
#if EXTRUDERS > 1
for (int8_t e = 0; e < EXTRUDERS; ++e) {
SERIAL_PROTOCOLPGM(" @");
SERIAL_PROTOCOL(e);
SERIAL_PROTOCOLCHAR(':');
#ifdef EXTRUDER_WATTS
SERIAL_PROTOCOL((EXTRUDER_WATTS * getHeaterPower(e)) / 127);
SERIAL_PROTOCOLCHAR('W');
#else
SERIAL_PROTOCOL(getHeaterPower(e));
#endif
}
#endif
#if ENABLED(SHOW_TEMP_ADC_VALUES) #if ENABLED(SHOW_TEMP_ADC_VALUES)
#if HAS_TEMP_BED #if HAS_TEMP_BED
SERIAL_PROTOCOLPGM(" ADC B:"); SERIAL_PROTOCOLPGM(" ADC B:");
@ -3868,6 +3872,22 @@ inline void gcode_M105() {
SERIAL_PROTOCOL_F(rawHotendTemp(cur_extruder) / OVERSAMPLENR, 0); SERIAL_PROTOCOL_F(rawHotendTemp(cur_extruder) / OVERSAMPLENR, 0);
} }
#endif #endif
}
#endif
/**
* M105: Read hot end and bed temperature
*/
inline void gcode_M105() {
if (setTargetedHotend(105)) return;
#if HAS_TEMP_0 || HAS_TEMP_BED || ENABLED(HEATER_0_USES_MAX6675)
SERIAL_PROTOCOLPGM(MSG_OK);
print_heaterstates();
#else // !HAS_TEMP_0 && !HAS_TEMP_BED
SERIAL_ERROR_START;
SERIAL_ERRORLNPGM(MSG_ERR_NO_THERMISTORS);
#endif
SERIAL_EOL; SERIAL_EOL;
} }
@ -3890,6 +3910,8 @@ inline void gcode_M105() {
* M109: Wait for extruder(s) to reach temperature * M109: Wait for extruder(s) to reach temperature
*/ */
inline void gcode_M109() { inline void gcode_M109() {
bool no_wait_for_cooling = true;
if (setTargetedHotend(109)) return; if (setTargetedHotend(109)) return;
if (marlin_debug_flags & DEBUG_DRYRUN) return; if (marlin_debug_flags & DEBUG_DRYRUN) return;
@ -3931,10 +3953,9 @@ inline void gcode_M109() {
{ // while loop { // while loop
if (millis() > temp_ms + 1000UL) { //Print temp & remaining time every 1s while waiting if (millis() > temp_ms + 1000UL) { //Print temp & remaining time every 1s while waiting
SERIAL_PROTOCOLPGM("T:"); #if HAS_TEMP_0 || HAS_TEMP_BED || ENABLED(HEATER_0_USES_MAX6675)
SERIAL_PROTOCOL_F(degHotend(target_extruder), 1); print_heaterstates();
SERIAL_PROTOCOLPGM(" E:"); #endif
SERIAL_PROTOCOL((int)target_extruder);
#ifdef TEMP_RESIDENCY_TIME #ifdef TEMP_RESIDENCY_TIME
SERIAL_PROTOCOLPGM(" W:"); SERIAL_PROTOCOLPGM(" W:");
if (residency_start_ms > -1) { if (residency_start_ms > -1) {
@ -3976,6 +3997,8 @@ inline void gcode_M109() {
* Rxxx Wait for bed current temp to reach target temp. Waits when heating and cooling * Rxxx Wait for bed current temp to reach target temp. Waits when heating and cooling
*/ */
inline void gcode_M190() { inline void gcode_M190() {
bool no_wait_for_cooling = true;
if (marlin_debug_flags & DEBUG_DRYRUN) return; if (marlin_debug_flags & DEBUG_DRYRUN) return;
LCD_MESSAGEPGM(MSG_BED_HEATING); LCD_MESSAGEPGM(MSG_BED_HEATING);
@ -3993,13 +4016,10 @@ inline void gcode_M109() {
if (ms > temp_ms + 1000UL) { //Print Temp Reading every 1 second while heating up. if (ms > temp_ms + 1000UL) { //Print Temp Reading every 1 second while heating up.
temp_ms = ms; temp_ms = ms;
float tt = degHotend(active_extruder); float tt = degHotend(active_extruder);
SERIAL_PROTOCOLPGM("T:"); #if HAS_TEMP_0 || HAS_TEMP_BED || ENABLED(HEATER_0_USES_MAX6675)
SERIAL_PROTOCOL(tt); print_heaterstates();
SERIAL_PROTOCOLPGM(" E:");
SERIAL_PROTOCOL((int)active_extruder);
SERIAL_PROTOCOLPGM(" B:");
SERIAL_PROTOCOL_F(degBed(), 1);
SERIAL_EOL; SERIAL_EOL;
#endif
} }
idle(); idle();
} }
@ -4912,6 +4932,9 @@ inline void gcode_M303() {
int e = code_seen('E') ? code_value_short() : 0; int e = code_seen('E') ? code_value_short() : 0;
int c = code_seen('C') ? code_value_short() : 5; int c = code_seen('C') ? code_value_short() : 5;
float temp = code_seen('S') ? code_value() : (e < 0 ? 70.0 : 150.0); float temp = code_seen('S') ? code_value() : (e < 0 ? 70.0 : 150.0);
if (e >=0 && e < EXTRUDERS)
target_extruder = e;
PID_autotune(temp, e, c); PID_autotune(temp, e, c);
} }

View file

@ -328,19 +328,10 @@ void PID_autotune(float temp, int extruder, int ncycles) {
} }
// Every 2 seconds... // Every 2 seconds...
if (ms > temp_ms + 2000) { if (ms > temp_ms + 2000) {
int p; #if HAS_TEMP_0 || HAS_TEMP_BED || ENABLED(HEATER_0_USES_MAX6675)
if (extruder < 0) { print_heaterstates();
p = soft_pwm_bed; SERIAL_EOL;
SERIAL_PROTOCOLPGM(MSG_B); #endif
}
else {
p = soft_pwm[extruder];
SERIAL_PROTOCOLPGM(MSG_T);
}
SERIAL_PROTOCOL(input);
SERIAL_PROTOCOLPGM(MSG_AT);
SERIAL_PROTOCOLLN(p);
temp_ms = ms; temp_ms = ms;
} // every 2 seconds } // every 2 seconds