Re: 3C8
Posted by
Karlis on
Sep 10, 2016; 7:02am
URL: http://bluesaab-forum.90.s1.nabble.com/3C8-tp9p673.html
So I've implemented some changes in the code. Now BlueSaab takes action depending on what state it is. If IHU is off or is in non-CDC mode, we send the
idle frame:
0x3C8 : 0x20 0x00 0x01 0x01 0xFF 0xFF 0xFF 0xD0When IHU is on
and goes into CDC mode, we immediately (50ms) react to that by sending an
acknowledgement frame:
0x3C8 : 0xE0 0xFF 0x3F 0x41 0xFF 0xFF 0xFF 0xD0Then we continue on with sending
basetime frame (every 1000ms):
0x3C8 : 0x20 0xFF 0x3F 0x41 0xFF 0xFF 0xFF 0xD0We do this till an event comes in from IHU (another button has been pressed or IHU gets powered off or goes out of CDC mode), then we
acknowledge the fact again and either continue on sending
basetime frames or switch back over to
idle frames.
I'm using bitwise operations to alter data in cdcGeneralStatusCmd frame on the fly.
From what I've seen this is as close as it gets to the behavior of the real CD changer. Tested this out on my car tonight and wasn't able to break it. The code worked and serial output showed that frames are being sent in order and on events as necessary.
The code has been checked in Github. Feel free to give it a test. Any comments are welcomed.
2001 9-5 SE V6; 2006 9-5 Wagon; iOS; BlueSaab version = "latest and greatest" :)