37 lines
1.2 KiB
Python
37 lines
1.2 KiB
Python
import lib.OCer as OCer
|
|
import logging
|
|
import configparser
|
|
import serial
|
|
import socket
|
|
|
|
if __name__ == "__main__":
|
|
#consts&confs
|
|
config = configparser.ConfigParser()
|
|
#bc_calculator = lomka.BCCCalculator()
|
|
some_open_ports = serial.tools.list_ports.comports()
|
|
|
|
#load config file
|
|
config.read('config.ini')
|
|
# device_hwid = config['DEFAULT']['device_hwid']
|
|
# baudrate = config['DEFAULT']['baudrate']
|
|
|
|
#log section
|
|
logging.basicConfig(
|
|
level=logging.INFO if config['DEFAULT']['debug'] == "false" else logging.DEBUG,
|
|
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
|
|
handlers=[
|
|
logging.FileHandler('lastest.log'),
|
|
logging.StreamHandler()])
|
|
logger = logging.getLogger(socket.gethostname())
|
|
|
|
zxc = OCer.caser(device_hwid="PID=1A86:7523", baudrate=9600,
|
|
config=config, logger=logger)
|
|
zxc.set_controller_number(1)
|
|
zxc.set_port_device()
|
|
zxc.set_controller_capacity(18)
|
|
# добавь *aargs
|
|
#print(zxc.READ_ALL_CELLS())
|
|
print(zxc.OPEN_ALL_CELLS_LEGACY(True))
|
|
# print(zxc.read_controller(1))
|
|
# print(zxc.send_command(1, 17))
|
|
# print(zxc.read_controller(1)) |