Skip to content

Commit

Permalink
Adds set_eeprom_lowlevel_config() to C3000Controller
Browse files Browse the repository at this point in the history
Enable sending "u" commands to change pump EEPROM settings, e.g.
set_eeprom_lowlevel_config(2, 90) to set motor run current to 90%
instead of 75%

See manual Table 5-5 for commands reference
  • Loading branch information
Dario Cambie committed Jun 3, 2019
1 parent 2ae49c9 commit 36d423b
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 13 deletions.
12 changes: 12 additions & 0 deletions pycont/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -1138,6 +1138,18 @@ def set_eeprom_config(self, operand_value):
print("Unpower and repower the pump to make changes active!")
print("####################################################")

def set_eeprom_lowlevel_config(self, command, operand):
"""
Sets the configuration of the EEPROM on the pumps.
Args:
command (int): The value of the command to be issued.
operand (int): The value of the supplied operand.
"""
eeprom_packet = self._protocol.forge_eeprom_lowlevel_config_packet(sub_command=command, operand_value=operand)
self.write_and_read_from_pump(eeprom_packet)

def flash_eeprom_3_way_y_valve(self):
"""
Sets the EEPROM config of the pump to use a 3-way Y valve (I/O operations)
Expand Down
3 changes: 3 additions & 0 deletions pycont/dtprotocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,11 @@ def decode(self):
if self.response is not None:
info = self.response.rstrip().rstrip('\x03').lstrip(DTStart)
address = info[0]
# try:
status = info[1]
data = info[2:]
# except IndexError:
# return None
return address, status, data
else:
return None
6 changes: 3 additions & 3 deletions tests/pump_test_config.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"io": {
"port": "/dev/pycont",
"port": "/dev/tricable",
"baudrate": 9600,
"timeout": 1
},
"default": {
"volume": 0.5,
"volume": 5,
"micro_step_mode": 2,
"top_velocity": 5000
"top_velocity": 6000
},
"groups": {
"chemicals": ["acetone"]
Expand Down
27 changes: 17 additions & 10 deletions tests/pycont_test_dario.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import time

import logging
logging.basicConfig(level=logging.INFO)
logging.basicConfig(level=logging.INFO )

# simply import the module
import pycont.controller
Expand All @@ -15,18 +15,25 @@
controller = pycont.controller.MultiPumpController.from_configfile(SETUP_CONFIG_FILE)

# initialize the pumps in a smart way, if they are already initialized we do not want to reinitialize them because they got back to zero position
# controller.smart_initialize()
controller.smart_initialize()
# print(controller.pumps['acetone'].get_current_valve_config())
# input("Flashing EEPROM! Press enter to confirm")
# controller.pumps['acetone'].flash_eeprom_4_way_dist_valve()
# input("Reboot pump and press enter to continue...")

controller.smart_initialize()
print(controller.pumps['acetone'].get_current_valve_config())
print("Pumping from inlet to outlet")
controller.pumps['acetone'].transfer(volume_in_ml=0.5, from_valve='I', to_valve='O')
# controller.pumps['acetone'].transfer(volume_in_ml=5, from_valve='I', to_valve='E')
controller.pumps['acetone'].go_to_volume(0)
# controller.smart_initialize()
# controller.pumps['acetone'].initialize()
# print(controller.pumps['acetone'].get_current_valve_config())
# Set max motor speed to 90%
# controller.pumps['acetone'].set_eeprom_lowlevel_config(2, 75)
# print("Pumping from inlet to outlet")

# for _ in range(0, 5):
# controller.pumps['acetone'].transfer(volume_in_ml=0.5, from_valve='I', to_valve='O', speed_in=20000, speed_out=20000)

# controller.pumps['acetone'].transfer(volume_in_ml=1, from_valve='I', to_valve='O')
# controller.pumps['acetone'].transfer(volume_in_ml=1, from_valve='I', to_valve='E')

controller.wait_until_all_pumps_idle()
for _ in range(0, 100):
controller.pumps['acetone'].go_to_volume(0, speed=3500, wait=True)
controller.pumps['acetone'].go_to_max_volume(speed=3500, wait=True)

0 comments on commit 36d423b

Please sign in to comment.