Announcement

Collapse
No announcement yet.

Generated code is wrong?

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

  • Generated code is wrong?

    I have the following small application I want to try out:
    Code:
    #platform "uLCD-32PT_GFX2"#inherit "4DGL_16bitColours.fnc"#inherit "VisualConst.inc"#inherit "WidgetsTestConst.inc"func main()//  Uncomment the following if uSD images used.putstr("Mounting...\n");if (!(disk:=file_Mount()))while(!(disk :=file_Mount()))putstr("Drive not mounted...");pause(200);gfx_Cls();pause(200);wendendifputstr("Mounting successful...\n");pause(1000);gfx_Cls();gfx_TransparentColour(0x0020);gfx_Transparency(ON);hndl := file_LoadImageControl("WIDGET~1.dat", "WIDGET~1.gci", 1);// Form1 generated 20/02/2012 7:51:48// Angularmeter1 generated 20/02/2012 8:28:17img_SetWord(hndl, iAngularmeter1, IMAGE_INDEX, numx); // where numx is 16 to 24img_Show(hndl, iAngularmeter1);repeat foreverendfunc
    And attached is the image (taken from the 4D ViSi IDE) of the small app I want to
    try out (filename: Workshop 3_2012-02-20_08-37-13.png).

    As you can see, the lower bound equals 16, the upper boundary equals 24. As such, the generated code tells me that numx
    , last parameter of the function img_SetWord(), should be a value between 16 and 24. Which, to me, looks logical...

    However, when I give a value between 16 and 24, I see garbage on the LCD when the app is downloaded.

    I only see a good image on the LCD (but wrong positioning of the needle), when values between 0 and 8. The scale is divided in 1/9th parts apparently, where it should normally be based on a value between 16 and 24 (are floating values also possible in the function img_SetWord()???).

    I've also attached a zip file that contains the project, in case someone wants to try it out him/herself.

    Best rgds,
    --Geert

  • #2


    The comment is wrong, for your application Numx should vary from 0 to 8.



    There are 10 values (i.e. two 18 and two 22) because you have specified Labels as 10, change it to 8 to fix that.



    Floating point values are not possible, but if you specify, say, decimals as 1, then 0 to 10 will be scaled as 0.0 to 1.0 (eg 9 will be 0.9)
    Mark

    Comment


    • #3


      There are 10 values (i.e. two 18 and two 22)

      I even didn't notice that...
      Next to this, I see that I also have to change the "Ticks" value to correspond to the new values, otherwise, the scale looks weird...

      Floating point values are not possible, but if you specify, say, decimals as 1, then 0 to 10 will be scaled as 0.0 to 1.0 (eg 9 will be 0.9)
      Ah, that's the way to do it! Works great... I can now display temperatures with a granularity of 0.1°C, when using your trick. Exactly as I want it... Super!
      Best rgds,
      --Geert

      Comment


      • #4


        By the way, the "auto generated comment" for numx now tells me that numx should be a value between 160 and 240. As I understood, that's a bug in the code generation, right?

        I'm going to post this bug in the 4D Visi forum, that's the correct place, right?
        Best rgds,
        --Geert

        Comment


        • #5


          Yep, that's a bug



          The Visi forum is the correct place (only got created the other day)
          Mark

          Comment

          Working...
          X