Fix LCD support, PWM initialization and start WATER COOLING support

parent 2bee6e22
...@@ -1149,7 +1149,7 @@ ...@@ -1149,7 +1149,7 @@
// http://reprap.org/wiki/RepRapDiscount_Full_Graphic_Smart_Controller // http://reprap.org/wiki/RepRapDiscount_Full_Graphic_Smart_Controller
// //
// REMEMBER TO INSTALL U8glib to your ARDUINO library folder: https://github.com/olikraus/U8glib_Arduino // REMEMBER TO INSTALL U8glib to your ARDUINO library folder: https://github.com/olikraus/U8glib_Arduino
//#define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER #define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER
// The RepRapWorld REPRAPWORLD_KEYPAD v1.1 // The RepRapWorld REPRAPWORLD_KEYPAD v1.1
// http://reprapworld.com/?products_details&products_id=202&cPath=1591_1626 // http://reprapworld.com/?products_details&products_id=202&cPath=1591_1626
......
...@@ -122,7 +122,7 @@ ...@@ -122,7 +122,7 @@
#define LASER_PERIPHERALS_STATUS_PIN 4 #define LASER_PERIPHERALS_STATUS_PIN 4
#endif // LASER_PERIPHERALS #endif // LASER_PERIPHERALS
#if ENABLED(LASER_WATER_COOLING) #if ENABLED(LASER_WATER_COOLING)
#define LASER_WATER_COOLING_PIN 1 #define LASER_WATER_COOLING_PIN 2 // Digital pins 2, 3, 5, 6, 7, 8 are attached to timers we can use
#endif // LASER WATER_COOLING #endif // LASER WATER_COOLING
#endif #endif
......
...@@ -8920,7 +8920,7 @@ void kill(const char* lcd_msg) { ...@@ -8920,7 +8920,7 @@ void kill(const char* lcd_msg) {
} }
#endif #endif
#if ENABLED(FAST_PWM_FAN) #if ENABLED(FAST_PWM_FAN) || ENABLED(LASER_WATER_COOLING)
void setPwmFrequency(uint8_t pin, int val) { void setPwmFrequency(uint8_t pin, int val) {
val &= 0x07; val &= 0x07;
......
...@@ -88,8 +88,9 @@ void refresh_cmd_timeout(); ...@@ -88,8 +88,9 @@ void refresh_cmd_timeout();
extern void delay_ms(millis_t ms); extern void delay_ms(millis_t ms);
#if ENABLED(FAST_PWM_FAN) #if ENABLED(FAST_PWM_FAN) || ENABLED(LASER_WATER_COOLING)
void setPwmFrequency(uint8_t pin, uint8_t val);
void setPwmFrequency(uint8_t pin, int val);
#endif #endif
extern float homing_feedrate[]; extern float homing_feedrate[];
......
...@@ -328,7 +328,7 @@ static void lcd_implementation_status_screen() { ...@@ -328,7 +328,7 @@ static void lcd_implementation_status_screen() {
u8g.drawBitmapP(29,4, LASERENABLE_BYTEWIDTH, LASERENABLE_HEIGHT, laserenable_bmp); u8g.drawBitmapP(29,4, LASERENABLE_BYTEWIDTH, LASERENABLE_HEIGHT, laserenable_bmp);
} }
#endif #endif
u8g.setFont(FONT_STATUSMENU); lcd_setFont(FONT_STATUSMENU);
u8g.setColorIndex(1); u8g.setColorIndex(1);
u8g.setPrintPos(3,6); u8g.setPrintPos(3,6);
if (current_block->laser_status == LASER_ON) { if (current_block->laser_status == LASER_ON) {
...@@ -400,7 +400,7 @@ static void lcd_implementation_status_screen() { ...@@ -400,7 +400,7 @@ static void lcd_implementation_status_screen() {
u8g.setPrintPos(90, 47); u8g.setPrintPos(90, 47);
if (end_time > 1380 || end_time == 0) if (end_time > 1380 || end_time == 0)
u8g.print('E--:--'); lcd_printPGM(PSTR("E--:--"));
else if (end_time > 0) { else if (end_time > 0) {
u8g.print('E'); u8g.print('E');
u8g.print(itostr2(end_time / 60)); u8g.print(itostr2(end_time / 60));
......
...@@ -52,7 +52,7 @@ char lcd_status_message[3 * LCD_WIDTH + 1] = WELCOME_MSG; // worst case is kana ...@@ -52,7 +52,7 @@ char lcd_status_message[3 * LCD_WIDTH + 1] = WELCOME_MSG; // worst case is kana
static void lcd_laser_focus_menu(); static void lcd_laser_focus_menu();
static void lcd_laser_menu(); static void lcd_laser_menu();
static void lcd_laser_test_fire_menu(); static void lcd_laser_test_fire_menu();
static void laser_test_fire(uint8_t power, uint8_t dwell); static void laser_test_fire(uint8_t power, int dwell);
static void laser_set_focus(float f_length); static void laser_set_focus(float f_length);
static void action_laser_focus_custom(); static void action_laser_focus_custom();
static void action_laser_focus_1mm(); static void action_laser_focus_1mm();
...@@ -87,12 +87,16 @@ static void lcd_status_screen(); ...@@ -87,12 +87,16 @@ static void lcd_status_screen();
static void lcd_move_menu(); static void lcd_move_menu();
static void lcd_control_menu(); static void lcd_control_menu();
static void lcd_stats_menu(); static void lcd_stats_menu();
#if DISABLED(LASER)
static void lcd_control_temperature_menu(); static void lcd_control_temperature_menu();
static void lcd_control_temperature_preheat_pla_settings_menu(); static void lcd_control_temperature_preheat_pla_settings_menu();
static void lcd_control_temperature_preheat_abs_settings_menu(); static void lcd_control_temperature_preheat_abs_settings_menu();
static void lcd_control_temperature_preheat_gum_settings_menu(); static void lcd_control_temperature_preheat_gum_settings_menu();
#endif
static void lcd_control_motion_menu(); static void lcd_control_motion_menu();
#if DISABLED(LASER)
static void lcd_control_volumetric_menu(); static void lcd_control_volumetric_menu();
#endif
#if HAS(LCD_CONTRAST) #if HAS(LCD_CONTRAST)
static void lcd_set_contrast(); static void lcd_set_contrast();
#endif #endif
...@@ -1135,11 +1139,11 @@ static void lcd_move_menu() { ...@@ -1135,11 +1139,11 @@ static void lcd_move_menu() {
static void lcd_control_menu() { static void lcd_control_menu() {
START_MENU(lcd_main_menu); START_MENU(lcd_main_menu);
MENU_ITEM(back, MSG_MAIN, lcd_main_menu); MENU_ITEM(back, MSG_MAIN, lcd_main_menu);
#if DISABLED(LASER)
MENU_ITEM(submenu, MSG_TEMPERATURE, lcd_control_temperature_menu); MENU_ITEM(submenu, MSG_TEMPERATURE, lcd_control_temperature_menu);
#if ENABLED(LASER) #endif
MENU_ITEM(submenu, MSG_TEMPERATURE, lcd_control_temperature_menu);
#else
MENU_ITEM(submenu, MSG_MOTION, lcd_control_motion_menu); MENU_ITEM(submenu, MSG_MOTION, lcd_control_motion_menu);
#if DISABLED(LASER)
MENU_ITEM(submenu, MSG_FILAMENT, lcd_control_volumetric_menu); MENU_ITEM(submenu, MSG_FILAMENT, lcd_control_volumetric_menu);
#endif #endif
...@@ -1326,6 +1330,7 @@ static void lcd_control_temperature_menu() { ...@@ -1326,6 +1330,7 @@ static void lcd_control_temperature_menu() {
MENU_ITEM_EDIT(bool, MSG_IDLEOOZING, &IDLE_OOZING_enabled); MENU_ITEM_EDIT(bool, MSG_IDLEOOZING, &IDLE_OOZING_enabled);
#endif #endif
#if DISABLED(LASER)
// //
// Preheat PLA conf // Preheat PLA conf
// //
...@@ -1340,6 +1345,7 @@ static void lcd_control_temperature_menu() { ...@@ -1340,6 +1345,7 @@ static void lcd_control_temperature_menu() {
// Preheat GUM conf // Preheat GUM conf
// //
MENU_ITEM(submenu, MSG_PREHEAT_GUM_SETTINGS, lcd_control_temperature_preheat_gum_settings_menu); MENU_ITEM(submenu, MSG_PREHEAT_GUM_SETTINGS, lcd_control_temperature_preheat_gum_settings_menu);
#endif
END_MENU(); END_MENU();
} }
#endif #endif
...@@ -1593,11 +1599,11 @@ static void lcd_laser_test_fire_menu() { ...@@ -1593,11 +1599,11 @@ static void lcd_laser_test_fire_menu() {
static void action_laser_acc_on() { static void action_laser_acc_on() {
enquecommand_P(PSTR("M80")); enqueuecommands_P(PSTR("M80"));
} }
static void action_laser_acc_off() { static void action_laser_acc_off() {
enquecommand_P(PSTR("M81")); enqueuecommands_P(PSTR("M81"));
} }
static void action_laser_test_20_50ms() { static void action_laser_test_20_50ms() {
laser_test_fire(20, 50); laser_test_fire(20, 50);
...@@ -1619,8 +1625,8 @@ static void action_laser_test_warm() { ...@@ -1619,8 +1625,8 @@ static void action_laser_test_warm() {
laser_test_fire(15, 2000); laser_test_fire(15, 2000);
} }
static void laser_test_fire(uint8_t power, uint8_t dwell) { static void laser_test_fire(uint8_t power, int dwell) {
enquecommand_P(PSTR("M80")); // Enable laser accessories since we don't know if its been done (and there's no penalty for doing it again). enqueuecommands_P(PSTR("M80")); // Enable laser accessories since we don't know if its been done (and there's no penalty for doing it again).
laser_fire(power); laser_fire(power);
delay(dwell); delay(dwell);
laser_extinguish(); laser_extinguish();
...@@ -1671,15 +1677,15 @@ static void action_laser_focus_7mm() { ...@@ -1671,15 +1677,15 @@ static void action_laser_focus_7mm() {
laser_set_focus(7); laser_set_focus(7);
} }
static void laser_set_focus(float f_length) { static void laser_set_focus(float f_length) {
if (!has_axis_homed[Z_AXIS]) { if (!TEST(axis_was_homed, Z_AXIS)) {
enquecommand_P(PSTR("G28 Z F150")); enqueuecommands_P(PSTR("G28 Z F150"));
} }
focalLength = f_length; focalLength = f_length;
float focus = LASER_FOCAL_HEIGHT - f_length; float focus = LASER_FOCAL_HEIGHT - f_length;
char cmd[20]; char cmd[20];
sprintf_P(cmd, PSTR("G0 Z%s F150"), ftostr52(focus)); sprintf_P(cmd, PSTR("G0 Z%s F150"), ftostr52(focus));
enquecommand(cmd); enqueuecommands_P(cmd);
} }
#endif // LASER #endif // LASER
......
...@@ -992,8 +992,9 @@ void tp_init() { ...@@ -992,8 +992,9 @@ void tp_init() {
#if ENABLED(LASER_WATER_COOLING) #if ENABLED(LASER_WATER_COOLING)
SET_OUTPUT(LASER_WATER_COOLING_PIN); SET_OUTPUT(LASER_WATER_COOLING_PIN);
setPwmFrequency(LASER_WATER_COOLING_PIN, 1); setPwmFrequency(LASER_WATER_COOLING_PIN, 2); // No prescaling. Pwm frequency = F_CPU/256/64
analogWrite(LASER_WATER_COOLING_PIN, 128); digitalWrite(LASER_WATER_COOLING_PIN,50);
analogWrite(LASER_WATER_COOLING_PIN, 50);
#endif #endif
#if ENABLED(HEATER_0_USES_MAX6675) #if ENABLED(HEATER_0_USES_MAX6675)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment