va1da5 / tm-th8a-emulator-research-stm32

Thrustmaster TH8A shifter emulator research using TinyGo and STM32 uC
1 stars 1 forks source link

Handbrake #2

Open armysolo opened 1 year ago

armysolo commented 1 year ago

I see that you have the bit data for the TSS Sparco handbrake. Does this support the handbrake natively? I've been looking into developing the I2C code to be able to use an Arduino to emulate an analog handbrake(non TM) to plug into the shifter to use on console port but it's a little out of my knowledge level.

I've already made a custom wheel button plate to replace my Sparco P310 wheel and it works greate so I do have some knowledge but I don't think I have enough to do this on my own.

va1da5 commented 1 year ago

Hey there! I stumbled upon the I2C capture on the racing forum. I've been trying out those bits via I2C and it seems to be working well. I even created min and max bytes arrays and tried them out while driving in Assetto Corsa, and it worked just as I expected! Upon further testing, I discovered that the 5th bit actually determines the strength of breaking - 0xFF means no break, while 0x00 means maximum break. I'm not entirely sure about the rest of the bits, so I just took them from the capture. Feel free to take a look at the arrays below!

uint8_t max[14] = {
    0x02, // TSS handbrake
    0x0C, // Unknown
    0x02, // Unknown
    0x01, // Unknown, 01 when max break
    0x00, // FF - no break, 00 max break
    0x7F, // Unknown ◄─┐
    0x1D, // Unknown ◄─│─┐
    0x7F, // Unknown ◄─┘ │
    0x1D, // Unknown ◄───┘
    0x00, // Unknown
    0x00, // Unknown
    0x00, // Unknown
    0x00, // Unknown
    0x00  // Unknown
};

uint8_t min[14] = {
    0x02, // TSS handbrake
    0x0C, // Unknown
    0x02, // Unknown
    0x00, // Unknown
    0xFF, // FF - no break, 00 max break
    0x80, // Unknown ◄─┐
    0x81, // Unknown ◄─│─┐
    0x80, // Unknown ◄─┘ │
    0x81, // Unknown ◄───┘
    0x00, // Unknown
    0x00, // Unknown
    0x00, // Unknown
    0x00, // Unknown
    0x00  // Unknown
};
armysolo commented 1 year ago

I would love to help you debug this but I2C sniffing is out of my area of expertise. I have the hardware including the TSS hand brake, a logic analyzer and the software to read it however I don't know hot to interpret the data. Furthermore I don't know how to connect my own handbrake to try and emulate the braking. I have a hydraulic handbrake with a pressure sensor or a linear pot I could connect so I have options by I'm just now sure where to go. If you're willing to send me your updated code with maybe an explanation how to decode it with a logic analyzer and possibly even instructions how to connect my own handbrake I'd be happy to help you out as much as I can.

On Sun, Mar 12, 2023, 10:40 AM Vaidas @.***> wrote:

Hey there! I stumbled upon the I2C capture on the racing forum https://www.isrtv.com/forums/topic/24532-gearbox-connector-on-base/?do=findComment&comment=232234. I've been trying out those bits via I2C and it seems to be working well. I even created min and max bytes arrays and tried them out while driving in Assetto Corsa, and it worked just as I expected! Upon further testing, I discovered that the 5th bit actually determines the strength of breaking - 0xFF means no break, while 0x00 means maximum break. I'm not entirely sure about the rest of the bits, so I just took them from the capture. Feel free to take a look at the arrays below!

uint8_t max[14] = { 0x02, // TSS handbrake 0x0C, // Unknown 0x02, // Unknown 0x01, // Unknown, 01 when max break 0x00, // FF - no break, 00 max break 0x7F, // Unknown ◄─┐ 0x1D, // Unknown ◄─│─┐ 0x7F, // Unknown ◄─┘ │ 0x1D, // Unknown ◄───┘ 0x00, // Unknown 0x00, // Unknown 0x00, // Unknown 0x00, // Unknown 0x00 // Unknown }; uint8_t min[14] = { 0x02, // TSS handbrake 0x0C, // Unknown 0x02, // Unknown 0x00, // Unknown 0xFF, // FF - no break, 00 max break 0x80, // Unknown ◄─┐ 0x81, // Unknown ◄─│─┐ 0x80, // Unknown ◄─┘ │ 0x81, // Unknown ◄───┘ 0x00, // Unknown 0x00, // Unknown 0x00, // Unknown 0x00, // Unknown 0x00 // Unknown };

— Reply to this email directly, view it on GitHub https://github.com/va1da5/tm-th8a-emulator-research-stm32/issues/2#issuecomment-1465230743, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGT7Y2LQV7JI2XRQVUJGLZ3W3XU57ANCNFSM6AAAAAAVJUYYXU . You are receiving this because you authored the thread.Message ID: @.***>

Nemchenkan commented 11 months ago

Today I have completed development Handbrake based on capture from the racing forum

First I have found correct parameters by changing firmware and flashing device, and after that I have found previous message from @va1da5... 🙄

I can confirm, that force of handbrake should be inverted and placed in to 5 bit of package (datatosend[4]). I have used LoadCell + hx711

uint8_t datatasend[14] = {
    0x02, // TSS handbrake
    0x0C, // Unknown
    0x02, // Unknown I have used 0x05 - all works fine, think this deviceID
    0x00, // Unknown
    0xFF, // FF - no break, 00 max break
    0x80, // Unknown Changing have no affect for handbrake work
    0x81, // Unknown Changing have no affect for handbrake work
    0x80, // Unknown Changing have no affect for handbrake work
    0x81, // Unknown Changing have no affect for handbrake work
    0x00, // Unknown
    0x00, // Unknown
    0x00, // Unknown
    0x00, // Unknown
    0x00  // Unknown
};

So, to use this in your code, you need to update handbrake force (inverted 0 - 100% force - ff or 255 - handbrake released) in datatasend[4] and resend datatasend[] in to 0x01 device of i2c of wheelbase. Package should be sent every 250 milliseconds and on each handbrake force change. All other data of datatasend[] can be sed from this message.