Subroutine setup and execution

Anything that doesn't fit into any of the other forums
Post Reply
yomamma
Posts: 54
Joined: Wed Mar 01, 2023 4:58 pm

Subroutine setup and execution

#1

Post by yomamma »

I have been trying to test my Sequencer scripts and I have a subroutine called GoToDSO in a scs file as follows:

SEQUENCE
DEF SUB GotoDSO
PRESERVE CAMERA SETTINGS
LIVE MODE
LOAD PROFILE "TestDSO (Test Camera 1 (Deep Sky))"
MOUNT GOTO RA=05:35:17,DEC=-05:23:28
DELAY 60
MOUNT SOLVEANDSYNC
DELAY 60
END PRESERVE
END SUB
END SEQUENCE

I set up a test call run as follows:

SEQUENCE
IMPORT SUBS FROM C:\Users\drobe\Documents\Sharpcap\GotoDSO.scs
GOSUB GoToDSO
END SEQUENCE

The Sequencer does not recognize the subroutine after I have loaded it into the run and I am not sure how the subroutine should be addressed.
Here is the sequencer run

12:13:58 PM Starting : Sequence
12:13:58 PM Starting : Import subroutines in C:\Users\drobe\Documents\Sharpcap\GotoDSO.scs
12:13:58 PM Starting : Define a subroutine called 'GotoDSO'
12:13:58 PM Completed : Define a subroutine called 'GotoDSO'
12:13:58 PM Completed : Import subroutines in C:\Users\drobe\Documents\Sharpcap\GotoDSO.scs
12:13:58 PM Starting : Call a previously defined subroutine called 'GoToDSO'
12:13:58 PM Error : 'A subroutine named GoToDSO has not been defined' while running step Call a previously defined subroutine called 'GoToDSO'
12:13:59 PM End : Sequence halted due to error.
12:13:59 PM Finished

How do you get the subroutine registered with the main program and how should I call it?

Thanks for your help
User avatar
admin
Site Admin
Posts: 13349
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: Subroutine setup and execution

#2

Post by admin »

Hi,

subroutine names are case sensitive, so the problem here is that you have named it 'GotoDSO' but are using 'GoToDSO' to call it. I had to run it under the debugger before I spotted it - perhaps I should remove the case sensitivity!

cheers,

Robin
yomamma
Posts: 54
Joined: Wed Mar 01, 2023 4:58 pm

Re: Subroutine setup and execution

#3

Post by yomamma »

Thanks I should have caught that I was looking to make sure DSO was all caps and missed the problem
Should the subroutines show in the drop down box? Mine dont
User avatar
admin
Site Admin
Posts: 13349
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: Subroutine setup and execution

#4

Post by admin »

Hi,

today's update makes calling a subroutine case insensitive. It should also show the names of subroutines in imported sequences in the dropdown to avoid the mismatch issue in the first place.

cheers,

Robin
yomamma
Posts: 54
Joined: Wed Mar 01, 2023 4:58 pm

Re: Subroutine setup and execution

#5

Post by yomamma »

admin wrote: Mon Jun 19, 2023 1:49 pm Hi,

today's update makes calling a subroutine case insensitive. It should also show the names of subroutines in imported sequences in the dropdown to avoid the mismatch issue in the first place.

cheers,

Robin
Thanks Robin. I really like your approach to the scripting process it dramatically shortens development time as I no longer make massive numbers of syntax errors and the commands offered seem to cover everything that needs to be done. I'll be testing this as soon as we have clear skies(an oxymoron here in north Florida in the summer) and when I get it working properly will post the final script
Jupiter
Posts: 24
Joined: Mon Nov 01, 2021 4:56 pm

Re: Subroutine setup and execution

#6

Post by Jupiter »

Hopefully not wearing out my welcome here, but another question: I am trying to use the "import subroutines" call in the sequence editor but I can't figure out how to refer to the imported subroutine...it would seem like it should show up in the drop down for the "run subroutine previously defined" but the dropdown is empty. The previous thread on this subject seems to indicate that the dropdown issue was rectified??

I was able to insert the subroutine name and make it work by using a manual editor so the problem (if there is one and I am not missing something) would appear to be in populating the drop down (which seems like an interesting task...the sequence editor would have to parse the imported file before execution to populate the drop down...I guess??). Thanks, yet again.
Jupiter
Posts: 24
Joined: Mon Nov 01, 2021 4:56 pm

Re: Subroutine setup and execution

#7

Post by Jupiter »

Sorry, I forgot to mention I checked and I am running the latest release of Sharpcap.
User avatar
admin
Site Admin
Posts: 13349
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: Subroutine setup and execution

#8

Post by admin »

Hi,

you can type into the box of the dropdown to enter subroutine names. Unfortunately the 'smart' part of the editor that populates the values to show in the dropdown isn't quite smart enough to do the imports yet. I will try to fix that when I get a chance.

cheers,

Robin
Jupiter
Posts: 24
Joined: Mon Nov 01, 2021 4:56 pm

Re: Subroutine setup and execution

#9

Post by Jupiter »

Robin,
Thanks for your response. No rush on my part on the "smart" dropdown. Just wanted to confirm I was not missing something obvious (which I have done several times in the last few weeks working in the script/sequencer).
Post Reply