Пример #1
0
 def do_save_htp(self, args):
     """Save humidity, temperature and pressure data on SD card"""
     # TODO: no command in dict
     try:
         obccom.send(self, self.command_dict["save_htp"])
     except KeyError:
         log_exception("Wrong key. Check dictionary")
Пример #2
0
 def do_set_frequency(self, args):
     """set measurements' frequency according to arg value"""
     # TODO: no command in dict
     try:
         obccom.send(self, self.command_dict["set_frequency"] + args)
     except KeyError:
         log_exception("Wrong key. Check dictionary")
Пример #3
0
 def do_go_scanning(self, args):
     """Turn the scanning mode on"""
     try:
         obccom.send(self, self.command_dict["sudo_set_status"] + "1")
     except KeyError:
         log_exception("Wrong key. Check dictionary")
         return
     else:
         obccom.streamDown(self)
Пример #4
0
 def do_set_speed(self, args):
     # TODO: usunac speed2?
     """set selected (arg1 [1-2]) motor's speed (arg2 [0-255])"""
     arg1, arg2 = args.split()
     arg1 = int(arg1)
     arg2 = int(arg2)
     if (arg1 == 1 or arg1 == 2) and (arg2 > 0 and arg2 < 256):
         if arg1 == 1:
             self.speed1 = arg2
             log_info("speed of motor no 1 is set to {0}".format(arg2))
         elif arg1 == 2:
             self.speed2 = arg2
             log_info("speed of motor no 2 is set to {0}".format(arg2))
     elif not (arg1 == 1 or arg1 == 2):
         log_warning("First argument must be 1 or 2! Enter 'help' for more info")
         return
     else:
         log_warning("Second argument must be from 0-255!")
         return
     try:
         obccom.send(self, self.command_dict["set_speed"] + self.speed1)
     except KeyError:
         log_exception("Wrong key. Check dictionary")
Пример #5
0
 def do_mknlog(self, args):
     """make new logfile on SD card"""
     try:
         obccom.send(self, self.command_dict["mknlog"])
     except KeyError:
         log_exception("Wrong key. Check dictionary")
Пример #6
0
 def do_go_manual(self, args):
     """Enable additional commands: set_speed, set_frequency, mknlog, save_htp"""
     try:
         obccom.send(self, self.command_dict["sudo_set_status"] + "2")
     except KeyError:
         log_exception("Wrong key. Check dictionary")
Пример #7
0
 def do_go_idle(self, args):
     """Turn off the motors and data gathering"""
     try:
         obccom.send(self, self.command_dict["sudo_set_status"] + "0")
     except KeyError:
         log_exception("Wrong key. Check dictionary")
Пример #8
0
 def do_stopm(self, args):
     """Stop motors"""
     try:
         obccom.send(self, self.command_dict["sudo_stopm"])
     except KeyError:
         log_exception("Wrong key. Check dictionary")
Пример #9
0
 def do_downstream_off(self, args):
     """Stop downstream"""
     msg = "FFFFFF"
     obccom.send(self, msg)
Пример #10
0
 def do_downstream_on(self, args):
     """Send command to start downstream and start downstream"""
     msg = "FFFFFF"
     obccom.send(self, msg)
     obccom.streamDown(self)