Browse Source

Merge branch 'Marlin_v1' of https://github.com/ErikZalm/Marlin into Marlin_v1

Daid 13 years ago
parent
commit
7244aa7eb7
9 changed files with 96 additions and 74 deletions
  1. 1
    0
      Marlin/Configuration.h
  2. 3
    2
      Marlin/Marlin.pde
  3. 13
    1
      Marlin/pins.h
  4. 11
    11
      Marlin/planner.cpp
  5. 4
    4
      Marlin/planner.h
  6. 5
    5
      Marlin/temperature.cpp
  7. 6
    4
      Marlin/ultralcd.h
  8. 51
    46
      Marlin/ultralcd.pde
  9. 2
    1
      README.md

+ 1
- 0
Marlin/Configuration.h View File

@@ -26,6 +26,7 @@
26 26
 // Gen6 = 5
27 27
 // Gen6 deluxe = 51
28 28
 // Sanguinololu 1.2 and above = 62
29
+// Melzi = 63
29 30
 // Ultimaker = 7
30 31
 // Teensylu = 8
31 32
 // Gen3+ =9

+ 3
- 2
Marlin/Marlin.pde View File

@@ -300,6 +300,8 @@ void setup()
300 300
   st_init();    // Initialize stepper;
301 301
   wd_init();
302 302
   setup_photpin();
303
+  
304
+  LCD_INIT;
303 305
 }
304 306
 
305 307
 
@@ -687,7 +689,6 @@ void process_commands()
687 689
         st_synchronize();
