Optimize Alpaca exchanges

Got an idea for something that SharpCap should do? Share it here.
Forum rules
'+1' posts are welcome in this area of the forums to indicate your support for a particular feature suggestion. Suggestions that get the most +1's will be seriously considered for inclusion in future versions of SharpCap.
Post Reply
cyrille.de.brebisson
Posts: 74
Joined: Sun Oct 01, 2023 4:42 pm

Optimize Alpaca exchanges

#1

Post by cyrille.de.brebisson »

Hello,

I am working on a mount based on an esp32 and am moving away from having an ascom driver on the computer as ascom is saying: move to alpaca or die (soon).

However, the way SharpCap sends Alpaca request to the esp32 is sub-optimal and is causing load on the system (I assume that I will not be the only one who suffers looking at how much esp are used in astro gear, amateur or professional :).

SharpCap sends 13 requests every 1/2 second to the mount (to get the "state").
This translates to 13 packets like this one (around 160 bytes).
"GET /api/v1/telescope/0/trackingrate?ClientID=1&ClientTransactionID=25899 HTTP/1.1
Host: 127.0.0.1
Accept: application/json
User-Agent: ASCOMAlpacaClient/2.2.1.0

"

Would it be possible to send all these request in a single TCP "send" instead of 13 separate send.
This would reduce the load on the esp32 by dropping the wifi count.
Furthermore, if you could drop the optional "Accept: application/json User-Agent: ASCOMAlpacaClient/2.2.1.0", this would save enough bytes to allow the full 13 request to fit in a single wifi frame.

It might also be possible to remove the request for the equatorialsystem which will not change once the mount has started..

Here are the 13 calls that I am seeing.
get_altitude -> 0.000000
get_azimuth -> 0.000000
get_sideofpier -> 1
get_targetrightascension -> 0.000000
get_targetdeclination -> 0.000000
get_equatorialsystem -> 2
get_tracking -> true
get_trackingrate -> 0
get_slewing -> false
get_rightascension -> 22.031948
get_declination -> 89.104324
get_atpark -> false
get_siderealtime -> er:ALPACA_ERR_VALUE_NOT_SET


In my case the problem is further increased because the same HW also handles the focuser, so I see these extra 4 calls:
get_connected -> true
get_ismoving -> false
get_position -> 32767
get_temperature -> er:ALPACA_ERR_ACTION_NOT_IMPLEMENTED

Thanks,
Cyrille
Post Reply