I've a script for the deadzone that doesn't work for me.

GPC2 script programming for Titan Two. Code examples, questions, requests.

I've a script for the deadzone that doesn't work for me.

Postby SANTIAGUETEEEEE » Sun Sep 06, 2020 12:21 pm

Fanatec_Santi-Tetra.gpc
(384 Bytes) Downloaded 56 times
Hi everybody!!
I've a script that I downloaded (part of it) from one of your topics and it doesn't work for me. I am a noob to this script issue, so I don't know what is wrong with this script. It's to reduce the deadzone of my Fanatec CSL Elite. This Steering Wheel is recognized by the T2 as a Logitech G25 (as you guided me in another topic). The T2 uses 'USB Xbox 360' as Output protocol.
The first instruction of this script, as you can see, is to redirect the commands to another stick (which is the one recognized by the WRC 7 game). This instruction does work fine. The second instruction (which is the one I copied and pasted from another topic) is the one that doesn't work.
Thanks for your help.
User avatar
SANTIAGUETEEEEE
Master Sergeant
Master Sergeant
 
Posts: 32
Joined: Wed Apr 24, 2019 4:10 pm

Re: I've a script for the deadzone that doesn't work for me.

Postby Buffy » Sun Sep 06, 2020 5:20 pm

Try this:

Code: Select all
 #pragma METAINFO("Fanatec CSL Elite", 1, 0, "Santi-Tetra")
 
#include <titanone.gph>
 
 
init {
 
 
  // Cambiar eje del volante
     remapper_swap(STICK_1_X, STICK_2_X);
 
}
 
main {
    // Steering wheel: make sure values below or equal 1 are "center"
    if(abs(get_val(XB360_LX)) <= 1) set_val(XB360_LX, 0);
 
    // Remove the deadzone, the value 23 can be changed
    deadzone(XB360_LX, XB360_LY, DZ_CIRCLE, 23);
}
 
ConsoleTuner Support Team || Discord || Custom Scripts
User avatar
Buffy
Lieutenant
Lieutenant
 
Posts: 422
Joined: Wed Jul 20, 2016 5:23 am

Re: I've a script for the deadzone that doesn't work for me.

Postby SANTIAGUETEEEEE » Tue Sep 15, 2020 11:15 am

Buffy wrote:Try this:

Code: Select all
 #pragma METAINFO("Fanatec CSL Elite", 1, 0, "Santi-Tetra")
 
#include <titanone.gph>
 
 
init {
 
 
  // Cambiar eje del volante
     remapper_swap(STICK_1_X, STICK_2_X);
 
}
 
main {
    // Steering wheel: make sure values below or equal 1 are "center"
    if(abs(get_val(XB360_LX)) <= 1) set_val(XB360_LX, 0);
 
    // Remove the deadzone, the value 23 can be changed
    deadzone(XB360_LX, XB360_LY, DZ_CIRCLE, 23);
}
 


Hi Buffy.
First of all, excuse me for not responding to your post before, but I was waiting for a notification to arrive to my E-Mail, and in view of the fact that the dates passed and I didn't receive any, I've entered your forum. Possibly, I didn't configure the E-Mail notifications correctly.
The Script that you send me is very similar to the one I had (it only changes a line that you've added). I don't know if I'm visualizing it well. In any case, I've pasted it over the one I had. I've modified the 'value 23' but the steering wheel still shows the same amount of deadzone (about 45º to the left and right). It's like it doesn't recognize the content of the script, I don't know.
Thanks again for your help.

P. D .: I add that in GTuner IV, once I paste the script, I click on the 'GPC Script IDE' button and, below, it shows the legend 'GPC success: GPC Build successed with 0 warning (s).' & 'Test and Debug: GPC script loaded for test and debug.'.
Cheers!!! :)

EDIT:
Hello everybody.
About a month and a half ago I wrote you a post but I haven't received any reply, and I'm surprised because this is a serious forum that works well. I suppose you will be with a lot of work.
Buffy corrected my script and he added a line to it that, I believe, invokes a file that, of course, I've on my PC (I've checked this).
The problem is, as I said in my previous post, that with this script and without it, the steering wheel behaves with a dead zone of about 45 degrees to the left and right. And even modifying the 'value 23' that dead zone doesn't change.
My steering wheel is a Fanatec CSL Elite, although in the T2 it sees it as a Logitech G25 (as you guided me in another thread).
Greetings and take good care of yourselves in this time of pandemic!
User avatar
SANTIAGUETEEEEE
Master Sergeant
Master Sergeant
 
