-
-
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
Queued fan control (#90) killed on/off fan control for "digital" pins #122
Comments
Doh. In the end, a very simple change fixes it. Can't verify that it'll work for the PWM fan peoples, but simply putting a WRITE(FAN_PIN,HIGH); (and LOW, respectively) before the analogWrites() seems to do the trick. |
I do not understand this. If the analogwrite is transformed to a digital write if the value is 0 or 255. Or if the pin has no PWM support. |
What I do know: I have a sanguinololu, and I'd wired up a FET to run a fan, and wired it to D28 / PA3, a free pin. Defining FAN_PIN to 28 in the pins.h enabled M106/M107 control of the fan prior to #90. The changes in #90 killed fan control for me. What I don't: My solution is still not quite right. With my patch applied, the fan will turn on/off when the printer is static, but will not while the machine is in the middle of a print. For instance, if I have gcodes that turn the fan on after the 2nd layer, it will not turn on until I manually "Pause" and "Resume" in Pronterface. I think there's something I don't understand about the command queuing still. I'm new to the Arduino libraries, though very experienced with AVR C, and I'm not sure what analogWrite() is supposed to do, but I had thought that it didn't work with a "digital" pin. (The whole thing seems to be a smokescreen around the chip actually doing PWM, but don't get me started.) So to answer your next-to-last question, I don't know if the "digital" pins work with analogWrite() or not. Hopefully, will have time to play with this soon. |
Use absolute value of angular_travel instead of signed value to ensure total_angular can never be 0, which could potentially result in a divide by zero on line MarlinFirmware#122 of G2_G3.cpp.
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. |
So I had a "digital" pin defined as FAN_PIN (because it was what I had free on my Sanguinololu) and would use M106/107 to turn the fan on and off, bang-bang style.
After the change to queued PWM fan control (Issue #90), it no longer works.
The short version:
WRITE(FAN_PIN,HIGH); got replaced with analogWrite(FAN_PIN, fanpwm); which seems to not work on D28 / PA3.
The RC2 tag version had a bit where it tested if fanpwm was 255, and turned set the pin bit high if it was, which worked for on/off fan control on any pin. I'm coding this up. If you want a push, let me know.
The text was updated successfully, but these errors were encountered: