Mentions légales du service

Skip to content
Snippets Groups Projects
Commit baca8fa4 authored by Simon Castellan's avatar Simon Castellan
Browse files

Changed repainting policy.

First, repainting is done as soon as we get an update, with a maximum
of a certain number of updates per second. We have two modes: a
normal, where there are five  updates every secondes, and a fast mode,
enabled when drawing when updates are propagated immediately.
parent 1ccd2e36
No related branches found
No related tags found
No related merge requests found
......@@ -12,6 +12,9 @@
namespace chrono = std::chrono;
namespace app
{
/**
* Time to wait after the last update from VNC before updating the screen
* (in microseconds).
......@@ -19,14 +22,13 @@ namespace chrono = std::chrono;
* VNC servers tend to send a lot of small updates in a short period of time.
* This delay allows grouping those small updates into a larger screen update.
*/
constexpr chrono::milliseconds update_delay{150};
namespace app
{
constexpr chrono::milliseconds update_delay_normal{200};
constexpr chrono::milliseconds update_delay_fast{0};
screen::screen(rmioc::screen& device, rfbClient* vnc_client)
: device(device)
, vnc_client(vnc_client)
, update_delay(update_delay_normal)
{
rfbClientSetClientData(
this->vnc_client,
......@@ -40,6 +42,12 @@ screen::screen(rmioc::screen& device, rfbClient* vnc_client)
this->vnc_client->GotFrameBufferUpdate = screen::update_framebuf;
}
void screen::set_update_fast() {
this->update_delay = update_delay_fast;
}
void screen::set_update_normal() {
this->update_delay = update_delay_normal;
}
void screen::flush_update()
{
this->device.update(
......@@ -53,12 +61,13 @@ auto screen::event_loop() -> event_loop_status
{
int remaining_wait_time =
chrono::duration_cast<chrono::milliseconds>(
this->update_info.last_update_time + update_delay
this->update_info.last_update_time + this->update_delay
- chrono::steady_clock::now()
).count();
if (remaining_wait_time <= 0)
{
this->update_info.last_update_time = chrono::steady_clock::now();
this->update_info.has_update = false;
log::print("Screen update")
......@@ -159,7 +168,7 @@ void screen::update_framebuf(rfbClient* vnc_client, int x, int y, int w, int h)
that->update_info.has_update = true;
}
that->update_info.last_update_time = chrono::steady_clock::now();
/* that->update_info.last_update_time = chrono::steady_clock::now();*/
}
} // namespace app
......@@ -29,12 +29,16 @@ public:
/** reMarkable screen device. */
rmioc::screen& device;
private:
void set_update_fast();
void set_update_normal();
private:
/** VNC connection. */
rfbClient* vnc_client;
std::chrono::milliseconds update_delay;
/**
* Called by the VNC client library to initialize our local framebuffer.
*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment