×

INDI Library v1.8.0 is Released (27 Jul 2019)

INDI Library v1.8.0 is mostly a maintenance release to fix a few bugs in several drivers.

Update port or baud rate

  • Posts: 50
  • Thank you received: 11

Replied by PDB on topic Update port or baud rate

I am reading the polulu guide, trying to understand what exactly needs to be sent. Will see if I can find a solution.

P
6 months 1 week ago #34892

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

  • Posts: 50
  • Thank you received: 11

Replied by PDB on topic Update port or baud rate

Try this, it compiles and sends data but can't check the result.

change command back to

uint8_t command[6]

change write to :

if ( (rc = tty_write(PortFD, (char *) command, sizeof(command), &nbytes_written)) != TTY_OK)
{
tty_error_msg(rc, errstr, MAXRBUF);
DEBUGF(INDI::Logger::DBG_ERROR, "Init error: %s.", errstr);
}


Dont't forget to correct alst exit_safe_start (That was currently sending no data (i forgot to set the data byte) maybe that caused your problems.

uint8_t command[] = { 0x83 };
(and cast in tty_write)

I think INDI sets the terminal raw as needed to send this binary data. So hopefully that works. Binary data on a ttyport can be interrpreted as contol chars if not all tyy settings are correct.

Looking at the doc it seems you can read the motor position from the device, so you could read that periodically (Timerhit) and wait until correct position is reached before accepting new commands. (Some programming needed, but should be possible)

Looks like an interesting motor controller, maye I should buy one for myself.

Regards,

Paul
6 months 1 week ago #34893

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

  • Posts: 50
  • Thank you received: 11

Replied by PDB on topic Update port or baud rate

I ordered one. Should arive tomorrow.

Paul
6 months 1 week ago #34895

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

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

Replied by HelgeMK on topic Update port or baud rate

Dear Paul, it is working now! I am really impressed, thank you very much once again for your support.

First, it did not work, then checked via the ticgui the status, and the motor needed to be re-energized (there is a button at the bottom of the GUI).

I uploaded the file in its latest version.

Best, Helge
6 months 1 week ago #34919
Attachments:

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

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

Replied by HelgeMK on topic Update port or baud rate

One more thing - tried different things to save the configuration for the port, in my case rfcomm1. Attchached the .cpp and .h file - but that did not work.

I hardly dare to ask again Paul - but in case weather conditions are again unfavorable, could you have a look? :-)
6 months 1 week ago #34949
Attachments:

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

  • Posts: 50
  • Thank you received: 11

Replied by PDB on topic Update port or baud rate

