×

INDI Library v2.0.6 is Released (02 Feb 2024)

Bi-monthly release with minor bug fixes and improvements

Driver OnStep (LX200 like) for INDI

  • Posts: 452
  • Thank you received: 71
Alex,

thank you for the Output tab implemen,tation.
Could you please explain how to use this feature?
and how to set-up on Onstep side?

Thanks
4 years 11 months ago #38395

Please Log in or Create an account to join the conversation.

  • Posts: 174
  • Thank you received: 27
Alaine,

Using this feature is very simple: enter a number into a box and push the set button. As a result of it, the following command would be sent to OnStep:
:SXG7,10#
where 7 is port and 10 is value to be sent there.
The ports to be used are board specific. My Ramps based board has PWM analog output on port 7. I use this output for driving flat panel so I can change the brightness of it.
I have no idea which ports are available on other boards.

Here is the corresponding code in OnStep in Command.ino:
if (parameter[0]=='G') { // Gn: General purpose output
          long v=(double)strtol(&parameter[3],NULL,10);
          if ((v>=0) && (v<=255)) {
#ifdef Aux0
            if (parameter[1]=='0') { valueAux0=v; static bool init=false; if (!init) { pinMode(Aux0,OUTPUT); init=true; } if (v==0) digitalWrite(Aux0,LOW); else digitalWrite(Aux0,HIGH); } else
#endif
#ifndef MODE_SWITCH_BEFORE_SLEW_SPI
#ifdef Aux1
            if (parameter[1]=='1') { valueAux1=v; static bool init=false; if (!init) { pinMode(Aux1,OUTPUT); init=true; } if (v==0) digitalWrite(Aux1,LOW); else digitalWrite(Aux1,HIGH); } else
#endif
#ifdef Aux2
            if (parameter[1]=='2') { valueAux2=v; static bool init=false; if (!init) { pinMode(Aux2,OUTPUT); init=true; } if (v==0) digitalWrite(Aux2,LOW); else digitalWrite(Aux2,HIGH); } else
#endif
#endif
#ifdef Aux3
            if (parameter[1]=='3') { valueAux3=v; static bool init=false; if (!init) { pinMode(Aux3,OUTPUT); init=true; }
  #ifdef Aux3_Analog
              analogWrite(Aux3,v); } else
  #else
              if (v==0) digitalWrite(Aux3,LOW); else digitalWrite(Aux3,HIGH); } else
  #endif
#endif
#ifdef Aux4
            if (parameter[1]=='4') { valueAux4=v; static bool init=false; if (!init) { pinMode(Aux4,OUTPUT); init=true; }
  #ifdef Aux4_Analog
              analogWrite(Aux4,v); } else
  #else
              if (v==0) digitalWrite(Aux4,LOW); else digitalWrite(Aux4,HIGH); } else
  #endif
#endif
#ifdef Aux5
            if (parameter[1]=='5') { valueAux5=v; static bool init=false; if (!init) { pinMode(Aux5,OUTPUT); init=true; }
  #ifdef Aux5_Analog
              analogWrite(Aux5,v); } else
  #else
              if (v==0) digitalWrite(Aux5,LOW); else digitalWrite(Aux5,HIGH); } else
  #endif
#endif
#ifdef Aux6
            if (parameter[1]=='6') { valueAux6=v; static bool init=false; if (!init) { pinMode(Aux6,OUTPUT); init=true; }
  #ifdef Aux6_Analog
              analogWrite(Aux6,v); } else
  #else
              if (v==0) digitalWrite(Aux6,LOW); else digitalWrite(Aux6,HIGH); } else
  #endif
#endif
#ifdef Aux7
            if (parameter[1]=='7') { valueAux7=v; static bool init=false; if (!init) { pinMode(Aux7,OUTPUT); init=true; }
  #ifdef Aux7_Analog
              analogWrite(Aux7,v); } else
  #else
              if (v==0) digitalWrite(Aux7,LOW); else digitalWrite(Aux7,HIGH); } else
  #endif
#endif
#ifdef Aux8
            if (parameter[1]=='8') { valueAux8=v; static bool init=false; if (!init) { pinMode(Aux8,OUTPUT); init=true; }
  #ifdef Aux8_Analog
              analogWrite(Aux8,v); } else
  #else
              if (v==0) digitalWrite(Aux8,LOW); else digitalWrite(Aux8,HIGH); } else
  #endif
#endif
#ifdef Aux9
            if (parameter[1]=='9') { valueAux9=v; static bool init=false; if (!init) { pinMode(Aux9,OUTPUT); init=true; } if (v==0) digitalWrite(Aux9,LOW); else digitalWrite(Aux9,HIGH); } else
#endif
4 years 11 months ago #38423

Please Log in or Create an account to join the conversation.

  • Posts: 161
  • Thank you received: 39
Do note that the reason that I stopped with the implementation, and I'm a little confused as to why this went in upstream, is:

THERE ARE NO CHECKS ON IF THE PIN IS IN USE. Aux pins ARE used for other things as well, so this has the potential to screw up OnStep, or things connected if you mess up what you are outputting to.

The best Idea I have is that this should be encapsulated with a control turning it on that's basically a warning to that effect. Or we should see what board it is (currently not possible, but I've got a branch I worked on yesterday that should work for that, so we can make it as safe as possible, ie, heaters/etc on RAMPS, etc.)
4 years 11 months ago #38440

