×

INDI Library v1.7.6 Released. (27 Feb 2019)

First release of 2019 comes with quite a few new drivers across the board along with significant performance improvements to INDI camera and live streaming performance. Many drivers received significant updates to improve performance & stability, while a few were re-written from scratch to be in line with INDI standards. Here are some of the highlights:

Update port or baud rate

  • Posts: 302
  • Karma: 1
  • Thank you received: 30

Update port or baud rate was created by HelgeMK

I am trying to get my head around, how I can update via the client for instance the port or the baud rate. I have been reading thru the INDI description, such as this chapter (serial class reference):

www.indilib.org/api/classConnection_1_1S...f47bea477d737ffc69aa

When working on the cpp-code of my focuser driver, I can see how the updating for instance of the stepmode work, starting with

bool FocusTic::ISNewNumber (const char *dev, const char *name, double values[], char *names[], int n)

Then: if (strcmp(StepModeSP.name, name) == 0) and further lines of code follow

What do I have to do to update the port or baud rate? Seems to me it is not working in the same way.
2 months 4 weeks ago #33997

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

  • Posts: 302
  • Karma: 1
  • Thank you received: 30

Replied by HelgeMK on topic Update port or baud rate

Found here the connectionserial.cpp code

www.indilib.org/api/connectionserial_8cpp_source.html

To be able to update the baudrate- would it just be a matter of copying some lines of code, see for instance row 32 and 83, and include the connectionserial.h file in my code?

Many thanks in advance for any guidance
2 months 4 weeks ago #34045

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

  • Posts: 302
  • Karma: 1
  • Thank you received: 30

Replied by HelgeMK on topic Update port or baud rate

Question resolved for baud rate, I have update the driver on github. For those interested, please have a look at the BT driver on github:

github.com/HelgeMK/TicFocuserBT

This is obviously not the first driver that allows updating the baud rate, in the INDI API documentation, there are plenty of other examples, e.g. robofocus driver.
The following user(s) said Thank You: knro
2 months 2 weeks ago #34542

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

  • Posts: 48
  • Thank you received: 11

Replied by PDB on topic Update port or baud rate

Sorry, but i do not really understand. Why bother with baudrate/port when to my mind this is handled by the standard framework. Done a few drivers for focusers now and never done anything for baud rate. Comes automatically in the "Connection Tab (wonder why it does not work for you ...)


Paul
2 months 2 weeks ago #34557

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

Replied by knro on topic Update port or baud rate

Paul is correct. I just checked the code.

1. write_port not required. use the standard tty_write in INDI.
2. tic_set_baud_rate is not required. If you want to set baud rate programatically, use the setDefaultBaudRate() function.
Jasem Mutlaq
Support INDI & Ekos; Get StellarMate Astrophotography Gadget.
How to Submit Logs when you have problems?
Add your observatory info
2 months 2 weeks ago #34562

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

  • Posts: 302
  • Karma: 1
  • Thank you received: 30

Replied by HelgeMK on topic Update port or baud rate

Dear Jasem, actually I thought about, but could not find out how to do. Maybe it is simple?

In my specific case, see line 115 - would I just replace the function call by

„tty_write(fd, command, sizeof(command), 0);

and that‘s it? So I can delete the function in rows 51 to 61? Any #include‘s or update of the .h file needed?

Apologies, but here I am really lacking of skills, was reading the API documentation again and again...
2 months 2 weeks ago #34593

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

  • Posts: 302
  • Karma: 1
  • Thank you received: 30

Replied by HelgeMK on topic Update port or baud rate

Hi Paul, thanks for your comments. The code I took from the Pololu user guide requires the setting of the port and baud rate. I wanted to avoid hard coding, so users can select the port and baud rate via the client.
2 months 2 weeks ago #34595

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

  • Posts: 48
  • Thank you received: 11

Replied by PDB on topic Update port or baud rate

Hi,

yes that is what is possible with the standard focuser framework. (Have a look at onfocus.c and onfocus.h sources in the the indi tree.)
I started my driver by looking at a simple one (nfocus or moonlite) as an example. Did not have to do anything to get port and baudrate configurable in the client ... (Sometimes INDI is simpler than it looks, sometimes not)