Must be a conflict between the built-in save-routine and your declarations. (Did you use the "save" button in the options panel?

So if you want to save your extra items, try this:

in the .h file change:
virtual bool saveConfigItems(FILE *fp);
to
virtual bool saveConfigItems(FILE * fp) override;

in the c++ code add just before line 320:

INDI::Focuser::saveConfigItems(fp);

Rgrds,

Paul
The following user(s) said Thank You: HelgeMK
6 months 1 week ago #34961

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

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

Replied by HelgeMK on topic Update port or baud rate

Hi Paul, it works, I am really pleased - thank you once again!!

Attached just a picture of the TIC825 with the HC-05 module.
Last edit: 6 months 1 week ago by HelgeMK.
6 months 1 week ago #34979
Attachments:

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

  • Posts: 50
  • Thank you received: 11

Replied by PDB on topic Update port or baud rate

That looks very good. (got my tic yesterday and now trying to make a driver that talks directly to the tic over the usb port. Still have to decide if I go for that or put an arduino nano in between and make a moonlite compatible protocol) If I do direct USB the board is soo small it can be fixed to the motor (so no risc of blowing the 8825 driver when connecting/disconnecting the motor when the board is powered)

Paul
6 months 1 week ago #34982

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

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

Replied by HelgeMK on topic Update port or baud rate

Hi, in principle, the focuser works as it is supposed to, but upon connection, I am having difficulties to get the stepper going (in the Ticgui I am getting an error message, which says that the stepper has been de-energized because of a “safe start violation error“. Once clicking on the resume button, it is all working.

I started to compare the code example on the Pololu website, to compare it to my driver. Thanks to the incredible support of Paul, I am now leveraging on the INDI API. Practically, there is a function called „handshake“, which I assumes opens up the serial port. Unfortunately, I do not find anything in the documentation what is exactly happening code-wise, for instance is something like this implemented, or any options set, or is there e.g. a tcflush command applied?
fd = open(device, O_RDWR | O_NOCTTY);

Many thanks in advance for any support!

Helge
5 months 2 weeks ago #35846

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

  • Posts: 50
  • Thank you received: 11

Replied by PDB on topic Update port or baud rate

Hi,

the handshake function will not be usefull here. It is used to decide if you are talking to the correct device. (send command, get response and check, return true if ok)

What you need to do is energize the motor. ( www.pololu.com/docs/0J71/8#cmd-energize )
This is a quick command and only requiers one byte to send (command code)

Had the same problems in my implementation, and solved it by doing this. (But since I talk directly to the USB i use the API commands, not the serial commands)

After that you will need to think about the position of focuser and steppermotor. If you don't take power of the motor stepper position will be were you left it. When power/off power/on it will probably be 0 (also seen negative values) so I am still thinking about a sort of calibration routine. (probably with a limit switch and homing mode to calibrate at absolute 0) ....

Now I am struggling to make an ASCOM driver :-( How much I like Indi, can't live without Win for fast usb connection. And my main area is solar astrophotography were I need the fastest USB camera rate I can get. (And Linux, or the drivers could not coop with that. )

This is my current Connect, you will need to translate Tic commands to their serial equivalent

bool TicFocusUsb::Connect()
{
DEBUGF(INDI::Logger::DBG_SESSION, "TiFocus searching for :%s:", desired_serial_number);
std::vector<tic::device> list = tic::list_connected_devices();
// Iterate through the list and select one device.
for (const tic::device & device : list)
{
DEBUGF(INDI::Logger::DBG_SESSION, "TicFocus has got:%s:", device.get_serial_number().c_str());
if (strcmp(desired_serial_number, "Any") &&
(strcmp(desired_serial_number, device.get_serial_number().c_str())))

// Found a device with the wrong serial number, so continue on to
// the next device in the list.
continue;
ticDev = tic::handle(device);
tic::variables vars = ticDev.get_variables();

currentPosition = vars.get_current_position();

if (currentPosition < 0) ticDev.halt_and_set_position(0);
curStepMode =vars.get_step_mode();
ticDev.set_max_speed(500000000);


ticDev.energize();
SetTimer(POLLMS);
ticDev.go_home(0);
return true;
}
DEBUG(INDI::Logger::DBG_SESSION, "No device found");
return IPS_IDLE;
}


Regards,

Paul
5 months 2 weeks ago #35852

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

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

Replied by HelgeMK on topic Update port or baud rate

Hi Paul,

I actually tried already whether it can be addressed by sending the „energize“ command. I wonder if it might have been wrong to send this command within the „handshake“ function, in-between the {} brackets?

Still wonder where in the code the port is actually opened, if this is not taking place during the handshake, how does the driver know the value for PortFD, where are the options set, as it happens within the Pololu code example - or is it technically not required. Probably I am ignoring something very basic.

Unfortunately I have no experience with ASCOM, so I cannot help. Amazing to here about the difference in speed, depending on OS. Hope you soon find a solution!

Best, Helge
5 months 2 weeks ago #35862

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

  • Posts: 50
  • Thank you received: 11

Replied by PDB on topic Update port or baud rate

Hi,

"Still wonder where in the code the port is actually opened"

Well hidden in the code. Look at indifocuser.cpp in the libs/indibase folder. That contains the base focuser class which you extends (? if that is the correct word for it) That inludes things from the connectionplugins folder including handling serial io.

I was wrong in my previous answer. Handshake should be the place to send the energize command in your case. (Since my version does not use serial or network, I had to re-impement the Connect method where I placed the code)

Regards,

Paul

PS: look at a few sources of other drivers, always a good source to see how these implemented some functions.
(and got a basic ASCOM driver working yesterday)
5 months 2 weeks ago #35887

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

Time to create page: 0.774 seconds