neildarlow / Marlin

Marlin 3D Printer Firmware customised for nophead's Mendel90.
6 stars 2 forks source link

Fixes M42 Pxx led control on Melzi hardware #1

Closed Banjer closed 10 years ago

Banjer commented 10 years ago

Fixes M42 Pxx on Melzi hardware. It is a minor "fix", and it won't affect many users, but it also keeps the code closer to the original Marlin.

neildarlow commented 10 years ago

That is an original nophead change.

The Melzi circuit diagram actually shows the LED connected to EXT-A4 which, I believe, equates to P28 and is most commonly used for control of the BED fan.

nophead's Melzi board, as far as I can see, does not have the LED fitted (I guess to save build cost) so I suspect that was his motivation for disabling LED support.

Banjer commented 10 years ago

The Melzi that came with the kit i got has a led, easy ways to test is is with M42 P27 S255, it's a small smd led. As for the pin 28 vs 27, check out https://github.com/ErikZalm/Marlin/pull/371 and https://github.com/ErikZalm/Marlin/pull/368 Perhaps Nophead commented it out because it isn't used by the firmware itself, or to avoid conflicts with broken libs. But if you want it left commented out, i can easily work around it by changing my scripts to use M42 P27 :)

neildarlow commented 10 years ago

You are correct, I don't know how I missed the LED being on P27 (especially after having played with various port numbers looking for it).

I don't have strong feelings on this one and, I guess, we could reinstate LED_PIN. Maybe it should go to a vote somewhere?

neildarlow commented 10 years ago

I have been thinking about this a little more and I am inclined to leave LED_PIN commented.

If I understand correctly, giving a pin a value puts it into the protected_pins array which means that M42 P27 Sxxx will no longer control it. This gives you a choice of either defining LED_PIN and using M42 Sxxx or leaving it commented and using M42 P27 Sxxx. Users of Nophead's firmware will be familiar with the second form and making this change will force them to adapt their GCode which, for a least surprises implementation, would not be desirable.

Banjer commented 10 years ago

Just tested it, but you can use both M42 Sx and M42 P27 Sx with the LED_PIN defined. Like i said, it's not important for me, i can work around it, but it could be argued that keeping the line the same as the original Marlin might lower the change of conflicts when merging upstream changes.