|
|
|
@ -44,7 +44,9 @@ static void lcd_status_screen();
|
|
|
|
|
|
|
|
|
|
#ifdef ULTIPANEL
|
|
|
|
|
|
|
|
|
|
#if HAS_POWER_SWITCH
|
|
|
|
|
extern bool powersupply;
|
|
|
|
|
#endif
|
|
|
|
|
static float manual_feedrate[] = MANUAL_FEEDRATE;
|
|
|
|
|
static void lcd_main_menu();
|
|
|
|
|
static void lcd_tune_menu();
|
|
|
|
@ -616,6 +618,7 @@ static void lcd_prepare_menu() {
|
|
|
|
|
MENU_ITEM(gcode, MSG_AUTO_HOME, PSTR("G28"));
|
|
|
|
|
MENU_ITEM(function, MSG_SET_HOME_OFFSETS, lcd_set_home_offsets);
|
|
|
|
|
//MENU_ITEM(gcode, MSG_SET_ORIGIN, PSTR("G92 X0 Y0 Z0"));
|
|
|
|
|
|
|
|
|
|
#if TEMP_SENSOR_0 != 0
|
|
|
|
|
#if TEMP_SENSOR_1 != 0 || TEMP_SENSOR_2 != 0 || TEMP_SENSOR_3 != 0 || TEMP_SENSOR_BED != 0
|
|
|
|
|
MENU_ITEM(submenu, MSG_PREHEAT_PLA, lcd_preheat_pla_menu);
|
|
|
|
@ -625,15 +628,16 @@ static void lcd_prepare_menu() {
|
|
|
|
|
MENU_ITEM(function, MSG_PREHEAT_ABS, lcd_preheat_abs0);
|
|
|
|
|
#endif
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
MENU_ITEM(function, MSG_COOLDOWN, lcd_cooldown);
|
|
|
|
|
#if defined(POWER_SUPPLY) && POWER_SUPPLY > 0 && defined(PS_ON_PIN) && PS_ON_PIN > -1
|
|
|
|
|
if (powersupply) {
|
|
|
|
|
|
|
|
|
|
#if HAS_POWER_SWITCH
|
|
|
|
|
if (powersupply)
|
|
|
|
|
MENU_ITEM(gcode, MSG_SWITCH_PS_OFF, PSTR("M81"));
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
else
|
|
|
|
|
MENU_ITEM(gcode, MSG_SWITCH_PS_ON, PSTR("M80"));
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
MENU_ITEM(submenu, MSG_MOVE_AXIS, lcd_move_menu);
|
|
|
|
|
|
|
|
|
|
#if defined(MANUAL_BED_LEVELING)
|
|
|
|
@ -1338,7 +1342,7 @@ void lcd_update() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
lastEncoderMovementMillis = ms;
|
|
|
|
|
}
|
|
|
|
|
} // encoderRateMultiplierEnabled
|
|
|
|
|
#endif //ENCODER_RATE_MULTIPLIER
|
|
|
|
|
|
|
|
|
|
lcdDrawUpdate = 1;
|
|
|
|
@ -1541,69 +1545,61 @@ bool lcd_clicked() { return LCD_CLICKED; }
|
|
|
|
|
|
|
|
|
|
#endif //ULTIPANEL
|
|
|
|
|
|
|
|
|
|
/********************************/
|
|
|
|
|
/** Float conversion utilities **/
|
|
|
|
|
/********************************/
|
|
|
|
|
// convert float to string with +123.4 format
|
|
|
|
|
/*********************************/
|
|
|
|
|
/** Number to string conversion **/
|
|
|
|
|
/*********************************/
|
|
|
|
|
|
|
|
|
|
char conv[8];
|
|
|
|
|
char *ftostr3(const float &x)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// Convert float to string with +123.4 format
|
|
|
|
|
char *ftostr3(const float &x) {
|
|
|
|
|
return itostr3((int)x);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
char *itostr2(const uint8_t &x)
|
|
|
|
|
{
|
|
|
|
|
// Convert int to string with 12 format
|
|
|
|
|
char *itostr2(const uint8_t &x) {
|
|
|
|
|
//sprintf(conv,"%5.1f",x);
|
|
|
|
|
int xx = x;
|
|
|
|
|
conv[0] = (xx / 10) % 10 + '0';
|
|
|
|
|
conv[1]=(xx)%10+'0';
|
|
|
|
|
conv[1] = xx % 10 + '0';
|
|
|
|
|
conv[2] = 0;
|
|
|
|
|
return conv;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Convert float to string with 123.4 format, dropping sign
|
|
|
|
|
char *ftostr31(const float &x)
|
|
|
|
|
{
|
|
|
|
|
int xx=x*10;
|
|
|
|
|
conv[0]=(xx>=0)?'+':'-';
|
|
|
|
|
xx=abs(xx);
|
|
|
|
|
// Convert float to string with +123.4 format
|
|
|
|
|
char *ftostr31(const float &x) {
|
|
|
|
|
int xx = abs(x * 10);
|
|
|
|
|
conv[0] = (x >= 0) ? '+' : '-';
|
|
|
|
|
conv[1] = (xx / 1000) % 10 + '0';
|
|
|
|
|
conv[2] = (xx / 100) % 10 + '0';
|
|
|
|
|
conv[3] = (xx / 10) % 10 + '0';
|
|
|
|
|
conv[4] = '.';
|
|
|
|
|
conv[5]=(xx)%10+'0';
|
|
|
|
|
conv[5] = xx % 10 + '0';
|
|
|
|
|
conv[6] = 0;
|
|
|
|
|
return conv;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Convert float to string with 123.4 format
|
|
|
|
|
char *ftostr31ns(const float &x)
|
|
|
|
|
{
|
|
|
|
|
int xx=x*10;
|
|
|
|
|
//conv[0]=(xx>=0)?'+':'-';
|
|
|
|
|
xx=abs(xx);
|
|
|
|
|
// Convert float to string with 123.4 format, dropping sign
|
|
|
|
|
char *ftostr31ns(const float &x) {
|
|
|
|
|
int xx = abs(x * 10);
|
|
|
|
|
conv[0] = (xx / 1000) % 10 + '0';
|
|
|
|
|
conv[1] = (xx / 100) % 10 + '0';
|
|
|
|
|
conv[2] = (xx / 10) % 10 + '0';
|
|
|
|
|
conv[3] = '.';
|
|
|
|
|
conv[4]=(xx)%10+'0';
|
|
|
|
|
conv[4] = xx % 10 + '0';
|
|
|
|
|
conv[5] = 0;
|
|
|
|
|
return conv;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
char *ftostr32(const float &x)
|
|
|
|
|
{
|
|
|
|
|
long xx=x*100;
|
|
|
|
|
if (xx >= 0)
|
|
|
|
|
conv[0]=(xx/10000)%10+'0';
|
|
|
|
|
else
|
|
|
|
|
conv[0]='-';
|
|
|
|
|
xx=abs(xx);
|
|
|
|
|
// Convert float to string with 123.4 format
|
|
|
|
|
char *ftostr32(const float &x) {
|
|
|
|
|
long xx = abs(x * 100);
|
|
|
|
|
conv[0] = x >= 0 ? (xx / 10000) % 10 + '0' : '-';
|
|
|
|
|
conv[1] = (xx / 1000) % 10 + '0';
|
|
|
|
|
conv[2] = (xx / 100) % 10 + '0';
|
|
|
|
|
conv[3] = '.';
|
|
|
|
|
conv[4] = (xx / 10) % 10 + '0';
|
|
|
|
|
conv[5]=(xx)%10+'0';
|
|
|
|
|
conv[5] = xx % 10 + '0';
|
|
|
|
|
conv[6] = 0;
|
|
|
|
|
return conv;
|
|
|
|
|
}
|
|
|
|
@ -1625,7 +1621,7 @@ char *ftostr43(const float &x)
|
|
|
|
|
return conv;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Float to string with 1.23 format
|
|
|
|
|
// Convert float to string with 1.23 format
|
|
|
|
|
char *ftostr12ns(const float &x)
|
|
|
|
|
{
|
|
|
|
|
long xx=x*100;
|
|
|
|
@ -1639,7 +1635,7 @@ char *ftostr12ns(const float &x)
|
|
|
|
|
return conv;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// convert float to space-padded string with -_23.4_ format
|
|
|
|
|
// Convert float to space-padded string with -_23.4_ format
|
|
|
|
|
char *ftostr32sp(const float &x) {
|
|
|
|
|
long xx = abs(x * 100);
|
|
|
|
|
uint8_t dig;
|
|
|
|
@ -1685,57 +1681,50 @@ char *ftostr32sp(const float &x) {
|
|
|
|
|
return conv;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
char *itostr31(const int &xx)
|
|
|
|
|
{
|
|
|
|
|
conv[0]=(xx>=0)?'+':'-';
|
|
|
|
|
conv[1]=(xx/1000)%10+'0';
|
|
|
|
|
conv[2]=(xx/100)%10+'0';
|
|
|
|
|
conv[3]=(xx/10)%10+'0';
|
|
|
|
|
// Convert int to lj string with +123.0 format
|
|
|
|
|
char *itostr31(const int &x) {
|
|
|
|
|
conv[0] = x >= 0 ? '+' : '-';
|
|
|
|
|
int xx = abs(x);
|
|
|
|
|
conv[1] = (xx / 100) % 10 + '0';
|
|
|
|
|
conv[2] = (xx / 10) % 10 + '0';
|
|
|
|
|
conv[3] = xx % 10 + '0';
|
|
|
|
|
conv[4] = '.';
|
|
|
|
|
conv[5]=(xx)%10+'0';
|
|
|
|
|
conv[5] = '0';
|
|
|
|
|
conv[6] = 0;
|
|
|
|
|
return conv;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Convert int to rj string with 123 or -12 format
|
|
|
|
|
char *itostr3(const int &x)
|
|
|
|
|
{
|
|
|
|
|
char *itostr3(const int &x) {
|
|
|
|
|
int xx = x;
|
|
|
|
|
if (xx < 0) {
|
|
|
|
|
conv[0] = '-';
|
|
|
|
|
xx = -xx;
|
|
|
|
|
} else if (xx >= 100)
|
|
|
|
|
conv[0]=(xx/100)%10+'0';
|
|
|
|
|
else
|
|
|
|
|
conv[0]=' ';
|
|
|
|
|
if (xx >= 10)
|
|
|
|
|
conv[1]=(xx/10)%10+'0';
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
conv[1]=' ';
|
|
|
|
|
conv[2]=(xx)%10+'0';
|
|
|
|
|
conv[0] = xx >= 100 ? (xx / 100) % 10 + '0' : ' ';
|
|
|
|
|
|
|
|
|
|
conv[1] = xx >= 10 ? (xx / 10) % 10 + '0' : ' ';
|
|
|
|
|
conv[2] = xx % 10 + '0';
|
|
|
|
|
conv[3] = 0;
|
|
|
|
|
return conv;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Convert int to lj string with 123 format
|
|
|
|
|
char *itostr3left(const int &xx)
|
|
|
|
|
{
|
|
|
|
|
if (xx >= 100)
|
|
|
|
|
{
|
|
|
|
|
char *itostr3left(const int &xx) {
|
|
|
|
|
if (xx >= 100) {
|
|
|
|
|
conv[0] = (xx / 100) % 10 + '0';
|
|
|
|
|
conv[1] = (xx / 10) % 10 + '0';
|
|
|
|
|
conv[2]=(xx)%10+'0';
|
|
|
|
|
conv[2] = xx % 10 + '0';
|
|
|
|
|
conv[3] = 0;
|
|
|
|
|
}
|
|
|
|
|
else if (xx >= 10)
|
|
|
|
|
{
|
|
|
|
|
else if (xx >= 10) {
|
|
|
|
|
conv[0] = (xx / 10) % 10 + '0';
|
|
|
|
|
conv[1]=(xx)%10+'0';
|
|
|
|
|
conv[1] = xx % 10 + '0';
|
|
|
|
|
conv[2] = 0;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
conv[0]=(xx)%10+'0';
|
|
|
|
|
else {
|
|
|
|
|
conv[0] = xx % 10 + '0';
|
|
|
|
|
conv[1] = 0;
|
|
|
|
|
}
|
|
|
|
|
return conv;
|
|
|
|
@ -1764,33 +1753,29 @@ char *ftostr5(const float &x) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Convert float to string with +1234.5 format
|
|
|
|
|
char *ftostr51(const float &x)
|
|
|
|
|
{
|
|
|
|
|
long xx=x*10;
|
|
|
|
|
conv[0]=(xx>=0)?'+':'-';
|
|
|
|
|
xx=abs(xx);
|
|
|
|
|
char *ftostr51(const float &x) {
|
|
|
|
|
long xx = abs(x * 10);
|
|
|
|
|
conv[0] = (x >= 0) ? '+' : '-';
|
|
|
|
|
conv[1] = (xx / 10000) % 10 + '0';
|
|
|
|
|
conv[2] = (xx / 1000) % 10 + '0';
|
|
|
|
|
conv[3] = (xx / 100) % 10 + '0';
|
|
|
|
|
conv[4] = (xx / 10) % 10 + '0';
|
|
|
|
|
conv[5] = '.';
|
|
|
|
|
conv[6]=(xx)%10+'0';
|
|
|
|
|
conv[6] = xx % 10 + '0';
|
|
|
|
|
conv[7] = 0;
|
|
|
|
|
return conv;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Convert float to string with +123.45 format
|
|
|
|
|
char *ftostr52(const float &x)
|
|
|
|
|
{
|
|
|
|
|
long xx=x*100;
|
|
|
|
|
conv[0]=(xx>=0)?'+':'-';
|
|
|
|
|
xx=abs(xx);
|
|
|
|
|
char *ftostr52(const float &x) {
|
|
|
|
|
conv[0] = (x >= 0) ? '+' : '-';
|
|
|
|
|
long xx = abs(x * 100);
|
|
|
|
|
conv[1] = (xx / 10000) % 10 + '0';
|
|
|
|
|
conv[2] = (xx / 1000) % 10 + '0';
|
|
|
|
|
conv[3] = (xx / 100) % 10 + '0';
|
|
|
|
|
conv[4] = '.';
|
|
|
|
|
conv[5] = (xx / 10) % 10 + '0';
|
|
|
|
|
conv[6]=(xx)%10+'0';
|
|
|
|
|
conv[6] = xx % 10 + '0';
|
|
|
|
|
conv[7] = 0;
|
|
|
|
|
return conv;
|
|
|
|
|
}
|
|
|
|
|