Yet another get_port question

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

Yet another get_port question

Postby trancaruas » Mon Sep 14, 2020 3:04 am

Hello experts!

Having another problem with get_port here.
Two devices (TM Warthog an VPC MongoosT-50CM2) are connected to ports A and B respectively
I am trying to differentiate same input click or hold coming from these two ports.

The below code seems somewhat working for the momentary clicks, but holding a button (or, more precisely, flipping a switch, which is FLOWR on throttle in this case) apparently blocks get_port from reporting an input coming from the other port:
Code: Select all
#include <ps4.gph>
 
bool FLOWR; // TMW FLOWR            BUTTON3
bool LCP;   // VPC lower center hat BUTTON3
 
main {
    set_val(BUTTON_3, 0.0);
 
    combo_run(b3t);
    combo_run(b3v);
 
    combo_run(Logger);
}
 
combo b3t {
    FLOWR = ((get_port(BUTTON_3) == PORT_USB_A) && get_actual(BUTTON_3))?TRUE:FALSE;
}
 
combo b3v {
    LCP = ((get_port(BUTTON_3) == PORT_USB_B) && get_actual(BUTTON_3))?TRUE:FALSE;
}
 
combo Logger {
    if(FLOWR) { printf("TMH FLOWR"); }
    if(LCP) { printf("VPC lower center press"); }
 
    wait(0);
    wait(1000);
}


So, while the throttle FLOWR switch is flipped on, only "TMH FLOWR" messages are appearing, whether the grip hat is pressed or not.
Am I missing something here?
Can be there any solution other then to wait for the full hid access in GPC?
User avatar
trancaruas
Private First Class
Private First Class
 
Posts: 3
Joined: Fri Sep 20, 2019 7:23 pm

Re: Yet another get_port question

Postby Scachi » Mon Sep 14, 2020 9:14 am

I guess the current implementation of get_port is limited to return only one value, so it can't be PORT_USB_A and PORT_USB_B.
Looks like we need a new function like "check_port(BUTTON_3,PORT_USB_A)" to check for different ports activity on the same button.
User avatar
Scachi
Brigadier General
Brigadier General
 
Posts: 3044
Joined: Wed May 11, 2016 6:25 am
Location: Germany


Return to GPC2 Script Programming

Who is online

Users browsing this forum: No registered users and 78 guests