I want to reduce the cycle to update temperatures on my CYD to 1s, but I need to understand why it is currently 10s when the value currently is 1,000,000ms? The source of the temperature data is coming from a seperate ESP32 over ESP-NOW.
// Create an animation to update the text label with the latest temperature value every 10 seconds
lv_anim_t a_temp;
lv_anim_init(&a_temp);
lv_anim_set_exec_cb(&a_temp, set_temp);
lv_anim_set_duration(&a_temp, 1000000);
lv_anim_set_playback_duration(&a_temp, 1000000);
Hi Sara,
This is very much unchanged from 3.1 Basic Temperature Display in the “Learn_LVGL_Build_GUIs_for_ESP32_Projects_V1_4” book
// Set the temperature value in the bar and text label
static void set_temp(void *text_label_temp_value, int32_t v) {
// Get the latest temperature reading in Celsius or Fahrenheit
#if TEMP_CELSIUS
float bme_temp = incomingTemp;
const char degree_symbol[] = “\u00B0C”;
Regards
Dion
Hi.
It seems there is a typo in our code.
According to the documentation, that value is in milliseconds.
So, if you want a one-second animation, you need to pass 1000 as the last parameter.
Like so:
lv_anim_set_duration(&a_temp, 1000);
lv_anim_set_playback_duration(&a_temp, 1000);
Let me know if this fixes the issue.
Regards,
Sara
Thank you Sara, it did. Although the original code was 1,000,000ms, it was still updating every 10 seconds so I couldn’t understand that and hence the reason for query.
Anyway this query can be closed.
regards
Dion
Hi.
There’s probably an issue in our original code in the way the animation is being handled.
We’ll take a look a it and update the code and eBook soon.
Thanks.
I’ll mark this issue as resolved. If you need further help, you just need to open a new question in our forum.
Regards,
Sara