This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TM4C129XNCZAD: Widget fluctating

Part Number: TM4C129XNCZAD

I have made the following Widget.It consist of value updating Continuously.

But When this widget in standstill condition ,it looks like fluctuating. 

The Value of E,P and Err looks fluctuating. Its not looks smooth operation.

How can we resolve ?

char g_pcRunningError[10];
Canvas(g_sRunningError, g_psPanels + 4, 0, 0,
&g_sKentec320x240x16_SSD2119,195,131 ,110,28,
CANVAS_STYLE_FILL | CANVAS_STYLE_TEXT | CANVAS_STYLE_TEXT_LEFT |
CANVAS_STYLE_TEXT_OPAQUE, ClrBlack, ClrBlack, ClrWhite,
g_psFontCmss28,g_pcRunningError , 0, 0);

char g_pcRunningPulse[10];
Canvas(g_sRunningPulse, g_psPanels + 4, &g_sRunningError, 0,
&g_sKentec320x240x16_SSD2119,235,60,80,18,
CANVAS_STYLE_FILL | CANVAS_STYLE_TEXT | CANVAS_STYLE_TEXT_LEFT |
CANVAS_STYLE_TEXT_OPAQUE, ClrBlack, ClrBlack, ClrWhite,
g_psFontCmss18, g_pcRunningPulse, 0, 0);

char g_pcRunningEnergy[15];
Canvas(g_sRunnigEnergy, g_psPanels + 4,&g_sRunningPulse, 0,
&g_sKentec320x240x16_SSD2119,95,60 ,120,18,
CANVAS_STYLE_FILL | CANVAS_STYLE_TEXT | CANVAS_STYLE_TEXT_LEFT |
CANVAS_STYLE_TEXT_OPAQUE, ClrBlack, ClrBlack, ClrWhite,
g_psFontCmss18, g_pcRunningEnergy, 0, 0);
Canvas(g_sProgressBar, g_psPanels + 4, &g_sRunnigEnergy, 0,
&g_sKentec320x240x16_SSD2119,ANIM_LEFT,ANIM_TOP_ERROR,ANIM_WIDTH,ANIM_HEIGHT - 5,
CANVAS_STYLE_OUTLINE , 0, ClrGreen, 0, 0, 0,
0, 0);
CheckBox(g_psCheckBoxes,g_psPanels + 4, &g_sProgressBar,0,
&g_sKentec320x240x16_SSD2119, 20, 114,50, 50,
CB_STYLE_IMG , 16, 0, ClrRed, 0, 0, 0, 0,
OnCheckChange);//
RectangularButton(g_sPushBtn, g_psPanels + 4,&g_psCheckBoxes,0, // Pulse source
&g_sKentec320x240x16_SSD2119, 110,170, 100,30,
PB_STYLE_FILL | PB_STYLE_TEXT | PB_STYLE_TEXT, ClrForestGreen,
ClrGray, ClrGray, ClrSilver, g_psFontCm22,
"START", 0, 0, 0 ,0 , OnButtonPress);

Canvas(g_sErrorMeasurement, g_psPanels + 4,0, &g_sPushBtn, &g_sKentec320x240x16_SSD2119,
X_OFFSET, Y_OFFSET, (320 - (X_OFFSET*2)),205,
CANVAS_STYLE_APP_DRAWN, 0, 0, 0, 0, 0, 0, OnErrorMeasurmentPaint);

The below is the function called  in while loop 

