From: Michael G. <gi...@gi...> - 2009-07-04 16:41:10
|
Cleanup and update interp_check error messages Improve some error checking to catch more logical errors of gcode Signed-off-by: Michael Geszkiewicz <mi...@wp...> http://git.linuxcnc.org/?p=emc2.git;a=commitdiff;h=2a8a986 --- src/emc/rs274ngc/interp_check.cc | 81 +++++++++++++++++------------------ src/emc/rs274ngc/rs274ngc_return.hh | 2 - 2 files changed, 40 insertions(+), 43 deletions(-) diff --git a/src/emc/rs274ngc/interp_check.cc b/src/emc/rs274ngc/interp_check.cc index f64237b..793f5ed 100644 --- a/src/emc/rs274ngc/interp_check.cc +++ b/src/emc/rs274ngc/interp_check.cc @@ -246,60 +246,47 @@ int Interp::check_other_codes(block_pointer block) //!< pointer to a block if (block->d_flag == ON) { CHKS(((block->g_modes[7] != G_41) && (block->g_modes[7] != G_42) && (block->g_modes[7] != G_41_1) && (block->g_modes[7] != G_42_1) && - (block->g_modes[14] != G_96) && (block->m_modes[5] != 66)), - "D word with no G41, G41.1, G42, G42.2, or G96 to use it"); + (block->g_modes[14] != G_96)), + _("D word with no G41, G41.1, G42, G42.2, or G96 to use it")); } - if (block->s_number < 0) { - CHKS((block->g_modes[14] == G_96), NCE_S_WORD_MISSING_WITH_G96); + + if (block->e_flag == ON) { + CHKS(((motion != G_76) && (block->m_modes[5] != 66) && + (block->m_modes[5] != 67) && (block->m_modes[5] != 68)), + _("E word with no G76, M66, M67 or M68 to use it")); } - + if (block->h_flag == ON) { - CHKS((block->g_modes[8] != G_43 && motion != G_76), NCE_H_WORD_WITH_NO_G43); + CHKS((block->g_modes[8] != G_43 && motion != G_76), + _("H word with no G43 or G76 to use it")); } if (block->i_flag == ON) { /* could still be useless if yz_plane arc */ CHKS(((motion != G_2) && (motion != G_3) && (motion != G_5) && (motion != G_5_1) && (motion != G_76) && (motion != G_87) && (block->g_modes[8] != G_43_1)), - "I word with no G2, G3, G5, G5.1, G76, G87, or G43.1 to use it"); + _("I word with no G2, G3, G5, G5.1, G76, G87 or G43.1 to use it")); } if (block->j_flag == ON) { /* could still be useless if xz_plane arc */ CHKS(((motion != G_2) && (motion != G_3) && (motion != G_5) && (motion != G_5_1) && (motion != G_76) && (motion != G_87)), - "J word with no G2, G3, G5, G5.1, G76, G87, or G43.1 to use it"); + _("J word with no G2, G3, G5, G5.1, G76 or G87 to use it")); } if (block->k_flag == ON) { /* could still be useless if xy_plane arc */ - CHKS(((motion != G_2) && (motion != G_3) && (motion != G_33) && (motion != G_33_1) && (motion != G_76) && (motion != G_87) && (block->g_modes[8] != G_43_1)), - "K word with no G2, G3, G76, G87, or G43.1 to use it"); - } - - if (motion == G_33 || motion == G_33_1) { - CHKS((block->k_flag == OFF), NCE_K_WORD_MISSING_WITH_G33); - CHKS((block->f_number != -1), NCE_F_WORD_USED_WITH_G33); - } - - if (motion == G_76) { - // pitch - CHKS((block->p_number == -1), NCE_P_WORD_MISSING_WITH_G76); - - CHKS((block->i_flag == OFF || block->j_flag == OFF || block->k_flag == OFF), - NCE_I_J_OR_K_WORDS_MISSING_WITH_G76); + CHKS(((motion != G_2) && (motion != G_3) && (motion != G_33) && + (motion != G_33_1) && (motion != G_76) && (motion != G_87) && (block->g_modes[8] != G_43_1)), + _("K word with no G2, G3, G33, G33.1, G76, G87 or G43.1 to use it")); } if (block->l_number != -1) { - CHKS((((motion < G_81) || (motion > G_89)) && + CHKS((((motion < G_81) || (motion > G_89)) && (motion != G_76) && + (motion != G_5_2) && (motion != G_73) && (block->g_modes[0] != G_10) && -// (motion != G_76) && - (motion != G_76) && (motion != G_5_2) && - (motion != G_73) && - (block->g_modes[7] != G_41) && - (block->g_modes[7] != G_41_1) && - (block->g_modes[7] != G_42) && - (block->g_modes[7] != G_42_1) && + (block->g_modes[7] != G_41) && (block->g_modes[7] != G_41_1) && + (block->g_modes[7] != G_42) && (block->g_modes[7] != G_42_1) && (block->m_modes[5] != 66)), -// "L word with no G10, cutter compensation, or canned cycle"); - "L word with no G10, cutter compensation, or canned cycle or NURBS code"); + _("L word with no G10, cutter compensation, canned cycle, digital/analog input, or NURBS code")); } if (block->p_flag == ON) { @@ -310,20 +297,15 @@ int Interp::check_other_codes(block_pointer block) //!< pointer to a block (block->m_modes[9] != 53) && (block->m_modes[5] != 62) && (block->m_modes[5] != 63) && (block->m_modes[5] != 64) && (block->m_modes[5] != 65) && (block->m_modes[5] != 66) && (block->user_m != 1)), - _("P word with no g4 g10 g64 g5 g5.2 g76 g82 g86 g88 g89\n" - "or m50 m51 m52 m53 m62 m63 m64 m65 m66 or user M code to use it")); + _("P word with no G4 G10 G64 G5 G5.2 G76 G82 G86 G88 G89" + " or M50 M51 M52 M53 M62 M63 M64 M65 M66 or user M code to use it")); } if (block->q_number != -1.0) { CHKS((motion != G_83) && (motion != G_73) && (motion != G_5) && (block->user_m != 1) && (motion != G_76) && (block->m_modes[5] != 66) && (block->m_modes[5] != 67) && (block->m_modes[5] != 68) && (block->g_modes[0] != G_10) && (block->m_modes[6] != 61) && (block->g_modes[13] != G_64), - "Q word with no g code that uses it"); - } - - if (block->e_flag == ON) { - CHKS(((motion != G_76) && (block->m_modes[5] != 66) && - (block->m_modes[5] != 67) && (block->m_modes[5] != 68)), NCE_E_WORD_WITH_NO_G76_OR_M66_TO_USE_IT); + _("Q word with no G5, G10, G64, G73, G76, G83, M66, M67, M68 or user M code that uses it")); } if (block->r_flag == ON) { @@ -334,5 +316,22 @@ int Interp::check_other_codes(block_pointer block) //!< pointer to a block NCE_R_WORD_WITH_NO_G_CODE_THAT_USES_IT); } + if (block->s_number < 0) { + CHKS((block->g_modes[14] == G_96), NCE_S_WORD_MISSING_WITH_G96); + } + + if (motion == G_33 || motion == G_33_1) { + CHKS((block->k_flag == OFF), NCE_K_WORD_MISSING_WITH_G33); + CHKS((block->f_number != -1), NCE_F_WORD_USED_WITH_G33); + } + + if (motion == G_76) { + // pitch + CHKS((block->p_number == -1), NCE_P_WORD_MISSING_WITH_G76); + + CHKS((block->i_flag == OFF || block->j_flag == OFF || block->k_flag == OFF), + NCE_I_J_OR_K_WORDS_MISSING_WITH_G76); + } + return INTERP_OK; } diff --git a/src/emc/rs274ngc/rs274ngc_return.hh b/src/emc/rs274ngc/rs274ngc_return.hh index fed8340..b9eb2f3 100644 --- a/src/emc/rs274ngc/rs274ngc_return.hh +++ b/src/emc/rs274ngc/rs274ngc_return.hh @@ -81,7 +81,6 @@ #define NCE_FILE_ENDED_WITH_NO_PERCENT_SIGN_OR_PROGRAM_END _("File ended with no percent sign or program end") #define NCE_FILE_NAME_TOO_LONG _("File name too long") #define NCE_G_CODE_OUT_OF_RANGE _("G code out of range") -#define NCE_H_WORD_WITH_NO_G43 _("H word with no g43") #define NCE_I_WORD_GIVEN_FOR_ARC_IN_YZ_PLANE _("I word given for arc in yz plane") #define NCE_I_WORD_MISSING_WITH_G87 _("I word missing with g87") #define NCE_I_WORD_WITH_NO_G2_OR_G3_G76_OR_G87_TO_USE_IT _("I word with no g2, g3, g87, or g43 to use it") @@ -217,7 +216,6 @@ #define NCE_I_J_OR_K_WORDS_MISSING_WITH_G76 _("I J or K words missing with G76") #define NCE_CANNOT_MOVE_ROTARY_AXES_WITH_G76 _("Cannot move rotary axes with G76") #define NCE_MULTIPLE_E_WORDS_ON_ONE_LINE _("Multiple e words on one line") -#define NCE_E_WORD_WITH_NO_G76_OR_M66_TO_USE_IT _("E word with no G76 or M66 to use it") #define NCE_NAMED_PARAMETER_NOT_TERMINATED _("Named parameter not terminated") #define NCE_NAMED_OWORD_NOT_TERMINATED _("Named oword not terminated") #define NCE_NAMED_OWORD_NOT_DEFINED _("Named oword not defined") |