Pre-release v1.0
This commit is contained in:
50
test-main.py
Normal file
50
test-main.py
Normal file
@@ -0,0 +1,50 @@
|
||||
import lib.OCer as OCer
|
||||
import logging
|
||||
import configparser
|
||||
import serial
|
||||
import socket
|
||||
import asyncio
|
||||
|
||||
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()
|
||||
|
||||
# добавь *aargs
|
||||
|
||||
async def main(zxc):
|
||||
# await zxc.set_controller_capacity(18)
|
||||
|
||||
# print(await zxc.watchdog())
|
||||
# print(await zxc.OPEN_ALL_CELLS_LEGACY(True))
|
||||
#print(await zxc.READ_ALL_CELLS())
|
||||
# print(await zxc.read_controller(1))
|
||||
# print(await zxc.send_command(1, 17))
|
||||
# print(await zxc.open_cell(1))
|
||||
# print(await zxc.set_controller_capacity_unsafe(18))
|
||||
# print(await zxc.READ_ALL_CELLS())
|
||||
|
||||
pass
|
||||
|
||||
while True:
|
||||
asyncio.run(main(zxc))
|
||||
Reference in New Issue
Block a user