Commit 3b222416 authored by MagoKimbra's avatar MagoKimbra

Update

parent 8fbdfab5
......@@ -216,8 +216,11 @@
// If you want the M105 heater power reported in watts, define the BED_WATTS, and (shared for all hotend) HOTEND_WATTS
//#define HOTEND_WATTS (12.0*12.0/6.7) // P=I^2/R
//#define BED_WATTS (12.0*12.0/1.1) // P=I^2/R
//===========================================================================
//============================= PID Settings ================================
//===========================================================================
// PID Tuning Guide here: http://reprap.org/wiki/PID_Tuning
//=============================== PID settings ==============================
// Comment the following line to disable PID and enable bang-bang.
#define PIDTEMP
#define BANG_MAX 255 // limits current to nozzle while in bang-bang mode; 255=full current
......
......@@ -2749,19 +2749,34 @@ inline void gcode_G28(boolean home_x=false, boolean home_y=false) {
int probePointCounter = 0;
bool zig = true;
for (int yProbe = front_probe_bed_position; yProbe <= back_probe_bed_position; yProbe += yGridSpacing) {
int xProbe, xInc;
for (int yCount=0; yCount < auto_bed_leveling_grid_points; yCount++)
{
double yProbe = front_probe_bed_position + yGridSpacing * yCount;
int xStart, xStop, xInc;
if (zig)
xProbe = left_probe_bed_position, xInc = xGridSpacing;
{
xStart = 0;
xStop = auto_bed_leveling_grid_points;
xInc = 1;
zig = false;
}
else
xProbe = right_probe_bed_position, xInc = -xGridSpacing;
{
xStart = auto_bed_leveling_grid_points - 1;
xStop = -1;
xInc = -1;
zig = true;
}
// If topo_flag is set then don't zig-zag. Just scan in one direction.
// This gets the probe points in more readable order.
if (!topo_flag) zig = !zig;
if (topo_flag) zig = !zig;
for (int xCount=xStart; xCount != xStop; xCount += xInc)
{
double xProbe = left_probe_bed_position + xGridSpacing * xCount;
for (int xCount = 0; xCount < auto_bed_leveling_grid_points; xCount++) {
// raise extruder
float measured_z,
z_before = probePointCounter == 0 ? Z_RAISE_BEFORE_PROBING : current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS;
......@@ -2789,10 +2804,7 @@ inline void gcode_G28(boolean home_x=false, boolean home_y=false) {
eqnAMatrix[probePointCounter + 2 * abl2] = 1;
probePointCounter++;
xProbe += xInc;
} //xProbe
} //yProbe
clean_up_after_endstop_move();
......@@ -2877,15 +2889,16 @@ inline void gcode_G28(boolean home_x=false, boolean home_y=false) {
z_at_pt_3 = probe_pt(ABL_PROBE_PT_3_X, ABL_PROBE_PT_3_Y, current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS, ProbeRetract, verbose_level);
}
else {
z_at_pt_1 = probe_pt(ABL_PROBE_PT_1_X, ABL_PROBE_PT_1_Y, Z_RAISE_BEFORE_PROBING, verbose_level);
z_at_pt_2 = probe_pt(ABL_PROBE_PT_2_X, ABL_PROBE_PT_2_Y, current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS, verbose_level);
z_at_pt_3 = probe_pt(ABL_PROBE_PT_3_X, ABL_PROBE_PT_3_Y, current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS, verbose_level);
z_at_pt_1 = probe_pt(ABL_PROBE_PT_1_X, ABL_PROBE_PT_1_Y, Z_RAISE_BEFORE_PROBING, verbose_level=verbose_level);
z_at_pt_2 = probe_pt(ABL_PROBE_PT_2_X, ABL_PROBE_PT_2_Y, current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS, verbose_level=verbose_level);
z_at_pt_3 = probe_pt(ABL_PROBE_PT_3_X, ABL_PROBE_PT_3_Y, current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS, verbose_level=verbose_level);
}
clean_up_after_endstop_move();
set_bed_level_equation_3pts(z_at_pt_1, z_at_pt_2, z_at_pt_3);
#endif // !AUTO_BED_LEVELING_GRID
do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], Z_RAISE_AFTER_PROBING);
st_synchronize();
if (verbose_level > 0)
......@@ -4281,7 +4294,8 @@ void process_commands()
break;
case 23: //M23 - Select file
{
starpos = (strchr(strchr_pointer + 4,'*'));
char* codepos = strchr_pointer + 4;
char* starpos = strchr(codepos, '*');
if(starpos!=NULL) *(starpos)='\0';
card.openFile(strchr_pointer + 4,true);
}
......@@ -4312,14 +4326,15 @@ void process_commands()
break;
case 28: //M28 - Start SD write
{
starpos = (strchr(strchr_pointer + 4,'*'));
char* codepos = strchr_pointer + 4;
char* starpos = strchr(codepos, '*');
if(starpos != NULL)
{
char* npos = strchr(cmdbuffer[bufindr], 'N');
strchr_pointer = strchr(npos,' ') + 1;
*(starpos) = '\0';
}
card.openFile(strchr_pointer+4,false);
card.openFile(codepos, false);
}
break;
case 29: //M29 - Stop SD write
......
......@@ -197,7 +197,7 @@ static void lcd_implementation_status_screen() {
u8g.drawBox(55, 50, (unsigned int)(71.f * card.percentDone() / 100.f), 2);
}
u8g.setPrintPos(80,47);
u8g.setPrintPos(80,48);
if (starttime != 0) {
uint16_t time = (millis() - starttime) / 60000;
u8g.print(itostr2(time/60));
......@@ -231,26 +231,27 @@ static void lcd_implementation_status_screen() {
}
// X, Y, Z-Coordinates
#define XYZ_BASELINE 38
u8g.setFont(FONT_STATUSMENU);
u8g.drawBox(0,29,128,10);
u8g.drawBox(0,30,128,9);
u8g.setColorIndex(0); // white on black
u8g.setPrintPos(2,37);
u8g.setPrintPos(2,XYZ_BASELINE);
u8g.print('X');
u8g.drawPixel(8,33);
u8g.drawPixel(8,35);
u8g.setPrintPos(10,37);
u8g.drawPixel(8,XYZ_BASELINE - 5);
u8g.drawPixel(8,XYZ_BASELINE - 3);
u8g.setPrintPos(10,XYZ_BASELINE);
u8g.print(ftostr31ns(current_position[X_AXIS]));
u8g.setPrintPos(43,37);
lcd_printPGM(PSTR("Y"));
u8g.drawPixel(49,33);
u8g.drawPixel(49,35);
u8g.setPrintPos(51,37);
u8g.setPrintPos(43,XYZ_BASELINE);
u8g.print('Y');
u8g.drawPixel(49,XYZ_BASELINE - 5);
u8g.drawPixel(49,XYZ_BASELINE - 3);
u8g.setPrintPos(51,XYZ_BASELINE);
u8g.print(ftostr31ns(current_position[Y_AXIS]));
u8g.setPrintPos(83,37);
u8g.setPrintPos(83,XYZ_BASELINE);
u8g.print('Z');
u8g.drawPixel(89,33);
u8g.drawPixel(89,35);
u8g.setPrintPos(91,37);
u8g.drawPixel(89,XYZ_BASELINE - 5);
u8g.drawPixel(89,XYZ_BASELINE - 3);
u8g.setPrintPos(91,XYZ_BASELINE);
u8g.print(ftostr31(current_position[Z_AXIS]));
u8g.setColorIndex(1); // black on white
......@@ -259,13 +260,13 @@ static void lcd_implementation_status_screen() {
u8g.setPrintPos(3,49);
u8g.print(LCD_STR_FEEDRATE[0]);
u8g.setFont(FONT_STATUSMENU);
u8g.setPrintPos(12,48);
u8g.setPrintPos(12,49);
u8g.print(itostr3(feedmultiply));
u8g.print('%');
// Status line
u8g.setFont(FONT_STATUSMENU);
u8g.setPrintPos(0,61);
u8g.setPrintPos(0,63);
#ifndef FILAMENT_LCD_DISPLAY
u8g.print(lcd_status_message);
#else
......
......@@ -47,6 +47,7 @@ block_t *current_block; // A pointer to the block currently being traced
// Variables used by The Stepper Driver Interrupt
static unsigned char out_bits; // The next stepping-bits to be output
static unsigned int cleaning_buffer_counter;
// Counter variables for the bresenham line tracer
static long counter_x, counter_y, counter_z, counter_e;
......@@ -92,8 +93,8 @@ static bool old_x_min_endstop = false,
static bool check_endstops = true;
volatile long count_position[NUM_AXIS] = { 0 };
volatile signed char count_direction[NUM_AXIS] = { 1 };
volatile long count_position[NUM_AXIS] = { 0, 0, 0, 0 };
volatile signed char count_direction[NUM_AXIS] = { 1, 1, 1, 1 };
//===========================================================================
......@@ -399,6 +400,17 @@ FORCE_INLINE void trapezoid_generator_reset() {
// "The Stepper Driver Interrupt" - This timer interrupt is the workhorse.
// It pops blocks from the block_buffer and executes them by pulsing the stepper pins appropriately.
ISR(TIMER1_COMPA_vect) {
if(cleaning_buffer_counter)
{
current_block = NULL;
plan_discard_current_block();
if ((cleaning_buffer_counter == 1) && (SD_FINISHED_STEPPERRELEASE)) enquecommands_P(PSTR(SD_FINISHED_RELEASECOMMAND));
cleaning_buffer_counter--;
OCR1A = 200;
return;
}
// If there is no current block, attempt to pop one from the buffer
if (!current_block) {
// Anything in the buffer?
......@@ -1057,6 +1069,7 @@ void finishAndDisableSteppers() {
}
void quickStop() {
cleaning_buffer_counter = 5000;
DISABLE_STEPPER_DRIVER_INTERRUPT();
while (blocks_queued()) plan_discard_current_block();
current_block = NULL;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment