Commit fc092b385c8abdae5c69a68953c9fa3adc6ba6b9

Authored by Alain Klotz
1 parent 1b27fed2
Exists in dev

Mise à jour de TNC Raspberry.

mount_tnc/raspberry/mountastro.py
... ... @@ -843,7 +843,7 @@ class Mountastro(Mounttools):
843 843 axisb.simu_motion_start("CONTINUOUS", frame='ang', drift=ha_drift_deg_per_sec)
844 844 axisp.simu_motion_start("CONTINUOUS", frame='ang', drift=dec_drift_deg_per_sec)
845 845 # === Real hardware
846   - err, res = self._my_hadec_move_stop(ha_drift_deg_per_sec, dec_drift_deg_per_sec)
  846 + err, res = self._my_hadec_move_stop()
847 847 return err, res
848 848  
849 849 def _my_hadec_stop(self):
... ... @@ -1326,6 +1326,55 @@ class Mountastro(Mounttools):
1326 1326 self.radec_init(self._lx200_setra_deg, self._lx200_setdec_deg)
1327 1327 elif command.startswith(":MS")==True:
1328 1328 self.radec_goto(self._lx200_setra_deg, self._lx200_setdec_deg)
  1329 + if self._remote_command_protocol=="astromecca":
  1330 + if command.startswith(chr(6))==True:
  1331 + res = "P"
  1332 + elif command.startswith(":Gg")==True:
  1333 + deg = self.site.longitude
  1334 + res = celme.Angle(deg).sexagesimal("d +0180")
  1335 + res = res[0:4] + "*" + res[5:7]
  1336 + """
  1337 + while True:
  1338 + # --- read the ASCOM commands
  1339 + lignes = ""
  1340 + try:
  1341 + err, lignes = ascom_chan.read_chan()
  1342 + #print("lignes = {}".format(lignes))
  1343 + lignes = str(lignes[0])
  1344 + except:
  1345 + pass
  1346 + if err==ascom_chan.NO_ERROR and lignes != "":
  1347 + mount_scx11.log.print("===\nlignes recu ={}".format(lignes))
  1348 + mots = lignes.split()
  1349 + mount_scx11.log.print("mots recus ={}".format(mots))
  1350 + msg = ""
  1351 + # --- traiter la ligne recue de ASCOM
  1352 + if lignes.startswith("READ_RA")==True:
  1353 + # --- on traite un goto
  1354 + ra, dec, side = mount_scx11.radec_coord(UNIT_RA="deg")
  1355 + mount_scx11.log.print("{} ra={}".format(mots[0],ra))
  1356 + msg = str( float(ra)/15.)
  1357 + if lignes.startswith("READ_DEC")==True:
  1358 + # --- on traite un goto
  1359 + ra, dec, side = mount_scx11.radec_coord(UNIT_DEC="deg")
  1360 + mount_scx11.log.print("{} dec={}".format(mots[0],dec))
  1361 + msg = str(dec)
  1362 + # --- traiter la ligne recue de ASCOM
  1363 + if lignes.startswith("GOTO_RA_DEC")==True:
  1364 + ra = float(mots[1])*15.
  1365 + dec = float(mots[2])
  1366 + mount_scx11.log.print("{} ra={} dec={}".format(mots[0],ra,dec))
  1367 + mount_scx11.radec_goto(ra, dec, EQUINOX="NOW")
  1368 + if lignes.startswith("PARK")==True:
  1369 + ha = 270.0
  1370 + dec = 90.0
  1371 + side = 1
  1372 + mount_scx11.log.print("{} ha={} dec={} side={}".format(mots[0],ra,dec,side))
  1373 + mount_scx11.hadec_goto(ha, dec, side=side)
  1374 + # --- send the EQMOD answer to ASCOM
  1375 + mount_scx11.log.print("msg renvoyé ={}".format(msg))
  1376 + ascom_chan.put_chan(msg)
  1377 + """
1329 1378 else:
1330 1379 pass
1331 1380 if res=="":
... ...
mount_tnc/raspberry/universalpad.py
... ... @@ -220,7 +220,9 @@ class UniversalPadRepeat(Thread):
220 220 try:
221 221 self._myself.pad_cbk_compute_lst()
222 222 self._myself.pad_cbk_compute_coord()
  223 + #print("ok 1001")
223 224 except:
  225 + #print("pb 1001")
224 226 pass
225 227 time.sleep(0.5)
226 228 msg = "The thread UniversalPadRepeat termined properly"
... ... @@ -250,7 +252,7 @@ class UniversalPad():
250 252 # --- configuration depending the computer
251 253 if hostname == "titanium":
252 254 print("Configuration = {}".format(hostname))
253   - port_serial_scx11='//./com6' ; # '//./com4'
  255 + port_serial_scx11='//./com12' ; # '//./com4'
