Procházet zdrojové kódy

Merge branch 'Marlin_v1', remote-tracking branch 'origin/Marlin_v1' into Marlin_v1

Erik van der Zalm před 12 roky
rodič
revize
15bb3f284e
5 změnil soubory, kde provedl 450 přidání a 454 odebrání
  1. 4
    2
      Marlin/cardreader.h
  2. 80
    35
      Marlin/cardreader.pde
  3. 53
    2
      Marlin/ultralcd.h
  4. 306
    411
      Marlin/ultralcd.pde
  5. 7
    4
      README.md

+ 4
- 2
Marlin/cardreader.h Zobrazit soubor

@@ -28,7 +28,8 @@ public:
28 28
   
29 29
 
30 30
   void ls();
31
-  
31
+  void chdir(const char * relpath);
32
+  void updir();
32 33
 
33 34
   inline bool eof() { return sdpos>=filesize ;};
34 35
   inline int16_t get() {  sdpos = file.curPosition();return (int16_t)file.read();};
@@ -40,8 +41,9 @@ public:
40 41
   bool sdprinting ;  
41 42
   bool cardOK ;
42 43
   char filename[11];
44
+  bool filenameIsDir;
43 45
 private:
44
-  SdFile root,*curDir;
46
+  SdFile root,*curDir,workDir,workDirParent,workDirParentParent;
45 47
   Sd2Card card;
46 48
   SdVolume volume;
47 49
   SdFile file;

+ 80
- 35
Marlin/cardreader.pde Zobrazit soubor

@@ -1,4 +1,5 @@
1 1
 #include "cardreader.h"
2
+//#include <unistd.h>
2 3
 #ifdef SDSUPPORT
3 4
 
4 5
 CardReader::CardReader()
@@ -36,11 +37,7 @@ char *createFilename(char *buffer,const dir_t &p) //buffer>12characters
36 37
   return buffer;
37 38
 }
38 39
 
39
-// bool SdFat::chdir(bool set_cwd) {
40
-//   if (set_cwd) SdBaseFile::cwd_ = &vwd_;
41
-//   vwd_.close();
42
-//   return vwd_.openRoot(&vol_);
43
-// }
40
+
44 41
 void  CardReader::lsDive(char *prepend,SdFile parent)
