|
@ -1,6 +1,9 @@ |
|
|
#include "ultralcd.h" |
|
|
#include "ultralcd.h" |
|
|
#ifdef ULTRA_LCD |
|
|
#ifdef ULTRA_LCD |
|
|
#include "Marlin.h" |
|
|
#include "Marlin.h" |
|
|
|
|
|
#include "language.h" |
|
|
|
|
|
#include "temperature.h" |
|
|
|
|
|
#include "EEPROMwrite.h" |
|
|
#include <LiquidCrystal.h> |
|
|
#include <LiquidCrystal.h> |
|
|
//=========================================================================== |
|
|
//=========================================================================== |
|
|
//=============================imported variables============================ |
|
|
//=============================imported variables============================ |
|
@ -13,6 +16,7 @@ extern volatile int extrudemultiply; |
|
|
|
|
|
|
|
|
extern long position[4]; |
|
|
extern long position[4]; |
|
|
#ifdef SDSUPPORT |
|
|
#ifdef SDSUPPORT |
|
|
|
|
|
#include "cardreader.h" |
|
|
extern CardReader card; |
|
|
extern CardReader card; |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
@ -20,7 +24,7 @@ extern CardReader card; |
|
|
//=============================public variables============================ |
|
|
//=============================public variables============================ |
|
|
//=========================================================================== |
|
|
//=========================================================================== |
|
|
volatile char buttons=0; //the last checked buttons in a bit array. |
|
|
volatile char buttons=0; //the last checked buttons in a bit array. |
|
|
int encoderpos=0; |
|
|
long encoderpos=0; |
|
|
short lastenc=0; |
|
|
short lastenc=0; |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -95,6 +99,9 @@ FORCE_INLINE void clear() |
|
|
void lcd_init() |
|
|
void lcd_init() |
|
|
{ |
|
|
{ |
|
|
//beep(); |
|
|
//beep(); |
|
|
|
|
|
#ifdef ULTIPANEL |
|
|
|
|
|
buttons_init(); |
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
byte Degree[8] = |
|
|
byte Degree[8] = |
|
|
{ |
|
|
{ |
|
@ -302,10 +309,6 @@ MainMenu::MainMenu() |
|
|
displayStartingRow=0; |
|
|
displayStartingRow=0; |
|
|
activeline=0; |
|
|
activeline=0; |
|
|
force_lcd_update=true; |
|
|
force_lcd_update=true; |
|
|
#ifdef ULTIPANEL |
|
|
|
|
|
buttons_init(); |
|
|
|
|
|
#endif |
|
|
|
|
|
lcd_init(); |
|
|
|
|
|
linechanging=false; |
|
|
linechanging=false; |
|
|
tune=false; |
|
|
tune=false; |
|
|
} |
|
|
} |
|
@ -881,7 +884,7 @@ void MainMenu::showTune() |
|
|
if(force_lcd_update) |
|
|
if(force_lcd_update) |
|
|
{ |
|
|
{ |
|
|
lcd.setCursor(0,line);lcdprintPGM(MSG_FLOW); |
|
|
lcd.setCursor(0,line);lcdprintPGM(MSG_FLOW); |
|
|
lcd.setCursor(13,line);lcd.print(itostr4(axis_steps_per_unit[3])); |
|
|
lcd.setCursor(13,line);lcd.print(ftostr52(axis_steps_per_unit[E_AXIS])); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if((activeline!=line) ) |
|
|
if((activeline!=line) ) |
|
@ -892,14 +895,14 @@ void MainMenu::showTune() |
|
|
linechanging=!linechanging; |
|
|
linechanging=!linechanging; |
|
|
if(linechanging) |
|
|
if(linechanging) |
|
|
{ |
|
|
{ |
|
|
encoderpos=(int)axis_steps_per_unit[3]; |
|
|
encoderpos=(long)(axis_steps_per_unit[E_AXIS]*100.0); |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
|
float factor=float(encoderpos)/float(axis_steps_per_unit[3]); |
|
|
float factor=float(encoderpos)/100.0/float(axis_steps_per_unit[E_AXIS]); |
|
|
position[E_AXIS]=lround(position[E_AXIS]*factor); |
|
|
position[E_AXIS]=lround(position[E_AXIS]*factor); |
|
|
//current_position[3]*=factor; |
|
|
//current_position[E_AXIS]*=factor; |
|
|
axis_steps_per_unit[E_AXIS]= encoderpos; |
|
|
axis_steps_per_unit[E_AXIS]= encoderpos/100.0; |
|
|
encoderpos=activeline*lcdslow; |
|
|
encoderpos=activeline*lcdslow; |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
@ -909,8 +912,8 @@ void MainMenu::showTune() |
|
|
if(linechanging) |
|
|
if(linechanging) |
|
|
{ |
|
|
{ |
|
|
if(encoderpos<5) encoderpos=5; |
|
|
if(encoderpos<5) encoderpos=5; |
|
|
if(encoderpos>9999) encoderpos=9999; |
|
|
if(encoderpos>999999) encoderpos=999999; |
|
|
lcd.setCursor(13,line);lcd.print(itostr4(encoderpos)); |
|
|
lcd.setCursor(13,line);lcd.print(ftostr52(encoderpos/100.0)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
}break; |
|
|
}break; |
|
@ -1293,7 +1296,7 @@ void MainMenu::showControlTemp() |
|
|
linechanging=!linechanging; |
|
|
linechanging=!linechanging; |
|
|
if(linechanging) |
|
|
if(linechanging) |
|
|
{ |
|
|
{ |
|
|
encoderpos=(int)Kp; |
|
|
encoderpos=(long)Kp; |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
@ -1328,7 +1331,7 @@ void MainMenu::showControlTemp() |
|
|
linechanging=!linechanging; |
|
|
linechanging=!linechanging; |
|
|
if(linechanging) |
|
|
if(linechanging) |
|
|
{ |
|
|
{ |
|
|
encoderpos=(int)(Ki*10/PID_dT); |
|
|
encoderpos=(long)(Ki*10/PID_dT); |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
@ -1364,7 +1367,7 @@ void MainMenu::showControlTemp() |
|
|
linechanging=!linechanging; |
|
|
linechanging=!linechanging; |
|
|
if(linechanging) |
|
|
if(linechanging) |
|
|
{ |
|
|
{ |
|
|
encoderpos=(int)(Kd/5./PID_dT); |
|
|
encoderpos=(long)(Kd/5./PID_dT); |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
@ -1400,7 +1403,7 @@ void MainMenu::showControlTemp() |
|
|
linechanging=!linechanging; |
|
|
linechanging=!linechanging; |
|
|
if(linechanging) |
|
|
if(linechanging) |
|
|
{ |
|
|
{ |
|
|
encoderpos=(int)Kc; |
|
|
encoderpos=(long)Kc; |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
@ -1473,7 +1476,7 @@ void MainMenu::showControlMotion() |
|
|
linechanging=!linechanging; |
|
|
linechanging=!linechanging; |
|
|
if(linechanging) |
|
|
if(linechanging) |
|
|
{ |
|
|
{ |
|
|
encoderpos=(int)acceleration/100; |
|
|
encoderpos=(long)acceleration/100; |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
@ -1507,7 +1510,7 @@ void MainMenu::showControlMotion() |
|
|
linechanging=!linechanging; |
|
|
linechanging=!linechanging; |
|
|
if(linechanging) |
|
|
if(linechanging) |
|
|
{ |
|
|
{ |
|
|
encoderpos=(int)max_xy_jerk; |
|
|
encoderpos=(long)max_xy_jerk; |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
@ -1550,7 +1553,7 @@ void MainMenu::showControlMotion() |
|
|
linechanging=!linechanging; |
|
|
linechanging=!linechanging; |
|
|
if(linechanging) |
|
|
if(linechanging) |
|
|
{ |
|
|
{ |
|
|
encoderpos=(int)max_feedrate[i-ItemCM_vmaxx]; |
|
|
encoderpos=(long)max_feedrate[i-ItemCM_vmaxx]; |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
@ -1586,7 +1589,7 @@ void MainMenu::showControlMotion() |
|
|
linechanging=!linechanging; |
|
|
linechanging=!linechanging; |
|
|
if(linechanging) |
|
|
if(linechanging) |
|
|
{ |
|
|
{ |
|
|
encoderpos=(int)(minimumfeedrate); |
|
|
encoderpos=(long)(minimumfeedrate); |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
@ -1621,7 +1624,7 @@ void MainMenu::showControlMotion() |
|
|
linechanging=!linechanging; |
|
|
linechanging=!linechanging; |
|
|
if(linechanging) |
|
|
if(linechanging) |
|
|
{ |
|
|
{ |
|
|
encoderpos=(int)mintravelfeedrate; |
|
|
encoderpos=(long)mintravelfeedrate; |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
@ -1664,7 +1667,7 @@ void MainMenu::showControlMotion() |
|
|
linechanging=!linechanging; |
|
|
linechanging=!linechanging; |
|
|
if(linechanging) |
|
|
if(linechanging) |
|
|
{ |
|
|
{ |
|
|
encoderpos=(int)max_acceleration_units_per_sq_second[i-ItemCM_amaxx]/100; |
|
|
encoderpos=(long)max_acceleration_units_per_sq_second[i-ItemCM_amaxx]/100; |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
@ -1698,7 +1701,7 @@ void MainMenu::showControlMotion() |
|
|
linechanging=!linechanging; |
|
|
linechanging=!linechanging; |
|
|
if(linechanging) |
|
|
if(linechanging) |
|
|
{ |
|
|
{ |
|
|
encoderpos=(int)retract_acceleration/100; |
|
|
encoderpos=(long)retract_acceleration/100; |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
@ -1722,7 +1725,7 @@ void MainMenu::showControlMotion() |
|
|
if(force_lcd_update) |
|
|
if(force_lcd_update) |
|
|
{ |
|
|
{ |
|
|
lcd.setCursor(0,line);lcdprintPGM(MSG_XSTEPS); |
|
|
lcd.setCursor(0,line);lcdprintPGM(MSG_XSTEPS); |
|
|
lcd.setCursor(11,line);lcd.print(ftostr52(axis_steps_per_unit[0])); |
|
|
lcd.setCursor(11,line);lcd.print(ftostr52(axis_steps_per_unit[X_AXIS])); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if((activeline!=line) ) |
|
|
if((activeline!=line) ) |
|
@ -1733,13 +1736,13 @@ void MainMenu::showControlMotion() |
|
|
linechanging=!linechanging; |
|
|
linechanging=!linechanging; |
|
|
if(linechanging) |
|
|
if(linechanging) |
|
|
{ |
|
|
{ |
|
|
encoderpos=(int)(axis_steps_per_unit[0]*100.0); |
|
|
encoderpos=(long)(axis_steps_per_unit[X_AXIS]*100.0); |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
|
float factor=float(encoderpos)/100.0/float(axis_steps_per_unit[0]); |
|
|
float factor=float(encoderpos)/100.0/float(axis_steps_per_unit[X_AXIS]); |
|
|
position[X_AXIS]=lround(position[X_AXIS]*factor); |
|
|
position[X_AXIS]=lround(position[X_AXIS]*factor); |
|
|
//current_position[3]*=factor; |
|
|
//current_position[X_AXIS]*=factor; |
|
|
axis_steps_per_unit[X_AXIS]= encoderpos/100.0; |
|
|
axis_steps_per_unit[X_AXIS]= encoderpos/100.0; |
|
|
encoderpos=activeline*lcdslow; |
|
|
encoderpos=activeline*lcdslow; |
|
|
} |
|
|
} |
|
@ -1749,7 +1752,7 @@ void MainMenu::showControlMotion() |
|
|
if(linechanging) |
|
|
if(linechanging) |
|
|
{ |
|
|
{ |
|
|
if(encoderpos<5) encoderpos=5; |
|
|
if(encoderpos<5) encoderpos=5; |
|
|
if(encoderpos>32000) encoderpos=32000;//TODO: This is a problem, encoderpos is 16bit, but steps_per_unit for e can be wel over 800 |
|
|
if(encoderpos>999999) encoderpos=999999; |
|
|
lcd.setCursor(11,line);lcd.print(ftostr52(encoderpos/100.0)); |
|
|
lcd.setCursor(11,line);lcd.print(ftostr52(encoderpos/100.0)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -1759,7 +1762,7 @@ void MainMenu::showControlMotion() |
|
|
if(force_lcd_update) |
|
|
if(force_lcd_update) |
|
|
{ |
|
|
{ |
|
|
lcd.setCursor(0,line);lcdprintPGM(MSG_YSTEPS); |
|
|
lcd.setCursor(0,line);lcdprintPGM(MSG_YSTEPS); |
|
|
lcd.setCursor(11,line);lcd.print(ftostr52(axis_steps_per_unit[1])); |
|
|
lcd.setCursor(11,line);lcd.print(ftostr52(axis_steps_per_unit[Y_AXIS])); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if((activeline!=line) ) |
|
|
if((activeline!=line) ) |
|
@ -1770,13 +1773,13 @@ void MainMenu::showControlMotion() |
|
|
linechanging=!linechanging; |
|
|
linechanging=!linechanging; |
|
|
if(linechanging) |
|
|
if(linechanging) |
|
|
{ |
|
|
{ |
|
|
encoderpos=(int)(axis_steps_per_unit[1]*100.0); |
|
|
encoderpos=(long)(axis_steps_per_unit[Y_AXIS]*100.0); |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
|
float factor=float(encoderpos)/100.0/float(axis_steps_per_unit[1]); |
|
|
float factor=float(encoderpos)/100.0/float(axis_steps_per_unit[Y_AXIS]); |
|
|
position[Y_AXIS]=lround(position[Y_AXIS]*factor); |
|
|
position[Y_AXIS]=lround(position[Y_AXIS]*factor); |
|
|
//current_position[3]*=factor; |
|
|
//current_position[Y_AXIS]*=factor; |
|
|
axis_steps_per_unit[Y_AXIS]= encoderpos/100.0; |
|
|
axis_steps_per_unit[Y_AXIS]= encoderpos/100.0; |
|
|
encoderpos=activeline*lcdslow; |
|
|
encoderpos=activeline*lcdslow; |
|
|
|
|
|
|
|
@ -1787,7 +1790,7 @@ void MainMenu::showControlMotion() |
|
|
if(linechanging) |
|
|
if(linechanging) |
|
|
{ |
|
|
{ |
|
|
if(encoderpos<5) encoderpos=5; |
|
|
if(encoderpos<5) encoderpos=5; |
|
|
if(encoderpos>9999) encoderpos=9999; |
|
|
if(encoderpos>999999) encoderpos=999999; |
|
|
lcd.setCursor(11,line);lcd.print(ftostr52(encoderpos/100.0)); |
|
|
lcd.setCursor(11,line);lcd.print(ftostr52(encoderpos/100.0)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -1797,7 +1800,7 @@ void MainMenu::showControlMotion() |
|
|
if(force_lcd_update) |
|
|
if(force_lcd_update) |
|
|
{ |
|
|
{ |
|
|
lcd.setCursor(0,line);lcdprintPGM(MSG_ZSTEPS); |
|
|
lcd.setCursor(0,line);lcdprintPGM(MSG_ZSTEPS); |
|
|
lcd.setCursor(11,line);lcd.print(ftostr52(axis_steps_per_unit[2])); |
|
|
lcd.setCursor(11,line);lcd.print(ftostr52(axis_steps_per_unit[Z_AXIS])); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if((activeline!=line) ) |
|
|
if((activeline!=line) ) |
|
@ -1808,13 +1811,13 @@ void MainMenu::showControlMotion() |
|
|
linechanging=!linechanging; |
|
|
linechanging=!linechanging; |
|
|
if(linechanging) |
|
|
if(linechanging) |
|
|
{ |
|
|
{ |
|
|
encoderpos=(int)(axis_steps_per_unit[2]*100.0); |
|
|
encoderpos=(long)(axis_steps_per_unit[Z_AXIS]*100.0); |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
|
float factor=float(encoderpos)/100.0/float(axis_steps_per_unit[2]); |
|
|
float factor=float(encoderpos)/100.0/float(axis_steps_per_unit[Z_AXIS]); |
|
|
position[Z_AXIS]=lround(position[Z_AXIS]*factor); |
|
|
position[Z_AXIS]=lround(position[Z_AXIS]*factor); |
|
|
//current_position[3]*=factor; |
|
|
//current_position[Z_AXIS]*=factor; |
|
|
axis_steps_per_unit[Z_AXIS]= encoderpos/100.0; |
|
|
axis_steps_per_unit[Z_AXIS]= encoderpos/100.0; |
|
|
encoderpos=activeline*lcdslow; |
|
|
encoderpos=activeline*lcdslow; |
|
|
|
|
|
|
|
@ -1825,7 +1828,7 @@ void MainMenu::showControlMotion() |
|
|
if(linechanging) |
|
|
if(linechanging) |
|
|
{ |
|
|
{ |
|
|
if(encoderpos<5) encoderpos=5; |
|
|
if(encoderpos<5) encoderpos=5; |
|
|
if(encoderpos>9999) encoderpos=9999; |
|
|
if(encoderpos>999999) encoderpos=999999; |
|
|
lcd.setCursor(11,line);lcd.print(ftostr52(encoderpos/100.0)); |
|
|
lcd.setCursor(11,line);lcd.print(ftostr52(encoderpos/100.0)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -1836,7 +1839,7 @@ void MainMenu::showControlMotion() |
|
|
if(force_lcd_update) |
|
|
if(force_lcd_update) |
|
|
{ |
|
|
{ |
|
|
lcd.setCursor(0,line);lcdprintPGM(MSG_ESTEPS); |
|
|
lcd.setCursor(0,line);lcdprintPGM(MSG_ESTEPS); |
|
|
lcd.setCursor(11,line);lcd.print(ftostr52(axis_steps_per_unit[3])); |
|
|
lcd.setCursor(11,line);lcd.print(ftostr52(axis_steps_per_unit[E_AXIS])); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if((activeline!=line) ) |
|
|
if((activeline!=line) ) |
|
@ -1847,13 +1850,13 @@ void MainMenu::showControlMotion() |
|
|
linechanging=!linechanging; |
|
|
linechanging=!linechanging; |
|
|
if(linechanging) |
|
|
if(linechanging) |
|
|
{ |
|
|
{ |
|
|
encoderpos=(int)(axis_steps_per_unit[3]*100.0); |
|
|
encoderpos=(long)(axis_steps_per_unit[E_AXIS]*100.0); |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
|
float factor=float(encoderpos)/100.0/float(axis_steps_per_unit[3]); |
|
|
float factor=float(encoderpos)/100.0/float(axis_steps_per_unit[E_AXIS]); |
|
|
position[E_AXIS]=lround(position[E_AXIS]*factor); |
|
|
position[E_AXIS]=lround(position[E_AXIS]*factor); |
|
|
//current_position[3]*=factor; |
|
|
//current_position[E_AXIS]*=factor; |
|
|
axis_steps_per_unit[E_AXIS]= encoderpos/100.0; |
|
|
axis_steps_per_unit[E_AXIS]= encoderpos/100.0; |
|
|
encoderpos=activeline*lcdslow; |
|
|
encoderpos=activeline*lcdslow; |
|
|
|
|
|
|
|
@ -1864,7 +1867,7 @@ void MainMenu::showControlMotion() |
|
|
if(linechanging) |
|
|
if(linechanging) |
|
|
{ |
|
|
{ |
|
|
if(encoderpos<5) encoderpos=5; |
|
|
if(encoderpos<5) encoderpos=5; |
|
|
if(encoderpos>9999) encoderpos=9999; |
|
|
if(encoderpos>999999) encoderpos=999999; |
|
|
lcd.setCursor(11,line);lcd.print(ftostr52(encoderpos/100.0)); |
|
|
lcd.setCursor(11,line);lcd.print(ftostr52(encoderpos/100.0)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -2105,9 +2108,10 @@ void MainMenu::showMainMenu() |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
clearIfNecessary(); |
|
|
clearIfNecessary(); |
|
|
for(int8_t line=0;line<LCD_HEIGHT;line++) |
|
|
uint8_t line=0; |
|
|
|
|
|
for(int8_t i=lineoffset;i<lineoffset+LCD_HEIGHT;i++) |
|
|
{ |
|
|
{ |
|
|
switch(line) |
|
|
switch(i) |
|
|
{ |
|
|
{ |
|
|
case ItemM_watch: |
|
|
case ItemM_watch: |
|
|
MENUITEM( lcdprintPGM(MSG_WATCH) , BLOCK;status=Main_Status;beepshort(); ) ; |
|
|
MENUITEM( lcdprintPGM(MSG_WATCH) , BLOCK;status=Main_Status;beepshort(); ) ; |
|
@ -2161,6 +2165,7 @@ void MainMenu::showMainMenu() |
|
|
SERIAL_ERRORLNPGM(MSG_SERIAL_ERROR_MENU_STRUCTURE); |
|
|
SERIAL_ERRORLNPGM(MSG_SERIAL_ERROR_MENU_STRUCTURE); |
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
|
|
|
|
line++; |
|
|
} |
|
|
} |
|
|
updateActiveLines(3,encoderpos); |
|
|
updateActiveLines(3,encoderpos); |
|
|
} |
|
|
} |
|
|