MarlinFirmware / Marlin

Marlin is an optimized firmware for RepRap 3D printers based on the Arduino platform. Many commercial 3D printers come with Marlin installed. Check with your vendor if you need source code for your specific machine.
https://marlinfw.org
GNU General Public License v3.0
16.23k stars 19.22k forks source link

SERVO2_PIN not behaving as expected #8508

Closed Bergerac56 closed 6 years ago

Bergerac56 commented 6 years ago

I use the "servo" pins to pilot RVB LEDs. If everything is fine for SERVO1 and SERVO3 pins, the behavior of SERVO2_PIN seems not to be right on RE-ARM when PWM is needed. When issuing a M42 P1.19 S0, the LED connected to it is OFF. When issuing a M42 P1.19 S1 to S255, the LED is ON (full). PWM seems not to work on this pin.

Is it a bug? Or a specificity of the RE_ARM ?

Bob-the-Kuhn commented 6 years ago

Confirmed - SERVO2 doesn't work on the latest Bugfix-2.0.x.

It won't be until tonight before I have enough time to see what's wrong.

Bob-the-Kuhn commented 6 years ago

I haven't forgotten about you. Dr. & Thanksgiving taking a lot of time.

I can see that the PWM ISR run about 10 times and then stop after issuing the Servo2 command.

I'm going to make the bold assumption that you want it to run a little longer.

Bob-the-Kuhn commented 6 years ago

Found the problem. I forgot to re-enable the PWM ISR when it couldn't find a requested pin.

The fix has been merged via PR #8518.

Bergerac56 commented 6 years ago

@Bob-the-Kuhn - Once again... well done. It works nicely now. Thanks a lot.

EDIT: Testing a bit more, I saw something I did not notice before (I will reload a older version of bugfix to check). When changing the "S" value, the LED "flashes" one time before coming to the desired luminosity. It gives the impression that, executing the desired value of S, it first very quickly goes to MAX (S255) and directly after to the desired "S". This happens on the 3 pins I use (P1_18 P1_19 P1_21). It is the most seeable when you increase the value of S (M42 P119 S30 -> M42 P119 S50 for ex).

BTW, I see that the syntax of the M42 gcode changed: no dot anymore in the syntax of the pin: P1.19 or P1_19 seems to be now P119. I suppose that this is the conclusion of the discussion about pin numbering?

In Marlin config, it is still today P1_19 (for ex.). Will that change?

Bob-the-Kuhn commented 6 years ago

The internal syntax is P1_02. M42 is P102.

As far as I know that's the way it'll stay.

If you have a customized pins_xxx.h file then you'll need to convert P1_2 to P1_02.

Bergerac56 commented 6 years ago

Nice Thanks.

github-actions[bot] commented 3 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.