254 256 port_serial_aux='//./com1'
255 257 elif hostname == "rapido2":
256 258 print("Configuration = {}".format(hostname))
... ... @@ -275,12 +277,18 @@ class UniversalPad():
275 277 # --- shortcuts
276 278 self._themount_axisb = self._themount.axis[Mountaxis.BASE]
277 279 self._themount_axisp = self._themount.axis[Mountaxis.POLAR]
278   - # --- simulation or not
279   - self._themount_axisb.real = False
  280 + # --- simulation or not
  281 + mount_mode = self.padconfig['mount_mode']
  282 + if mount_mode=="simulation":
  283 + mount_mode_real = False
  284 + else:
  285 + mount_mode_real = True
  286 + print("mount_mode={}".format(mount_mode))
  287 + self._themount_axisb.real = mount_mode_real
280 288 self._themount_axisb.ratio_wheel_puley = 6.32721
281 289 self._themount_axisb.inc_per_motor_rev = 1540 # DPR for -490000 to +490000
282 290 self._themount_axisb.senseinc = 1
283   - self._themount_axisp.real = False
  291 + self._themount_axisp.real = mount_mode_real
284 292 self._themount_axisp.ratio_wheel_puley = 6.8262
285 293 self._themount_axisp.inc_per_motor_rev = 1421
286 294 self._themount_axisp.senseinc = -1
... ... @@ -336,8 +344,8 @@ class UniversalPad():
336 344 self._themount.hadec_goto(ha, dec, side=theside, blocking=False)
337 345  
338 346 def pad_cbk_name2coord(self):
339   - name =self.pad_var_object_name.get()
340 347 with lock:
  348 + name =self.pad_var_object_name.get()
341 349 tools = Mounttools()
342 350 found, ra, dec= tools.name2coord(name)
343 351 if found==1:
... ... @@ -363,26 +371,29 @@ class UniversalPad():
363 371 self._themount.radec_goto(ra, dec, side=theside, blocking=False)
364 372  
365 373 def pad_cbk_compute_coord(self):
  374 + # --- do not lock this function !!!
366 375 err = self.NO_ERROR
367   - with lock:
368   - try:
369   - if self._themount!=None:
  376 + try:
  377 + if self._themount!=None:
  378 + with lock:
370 379 ha, dec, side = self._themount.hadec_coord()
371   - else:
372   - ha, dec, side = (0, 0, 0)
373   - coord = "H.A.="+str(ha)+" Dec="+str(dec)+" "+str(side)
374   - self.pad_var_coord.set(coord)
375   - #
376   - if self._themount!=None:
  380 + else:
  381 + ha, dec, side = (0, 0, 0)
  382 + coord = "H.A.="+str(ha)+" Dec="+str(dec)+" "+str(side)
  383 + self.pad_var_coord.set(coord)
  384 + #
  385 + if self._themount!=None:
  386 + with lock:
377 387 ra2000, dec2000, side_radec = self._themount.radec_coord(EQUINOX="J2000")
378   - else:
379   - ra2000, dec2000, side_radec = (0, 0, 0)
380   - coord = "R.A.="+str(ra2000)+" Dec="+str(dec2000)+" "+str(side_radec)
381   - self.pad_var_radec_coord.set(coord)
382   - except:
383   - print("pb coord")
384   - ha, dec, side = (0,0,0)
385   - err= self.ERR_UNKNOWN
  388 + else:
  389 + ra2000, dec2000, side_radec = (0, 0, 0)
  390 + coord = "R.A.="+str(ra2000)+" Dec="+str(dec2000)+" "+str(side_radec)
  391 + self.pad_var_radec_coord.set(coord)
  392 + print("pad_cbk_compute_coord={}".format(coord))
  393 + except:
  394 + print("pb coord")
  395 + ha, dec, side = (0,0,0)
  396 + err= self.ERR_UNKNOWN
386 397 return err, ha, dec, side
387 398  
388 399 def pad_cbk_coord_detailed(self):
... ... @@ -450,6 +461,10 @@ class UniversalPad():
450 461 self._themount.goto_park()
451 462  
452 463 def pad_cbk_quit(self):
  464 + try:
  465 + self._themount.close_chan()
  466 + except:
  467 + pass
453 468 self.pad_gui_delete()
454 469  
455 470 def pad_cbk_console(self, event):
... ... @@ -518,6 +533,7 @@ class UniversalPad():
518 533 lst_hms = ang.sexagesimal("H0.0")
519 534 self.pad_var_date.set("UTC {}".format(dateiso))
520 535 self.pad_var_lst.set("Local Sideral Time {}".format(lst_hms))
  536 + lock.release()
521 537  
522 538 def pad_gui_delete(self):
523 539 # --- kill the threads
... ...