Accessibility: One button > Tap = Right Longer Hold/Release = Left

A method of controlling a slide show on KODI on a Raspberry Pi using a single button or accessibility switch. Can be tweaked for other functions.
Version1.00
AuthorSpecialEffect
Publish DateWed, 18 Oct 2017 - 09:35
Last UpdateWed, 18 Oct 2017 - 09:35
Downloads27
RATE


0

0

Code: Select all
// Designed to give a single switch control over a KODI slide-show on a Raspberry Pi.
// Thanks to Scachi for pointers: https://www.consoletuner.com/forum/viewtopic.php?f=6&t=7138&p=52923#p52923
// Barrie Ellis - 18/10/2017
 
define SWITCH = PS3_CROSS;
define RIGHT  = PS3_RIGHT;
define LEFT   = PS3_LEFT;
 
int TIMER = 800;
int RESTRICTIONS = 1; // SET TO 1 TO BLOCK MOST CONTROLS (as set to 0 value in the main code)
 
remap PS3_CROSS -> PS4_TOUCH;
remap PS4_TOUCH -> PS3_CROSS;
 
main {
 
    if(RESTRICTIONS) {
        set_val(PS3_PS,0); set_val(PS3_SELECT,0);set_val(PS3_START,0);
        set_val(PS3_L1,0);set_val(PS3_R1,0);set_val(PS3_L2,0);set_val(PS3_R2,0);set_val(PS3_L3,0);set_val(PS3_R3,0);}
        set_val(PS3_CIRCLE,0);set_val(PS3_SQUARE,0);set_val(PS3_TRIANGLE,0);
        set_val(PS3_LX,0);set_val(PS3_LY,0);set_val(PS3_RX,0);set_val(PS3_RY,0);set_val(XB360_LT,0);set_val(XB360_RT,0);
 
    if(event_release(SWITCH) && get_ptime(SWITCH) >= TIMER) {combo_run(GO_BACK);}
    if(event_release(SWITCH) && get_ptime(SWITCH) <= TIMER) {combo_run(GO_FORWARD);}
}
 
 
combo GO_FORWARD {set_val(RIGHT, 100);wait(500);}
combo GO_BACK {set_val(LEFT, 100);wait(500);}