Updated README

Added External BMS support to fwupd
legit-fork
flowswitch 2018-12-07 01:56:11 +01:00
parent 794d5bb24d
commit 71f8151fe2
3 changed files with 14 additions and 4 deletions

View File

@ -1,5 +1,10 @@
# py9b # py9b
Ninebot/Xiaomi electric scooter communication library Ninebot/Xiaomi electric scooter communication library and tools.
## Tools
* fwupd.py - firmware flasher capable of flashing BLE/ESC/BMS
* readregs.py - ESC/BMS register file dumper
Other tools are higly experimental.
## Requirements ## Requirements
* Python 2.x.x [www.python.org] * Python 2.x.x [www.python.org]

View File

@ -78,9 +78,9 @@ parser = argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpForm
epilog='Example 1: %(prog)s ble ble_patched.bin - flash ble_patched.bin to BLE using default communication parameters' epilog='Example 1: %(prog)s ble ble_patched.bin - flash ble_patched.bin to BLE using default communication parameters'
'\nExample 2: %(prog)s -i tcp -a 192.168.1.10:6000 bms bms115.bin - flash bms115.bin to BMS over TCP-BLE bridge at 192.168.1.10:6000' '\nExample 2: %(prog)s -i tcp -a 192.168.1.10:6000 bms bms115.bin - flash bms115.bin to BMS over TCP-BLE bridge at 192.168.1.10:6000'
'\nExample 3: %(prog)s -i serial -a COM2 esc CFW.bin - flash CFW.bin to ESC via COM2' '\nExample 3: %(prog)s -i serial -a COM2 esc CFW.bin - flash CFW.bin to ESC via COM2'
'\nExample 4: %(prog)s -i ble -a 12:34:56:78:9A:BC esc CFW.bin - flash CFW.bin to ESC via BLE, use specified BLE address') '\nExample 4: %(prog)s -i ble -a 12:34:56:78:9A:BC -p ninebot extbms bms107.bin - flash bms107.bin to Ninebot\'s external BMS via BLE, use specified BLE address')
devices = {'ble' : BT.BLE, 'esc' : BT.ESC, 'bms' : BT.BMS} # TODO: add extbms devices = {'ble' : BT.BLE, 'esc' : BT.ESC, 'bms' : BT.BMS, 'extbms' : BT.EXTBMS }
parser.add_argument('device', help='target device', type=str.lower, choices=devices) parser.add_argument('device', help='target device', type=str.lower, choices=devices)
parser.add_argument('file', type=argparse.FileType('rb'), help='firmware file') parser.add_argument('file', type=argparse.FileType('rb'), help='firmware file')
@ -99,6 +99,9 @@ if len(argv)==1:
exit() exit()
args = parser.parse_args() args = parser.parse_args()
if args.device=='extbms' and args.protocol!='ninebot':
exit('Only Ninebot supports External BMS !')
dev = devices.get(args.device) dev = devices.get(args.device)
if args.interface=='ble': if args.interface=='ble':

View File

@ -7,6 +7,7 @@ from py9b.link.serial import SerialLink
from py9b.transport.base import BaseTransport as BT from py9b.transport.base import BaseTransport as BT
from py9b.transport.packet import BasePacket as PKT from py9b.transport.packet import BasePacket as PKT
from py9b.transport.xiaomi import XiaomiTransport from py9b.transport.xiaomi import XiaomiTransport
from py9b.transport.ninebot import NinebotTransport
link = SerialLink() link = SerialLink()
#link = TCPLink() #link = TCPLink()
@ -17,7 +18,8 @@ with link:
ports = link.scan() ports = link.scan()
print ports print ports
tran = XiaomiTransport(link) #tran = XiaomiTransport(link)
tran = NinebotTransport(link)
#link.open(("192.168.1.45", 6000)) #link.open(("192.168.1.45", 6000))
link.open(ports[0][1]) link.open(ports[0][1])