From 243f32e5b8c39d41402c19f9169d067cb26d0bb5 Mon Sep 17 00:00:00 2001 From: InsanityAutomation Date: Wed, 9 May 2018 19:53:46 -0400 Subject: [PATCH] Reimplement laser control --- Marlin/Configuration.h | 8 ++++---- Marlin/Configuration_adv.h | 2 +- Marlin/Marlin_main.cpp | 31 ++++++++++++++++++++++++++++++- Marlin/Version.h | 4 ++-- Marlin/language_en.h | 8 ++++++++ Marlin/ultralcd.cpp | 26 ++++++++++++++++++-------- 6 files changed, 63 insertions(+), 16 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index f0ecb8553d..0e10fc563a 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -20,6 +20,9 @@ * */ +//#define X_2208 +//#define Y_2208 + /** * Configuration.h * @@ -91,9 +94,6 @@ */ -//#define X_2208 -#define Y_2208 - // Enable to show the bitmap in Marlin/_Bootscreen.h on startup. #define SHOW_CUSTOM_BOOTSCREEN @@ -1100,7 +1100,7 @@ #endif // Homing speeds (mm/m) -#define HOMING_FEEDRATE_XY (50*60) +#define HOMING_FEEDRATE_XY (80*60) #define HOMING_FEEDRATE_Z (4*60) // @section calibrate diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index adf1960724..67e712b47a 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -749,7 +749,7 @@ */ #define LIN_ADVANCE #if ENABLED(LIN_ADVANCE) - #define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed + #define LIN_ADVANCE_K 0.07 // Unit: mm compression per 1mm/s extruder speed //#define LA_DEBUG // If enabled, this will generate debug information output over USB. #endif diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index b15458d8c2..2cd3950648 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -6506,6 +6506,24 @@ inline void gcode_G92() { #endif // SPINDLE_LASER_ENABLE +#if ENABLED(FAN_AS_LASER) + /** + * M3, M4: Laser On + */ + inline void gcode_M3_M4(bool is_M3) { + stepper.synchronize(); + fanSpeeds[FAN_NUM_AS_LASER] = parser.byteval('S', 255); + } + + /** + * M5: Laser Off + */ + inline void gcode_M5() { + stepper.synchronize(); + fanSpeeds[FAN_NUM_AS_LASER] = 0; + } +#endif + /** * M17: Enable power on all stepper motors */ @@ -7937,6 +7955,11 @@ inline void gcode_M105() { */ inline void gcode_M106() { const uint8_t p = parser.byteval('P'); + + #if(ENABLED(LASER_PIN_DEDICATED) && ENABLED(FAN_AS_LASER) && (FAN_NUM_AS_LASER==p)) + return + #endif + if (p < FAN_COUNT) { #if ENABLED(EXTRA_FAN_SPEED) const int16_t t = parser.intval('T'); @@ -7966,6 +7989,9 @@ inline void gcode_M105() { */ inline void gcode_M107() { const uint16_t p = parser.ushortval('P'); + #if(ENABLED(LASER_PIN_DEDICATED) && ENABLED(FAN_AS_LASER) && (FAN_NUM_AS_LASER==p)) + return + #endif if (p < FAN_COUNT) fanSpeeds[p] = 0; } @@ -12075,7 +12101,10 @@ void process_parsed_command() { case 4: gcode_M3_M4(false); break; // M4: Laser/CCW-Spindle Power case 5: gcode_M5(); break; // M5: Laser/Spindle OFF #endif - + #if ENABLED(FAN_AS_LASER) + case 3: gcode_M3_M4(true); break; // M3: Laser Power On + case 5: gcode_M5(); break; // M5: Laser OFF + #endif case 17: gcode_M17(); break; // M17: Enable all steppers #if ENABLED(SDSUPPORT) diff --git a/Marlin/Version.h b/Marlin/Version.h index d64e11ffe9..081b2f3bb6 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -35,7 +35,7 @@ /** * Marlin release version identifier */ - #define SHORT_BUILD_VERSION "TM3D 1.1.8_R3" + #define SHORT_BUILD_VERSION "TM3D 1.1.8_R4" /** * Verbose version identifier which should contain a reference to the location @@ -48,7 +48,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ - #define STRING_DISTRIBUTION_DATE "2018-04-24" + #define STRING_DISTRIBUTION_DATE "2018-05-09" /** * Required minimum Configuration.h and Configuration_adv.h file versions. diff --git a/Marlin/language_en.h b/Marlin/language_en.h index 03483d6148..5a41b37b57 100644 --- a/Marlin/language_en.h +++ b/Marlin/language_en.h @@ -471,6 +471,14 @@ #ifndef MSG_EXTRA_FAN_SPEED #define MSG_EXTRA_FAN_SPEED _UxGT("Extra fan speed") #endif + +#ifndef MSG_LASER_ON + #define MSG_LASER_ON _UxGT("Laser On") +#endif +#ifndef MSG_LASER_OFF + #define MSG_LASER_OFF _UxGT("Laser Off") +#endif + #ifndef MSG_FLOW #define MSG_FLOW _UxGT("Flow") #endif diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 45f83531ea..0ef9958f75 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -1353,6 +1353,7 @@ void lcd_quick_feedback(const bool clear_buttons) { #endif } + // First Fan Speed title in "Tune" and "Control>Temperature" menus #if FAN_COUNT > 0 && HAS_FAN0 #if FAN_COUNT > 1 @@ -1436,24 +1437,30 @@ void lcd_quick_feedback(const bool clear_buttons) { #if HAS_HEATED_BED MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_BED, &thermalManager.target_temperature_bed, 0, BED_MAXTEMP - 15, watch_temp_callback_bed); #endif - + // + // Laser ON/OFF: + // + #if ENABLED(FAN_AS_LASER) + MENU_ITEM(gcode, MSG_LASER_ON, PSTR(" M3 ")); + MENU_ITEM(gcode, MSG_LASER_OFF, PSTR(" M5 ")); + #endif // // Fan Speed: // #if FAN_COUNT > 0 - #if HAS_FAN0 + #if (HAS_FAN0 && FAN_NUM_AS_LASER!=0) MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_FAN_SPEED FAN_SPEED_1_SUFFIX, &fanSpeeds[0], 0, 255); #if ENABLED(EXTRA_FAN_SPEED) MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_EXTRA_FAN_SPEED FAN_SPEED_1_SUFFIX, &new_fanSpeeds[0], 3, 255); #endif #endif - #if HAS_FAN1 + #if (HAS_FAN1 && FAN_NUM_AS_LASER!=1) MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_FAN_SPEED " 2", &fanSpeeds[1], 0, 255); #if ENABLED(EXTRA_FAN_SPEED) MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_EXTRA_FAN_SPEED " 2", &new_fanSpeeds[1], 3, 255); #endif #endif - #if HAS_FAN2 + #if (HAS_FAN2 && FAN_NUM_AS_LASER!=2) MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_FAN_SPEED " 3", &fanSpeeds[2], 0, 255); #if ENABLED(EXTRA_FAN_SPEED) MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_EXTRA_FAN_SPEED " 3", &new_fanSpeeds[2], 3, 255); @@ -3501,24 +3508,27 @@ void lcd_quick_feedback(const bool clear_buttons) { #if HAS_HEATED_BED MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_BED, &thermalManager.target_temperature_bed, 0, BED_MAXTEMP - 15, watch_temp_callback_bed); #endif - + #if ENABLED(FAN_AS_LASER) + MENU_ITEM(gcode, MSG_LASER_ON, PSTR("M3")); + MENU_ITEM(gcode, MSG_LASER_OFF, PSTR("M5")); + #endif // // Fan Speed: // #if FAN_COUNT > 0 - #if HAS_FAN0 + #if (HAS_FAN0 && FAN_NUM_AS_LASER!=0) MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_FAN_SPEED FAN_SPEED_1_SUFFIX, &fanSpeeds[0], 0, 255); #if ENABLED(EXTRA_FAN_SPEED) MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_EXTRA_FAN_SPEED FAN_SPEED_1_SUFFIX, &new_fanSpeeds[0], 3, 255); #endif #endif - #if HAS_FAN1 + #if (HAS_FAN1 && FAN_NUM_AS_LASER!=1) MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_FAN_SPEED " 2", &fanSpeeds[1], 0, 255); #if ENABLED(EXTRA_FAN_SPEED) MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_EXTRA_FAN_SPEED " 2", &new_fanSpeeds[1], 3, 255); #endif #endif - #if HAS_FAN2 + #if (HAS_FAN2 && FAN_NUM_AS_LASER!=2) MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_FAN_SPEED " 3", &fanSpeeds[2], 0, 255); #if ENABLED(EXTRA_FAN_SPEED) MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_EXTRA_FAN_SPEED " 3", &new_fanSpeeds[2], 3, 255);