M114 returns millimeters instead of steps
This commit is contained in:
parent
ee481864fa
commit
e108ab2548
10
dda.h
10
dda.h
|
|
@ -5,6 +5,16 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
// Used in distance calculation during DDA setup
|
||||
/// micrometers per step X
|
||||
#define UM_PER_STEP_X 1000L / ((uint32_t) STEPS_PER_MM_X)
|
||||
/// micrometers per step Y
|
||||
#define UM_PER_STEP_Y 1000L / ((uint32_t) STEPS_PER_MM_Y)
|
||||
/// micrometers per step Z
|
||||
#define UM_PER_STEP_Z 1000L / ((uint32_t) STEPS_PER_MM_Z)
|
||||
/// micrometers per step E
|
||||
#define UM_PER_STEP_E 1000L / ((uint32_t) STEPS_PER_MM_E)
|
||||
|
||||
#ifdef ACCELERATION_REPRAP
|
||||
#ifdef ACCELERATION_RAMPING
|
||||
#error Cant use ACCELERATION_REPRAP and ACCELERATION_RAMPING together.
|
||||
|
|
|
|||
|
|
@ -392,7 +392,7 @@ void process_gcode_command() {
|
|||
// M113- extruder PWM
|
||||
// M114- report XYZEF to host
|
||||
case 114:
|
||||
sersendf_P(PSTR("X:%ld,Y:%ld,Z:%ld,E:%ld,F:%ld"), current_position.X, current_position.Y, current_position.Z, current_position.E, current_position.F);
|
||||
sersendf_P(PSTR("X:%lq,Y:%lq,Z:%lq,E:%lq,F:%ld"), current_position.X * UM_PER_STEP_X, current_position.Y * UM_PER_STEP_Y, current_position.Z * UM_PER_STEP_Z, current_position.E * UM_PER_STEP_E, current_position.F);
|
||||
// newline is sent from gcode_parse after we return
|
||||
break;
|
||||
// M115- capabilities string
|
||||
|
|
|
|||
36
sermsg.c
36
sermsg.c
|
|
@ -74,3 +74,39 @@ void serwrite_int32(int32_t v) {
|
|||
|
||||
serwrite_uint32(v);
|
||||
}
|
||||
|
||||
/** write decimal digits from a long unsigned int
|
||||
\param v number to send
|
||||
*/
|
||||
void serwrite_uint32_vf(uint32_t v, uint8_t fp) {
|
||||
uint8_t e, t;
|
||||
|
||||
for (e = 9; e > 0; e--) {
|
||||
if (v >= powers[e])
|
||||
break;
|
||||
}
|
||||
|
||||
if (e < fp)
|
||||
e = fp;
|
||||
|
||||
do
|
||||
{
|
||||
for (t = 0; v >= powers[e]; v -= powers[e], t++);
|
||||
serial_writechar(t + '0');
|
||||
if (e == fp)
|
||||
serial_writechar('.');
|
||||
}
|
||||
while (e--);
|
||||
}
|
||||
|
||||
/** write decimal digits from a long signed int
|
||||
\param v number to send
|
||||
*/
|
||||
void serwrite_int32_vf(int32_t v, uint8_t fp) {
|
||||
if (v < 0) {
|
||||
serial_writechar('-');
|
||||
v = -v;
|
||||
}
|
||||
|
||||
serwrite_uint32_vf(v, fp);
|
||||
}
|
||||
|
|
|
|||
3
sermsg.h
3
sermsg.h
|
|
@ -18,4 +18,7 @@ void serwrite_hex32(uint32_t v);
|
|||
void serwrite_uint32(uint32_t v);
|
||||
void serwrite_int32(int32_t v);
|
||||
|
||||
void serwrite_uint32_vf(uint32_t v, uint8_t fp);
|
||||
void serwrite_int32_vf(int32_t v, uint8_t fp);
|
||||
|
||||
#endif /* _SERMSG_H */
|
||||
|
|
@ -141,6 +141,10 @@ void sersendf_P(PGM_P format, ...) {
|
|||
break;
|
||||
/* case 'p':
|
||||
serwrite_hex16(va_arg(args, uint16_t));*/
|
||||
case 'q':
|
||||
serwrite_int32_vf(va_arg(args, int32_t), 3);
|
||||
j = 0;
|
||||
break;
|
||||
default:
|
||||
serial_writechar(c);
|
||||
j = 0;
|
||||
|
|
|
|||
Loading…
Reference in New Issue