Changed the naming of some LCD functions, so the names match better what the function does. Also moved around some prototypes for general cleanup.

This commit is contained in:
daid303 2012-12-03 12:52:00 +01:00
parent 94ea26ff46
commit 6a9bee27cc
10 changed files with 275 additions and 296 deletions

View file

@ -19,6 +19,4 @@ FORCE_INLINE void Config_StoreSettings() {}
FORCE_INLINE void Config_RetrieveSettings() { Config_ResetDefault(); Config_PrintSettings(); } FORCE_INLINE void Config_RetrieveSettings() { Config_ResetDefault(); Config_PrintSettings(); }
#endif #endif
#endif #endif//CONFIG_STORE_H

View file

@ -180,6 +180,7 @@ void setPwmFrequency(uint8_t pin, int val);
extern float homing_feedrate[]; extern float homing_feedrate[];
extern bool axis_relative_modes[]; extern bool axis_relative_modes[];
extern int feedmultiply; extern int feedmultiply;
extern bool feedmultiplychanged;
extern int extrudemultiply; // Sets extrude multiply factor (in percent) extern int extrudemultiply; // Sets extrude multiply factor (in percent)
extern float current_position[NUM_AXIS] ; extern float current_position[NUM_AXIS] ;
extern float add_homeing[3]; extern float add_homeing[3];

View file

@ -147,6 +147,7 @@ CardReader card;
float homing_feedrate[] = HOMING_FEEDRATE; float homing_feedrate[] = HOMING_FEEDRATE;
bool axis_relative_modes[] = AXIS_RELATIVE_MODES; bool axis_relative_modes[] = AXIS_RELATIVE_MODES;
int feedmultiply=100; //100->1 200->2 int feedmultiply=100; //100->1 200->2
bool feedmultiplychanged;
int saved_feedmultiply; int saved_feedmultiply;
int extrudemultiply=100; //100->1 200->2 int extrudemultiply=100; //100->1 200->2
float current_position[NUM_AXIS] = { 0.0, 0.0, 0.0, 0.0 }; float current_position[NUM_AXIS] = { 0.0, 0.0, 0.0, 0.0 };
@ -360,7 +361,7 @@ void setup()
st_init(); // Initialize stepper, this enables interrupts! st_init(); // Initialize stepper, this enables interrupts!
setup_photpin(); setup_photpin();
LCD_INIT; lcd_init();
} }
@ -401,7 +402,7 @@ void loop()
manage_heater(); manage_heater();
manage_inactivity(); manage_inactivity();
checkHitEndstops(); checkHitEndstops();
LCD_STATUS; lcd_update();
} }
void get_command() void get_command()
@ -534,7 +535,7 @@ void get_command()
sprintf_P(time, PSTR("%i min, %i sec"),min,sec); sprintf_P(time, PSTR("%i min, %i sec"),min,sec);
SERIAL_ECHO_START; SERIAL_ECHO_START;
SERIAL_ECHOLN(time); SERIAL_ECHOLN(time);
LCD_MESSAGE(time); lcd_setstatus(time);
card.printingHasFinished(); card.printingHasFinished();
card.checkautostart(true); card.checkautostart(true);
@ -683,7 +684,7 @@ void process_commands()
while(millis() < codenum ){ while(millis() < codenum ){
manage_heater(); manage_heater();
manage_inactivity(); manage_inactivity();
LCD_STATUS; lcd_update();
} }
break; break;
#ifdef FWRETRACT #ifdef FWRETRACT
@ -847,16 +848,16 @@ 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 && !CLICKED){ while(millis() < codenum && !LCD_CLICKED){
manage_heater(); manage_heater();
manage_inactivity(); manage_inactivity();
LCD_STATUS; lcd_update();
} }
}else{ }else{
while(!CLICKED){ while(!LCD_CLICKED){
manage_heater(); manage_heater();
manage_inactivity(); manage_inactivity();
LCD_STATUS; lcd_update();
} }
} }
} }
@ -947,7 +948,7 @@ void process_commands()
sprintf_P(time, PSTR("%i min, %i sec"), min, sec); sprintf_P(time, PSTR("%i min, %i sec"), min, sec);
SERIAL_ECHO_START; SERIAL_ECHO_START;
SERIAL_ECHOLN(time); SERIAL_ECHOLN(time);
LCD_MESSAGE(time); lcd_setstatus(time);
autotempShutdown(); autotempShutdown();
} }
break; break;
@ -1075,7 +1076,7 @@ void process_commands()
} }
manage_heater(); manage_heater();
manage_inactivity(); manage_inactivity();
LCD_STATUS; lcd_update();
#ifdef TEMP_RESIDENCY_TIME #ifdef TEMP_RESIDENCY_TIME
/* start/restart the TEMP_RESIDENCY_TIME timer whenever we reach target temp for the first time /* start/restart the TEMP_RESIDENCY_TIME timer whenever we reach target temp for the first time
or when current temp falls outside the hysteresis after target temp was reached */ or when current temp falls outside the hysteresis after target temp was reached */
@ -1113,7 +1114,7 @@ void process_commands()
} }
manage_heater(); manage_heater();
manage_inactivity(); manage_inactivity();
LCD_STATUS; lcd_update();
} }
LCD_MESSAGEPGM(MSG_BED_DONE); LCD_MESSAGEPGM(MSG_BED_DONE);
previous_millis_cmd = millis(); previous_millis_cmd = millis();
@ -1220,7 +1221,7 @@ void process_commands()
SERIAL_PROTOCOLPGM(MSG_M115_REPORT); SERIAL_PROTOCOLPGM(MSG_M115_REPORT);
break; break;
case 117: // M117 display message case 117: // M117 display message
LCD_MESSAGE(cmdbuffer[bufindr]+5); lcd_setstatus(cmdbuffer[bufindr]+5);
break; break;
case 114: // M114 case 114: // M114
SERIAL_PROTOCOLPGM("X:"); SERIAL_PROTOCOLPGM("X:");
@ -1371,6 +1372,7 @@ void process_commands()
if(code_seen('S')) if(code_seen('S'))
{ {
feedmultiply = code_value() ; feedmultiply = code_value() ;
feedmultiplychanged = true;
} }
} }
break; break;

View file

@ -279,7 +279,7 @@ void CardReader::openFile(char* name,bool read)
sdpos = 0; sdpos = 0;
SERIAL_PROTOCOLLNPGM(MSG_SD_FILE_SELECTED); SERIAL_PROTOCOLLNPGM(MSG_SD_FILE_SELECTED);
LCD_MESSAGE(fname); lcd_setstatus(fname);
} }
else else
{ {
@ -301,7 +301,7 @@ void CardReader::openFile(char* name,bool read)
saving = true; saving = true;
SERIAL_PROTOCOLPGM(MSG_SD_WRITE_TO_FILE); SERIAL_PROTOCOLPGM(MSG_SD_WRITE_TO_FILE);
SERIAL_PROTOCOLLN(name); SERIAL_PROTOCOLLN(name);
LCD_MESSAGE(fname); lcd_setstatus(fname);
} }
} }

View file

@ -69,6 +69,17 @@ private:
extern CardReader card; extern CardReader card;
#define IS_SD_PRINTING (card.sdprinting) #define IS_SD_PRINTING (card.sdprinting)
#if (SDCARDDETECT > -1)
# ifdef SDCARDDETECTINVERTED
# define IS_SD_INSERTED (READ(SDCARDDETECT)!=0)
# else
# define IS_SD_INSERTED (READ(SDCARDDETECT)==0)
# endif //SDCARDTETECTINVERTED
#else
//If we don't have a card detect line, aways asume the card is inserted
# define IS_SD_INSERTED true
#endif
#else #else
#define IS_SD_PRINTING (false) #define IS_SD_PRINTING (false)

View file

@ -506,7 +506,7 @@ void plan_buffer_line(const float &x, const float &y, const float &z, const floa
{ {
manage_heater(); manage_heater();
manage_inactivity(); manage_inactivity();
LCD_STATUS; lcd_update();
} }
// The target position of the tool in absolute steps // The target position of the tool in absolute steps

View file

@ -905,7 +905,7 @@ void st_synchronize()
while( blocks_queued()) { while( blocks_queued()) {
manage_heater(); manage_heater();
manage_inactivity(); manage_inactivity();
LCD_STATUS; lcd_update();
} }
} }

View file

