If there's no HEATER_PIN, there's no heater, so disable the

heater code. Also remove the temp_achieved() declaration
in heater.h, which has no definition in heater.c.

If you wonder about what might be the use of not having a heater,
think about a paste dispenser or an externally heated extruder :-)

Having no heater removes a whopping 1200 bytes of program size.
This commit is contained in:
Markus Hitter 2010-10-07 22:38:21 +02:00
parent 896f6e140f
commit 2391dc2901
4 changed files with 21 additions and 0 deletions

View File

@ -171,6 +171,7 @@
// OC2A DIO11
// OC2B DIO3
// comment out the ones you don't have
#define HEATER_PIN DIO6
#define HEATER_PWM OCR0A

View File

@ -176,9 +176,11 @@ void scan_char(uint8_t c) {
// but it takes less code, less memory and loses no precision if we do it here instead
if ((next_target.M == 104) || (next_target.M == 109))
next_target.S = decfloat_to_int(&read_digit, 4, 1);
#ifdef HEATER_PIN
// if this is heater PID stuff, multiply by PID_SCALE because we divide by PID_SCALE later on
else if ((next_target.M >= 130) && (next_target.M <= 132))
next_target.S = decfloat_to_int(&read_digit, PID_SCALE, 1);
#endif
else
next_target.S = decfloat_to_int(&read_digit, 1, 1);
if (debug_flags & DEBUG_ECHO)
@ -617,6 +619,7 @@ void process_gcode_command(GCODE_COMMAND *gcmd) {
sersendf_P("X:%ld,Y:%ld,Z:%ld,E:%ld,F:%ld\n", current_position.X, current_position.Y, current_position.Z, current_position.E, current_position.F);
break;
#ifdef HEATER_PIN
// M130- heater P factor
case 130:
if (gcmd->seen_S)
@ -641,6 +644,7 @@ void process_gcode_command(GCODE_COMMAND *gcmd) {
case 134:
heater_save_settings();
break;
#endif /* HEATER_PIN */
#ifdef DEBUG
// M140- echo off

View File

@ -1,5 +1,7 @@
#include "heater.h"
#ifdef HEATER_PIN
#include <avr/eeprom.h>
#include "sersendf.h"
@ -101,3 +103,5 @@ void heater_tick(int16_t current_temp, int16_t target_temp) {
disable_heater();
#endif
}
#endif /* HEATER_PIN */

View File

@ -3,6 +3,8 @@
#include "config.h"
#ifdef HEATER_PIN
#ifdef HEATER_PWM
#define enable_heater() { TCCR0A |= MASK(COM0A1); }
#define disable_heater() { TCCR0A &= ~MASK(COM0A1); }
@ -26,4 +28,14 @@ void heater_save_settings(void);
void heater_tick(int16_t current_temp, int16_t target_temp);
uint8_t temp_achieved(void);
#else /* HEATER_PIN */
// if there is no heater pin, there is no heater
#define enable_heater() /* empty */
#define disable_heater() /* empty */
#define heater_init() /* empty */
#define heater_save_settings() /* empty */
#define heater_tick(p1, p2) /* empty */
#endif /* HEATER_PIN */
#endif /* _HEATER_H */