Merge pull request #407 from buildrob101/Marlin_v1

Combine and converge other I2C LCD branches (PANELOLU2, VIKI & PCF8575)
This commit is contained in:
ErikZalm 2013-05-18 11:28:32 -07:00
commit 1a18a487f9
7 changed files with 1081 additions and 907 deletions

View file

@ -90,7 +90,7 @@
#define TEMP_SENSOR_BED 0 #define TEMP_SENSOR_BED 0
// Actual temperature must be close to target for this long before M109 returns success // Actual temperature must be close to target for this long before M109 returns success
#define TEMP_RESIDENCY_TIME 10 // (seconds) #define TEMP_RESIDENCY_TIME 10 // (seconds)
#define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one #define TEMP_HYSTERESIS 3 // (degC) range of +/- temperatures considered "close" to the target one
#define TEMP_WINDOW 1 // (degC) Window around target to start the recidency timer x degC early. #define TEMP_WINDOW 1 // (degC) Window around target to start the recidency timer x degC early.
@ -315,9 +315,18 @@ const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of th
// please keep turned on if you can. // please keep turned on if you can.
//#define EEPROM_CHITCHAT //#define EEPROM_CHITCHAT
// Preheat Constants
#define PLA_PREHEAT_HOTEND_TEMP 180
#define PLA_PREHEAT_HPB_TEMP 70
#define PLA_PREHEAT_FAN_SPEED 255 // Insert Value between 0 and 255
#define ABS_PREHEAT_HOTEND_TEMP 240
#define ABS_PREHEAT_HPB_TEMP 100
#define ABS_PREHEAT_FAN_SPEED 255 // Insert Value between 0 and 255
//LCD and SD support //LCD and SD support
//#define ULTRA_LCD //general lcd support, also 16x2 //#define ULTRA_LCD //general lcd support, also 16x2
//#define DOGLCD // Support for SPI LCD 128x64 (Controller ST7565R graphic Display Family) //#define DOGLCD // Support for SPI LCD 128x64 (Controller ST7565R graphic Display Family)
//#define SDSUPPORT // Enable SD Card Support in Hardware Console //#define SDSUPPORT // Enable SD Card Support in Hardware Console
//#define SDSLOW // Use slower SD transfer mode (not normally needed - uncomment if you're getting volume init error) //#define SDSLOW // Use slower SD transfer mode (not normally needed - uncomment if you're getting volume init error)
@ -360,36 +369,67 @@ const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of th
#define ULTIPANEL #define ULTIPANEL
#endif #endif
// Preheat Constants //I2C PANELS
#define PLA_PREHEAT_HOTEND_TEMP 180
#define PLA_PREHEAT_HPB_TEMP 70
#define PLA_PREHEAT_FAN_SPEED 255 // Insert Value between 0 and 255
#define ABS_PREHEAT_HOTEND_TEMP 240 //#define LCD_I2C_SAINSMART_YWROBOT
#define ABS_PREHEAT_HPB_TEMP 100 #ifdef LCD_I2C_SAINSMART_YWROBOT
#define ABS_PREHEAT_FAN_SPEED 255 // Insert Value between 0 and 255 // This uses the LiquidCrystal_I2C library ( https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home )
// Make sure it is placed in the Arduino libraries directory.
#define LCD_I2C_TYPE_PCF8575
#define LCD_I2C_ADDRESS 0x27 // I2C Address of the port expander
#define NEWPANEL
#define ULTIPANEL
#endif
// PANELOLU2 LCD with status LEDs, separate encoder and click inputs
//#define LCD_I2C_PANELOLU2
#ifdef LCD_I2C_PANELOLU2
// This uses the LiquidTWI2 library v1.2.3 or later ( https://github.com/lincomatic/LiquidTWI2 )
// Make sure the LiquidTWI2 directory is placed in the Arduino or Sketchbook libraries subdirectory.
// (v1.2.3 no longer requires you to define PANELOLU in the LiquidTWI2.h library header file)
// Note: The PANELOLU2 encoder click input can either be directly connected to a pin
// (if BTN_ENC defined to != -1) or read through I2C (when BTN_ENC == -1).
#define LCD_I2C_TYPE_MCP23017
#define LCD_I2C_ADDRESS 0x20 // I2C Address of the port expander
#define LCD_USE_I2C_BUZZER //comment out to disable buzzer on LCD
#define NEWPANEL
#define ULTIPANEL
#endif
// Panucatt VIKI LCD with status LEDs, integrated click & L/R/U/P buttons, separate encoder inputs
//#define LCD_I2C_VIKI
#ifdef LCD_I2C_VIKI
// This uses the LiquidTWI2 library v1.2.3 or later ( https://github.com/lincomatic/LiquidTWI2 )
// Make sure the LiquidTWI2 directory is placed in the Arduino or Sketchbook libraries subdirectory.
// Note: The pause/stop/resume LCD button pin should be connected to the Arduino
// BTN_ENC pin (or set BTN_ENC to -1 if not used)
#define LCD_I2C_TYPE_MCP23017
#define LCD_I2C_ADDRESS 0x20 // I2C Address of the port expander
#define LCD_USE_I2C_BUZZER //comment out to disable buzzer on LCD (requires LiquidTWI2 v1.2.3 or later)
#define NEWPANEL
#define ULTIPANEL
#endif
#ifdef ULTIPANEL #ifdef ULTIPANEL
// #define NEWPANEL //enable this if you have a click-encoder panel // #define NEWPANEL //enable this if you have a click-encoder panel
#define SDSUPPORT #define SDSUPPORT
#define ULTRA_LCD #define ULTRA_LCD
#ifdef DOGLCD // Change number of lines to match the DOG graphic display #ifdef DOGLCD // Change number of lines to match the DOG graphic display
#define LCD_WIDTH 20 #define LCD_WIDTH 20
#define LCD_HEIGHT 5 #define LCD_HEIGHT 5
#else #else
#define LCD_WIDTH 20 #define LCD_WIDTH 20
#define LCD_HEIGHT 4 #define LCD_HEIGHT 4
#endif #endif
#else //no panel but just lcd #else //no panel but just lcd
#ifdef ULTRA_LCD #ifdef ULTRA_LCD
#ifdef DOGLCD // Change number of lines to match the 128x64 graphics display #ifdef DOGLCD // Change number of lines to match the 128x64 graphics display
#define LCD_WIDTH 20 #define LCD_WIDTH 20
#define LCD_HEIGHT 5 #define LCD_HEIGHT 5
#else #else
#define LCD_WIDTH 16 #define LCD_WIDTH 16
#define LCD_HEIGHT 2 #define LCD_HEIGHT 2
#endif #endif
#endif #endif
#endif #endif

View file

@ -34,11 +34,17 @@
#include "pins.h" #include "pins.h"
#ifdef ULTRA_LCD #ifdef ULTRA_LCD
#ifdef DOGLCD #if defined(LCD_I2C_TYPE_PCF8575)
#include <U8glib.h> // library for graphics LCD by Oli Kraus (https://code.google.com/p/u8glib/) #include <Wire.h>
#else #include <LiquidCrystal_I2C.h>
#include <LiquidCrystal.h> // library for character LCD #elif defined(LCD_I2C_TYPE_MCP23017) || defined(LCD_I2C_TYPE_MCP23008)
#endif #include <Wire.h>
#include <LiquidTWI2.h>
#elif defined(DOGLCD)
#include <U8glib.h> // library for graphics LCD by Oli Kraus (https://code.google.com/p/u8glib/)
#else
#include <LiquidCrystal.h> // library for character LCD
#endif
#endif #endif
#if DIGIPOTSS_PIN > -1 #if DIGIPOTSS_PIN > -1

View file

