-
-
Notifications
You must be signed in to change notification settings - Fork 19.3k
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
Unify all AVR90USB pin mappings #6889
Unify all AVR90USB pin mappings #6889
Conversation
1d26339
to
ffa7a93
Compare
The LCD pins all use FASTIO routines. I've just pushed a commit on PR #6737 what cleans up mixing of FASTIO and non-FASTIO routines on the same pin. As part of that I made a list of all the pins that do NOT use FASTIO. These are the pins that need to use the Teensy/MARLIN/Arduino pin map. Signals that use analogWrite
|
ffa7a93
to
d12bf22
Compare
c562706
to
837688b
Compare
With your comments on my PR I'm finally realizing what this PR is about. The solution is to just to use FASTIO macros that match the Teensyduino pin map plus pins 46 & 47. BEST SOLUTION BY FAR!!!! I'll download this PR & start double checking the translations & run a few sanity checks. Give me a couple of days to complete that. |
The one little tweak, which is nothing compared to all the mess we'll be fixing.
Thanks, Bob! The only (?) part I missed and will need guidance on is how / whether we'll need to do any special remapping for |
I'm sure this is an ignorant question. But it would be real easy to understand if we had a to_fastio(int pin) function. And a corresponding to_aurdio(int pin) function. Maybe we don't need these with this work almost done. But if we would have had those functions a year ago... Things would have been simpler. |
That would have been good! I think that until recently there was just a lot of confusion around the rationale for "traditional" (aka "Marlin") pin numbering and its special relationship with the AT90USB pins files, so no one wanted to mess with it. Sometimes it's hard to sort out what is just "the way it happens to be done" from "the way it must be done." Bob and I both got into the fastio weeds with Now that I've gone through the process in this PR, I am surprised how straightforward it turns out to be. At the same time, I can totally understand why no one wanted to approach it, since this is among the deepest bowels of what Marlin does. |
Those are not needed with this approach. It'd be exactly like all the other CPU families - FASTIO and Arduino use the same logical pin number for the same port. The only exception is pin 46 & 47. Those will remain FASTIO only pins just because the Arduino Teensy IDE extensions don't know what to do with them. |
Once FASTIO matches the Teensy pin numbering then nothing special needs to be done. Everything would behave the same as the other CPU families with the exception of pins 46 & 47. 46 & 47 will always have to use the FASTIO routines. |
Overall, pretty decent for just replacing one set of numbers with another. So, does anything in this PR cause breakage? You mentioned that the LCD pins would also need to be remapped, possibly. In this PR I left all the pins named Anyway, before I dive ahead and merge this, I should look it over a couple more times to make sure I didn't miss any pins or introduce any typos. I feel pretty confident that this will work if everything is sewed up. I'm ready to breathe a sigh of relief and see an end to all our mapping woes! |
My impression is that the LCD stuff is even more confusing than the FASTIO/Teensy stuff. Using the current bugfix-1.1.x and some LEDs I found out that
BUT... I see where LCD_PINS_D4 is passed to an Arduino library which has to be using the Teensy numbers. As best I can tell the LCDs that use the Marlin ST7920 routines use FASTIO and everything else uses Teensy. I'll do some more digging tomorrow. |
Why are you changing all those non-AT90USB boards? I don't see any value add to adding the FASTIO flags. I do see people scratching their heads wondering what it's about. If my notes from 6 months ago are correct then the only pins_XXX.h files that need to be touched are:
|
Progress report I've put more LEDs on my Teensylu and downloaded all the LCD controllers that use the LCD_PINS_xx pins and DOGLCD_xx pins. I've confirmed that all the DOGLCD_xx pins are FASTIO. I've confirmed that the LCD_PINS_xx are a mix. 7 of the 9 controllers that use these signals use the FASTIO pins. REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER and BQ_LCD_SMART_CONTROLLER use the Teensy pins. Only the Printrboard files are affected by the mix. Unfortunately they do NOT have tight enough if-then-else defines to tell the difference. The same
Nest step is to do the same thing with the I2C controllers and the shift register controllers. |
Only added commentary to them, trying to clarify which pins are non-FastIO in all pins files. |
837688b
to
d1199d0
Compare
Ok, removed the "non-FastIO" comments from all of those. |
So it looks like if I re-map the Now, when you say "Teensy" mapping in the context of these displays, do you mean they are already mapped to the Teensy DIO pin numbers, and therefore do not need to be changed? Or, are you indicating the The thing is, "FastIO" and "Teensy" are not the opposite of each other. "Marlin" and "Teensy" are the two competing pin mappings. "FastIO" as I said before applies always. So, should the above really read like this…?
|
835d5dc
to
36fa6ae
Compare
Marlin/pins_BRAINWAVE.h
Outdated
@@ -82,7 +82,7 @@ | |||
#define X_STEP_PIN 3 // D3 | |||
#define X_DIR_PIN 5 // D5 | |||
#define X_ENABLE_PIN 4 // D4 | |||
#define X_ATT_PIN 3 // D3 | |||
#define X_ATT_PIN 2 // D2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Has this been wrong till now?
Yes, remove all mentions of FASTIO , non-FASTIO, Teensy , .. from the pin comments. Here's the updated Brainwave PRO file. It originally used the Teensy system so I took your conversion, checked it, added info on the expansion connectors and updated the header. On the Brainwave question - for X_ATT_PIN pin 2 port D2 is correct. |
@fiveangle has tested the Printrboard Rev F. He's pointed out two things:
I've changed the fan per Dave's request. I've also modified the text to indicate that Teensyduino is the most used IDE extension and removed the comment about the 64k limit. Here's the modified files. Brainwave didn't change but I included it for completeness. With Dave's testing I'm comfortable merging this PR with the updated pins_XXX.h files. |
Noble work here @Bob-the-Kuhn. With the weath of misinformation about all this spread out over the years, this was a long time coming and the Marlin world solutes you for the perseverance :) |
Scott was the one that got the courage up to do away with the old system. I'm REALLY looking forward to seeing it merged. |
@thinkyhead - Scott what are your plans for this PR? Is there anything I can do to get it ready to merge? |
I see the non-AT90USB boards are still in the PR. I really believe that adding non-FASTIO to them is of no value and will result in questions. |
fa7c24c
to
c757d95
Compare
Just had a chance to get it cleaned up. Please give it another review! |
c757d95
to
bf82e69
Compare
Please replace the AT90USB boards with these files The comments have been changed to say that the main reason for using Printrboard IDE extension is if the board doesn't have the Teensyduino bootloader. The comment that implied that Teensyduino can't upload images greater than 64k has been removed because it is no longer true. The fan pin in the Printrboard files have been corrected. Once the files have been updated then this PR is ready to merge. |
8f736f5
to
44bec97
Compare
} | ||
//if (!pwm_status(pin)) SERIAL_CHAR(' '); // add padding if it's not a PWM pin | ||
if (extended) pwm_details(pin); // report PWM capabilities only if doing an extended report | ||
SERIAL_EOL(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Bob-the-Kuhn I had a little hiccup when merging, wasn't sure how the end of this function should be. Are these changes the same as they were?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is correct. The SERIAL_EOL has been moved a couple of levels up/left.
44bec97
to
1bec42b
Compare
Ok, I've brought in your changes. Looks like not a lot needed adjustment. Could it be this is ready to merge?? |
1bec42b
to
51bc502
Compare
Most definitely it's ready |
So, in layman's terms how should we hype this?
Does that capture everything? |
For the user it's "Easier to customize and to understand." |
@Bob-the-Kuhn The idea here is to use only the Teensy mapping and say farewell to the "Marlin mapping" scheme. Does this make sense as a complete solution?
I remapped all files that were using "Marlin mapping" and labeled the pins in the other files with their ports. I took care not to change pins that were using "Non-FastIO" mapping, and I added a note to
pins.h
about how pins mapping works.Note that for "Marlin" pins 34 and 35, I mapped them to Teensy pins 46 and 47 which map to ports E2 and E3. That should be 100% consistent with the way pins were getting mapped before.
Due to indentation changes, view the concise diff.
Also:
EXT_AUX_*
pins were using the incorrect ("Marlin") mapping, while the rest seem to be using Teensy++. Patched.