From 318c7b4f64ec0a1734106a5858d2345905b48929 Mon Sep 17 00:00:00 2001 From: Greg Dahlman Date: Thu, 3 Nov 2011 23:32:57 -0700 Subject: Edited pins.h to add missing #endif --- Sprinter/pins.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Sprinter/pins.h b/Sprinter/pins.h index cc6265c..ed0420f 100644 --- a/Sprinter/pins.h +++ b/Sprinter/pins.h @@ -734,6 +734,9 @@ #define TEMP_1_PIN 38 //Bed #define FAN_PIN -1 #define PS_ON_PIN 21 + +#endif + /**************************************************************************************** * Teensylu 0.7 pin assingments (ATMEGA90USB) * Requires the Teensyduino software with Teensy2.0++ selected in arduino IDE! -- cgit v1.2.1 From f5c05d94393b79d52b9ada67fe4bdffa3c39da52 Mon Sep 17 00:00:00 2001 From: Chris Dieringer Date: Sun, 6 Nov 2011 07:57:57 -0800 Subject: osc reduction --- Sprinter/Configuration.h | 6 ++++++ Sprinter/Sprinter.pde | 44 ++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 48 insertions(+), 2 deletions(-) diff --git a/Sprinter/Configuration.h b/Sprinter/Configuration.h index df52a08..950387a 100644 --- a/Sprinter/Configuration.h +++ b/Sprinter/Configuration.h @@ -99,6 +99,12 @@ bool axis_relative_modes[] = {false, false, false, false}; // If you enable this, make sure STEP_DELAY_MICROS is disabled. (except for Gen6: both need to be enabled.) //#define STEP_DELAY_RATIO 0.25 +///Oscillation reduction. Forces x,y,or z axis to be stationary for ## ms before allowing axis to switch direcitons. Alternative method to prevent skipping steps. Uncomment the line below to activate. +//#define RAPID_OSCILLATION_REDUCTION +#ifdef RAPID_OSCILLATION_REDUCTION +long min_time_before_dir_change = 30; //milliseconds +#endif + // Comment this to disable ramp acceleration #define RAMP_ACCELERATION diff --git a/Sprinter/Sprinter.pde b/Sprinter/Sprinter.pde index 657efed..bc8a2ac 100644 --- a/Sprinter/Sprinter.pde +++ b/Sprinter/Sprinter.pde @@ -91,7 +91,12 @@ float axis_diff[NUM_AXIS] = {0, 0, 0, 0}; #ifdef STEP_DELAY_RATIO long long_step_delay_ratio = STEP_DELAY_RATIO * 100; #endif - +///oscillation reduction +ifdef RAPID_OSCILLATION_REDUCTION + float cumm_wait_time_in_dir[NUM_AXIS]={0.0,0.0,0.0,0.0}; + bool prev_move_direction[NUM_AXIS]={1,1,1,1}; + float osc_wait_remainder = 0.0; +#endif // comm variables #define MAX_CMD_SIZE 96 @@ -1081,11 +1086,46 @@ void prepare_move() time_for_move = time_for_move / max_feedrate[i] * (abs(axis_diff[i]) / (time_for_move / 60000000.0)); } } + +#ifdef RAPID_OSCILLATION_REDUCTION //VERBOSE commenting for peer review. tested on multiple prints--works! + for(int i=0; i < NUM_AXIS-1; i++) { //do for each axis, except for extruder (refer to the -1 value) + if(prev_move_direction[i] != move_direction[i]){ //check if we've changed direcitons + osc_wait_remainder=min_time_before_dir_change; //if we changed directions, then shit the bed! We better make sure to wait & chill out time before jerkin' over in the opposite direction! + if(cumm_wait_time_in_dir[i]osc_wait_remainder){ //if not, dont overwrite the remaining wait time if we already have to wait LONGER for a different axis + osc_wait_remainder=min_time_before_dir_change-cumm_wait_time_in_dir[i]; + } + } + cumm_wait_time_in_dir[i] = 0.0; //we've changed directions! now that we've either set a wait period, or we had already waited long enough after a direction change, let's reset our wait variable for this axis + } + else{ //we haven't changed directions! so, lets make sure to increase our wait time for the time we have not been moving back on the same axis + if(cumm_wait_time_in_dir[i]==0.0){ + cumm_wait_time_in_dir[i] = 0.001; //if the cumm wait variable = 0.0, that means we've just completed our first move after a dir change. we really haven't waited at all. so, let's increment the wait value insignifcant value so that we may proceed, but not hit this line again. + } + else{ + //Serial.print("It is will take [ESTIMATED] this many seconds to perform this move:"); Serial.println(time_for_move/1000000); + cumm_wait_time_in_dir[i] = cumm_wait_time_in_dir[i] + time_for_move/1000; //increment the time we've waited in this axis + } + } + } + + //update prev_moves for next move. again, excluded extruder + for(int i=0; i < NUM_AXIS-1; i++) { + prev_move_direction[i]=move_direction[i]; + } + + //now WAIT if you are oscillating back & forth too fast in any given axis + if(osc_wait_remainder>0.0){ + delay(osc_wait_remainder); + osc_wait_remainder=0.0; + } +#endif + //Calculate the full speed stepper interval for each axis for(int i=0; i < NUM_AXIS; i++) { if(move_steps_to_take[i]) axis_interval[i] = time_for_move / move_steps_to_take[i] * 100; } - + #ifdef DEBUG_PREPARE_MOVE log_float("_PREPARE_MOVE - Move distance on the XY plane", xy_d); log_float("_PREPARE_MOVE - Move distance on the XYZ space", d); -- cgit v1.2.1 From 074acbe5477d7069ebf93fcef513b87b378de17b Mon Sep 17 00:00:00 2001 From: Kliment Yanev Date: Thu, 10 Nov 2011 10:13:12 +0100 Subject: Improve 200k thermistor table to better match reality --- Sprinter/thermistortables.h | 89 +++++++++++++++++++++++++++++++++------------ 1 file changed, 66 insertions(+), 23 deletions(-) diff --git a/Sprinter/thermistortables.h b/Sprinter/thermistortables.h index e69f367..ef1e78b 100644 --- a/Sprinter/thermistortables.h +++ b/Sprinter/thermistortables.h @@ -69,30 +69,73 @@ const short temptable_1[NUMTEMPS_1][2] = { { 1008 , 0 } //safety }; #endif -#if (THERMISTORHEATER == 2) || (THERMISTORBED == 2) //200k bed thermistor -#define NUMTEMPS_2 21 +#if (THERMISTORHEATER == 2) || (THERMISTORBED == 2) //200k bed thermistor verified by arcol +#define NUMTEMPS_2 64 const short temptable_2[NUMTEMPS_2][2] = { - {1, 848}, - {54, 275}, - {107, 228}, - {160, 202}, - {213, 185}, - {266, 171}, - {319, 160}, - {372, 150}, - {425, 141}, - {478, 133}, - {531, 125}, - {584, 118}, - {637, 110}, - {690, 103}, - {743, 95}, - {796, 86}, - {849, 77}, - {902, 65}, - {955, 49}, - {1008, 17}, - {1020, 0} //safety + { 16, 315}, + { 17, 310}, + { 18, 305}, + { 19, 300}, + { 20, 295}, + { 21, 290}, + { 22, 285}, + { 23, 280}, + { 24, 275}, + { 25, 270}, + { 29, 265}, + { 30, 260}, + { 35, 255}, + { 40, 250}, + { 45, 245}, + { 50, 240}, + { 55, 235}, + { 60, 230}, + { 65, 225}, + { 70, 220}, + { 90, 215}, + { 95, 210}, + { 103, 205}, + { 105, 200}, + { 115, 195}, + { 130, 190}, + { 150, 185}, + { 167, 180}, + { 190, 175}, + { 200, 170}, + { 230, 165}, + { 250, 160}, + { 270, 155}, + { 300, 150}, + { 330, 145}, + { 360, 140}, + { 380, 135}, + { 408, 130}, + { 450, 125}, + { 500, 120}, + { 530, 115}, + { 550, 110}, + { 570, 105}, + { 595, 100}, + { 615, 95}, + { 640, 90}, + { 665, 85}, + { 700, 80}, + { 740, 75}, + { 780, 70}, + { 810, 65}, + { 840, 60}, + { 880, 55}, + { 920, 50}, + { 960, 45}, + { 980, 40}, + { 990, 35}, + {1000, 30}, + {1005, 25}, + {1006, 20}, + {1009, 15}, + {1010, 10}, + {1020, 5}, + {1023, 0} //safety }; #endif -- cgit v1.2.1 From 98b8a45868ef3b500352bafd4cb0b1ac38d0674d Mon Sep 17 00:00:00 2001 From: sparr Date: Thu, 10 Nov 2011 04:25:13 -0500 Subject: note Sanguino-specific steps --- README | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README b/README index 34fc7a6..21a1272 100644 --- a/README +++ b/README @@ -32,6 +32,8 @@ From a fresh Ubuntu install how to update the firmware of your Prusa Mendel ? This version uses the http://reprap.org/wiki/Sanguinololu. Some details may not fit your hardware, be sure to check what you are doing) +Steps 3,10,11 are hardware-specific to the Sanuiglolu and Bath Prusa and should be skipped or modified accordingly for other hardware such as the Arduino Mega 2560 + Software installation ---------------------- -- cgit v1.2.1 From f0e3ab1e22d80b4edf32862a31eb7f27f60eafa4 Mon Sep 17 00:00:00 2001 From: sparr Date: Thu, 10 Nov 2011 04:31:44 -0500 Subject: spelling correction --- README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README b/README index 21a1272..2bd4c29 100644 --- a/README +++ b/README @@ -32,7 +32,7 @@ From a fresh Ubuntu install how to update the firmware of your Prusa Mendel ? This version uses the http://reprap.org/wiki/Sanguinololu. Some details may not fit your hardware, be sure to check what you are doing) -Steps 3,10,11 are hardware-specific to the Sanuiglolu and Bath Prusa and should be skipped or modified accordingly for other hardware such as the Arduino Mega 2560 +Steps 3,10,11 are hardware-specific to the Sanguinololu and Bath Prusa and should be skipped or modified accordingly for other hardware such as the Arduino Mega 2560 Software installation ---------------------- -- cgit v1.2.1 From d196068a8ca3d47ec9f92525644b12fb70aeb29b Mon Sep 17 00:00:00 2001 From: Philip Kin Date: Wed, 16 Nov 2011 09:16:14 -0600 Subject: M30/M31 fast sd block transfer --- Sprinter/Configuration.h | 6 ++- Sprinter/Sprinter.pde | 106 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 111 insertions(+), 1 deletion(-) diff --git a/Sprinter/Configuration.h b/Sprinter/Configuration.h index 950387a..be42e0b 100644 --- a/Sprinter/Configuration.h +++ b/Sprinter/Configuration.h @@ -50,9 +50,13 @@ const bool Z_ENDSTOP_INVERT = false; // Comment out (using // at the start of the line) to disable SD support: #define SDSUPPORT - //// ADVANCED SETTINGS - to tweak parameters +#ifdef SDSUPPORT + //Fast transfer chunk size (> 1024 is unstable, change at your own risk). + #define SD_FAST_XFER_CHUNK_SIZE 1024 +#endif + #include "thermistortables.h" // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 diff --git a/Sprinter/Sprinter.pde b/Sprinter/Sprinter.pde index bc8a2ac..b189744 100644 --- a/Sprinter/Sprinter.pde +++ b/Sprinter/Sprinter.pde @@ -167,6 +167,9 @@ unsigned long stepper_inactive_time = 0; bool sdactive = false; bool savetosd = false; int16_t n; + char fastxferbuffer[SD_FAST_XFER_CHUNK_SIZE + 1]; + int lastxferchar; + long xferbytes; void initsd(){ sdactive = false; @@ -205,6 +208,102 @@ unsigned long stepper_inactive_time = 0; Serial.println("error writing to file"); } } + + void fast_xfer() + { + char *pstr; + boolean done = false; + + //force heater pins low + if(HEATER_0_PIN > -1) WRITE(HEATER_0_PIN,LOW); + if(HEATER_1_PIN > -1) WRITE(HEATER_1_PIN,LOW); + + lastxferchar = 1; + xferbytes = 0; + + pstr = strstr(strchr_pointer+4, " "); + + if(pstr == NULL) + { + SerialMgr.cur()->println("invalid command"); + return; + } + + *pstr = '\0'; + + //check mode (currently only RAW is supported + if(strcmp(strchr_pointer+4, "RAW") != 0) + { + SerialMgr.cur()->println("Invalid transfer codec"); + return; + }else{ + SerialMgr.cur()->print("Selected codec: "); + SerialMgr.cur()->println(strchr_pointer+4); + } + + if (!file.open(&root, pstr+1, O_CREAT | O_APPEND | O_WRITE | O_TRUNC)) + { + SerialMgr.cur()->print("open failed, File: "); + SerialMgr.cur()->print(pstr+1); + SerialMgr.cur()->print("."); + }else{ + SerialMgr.cur()->print("Writing to file: "); + SerialMgr.cur()->println(pstr+1); + } + + SerialMgr.cur()->println("ok"); + + //RAW transfer codec + //Host sends \0 then up to SD_FAST_XFER_CHUNK_SIZE then \0 + //when host is done, it sends \0\0. + //if a non \0 character is recieved at the beginning, host has failed somehow, kill the transfer. + + //read SD_FAST_XFER_CHUNK_SIZE bytes (or until \0 is recieved) + while(!done) + { + while(!SerialMgr.cur()->available()) + { + } + if(SerialMgr.cur()->peek() != 0) + { + //host has failed, this isn't a RAW chunk, it's an actual command + file.sync(); + file.close(); + return; + } + //clear the initial 0 + SerialMgr.cur()->read(); + for(int i=0;iavailable()) + { + } + lastxferchar = SerialMgr.cur()->read(); + //buffer the data... + fastxferbuffer[i] = lastxferchar; + + xferbytes++; + + if(lastxferchar == 0) + break; + } + + if(fastxferbuffer[0] != 0) + { + fastxferbuffer[SD_FAST_XFER_CHUNK_SIZE] = 0; + file.write(fastxferbuffer); + SerialMgr.cur()->println("ok"); + }else{ + SerialMgr.cur()->print("Wrote "); + SerialMgr.cur()->print(xferbytes); + SerialMgr.cur()->println(" bytes."); + done = true; + } + } + + file.sync(); + file.close(); + } #endif @@ -750,6 +849,13 @@ inline void process_commands() //processed in write to file routine above //savetosd = false; break; + case 30: //M30 - fast SD transfer + fast_xfer(); + break; + case 31: //M31 - high speed xfer capabilities + SerialMgr.cur()->print("RAW:"); + SerialMgr.cur()->println(SD_FAST_XFER_CHUNK_SIZE); + break; #endif case 42: //M42 -Change pin status via gcode if (code_seen('S')) -- cgit v1.2.1 From fa1a0e7def0c3c0049953639cc17b8a21e8da163 Mon Sep 17 00:00:00 2001 From: Philip Kin Date: Wed, 16 Nov 2011 09:17:33 -0600 Subject: M30/M31 fast sd block transfer --- Sprinter/Sprinter.pde | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/Sprinter/Sprinter.pde b/Sprinter/Sprinter.pde index b189744..1322b30 100644 --- a/Sprinter/Sprinter.pde +++ b/Sprinter/Sprinter.pde @@ -225,7 +225,7 @@ unsigned long stepper_inactive_time = 0; if(pstr == NULL) { - SerialMgr.cur()->println("invalid command"); + Serial.println("invalid command"); return; } @@ -234,24 +234,24 @@ unsigned long stepper_inactive_time = 0; //check mode (currently only RAW is supported if(strcmp(strchr_pointer+4, "RAW") != 0) { - SerialMgr.cur()->println("Invalid transfer codec"); + Serial.println("Invalid transfer codec"); return; }else{ - SerialMgr.cur()->print("Selected codec: "); - SerialMgr.cur()->println(strchr_pointer+4); + Serial.print("Selected codec: "); + Serial.println(strchr_pointer+4); } if (!file.open(&root, pstr+1, O_CREAT | O_APPEND | O_WRITE | O_TRUNC)) { - SerialMgr.cur()->print("open failed, File: "); - SerialMgr.cur()->print(pstr+1); - SerialMgr.cur()->print("."); + Serial.print("open failed, File: "); + Serial.print(pstr+1); + Serial.print("."); }else{ - SerialMgr.cur()->print("Writing to file: "); - SerialMgr.cur()->println(pstr+1); + Serial.print("Writing to file: "); + Serial.println(pstr+1); } - SerialMgr.cur()->println("ok"); + Serial.println("ok"); //RAW transfer codec //Host sends \0 then up to SD_FAST_XFER_CHUNK_SIZE then \0 @@ -261,10 +261,10 @@ unsigned long stepper_inactive_time = 0; //read SD_FAST_XFER_CHUNK_SIZE bytes (or until \0 is recieved) while(!done) { - while(!SerialMgr.cur()->available()) + while(!Serial.available()) { } - if(SerialMgr.cur()->peek() != 0) + if(Serial.peek() != 0) { //host has failed, this isn't a RAW chunk, it's an actual command file.sync(); @@ -272,13 +272,13 @@ unsigned long stepper_inactive_time = 0; return; } //clear the initial 0 - SerialMgr.cur()->read(); + Serial.read(); for(int i=0;iavailable()) + while(!Serial.available()) { } - lastxferchar = SerialMgr.cur()->read(); + lastxferchar = Serial.read(); //buffer the data... fastxferbuffer[i] = lastxferchar; @@ -292,11 +292,11 @@ unsigned long stepper_inactive_time = 0; { fastxferbuffer[SD_FAST_XFER_CHUNK_SIZE] = 0; file.write(fastxferbuffer); - SerialMgr.cur()->println("ok"); + Serial.println("ok"); }else{ - SerialMgr.cur()->print("Wrote "); - SerialMgr.cur()->print(xferbytes); - SerialMgr.cur()->println(" bytes."); + Serial.print("Wrote "); + Serial.print(xferbytes); + Serial.println(" bytes."); done = true; } } @@ -853,8 +853,8 @@ inline void process_commands() fast_xfer(); break; case 31: //M31 - high speed xfer capabilities - SerialMgr.cur()->print("RAW:"); - SerialMgr.cur()->println(SD_FAST_XFER_CHUNK_SIZE); + Serial.print("RAW:"); + Serial.println(SD_FAST_XFER_CHUNK_SIZE); break; #endif case 42: //M42 -Change pin status via gcode -- cgit v1.2.1 From 3bbfe733e7bad3577e0a7bcdcf22155a2808ceb8 Mon Sep 17 00:00:00 2001 From: Markus Hitter Date: Mon, 28 Nov 2011 16:02:58 +0100 Subject: pins.h: allow an ATmega644 (without P). --- Sprinter/pins.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sprinter/pins.h b/Sprinter/pins.h index fbe6a6e..65ef26a 100644 --- a/Sprinter/pins.h +++ b/Sprinter/pins.h @@ -630,7 +630,7 @@ #endif #if MOTHERBOARD == 6 #define KNOWN_BOARD 1 -#if !defined(__AVR_ATmega644P__) && !defined(__AVR_ATmega1284P__) +#if !defined(__AVR_ATmega644__) && !defined(__AVR_ATmega644P__) && !defined(__AVR_ATmega1284P__) #error Oops! Make sure you have 'Sanguino' selected from the 'Tools -> Boards' menu. #endif -- cgit v1.2.1 From 67199da50919088a67d0218103be6244f8cbb9d7 Mon Sep 17 00:00:00 2001 From: Kliment Yanev Date: Mon, 28 Nov 2011 16:10:48 +0100 Subject: Revert "Merge pull request #121 from Traumflug/master" This reverts commit 11d3281a09e2a2f0ae7c9695f79d2d903c22716b, reversing changes made to f8c17d3b4655ba9b694c407ff174135badb914a5. --- Sprinter/pins.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sprinter/pins.h b/Sprinter/pins.h index 65ef26a..fbe6a6e 100644 --- a/Sprinter/pins.h +++ b/Sprinter/pins.h @@ -630,7 +630,7 @@ #endif #if MOTHERBOARD == 6 #define KNOWN_BOARD 1 -#if !defined(__AVR_ATmega644__) && !defined(__AVR_ATmega644P__) && !defined(__AVR_ATmega1284P__) +#if !defined(__AVR_ATmega644P__) && !defined(__AVR_ATmega1284P__) #error Oops! Make sure you have 'Sanguino' selected from the 'Tools -> Boards' menu. #endif -- cgit v1.2.1 From b331d4810168001ef18d7ab034dfd03e2b03cf00 Mon Sep 17 00:00:00 2001 From: Kliment Yanev Date: Mon, 28 Nov 2011 16:23:52 +0100 Subject: Add gen7 to list of boards in configuration Allow ATmega644 (non-P version) for Gen7 --- Sprinter/Configuration.h | 1 + Sprinter/pins.h | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Sprinter/Configuration.h b/Sprinter/Configuration.h index be42e0b..2a57812 100644 --- a/Sprinter/Configuration.h +++ b/Sprinter/Configuration.h @@ -9,6 +9,7 @@ // Gen6 = 5, // Sanguinololu up to 1.1 = 6 // Sanguinololu 1.2 and above = 62 +// Gen 7 = 7 // Teensylu (at90usb) = 8 // Gen 3 Plus = 21 // gen 3 Monolithic Electronics = 22 diff --git a/Sprinter/pins.h b/Sprinter/pins.h index ed0420f..01f29ed 100644 --- a/Sprinter/pins.h +++ b/Sprinter/pins.h @@ -143,7 +143,6 @@ #endif - /**************************************************************************************** * RepRap Motherboard ****---NOOOOOO RS485/EXTRUDER CONTROLLER!!!!!!!!!!!!!!!!!---******* * @@ -694,7 +693,7 @@ #if MOTHERBOARD == 7 #define KNOWN_BOARD 1 -#if !defined(__AVR_ATmega644P__) && !defined(__AVR_ATmega1284P__) +#if !defined(__AVR_ATmega644P__) && !defined(__AVR_ATmega1284P__) && !defined(__AVR_ATmega644__) #error Oops! Make sure you have 'Sanguino' selected from the 'Tools -> Boards' menu. #endif -- cgit v1.2.1