Feature Request in Gtuner IV (strength of the centering)

Titan Two general support. Questions, firmware update, feature request.

Feature Request in Gtuner IV (strength of the centering)

Postby tiki » Wed Oct 16, 2019 10:36 pm

Hi,

It would be nice if I could adjust the strength of the centering as a parameter for the mouse conversion interface in the input translator.
Similar to an adjustable magnetic attraction. 0 - 100%
And an option, auto center X/Y axis when mouse stop moving.

Maybe a adjustable hotkey button (Button_0 - Button_21) for X/Y axis centering.
And time controlled X/Y axis centering 0 - xxx ms

This setting would be great for mouse players in Flight Sims, Space Sims, Car Racing, ...

best regards
User avatar
tiki
Sergeant
Sergeant
 
Posts: 6
Joined: Wed Oct 16, 2019 9:10 pm

Re: Feature Request in Gtuner IV (strength of the centering)

Postby DontAtMe » Thu Oct 17, 2019 12:03 am

This can be done using a script.
Code: Select all
fix32 strength = 0.75;
 
main {
  uint32 timestamp;
  mouse_active(&timestamp);
 
  fix32 x_val, y_val;
  if(!mouse_active()){
   x_val = get_actual(STICK_1_X);
   y_val = get_actual(STICK_1_Y);
  }
  else {
    if(x_val>get_actual(STICK_1_X)) x_val -= strength;
    else if(x_val<get_actual(STICK_1_X)) x_val += strength;
    if(y_val>get_actual(STICK_1_Y)) y_val -= strength;
    else if(y_val<get_actual(STICK_1_Y)) y_val += strength;
  }
 
  set_val(STICK_1_X, x_val);
  set_val(STICK_1_Y, y_val);
}
 
bool mouse_active(uint32* t){
static uint32 last_t, timestamp;
  t  += mouse_status(-2);
  if(t && (last_t != t)){
    last_t = t;
    timestamp = system_time();
  }
  return (system_time() - timestamp >= 8);
}
User avatar
DontAtMe
Captain
Captain
 
Posts: 502
Joined: Tue Oct 02, 2018 4:49 am

Re: Feature Request in Gtuner IV (strength of the centering)

Postby tiki » Sun Oct 20, 2019 12:39 am

@DontAtMe Thanks for your help

I am sure that you can script everything.
If I want to use the conversions curve or the button remapper, the scripts become more and more.
It would be easy and quick if I could adjust the degree of centering as a parameter for the mouse conversion surface in the input translator.


best regards
Last edited by tiki on Sun Oct 27, 2019 2:57 am, edited 1 time in total.
User avatar
tiki
Sergeant
Sergeant
 
Posts: 6
Joined: Wed Oct 16, 2019 9:10 pm

Re: Feature Request in Gtuner IV (strength of the centering)

Postby tiki » Sun Oct 27, 2019 2:53 am

@DontAtMe

I can not completely switch off the joystick centering in the script.
I want it to work like this script.
Or that it is adjustable.

Code: Select all
#Title         :Mjoy vJoy FreePIE python script
#Version       :0.5 (2016-10-08)
#Author        :snp
#Description   :FreePIE python script for flight sims. Provides mouse and keyboard support via vJoy device driver and some other features.
 
import time
from System import Int16
from ctypes import windll, Structure, c_ulong, byref
 
class POINT(Structure):
   _fields_ = [("x", c_ulong), ("y", c_ulong)]
 
if starting:
   vJoy0_stat = 1
   vJoy[0].x = 0
   vJoy[0].y = 0
   vJoy[0].z = 0
   vJoy[0].rz = 0
   x = 0
   y = 0
   z = 0
   rz = 0
   mouse_x = 0
   mouse_y = 0
   mouse_x_locked = 0
   mouse_y_locked = 0
   x_m = 0
   y_m = 0
   axis_max = 16384
   screen_x = windll.user32.GetSystemMetrics(0)
   screen_y = windll.user32.GetSystemMetrics(1)
   pt = POINT()   
   sequence = 0
   system.setThreadTiming(TimingTypes.HighresSystemTimer)
   system.threadExecutionInterval = 1
 
