asynchronous processes and variables and errors

Lets see example

var global gV;

function classA_setThemeParams(colour)

{

  gV= col;

  ....

}

function onLayout(dc)

{

classA_setThemeParams();

}

function onUpdate(dc)

{

for(i...)

{

    //something external fe. backgroung call classA_setThemeParams during the loop

    drawables(i).draw(dc);//samewher in drawables there is dc.setColor(gV,gV);  <----------------------------------- from time to time error, why?

}

Error Name: Symbol Not Found Error

Error Name: Invalid Value

Why this happen?

gV should be handle an point to  value

this example  show that

- sdk makes "local var" from global instead of taking value from def every time

- during operation = sdk change handle to object

  • after implementing flow

      x = getProperty()

      x.toFloat()/x.toNumber()

    there has been no error for 2 days (maybe users stop using my wf Slight smile)

    part of this data are saving obtaining it previous from json coming from webrequest so maybe there is problem for system to valid good type but still on sim data are saved in correct type

  • unfortunately I've got error

    Error Name: System Error
    Occurrences: 1
    First Occurrence: 2021-02-20
    Last Occurrence: 2021-02-20
    Devices:
        vĂ­voactive® 3: 7.40                MEMOMRY PEAK 89.9/92
    App Versions: 1.7.3
    Languages: pol

    let' analyse


    Backtrace:
        PSX1_Vie.onBD:1032
        PSX1_NowField.draw:418
        PSX1_Vie.onUpdate:2077
        PSX1_Vie.onExitSleep:2260

    **************************
    PSX1_Vie.onBD:1032

    //global
    const P_GX         = 0;
    const P_GG         = 1;
    const P_GA         = 2;
    const P_AG         = 3;
    const P_AR         = 4;
    const P_RA         = 5;
    const P_RR         = 6;
    const P_RX         = 7;
    var            PAL_COL=[
                    0x00AAFF,//00                        52
                    0x00FF00,//01                        51
                    0x55FF00,//02                        35                                                         
                    0xAAFF00,//03                        19                          
                    0xFFAA00,//04                        07
                    0xFF5500,//05                        11
                    0xFF0000,//06                        15
                    0xFF00AA];//07   
                    wp = a.getProperty(AP_W);//dictionary
                   //many reading from wp and everything is ok
                   //float wind speed
                    v = wp[AP_W_WS];
                    if(v != null)
                    {
                        v = v.toFloat();
                    }
                    if(v == null)
                    {
                        v = NO_DATA;
                    }else
                    {//speed in m/s
                        if(v > 17.1)//63km/h
                        {
                            col = PAL_COL[P_RX];
                        }else if(v > 10.7)//40km/h
                        {
                            col = PAL_COL[P_RR];
                        }else if(v > 7.9)//30km/h
                        {
                            col = PAL_COL[P_RA];
                        }else if(v > 5.4)//20km/h
                        {
                            col = PAL_COL[P_AR];//1032 ERROR imposiible
                        }
                    }

    **************************
    PSX1_NowField.draw:418 //imposibble this line call not call onBD
    but line 394: APP.getApp().mV.onBD();//mV is the view, only one place calling onBD
    **************************
        PSX1_Vie.onUpdate:2077
            return draw(dc,gIsBurn);
    **********************
        PSX1_Vie.onExitSleep:2260
            gIsBurn = false;/////glabal, declaration: var        gIsBurn    = false;

    ************************* 
        function onEnterSleep()
        {       
            if(mNBiP)
            {//is burn in protection
                gIsBurn = true;
            }
        }

  • aftrer changing flow

    view.onUpdate() -> drawable.draw() -> view.onBD()

    to

    view.onUpdate() ->view.onBD() -> drawable.draw()

    there is no error for 7 days, but of course maybe people have stoped using my wf Slight smile