diff --git a/.gitignore b/.gitignore index 28cc5c2..ae89a56 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,5 @@ Extras/ScottoModules/STM32F072CBT6/fp-info-cache compile_commands.json Extras/ScottoScripts/OLED Video/frames Extras/ScottoScripts/OLED Video/frames.c +Extras/ScottoScripts/OLED Video/oled.c Extras/ScottoScripts/OLED Video/frames.txt diff --git a/Extras/ScottoScripts/OLED Video/extract_frames.py b/Extras/ScottoScripts/OLED Video/extract_frames.py index 8aee4c1..e162df8 100644 --- a/Extras/ScottoScripts/OLED Video/extract_frames.py +++ b/Extras/ScottoScripts/OLED Video/extract_frames.py @@ -1,6 +1,7 @@ #!/usr/bin/env python3 import argparse import os +import shutil import subprocess # Arguments @@ -37,11 +38,14 @@ parser.add_argument( args = parser.parse_args() -# Create output directory -os.makedirs("frames", exist_ok=True) +# Clear and recreate output directory +output_dir = "frames" +if os.path.exists(output_dir): + shutil.rmtree(output_dir) +os.makedirs(output_dir) # Create ffmpeg command -output_pattern = os.path.join("frames", "out_%03d.png") +output_pattern = os.path.join(output_dir, "out_%03d.png") # setpts expression: PTS = 1/speed * PTS setpts_expr = f"setpts={1/args.speed}*PTS" @@ -63,4 +67,4 @@ print("Running command:\n", " ".join(ffmpeg_cmd)) # Run command subprocess.run(ffmpeg_cmd, check=True) -print(f"Frames exported to ./frames") +print(f"Frames exported to ./{output_dir}") diff --git a/Extras/ScottoScripts/OLED Video/oled.c b/Extras/ScottoScripts/OLED Video/oled.c deleted file mode 100644 index a853f8c..0000000 --- a/Extras/ScottoScripts/OLED Video/oled.c +++ /dev/null @@ -1,37 +0,0 @@ -#include "frames.c" -#include "quantum.h" - -#ifdef OLED_ENABLE - -oled_rotation_t oled_init_user(oled_rotation_t rotation) { - return OLED_ROTATION_180; // flips the display 180 degrees if offhand -} - -#define NUM_FRAMES 120 -#define FRAME_WIDTH 128 -#define FRAME_HEIGHT 64 -#define FRAME_SIZE \ - (FRAME_WIDTH * FRAME_HEIGHT / 8) // 128*64 / 8 = 1024 bytes per frame -#define FRAME_DELAY 100 // ms per frame, ~10 fps - -bool oled_task_user(void) { - static uint16_t frame_index = 0; - static uint32_t last_update = 0; - - // Only update frame every FRAME_DELAY ms - if (timer_elapsed32(last_update) > FRAME_DELAY) { - last_update = timer_read32(); - - // Write current frame to OLED (cast to const char* to fix signedness) - oled_write_raw_P((const char *)frames[frame_index], FRAME_SIZE); - - // Advance to next frame, loop back to 0 - frame_index++; - if (frame_index >= NUM_FRAMES) - frame_index = 0; - } - - return false; // keep other OLED content disabled -} - -#endif