|
Re: Reliable way to detect disconnected controller
Ok, I have an update for you. There is a way to detect if the device is disconnected. .
Ok, The Chicklet stuffs digital data in the following format:
Only the High nibble is to be used, the lower nibble is assumed to be garbage. The MSB of the LOW Nibble is set (1). This is to create an allowable range of values.
ex:
1111 1000 = 248
1111 0000 = 240 this case should not occur due to the high bit of the low nibble being set.
1111 1111 = 255
When the user reads the high nibble, the value can be any where within that range of decimal values and still be valid.
The Chicklet uses inverted logic. So when no buttons are pressed we will see the following binary value:
1111 1000 = 248(decimal)
When the device is disconnected we will see 126-128. Or:
0111 1110 = 126
0111 1111 = 127
1000 0000 = 128
These conditions cannot occur during game play. You can validate this through dash board. But if the Chicklet is calibrated properly this condition should not happen. The closest normal value we have observed is:
0111 1010 = 122
If you check for the above values (126-128) and they are true then the device is not connected. Try it out and let me know how well it works.
__________________
Mike Copioli
CTRE Hardware Engineer
http://www.ctr-electronics.com
Team 3539 The Byting Bull Dogs
2013 Michigan State Champions
Team 217 The Thunder Chickens
2006 World Champions
2008 World Champions
2009 Michigan State Champions
|