Please Log in or Create an account to join the conversation.

  • Posts: 174
  • Thank you received: 27
James,
I think the implemented approach is very safe - even though commands for driving outputs can be sent to the controller for all Aux ports, I don't think any damage can be done because processing the output command is surrounded by #ifdefs like this:
#ifdef Aux7
            if (parameter[1]=='7') { valueAux7=v; static bool init=false; if (!init) { pinMode(Aux7,OUTPUT); init=true; }
  #ifdef Aux7_Analog
              analogWrite(Aux7,v); } else
  #else
              if (v==0) digitalWrite(Aux7,LOW); else digitalWrite(Aux7,HIGH); } else
  #endif
#endif

These #defines are set appropriately in the Pins header files, e.g. in Pins.Ramps14.h we can see the following:
// The multi-purpose pins (Aux3..Aux8 can be analog (pwm/dac) if supported)
#define Aux0          11
#define Aux1          29
#define Aux2          37
#define Aux3          62
#define Aux4          24
#define Aux5          30
#define Aux6           8    // heater
#define Aux7           9    // heater, analog (pwm)
#define Aux7_Analog
#define Aux8          10    // heater, analog (pwm)
#define Aux8_Analog
#define Aux9          39    // general purpose
#define Aux10         41
#define Aux11         43
#define Aux12         45
#define Aux13         47
#define Aux14         32

whereas in Pins.MaxESP2.h we see this:
#define Aux3          21    // Home SW for Axis1 (or I2C SDA)
#define Aux4          22    // Home SW for Axis2 (or I2C SCL)
//#define Aux5          "V0"  // Virtual Aux Pin0 (usually maps to AXIS1_ENC_A_PIN)
//#define Aux6          "V1"  // Virtual Aux Pin1 (usually maps to AXIS1_ENC_B_PIN)
#define Aux7          39    // Limit SW, Status LED2, Reticule, etc.
#define Aux8          25    // Status LED, PPS, Tone, etc.

So based on this, I think that the implementation is very safe.

Alex
4 years 11 months ago #38463

Please Log in or Create an account to join the conversation.

  • Posts: 60
  • Thank you received: 1
Hello,
I found a problem with dome management:
If I select "dome locks telescope". Even if the dome is "unpark" it is not possible to unpark the telescope. It says "Telescope locked by the dome".
With AstroEQ or telescope simulator, the operation is correct.

Regards,
4 years 10 months ago #38696

Please Log in or Create an account to join the conversation.

  • Posts: 1
  • Thank you received: 0
Hi everyone,

I am very interested in using this OnStep controller: is it possible to control a DIY wedged fork, or can it only handle AltAz forks?

Thanks,

Martin
4 years 10 months ago #38821

Please Log in or Create an account to join the conversation.

  • Posts: 322
  • Thank you received: 31
OnStep Alpha has support for fork mounts, as of a week or two ago, so it should work. But it has not been verified by someone yet.
4 years 10 months ago #38822

Please Log in or Create an account to join the conversation.

  • Posts: 60
  • Thank you received: 1
It's not a problem with OnStep.
Today, i have the same problem with AstroEQ...
4 years 10 months ago #38827

Please Log in or Create an account to join the conversation.

  • Posts: 322
  • Thank you received: 31

The polar aligned fork mount is verified to work. See This thread .
4 years 10 months ago #38850

Please Log in or Create an account to join the conversation.

  • Posts: 3
  • Thank you received: 0
Hi Khalid,

Dragonlost asked me if I can develop an INDI driver for TeenAstro.
If think it is much easier for both community to have 2 drivers one for onstep and one for TeenAstro. Indeed all the beauty of OnStep is the flexibility and the beauty of TeenAstro is to keep the thing as simple as possible.
The good news is that TeenAstro overlap to 95% with ONStep and has significantly less feature. For example no PEC and No multiStar alignment...
My only problem is that I have no experience with LINUX...

Charles
4 years 10 months ago #38858

Please Log in or Create an account to join the conversation.

  • Posts: 161
  • Thank you received: 39
So after looking a bit.

(Sorry about my lack of response, when I look up, it's been something in the range of R=G=B for the most part for a while. :( )

The code there will not protect overriding other functions of OnStep. Nor after looking are there any checks to see if there's any other use for the pins. Honestly, in the pinmap, any time an aux pin is used, it should probably be followed with an undef AuxX as the best solution. That's not the case though so, that's why I consider it unsafe. For example, on Ramps, some of the Aux pins 4, for example will knock on or off the focuser enable, rotator enable, or SPI if using fancy drivers. That's why I consider it a bit unsafe. It's nothing to do with your code (or my code before) it's that OnStep allows access to them without any checks internally. Which is why I think there should be something around it to go: This can cause problems. Are you sure?
4 years 10 months ago #38876

Please Log in or Create an account to join the conversation.

  • Posts: 257
  • Thank you received: 22

You might get collaborative help on this if you start a new thread suggesting it. Something like: Teenastro Development might do the trick. I think it would limit cross talk if we did that. Let us know if you make one so we can subscribe and help out too.
4 years 10 months ago #38923

Please Log in or Create an account to join the conversation.

Time to create page: 1.207 seconds