Best way to save value when slider is used


I have application in which slider is used in order to set particular value. I need to save this value in ini configuration file. But when it is best way to save value? Looks like slider event callback is not the best place to save events since they appear too often.

Why not? As far as I understand LV_EVENT_RELEASED will be called when you release slider. So save data when slider released.
Besides documentation tells

  • LV_EVENT_VALUE_CHANGED Sent while the slider is being dragged or changed with keys. The event is sent continuously while the slider is dragged and once when released. Use lv_slider_is_dragged to determine whether the Slider is still being dragged or has just been released.

In this case lv_slider_is_dragged() should return false in LV_EVENT_VALUE_CHANGED-handler if slider released, in this moment you can save data.

Checking for LV_EVENT_RELEASED and using lv_slider_is_dragged() both don’t seem to work, not on my 32F769IDISCOVERY nor inside of a simulator. lv_slider_is_dragged() only seems to return false whenever I use my keyboard inside of the simulator to move the slider.

What do you mean? LV_EVENT_RELEASED is not called when you release the slider?

Yeah, I thought I added all the events, but turns out I didn’t, so that was the problem…

Thanks for you fast response though!