Constant E4 Error

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

Constant E4 Error

Postby UK_Wildcats » Tue Mar 13, 2018 3:56 am

I am constantly getting an E4 error that freezes the T2 when the Blink combo is run. I commented out the combos to verify it. I have not run this script for a few weeks. It used to run well until now a few Gtuner/FW updates.

Any idea why it is happening and how to fix it?

Code: Select all
#pragma METAINFO("COD WW2 AFK", 1, 01, "UK_Wildcats_Fans")
 
/*
<cfgdesc>
shortdesc    = <font size="14"><font color="blue"><b>AFK Script</b></font></font><br><br>
control        = info
 
[CIRCLE ANGLE]
shortdesc    = Set the angle adjustment to make a bigger or smaller circle
byteoffset    = 10
bitsize        = 32
control        = spinboxf
default        = 00010000
minimum        = 00000000
maximum        = 80000000
 
[LED INTENSITY]
shortdesc    = Set the LED instensity from 0.0 to 100.0 in 0.5 steps
byteoffset    = 20
bitsize        = 32
control        = spinboxf
default        = 50000000
minimum        = 00000000
maximum        = 100000000
step        = 500000
 
 
</cfgdesc>
*/

 
#define UP              BUTTON_10
#define DOWN            BUTTON_11
#define LEFT            BUTTON_12
#define RIGHT           BUTTON_13
 
#define JUMP            BUTTON_16
 
fix32 angle, angle_adjust, LED_Intensity;
bool Enabled;
int Counter, Blink_Counter;
 
init {
    pmem_load();   
    pmem_read(10, &angle_adjust);
    Enabled = TRUE;
    Counter = 1;
    Blink_Counter=1;
    pmem_read(20, &LED_Intensity);
    ColorLED('R');
}
 
main {
    if(Enabled) {combo_run(AFK);}
    if(!Enabled){combo_run(DPAD);}
}
 
 
void ColorLED(char Color) {
    // LED_Intensity is set as part of the interactive configuration
    fix32 Color1, Color2, Color3, Color4;
    int Blink;
    Blink = 0; //mS
    if(Color == 'B'){Color1 = LED_Intensity;     Color2 = 0.0;                 Color3 = 0.0;                 Color4 = 0.0;}
    if(Color == 'R'){Color1 = 0.0;                 Color2 = LED_Intensity;     Color3 = 0.0;                 Color4 = 0.0;}
    if(Color == 'G'){Color1 = 0.0;                 Color2 = 0.0;                 Color3 = LED_Intensity;     Color4 = 0.0;}
    if(Color == 'P'){Color1 = 0.0;                 Color2 = 0.0;                 Color3 = 0.0;                 Color4 = LED_Intensity;}
    if(Color == 'C'){Color1 = LED_Intensity;     Color2 = 0.0;                 Color3 = LED_Intensity;     Color4 = 0.0;}
    if(Color == 'Y'){Color1 = 0.0;                 Color2 = LED_Intensity;     Color3 = LED_Intensity;     Color4 = 0.0;}
    if(Color == 'W'){Color1 = LED_Intensity;     Color2 = LED_Intensity;     Color3 = LED_Intensity;     Color4 = LED_Intensity;}
    led_set(LED_1,Color1,Blink);
    led_set(LED_2,Color2,Blink);
    led_set(LED_3,Color3,Blink);
    led_set(LED_4,Color4,Blink);
    return;
}
 
 
combo AFK {
    set_val(STICK_2_X, sin(angle) * 100.0);
    set_val(STICK_2_Y, cos(angle) * 100.0);
    angle += angle_adjust; if(angle >= 2.0 * PI) angle = 0.0;
    wait(1000);
    set_val(STICK_2_X, 0);
    set_val(STICK_2_Y, 0);
//    combo_run(BLINK);
    wait(30000);
    Enabled = FALSE;
}
 
combo DPAD {
//    set_val(JUMP,100);
//    wait(20);
//    wait(1000);
    if(Counter == 1) {set_val(UP,100);}
    if(Counter == 2) {set_val(DOWN,100);}
    if(Counter == 3) {set_val(LEFT,100);}
    if(Counter == 4) {set_val(RIGHT,100);}
    wait(200);
    set_val(UP,0);
//    combo_run(BLINK);
    wait(30000);
    Enabled = TRUE;
    Counter = Counter + 1;
    if(Counter > 4) {Counter = 1;}
}
 
 
combo BLINK {
    ColorLED('R');
    wait(1000);
    ColorLED('G');
    wait(1000);
/*
    ColorLED('R');
    wait(1000);
    ColorLED('G');
    wait(1000);
    ColorLED('R');
    wait(1000);5
    ColorLED('G');
    wait(1000);
    ColorLED('R');
    wait(1000);
    ColorLED('G');
    wait(1000);
    ColorLED('R');
    wait(1000);
    ColorLED('G');
    wait(1000);
    ColorLED('R');
    wait(1000);
    ColorLED('G');
    wait(1000);
    ColorLED('R');
    wait(1000);
    ColorLED('G');
    wait(1000);
    ColorLED('R');
    wait(1000);
    ColorLED('G');
    wait(1000);
    ColorLED('R');
    wait(1000);
    ColorLED('G');
    wait(1000);
    ColorLED('R');
    wait(1000);
    ColorLED('G');
    wait(1000);
    ColorLED('R');
    wait(1000);
    ColorLED('G');
    wait(1000);
    ColorLED('R');
    wait(1000);
    ColorLED('G');
    wait(1000);
    ColorLED('R');
    wait(1000);
    ColorLED('G');
    wait(1000);
    ColorLED('R');
    wait(1000);
    ColorLED('G');
    wait(1000);
    ColorLED('R');
    wait(1000);
    ColorLED('G');
    wait(1000);
*/
   
}
 
