On March 12, 2017 5:31:42 AM MDT, MH <mhemc2nos...@googlemail.com> wrote: > >Hello, > >I have a question about the behaviour of the halui bit pins and would >like to confirm that I understand the code correctly. I could not >answer >my question from the halui documentation. > >Do these pins activate on both a rising and a falling edge ? > >It like to use the input pin halui.program.pause to pause a running >program if I get a signal that might indicate that the material sheet >*might* have moved and the operator needs to check. > >Having a cursory look at the linuxcnc source code I suspect the halui >pins come from linuxcnc-dev/src/emc/usr_intf/halui.cc > >And in halui.cc these line (with lines numbers): > > 1114 static int sendProgramPause() > 1115 { > 1116 EMC_TASK_PLAN_PAUSE emc_task_plan_pause_msg; > 1117 > 1118 return emcCommandSend(emc_task_plan_pause_msg); > >... > > 1544 static int check_bit_changed(bool halpin, bool &newpin) > 1545 { > 1546 if (halpin != newpin) { > 1547 newpin = halpin; > 1548 return halpin; > 1549 } > 1550 return 0; > 1551 } > >... > > 1654 if (check_bit_changed(new_halui_data.program_pause, >old_halui_data.program_pause) != 0) > 1655 sendProgramPause(); > >That line 1654 looks to me as if both edges would trigger the msg >emc_task_plan_pause_msg to be send. > >Is that correct ?
Almost. Look at line 1548, if the pin has switched state it turns the new state. So that function returns True on a positive edge, only. I notice now that the names of the variables inside the function are the opposite of what it seems they should be, that's confusing... -- Sebastian Kuzminsky ------------------------------------------------------------------------------ Announcing the Oxford Dictionaries API! The API offers world-renowned dictionary content that is easy and intuitive to access. Sign up for an account today to start using our lexical data to power your apps and projects. Get started today and enter our developer competition. http://sdm.link/oxford _______________________________________________ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users