![]() |
LinuxCNC PoKeysLib-Comp
unofficial PoKeys HAL-Component for LinuxCNC
|
The LinuxCnc_PokeysLibComp project integrates PoKeys devices with LinuxCNC, providing control and monitoring capabilities. This repository contains the necessary components, scripts, and documentation to set up and use PoKeys devices with LinuxCNC.
The repository is organized into the following directories:
pokeys_uspace/
: Contains Source of pokeys userspace component for interfacing with PoKeys devices.pokeys_py/
: prepared for Contains Python scripts for interfacing with PoKeys devices.pokeys_rt/
: Contains Source of pokeys_homecomp real-time component for PoKeys devices.tests/
: Contains unit tests, integration tests, and other testing-related files.docs/
: Contains project-related documentation.scripts/
: Contains scripts for setup, configuration, and auxiliary tasks.To install the LinuxCnc_PokeysLibComp project, follow these steps:
The project has been tested with the following hardware:
The following features have been implemented and tested:
x ... available i ... implemented but not tested ! ... implemented but not working yet p ... planned e ... known issue
changing structure of IOs to "Canonical Device Interface" in work
Count: 55
the PinFunction can be set using followin enumeration. Note that e.g. digitalInput or digitalOutput could be directly inverted on pokeys by adding value 128 (PK_PinCap_digitalOutput+PK_PinCap_invertPin or 2 + 128 = 130):
add. Note: for PK_PinCap_analogOutput has not been used so far currently only PWM functionality has been used instead that is what is being used for (pins 18, 20, 21 and 22)
Count: 55
pokeys.[DevID].digin.[PinID].invert
bit invert Pin on pokeys using PK_PinCap_invertPin on PinFunctionCount: 55
pokeys.[DevID].digout.[PinID].out
bit Value to be written (possibly inverted) to the hardware outputpokeys.[DevID].digout.[PinID].invert
bit invert Pin on pokeys using PK_PinCap_invertPin on PinFunctionCount: 7
pokeys.[DevID].adcin.[AdcId].value-raw
float The hardware readingpokeys.[DevID].adcin.[AdcId].value
float The hardware reading, scaled according to the scale and offset parameterspokeys.[DevID].adcin.[AdcId].scale
float The input voltage (or current) will be multiplied by scale before being output to valuepokeys.[DevID].adcin.[AdcId].offset
float This will be subtracted from the hardware input voltage (or current) after the scale multiplier has been appliedCount: 6
pokeys.[DevID].adcout.[AdcId].value
: The value to be written. The actual value output to the hardware will depend on the scale and offset parameterspokeys.[DevID].adcout.[AdcId].enable
: If false, then output 0 to the hardware, regardless of the value pinpokeys.[DevID].adcout.[AdcId].offset
: This will be added to the value before the hardware is updatedpokeys.[DevID].adcout.[AdcId].scale
: This should be set so that an input of 1 on the value pin will cause 1Vpokeys.[DevID].adcout.[AdcId].high_limit
: When calculating the value to output to the hardware, if value + offset is greater than high_limit, then high_limit will be used insteadpokeys.[DevID].adcout.[AdcId].low_limit
: When calculating the value to output to the hardware, if value + offset is less than low_limit, then low_limit will be used insteadpokeys.[DevID].adcout.[AdcId].max_v
: Max output voltagepokeys.[DevID].adcout.pwm.period
: PWM period, shared among all channelsCount: 29
pokeys.[DevID].rtc.sec
: Secondpokeys.[DevID].rtc.min
: Minutepokeys.[DevID].rtc.hour
: Hourpokeys.[DevID].rtc.dow
: Day of weekpokeys.[DevID].rtc.dom
: Day of monthpokeys.[DevID].rtc.doy
: Day of yearpokeys.[DevID].rtc.month
: Monthpokeys.[DevID].rtc.year
: Yearpokeys.[DevID].rtc.loop_frequ
: Actual loop frequency of pokeys.comp updated after rtc.sec changedpokeys.[DevID].rtc.loop_frequ_demand
: Demand value for loop frequency (if 0, default of 10Hz will be used)This section provides access to external Relay and Open-Collector (OC) outputs available on PoKeys devices that support Pulse Engine v2 (PEv2).
The following HAL output pins are exposed by the component:
pokeys.[DevID].PEv2.digout.ExternalRelay-0.out pokeys.[DevID].PEv2.digout.ExternalRelay-1.out pokeys.[DevID].PEv2.digout.ExternalRelay-2.out pokeys.[DevID].PEv2.digout.ExternalRelay-3.out
pokeys.[DevID].PEv2.digout.ExternalOC-0.out pokeys.[DevID].PEv2.digout.ExternalOC-1.out pokeys.[DevID].PEv2.digout.ExternalOC-2.out pokeys.[DevID].PEv2.digout.ExternalOC-3.out
These pins correspond to the checkboxes shown in the Aux. outputs section of the PoKeys configuration utility:
UI Label | HAL Pin | PoKeys57CNC | PoKeys57CNCpro4x25 | PoKeysCNCaddon |
---|---|---|---|---|
0 | pokeys.[DevID].PEv2.digout.ExternalRelay-0.out | SSR1 | FAN Control | Relay1 |
1 | pokeys.[DevID].PEv2.digout.ExternalRelay-1.out | SSR2 | Plasma Relay | Relay2 |
2 | pokeys.[DevID].PEv2.digout.ExternalRelay-2.out | Relay1 | Relay1 | Relay3 |
3 | pokeys.[DevID].PEv2.digout.ExternalRelay-3.out | Relay2 | Relay2 | Relay4 |
UI Label | HAL Pin | PoKeys57CNC | PoKeys57CNCpro4x25 | PoKeysCNCaddon |
---|---|---|---|---|
0 | pokeys.[DevID].PEv2.digout.ExternalOC-0.out | OC1 | OC1 | OC1 |
1 | pokeys.[DevID].PEv2.digout.ExternalOC-1.out | OC2 | OC2 | OC2 |
2 | pokeys.[DevID].PEv2.digout.ExternalOC-2.out | OC3 | OC3 | OC3 |
3 | pokeys.[DevID].PEv2.digout.ExternalOC-3.out | OC4 | OC4 | OC4 |
ℹ️ Note: These mappings are automatically applied at runtime based on the detected device type. You don't need to change your HAL file — the component ensures correct hardware control behind the scenes.
You can assign a logical signal to control a relay like this:
The documentation provides clear instructions on running tests, setup steps for hardware-dependent tests, and interpreting test results and coverage reports. It is essential to keep the documentation up to date as new features are implemented and tests are added.
By following these instructions, you can ensure the reliability, correctness, and performance of the pokeys_py
component, making it easier to maintain and develop in the future.
We welcome contributions from the community to help improve the project. Please take a moment to review the CONTRIBUTING.md file for guidelines on how to contribute.
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.
To keep the repository organized, please follow these branch naming conventions:
feature/{feature-name}
bugfix/{bug-name}
improvement/{improvement-name}
hotfix/{hotfix-name}
Each new feature or bug fix should have its own branch created from the latest version of the main branch. The branch should focus on one feature or issue to ensure isolated development.
This repository aligns with LinuxCNC’s development practices and canonical interfaces. The components have been reviewed and updated to follow LinuxCNC coding guidelines, ensuring that HAL and INI files conform to LinuxCNC’s structure and formatting. Real-time components comply with LinuxCNC’s real-time constraints, and all components follow the canonical interface definitions. The code adheres to LinuxCNC's code style and formatting guidelines, and test cases have been created and run to validate conformity.
We encourage the use of GitHub Discussions for questions, feature requests, and ideas before creating issues or pull requests. This helps keep the issue tracker focused on actionable items and fosters community engagement.
We have created the following categories in GitHub Discussions to help organize conversations:
When starting a discussion, please follow these guidelines:
Use GitHub Discussions for:
By using GitHub Discussions effectively, we can build a stronger community around the project and make the repository more welcoming to both new and experienced users.
You can access the GitHub Discussions for this repository here.
We appreciate your interest in supporting the LinuxCnc_PokeysLibComp project! Your sponsorship helps us continue to develop and maintain this project. Here are some ways you can sponsor us:
For more detailed information on sponsorship tiers and benefits, as well as instructions on how to sponsor through GitHub Sponsors and PayPal, please refer to our Sponsorship Page.
Thank you for your support!