// Below is the function which upon calling is making the display to flicker.
void read_data(void)
{
CurrentValue_prev= CurrentValue;
temperature_prev=temperature;
//start_flag is when the user press start
if(START_flag == 1)
{
digitalWrite(RelayPIN, LOW);
//-------------------------------read the rtd temp------------------------------
float rtdResistance = max31865.readRTD();
temperature = max31865.temperature(PT100_RNOMINAL, REF_RESISTOR);
//--------------------------------------------------------------------------------
/*If you are reading DC current, use this function to read DC current*/
CurrentValue= readDCCurrent(currentSensorPin);
//dd_flag is for unit value chosen by the user
if(dd_flag==1)
{
float divide=temperature * 9.0/5;
temperature=divide+ 32;
float salt =CurrentValue*0.00220462;
CurrentValue=salt;
}
else if(dd_flag==3)
{
CurrentValue= 15; //readDCCurrent(currentSensorPin);
temperature = 15; //max31865.temperature(PT100_RNOMINAL, REF_RESISTOR);
}
else if(dd_flag==7)
{
CurrentValue=0;
temperature=0;
}
}
else
{
CurrentValue=0;
temperature=0;
digitalWrite(RelayPIN, HIGH);
}
void loop()
{
lv_timer_handler();
read_data();
if(CurrentValue_prev!=CurrentValue && START_flag==1)
{
lv_example_style_3();
lv_example_style_4();
// delay(1000);
}
else
{
CurrentValue=0;
temperature=0;
}
}
I think the above code is the cause of flickering in my display!Do you have any siggestion for solving it? I will upload a gif of the flickering!