Announcement

Collapse
No announcement yet.

Workshop suddenly error after compiled

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

  • Workshop suddenly error after compiled

    Hi, I tried to make a simple program with slider as input(0-290) and angular as output(0-45000). Output I expected: when the slider input changes, the output angular also change linearly and data sent to another microcontroller over serial port. Workshop suddenly error after compile finished, appears a message: send a bug report form. Anybody help me? Thanks

    Code:
    #platform "uLCD-43PCT"
    #inherit "4DGL_16bitColours.fnc"
    #inherit "VisualConst.inc"
    #inherit "TestConst.inc"
    
    #CONST
        SLIDER_MAX :=290;
        ANGULAR_MAX :=45000;
    #END
    
    var x, y;
    var posn, frame;
    
    func moveiSlider()
        posn := y - 53 ;                        // y - top - 8
        if (posn < 0)
            posn := SLIDER_MAX ;                // maxvalue-minvalue
        else if (posn > 169)                    // height - 17)
            posn := 0 ;
        else
            posn := SLIDER_MAX - SLIDER_MAX * posn / 169 ;    // max-min - (max-min) * posn / (height-17)
        endif
        img_SetWord(hndl, iSlider1, IMAGE_INDEX, posn);
        img_Show(hndl, iSlider1);
    endfunc
    
    func moveiAngular()
        frame := (posn/SLIDER_MAX) * ANGULAR_MAX;
        img_SetWord(hndl, iAngularmeter1, IMAGE_INDEX, frame) ; // where frame is 0 to 45000 (for a displayed 0 to 45000)
        img_Show(hndl,iAngularmeter1);
    endfunc
    
    func main()
        var state, n;
    
        putstr("Loading...\n");
    if (!(disk:=file_Mount()))
            while(!(disk :=file_Mount()))
                putstr("Drive not mounted...");
                pause(200);
                gfx_Cls();
                pause(200);
            wend
        endif
        //gfx_TransparentColour(0x0020);
        //gfx_Transparency(ON);
    
    //  hFontn := file_LoadImageControl("Ctech.dan", "Ctech.gcn", 1); // Open handle to access uSD fonts, uncomment if required and change n to font number dropping a and c if > 9
    //  hstrings := file_Open("Ctech.txf", 'r') ; // Open handle to access uSD strings, uncomment if required
        hndl := file_LoadImageControl("Ctech.dat", "Ctech.gci", 1);
    
        gfx_Set(SCREEN_MODE,LANDSCAPE) ;
    
        // iSlider1 initialize
        img_Show(hndl,iSlider1) ;
        img_SetWord(hndl, iSlider1, IMAGE_FLAGS, (img_GetWord(hndl, iSlider1, IMAGE_FLAGS) | I_STAYONTOP) &amp; ~I_TOUCH_DISABLE);
    
        // iAngularmeter1 initialize
        img_Show(hndl, iAngularmeter1);
    
        // enable the touch screen
        touch_Set(TOUCH_ENABLE);
    
        repeat
            // read toucshscreen status
            state := touch_Get(TOUCH_STATUS);
            n := img_Touched(hndl,-1) ;
    
            switch(state)
              case NOTOUCH:
              break;
    
              case TOUCH_RELEASED:
              break;
    
              case TOUCH_PRESSED:
                x := touch_Get(TOUCH_GETX);
                y := touch_Get(TOUCH_GETY);
    
              case TOUCH_MOVING:
                x := touch_Get(TOUCH_GETX);
                y := touch_Get(TOUCH_GETY);
                if (n == iSlider1)
                    moveiSlider();
                    moveiAngular();
                    // sending data to another microcontroller ??
                endif
                break;
            endswitch
    
        forever
    endfunc
    Best Regards

    Edha

  • #2


    What was the error message?

    If you sent the bug report we'd have a bit more to look into.

    If you want us to look at the source use zip project to include the Visual stuff and attack it here.
    Mark

    Comment


    • #3


      @ESPsupport, I attach snapshot of the error and source code. I get message when workshop crashes, send bug repport window appears. I'm used last workshop(). Thank you.

      Attached files SourceCode.zip (5.9 KB) Workshop_Error1.zip (757.6 KB) Workshop_Error2.zip (714.5 KB)
      Best Regards

      Edha

      Comment


      • #4


        Wow!

        You have a meter with 45000 values, this means Workshop will need to put 45000 frames of the meter onto the uSD card.

        This will result in a .GCI file over 4gb in size, which will exceed the maximum file size for FAT16.

        Since the display cannot possibly display the granularity of 45000 values, try scaling the meter back, to say 4500 x10, or even 450 x100. eg 450 values with x100 in the Caption.
        Mark

        Comment


        • #5


          I use 45 frames(0-45). How to show on the screen 0-45000 despite using 45 frames? Is possible?

          45 frames on screen
          ------------------------
          0 0
          5 4500
          9 9000
          13.5 13500
          18 18000
          22.5 22500
          27 27000
          31.5 31500
          36 36000
          40.5 40500
          45 45000
          Best Regards

          Edha

          Comment


          • #6


            No that's not possible.

            You could do this though

            Attached files
            Mark

            Comment

            Working...
            X