control: use new refresh task control.

This commit is contained in:
Maxim Poliakovski 2023-07-31 03:53:13 +02:00
parent 0ca1ebf724
commit 4872af1053

View File

@ -31,7 +31,6 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
Kudos to joevt#3510 for his precious technical help and HW hacking. Kudos to joevt#3510 for his precious technical help and HW hacking.
*/ */
#include <core/timermanager.h>
#include <devices/common/i2c/athens.h> #include <devices/common/i2c/athens.h>
#include <devices/common/i2c/i2c.h> #include <devices/common/i2c/i2c.h>
#include <devices/deviceregistry.h> #include <devices/deviceregistry.h>
@ -293,18 +292,10 @@ void ControlVideo::enable_display()
/ (new_height + vert_blank); / (new_height + vert_blank);
LOG_F(INFO, "Control: refresh rate set to %f Hz", this->refresh_rate); LOG_F(INFO, "Control: refresh rate set to %f Hz", this->refresh_rate);
if (this->refresh_task_id) { this->stop_refresh_task();
TimerManager::get_instance()->cancel_timer(this->refresh_task_id);
}
// set up periodic timer for display updates // set up periodic timer for display updates
uint64_t refresh_interval = static_cast<uint64_t>(1.0f / refresh_rate * NS_PER_SEC + 0.5); this->start_refresh_task();
this->refresh_task_id = TimerManager::get_instance()->add_cyclic_timer(
refresh_interval,
[this]() {
this->update_screen();
}
);
this->blank_on = false; this->blank_on = false;