diff --git a/src/emc/rs274ngc/interp_check.cc b/src/emc/rs274ngc/interp_check.cc index 8ecd8666e7d..49c692e4aaf 100644 --- a/src/emc/rs274ngc/interp_check.cc +++ b/src/emc/rs274ngc/interp_check.cc @@ -239,7 +239,7 @@ int Interp::check_other_codes(block_pointer block) //!< pointer to a block return INTERP_OK; } // bypass ALL checks, argspec takes care of that - if (has_user_mcode(&(_setup),block)) { + if (is_any_m_code_remapped(block, &(_setup))) { return INTERP_OK; } if (block->a_flag) { diff --git a/src/emc/rs274ngc/interp_remap.cc b/src/emc/rs274ngc/interp_remap.cc index fc7b41d62ca..947fac5cfcd 100644 --- a/src/emc/rs274ngc/interp_remap.cc +++ b/src/emc/rs274ngc/interp_remap.cc @@ -54,14 +54,12 @@ bool Interp::is_m_code_remappable(int m_code) m_code == 68); } -bool Interp::has_user_mcode(setup_pointer settings,block_pointer block) +bool Interp::is_any_m_code_remapped(block_pointer block, setup_pointer settings) { - unsigned i; - for(i = 0; i < sizeof(block->m_modes)/sizeof(int); i++) { - if (block->m_modes[i] == -1) - continue; - if (is_m_code_remappable(block->m_modes[i]) && - settings->m_remapped[block->m_modes[i]]) + for (const int m_mode : block->m_modes) { + if (m_mode == -1) + continue; + if (is_m_code_remappable(m_mode) && settings->m_remapped[m_mode]) return true; } return false; diff --git a/src/emc/rs274ngc/rs274ngc_interp.hh b/src/emc/rs274ngc/rs274ngc_interp.hh index 0e3a45d33d7..d5e1e9614bb 100644 --- a/src/emc/rs274ngc/rs274ngc_interp.hh +++ b/src/emc/rs274ngc/rs274ngc_interp.hh @@ -609,8 +609,6 @@ int read_inputs(setup_pointer settings); int init_named_parameters(); int init_python_predef_parameter(const char *name); - bool has_user_mcode(setup_pointer settings,block_pointer block); - bool remap_in_progress(const char *code); int convert_remapped_code(block_pointer block, setup_pointer settings, @@ -682,9 +680,10 @@ int read_inputs(setup_pointer settings); private: [[nodiscard]] static bool is_parameter_readonly(int index); - [[nodiscard]] static bool is_m_code_remappable(int m_code); + [[nodiscard]] static bool is_any_m_code_remapped(block_pointer block, setup_pointer settings); [[nodiscard]] static bool is_user_defined_m_code(block_pointer block, setup_pointer settings, int m_group); + [[nodiscard]] static bool is_m_code_remappable(int m_code); [[nodiscard]] static bool is_g_code_remappable(int g_code); [[nodiscard]] bool is_user_defined_g_code(int g_code);