Merge pull request #453 from PavelSindler/fw_version_check
Fw version check and M600 filament unload current
This commit is contained in:
commit
6ba52e33d3
|
|
@ -205,6 +205,7 @@ const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic o
|
||||||
//new settings is possible for vsense = 1, running current value > 31 set vsense to zero and shift both currents by 1 bit right (Z axis only)
|
//new settings is possible for vsense = 1, running current value > 31 set vsense to zero and shift both currents by 1 bit right (Z axis only)
|
||||||
#define TMC2130_CURRENTS_H {13, 20, 25, 35} // default holding currents for all axes
|
#define TMC2130_CURRENTS_H {13, 20, 25, 35} // default holding currents for all axes
|
||||||
#define TMC2130_CURRENTS_R {13, 20, 25, 35} // default running currents for all axes
|
#define TMC2130_CURRENTS_R {13, 20, 25, 35} // default running currents for all axes
|
||||||
|
#define TMC2130_UNLOAD_CURRENT_R 12 // lowe current for M600 to protect filament sensor
|
||||||
|
|
||||||
//#define TMC2130_DEBUG
|
//#define TMC2130_DEBUG
|
||||||
//#define TMC2130_DEBUG_WR
|
//#define TMC2130_DEBUG_WR
|
||||||
|
|
|
||||||
|
|
@ -5740,6 +5740,10 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp
|
||||||
//plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], 3500 / 60, active_extruder);
|
//plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], 3500 / 60, active_extruder);
|
||||||
|
|
||||||
target[E_AXIS] -= FILAMENTCHANGE_FINALRETRACT;
|
target[E_AXIS] -= FILAMENTCHANGE_FINALRETRACT;
|
||||||
|
st_synchronize();
|
||||||
|
uint8_t tmc2130_current_r_bckp = tmc2130_current_r[E_AXIS];
|
||||||
|
tmc2130_set_current_r(E_AXIS, TMC2130_UNLOAD_CURRENT_R);
|
||||||
|
|
||||||
target[E_AXIS] -= 45;
|
target[E_AXIS] -= 45;
|
||||||
plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], 5200 / 60, active_extruder);
|
plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], 5200 / 60, active_extruder);
|
||||||
st_synchronize();
|
st_synchronize();
|
||||||
|
|
@ -5750,6 +5754,7 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp
|
||||||
plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], 1000 / 60, active_extruder);
|
plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], 1000 / 60, active_extruder);
|
||||||
st_synchronize();
|
st_synchronize();
|
||||||
|
|
||||||
|
tmc2130_set_current_r(E_AXIS, tmc2130_current_r_bckp);
|
||||||
#endif // SNMM
|
#endif // SNMM
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ inline bool parse_version(const char *str, uint16_t version[4])
|
||||||
version[3] = FIRMWARE_REVISION_ALPHA;
|
version[3] = FIRMWARE_REVISION_ALPHA;
|
||||||
else if (n == strlen_P(STR_REVISION_BETA) && strncmp_P(p, STR_REVISION_BETA, n) == 0)
|
else if (n == strlen_P(STR_REVISION_BETA) && strncmp_P(p, STR_REVISION_BETA, n) == 0)
|
||||||
version[3] = FIRMWARE_REVISION_BETA;
|
version[3] = FIRMWARE_REVISION_BETA;
|
||||||
else if ((n == 2 || n == 3) && p[0] == 'r' && p[1] == 'c') {
|
else if ((n == 2 || n == 3) && (p[0] == 'r' || p[0] == 'R') && (p[1] == 'c' || p[1] == 'C')) {
|
||||||
if (n == 2)
|
if (n == 2)
|
||||||
version[3] = FIRMWARE_REVISION_RC;
|
version[3] = FIRMWARE_REVISION_RC;
|
||||||
else {
|
else {
|
||||||
|
|
@ -116,12 +116,22 @@ inline bool parse_version(const char *str, uint16_t version[4])
|
||||||
inline bool strncmp_PP(const char *p1, const char *p2, uint8_t n)
|
inline bool strncmp_PP(const char *p1, const char *p2, uint8_t n)
|
||||||
{
|
{
|
||||||
for (; n > 0; -- n, ++ p1, ++ p2) {
|
for (; n > 0; -- n, ++ p1, ++ p2) {
|
||||||
if (pgm_read_byte(p1) < pgm_read_byte(p2))
|
if (pgm_read_byte(p1) >= 65 && pgm_read_byte(p1) <= 92) //p1 is upper case (p2 is always lowercase)
|
||||||
return -1;
|
{
|
||||||
if (pgm_read_byte(p1) > pgm_read_byte(p2))
|
if ((pgm_read_byte(p1)+32) < pgm_read_byte(p2))
|
||||||
return 1;
|
return -1;
|
||||||
if (pgm_read_byte(p1) == 0)
|
if ((pgm_read_byte(p1)+32) > pgm_read_byte(p2))
|
||||||
return 0;
|
return 1;
|
||||||
|
}
|
||||||
|
else if (pgm_read_byte(p1) == 0) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else { //p1 is lowercase
|
||||||
|
if (pgm_read_byte(p1) < pgm_read_byte(p2))
|
||||||
|
return -1;
|
||||||
|
if (pgm_read_byte(p1) > pgm_read_byte(p2))
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue