Announcement

Collapse
No announcement yet.

Visi code tilts the display, when code is to big

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Visi code tilts the display, when code is to big

    Hi,

    I have two function, a ninput and a formshow. The size of the kbinput is about
    1895 out of the 14400, the formshow was 3100 something.
    The ninput is loaded when needed and freed after usage The formshow is active all the time.

    When the formshow was increased above 5000 bytes, the system started to reset.
    The formshow is a simple menusystem where I paste all code inside the Visi. There is
    no additional logic, exept for scaling the values to the gauges.

    I have now reduced the size to 2200 bytes, and now it works again (removed obsolete lines).

    I tried to find a bug, without success. The same phenomen could be achieved with the Serial commander also, so it's not the arduino. The speed is 9600 baud, so no error there either.

    It looks like there is something in the displays internal code.

    The GCI has about 60 objects (about 10 gauges+30 buttons+20 labels) and its size is about 91kb.

    Do you have any limits on the codesizes and how many functions can be loaded simultaneously.
    The ninput simply halts the display, and it must be reseted.


    /Kimi

  • #2


    Those sizes are the program sizes, since they are functions they must live in RAM.

    More RAM is used by open files and the 'entries' in a GCI. (i.e. each open file uses ~570 bytes, each entry/line in a .dat file uses 28 bytes).

    Not sure how your program is setup structured, but try using print(mem_Heap()) to see how much you are using at any point.

    Also consider running your main program from FLASH (using #MODE RUNFLASH, as well as destination Flash).
    Mark

    Comment


    • #3


      Hi,

      If I put the formShow code into the Flash, how can I call it from the Arduino.
      #MODE RUNFLASH in the code, select flash from visi, then compile'nLoad.

      I get no info about a handlernumber and the SPE is wiped out.

      How do I keep the SPE in the flash, and know how to call my program
      in flash in the same time and get a handle to use in my Arduino code.

      /KImi

      Comment


      • #4


        Ok, I got it, I use the MODE runflash but change nothing else and the program is loaded by SPE into the flash executed from there.

        I tried this with the serial commander. I got no difference
        Here the memHeap report.

        9862 after mount
        Loading formshow
        7016 after GCI & DAT load
        4946 after 4FN load RAM version
        4946 after 4fn execution

        9862 after mount
        7016 after GCI & DAT load
        4946 after 4fn load Flash version
        4946 after 4fn execution

        Loading RAM version
        file_Mount[FF03 ] 0,141 (ACK 5506 0x1582)
        mem_Heap[FF23 ] 0,007 (ACK 9862 0x2686)
        file_LoadImageControl[0009 "mittari.dat" mittari.gci 0001] 0,662 (ACK 4083 0x0FF3) this is the formshow images
        mem_Heap[FF23 ] 0,007 (ACK 7016 0x1B68)
        file_LoadFunction[0008 mittari.4FN] 0,037 (ACK 35816 0x8BE8) this is the formshow function, RAM version
        mem_Heap[FF23 ] 0,007 (ACK 4946 0x1352)
        file_CallFunction[0019 8BE8 0007 0FF3 0001 000A 000A 000A 000A 000A] 0,128 (ACK 1 0x0001)
        mem_Heap[FF23 ] 0,007 (ACK 4946 0x1352)

        RESETing display and loading Flash version
        file_Mount[FF03 ] 0,142 (ACK 5506 0x1582)
        file_LoadImageControl[0009 "mittari.dat" mittari.gci 0001] 0,663 (ACK 4083 0x0FF3)
        mem_Heap[FF23 ] 0,007 (ACK 7016 0x1B68)
        file_LoadFunction[0008 mittarif.4FN] 0,038 (ACK 35816 0x8BE8) This is the Flash version #MODE RUNFLASH in beginning of code
        mem_Heap[FF23 ] 0,007 (ACK 4946 0x1352)
        file_CallFunction[0019 8BE8 0007 0FF3 0001 000A 0001 000A 000A 000A] 0,128 (ACK 1 0x0001)
        mem_Heap[FF23 ] 0,007 (ACK 4946 0x1352)

        Here how I put the MODE in the code.

        #platform "uLCD-32PT"
        #MODE RUNFLASH


        // Program Skeleton 1.0 generated 25.8.2013 14:18:49

        #inherit "4DGL_16bitColours.fnc"

        #inherit "VisualConst.inc"

        #inherit "MittariConst.inc"
        var state;

        func main(var hndimgp,var screen,var rpm,var afr, var adv,var pot,var extra)
        ....


        /Kimi

        Comment


        • #5


          Sorry, didn't realise you were using SPE.

          All 'sub' programs must run from RAM, so run flash will have no effect, as you are seeing.

          4946 bytes of RAM after .4fn execution, looks 'ok' how/where are you seeing " I get no info about a handlernumber and the SPE is wiped out."
          Mark

          Comment


          • #6


            Hi,

            I assumed that I can load functions resident into the flash, and then call them, but it seems
            that this is not possible.

            It would be nice to create own function and include those into the SPE.

            I have moved a huge amount of code from Arduino to the Visi, actually, I have only a couple of absolute xy- coordinates for objects left in my arduino code. I use the buttons as text positions. This way I can reorganise the whole layout for a screen in visi instead of changing coordinates.
            Here is my ImgText function how I print text over a button.

            word Picaso_Serial_4DLib::ImgText(word handle,word index,word tsize,char *s)
            {
            word x,y,oldc;
            word oldh,oldw;
            x=ImgGetX(handle,index)+7;
            y=ImgGetY(handle,index)+7;
            // ImgShow(handle,index);
            if (tsize

            Comment

            Working...
            X