Added a structure that will allow easy translations/modifications to the LCD menu.

Signed-off-by: Blair Thompson <mail@justblair.co.uk>
This commit is contained in:
Blair Thompson
2012-02-20 22:22:46 +00:00
parent a05a261b72
commit fe940a142d
19 changed files with 1766 additions and 61 deletions

View File

@@ -122,7 +122,7 @@ void lcd_init()
lcd.createChar(3,uplevel);
lcd.createChar(4,refresh);
lcd.createChar(5,folder);
LCD_MESSAGEPGM("UltiMarlin ready.");
LCD_MESSAGEPGM(WELCOME_MSG);
}
@@ -464,25 +464,25 @@ void MainMenu::showPrepare()
switch(i)
{
case ItemP_exit:
MENUITEM( lcdprintPGM(" Main \003") , BLOCK;status=Main_Menu;beepshort(); ) ;
MENUITEM( lcdprintPGM(MSG_MAIN) , BLOCK;status=Main_Menu;beepshort(); ) ;
break;
case ItemP_autostart:
MENUITEM( lcdprintPGM(" Autostart") , BLOCK;card.lastnr=0;card.setroot();card.checkautostart(true);beepshort(); ) ;
MENUITEM( lcdprintPGM(MSG_AUTOSTART) , BLOCK;card.lastnr=0;card.setroot();card.checkautostart(true);beepshort(); ) ;
break;
case ItemP_disstep:
MENUITEM( lcdprintPGM(" Disable Steppers") , BLOCK;enquecommand("M84");beepshort(); ) ;
MENUITEM( lcdprintPGM(MSG_DISABLE_STEPPERS) , BLOCK;enquecommand("M84");beepshort(); ) ;
break;
case ItemP_home:
MENUITEM( lcdprintPGM(" Auto Home") , BLOCK;enquecommand("G28 X-105 Y-105 Z0");beepshort(); ) ;
MENUITEM( lcdprintPGM(MSG_AUTO_HOME) , BLOCK;enquecommand("G28 X-105 Y-105 Z0");beepshort(); ) ;
break;
case ItemP_origin:
MENUITEM( lcdprintPGM(" Set Origin") , BLOCK;enquecommand("G92 X0 Y0 Z0");beepshort(); ) ;
MENUITEM( lcdprintPGM(MSG_SET_ORIGIN) , BLOCK;enquecommand("G92 X0 Y0 Z0");beepshort(); ) ;
break;
case ItemP_preheat:
MENUITEM( lcdprintPGM(" Preheat") , BLOCK;setTargetHotend0(170);setTargetBed(70);beepshort(); ) ;
MENUITEM( lcdprintPGM(MSG_PREHEAT) , BLOCK;setTargetHotend0(170);setTargetBed(70);beepshort(); ) ;
break;
case ItemP_cooldown:
MENUITEM( lcdprintPGM(" Cooldown") , BLOCK;setTargetHotend0(0);setTargetBed(0);beepshort(); ) ;
MENUITEM( lcdprintPGM(MSG_COOLDOWN) , BLOCK;setTargetHotend0(0);setTargetBed(0);beepshort(); ) ;
break;
case ItemP_extrude:
MENUITEM( lcdprintPGM(" Extrude") , BLOCK;enquecommand("G92 E0");enquecommand("G1 F700 E50");beepshort(); ) ;
@@ -513,13 +513,13 @@ void MainMenu::showTune()
switch(i)
{
case ItemT_exit:
MENUITEM( lcdprintPGM(" Main \003") , BLOCK;status=Main_Menu;beepshort(); ) ;
MENUITEM( lcdprintPGM(MSG_MAIN) , BLOCK;status=Main_Menu;beepshort(); ) ;
break;
case ItemT_speed:
{
if(force_lcd_update)
{
lcd.setCursor(0,line);lcdprintPGM(" Speed:");
lcd.setCursor(0,line);lcdprintPGM(MSG_SPEED);
lcd.setCursor(13,line);lcd.print(ftostr3(feedmultiply));
}
@@ -554,7 +554,7 @@ void MainMenu::showTune()
{
if(force_lcd_update)
{
lcd.setCursor(0,line);lcdprintPGM(" \002Nozzle:");
lcd.setCursor(0,line);lcdprintPGM(MSG_NOZZLE);
lcd.setCursor(13,line);lcd.print(ftostr3(intround(degTargetHotend0())));
}
@@ -588,7 +588,7 @@ void MainMenu::showTune()
{
if(force_lcd_update)
{
lcd.setCursor(0,line);lcdprintPGM(" \002Bed:");
lcd.setCursor(0,line);lcdprintPGM(MSG_BED);
lcd.setCursor(13,line);lcd.print(ftostr3(intround(degTargetBed())));
}
@@ -659,7 +659,7 @@ void MainMenu::showTune()
{
if(force_lcd_update)
{
lcd.setCursor(0,line);lcdprintPGM(" Flow:");
lcd.setCursor(0,line);lcdprintPGM(MSG_FLOW);
lcd.setCursor(13,line);lcd.print(itostr4(axis_steps_per_unit[3]));
}
@@ -740,13 +740,13 @@ void MainMenu::showControlTemp()
switch(i)
{
case ItemCT_exit:
MENUITEM( lcdprintPGM(" Control \003") , BLOCK;status=Main_Control;beepshort(); ) ;
MENUITEM( lcdprintPGM(MSG_CONTROL) , BLOCK;status=Main_Control;beepshort(); ) ;
break;
case ItemCT_nozzle:
{
if(force_lcd_update)
{
lcd.setCursor(0,line);lcdprintPGM(" \002Nozzle:");
lcd.setCursor(0,line);lcdprintPGM(MSG_NOZZLE);
lcd.setCursor(13,line);lcd.print(ftostr3(intround(degTargetHotend0())));
}
@@ -781,7 +781,7 @@ void MainMenu::showControlTemp()
{
if(force_lcd_update)
{
lcd.setCursor(0,line);lcdprintPGM(" \002 Min:");
lcd.setCursor(0,line);lcdprintPGM(MSG_MIN);
lcd.setCursor(13,line);lcd.print(ftostr3(autotemp_min));
}
@@ -815,7 +815,7 @@ void MainMenu::showControlTemp()
{
if(force_lcd_update)
{
lcd.setCursor(0,line);lcdprintPGM(" \002 Max:");
lcd.setCursor(0,line);lcdprintPGM(MSG_MAX);
lcd.setCursor(13,line);lcd.print(ftostr3(autotemp_max));
}
@@ -849,7 +849,7 @@ void MainMenu::showControlTemp()
{
if(force_lcd_update)
{
lcd.setCursor(0,line);lcdprintPGM(" \002 Fact:");
lcd.setCursor(0,line);lcdprintPGM(MSG_FACTOR);
lcd.setCursor(13,line);lcd.print(ftostr32(autotemp_factor));
}
@@ -883,12 +883,12 @@ void MainMenu::showControlTemp()
{
if(force_lcd_update)
{
lcd.setCursor(0,line);lcdprintPGM(" Autotemp:");
lcd.setCursor(0,line);lcdprintPGM(MSG_AUTOTEMP);
lcd.setCursor(13,line);
if(autotemp_enabled)
lcdprintPGM("On");
lcdprintPGM(MSG_ON);
else
lcdprintPGM("Off");
lcdprintPGM(MSG_OFF);
}
if((activeline!=line) )
@@ -899,9 +899,9 @@ void MainMenu::showControlTemp()
autotemp_enabled=!autotemp_enabled;
lcd.setCursor(13,line);
if(autotemp_enabled)
lcdprintPGM("On ");
lcdprintPGM(MSG_ON);
else
lcdprintPGM("Off");
lcdprintPGM(MSG_OFF);
BLOCK;
}
@@ -912,7 +912,7 @@ void MainMenu::showControlTemp()
{
if(force_lcd_update)
{
lcd.setCursor(0,line);lcdprintPGM(" \002Bed:");
lcd.setCursor(0,line);lcdprintPGM(MSG_BED);
lcd.setCursor(13,line);lcd.print(ftostr3(intround(degTargetBed())));
}
@@ -946,7 +946,7 @@ void MainMenu::showControlTemp()
{
if(force_lcd_update)
{
lcd.setCursor(0,line);lcdprintPGM(" Fan speed:");
lcd.setCursor(0,line);lcdprintPGM(MSG_FAN_SPEED);
lcd.setCursor(13,line);lcd.print(ftostr3(fanpwm));
}
@@ -1016,7 +1016,7 @@ void MainMenu::showControlTemp()
{
if(force_lcd_update)
{
lcd.setCursor(0,line);lcdprintPGM(" PID-I: ");
lcd.setCursor(0,line);lcdprintPGM(MSG_PID_I);
lcd.setCursor(13,line);lcd.print(ftostr51(Ki/PID_dT));
}
@@ -1051,7 +1051,7 @@ void MainMenu::showControlTemp()
{
if(force_lcd_update)
{
lcd.setCursor(0,line);lcdprintPGM(" PID-D: ");
lcd.setCursor(0,line);lcdprintPGM(MSG_PID_D);
lcd.setCursor(13,line);lcd.print(itostr4(Kd*PID_dT));
}
@@ -1088,7 +1088,7 @@ void MainMenu::showControlTemp()
{
if(force_lcd_update)
{
lcd.setCursor(0,line);lcdprintPGM(" PID-C: ");
lcd.setCursor(0,line);lcdprintPGM(MSG_PID_C);
lcd.setCursor(13,line);lcd.print(itostr3(Kc));
}
@@ -1154,13 +1154,13 @@ void MainMenu::showControlMotion()
switch(i)
{
case ItemCM_exit:
MENUITEM( lcdprintPGM(" Control \003") , BLOCK;status=Main_Control;beepshort(); ) ;
MENUITEM( lcdprintPGM(MSG_CONTROL) , BLOCK;status=Main_Control;beepshort(); ) ;
break;
case ItemCM_acc:
{
if(force_lcd_update)
{
lcd.setCursor(0,line);lcdprintPGM(" Acc:");
lcd.setCursor(0,line);lcdprintPGM(MSG_ACC);
lcd.setCursor(13,line);lcd.print(itostr3(acceleration/100));lcdprintPGM("00");
}
@@ -1194,7 +1194,7 @@ void MainMenu::showControlMotion()
{
if(force_lcd_update)
{
lcd.setCursor(0,line);lcdprintPGM(" Vxy-jerk: ");
lcd.setCursor(0,line);lcdprintPGM(MSG_VXY_JERK);
lcd.setCursor(13,line);lcd.print(itostr3(max_xy_jerk));
}
@@ -1233,11 +1233,11 @@ void MainMenu::showControlMotion()
{
if(force_lcd_update)
{
lcd.setCursor(0,line);lcdprintPGM(" Vmax ");
if(i==ItemCM_vmaxx)lcdprintPGM("x:");
if(i==ItemCM_vmaxy)lcdprintPGM("y:");
if(i==ItemCM_vmaxz)lcdprintPGM("z:");
if(i==ItemCM_vmaxe)lcdprintPGM("e:");
lcd.setCursor(0,line);lcdprintPGM(MSG_VMAX);
if(i==ItemCM_vmaxx)lcdprintPGM(MSG_X);
if(i==ItemCM_vmaxy)lcdprintPGM(MSG_Y);
if(i==ItemCM_vmaxz)lcdprintPGM(MSG_Z);
if(i==ItemCM_vmaxe)lcdprintPGM(MSG_E);
lcd.setCursor(13,line);lcd.print(itostr3(max_feedrate[i-ItemCM_vmaxx]));
}
@@ -1273,7 +1273,7 @@ void MainMenu::showControlMotion()
{
if(force_lcd_update)
{
lcd.setCursor(0,line);lcdprintPGM(" Vmin:");
lcd.setCursor(0,line);lcdprintPGM(MSG_VMIN);
lcd.setCursor(13,line);lcd.print(itostr3(minimumfeedrate));
}
@@ -1308,7 +1308,7 @@ void MainMenu::showControlMotion()
{
if(force_lcd_update)
{
lcd.setCursor(0,line);lcdprintPGM(" VTrav min:");
lcd.setCursor(0,line);lcdprintPGM(MSG_VTRAV_MIN);
lcd.setCursor(13,line);lcd.print(itostr3(mintravelfeedrate));
}
@@ -1348,10 +1348,10 @@ void MainMenu::showControlMotion()
if(force_lcd_update)
{
lcd.setCursor(0,line);lcdprintPGM(" Amax ");
if(i==ItemCM_amaxx)lcdprintPGM("x:");
if(i==ItemCM_amaxy)lcdprintPGM("y:");
if(i==ItemCM_amaxz)lcdprintPGM("z:");
if(i==ItemCM_amaxe)lcdprintPGM("e:");
if(i==ItemCM_amaxx)lcdprintPGM(MSG_X);
if(i==ItemCM_amaxy)lcdprintPGM(MSG_Y);
if(i==ItemCM_amaxz)lcdprintPGM(MSG_Z);
if(i==ItemCM_amaxe)lcdprintPGM(MSG_E);
lcd.setCursor(13,line);lcd.print(itostr3(max_acceleration_units_per_sq_second[i-ItemCM_amaxx]/100));lcdprintPGM("00");
}
@@ -1385,7 +1385,7 @@ void MainMenu::showControlMotion()
{
if(force_lcd_update)
{
lcd.setCursor(0,line);lcdprintPGM(" A-retract:");
lcd.setCursor(0,line);lcdprintPGM(MSG_A_RETRACT);
lcd.setCursor(13,line);lcd.print(ftostr3(retract_acceleration/100));lcdprintPGM("00");
}
@@ -1420,7 +1420,7 @@ void MainMenu::showControlMotion()
{
if(force_lcd_update)
{
lcd.setCursor(0,line);lcdprintPGM(" Esteps/mm:");
lcd.setCursor(0,line);lcdprintPGM(MSG_ESTEPS);
lcd.setCursor(13,line);lcd.print(itostr4(axis_steps_per_unit[3]));
}
@@ -1477,19 +1477,19 @@ void MainMenu::showControl()
switch(i)
{
case ItemC_exit:
MENUITEM( lcdprintPGM(" Main \003") , BLOCK;status=Main_Menu;beepshort(); ) ;
MENUITEM( lcdprintPGM(MSG_MAIN_WIDE) , BLOCK;status=Main_Menu;beepshort(); ) ;
break;
case ItemC_temp:
MENUITEM( lcdprintPGM(" Temperature \x7E") , BLOCK;status=Sub_TempControl;beepshort(); ) ;
MENUITEM( lcdprintPGM(MSG_TEMPERATURE_WIDE) , BLOCK;status=Sub_TempControl;beepshort(); ) ;
break;
case ItemC_move:
MENUITEM( lcdprintPGM(" Motion \x7E") , BLOCK;status=Sub_MotionControl;beepshort(); ) ;
MENUITEM( lcdprintPGM(MSG_MOTION_WIDE) , BLOCK;status=Sub_MotionControl;beepshort(); ) ;
break;
case ItemC_store:
{
if(force_lcd_update)
{
lcd.setCursor(0,line);lcdprintPGM(" Store EPROM");
lcd.setCursor(0,line);lcdprintPGM(MSG_STORE_EPROM);
}
if((activeline==line) && CLICKED)
{
@@ -1503,7 +1503,7 @@ void MainMenu::showControl()
{
if(force_lcd_update)
{
lcd.setCursor(0,line);lcdprintPGM(" Load EPROM");
lcd.setCursor(0,line);lcdprintPGM(MSG_LOAD_EPROM);
}
if((activeline==line) && CLICKED)
{
@@ -1517,7 +1517,7 @@ void MainMenu::showControl()
{
if(force_lcd_update)
{
lcd.setCursor(0,line);lcdprintPGM(" Restore Failsafe");
lcd.setCursor(0,line);lcdprintPGM(MSG_RESTORE_FAILSAFE);
}
if((activeline==line) && CLICKED)
{
@@ -1564,7 +1564,7 @@ void MainMenu::showSD()
switch(i)
{
case 0:
MENUITEM( lcdprintPGM(" Main \003") , BLOCK;status=Main_Menu;beepshort(); ) ;
MENUITEM( lcdprintPGM(MSG_MAIN) , BLOCK;status=Main_Menu;beepshort(); ) ;
break;
// case 1:
// {
@@ -1595,7 +1595,7 @@ void MainMenu::showSD()
// }
// }break;
case 1:
MENUITEM( lcd.print(" ");card.getWorkDirName();if(card.filename[0]=='/') lcdprintPGM("\004Refresh");else {lcd.print("\005");lcd.print(card.filename);lcd.print("/..");} , BLOCK;card.updir();enforceupdate=true;lineoffset=0;beepshort(); ) ;
MENUITEM( lcd.print(" ");card.getWorkDirName();if(card.filename[0]=='/') lcdprintPGM(MSG_REFRESH);else {lcd.print("\005");lcd.print(card.filename);lcd.print("/..");} , BLOCK;card.updir();enforceupdate=true;lineoffset=0;beepshort(); ) ;
break;
default:
@@ -1682,14 +1682,14 @@ void MainMenu::showMainMenu()
switch(line)
{
case ItemM_watch:
MENUITEM( lcdprintPGM(" Watch \003") , BLOCK;status=Main_Status;beepshort(); ) ;
MENUITEM( lcdprintPGM(MSG_WATCH) , BLOCK;status=Main_Status;beepshort(); ) ;
break;
case ItemM_prepare:
MENUITEM( if(!tune) lcdprintPGM(" Prepare \x7E");else lcdprintPGM(" Tune \x7E"); , BLOCK;status=Main_Prepare;beepshort(); ) ;
MENUITEM( if(!tune) lcdprintPGM(MSG_PREPARE);else lcdprintPGM(MSG_TUNE); , BLOCK;status=Main_Prepare;beepshort(); ) ;
break;
case ItemM_control:
MENUITEM( lcdprintPGM(" Control \x7E") , BLOCK;status=Main_Control;beepshort(); ) ;
MENUITEM( lcdprintPGM(MSG_CONTROL_ARROW) , BLOCK;status=Main_Control;beepshort(); ) ;
break;
#ifdef SDSUPPORT
case ItemM_file:
@@ -1704,13 +1704,13 @@ void MainMenu::showMainMenu()
#endif
{
if(card.sdprinting)
lcdprintPGM(" Stop Print \x7E");
lcdprintPGM(MSG_STOP_PRINT);
else
lcdprintPGM(" Card Menu \x7E");
lcdprintPGM(MSG_CARD_MENU);
}
else
{
lcdprintPGM(" No Card");
lcdprintPGM(MSG_NO_CARD);
}
}
#ifdef CARDINSERTED
@@ -1730,7 +1730,7 @@ void MainMenu::showMainMenu()
#endif
default:
SERIAL_ERROR_START;
SERIAL_ERRORLNPGM("Something is wrong in the MenuStructure.");
SERIAL_ERRORLNPGM(MSG_SERIAL_ERROR_MENU_STRUCTURE);
break;
}
}
@@ -1751,12 +1751,12 @@ void MainMenu::update()
if(CARDINSERTED)
{
card.initsd();
LCD_MESSAGEPGM("Card inserted");
LCD_MESSAGEPGM(MSG_SD_INSERTED);
}
else
{
card.release();
LCD_MESSAGEPGM("Card removed");
LCD_MESSAGEPGM(MSG_SD_REMOVED);
}
}
#endif