@ -40,11 +40,11 @@
#include "language.h" #include "language.h"
#include "pins_arduino.h" #include "pins_arduino.h"
#if (defined NUM_SERVOS) && (NUM_SERVOS > 0) #if NUM_SERVOS > 0
#include "Servo.h" #include "Servo.h"
#endif #endif
#if DIGIPOTSS_PIN > -1 #if DIGIPOTSS_PIN > 0
#include <SPI.h> #include <SPI.h>
#endif #endif
@ -102,7 +102,7 @@
// M85 - Set inactivity shutdown timer with parameter S<seconds>. To disable set zero (default) // M85 - Set inactivity shutdown timer with parameter S<seconds>. To disable set zero (default)
// M92 - Set axis_steps_per_unit - same syntax as G92 // M92 - Set axis_steps_per_unit - same syntax as G92
// M114 - Output current position to serial port // M114 - Output current position to serial port
// M115 - Capabilities string // M115 - Capabilities string
// M117 - display message // M117 - display message
// M119 - Output Endstop status to serial port // M119 - Output Endstop status to serial port
// M126 - Solenoid Air Valve Open (BariCUDA support by jmil) // M126 - Solenoid Air Valve Open (BariCUDA support by jmil)
@ -230,7 +230,7 @@ static uint8_t tmp_extruder;
bool Stopped=false; bool Stopped=false;
#if (defined NUM_SERVOS) && (NUM_SERVOS > 0) #if NUM_SERVOS > 0
Servo servos[NUM_SERVOS]; Servo servos[NUM_SERVOS];
#endif #endif
@ -309,7 +309,7 @@ void setup_killpin()
void setup_photpin() void setup_photpin()
{ {
#ifdef PHOTOGRAPH_PIN #ifdef PHOTOGRAPH_PIN
#if (PHOTOGRAPH_PIN > -1) #if (PHOTOGRAPH_PIN > 0)
SET_OUTPUT(PHOTOGRAPH_PIN); SET_OUTPUT(PHOTOGRAPH_PIN);
WRITE(PHOTOGRAPH_PIN, LOW); WRITE(PHOTOGRAPH_PIN, LOW);
#endif #endif
@ -324,7 +324,7 @@ void setup_powerhold()
WRITE(SUICIDE_PIN, HIGH); WRITE(SUICIDE_PIN, HIGH);
#endif #endif
#endif #endif
#if (PS_ON_PIN > -1) #if (PS_ON_PIN > 0)
SET_OUTPUT(PS_ON_PIN); SET_OUTPUT(PS_ON_PIN);
WRITE(PS_ON_PIN, PS_ON_AWAKE); WRITE(PS_ON_PIN, PS_ON_AWAKE);
#endif #endif
@ -333,7 +333,7 @@ void setup_powerhold()
void suicide() void suicide()
{ {
#ifdef SUICIDE_PIN #ifdef SUICIDE_PIN
#if (SUICIDE_PIN> -1) #if (SUICIDE_PIN > 0)
SET_OUTPUT(SUICIDE_PIN); SET_OUTPUT(SUICIDE_PIN);
WRITE(SUICIDE_PIN, LOW); WRITE(SUICIDE_PIN, LOW);
#endif #endif
@ -342,16 +342,16 @@ void suicide()
void servo_init() void servo_init()
{ {
#if (NUM_SERVOS >= 1) && defined (SERVO0_PIN) && (SERVO0_PIN > -1) #if (NUM_SERVOS >= 1) && (SERVO0_PIN > 0)
servos[0].attach(SERVO0_PIN); servos[0].attach(SERVO0_PIN);
#endif #endif
#if (NUM_SERVOS >= 2) && defined (SERVO1_PIN) && (SERVO1_PIN > -1) #if (NUM_SERVOS >= 2) && (SERVO1_PIN > 0)
servos[1].attach(SERVO1_PIN); servos[1].attach(SERVO1_PIN);
#endif #endif
#if (NUM_SERVOS >= 3) && defined (SERVO2_PIN) && (SERVO2_PIN > -1) #if (NUM_SERVOS >= 3) && (SERVO2_PIN > 0)
servos[2].attach(SERVO2_PIN); servos[2].attach(SERVO2_PIN);
#endif #endif
#if (NUM_SERVOS >= 4) && defined (SERVO3_PIN) && (SERVO3_PIN > -1) #if (NUM_SERVOS >= 4) && (SERVO3_PIN > 0)
servos[3].attach(SERVO3_PIN); servos[3].attach(SERVO3_PIN);
#endif #endif
#if (NUM_SERVOS >= 5) #if (NUM_SERVOS >= 5)
@ -433,9 +433,9 @@ void loop()
#ifdef SDSUPPORT #ifdef SDSUPPORT
if(card.saving) if(card.saving)
{ {
if(strstr_P(cmdbuffer[bufindr], PSTR("M29")) == NULL) if(strstr_P(cmdbuffer[bufindr], PSTR("M29")) == NULL)
{ {
card.write_command(cmdbuffer[bufindr]); card.write_command(cmdbuffer[bufindr]);
if(card.logging) if(card.logging)
{ {
process_commands(); process_commands();
@ -444,16 +444,16 @@ void loop()
{ {
SERIAL_PROTOCOLLNPGM(MSG_OK); SERIAL_PROTOCOLLNPGM(MSG_OK);
} }
} }
else else
{ {
card.closefile(); card.closefile();
SERIAL_PROTOCOLLNPGM(MSG_FILE_SAVED); SERIAL_PROTOCOLLNPGM(MSG_FILE_SAVED);
} }
} }
else else
{ {
process_commands(); process_commands();
} }
#else #else
process_commands(); process_commands();
@ -548,10 +548,10 @@ void get_command()
case 2: case 2:
case 3: case 3:
if(Stopped == false) { // If printer is stopped by an error the G[0-3] codes are ignored. if(Stopped == false) { // If printer is stopped by an error the G[0-3] codes are ignored.
#ifdef SDSUPPORT #ifdef SDSUPPORT
if(card.saving) if(card.saving)
break; break;
#endif //SDSUPPORT #endif //SDSUPPORT
SERIAL_PROTOCOLLNPGM(MSG_OK); SERIAL_PROTOCOLLNPGM(MSG_OK);
} }
else { else {
@ -645,17 +645,17 @@ bool code_seen(char code)
return (strchr_pointer != NULL); //Return True if a character was found return (strchr_pointer != NULL); //Return True if a character was found
} }
#define DEFINE_PGM_READ_ANY(type, reader) \ #define DEFINE_PGM_READ_ANY(type, reader) \
static inline type pgm_read_any(const type *p) \ static inline type pgm_read_any(const type *p) \
{ return pgm_read_##reader##_near(p); } { return pgm_read_##reader##_near(p); }
DEFINE_PGM_READ_ANY(float, float); DEFINE_PGM_READ_ANY(float, float);
DEFINE_PGM_READ_ANY(signed char, byte); DEFINE_PGM_READ_ANY(signed char, byte);
#define XYZ_CONSTS_FROM_CONFIG(type, array, CONFIG) \ #define XYZ_CONSTS_FROM_CONFIG(type, array, CONFIG) \
static const PROGMEM type array##_P[3] = \ static const PROGMEM type array##_P[3] = \
{ X_##CONFIG, Y_##CONFIG, Z_##CONFIG }; \ { X_##CONFIG, Y_##CONFIG, Z_##CONFIG }; \
static inline type array(int axis) \ static inline type array(int axis) \
{ return pgm_read_any(&array##_P[axis]); } { return pgm_read_any(&array##_P[axis]); }
XYZ_CONSTS_FROM_CONFIG(float, base_min_pos, MIN_POS); XYZ_CONSTS_FROM_CONFIG(float, base_min_pos, MIN_POS);
@ -673,7 +673,7 @@ static void axis_is_at_home(int axis) {
static void homeaxis(int axis) { static void homeaxis(int axis) {
#define HOMEAXIS_DO(LETTER) \ #define HOMEAXIS_DO(LETTER) \
((LETTER##_MIN_PIN > -1 && LETTER##_HOME_DIR==-1) || (LETTER##_MAX_PIN > -1 && LETTER##_HOME_DIR==1)) ((LETTER##_MIN_PIN > 0 && LETTER##_HOME_DIR==-1) || (LETTER##_MAX_PIN > 0 && LETTER##_HOME_DIR==1))
if (axis==X_AXIS ? HOMEAXIS_DO(X) : if (axis==X_AXIS ? HOMEAXIS_DO(X) :
axis==Y_AXIS ? HOMEAXIS_DO(Y) : axis==Y_AXIS ? HOMEAXIS_DO(Y) :
@ -911,13 +911,13 @@ void process_commands()
previous_millis_cmd = millis(); previous_millis_cmd = millis();
if (codenum > 0){ if (codenum > 0){
codenum += millis(); // keep track of when we started waiting codenum += millis(); // keep track of when we started waiting
while(millis() < codenum && !LCD_CLICKED){ while(millis() < codenum && !lcd_clicked()){
manage_heater(); manage_heater();
manage_inactivity(); manage_inactivity();
lcd_update(); lcd_update();
} }
}else{ }else{
while(!LCD_CLICKED){ while(!lcd_clicked()){
manage_heater(); manage_heater();
manage_inactivity(); manage_inactivity();
lcd_update(); lcd_update();
@ -987,17 +987,17 @@ void process_commands()
//card,saving = false; //card,saving = false;
break; break;
case 30: //M30 <filename> Delete File case 30: //M30 <filename> Delete File
if (card.cardOK){ if (card.cardOK){
card.closefile(); card.closefile();
starpos = (strchr(strchr_pointer + 4,'*')); starpos = (strchr(strchr_pointer + 4,'*'));
if(starpos != NULL){ if(starpos != NULL){
char* npos = strchr(cmdbuffer[bufindr], 'N'); char* npos = strchr(cmdbuffer[bufindr], 'N');
strchr_pointer = strchr(npos,' ') + 1; strchr_pointer = strchr(npos,' ') + 1;
*(starpos-1) = '\0'; *(starpos-1) = '\0';
} }
card.removeFile(strchr_pointer + 4); card.removeFile(strchr_pointer + 4);
} }
break; break;
case 928: //M928 - Start SD write case 928: //M928 - Start SD write
starpos = (strchr(strchr_pointer + 5,'*')); starpos = (strchr(strchr_pointer + 5,'*'));
if(starpos != NULL){ if(starpos != NULL){
@ -1062,12 +1062,12 @@ void process_commands()
if(setTargetedHotend(105)){ if(setTargetedHotend(105)){
break; break;
} }
#if (TEMP_0_PIN > -1) #if (TEMP_0_PIN > 0)
SERIAL_PROTOCOLPGM("ok T:"); SERIAL_PROTOCOLPGM("ok T:");
SERIAL_PROTOCOL_F(degHotend(tmp_extruder),1); SERIAL_PROTOCOL_F(degHotend(tmp_extruder),1);
SERIAL_PROTOCOLPGM(" /"); SERIAL_PROTOCOLPGM(" /");
SERIAL_PROTOCOL_F(degTargetHotend(tmp_extruder),1); SERIAL_PROTOCOL_F(degTargetHotend(tmp_extruder),1);
#if TEMP_BED_PIN > -1 #if TEMP_BED_PIN > 0
SERIAL_PROTOCOLPGM(" B:"); SERIAL_PROTOCOLPGM(" B:");
SERIAL_PROTOCOL_F(degBed(),1); SERIAL_PROTOCOL_F(degBed(),1);
SERIAL_PROTOCOLPGM(" /"); SERIAL_PROTOCOLPGM(" /");
@ -1165,7 +1165,7 @@ void process_commands()
} }
break; break;
case 190: // M190 - Wait for bed heater to reach target. case 190: // M190 - Wait for bed heater to reach target.
#if TEMP_BED_PIN > -1 #if TEMP_BED_PIN > 0
LCD_MESSAGEPGM(MSG_BED_HEATING); LCD_MESSAGEPGM(MSG_BED_HEATING);
if (code_seen('S')) setTargetBed(code_value()); if (code_seen('S')) setTargetBed(code_value());
codenum = millis(); codenum = millis();
@ -1192,7 +1192,7 @@ void process_commands()
#endif #endif
break; break;
#if FAN_PIN > -1 #if FAN_PIN > 0
case 106: //M106 Fan On case 106: //M106 Fan On
if (code_seen('S')){ if (code_seen('S')){
fanSpeed=constrain(code_value(),0,255); fanSpeed=constrain(code_value(),0,255);
@ -1206,8 +1206,8 @@ void process_commands()
break; break;
#endif //FAN_PIN #endif //FAN_PIN
#ifdef BARICUDA #ifdef BARICUDA
// PWM for HEATER_1_PIN // PWM for HEATER_1_PIN
#if HEATER_1_PIN > -1 #if HEATER_1_PIN > 0
case 126: //M126 valve open case 126: //M126 valve open
if (code_seen('S')){ if (code_seen('S')){
ValvePressure=constrain(code_value(),0,255); ValvePressure=constrain(code_value(),0,255);
@ -1221,8 +1221,8 @@ void process_commands()
break; break;
#endif //HEATER_1_PIN #endif //HEATER_1_PIN
// PWM for HEATER_2_PIN // PWM for HEATER_2_PIN
#if HEATER_2_PIN > -1 #if HEATER_2_PIN > 0
case 128: //M128 valve open case 128: //M128 valve open
if (code_seen('S')){ if (code_seen('S')){
EtoPPressure=constrain(code_value(),0,255); EtoPPressure=constrain(code_value(),0,255);
@ -1237,7 +1237,7 @@ void process_commands()
#endif //HEATER_2_PIN #endif //HEATER_2_PIN
#endif #endif
#if (PS_ON_PIN > -1) #if (PS_ON_PIN > 0)
case 80: // M80 - ATX Power On case 80: // M80 - ATX Power On
SET_OUTPUT(PS_ON_PIN); //GND SET_OUTPUT(PS_ON_PIN); //GND
WRITE(PS_ON_PIN, PS_ON_AWAKE); WRITE(PS_ON_PIN, PS_ON_AWAKE);
@ -1246,14 +1246,14 @@ void process_commands()
case 81: // M81 - ATX Power Off case 81: // M81 - ATX Power Off
#if defined SUICIDE_PIN && SUICIDE_PIN > -1 #if defined SUICIDE_PIN && SUICIDE_PIN > 0
st_synchronize(); st_synchronize();
suicide(); suicide();
#elif (PS_ON_PIN > -1) #elif (PS_ON_PIN > 0)
SET_OUTPUT(PS_ON_PIN); SET_OUTPUT(PS_ON_PIN);
WRITE(PS_ON_PIN, PS_ON_ASLEEP); WRITE(PS_ON_PIN, PS_ON_ASLEEP);
#endif #endif
break; break;
case 82: case 82:
axis_relative_modes[3] = false; axis_relative_modes[3] = false;
@ -1354,27 +1354,27 @@ void process_commands()
break; break;
case 119: // M119 case 119: // M119
SERIAL_PROTOCOLLN(MSG_M119_REPORT); SERIAL_PROTOCOLLN(MSG_M119_REPORT);
#if (X_MIN_PIN > -1) #if (X_MIN_PIN > 0)
SERIAL_PROTOCOLPGM(MSG_X_MIN); SERIAL_PROTOCOLPGM(MSG_X_MIN);
SERIAL_PROTOCOLLN(((READ(X_MIN_PIN)^X_ENDSTOPS_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN)); SERIAL_PROTOCOLLN(((READ(X_MIN_PIN)^X_ENDSTOPS_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN));
#endif #endif
#if (X_MAX_PIN > -1) #if (X_MAX_PIN > 0)
SERIAL_PROTOCOLPGM(MSG_X_MAX); SERIAL_PROTOCOLPGM(MSG_X_MAX);
SERIAL_PROTOCOLLN(((READ(X_MAX_PIN)^X_ENDSTOPS_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN)); SERIAL_PROTOCOLLN(((READ(X_MAX_PIN)^X_ENDSTOPS_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN));
#endif #endif
#if (Y_MIN_PIN > -1) #if (Y_MIN_PIN > 0)
SERIAL_PROTOCOLPGM(MSG_Y_MIN); SERIAL_PROTOCOLPGM(MSG_Y_MIN);
SERIAL_PROTOCOLLN(((READ(Y_MIN_PIN)^Y_ENDSTOPS_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN)); SERIAL_PROTOCOLLN(((READ(Y_MIN_PIN)^Y_ENDSTOPS_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN));
#endif #endif
#if (Y_MAX_PIN > -1) #if (Y_MAX_PIN > 0)
SERIAL_PROTOCOLPGM(MSG_Y_MAX); SERIAL_PROTOCOLPGM(MSG_Y_MAX);
SERIAL_PROTOCOLLN(((READ(Y_MAX_PIN)^Y_ENDSTOPS_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN)); SERIAL_PROTOCOLLN(((READ(Y_MAX_PIN)^Y_ENDSTOPS_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN));
#endif #endif
#if (Z_MIN_PIN > -1) #if (Z_MIN_PIN > 0)
SERIAL_PROTOCOLPGM(MSG_Z_MIN); SERIAL_PROTOCOLPGM(MSG_Z_MIN);
SERIAL_PROTOCOLLN(((READ(Z_MIN_PIN)^Z_ENDSTOPS_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN)); SERIAL_PROTOCOLLN(((READ(Z_MIN_PIN)^Z_ENDSTOPS_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN));
#endif #endif
#if (Z_MAX_PIN > -1) #if (Z_MAX_PIN > 0)
SERIAL_PROTOCOLPGM(MSG_Z_MAX); SERIAL_PROTOCOLPGM(MSG_Z_MAX);
SERIAL_PROTOCOLLN(((READ(Z_MAX_PIN)^Z_ENDSTOPS_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN)); SERIAL_PROTOCOLLN(((READ(Z_MAX_PIN)^Z_ENDSTOPS_INVERTING)?MSG_ENDSTOP_HIT:MSG_ENDSTOP_OPEN));
#endif #endif
@ -1389,7 +1389,7 @@ void process_commands()
} }
} }
// steps per sq second need to be updated to agree with the units per sq second (as they are what is used in the planner) // steps per sq second need to be updated to agree with the units per sq second (as they are what is used in the planner)
reset_acceleration_rates(); reset_acceleration_rates();
break; break;
#if 0 // Not used for Sprinter/grbl gen6 #if 0 // Not used for Sprinter/grbl gen6
case 202: // M202 case 202: // M202
@ -1513,8 +1513,8 @@ void process_commands()
} }
} }
break; break;
#if (defined NUM_SERVOS) && (NUM_SERVOS > 0) #if NUM_SERVOS > 0
case 280: // M280 - set servo position absolute. P: servo index, S: angle or microseconds case 280: // M280 - set servo position absolute. P: servo index, S: angle or microseconds
{ {
int servo_index = -1; int servo_index = -1;
@ -1545,16 +1545,20 @@ void process_commands()
break; break;
#endif // NUM_SERVOS > 0 #endif // NUM_SERVOS > 0
#if defined(LARGE_FLASH) && LARGE_FLASH == true && defined(BEEPER) && BEEPER > -1 #if LARGE_FLASH == true && ( BEEPER > 0 || defined(ULTRALCD) )
case 300: // M300 case 300: // M300
{ {
int beepS = 1; int beepS = 400;
int beepP = 1000; int beepP = 1000;
if(code_seen('S')) beepS = code_value(); if(code_seen('S')) beepS = code_value();
if(code_seen('P')) beepP = code_value(); if(code_seen('P')) beepP = code_value();
tone(BEEPER, beepS); #if BEEPER > 0
delay(beepP); tone(BEEPER, beepS);
noTone(BEEPER); delay(beepP);
noTone(BEEPER);
#elif defined(ULTRALCD)
lcd_buzz(beepS, beepP);
#endif
} }
break; break;
#endif // M300 #endif // M300
@ -1572,7 +1576,7 @@ void process_commands()
updatePID(); updatePID();
SERIAL_PROTOCOL(MSG_OK); SERIAL_PROTOCOL(MSG_OK);
SERIAL_PROTOCOL(" p:"); SERIAL_PROTOCOL(" p:");
SERIAL_PROTOCOL(Kp); SERIAL_PROTOCOL(Kp);
SERIAL_PROTOCOL(" i:"); SERIAL_PROTOCOL(" i:");
SERIAL_PROTOCOL(unscalePID_i(Ki)); SERIAL_PROTOCOL(unscalePID_i(Ki));
@ -1596,7 +1600,7 @@ void process_commands()
updatePID(); updatePID();
SERIAL_PROTOCOL(MSG_OK); SERIAL_PROTOCOL(MSG_OK);
SERIAL_PROTOCOL(" p:"); SERIAL_PROTOCOL(" p:");
SERIAL_PROTOCOL(bedKp); SERIAL_PROTOCOL(bedKp);
SERIAL_PROTOCOL(" i:"); SERIAL_PROTOCOL(" i:");
SERIAL_PROTOCOL(unscalePID_i(bedKi)); SERIAL_PROTOCOL(unscalePID_i(bedKi));
@ -1609,7 +1613,7 @@ void process_commands()
case 240: // M240 Triggers a camera by emulating a Canon RC-1 : http://www.doc-diy.net/photo/rc-1_hacked/ case 240: // M240 Triggers a camera by emulating a Canon RC-1 : http://www.doc-diy.net/photo/rc-1_hacked/
{ {
#ifdef PHOTOGRAPH_PIN #ifdef PHOTOGRAPH_PIN
#if (PHOTOGRAPH_PIN > -1) #if (PHOTOGRAPH_PIN > 0)
const uint8_t NUM_PULSES=16; const uint8_t NUM_PULSES=16;
const float PULSE_LENGTH=0.01524; const float PULSE_LENGTH=0.01524;
for(int i=0; i < NUM_PULSES; i++) { for(int i=0; i < NUM_PULSES; i++) {
@ -1641,8 +1645,8 @@ void process_commands()
int e=0; int e=0;
int c=5; int c=5;
if (code_seen('E')) e=code_value(); if (code_seen('E')) e=code_value();
if (e<0) if (e<0)
temp=70; temp=70;
if (code_seen('S')) temp=code_value(); if (code_seen('S')) temp=code_value();
if (code_seen('C')) c=code_value(); if (code_seen('C')) c=code_value();
PID_autotune(temp, e, c); PID_autotune(temp, e, c);
@ -1765,23 +1769,24 @@ void process_commands()
delay(100); delay(100);
LCD_ALERTMESSAGEPGM(MSG_FILAMENTCHANGE); LCD_ALERTMESSAGEPGM(MSG_FILAMENTCHANGE);
uint8_t cnt=0; uint8_t cnt=0;
while(!LCD_CLICKED){ while(!lcd_clicked()){
cnt++; cnt++;
manage_heater(); manage_heater();
manage_inactivity(); manage_inactivity();
lcd_update(); lcd_update();
#if BEEPER > -1
if(cnt==0) if(cnt==0)
{ {
#if BEEPER > 0
SET_OUTPUT(BEEPER); SET_OUTPUT(BEEPER);
WRITE(BEEPER,HIGH); WRITE(BEEPER,HIGH);
delay(3); delay(3);
WRITE(BEEPER,LOW); WRITE(BEEPER,LOW);
delay(3); delay(3);
} #else
lcd_buzz(1000/6,100);
#endif #endif
}
} }
//return to normal //return to normal
@ -1806,7 +1811,7 @@ void process_commands()
#endif //FILAMENTCHANGEENABLE #endif //FILAMENTCHANGEENABLE
case 907: // M907 Set digital trimpot motor current using axis codes. case 907: // M907 Set digital trimpot motor current using axis codes.
{ {
#if DIGIPOTSS_PIN > -1 #if DIGIPOTSS_PIN > 0
for(int i=0;i<NUM_AXIS;i++) if(code_seen(axis_codes[i])) digipot_current(i,code_value()); for(int i=0;i<NUM_AXIS;i++) if(code_seen(axis_codes[i])) digipot_current(i,code_value());
if(code_seen('B')) digipot_current(4,code_value()); if(code_seen('B')) digipot_current(4,code_value());
if(code_seen('S')) for(int i=0;i<=4;i++) digipot_current(i,code_value()); if(code_seen('S')) for(int i=0;i<=4;i++) digipot_current(i,code_value());
@ -1815,7 +1820,7 @@ void process_commands()
break; break;
case 908: // M908 Control digital trimpot directly. case 908: // M908 Control digital trimpot directly.
{ {
#if DIGIPOTSS_PIN > -1 #if DIGIPOTSS_PIN > 0
uint8_t channel,current; uint8_t channel,current;
if(code_seen('P')) channel=code_value(); if(code_seen('P')) channel=code_value();
if(code_seen('S')) current=code_value(); if(code_seen('S')) current=code_value();
@ -1825,7 +1830,7 @@ void process_commands()
break; break;
case 350: // M350 Set microstepping mode. Warning: Steps per unit remains unchanged. S code sets stepping mode for all drivers. case 350: // M350 Set microstepping mode. Warning: Steps per unit remains unchanged. S code sets stepping mode for all drivers.
{ {
#if X_MS1_PIN > -1 #if X_MS1_PIN > 0
if(code_seen('S')) for(int i=0;i<=4;i++) microstep_mode(i,code_value()); if(code_seen('S')) for(int i=0;i<=4;i++) microstep_mode(i,code_value());
for(int i=0;i<NUM_AXIS;i++) if(code_seen(axis_codes[i])) microstep_mode(i,(uint8_t)code_value()); for(int i=0;i<NUM_AXIS;i++) if(code_seen(axis_codes[i])) microstep_mode(i,(uint8_t)code_value());
if(code_seen('B')) microstep_mode(4,code_value()); if(code_seen('B')) microstep_mode(4,code_value());
@ -1835,7 +1840,7 @@ void process_commands()
break; break;
case 351: // M351 Toggle MS1 MS2 pins directly, S# determines MS1 or MS2, X# sets the pin high/low. case 351: // M351 Toggle MS1 MS2 pins directly, S# determines MS1 or MS2, X# sets the pin high/low.
{ {
#if X_MS1_PIN > -1 #if X_MS1_PIN > 0
if(code_seen('S')) switch((int)code_value()) if(code_seen('S')) switch((int)code_value())
{ {
case 1: case 1:
@ -2173,7 +2178,7 @@ void kill()
disable_e1(); disable_e1();
disable_e2(); disable_e2();
if(PS_ON_PIN > -1) pinMode(PS_ON_PIN,INPUT); if(PS_ON_PIN > 0) pinMode(PS_ON_PIN,INPUT);
SERIAL_ERROR_START; SERIAL_ERROR_START;
SERIAL_ERRORLNPGM(MSG_ERR_KILLED); SERIAL_ERRORLNPGM(MSG_ERR_KILLED);
LCD_ALERTMESSAGEPGM(MSG_KILLED); LCD_ALERTMESSAGEPGM(MSG_KILLED);

View file

@ -14,7 +14,7 @@
#define DIGIPOTSS_PIN -1 #define DIGIPOTSS_PIN -1
#if MOTHERBOARD == 99 #if MOTHERBOARD == 99
#define KNOWN_BOARD 1 #define KNOWN_BOARD 1
#define X_STEP_PIN 2 #define X_STEP_PIN 2
#define X_DIR_PIN 3 #define X_DIR_PIN 3
@ -228,7 +228,7 @@
//x axis pins //x axis pins
#define X_STEP_PIN 21 //different from stanard GEN7 #define X_STEP_PIN 21 //different from stanard GEN7
#define X_DIR_PIN 20 //different from stanard GEN7 #define X_DIR_PIN 20 //different from stanard GEN7
#define X_ENABLE_PIN 24 #define X_ENABLE_PIN 24
#define X_STOP_PIN 0 #define X_STOP_PIN 0
@ -274,11 +274,11 @@
//#define RX_ENABLE_PIN 13 //#define RX_ENABLE_PIN 13
#define BEEPER -1 #define BEEPER -1
#define SDCARDDETECT -1 #define SDCARDDETECT -1
#define SUICIDE_PIN -1 //has to be defined; otherwise Power_off doesn't work #define SUICIDE_PIN -1 //has to be defined; otherwise Power_off doesn't work
#define KILL_PIN -1 #define KILL_PIN -1
//Pins for 4bit LCD Support //Pins for 4bit LCD Support
#define LCD_PINS_RS 18 #define LCD_PINS_RS 18
#define LCD_PINS_ENABLE 17 #define LCD_PINS_ENABLE 17
#define LCD_PINS_D4 16 #define LCD_PINS_D4 16
@ -291,14 +291,6 @@
#define BTN_EN2 10 #define BTN_EN2 10
#define BTN_ENC 12 //the click #define BTN_ENC 12 //the click
#define BLEN_C 2
#define BLEN_B 1
#define BLEN_A 0
#define encrot0 0
#define encrot1 2
#define encrot2 3
#define encrot3 1
#endif #endif
/**************************************************************************************** /****************************************************************************************
@ -391,17 +383,7 @@
#ifdef ULTRA_LCD #ifdef ULTRA_LCD
#ifdef NEWPANEL #ifdef NEWPANEL
//encoder rotation values #define LCD_PINS_RS 16
#define encrot0 0
#define encrot1 2
#define encrot2 3
#define encrot3 1
#define BLEN_A 0
#define BLEN_B 1
#define BLEN_C 2
#define LCD_PINS_RS 16
#define LCD_PINS_ENABLE 17 #define LCD_PINS_ENABLE 17
#define LCD_PINS_D4 23 #define LCD_PINS_D4 23
#define LCD_PINS_D5 25 #define LCD_PINS_D5 25
@ -418,7 +400,7 @@
#define SDCARDDETECT 49 #define SDCARDDETECT 49
#else #else
//arduino pin which triggers an piezzo beeper //arduino pin which triggers an piezzo beeper
#define BEEPER 33 // Beeper on AUX-4 #define BEEPER 33 // Beeper on AUX-4
//buttons are directly attached using AUX-2 //buttons are directly attached using AUX-2
#ifdef REPRAPWORLD_KEYPAD #ifdef REPRAPWORLD_KEYPAD
@ -428,16 +410,7 @@
#define SHIFT_OUT 40 // shift register #define SHIFT_OUT 40 // shift register
#define SHIFT_CLK 44 // shift register #define SHIFT_CLK 44 // shift register
#define SHIFT_LD 42 // shift register #define SHIFT_LD 42 // shift register
// define register bit values, don't change it #else
#define BLEN_REPRAPWORLD_KEYPAD_F3 0
#define BLEN_REPRAPWORLD_KEYPAD_F2 1
#define BLEN_REPRAPWORLD_KEYPAD_F1 2
#define BLEN_REPRAPWORLD_KEYPAD_UP 3
#define BLEN_REPRAPWORLD_KEYPAD_RIGHT 4
#define BLEN_REPRAPWORLD_KEYPAD_MIDDLE 5
#define BLEN_REPRAPWORLD_KEYPAD_DOWN 6
#define BLEN_REPRAPWORLD_KEYPAD_LEFT 7
#else
#define BTN_EN1 37 #define BTN_EN1 37
#define BTN_EN2 35 #define BTN_EN2 35
#define BTN_ENC 31 //the click #define BTN_ENC 31 //the click
@ -452,10 +425,10 @@
#else //old style panel with shift register #else //old style panel with shift register
//arduino pin witch triggers an piezzo beeper //arduino pin witch triggers an piezzo beeper
#define BEEPER 33 No Beeper added #define BEEPER 33 // No Beeper added
//buttons are attached to a shift register //buttons are attached to a shift register
// Not wired this yet // Not wired this yet
//#define SHIFT_CLK 38 //#define SHIFT_CLK 38
//#define SHIFT_LD 42 //#define SHIFT_LD 42
//#define SHIFT_OUT 40 //#define SHIFT_OUT 40
@ -467,26 +440,7 @@
#define LCD_PINS_D5 25 #define LCD_PINS_D5 25
#define LCD_PINS_D6 27 #define LCD_PINS_D6 27
#define LCD_PINS_D7 29 #define LCD_PINS_D7 29
#endif
//encoder rotation values
#define encrot0 0
#define encrot1 2
#define encrot2 3
#define encrot3 1
//bits in the shift register that carry the buttons for:
// left up center down right red
#define BL_LE 7
#define BL_UP 6
#define BL_MI 5
#define BL_DW 4
#define BL_RI 3
#define BL_ST 2
#define BLEN_B 1
#define BLEN_A 0
#endif
#endif //ULTRA_LCD #endif //ULTRA_LCD
#else // RAMPS_V_1_1 or RAMPS_V_1_2 as default (MOTHERBOARD == 3) #else // RAMPS_V_1_1 or RAMPS_V_1_2 as default (MOTHERBOARD == 3)
@ -659,8 +613,8 @@
#define DEBUG_PIN 0 #define DEBUG_PIN 0
//our RS485 pins //our RS485 pins
#define TX_ENABLE_PIN 12 #define TX_ENABLE_PIN 12
#define RX_ENABLE_PIN 13 #define RX_ENABLE_PIN 13
#endif #endif
@ -759,43 +713,32 @@
//we have no buzzer installed //we have no buzzer installed
#define BEEPER -1 #define BEEPER -1
//LCD Pins //LCD Pins
#ifdef DOGLCD #ifdef DOGLCD
// Pins for DOGM SPI LCD Support // Pins for DOGM SPI LCD Support
#define DOGLCD_A0 30 #define DOGLCD_A0 30
#define DOGLCD_CS 29 #define DOGLCD_CS 29
// GLCD features // GLCD features
#define LCD_CONTRAST 1 #define LCD_CONTRAST 1
// Uncomment screen orientation // Uncomment screen orientation
// #define LCD_SCREEN_ROT_0 // #define LCD_SCREEN_ROT_0
// #define LCD_SCREEN_ROT_90 // #define LCD_SCREEN_ROT_90
#define LCD_SCREEN_ROT_180 #define LCD_SCREEN_ROT_180
// #define LCD_SCREEN_ROT_270 // #define LCD_SCREEN_ROT_270
#else // standard Hitachi LCD controller #else // standard Hitachi LCD controller
#define LCD_PINS_RS 4 #define LCD_PINS_RS 4
#define LCD_PINS_ENABLE 17 #define LCD_PINS_ENABLE 17
#define LCD_PINS_D4 30 #define LCD_PINS_D4 30
#define LCD_PINS_D5 29 #define LCD_PINS_D5 29
#define LCD_PINS_D6 28 #define LCD_PINS_D6 28
#define LCD_PINS_D7 27 #define LCD_PINS_D7 27
#endif #endif
//The encoder and click button //The encoder and click button
#define BTN_EN1 11 //must be a hardware interrupt pin #define BTN_EN1 11
#define BTN_EN2 10 //must be hardware interrupt pin #define BTN_EN2 10
#define BTN_ENC 16 //the switch #define BTN_ENC 16 //the switch
//not connected to a pin //not connected to a pin
#define SDCARDDETECT -1 #define SDCARDDETECT -1
//from the same bit in the RAMPS Newpanel define
//encoder rotation values
#define encrot0 0
#define encrot1 2
#define encrot2 3
#define encrot3 1
#define BLEN_C 2
#define BLEN_B 1
#define BLEN_A 0
#endif //Newpanel #endif //Newpanel
#endif //Ultipanel #endif //Ultipanel
@ -879,18 +822,9 @@
#define BTN_EN1 40 #define BTN_EN1 40
#define BTN_EN2 42 #define BTN_EN2 42
#define BTN_ENC 19 //the click #define BTN_ENC 19 //the click
#define BLEN_C 2
#define BLEN_B 1
#define BLEN_A 0
#define SDCARDDETECT 38 #define SDCARDDETECT 38
//encoder rotation values
#define encrot0 0
#define encrot1 2
#define encrot2 3
#define encrot3 1
#else //old style panel with shift register #else //old style panel with shift register
//arduino pin witch triggers an piezzo beeper //arduino pin witch triggers an piezzo beeper
#define BEEPER 18 #define BEEPER 18
@ -907,34 +841,9 @@
#define LCD_PINS_D5 21 #define LCD_PINS_D5 21
#define LCD_PINS_D6 20 #define LCD_PINS_D6 20
#define LCD_PINS_D7 19 #define LCD_PINS_D7 19
//encoder rotation values
#ifndef ULTIMAKERCONTROLLER
#define encrot0 0
#define encrot1 2
#define encrot2 3
#define encrot3 1
#else
#define encrot0 0
#define encrot1 1
#define encrot2 3
#define encrot3 2
#endif
#define SDCARDDETECT -1 #define SDCARDDETECT -1
//bits in the shift register that carry the buttons for: #endif
// left up center down right red
#define BL_LE 7
#define BL_UP 6
#define BL_MI 5
#define BL_DW 4
#define BL_RI 3
#define BL_ST 2
#define BLEN_B 1
#define BLEN_A 0
#endif
#endif //ULTRA_LCD #endif //ULTRA_LCD
#endif #endif
@ -1122,14 +1031,6 @@
#define BTN_EN1 11 #define BTN_EN1 11
#define BTN_EN2 12 #define BTN_EN2 12
#define BTN_ENC 43 #define BTN_ENC 43
//encoder rotation values
#define BLEN_C 2
#define BLEN_B 1
#define BLEN_A 0
#define encrot0 0
#define encrot1 2
#define encrot2 3
#define encrot3 1
#endif //MOTHERBOARD==80 #endif //MOTHERBOARD==80
@ -1434,12 +1335,12 @@
#define E0_ENABLE_PIN 10 #define E0_ENABLE_PIN 10
/* future proofing */ /* future proofing */
#define __FS 20 #define __FS 20
#define __FD 19 #define __FD 19
#define __GS 18 #define __GS 18
#define __GD 13 #define __GD 13
#define UNUSED_PWM 14 /* PWM on LEFT connector */ #define UNUSED_PWM 14 /* PWM on LEFT connector */
#define E1_STEP_PIN -1 // 21 #define E1_STEP_PIN -1 // 21
#define E1_DIR_PIN -1 // 20 #define E1_DIR_PIN -1 // 20
@ -1468,8 +1369,8 @@
#define HEATER_BED_PIN 4 #define HEATER_BED_PIN 4
#define TEMP_BED_PIN 2 // 1,2 or I2C #define TEMP_BED_PIN 2 // 1,2 or I2C
#define I2C_SCL 16 #define I2C_SCL 16
#define I2C_SDA 17 #define I2C_SDA 17
#endif #endif
@ -1617,7 +1518,7 @@
#define HEATER_BED_PIN 10 // BED #define HEATER_BED_PIN 10 // BED
#define TEMP_BED_PIN 14 // ANALOG NUMBERING #define TEMP_BED_PIN 14 // ANALOG NUMBERING
#define BEEPER 33 // Beeper on AUX-4 #define BEEPER 33 // Beeper on AUX-4
#ifdef ULTRA_LCD #ifdef ULTRA_LCD
@ -1636,18 +1537,8 @@
#define BTN_EN1 59 #define BTN_EN1 59
#define BTN_EN2 64 #define BTN_EN2 64
#define BTN_ENC 43 //the click #define BTN_ENC 43 //the click
#define BLEN_C 2 #define SDCARDDETECT -1 // Ramps does not use this port
#define BLEN_B 1
#define BLEN_A 0
#define SDCARDDETECT -1 // Ramps does not use this port
//encoder rotation values
#define encrot0 0
#define encrot1 2
#define encrot2 3
#define encrot3 1
#endif #endif
#endif //ULTRA_LCD #endif //ULTRA_LCD

View file

@ -76,7 +76,11 @@ static void menu_action_setting_edit_callback_float51(const char* pstr, float* p
static void menu_action_setting_edit_callback_float52(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc); static void menu_action_setting_edit_callback_float52(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc);
static void menu_action_setting_edit_callback_long5(const char* pstr, unsigned long* ptr, unsigned long minValue, unsigned long maxValue, menuFunc_t callbackFunc); static void menu_action_setting_edit_callback_long5(const char* pstr, unsigned long* ptr, unsigned long minValue, unsigned long maxValue, menuFunc_t callbackFunc);
#define ENCODER_STEPS_PER_MENU_ITEM 5 #if !defined(LCD_I2C_VIKI)
#define ENCODER_STEPS_PER_MENU_ITEM 5
#else
#define ENCODER_STEPS_PER_MENU_ITEM 2 // VIKI LCD rotary encoder uses a different number of steps per rotation
#endif
/* Helper macros for menus */ /* Helper macros for menus */
#define START_MENU() do { \ #define START_MENU() do { \
@ -112,15 +116,18 @@ static void menu_action_setting_edit_callback_long5(const char* pstr, unsigned l
} } while(0) } } while(0)
/** Used variables to keep track of the menu */ /** Used variables to keep track of the menu */
#ifndef REPRAPWORLD_KEYPAD
volatile uint8_t buttons;//Contains the bits of the currently pressed buttons. volatile uint8_t buttons;//Contains the bits of the currently pressed buttons.
volatile uint8_t buttons_reprapworld_keypad; // to store the reprapworld_keypad shiftregister values #else
volatile uint16_t buttons;//Contains the bits of the currently pressed buttons (extended).
#endif
uint8_t currentMenuViewOffset; /* scroll offset in the current menu */ uint8_t currentMenuViewOffset; /* scroll offset in the current menu */
uint32_t blocking_enc; uint32_t blocking_enc;
uint8_t lastEncoderBits; uint8_t lastEncoderBits;
int8_t encoderDiff; /* encoderDiff is updated from interrupt context and added to encoderPosition every LCD update */ int8_t encoderDiff; /* encoderDiff is updated from interrupt context and added to encoderPosition every LCD update */
uint32_t encoderPosition; uint32_t encoderPosition;
#if (SDCARDDETECT > -1) #if (SDCARDDETECT > 0)
bool lcd_oldcardstatus; bool lcd_oldcardstatus;
#endif #endif
#endif//ULTIPANEL #endif//ULTIPANEL
@ -222,14 +229,14 @@ static void lcd_main_menu()
}else{ }else{
MENU_ITEM(submenu, MSG_CARD_MENU, lcd_sdcard_menu); MENU_ITEM(submenu, MSG_CARD_MENU, lcd_sdcard_menu);
#if SDCARDDETECT < 1 #if SDCARDDETECT < 1
MENU_ITEM(gcode, MSG_CNG_SDCARD, PSTR("M21")); // SD-card changed by user MENU_ITEM(gcode, MSG_CNG_SDCARD, PSTR("M21")); // SD-card changed by user
#endif #endif
} }
}else{ }else{
MENU_ITEM(submenu, MSG_NO_CARD, lcd_sdcard_menu); MENU_ITEM(submenu, MSG_NO_CARD, lcd_sdcard_menu);
#if SDCARDDETECT < 1 #if SDCARDDETECT < 1
MENU_ITEM(gcode, MSG_INIT_SDCARD, PSTR("M21")); // Manually initialize the SD-card via user interface MENU_ITEM(gcode, MSG_INIT_SDCARD, PSTR("M21")); // Manually initialize the SD-card via user interface
#endif #endif
} }
#endif #endif
END_MENU(); END_MENU();
@ -252,7 +259,7 @@ void lcd_preheat_pla()
setTargetBed(plaPreheatHPBTemp); setTargetBed(plaPreheatHPBTemp);
fanSpeed = plaPreheatFanSpeed; fanSpeed = plaPreheatFanSpeed;
lcd_return_to_status(); lcd_return_to_status();
setWatch(); // heater sanity check timer setWatch(); // heater sanity check timer
} }
void lcd_preheat_abs() void lcd_preheat_abs()
@ -263,16 +270,16 @@ void lcd_preheat_abs()
setTargetBed(absPreheatHPBTemp); setTargetBed(absPreheatHPBTemp);
fanSpeed = absPreheatFanSpeed; fanSpeed = absPreheatFanSpeed;
lcd_return_to_status(); lcd_return_to_status();
setWatch(); // heater sanity check timer setWatch(); // heater sanity check timer
} }
static void lcd_cooldown() static void lcd_cooldown()
{ {
setTargetHotend0(0); setTargetHotend0(0);
setTargetHotend1(0); setTargetHotend1(0);
setTargetHotend2(0); setTargetHotend2(0);
setTargetBed(0); setTargetBed(0);
lcd_return_to_status(); lcd_return_to_status();
} }
static void lcd_tune_menu() static void lcd_tune_menu()
@ -471,10 +478,10 @@ static void lcd_control_menu()
static void lcd_control_temperature_menu() static void lcd_control_temperature_menu()
{ {
// set up temp variables - undo the default scaling // set up temp variables - undo the default scaling
raw_Ki = unscalePID_i(Ki); raw_Ki = unscalePID_i(Ki);
raw_Kd = unscalePID_d(Kd); raw_Kd = unscalePID_d(Kd);
START_MENU(); START_MENU();
MENU_ITEM(back, MSG_CONTROL, lcd_control_menu); MENU_ITEM(back, MSG_CONTROL, lcd_control_menu);
MENU_ITEM_EDIT(int3, MSG_NOZZLE, &target_temperature[0], 0, HEATER_0_MAXTEMP - 15); MENU_ITEM_EDIT(int3, MSG_NOZZLE, &target_temperature[0], 0, HEATER_0_MAXTEMP - 15);
@ -496,7 +503,7 @@ static void lcd_control_temperature_menu()
#endif #endif
#ifdef PIDTEMP #ifdef PIDTEMP
MENU_ITEM_EDIT(float52, MSG_PID_P, &Kp, 1, 9990); MENU_ITEM_EDIT(float52, MSG_PID_P, &Kp, 1, 9990);
// i is typically a small value so allows values below 1 // i is typically a small value so allows values below 1
MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_I, &raw_Ki, 0.01, 9990, copy_and_scalePID_i); MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_I, &raw_Ki, 0.01, 9990, copy_and_scalePID_i);
MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D, &raw_Kd, 1, 9990, copy_and_scalePID_d); MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D, &raw_Kd, 1, 9990, copy_and_scalePID_d);
# ifdef PID_ADD_EXTRUSION_RATE # ifdef PID_ADD_EXTRUSION_RATE
@ -700,21 +707,21 @@ menu_edit_type(float, float52, ftostr52, 100)
menu_edit_type(unsigned long, long5, ftostr5, 0.01) menu_edit_type(unsigned long, long5, ftostr5, 0.01)
#ifdef REPRAPWORLD_KEYPAD #ifdef REPRAPWORLD_KEYPAD
static void reprapworld_keypad_move_y_down() { static void reprapworld_keypad_move_y_down() {
encoderPosition = 1; encoderPosition = 1;
move_menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP; move_menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP;
lcd_move_y(); lcd_move_y();
} }
static void reprapworld_keypad_move_y_up() { static void reprapworld_keypad_move_y_up() {
encoderPosition = -1; encoderPosition = -1;
move_menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP; move_menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP;
lcd_move_y(); lcd_move_y();
} }
static void reprapworld_keypad_move_home() { static void reprapworld_keypad_move_home() {
//enquecommand_P((PSTR("G28"))); // move all axis home //enquecommand_P((PSTR("G28"))); // move all axis home
// TODO gregor: move all axis home, i have currently only one axis on my prusa i3 // TODO gregor: move all axis home, i have currently only one axis on my prusa i3
enquecommand_P((PSTR("G28 Y"))); enquecommand_P((PSTR("G28 Y")));
} }
#endif #endif
/** End of menus **/ /** End of menus **/
@ -775,18 +782,20 @@ void lcd_init()
#ifdef NEWPANEL #ifdef NEWPANEL
pinMode(BTN_EN1,INPUT); pinMode(BTN_EN1,INPUT);
pinMode(BTN_EN2,INPUT); pinMode(BTN_EN2,INPUT);
pinMode(BTN_ENC,INPUT);
pinMode(SDCARDDETECT,INPUT); pinMode(SDCARDDETECT,INPUT);
WRITE(BTN_EN1,HIGH); WRITE(BTN_EN1,HIGH);
WRITE(BTN_EN2,HIGH); WRITE(BTN_EN2,HIGH);
#if BTN_ENC > 0
pinMode(BTN_ENC,INPUT);
WRITE(BTN_ENC,HIGH); WRITE(BTN_ENC,HIGH);
#ifdef REPRAPWORLD_KEYPAD #endif
pinMode(SHIFT_CLK,OUTPUT); #ifdef REPRAPWORLD_KEYPAD
pinMode(SHIFT_LD,OUTPUT); pinMode(SHIFT_CLK,OUTPUT);
pinMode(SHIFT_OUT,INPUT); pinMode(SHIFT_LD,OUTPUT);
WRITE(SHIFT_OUT,HIGH); pinMode(SHIFT_OUT,INPUT);
WRITE(SHIFT_LD,HIGH); WRITE(SHIFT_OUT,HIGH);
#endif WRITE(SHIFT_LD,HIGH);
#endif
#else #else
pinMode(SHIFT_CLK,OUTPUT); pinMode(SHIFT_CLK,OUTPUT);
pinMode(SHIFT_LD,OUTPUT); pinMode(SHIFT_LD,OUTPUT);
@ -796,12 +805,14 @@ void lcd_init()
WRITE(SHIFT_LD,HIGH); WRITE(SHIFT_LD,HIGH);
WRITE(SHIFT_EN,LOW); WRITE(SHIFT_EN,LOW);
#endif//!NEWPANEL #endif//!NEWPANEL
#if (SDCARDDETECT > -1) #if (SDCARDDETECT > 0)
WRITE(SDCARDDETECT, HIGH); WRITE(SDCARDDETECT, HIGH);
lcd_oldcardstatus = IS_SD_INSERTED; lcd_oldcardstatus = IS_SD_INSERTED;
#endif//(SDCARDDETECT > -1) #endif//(SDCARDDETECT > 0)
lcd_buttons_update(); lcd_buttons_update();
#ifdef ULTIPANEL
encoderDiff = 0; encoderDiff = 0;
#endif
} }
void lcd_update() void lcd_update()
@ -810,7 +821,11 @@ void lcd_update()
lcd_buttons_update(); lcd_buttons_update();
#if (SDCARDDETECT > -1) #ifdef LCD_HAS_SLOW_BUTTONS
buttons |= lcd_implementation_read_slow_buttons(); // buttons which take too long to read in interrupt context
#endif
#if (SDCARDDETECT > 0)
if((IS_SD_INSERTED != lcd_oldcardstatus)) if((IS_SD_INSERTED != lcd_oldcardstatus))
{ {
lcdDrawUpdate = 2; lcdDrawUpdate = 2;
@ -833,17 +848,17 @@ void lcd_update()
if (lcd_next_update_millis < millis()) if (lcd_next_update_millis < millis())
{ {
#ifdef ULTIPANEL #ifdef ULTIPANEL
#ifdef REPRAPWORLD_KEYPAD #ifdef REPRAPWORLD_KEYPAD
if (REPRAPWORLD_KEYPAD_MOVE_Y_DOWN) { if (REPRAPWORLD_KEYPAD_MOVE_Y_DOWN) {
reprapworld_keypad_move_y_down(); reprapworld_keypad_move_y_down();
} }
if (REPRAPWORLD_KEYPAD_MOVE_Y_UP) { if (REPRAPWORLD_KEYPAD_MOVE_Y_UP) {
reprapworld_keypad_move_y_up(); reprapworld_keypad_move_y_up();
} }
if (REPRAPWORLD_KEYPAD_MOVE_HOME) { if (REPRAPWORLD_KEYPAD_MOVE_HOME) {
reprapworld_keypad_move_home(); reprapworld_keypad_move_home();
} }
#endif #endif
if (encoderDiff) if (encoderDiff)
{ {
lcdDrawUpdate = 1; lcdDrawUpdate = 1;
@ -856,21 +871,26 @@ void lcd_update()
#endif//ULTIPANEL #endif//ULTIPANEL
#ifdef DOGLCD // Changes due to different driver architecture of the DOGM display #ifdef DOGLCD // Changes due to different driver architecture of the DOGM display
blink++; // Variable for fan animation and alive dot blink++; // Variable for fan animation and alive dot
u8g.firstPage(); u8g.firstPage();
do { do
u8g.setFont(u8g_font_6x10_marlin); {
u8g.setPrintPos(125,0); u8g.setFont(u8g_font_6x10_marlin);
if (blink % 2) u8g.setColorIndex(1); else u8g.setColorIndex(0); // Set color for the alive dot u8g.setPrintPos(125,0);
u8g.drawPixel(127,63); // draw alive dot if (blink % 2) u8g.setColorIndex(1); else u8g.setColorIndex(0); // Set color for the alive dot
u8g.setColorIndex(1); // black on white u8g.drawPixel(127,63); // draw alive dot
(*currentMenu)(); u8g.setColorIndex(1); // black on white
if (!lcdDrawUpdate) break; // Terminate display update, when nothing new to draw. This must be done before the last dogm.next() (*currentMenu)();
} while( u8g.nextPage() ); if (!lcdDrawUpdate) break; // Terminate display update, when nothing new to draw. This must be done before the last dogm.next()
} while( u8g.nextPage() );
#else #else
(*currentMenu)(); (*currentMenu)();
#endif #endif
#ifdef LCD_HAS_STATUS_INDICATORS
lcd_implementation_update_indicators();
#endif
#ifdef ULTIPANEL #ifdef ULTIPANEL
if(timeoutToStatus < millis() && currentMenu != lcd_status_screen) if(timeoutToStatus < millis() && currentMenu != lcd_status_screen)
{ {
@ -921,23 +941,25 @@ void lcd_buttons_update()
uint8_t newbutton=0; uint8_t newbutton=0;
if(READ(BTN_EN1)==0) newbutton|=EN_A; if(READ(BTN_EN1)==0) newbutton|=EN_A;
if(READ(BTN_EN2)==0) newbutton|=EN_B; if(READ(BTN_EN2)==0) newbutton|=EN_B;
#if BTN_ENC > 0
if((blocking_enc<millis()) && (READ(BTN_ENC)==0)) if((blocking_enc<millis()) && (READ(BTN_ENC)==0))
newbutton |= EN_C; newbutton |= EN_C;
#endif
#ifdef REPRAPWORLD_KEYPAD
// for the reprapworld_keypad
uint8_t newbutton_reprapworld_keypad=0;
WRITE(SHIFT_LD,LOW);
WRITE(SHIFT_LD,HIGH);
for(int8_t i=0;i<8;i++) {
newbutton_reprapworld_keypad = newbutton_reprapworld_keypad>>1;
if(READ(SHIFT_OUT))
newbutton_reprapworld_keypad|=(1<<7);
WRITE(SHIFT_CLK,HIGH);
WRITE(SHIFT_CLK,LOW);
}
newbutton |= ((~newbutton_reprapworld_keypad) << REPRAPWORLD_BTN_OFFSET); //invert it, because a pressed switch produces a logical 0
#endif
buttons = newbutton; buttons = newbutton;
#ifdef REPRAPWORLD_KEYPAD
// for the reprapworld_keypad
uint8_t newbutton_reprapworld_keypad=0;
WRITE(SHIFT_LD,LOW);
WRITE(SHIFT_LD,HIGH);
for(int8_t i=0;i<8;i++) {
newbutton_reprapworld_keypad = newbutton_reprapworld_keypad>>1;
if(READ(SHIFT_OUT))
newbutton_reprapworld_keypad|=(1<<7);
WRITE(SHIFT_CLK,HIGH);
WRITE(SHIFT_CLK,LOW);
}
buttons_reprapworld_keypad=~newbutton_reprapworld_keypad; //invert it, because a pressed switch produces a logical 0
#endif
#else //read it from the shift register #else //read it from the shift register
uint8_t newbutton=0; uint8_t newbutton=0;
WRITE(SHIFT_LD,LOW); WRITE(SHIFT_LD,LOW);
@ -992,6 +1014,18 @@ void lcd_buttons_update()
} }
lastEncoderBits = enc; lastEncoderBits = enc;
} }
void lcd_buzz(long duration, uint16_t freq)
{
#ifdef LCD_USE_I2C_BUZZER
lcd.buzz(duration,freq);
#endif
}
bool lcd_clicked()
{
return LCD_CLICKED;
}
#endif//ULTIPANEL #endif//ULTIPANEL
/********************************/ /********************************/
@ -1193,7 +1227,7 @@ void copy_and_scalePID_i()
{ {
Ki = scalePID_i(raw_Ki); Ki = scalePID_i(raw_Ki);
updatePID(); updatePID();
} }
// Callback for after editing PID d value // Callback for after editing PID d value
// grab the pid d value out of the temp variable; scale it; then update the PID driver // grab the pid d value out of the temp variable; scale it; then update the PID driver
@ -1201,6 +1235,6 @@ void copy_and_scalePID_d()
{ {
Kd = scalePID_d(raw_Kd); Kd = scalePID_d(raw_Kd);
updatePID(); updatePID();
} }
#endif //ULTRA_LCD #endif //ULTRA_LCD

View file

@ -22,10 +22,6 @@
#ifdef ULTIPANEL #ifdef ULTIPANEL
void lcd_buttons_update(); void lcd_buttons_update();
extern volatile uint8_t buttons; //the last checked buttons in a bit array.
#ifdef REPRAPWORLD_KEYPAD
extern volatile uint8_t buttons_reprapworld_keypad; // to store the keypad shiftregister values
#endif
#else #else
FORCE_INLINE void lcd_buttons_update() {} FORCE_INLINE void lcd_buttons_update() {}
#endif #endif
@ -38,40 +34,8 @@
extern int absPreheatHPBTemp; extern int absPreheatHPBTemp;
extern int absPreheatFanSpeed; extern int absPreheatFanSpeed;
#ifdef NEWPANEL void lcd_buzz(long duration,uint16_t freq);
#define EN_C (1<<BLEN_C) bool lcd_clicked();
#define EN_B (1<<BLEN_B)
#define EN_A (1<<BLEN_A)
#define LCD_CLICKED (buttons&EN_C)
#ifdef REPRAPWORLD_KEYPAD
#define EN_REPRAPWORLD_KEYPAD_F3 (1<<BLEN_REPRAPWORLD_KEYPAD_F3)
#define EN_REPRAPWORLD_KEYPAD_F2 (1<<BLEN_REPRAPWORLD_KEYPAD_F2)
#define EN_REPRAPWORLD_KEYPAD_F1 (1<<BLEN_REPRAPWORLD_KEYPAD_F1)
#define EN_REPRAPWORLD_KEYPAD_UP (1<<BLEN_REPRAPWORLD_KEYPAD_UP)
#define EN_REPRAPWORLD_KEYPAD_RIGHT (1<<BLEN_REPRAPWORLD_KEYPAD_RIGHT)
#define EN_REPRAPWORLD_KEYPAD_MIDDLE (1<<BLEN_REPRAPWORLD_KEYPAD_MIDDLE)
#define EN_REPRAPWORLD_KEYPAD_DOWN (1<<BLEN_REPRAPWORLD_KEYPAD_DOWN)
#define EN_REPRAPWORLD_KEYPAD_LEFT (1<<BLEN_REPRAPWORLD_KEYPAD_LEFT)
#define LCD_CLICKED ((buttons&EN_C) || (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_F1))
#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
//atomatic, do not change
#define B_LE (1<<BL_LE)
#define B_UP (1<<BL_UP)
#define B_MI (1<<BL_MI)
#define B_DW (1<<BL_DW)
#define B_RI (1<<BL_RI)
#define B_ST (1<<BL_ST)
#define EN_B (1<<BLEN_B)
#define EN_A (1<<BLEN_A)
#define LCD_CLICKED ((buttons&B_MI)||(buttons&B_ST))
#endif//NEWPANEL
#else //no lcd #else //no lcd
FORCE_INLINE void lcd_update() {} FORCE_INLINE void lcd_update() {}
@ -79,6 +43,7 @@
FORCE_INLINE void lcd_setstatus(const char* message) {} FORCE_INLINE void lcd_setstatus(const char* message) {}
FORCE_INLINE void lcd_buttons_update() {} FORCE_INLINE void lcd_buttons_update() {}
FORCE_INLINE void lcd_reset_alert_level() {} FORCE_INLINE void lcd_reset_alert_level() {}
FORCE_INLINE void lcd_buzz(long duration,uint16_t freq) {}
#define LCD_MESSAGEPGM(x) #define LCD_MESSAGEPGM(x)
#define LCD_ALERTMESSAGEPGM(x) #define LCD_ALERTMESSAGEPGM(x)

View file

@ -1,515 +1,748 @@
#ifndef ULTRA_LCD_IMPLEMENTATION_HITACHI_HD44780_H #ifndef ULTRA_LCD_IMPLEMENTATION_HITACHI_HD44780_H
#define ULTRA_LCD_IMPLEMENTATION_HITACHI_HD44780_H #define ULTRA_LCD_IMPLEMENTATION_HITACHI_HD44780_H
/** /**
* Implementation of the LCD display routines for a hitachi HD44780 display. These are common LCD character displays. * Implementation of the LCD display routines for a hitachi HD44780 display. These are common LCD character displays.
* When selecting the rusian language, a slightly different LCD implementation is used to handle UTF8 characters. * When selecting the rusian language, a slightly different LCD implementation is used to handle UTF8 characters.
**/ **/
#if LANGUAGE_CHOICE == 6 #ifndef REPRAPWORLD_KEYPAD
#include "LiquidCrystalRus.h" extern volatile uint8_t buttons; //the last checked buttons in a bit array.
#define LCD_CLASS LiquidCrystalRus #else
#else extern volatile uint16_t buttons; //an extended version of the last checked buttons in a bit array.
#include <LiquidCrystal.h> #endif
#define LCD_CLASS LiquidCrystal
#endif ////////////////////////////////////
// Setup button and encode mappings for each panel (into 'buttons' variable)
/* Custom characters defined in the first 8 characters of the LCD */ //
#define LCD_STR_BEDTEMP "\x00" // This is just to map common functions (across different panels) onto the same
#define LCD_STR_DEGREE "\x01" // macro name. The mapping is independent of whether the button is directly connected or
#define LCD_STR_THERMOMETER "\x02" // via a shift/i2c register.
#define LCD_STR_UPLEVEL "\x03"
#define LCD_STR_REFRESH "\x04" #ifdef ULTIPANEL
#define LCD_STR_FOLDER "\x05" // All Ultipanels might have an encoder - so this is always be mapped onto first two bits
#define LCD_STR_FEEDRATE "\x06" #define BLEN_B 1
#define LCD_STR_CLOCK "\x07" #define BLEN_A 0
#define LCD_STR_ARROW_RIGHT "\x7E" /* from the default character set */
#define EN_B (1<<BLEN_B) // The two encoder pins are connected through BTN_EN1 and BTN_EN2
LCD_CLASS lcd(LCD_PINS_RS, LCD_PINS_ENABLE, LCD_PINS_D4, LCD_PINS_D5,LCD_PINS_D6,LCD_PINS_D7); //RS,Enable,D4,D5,D6,D7 #define EN_A (1<<BLEN_A)
static void lcd_implementation_init()
{ #if defined(BTN_ENC) && BTN_ENC > -1
byte bedTemp[8] = // encoder click is directly connected
{ #define BLEN_C 2
B00000, #define EN_C (1<<BLEN_C)
B11111, #endif
B10101,
B10001, //
B10101, // Setup other button mappings of each panel
B11111, //
B00000, #if defined(LCD_I2C_VIKI)
B00000 #define B_I2C_BTN_OFFSET 3 // (the first three bit positions reserved for EN_A, EN_B, EN_C)
}; //thanks Sonny Mounicou
byte degree[8] = // button and encoder bit positions within 'buttons'
{ #define B_LE (BUTTON_LEFT<<B_I2C_BTN_OFFSET) // The remaining normalized buttons are all read via I2C
B01100, #define B_UP (BUTTON_UP<<B_I2C_BTN_OFFSET)
B10010, #define B_MI (BUTTON_SELECT<<B_I2C_BTN_OFFSET)
B10010, #define B_DW (BUTTON_DOWN<<B_I2C_BTN_OFFSET)
B01100, #define B_RI (BUTTON_RIGHT<<B_I2C_BTN_OFFSET)
B00000,
B00000, #if defined(BTN_ENC) && BTN_ENC > -1
B00000, // the pause/stop/restart button is connected to BTN_ENC when used
B00000 #define B_ST (EN_C) // Map the pause/stop/resume button into its normalized functional name
}; #define LCD_CLICKED (buttons&(B_MI|B_RI|B_ST)) // pause/stop button also acts as click until we implement proper pause/stop.
byte thermometer[8] = #else
{ #define LCD_CLICKED (buttons&(B_MI|B_RI))
B00100, #endif
B01010,
B01010, // I2C buttons take too long to read inside an interrupt context and so we read them during lcd_update
B01010, #define LCD_HAS_SLOW_BUTTONS
B01010,
B10001, #elif defined(LCD_I2C_PANELOLU2)
B10001, // encoder click can be read through I2C if not directly connected
B01110 #if BTN_ENC <= 0
}; #define B_I2C_BTN_OFFSET 3 // (the first three bit positions reserved for EN_A, EN_B, EN_C)
byte uplevel[8]={
B00100, #define B_MI (PANELOLU2_ENCODER_C<<B_I2C_BTN_OFFSET) // requires LiquidTWI2 library v1.2.3 or later
B01110,
B11111, #define LCD_CLICKED (buttons&B_MI)
B00100,
B11100, // I2C buttons take too long to read inside an interrupt context and so we read them during lcd_update
B00000, #define LCD_HAS_SLOW_BUTTONS
B00000, #else
B00000 #define LCD_CLICKED (buttons&EN_C)
}; //thanks joris #endif
byte refresh[8]={
B00000, #elif defined(REPRAPWORLD_KEYPAD)
B00110, // define register bit values, don't change it
B11001, #define BLEN_REPRAPWORLD_KEYPAD_F3 0
B11000, #define BLEN_REPRAPWORLD_KEYPAD_F2 1
B00011, #define BLEN_REPRAPWORLD_KEYPAD_F1 2
B10011, #define BLEN_REPRAPWORLD_KEYPAD_UP 3
B01100, #define BLEN_REPRAPWORLD_KEYPAD_RIGHT 4
B00000, #define BLEN_REPRAPWORLD_KEYPAD_MIDDLE 5
}; //thanks joris #define BLEN_REPRAPWORLD_KEYPAD_DOWN 6
byte folder [8]={ #define BLEN_REPRAPWORLD_KEYPAD_LEFT 7
B00000,
B11100, #define REPRAPWORLD_BTN_OFFSET 3 // bit offset into buttons for shift register values
B11111,
B10001, #define EN_REPRAPWORLD_KEYPAD_F3 (1<<(BLEN_REPRAPWORLD_KEYPAD_F3+REPRAPWORLD_BTN_OFFSET))
B10001, #define EN_REPRAPWORLD_KEYPAD_F2 (1<<(BLEN_REPRAPWORLD_KEYPAD_F2+REPRAPWORLD_BTN_OFFSET))
B11111, #define EN_REPRAPWORLD_KEYPAD_F1 (1<<(BLEN_REPRAPWORLD_KEYPAD_F1+REPRAPWORLD_BTN_OFFSET))
B00000, #define EN_REPRAPWORLD_KEYPAD_UP (1<<(BLEN_REPRAPWORLD_KEYPAD_UP+REPRAPWORLD_BTN_OFFSET))
B00000 #define EN_REPRAPWORLD_KEYPAD_RIGHT (1<<(BLEN_REPRAPWORLD_KEYPAD_RIGHT+REPRAPWORLD_BTN_OFFSET))
}; //thanks joris #define EN_REPRAPWORLD_KEYPAD_MIDDLE (1<<(BLEN_REPRAPWORLD_KEYPAD_MIDDLE+REPRAPWORLD_BTN_OFFSET))
byte feedrate [8]={ #define EN_REPRAPWORLD_KEYPAD_DOWN (1<<(BLEN_REPRAPWORLD_KEYPAD_DOWN+REPRAPWORLD_BTN_OFFSET))
B11100, #define EN_REPRAPWORLD_KEYPAD_LEFT (1<<(BLEN_REPRAPWORLD_KEYPAD_LEFT+REPRAPWORLD_BTN_OFFSET))
B10000,
B11000, #define LCD_CLICKED ((buttons&EN_C) || (buttons&EN_REPRAPWORLD_KEYPAD_F1))
B10111, #define REPRAPWORLD_KEYPAD_MOVE_Y_DOWN (buttons&EN_REPRAPWORLD_KEYPAD_DOWN)
B00101, #define REPRAPWORLD_KEYPAD_MOVE_Y_UP (buttons&EN_REPRAPWORLD_KEYPAD_UP)
B00110, #define REPRAPWORLD_KEYPAD_MOVE_HOME (buttons&EN_REPRAPWORLD_KEYPAD_MIDDLE)
B00101,
B00000 #elif defined(NEWPANEL)
}; //thanks Sonny Mounicou #define LCD_CLICKED (buttons&EN_C)
byte clock [8]={
B00000, #else // old style ULTIPANEL
B01110, //bits in the shift register that carry the buttons for:
B10011, // left up center down right red(stop)
B10101, #define BL_LE 7
B10001, #define BL_UP 6
B01110, #define BL_MI 5
B00000, #define BL_DW 4
B00000 #define BL_RI 3
}; //thanks Sonny Mounicou #define BL_ST 2
lcd.begin(LCD_WIDTH, LCD_HEIGHT);
lcd.createChar(LCD_STR_BEDTEMP[0], bedTemp); //automatic, do not change
lcd.createChar(LCD_STR_DEGREE[0], degree); #define B_LE (1<<BL_LE)
lcd.createChar(LCD_STR_THERMOMETER[0], thermometer); #define B_UP (1<<BL_UP)
lcd.createChar(LCD_STR_UPLEVEL[0], uplevel); #define B_MI (1<<BL_MI)
lcd.createChar(LCD_STR_REFRESH[0], refresh); #define B_DW (1<<BL_DW)
lcd.createChar(LCD_STR_FOLDER[0], folder); #define B_RI (1<<BL_RI)
lcd.createChar(LCD_STR_FEEDRATE[0], feedrate); #define B_ST (1<<BL_ST)
lcd.createChar(LCD_STR_CLOCK[0], clock);
lcd.clear(); #define LCD_CLICKED (buttons&(B_MI|B_ST))
} #endif
static void lcd_implementation_clear()
{ ////////////////////////
lcd.clear(); // Setup Rotary Encoder Bit Values (for two pin encoders to indicate movement)
} // These values are independent of which pins are used for EN_A and EN_B indications
/* Arduino < 1.0.0 is missing a function to print PROGMEM strings, so we need to implement our own */ // The rotary encoder part is also independent to the chipset used for the LCD
static void lcd_printPGM(const char* str) #if defined(EN_A) && defined(EN_B)
{ #ifndef ULTIMAKERCONTROLLER
char c; #define encrot0 0
while((c = pgm_read_byte(str++)) != '\0') #define encrot1 2
{ #define encrot2 3
lcd.write(c); #define encrot3 1
} #else
} #define encrot0 0
/* #define encrot1 1
Possible status screens: #define encrot2 3
16x2 |0123456789012345| #define encrot3 2
|000/000 B000/000| #endif
|Status line.....| #endif
16x4 |0123456789012345| #endif //ULTIPANEL
|000/000 B000/000|
|SD100% Z000.0| ////////////////////////////////////
|F100% T--:--| // Create LCD class instance and chipset-specific information
|Status line.....| #if defined(LCD_I2C_TYPE_PCF8575)
// note: these are register mapped pins on the PCF8575 controller not Arduino pins
20x2 |01234567890123456789| #define LCD_I2C_PIN_BL 3
|T000/000D B000/000D | #define LCD_I2C_PIN_EN 2
|Status line.........| #define LCD_I2C_PIN_RW 1
#define LCD_I2C_PIN_RS 0
20x4 |01234567890123456789| #define LCD_I2C_PIN_D4 4
|T000/000D B000/000D | #define LCD_I2C_PIN_D5 5
|X+000.0 Y+000.0 Z+000.0| #define LCD_I2C_PIN_D6 6
|F100% SD100% T--:--| #define LCD_I2C_PIN_D7 7
|Status line.........|
#include <Wire.h>
20x4 |01234567890123456789| #include <LCD.h>
|T000/000D B000/000D | #include <LiquidCrystal_I2C.h>
|T000/000D Z000.0| #define LCD_CLASS LiquidCrystal_I2C
|F100% SD100% T--:--| LCD_CLASS lcd(LCD_I2C_ADDRESS,LCD_I2C_PIN_EN,LCD_I2C_PIN_RW,LCD_I2C_PIN_RS,LCD_I2C_PIN_D4,LCD_I2C_PIN_D5,LCD_I2C_PIN_D6,LCD_I2C_PIN_D7);
|Status line.........|
*/ #elif defined(LCD_I2C_TYPE_MCP23017)
static void lcd_implementation_status_screen() //for the LED indicators (which maybe mapped to different things in lcd_implementation_update_indicators())
{ #define LED_A 0x04 //100
int tHotend=int(degHotend(0) + 0.5); #define LED_B 0x02 //010
int tTarget=int(degTargetHotend(0) + 0.5); #define LED_C 0x01 //001
#if LCD_WIDTH < 20 #define LCD_HAS_STATUS_INDICATORS
lcd.setCursor(0, 0);
lcd.print(itostr3(tHotend)); #include <Wire.h>
lcd.print('/'); #include <LiquidTWI2.h>
lcd.print(itostr3left(tTarget)); #define LCD_CLASS LiquidTWI2
LCD_CLASS lcd(LCD_I2C_ADDRESS);
# if EXTRUDERS > 1 || TEMP_SENSOR_BED != 0
//If we have an 2nd extruder or heated bed, show that in the top right corner #elif defined(LCD_I2C_TYPE_MCP23008)
lcd.setCursor(8, 0); #include <Wire.h>
# if EXTRUDERS > 1 #include <LiquidTWI2.h>
tHotend = int(degHotend(1) + 0.5); #define LCD_CLASS LiquidTWI2
tTarget = int(degTargetHotend(1) + 0.5); LCD_CLASS lcd(LCD_I2C_ADDRESS);
lcd.print(LCD_STR_THERMOMETER[0]);
# else//Heated bed #else
tHotend=int(degBed() + 0.5); // Standard directly connected LCD implementations
tTarget=int(degTargetBed() + 0.5); #if LANGUAGE_CHOICE == 6
lcd.print(LCD_STR_BEDTEMP[0]); #include "LiquidCrystalRus.h"
# endif #define LCD_CLASS LiquidCrystalRus
lcd.print(itostr3(tHotend)); #else
lcd.print('/'); #include <LiquidCrystal.h>
lcd.print(itostr3left(tTarget)); #define LCD_CLASS LiquidCrystal
# endif//EXTRUDERS > 1 || TEMP_SENSOR_BED != 0 #endif
LCD_CLASS lcd(LCD_PINS_RS, LCD_PINS_ENABLE, LCD_PINS_D4, LCD_PINS_D5,LCD_PINS_D6,LCD_PINS_D7); //RS,Enable,D4,D5,D6,D7
#else//LCD_WIDTH > 19 #endif
lcd.setCursor(0, 0);
lcd.print(LCD_STR_THERMOMETER[0]); /* Custom characters defined in the first 8 characters of the LCD */
lcd.print(itostr3(tHotend)); #define LCD_STR_BEDTEMP "\x00"
lcd.print('/'); #define LCD_STR_DEGREE "\x01"
lcd.print(itostr3left(tTarget)); #define LCD_STR_THERMOMETER "\x02"
lcd_printPGM(PSTR(LCD_STR_DEGREE " ")); #define LCD_STR_UPLEVEL "\x03"
if (tTarget < 10) #define LCD_STR_REFRESH "\x04"
lcd.print(' '); #define LCD_STR_FOLDER "\x05"
#define LCD_STR_FEEDRATE "\x06"
# if EXTRUDERS > 1 || TEMP_SENSOR_BED != 0 #define LCD_STR_CLOCK "\x07"
//If we have an 2nd extruder or heated bed, show that in the top right corner #define LCD_STR_ARROW_RIGHT "\x7E" /* from the default character set */
lcd.setCursor(10, 0);
# if EXTRUDERS > 1 static void lcd_implementation_init()
tHotend = int(degHotend(1) + 0.5); {
tTarget = int(degTargetHotend(1) + 0.5); byte bedTemp[8] =
lcd.print(LCD_STR_THERMOMETER[0]); {
# else//Heated bed B00000,
tHotend=int(degBed() + 0.5); B11111,
tTarget=int(degTargetBed() + 0.5); B10101,
lcd.print(LCD_STR_BEDTEMP[0]); B10001,
# endif B10101,
lcd.print(itostr3(tHotend)); B11111,
lcd.print('/'); B00000,
lcd.print(itostr3left(tTarget)); B00000
lcd_printPGM(PSTR(LCD_STR_DEGREE " ")); }; //thanks Sonny Mounicou
if (tTarget < 10) byte degree[8] =
lcd.print(' '); {
# endif//EXTRUDERS > 1 || TEMP_SENSOR_BED != 0 B01100,
#endif//LCD_WIDTH > 19 B10010,
B10010,
#if LCD_HEIGHT > 2 B01100,
//Lines 2 for 4 line LCD B00000,
# if LCD_WIDTH < 20 B00000,
# ifdef SDSUPPORT B00000,
lcd.setCursor(0, 2); B00000
lcd_printPGM(PSTR("SD")); };
if (IS_SD_PRINTING) byte thermometer[8] =
lcd.print(itostr3(card.percentDone())); {
else B00100,
lcd_printPGM(PSTR("---")); B01010,
lcd.print('%'); B01010,
# endif//SDSUPPORT B01010,
# else//LCD_WIDTH > 19 B01010,
# if EXTRUDERS > 1 && TEMP_SENSOR_BED != 0 B10001,
//If we both have a 2nd extruder and a heated bed, show the heated bed temp on the 2nd line on the left, as the first line is filled with extruder temps B10001,
tHotend=int(degBed() + 0.5); B01110
tTarget=int(degTargetBed() + 0.5); };
byte uplevel[8]={
lcd.setCursor(0, 1); B00100,
lcd.print(LCD_STR_BEDTEMP[0]); B01110,
lcd.print(itostr3(tHotend)); B11111,
lcd.print('/'); B00100,
lcd.print(itostr3left(tTarget)); B11100,
lcd_printPGM(PSTR(LCD_STR_DEGREE " ")); B00000,
if (tTarget < 10) B00000,
lcd.print(' '); B00000
# else }; //thanks joris
lcd.setCursor(0,1); byte refresh[8]={
lcd.print('X'); B00000,
lcd.print(ftostr3(current_position[X_AXIS])); B00110,
lcd_printPGM(PSTR(" Y")); B11001,
lcd.print(ftostr3(current_position[Y_AXIS])); B11000,
# endif//EXTRUDERS > 1 || TEMP_SENSOR_BED != 0 B00011,
# endif//LCD_WIDTH > 19 B10011,
lcd.setCursor(LCD_WIDTH - 8, 1); B01100,
lcd.print('Z'); B00000,
lcd.print(ftostr32(current_position[Z_AXIS])); }; //thanks joris
#endif//LCD_HEIGHT > 2 byte folder [8]={
B00000,
#if LCD_HEIGHT > 3 B11100,
lcd.setCursor(0, 2); B11111,
lcd.print(LCD_STR_FEEDRATE[0]); B10001,
lcd.print(itostr3(feedmultiply)); B10001,
lcd.print('%'); B11111,
# if LCD_WIDTH > 19 B00000,
# ifdef SDSUPPORT B00000
lcd.setCursor(7, 2); }; //thanks joris
lcd_printPGM(PSTR("SD")); byte feedrate [8]={
if (IS_SD_PRINTING) B11100,
lcd.print(itostr3(card.percentDone())); B10000,
else B11000,
lcd_printPGM(PSTR("---")); B10111,
lcd.print('%'); B00101,
# endif//SDSUPPORT B00110,
# endif//LCD_WIDTH > 19 B00101,
lcd.setCursor(LCD_WIDTH - 6, 2); B00000
lcd.print(LCD_STR_CLOCK[0]); }; //thanks Sonny Mounicou
if(starttime != 0) byte clock [8]={
{ B00000,
uint16_t time = millis()/60000 - starttime/60000; B01110,
lcd.print(itostr2(time/60)); B10011,
lcd.print(':'); B10101,
lcd.print(itostr2(time%60)); B10001,
}else{ B01110,
lcd_printPGM(PSTR("--:--")); B00000,
} B00000
#endif }; //thanks Sonny Mounicou
//Status message line on the last line #if defined(LCDI2C_TYPE_PCF8575)
lcd.setCursor(0, LCD_HEIGHT - 1); lcd.begin(LCD_WIDTH, LCD_HEIGHT);
lcd.print(lcd_status_message); #ifdef LCD_I2C_PIN_BL
} lcd.setBacklightPin(LCD_I2C_PIN_BL,POSITIVE);
static void lcd_implementation_drawmenu_generic(uint8_t row, const char* pstr, char pre_char, char post_char) lcd.setBacklight(HIGH);
{ #endif
char c;
//Use all characters in narrow LCDs #elif defined(LCD_I2C_TYPE_MCP23017)
#if LCD_WIDTH < 20 lcd.setMCPType(LTI_TYPE_MCP23017);
uint8_t n = LCD_WIDTH - 1 - 1; lcd.begin(LCD_WIDTH, LCD_HEIGHT);
#else lcd.setBacklight(0); //set all the LEDs off to begin with
uint8_t n = LCD_WIDTH - 1 - 2;
#endif #elif defined(LCD_I2C_TYPE_MCP23008)
lcd.setCursor(0, row); lcd.setMCPType(LTI_TYPE_MCP23008);
lcd.print(pre_char); lcd.begin(LCD_WIDTH, LCD_HEIGHT);
while((c = pgm_read_byte(pstr)) != '\0')
{ #else
lcd.print(c); lcd.begin(LCD_WIDTH, LCD_HEIGHT);
pstr++; #endif
n--;
} lcd.createChar(LCD_STR_BEDTEMP[0], bedTemp);
while(n--) lcd.createChar(LCD_STR_DEGREE[0], degree);
lcd.print(' '); lcd.createChar(LCD_STR_THERMOMETER[0], thermometer);
lcd.print(post_char); lcd.createChar(LCD_STR_UPLEVEL[0], uplevel);
lcd.print(' '); lcd.createChar(LCD_STR_REFRESH[0], refresh);
} lcd.createChar(LCD_STR_FOLDER[0], folder);
static void lcd_implementation_drawmenu_setting_edit_generic(uint8_t row, const char* pstr, char pre_char, char* data) lcd.createChar(LCD_STR_FEEDRATE[0], feedrate);
{ lcd.createChar(LCD_STR_CLOCK[0], clock);
char c; lcd.clear();
//Use all characters in narrow LCDs }
#if LCD_WIDTH < 20 static void lcd_implementation_clear()
uint8_t n = LCD_WIDTH - 1 - 1 - strlen(data); {
#else lcd.clear();
uint8_t n = LCD_WIDTH - 1 - 2 - strlen(data); }
#endif /* Arduino < 1.0.0 is missing a function to print PROGMEM strings, so we need to implement our own */
lcd.setCursor(0, row); static void lcd_printPGM(const char* str)
lcd.print(pre_char); {
while((c = pgm_read_byte(pstr)) != '\0') char c;
{ while((c = pgm_read_byte(str++)) != '\0')
lcd.print(c); {
pstr++; lcd.write(c);
n--; }
} }
lcd.print(':'); /*
while(n--) Possible status screens:
lcd.print(' '); 16x2 |0123456789012345|
lcd.print(data); |000/000 B000/000|
} |Status line.....|
static void lcd_implementation_drawmenu_setting_edit_generic_P(uint8_t row, const char* pstr, char pre_char, const char* data)
{ 16x4 |0123456789012345|
char c; |000/000 B000/000|
//Use all characters in narrow LCDs |SD100% Z000.0|
#if LCD_WIDTH < 20 |F100% T--:--|
uint8_t n = LCD_WIDTH - 1 - 1 - strlen_P(data); |Status line.....|
#else
uint8_t n = LCD_WIDTH - 1 - 2 - strlen_P(data); 20x2 |01234567890123456789|
#endif |T000/000D B000/000D |
lcd.setCursor(0, row); |Status line.........|
lcd.print(pre_char);
while((c = pgm_read_byte(pstr)) != '\0') 20x4 |01234567890123456789|
{ |T000/000D B000/000D |
lcd.print(c); |X+000.0 Y+000.0 Z+000.0|
pstr++; |F100% SD100% T--:--|
n--; |Status line.........|
}
lcd.print(':'); 20x4 |01234567890123456789|
while(n--) |T000/000D B000/000D |
lcd.print(' '); |T000/000D Z000.0|
lcd_printPGM(data); |F100% SD100% T--:--|
} |Status line.........|
#define lcd_implementation_drawmenu_setting_edit_int3_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', itostr3(*(data))) */
#define lcd_implementation_drawmenu_setting_edit_int3(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', itostr3(*(data))) static void lcd_implementation_status_screen()
#define lcd_implementation_drawmenu_setting_edit_float3_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr3(*(data))) {
#define lcd_implementation_drawmenu_setting_edit_float3(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr3(*(data))) int tHotend=int(degHotend(0) + 0.5);
#define lcd_implementation_drawmenu_setting_edit_float32_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr32(*(data))) int tTarget=int(degTargetHotend(0) + 0.5);
#define lcd_implementation_drawmenu_setting_edit_float32(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr32(*(data)))
#define lcd_implementation_drawmenu_setting_edit_float5_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr5(*(data))) #if LCD_WIDTH < 20
#define lcd_implementation_drawmenu_setting_edit_float5(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr5(*(data))) lcd.setCursor(0, 0);
#define lcd_implementation_drawmenu_setting_edit_float52_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr52(*(data))) lcd.print(itostr3(tHotend));
#define lcd_implementation_drawmenu_setting_edit_float52(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr52(*(data))) lcd.print('/');
#define lcd_implementation_drawmenu_setting_edit_float51_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr51(*(data))) lcd.print(itostr3left(tTarget));
#define lcd_implementation_drawmenu_setting_edit_float51(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr51(*(data)))
#define lcd_implementation_drawmenu_setting_edit_long5_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr5(*(data))) # if EXTRUDERS > 1 || TEMP_SENSOR_BED != 0
#define lcd_implementation_drawmenu_setting_edit_long5(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr5(*(data))) //If we have an 2nd extruder or heated bed, show that in the top right corner
#define lcd_implementation_drawmenu_setting_edit_bool_selected(row, pstr, pstr2, data) lcd_implementation_drawmenu_setting_edit_generic_P(row, pstr, '>', (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF)) lcd.setCursor(8, 0);
#define lcd_implementation_drawmenu_setting_edit_bool(row, pstr, pstr2, data) lcd_implementation_drawmenu_setting_edit_generic_P(row, pstr, ' ', (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF)) # if EXTRUDERS > 1
tHotend = int(degHotend(1) + 0.5);
//Add version for callback functions tTarget = int(degTargetHotend(1) + 0.5);
#define lcd_implementation_drawmenu_setting_edit_callback_int3_selected(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', itostr3(*(data))) lcd.print(LCD_STR_THERMOMETER[0]);
#define lcd_implementation_drawmenu_setting_edit_callback_int3(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', itostr3(*(data))) # else//Heated bed
#define lcd_implementation_drawmenu_setting_edit_callback_float3_selected(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr3(*(data))) tHotend=int(degBed() + 0.5);
#define lcd_implementation_drawmenu_setting_edit_callback_float3(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr3(*(data))) tTarget=int(degTargetBed() + 0.5);
#define lcd_implementation_drawmenu_setting_edit_callback_float32_selected(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr32(*(data))) lcd.print(LCD_STR_BEDTEMP[0]);
#define lcd_implementation_drawmenu_setting_edit_callback_float32(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr32(*(data))) # endif
#define lcd_implementation_drawmenu_setting_edit_callback_float5_selected(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr5(*(data))) lcd.print(itostr3(tHotend));
#define lcd_implementation_drawmenu_setting_edit_callback_float5(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr5(*(data))) lcd.print('/');
#define lcd_implementation_drawmenu_setting_edit_callback_float52_selected(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr52(*(data))) lcd.print(itostr3left(tTarget));
#define lcd_implementation_drawmenu_setting_edit_callback_float52(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr52(*(data))) # endif//EXTRUDERS > 1 || TEMP_SENSOR_BED != 0
#define lcd_implementation_drawmenu_setting_edit_callback_float51_selected(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr51(*(data)))
#define lcd_implementation_drawmenu_setting_edit_callback_float51(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr51(*(data))) #else//LCD_WIDTH > 19
#define lcd_implementation_drawmenu_setting_edit_callback_long5_selected(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr5(*(data))) lcd.setCursor(0, 0);
#define lcd_implementation_drawmenu_setting_edit_callback_long5(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr5(*(data))) lcd.print(LCD_STR_THERMOMETER[0]);
#define lcd_implementation_drawmenu_setting_edit_callback_bool_selected(row, pstr, pstr2, data, callback) lcd_implementation_drawmenu_setting_edit_generic_P(row, pstr, '>', (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF)) lcd.print(itostr3(tHotend));
#define lcd_implementation_drawmenu_setting_edit_callback_bool(row, pstr, pstr2, data, callback) lcd_implementation_drawmenu_setting_edit_generic_P(row, pstr, ' ', (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF)) lcd.print('/');
lcd.print(itostr3left(tTarget));
lcd_printPGM(PSTR(LCD_STR_DEGREE " "));
void lcd_implementation_drawedit(const char* pstr, char* value) if (tTarget < 10)
{ lcd.print(' ');
lcd.setCursor(1, 1);
lcd_printPGM(pstr); # if EXTRUDERS > 1 || TEMP_SENSOR_BED != 0
lcd.print(':'); //If we have an 2nd extruder or heated bed, show that in the top right corner
#if LCD_WIDTH < 20 lcd.setCursor(10, 0);
lcd.setCursor(LCD_WIDTH - strlen(value), 1); # if EXTRUDERS > 1
#else tHotend = int(degHotend(1) + 0.5);
lcd.setCursor(LCD_WIDTH -1 - strlen(value), 1); tTarget = int(degTargetHotend(1) + 0.5);
#endif lcd.print(LCD_STR_THERMOMETER[0]);
lcd.print(value); # else//Heated bed
} tHotend=int(degBed() + 0.5);
static void lcd_implementation_drawmenu_sdfile_selected(uint8_t row, const char* pstr, const char* filename, char* longFilename) tTarget=int(degTargetBed() + 0.5);
{ lcd.print(LCD_STR_BEDTEMP[0]);
char c; # endif
uint8_t n = LCD_WIDTH - 1; lcd.print(itostr3(tHotend));
lcd.setCursor(0, row); lcd.print('/');
lcd.print('>'); lcd.print(itostr3left(tTarget));
if (longFilename[0] != '\0') lcd_printPGM(PSTR(LCD_STR_DEGREE " "));
{ if (tTarget < 10)
filename = longFilename; lcd.print(' ');
longFilename[LCD_WIDTH-1] = '\0'; # endif//EXTRUDERS > 1 || TEMP_SENSOR_BED != 0
} #endif//LCD_WIDTH > 19
while((c = *filename) != '\0')
{ #if LCD_HEIGHT > 2
lcd.print(c); //Lines 2 for 4 line LCD
filename++; # if LCD_WIDTH < 20
n--; # ifdef SDSUPPORT
} lcd.setCursor(0, 2);
while(n--) lcd_printPGM(PSTR("SD"));
lcd.print(' '); if (IS_SD_PRINTING)
} lcd.print(itostr3(card.percentDone()));
static void lcd_implementation_drawmenu_sdfile(uint8_t row, const char* pstr, const char* filename, char* longFilename) else
{ lcd_printPGM(PSTR("---"));
char c; lcd.print('%');
uint8_t n = LCD_WIDTH - 1; # endif//SDSUPPORT
lcd.setCursor(0, row); # else//LCD_WIDTH > 19
lcd.print(' '); # if EXTRUDERS > 1 && TEMP_SENSOR_BED != 0
if (longFilename[0] != '\0') //If we both have a 2nd extruder and a heated bed, show the heated bed temp on the 2nd line on the left, as the first line is filled with extruder temps
{ tHotend=int(degBed() + 0.5);
filename = longFilename; tTarget=int(degTargetBed() + 0.5);
longFilename[LCD_WIDTH-1] = '\0';
} lcd.setCursor(0, 1);
while((c = *filename) != '\0') lcd.print(LCD_STR_BEDTEMP[0]);
{ lcd.print(itostr3(tHotend));
lcd.print(c); lcd.print('/');
filename++; lcd.print(itostr3left(tTarget));
n--; lcd_printPGM(PSTR(LCD_STR_DEGREE " "));
} if (tTarget < 10)
while(n--) lcd.print(' ');
lcd.print(' '); # else
} lcd.setCursor(0,1);
static void lcd_implementation_drawmenu_sddirectory_selected(uint8_t row, const char* pstr, const char* filename, char* longFilename) lcd.print('X');
{ lcd.print(ftostr3(current_position[X_AXIS]));
char c; lcd_printPGM(PSTR(" Y"));
uint8_t n = LCD_WIDTH - 2; lcd.print(ftostr3(current_position[Y_AXIS]));
lcd.setCursor(0, row); # endif//EXTRUDERS > 1 || TEMP_SENSOR_BED != 0
lcd.print('>'); # endif//LCD_WIDTH > 19
lcd.print(LCD_STR_FOLDER[0]); lcd.setCursor(LCD_WIDTH - 8, 1);
if (longFilename[0] != '\0') lcd.print('Z');
{ lcd.print(ftostr32(current_position[Z_AXIS]));
filename = longFilename; #endif//LCD_HEIGHT > 2
longFilename[LCD_WIDTH-2] = '\0';
} #if LCD_HEIGHT > 3
while((c = *filename) != '\0') lcd.setCursor(0, 2);
{ lcd.print(LCD_STR_FEEDRATE[0]);
lcd.print(c); lcd.print(itostr3(feedmultiply));
filename++; lcd.print('%');
n--; # if LCD_WIDTH > 19
} # ifdef SDSUPPORT
while(n--) lcd.setCursor(7, 2);
lcd.print(' '); lcd_printPGM(PSTR("SD"));
} if (IS_SD_PRINTING)
static void lcd_implementation_drawmenu_sddirectory(uint8_t row, const char* pstr, const char* filename, char* longFilename) lcd.print(itostr3(card.percentDone()));
{ else
char c; lcd_printPGM(PSTR("---"));
uint8_t n = LCD_WIDTH - 2; lcd.print('%');
lcd.setCursor(0, row); # endif//SDSUPPORT
lcd.print(' '); # endif//LCD_WIDTH > 19
lcd.print(LCD_STR_FOLDER[0]); lcd.setCursor(LCD_WIDTH - 6, 2);
if (longFilename[0] != '\0') lcd.print(LCD_STR_CLOCK[0]);
{ if(starttime != 0)
filename = longFilename; {
longFilename[LCD_WIDTH-2] = '\0'; uint16_t time = millis()/60000 - starttime/60000;
} lcd.print(itostr2(time/60));
while((c = *filename) != '\0') lcd.print(':');
{ lcd.print(itostr2(time%60));
lcd.print(c); }else{
filename++; lcd_printPGM(PSTR("--:--"));
n--; }
} #endif
while(n--)
lcd.print(' '); //Status message line on the last line
} lcd.setCursor(0, LCD_HEIGHT - 1);
#define lcd_implementation_drawmenu_back_selected(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, LCD_STR_UPLEVEL[0], LCD_STR_UPLEVEL[0]) lcd.print(lcd_status_message);
#define lcd_implementation_drawmenu_back(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, ' ', LCD_STR_UPLEVEL[0]) }
#define lcd_implementation_drawmenu_submenu_selected(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, '>', LCD_STR_ARROW_RIGHT[0]) static void lcd_implementation_drawmenu_generic(uint8_t row, const char* pstr, char pre_char, char post_char)
#define lcd_implementation_drawmenu_submenu(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, ' ', LCD_STR_ARROW_RIGHT[0]) {
#define lcd_implementation_drawmenu_gcode_selected(row, pstr, gcode) lcd_implementation_drawmenu_generic(row, pstr, '>', ' ') char c;
#define lcd_implementation_drawmenu_gcode(row, pstr, gcode) lcd_implementation_drawmenu_generic(row, pstr, ' ', ' ') //Use all characters in narrow LCDs
#define lcd_implementation_drawmenu_function_selected(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, '>', ' ') #if LCD_WIDTH < 20
#define lcd_implementation_drawmenu_function(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, ' ', ' ') uint8_t n = LCD_WIDTH - 1 - 1;
#else
static void lcd_implementation_quick_feedback() uint8_t n = LCD_WIDTH - 1 - 2;
{ #endif
#if BEEPER > -1 lcd.setCursor(0, row);
SET_OUTPUT(BEEPER); lcd.print(pre_char);
for(int8_t i=0;i<10;i++) while((c = pgm_read_byte(pstr)) != '\0')
{ {
WRITE(BEEPER,HIGH); lcd.print(c);
delay(3); pstr++;
WRITE(BEEPER,LOW); n--;
delay(3); }
} while(n--)
#endif lcd.print(' ');
} lcd.print(post_char);
#endif//ULTRA_LCD_IMPLEMENTATION_HITACHI_HD44780_H lcd.print(' ');
}
static void lcd_implementation_drawmenu_setting_edit_generic(uint8_t row, const char* pstr, char pre_char, char* data)
{
char c;
//Use all characters in narrow LCDs
#if LCD_WIDTH < 20
uint8_t n = LCD_WIDTH - 1 - 1 - strlen(data);
#else
uint8_t n = LCD_WIDTH - 1 - 2 - strlen(data);
#endif
lcd.setCursor(0, row);
lcd.print(pre_char);
while((c = pgm_read_byte(pstr)) != '\0')
{
lcd.print(c);
pstr++;
n--;
}
lcd.print(':');
while(n--)
lcd.print(' ');
lcd.print(data);
}
static void lcd_implementation_drawmenu_setting_edit_generic_P(uint8_t row, const char* pstr, char pre_char, const char* data)
{
char c;
//Use all characters in narrow LCDs
#if LCD_WIDTH < 20
uint8_t n = LCD_WIDTH - 1 - 1 - strlen_P(data);
#else
uint8_t n = LCD_WIDTH - 1 - 2 - strlen_P(data);
#endif
lcd.setCursor(0, row);
lcd.print(pre_char);
while((c = pgm_read_byte(pstr)) != '\0')
{
lcd.print(c);
pstr++;
n--;
}
lcd.print(':');
while(n--)
lcd.print(' ');
lcd_printPGM(data);
}
#define lcd_implementation_drawmenu_setting_edit_int3_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', itostr3(*(data)))
#define lcd_implementation_drawmenu_setting_edit_int3(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', itostr3(*(data)))
#define lcd_implementation_drawmenu_setting_edit_float3_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr3(*(data)))
#define lcd_implementation_drawmenu_setting_edit_float3(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr3(*(data)))
#define lcd_implementation_drawmenu_setting_edit_float32_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr32(*(data)))
#define lcd_implementation_drawmenu_setting_edit_float32(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr32(*(data)))
#define lcd_implementation_drawmenu_setting_edit_float5_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr5(*(data)))
#define lcd_implementation_drawmenu_setting_edit_float5(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr5(*(data)))
#define lcd_implementation_drawmenu_setting_edit_float52_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr52(*(data)))
#define lcd_implementation_drawmenu_setting_edit_float52(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr52(*(data)))
#define lcd_implementation_drawmenu_setting_edit_float51_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr51(*(data)))
#define lcd_implementation_drawmenu_setting_edit_float51(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr51(*(data)))
#define lcd_implementation_drawmenu_setting_edit_long5_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr5(*(data)))
#define lcd_implementation_drawmenu_setting_edit_long5(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr5(*(data)))
#define lcd_implementation_drawmenu_setting_edit_bool_selected(row, pstr, pstr2, data) lcd_implementation_drawmenu_setting_edit_generic_P(row, pstr, '>', (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF))
#define lcd_implementation_drawmenu_setting_edit_bool(row, pstr, pstr2, data) lcd_implementation_drawmenu_setting_edit_generic_P(row, pstr, ' ', (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF))
//Add version for callback functions
#define lcd_implementation_drawmenu_setting_edit_callback_int3_selected(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', itostr3(*(data)))
#define lcd_implementation_drawmenu_setting_edit_callback_int3(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', itostr3(*(data)))
#define lcd_implementation_drawmenu_setting_edit_callback_float3_selected(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr3(*(data)))
#define lcd_implementation_drawmenu_setting_edit_callback_float3(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr3(*(data)))
#define lcd_implementation_drawmenu_setting_edit_callback_float32_selected(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr32(*(data)))
#define lcd_implementation_drawmenu_setting_edit_callback_float32(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr32(*(data)))
#define lcd_implementation_drawmenu_setting_edit_callback_float5_selected(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr5(*(data)))
#define lcd_implementation_drawmenu_setting_edit_callback_float5(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr5(*(data)))
#define lcd_implementation_drawmenu_setting_edit_callback_float52_selected(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr52(*(data)))
#define lcd_implementation_drawmenu_setting_edit_callback_float52(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr52(*(data)))
#define lcd_implementation_drawmenu_setting_edit_callback_float51_selected(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr51(*(data)))
#define lcd_implementation_drawmenu_setting_edit_callback_float51(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr51(*(data)))
#define lcd_implementation_drawmenu_setting_edit_callback_long5_selected(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr5(*(data)))
#define lcd_implementation_drawmenu_setting_edit_callback_long5(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr5(*(data)))
#define lcd_implementation_drawmenu_setting_edit_callback_bool_selected(row, pstr, pstr2, data, callback) lcd_implementation_drawmenu_setting_edit_generic_P(row, pstr, '>', (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF))
#define lcd_implementation_drawmenu_setting_edit_callback_bool(row, pstr, pstr2, data, callback) lcd_implementation_drawmenu_setting_edit_generic_P(row, pstr, ' ', (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF))
void lcd_implementation_drawedit(const char* pstr, char* value)
{
lcd.setCursor(1, 1);
lcd_printPGM(pstr);
lcd.print(':');
#if LCD_WIDTH < 20
lcd.setCursor(LCD_WIDTH - strlen(value), 1);
#else
lcd.setCursor(LCD_WIDTH -1 - strlen(value), 1);
#endif
lcd.print(value);
}
static void lcd_implementation_drawmenu_sdfile_selected(uint8_t row, const char* pstr, const char* filename, char* longFilename)
{
char c;
uint8_t n = LCD_WIDTH - 1;
lcd.setCursor(0, row);
lcd.print('>');
if (longFilename[0] != '\0')
{
filename = longFilename;
longFilename[LCD_WIDTH-1] = '\0';
}
while((c = *filename) != '\0')
{
lcd.print(c);
filename++;
n--;
}
while(n--)
lcd.print(' ');
}
static void lcd_implementation_drawmenu_sdfile(uint8_t row, const char* pstr, const char* filename, char* longFilename)
{
char c;
uint8_t n = LCD_WIDTH - 1;
lcd.setCursor(0, row);
lcd.print(' ');
if (longFilename[0] != '\0')
{
filename = longFilename;
longFilename[LCD_WIDTH-1] = '\0';
}
while((c = *filename) != '\0')
{
lcd.print(c);
filename++;
n--;
}
while(n--)
lcd.print(' ');
}
static void lcd_implementation_drawmenu_sddirectory_selected(uint8_t row, const char* pstr, const char* filename, char* longFilename)
{
char c;
uint8_t n = LCD_WIDTH - 2;
lcd.setCursor(0, row);
lcd.print('>');
lcd.print(LCD_STR_FOLDER[0]);
if (longFilename[0] != '\0')
{
filename = longFilename;
longFilename[LCD_WIDTH-2] = '\0';
}
while((c = *filename) != '\0')
{
lcd.print(c);
filename++;
n--;
}
while(n--)
lcd.print(' ');
}
static void lcd_implementation_drawmenu_sddirectory(uint8_t row, const char* pstr, const char* filename, char* longFilename)
{
char c;
uint8_t n = LCD_WIDTH - 2;
lcd.setCursor(0, row);
lcd.print(' ');
lcd.print(LCD_STR_FOLDER[0]);
if (longFilename[0] != '\0')
{
filename = longFilename;
longFilename[LCD_WIDTH-2] = '\0';
}
while((c = *filename) != '\0')
{
lcd.print(c);
filename++;
n--;
}
while(n--)
lcd.print(' ');
}
#define lcd_implementation_drawmenu_back_selected(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, LCD_STR_UPLEVEL[0], LCD_STR_UPLEVEL[0])
#define lcd_implementation_drawmenu_back(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, ' ', LCD_STR_UPLEVEL[0])
#define lcd_implementation_drawmenu_submenu_selected(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, '>', LCD_STR_ARROW_RIGHT[0])
#define lcd_implementation_drawmenu_submenu(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, ' ', LCD_STR_ARROW_RIGHT[0])
#define lcd_implementation_drawmenu_gcode_selected(row, pstr, gcode) lcd_implementation_drawmenu_generic(row, pstr, '>', ' ')
#define lcd_implementation_drawmenu_gcode(row, pstr, gcode) lcd_implementation_drawmenu_generic(row, pstr, ' ', ' ')
#define lcd_implementation_drawmenu_function_selected(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, '>', ' ')
#define lcd_implementation_drawmenu_function(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, ' ', ' ')
static void lcd_implementation_quick_feedback()
{
#ifdef LCD_USE_I2C_BUZZER
lcd.buzz(60,1000/6);
#elif defined(BEEPER) && BEEPER > -1
SET_OUTPUT(BEEPER);
for(int8_t i=0;i<10;i++)
{
WRITE(BEEPER,HIGH);
delay(3);
WRITE(BEEPER,LOW);
delay(3);
}
#endif
}
#ifdef LCD_HAS_STATUS_INDICATORS
static void lcd_implementation_update_indicators()
{
#if defined(LCD_I2C_PANELOLU2) || defined(LCD_I2C_VIKI)
//set the LEDS - referred to as backlights by the LiquidTWI2 library
static uint8_t ledsprev = 0;
uint8_t leds = 0;
if (target_temperature_bed > 0) leds |= LED_A;
if (target_temperature[0] > 0) leds |= LED_B;
if (fanSpeed) leds |= LED_C;
#if EXTRUDERS > 1
if (target_temperature[1] > 0) leds |= LED_C;
#endif
if (leds != ledsprev) {
lcd.setBacklight(leds);
ledsprev = leds;
}
#endif
}
#endif
#ifdef LCD_HAS_SLOW_BUTTONS
static uint8_t lcd_implementation_read_slow_buttons()
{
#ifdef LCD_I2C_TYPE_MCP23017
// Reading these buttons this is likely to be too slow to call inside interrupt context
// so they are called during normal lcd_update
return lcd.readButtons() << B_I2C_BTN_OFFSET;
#endif
}
#endif
#endif//ULTRA_LCD_IMPLEMENTATION_HITACHI_HD44780_H