Commit 3e24267e authored by MagoKimbra's avatar MagoKimbra

lcd_wait_better

parent fff64606
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
// User-specified version info of this build to display in [Pronterface, etc] terminal window during // User-specified version info of this build to display in [Pronterface, etc] terminal window during
// startup. Implementation of an idea by Prof Braino to inform user that any changes made to this // startup. Implementation of an idea by Prof Braino to inform user that any changes made to this
// build by the user have been successfully uploaded into firmware. // build by the user have been successfully uploaded into firmware.
#define STRING_VERSION_CONFIG_H __DATE__ " 24/11/2014 " __TIME__ // build date and time #define STRING_VERSION_CONFIG_H __DATE__ " 28/11/2014 " __TIME__ // build date and time
#define STRING_CONFIG_H_AUTHOR "(MagoKimbra: magokimbra@hotmail.com, Version 4.0)" // Who made the changes. #define STRING_CONFIG_H_AUTHOR "(MagoKimbra: magokimbra@hotmail.com, Version 4.0)" // Who made the changes.
// SERIAL_PORT selects which serial port should be used for communication with the host. // SERIAL_PORT selects which serial port should be used for communication with the host.
...@@ -43,6 +43,10 @@ ...@@ -43,6 +43,10 @@
// If you want test the firmware uncomment below. The command for run test is M998. Use Serial arduino monitor... // If you want test the firmware uncomment below. The command for run test is M998. Use Serial arduino monitor...
//#define FIRMWARE_TEST //#define FIRMWARE_TEST
#ifdef FIRMWARE_TEST
#undef BAUDRATE
#define BAUDRATE 115200 // Baudrate setting to 115200 because serial monitor arduino fuction at max 115200 baudrate.
#endif
/***********************************************************************\ /***********************************************************************\
**************************** Define type printer ********************** **************************** Define type printer **********************
......
...@@ -1927,7 +1927,7 @@ void process_commands() ...@@ -1927,7 +1927,7 @@ void process_commands()
st_synchronize(); st_synchronize();
codenum += millis(); // keep track of when we started waiting codenum += millis(); // keep track of when we started waiting
previous_millis_cmd = millis(); previous_millis_cmd = millis();
while(millis() < codenum ){ while(millis() < codenum) {
manage_heater(); manage_heater();
manage_inactivity(); manage_inactivity();
lcd_update(); lcd_update();
...@@ -3043,29 +3043,50 @@ void process_commands() ...@@ -3043,29 +3043,50 @@ void process_commands()
case 0: // M0 - Unconditional stop - Wait for user button press on LCD case 0: // M0 - Unconditional stop - Wait for user button press on LCD
case 1: // M1 - Conditional stop - Wait for user button press on LCD case 1: // M1 - Conditional stop - Wait for user button press on LCD
{ {
LCD_MESSAGEPGM(MSG_USERWAIT); char *src = strchr_pointer + 2;
codenum = 0; codenum = 0;
if(code_seen('P')) codenum = code_value(); // milliseconds to wait
if(code_seen('S')) codenum = code_value() * 1000; // seconds to wait
bool hasP = false, hasS = false;
if (code_seen('P')) {
codenum = code_value(); // milliseconds to wait
hasP = codenum > 0;
}
if (code_seen('S')) {
codenum = code_value() * 1000; // seconds to wait
hasS = codenum > 0;
}
starpos = strchr(src, '*');
if (starpos != NULL) *(starpos) = '\0';
while (*src == ' ') ++src;
if (!hasP && !hasS && *src != '\0') {
lcd_setstatus(src);
} else {
LCD_MESSAGEPGM(MSG_USERWAIT);
}
lcd_ignore_click();
st_synchronize(); st_synchronize();
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();
} }
} lcd_ignore_click(false);
else { }else{
while(!lcd_clicked()){ while(!lcd_clicked()){
manage_heater(); manage_heater();
manage_inactivity(); manage_inactivity();
lcd_update(); lcd_update();
} }
} }
LCD_MESSAGEPGM(MSG_RESUMING); if (IS_SD_PRINTING)
LCD_MESSAGEPGM(MSG_RESUMING);
else
LCD_MESSAGEPGM(WELCOME_MSG);
} }
break; break;
#endif #endif
......
...@@ -714,7 +714,7 @@ ...@@ -714,7 +714,7 @@
#define MSG_DISABLE_STEPPERS "Apagar motores" #define MSG_DISABLE_STEPPERS "Apagar motores"
#define MSG_AUTO_HOME "Llevar al origen" #define MSG_AUTO_HOME "Llevar al origen"
#define MSG_BED_SETTING "Bed Setting" #define MSG_BED_SETTING "Bed Setting"
#define MSG_SET_HOME_OFFSETS "Set home offsets" #define MSG_SET_HOME_OFFSETS "Ajustar offsets"
#define MSG_SET_ORIGIN "Establecer cero" #define MSG_SET_ORIGIN "Establecer cero"
#define MSG_PREHEAT_PLA "Precalentar PLA" #define MSG_PREHEAT_PLA "Precalentar PLA"
#define MSG_PREHEAT_PLA0 "Precalentar PLA 1" #define MSG_PREHEAT_PLA0 "Precalentar PLA 1"
...@@ -731,8 +731,8 @@ ...@@ -731,8 +731,8 @@
#define MSG_PREHEAT_ABS_BEDONLY "Precal. ABS Base" #define MSG_PREHEAT_ABS_BEDONLY "Precal. ABS Base"
#define MSG_PREHEAT_ABS_SETTINGS "Ajustar temp. ABS" #define MSG_PREHEAT_ABS_SETTINGS "Ajustar temp. ABS"
#define MSG_COOLDOWN "Enfriar" #define MSG_COOLDOWN "Enfriar"
#define MSG_SWITCH_PS_ON "Switch Power On" #define MSG_SWITCH_PS_ON "Encender"
#define MSG_SWITCH_PS_OFF "Switch Power Off" #define MSG_SWITCH_PS_OFF "Apagar"
#define MSG_EXTRUDE "Extruir" #define MSG_EXTRUDE "Extruir"
#define MSG_RETRACT "Retraer" #define MSG_RETRACT "Retraer"
#define MSG_MOVE_AXIS "Mover ejes" #define MSG_MOVE_AXIS "Mover ejes"
...@@ -776,7 +776,7 @@ ...@@ -776,7 +776,7 @@
#define MSG_Z "z" #define MSG_Z "z"
#define MSG_E "e" #define MSG_E "e"
#define MSG_VMIN "Vmin" #define MSG_VMIN "Vmin"
#define MSG_VTRAV_MIN "VTrav min" #define MSG_VTRAV_MIN "Vvacio min"
#define MSG_AMAX "Amax" #define MSG_AMAX "Amax"
#define MSG_A_RETRACT "A-retrac." #define MSG_A_RETRACT "A-retrac."
#define MSG_XSTEPS "X pasos/mm" #define MSG_XSTEPS "X pasos/mm"
...@@ -824,14 +824,14 @@ ...@@ -824,14 +824,14 @@
#define MSG_CONTROL_ARROW "Control" #define MSG_CONTROL_ARROW "Control"
#define MSG_RETRACT_ARROW "Retraer" #define MSG_RETRACT_ARROW "Retraer"
#define MSG_STEPPER_RELEASED "Desacoplada." #define MSG_STEPPER_RELEASED "Desacoplada."
#define MSG_ZPROBE_OUT "Z probe out. bed" #define MSG_ZPROBE_OUT "sonda Z fuera"
#define MSG_POSITION_UNKNOWN "Home X/Y before Z" #define MSG_POSITION_UNKNOWN "Reiniciar X/Y y Z"
#define MSG_ZPROBE_ZOFFSET "Z Offset" #define MSG_ZPROBE_ZOFFSET "Offset Z"
#define MSG_BABYSTEP_X "Babystep X" #define MSG_BABYSTEP_X "Babystep X"
#define MSG_BABYSTEP_Y "Babystep Y" #define MSG_BABYSTEP_Y "Babystep Y"
#define MSG_BABYSTEP_Z "Babystep Z" #define MSG_BABYSTEP_Z "Babystep Z"
#define MSG_ENDSTOP_ABORT "Endstop abort" #define MSG_ENDSTOP_ABORT "Endstop abort"
#define MSG_CONTRAST "Contrast" #define MSG_CONTRAST "Contraste"
#define MSG_LASER "Laser Preset" #define MSG_LASER "Laser Preset"
#define MSG_CONFIG "Configuration" #define MSG_CONFIG "Configuration"
#define MSG_BAUDRATE "Baudrate" #define MSG_BAUDRATE "Baudrate"
...@@ -1023,7 +1023,7 @@ ...@@ -1023,7 +1023,7 @@
#define MSG_MOVE_01MM "Muovi 0.1mm" #define MSG_MOVE_01MM "Muovi 0.1mm"
#define MSG_MOVE_1MM "Muovi 1mm" #define MSG_MOVE_1MM "Muovi 1mm"
#define MSG_MOVE_10MM "Muovi 10mm" #define MSG_MOVE_10MM "Muovi 10mm"
#define MSG_SPEED "Velcit�" #define MSG_SPEED "Velocità"
#define MSG_NOZZLE "Ugello" #define MSG_NOZZLE "Ugello"
#define MSG_NOZZLE1 "Ugello2" #define MSG_NOZZLE1 "Ugello2"
#define MSG_NOZZLE2 "Ugello3" #define MSG_NOZZLE2 "Ugello3"
......
...@@ -170,6 +170,8 @@ bool lcd_oldcardstatus; ...@@ -170,6 +170,8 @@ bool lcd_oldcardstatus;
menuFunc_t currentMenu = lcd_status_screen; /* function pointer to the currently active menu */ menuFunc_t currentMenu = lcd_status_screen; /* function pointer to the currently active menu */
uint32_t lcd_next_update_millis; uint32_t lcd_next_update_millis;
uint8_t lcd_status_update_delay; uint8_t lcd_status_update_delay;
bool ignore_click = false;
bool wait_for_unclick;
uint8_t lcdDrawUpdate = 2; /* Set to none-zero when the LCD needs to draw, decreased after every draw. Set to 2 in LCD routines so the LCD gets at least 1 full redraw (first redraw is partial) */ uint8_t lcdDrawUpdate = 2; /* Set to none-zero when the LCD needs to draw, decreased after every draw. Set to 2 in LCD routines so the LCD gets at least 1 full redraw (first redraw is partial) */
//prevMenu and prevEncoderPosition are used to store the previous menu location when editing settings. //prevMenu and prevEncoderPosition are used to store the previous menu location when editing settings.
...@@ -197,7 +199,26 @@ static void lcd_status_screen() ...@@ -197,7 +199,26 @@ static void lcd_status_screen()
lcd_status_update_delay = 10; /* redraw the main screen every second. This is easier then trying keep track of all things that change on the screen */ lcd_status_update_delay = 10; /* redraw the main screen every second. This is easier then trying keep track of all things that change on the screen */
} }
#ifdef ULTIPANEL #ifdef ULTIPANEL
if (LCD_CLICKED)
bool current_click = LCD_CLICKED;
if (ignore_click) {
if (wait_for_unclick) {
if (!current_click) {
ignore_click = wait_for_unclick = false;
}
else {
current_click = false;
}
}
else if (current_click) {
lcd_quick_feedback();
wait_for_unclick = true;
current_click = false;
}
}
if (current_click)
{ {
currentMenu = lcd_main_menu; currentMenu = lcd_main_menu;
encoderPosition = 0; encoderPosition = 0;
...@@ -1520,6 +1541,12 @@ void lcd_update() ...@@ -1520,6 +1541,12 @@ void lcd_update()
} }
} }
void lcd_ignore_click(bool b)
{
ignore_click = b;
wait_for_unclick = false;
}
void lcd_setstatus(const char* message) void lcd_setstatus(const char* message)
{ {
if (lcd_status_message_level > 0) if (lcd_status_message_level > 0)
......
...@@ -52,6 +52,8 @@ ...@@ -52,6 +52,8 @@
void lcd_buzz(long duration,uint16_t freq); void lcd_buzz(long duration,uint16_t freq);
bool lcd_clicked(); bool lcd_clicked();
void lcd_ignore_click(bool b=true);
#ifdef NEWPANEL #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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment