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();
}
}