Browse Source

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

pull/1/head
Erik van der Zalm 13 years ago
parent
commit
15bb3f284e
  1. 6
      Marlin/cardreader.h
  2. 115
      Marlin/cardreader.pde
  3. 55
      Marlin/ultralcd.h
  4. 713
      Marlin/ultralcd.pde
  5. 11
      README.md

6
Marlin/cardreader.h

@ -28,7 +28,8 @@ public:
void ls();
void chdir(const char * relpath);
void updir();
inline bool eof() { return sdpos>=filesize ;};
inline int16_t get() { sdpos = file.curPosition();return (int16_t)file.read();};
@ -40,8 +41,9 @@ public:
bool sdprinting ;
bool cardOK ;
char filename[11];
bool filenameIsDir;
private:
SdFile root,*curDir;
SdFile root,*curDir,workDir,workDirParent,workDirParentParent;
Sd2Card card;
SdVolume volume;
SdFile file;

115
Marlin/cardreader.pde

@ -1,4 +1,5 @@
#include "cardreader.h"
//#include <unistd.h>
#ifdef SDSUPPORT
CardReader::CardReader()
@ -36,11 +37,7 @@ char *createFilename(char *buffer,const dir_t &p) //buffer>12characters
return buffer;
}
// bool SdFat::chdir(bool set_cwd) {
// if (set_cwd) SdBaseFile::cwd_ = &vwd_;
// vwd_.close();
// return vwd_.openRoot(&vol_);
// }
void CardReader::lsDive(char *prepend,SdFile parent)
{
dir_t p;
@ -85,11 +82,19 @@ void CardReader::lsDive(char *prepend,SdFile parent)
{
if (p.name[0] == DIR_NAME_FREE) break;
if (p.name[0] == DIR_NAME_DELETED || p.name[0] == '.'|| p.name[0] == '_') continue;
if ( p.name[0] == '.')
{
if ( p.name[1] != '.')
continue;
}
if (!DIR_IS_FILE_OR_SUBDIR(&p)) continue;
filenameIsDir=DIR_IS_SUBDIR(&p);
if(p.name[8]!='G') continue;
if(p.name[9]=='~') continue;
if(!filenameIsDir)
{
if(p.name[8]!='G') continue;
if(p.name[9]=='~') continue;
}
//if(cnt++!=nr) continue;
createFilename(filename,p);
if(lsAction==LS_SerialPrint)
@ -126,33 +131,35 @@ void CardReader::ls()
void CardReader::initsd()
{
cardOK = false;
#if SDSS >- 1
if(root.isOpen())
root.close();
if (!card.init(SPI_FULL_SPEED,SDSS))
{
//if (!card.init(SPI_HALF_SPEED,SDSS))
SERIAL_ECHO_START;
SERIAL_ECHOLNPGM("SD init fail");
}
else if (!volume.init(&card))
{
SERIAL_ERROR_START;
SERIAL_ERRORLNPGM("volume.init failed");
}
else if (!root.openRoot(&volume))
{
SERIAL_ERROR_START;
SERIAL_ERRORLNPGM("openRoot failed");
}
else
{
cardOK = true;
SERIAL_ECHO_START;
SERIAL_ECHOLNPGM("SD card ok");
}
curDir=&root;
#endif //SDSS
if(root.isOpen())
root.close();
if (!card.init(SPI_FULL_SPEED,SDSS))
{
//if (!card.init(SPI_HALF_SPEED,SDSS))
SERIAL_ECHO_START;
SERIAL_ECHOLNPGM("SD init fail");
}
else if (!volume.init(&card))
{
SERIAL_ERROR_START;
SERIAL_ERRORLNPGM("volume.init failed");
}
else if (!root.openRoot(&volume))
{
SERIAL_ERROR_START;
SERIAL_ERRORLNPGM("openRoot failed");
}
else
{
cardOK = true;
SERIAL_ECHO_START;
SERIAL_ECHOLNPGM("SD card ok");
}
curDir=&root;
if(!workDir.openRoot(&volume))
{
SERIAL_ECHOLNPGM("workDir open failed");
}
}
void CardReader::release()
{
@ -229,6 +236,10 @@ void CardReader::openFile(char* name,bool read)
}
}
else //relative path
{
curDir=&workDir;
}
if(read)
{
if (file.open(curDir, fname, O_READ))
@ -362,6 +373,7 @@ void CardReader::closefile()
void CardReader::getfilename(const uint8_t nr)
{
curDir=&workDir;
lsAction=LS_GetFilename;
nrFiles=nr;
curDir->rewind();
@ -371,12 +383,45 @@ void CardReader::getfilename(const uint8_t nr)
uint16_t CardReader::getnrfilenames()
{
curDir=&workDir;
lsAction=LS_Count;
nrFiles=0;
curDir->rewind();
lsDive("",*curDir);
//SERIAL_ECHOLN(nrFiles);
return nrFiles;
}
void CardReader::chdir(const char * relpath)
{
SdFile newfile;
SdFile *parent=&root;
if(workDir.isOpen())
parent=&workDir;
if(!newfile.open(*parent,relpath, O_READ))
{
SERIAL_ECHO_START;
SERIAL_ECHOPGM("Cannot enter subdir:");
SERIAL_ECHOLN(relpath);
}
else
{
workDirParentParent=workDirParent;
workDirParent=*parent;
workDir=newfile;
}
}
void CardReader::updir()
{
if(!workDir.isRoot())
{
workDir=workDirParent;
workDirParent=workDirParentParent;
}
}
#endif //SDSUPPORT

55
Marlin/ultralcd.h

@ -51,13 +51,13 @@
#define blocktime 500
#define lcdslow 5
enum MainStatus{Main_Status, Main_Menu, Main_Prepare, Main_Control, Main_SD};
enum MainStatus{Main_Status, Main_Menu, Main_Prepare, Main_Control, Main_SD,Sub_TempControl,Sub_MotionControl};
class MainMenu{
public:
MainMenu();
void update();
uint8_t activeline;
int8_t activeline;
MainStatus status;
uint8_t displayStartingRow;
@ -65,6 +65,8 @@
void showMainMenu();
void showPrepare();
void showControl();
void showControlMotion();
void showControlTemp();
void showSD();
bool force_lcd_update;
int lastencoderpos;
@ -72,6 +74,55 @@
int8_t lastlineoffset;
bool linechanging;
private:
inline void updateActiveLines(const uint8_t &maxlines,volatile int &encoderpos)
{
if(linechanging) return; // an item is changint its value, do not switch lines hence
lastlineoffset=lineoffset;
int curencoderpos=encoderpos;
force_lcd_update=false;
if( (abs(curencoderpos-lastencoderpos)<lcdslow) )
{
lcd.setCursor(0,activeline);lcd.print((activeline+lineoffset)?' ':' ');
if(curencoderpos<0)
{
lineoffset--;
if(lineoffset<0) lineoffset=0;
curencoderpos=lcdslow-1;
force_lcd_update=true;
}
if(curencoderpos>(LCD_HEIGHT-1+1)*lcdslow)
{
lineoffset++;
curencoderpos=(LCD_HEIGHT-1)*lcdslow;
if(lineoffset>(maxlines+1-LCD_HEIGHT))
lineoffset=maxlines+1-LCD_HEIGHT;
if(curencoderpos>maxlines*lcdslow)
curencoderpos=maxlines*lcdslow;
force_lcd_update=true;
}
lastencoderpos=encoderpos=curencoderpos;
activeline=curencoderpos/lcdslow;
if(activeline<0) activeline=0;
if(activeline>LCD_HEIGHT-1) activeline=LCD_HEIGHT-1;
if(activeline>maxlines)
{
activeline=maxlines;
curencoderpos=maxlines*lcdslow;
}
lcd.setCursor(0,activeline);lcd.print((activeline+lineoffset)?'>':'\003');
}
}
inline void clearIfNecessary()
{
if(lastlineoffset!=lineoffset ||force_lcd_update)
{
force_lcd_update=true;
lcd.clear();
}
}
};
//conversion routines, could need some overworking

713
Marlin/ultralcd.pde

File diff suppressed because it is too large

11
README.md

@ -54,6 +54,7 @@ This is only possible, if some future moves are already processed, hence the nam
It leads to less over-deposition at corners, especially at flat angles.
*Arc support:*
Splic3r can find curves that, although broken into segments, were ment to describe an arc.
Marlin is able to print those arcs. The advantage is the firmware can choose the resolution,
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.
Non-standard M-Codes, different to an old version of sprinter:
==============================================================
Movement:
* G2 - CW ARC
* G3 - CCW ARC
General:
* M17 - Enable/Power all stepper motors
* M18 - Disable all stepper motors; same as M84
* M17 - Enable/Power all stepper motors. Compatibility to ReplicatorG.
* M18 - Disable all stepper motors; same as M84.Compatibility to ReplicatorG.
* M30 - Print time since last M109 or SD card start to serial
* M42 - Change pin status via gcode
* M80 - Turn on Power Supply
@ -137,9 +140,9 @@ Movement variables:
* M202 - Set max acceleration in units/s^2 for travel moves (M202 X1000 Y1000) Unused in Marlin!!
* M203 - Set maximum feedrate that your machine can sustain (M203 X200 Y200 Z300 E10000) in mm/sec
* 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
* M220 - set build speed factor override percentage S:factor in percent ; aka "realtime tuneing in the gcode"
* 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.
* M301 - Set PID parameters P I and D
* M400 - Finish all moves
* M400 - Finish all buffered moves.
Advance:

Loading…
Cancel
Save