From d8e7e2f72e28d2df29f3f8b23215419e21b0727b Mon Sep 17 00:00:00 2001 From: Bernhard Kubicek Date: Sun, 20 Nov 2011 11:55:06 +0100 Subject: [PATCH 1/3] more readme --- README.md | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 16c1a632f0..5b1ead2039 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,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. @@ -120,13 +121,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 @@ -139,9 +142,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: From cd2268f10a88de393a565c887c8891c7f7979a97 Mon Sep 17 00:00:00 2001 From: Bernhard Kubicek Date: Sun, 20 Nov 2011 11:55:33 +0100 Subject: [PATCH 2/3] code cleanup in ultralcd. --- Marlin/ultralcd.h | 49 +++++++ Marlin/ultralcd.pde | 326 +++++++++----------------------------------- 2 files changed, 112 insertions(+), 263 deletions(-) diff --git a/Marlin/ultralcd.h b/Marlin/ultralcd.h index 6bae43dccb..d3496bec98 100644 --- a/Marlin/ultralcd.h +++ b/Marlin/ultralcd.h @@ -72,6 +72,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)(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 diff --git a/Marlin/ultralcd.pde b/Marlin/ultralcd.pde index c4ea234883..aa30a3dd0e 100644 --- a/Marlin/ultralcd.pde +++ b/Marlin/ultralcd.pde @@ -279,7 +279,6 @@ MainMenu::MainMenu() linechanging=false; } - void MainMenu::showStatus() { #if LCD_HEIGHT==4 @@ -426,131 +425,46 @@ void MainMenu::showStatus() enum {ItemP_exit, ItemP_home, ItemP_origin, ItemP_preheat, ItemP_extrude, ItemP_disstep}; +//any action must not contain a ',' character anywhere, or this breaks: +#define MENUITEM(repaint_action, click_action) \ + {\ + if(force_lcd_update) { lcd.setCursor(0,line); repaint_action; } \ + if((activeline==line) && CLICKED) {click_action} \ + } + void MainMenu::showPrepare() { uint8_t line=0; - if(lastlineoffset!=lineoffset) - { - force_lcd_update=true; - clear(); - } + clearIfNecessary(); for(int8_t i=lineoffset;i3) - { - lineoffset++; - encoderpos=3*lcdslow; - if(lineoffset>(ItemP_disstep+1-LCD_HEIGHT)) - lineoffset=ItemP_disstep+1-LCD_HEIGHT; - force_lcd_update=true; - } - //encoderpos=encoderpos%LCD_HEIGHT; - lastencoderpos=encoderpos; - activeline=encoderpos/lcdslow; - lcd.setCursor(0,activeline);lcd.print((activeline+lineoffset)?'>':'\003'); - } + updateActiveLines(ItemP_disstep,encoderpos); } enum { ItemC_exit, ItemC_nozzle, @@ -563,31 +477,35 @@ enum { ItemC_aret,ItemC_esteps, ItemC_store, ItemC_load,ItemC_failsafe }; +//does not work +// #define MENUCHANGEITEM(repaint_action, enter_action, accept_action, change_action) \ +// {\ +// if(force_lcd_update) { lcd.setCursor(0,line); repaint_action; } \ +// if(activeline==line) \ +// { \ +// if(CLICKED) \ +// { \ +// linechanging=!linechanging; \ +// if(linechanging) {enter_action;} \ +// else {accept_action;} \ +// } \ +// else \ +// if(linechanging) {change_action};}\ +// } +// + + void MainMenu::showControl() { uint8_t line=0; - if((lastlineoffset!=lineoffset)||force_lcd_update) - { - force_lcd_update=true; - clear(); - } + clearIfNecessary(); for(int8_t i=lineoffset;i3) - { - lineoffset++; - encoderpos=3*lcdslow; - if(lineoffset>(ItemC_failsafe+1-LCD_HEIGHT)) - lineoffset=ItemC_failsafe+1-LCD_HEIGHT; - force_lcd_update=true; - } - //encoderpos=encoderpos%LCD_HEIGHT; - lastencoderpos=encoderpos; - activeline=encoderpos/lcdslow; - if(activeline>3) activeline=3; - lcd.setCursor(0,activeline);lcd.print((activeline+lineoffset)?'>':'\003'); - } + updateActiveLines(ItemC_failsafe,encoderpos); } @@ -1175,14 +1065,11 @@ void MainMenu::showSD() #ifdef SDSUPPORT uint8_t line=0; - if(lastlineoffset!=lineoffset) - { - force_lcd_update=true; - } + clearIfNecessary(); static uint8_t nrfiles=0; if(force_lcd_update) { - clear(); + clear(); if(card.cardOK) { nrfiles=card.getnrfilenames(); @@ -1192,7 +1079,6 @@ void MainMenu::showSD() nrfiles=0; lineoffset=0; } - //Serial.print("Nr files:"); Serial.println((int)nrfiles); } for(int8_t i=lineoffset;i3) - { - lineoffset++; - encoderpos=3*lcdslow; - if(lineoffset>(1+nrfiles+1-LCD_HEIGHT)) - lineoffset=1+nrfiles+1-LCD_HEIGHT; - force_lcd_update=true; - - } - lastencoderpos=encoderpos; - activeline=encoderpos; - if(activeline>3) - { - activeline=3; - } - if(activeline<0) - { - activeline=0; - } - if(activeline>1+nrfiles) activeline=1+nrfiles; - if(lineoffset>1+nrfiles) lineoffset=1+nrfiles; - lcd.setCursor(0,activeline);lcd.print((activeline+lineoffset)?'>':'\003'); - - } + updateActiveLines(1+nrfiles,encoderpos); #endif } enum {ItemM_watch, ItemM_prepare, ItemM_control, ItemM_file }; void MainMenu::showMainMenu() { - //if(int(encoderpos/lcdslow)!=int(lastencoderpos/lcdslow)) - // force_lcd_update=true; + #ifndef ULTIPANEL force_lcd_update=false; #endif - //Serial.println((int)activeline); - if(force_lcd_update) - clear(); + + clearIfNecessary(); for(int8_t line=0;line=LCD_HEIGHT) - activeline=LCD_HEIGHT-1; - if((encoderpos!=lastencoderpos)||force_lcd_update) - { - lcd.setCursor(0,activeline);lcd.print(activeline?' ':' '); - if(encoderpos<0) encoderpos=0; - if(encoderpos>3*lcdslow) - encoderpos=3*lcdslow; - activeline=abs(encoderpos/lcdslow)%LCD_HEIGHT; - if(activeline<0) - activeline=0; - if(activeline>=LCD_HEIGHT) - activeline=LCD_HEIGHT-1; - lastencoderpos=encoderpos; - lcd.setCursor(0,activeline);lcd.print(activeline?'>':'\003'); - } + updateActiveLines(3,encoderpos); } void MainMenu::update() @@ -1433,20 +1235,18 @@ void MainMenu::update() if(CARDINSERTED) { card.initsd(); - lcd_status("Card inserted"); + LCD_MESSAGEPGM("Card inserted"); } else { card.release(); - lcd_status("Card removed"); + LCD_MESSAGEPGM("Card removed"); } } #endif if(status!=oldstatus) { - //Serial.println(status); - //clear(); force_lcd_update=true; encoderpos=0; lineoffset=0; From b21d5193f25e3e388ddc3787aba7f0086a1abad7 Mon Sep 17 00:00:00 2001 From: Bernhard Kubicek Date: Sun, 20 Nov 2011 14:43:47 +0100 Subject: [PATCH 3/3] made ultralcd compatible with folders. --- Marlin/cardreader.h | 6 +- Marlin/cardreader.pde | 115 ++++++++---- Marlin/ultralcd.h | 6 +- Marlin/ultralcd.pde | 407 ++++++++++++++++++++++++++---------------- 4 files changed, 339 insertions(+), 195 deletions(-) diff --git a/Marlin/cardreader.h b/Marlin/cardreader.h index 653f59452e..44ebf0e2c1 100644 --- a/Marlin/cardreader.h +++ b/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; diff --git a/Marlin/cardreader.pde b/Marlin/cardreader.pde index bab87834ec..c0dbc58e47 100644 --- a/Marlin/cardreader.pde +++ b/Marlin/cardreader.pde @@ -1,4 +1,5 @@ #include "cardreader.h" +//#include #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 \ No newline at end of file diff --git a/Marlin/ultralcd.h b/Marlin/ultralcd.h index d3496bec98..6222c70c25 100644 --- a/Marlin/ultralcd.h +++ b/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; diff --git a/Marlin/ultralcd.pde b/Marlin/ultralcd.pde index aa30a3dd0e..57f63c1061 100644 --- a/Marlin/ultralcd.pde +++ b/Marlin/ultralcd.pde @@ -114,11 +114,13 @@ void lcd_init() }; byte uplevel[8]={0x04, 0x0e, 0x1f, 0x04, 0x1c, 0x00, 0x00, 0x00};//thanks joris byte refresh[8]={0x00, 0x06, 0x19, 0x18, 0x03, 0x13, 0x0c, 0x00}; //thanks joris + byte folder [8]={0x00, 0x1c, 0x1f, 0x11, 0x11, 0x1f, 0x00, 0x00}; //thanks joris lcd.begin(LCD_WIDTH, LCD_HEIGHT); lcd.createChar(1,Degree); lcd.createChar(2,Thermometer); lcd.createChar(3,uplevel); lcd.createChar(4,refresh); + lcd.createChar(5,folder); LCD_MESSAGEPGM("UltiMarlin ready."); } @@ -224,6 +226,7 @@ void buttons_check() buttons=~newbutton; //invert it, because a pressed switch produces a logical 0 #endif + //manage encoder rotation char enc=0; if(buttons&EN_A) enc|=(1<<0); @@ -311,22 +314,22 @@ void MainMenu::showStatus() oldtargetHotEnd0=ttHotEnd0; } #if defined BED_USES_THERMISTOR || defined BED_USES_AD595 - static int oldtBed=-1; - static int oldtargetBed=-1; - int tBed=intround(degBed()); - if((tBed!=oldtBed)||force_lcd_update) - { - lcd.setCursor(1,0); - lcd.print(ftostr3(tBed)); - olddegHotEnd0=tBed; - } - int targetBed=intround(degTargetBed()); - if((targetBed!=oldtargetBed)||force_lcd_update) - { - lcd.setCursor(5,0); - lcd.print(ftostr3(targetBed)); - oldtargetBed=targetBed; - } + static int oldtBed=-1; + static int oldtargetBed=-1; + int tBed=intround(degBed()); + if((tBed!=oldtBed)||force_lcd_update) + { + lcd.setCursor(1,0); + lcd.print(ftostr3(tBed)); + oldtBed=tBed; + } + int targetBed=intround(degTargetBed()); + if((targetBed!=oldtargetBed)||force_lcd_update) + { + lcd.setCursor(5,0); + lcd.print(ftostr3(targetBed)); + oldtargetBed=targetBed; + } #endif //starttime=2; static uint16_t oldtime=0; @@ -421,6 +424,7 @@ void MainMenu::showStatus() } #endif + force_lcd_update=false; } enum {ItemP_exit, ItemP_home, ItemP_origin, ItemP_preheat, ItemP_extrude, ItemP_disstep}; @@ -466,16 +470,7 @@ void MainMenu::showPrepare() } updateActiveLines(ItemP_disstep,encoderpos); } -enum { - ItemC_exit, ItemC_nozzle, - ItemC_PID_P,ItemC_PID_I,ItemC_PID_D,ItemC_PID_C, - ItemC_fan, - ItemC_acc, ItemC_xyjerk, - ItemC_vmaxx, ItemC_vmaxy, ItemC_vmaxz, ItemC_vmaxe, - ItemC_vtravmin,ItemC_vmin, - ItemC_amaxx, ItemC_amaxy, ItemC_amaxz, ItemC_amaxe, - ItemC_aret,ItemC_esteps, ItemC_store, ItemC_load,ItemC_failsafe -}; + //does not work // #define MENUCHANGEITEM(repaint_action, enter_action, accept_action, change_action) \ @@ -494,19 +489,23 @@ enum { // } // - -void MainMenu::showControl() +enum { + ItemCT_exit, ItemCT_nozzle, ItemCT_fan, + ItemCT_PID_P,ItemCT_PID_I,ItemCT_PID_D,ItemCT_PID_C +}; + +void MainMenu::showControlTemp() { - uint8_t line=0; + uint8_t line=0; clearIfNecessary(); for(int8_t i=lineoffset;i990) encoderpos=990; - lcd.setCursor(13,line);lcd.print(itostr3(encoderpos));lcdprintPGM("00"); + if(encoderpos<1) encoderpos=1; + if(encoderpos>9990/5) encoderpos=9990/5; + lcd.setCursor(13,line);lcd.print(itostr4(encoderpos*5)); } } }break; - case ItemC_xyjerk: //max_xy_jerk + case ItemCT_PID_I: { if(force_lcd_update) { - lcd.setCursor(0,line);lcdprintPGM(" Vxy-jerk: "); - lcd.setCursor(13,line);lcd.print(itostr3(max_xy_jerk)); + lcd.setCursor(0,line);lcdprintPGM(" PID-I: "); + lcd.setCursor(13,line);lcd.print(ftostr51(Ki)); } if((activeline==line) ) @@ -625,11 +625,11 @@ void MainMenu::showControl() linechanging=!linechanging; if(linechanging) { - encoderpos=(int)max_xy_jerk; + encoderpos=(int)(Ki*10); } else { - max_xy_jerk= encoderpos; + Ki= encoderpos/10.; encoderpos=activeline*lcdslow; } @@ -638,18 +638,18 @@ void MainMenu::showControl() } if(linechanging) { - if(encoderpos<1) encoderpos=1; - if(encoderpos>990) encoderpos=990; - lcd.setCursor(13,line);lcd.print(itostr3(encoderpos)); + if(encoderpos<0) encoderpos=0; + if(encoderpos>9990) encoderpos=9990; + lcd.setCursor(13,line);lcd.print(ftostr51(encoderpos/10.)); } } }break; - case ItemC_PID_P: + case ItemCT_PID_D: { if(force_lcd_update) { - lcd.setCursor(0,line);lcdprintPGM(" PID-P: "); - lcd.setCursor(13,line);lcd.print(itostr4(Kp)); + lcd.setCursor(0,line);lcdprintPGM(" PID-D: "); + lcd.setCursor(13,line);lcd.print(itostr4(Kd)); } if((activeline==line) ) @@ -659,11 +659,11 @@ void MainMenu::showControl() linechanging=!linechanging; if(linechanging) { - encoderpos=(int)Kp/5; + encoderpos=(int)Kd/5; } else { - Kp= encoderpos*5; + Kd= encoderpos*5; encoderpos=activeline*lcdslow; } @@ -672,18 +672,19 @@ void MainMenu::showControl() } if(linechanging) { - if(encoderpos<1) encoderpos=1; + if(encoderpos<0) encoderpos=0; if(encoderpos>9990/5) encoderpos=9990/5; lcd.setCursor(13,line);lcd.print(itostr4(encoderpos*5)); } } - }break; - case ItemC_PID_I: + }break; + case ItemCT_PID_C: + #ifdef PID_ADD_EXTRUSION_RATE { if(force_lcd_update) { - lcd.setCursor(0,line);lcdprintPGM(" PID-I: "); - lcd.setCursor(13,line);lcd.print(ftostr51(Ki)); + lcd.setCursor(0,line);lcdprintPGM(" PID-C: "); + lcd.setCursor(13,line);lcd.print(itostr3(Kc)); } if((activeline==line) ) @@ -693,11 +694,11 @@ void MainMenu::showControl() linechanging=!linechanging; if(linechanging) { - encoderpos=(int)(Ki*10); + encoderpos=(int)Kc; } else { - Ki= encoderpos/10.; + Kc= encoderpos; encoderpos=activeline*lcdslow; } @@ -707,17 +708,54 @@ void MainMenu::showControl() if(linechanging) { if(encoderpos<0) encoderpos=0; - if(encoderpos>9990) encoderpos=9990; - lcd.setCursor(13,line);lcd.print(ftostr51(encoderpos/10.)); + if(encoderpos>990) encoderpos=990; + lcd.setCursor(13,line);lcd.print(itostr3(encoderpos)); } } - }break; - case ItemC_PID_D: - { + } + #endif + break; + default: + break; + } + line++; + } + #ifdef PID_ADD_EXTRUSION_RATE + updateActiveLines(ItemCT_PID_C,encoderpos); + #else + updateActiveLines(ItemCT_PID_D,encoderpos); + #endif +} + + +enum { + ItemCM_exit, + ItemCM_acc, ItemCM_xyjerk, + ItemCM_vmaxx, ItemCM_vmaxy, ItemCM_vmaxz, ItemCM_vmaxe, + ItemCM_vtravmin,ItemCM_vmin, + ItemCM_amaxx, ItemCM_amaxy, ItemCM_amaxz, ItemCM_amaxe, + ItemCM_aret,ItemCM_esteps +}; + + + +void MainMenu::showControlMotion() +{ + uint8_t line=0; + clearIfNecessary(); + for(int8_t i=lineoffset;i9990/5) encoderpos=9990/5; - lcd.setCursor(13,line);lcd.print(itostr4(encoderpos*5)); + if(encoderpos<5) encoderpos=5; + if(encoderpos>990) encoderpos=990; + lcd.setCursor(13,line);lcd.print(itostr3(encoderpos));lcdprintPGM("00"); } } }break; - - - - case ItemC_PID_C: + case ItemCM_xyjerk: //max_xy_jerk { if(force_lcd_update) { - lcd.setCursor(0,line);lcdprintPGM(" PID-C: "); - lcd.setCursor(13,line);lcd.print(itostr3(Kc)); + lcd.setCursor(0,line);lcdprintPGM(" Vxy-jerk: "); + lcd.setCursor(13,line);lcd.print(itostr3(max_xy_jerk)); } if((activeline==line) ) @@ -764,11 +798,11 @@ void MainMenu::showControl() linechanging=!linechanging; if(linechanging) { - encoderpos=(int)Kc; + encoderpos=(int)max_xy_jerk; } else { - Kc= encoderpos; + max_xy_jerk= encoderpos; encoderpos=activeline*lcdslow; } @@ -777,25 +811,26 @@ void MainMenu::showControl() } if(linechanging) { - if(encoderpos<0) encoderpos=0; + if(encoderpos<1) encoderpos=1; if(encoderpos>990) encoderpos=990; lcd.setCursor(13,line);lcd.print(itostr3(encoderpos)); } } }break; - case ItemC_vmaxx: - case ItemC_vmaxy: - case ItemC_vmaxz: - case ItemC_vmaxe: + + case ItemCM_vmaxx: + case ItemCM_vmaxy: + case ItemCM_vmaxz: + case ItemCM_vmaxe: { if(force_lcd_update) { lcd.setCursor(0,line);lcdprintPGM(" Vmax "); - if(i==ItemC_vmaxx)lcdprintPGM("x:"); - if(i==ItemC_vmaxy)lcdprintPGM("y:"); - if(i==ItemC_vmaxz)lcdprintPGM("z:"); - if(i==ItemC_vmaxe)lcdprintPGM("e:"); - lcd.setCursor(13,line);lcd.print(itostr3(max_feedrate[i-ItemC_vmaxx])); + if(i==ItemCM_vmaxx)lcdprintPGM("x:"); + if(i==ItemCM_vmaxy)lcdprintPGM("y:"); + if(i==ItemCM_vmaxz)lcdprintPGM("z:"); + if(i==ItemCM_vmaxe)lcdprintPGM("e:"); + lcd.setCursor(13,line);lcd.print(itostr3(max_feedrate[i-ItemCM_vmaxx])); } if((activeline==line) ) @@ -805,11 +840,11 @@ void MainMenu::showControl() linechanging=!linechanging; if(linechanging) { - encoderpos=(int)max_feedrate[i-ItemC_vmaxx]; + encoderpos=(int)max_feedrate[i-ItemCM_vmaxx]; } else { - max_feedrate[i-ItemC_vmaxx]= encoderpos; + max_feedrate[i-ItemCM_vmaxx]= encoderpos; encoderpos=activeline*lcdslow; } @@ -825,7 +860,7 @@ void MainMenu::showControl() } }break; - case ItemC_vmin: + case ItemCM_vmin: { if(force_lcd_update) { @@ -859,7 +894,7 @@ void MainMenu::showControl() } } }break; - case ItemC_vtravmin: + case ItemCM_vtravmin: { if(force_lcd_update) { @@ -894,19 +929,19 @@ void MainMenu::showControl() } }break; - case ItemC_amaxx: - case ItemC_amaxy: - case ItemC_amaxz: - case ItemC_amaxe: + case ItemCM_amaxx: + case ItemCM_amaxy: + case ItemCM_amaxz: + case ItemCM_amaxe: { if(force_lcd_update) { lcd.setCursor(0,line);lcdprintPGM(" Amax "); - if(i==ItemC_amaxx)lcdprintPGM("x:"); - if(i==ItemC_amaxy)lcdprintPGM("y:"); - if(i==ItemC_amaxz)lcdprintPGM("z:"); - if(i==ItemC_amaxe)lcdprintPGM("e:"); - lcd.setCursor(13,line);lcd.print(itostr3(max_acceleration_units_per_sq_second[i-ItemC_amaxx]/100));lcdprintPGM("00"); + if(i==ItemCM_amaxx)lcdprintPGM("x:"); + if(i==ItemCM_amaxy)lcdprintPGM("y:"); + if(i==ItemCM_amaxz)lcdprintPGM("z:"); + if(i==ItemCM_amaxe)lcdprintPGM("e:"); + lcd.setCursor(13,line);lcd.print(itostr3(max_acceleration_units_per_sq_second[i-ItemCM_amaxx]/100));lcdprintPGM("00"); } if((activeline==line) ) @@ -916,11 +951,11 @@ void MainMenu::showControl() linechanging=!linechanging; if(linechanging) { - encoderpos=(int)max_acceleration_units_per_sq_second[i-ItemC_amaxx]/100; + encoderpos=(int)max_acceleration_units_per_sq_second[i-ItemCM_amaxx]/100; } else { - max_acceleration_units_per_sq_second[i-ItemC_amaxx]= encoderpos*100; + max_acceleration_units_per_sq_second[i-ItemCM_amaxx]= encoderpos*100; encoderpos=activeline*lcdslow; } BLOCK; @@ -934,7 +969,7 @@ void MainMenu::showControl() } } }break; - case ItemC_aret://float retract_acceleration = 7000; + case ItemCM_aret://float retract_acceleration = 7000; { if(force_lcd_update) { @@ -968,7 +1003,7 @@ void MainMenu::showControl() } } }break; - case ItemC_esteps://axis_steps_per_unit[i] = code_value(); + case ItemCM_esteps://axis_steps_per_unit[i] = code_value(); { if(force_lcd_update) { @@ -1005,6 +1040,37 @@ void MainMenu::showControl() } } }break; + default: + break; + } + line++; + } + updateActiveLines(ItemCM_esteps,encoderpos); +} + + +enum { + ItemC_exit,ItemC_temp,ItemC_move, + ItemC_store, ItemC_load,ItemC_failsafe +}; + +void MainMenu::showControl() +{ + uint8_t line=0; + clearIfNecessary(); + for(int8_t i=lineoffset;i