Welcome! Log In Create A New Profile

Advanced

Setting RGB LED values on boot

Posted by Aethelstan 
Setting RGB LED values on boot
June 04, 2017 11:26AM
I have my custom built 3d printer working quite nicely now with Marlin and RAMPS, and the RGB LED support is great since getting it working with help on this forum. What I would like to do is have the LEDs start fully on white. I have seen that I can load custom boot up gcode using an SD card, but I don't have access to the SD slot and it is disabled in my firmware build. Is there another way to add either custom gcode or set the three pins to 255 as it boots? I assume that there will be a function that is called that sets pins to the expected states and perhaps I can add the commands in there, but I am not entirely sure what I am looking for. Does anyone have any tips, please?
Re: Setting RGB LED values on boot
June 05, 2017 09:25AM
can't try it at the moment, but give this a try

in Marlin_main.c line 12708 (in my version) is the following

  #if ENABLED(RGB_LED) || ENABLED(RGBW_LED)
    SET_OUTPUT(RGB_LED_R_PIN);
    SET_OUTPUT(RGB_LED_G_PIN);
    SET_OUTPUT(RGB_LED_B_PIN);
    #if ENABLED(RGBW_LED)
      SET_OUTPUT(RGB_LED_W_PIN);
    #endif
  #endif

change to

  #if ENABLED(RGB_LED) || ENABLED(RGBW_LED)
    SET_OUTPUT(RGB_LED_R_PIN);
    OUT_WRITE(RGB_LED_R_PIN, HIGH); // turn it on
    SET_OUTPUT(RGB_LED_G_PIN);
    OUT_WRITE(RGB_LED_G_PIN, HIGH); // turn it on
    SET_OUTPUT(RGB_LED_B_PIN);
    OUT_WRITE(RGB_LED_B_PIN, HIGH); // turn it on
    #if ENABLED(RGBW_LED)
      SET_OUTPUT(RGB_LED_W_PIN);
      OUT_WRITE(RGB_LED_R_PIN, LOW); // turn it off
      OUT_WRITE(RGB_LED_G_PIN, LOW); // turn it off
      OUT_WRITE(RGB_LED_B_PIN, LOW); // turn it off
      OUT_WRITE(RGB_LED_W_PIN, HIGH); // turn it on
    #endif
  #endif

Edited 2 time(s). Last edit at 06/05/2017 09:31AM by Dust.
Re: Setting RGB LED values on boot
June 05, 2017 09:28AM
Cheers, will give it a try in the morning as I am just off to work. smiling smiley
Re: Setting RGB LED values on boot
June 06, 2017 06:23AM
Compiled and uploaded this morning and it does exactly as intended. Thanks ever so much smiling smiley
Sorry, only registered users may post in this forum.

Click here to login