Regards,

Paul
2 months 2 weeks ago #34596

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

  • Posts: 302
  • Karma: 1
  • Thank you received: 30

Replied by HelgeMK on topic Update port or baud rate

Hi Paul, thanks for pointing me to onfocus.cpp! Does not look too complicated. I noted that you are including for this purpose the indictment.h file. What I am still wondering about: the variable PortFD - what value is assigned?

In my case, I have two Bluetooth ports: rfcomm0 (for EqMod) and rfcomm1 for the focuser.

My assumption would have been that PortFD would need to capture something like „/dev/rfcomm1“ (and not rfcomm0 accidentally).
2 months 2 weeks ago #34648

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

  • Posts: 48
  • Thank you received: 11

Replied by PDB on topic Update port or baud rate

Hi,
Sorry for the late answer. I was out for medical checkup.

If I understand the whole mechanism correctly (long time since I went through the docs) is all that handled by the standard focuser framework on which you extend functionality. (Sorry if terminology is incorrect, but I am an old-style programmer) So the whole setting / reading - writing of the device is taken care of by INDI. The PortFD will point to the devicename that is selected in the configuration tab (and that item is automatic).

What I noticed when doing some development: if you start a driver in indi and it crashes at startup there will be no config tab.

Do you compile the driver independent from the INDI tree? That might give some issues (not sure, maybe Jasem can explain that better)

Regards,

Paul
2 months 2 weeks ago #34703

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

  • Posts: 302
  • Karma: 1
  • Thank you received: 30

Replied by HelgeMK on topic Update port or baud rate

Hi Paul,

Hope all went well with your check-up!

I have been trying all sorts of things, to utilize the "tty_write()" command, but cannot get it compiled. To show my most recent attempts which resulted in a couple of error messages ("PortFD not declared in this scope)":

bool FocusTic::Handshake()
{}

const char * FocusTic::getDefaultName()
{
return "FocusTic";
}

bool FocusTic::Ack()
{
tcflush(PortFD, TCIOFLUSH);
}

int tic_set_target_position(int fd, int32_t target)
{
uint32_t value = target;
uint8_t command[6];
command[0] = 0xE0;
command[1] = ((value >> 7) & 1) |
((value >> 14) & 2) |
((value >> 21) & 4) |
((value >> 28) & 8);
command[2] = value >> 0 & 0x7F;
command[3] = value >> 8 & 0x7F;
command[4] = value >> 16 & 0x7F;
command[5] = value >> 24 & 0x7F;
return tty_write(PortFD, command, sizeof(command),0 );

// write_port(fd, command, sizeof(command));

}

For editing/compiling I am using the Qt editor, maybe there is something else I need to pay attention to?

Best, Helge
2 months 2 weeks ago #34723

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

  • Posts: 48
  • Thank you received: 11

Replied by PDB on topic Update port or baud rate

I only use console develoment and have set it up according to the instructions at indilib.org/develop/developer-manual/163...ent-environment.html
Then I create my cpp and h files and place then in libindi/drivers/focuser (for a focuser)

To compile I adapt the indi/libindi/CMakeLists.txt
there I add the lines for the driver

Something like this
################ OnFocus Focuser ################

SET(onfocus_SRC
${CMAKE_CURRENT_SOURCE_DIR}/drivers/focuser/onfocus.cpp)

add_executable(indi_onfocus_focus ${onfocus_SRC})
target_link_libraries(indi_onfocus_focus indidriver)
install(TARGETS indi_onfocus_focus RUNTIME DESTINATION bin)


Then I think you have to cmake again and then just make that should compile everything

For Qt think you also just have to add that to Cmakelists.txt (Since all my changes were simple did not need Qt debugging, usually could solve my bugs by just adding a few printf statements)

Hope this helps.

If you want to integrate your work in INDI, it gets a bit more complicated. You need to fork the repo, do your changes from your fork and then do a pull request . There is a tutorial for that somewhere on the INDI site as well.

Paul

PS: medical was Ok :)
2 months 2 weeks ago #34728

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

Time to create page: 0.681 seconds