• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

Duration of set_temp() callback function

Q&A Forum › Category: ESP32 › Duration of set_temp() callback function
0 Vote Up Vote Down
Dion Zappacosta asked 1 week ago

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

Question Tags: CYD, Esp-now
5 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 1 week ago

Hi.
Can you show me your set_temp() function?

Regards,
Sara

0 Vote Up Vote Down
Dion Zappacosta answered 1 week ago

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

0 Vote Up Vote Down
Sara Santos Staff answered 6 days ago

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
 

0 Vote Up Vote Down
Dion Zappacosta answered 6 days ago

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

0 Vote Up Vote Down
Sara Santos Staff answered 5 days ago

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

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [eBook Updated] Learn Raspberry Pi Pico/Pico W with MicroPython eBook – Version 1.2 May 26, 2025
  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.