I've never been entirely fond of the results with that approach last I checked, but it's possibly less terrible on some devices (the latency at which the frontlight reacts varies wildly between devices).
Regardless of how it ends up working, yeah, that's basically the best you can do from userland

.
Keep in mind that wait might block *noticeably* longer than the visible refresh. Not a lot, but it's noticeable, especially given the timing issues mentioned earlier. And also that the wait ioctl is hilariously borked on some devices (Libra 1 for sure, jury's still out for the Libra 2 & Nia).