Merge remote-tracking branch 'upstream/experimental'
Conflicts: Sprinter/pins.h
This commit is contained in:
commit
09d5247ba2
5 changed files with 229 additions and 29 deletions
2
README
2
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 Sanguinololu and Bath Prusa and should be skipped or modified accordingly for other hardware such as the Arduino Mega 2560
|
||||
|
||||
Software installation
|
||||
----------------------
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -50,9 +51,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
|
||||
|
|
@ -99,6 +104,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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -162,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;
|
||||
|
|
@ -200,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)
|
||||
{
|
||||
Serial.println("invalid command");
|
||||
return;
|
||||
}
|
||||
|
||||
*pstr = '\0';
|
||||
|
||||
//check mode (currently only RAW is supported
|
||||
if(strcmp(strchr_pointer+4, "RAW") != 0)
|
||||
{
|
||||
Serial.println("Invalid transfer codec");
|
||||
return;
|
||||
}else{
|
||||
Serial.print("Selected codec: ");
|
||||
Serial.println(strchr_pointer+4);
|
||||
}
|
||||
|
||||
if (!file.open(&root, pstr+1, O_CREAT | O_APPEND | O_WRITE | O_TRUNC))
|
||||
{
|
||||
Serial.print("open failed, File: ");
|
||||
Serial.print(pstr+1);
|
||||
Serial.print(".");
|
||||
}else{
|
||||
Serial.print("Writing to file: ");
|
||||
Serial.println(pstr+1);
|
||||
}
|
||||
|
||||
Serial.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(!Serial.available())
|
||||
{
|
||||
}
|
||||
if(Serial.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
|
||||
Serial.read();
|
||||
for(int i=0;i<SD_FAST_XFER_CHUNK_SIZE+1;i++)
|
||||
{
|
||||
while(!Serial.available())
|
||||
{
|
||||
}
|
||||
lastxferchar = Serial.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);
|
||||
Serial.println("ok");
|
||||
}else{
|
||||
Serial.print("Wrote ");
|
||||
Serial.print(xferbytes);
|
||||
Serial.println(" bytes.");
|
||||
done = true;
|
||||
}
|
||||
}
|
||||
|
||||
file.sync();
|
||||
file.close();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
|
@ -745,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
|
||||
Serial.print("RAW:");
|
||||
Serial.println(SD_FAST_XFER_CHUNK_SIZE);
|
||||
break;
|
||||
#endif
|
||||
case 42: //M42 -Change pin status via gcode
|
||||
if (code_seen('S'))
|
||||
|
|
@ -1081,11 +1192,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]<min_time_before_dir_change){ //if so, check if we've sat @ the current position long enough for this axis
|
||||
if((min_time_before_dir_change-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);
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
@ -737,7 +736,6 @@
|
|||
|
||||
#endif
|
||||
|
||||
|
||||
/****************************************************************************************
|
||||
* Teensylu 0.7 pin assingments (ATMEGA90USB)
|
||||
* Requires the Teensyduino software with Teensy2.0++ selected in arduino IDE!
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue