Просмотр исходного кода

Fix: continue logging when not in portal start scene (#8)

* continue logging when not in portal start scene

* removed comment

* added terminating character to prevent junk

* Revert "added terminating character to prevent junk"

This reverts commit d2410cd0fa5c236d2be97395d8e6e6f452601271.
bigbrodude6119 2 лет назад
Родитель
Сommit
a3d0ee1b3e
2 измененных файлов с 12 добавлено и 2 удалено
  1. 0 1
      evil_portal_app.c
  2. 12 1
      evil_portal_uart.c

+ 0 - 1
evil_portal_app.c

@@ -113,7 +113,6 @@ int32_t evil_portal_app(void *p) {
 
 
   view_dispatcher_run(evil_portal_app->view_dispatcher);  
   view_dispatcher_run(evil_portal_app->view_dispatcher);  
 
 
-  // crashing here
   evil_portal_app_free(evil_portal_app);
   evil_portal_app_free(evil_portal_app);
 
 
   return 0;
   return 0;

+ 12 - 1
evil_portal_uart.c

@@ -82,13 +82,24 @@ static int32_t uart_worker(void *context) {
             strcat(uart->app->portal_logs, (char *)uart->rx_buf);
             strcat(uart->app->portal_logs, (char *)uart->rx_buf);
           }
           }
 
 
+          if (strlen(uart->app->portal_logs) > 4000) {
+            write_logs(uart->app->portal_logs);
+            free(uart->app->portal_logs);
+            strcpy(uart->app->portal_logs, "");
+          }
+        } else {          
+          uart->rx_buf[len] = '\0';
+          if (uart->app->sent_reset == false) {
+            strcat(uart->app->portal_logs, (char *)uart->rx_buf);
+          }
+
           if (strlen(uart->app->portal_logs) > 4000) {
           if (strlen(uart->app->portal_logs) > 4000) {
             write_logs(uart->app->portal_logs);
             write_logs(uart->app->portal_logs);
             free(uart->app->portal_logs);
             free(uart->app->portal_logs);
             strcpy(uart->app->portal_logs, "");
             strcpy(uart->app->portal_logs, "");
           }
           }
         }
         }
-      }
+      } 
     }
     }
   }
   }