Compare commits

...

209 Commits

Author SHA1 Message Date
Robby Candra 0181e57417 Add a minimum Z change option to power-loss recovery (#13859) 2019-05-02 22:29:05 -05:00
Robby Candra c369477cb0 Fix bug: diveToFile breaks M23 (#13865) 2019-05-02 15:54:24 -05:00
Tanguy Pruvot e5438a9a03 settings: store runout sensor on/off (#13876) 2019-05-02 00:47:26 -05:00
Scott Lahteine e7682eea42 Use Arduino.h include wrapper (#13877) 2019-05-02 00:45:50 -05:00
Tanguy Pruvot 51d1e0f1dd Auto-mount the SDIO SD card (#13879) 2019-05-02 00:45:21 -05:00
Thomas Moore ee243e4edf Fix mixing extruder filament change (#13803) 2019-05-01 21:55:58 -05:00
Scott Lahteine bf54251a10 Finish, improve, clean up FYSETC_MINI_12864 revisions (#13871) 2019-05-01 20:05:29 -05:00
Scott Lahteine 9372e2603c Simpler neopixel comment 2019-05-01 13:55:51 -05:00
Tanguy Pruvot 3272d0db01 Update French language (#13866) 2019-05-01 13:00:07 -05:00
Chris Pepper 95beafa9a2 Fix typo 2019-05-01 16:30:21 +01:00
Ludy 408a5f08dc Update German language (#13853) 2019-05-01 01:25:57 -05:00
Ludy 8a6308b498 Fix config regression
Fix bad commits from around db89fc03
2019-05-01 01:22:40 -05:00
Tanguy Pruvot cf3c746029 Improve French language (#13851) 2019-05-01 01:12:25 -05:00
Clinton James 2740cc64d8 Add SD Release when no SD_DETECT_PIN exists (#13857) 2019-05-01 01:00:21 -05:00
Luu Lac 39ebca6b5f Fix FYSETC, MINIPANEL, MKS_MINI_12864 display (#13864) 2019-05-01 00:37:52 -05:00
Giuliano Zaro 93dcb537ef Update Italian language (#13809) 2019-04-30 20:31:40 -05:00
Roxy-3D 142c8e2fed Remove redundant Frivolous Game Options 2019-04-28 14:03:53 -05:00
Scott Lahteine e43afb1a58 Clean up SKR pins 2019-04-27 14:56:12 +02:00
Scott Lahteine 9ccbd382e7 Update Watchdog description 2019-04-27 14:56:12 +02:00
Scott Lahteine b6279abd30 Better THERMAL_PROTECTION_GRACE_PERIOD
See #13783
2019-04-27 14:40:09 +02:00
chai-md ed9eaa1942 Fix a comment in fwretract.cpp (#13802) 2019-04-26 09:36:29 +02:00
InsanityAutomation 610fb46683 Fix some ExtUI issues (#13799) 2019-04-26 09:32:01 +02:00
Bob-the-Kuhn db89fc0304 Revert "bring my copy up to date"
This reverts commit 503905c628.
2019-04-25 17:38:41 -05:00
Bob-the-Kuhn 503905c628 bring my copy up to date 2019-04-25 12:08:49 -05:00
Bob-the-Kuhn 73726d56b3 Merge branch 'bugfix-2.0.x' of https://github.com/MarlinFirmware/Marlin into bugfix-2.0.x 2019-04-25 12:06:01 -05:00
Scott Lahteine 5051909c3c Update do_select_screen for general use (#13800) 2019-04-24 10:13:44 -05:00
Scott Lahteine 63f6ad3fd2 Basic RAMPS SD_DETECT_PIN override 2019-04-23 18:10:21 -05:00
InsanityAutomation c6632925e3 Force no move on IDEX full control mode (#13797) 2019-04-23 15:20:59 -05:00
Giuliano Zaro e2dd2268e8 Add a Z raise-between-probes to G34 (#13791) 2019-04-23 13:40:55 -05:00
Giuliano Zaro 0f9c49ccba Update Italian language (#13790) 2019-04-23 13:36:05 -05:00
Giuliano Zaro d77ef437db Fix warning for redefined DEBUG_PRINT_P (#13789) 2019-04-23 13:35:02 -05:00
Marcio Teixeira ca7f6ff287 Fix MSG_En messages for consistency (#13788) 2019-04-23 13:31:51 -05:00
Scott Lahteine 6ff81a33c1 Provide JSON values for SOFT_PWM_SCALE 2019-04-22 14:06:14 -05:00
Scott Lahteine 0c4d3e6622 Improve M906 description 2019-04-22 13:48:02 -05:00
Tanguy Pruvot 04ae3ba1fd Major update to French language (#13784) 2019-04-22 13:31:04 -05:00
chai-md 78d7349fd7 Remove extra Z raises in tool change (#13782) 2019-04-21 21:06:46 -05:00
Kajetan Rzepecki 875e673a8c Add HAL-based thermal protection grace period for all heaters (#13778) 2019-04-21 20:50:32 -05:00
Bob Kuhn 81ca5a4cd4 Fix and improve FYSETC LCD support (#13767) 2019-04-21 20:48:53 -05:00
felixstorm 4e35e6c705 Fix SS pin in ESP32 HW SPI (#13781) 2019-04-21 17:15:15 -05:00
felixstorm 4a48b70c0b Fix (re-)defines in HAL_ESP32 (#13780) 2019-04-21 17:14:38 -05:00
João Brázio 44216749c6 Update README.md
Fixes TravisCI shield to point to the correct branch buildroot, removes no longer used shield and adds some new shields.
2019-04-21 02:44:40 +01:00
Ludy 4228fd3e03 Update German language (#13769) 2019-04-20 15:01:56 -05:00
Kajetan Rzepecki 5f70c876ae Fix _temp_error-related compile error (#13768) 2019-04-20 13:57:38 -05:00
Kajetan Rzepecki ea1ee02b53 Disable hardware PWM on ESP32 I2S expander (#13762) 2019-04-20 13:41:17 -05:00
Scott Lahteine bddb776ddb Add chamber max-temp check
Followup to #13756
2019-04-19 22:18:55 -05:00
Marcio Teixeira d0c1eee53b Add extra max-temp safety checks (#13756) 2019-04-19 21:37:12 -05:00
Marcio Teixeira 4ac28ba6b3 Add missing file (#13754) 2019-04-19 20:20:45 -05:00
jmdearras b65cb5704d Fix, improve FYSETC_MINI_12864 support (#13730) 2019-04-19 20:11:51 -05:00
Scott Lahteine 69c333ead9 More universal Formbot pins
Replace `ROXYs_TRex` with pre-defines of the relevant pins at the configuration level.
2019-04-18 21:09:34 -05:00
Scott Lahteine 0a6835fbea More robust HAS_LCD_CONTRAST 2019-04-18 21:09:34 -05:00
Marcio Teixeira 2e3d121ac4 Squelch compiler warning (#13739) 2019-04-18 13:18:49 -05:00
Kajetan Rzepecki d83a7924e6 Fix ESP32 TOGGLE() with I2S expander (#13743) 2019-04-18 13:15:35 -05:00
Jimmy Wennlund e6f6ed76c8 Show UBL Activate/Deactivate menu for current state (#13744) 2019-04-18 13:13:05 -05:00
Marcio Teixeira 08f21335a6 Fix bad opcode in LIGHTWEIGHT_UI; add 32-bit HAL and Due compatibility (#13751) 2019-04-18 13:10:58 -05:00
Kajetan Rzepecki 7c8ee0cd5b Enable more ADC1 channels (pins 32-39) (#13742) 2019-04-18 13:01:24 -05:00
Bob-the-Kuhn 520585c5ed Merge branch 'bugfix-2.0.x' of https://github.com/MarlinFirmware/Marlin into bugfix-2.0.x 2019-04-17 15:34:29 -05:00
Kajetan Rzepecki e1acc09c6e Fix LPC1768 HAL SSD* screen init (#13741) 2019-04-17 14:57:50 -05:00
Marcio Teixeira 836435c5ef Fix action_edit int range bug (#13737) 2019-04-17 14:55:31 -05:00
Antonio Pérez bf28ad4b6c Fix clear of Z position last digit (#13731) 2019-04-17 14:52:20 -05:00
Marcio Teixeira 866e2d41dc Correct range of LCD axis step editing (#13727) 2019-04-16 15:45:31 -05:00
Scott Lahteine ab8052887f Add missing MSG_PAUSE_PRINT_INIT_1 for en 2019-04-16 13:54:20 -05:00
petrzjunior 12d340cf2a Update Czech language (#13729) 2019-04-16 13:53:14 -05:00
Robby Candra e8dc87a2b7 Fix updated Allen Key pause probe logic (#13723) 2019-04-16 12:35:58 -05:00
Robby Candra 7ca1fea22b Option to pause probe deployment only when triggered, for manually-deployed allen-key probe (#13698) 2019-04-16 01:32:43 -05:00
Robby Candra 35160dfb7a Simplify PLR homing when Z homes to max (#13718) 2019-04-16 00:17:27 -05:00
Scott Lahteine 92ed9a2bb6 Fix is_M29
Followup for #13013
2019-04-15 23:47:06 -05:00
jmdearras 5f49b65c1f Move LPC SD options to configs, add MKS_MINI_DISPLAY to SKR boards (#13712) 2019-04-15 22:55:33 -05:00
Bob Kuhn 9b578ca343 Support FYSETC_MINI_12864 on Re-ARM, RAMPS_FD, MKS SBASE (#13717) 2019-04-15 22:54:11 -05:00
Scott Lahteine 9992c424f5 Patch G92.9 flags
Followup to #13703
2019-04-15 20:26:40 -05:00
ManuelMcLure b1c13bce58 Fix EEPROM_CHITCHAT (and debug_out.h) (#13716) 2019-04-15 20:21:26 -05:00
Msq001 455ee23499 Fix, improve Power Loss Recovery (#13703)
- Save and restore workspace offsets
- Add retract and purge (hidden) options
- Always restore axis relative modes
- Use added `G92.9` to do position restores
2019-04-15 18:53:39 -05:00
Laurent df75a606ff Support MKS SGen board (#13694) 2019-04-15 17:03:10 -05:00
Kajetan Rzepecki 20dc45bca7 Refactor, fix ESP32 WebSocketSerial (#13689) 2019-04-15 16:32:20 -05:00
Roman Moravčík db373f130c Update Slovak language (#13692) 2019-04-15 16:14:49 -05:00
Kajetan Rzepecki 6fe90f0324 Define I2S pins for ESP32 (#13714) 2019-04-15 16:13:59 -05:00
InsanityAutomation aa0f7afbe6 Fix call to uninitialized PWM pin, heater 2 overlap (#13674) 2019-04-15 15:57:34 -05:00
Bob-the-Kuhn 57aaa9110b Merge branch 'bugfix-2.0.x' of https://github.com/MarlinFirmware/Marlin into bugfix-2.0.x 2019-04-13 21:14:52 -05:00
Scott Lahteine 6a71df2925 Tweak babystep add_steps 2019-04-13 14:14:26 -05:00
Bob-the-Kuhn 9dd4252b39 Merge branch 'bugfix-2.0.x' of https://github.com/MarlinFirmware/Marlin into bugfix-2.0.x 2019-04-12 22:07:12 -05:00
Marcio Teixeira bdfffee037 Modify Z-offset overlay for clarity (#13660) 2019-04-12 15:43:29 -05:00
Stephan 84273557f9 Move and update heated chamber settings (#13671)
Co-Authored-By: the-real-orca <stephan.veigl@gmail.com>
2019-04-12 15:38:10 -05:00
Ludy 62b4265410 Update German language (#13665) 2019-04-12 14:48:13 -05:00
Scott Lahteine b18316dd37 Fix some spacing 2019-04-12 13:35:42 -05:00
Scott Lahteine f2ba0a5ae7 Tweak some formatting 2019-04-12 13:15:37 -05:00
Scott Lahteine 7e58d33a2e Update some headers 2019-04-12 13:04:04 -05:00
ManuelMcLure 8bc5817559 Save files before starting AutoBuild (#13649) 2019-04-12 12:33:16 -05:00
Giuliano Zaro 64ee064ded Update Italian language (#13661) 2019-04-12 12:22:43 -05:00
Scott Lahteine 14b561f182 Extra AxisEnum values for E0-E5 2019-04-12 12:13:48 -05:00
Robby Candra 9e86fc3831 Require homing to toggle leveling (#13652) 2019-04-11 14:09:41 -05:00
Ludy 9fd3e64ba8 Fix compile error with EXTRUDER>1 (#13651) 2019-04-11 13:58:50 -05:00
Jamie 509dc283f2 Restore declarations of G53-G59 (#13654) 2019-04-11 13:51:05 -05:00
chai-md 2adc37becc MAGNETIC_SWITCHING_TOOLHEAD (#13629) 2019-04-11 13:29:17 -05:00
ManuelMcLure 492883859e Don't protect unused CS pins (#13647) 2019-04-10 21:57:57 -05:00
Scott Lahteine 9898f53361 Fix missing IS_SD_PRINTING 2019-04-10 21:48:16 -05:00
Scott Lahteine 1e59a2ac73 Hide pause/stop unless active printing 2019-04-10 19:46:59 -05:00
Scott Lahteine ae42206500 Fix SD_REPRINT_LAST_SELECTED_FILE 2019-04-10 17:43:08 -05:00
Scott Lahteine d72946a8d7 Fix LPC1768 build with no watchdog
Fix issue mentioned at https://github.com/MarlinFirmware/Marlin/pull/13587#issuecomment-481737509
2019-04-10 17:34:15 -05:00
Scott Lahteine cee3b172b9 Fix Marlin splash screen logic (#13646) 2019-04-10 17:14:57 -05:00
ANMay-ru 052f2ac352 Fix RURAMPS4D baud rate (#13644) 2019-04-10 15:53:21 -05:00
Marcio Teixeira e6ebd30f60 Fix LCD issue on stepper timeout (#13630)
- Remove a re-paint of the status screen on stepper timeout, which would cause a garbled LCD with `LIGHTWEIGHT_UI` and could interrupt whatever else the user might be doing in a submenu (such as playing games!)
- Use the helper function to reset stepper timeout.
2019-04-10 15:51:48 -05:00
klcjr89 a8edd4f6d4 Fix Azteeg X5 MINI BOARD_NAME (#13632)
Co-Authored-By: klcjr89 <klcjr89@users.noreply.github.com>
2019-04-10 15:46:12 -05:00
Scott Lahteine ac81c007a6 Merge pull request #13634 from marcio-ao/pr-remove-extra-stm32-dir
Remove extra STM32 config dir #13622
2019-04-10 15:40:25 -05:00
Marcio Teixeira 610e9cf76a Fix SWITCHING_NOZZLE error (#13633) 2019-04-10 15:22:29 -05:00
Scott Lahteine 3656ef4a2d Rename, step 2 2019-04-10 15:17:38 -05:00
Scott Lahteine 6b8611ad56 Rename, step 1 2019-04-10 15:17:08 -05:00
Scott Lahteine 5018fdacbe Support FYSETC_MINI_12864_PANEL (#13365) 2019-04-09 18:34:29 -05:00
InsanityAutomation 4900c28bf6 Fix IDEX tool-change, and more (#13614) 2019-04-09 18:33:40 -05:00
InsanityAutomation ba31d39f6d Azteeg X5 Mini support (#13425) 2019-04-08 23:10:45 -05:00
ManuelMcLure f9b2b3e4f5 AutoBuild quality-of-life improvements (#13626)
- Assign helpful names to the terminals.
- Bring terminal forward so error messages are seen.
2019-04-08 23:07:57 -05:00
Scott Lahteine 9ea99b49be clean whitespace 2019-04-08 21:49:18 -05:00
Scott Lahteine 9cb5c57b84 Adjustments to ui8tostr_percent 2019-04-08 21:47:50 -05:00
Scott Lahteine 321a5e6580 Fix SD card reselect when scrolled (#13624)
- Change encoder position to 16-bit integer.
- Fix `SD_REPRINT_LAST_SELECTED_FILE` when the screen is scrolled.
2019-04-08 21:10:41 -05:00
Scott Lahteine 0e3c9e726d Set default Raptor runout/caselight pins 2019-04-08 18:18:08 -05:00
Scott Lahteine 5e38d70697 Fix M217 report label, general cleanup 2019-04-08 18:18:08 -05:00
Scott Lahteine fae2b7edc3 Update MMU2 code style 2019-04-08 18:13:42 -05:00
Scott Lahteine c8a83fb122 SPINDLE_LASER_ENABLE => SPINDLE_LASER_ENA 2019-04-08 18:13:41 -05:00
Scott Lahteine 9abe9aff56 Confirm before starting SD print (#13616) 2019-04-08 13:44:35 -05:00
Scott Lahteine 7e0008f5b3 Fix SETCURSOR_RJ 2019-04-07 20:25:54 -05:00
Robby Candra 81c2c3ec11 Continuous filename scrolling (#13609) 2019-04-07 16:58:32 -05:00
Ludy c29820f649 Suppress compile warning (#13612) 2019-04-07 16:53:30 -05:00
Scott Lahteine a2b3ad6d0a Don't override RGB LED pins, by default 2019-04-07 16:42:26 -05:00
swilkens e9d9cf2b5b [2.0.x] Reduce all Creality homing speeds (#13595) 2019-04-06 19:50:02 -05:00
SmallSharky 1de6e7fb9d Fix MKS Robin section in platformio.ini (#13598)
Updated ststm32 version because the old version gives build errors. Added `U8glib-HAL` to ignore list because there are also build errors.
2019-04-06 18:07:21 -05:00
Bob Kuhn 9a56d90150 Fix M43 on LPC176x (#13587)
The real fix. PR #13568 was wrong.
2019-04-06 18:06:07 -05:00
Roxy-3D 9cee81d47e Option to show babysteps total since G28 (#13580) 2019-04-06 18:04:34 -05:00
Scott Lahteine 3221658a78 Adjust park position description 2019-04-05 20:40:50 -05:00
Scott Lahteine 028b78f623 Suppress a compile warning 2019-04-05 20:06:19 -05:00
Scott Lahteine cf12fc8366 Expand on serial debugging (#13577) 2019-04-05 20:02:46 -05:00
Marcio Teixeira bf7b28b456 Fix incorrect variable name (#13585) 2019-04-05 19:04:46 -05:00
Kajetan Rzepecki 27693cec29 Extend ESP32 HardwareSerial with flushTX. (#13588) 2019-04-05 19:04:02 -05:00
Alexander Gavrilenko 3c47e1b4d1 Support Black STM32F407VET6 with RAMPS-like shield (#13524) 2019-04-05 15:30:19 -05:00
VBen 0dfd76ba55 Fix Z hotend offset broken by parking extruder tool change (#13582) 2019-04-05 15:28:32 -05:00
Scott Lahteine 027a901bec Trim whitespace 2019-04-05 15:04:23 -05:00
Kajetan Rzepecki 692a0198f9 Fix SPISettings frequency parameters in ESP32 HW SPI (#13573) 2019-04-04 23:17:14 -05:00
Kajetan Rzepecki 63d95862fa Add FastIO TOGGLE for ESP32 (#13574) 2019-04-04 23:15:17 -05:00
drzejkopf 0992d1a4c8 Fix Invaders game compile error (#13575) 2019-04-04 23:13:11 -05:00
Robby Candra cd1ef33c8c Drop extra PLR save test (#13554) 2019-04-04 22:47:00 -05:00
Scott Lahteine 72c7751768 Fix SERIAL_POS in use with DEBUG_OUT 2019-04-04 22:12:03 -05:00
Scott Lahteine cacec5764a Clean up whitespace 2019-04-04 22:12:02 -05:00
Scott Lahteine 83e214478e Click-hold to exit Invaders, fix Brickout compile 2019-04-04 17:07:50 -05:00
Scott Lahteine 240ea1bbb3 Split up games into separate files 2019-04-04 03:06:19 -05:00
Marcio Teixeira 27a4927ed1 Add option to move away from endstop after homing. (#13557)
Add option to move away from endstop after homing.
- Add `ENDSTOP_BACKOFF` for printers with a recessed Z home button (Lulzbot TAZ 6).
- Also prevents chattering when sensorless homing with axes against bumpers.
2019-04-04 02:47:19 -05:00
InsanityAutomation d44e5b1fde Fix stepper direction macros, multi-nozzle scope (#13569) 2019-04-04 02:44:07 -05:00
Scott Lahteine 10b9632bed Fix menu history item selection 2019-04-04 02:41:23 -05:00
Scott Lahteine f1810689ff Fix bootscreen condition 2019-04-04 00:19:47 -05:00
reloxx13 2d5b93e850 Change to CHOPPER_DEFAULT_24V for Ender 3 (#13565) 2019-04-03 20:30:40 -05:00
Kajetan Rzepecki b21ca53dfc SPIFFS-backed PersistentStore for ESP32 (#13566) 2019-04-03 20:28:26 -05:00
Scott Lahteine af92ee9dd6 No PLR include needed in queue.cpp 2019-04-03 18:26:31 -05:00
Scott Lahteine 5d2c5877f7 DOGM bootscreen cleanup 2019-04-03 18:10:50 -05:00
Scott Lahteine 2aa35e95af More G26 arc cleanup
Followup to #13531
2019-04-03 16:03:21 -05:00
Scott Lahteine 20a41e2f7b SDCARD_RATHERRECENTFIRST with SDCARD_SORT_ALPHA 2019-04-02 22:25:18 -05:00
Robby Candra 46445a5a16 Event G-code for Stop SD Print (#13547)
Co-Authored-By: 7eggert <7eggert@gmx.de>
Co-Authored-By: robbycandra <robbycandra.mail@gmail.com>
2019-04-02 22:09:30 -05:00
Kajetan Rzepecki 2cfa9e9008 Fixed chamber-related compile error (#13552) 2019-04-01 17:53:56 -05:00
Scott Lahteine a0a5c31c05 Power-Loss initialization fix (#13553)
- Only save to PLR file on moves with E and X or Y
- Save to PLR after any long-ish Z downward move
2019-04-01 17:52:45 -05:00
Scott Lahteine 8b7c3eec83 Games, for fun (and stress-testing) (#13464) 2019-04-01 17:48:54 -05:00
InsanityAutomation fbc7b51a24 Use NO_FETCH for Dual X G28 (#13539) 2019-04-01 17:48:21 -05:00
Scott Lahteine 5de7b5b35e Games, for fun (and stress-testing) (#13464) 2019-04-01 15:43:48 -05:00
InsanityAutomation 4961d8aa3e Update G28.cpp (#13539) 2019-03-31 19:50:40 -05:00
Scott Lahteine de0046fc8b Fix empty HAS_TIMER macros 2019-03-30 23:04:40 -05:00
Kajetan Rzepecki c9079165ee Fix MAX6675 readout with Hardware SPI (#13530) 2019-03-30 22:31:49 -05:00
ManuelMcLure 04086fc455 Minor optimization to ARC_SUPPORT code (#13531) 2019-03-30 22:29:37 -05:00
Robby Candra a3f67acd6d Fix Power Loss Recovery file delete (#13522) 2019-03-30 13:14:58 -05:00
Marcio Teixeira d992dfe7d5 Use the percent util func in the string func. (#13523) 2019-03-30 13:00:31 -05:00
drzejkopf b1f739e27b CR10_STOCKDISPLAY support in Bigtreetech SKR (#13516) 2019-03-29 14:19:18 -05:00
Marcio Teixeira 5679fae11e UltraLCD enhancements (lower fan resolution, backlash menu) (#13519) 2019-03-29 14:07:43 -05:00
pinchies de0f35f2d9 Fix platformio.ini for MKS Robin (#13502) 2019-03-29 13:57:19 -05:00
Msq001 f0d14b83bc Save/restore Relative modes in Power-Loss Recovery (#13501) 2019-03-29 13:40:42 -05:00
Marcio Teixeira c6466c23fe Silence signed/unsigned comparison warning. (#13508) 2019-03-29 13:33:45 -05:00
InsanityAutomation 7240e3a68f Allow G26 with no heated bed (#13511) 2019-03-29 13:32:43 -05:00
Alexander Gavrilenko 6d9aaca082 Fix compilation error for MKS Robin (#13506) 2019-03-29 12:40:24 -05:00
Scott Alfter c6dbe6e9d6 Fix Teensy 3.5/3.6 __get_primask (#13514) 2019-03-29 12:23:09 -05:00
Alexander Amelkin e40636a7c1 Replace digitalPinHasPWM with HAS_TIMER (#13520) 2019-03-29 12:21:14 -05:00
Scott Lahteine 5a2c68e995 Update BLTouch 3 text, don't call extraneous functions (#13495) 2019-03-26 19:22:25 -05:00
Scott Lahteine b46ca9aa94 Less timely comment, tweak conditions 2019-03-26 19:20:13 -05:00
InsanityAutomation eb91f08725 Update descriptions and dont call unneeded functions 2019-03-26 11:24:52 -04:00
Ludy fe346cd4d1 Fix DEBUG_EEPROM_READWRITE compile error (#13492) 2019-03-26 04:12:22 -05:00
Sam Lane e3ab54753b Add extra Linear Advance factors (#13490) 2019-03-26 04:02:27 -05:00
Chris Pepper ffc2c2d7c5 Move FAST_PWM_FAN code to HALs (#13491) 2019-03-26 01:03:23 -05:00
Thomas Moore 263f8edff8 Disable volumetric extrusion during G26 (#13479) 2019-03-25 22:41:52 -05:00
Bob Kuhn 6bd0a0be97 Relocate DUE Stepper ISR to TC0,2 (#13481) 2019-03-25 22:39:51 -05:00
Thomas Moore 13a12f8a87 Fix UBL mesh editor on delta (#13478) 2019-03-25 22:04:57 -05:00
Scott Lahteine d2e0c03afb Remove trailing whitespace 2019-03-25 20:51:38 -05:00
Marcio Teixeira 7462fe3068 Fix compile error, squelch warnings (#13487)
- Fix path to `bedlevel.h` include file
- Add default to `case` statements to suppress warnings
2019-03-25 20:41:38 -05:00
Yannik Sembritzki 0d3ea59bcf Add pins for Dual Z UART on SKR 1.3 (#13474)
Fix #13470
2019-03-24 20:09:00 -05:00
pinchies ef3b93daa1 Fix STM32F1 SD-based EEPROM emulation (#13475)
If `openFile` is given `true`, then it has read-only access. Because all the writing occurs on the next line, this breaks SD card as EEPROM.
2019-03-24 20:07:31 -05:00
Chris Pepper aacc1148b0 Fix M106 for index > extruders (#13473) 2019-03-24 20:03:53 -05:00
Thomas Moore c5e96544b5 Fix vtool compiler warning (#13476) 2019-03-24 20:02:28 -05:00
Thomas Moore 02dc72acb6 Disable ABL when leveling corners (#13471) 2019-03-24 20:01:18 -05:00
7eggert d96f7d6068 Minimum segments for G2/G3. Better for small arcs. (#13466) 2019-03-24 19:53:47 -05:00
Scott Lahteine 380c771988 Handle word-padded flash-based eeprom (STM32F1)
Fix #13445
2019-03-24 19:14:04 -05:00
Scott Alfter 32332bcd03 Proceed with Teensy 3.5/3.6 HAL (#13450) 2019-03-24 00:08:32 -05:00
Scott Alfter 407202cc0f Fix BLTouch pre-3.0 compatibility (#13454) 2019-03-23 23:28:15 -05:00
Marcio Teixeira a0ca98f699 Additional ExtUI features (#13449) 2019-03-23 23:09:18 -05:00
Sam Lane a8fa275dc6 Fix Fan 0 responding to all fan speeds (#13444) 2019-03-23 23:00:31 -05:00
InsanityAutomation 5eeffab5e5 Fix BLTouch Menus (#13441) 2019-03-23 22:58:34 -05:00
Scott Lahteine d8329d858d Default argument to defer_status_screen 2019-03-23 16:33:37 -05:00
Giuliano Zaro 9562a02c5a Update Italian language (#13440) 2019-03-20 18:26:55 -05:00
drzejkopf 70e6a3db8a Add LEVEL_CORNERS_HEIGHT to LEVEL_BED_CORNERS (#13439) 2019-03-20 18:26:12 -05:00
Roman Moravčík f3cf95a937 Update Slovak language. (#13435) 2019-03-20 16:37:34 -05:00
Scott Lahteine 144018736a Use USES_Z_MIN_PROBE_ENDSTOP 2019-03-18 16:58:31 -05:00
InsanityAutomation 5b2c37d6c1 Followup to BLTouch (#13422) 2019-03-18 16:31:11 -05:00
InsanityAutomation 3fb8489ae3 EXTUI and UBL compilation fixes (#13420) 2019-03-17 07:57:54 -05:00
Scott Lahteine b376c7e374 Group DISABLED items 2019-03-17 07:56:35 -05:00
Scott Lahteine 58bca67883 Unify status scrolling further 2019-03-17 07:56:35 -05:00
Scott Lahteine c4443f885e finishstatus => finish_status 2019-03-17 07:56:35 -05:00
Urja Rannikko d9f0ed8247 readme: ATmega1284 has 16k of SRAM (#13421) 2019-03-17 06:36:25 -05:00
InsanityAutomation 691e5c3bb8 BLTouch V3.0 support (#13406) 2019-03-17 05:57:25 -05:00
Scott Lahteine 49cf92dc36 Extended condition macros (#13419)
Allow `ENABLED`, `DISABLED`, `PIN_EXISTS`, and `BUTTON_EXISTS` to take multiple arguments. Also add:
- Alias `ANY(...)` for `!DISABLED(...)`
- Alias `ANY_PIN(...)` for `PIN_EXISTS(a) || PIN_EXISTS(b) ...`
- Alias `EITHER(A,B)` for `ANY(...)`
- Alias `ALL(...)` and `BOTH(A,B)` for `ENABLED(...)`
- `NONE(...)` for `DISABLED(...)`
2019-03-16 23:43:06 -05:00
Tobias Frost d20eab4f83 Fix macro in set_color() (#13417) 2019-03-16 19:05:59 -05:00
528 changed files with 24742 additions and 7886 deletions
+59 -26
View File
@@ -218,7 +218,7 @@
*/
//#define MAGNETIC_PARKING_EXTRUDER
#if ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER)
#if EITHER(PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER)
#define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders
#define PARKING_EXTRUDER_GRAB_DISTANCE 1 // (mm) Distance to move beyond the parking point to grab the extruder
@@ -249,13 +249,27 @@
* the E3D Tool Changer. Toolheads are locked with a servo.
*/
//#define SWITCHING_TOOLHEAD
#if ENABLED(SWITCHING_TOOLHEAD)
#define SWITCHING_TOOLHEAD_SERVO_NR 2 // Index of the servo connector
#define SWITCHING_TOOLHEAD_SERVO_ANGLES { 0, 180 } // (degrees) Angles for Lock, Unlock
#define SWITCHING_TOOLHEAD_Y_POS 235 // (mm) Y position of the toolhead dock
#define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis
#define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis
#define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders
/**
* Magnetic Switching Toolhead
*
* Support swappable and dockable toolheads with a magnetic
* docking mechanism using movement and no servo.
*/
//#define MAGNETIC_SWITCHING_TOOLHEAD
#if EITHER(SWITCHING_TOOLHEAD, MAGNETIC_SWITCHING_TOOLHEAD)
#define SWITCHING_TOOLHEAD_Y_POS 235 // (mm) Y position of the toolhead dock
#define SWITCHING_TOOLHEAD_Y_SECURITY 10 // (mm) Security distance Y axis
#define SWITCHING_TOOLHEAD_Y_CLEAR 60 // (mm) Minimum distance from dock for unobstructed X axis
#define SWITCHING_TOOLHEAD_X_POS { 215, 0 } // (mm) X positions for parking the extruders
#if ENABLED(SWITCHING_TOOLHEAD)
#define SWITCHING_TOOLHEAD_SERVO_NR 2 // Index of the servo connector
#define SWITCHING_TOOLHEAD_SERVO_ANGLES { 0, 180 } // (degrees) Angles for Lock, Unlock
#elif ENABLED(MAGNETIC_SWITCHING_TOOLHEAD)
#define SWITCHING_TOOLHEAD_Y_RELEASE 5 // (mm) Security distance Y axis
#define SWITCHING_TOOLHEAD_X_SECURITY -35 // (mm) Security distance X axis
#endif
#endif
/**
@@ -377,7 +391,6 @@
#define TEMP_SENSOR_5 0
#define TEMP_SENSOR_BED 0
#define TEMP_SENSOR_CHAMBER 0
#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system
// Dummy thermistor constant temperature readings, for use with 998 and 999
#define DUMMY_THERMISTOR_998_VALUE 25
@@ -396,8 +409,6 @@
#define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer
#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target
#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target
// Below this temperature the heater will be switched off
// because it probably indicates a broken thermistor wire.
#define HEATER_0_MINTEMP 5
@@ -407,7 +418,6 @@
#define HEATER_4_MINTEMP 5
#define HEATER_5_MINTEMP 5
#define BED_MINTEMP 5
#define CHAMBER_MINTEMP 5
// Above this temperature the heater will be switched off.
// This can protect components from overheating, but NOT from shorts and failures.
@@ -419,7 +429,6 @@
#define HEATER_4_MAXTEMP 275
#define HEATER_5_MAXTEMP 275
#define BED_MAXTEMP 150
#define CHAMBER_MAXTEMP 100
//===========================================================================
//============================= PID Settings ================================
@@ -462,7 +471,7 @@
#endif // PIDTEMP
//===========================================================================
//============================= PID > Bed Temperature Control ===============
//====================== PID > Bed Temperature Control ======================
//===========================================================================
/**
@@ -817,6 +826,17 @@
//#define BLTOUCH
#if ENABLED(BLTOUCH)
//#define BLTOUCH_DELAY 375 // (ms) Enable and increase if needed
/**
* BLTouch V3.0 and newer smart series
* For genuine BLTouch 3.0 sensors. Clones may be confused by 3.0 command angles. YMMV.
* If the pin trigger is not detected, first try swapping the black and white wires then toggle this.
*/
//#define BLTOUCH_V3
#if ENABLED(BLTOUCH_V3)
//#define BLTOUCH_FORCE_5V_MODE
//#define BLTOUCH_FORCE_OPEN_DRAIN_MODE
#endif
#endif
// A probe that is deployed and stowed with a solenoid pin (SOL1_PIN)
@@ -907,6 +927,9 @@
// Before deploy/stow pause for user confirmation
//#define PAUSE_BEFORE_DEPLOY_STOW
#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW)
//#define PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED // For Manual Deploy Allenkey Probe
#endif
/**
* Enable one or more of the following if probing seems unreliable.
@@ -1015,7 +1038,7 @@
#define MAX_SOFTWARE_ENDSTOP_Z
#endif
#if ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS)
#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS)
//#define SOFT_ENDSTOPS_MENU_ITEM // Enable/Disable software endstops from the LCD
#endif
@@ -1108,7 +1131,7 @@
*/
//#define DEBUG_LEVELING_FEATURE
#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL)
#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, AUTO_BED_LEVELING_UBL)
// Gradually reduce leveling correction until a set height is reached,
// at which point movement will be level to the machine's XY plane.
// The height can be set with M420 Z<height>
@@ -1134,7 +1157,7 @@
#endif
#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR)
#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR)
// Set the number of grid points per dimension.
#define GRID_MAX_POINTS_X 3
@@ -1203,7 +1226,7 @@
* Points to probe for all 3-point Leveling procedures.
* Override if the automatically selected points are inadequate.
*/
#if ENABLED(AUTO_BED_LEVELING_3POINT) || ENABLED(AUTO_BED_LEVELING_UBL)
#if EITHER(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL)
//#define PROBE_PT_1_X 15
//#define PROBE_PT_1_Y 180
//#define PROBE_PT_2_X 15
@@ -1230,6 +1253,7 @@
#if ENABLED(LEVEL_BED_CORNERS)
#define LEVEL_CORNERS_INSET 30 // (mm) An inset for corner leveling
#define LEVEL_CORNERS_Z_HOP 4.0 // (mm) Move nozzle up before moving between corners
#define LEVEL_CORNERS_HEIGHT 0.0 // (mm) Z height of nozzle at leveling points
//#define LEVEL_CENTER_TOO // Move to the center after the last corner
#endif
@@ -1401,7 +1425,7 @@
//#define NOZZLE_PARK_FEATURE
#if ENABLED(NOZZLE_PARK_FEATURE)
// Specify a park position as { X, Y, Z }
// Specify a park position as { X, Y, Z_raise }
#define NOZZLE_PARK_POINT { (X_MIN_POS + 10), (Y_MAX_POS - 10), 20 }
#define NOZZLE_PARK_XY_FEEDRATE 100 // (mm/s) X and Y axes feedrate (also used for delta Z axis)
#define NOZZLE_PARK_Z_FEEDRATE 5 // (mm/s) Z axis feedrate (not used for delta printers)
@@ -1881,6 +1905,14 @@
//
//#define MKS_MINI_12864
//
// FYSETC variant of the MINI12864 graphic controller with SD support
// https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8
//
//#define FYSETC_MINI_12864_1_2 // Type C/D/E/F. Simple RGB Backlight (always on)
//#define FYSETC_MINI_12864_2_0 // Type A/B. Discreet RGB Backlight
//#define FYSETC_MINI_12864_2_1 // Type A/B. Neopixel RGB Backlight
//
// Factory display for Creality CR-10
// https://www.aliexpress.com/item/Universal-LCD-12864-3D-Printer-Display-Screen-With-Encoder-For-CR-10-CR-7-Model/32833148327.html
@@ -1983,6 +2015,7 @@
// affecting heaters, and the fan if FAN_SOFT_PWM is enabled.
// However, control resolution will be halved for each increment;
// at zero value, there are 128 effective control positions.
// :[0,1,2,3,4,5,6,7]
#define SOFT_PWM_SCALE 0
// If SOFT_PWM_SCALE is set to a value higher than 0, dithering can
@@ -2037,18 +2070,18 @@
//#define RGB_LED
//#define RGBW_LED
#if ENABLED(RGB_LED) || ENABLED(RGBW_LED)
#define RGB_LED_R_PIN 34
#define RGB_LED_G_PIN 43
#define RGB_LED_B_PIN 35
#define RGB_LED_W_PIN -1
#if EITHER(RGB_LED, RGBW_LED)
//#define RGB_LED_R_PIN 34
//#define RGB_LED_G_PIN 43
//#define RGB_LED_B_PIN 35
//#define RGB_LED_W_PIN -1
#endif
// Support for Adafruit Neopixel LED driver
//#define NEOPIXEL_LED
#if ENABLED(NEOPIXEL_LED)
#define NEOPIXEL_TYPE NEO_GRBW // NEO_GRBW / NEO_GRB - four/three channel driver type (defined in Adafruit_NeoPixel.h)
#define NEOPIXEL_PIN 4 // LED driving pin on motherboard 4 => D4 (EXP2-5 on Printrboard) / 30 => PC7 (EXP3-13 on Rumba)
#define NEOPIXEL_PIN 4 // LED driving pin
#define NEOPIXEL_PIXELS 30 // Number of LEDs in the strip
#define NEOPIXEL_IS_SEQUENTIAL // Sequential display for temperature change - LED by LED. Disable to change all LEDs at once.
#define NEOPIXEL_BRIGHTNESS 127 // Initial brightness (0-255)
@@ -2066,7 +2099,7 @@
* - Change to green once print has finished
* - Turn off after the print has finished and the user has pushed a button
*/
#if ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632) || ENABLED(PCA9533)|| ENABLED(NEOPIXEL_LED)
#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED)
#define PRINTER_EVENT_LEDS
#endif
+69 -24
View File
@@ -50,6 +50,19 @@
#define HEATER_BED_INVERTING true
#endif
/**
* Heated Chamber settings
*/
#if TEMP_SENSOR_CHAMBER
#define CHAMBER_MINTEMP 5
#define CHAMBER_MAXTEMP 60
#define TEMP_CHAMBER_HYSTERESIS 1 // (°C) Temperature proximity considered "close enough" to the target
#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber
//#define CHAMBER_LIMIT_SWITCHING
//#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin
//#define HEATER_CHAMBER_INVERTING false
#endif
#if DISABLED(PIDTEMPBED)
#define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control
#if ENABLED(BED_LIMIT_SWITCHING)
@@ -78,7 +91,7 @@
#define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius
//#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops
#if ENABLED(ADAPTIVE_FAN_SLOWING) && ENABLED(PIDTEMP)
#if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP)
//#define NO_FAN_SLOWING_IN_PID_TUNING // Don't slow fan speed during M303
#endif
@@ -127,8 +140,8 @@
#endif
#if ENABLED(PIDTEMP)
// this adds an experimental additional term to the heating power, proportional to the extrusion speed.
// if Kc is chosen well, the additional required power due to increased melting should be compensated.
// Add an experimental additional term to the heater power, proportional to the extrusion speed.
// A well-chosen Kc value should add just enough power to melt the increased material volume.
//#define PID_EXTRUSION_SCALING
#if ENABLED(PID_EXTRUSION_SCALING)
#define DEFAULT_Kc (100) //heating power=Kc*(e_speed)
@@ -404,20 +417,20 @@
* The inactive carriage is parked automatically to prevent oozing.
* X1 is the left carriage, X2 the right. They park and home at opposite ends of the X axis.
* By default the X2 stepper is assigned to the first unused E plug on the board.
*
*
* The following Dual X Carriage modes can be selected with M605 S<mode>:
*
*
* 0 : (FULL_CONTROL) The slicer has full control over both X-carriages and can achieve optimal travel
* results as long as it supports dual X-carriages. (M605 S0)
*
*
* 1 : (AUTO_PARK) The firmware automatically parks and unparks the X-carriages on tool-change so
* that additional slicer support is not required. (M605 S1)
*
*
* 2 : (DUPLICATION) The firmware moves the second X-carriage and extruder in synchronization with
* the first X-carriage and extruder, to print 2 copies of the same object at the same time.
* Set the constant X-offset and temperature differential with M605 S2 X[offs] R[deg] and
* follow with M605 S2 to initiate duplicated movement.
*
*
* 3 : (MIRRORED) Formbot/Vivedino-inspired mirrored mode in which the second extruder duplicates
* the movement of the first except the second extruder is reversed in the X axis.
* Set the initial X offset and temperature differential with M605 S2 X[offs] R[deg] and
@@ -456,6 +469,7 @@
#define Z_HOME_BUMP_MM 2
#define HOMING_BUMP_DIVISOR { 2, 2, 4 } // Re-Bump Speed Divisor (Divides the Homing Feedrate)
//#define QUICK_HOME // If homing includes X and Y, do a diagonal move initially
//#define HOMING_BACKOFF_MM { 2, 2, 2 } // (mm) Move away from the endstops after homing
// When G28 is called, this option will make Y home before X
//#define HOME_Y_BEFORE_X
@@ -678,6 +692,7 @@
* A (A shifted) B (B shifted) IC
* Smoothie 0x2C (0x58) 0x2D (0x5A) MCP4451
* AZTEEG_X3_PRO 0x2C (0x58) 0x2E (0x5C) MCP4451
* AZTEEG_X5_MINI 0x2C (0x58) 0x2E (0x5C) MCP4451
* AZTEEG_X5_MINI_WIFI 0x58 0x5C MCP4451
* MIGHTYBOARD_REVE 0x2F (0x5E) MCP4018
*/
@@ -770,8 +785,11 @@
// Since the FAT gets out of order with usage, SDCARD_SORT_ALPHA is recommended.
#define SDCARD_RATHERRECENTFIRST
// Add an option in the menu to run all auto#.g files
//#define MENU_ADDAUTOSTART
#define SD_MENU_CONFIRM_START // Confirm the selected SD file before printing
//#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files
#define EVENT_GCODE_SD_STOP "G28XY" // G-code to run on Stop Print (e.g., "G28XY" or "G27")
/**
* Continue after Power-Loss (Creality3D)
@@ -785,6 +803,10 @@
#if ENABLED(POWER_LOSS_RECOVERY)
//#define POWER_LOSS_PIN 44 // Pin to detect power loss
//#define POWER_LOSS_STATE HIGH // State of pin indicating power loss
// Without a POWER_LOSS_PIN the following option helps reduce wear on the SD card,
// especially with "vase mode" printing. Set too high and vases cannot be continued.
#define POWER_LOSS_MIN_Z_CHANGE 0.05 // (mm) Minimum Z change before saving power-loss data
#endif
/**
@@ -887,6 +909,17 @@
// Add an optimized binary file transfer mode, initiated with 'M28 B1'
//#define BINARY_FILE_TRANSFER
// LPC-based boards have on-board SD Card options. Override here or defaults apply.
#ifdef TARGET_LPC1768
//#define LPC_SD_LCD // Use the SD drive in the external LCD controller.
//#define LPC_SD_ONBOARD // Use the SD drive on the control board. (No SD_DETECT_PIN. M21 to init.)
//#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD (as defined in a pins file).
//#define USB_SD_DISABLED // Disable SD Card access over USB (for security).
#if ENABLED(LPC_SD_ONBOARD)
//#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device.
#endif
#endif
#endif // SDSUPPORT
/**
@@ -959,19 +992,28 @@
//#define STATUS_ALT_FAN_BITMAP // Use the alternative fan bitmap
//#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames
//#define STATUS_HEAT_PERCENT // Show heating in a progress bar
//#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash)
// Frivolous Game Options
//#define MARLIN_BRICKOUT
//#define MARLIN_INVADERS
//#define MARLIN_SNAKE
#endif // HAS_GRAPHICAL_LCD
// @section safety
// The hardware watchdog should reset the microcontroller disabling all outputs,
// in case the firmware gets stuck and doesn't do temperature regulation.
/**
* The watchdog hardware timer will do a reset and disable all outputs
* if the firmware gets too overloaded to read the temperature sensors.
*
* If you find that watchdog reboot causes your AVR board to hang forever,
* enable WATCHDOG_RESET_MANUAL to use a custom timer instead of WDTO.
* NOTE: This method is less reliable as it can only catch hangups while
* interrupts are enabled.
*/
#define USE_WATCHDOG
#if ENABLED(USE_WATCHDOG)
// If you have a watchdog reboot in an ArduinoMega2560 then the device will hang forever, as a watchdog reset will leave the watchdog on.
// The "WATCHDOG_RESET_MANUAL" goes around this by not using the hardware reset.
// However, THIS FEATURE IS UNSAFE!, as it will only work if interrupts are disabled. And the code could hang in an interrupt routine with interrupts disabled.
//#define WATCHDOG_RESET_MANUAL
#endif
@@ -995,13 +1037,15 @@
#if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING)
#define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds.
// Note: Extra time may be added to mitigate controller latency.
//#define BABYSTEP_ALWAYS_AVAILABLE // Allow babystepping at all times (not just during movement).
#define BABYSTEP_ALWAYS_AVAILABLE // Allow babystepping at all times (not just during movement).
//#define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle.
#if ENABLED(MOVE_Z_WHEN_IDLE)
#define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size.
#endif
#endif
//#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28
//#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping
#if ENABLED(BABYSTEP_ZPROBE_OFFSET)
//#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets
@@ -1029,13 +1073,14 @@
*/
//#define LIN_ADVANCE
#if ENABLED(LIN_ADVANCE)
#define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed
//#define LA_DEBUG // If enabled, this will generate debug information output over USB.
//#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants
#define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed
//#define LA_DEBUG // If enabled, this will generate debug information output over USB.
#endif
// @section leveling
#if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_UBL)
#if EITHER(MESH_BED_LEVELING, AUTO_BED_LEVELING_UBL)
// Override the mesh area if the automatic (max) area is too large
//#define MESH_MIN_X MESH_INSET
//#define MESH_MIN_Y MESH_INSET
@@ -1069,7 +1114,8 @@
#define ARC_SUPPORT // Disable this feature to save ~3226 bytes
#if ENABLED(ARC_SUPPORT)
#define MM_PER_ARC_SEGMENT 1 // Length of each arc segment
#define N_ARC_CORRECTION 25 // Number of intertpolated segments between corrections
#define MIN_ARC_SEGMENTS 24 // Minimum number of segments in a complete circle
#define N_ARC_CORRECTION 25 // Number of interpolated segments between corrections
//#define ARC_P_CIRCLES // Enable the 'P' parameter to specify complete circles
//#define CNC_WORKSPACE_PLANES // Allow G2/G3 to operate in XY, ZX, or YZ planes
#endif
@@ -1654,7 +1700,7 @@
*/
//#define SENSORLESS_PROBING // TMC2130 only
#if ENABLED(SENSORLESS_HOMING) || ENABLED(SENSORLESS_PROBING)
#if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING)
#define X_STALL_SENSITIVITY 8
#define Y_STALL_SENSITIVITY 8
//#define Z_STALL_SENSITIVITY 8
@@ -1669,8 +1715,7 @@
/**
* You can set your own advanced settings by filling in predefined functions.
* A list of available functions can be found on the library github page
* https://github.com/teemuatlut/TMC2130Stepper
* https://github.com/teemuatlut/TMC2208Stepper
* https://github.com/teemuatlut/TMCStepper
*
* Example:
* #define TMC_ADV() { \
+1 -1
View File
@@ -674,7 +674,7 @@ ASFLAGS := $(CDEFS)
ifeq ($(HARDWARE_VARIANT), archim)
LD_PREFIX = -Wl,--gc-sections,-Map,Marlin.ino.map,--cref,--check-sections,--entry=Reset_Handler,--unresolved-symbols=report-all,--warn-common,--warn-section-align
LD_SUFFIX = $(LDLIBS)
LDFLAGS = -lm -gcc -T$(LDSCRIPT) -u _sbrk -u link -u _close -u _fstat -u _isatty -u _lseek -u _read -u _write -u _exit -u kill -u _getpid
LDFLAGS = -lm -T$(LDSCRIPT) -u _sbrk -u link -u _close -u _fstat -u _isatty -u _lseek -u _read -u _write -u _exit -u kill -u _getpid
else
LD_PREFIX = -Wl,--gc-sections,--relax
LDFLAGS = -lm
+27 -9
View File
@@ -24,14 +24,7 @@
#include <stdint.h>
#include <Arduino.h>
#include <util/delay.h>
#include <avr/eeprom.h>
#include <avr/pgmspace.h>
#include <avr/interrupt.h>
#include <avr/io.h>
#include "../shared/Marduino.h"
#include "../shared/HAL_SPI.h"
#include "fastio_AVR.h"
#include "watchdog_AVR.h"
@@ -43,6 +36,12 @@
#include "MarlinSerial.h"
#endif
#include <util/delay.h>
#include <avr/eeprom.h>
#include <avr/pgmspace.h>
#include <avr/interrupt.h>
#include <avr/io.h>
// --------------------------------------------------------------------------
// Defines
// --------------------------------------------------------------------------
@@ -182,7 +181,7 @@ FORCE_INLINE void HAL_timer_start(const uint8_t timer_num, const uint32_t freque
#define TIMER_OCR_0 OCR0A
#define TIMER_COUNTER_0 TCNT0
#define _CAT(a, ...) a ## __VA_ARGS__
#define _CAT(a,V...) a##V
#define HAL_timer_set_compare(timer, compare) (_CAT(TIMER_OCR_, timer) = compare)
#define HAL_timer_get_compare(timer) _CAT(TIMER_OCR_, timer)
#define HAL_timer_get_count(timer) _CAT(TIMER_COUNTER_, timer)
@@ -372,3 +371,22 @@ inline void HAL_adc_init(void) {
// AVR compatibility
#define strtof strtod
/**
* set_pwm_frequency
* Sets the frequency of the timer corresponding to the provided pin
* as close as possible to the provided desired frequency. Internally
* calculates the required waveform generation mode, prescaler and
* resolution values required and sets the timer registers accordingly.
* NOTE that the frequency is applied to all pins on the timer (Ex OC3A, OC3B and OC3B)
* NOTE that there are limitations, particularly if using TIMER2. (see Configuration_adv.h -> FAST FAN PWM Settings)
*/
void set_pwm_frequency(const pin_t pin, int f_desired);
/**
* set_pwm_duty
* Sets the PWM duty cycle of the provided pin to the provided value
* Optionally allows inverting the duty cycle [default = false]
* Optionally allows changing the maximum size of the provided value to enable finer PWM duty control [default = 255]
*/
void set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t v_size=255, const bool invert=false);
+12 -12
View File
@@ -739,24 +739,24 @@
#endif // !USBCON && (UBRRH || UBRR0H || UBRR1H || UBRR2H || UBRR3H)
#ifdef INTERNAL_SERIAL_PORT
#if defined(INTERNAL_SERIAL_PORT)
ISR(SERIAL_REGNAME(USART,INTERNAL_SERIAL_PORT,_RX_vect)) {
MarlinSerial<MarlinInternalSerialCfg<INTERNAL_SERIAL_PORT>>::store_rxd_char();
}
ISR(SERIAL_REGNAME(USART,INTERNAL_SERIAL_PORT,_RX_vect)) {
MarlinSerial<MarlinInternalSerialCfg<INTERNAL_SERIAL_PORT>>::store_rxd_char();
}
ISR(SERIAL_REGNAME(USART,INTERNAL_SERIAL_PORT,_UDRE_vect)) {
MarlinSerial<MarlinInternalSerialCfg<INTERNAL_SERIAL_PORT>>::_tx_udr_empty_irq();
}
ISR(SERIAL_REGNAME(USART,INTERNAL_SERIAL_PORT,_UDRE_vect)) {
MarlinSerial<MarlinInternalSerialCfg<INTERNAL_SERIAL_PORT>>::_tx_udr_empty_irq();
}
// Preinstantiate
template class MarlinSerial<MarlinInternalSerialCfg<INTERNAL_SERIAL_PORT>>;
// Preinstantiate
template class MarlinSerial<MarlinInternalSerialCfg<INTERNAL_SERIAL_PORT>>;
// Instantiate
MarlinSerial<MarlinInternalSerialCfg<INTERNAL_SERIAL_PORT>> internalSerial;
// Instantiate
MarlinSerial<MarlinInternalSerialCfg<INTERNAL_SERIAL_PORT>> internalSerial;
#endif
// For AT90USB targets use the UART for BT interfacing
#if defined(USBCON) && ENABLED(BLUETOOTH)
HardwareSerial bluetoothSerial;
+1 -1
View File
@@ -276,7 +276,7 @@
#endif // !USBCON
#if defined(INTERNAL_SERIAL_PORT)
#ifdef INTERNAL_SERIAL_PORT
template <uint8_t serial>
struct MarlinInternalSerialCfg {
static constexpr int PORT = serial;
+2 -2
View File
@@ -46,8 +46,8 @@
* Sanity checks for Spindle / Laser
*/
#if ENABLED(SPINDLE_LASER_ENABLE)
#if !PIN_EXISTS(SPINDLE_LASER_ENABLE)
#error "SPINDLE_LASER_ENABLE requires SPINDLE_LASER_ENABLE_PIN."
#if !PIN_EXISTS(SPINDLE_LASER_ENA)
#error "SPINDLE_LASER_ENABLE requires SPINDLE_LASER_ENA_PIN."
#elif SPINDLE_DIR_CHANGE && !PIN_EXISTS(SPINDLE_DIR)
#error "SPINDLE_DIR_PIN not defined."
#elif ENABLED(SPINDLE_LASER_PWM) && PIN_EXISTS(SPINDLE_LASER_PWM)
+250
View File
@@ -0,0 +1,250 @@
#ifdef __AVR__
#include "../../inc/MarlinConfigPre.h"
/**
* get_pwm_timer
* Grabs timer information and registers of the provided pin
* returns Timer struct containing this information
* Used by set_pwm_frequency, set_pwm_duty
*
*/
#if ENABLED(FAST_PWM_FAN)
#include "HAL.h"
struct Timer {
volatile uint8_t* TCCRnQ[3]; // max 3 TCCR registers per timer
volatile uint16_t* OCRnQ[3]; // max 3 OCR registers per timer
volatile uint16_t* ICRn; // max 1 ICR register per timer
uint8_t n; // the timer number [0->5]
uint8_t q; // the timer output [0->2] (A->C)
};
Timer get_pwm_timer(pin_t pin) {
uint8_t q = 0;
switch (digitalPinToTimer(pin)) {
// Protect reserved timers (TIMER0 & TIMER1)
#ifdef TCCR0A
#if !AVR_AT90USB1286_FAMILY
case TIMER0A:
#endif
case TIMER0B:
#endif
#ifdef TCCR1A
case TIMER1A: case TIMER1B:
#endif
break;
#if defined(TCCR2) || defined(TCCR2A)
#ifdef TCCR2
case TIMER2: {
Timer timer = {
/*TCCRnQ*/ { &TCCR2, NULL, NULL},
/*OCRnQ*/ { (uint16_t*)&OCR2, NULL, NULL},
/*ICRn*/ NULL,
/*n, q*/ 2, 0
};
}
#elif defined TCCR2A
#if ENABLED(USE_OCR2A_AS_TOP)
case TIMER2A: break; // protect TIMER2A
case TIMER2B: {
Timer timer = {
/*TCCRnQ*/ { &TCCR2A, &TCCR2B, NULL},
/*OCRnQ*/ { (uint16_t*)&OCR2A, (uint16_t*)&OCR2B, NULL},
/*ICRn*/ NULL,
/*n, q*/ 2, 1
};
return timer;
}
#else
case TIMER2B: ++q;
case TIMER2A: {
Timer timer = {
/*TCCRnQ*/ { &TCCR2A, &TCCR2B, NULL},
/*OCRnQ*/ { (uint16_t*)&OCR2A, (uint16_t*)&OCR2B, NULL},
/*ICRn*/ NULL,
2, q
};
return timer;
}
#endif
#endif
#endif
#ifdef TCCR3A
case TIMER3C: ++q;
case TIMER3B: ++q;
case TIMER3A: {
Timer timer = {
/*TCCRnQ*/ { &TCCR3A, &TCCR3B, &TCCR3C},
/*OCRnQ*/ { &OCR3A, &OCR3B, &OCR3C},
/*ICRn*/ &ICR3,
/*n, q*/ 3, q
};
return timer;
}
#endif
#ifdef TCCR4A
case TIMER4C: ++q;
case TIMER4B: ++q;
case TIMER4A: {
Timer timer = {
/*TCCRnQ*/ { &TCCR4A, &TCCR4B, &TCCR4C},
/*OCRnQ*/ { &OCR4A, &OCR4B, &OCR4C},
/*ICRn*/ &ICR4,
/*n, q*/ 4, q
};
return timer;
}
#endif
#ifdef TCCR5A
case TIMER5C: ++q;
case TIMER5B: ++q;
case TIMER5A: {
Timer timer = {
/*TCCRnQ*/ { &TCCR5A, &TCCR5B, &TCCR5C},
/*OCRnQ*/ { &OCR5A, &OCR5B, &OCR5C },
/*ICRn*/ &ICR5,
/*n, q*/ 5, q
};
return timer;
}
#endif
}
Timer timer = {
/*TCCRnQ*/ { NULL, NULL, NULL},
/*OCRnQ*/ { NULL, NULL, NULL},
/*ICRn*/ NULL,
0, 0
};
return timer;
}
void set_pwm_frequency(const pin_t pin, int f_desired) {
Timer timer = get_pwm_timer(pin);
if (timer.n == 0) return; // Don't proceed if protected timer or not recognised
uint16_t size;
if (timer.n == 2) size = 255; else size = 65535;
uint16_t res = 255; // resolution (TOP value)
uint8_t j = 0; // prescaler index
uint8_t wgm = 1; // waveform generation mode
// Calculating the prescaler and resolution to use to achieve closest frequency
if (f_desired != 0) {
int f = (F_CPU) / (2 * 1024 * size) + 1; // Initialize frequency as lowest (non-zero) achievable
uint16_t prescaler[] = { 0, 1, 8, /*TIMER2 ONLY*/32, 64, /*TIMER2 ONLY*/128, 256, 1024 };
// loop over prescaler values
for (uint8_t i = 1; i < 8; i++) {
uint16_t res_temp_fast = 255, res_temp_phase_correct = 255;
if (timer.n == 2) {
// No resolution calculation for TIMER2 unless enabled USE_OCR2A_AS_TOP
#if ENABLED(USE_OCR2A_AS_TOP)
const uint16_t rtf = (F_CPU) / (prescaler[i] * f_desired);
res_temp_fast = rtf - 1;
res_temp_phase_correct = rtf / 2;
#endif
}
else {
// Skip TIMER2 specific prescalers when not TIMER2
if (i == 3 || i == 5) continue;
const uint16_t rtf = (F_CPU) / (prescaler[i] * f_desired);
res_temp_fast = rtf - 1;
res_temp_phase_correct = rtf / 2;
}
LIMIT(res_temp_fast, 1u, size);
LIMIT(res_temp_phase_correct, 1u, size);
// Calculate frequencies of test prescaler and resolution values
const int f_temp_fast = (F_CPU) / (prescaler[i] * (1 + res_temp_fast)),
f_temp_phase_correct = (F_CPU) / (2 * prescaler[i] * res_temp_phase_correct),
f_diff = ABS(f - f_desired),
f_fast_diff = ABS(f_temp_fast - f_desired),
f_phase_diff = ABS(f_temp_phase_correct - f_desired);
// If FAST values are closest to desired f
if (f_fast_diff < f_diff && f_fast_diff <= f_phase_diff) {
// Remember this combination
f = f_temp_fast;
res = res_temp_fast;
j = i;
// Set the Wave Generation Mode to FAST PWM
if (timer.n == 2) {
wgm = (
#if ENABLED(USE_OCR2A_AS_TOP)
WGM2_FAST_PWM_OCR2A
#else
WGM2_FAST_PWM
#endif
);
}
else wgm = WGM_FAST_PWM_ICRn;
}
// If PHASE CORRECT values are closes to desired f
else if (f_phase_diff < f_diff) {
f = f_temp_phase_correct;
res = res_temp_phase_correct;
j = i;
// Set the Wave Generation Mode to PWM PHASE CORRECT
if (timer.n == 2) {
wgm = (
#if ENABLED(USE_OCR2A_AS_TOP)
WGM2_PWM_PC_OCR2A
#else
WGM2_PWM_PC
#endif
);
}
else wgm = WGM_PWM_PC_ICRn;
}
}
}
_SET_WGMnQ(timer.TCCRnQ, wgm);
_SET_CSn(timer.TCCRnQ, j);
if (timer.n == 2) {
#if ENABLED(USE_OCR2A_AS_TOP)
_SET_OCRnQ(timer.OCRnQ, 0, res); // Set OCR2A value (TOP) = res
#endif
}
else
_SET_ICRn(timer.ICRn, res); // Set ICRn value (TOP) = res
}
void set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t v_size/*=255*/, const bool invert/*=false*/) {
// If v is 0 or v_size (max), digitalWrite to LOW or HIGH.
// Note that digitalWrite also disables pwm output for us (sets COM bit to 0)
if (v == 0)
digitalWrite(pin, invert);
else if (v == v_size)
digitalWrite(pin, !invert);
else {
Timer timer = get_pwm_timer(pin);
if (timer.n == 0) return; // Don't proceed if protected timer or not recognised
// Set compare output mode to CLEAR -> SET or SET -> CLEAR (if inverted)
_SET_COMnQ(timer.TCCRnQ, (timer.q
#ifdef TCCR2
+ (timer.q == 2) // COM20 is on bit 4 of TCCR2, thus requires q + 1 in the macro
#endif
), COM_CLEAR_SET + invert
);
uint16_t top;
if (timer.n == 2) { // if TIMER2
top = (
#if ENABLED(USE_OCR2A_AS_TOP)
*timer.OCRnQ[0] // top = OCR2A
#else
255 // top = 0xFF (max)
#endif
);
}
else
top = *timer.ICRn; // top = ICRn
_SET_OCRnQ(timer.OCRnQ, timer.q, v * float(top / v_size)); // Scale 8/16-bit v to top value
}
}
#endif // FAST_PWM_FAN
#endif // __AVR__
+1 -1
View File
@@ -30,7 +30,7 @@
#ifdef FASTIO_EXT_START
#include <Arduino.h>
#include "../shared/Marduino.h"
#define _IS_EXT(P) WITHIN(P, FASTIO_EXT_START, FASTIO_EXT_END)
+12 -12
View File
@@ -81,9 +81,9 @@
#define _SET_INPUT(IO) CBI(DIO ## IO ## _DDR, DIO ## IO ## _PIN)
#define _SET_OUTPUT(IO) SBI(DIO ## IO ## _DDR, DIO ## IO ## _PIN)
#define _GET_INPUT(IO) !TEST(DIO ## IO ## _DDR, DIO ## IO ## _PIN)
#define _GET_OUTPUT(IO) TEST(DIO ## IO ## _DDR, DIO ## IO ## _PIN)
#define _GET_TIMER(IO) DIO ## IO ## _PWM
#define _IS_INPUT(IO) !TEST(DIO ## IO ## _DDR, DIO ## IO ## _PIN)
#define _IS_OUTPUT(IO) TEST(DIO ## IO ## _DDR, DIO ## IO ## _PIN)
#define _HAS_TIMER(IO) DIO ## IO ## _PWM
// digitalRead/Write wrappers
#ifdef FASTIO_EXT_START
@@ -104,9 +104,9 @@
#define SET_PWM(IO) SET_OUTPUT(IO)
#define GET_INPUT(IO) _GET_INPUT(IO)
#define GET_OUTPUT(IO) _GET_OUTPUT(IO)
#define GET_TIMER(IO) _GET_TIMER(IO)
#define IS_INPUT(IO) _IS_INPUT(IO)
#define IS_OUTPUT(IO) _IS_OUTPUT(IO)
#define HAS_TIMER(IO) _HAS_TIMER(IO)
#define OUT_WRITE(IO,V) do{ SET_OUTPUT(IO); WRITE(IO,V); }while(0)
@@ -200,7 +200,7 @@ enum ClockSource2 : char {
TCCR##T##B = (TCCR##T##B & ~(0x3 << WGM##T##2)) | (((int(V) >> 2) & 0x3) << WGM##T##2); \
}while(0)
#define SET_WGM(T,V) _SET_WGM(T,WGM_##V)
// Runtime (see Temperature::set_pwm_frequency):
// Runtime (see set_pwm_frequency):
#define _SET_WGMnQ(TCCRnQ, V) do{ \
*(TCCRnQ)[0] = (*(TCCRnQ)[0] & ~(0x3 << 0)) | (( int(V) & 0x3) << 0); \
*(TCCRnQ)[1] = (*(TCCRnQ)[1] & ~(0x3 << 3)) | (((int(V) >> 2) & 0x3) << 3); \
@@ -230,7 +230,7 @@ enum ClockSource2 : char {
#define SET_CS4(V) _SET_CS4(CS_##V)
#define SET_CS5(V) _SET_CS5(CS_##V)
#define SET_CS(T,V) SET_CS##T(V)
// Runtime (see Temperature::set_pwm_frequency)
// Runtime (see set_pwm_frequency)
#define _SET_CSn(TCCRnQ, V) do{ \
(*(TCCRnQ)[1] = (*(TCCRnQ[1]) & ~(0x7 << 0)) | ((int(V) & 0x7) << 0)); \
}while(0)
@@ -243,19 +243,19 @@ enum ClockSource2 : char {
#define SET_COMB(T,V) SET_COM(T,B,V)
#define SET_COMC(T,V) SET_COM(T,C,V)
#define SET_COMS(T,V1,V2,V3) do{ SET_COMA(T,V1); SET_COMB(T,V2); SET_COMC(T,V3); }while(0)
// Runtime (see Temperature::set_pwm_duty)
// Runtime (see set_pwm_duty)
#define _SET_COMnQ(TCCRnQ, Q, V) do{ \
(*(TCCRnQ)[0] = (*(TCCRnQ)[0] & ~(0x3 << (6-2*(Q)))) | (int(V) << (6-2*(Q)))); \
}while(0)
// Set OCRnQ register
// Runtime (see Temperature::set_pwm_duty):
// Runtime (see set_pwm_duty):
#define _SET_OCRnQ(OCRnQ, Q, V) do{ \
(*(OCRnQ)[(Q)] = (0x0000) | (int(V) & 0xFFFF)); \
}while(0)
// Set ICRn register (one per timer)
// Runtime (see Temperature::set_pwm_frequency)
// Runtime (see set_pwm_frequency)
#define _SET_ICRn(ICRn, V) do{ \
(*(ICRn) = (0x0000) | (int(V) & 0xFFFF)); \
}while(0)
@@ -286,7 +286,7 @@ enum ClockSource2 : char {
#define PWM_CHK_FAN_B(P) (P == E0_AUTO_FAN_PIN || P == E1_AUTO_FAN_PIN || P == E2_AUTO_FAN_PIN || P == E3_AUTO_FAN_PIN || P == E4_AUTO_FAN_PIN || P == E5_AUTO_FAN_PIN || P == CHAMBER_AUTO_FAN_PIN)
#endif
#if PIN_EXISTS(FAN) || PIN_EXISTS(FAN1) || PIN_EXISTS(FAN2)
#if ANY_PIN(FAN, FAN1, FAN2)
#if PIN_EXISTS(FAN2)
#define PWM_CHK_FAN_A(P) (P == FAN_PIN || P == FAN1_PIN || P == FAN2_PIN)
#elif PIN_EXISTS(FAN1)
@@ -23,7 +23,7 @@
#include "../../inc/MarlinConfig.h"
#if ENABLED(EEPROM_SETTINGS) || ENABLED(SD_FIRMWARE_UPDATE)
#if EITHER(EEPROM_SETTINGS, SD_FIRMWARE_UPDATE)
#include "../shared/persistent_store_api.h"
+1 -1
View File
@@ -58,8 +58,8 @@
#if HAS_SERVOS
#include <avr/interrupt.h>
#include <Arduino.h>
#include "../shared/Marduino.h"
#include "../shared/servo.h"
#include "../shared/servo_private.h"
+2 -2
View File
@@ -38,7 +38,7 @@ void watchdog_init() {
#define WDTO_NS WDTO_4S
#endif
#if ENABLED(WATCHDOG_RESET_MANUAL)
// We enable the watchdog timer, but only for the interrupt.
// Enable the watchdog timer, but only for the interrupt.
// Take care, as this requires the correct order of operation, with interrupts disabled.
// See the datasheet of any AVR chip for details.
wdt_reset();
@@ -65,7 +65,7 @@ void watchdog_init() {
SERIAL_ERROR_MSG(MSG_WATCHDOG_FIRED);
minkill(); // interrupt-safe final kill and infinite loop
}
#endif // WATCHDOG_RESET_MANUAL
#endif
#endif // USE_WATCHDOG
#endif // __AVR__
@@ -34,9 +34,9 @@
#include "../shared/persistent_store_api.h"
#include "../../inc/MarlinConfig.h"
#if ENABLED(EEPROM_SETTINGS) && DISABLED(I2C_EEPROM) && DISABLED(SPI_EEPROM)
#if ENABLED(EEPROM_SETTINGS) && DISABLED(I2C_EEPROM, SPI_EEPROM)
#include <Arduino.h>
#include "../shared/Marduino.h"
#define EEPROMSize 4096
#define PagesPerGroup 128
@@ -997,5 +997,5 @@ void eeprom_flush(void) {
ee_Flush();
}
#endif // ENABLED(EEPROM_SETTINGS) && DISABLED(I2C_EEPROM) && DISABLED(SPI_EEPROM)
#endif // EEPROM_SETTINGS && (!I2C_EEPROM && !SPI_EEPROM)
#endif // ARDUINO_ARCH_AVR
+3 -4
View File
@@ -29,16 +29,15 @@
#define CPU_32_BIT
#include <stdint.h>
#include <Arduino.h>
#include "../shared/Marduino.h"
#include "../shared/math_32bit.h"
#include "../shared/HAL_SPI.h"
#include "fastio_Due.h"
#include "watchdog_Due.h"
#include "HAL_timers_Due.h"
#include <stdint.h>
// Serial ports
#if !WITHIN(SERIAL_PORT, -1, 3)
#error "SERIAL_PORT must be from -1 to 3"
+40 -4
View File
@@ -53,7 +53,7 @@
// Public functions
// --------------------------------------------------------------------------
#if ENABLED(DUE_SOFTWARE_SPI)
#if EITHER(DUE_SOFTWARE_SPI, FORCE_SOFT_SPI)
// --------------------------------------------------------------------------
// software SPI
@@ -739,7 +739,42 @@
#define SPI_MODE_2_DUE_HW 0
#define SPI_MODE_3_DUE_HW 1
/**
* The DUE SPI controller is set up so the upper word of the longword
* written to the transmit data register selects which SPI Chip Select
* Register is used. This allows different streams to have different SPI
* settings.
*
* In practice it's spooky. Some combinations hang the system, while others
* upset the peripheral device.
*
* SPI mode should be the same for all streams. The FYSETC_MINI_12864 gets
* upset if the clock phase changes after chip select goes active.
*
* SPI_CSR_CSAAT should be set for all streams. If not the WHILE_TX(0)
* macro returns immediately which can result in the SPI chip select going
* inactive before all the data has been sent.
*
* The TMC2130 library uses SPI0->SPI_CSR[3].
*
* The U8G hardware SPI uses SPI0->SPI_CSR[0]. The system hangs and/or the
* FYSETC_MINI_12864 gets upset if lower baud rates are used and the SD card
* is inserted or removed.
*
* The SD card uses SPI0->SPI_CSR[3]. Efforts were made to use [1] and [2]
* but they all resulted in hangs or garbage on the LCD.
*
* The SPI controlled chip selects are NOT enabled in the GPIO controller.
* The application must control the chip select.
*
* All of the above can be avoided by defining FORCE_SOFT_SPI to force the
* display to use software SPI.
*
*/
void spiInit(uint8_t spiRate=6) { // Default to slowest rate if not specified)
// Also sets U8G SPI rate to 4MHz and the SPI mode to 3
// 8.4 MHz, 4 MHz, 2 MHz, 1 MHz, 0.5 MHz, 0.329 MHz, 0.329 MHz
constexpr int spiDivider[] = { 10, 21, 42, 84, 168, 255, 255 };
if (spiRate > 6) spiRate = 1;
@@ -760,15 +795,16 @@
// TMC2103 compatible setup
// Master mode, no fault detection, PCS bits in data written to TDR select CSR register
SPI0->SPI_MR = SPI_MR_MSTR | SPI_MR_PS | SPI_MR_MODFDIS;
// SPI mode 0, 8 Bit data transfer, baud rate
SPI0->SPI_CSR[3] = SPI_CSR_SCBR(spiDivider[spiRate]) | SPI_CSR_CSAAT | SPI_MODE_0_DUE_HW; // use same CSR as TMC2130
// SPI mode 3, 8 Bit data transfer, baud rate
SPI0->SPI_CSR[3] = SPI_CSR_SCBR(spiDivider[spiRate]) | SPI_CSR_CSAAT | SPI_MODE_3_DUE_HW; // use same CSR as TMC2130
SPI0->SPI_CSR[0] = SPI_CSR_SCBR(spiDivider[1]) | SPI_CSR_CSAAT | SPI_MODE_3_DUE_HW; // U8G default to 4MHz
}
void spiBegin() { spiInit(); }
static uint8_t spiTransfer(uint8_t data) {
WHILE_TX(0);
SPI0->SPI_TDR = (uint32_t)data | 0x00070000UL; // Add TMC2130 PCS bits to every byte
SPI0->SPI_TDR = (uint32_t)data | 0x00070000UL; // Add TMC2130 PCS bits to every byte (use SPI0->SPI_CSR[3])
WHILE_TX(0);
WHILE_RX(0);
return SPI0->SPI_RDR;
+2 -2
View File
@@ -63,8 +63,8 @@
const tTimerConfig TimerConfig [NUM_HARDWARE_TIMERS] = {
{ TC0, 0, TC0_IRQn, 3}, // 0 - [servo timer5]
{ TC0, 1, TC1_IRQn, 0}, // 1
{ TC0, 2, TC2_IRQn, 0}, // 2
{ TC1, 0, TC3_IRQn, 2}, // 3 - stepper
{ TC0, 2, TC2_IRQn, 2}, // 2 - stepper
{ TC1, 0, TC3_IRQn, 0}, // 3
{ TC1, 1, TC4_IRQn, 15}, // 4 - temperature
{ TC1, 2, TC5_IRQn, 3}, // 5 - [servo timer3]
{ TC2, 0, TC6_IRQn, 14}, // 6 - tone
+2 -2
View File
@@ -43,7 +43,7 @@ typedef uint32_t hal_timer_t;
#define HAL_TIMER_RATE ((F_CPU) / 2) // frequency of timers peripherals
#define STEP_TIMER_NUM 3 // index of timer to use for stepper
#define STEP_TIMER_NUM 2 // index of timer to use for stepper
#define TEMP_TIMER_NUM 4 // index of timer to use for temperature
#define PULSE_TIMER_NUM STEP_TIMER_NUM
#define TONE_TIMER_NUM 6 // index of timer to use for beeper tones
@@ -65,7 +65,7 @@ typedef uint32_t hal_timer_t;
#define ENABLE_TEMPERATURE_INTERRUPT() HAL_timer_enable_interrupt(TEMP_TIMER_NUM)
#define DISABLE_TEMPERATURE_INTERRUPT() HAL_timer_disable_interrupt(TEMP_TIMER_NUM)
#define HAL_STEP_TIMER_ISR() void TC3_Handler()
#define HAL_STEP_TIMER_ISR() void TC2_Handler()
#define HAL_TEMP_TIMER_ISR() void TC4_Handler()
#define HAL_TONE_TIMER_ISR() void TC6_Handler()
+4
View File
@@ -50,3 +50,7 @@
#error "DUE software SPI is required but is incompatible with TMC2130 hardware SPI. Enable TMC_USE_SW_SPI to fix."
#endif
#endif
#if ENABLED(FAST_PWM_FAN)
#error "FAST_PWM_FAN is not yet implemented for this platform."
#endif
+1 -1
View File
@@ -44,7 +44,7 @@
#if HAS_SERVOS
#include <Arduino.h>
#include "../shared/Marduino.h"
#include "../shared/servo.h"
#include "../shared/servo_private.h"
+3 -3
View File
@@ -177,11 +177,11 @@
#define SET_PWM(IO) SET_OUTPUT(IO)
// Check if pin is an input
#define GET_INPUT(IO) ((digitalPinToPort(IO)->PIO_OSR & digitalPinToBitMask(IO)) == 0)
#define IS_INPUT(IO) ((digitalPinToPort(IO)->PIO_OSR & digitalPinToBitMask(IO)) == 0)
// Check if pin is an output
#define GET_OUTPUT(IO) ((digitalPinToPort(IO)->PIO_OSR & digitalPinToBitMask(IO)) != 0)
#define IS_OUTPUT(IO) ((digitalPinToPort(IO)->PIO_OSR & digitalPinToBitMask(IO)) != 0)
// Check if pin is a timer - Must be a constexpr
#define GET_TIMER(IO) ((IO) >= 2 && (IO) <= 13)
#define HAS_TIMER(IO) ((IO) >= 2 && (IO) <= 13)
// Shorthand
#define OUT_WRITE(IO,V) { SET_OUTPUT(IO); WRITE(IO,V); }
@@ -29,7 +29,7 @@
#include "../../inc/MarlinConfig.h"
#include "../shared/persistent_store_api.h"
#if DISABLED(I2C_EEPROM) && DISABLED(SPI_EEPROM)
#if DISABLED(I2C_EEPROM, SPI_EEPROM)
#define E2END 0xFFF // Default to Flash emulated EEPROM size (EepromEmulation_Due.cpp)
#endif
@@ -38,7 +38,7 @@ extern void eeprom_flush(void);
bool PersistentStore::access_start() { return true; }
bool PersistentStore::access_finish() {
#if DISABLED(I2C_EEPROM) && DISABLED(SPI_EEPROM)
#if DISABLED(I2C_EEPROM, SPI_EEPROM)
eeprom_flush();
#endif
return true;
+1 -1
View File
@@ -28,7 +28,7 @@
* Translation of routines & variables used by pinsDebug.h
*/
#include <Arduino.h>
#include "../shared/Marduino.h"
/**
* Due/Marlin quirks
@@ -66,20 +66,20 @@
#include "../../Marlin.h"
#define SPI_FULL_SPEED 0
#define SPI_HALF_SPEED 1
#define SPI_QUARTER_SPEED 2
#define SPI_EIGHTH_SPEED 3
#define SPI_FULL_SPEED 0
#define SPI_HALF_SPEED 1
#define SPI_QUARTER_SPEED 2
#define SPI_EIGHTH_SPEED 3
#define SPI_SIXTEENTH_SPEED 4
#define SPI_SPEED_5 5
#define SPI_SPEED_6 6
#define SPI_SPEED_5 5
#define SPI_SPEED_6 6
void spiBegin();
void spiInit(uint8_t spiRate);
void spiSend(uint8_t b);
void spiSend(const uint8_t* buf, size_t n);
#include <Arduino.h>
#include "../shared/Marduino.h"
#include "fastio_Due.h"
void u8g_SetPIOutput_DUE_hw_spi(u8g_t *u8g, uint8_t pin_index) {
@@ -59,10 +59,11 @@
#if HAS_GRAPHICAL_LCD
#include <U8glib.h>
#include <Arduino.h>
#include "../shared/Marduino.h"
#include "../shared/Delay.h"
#include <U8glib.h>
void u8g_SetPIOutput_DUE(u8g_t *u8g, uint8_t pin_index) {
PIO_Configure(g_APinDescription[u8g->pin_list[pin_index]].pPort, PIO_OUTPUT_1,
g_APinDescription[u8g->pin_list[pin_index]].ulPin, g_APinDescription[u8g->pin_list[pin_index]].ulPinConfiguration); // OUTPUT
@@ -99,7 +100,7 @@ static void u8g_com_DUE_st7920_write_byte_sw_spi(uint8_t rs, uint8_t val) {
spiSend_sw_DUE(rs ? 0x0FA : 0x0F8); // Command or Data
DELAY_US(40); // give the controller some time to process the data: 20 is bad, 30 is OK, 40 is safe
}
spiSend_sw_DUE(val & 0x0F0);
spiSend_sw_DUE(val & 0xF0);
spiSend_sw_DUE(val << 4);
}
@@ -168,6 +169,42 @@ uint8_t u8g_com_HAL_DUE_ST7920_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_va
return 1;
}
#endif // HAS_GRAPHICAL_LCD
#if ENABLED(LIGHTWEIGHT_UI)
#include "../../lcd/ultralcd.h"
#include "../shared/HAL_ST7920.h"
#define ST7920_CS_PIN LCD_PINS_RS
#if DOGM_SPI_DELAY_US > 0
#define U8G_DELAY() DELAY_US(DOGM_SPI_DELAY_US)
#else
#define U8G_DELAY() DELAY_US(10)
#endif
void ST7920_cs() {
WRITE(ST7920_CS_PIN, HIGH);
U8G_DELAY();
}
void ST7920_ncs() {
WRITE(ST7920_CS_PIN, LOW);
}
void ST7920_set_cmd() {
spiSend_sw_DUE(0xF8);
DELAY_US(40);
}
void ST7920_set_dat() {
spiSend_sw_DUE(0xFA);
DELAY_US(40);
}
void ST7920_write_byte(const uint8_t val) {
spiSend_sw_DUE(val & 0xF0);
spiSend_sw_DUE(val << 4);
}
#endif // LIGHTWEIGHT_UI
#endif // HAS_GRAPHICAL_LCD
#endif // ARDUINO_ARCH_SAM
@@ -0,0 +1,33 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2019 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 <http://www.gnu.org/licenses/>.
*
*/
#include "FlushableHardwareSerial.h"
#ifdef ARDUINO_ARCH_ESP32
FlushableHardwareSerial::FlushableHardwareSerial(int uart_nr)
: HardwareSerial(uart_nr)
{}
FlushableHardwareSerial flushableSerial(0);
#endif // ARDUINO_ARCH_ESP32
@@ -0,0 +1,36 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2019 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 <http://www.gnu.org/licenses/>.
*
*/
#ifdef ARDUINO_ARCH_ESP32
#include <HardwareSerial.h>
class FlushableHardwareSerial : public HardwareSerial {
public:
FlushableHardwareSerial(int uart_nr);
inline void flushTX(void) { /* No need to flush the hardware serial, but defined here for compatibility. */ }
};
extern FlushableHardwareSerial flushableSerial;
#endif // ARDUINO_ARCH_ESP32
+23 -6
View File
@@ -41,7 +41,10 @@
#endif
#if ENABLED(WEBSUPPORT)
#include "web.h"
#include "spiffs.h"
#endif
#elif ENABLED(EEPROM_SETTINGS)
#include "spiffs.h"
#endif
// --------------------------------------------------------------------------
@@ -95,9 +98,12 @@ void HAL_init(void) {
OTA_init();
#endif
#if ENABLED(WEBSUPPORT)
spiffs_init();
web_init();
#endif
server.begin();
#elif ENABLED(EEPROM_SETTINGS)
spiffs_init();
#endif
i2s_init();
@@ -111,7 +117,7 @@ void HAL_idletask(void) {
void HAL_clear_reset_source(void) { }
uint8_t HAL_get_reset_source (void) {
uint8_t HAL_get_reset_source(void) {
return rtc_get_reset_reason(1);
}
@@ -127,12 +133,16 @@ int freeMemory() {
// --------------------------------------------------------------------------
// ADC
// --------------------------------------------------------------------------
#define ADC1_CHANNEL(pin) ADC1_GPIO##pin_CHANNEL
#define ADC1_CHANNEL(pin) ADC1_GPIO ## pin ## _CHANNEL
adc1_channel_t get_channel(int pin) {
switch (pin) {
case 36: return ADC1_GPIO36_CHANNEL;
case 39: return ADC1_GPIO39_CHANNEL;
case 39: return ADC1_CHANNEL(39);
case 36: return ADC1_CHANNEL(36);
case 35: return ADC1_CHANNEL(35);
case 34: return ADC1_CHANNEL(34);
case 33: return ADC1_CHANNEL(33);
case 32: return ADC1_CHANNEL(32);
}
return ADC1_CHANNEL_MAX;
@@ -141,14 +151,21 @@ adc1_channel_t get_channel(int pin) {
void HAL_adc_init() {
// Configure ADC
adc1_config_width(ADC_WIDTH_12Bit);
adc1_config_channel_atten(get_channel(36), ADC_ATTEN_11db);
adc1_config_channel_atten(get_channel(39), ADC_ATTEN_11db);
adc1_config_channel_atten(get_channel(36), ADC_ATTEN_11db);
adc1_config_channel_atten(get_channel(35), ADC_ATTEN_11db);
adc1_config_channel_atten(get_channel(34), ADC_ATTEN_11db);
adc1_config_channel_atten(get_channel(33), ADC_ATTEN_11db);
adc1_config_channel_atten(get_channel(32), ADC_ATTEN_11db);
// Note that adc2 is shared with the WiFi module, which has higher priority, so the conversion may fail.
// That's why we're not setting it up here.
// Calculate ADC characteristics i.e. gain and offset factors
esp_adc_cal_characterize(ADC_UNIT_1, ADC_ATTEN_DB_11, ADC_WIDTH_BIT_12, V_REF, &characteristics);
}
void HAL_adc_start_conversion (uint8_t adc_pin) {
void HAL_adc_start_conversion(uint8_t adc_pin) {
uint32_t mv;
esp_adc_cal_get_voltage((adc_channel_t)get_channel(adc_pin), &characteristics, &mv);
+5 -11
View File
@@ -30,14 +30,7 @@
#include <stdint.h>
#undef DISABLED
#undef M_PI
#include <Arduino.h>
#undef DISABLED
#define DISABLED(b) (!_CAT(SWITCH_ENABLED_, b))
#include "../shared/Marduino.h"
#include "../shared/math_32bit.h"
#include "../shared/HAL_SPI.h"
@@ -48,6 +41,7 @@
#include "HAL_timers_ESP32.h"
#include "WebSocketSerial.h"
#include "FlushableHardwareSerial.h"
// --------------------------------------------------------------------------
// Defines
@@ -55,7 +49,7 @@
extern portMUX_TYPE spinlock;
#define MYSERIAL0 Serial
#define MYSERIAL0 flushableSerial
#if ENABLED(WIFISUPPORT)
#define NUM_SERIAL 2
@@ -96,7 +90,7 @@ extern uint16_t HAL_adc_result;
void HAL_clear_reset_source (void);
// reset reason
uint8_t HAL_get_reset_source (void);
uint8_t HAL_get_reset_source(void);
void _delay_ms(int delay);
@@ -119,7 +113,7 @@ void HAL_adc_init(void);
#define HAL_READ_ADC() HAL_adc_result
#define HAL_ADC_READY() true
void HAL_adc_start_conversion (uint8_t adc_pin);
void HAL_adc_start_conversion(uint8_t adc_pin);
#define GET_PIN_MAP_PIN(index) index
#define GET_PIN_MAP_INDEX(pin) pin
+19 -7
View File
@@ -44,6 +44,15 @@ static SPISettings spiConfig;
// Public functions
// --------------------------------------------------------------------------
#if ENABLED(SOFTWARE_SPI)
// --------------------------------------------------------------------------
// Software SPI
// --------------------------------------------------------------------------
#error "Software SPI not supported for ESP32. Use Hardware SPI."
#else
// --------------------------------------------------------------------------
// Hardware SPI
// --------------------------------------------------------------------------
@@ -61,13 +70,14 @@ void spiInit(uint8_t spiRate) {
uint32_t clock;
switch (spiRate) {
case SPI_FULL_SPEED: clock = SPI_CLOCK_DIV2; break;
case SPI_HALF_SPEED: clock = SPI_CLOCK_DIV4; break;
case SPI_QUARTER_SPEED: clock = SPI_CLOCK_DIV8; break;
case SPI_EIGHTH_SPEED: clock = SPI_CLOCK_DIV16; break;
case SPI_SPEED_5: clock = SPI_CLOCK_DIV32; break;
case SPI_SPEED_6: clock = SPI_CLOCK_DIV64; break;
default: clock = SPI_CLOCK_DIV2; // Default from the SPI library
case SPI_FULL_SPEED: clock = 16000000; break;
case SPI_HALF_SPEED: clock = 8000000; break;
case SPI_QUARTER_SPEED: clock = 4000000; break;
case SPI_EIGHTH_SPEED: clock = 2000000; break;
case SPI_SIXTEENTH_SPEED: clock = 1000000; break;
case SPI_SPEED_5: clock = 500000; break;
case SPI_SPEED_6: clock = 250000; break;
default: clock = 1000000; // Default from the SPI library
}
spiConfig = SPISettings(clock, MSBFIRST, SPI_MODE0);
@@ -106,4 +116,6 @@ void spiBeginTransaction(uint32_t spiClock, uint8_t bitOrder, uint8_t dataMode)
SPI.beginTransaction(spiConfig);
}
#endif // !SOFTWARE_SPI
#endif // ARDUINO_ARCH_ESP32
+4
View File
@@ -23,3 +23,7 @@
#if ENABLED(EMERGENCY_PARSER)
#error "EMERGENCY_PARSER is not yet implemented for ESP32. Disable EMERGENCY_PARSER to continue."
#endif
#if ENABLED(FAST_PWM_FAN)
#error "FAST_PWM_FAN is not yet implemented for this platform."
#endif
+96 -177
View File
@@ -1,6 +1,6 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
* Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
@@ -21,213 +21,132 @@
*/
#ifdef ARDUINO_ARCH_ESP32
#include "../../inc/MarlinConfig.h"
#include "../../inc/MarlinConfigPre.h"
#if ENABLED(WIFISUPPORT)
#include "WebSocketSerial.h"
extern WebSocketSerial webSocketSerial;
#include "wifi.h"
#include <AsyncTCP.h>
#include <ESPAsyncWebServer.h>
struct ring_buffer_r {
unsigned char buffer[RX_BUFFER_SIZE];
volatile ring_buffer_pos_t head, tail;
};
WebSocketSerial webSocketSerial;
AsyncWebSocket ws("/ws"); // TODO Move inside the class.
struct ring_buffer_t {
unsigned char buffer[256];
volatile uint8_t head, tail;
};
// RingBuffer impl
ring_buffer_r rx_buffer = { { 0 }, 0, 0 };
ring_buffer_t tx_buffer = { { 0 }, 0, 0 };
#define NEXT_INDEX(I, SIZE) ((I + 1) & (ring_buffer_pos_t)(SIZE - 1))
static bool _written;
RingBuffer::RingBuffer(ring_buffer_pos_t size)
: data(new uint8_t[size]),
read_index(0),
write_index(0),
size(size)
{}
#if ENABLED(EMERGENCY_PARSER)
static EmergencyParser::State emergency_state; // = EP_RESET
#endif
RingBuffer::~RingBuffer() { delete[] data; }
AsyncWebSocket ws("/ws"); // access at ws://[esp ip]/ws
ring_buffer_pos_t RingBuffer::write(const uint8_t c) {
const ring_buffer_pos_t n = NEXT_INDEX(write_index, size);
FORCE_INLINE int next_rx_index(const int i) { return (ring_buffer_pos_t)(i + 1) & (ring_buffer_pos_t)(RX_BUFFER_SIZE - 1); }
FORCE_INLINE int next_tx_index(const int i) { return (ring_buffer_pos_t)(i + 1) & (ring_buffer_pos_t)(TX_BUFFER_SIZE - 1); }
static void addToBuffer(uint8_t * const data, const size_t len) {
for (size_t i = 0; i < len; i++) {
ring_buffer_pos_t h = rx_buffer.head;
const ring_buffer_pos_t t = rx_buffer.tail, n = next_rx_index(h);
if (n != t) { rx_buffer.buffer[h] = data[i]; h = n; }
// TODO: buffer is full, handle?
rx_buffer.head = h;
if (n != read_index) {
this->data[write_index] = c;
write_index = n;
return 1;
}
// TODO: buffer is full, handle?
return 0;
}
// Handle WebSocket event
static void onEvent(AsyncWebSocket * server, AsyncWebSocketClient * client, AwsEventType type, void * arg, uint8_t *data, size_t len) {
switch (type) {
case WS_EVT_CONNECT: client->ping(); break; // client connected
case WS_EVT_DISCONNECT: // client disconnected
case WS_EVT_ERROR: // error was received from the other end
case WS_EVT_PONG: break; // pong message was received (in response to a ping request maybe)
case WS_EVT_DATA: { // data packet
AwsFrameInfo * info = (AwsFrameInfo*)arg;
if (info->opcode == WS_TEXT || info->message_opcode == WS_TEXT)
addToBuffer(data, len);
}
ring_buffer_pos_t RingBuffer::write(const uint8_t *buffer, ring_buffer_pos_t size) {
ring_buffer_pos_t written = 0;
for (ring_buffer_pos_t i = 0; i < size; i++) {
written += write(buffer[i]);
}
return written;
}
// Public Methods
int RingBuffer::available(void) {
return (size - read_index + write_index) & (size - 1);
}
int RingBuffer::peek(void) {
return available() ? data[read_index] : -1;
}
int RingBuffer::read(void) {
if (available()) {
const int ret = data[read_index];
read_index = NEXT_INDEX(read_index, size);
return ret;
}
return -1;
}
ring_buffer_pos_t RingBuffer::read(uint8_t *buffer) {
ring_buffer_pos_t len = available();
for(ring_buffer_pos_t i = 0; read_index != write_index; i++) {
buffer[i] = data[read_index];
read_index = NEXT_INDEX(read_index, size);
}
return len;
}
void RingBuffer::flush(void) { read_index = write_index; }
// WebSocketSerial impl
WebSocketSerial::WebSocketSerial()
: rx_buffer(RingBuffer(RX_BUFFER_SIZE)),
tx_buffer(RingBuffer(TX_BUFFER_SIZE))
{}
void WebSocketSerial::begin(const long baud_setting) {
ws.onEvent(onEvent);
server.addHandler(&ws); // attach AsyncWebSocket
ws.onEvent([this](AsyncWebSocket *server, AsyncWebSocketClient *client, AwsEventType type, void *arg, uint8_t *data, size_t len) {
switch (type) {
case WS_EVT_CONNECT: client->ping(); break; // client connected
case WS_EVT_DISCONNECT: // client disconnected
case WS_EVT_ERROR: // error was received from the other end
case WS_EVT_PONG: break; // pong message was received (in response to a ping request maybe)
case WS_EVT_DATA: { // data packet
AwsFrameInfo * info = (AwsFrameInfo*)arg;
if (info->opcode == WS_TEXT || info->message_opcode == WS_TEXT)
this->rx_buffer.write(data, len);
}
}
});
server.addHandler(&ws);
}
void WebSocketSerial::end() { }
int WebSocketSerial::peek(void) { return rx_buffer.peek(); }
int WebSocketSerial::read(void) { return rx_buffer.read(); }
int WebSocketSerial::available(void) { return rx_buffer.available(); }
void WebSocketSerial::flush(void) { rx_buffer.flush(); }
int WebSocketSerial::peek(void) {
const int v = rx_buffer.head == rx_buffer.tail ? -1 : rx_buffer.buffer[rx_buffer.tail];
return v;
}
size_t WebSocketSerial::write(const uint8_t c) {
size_t ret = tx_buffer.write(c);
int WebSocketSerial::read(void) {
const ring_buffer_pos_t h = rx_buffer.head, t = rx_buffer.tail;
if (h == t) return -1; // Nothing to read? Return now
const int v = rx_buffer.buffer[t];
rx_buffer.tail = (ring_buffer_pos_t)(t + 1) & (RX_BUFFER_SIZE - 1); // Advance tail
return v;
}
bool WebSocketSerial::available(void) {
const ring_buffer_pos_t h = rx_buffer.head, t = rx_buffer.tail;
return (ring_buffer_pos_t)(RX_BUFFER_SIZE + h - t) & (RX_BUFFER_SIZE - 1);
}
void WebSocketSerial::flush(void) {
ws.textAll("flush");
rx_buffer.tail = rx_buffer.head;
}
#if TX_BUFFER_SIZE
void WebSocketSerial::write(const uint8_t c) {
_written = true;
const uint8_t i = (tx_buffer.head + 1) & (TX_BUFFER_SIZE - 1);
// Store new char. head is always safe to move
tx_buffer.buffer[tx_buffer.head] = c;
tx_buffer.head = i;
if (c == '\n') {
ws.textAll(tx_buffer.buffer, tx_buffer.head);
tx_buffer.head = 0;
}
if (ret && c == '\n') {
uint8_t tmp[TX_BUFFER_SIZE];
ring_buffer_pos_t size = tx_buffer.read(tmp);
ws.textAll(tmp, size);
}
void WebSocketSerial::flushTx(void) {
ws.textAll("flushTx");
if (!_written) return;
}
#else
//void WebSocketSerial::write(const uint8_t c) { _written = true; }
//void WebSocketSerial::flushTx(void) { if (!_written) return; }
#endif
/**
* Imports from print.h
*/
void WebSocketSerial::print(char c, int base) { print((long)c, base); }
void WebSocketSerial::print(unsigned char b, int base) { print((unsigned long)b, base); }
void WebSocketSerial::print(int n, int base) { print((long)n, base); }
void WebSocketSerial::print(unsigned int n, int base) { print((unsigned long)n, base); }
void WebSocketSerial::print(long n, int base) {
if (base == 0)
write(n);
else if (base == 10) {
if (n < 0) { print('-'); n = -n; }
printNumber(n, 10);
}
else
printNumber(n, base);
return ret;
}
void WebSocketSerial::print(unsigned long n, int base) {
if (base == 0) write(n); else printNumber(n, base);
size_t WebSocketSerial::write(const uint8_t* buffer, size_t size) {
size_t written = 0;
for(size_t i = 0; i < size; i++) {
written += write(buffer[i]);
}
return written;
}
void WebSocketSerial::print(double n, int digits) { printFloat(n, digits); }
void WebSocketSerial::println(void) { print('\r'); print('\n'); }
void WebSocketSerial::println(const String& s) { print(s); println(); }
void WebSocketSerial::println(const char c[]) { print(c); println(); }
void WebSocketSerial::println(char c, int base) { print(c, base); println(); }
void WebSocketSerial::println(unsigned char b, int base) { print(b, base); println(); }
void WebSocketSerial::println(int n, int base) { print(n, base); println(); }
void WebSocketSerial::println(unsigned int n, int base) { print(n, base); println(); }
void WebSocketSerial::println(long n, int base) { print(n, base); println(); }
void WebSocketSerial::println(unsigned long n, int base) { print(n, base); println(); }
void WebSocketSerial::println(double n, int digits) { print(n, digits); println(); }
// Private Methods
void WebSocketSerial::printNumber(unsigned long n, uint8_t base) {
if (n) {
unsigned char buf[8 * sizeof(long)]; // Enough space for base 2
int8_t i = 0;
while (n) {
buf[i++] = n % base;
n /= base;
}
while (i--)
print((char)(buf[i] + (buf[i] < 10 ? '0' : 'A' - 10)));
}
else
print('0');
}
void WebSocketSerial::printFloat(double number, uint8_t digits) {
// Handle negative numbers
if (number < 0.0) { print('-'); number = -number; }
// Round correctly so that print(1.999, 2) prints as "2.00"
// Use a lookup table for performance
constexpr double rounds[] = { 0.5, 0.05, 0.005, 0.0005, 0.00005, 0.000005, 0.0000005, 0.00000005 };
number += rounds[digits];
//number += pow(10, -(digits + 1)); // slower single-line equivalent
// Extract the integer part of the number and print it
unsigned long int_part = (unsigned long)number;
print(int_part);
// Print the decimal point, but only if there are digits beyond
double remainder = number - (double)int_part;
if (digits) {
print('.');
// Extract digits from the remainder one at a time
while (digits--) {
remainder *= 10.0;
const int toPrint = int(remainder);
print(toPrint);
remainder -= toPrint;
}
}
void WebSocketSerial::flushTX(void) {
// No need to do anything as there's no benefit to sending partial lines over the websocket connection.
}
#endif // WIFISUPPORT
+38 -53
View File
@@ -1,6 +1,6 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
* Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
@@ -23,12 +23,7 @@
#include "../../inc/MarlinConfig.h"
#include <WString.h>
#define DEC 10
#define HEX 16
#define OCT 8
#define BIN 2
#include "Stream.h"
#ifndef RX_BUFFER_SIZE
#define RX_BUFFER_SIZE 128
@@ -40,60 +35,50 @@
#error "TX_BUFFER_SIZE is required for the WebSocket."
#endif
#if RX_BUFFER_SIZE > 256
typedef uint16_t ring_buffer_pos_t;
#else
typedef uint8_t ring_buffer_pos_t;
#endif
typedef uint16_t ring_buffer_pos_t;
class RingBuffer {
uint8_t *data;
ring_buffer_pos_t size, read_index, write_index;
class WebSocketSerial {
public:
WebSocketSerial() {};
static void begin(const long);
static void end();
static int peek(void);
static int read(void);
static void flush(void);
static void flushTx(void);
static bool available(void);
static void write(const uint8_t c);
RingBuffer(ring_buffer_pos_t size);
~RingBuffer();
int available(void);
int peek(void);
int read(void);
ring_buffer_pos_t read(uint8_t *buffer);
void flush(void);
ring_buffer_pos_t write(const uint8_t c);
ring_buffer_pos_t write(const uint8_t* buffer, ring_buffer_pos_t size);
};
class WebSocketSerial: public Stream {
RingBuffer rx_buffer;
RingBuffer tx_buffer;
public:
WebSocketSerial();
void begin(const long);
void end();
int available(void);
int peek(void);
int read(void);
void flush(void);
void flushTX(void);
size_t write(const uint8_t c);
size_t write(const uint8_t* buffer, size_t size);
operator bool() { return true; }
#if ENABLED(SERIAL_STATS_DROPPED_RX)
FORCE_INLINE static uint32_t dropped() { return 0; }
FORCE_INLINE uint32_t dropped() { return 0; }
#endif
#if ENABLED(SERIAL_STATS_MAX_RX_QUEUED)
FORCE_INLINE static int rxMaxEnqueued() { return 0; }
FORCE_INLINE int rxMaxEnqueued() { return 0; }
#endif
FORCE_INLINE static void write(const char* str) { while (*str) write(*str++); }
FORCE_INLINE static void write(const uint8_t* buffer, size_t size) { while (size--) write(*buffer++); }
FORCE_INLINE static void print(const String& s) { for (int i = 0; i < (int)s.length(); i++) write(s[i]); }
FORCE_INLINE static void print(const char* str) { write(str); }
static void print(char, int = 0);
static void print(unsigned char, int = 0);
static void print(int, int = DEC);
static void print(unsigned int, int = DEC);
static void print(long, int = DEC);
static void print(unsigned long, int = DEC);
static void print(double, int = 2);
static void println(const String& s);
static void println(const char[]);
static void println(char, int = 0);
static void println(unsigned char, int = 0);
static void println(int, int = DEC);
static void println(unsigned int, int = DEC);
static void println(long, int = DEC);
static void println(unsigned long, int = DEC);
static void println(double, int = 2);
static void println(void);
operator bool() { return true; }
private:
static void printNumber(unsigned long, const uint8_t);
static void printFloat(double, uint8_t);
};
extern WebSocketSerial webSocketSerial;
+12 -4
View File
@@ -27,6 +27,10 @@
* Utility functions
*/
// I2S expander pin mapping.
#define IS_I2S_EXPANDER_PIN(IO) TEST(IO, 7)
#define I2S_EXPANDER_PIN_INDEX(IO) (IO & 0x7F)
// Set pin as input
#define _SET_INPUT(IO) pinMode(IO, INPUT)
@@ -37,10 +41,10 @@
#define _PULLUP(IO, v) pinMode(IO, v ? INPUT_PULLUP : INPUT)
// Read a pin wrapper
#define READ(IO) digitalRead(IO)
#define READ(IO) (IS_I2S_EXPANDER_PIN(IO) ? i2s_state(I2S_EXPANDER_PIN_INDEX(IO)) : digitalRead(IO))
// Write to a pin wrapper
#define WRITE(IO, v) (TEST(IO, 7) ? i2s_write(IO & 0x7F, v) : digitalWrite(IO, v))
#define WRITE(IO, v) (IS_I2S_EXPANDER_PIN(IO) ? i2s_write(I2S_EXPANDER_PIN_INDEX(IO), v) : digitalWrite(IO, v))
// Set pin as input wrapper
#define SET_INPUT(IO) _SET_INPUT(IO)
@@ -61,8 +65,12 @@
#define extDigitalRead(IO) digitalRead(IO)
#define extDigitalWrite(IO,V) digitalWrite(IO,V)
#define PWM_PIN(P) true
#define USEABLE_HARDWARE_PWM(P) PWM_PIN(P)
// PWM outputs
#define PWM_PIN(P) (P < 34) // NOTE Pins >= 34 are input only on ESP32, so they can't be used for output.
#define USEABLE_HARDWARE_PWM(P) (!IS_I2S_EXPANDER_PIN(P) && PWM_PIN(P))
// Toggle pin value
#define TOGGLE(IO) WRITE(IO, !READ(IO))
//
// Ports and functions
+9 -4
View File
@@ -21,8 +21,9 @@
*/
#ifdef ARDUINO_ARCH_ESP32
#include <Arduino.h> // replace that with the proper imports
#include "i2s.h"
#include "../shared/Marduino.h"
#include "../../core/macros.h"
#include "driver/periph_ctrl.h"
#include "rom/lldesc.h"
@@ -303,9 +304,9 @@ int i2s_init() {
xTaskCreate(stepperTask, "StepperTask", 10000, NULL, 1, NULL);
// Route the i2s pins to the appropriate GPIO
gpio_matrix_out_check(22, I2S0O_DATA_OUT23_IDX, 0, 0);
gpio_matrix_out_check(25, I2S0O_WS_OUT_IDX, 0, 0);
gpio_matrix_out_check(26, I2S0O_BCK_OUT_IDX, 0, 0);
gpio_matrix_out_check(I2S_DATA, I2S0O_DATA_OUT23_IDX, 0, 0);
gpio_matrix_out_check(I2S_BCK, I2S0O_BCK_OUT_IDX, 0, 0);
gpio_matrix_out_check(I2S_WS, I2S0O_WS_OUT_IDX, 0, 0);
// Start the I2S peripheral
return i2s_start(I2S_NUM_0);
@@ -315,6 +316,10 @@ void i2s_write(uint8_t pin, uint8_t val) {
SET_BIT_TO(i2s_port_data, pin, val);
}
uint8_t i2s_state(uint8_t pin) {
return TEST(i2s_port_data, pin);
}
void i2s_push_sample() {
dma.current[dma.rw_pos++] = i2s_port_data;
}
+10
View File
@@ -21,11 +21,21 @@
*/
#pragma once
#include <stdint.h>
// current value of the outputs provided over i2s
extern uint32_t i2s_port_data;
int i2s_init();
uint8_t i2s_state(uint8_t pin);
void i2s_write(uint8_t pin, uint8_t val);
void i2s_push_sample();
// pin definitions
#define I2S_WS 25
#define I2S_BCK 26
#define I2S_DATA 27
@@ -0,0 +1,93 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2019 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 <http://www.gnu.org/licenses/>.
*
*/
#ifdef ARDUINO_ARCH_ESP32
#include "../../inc/MarlinConfig.h"
#if ENABLED(EEPROM_SETTINGS) && DISABLED(FLASH_EEPROM_EMULATION)
#include "../shared/persistent_store_api.h"
#include "SPIFFS.h"
#include "FS.h"
#include "spiffs.h"
#define HAL_ESP32_EEPROM_SIZE 4096
File eeprom_file;
bool PersistentStore::access_start() {
if (spiffs_initialized) {
eeprom_file = SPIFFS.open("/eeprom.dat", "r+");
size_t file_size = eeprom_file.size();
if (file_size < HAL_ESP32_EEPROM_SIZE) {
bool write_ok = eeprom_file.seek(file_size);
while (write_ok && file_size < HAL_ESP32_EEPROM_SIZE) {
write_ok = eeprom_file.write(0xFF) == 1;
file_size++;
}
}
return true;
}
return false;
}
bool PersistentStore::access_finish() {
eeprom_file.close();
return true;
}
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
if (!eeprom_file.seek(pos)) return true; // return true for any error
if (eeprom_file.write(value, size) != size) return true;
crc16(crc, value, size);
pos += size;
return false;
}
bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
if (!eeprom_file.seek(pos)) return true; // return true for any error
if (writing) {
if (eeprom_file.read(value, size) != size) return true;
crc16(crc, value, size);
}
else {
uint8_t tmp[size];
if (eeprom_file.read(tmp, size) != size) return true;
crc16(crc, tmp, size);
}
pos += size;
return false;
}
size_t PersistentStore::capacity() { return HAL_ESP32_EEPROM_SIZE; }
#endif // EEPROM_SETTINGS
#endif // ARDUINO_ARCH_ESP32
+1 -1
View File
@@ -18,7 +18,7 @@
*/
#pragma once
#define SS_PIN 5
#define SS_PIN SDSS
#define SCK_PIN 18
#define MISO_PIN 19
#define MOSI_PIN 23
+44
View File
@@ -0,0 +1,44 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2019 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 <http://www.gnu.org/licenses/>.
*
*/
#ifdef ARDUINO_ARCH_ESP32
#include "../../inc/MarlinConfigPre.h"
#if EITHER(WEBSUPPORT, EEPROM_SETTINGS)
#include "../../core/serial.h"
#include "FS.h"
#include "SPIFFS.h"
bool spiffs_initialized;
void spiffs_init() {
if (SPIFFS.begin())
spiffs_initialized = true;
else
SERIAL_ECHO_MSG("SPIFFS mount failed");
}
#endif // WEBSUPPORT
#endif // ARDUINO_ARCH_ESP32
+26
View File
@@ -0,0 +1,26 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2019 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 <http://www.gnu.org/licenses/>.
*
*/
#pragma once
extern bool spiffs_initialized;
void spiffs_init();
+7 -11
View File
@@ -1,7 +1,9 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
* Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com
* Copyright (C) 2019 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
@@ -15,6 +17,7 @@
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifdef ARDUINO_ARCH_ESP32
@@ -23,9 +26,6 @@
#if ENABLED(WEBSUPPORT)
#include "../../core/serial.h"
#include "FS.h"
#include "SPIFFS.h"
#include "wifi.h"
@@ -37,12 +37,8 @@ void onNotFound(AsyncWebServerRequest *request){
void web_init() {
server.addHandler(&events); // attach AsyncEventSource
if (SPIFFS.begin()) {
server.serveStatic("/", SPIFFS, "/www").setDefaultFile("index.html");
server.onNotFound(onNotFound);
}
else
SERIAL_ECHO_MSG("SPIFFS Mount Failed");
server.serveStatic("/", SPIFFS, "/www").setDefaultFile("index.html");
server.onNotFound(onNotFound);
}
#endif // WEBSUPPORT
+5 -2
View File
@@ -1,7 +1,9 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
* Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com
* Copyright (C) 2019 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
@@ -15,6 +17,7 @@
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#pragma once
+5 -2
View File
@@ -1,7 +1,9 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
* Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com
* Copyright (C) 2019 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
@@ -15,6 +17,7 @@
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifdef ARDUINO_ARCH_ESP32
+5 -2
View File
@@ -1,7 +1,9 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
* Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com
* Copyright (C) 2019 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
@@ -15,6 +17,7 @@
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#pragma once
+3 -4
View File
@@ -47,16 +47,15 @@ uint8_t _getc();
//arduino: Print.h
#define DEC 10
#define HEX 16
#define OCT 8
#define BIN 2
#define OCT 8
#define BIN 2
//arduino: binary.h (weird defines)
#define B01 1
#define B10 2
#include "hardware/Clock.h"
#include <Arduino.h>
#include "../shared/Marduino.h"
#include "../shared/math_32bit.h"
#include "../shared/HAL_SPI.h"
#include "fastio.h"
+6 -2
View File
@@ -25,8 +25,8 @@
*/
#if ENABLED(SPINDLE_LASER_ENABLE)
#if !PIN_EXISTS(SPINDLE_LASER_ENABLE)
#error "SPINDLE_LASER_ENABLE requires SPINDLE_LASER_ENABLE_PIN."
#if !PIN_EXISTS(SPINDLE_LASER_ENA)
#error "SPINDLE_LASER_ENABLE requires SPINDLE_LASER_ENA_PIN."
#elif SPINDLE_DIR_CHANGE && !PIN_EXISTS(SPINDLE_DIR)
#error "SPINDLE_DIR_PIN not defined."
#elif ENABLED(SPINDLE_LASER_PWM) && PIN_EXISTS(SPINDLE_LASER_PWM)
@@ -65,3 +65,7 @@
#endif
#endif
#endif // SPINDLE_LASER_ENABLE
#if ENABLED(FAST_PWM_FAN)
#error "FAST_PWM_FAN is not yet implemented for this platform."
#endif
+9 -9
View File
@@ -25,7 +25,7 @@
* Fast I/O Routines for X86_64
*/
#include <Arduino.h>
#include "../shared/Marduino.h"
#include <pinmapping.h>
#define SET_DIR_INPUT(IO) Gpio::setDir(IO, 1)
@@ -75,19 +75,19 @@
// hg42: currently not used, but was used by pinsDebug
/// check if pin is an input
#define _GET_INPUT(IO) (LPC1768_PIN_PIN(IO) >= 0)
#define _IS_INPUT(IO) (LPC1768_PIN_PIN(IO) >= 0)
/// check if pin is an output
#define _GET_OUTPUT(IO) (LPC1768_PIN_PIN(IO) >= 0)
#define _IS_OUTPUT(IO) (LPC1768_PIN_PIN(IO) >= 0)
// hg42: GET_TIMER is used only to check if it's a PWM pin
// hg42: HAS_TIMER is used only to check if it's a PWM pin
// hg42: we cannot use USEABLE_HARDWARE_PWM because it uses a function that cannot be used statically
// hg42: instead use PWM bit from the #define
/// check if pin is a timer
#define _GET_TIMER(IO) true // could be LPC1768_PIN_PWM(IO), but there
#define _HAS_TIMER(IO) true // could be LPC1768_PIN_PWM(IO), but there
// hg42: could be this:
// #define _GET_TIMER(IO) LPC1768_PIN_PWM(IO)
// #define _HAS_TIMER(IO) LPC1768_PIN_PWM(IO)
// but this is an incomplete check (12 pins are PWMable, but only 6 can be used at the same time)
/// Read a pin wrapper
@@ -112,12 +112,12 @@
#define SET_PWM(IO) SET_OUTPUT(IO)
/// check if pin is an input wrapper
#define GET_INPUT(IO) _GET_INPUT(IO)
#define IS_INPUT(IO) _IS_INPUT(IO)
/// check if pin is an output wrapper
#define GET_OUTPUT(IO) _GET_OUTPUT(IO)
#define IS_OUTPUT(IO) _IS_OUTPUT(IO)
/// check if pin is a timer (wrapper)
#define GET_TIMER(IO) _GET_TIMER(IO)
#define HAS_TIMER(IO) _HAS_TIMER(IO)
// Shorthand
#define OUT_WRITE(IO,V) do{ SET_OUTPUT(IO); WRITE(IO,V); }while(0)
+1 -1
View File
@@ -23,7 +23,7 @@
#include "src/core/macros.h"
#if ENABLED(SDSUPPORT) && ENABLED(DOGLCD) && (LCD_PINS_D4 == SCK_PIN || LCD_PINS_ENABLE == MOSI_PIN || DOGLCD_SCK == SCK_PIN || DOGLCD_MOSI == MOSI_PIN)
#if BOTH(SDSUPPORT, DOGLCD) && (LCD_PINS_D4 == SCK_PIN || LCD_PINS_ENABLE == MOSI_PIN || DOGLCD_SCK == SCK_PIN || DOGLCD_MOSI == MOSI_PIN)
#define LPC_SOFTWARE_SPI // If the SD card and LCD adapter share the same SPI pins, then software SPI is currently
// needed due to the speed and mode requred for communicating with each device being different.
// This requirement can be removed if the SPI access to these devices is updated to use
+6 -4
View File
@@ -52,11 +52,13 @@ int freeMemory() {
return result;
}
// scan command line for code
// return index into pin map array if found and the pin is valid.
// return dval if not found or not a valid pin.
int16_t PARSED_PIN_INDEX(const char code, const int16_t dval) {
const uint16_t val = (uint16_t)parser.intval(code), port = val / 100, pin = val % 100;
const int16_t ind = (port < (NUM_DIGITAL_PINS >> 5) && (pin < 32))
? GET_PIN_MAP_INDEX(port << 5 | pin) : -2;
return ind > -2 ? ind : dval;
const uint16_t val = (uint16_t)parser.intval(code, -1), port = val / 100, pin = val % 100;
const int16_t ind = (port < ((NUM_DIGITAL_PINS) >> 5) && pin < 32) ? GET_PIN_MAP_INDEX((port << 5) | pin) : -2;
return ind > -1 ? ind : dval;
}
void flashFirmware(int16_t value) {
+24 -5
View File
@@ -37,18 +37,18 @@ void HAL_init();
extern "C" volatile millis_t _millis;
#include <Arduino.h>
#include <pinmapping.h>
#include <CDCSerial.h>
#include "../shared/Marduino.h"
#include "../shared/math_32bit.h"
#include "../shared/HAL_SPI.h"
#include "fastio.h"
#include <adc.h>
#include "watchdog.h"
#include "HAL_timers.h"
#include "MarlinSerial.h"
#include <adc.h>
#include <pinmapping.h>
#include <CDCSerial.h>
//
// Default graphical display delays
//
@@ -147,6 +147,9 @@ using FilteredADC = LPC176x::ADC<ADC_LOWPASS_K_VALUE, ADC_MEDIAN_FILTER_SIZE>;
#define HAL_READ_ADC() FilteredADC::get_result()
#define HAL_ADC_READY() FilteredADC::finished_conversion()
// A grace period for the ADC readings to stabilize before they start causing thermal protection errors.
#define THERMAL_PROTECTION_GRACE_PERIOD 800
// 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
@@ -157,3 +160,19 @@ void HAL_idletask(void);
#define PLATFORM_M997_SUPPORT
void flashFirmware(int16_t value);
/**
* set_pwm_frequency
* Set the frequency of the timer corresponding to the provided pin
* All Hardware PWM pins run at the same frequency and all
* Software PWM pins run at the same frequency
*/
void set_pwm_frequency(const pin_t pin, int f_desired);
/**
* set_pwm_duty
* Set the PWM duty cycle of the provided pin to the provided value
* Optionally allows inverting the duty cycle [default = false]
* Optionally allows changing the maximum size of the provided value to enable finer PWM duty control [default = 255]
*/
void set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t v_size=255, const bool invert=false);
+3 -8
View File
@@ -25,8 +25,8 @@
*/
#if ENABLED(SPINDLE_LASER_ENABLE)
#if !PIN_EXISTS(SPINDLE_LASER_ENABLE)
#error "SPINDLE_LASER_ENABLE requires SPINDLE_LASER_ENABLE_PIN."
#if !PIN_EXISTS(SPINDLE_LASER_ENA)
#error "SPINDLE_LASER_ENABLE requires SPINDLE_LASER_ENA_PIN."
#elif SPINDLE_DIR_CHANGE && !PIN_EXISTS(SPINDLE_DIR)
#error "SPINDLE_DIR_PIN not defined."
#elif ENABLED(SPINDLE_LASER_PWM) && PIN_EXISTS(SPINDLE_LASER_PWM)
@@ -66,12 +66,7 @@
#endif
#endif // SPINDLE_LASER_ENABLE
#if ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) && HAS_DRIVER(TMC2130) && DISABLED(TMC_USE_SW_SPI) \
&& (MB(RAMPS_14_RE_ARM_EFB) \
|| MB(RAMPS_14_RE_ARM_EEB) \
|| MB(RAMPS_14_RE_ARM_EFF) \
|| MB(RAMPS_14_RE_ARM_EEF) \
|| MB(RAMPS_14_RE_ARM_SF))
#if IS_RE_ARM_BOARD && ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) && HAS_DRIVER(TMC2130) && DISABLED(TMC_USE_SW_SPI)
#error "Re-ARM with REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER and TMC2130 require TMC_USE_SW_SPI"
#endif
+40
View File
@@ -0,0 +1,40 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2019 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 <http://www.gnu.org/licenses/>.
*
*/
#ifdef TARGET_LPC1768
#include "../../inc/MarlinConfigPre.h"
#if ENABLED(FAST_PWM_FAN)
#include <pwm.h>
void set_pwm_frequency(const pin_t pin, int f_desired) {
pwm_set_frequency(pin, f_desired);
}
void set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t v_size/*=255*/, const bool invert/*=false*/) {
pwm_write_ratio(pin, invert ? 1.0f - (float)v / v_size : (float)v / v_size);
}
#endif // FAST_PWM_FAN
#endif // TARGET_LPC1768
+7 -7
View File
@@ -33,7 +33,7 @@
* For TARGET LPC1768
*/
#include <Arduino.h>
#include "../shared/Marduino.h"
#define PWM_PIN(P) true // all pins are PWM capable
#define USEABLE_HARDWARE_PWM(P) PWM_PIN(P)
@@ -84,14 +84,14 @@
#define _PULLDOWN(IO,V) pinMode(IO, (V) ? INPUT_PULLDOWN : INPUT)
/// check if pin is an input
#define _GET_INPUT(IO) (!gpio_get_dir(IO))
#define _IS_INPUT(IO) (!gpio_get_dir(IO))
/// check if pin is an output
#define _GET_OUTPUT(IO) (gpio_get_dir(IO))
#define _IS_OUTPUT(IO) (gpio_get_dir(IO))
/// check if pin is a timer
/// all gpio pins are pwm capable, either interrupt or hardware pwm controlled
#define _GET_TIMER(IO) true
#define _HAS_TIMER(IO) true
/// Read a pin wrapper
#define READ(IO) _READ(IO)
@@ -115,12 +115,12 @@
#define SET_PWM(IO) SET_OUTPUT(IO)
/// check if pin is an input wrapper
#define GET_INPUT(IO) _GET_INPUT(IO)
#define IS_INPUT(IO) _IS_INPUT(IO)
/// check if pin is an output wrapper
#define GET_OUTPUT(IO) _GET_OUTPUT(IO)
#define IS_OUTPUT(IO) _IS_OUTPUT(IO)
/// check if pin is a timer (wrapper)
#define GET_TIMER(IO) _GET_TIMER(IO)
#define HAS_TIMER(IO) _HAS_TIMER(IO)
// Shorthand
#define OUT_WRITE(IO,V) do{ SET_OUTPUT(IO); WRITE(IO,V); }while(0)
+22 -1
View File
@@ -1,3 +1,24 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2019 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 <http://www.gnu.org/licenses/>.
*
*/
#ifdef TARGET_LPC1768
#include <usb/usb.h>
@@ -98,7 +119,7 @@ void HAL_init() {
// HAL idle task
void HAL_idletask(void) {
#if ENABLED(SDSUPPORT) && ENABLED(SHARED_SD_CARD)
#if BOTH(SDSUPPORT, SHARED_SD_CARD)
// If Marlin is using the SD card we need to lock it to prevent access from
// a PC via USB.
// Other HALs use IS_SD_PRINTING() and IS_SD_FILE_OPEN() to check for access but
@@ -74,7 +74,8 @@ bool PersistentStore::access_start() {
// sector is blank so nothing stored yet
for (int i = 0; i < EEPROM_SIZE; i++) ram_eeprom[i] = EEPROM_ERASE;
current_slot = EEPROM_SLOTS;
} else {
}
else {
// current slot is the first non blank one
current_slot = first_nblank_loc / EEPROM_SIZE;
uint8_t *eeprom_data = SLOT_ADDRESS(EEPROM_SECTOR, current_slot);
+6
View File
@@ -40,6 +40,12 @@
#define PRINT_PIN(p) do {sprintf_P(buffer, PSTR("%d.%02d"), LPC1768_PIN_PORT(p), LPC1768_PIN_PIN(p)); SERIAL_ECHO(buffer);} while (0)
#define MULTI_NAME_PAD 16 // space needed to be pretty if not first name assigned to a pin
// pins that will cause hang/reset/disconnect in M43 Toggle and Watch utilities
// uses pin index
#ifndef M43_NEVER_TOUCH
#define M43_NEVER_TOUCH(Q) ((Q) == 29 || (Q) == 30 || (Q) == 73) // USB pins
#endif
// active ADC function/mode/code values for PINSEL registers
constexpr int8_t ADC_pin_mode(pin_t pin) {
return (LPC1768_PIN_PORT(pin) == 0 && LPC1768_PIN_PIN(pin) == 2 ? 2 :
@@ -137,8 +137,11 @@ uint8_t u8g_com_HAL_LPC1768_ssd_hw_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_v
case U8G_COM_MSG_WRITE_BYTE:
//u8g->pin_list[U8G_PI_SET_A0] = 1;
//if (u8g_com_arduino_ssd_start_sequence(u8g) == 0)
// return u8g_i2c_stop(), 0;
if (u8g_com_ssd_I2C_start_sequence(u8g) == 0) {
u8g_i2c_stop();
return 0;
}
if (u8g_i2c_send_byte(arg_val) == 0) {
u8g_i2c_stop();
return 0;
@@ -186,9 +189,6 @@ uint8_t u8g_com_HAL_LPC1768_ssd_hw_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_v
case U8G_COM_MSG_ADDRESS: /* define cmd (arg_val = 0) or data mode (arg_val = 1) */
u8g->pin_list[U8G_PI_A0_STATE] = arg_val;
u8g->pin_list[U8G_PI_SET_A0] = 1; /* force a0 to set again */
u8g_i2c_start(0); // send slave address and write bit
u8g_i2c_send_byte(arg_val ? 0x40 : 0x80); // Write to ? Graphics DRAM mode : Command mode
break;
} // switch
@@ -59,16 +59,82 @@
#if HAS_GRAPHICAL_LCD
#include <U8glib.h>
#include "SoftwareSPI.h"
#undef SPI_SPEED
#define SPI_SPEED 2 // About 2 MHz
#include <Arduino.h>
#include <algorithm>
#include <LPC17xx.h>
#include <gpio.h>
#include <U8glib.h>
uint8_t swSpiTransfer_mode_0(uint8_t b, const uint8_t spi_speed, const pin_t sck_pin, const pin_t miso_pin, const pin_t mosi_pin ) {
for (uint8_t i = 0; i < 8; i++) {
if (spi_speed == 0) {
gpio_set(mosi_pin, !!(b & 0x80));
gpio_set(sck_pin, HIGH);
b <<= 1;
if (miso_pin >= 0 && gpio_get(miso_pin)) b |= 1;
gpio_set(sck_pin, LOW);
}
else {
const uint8_t state = (b & 0x80) ? HIGH : LOW;
for (uint8_t j = 0; j < spi_speed; j++)
gpio_set(mosi_pin, state);
for (uint8_t j = 0; j < spi_speed + (miso_pin >= 0 ? 0 : 1); j++)
gpio_set(sck_pin, HIGH);
b <<= 1;
if (miso_pin >= 0 && gpio_get(miso_pin)) b |= 1;
for (uint8_t j = 0; j < spi_speed; j++)
gpio_set(sck_pin, LOW);
}
}
return b;
}
uint8_t swSpiTransfer_mode_3(uint8_t b, const uint8_t spi_speed, const pin_t sck_pin, const pin_t miso_pin, const pin_t mosi_pin ) {
for (uint8_t i = 0; i < 8; i++) {
const uint8_t state = (b & 0x80) ? HIGH : LOW;
if (spi_speed == 0) {
gpio_set(sck_pin, LOW);
gpio_set(mosi_pin, state);
gpio_set(mosi_pin, state); // need some setup time
gpio_set(sck_pin, HIGH);
}
else {
for (uint8_t j = 0; j < spi_speed + (miso_pin >= 0 ? 0 : 1); j++)
gpio_set(sck_pin, LOW);
for (uint8_t j = 0; j < spi_speed; j++)
gpio_set(mosi_pin, state);
for (uint8_t j = 0; j < spi_speed; j++)
gpio_set(sck_pin, HIGH);
}
b <<= 1;
if (miso_pin >= 0 && gpio_get(miso_pin)) b |= 1;
}
return b;
}
static uint8_t SPI_speed = 0;
static void u8g_sw_spi_HAL_LPC1768_shift_out(uint8_t dataPin, uint8_t clockPin, uint8_t val) {
swSpiTransfer(val, SPI_speed, clockPin, -1, dataPin);
#if ENABLED(FYSETC_MINI_12864)
swSpiTransfer_mode_3(val, SPI_speed, clockPin, -1, dataPin);
#else
swSpiTransfer_mode_0(val, SPI_speed, clockPin, -1, dataPin);
#endif
}
uint8_t u8g_com_HAL_LPC1768_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr) {
+4 -2
View File
@@ -74,8 +74,10 @@ void watchdog_reset() {
#else
void HAL_clear_reset_source(void) {}
uint8_t HAL_get_reset_source(void) { return RST_POWER_ON; }
void watchdog_init(void) {}
void watchdog_reset(void) {}
void HAL_clear_reset_source(void) {}
uint8_t HAL_get_reset_source(void) { return RST_POWER_ON; }
#endif // USE_WATCHDOG
+4 -2
View File
@@ -36,8 +36,10 @@
#if ENABLED(EEPROM_EMULATED_WITH_SRAM)
#if STM32F7xx
#include "stm32f7xx_ll_pwr.h"
#elif STM32F4xx
#include "stm32f4xx_ll_pwr.h"
#else
#error "EEPROM_EMULATED_WITH_SRAM is currently only supported for STM32F7xx"
#error "EEPROM_EMULATED_WITH_SRAM is currently only supported for STM32F4xx and STM32F7xx"
#endif
#endif // EEPROM_EMULATED_WITH_SRAM
@@ -118,7 +120,7 @@ void HAL_init(void) {
void HAL_clear_reset_source(void) { __HAL_RCC_CLEAR_RESET_FLAGS(); }
uint8_t HAL_get_reset_source (void) {
uint8_t HAL_get_reset_source(void) {
if (__HAL_RCC_GET_FLAG(RCC_FLAG_IWDGRST) != RESET) return RST_WATCHDOG;
if (__HAL_RCC_GET_FLAG(RCC_FLAG_SFTRST) != RESET) return RST_SOFTWARE;
if (__HAL_RCC_GET_FLAG(RCC_FLAG_PINRST) != RESET) return RST_EXTERNAL;
+10 -10
View File
@@ -28,20 +28,20 @@
// Includes
// --------------------------------------------------------------------------
#include <stdint.h>
#include "Arduino.h"
#ifdef USBCON
#include <USBSerial.h>
#endif
#include "../../inc/MarlinConfigPre.h"
#include "../shared/Marduino.h"
#include "../shared/math_32bit.h"
#include "../shared/HAL_SPI.h"
#include "fastio_STM32.h"
#include "watchdog_STM32.h"
#include "../../inc/MarlinConfigPre.h"
#include <stdint.h>
#ifdef USBCON
#include <USBSerial.h>
#endif
// --------------------------------------------------------------------------
// Defines
// --------------------------------------------------------------------------
@@ -165,7 +165,7 @@ void HAL_init(void);
void HAL_clear_reset_source (void);
/** reset reason */
uint8_t HAL_get_reset_source (void);
uint8_t HAL_get_reset_source(void);
void _delay_ms(const int delay);
+6 -2
View File
@@ -25,8 +25,8 @@
* Test Re-ARM specific configuration values for errors at compile-time.
*/
#if ENABLED(SPINDLE_LASER_ENABLE)
#if !PIN_EXISTS(SPINDLE_LASER_ENABLE)
#error "SPINDLE_LASER_ENABLE requires SPINDLE_LASER_ENABLE_PIN."
#if !PIN_EXISTS(SPINDLE_LASER_ENA)
#error "SPINDLE_LASER_ENABLE requires SPINDLE_LASER_ENA_PIN."
#elif SPINDLE_DIR_CHANGE && !PIN_EXISTS(SPINDLE_DIR)
#error "SPINDLE_DIR_PIN not defined."
#elif ENABLED(SPINDLE_LASER_PWM) && PIN_EXISTS(SPINDLE_LASER_PWM)
@@ -69,3 +69,7 @@
#if ENABLED(EMERGENCY_PARSER)
#error "EMERGENCY_PARSER is not yet implemented for STM32. Disable EMERGENCY_PARSER to continue."
#endif
#if ENABLED(FAST_PWM_FAN)
#error "FAST_PWM_FAN is not yet implemented for this platform."
#endif
+4 -4
View File
@@ -78,11 +78,11 @@ void FastIO_init(); // Must be called before using fast io macros
#define SET_OUTPUT(IO) OUT_WRITE(IO, LOW)
#define SET_PWM(IO) _SET_MODE(IO, PWM)
#define GET_INPUT(IO)
#define GET_OUTPUT(IO)
#define GET_TIMER(IO)
#define IS_INPUT(IO)
#define IS_OUTPUT(IO)
#define HAS_TIMER(IO) digitalPinHasPWM(IO)
#define PWM_PIN(P) digitalPinHasPWM(P)
#define PWM_PIN(P) HAS_TIMER(P)
#define USEABLE_HARDWARE_PWM(P) PWM_PIN(P)
// digitalRead/Write wrappers
@@ -28,20 +28,20 @@
#include "../shared/persistent_store_api.h"
#if DISABLED(EEPROM_EMULATED_WITH_SRAM) && DISABLED(SPI_EEPROM) && DISABLED(I2C_EEPROM)
#if DISABLED(EEPROM_EMULATED_WITH_SRAM, SPI_EEPROM, I2C_EEPROM)
#include <EEPROM.h>
static bool eeprom_data_written = false;
#endif
bool PersistentStore::access_start() {
#if DISABLED(EEPROM_EMULATED_WITH_SRAM) && DISABLED(SPI_EEPROM) && DISABLED(I2C_EEPROM)
#if DISABLED(EEPROM_EMULATED_WITH_SRAM, SPI_EEPROM, I2C_EEPROM)
eeprom_buffer_fill();
#endif
return true;
}
bool PersistentStore::access_finish() {
#if DISABLED(EEPROM_EMULATED_WITH_SRAM) && DISABLED(SPI_EEPROM) && DISABLED(I2C_EEPROM)
#if DISABLED(EEPROM_EMULATED_WITH_SRAM, SPI_EEPROM, I2C_EEPROM)
if (eeprom_data_written) {
eeprom_buffer_flush();
eeprom_data_written = false;
@@ -55,7 +55,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
uint8_t v = *value;
// Save to either external EEPROM, program flash or Backup SRAM
#if ENABLED(SPI_EEPROM) || ENABLED(I2C_EEPROM)
#if EITHER(SPI_EEPROM, I2C_EEPROM)
// EEPROM has only ~100,000 write cycles,
// so only write bytes that have changed!
uint8_t * const p = (uint8_t * const)pos;
@@ -76,7 +76,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
pos++;
value++;
};
#if DISABLED(EEPROM_EMULATED_WITH_SRAM) && DISABLED(SPI_EEPROM) && DISABLED(I2C_EEPROM)
#if DISABLED(EEPROM_EMULATED_WITH_SRAM, SPI_EEPROM, I2C_EEPROM)
eeprom_data_written = true;
#endif
@@ -87,7 +87,7 @@ bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t
do {
// Read from either external EEPROM, program flash or Backup SRAM
const uint8_t c = (
#if ENABLED(SPI_EEPROM) || ENABLED(I2C_EEPROM)
#if EITHER(SPI_EEPROM, I2C_EEPROM)
eeprom_read_byte((uint8_t*)pos)
#elif DISABLED(EEPROM_EMULATED_WITH_SRAM)
eeprom_buffered_read_byte(pos)
@@ -105,7 +105,7 @@ bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t
}
size_t PersistentStore::capacity() {
#if ENABLED(SPI_EEPROM) || ENABLED(I2C_EEPROM)
#if EITHER(SPI_EEPROM, I2C_EEPROM)
return E2END + 1;
#elif DISABLED(EEPROM_EMULATED_WITH_SRAM)
return E2END + 1;
+9 -8
View File
@@ -36,14 +36,7 @@
// Includes
// --------------------------------------------------------------------------
#include <stdint.h>
#include <util/atomic.h>
#include <Arduino.h>
// --------------------------------------------------------------------------
// Includes
// --------------------------------------------------------------------------
#include "../shared/Marduino.h"
#include "../shared/math_32bit.h"
#include "../shared/HAL_SPI.h"
@@ -51,6 +44,10 @@
#include "watchdog_STM32F1.h"
#include "HAL_timers_STM32F1.h"
#include <stdint.h>
#include <util/atomic.h>
#include "../../inc/MarlinConfigPre.h"
// --------------------------------------------------------------------------
@@ -130,6 +127,10 @@ void HAL_init();
#define analogInputToDigitalPin(p) (p)
#endif
#ifndef digitalPinHasPWM
#define digitalPinHasPWM(P) (PIN_MAP[P].timer_device != NULL)
#endif
#define CRITICAL_SECTION_START uint32_t primask = __get_primask(); (void)__iCliRetVal()
#define CRITICAL_SECTION_END if (!primask) (void)__iSeiRetVal()
#define ISRS_ENABLED() (!__get_primask())
@@ -21,7 +21,7 @@
*
*/
#if defined(__STM32F1__) && (defined(STM32_HIGH_DENSITY) || defined(STM32_XL_DENSITY))
#if defined(ARDUINO_ARCH_STM32F1) && (defined(STM32_HIGH_DENSITY) || defined(STM32_XL_DENSITY))
#include "HAL_sdio_STM32F1.h"
@@ -76,7 +76,7 @@ bool SDIO_Init(void) {
return true;
}
bool SDIO_ReadBlock(uint32_t blockAddress, uint8_t *data) {
bool SDIO_ReadBlock_DMA(uint32_t blockAddress, uint8_t *data) {
if (SDIO_GetCardState() != SDIO_CARD_TRANSFER) return false;
if (blockAddress >= SdCard.LogBlockNbr) return false;
if ((0x03 & (uint32_t)data)) return false; // misaligned data
@@ -100,6 +100,12 @@ bool SDIO_ReadBlock(uint32_t blockAddress, uint8_t *data) {
dma_disable(SDIO_DMA_DEV, SDIO_DMA_CHANNEL);
if (SDIO->STA & SDIO_STA_RXDAVL) {
while (SDIO->STA & SDIO_STA_RXDAVL) (void) SDIO->FIFO;
SDIO_CLEAR_FLAG(SDIO_ICR_CMD_FLAGS | SDIO_ICR_DATA_FLAGS);
return false;
}
if (SDIO_GET_FLAG(SDIO_STA_TRX_ERROR_FLAGS)) {
SDIO_CLEAR_FLAG(SDIO_ICR_CMD_FLAGS | SDIO_ICR_DATA_FLAGS);
return false;
@@ -108,6 +114,12 @@ bool SDIO_ReadBlock(uint32_t blockAddress, uint8_t *data) {
return true;
}
bool SDIO_ReadBlock(uint32_t blockAddress, uint8_t *data) {
uint32_t retries = 3;
while (retries--) if (SDIO_ReadBlock_DMA(blockAddress, data)) return true;
return false;
}
bool SDIO_WriteBlock(uint32_t blockAddress, const uint8_t *data) {
if (SDIO_GetCardState() != SDIO_CARD_TRANSFER) return false;
if (blockAddress >= SdCard.LogBlockNbr) return false;
@@ -264,4 +276,4 @@ bool SDIO_GetCmdResp7(void) {
return true;
}
#endif // __STM32F1__ && (STM32_HIGH_DENSITY || STM32_XL_DENSITY)
#endif // ARDUINO_ARCH_STM32F1 && (STM32_HIGH_DENSITY || STM32_XL_DENSITY)
@@ -25,7 +25,8 @@
// Includes
// --------------------------------------------------------------------------
#include "Arduino.h"
#include "../shared/Marduino.h"
#include "libmaple/sdio.h"
#include "libmaple/dma.h"
+6 -2
View File
@@ -28,8 +28,8 @@
* Test Re-ARM specific configuration values for errors at compile-time.
*/
#if ENABLED(SPINDLE_LASER_ENABLE)
#if !PIN_EXISTS(SPINDLE_LASER_ENABLE)
#error "SPINDLE_LASER_ENABLE requires SPINDLE_LASER_ENABLE_PIN."
#if !PIN_EXISTS(SPINDLE_LASER_ENA)
#error "SPINDLE_LASER_ENABLE requires SPINDLE_LASER_ENA_PIN."
#elif SPINDLE_DIR_CHANGE && !PIN_EXISTS(SPINDLE_DIR)
#error "SPINDLE_DIR_PIN not defined."
#elif ENABLED(SPINDLE_LASER_PWM) && PIN_EXISTS(SPINDLE_LASER_PWM)
@@ -74,3 +74,7 @@
#if ENABLED(SDIO_SUPPORT) && DISABLED(SDSUPPORT)
#error "SDIO_SUPPORT requires SDSUPPORT. Enable SDSUPPORT to continue."
#endif
#if ENABLED(FAST_PWM_FAN)
#error "FAST_PWM_FAN is not yet implemented for this platform."
#endif
+4 -4
View File
@@ -45,11 +45,11 @@
#define SET_OUTPUT(IO) OUT_WRITE(IO, LOW)
#define SET_PWM(IO) pinMode(IO, PWM) // do{ gpio_set_mode(PIN_MAP[pin].gpio_device, PIN_MAP[pin].gpio_bit, GPIO_AF_OUTPUT_PP); timer_set_mode(PIN_MAP[pin].timer_device, PIN_MAP[pin].timer_channel, TIMER_PWM); }while(0)
#define GET_INPUT(IO) (_GET_MODE(IO) == GPIO_INPUT_FLOATING || _GET_MODE(IO) == GPIO_INPUT_ANALOG || _GET_MODE(IO) == GPIO_INPUT_PU || _GET_MODE(IO) == GPIO_INPUT_PD)
#define GET_OUTPUT(IO) (_GET_MODE(IO) == GPIO_OUTPUT_PP)
#define GET_TIMER(IO) (PIN_MAP[IO].timer_device != NULL)
#define IS_INPUT(IO) (_GET_MODE(IO) == GPIO_INPUT_FLOATING || _GET_MODE(IO) == GPIO_INPUT_ANALOG || _GET_MODE(IO) == GPIO_INPUT_PU || _GET_MODE(IO) == GPIO_INPUT_PD)
#define IS_OUTPUT(IO) (_GET_MODE(IO) == GPIO_OUTPUT_PP)
#define HAS_TIMER(IO) (PIN_MAP[IO].timer_device != NULL)
#define PWM_PIN(P) digitalPinHasPWM(P)
#define PWM_PIN(P) HAS_TIMER(P)
#define USEABLE_HARDWARE_PWM(P) PWM_PIN(P)
// digitalRead/Write wrappers
@@ -32,7 +32,7 @@
#include "../../inc/MarlinConfig.h"
// This is for EEPROM emulation in flash
#if ENABLED(EEPROM_SETTINGS) && ENABLED(FLASH_EEPROM_EMULATION)
#if BOTH(EEPROM_SETTINGS, FLASH_EEPROM_EMULATION)
#include "../shared/persistent_store_api.h"
@@ -79,14 +79,15 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, const size_t si
}
// Now, write any remaining single byte
if (size & 1) {
const uint16_t odd = size & 1;
if (odd) {
uint16_t temp = value[size - 1];
status = FLASH_ProgramHalfWord(pageBase + pos + i, temp);
if (status != FLASH_COMPLETE) return true;
}
crc16(crc, value, size);
pos += ((size + 1) & ~1);
pos += size + odd;
return false;
}
@@ -97,7 +98,7 @@ bool PersistentStore::read_data(int &pos, uint8_t* value, const size_t size, uin
if (writing) value[i] = c;
crc16(crc, &c, 1);
}
pos += ((size + 1) & ~1);
pos += ((size + 1) & ~1); // i.e., size+(size&1), round up odd values
return false;
}
@@ -55,7 +55,7 @@ bool PersistentStore::access_start() {
bool PersistentStore::access_finish() {
if (!card.isDetected()) return false;
card.openFile(eeprom_filename, true);
card.openFile(eeprom_filename, false);
int16_t bytes_written = card.write(HAL_STM32F1_eeprom_content, HAL_STM32F1_EEPROM_SIZE);
card.closefile();
return (bytes_written == HAL_STM32F1_EEPROM_SIZE);
@@ -26,7 +26,7 @@
* Communication interface for FSMC
*/
#if (defined(STM32F1) || defined(STM32F1xx)) && (defined(STM32_HIGH_DENSITY) || defined(STM32_XL_DENSITY))
#if defined(ARDUINO_ARCH_STM32F1) && (defined(STM32_HIGH_DENSITY) || defined(STM32_XL_DENSITY))
#include "../../inc/MarlinConfig.h"
@@ -267,4 +267,4 @@ uint32_t LCD_IO_ReadData(uint16_t RegValue, uint8_t ReadSize) {
#endif // HAS_GRAPHICAL_LCD
#endif // (STM32F1 || STM32F1xx) && (STM32_HIGH_DENSITY || STM32_XL_DENSITY)
#endif // ARDUINO_ARCH_STM32F1 && (STM32_HIGH_DENSITY || STM32_XL_DENSITY)
@@ -1,50 +1,48 @@
/**
******************************************************************************
* @file EEPROM/EEPROM_Emulation/inc/eeprom.h
* @author MCD Application Team
* @version V1.2.6
* @date 04-November-2016
* @brief This file contains all the functions prototypes for the EEPROM
* emulation firmware library.
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright 2016 STMicroelectronics International N.V.
* All rights reserved.</center></h2>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted, provided that the following conditions are met:
*
* 1. Redistribution of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. 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.
* 3. Neither the name of STMicroelectronics nor the names of other
* contributors to this software may be used to endorse or promote products
* derived from this software without specific written permission.
* 4. This software, including modifications and/or derivative works of this
* software, must execute solely and exclusively on microcontroller or
* microprocessor devices manufactured by or for STMicroelectronics.
* 5. Redistribution and use of this software other than as permitted under
* this license is void and will automatically terminate your rights under
* this license.
*
* THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
* RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
* SHALL STMICROELECTRONICS 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.
*
******************************************************************************
*/
/******************************************************************************
* @file eeprom_emul.h
* @author MCD Application Team
* @version V1.2.6
* @date 04-November-2016
* @brief This file contains all the functions prototypes for the EEPROM
* emulation firmware library.
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright 2016 STMicroelectronics International N.V.
* All rights reserved.</center></h2>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted, provided that the following conditions are met:
*
* 1. Redistribution of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. 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.
* 3. Neither the name of STMicroelectronics nor the names of other
* contributors to this software may be used to endorse or promote products
* derived from this software without specific written permission.
* 4. This software, including modifications and/or derivative works of this
* software, must execute solely and exclusively on microcontroller or
* microprocessor devices manufactured by or for STMicroelectronics.
* 5. Redistribution and use of this software other than as permitted under
* this license is void and will automatically terminate your rights under
* this license.
*
* THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
* RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
* SHALL STMICROELECTRONICS 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.
*
******************************************************************************/
#pragma once
// --------------------------------------------------------------------------
@@ -26,7 +26,7 @@
#include "../../inc/MarlinConfig.h"
#if ENABLED(EEPROM_SETTINGS) && DISABLED(I2C_EEPROM) && DISABLED(SPI_EEPROM)
#if ENABLED(EEPROM_SETTINGS) && DISABLED(I2C_EEPROM, SPI_EEPROM)
// --------------------------------------------------------------------------
// Includes
@@ -138,5 +138,5 @@ void eeprom_update_block(const void *__src, void *__dst, size_t __n) {
}
#endif // ENABLED(EEPROM_SETTINGS) && DISABLED(I2C_EEPROM) && DISABLED(SPI_EEPROM)
#endif // EEPROM_SETTINGS && (!I2C_EEPROM && !SPI_EEPROM)
#endif // STM32GENERIC && STM32F4
+1 -1
View File
@@ -79,7 +79,7 @@ void sei(void) { interrupts(); }
void HAL_clear_reset_source(void) { __HAL_RCC_CLEAR_RESET_FLAGS(); }
uint8_t HAL_get_reset_source (void) {
uint8_t HAL_get_reset_source(void) {
if (__HAL_RCC_GET_FLAG(RCC_FLAG_IWDGRST) != RESET) return RST_WATCHDOG;
if (__HAL_RCC_GET_FLAG(RCC_FLAG_SFTRST) != RESET) return RST_SOFTWARE;
+10 -10
View File
@@ -32,21 +32,21 @@
// Includes
// --------------------------------------------------------------------------
#include <stdint.h>
#include "Arduino.h"
#ifdef USBCON
#include <USBSerial.h>
#endif
#include "../shared/Marduino.h"
#include "../shared/math_32bit.h"
#include "../shared/HAL_SPI.h"
#include "fastio_STM32F4.h"
#include "watchdog_STM32F4.h"
#include "HAL_timers_STM32F4.h"
#include "../../inc/MarlinConfigPre.h"
#include <stdint.h>
#ifdef USBCON
#include <USBSerial.h>
#endif
// --------------------------------------------------------------------------
// Defines
// --------------------------------------------------------------------------
@@ -170,7 +170,7 @@ extern uint16_t HAL_adc_result;
void HAL_clear_reset_source (void);
/** reset reason */
uint8_t HAL_get_reset_source (void);
uint8_t HAL_get_reset_source(void);
void _delay_ms(const int delay);
+6 -2
View File
@@ -24,8 +24,8 @@
* Test Re-ARM specific configuration values for errors at compile-time.
*/
#if ENABLED(SPINDLE_LASER_ENABLE)
#if !PIN_EXISTS(SPINDLE_LASER_ENABLE)
#error "SPINDLE_LASER_ENABLE requires SPINDLE_LASER_ENABLE_PIN."
#if !PIN_EXISTS(SPINDLE_LASER_ENA)
#error "SPINDLE_LASER_ENABLE requires SPINDLE_LASER_ENA_PIN."
#elif SPINDLE_DIR_CHANGE && !PIN_EXISTS(SPINDLE_DIR)
#error "SPINDLE_DIR_PIN not defined."
#elif ENABLED(SPINDLE_LASER_PWM) && PIN_EXISTS(SPINDLE_LASER_PWM)
@@ -68,3 +68,7 @@
#if ENABLED(EMERGENCY_PARSER)
#error "EMERGENCY_PARSER is not yet implemented for STM32F4. Disable EMERGENCY_PARSER to continue."
#endif
#if ENABLED(FAST_PWM_FAN)
#error "FAST_PWM_FAN is not yet implemented for this platform."
#endif
+4 -4
View File
@@ -48,11 +48,11 @@
#define TOGGLE(IO) OUT_WRITE(IO, !READ(IO))
#define GET_INPUT(IO)
#define GET_OUTPUT(IO)
#define GET_TIMER(IO)
#define IS_INPUT(IO)
#define IS_OUTPUT(IO)
#define HAS_TIMER(IO) true
#define PWM_PIN(P) true
#define PWM_PIN(P) HAS_TIMER(P)
#define USEABLE_HARDWARE_PWM(P) PWM_PIN(P)
// digitalRead/Write wrappers
@@ -1,50 +1,48 @@
/**
******************************************************************************
* @file EEPROM/EEPROM_Emulation/inc/eeprom.h
* @author MCD Application Team
* @version V1.2.6
* @date 04-November-2016
* @brief This file contains all the functions prototypes for the EEPROM
* emulation firmware library.
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright © 2016 STMicroelectronics International N.V.
* All rights reserved.</center></h2>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted, provided that the following conditions are met:
*
* 1. Redistribution of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. 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.
* 3. Neither the name of STMicroelectronics nor the names of other
* contributors to this software may be used to endorse or promote products
* derived from this software without specific written permission.
* 4. This software, including modifications and/or derivative works of this
* software, must execute solely and exclusively on microcontroller or
* microprocessor devices manufactured by or for STMicroelectronics.
* 5. Redistribution and use of this software other than as permitted under
* this license is void and will automatically terminate your rights under
* this license.
*
* THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
* RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
* SHALL STMICROELECTRONICS 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.
*
******************************************************************************
*/
/******************************************************************************
* @file eeprom_emul.h
* @author MCD Application Team
* @version V1.2.6
* @date 04-November-2016
* @brief This file contains all the functions prototypes for the EEPROM
* emulation firmware library.
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright © 2016 STMicroelectronics International N.V.
* All rights reserved.</center></h2>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted, provided that the following conditions are met:
*
* 1. Redistribution of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. 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.
* 3. Neither the name of STMicroelectronics nor the names of other
* contributors to this software may be used to endorse or promote products
* derived from this software without specific written permission.
* 4. This software, including modifications and/or derivative works of this
* software, must execute solely and exclusively on microcontroller or
* microprocessor devices manufactured by or for STMicroelectronics.
* 5. Redistribution and use of this software other than as permitted under
* this license is void and will automatically terminate your rights under
* this license.
*
* THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
* RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
* SHALL STMICROELECTRONICS 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.
*
*****************************************************************************/
#pragma once
// --------------------------------------------------------------------------
+1 -1
View File
@@ -79,7 +79,7 @@ void sei(void) { interrupts(); }
void HAL_clear_reset_source(void) { __HAL_RCC_CLEAR_RESET_FLAGS(); }
uint8_t HAL_get_reset_source (void) {
uint8_t HAL_get_reset_source(void) {
if (__HAL_RCC_GET_FLAG(RCC_FLAG_IWDGRST) != RESET)
return RST_WATCHDOG;
+3 -3
View File
@@ -34,8 +34,7 @@
#include <stdint.h>
#include "Arduino.h"
#include "../shared/Marduino.h"
#include "../shared/math_32bit.h"
#include "../shared/HAL_SPI.h"
@@ -44,6 +43,7 @@
#include "HAL_timers_STM32F7.h"
#include "../../inc/MarlinConfigPre.h"
// --------------------------------------------------------------------------
// Defines
@@ -157,7 +157,7 @@ extern uint16_t HAL_adc_result;
void HAL_clear_reset_source (void);
/** reset reason */
uint8_t HAL_get_reset_source (void);
uint8_t HAL_get_reset_source(void);
void _delay_ms(const int delay);
+6 -2
View File
@@ -24,8 +24,8 @@
* Test Re-ARM specific configuration values for errors at compile-time.
*/
#if ENABLED(SPINDLE_LASER_ENABLE)
#if !PIN_EXISTS(SPINDLE_LASER_ENABLE)
#error "SPINDLE_LASER_ENABLE requires SPINDLE_LASER_ENABLE_PIN."
#if !PIN_EXISTS(SPINDLE_LASER_ENA)
#error "SPINDLE_LASER_ENABLE requires SPINDLE_LASER_ENA_PIN."
#elif SPINDLE_DIR_CHANGE && !PIN_EXISTS(SPINDLE_DIR)
#error "SPINDLE_DIR_PIN not defined."
#elif ENABLED(SPINDLE_LASER_PWM) && PIN_EXISTS(SPINDLE_LASER_PWM)
@@ -70,3 +70,7 @@
#if ENABLED(EMERGENCY_PARSER)
#error "EMERGENCY_PARSER is not yet implemented for STM32F7. Disable EMERGENCY_PARSER to continue."
#endif
#if ENABLED(FAST_PWM_FAN)
#error "FAST_PWM_FAN is not yet implemented for this platform."
#endif
+4 -4
View File
@@ -47,11 +47,11 @@
#define TOGGLE(IO) OUT_WRITE(IO, !READ(IO))
#define GET_INPUT(IO)
#define GET_OUTPUT(IO)
#define GET_TIMER(IO)
#define IS_INPUT(IO)
#define IS_OUTPUT(IO)
#define HAS_TIMER(IO) true
#define PWM_PIN(P) true
#define PWM_PIN(P) HAS_TIMER(P)
#define USEABLE_HARDWARE_PWM(P) PWM_PIN(P)
// digitalRead/Write wrappers
+1 -8
View File
@@ -28,14 +28,7 @@
#define CPU_32_BIT
// _BV is re-defined in Arduino.h
#undef _BV
#include <Arduino.h>
// Redefine sq macro defined by teensy3/wiring.h
#undef sq
#define sq(x) ((x)*(x))
#include "../shared/Marduino.h"
#include "../math_32bit.h"
#include "../HAL_SPI.h"
@@ -27,3 +27,7 @@
#if ENABLED(EMERGENCY_PARSER)
#error "EMERGENCY_PARSER is not yet implemented for Teensy 3.1/3.2. Disable EMERGENCY_PARSER to continue."
#endif
#if ENABLED(FAST_PWM_FAN)
#error "FAST_PWM_FAN is not yet implemented for this platform."
#endif
@@ -67,8 +67,8 @@
GPIO_BITBAND(CORE_PIN ## P ## _DDRREG , CORE_PIN ## P ## _BIT) = 0; \
}while(0)
#define _GET_INPUT(P) ((CORE_PIN ## P ## _DDRREG & CORE_PIN ## P ## _BITMASK) == 0)
#define _GET_OUTPUT(P) ((CORE_PIN ## P ## _DDRREG & CORE_PIN ## P ## _BITMASK) == 0)
#define _IS_INPUT(P) ((CORE_PIN ## P ## _DDRREG & CORE_PIN ## P ## _BITMASK) == 0)
#define _IS_OUTPUT(P) ((CORE_PIN ## P ## _DDRREG & CORE_PIN ## P ## _BITMASK) == 0)
#define READ(IO) _READ(IO)
@@ -81,8 +81,8 @@
#define SET_OUTPUT(IO) _SET_OUTPUT(IO)
#define SET_PWM(IO) SET_OUTPUT(IO)
#define GET_INPUT(IO) _GET_INPUT(IO)
#define GET_OUTPUT(IO) _GET_OUTPUT(IO)
#define IS_INPUT(IO) _IS_INPUT(IO)
#define IS_OUTPUT(IO) _IS_OUTPUT(IO)
#define OUT_WRITE(IO,V) do{ SET_OUTPUT(IO); WRITE(IO,V); }while(0)
+4 -14
View File
@@ -31,15 +31,7 @@
// Includes
// --------------------------------------------------------------------------
// _BV is re-defined in Arduino.h
#undef _BV
#include <Arduino.h>
// Redefine sq macro defined by teensy3/wiring.h
#undef sq
#define sq(x) ((x)*(x))
#include "../shared/Marduino.h"
#include "../shared/math_32bit.h"
#include "../shared/HAL_SPI.h"
@@ -49,6 +41,7 @@
#include "HAL_timers_Teensy.h"
#include <stdint.h>
#include <util/atomic.h>
#define ST7920_DELAY_1 DELAY_NS(600)
#define ST7920_DELAY_2 DELAY_NS(750)
@@ -58,9 +51,6 @@
// Defines
// --------------------------------------------------------------------------
#undef MOTHERBOARD
#define MOTHERBOARD BOARD_TEENSY35_36
#define IS_32BIT_TEENSY (defined(__MK64FX512__) || defined(__MK66FX1M0__))
#define IS_TEENSY35 defined(__MK64FX512__)
#define IS_TEENSY36 defined(__MK66FX1M0__)
@@ -87,9 +77,9 @@ typedef int8_t pin_t;
#define analogInputToDigitalPin(p) ((p < 12u) ? (p) + 54u : -1)
#endif
#define CRITICAL_SECTION_START uint32_t primask = __get_PRIMASK(); __disable_irq()
#define CRITICAL_SECTION_START uint32_t primask = __get_primask(); __disable_irq()
#define CRITICAL_SECTION_END if (!primask) __enable_irq()
#define ISRS_ENABLED() (!__get_PRIMASK())
#define ISRS_ENABLED() (!__get_primask())
#define ENABLE_ISRS() __enable_irq()
#define DISABLE_ISRS() __disable_irq()
@@ -27,3 +27,7 @@
#if ENABLED(EMERGENCY_PARSER)
#error "EMERGENCY_PARSER is not yet implemented for Teensy 3.5/3.6. Disable EMERGENCY_PARSER to continue."
#endif
#if ENABLED(FAST_PWM_FAN)
#error "FAST_PWM_FAN is not yet implemented for this platform."
#endif
@@ -66,8 +66,8 @@
GPIO_BITBAND(CORE_PIN ## P ## _DDRREG , CORE_PIN ## P ## _BIT) = 0; \
}while(0)
#define _GET_INPUT(P) ((CORE_PIN ## P ## _DDRREG & CORE_PIN ## P ## _BITMASK) == 0)
#define _GET_OUTPUT(P) ((CORE_PIN ## P ## _DDRREG & CORE_PIN ## P ## _BITMASK) == 0)
#define _IS_INPUT(P) ((CORE_PIN ## P ## _DDRREG & CORE_PIN ## P ## _BITMASK) == 0)
#define _IS_OUTPUT(P) ((CORE_PIN ## P ## _DDRREG & CORE_PIN ## P ## _BITMASK) == 0)
#define READ(IO) _READ(IO)
@@ -80,8 +80,8 @@
#define SET_OUTPUT(IO) _SET_OUTPUT(IO)
#define SET_PWM(IO) SET_OUTPUT(IO)
#define GET_INPUT(IO) _GET_INPUT(IO)
#define GET_OUTPUT(IO) _GET_OUTPUT(IO)
#define IS_INPUT(IO) _IS_INPUT(IO)
#define IS_OUTPUT(IO) _IS_OUTPUT(IO)
#define OUT_WRITE(IO,V) do{ SET_OUTPUT(IO); WRITE(IO,V); }while(0)
@@ -19,22 +19,18 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#pragma once
/**
* M49.cpp - Toggle the G26 debug flag
* HAL/HAL_ST7920.h
* For the HALs that provide direct access to the ST7920 display
* (bypassing U8G), it will allow the LIGHTWEIGHT_UI to operate.
*/
#include "../../../inc/MarlinConfig.h"
#if ENABLED(G26_MESH_VALIDATION)
#include "../../gcode.h"
#include "../../../feature/bedlevel/bedlevel.h"
void GcodeSuite::M49() {
g26_debug_flag ^= true;
SERIAL_ECHOPGM("G26 Debug: ");
serialprintPGM(g26_debug_flag ? PSTR("On\n") : PSTR("Off\n"));
}
#endif // G26_MESH_VALIDATION
#if HAS_GRAPHICAL_LCD && ENABLED(LIGHTWEIGHT_UI)
void ST7920_cs();
void ST7920_ncs();
void ST7920_set_cmd();
void ST7920_set_dat();
void ST7920_write_byte(const uint8_t data);
#endif
+50
View File
@@ -0,0 +1,50 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2019 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 <http://www.gnu.org/licenses/>.
*
*/
#pragma once
/**
* HAL/shared/Marduino.h
*/
#undef DISABLED // Redefined by ESP32
#undef M_PI // Redefined by all
#undef _BV // Redefined by some
#undef sq // Redefined by teensy3/wiring.h
#include <Arduino.h> // NOTE: If included earlier then this line is a NOOP
#undef DISABLED
#define DISABLED(V...) DO(DIS,&&,V)
#undef _BV
#define _BV(b) (1UL << (b))
#undef sq
#define sq(x) ((x)*(x))
#ifndef SBI
#define SBI(A,B) (A |= (1 << (B)))
#endif
#ifndef CBI
#define CBI(A,B) (A &= ~(1 << (B)))
#endif
@@ -124,13 +124,11 @@ UnwResult UnwStartArm(UnwState * const state) {
/* MRS */
else if ((instr & 0xFFBF0FFF) == 0xE10F0000) {
uint8_t rd = (instr & 0x0000F000) >> 12;
#ifdef UNW_DEBUG
const bool R = !!(instr & 0x00400000);
#else
constexpr bool R = false;
UnwPrintd4("MRS r%d,%s\t; r%d invalidated", rd, R ? "SPSR" : "CPSR", rd);
#endif
uint8_t rd = (instr & 0x0000F000) >> 12;
UnwPrintd4("MRS r%d,%s\t; r%d invalidated", rd, R ? "SPSR" : "CPSR", rd);
/* Status registers untracked */
state->regData[rd].o = REG_VAL_INVALID;
@@ -22,7 +22,7 @@
*/
#include "../../inc/MarlinConfigPre.h"
#if ENABLED(EEPROM_SETTINGS) || ENABLED(SD_FIRMWARE_UPDATE)
#if EITHER(EEPROM_SETTINGS, SD_FIRMWARE_UPDATE)
#include "persistent_store_api.h"
PersistentStore persistentStore;
-1
View File
@@ -55,7 +55,6 @@
#if HAS_SERVOS && !(IS_32BIT_TEENSY || defined(TARGET_LPC1768) || defined(STM32F1) || defined(STM32F1xx) || defined(STM32F4) || defined(STM32F4xx) || defined(STM32F7xx))
//#include <Arduino.h>
#include "servo.h"
#include "servo_private.h"
+29 -19
View File
@@ -30,6 +30,7 @@
#include "Marlin.h"
#include "core/utility.h"
#include "lcd/ultralcd.h"
#include "module/motion.h"
#include "module/planner.h"
@@ -84,6 +85,10 @@
#include "feature/leds/leds.h"
#endif
#if ENABLED(BLTOUCH)
#include "feature/bltouch.h"
#endif
#if HAS_SERVOS
#include "module/servo.h"
#endif
@@ -128,7 +133,7 @@
#include "feature/bedlevel/bedlevel.h"
#endif
#if ENABLED(ADVANCED_PAUSE_FEATURE) && ENABLED(PAUSE_PARK_NO_STEPPER_TIMEOUT)
#if BOTH(ADVANCED_PAUSE_FEATURE, PAUSE_PARK_NO_STEPPER_TIMEOUT)
#include "feature/pause.h"
#endif
@@ -152,7 +157,7 @@
#include "feature/fanmux.h"
#endif
#if DO_SWITCH_EXTRUDER || ENABLED(SWITCHING_NOZZLE) || ENABLED(PARKING_EXTRUDER) || ENABLED(MAGNETIC_PARKING_EXTRUDER)
#if DO_SWITCH_EXTRUDER || ANY(SWITCHING_NOZZLE, PARKING_EXTRUDER, MAGNETIC_PARKING_EXTRUDER)
#include "module/tool_change.h"
#endif
@@ -328,7 +333,7 @@ void disable_all_steppers() {
ExtUI::onFilamentRunout(ExtUI::getActiveTool());
#endif
#if ENABLED(HOST_PROMPT_SUPPORT) || ENABLED(HOST_ACTION_COMMANDS)
#if EITHER(HOST_PROMPT_SUPPORT, HOST_ACTION_COMMANDS)
const char tool = '0'
#if NUM_RUNOUT_SENSORS > 1
+ active_extruder
@@ -443,7 +448,7 @@ void manage_inactivity(const bool ignore_stepper_queue/*=false*/) {
}
// Prevent steppers timing-out in the middle of M600
#if ENABLED(ADVANCED_PAUSE_FEATURE) && ENABLED(PAUSE_PARK_NO_STEPPER_TIMEOUT)
#if BOTH(ADVANCED_PAUSE_FEATURE, PAUSE_PARK_NO_STEPPER_TIMEOUT)
#define MOVE_AWAY_TEST !did_pause_print
#else
#define MOVE_AWAY_TEST true
@@ -452,7 +457,7 @@ void manage_inactivity(const bool ignore_stepper_queue/*=false*/) {
if (stepper_inactive_time) {
static bool already_shutdown_steppers; // = false
if (planner.has_blocks_queued())
gcode.previous_move_ms = ms; // reset_stepper_timeout to keep steppers powered
gcode.reset_stepper_timeout();
else if (MOVE_AWAY_TEST && !ignore_stepper_queue && ELAPSED(ms, gcode.previous_move_ms + stepper_inactive_time)) {
if (!already_shutdown_steppers) {
already_shutdown_steppers = true; // L6470 SPI will consume 99% of free time without this
@@ -468,14 +473,11 @@ void manage_inactivity(const bool ignore_stepper_queue/*=false*/) {
#if ENABLED(DISABLE_INACTIVE_E)
disable_e_steppers();
#endif
#if HAS_LCD_MENU
ui.status_screen();
#if ENABLED(AUTO_BED_LEVELING_UBL)
if (ubl.lcd_map_control) {
ubl.lcd_map_control = false;
ui.defer_status_screen(false);
}
#endif
#if HAS_LCD_MENU && ENABLED(AUTO_BED_LEVELING_UBL)
if (ubl.lcd_map_control) {
ubl.lcd_map_control = false;
ui.defer_status_screen(false);
}
#endif
}
}
@@ -612,7 +614,7 @@ void manage_inactivity(const bool ignore_stepper_queue/*=false*/) {
}
#endif // !SWITCHING_EXTRUDER
gcode.previous_move_ms = ms; // reset_stepper_timeout to keep steppers powered
gcode.reset_stepper_timeout();
}
#endif // EXTRUDER_RUNOUT_PREVENT
@@ -718,7 +720,7 @@ void idle(
#endif
#if ENABLED(PRUSA_MMU2)
mmu2.mmuLoop();
mmu2.mmu_loop();
#endif
}
@@ -937,6 +939,11 @@ void setup() {
queue_setup();
#if ENABLED(SDIO_SUPPORT) && SD_DETECT_PIN == -1
// Auto-mount the SD for EEPROM.dat emulation
if (!card.isDetected()) card.initsd();
#endif
// Load data from EEPROM if available (or use defaults)
// This also updates variables in the planner, elsewhere
(void)settings.load();
@@ -970,7 +977,7 @@ void setup() {
#endif
#if ENABLED(SPINDLE_LASER_ENABLE)
OUT_WRITE(SPINDLE_LASER_ENABLE_PIN, !SPINDLE_LASER_ENABLE_INVERT); // init spindle to off
OUT_WRITE(SPINDLE_LASER_ENA_PIN, !SPINDLE_LASER_ENABLE_INVERT); // init spindle to off
#if SPINDLE_DIR_CHANGE
OUT_WRITE(SPINDLE_DIR_PIN, SPINDLE_INVERT_DIR ? 255 : 0); // init rotation to clockwise (M3)
#endif
@@ -1000,7 +1007,7 @@ void setup() {
dac_init();
#endif
#if (ENABLED(Z_PROBE_SLED) || ENABLED(SOLENOID_PROBE)) && HAS_SOLENOID_1
#if EITHER(Z_PROBE_SLED, SOLENOID_PROBE) && HAS_SOLENOID_1
OUT_WRITE(SOL1_PIN, LOW); // OFF
#endif
@@ -1040,7 +1047,7 @@ void setup() {
ui.init();
ui.reset_status();
#if ENABLED(SHOW_BOOTSCREEN)
#if HAS_SPI_LCD && ENABLED(SHOW_BOOTSCREEN)
ui.show_bootscreen();
#endif
@@ -1049,7 +1056,7 @@ void setup() {
#endif
#if ENABLED(BLTOUCH)
bltouch_init();
bltouch.init();
#endif
#if ENABLED(I2C_POSITION_ENCODERS)
@@ -1138,6 +1145,9 @@ void loop() {
#if ENABLED(POWER_LOSS_RECOVERY)
card.removeJobRecoveryFile();
#endif
#ifdef EVENT_GCODE_SD_STOP
enqueue_and_echo_commands_P(PSTR(EVENT_GCODE_SD_STOP));
#endif
}
#endif // SDSUPPORT
+5 -1
View File
@@ -189,10 +189,12 @@
#define BOARD_COHESION3D_REMIX 1755 // Cohesion3D ReMix
#define BOARD_COHESION3D_MINI 1756 // Cohesion3D Mini
#define BOARD_SMOOTHIEBOARD 1757 // Smoothieboard
#define BOARD_AZTEEG_X5_MINI_WIFI 1758 // Azteeg X5 Mini (Power outputs: Hotend0, Bed, Fan)
#define BOARD_AZTEEG_X5_MINI_WIFI 1758 // Azteeg X5 Mini Wifi (Power outputs: Hotend0, Bed, Fan)
#define BOARD_BIQU_SKR_V1_1 1759 // BIQU SKR_V1.1 (Power outputs: Hotend0,Hotend1, Fan, Bed)
#define BOARD_BIQU_B300_V1_0 1760 // BIQU B300_V1.0 (Power outputs: Hotend0, Fan, Bed, SPI Driver)
#define BOARD_BIGTREE_SKR_V1_3 1761 // BIGTREE SKR_V1.3 (Power outputs: Hotend0, Hotend1, Fan, Bed)
#define BOARD_AZTEEG_X5_MINI 1762 // Azteeg X5 Mini (Power outputs: Hotend0, Bed, Fan)
#define BOARD_MKS_SGEN 1763 // MKS-SGen (Power outputs: Hotend0, Hotend1, Bed, Fan)
//
// SAM3X8E ARM Cortex M3
@@ -253,6 +255,8 @@
#define BOARD_STM32F4 1804 // STM32 STM32GENERIC based STM32F4 controller
#define BOARD_ARMED 1807 // Arm'ed STM32F4 based controller
#define BOARD_RUMBA32 1809 // RUMBA32 STM32F4 based controller
#define BOARD_BLACK_STM32F407VE 1810 // BLACK_STM32F407VE
#define BOARD_BLACK_STM32F407ZE 1811 // BLACK_STM32F407ZE
#define BOARD_STEVAL 1866 // STEVAL-3DP001V1 3D PRINTER BOARD
//
+3 -1
View File
@@ -19,7 +19,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#pragma once
//
// Serial aliases for debugging.
@@ -27,6 +26,7 @@
// (or not) in a given .cpp file
//
#undef DEBUG_PRINT_P
#undef DEBUG_ECHO_START
#undef DEBUG_ERROR_START
#undef DEBUG_CHAR
@@ -47,6 +47,7 @@
#undef DEBUG_DELAY
#if DEBUG_OUT
#define DEBUG_PRINT_P(P) serialprintPGM(P)
#define DEBUG_ECHO_START SERIAL_ECHO_START
#define DEBUG_ERROR_START SERIAL_ERROR_START
#define DEBUG_CHAR SERIAL_CHAR
@@ -66,6 +67,7 @@
#define DEBUG_XYZ SERIAL_XYZ
#define DEBUG_DELAY(ms) serial_delay(ms)
#else
#define DEBUG_PRINT_P(P) NOOP
#define DEBUG_ECHO_START() NOOP
#define DEBUG_ERROR_START() NOOP
#define DEBUG_CHAR(...) NOOP
+39 -14
View File
@@ -52,7 +52,7 @@
#define AXIS_DRIVER_TYPE_X(T) _AXIS_DRIVER_TYPE(X,T)
#define AXIS_DRIVER_TYPE_Y(T) _AXIS_DRIVER_TYPE(Y,T)
#define AXIS_DRIVER_TYPE_Z(T) _AXIS_DRIVER_TYPE(Z,T)
#define AXIS_DRIVER_TYPE_X2(T) ((ENABLED(X_DUAL_STEPPER_DRIVERS) || ENABLED(DUAL_X_CARRIAGE)) && _AXIS_DRIVER_TYPE(X2,T))
#define AXIS_DRIVER_TYPE_X2(T) (EITHER(X_DUAL_STEPPER_DRIVERS, DUAL_X_CARRIAGE) && _AXIS_DRIVER_TYPE(X2,T))
#define AXIS_DRIVER_TYPE_Y2(T) (ENABLED(Y_DUAL_STEPPER_DRIVERS) && _AXIS_DRIVER_TYPE(Y2,T))
#define AXIS_DRIVER_TYPE_Z2(T) (Z_MULTI_STEPPER_DRIVERS && _AXIS_DRIVER_TYPE(Z2,T))
#define AXIS_DRIVER_TYPE_Z3(T) (ENABLED(Z_TRIPLE_STEPPER_DRIVERS) && _AXIS_DRIVER_TYPE(Z3,T))
@@ -65,20 +65,45 @@
#define AXIS_DRIVER_TYPE(A,T) AXIS_DRIVER_TYPE_##A(T)
#define HAS_DRIVER(T) (AXIS_DRIVER_TYPE_X(T) || AXIS_DRIVER_TYPE_X2(T) || \
AXIS_DRIVER_TYPE_Y(T) || AXIS_DRIVER_TYPE_Y2(T) || \
AXIS_DRIVER_TYPE_Z(T) || AXIS_DRIVER_TYPE_Z2(T) || AXIS_DRIVER_TYPE_Z3(T) || \
AXIS_DRIVER_TYPE_E0(T) || AXIS_DRIVER_TYPE_E1(T) || \
AXIS_DRIVER_TYPE_E2(T) || AXIS_DRIVER_TYPE_E3(T) || \
AXIS_DRIVER_TYPE_E4(T) || AXIS_DRIVER_TYPE_E5(T) )
#define HAS_DRIVER(T) ( AXIS_DRIVER_TYPE_X(T) || AXIS_DRIVER_TYPE_X2(T) \
|| AXIS_DRIVER_TYPE_Y(T) || AXIS_DRIVER_TYPE_Y2(T) \
|| AXIS_DRIVER_TYPE_Z(T) || AXIS_DRIVER_TYPE_Z2(T) || AXIS_DRIVER_TYPE_Z3(T) \
|| AXIS_DRIVER_TYPE_E0(T) || AXIS_DRIVER_TYPE_E1(T) \
|| AXIS_DRIVER_TYPE_E2(T) || AXIS_DRIVER_TYPE_E3(T) \
|| AXIS_DRIVER_TYPE_E4(T) || AXIS_DRIVER_TYPE_E5(T) )
// Test for supported TMC drivers that require advanced configuration
// Does not match standalone configurations
#define HAS_TRINAMIC ( HAS_DRIVER(TMC2130) || HAS_DRIVER(TMC2160) || HAS_DRIVER(TMC2208) || HAS_DRIVER(TMC2660) || HAS_DRIVER(TMC5130) || HAS_DRIVER(TMC5160) )
#define HAS_TRINAMIC ( HAS_DRIVER(TMC2130) \
|| HAS_DRIVER(TMC2160) \
|| HAS_DRIVER(TMC2208) \
|| HAS_DRIVER(TMC2660) \
|| HAS_DRIVER(TMC5130) \
|| HAS_DRIVER(TMC5160) )
#define AXIS_IS_TMC(A) ( AXIS_DRIVER_TYPE_##A(TMC2130) || \
AXIS_DRIVER_TYPE_##A(TMC2160) || \
AXIS_DRIVER_TYPE_##A(TMC2208) || \
AXIS_DRIVER_TYPE_##A(TMC2660) || \
AXIS_DRIVER_TYPE_##A(TMC5130) || \
AXIS_DRIVER_TYPE_##A(TMC5160))
#define AXIS_IS_TMC(A) ( AXIS_DRIVER_TYPE(A,TMC2130) \
|| AXIS_DRIVER_TYPE(A,TMC2160) \
|| AXIS_DRIVER_TYPE(A,TMC2208) \
|| AXIS_DRIVER_TYPE(A,TMC2660) \
|| AXIS_DRIVER_TYPE(A,TMC5130) \
|| AXIS_DRIVER_TYPE(A,TMC5160) )
// Test for a driver that uses SPI - this allows checking whether a _CS_ pin
// is considered sensitive
#define AXIS_HAS_SPI(A) ( AXIS_DRIVER_TYPE(A,TMC2130) \
|| AXIS_DRIVER_TYPE(A,TMC2160) \
|| AXIS_DRIVER_TYPE(A,TMC2660) \
|| AXIS_DRIVER_TYPE(A,TMC5130) \
|| AXIS_DRIVER_TYPE(A,TMC5160) )
#define AXIS_HAS_STALLGUARD(A) ( AXIS_DRIVER_TYPE(A,TMC2130) \
|| AXIS_DRIVER_TYPE(A,TMC2160) \
|| AXIS_DRIVER_TYPE(A,TMC2660) \
|| AXIS_DRIVER_TYPE(A,TMC5130) \
|| AXIS_DRIVER_TYPE(A,TMC5160) )
#define AXIS_HAS_STEALTHCHOP(A) ( AXIS_DRIVER_TYPE(A,TMC2130) \
|| AXIS_DRIVER_TYPE(A,TMC2160) \
|| AXIS_DRIVER_TYPE(A,TMC2208) \
|| AXIS_DRIVER_TYPE(A,TMC5130) \
|| AXIS_DRIVER_TYPE(A,TMC5160) )
+6
View File
@@ -39,6 +39,12 @@ enum AxisEnum : unsigned char {
X_HEAD = 4,
Y_HEAD = 5,
Z_HEAD = 6,
E0_AXIS = 3,
E1_AXIS = 4,
E2_AXIS = 5,
E3_AXIS = 6,
E4_AXIS = 7,
E5_AXIS = 8,
ALL_AXES = 0xFE,
NO_AXIS = 0xFF
};
+2 -1
View File
@@ -162,6 +162,8 @@
#define MSG_BEGIN_FILE_LIST "Begin file list"
#define MSG_END_FILE_LIST "End file list"
#define MSG_INVALID_EXTRUDER "Invalid extruder"
#define MSG_INVALID_E_STEPPER "Invalid E stepper"
#define MSG_E_STEPPER_NOT_SPECIFIED "E stepper not specified"
#define MSG_INVALID_SOLENOID "Invalid solenoid"
#define MSG_ERR_NO_THERMISTORS "No thermistors - no temperature"
#define MSG_M115_REPORT "FIRMWARE_NAME:Marlin " DETAILED_BUILD_VERSION " SOURCE_CODE_URL:" SOURCE_CODE_URL " PROTOCOL_VERSION:" PROTOCOL_VERSION " MACHINE_TYPE:" MACHINE_NAME " EXTRUDER_COUNT:" STRINGIFY(EXTRUDERS) " UUID:" MACHINE_UUID
@@ -344,7 +346,6 @@
#define MSG_LCD_N3 " 4"
#define MSG_LCD_N4 " 5"
#define MSG_LCD_N5 " 6"
#define MSG_E0 "E0"
#define MSG_E1 "E1"
#define MSG_E2 "E2"
#define MSG_E3 "E3"

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