This commit is contained in:
2026-02-25 11:54:10 +01:00
parent e7aa562c0b
commit 5c8a35440e
5 changed files with 10 additions and 15 deletions

View File

@@ -90,6 +90,13 @@ class BuzzerConnection:
with open(filepath, 'rb') as f: with open(filepath, 'rb') as f:
while bytes_sent < file_size: 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) chunk = f.read(chunk_size)
if not chunk: if not chunk:
break break
@@ -97,10 +104,8 @@ class BuzzerConnection:
self.serial.flush() self.serial.flush()
bytes_sent += len(chunk) bytes_sent += len(chunk)
# Callback aufrufen, falls vorhanden
if progress_callback: if progress_callback:
progress_callback(len(chunk)) progress_callback(len(chunk))
# 3. Warte auf das finale OK (oder ERR bei CRC/Schreib-Fehlern) # 3. Warte auf das finale OK (oder ERR bei CRC/Schreib-Fehlern)
start_time = time.time() start_time = time.time()
while (time.time() - start_time) < timeout: while (time.time() - start_time) < timeout:

View File

@@ -43,6 +43,4 @@ CONFIG_NRFX_I2S=y
# --- Random & HW Info (für Audio-File-Auswahl) --- # --- Random & HW Info (für Audio-File-Auswahl) ---
CONFIG_HWINFO=y CONFIG_HWINFO=y
CONFIG_ENTROPY_GENERATOR=y CONFIG_ENTROPY_GENERATOR=y
CONFIG_BOOT_BANNER=n
CONFIG_NCS_BOOT_BANNER=n
CONFIG_CRC=y CONFIG_CRC=y

View File

@@ -35,17 +35,7 @@ void print_device_id(void) {
static int print_custom_banner(void) static int print_custom_banner(void)
{ {
printk("*** Edis Buzzer Version: " APP_VERSION_STRING " ***" );
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");
return 0; return 0;
} }

View File

@@ -141,6 +141,7 @@ int put_binary_file(const char *filename, ssize_t filesize, uint32_t expected_cr
bytes_written += written; bytes_written += written;
retry_count = 0; retry_count = 0;
usb_resume_rx();
} }
uint32_t duration = k_uptime_get_32() - start; uint32_t duration = k_uptime_get_32() - start;
uint32_t kb_per_s = (filesize * 1000) / (duration * 1024 +1); uint32_t kb_per_s = (filesize * 1000) / (duration * 1024 +1);

View File

@@ -105,6 +105,7 @@ void usb_flush_rx(void)
// Semaphore zurücksetzen, falls sie gesetzt war // Semaphore zurücksetzen, falls sie gesetzt war
k_sem_reset(&usb_rx_sem); 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) static void usb_status_cb(enum usb_dc_status_code cb_status, const uint8_t *param)