From 80e98e9b222110c200aebb883bc5c548bf4103a2 Mon Sep 17 00:00:00 2001 From: plasmator Date: Tue, 25 Jan 2011 22:57:00 -0600 Subject: [PATCH] Added Heated Bed Support Signed-off-by: plasmator Signed-off-by: Michael Moon --- config.h.dist | 2 +- gcode_process.c | 10 ++++++++++ temp.c | 10 +++++++++- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/config.h.dist b/config.h.dist index 744a3e8..e7c6a6d 100644 --- a/config.h.dist +++ b/config.h.dist @@ -273,7 +273,7 @@ struct { // number of heaters- for GEN3, set to zero as extruder manages the heater by itself #define NUM_HEATERS 0 - +#define BED_HEATER 3 //Set to 0 if no bed heater // check if heater responds to changes in target temperature, disable and spit errors if not // #define HEATER_SANITY_CHECK diff --git a/gcode_process.c b/gcode_process.c index 9b8c644..a435b54 100644 --- a/gcode_process.c +++ b/gcode_process.c @@ -360,6 +360,16 @@ void process_gcode_command() { if (next_target.seen_S) heater_set(next_target.P, next_target.S); break; + + case 140: //Set heated bed temperature + temp_set(BED_HEATER, next_target.S); + if (next_target.S) { + power_on(); + } + else { + disable_heater(); + } + break; #endif /* NUM_HEATERS > 0 */ // M190- power on diff --git a/temp.c b/temp.c index c177038..ae30dac 100644 --- a/temp.c +++ b/temp.c @@ -284,7 +284,15 @@ void temp_print(uint8_t index) { uint8_t c = 0; c = (temp_sensors_runtime[index].last_read_temp & 3) * 25; + +#if BED_HEATER > 0 + uint8_t b = 0; + b = (temp_sensors_runtime[BED_HEATER - 1].last_read_temp & 3) * 25; - sersendf_P(PSTR("T:%u.%u\n"), temp_sensors_runtime[index].last_read_temp >> 2, c); + sersendf_P(PSTR("T:%u.%u B:%u.%u\n"), temp_sensors_runtime[index].last_read_temp >> 2, c, temp_sensors_runtime[BED_HEATER - 1].last_read_temp >> 2 , b); +#else + sersendf_P(PSTR("T:%u.%u"), temp_sensors_runtime[index].last_read_temp >> 2, c); +#endif + } #endif