|
@@ -1,6 +1,9 @@
|
1
|
1
|
#include "ultralcd.h"
|
2
|
2
|
#ifdef ULTRA_LCD
|
3
|
3
|
#include "Marlin.h"
|
|
4
|
+#include "language.h"
|
|
5
|
+#include "temperature.h"
|
|
6
|
+#include "EEPROMwrite.h"
|
4
|
7
|
#include <LiquidCrystal.h>
|
5
|
8
|
//===========================================================================
|
6
|
9
|
//=============================imported variables============================
|
|
@@ -13,6 +16,7 @@ extern volatile int extrudemultiply;
|
13
|
16
|
|
14
|
17
|
extern long position[4];
|
15
|
18
|
#ifdef SDSUPPORT
|
|
19
|
+#include "cardreader.h"
|
16
|
20
|
extern CardReader card;
|
17
|
21
|
#endif
|
18
|
22
|
|
|
@@ -20,7 +24,7 @@ extern CardReader card;
|
20
|
24
|
//=============================public variables============================
|
21
|
25
|
//===========================================================================
|
22
|
26
|
volatile char buttons=0; //the last checked buttons in a bit array.
|
23
|
|
-int encoderpos=0;
|
|
27
|
+long encoderpos=0;
|
24
|
28
|
short lastenc=0;
|
25
|
29
|
|
26
|
30
|
|
|
@@ -95,6 +99,9 @@ FORCE_INLINE void clear()
|
95
|
99
|
void lcd_init()
|
96
|
100
|
{
|
97
|
101
|
//beep();
|
|
102
|
+ #ifdef ULTIPANEL
|
|
103
|
+ buttons_init();
|
|
104
|
+ #endif
|
98
|
105
|
|
99
|
106
|
byte Degree[8] =
|
100
|
107
|
{
|
|
@@ -302,10 +309,6 @@ MainMenu::MainMenu()
|
302
|
309
|
displayStartingRow=0;
|
303
|
310
|
activeline=0;
|
304
|
311
|
force_lcd_update=true;
|
305
|
|
- #ifdef ULTIPANEL
|
306
|
|
- buttons_init();
|
307
|
|
- #endif
|
308
|
|
- lcd_init();
|
309
|
312
|
linechanging=false;
|
310
|
313
|
tune=false;
|
311
|
314
|
}
|
|
@@ -881,7 +884,7 @@ void MainMenu::showTune()
|
881
|
884
|
if(force_lcd_update)
|
882
|
885
|
{
|
883
|
886
|
lcd.setCursor(0,line);lcdprintPGM(MSG_FLOW);
|
884
|
|
- lcd.setCursor(13,line);lcd.print(itostr4(axis_steps_per_unit[3]));
|
|
887
|
+ lcd.setCursor(13,line);lcd.print(ftostr52(axis_steps_per_unit[E_AXIS]));
|
885
|
888
|
}
|
886
|
889
|
|
887
|
890
|
if((activeline!=line) )
|
|
@@ -892,14 +895,14 @@ void MainMenu::showTune()
|
892
|
895
|
linechanging=!linechanging;
|
893
|
896
|
if(linechanging)
|
894
|
897
|
{
|
895
|
|
- encoderpos=(int)axis_steps_per_unit[3];
|
|
898
|
+ encoderpos=(long)(axis_steps_per_unit[E_AXIS]*100.0);
|
896
|
899
|
}
|
897
|
900
|
else
|
898
|
901
|
{
|
899
|
|
- float factor=float(encoderpos)/float(axis_steps_per_unit[3]);
|
|
902
|
+ float factor=float(encoderpos)/100.0/float(axis_steps_per_unit[E_AXIS]);
|
900
|
903
|
position[E_AXIS]=lround(position[E_AXIS]*factor);
|
901
|
|
- //current_position[3]*=factor;
|
902
|
|
- axis_steps_per_unit[E_AXIS]= encoderpos;
|
|
904
|
+ //current_position[E_AXIS]*=factor;
|
|
905
|
+ axis_steps_per_unit[E_AXIS]= encoderpos/100.0;
|
903
|
906
|
encoderpos=activeline*lcdslow;
|
904
|
907
|
|
905
|
908
|
}
|
|
@@ -909,8 +912,8 @@ void MainMenu::showTune()
|
909
|
912
|
if(linechanging)
|
910
|
913
|
{
|
911
|
914
|
if(encoderpos<5) encoderpos=5;
|
912
|
|
- if(encoderpos>9999) encoderpos=9999;
|
913
|
|
- lcd.setCursor(13,line);lcd.print(itostr4(encoderpos));
|
|
915
|
+ if(encoderpos>999999) encoderpos=999999;
|
|
916
|
+ lcd.setCursor(13,line);lcd.print(ftostr52(encoderpos/100.0));
|
914
|
917
|
}
|
915
|
918
|
|
916
|
919
|
}break;
|
|
@@ -1293,7 +1296,7 @@ void MainMenu::showControlTemp()
|
1293
|
1296
|
linechanging=!linechanging;
|
1294
|
1297
|
if(linechanging)
|
1295
|
1298
|
{
|
1296
|
|
- encoderpos=(int)Kp;
|
|
1299
|
+ encoderpos=(long)Kp;
|
1297
|
1300
|
}
|
1298
|
1301
|
else
|
1299
|
1302
|
{
|
|
@@ -1328,7 +1331,7 @@ void MainMenu::showControlTemp()
|
1328
|
1331
|
linechanging=!linechanging;
|
1329
|
1332
|
if(linechanging)
|
1330
|
1333
|
{
|
1331
|
|
- encoderpos=(int)(Ki*10/PID_dT);
|
|
1334
|
+ encoderpos=(long)(Ki*10/PID_dT);
|
1332
|
1335
|
}
|
1333
|
1336
|
else
|
1334
|
1337
|
{
|
|
@@ -1364,7 +1367,7 @@ void MainMenu::showControlTemp()
|
1364
|
1367
|
linechanging=!linechanging;
|
1365
|
1368
|
if(linechanging)
|
1366
|
1369
|
{
|
1367
|
|
- encoderpos=(int)(Kd/5./PID_dT);
|
|
1370
|
+ encoderpos=(long)(Kd/5./PID_dT);
|
1368
|
1371
|
}
|
1369
|
1372
|
else
|
1370
|
1373
|
{
|
|
@@ -1400,7 +1403,7 @@ void MainMenu::showControlTemp()
|
1400
|
1403
|
linechanging=!linechanging;
|
1401
|
1404
|
if(linechanging)
|
1402
|
1405
|
{
|
1403
|
|
- encoderpos=(int)Kc;
|
|
1406
|
+ encoderpos=(long)Kc;
|
1404
|
1407
|
}
|
1405
|
1408
|
else
|
1406
|
1409
|
{
|
|
@@ -1473,7 +1476,7 @@ void MainMenu::showControlMotion()
|
1473
|
1476
|
linechanging=!linechanging;
|
1474
|
1477
|
if(linechanging)
|
1475
|
1478
|
{
|
1476
|
|
- encoderpos=(int)acceleration/100;
|
|
1479
|
+ encoderpos=(long)acceleration/100;
|
1477
|
1480
|
}
|
1478
|
1481
|
else
|
1479
|
1482
|
{
|
|
@@ -1507,7 +1510,7 @@ void MainMenu::showControlMotion()
|
1507
|
1510
|
linechanging=!linechanging;
|
1508
|
1511
|
if(linechanging)
|
1509
|
1512
|
{
|
1510
|
|
- encoderpos=(int)max_xy_jerk;
|
|
1513
|
+ encoderpos=(long)max_xy_jerk;
|
1511
|
1514
|
}
|
1512
|
1515
|
else
|
1513
|
1516
|
{
|
|
@@ -1550,7 +1553,7 @@ void MainMenu::showControlMotion()
|
1550
|
1553
|
linechanging=!linechanging;
|
1551
|
1554
|
if(linechanging)
|
1552
|
1555
|
{
|
1553
|
|
- encoderpos=(int)max_feedrate[i-ItemCM_vmaxx];
|
|
1556
|
+ encoderpos=(long)max_feedrate[i-ItemCM_vmaxx];
|
1554
|
1557
|
}
|
1555
|
1558
|
else
|
1556
|
1559
|
{
|
|
@@ -1586,7 +1589,7 @@ void MainMenu::showControlMotion()
|
1586
|
1589
|
linechanging=!linechanging;
|
1587
|
1590
|
if(linechanging)
|
1588
|
1591
|
{
|
1589
|
|
- encoderpos=(int)(minimumfeedrate);
|
|
1592
|
+ encoderpos=(long)(minimumfeedrate);
|
1590
|
1593
|
}
|
1591
|
1594
|
else
|
1592
|
1595
|
{
|
|
@@ -1621,7 +1624,7 @@ void MainMenu::showControlMotion()
|
1621
|
1624
|
linechanging=!linechanging;
|
1622
|
1625
|
if(linechanging)
|
1623
|
1626
|
{
|
1624
|
|
- encoderpos=(int)mintravelfeedrate;
|
|
1627
|
+ encoderpos=(long)mintravelfeedrate;
|
1625
|
1628
|
}
|
1626
|
1629
|
else
|
1627
|
1630
|
{
|
|
@@ -1664,7 +1667,7 @@ void MainMenu::showControlMotion()
|
1664
|
1667
|
linechanging=!linechanging;
|
1665
|
1668
|
if(linechanging)
|
1666
|
1669
|
{
|
1667
|
|
- encoderpos=(int)max_acceleration_units_per_sq_second[i-ItemCM_amaxx]/100;
|
|
1670
|
+ encoderpos=(long)max_acceleration_units_per_sq_second[i-ItemCM_amaxx]/100;
|
1668
|
1671
|
}
|
1669
|
1672
|
else
|
1670
|
1673
|
{
|
|
@@ -1698,7 +1701,7 @@ void MainMenu::showControlMotion()
|
1698
|
1701
|
linechanging=!linechanging;
|
1699
|
1702
|
if(linechanging)
|
1700
|
1703
|
{
|
1701
|
|
- encoderpos=(int)retract_acceleration/100;
|
|
1704
|
+ encoderpos=(long)retract_acceleration/100;
|
1702
|
1705
|
}
|
1703
|
1706
|
else
|
1704
|
1707
|
{
|
|
@@ -1722,7 +1725,7 @@ void MainMenu::showControlMotion()
|
1722
|
1725
|
if(force_lcd_update)
|
1723
|
1726
|
{
|
1724
|
1727
|
lcd.setCursor(0,line);lcdprintPGM(MSG_XSTEPS);
|
1725
|
|
- lcd.setCursor(11,line);lcd.print(ftostr52(axis_steps_per_unit[0]));
|
|
1728
|
+ lcd.setCursor(11,line);lcd.print(ftostr52(axis_steps_per_unit[X_AXIS]));
|
1726
|
1729
|
}
|
1727
|
1730
|
|
1728
|
1731
|
if((activeline!=line) )
|
|
@@ -1733,13 +1736,13 @@ void MainMenu::showControlMotion()
|
1733
|
1736
|
linechanging=!linechanging;
|
1734
|
1737
|
if(linechanging)
|
1735
|
1738
|
{
|
1736
|
|
- encoderpos=(int)(axis_steps_per_unit[0]*100.0);
|
|
1739
|
+ encoderpos=(long)(axis_steps_per_unit[X_AXIS]*100.0);
|
1737
|
1740
|
}
|
1738
|
1741
|
else
|
1739
|
1742
|
{
|
1740
|
|
- float factor=float(encoderpos)/100.0/float(axis_steps_per_unit[0]);
|
|
1743
|
+ float factor=float(encoderpos)/100.0/float(axis_steps_per_unit[X_AXIS]);
|
1741
|
1744
|
position[X_AXIS]=lround(position[X_AXIS]*factor);
|
1742
|
|
- //current_position[3]*=factor;
|
|
1745
|
+ //current_position[X_AXIS]*=factor;
|
1743
|
1746
|
axis_steps_per_unit[X_AXIS]= encoderpos/100.0;
|
1744
|
1747
|
encoderpos=activeline*lcdslow;
|
1745
|
1748
|
}
|
|
@@ -1749,7 +1752,7 @@ void MainMenu::showControlMotion()
|
1749
|
1752
|
if(linechanging)
|
1750
|
1753
|
{
|
1751
|
1754
|
if(encoderpos<5) encoderpos=5;
|
1752
|
|
- if(encoderpos>32000) encoderpos=32000;//TODO: This is a problem, encoderpos is 16bit, but steps_per_unit for e can be wel over 800
|
|
1755
|
+ if(encoderpos>999999) encoderpos=999999;
|
1753
|
1756
|
lcd.setCursor(11,line);lcd.print(ftostr52(encoderpos/100.0));
|
1754
|
1757
|
}
|
1755
|
1758
|
|
|
@@ -1759,7 +1762,7 @@ void MainMenu::showControlMotion()
|
1759
|
1762
|
if(force_lcd_update)
|
1760
|
1763
|
{
|
1761
|
1764
|
lcd.setCursor(0,line);lcdprintPGM(MSG_YSTEPS);
|
1762
|
|
- lcd.setCursor(11,line);lcd.print(ftostr52(axis_steps_per_unit[1]));
|
|
1765
|
+ lcd.setCursor(11,line);lcd.print(ftostr52(axis_steps_per_unit[Y_AXIS]));
|
1763
|
1766
|
}
|
1764
|
1767
|
|
1765
|
1768
|
if((activeline!=line) )
|
|
@@ -1770,13 +1773,13 @@ void MainMenu::showControlMotion()
|
1770
|
1773
|
linechanging=!linechanging;
|
1771
|
1774
|
if(linechanging)
|
1772
|
1775
|
{
|
1773
|
|
- encoderpos=(int)(axis_steps_per_unit[1]*100.0);
|
|
1776
|
+ encoderpos=(long)(axis_steps_per_unit[Y_AXIS]*100.0);
|
1774
|
1777
|
}
|
1775
|
1778
|
else
|
1776
|
1779
|
{
|
1777
|
|
- float factor=float(encoderpos)/100.0/float(axis_steps_per_unit[1]);
|
|
1780
|
+ float factor=float(encoderpos)/100.0/float(axis_steps_per_unit[Y_AXIS]);
|
1778
|
1781
|
position[Y_AXIS]=lround(position[Y_AXIS]*factor);
|
1779
|
|
- //current_position[3]*=factor;
|
|
1782
|
+ //current_position[Y_AXIS]*=factor;
|
1780
|
1783
|
axis_steps_per_unit[Y_AXIS]= encoderpos/100.0;
|
1781
|
1784
|
encoderpos=activeline*lcdslow;
|
1782
|
1785
|
|
|
@@ -1787,7 +1790,7 @@ void MainMenu::showControlMotion()
|
1787
|
1790
|
if(linechanging)
|
1788
|
1791
|
{
|
1789
|
1792
|
if(encoderpos<5) encoderpos=5;
|
1790
|
|
- if(encoderpos>9999) encoderpos=9999;
|
|
1793
|
+ if(encoderpos>999999) encoderpos=999999;
|
1791
|
1794
|
lcd.setCursor(11,line);lcd.print(ftostr52(encoderpos/100.0));
|
1792
|
1795
|
}
|
1793
|
1796
|
|
|
@@ -1797,7 +1800,7 @@ void MainMenu::showControlMotion()
|
1797
|
1800
|
if(force_lcd_update)
|
1798
|
1801
|
{
|
1799
|
1802
|
lcd.setCursor(0,line);lcdprintPGM(MSG_ZSTEPS);
|
1800
|
|
- lcd.setCursor(11,line);lcd.print(ftostr52(axis_steps_per_unit[2]));
|
|
1803
|
+ lcd.setCursor(11,line);lcd.print(ftostr52(axis_steps_per_unit[Z_AXIS]));
|
1801
|
1804
|
}
|
1802
|
1805
|
|
1803
|
1806
|
if((activeline!=line) )
|
|
@@ -1808,13 +1811,13 @@ void MainMenu::showControlMotion()
|
1808
|
1811
|
linechanging=!linechanging;
|
1809
|
1812
|
if(linechanging)
|
1810
|
1813
|
{
|
1811
|
|
- encoderpos=(int)(axis_steps_per_unit[2]*100.0);
|
|
1814
|
+ encoderpos=(long)(axis_steps_per_unit[Z_AXIS]*100.0);
|
1812
|
1815
|
}
|
1813
|
1816
|
else
|
1814
|
1817
|
{
|
1815
|
|
- float factor=float(encoderpos)/100.0/float(axis_steps_per_unit[2]);
|
|
1818
|
+ float factor=float(encoderpos)/100.0/float(axis_steps_per_unit[Z_AXIS]);
|
1816
|
1819
|
position[Z_AXIS]=lround(position[Z_AXIS]*factor);
|
1817
|
|
- //current_position[3]*=factor;
|
|
1820
|
+ //current_position[Z_AXIS]*=factor;
|
1818
|
1821
|
axis_steps_per_unit[Z_AXIS]= encoderpos/100.0;
|
1819
|
1822
|
encoderpos=activeline*lcdslow;
|
1820
|
1823
|
|
|
@@ -1825,7 +1828,7 @@ void MainMenu::showControlMotion()
|
1825
|
1828
|
if(linechanging)
|
1826
|
1829
|
{
|
1827
|
1830
|
if(encoderpos<5) encoderpos=5;
|
1828
|
|
- if(encoderpos>9999) encoderpos=9999;
|
|
1831
|
+ if(encoderpos>999999) encoderpos=999999;
|
1829
|
1832
|
lcd.setCursor(11,line);lcd.print(ftostr52(encoderpos/100.0));
|
1830
|
1833
|
}
|
1831
|
1834
|
|
|
@@ -1836,7 +1839,7 @@ void MainMenu::showControlMotion()
|
1836
|
1839
|
if(force_lcd_update)
|
1837
|
1840
|
{
|
1838
|
1841
|
lcd.setCursor(0,line);lcdprintPGM(MSG_ESTEPS);
|
1839
|
|
- lcd.setCursor(11,line);lcd.print(ftostr52(axis_steps_per_unit[3]));
|
|
1842
|
+ lcd.setCursor(11,line);lcd.print(ftostr52(axis_steps_per_unit[E_AXIS]));
|
1840
|
1843
|
}
|
1841
|
1844
|
|
1842
|
1845
|
if((activeline!=line) )
|
|
@@ -1847,13 +1850,13 @@ void MainMenu::showControlMotion()
|
1847
|
1850
|
linechanging=!linechanging;
|
1848
|
1851
|
if(linechanging)
|
1849
|
1852
|
{
|
1850
|
|
- encoderpos=(int)(axis_steps_per_unit[3]*100.0);
|
|
1853
|
+ encoderpos=(long)(axis_steps_per_unit[E_AXIS]*100.0);
|
1851
|
1854
|
}
|
1852
|
1855
|
else
|
1853
|
1856
|
{
|
1854
|
|
- float factor=float(encoderpos)/100.0/float(axis_steps_per_unit[3]);
|
|
1857
|
+ float factor=float(encoderpos)/100.0/float(axis_steps_per_unit[E_AXIS]);
|
1855
|
1858
|
position[E_AXIS]=lround(position[E_AXIS]*factor);
|
1856
|
|
- //current_position[3]*=factor;
|
|
1859
|
+ //current_position[E_AXIS]*=factor;
|
1857
|
1860
|
axis_steps_per_unit[E_AXIS]= encoderpos/100.0;
|
1858
|
1861
|
encoderpos=activeline*lcdslow;
|
1859
|
1862
|
|
|
@@ -1864,7 +1867,7 @@ void MainMenu::showControlMotion()
|
1864
|
1867
|
if(linechanging)
|
1865
|
1868
|
{
|
1866
|
1869
|
if(encoderpos<5) encoderpos=5;
|
1867
|
|
- if(encoderpos>9999) encoderpos=9999;
|
|
1870
|
+ if(encoderpos>999999) encoderpos=999999;
|
1868
|
1871
|
lcd.setCursor(11,line);lcd.print(ftostr52(encoderpos/100.0));
|
1869
|
1872
|
}
|
1870
|
1873
|
|
|
@@ -2105,9 +2108,10 @@ void MainMenu::showMainMenu()
|
2105
|
2108
|
}
|
2106
|
2109
|
}
|
2107
|
2110
|
clearIfNecessary();
|
2108
|
|
- for(int8_t line=0;line<LCD_HEIGHT;line++)
|
|
2111
|
+ uint8_t line=0;
|
|
2112
|
+ for(int8_t i=lineoffset;i<lineoffset+LCD_HEIGHT;i++)
|
2109
|
2113
|
{
|
2110
|
|
- switch(line)
|
|
2114
|
+ switch(i)
|
2111
|
2115
|
{
|
2112
|
2116
|
case ItemM_watch:
|
2113
|
2117
|
MENUITEM( lcdprintPGM(MSG_WATCH) , BLOCK;status=Main_Status;beepshort(); ) ;
|
|
@@ -2161,6 +2165,7 @@ void MainMenu::showMainMenu()
|
2161
|
2165
|
SERIAL_ERRORLNPGM(MSG_SERIAL_ERROR_MENU_STRUCTURE);
|
2162
|
2166
|
break;
|
2163
|
2167
|
}
|
|
2168
|
+ line++;
|
2164
|
2169
|
}
|
2165
|
2170
|
updateActiveLines(3,encoderpos);
|
2166
|
2171
|
}
|
|
@@ -2378,4 +2383,4 @@ char *ftostr52(const float &x)
|
2378
|
2383
|
|
2379
|
2384
|
#endif //ULTRA_LCD
|
2380
|
2385
|
|
2381
|
|
-
|
|
2386
|
+
|