@ -190,6 +190,9 @@ void PID_autotune(float temp, int extruder, int ncycles)
for(;;) { for(;;) {
if(temp_meas_ready == true) { // temp sample ready if(temp_meas_ready == true) { // temp sample ready
//Reset the watchdog after we know we have a temperature measurement.
watchdog_reset();
CRITICAL_SECTION_START; CRITICAL_SECTION_START;
temp_meas_ready = false; temp_meas_ready = false;
CRITICAL_SECTION_END; CRITICAL_SECTION_END;
@ -291,7 +294,7 @@ void PID_autotune(float temp, int extruder, int ncycles)
SERIAL_PROTOCOLLNPGM("PID Autotune finished ! Place the Kp, Ki and Kd constants in the configuration.h"); SERIAL_PROTOCOLLNPGM("PID Autotune finished ! Place the Kp, Ki and Kd constants in the configuration.h");
return; return;
} }
LCD_STATUS; lcd_update();
} }
} }
@ -957,9 +960,7 @@ ISR(TIMER0_COMPB_vect)
ADMUX = ((1 << REFS0) | (TEMP_0_PIN & 0x07)); ADMUX = ((1 << REFS0) | (TEMP_0_PIN & 0x07));
ADCSRA |= 1<<ADSC; // Start conversion ADCSRA |= 1<<ADSC; // Start conversion
#endif #endif
#ifdef ULTIPANEL lcd_buttons_update();
buttons_check();
#endif
temp_state = 1; temp_state = 1;
break; break;
case 1: // Measure TEMP_0 case 1: // Measure TEMP_0
@ -981,9 +982,7 @@ ISR(TIMER0_COMPB_vect)
ADMUX = ((1 << REFS0) | (TEMP_BED_PIN & 0x07)); ADMUX = ((1 << REFS0) | (TEMP_BED_PIN & 0x07));
ADCSRA |= 1<<ADSC; // Start conversion ADCSRA |= 1<<ADSC; // Start conversion
#endif #endif
#ifdef ULTIPANEL lcd_buttons_update();
buttons_check();
#endif
temp_state = 3; temp_state = 3;
break; break;
case 3: // Measure TEMP_BED case 3: // Measure TEMP_BED
@ -1002,9 +1001,7 @@ ISR(TIMER0_COMPB_vect)
ADMUX = ((1 << REFS0) | (TEMP_1_PIN & 0x07)); ADMUX = ((1 << REFS0) | (TEMP_1_PIN & 0x07));
ADCSRA |= 1<<ADSC; // Start conversion ADCSRA |= 1<<ADSC; // Start conversion
#endif #endif
#ifdef ULTIPANEL lcd_buttons_update();
buttons_check();
#endif
temp_state = 5; temp_state = 5;
break; break;
case 5: // Measure TEMP_1 case 5: // Measure TEMP_1
@ -1023,9 +1020,7 @@ ISR(TIMER0_COMPB_vect)
ADMUX = ((1 << REFS0) | (TEMP_2_PIN & 0x07)); ADMUX = ((1 << REFS0) | (TEMP_2_PIN & 0x07));
ADCSRA |= 1<<ADSC; // Start conversion ADCSRA |= 1<<ADSC; // Start conversion
#endif #endif
#ifdef ULTIPANEL lcd_buttons_update();
buttons_check();
#endif
temp_state = 7; temp_state = 7;
break; break;
case 7: // Measure TEMP_2 case 7: // Measure TEMP_2

View file

