×

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
Hi James,

I have a strange behavior with OnStep.
1) Site Management Tab
2) Set a Site name
3)When selecting another Site Onstep Crashes

I am trying to debug but found nothing so far
Any idea?

kstars 3.5.6 Beta
INDI Library: 1.9.3
Code v1.9.2-21-g2ea67102f. Protocol 1.7.
OnStep 4.24.k
Last edit: 2 years 5 months ago by Alain Zwingelstein.
2 years 5 months ago #76688

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

  • Posts: 161
  • Thank you received: 39
Sorry for not replying, this was getting annoying to track down. It's not directly an OnStep issue, but seems to be a more general LX200telescope one.

There are 2 ways to fix it.

First a description of the problem:
It's these two lines in lx200telescope.cpp @about 684:
IText *tp = IUFindText(&SiteNameTP, names[0]);
IUSaveText(tp, texts[0]); IDSetText(&SiteNameTP, "Site name updated");

It will then crash when these lines are called about 870, actually on the IDSetSwitch(&SiteNameTP, nullptr) when it tries to send it out, but the reason is:
if (isSimulation())
IUSaveText(&SiteNameTP.tp[0], "Sample Site");
else {
getSiteName(PortFD, SiteNameTP.tp[0].text, currentSiteNum);

Now, The reason it crashes is that IUSaveText will reallocate the string length to strlen()+1 (for null) It's originally allocated as (about 1225):
SiteNameT[0].text = new char[64];

IUSaveText does this (literally the only line function):
tp->text = strcpy(realloc(tp->text, strlen(newtext) + 1), newtext);

So as long as the getSiteName method of calling the pointer directly (SiteNameTP.tp[0].text) is used, and no IUSaveText is, it's good. When it's used as the getSiteName, (Changing sites) it has a shortened string, and dies when trying to send the XML out. Which is why it only dies only after a change of site, and fetches the changed to site's name.

First fix is to avoid reallocation in the set function :
strncpy(SiteNameTP.tp[0].text,texts[0],64);
IDSetText(&SiteNameTP, "Site name updated");


The Second is to modify the getSiteName to also use IUSaveText:
if (isSimulation())
IUSaveText(&SiteNameTP.tp[0], "Sample Site"); //Update this as well? Under sim, it doesn't seem to crash.
else {
//getSiteName(PortFD, SiteNameTP.tp[0].text, currentSiteNum); //Original Call
char temp_site_name[64] = {0};
getSiteName(PortFD, temp_site_name, currentSiteNum);
IText *tp = IUFindText(&SiteNameTP, "Name"); //Should change the line ( IUFillText(&SiteNameT[0], "Name", "", "");) so it's not just 'Name'?
IUSaveText(tp, temp_site_name);
}

@knro, Any preference on which way is more proper/better for INDI? It looks like lx200pulsar2.cpp uses the getSiteName method and if the 2nd solution is chosen it would need to be updated as well. I'm inclined to use the first solution, as it's simpler, and there seem to be a few
The following user(s) said Thank You: Alain Zwingelstein
Last edit: 2 years 5 months ago by james_lan. Reason: Stupid formatting!
2 years 5 months ago #76974

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

I pushed a fix to this, please test from Git.
The following user(s) said Thank You: Alain Zwingelstein
2 years 4 months ago #77074

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

  • Posts: 452
  • Thank you received: 71
@Jasem,

I checked the fix but still have kstars crash when clicking on the "Set" button for Site Names (in the Site Management Panel)
2 years 4 months ago #77080

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

I can't reproduce the crash here (with LX200 Autostar simulator) when setting the site name. Are you sure you compiled from latest GIT and installed?
2 years 4 months ago #77090

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

  • Posts: 452
  • Thank you received: 71
In fact it is true, with the simulator there is no bug!
An yes, I installed and compiled the latest git source.
I tested with LX200_Classic, LX200_Basic, LX200_OnStep in real situation (controller attached)
Last edit: 2 years 4 months ago by Alain Zwingelstein.
2 years 4 months ago #77092

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

  • Posts: 65
  • Thank you received: 4
Hi Jasem, i installed Indi server on my Raspberry Pi via APT.

My question is when is the APT repository updated? At the same time has the github repository?

I would prefer to stick to apt update/upgrades if i could.

Thanks,
Chad
2 years 4 months ago #77096

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

  • Posts: 161
  • Thank you received: 39
Simulator just assigns it, so never calls IUUpateText

Each call to getSiteName needs to be changed. I have added a pull request which should fix all the remaining locations.

github.com/indilib/indi/pull/1550

And because I suck at git branches, you can check directly from github.com/james-lan/indi
The following user(s) said Thank You: Alain Zwingelstein
Last edit: 2 years 4 months ago by james_lan. Reason: added links
2 years 4 months ago #77101

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

  • Posts: 452
  • Thank you received: 71
@Jame, @Jasem,

I just built the last git and it works fine.
I tested with Onstep and with all lx200 variants (Classic ...)
The following user(s) said Thank You: james_lan
2 years 4 months ago #77140

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

  • Posts: 65
  • Thank you received: 4
@james_lan try Github desktop.  When i started to use it git started to make more sense too me.

desktop.github.com/
2 years 4 months ago #77145

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

  • Posts: 161
  • Thank you received: 39
It makes sense, I'm just easily distracted. (If you look at the last commits, there's one where I fixed something, committed, pushed, and forgot to actually save the fix.)

