Skip to content

Commit b244b37

Browse files
committed
Fix for #2410
See the issue on github for more details, but the cause seems to be a naive attempt to handle zero-length moves at zero feed rate without considering very short moves at a suitably small feed rate. Signed-off-by: andypugh <andy@bodgesoc.org>
1 parent de5aa5b commit b244b37

3 files changed

Lines changed: 17 additions & 11 deletions

File tree

src/emc/rs274ngc/interp_convert.cc

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4750,11 +4750,10 @@ The approach to operating in incremental distance mode (g91) is to
47504750
put the the absolute position values into the block before using the
47514751
block to generate a move.
47524752
4753-
In inverse time feed mode, a lower bound of 0.1 is placed on the feed
4754-
rate so that the feed rate is never set to zero. If the destination
4755-
point is the same as the current point, the feed rate would be
4756-
calculated as zero otherwise.
4757-
4753+
If the destination point is the same as the current point, the feed rate
4754+
will be calculated as zero, so a default of 0.1 is applied in this case
4755+
(It doesn't matter how wrong the feed rate is on a zero-length move)
4756+
47584757
If cutter compensation is in use, the path's length may increase or
47594758
decrease. Also an arc may be added, to go around a corner, before the
47604759
straight move. For the purpose of calculating the feed rate when in

src/emc/rs274ngc/interp_inverse.cc

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,13 @@ int Interp::inverse_time_rate_arc(double x1, //!< x coord of start point of
6262
if (settings->feed_mode != INVERSE_TIME) return -1;
6363

6464
length = find_arc_length(x1, y1, z1, cx, cy, turn, x2, y2, z2);
65-
rate = std::max(0.1, (length * block->f_number));
65+
if (length == 0){
66+
rate = 0.1; // See https://github.com/LinuxCNC/linuxcnc/issues/2410
67+
} else {
68+
rate = length * block->f_number;
69+
}
6670
enqueue_SET_FEED_RATE(rate);
6771
settings->feed_rate = rate;
68-
6972
return INTERP_OK;
7073
}
7174

@@ -120,10 +123,14 @@ int Interp::inverse_time_rate_straight(double end_x, //!< x coordinate of en
120123
cx, cy, cz,
121124
settings->AA_current, settings->BB_current, settings->CC_current,
122125
settings->u_current, settings->v_current, settings->w_current);
123-
124-
rate = std::max(0.1, (length * block->f_number));
126+
if (length == 0){
127+
rate = 0.1; // See https://github.com/LinuxCNC/linuxcnc/issues/2410
128+
} else {
129+
rate = length * block->f_number;
130+
}
131+
125132
enqueue_SET_FEED_RATE(rate);
126133
settings->feed_rate = rate;
127-
134+
printf("Length = %f, rate = %f\n", length, rate);
128135
return INTERP_OK;
129136
}

src/hal/drivers/mesa-hostmot2/modbus/mesa_modbus.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ int send_modbus_pkt(hm2_modbus_inst_t *inst){
472472
rtapi_u16 checksum;
473473
rtapi_u16 fsizes[1];
474474
rtapi_u8 frames;
475-
int i;
475+
int i;
476476

477477
checksum = RTU_CRC(ch->data, ch->ptr + 1);
478478
ch->data[++(ch->ptr)] = checksum & 0xFF;

0 commit comments

Comments
 (0)