clamp = lambda n, minn, maxn: max(min(maxn, n), minn)
 
# Mouse looking around
 
if keyboard.getPressed(Key.LeftAlt):
   mouse_x_locked = pt.x
   mouse_y_locked = pt.y
 
if keyboard.getKeyDown(Key.LeftAlt):
   windll.user32.SetCursorPos((mouse_x_locked),(mouse_y_locked))
 
#if keyboard.getKeyDown(Key.LeftAlt):
#   vJoy0_stat = 0
 
#if keyboard.getKeyUp (Key.LeftAlt):
#   vJoy0_stat = 1
 
# Il2 CoD - Mousewheel throttle
 
if mouse.wheelUp:
   keyboard.setPressed(Key.D4)
 
if mouse.wheelDown:
   keyboard.setPressed(Key.D3)
 
# Il2 CoD - Toogleable FOV zoom
 
if mouse.getPressed(2):
   if sequence == 0:
      keyboard.setPressed(Key.D7)
   elif sequence == 1:
      keyboard.setPressed(Key.V)
 
   sequence = sequence + 1
   if sequence > 1:
      sequence = 0
 
# Rudder control
 
rz = clamp(rz, - axis_max, axis_max)
 
if keyboard.getKeyDown(Key.Q):
   rz = rz - 128
 
if keyboard.getKeyUp(Key.E):
   if keyboard.getKeyUp(Key.Q):
      if rz > 0:
         rz = rz - 128
      if rz < 0:
         rz = rz + 128
 
if keyboard.getKeyDown(Key.E):
   rz = rz + 128
 
vJoy[0].rz = rz
 
# Brakes control
 
if keyboard.getKeyDown(Key.X):
   z = z + 128
   vJoy[0].z = z
 
if keyboard.getKeyUp(Key.X):
   z = -axis_max
   vJoy[0].z = -axis_max
 
# X/Y axis centering
 
if keyboard.getKeyDown(Key.Space):
   #windll.user32.SetCursorPos((screen_x / 2),(screen_y / 2))
   windll.user32.SetCursorPos((screen_x / 2),((screen_y - 64) / 2))
 
# Mjoy vJoy
 
# Turn VJoy on/off
 
if keyboard.getPressed(Key.K):
   if sequence == 0:
      vJoy0_stat = 0
   elif sequence == 1:
      vJoy0_stat = 1
 
   sequence = sequence + 1
   if sequence > 1:
      sequence = 0
 
x = clamp(x, - axis_max, axis_max)
y = clamp(y, - axis_max, axis_max)
 
if vJoy0_stat == 1:
   windll.user32.GetCursorPos(byref(pt))
   mouse_x = pt.x
   mouse_y = pt.y
   sensitivity_x = 26
   sensitivity_y = 40
   x_m = (mouse_x - (screen_x / 2)) * sensitivity_x
   y_m = (mouse_y - (screen_y / 2)) * sensitivity_y
   x_both = x_m + x
   y_both = y_m + y
   x_keyb_sensitivity = 512
   y_keyb_sensitivity = 64
 
   x_m = clamp(x_m, - axis_max, axis_max)
   y_m = clamp(y_m, - axis_max, axis_max)
   x = clamp(x, - axis_max, axis_max)
   y = clamp(y, - axis_max, axis_max)
   x_both = clamp(x_both, - axis_max, axis_max)
   y_both = clamp(y_both, - axis_max, axis_max)
 
   if keyboard.getKeyDown(Key.A):
      x = x - x_keyb_sensitivity
 
   if keyboard.getKeyUp(Key.D):
      if keyboard.getKeyUp(Key.A):
         if x > 0:
            x = x - x_keyb_sensitivity
         if x < 0:
            x = x + x_keyb_sensitivity
 
   if keyboard.getKeyDown(Key.D):
      x = x + x_keyb_sensitivity
 
   if keyboard.getKeyDown(Key.W):
      y = y - y_keyb_sensitivity
 
   if keyboard.getKeyUp(Key.S):
      if keyboard.getKeyUp(Key.W):
         if y > 0:
            y = y - y_keyb_sensitivity
         if y < 0:
            y = y + y_keyb_sensitivity
 
   if keyboard.getKeyDown(Key.S):
      y = y + y_keyb_sensitivity
 
   vJoy[0].x = x_both
   vJoy[0].y = y_both
   #vJoy[0].x = x_m
   #vJoy[0].y = y_m
 
