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
but only till S254, I can't get it to 100% duty cycle, odly enough just 99%...then it stops.... =(