Merge pull request #483 from XPila/MK3-accurate_homming
Mk3 accurate homming
This commit is contained in:
commit
c2917a4ba6
|
|
@ -1140,6 +1140,51 @@ void setup()
|
|||
// Force SD card update. Otherwise the SD card update is done from loop() on card.checkautostart(false),
|
||||
// but this times out if a blocking dialog is shown in setup().
|
||||
card.initsd();
|
||||
#ifdef DEBUG_SD_SPEED_TEST
|
||||
if (card.cardOK)
|
||||
{
|
||||
uint8_t* buff = (uint8_t*)block_buffer;
|
||||
uint32_t block = 0;
|
||||
uint32_t sumr = 0;
|
||||
uint32_t sumw = 0;
|
||||
for (int i = 0; i < 1024; i++)
|
||||
{
|
||||
uint32_t u = micros();
|
||||
bool res = card.card.readBlock(i, buff);
|
||||
u = micros() - u;
|
||||
if (res)
|
||||
{
|
||||
printf_P(PSTR("readBlock %4d 512 bytes %lu us\n"), i, u);
|
||||
sumr += u;
|
||||
u = micros();
|
||||
res = card.card.writeBlock(i, buff);
|
||||
u = micros() - u;
|
||||
if (res)
|
||||
{
|
||||
printf_P(PSTR("writeBlock %4d 512 bytes %lu us\n"), i, u);
|
||||
sumw += u;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf_P(PSTR("writeBlock %4d error\n"), i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
printf_P(PSTR("readBlock %4d error\n"), i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
uint32_t avg_rspeed = (1024 * 1000000) / (sumr / 512);
|
||||
uint32_t avg_wspeed = (1024 * 1000000) / (sumw / 512);
|
||||
printf_P(PSTR("avg read speed %lu bytes/s\n"), avg_rspeed);
|
||||
printf_P(PSTR("avg write speed %lu bytes/s\n"), avg_wspeed);
|
||||
}
|
||||
else
|
||||
printf_P(PSTR("Card NG!\n"));
|
||||
#endif DEBUG_SD_SPEED_TEST
|
||||
|
||||
if (eeprom_read_byte((uint8_t*)EEPROM_POWER_COUNT) == 0xff) eeprom_write_byte((uint8_t*)EEPROM_POWER_COUNT, 0);
|
||||
if (eeprom_read_byte((uint8_t*)EEPROM_CRASH_COUNT_X) == 0xff) eeprom_write_byte((uint8_t*)EEPROM_CRASH_COUNT_X, 0);
|
||||
if (eeprom_read_byte((uint8_t*)EEPROM_CRASH_COUNT_Y) == 0xff) eeprom_write_byte((uint8_t*)EEPROM_CRASH_COUNT_Y, 0);
|
||||
|
|
@ -1845,6 +1890,7 @@ void homeaxis(int axis, uint8_t cnt, uint8_t* pstep)
|
|||
// for the stall guard to work.
|
||||
current_position[axis] = 0;
|
||||
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
||||
set_destination_to_current();
|
||||
// destination[axis] = 11.f;
|
||||
destination[axis] = 3.f;
|
||||
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
|
||||
|
|
@ -6527,6 +6573,11 @@ void get_coordinates()
|
|||
if (next_feedrate > MAX_SILENT_FEEDRATE) next_feedrate = MAX_SILENT_FEEDRATE;
|
||||
#endif //MAX_SILENT_FEEDRATE
|
||||
if(next_feedrate > 0.0) feedrate = next_feedrate;
|
||||
if (!seen[0] && !seen[1] && !seen[2] && seen[3])
|
||||
{
|
||||
// float e_max_speed =
|
||||
// printf_P(PSTR("E MOVE speed %7.3f\n"), feedrate / 60)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -131,7 +131,12 @@ private:
|
|||
|
||||
#endif // SDCARD_SORT_ALPHA
|
||||
|
||||
#ifdef DEBUG_SD_SPEED_TEST
|
||||
public:
|
||||
#endif DEBUG_SD_SPEED_TEST
|
||||
Sd2Card card;
|
||||
|
||||
private:
|
||||
SdVolume volume;
|
||||
SdFile file;
|
||||
#define SD_PROCEDURE_DEPTH 1
|
||||
|
|
|
|||
|
|
@ -117,10 +117,11 @@ void tmc2130_wr_PWMCONF(uint8_t axis, uint8_t pwm_ampl, uint8_t pwm_grad, uint8_
|
|||
void tmc2130_wr_TPWMTHRS(uint8_t axis, uint32_t val32);
|
||||
void tmc2130_wr_THIGH(uint8_t axis, uint32_t val32);
|
||||
|
||||
#define tmc2130_rd(axis, addr, rval) tmc2130_rx(axis, addr, rval)
|
||||
#define tmc2130_wr(axis, addr, wval) tmc2130_tx(axis, addr | 0x80, wval)
|
||||
|
||||
uint8_t tmc2130_wr(uint8_t axis, uint8_t addr, uint32_t wval);
|
||||
uint8_t tmc2130_rd(uint8_t axis, uint8_t addr, uint32_t* rval);
|
||||
uint8_t tmc2130_txrx(uint8_t axis, uint8_t addr, uint32_t wval, uint32_t* rval);
|
||||
uint8_t tmc2130_tx(uint8_t axis, uint8_t addr, uint32_t wval);
|
||||
uint8_t tmc2130_rx(uint8_t axis, uint8_t addr, uint32_t* rval);
|
||||
|
||||
|
||||
void tmc2130_setup_chopper(uint8_t axis, uint8_t mres, uint8_t current_h, uint8_t current_r);
|
||||
|
|
@ -130,10 +131,6 @@ void tmc2130_setup_chopper(uint8_t axis, uint8_t mres, uint8_t current_h, uint8_
|
|||
void tmc2130_init()
|
||||
{
|
||||
DBG(_n("tmc2130_init(), mode=%S\n"), tmc2130_mode?_n("STEALTH"):_n("NORMAL"));
|
||||
/* tmc2130_mres[X_AXIS] = tmc2130_usteps2mres(TMC2130_USTEPS_XY);
|
||||
tmc2130_mres[Y_AXIS] = tmc2130_usteps2mres(TMC2130_USTEPS_XY);
|
||||
tmc2130_mres[Z_AXIS] = tmc2130_usteps2mres(TMC2130_USTEPS_Z);
|
||||
tmc2130_mres[E_AXIS] = tmc2130_usteps2mres(TMC2130_USTEPS_E);*/
|
||||
WRITE(X_TMC2130_CS, HIGH);
|
||||
WRITE(Y_TMC2130_CS, HIGH);
|
||||
WRITE(Z_TMC2130_CS, HIGH);
|
||||
|
|
@ -233,14 +230,7 @@ void tmc2130_st_isr(uint8_t last_step_mask)
|
|||
}
|
||||
if (sg_homing_axes_mask == 0)
|
||||
{
|
||||
/* if (crash)
|
||||
{
|
||||
if (diag_mask & 0x01) tmc2130_sg_cnt[0]++;
|
||||
if (diag_mask & 0x02) tmc2130_sg_cnt[1]++;
|
||||
if (diag_mask & 0x04) tmc2130_sg_cnt[2]++;
|
||||
if (diag_mask & 0x08) tmc2130_sg_cnt[3]++;
|
||||
}*/
|
||||
if (/*!is_usb_printing && */tmc2130_sg_stop_on_crash && crash)
|
||||
if (tmc2130_sg_stop_on_crash && crash)
|
||||
{
|
||||
tmc2130_sg_crash = crash;
|
||||
tmc2130_sg_stop_on_crash = false;
|
||||
|
|
@ -499,7 +489,7 @@ void tmc2130_wr_MSLUTSTART(uint8_t axis, uint8_t start_sin, uint8_t start_sin90)
|
|||
val |= (uint32_t)start_sin;
|
||||
val |= ((uint32_t)start_sin90) << 16;
|
||||
tmc2130_wr(axis, TMC2130_REG_MSLUTSTART, val);
|
||||
//printf_P(PSTR("MSLUTSTART=%08lx (start_sin=%d start_sin90=%d)\n"), val, start_sin, start_sin90);
|
||||
//printf_P(PSTR("MSLUTSTART=%08lx (start_sin=%d start_sin90=%d)\n"), val, start_sin, start_sin90);
|
||||
}
|
||||
|
||||
void tmc2130_wr_MSLUTSEL(uint8_t axis, uint8_t x1, uint8_t x2, uint8_t x3, uint8_t w0, uint8_t w1, uint8_t w2, uint8_t w3)
|
||||
|
|
@ -513,13 +503,13 @@ void tmc2130_wr_MSLUTSEL(uint8_t axis, uint8_t x1, uint8_t x2, uint8_t x3, uint8
|
|||
val |= ((uint32_t)x2) << 16;
|
||||
val |= ((uint32_t)x3) << 24;
|
||||
tmc2130_wr(axis, TMC2130_REG_MSLUTSEL, val);
|
||||
//printf_P(PSTR("MSLUTSEL=%08lx (x1=%d x2=%d x3=%d w0=%d w1=%d w2=%d w3=%d)\n"), val, x1, x2, x3, w0, w1, w2, w3);
|
||||
//printf_P(PSTR("MSLUTSEL=%08lx (x1=%d x2=%d x3=%d w0=%d w1=%d w2=%d w3=%d)\n"), val, x1, x2, x3, w0, w1, w2, w3);
|
||||
}
|
||||
|
||||
void tmc2130_wr_MSLUT(uint8_t axis, uint8_t i, uint32_t val)
|
||||
{
|
||||
tmc2130_wr(axis, TMC2130_REG_MSLUT0 + (i & 7), val);
|
||||
//printf_P(PSTR("MSLUT[%d]=%08lx\n"), i, val);
|
||||
//printf_P(PSTR("MSLUT[%d]=%08lx\n"), i, val);
|
||||
}
|
||||
|
||||
void tmc2130_wr_CHOPCONF(uint8_t axis, uint8_t toff, uint8_t hstrt, uint8_t hend, uint8_t fd3, uint8_t disfdcc, uint8_t rndtf, uint8_t chm, uint8_t tbl, uint8_t vsense, uint8_t vhighfs, uint8_t vhighchm, uint8_t sync, uint8_t mres, uint8_t intpol, uint8_t dedge, uint8_t diss2g)
|
||||
|
|
@ -574,43 +564,6 @@ uint8_t tmc2130_usteps2mres(uint16_t usteps)
|
|||
return mres;
|
||||
}
|
||||
|
||||
uint8_t tmc2130_wr(uint8_t axis, uint8_t addr, uint32_t wval)
|
||||
{
|
||||
uint8_t stat = tmc2130_txrx(axis, addr | 0x80, wval, 0);
|
||||
#ifdef TMC2130_DEBUG_WR
|
||||
MYSERIAL.print("tmc2130_wr(");
|
||||
MYSERIAL.print((unsigned char)axis, DEC);
|
||||
MYSERIAL.print(", 0x");
|
||||
MYSERIAL.print((unsigned char)addr, HEX);
|
||||
MYSERIAL.print(", 0x");
|
||||
MYSERIAL.print((unsigned long)wval, HEX);
|
||||
MYSERIAL.print(")=0x");
|
||||
MYSERIAL.println((unsigned char)stat, HEX);
|
||||
#endif //TMC2130_DEBUG_WR
|
||||
return stat;
|
||||
}
|
||||
|
||||
uint8_t tmc2130_rd(uint8_t axis, uint8_t addr, uint32_t* rval)
|
||||
{
|
||||
uint32_t val32 = 0;
|
||||
uint8_t stat = tmc2130_txrx(axis, addr, 0x00000000, &val32);
|
||||
if (rval != 0) *rval = val32;
|
||||
#ifdef TMC2130_DEBUG_RD
|
||||
if (!skip_debug_msg)
|
||||
{
|
||||
MYSERIAL.print("tmc2130_rd(");
|
||||
MYSERIAL.print((unsigned char)axis, DEC);
|
||||
MYSERIAL.print(", 0x");
|
||||
MYSERIAL.print((unsigned char)addr, HEX);
|
||||
MYSERIAL.print(", 0x");
|
||||
MYSERIAL.print((unsigned long)val32, HEX);
|
||||
MYSERIAL.print(")=0x");
|
||||
MYSERIAL.println((unsigned char)stat, HEX);
|
||||
}
|
||||
skip_debug_msg = false;
|
||||
#endif //TMC2130_DEBUG_RD
|
||||
return stat;
|
||||
}
|
||||
|
||||
inline void tmc2130_cs_low(uint8_t axis)
|
||||
{
|
||||
|
|
@ -634,7 +587,8 @@ inline void tmc2130_cs_high(uint8_t axis)
|
|||
}
|
||||
}
|
||||
|
||||
uint8_t tmc2130_txrx(uint8_t axis, uint8_t addr, uint32_t wval, uint32_t* rval)
|
||||
|
||||
uint8_t tmc2130_tx(uint8_t axis, uint8_t addr, uint32_t wval)
|
||||
{
|
||||
//datagram1 - request
|
||||
SPI.beginTransaction(SPISettings(4000000, MSBFIRST, SPI_MODE3));
|
||||
|
|
@ -646,6 +600,20 @@ uint8_t tmc2130_txrx(uint8_t axis, uint8_t addr, uint32_t wval, uint32_t* rval)
|
|||
SPI.transfer(wval & 0xff); // LSB
|
||||
tmc2130_cs_high(axis);
|
||||
SPI.endTransaction();
|
||||
}
|
||||
|
||||
uint8_t tmc2130_rx(uint8_t axis, uint8_t addr, uint32_t* rval)
|
||||
{
|
||||
//datagram1 - request
|
||||
SPI.beginTransaction(SPISettings(4000000, MSBFIRST, SPI_MODE3));
|
||||
tmc2130_cs_low(axis);
|
||||
SPI.transfer(addr); // address
|
||||
SPI.transfer(0); // MSB
|
||||
SPI.transfer(0);
|
||||
SPI.transfer(0);
|
||||
SPI.transfer(0); // LSB
|
||||
tmc2130_cs_high(axis);
|
||||
SPI.endTransaction();
|
||||
//datagram2 - response
|
||||
SPI.beginTransaction(SPISettings(4000000, MSBFIRST, SPI_MODE3));
|
||||
tmc2130_cs_low(axis);
|
||||
|
|
@ -704,10 +672,10 @@ uint16_t tmc2130_get_res(uint8_t axis)
|
|||
void tmc2130_set_res(uint8_t axis, uint16_t res)
|
||||
{
|
||||
tmc2130_mres[axis] = tmc2130_usteps2mres(res);
|
||||
// uint32_t u = micros();
|
||||
uint32_t u = micros();
|
||||
tmc2130_setup_chopper(axis, tmc2130_mres[axis], tmc2130_current_h[axis], tmc2130_current_r[axis]);
|
||||
// u = micros() - u;
|
||||
// printf_P(PSTR("tmc2130_setup_chopper %c %lu us"), "XYZE"[axis], u);
|
||||
u = micros() - u;
|
||||
printf_P(PSTR("tmc2130_setup_chopper %c %lu us"), "XYZE"[axis], u);
|
||||
}
|
||||
|
||||
uint8_t tmc2130_get_pwr(uint8_t axis)
|
||||
|
|
@ -852,8 +820,8 @@ void tmc2130_get_wave(uint8_t axis, uint8_t* data, FILE* stream)
|
|||
|
||||
void tmc2130_set_wave(uint8_t axis, uint8_t amp, uint8_t fac200)
|
||||
{
|
||||
// TMC2130 wave compression algorithm
|
||||
// optimized for minimal memory requirements
|
||||
// TMC2130 wave compression algorithm
|
||||
// optimized for minimal memory requirements
|
||||
printf_P(PSTR("tmc2130_set_wave %d %d\n"), axis, fac200);
|
||||
if (fac200 < TMC2130_WAVE_FAC200_MIN) fac200 = 0;
|
||||
if (fac200 > TMC2130_WAVE_FAC200_MAX) fac200 = TMC2130_WAVE_FAC200_MAX;
|
||||
|
|
@ -865,15 +833,15 @@ void tmc2130_set_wave(uint8_t axis, uint8_t amp, uint8_t fac200)
|
|||
uint8_t w[4] = {1,1,1,1}; //W bits (MSLUTSEL)
|
||||
uint8_t x[3] = {255,255,255}; //X segment bounds (MSLUTSEL)
|
||||
uint8_t s = 0; //current segment
|
||||
int8_t b; //encoded bit value
|
||||
int8_t b; //encoded bit value
|
||||
uint8_t dA; //delta value
|
||||
int i; //microstep index
|
||||
uint32_t reg; //tmc2130 register
|
||||
tmc2130_wr_MSLUTSTART(axis, 0, amp);
|
||||
int i; //microstep index
|
||||
uint32_t reg; //tmc2130 register
|
||||
tmc2130_wr_MSLUTSTART(axis, 0, amp);
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
if ((i & 31) == 0)
|
||||
reg = 0;
|
||||
{
|
||||
if ((i & 31) == 0)
|
||||
reg = 0;
|
||||
// calculate value
|
||||
if (fac == 0) // default TMC wave
|
||||
vA = (uint8_t)((amp+1) * sin((2*PI*i + PI)/1024) + 0.5) - 1;
|
||||
|
|
@ -887,7 +855,7 @@ void tmc2130_set_wave(uint8_t axis, uint8_t amp, uint8_t fac200)
|
|||
else
|
||||
{
|
||||
if (dA < d0) // delta < delta0 => switch wbit down
|
||||
{
|
||||
{
|
||||
//printf("dn\n");
|
||||
b = 0;
|
||||
switch (dA)
|
||||
|
|
@ -897,11 +865,11 @@ void tmc2130_set_wave(uint8_t axis, uint8_t amp, uint8_t fac200)
|
|||
case 1: d0 = 1; d1 = 2; w[s+1] = 2; break;
|
||||
default: b = -1; break;
|
||||
}
|
||||
if (b >= 0) { x[s] = i; s++; }
|
||||
if (b >= 0) { x[s] = i; s++; }
|
||||
}
|
||||
else if (dA > d1) // delta > delta0 => switch wbit up
|
||||
{
|
||||
//printf("up\n");
|
||||
//printf("up\n");
|
||||
b = 1;
|
||||
switch (dA)
|
||||
{
|
||||
|
|
@ -910,146 +878,20 @@ void tmc2130_set_wave(uint8_t axis, uint8_t amp, uint8_t fac200)
|
|||
case 3: d0 = 2; d1 = 3; w[s+1] = 3; break;
|
||||
default: b = -1; break;
|
||||
}
|
||||
if (b >= 0) { x[s] = i; s++; }
|
||||
if (b >= 0) { x[s] = i; s++; }
|
||||
}
|
||||
}
|
||||
if (b < 0) break; // delta out of range (<-1 or >3)
|
||||
if (s > 3) break; // segment out of range (> 3)
|
||||
//printf("%d\n", vA);
|
||||
if (b == 1) reg |= 0x80000000;
|
||||
if ((i & 31) == 31)
|
||||
tmc2130_wr_MSLUT(axis, (uint8_t)(i >> 5), reg);
|
||||
else
|
||||
reg >>= 1;
|
||||
// printf("%3d\t%3d\t%2d\t%2d\t%2d\t%2d %08x\n", i, vA, dA, b, w[s], s, reg);
|
||||
if (b < 0) break; // delta out of range (<-1 or >3)
|
||||
if (s > 3) break; // segment out of range (> 3)
|
||||
//printf("%d\n", vA);
|
||||
if (b == 1) reg |= 0x80000000;
|
||||
if ((i & 31) == 31)
|
||||
tmc2130_wr_MSLUT(axis, (uint8_t)(i >> 5), reg);
|
||||
else
|
||||
reg >>= 1;
|
||||
// printf("%3d\t%3d\t%2d\t%2d\t%2d\t%2d %08x\n", i, vA, dA, b, w[s], s, reg);
|
||||
}
|
||||
tmc2130_wr_MSLUTSEL(axis, x[0], x[1], x[2], w[0], w[1], w[2], w[3]);
|
||||
|
||||
/*
|
||||
// printf_P(PSTR(" tmc2130_set_wave %d %d\n"), axis, fac200);
|
||||
switch (fac200)
|
||||
{
|
||||
case 0: //default TMC wave 247/0
|
||||
tmc2130_wr_MSLUTSTART(axis, 0, 247);
|
||||
tmc2130_wr_MSLUT(axis, 0, 0xaaaab556);
|
||||
tmc2130_wr_MSLUT(axis, 1, 0x4a9554aa);
|
||||
tmc2130_wr_MSLUT(axis, 2, 0x24492929);
|
||||
tmc2130_wr_MSLUT(axis, 3, 0x10104222);
|
||||
tmc2130_wr_MSLUT(axis, 4, 0xf8000000);
|
||||
tmc2130_wr_MSLUT(axis, 5, 0xb5bb777d);
|
||||
tmc2130_wr_MSLUT(axis, 6, 0x49295556);
|
||||
tmc2130_wr_MSLUT(axis, 7, 0x00404222);
|
||||
tmc2130_wr_MSLUTSEL(axis, 2, 154, 255, 1, 2, 1, 1);
|
||||
break;
|
||||
case 210: //calculated wave 247/1.050
|
||||
tmc2130_wr_MSLUTSTART(axis, 0, 247);
|
||||
tmc2130_wr_MSLUT(axis, 0, 0x55294a4e);
|
||||
tmc2130_wr_MSLUT(axis, 1, 0xa52a552a);
|
||||
tmc2130_wr_MSLUT(axis, 2, 0x48949294);
|
||||
tmc2130_wr_MSLUT(axis, 3, 0x81042222);
|
||||
tmc2130_wr_MSLUT(axis, 4, 0x00000000);
|
||||
tmc2130_wr_MSLUT(axis, 5, 0xdb6eef7e);
|
||||
tmc2130_wr_MSLUT(axis, 6, 0x9295555a);
|
||||
tmc2130_wr_MSLUT(axis, 7, 0x00408444);
|
||||
tmc2130_wr_MSLUTSEL(axis, 3, 160, 255, 1, 2, 1, 1);
|
||||
break;
|
||||
case 212: //calculated wave 247/1.060
|
||||
tmc2130_wr_MSLUTSTART(axis, 0, 247);
|
||||
tmc2130_wr_MSLUT(axis, 0, 0x4a94948e);
|
||||
tmc2130_wr_MSLUT(axis, 1, 0x94a952a5);
|
||||
tmc2130_wr_MSLUT(axis, 2, 0x24925252);
|
||||
tmc2130_wr_MSLUT(axis, 3, 0x10421112);
|
||||
tmc2130_wr_MSLUT(axis, 4, 0xc0000020);
|
||||
tmc2130_wr_MSLUT(axis, 5, 0xdb7777df);
|
||||
tmc2130_wr_MSLUT(axis, 6, 0x9295556a);
|
||||
tmc2130_wr_MSLUT(axis, 7, 0x00408444);
|
||||
tmc2130_wr_MSLUTSEL(axis, 3, 157, 255, 1, 2, 1, 1);
|
||||
break;
|
||||
case 214: //calculated wave 247/1.070
|
||||
tmc2130_wr_MSLUTSTART(axis, 0, 247);
|
||||
tmc2130_wr_MSLUT(axis, 0, 0xa949489e);
|
||||
tmc2130_wr_MSLUT(axis, 1, 0x52a54a54);
|
||||
tmc2130_wr_MSLUT(axis, 2, 0x224a494a);
|
||||
tmc2130_wr_MSLUT(axis, 3, 0x04108889);
|
||||
tmc2130_wr_MSLUT(axis, 4, 0xffc08002);
|
||||
tmc2130_wr_MSLUT(axis, 5, 0x6dbbbdfb);
|
||||
tmc2130_wr_MSLUT(axis, 6, 0x94a555ab);
|
||||
tmc2130_wr_MSLUT(axis, 7, 0x00408444);
|
||||
tmc2130_wr_MSLUTSEL(axis, 4, 149, 255, 1, 2, 1, 1);
|
||||
break;
|
||||
case 215: //calculated wave 247/1.075
|
||||
tmc2130_wr_MSLUTSTART(axis, 0, 247);
|
||||
tmc2130_wr_MSLUT(axis, 0, 0x4a52491e);
|
||||
tmc2130_wr_MSLUT(axis, 1, 0xa54a54a9);
|
||||
tmc2130_wr_MSLUT(axis, 2, 0x49249494);
|
||||
tmc2130_wr_MSLUT(axis, 3, 0x10421122);
|
||||
tmc2130_wr_MSLUT(axis, 4, 0x00000008);
|
||||
tmc2130_wr_MSLUT(axis, 5, 0x6ddbdefc);
|
||||
tmc2130_wr_MSLUT(axis, 6, 0x94a555ad);
|
||||
tmc2130_wr_MSLUT(axis, 7, 0x00408444);
|
||||
tmc2130_wr_MSLUTSEL(axis, 4, 161, 255, 1, 2, 1, 1);
|
||||
break;
|
||||
case 216: //calculated wave 247/1.080
|
||||
tmc2130_wr_MSLUTSTART(axis, 0, 247);
|
||||
tmc2130_wr_MSLUT(axis, 0, 0x9494911e);
|
||||
tmc2130_wr_MSLUT(axis, 1, 0x4a94a94a);
|
||||
tmc2130_wr_MSLUT(axis, 2, 0x92492929);
|
||||
tmc2130_wr_MSLUT(axis, 3, 0x41044444);
|
||||
tmc2130_wr_MSLUT(axis, 4, 0x00000040);
|
||||
tmc2130_wr_MSLUT(axis, 5, 0xaedddf7f);
|
||||
tmc2130_wr_MSLUT(axis, 6, 0x94a956ad);
|
||||
tmc2130_wr_MSLUT(axis, 7, 0x00808448);
|
||||
tmc2130_wr_MSLUTSEL(axis, 4, 159, 255, 1, 2, 1, 1);
|
||||
break;
|
||||
case 218: //calculated wave 247/1.090
|
||||
tmc2130_wr_MSLUTSTART(axis, 0, 247);
|
||||
tmc2130_wr_MSLUT(axis, 0, 0x4a49223e);
|
||||
tmc2130_wr_MSLUT(axis, 1, 0x4a52a529);
|
||||
tmc2130_wr_MSLUT(axis, 2, 0x49252529);
|
||||
tmc2130_wr_MSLUT(axis, 3, 0x08422224);
|
||||
tmc2130_wr_MSLUT(axis, 4, 0xfc008004);
|
||||
tmc2130_wr_MSLUT(axis, 5, 0xb6eef7df);
|
||||
tmc2130_wr_MSLUT(axis, 6, 0xa4aaaab5);
|
||||
tmc2130_wr_MSLUT(axis, 7, 0x00808448);
|
||||
tmc2130_wr_MSLUTSEL(axis, 5, 153, 255, 1, 2, 1, 1);
|
||||
break;
|
||||
case 220: //calculated wave 247/1.100
|
||||
tmc2130_wr_MSLUTSTART(axis, 0, 247);
|
||||
tmc2130_wr_MSLUT(axis, 0, 0xa492487e);
|
||||
tmc2130_wr_MSLUT(axis, 1, 0x294a52a4);
|
||||
tmc2130_wr_MSLUT(axis, 2, 0x492494a5);
|
||||
tmc2130_wr_MSLUT(axis, 3, 0x82110912);
|
||||
tmc2130_wr_MSLUT(axis, 4, 0x00000080);
|
||||
tmc2130_wr_MSLUT(axis, 5, 0xdb777df8);
|
||||
tmc2130_wr_MSLUT(axis, 6, 0x252aaad6);
|
||||
tmc2130_wr_MSLUT(axis, 7, 0x00808449);
|
||||
tmc2130_wr_MSLUTSEL(axis, 6, 162, 255, 1, 2, 1, 1);
|
||||
break;
|
||||
case 222: //calculated wave 247/1.110
|
||||
tmc2130_wr_MSLUTSTART(axis, 0, 247);
|
||||
tmc2130_wr_MSLUT(axis, 0, 0x524910fe);
|
||||
tmc2130_wr_MSLUT(axis, 1, 0xa5294a52);
|
||||
tmc2130_wr_MSLUT(axis, 2, 0x24929294);
|
||||
tmc2130_wr_MSLUT(axis, 3, 0x20844489);
|
||||
tmc2130_wr_MSLUT(axis, 4, 0xc0004008);
|
||||
tmc2130_wr_MSLUT(axis, 5, 0xdbbbdf7f);
|
||||
tmc2130_wr_MSLUT(axis, 6, 0x252aab5a);
|
||||
tmc2130_wr_MSLUT(axis, 7, 0x00808449);
|
||||
tmc2130_wr_MSLUTSEL(axis, 7, 157, 255, 1, 2, 1, 1);
|
||||
break;
|
||||
case 224: //calculated wave 247/1.120
|
||||
tmc2130_wr_MSLUTSTART(axis, 0, 247);
|
||||
tmc2130_wr_MSLUT(axis, 0, 0x292223fe);
|
||||
tmc2130_wr_MSLUT(axis, 1, 0x94a52949);
|
||||
tmc2130_wr_MSLUT(axis, 2, 0x92524a52);
|
||||
tmc2130_wr_MSLUT(axis, 3, 0x04222244);
|
||||
tmc2130_wr_MSLUT(axis, 4, 0x00000101);
|
||||
tmc2130_wr_MSLUT(axis, 5, 0x6dddefe0);
|
||||
tmc2130_wr_MSLUT(axis, 6, 0x254aad5b);
|
||||
tmc2130_wr_MSLUT(axis, 7, 0x00810889);
|
||||
tmc2130_wr_MSLUTSEL(axis, 9, 164, 255, 1, 2, 1, 1);
|
||||
break;
|
||||
}*/
|
||||
tmc2130_wr_MSLUTSEL(axis, x[0], x[1], x[2], w[0], w[1], w[2], w[3]);
|
||||
}
|
||||
|
||||
void bubblesort_uint8(uint8_t* data, uint8_t size, uint8_t* data2)
|
||||
|
|
|
|||
|
|
@ -1585,13 +1585,17 @@ static void lcd_menu_fails_stats()
|
|||
|
||||
|
||||
#ifdef DEBUG_BUILD
|
||||
#ifdef DEBUG_STACK_MONITOR
|
||||
extern uint16_t SP_min;
|
||||
extern char* __malloc_heap_start;
|
||||
extern char* __malloc_heap_end;
|
||||
#endif //DEBUG_STACK_MONITOR
|
||||
|
||||
static void lcd_menu_debug()
|
||||
{
|
||||
#ifdef DEBUG_STACK_MONITOR
|
||||
fprintf_P(lcdout, PSTR(ESC_H(1,1)"RAM statistics"ESC_H(5,1)"SP_min: 0x%04x"ESC_H(1,2)"heap_start: 0x%04x"ESC_H(3,3)"heap_end: 0x%04x"), SP_min, __malloc_heap_start, __malloc_heap_end);
|
||||
#endif //DEBUG_STACK_MONITOR
|
||||
|
||||
if (lcd_clicked())
|
||||
{
|
||||
|
|
@ -5836,7 +5840,7 @@ static void lcd_selftest_v()
|
|||
static bool lcd_selftest()
|
||||
{
|
||||
int _progress = 0;
|
||||
bool _result = false;
|
||||
bool _result = true;
|
||||
lcd_wait_for_cool_down();
|
||||
lcd_implementation_clear();
|
||||
lcd.setCursor(0, 0); lcd_printPGM(MSG_SELFTEST_START);
|
||||
|
|
@ -5845,8 +5849,12 @@ static bool lcd_selftest()
|
|||
#endif // TMC2130
|
||||
delay(2000);
|
||||
KEEPALIVE_STATE(IN_HANDLER);
|
||||
_progress = lcd_selftest_screen(-1, _progress, 3, true, 2000);
|
||||
_result = lcd_selftest_fan_dialog(0);
|
||||
|
||||
if (_result)
|
||||
{
|
||||
_progress = lcd_selftest_screen(-1, _progress, 3, true, 2000);
|
||||
_result = lcd_selftest_fan_dialog(0);
|
||||
}
|
||||
|
||||
if (_result)
|
||||
{
|
||||
|
|
@ -5929,6 +5937,15 @@ static bool lcd_selftest()
|
|||
}
|
||||
}
|
||||
|
||||
if (_result)
|
||||
{
|
||||
_progress = lcd_selftest_screen(13, 0, 2, true, 0);
|
||||
tmc2130_home_calibrate(X_AXIS);
|
||||
_progress = lcd_selftest_screen(13, 1, 2, true, 0);
|
||||
tmc2130_home_calibrate(Y_AXIS);
|
||||
_progress = lcd_selftest_screen(13, 2, 2, true, 0);
|
||||
}
|
||||
|
||||
if (_result)
|
||||
{
|
||||
_progress = lcd_selftest_screen(7, _progress, 3, true, 2000); //check bed
|
||||
|
|
@ -6712,6 +6729,7 @@ static int lcd_selftest_screen(int _step, int _progress, int _progress_scale, bo
|
|||
if (_step == 10) lcd_printPGM(MSG_SELFTEST_CHECK_FSENSOR);
|
||||
if (_step == 11) lcd_printPGM(MSG_SELFTEST_CHECK_ALLCORRECT);
|
||||
if (_step == 12) lcd_printPGM(MSG_SELFTEST_FAILED);
|
||||
if (_step == 13) lcd_printPGM(PSTR("Calibrating home"));
|
||||
|
||||
lcd.setCursor(0, 1);
|
||||
lcd.print("--------------------");
|
||||
|
|
|
|||
Loading…
Reference in New Issue