Browse Source

Update setup() description

Scott Lahteine 3 years ago
parent
commit
de73b9b934
1 changed files with 89 additions and 27 deletions
  1. 89
    27
      Marlin/src/MarlinCore.cpp

+ 89
- 27
Marlin/src/MarlinCore.cpp View File

@@ -953,23 +953,92 @@ inline void tmc_standby_setup() {
953 953
 }
954 954
 
955 955
 /**
956
- * Marlin entry-point: Set up before the program loop
957
- *  - Set up the kill pin, filament runout, power hold, custom user buttons
958
- *  - Start the serial port
956
+ * Marlin Firmware entry-point. Abandon Hope All Ye Who Enter Here.
957
+ * Setup before the program loop:
958
+ *
959
+ *  - Call any special pre-init set for the board
960
+ *  - Put TMC drivers into Low Power Standby mode
961
+ *  - Init the serial ports (so setup can be debugged)
962
+ *  - Set up the kill and suicide pins
963
+ *  - Prepare (disable) board JTAG and Debug ports
964
+ *  - Init serial for a connected MKS TFT with WiFi
965
+ *  - Install Marlin custom Exception Handlers, if set.
966
+ *  - Init Marlin's HAL interfaces (for SPI, i2c, etc.)
967
+ *  - Init some optional hardware and features:
968
+ *    • MAX Thermocouple pins
969
+ *    • Duet Smart Effector
970
+ *    • Filament Runout Sensor
971
+ *    • TMC220x Stepper Drivers (Serial)
972
+ *    • PSU control
973
+ *    • Power-loss Recovery
974
+ *    • L64XX Stepper Drivers (SPI)
975
+ *    • Stepper Driver Reset: DISABLE
976
+ *    • TMC Stepper Drivers (SPI)
977
+ *    • Run BOARD_INIT if defined
978
+ *    • ESP WiFi
979
+ *  - Get the Reset Reason and report it
959 980
  *  - Print startup messages and diagnostics
960
- *  - Get EEPROM or default settings
961
- *  - Initialize managers for:
962
- *    • temperature
963
- *    • planner
964
- *    • watchdog
965
- *    • stepper
966
- *    • photo pin
967
- *    • servos
968
- *    • LCD controller
969
- *    • Digipot I2C
970
- *    • Z probe sled
971
- *    • status LEDs
972
- *    • Max7219
981
+ *  - Calibrate the HAL DELAY for precise timing
982
+ *  - Init the buzzer, possibly a custom timer
983
+ *  - Init more optional hardware:
984
+ *    • Color LED illumination
985
+ *    • Neopixel illumination
986
+ *    • Controller Fan
987
+ *    • Creality DWIN LCD (show boot image)
988
+ *    • Tare the Probe if possible
989
+ *  - Mount the (most likely external) SD Card
990
+ *  - Load settings from EEPROM (or use defaults)
991
+ *  - Init the Ethernet Port
992
+ *  - Init Touch Buttons (for emulated DOGLCD)
993
+ *  - Adjust the (certainly wrong) current position by the home offset
994
+ *  - Init the Planner::position (steps) based on current (native) position
995
+ *  - Initialize more managers and peripherals:
996
+ *    • Temperatures
997
+ *    • Print Job Timer
998
+ *    • Endstops and Endstop Interrupts
999
+ *    • Stepper ISR - Kind of Important!
1000
+ *    • Servos
1001
+ *    • Servo-based Probe
1002
+ *    • Photograph Pin
1003
+ *    • Laser/Spindle tool Power / PWM
1004
+ *    • Coolant Control
1005
+ *    • Bed Probe
1006
+ *    • Stepper Driver Reset: ENABLE
1007
+ *    • Digipot I2C - Stepper driver current control
1008
+ *    • Stepper DAC - Stepper driver current control
1009
+ *    • Solenoid (probe, or for other use)
1010
+ *    • Home Pin
1011
+ *    • Custom User Buttons
1012
+ *    • Red/Blue Status LEDs
1013
+ *    • Case Light
1014
+ *    • Prusa MMU filament changer
1015
+ *    • Fan Multiplexer
1016
+ *    • Mixing Extruder
1017
+ *    • BLTouch Probe
1018
+ *    • I2C Position Encoders
1019
+ *    • Custom I2C Bus handlers
1020
+ *    • Enhanced tools or extruders:
1021
+ *      • Switching Extruder
1022
+ *      • Switching Nozzle
1023
+ *      • Parking Extruder
1024
+ *      • Magnetic Parking Extruder
1025
+ *      • Switching Toolhead
1026
+ *      • Electromagnetic Switching Toolhead
1027
+ *    • Watchdog Timer - Also Kind of Important!
1028
+ *    • Closed Loop Controller
1029
+ *  - Run Startup Commands, if defined
1030
+ *  - Tell host to close Host Prompts
1031
+ *  - Test Trinamic driver connections
1032
+ *  - Init Prusa MMU2 filament changer
1033
+ *  - Init and test BL24Cxx EEPROM
1034
+ *  - Init Creality DWIN encoder, show faux progress bar
1035
+ *  - Reset Status Message / Show Service Messages
1036
+ *  - Init MAX7219 LED Matrix
1037
+ *  - Init Direct Stepping (Klipper-style motion control)
1038
+ *  - Init TFT LVGL UI (with 3D Graphics)
1039
+ *  - Apply Password Lock - Hold for Authentication
1040
+ *  - Open Touch Screen Calibration screen, if not calibrated
1041
+ *  - Set Marlin to RUNNING State
973 1042
  */
974 1043
 void setup() {
975 1044
   #ifdef BOARD_PREINIT
@@ -1311,7 +1380,6 @@ void setup() {
1311 1380
   #if PIN_EXISTS(STAT_LED_RED)
1312 1381
     OUT_WRITE(STAT_LED_RED_PIN, LOW); // OFF
1313 1382
   #endif
1314
-
1315 1383
   #if PIN_EXISTS(STAT_LED_BLUE)
1316 1384
     OUT_WRITE(STAT_LED_BLUE_PIN, LOW); // OFF
1317 1385
   #endif
@@ -1364,19 +1432,13 @@ void setup() {
1364 1432
     #endif
1365 1433
   #endif
1366 1434
 
1367
-  #if ENABLED(MAGNETIC_PARKING_EXTRUDER)
1368
-    SETUP_RUN(mpe_settings_init());
1369
-  #endif
1370
-
1371 1435
   #if ENABLED(PARKING_EXTRUDER)
1372 1436
     SETUP_RUN(pe_solenoid_init());
1373
-  #endif
1374
-
1375
-  #if ENABLED(SWITCHING_TOOLHEAD)
1437
+  #elif ENABLED(MAGNETIC_PARKING_EXTRUDER)
1438
+    SETUP_RUN(mpe_settings_init());
1439
+  #elif ENABLED(SWITCHING_TOOLHEAD)
1376 1440
     SETUP_RUN(swt_init());
1377
-  #endif
1378
-
1379
-  #if ENABLED(ELECTROMAGNETIC_SWITCHING_TOOLHEAD)
1441
+  #elif ENABLED(ELECTROMAGNETIC_SWITCHING_TOOLHEAD)
1380 1442
     SETUP_RUN(est_init());
1381 1443
   #endif
1382 1444
 

Loading…
Cancel
Save