mirror of
https://github.com/armel/uv-k1-k5v3-firmware-custom.git
synced 2026-10-02 03:15:37 +00:00
Rename screenshot module to k5viewer
This commit is contained in:
1 parent
e2d21c61c2
commit
46034ec39f
19 files changed
+133
-133
No files matched your search
+4
-4
@@ -180,8 +180,8 @@ enable_feature(ENABLE_FEAT_F4HWN)
|
||||
enable_feature(ENABLE_FEAT_F4HWN_GAME
|
||||
app/breakout.c
|
||||
)
|
||||
enable_feature(ENABLE_FEAT_F4HWN_SCREENSHOT
|
||||
screenshot.c
|
||||
enable_feature(ENABLE_FEAT_F4HWN_K5VIEWER
|
||||
k5viewer.c
|
||||
)
|
||||
enable_feature(ENABLE_FEAT_F4HWN_SPECTRUM)
|
||||
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_K5VIEWER)
|
||||
|
||||
if(ENABLE_FEAT_F4HWN_RXTX_LOG_K5VIEWER AND NOT (ENABLE_FEAT_F4HWN_RXTX_LOG AND ENABLE_FEAT_F4HWN_SCREENSHOT))
|
||||
message(FATAL_ERROR "ENABLE_FEAT_F4HWN_RXTX_LOG_K5VIEWER requires ENABLE_FEAT_F4HWN_RXTX_LOG (log data) and ENABLE_FEAT_F4HWN_SCREENSHOT (serial transport).")
|
||||
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_K5VIEWER (serial transport).")
|
||||
endif()
|
||||
|
||||
if(ENABLE_FEAT_F4HWN_BEAM AND NOT ENABLE_AIRCOPY)
|
||||
|
||||
+8
-8
@@ -30,8 +30,8 @@
|
||||
#include "settings.h"
|
||||
#include <stddef.h>
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN_SCREENSHOT
|
||||
#include "screenshot.h"
|
||||
#ifdef ENABLE_FEAT_F4HWN_K5VIEWER
|
||||
#include "k5viewer.h"
|
||||
#endif
|
||||
|
||||
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;
|
||||
}
|
||||
#ifdef ENABLE_FEAT_F4HWN_SCREENSHOT
|
||||
SCREENSHOT_Update(true);
|
||||
#ifdef ENABLE_FEAT_F4HWN_K5VIEWER
|
||||
K5VIEWER_Update(true);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -170,8 +170,8 @@ static inline void AIRCOPY_CheckComplete(uint16_t *num)
|
||||
if (done >= map->total_blocks)
|
||||
{
|
||||
gAircopyState = AIRCOPY_COMPLETE;
|
||||
#ifdef ENABLE_FEAT_F4HWN_SCREENSHOT
|
||||
SCREENSHOT_Update(false);
|
||||
#ifdef ENABLE_FEAT_F4HWN_K5VIEWER
|
||||
K5VIEWER_Update(false);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -222,8 +222,8 @@ bool AIRCOPY_SendMessage(void)
|
||||
// Check if transfer is complete
|
||||
if (CurrentSegmentIndex >= map->num_segments) {
|
||||
gAircopyState = AIRCOPY_COMPLETE;
|
||||
#ifdef ENABLE_FEAT_F4HWN_SCREENSHOT
|
||||
SCREENSHOT_Update(false);
|
||||
#ifdef ENABLE_FEAT_F4HWN_K5VIEWER
|
||||
K5VIEWER_Update(false);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
+10
-10
@@ -83,8 +83,8 @@
|
||||
#include "ui/ui.h"
|
||||
#include "ui/welcome.h"
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN_SCREENSHOT
|
||||
#include "screenshot.h"
|
||||
#ifdef ENABLE_FEAT_F4HWN_K5VIEWER
|
||||
#include "k5viewer.h"
|
||||
#endif
|
||||
|
||||
static bool flagSaveVfo;
|
||||
@@ -230,8 +230,8 @@ static void ScreenSaverRenderLogoPlus(bool reset)
|
||||
|
||||
static void ScreenSaverUpdateViewer(void)
|
||||
{
|
||||
#ifdef ENABLE_FEAT_F4HWN_SCREENSHOT
|
||||
SCREENSHOT_Update(false);
|
||||
#ifdef ENABLE_FEAT_F4HWN_K5VIEWER
|
||||
K5VIEWER_Update(false);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1121,10 +1121,10 @@ static void HandleVox(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,
|
||||
// regardless of whether the screen needs redrawing.
|
||||
SCREENSHOT_ParseInput();
|
||||
K5VIEWER_ParseInput();
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
@@ -1666,15 +1666,15 @@ void APP_TimeSlice10ms(void)
|
||||
UI_DisplayStatus();
|
||||
}
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN_SCREENSHOT
|
||||
#ifdef ENABLE_FEAT_F4HWN_K5VIEWER
|
||||
if (gUpdateDisplayCurrent || gUpdateStatusCurrent
|
||||
#ifdef ENABLE_FEAT_F4HWN_LOGO_SAV
|
||||
|| screenSaverRendered
|
||||
#endif
|
||||
) {
|
||||
SCREENSHOT_Update(false);
|
||||
} else if (SCREENSHOT_HasPendingStateChange()) {
|
||||
SCREENSHOT_Update(false);
|
||||
K5VIEWER_Update(false);
|
||||
} else if (K5VIEWER_HasPendingStateChange()) {
|
||||
K5VIEWER_Update(false);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
+6
-6
@@ -16,8 +16,8 @@
|
||||
|
||||
#include "app/breakout.h"
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN_SCREENSHOT
|
||||
#include "screenshot.h"
|
||||
#ifdef ENABLE_FEAT_F4HWN_K5VIEWER
|
||||
#include "k5viewer.h"
|
||||
#endif
|
||||
|
||||
static uint32_t randSeed = 1;
|
||||
@@ -304,10 +304,10 @@ static void OnKeyDown(uint8_t key)
|
||||
// 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,
|
||||
// regardless of whether the screen needs redrawing.
|
||||
SCREENSHOT_ParseInput();
|
||||
K5VIEWER_ParseInput();
|
||||
#endif
|
||||
|
||||
kbd.prev = kbd.current;
|
||||
@@ -388,10 +388,10 @@ void APP_RunBreakout(void) {
|
||||
ST7565_BlitStatusLine(); // Blank status line
|
||||
ST7565_BlitFullScreen();
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN_SCREENSHOT
|
||||
#ifdef ENABLE_FEAT_F4HWN_K5VIEWER
|
||||
if(isPaused || swap == 0)
|
||||
{
|
||||
SCREENSHOT_Update(false);
|
||||
K5VIEWER_Update(false);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
+7
-7
@@ -27,8 +27,8 @@
|
||||
#include "ui/helper.h"
|
||||
#include "ui/main.h"
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN_SCREENSHOT
|
||||
#include "screenshot.h"
|
||||
#ifdef ENABLE_FEAT_F4HWN_K5VIEWER
|
||||
#include "k5viewer.h"
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN_SPECTRUM
|
||||
@@ -2461,10 +2461,10 @@ static void UpdateListening()
|
||||
|
||||
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,
|
||||
// regardless of whether the screen needs redrawing.
|
||||
SCREENSHOT_ParseInput();
|
||||
K5VIEWER_ParseInput();
|
||||
#endif
|
||||
|
||||
if (gNextTimeslice)
|
||||
@@ -2532,9 +2532,9 @@ static void Tick()
|
||||
if (redrawScreen || ++renderTimer >= RENDER_PERIOD_TICKS)
|
||||
{
|
||||
Render();
|
||||
// For screenshot
|
||||
#ifdef ENABLE_FEAT_F4HWN_SCREENSHOT
|
||||
SCREENSHOT_Update(false);
|
||||
// For K5Viewer
|
||||
#ifdef ENABLE_FEAT_F4HWN_K5VIEWER
|
||||
K5VIEWER_Update(false);
|
||||
#endif
|
||||
redrawScreen = false;
|
||||
renderTimer = 0;
|
||||
|
||||
+2
-2
@@ -863,7 +863,7 @@ void UART_HandleCommand(uint32_t Port)
|
||||
#endif
|
||||
} // switch
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN_SCREENSHOT
|
||||
gUART_LockScreenshot = 20; // lock screenshot
|
||||
#ifdef ENABLE_FEAT_F4HWN_K5VIEWER
|
||||
gUART_LockK5Viewer = 20; // lock the K5Viewer stream
|
||||
#endif
|
||||
}
|
||||
@@ -27,7 +27,7 @@ KEY_Code_t gKeyReading1 = KEY_INVALID;
|
||||
uint16_t gDebounceCounter = 0;
|
||||
bool gWasFKeyPressed = false;
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN_SCREENSHOT
|
||||
#ifdef ENABLE_FEAT_F4HWN_K5VIEWER
|
||||
// Short press: hold key for SERIAL_KEY_SHORT_POLLS calls.
|
||||
// Must exceed key_debounce_10ms (2) to trigger ProcessKey(key, true, false).
|
||||
#define SERIAL_KEY_SHORT_POLLS 5
|
||||
@@ -184,7 +184,7 @@ static const KEY_Code_t keyboard[5][4] = {
|
||||
|
||||
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,
|
||||
// so the debounce counter in app.c reaches the right threshold:
|
||||
// - Short: key_debounce_10ms (2) → ProcessKey(key, true, false)
|
||||
|
||||
@@ -64,7 +64,7 @@ extern KEY_Code_t gKeyReading1;
|
||||
extern uint16_t gDebounceCounter;
|
||||
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).
|
||||
extern volatile KEY_Code_t gKeyFromSerial;
|
||||
|
||||
|
||||
+3
-3
@@ -24,7 +24,7 @@
|
||||
#include "driver/st7565.h"
|
||||
#include "driver/system.h"
|
||||
#include "misc.h"
|
||||
#include "screenshot.h"
|
||||
#include "k5viewer.h"
|
||||
|
||||
#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)
|
||||
{
|
||||
ST7565_BlitScreen(line + 1);
|
||||
#ifdef ENABLE_FEAT_F4HWN_SCREENSHOT
|
||||
SCREENSHOT_Update(true); // Force immediate capture
|
||||
#ifdef ENABLE_FEAT_F4HWN_K5VIEWER
|
||||
K5VIEWER_Update(true); // Force immediate capture
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -23,7 +23,7 @@
|
||||
#include "py32f071_ll_gpio.h"
|
||||
#include "py32f071_ll_usart.h"
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN_SCREENSHOT
|
||||
#ifdef ENABLE_FEAT_F4HWN_K5VIEWER
|
||||
#include "driver/keyboard.h"
|
||||
#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) {
|
||||
static uint8_t read_ptr = 0;
|
||||
static ParseState_t state = STATE_IDLE;
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ void UART_Init(void);
|
||||
void UART_Send(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);
|
||||
#endif
|
||||
|
||||
|
||||
+4
-4
@@ -18,7 +18,7 @@
|
||||
#include "usb_config.h"
|
||||
#include "py32f071_ll_bus.h"
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN_SCREENSHOT
|
||||
#ifdef ENABLE_FEAT_F4HWN_K5VIEWER
|
||||
#include "driver/keyboard.h"
|
||||
#endif
|
||||
|
||||
@@ -42,8 +42,8 @@ void VCP_Init()
|
||||
NVIC_EnableIRQ(USBD_IRQn);
|
||||
}
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN_SCREENSHOT
|
||||
bool VCP_ScreenshotPing(void)
|
||||
#ifdef ENABLE_FEAT_F4HWN_K5VIEWER
|
||||
bool VCP_K5ViewerPing(void)
|
||||
{
|
||||
// State machine for parsing incoming packets:
|
||||
// Keepalive: 0x55 0xAA 0x00 0x00 → viewer alive, no extensions
|
||||
@@ -93,4 +93,4 @@ bool VCP_ScreenshotPing(void)
|
||||
|
||||
return connected;
|
||||
}
|
||||
#endif // ENABLE_FEAT_F4HWN_SCREENSHOT
|
||||
#endif // ENABLE_FEAT_F4HWN_K5VIEWER
|
||||
+2
-2
@@ -29,8 +29,8 @@ extern volatile uint32_t VCP_RxBufPointer;
|
||||
|
||||
void VCP_Init();
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN_SCREENSHOT
|
||||
bool VCP_ScreenshotPing(void);
|
||||
#ifdef ENABLE_FEAT_F4HWN_K5VIEWER
|
||||
bool VCP_K5ViewerPing(void);
|
||||
#endif
|
||||
|
||||
static inline void VCP_Send(const uint8_t *Buf, uint32_t Size)
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
#include "debugging.h"
|
||||
#include "driver/st7565.h"
|
||||
#include "screenshot.h"
|
||||
#include "k5viewer.h"
|
||||
#include "misc.h"
|
||||
#include "driver/vcp.h"
|
||||
#include "driver/keyboard.h"
|
||||
@@ -50,7 +50,7 @@ static bool rfLogSent = false;
|
||||
#endif
|
||||
|
||||
// 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;
|
||||
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));
|
||||
}
|
||||
|
||||
void SCREENSHOT_ParseInput(void)
|
||||
void K5VIEWER_ParseInput(void)
|
||||
{
|
||||
if (SCREENSHOT_IsLocked())
|
||||
if (K5VIEWER_IsLocked())
|
||||
return;
|
||||
|
||||
if (UART_IsCableConnected()) {
|
||||
keepAlive = 15;
|
||||
hasConnectionPing = true;
|
||||
gUSB_ScreenshotEnabled = false;
|
||||
gUSB_K5ViewerEnabled = false;
|
||||
}
|
||||
else if (VCP_ScreenshotPing()) {
|
||||
else if (VCP_K5ViewerPing()) {
|
||||
keepAlive = 15;
|
||||
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);
|
||||
} else {
|
||||
UART_Send(buf, len);
|
||||
@@ -86,37 +86,37 @@ static void SCREENSHOT_Send(const uint8_t *buf, uint16_t len)
|
||||
}
|
||||
|
||||
enum {
|
||||
SCREENSHOT_CHUNK_SIZE = 8,
|
||||
SCREENSHOT_CHUNKS_PER_LINE = 16,
|
||||
SCREENSHOT_HALF_LINE_COLUMNS = LCD_WIDTH / 2,
|
||||
SCREENSHOT_MARKER_BASE = 0xF0,
|
||||
SCREENSHOT_TYPE_DIFF = 0x02,
|
||||
SCREENSHOT_TYPE_RXTX_LOG = 0x05,
|
||||
SCREENSHOT_FLAG_DEEP_SLEEP = 1 << 0,
|
||||
SCREENSHOT_FLAG_LED_RED = 1 << 1,
|
||||
SCREENSHOT_FLAG_LED_GREEN = 1 << 2,
|
||||
K5VIEWER_CHUNK_SIZE = 8,
|
||||
K5VIEWER_CHUNKS_PER_LINE = 16,
|
||||
K5VIEWER_HALF_LINE_COLUMNS = LCD_WIDTH / 2,
|
||||
K5VIEWER_MARKER_BASE = 0xF0,
|
||||
K5VIEWER_TYPE_DIFF = 0x02,
|
||||
K5VIEWER_TYPE_RXTX_LOG = 0x05,
|
||||
K5VIEWER_FLAG_DEEP_SLEEP = 1 << 0,
|
||||
K5VIEWER_FLAG_LED_RED = 1 << 1,
|
||||
K5VIEWER_FLAG_LED_GREEN = 1 << 2,
|
||||
};
|
||||
|
||||
static uint8_t SCREENSHOT_StateFlags(void)
|
||||
static uint8_t K5VIEWER_StateFlags(void)
|
||||
{
|
||||
uint8_t flags = 0;
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN_SLEEP
|
||||
if (gWakeUp)
|
||||
flags |= SCREENSHOT_FLAG_DEEP_SLEEP;
|
||||
flags |= K5VIEWER_FLAG_DEEP_SLEEP;
|
||||
#endif
|
||||
|
||||
if (BK4819_IsGpioOutSet(BK4819_GPIO5_PIN1_RED))
|
||||
flags |= SCREENSHOT_FLAG_LED_RED;
|
||||
flags |= K5VIEWER_FLAG_LED_RED;
|
||||
|
||||
if (BK4819_IsGpioOutSet(BK4819_GPIO6_PIN2_GREEN))
|
||||
flags |= SCREENSHOT_FLAG_LED_GREEN;
|
||||
flags |= K5VIEWER_FLAG_LED_GREEN;
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
#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)
|
||||
return false;
|
||||
@@ -124,7 +124,7 @@ static bool SCREENSHOT_HasPendingRfLogUpdate(void)
|
||||
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
|
||||
// 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;
|
||||
uint8_t header[5] = {
|
||||
0xAA, 0x55, SCREENSHOT_TYPE_RXTX_LOG,
|
||||
0xAA, 0x55, K5VIEWER_TYPE_RXTX_LOG,
|
||||
(uint8_t)(len >> 8),
|
||||
(uint8_t)(len & 0xFF)
|
||||
};
|
||||
|
||||
SCREENSHOT_Send(header, 5);
|
||||
RXTX_LOG_SendK5ViewerPacket(SCREENSHOT_Send);
|
||||
K5VIEWER_Send(header, 5);
|
||||
RXTX_LOG_SendK5ViewerPacket(K5VIEWER_Send);
|
||||
|
||||
uint8_t end = 0x0A;
|
||||
SCREENSHOT_Send(&end, 1);
|
||||
K5VIEWER_Send(&end, 1);
|
||||
}
|
||||
#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;
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN_RXTX_LOG_K5VIEWER
|
||||
if (SCREENSHOT_HasPendingRfLogUpdate())
|
||||
if (K5VIEWER_HasPendingRfLogUpdate())
|
||||
return true;
|
||||
#endif
|
||||
|
||||
return !wasConnected || SCREENSHOT_StateFlags() != previousStateFlags;
|
||||
return !wasConnected || K5VIEWER_StateFlags() != previousStateFlags;
|
||||
}
|
||||
|
||||
// Compute one 8-byte output chunk directly from the display buffers.
|
||||
// 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.
|
||||
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 line = chunkIdx / SCREENSHOT_CHUNKS_PER_LINE;
|
||||
const uint8_t chunkInLine = chunkIdx % K5VIEWER_CHUNKS_PER_LINE;
|
||||
const uint8_t line = chunkIdx / K5VIEWER_CHUNKS_PER_LINE;
|
||||
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])
|
||||
+ 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;
|
||||
for (uint8_t k = 0; k < SCREENSHOT_CHUNK_SIZE; k++) {
|
||||
if (src[j * SCREENSHOT_CHUNK_SIZE + k] & (1 << bit)) acc |= (1 << k);
|
||||
for (uint8_t k = 0; k < K5VIEWER_CHUNK_SIZE; k++) {
|
||||
if (src[j * K5VIEWER_CHUNK_SIZE + k] & (1 << bit)) acc |= (1 << k);
|
||||
}
|
||||
dest[j] = gSetting_set_inv ? ~acc : acc;
|
||||
}
|
||||
}
|
||||
|
||||
void SCREENSHOT_Update(bool force)
|
||||
void K5VIEWER_Update(bool force)
|
||||
{
|
||||
if (SCREENSHOT_IsLocked())
|
||||
if (K5VIEWER_IsLocked())
|
||||
return;
|
||||
|
||||
if (keepAlive > 0) {
|
||||
@@ -207,10 +207,10 @@ void SCREENSHOT_Update(bool force)
|
||||
force = true;
|
||||
}
|
||||
|
||||
const uint8_t stateFlags = SCREENSHOT_StateFlags();
|
||||
const uint8_t stateFlags = K5VIEWER_StateFlags();
|
||||
const bool stateChanged = (stateFlags != previousStateFlags);
|
||||
#ifdef ENABLE_FEAT_F4HWN_RXTX_LOG_K5VIEWER
|
||||
const bool rfLogPending = SCREENSHOT_HasPendingRfLogUpdate();
|
||||
const bool rfLogPending = K5VIEWER_HasPendingRfLogUpdate();
|
||||
#else
|
||||
const bool rfLogPending = false;
|
||||
#endif
|
||||
@@ -221,9 +221,9 @@ void SCREENSHOT_Update(bool force)
|
||||
uint8_t chunk[9]; // [0] = index, [1..8] = payload
|
||||
|
||||
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);
|
||||
|
||||
if (changed || isForced || force) {
|
||||
@@ -251,17 +251,17 @@ void SCREENSHOT_Update(bool force)
|
||||
{
|
||||
// ==== Send version marker and state flags ====
|
||||
// 0xF0 keeps a resync-safe marker before the standard AA 55 header.
|
||||
uint8_t versionMarker = SCREENSHOT_MARKER_BASE | stateFlags;
|
||||
SCREENSHOT_Send(&versionMarker, 1);
|
||||
uint8_t versionMarker = K5VIEWER_MARKER_BASE | stateFlags;
|
||||
K5VIEWER_Send(&versionMarker, 1);
|
||||
|
||||
// ==== Send header ====
|
||||
uint8_t header[5] = {
|
||||
0xAA, 0x55, SCREENSHOT_TYPE_DIFF,
|
||||
0xAA, 0x55, K5VIEWER_TYPE_DIFF,
|
||||
(uint8_t)(deltaLen >> 8),
|
||||
(uint8_t)(deltaLen & 0xFF)
|
||||
};
|
||||
|
||||
SCREENSHOT_Send(header, 5);
|
||||
K5VIEWER_Send(header, 5);
|
||||
|
||||
// ==== SECOND PASS: Send only changed chunks ====
|
||||
for (uint8_t chunkIdx = 0; chunkIdx < 128; chunkIdx++) {
|
||||
@@ -269,24 +269,24 @@ void SCREENSHOT_Update(bool force)
|
||||
continue;
|
||||
|
||||
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,
|
||||
// so chunks skipped by an early return stay marked as changed.
|
||||
// Hashing the recomputed payload also keeps the fingerprint in
|
||||
// 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;
|
||||
SCREENSHOT_Send(&end, 1);
|
||||
K5VIEWER_Send(&end, 1);
|
||||
}
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN_RXTX_LOG_K5VIEWER
|
||||
if (rfLogPending)
|
||||
SCREENSHOT_SendRfLog();
|
||||
K5VIEWER_SendRfLog();
|
||||
#endif
|
||||
|
||||
previousStateFlags = stateFlags;
|
||||
@@ -14,11 +14,11 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef SCREENSHOT_H
|
||||
#define SCREENSHOT_H
|
||||
#ifndef K5VIEWER_H
|
||||
#define K5VIEWER_H
|
||||
|
||||
void SCREENSHOT_Update(bool force);
|
||||
void SCREENSHOT_ParseInput(void);
|
||||
bool SCREENSHOT_HasPendingStateChange(void);
|
||||
void K5VIEWER_Update(bool force);
|
||||
void K5VIEWER_ParseInput(void);
|
||||
bool K5VIEWER_HasPendingStateChange(void);
|
||||
|
||||
#endif
|
||||
+7
-7
@@ -210,9 +210,9 @@ volatile bool gTxTimeoutReached;
|
||||
#ifdef ENABLE_FEAT_F4HWN_RX_TX_TIMER
|
||||
volatile uint16_t gRxTimerCountdown_500ms;
|
||||
#endif
|
||||
#ifdef ENABLE_FEAT_F4HWN_SCREENSHOT
|
||||
volatile uint8_t gUART_LockScreenshot = 0; // lock screenshot if Chirp is used
|
||||
bool gUSB_ScreenshotEnabled = false;
|
||||
#ifdef ENABLE_FEAT_F4HWN_K5VIEWER
|
||||
volatile uint8_t gUART_LockK5Viewer = 0; // lock the K5Viewer stream if Chirp is used
|
||||
bool gUSB_K5ViewerEnabled = false;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -646,11 +646,11 @@ void MR_PrintCacheStats(void)
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN_SCREENSHOT
|
||||
bool SCREENSHOT_IsLocked(void)
|
||||
#ifdef ENABLE_FEAT_F4HWN_K5VIEWER
|
||||
bool K5VIEWER_IsLocked(void)
|
||||
{
|
||||
if (gUART_LockScreenshot > 0) {
|
||||
gUART_LockScreenshot--;
|
||||
if (gUART_LockK5Viewer > 0) {
|
||||
gUART_LockK5Viewer--;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -336,11 +336,11 @@ extern volatile bool gTxTimeoutReached;
|
||||
#ifdef ENABLE_FEAT_F4HWN_RX_TX_TIMER
|
||||
extern volatile uint16_t gRxTimerCountdown_500ms;
|
||||
#endif
|
||||
#ifdef ENABLE_FEAT_F4HWN_SCREENSHOT
|
||||
extern volatile uint8_t gUART_LockScreenshot; // lock screenshot if Chirp is used
|
||||
extern bool gUSB_ScreenshotEnabled;
|
||||
#ifdef ENABLE_FEAT_F4HWN_K5VIEWER
|
||||
extern volatile uint8_t gUART_LockK5Viewer; // lock the K5Viewer stream if Chirp is used
|
||||
extern bool gUSB_K5ViewerEnabled;
|
||||
|
||||
bool SCREENSHOT_IsLocked(void);
|
||||
bool K5VIEWER_IsLocked(void);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
+4
-4
@@ -29,8 +29,8 @@
|
||||
#include "version.h"
|
||||
#include "bitmaps.h"
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN_SCREENSHOT
|
||||
#include "screenshot.h"
|
||||
#ifdef ENABLE_FEAT_F4HWN_K5VIEWER
|
||||
#include "k5viewer.h"
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN_LOGO
|
||||
@@ -355,7 +355,7 @@ void UI_DisplayWelcome(void)
|
||||
ST7565_BlitStatusLine();
|
||||
ST7565_BlitFullScreen();
|
||||
|
||||
#ifdef ENABLE_FEAT_F4HWN_SCREENSHOT
|
||||
SCREENSHOT_Update(true);
|
||||
#ifdef ENABLE_FEAT_F4HWN_K5VIEWER
|
||||
K5VIEWER_Update(true);
|
||||
#endif
|
||||
}
|
||||
+7
-7
@@ -47,7 +47,7 @@
|
||||
"ENABLE_EXTRA_UART_CMD": false,
|
||||
"ENABLE_FEAT_F4HWN": true,
|
||||
"ENABLE_FEAT_F4HWN_GAME": false,
|
||||
"ENABLE_FEAT_F4HWN_SCREENSHOT": false,
|
||||
"ENABLE_FEAT_F4HWN_K5VIEWER": false,
|
||||
"ENABLE_FEAT_F4HWN_SPECTRUM": true,
|
||||
"ENABLE_FEAT_F4HWN_RX_TX_TIMER": true,
|
||||
"ENABLE_FEAT_F4HWN_CHARGING_C": false,
|
||||
@@ -100,7 +100,7 @@
|
||||
"ENABLE_FMRADIO": false,
|
||||
"ENABLE_VOX": false,
|
||||
"ENABLE_AIRCOPY": true,
|
||||
"ENABLE_FEAT_F4HWN_SCREENSHOT": true,
|
||||
"ENABLE_FEAT_F4HWN_K5VIEWER": true,
|
||||
"ENABLE_FEAT_F4HWN_GAME": false,
|
||||
"ENABLE_FEAT_F4HWN_PMR": true,
|
||||
"ENABLE_FEAT_F4HWN_GMRS_FRS_MURS": true,
|
||||
@@ -117,7 +117,7 @@
|
||||
"ENABLE_FMRADIO": true,
|
||||
"ENABLE_VOX": true,
|
||||
"ENABLE_AIRCOPY": true,
|
||||
"ENABLE_FEAT_F4HWN_SCREENSHOT": true,
|
||||
"ENABLE_FEAT_F4HWN_K5VIEWER": true,
|
||||
"ENABLE_FEAT_F4HWN_GAME": false,
|
||||
"ENABLE_FEAT_F4HWN_PMR": true,
|
||||
"ENABLE_FEAT_F4HWN_GMRS_FRS_MURS": true,
|
||||
@@ -134,7 +134,7 @@
|
||||
"ENABLE_FMRADIO": true,
|
||||
"ENABLE_VOX": false,
|
||||
"ENABLE_AIRCOPY": false,
|
||||
"ENABLE_FEAT_F4HWN_SCREENSHOT": false,
|
||||
"ENABLE_FEAT_F4HWN_K5VIEWER": false,
|
||||
"ENABLE_FEAT_F4HWN_GAME": false,
|
||||
"ENABLE_FEAT_F4HWN_SPECTRUM": false,
|
||||
"ENABLE_FEAT_F4HWN_PMR": true,
|
||||
@@ -158,7 +158,7 @@
|
||||
"ENABLE_FMRADIO": false,
|
||||
"ENABLE_VOX": true,
|
||||
"ENABLE_AIRCOPY": true,
|
||||
"ENABLE_FEAT_F4HWN_SCREENSHOT": true,
|
||||
"ENABLE_FEAT_F4HWN_K5VIEWER": true,
|
||||
"ENABLE_FEAT_F4HWN_GAME": false,
|
||||
"ENABLE_FEAT_F4HWN_PMR": true,
|
||||
"ENABLE_FEAT_F4HWN_GMRS_FRS_MURS": true,
|
||||
@@ -176,7 +176,7 @@
|
||||
"ENABLE_FMRADIO": true,
|
||||
"ENABLE_VOX": false,
|
||||
"ENABLE_AIRCOPY": true,
|
||||
"ENABLE_FEAT_F4HWN_SCREENSHOT": true,
|
||||
"ENABLE_FEAT_F4HWN_K5VIEWER": true,
|
||||
"ENABLE_FEAT_F4HWN_GAME": true,
|
||||
"ENABLE_FEAT_F4HWN_PMR": true,
|
||||
"ENABLE_FEAT_F4HWN_GMRS_FRS_MURS": true,
|
||||
@@ -193,7 +193,7 @@
|
||||
"ENABLE_FMRADIO": true,
|
||||
"ENABLE_VOX": true,
|
||||
"ENABLE_AIRCOPY": true,
|
||||
"ENABLE_FEAT_F4HWN_SCREENSHOT": true,
|
||||
"ENABLE_FEAT_F4HWN_K5VIEWER": true,
|
||||
"ENABLE_FEAT_F4HWN_GAME": true,
|
||||
"ENABLE_FEAT_F4HWN_PMR": true,
|
||||
"ENABLE_FEAT_F4HWN_GMRS_FRS_MURS": true,
|
||||
|
||||
Reference in new issue
Block a user