Compare commits

...

103 Commits

Author SHA1 Message Date
InsanityAutomation f3ed2473ea Update runout.h 2024-07-13 12:36:49 -04:00
InsanityAutomation 2a570b8983 Update runout.h 2024-07-13 12:36:48 -04:00
InsanityAutomation e8d124886e Pass 1 builds - Switch and Motion support dropped temporarily 2024-07-13 12:36:48 -04:00
InsanityAutomation 180832ef0c First Pass M591 Import 2024-07-13 12:36:48 -04:00
thinkyhead c961f3ab2b [cron] Bump distribution date (2024-07-12) 2024-07-12 00:23:21 +00:00
Scott Lahteine 3469cb9d24 🔧 Fallback STRING_CONFIG_H_AUTHOR 2024-07-11 16:27:52 -05:00
thinkyhead 6c09b83f30 [cron] Bump distribution date (2024-07-11) 2024-07-11 00:23:57 +00:00
ellensp 17a1363f4d 🐛 Fix ERR_EEPROM_NOPROM result (#27255)
Followup to #27199
2024-07-09 21:15:34 -05:00
thinkyhead 115350317c [cron] Bump distribution date (2024-07-10) 2024-07-10 00:23:49 +00:00
Justin Nesselrotte 44c2682168 RS485 support with G-code M485 (#25680)
Co-authored-by: Stephen Hawes <sphawes@gmail.com>
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
2024-07-09 17:00:14 -05:00
ellensp 8b81aae870 Update preflight-checks.py for windows 2024-07-09 18:55:36 +12:00
thinkyhead 72a2699b10 [cron] Bump distribution date (2024-07-09) 2024-07-09 00:23:05 +00:00
Keith Bennett b7c07f1329 🚸 Fix G33 display precision (3 digits) (#27186) 2024-07-08 19:13:21 -05:00
Vovodroid 2b9a62093a 🚸 Edit IS frequency while moving (#27248) 2024-07-08 19:03:20 -05:00
ellensp 3385b4c280 🔨 Auto-replace BOTH / EITHER in configs (#27249)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
2024-07-08 18:46:03 -05:00
thinkyhead 7c1f82cd96 [cron] Bump distribution date (2024-07-08) 2024-07-08 18:06:51 +00:00
Roxy-3D 9ebfdc4a86 Update README.md with hotlink to all supported boards 2024-07-08 10:35:41 -05:00
thinkyhead 586313c2fb [cron] Bump distribution date (2024-07-07) 2024-07-07 00:25:40 +00:00
David Buezas 571783fc04 🚸 SD card wake on insert, status screen on remove (#27197)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
2024-07-06 17:41:02 -05:00
Scott Lahteine 4af5229cee 🧑‍💻 Conditional HAS_LED_POWEROFF_TIMEOUT 2024-07-05 20:08:07 -05:00
thinkyhead e0dcc610da [cron] Bump distribution date (2024-07-06) 2024-07-06 00:22:12 +00:00
Scott Lahteine 4aff10785e 🧑‍💻 Use "enum class" 2024-07-05 18:48:41 -05:00
thinkyhead d0e110d666 [cron] Bump distribution date (2024-07-05) 2024-07-05 06:08:13 +00:00
Vovodroid 10ffb9cb68 FAN_KICKSTART_LINEAR (#27072) 2024-07-04 21:22:16 -05:00
Keith Bennett b303bb1e56 🔧 English as default on MKS H43 (#27218) 2024-07-04 20:57:21 -05:00
Keith Bennett e6a61b182f 🐛 Fix E3S1PRO DGUS builds (#27211)
Partially reverts #26261
2024-07-04 20:37:43 -05:00
Keith Bennett 785b1da021 🐛 Fix YHCB2004 builds (#27210)
Co-authored-by: ellensp <530024+ellensp@users.noreply.github.com>
2024-07-04 20:36:17 -05:00
tombrazier a4d20031ec 🐛 Fix backlash intial direction (#27208)
Fix regression from #25791
2024-07-04 20:33:45 -05:00
tombrazier 3c60145792 🩹 Fix "calibration" endstop report (#27207)
Followup to #27204
2024-07-04 20:31:25 -05:00
Keith Bennett f2940adcf1 🔥 Drop BTT Manta XFER environments (#27240)
USB is connected to SoC (CM4/CB1/CB2), not MCU
2024-07-04 19:50:34 -05:00
Keith Bennett b5b9cc0b79 🔥 Drop BOARD_BIGTREE_SKR_V1_2 "renamed" reference (#27230) 2024-07-04 19:48:48 -05:00
ellensp 1d1eb97567 🚸 Update Zonestar OLEDs to SPI (#27220)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
2024-07-04 19:43:17 -05:00
thinkyhead 0103cffcd0 [cron] Bump distribution date (2024-07-02) 2024-07-02 00:23:05 +00:00
Mihai 6fed66dd42 🩹️ Fix judder, optimize planner (#27035) 2024-07-01 13:56:06 -05:00
thinkyhead c81416438d [cron] Bump distribution date (2024-06-30) 2024-06-30 00:25:29 +00:00
Scott Lahteine c95825a0ff 🔧 Simplify sensitive pins (#27219) 2024-06-29 15:50:35 -05:00
David Buezas b6284c9f01 🚸 Skip REINIT_NOISY_LCD for I2C OLED (#27222) 2024-06-29 15:43:08 -05:00
thinkyhead f84a97f51c [cron] Bump distribution date (2024-06-29) 2024-06-29 00:22:24 +00:00
Scott Lahteine 563296fc8b 🩹 LCD_CONTRAST => LCD_CONTRAST_INIT 2024-06-28 12:52:36 -05:00
thinkyhead 13290e798b [cron] Bump distribution date (2024-06-28) 2024-06-28 00:22:46 +00:00
thisiskeithb 96e3dfed46 🩹 Fix/Add Malyan M300 E0_AUTO_FAN_PIN 2024-06-27 19:00:20 -05:00
David Buezas cb6fd130ba ️ Load/init (most) settings after showing boot-screen (#27199)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
Co-authored-by: Peter Ellens <ellensp@users.noreply.github.com>
2024-06-27 18:37:35 -05:00
Scott Lahteine 11f90de873 🩹 Set color 1 on DOGM clear
Followup to `clear_for_drawing`
2024-06-27 18:35:00 -05:00
Keith Bennett 9240ec89d0 Add fail-fast: true default strategy to build test CI (#27215) 2024-06-27 11:50:26 -05:00
thinkyhead 8cf2a41f81 [cron] Bump distribution date (2024-06-27) 2024-06-27 00:22:45 +00:00
Scott Lahteine 1f9fc665ec 🚸 MarlinUI:: clear_for_drawing 2024-06-26 18:27:05 -05:00
Keith Bennett bf1995140a 🔨 TMC2100 is STANDALONE (#27209) 2024-06-26 16:26:42 -05:00
David Buezas 7b21cd5d72 🩹 Don't reinit i2c LCDs (#27194)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
2024-06-26 16:04:58 -05:00
thinkyhead 37fc32d972 [cron] Bump distribution date (2024-06-26) 2024-06-26 06:07:26 +00:00
Ben 9a6d4b5e56 🚸 PLR: Add FR and Flow (#27201)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
2024-06-25 22:34:33 -05:00
thinkyhead 1e0719dac5 [cron] Bump distribution date (2024-06-25) 2024-06-25 00:22:37 +00:00
Jonathan Brazier f2248f79d3 ️ Implement CALIBRATION_GCODE as endstop (#27204) 2024-06-24 14:52:49 -05:00
thinkyhead 60d843b540 [cron] Bump distribution date (2024-06-22) 2024-06-22 06:07:24 +00:00
Keith Bennett 6d7d281559 🔧 Warning for ZV Shaping on CoreQZ (#27200) 2024-06-21 19:38:11 -05:00
thinkyhead b3d462b890 [cron] Bump distribution date (2024-06-20) 2024-06-20 18:07:46 +00:00
Scott Lahteine a7444021c6 🔨 Fatal error for wrong GCC on macOS Native Sim 2024-06-20 12:53:58 -05:00
thinkyhead a93acbd35c [cron] Bump distribution date (2024-06-17) 2024-06-17 00:24:05 +00:00
Vovodroid d978123289 🔧 Nonlinear Extrusion optional Adaptive Smoothing (#27175) 2024-06-16 16:21:57 -05:00
Keith Bennett ee8dada752 ♻️ DISABLE_ENCODER => NO_BACK_MENU_ITEM (#27180) 2024-06-16 16:10:12 -05:00
ellensp 7bc6261d2a 🐛 Mount media early for POWER_LOSS_RECOVERY (#27177) 2024-06-15 20:14:46 -05:00
thinkyhead 013c3bcd82 [cron] Bump distribution date (2024-06-16) 2024-06-16 00:31:38 +00:00
Scott Lahteine 2fc86ad836 🐛 Fix homing when FT Motion exists (#27179) 2024-06-15 19:11:19 -05:00
Mihai 082dc24865 🧑‍💻 Adjust pulse_phase_isr code guards (#27112) 2024-06-15 18:01:36 -05:00
Mihai d7b6acc03d ️ Optimize LPC176x set_pwm_duty (#27178) 2024-06-15 17:55:45 -05:00
thinkyhead a1dc2856de [cron] Bump distribution date (2024-06-15) 2024-06-15 00:22:26 +00:00
Andrew 959be66cc2 🔨 Build scripts cleanup (#27157)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
2024-06-14 16:01:34 -05:00
thinkyhead ae2843940f [cron] Bump distribution date (2024-06-14) 2024-06-14 06:07:52 +00:00
Mihai 611ceedc1d 🐛 Fix step oversampling with NONLINEAR_EXTRUSION (#27171)
Followup to #27113
2024-06-13 23:05:05 -05:00
thinkyhead 38298076d6 [cron] Bump distribution date (2024-06-13) 2024-06-13 18:06:44 +00:00
Nicolas Graziano 1f0b8d6cd8 🚸 AnyCubic Vyper LCD improvements (#27158)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
2024-06-13 11:50:16 -05:00
thinkyhead e0d683baed [cron] Bump distribution date (2024-06-12) 2024-06-12 00:22:43 +00:00
Nicolas Graziano f4f75b6b12 🔨 Rename AnyCubic Vyper binary (#27167)
The vyper board need a file name which begin with 'main_board_'
2024-06-11 14:31:57 -05:00
thinkyhead fb6dc90a85 [cron] Bump distribution date (2024-06-11) 2024-06-11 00:22:36 +00:00
Bob Kuhn b99391c810 🚸🐛 Anycubic Vyper fixes (1) (#26261) 2024-06-10 14:20:03 -05:00
Vovodroid d9fc4f3a99 🚸 Nonlinear Extrusion polynomial Av^2+Bv+C (#27162) 2024-06-10 13:42:28 -05:00
Scott Lahteine daeffbc944 🚸 Prefer friendly Power Off over Auto-unalive 2024-06-10 12:51:21 -05:00
Scott Lahteine 87dde46fb0 🔧 Assume RAMPS_CREALITY is not CR2020 2024-06-10 12:51:21 -05:00
thinkyhead d96c6f867d [cron] Bump distribution date (2024-06-10) 2024-06-10 06:07:31 +00:00
Scott Lahteine 1f2e6d5434 📝 "Boards Manager" 2024-06-09 17:38:55 -05:00
thinkyhead 232b989d50 [cron] Bump distribution date (2024-06-09) 2024-06-09 00:25:46 +00:00
TheRaf974 d38261c908 🔧 Overridable SUICIDE_PIN for RAMPS_CREALITY (#27143) 2024-06-08 16:45:51 -05:00
Ryan P 3075bc3b7b 🚸🐛 SW SPI Mode 3 for U8G on STM32 (#27111) 2024-06-08 16:03:21 -05:00
Scott Lahteine 842d0b1c9f 🎨 Misc. SPI cleanup 2024-06-08 15:55:36 -05:00
Scott Lahteine 042b238dd8 🧑‍💻 USE_SOFTWARE_SPI => SDFAT_USE_SOFTWARE_SPI 2024-06-08 15:55:36 -05:00
Scott Lahteine c30904b631 🧑‍💻 U8G_SPI_USE_MODE_3 for *_MINI_12864 2024-06-08 15:55:36 -05:00
Mihai 225a71f4cd ️ Optimize LPC176x pin toggle (#27149) 2024-06-08 13:33:08 -05:00
ellensp 1d29a56344 🔧 Fix Z_MULTI_ENDSTOPS pin post-process (#27137) 2024-06-08 13:27:13 -05:00
ellensp 320e00267d ✏️ Fix comma typo (#27138) 2024-06-07 20:38:44 -05:00
thinkyhead 9869629b67 [cron] Bump distribution date (2024-06-08) 2024-06-08 00:23:12 +00:00
Scott Lahteine 3da78e85bf 📝 Remove dead video links 2024-06-07 17:25:42 -05:00
thinkyhead 11a4314261 [cron] Bump distribution date (2024-06-06) 2024-06-06 06:07:15 +00:00
Mihai 65c19f82b9 🔧 Minimum Stepper Pulse in Nanoseconds (#27113) 2024-06-05 21:26:09 -05:00
thinkyhead 0169cde8a4 [cron] Bump distribution date (2024-06-03) 2024-06-03 00:23:09 +00:00
InsanityAutomation ab0173b7e6 🚸 ExtUI: Shaping, Probing limits (#26754) 2024-06-02 14:45:19 -05:00
thinkyhead 95f81d2565 [cron] Bump distribution date (2024-05-29) 2024-05-29 00:26:13 +00:00
Scott Lahteine 9c922f0eab 🧑‍💻 Fix test STM32F103RC_btt_USB 2024-05-28 19:05:03 -05:00
Scott Lahteine 35a03d66e5 🔨 Update SAMD51 build deps 2024-05-28 18:49:39 -05:00
Mihai a4a0887fa7 🐛 Fix NONE, ALL, EVAL macro collision (#27132) 2024-05-28 18:22:39 -05:00
thinkyhead e7c9cf3e1d [cron] Bump distribution date (2024-05-27) 2024-05-27 00:22:53 +00:00
ellensp 6710616a09 🩹 Longer3D LK has ONBOARD_SDIO (#27129) 2024-05-26 12:09:18 -05:00
Scott Lahteine 2064c83c66 🚸 Fix SD nav after "one click print" (2) 2024-05-26 12:04:14 -05:00
thinkyhead 2e97ad1f4b [cron] Bump distribution date (2024-05-26) 2024-05-26 12:07:31 +00:00
Scott Lahteine 4f85f88ae3 🚸 Fix SD nav after "one click print" 2024-05-26 02:18:37 -05:00
226 changed files with 3279 additions and 3210 deletions
+1
View File
@@ -37,6 +37,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
test-platform:
+22 -58
View File
@@ -112,6 +112,16 @@
//#define SERIAL_PORT_3 1
//#define BAUDRATE_3 250000 // :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000] Enable to override BAUDRATE
/**
* Select a serial port to communicate with RS485 protocol
* :[-1, 0, 1, 2, 3, 4, 5, 6, 7]
*/
//#define RS485_SERIAL_PORT 1
#ifdef RS485_SERIAL_PORT
//#define M485_PROTOCOL 1 // Check your host for protocol compatibility
//#define RS485_BUS_BUFFER_SIZE 128
#endif
// Enable the Bluetooth serial interface on AT90USB devices
//#define BLUETOOTH
@@ -1898,12 +1908,11 @@
* RAMPS-based boards use SERVO3_PIN for the first runout sensor.
* For other boards you may need to define FIL_RUNOUT_PIN, FIL_RUNOUT2_PIN, etc.
*/
//#define FILAMENT_RUNOUT_SENSOR
#define FILAMENT_RUNOUT_SENSOR
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
#define FIL_RUNOUT_ENABLED_DEFAULT true // Enable the sensor on startup. Override with M412 followed by M500.
#define NUM_RUNOUT_SENSORS 1 // Number of sensors, up to one per extruder. Define a FIL_RUNOUT#_PIN for each.
#define FIL_RUNOUT_ENABLED { true } // Default enabled state for sensors E0[, E1[, E2[, E3...]]]. Override with M591EnnSn followed by M500.
#define FIL_RUNOUT_MODE { 7 } // Default mode for sensors E0[, E1[, E2[, E3...]]]. 0:NONE 1:Switch NO 2:Switch NC 7:Motion Sensor Override with M591EnPnn
#define FIL_RUNOUT_STATE LOW // Pin state indicating that filament is NOT present.
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
//#define WATCH_ALL_RUNOUT_SENSORS // Execute runout script on any triggering sensor, not only for the active extruder.
@@ -1947,58 +1956,11 @@
// NOTE: After 'M412 H1' the host handles filament runout and this script does not apply.
#define FILAMENT_RUNOUT_SCRIPT "M600"
// After a runout is detected, continue printing this length of filament
// before executing the runout script. Useful for a sensor at the end of
// a feed tube. Requires 4 bytes SRAM per sensor, plus 4 bytes overhead.
//#define FILAMENT_RUNOUT_DISTANCE_MM 25
#ifdef FILAMENT_RUNOUT_DISTANCE_MM
// Enable this option to use an encoder disc that toggles the runout pin
// as the filament moves. (Be sure to set FILAMENT_RUNOUT_DISTANCE_MM
// large enough to avoid false positives.)
//#define FILAMENT_MOTION_SENSOR
#if ENABLED(FILAMENT_MOTION_SENSOR)
//#define FILAMENT_SWITCH_AND_MOTION
#if ENABLED(FILAMENT_SWITCH_AND_MOTION)
#define NUM_MOTION_SENSORS 1 // Number of sensors, up to one per extruder. Define a FIL_MOTION#_PIN for each.
//#define FIL_MOTION1_PIN -1
// Override individually if the motion sensors vary
//#define FIL_MOTION1_STATE LOW
//#define FIL_MOTION1_PULLUP
//#define FIL_MOTION1_PULLDOWN
//#define FIL_MOTION2_STATE LOW
//#define FIL_MOTION2_PULLUP
//#define FIL_MOTION2_PULLDOWN
//#define FIL_MOTION3_STATE LOW
//#define FIL_MOTION3_PULLUP
//#define FIL_MOTION3_PULLDOWN
//#define FIL_MOTION4_STATE LOW
//#define FIL_MOTION4_PULLUP
//#define FIL_MOTION4_PULLDOWN
//#define FIL_MOTION5_STATE LOW
//#define FIL_MOTION5_PULLUP
//#define FIL_MOTION5_PULLDOWN
//#define FIL_MOTION6_STATE LOW
//#define FIL_MOTION6_PULLUP
//#define FIL_MOTION6_PULLDOWN
//#define FIL_MOTION7_STATE LOW
//#define FIL_MOTION7_PULLUP
//#define FIL_MOTION7_PULLDOWN
//#define FIL_MOTION8_STATE LOW
//#define FIL_MOTION8_PULLUP
//#define FIL_MOTION8_PULLDOWN
#endif
#endif
#endif
// In Mode 1 or 2, continue printing this length of filament after a run out occurs before executing the
// runout script. Useful for a sensor at the end of a feed tube or debounce on a flakey sensor.
// In Mode 7, extrusion distance to expect a change of state.
// Override with M591EnLnn
#define FILAMENT_RUNOUT_DISTANCE_MM 5
#endif
//===========================================================================
@@ -2421,7 +2383,7 @@
* P1 Raise the nozzle always to Z-park height.
* P2 Raise the nozzle by Z-park amount, limited to Z_MAX_POS.
*/
//#define NOZZLE_PARK_FEATURE
#define NOZZLE_PARK_FEATURE
#if ENABLED(NOZZLE_PARK_FEATURE)
// Specify a park position as { X, Y, Z_raise }
@@ -3415,7 +3377,9 @@
#define BUTTON_DELAY_EDIT 50 // (ms) Button repeat delay for edit screens
#define BUTTON_DELAY_MENU 250 // (ms) Button repeat delay for menus
//#define DISABLE_ENCODER // Disable the click encoder, if any
#if ANY(TFT_CLASSIC_UI, TFT_COLOR_UI)
//#define NO_BACK_MENU_ITEM // Don't display a top menu item to go back to the parent menu
#endif
#define TOUCH_SCREEN_CALIBRATION
+19 -17
View File
@@ -604,6 +604,8 @@
*/
//#define FAN_KICKSTART_TIME 100 // (ms)
//#define FAN_KICKSTART_POWER 180 // 64-255
//#define FAN_KICKSTART_LINEAR // Set kickstart time linearly based on the speed, e.g., for 20% (51) it will be FAN_KICKSTART_TIME * 0.2.
// Useful for quick speed up to low speed. Kickstart power must be set to 255.
// Some coolers may require a non-zero "off" state.
//#define FAN_OFF_PWM 1
@@ -1331,8 +1333,6 @@
//#define CALIBRATION_SCRIPT_PRE "M117 Starting Auto-Calibration\nT0\nG28\nG12\nM117 Calibrating..."
//#define CALIBRATION_SCRIPT_POST "M500\nM117 Calibration data saved"
#define CALIBRATION_MEASUREMENT_RESOLUTION 0.01 // mm
#define CALIBRATION_FEEDRATE_SLOW 60 // mm/min
#define CALIBRATION_FEEDRATE_FAST 1200 // mm/min
#define CALIBRATION_FEEDRATE_TRAVEL 3000 // mm/min
@@ -2329,6 +2329,7 @@
*
* Control extrusion rate based on instantaneous extruder velocity. Can be used to correct for
* underextrusion at high extruder speeds that are otherwise well-behaved (i.e., not skipping).
* For better results also enable ADAPTIVE_STEP_SMOOTHING.
*/
//#define NONLINEAR_EXTRUSION
@@ -2556,27 +2557,28 @@
//#define MINIMUM_STEPPER_PRE_DIR_DELAY 650
/**
* Minimum stepper driver pulse width (in µs)
* 0 : Smallest possible width the MCU can produce, compatible with TMC2xxx drivers
* 0 : Minimum 500ns for LV8729, adjusted in stepper.h
* 1 : Minimum for A4988 and A5984 stepper drivers
* 2 : Minimum for DRV8825 stepper drivers
* 3 : Minimum for TB6600 stepper drivers
* 30 : Minimum for TB6560 stepper drivers
* Minimum stepper driver pulse width (in ns)
* If undefined, these defaults (from Conditionals_adv.h) apply:
* 100 : Minimum for TMC2xxx stepper drivers
* 500 : Minimum for LV8729
* 1000 : Minimum for A4988 and A5984 stepper drivers
* 2000 : Minimum for DRV8825 stepper drivers
* 3000 : Minimum for TB6600 stepper drivers
* 30000 : Minimum for TB6560 stepper drivers
*
* Override the default value based on the driver type set in Configuration.h.
*/
//#define MINIMUM_STEPPER_PULSE 2
//#define MINIMUM_STEPPER_PULSE_NS 2000
/**
* Maximum stepping rate (in Hz) the stepper driver allows
* If undefined, defaults to 1MHz / (2 * MINIMUM_STEPPER_PULSE)
* If undefined, these defaults (from Conditionals_adv.h) apply:
* 5000000 : Maximum for TMC2xxx stepper drivers
* 1000000 : Maximum for LV8729 stepper driver
* 500000 : Maximum for A4988 stepper driver
* 250000 : Maximum for DRV8825 stepper driver
* 150000 : Maximum for TB6600 stepper driver
* 15000 : Maximum for TB6560 stepper driver
* 500000 : Maximum for A4988 stepper driver
* 250000 : Maximum for DRV8825 stepper driver
* 150000 : Maximum for TB6600 stepper driver
* 15000 : Maximum for TB6560 stepper driver
*
* Override the default value based on the driver type set in Configuration.h.
*/
@@ -2653,7 +2655,7 @@
* Currently handles M108, M112, M410, M876
* NOTE: Not yet implemented for all platforms.
*/
//#define EMERGENCY_PARSER
#define EMERGENCY_PARSER
/**
* Realtime Reporting (requires EMERGENCY_PARSER)
@@ -2886,7 +2888,7 @@
*
* Enable PARK_HEAD_ON_PAUSE to add the G-code M125 Pause and Park.
*/
//#define ADVANCED_PAUSE_FEATURE
#define ADVANCED_PAUSE_FEATURE
#if ENABLED(ADVANCED_PAUSE_FEATURE)
#define PAUSE_PARK_RETRACT_FEEDRATE 60 // (mm/s) Initial retract feedrate.
#define PAUSE_PARK_RETRACT_LENGTH 2 // (mm) Initial retract.
+1 -1
View File
@@ -41,7 +41,7 @@
* here we define this default string as the date where the latest release
* version was tagged.
*/
//#define STRING_DISTRIBUTION_DATE "2024-05-24"
//#define STRING_DISTRIBUTION_DATE "2024-07-12"
/**
* Defines a generic printer name to be output to the LCD after booting Marlin.
+2 -2
View File
@@ -141,7 +141,7 @@ typedef Servo hal_servo_t;
#error "LCD_SERIAL_PORT must be from 0 to 3."
#endif
#define LCD_SERIAL lcdSerial
#if HAS_DGUS_LCD
#if ANY(HAS_DGUS_LCD, EXTENSIBLE_UI)
#define LCD_SERIAL_TX_BUFFER_FREE() LCD_SERIAL.get_tx_buffer_free()
#endif
#endif
@@ -159,7 +159,7 @@ typedef Servo hal_servo_t;
#define GET_PIN_MAP_INDEX(pin) pin
#define PARSED_PIN_INDEX(code, dval) parser.intval(code, dval)
#define HAL_SENSITIVE_PINS 0, 1,
#define HAL_SENSITIVE_PINS 0, 1
#ifdef __AVR_AT90USB1286__
#define JTAG_DISABLE() do{ MCUCR = 0x80; MCUCR = 0x80; }while(0)
+1 -1
View File
@@ -629,7 +629,7 @@ MSerialT1 customizedSerial1(MSerialT1::HasEmergencyParser);
template class MarlinSerial< LCDSerialCfg<LCD_SERIAL_PORT> >;
MSerialLCD lcdSerial(MSerialLCD::HasEmergencyParser);
#if HAS_DGUS_LCD
#if ANY(HAS_DGUS_LCD, EXTENSIBLE_UI)
template<typename Cfg>
typename MarlinSerial<Cfg>::ring_buffer_pos_t MarlinSerial<Cfg>::get_tx_buffer_free() {
const ring_buffer_pos_t t = tx_buffer.tail, // next byte to send.
+1 -1
View File
@@ -205,7 +205,7 @@
static ring_buffer_pos_t available();
static void write(const uint8_t c);
static void flushTX();
#if HAS_DGUS_LCD
#if ANY(HAS_DGUS_LCD, EXTENSIBLE_UI)
static ring_buffer_pos_t get_tx_buffer_free();
#endif
+8
View File
@@ -345,6 +345,14 @@ void setup_endstop_interrupts() {
pciSetup(Z_MIN_PROBE_PIN);
#endif
#endif
#if USE_CALIBRATION
#if (digitalPinToInterrupt(CALIBRATION_PIN) != NOT_AN_INTERRUPT)
_ATTACH(CALIBRATION_PIN);
#else
static_assert(digitalPinHasPCICR(CALIBRATION_PIN), "CALIBRATION_PIN is not interrupt-capable. Disable ENDSTOP_INTERRUPTS_FEATURE to continue.");
pciSetup(CALIBRATION_PIN);
#endif
#endif
// If we arrive here without raising an assertion, each pin has either an EXT-interrupt or a PCI.
}
+1 -1
View File
@@ -150,7 +150,7 @@ void MarlinHAL::set_pwm_frequency(const pin_t pin, const uint16_t f_desired) {
else {
if (p == 32 || p == 128) continue; // Skip TIMER2 specific prescalers when not TIMER2
const uint16_t rft = (F_CPU) / (p * f_desired);
DEBUG_ECHOLNPGM("(Not Timer 2) F_CPU=" STRINGIFY(F_CPU), " prescaler=", p, " f_desired=", f_desired);
DEBUG_ECHOLNPGM("(Not Timer 2) F_CPU=", STRINGIFY(F_CPU), " prescaler=", p, " f_desired=", f_desired);
res_fast_temp = rft - 1;
res_pc_temp = rft / 2;
}
-3
View File
@@ -28,9 +28,6 @@
* Port : E0 E1 E4 E5 G5 E3 H3 H4 H5 H6 B4 B5 B6 B7 J1 J0 H1 H0 D3 D2 D1 D0 A0 A1 A2 A3 A4 A5 A6 A7 C7 C6 C5 C4 C3 C2 C1 C0 D7 G2 G1 G0 L7 L6 L5 L4 L3 L2 L1 L0 B3 B2 B1 B0 F0 F1 F2 F3 F4 F5 F6 F7 K0 K1 K2 K3 K4 K5 K6 K7 | E2 E6 E7 xx xx H2 H7 G3 G4 xx xx xx xx xx D4 D5 D6 xx xx J2 J3 J4 J5 J6 J7 xx xx xx xx xx
* Logical Pin : 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | 78 79 80 xx xx 84 85 71 70 xx xx xx xx xx 81 82 83 xx xx 72 73 75 76 77 74 xx xx xx xx xx
* Analog Input : 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
*
* Arduino Pin Layout video: https://youtu.be/rIqeVCX09FA
* AVR alternate pin function overview video: https://youtu.be/1yd8wuI5Plg
*/
#include "../fastio.h"
-3
View File
@@ -26,9 +26,6 @@
*
* Logical Pin: 38 39 40 41 42 43 44 45 16 10 11 12 06 07 08 09 30 31 32 33 34 35 36 37 17 18 19 20 21 22 23 24 00 01 13 05 02 03 14 15 46 47 48 49 50 51 52 53 25 26 27 28 29 04
* Port: A0 A1 A2 A3 A4 A5 A6 A7 B0 B1 B2 B3 B4 B5 B6 B7 C0 C1 C2 C3 C4 C5 C6 C7 D0 D1 D2 D3 D4 D5 D6 D7 E0 E1 E2 E3 E4 E5 E6 E7 F0 F1 F2 F3 F4 F5 F6 F7 G0 G1 G2 G3 G4 G5
*
* Arduino Pin Layout video: https://youtu.be/rIqeVCX09FA
* AVR alternate pin function overview video: https://youtu.be/1yd8wuI5Plg
*/
#include "../fastio.h"
-3
View File
@@ -26,9 +26,6 @@
*
* Logical Pin: 08 09 10 11 12 13 14 15 16 17 18 19 20 21 00 01 02 03 04 05 06 07
* Port: B0 B1 B2 B3 B4 B5 C0 C1 C2 C3 C4 C5 C6 C7 D0 D1 D2 D3 D4 D5 D6 D7
*
* Arduino Pin Layout video: https://youtu.be/rIqeVCX09FA
* AVR alternate pin function overview video: https://youtu.be/1yd8wuI5Plg
*/
#include "../fastio.h"
-3
View File
@@ -26,9 +26,6 @@
*
* Logical Pin: 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
* Port: B0 B1 B2 B3 B4 B5 B6 B7 D0 D1 D2 D3 D4 D5 D6 D7 C0 C1 C2 C3 C4 C5 C6 C7 A7 A6 A5 A4 A3 A2 A1 A0
*
* Arduino Pin Layout video: https://youtu.be/rIqeVCX09FA
* AVR alternate pin function overview video: https://youtu.be/1yd8wuI5Plg
*/
/** ATMega644
@@ -27,9 +27,6 @@
* Logical Pin: 28 29 30 31 32 33 34 35 20 21 22 23 24 25 26 27 10 11 12 13 14 15 16 17 00 01 02 03 04 05 06 07 08 09(46*47)36 37 18 19 38 39 40 41 42 43 44 45
* Port: A0 A1 A2 A3 A4 A5 A6 A7 B0 B1 B2 B3 B4 B5 B6 B7 C0 C1 C2 C3 C4 C5 C6 C7 D0 D1 D2 D3 D4 D5 D6 D7 E0 E1 E2 E3 E4 E5 E6 E7 F0 F1 F2 F3 F4 F5 F6 F7
* The logical pins 46 and 47 are not supported by Teensyduino, but are supported below as E2 and E3
*
* Arduino Pin Layout video: https://youtu.be/rIqeVCX09FA
* AVR alternate pin function overview video: https://youtu.be/1yd8wuI5Plg
*/
#include "../fastio.h"
@@ -120,7 +120,7 @@ void u8g_spiSend_sw_AVR_mode_3(uint8_t val) {
U8G_ATOMIC_END();
}
#if ENABLED(FYSETC_MINI_12864)
#if U8G_SPI_USE_MODE_3
#define SPISEND_SW_AVR u8g_spiSend_sw_AVR_mode_3
#else
#define SPISEND_SW_AVR u8g_spiSend_sw_AVR_mode_0
@@ -143,9 +143,9 @@ uint8_t u8g_com_HAL_AVR_sw_sp_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void
break;
case U8G_COM_MSG_CHIP_SELECT:
#if ENABLED(FYSETC_MINI_12864) // LCD SPI is running mode 3 while SD card is running mode 0
if (arg_val) { // SCK idle state needs to be set to the proper idle state before
// the next chip select goes active
#if U8G_SPI_USE_MODE_3 // LCD SPI is running mode 3 while SD card is running mode 0
if (arg_val) { // SCK idle state needs to be set to the proper idle state before
// the next chip select goes active
u8g_com_arduino_digital_write(u8g, U8G_PI_SCK, 1); // Set SCK to mode 3 idle state before CS goes active
u8g_com_arduino_digital_write(u8g, U8G_PI_CS, LOW);
}
+1
View File
@@ -64,6 +64,7 @@ void setup_endstop_interrupts() {
TERN_(USE_Z4_MAX, _ATTACH(Z4_MAX_PIN));
TERN_(USE_Z4_MIN, _ATTACH(Z4_MIN_PIN));
TERN_(USE_Z_MIN_PROBE, _ATTACH(Z_MIN_PROBE_PIN));
TERN_(USE_CALIBRATION, _ATTACH(CALIBRATION_PIN));
TERN_(USE_I_MAX, _ATTACH(I_MAX_PIN));
TERN_(USE_I_MIN, _ATTACH(I_MIN_PIN));
TERN_(USE_J_MAX, _ATTACH(J_MAX_PIN));
+6 -7
View File
@@ -68,16 +68,15 @@
* Usually the hardware SPI pins are only available to the LCD. This makes the DUE hard SPI used at the same time
* as the TMC2130 soft SPI the most common setup.
*/
#define _IS_HW_SPI(P) (defined(TMC_SPI_##P) && (TMC_SPI_##P == SD_MOSI_PIN || TMC_SPI_##P == SD_MISO_PIN || TMC_SPI_##P == SD_SCK_PIN))
#if HAS_MEDIA && HAS_DRIVER(TMC2130)
#if ENABLED(TMC_USE_SW_SPI)
#if DISABLED(SOFTWARE_SPI) && (_IS_HW_SPI(MOSI) || _IS_HW_SPI(MISO) || _IS_HW_SPI(SCK))
#error "DUE hardware SPI is required but is incompatible with TMC2130 software SPI. Either disable TMC_USE_SW_SPI or use separate pins for the two SPIs."
#endif
#elif ENABLED(SOFTWARE_SPI)
#define _IS_HW_SPI(P) (defined(TMC_SPI_##P) && (TMC_SPI_##P == SD_MOSI_PIN || TMC_SPI_##P == SD_MISO_PIN || TMC_SPI_##P == SD_SCK_PIN))
#if DISABLED(SOFTWARE_SPI) && ENABLED(TMC_USE_SW_SPI) && (_IS_HW_SPI(MOSI) || _IS_HW_SPI(MISO) || _IS_HW_SPI(SCK))
#error "DUE hardware SPI is required but is incompatible with TMC2130 software SPI. Either disable TMC_USE_SW_SPI or use separate pins for the two SPIs."
#endif
#if ENABLED(SOFTWARE_SPI) && DISABLED(TMC_USE_SW_SPI)
#error "DUE software SPI is required but is incompatible with TMC2130 hardware SPI. Enable TMC_USE_SW_SPI to fix."
#endif
#undef _IS_HW_SPI
#endif
#if ENABLED(FAST_PWM_FAN) || SPINDLE_LASER_FREQUENCY
+1 -1
View File
@@ -24,7 +24,7 @@
/**
* Define SPI Pins: SCK, MISO, MOSI, SS
*
* Available chip select pins for HW SPI are 4 10 52 77
* Available chip select pins for HW SPI are 4 10 52 77 87
*/
#if SDSS == 4 || SDSS == 10 || SDSS == 52 || SDSS == 77 || SDSS == 87
#if SDSS == 4
@@ -66,7 +66,7 @@
#include <U8glib-HAL.h>
#if ENABLED(FYSETC_MINI_12864)
#if U8G_SPI_USE_MODE_3
#define SPISEND_SW_DUE u8g_spiSend_sw_DUE_mode_3
#else
#define SPISEND_SW_DUE u8g_spiSend_sw_DUE_mode_0
@@ -96,15 +96,15 @@ uint8_t u8g_com_HAL_DUE_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void
break;
case U8G_COM_MSG_CHIP_SELECT:
#if ENABLED(FYSETC_MINI_12864) // LCD SPI is running mode 3 while SD card is running mode 0
if (arg_val) { // SCK idle state needs to be set to the proper idle state before
// the next chip select goes active
u8g_SetPILevel_DUE(u8g, U8G_PI_SCK, 1); //set SCK to mode 3 idle state before CS goes active
#if U8G_SPI_USE_MODE_3 // LCD SPI is running mode 3 while SD card is running mode 0
if (arg_val) { // SCK idle state needs to be set to the proper idle state before
// the next chip select goes active
u8g_SetPILevel_DUE(u8g, U8G_PI_SCK, 1); // Set SCK to mode 3 idle state before CS goes active
u8g_SetPILevel_DUE(u8g, U8G_PI_CS, LOW);
}
else {
u8g_SetPILevel_DUE(u8g, U8G_PI_CS, HIGH);
u8g_SetPILevel_DUE(u8g, U8G_PI_SCK, 0); //set SCK to mode 0 idle state after CS goes inactive
u8g_SetPILevel_DUE(u8g, U8G_PI_SCK, 0); // Set SCK to mode 0 idle state after CS goes inactive
}
#else
u8g_SetPILevel_DUE(u8g, U8G_PI_CS, !arg_val);
+1 -1
View File
@@ -11,7 +11,7 @@ if pioutil.is_pio_build():
if current_OS == 'Windows':
Import("env")
env = pioutil.env
# Use bossac.exe on Windows
env.Replace(
@@ -59,6 +59,7 @@ void setup_endstop_interrupts() {
TERN_(USE_Z4_MAX, _ATTACH(Z4_MAX_PIN));
TERN_(USE_Z4_MIN, _ATTACH(Z4_MIN_PIN));
TERN_(USE_Z_MIN_PROBE, _ATTACH(Z_MIN_PROBE_PIN));
TERN_(USE_CALIBRATION, _ATTACH(CALIBRATION_PIN));
TERN_(USE_I_MAX, _ATTACH(I_MAX_PIN));
TERN_(USE_I_MIN, _ATTACH(I_MIN_PIN));
TERN_(USE_J_MAX, _ATTACH(J_MAX_PIN));
+3 -1
View File
@@ -101,12 +101,14 @@ void setup_endstop_interrupts() {
SETUP(Z_MIN_PROBE);
SETUP(CALIBRATION);
#undef SETUP
}
// Ensure 1 - 10 IRQs are registered
// Disable some endstops if you encounter this error
#define ENDSTOPS_INTERRUPTS_COUNT COUNT_ENABLED(USE_X_MAX, USE_X_MIN, USE_X2_MAX, USE_X2_MIN, USE_Y_MAX, USE_Y_MIN, USE_Y2_MAX, USE_Y2_MIN, USE_Z_MAX, USE_Z_MIN, USE_Z2_MAX, USE_Z2_MIN, USE_Z3_MAX, USE_Z3_MIN, USE_Z4_MAX, USE_Z4_MIN, USE_Z_MIN_PROBE)
#define ENDSTOPS_INTERRUPTS_COUNT COUNT_ENABLED(USE_X_MAX, USE_X_MIN, USE_X2_MAX, USE_X2_MIN, USE_Y_MAX, USE_Y_MIN, USE_Y2_MAX, USE_Y2_MIN, USE_Z_MAX, USE_Z_MIN, USE_Z2_MAX, USE_Z2_MIN, USE_Z3_MAX, USE_Z3_MIN, USE_Z4_MAX, USE_Z4_MIN, USE_Z_MIN_PROBE, USE_CALIBRATION)
#if ENDSTOPS_INTERRUPTS_COUNT > 10
#error "Too many endstop interrupts! HC32F460 only supports 10 endstop interrupts."
#elif ENDSTOPS_INTERRUPTS_COUNT == 0
@@ -82,7 +82,7 @@ static inline uint8_t swSpiTransfer_mode_3(uint8_t b, const uint8_t spi_speed, c
}
static void u8g_sw_spi_shift_out(uint8_t val) {
#if ANY(FYSETC_MINI_12864, MKS_MINI_12864)
#if U8G_SPI_USE_MODE_3
swSpiTransfer_mode_3(val, SPI_speed);
#else
swSpiTransfer_mode_0(val, SPI_speed);
@@ -116,15 +116,15 @@ uint8_t u8g_com_HAL_HC32_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, voi
break;
case U8G_COM_MSG_CHIP_SELECT:
#if ANY(FYSETC_MINI_12864, MKS_MINI_12864) // This LCD SPI is running mode 3 while SD card is running mode 0
if (arg_val) { // SCK idle state needs to be set to the proper idle state before
// the next chip select goes active
WRITE(DOGLCD_SCK, HIGH); // Set SCK to mode 3 idle state before CS goes active
#if U8G_SPI_USE_MODE_3 // This LCD SPI is running mode 3 while SD card is running mode 0
if (arg_val) { // SCK idle state needs to be set to the proper idle state before
// the next chip select goes active
WRITE(DOGLCD_SCK, HIGH); // Set SCK to mode 3 idle state before CS goes active
WRITE(DOGLCD_CS, LOW);
}
else {
WRITE(DOGLCD_CS, HIGH);
WRITE(DOGLCD_SCK, LOW); // Set SCK to mode 0 idle state after CS goes inactive
WRITE(DOGLCD_SCK, LOW); // Set SCK to mode 0 idle state after CS goes inactive
}
#else
WRITE(DOGLCD_CS, !arg_val);
-6
View File
@@ -28,12 +28,6 @@
// spiBeginTransaction.
#endif
// Onboard SD
//#define SD_SCK_PIN P0_07
//#define SD_MISO_PIN P0_08
//#define SD_MOSI_PIN P0_09
//#define SD_SS_PIN P0_06
// External SD
#ifndef SD_SCK_PIN
#define SD_SCK_PIN 50
+2 -2
View File
@@ -100,7 +100,7 @@ extern DefaultSerial1 USBSerial;
#else
#error "LCD_SERIAL_PORT must be from 0 to 3. You can also use -1 if the board supports Native USB."
#endif
#if HAS_DGUS_LCD
#if ANY(HAS_DGUS_LCD, EXTENSIBLE_UI)
#define LCD_SERIAL_TX_BUFFER_FREE() LCD_SERIAL.available()
#endif
#endif
@@ -159,7 +159,7 @@ constexpr pin_t GET_PIN_MAP_PIN(const int16_t index) {
// Parse a G-code word into a pin index
int16_t PARSED_PIN_INDEX(const char code, const int16_t dval);
// P0.6 thru P0.9 are for the onboard SD card
#define HAL_SENSITIVE_PINS P0_06, P0_07, P0_08, P0_09,
#define HAL_SENSITIVE_PINS P0_06, P0_07, P0_08, P0_09
// ------------------------
// Defines
@@ -146,6 +146,12 @@ void setup_endstop_interrupts() {
#endif
_ATTACH(Z_MIN_PROBE_PIN);
#endif
#if USE_CALIBRATION
#if !LPC1768_PIN_INTERRUPT_M(CALIBRATION_PIN)
#error "CALIBRATION_PIN is not INTERRUPT-capable. Disable ENDSTOP_INTERRUPTS_FEATURE to continue."
#endif
_ATTACH(CALIBRATION_PIN);
#endif
#if USE_I_MAX
#if !LPC1768_PIN_INTERRUPT_M(I_MAX_PIN)
#error "I_MAX_PIN is not INTERRUPT-capable. Disable ENDSTOP_INTERRUPTS_FEATURE to continue."
+4 -2
View File
@@ -26,8 +26,10 @@
void MarlinHAL::set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t v_size/*=255*/, const bool invert/*=false*/) {
if (!LPC176x::pin_is_valid(pin)) return;
if (LPC176x::pwm_attach_pin(pin))
LPC176x::pwm_write_ratio(pin, invert ? 1.0f - (float)v / v_size : (float)v / v_size); // map 1-254 onto PWM range
if (LPC176x::pwm_attach_pin(pin)) {
const uint32_t duty = map(invert ? v_size - v : v, 0, v_size, 0, LPC176x::pwm_get_period(pin));
LPC176x::pwm_write(pin, duty);
}
}
void MarlinHAL::set_pwm_frequency(const pin_t pin, const uint16_t f_desired) {
+1 -1
View File
@@ -66,7 +66,7 @@
#define _WRITE(IO,V) WRITE_PIN(IO,V)
/// toggle a pin
#define _TOGGLE(IO) _WRITE(IO, !READ(IO))
#define _TOGGLE(IO) LPC176x::gpio_toggle(IO)
/// set pin as input
#define _SET_INPUT(IO) SET_DIR_INPUT(IO)
+7 -6
View File
@@ -28,12 +28,13 @@
// spiBeginTransaction.
#endif
/** onboard SD card */
//#define SD_SCK_PIN P0_07
//#define SD_MISO_PIN P0_08
//#define SD_MOSI_PIN P0_09
//#define SD_SS_PIN P0_06
/** external */
// Onboard SD
//#define SD_SCK_PIN P0_07
//#define SD_MISO_PIN P0_08
//#define SD_MOSI_PIN P0_09
//#define SD_SS_PIN P0_06
// External SD
#ifndef SD_SCK_PIN
#define SD_SCK_PIN P0_15
#endif
@@ -132,7 +132,7 @@ uint8_t swSpiTransfer_mode_3(uint8_t b, const uint8_t spi_speed, const pin_t sck
static uint8_t SPI_speed = 0;
static void u8g_sw_spi_shift_out(uint8_t dataPin, uint8_t clockPin, uint8_t val) {
#if ANY(FYSETC_MINI_12864, MKS_MINI_12864)
#if U8G_SPI_USE_MODE_3
swSpiTransfer_mode_3(val, SPI_speed, clockPin, -1, dataPin);
#else
swSpiTransfer_mode_0(val, SPI_speed, clockPin, -1, dataPin);
@@ -160,15 +160,15 @@ uint8_t u8g_com_HAL_LPC1768_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val,
break;
case U8G_COM_MSG_CHIP_SELECT:
#if ANY(FYSETC_MINI_12864, MKS_MINI_12864) // LCD SPI is running mode 3 while SD card is running mode 0
if (arg_val) { // SCK idle state needs to be set to the proper idle state before
// the next chip select goes active
u8g_SetPILevel(u8g, U8G_PI_SCK, 1); // Set SCK to mode 3 idle state before CS goes active
#if U8G_SPI_USE_MODE_3 // LCD SPI is running mode 3 while SD card is running mode 0
if (arg_val) { // SCK idle state needs to be set to the proper idle state before
// the next chip select goes active
u8g_SetPILevel(u8g, U8G_PI_SCK, 1); // Set SCK to mode 3 idle state before CS goes active
u8g_SetPILevel(u8g, U8G_PI_CS, LOW);
}
else {
u8g_SetPILevel(u8g, U8G_PI_CS, HIGH);
u8g_SetPILevel(u8g, U8G_PI_SCK, 0); // Set SCK to mode 0 idle state after CS goes inactive
u8g_SetPILevel(u8g, U8G_PI_SCK, 0); // Set SCK to mode 0 idle state after CS goes inactive
}
#else
u8g_SetPILevel(u8g, U8G_PI_CS, !arg_val);
@@ -13,9 +13,9 @@ if pioutil.is_pio_build():
target_drive = "REARM"
import platform
current_OS = platform.system()
Import("env")
env = pioutil.env
def print_error(e):
print('\nUnable to find destination disk (%s)\n' \
@@ -131,7 +131,7 @@ static uint8_t swSpiInit(const uint8_t spi_speed, const uint8_t clk_pin, const u
}
static void u8g_sw_spi_shift_out(uint8_t dataPin, uint8_t clockPin, uint8_t val) {
#if ANY(FYSETC_MINI_12864, MKS_MINI_12864)
#if U8G_SPI_USE_MODE_3
swSpiTransfer_mode_3(val, SPI_speed, clockPin, -1, dataPin);
#else
swSpiTransfer_mode_0(val, SPI_speed, clockPin, -1, dataPin);
@@ -159,15 +159,15 @@ uint8_t u8g_com_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_pt
break;
case U8G_COM_MSG_CHIP_SELECT:
#if ANY(FYSETC_MINI_12864, MKS_MINI_12864) // LCD SPI is running mode 3 while SD card is running mode 0
if (arg_val) { // SCK idle state needs to be set to the proper idle state before
// the next chip select goes active
u8g_SetPILevel(u8g, U8G_PI_SCK, 1); // Set SCK to mode 3 idle state before CS goes active
#if U8G_SPI_USE_MODE_3 // LCD SPI is running mode 3 while SD card is running mode 0
if (arg_val) { // SCK idle state needs to be set to the proper idle state before
// the next chip select goes active
u8g_SetPILevel(u8g, U8G_PI_SCK, 1); // Set SCK to mode 3 idle state before CS goes active
u8g_SetPILevel(u8g, U8G_PI_CS, LOW);
}
else {
u8g_SetPILevel(u8g, U8G_PI_CS, HIGH);
u8g_SetPILevel(u8g, U8G_PI_SCK, 0); // Set SCK to mode 0 idle state after CS goes inactive
u8g_SetPILevel(u8g, U8G_PI_SCK, 0); // Set SCK to mode 0 idle state after CS goes inactive
}
#else
u8g_SetPILevel(u8g, U8G_PI_CS, !arg_val);
+9 -1
View File
@@ -83,6 +83,7 @@
#define MATCH_Z4_MAX_EILINE(P) TERN0(USE_Z4_MAX, DEFER4(MATCH_EILINE)(P, Z4_MAX_PIN))
#define MATCH_Z4_MIN_EILINE(P) TERN0(USE_Z4_MIN, DEFER4(MATCH_EILINE)(P, Z4_MIN_PIN))
#define MATCH_Z_MIN_PROBE_EILINE(P) TERN0(USE_Z_MIN_PROBE, DEFER4(MATCH_EILINE)(P, Z_MIN_PROBE_PIN))
#define MATCH_CALIBRATION_EILINE(P) TERN0(USE_CALIBRATION, DEFER4(MATCH_EILINE)(P, CALIBRATION_PIN))
#define AVAILABLE_EILINE(P) ( PIN_TO_EILINE(P) != -1 \
&& !MATCH_X_MAX_EILINE(P) && !MATCH_X_MIN_EILINE(P) \
@@ -99,7 +100,8 @@
&& !MATCH_Z2_MAX_EILINE(P) && !MATCH_Z2_MIN_EILINE(P) \
&& !MATCH_Z3_MAX_EILINE(P) && !MATCH_Z3_MIN_EILINE(P) \
&& !MATCH_Z4_MAX_EILINE(P) && !MATCH_Z4_MIN_EILINE(P) \
&& !MATCH_Z_MIN_PROBE_EILINE(P) )
&& !MATCH_Z_MIN_PROBE_EILINE(P) \
&& !MATCH_CALIBRATION_EILINE(P) )
// One ISR for all EXT-Interrupts
void endstop_ISR() { endstops.update(); }
@@ -208,6 +210,12 @@ void setup_endstop_interrupts() {
#endif
_ATTACH(Z_MIN_PROBE_PIN);
#endif
#if USE_CALIBRATION
#if !AVAILABLE_EILINE(CALIBRATION_PIN)
#error "CALIBRATION_PIN has no EXTINT line available. Disable ENDSTOP_INTERRUPTS_FEATURE to continue."
#endif
_ATTACH(CALIBRATION_PIN);
#endif
#if USE_I_MAX
#if !AVAILABLE_EILINE(I_MAX_PIN)
#error "I_MAX_PIN has no EXTINT line available. Disable ENDSTOP_INTERRUPTS_FEATURE to continue."
+9 -1
View File
@@ -82,6 +82,7 @@
#define MATCH_Z4_MAX_EILINE(P) TERN0(USE_Z4_MAX, DEFER4(MATCH_EILINE)(P, Z4_MAX_PIN))
#define MATCH_Z4_MIN_EILINE(P) TERN0(USE_Z4_MIN, DEFER4(MATCH_EILINE)(P, Z4_MIN_PIN))
#define MATCH_Z_MIN_PROBE_EILINE(P) TERN0(USE_Z_MIN_PROBE, DEFER4(MATCH_EILINE)(P, Z_MIN_PROBE_PIN))
#define MATCH_CALIBRATION_EILINE(P) TERN0(USE_CALIBRATION, DEFER4(MATCH_EILINE)(P, CALIBRATION_PIN))
#define AVAILABLE_EILINE(P) ( PIN_TO_EILINE(P) != -1 \
&& !MATCH_X_MAX_EILINE(P) && !MATCH_X_MIN_EILINE(P) \
@@ -98,7 +99,8 @@
&& !MATCH_Z2_MAX_EILINE(P) && !MATCH_Z2_MIN_EILINE(P) \
&& !MATCH_Z3_MAX_EILINE(P) && !MATCH_Z3_MIN_EILINE(P) \
&& !MATCH_Z4_MAX_EILINE(P) && !MATCH_Z4_MIN_EILINE(P) \
&& !MATCH_Z_MIN_PROBE_EILINE(P) )
&& !MATCH_Z_MIN_PROBE_EILINE(P) \
&& !MATCH_CALIBRATION_EILINE(P) )
// One ISR for all EXT-Interrupts
void endstop_ISR() { endstops.update(); }
@@ -183,6 +185,12 @@ void setup_endstop_interrupts() {
#endif
_ATTACH(Z_MIN_PROBE_PIN);
#endif
#if USE_CALIBRATION
#if !AVAILABLE_EILINE(CALIBRATION_PIN)
#error "CALIBRATION_PIN has no EXTINT line available. Disable ENDSTOP_INTERRUPTS_FEATURE to continue."
#endif
_ATTACH(CALIBRATION_PIN);
#endif
#if USE_I_MAX
#if !AVAILABLE_EILINE(I_MAX_PIN)
#error "I_MAX_PIN has no EXTINT line available. Disable ENDSTOP_INTERRUPTS_FEATURE to continue."
+9 -1
View File
@@ -112,11 +112,19 @@
#else
#error "LCD_SERIAL_PORT must be from 1 to 9, or -1 for Native USB."
#endif
#if HAS_DGUS_LCD
#if ANY(HAS_DGUS_LCD, EXTENSIBLE_UI)
#define LCD_SERIAL_TX_BUFFER_FREE() LCD_SERIAL.availableForWrite()
#endif
#endif
#ifdef RS485_SERIAL_PORT
#if WITHIN(RS485_SERIAL_PORT, 1, 9)
#define RS485_SERIAL MSERIAL(RS485_SERIAL_PORT)
#else
#error "RS485_SERIAL_PORT must be from 1 to 9."
#endif
#endif
/**
* TODO: review this to return 1 for pins that are not analog input
*/
+1 -1
View File
@@ -37,7 +37,7 @@ static SPISettings spiConfig;
// Public functions
// ------------------------
#if ENABLED(SOFTWARE_SPI)
#if ANY(SOFTWARE_SPI, FORCE_SOFT_SPI)
// ------------------------
// Software SPI
@@ -0,0 +1,136 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2024 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm / Ryan Power
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#ifdef HAL_STM32
#include "../../../inc/MarlinConfig.h"
#if ALL(HAS_MARLINUI_U8GLIB, FORCE_SOFT_SPI)
#include <U8glib-HAL.h>
#include "../../shared/HAL_SPI.h"
#define nop asm volatile ("\tnop\n")
static inline uint8_t swSpiTransfer_mode_0(uint8_t b) {
for (uint8_t i = 0; i < 8; ++i) {
const uint8_t state = (b & 0x80) ? HIGH : LOW;
WRITE(DOGLCD_SCK, HIGH);
WRITE(DOGLCD_MOSI, state);
b <<= 1;
WRITE(DOGLCD_SCK, LOW);
}
return b;
}
static inline uint8_t swSpiTransfer_mode_3(uint8_t b) {
for (uint8_t i = 0; i < 8; ++i) {
const uint8_t state = (b & 0x80) ? HIGH : LOW;
WRITE(DOGLCD_SCK, LOW);
WRITE(DOGLCD_MOSI, state);
b <<= 1;
WRITE(DOGLCD_SCK, HIGH);
}
return b;
}
static void u8g_sw_spi_shift_out(uint8_t val) {
#if U8G_SPI_USE_MODE_3
swSpiTransfer_mode_3(val);
#else
swSpiTransfer_mode_0(val);
#endif
}
static void swSpiInit() {
#if PIN_EXISTS(LCD_RESET)
SET_OUTPUT(LCD_RESET_PIN);
#endif
SET_OUTPUT(DOGLCD_A0);
OUT_WRITE(DOGLCD_SCK, LOW);
OUT_WRITE(DOGLCD_MOSI, LOW);
OUT_WRITE(DOGLCD_CS, HIGH);
}
uint8_t u8g_com_HAL_STM32_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr) {
switch (msg) {
case U8G_COM_MSG_INIT:
swSpiInit();
break;
case U8G_COM_MSG_STOP:
break;
case U8G_COM_MSG_RESET:
#if PIN_EXISTS(LCD_RESET)
WRITE(LCD_RESET_PIN, arg_val);
#endif
break;
case U8G_COM_MSG_CHIP_SELECT:
#if U8G_SPI_USE_MODE_3 // This LCD SPI is running mode 3 while SD card is running mode 0
if (arg_val) { // SCK idle state needs to be set to the proper idle state before
// the next chip select goes active
WRITE(DOGLCD_SCK, HIGH); // Set SCK to mode 3 idle state before CS goes active
WRITE(DOGLCD_CS, LOW);
nop; // hold SCK high for a few ns
nop;
}
else {
WRITE(DOGLCD_CS, HIGH);
WRITE(DOGLCD_SCK, LOW); // Set SCK to mode 0 idle state after CS goes inactive
}
#else
WRITE(DOGLCD_CS, !arg_val);
#endif
break;
case U8G_COM_MSG_WRITE_BYTE:
u8g_sw_spi_shift_out(arg_val);
break;
case U8G_COM_MSG_WRITE_SEQ: {
uint8_t *ptr = (uint8_t *)arg_ptr;
while (arg_val > 0) {
u8g_sw_spi_shift_out(*ptr++);
arg_val--;
}
} break;
case U8G_COM_MSG_WRITE_SEQ_P: {
uint8_t *ptr = (uint8_t *)arg_ptr;
while (arg_val > 0) {
u8g_sw_spi_shift_out(u8g_pgm_read(ptr));
ptr++;
arg_val--;
}
} break;
case U8G_COM_MSG_ADDRESS: /* define cmd (arg_val = 0) or data mode (arg_val = 1) */
WRITE(DOGLCD_A0, arg_val);
break;
}
return 1;
}
#endif // HAS_MARLINUI_U8GLIB && FORCE_SOFT_SPI
#endif // HAL_STM32
@@ -45,6 +45,7 @@ void setup_endstop_interrupts() {
TERN_(USE_Z4_MAX, _ATTACH(Z4_MAX_PIN));
TERN_(USE_Z4_MIN, _ATTACH(Z4_MIN_PIN));
TERN_(USE_Z_MIN_PROBE, _ATTACH(Z_MIN_PROBE_PIN));
TERN_(USE_CALIBRATION, _ATTACH(CALIBRATION_PIN));
TERN_(USE_I_MAX, _ATTACH(I_MAX_PIN));
TERN_(USE_I_MIN, _ATTACH(I_MIN_PIN));
TERN_(USE_J_MAX, _ATTACH(J_MAX_PIN));
@@ -30,6 +30,3 @@
#undef F_CPU
#define F_CPU BOARD_F_CPU
#endif
// The Sensitive Pins array is not optimizable
#define RUNTIME_ONLY_ANALOG_TO_DIGITAL
+3 -3
View File
@@ -25,8 +25,8 @@
* STM32 LCD-specific defines
*/
uint8_t u8g_com_std_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); // See U8glib-HAL
uint8_t u8g_com_stm32duino_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); // See U8glib-HAL
uint8_t u8g_com_HAL_STM32_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); // u8g_com_stm32duino_swspi.cpp
#define U8G_COM_HAL_SW_SPI_FN u8g_com_HAL_STM32_sw_spi_fn
#define U8G_COM_HAL_SW_SPI_FN u8g_com_std_sw_spi_fn
uint8_t u8g_com_stm32duino_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); // See U8glib-HAL
#define U8G_COM_HAL_HW_SPI_FN u8g_com_stm32duino_hw_spi_fn
+12 -1
View File
@@ -138,11 +138,22 @@
#define LCD_SERIAL MSERIAL(1) // dummy port
static_assert(false, "LCD_SERIAL_PORT must be from 1 to " STRINGIFY(NUM_UARTS) ". You can also use -1 if the board supports Native USB.")
#endif
#if HAS_DGUS_LCD
#if ANY(HAS_DGUS_LCD, EXTENSIBLE_UI)
#define LCD_SERIAL_TX_BUFFER_FREE() LCD_SERIAL.availableForWrite()
#endif
#endif
#ifdef RS485_SERIAL_PORT
#if RS485_SERIAL_PORT == -1
#define RS485_SERIAL UsbSerial
#elif WITHIN(RS485_SERIAL_PORT, 1, NUM_UARTS)
#define RS485_SERIAL MSERIAL(RS485_SERIAL_PORT)
#else
#define RS485_SERIAL MSERIAL(1) // dummy port
static_assert(false, "RS485_SERIAL_PORT must be from 1 to " STRINGIFY(NUM_UARTS) ".")
#endif
#endif
/**
* TODO: review this to return 1 for pins that are not analog input
*/
-56
View File
@@ -1,56 +0,0 @@
from __future__ import print_function
import sys
#dynamic build flags for generic compile options
if __name__ == "__main__":
args = " ".join([ "-std=gnu++14",
"-Os",
"-mcpu=cortex-m3",
"-mthumb",
"-fsigned-char",
"-fno-move-loop-invariants",
"-fno-strict-aliasing",
"-fsingle-precision-constant",
"--specs=nano.specs",
"--specs=nosys.specs",
"-IMarlin/src/HAL/STM32F1",
"-MMD",
"-MP",
"-DTARGET_STM32F1"
])
for i in range(1, len(sys.argv)):
args += " " + sys.argv[i]
print(args)
# extra script for linker options
else:
import pioutil
if pioutil.is_pio_build():
from SCons.Script import DefaultEnvironment
env = DefaultEnvironment()
env.Append(
ARFLAGS=["rcs"],
ASFLAGS=["-x", "assembler-with-cpp"],
CXXFLAGS=[
"-fabi-version=0",
"-fno-use-cxa-atexit",
"-fno-threadsafe-statics"
],
LINKFLAGS=[
"-Os",
"-mcpu=cortex-m3",
"-ffreestanding",
"-mthumb",
"--specs=nano.specs",
"--specs=nosys.specs",
"-u_printf_float",
],
)
@@ -89,7 +89,7 @@ static inline uint8_t swSpiTransfer_mode_3(uint8_t b, const uint8_t spi_speed, c
}
static void u8g_sw_spi_shift_out(uint8_t val) {
#if ENABLED(FYSETC_MINI_12864)
#if U8G_SPI_USE_MODE_3
swSpiTransfer_mode_3(val, SPI_speed);
#else
swSpiTransfer_mode_0(val, SPI_speed);
@@ -123,15 +123,15 @@ uint8_t u8g_com_HAL_STM32F1_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val,
break;
case U8G_COM_MSG_CHIP_SELECT:
#if ENABLED(FYSETC_MINI_12864) // This LCD SPI is running mode 3 while SD card is running mode 0
if (arg_val) { // SCK idle state needs to be set to the proper idle state before
// the next chip select goes active
WRITE(DOGLCD_SCK, HIGH); // Set SCK to mode 3 idle state before CS goes active
#if U8G_SPI_USE_MODE_3 // This LCD SPI is running mode 3 while SD card is running mode 0
if (arg_val) { // SCK idle state needs to be set to the proper idle state before
// the next chip select goes active
WRITE(DOGLCD_SCK, HIGH); // Set SCK to mode 3 idle state before CS goes active
WRITE(DOGLCD_CS, LOW);
}
else {
WRITE(DOGLCD_CS, HIGH);
WRITE(DOGLCD_SCK, LOW); // Set SCK to mode 0 idle state after CS goes inactive
WRITE(DOGLCD_SCK, LOW); // Set SCK to mode 0 idle state after CS goes inactive
}
#else
WRITE(DOGLCD_CS, !arg_val);
@@ -70,6 +70,7 @@ void setup_endstop_interrupts() {
TERN_(USE_Z4_MAX, _ATTACH(Z4_MAX_PIN));
TERN_(USE_Z4_MIN, _ATTACH(Z4_MIN_PIN));
TERN_(USE_Z_MIN_PROBE, _ATTACH(Z_MIN_PROBE_PIN));
TERN_(USE_CALIBRATION, _ATTACH(CALIBRATION_PIN));
TERN_(USE_I_MAX, _ATTACH(I_MAX_PIN));
TERN_(USE_I_MIN, _ATTACH(I_MIN_PIN));
TERN_(USE_J_MAX, _ATTACH(J_MAX_PIN));
+1 -1
View File
@@ -25,7 +25,7 @@
* STM32F1 (Maple) LCD-specific defines
*/
uint8_t u8g_com_HAL_STM32F1_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
uint8_t u8g_com_HAL_STM32F1_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); // u8g_com_stm32duino_swspi.cpp
uint8_t u8g_com_stm32duino_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); // See U8glib-HAL
#define U8G_COM_HAL_SW_SPI_FN u8g_com_HAL_STM32F1_sw_spi_fn
@@ -64,6 +64,7 @@ void setup_endstop_interrupts() {
TERN_(USE_Z4_MAX, _ATTACH(Z4_MAX_PIN));
TERN_(USE_Z4_MIN, _ATTACH(Z4_MIN_PIN));
TERN_(USE_Z_MIN_PROBE, _ATTACH(Z_MIN_PROBE_PIN));
TERN_(USE_CALIBRATION, _ATTACH(CALIBRATION_PIN));
TERN_(USE_I_MAX, _ATTACH(I_MAX_PIN));
TERN_(USE_I_MIN, _ATTACH(I_MIN_PIN));
TERN_(USE_J_MAX, _ATTACH(J_MAX_PIN));
@@ -63,6 +63,7 @@ void setup_endstop_interrupts() {
TERN_(USE_Z4_MAX, _ATTACH(Z4_MAX_PIN));
TERN_(USE_Z4_MIN, _ATTACH(Z4_MIN_PIN));
TERN_(USE_Z_MIN_PROBE, _ATTACH(Z_MIN_PROBE_PIN));
TERN_(USE_CALIBRATION, _ATTACH(CALIBRATION_PIN));
TERN_(USE_I_MAX, _ATTACH(I_MAX_PIN));
TERN_(USE_I_MIN, _ATTACH(I_MIN_PIN));
TERN_(USE_J_MAX, _ATTACH(J_MAX_PIN));
@@ -63,6 +63,7 @@ void setup_endstop_interrupts() {
TERN_(USE_Z4_MAX, _ATTACH(Z4_MAX_PIN));
TERN_(USE_Z4_MIN, _ATTACH(Z4_MIN_PIN));
TERN_(USE_Z_MIN_PROBE, _ATTACH(Z_MIN_PROBE_PIN));
TERN_(USE_CALIBRATION, _ATTACH(CALIBRATION_PIN));
TERN_(USE_I_MAX, _ATTACH(I_MAX_PIN));
TERN_(USE_I_MIN, _ATTACH(I_MIN_PIN));
TERN_(USE_J_MAX, _ATTACH(J_MAX_PIN));
+5 -4
View File
@@ -36,13 +36,13 @@
typedef uint32_t hal_timer_t;
#define HAL_TIMER_TYPE_MAX 0xFFFFFFFE
#define GPT_TIMER_RATE F_BUS_ACTUAL // 150MHz
#define GPT_TIMER_RATE (F_CPU / 4) // 150MHz (Can't use F_BUS_ACTUAL because it's extern volatile)
#define GPT1_TIMER_PRESCALE 2
#define GPT2_TIMER_PRESCALE 10
#define GPT1_TIMER_RATE (GPT_TIMER_RATE / GPT1_TIMER_PRESCALE) // 75MHz
#define GPT2_TIMER_RATE (GPT_TIMER_RATE / GPT2_TIMER_PRESCALE) // 15MHz
#define GPT1_TIMER_RATE (GPT_TIMER_RATE / GPT1_TIMER_PRESCALE) // 150MHz / 2 = 75MHz
#define GPT2_TIMER_RATE (GPT_TIMER_RATE / GPT2_TIMER_PRESCALE) // 150MHz / 10 = 15MHz
#ifndef MF_TIMER_STEP
#define MF_TIMER_STEP 0 // Timer Index for Stepper
@@ -57,7 +57,8 @@ typedef uint32_t hal_timer_t;
#define TEMP_TIMER_RATE 1000000
#define TEMP_TIMER_FREQUENCY 1000
#define STEPPER_TIMER_RATE GPT1_TIMER_RATE
#define HAL_TIMER_RATE GPT1_TIMER_RATE
#define STEPPER_TIMER_RATE HAL_TIMER_RATE
#define STEPPER_TIMER_TICKS_PER_US ((STEPPER_TIMER_RATE) / 1000000)
#define STEPPER_TIMER_PRESCALE ((GPT_TIMER_RATE / 1000000) / STEPPER_TIMER_TICKS_PER_US)
+29 -27
View File
@@ -261,9 +261,13 @@
#include "tests/marlin_tests.h"
#endif
#if HAS_RS485_SERIAL
#include "feature/rs485.h"
#endif
PGMSTR(M112_KILL_STR, "M112 Shutdown");
MarlinState marlin_state = MF_INITIALIZING;
MarlinState marlin_state = MarlinState::MF_INITIALIZING;
// For M109 and M190, this flag may be cleared (by M108) to exit the wait loop
bool wait_for_heatup = false;
@@ -308,23 +312,12 @@ bool wait_for_heatup = false;
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wnarrowing"
#ifndef RUNTIME_ONLY_ANALOG_TO_DIGITAL
template <pin_t ...D>
constexpr pin_t OnlyPins<_SP_END, D...>::table[sizeof...(D)];
#endif
bool pin_is_protected(const pin_t pin) {
#ifdef RUNTIME_ONLY_ANALOG_TO_DIGITAL
static const pin_t sensitive_pins[] PROGMEM = { SENSITIVE_PINS };
const size_t pincount = COUNT(sensitive_pins);
#else
static constexpr size_t pincount = OnlyPins<SENSITIVE_PINS>::size;
static const pin_t (&sensitive_pins)[pincount] PROGMEM = OnlyPins<SENSITIVE_PINS>::table;
#endif
for (uint8_t i = 0; i < pincount; ++i) {
const pin_t * const pptr = &sensitive_pins[i];
if (pin == (sizeof(pin_t) == 2 ? (pin_t)pgm_read_word(pptr) : (pin_t)pgm_read_byte(pptr))) return true;
}
#define pgm_read_pin(P) (sizeof(pin_t) == 2 ? (pin_t)pgm_read_word(P) : (pin_t)pgm_read_byte(P))
for (uint8_t i = 0; i < COUNT(sensitive_dio); ++i)
if (pin == pgm_read_pin(&sensitive_dio[i])) return true;
for (uint8_t i = 0; i < COUNT(sensitive_aio); ++i)
if (pin == analogInputToDigitalPin(pgm_read_pin(&sensitive_dio[i]))) return true;
return false;
}
@@ -388,8 +381,8 @@ void startOrResumeJob() {
}
inline void finishSDPrinting() {
if (queue.enqueue_one(F("M1001"))) { // Keep trying until it gets queued
marlin_state = MF_RUNNING; // Signal to stop trying
if (queue.enqueue_one(F("M1001"))) { // Keep trying until it gets queued
marlin_state = MarlinState::MF_RUNNING; // Signal to stop trying
TERN_(PASSWORD_AFTER_SD_PRINT_END, password.lock_machine());
TERN_(DGUS_LCD_UI_MKS, screen.sdPrintingFinished());
}
@@ -784,7 +777,7 @@ void idle(const bool no_stepper_sleep/*=false*/) {
TERN_(MAX7219_DEBUG, max7219.idle_tasks());
// Return if setup() isn't completed
if (marlin_state == MF_INITIALIZING) goto IDLE_DONE;
if (marlin_state == MarlinState::MF_INITIALIZING) goto IDLE_DONE;
// TODO: Still causing errors
TERN_(TOOL_SENSOR, (void)check_tool_sensor_stats(active_extruder, true));
@@ -970,7 +963,7 @@ void stop() {
SERIAL_ERROR_MSG(STR_ERR_STOPPED);
LCD_MESSAGE(MSG_STOPPED);
safe_delay(350); // allow enough time for messages to get out before stopping
marlin_state = MF_STOPPED;
marlin_state = MarlinState::MF_STOPPED;
}
}
@@ -1284,7 +1277,7 @@ void setup() {
// Identify myself as Marlin x.x.x
SERIAL_ECHOLNPGM("Marlin " SHORT_BUILD_VERSION);
#if defined(STRING_DISTRIBUTION_DATE) && defined(STRING_CONFIG_H_AUTHOR)
#ifdef STRING_DISTRIBUTION_DATE
SERIAL_ECHO_MSG(
" Last Updated: " STRING_DISTRIBUTION_DATE
" | Author: " STRING_CONFIG_H_AUTHOR
@@ -1330,18 +1323,23 @@ void setup() {
#endif
#endif
#if ALL(HAS_MEDIA, SDCARD_EEPROM_EMULATION)
#if HAS_MEDIA && ANY(SDCARD_EEPROM_EMULATION, POWER_LOSS_RECOVERY)
SETUP_RUN(card.mount()); // Mount media with settings before first_load
#endif
SETUP_RUN(settings.first_load()); // Load data from EEPROM if available (or use defaults)
// This also updates variables in the planner, elsewhere
// Prepare some LCDs to display early
#if HAS_EARLY_LCD_SETTINGS
SETUP_RUN(settings.load_lcd_state());
#endif
#if ALL(HAS_WIRED_LCD, SHOW_BOOTSCREEN)
SETUP_RUN(ui.show_bootscreen());
const millis_t bootscreen_ms = millis();
#endif
SETUP_RUN(settings.first_load()); // Load data from EEPROM if available (or use defaults)
// This also updates variables in the planner, elsewhere
#if ENABLED(PROBE_TARE)
SETUP_RUN(probe.tare_init());
#endif
@@ -1648,11 +1646,15 @@ void setup() {
SETUP_RUN(bdl.init(I2C_BD_SDA_PIN, I2C_BD_SCL_PIN, I2C_BD_DELAY));
#endif
#if HAS_RS485_SERIAL
SETUP_RUN(rs485_init());
#endif
#if ENABLED(FT_MOTION)
SETUP_RUN(ftMotion.init());
#endif
marlin_state = MF_RUNNING;
marlin_state = MarlinState::MF_RUNNING;
#ifdef STARTUP_TUNE
// Play a short startup tune before continuing.
@@ -1684,7 +1686,7 @@ void loop() {
#if HAS_MEDIA
if (card.flag.abort_sd_printing) abortSDPrinting();
if (marlin_state == MF_SD_COMPLETE) finishSDPrinting();
if (marlin_state == MarlinState::MF_SD_COMPLETE) finishSDPrinting();
#endif
queue.advance();
+3 -3
View File
@@ -42,7 +42,7 @@ void kill(FSTR_P const lcd_error=nullptr, FSTR_P const lcd_component=nullptr, co
void minkill(const bool steppers_off=false);
// Global State of the firmware
enum MarlinState : uint8_t {
enum class MarlinState : uint8_t {
MF_INITIALIZING = 0,
MF_STOPPED,
MF_KILLED,
@@ -53,8 +53,8 @@ enum MarlinState : uint8_t {
};
extern MarlinState marlin_state;
inline bool IsRunning() { return marlin_state >= MF_RUNNING; }
inline bool IsStopped() { return marlin_state == MF_STOPPED; }
inline bool IsRunning() { return marlin_state >= MarlinState::MF_RUNNING; }
inline bool IsStopped() { return marlin_state == MarlinState::MF_STOPPED; }
bool printingIsActive();
bool printJobOngoing();
+2 -1
View File
@@ -103,7 +103,8 @@
#define HAS_TRINAMIC HAS_TRINAMIC_CONFIG
#if ( HAS_DRIVER(TMC2130_STANDALONE) || HAS_DRIVER(TMC2160_STANDALONE) \
#if ( HAS_DRIVER(TMC2100) \
|| HAS_DRIVER(TMC2130_STANDALONE) || HAS_DRIVER(TMC2160_STANDALONE) \
|| HAS_DRIVER(TMC2208_STANDALONE) || HAS_DRIVER(TMC2209_STANDALONE) \
|| HAS_DRIVER(TMC2660_STANDALONE) || HAS_DRIVER(TMC5130_STANDALONE) \
|| HAS_DRIVER(TMC5160_STANDALONE) )
+2
View File
@@ -355,6 +355,8 @@
#define STR_PROBE_EN "probe_en"
#define STR_FILAMENT "filament"
#define STR_CALIBRATION "calibration"
// General axis names
#define STR_X "X"
#define STR_Y "Y"
+3 -6
View File
@@ -55,9 +55,6 @@
#define CYCLES_PER_MICROSECOND (F_CPU / 1000000UL) // 16 or 20 on AVR
#endif
// Nanoseconds per cycle
#define NANOSECONDS_PER_CYCLE (1000000000.0 / F_CPU)
// Macros to make a string from a macro
#define STRINGIFY_(M) #M
#define STRINGIFY(M) STRINGIFY_(M)
@@ -197,8 +194,8 @@
#define ENABLED(V...) DO(ENA,&&,V)
#define DISABLED(V...) DO(DIS,&&,V)
#define ANY(V...) !DISABLED(V)
#define ALL ENABLED
#define NONE DISABLED
#define ALL(V...) ENABLED(V)
#define NONE(V...) DISABLED(V)
#define COUNT_ENABLED(V...) DO(ENA,+,V)
#define MANY(V...) (COUNT_ENABLED(V) > 1)
@@ -630,7 +627,7 @@
#define DEFER4(M) M EMPTY EMPTY EMPTY EMPTY()()()()
// Force define expansion
#define EVAL EVAL16
#define EVAL(V...) EVAL16(V)
#define EVAL4096(V...) EVAL2048(EVAL2048(V))
#define EVAL2048(V...) EVAL1024(EVAL1024(V))
#define EVAL1024(V...) EVAL512(EVAL512(V))
+5 -4
View File
@@ -171,13 +171,14 @@ int32_t Backlash::get_applied_steps(const AxisEnum axis) {
const int32_t residual_error_axis = residual_error[axis];
// At startup it is assumed the last move was forward.
// So the applied steps will always be negative.
// At startup, when no steps are applied, it is assumed the last move was backwards.
// So the applied steps will always be zero (when moving backwards) or a positive
// number (when moving forwards).
if (forward) return -residual_error_axis;
if (!forward) return -residual_error_axis;
const float f_corr = float(correction) / all_on;
const int32_t full_error_axis = -f_corr * distance_mm[axis] * planner.settings.axis_steps_per_mm[axis];
const int32_t full_error_axis = f_corr * distance_mm[axis] * planner.settings.axis_steps_per_mm[axis];
return full_error_axis - residual_error_axis;
}
+1 -1
View File
@@ -141,7 +141,7 @@ void MarlinEthernet::check() {
case CONNECTING:
telnetClient.println("Marlin " SHORT_BUILD_VERSION);
#if defined(STRING_DISTRIBUTION_DATE) && defined(STRING_CONFIG_H_AUTHOR)
#ifdef STRING_DISTRIBUTION_DATE
telnetClient.println(
" Last Updated: " STRING_DISTRIBUTION_DATE
" | Author: " STRING_CONFIG_H_AUTHOR
+1 -1
View File
@@ -197,7 +197,7 @@ void HostUI::action(FSTR_P const fstr, const bool eol) {
#endif
#if HAS_FILAMENT_SENSOR
if (runout.filament_ran_out) { // Disable a triggered sensor
runout.enabled = false;
runout.enabled[active_extruder] = false;
runout.reset();
}
#endif
+1 -1
View File
@@ -239,7 +239,7 @@ void LEDLights::set_color(const LEDColor &incol
void LEDLights::toggle() { if (lights_on) set_off(); else update(); }
#endif
#if LED_POWEROFF_TIMEOUT > 0
#if HAS_LED_POWEROFF_TIMEOUT
millis_t LEDLights::led_off_time; // = 0
+2 -2
View File
@@ -164,11 +164,11 @@ public:
#if ENABLED(LED_CONTROL_MENU)
static void toggle(); // swap "off" with color
#endif
#if ANY(LED_CONTROL_MENU, CASE_LIGHT_USE_RGB_LED) || LED_POWEROFF_TIMEOUT > 0
#if ANY(LED_CONTROL_MENU, CASE_LIGHT_USE_RGB_LED, HAS_LED_POWEROFF_TIMEOUT)
static void update() { set_color(color); }
#endif
#if LED_POWEROFF_TIMEOUT > 0
#if HAS_LED_POWEROFF_TIMEOUT
private:
static millis_t led_off_time;
public:
+1 -1
View File
@@ -135,7 +135,7 @@ void MMU2::reset() {
int8_t MMU2::get_current_tool() { return extruder == MMU2_NO_TOOL ? -1 : extruder; }
#if ANY(HAS_PRUSA_MMU2S, MMU_EXTRUDER_SENSOR)
#define FILAMENT_PRESENT() (READ(FIL_RUNOUT1_PIN) != FIL_RUNOUT1_STATE)
#define FILAMENT_PRESENT() (READ(FIL_RUNOUT1_PIN) != runout.out_state())
#else
#define FILAMENT_PRESENT() true
#endif
+13 -4
View File
@@ -214,12 +214,21 @@ bool load_filament(const_float_t slow_load_length/*=0*/, const_float_t fast_load
impatient_beep(max_beep_count);
#if ALL(FILAMENT_CHANGE_RESUME_ON_INSERT, FILAMENT_RUNOUT_SENSOR)
#if MULTI_FILAMENT_SENSOR
#define _CASE_INSERTED(N) case N-1: if (READ(FIL_RUNOUT##N##_PIN) != FIL_RUNOUT##N##_STATE) wait_for_user = false; break;
switch (active_extruder) {
REPEAT_1(NUM_RUNOUT_SENSORS, _CASE_INSERTED)
LOOP_S_LE_N(i, 1, NUM_RUNOUT_SENSORS) {
pin_t pin;
switch (i) {
default: continue;
#define _CASE_RUNOUT(N) case N: pin = FIL_RUNOUT##N##_PIN; break;
REPEAT_1(NUM_RUNOUT_SENSORS, _CASE_RUNOUT)
#undef _CASE_RUNOUT
}
const RunoutMode rm = runout.mode[i - 1];
if (rm != RM_NONE && rm != RM_MOTION_SENSOR && extDigitalRead(pin) != runout.out_state(i - 1))
wait_for_user = false;
}
#else
if (READ(FIL_RUNOUT_PIN) != FIL_RUNOUT_STATE) wait_for_user = false;
if (READ(FIL_RUNOUT_PIN) != runout.out_state(active_extruder))
wait_for_user = false;
#endif
#endif
idle_no_sleep();
+1 -1
View File
@@ -201,7 +201,7 @@ void Power::power_off() {
/**
* Check all conditions that would signal power needing to be on.
*
* @returns bool if power is needed
* @return bool if power is needed
*/
bool Power::is_power_needed() {
+15 -4
View File
@@ -205,6 +205,9 @@ void PrintJobRecovery::save(const bool force/*=false*/, const float zraise/*=POW
// info.sdpos and info.current_position are pre-filled from the Stepper ISR
info.feedrate = uint16_t(MMS_TO_MMM(feedrate_mm_s));
info.feedrate_percentage = feedrate_percentage;
COPY(info.flow_percentage, planner.flow_percentage);
info.zraise = zraise;
info.flag.raised = raised; // Was Z raised before power-off?
@@ -216,7 +219,7 @@ void PrintJobRecovery::save(const bool force/*=false*/, const float zraise/*=POW
#if DISABLED(NO_VOLUMETRICS)
info.flag.volumetric_enabled = parser.volumetric_enabled;
#if HAS_MULTI_EXTRUDER
EXTRUDER_LOOP() info.filament_size[e] = planner.filament_size[e];
COPY(info.filament_size, planner.filament_size);
#else
if (parser.volumetric_enabled) info.filament_size[0] = planner.filament_size[active_extruder];
#endif
@@ -269,7 +272,10 @@ void PrintJobRecovery::save(const bool force/*=false*/, const float zraise/*=POW
#if POWER_LOSS_RETRACT_LEN
// Retract filament now
gcode.process_subcommands_now(F("G1 F3000 E-" STRINGIFY(POWER_LOSS_RETRACT_LEN)));
const uint16_t old_flow = planner.flow_percentage[active_extruder];
planner.set_flow(active_extruder, 100);
gcode.process_subcommands_now(F("G1F3000E-" STRINGIFY(POWER_LOSS_RETRACT_LEN)));
planner.set_flow(active_extruder, old_flow);
#endif
#if POWER_LOSS_ZRAISE
@@ -555,8 +561,12 @@ void PrintJobRecovery::resume() {
// Move back down to the saved Z for printing
PROCESS_SUBCOMMANDS_NOW(TS(F("G1F600Z"), p_float_t(z_print, 3)));
// Restore the feedrate
// Restore the feedrate and percentage
PROCESS_SUBCOMMANDS_NOW(TS(F("G1F"), info.feedrate));
feedrate_percentage = info.feedrate_percentage;
// Flowrate percentage
EXTRUDER_LOOP() planner.set_flow(e, info.flow_percentage[e]);
// Restore E position with G92.9
PROCESS_SUBCOMMANDS_NOW(TS(F("G92.9E"), p_float_t(resume_pos.e, 3)));
@@ -589,7 +599,8 @@ void PrintJobRecovery::resume() {
}
DEBUG_EOL();
DEBUG_ECHOLNPGM("feedrate: ", info.feedrate);
DEBUG_ECHOLN(F("feedrate: "), info.feedrate, F(" x "), info.feedrate_percentage, '%');
EXTRUDER_LOOP() DEBUG_ECHOLN('E', e + 1, F(" flow %: "), info.flow_percentage[e]);
DEBUG_ECHOLNPGM("zraise: ", info.zraise, " ", info.flag.raised ? "(before)" : "");
+2
View File
@@ -59,6 +59,8 @@ typedef struct {
// Machine state
xyze_pos_t current_position;
uint16_t feedrate;
int16_t feedrate_percentage;
uint16_t flow_percentage[EXTRUDERS];
float zraise;
+39
View File
@@ -0,0 +1,39 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2024 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#include "../inc/MarlinConfig.h"
#if HAS_RS485_SERIAL
#include "rs485.h"
HardwareSerialBusIO rs485BusIO(&RS485_SERIAL);
RS485Bus<RS485_BUS_BUFFER_SIZE> rs485Bus(rs485BusIO, RS485_RX_ENABLE_PIN, RS485_TX_ENABLE_PIN);
PhotonProtocol rs485Protocol;
Packetizer rs485Packetizer(rs485Bus, rs485Protocol);
uint8_t rs485Buffer[RS485_SEND_BUFFER_SIZE];
void rs485_init() { RS485_SERIAL.begin(57600); }
#endif // HAS_RS485_SERIAL
+40
View File
@@ -0,0 +1,40 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2024 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#pragma once
#include "../inc/MarlinConfigPre.h"
#include <rs485/rs485bus.hpp>
#include <rs485/bus_adapters/hardware_serial.h>
#include <rs485/protocols/photon.h>
#include <rs485/packetizer.h>
#define RS485_SEND_BUFFER_SIZE 32
extern HardwareSerialBusIO rs485BusIO;
extern RS485Bus<RS485_BUS_BUFFER_SIZE> rs485Bus;
extern PhotonProtocol rs485Protocol;
extern Packetizer rs485Packetizer;
extern uint8_t rs485Buffer[RS485_SEND_BUFFER_SIZE];
void rs485_init();
+7 -12
View File
@@ -32,9 +32,9 @@
FilamentMonitor runout;
bool FilamentMonitorBase::enabled = true,
FilamentMonitorBase::filament_ran_out; // = false
bool FilamentMonitorBase::enabled[NUM_RUNOUT_SENSORS], // Initialized by settings.load
FilamentMonitorBase::filament_ran_out; // = false
RunoutMode FilamentMonitorBase::mode[NUM_RUNOUT_SENSORS]; // Initialized by settings.load
#if ENABLED(HOST_ACTION_COMMANDS)
bool FilamentMonitorBase::host_handling; // = false
#endif
@@ -45,15 +45,10 @@ bool FilamentMonitorBase::enabled = true,
#include "../core/debug_out.h"
#endif
#if HAS_FILAMENT_RUNOUT_DISTANCE
float RunoutResponseDelayed::runout_distance_mm = FILAMENT_RUNOUT_DISTANCE_MM;
countdown_t RunoutResponseDelayed::mm_countdown;
#if ENABLED(FILAMENT_MOTION_SENSOR)
uint8_t FilamentSensorEncoder::motion_detected;
#endif
#else
int8_t RunoutResponseDebounced::runout_count[NUM_RUNOUT_SENSORS]; // = 0
#endif
float RunoutResponseDelayed::runout_distance_mm[NUM_RUNOUT_SENSORS]; // Initialized by settings.load
countdown_t RunoutResponseDelayed::mm_countdown;
uint8_t FilamentSensorCore::motion_detected;
int8_t RunoutResponseDelayed::runout_count[NUM_RUNOUT_SENSORS]; // = 0
//
// Filament Runout event handler
+65 -189
View File
@@ -40,16 +40,6 @@
#endif
//#define FILAMENT_RUNOUT_SENSOR_DEBUG
#ifndef FILAMENT_RUNOUT_THRESHOLD
#define FILAMENT_RUNOUT_THRESHOLD 5
#endif
#if ENABLED(FILAMENT_MOTION_SENSOR)
#define HAS_FILAMENT_MOTION 1
#endif
#if DISABLED(FILAMENT_MOTION_SENSOR) || ENABLED(FILAMENT_SWITCH_AND_MOTION)
#define HAS_FILAMENT_SWITCH 1
#endif
typedef Flags<
#if NUM_MOTION_SENSORS > NUM_RUNOUT_SENSORS
@@ -62,73 +52,65 @@ typedef Flags<
void event_filament_runout(const uint8_t extruder);
inline bool should_monitor_runout() { return did_pause_print || printingIsActive(); }
template<class RESPONSE_T, class SENSOR_T>
class TFilamentMonitor;
class FilamentSensor;
class RunoutResponseDelayed;
class RunoutResponseDebounced;
/********************************* TEMPLATE SPECIALIZATION *********************************/
typedef TFilamentMonitor<
TERN(HAS_FILAMENT_RUNOUT_DISTANCE, RunoutResponseDelayed, RunoutResponseDebounced),
FilamentSensor
> FilamentMonitor;
extern FilamentMonitor runout;
/*******************************************************************************************/
class FilamentMonitorBase {
enum RunoutMode : uint8_t {
RM_NONE,
RM_OUT_ON_LOW,
RM_OUT_ON_HIGH,
RM_RESERVED3,
RM_RESERVED4,
RM_RESERVED5,
RM_RESERVED6,
RM_MOTION_SENSOR
};
class FilamentSensor {
public:
static bool enabled, filament_ran_out;
static bool enabled[NUM_RUNOUT_SENSORS], filament_ran_out;
static RunoutMode mode[NUM_RUNOUT_SENSORS];
static uint8_t out_state(const uint8_t e=0) { return mode[e] == RM_OUT_ON_HIGH ? HIGH : LOW; }
#if ENABLED(HOST_ACTION_COMMANDS)
static bool host_handling;
#else
static constexpr bool host_handling = false;
#endif
};
template<class RESPONSE_T, class SENSOR_T>
class TFilamentMonitor : public FilamentMonitorBase {
private:
typedef RESPONSE_T response_t;
typedef SENSOR_T sensor_t;
static response_t response;
static sensor_t sensor;
public:
static void setup() {
sensor.setup();
#define _INIT_RUNOUT_PIN(P,S,U,D) do{ if (ENABLED(U)) SET_INPUT_PULLUP(P); else if (ENABLED(D)) SET_INPUT_PULLDOWN(P); else SET_INPUT(P); }while(0);
#define INIT_RUNOUT_PIN(N) _INIT_RUNOUT_PIN(FIL_RUNOUT##N##_PIN, FIL_RUNOUT##N##_STATE, FIL_RUNOUT##N##_PULLUP, FIL_RUNOUT##N##_PULLDOWN);
REPEAT_1(NUM_RUNOUT_SENSORS, INIT_RUNOUT_PIN)
#undef INIT_RUNOUT_PIN
#if ENABLED(FILAMENT_SWITCH_AND_MOTION)
#define INIT_MOTION_PIN(N) _INIT_RUNOUT_PIN(FIL_MOTION##N##_PIN, FIL_MOTION##N##_STATE, FIL_MOTION##N##_PULLUP, FIL_MOTION##N##_PULLDOWN);
REPEAT_1(NUM_MOTION_SENSORS, INIT_MOTION_PIN)
#undef INIT_MOTION_PIN
#endif
#undef _INIT_RUNOUT_PIN
reset();
}
static void reset() {
filament_ran_out = false;
response.reset();
for (uint8_t i = 0; i < NUM_RUNOUT_SENSORS; ++i) filament_present(i);
#if ENABLED(FILAMENT_SWITCH_AND_MOTION)
for (uint8_t i = 0; i < NUM_MOTION_SENSORS; ++i) filament_motion_present(i);
#endif
}
// Call this method when filament is present,
// so the response can reset its counter.
static void filament_present(const uint8_t extruder) {
response.filament_present(extruder);
}
#if ENABLED(FILAMENT_SWITCH_AND_MOTION)
static void filament_motion_present(const uint8_t extruder) {
response.filament_motion_present(extruder);
}
#endif
#if HAS_FILAMENT_RUNOUT_DISTANCE
static float& runout_distance() { return response.runout_distance_mm; }
static void set_runout_distance(const_float_t mm) { response.runout_distance_mm = mm; }
#endif
static void filament_present(const uint8_t e) { filament_present(e); }
static float& runout_distance(const uint8_t e=0) { return runout_distance_mm[e]; }
static void set_runout_distance(const_float_t mm, const uint8_t e=0) { runout_distance_mm[e] = mm; }
// Handle a block completion. RunoutResponseDelayed uses this to
// add up the length of filament moved while the filament is out.
static void block_completed(const block_t * const b) {
if (enabled) {
if (enabled[active_extruder]) {
response.block_completed(b);
sensor.block_completed(b);
}
@@ -137,11 +119,11 @@ class TFilamentMonitor : public FilamentMonitorBase {
// Give the response a chance to update its counter.
static void run() {
if (enabled && !filament_ran_out && should_monitor_runout()) {
TERN_(HAS_FILAMENT_RUNOUT_DISTANCE, cli()); // Prevent RunoutResponseDelayed::block_completed from accumulating here
cli(); // Prevent RunoutResponseDelayed::block_completed from accumulating here
response.run();
sensor.run();
const runout_flags_t runout_flags = response.has_run_out();
TERN_(HAS_FILAMENT_RUNOUT_DISTANCE, sei());
sei();
#if MULTI_FILAMENT_SENSOR
#if ENABLED(WATCH_ALL_RUNOUT_SENSORS)
const bool ran_out = bool(runout_flags); // any sensor triggers
@@ -169,11 +151,7 @@ class TFilamentMonitor : public FilamentMonitorBase {
}
}
}
};
/*************************** FILAMENT PRESENCE SENSORS ***************************/
class FilamentSensorBase {
protected:
/**
* Called by FilamentSensorSwitch::run when filament is detected.
@@ -182,26 +160,8 @@ class FilamentSensorBase {
static void filament_present(const uint8_t extruder) {
runout.filament_present(extruder); // ...which calls response.filament_present(extruder)
}
#if ENABLED(FILAMENT_SWITCH_AND_MOTION)
static void filament_motion_present(const uint8_t extruder) {
runout.filament_motion_present(extruder); // ...which calls response.filament_motion_present(extruder)
}
#endif
public:
static void setup() {
#define _INIT_RUNOUT_PIN(P,S,U,D) do{ if (ENABLED(U)) SET_INPUT_PULLUP(P); else if (ENABLED(D)) SET_INPUT_PULLDOWN(P); else SET_INPUT(P); }while(0);
#define INIT_RUNOUT_PIN(N) _INIT_RUNOUT_PIN(FIL_RUNOUT##N##_PIN, FIL_RUNOUT##N##_STATE, FIL_RUNOUT##N##_PULLUP, FIL_RUNOUT##N##_PULLDOWN);
REPEAT_1(NUM_RUNOUT_SENSORS, INIT_RUNOUT_PIN)
#undef INIT_RUNOUT_PIN
#if ENABLED(FILAMENT_SWITCH_AND_MOTION)
#define INIT_MOTION_PIN(N) _INIT_RUNOUT_PIN(FIL_MOTION##N##_PIN, FIL_MOTION##N##_STATE, FIL_MOTION##N##_PULLUP, FIL_MOTION##N##_PULLDOWN);
REPEAT_1(NUM_MOTION_SENSORS, INIT_MOTION_PIN)
#undef INIT_MOTION_PIN
#endif
#undef _INIT_RUNOUT_PIN
}
// Return a bitmask of runout pin states
static uint8_t poll_runout_pins() {
@@ -212,12 +172,11 @@ class FilamentSensorBase {
// Return a bitmask of runout flag states (1 bits always indicates runout)
static uint8_t poll_runout_states() {
#define _INVERT_BIT(N) | (FIL_RUNOUT##N##_STATE ? 0 : _BV(N - 1))
#define _INVERT_BIT(N) | (runout.out_state(N-1) ? 0 : _BV(N-1))
return poll_runout_pins() ^ uint8_t(0 REPEAT_1(NUM_RUNOUT_SENSORS, _INVERT_BIT));
#undef _INVERT_BIT
}
#if ENABLED(FILAMENT_SWITCH_AND_MOTION)
// Return a bitmask of motion pin states
static uint8_t poll_motion_pins() {
#define _OR_MOTION(N) | (READ(FIL_MOTION##N##_PIN) ? _BV((N) - 1) : 0)
@@ -231,20 +190,23 @@ class FilamentSensorBase {
return poll_motion_pins() ^ uint8_t(0 REPEAT_1(NUM_MOTION_SENSORS, _OR_MOTION));
#undef _OR_MOTION
}
#endif
};
#if HAS_FILAMENT_MOTION
class FilamentSensorCore : public FilamentSensorBase {
private:
static uint8_t motion_detected;
/**
* This sensor uses a magnetic encoder disc and a Hall effect
* sensor (or a slotted disc and optical sensor). The state
* will toggle between 0 and 1 on filament movement. It can detect
* filament runout and stripouts or jams.
*/
class FilamentSensorEncoder : public FilamentSensorBase {
private:
static uint8_t motion_detected;
static bool poll_runout_state(const uint8_t extruder) {
const uint8_t runout_states = poll_runout_states();
#if MULTI_FILAMENT_SENSOR
if ( !TERN0(DUAL_X_CARRIAGE, idex_is_duplicating())
&& !TERN0(MULTI_NOZZLE_DUPLICATION, extruder_duplication_enabled)
) return TEST(runout_states, extruder); // A specific extruder ran out
#else
UNUSED(extruder);
#endif
return !!runout_states; // Any extruder ran out
}
static void poll_motion_sensor() {
static uint8_t old_state;
@@ -275,36 +237,12 @@ class FilamentSensorBase {
motion_detected = 0;
}
static void run() { poll_motion_sensor(); }
};
#endif // HAS_FILAMENT_MOTION
#if HAS_FILAMENT_SWITCH
/**
* This is a simple endstop switch in the path of the filament.
* It can detect filament runout, but not stripouts or jams.
*/
class FilamentSensorSwitch : public FilamentSensorBase {
private:
static bool poll_runout_state(const uint8_t extruder) {
const uint8_t runout_states = poll_runout_states();
#if MULTI_FILAMENT_SENSOR
if ( !TERN0(DUAL_X_CARRIAGE, idex_is_duplicating())
&& !TERN0(MULTI_NOZZLE_DUPLICATION, extruder_duplication_enabled)
) return TEST(runout_states, extruder); // A specific extruder ran out
#else
UNUSED(extruder);
#endif
return !!runout_states; // Any extruder ran out
static void run() {
if (mode[active_extruder] == RM_MOTION_SENSOR) {
poll_motion_sensor();
}
public:
static void block_completed(const block_t * const) {}
static void run() {
for (uint8_t s = 0; s < NUM_RUNOUT_SENSORS; ++s) {
else if (mode[active_extruder] != RM_NONE) {
for(uint8_t s = 0; s < NUM_RUNOUT_SENSORS; ++s) {
const bool out = poll_runout_state(s);
if (!out) filament_present(s);
#if ENABLED(FILAMENT_RUNOUT_SENSOR_DEBUG)
@@ -316,36 +254,13 @@ class FilamentSensorBase {
#endif
}
}
};
}
};
#endif // HAS_FILAMENT_SWITCH
/**
* This is a simple endstop switch in the path of the filament.
* It can detect filament runout, but not stripouts or jams.
*/
class FilamentSensor : public FilamentSensorBase {
private:
TERN_(HAS_FILAMENT_MOTION, static FilamentSensorEncoder encoder_sensor);
TERN_(HAS_FILAMENT_SWITCH, static FilamentSensorSwitch switch_sensor);
public:
static void block_completed(const block_t * const b) {
TERN_(HAS_FILAMENT_MOTION, encoder_sensor.block_completed(b));
TERN_(HAS_FILAMENT_SWITCH, switch_sensor.block_completed(b));
}
static void run() {
TERN_(HAS_FILAMENT_MOTION, encoder_sensor.run());
TERN_(HAS_FILAMENT_SWITCH, switch_sensor.run());
}
};
/********************************* RESPONSE TYPE *********************************/
#if HAS_FILAMENT_RUNOUT_DISTANCE
typedef struct {
typedef struct {
float runout[NUM_RUNOUT_SENSORS];
Flags<NUM_RUNOUT_SENSORS> runout_reset; // Reset runout later
#if ENABLED(FILAMENT_SWITCH_AND_MOTION)
@@ -361,15 +276,9 @@ class FilamentSensorBase {
private:
static countdown_t mm_countdown;
public:
static float runout_distance_mm;
static void reset() {
for (uint8_t i = 0; i < NUM_RUNOUT_SENSORS; ++i) filament_present(i);
#if ENABLED(FILAMENT_SWITCH_AND_MOTION)
for (uint8_t i = 0; i < NUM_MOTION_SENSORS; ++i) filament_motion_present(i);
#endif
}
public:
static float runout_distance_mm[NUM_RUNOUT_SENSORS];
static int8_t runout_count[NUM_RUNOUT_SENSORS];
static void run() {
#if ENABLED(FILAMENT_RUNOUT_SENSOR_DEBUG)
@@ -398,11 +307,11 @@ class FilamentSensorBase {
}
static void filament_present(const uint8_t extruder) {
if (mm_countdown.runout[extruder] < runout_distance_mm || did_pause_print) {
if (mm_countdown.runout[extruder] < runout_distance_mm[extruder] || did_pause_print) {
// Reset runout only if it is smaller than runout_distance or printing is paused.
// On Bowden systems retract may be larger than runout_distance_mm, so if retract
// was added leave it in place, or the following unretract will cause runout event.
mm_countdown.runout[extruder] = runout_distance_mm;
mm_countdown.runout[extruder] = runout_distance_mm[extruder];
mm_countdown.runout_reset.clear(extruder);
}
else {
@@ -451,36 +360,3 @@ class FilamentSensorBase {
}
};
#else // !HAS_FILAMENT_RUNOUT_DISTANCE
// RunoutResponseDebounced triggers a runout event after a runout
// condition has been detected runout_threshold times in a row.
class RunoutResponseDebounced {
private:
static constexpr int8_t runout_threshold = FILAMENT_RUNOUT_THRESHOLD;
static int8_t runout_count[NUM_RUNOUT_SENSORS];
public:
static void reset() {
for (uint8_t i = 0; i < NUM_RUNOUT_SENSORS; ++i) filament_present(i);
}
static void run() {
for (uint8_t i = 0; i < NUM_RUNOUT_SENSORS; ++i) if (runout_count[i] >= 0) runout_count[i]--;
}
static runout_flags_t has_run_out() {
runout_flags_t runout_flags{0};
for (uint8_t i = 0; i < NUM_RUNOUT_SENSORS; ++i) if (runout_count[i] < 0) runout_flags.set(i);
return runout_flags;
}
static void block_completed(const block_t * const) { }
static void filament_present(const uint8_t extruder) {
runout_count[extruder] = runout_threshold;
}
};
#endif // !HAS_FILAMENT_RUNOUT_DISTANCE
+1 -1
View File
@@ -634,7 +634,7 @@ void GcodeSuite::G33() {
}
SERIAL_EOL();
MString<20> msg(F("Calibration sd:"));
MString<21> msg(F("Calibration sd:"));
if (zero_std_dev_min < 1)
msg.appendf(F("0.%03i"), (int)LROUND(zero_std_dev_min * 1000.0f));
else
+8 -22
View File
@@ -181,20 +181,6 @@ inline void park_above_object(measurements_t &m, const float uncertainty) {
#endif
#if !PIN_EXISTS(CALIBRATION)
#include "../../module/probe.h"
#endif
inline bool read_calibration_pin() {
return (
#if PIN_EXISTS(CALIBRATION)
READ(CALIBRATION_PIN) != CALIBRATION_PIN_INVERTING
#else
PROBE_TRIGGERED()
#endif
);
}
/**
* Move along axis in the specified dir until the probe value becomes stop_state,
* then return the axis value.
@@ -205,18 +191,18 @@ inline bool read_calibration_pin() {
* fast in - Fast vs. precise measurement
*/
float measuring_movement(const AxisEnum axis, const int dir, const bool stop_state, const bool fast) {
const float step = fast ? 0.25 : CALIBRATION_MEASUREMENT_RESOLUTION;
const feedRate_t mms = fast ? MMM_TO_MMS(CALIBRATION_FEEDRATE_FAST) : MMM_TO_MMS(CALIBRATION_FEEDRATE_SLOW);
const float limit = fast ? 50 : 5;
destination = current_position;
for (float travel = 0; travel < limit; travel += step) {
destination[axis] += dir * step;
do_blocking_move_to((xyz_pos_t)destination, mms);
planner.synchronize();
if (read_calibration_pin() == stop_state) break;
}
return destination[axis];
destination[axis] += dir * limit;
endstops.enable_calibration_probe(true, stop_state);
do_blocking_move_to((xyz_pos_t)destination, mms);
endstops.enable_calibration_probe(false);
endstops.hit_on_purpose();
set_current_from_steppers_for_axis(axis);
sync_plan_position();
return current_position[axis];
}
/**
+3 -3
View File
@@ -112,9 +112,9 @@ void GcodeSuite::M81() {
return;
}
#if HAS_SUICIDE
suicide();
#elif ENABLED(PSU_CONTROL)
#if ENABLED(PSU_CONTROL)
powerManager.power_off_soon();
#elif HAS_SUICIDE
suicide();
#endif
}
+1 -1
View File
@@ -36,7 +36,7 @@
* existing command buffer.
*/
void GcodeSuite::M999() {
marlin_state = MF_RUNNING;
marlin_state = MarlinState::MF_RUNNING;
ui.reset_alert_level();
if (parser.boolval('S')) return;
+3 -3
View File
@@ -35,12 +35,12 @@ void GcodeSuite::M592_report(const bool forReplay/*=true*/) {
/**
* M592: Get or set nonlinear extrusion parameters
* A<factor> Linear coefficient (default 0.0)
* B<factor> Quadratic coefficient (default 0.0)
* A<factor> Quadratic coefficient (default 0.0)
* B<factor> Linear coefficient (default 0.0)
* C<factor> Constant coefficient (default 1.0)
*
* Adjusts the amount of extrusion based on the instantaneous velocity of extrusion, as a multiplier.
* The amount of extrusion is multiplied by max(C, C + A*v + B*v^2) where v is extruder velocity in mm/s.
* The amount of extrusion is multiplied by max(C, A*v^2 + B*v + C) where v is extruder velocity in mm/s.
* Only adjusts forward extrusions, since those are the ones affected by backpressure.
*/
void GcodeSuite::M592() {
+1 -1
View File
@@ -94,7 +94,7 @@ void GcodeSuite::M600() {
// In this case, for duplicating modes set DXC_ext to the extruder that ran out.
#if MULTI_FILAMENT_SENSOR
if (idex_is_duplicating())
DXC_ext = (READ(FIL_RUNOUT2_PIN) == FIL_RUNOUT2_STATE) ? 1 : 0;
DXC_ext = (READ(FIL_RUNOUT2_PIN) == runout.out_state(1)) ? 1 : 0;
#else
DXC_ext = active_extruder;
#endif
+127
View File
@@ -0,0 +1,127 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2024 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#include "../../../inc/MarlinConfig.h"
#if HAS_RS485_SERIAL
#include "../../../feature/rs485.h"
#include "../../gcode.h"
void write_packet_data() {
Packet packet = rs485Packetizer.getPacket();
for (size_t i = packet.startIndex; i <= packet.endIndex; i++) {
const uint8_t data = rs485Bus[i];
if (data < 0x10) SERIAL_ECHOPGM_P(PSTR("0"));
SERIAL_PRINT(data, PrintBase::Hex);
}
SERIAL_EOL();
}
static void rs485_write_failed(const PacketWriteResult writeResult) {
SERIAL_ERROR_START();
SERIAL_ECHOPGM("RS485: Write failed ");
switch (writeResult) {
case PacketWriteResult::FAILED_INTERRUPTED: SERIAL_ECHOPGM("interrupted"); break;
case PacketWriteResult::FAILED_BUFFER_FULL: SERIAL_ECHOPGM("buffer full"); break;
case PacketWriteResult::FAILED_TIMEOUT: SERIAL_ECHOPGM("timeout"); break;
}
SERIAL_EOL();
}
void GcodeSuite::M485() {
if (strlen(parser.string_arg) & 1) {
SERIAL_ERROR_MSG("String must contain an even number of bytes.");
return;
}
if (strlen(parser.string_arg) > RS485_SEND_BUFFER_SIZE * 2) {
SERIAL_ERROR_MSG("String too long (" STRINGIFY(RS485_SEND_BUFFER_SIZE) " bytes max).");
return;
}
// Convert the string to bytes in the buffer
for (size_t i = 0; i < strlen(parser.string_arg); i += 2) {
const uint8_t nybble1 = HEXCHR(parser.string_arg[i]),
nybble2 = HEXCHR(parser.string_arg[i + 1]);
if (nybble1 == -1 || nybble2 == -1) {
SERIAL_ERROR_START();
SERIAL_ECHOPGM("Not a hex character: ");
SERIAL_CHAR(nybble1 == -1 ? parser.string_arg[i] : parser.string_arg[i+1]);
SERIAL_EOL();
return;
}
rs485Buffer[i >> 1] = (nybble1 & 0x0F) << 4 | (nybble2 & 0x0F);
}
rs485Packetizer.setMaxReadTimeout(50000); // This can be super small since ideally any packets will already be in our buffer
rs485Packetizer.setFalsePacketVerificationTimeout(5000);
// Read and ignore any packets that may have come in, before we write.
while (rs485Packetizer.hasPacket()) {
#if M485_PROTOCOL >= 2
SERIAL_ECHO_START();
#endif
SERIAL_ECHO(F("rs485-"), F("unexpected-packet: "));
write_packet_data();
rs485Packetizer.clearPacket();
}
const PacketWriteResult writeResult = rs485Packetizer.writePacket(rs485Buffer, strlen(parser.string_arg) / 2);
switch (writeResult) {
default: rs485_write_failed(writeResult);
case PacketWriteResult::OK: break; // Nothing to do
}
//millis_t startTime = millis();
bool hasPacket = rs485Packetizer.hasPacket();
//millis_t endTime = millis();
//#if M485_PROTOCOL >= 2
// SERIAL_ECHO_START();
//#endif
//SERIAL_ECHOLN(F("rs485-"), F("time: "), endTime - startTime);
#if M485_PROTOCOL >= 2
SERIAL_ECHO_START();
#endif
SERIAL_ECHO(F("rs485-"));
if (!hasPacket) {
#if M485_PROTOCOL >= 2
SERIAL_ECHOLN(F("timeout"));
#else
SERIAL_ECHOLN(F("reply: TIMEOUT"));
#endif
return;
}
SERIAL_ECHO(F("reply: "));
write_packet_data();
rs485Packetizer.clearPacket();
}
#endif // HAS_RS485_SERIAL
@@ -28,36 +28,46 @@
#include "../../../feature/runout.h"
/**
* M412: Enable / Disable filament runout detection
* M591: Configure filament runout detection
*
* Parameters
* R : Reset the runout sensor
* S<bool> : Reset and enable/disable the runout sensor
* H<bool> : Enable/disable host handling of filament runout
* D<linear> : Extra distance to continue after runout is triggered
* L<linear> : Extra distance to continue after runout is triggered or motion interval
* D<linear> : Alias for L
* P<index> : Mode 0 = NONE
* 1 = Switch NO (HIGH = filament present)
* 2 = Switch NC (LOW = filament present)
* 3 = Encoder / Motion Sensor
*/
void GcodeSuite::M412() {
if (parser.seen("RS"
TERN_(HAS_FILAMENT_RUNOUT_DISTANCE, "D")
TERN_(HOST_ACTION_COMMANDS, "H")
)) {
void GcodeSuite::M591() {
if (parser.seen("RSDP" TERN_(HOST_ACTION_COMMANDS, "H"))) {
#if ENABLED(HOST_ACTION_COMMANDS)
if (parser.seen('H')) runout.host_handling = parser.value_bool();
#endif
const bool seenR = parser.seen_test('R'), seenS = parser.seen('S');
if (seenR || seenS) runout.reset();
if (seenS) runout.enabled = parser.value_bool();
#if HAS_FILAMENT_RUNOUT_DISTANCE
if (parser.seenval('D')) runout.set_runout_distance(parser.value_linear_units());
#endif
const uint8_t tool = TERN0(MULTI_FILAMENT_SENSOR, parser.ushortval('E', active_extruder));
if (seenS) runout.enabled[tool] = parser.value_bool();
if (parser.seen('D') || parser.seen('L')) runout.set_runout_distance(parser.value_linear_units(), tool);
if (parser.seen('P')) {
const RunoutMode tmp_mode = (RunoutMode)parser.value_int();
switch (tmp_mode) {
case RM_NONE ... RM_OUT_ON_HIGH:
case RM_MOTION_SENSOR:
runout.mode[tool] = tmp_mode;
runout.setup();
default: break;
}
}
}
else {
SERIAL_ECHO_START();
SERIAL_ECHOPGM("Filament runout ");
serialprint_onoff(runout.enabled);
#if HAS_FILAMENT_RUNOUT_DISTANCE
SERIAL_ECHOPGM(" ; Distance ", runout.runout_distance(), "mm");
#endif
serialprint_onoff(runout.enabled[active_extruder]);
SERIAL_ECHOPGM(" ; Distance ", runout.runout_distance(active_extruder), "mm");
SERIAL_ECHOPGM(" ; Mode ", runout.mode[active_extruder]);
#if ENABLED(HOST_ACTION_COMMANDS)
SERIAL_ECHOPGM(" ; Host handling ");
serialprint_onoff(runout.host_handling);
@@ -66,18 +76,19 @@ void GcodeSuite::M412() {
}
}
void GcodeSuite::M412_report(const bool forReplay/*=true*/) {
void GcodeSuite::M591_report(const bool forReplay/*=true*/) {
TERN_(MARLIN_SMALL_BUILD, return);
report_heading_etc(forReplay, F(STR_FILAMENT_RUNOUT_SENSOR));
SERIAL_ECHOPGM(
" M412 S", runout.enabled
#if HAS_FILAMENT_RUNOUT_DISTANCE
, " D", LINEAR_UNIT(runout.runout_distance())
#endif
, " ; Sensor "
);
serialprintln_onoff(runout.enabled);
for(int e=0; e < NUM_RUNOUT_SENSORS; e++)
SERIAL_ECHOLNPGM(
" M591"
#if MULTI_FILAMENT_SENSOR
" E", e,
#endif
" S", runout.enabled[e]
, " D", LINEAR_UNIT(runout.runout_distance(e))
, " P", runout.mode[e]
);
}
#endif // HAS_FILAMENT_SENSOR
+13 -4
View File
@@ -865,10 +865,6 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
case 407: M407(); break; // M407: Display measured filament diameter
#endif
#if HAS_FILAMENT_SENSOR
case 412: M412(); break; // M412: Enable/Disable filament runout detection
#endif
#if HAS_MULTI_LANGUAGE
case 414: M414(); break; // M414: Select multi language menu
#endif
@@ -897,6 +893,10 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
case 430: M430(); break; // M430: Read the system current (A), voltage (V), and power (W)
#endif
#if HAS_RS485_SERIAL
case 485: M485(); break; // M485: Send RS485 packets
#endif
#if ENABLED(CANCEL_OBJECTS)
case 486: M486(); break; // M486: Identify and cancel objects
#endif
@@ -943,6 +943,11 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
case 575: M575(); break; // M575: Set serial baudrate
#endif
#if HAS_FILAMENT_SENSOR
case 412: M412(); break; // Alias to M591
case 591: M591(); break; // M591 Configure filament runout detection
#endif
#if ENABLED(NONLINEAR_EXTRUSION)
case 592: M592(); break; // M592: Nonlinear Extrusion control
#endif
@@ -1105,6 +1110,10 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
case 1002: M1002(); break; // M1002: [INTERNAL] Tool-change and Relative E Move
#endif
#if ENABLED(ONE_CLICK_PRINT)
case 1003: M1003(); break; // M1003: [INTERNAL] Set the current dir to /
#endif
#if ENABLED(UBL_MESH_WIZARD)
case 1004: M1004(); break; // M1004: UBL Mesh Wizard
#endif
+14 -4
View File
@@ -234,7 +234,6 @@
* M406 - Disable Filament Sensor flow control. (Requires FILAMENT_WIDTH_SENSOR)
* M407 - Display measured filament diameter in millimeters. (Requires FILAMENT_WIDTH_SENSOR)
* M410 - Quickstop. Abort all planned moves.
* M412 - Enable / Disable Filament Runout Detection. (Requires FILAMENT_RUNOUT_SENSOR)
* M413 - Enable / Disable Power-Loss Recovery. (Requires POWER_LOSS_RECOVERY)
* M414 - Set language by index. (Requires LCD_LANGUAGE_2...)
* M420 - Enable/Disable Leveling (with current values) S1=enable S0=disable (Requires MESH_BED_LEVELING or ABL)
@@ -243,6 +242,7 @@
* M425 - Enable/Disable and tune backlash correction. (Requires BACKLASH_COMPENSATION and BACKLASH_GCODE)
* M428 - Set the home_offset based on the current_position. Nearest edge applies. (Disabled by NO_WORKSPACE_OFFSETS or DELTA)
* M430 - Read the system current, voltage, and power (Requires POWER_MONITOR_CURRENT, POWER_MONITOR_VOLTAGE, or POWER_MONITOR_FIXED_VOLTAGE)
* M485 - Send RS485 packets (Requires RS485_SERIAL_PORT)
* M486 - Identify and cancel objects. (Requires CANCEL_OBJECTS)
* M500 - Store parameters in EEPROM. (Requires EEPROM_SETTINGS)
* M501 - Restore parameters from EEPROM. (Requires EEPROM_SETTINGS)
@@ -259,7 +259,8 @@
* M554 - Get or set IP gateway. (Requires enabled Ethernet port)
* M569 - Enable stealthChop on an axis. (Requires at least one _DRIVER_TYPE to be TMC2130/2160/2208/2209/5130/5160)
* M575 - Change the serial baud rate. (Requires BAUD_RATE_GCODE)
* M592 - Get or set nonlinear extrusion parameters. (Requires NONLINEAR_EXTRUSION)
* M591 - Configure Filament Runout Detection. (Requires FILAMENT_RUNOUT_SENSOR)
* M592 - Get or set nonlinear extrusion parameters. (Requires NONLINEAR_EXTRUSION)
* M593 - Get or set input shaping parameters. (Requires INPUT_SHAPING_[XY])
* M600 - Pause for filament change: "M600 X<pos> Y<pos> Z<raise> E<first_retract> L<later_retract>". (Requires ADVANCED_PAUSE_FEATURE)
* M603 - Configure filament change: "M603 T<tool> U<unload_length> L<load_length>". (Requires ADVANCED_PAUSE_FEATURE)
@@ -1035,8 +1036,9 @@ private:
#endif
#if HAS_FILAMENT_SENSOR
static void M412();
static void M412_report(const bool forReplay=true);
static void M412() { M591(); }
static void M591();
static void M591_report(const bool forReplay=true);
#endif
#if HAS_MULTI_LANGUAGE
@@ -1063,6 +1065,10 @@ private:
static void M430();
#endif
#if HAS_RS485_SERIAL
static void M485();
#endif
#if ENABLED(CANCEL_OBJECTS)
static void M486();
#endif
@@ -1276,6 +1282,10 @@ private:
static void M1002();
#endif
#if ENABLED(ONE_CLICK_PRINT)
static void M1003();
#endif
#if ENABLED(UBL_MESH_WIZARD)
static void M1004();
#endif
+1 -1
View File
@@ -154,7 +154,7 @@ void GcodeSuite::M115() {
// AUTOLEVEL (G29)
cap_line(F("AUTOLEVEL"), ENABLED(HAS_AUTOLEVEL));
// RUNOUT (M412, M600)
// RUNOUT (M591, M600)
cap_line(F("RUNOUT"), ENABLED(FILAMENT_RUNOUT_SENSOR));
// Z_PROBE (G30)
+5 -2
View File
@@ -274,9 +274,12 @@ void GCodeParser::parse(char *p) {
// Only use string_arg for these M codes
if (letter == 'M') switch (codenum) {
TERN_(GCODE_MACROS, case 810 ... 819:)
TERN_(EXPECTED_PRINTER_CHECK, case 16:)
case 23: case 28: case 30: case 117 ... 118: case 928:
TERN_(SDSUPPORT, case 23: case 28: case 30: case 928:)
TERN_(HAS_STATUS_MESSAGE, case 117:)
TERN_(HAS_RS485_SERIAL, case 485:)
TERN_(GCODE_MACROS, case 810 ... 819:)
case 118:
string_arg = unescape_string(p);
return;
default: break;
+1 -1
View File
@@ -34,7 +34,7 @@
#include "../../feature/probe_temp_comp.h"
#endif
#if ANY(DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI)
#if ANY(DWIN_CREALITY_LCD_JYERSUI, EXTENSIBLE_UI)
#define VERBOSE_SINGLE_PROBE
#endif
+36
View File
@@ -0,0 +1,36 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2024 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#include "../../inc/MarlinConfig.h"
#if ENABLED(ONE_CLICK_PRINT)
#include "../gcode.h"
#include "../../sd/cardreader.h"
/**
* M1003: Set the current dir to /. Should come after 'M24'.
* Prevents the SD menu getting stuck in the newest file's workDir.
*/
void GcodeSuite::M1003() { card.cdroot(); }
#endif // ONE_CLICK_PRINT
+6
View File
@@ -497,6 +497,8 @@
#error "DIGIPOT_I2C is now DIGIPOT_MCP4451 (or DIGIPOT_MCP4018)."
#elif defined(TOUCH_BUTTONS)
#error "TOUCH_BUTTONS is now TOUCH_SCREEN."
#elif defined(DISABLE_ENCODER)
#error "DISABLE_ENCODER is now NO_BACK_MENU_ITEM."
#elif defined(LCD_FULL_PIXEL_HEIGHT) || defined(LCD_FULL_PIXEL_WIDTH)
#error "LCD_FULL_PIXEL_(WIDTH|HEIGHT) is deprecated and should be removed."
#elif defined(FSMC_UPSCALE)
@@ -641,6 +643,8 @@
#error "PROBE_PT_[123]_[XY] is now defined using PROBE_PT_[123] with an array { x, y }."
#elif defined(SQUARE_WAVE_STEPPING)
#error "SQUARE_WAVE_STEPPING is now EDGE_STEPPING."
#elif defined(MINIMUM_STEPPER_PULSE)
#error "MINIMUM_STEPPER_PULSE (in µs) is now MINIMUM_STEPPER_PULSE_NS. Multiply old MINIMUM_STEPPER_PULSE x 1000!"
#elif defined(FAN_PIN)
#error "FAN_PIN is now FAN0_PIN."
#elif defined(X_MIN_ENDSTOP_INVERTING) || defined(Y_MIN_ENDSTOP_INVERTING) || defined(Z_MIN_ENDSTOP_INVERTING) \
@@ -693,6 +697,8 @@
#error "Z_PROBE_END_SCRIPT is now EVENT_GCODE_AFTER_G29."
#elif defined(WIFI_SERIAL)
#error "WIFI_SERIAL is now WIFI_SERIAL_PORT."
#elif defined(CALIBRATION_MEASUREMENT_RESOLUTION)
#error "CALIBRATION_MEASUREMENT_RESOLUTION is no longer needed and should be removed."
#endif
// Changes to Probe Temp Compensation (#17392)
+57 -28
View File
@@ -26,6 +26,10 @@
* Conditionals that need to be set before Configuration_adv.h or pins.h
*/
#ifndef STRING_CONFIG_H_AUTHOR
#define STRING_CONFIG_H_AUTHOR "(anonymous)"
#endif
/**
* Extruders have some combination of stepper motors and hotends
* so we separate these concepts into the defines:
@@ -654,11 +658,11 @@
#elif ENABLED(ZONESTAR_12864OLED)
#define IS_RRD_SC 1
#define U8GLIB_SH1106
#define U8GLIB_SH1106_SPI
#elif ENABLED(ZONESTAR_12864OLED_SSD1306)
#define IS_RRD_SC 1
#define IS_U8GLIB_SSD1306
#define U8GLIB_SSD1306_SPI
#elif ENABLED(RADDS_DISPLAY)
#define IS_ULTIPANEL 1
@@ -716,7 +720,7 @@
#elif ENABLED(SAV_3DGLCD)
#ifdef U8GLIB_SSD1306
#if ENABLED(U8GLIB_SSD1306)
#define IS_U8GLIB_SSD1306 // Allow for U8GLIB_SSD1306 + SAV_3DGLCD
#endif
#define IS_NEWPANEL 1
@@ -815,6 +819,10 @@
#endif
#if ANY(FYSETC_MINI_12864, MKS_MINI_12864)
#define U8G_SPI_USE_MODE_3 1
#endif
// ST7920-based graphical displays
#if ANY(IS_RRD_FG_SC, LCD_FOR_MELZI, SILVER_GATE_GLCD_CONTROLLER)
#define DOGLCD
@@ -853,9 +861,12 @@
#define STD_ENCODER_STEPS_PER_MENU_ITEM 1
#endif
// 128x64 I2C OLED LCDs - SSD1306/SSD1309/SH1106
// 128x64 I2C OLED LCDs (SSD1306 / SSD1309 / SH1106)
// ...and 128x64 SPI OLED LCDs (SSD1306 / SH1106)
#if ANY(U8GLIB_SSD1306, U8GLIB_SSD1309, U8GLIB_SH1106)
#define HAS_U8GLIB_I2C_OLED 1
#endif
#if ANY(HAS_U8GLIB_I2C_OLED, U8GLIB_SSD1306_SPI, U8GLIB_SH1106_SPI)
#define HAS_WIRED_LCD 1
#define DOGLCD
#endif
@@ -1095,6 +1106,9 @@
* - poweroff (for PSU_CONTROL and HAS_MARLINUI_MENU)
*
* ...and implements these MarlinUI methods:
* - init_lcd
* - clear_lcd
* - clear_for_drawing
* - zoffset_overlay (if BABYSTEP_GFX_OVERLAY or MESH_EDIT_GFX_OVERLAY are supported)
* - draw_kill_screen
* - kill_screen
@@ -1200,10 +1214,14 @@
* Fill in undefined Filament Sensor options
*/
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
#define HAS_FILAMENT_SENSOR 1
#ifndef NUM_RUNOUT_SENSORS
#define NUM_RUNOUT_SENSORS E_STEPPERS
#endif
#if ENABLED(MIXING_EXTRUDER)
#define WATCH_ALL_RUNOUT_SENSORS
#endif
#if NUM_RUNOUT_SENSORS >= 1
#ifndef FIL_RUNOUT1_STATE
#define FIL_RUNOUT1_STATE FIL_RUNOUT_STATE
#endif
#ifndef FIL_RUNOUT1_PULLUP
#define FIL_RUNOUT1_PULLUP FIL_RUNOUT_PULLUP
#endif
@@ -1212,9 +1230,7 @@
#endif
#endif
#if NUM_RUNOUT_SENSORS >= 2
#ifndef FIL_RUNOUT2_STATE
#define FIL_RUNOUT2_STATE FIL_RUNOUT_STATE
#endif
#define MULTI_FILAMENT_SENSOR 1
#ifndef FIL_RUNOUT2_PULLUP
#define FIL_RUNOUT2_PULLUP FIL_RUNOUT_PULLUP
#endif
@@ -1223,9 +1239,6 @@
#endif
#endif
#if NUM_RUNOUT_SENSORS >= 3
#ifndef FIL_RUNOUT3_STATE
#define FIL_RUNOUT3_STATE FIL_RUNOUT_STATE
#endif
#ifndef FIL_RUNOUT3_PULLUP
#define FIL_RUNOUT3_PULLUP FIL_RUNOUT_PULLUP
#endif
@@ -1234,9 +1247,6 @@
#endif
#endif
#if NUM_RUNOUT_SENSORS >= 4
#ifndef FIL_RUNOUT4_STATE
#define FIL_RUNOUT4_STATE FIL_RUNOUT_STATE
#endif
#ifndef FIL_RUNOUT4_PULLUP
#define FIL_RUNOUT4_PULLUP FIL_RUNOUT_PULLUP
#endif
@@ -1245,9 +1255,6 @@
#endif
#endif
#if NUM_RUNOUT_SENSORS >= 5
#ifndef FIL_RUNOUT5_STATE
#define FIL_RUNOUT5_STATE FIL_RUNOUT_STATE
#endif
#ifndef FIL_RUNOUT5_PULLUP
#define FIL_RUNOUT5_PULLUP FIL_RUNOUT_PULLUP
#endif
@@ -1256,9 +1263,6 @@
#endif
#endif
#if NUM_RUNOUT_SENSORS >= 6
#ifndef FIL_RUNOUT6_STATE
#define FIL_RUNOUT6_STATE FIL_RUNOUT_STATE
#endif
#ifndef FIL_RUNOUT6_PULLUP
#define FIL_RUNOUT6_PULLUP FIL_RUNOUT_PULLUP
#endif
@@ -1267,9 +1271,6 @@
#endif
#endif
#if NUM_RUNOUT_SENSORS >= 7
#ifndef FIL_RUNOUT7_STATE
#define FIL_RUNOUT7_STATE FIL_RUNOUT_STATE
#endif
#ifndef FIL_RUNOUT7_PULLUP
#define FIL_RUNOUT7_PULLUP FIL_RUNOUT_PULLUP
#endif
@@ -1278,9 +1279,6 @@
#endif
#endif
#if NUM_RUNOUT_SENSORS >= 8
#ifndef FIL_RUNOUT8_STATE
#define FIL_RUNOUT8_STATE FIL_RUNOUT_STATE
#endif
#ifndef FIL_RUNOUT8_PULLUP
#define FIL_RUNOUT8_PULLUP FIL_RUNOUT_PULLUP
#endif
@@ -1659,6 +1657,9 @@
#if SERIAL_PORT == -1 || SERIAL_PORT_2 == -1 || SERIAL_PORT_3 == -1
#define HAS_USB_SERIAL 1
#endif
#ifdef RS485_SERIAL_PORT
#define HAS_RS485_SERIAL 1
#endif
#if SERIAL_PORT_2 == -2
#define HAS_ETHERNET 1
#endif
@@ -1888,6 +1889,34 @@
#define NEOPIXEL_BKGD_INDEX_LAST NEOPIXEL_BKGD_INDEX_FIRST
#endif
#if LED_POWEROFF_TIMEOUT > 0
#define HAS_LED_POWEROFF_TIMEOUT 1
#endif
/*** TEMPORARY COMPATIBILITY ***/
#if HAS_FILAMENT_SENSOR
#ifndef FIL_RUNOUT_ENABLED
#if FIL_RUNOUT_ENABLED_DEFAULT
#define FIL_RUNOUT_ENABLED ARRAY_N_1(NUM_RUNOUT_SENSORS, true)
#else
#define FIL_RUNOUT_ENABLED ARRAY_N_1(NUM_RUNOUT_SENSORS, false)
#endif
#endif
#ifndef FIL_RUNOUT_MODE
#if FIL_RUNOUT_STATE
#define FIL_RUNOUT_MODE ARRAY_N_1(NUM_RUNOUT_SENSORS, 1)
#else
#define FIL_RUNOUT_MODE ARRAY_N_1(NUM_RUNOUT_SENSORS, 2)
#endif
#endif
#ifndef FIL_RUNOUT_DISTANCE_MM
#define FIL_RUNOUT_DISTANCE_MM ARRAY_N_1(NUM_RUNOUT_SENSORS, 10)
#endif
#undef FIL_RUNOUT_ENABLED_DEFAULT
#undef FIL_RUNOUT_STATE
#undef FILAMENT_RUNOUT_DISTANCE_MM
#endif
#if ALL(SPI_FLASH, HAS_MEDIA, MARLIN_DEV_MODE)
#define SPI_FLASH_BACKUP 1
#endif
+10 -13
View File
@@ -840,9 +840,6 @@
#if NUM_RUNOUT_SENSORS > 1
#define MULTI_FILAMENT_SENSOR 1
#endif
#ifdef FILAMENT_RUNOUT_DISTANCE_MM
#define HAS_FILAMENT_RUNOUT_DISTANCE 1
#endif
#if ENABLED(MIXING_EXTRUDER)
#define WATCH_ALL_RUNOUT_SENSORS
#endif
@@ -1198,21 +1195,21 @@
#define MINIMUM_STEPPER_PRE_DIR_DELAY MINIMUM_STEPPER_POST_DIR_DELAY
#endif
#ifndef MINIMUM_STEPPER_PULSE
#ifndef MINIMUM_STEPPER_PULSE_NS
#if HAS_DRIVER(TB6560)
#define MINIMUM_STEPPER_PULSE 30
#define MINIMUM_STEPPER_PULSE_NS 30000
#elif HAS_DRIVER(TB6600)
#define MINIMUM_STEPPER_PULSE 3
#define MINIMUM_STEPPER_PULSE_NS 3000
#elif HAS_DRIVER(DRV8825)
#define MINIMUM_STEPPER_PULSE 2
#define MINIMUM_STEPPER_PULSE_NS 2000
#elif HAS_DRIVER(A4988) || HAS_DRIVER(A5984)
#define MINIMUM_STEPPER_PULSE 1
#elif HAS_TRINAMIC_CONFIG || HAS_TRINAMIC_STANDALONE
#define MINIMUM_STEPPER_PULSE 0
#define MINIMUM_STEPPER_PULSE_NS 1000
#elif HAS_DRIVER(LV8729)
#define MINIMUM_STEPPER_PULSE 0
#define MINIMUM_STEPPER_PULSE_NS 500
#elif HAS_TRINAMIC_CONFIG || HAS_TRINAMIC_STANDALONE
#define MINIMUM_STEPPER_PULSE_NS 100
#else
#define MINIMUM_STEPPER_PULSE 2
// Expecting MAXIMUM_STEPPER_RATE to be defined
#endif
#endif
@@ -1230,7 +1227,7 @@
#elif HAS_TRINAMIC_CONFIG || HAS_TRINAMIC_STANDALONE
#define MAXIMUM_STEPPER_RATE 5000000
#else
#define MAXIMUM_STEPPER_RATE 250000
// Expecting MINIMUM_STEPPER_PULSE_NS to be defined
#endif
#endif
+17 -7
View File
@@ -557,7 +557,7 @@
#endif
#endif
#if HAS_SD_DETECT && NONE(HAS_GRAPHICAL_TFT, LCD_USE_DMA_FSMC, HAS_FSMC_GRAPHICAL_TFT, HAS_SPI_GRAPHICAL_TFT, IS_DWIN_MARLINUI, EXTENSIBLE_UI, HAS_DWIN_E3V2)
#if HAS_SD_DETECT && NONE(HAS_GRAPHICAL_TFT, LCD_USE_DMA_FSMC, HAS_FSMC_GRAPHICAL_TFT, HAS_SPI_GRAPHICAL_TFT, IS_DWIN_MARLINUI, EXTENSIBLE_UI, HAS_DWIN_E3V2, HAS_U8GLIB_I2C_OLED)
#define REINIT_NOISY_LCD 1 // Have the LCD re-init on SD insertion
#endif
@@ -1827,11 +1827,12 @@
//
// Flag the indexed hardware serial ports in use
#define SERIAL_IN_USE(N) ( (defined(SERIAL_PORT) && N == SERIAL_PORT) \
|| (defined(SERIAL_PORT_2) && N == SERIAL_PORT_2) \
|| (defined(SERIAL_PORT_3) && N == SERIAL_PORT_3) \
|| (defined(MMU2_SERIAL_PORT) && N == MMU2_SERIAL_PORT) \
|| (defined(LCD_SERIAL_PORT) && N == LCD_SERIAL_PORT) )
#define SERIAL_IN_USE(N) ( (defined(SERIAL_PORT) && N == SERIAL_PORT) \
|| (defined(SERIAL_PORT_2) && N == SERIAL_PORT_2) \
|| (defined(SERIAL_PORT_3) && N == SERIAL_PORT_3) \
|| (defined(MMU2_SERIAL_PORT) && N == MMU2_SERIAL_PORT) \
|| (defined(LCD_SERIAL_PORT) && N == LCD_SERIAL_PORT) \
|| (defined(RS485_SERIAL_PORT) && N == RS485_SERIAL_PORT) )
// Flag the named hardware serial ports in use
#define TMC_UART_IS(A,N) (defined(A##_HARDWARE_SERIAL) && (CAT(HW_,A##_HARDWARE_SERIAL) == HW_Serial##N || CAT(HW_,A##_HARDWARE_SERIAL) == HW_MSerial##N))
@@ -2200,6 +2201,11 @@
#define HAS_Z_PROBE_STATE 1
#endif
#if PIN_EXISTS(CALIBRATION)
#define USE_CALIBRATION 1
#define HAS_CALIBRATION_STATE 1
#endif
#undef _ANY_STOP
#undef _USE_STOP
#undef _HAS_STATE
@@ -2752,7 +2758,7 @@
// Fan Kickstart
#if FAN_KICKSTART_TIME && !defined(FAN_KICKSTART_POWER)
#define FAN_KICKSTART_POWER 180
#define FAN_KICKSTART_POWER TERN(FAN_KICKSTART_LINEAR, 255, 180)
#endif
// Servos
@@ -3379,6 +3385,10 @@
#define LCD_HEIGHT TERN(IS_ULTIPANEL, 4, 2)
#endif
#endif
// Prepare the LCD to show the bootscreen early in setup
#if ENABLED(SHOW_BOOTSCREEN) && ANY(HAS_LCD_CONTRAST, HAS_LCD_BRIGHTNESS)
#define HAS_EARLY_LCD_SETTINGS 1
#endif
#endif
#if BUTTONS_EXIST(EN1, EN2, ENC)
+130 -7
View File
@@ -541,10 +541,71 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L
#error "You can't enable FIL_RUNOUT7_PULLUP and FIL_RUNOUT7_PULLDOWN at the same time."
#elif ALL(FIL_RUNOUT8_PULLUP, FIL_RUNOUT8_PULLDOWN)
#error "You can't enable FIL_RUNOUT8_PULLUP and FIL_RUNOUT8_PULLDOWN at the same time."
#elif FILAMENT_RUNOUT_DISTANCE_MM < 0
#error "FILAMENT_RUNOUT_DISTANCE_MM must be greater than or equal to zero."
#elif DISABLED(ADVANCED_PAUSE_FEATURE) && defined(FILAMENT_RUNOUT_SCRIPT)
static_assert(nullptr == strstr(FILAMENT_RUNOUT_SCRIPT, "M600"), "FILAMENT_RUNOUT_SCRIPT cannot make use of M600 unless ADVANCED_PAUSE_FEATURE is enabled");
#elif defined(FIL_RUNOUT_ENABLED_DEFAULT)
#error "FIL_RUNOUT_ENABLED_DEFAULT is now set with the FILAMENT_RUNOUT_ENABLED array."
#elif defined(FILAMENT_RUNOUT_DISTANCE_MM)
#error "FILAMENT_RUNOUT_DISTANCE_MM is now set with the FIL_RUNOUT_DISTANCE_MM array."
#elif defined(FIL_RUNOUT_STATE) || defined(FIL_RUNOUT2_STATE) || defined(FIL_RUNOUT3_STATE) || defined(FIL_RUNOUT4_STATE) || defined(FIL_RUNOUT5_STATE) || defined(FIL_RUNOUT6_STATE) || defined(FIL_RUNOUT7_STATE) || defined(FIL_RUNOUT8_STATE)
#ifdef FIL_RUNOUT_STATE
#if FIL_RUNOUT_STATE
#error "FIL_RUNOUT_STATE HIGH is now set with FIL_RUNOUT_MODE { 2 ... }."
#else
#error "FIL_RUNOUT_STATE LOW is now set with FIL_RUNOUT_MODE { 1 ... }."
#endif
#endif
#ifdef FIL_RUNOUT2_STATE
#if FIL_RUNOUT2_STATE
#error "FIL_RUNOUT2_STATE HIGH is now set with FIL_RUNOUT_MODE { n, 2 ... }."
#else
#error "FIL_RUNOUT2_STATE LOW is now set with FIL_RUNOUT_MODE { n, 1 ... }."
#endif
#endif
#ifdef FIL_RUNOUT3_STATE
#if FIL_RUNOUT3_STATE
#error "FIL_RUNOUT3_STATE HIGH is now set with FIL_RUNOUT_MODE { n, n, 2 ... }."
#else
#error "FIL_RUNOUT3_STATE LOW is now set with FIL_RUNOUT_MODE { n, n, 1 ... }."
#endif
#endif
#ifdef FIL_RUNOUT4_STATE
#if FIL_RUNOUT4_STATE
#error "FIL_RUNOUT4_STATE HIGH is now set with FIL_RUNOUT_MODE { n, n, n, 2 ... }."
#else
#error "FIL_RUNOUT4_STATE LOW is now set with FIL_RUNOUT_MODE { n, n, n, 1 ... }."
#endif
#endif
#ifdef FIL_RUNOUT5_STATE
#if FIL_RUNOUT5_STATE
#error "FIL_RUNOUT5_STATE HIGH is now set with FIL_RUNOUT_MODE { n, n, n, n, 2 ... }."
#else
#error "FIL_RUNOUT5_STATE LOW is now set with FIL_RUNOUT_MODE { n, n, n, n, 1 ... }."
#endif
#endif
#ifdef FIL_RUNOUT6_STATE
#if FIL_RUNOUT6_STATE
#error "FIL_RUNOUT6_STATE HIGH is now set with FIL_RUNOUT_MODE { n, n, n, n, n, 2 ... }."
#else
#error "FIL_RUNOUT6_STATE LOW is now set with FIL_RUNOUT_MODE { n, n, n, n, n, 1 ... }."
#endif
#endif
#ifdef FIL_RUNOUT7_STATE
#if FIL_RUNOUT7_STATE
#error "FIL_RUNOUT7_STATE HIGH is now set with FIL_RUNOUT_MODE { n, n, n, n, n, n, 2 ... }."
#else
#error "FIL_RUNOUT7_STATE LOW is now set with FIL_RUNOUT_MODE { n, n, n, n, n, n, 1 ... }."
#endif
#endif
#ifdef FIL_RUNOUT8_STATE
#if FIL_RUNOUT8_STATE
#error "FIL_RUNOUT8_STATE HIGH is now set with FIL_RUNOUT_MODE { n, n, n, n, n, n, n, 2 ... }."
#else
#error "FIL_RUNOUT8_STATE LOW is now set with FIL_RUNOUT_MODE { n, n, n, n, n, n, n, 1 ... }."
#endif
#endif
#elif ENABLED(FILAMENT_MOTION_SENSOR)
#error "FILAMENT_MOTION_SENSOR is now set with FIL_RUNOUT_MODE { 7 ... }."
#endif
#endif
@@ -837,9 +898,7 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L
* Nonlinear Extrusion requirements
*/
#if ENABLED(NONLINEAR_EXTRUSION)
#if DISABLED(ADAPTIVE_STEP_SMOOTHING)
#error "ADAPTIVE_STEP_SMOOTHING is required for NONLINEAR_EXTRUSION."
#elif HAS_MULTI_EXTRUDER
#if HAS_MULTI_EXTRUDER
#error "NONLINEAR_EXTRUSION doesn't currently support multi-extruder setups."
#elif DISABLED(CPU_32_BIT)
#error "NONLINEAR_EXTRUSION requires a 32-bit CPU."
@@ -1011,8 +1070,12 @@ static_assert(NUM_SERVOS <= NUM_SERVO_PLUGS, "NUM_SERVOS (or some servo index) i
#endif
// Fan Kickstart power
#if FAN_KICKSTART_TIME && !WITHIN(FAN_KICKSTART_POWER, 64, 255)
#error "FAN_KICKSTART_POWER must be an integer from 64 to 255."
#if FAN_KICKSTART_TIME
#if ENABLED(FAN_KICKSTART_LINEAR) && FAN_KICKSTART_POWER != 255
#error "FAN_KICKSTART_LINEAR requires a FAN_KICKSTART_POWER of 255."
#elif !WITHIN(FAN_KICKSTART_POWER, 64, 255)
#error "FAN_KICKSTART_POWER must be an integer from 64 to 255."
#endif
#endif
/**
@@ -2466,6 +2529,51 @@ static_assert(NUM_SERVOS <= NUM_SERVO_PLUGS, "NUM_SERVOS (or some servo index) i
#elif Z_SPI_SENSORLESS && !(AXIS_HAS_SPI(Z2) && (NUM_Z_STEPPERS < 3 || AXIS_HAS_SPI(Z3)) && (NUM_Z_STEPPERS < 4 || AXIS_HAS_SPI(Z4)))
#error "All Z Stepper Drivers must be SPI-capable to use SPI Endstops on Z."
#endif
#if PIN_EXISTS(Z2_STOP)
#if X_HOME_TO_MIN && Z2_STOP_PIN == X_MIN_PIN
#error "Z2_STOP_PIN can't be the same as X_MIN_PIN when homing to X_MIN"
#elif X_HOME_TO_MAX && Z2_STOP_PIN == X_MAX_PIN
#error "Z2_STOP_PIN can't be the same as X_MAX_PIN when homing to X_MAX"
#elif Y_HOME_TO_MIN && Z2_STOP_PIN == Y_MIN_PIN
#error "Z2_STOP_PIN can't be the same as Y_MIN_PIN when homing to Y_MIN"
#elif Y_HOME_TO_MAX && Z2_STOP_PIN == Y_MAX_PIN
#error "Z2_STOP_PIN can't be the same as Y_MAX_PIN when homing to Y_MAX"
#elif Z_HOME_TO_MIN && Z2_STOP_PIN == Z_MIN_PIN
#error "Z2_STOP_PIN can't be the same as Z_MIN_PIN when homing to Z_MIN"
#elif Z_HOME_TO_MAX && Z2_STOP_PIN == Z_MAX_PIN
#error "Z2_STOP_PIN can't be the same as Z_MAX_PIN when homing to Z_MAX"
#endif
#endif
#if PIN_EXISTS(Z3_STOP)
#if X_HOME_TO_MIN && Z3_STOP_PIN == X_MIN_PIN
#error "Z3_STOP_PIN can't be the same as X_MIN_PIN when homing to X_MIN"
#elif X_HOME_TO_MAX && Z3_STOP_PIN == X_MAX_PIN
#error "Z3_STOP_PIN can't be the same as X_MAX_PIN when homing to X_MAX"
#elif Y_HOME_TO_MIN && Z3_STOP_PIN == Y_MIN_PIN
#error "Z3_STOP_PIN can't be the same as Y_MIN_PIN when homing to Y_MIN"
#elif Y_HOME_TO_MAX && Z3_STOP_PIN == Y_MAX_PIN
#error "Z3_STOP_PIN can't be the same as Y_MAX_PIN when homing to Y_MAX"
#elif Z_HOME_TO_MIN && Z3_STOP_PIN == Z_MIN_PIN
#error "Z3_STOP_PIN can't be the same as Z_MIN_PIN when homing to Z_MIN"
#elif Z_HOME_TO_MAX && Z3_STOP_PIN == Z_MAX_PIN
#error "Z3_STOP_PIN can't be the same as Z_MAX_PIN when homing to Z_MAX"
#endif
#endif
#if PIN_EXISTS(Z4_STOP)
#if X_HOME_TO_MIN && Z4_STOP_PIN == X_MIN_PIN
#error "Z4_STOP_PIN can't be the same as X_MIN_PIN when homing to X_MIN"
#elif X_HOME_TO_MAX && Z4_STOP_PIN == X_MAX_PIN
#error "Z4_STOP_PIN can't be the same as X_MAX_PIN when homing to X_MAX"
#elif Y_HOME_TO_MIN && Z4_STOP_PIN == Y_MIN_PIN
#error "Z4_STOP_PIN can't be the same as Y_MIN_PIN when homing to Y_MIN"
#elif Y_HOME_TO_MAX && Z4_STOP_PIN == Y_MAX_PIN
#error "Z4_STOP_PIN can't be the same as Y_MAX_PIN when homing to Y_MAX"
#elif Z_HOME_TO_MIN && Z4_STOP_PIN == Z_MIN_PIN
#error "Z4_STOP_PIN can't be the same as Z_MIN_PIN when homing to Z_MIN"
#elif Z_HOME_TO_MAX && Z4_STOP_PIN == Z_MAX_PIN
#error "Z4_STOP_PIN can't be the same as Z_MAX_PIN when homing to Z_MAX"
#endif
#endif
#endif
#if defined(ENDSTOP_NOISE_THRESHOLD) && !WITHIN(ENDSTOP_NOISE_THRESHOLD, 2, 7)
@@ -2872,6 +2980,8 @@ static_assert(NUM_SERVOS <= NUM_SERVO_PLUGS, "NUM_SERVOS (or some servo index) i
#error "MMU2_SERIAL_PORT cannot be the same as SERIAL_PORT_2."
#elif defined(LCD_SERIAL_PORT) && MMU2_SERIAL_PORT == LCD_SERIAL_PORT
#error "MMU2_SERIAL_PORT cannot be the same as LCD_SERIAL_PORT."
#elif defined(RS485_SERIAL_PORT) && MMU2_SERIAL_PORT == RS485_SERIAL_PORT
#error "MMU2_SERIAL_PORT cannot be the same as RS485_SERIAL_PORT."
#endif
#endif
@@ -2883,6 +2993,8 @@ static_assert(NUM_SERVOS <= NUM_SERVO_PLUGS, "NUM_SERVOS (or some servo index) i
#error "LCD_SERIAL_PORT cannot be the same as SERIAL_PORT."
#elif defined(SERIAL_PORT_2) && LCD_SERIAL_PORT == SERIAL_PORT_2
#error "LCD_SERIAL_PORT cannot be the same as SERIAL_PORT_2."
#elif defined(RS485_SERIAL_PORT) && LCD_SERIAL_PORT == RS485_SERIAL_PORT
#error "LCD_SERIAL_PORT cannot be the same as RS485_SERIAL_PORT."
#endif
#else
#if HAS_DGUS_LCD
@@ -2896,6 +3008,17 @@ static_assert(NUM_SERVOS <= NUM_SERVO_PLUGS, "NUM_SERVOS (or some servo index) i
#endif
#endif
/**
* RS485 bus requires a dedicated serial port
*/
#ifdef RS485_SERIAL_PORT
#if RS485_SERIAL_PORT == SERIAL_PORT
#error "RS485_SERIAL_PORT cannot be the same as SERIAL_PORT."
#elif defined(SERIAL_PORT_2) && RS485_SERIAL_PORT == SERIAL_PORT_2
#error "RS485_SERIAL_PORT cannot be the same as SERIAL_PORT_2."
#endif
#endif
/**
* Check existing CS pins against enabled TMC SPI drivers.
*/
+1 -1
View File
@@ -42,7 +42,7 @@
* version was tagged.
*/
#ifndef STRING_DISTRIBUTION_DATE
#define STRING_DISTRIBUTION_DATE "2024-05-24"
#define STRING_DISTRIBUTION_DATE "2024-07-12"
#endif
/**
+1 -1
View File
@@ -789,7 +789,7 @@
* Input Shaping
*/
#if HAS_ZV_SHAPING
#if ANY(CORE_IS_XY, MARKFORGED_XY, MARKFORGED_YX)
#if ANY(IS_CORE, MARKFORGED_XY, MARKFORGED_YX)
#warning "Input Shaping for CORE / MARKFORGED kinematic axes is still experimental."
#endif
#if ENABLED(I2S_STEPPER_STREAM)
+2 -1
View File
@@ -467,6 +467,7 @@ bool MarlinUI::detected() {
#endif
void MarlinUI::clear_lcd() { lcd.clear(); }
void MarlinUI::clear_for_drawing() { clear_lcd(); }
#if ENABLED(SHOW_BOOTSCREEN)
@@ -1515,7 +1516,7 @@ void MarlinUI::draw_status_screen() {
lower_right.column = 0;
lower_right.row = 0;
clear_lcd();
clear_for_drawing();
x_map_pixels = (HD44780_CHAR_WIDTH) * (MESH_MAP_COLS) - 2; // Minus 2 because we are drawing a box around the map
y_map_pixels = (HD44780_CHAR_HEIGHT) * (MESH_MAP_ROWS) - 2;
@@ -376,6 +376,8 @@ void MarlinUI::clear_lcd() {
lcd.clear_buffer();
}
void MarlinUI::clear_for_drawing() { clear_lcd(); }
#if HAS_LCD_CONTRAST
void MarlinUI::_set_contrast() { lcd.setContrast(contrast); }
#endif
+15 -2
View File
@@ -374,12 +374,25 @@ void MarlinUI::draw_kill_screen() {
} while (u8g.nextPage());
}
void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
// Erase the LCD contents by drawing an empty box.
void MarlinUI::clear_lcd() {
u8g.setColorIndex(0);
u8g.firstPage();
do {
u8g.drawBox(0, 0, u8g.getWidth(), u8g.getHeight());
} while (u8g.nextPage());
u8g.setColorIndex(1);
}
// U8G displays are drawn over multiple loops so must do their own clearing.
void MarlinUI::clear_for_drawing() {
// Automatically cleared by Picture Loop
}
#if HAS_DISPLAY_SLEEP
void MarlinUI::sleep_display(const bool sleep/*=true*/) {
static bool asleep = false;
if (asleep != sleep){
if (asleep != sleep) {
sleep ? u8g.sleepOn() : u8g.sleepOff();
asleep = sleep;
}
+10 -2
View File
@@ -155,7 +155,11 @@
#if ENABLED(ALTERNATIVE_LCD)
#define U8G_CLASS U8GLIB_SH1306_128X64_2X // 4 stripes
#else
#define U8G_CLASS U8GLIB_SH1306_128X64 // 8 stripes
#if ENABLED(U8GLIB_SSD1306_SPI)
#define U8G_CLASS U8GLIB_SSD1306_128X64_SW_SPI_HAL
#else
#define U8G_CLASS U8GLIB_SH1306_128X64 // 8 stripes
#endif
#endif
#elif ANY(MKS_12864OLED, ZONESTAR_12864OLED)
@@ -168,7 +172,11 @@
#if ENABLED(ALTERNATIVE_LCD)
#define U8G_CLASS U8GLIB_SH1106_128X64_2X // 4 stripes
#else
#define U8G_CLASS U8GLIB_SH1106_128X64 // 8 stripes
#if ENABLED(U8GLIB_SH1106_SPI)
#define U8G_CLASS U8GLIB_SH1106_128X64_SW_SPI_HAL
#else
#define U8G_CLASS U8GLIB_SH1106_128X64 // 8 stripes
#endif
#endif
#elif ENABLED(U8GLIB_SH1106_EINSTART)
@@ -23,7 +23,7 @@
#include "../../../inc/MarlinConfig.h"
// use this file to create the public interface for device drivers that are NOT in the U8G library
// Use this file to create the public interface for device drivers that are NOT in the U8G library
extern u8g_dev_t u8g_dev_st7565_64128n_HAL_2x_sw_spi;
extern u8g_dev_t u8g_dev_st7565_64128n_HAL_2x_hw_spi;
@@ -90,6 +90,30 @@ public:
void init(uint8_t options = U8G_I2C_OPT_NONE) { U8GLIB::init(&u8g_dev_ssd1306_128x64_2x_i2c_2_wire, options); }
};
#if ENABLED(U8GLIB_SH1106_SPI)
extern u8g_dev_t u8g_dev_sh1106_128x64_HAL_sw_spi;
class U8GLIB_SH1106_128X64_SW_SPI_HAL : public U8GLIB {
public:
U8GLIB_SH1106_128X64_SW_SPI_HAL() : U8GLIB() { }
U8GLIB_SH1106_128X64_SW_SPI_HAL(pin_t sck, pin_t mosi, pin_t cs, pin_t reset = U8G_PIN_NONE) {init(sck, mosi, cs, reset); }
void init(pin_t sck, pin_t mosi, pin_t cs, pin_t reset=U8G_PIN_NONE) {
U8GLIB::init(&u8g_dev_sh1106_128x64_HAL_sw_spi, (uint8_t)sck, (uint8_t)mosi, (uint8_t)cs, U8G_PIN_NONE, (uint8_t)reset);
}
};
#endif
#if ENABLED(U8GLIB_SSD1306_SPI)
extern u8g_dev_t u8g_dev_ssd1306_128x64_HAL_sw_spi;
class U8GLIB_SSD1306_128X64_SW_SPI_HAL : public U8GLIB {
public:
U8GLIB_SSD1306_128X64_SW_SPI_HAL() : U8GLIB() { }
U8GLIB_SSD1306_128X64_SW_SPI_HAL(pin_t sck, pin_t mosi, pin_t cs, pin_t reset = U8G_PIN_NONE) {init(sck, mosi, cs, reset); }
void init(pin_t sck, pin_t mosi, pin_t cs, pin_t reset=U8G_PIN_NONE) {
U8GLIB::init(&u8g_dev_ssd1306_128x64_HAL_sw_spi, (uint8_t)sck, (uint8_t)mosi, (uint8_t)cs, U8G_PIN_NONE, (uint8_t)reset);
}
};
#endif
//
// Very basic support for 320x240 TFT screen
// Tested on MKS Robin TFT_V2.0 with ST7789V controller
@@ -77,35 +77,34 @@
uint8_t u8g_WriteEscSeqP_2_wire(u8g_t *u8g, u8g_dev_t *dev, const uint8_t *esc_seq);
// The sh1106 is compatible to the ssd1306, but is 132x64. 128x64 display area is centered within
// the 132x64.
// SH1106 (132x64) is compatible with SSD1306 (128x64) by adding a small margin to the larger display
#define SH1106_PAGE_ADR(N) (0x20), (N)
#define SH1106_COL_ADR(N) (0x10 | ((N) >> 4)), ((N) & 0xFF)
#define SH1106_COLUMN_RANGE(N,O) (0x21), (N), (O)
#define SH1106_PAGE_RANGE(N,O) (0x22), (N), (O)
#define SH1106_SCROLL(N) ((N) ? 0x2F : 0x2E)
#define SH1106_START_LINE(N) (0x40 | (N))
#define SH1106_CONTRAST(N) (0x81), (N)
#define SH1106_CHARGE_PUMP(N) (0x8D), ((N) ? 0x14 : 0x10)
#define SH1106_ADC_REVERSE(N) ((N) ? 0xA1 : 0xA0)
#define SH1106_ALL_PIX(N) ((N) ? 0xA5 : 0xA4)
#define SH1106_INVERTED(N) ((N) ? 0xA7 : 0xA6)
#define SH1106_MUX_RATIO(N) (0xA8), (N)
#define SH1106_ON(N) ((N) ? 0xAF : 0xAE)
#define SH1106_OUT_MODE(N) ((N) ? 0xC8 : 0xC0)
#define SH1106_DISP_OFFS(N) (0xD3), (N)
#define SH1106_OSC_FREQ(R,F) (0xD5), ((F) << 4 | (R))
#define SH1106_CHARGE_PER(P,D) (0xD9), ((D) << 4 | (P))
#define SH1106_COM_CONFIG(N) (0xDA), ((N) ? 0x12 : 0x02)
#define SH1106_VCOM_DESEL(N) (0xDB), (N)
#define SH1106_NOOP() (0xE3)
static const uint8_t u8g_dev_sh1106_128x64_data_start_2_wire[] PROGMEM = {
0x010, // set upper 4 bit of the col adr to 0
0x002, // set lower 4 bit of the col adr to 2 (centered display with ssd1306)
U8G_ESC_END // end of sequence
SH1106_COL_ADR(2), // Column 2 to center 128 pixels in 132 pixels
U8G_ESC_END // End of sequence
};
#define SH1106_PAGE_ADR(N) (0x20), (N)
#define SH1106_COLUMN_RANGE(N) (0x21), (((N) >> 8) & 0xFF), ((N) & 0xFF)
#define SH1106_PAGE_RANGE(N,O) (0x22), (N), (O)
#define SH1106_SCROLL(N) ((N) ? 0x2F : 0x2E)
#define SH1106_START_LINE(N) (0x40 | (N))
#define SH1106_CONTRAST(N) (0x81), (N)
#define SH1106_CHARGE_PUMP(N) (0x8D), ((N) ? 0x14 : 0x10)
#define SH1106_ADC_REVERSE(N) ((N) ? 0xA1 : 0xA0)
#define SH1106_ALL_PIX(N) ((N) ? 0xA5 : 0xA4)
#define SH1106_INVERTED(N) ((N) ? 0xA7 : 0xA6)
#define SH1106_MUX_RATIO(N) (0xA8), (N)
#define SH1106_ON(N) ((N) ? 0xAF : 0xAE)
#define SH1106_OUT_MODE(N) ((N) ? 0xC8 : 0xC0)
#define SH1106_DISP_OFFS(N) (0xD3), (N)
#define SH1106_OSC_FREQ(R,F) (0xD5), ((F) << 4 | (R))
#define SH1106_CHARGE_PER(P,D) (0xD9), ((D) << 4 | (P))
#define SH1106_COM_CONFIG(N) (0xDA), ((N) ? 0x12 : 0x02)
#define SH1106_VCOM_DESEL(N) (0xDB), (N)
#define SH1106_NOOP() (0xE3)
static const uint8_t u8g_dev_sh1106_128x64_init_seq_2_wire[] PROGMEM = {
U8G_ESC_ADR(0), // Initiate command mode
SH1106_ON(0), // Display off, sleep mode
@@ -113,19 +112,19 @@ static const uint8_t u8g_dev_sh1106_128x64_init_seq_2_wire[] PROGMEM = {
SH1106_DISP_OFFS(0), // Display offset
SH1106_START_LINE(0), // Start line
SH1106_ADC_REVERSE(1), // Segment remap A0/A1
SH1106_OUT_MODE(1), // C0: scan dir normal, C8: reverse
SH1106_COM_CONFIG(1), // Com pin HW config, sequential com pin config (bit 4), disable left/right remap (bit 5)
SH1106_CONTRAST(0xCF), // [2] set contrast control
SH1106_PAGE_ADR(0x02), // 2012-05-27: page addressing mode
SH1106_COLUMN_RANGE(0x281), // Set column range from 0 through 131
SH1106_PAGE_RANGE(0, 7), // Set page range from 0 through 7
SH1106_CHARGE_PER(0x1, 0xF), // [2] pre-charge period 0x22/F1
SH1106_OUT_MODE(1), // 0: scan dir normal, 1: reverse
SH1106_COM_CONFIG(1), // COM pin HW config, sequential com pin config (bit 4), disable left/right remap (bit 5)
SH1106_CONTRAST(0xCF), // Set contrast control
SH1106_PAGE_ADR(0x02), // page addressing mode
SH1106_COLUMN_RANGE(2, 129), // Set column range 2 .. 129
SH1106_PAGE_RANGE(0, 7), // Set page range 0 .. 7
SH1106_CHARGE_PER(0x1, 0xF), // Pre-charge period
SH1106_VCOM_DESEL(0x40), // Vcomh deselect level
SH1106_ALL_PIX(0), // Output ram to display
SH1106_ALL_PIX(0), // Output RAM to display
SH1106_INVERTED(0), // Normal display mode
SH1106_OSC_FREQ(0, 8), // Clock divide ratio (0:1) and oscillator frequency (8)
SH1106_CHARGE_PUMP(1), // [2] charge pump setting (P62): 0x14 enable, 0x10 disable
SH1106_SCROLL(0), // 2012-05-27: Deactivate scroll
SH1106_CHARGE_PUMP(1), // Charge pump setting
SH1106_SCROLL(0), // Deactivate scroll
SH1106_ON(1), // Display on
U8G_ESC_END // End of sequence
};
@@ -136,28 +135,24 @@ uint8_t u8g_dev_sh1106_128x64_2x_2_wire_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t m
u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS);
u8g_WriteEscSeqP_2_wire(u8g, dev, u8g_dev_sh1106_128x64_init_seq_2_wire);
break;
case U8G_DEV_MSG_STOP:
break;
case U8G_DEV_MSG_STOP: break;
case U8G_DEV_MSG_PAGE_NEXT: {
u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
u8g_SetAddress(u8g, dev, 0); // instruction mode
u8g_WriteEscSeqP_2_wire(u8g, dev, u8g_dev_sh1106_128x64_data_start_2_wire);
u8g_WriteByte(u8g, dev, 0x0B0 | (pb->p.page*2)); // select current page
u8g_SetAddress(u8g, dev, 1); // data mode
u8g_WriteSequence(u8g, dev, pb->width, (uint8_t *) pb->buf);
u8g_SetChipSelect(u8g, dev, 0);
u8g_SetAddress(u8g, dev, 0); // instruction mode
u8g_WriteEscSeqP_2_wire(u8g, dev, u8g_dev_sh1106_128x64_data_start_2_wire);
u8g_WriteByte(u8g, dev, 0x0B0 | (pb->p.page*2+1)); // select current page
u8g_SetAddress(u8g, dev, 1); // data mode
u8g_WriteSequence(u8g, dev, pb->width, (uint8_t *)(pb->buf)+pb->width);
u8g_SetChipSelect(u8g, dev, 0);
}
break;
case U8G_DEV_MSG_SLEEP_ON:
return 1;
case U8G_DEV_MSG_SLEEP_OFF:
return 1;
u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
u8g_SetAddress(u8g, dev, 0); // Instruction mode
u8g_WriteEscSeqP_2_wire(u8g, dev, u8g_dev_sh1106_128x64_data_start_2_wire);
u8g_WriteByte(u8g, dev, 0xB0 | (pb->p.page*2)); // Select current page
u8g_SetAddress(u8g, dev, 1); // Data mode
u8g_WriteSequence(u8g, dev, pb->width, (uint8_t *) pb->buf);
u8g_SetChipSelect(u8g, dev, 0);
u8g_SetAddress(u8g, dev, 0); // Instruction mode
u8g_WriteEscSeqP_2_wire(u8g, dev, u8g_dev_sh1106_128x64_data_start_2_wire);
u8g_WriteByte(u8g, dev, 0xB0 | (pb->p.page*2+1)); // Select current page
u8g_SetAddress(u8g, dev, 1); // Data mode
u8g_WriteSequence(u8g, dev, pb->width, (uint8_t *)(pb->buf)+pb->width);
u8g_SetChipSelect(u8g, dev, 0);
} break;
case U8G_DEV_MSG_SLEEP_ON: return 1;
case U8G_DEV_MSG_SLEEP_OFF: return 1;
}
return u8g_dev_pb16v1_base_fn(u8g, dev, msg, arg);
}
@@ -169,33 +164,32 @@ u8g_dev_t u8g_dev_sh1106_128x64_2x_i2c_2_wire = { u8g_dev_sh1106_128x64_2x_2_wir
/////////////////////////////////////////////////////////////////////////////////////////////
static const uint8_t u8g_dev_ssd1306_128x64_data_start_2_wire[] PROGMEM = {
0x010, // set upper 4 bit of the col adr to 0
0x000, // set lower 4 bit of the col adr to 0
U8G_ESC_END // end of sequence
SH1106_COL_ADR(0), // Column 0
U8G_ESC_END // End of sequence
};
static const uint8_t u8g_dev_ssd1306_128x64_init_seq_2_wire[] PROGMEM = {
U8G_ESC_ADR(0), // initiate command mode
0x0AE, // display off, sleep mode
0x0A8, 0x03F, // mux ratio
0x0D3, 0x00, // display offset
0x040, // start line
0x0A1, // segment remap a0/a1
0x0C8, // c0: scan dir normal, c8: reverse
0x0DA, 0x012, // com pin HW config, sequential com pin config (bit 4), disable left/right remap (bit 5)
0x081, 0x0CF, // [2] set contrast control
0x020, 0x002, // 2012-05-27: page addressing mode
0x21, 0, 0x7F, // set column range from 0 through 127
0x22, 0, 7, // set page range from 0 through 7
0x0D9, 0x0F1, // [2] pre-charge period 0x022/f1
0x0DB, 0x040, // vcomh deselect level
0x0A4, // output ram to display
0x0A6, // none inverted normal display mode
0x0D5, 0x080, // clock divide ratio (0x00=1) and oscillator frequency (0x8)
0x08D, 0x014, // [2] charge pump setting (p62): 0x014 enable, 0x010 disable
0x02E, // 2012-05-27: Deactivate scroll
0x0AF, // display on
U8G_ESC_END // end of sequence
U8G_ESC_CS(0), // Disable chip
SH1106_ON(0), // Display off, sleep mode
SH1106_MUX_RATIO(0x3F), // Mux ratio
SH1106_DISP_OFFS(0), // Display offset
SH1106_START_LINE(0), // Start line
SH1106_ADC_REVERSE(1), // Segment remap A0/A1
SH1106_OUT_MODE(1), // 0: scan dir normal, 1: reverse
SH1106_COM_CONFIG(1), // COM pin HW config, sequential com pin config (bit 4), disable left/right remap (bit 5)
SH1106_CONTRAST(0xCF), // Set contrast control
SH1106_PAGE_ADR(0x02), // page addressing mode
SH1106_COLUMN_RANGE(0, 127), // Set column range 0 .. 127
SH1106_PAGE_RANGE(0, 7), // Set page range from 0 .. 7
SH1106_CHARGE_PER(0x1, 0xF), // Pre-charge period
SH1106_VCOM_DESEL(0x40), // Vcomh deselect level
SH1106_ALL_PIX(0), // Send RAM to display
SH1106_INVERTED(0), // Normal display mode
SH1106_OSC_FREQ(0, 8), // Clock divide ratio (0:1) and oscillator frequency (8)
SH1106_CHARGE_PUMP(1), // Charge pump setting
SH1106_SCROLL(0), // Deactivate scroll
SH1106_ON(1), // Display on
U8G_ESC_END // End of sequence
};
uint8_t u8g_dev_ssd1306_128x64_2x_2_wire_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg) {
@@ -204,28 +198,24 @@ uint8_t u8g_dev_ssd1306_128x64_2x_2_wire_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t
u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS);
u8g_WriteEscSeqP_2_wire(u8g, dev, u8g_dev_ssd1306_128x64_init_seq_2_wire);
break;
case U8G_DEV_MSG_STOP:
break;
case U8G_DEV_MSG_STOP: break;
case U8G_DEV_MSG_PAGE_NEXT: {
u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
u8g_SetAddress(u8g, dev, 0); // instruction mode
u8g_WriteEscSeqP_2_wire(u8g, dev, u8g_dev_ssd1306_128x64_data_start_2_wire);
u8g_WriteByte(u8g, dev, 0x0B0 | (pb->p.page*2)); // select current page
u8g_SetAddress(u8g, dev, 1); // data mode
u8g_WriteSequence(u8g, dev, pb->width, (uint8_t *) pb->buf);
u8g_SetChipSelect(u8g, dev, 0);
u8g_SetAddress(u8g, dev, 0); // instruction mode
u8g_WriteEscSeqP_2_wire(u8g, dev, u8g_dev_ssd1306_128x64_data_start_2_wire);
u8g_WriteByte(u8g, dev, 0x0B0 | (pb->p.page*2+1)); // select current page
u8g_SetAddress(u8g, dev, 1); // data mode
u8g_WriteSequence(u8g, dev, pb->width, (uint8_t *)(pb->buf)+pb->width);
u8g_SetChipSelect(u8g, dev, 0);
}
break;
case U8G_DEV_MSG_SLEEP_ON:
return 1;
case U8G_DEV_MSG_SLEEP_OFF:
return 1;
u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
u8g_SetAddress(u8g, dev, 0); // Instruction mode
u8g_WriteEscSeqP_2_wire(u8g, dev, u8g_dev_ssd1306_128x64_data_start_2_wire);
u8g_WriteByte(u8g, dev, 0xB0 | (pb->p.page*2)); // Select current page
u8g_SetAddress(u8g, dev, 1); // Data mode
u8g_WriteSequence(u8g, dev, pb->width, (uint8_t *) pb->buf);
u8g_SetChipSelect(u8g, dev, 0);
u8g_SetAddress(u8g, dev, 0); // Instruction mode
u8g_WriteEscSeqP_2_wire(u8g, dev, u8g_dev_ssd1306_128x64_data_start_2_wire);
u8g_WriteByte(u8g, dev, 0xB0 | (pb->p.page*2+1)); // Select current page
u8g_SetAddress(u8g, dev, 1); // Data mode
u8g_WriteSequence(u8g, dev, pb->width, (uint8_t *)(pb->buf)+pb->width);
u8g_SetChipSelect(u8g, dev, 0);
} break;
case U8G_DEV_MSG_SLEEP_ON: return 1;
case U8G_DEV_MSG_SLEEP_OFF: return 1;
}
return u8g_dev_pb16v1_base_fn(u8g, dev, msg, arg);
}
@@ -236,10 +226,10 @@ u8g_dev_t u8g_dev_ssd1306_128x64_2x_i2c_2_wire = { u8g_dev_ssd1306_128x64_2x_2_w
/////////////////////////////////////////////////////////////////////////////////////////////
// This routine adds the instruction byte in between the command bytes. This makes the init
// sequences a lot easier to read.
// This routine adds the instruction byte in between the command bytes.
// This makes the init sequences a lot easier to read.
#define I2C_CMD_MODE 0x080
#define I2C_CMD_MODE 0x80
uint8_t u8g_WriteEscSeqP_2_wire(u8g_t *u8g, u8g_dev_t *dev, const uint8_t *esc_seq) {
uint8_t is_escape = 0;
@@ -247,10 +237,8 @@ uint8_t u8g_WriteEscSeqP_2_wire(u8g_t *u8g, u8g_dev_t *dev, const uint8_t *esc_s
uint8_t value = u8g_pgm_read(esc_seq);
if (is_escape == 0) {
if (value != 255) {
if (u8g_WriteByte(u8g, dev, value) == 0 )
return 0;
if (u8g_WriteByte(u8g, dev, I2C_CMD_MODE) == 0 )
return 0;
if (u8g_WriteByte(u8g, dev, value) == 0) return 0;
if (u8g_WriteByte(u8g, dev, I2C_CMD_MODE) == 0) return 0;
}
else {
is_escape = 1;
@@ -258,16 +246,14 @@ uint8_t u8g_WriteEscSeqP_2_wire(u8g_t *u8g, u8g_dev_t *dev, const uint8_t *esc_s
}
else {
if (value == 255) {
if (u8g_WriteByte(u8g, dev, value) == 0 )
return 0;
if (u8g_WriteByte(u8g, dev, I2C_CMD_MODE) == 0 )
return 0;
if (u8g_WriteByte(u8g, dev, value) == 0) return 0;
if (u8g_WriteByte(u8g, dev, I2C_CMD_MODE) == 0) return 0;
}
else if (value == 254) {
break;
}
else if (value >= 0x0F0) {
/* not yet used, do nothing */
else if (value >= 0xF0) {
// not yet used, do nothing
}
else if (value >= 0xE0 ) {
u8g_SetAddress(u8g, dev, value & 0x0F);
@@ -279,13 +265,14 @@ uint8_t u8g_WriteEscSeqP_2_wire(u8g_t *u8g, u8g_dev_t *dev, const uint8_t *esc_s
u8g_SetResetLow(u8g, dev);
value &= 0x0F;
value <<= 4;
value+=2;
value += 2;
u8g_Delay(value);
u8g_SetResetHigh(u8g, dev);
u8g_Delay(value);
}
else if (value >= 0xBE) { /* not yet implemented */
/* u8g_SetVCC(u8g, dev, value & 0x01); */
else if (value >= 0xBE) {
// not yet implemented
//u8g_SetVCC(u8g, dev, value & 0x01);
}
else if (value <= 127) {
u8g_Delay(value);
@@ -0,0 +1,246 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
/**
* Based on u8g_dev_ssd1306_128x64.c
*
* Universal 8bit Graphics Library
*
* Copyright (c) 2015, olikraus@gmail.com
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list
* of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice, this
* list of conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "../../../inc/MarlinConfig.h"
#if ALL(HAS_MARLINUI_U8GLIB, FORCE_SOFT_SPI) && ANY(U8GLIB_SH1106_SPI, U8GLIB_SSD1306_SPI)
#include "HAL_LCD_com_defines.h"
#define WIDTH 128
#define HEIGHT 64
#define PAGE_HEIGHT 8
#define SH1106_PAGE_ADR(N) (0x20), (N)
#define SH1106_COL_ADR(N) (0x10 | ((N) >> 4)), ((N) & 0xFF)
#define SH1106_COLUMN_RANGE(N,O) (0x21), (N), (O)
#define SH1106_PAGE_RANGE(N,O) (0x22), (N), (O)
#define SH1106_SCROLL(N) ((N) ? 0x2F : 0x2E)
#define SH1106_START_LINE(N) (0x40 | (N))
#define SH1106_CONTRAST(N) (0x81), (N)
#define SH1106_CHARGE_PUMP(N) (0x8D), ((N) ? 0x14 : 0x10)
#define SH1106_ADC_REVERSE(N) ((N) ? 0xA1 : 0xA0)
#define SH1106_ALL_PIX(N) ((N) ? 0xA5 : 0xA4)
#define SH1106_INVERTED(N) ((N) ? 0xA7 : 0xA6)
#define SH1106_MUX_RATIO(N) (0xA8), (N)
#define SH1106_ON(N) ((N) ? 0xAF : 0xAE)
#define SH1106_OUT_MODE(N) ((N) ? 0xC8 : 0xC0)
#define SH1106_DISP_OFFS(N) (0xD3), (N)
#define SH1106_OSC_FREQ(R,F) (0xD5), ((F) << 4 | (R))
#define SH1106_CHARGE_PER(P,D) (0xD9), ((D) << 4 | (P))
#define SH1106_COM_CONFIG(N) (0xDA), ((N) ? 0x12 : 0x02)
#define SH1106_VCOM_DESEL(N) (0xDB), (N)
#define SH1106_NOOP() (0xE3)
static const uint8_t u8g_dev_ssd13xx_HAL_sleep_on[] PROGMEM = {
U8G_ESC_ADR(0), // Instruction mode
U8G_ESC_CS(1), // Enable chip
SH1106_ON(0) // Display off
U8G_ESC_CS(0), // Disable chip
U8G_ESC_END // End of sequence
};
static const uint8_t u8g_dev_ssd13xx_HAL_sleep_off[] PROGMEM = {
U8G_ESC_ADR(0), // Instruction mode
U8G_ESC_CS(1), // Enable chip
SH1106_ON(1), // Display on
U8G_ESC_DLY(50), // Delay 50 ms
U8G_ESC_CS(0), // Disable chip
U8G_ESC_END // End of sequence
};
#if ENABLED(U8GLIB_SH1106_SPI)
// Init sequence Adafruit 128x64 OLED (NOT TESTED). Like Adafruit3, but with page addressing mode.
static const uint8_t u8g_dev_sh1106_128x64_HAL_init_seq[] PROGMEM = {
U8G_ESC_CS(0), // Disable chip
U8G_ESC_ADR(0), // Instruction mode
U8G_ESC_RST(1), // Do reset low pulse with (1*16)+2 milliseconds
U8G_ESC_CS(1), // Enable chip
SH1106_ON(0), // Display off, sleep mode
SH1106_OSC_FREQ(0, 8), // Clock divide ratio (0:1) and oscillator frequency (8)
SH1106_MUX_RATIO(0x3F), // Mux ratio
SH1106_DISP_OFFS(0), // Display offset
SH1106_START_LINE(0), // Start line
SH1106_CHARGE_PUMP(1), // Charge pump setting
SH1106_PAGE_ADR(0x02), // page addressing mode
SH1106_ADC_REVERSE(1), // Segment remap A0/A1
SH1106_OUT_MODE(1), // 0: scan dir normal, 1: reverse
SH1106_COM_CONFIG(1), // COM pin HW config, sequential com pin config (bit 4), disable left/right remap (bit 5)
SH1106_CONTRAST(0x80), // Set contrast control
SH1106_CHARGE_PER(0x1, 0xF), // Pre-charge period
SH1106_VCOM_DESEL(0x40), // Vcomh deselect level
SH1106_SCROLL(0), // Deactivate scroll
SH1106_ALL_PIX(0), // Output RAM to display
SH1106_INVERTED(0), // Normal display mode
SH1106_ON(1), // Display on
U8G_ESC_CS(0), // Disable chip
U8G_ESC_END // End of sequence
};
// SH1106 (132x64) is compatible with SSD1306 (128x64) by adding a small margin to the larger display
static const uint8_t u8g_dev_sh1106_128x64_HAL_data_start[] PROGMEM = {
U8G_ESC_ADR(0), // Instruction mode
U8G_ESC_CS(1), // Enable chip
SH1106_COL_ADR(2), // Column 2 to center 128 pixels in 132 pixels
U8G_ESC_END // End of sequence
};
uint8_t u8g_dev_sh1106_128x64_HAL_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg) {
switch(msg) {
case U8G_DEV_MSG_INIT:
u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS);
u8g_WriteEscSeqP(u8g, dev, u8g_dev_sh1106_128x64_HAL_init_seq);
break;
case U8G_DEV_MSG_STOP:
break;
case U8G_DEV_MSG_PAGE_NEXT: {
u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
u8g_WriteEscSeqP(u8g, dev, u8g_dev_sh1106_128x64_HAL_data_start);
u8g_WriteByte(u8g, dev, 0x0B0 | pb->p.page); // Select current page (SSD1306)
u8g_SetAddress(u8g, dev, 1); // Data mode
if (u8g_pb_WriteBuffer(pb, u8g, dev) == 0) return 0;
u8g_SetChipSelect(u8g, dev, 0);
} break;
case U8G_DEV_MSG_SLEEP_ON:
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd13xx_HAL_sleep_on);
return 1;
case U8G_DEV_MSG_SLEEP_OFF:
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd13xx_HAL_sleep_off);
return 1;
case U8G_DEV_MSG_CONTRAST:
u8g_SetChipSelect(u8g, dev, 1);
u8g_SetAddress(u8g, dev, 0); // Instruction mode
u8g_WriteByte(u8g, dev, 0x81);
u8g_WriteByte(u8g, dev, *(uint8_t *) arg);
u8g_SetChipSelect(u8g, dev, 0);
return 1;
}
return u8g_dev_pb8v1_base_fn(u8g, dev, msg, arg);
}
U8G_PB_DEV(u8g_dev_sh1106_128x64_HAL_sw_spi, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_sh1106_128x64_HAL_fn, U8G_COM_HAL_SW_SPI_FN);
#elif ENABLED(U8GLIB_SSD1306_SPI)
static const uint8_t u8g_dev_ssd1306_128x64_HAL_init_seq[] PROGMEM = {
U8G_ESC_CS(0), // Disable chip
U8G_ESC_ADR(0), // Instruction mode
U8G_ESC_RST(1), // Do reset low pulse with (1*16)+2 milliseconds
U8G_ESC_CS(1), // Enable chip
SH1106_ON(0), // Display off, sleep mode
SH1106_OSC_FREQ(0, 8), // Clock divide ratio (0:1) and oscillator frequency (8)
SH1106_MUX_RATIO(0x3F), // Mux ratio
SH1106_DISP_OFFS(0), // Display offset
SH1106_START_LINE(0), // Start line
SH1106_CHARGE_PUMP(1), // Charge pump setting
SH1106_PAGE_ADR(0x02), // page addressing mode
SH1106_ADC_REVERSE(1), // Segment remap A0/A1
SH1106_OUT_MODE(1), // 0: scan dir normal, 1: reverse
SH1106_COM_CONFIG(1), // COM pin HW config, sequential com pin config (bit 4), disable left/right remap (bit 5)
SH1106_CONTRAST(0x80), // Set contrast control
SH1106_CHARGE_PER(0x1, 0xF), // Pre-charge period
SH1106_VCOM_DESEL(0x40), // Vcomh deselect level
SH1106_SCROLL(0), // Deactivate scroll
SH1106_ALL_PIX(0), // Output RAM to display
SH1106_INVERTED(0), // Normal display mode
SH1106_ON(1), // Display on
U8G_ESC_CS(0), // Disable chip
U8G_ESC_END // End of sequence
};
static const uint8_t u8g_dev_ssd1306_128x64_HAL_data_start[] PROGMEM = {
U8G_ESC_ADR(0), // Instruction mode
U8G_ESC_CS(1), // Enable chip
SH1106_COL_ADR(0), // Column 0
U8G_ESC_END // End of sequence
};
uint8_t u8g_dev_ssd1306_128x64_HAL_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg) {
switch(msg) {
case U8G_DEV_MSG_INIT:
u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_400NS);
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1306_128x64_HAL_init_seq);
break;
case U8G_DEV_MSG_STOP: break;
case U8G_DEV_MSG_PAGE_NEXT: {
u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1306_128x64_HAL_data_start);
u8g_WriteByte(u8g, dev, 0x0b0 | pb->p.page); // Select current page (SSD1306)
u8g_SetAddress(u8g, dev, 1); // Data mode
if (u8g_pb_WriteBuffer(pb, u8g, dev) == 0) return 0;
u8g_SetChipSelect(u8g, dev, 0);
} break;
case U8G_DEV_MSG_SLEEP_ON:
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd13xx_HAL_sleep_on);
return 1;
case U8G_DEV_MSG_SLEEP_OFF:
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd13xx_HAL_sleep_off);
return 1;
case U8G_DEV_MSG_CONTRAST:
u8g_SetChipSelect(u8g, dev, 1);
u8g_SetAddress(u8g, dev, 0); // Instruction mode
u8g_WriteByte(u8g, dev, 0x81);
u8g_WriteByte(u8g, dev, *(uint8_t *) arg);
u8g_SetChipSelect(u8g, dev, 0);
return 1;
}
return u8g_dev_pb8v1_base_fn(u8g, dev, msg, arg);
}
U8G_PB_DEV(u8g_dev_ssd1306_128x64_HAL_sw_spi, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_ssd1306_128x64_HAL_fn, U8G_COM_HAL_SW_SPI_FN);
#endif // U8GLIB_SSD1306_SPI
#endif // HAS_MARLINUI_U8GLIB
@@ -31,61 +31,83 @@
#define HEIGHT 64
#define PAGE_HEIGHT 8
#define SSD1309_PAGE_ADR(N) (0x20), (N)
#define SSD1309_COL_ADR(N) (0x10 | ((N) >> 4)), ((N) & 0xFF)
#define SSD1309_COLUMN_RANGE(N,O) (0x21), (N), (O)
#define SSD1309_PAGE_RANGE(N,O) (0x22), (N), (O)
#define SSD1309_SCROLL(N) ((N) ? 0x2F : 0x2E)
#define SSD1309_START_LINE(N) (0x40 | (N))
#define SSD1309_CONTRAST(N) (0x81), (N)
#define SSD1309_CHARGE_PUMP(N) (0x8D), ((N) ? 0x14 : 0x10)
#define SSD1309_ADC_REVERSE(N) ((N) ? 0xA1 : 0xA0)
#define SSD1309_ALL_PIX(N) ((N) ? 0xA5 : 0xA4)
#define SSD1309_INVERTED(N) ((N) ? 0xA7 : 0xA6)
#define SSD1309_MUX_RATIO(N) (0xA8), (N)
#define SSD1309_ON(N) ((N) ? 0xAF : 0xAE)
#define SSD1309_OUT_MODE(N) ((N) ? 0xC8 : 0xC0)
#define SSD1309_DISP_OFFS(N) (0xD3), (N)
#define SSD1309_OSC_FREQ(R,F) (0xD5), ((F) << 4 | (R))
#define SSD1309_CHARGE_PER(P,D) (0xD9), ((D) << 4 | (P))
#define SSD1309_COM_CONFIG(N) (0xDA), ((N) ? 0x12 : 0x02)
#define SSD1309_VCOM_DESEL(N) (0xDB), (N)
#define SSD1309_NOOP() (0xE3)
#define SSD1309_COMMAND_LOCK(N) (0xFD), ((N) ? 0x16 : 0x12)
// SSD1309 init sequence
static const uint8_t u8g_dev_ssd1309_128x64_init_seq[] PROGMEM = {
U8G_ESC_CS(0), // Disable chip
U8G_ESC_ADR(0), // Instruction mode
U8G_ESC_RST(1), // Do reset low pulse with (1*16)+2 milliseconds
U8G_ESC_CS(1), // Enable chip
U8G_ESC_CS(0), // Disable chip
U8G_ESC_ADR(0), // Instruction mode
U8G_ESC_RST(1), // Do reset low pulse with (1*16)+2 milliseconds
U8G_ESC_CS(1), // Enable chip
0xFD,0x12, // Command Lock
0xAE, // Set Display Off
0xD5,0xA0, // Set Display Clock Divide Ratio/Oscillator Frequency
0xA8,0x3F, // Set Multiplex Ratio
0x3D,0x00, // Set Display Offset
0x40, // Set Display Start Line
0xA1, // Set Segment Re-Map
0xC8, // Set COM Output Scan Direction
0xDA,0x12, // Set COM Pins Hardware Configuration
0x81,0xDF, // Set Current Control
0xD9,0x82, // Set Pre-Charge Period
0xDB,0x34, // Set VCOMH Deselect Level
0xA4, // Set Entire Display On/Off
0xA6, // Set Normal/Inverse Display
U8G_ESC_VCC(1), // Power up VCC & Stabilized
SSD1309_COMMAND_LOCK(0), // Unlock OLED driver IC MCU command interface
SSD1309_ON(0),
SSD1309_OSC_FREQ(0, 10), // Clock divide ratio (0:1) and oscillator frequency (8)
SSD1309_MUX_RATIO(0x3F), // Mux ratio
SSD1309_DISP_OFFS(0), // Display offset
SSD1309_START_LINE(0), // Start line
SSD1309_ADC_REVERSE(1), // Segment remap A0/A1
SSD1309_OUT_MODE(1), // 0: scan dir normal, 1: reverse
SSD1309_COM_CONFIG(1), // COM pin HW config, sequential com pin config (bit 4), disable left/right remap (bit 5)
SSD1309_CONTRAST(0xDF), // Set contrast control
SSD1309_CHARGE_PER(0x2, 0x8), // Pre-charge period
SSD1309_VCOM_DESEL(0x34), // Vcomh deselect level
SSD1309_ALL_PIX(0), // Output RAM to display
SSD1309_INVERTED(0), // Normal display mode
U8G_ESC_VCC(1), // Power up VCC & stabilize
U8G_ESC_DLY(50),
0xAF, // Set Display On
SSD1309_ON(1), // Display on
U8G_ESC_DLY(50),
U8G_ESC_CS(0), // Disable chip
U8G_ESC_END // End of sequence
U8G_ESC_CS(0), // Disable chip
U8G_ESC_END // End of sequence
};
// Select one init sequence here
#define u8g_dev_ssd1309_128x64_init_seq u8g_dev_ssd1309_128x64_init_seq
static const uint8_t u8g_dev_ssd1309_128x64_data_start[] PROGMEM = {
U8G_ESC_ADR(0), // Instruction mode
U8G_ESC_CS(1), // Enable chip
0x010, // Set upper 4 bit of the col adr to 0
0x000, // Set lower 4 bit of the col adr to 4
U8G_ESC_END // End of sequence
U8G_ESC_ADR(0), // Instruction mode
U8G_ESC_CS(1), // Enable chip
SSD1309_COL_ADR(0), // Column 0
U8G_ESC_END // End of sequence
};
static const uint8_t u8g_dev_ssd13xx_sleep_on[] PROGMEM = {
U8G_ESC_ADR(0), // Instruction mode
U8G_ESC_CS(1), // Enable chip
0x0AE, // Display off
U8G_ESC_CS(0), // Disable chip
U8G_ESC_END // End of sequence
U8G_ESC_ADR(0), // Instruction mode
U8G_ESC_CS(1), // Enable chip
SSD1309_ON(0), // Display off
U8G_ESC_CS(0), // Disable chip
U8G_ESC_END // End of sequence
};
static const uint8_t u8g_dev_ssd13xx_sleep_off[] PROGMEM = {
U8G_ESC_ADR(0), // Instruction mode
U8G_ESC_CS(1), // Enable chip
0x0AF, // Display on
U8G_ESC_DLY(50), // Delay 50 ms
U8G_ESC_CS(0), // Disable chip
U8G_ESC_END // End of sequence
U8G_ESC_ADR(0), // Instruction mode
U8G_ESC_CS(1), // Enable chip
SSD1309_ON(1), // Display on
U8G_ESC_DLY(50), // Delay 50 ms
U8G_ESC_CS(0), // Disable chip
U8G_ESC_END // End of sequence
};
uint8_t u8g_dev_ssd1309_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg) {
@@ -99,7 +121,7 @@ uint8_t u8g_dev_ssd1309_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void
case U8G_DEV_MSG_PAGE_NEXT: {
u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1309_128x64_data_start);
u8g_WriteByte(u8g, dev, 0x0B0 | pb->p.page); // Select current page (SSD1306)
u8g_WriteByte(u8g, dev, 0xB0 | pb->p.page); // Select current page (SSD1306)
u8g_SetAddress(u8g, dev, 1); // Data mode
if (u8g_pb_WriteBuffer(pb, u8g, dev) == 0) return 0;
u8g_SetChipSelect(u8g, dev, 0);
@@ -108,8 +130,8 @@ uint8_t u8g_dev_ssd1309_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void
case U8G_DEV_MSG_CONTRAST:
u8g_SetChipSelect(u8g, dev, 1);
u8g_SetAddress(u8g, dev, 0); // Instruction mode
u8g_WriteByte(u8g, dev, 0x081);
u8g_WriteByte(u8g, dev, (*(uint8_t *)arg) ); // 11 Jul 2015: fixed contrast calculation
u8g_WriteByte(u8g, dev, 0x81);
u8g_WriteByte(u8g, dev, (*(uint8_t *)arg));
u8g_SetChipSelect(u8g, dev, 0);
return 1;
case U8G_DEV_MSG_SLEEP_ON:
@@ -130,7 +130,7 @@ static const uint8_t u8g_dev_uc1701_mini12864_HAL_data_start[] PROGMEM = {
UC1701_V5_RATIO(3), // set V0 voltage resistor ratio to large
UC1701_INDICATOR(0), // indicator disable
UC1701_ON(1), // display on
UC1701_COLUMN_HI(0), // set upper 4 bit of the col adr to 0
UC1701_COLUMN_HI(0), // set upper 4 bits of the col adr to 0
U8G_ESC_END, // end of sequence
U8G_ESC_DLY(5) // delay 5 ms
#else
+2
View File
@@ -1816,6 +1816,8 @@ void hmiSDCardInit() { card.cdroot(); }
// Initialize or re-initialize the LCD
void MarlinUI::init_lcd() { dwinStartup(); }
void MarlinUI::clear_lcd() {}
void MarlinUI::update() {
eachMomentUpdate(); // Status update
hmiSDCardUpdate(); // SD card update
+8 -6
View File
@@ -828,7 +828,7 @@ void JyersDWIN::drawStatusArea(const bool icons/*=false*/) {
}
if (planner.flow_percentage[0] != flow) {
flow = planner.flow_percentage[0];
dwinDrawIntValue(true, true, 0, DWIN_FONT_STAT, getColor(eeprom_settings.status_area_text, COLOR_WHITE), COLOR_BG_BLACK, 3, 116 + 2 * STAT_CHR_W, 417, planner.flow_percentage[0]);
dwinDrawIntValue(true, true, 0, DWIN_FONT_STAT, getColor(eeprom_settings.status_area_text, COLOR_WHITE), COLOR_BG_BLACK, 3, 116 + 2 * STAT_CHR_W, 417, flow);
}
#endif
@@ -2957,11 +2957,11 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra
case ADVANCED_FILSENSORENABLED:
if (draw) {
drawMenuItem(row, ICON_Extruder, GET_TEXT_F(MSG_RUNOUT_SENSOR));
drawCheckbox(row, runout.enabled);
drawCheckbox(row, runout.enabled[0]);
}
else {
runout.enabled ^= true;
drawCheckbox(row, runout.enabled);
drawCheckbox(row, runout.enabled[0]);
}
break;
@@ -3954,11 +3954,11 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra
case TUNE_FILSENSORENABLED:
if (draw) {
drawMenuItem(row, ICON_Extruder, GET_TEXT_F(MSG_RUNOUT_SENSOR));
drawCheckbox(row, runout.enabled);
drawCheckbox(row, runout.enabled[0]);
}
else {
runout.enabled ^= true;
drawCheckbox(row, runout.enabled);
runout.enabled[0] ^= true;
drawCheckbox(row, runout.enabled[0]);
}
break;
#endif
@@ -5155,6 +5155,8 @@ void MarlinUI::init_lcd() {
jyersDWIN.redrawScreen();
}
void MarlinUI::clear_lcd() {}
#if ENABLED(ADVANCED_PAUSE_FEATURE)
void MarlinUI::pause_show_message(const PauseMessage message, const PauseMode mode/*=PAUSE_MODE_SAME*/, const uint8_t extruder/*=active_extruder*/) {
if (mode != PAUSE_MODE_SAME) pause_mode = mode;

Some files were not shown because too many files have changed in this diff Show More