# Diag
 
diagnostics.watch(screen_x)
diagnostics.watch(screen_y)
diagnostics.watch(mouse_x)
diagnostics.watch(mouse_y)
diagnostics.watch(mouse_x_locked)
diagnostics.watch(mouse_y_locked)
diagnostics.watch(vJoy[0].x)
diagnostics.watch(vJoy[0].y)
diagnostics.watch(vJoy[0].z)
diagnostics.watch(vJoy[0].rz)
 


best regards
User avatar
tiki
Sergeant
Sergeant
 
Posts: 6
Joined: Wed Oct 16, 2019 9:10 pm

Re: Feature Request in Gtuner IV (strength of the centering)

Postby DontAtMe » Sun Oct 27, 2019 8:45 pm

tiki wrote:@DontAtMe

I can not completely switch off the joystick centering in the script.


Code: Select all
#include <keyboard.gph>
 
fix32 strength = 0.25 ;
 
uint32 timestamp;
fix32 x_val, y_val;
main {
  if(!key_status(KEY_SPACEBAR)){
    mouse_active(&timestamp);
    if(!mouse_active()) {
      x_val = get_actual(STICK_1_X);
      y_val = get_actual(STICK_1_Y);
    }
    else {
      if(x_val>get_actual(STICK_1_X)) x_val -= strength;
      else if(x_val<get_actual(STICK_1_X)) x_val += strength;
      if(y_val>get_actual(STICK_1_Y)) y_val -= strength;
      else if(y_val<get_actual(STICK_1_Y)) y_val += strength;
    }
  }
  set_val(5, mouse_status(0));
  set_val(6, mouse_status(1));
  set_val(STICK_1_X, x_val);
  set_val(STICK_1_Y, y_val);
}
 
bool mouse_active(uint32* t){
  static uint32 last_t, timestamp;
  t += mouse_status(-2);
  if(t && (last_t != t)){
    last_t = t;
    timestamp = system_time();
  }
  return (system_time() - timestamp >= 2);
}

Hold Spacebar to stop the x and y axis values from returning to center.
User avatar
DontAtMe
Captain
Captain
 
Posts: 502
Joined: Tue Oct 02, 2018 4:49 am

Re: Feature Request in Gtuner IV (strength of the centering)

Postby tiki » Fri Nov 01, 2019 12:39 am

@DontAtMe Thanks for the Script.

Code: Select all
fix32 strength = 0.1;
 
main {
  uint32 timestamp;
  mouse_active(&timestamp);
 
  fix32 x_val, y_val;
  if(!mouse_active()){
   x_val = get_actual(STICK_1_X);
   y_val = get_actual(STICK_1_Y);
  }
  else {
    if(x_val>get_actual(STICK_1_X)) x_val -= strength;
    else if(x_val<get_actual(STICK_1_X)) x_val += strength;
    if(y_val>get_actual(STICK_1_Y)) y_val -= strength;
    else if(y_val<get_actual(STICK_1_Y)) y_val += strength;
  }
 
  set_val(STICK_1_X, x_val);
  set_val(STICK_1_Y, y_val);
}
 
