feat: raw bin files now recieve timestamped filenames.
This commit is contained in:
@@ -13,6 +13,7 @@ Requires only the stdlib (Tkinter is bundled on Windows/Python).
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import datetime
|
||||||
import os
|
import os
|
||||||
import queue
|
import queue
|
||||||
import subprocess
|
import subprocess
|
||||||
@@ -125,11 +126,22 @@ class BridgeGUI(tk.Tk):
|
|||||||
|
|
||||||
args = [sys.executable, BRIDGE_PATH, "--bw", bw, "--s3", s3, "--baud", baud, "--logdir", logdir]
|
args = [sys.executable, BRIDGE_PATH, "--bw", bw, "--s3", s3, "--baud", baud, "--logdir", logdir]
|
||||||
|
|
||||||
|
ts = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
|
||||||
|
|
||||||
raw_bw = self.raw_bw_var.get().strip()
|
raw_bw = self.raw_bw_var.get().strip()
|
||||||
raw_s3 = self.raw_s3_var.get().strip()
|
raw_s3 = self.raw_s3_var.get().strip()
|
||||||
|
|
||||||
|
# If the user left the default generic name, replace with a timestamped one
|
||||||
|
# so each session gets its own file.
|
||||||
if raw_bw:
|
if raw_bw:
|
||||||
|
if os.path.basename(raw_bw) in ("raw_bw.bin", "raw_bw"):
|
||||||
|
raw_bw = os.path.join(os.path.dirname(raw_bw) or logdir, f"raw_bw_{ts}.bin")
|
||||||
|
self.raw_bw_var.set(raw_bw)
|
||||||
args += ["--raw-bw", raw_bw]
|
args += ["--raw-bw", raw_bw]
|
||||||
if raw_s3:
|
if raw_s3:
|
||||||
|
if os.path.basename(raw_s3) in ("raw_s3.bin", "raw_s3"):
|
||||||
|
raw_s3 = os.path.join(os.path.dirname(raw_s3) or logdir, f"raw_s3_{ts}.bin")
|
||||||
|
self.raw_s3_var.set(raw_s3)
|
||||||
args += ["--raw-s3", raw_s3]
|
args += ["--raw-s3", raw_s3]
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -345,14 +345,25 @@ def main() -> int:
|
|||||||
ts = _dt.datetime.now().strftime("%Y%m%d_%H%M%S")
|
ts = _dt.datetime.now().strftime("%Y%m%d_%H%M%S")
|
||||||
log_path = os.path.join(args.logdir, f"s3_session_{ts}.log")
|
log_path = os.path.join(args.logdir, f"s3_session_{ts}.log")
|
||||||
bin_path = os.path.join(args.logdir, f"s3_session_{ts}.bin")
|
bin_path = os.path.join(args.logdir, f"s3_session_{ts}.bin")
|
||||||
logger = SessionLogger(log_path, bin_path, raw_bw_path=args.raw_bw, raw_s3_path=args.raw_s3)
|
|
||||||
|
# If raw tap flags were passed without a path (bare --raw-bw / --raw-s3),
|
||||||
|
# or if the sentinel value "auto" is used, generate a timestamped name.
|
||||||
|
# If a specific path was provided, use it as-is (caller's responsibility).
|
||||||
|
raw_bw_path = args.raw_bw
|
||||||
|
raw_s3_path = args.raw_s3
|
||||||
|
if raw_bw_path in (None, "", "auto"):
|
||||||
|
raw_bw_path = os.path.join(args.logdir, f"raw_bw_{ts}.bin") if args.raw_bw is not None else None
|
||||||
|
if raw_s3_path in (None, "", "auto"):
|
||||||
|
raw_s3_path = os.path.join(args.logdir, f"raw_s3_{ts}.bin") if args.raw_s3 is not None else None
|
||||||
|
|
||||||
|
logger = SessionLogger(log_path, bin_path, raw_bw_path=raw_bw_path, raw_s3_path=raw_s3_path)
|
||||||
|
|
||||||
print(f"[LOG] Writing hex log to {log_path}")
|
print(f"[LOG] Writing hex log to {log_path}")
|
||||||
print(f"[LOG] Writing binary log to {bin_path}")
|
print(f"[LOG] Writing binary log to {bin_path}")
|
||||||
if args.raw_bw:
|
if raw_bw_path:
|
||||||
print(f"[LOG] Raw tap BW->S3 -> {args.raw_bw}")
|
print(f"[LOG] Raw tap BW->S3 -> {raw_bw_path}")
|
||||||
if args.raw_s3:
|
if raw_s3_path:
|
||||||
print(f"[LOG] Raw tap S3->BW -> {args.raw_s3}")
|
print(f"[LOG] Raw tap S3->BW -> {raw_s3_path}")
|
||||||
|
|
||||||
logger.log_info(f"s3_bridge {VERSION} start")
|
logger.log_info(f"s3_bridge {VERSION} start")
|
||||||
logger.log_info(f"BW={args.bw} S3={args.s3} baud={args.baud}")
|
logger.log_info(f"BW={args.bw} S3={args.s3} baud={args.baud}")
|
||||||
|
|||||||
Reference in New Issue
Block a user