45 42
 {
46 43
   dir_t p;
@@ -85,11 +82,19 @@ void  CardReader::lsDive(char *prepend,SdFile parent)
85 82
     {
86 83
       if (p.name[0] == DIR_NAME_FREE) break;
87 84
       if (p.name[0] == DIR_NAME_DELETED || p.name[0] == '.'|| p.name[0] == '_') continue;
85
+      if ( p.name[0] == '.')
86
+      {
87
+        if ( p.name[1] != '.')
88
+        continue;
89
+      }
88 90
       if (!DIR_IS_FILE_OR_SUBDIR(&p)) continue;
91
+      filenameIsDir=DIR_IS_SUBDIR(&p);
89 92
       
90
-      
91
-      if(p.name[8]!='G') continue;
92
-      if(p.name[9]=='~') continue;
93
+      if(!filenameIsDir)
94
+      {
95
+        if(p.name[8]!='G') continue;
96
+        if(p.name[9]=='~') continue;
97
+      }
93 98
       //if(cnt++!=nr) continue;
94 99
       createFilename(filename,p);
95 100
       if(lsAction==LS_SerialPrint)
@@ -126,33 +131,35 @@ void CardReader::ls()
126 131
 void CardReader::initsd()
127 132
 {
128 133
   cardOK = false;
129
-  #if SDSS >- 1
130
-    if(root.isOpen())
131
-      root.close();
132
-    if (!card.init(SPI_FULL_SPEED,SDSS))
133
-    {
134
-      //if (!card.init(SPI_HALF_SPEED,SDSS))
135
-      SERIAL_ECHO_START;
136
-      SERIAL_ECHOLNPGM("SD init fail");
137
-    }
138
-    else if (!volume.init(&card))
139
-    {
140
-      SERIAL_ERROR_START;
141
-      SERIAL_ERRORLNPGM("volume.init failed");
142
-    }
143
-    else if (!root.openRoot(&volume)) 
144
-    {
145
-      SERIAL_ERROR_START;
146
-      SERIAL_ERRORLNPGM("openRoot failed");
147
-    }
148
-    else 
149
-    {
150
-      cardOK = true;
151
-      SERIAL_ECHO_START;
152
-      SERIAL_ECHOLNPGM("SD card ok");
153
-    }
154
-    curDir=&root;
155
-  #endif //SDSS
134
+  if(root.isOpen())
135
+    root.close();
136
+  if (!card.init(SPI_FULL_SPEED,SDSS))
137
+  {
138
+    //if (!card.init(SPI_HALF_SPEED,SDSS))
139
+    SERIAL_ECHO_START;
140
+    SERIAL_ECHOLNPGM("SD init fail");
141
+  }
142
+  else if (!volume.init(&card))
143
+  {
144
+    SERIAL_ERROR_START;
145
+    SERIAL_ERRORLNPGM("volume.init failed");
146
+  }
147
+  else if (!root.openRoot(&volume)) 
148
+  {
149
+    SERIAL_ERROR_START;
150
+    SERIAL_ERRORLNPGM("openRoot failed");
151
+  }
152
+  else 
153
+  {
154
+    cardOK = true;
155
+    SERIAL_ECHO_START;
156
+    SERIAL_ECHOLNPGM("SD card ok");
157
+  }
158
+  curDir=&root;
159
+  if(!workDir.openRoot(&volume))
160
+  {
161
+    SERIAL_ECHOLNPGM("workDir open failed");
162
+  }
156 163
 }
157 164
 void CardReader::release()
158 165
 {
@@ -229,6 +236,10 @@ void CardReader::openFile(char* name,bool read)
229 236
       
230 237
     }
231 238
   }
239
+  else //relative path
240
+  {
241
+    curDir=&workDir;
242
+  }
232 243
   if(read)
233 244
   {
234 245
     if (file.open(curDir, fname, O_READ)) 
@@ -362,6 +373,7 @@ void CardReader::closefile()
362 373
 
363 374
 void CardReader::getfilename(const uint8_t nr)
364 375
 {
376
+  curDir=&workDir;
365 377
   lsAction=LS_GetFilename;
366 378
   nrFiles=nr;
367 379
   curDir->rewind();
@@ -371,12 +383,45 @@ void CardReader::getfilename(const uint8_t nr)
371 383
 
372 384
 uint16_t CardReader::getnrfilenames()
373 385
 {
386
+  curDir=&workDir;
374 387
   lsAction=LS_Count;
375 388
   nrFiles=0;
376 389
   curDir->rewind();
377 390
   lsDive("",*curDir);
391
+  //SERIAL_ECHOLN(nrFiles);
378 392
   return nrFiles;
379 393
 }
380 394
 
395
+void CardReader::chdir(const char * relpath)
396
+{
397
+  SdFile newfile;
398
+  SdFile *parent=&root;
399
+  
400
+  if(workDir.isOpen())
401
+    parent=&workDir;
402
+  
403
+  if(!newfile.open(*parent,relpath, O_READ))
404
+  {
405
+   SERIAL_ECHO_START;
406
+   SERIAL_ECHOPGM("Cannot enter subdir:");
407
+   SERIAL_ECHOLN(relpath);
408
+  }
409
+  else
410
+  {
411
+    workDirParentParent=workDirParent;
412
+    workDirParent=*parent;
413
+    
414
+    workDir=newfile;
415
+  }
416
+}
417
+
418
+void CardReader::updir()
419
+{
420
+  if(!workDir.isRoot())
421
+  {
422
+    workDir=workDirParent;
423
+    workDirParent=workDirParentParent;
424
+  }
425
+}
381 426
 
382 427
 #endif //SDSUPPORT

+ 53
- 2
Marlin/ultralcd.h Zobrazit soubor

@@ -51,13 +51,13 @@
51 51
   #define blocktime 500
52 52
   #define lcdslow 5
53 53
     
54
-  enum MainStatus{Main_Status, Main_Menu, Main_Prepare, Main_Control, Main_SD};
54
+  enum MainStatus{Main_Status, Main_Menu, Main_Prepare, Main_Control, Main_SD,Sub_TempControl,Sub_MotionControl};
55 55
 
56 56
   class MainMenu{
57 57
   public:
58 58
     MainMenu();
59 59
     void update();
60
-    uint8_t activeline;
60
+    int8_t activeline;
61 61
     MainStatus status;
62 62
     uint8_t displayStartingRow;
63 63
     
@@ -65,6 +65,8 @@
65 65
     void showMainMenu();
66 66
     void showPrepare();
67 67
     void showControl();
68
+    void showControlMotion();
69
+    void showControlTemp();
68 70
     void showSD();
69 71
     bool force_lcd_update;
70 72
     int lastencoderpos;
@@ -72,6 +74,55 @@
72 74
     int8_t lastlineoffset;
73 75
     
74 76
     bool linechanging;
77
+    
78
+  private:
79
+    inline void updateActiveLines(const uint8_t &maxlines,volatile int &encoderpos)
80
+    {
81
+      if(linechanging) return; // an item is changint its value, do not switch lines hence
82
+      lastlineoffset=lineoffset; 
83
+      int curencoderpos=encoderpos;  
84
+      force_lcd_update=false;
85
+      if(  (abs(curencoderpos-lastencoderpos)<lcdslow) ) 
86
+      { 
87
+        lcd.setCursor(0,activeline);lcd.print((activeline+lineoffset)?' ':' '); 
88
+        if(curencoderpos<0)  
89
+        {  
90
+          lineoffset--; 
91
+          if(lineoffset<0) lineoffset=0; 
92
+          curencoderpos=lcdslow-1; 
93
+          force_lcd_update=true; 
94
+        } 
95
+        if(curencoderpos>(LCD_HEIGHT-1+1)*lcdslow) 
96
+        { 
97
+          lineoffset++; 
98
+          curencoderpos=(LCD_HEIGHT-1)*lcdslow; 
99
+          if(lineoffset>(maxlines+1-LCD_HEIGHT)) 
100
+            lineoffset=maxlines+1-LCD_HEIGHT; 
101
+          if(curencoderpos>maxlines*lcdslow) 
102
+            curencoderpos=maxlines*lcdslow; 
103
+          force_lcd_update=true; 
104
+        } 
105
+        lastencoderpos=encoderpos=curencoderpos; 
106
+        activeline=curencoderpos/lcdslow;
107
+        if(activeline<0) activeline=0;
108
+        if(activeline>LCD_HEIGHT-1) activeline=LCD_HEIGHT-1;
109
+        if(activeline>maxlines) 
110
+        {
111
+          activeline=maxlines;
112
+          curencoderpos=maxlines*lcdslow;
113
+        }
114
+        lcd.setCursor(0,activeline);lcd.print((activeline+lineoffset)?'>':'\003');    
115
+      } 
116
+    }
117
+    
118
+    inline void clearIfNecessary()
119
+    {
120
+      if(lastlineoffset!=lineoffset ||force_lcd_update)
121
+      {
122
+        force_lcd_update=true;
123
+         lcd.clear();
124
+      } 
125
+    }
75 126
   };
76 127
 
77 128
   //conversion routines, could need some overworking

+ 306
- 411
Marlin/ultralcd.pde
Diff nebyl zobrazen, protože je příliš veliký
Zobrazit soubor


+ 7
- 4
README.md Zobrazit soubor

@@ -54,6 +54,7 @@ This is only possible, if some future moves are already processed, hence the nam
54 54
 It leads to less over-deposition at corners, especially at flat angles.
55 55
 
56 56
 *Arc support:*
57
+
57 58
 Splic3r can find curves that, although broken into segments, were ment to describe an arc.
58 59
 Marlin is able to print those arcs. The advantage is the firmware can choose the resolution,
59 60
 and can perform the arc with nearly constant velocity, resulting in a nice finish. 
@@ -118,13 +119,15 @@ This leads to less blocking in the heater management routine.
118 119
 
119 120
 Non-standard M-Codes, different to an old version of sprinter:
120 121
 ==============================================================
122
+Movement:
123
+
121 124
 *   G2  - CW ARC
122 125
 *   G3  - CCW ARC
123 126
 
124 127
 General:
125 128
 
126
-*   M17  - Enable/Power all stepper motors
127
-*   M18  - Disable all stepper motors; same as M84
129
+*   M17  - Enable/Power all stepper motors. Compatibility to ReplicatorG.
130
+*   M18  - Disable all stepper motors; same as M84.Compatibility to ReplicatorG.
128 131
 *   M30  - Print time since last M109 or SD card start to serial
129 132
 *   M42  - Change pin status via gcode
130 133
 *   M80  - Turn on Power Supply
@@ -137,9 +140,9 @@ Movement variables:
137 140
 *   M202 - Set max acceleration in units/s^2 for travel moves (M202 X1000 Y1000) Unused in Marlin!!
138 141
 *   M203 - Set maximum feedrate that your machine can sustain (M203 X200 Y200 Z300 E10000) in mm/sec
139 142
 *   M204 - Set default acceleration: S normal moves T filament only moves (M204 S3000 T7000) im mm/sec^2  also sets minimum segment time in ms (B20000) to prevent buffer underruns and M20 minimum feedrate
140
-*   M220 - set build speed factor override percentage S:factor in percent ; aka "realtime tuneing in the gcode"
143
+*   M220 - set build speed mulitplying S:factor in percent ; aka "realtime tuneing in the gcode". So you can slow down if you have islands in one height-range, and speed up otherwise.
141 144
 *   M301 - Set PID parameters P I and D
142
-*   M400 - Finish all moves
145
+*   M400 - Finish all buffered moves.
143 146
 
144 147
 Advance:
145 148
 

Loading…
Zrušit
Uložit