bool mouse_active(uint32* t){
static uint32 last_t, timestamp;
  t  += mouse_status(-2);
  if(t && (last_t != t)){
    last_t = t;
    timestamp = system_time();
  }
  return (system_time() - timestamp >= -5);



Code: Select all
#include <keyboard.gph>
 
fix32 strength = 0.1 ;
 
uint32 timestamp;
fix32 x_val, y_val;
main {
  if(!key_status(KEY_SPACEBAR)){
    mouse_active(&timestamp);
    if(!mouse_active()) {
      x_val = get_actual(STICK_1_X);
      y_val = get_actual(STICK_1_Y);
    }
    else {
      if(x_val>get_actual(STICK_1_X)) x_val -= strength;
      else if(x_val<get_actual(STICK_1_X)) x_val += strength;
      if(y_val>get_actual(STICK_1_Y)) y_val -= strength;
      else if(y_val<get_actual(STICK_1_Y)) y_val += strength;
    }
  }
  set_val(5, mouse_status(0));
  set_val(6, mouse_status(1));
  set_val(STICK_1_X, x_val);
  set_val(STICK_1_Y, y_val);
}
 
bool mouse_active(uint32* t){
  static uint32 last_t, timestamp;
  t += mouse_status(-2);
  if(t && (last_t != t)){
    last_t = t;
    timestamp = system_time();
  }
  return (system_time() - timestamp >= -5);
}
 


The centering is slower, which is ok, but Unfortunately the movement speed is affected here.
The lower I set the strengh + timestamp, the less moving speed I have with the Mouse.
If I change only the strength then the centering can not be reduced far enough (fix32 strength = 0.001).
Can the centering not be completely switched off? The sensitivity of the mouse should not change.
Like a joystick without a spring. The mouse should work like a joystick without a spring. Best like an adjustable spring.
Maybe this feature is not correctly implemented, or not enough (strength of the centering) (fix32 strength ??? ).

best regards
User avatar
tiki
Sergeant
Sergeant
 
Posts: 6
Joined: Wed Oct 16, 2019 9:10 pm

Re: Feature Request in Gtuner IV (strength of the centering)

Postby tiki » Sat Nov 09, 2019 4:33 pm

Da mein English recht bescheiden ist schreibe ich hier mal auf Deutsch.
Ich habe mit dem obigen Script noch ein bisschen rumgespielt, Danke an dieser Stelle nochmal an DontAtMe für seine Lösungsvorschläge.
Eine Lösung für mich ist es leider nicht, da die Mausgeschwindigkeit allgemein mit negativ beeinflusst wird.
Warscheinlich da man die Kraft der Joystick Zentrierung nicht direkt oder nicht genug mit dem Wert "fix32 strength = 0.1 ;" beeinflussen kann sondern nur üder den Umweg mit der Rücksetzung über einen Timestamp "return (system_time() - timestamp >= -5);" .
Meiner Meinung nach ist der Umweg oder Lösungsansatz auch falsch umgesetzt. Es sollte so sein, je schwächer die Feder ist, dersto langsamer sollte die Rückkehr in die Mitte sein und desto leichter kann man nach links und rechts bewegen. In dem Script ist es aber so umgesetzt das die Rückkehr langsam ist, aber man auch schwerer nach links und rechts bewegen kann.
Richtig umgesetzt als Option im Input Translator wäre es mir sogar 50€ wert.

I pay 50 € for an Center spring intensity option in the mouse conversion interface in the input translator.
This should indicate the strength of the spring that resets the wheel or joystick to the center (neutral) position.
The weaker the spring is, the slower the return to center is, and the easier you can move it to left and right.

That would be worth it to me :-)
User avatar
tiki
Sergeant
Sergeant
 
Posts: 6
Joined: Wed Oct 16, 2019 9:10 pm


Return to Titan Two Device

Who is online

Users browsing this forum: No registered users and 86 guests