@@ -86,6 +86,8 @@ static int axis_mask = 0;
8686 FIELD(hal_bit_t ,program_is_running) /* pin for notifying user that program is running */ \
8787 FIELD(hal_bit_t ,halui_mdi_is_running) /* pin for notifying user that halui MDI commands is running */ \
8888 FIELD(hal_bit_t ,program_is_paused) /* pin for notifying user that program is paused */ \
89+ FIELD(hal_bit_t ,cycle_start) /* pin for running program */ \
90+ FIELD(hal_bit_t ,cycle_pause) /* pin for running program */ \
8991 FIELD(hal_bit_t ,program_run) /* pin for running program */ \
9092 FIELD(hal_bit_t ,program_pause) /* pin for pausing program */ \
9193 FIELD(hal_bit_t ,program_resume) /* pin for resuming program */ \
@@ -555,6 +557,36 @@ int halui_export_pin_OUT_bit(hal_bit_t **pin, const char *name)
555557 return 0 ;
556558}
557559
560+ static void py_call_cycleStart () {
561+
562+ // check socket messages for jogspeed
563+ pFuncWrite = PyObject_GetAttrString (pInstance, " cycleStart" );
564+ if (pFuncRead && PyCallable_Check (pFuncWrite)) {
565+ pValue = PyObject_CallNoArgs (pFuncWrite);
566+ if (pValue == NULL ){
567+ fprintf (stderr, " Halui Bridge: cycleStart function failed: returned NULL\n " );
568+ }
569+ Py_DECREF (pValue);
570+ }
571+ Py_DECREF (pFuncWrite);
572+ return ;
573+ }
574+
575+ static void py_call_cyclePause () {
576+
577+ // check socket messages for jogspeed
578+ pFuncWrite = PyObject_GetAttrString (pInstance, " cyclePause" );
579+ if (pFuncRead && PyCallable_Check (pFuncWrite)) {
580+ pValue = PyObject_CallNoArgs (pFuncWrite);
581+ if (pValue == NULL ){
582+ fprintf (stderr, " Halui Bridge: cyclePause function failed: returned NULL\n " );
583+ }
584+ Py_DECREF (pValue);
585+ }
586+ Py_DECREF (pFuncWrite);
587+ return ;
588+ }
589+
558590static int py_call_get_mdi_count () {
559591 int value = 0 ;
560592 // check socket messages for jogspeed
@@ -846,6 +878,10 @@ int halui_hal_init(void)
846878 if (retval < 0 ) return retval;
847879 retval = halui_export_pin_IN_bit (&(halui_data->flood_off ), " halui.flood.off" );
848880 if (retval < 0 ) return retval;
881+ retval = halui_export_pin_IN_bit (&(halui_data->cycle_start ), " halui.cycle.start" );
882+ if (retval < 0 ) return retval;
883+ retval = halui_export_pin_IN_bit (&(halui_data->cycle_pause ), " halui.cycle.pause" );
884+ if (retval < 0 ) return retval;
849885 retval = halui_export_pin_IN_bit (&(halui_data->program_run ), " halui.program.run" );
850886 if (retval < 0 ) return retval;
851887 retval = halui_export_pin_IN_bit (&(halui_data->program_pause ), " halui.program.pause" );
@@ -1975,6 +2011,16 @@ static void check_hal_changes()
19752011 if (check_bit_changed (new_halui_data.flood_off , old_halui_data.flood_off ) != 0 )
19762012 sendFloodOff ();
19772013
2014+ if (check_bit_changed (new_halui_data.cycle_start , old_halui_data.cycle_start ) != 0 ){
2015+ fprintf (stderr, " cycle-start value = %i\n " , new_halui_data.cycle_start );
2016+ py_call_cycleStart ();
2017+ }
2018+
2019+ if (check_bit_changed (new_halui_data.cycle_pause , old_halui_data.cycle_pause ) != 0 ){
2020+ fprintf (stderr, " cycle-pause value = %i\n " , new_halui_data.cycle_pause );
2021+ py_call_cyclePause ();
2022+ }
2023+
19782024 if (check_bit_changed (new_halui_data.program_run , old_halui_data.program_run ) != 0 )
19792025 sendProgramRun (0 );
19802026
0 commit comments