|
|
@ -65,6 +65,7 @@ inline int intround(const float &x){return int(0.5+x);}
|
|
|
|
void lcd_status(const char* message)
|
|
|
|
void lcd_status(const char* message)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
strncpy(messagetext,message,LCD_WIDTH);
|
|
|
|
strncpy(messagetext,message,LCD_WIDTH);
|
|
|
|
|
|
|
|
messagetext[strlen(message)]=0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void lcd_statuspgm(const char* message)
|
|
|
|
void lcd_statuspgm(const char* message)
|
|
|
@ -79,6 +80,7 @@ void lcd_statuspgm(const char* message)
|
|
|
|
cnt++;
|
|
|
|
cnt++;
|
|
|
|
ch=pgm_read_byte(++message);
|
|
|
|
ch=pgm_read_byte(++message);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
*target=0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline void clear()
|
|
|
|
inline void clear()
|
|
|
@ -280,6 +282,7 @@ MainMenu::MainMenu()
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
lcd_init();
|
|
|
|
lcd_init();
|
|
|
|
linechanging=false;
|
|
|
|
linechanging=false;
|
|
|
|
|
|
|
|
tune=false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MainMenu::showStatus()
|
|
|
|
void MainMenu::showStatus()
|
|
|
@ -373,7 +376,11 @@ void MainMenu::showStatus()
|
|
|
|
if(messagetext[0]!='\0')
|
|
|
|
if(messagetext[0]!='\0')
|
|
|
|
{
|
|
|
|
{
|
|
|
|
lcd.setCursor(0,LCD_HEIGHT-1);
|
|
|
|
lcd.setCursor(0,LCD_HEIGHT-1);
|
|
|
|
lcd.print(fillto(LCD_WIDTH,messagetext));
|
|
|
|
lcd.print(messagetext);
|
|
|
|
|
|
|
|
uint8_t n=strlen(messagetext);
|
|
|
|
|
|
|
|
for(int8_t i=0;i<LCD_WIDTH-n;i++)
|
|
|
|
|
|
|
|
lcd.print(" ");
|
|
|
|
|
|
|
|
|
|
|
|
messagetext[0]='\0';
|
|
|
|
messagetext[0]='\0';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -419,7 +426,10 @@ void MainMenu::showStatus()
|
|
|
|
if(messagetext[0]!='\0')
|
|
|
|
if(messagetext[0]!='\0')
|
|
|
|
{
|
|
|
|
{
|
|
|
|
lcd.setCursor(0,LCD_HEIGHT-1);
|
|
|
|
lcd.setCursor(0,LCD_HEIGHT-1);
|
|
|
|
lcd.print(fillto(LCD_WIDTH,messagetext));
|
|
|
|
lcd.print(messagetext);
|
|
|
|
|
|
|
|
uint8_t n=strlen(messagetext);
|
|
|
|
|
|
|
|
for(int8_t i=0;i<LCD_WIDTH-n;i++)
|
|
|
|
|
|
|
|
lcd.print(" ");
|
|
|
|
messagetext[0]='\0';
|
|
|
|
messagetext[0]='\0';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -471,6 +481,166 @@ void MainMenu::showPrepare()
|
|
|
|
updateActiveLines(ItemP_disstep,encoderpos);
|
|
|
|
updateActiveLines(ItemP_disstep,encoderpos);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
enum {ItemT_exit,ItemT_speed,ItemT_flow,ItemT_nozzle,ItemT_fan};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void MainMenu::showTune()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
uint8_t line=0;
|
|
|
|
|
|
|
|
clearIfNecessary();
|
|
|
|
|
|
|
|
for(int8_t i=lineoffset;i<lineoffset+LCD_HEIGHT;i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
//Serial.println((int)(line-lineoffset));
|
|
|
|
|
|
|
|
switch(i)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
case ItemT_exit:
|
|
|
|
|
|
|
|
MENUITEM( lcdprintPGM(" Tune") , BLOCK;status=Main_Menu;beepshort(); ) ;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ItemT_speed:
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if(force_lcd_update)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
lcd.setCursor(0,line);lcdprintPGM(" Speed:");
|
|
|
|
|
|
|
|
lcd.setCursor(13,line);lcd.print(ftostr3(feedmultiply));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if((activeline==line) )
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if(CLICKED) //nalogWrite(FAN_PIN, fanpwm);
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
linechanging=!linechanging;
|
|
|
|
|
|
|
|
if(linechanging)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
encoderpos=feedmultiply;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
encoderpos=activeline*lcdslow;
|
|
|
|
|
|
|
|
beepshort();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
BLOCK;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(linechanging)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if(encoderpos<1) encoderpos=1;
|
|
|
|
|
|
|
|
if(encoderpos>400) encoderpos=400;
|
|
|
|
|
|
|
|
feedmultiply = encoderpos;
|
|
|
|
|
|
|
|
feedmultiplychanged=true;
|
|
|
|
|
|
|
|
lcd.setCursor(13,line);lcd.print(itostr3(encoderpos));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}break;
|
|
|
|
|
|
|
|
case ItemT_nozzle:
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if(force_lcd_update)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
lcd.setCursor(0,line);lcdprintPGM(" \002Nozzle:");
|
|
|
|
|
|
|
|
lcd.setCursor(13,line);lcd.print(ftostr3(intround(degTargetHotend0())));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if((activeline==line) )
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if(CLICKED)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
linechanging=!linechanging;
|
|
|
|
|
|
|
|
if(linechanging)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
encoderpos=intround(degTargetHotend0());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
setTargetHotend0(encoderpos);
|
|
|
|
|
|
|
|
encoderpos=activeline*lcdslow;
|
|
|
|
|
|
|
|
beepshort();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
BLOCK;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(linechanging)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if(encoderpos<0) encoderpos=0;
|
|
|
|
|
|
|
|
if(encoderpos>260) encoderpos=260;
|
|
|
|
|
|
|
|
lcd.setCursor(13,line);lcd.print(itostr3(encoderpos));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case ItemT_fan:
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if(force_lcd_update)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
lcd.setCursor(0,line);lcdprintPGM(" Fan speed:");
|
|
|
|
|
|
|
|
lcd.setCursor(13,line);lcd.print(ftostr3(fanpwm));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if((activeline==line) )
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if(CLICKED) //nalogWrite(FAN_PIN, fanpwm);
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
linechanging=!linechanging;
|
|
|
|
|
|
|
|
if(linechanging)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
encoderpos=fanpwm;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
encoderpos=activeline*lcdslow;
|
|
|
|
|
|
|
|
beepshort();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
BLOCK;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(linechanging)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if(encoderpos<0) encoderpos=0;
|
|
|
|
|
|
|
|
if(encoderpos>255) encoderpos=255;
|
|
|
|
|
|
|
|
fanpwm=encoderpos;
|
|
|
|
|
|
|
|
analogWrite(FAN_PIN, fanpwm);
|
|
|
|
|
|
|
|
lcd.setCursor(13,line);lcd.print(itostr3(encoderpos));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}break;
|
|
|
|
|
|
|
|
case ItemT_flow://axis_steps_per_unit[i] = code_value();
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if(force_lcd_update)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
lcd.setCursor(0,line);lcdprintPGM(" Flow:");
|
|
|
|
|
|
|
|
lcd.setCursor(13,line);lcd.print(itostr4(axis_steps_per_unit[3]));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if((activeline==line) )
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if(CLICKED)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
linechanging=!linechanging;
|
|
|
|
|
|
|
|
if(linechanging)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
encoderpos=(int)axis_steps_per_unit[3];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
float factor=float(encoderpos)/float(axis_steps_per_unit[3]);
|
|
|
|
|
|
|
|
position[E_AXIS]=lround(position[E_AXIS]*factor);
|
|
|
|
|
|
|
|
//current_position[3]*=factor;
|
|
|
|
|
|
|
|
axis_steps_per_unit[E_AXIS]= encoderpos;
|
|
|
|
|
|
|
|
encoderpos=activeline*lcdslow;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
BLOCK;
|
|
|
|
|
|
|
|
beepshort();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(linechanging)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if(encoderpos<5) encoderpos=5;
|
|
|
|
|
|
|
|
if(encoderpos>9999) encoderpos=9999;
|
|
|
|
|
|
|
|
lcd.setCursor(13,line);lcd.print(itostr4(encoderpos));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
line++;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
updateActiveLines(ItemT_fan,encoderpos);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//does not work
|
|
|
|
//does not work
|
|
|
|
// #define MENUCHANGEITEM(repaint_action, enter_action, accept_action, change_action) \
|
|
|
|
// #define MENUCHANGEITEM(repaint_action, enter_action, accept_action, change_action) \
|
|
|
@ -510,7 +680,7 @@ void MainMenu::showControlTemp()
|
|
|
|
if(force_lcd_update)
|
|
|
|
if(force_lcd_update)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
lcd.setCursor(0,line);lcdprintPGM(" \002Nozzle:");
|
|
|
|
lcd.setCursor(0,line);lcdprintPGM(" \002Nozzle:");
|
|
|
|
lcd.setCursor(13,line);lcd.print(ftostr3(intround(degHotend0())));
|
|
|
|
lcd.setCursor(13,line);lcd.print(ftostr3(intround(degTargetHotend0())));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if((activeline==line) )
|
|
|
|
if((activeline==line) )
|
|
|
@ -520,7 +690,7 @@ void MainMenu::showControlTemp()
|
|
|
|
linechanging=!linechanging;
|
|
|
|
linechanging=!linechanging;
|
|
|
|
if(linechanging)
|
|
|
|
if(linechanging)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
encoderpos=intround(degHotend0());
|
|
|
|
encoderpos=intround(degTargetHotend0());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -558,10 +728,7 @@ void MainMenu::showControlTemp()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
fanpwm = constrain(encoderpos,0,255);
|
|
|
|
encoderpos=activeline*lcdslow;
|
|
|
|
encoderpos=fanpwm;
|
|
|
|
|
|
|
|
analogWrite(FAN_PIN, fanpwm);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
beepshort();
|
|
|
|
beepshort();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
BLOCK;
|
|
|
|
BLOCK;
|
|
|
@ -1246,7 +1413,22 @@ void MainMenu::showMainMenu()
|
|
|
|
#ifndef ULTIPANEL
|
|
|
|
#ifndef ULTIPANEL
|
|
|
|
force_lcd_update=false;
|
|
|
|
force_lcd_update=false;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if(tune)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if(!(movesplanned() ||card.sdprinting))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
force_lcd_update=true;
|
|
|
|
|
|
|
|
tune=false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if(movesplanned() ||card.sdprinting)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
force_lcd_update=true;
|
|
|
|
|
|
|
|
tune=true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
clearIfNecessary();
|
|
|
|
clearIfNecessary();
|
|
|
|
for(int8_t line=0;line<LCD_HEIGHT;line++)
|
|
|
|
for(int8_t line=0;line<LCD_HEIGHT;line++)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -1256,7 +1438,7 @@ void MainMenu::showMainMenu()
|
|
|
|
MENUITEM( lcdprintPGM(" Watch") , BLOCK;status=Main_Status;beepshort(); ) ;
|
|
|
|
MENUITEM( lcdprintPGM(" Watch") , BLOCK;status=Main_Status;beepshort(); ) ;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case ItemM_prepare:
|
|
|
|
case ItemM_prepare:
|
|
|
|
MENUITEM( lcdprintPGM(" Prepare \x7E") , BLOCK;status=Main_Prepare;beepshort(); ) ;
|
|
|
|
MENUITEM( if(!tune) lcdprintPGM(" Prepare \x7E");else lcdprintPGM(" Tune \x7E"); , BLOCK;status=Main_Prepare;beepshort(); ) ;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case ItemM_control:
|
|
|
|
case ItemM_control:
|
|
|
@ -1362,8 +1544,15 @@ void MainMenu::update()
|
|
|
|
linechanging=false;
|
|
|
|
linechanging=false;
|
|
|
|
}break;
|
|
|
|
}break;
|
|
|
|
case Main_Prepare:
|
|
|
|
case Main_Prepare:
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if(tune)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
showTune();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
showPrepare();
|
|
|
|
showPrepare();
|
|
|
|
|
|
|
|
}
|
|
|
|
}break;
|
|
|
|
}break;
|
|
|
|
case Main_Control:
|
|
|
|
case Main_Control:
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -1478,26 +1667,6 @@ char *ftostr51(const float &x)
|
|
|
|
return conv;
|
|
|
|
return conv;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
char *fillto(int8_t n,char *c)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
static char ret[25];
|
|
|
|
|
|
|
|
bool endfound=false;
|
|
|
|
|
|
|
|
for(int8_t i=0;i<n;i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
ret[i]=c[i];
|
|
|
|
|
|
|
|
if(c[i]==0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
endfound=true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(endfound)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
ret[i]=' ';
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
ret[n]=0;
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif //ULTRA_LCD
|
|
|
|
#endif //ULTRA_LCD
|
|
|
|
|
|
|
|
|
|
|
|