Welcome! Log In Create A New Profile

Advanced

Ramps 1.4 - Repetier Firmware - Cooling Fan control

Posted by TheHackerArtist 
Ramps 1.4 - Repetier Firmware - Cooling Fan control
August 31, 2014 09:21PM
Hi,

I have been using Marlin firmware for some time and wanted to give Repetier Firmware a go. I configured everything right, everything works...except, the cooling fan output. The fan that cools the plastic (not the extruder)

I know it's not a hardware problem because I switched back to Marlin and it worked. I recompiled the sketch
a few times as well, still the same issue.

I have the Cooling Fan on Heater 2 ( normally extruder 1 - according to the note in repetier firmware) That's the D9 PWM output on the RAMPS 1.4 board.



The LED for D9 blinks when I send a M106 ( Fan on) G code command but very slowly, like 10 or 20 Hz...so it`s clearly not sending 100% duty cycle...

So, ya. I don`t knwo what`s wrong nor how to correct the issue. Does anybody have any suggestions? I don`t mind going into the arduino sketch and changing things but I have no clue where to go =/

Thanks for you advice =)

Edited 1 time(s). Last edit at 08/31/2014 09:23PM by TheHackerArtist.
Re: Ramps 1.4 - Repetier Firmware - Cooling Fan control
August 31, 2014 10:53PM
Ok, so I found the following bit of code in commands.cpp :


#if FAN_PIN>-1 && FEATURE_FAN_CONTROL
case 106: //M106 Fan On
setFanSpeed(com->hasS()?com->S:255,com->hasP());
break;
case 107: //M107 Fan Off
setFanSpeed(0,com->hasP());
break;
Which I have no clue what it mean because i've never seen this kind of syntax used while calling a funciton. What does -> mean? and what's hasS? couldn't find anything on the arduino documentation or on google....confusing =/ but i guess it means check for S and then take whatever is after as the argument, same for p which probably stands for pause?

So then I found this function:

void Commands::setFanSpeed(int speed,bool wait)
{
#if FAN_PIN>=0
speed = constrain(speed,0,255);
Printer::setMenuMode(MENU_MODE_FAN_RUNNING,speed!=0);
if(wait)
Commands::waitUntilEndOfAllMoves(); // use only if neededthis to change the speed exactly at that point, but it may cause blobs if you do!
if(speed!=pwm_pos[NUM_EXTRUDER+2])
Com::printFLN(Com::tFanspeed,speed);
pwm_pos[NUM_EXTRUDER+2] = speed;
#endif
}

I got ride of the c**p and replaced it with this :

void Commands::setFanSpeed(int speed,bool wait)
{
#if FAN_PIN>=0
speed = constrain(speed,0,255);
if(wait)
Commands::waitUntilEndOfAllMoves(); // use only if neededthis to change the speed exactly at that point, but it may cause blobs if you do!
if(speed!=pwm_pos[NUM_EXTRUDER+2])
analogWrite(9,speed);
#endif
}

because I know my fan is on pin 9

and it works! Yeah spinning smiley sticking its tongue out but only till S254, I can't get it to 100% duty cycle, odly enough just 99%...then it stops.... =(
Sorry, only registered users may post in this forum.

Click here to login