User avatar
UK_Wildcats
Brigadier General
Brigadier General
 
Posts: 2243
Joined: Thu Jan 08, 2015 6:53 pm

Re: Constant E4 Error

Postby J2Kbr » Tue Mar 13, 2018 7:12 pm

I believe (not actually tested) your script is over flooding the controller with LED data packets, please update your ColorLED function as below. If I am right this will fix the problem. :smile0517:

Code: Select all
void ColorLED(char Color) {
    static uint32 timestamp;
    uint32 elapsed = system_time() - timestamp;
 
    if(!elapsed || elapsed >= 10) {
 
        // LED_Intensity is set as part of the interactive configuration
        fix32 Color1, Color2, Color3, Color4;
        int Blink;
        Blink = 0; //mS
        if(Color == 'B'){Color1 = LED_Intensity;     Color2 = 0.0;                 Color3 = 0.0;                 Color4 = 0.0;}
        if(Color == 'R'){Color1 = 0.0;                 Color2 = LED_Intensity;     Color3 = 0.0;                 Color4 = 0.0;}
        if(Color == 'G'){Color1 = 0.0;                 Color2 = 0.0;                 Color3 = LED_Intensity;     Color4 = 0.0;}
        if(Color == 'P'){Color1 = 0.0;                 Color2 = 0.0;                 Color3 = 0.0;                 Color4 = LED_Intensity;}
        if(Color == 'C'){Color1 = LED_Intensity;     Color2 = 0.0;                 Color3 = LED_Intensity;     Color4 = 0.0;}
        if(Color == 'Y'){Color1 = 0.0;                 Color2 = LED_Intensity;     Color3 = LED_Intensity;     Color4 = 0.0;}
        if(Color == 'W'){Color1 = LED_Intensity;     Color2 = LED_Intensity;     Color3 = LED_Intensity;     Color4 = LED_Intensity;}
        led_set(LED_1,Color1,Blink);
        led_set(LED_2,Color2,Blink);
        led_set(LED_3,Color3,Blink);
        led_set(LED_4,Color4,Blink);
 
        timestamp = system_time();
    }
    return;
}
ConsoleTuner Support Team
User avatar
J2Kbr
General of the Army
General of the Army
 
Posts: 20323
Joined: Tue Mar 18, 2014 1:39 pm

Re: Constant E4 Error

Postby UK_Wildcats » Tue Mar 13, 2018 10:29 pm

That worked. FYI If I leave the comments (/* */) in the Blink combo, it gives me a compile error. It works with just the first two. Any idea why it gives a compile error?
User avatar
UK_Wildcats
Brigadier General
Brigadier General
 
Posts: 2243
Joined: Thu Jan 08, 2015 6:53 pm

Re: Constant E4 Error

Postby Sillyasskid » Tue Mar 13, 2018 11:42 pm

UK_Wildcats_Fans wrote:That worked. FYI If I leave the comments (/* */) in the Blink combo, it gives me a compile error. It works with just the first two. Any idea why it gives a compile error?


Code: Select all
combo BLINK {
    ColorLED('R');
    wait(1000);
    ColorLED('G');
    wait(1000);
    ColorLED('R');
    wait(1000);
    ColorLED('G');
    wait(1000);
    ColorLED('R');   /*
--> wait(1000);5 <-- */

    ColorLED('G')
    wait(1000);
    ColorLED('R');
    wait(1000);
    ColorLED('G');
    wait(1000);
    ColorLED('R');
    wait(1000);
    ColorLED('G');
    wait(1000);
    ColorLED('R');
    wait(1000);
    ColorLED('G');
    wait(1000);
    ColorLED('R');
    wait(1000);
    ColorLED('G');
    wait(1000);
    ColorLED('R');
    wait(1000);
    ColorLED('G');
    wait(1000);
    ColorLED('R');
    wait(1000);
    ColorLED('G');
    wait(1000);
    ColorLED('R');
    wait(1000);
    ColorLED('G');
    wait(1000);
    ColorLED('R');
    wait(1000);
    ColorLED('G');
    wait(1000);
    ColorLED('R');
    wait(1000);
    ColorLED('G');
    wait(1000);
    ColorLED('R');
    wait(1000);
    ColorLED('G');
    wait(1000);
    ColorLED('R');
    wait(1000);
    ColorLED('G');
    wait(1000);
    ColorLED('R');
    wait(1000);
    ColorLED('G');
    wait(1000);
}
:smile0523:
User avatar
Sillyasskid
Captain
Captain
 
Posts: 574
Joined: Sat May 14, 2016 3:07 am

Re: Constant E4 Error

Postby UK_Wildcats » Wed Mar 14, 2018 10:08 pm

LMAO. I completely missed that. Thank you.
User avatar
UK_Wildcats
Brigadier General
Brigadier General
 
Posts: 2243
Joined: Thu Jan 08, 2015 6:53 pm


Return to GPC2 Script Programming

Who is online

Users browsing this forum: No registered users and 66 guests