Merge pull request #906 from openmv/selftest

Make self-test configurable.
This commit is contained in:
Ibrahim Abd Elkader 2020-09-22 23:13:31 +02:00 committed by GitHub
commit 62bff5f9f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 23 additions and 3 deletions

View File

@ -52,6 +52,9 @@
#define OMV_ENABLE_LEPTON (0)
#define OMV_ENABLE_HM01B0 (0)
// Enable self-tests on first boot
#define OMV_ENABLE_SELFTEST (1)
// If buffer size is bigger than this threshold, the quality is reduced.
// This is only used for JPEG images sent to the IDE not normal compression.
#define JPEG_QUALITY_THRESH (160*120*2)

View File

@ -52,6 +52,9 @@
#define OMV_ENABLE_LEPTON (0)
#define OMV_ENABLE_HM01B0 (0)
// Enable self-tests on first boot
#define OMV_ENABLE_SELFTEST (1)
// If buffer size is bigger than this threshold, the quality is reduced.
// This is only used for JPEG images sent to the IDE not normal compression.
#define JPEG_QUALITY_THRESH (160*120*2)

View File

@ -58,6 +58,9 @@
// Enable WiFi debug
#define OMV_ENABLE_WIFIDBG (1)
// Enable self-tests on first boot
#define OMV_ENABLE_SELFTEST (1)
// If buffer size is bigger than this threshold, the quality is reduced.
// This is only used for JPEG images sent to the IDE not normal compression.
#define JPEG_QUALITY_THRESH (320*240*2)

View File

@ -62,6 +62,9 @@
// Enable WiFi debug
#define OMV_ENABLE_WIFIDBG (1)
// Enable self-tests on first boot
#define OMV_ENABLE_SELFTEST (1)
// If buffer size is bigger than this threshold, the quality is reduced.
// This is only used for JPEG images sent to the IDE not normal compression.
#define JPEG_QUALITY_THRESH (1920*1080*2)

View File

@ -62,6 +62,9 @@
// Enable WiFi debug
#define OMV_ENABLE_WIFIDBG (1)
// Enable self-tests on first boot
#define OMV_ENABLE_SELFTEST (0)
// If buffer size is bigger than this threshold, the quality is reduced.
// This is only used for JPEG images sent to the IDE not normal compression.
#define JPEG_QUALITY_THRESH (1920*1080*2)

View File

@ -59,6 +59,9 @@
// Enable WiFi debug
#define OMV_ENABLE_WIFIDBG (0)
// Enable self-tests on first boot
#define OMV_ENABLE_SELFTEST (0)
// If buffer size is bigger than this threshold, the quality is reduced.
// This is only used for JPEG images sent to the IDE not normal compression.
#define JPEG_QUALITY_THRESH (320*240*2)

View File

@ -113,9 +113,7 @@ static const char fresh_readme_txt[] =
"https://github.com/openmv/openmv\r\n"
;
#ifdef OPENMV1
static const char fresh_selftest_py[] ="";
#else
#if (OMV_ENABLE_SELFTEST == 1)
static const char fresh_selftest_py[] =
"import sensor, time, pyb\n"
"\n"
@ -275,10 +273,12 @@ void make_flash_fs()
f_write(&fp, fresh_readme_txt, sizeof(fresh_readme_txt) - 1 /* don't count null terminator */, &n);
f_close(&fp);
#if (OMV_ENABLE_SELFTEST == 1)
// Create default selftest.py
f_open(&vfs_fat->fatfs, &fp, "/selftest.py", FA_WRITE | FA_CREATE_ALWAYS);
f_write(&fp, fresh_selftest_py, sizeof(fresh_selftest_py) - 1 /* don't count null terminator */, &n);
f_close(&fp);
#endif
led_state(LED_RED, 0);
}
@ -596,9 +596,11 @@ soft_reset:
// Execute the boot.py script before initializing the USB dev to
// override the USB mode if required, otherwise VCP+MSC is used.
exec_boot_script("/boot.py", false, false);
#if (OMV_ENABLE_SELFTEST == 1)
// Execute the selftests.py script before the filesystem is mounted
// to avoid corrupting the filesystem when selftests.py is removed.
exec_boot_script("/selftest.py", true, false);
#endif
}
// Init USB device to default setting if it was not already configured