Quick help with btcfg.py needed

Post any 3rd party software here.
Post Reply
Sroof
Posts: 11
Joined: Tue Dec 03, 2013 4:25 pm

Quick help with btcfg.py needed

Post by Sroof » Wed Oct 21, 2015 8:33 am

My ECM-1240-RaspberryPi-btmon system has been running fine for a couple of years. Now I'd like to inspect and possibly change the packet send interval using btcfg.py. I've got btcfg.py running, but I'm a little embarrassed to confess that I cannot figure out how to enter commands at the btcfg: prompt. Could someone show me the syntax for how to view and change the packet send interval? Thanks!
ben
Site Admin
Posts: 4254
Joined: Fri Jun 04, 2010 9:39 am

Re: Quick help with btcfg.py needed

Post by ben » Wed Oct 21, 2015 11:14 am

I haven't used it myself but going through the code it looks like there's an included help option.

Commands:

rcv - display settings
ct N TTT RRR - set type and range of CT N to TTT and RRR
pt TTT RRR - set the PT type and range to TTT and RRR
sf X - set the packet send frequency to X seconds [1,255]
tv X - set the packet send trigger value to X watts [1,32000]
rkw - reset the watt-second counters
rqs - reset the seconds counter
ng N - toggle polarity on channel N
xtd - set real-time mode to on
off - set real-time mode to off
spk - send a single packet
d XX - specify device identifier one of [fc,fd,fe,ff]

For help (the options above):

python btcfg.py --device-type ecm1240 h

Then it looks like, for serial:

python btcfg.py --device-type ecm1240 --serial --serial-port <portnum> --serial-baud 19200 <command>

For IP Client:

python btcfg.py --device-type ecm1240 --ip --ip-host <ecm ip> --ip-port <port> <command>

For IP Server (maybe, not sure if Server is implemented):

python btcfg.py --device-type ecm1240 --ip --ip-port <port> <command>
Ben
Brultech Research Inc.
E: ben(at)brultech.com
Sroof
Posts: 11
Joined: Tue Dec 03, 2013 4:25 pm

Re: Quick help with btcfg.py needed

Post by Sroof » Thu Oct 22, 2015 8:14 am

Thanks Ben. With a little trial and error, I found starting btcfg this way usually works:
python btcfg.py --device-type ecm1240 --serial --serial-port /dev/ttyUSB0

I always get a prompt like this: btcfg: 0xfc:
However, sometimes when I enter a command (e.g., sf 10), I get an error:
2015/10/22 07:30:26 wrong response 0x0, expected 0xfc

If I quit btcfg and restart it, my command is accepted with no error:
btcfg: 0xfc: sf 10
btcfg: 0xfc:

Entering rcv shows send frequency = 10
I can live with this, but can anyone tell if am I starting btcfg.py incorrectly?
mwall
Posts: 140
Joined: Wed Dec 07, 2011 6:25 pm

Re: Quick help with btcfg.py needed

Post by mwall » Thu Oct 22, 2015 5:19 pm

Sroof wrote: If I quit btcfg and restart it, my command is accepted with no error:
btcfg: 0xfc: sf 10
btcfg: 0xfc:

Entering rcv shows send frequency = 10
I can live with this, but can anyone tell if am I starting btcfg.py incorrectly?
you are doing it right.

the 0xfc indicates which ecm1240 you are sending to. changing this is only necessary when you have multiple ecm1240 on the same serial connection. options are 0xfc, 0xfd, 0xfe, 0xff.

the 'wrong response 0x0' is probably due to timing issues. it indicates that btcfg has not synchronized its communication with the ecm1240. if your ecm1240 is configured to emit packets regularly, then then btcfg can only communicate with it when it is not sending. chances are that btcfg tried to talk to the ecm1240 at the same time it was sending a packet.

for now just retry the command.

you should get acknowledgement when a command actually succeeds.

someday i would like to make btcfg do some buffering and synchronization...

m
Sroof
Posts: 11
Joined: Tue Dec 03, 2013 4:25 pm

Re: Quick help with btcfg.py needed

Post by Sroof » Thu Oct 22, 2015 10:34 pm

Thanks, mwall. Unfortunately, I could not get btcfg.py to communicate successfully with the ECM-1240 transmitting at 10 seconds. I tried dozens of times but always got the 'wrong response 0x0' error. Eventually I gave up and used Brultech's IA software on my Windows laptop to reset the ECM-1240 to 60 seconds send frequency.
Post Reply