Commit 9bb65516 authored by MagoKimbra's avatar MagoKimbra

Fix

parent 4ca763b5
...@@ -103,7 +103,7 @@ ...@@ -103,7 +103,7 @@
* M300 - Play beep sound S[frequency Hz] P[duration ms] * M300 - Play beep sound S[frequency Hz] P[duration ms]
* M301 - Set PID parameters P I and D * M301 - Set PID parameters P I and D
* M302 - Allow cold extrudes * M302 - Allow cold extrudes
* M303 - PID relay autotune S<temperature> sets the target temperature (default target temperature = 150C). H<hotend> C<cycles> * M303 - PID relay autotune S<temperature> sets the target temperature (default target temperature = 150C). H<hotend> C<cycles> U<Apply result>
* M304 - Set bed PID parameters P I and D * M304 - Set bed PID parameters P I and D
* M350 - Set microstepping mode. * M350 - Set microstepping mode.
* M351 - Toggle MS1 MS2 pins directly. * M351 - Toggle MS1 MS2 pins directly.
......
...@@ -169,9 +169,10 @@ ...@@ -169,9 +169,10 @@
// Comment the following line to disable PID and enable bang-bang. // Comment the following line to disable PID and enable bang-bang.
#define PIDTEMP #define PIDTEMP
//#define PID_DEBUG // Sends debug data to the serial port. //#define PID_AUTOTUNE_MENU // Add PID Autotune to the LCD "Temperature" menu to run M303 and apply the result.
//#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX //#define PID_DEBUG // Sends debug data to the serial port.
//#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay //#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX
//#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay
// If the temperature difference between the target temperature and the actual temperature // If the temperature difference between the target temperature and the actual temperature
// is more then PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max. // is more then PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.
#define PID_FUNCTIONAL_RANGE 10 // degC #define PID_FUNCTIONAL_RANGE 10 // degC
...@@ -1092,7 +1093,7 @@ ...@@ -1092,7 +1093,7 @@
//#define INVERT_CLICK_BUTTON // Option for invert encoder button logic //#define INVERT_CLICK_BUTTON // Option for invert encoder button logic
//#define INVERT_BACK_BUTTON // Option for invert back button logic if avaible //#define INVERT_BACK_BUTTON // Option for invert back button logic if avaible
//#define INVERT_ROTARY_SWITCH // Option for invert rotary encoder //#define INVERT_ROTARY_SWITCH // Option for reverses the encoder direction for navigating LCD menus.
#define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly #define ENCODER_RATE_MULTIPLIER // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly
#define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceeds this value, multiply steps moved x10 to quickly advance the value #define ENCODER_10X_STEPS_PER_SEC 75 // If the encoder steps per sec exceeds this value, multiply steps moved x10 to quickly advance the value
#define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceeds this value, multiply steps moved x100 to really quickly advance the value #define ENCODER_100X_STEPS_PER_SEC 160 // If the encoder steps per sec exceeds this value, multiply steps moved x100 to really quickly advance the value
......
...@@ -146,7 +146,7 @@ ...@@ -146,7 +146,7 @@
* M300 - Play beep sound S<frequency Hz> P<duration ms> * M300 - Play beep sound S<frequency Hz> P<duration ms>
* M301 - Set PID parameters P I D and C * M301 - Set PID parameters P I D and C
* M302 - Allow cold extrudes, or set the minimum extrude S<temperature>. * M302 - Allow cold extrudes, or set the minimum extrude S<temperature>.
* M303 - PID relay autotune S<temperature> sets the target temperature (default target temperature = 150C). H<hotend> C<cycles> * M303 - PID relay autotune S<temperature> sets the target temperature (default target temperature = 150C). H<hotend> C<cycles> U<Apply result>
* M304 - Set bed PID parameters P I and D * M304 - Set bed PID parameters P I and D
* M350 - Set microstepping mode. * M350 - Set microstepping mode.
* M351 - Toggle MS1 MS2 pins directly. * M351 - Toggle MS1 MS2 pins directly.
......
...@@ -5424,15 +5424,9 @@ inline void gcode_M109() { ...@@ -5424,15 +5424,9 @@ inline void gcode_M109() {
inline void gcode_M111() { inline void gcode_M111() {
mk_debug_flags = code_seen('S') ? code_value_short() : DEBUG_NONE; mk_debug_flags = code_seen('S') ? code_value_short() : DEBUG_NONE;
const static char str_debug_1[] PROGMEM = SERIAL_DEBUG_ECHO; const static char* const debug_strings[] {
const static char str_debug_2[] PROGMEM = SERIAL_DEBUG_INFO; SERIAL_DEBUG_ECHO, SERIAL_DEBUG_INFO, SERIAL_DEBUG_ERRORS,
const static char str_debug_4[] PROGMEM = SERIAL_DEBUG_ERRORS; SERIAL_DEBUG_DRYRUN, SERIAL_DEBUG_COMMUNICATION, SERIAL_DEBUG_DEBUG
const static char str_debug_8[] PROGMEM = SERIAL_DEBUG_DRYRUN;
const static char str_debug_16[] PROGMEM = SERIAL_DEBUG_COMMUNICATION;
const static char str_debug_32[] PROGMEM = SERIAL_DEBUG_DEBUG;
const static char* const debug_strings[] PROGMEM = {
str_debug_1, str_debug_2, str_debug_4, str_debug_8, str_debug_16, str_debug_32
}; };
ECHO_M(SERIAL_DEBUG_PREFIX); ECHO_M(SERIAL_DEBUG_PREFIX);
...@@ -5490,11 +5484,11 @@ inline void gcode_M114() { ...@@ -5490,11 +5484,11 @@ inline void gcode_M114() {
CRITICAL_SECTION_END; CRITICAL_SECTION_END;
#if MECH(COREXY) || MECH(COREYX) || MECH(COREXZ) || MECH(COREZX) #if MECH(COREXY) || MECH(COREYX) || MECH(COREXZ) || MECH(COREZX)
ECHO_M(MSG_COUNT_A); ECHO_M(SERIAL_COUNT_A);
#elif MECH(DELTA) #elif MECH(DELTA)
ECHO_M(MSG_COUNT_ALPHA); ECHO_M(SERIAL_COUNT_ALPHA);
#else #else
ECHO_M(MSG_COUNT_X); ECHO_M(SERIAL_COUNT_X);
#endif #endif
ECHO_V(xpos); ECHO_V(xpos);
...@@ -6255,22 +6249,26 @@ inline void gcode_M226() { ...@@ -6255,22 +6249,26 @@ inline void gcode_M226() {
} }
#endif // PREVENT_DANGEROUS_EXTRUDE #endif // PREVENT_DANGEROUS_EXTRUDE
#if ENABLED(PIDTEMP) || ENABLED(PIDTEMPBED) #if HAS(PID_HEATING)
/** /**
* M303: PID relay autotune * M303: PID relay autotune
* S<temperature> sets the target temperature. (default target temperature = 150C) * S<temperature> sets the target temperature. (default target temperature = 150C)
* H<hotend> (-1 for the bed) * H<hotend> (-1 for the bed) (default 0)
* C<cycles> * C<cycles>
* U<bool> with a non-zero value will apply the result to current settings
*/ */
inline void gcode_M303() { inline void gcode_M303() {
int h = code_seen('H') ? code_value_short() : 0; int h = code_seen('H') ? code_value_short() : 0;
int c = code_seen('C') ? code_value_short() : 5; int c = code_seen('C') ? code_value_short() : 5;
bool u = code_seen('U') && code_value_short() != 0;
float temp = code_seen('S') ? code_value() : (h < 0 ? 70.0 : 150.0); float temp = code_seen('S') ? code_value() : (h < 0 ? 70.0 : 150.0);
if (h >= 0 && h < HOTENDS) target_extruder = h; if (h >= 0 && h < HOTENDS) target_extruder = h;
KEEPALIVE_STATE(NOT_BUSY); // don't send "busy: processing" messages during autotune output KEEPALIVE_STATE(NOT_BUSY); // don't send "busy: processing" messages during autotune output
PID_autotune(temp, h, c); PID_autotune(temp, h, c, u);
KEEPALIVE_STATE(IN_HANDLER); KEEPALIVE_STATE(IN_HANDLER);
} }
...@@ -8002,7 +8000,7 @@ void process_next_command() { ...@@ -8002,7 +8000,7 @@ void process_next_command() {
gcode_M302(); break; gcode_M302(); break;
#endif // PREVENT_DANGEROUS_EXTRUDE #endif // PREVENT_DANGEROUS_EXTRUDE
#if ENABLED(PIDTEMP) || ENABLED(PIDTEMPBED) #if HAS(PID_HEATING)
case 303: // M303 PID autotune case 303: // M303 PID autotune
gcode_M303(); break; gcode_M303(); break;
#endif #endif
......
...@@ -593,6 +593,12 @@ ...@@ -593,6 +593,12 @@
#define HEATER_USES_AD595 (ENABLED(HEATER_0_USES_AD595) || ENABLED(HEATER_1_USES_AD595) || ENABLED(HEATER_2_USES_AD595) || ENABLED(HEATER_3_USES_AD595)) #define HEATER_USES_AD595 (ENABLED(HEATER_0_USES_AD595) || ENABLED(HEATER_1_USES_AD595) || ENABLED(HEATER_2_USES_AD595) || ENABLED(HEATER_3_USES_AD595))
/**
* Flags for PID handling
*/
#define HAS_PID_HEATING (ENABLED(PIDTEMP) || ENABLED(PIDTEMPBED))
#define HAS_PID_FOR_BOTH (ENABLED(PIDTEMP) && ENABLED(PIDTEMPBED))
/** /**
* ARRAY_BY_EXTRUDERS based on EXTRUDERS * ARRAY_BY_EXTRUDERS based on EXTRUDERS
*/ */
......
...@@ -130,9 +130,9 @@ ...@@ -130,9 +130,9 @@
#define SERIAL_ACTIVE_DRIVER "Active Driver: " #define SERIAL_ACTIVE_DRIVER "Active Driver: "
#define SERIAL_ACTIVE_EXTRUDER "Active Extruder: " #define SERIAL_ACTIVE_EXTRUDER "Active Extruder: "
#define SERIAL_ACTIVE_COLOR "Active Color: " #define SERIAL_ACTIVE_COLOR "Active Color: "
#define MSG_COUNT_X " Count X:" #define SERIAL_COUNT_X " Count X:"
#define MSG_COUNT_A " Count A:" #define SERIAL_COUNT_A " Count A:"
#define MSG_COUNT_ALPHA " Count Alpha:" #define SERIAL_COUNT_ALPHA " Count Alpha:"
#define SERIAL_X_MIN "x_min: " #define SERIAL_X_MIN "x_min: "
#define SERIAL_X_MAX "x_max: " #define SERIAL_X_MAX "x_max: "
#define SERIAL_Y_MIN "y_min: " #define SERIAL_Y_MIN "y_min: "
...@@ -180,6 +180,7 @@ ...@@ -180,6 +180,7 @@
#define SERIAL_ENDSTOPS_HIT "endstops hit: " #define SERIAL_ENDSTOPS_HIT "endstops hit: "
#define SERIAL_ERR_COLD_EXTRUDE_STOP "cold extrusion prevented" #define SERIAL_ERR_COLD_EXTRUDE_STOP "cold extrusion prevented"
#define SERIAL_ERR_LONG_EXTRUDE_STOP "too long extrusion prevented" #define SERIAL_ERR_LONG_EXTRUDE_STOP "too long extrusion prevented"
#define SERIAL_MICROSTEP_MS1_MS2 "MS1,MS2 Pins" #define SERIAL_MICROSTEP_MS1_MS2 "MS1,MS2 Pins"
#define SERIAL_MICROSTEP_X "X:" #define SERIAL_MICROSTEP_X "X:"
#define SERIAL_MICROSTEP_Y "Y:" #define SERIAL_MICROSTEP_Y "Y:"
......
...@@ -12,17 +12,20 @@ ...@@ -12,17 +12,20 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
// BitMap for splashscreen /**
// Generated with: http://www.digole.com/tools/PicturetoC_Hex_converter.php * BitMap for splashscreen
// Please note that using the high-res version takes 402Bytes of PROGMEM. * Generated with: http://www.digole.com/tools/PicturetoC_Hex_converter.php
* Please note that using the high-res version takes 402Bytes of PROGMEM.
*/
#define START_BMPHIGH #define START_BMPHIGH
#if ENABLED(SHOW_BOOTSCREEN) #if ENABLED(SHOW_BOOTSCREEN)
......
/* /**
* MK & MK4due 3D Printer Firmware
*
* Based on Marlin, Sprinter and grbl
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
* Copyright (C) 2013 - 2016 Alberto Cotronei @MagoKimbra
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
Fontname: -Misc-Fixed-Medium-R-Normal--9-90-75-75-C-60-ISO10646-1 Fontname: -Misc-Fixed-Medium-R-Normal--9-90-75-75-C-60-ISO10646-1
Copyright: Public domain font. Share and enjoy. Copyright: Public domain font. Share and enjoy.
Capital A Height: 6, '1' Height: 6 Capital A Height: 6, '1' Height: 6
......
/* /**
* MK & MK4due 3D Printer Firmware
*
* Based on Marlin, Sprinter and grbl
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
* Copyright (C) 2013 - 2016 Alberto Cotronei @MagoKimbra
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
Fontname: HD44780_C v1.2 Fontname: HD44780_C v1.2
Copyright: A. Hardtung, public domain Copyright: A. Hardtung, public domain
Capital A Height: 7, '1' Height: 7 Capital A Height: 7, '1' Height: 7
......
/* /**
* MK & MK4due 3D Printer Firmware
*
* Based on Marlin, Sprinter and grbl
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
* Copyright (C) 2013 - 2016 Alberto Cotronei @MagoKimbra
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
Fontname: HD44780_J Fontname: HD44780_J
Copyright: A. Hardtung, public domain Copyright: A. Hardtung, public domain
Capital A Height: 7, '1' Height: 7 Capital A Height: 7, '1' Height: 7
Calculated Max Values w= 6 h=10 x= 2 y= 8 dx= 6 dy= 0 ascent= 8 len= 8 Calculated Max Values w= 6 h=10 x= 2 y= 5 dx= 6 dy= 0 ascent= 8 len= 8
Font Bounding box w= 6 h= 9 x= 0 y=-2 Font Bounding box w= 6 h= 9 x= 0 y=-2
Calculated Min Values x= 0 y=-2 dx= 0 dy= 0 Calculated Min Values x= 0 y=-2 dx= 0 dy= 0
Pure Font ascent = 7 descent=-1 Pure Font ascent = 7 descent=-1
...@@ -10,9 +32,9 @@ ...@@ -10,9 +32,9 @@
Max Font ascent = 8 descent=-2 Max Font ascent = 8 descent=-2
*/ */
#include <U8glib.h> #include <U8glib.h>
const u8g_fntpgm_uint8_t HD44780_J_5x7[2491] U8G_SECTION(".progmem.HD44780_J_5x7") = { const u8g_fntpgm_uint8_t HD44780_J_5x7[2492] U8G_SECTION(".progmem.HD44780_J_5x7") = {
0, 6, 9, 0, 254, 7, 1, 145, 3, 34, 32, 255, 255, 8, 254, 7, 0, 6, 9, 0, 254, 7, 1, 145, 3, 34, 32, 255, 255, 8, 254, 7,
255, 0, 0, 0, 6, 0, 8, 1, 7, 7, 6, 2, 0, 128, 128, 128, 255, 0, 0, 0, 6, 0, 0, 1, 7, 7, 6, 2, 0, 128, 128, 128,
128, 128, 0, 128, 3, 2, 2, 6, 1, 5, 160, 160, 5, 7, 7, 6, 128, 128, 0, 128, 3, 2, 2, 6, 1, 5, 160, 160, 5, 7, 7, 6,
0, 0, 80, 80, 248, 80, 248, 80, 80, 5, 7, 7, 6, 0, 0, 32, 0, 0, 80, 80, 248, 80, 248, 80, 80, 5, 7, 7, 6, 0, 0, 32,
120, 160, 112, 40, 240, 32, 5, 7, 7, 6, 0, 0, 192, 200, 16, 32, 120, 160, 112, 40, 240, 32, 5, 7, 7, 6, 0, 0, 192, 200, 16, 32,
...@@ -84,19 +106,19 @@ const u8g_fntpgm_uint8_t HD44780_J_5x7[2491] U8G_SECTION(".progmem.HD44780_J_5x7 ...@@ -84,19 +106,19 @@ const u8g_fntpgm_uint8_t HD44780_J_5x7[2491] U8G_SECTION(".progmem.HD44780_J_5x7
128, 64, 64, 32, 1, 7, 7, 6, 2, 0, 128, 128, 128, 128, 128, 128, 128, 64, 64, 32, 1, 7, 7, 6, 2, 0, 128, 128, 128, 128, 128, 128,
128, 3, 7, 7, 6, 1, 0, 128, 64, 64, 32, 64, 64, 128, 5, 5, 128, 3, 7, 7, 6, 1, 0, 128, 64, 64, 32, 64, 64, 128, 5, 5,
5, 6, 0, 1, 32, 16, 248, 16, 32, 5, 5, 5, 6, 0, 1, 32, 5, 6, 0, 1, 32, 16, 248, 16, 32, 5, 5, 5, 6, 0, 1, 32,
64, 248, 64, 32, 0, 0, 0, 6, 0, 8, 0, 0, 0, 6, 0, 8, 64, 248, 64, 32, 0, 0, 0, 6, 0, 0, 0, 0, 0, 6, 0, 0,
0, 0, 0, 6, 0, 8, 0, 0, 0, 6, 0, 8, 0, 0, 0, 6, 0, 0, 0, 6, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 6,
0, 8, 0, 0, 0, 6, 0, 8, 0, 0, 0, 6, 0, 8, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0,
0, 6, 0, 8, 0, 0, 0, 6, 0, 8, 0, 0, 0, 6, 0, 8, 0, 6, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 6, 0, 0,
0, 0, 0, 6, 0, 8, 0, 0, 0, 6, 0, 8, 0, 0, 0, 6, 0, 0, 0, 6, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 6,
0, 8, 0, 0, 0, 6, 0, 8, 0, 0, 0, 6, 0, 8, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0,
0, 6, 0, 8, 0, 0, 0, 6, 0, 8, 0, 0, 0, 6, 0, 8, 0, 6, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 6, 0, 0,
0, 0, 0, 6, 0, 8, 0, 0, 0, 6, 0, 8, 0, 0, 0, 6, 0, 0, 0, 6, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 6,
0, 8, 0, 0, 0, 6, 0, 8, 0, 0, 0, 6, 0, 8, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0,
0, 6, 0, 8, 0, 0, 0, 6, 0, 8, 0, 0, 0, 6, 0, 8, 0, 6, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 6, 0, 0,
0, 0, 0, 6, 0, 8, 0, 0, 0, 6, 0, 8, 0, 0, 0, 6, 0, 0, 0, 6, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 6,
0, 8, 0, 0, 0, 6, 0, 8, 0, 0, 0, 6, 0, 8, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0,
0, 6, 0, 8, 0, 0, 0, 6, 0, 8, 3, 3, 3, 6, 0, 0, 0, 6, 0, 0, 0, 0, 0, 6, 0, 0, 3, 3, 3, 6, 0, 0,
224, 160, 224, 3, 4, 4, 6, 2, 3, 224, 128, 128, 128, 3, 4, 4, 224, 160, 224, 3, 4, 4, 6, 2, 3, 224, 128, 128, 128, 3, 4, 4,
6, 0, 0, 32, 32, 32, 224, 3, 3, 3, 6, 0, 0, 128, 64, 32, 6, 0, 0, 32, 32, 32, 224, 3, 3, 3, 6, 0, 0, 128, 64, 32,
2, 2, 2, 6, 1, 2, 192, 192, 5, 6, 6, 6, 0, 0, 248, 8, 2, 2, 2, 6, 1, 2, 192, 192, 5, 6, 6, 6, 0, 0, 248, 8,
...@@ -106,7 +128,7 @@ const u8g_fntpgm_uint8_t HD44780_J_5x7[2491] U8G_SECTION(".progmem.HD44780_J_5x7 ...@@ -106,7 +128,7 @@ const u8g_fntpgm_uint8_t HD44780_J_5x7[2491] U8G_SECTION(".progmem.HD44780_J_5x7
5, 5, 6, 0, 0, 16, 248, 48, 80, 144, 5, 5, 5, 6, 0, 0, 5, 5, 6, 0, 0, 16, 248, 48, 80, 144, 5, 5, 5, 6, 0, 0,
64, 248, 72, 80, 64, 5, 4, 4, 6, 0, 0, 112, 16, 16, 248, 4, 64, 248, 72, 80, 64, 5, 4, 4, 6, 0, 0, 112, 16, 16, 248, 4,
5, 5, 6, 0, 0, 240, 16, 240, 16, 240, 5, 4, 4, 6, 0, 0, 5, 5, 6, 0, 0, 240, 16, 240, 16, 240, 5, 4, 4, 6, 0, 0,
168, 168, 8, 48, 5, 1, 1, 6, 0, 4, 248, 5, 7, 7, 6, 0, 168, 168, 8, 48, 5, 1, 1, 6, 0, 3, 248, 5, 7, 7, 6, 0,
0, 248, 8, 40, 48, 32, 32, 64, 5, 7, 7, 6, 0, 0, 8, 16, 0, 248, 8, 40, 48, 32, 32, 64, 5, 7, 7, 6, 0, 0, 8, 16,
32, 96, 160, 32, 32, 5, 7, 7, 6, 0, 0, 32, 248, 136, 136, 8, 32, 96, 160, 32, 32, 5, 7, 7, 6, 0, 0, 32, 248, 136, 136, 8,
16, 32, 5, 6, 6, 6, 0, 0, 248, 32, 32, 32, 32, 248, 5, 7, 16, 32, 5, 6, 6, 6, 0, 0, 248, 32, 32, 32, 32, 248, 5, 7,
...@@ -124,47 +146,47 @@ const u8g_fntpgm_uint8_t HD44780_J_5x7[2491] U8G_SECTION(".progmem.HD44780_J_5x7 ...@@ -124,47 +146,47 @@ const u8g_fntpgm_uint8_t HD44780_J_5x7[2491] U8G_SECTION(".progmem.HD44780_J_5x7
6, 0, 0, 112, 0, 248, 32, 32, 32, 64, 3, 7, 7, 6, 1, 0, 6, 0, 0, 112, 0, 248, 32, 32, 32, 64, 3, 7, 7, 6, 1, 0,
128, 128, 128, 192, 160, 128, 128, 5, 7, 7, 6, 0, 0, 32, 32, 248, 128, 128, 128, 192, 160, 128, 128, 5, 7, 7, 6, 0, 0, 32, 32, 248,
32, 32, 64, 128, 5, 6, 6, 6, 0, 0, 112, 0, 0, 0, 0, 248, 32, 32, 64, 128, 5, 6, 6, 6, 0, 0, 112, 0, 0, 0, 0, 248,
5, 6, 6, 6, 0, 0, 248, 8, 80, 32, 80, 128, 5, 6, 6, 6, 5, 6, 6, 6, 0, 0, 248, 8, 80, 32, 80, 128, 5, 7, 7, 6,
0, 1, 32, 248, 16, 32, 112, 168, 3, 7, 7, 6, 1, 0, 32, 32, 0, 0, 32, 248, 16, 32, 112, 168, 32, 3, 7, 7, 6, 1, 0, 32,
32, 32, 32, 64, 128, 5, 6, 6, 6, 0, 0, 32, 16, 136, 136, 136, 32, 32, 32, 32, 64, 128, 5, 6, 6, 6, 0, 0, 32, 16, 136, 136,
136, 5, 7, 7, 6, 0, 0, 128, 128, 248, 128, 128, 128, 120, 5, 6, 136, 136, 5, 7, 7, 6, 0, 0, 128, 128, 248, 128, 128, 128, 120, 5,
6, 6, 0, 0, 248, 8, 8, 8, 16, 96, 5, 5, 5, 6, 0, 1, 6, 6, 6, 0, 0, 248, 8, 8, 8, 16, 96, 5, 5, 5, 6, 0,
64, 160, 16, 8, 8, 5, 7, 7, 6, 0, 0, 32, 248, 32, 32, 168, 1, 64, 160, 16, 8, 8, 5, 7, 7, 6, 0, 0, 32, 248, 32, 32,
168, 32, 5, 6, 6, 6, 0, 0, 248, 8, 8, 80, 32, 16, 4, 6, 168, 168, 32, 5, 6, 6, 6, 0, 0, 248, 8, 8, 80, 32, 16, 4,
6, 6, 1, 0, 224, 0, 224, 0, 224, 16, 5, 6, 6, 6, 0, 0, 6, 6, 6, 1, 0, 224, 0, 224, 0, 224, 16, 5, 6, 6, 6, 0,
32, 64, 128, 136, 248, 8, 5, 6, 6, 6, 0, 0, 8, 8, 80, 32, 0, 32, 64, 128, 136, 248, 8, 5, 6, 6, 6, 0, 0, 8, 8, 80,
80, 128, 5, 6, 6, 6, 0, 0, 248, 64, 248, 64, 64, 56, 5, 7, 32, 80, 128, 5, 6, 6, 6, 0, 0, 248, 64, 248, 64, 64, 56, 5,
7, 6, 0, 0, 64, 64, 248, 72, 80, 64, 64, 5, 7, 7, 6, 0, 7, 7, 6, 0, 0, 64, 64, 248, 72, 80, 64, 64, 5, 7, 7, 6,
0, 112, 16, 16, 16, 16, 16, 248, 5, 6, 6, 6, 0, 0, 248, 8, 0, 0, 112, 16, 16, 16, 16, 16, 248, 5, 6, 6, 6, 0, 0, 248,
248, 8, 8, 248, 5, 7, 7, 6, 0, 0, 112, 0, 248, 8, 8, 16, 8, 248, 8, 8, 248, 5, 7, 7, 6, 0, 0, 112, 0, 248, 8, 8,
32, 4, 7, 7, 6, 0, 0, 144, 144, 144, 144, 16, 32, 64, 5, 6, 16, 32, 4, 7, 7, 6, 0, 0, 144, 144, 144, 144, 16, 32, 64, 5,
6, 6, 0, 0, 32, 160, 160, 168, 168, 176, 5, 7, 7, 6, 0, 0, 6, 6, 6, 0, 0, 32, 160, 160, 168, 168, 176, 5, 7, 7, 6, 0,
128, 128, 128, 136, 144, 160, 192, 5, 6, 6, 6, 0, 0, 248, 136, 136, 0, 128, 128, 128, 136, 144, 160, 192, 5, 6, 6, 6, 0, 0, 248, 136,
136, 136, 248, 5, 6, 6, 6, 0, 0, 248, 136, 136, 8, 16, 32, 5, 136, 136, 136, 248, 5, 6, 6, 6, 0, 0, 248, 136, 136, 8, 16, 32,
6, 6, 6, 0, 0, 192, 0, 8, 8, 16, 224, 4, 3, 3, 6, 0, 5, 6, 6, 6, 0, 0, 192, 0, 8, 8, 16, 224, 4, 3, 3, 6,
4, 32, 144, 64, 3, 3, 3, 6, 0, 4, 224, 160, 224, 5, 5, 5, 0, 4, 32, 144, 64, 3, 3, 3, 6, 0, 4, 224, 160, 224, 5, 5,
6, 0, 1, 72, 168, 144, 144, 104, 5, 7, 7, 6, 0, 0, 80, 0, 5, 6, 0, 1, 72, 168, 144, 144, 104, 5, 7, 7, 6, 0, 0, 80,
112, 8, 120, 136, 120, 4, 8, 8, 6, 1, 255, 96, 144, 144, 224, 144, 0, 112, 8, 120, 136, 120, 4, 8, 8, 6, 1, 255, 96, 144, 144, 224,
144, 224, 128, 5, 5, 5, 6, 0, 0, 112, 128, 96, 136, 112, 5, 6, 144, 144, 224, 128, 5, 5, 5, 6, 0, 0, 112, 128, 96, 136, 112, 5,
6, 6, 0, 255, 136, 136, 152, 232, 136, 128, 5, 5, 5, 6, 0, 0, 6, 6, 6, 0, 255, 136, 136, 152, 232, 136, 128, 5, 5, 5, 6, 0,
120, 160, 144, 136, 112, 5, 7, 7, 6, 0, 254, 48, 72, 136, 136, 240, 0, 120, 160, 144, 136, 112, 5, 7, 7, 6, 0, 254, 48, 72, 136, 136,
128, 128, 5, 8, 8, 6, 0, 254, 120, 136, 136, 136, 120, 8, 8, 112, 240, 128, 128, 5, 8, 8, 6, 0, 254, 120, 136, 136, 136, 120, 8, 8,
5, 5, 5, 6, 0, 1, 56, 32, 32, 160, 64, 4, 3, 3, 6, 0, 112, 5, 5, 5, 6, 0, 1, 56, 32, 32, 160, 64, 4, 3, 3, 6,
3, 16, 208, 16, 4, 8, 8, 6, 0, 255, 16, 0, 48, 16, 16, 16, 0, 3, 16, 208, 16, 4, 8, 8, 6, 0, 255, 16, 0, 48, 16, 16,
144, 96, 3, 3, 3, 6, 0, 4, 160, 64, 160, 5, 7, 7, 6, 0, 16, 144, 96, 3, 3, 3, 6, 0, 4, 160, 64, 160, 5, 7, 7, 6,
0, 32, 112, 160, 160, 168, 112, 32, 5, 7, 7, 6, 0, 0, 64, 64, 0, 0, 32, 112, 160, 160, 168, 112, 32, 5, 7, 7, 6, 0, 0, 64,
224, 64, 224, 64, 120, 5, 7, 7, 6, 0, 0, 112, 0, 176, 200, 136, 64, 224, 64, 224, 64, 120, 5, 7, 7, 6, 0, 0, 112, 0, 176, 200,
136, 136, 5, 7, 7, 6, 0, 0, 80, 0, 112, 136, 136, 136, 112, 5, 136, 136, 136, 5, 7, 7, 6, 0, 0, 80, 0, 112, 136, 136, 136, 112,
7, 7, 6, 0, 255, 176, 200, 136, 136, 240, 128, 128, 5, 7, 7, 6, 5, 7, 7, 6, 0, 255, 176, 200, 136, 136, 240, 128, 128, 5, 7, 7,
0, 255, 104, 152, 136, 136, 120, 8, 8, 5, 6, 6, 6, 0, 0, 112, 6, 0, 255, 104, 152, 136, 136, 120, 8, 8, 5, 6, 6, 6, 0, 0,
136, 248, 136, 136, 112, 5, 3, 3, 6, 0, 2, 88, 168, 208, 5, 5, 112, 136, 248, 136, 136, 112, 5, 3, 3, 6, 0, 2, 88, 168, 208, 5,
5, 6, 0, 0, 112, 136, 136, 80, 216, 5, 7, 7, 6, 0, 0, 80, 5, 5, 6, 0, 0, 112, 136, 136, 80, 216, 5, 7, 7, 6, 0, 0,
0, 136, 136, 136, 152, 104, 5, 7, 7, 6, 0, 0, 248, 128, 64, 32, 80, 0, 136, 136, 136, 152, 104, 5, 7, 7, 6, 0, 0, 248, 128, 64,
64, 128, 248, 5, 5, 5, 6, 0, 0, 248, 80, 80, 80, 152, 5, 7, 32, 64, 128, 248, 5, 5, 5, 6, 0, 0, 248, 80, 80, 80, 152, 5,
7, 6, 0, 0, 248, 0, 136, 80, 32, 80, 136, 5, 7, 7, 6, 0, 7, 7, 6, 0, 0, 248, 0, 136, 80, 32, 80, 136, 5, 7, 7, 6,
255, 136, 136, 136, 136, 120, 8, 112, 5, 6, 6, 6, 0, 1, 8, 240, 0, 255, 136, 136, 136, 136, 120, 8, 112, 5, 6, 6, 6, 0, 0, 8,
32, 248, 32, 32, 5, 5, 5, 6, 0, 0, 248, 64, 120, 72, 136, 5, 240, 32, 248, 32, 32, 5, 5, 5, 6, 0, 0, 248, 64, 120, 72, 136,
5, 5, 6, 0, 0, 248, 168, 248, 136, 136, 5, 5, 5, 6, 0, 1, 5, 5, 5, 6, 0, 0, 248, 168, 248, 136, 136, 5, 5, 5, 6, 0,
32, 0, 248, 0, 32, 0, 0, 0, 6, 0, 8, 6, 10, 10, 6, 0, 1, 32, 0, 248, 0, 32, 0, 0, 0, 6, 0, 0, 6, 10, 10, 6,
254, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252 0, 254, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252
}; };
/* /**
* MK & MK4due 3D Printer Firmware
*
* Based on Marlin, Sprinter and grbl
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
* Copyright (C) 2013 - 2016 Alberto Cotronei @MagoKimbra
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
Fontname: HD44780_W Fontname: HD44780_W
Copyright: A.Hardtung, public domain Copyright: A.Hardtung, public domain
Capital A Height: 7, '1' Height: 7 Capital A Height: 7, '1' Height: 7
......
/* /**
* MK & MK4due 3D Printer Firmware
*
* Based on Marlin, Sprinter and grbl
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
* Copyright (C) 2013 - 2016 Alberto Cotronei @MagoKimbra
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
Fontname: ISO10646-1 Fontname: ISO10646-1
Copyright: A.Hardtung, public domain Copyright: A.Hardtung, public domain
Capital A Height: 7, '1' Height: 7 Capital A Height: 7, '1' Height: 7
......
/* /**
* MK & MK4due 3D Printer Firmware
*
* Based on Marlin, Sprinter and grbl
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
* Copyright (C) 2013 - 2016 Alberto Cotronei @MagoKimbra
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
Fontname: ISO10646_5_Cyrillic Fontname: ISO10646_5_Cyrillic
Copyright: A. Hardtung, public domain Copyright: A. Hardtung, public domain
Capital A Height: 7, '1' Height: 7 Capital A Height: 7, '1' Height: 7
......
/* /**
* MK & MK4due 3D Printer Firmware
*
* Based on Marlin, Sprinter and grbl
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
* Copyright (C) 2013 - 2016 Alberto Cotronei @MagoKimbra
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
Fontname: Marlin_symbols Fontname: Marlin_symbols
Copyright: Created with Fony 1.4.7 Copyright: Created with Fony 1.4.7
Capital A Height: 0, '1' Height: 0 Capital A Height: 0, '1' Height: 0
......
...@@ -290,8 +290,13 @@ FORCE_INLINE void _draw_centered_temp(int temp, int x, int y) { ...@@ -290,8 +290,13 @@ FORCE_INLINE void _draw_centered_temp(int temp, int x, int y) {
lcd_printPGM(PSTR(LCD_STR_DEGREE " ")); lcd_printPGM(PSTR(LCD_STR_DEGREE " "));
} }
static void _draw_heater_status(int x, int heater) { FORCE_INLINE void _draw_heater_status(int x, int heater) {
bool isBed = heater < 0; #if HAS(TEMP_BED)
bool isBed = heater < 0;
#else
const bool isBed = false;
#endif
int y = 17 + (isBed ? 1 : 0); int y = 17 + (isBed ? 1 : 0);
lcd_setFont(FONT_STATUSMENU); lcd_setFont(FONT_STATUSMENU);
...@@ -650,7 +655,7 @@ void lcd_implementation_drawedit(const char* pstr, char* value) { ...@@ -650,7 +655,7 @@ void lcd_implementation_drawedit(const char* pstr, char* value) {
#endif //SDSUPPORT #endif //SDSUPPORT
#define lcd_implementation_drawmenu_back(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, LCD_STR_UPLEVEL[0], LCD_STR_UPLEVEL[0]) #define lcd_implementation_drawmenu_back(sel, row, pstr) lcd_implementation_drawmenu_generic(sel, row, pstr, LCD_STR_UPLEVEL[0], LCD_STR_UPLEVEL[0])
#define lcd_implementation_drawmenu_submenu(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', LCD_STR_ARROW_RIGHT[0]) #define lcd_implementation_drawmenu_submenu(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', LCD_STR_ARROW_RIGHT[0])
#define lcd_implementation_drawmenu_gcode(sel, row, pstr, gcode) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', ' ') #define lcd_implementation_drawmenu_gcode(sel, row, pstr, gcode) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', ' ')
#define lcd_implementation_drawmenu_function(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', ' ') #define lcd_implementation_drawmenu_function(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', ' ')
......
This diff is collapsed.
...@@ -28,7 +28,10 @@ ...@@ -28,7 +28,10 @@
#include "buzzer.h" #include "buzzer.h"
#endif #endif
int lcd_strlen(char* s); #define BUTTON_EXISTS(BN) (defined(BTN_## BN) && BTN_## BN >= 0)
#define BUTTON_PRESSED(BN) !READ(BTN_## BN)
int lcd_strlen(const char* s);
int lcd_strlen_P(const char* s); int lcd_strlen_P(const char* s);
void lcd_update(); void lcd_update();
void lcd_init(); void lcd_init();
...@@ -64,10 +67,7 @@ ...@@ -64,10 +67,7 @@
#if ENABLED(ULTIPANEL) #if ENABLED(ULTIPANEL)
void lcd_buttons_update(); void lcd_buttons_update();
extern volatile uint8_t buttons; //the last checked buttons in a bit array. extern volatile uint8_t buttons; // the last checked buttons in a bit array.
#if ENABLED(REPRAPWORLD_KEYPAD)
extern volatile uint8_t buttons_reprapworld_keypad; // to store the keypad shift register values
#endif
#else #else
FORCE_INLINE void lcd_buttons_update() {} FORCE_INLINE void lcd_buttons_update() {}
#endif #endif
...@@ -89,18 +89,54 @@ ...@@ -89,18 +89,54 @@
#endif #endif
void lcd_quick_feedback(); // Audible feedback for a button click - could also be visual void lcd_quick_feedback(); // Audible feedback for a button click - could also be visual
bool lcd_clicked(); bool lcd_clicked();
void lcd_ignore_click(bool b = true);
void lcd_ignore_click(bool b=true); bool lcd_blink();
#if ENABLED(ULTIPANEL) && ENABLED(REPRAPWORLD_KEYPAD)
#define REPRAPWORLD_BTN_OFFSET 0 // bit offset into buttons for shift register values
#define BLEN_REPRAPWORLD_KEYPAD_F3 0
#define BLEN_REPRAPWORLD_KEYPAD_F2 1
#define BLEN_REPRAPWORLD_KEYPAD_F1 2
#define BLEN_REPRAPWORLD_KEYPAD_DOWN 3
#define BLEN_REPRAPWORLD_KEYPAD_RIGHT 4
#define BLEN_REPRAPWORLD_KEYPAD_MIDDLE 5
#define BLEN_REPRAPWORLD_KEYPAD_UP 6
#define BLEN_REPRAPWORLD_KEYPAD_LEFT 7
#define EN_REPRAPWORLD_KEYPAD_F3 (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_F3))
#define EN_REPRAPWORLD_KEYPAD_F2 (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_F2))
#define EN_REPRAPWORLD_KEYPAD_F1 (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_F1))
#define EN_REPRAPWORLD_KEYPAD_DOWN (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_DOWN))
#define EN_REPRAPWORLD_KEYPAD_RIGHT (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_RIGHT))
#define EN_REPRAPWORLD_KEYPAD_MIDDLE (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_MIDDLE))
#define EN_REPRAPWORLD_KEYPAD_UP (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_UP))
#define EN_REPRAPWORLD_KEYPAD_LEFT (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_LEFT))
#define REPRAPWORLD_KEYPAD_MOVE_Z_DOWN (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_F3)
#define REPRAPWORLD_KEYPAD_MOVE_Z_UP (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_F2)
#define REPRAPWORLD_KEYPAD_MOVE_Y_DOWN (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_DOWN)
#define REPRAPWORLD_KEYPAD_MOVE_X_RIGHT (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_RIGHT)
#define REPRAPWORLD_KEYPAD_MOVE_HOME (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_MIDDLE)
#define REPRAPWORLD_KEYPAD_MOVE_Y_UP (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_UP)
#define REPRAPWORLD_KEYPAD_MOVE_X_LEFT (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_LEFT)
#endif // ULTIPANEL && REPRAPWORLD_KEYPAD
#if ENABLED(NEWPANEL) #if ENABLED(NEWPANEL)
#define EN_C (_BV(BLEN_C)) #define EN_C (_BV(BLEN_C))
#define EN_B (_BV(BLEN_B)) #define EN_B (_BV(BLEN_B))
#define EN_A (_BV(BLEN_A)) #define EN_A (_BV(BLEN_A))
#if ENABLED(INVERT_CLICK_BUTTON)
#define LCD_CLICKED !(buttons&EN_C) #if ENABLED(REPRAPWORLD_KEYPAD)
#define LCD_CLICKED ((buttons&EN_C) || (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_F1))
#else #else
#define LCD_CLICKED (buttons&EN_C) #if ENABLED(INVERT_CLICK_BUTTON)
#define LCD_CLICKED !(buttons&EN_C)
#else
#define LCD_CLICKED (buttons&EN_C)
#endif
#endif #endif
#if ENABLED(BTN_BACK) && BTN_BACK > 0 #if ENABLED(BTN_BACK) && BTN_BACK > 0
#define EN_D (_BV(BLEN_D)) #define EN_D (_BV(BLEN_D))
#if ENABLED(INVERT_BACK_BUTTON) #if ENABLED(INVERT_BACK_BUTTON)
...@@ -109,30 +145,10 @@ ...@@ -109,30 +145,10 @@
#define LCD_BACK_CLICKED (buttons&EN_D) #define LCD_BACK_CLICKED (buttons&EN_D)
#endif #endif
#endif #endif
#if ENABLED(REPRAPWORLD_KEYPAD)
#define EN_REPRAPWORLD_KEYPAD_F3 (_BV(BLEN_REPRAPWORLD_KEYPAD_F3)) #else // !NEWPANEL
#define EN_REPRAPWORLD_KEYPAD_F2 (_BV(BLEN_REPRAPWORLD_KEYPAD_F2))
#define EN_REPRAPWORLD_KEYPAD_F1 (_BV(BLEN_REPRAPWORLD_KEYPAD_F1)) // atomic, do not change
#define EN_REPRAPWORLD_KEYPAD_UP (_BV(BLEN_REPRAPWORLD_KEYPAD_UP))
#define EN_REPRAPWORLD_KEYPAD_RIGHT (_BV(BLEN_REPRAPWORLD_KEYPAD_RIGHT))
#define EN_REPRAPWORLD_KEYPAD_MIDDLE (_BV(BLEN_REPRAPWORLD_KEYPAD_MIDDLE))
#define EN_REPRAPWORLD_KEYPAD_DOWN (_BV(BLEN_REPRAPWORLD_KEYPAD_DOWN))
#define EN_REPRAPWORLD_KEYPAD_LEFT (_BV(BLEN_REPRAPWORLD_KEYPAD_LEFT))
#if ENABLED(INVERT_CLICK_BUTTON)
#define LCD_CLICKED !((buttons&EN_C) || (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_F1))
#else
#define LCD_CLICKED ((buttons&EN_C) || (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_F1))
#endif
#define REPRAPWORLD_KEYPAD_MOVE_Z_UP (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_F2)
#define REPRAPWORLD_KEYPAD_MOVE_Z_DOWN (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_F3)
#define REPRAPWORLD_KEYPAD_MOVE_X_LEFT (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_LEFT)
#define REPRAPWORLD_KEYPAD_MOVE_X_RIGHT (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_RIGHT)
#define REPRAPWORLD_KEYPAD_MOVE_Y_DOWN (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_DOWN)
#define REPRAPWORLD_KEYPAD_MOVE_Y_UP (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_UP)
#define REPRAPWORLD_KEYPAD_MOVE_HOME (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_MIDDLE)
#endif //REPRAPWORLD_KEYPAD
#else
//atomic, do not change
#define B_LE (_BV(BL_LE)) #define B_LE (_BV(BL_LE))
#define B_UP (_BV(BL_UP)) #define B_UP (_BV(BL_UP))
#define B_MI (_BV(BL_MI)) #define B_MI (_BV(BL_MI))
...@@ -142,9 +158,9 @@ ...@@ -142,9 +158,9 @@
#define EN_B (_BV(BLEN_B)) #define EN_B (_BV(BLEN_B))
#define EN_A (_BV(BLEN_A)) #define EN_A (_BV(BLEN_A))
#define LCD_CLICKED (buttons&(B_MI|B_ST)) #define LCD_CLICKED ((buttons&B_MI)||(buttons&B_ST))
#endif//NEWPANEL #endif // NEWPANEL
char* itostr2(const uint8_t& x); char* itostr2(const uint8_t& x);
char* itostr31(const int& xx); char* itostr31(const int& xx);
......
...@@ -933,7 +933,7 @@ void lcd_implementation_drawedit(const char* pstr, char* value) { ...@@ -933,7 +933,7 @@ void lcd_implementation_drawedit(const char* pstr, char* value) {
#endif // SDSUPPORT #endif // SDSUPPORT
#define lcd_implementation_drawmenu_back(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, LCD_STR_UPLEVEL[0], LCD_STR_UPLEVEL[0]) #define lcd_implementation_drawmenu_back(sel, row, pstr) lcd_implementation_drawmenu_generic(sel, row, pstr, LCD_STR_UPLEVEL[0], LCD_STR_UPLEVEL[0])
#define lcd_implementation_drawmenu_submenu(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', LCD_STR_ARROW_RIGHT[0]) #define lcd_implementation_drawmenu_submenu(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', LCD_STR_ARROW_RIGHT[0])
#define lcd_implementation_drawmenu_gcode(sel, row, pstr, gcode) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', ' ') #define lcd_implementation_drawmenu_gcode(sel, row, pstr, gcode) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', ' ')
#define lcd_implementation_drawmenu_function(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', ' ') #define lcd_implementation_drawmenu_function(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', ' ')
......
...@@ -226,8 +226,8 @@ void autotempShutdown() { ...@@ -226,8 +226,8 @@ void autotempShutdown() {
#endif #endif
} }
#if ENABLED(PIDTEMP) || ENABLED(PIDTEMPBED) #if HAS(PID_HEATING)
void PID_autotune(float temp, int hotend, int ncycles) { void PID_autotune(float temp, int hotend, int ncycles, bool set_result/*=false*/) {
float input = 0.0; float input = 0.0;
int cycles = 0; int cycles = 0;
bool heating = true; bool heating = true;
...@@ -237,7 +237,7 @@ void autotempShutdown() { ...@@ -237,7 +237,7 @@ void autotempShutdown() {
long bias = 0, d = 0; long bias = 0, d = 0;
float Ku = 0, Tu = 0; float Ku = 0, Tu = 0;
float Kp_temp = 0, Ki_temp = 0, Kd_temp = 0; float workKp = 0, workKi = 0, workKd = 0;
float max = 0, min = 10000; float max = 0, min = 10000;
#if HAS(AUTO_FAN) #if HAS(AUTO_FAN)
...@@ -323,23 +323,29 @@ void autotempShutdown() { ...@@ -323,23 +323,29 @@ void autotempShutdown() {
Tu = ((float)(t_low + t_high) / 1000.0); Tu = ((float)(t_low + t_high) / 1000.0);
ECHO_MV(SERIAL_KU, Ku); ECHO_MV(SERIAL_KU, Ku);
ECHO_EMV(SERIAL_TU, Tu); ECHO_EMV(SERIAL_TU, Tu);
Kp_temp = 0.6 * Ku; workKp = 0.6 * Ku;
Ki_temp = 2 * Kp_temp / Tu; workKi = 2 * workKp / Tu;
Kd_temp = Kp_temp * Tu / 8; workKd = workKp * Tu / 8;
ECHO_EM(SERIAL_CLASSIC_PID); ECHO_EM(SERIAL_CLASSIC_PID);
ECHO_MV(SERIAL_KP, Kp_temp); ECHO_MV(SERIAL_KP, workKp);
ECHO_MV(SERIAL_KI, Ki_temp); ECHO_MV(SERIAL_KI, workKi);
ECHO_EMV(SERIAL_KD, Kd_temp); ECHO_EMV(SERIAL_KD, workKd);
} }
else { else {
ECHO_E; ECHO_E;
} }
} }
if (hotend < 0) #if HAS(PID_FOR_BOTH)
soft_pwm_bed = (bias + d) >> 1; if (hotend < 0)
else soft_pwm_bed = (bias + d) >> 1;
else
soft_pwm[hotend] = (bias + d) >> 1;
#elif ENABLED(PIDTEMP)
soft_pwm[hotend] = (bias + d) >> 1; soft_pwm[hotend] = (bias + d) >> 1;
#else
soft_pwm_bed = (bias + d) >> 1;
#endif
cycles++; cycles++;
min = temp; min = temp;
} }
...@@ -351,7 +357,7 @@ void autotempShutdown() { ...@@ -351,7 +357,7 @@ void autotempShutdown() {
} }
// Every 2 seconds... // Every 2 seconds...
if (ms > temp_ms + 2000) { if (ELAPSED(ms, temp_ms + 2000UL)) {
#if HAS(TEMP_0) || HAS(TEMP_BED) || ENABLED(HEATER_0_USES_MAX6675) #if HAS(TEMP_0) || HAS(TEMP_BED) || ENABLED(HEATER_0_USES_MAX6675)
print_heaterstates(); print_heaterstates();
ECHO_E; ECHO_E;
...@@ -367,23 +373,51 @@ void autotempShutdown() { ...@@ -367,23 +373,51 @@ void autotempShutdown() {
} }
if (cycles > ncycles) { if (cycles > ncycles) {
ECHO_LM(DB, SERIAL_PID_AUTOTUNE_FINISHED); ECHO_LM(DB, SERIAL_PID_AUTOTUNE_FINISHED);
#if ENABLED(PIDTEMP) #if HAS(PID_FOR_BOTH)
if (hotend >= 0) { if (hotend >= 0) {
PID_PARAM(Kp, hotend) = Kp_temp;
PID_PARAM(Ki, hotend) = scalePID_i(Ki_temp);
PID_PARAM(Kd, hotend) = scalePID_d(Kd_temp);
updatePID();
ECHO_SMV(DB, SERIAL_KP, PID_PARAM(Kp, hotend)); ECHO_SMV(DB, SERIAL_KP, PID_PARAM(Kp, hotend));
ECHO_MV(SERIAL_KI, unscalePID_i(PID_PARAM(Ki, hotend))); ECHO_MV(SERIAL_KI, unscalePID_i(PID_PARAM(Ki, hotend)));
ECHO_EMV(SERIAL_KD, unscalePID_d(PID_PARAM(Kd, hotend))); ECHO_EMV(SERIAL_KD, unscalePID_d(PID_PARAM(Kd, hotend)));
if (set_result) {
PID_PARAM(Kp, hotend) = workKp;
PID_PARAM(Ki, hotend) = scalePID_i(workKi);
PID_PARAM(Kd, hotend) = scalePID_d(workKd);
updatePID();
}
} }
else { else {
ECHO_LMV(DB, "#define DEFAULT_bedKp ", Kp_temp); ECHO_LMV(DB, "#define DEFAULT_bedKp ", workKp);
ECHO_LMV(DB, "#define DEFAULT_bedKi ", unscalePID_i(Ki_temp)); ECHO_LMV(DB, "#define DEFAULT_bedKi ", unscalePID_i(workKi));
ECHO_LMV(DB, "#define DEFAULT_bedKd ", unscalePID_d(Kd_temp)); ECHO_LMV(DB, "#define DEFAULT_bedKd ", unscalePID_d(workKd));
if (set_result) {
bedKp = workKp;
bedKi = scalePID_i(workKi);
bedKd = scalePID_d(workKd);
updatePID();
}
}
#elif ENABLED(PIDTEMP)
ECHO_SMV(DB, SERIAL_KP, PID_PARAM(Kp, hotend));
ECHO_MV(SERIAL_KI, unscalePID_i(PID_PARAM(Ki, hotend)));
ECHO_EMV(SERIAL_KD, unscalePID_d(PID_PARAM(Kd, hotend)));
if (set_result) {
PID_PARAM(Kp, hotend) = workKp;
PID_PARAM(Ki, hotend) = scalePID_i(workKi);
PID_PARAM(Kd, hotend) = scalePID_d(workKd);
updatePID();
}
#else
ECHO_LMV(DB, "#define DEFAULT_bedKp ", workKp);
ECHO_LMV(DB, "#define DEFAULT_bedKi ", unscalePID_i(workKi));
ECHO_LMV(DB, "#define DEFAULT_bedKd ", unscalePID_d(workKd));
if (set_result) {
bedKp = workKp;
bedKi = scalePID_i(workKi);
bedKd = scalePID_d(workKd);
updatePID();
} }
#endif #endif
return; return;
} }
lcd_update(); lcd_update();
......
...@@ -168,7 +168,9 @@ int getHeaterPower(int heater); ...@@ -168,7 +168,9 @@ int getHeaterPower(int heater);
void disable_all_heaters(); void disable_all_heaters();
void updatePID(); void updatePID();
void PID_autotune(float temp, int hotend, int ncycles); #if HAS(PID_HEATING)
void PID_autotune(float temp, int hotend, int ncycles, bool set_result = false);
#endif
void setExtruderAutoFanState(int pin, bool state); void setExtruderAutoFanState(int pin, bool state);
void checkExtruderAutoFans(); void checkExtruderAutoFans();
......
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