Posts: 32
Joined: Wed Apr 24, 2019 4:10 pm

Re: I've a script for the deadzone that doesn't work for me.

Postby Scachi » Tue Nov 03, 2020 11:29 am

It is not possible to remove the "hardware deadzone" with software.
When your wheel isn't reporting any values in that 45 deg range we can't do that with a script as we don't know where the actual motion of the script is currently below that 45 deg range.

When you see no values at all in the Device Monitor in GTuner IV when you move the wheel in that 45deg range I have no idea what is causing that. Perhaps there is some adjustment required to the hid driver for that device or something like that.
So please check the Device Monitor if you see any values there when you move your wheel below/ in that 45 range.
User avatar
Scachi
Brigadier General
Brigadier General
 
Posts: 3044
Joined: Wed May 11, 2016 6:25 am
Location: Germany

Re: I've a script for the deadzone that doesn't work for me.

Postby SANTIAGUETEEEEE » Tue Nov 03, 2020 2:09 pm

SANTIAGUETEEEEE wrote:
Scachi wrote:It is not possible to remove the "hardware deadzone" with software.
When your wheel isn't reporting any values in that 45 deg range we can't do that with a script as we don't know where the actual motion of the script is currently below that 45 deg range.

When you see no values at all in the Device Monitor in GTuner IV when you move the wheel in that 45deg range I have no idea what is causing that. Perhaps there is some adjustment required to the hid driver for that device or something like that.
So please check the Device Monitor if you see any values there when you move your wheel below/ in that 45 range.

Hello again.
I put a video with the values that my steering wheel gives in the 'Device Monitor'.

I can't post videos... Photos, then... :icon_frown:
As you can guess, it shows values that increase as I turn the steering wheel, but until it's marked in green, the steering wheel does not act.
Attachments
Device Monitor-4.jpg
Device Monitor-4.jpg (227.37 KiB) Viewed 1038 times
Device Monitor-3.jpg
Device Monitor-3.jpg (226.96 KiB) Viewed 1038 times
Device Monitor-2.jpg
Device Monitor-2.jpg (227.55 KiB) Viewed 1038 times
Device Monitor-1.jpg
Device Monitor-1.jpg (226.58 KiB) Viewed 1038 times
User avatar
SANTIAGUETEEEEE
Master Sergeant
Master Sergeant
 
Posts: 32
Joined: Wed Apr 24, 2019 4:10 pm

Re: I've a script for the deadzone that doesn't work for me.

Postby Scachi » Tue Nov 03, 2020 2:30 pm

Sorry. I cant get the information from the images. The color doesn't matter much..it important what values are shown.
Does the value shown there change slowly from -100 to 100 when you turn your wheel slowly from full left all the way to full right ? Don't look at the color.. the values do matter.
Or is there some "dead area" where the value doesn't change at all while you are turning the wheel when there is no value change during that 45deg you said in your previous post then there is nothing you can do with code to reduce that area.
User avatar
Scachi
Brigadier General
Brigadier General
 
Posts: 3044
Joined: Wed May 11, 2016 6:25 am
Location: Germany

Re: I've a script for the deadzone that doesn't work for me.

Postby SANTIAGUETEEEEE » Tue Nov 03, 2020 3:04 pm

Yes, the values go from 0 to 100 when I turn the steering wheel to the right and from 0 to -100 when I turn it to the left.
And as for the color, although you tell me that it isn't important, I will tell you anyway that it's shown from the values 20 and -20. And it's precisely from those values (from 20 to 100 and from -20 to -100) that the game recognizes steering wheel activity.
User avatar
SANTIAGUETEEEEE
Master Sergeant
Master Sergeant
 
Posts: 32
Joined: Wed Apr 24, 2019 4:10 pm

Re: I've a script for the deadzone that doesn't work for me.

Postby Scachi » Tue Nov 03, 2020 4:42 pm

