News:

Rule #1 - Be Patient - Rule #2 - Don't ask when, if you don't contribute - Rule #3 - You have coding skills - LinuxMCE's small brother is available: http://www.agocontrol.com

Main Menu

CM11A - adding new lights...

Started by jondecker76, February 09, 2008, 03:54:45 AM

Previous topic - Next topic

jondecker76

Dan-

I'm working on it now.. trying to get the checksum bug fixed as we speak :)

nite_man

Quote from: jondecker76 on February 21, 2008, 08:44:59 AM
Dan-

I'm working on it now.. trying to get the checksum bug fixed as we speak :)

Excellent! Finally we'll get a 100% working CM11 interface :)
Michael Stepanov,
My setup: [url="http://wiki.linuxmce.org/index.php/User:Nite_man#New_setup"]http://wiki.linuxmce.org/index.php/User:Nite_man#New_setup[/url]
Russian LinuxMCE community: [url="http://linuxmce.ru"]http://linuxmce.ru[/url]

jondecker76

It may take a little while (I'm a bit rusty on my C++) but I had a good first night working on this. Most of the time so far has been spent commenting all the code so I can follow it better, as well as setting up a development environment (there are some really helpful guys on IRC - thanks for the help - you know who you are). I'm just now starting to make changes to the code and see where it gets me. I'll post back when I actually get somewhere

ddamron

The only intuitive interface is the nipple.  After that it's all learned.
My other computer is your windows box.
I'm out of my mind.  Back in 5 minutes.
Q:  What's Red and smells like blue paint?

A:  Red Paint.

ddamron

jon,

I'm sure you've found this, but the message.cpp file I believe is where the checksum is calculated..

HTH

Dan
The only intuitive interface is the nipple.  After that it's all learned.
My other computer is your windows box.
I'm out of my mind.  Back in 5 minutes.
Q:  What's Red and smells like blue paint?

A:  Red Paint.

ddamron

Hey Guys:
Devicepoll.cpp Line 239, remove the '!'.
That fixes the polling! YAY

Tested and confirmed!

All the best,

Dan
The only intuitive interface is the nipple.  After that it's all learned.
My other computer is your windows box.
I'm out of my mind.  Back in 5 minutes.
Q:  What's Red and smells like blue paint?

A:  Red Paint.

jondecker76

#21
Dan-

I found that too. Unfortunately I had to wrap up for the night and go to work (I'm working right now..)
Where I wanted to continue tomorrow is in Serial/SerialPort.cpp and take a look at CSerialPort::IsReadEmpty()
to make sure there wasn't a problem in there before removing the !
Anyways, good work! We were on the same track

ddamron

Ok Jon, I've committed my change, and now I'm seeing everything coming in NO problem.

FYI, I had to change the monitoring house code to C (only device I had).  So if you look into that a bit closer, keep me posted.

Great Stuff!

Regards,

Dan

The only intuitive interface is the nipple.  After that it's all learned.
My other computer is your windows box.
I'm out of my mind.  Back in 5 minutes.
Q:  What's Red and smells like blue paint?

A:  Red Paint.

jondecker76

#23
Dan

There should be no reson that I can see to change the Monitored house code from 0x06 (I'm assuming your talking about the hard-coded monitored house code in DevicePoll::SendClock()). The interface will receive on all house codes regardless of what the monitored house code is set to. The only time that function is called anyways is pretty much if the power goes out and comes back on, or when you first plug it in.

After a lot of reading, what the monitored house code appears to do is store the state of all devices for the specified house code. (So the CM11A has a 2-byte buffer, with the 16 bits representing on/off for all of the device code for the monitored house code). That way, when a power outtage occurs, the interface will send a timer request to the PC (0xA5) to resync the internal time clock, and set the house code to monitor states on.
After this point, if we send the CM11A a status request (0x8B), we can obtain the stored status of all the devices on the monitored house code.
(This is what I understand of it anyways, and I think i have a pretty good handle on it)

I don't believe LMCE uses this information anyways (though I haven't really looked yet), and even if it did, it would not be all that useful in the context of LMCE.

and on another note, I'm going to do some tests with motion sensors tomorrow :)

jondecker76

I'm at work and don't have much time to look into it, but I couldn't help but to check on the monitored house code thing...
if you look at cmllaconsts.h, the status request byte (0x8B) isn't defined, so without looking into it further I would say that LMCE doesn't even support it (and really doesn't need to)

grba

Quote from: Zaerc on February 20, 2008, 08:00:13 PM

grba, could it be that those outlets are on different phases?


It's not it's on same phase. But work just fine and after 2-3 minutes start to switch on my lights. In other socket 3mtr from that one working fine.

jondecker76

dan -
I just got home after a 14 hour work night. I had a quick chance to test the change.
Polling does work - however there is still a problem. The latency of my X10 setup was about 1 second. Now, with the change, its anywhere from 5 to 12 seconds. I'm going to work on this today after I wake up - i need to get some sleep!


jondecker76

ok going to sleep for real this time..
X10 sensor causes and endless loop here:

do {
LoggerWrapper::GetInstance()->Write(LV_STATUS, "Reading the Upload Buffer Size...");

nread = serprt.Read((char*)&resp, 1, CM11A_READ_TIMEOUT);
LoggerWrapper::GetInstance()->Write(LV_STATUS, "got %x", resp);
} while (nread > 0 && resp == CM11A_INTERFACE_CQ);


I'm going to look at it when I get up.... Feel free to get a jump on this!

nosilla99

Quote from: ddamron on February 22, 2008, 01:56:05 AM
Hey Guys:
Devicepoll.cpp Line 239, remove the '!'.
That fixes the polling! YAY

Tested and confirmed!

All the best,

Dan


Cheers Dan,

Given the code below and your change this would infer that in logical/boolean terms somewhere in the pluto code FALSE is defined as being true  :o

bool CSerialPort::IsReadEmpty()
{
    Sleep(0);   
    return FALSE;
}


Does anyone know where FALSE is defined as if the above is correct then it makes reading code very difficult

NOS

jondecker76

Nosilla -

I chased that for a while too, but then I noticed this:

#ifdef WIN32


so there is another IsReadEmpth() method used by linux (look further down the page)