Found segment fault in hold message preparation

This commit is contained in:
Alden Hart
2017-04-10 17:03:45 -04:00
parent f3e950c81b
commit 8eb99f2513
3 changed files with 18 additions and 9 deletions
+12 -6
View File
@@ -1907,12 +1907,18 @@ static const char msg_hold0[] = "Off";
static const char msg_hold1[] = "Requested";
static const char msg_hold2[] = "Sync";
static const char msg_hold3[] = "Decel Continue";
static const char msg_hold4[] = "Decel to Zero";
static const char msg_hold5[] = "Decel Done";
static const char msg_hold6[] = "Pending";
static const char msg_hold7[] = "Hold";
static const char *const msg_hold[] = { msg_hold0, msg_hold1, msg_hold2, msg_hold3,
msg_hold4, msg_hold5, msg_hold6, msg_hold7 };
static const char msg_hold4[] = "Decel To Zero";
static const char msg_hold5[] = "Decel Complete";
static const char msg_hold6[] = "Motion Stopping";
static const char msg_hold7[] = "Motion Stopped";
static const char msg_hold8[] = "Hold Actions Pending";
static const char msg_hold9[] = "Hold Actions Complete";
static const char msg_hold10[] = "Holding";
static const char msg_hold11[] = "Hold Exit Actions Pending";
static const char msg_hold12[] = "Hold Exit Actions Complete";
static const char *const msg_hold[] = { msg_hold0, msg_hold1, msg_hold2, msg_hold3, msg_hold4,
msg_hold5, msg_hold6, msg_hold7, msg_hold8, msg_hold9,
msg_hold10, msg_hold11, msg_hold12 };
static const char msg_home0[] = "Not Homed";
static const char msg_home1[] = "Homed";
+2 -1
View File
@@ -258,7 +258,8 @@ static void _dispatch_kernel(const devflags_t flags)
}
// trap single character commands
if (*cs.bufp == '!') { cm_request_feedhold(FEEDHOLD_TYPE_ACTIONS, FEEDHOLD_EXIT_CYCLE); }
// if (*cs.bufp == '!') { cm_request_feedhold(FEEDHOLD_TYPE_ACTIONS, FEEDHOLD_EXIT_CYCLE); }
if (*cs.bufp == '!') { cm_request_feedhold(FEEDHOLD_TYPE_HOLD, FEEDHOLD_EXIT_CYCLE); }
else if (*cs.bufp == '~') { cm_request_cycle_start(); }
else if (*cs.bufp == '%') { cm_request_queue_flush(); xio_flush_to_command(); }
else if (*cs.bufp == EOT) { cm_request_job_kill(); xio_flush_to_command(); }
+4 -2
View File
@@ -404,8 +404,10 @@ static uint8_t _populate_filtered_status_report()
// report values that have changed by more than the indicated precision, but always stops and ends
if ((fabs(current_value - sr.status_report_value[i]) > precision[cfgArray[nv->index].precision]) ||
((nv->index == sr.stat_index) && fp_EQ(nv->value_int, COMBINED_PROGRAM_STOP)) ||
((nv->index == sr.stat_index) && fp_EQ(nv->value_int, COMBINED_PROGRAM_END))) {
// ((nv->index == sr.stat_index) && fp_EQ(nv->value_int, COMBINED_PROGRAM_STOP)) ||
// ((nv->index == sr.stat_index) && fp_EQ(nv->value_int, COMBINED_PROGRAM_END))) {
((nv->index == sr.stat_index) && (nv->value_int == COMBINED_PROGRAM_STOP)) ||
((nv->index == sr.stat_index) && (nv->value_int == COMBINED_PROGRAM_END))) {
strcpy(tmp, nv->group); // flatten out groups - WARNING - you cannot use strncpy here...
strcat(tmp, nv->token);