void
UpdateError(float Accumulated_Energy,unsigned int Pulse,float Error)
{
bool bIntDisabled;


bIntDisabled = IntMasterDisable();

if(Flag.N_Actual_Ready)
{
Flag.N_Actual_Ready=0;
calculate_error();
Flag.Error_Displyed_Once = 1;

}

sprintf(g_pcRunningEnergy, "%0.2f", Accumulated_Energy);
sprintf(g_pcRunningPulse, "%d of %d", Scanner_Pulse_Received,Temp_pulses);

if((Flag.Pulse_Received)&&(Flag.Error_Displyed_Once==0))
{
ustrncpy(g_pcRunningError,"--.--%", sizeof(g_pcRunningError));

}
else
{
sprintf(g_pcRunningError, "%0.2f",Error);
}

if(g_ui32Panel == 4)
{
WidgetPaint((tWidget *)&g_sRunningError);
WidgetPaint((tWidget *)&g_sRunnigEnergy);
WidgetPaint((tWidget *)&g_sRunningPulse);
}
if(bIntDisabled == false)
{
IntMasterEnable();
}
}

  • Hello Rajesh,

    I have not gone into that level of development with our Graphics library widgets before, but one of my colleagues has been putting together documentation for our graphics library that is planned for release later this year and he may be able to give some better guidance here. He will return to office tomorrow. I will ask him to reply with any ideas he can offer.

    Best Regards,

    Ralph

  • Hi,

      What do you mean by fluctuating? You sent a still image, not a video. So it is difficult to visualize what is wrong. In any case, I'm not sure if calling WidgetPaint in a while loop is the correct way. I look at some of the grlib examples and WidgetPaint is only called after an event that triggers a callback. Why do you need to call UpdateError in a while loop? I will suggest that you try to use a timer so you only call UpdateError periodically after some timer delay and see if that makes a difference.

  • Dear Charles,

     

    void UpdatePQSRegister(void)

    {

        //uint8_t pui8MACAddr[6];

                   

                                    sprintf(g_pcActive_P,     "P:         %d",boot_cnt);

                                    sprintf(g_pcReactive_QL, "QL:   %0.4f",Reactive_Energy_Lag);

                                    sprintf(g_pcReactive_QC, "QC:  %0.4f",Reactive_Energy_Lag);

                                    sprintf(g_pcApprent_S,                 "S:         %0.5f",Apprent_Energy);

                   

                                    if(Timer_flag)

                                    {             

                                                                    Timer_flag=0;

                                                                    WidgetPaint((tWidget *)&g_sActive_P);

                                                                    WidgetPaint((tWidget *)&g_sReactive_QL);

                                                                    WidgetPaint((tWidget *)&g_sReactive_QC);

                                                                    WidgetPaint((tWidget *)&g_sApprent_S);

                                    }             

                    }

     

    The above function- UpdatePQSRegister(); is called in while (1) in void main(void) function.

    The Timer0 interrupt configured for  1 sec and once interrupt arrives we are set timerflag=1

    And go for widget paint as shown above.

     

    I am attaching video also  too for your refrence.

    I video you can see P,QL,QS,S value blinking while refreshing.

     

    Regards,

    Rajesh Varma

  • Hi Rajesh,

      In the video, I don't particularly see anything wrong. Perhaps there is a difference watching the display in person. For example, I see the P value changing from 4419 to 4420, 4421 every second when the display is refreshed. Basically, I don't the blinking. Perhaps, can you elaborate what blinking is it. 

      Do a experiment, can you comment out some of the WidgetPaint? Do you see same blinking or slightly improving although I can't see any blinking on the video.

                                                                    WidgetPaint((tWidget *)&g_sActive_P);

                                                                  //  WidgetPaint((tWidget *)&g_sReactive_QL);

                                                                  //  WidgetPaint((tWidget *)&g_sReactive_QC);

                                                                  //  WidgetPaint((tWidget *)&g_sApprent_S);

  • I have used the graphics library with the Kentec display. One application did the same thing as in your project -- a sensor was read and each new value was used to update the display.

    I refreshed my updating status readout by first overwriting the old value with the background color and then writing the new value with the foreground color. Does it "blink?" It's hard to say and it depends on the time between when the overwrite paint was called and the new-value paint was called. Is there a better way to do this? Perhaps, but that requires a deep dive into the library.

    In conjunction with this, one thing I've noticed is that when you use a font with variable character width, that is, character width depends on the character, the display may appear to jump based on the previous value and the new value. Look at the second video. When the QC value goes from 1770 to 1771 to 1772, the '1' is thinner than either the '0' that precedes it or the '2' that follows it. So all of the characters to the right of the ones digit in the display (including the decimal point) shift slightly to the left when '1770' changes to '1771' and they all move slightly to the right when '1771' changes to '1772'. That looks like a "jump" in the display. Perhaps changing to a fixed-width font will mitigate this.