Skip to content

Commit

Permalink
minor modifications to laser and plasma loading
Browse files Browse the repository at this point in the history
  • Loading branch information
Paciente8159 committed Aug 4, 2023
1 parent 530f108 commit 4b922c6
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 27 deletions.
19 changes: 11 additions & 8 deletions uCNC/src/hal/tools/tools/laser_ppi.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ bool laser_ppi_mcodes_exec(void *args)
*(ptr->error) = STATUS_GCODE_VALUE_WORD_MISSING;
return EVENT_HANDLED;
}

*(ptr->error) = STATUS_OK;
break;
}
Expand Down Expand Up @@ -230,6 +230,16 @@ bool laser_ppi_mcodes_exec(void *args)
CREATE_EVENT_LISTENER(gcode_exec, laser_ppi_mcodes_exec);
#endif

DECL_MODULE(laser_ppi)
{
#ifdef ENABLE_PARSER_MODULES
ADD_EVENT_LISTENER(gcode_parse, laser_ppi_mcodes_parse);
ADD_EVENT_LISTENER(gcode_exec, laser_ppi_mcodes_exec);
#else
#warning "Parser extensions are not enabled. M126, M127 and M128 code extensions will not work."
#endif
}

/**
* Now starts the actual tool functions definitions
* These functions will then be called by the tool HAL
Expand All @@ -248,13 +258,6 @@ static void startup_code(void)
g_settings.laser_mode |= LASER_PPI_MODE;
laser_ppi_config_parameters();
HOOK_ATTACH_CALLBACK(itp_rt_stepbits, laser_ppi_pulse);

RUNONCE
{
ADD_EVENT_LISTENER(gcode_parse, laser_ppi_mcodes_parse);
ADD_EVENT_LISTENER(gcode_exec, laser_ppi_mcodes_exec);
RUNONCE_COMPLETE();
}
}

static void shutdown_code(void)
Expand Down
31 changes: 12 additions & 19 deletions uCNC/src/hal/tools/tools/plasma_thc.c
Original file line number Diff line number Diff line change
Expand Up @@ -426,17 +426,6 @@ static void pid_update(void)
}
}

DECL_MODULE(plasma_thc)
{
#ifdef ENABLE_PARSER_MODULES
ADD_EVENT_LISTENER(gcode_parse, m103_parse);
ADD_EVENT_LISTENER(gcode_exec, m103_exec);
ADD_EVENT_LISTENER(gcode_exec, plasma_virtual_pins);
#else
#error "Parser extensions are not enabled. M103 code extension will not work."
#endif
}

// uses similar status to grblhal
bool plasma_protocol_send_status(void *args)
{
Expand Down Expand Up @@ -485,20 +474,24 @@ bool plasma_protocol_send_status(void *args)

CREATE_EVENT_LISTENER(protocol_send_status, plasma_protocol_send_status);

static void startup_code(void)
DECL_MODULE(plasma_thc)
{
static bool run_once = false;
ADD_EVENT_LISTENER(protocol_send_status, plasma_protocol_send_status);
#ifdef ENABLE_PARSER_MODULES
ADD_EVENT_LISTENER(gcode_parse, m103_parse);
ADD_EVENT_LISTENER(gcode_exec, m103_exec);
ADD_EVENT_LISTENER(gcode_exec, plasma_virtual_pins);
#else
#error "Parser extensions are not enabled. M103 code extension will not work."
#endif
}

static void startup_code(void)
{
// force plasma off
#if ASSERT_PIN(PLASMA_ON_OUTPUT)
io_clear_output(PLASMA_ON_OUTPUT);
#endif

if (!run_once)
{
ADD_EVENT_LISTENER(protocol_send_status, plasma_protocol_send_status);
run_once = true;
}
}

static void shutdown_code(void)
Expand Down
4 changes: 4 additions & 0 deletions uCNC/src/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ void mod_init(void)
LOAD_MODULE(tmcdriver);
#endif

#ifdef ENABLE_LASER_PPI
LOAD_MODULE(laser_ppi);
#endif

#ifdef ENABLE_PLASMA_THC
LOAD_MODULE(plasma_thc);
#endif
Expand Down

0 comments on commit 4b922c6

Please sign in to comment.