WIP
This commit is contained in:
@@ -39,6 +39,8 @@ volatile uint8_t sys_rt_exec_accessory_override; // Global realtime executor bit
|
||||
volatile uint8_t sys_rt_exec_debug;
|
||||
#endif
|
||||
|
||||
int enableDebugPrintouts = 0;
|
||||
|
||||
// Start worker for socket read()
|
||||
void f_worker_read(void *obj) {
|
||||
if(!obj) {
|
||||
@@ -122,6 +124,10 @@ ecmcGrbl::ecmcGrbl(char* configStr,
|
||||
if(!cfgAutoEnableAtStart_) {
|
||||
autoEnableExecuted_ = 1;
|
||||
}
|
||||
|
||||
// global varaible in grbl
|
||||
enableDebugPrintouts = cfgDbgMode_;
|
||||
|
||||
//Check atleast one valid axis
|
||||
if(cfgXAxisId_<0 && cfgXAxisId_<0 && cfgXAxisId_<0 && cfgSpindleAxisId_<0) {
|
||||
throw std::out_of_range("No valid axis choosen.");
|
||||
|
||||
@@ -60,7 +60,14 @@
|
||||
#include "grbl_serial.h"
|
||||
#include "grbl_spindle_control.h"
|
||||
#include "grbl_stepper.h"
|
||||
#include "grbl_jog.h"
|
||||
#include "grbl_jog.h"
|
||||
|
||||
#define PRINTF_DEBUG(str) \
|
||||
{ \
|
||||
if (enableDebugPrintouts) { \
|
||||
printf("%s:%s:%d:%s\n",__FILE__,__FUNCTION__,__LINE__,str); \
|
||||
} \
|
||||
} \
|
||||
|
||||
// ---------------------------------------------------------------------------------------
|
||||
// COMPILE-TIME ERROR CHECKING OF DEFINE VALUES:
|
||||
|
||||
@@ -41,7 +41,7 @@ parser_block_t gc_block;
|
||||
|
||||
void gc_init()
|
||||
{
|
||||
printf("%s:%s:%d:\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
PRINTF_DEBUG("");
|
||||
|
||||
memset(&gc_state, 0, sizeof(parser_state_t));
|
||||
|
||||
@@ -56,7 +56,7 @@ void gc_init()
|
||||
// limit pull-off routines.
|
||||
void gc_sync_position()
|
||||
{
|
||||
printf("%s:%s:%d:\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
PRINTF_DEBUG("");
|
||||
system_convert_array_steps_to_mpos(gc_state.position,sys_position);
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ void gc_sync_position()
|
||||
// coordinates, respectively.
|
||||
uint8_t gc_execute_line(char *line)
|
||||
{
|
||||
printf("%s:%s:%d:%s\n",__FILE__,__FUNCTION__,__LINE__,line);
|
||||
PRINTF_DEBUG("");
|
||||
|
||||
/* -------------------------------------------------------------------------------------
|
||||
STEP 1: Initialize parser block struct and copy current g-code state modes. The parser
|
||||
@@ -345,7 +345,7 @@ uint8_t gc_execute_line(char *line)
|
||||
value_words |= bit(word_bit); // Flag to indicate parameter assigned.
|
||||
|
||||
}
|
||||
//printf("%s:%s:%d:\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
//PRINTF_DEBUG("");
|
||||
}
|
||||
// Parsing complete!
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
// in the planner and to let backlash compensation or canned cycle integration simple and direct.
|
||||
void mc_line(float *target, plan_line_data_t *pl_data)
|
||||
{
|
||||
printf("%s:%s:%d\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
PRINTF_DEBUG("");
|
||||
|
||||
// If enabled, check for soft limit violations. Placed here all line motions are picked up
|
||||
// from everywhere in Grbl.
|
||||
@@ -88,7 +88,7 @@ void mc_line(float *target, plan_line_data_t *pl_data)
|
||||
void mc_arc(float *target, plan_line_data_t *pl_data, float *position, float *offset, float radius,
|
||||
uint8_t axis_0, uint8_t axis_1, uint8_t axis_linear, uint8_t is_clockwise_arc)
|
||||
{
|
||||
printf("%s:%s:%d\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
PRINTF_DEBUG("");
|
||||
|
||||
float center_axis0 = position[axis_0] + offset[axis_0];
|
||||
float center_axis1 = position[axis_1] + offset[axis_1];
|
||||
@@ -197,7 +197,7 @@ void mc_arc(float *target, plan_line_data_t *pl_data, float *position, float *of
|
||||
// Execute dwell in seconds.
|
||||
void mc_dwell(float seconds)
|
||||
{
|
||||
printf("%s:%s:%d\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
PRINTF_DEBUG("");
|
||||
|
||||
if (sys.state == STATE_CHECK_MODE) { return; }
|
||||
protocol_buffer_synchronize();
|
||||
@@ -333,7 +333,7 @@ uint8_t mc_probe_cycle(float *target, plan_line_data_t *pl_data, uint8_t parser_
|
||||
#ifdef PARKING_ENABLE
|
||||
void mc_parking_motion(float *parking_target, plan_line_data_t *pl_data)
|
||||
{
|
||||
printf("%s:%s:%d\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
PRINTF_DEBUG("");
|
||||
|
||||
if (sys.abort) { return; } // Block during abort.
|
||||
|
||||
@@ -362,7 +362,7 @@ uint8_t mc_probe_cycle(float *target, plan_line_data_t *pl_data, uint8_t parser_
|
||||
#ifdef ENABLE_PARKING_OVERRIDE_CONTROL
|
||||
void mc_override_ctrl_update(uint8_t override_state)
|
||||
{
|
||||
printf("%s:%s:%d\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
PRINTF_DEBUG("");
|
||||
|
||||
// Finish all queued commands before altering override control state
|
||||
protocol_buffer_synchronize();
|
||||
@@ -379,7 +379,7 @@ uint8_t mc_probe_cycle(float *target, plan_line_data_t *pl_data, uint8_t parser_
|
||||
// realtime abort command and hard limits. So, keep to a minimum.
|
||||
void mc_reset()
|
||||
{
|
||||
printf("%s:%s:%d\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
PRINTF_DEBUG("");
|
||||
|
||||
// Only this function can set the system reset. Helps prevent multiple kill calls.
|
||||
if (bit_isfalse(sys_rt_exec_state, EXEC_RESET)) {
|
||||
|
||||
@@ -37,7 +37,7 @@ static void protocol_exec_rt_suspend();
|
||||
*/
|
||||
void protocol_main_loop()
|
||||
{
|
||||
printf("%s:%s:%d\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
PRINTF_DEBUG("");
|
||||
|
||||
// Perform some machine checks to make sure everything is good to go.
|
||||
#ifdef CHECK_LIMITS_AT_INIT
|
||||
|
||||
@@ -216,8 +216,10 @@ void ecmc_write_command_serial(char* line) {
|
||||
ecmc_add_char_to_buffer(line[i]);
|
||||
}
|
||||
ecmc_add_char_to_buffer('\n');
|
||||
printf("Added: %s",line);
|
||||
printf("to buffer: %s\n",serial_rx_buffer);
|
||||
if(enableDebugPrintouts) {
|
||||
printf("Added: %s",line);
|
||||
printf("to buffer: %s\n",serial_rx_buffer);
|
||||
}
|
||||
free(line);
|
||||
}
|
||||
|
||||
|
||||
@@ -227,7 +227,7 @@ static bool stepperInterruptEnable = 0;
|
||||
void st_wake_up()
|
||||
{
|
||||
|
||||
printf("%s:%s:%d\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
PRINTF_DEBUG("");
|
||||
// Enable stepper drivers.
|
||||
//if (bit_istrue(settings.flags,BITFLAG_INVERT_ST_ENABLE)) { STEPPERS_DISABLE_PORT |= (1<<STEPPERS_DISABLE_BIT); }
|
||||
//else { STEPPERS_DISABLE_PORT &= ~(1<<STEPPERS_DISABLE_BIT); }
|
||||
@@ -258,7 +258,7 @@ void st_wake_up()
|
||||
// Stepper shutdown
|
||||
void st_go_idle()
|
||||
{
|
||||
printf("%s:%s:%d\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
PRINTF_DEBUG("");
|
||||
|
||||
stepperInterruptEnable = 0;
|
||||
|
||||
@@ -334,7 +334,7 @@ void st_go_idle()
|
||||
// returns exe_time_rate_ms (need to downsample to ecmc rate)
|
||||
double ecmc_grbl_main_rt_thread()
|
||||
{
|
||||
//printf("%s:%s:%d\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
//PRINTF_DEBUG("");
|
||||
|
||||
if (busy || !stepperInterruptEnable) { return -1.0; } // The busy-flag is used to avoid reentering this interrupt
|
||||
|
||||
@@ -549,7 +549,7 @@ double ecmc_grbl_main_rt_thread()
|
||||
// Generates the step and direction port invert masks used in the Stepper Interrupt Driver.
|
||||
void st_generate_step_dir_invert_masks()
|
||||
{
|
||||
printf("%s:%s:%d\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
PRINTF_DEBUG("");
|
||||
|
||||
uint8_t idx;
|
||||
step_port_invert_mask = 0;
|
||||
@@ -571,7 +571,7 @@ void st_generate_step_dir_invert_masks()
|
||||
// Reset and clear stepper subsystem variables
|
||||
void st_reset()
|
||||
{
|
||||
printf("%s:%s:%d\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
PRINTF_DEBUG("");
|
||||
|
||||
// Initialize stepper driver idle state.
|
||||
st_go_idle();
|
||||
@@ -604,7 +604,7 @@ void st_reset()
|
||||
// Initialize and start the stepper motor subsystem
|
||||
void stepper_init()
|
||||
{
|
||||
printf("%s:%s:%d\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
PRINTF_DEBUG("");
|
||||
|
||||
// Configure step and direction interface pins
|
||||
// STEP_DDR |= STEP_MASK;
|
||||
@@ -638,7 +638,7 @@ void stepper_init()
|
||||
// Called by planner_recalculate() when the executing block is updated by the new plan.
|
||||
void st_update_plan_block_parameters()
|
||||
{
|
||||
printf("%s:%s:%d\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
PRINTF_DEBUG("");
|
||||
|
||||
if (pl_block != NULL) { // Ignore if at start of a new block.
|
||||
prep.recalculate_flag |= PREP_FLAG_RECALCULATE;
|
||||
@@ -651,7 +651,7 @@ void st_update_plan_block_parameters()
|
||||
// Increments the step segment buffer block data ring buffer.
|
||||
static uint8_t st_next_block_index(uint8_t block_index)
|
||||
{
|
||||
printf("%s:%s:%d\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
PRINTF_DEBUG("");
|
||||
|
||||
block_index++;
|
||||
if ( block_index == (SEGMENT_BUFFER_SIZE-1) ) { return(0); }
|
||||
@@ -712,7 +712,7 @@ static uint8_t st_next_block_index(uint8_t block_index)
|
||||
*/
|
||||
void st_prep_buffer()
|
||||
{
|
||||
//printf("%s:%s:%d\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
//PRINTF_DEBUG("");
|
||||
|
||||
// Block step prep buffer, while in a suspend state and there is no suspend motion to execute.
|
||||
if (bit_istrue(sys.step_control,STEP_CONTROL_END_MOTION)) { return; }
|
||||
@@ -1143,7 +1143,7 @@ void st_prep_buffer()
|
||||
// divided by the ACCELERATION TICKS PER SECOND in seconds.
|
||||
float st_get_realtime_rate()
|
||||
{
|
||||
printf("%s:%s:%d\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
PRINTF_DEBUG("");
|
||||
|
||||
if (sys.state & (STATE_CYCLE | STATE_HOMING | STATE_HOLD | STATE_JOG | STATE_SAFETY_DOOR)){
|
||||
return prep.current_speed;
|
||||
|
||||
@@ -151,6 +151,7 @@ typedef struct {
|
||||
extern system_t sys;
|
||||
|
||||
// NOTE: These position variables may need to be declared as volatiles, if problems arise.
|
||||
extern int enableDebugPrintouts;
|
||||
extern int32_t sys_position[N_AXIS]; // Real-time machine (aka home) position vector in steps.
|
||||
extern int32_t sys_probe_position[N_AXIS]; // Last probe position in machine coordinates and steps.
|
||||
|
||||
|
||||
3139
iocsh/log.log
3139
iocsh/log.log
File diff suppressed because it is too large
Load Diff
@@ -59,7 +59,7 @@ epicsEnvSet("PLUGIN_VER" ,"develop")
|
||||
require ecmc_plugin_grbl $(PLUGIN_VER)
|
||||
|
||||
epicsEnvSet(ECMC_PLUGIN_FILNAME,"/home/pi/epics/base-7.0.5/require/${E3_REQUIRE_VERSION}/siteMods/ecmc_plugin_grbl/$(PLUGIN_VER)/lib/${EPICS_HOST_ARCH=linux-x86_64}/libecmc_plugin_grbl.so")
|
||||
epicsEnvSet(ECMC_PLUGIN_CONFIG,"DBG_PRINT=1;X_AXIS=1;Y_AXIS=2;AUTO_ENABLE=1;") # Only one option implemented in this plugin
|
||||
epicsEnvSet(ECMC_PLUGIN_CONFIG,"DBG_PRINT=0;X_AXIS=1;Y_AXIS=2;AUTO_ENABLE=1;") # Only one option implemented in this plugin
|
||||
${SCRIPTEXEC} ${ecmccfg_DIR}loadPlugin.cmd, "PLUGIN_ID=0,FILE=${ECMC_PLUGIN_FILNAME},CONFIG='${ECMC_PLUGIN_CONFIG}', REPORT=1"
|
||||
epicsEnvUnset(ECMC_PLUGIN_FILNAME)
|
||||
epicsEnvUnset(ECMC_PLUGIN_CONFIG)
|
||||
@@ -67,23 +67,23 @@ epicsEnvUnset(ECMC_PLUGIN_CONFIG)
|
||||
ecmcGrblAddCommand("G1X20Y20F180");
|
||||
ecmcGrblAddCommand("G4P1");
|
||||
ecmcGrblAddCommand("G2X0Y0R20");
|
||||
//ecmcGrblAddCommand("G0X10Y10");
|
||||
//ecmcGrblAddCommand("G4P1");
|
||||
//ecmcGrblAddCommand("G1X10Y0F360");
|
||||
//ecmcGrblAddCommand("G4P1");
|
||||
//ecmcGrblAddCommand("G1X50Y50F180");
|
||||
//ecmcGrblAddCommand("G4P1");
|
||||
//ecmcGrblAddCommand("G1X0Y0F360");
|
||||
//ecmcGrblAddCommand("G1X20Y20F180");
|
||||
//ecmcGrblAddCommand("G4P1");
|
||||
//ecmcGrblAddCommand("G2X0Y0R20");
|
||||
//ecmcGrblAddCommand("G0X10Y10");
|
||||
//ecmcGrblAddCommand("G4P1");
|
||||
//ecmcGrblAddCommand("G1X10Y0F360");
|
||||
//ecmcGrblAddCommand("G4P1");
|
||||
//ecmcGrblAddCommand("G1X50Y50F180");
|
||||
//ecmcGrblAddCommand("G4P1");
|
||||
//ecmcGrblAddCommand("G1X0Y0F360");
|
||||
ecmcGrblAddCommand("G0X10Y10");
|
||||
ecmcGrblAddCommand("G4P1");
|
||||
ecmcGrblAddCommand("G1X10Y0F360");
|
||||
ecmcGrblAddCommand("G4P1");
|
||||
ecmcGrblAddCommand("G1X50Y50F180");
|
||||
ecmcGrblAddCommand("G4P1");
|
||||
ecmcGrblAddCommand("G1X0Y0F360");
|
||||
ecmcGrblAddCommand("G1X20Y20F180");
|
||||
ecmcGrblAddCommand("G4P1");
|
||||
ecmcGrblAddCommand("G2X0Y0R20");
|
||||
ecmcGrblAddCommand("G0X10Y10");
|
||||
ecmcGrblAddCommand("G4P1");
|
||||
ecmcGrblAddCommand("G1X10Y0F360");
|
||||
ecmcGrblAddCommand("G4P1");
|
||||
ecmcGrblAddCommand("G1X50Y50F180");
|
||||
ecmcGrblAddCommand("G4P1");
|
||||
ecmcGrblAddCommand("G1X0Y0F360");
|
||||
//ecmcGrblAddCommand("G1X20Y20F180");
|
||||
//ecmcGrblAddCommand("G4P1");
|
||||
//ecmcGrblAddCommand("G2X0Y0R20");
|
||||
@@ -201,9 +201,7 @@ ecmcConfigOrDie "Cfg.SetDiagAxisEnable(0)"
|
||||
|
||||
$(SCRIPTEXEC) ($(ecmccfg_DIR)setAppMode.cmd)
|
||||
|
||||
asynSetTraceMask(MC_CPU1, -1, 0)
|
||||
asynSetTraceIOMask(MC_CPU1, -1, 0)
|
||||
asynSetTraceInfoMask(MC_CPU1, -1, 0)
|
||||
asynSetTraceMask(MC_CPU1, -1, 0x41)
|
||||
iocInit()
|
||||
|
||||
dbpf $(IOC):Axis1.SPAM 0
|
||||
|
||||
Reference in New Issue
Block a user