688 690
       for(int8_t i=0; i < NUM_AXIS; i++) {
689 691
         if(code_seen(axis_codes[i])) { 
690
-           current_position[i] = code_value()+add_homeing[i];  
691 692
            if(i == E_AXIS) {
692 693
              current_position[i] = code_value();  
693 694
              plan_set_e_position(current_position[E_AXIS]);
@@ -1246,7 +1247,7 @@ void process_commands()
1246 1247
      }
1247 1248
     break;
1248 1249
       
1249
-    case 302: // finish all moves
1250
+    case 302: // allow cold extrudes
1250 1251
     {
1251 1252
       allow_cold_extrudes(true);
1252 1253
     }

+ 13
- 1
Marlin/pins.h View File

@@ -554,7 +554,10 @@
554 554
 * Sanguinololu pin assignment
555 555
 *
556 556
 ****************************************************************************************/
557
-#if MOTHERBOARD == 62
557
+#if MOTHERBOARD == 63
558
+#define MELZI
559
+#endif
560
+#if MOTHERBOARD == 62 || MOTHERBOARD == 63
558 561
 #undef MOTHERBOARD
559 562
 #define MOTHERBOARD 6
560 563
 #define SANGUINOLOLU_V_1_2 
@@ -589,6 +592,11 @@
589 592
 
590 593
 #define FAN_PIN            -1 
591 594
 
595
+#ifdef MELZI
596
+#define LED_PIN            28
597
+#define FAN_PIN            4
598
+#endif
599
+
592 600
 #define PS_ON_PIN          -1
593 601
 #define KILL_PIN           -1
594 602
 
@@ -621,6 +629,10 @@
621 629
 #define SDPOWER            -1
622 630
 #define SDSS               31
623 631
 
632
+#ifdef MELZI
633
+#define SDSS               24
634
+#endif
635
+
624 636
 #endif
625 637
 
626 638
 

+ 11
- 11
Marlin/planner.cpp View File

@@ -556,8 +556,8 @@ void plan_buffer_line(const float &x, const float &y, const float &z, const floa
556 556
   delta_mm[Y_AXIS] = (target[Y_AXIS]-position[Y_AXIS])/axis_steps_per_unit[Y_AXIS];
557 557
   delta_mm[Z_AXIS] = (target[Z_AXIS]-position[Z_AXIS])/axis_steps_per_unit[Z_AXIS];
558 558
   delta_mm[E_AXIS] = ((target[E_AXIS]-position[E_AXIS])/axis_steps_per_unit[E_AXIS])*extrudemultiply/100.0;
559
-  if ( block->steps_x == 0 && block->steps_y == 0 && block->steps_z == 0 ) {
560
-    block->millimeters = abs(delta_mm[E_AXIS]);
559
+  if ( block->steps_x <=dropsegments && block->steps_y <=dropsegments && block->steps_z <=dropsegments ) {
560
+    block->millimeters = fabs(delta_mm[E_AXIS]);
561 561
   } else {
562 562
     block->millimeters = sqrt(square(delta_mm[X_AXIS]) + square(delta_mm[Y_AXIS]) + square(delta_mm[Z_AXIS]));
563 563
   }
@@ -593,8 +593,8 @@ void plan_buffer_line(const float &x, const float &y, const float &z, const floa
593 593
   float speed_factor = 1.0; //factor <=1 do decrease speed
594 594
   for(int i=0; i < 4; i++) {
595 595
     current_speed[i] = delta_mm[i] * inverse_second;
596
-    if(abs(current_speed[i]) > max_feedrate[i])
597
-      speed_factor = min(speed_factor, max_feedrate[i] / abs(current_speed[i]));
596
+    if(fabs(current_speed[i]) > max_feedrate[i])
597
+      speed_factor = min(speed_factor, max_feedrate[i] / fabs(current_speed[i]));
598 598
   }
599 599
 
600 600
 // Max segement time in us.
@@ -698,25 +698,25 @@ void plan_buffer_line(const float &x, const float &y, const float &z, const floa
698 698
 #endif
699 699
   // Start with a safe speed
700 700
   float vmax_junction = max_xy_jerk/2;  
701
-  if(abs(current_speed[Z_AXIS]) > max_z_jerk/2) 
701
+  if(fabs(current_speed[Z_AXIS]) > max_z_jerk/2) 
702 702
     vmax_junction = max_z_jerk/2;
703 703
   vmax_junction = min(vmax_junction, block->nominal_speed);
704
-  if(abs(current_speed[E_AXIS]) > max_e_jerk/2) 
704
+  if(fabs(current_speed[E_AXIS]) > max_e_jerk/2) 
705 705
     vmax_junction = min(vmax_junction, max_e_jerk/2);
706 706
     
707 707
   if ((moves_queued > 1) && (previous_nominal_speed > 0.0001)) {
708 708
     float jerk = sqrt(pow((current_speed[X_AXIS]-previous_speed[X_AXIS]), 2)+pow((current_speed[Y_AXIS]-previous_speed[Y_AXIS]), 2));
709
-    if((abs(previous_speed[X_AXIS]) > 0.0001) || (abs(previous_speed[Y_AXIS]) > 0.0001)) {
709
+    if((fabs(previous_speed[X_AXIS]) > 0.0001) || (fabs(previous_speed[Y_AXIS]) > 0.0001)) {
710 710
       vmax_junction = block->nominal_speed;
711 711
     }
712 712
     if (jerk > max_xy_jerk) {
713 713
       vmax_junction *= (max_xy_jerk/jerk);
714 714
     } 
715
-    if(abs(current_speed[Z_AXIS] - previous_speed[Z_AXIS]) > max_z_jerk) {
716
-      vmax_junction *= (max_z_jerk/abs(current_speed[Z_AXIS] - previous_speed[Z_AXIS]));
715
+    if(fabs(current_speed[Z_AXIS] - previous_speed[Z_AXIS]) > max_z_jerk) {
716
+      vmax_junction *= (max_z_jerk/fabs(current_speed[Z_AXIS] - previous_speed[Z_AXIS]));
717 717
     } 
718
-    if(abs(current_speed[E_AXIS] - previous_speed[E_AXIS]) > max_e_jerk) {
719
-      vmax_junction *= (max_e_jerk/abs(current_speed[E_AXIS] - previous_speed[E_AXIS]));
718
+    if(fabs(current_speed[E_AXIS] - previous_speed[E_AXIS]) > max_e_jerk) {
719
+      vmax_junction *= (max_e_jerk/fabs(current_speed[E_AXIS] - previous_speed[E_AXIS]));
720 720
     } 
721 721
   }
722 722
   block->max_entry_speed = vmax_junction;

+ 4
- 4
Marlin/planner.h View File

@@ -45,10 +45,10 @@ typedef struct {
45 45
   #endif
46 46
 
47 47
   // Fields used by the motion planner to manage acceleration
48
-//  float speed_x, speed_y, speed_z, speed_e;        // Nominal mm/minute for each axis
49
-  float nominal_speed;                               // The nominal speed for this block in mm/min  
50
-  float entry_speed;                                 // Entry speed at previous-current junction in mm/min
51
-  float max_entry_speed;                             // Maximum allowable junction entry speed in mm/min
48
+//  float speed_x, speed_y, speed_z, speed_e;        // Nominal mm/sec for each axis
49
+  float nominal_speed;                               // The nominal speed for this block in mm/sec 
50
+  float entry_speed;                                 // Entry speed at previous-current junction in mm/sec
51
+  float max_entry_speed;                             // Maximum allowable junction entry speed in mm/sec
52 52
   float millimeters;                                 // The total travel of this block in mm
53 53
   float acceleration;                                // acceleration mm/sec^2
54 54
   unsigned char recalculate_flag;                    // Planner flag to recalculate trapezoids on entry junction

+ 5
- 5
Marlin/temperature.cpp View File

@@ -134,8 +134,8 @@ void PID_autotune(float temp)
134 134
   long t_high;
135 135
   long t_low;
136 136
 
137
-  long bias=127;
138
-  long d = 127;
137
+  long bias=PID_MAX/2;
138
+  long d = PID_MAX/2;
139 139
   float Ku, Tu;
140 140
   float Kp, Ki, Kd;
141 141
   float max, min;
@@ -144,7 +144,7 @@ void PID_autotune(float temp)
144 144
   
145 145
   disable_heater(); // switch off all heaters.
146 146
   
147
-  soft_pwm[0] = 255>>1;
147
+  soft_pwm[0] = PID_MAX/2;
148 148
     
149 149
   for(;;) {
150 150
 
@@ -172,8 +172,8 @@ void PID_autotune(float temp)
172 172
           t_low=t2 - t1;
173 173
           if(cycles > 0) {
174 174
             bias += (d*(t_high - t_low))/(t_low + t_high);
175
-            bias = constrain(bias, 20 ,235);
176
-            if(bias > 127) d = 254 - bias;
175
+            bias = constrain(bias, 20 ,PID_MAX-20);
176
+            if(bias > PID_MAX/2) d = PID_MAX - 1 - bias;
177 177
             else d = bias;
178 178
 
179 179
             SERIAL_PROTOCOLPGM(" bias: "); SERIAL_PROTOCOL(bias);

+ 6
- 4
Marlin/ultralcd.h View File

@@ -7,6 +7,7 @@
7 7
   void lcd_init();
8 8
   void lcd_status(const char* message);
9 9
   void beep();
10
+  void buttons_init();
10 11
   void buttons_check();
11 12
 
12 13
   #define LCD_UPDATE_INTERVAL 100
@@ -69,7 +70,7 @@
69 70
     void showAxisMove();
70 71
     void showSD();
71 72
     bool force_lcd_update;
72
-    int lastencoderpos;
73
+    long lastencoderpos;
73 74
     int8_t lineoffset;
74 75
     int8_t lastlineoffset;
75 76
     
@@ -78,11 +79,11 @@
78 79
     bool tune;
79 80
     
80 81
   private:
81
-    FORCE_INLINE void updateActiveLines(const uint8_t &maxlines,volatile int &encoderpos)
82
+    FORCE_INLINE void updateActiveLines(const uint8_t &maxlines,volatile long &encoderpos)
82 83
     {
83 84
       if(linechanging) return; // an item is changint its value, do not switch lines hence
84 85
       lastlineoffset=lineoffset; 
85
-      int curencoderpos=encoderpos;  
86
+      long curencoderpos=encoderpos;  
86 87
       force_lcd_update=false;
87 88
       if(  (abs(curencoderpos-lastencoderpos)<lcdslow) ) 
88 89
       { 
@@ -134,11 +135,12 @@
134 135
   char *ftostr3(const float &x);
135 136
 
136 137
 
137
-
138
+  #define LCD_INIT lcd_init();
138 139
   #define LCD_MESSAGE(x) lcd_status(x);
139 140
   #define LCD_MESSAGEPGM(x) lcd_statuspgm(MYPGM(x));
140 141
   #define LCD_STATUS lcd_status()
141 142
 #else //no lcd
143
+  #define LCD_INIT
142 144
   #define LCD_STATUS
143 145
   #define LCD_MESSAGE(x)
144 146
   #define LCD_MESSAGEPGM(x)

+ 51
- 46
Marlin/ultralcd.pde View File

@@ -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
+

+ 2
- 1
README.md View File

@@ -161,7 +161,8 @@ Advance:
161 161
 
162 162
 EEPROM:
163 163
 
164
-*   M500 - stores paramters in EEPROM
164
+*   M500 - stores paramters in EEPROM. This parameters are stored:  axis_steps_per_unit,  max_feedrate, max_acceleration  ,acceleration,retract_acceleration,
165
+  minimumfeedrate,mintravelfeedrate,minsegmenttime,  jerk velocities, PID
165 166
 *   M501 - reads parameters from EEPROM (if you need reset them after you changed them temporarily).  
166 167
 *   M502 - reverts to the default "factory settings".  You still need to store them in EEPROM afterwards if you want to.
167 168
 *   M503 - print the current settings (from memory not from eeprom)

Loading…
Cancel
Save