Converge all I2C LCD branches (PANELOLU2, VIKI & PCF8575)
This includes refactoring the buttons code to remove a large amount of non-pin dependent duplication from pins.h.
This commit is contained in:
parent
67710df9f3
commit
1292d735ba
@ -306,12 +306,21 @@ const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of th
|
||||
// please keep turned on if you can.
|
||||
//#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
|
||||
//#define ULTRA_LCD //general lcd support, also 16x2
|
||||
//#define SDSUPPORT // Enable SD Card Support in Hardware Console
|
||||
|
||||
//#define ULTIMAKERCONTROLLER //as available from the ultimaker online store.
|
||||
//#define ULTIPANEL //the ultipanel as on thingiverse
|
||||
#define ULTIPANEL //the ultipanel as on thingiverse
|
||||
|
||||
// The RepRapDiscount Smart Controller (white PCB)
|
||||
// http://reprap.org/wiki/RepRapDiscount_Smart_Controller
|
||||
@ -327,15 +336,42 @@ const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of th
|
||||
#define NEWPANEL
|
||||
#endif
|
||||
|
||||
// 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
|
||||
// I2C PANELS
|
||||
|
||||
#define ABS_PREHEAT_HOTEND_TEMP 240
|
||||
#define ABS_PREHEAT_HPB_TEMP 100
|
||||
#define ABS_PREHEAT_FAN_SPEED 255 // Insert Value between 0 and 255
|
||||
#define LCD_I2C_SAINSMART_YWROBOT
|
||||
#ifdef LCD_I2C_SAINSMART_YWROBOT
|
||||
// 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 ULTIPANEL
|
||||
#define NEWPANEL
|
||||
#define LCD_I2C_ADDRESS 0x27 // I2C Address of the port expander
|
||||
#endif
|
||||
|
||||
// PANELOLU2 LCD with status LEDs, separate encoder and click inputs
|
||||
//#define LCD_I2C_PANELOLU2
|
||||
#ifdef LCD_I2C_PANELOLU2
|
||||
// This uses the LiquidTWI2 library ( https://github.com/lincomatic/LiquidTWI2 ).
|
||||
// Make sure it is placed in the Arduino libraries directory.
|
||||
#define LCD_I2C_TYPE_MCP23017
|
||||
#define ULTIPANEL
|
||||
#define NEWPANEL
|
||||
#define LCD_I2C_ADDRESS 0x20
|
||||
#define LCD_HAS_I2C_BUZZ //comment out to disable buzzer on LCD
|
||||
#define LCD_HAS_STATUS_INDICATORS
|
||||
#endif
|
||||
|
||||
// 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 (https://github.com/lincomatic/LiquidTWI2).
|
||||
// Make sure it is placed in the Arduino libraries directory.
|
||||
#define LCD_I2C_TYPE_MCP23017
|
||||
#define ULTIPANEL
|
||||
#define NEWPANEL
|
||||
#define LCD_I2C_ADDRESS 0x20
|
||||
#define LCD_HAS_STATUS_INDICATORS
|
||||
#endif
|
||||
|
||||
#ifdef ULTIPANEL
|
||||
// #define NEWPANEL //enable this if you have a click-encoder panel
|
||||
@ -351,15 +387,6 @@ const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of th
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//The LCD is attached via an I2C port expander.
|
||||
//#define LCD_I2C
|
||||
#ifdef LCD_I2C
|
||||
// Port Expander Type - 0=PCF8574 sainsmart/ywrobot
|
||||
#define LCD_I2C_TYPE 0
|
||||
// I2C Address of the port expander
|
||||
#define LCD_I2C_ADDRESS 0x27
|
||||
#endif
|
||||
|
||||
// Increase the FAN pwm frequency. Removes the PWM noise but increases heating in the FET/Arduino
|
||||
//#define FAST_PWM_FAN
|
||||
|
||||
|
@ -36,7 +36,21 @@
|
||||
#ifdef ULTRA_LCD
|
||||
#ifdef LCD_I2C
|
||||
#include <Wire.h>
|
||||
#include <LiquidCrystal_I2C.h>
|
||||
#if defined(LCD_I2C_TYPE_PCF8575)
|
||||
#include <LiquidCrystal_I2C.h>
|
||||
#elif defined(LCD_I2C_TYPE_MCP23017)
|
||||
#ifdef PANELOLU2
|
||||
#undef PANELOLU2
|
||||
#include <LiquidTWI2.h>
|
||||
#ifndef PANELOLU2
|
||||
#error You must uncomment #define PANELOLU2 in LiquidTWI2.h for LiquidTWI2.cpp to compile correctly
|
||||
#endif
|
||||
#else
|
||||
#include <LiquidTWI2.h>
|
||||
#endif
|
||||
#else
|
||||
#error Unknown I2C LCD type
|
||||
#endif
|
||||
#else
|
||||
#include <LiquidCrystal.h>
|
||||
#endif
|
||||
|
@ -124,7 +124,7 @@
|
||||
// M500 - stores paramters in EEPROM
|
||||
// M501 - reads parameters from EEPROM (if you need reset them after you changed them temporarily).
|
||||
// M502 - reverts to the default "factory settings". You still need to store them in EEPROM afterwards if you want to.
|
||||
// M503 - print the current settings (from memory not from eeprom)
|
||||
// M503 - print the current settings (from memory not from eeprom)
|
||||
// M540 - Use S[0|1] to enable or disable the stop SD card print on endstop hit (requires ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
|
||||
// M600 - Pause for filament change X[pos] Y[pos] Z[relative lift] E[initial retract] L[later retract distance for removal]
|
||||
// M907 - Set digital trimpot motor current using axis codes.
|
||||
@ -853,13 +853,13 @@ void process_commands()
|
||||
previous_millis_cmd = millis();
|
||||
if (codenum > 0){
|
||||
codenum += millis(); // keep track of when we started waiting
|
||||
while(millis() < codenum && !LCD_CLICKED){
|
||||
while(millis() < codenum && !lcd_clicked()){
|
||||
manage_heater();
|
||||
manage_inactivity();
|
||||
lcd_update();
|
||||
}
|
||||
}else{
|
||||
while(!LCD_CLICKED){
|
||||
while(!lcd_clicked()){
|
||||
manage_heater();
|
||||
manage_inactivity();
|
||||
lcd_update();
|
||||
@ -1499,13 +1499,13 @@ void process_commands()
|
||||
{
|
||||
Config_PrintSettings();
|
||||
}
|
||||
break;
|
||||
#ifdef ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
|
||||
case 540:
|
||||
{
|
||||
if(code_seen('S')) abort_on_endstop_hit = code_value() > 0;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
#ifdef ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
|
||||
case 540:
|
||||
{
|
||||
if(code_seen('S')) abort_on_endstop_hit = code_value() > 0;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
#ifdef FILAMENTCHANGEENABLE
|
||||
case 600: //Pause for filament change X[pos] Y[pos] Z[relative lift] E[initial retract] L[later retract distance for removal]
|
||||
@ -1592,7 +1592,7 @@ void process_commands()
|
||||
delay(100);
|
||||
LCD_ALERTMESSAGEPGM(MSG_FILAMENTCHANGE);
|
||||
uint8_t cnt=0;
|
||||
while(!LCD_CLICKED){
|
||||
while(!lcd_clicked()){
|
||||
cnt++;
|
||||
manage_heater();
|
||||
manage_inactivity();
|
||||
|
105
Marlin/pins.h
105
Marlin/pins.h
@ -290,15 +290,6 @@
|
||||
#define BTN_EN1 11
|
||||
#define BTN_EN2 10
|
||||
#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
|
||||
|
||||
/****************************************************************************************
|
||||
@ -384,16 +375,6 @@
|
||||
#ifdef ULTRA_LCD
|
||||
|
||||
#ifdef NEWPANEL
|
||||
//encoder rotation values
|
||||
#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_D4 23
|
||||
@ -427,7 +408,7 @@
|
||||
|
||||
#else //old style panel with shift register
|
||||
//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
|
||||
// Not wired this yet
|
||||
@ -442,25 +423,6 @@
|
||||
#define LCD_PINS_D5 25
|
||||
#define LCD_PINS_D6 27
|
||||
#define LCD_PINS_D7 29
|
||||
|
||||
//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
|
||||
|
||||
@ -735,23 +697,12 @@
|
||||
#define LCD_PINS_D7 27
|
||||
|
||||
//The encoder and click button
|
||||
#define BTN_EN1 11 //must be a hardware interrupt pin
|
||||
#define BTN_EN2 10 //must be hardware interrupt pin
|
||||
#define BTN_EN1 11
|
||||
#define BTN_EN2 10
|
||||
#define BTN_ENC 16 //the switch
|
||||
//not connected to a pin
|
||||
#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
|
||||
|
||||
#define SDCARDDETECT -1
|
||||
|
||||
#endif //Newpanel
|
||||
#endif //Ultipanel
|
||||
|
||||
@ -834,17 +785,8 @@
|
||||
#define BTN_EN2 42
|
||||
#define BTN_ENC 19 //the click
|
||||
|
||||
#define BLEN_C 2
|
||||
#define BLEN_B 1
|
||||
#define BLEN_A 0
|
||||
|
||||
#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
|
||||
//arduino pin witch triggers an piezzo beeper
|
||||
#define BEEPER 18
|
||||
@ -861,33 +803,8 @@
|
||||
#define LCD_PINS_D5 21
|
||||
#define LCD_PINS_D6 20
|
||||
#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
|
||||
//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
|
||||
|
||||
@ -1455,17 +1372,7 @@
|
||||
#define BTN_EN2 64
|
||||
#define BTN_ENC 43 //the click
|
||||
|
||||
#define BLEN_C 2
|
||||
#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 //ULTRA_LCD
|
||||
|
||||
|
@ -714,6 +714,10 @@ void lcd_update()
|
||||
|
||||
lcd_buttons_update();
|
||||
|
||||
#ifdef LCD_HAS_EXTRA_BUTTONS
|
||||
buttons |= lcd_read_extra_buttons(); // buttons which take too long to read in interrupt context
|
||||
#endif
|
||||
|
||||
#if (SDCARDDETECT > -1)
|
||||
if((IS_SD_INSERTED != lcd_oldcardstatus))
|
||||
{
|
||||
@ -858,6 +862,11 @@ void lcd_buttons_update()
|
||||
}
|
||||
#endif//ULTIPANEL
|
||||
|
||||
bool lcd_clicked()
|
||||
{
|
||||
return LCD_CLICKED;
|
||||
}
|
||||
|
||||
/********************************/
|
||||
/** Float conversion utilities **/
|
||||
/********************************/
|
||||
|
@ -20,7 +20,6 @@
|
||||
|
||||
#ifdef ULTIPANEL
|
||||
void lcd_buttons_update();
|
||||
extern volatile uint8_t buttons; //the last checked buttons in a bit array.
|
||||
#else
|
||||
FORCE_INLINE void lcd_buttons_update() {}
|
||||
#endif
|
||||
@ -33,25 +32,7 @@
|
||||
extern int absPreheatHPBTemp;
|
||||
extern int absPreheatFanSpeed;
|
||||
|
||||
#ifdef NEWPANEL
|
||||
#define EN_C (1<<BLEN_C)
|
||||
#define EN_B (1<<BLEN_B)
|
||||
#define EN_A (1<<BLEN_A)
|
||||
|
||||
#define LCD_CLICKED (buttons&EN_C)
|
||||
#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
|
||||
bool lcd_clicked();
|
||||
|
||||
#else //no lcd
|
||||
FORCE_INLINE void lcd_update() {}
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user