Browse Source

little change

JY 5 months ago
parent
commit
2e51ee728d
2 changed files with 14 additions and 4 deletions
  1. 5 3
      IAP_YMODEM_ATY.c
  2. 9 1
      IAP_YMODEM_ATY.h

+ 5 - 3
IAP_YMODEM_ATY.c

@@ -82,8 +82,10 @@ void JumpToAppWithReset(void)
 void Interface_Clean(void)
 {
 #ifndef IAP_YMODEM_ATY_USB
+#warning "NOT IAP_YMODEM_ATY_USB"
     __HAL_UART_FLUSH_DRREGISTER(&Interface_UART);
 #else
+#warning "IAP_YMODEM_ATY_USB"
     ucdcRcvLength = 0;
     ucdcRcvOverFlag = 1;
 
@@ -222,8 +224,7 @@ void Main_Menu(void)
         Interface_Clean();
 
         /* Receive key */
-        uint16_t autoBootTime = 5000;
-        Interface_Receive(&key, 1, autoBootTime);
+        Interface_Receive(&key, 1, IAP_3_TIME);
         /* Auto jump to app */
         if(key == 0)
             key = 51;
@@ -298,7 +299,7 @@ void Main_Cycle(void)
     {
         if(1)
         {
-            if(Interface_Receive(sKey, 2, RX_TIMEOUT) == HAL_OK)
+            if(Interface_Receive(sKey, 2, IAP_S_TIME) == HAL_OK)
             {
                 if(sKey[0] == 'S')
                 {
@@ -327,6 +328,7 @@ void Main_Cycle(void)
             }
             else{
                 Interface_Clean();
+                Main_Menu();
             }
         }
         /* Keep the user application running */

+ 9 - 1
IAP_YMODEM_ATY.h

@@ -33,7 +33,7 @@
 
 #include "INCLUDE_ATY.h"
 #include "HW_RESET_ATY.h"
-#include "main.h"
+// #include "main.h"
 
 /******************************* For user *************************************/
 // do not forget change USER_VECT_TAB_ADDRESS VECT_TAB_OFFSET at system_stm32f1xx.c
@@ -45,6 +45,14 @@
 // #define IAP_YMODEM_ATY_USB
 // #endif
 
+#ifndef IAP_S_TIME
+#define IAP_S_TIME RX_TIMEOUT
+// #define IAP_S_TIME 1000
+#endif
+#ifndef IAP_3_TIME
+#define IAP_3_TIME 5000
+#endif
+
 extern UART_HandleTypeDef huart3;
 #define Interface_UART huart3