Fix LCD support, PWM initialization and start WATER COOLING support

parent 2bee6e22
......@@ -1149,7 +1149,7 @@
// http://reprap.org/wiki/RepRapDiscount_Full_Graphic_Smart_Controller
//
// 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
// http://reprapworld.com/?products_details&products_id=202&cPath=1591_1626
......
......@@ -122,7 +122,7 @@
#define LASER_PERIPHERALS_STATUS_PIN 4
#endif // LASER_PERIPHERALS
#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
......
......@@ -8920,7 +8920,7 @@ void kill(const char* lcd_msg) {
}
#endif
#if ENABLED(FAST_PWM_FAN)
#if ENABLED(FAST_PWM_FAN) || ENABLED(LASER_WATER_COOLING)
void setPwmFrequency(uint8_t pin, int val) {
val &= 0x07;
......
......@@ -88,8 +88,9 @@ void refresh_cmd_timeout();
extern void delay_ms(millis_t ms);
#if ENABLED(FAST_PWM_FAN)
void setPwmFrequency(uint8_t pin, uint8_t val);
#if ENABLED(FAST_PWM_FAN) || ENABLED(LASER_WATER_COOLING)
void setPwmFrequency(uint8_t pin, int val);
#endif
extern float homing_feedrate[];
......
......@@ -328,7 +328,7 @@ static void lcd_implementation_status_screen() {
u8g.drawBitmapP(29,4, LASERENABLE_BYTEWIDTH, LASERENABLE_HEIGHT, laserenable_bmp);
}
#endif
u8g.setFont(FONT_STATUSMENU);
lcd_setFont(FONT_STATUSMENU);
u8g.setColorIndex(1);
u8g.setPrintPos(3,6);
if (current_block->laser_status == LASER_ON) {
......@@ -400,7 +400,7 @@ static void lcd_implementation_status_screen() {
u8g.setPrintPos(90, 47);
if (end_time > 1380 || end_time == 0)
u8g.print('E--:--');
lcd_printPGM(PSTR("E--:--"));
else if (end_time > 0) {
u8g.print('E');
u8g.print(itostr2(end_time / 60));
......
......@@ -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_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 action_laser_focus_custom();
static void action_laser_focus_1mm();
......@@ -87,12 +87,16 @@ static void lcd_status_screen();
static void lcd_move_menu();
static void lcd_control_menu();
static void lcd_stats_menu();
#if DISABLED(LASER)
static void lcd_control_temperature_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_gum_settings_menu();
#endif
static void lcd_control_motion_menu();
#if DISABLED(LASER)
static void lcd_control_volumetric_menu();
#endif
#if HAS(LCD_CONTRAST)
static void lcd_set_contrast();
#endif
......@@ -1135,11 +1139,11 @@ static void lcd_move_menu() {
static void lcd_control_menu() {
START_MENU(lcd_main_menu);
MENU_ITEM(back, MSG_MAIN, lcd_main_menu);
#if DISABLED(LASER)
MENU_ITEM(submenu, MSG_TEMPERATURE, lcd_control_temperature_menu);
#if ENABLED(LASER)
MENU_ITEM(submenu, MSG_TEMPERATURE, lcd_control_temperature_menu);
#else
#endif
MENU_ITEM(submenu, MSG_MOTION, lcd_control_motion_menu);
#if DISABLED(LASER)
MENU_ITEM(submenu, MSG_FILAMENT, lcd_control_volumetric_menu);
#endif
......@@ -1326,6 +1330,7 @@ static void lcd_control_temperature_menu() {
MENU_ITEM_EDIT(bool, MSG_IDLEOOZING, &IDLE_OOZING_enabled);
#endif
#if DISABLED(LASER)
//
// Preheat PLA conf
//
......@@ -1340,6 +1345,7 @@ static void lcd_control_temperature_menu() {
// Preheat GUM conf
//
MENU_ITEM(submenu, MSG_PREHEAT_GUM_SETTINGS, lcd_control_temperature_preheat_gum_settings_menu);
#endif
END_MENU();
}
#endif
......@@ -1593,11 +1599,11 @@ static void lcd_laser_test_fire_menu() {
static void action_laser_acc_on() {
enquecommand_P(PSTR("M80"));
enqueuecommands_P(PSTR("M80"));
}
static void action_laser_acc_off() {
enquecommand_P(PSTR("M81"));
enqueuecommands_P(PSTR("M81"));
}
static void action_laser_test_20_50ms() {
laser_test_fire(20, 50);
......@@ -1619,8 +1625,8 @@ static void action_laser_test_warm() {
laser_test_fire(15, 2000);
}
static void laser_test_fire(uint8_t power, uint8_t 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).
static void laser_test_fire(uint8_t power, int dwell) {
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);
delay(dwell);
laser_extinguish();
......@@ -1671,15 +1677,15 @@ static void action_laser_focus_7mm() {
laser_set_focus(7);
}
static void laser_set_focus(float f_length) {
if (!has_axis_homed[Z_AXIS]) {
enquecommand_P(PSTR("G28 Z F150"));
if (!TEST(axis_was_homed, Z_AXIS)) {
enqueuecommands_P(PSTR("G28 Z F150"));
}
focalLength = f_length;
float focus = LASER_FOCAL_HEIGHT - f_length;
char cmd[20];
sprintf_P(cmd, PSTR("G0 Z%s F150"), ftostr52(focus));
enquecommand(cmd);
enqueuecommands_P(cmd);
}
#endif // LASER
......
......@@ -992,8 +992,9 @@ void tp_init() {
#if ENABLED(LASER_WATER_COOLING)
SET_OUTPUT(LASER_WATER_COOLING_PIN);
setPwmFrequency(LASER_WATER_COOLING_PIN, 1);
analogWrite(LASER_WATER_COOLING_PIN, 128);
setPwmFrequency(LASER_WATER_COOLING_PIN, 2); // No prescaling. Pwm frequency = F_CPU/256/64
digitalWrite(LASER_WATER_COOLING_PIN,50);
analogWrite(LASER_WATER_COOLING_PIN, 50);
#endif
#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