Titan 2 script init causing shutoff - CLOSED

GPC script programming for Titan Two device. Code examples, how to, questions, requests.

Moderators: The_Rabid_Taco, pablosscripts, bonefisher

Titan 2 script init causing shutoff - CLOSED

Postby Naoki95957 » Fri Jul 13, 2018 11:54 pm

Hi guys, I'm in a bit of a pickle. I want to be able to read a BUNCH of checkboxes, and I have the output correct and everything seems to be good to move forward except.... after reading 4 checkboxes my Titan shuts off and reboots

I'm working on a script more as a challenge to myself so I'm gonna stay hush-hush about it for now but I'll open up on it soon. As for now, I'm trying to load 37 bits of data in, with 5 calls of pmem_read(uint8 x, &var);
My output is as desired, but my result is an unexpected shutdown for the Titan 2.

Code: Select all
 init
{   
    printf("Init started!");
    pmem_load();
 
    uint8 ignoreIndex = 38;//to save slight performance, I use a prefix
    bool initiation = FALSE;
 
    uint8 i, j, t = 0;
    uint8 address = 0;
    for(j = 9; j >= 5; --j)
    {
        pmem_read(j, &address);
        for(i = 7; i >= 0; --i){
            if(!initiation)//sets the first bit of data in pmem: located at byte 9, bit 5
            {
                initiation = TRUE;
                j = 9;
                i = 5;
            }
            else if (j == 5 && i == 1)//breaks loop when last bit is read
            {
                continue;
            }
            ignoreFunctions[--ignoreIndex] = ((*address >> i) % 2 == 1);
            printf("Init processing: %d, %d output:%d", j, i, (*address >> i) % 2);
            ++t;
        }
    }
    printf("Init complete!");
}


The var "ignoreFunctions" is declared as a field:
bool ignoreFunctions [38];

My output is as follows:

Memory Slots: Updating memory slot 3 (Configuration)
GVM Output: Init started!
GVM Output: Init processing: 9, 5 output:1
GVM Output: Init processing: 9, 4 output:1
GVM Output: Init processing: 9, 3 output:1
GVM Output: Init processing: 9, 2 output:1
Disconnect: Titan Two device disconnected (USB Disconnection)
Device Selector: removed 1 device(s), total of 0 device(s) detected
Device Selector: added 1 device(s), total of 1 device(s) detected
Connect: Naoki's Titan connected
Micro-SD Card: Inserted (14.84GB)
Last edited by Naoki95957 on Sat Jul 14, 2018 7:00 am, edited 3 times in total.
User avatar
Naoki95957
Staff Sergeant
Staff Sergeant
 
Posts: 15
Joined: Thu Jun 21, 2018 11:36 pm

Re: Titan 2 script init causing shutoffs

Postby Naoki95957 » Sat Jul 14, 2018 12:06 am

I attempted to configure while connected to the PSU and still no dice. That makes me assume I'm doing some serious no-no here to get the Titan 2 to trigger a shut-down. I'll probably just do individual calls into memory and not through a loop, but I'd like to know what I'm doing wrong for future awareness.
User avatar
Naoki95957
Staff Sergeant
Staff Sergeant
 
Posts: 15
Joined: Thu Jun 21, 2018 11:36 pm

Re: Titan 2 script init causing shutoffs

Postby Scachi » Sat Jul 14, 2018 3:21 am

Code: Select all
for(i = 7; i >= 0; --i){

I think that isn't working with an uint8 that way, i is getting a value of 255 just before it will exit the loop (not -1) because of i>=0 , but stays in it because of it..endless loop. It isn't crashing with i>0 at the for loop.
Use an "int8" for "i" (instead of your uint8) should stop your T2 from doing reboots.
User avatar
Scachi
Major
Major
 
Posts: 989
Joined: Wed May 11, 2016 6:25 am
Location: Germany

Re: Titan 2 script init causing shutoffs

Postby Naoki95957 » Sat Jul 14, 2018 6:38 am

That makes sense. Thanks for that. Sometimes someone else's eyes are needed to see things you'd otherwise miss. :innocent_smile_1:
User avatar
Naoki95957
Staff Sergeant
Staff Sergeant
 
Posts: 15
Joined: Thu Jun 21, 2018 11:36 pm


Return to GPC Script Programming (Titan Two)

Who is online

Users browsing this forum: Psebcool and 12 guests