Topics

Reticle LED as Aux output #fysetc


martin@...
 

Well,

as I am getting through the code at the moment and "fitting" it to my setup I found one "grey spot" or missing feature config - I call it "Reticle as Aux output"

Normal situation:
- normal way reticle is connected to CPU pin in open drain configuration and it is coded accordingly
- Increase and decrease of reticle brightness works as expected

My situation:
- reticle led is connected to fan output of fysetc s6 board - there are plety of them - i have more flexibility here - vcc is 12V - therefore I need a resistor in series
- motivation: robustness - no long cable, no exposed cpu pins without any sort of protection/limitation

My implementation:
- Reticle pin in pinmap to Aux2

#define ReticlePin          Aux2

Result:

Decrease and Increase of brightness has reversed logic

Solution:

In myconfig.h (or in config.h alternatively) is added:

#define RETICLE_AS_AUX

and in command.ino routine for reticle is modified:

//  B - Reticule/Accessory Control
// :B+#       Increase reticule Brightness
//            Returns: Nothing
// :B-#       Decrease Reticule Brightness
//            Returns: Nothing
      if (command[0] == 'B' && (command[1] == '+' || command[1] == '-') && parameter[0] == 0)  {
#if LED_RETICLE >= 0
        int scale;
        
        #ifdef RETICLE_AS_AUX
          if (command[1] == '+') reticuleBrightness+=16;  if (reticuleBrightness > 255) reticuleBrightness=255;
          if (command[1] == '-') reticuleBrightness-=16;  if (reticuleBrightness < 0)   reticuleBrightness=0;
        #endif
 
        #ifndef RETICLE_AS_AUX
          if (reticuleBrightness > 255-8) scale=1; else
          if (reticuleBrightness > 255-32) scale=4; else
          if (reticuleBrightness > 255-64) scale=12; else
          if (reticuleBrightness > 255-128) scale=32; else scale=64;
          if (command[1] == '-') reticuleBrightness+=scale;  if (reticuleBrightness > 255) reticuleBrightness=255;
          if (command[1] == '+') reticuleBrightness-=scale;  if (reticuleBrightness < 0)   reticuleBrightness=0;
        #endif
 
        analogWrite(ReticlePin,reticuleBrightness);
#endif
        boolReply=false;
      } else 

How to make it functional without touching pinmaps?

Solution works as expected with very nice and linear control of reticle brightness
- reticle pin on aux solves some of the collisions on EXP2 if you need more functions like STATUS LED 2

Is it worth to add it to beta or master branch?

Martin

 


Khalid Baheyeldin
 

Don't know if what I will say is related, but it is something I read on a 3D printing forum (forgot which one) ...
Someone was complaining that the Fan outputs are reversed, and he burned a fan because of that.
Maybe test reversing the wires for the fan, and see if they are correct that way?


martin@...
 

Hi Khalid,

that is actually not the case. Controlling and switching the output is ok - for example, I run a fan on another aux and that is easy to control and works as expected. It is just the rutine for reticle control which works with inverted logic