Rename screenshot module to k5viewer

This commit is contained in:
Armel FAUVEAU committed 2026-07-09 05:22:39 +02:00
1 parent e2d21c61c2
commit 46034ec39f
19 files changed
+133 -133

No files matched your search

+4 -4
View File
@@ -180,8 +180,8 @@ enable_feature(ENABLE_FEAT_F4HWN)
enable_feature(ENABLE_FEAT_F4HWN_GAME enable_feature(ENABLE_FEAT_F4HWN_GAME
app/breakout.c app/breakout.c
) )
enable_feature(ENABLE_FEAT_F4HWN_SCREENSHOT enable_feature(ENABLE_FEAT_F4HWN_K5VIEWER
screenshot.c k5viewer.c
) )
enable_feature(ENABLE_FEAT_F4HWN_SPECTRUM) enable_feature(ENABLE_FEAT_F4HWN_SPECTRUM)
enable_feature(ENABLE_FEAT_F4HWN_RX_TX_TIMER) enable_feature(ENABLE_FEAT_F4HWN_RX_TX_TIMER)
@@ -213,8 +213,8 @@ enable_feature(ENABLE_FEAT_F4HWN_RXTX_LOG
enable_feature(ENABLE_FEAT_F4HWN_RXTX_LOG_WRAP) enable_feature(ENABLE_FEAT_F4HWN_RXTX_LOG_WRAP)
enable_feature(ENABLE_FEAT_F4HWN_RXTX_LOG_K5VIEWER) enable_feature(ENABLE_FEAT_F4HWN_RXTX_LOG_K5VIEWER)
if(ENABLE_FEAT_F4HWN_RXTX_LOG_K5VIEWER AND NOT (ENABLE_FEAT_F4HWN_RXTX_LOG AND ENABLE_FEAT_F4HWN_SCREENSHOT)) if(ENABLE_FEAT_F4HWN_RXTX_LOG_K5VIEWER AND NOT (ENABLE_FEAT_F4HWN_RXTX_LOG AND ENABLE_FEAT_F4HWN_K5VIEWER))
message(FATAL_ERROR "ENABLE_FEAT_F4HWN_RXTX_LOG_K5VIEWER requires ENABLE_FEAT_F4HWN_RXTX_LOG (log data) and ENABLE_FEAT_F4HWN_SCREENSHOT (serial transport).") message(FATAL_ERROR "ENABLE_FEAT_F4HWN_RXTX_LOG_K5VIEWER requires ENABLE_FEAT_F4HWN_RXTX_LOG (log data) and ENABLE_FEAT_F4HWN_K5VIEWER (serial transport).")
endif() endif()
if(ENABLE_FEAT_F4HWN_BEAM AND NOT ENABLE_AIRCOPY) if(ENABLE_FEAT_F4HWN_BEAM AND NOT ENABLE_AIRCOPY)
+8 -8
View File
@@ -30,8 +30,8 @@
#include "settings.h" #include "settings.h"
#include <stddef.h> #include <stddef.h>
#ifdef ENABLE_FEAT_F4HWN_SCREENSHOT #ifdef ENABLE_FEAT_F4HWN_K5VIEWER
#include "screenshot.h" #include "k5viewer.h"
#endif #endif
static const uint16_t Obfuscation[8] = { 0x6C16, 0xE614, 0x912E, 0x400D, 0x3521, 0x40D5, 0x0313, 0x80E9 }; static const uint16_t Obfuscation[8] = { 0x6C16, 0xE614, 0x912E, 0x400D, 0x3521, 0x40D5, 0x0313, 0x80E9 };
@@ -140,8 +140,8 @@ static void AIRCOPY_clear()
{ {
crc[i] = 0; crc[i] = 0;
} }
#ifdef ENABLE_FEAT_F4HWN_SCREENSHOT #ifdef ENABLE_FEAT_F4HWN_K5VIEWER
SCREENSHOT_Update(true); K5VIEWER_Update(true);
#endif #endif
} }
@@ -170,8 +170,8 @@ static inline void AIRCOPY_CheckComplete(uint16_t *num)
if (done >= map->total_blocks) if (done >= map->total_blocks)
{ {
gAircopyState = AIRCOPY_COMPLETE; gAircopyState = AIRCOPY_COMPLETE;
#ifdef ENABLE_FEAT_F4HWN_SCREENSHOT #ifdef ENABLE_FEAT_F4HWN_K5VIEWER
SCREENSHOT_Update(false); K5VIEWER_Update(false);
#endif #endif
} }
} }
@@ -222,8 +222,8 @@ bool AIRCOPY_SendMessage(void)
// Check if transfer is complete // Check if transfer is complete
if (CurrentSegmentIndex >= map->num_segments) { if (CurrentSegmentIndex >= map->num_segments) {
gAircopyState = AIRCOPY_COMPLETE; gAircopyState = AIRCOPY_COMPLETE;
#ifdef ENABLE_FEAT_F4HWN_SCREENSHOT #ifdef ENABLE_FEAT_F4HWN_K5VIEWER
SCREENSHOT_Update(false); K5VIEWER_Update(false);
#endif #endif
return 0; return 0;
} }
+10 -10
View File
@@ -83,8 +83,8 @@
#include "ui/ui.h" #include "ui/ui.h"
#include "ui/welcome.h" #include "ui/welcome.h"
#ifdef ENABLE_FEAT_F4HWN_SCREENSHOT #ifdef ENABLE_FEAT_F4HWN_K5VIEWER
#include "screenshot.h" #include "k5viewer.h"
#endif #endif
static bool flagSaveVfo; static bool flagSaveVfo;
@@ -230,8 +230,8 @@ static void ScreenSaverRenderLogoPlus(bool reset)
static void ScreenSaverUpdateViewer(void) static void ScreenSaverUpdateViewer(void)
{ {
#ifdef ENABLE_FEAT_F4HWN_SCREENSHOT #ifdef ENABLE_FEAT_F4HWN_K5VIEWER
SCREENSHOT_Update(false); K5VIEWER_Update(false);
#endif #endif
} }
@@ -1121,10 +1121,10 @@ static void HandleVox(void)
void APP_Update(void) void APP_Update(void)
{ {
#ifdef ENABLE_FEAT_F4HWN_SCREENSHOT #ifdef ENABLE_FEAT_F4HWN_K5VIEWER
// Parse incoming packets on every tick so serial keys are never missed, // Parse incoming packets on every tick so serial keys are never missed,
// regardless of whether the screen needs redrawing. // regardless of whether the screen needs redrawing.
SCREENSHOT_ParseInput(); K5VIEWER_ParseInput();
#endif #endif
#ifdef ENABLE_VOICE #ifdef ENABLE_VOICE
@@ -1666,15 +1666,15 @@ void APP_TimeSlice10ms(void)
UI_DisplayStatus(); UI_DisplayStatus();
} }
#ifdef ENABLE_FEAT_F4HWN_SCREENSHOT #ifdef ENABLE_FEAT_F4HWN_K5VIEWER
if (gUpdateDisplayCurrent || gUpdateStatusCurrent if (gUpdateDisplayCurrent || gUpdateStatusCurrent
#ifdef ENABLE_FEAT_F4HWN_LOGO_SAV #ifdef ENABLE_FEAT_F4HWN_LOGO_SAV
|| screenSaverRendered || screenSaverRendered
#endif #endif
) { ) {
SCREENSHOT_Update(false); K5VIEWER_Update(false);
} else if (SCREENSHOT_HasPendingStateChange()) { } else if (K5VIEWER_HasPendingStateChange()) {
SCREENSHOT_Update(false); K5VIEWER_Update(false);
} }
#endif #endif
+6 -6
View File
@@ -16,8 +16,8 @@
#include "app/breakout.h" #include "app/breakout.h"
#ifdef ENABLE_FEAT_F4HWN_SCREENSHOT #ifdef ENABLE_FEAT_F4HWN_K5VIEWER
#include "screenshot.h" #include "k5viewer.h"
#endif #endif
static uint32_t randSeed = 1; static uint32_t randSeed = 1;
@@ -304,10 +304,10 @@ static void OnKeyDown(uint8_t key)
// HandleUserInput // HandleUserInput
static bool HandleUserInput() static bool HandleUserInput()
{ {
#ifdef ENABLE_FEAT_F4HWN_SCREENSHOT #ifdef ENABLE_FEAT_F4HWN_K5VIEWER
// Parse incoming packets on every tick so serial keys are never missed, // Parse incoming packets on every tick so serial keys are never missed,
// regardless of whether the screen needs redrawing. // regardless of whether the screen needs redrawing.
SCREENSHOT_ParseInput(); K5VIEWER_ParseInput();
#endif #endif
kbd.prev = kbd.current; kbd.prev = kbd.current;
@@ -388,10 +388,10 @@ void APP_RunBreakout(void) {
ST7565_BlitStatusLine(); // Blank status line ST7565_BlitStatusLine(); // Blank status line
ST7565_BlitFullScreen(); ST7565_BlitFullScreen();
#ifdef ENABLE_FEAT_F4HWN_SCREENSHOT #ifdef ENABLE_FEAT_F4HWN_K5VIEWER
if(isPaused || swap == 0) if(isPaused || swap == 0)
{ {
SCREENSHOT_Update(false); K5VIEWER_Update(false);
} }
#endif #endif
} }
+7 -7
View File
@@ -27,8 +27,8 @@
#include "ui/helper.h" #include "ui/helper.h"
#include "ui/main.h" #include "ui/main.h"
#ifdef ENABLE_FEAT_F4HWN_SCREENSHOT #ifdef ENABLE_FEAT_F4HWN_K5VIEWER
#include "screenshot.h" #include "k5viewer.h"
#endif #endif
#ifdef ENABLE_FEAT_F4HWN_SPECTRUM #ifdef ENABLE_FEAT_F4HWN_SPECTRUM
@@ -2461,10 +2461,10 @@ static void UpdateListening()
static void Tick() static void Tick()
{ {
#ifdef ENABLE_FEAT_F4HWN_SCREENSHOT #ifdef ENABLE_FEAT_F4HWN_K5VIEWER
// Parse incoming packets on every tick so serial keys are never missed, // Parse incoming packets on every tick so serial keys are never missed,
// regardless of whether the screen needs redrawing. // regardless of whether the screen needs redrawing.
SCREENSHOT_ParseInput(); K5VIEWER_ParseInput();
#endif #endif
if (gNextTimeslice) if (gNextTimeslice)
@@ -2532,9 +2532,9 @@ static void Tick()
if (redrawScreen || ++renderTimer >= RENDER_PERIOD_TICKS) if (redrawScreen || ++renderTimer >= RENDER_PERIOD_TICKS)
{ {
Render(); Render();
// For screenshot // For K5Viewer
#ifdef ENABLE_FEAT_F4HWN_SCREENSHOT #ifdef ENABLE_FEAT_F4HWN_K5VIEWER
SCREENSHOT_Update(false); K5VIEWER_Update(false);
#endif #endif
redrawScreen = false; redrawScreen = false;
renderTimer = 0; renderTimer = 0;
+2 -2
View File
@@ -863,7 +863,7 @@ void UART_HandleCommand(uint32_t Port)
#endif #endif
} // switch } // switch
#ifdef ENABLE_FEAT_F4HWN_SCREENSHOT #ifdef ENABLE_FEAT_F4HWN_K5VIEWER
gUART_LockScreenshot = 20; // lock screenshot gUART_LockK5Viewer = 20; // lock the K5Viewer stream
#endif #endif
} }
+2 -2
View File
@@ -27,7 +27,7 @@ KEY_Code_t gKeyReading1 = KEY_INVALID;
uint16_t gDebounceCounter = 0; uint16_t gDebounceCounter = 0;
bool gWasFKeyPressed = false; bool gWasFKeyPressed = false;
#ifdef ENABLE_FEAT_F4HWN_SCREENSHOT #ifdef ENABLE_FEAT_F4HWN_K5VIEWER
// Short press: hold key for SERIAL_KEY_SHORT_POLLS calls. // Short press: hold key for SERIAL_KEY_SHORT_POLLS calls.
// Must exceed key_debounce_10ms (2) to trigger ProcessKey(key, true, false). // Must exceed key_debounce_10ms (2) to trigger ProcessKey(key, true, false).
#define SERIAL_KEY_SHORT_POLLS 5 #define SERIAL_KEY_SHORT_POLLS 5
@@ -184,7 +184,7 @@ static const KEY_Code_t keyboard[5][4] = {
KEY_Code_t KEYBOARD_Poll(void) KEY_Code_t KEYBOARD_Poll(void)
{ {
#ifdef ENABLE_FEAT_F4HWN_SCREENSHOT #ifdef ENABLE_FEAT_F4HWN_K5VIEWER
// Serial-injected key: hold it for SHORT or LONG polls depending on press type, // Serial-injected key: hold it for SHORT or LONG polls depending on press type,
// so the debounce counter in app.c reaches the right threshold: // so the debounce counter in app.c reaches the right threshold:
// - Short: key_debounce_10ms (2) → ProcessKey(key, true, false) // - Short: key_debounce_10ms (2) → ProcessKey(key, true, false)
+1 -1
View File
@@ -64,7 +64,7 @@ extern KEY_Code_t gKeyReading1;
extern uint16_t gDebounceCounter; extern uint16_t gDebounceCounter;
extern bool gWasFKeyPressed; extern bool gWasFKeyPressed;
#ifdef ENABLE_FEAT_F4HWN_SCREENSHOT #ifdef ENABLE_FEAT_F4HWN_K5VIEWER
// Serial-injected key (written by UART/VCP parser, consumed by KEYBOARD_Poll). // Serial-injected key (written by UART/VCP parser, consumed by KEYBOARD_Poll).
extern volatile KEY_Code_t gKeyFromSerial; extern volatile KEY_Code_t gKeyFromSerial;
+3 -3
View File
@@ -24,7 +24,7 @@
#include "driver/st7565.h" #include "driver/st7565.h"
#include "driver/system.h" #include "driver/system.h"
#include "misc.h" #include "misc.h"
#include "screenshot.h" #include "k5viewer.h"
#define SPIx SPI1 #define SPIx SPI1
@@ -164,8 +164,8 @@ void ST7565_DrawLine(const unsigned int Column, const unsigned int Line, const u
void ST7565_BlitLine(unsigned line) void ST7565_BlitLine(unsigned line)
{ {
ST7565_BlitScreen(line + 1); ST7565_BlitScreen(line + 1);
#ifdef ENABLE_FEAT_F4HWN_SCREENSHOT #ifdef ENABLE_FEAT_F4HWN_K5VIEWER
SCREENSHOT_Update(true); // Force immediate capture K5VIEWER_Update(true); // Force immediate capture
#endif #endif
} }
+2 -2
View File
@@ -23,7 +23,7 @@
#include "py32f071_ll_gpio.h" #include "py32f071_ll_gpio.h"
#include "py32f071_ll_usart.h" #include "py32f071_ll_usart.h"
#ifdef ENABLE_FEAT_F4HWN_SCREENSHOT #ifdef ENABLE_FEAT_F4HWN_K5VIEWER
#include "driver/keyboard.h" #include "driver/keyboard.h"
#endif #endif
@@ -150,7 +150,7 @@ void UART_LogSend(const void *pBuffer, uint32_t Size)
} }
} }
#ifdef ENABLE_FEAT_F4HWN_SCREENSHOT #ifdef ENABLE_FEAT_F4HWN_K5VIEWER
bool UART_IsCableConnected(void) { bool UART_IsCableConnected(void) {
static uint8_t read_ptr = 0; static uint8_t read_ptr = 0;
static ParseState_t state = STATE_IDLE; static ParseState_t state = STATE_IDLE;
+1 -1
View File
@@ -27,7 +27,7 @@ void UART_Init(void);
void UART_Send(const void *pBuffer, uint32_t Size); void UART_Send(const void *pBuffer, uint32_t Size);
void UART_LogSend(const void *pBuffer, uint32_t Size); void UART_LogSend(const void *pBuffer, uint32_t Size);
#ifdef ENABLE_FEAT_F4HWN_SCREENSHOT #ifdef ENABLE_FEAT_F4HWN_K5VIEWER
bool UART_IsCableConnected(void); bool UART_IsCableConnected(void);
#endif #endif
+4 -4
View File
@@ -18,7 +18,7 @@
#include "usb_config.h" #include "usb_config.h"
#include "py32f071_ll_bus.h" #include "py32f071_ll_bus.h"
#ifdef ENABLE_FEAT_F4HWN_SCREENSHOT #ifdef ENABLE_FEAT_F4HWN_K5VIEWER
#include "driver/keyboard.h" #include "driver/keyboard.h"
#endif #endif
@@ -42,8 +42,8 @@ void VCP_Init()
NVIC_EnableIRQ(USBD_IRQn); NVIC_EnableIRQ(USBD_IRQn);
} }
#ifdef ENABLE_FEAT_F4HWN_SCREENSHOT #ifdef ENABLE_FEAT_F4HWN_K5VIEWER
bool VCP_ScreenshotPing(void) bool VCP_K5ViewerPing(void)
{ {
// State machine for parsing incoming packets: // State machine for parsing incoming packets:
// Keepalive: 0x55 0xAA 0x00 0x00 → viewer alive, no extensions // Keepalive: 0x55 0xAA 0x00 0x00 → viewer alive, no extensions
@@ -93,4 +93,4 @@ bool VCP_ScreenshotPing(void)
return connected; return connected;
} }
#endif // ENABLE_FEAT_F4HWN_SCREENSHOT #endif // ENABLE_FEAT_F4HWN_K5VIEWER
+2 -2
View File
@@ -29,8 +29,8 @@ extern volatile uint32_t VCP_RxBufPointer;
void VCP_Init(); void VCP_Init();
#ifdef ENABLE_FEAT_F4HWN_SCREENSHOT #ifdef ENABLE_FEAT_F4HWN_K5VIEWER
bool VCP_ScreenshotPing(void); bool VCP_K5ViewerPing(void);
#endif #endif
static inline void VCP_Send(const uint8_t *Buf, uint32_t Size) static inline void VCP_Send(const uint8_t *Buf, uint32_t Size)
+54 -54
View File
@@ -16,7 +16,7 @@
#include "debugging.h" #include "debugging.h"
#include "driver/st7565.h" #include "driver/st7565.h"
#include "screenshot.h" #include "k5viewer.h"
#include "misc.h" #include "misc.h"
#include "driver/vcp.h" #include "driver/vcp.h"
#include "driver/keyboard.h" #include "driver/keyboard.h"
@@ -50,7 +50,7 @@ static bool rfLogSent = false;
#endif #endif
// FNV-1a over one 8-byte chunk, folded to 16 bits // FNV-1a over one 8-byte chunk, folded to 16 bits
static uint16_t SCREENSHOT_Hash(const uint8_t *data) static uint16_t K5VIEWER_Hash(const uint8_t *data)
{ {
uint32_t h = 2166136261u; uint32_t h = 2166136261u;
for (uint8_t i = 0; i < 8; i++) { for (uint8_t i = 0; i < 8; i++) {
@@ -59,26 +59,26 @@ static uint16_t SCREENSHOT_Hash(const uint8_t *data)
return (uint16_t)(h ^ (h >> 16)); return (uint16_t)(h ^ (h >> 16));
} }
void SCREENSHOT_ParseInput(void) void K5VIEWER_ParseInput(void)
{ {
if (SCREENSHOT_IsLocked()) if (K5VIEWER_IsLocked())
return; return;
if (UART_IsCableConnected()) { if (UART_IsCableConnected()) {
keepAlive = 15; keepAlive = 15;
hasConnectionPing = true; hasConnectionPing = true;
gUSB_ScreenshotEnabled = false; gUSB_K5ViewerEnabled = false;
} }
else if (VCP_ScreenshotPing()) { else if (VCP_K5ViewerPing()) {
keepAlive = 15; keepAlive = 15;
hasConnectionPing = true; hasConnectionPing = true;
gUSB_ScreenshotEnabled = true; gUSB_K5ViewerEnabled = true;
} }
} }
static void SCREENSHOT_Send(const uint8_t *buf, uint16_t len) static void K5VIEWER_Send(const uint8_t *buf, uint16_t len)
{ {
if (gUSB_ScreenshotEnabled) { if (gUSB_K5ViewerEnabled) {
cdc_acm_data_send_with_dtr(buf, len); cdc_acm_data_send_with_dtr(buf, len);
} else { } else {
UART_Send(buf, len); UART_Send(buf, len);
@@ -86,37 +86,37 @@ static void SCREENSHOT_Send(const uint8_t *buf, uint16_t len)
} }
enum { enum {
SCREENSHOT_CHUNK_SIZE = 8, K5VIEWER_CHUNK_SIZE = 8,
SCREENSHOT_CHUNKS_PER_LINE = 16, K5VIEWER_CHUNKS_PER_LINE = 16,
SCREENSHOT_HALF_LINE_COLUMNS = LCD_WIDTH / 2, K5VIEWER_HALF_LINE_COLUMNS = LCD_WIDTH / 2,
SCREENSHOT_MARKER_BASE = 0xF0, K5VIEWER_MARKER_BASE = 0xF0,
SCREENSHOT_TYPE_DIFF = 0x02, K5VIEWER_TYPE_DIFF = 0x02,
SCREENSHOT_TYPE_RXTX_LOG = 0x05, K5VIEWER_TYPE_RXTX_LOG = 0x05,
SCREENSHOT_FLAG_DEEP_SLEEP = 1 << 0, K5VIEWER_FLAG_DEEP_SLEEP = 1 << 0,
SCREENSHOT_FLAG_LED_RED = 1 << 1, K5VIEWER_FLAG_LED_RED = 1 << 1,
SCREENSHOT_FLAG_LED_GREEN = 1 << 2, K5VIEWER_FLAG_LED_GREEN = 1 << 2,
}; };
static uint8_t SCREENSHOT_StateFlags(void) static uint8_t K5VIEWER_StateFlags(void)
{ {
uint8_t flags = 0; uint8_t flags = 0;
#ifdef ENABLE_FEAT_F4HWN_SLEEP #ifdef ENABLE_FEAT_F4HWN_SLEEP
if (gWakeUp) if (gWakeUp)
flags |= SCREENSHOT_FLAG_DEEP_SLEEP; flags |= K5VIEWER_FLAG_DEEP_SLEEP;
#endif #endif
if (BK4819_IsGpioOutSet(BK4819_GPIO5_PIN1_RED)) if (BK4819_IsGpioOutSet(BK4819_GPIO5_PIN1_RED))
flags |= SCREENSHOT_FLAG_LED_RED; flags |= K5VIEWER_FLAG_LED_RED;
if (BK4819_IsGpioOutSet(BK4819_GPIO6_PIN2_GREEN)) if (BK4819_IsGpioOutSet(BK4819_GPIO6_PIN2_GREEN))
flags |= SCREENSHOT_FLAG_LED_GREEN; flags |= K5VIEWER_FLAG_LED_GREEN;
return flags; return flags;
} }
#ifdef ENABLE_FEAT_F4HWN_RXTX_LOG_K5VIEWER #ifdef ENABLE_FEAT_F4HWN_RXTX_LOG_K5VIEWER
static bool SCREENSHOT_HasPendingRfLogUpdate(void) static bool K5VIEWER_HasPendingRfLogUpdate(void)
{ {
if ((gSerialViewerFeatures & SERIAL_VIEWER_FEATURE_RF_LOG) == 0) if ((gSerialViewerFeatures & SERIAL_VIEWER_FEATURE_RF_LOG) == 0)
return false; return false;
@@ -124,7 +124,7 @@ static bool SCREENSHOT_HasPendingRfLogUpdate(void)
return !rfLogSent || RXTX_LOG_K5ViewerSignature() != previousRfLogSignature; return !rfLogSent || RXTX_LOG_K5ViewerSignature() != previousRfLogSignature;
} }
static void SCREENSHOT_SendRfLog(void) static void K5VIEWER_SendRfLog(void)
{ {
// Capture the signature before streaming: a state change landing // Capture the signature before streaming: a state change landing
// during the blocking send still differs afterwards and triggers a // during the blocking send still differs afterwards and triggers a
@@ -134,56 +134,56 @@ static void SCREENSHOT_SendRfLog(void)
const uint16_t len = RXTX_LOG_K5VIEWER_PACKET_SIZE; const uint16_t len = RXTX_LOG_K5VIEWER_PACKET_SIZE;
uint8_t header[5] = { uint8_t header[5] = {
0xAA, 0x55, SCREENSHOT_TYPE_RXTX_LOG, 0xAA, 0x55, K5VIEWER_TYPE_RXTX_LOG,
(uint8_t)(len >> 8), (uint8_t)(len >> 8),
(uint8_t)(len & 0xFF) (uint8_t)(len & 0xFF)
}; };
SCREENSHOT_Send(header, 5); K5VIEWER_Send(header, 5);
RXTX_LOG_SendK5ViewerPacket(SCREENSHOT_Send); RXTX_LOG_SendK5ViewerPacket(K5VIEWER_Send);
uint8_t end = 0x0A; uint8_t end = 0x0A;
SCREENSHOT_Send(&end, 1); K5VIEWER_Send(&end, 1);
} }
#endif #endif
bool SCREENSHOT_HasPendingStateChange(void) bool K5VIEWER_HasPendingStateChange(void)
{ {
if (gUART_LockScreenshot > 0 || keepAlive == 0 || !hasConnectionPing) if (gUART_LockK5Viewer > 0 || keepAlive == 0 || !hasConnectionPing)
return false; return false;
#ifdef ENABLE_FEAT_F4HWN_RXTX_LOG_K5VIEWER #ifdef ENABLE_FEAT_F4HWN_RXTX_LOG_K5VIEWER
if (SCREENSHOT_HasPendingRfLogUpdate()) if (K5VIEWER_HasPendingRfLogUpdate())
return true; return true;
#endif #endif
return !wasConnected || SCREENSHOT_StateFlags() != previousStateFlags; return !wasConnected || K5VIEWER_StateFlags() != previousStateFlags;
} }
// Compute one 8-byte output chunk directly from the display buffers. // Compute one 8-byte output chunk directly from the display buffers.
// Frame layout: per line (status + 7 frame lines), 8 bit layers of // Frame layout: per line (status + 7 frame lines), 8 bit layers of
// 16 bytes each. Each bit layer is split into two 64-column chunks. // 16 bytes each. Each bit layer is split into two 64-column chunks.
static void SCREENSHOT_Chunk(uint8_t chunkIdx, uint8_t *dest) static void K5VIEWER_Chunk(uint8_t chunkIdx, uint8_t *dest)
{ {
const uint8_t chunkInLine = chunkIdx % SCREENSHOT_CHUNKS_PER_LINE; const uint8_t chunkInLine = chunkIdx % K5VIEWER_CHUNKS_PER_LINE;
const uint8_t line = chunkIdx / SCREENSHOT_CHUNKS_PER_LINE; const uint8_t line = chunkIdx / K5VIEWER_CHUNKS_PER_LINE;
const uint8_t bit = chunkInLine / 2; const uint8_t bit = chunkInLine / 2;
const uint8_t columnBase = (chunkInLine % 2) * SCREENSHOT_HALF_LINE_COLUMNS; const uint8_t columnBase = (chunkInLine % 2) * K5VIEWER_HALF_LINE_COLUMNS;
const uint8_t *src = (line == 0 ? gStatusLine : gFrameBuffer[line - 1]) const uint8_t *src = (line == 0 ? gStatusLine : gFrameBuffer[line - 1])
+ columnBase; + columnBase;
for (uint8_t j = 0; j < SCREENSHOT_CHUNK_SIZE; j++) { for (uint8_t j = 0; j < K5VIEWER_CHUNK_SIZE; j++) {
uint8_t acc = 0; uint8_t acc = 0;
for (uint8_t k = 0; k < SCREENSHOT_CHUNK_SIZE; k++) { for (uint8_t k = 0; k < K5VIEWER_CHUNK_SIZE; k++) {
if (src[j * SCREENSHOT_CHUNK_SIZE + k] & (1 << bit)) acc |= (1 << k); if (src[j * K5VIEWER_CHUNK_SIZE + k] & (1 << bit)) acc |= (1 << k);
} }
dest[j] = gSetting_set_inv ? ~acc : acc; dest[j] = gSetting_set_inv ? ~acc : acc;
} }
} }
void SCREENSHOT_Update(bool force) void K5VIEWER_Update(bool force)
{ {
if (SCREENSHOT_IsLocked()) if (K5VIEWER_IsLocked())
return; return;
if (keepAlive > 0) { if (keepAlive > 0) {
@@ -207,10 +207,10 @@ void SCREENSHOT_Update(bool force)
force = true; force = true;
} }
const uint8_t stateFlags = SCREENSHOT_StateFlags(); const uint8_t stateFlags = K5VIEWER_StateFlags();
const bool stateChanged = (stateFlags != previousStateFlags); const bool stateChanged = (stateFlags != previousStateFlags);
#ifdef ENABLE_FEAT_F4HWN_RXTX_LOG_K5VIEWER #ifdef ENABLE_FEAT_F4HWN_RXTX_LOG_K5VIEWER
const bool rfLogPending = SCREENSHOT_HasPendingRfLogUpdate(); const bool rfLogPending = K5VIEWER_HasPendingRfLogUpdate();
#else #else
const bool rfLogPending = false; const bool rfLogPending = false;
#endif #endif
@@ -221,9 +221,9 @@ void SCREENSHOT_Update(bool force)
uint8_t chunk[9]; // [0] = index, [1..8] = payload uint8_t chunk[9]; // [0] = index, [1..8] = payload
for (uint8_t chunkIdx = 0; chunkIdx < 128; chunkIdx++) { for (uint8_t chunkIdx = 0; chunkIdx < 128; chunkIdx++) {
SCREENSHOT_Chunk(chunkIdx, &chunk[1]); K5VIEWER_Chunk(chunkIdx, &chunk[1]);
bool changed = SCREENSHOT_Hash(&chunk[1]) != previousHash[chunkIdx]; bool changed = K5VIEWER_Hash(&chunk[1]) != previousHash[chunkIdx];
bool isForced = (chunkIdx == forcedBlock); bool isForced = (chunkIdx == forcedBlock);
if (changed || isForced || force) { if (changed || isForced || force) {
@@ -251,17 +251,17 @@ void SCREENSHOT_Update(bool force)
{ {
// ==== Send version marker and state flags ==== // ==== Send version marker and state flags ====
// 0xF0 keeps a resync-safe marker before the standard AA 55 header. // 0xF0 keeps a resync-safe marker before the standard AA 55 header.
uint8_t versionMarker = SCREENSHOT_MARKER_BASE | stateFlags; uint8_t versionMarker = K5VIEWER_MARKER_BASE | stateFlags;
SCREENSHOT_Send(&versionMarker, 1); K5VIEWER_Send(&versionMarker, 1);
// ==== Send header ==== // ==== Send header ====
uint8_t header[5] = { uint8_t header[5] = {
0xAA, 0x55, SCREENSHOT_TYPE_DIFF, 0xAA, 0x55, K5VIEWER_TYPE_DIFF,
(uint8_t)(deltaLen >> 8), (uint8_t)(deltaLen >> 8),
(uint8_t)(deltaLen & 0xFF) (uint8_t)(deltaLen & 0xFF)
}; };
SCREENSHOT_Send(header, 5); K5VIEWER_Send(header, 5);
// ==== SECOND PASS: Send only changed chunks ==== // ==== SECOND PASS: Send only changed chunks ====
for (uint8_t chunkIdx = 0; chunkIdx < 128; chunkIdx++) { for (uint8_t chunkIdx = 0; chunkIdx < 128; chunkIdx++) {
@@ -269,24 +269,24 @@ void SCREENSHOT_Update(bool force)
continue; continue;
chunk[0] = chunkIdx; chunk[0] = chunkIdx;
SCREENSHOT_Chunk(chunkIdx, &chunk[1]); K5VIEWER_Chunk(chunkIdx, &chunk[1]);
SCREENSHOT_Send(chunk, 9); K5VIEWER_Send(chunk, 9);
// Update the fingerprint only once the chunk is actually sent, // Update the fingerprint only once the chunk is actually sent,
// so chunks skipped by an early return stay marked as changed. // so chunks skipped by an early return stay marked as changed.
// Hashing the recomputed payload also keeps the fingerprint in // Hashing the recomputed payload also keeps the fingerprint in
// sync if the display buffer changed between the two passes. // sync if the display buffer changed between the two passes.
previousHash[chunkIdx] = SCREENSHOT_Hash(&chunk[1]); previousHash[chunkIdx] = K5VIEWER_Hash(&chunk[1]);
} }
uint8_t end = 0x0A; uint8_t end = 0x0A;
SCREENSHOT_Send(&end, 1); K5VIEWER_Send(&end, 1);
} }
#ifdef ENABLE_FEAT_F4HWN_RXTX_LOG_K5VIEWER #ifdef ENABLE_FEAT_F4HWN_RXTX_LOG_K5VIEWER
if (rfLogPending) if (rfLogPending)
SCREENSHOT_SendRfLog(); K5VIEWER_SendRfLog();
#endif #endif
previousStateFlags = stateFlags; previousStateFlags = stateFlags;
+5 -5
View File
@@ -14,11 +14,11 @@
* limitations under the License. * limitations under the License.
*/ */
#ifndef SCREENSHOT_H #ifndef K5VIEWER_H
#define SCREENSHOT_H #define K5VIEWER_H
void SCREENSHOT_Update(bool force); void K5VIEWER_Update(bool force);
void SCREENSHOT_ParseInput(void); void K5VIEWER_ParseInput(void);
bool SCREENSHOT_HasPendingStateChange(void); bool K5VIEWER_HasPendingStateChange(void);
#endif #endif
+7 -7
View File
@@ -210,9 +210,9 @@ volatile bool gTxTimeoutReached;
#ifdef ENABLE_FEAT_F4HWN_RX_TX_TIMER #ifdef ENABLE_FEAT_F4HWN_RX_TX_TIMER
volatile uint16_t gRxTimerCountdown_500ms; volatile uint16_t gRxTimerCountdown_500ms;
#endif #endif
#ifdef ENABLE_FEAT_F4HWN_SCREENSHOT #ifdef ENABLE_FEAT_F4HWN_K5VIEWER
volatile uint8_t gUART_LockScreenshot = 0; // lock screenshot if Chirp is used volatile uint8_t gUART_LockK5Viewer = 0; // lock the K5Viewer stream if Chirp is used
bool gUSB_ScreenshotEnabled = false; bool gUSB_K5ViewerEnabled = false;
#endif #endif
#endif #endif
@@ -646,11 +646,11 @@ void MR_PrintCacheStats(void)
#endif #endif
#ifdef ENABLE_FEAT_F4HWN_SCREENSHOT #ifdef ENABLE_FEAT_F4HWN_K5VIEWER
bool SCREENSHOT_IsLocked(void) bool K5VIEWER_IsLocked(void)
{ {
if (gUART_LockScreenshot > 0) { if (gUART_LockK5Viewer > 0) {
gUART_LockScreenshot--; gUART_LockK5Viewer--;
return true; return true;
} }
+4 -4
View File
@@ -336,11 +336,11 @@ extern volatile bool gTxTimeoutReached;
#ifdef ENABLE_FEAT_F4HWN_RX_TX_TIMER #ifdef ENABLE_FEAT_F4HWN_RX_TX_TIMER
extern volatile uint16_t gRxTimerCountdown_500ms; extern volatile uint16_t gRxTimerCountdown_500ms;
#endif #endif
#ifdef ENABLE_FEAT_F4HWN_SCREENSHOT #ifdef ENABLE_FEAT_F4HWN_K5VIEWER
extern volatile uint8_t gUART_LockScreenshot; // lock screenshot if Chirp is used extern volatile uint8_t gUART_LockK5Viewer; // lock the K5Viewer stream if Chirp is used
extern bool gUSB_ScreenshotEnabled; extern bool gUSB_K5ViewerEnabled;
bool SCREENSHOT_IsLocked(void); bool K5VIEWER_IsLocked(void);
#endif #endif
#endif #endif
+4 -4
View File
@@ -29,8 +29,8 @@
#include "version.h" #include "version.h"
#include "bitmaps.h" #include "bitmaps.h"
#ifdef ENABLE_FEAT_F4HWN_SCREENSHOT #ifdef ENABLE_FEAT_F4HWN_K5VIEWER
#include "screenshot.h" #include "k5viewer.h"
#endif #endif
#ifdef ENABLE_FEAT_F4HWN_LOGO #ifdef ENABLE_FEAT_F4HWN_LOGO
@@ -355,7 +355,7 @@ void UI_DisplayWelcome(void)
ST7565_BlitStatusLine(); ST7565_BlitStatusLine();
ST7565_BlitFullScreen(); ST7565_BlitFullScreen();
#ifdef ENABLE_FEAT_F4HWN_SCREENSHOT #ifdef ENABLE_FEAT_F4HWN_K5VIEWER
SCREENSHOT_Update(true); K5VIEWER_Update(true);
#endif #endif
} }
+7 -7
View File
@@ -47,7 +47,7 @@
"ENABLE_EXTRA_UART_CMD": false, "ENABLE_EXTRA_UART_CMD": false,
"ENABLE_FEAT_F4HWN": true, "ENABLE_FEAT_F4HWN": true,
"ENABLE_FEAT_F4HWN_GAME": false, "ENABLE_FEAT_F4HWN_GAME": false,
"ENABLE_FEAT_F4HWN_SCREENSHOT": false, "ENABLE_FEAT_F4HWN_K5VIEWER": false,
"ENABLE_FEAT_F4HWN_SPECTRUM": true, "ENABLE_FEAT_F4HWN_SPECTRUM": true,
"ENABLE_FEAT_F4HWN_RX_TX_TIMER": true, "ENABLE_FEAT_F4HWN_RX_TX_TIMER": true,
"ENABLE_FEAT_F4HWN_CHARGING_C": false, "ENABLE_FEAT_F4HWN_CHARGING_C": false,
@@ -100,7 +100,7 @@
"ENABLE_FMRADIO": false, "ENABLE_FMRADIO": false,
"ENABLE_VOX": false, "ENABLE_VOX": false,
"ENABLE_AIRCOPY": true, "ENABLE_AIRCOPY": true,
"ENABLE_FEAT_F4HWN_SCREENSHOT": true, "ENABLE_FEAT_F4HWN_K5VIEWER": true,
"ENABLE_FEAT_F4HWN_GAME": false, "ENABLE_FEAT_F4HWN_GAME": false,
"ENABLE_FEAT_F4HWN_PMR": true, "ENABLE_FEAT_F4HWN_PMR": true,
"ENABLE_FEAT_F4HWN_GMRS_FRS_MURS": true, "ENABLE_FEAT_F4HWN_GMRS_FRS_MURS": true,
@@ -117,7 +117,7 @@
"ENABLE_FMRADIO": true, "ENABLE_FMRADIO": true,
"ENABLE_VOX": true, "ENABLE_VOX": true,
"ENABLE_AIRCOPY": true, "ENABLE_AIRCOPY": true,
"ENABLE_FEAT_F4HWN_SCREENSHOT": true, "ENABLE_FEAT_F4HWN_K5VIEWER": true,
"ENABLE_FEAT_F4HWN_GAME": false, "ENABLE_FEAT_F4HWN_GAME": false,
"ENABLE_FEAT_F4HWN_PMR": true, "ENABLE_FEAT_F4HWN_PMR": true,
"ENABLE_FEAT_F4HWN_GMRS_FRS_MURS": true, "ENABLE_FEAT_F4HWN_GMRS_FRS_MURS": true,
@@ -134,7 +134,7 @@
"ENABLE_FMRADIO": true, "ENABLE_FMRADIO": true,
"ENABLE_VOX": false, "ENABLE_VOX": false,
"ENABLE_AIRCOPY": false, "ENABLE_AIRCOPY": false,
"ENABLE_FEAT_F4HWN_SCREENSHOT": false, "ENABLE_FEAT_F4HWN_K5VIEWER": false,
"ENABLE_FEAT_F4HWN_GAME": false, "ENABLE_FEAT_F4HWN_GAME": false,
"ENABLE_FEAT_F4HWN_SPECTRUM": false, "ENABLE_FEAT_F4HWN_SPECTRUM": false,
"ENABLE_FEAT_F4HWN_PMR": true, "ENABLE_FEAT_F4HWN_PMR": true,
@@ -158,7 +158,7 @@
"ENABLE_FMRADIO": false, "ENABLE_FMRADIO": false,
"ENABLE_VOX": true, "ENABLE_VOX": true,
"ENABLE_AIRCOPY": true, "ENABLE_AIRCOPY": true,
"ENABLE_FEAT_F4HWN_SCREENSHOT": true, "ENABLE_FEAT_F4HWN_K5VIEWER": true,
"ENABLE_FEAT_F4HWN_GAME": false, "ENABLE_FEAT_F4HWN_GAME": false,
"ENABLE_FEAT_F4HWN_PMR": true, "ENABLE_FEAT_F4HWN_PMR": true,
"ENABLE_FEAT_F4HWN_GMRS_FRS_MURS": true, "ENABLE_FEAT_F4HWN_GMRS_FRS_MURS": true,
@@ -176,7 +176,7 @@
"ENABLE_FMRADIO": true, "ENABLE_FMRADIO": true,
"ENABLE_VOX": false, "ENABLE_VOX": false,
"ENABLE_AIRCOPY": true, "ENABLE_AIRCOPY": true,
"ENABLE_FEAT_F4HWN_SCREENSHOT": true, "ENABLE_FEAT_F4HWN_K5VIEWER": true,
"ENABLE_FEAT_F4HWN_GAME": true, "ENABLE_FEAT_F4HWN_GAME": true,
"ENABLE_FEAT_F4HWN_PMR": true, "ENABLE_FEAT_F4HWN_PMR": true,
"ENABLE_FEAT_F4HWN_GMRS_FRS_MURS": true, "ENABLE_FEAT_F4HWN_GMRS_FRS_MURS": true,
@@ -193,7 +193,7 @@
"ENABLE_FMRADIO": true, "ENABLE_FMRADIO": true,
"ENABLE_VOX": true, "ENABLE_VOX": true,
"ENABLE_AIRCOPY": true, "ENABLE_AIRCOPY": true,
"ENABLE_FEAT_F4HWN_SCREENSHOT": true, "ENABLE_FEAT_F4HWN_K5VIEWER": true,
"ENABLE_FEAT_F4HWN_GAME": true, "ENABLE_FEAT_F4HWN_GAME": true,
"ENABLE_FEAT_F4HWN_PMR": true, "ENABLE_FEAT_F4HWN_PMR": true,
"ENABLE_FEAT_F4HWN_GMRS_FRS_MURS": true, "ENABLE_FEAT_F4HWN_GMRS_FRS_MURS": true,