Skip to content

Commit

Permalink
Update DeepskyLog import of instruments (#271)
Browse files Browse the repository at this point in the history
* Use new instruments table when importing from DeepskyLog.

* Use new instruments table when importing from DeepskyLog.

* Fix changing telescope from the PiFinder menu.
  • Loading branch information
WimDeMeester authored Feb 4, 2025
1 parent 4874c2c commit 7665bda
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 25 deletions.
36 changes: 13 additions & 23 deletions python/PiFinder/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,14 @@ def equipment_import():
# Skip the naked eye
continue

make = instrument["instrument_make"]["name"]

obstruction_perc = instrument["obstruction_perc"]
if obstruction_perc is None:
obstruction_perc = 0
else:
obstruction_perc = float(obstruction_perc)

# Convert the html special characters (ampersand, quote, ...) in instrument["name"]
# to the corresponding character
instrument["name"] = instrument["name"].replace("&", "&")
Expand All @@ -355,33 +363,15 @@ def equipment_import():
instrument["name"] = instrument["name"].replace("&lt;", "<")
instrument["name"] = instrument["name"].replace("&gt;", ">")

flip = False
flop = False

if (
instrument["type"] == 2
or instrument["type"] == 4
or instrument["type"] == 6
or instrument["type"] == 8
or instrument["type"] == 9
):
# Refractor (2), Finderscope (4), Cassegrain (6), Maksutov (8), Schmidt Cassegrain (9)
flip = True
flop = False
elif instrument["type"] == 3 or instrument["type"] == 7:
# Reflector (3), Kutter (7)
flip = True
flop = True

new_instrument = Telescope(
make="",
make=make,
name=instrument["name"],
aperture_mm=int(instrument["diameter"]),
focal_length_mm=int(instrument["diameter"] * instrument["fd"]),
obstruction_perc=0,
mount_type="alt/az",
flip_image=flip,
flop_image=flop,
obstruction_perc=obstruction_perc,
mount_type=instrument["mount_type"]["name"].lower(),
flip_image=bool(instrument["flip_image"]),
flop_image=bool(instrument["flop_image"]),
reverse_arrow_a=False,
reverse_arrow_b=False,
)
Expand Down
2 changes: 1 addition & 1 deletion python/PiFinder/ui/menu_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def dyn_menu_equipment(cfg):
"class": UITextMenu,
"select": "single",
"label": "select_telescope",
"config_option": "equipment.actice_telescope",
"config_option": "equipment.active_telescope",
"items": telescope_menu_items,
}

Expand Down
2 changes: 1 addition & 1 deletion python/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ luma.lcd==2.11.0
pillow==10.4.0
numpy==1.26.2
pandas==1.5.3
pydeepskylog==1.3.1
pydeepskylog==1.3.2
pyjwt==2.8.0
pytz==2022.7.1
requests==2.28.2
Expand Down

0 comments on commit 7665bda

Please sign in to comment.