-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using Fans with other I/O ports #2
Comments
Depending on the number of I/O ports supported by the driver you can control the remaining ports via M62-M66 commands, no plugin is needed for that. This plugin can be enabled alongside other plugin , but the driver must have support for enough I/O ports. Most drivers can easily be changed to support more ports, especially so if a custom board map file is used. BTW the core supports tool changes via an ATC, but you will have to write a dedicated plugin for the one you have. |
I am using the iMXRT1062 driver on a Teensy 4.1 with a custom board map. As an example, to add one more output, presumably I add to my_board_map.h
and then to driver.c
and then under
...
.id .port and .group aren't showing as referencing anything in Platform IO, so presumably there's more to do or I'm barking up the wrong tree? Any simple way around the problem of defining more out ports would be most welcome. |
I have now added definitions for aux inputs and outputs up to #7 (8 ports) in driver.c. If more than that is needed the core has to be updated. |
That is wonderful. Works great. Thanks so much. Because I am using the RGB plugin, which out of the box works nicely with ports AuxOut0-2, can I easily move the ports of the M62-65 commands to AuxOut4-7? Presumably I just shuffle things around the port definitions in lines 472-478 in driver.c? |
Aux 4-7 will be moved to the lowest M62-65 port numbers automatically, check with the
No, there is no need for that. |
My problem is that the RGB plugin defaults to status changes reading on Auxout0-2 (which also is controlled by M62-65 commands). If I change it so that the RGB pins are on auxoutput 4, 5, 6 I can't see an easy way to make that plugin read the corresponding higher ports, so I was thinking that it would be easier to adjust the driver. |
Ouch, I see now that the RGB plugin does not claim the ports with the new method that shuffles the M62-M65 port numbers. The fans plugin does, and adds settings for the end user to select port > pin bindings. If modifying the plugin the
|
Great stuff, its really amazing to have a Grbl variant with so much power. I have given 5ocworkshop a gentle nudge so hopefully he can update the RGB status plugin. Now that I have 4 ports for my ATC controlled by M62-66 and 3 ports awaiting RGB, I have also added the Fans plugin. I have defined 1 fan on port 7 in my board map, which shows up as Auxout7 using $pins. Do I need to do anything else? I was expecting that issuing M106 P7 and M106 P7 would turn the fan on/off. |
The |
Unfortunately when sending M106/M107, IoSender reports Unsupported or Invalid g-code command found in block I have dropped the RGB plugin for the time being and not sent any $-settings (I didn't quite understand the significance in the read me). The only thing I've done is define AUXOUTPUT7_PIN in the board map. |
Does Fan 0 show up in the
and when bound to port 2 by setting $386 to 2:
Is With the edge build of ioSender I get a checkbox for switching the fan on/off, this can be done even when a gode program is running: |
Not quite like that! regardless of $386 settings, I get this [PIN:41,Aux out 0,] M64-65 Commands still working with Aux Out 0-3 |
Ok, there is a memory leak at play - and an issue when aux pins are not contiguous. The memory leak can be fixed by replacing this code with
Assign pin 27 as Be aware when changing $386 the controller has to be power cycled as the Teensy does not have a reset button.. |
Sweet, now I have The Fans plug in wanted to take port priority, so I defined
I hadn't clocked that – I haven't heard back yet from the developer of the RGB plugin, so I thought that I'd follow your suggestion to modify. I'm not familiar with the syntax (programming is not my first language!), should the code look something like this...
At this stage I am gunning for ports/auxouts 5-7 |
Correct, I have just committed an update that forces the reported Aux port numbers to be contiguous regardless of the definition in the map file. This makes handling simpler in the code but may be confusing when creating a map file. End users should use the I'll come back to the RGB plugin code, it is late evening here. |
Great stuff once again Terjeio. Please don't worry about when you can look at the RGB code, it is definitely outside your remit and I'm sure you have way more important things to do. Thanks for all your diligent hard work. |
Try this: I have changed the enable define to the "official" |
Thanks Terjeio, I get compile errors of this nature:
etc Sorry again for my ignorance, are you saying that the array code that you added to rgb.c is picked up by lines 64-66 in ioports.c? Do I need to do something like add btw loving how easy IoSender makes it to invert my required selection of aux out pins in the settings GUI :) |
This cannot be with the code I posted above in rgb.zip... Have you updated the correct file? There was a mix of array values and separate values for each port, I opted to use the separate values instead as theye were used more places than the array and is easier to read.
In the file I posted above I added these defines for mapping the port number to the LED:
It is not picked up by the ioports.c code directly, assignment is through a layered API. Calling ioport_claim() in the plugin init does the trick:
Yes. |
Duh! Clearly not! That heinous crime and also failing to comment out the old plugin.
I'm off to do my happy dance. Terje you are a rock star. |
WS2812 uses a serial interface over a single pin for control, thus it cannot be controlled via the I/O ports interface. |
Thanks again Terjeio, I mean the RGB plugin to work with my pico zero, I can't find a way to assign the GP16 pin to make the RGB led work. |
To make the RGB plugin work with a WS2812 LED it has to be modified to control it via the single pin WS2812 serial interface. The RGB plugin uses three pins to control each LED (Red, Green and Blue) individually on/off. |
Terjeio, to send you one, or through paypal so you can buy it I remain attentive thanks for your help. |
Try this code, it should set the LED to a not too strong red colour: Add the files to the root of the project (in the same directory as main.c is located) and enable compilation of my_plugin.c. I found the code in a Pi Pico example and have modified it for grblHAL, I leave it to you to test it and expand on it. |
Good morning Terjeio, I tell you that I added the plugin to grblHAL and it works fine, the rgb led turns red, and at the end of the code change the value and change the color it works, but for the functions that the rgb datron plugin has to work , ?? thanks for your help.... |
Replace the code that claims the io ports for the LED with init code from the above example and replace this code with call to |
good morning, Terjeio, I didn't understand :( |
Change:
and
You may have to change values here to match the LED/for the intensity and or colour you want.
add put |
terjeio, I change these values in rgb.c? |
Yes. |
Good morning terjeio, it doesn't work :( |
@Juank23 The rgb.c code will not compile against recent core versions, I have added a PR with a fix - hopefully it will be accepted. Here is a working version without the WS2812 changes: |
I'm using grblHAL with the RGB LED Datron style plugin and now wish to add a wine rack style ATC. My plan is to use the fans control plugin to operate pneumatic solenoids to shove the tool rack around.
As both use the standard 4 analogue outs, I was wondering if there was a simple way to use both plugins at once? I have a Teensy 4.1 with lots of spare pins and practically nil programming skills. The plugin examples show that extra I/O and M codes would be easily achievable but I fear that its above my pay grade.
The text was updated successfully, but these errors were encountered: