Comments (6)
I thought perhaps there was something unique in the bool situation that I wasn't familiar with but I have cconfirmed that none of the pairs of true/false, 1/0 or On/Off work. Yes, I know they should all evaluate to being equivalent, just trying to poke it to see if I could get a different result.
Are there setup steps required before the ports are available via the HAL commands?
from core.
Poked around a bit more. I had originally been testing in my new module but moved the testing to the coolant control function so I could use M7 and M9 to trigger the event. I noticed I hadn't included driver.h in the coolant_control.c, so I added that and I can see that Output_Aux0 evaluates to "82". However, the result is the same. The command hangs the system.
I am manually setting the pin the output before running the command, until I can confirm the init occurs elsewhere.
In driver.c I can see that .pin = AUXOUTPUT0_PIN correctly resolves to the pin I expect it to (derived from my_machine_map.h).
from core.
Looking at the syntax in fan.c I thought this should work:
hal.port.digital_out(0, true);
delay(1000);
hal.port.digital_out(0, false);
But it also hangs the board.
I'm also a little bit confused that we are using integers to refer to the ports when we have the whole xbar with human readable names. Perhaps I am misunderstanding how the HAL is intended to work, but I would have thought doing the lookup by name would improve readability?
from core.
Mystery solved. My my_machine_map.h was missing the line:
#define HAS_IOPORTS
It might be good to have an error check when calling digital_in and digital_out to ensure the ioports.c module was compiled in and output to console gracefully. I am not familiar enough with the code to offer a patch at the moment but I hope to get up to speed and contribute going forward.
from core.
It might be good to have an error check when calling digital_in and digital_out to ensure the ioports.c module was compiled in and output to console gracefully.
When using ioports you have to check if ports are available before calling the API directly or use the default M-codes (M62-M67) as those returns an error if not available.
If the API is called from a plugin the ports should be "claimed" by decrementing number of available ports so that other plugins and/or default M-codes do not access them. An example is the init code for the fans plugin:
if(hal.port.num_digital_out >= FANS_ENABLE) { // check availability
hal.port.num_digital_out -= FANS_ENABLE; // decrement number of available ports so that other plugins cannot see or use it
base_port = hal.port.num_digital_out; // save the port number of the claimed port(s)
...
I am not familiar enough with the code to offer a patch at the moment but I hope to get up to speed and contribute going forward.
For this better documentation is required? Different drivers and even different board maps will not neccessarily support the same number of ports or even any at all (or they may be claimed by other plugins earlier in the startup sequence). Never assume that ports are available and provide feedback if not.
from core.
For this better documentation is required? Different drivers and even different board maps will not neccessarily support the same number of ports or even any at all (or they may be claimed by other plugins earlier in the startup sequence). Never assume that ports are available and provide feedback if not.
I hadn't seen this when you posted it but around the same time I saw how the Fans plugin was handling things and I followed that structure, so I do have the port decrementing and error handling included now. Thanks for flagging it.
from core.
Related Issues (20)
- protocol_enqueue_gcode does not set last_error HOT 3
- probe enabled by default HOT 1
- MKS Tinybee cannot connect to the router using STA HOT 3
- Cannot Restore After Feedhold When Issued During Change of Spindle State HOT 10
- Not an issue: Want to know if macro variables are available for $342 to $344. HOT 3
- Tool table offsets are not persistent over power cycle HOT 6
- Joggin unavailable for many commands HOT 3
- Lathe Diameter/Radius offset report issue HOT 1
- kinda vfd support HOT 3
- Macro Issue that I can not figure out. HOT 6
- I noticed that the current Setting_AxisStepsPerMM setting has 5 zeros after the decimal point. Is there any reason for doing this? HOT 2
- regression in websocket init_message caused by commit a912ce4 HOT 1
- Is the data in the driver capabilities list dependably up to date? HOT 2
- set machine origin to 0, or bit3, not working for $22 HOT 5
- octopus max STM32H723 HOT 1
- Not correctly reporting coordinates? HOT 4
- Experiencing issues with ESP32 Blackbox Build HOT 10
- How to limit the maximum output pulse frequency to prevent the user from setting an excessively high pulse rate that could cause grblHAL to crash? HOT 1
- Delta Kinematics: Y axis moves are not executing correctly - Motor duplication? HOT 1
- Syntax error / typo in ngc_expr.c HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from core.