Browse Source

🧑‍💻 MARLIN_TEST_BUILD – for future use (#24077)

Scott Lahteine 1 year ago
parent
commit
59c2fe4561
No account linked to committer's email address

+ 3
- 0
Marlin/Configuration_adv.h View File

@@ -4295,6 +4295,9 @@
4295 4295
 //
4296 4296
 //#define PINS_DEBUGGING
4297 4297
 
4298
+// Enable Tests that will run at startup and produce a report
4299
+//#define MARLIN_TEST_BUILD
4300
+
4298 4301
 // Enable Marlin dev mode which adds some special commands
4299 4302
 //#define MARLIN_DEV_MODE
4300 4303
 

+ 11
- 7
Marlin/src/MarlinCore.cpp View File

@@ -39,17 +39,13 @@
39 39
 #endif
40 40
 #include <math.h>
41 41
 
42
-#include "core/utility.h"
43
-
42
+#include "module/endstops.h"
44 43
 #include "module/motion.h"
45 44
 #include "module/planner.h"
46
-#include "module/endstops.h"
47
-#include "module/temperature.h"
48
-#include "module/settings.h"
49 45
 #include "module/printcounter.h" // PrintCounter or Stopwatch
50
-
46
+#include "module/settings.h"
51 47
 #include "module/stepper.h"
52
-#include "module/stepper/indirection.h"
48
+#include "module/temperature.h"
53 49
 
54 50
 #include "gcode/gcode.h"
55 51
 #include "gcode/parser.h"
@@ -248,6 +244,10 @@
248 244
   #include "feature/easythreed_ui.h"
249 245
 #endif
250 246
 
247
+#if ENABLED(MARLIN_TEST_BUILD)
248
+  #include "tests/marlin_tests.h"
249
+#endif
250
+
251 251
 PGMSTR(M112_KILL_STR, "M112 Shutdown");
252 252
 
253 253
 MarlinState marlin_state = MF_INITIALIZING;
@@ -1635,6 +1635,8 @@ void setup() {
1635 1635
   marlin_state = MF_RUNNING;
1636 1636
 
1637 1637
   SETUP_LOG("setup() completed.");
1638
+
1639
+  TERN_(MARLIN_TEST_BUILD, runStartupTests());
1638 1640
 }
1639 1641
 
1640 1642
 /**
@@ -1669,5 +1671,7 @@ void loop() {
1669 1671
 
1670 1672
     TERN_(HAS_TFT_LVGL_UI, printer_state_polling());
1671 1673
 
1674
+    TERN_(MARLIN_TEST_BUILD, runPeriodicTests());
1675
+
1672 1676
   } while (ENABLED(__AVR__)); // Loop forever on slower (AVR) boards
1673 1677
 }

+ 47
- 0
Marlin/src/tests/marlin_tests.cpp View File

@@ -0,0 +1,47 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (c) 2022 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+
23
+#include "../inc/MarlinConfigPre.h"
24
+
25
+#if ENABLED(MARLIN_TEST_BUILD)
26
+
27
+#include "../module/endstops.h"
28
+#include "../module/motion.h"
29
+#include "../module/planner.h"
30
+#include "../module/settings.h"
31
+#include "../module/stepper.h"
32
+#include "../module/temperature.h"
33
+
34
+// Individual tests are localized in each module.
35
+// Each test produces its own report.
36
+
37
+// Startup tests are run at the end of setup()
38
+void runStartupTests() {
39
+  // Call post-setup tests here to validate behaviors.
40
+}
41
+
42
+// Periodic tests are run from within loop()
43
+void runPeriodicTests() {
44
+  // Call periodic tests here to validate behaviors.
45
+}
46
+
47
+#endif // MARLIN_TEST_BUILD

+ 25
- 0
Marlin/src/tests/marlin_tests.h View File

@@ -0,0 +1,25 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (c) 2022 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#pragma once
23
+
24
+void runStartupTests();
25
+void runPeriodicTests();

+ 1
- 0
ini/features.ini View File

@@ -14,6 +14,7 @@ YHCB2004                               = red-scorp/LiquidCrystal_AIP31068@^1.0.4
14 14
 HAS_TFT_LVGL_UI                        = lvgl=https://github.com/makerbase-mks/LVGL-6.1.1-MKS/archive/master.zip
15 15
                                          src_filter=+<src/lcd/extui/mks_ui>
16 16
                                          extra_scripts=download_mks_assets.py
17
+MARLIN_TEST_BUILD                      = src_filter=+<src/tests>
17 18
 POSTMORTEM_DEBUGGING                   = src_filter=+<src/HAL/shared/cpu_exception> +<src/HAL/shared/backtrace>
18 19
                                          build_flags=-funwind-tables
19 20
 MKS_WIFI_MODULE                        = QRCode=https://github.com/makerbase-mks/QRCode/archive/master.zip

+ 1
- 1
platformio.ini View File

@@ -51,7 +51,7 @@ extra_scripts      =
51 51
   pre:buildroot/share/PlatformIO/scripts/preflight-checks.py
52 52
   post:buildroot/share/PlatformIO/scripts/common-dependencies-post.py
53 53
 lib_deps           =
54
-default_src_filter = +<src/*> -<src/config> -<src/HAL> +<src/HAL/shared> -<Marlin/Marlin.ino>
54
+default_src_filter = +<src/*> -<src/config> -<src/HAL> +<src/HAL/shared> -<src/tests>
55 55
   -<src/lcd/HD44780> -<src/lcd/TFTGLCD> -<src/lcd/dogm> -<src/lcd/tft> -<src/lcd/tft_io>
56 56
   -<src/HAL/STM32/tft> -<src/HAL/STM32F1/tft>
57 57
   -<src/lcd/e3v2/common> -<src/lcd/e3v2/creality> -<src/lcd/e3v2/proui> -<src/lcd/e3v2/jyersui> -<src/lcd/e3v2/marlinui>

Loading…
Cancel
Save