Skip to content

Commit

Permalink
串口还原
Browse files Browse the repository at this point in the history
  • Loading branch information
losehu committed Jun 28, 2024
1 parent c0f3b7e commit 1af09b3
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 8 deletions.
52 changes: 47 additions & 5 deletions app/uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ static void CMD_051B(const uint8_t *pBuffer) {
const CMD_051B_t *pCmd = (const CMD_051B_t *) pBuffer;
REPLY_051B_t Reply;
#ifdef ENABLE_BLOCK

bool bLocked = false;
#endif
if (pCmd->Timestamp != Timestamp)
Expand Down Expand Up @@ -580,7 +581,35 @@ bool UART_IsCommandAvailable(void) {
return judge;
}


#if ENABLE_CHINESE_FULL == 4
//
//static void CMD_052B(const uint8_t *pBuffer)//read
//{
// const CMD_052B_t *pCmd = (const CMD_052B_t *) pBuffer;
// REPLY_051B_t Reply;
//
//
// if (pCmd->Timestamp != Timestamp)
// return;
//
// gSerialConfigCountDown_500ms = 12; // 6 sec
//
//#ifdef ENABLE_FMRADIO
// gFmRadioCountdown_500ms = fm_radio_countdown_500ms;
//#endif
//
//// memset(&Reply, 0, sizeof(Reply));
// Reply.Header.ID = 0x051C;
// Reply.Header.Size = pCmd->Size + 4;
// Reply.Data.Offset = pCmd->Offset;
//
// Reply.Data.Size = pCmd->Size;
//
//
// EEPROM_ReadBuffer(((pCmd->Offset) << 16) + ((pCmd->ADD[1]) << 8) + (pCmd->ADD[0]), Reply.Data.Data, pCmd->Size);
//
// SendReply(&Reply, pCmd->Size + 8);
//}

static void CMD_0538(const uint8_t *pBuffer)//write
{
Expand All @@ -601,7 +630,14 @@ static void CMD_0538(const uint8_t *pBuffer)//write

for ( int i = 0; i < ((pCmd->Size) - 2) / 8+(add==0?0:1); i++) {
const uint32_t Offset = ((pCmd->Offset) << 16) + ((pCmd->Data[1]) << 8) + (pCmd->Data[0]) + (i * 8U);

//#ifdef ENABLE_DOPPLER
// if(Offset>=0x90000)
// {
// memcpy(time,pCmd->Data[i * 8U + 2],6);
// RTC_Set(time);
// continue;
// }
//#endif
if(add&&i==((pCmd->Size) - 2) / 8+(add==0?0:1)-1)
EEPROM_WriteBuffer(Offset, &pCmd->Data[i * 8U + 2], add);
else
Expand All @@ -611,6 +647,7 @@ static void CMD_0538(const uint8_t *pBuffer)//write

SendReply(&Reply, sizeof(Reply));
}
#endif

#ifdef ENABLE_DOCK
static void CMD_0801(const uint8_t *pBuffer)
Expand All @@ -629,15 +666,14 @@ static void CMD_0801(const uint8_t *pBuffer)

void UART_HandleCommand(void) {
switch (UART_Command.Header.ID) {
case 0x051B:
#if ENABLE_CHINESE_FULL == 4
case 0x052B://read
CMD_051B(UART_Command.Buffer);
break;
case 0x051D:
case 0x0538://write
CMD_0538(UART_Command.Buffer);
break;

#endif
#ifdef ENABLE_DOCK
case 0x0801:
CMD_0801(UART_Command.Buffer);
Expand All @@ -648,7 +684,13 @@ void UART_HandleCommand(void) {
CMD_0514(UART_Command.Buffer);
break;

case 0x051B:
CMD_051B(UART_Command.Buffer);
break;

case 0x051D:
CMD_051D(UART_Command.Buffer);
break;


case 0x0527:
Expand Down
1 change: 0 additions & 1 deletion driver/eeprom.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ void EEPROM_ReadBuffer(uint32_t Address, void *pBuffer, uint8_t Size);

void EEPROM_WriteBuffer(uint32_t Address, const void *pBuffer, uint8_t WRITE_SIZE);

void EEPROM_Buffer_MORE(uint32_t Address, void *pBuffer, uint16_t WRITE_SIZE,uint8_t TYPE) ;



Expand Down
4 changes: 2 additions & 2 deletions ui/welcome.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ void UI_DisplayWelcome(void) {

memset(gStatusLine, 0, sizeof(gStatusLine));
UI_DisplayClear();
// ST7565_BlitStatusLine(); // blank status line
// ST7565_BlitFullScreen();
ST7565_BlitStatusLine(); // blank status line
ST7565_BlitFullScreen();
#if ENABLE_CHINESE_FULL == 4

if (gEeprom.POWER_ON_DISPLAY_MODE == POWER_ON_DISPLAY_MODE_MESSAGE) {
Expand Down

0 comments on commit 1af09b3

Please sign in to comment.