Selaa lähdekoodia

【修改】开机自启动文件 main.py 路径

SummerGift 6 vuotta sitten
vanhempi
sitoutus
ce3dff7072
2 muutettua tiedostoa jossa 2 lisäystä ja 1 poistoa
  1. 1 0
      port/mpconfigport.h
  2. 1 1
      port/mpy_main.c

+ 1 - 0
port/mpconfigport.h

@@ -330,6 +330,7 @@ typedef long mp_off_t;
 #define MICROPY_HW_MCU_NAME            "RT-Thread"
 #define MICROPY_HW_MCU_NAME            "RT-Thread"
 #define MICROPY_PY_PATH_FIRST          "/libs/mpy/"
 #define MICROPY_PY_PATH_FIRST          "/libs/mpy/"
 #define MICROPY_PY_PATH_SECOND         "/scripts/"
 #define MICROPY_PY_PATH_SECOND         "/scripts/"
+#define MICROPY_MAIN_PY_PATH           "/scripts/main.py"
 
 
 #define MICROPY_BEGIN_ATOMIC_SECTION()     rt_hw_interrupt_disable()
 #define MICROPY_BEGIN_ATOMIC_SECTION()     rt_hw_interrupt_disable()
 #define MICROPY_END_ATOMIC_SECTION(state)  rt_hw_interrupt_enable(state)
 #define MICROPY_END_ATOMIC_SECTION(state)  rt_hw_interrupt_enable(state)

+ 1 - 1
port/mpy_main.c

@@ -115,7 +115,7 @@ void mpy_main(const char *filename) {
 #ifdef MICROPYTHON_USING_UOS
 #ifdef MICROPYTHON_USING_UOS
         // run boot-up scripts
         // run boot-up scripts
         void *frozen_data;
         void *frozen_data;
-        const char *_boot_file = "_boot.py", *boot_file = "boot.py", *main_file = "main.py";
+        const char *_boot_file = "_boot.py", *boot_file = "boot.py", *main_file = MICROPY_MAIN_PY_PATH;
         if (mp_find_frozen_module(_boot_file, strlen(_boot_file), &frozen_data) != MP_FROZEN_NONE) {
         if (mp_find_frozen_module(_boot_file, strlen(_boot_file), &frozen_data) != MP_FROZEN_NONE) {
             pyexec_frozen_module(_boot_file);
             pyexec_frozen_module(_boot_file);
         }
         }