Also that doesn't work on Linux.
2 years 4 months ago #77157

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

  • Posts: 322
  • Thank you received: 31
Lots of errors and issues in today's update from Jasem's PPA.

indi-bin 1.9.3~202111111245~ubuntu18.04.1
libindi-data 1.9.3~202111111245~ubuntu18.04.1

All this with OnStep 4.24m.

First, there is the "unable to parse respone".
Then, the error setting site latitude coordinates (I have KStars set time and location of other devices).

And it tries to access focusers, although I have none enabled.

And when I try to slew to any object, nothing happens.

2021-11-11T23:27:57: [INFO] Initialization Complete
2021-11-11T23:27:57: [INFO] Mount is unparked.
2021-11-11T23:27:57: [INFO] Rotator found.
2021-11-11T23:27:57: [INFO] Focuser 2 found
2021-11-11T23:27:57: [INFO] Focuser 1 found
2021-11-11T23:27:57: [INFO] =============== Parkdata loaded
2021-11-11T23:27:57: [INFO] Mount is unparked.
2021-11-11T23:27:57: [INFO] OnStep/OnStepX version could not be detected
2021-11-11T23:28:42: [INFO] Focuser 2 called, but returned error -4 on read, disabling further polling
2021-11-11T23:27:57: [INFO] Device configuration applied.
2021-11-11T23:27:57: [INFO] Pulse guiding is enabled.
2021-11-11T23:27:57: [INFO] Setting Max Slew Rate to 5 (8x)
2021-11-11T23:27:57: [ERROR] Error setting site latitude coordinates
2021-11-11T23:27:57: [WARNING] Dome Policy set to: Dome locks. This prevents the mount from unparking when dome is parked.
2021-11-11T23:27:57: [INFO] Loading device configuration...
2021-11-11T23:27:57: [INFO] Initialization Complete
2021-11-11T23:27:57: [INFO] Mount is unparked.
2021-11-11T23:27:56: [INFO] No Rotator found.
2021-11-11T23:27:56: [ERROR] Unable to parse response.
2021-11-11T23:27:56: [INFO] No Focusers found
2021-11-11T23:27:56: [INFO] Function call failed, stopping Focuser probe, return: -4
2021-11-11T23:27:56: [INFO] Focuser 2 NOT found (Checking for OnStepX Focusers)
2021-11-11T23:27:56: [INFO] Focuser 1 NOT found
2021-11-11T23:27:56: [INFO] =============== Parkdata loaded
2021-11-11T23:27:56: [INFO] Mount is unparked.
2021-11-11T23:27:56: [INFO] V4 OnStep detected, setting some defaults
2021-11-11T23:27:56: [INFO] Mount has Latitude 43:nn:0.0 (43.nn) Longitude -80:nn:0.0 (-80.nn) (Longitude sign in carthography format)
2021-11-11T23:27:56: [INFO] LX200 OnStep is online.
2021-11-11T23:27:55: [INFO] Connecting to 192.168.0.21@9998 ...
2021-11-11T23:27:55: [INFO] Debug is enabled.
2 years 4 months ago #77497

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

Time to create page: 1.008 seconds