重构代码的架构设计,增加测试单元,提高代码可靠性
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* remoteDisplay.c - TCP 服务器线程实现
|
||||
* 实现 RemoDispBus 协议:解析 remo_disp_server.py 的请求,返回 lcd 显存数据等。
|
||||
* 帧格式: [TAG][cmd][len_hi][len_lo][data][crc],CRC = data 区逐字节异或低 8 位。
|
||||
@@ -8,7 +8,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "Drv/lcd.h"
|
||||
#include "Drv/lcd/lcd.h"
|
||||
#include "TCP/tcp.h"
|
||||
#include "Drv/key.h"
|
||||
#include "remoteDisplay.h"
|
||||
@@ -78,6 +78,7 @@ static int send_reply(int client, uint8_t cmd, const uint8_t* data, unsigned int
|
||||
/* 处理 CMD_LCDMEM:请求 data 为 4 字节大端起始地址;回复 [4B 地址][显存数据] */
|
||||
static void handle_cmd_lcdmem(int client, const uint8_t* req_data, unsigned int req_len)
|
||||
{
|
||||
const uint8_t *framebuffer = Lcd_GetFrameBuffer();
|
||||
unsigned int start_addr = 0;
|
||||
|
||||
if (req_len >= 4)
|
||||
@@ -96,7 +97,7 @@ static void handle_cmd_lcdmem(int client, const uint8_t* req_data, unsigned int
|
||||
{
|
||||
unsigned int offset = start_addr;
|
||||
copy_len = LCD_DISPLAYMEMORYSIZE - offset;
|
||||
memcpy(payload + 4, g_tCVsr.pwbyLCDMemory + offset, copy_len);
|
||||
memcpy(payload + 4, framebuffer + offset, copy_len);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user