Speed Fan M106 ..... S ???????

why does the M106 S50 command send me the maximum fan speed instead with the old firmware corresponding to 20%?
what is the max value and 50%?

Comments

  • S value can vary between 0 = 0% and 255 = 100%. As far as I know all firmwares use this scale.
  • because from 100 to 255 it does not change speed
    measured with an optical speed reader ..
    is not that the new firmware 1.0.2 has something wrong?
    I use Ramps 1.4 and  arduino mega
  • That code hasn't changed for some years. All pwm use the same function including heaters and they go all 0-255 for intensity. Will recheck code if I see a  limit to 100.
  • I'm sorry to say it but at me over 100 does not change the speed.
    it always remains max from 100 to 255
    if you check the software and if you can tell me what I have to change to have an excursion from 0 to 255
  • Ok in commands.cpp you have

        case 106: // M106 Fan On

            if(com->hasI()) {

                if(com->I != 0)

                    Printer::flag2 |= PRINTER_FLAG2_IGNORE_M106_COMMAND;

                else

                    Printer::flag2 &= ~PRINTER_FLAG2_IGNORE_M106_COMMAND;

            }

            if(!(Printer::flag2 & PRINTER_FLAG2_IGNORE_M106_COMMAND)) {

                if(com->hasP() && com->P == 1)

                    setFan2Speed(com->hasS() ? com->S : 255);

                else

                    setFanSpeed(com->hasS() ? com->S : 255);

            }

            break;


    So no limit. This calls setFanSpeed

    void Commands::setFanSpeed(int speed, bool immediately) {

    #if FAN_PIN >- 1 && FEATURE_FAN_CONTROL

        if(Printer::fanSpeed == speed)

            return;

        speed = constrain(speed, 0, 255);

        Printer::setMenuMode(MENU_MODE_FAN_RUNNING, speed != 0);

        Printer::fanSpeed = speed;

        if(PrintLine::linesCount == 0 || immediately) {

            if(Printer::mode == PRINTER_MODE_FFF) {

                for(fast8_t i = 0; i < PRINTLINE_CACHE_SIZE; i++)

                    PrintLine::lines[i].secondSpeed = speed;         // fill all printline buffers with new fan speed value

            }

            Printer::setFanSpeedDirectly(speed);

        }

        Com::printFLN(Com::tFanspeed, speed); // send only new values to break update loops!

    #endif

    }


    At the beginning you see constrain to 0-255.


    This calls setFanSpeedDirectly:

    void Printer::setFanSpeedDirectly(uint8_t speed) {

    uint8_t trimmedSpeed = TRIM_FAN_PWM(speed);

    #if FAN_PIN > -1 && FEATURE_FAN_CONTROL

        if(pwm_pos[PWM_FAN1] == trimmedSpeed)

            return;

    #if FAN_KICKSTART_TIME

        if(fanKickstart == 0 && speed > pwm_pos[PWM_FAN1] && speed < 85) {

            if(pwm_pos[PWM_FAN1]) fanKickstart = FAN_KICKSTART_TIME / 100;

            else                  fanKickstart = FAN_KICKSTART_TIME / 25;

        }

    #endif

        pwm_pos[PWM_FAN1] = trimmedSpeed;

    #endif

    }

    Here TRIM_FAN_PWM could be the problem

    #if !defined(MAX_FAN_PWM) || MAX_FAN_PWM == 255

    #define TRIM_FAN_PWM(x) x

    #undef MAX_FAN_PWM

    #define MAX_FAN_PWM 255

    #else

    #define TRIM_FAN_PWM(x) static_cast<uint8_t>(static_cast<unsigned int>(x) * MAX_FAN_PWM / 255)

    #endif


    As you see if you defined MAX_FAN_PWM 100 then 100 then what you describe would happen, but you would need to set this explicitly. But maybe you did.



  • is there a code to turn the LASER on at minimum to see where it starts working and to position the material in the correct position?
    That is, if I put a wood and I have to make an incision in a specific point, I can't know exactly where the laser starts working except for attempts to move, since I often have only one piece to be engraved, I risk always being wrong.
    I would therefore need before starting the job to turn on the laser and be able to move it to find the starting point.
  • Is it only intended to use the extruder to be able to switch on the LASER?
    and the pins of the fan to regulate the power during work?
  • No, laser TTL is only on full power during moves or off. Not sure about other lasers but mine has a focus point when it gets it's12V power that I can use. I have connected that to a fan output so I can enable/disable this while the laser logic enables the laser or disables it.
  • sorry I did not understand..
    you have the laser connected to the fan output to give it the 12V power supply.
    But the logic for enable/disable where  pin you connected it ???
  • For TTL logic I use one of the free pins on the extension pins. That just needs only %V but no high amp. So fan controls if laser gets power at all and the pin controls if laser should be enabled.
  • I connected the laser on the D10 extruder pin of ramps 1.4 and the pin D9 of the fan on the TTL of the LASER
    why when I enable the D10 with the M104 command after 30 seconds does it give me the decoupling probe error of the extruder? 
  • A laser is no extruder! You do not control it with temperatures. You need to configure it as laser by setting the laser pin and using the laser mode. Also D9 and D10 have both main voltage output. TTL input only needs 5V so that can destroy the layer electronics. Do not do that.
    Use config tool and enable laser support and you get the extra pin definition for the laser and also posiility to switch into laser mode using 
    - M450 - Reports printer mode
    - M451 - Set printer mode to FFF
    - M452 - Set printer mode to laser
    - M453 - Set printer mode to CNC
  • personally I did as you say
    1- the laser function is activated in the firmware
    2 - from repetier host I set the command M452 to switch to the Laser function and with M450 I have the confirmation that I am in this mode.
    I connect laser power on the D10 and the TTL / PWM on the D9
    3 - I turn on the D10 with the M104 command and the laser starts to run its fan.

    but after 30 seconds it gives me probe error ALSO ...
    even if they are in LASER mode ...
    WHY?
  • That is NOT what I said. I said to NOT connect TTL to the 12V outputs as they damage the laser. Put them on a 5V output!
    I also said to put main power to fan output to be controlled with M106. That does mean the regular fan not the cooling fan that requires hot extruder which you do not have. And furthermore do not heat up - it is a laser not a extruder! That will fail with missing heater and temp. sensor as you saw.

    If you follow this in laser mode a g1 move will enable laser when you previusly send M3 (laser on) until M5 (laser off) is send or if there is an increasing E value.
Sign In or Register to comment.