SANTIAGUETEEEEE wrote:Yes, the values go from 0 to 100 when I turn the steering wheel to the right and from 0 to -100 when I turn it to the left.
And as for the color, although you tell me that it isn't important, I will tell you anyway that it's shown from the values 20 and -20. And it's precisely from those values (from 20 to 100 and from -20 to -100) that the game recognizes steering wheel activity.


Did you see the documentation about racing wheel ?
There is some example code that should work for your:
https://www.consoletuner.com/wiki/index ... ontrollers

Here is the swapping added, please try this, you can try to adjust the RESTING_DEADZONE if you need to:
 
Code: Select all
 #pragma METAINFO("Fanatec CSL Elite", 1, 0, "")

#define RESTING_DEADZONE        20.0 // <- adjust that one
#define APPLY_TO_STICK          STICK_2_X // <- change that to STICK_1_X if adjusting RESTING_DEADZONE doesn't change anything

#define WHEEL_RESTING_VALUE     0.70
#define WHEEL_SENSITIVITY       1.0

 
 
init {
    remapper_swap(STICK_1_X, STICK_2_X);
}
 
main {
    fix32 wheel_value = get_actual(APPLY_TO_STICK) + WHEEL_RESTING_VALUE;
    fix32 direction = (wheel_value >= 0.0) ? 1.0 : -1.0;
    wheel_value = abs(wheel_value);
    if(wheel_value > 2.0) {
        wheel_value *= WHEEL_SENSITIVITY;
        wheel_value += RESTING_DEADZONE;
        set_val(APPLY_TO_STICK, clamp(wheel_value, 0.0, 100.0) * direction);
    }
}

 
User avatar
Scachi
Brigadier General
Brigadier General
 
Posts: 3044
Joined: Wed May 11, 2016 6:25 am
Location: Germany

Re: I've a script for the deadzone that doesn't work for me.

Postby Buffy » Tue Nov 03, 2020 8:32 pm

To me it sounds like you actually want the wheels values (excluding the wheels deadzone area) scaled to the games deadzone, try this:

Code: Select all
#pragma METAINFO("Fanatec CSL Elite", 1, 0, "Santi-Tetra")
 
#include <xb360.gph>
 
#define WHEEL_DEADZONE_X   1.0
#define INGAME_X_DEADZONE  20.0
 
init {
    // Cambiar eje del volante
    remapper_swap(XB360_RX, XB360_LX);
 
}
 
main {
    // Steering wheel: make sure values below or equal 1 are "center"
    if(abs(get_val(XB360_LX)) > WHEEL_DEADZONE_X) {
        fix32 tmp_x = lerp(INGAME_X_DEADZONE, 100.0, ((abs(get_val(XB360_LX)) - 0.0) / (100.0 - 0.0)));
        if(get_val(XB360_LX) < 0.0) tmp_x = -tmp_x;
        set_val(XB360_LX, tmp_x);
    }
    else set_val(XB360_LX, 0);
 
}
ConsoleTuner Support Team || Discord || Custom Scripts
User avatar
Buffy
Lieutenant
Lieutenant
 
Posts: 422
Joined: Wed Jul 20, 2016 5:23 am

Re: I've a script for the deadzone that doesn't work for me.

Postby SANTIAGUETEEEEE » Wed Nov 04, 2020 12:22 pm

Hi !!
Thanks for the two scripts. I've tried them both and I've observed that by modifying the values that you indicate to me, I can correct the reading of the steering wheel about its turn.
However, now in 'Device Monitor' the value that goes from -100 - 0 - 100 when I turn the wheel stays at 0 and until it reaches the value 20 it doesn't start to move. That happens to me with both scripts.
I think you're getting closer to the solution.

I've just verified that removing the second device that I've connected to the T2 'Device Monitor' shows all the values and the steering wheel doesn't have any deadzone.
I've my steering wheel connected to T2 in the 'Input-B' slot.
Obviously, I need to connect both devices to T2.
I think this question clarifies things a bit.
You will tell me, :)

Thank you so much for everything!!
User avatar
SANTIAGUETEEEEE
Master Sergeant
Master Sergeant
 
Posts: 32
Joined: Wed Apr 24, 2019 4:10 pm


Return to GPC2 Script Programming

Who is online

Users browsing this forum: No registered users and 101 guests