diff --git a/buzzer_tool/core/connection.py b/buzzer_tool/core/connection.py index ddc9a8d..b41c4e3 100644 --- a/buzzer_tool/core/connection.py +++ b/buzzer_tool/core/connection.py @@ -90,6 +90,13 @@ class BuzzerConnection: with open(filepath, 'rb') as f: while bytes_sent < file_size: + + # NEU: Prüfe, ob der Controller VORZEITIG abgebrochen hat (z.B. ERR) + if self.serial.in_waiting > 0: + line = self.serial.readline().decode('utf-8', errors='ignore').strip() + if line.startswith("ERR"): + raise BuzzerError(f"Controller hat Transfer abgebrochen: {line}") + chunk = f.read(chunk_size) if not chunk: break @@ -97,10 +104,8 @@ class BuzzerConnection: self.serial.flush() bytes_sent += len(chunk) - # Callback aufrufen, falls vorhanden if progress_callback: progress_callback(len(chunk)) - # 3. Warte auf das finale OK (oder ERR bei CRC/Schreib-Fehlern) start_time = time.time() while (time.time() - start_time) < timeout: diff --git a/firmware/prj.conf b/firmware/prj.conf index 650cdc1..0720eba 100644 --- a/firmware/prj.conf +++ b/firmware/prj.conf @@ -43,6 +43,4 @@ CONFIG_NRFX_I2S=y # --- Random & HW Info (für Audio-File-Auswahl) --- CONFIG_HWINFO=y CONFIG_ENTROPY_GENERATOR=y -CONFIG_BOOT_BANNER=n -CONFIG_NCS_BOOT_BANNER=n CONFIG_CRC=y \ No newline at end of file diff --git a/firmware/src/main.c b/firmware/src/main.c index d5cdef7..2ec6248 100644 --- a/firmware/src/main.c +++ b/firmware/src/main.c @@ -35,17 +35,7 @@ void print_device_id(void) { static int print_custom_banner(void) { - - printk("\x1b[44m\x1b[2J\x1b[H"); - - // Oberer Rahmen - printk("\x1b[1;37m┌───────────────────────────────────────────┐\n"); - printk("│ Edis Buzzer Version: %-20s │\n", APP_VERSION_STRING); - printk("├───────────────────────────────────────────┤\n"); - printk("│ \x1b[22;37mZephyr Version: \x1b[1;37m%-20s │\n", KERNEL_VERSION_STRING); - printk("│ \x1b[22;37mNCS Version: \x1b[1;37m%-20s │\n", NCS_VERSION_STRING); - printk("└───────────────────────────────────────────┘\x1b[0m\n"); - + printk("*** Edis Buzzer Version: " APP_VERSION_STRING " ***" ); return 0; } diff --git a/firmware/src/protocol.c b/firmware/src/protocol.c index 1731522..058855d 100644 --- a/firmware/src/protocol.c +++ b/firmware/src/protocol.c @@ -141,6 +141,7 @@ int put_binary_file(const char *filename, ssize_t filesize, uint32_t expected_cr bytes_written += written; retry_count = 0; + usb_resume_rx(); } uint32_t duration = k_uptime_get_32() - start; uint32_t kb_per_s = (filesize * 1000) / (duration * 1024 +1); diff --git a/firmware/src/usb.c b/firmware/src/usb.c index 8044086..7380829 100644 --- a/firmware/src/usb.c +++ b/firmware/src/usb.c @@ -105,6 +105,7 @@ void usb_flush_rx(void) // Semaphore zurücksetzen, falls sie gesetzt war k_sem_reset(&usb_rx_sem); + usb_resume_rx(); } static void usb_status_cb(enum usb_dc_status_code cb_status, const uint8_t *param)