- Finished first workable version of housing. Fine tuning still needed

- Changed batch script to read out framebuffer -> better automatic file naming. Needs to be tested.
This commit is contained in:
2025-09-12 22:25:10 +02:00
parent bdf157168d
commit 30da52f4b0
2 changed files with 51 additions and 70 deletions

View File

@@ -26,6 +26,9 @@ if not exist "Buffer_Reader.py" (
exit /b 1
)
:: Initialize Repeat_Counter for file naming
set /a repeat_counter=1
:: Check command line arguments
if "%~1"=="" goto :interactive_mode
if "%~1"=="/?" goto :show_help
@@ -33,8 +36,8 @@ if "%~1"=="--help" goto :show_help
:: Direct mode - use command line arguments
set "port_input=%~1"
set "image_file=%~2"
set "csv_file=%~3"
set "image_file_base=%~2"
set "csv_file_base=%~3"
:: Process port input - add COM prefix if not present
if "!port_input:~0,3!"=="COM" (
@@ -67,20 +70,31 @@ if "!port_input:~0,3!"=="COM" (
)
:: Get image filename (optional)
set "image_file="
set /p "image_file=Enter image filename (press Enter for default): "
set "image_file_base="
set /p "image_file_base=Enter image filename (press Enter for default): "
:: Get CSV filename (optional)
set "csv_file="
set /p "csv_file=Enter CSV filename (press Enter for default): "
set "csv_file_base="
set /p "csv_file_base=Enter CSV filename (press Enter for default): "
:set_default_files
:: Get current timestamp for default filenames
for /f "tokens=2 delims==" %%a in ('wmic OS Get localdatetime /value') do set "dt=%%a"
set "timestamp=%dt:~0,4%%dt:~4,2%%dt:~6,2%_%dt:~8,2%%dt:~10,2%%dt:~12,2%"
if "!image_file_base!"=="" set "image_file_base=capture"
if "!csv_file_base!"=="" set "csv_file_base=pixels"
:: Check if image_file_base has an extension and remove it
for %%f in ("!image_file_base!") do (
set "image_file_base=%%~nf"
)
:: Check if image_file_base has an extension and remove it
for %%f in ("!csv_file_base!") do (
set "csv_file_base=%%~nf"
)
set "image_file=!image_file_base!_!repeat_counter!.png"
set "csv_file=!csv_file_base!_!repeat_counter!.csv"
if "!image_file!"=="" set "image_file=capture_1.png"
if "!csv_file!"=="" set "csv_file=pixels_1.csv"
:main_loop
echo.
@@ -131,42 +145,11 @@ set /p "repeat_choice="
:: Check if user pressed just Enter (empty input)
if "!repeat_choice!"=="" (
:: Increment counter for repeat runs
if not defined repeat_counter set repeat_counter=0
set /a repeat_counter+=1
:: Create new filenames with counter suffix
:: Remove existing counter suffix if present, then add new one
set "base_image=!image_file!"
set "base_csv=!csv_file!"
:: Remove previous counter from image filename
for /f "tokens=1,2 delims=_" %%a in ("!base_image!") do (
if "%%b" neq "" (
echo %%b | findstr "^[0-9][0-9]*\.png$" >nul
if !errorlevel! equ 0 (
set "base_image=%%a.png"
)
)
)
:: Remove previous counter from csv filename
for /f "tokens=1,2 delims=_" %%a in ("!base_csv!") do (
if "%%b" neq "" (
echo %%b | findstr "^[0-9][0-9]*\.csv$" >nul
if !errorlevel! equ 0 (
set "base_csv=%%a.csv"
)
)
)
:: Add counter to filenames
for %%f in ("!base_image!") do (
set "image_file=%%~nf_!repeat_counter!%%~xf"
)
for %%f in ("!base_csv!") do (
set "csv_file=%%~nf_!repeat_counter!%%~xf"
)
set "image_file=!image_file_base!_!repeat_counter!.png"
set "csv_file=!csv_file_base!_!repeat_counter!.csv"
goto :main_loop
)