int l = txbuf.available();
if (l > 0) {
- if (l > MAX_PACKET_SIZE_EPBULK)
- l = MAX_PACKET_SIZE_EPBULK;
+ // Use MAX_PACKET_SIZE_EPBULK-1 below instead of MAX_PACKET_SIZE_EPBULK
+ // to work around a problem sending packets that are exactly MAX_PACKET_SIZE_EPBULK
+ // bytes in length. The problem is that these packets don't flush properly.
+ if (l > MAX_PACKET_SIZE_EPBULK-1)
+ l = MAX_PACKET_SIZE_EPBULK-1;
int i;
for (i = 0; i < l; i++) {
txbuf.dequeue(&b[i]);
readEP(c, &size);
iprintf("Read %ld bytes:\n\t", size);
for (uint8_t i = 0; i < size; i++) {
+
+ // handle backspace and delete by deleting the last character in the buffer if there is one
+ if(c[i] == 0x08 || c[i] == 0x7F) {
+ if(!rxbuf.isEmpty()) rxbuf.pop();
+ continue;
+ }
+
if(c[i] == 'X' - 'A' + 1) { // ^X
- THEKERNEL->set_feed_hold(false); // required to free stuff up
+ //THEKERNEL->set_feed_hold(false); // required to free stuff up
halt_flag = true;
continue;
}
THEKERNEL->set_feed_hold(false);
continue;
}
- if(last_char_was_dollar && (c[i] == 'X' || c[i] == 'H')) {
- // we need to do this otherwise $X/$H won't work if there was a feed hold like when stop is clicked in bCNC
- THEKERNEL->set_feed_hold(false);
- }
}
last_char_was_dollar = (c[i] == '$');
halt_flag = false;
THEKERNEL->call_event(ON_HALT, nullptr);
if(THEKERNEL->is_grbl_mode()) {
- puts("ALARM:Abort during cycle\r\n");
+ puts("ALARM: Abort during cycle\r\n");
} else {
puts("HALTED, M999 or $X to exit HALT state\r\n");
}
}
// if we are in feed hold we do not process anything
- if(THEKERNEL->get_feed_hold()) return;
+ //if(THEKERNEL->get_feed_hold()) return;
if (nl_in_rx) {
string received;