From 9d797851b8bdc5ba5d848bcf5fe2f016865295c4 Mon Sep 17 00:00:00 2001 From: Thomas Farstrike Date: Fri, 25 Apr 2025 09:22:42 +0200 Subject: [PATCH] Move to new startup script names --- apps/com.example.cputest/META-INF/MANIFEST.MF | 1 + .../assets/{main.py => cputest.py} | 0 apps/com.example.imu/META-INF/MANIFEST.MF | 2 - apps/com.example.imutest/META-INF/MANIFEST.MF | 3 + .../assets/imutest.py} | 0 .../res/mipmap-mdpi/launcher_icon.png | 0 .../com.example.lvgltest/META-INF/MANIFEST.MF | 1 + .../assets/{main.py => lvgltest.py} | 0 apps/com.example.memtest/META-INF/MANIFEST.MF | 1 + .../assets/{main.py => memtest.py} | 0 .../META-INF/MANIFEST.MF | 2 - apps/com.example.threadtest/assets/main.py | 86 ------------------- .../res/mipmap-mdpi/launcher_icon.png | 1 - 13 files changed, 6 insertions(+), 91 deletions(-) rename apps/com.example.cputest/assets/{main.py => cputest.py} (100%) delete mode 100644 apps/com.example.imu/META-INF/MANIFEST.MF create mode 100644 apps/com.example.imutest/META-INF/MANIFEST.MF rename apps/{com.example.imu/assets/main.py => com.example.imutest/assets/imutest.py} (100%) rename apps/{com.example.imu => com.example.imutest}/res/mipmap-mdpi/launcher_icon.png (100%) rename apps/com.example.lvgltest/assets/{main.py => lvgltest.py} (100%) rename apps/com.example.memtest/assets/{main.py => memtest.py} (100%) delete mode 100644 apps/com.example.threadtest/META-INF/MANIFEST.MF delete mode 100644 apps/com.example.threadtest/assets/main.py delete mode 120000 apps/com.example.threadtest/res/mipmap-mdpi/launcher_icon.png diff --git a/apps/com.example.cputest/META-INF/MANIFEST.MF b/apps/com.example.cputest/META-INF/MANIFEST.MF index 821e4834..bf1e1f4e 100644 --- a/apps/com.example.cputest/META-INF/MANIFEST.MF +++ b/apps/com.example.cputest/META-INF/MANIFEST.MF @@ -1,2 +1,3 @@ Manifest-Version: 1.0 Name: CPUTest +Start-Script: assets/cputest.py diff --git a/apps/com.example.cputest/assets/main.py b/apps/com.example.cputest/assets/cputest.py similarity index 100% rename from apps/com.example.cputest/assets/main.py rename to apps/com.example.cputest/assets/cputest.py diff --git a/apps/com.example.imu/META-INF/MANIFEST.MF b/apps/com.example.imu/META-INF/MANIFEST.MF deleted file mode 100644 index 57ef1edc..00000000 --- a/apps/com.example.imu/META-INF/MANIFEST.MF +++ /dev/null @@ -1,2 +0,0 @@ -Manifest-Version: 1.0 -Name: IMU diff --git a/apps/com.example.imutest/META-INF/MANIFEST.MF b/apps/com.example.imutest/META-INF/MANIFEST.MF new file mode 100644 index 00000000..22b19cd3 --- /dev/null +++ b/apps/com.example.imutest/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Name: IMUTest +Start-Script: assets/imutest.py diff --git a/apps/com.example.imu/assets/main.py b/apps/com.example.imutest/assets/imutest.py similarity index 100% rename from apps/com.example.imu/assets/main.py rename to apps/com.example.imutest/assets/imutest.py diff --git a/apps/com.example.imu/res/mipmap-mdpi/launcher_icon.png b/apps/com.example.imutest/res/mipmap-mdpi/launcher_icon.png similarity index 100% rename from apps/com.example.imu/res/mipmap-mdpi/launcher_icon.png rename to apps/com.example.imutest/res/mipmap-mdpi/launcher_icon.png diff --git a/apps/com.example.lvgltest/META-INF/MANIFEST.MF b/apps/com.example.lvgltest/META-INF/MANIFEST.MF index 9492539b..414f3ed5 100644 --- a/apps/com.example.lvgltest/META-INF/MANIFEST.MF +++ b/apps/com.example.lvgltest/META-INF/MANIFEST.MF @@ -1,2 +1,3 @@ Manifest-Version: 1.0 Name: LVGLTest +Start-Script: assets/lvgltest.py diff --git a/apps/com.example.lvgltest/assets/main.py b/apps/com.example.lvgltest/assets/lvgltest.py similarity index 100% rename from apps/com.example.lvgltest/assets/main.py rename to apps/com.example.lvgltest/assets/lvgltest.py diff --git a/apps/com.example.memtest/META-INF/MANIFEST.MF b/apps/com.example.memtest/META-INF/MANIFEST.MF index 0c810526..cdb969be 100644 --- a/apps/com.example.memtest/META-INF/MANIFEST.MF +++ b/apps/com.example.memtest/META-INF/MANIFEST.MF @@ -1,2 +1,3 @@ Manifest-Version: 1.0 Name: MemTest +Start-Script: assets/memtest.py diff --git a/apps/com.example.memtest/assets/main.py b/apps/com.example.memtest/assets/memtest.py similarity index 100% rename from apps/com.example.memtest/assets/main.py rename to apps/com.example.memtest/assets/memtest.py diff --git a/apps/com.example.threadtest/META-INF/MANIFEST.MF b/apps/com.example.threadtest/META-INF/MANIFEST.MF deleted file mode 100644 index 565066dd..00000000 --- a/apps/com.example.threadtest/META-INF/MANIFEST.MF +++ /dev/null @@ -1,2 +0,0 @@ -Manifest-Version: 1.0 -Name: ThreadTest diff --git a/apps/com.example.threadtest/assets/main.py b/apps/com.example.threadtest/assets/main.py deleted file mode 100644 index 1c663261..00000000 --- a/apps/com.example.threadtest/assets/main.py +++ /dev/null @@ -1,86 +0,0 @@ -# Maximum threads with stack size 1024: 48 -# Maximum threads with stack size 2048: 48 -# Maximum threads with stack size 4096: 48 -# Maximum threads with stack size 8192: 22 -# Maximum threads with stack size 16386: 10 -# Maximum threads with stack size 32768: 3 -# Maximum threads with stack size 65536: 1 - -import _thread -import time - -# Global flag to signal thread termination -terminate_threads = False - -# Function to be run by each thread -def thread_func(thread_id): - global terminate_threads - while not terminate_threads: - time.sleep_ms(10) # Minimal work to keep thread alive - -# Test function for a given stack size -def test_threads(stack_size): - global terminate_threads - print(f"\nTesting with stack size: {stack_size} bytes") - - # Set stack size for new threads - try: - _thread.stack_size(stack_size) - except AttributeError as e: - print(f"Error setting stack size: {e}") - return 0 - - # Reset termination flag - terminate_threads = False - - threads = [] - thread_count = 0 - - try: - while True: - # Start a new thread - thread_id = _thread.start_new_thread(thread_func, (thread_count,)) - threads.append(thread_id) - thread_count += 1 - print(f"Started thread {thread_count}", end="\r") - time.sleep_ms(10) # Small delay to allow thread to start - except Exception as e: - print(f"\nException after {thread_count} threads: {e}") - - # Signal all threads to terminate - terminate_threads = True - - # Wait for threads to terminate - print("Terminating threads...", end="") - time.sleep_ms(500) # Give threads time to exit - print("Done") - - return thread_count - -# Main function to run tests with different stack sizes -def main(): - # List of stack sizes to test (in bytes) - stack_sizes = [1024, 2048, 4096, 8192, 16386, 32768, 65536] - - for stack_size in stack_sizes: - max_threads = test_threads(stack_size) - print(f"Maximum threads with stack size {stack_size}: {max_threads}") - # Allow some time for cleanup before next test - time.sleep_ms(1000) - - print("\nAll tests completed.") - - wifi_icon = lv.label(lv.screen_active()) - wifi_icon.set_text("Test label") - wifi_icon.align(lv.ALIGN.CENTER, 0, 0) - wifi_icon.set_style_text_color(lv.color_hex(0x0000FF), 0) - - print("done!") - -# Run the tests -if __name__ == "__main__": - try: - main() - except Exception as e: - print(f"Error in main: {e}") - diff --git a/apps/com.example.threadtest/res/mipmap-mdpi/launcher_icon.png b/apps/com.example.threadtest/res/mipmap-mdpi/launcher_icon.png deleted file mode 120000 index ce223be1..00000000 --- a/apps/com.example.threadtest/res/mipmap-mdpi/launcher_icon.png +++ /dev/null @@ -1 +0,0 @@ -../../../../icon_64x64.png \ No newline at end of file