×

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

Bi-monthly release with minor bug fixes and improvements

Update port or baud rate

  • Posts: 281
  • Thank you received: 29

Replied by Helge on topic Update port or baud rate

Hi Paul,

Congrats on the ASCOM driver - would be curious to learn more about your project at some stage!

Thanks for pointing me to the github libraries. I found here in line 242 and following what I was looking for, especially line 255 which seems to be the one opening the port.

github.com/indilib/indi/blob/master/libi...nplugins/ttybase.cpp

But how does it work? When „handshake“ is called, what is the „chain of events“ that the above lines of code are executed? I am missing the kind of conceptual link. I have already been reading some tutorials about c++ programming and have some basic ideas about the concept of classes, but this is beyond my skills, but would be very keen to understand the logic!

I also looked at some other drivers, like onstep, smartfocus, nstep and can see that they all use the handshake - in that sense they are similar.

Best, Helge
5 years 3 weeks ago #35913

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

ttybase.cpp is not used in the current code. It is a proposal to move to a better more customizable solution than the current indicom implementation.

Last week, I started adding a few Skeleton drivers that you can modify and base your drivers on. Right now there are focuser and mount drivers, but I should add more with time. It is a great starting template for developing new drivers.

For serial drivers, the process is simple as you do not need to handle the serial connection yourself. After the user presses "Connect", the INDI::Focuser class establishes the connection and then call Handshake(). So at this point, you need to make sure you can communicate with the focuser. By now, you have a valid PortFD file descriptor that you can use with indicom's tty_XXX functions. However, I added a function called sendCommand that is better be used instead of direct tty_read or tty_write functions. Now I use this function in all the serial drivers since it makes things so much easier.
The following user(s) said Thank You: Helge
5 years 3 weeks ago #35943

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

  • Posts: 220
  • Thank you received: 27

Replied by PDB on topic Update port or baud rate

Hello Jasem,

will give these new skeletons a try (when I have time ....). That is probably an easier way to start a new driver than starting from some existing thing and forgetting to clean out not neededcode.

Paul
5 years 3 weeks ago #35944

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

  • Posts: 281
  • Thank you received: 29

Replied by Helge on topic Update port or baud rate

Hi Jasem,

Many thanks for the explanation and for providing the mentioned Skeleton drivers!

In my reference code for the Pololu stepper controller, there are a couple of configurations defined, for instance:

www.pololu.com/docs/0J71/12.5

// Turn off any options that might interfere with our ability to send and
// receive raw binary bytes.
options.c_iflag &= ~(INLCR | IGNCR | ICRNL | IXON | IXOFF);
options.c_oflag &= ~(ONLCR | OCRNL);
options.c_lflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN);

// Set up timeouts: Calls to read() will return as soon as there is
// at least one byte available or when 100 ms has passed.
options.c_cc[VTIME] = 1;
options.c_cc[VMIN] = 0;

Are similar settings also initiated in the course of establishing the connection (upon pressing the connect button), or do I have to take of that in the driver myself?

Best, Helge
5 years 3 weeks ago #35983

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

  • Posts: 220
  • Thank you received: 27

Replied by PDB on topic Update port or baud rate

Hello Helge,

can't anwer that last question, that is something for Jasem.

But if I understand your setup correctly it is : Stepper <> PololuTic <> BT module <> BTinterface via Serial Port on Linux.
So actually you will be sending data to the BT thing. Is that completely transparant or can charachters be mangled op there as well? (Same question would come up when TX/RX pin op the Tic are connected to a serial/usb converter ...) An't test that because I have no BT stuff and connect directly to the TIC over USB. (more control, only difficult thing was compile the TIC api in a library)

Paul
5 years 3 weeks ago #35986

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


I'd say only start worrying about these details if you cannot establish any communication in the handshake function. So start there and try to use sendCommand() to send something to the device and try to get some response back. If that fails, then start looking deeper into the serial communication low-level settings. Most likely you won't need to change a thing.
The following user(s) said Thank You: Helge
5 years 3 weeks ago #35994

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

Time to create page: 0.424 seconds