@ -11,21 +11,15 @@
//=============================imported variables============================ //=============================imported variables============================
//=========================================================================== //===========================================================================
extern volatile int feedmultiply;
extern volatile bool feedmultiplychanged;
extern volatile int extrudemultiply;
extern long position[4]; extern long position[4];
#ifdef SDSUPPORT #ifdef SDSUPPORT
#include "cardreader.h" #include "cardreader.h"
extern CardReader card;
#endif #endif
//=========================================================================== //===========================================================================
//=============================public variables============================ //=============================public variables============================
//=========================================================================== //===========================================================================
volatile char buttons=0; //the last checked buttons in a bit array. volatile uint8_t buttons=0; //the last checked buttons in a bit array.
long encoderpos=0; long encoderpos=0;
short lastenc=0; short lastenc=0;
@ -79,13 +73,13 @@ void lcdProgMemprint(const char *str)
int intround(const float &x){return int(0.5+x);} int intround(const float &x){return int(0.5+x);}
void lcd_status(const char* message) void lcd_setstatus(const char* message)
{ {
strncpy(messagetext,message,LCD_WIDTH); strncpy(messagetext,message,LCD_WIDTH);
messagetext[strlen(message)]=0; messagetext[strlen(message)]=0;
} }
void lcd_statuspgm(const char* message) void lcd_setstatuspgm(const char* message)
{ {
char ch=pgm_read_byte(message); char ch=pgm_read_byte(message);
char *target=messagetext; char *target=messagetext;
@ -100,9 +94,9 @@ void lcd_statuspgm(const char* message)
*target=0; *target=0;
} }
void lcd_alertstatuspgm(const char* message) void lcd_setalertstatuspgm(const char* message)
{ {
lcd_statuspgm(message); lcd_setstatuspgm(message);
menu.showStatus(); menu.showStatus();
} }
@ -116,7 +110,7 @@ void lcd_init()
{ {
//beep(); //beep();
#ifdef ULTIPANEL #ifdef ULTIPANEL
buttons_init(); lcd_buttons_init();
#endif #endif
byte Degree[8] = byte Degree[8] =
@ -217,7 +211,7 @@ void beepshort()
#endif #endif
} }
void lcd_status() void lcd_update()
{ {
#ifdef ULTIPANEL #ifdef ULTIPANEL
static uint8_t oldbuttons=0; static uint8_t oldbuttons=0;
@ -250,7 +244,7 @@ void lcd_status()
#ifdef ULTIPANEL #ifdef ULTIPANEL
void buttons_init() void lcd_buttons_init()
{ {
#ifdef NEWPANEL #ifdef NEWPANEL
pinMode(BTN_EN1,INPUT); pinMode(BTN_EN1,INPUT);
@ -276,8 +270,8 @@ void buttons_init()
#endif #endif
} }
/* Warning, this is called from interrupt context! */
void buttons_check() void lcd_buttons_update()
{ {
#ifdef NEWPANEL #ifdef NEWPANEL
@ -536,7 +530,7 @@ enum {ItemP_exit, ItemP_autostart,ItemP_disstep,ItemP_home, ItemP_origin, ItemP_
#define MENUITEM(repaint_action, click_action) \ #define MENUITEM(repaint_action, click_action) \
{\ {\
if(force_lcd_update) { lcd.setCursor(0,line); repaint_action; } \ if(force_lcd_update) { lcd.setCursor(0,line); repaint_action; } \
if((activeline==line) && CLICKED) {click_action} \ if((activeline==line) && LCD_CLICKED) {click_action} \
} }
void MainMenu::showPrepare() void MainMenu::showPrepare()
@ -550,48 +544,48 @@ void MainMenu::showPrepare()
switch(i) switch(i)
{ {
case ItemP_exit: case ItemP_exit:
MENUITEM( LCD_PRINT_PGM(MSG_MAIN) , BLOCK;status=Main_Menu;beepshort(); ) ; MENUITEM( LCD_PRINT_PGM(MSG_MAIN) , LCD_BLOCK;status=Main_Menu;beepshort(); ) ;
break; break;
case ItemP_autostart: case ItemP_autostart:
MENUITEM( LCD_PRINT_PGM(MSG_AUTOSTART) , BLOCK; MENUITEM( LCD_PRINT_PGM(MSG_AUTOSTART) , LCD_BLOCK;
#ifdef SDSUPPORT #ifdef SDSUPPORT
card.lastnr=0;card.setroot();card.checkautostart(true); card.lastnr=0;card.setroot();card.checkautostart(true);
#endif #endif
beepshort(); ) ; beepshort(); ) ;
break; break;
case ItemP_disstep: case ItemP_disstep:
MENUITEM( LCD_PRINT_PGM(MSG_DISABLE_STEPPERS) , BLOCK;enquecommand("M84");beepshort(); ) ; MENUITEM( LCD_PRINT_PGM(MSG_DISABLE_STEPPERS) , LCD_BLOCK;enquecommand("M84");beepshort(); ) ;
break; break;
case ItemP_home: case ItemP_home:
MENUITEM( LCD_PRINT_PGM(MSG_AUTO_HOME) , BLOCK;enquecommand("G28");beepshort(); ) ; MENUITEM( LCD_PRINT_PGM(MSG_AUTO_HOME) , LCD_BLOCK;enquecommand("G28");beepshort(); ) ;
break; break;
case ItemP_origin: case ItemP_origin:
MENUITEM( LCD_PRINT_PGM(MSG_SET_ORIGIN) , BLOCK;enquecommand("G92 X0 Y0 Z0");beepshort(); ) ; MENUITEM( LCD_PRINT_PGM(MSG_SET_ORIGIN) , LCD_BLOCK;enquecommand("G92 X0 Y0 Z0");beepshort(); ) ;
break; break;
case ItemP_preheat_pla: case ItemP_preheat_pla:
MENUITEM( LCD_PRINT_PGM(MSG_PREHEAT_PLA) , BLOCK;setTargetHotend0(plaPreheatHotendTemp);setTargetBed(plaPreheatHPBTemp); MENUITEM( LCD_PRINT_PGM(MSG_PREHEAT_PLA) , LCD_BLOCK;setTargetHotend0(plaPreheatHotendTemp);setTargetBed(plaPreheatHPBTemp);
#if FAN_PIN > -1 #if FAN_PIN > -1
FanSpeed = plaPreheatFanSpeed; fanSpeed = plaPreheatFanSpeed;
analogWrite(FAN_PIN, FanSpeed); analogWrite(FAN_PIN, fanSpeed);
#endif #endif
beepshort(); ); beepshort(); );
break; break;
case ItemP_preheat_abs: case ItemP_preheat_abs:
MENUITEM( LCD_PRINT_PGM(MSG_PREHEAT_ABS) , BLOCK;setTargetHotend0(absPreheatHotendTemp);setTargetBed(absPreheatHPBTemp); MENUITEM( LCD_PRINT_PGM(MSG_PREHEAT_ABS) , LCD_BLOCK;setTargetHotend0(absPreheatHotendTemp);setTargetBed(absPreheatHPBTemp);
#if FAN_PIN > -1 #if FAN_PIN > -1
FanSpeed = absPreheatFanSpeed; fanSpeed = absPreheatFanSpeed;
analogWrite(FAN_PIN, FanSpeed); analogWrite(FAN_PIN, fanSpeed);
#endif #endif
beepshort(); ); beepshort(); );
break; break;
case ItemP_cooldown: case ItemP_cooldown:
MENUITEM( LCD_PRINT_PGM(MSG_COOLDOWN) , BLOCK;setTargetHotend0(0);setTargetHotend1(0);setTargetHotend2(0);setTargetBed(0);beepshort(); ) ; MENUITEM( LCD_PRINT_PGM(MSG_COOLDOWN) , LCD_BLOCK;setTargetHotend0(0);setTargetHotend1(0);setTargetHotend2(0);setTargetBed(0);beepshort(); ) ;
break; break;
// case ItemP_extrude: // case ItemP_extrude:
// MENUITEM( LCD_PRINT_PGM(" Extrude") , BLOCK;enquecommand("G92 E0");enquecommand("G1 F700 E50");beepshort(); ) ; // MENUITEM( LCD_PRINT_PGM(" Extrude") , LCD_BLOCK;enquecommand("G92 E0");enquecommand("G1 F700 E50");beepshort(); ) ;
// break; // break;
case ItemP_move: case ItemP_move:
MENUITEM( LCD_PRINT_PGM(MSG_MOVE_AXIS) , BLOCK;status=Sub_PrepareMove;beepshort(); ); MENUITEM( LCD_PRINT_PGM(MSG_MOVE_AXIS) , LCD_BLOCK;status=Sub_PrepareMove;beepshort(); );
break; break;
default: default:
break; break;
@ -617,7 +611,7 @@ void MainMenu::showAxisMove()
switch(i) switch(i)
{ {
case ItemAM_exit: case ItemAM_exit:
MENUITEM( LCD_PRINT_PGM(MSG_PREPARE_ALT) , BLOCK;status=Main_Prepare;beepshort(); ) ; MENUITEM( LCD_PRINT_PGM(MSG_PREPARE_ALT) , LCD_BLOCK;status=Main_Prepare;beepshort(); ) ;
break; break;
case ItemAM_X: case ItemAM_X:
{ {
@ -631,7 +625,7 @@ void MainMenu::showAxisMove()
if((activeline!=line) ) if((activeline!=line) )
break; break;
if(CLICKED) if(LCD_CLICKED)
{ {
linechanging=!linechanging; linechanging=!linechanging;
if(linechanging) if(linechanging)
@ -644,7 +638,7 @@ void MainMenu::showAxisMove()
encoderpos=activeline*lcdslow; encoderpos=activeline*lcdslow;
beepshort(); beepshort();
} }
BLOCK; LCD_BLOCK;
} }
if(linechanging) if(linechanging)
{ {
@ -676,7 +670,7 @@ void MainMenu::showAxisMove()
if((activeline!=line) ) if((activeline!=line) )
break; break;
if(CLICKED) if(LCD_CLICKED)
{ {
linechanging=!linechanging; linechanging=!linechanging;
if(linechanging) if(linechanging)
@ -689,7 +683,7 @@ void MainMenu::showAxisMove()
encoderpos=activeline*lcdslow; encoderpos=activeline*lcdslow;
beepshort(); beepshort();
} }
BLOCK; LCD_BLOCK;
} }
if(linechanging) if(linechanging)
{ {
@ -721,7 +715,7 @@ void MainMenu::showAxisMove()
if((activeline!=line) ) if((activeline!=line) )
break; break;
if(CLICKED) if(LCD_CLICKED)
{ {
linechanging=!linechanging; linechanging=!linechanging;
if(linechanging) if(linechanging)
@ -734,7 +728,7 @@ void MainMenu::showAxisMove()
encoderpos=activeline*lcdslow; encoderpos=activeline*lcdslow;
beepshort(); beepshort();
} }
BLOCK; LCD_BLOCK;
} }
if(linechanging) if(linechanging)
{ {
@ -757,11 +751,11 @@ void MainMenu::showAxisMove()
break; break;
case ItemAM_E: case ItemAM_E:
// ErikDB: TODO: this length should be changed for volumetric. // ErikDB: TODO: this length should be changed for volumetric.
MENUITEM( LCD_PRINT_PGM(MSG_EXTRUDE) , BLOCK;enquecommand("G92 E0");enquecommand("G1 F70 E1");beepshort(); ) ; MENUITEM( LCD_PRINT_PGM(MSG_EXTRUDE) , LCD_BLOCK;enquecommand("G92 E0");enquecommand("G1 F70 E1");beepshort(); ) ;
break; break;
case ItemAM_ERetract: case ItemAM_ERetract:
// ErikDB: TODO: this length should be changed for volumetric. // ErikDB: TODO: this length should be changed for volumetric.
MENUITEM( LCD_PRINT_PGM(MSG_RETRACT) , BLOCK;enquecommand("G92 E0");enquecommand("G1 F700 E-1");beepshort(); ) ; MENUITEM( LCD_PRINT_PGM(MSG_RETRACT) , LCD_BLOCK;enquecommand("G92 E0");enquecommand("G1 F700 E-1");beepshort(); ) ;
break; break;
default: default:
break; break;
@ -787,7 +781,7 @@ void MainMenu::showTune()
switch(i) switch(i)
{ {
case ItemT_exit: case ItemT_exit:
MENUITEM( LCD_PRINT_PGM(MSG_MAIN) , BLOCK;status=Main_Menu;beepshort(); ) ; MENUITEM( LCD_PRINT_PGM(MSG_MAIN) , LCD_BLOCK;status=Main_Menu;beepshort(); ) ;
break; break;
case ItemT_speed: case ItemT_speed:
{ {
@ -800,7 +794,7 @@ void MainMenu::showTune()
if((activeline!=line) ) if((activeline!=line) )
break; break;
if(CLICKED) //AnalogWrite(FAN_PIN, fanpwm); if(LCD_CLICKED) //AnalogWrite(FAN_PIN, fanpwm);
{ {
linechanging=!linechanging; linechanging=!linechanging;
if(linechanging) if(linechanging)
@ -812,7 +806,7 @@ void MainMenu::showTune()
encoderpos=activeline*lcdslow; encoderpos=activeline*lcdslow;
beepshort(); beepshort();
} }
BLOCK; LCD_BLOCK;
} }
if(linechanging) if(linechanging)
{ {
@ -835,7 +829,7 @@ void MainMenu::showTune()
if((activeline!=line) ) if((activeline!=line) )
break; break;
if(CLICKED) if(LCD_CLICKED)
{ {
linechanging=!linechanging; linechanging=!linechanging;
if(linechanging) if(linechanging)
@ -848,7 +842,7 @@ void MainMenu::showTune()
encoderpos=activeline*lcdslow; encoderpos=activeline*lcdslow;
beepshort(); beepshort();
} }
BLOCK; LCD_BLOCK;
} }
if(linechanging) if(linechanging)
{ {
@ -869,7 +863,7 @@ void MainMenu::showTune()
if((activeline!=line) ) if((activeline!=line) )
break; break;
if(CLICKED) if(LCD_CLICKED)
{ {
linechanging=!linechanging; linechanging=!linechanging;
if(linechanging) if(linechanging)
@ -882,7 +876,7 @@ void MainMenu::showTune()
encoderpos=activeline*lcdslow; encoderpos=activeline*lcdslow;
beepshort(); beepshort();
} }
BLOCK; LCD_BLOCK;
} }
if(linechanging) if(linechanging)
{ {
@ -899,32 +893,32 @@ void MainMenu::showTune()
if(force_lcd_update) if(force_lcd_update)
{ {
lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_FAN_SPEED); lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_FAN_SPEED);
lcd.setCursor(13,line);lcd.print(ftostr3(FanSpeed)); lcd.setCursor(13,line);lcd.print(ftostr3(fanSpeed));
} }
if((activeline!=line) ) if((activeline!=line) )
break; break;
if(CLICKED) //nalogWrite(FAN_PIN, fanpwm); if(LCD_CLICKED) //nalogWrite(FAN_PIN, fanpwm);
{ {
linechanging=!linechanging; linechanging=!linechanging;
if(linechanging) if(linechanging)
{ {
encoderpos=FanSpeed; encoderpos=fanSpeed;
} }
else else
{ {
encoderpos=activeline*lcdslow; encoderpos=activeline*lcdslow;
beepshort(); beepshort();
} }
BLOCK; LCD_BLOCK;
} }
if(linechanging) if(linechanging)
{ {
if(encoderpos<0) encoderpos=0; if(encoderpos<0) encoderpos=0;
if(encoderpos>255) encoderpos=255; if(encoderpos>255) encoderpos=255;
FanSpeed=encoderpos; fanSpeed=encoderpos;
analogWrite(FAN_PIN, FanSpeed); analogWrite(FAN_PIN, fanSpeed);
lcd.setCursor(13,line);lcd.print(itostr3(encoderpos)); lcd.setCursor(13,line);lcd.print(itostr3(encoderpos));
} }
@ -940,7 +934,7 @@ void MainMenu::showTune()
if((activeline!=line) ) if((activeline!=line) )
break; break;
if(CLICKED) if(LCD_CLICKED)
{ {
linechanging=!linechanging; linechanging=!linechanging;
if(linechanging) if(linechanging)
@ -956,7 +950,7 @@ void MainMenu::showTune()
encoderpos=activeline*lcdslow; encoderpos=activeline*lcdslow;
} }
BLOCK; LCD_BLOCK;
beepshort(); beepshort();
} }
if(linechanging) if(linechanging)
@ -981,7 +975,7 @@ void MainMenu::showTune()
if(force_lcd_update) { lcd.setCursor(0,line); repaint_action; } \ if(force_lcd_update) { lcd.setCursor(0,line); repaint_action; } \
if(activeline==line) \ if(activeline==line) \
{ \ { \
if(CLICKED) \ if(LCD_CLICKED) \
{ \ { \
linechanging=!linechanging; \ linechanging=!linechanging; \
if(linechanging) {enter_action;} \ if(linechanging) {enter_action;} \
@ -1022,7 +1016,7 @@ void MainMenu::showControlTemp()
switch(i) switch(i)
{ {
case ItemCT_exit: case ItemCT_exit:
MENUITEM( LCD_PRINT_PGM(MSG_CONTROL) , BLOCK;status=Main_Control;beepshort(); ) ; MENUITEM( LCD_PRINT_PGM(MSG_CONTROL) , LCD_BLOCK;status=Main_Control;beepshort(); ) ;
break; break;
case ItemCT_nozzle0: case ItemCT_nozzle0:
{ {
@ -1035,7 +1029,7 @@ void MainMenu::showControlTemp()
if((activeline!=line) ) if((activeline!=line) )
break; break;
if(CLICKED) if(LCD_CLICKED)
{ {
linechanging=!linechanging; linechanging=!linechanging;
if(linechanging) if(linechanging)
@ -1048,7 +1042,7 @@ void MainMenu::showControlTemp()
encoderpos=activeline*lcdslow; encoderpos=activeline*lcdslow;
beepshort(); beepshort();
} }
BLOCK; LCD_BLOCK;
} }
if(linechanging) if(linechanging)
{ {
@ -1070,7 +1064,7 @@ void MainMenu::showControlTemp()
if((activeline!=line) ) if((activeline!=line) )
break; break;
if(CLICKED) if(LCD_CLICKED)
{ {
linechanging=!linechanging; linechanging=!linechanging;
if(linechanging) if(linechanging)
@ -1083,7 +1077,7 @@ void MainMenu::showControlTemp()
encoderpos=activeline*lcdslow; encoderpos=activeline*lcdslow;
beepshort(); beepshort();
} }
BLOCK; LCD_BLOCK;
} }
if(linechanging) if(linechanging)
{ {
@ -1106,7 +1100,7 @@ void MainMenu::showControlTemp()
if((activeline!=line) ) if((activeline!=line) )
break; break;
if(CLICKED) if(LCD_CLICKED)
{ {
linechanging=!linechanging; linechanging=!linechanging;
if(linechanging) if(linechanging)
@ -1119,7 +1113,7 @@ void MainMenu::showControlTemp()
encoderpos=activeline*lcdslow; encoderpos=activeline*lcdslow;
beepshort(); beepshort();
} }
BLOCK; LCD_BLOCK;
} }
if(linechanging) if(linechanging)
{ {
@ -1142,7 +1136,7 @@ void MainMenu::showControlTemp()
if((activeline!=line) ) if((activeline!=line) )
break; break;
if(CLICKED) if(LCD_CLICKED)
{ {
linechanging=!linechanging; linechanging=!linechanging;
if(linechanging) if(linechanging)
@ -1155,7 +1149,7 @@ void MainMenu::showControlTemp()
encoderpos=activeline*lcdslow; encoderpos=activeline*lcdslow;
beepshort(); beepshort();
} }
BLOCK; LCD_BLOCK;
} }
if(linechanging) if(linechanging)
{ {
@ -1176,7 +1170,7 @@ void MainMenu::showControlTemp()
if((activeline!=line) ) if((activeline!=line) )
break; break;
if(CLICKED) if(LCD_CLICKED)
{ {
linechanging=!linechanging; linechanging=!linechanging;
if(linechanging) if(linechanging)
@ -1189,7 +1183,7 @@ void MainMenu::showControlTemp()
encoderpos=activeline*lcdslow; encoderpos=activeline*lcdslow;
beepshort(); beepshort();
} }
BLOCK; LCD_BLOCK;
} }
if(linechanging) if(linechanging)
{ {
@ -1210,7 +1204,7 @@ void MainMenu::showControlTemp()
if((activeline!=line) ) if((activeline!=line) )
break; break;
if(CLICKED) if(LCD_CLICKED)
{ {
linechanging=!linechanging; linechanging=!linechanging;
if(linechanging) if(linechanging)
@ -1223,7 +1217,7 @@ void MainMenu::showControlTemp()
encoderpos=activeline*lcdslow; encoderpos=activeline*lcdslow;
beepshort(); beepshort();
} }
BLOCK; LCD_BLOCK;
} }
if(linechanging) if(linechanging)
{ {
@ -1248,7 +1242,7 @@ void MainMenu::showControlTemp()
if((activeline!=line) ) if((activeline!=line) )
break; break;
if(CLICKED) if(LCD_CLICKED)
{ {
autotemp_enabled=!autotemp_enabled; autotemp_enabled=!autotemp_enabled;
lcd.setCursor(13,line); lcd.setCursor(13,line);
@ -1256,7 +1250,7 @@ void MainMenu::showControlTemp()
LCD_PRINT_PGM(MSG_ON); LCD_PRINT_PGM(MSG_ON);
else else
LCD_PRINT_PGM(MSG_OFF); LCD_PRINT_PGM(MSG_OFF);
BLOCK; LCD_BLOCK;
} }
}break; }break;
@ -1273,7 +1267,7 @@ void MainMenu::showControlTemp()
if((activeline!=line) ) if((activeline!=line) )
break; break;
if(CLICKED) if(LCD_CLICKED)
{ {
linechanging=!linechanging; linechanging=!linechanging;
if(linechanging) if(linechanging)
@ -1286,7 +1280,7 @@ void MainMenu::showControlTemp()
encoderpos=activeline*lcdslow; encoderpos=activeline*lcdslow;
beepshort(); beepshort();
} }
BLOCK; LCD_BLOCK;
} }
if(linechanging) if(linechanging)
{ {
@ -1301,32 +1295,32 @@ void MainMenu::showControlTemp()
if(force_lcd_update) if(force_lcd_update)
{ {
lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_FAN_SPEED); lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_FAN_SPEED);
lcd.setCursor(13,line);lcd.print(ftostr3(FanSpeed)); lcd.setCursor(13,line);lcd.print(ftostr3(fanSpeed));
} }
if((activeline!=line) ) if((activeline!=line) )
break; break;
if(CLICKED) //nalogWrite(FAN_PIN, fanpwm); if(LCD_CLICKED) //nalogWrite(FAN_PIN, fanpwm);
{ {
linechanging=!linechanging; linechanging=!linechanging;
if(linechanging) if(linechanging)
{ {
encoderpos=FanSpeed; encoderpos=fanSpeed;
} }
else else
{ {
encoderpos=activeline*lcdslow; encoderpos=activeline*lcdslow;
beepshort(); beepshort();
} }
BLOCK; LCD_BLOCK;
} }
if(linechanging) if(linechanging)
{ {
if(encoderpos<0) encoderpos=0; if(encoderpos<0) encoderpos=0;
if(encoderpos>255) encoderpos=255; if(encoderpos>255) encoderpos=255;
FanSpeed=encoderpos; fanSpeed=encoderpos;
analogWrite(FAN_PIN, FanSpeed); analogWrite(FAN_PIN, fanSpeed);
lcd.setCursor(13,line);lcd.print(itostr3(encoderpos)); lcd.setCursor(13,line);lcd.print(itostr3(encoderpos));
} }
@ -1343,7 +1337,7 @@ void MainMenu::showControlTemp()
if((activeline!=line) ) if((activeline!=line) )
break; break;
if(CLICKED) if(LCD_CLICKED)
{ {
linechanging=!linechanging; linechanging=!linechanging;
if(linechanging) if(linechanging)
@ -1356,7 +1350,7 @@ void MainMenu::showControlTemp()
encoderpos=activeline*lcdslow; encoderpos=activeline*lcdslow;
} }
BLOCK; LCD_BLOCK;
beepshort(); beepshort();
} }
if(linechanging) if(linechanging)
@ -1378,7 +1372,7 @@ void MainMenu::showControlTemp()
if((activeline!=line) ) if((activeline!=line) )
break; break;
if(CLICKED) if(LCD_CLICKED)
{ {
linechanging=!linechanging; linechanging=!linechanging;
if(linechanging) if(linechanging)
@ -1391,7 +1385,7 @@ void MainMenu::showControlTemp()
encoderpos=activeline*lcdslow; encoderpos=activeline*lcdslow;
} }
BLOCK; LCD_BLOCK;
beepshort(); beepshort();
} }
if(linechanging) if(linechanging)
@ -1414,7 +1408,7 @@ void MainMenu::showControlTemp()
break; break;
if(CLICKED) if(LCD_CLICKED)
{ {
linechanging=!linechanging; linechanging=!linechanging;
if(linechanging) if(linechanging)
@ -1427,7 +1421,7 @@ void MainMenu::showControlTemp()
encoderpos=activeline*lcdslow; encoderpos=activeline*lcdslow;
} }
BLOCK; LCD_BLOCK;
beepshort(); beepshort();
} }
if(linechanging) if(linechanging)
@ -1450,7 +1444,7 @@ void MainMenu::showControlTemp()
if((activeline!=line) ) if((activeline!=line) )
break; break;
if(CLICKED) if(LCD_CLICKED)
{ {
linechanging=!linechanging; linechanging=!linechanging;
if(linechanging) if(linechanging)
@ -1463,7 +1457,7 @@ void MainMenu::showControlTemp()
encoderpos=activeline*lcdslow; encoderpos=activeline*lcdslow;
} }
BLOCK; LCD_BLOCK;
beepshort(); beepshort();
} }
if(linechanging) if(linechanging)
@ -1478,10 +1472,10 @@ void MainMenu::showControlTemp()
#endif #endif
break; break;
case ItemCT_PLA_PreHeat_Setting: case ItemCT_PLA_PreHeat_Setting:
MENUITEM( LCD_PRINT_PGM(MSG_PREHEAT_PLA_SETTINGS) , BLOCK;status=Sub_PreheatPLASettings;beepshort(); ) ; MENUITEM( LCD_PRINT_PGM(MSG_PREHEAT_PLA_SETTINGS) , LCD_BLOCK;status=Sub_PreheatPLASettings;beepshort(); ) ;
break; break;
case ItemCT_ABS_PreHeat_Setting: case ItemCT_ABS_PreHeat_Setting:
MENUITEM( LCD_PRINT_PGM(MSG_PREHEAT_ABS_SETTINGS) , BLOCK;status=Sub_PreheatABSSettings;beepshort(); ) ; MENUITEM( LCD_PRINT_PGM(MSG_PREHEAT_ABS_SETTINGS) , LCD_BLOCK;status=Sub_PreheatABSSettings;beepshort(); ) ;
break; break;
default: default:
break; break;
@ -1513,7 +1507,7 @@ void MainMenu::showControlMotion()
switch(i) switch(i)
{ {
case ItemCM_exit: case ItemCM_exit:
MENUITEM( LCD_PRINT_PGM(MSG_CONTROL) , BLOCK;status=Main_Control;beepshort(); ) ; MENUITEM( LCD_PRINT_PGM(MSG_CONTROL) , LCD_BLOCK;status=Main_Control;beepshort(); ) ;
break; break;
case ItemCM_acc: case ItemCM_acc:
{ {
@ -1526,7 +1520,7 @@ void MainMenu::showControlMotion()
if((activeline!=line) ) if((activeline!=line) )
break; break;
if(CLICKED) if(LCD_CLICKED)
{ {
linechanging=!linechanging; linechanging=!linechanging;
if(linechanging) if(linechanging)
@ -1538,7 +1532,7 @@ void MainMenu::showControlMotion()
acceleration= encoderpos*100; acceleration= encoderpos*100;
encoderpos=activeline*lcdslow; encoderpos=activeline*lcdslow;
} }
BLOCK; LCD_BLOCK;
beepshort(); beepshort();
} }
if(linechanging) if(linechanging)
@ -1560,7 +1554,7 @@ void MainMenu::showControlMotion()
if((activeline!=line) ) if((activeline!=line) )
break; break;
if(CLICKED) if(LCD_CLICKED)
{ {
linechanging=!linechanging; linechanging=!linechanging;
if(linechanging) if(linechanging)
@ -1573,7 +1567,7 @@ void MainMenu::showControlMotion()
encoderpos=activeline*lcdslow; encoderpos=activeline*lcdslow;
} }
BLOCK; LCD_BLOCK;
beepshort(); beepshort();
} }
if(linechanging) if(linechanging)
@ -1603,7 +1597,7 @@ void MainMenu::showControlMotion()
if((activeline!=line) ) if((activeline!=line) )
break; break;
if(CLICKED) if(LCD_CLICKED)
{ {
linechanging=!linechanging; linechanging=!linechanging;
if(linechanging) if(linechanging)
@ -1616,7 +1610,7 @@ void MainMenu::showControlMotion()
encoderpos=activeline*lcdslow; encoderpos=activeline*lcdslow;
} }
BLOCK; LCD_BLOCK;
beepshort(); beepshort();
} }
if(linechanging) if(linechanging)
@ -1639,7 +1633,7 @@ void MainMenu::showControlMotion()
if((activeline!=line) ) if((activeline!=line) )
break; break;
if(CLICKED) if(LCD_CLICKED)
{ {
linechanging=!linechanging; linechanging=!linechanging;
if(linechanging) if(linechanging)
@ -1652,7 +1646,7 @@ void MainMenu::showControlMotion()
encoderpos=activeline*lcdslow; encoderpos=activeline*lcdslow;
} }
BLOCK; LCD_BLOCK;
beepshort(); beepshort();
} }
if(linechanging) if(linechanging)
@ -1674,7 +1668,7 @@ void MainMenu::showControlMotion()
if((activeline!=line) ) if((activeline!=line) )
break; break;
if(CLICKED) if(LCD_CLICKED)
{ {
linechanging=!linechanging; linechanging=!linechanging;
if(linechanging) if(linechanging)
@ -1687,7 +1681,7 @@ void MainMenu::showControlMotion()
encoderpos=activeline*lcdslow; encoderpos=activeline*lcdslow;
} }
BLOCK; LCD_BLOCK;
beepshort(); beepshort();
} }
if(linechanging) if(linechanging)
@ -1717,7 +1711,7 @@ void MainMenu::showControlMotion()
if((activeline!=line) ) if((activeline!=line) )
break; break;
if(CLICKED) if(LCD_CLICKED)
{ {
linechanging=!linechanging; linechanging=!linechanging;
if(linechanging) if(linechanging)
@ -1729,7 +1723,7 @@ void MainMenu::showControlMotion()
max_acceleration_units_per_sq_second[i-ItemCM_amaxx]= encoderpos*100; max_acceleration_units_per_sq_second[i-ItemCM_amaxx]= encoderpos*100;
encoderpos=activeline*lcdslow; encoderpos=activeline*lcdslow;
} }
BLOCK; LCD_BLOCK;
beepshort(); beepshort();
} }
if(linechanging) if(linechanging)
@ -1753,7 +1747,7 @@ void MainMenu::showControlMotion()
if((activeline!=line) ) if((activeline!=line) )
break; break;
if(CLICKED) if(LCD_CLICKED)
{ {
linechanging=!linechanging; linechanging=!linechanging;
if(linechanging) if(linechanging)
@ -1766,7 +1760,7 @@ void MainMenu::showControlMotion()
encoderpos=activeline*lcdslow; encoderpos=activeline*lcdslow;
} }
BLOCK; LCD_BLOCK;
beepshort(); beepshort();
} }
if(linechanging) if(linechanging)
@ -1788,7 +1782,7 @@ void MainMenu::showControlMotion()
if((activeline!=line) ) if((activeline!=line) )
break; break;
if(CLICKED) if(LCD_CLICKED)
{ {
linechanging=!linechanging; linechanging=!linechanging;
if(linechanging) if(linechanging)
@ -1803,7 +1797,7 @@ void MainMenu::showControlMotion()
axis_steps_per_unit[X_AXIS]= encoderpos/100.0; axis_steps_per_unit[X_AXIS]= encoderpos/100.0;
encoderpos=activeline*lcdslow; encoderpos=activeline*lcdslow;
} }
BLOCK; LCD_BLOCK;
beepshort(); beepshort();
} }
if(linechanging) if(linechanging)
@ -1825,7 +1819,7 @@ void MainMenu::showControlMotion()
if((activeline!=line) ) if((activeline!=line) )
break; break;
if(CLICKED) if(LCD_CLICKED)
{ {
linechanging=!linechanging; linechanging=!linechanging;
if(linechanging) if(linechanging)
@ -1841,7 +1835,7 @@ void MainMenu::showControlMotion()
encoderpos=activeline*lcdslow; encoderpos=activeline*lcdslow;
} }
BLOCK; LCD_BLOCK;
beepshort(); beepshort();
} }
if(linechanging) if(linechanging)
@ -1863,7 +1857,7 @@ void MainMenu::showControlMotion()
if((activeline!=line) ) if((activeline!=line) )
break; break;
if(CLICKED) if(LCD_CLICKED)
{ {
linechanging=!linechanging; linechanging=!linechanging;
if(linechanging) if(linechanging)
@ -1879,7 +1873,7 @@ void MainMenu::showControlMotion()
encoderpos=activeline*lcdslow; encoderpos=activeline*lcdslow;
} }
BLOCK; LCD_BLOCK;
beepshort(); beepshort();
} }
if(linechanging) if(linechanging)
@ -1902,7 +1896,7 @@ void MainMenu::showControlMotion()
if((activeline!=line) ) if((activeline!=line) )
break; break;
if(CLICKED) if(LCD_CLICKED)
{ {
linechanging=!linechanging; linechanging=!linechanging;
if(linechanging) if(linechanging)
@ -1918,7 +1912,7 @@ void MainMenu::showControlMotion()
encoderpos=activeline*lcdslow; encoderpos=activeline*lcdslow;
} }
BLOCK; LCD_BLOCK;
beepshort(); beepshort();
} }
if(linechanging) if(linechanging)
@ -1958,7 +1952,7 @@ void MainMenu::showControlRetract()
switch(i) switch(i)
{ {
case ItemR_exit: case ItemR_exit:
MENUITEM( LCD_PRINT_PGM(MSG_CONTROL) , BLOCK;status=Main_Control;beepshort(); ) ; MENUITEM( LCD_PRINT_PGM(MSG_CONTROL) , LCD_BLOCK;status=Main_Control;beepshort(); ) ;
break; break;
//float retract_length=2, retract_feedrate=1200, retract_zlift=0.4; //float retract_length=2, retract_feedrate=1200, retract_zlift=0.4;
@ -1978,7 +1972,7 @@ void MainMenu::showControlRetract()
if((activeline!=line) ) if((activeline!=line) )
break; break;
if(CLICKED) if(LCD_CLICKED)
{ {
autoretract_enabled=!autoretract_enabled; autoretract_enabled=!autoretract_enabled;
lcd.setCursor(13,line); lcd.setCursor(13,line);
@ -1986,7 +1980,7 @@ void MainMenu::showControlRetract()
LCD_PRINT_PGM(MSG_ON); LCD_PRINT_PGM(MSG_ON);
else else
LCD_PRINT_PGM(MSG_OFF); LCD_PRINT_PGM(MSG_OFF);
BLOCK; LCD_BLOCK;
} }
}break; }break;
@ -2002,7 +1996,7 @@ void MainMenu::showControlRetract()
if((activeline!=line) ) if((activeline!=line) )
break; break;
if(CLICKED) if(LCD_CLICKED)
{ {
linechanging=!linechanging; linechanging=!linechanging;
if(linechanging) if(linechanging)
@ -2015,7 +2009,7 @@ void MainMenu::showControlRetract()
encoderpos=activeline*lcdslow; encoderpos=activeline*lcdslow;
} }
BLOCK; LCD_BLOCK;
beepshort(); beepshort();
} }
if(linechanging) if(linechanging)
@ -2037,7 +2031,7 @@ void MainMenu::showControlRetract()
if((activeline!=line) ) if((activeline!=line) )
break; break;
if(CLICKED) if(LCD_CLICKED)
{ {
linechanging=!linechanging; linechanging=!linechanging;
if(linechanging) if(linechanging)
@ -2050,7 +2044,7 @@ void MainMenu::showControlRetract()
encoderpos=activeline*lcdslow; encoderpos=activeline*lcdslow;
} }
BLOCK; LCD_BLOCK;
beepshort(); beepshort();
} }
if(linechanging) if(linechanging)
@ -2072,7 +2066,7 @@ void MainMenu::showControlRetract()
if((activeline!=line) ) if((activeline!=line) )
break; break;
if(CLICKED) if(LCD_CLICKED)
{ {
linechanging=!linechanging; linechanging=!linechanging;
if(linechanging) if(linechanging)
@ -2085,7 +2079,7 @@ void MainMenu::showControlRetract()
encoderpos=activeline*lcdslow; encoderpos=activeline*lcdslow;
} }
BLOCK; LCD_BLOCK;
beepshort(); beepshort();
} }
if(linechanging) if(linechanging)
@ -2107,7 +2101,7 @@ void MainMenu::showControlRetract()
if((activeline!=line) ) if((activeline!=line) )
break; break;
if(CLICKED) if(LCD_CLICKED)
{ {
linechanging=!linechanging; linechanging=!linechanging;
if(linechanging) if(linechanging)
@ -2120,7 +2114,7 @@ void MainMenu::showControlRetract()
encoderpos=activeline*lcdslow; encoderpos=activeline*lcdslow;
} }
BLOCK; LCD_BLOCK;
beepshort(); beepshort();
} }
if(linechanging) if(linechanging)
@ -2143,7 +2137,7 @@ void MainMenu::showControlRetract()
if((activeline!=line) ) if((activeline!=line) )
break; break;
if(CLICKED) if(LCD_CLICKED)
{ {
linechanging=!linechanging; linechanging=!linechanging;
if(linechanging) if(linechanging)
@ -2156,7 +2150,7 @@ void MainMenu::showControlRetract()
encoderpos=activeline*lcdslow; encoderpos=activeline*lcdslow;
} }
BLOCK; LCD_BLOCK;
beepshort(); beepshort();
} }
if(linechanging) if(linechanging)
@ -2196,17 +2190,17 @@ void MainMenu::showControl()
switch(i) switch(i)
{ {
case ItemC_exit: case ItemC_exit:
MENUITEM( LCD_PRINT_PGM(MSG_MAIN_WIDE) , BLOCK;status=Main_Menu;beepshort(); ) ; MENUITEM( LCD_PRINT_PGM(MSG_MAIN_WIDE) , LCD_BLOCK;status=Main_Menu;beepshort(); ) ;
break; break;
case ItemC_temp: case ItemC_temp:
MENUITEM( LCD_PRINT_PGM(MSG_TEMPERATURE_WIDE) , BLOCK;status=Sub_TempControl;beepshort(); ) ; MENUITEM( LCD_PRINT_PGM(MSG_TEMPERATURE_WIDE) , LCD_BLOCK;status=Sub_TempControl;beepshort(); ) ;
break; break;
case ItemC_move: case ItemC_move:
MENUITEM( LCD_PRINT_PGM(MSG_MOTION_WIDE) , BLOCK;status=Sub_MotionControl;beepshort(); ) ; MENUITEM( LCD_PRINT_PGM(MSG_MOTION_WIDE) , LCD_BLOCK;status=Sub_MotionControl;beepshort(); ) ;
break; break;
#ifdef FWRETRACT #ifdef FWRETRACT
case ItemC_rectract: case ItemC_rectract:
MENUITEM( LCD_PRINT_PGM(MSG_RECTRACT_WIDE) , BLOCK;status=Sub_RetractControl;beepshort(); ) ; MENUITEM( LCD_PRINT_PGM(MSG_RECTRACT_WIDE) , LCD_BLOCK;status=Sub_RetractControl;beepshort(); ) ;
break; break;
#endif #endif
case ItemC_store: case ItemC_store:
@ -2215,11 +2209,11 @@ void MainMenu::showControl()
{ {
lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_STORE_EPROM); lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_STORE_EPROM);
} }
if((activeline==line) && CLICKED) if((activeline==line) && LCD_CLICKED)
{ {
//enquecommand("M84"); //enquecommand("M84");
beepshort(); beepshort();
BLOCK; LCD_BLOCK;
Config_StoreSettings(); Config_StoreSettings();
} }
}break; }break;
@ -2229,11 +2223,11 @@ void MainMenu::showControl()
{ {
lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_LOAD_EPROM); lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_LOAD_EPROM);
} }
if((activeline==line) && CLICKED) if((activeline==line) && LCD_CLICKED)
{ {
//enquecommand("M84"); //enquecommand("M84");
beepshort(); beepshort();
BLOCK; LCD_BLOCK;
Config_RetrieveSettings(); Config_RetrieveSettings();
} }
}break; }break;
@ -2243,11 +2237,11 @@ void MainMenu::showControl()
{ {
lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_RESTORE_FAILSAFE); lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_RESTORE_FAILSAFE);
} }
if((activeline==line) && CLICKED) if((activeline==line) && LCD_CLICKED)
{ {
//enquecommand("M84"); //enquecommand("M84");
beepshort(); beepshort();
BLOCK; LCD_BLOCK;
Config_ResetDefault(); Config_ResetDefault();
} }
}break; }break;
@ -2288,7 +2282,7 @@ void MainMenu::showSD()
switch(i) switch(i)
{ {
case 0: case 0:
MENUITEM( LCD_PRINT_PGM(MSG_MAIN) , BLOCK;status=Main_Menu;beepshort(); ) ; MENUITEM( LCD_PRINT_PGM(MSG_MAIN) , LCD_BLOCK;status=Main_Menu;beepshort(); ) ;
break; break;
// case 1: // case 1:
// { // {
@ -2305,9 +2299,9 @@ void MainMenu::showSD()
// } // }
// //
// } // }
// if((activeline==line) && CLICKED) // if((activeline==line) && LCD_CLICKED)
// { // {
// BLOCK; // LCD_BLOCK;
// beepshort(); // beepshort();
// card.initsd(); // card.initsd();
// force_lcd_update=true; // force_lcd_update=true;
@ -2322,7 +2316,7 @@ void MainMenu::showSD()
lcd.print(card.filename); lcd.print(card.filename);
lcd.print("/.."); lcd.print("/..");
} , } ,
BLOCK; LCD_BLOCK;
if(SDCARDDETECT == -1) card.initsd(); if(SDCARDDETECT == -1) card.initsd();
card.updir(); card.updir();
enforceupdate=true; enforceupdate=true;
@ -2355,9 +2349,9 @@ void MainMenu::showSD()
lcd.print(card.filename); lcd.print(card.filename);
} }
} }
if((activeline==line) && CLICKED) if((activeline==line) && LCD_CLICKED)
{ {
BLOCK LCD_BLOCK
card.getfilename(i-FIRSTITEM); card.getfilename(i-FIRSTITEM);
if(card.filenameIsDir) if(card.filenameIsDir)
{ {
@ -2381,11 +2375,11 @@ void MainMenu::showSD()
if (card.longFilename[0]) if (card.longFilename[0])
{ {
card.longFilename[LCD_WIDTH-1] = '\0'; card.longFilename[LCD_WIDTH-1] = '\0';
lcd_status(card.longFilename); lcd_setstatus(card.longFilename);
} }
else else
{ {
lcd_status(card.filename); lcd_setstatus(card.filename);
} }
} }
} }
@ -2436,14 +2430,14 @@ void MainMenu::showMainMenu()
switch(i) switch(i)
{ {
case ItemM_watch: case ItemM_watch:
MENUITEM( LCD_PRINT_PGM(MSG_WATCH) , BLOCK;status=Main_Status;beepshort(); ) ; MENUITEM( LCD_PRINT_PGM(MSG_WATCH) , LCD_BLOCK;status=Main_Status;beepshort(); ) ;
break; break;
case ItemM_prepare: case ItemM_prepare:
MENUITEM( if(!tune) LCD_PRINT_PGM(MSG_PREPARE);else LCD_PRINT_PGM(MSG_TUNE); , BLOCK;status=Main_Prepare;beepshort(); ) ; MENUITEM( if(!tune) LCD_PRINT_PGM(MSG_PREPARE);else LCD_PRINT_PGM(MSG_TUNE); , LCD_BLOCK;status=Main_Prepare;beepshort(); ) ;
break; break;
case ItemM_control: case ItemM_control:
MENUITEM( LCD_PRINT_PGM(MSG_CONTROL_ARROW) , BLOCK;status=Main_Control;beepshort(); ) ; MENUITEM( LCD_PRINT_PGM(MSG_CONTROL_ARROW) , LCD_BLOCK;status=Main_Control;beepshort(); ) ;
break; break;
#ifdef SDSUPPORT #ifdef SDSUPPORT
case ItemM_file: case ItemM_file:
@ -2451,7 +2445,7 @@ void MainMenu::showMainMenu()
if(force_lcd_update) if(force_lcd_update)
{ {
lcd.setCursor(0,line); lcd.setCursor(0,line);
if(CARDINSERTED) if(IS_SD_INSERTED)
{ {
if(card.sdprinting) if(card.sdprinting)
LCD_PRINT_PGM(MSG_STOP_PRINT); LCD_PRINT_PGM(MSG_STOP_PRINT);
@ -2463,10 +2457,10 @@ void MainMenu::showMainMenu()
LCD_PRINT_PGM(MSG_NO_CARD); LCD_PRINT_PGM(MSG_NO_CARD);
} }
} }
if(CARDINSERTED&&(activeline==line)&&CLICKED) if(IS_SD_INSERTED&&(activeline==line) && LCD_CLICKED)
{ {
card.printingHasFinished(); card.printingHasFinished();
BLOCK; LCD_BLOCK;
status=Main_SD; status=Main_SD;
beepshort(); beepshort();
} }
@ -2476,7 +2470,7 @@ void MainMenu::showMainMenu()
if(force_lcd_update) if(force_lcd_update)
{ {
lcd.setCursor(0,line); lcd.setCursor(0,line);
if(CARDINSERTED) if(IS_SD_INSERTED)
{ {
if(card.sdprinting) if(card.sdprinting)
LCD_PRINT_PGM(MSG_PAUSE_PRINT); LCD_PRINT_PGM(MSG_PAUSE_PRINT);
@ -2488,7 +2482,7 @@ void MainMenu::showMainMenu()
//LCD_PRINT_PGM(MSG_NO_CARD); //LCD_PRINT_PGM(MSG_NO_CARD);
} }
} }
if(CARDINSERTED && (activeline==line) && CLICKED) if(IS_SD_INSERTED && (activeline==line) && LCD_CLICKED)
{ {
if(card.sdprinting) if(card.sdprinting)
{ {
@ -2535,13 +2529,13 @@ void MainMenu::update()
#if (SDCARDDETECT > -1) #if (SDCARDDETECT > -1)
//This code is only relivant if you have an SDcard detect pin. //This code is only relivant if you have an SDcard detect pin.
static bool oldcardstatus=false; static bool oldcardstatus=false;
if((CARDINSERTED != oldcardstatus)) if((IS_SD_INSERTED != oldcardstatus))
{ {
force_lcd_update=true; force_lcd_update=true;
oldcardstatus=CARDINSERTED; oldcardstatus=IS_SD_INSERTED;
lcd_init(); // to maybe revive the lcd if static electricty killed it. lcd_init(); // to maybe revive the lcd if static electricty killed it.
//Serial.println("echo: SD CHANGE"); //Serial.println("echo: SD CHANGE");
if(CARDINSERTED) if(IS_SD_INSERTED)
{ {
card.initsd(); card.initsd();
LCD_MESSAGEPGM(MSG_SD_INSERTED); LCD_MESSAGEPGM(MSG_SD_INSERTED);
@ -2562,20 +2556,20 @@ void MainMenu::update()
oldstatus=status; oldstatus=status;
} }
if( (encoderpos!=lastencoderpos) || CLICKED) if( (encoderpos!=lastencoderpos) || LCD_CLICKED)
timeoutToStatus=millis()+STATUSTIMEOUT; timeoutToStatus=millis()+LCD_TIMEOUT_TO_STATUS;
switch(status) switch(status)
{ {
case Main_Status: case Main_Status:
{ {
showStatus(); showStatus();
if(CLICKED) if(LCD_CLICKED)
{ {
linechanging=false; linechanging=false;
BLOCK LCD_BLOCK
status=Main_Menu; status=Main_Menu;
timeoutToStatus=millis()+STATUSTIMEOUT; timeoutToStatus=millis()+LCD_TIMEOUT_TO_STATUS;
} }
}break; }break;
case Main_Menu: case Main_Menu:
@ -2653,7 +2647,7 @@ void MainMenu::showPLAsettings()
{ {
case ItemPLAPreHeat_Exit: case ItemPLAPreHeat_Exit:
MENUITEM( LCD_PRINT_PGM(MSG_TEMPERATURE_RTN) , BLOCK;status=Sub_TempControl;beepshort(); ) ; MENUITEM( LCD_PRINT_PGM(MSG_TEMPERATURE_RTN) , LCD_BLOCK;status=Sub_TempControl;beepshort(); ) ;
break; break;
case ItemPLAPreHeat_set_PLA_FanSpeed: case ItemPLAPreHeat_set_PLA_FanSpeed:
@ -2667,7 +2661,7 @@ void MainMenu::showPLAsettings()
if((activeline!=line) ) if((activeline!=line) )
break; break;
if(CLICKED) if(LCD_CLICKED)
{ {
linechanging=!linechanging; linechanging=!linechanging;
if(linechanging) if(linechanging)
@ -2679,7 +2673,7 @@ void MainMenu::showPLAsettings()
encoderpos=activeline*lcdslow; encoderpos=activeline*lcdslow;
beepshort(); beepshort();
} }
BLOCK; LCD_BLOCK;
} }
if(linechanging) if(linechanging)
{ {
@ -2701,7 +2695,7 @@ void MainMenu::showPLAsettings()
if((activeline!=line) ) if((activeline!=line) )
break; break;
if(CLICKED) if(LCD_CLICKED)
{ {
linechanging=!linechanging; linechanging=!linechanging;
if(linechanging) if(linechanging)
@ -2713,7 +2707,7 @@ void MainMenu::showPLAsettings()
encoderpos=activeline*lcdslow; encoderpos=activeline*lcdslow;
beepshort(); beepshort();
} }
BLOCK; LCD_BLOCK;
} }
if(linechanging) if(linechanging)
{ {
@ -2735,7 +2729,7 @@ void MainMenu::showPLAsettings()
if((activeline!=line) ) if((activeline!=line) )
break; break;
if(CLICKED) if(LCD_CLICKED)
{ {
linechanging=!linechanging; linechanging=!linechanging;
if(linechanging) if(linechanging)
@ -2747,7 +2741,7 @@ void MainMenu::showPLAsettings()
encoderpos=activeline*lcdslow; encoderpos=activeline*lcdslow;
beepshort(); beepshort();
} }
BLOCK; LCD_BLOCK;
} }
if(linechanging) if(linechanging)
{ {
@ -2763,11 +2757,11 @@ void MainMenu::showPLAsettings()
{ {
lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_STORE_EPROM); lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_STORE_EPROM);
} }
if((activeline==line) && CLICKED) if((activeline==line) && LCD_CLICKED)
{ {
//enquecommand("M84"); //enquecommand("M84");
beepshort(); beepshort();
BLOCK; LCD_BLOCK;
Config_StoreSettings(); Config_StoreSettings();
} }
}break; }break;
@ -2799,7 +2793,7 @@ void MainMenu::showABSsettings()
{ {
case ItemABSPreHeat_Exit: case ItemABSPreHeat_Exit:
MENUITEM( LCD_PRINT_PGM(MSG_TEMPERATURE_RTN) , BLOCK;status=Sub_TempControl;beepshort(); ) ; MENUITEM( LCD_PRINT_PGM(MSG_TEMPERATURE_RTN) , LCD_BLOCK;status=Sub_TempControl;beepshort(); ) ;
break; break;
case ItemABSPreHeat_set_FanSpeed: case ItemABSPreHeat_set_FanSpeed:
@ -2813,7 +2807,7 @@ void MainMenu::showABSsettings()
if((activeline!=line) ) if((activeline!=line) )
break; break;
if(CLICKED) if(LCD_CLICKED)
{ {
linechanging=!linechanging; linechanging=!linechanging;
if(linechanging) if(linechanging)
@ -2825,7 +2819,7 @@ void MainMenu::showABSsettings()
encoderpos=activeline*lcdslow; encoderpos=activeline*lcdslow;
beepshort(); beepshort();
} }
BLOCK; LCD_BLOCK;
} }
if(linechanging) if(linechanging)
{ {
@ -2847,7 +2841,7 @@ void MainMenu::showABSsettings()
if((activeline!=line) ) if((activeline!=line) )
break; break;
if(CLICKED) if(LCD_CLICKED)
{ {
linechanging=!linechanging; linechanging=!linechanging;
if(linechanging) if(linechanging)
@ -2859,7 +2853,7 @@ void MainMenu::showABSsettings()
encoderpos=activeline*lcdslow; encoderpos=activeline*lcdslow;
beepshort(); beepshort();
} }
BLOCK; LCD_BLOCK;
} }
if(linechanging) if(linechanging)
{ {
@ -2881,7 +2875,7 @@ void MainMenu::showABSsettings()
if((activeline!=line) ) if((activeline!=line) )
break; break;
if(CLICKED) if(LCD_CLICKED)
{ {
linechanging=!linechanging; linechanging=!linechanging;
if(linechanging) if(linechanging)
@ -2893,7 +2887,7 @@ void MainMenu::showABSsettings()
encoderpos=activeline*lcdslow; encoderpos=activeline*lcdslow;
beepshort(); beepshort();
} }
BLOCK; LCD_BLOCK;
} }
if(linechanging) if(linechanging)
{ {
@ -2909,11 +2903,11 @@ void MainMenu::showABSsettings()
{ {
lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_STORE_EPROM); lcd.setCursor(0,line);LCD_PRINT_PGM(MSG_STORE_EPROM);
} }
if((activeline==line) && CLICKED) if((activeline==line) && LCD_CLICKED)
{ {
//enquecommand("M84"); //enquecommand("M84");
beepshort(); beepshort();
BLOCK; LCD_BLOCK;
Config_StoreSettings(); Config_StoreSettings();
} }
}break; }break;

View file

@ -4,38 +4,47 @@
#include "Marlin.h" #include "Marlin.h"
#ifdef ULTRA_LCD #ifdef ULTRA_LCD
#include "language.h"
#if LANGUAGE_CHOICE == 6 #if LANGUAGE_CHOICE == 6
#include "LiquidCrystalRus.h" #include "LiquidCrystalRus.h"
#define LCD_CLASS LiquidCrystalRus #define LCD_CLASS LiquidCrystalRus
#else #else
#include <LiquidCrystal.h> #include <LiquidCrystal.h>
#define LCD_CLASS LiquidCrystal #define LCD_CLASS LiquidCrystal
#endif #endif
void lcd_status(); void lcd_update();
void lcd_init(); void lcd_init();
void lcd_status(const char* message); void lcd_setstatus(const char* message);
void beep(); void lcd_setstatuspgm(const char* message);
void buttons_init(); void lcd_setalertstatuspgm(const char* message);
void buttons_check(); void lcd_buttons_update();
void lcd_buttons_init();
#define LCD_UPDATE_INTERVAL 100 #define LCD_MESSAGEPGM(x) lcd_setstatuspgm(PSTR(x))
#define STATUSTIMEOUT 15000 #define LCD_ALERTMESSAGEPGM(x) lcd_setalertstatuspgm(PSTR(x))
extern LCD_CLASS lcd; #define LCD_UPDATE_INTERVAL 100
#define LCD_TIMEOUT_TO_STATUS 15000
extern volatile char buttons; //the last checked buttons in a bit array. extern volatile uint8_t buttons; //the last checked buttons in a bit array.
#ifdef NEWPANEL extern int plaPreheatHotendTemp;
extern int plaPreheatHPBTemp;
extern int plaPreheatFanSpeed;
extern int absPreheatHotendTemp;
extern int absPreheatHPBTemp;
extern int absPreheatFanSpeed;
#ifdef NEWPANEL
#define EN_C (1<<BLEN_C) #define EN_C (1<<BLEN_C)
#define EN_B (1<<BLEN_B) #define EN_B (1<<BLEN_B)
#define EN_A (1<<BLEN_A) #define EN_A (1<<BLEN_A)
#define CLICKED (buttons&EN_C) #define LCD_CLICKED (buttons&EN_C)
#define BLOCK {blocking=millis()+blocktime;} #define LCD_BLOCK {blocking=millis()+blocktime;}
#else #else
//atomatic, do not change //atomatic, do not change
#define B_LE (1<<BL_LE) #define B_LE (1<<BL_LE)
#define B_UP (1<<BL_UP) #define B_UP (1<<BL_UP)
@ -46,21 +55,9 @@ extern volatile char buttons; //the last checked buttons in a bit array.
#define EN_B (1<<BLEN_B) #define EN_B (1<<BLEN_B)
#define EN_A (1<<BLEN_A) #define EN_A (1<<BLEN_A)
#define CLICKED ((buttons&B_MI)||(buttons&B_ST)) #define LCD_CLICKED ((buttons&B_MI)||(buttons&B_ST))
#define BLOCK {blocking[BL_MI]=millis()+blocktime;blocking[BL_ST]=millis()+blocktime;} #define LCD_BLOCK {blocking[BL_MI]=millis()+blocktime;blocking[BL_ST]=millis()+blocktime;}
#endif #endif
#if (SDCARDDETECT > -1)
#ifdef SDCARDDETECTINVERTED
#define CARDINSERTED (READ(SDCARDDETECT)!=0)
#else
#define CARDINSERTED (READ(SDCARDDETECT)==0)
#endif //SDCARDTETECTINVERTED
#else
//If we don't have a card detect line, aways asume the card is inserted
#define CARDINSERTED true
#endif
// blocking time for recognizing a new keypress of one key, ms // blocking time for recognizing a new keypress of one key, ms
#define blocktime 500 #define blocktime 500
@ -68,6 +65,8 @@ extern volatile char buttons; //the last checked buttons in a bit array.
enum MainStatus{Main_Status, Main_Menu, Main_Prepare,Sub_PrepareMove, Main_Control, Main_SD,Sub_TempControl,Sub_MotionControl,Sub_RetractControl, Sub_PreheatPLASettings, Sub_PreheatABSSettings}; enum MainStatus{Main_Status, Main_Menu, Main_Prepare,Sub_PrepareMove, Main_Control, Main_SD,Sub_TempControl,Sub_MotionControl,Sub_RetractControl, Sub_PreheatPLASettings, Sub_PreheatABSSettings};
extern LCD_CLASS lcd;
class MainMenu{ class MainMenu{
public: public:
MainMenu(); MainMenu();
@ -146,50 +145,29 @@ extern volatile char buttons; //the last checked buttons in a bit array.
} }
} }
}; };
//conversion routines, could need some overworking
char *ftostr51(const float &x);
char *ftostr52(const float &x);
char *ftostr31(const float &x);
char *ftostr3(const float &x);
#define LCD_INIT lcd_init();
#define LCD_MESSAGE(x) lcd_status(x);
#define LCD_MESSAGEPGM(x) lcd_statuspgm(PSTR(x));
#define LCD_ALERTMESSAGEPGM(x) lcd_alertstatuspgm(PSTR(x));
#define LCD_STATUS lcd_status()
#else //no lcd #else //no lcd
#define LCD_INIT FORCE_INLINE void lcd_update() {}
#define LCD_STATUS FORCE_INLINE void lcd_init() {}
#define LCD_MESSAGE(x) FORCE_INLINE void lcd_setstatus(const char* message) {}
FORCE_INLINE void lcd_buttons_init() {}
FORCE_INLINE void lcd_buttons_update() {}
#define LCD_MESSAGEPGM(x) #define LCD_MESSAGEPGM(x)
#define LCD_ALERTMESSAGEPGM(x) #define LCD_ALERTMESSAGEPGM(x)
FORCE_INLINE void lcd_status() {};
#define CLICKED false #define CLICKED false
#define BLOCK ; #define BLOCK ;
#endif #endif
void lcd_statuspgm(const char* message);
void lcd_alertstatuspgm(const char* message);
char *ftostr3(const float &x);
char *itostr2(const uint8_t &x); char *itostr2(const uint8_t &x);
char *ftostr31(const float &x);
char *ftostr32(const float &x);
char *itostr31(const int &xx); char *itostr31(const int &xx);
char *itostr3(const int &xx); char *itostr3(const int &xx);
char *itostr4(const int &xx); char *itostr4(const int &xx);
char *ftostr3(const float &x);
char *ftostr31(const float &x);
char *ftostr32(const float &x);
char *ftostr51(const float &x); char *ftostr51(const float &x);
char *ftostr52(const float &x);
//TODO: These do not belong here.
extern int plaPreheatHotendTemp;
extern int plaPreheatHPBTemp;
extern int plaPreheatFanSpeed;
extern int absPreheatHotendTemp;
extern int absPreheatHPBTemp;
extern int absPreheatFanSpeed;
#endif //ULTRALCD #endif //ULTRALCD