Ejemplo n.º 1
0
    def run_step(self, sblink=False):
        millis = int(round(time.time() * 1000))
        self.step += 1
        self.time_flag[self.step] = millis
        self.notify_observers(self.step)
        config_list = self.CS_config[self.step]
        print(config_list[0])
        # take the row
        # turn on or off all the stimuli

        # turn on or off the delivery
        if config_list[2] == 0:
            if self.infuse == True:
                new_era.stop_pump(self.pser, self.pump)
                self.infuse = False
        elif config_list[2] == 1:
            if self.infuse == False:
                new_era.set_rate(self.pser, self.pump, flowrate)
                new_era.run_all(self.pser)
                self.infuse = True

        if config_list[1] == 0:
            self.ard.setLow(pin_LED)  # keep the LED off
            time.sleep(config_list[0])
        elif config_list[1] == 1:
            if sblink:
                self.blink(config_list[0])
            else:
                self.ard.setHigh(pin_LED)
                time.sleep(config_list[0])
Ejemplo n.º 2
0
    def run_step(self, sblink=False):
        millis = int(round(time.time() * 1000))
        self.step += 1
        self.time_flag[self.step] = millis
        self.notify_observers(self.step)
        config_list = self.CS_config[self.step]
        print(config_list[0])
        # take the row
        # turn on or off all the stimuli

        # turn on or off the delivery
        if config_list[2] == 0:
            if (self.infuse == True):
                new_era.stop_pump(self.pser, self.pump)
                self.infuse = False
        elif config_list[2] == 1:
            if (self.infuse == False):
                new_era.set_rate(self.pser, self.pump, flowrate)
                new_era.run_all(self.pser)
                self.infuse = True

        if config_list[1] == 0:
            self.ard.setLow(pin_LED)  # keep the LED off
            time.sleep(config_list[0])
        elif config_list[1] == 1:
            if sblink:
                self.blink(config_list[0])
            else:
                self.ard.setHigh(pin_LED)
                time.sleep(config_list[0])
Ejemplo n.º 3
0
 def prime_pumps(self,pump):
     if self.curr_state == 'Stopped':
         if pump not in self.prime_state: # currently not priming
             new_era.prime(self.ser,pump)
             self.commandbar.setText('Last command: priming pump %i'%pump)
             self.statusbar.setText('Status: Priming')
             self.prime_state.add(pump)# add to prime state
         else: # currently priming
             new_era.stop_pump(self.ser,pump)
             self.commandbar.setText('Last command: stopped pump %i'%pump)
             self.prime_state.remove(pump)# remove prime state
             if len(self.prime_state)==0: self.statusbar.setText('Status: Stopped')# if this is the last one, show status=Stopped
         actual_rates = new_era.get_rates(self.ser,self.rates.keys())
         self.currflow[pump].setText(actual_rates[pump]+' ul/hr')
     else:
         self.commandbar.setText("Can't prime pump while running")
         self.prime_btns[pump].setChecked(0)
Ejemplo n.º 4
0
 def prime_pumps(self, pump):
     if self.curr_state == 'Stopped':
         if pump not in self.prime_state:  # currently not priming
             new_era.prime(self.ser, pump)
             self.commandbar.setText('Last command: priming pump %i' % pump)
             self.statusbar.setText('Status: Priming')
             self.prime_state.add(pump)  # add to prime state
         else:  # currently priming
             new_era.stop_pump(self.ser, pump)
             self.commandbar.setText('Last command: stopped pump %i' % pump)
             self.prime_state.remove(pump)  # remove prime state
             if len(self.prime_state) == 0:
                 self.statusbar.setText(
                     'Status: Stopped'
                 )  # if this is the last one, show status=Stopped
         actual_rates = new_era.get_rates(self.ser, self.rates.keys())
         self.currflow[pump].setText(actual_rates[pump] + ' ul/hr')
     else:
         self.commandbar.setText("Can't prime pump while running")
         self.prime_btns[pump].setChecked(0)
Ejemplo n.º 5
0
    def terminate_step(self):
        # terminate a step

        self.ard.setLow(pin_LED)
        self.ard.analogWrite(pin_Servo, 0)
        new_era.stop_pump(self.pser, self.pump)
Ejemplo n.º 6
0
    def terminate_step(self):
        # terminate a step

        self.ard.setLow(pin_LED)
        self.ard.analogWrite(pin_Servo, 0)
        new_era.stop_pump(self.pser, self.pump)
Ejemplo n.º 7
0
 def stop_pump(self):
     new_era.stop_pump(self.ser, self.pump)