Controller vibration (ffb) not working as expected

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

Re: Controller vibration (ffb) not working as expected

Postby USER101 » Sat Feb 16, 2019 9:03 pm

J2Kbr wrote:Thanks C75mitch for the provided information. I could not reproduce this issue. However, this week we will be releasing a firmware update with improvements on the XB1 drivers and hopefully the changes will also make some progress on what your are reporting.


J2Kbr,
I was also having some strange issues with FFB that I was not having in the past. At first I thought I screwed something up in my code but when I loaded old versions I ran into the same sort of issue that I am positive was not present before. Which is what yielded the search that led me here. For me the issue seems to come when dealing with macros. I decided to try and reproduce some of the strange things that keep happening. Before I continue, I tried this on several Titans with and without external power, and different USB cables with the same sort of results. It may be the way I am coding that is causing my glitch but I am still learning.

Code: Select all
#pragma METAINFO("test.gpc", 1, 1, "USER101")
 
// TESTING FOR FFB ISSUES //
 
bool bHold = TRUE;
bool bRecord = FALSE;
bool recordStandby = FALSE;
bool recording = FALSE;
bool bPlay = FALSE;
bool playStandby = FALSE;
bool playing = FALSE;
bool stopped = FALSE;
bool rumble = FALSE;
bool activity(){ // Checks if any buttons I/O, (1 thru 25) are active.
        uint8 i = 25;
        while(i--){
            if(i == BUTTON_7 | i == BUTTON_4) --i;
            if(is_active(i)) return TRUE;
            }
        return FALSE
        }
init {
ffb_reset();
}
main {
    if(check_active(BUTTON_7,1000)){
        if(bHold){
        rumble = !rumble;
            if(recording){
                stopped = !stopped;
                recording = !recording;
                bHold = !bHold;   
            }
        recordStandby = !recordStandby;
        printf("Recording Standby");
        bHold = !bHold;   
        }
    }
    if(check_active(BUTTON_4,1000)){
        if(bHold){
        rumble = !rumble;
            if(playing){
                stopped = !stopped;
                playing = !playing;
                bHold = !bHold;   
            }
        playStandby = !playStandby;
        printf("Play Standby");
        bHold = !bHold;   
        }
    }
    if(!bHold){
        if(event_release(BUTTON_7) || event_release(BUTTON_4)) {
            bHold = !bHold;   
        }   
    }
    if(recordStandby){
        if(activity()){
            rumble = !rumble;      //This line does not seem to work
            bRecord = !bRecord;    //but this line seems to work
            recordStandby = !recordStandby;
        }   
    }
    if(playStandby){
        if(activity()){
            rumble = !rumble;
            bPlay = !bPlay;
            playStandby = !playStandby;
        }   
    }
    if(bRecord){
        printf("Recording");
        recording = !recording;
        bRecord = !bRecord;
    }
    if(bPlay){
        printf("Playing");
        playing = !playing;
        bPlay = !bPlay;
    }
    if(recording) macro_rec("test.gmk");
    if(playing) macro_run("test.gmk");
    if(stopped){
        printf("Stopped");
        macro_stop();
        stopped = !stopped;
    }
 
}
 
combo Rumble {
    ffb_set(FFB_2, 50.0, 100);   
} 
Last edited by USER101 on Mon Feb 18, 2019 2:34 am, edited 1 time in total.
User avatar
USER101
Sergeant Major
Sergeant Major
 
Posts: 100
Joined: Mon Dec 03, 2018 5:45 pm

Re: Controller vibration (ffb) not working as expected

Postby Scachi » Sat Feb 16, 2019 10:33 pm

Are you sure your code is doing what you want it do ?
All the bool=!bool will invert the current value. true to false or false to true.
When you want to start/stop something you may want to set bool = FALSE; or TRUE explicitly instead to make sure it really is assigned the value you need it to be.

Overlapping rumble command may result in unexpected behavior, like keeping rumble on permanently.
To make sure your rumble command is finished before a new can be started you can try to modify your combo:
Code: Select all
 
combo Rumble {
    ffb_set(FFB_2, 50.0, 100);
    wait(0); // run the ffb_set once
   wait(120);// block combo_run of this combo until the rumble finished
 ffb_reset(); // allow commands from console to the rumbles again
} 


https://www.consoletuner.com/wiki/index ... t2:ffb_set
https://www.consoletuner.com/wiki/index ... :ffb_reset
User avatar
Scachi
Brigadier General
Brigadier General
 
Posts: 3044
Joined: Wed May 11, 2016 6:25 am
Location: Germany

Re: Controller vibration (ffb) not working as expected

Postby USER101 » Mon Feb 18, 2019 1:59 am

Scachi wrote:Overlapping rumble command may result in unexpected behavior, like keeping rumble on permanently.
To make sure your rumble command is finished before a new can be started you can try to modify your combo:
Code: Select all
 
combo Rumble {
    ffb_set(FFB_2, 50.0, 100);
    wait(0); // run the ffb_set once
   wait(120);// block combo_run of this combo until the rumble finished
 ffb_reset(); // allow commands from console to the rumbles again
} 


https://www.consoletuner.com/wiki/index ... t2:ffb_set
https://www.consoletuner.com/wiki/index ... :ffb_reset


That did the trick!! Thanks
User avatar
USER101
Sergeant Major
Sergeant Major
 
Posts: 100
Joined: Mon Dec 03, 2018 5:45 pm

Previous

Return to Titan Two Device

Who is online

Users browsing this forum: No registered users and 130 guests