From c34a56ed63ad55ab9c7985c59f8ee28ef74c914b Mon Sep 17 00:00:00 2001 From: chen <15335560115@163.com> Date: 星期三, 15 一月 2025 18:05:06 +0800 Subject: [PATCH] 修改算法 --- keil/ymodem.c | 12 ++++++++++-- 1 files changed, 10 insertions(+), 2 deletions(-) diff --git a/keil/ymodem.c b/keil/ymodem.c index 036847e..c6bebf3 100644 --- a/keil/ymodem.c +++ b/keil/ymodem.c @@ -253,14 +253,14 @@ * 1: abort by user */ uint16_t current_seqno,flash_seqno,i2; -uint8_t c; +uint8_t c,temp5,temp6,temp7,temp8; static int32_t Receive_Packet (uint8_t *data, int32_t *length, uint32_t timeout) { uint16_t packet_size, computedcrc; *length = 0; if (Receive_Byte(&c, timeout) != 0)//返回0成功收取数据,-1为没收到数据 - { + {temp5=1; return -1; } switch (c) @@ -282,11 +282,13 @@ else { return -1; + temp6=1; } case ABORT1: case ABORT2: return 1; default: + temp7=1; return -1; } *data = c;//放到1024+5字节的包里面 @@ -294,6 +296,7 @@ { if (Receive_Byte(data + i2, timeout) != 0)//不断的接收1024字节放入 { + temp8=1; return -1; } } @@ -339,6 +342,7 @@ uint8_t temp111[256]; uint8_t tempchangdu; extern uint8_t Get_anchor_appdata_num; +uint8_t temp1,temp2,temp3,temp4; int32_t Ymodem_Receive (uint8_t *buf) { @@ -403,6 +407,7 @@ /* End session */ Send_Byte(CA); Send_Byte(CA); + temp1=1; return -1; } /* erase user application area */ @@ -451,6 +456,7 @@ /* End session */ Send_Byte(CA); Send_Byte(CA); + temp2=1; return -2; } } @@ -462,6 +468,7 @@ case 1: Send_Byte(CA); Send_Byte(CA); + temp3=1; return -3; default://检验错误 if (session_begin > 0) @@ -472,6 +479,7 @@ { Send_Byte(CA); Send_Byte(CA); + temp4=1; return 0; } -- Gitblit v1.9.3