Merge pull request #5133 from thinkyhead/rc_M355_case_light

M355 Case light
master
Scott Lahteine 8 years ago committed by GitHub
commit 66744a6076

@ -509,6 +509,7 @@
#define HAS_E4_STEP (PIN_EXISTS(E4_STEP)) #define HAS_E4_STEP (PIN_EXISTS(E4_STEP))
#define HAS_DIGIPOTSS (PIN_EXISTS(DIGIPOTSS)) #define HAS_DIGIPOTSS (PIN_EXISTS(DIGIPOTSS))
#define HAS_BUZZER (PIN_EXISTS(BEEPER) || ENABLED(LCD_USE_I2C_BUZZER)) #define HAS_BUZZER (PIN_EXISTS(BEEPER) || ENABLED(LCD_USE_I2C_BUZZER))
#define HAS_CASE_LIGHT (PIN_EXISTS(CASE_LIGHT))
#define HAS_MOTOR_CURRENT_PWM (PIN_EXISTS(MOTOR_CURRENT_PWM_XY) || PIN_EXISTS(MOTOR_CURRENT_PWM_Z) || PIN_EXISTS(MOTOR_CURRENT_PWM_E)) #define HAS_MOTOR_CURRENT_PWM (PIN_EXISTS(MOTOR_CURRENT_PWM_XY) || PIN_EXISTS(MOTOR_CURRENT_PWM_Z) || PIN_EXISTS(MOTOR_CURRENT_PWM_E))

@ -224,6 +224,10 @@
#define EXTRUDER_AUTO_FAN_TEMPERATURE 50 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed #define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed
// Define a pin to turn case light on/off
//#define CASE_LIGHT_PIN 4
//#define CASE_LIGHT_DEFAULT_ON // Uncomment to set default state to on
//=========================================================================== //===========================================================================
//============================ Mechanical Settings ========================== //============================ Mechanical Settings ==========================
//=========================================================================== //===========================================================================

