diff --git a/settings.txt b/settings.txt index dbe400b..408fec0 100644 --- a/settings.txt +++ b/settings.txt @@ -98,6 +98,10 @@ # This is happening or Raspberry Pi Zero 2W. Disable this to use SW decoding for that case. #hw-decode = true +# Request extra frames onevery key press. Usefull if you do not see last updates after key press +# Enable for RPI hardware decoding and other systems where hardware decoder tends to buffer frames +#force-redraw = false + # Corrects aspect of UI #aspect-correction = 1 diff --git a/src/helper/protocol_const.h b/src/helper/protocol_const.h index ba30976..32c02fb 100644 --- a/src/helper/protocol_const.h +++ b/src/helper/protocol_const.h @@ -38,7 +38,7 @@ #define BTN_SIRI 5 #define BTN_MICROPHONE 7 -#define BTN_12 12 +#define BTN_SCREEN_REFRESH 12 // Navigation buttons #define BTN_LEFT 100 #define BTN_RIGHT 101 diff --git a/src/main.cpp b/src/main.cpp index 7311fad..fb236e5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -59,8 +59,8 @@ void processKey(Protocol &protocol, SDL_Keysym key, RunParams ¶ms) return; case SDLK_r: + protocol.sendKey(BTN_SCREEN_REFRESH); params.dirty = true; - protocol.sendKey(BTN_12); return; case SDLK_h: diff --git a/src/protocol.cpp b/src/protocol.cpp index 1a08eb1..83bca8f 100644 --- a/src/protocol.cpp +++ b/src/protocol.cpp @@ -119,6 +119,12 @@ void Protocol::sendKey(int key) write_uint32_le(&buf[0], key); send(CMD_CONTROL, false, buf, 4); + + if(Settings::forceRedraw) + { + write_uint32_le(&buf[0], BTN_SCREEN_REFRESH); + send(CMD_CONTROL, false, buf, 4); + } } void Protocol::sendFile(const char *filename, const char *value) diff --git a/src/settings.h b/src/settings.h index 6f033a7..a94e1ed 100644 --- a/src/settings.h +++ b/src/settings.h @@ -35,6 +35,7 @@ public: static inline Setting fontSize{"font-size", 30}; static inline Setting vsync{"vsync", false}; static inline Setting hwDecode{"hw-decode", true}; + static inline Setting forceRedraw{"force-redraw", false}; static inline Setting aspectCorrection{"aspect-correction", 1}; static inline Setting fastScale{"fast-render-scale", false}; static inline Setting videoQueue{"video-buffer-size", 32};