From 97f344f0fae3ec2db561ab0b000081a6d4a72c3d Mon Sep 17 00:00:00 2001 From: Michael Moon Date: Wed, 2 Feb 2011 18:20:08 +1100 Subject: [PATCH] changes discussed in chat on pull 19 --- gcode_process.c | 6 ++++-- heater.h | 3 ++- temp.c | 2 +- temp.h | 5 +++-- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/gcode_process.c b/gcode_process.c index 2c11311..954b03d 100644 --- a/gcode_process.c +++ b/gcode_process.c @@ -275,14 +275,16 @@ void process_gcode_command() { // M7/M106- fan on case 7: case 106: - if (NUM_HEATERS > 1) + #if NUM_HEATERS >= 1 heater_set(1, 255); + #endif break; // M107- fan off case 9: case 107: - if (NUM_HEATERS > 1) + #if NUM_HEATERS >= 1 heater_set(1, 0); + #endif break; // M109- set temp and wait diff --git a/heater.h b/heater.h index c8d1a6e..1251383 100644 --- a/heater.h +++ b/heater.h @@ -13,7 +13,8 @@ typedef enum { #include "config.h" - NUM_HEATERS + NUM_HEATERS, + HEATER_none } heater_t; #undef DEFINE_HEATER diff --git a/temp.c b/temp.c index 51412fa..bc4b954 100644 --- a/temp.c +++ b/temp.c @@ -36,7 +36,7 @@ typedef struct { } temp_sensor_definition_t; #undef DEFINE_TEMP_SENSOR -#define DEFINE_TEMP_SENSOR(name, type, pin, heater) { (type), (pin), (heater) }, +#define DEFINE_TEMP_SENSOR(name, type, pin) { (type), (pin), (HEATER_ ## name) }, static const temp_sensor_definition_t temp_sensors[NUM_TEMP_SENSORS] = { #include "config.h" diff --git a/temp.h b/temp.h index 6c4d7c9..1815c4c 100644 --- a/temp.h +++ b/temp.h @@ -13,10 +13,11 @@ we still need to specify which analog pins we use in machine.h for the analog se */ #undef DEFINE_TEMP_SENSOR -#define DEFINE_TEMP_SENSOR(name, type, pin, heater) TEMP_SENSOR_##name, +#define DEFINE_TEMP_SENSOR(name, type, pin) TEMP_SENSOR_ ## name, typedef enum { #include "config.h" - NUM_TEMP_SENSORS + NUM_TEMP_SENSORS, + TEMP_SENSOR_none } temp_sensor_t; #undef DEFINE_TEMP_SENSOR