@ -861,12 +861,18 @@ void setup_homepin(void) {
#endif #endif
} }
void setup_photpin() { #if HAS_CASE_LIGHT
#if HAS_PHOTOGRAPH
OUT_WRITE(PHOTOGRAPH_PIN, LOW); void setup_case_light() {
#if ENABLED(CASE_LIGHT_DEFAULT_ON)
OUT_WRITE(CASE_LIGHT_PIN, HIGH);
#else
OUT_WRITE(CASE_LIGHT_PIN, LOW);
#endif #endif
} }
#endif
void setup_powerhold() { void setup_powerhold() {
#if HAS_SUICIDE #if HAS_SUICIDE
OUT_WRITE(SUICIDE_PIN, HIGH); OUT_WRITE(SUICIDE_PIN, HIGH);
@ -7087,6 +7093,38 @@ inline void gcode_M907() {
#endif // HAS_MICROSTEPS #endif // HAS_MICROSTEPS
#if HAS_CASE_LIGHT
/**
* M355: Turn case lights on/off
*
* S<int> change state on/off or sets PWM
*
*/
inline void gcode_M355() {
if (code_seen('S')) {
SERIAL_ECHO_START;
SERIAL_ECHOPGM("Case lights ");
byte light_pwm = code_value_byte();
switch (light_pwm) {
case 0: // Disable lights
SERIAL_ECHOPGM("off");
break;
case 1: // Enable lights
light_pwm = 255;
SERIAL_ECHOPGM("on");
break;
default: // Enable lights PWM
SERIAL_ECHOPAIR("set to: ", (int)map(light_pwm, 0, 255, 0, 100));
SERIAL_CHAR('%');
break;
}
analogWrite(CASE_LIGHT_PIN, light_pwm);
SERIAL_EOL;
}
}
#endif // HAS_CASE_LIGHT
#if ENABLED(MIXING_EXTRUDER) #if ENABLED(MIXING_EXTRUDER)
/** /**
@ -8195,6 +8233,14 @@ void process_next_command() {
#endif // HAS_MICROSTEPS #endif // HAS_MICROSTEPS
#if HAS_CASE_LIGHT
case 355: // M355 Turn case lights on/off
gcode_M355();
break;
#endif // HAS_CASE_LIGHT
case 999: // M999: Restart after being Stopped case 999: // M999: Restart after being Stopped
gcode_M999(); gcode_M999();
break; break;
@ -9693,9 +9739,16 @@ void setup() {
#endif #endif
stepper.init(); // Initialize stepper, this enables interrupts! stepper.init(); // Initialize stepper, this enables interrupts!
setup_photpin();
servo_init(); servo_init();
#if HAS_PHOTOGRAPH
OUT_WRITE(PHOTOGRAPH_PIN, LOW);
#endif
#if HAS_CASE_LIGHT
setup_case_light();
#endif
#if HAS_BED_PROBE #if HAS_BED_PROBE
endstops.enable_z_probe(false); endstops.enable_z_probe(false);
#endif #endif

@ -224,6 +224,10 @@
#define EXTRUDER_AUTO_FAN_TEMPERATURE 35 #define EXTRUDER_AUTO_FAN_TEMPERATURE 35
#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed #define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed
// Define a pin to turn case light on/off
//#define CASE_LIGHT_PIN 4
//#define CASE_LIGHT_DEFAULT_ON // Uncomment to set default state to on
//=========================================================================== //===========================================================================
//============================ Mechanical Settings ========================== //============================ Mechanical Settings ==========================
//=========================================================================== //===========================================================================

@ -224,6 +224,10 @@
#define EXTRUDER_AUTO_FAN_TEMPERATURE 50 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed #define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed
// Define a pin to turn case light on/off
//#define CASE_LIGHT_PIN 4
//#define CASE_LIGHT_DEFAULT_ON // Uncomment to set default state to on
//=========================================================================== //===========================================================================
//============================ Mechanical Settings ========================== //============================ Mechanical Settings ==========================
//=========================================================================== //===========================================================================

@ -224,6 +224,10 @@
#define EXTRUDER_AUTO_FAN_TEMPERATURE 50 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed #define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed
// Define a pin to turn case light on/off
//#define CASE_LIGHT_PIN 4
//#define CASE_LIGHT_DEFAULT_ON // Uncomment to set default state to on
//=========================================================================== //===========================================================================
//============================ Mechanical Settings ========================== //============================ Mechanical Settings ==========================
//=========================================================================== //===========================================================================

@ -224,6 +224,10 @@
#define EXTRUDER_AUTO_FAN_TEMPERATURE 50 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed #define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed
// Define a pin to turn case light on/off
//#define CASE_LIGHT_PIN 4
//#define CASE_LIGHT_DEFAULT_ON // Uncomment to set default state to on
//=========================================================================== //===========================================================================
//============================ Mechanical Settings ========================== //============================ Mechanical Settings ==========================
//=========================================================================== //===========================================================================

@ -230,6 +230,10 @@
#define EXTRUDER_AUTO_FAN_TEMPERATURE 50 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed #define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed
// Define a pin to turn case light on/off
//#define CASE_LIGHT_PIN 4
//#define CASE_LIGHT_DEFAULT_ON // Uncomment to set default state to on
//=========================================================================== //===========================================================================
//============================ Mechanical Settings ========================== //============================ Mechanical Settings ==========================
//=========================================================================== //===========================================================================

@ -224,6 +224,10 @@
#define EXTRUDER_AUTO_FAN_TEMPERATURE 50 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed #define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed
// Define a pin to turn case light on/off
//#define CASE_LIGHT_PIN 4
//#define CASE_LIGHT_DEFAULT_ON // Uncomment to set default state to on
//=========================================================================== //===========================================================================
//============================ Mechanical Settings ========================== //============================ Mechanical Settings ==========================
//=========================================================================== //===========================================================================

@ -224,6 +224,10 @@
#define EXTRUDER_AUTO_FAN_TEMPERATURE 50 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed #define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed
// Define a pin to turn case light on/off
//#define CASE_LIGHT_PIN 4
//#define CASE_LIGHT_DEFAULT_ON // Uncomment to set default state to on
//=========================================================================== //===========================================================================
//============================ Mechanical Settings ========================== //============================ Mechanical Settings ==========================
//=========================================================================== //===========================================================================

@ -224,6 +224,10 @@
#define EXTRUDER_AUTO_FAN_TEMPERATURE 50 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed #define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed
// Define a pin to turn case light on/off
//#define CASE_LIGHT_PIN 4
//#define CASE_LIGHT_DEFAULT_ON // Uncomment to set default state to on
//=========================================================================== //===========================================================================
//============================ Mechanical Settings ========================== //============================ Mechanical Settings ==========================
//=========================================================================== //===========================================================================

@ -232,6 +232,10 @@
#define EXTRUDER_AUTO_FAN_TEMPERATURE 50 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed #define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed
// Define a pin to turn case light on/off
//#define CASE_LIGHT_PIN 4
//#define CASE_LIGHT_DEFAULT_ON // Uncomment to set default state to on
//=========================================================================== //===========================================================================
//============================ Mechanical Settings ========================== //============================ Mechanical Settings ==========================
//=========================================================================== //===========================================================================

@ -224,6 +224,10 @@
#define EXTRUDER_AUTO_FAN_TEMPERATURE 50 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed #define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed
// Define a pin to turn case light on/off
//#define CASE_LIGHT_PIN 4
//#define CASE_LIGHT_DEFAULT_ON // Uncomment to set default state to on
//=========================================================================== //===========================================================================
//============================ Mechanical Settings ========================== //============================ Mechanical Settings ==========================
//=========================================================================== //===========================================================================

@ -224,6 +224,10 @@
#define EXTRUDER_AUTO_FAN_TEMPERATURE 50 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed #define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed
// Define a pin to turn case light on/off
//#define CASE_LIGHT_PIN 4
//#define CASE_LIGHT_DEFAULT_ON // Uncomment to set default state to on
//=========================================================================== //===========================================================================
//============================ Mechanical Settings ========================== //============================ Mechanical Settings ==========================
//=========================================================================== //===========================================================================

@ -224,6 +224,10 @@
#define EXTRUDER_AUTO_FAN_TEMPERATURE 50 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed #define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed
// Define a pin to turn case light on/off
//#define CASE_LIGHT_PIN 4
//#define CASE_LIGHT_DEFAULT_ON // Uncomment to set default state to on
//=========================================================================== //===========================================================================
//============================ Mechanical Settings ========================== //============================ Mechanical Settings ==========================
//=========================================================================== //===========================================================================

@ -224,6 +224,10 @@
#define EXTRUDER_AUTO_FAN_TEMPERATURE 50 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed #define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed
// Define a pin to turn case light on/off
//#define CASE_LIGHT_PIN 4
//#define CASE_LIGHT_DEFAULT_ON // Uncomment to set default state to on
//=========================================================================== //===========================================================================
//============================ Mechanical Settings ========================== //============================ Mechanical Settings ==========================
//=========================================================================== //===========================================================================

@ -229,6 +229,10 @@
#define EXTRUDER_AUTO_FAN_TEMPERATURE 50 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed #define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed
// Define a pin to turn case light on/off
//#define CASE_LIGHT_PIN 4
//#define CASE_LIGHT_DEFAULT_ON // Uncomment to set default state to on
//=========================================================================== //===========================================================================
//============================ Mechanical Settings ========================== //============================ Mechanical Settings ==========================
//=========================================================================== //===========================================================================

@ -224,6 +224,10 @@
#define EXTRUDER_AUTO_FAN_TEMPERATURE 50 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed #define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed
// Define a pin to turn case light on/off
//#define CASE_LIGHT_PIN 4
//#define CASE_LIGHT_DEFAULT_ON // Uncomment to set default state to on
//=========================================================================== //===========================================================================
//============================ Mechanical Settings ========================== //============================ Mechanical Settings ==========================
//=========================================================================== //===========================================================================

@ -224,6 +224,10 @@
#define EXTRUDER_AUTO_FAN_TEMPERATURE 50 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed #define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed
// Define a pin to turn case light on/off
//#define CASE_LIGHT_PIN 4
//#define CASE_LIGHT_DEFAULT_ON // Uncomment to set default state to on
//=========================================================================== //===========================================================================
//============================ Mechanical Settings ========================== //============================ Mechanical Settings ==========================
//=========================================================================== //===========================================================================

@ -224,6 +224,10 @@
#define EXTRUDER_AUTO_FAN_TEMPERATURE 50 #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed #define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed
// Define a pin to turn case light on/off
//#define CASE_LIGHT_PIN 4
//#define CASE_LIGHT_DEFAULT_ON // Uncomment to set default state to on
//=========================================================================== //===========================================================================
//============================ Mechanical Settings ========================== //============================ Mechanical Settings ==========================
//=========================================================================== //===========================================================================

Loading…
Cancel
Save