|
@@ -3,6 +3,9 @@
|
3
|
3
|
#include "ultralcd.h"
|
4
|
4
|
#ifdef ULTRA_LCD
|
5
|
5
|
#include "Marlin.h"
|
|
6
|
+#include "language.h"
|
|
7
|
+#include "temperature.h"
|
|
8
|
+#include "EEPROMwrite.h"
|
6
|
9
|
#include <LiquidCrystal.h>
|
7
|
10
|
//===========================================================================
|
8
|
11
|
//=============================imported variables============================
|
|
@@ -15,6 +18,7 @@ extern volatile int extrudemultiply;
|
15
|
18
|
|
16
|
19
|
extern long position[4];
|
17
|
20
|
#ifdef SDSUPPORT
|
|
21
|
+#include "cardreader.h"
|
18
|
22
|
extern CardReader card;
|
19
|
23
|
#endif
|
20
|
24
|
|
|
@@ -22,7 +26,7 @@ extern CardReader card;
|
22
|
26
|
//=============================public variables============================
|
23
|
27
|
//===========================================================================
|
24
|
28
|
volatile char buttons=0; //the last checked buttons in a bit array.
|
25
|
|
-int encoderpos=0;
|
|
29
|
+long encoderpos=0;
|
26
|
30
|
short lastenc=0;
|
27
|
31
|
|
28
|
32
|
|
|
@@ -97,6 +101,9 @@ FORCE_INLINE void clear()
|
97
|
101
|
void lcd_init()
|
98
|
102
|
{
|
99
|
103
|
//beep();
|
|
104
|
+ #ifdef ULTIPANEL
|
|
105
|
+ buttons_init();
|
|
106
|
+ #endif
|
100
|
107
|
|
101
|
108
|
byte Degree[8] =
|
102
|
109
|
{
|
|
@@ -304,10 +311,6 @@ MainMenu::MainMenu()
|
304
|
311
|
displayStartingRow=0;
|
305
|
312
|
activeline=0;
|
306
|
313
|
force_lcd_update=true;
|
307
|
|
- #ifdef ULTIPANEL
|
308
|
|
- buttons_init();
|
309
|
|
- #endif
|
310
|
|
- lcd_init();
|
311
|
314
|
linechanging=false;
|
312
|
315
|
tune=false;
|
313
|
316
|
}
|
|
@@ -884,7 +887,7 @@ void MainMenu::showTune()
|
884
|
887
|
if(force_lcd_update)
|
885
|
888
|
{
|
886
|
889
|
lcd.setCursor(0,line);lcdprintPGM(MSG_FLOW);
|
887
|
|
- lcd.setCursor(13,line);lcd.print(itostr4(axis_steps_per_unit[3]));
|
|
890
|
+ lcd.setCursor(13,line);lcd.print(ftostr52(axis_steps_per_unit[E_AXIS]));
|
888
|
891
|
}
|
889
|
892
|
|
890
|
893
|
if((activeline!=line) )
|
|
@@ -895,14 +898,14 @@ void MainMenu::showTune()
|
895
|
898
|
linechanging=!linechanging;
|
896
|
899
|
if(linechanging)
|
897
|
900
|
{
|
898
|
|
- encoderpos=(int)axis_steps_per_unit[3];
|
|
901
|
+ encoderpos=(long)(axis_steps_per_unit[E_AXIS]*100.0);
|
899
|
902
|
}
|
900
|
903
|
else
|
901
|
904
|
{
|
902
|
|
- float factor=float(encoderpos)/float(axis_steps_per_unit[3]);
|
|
905
|
+ float factor=float(encoderpos)/100.0/float(axis_steps_per_unit[E_AXIS]);
|
903
|
906
|
position[E_AXIS]=lround(position[E_AXIS]*factor);
|
904
|
|
- //current_position[3]*=factor;
|
905
|
|
- axis_steps_per_unit[E_AXIS]= encoderpos;
|
|
907
|
+ //current_position[E_AXIS]*=factor;
|
|
908
|
+ axis_steps_per_unit[E_AXIS]= encoderpos/100.0;
|
906
|
909
|
encoderpos=activeline*lcdslow;
|
907
|
910
|
|
908
|
911
|
}
|
|
@@ -912,8 +915,8 @@ void MainMenu::showTune()
|
912
|
915
|
if(linechanging)
|
913
|
916
|
{
|
914
|
917
|
if(encoderpos<5) encoderpos=5;
|
915
|
|
- if(encoderpos>9999) encoderpos=9999;
|
916
|
|
- lcd.setCursor(13,line);lcd.print(itostr4(encoderpos));
|
|
918
|
+ if(encoderpos>999999) encoderpos=999999;
|
|
919
|
+ lcd.setCursor(13,line);lcd.print(ftostr52(encoderpos/100.0));
|
917
|
920
|
}
|
918
|
921
|
|
919
|
922
|
}break;
|
|
@@ -1296,7 +1299,7 @@ void MainMenu::showControlTemp()
|
1296
|
1299
|
linechanging=!linechanging;
|
1297
|
1300
|
if(linechanging)
|
1298
|
1301
|
{
|
1299
|
|
- encoderpos=(int)Kp;
|
|
1302
|
+ encoderpos=(long)Kp;
|
1300
|
1303
|
}
|
1301
|
1304
|
else
|
1302
|
1305
|
{
|
|
@@ -1331,7 +1334,7 @@ void MainMenu::showControlTemp()
|
1331
|
1334
|
linechanging=!linechanging;
|
1332
|
1335
|
if(linechanging)
|
1333
|
1336
|
{
|
1334
|
|
- encoderpos=(int)(Ki*10/PID_dT);
|
|
1337
|
+ encoderpos=(long)(Ki*10/PID_dT);
|
1335
|
1338
|
}
|
1336
|
1339
|
else
|
1337
|
1340
|
{
|
|
@@ -1367,7 +1370,7 @@ void MainMenu::showControlTemp()
|
1367
|
1370
|
linechanging=!linechanging;
|
1368
|
1371
|
if(linechanging)
|
1369
|
1372
|
{
|
1370
|
|
- encoderpos=(int)(Kd/5./PID_dT);
|
|
1373
|
+ encoderpos=(long)(Kd/5./PID_dT);
|
1371
|
1374
|
}
|
1372
|
1375
|
else
|
1373
|
1376
|
{
|
|
@@ -1403,7 +1406,7 @@ void MainMenu::showControlTemp()
|
1403
|
1406
|
linechanging=!linechanging;
|
1404
|
1407
|
if(linechanging)
|
1405
|
1408
|
{
|
1406
|
|
- encoderpos=(int)Kc;
|
|
1409
|
+ encoderpos=(long)Kc;
|
1407
|
1410
|
}
|
1408
|
1411
|
else
|
1409
|
1412
|
{
|
|
@@ -1476,7 +1479,7 @@ void MainMenu::showControlMotion()
|
1476
|
1479
|
linechanging=!linechanging;
|
1477
|
1480
|
if(linechanging)
|
1478
|
1481
|
{
|
1479
|
|
- encoderpos=(int)acceleration/100;
|
|
1482
|
+ encoderpos=(long)acceleration/100;
|
1480
|
1483
|
}
|
1481
|
1484
|
else
|
1482
|
1485
|
{
|
|
@@ -1510,7 +1513,7 @@ void MainMenu::showControlMotion()
|
1510
|
1513
|
linechanging=!linechanging;
|
1511
|
1514
|
if(linechanging)
|
1512
|
1515
|
{
|
1513
|
|
- encoderpos=(int)max_xy_jerk;
|
|
1516
|
+ encoderpos=(long)max_xy_jerk;
|
1514
|
1517
|
}
|
1515
|
1518
|
else
|
1516
|
1519
|
{
|
|
@@ -1553,7 +1556,7 @@ void MainMenu::showControlMotion()
|
1553
|
1556
|
linechanging=!linechanging;
|
1554
|
1557
|
if(linechanging)
|
1555
|
1558
|
{
|
1556
|
|
- encoderpos=(int)max_feedrate[i-ItemCM_vmaxx];
|
|
1559
|
+ encoderpos=(long)max_feedrate[i-ItemCM_vmaxx];
|
1557
|
1560
|
}
|
1558
|
1561
|
else
|
1559
|
1562
|
{
|
|
@@ -1589,7 +1592,7 @@ void MainMenu::showControlMotion()
|
1589
|
1592
|
linechanging=!linechanging;
|
1590
|
1593
|
if(linechanging)
|
1591
|
1594
|
{
|
1592
|
|
- encoderpos=(int)(minimumfeedrate);
|
|
1595
|
+ encoderpos=(long)(minimumfeedrate);
|
1593
|
1596
|
}
|
1594
|
1597
|
else
|
1595
|
1598
|
{
|
|
@@ -1624,7 +1627,7 @@ void MainMenu::showControlMotion()
|
1624
|
1627
|
linechanging=!linechanging;
|
1625
|
1628
|
if(linechanging)
|
1626
|
1629
|
{
|
1627
|
|
- encoderpos=(int)mintravelfeedrate;
|
|
1630
|
+ encoderpos=(long)mintravelfeedrate;
|
1628
|
1631
|
}
|
1629
|
1632
|
else
|
1630
|
1633
|
{
|
|
@@ -1667,7 +1670,7 @@ void MainMenu::showControlMotion()
|
1667
|
1670
|
linechanging=!linechanging;
|
1668
|
1671
|
if(linechanging)
|
1669
|
1672
|
{
|
1670
|
|
- encoderpos=(int)max_acceleration_units_per_sq_second[i-ItemCM_amaxx]/100;
|
|
1673
|
+ encoderpos=(long)max_acceleration_units_per_sq_second[i-ItemCM_amaxx]/100;
|
1671
|
1674
|
}
|
1672
|
1675
|
else
|
1673
|
1676
|
{
|
|
@@ -1701,7 +1704,7 @@ void MainMenu::showControlMotion()
|
1701
|
1704
|
linechanging=!linechanging;
|
1702
|
1705
|
if(linechanging)
|
1703
|
1706
|
{
|
1704
|
|
- encoderpos=(int)retract_acceleration/100;
|
|
1707
|
+ encoderpos=(long)retract_acceleration/100;
|
1705
|
1708
|
}
|
1706
|
1709
|
else
|
1707
|
1710
|
{
|
|
@@ -1725,7 +1728,7 @@ void MainMenu::showControlMotion()
|
1725
|
1728
|
if(force_lcd_update)
|
1726
|
1729
|
{
|
1727
|
1730
|
lcd.setCursor(0,line);lcdprintPGM(MSG_XSTEPS);
|
1728
|
|
- lcd.setCursor(11,line);lcd.print(ftostr52(axis_steps_per_unit[0]));
|
|
1731
|
+ lcd.setCursor(11,line);lcd.print(ftostr52(axis_steps_per_unit[X_AXIS]));
|
1729
|
1732
|
}
|
1730
|
1733
|
|
1731
|
1734
|
if((activeline!=line) )
|
|
@@ -1736,13 +1739,13 @@ void MainMenu::showControlMotion()
|
1736
|
1739
|
linechanging=!linechanging;
|
1737
|
1740
|
if(linechanging)
|
1738
|
1741
|
{
|
1739
|
|
- encoderpos=(int)(axis_steps_per_unit[0]*100.0);
|
|
1742
|
+ encoderpos=(long)(axis_steps_per_unit[X_AXIS]*100.0);
|
1740
|
1743
|
}
|
1741
|
1744
|
else
|
1742
|
1745
|
{
|
1743
|
|
- float factor=float(encoderpos)/100.0/float(axis_steps_per_unit[0]);
|
|
1746
|
+ float factor=float(encoderpos)/100.0/float(axis_steps_per_unit[X_AXIS]);
|
1744
|
1747
|
position[X_AXIS]=lround(position[X_AXIS]*factor);
|
1745
|
|
- //current_position[3]*=factor;
|
|
1748
|
+ //current_position[X_AXIS]*=factor;
|
1746
|
1749
|
axis_steps_per_unit[X_AXIS]= encoderpos/100.0;
|
1747
|
1750
|
encoderpos=activeline*lcdslow;
|
1748
|
1751
|
}
|
|
@@ -1752,7 +1755,7 @@ void MainMenu::showControlMotion()
|
1752
|
1755
|
if(linechanging)
|
1753
|
1756
|
{
|
1754
|
1757
|
if(encoderpos<5) encoderpos=5;
|
1755
|
|
- if(encoderpos>32000) encoderpos=32000;//TODO: This is a problem, encoderpos is 16bit, but steps_per_unit for e can be wel over 800
|
|
1758
|
+ if(encoderpos>999999) encoderpos=999999;
|
1756
|
1759
|
lcd.setCursor(11,line);lcd.print(ftostr52(encoderpos/100.0));
|
1757
|
1760
|
}
|
1758
|
1761
|
|
|
@@ -1762,7 +1765,7 @@ void MainMenu::showControlMotion()
|
1762
|
1765
|
if(force_lcd_update)
|
1763
|
1766
|
{
|
1764
|
1767
|
lcd.setCursor(0,line);lcdprintPGM(MSG_YSTEPS);
|
1765
|
|
- lcd.setCursor(11,line);lcd.print(ftostr52(axis_steps_per_unit[1]));
|
|
1768
|
+ lcd.setCursor(11,line);lcd.print(ftostr52(axis_steps_per_unit[Y_AXIS]));
|
1766
|
1769
|
}
|
1767
|
1770
|
|
1768
|
1771
|
if((activeline!=line) )
|
|
@@ -1773,13 +1776,13 @@ void MainMenu::showControlMotion()
|
1773
|
1776
|
linechanging=!linechanging;
|
1774
|
1777
|
if(linechanging)
|
1775
|
1778
|
{
|
1776
|
|
- encoderpos=(int)(axis_steps_per_unit[1]*100.0);
|
|
1779
|
+ encoderpos=(long)(axis_steps_per_unit[Y_AXIS]*100.0);
|
1777
|
1780
|
}
|
1778
|
1781
|
else
|
1779
|
1782
|
{
|
1780
|
|
- float factor=float(encoderpos)/100.0/float(axis_steps_per_unit[1]);
|
|
1783
|
+ float factor=float(encoderpos)/100.0/float(axis_steps_per_unit[Y_AXIS]);
|
1781
|
1784
|
position[Y_AXIS]=lround(position[Y_AXIS]*factor);
|
1782
|
|
- //current_position[3]*=factor;
|
|
1785
|
+ //current_position[Y_AXIS]*=factor;
|
1783
|
1786
|
axis_steps_per_unit[Y_AXIS]= encoderpos/100.0;
|
1784
|
1787
|
encoderpos=activeline*lcdslow;
|
1785
|
1788
|
|
|
@@ -1790,7 +1793,7 @@ void MainMenu::showControlMotion()
|
1790
|
1793
|
if(linechanging)
|
1791
|
1794
|
{
|
1792
|
1795
|
if(encoderpos<5) encoderpos=5;
|
1793
|
|
- if(encoderpos>9999) encoderpos=9999;
|
|
1796
|
+ if(encoderpos>999999) encoderpos=999999;
|
1794
|
1797
|
lcd.setCursor(11,line);lcd.print(ftostr52(encoderpos/100.0));
|
1795
|
1798
|
}
|
1796
|
1799
|
|
|
@@ -1800,7 +1803,7 @@ void MainMenu::showControlMotion()
|
1800
|
1803
|
if(force_lcd_update)
|
1801
|
1804
|
{
|
1802
|
1805
|
lcd.setCursor(0,line);lcdprintPGM(MSG_ZSTEPS);
|
1803
|
|
- lcd.setCursor(11,line);lcd.print(ftostr52(axis_steps_per_unit[2]));
|
|
1806
|
+ lcd.setCursor(11,line);lcd.print(ftostr52(axis_steps_per_unit[Z_AXIS]));
|
1804
|
1807
|
}
|
1805
|
1808
|
|
1806
|
1809
|
if((activeline!=line) )
|
|
@@ -1811,13 +1814,13 @@ void MainMenu::showControlMotion()
|
1811
|
1814
|
linechanging=!linechanging;
|
1812
|
1815
|
if(linechanging)
|
1813
|
1816
|
{
|
1814
|
|
- encoderpos=(int)(axis_steps_per_unit[2]*100.0);
|
|
1817
|
+ encoderpos=(long)(axis_steps_per_unit[Z_AXIS]*100.0);
|
1815
|
1818
|
}
|
1816
|
1819
|
else
|
1817
|
1820
|
{
|
1818
|
|
- float factor=float(encoderpos)/100.0/float(axis_steps_per_unit[2]);
|
|
1821
|
+ float factor=float(encoderpos)/100.0/float(axis_steps_per_unit[Z_AXIS]);
|
1819
|
1822
|
position[Z_AXIS]=lround(position[Z_AXIS]*factor);
|
1820
|
|
- //current_position[3]*=factor;
|
|
1823
|
+ //current_position[Z_AXIS]*=factor;
|
1821
|
1824
|
axis_steps_per_unit[Z_AXIS]= encoderpos/100.0;
|
1822
|
1825
|
encoderpos=activeline*lcdslow;
|
1823
|
1826
|
|
|
@@ -1828,7 +1831,7 @@ void MainMenu::showControlMotion()
|
1828
|
1831
|
if(linechanging)
|
1829
|
1832
|
{
|
1830
|
1833
|
if(encoderpos<5) encoderpos=5;
|
1831
|
|
- if(encoderpos>9999) encoderpos=9999;
|
|
1834
|
+ if(encoderpos>999999) encoderpos=999999;
|
1832
|
1835
|
lcd.setCursor(11,line);lcd.print(ftostr52(encoderpos/100.0));
|
1833
|
1836
|
}
|
1834
|
1837
|
|
|
@@ -1839,7 +1842,7 @@ void MainMenu::showControlMotion()
|
1839
|
1842
|
if(force_lcd_update)
|
1840
|
1843
|
{
|
1841
|
1844
|
lcd.setCursor(0,line);lcdprintPGM(MSG_ESTEPS);
|
1842
|
|
- lcd.setCursor(11,line);lcd.print(ftostr52(axis_steps_per_unit[3]));
|
|
1845
|
+ lcd.setCursor(11,line);lcd.print(ftostr52(axis_steps_per_unit[E_AXIS]));
|
1843
|
1846
|
}
|
1844
|
1847
|
|
1845
|
1848
|
if((activeline!=line) )
|
|
@@ -1850,13 +1853,13 @@ void MainMenu::showControlMotion()
|
1850
|
1853
|
linechanging=!linechanging;
|
1851
|
1854
|
if(linechanging)
|
1852
|
1855
|
{
|
1853
|
|
- encoderpos=(int)(axis_steps_per_unit[3]*100.0);
|
|
1856
|
+ encoderpos=(long)(axis_steps_per_unit[E_AXIS]*100.0);
|
1854
|
1857
|
}
|
1855
|
1858
|
else
|
1856
|
1859
|
{
|
1857
|
|
- float factor=float(encoderpos)/100.0/float(axis_steps_per_unit[3]);
|
|
1860
|
+ float factor=float(encoderpos)/100.0/float(axis_steps_per_unit[E_AXIS]);
|
1858
|
1861
|
position[E_AXIS]=lround(position[E_AXIS]*factor);
|
1859
|
|
- //current_position[3]*=factor;
|
|
1862
|
+ //current_position[E_AXIS]*=factor;
|
1860
|
1863
|
axis_steps_per_unit[E_AXIS]= encoderpos/100.0;
|
1861
|
1864
|
encoderpos=activeline*lcdslow;
|
1862
|
1865
|
|
|
@@ -1867,7 +1870,7 @@ void MainMenu::showControlMotion()
|
1867
|
1870
|
if(linechanging)
|
1868
|
1871
|
{
|
1869
|
1872
|
if(encoderpos<5) encoderpos=5;
|
1870
|
|
- if(encoderpos>9999) encoderpos=9999;
|
|
1873
|
+ if(encoderpos>999999) encoderpos=999999;
|
1871
|
1874
|
lcd.setCursor(11,line);lcd.print(ftostr52(encoderpos/100.0));
|
1872
|
1875
|
}
|
1873
|
1876
|
|
|
@@ -2108,9 +2111,10 @@ void MainMenu::showMainMenu()
|
2108
|
2111
|
}
|
2109
|
2112
|
}
|
2110
|
2113
|
clearIfNecessary();
|
2111
|
|
- for(int8_t line=0;line<LCD_HEIGHT;line++)
|
|
2114
|
+ uint8_t line=0;
|
|
2115
|
+ for(int8_t i=lineoffset;i<lineoffset+LCD_HEIGHT;i++)
|
2112
|
2116
|
{
|
2113
|
|
- switch(line)
|
|
2117
|
+ switch(i)
|
2114
|
2118
|
{
|
2115
|
2119
|
case ItemM_watch:
|
2116
|
2120
|
MENUITEM( lcdprintPGM(MSG_WATCH) , BLOCK;status=Main_Status;beepshort(); ) ;
|
|
@@ -2164,6 +2168,7 @@ void MainMenu::showMainMenu()
|
2164
|
2168
|
SERIAL_ERRORLNPGM(MSG_SERIAL_ERROR_MENU_STRUCTURE);
|
2165
|
2169
|
break;
|
2166
|
2170
|
}
|
|
2171
|
+ line++;
|
2167
|
2172
|
}
|
2168
|
2173
|
updateActiveLines(3,encoderpos);
|
2169
|
2174
|
}
|
|
@@ -2381,4 +2386,4 @@ char *ftostr52(const float &x)
|
2381
|
2386
|
|
2382
|
2387
|
#endif //ULTRA_LCD
|
2383
|
2388
|
|
2384
|
|
-
|
|
2389
|
+
|