This commit is contained in:
2026-02-27 11:59:07 +01:00
parent c8053925af
commit 4227417c5e
5 changed files with 71 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
# core/commands/mkdir.py
from core.connection import BuzzerError
def execute(conn, path: str):
"""Erstellt ein Verzeichnis auf dem Controller."""
try:
conn.send_command(f"mkdir {path}")
print(f"📁 Verzeichnis '{path}' erfolgreich erstellt.")
except BuzzerError as e:
print(f"❌ Fehler beim Erstellen von '{path}': {e}")

View File

@@ -0,0 +1,44 @@
# core/commands/rm.py
from core.connection import BuzzerError
from core.commands.ls import get_file_tree
def _delete_recursive(conn, nodes):
"""Löscht Knoten Bottom-Up (erst Dateien/Unterordner, dann den Ordner selbst)"""
for node in nodes:
if node["type"] == 'D':
if "children" in node and node["children"]:
_delete_recursive(conn, node["children"])
_try_rm(conn, node["path"], is_dir=True)
elif node["type"] == 'F':
_try_rm(conn, node["path"], is_dir=False)
def _try_rm(conn, path, is_dir=False):
icon = "📁" if is_dir else "📄"
try:
conn.send_command(f"rm {path}")
print(f" 🗑️ {icon} Gelöscht: {path}")
except BuzzerError as e:
print(f" ❌ Fehler bei {path}: {e}")
def execute(conn, path: str, recursive: bool = False):
"""Löscht eine Datei oder ein Verzeichnis."""
if recursive:
print(f"Sammle Dateibaum für rekursives Löschen von '{path}'...")
# Lade den kompletten Baum ab diesem Pfad
tree = get_file_tree(conn, target_path=path, recursive=True)
if len(tree) == 1 and tree[0].get("type") == "E":
print(f"❌ Pfad nicht gefunden oder Fehler: {tree[0]['name']}")
return
if not tree:
print(f"Ordner '{path}' ist bereits leer.")
else:
_delete_recursive(conn, tree)
# Am Ende das eigentliche Ziel löschen (die Datei oder den nun leeren Ordner)
try:
conn.send_command(f"rm {path}")
print(f"🗑️ '{path}' erfolgreich gelöscht.")
except BuzzerError as e:
print(f"❌ Fehler beim Löschen von '{path}': {e}")

View File

@@ -0,0 +1,14 @@
/* 1. Hardware-Controller abschalten - das reicht meistens aus */
&uart0 { status = "disabled"; };
/* 2. Spezialfall Bluetooth & IEEE 802.15.4 */
/* Wir löschen die chosen-Einträge, damit das System nicht versucht,
darauf zuzugreifen, falls die Stacks noch irgendwo aktiv sind */
/ {
chosen {
/delete-property/ zephyr,console;
/delete-property/ zephyr,shell-uart;
/delete-property/ zephyr,uart-mcumgr;
/delete-property/ zephyr,ieee802154;
};
};

1
firmware/sysbuild.conf Normal file
View File

@@ -0,0 +1 @@
SB_CONFIG_BOOTLOADER_MCUBOOT=y

View File

@@ -0,0 +1,2 @@
CONFIG_LOG=y
CONFIG_MCUBOOT_LOG_LEVEL_INF=y