parent
794d5bb24d
commit
71f8151fe2
|
@ -1,5 +1,10 @@
|
|||
# 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
|
||||
* Python 2.x.x [www.python.org]
|
||||
|
|
7
fwupd.py
7
fwupd.py
|
@ -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'
|
||||
'\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 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('file', type=argparse.FileType('rb'), help='firmware file')
|
||||
|
@ -99,6 +99,9 @@ if len(argv)==1:
|
|||
exit()
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.device=='extbms' and args.protocol!='ninebot':
|
||||
exit('Only Ninebot supports External BMS !')
|
||||
|
||||
dev = devices.get(args.device)
|
||||
|
||||
if args.interface=='ble':
|
||||
|
|
|
@ -7,6 +7,7 @@ from py9b.link.serial import SerialLink
|
|||
from py9b.transport.base import BaseTransport as BT
|
||||
from py9b.transport.packet import BasePacket as PKT
|
||||
from py9b.transport.xiaomi import XiaomiTransport
|
||||
from py9b.transport.ninebot import NinebotTransport
|
||||
|
||||
link = SerialLink()
|
||||
#link = TCPLink()
|
||||
|
@ -17,7 +18,8 @@ with link:
|
|||
ports = link.scan()
|
||||
print ports
|
||||
|
||||
tran = XiaomiTransport(link)
|
||||
#tran = XiaomiTransport(link)
|
||||
tran = NinebotTransport(link)
|
||||
|
||||
#link.open(("192.168.1.45", 6000))
|
||||
link.open(ports[0][1])
|
||||
|
|
Loading…
Reference in New Issue