Announcement

Collapse
No announcement yet.

Changing color ranges and LED colors for bar gauges after programmed into a display.

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

  • Changing color ranges and LED colors for bar gauges after programmed into a display.

    Is it possible to access the gauge properties once the gauges are running in a display. I'd like the end user to beable to select from a pallet of colors for both LED digits and the bar gauges along with change the % points when the bar gauge goes from green to yellow to red. Is this available in the Pro version?

    Thanks Ryan

  • #2
    Good day,

    You cannot actually dynamically change the color properties of the widgets that are already uploaded into the display even in Pro version. What you can do is put multiple different colored widgets on top of each other and just 'write to' the one you want to be 'on top'. Implementing this will also depend on which Workshop4 environment are you working on with this project (ViSi-genie, ViSi, Serial or Designer).

    Best Regards,

    Comment


    • #3
      Hi,

      What you can try exploring is our new internal and inherent widgets which has its color and properties stored in flash. Normally, ViSi environment paste code will store parameters to Flash but these widgets can also use parameters from RAM if you do some modifications.

      Best Regards,

      Comment


      • #4
        Okay, so poking around it looks like Designer allows you to see the raw code for the inherent widgets. And looking through the commands and syntax shows how the LEDdigits is created.

        for example when value X goes above 100 I want to change from green to yellow digits I can call a new "gfx_ LedDigits (value , Digits1RAM , Digits1Info ); // LED digit Widget" with a different Digits1info with in a case statement?

        Code:
        #DATA
        word Digits1Info 10, 10, 66, 106, 2, 0 , 0, 5, 0xFFFF, 0x630C,(LEDDIGITS_F_LEADING0 | LEDDIGITS_F_UNSIGNED | LEDDIGITS_F_INT16 | LEDDIGITS_F_DP_DOT)
        word Digits2Info 10, 10, 66, 106, 2, 0 , 0, 5, 0xFFFF, 0x725F,(LEDDIGITS_F_LEADING0 | LEDDIGITS_F_UNSIGNED | LEDDIGITS_F_INT16 | LEDDIGITS_F_DP_DOT)
        word Digits3Info 10, 10, 66, 106, 2, 0 , 0, 5, 0xFFFF, 0x9420,(LEDDIGITS_F_LEADING0 | LEDDIGITS_F_UNSIGNED | LEDDIGITS_F_INT16 | LEDDIGITS_F_DP_DOT)
        #END
        
        
        //in main loop..
        if(valueX <100) then
        gfx_ LedDigits (valueX , Digits1RAM , Digits1Info );
        else if (valueX >100 && valueX <= 200)
        gfx_ LedDigits (valueX , Digits1RAM , Digits2Info );
        else if (valueX >200)
        gfx_ LedDigits (valueX , Digits1RAM , Digits3Info );
        end if

        Comment


        • #5
          Hi,

          The other way to do this would be to use an array for the data and then change the parameter you want in code

          Code:
          var Digits1Info[11] := [10, 10, 66, 106, 3, 0 , 0, 5, 0xFFFF, 0x630C,(LEDDIGITS_F_LEADING0 | LEDDIGITS_F_UNSIGNED | LEDDIGITS_F_INT16 | LEDDIGITS_F_DP_DOT)];
          
          if(valueX <100)
          Digits1Info[9] := 0x630C;
          gfx_LedDigits (valueX , Digits1RAM , Digits1Info );
          else if (valueX >100 && valueX <= 200)
          Digits1Info[9] := 0x725F;
          gfx_LedDigits (valueX , Digits1RAM , Digits1Info );
          else if (valueX >200)
          Digits1Info[9] := 0x9420;
          gfx_LedDigits (valueX , Digits1RAM , Digits1Info );
          endif
          Digits1Info[8] is the LedDigits segment on colour;
          Digits1Info[9] is the LedDigits segment off colour

          Best regards

          Paul

          Comment


          • #6
            I finally got around to trying this and it works. display counts up and down changing the LED colors as it passes 10.0, 20.0, 80.0 and 90.0. If I wanted to store the color changing thresholds and store those values in flash... how do I update those values. I see a getword or byte command but not a putword or byte. Can you update a flash page location without writing the whole page?

            Thanks Ryan

            Code:
            if (!(sys_GetTimer(TIMER0)))
            
            if(value <= 100)
            IILedDigits1[8] := 0xF800; // red
            else if(value >= 100 && value < 200)
            IILedDigits1[8] := 0xFFE0; // yellow
            else if(value >= 200 && value < 800)
            IILedDigits1[8] := 0x07E0; // green
            else if(value >= 800 && value < 900)
            IILedDigits1[8] := 0xFFE0; // yellow
            else if(value >= 900)
            IILedDigits1[8] := 0xF800; // red
            endif
            
            if (value >= 1000)
            direction := 1;
            else if (value <= 1)
            direction := 0;
            endif
            
            if(direction)
            value--;
            else
            value++;
            endif
            gfx_LedDigits(value, vILedDigits1RAM, IILedDigits1) ;
            sys_SetTimer(TIMER0,50) ; // restart counter
            endif

            Comment


            • #7
              Here is a video of it working

              https://youtu.be/kBFXUDtG-Ms

              Comment


              • #8
                Added threshold adjustment by storing data into flash page 5.

                https://youtu.be/qkFwo_97kEo

                Comment

                Working...
                X