Compare commits
288 commits
2.0.x
...
bugfix-2.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fbc2d2d726 | ||
|
|
1b0a5abd73 | ||
|
|
99c377b4e4 | ||
|
|
288eb06708 | ||
|
|
eb3d6a5333 | ||
|
|
37b56e09a3 | ||
|
|
0cccc60409 | ||
|
|
2282801172 | ||
|
|
f4e9f3654e | ||
|
|
40d442fde2 | ||
|
|
6ccb4b93b1 | ||
|
|
ddc23c6224 | ||
|
|
7216b8f804 | ||
|
|
bd6e60f56d | ||
|
|
5b9aeb2e5f | ||
|
|
0465e0ae3a | ||
|
|
3b68e44d9a | ||
|
|
d4ba94479b | ||
|
|
87ce545e15 | ||
|
|
f8ee6f8b31 | ||
|
|
f15fef90a9 | ||
|
|
53e79224fc | ||
|
|
2abb674c87 | ||
|
|
60aadd2a02 | ||
|
|
6ce1eeb4ae | ||
|
|
a70fdfaeba | ||
|
|
f17394d677 | ||
|
|
12ba2ad77e | ||
|
|
59eca253e1 | ||
|
|
4ace02f4c2 | ||
|
|
c753d2b7f4 | ||
|
|
d5fdc75c82 | ||
|
|
3c318d0dc7 | ||
|
|
5013fdaf79 | ||
|
|
06bf3ccfb7 | ||
|
|
dcb0f5dc3b | ||
|
|
18fb4b1ce1 | ||
|
|
45116128e8 | ||
|
|
7beebcd315 | ||
|
|
883347bc11 | ||
|
|
b5ef699523 | ||
|
|
2da25d67e1 | ||
|
|
6954772ece | ||
|
|
2fdeceda58 | ||
|
|
53cc8a0d6e | ||
|
|
10fd9ed896 | ||
|
|
bb7dbceb5c | ||
|
|
a439892d7a | ||
|
|
bd872d5dcf | ||
|
|
bdfedf249a | ||
|
|
4785b04aa1 | ||
|
|
8c052e43f1 | ||
|
|
85d094bbb4 | ||
|
|
97d7af7a23 | ||
|
|
0a64f197d9 | ||
|
|
af75e24c2e | ||
|
|
78e10d346a | ||
|
|
c574bcce88 | ||
|
|
ce90447531 | ||
|
|
f924344cc5 | ||
|
|
323b3a63d6 | ||
|
|
077b9201ef | ||
|
|
1f6612dfc4 | ||
|
|
c43ca39ec2 | ||
|
|
0407828027 | ||
|
|
a1cce36c1e | ||
|
|
4fe1adc383 | ||
|
|
2a78fe0f81 | ||
|
|
ea5886c77d | ||
|
|
e9053654a7 | ||
|
|
0be276482e | ||
|
|
7e55cbf798 | ||
|
|
f131f58124 | ||
|
|
5a4a6285bb | ||
|
|
e7ebb66200 | ||
|
|
5deca5a18f | ||
|
|
05033bb9d6 | ||
|
|
83097657d5 | ||
|
|
12e8861a1c | ||
|
|
22bf2b49c6 | ||
|
|
4a39c8cd53 | ||
|
|
c05beb74a9 | ||
|
|
cd89fa141b | ||
|
|
76f4dd34e0 | ||
|
|
da60dcbf2e | ||
|
|
368a581de9 | ||
|
|
24c5259005 | ||
|
|
2110739138 | ||
|
|
a4a487b0cc | ||
|
|
6071a0835a | ||
|
|
a272c019f9 | ||
|
|
dde86a4179 | ||
|
|
f8d57370d0 | ||
|
|
de315c97b1 | ||
|
|
1247f73754 | ||
|
|
50ba20fe1f | ||
|
|
b6856dcb99 | ||
|
|
54ec6a0ce2 | ||
|
|
dca7c5d1ad | ||
|
|
7473241438 | ||
|
|
be0c9ff705 | ||
|
|
3f644b6275 | ||
|
|
838220e4b3 | ||
|
|
18a5000718 | ||
|
|
21674b2879 | ||
|
|
12dec2563a | ||
|
|
603e4d66ac | ||
|
|
90fcb82a3e | ||
|
|
94a6844521 | ||
|
|
bdb3f1ae2f | ||
|
|
e3f1f7cd85 | ||
|
|
c0b4f4eb47 | ||
|
|
68ef3ac675 | ||
|
|
2cae26ee35 | ||
|
|
83aa3dbfa6 | ||
|
|
82ac8a1e76 | ||
|
|
c60696dbae | ||
|
|
75b0e3246a | ||
|
|
a74e82fbae | ||
|
|
8cf672104e | ||
|
|
8bdde8d7a0 | ||
|
|
c4f3f67537 | ||
|
|
ec23e37a4a | ||
|
|
00fbe50bbe | ||
|
|
2e48d6cf70 | ||
|
|
ec04517710 | ||
|
|
8cc0369d97 | ||
|
|
f7cdc05937 | ||
|
|
ea0afd0b4d | ||
|
|
62ba799d72 | ||
|
|
b6508c4bd1 | ||
|
|
853d01de68 | ||
|
|
311b65b225 | ||
|
|
b632b52b11 | ||
|
|
9630c2683c | ||
|
|
f53d5a0872 | ||
|
|
5917b5cf5c | ||
|
|
2a6d48bf9e | ||
|
|
0967c87a8f | ||
|
|
0ffee29a11 | ||
|
|
c75e98dc84 | ||
|
|
c7f7f2403d | ||
|
|
4533a197d5 | ||
|
|
1ed853f5d6 | ||
|
|
f83bbce3a3 | ||
|
|
4fccb92e07 | ||
|
|
ec596315bd | ||
|
|
9aee6674bb | ||
|
|
7d64de646a | ||
|
|
1e4691f02a | ||
|
|
4fe4fb0585 | ||
|
|
cf74248949 | ||
|
|
072f996af7 | ||
|
|
1f7c085527 | ||
|
|
a596969049 | ||
|
|
11badea962 | ||
|
|
d04ec15849 | ||
|
|
69d55cabd4 | ||
|
|
9baa944460 | ||
|
|
92767f5513 | ||
|
|
b320b1a3c2 | ||
|
|
35b9e9b4a5 | ||
|
|
21ce39aa9b | ||
|
|
ea80b2c8fc | ||
|
|
f501930728 | ||
|
|
8285953c1b | ||
|
|
6375829448 | ||
|
|
b0f0dc683d | ||
|
|
c2802d35bb | ||
|
|
2693d0eb27 | ||
|
|
6fed11896b | ||
|
|
178721a329 | ||
|
|
263f29a96a | ||
|
|
e99f967372 | ||
|
|
313efa33ae | ||
|
|
eaf6777a66 | ||
|
|
0f6fc48f85 | ||
|
|
1e13a7161a | ||
|
|
3ed0b24831 | ||
|
|
050ba0e0a0 | ||
|
|
418b3e5ee2 | ||
|
|
aa901ac4a2 | ||
|
|
0b80841c38 | ||
|
|
e370834c35 | ||
|
|
9b9cd698a5 | ||
|
|
a4b89e67c6 | ||
|
|
814db9d7c9 | ||
|
|
7f83231385 | ||
|
|
5247bb11f7 | ||
|
|
763544585a | ||
|
|
8a885dc61b | ||
|
|
f74b5a6b9b | ||
|
|
72e3238c3f | ||
|
|
f86c6851fc | ||
|
|
f6ffbe548c | ||
|
|
04c27573d6 | ||
|
|
9a23fb5863 | ||
|
|
90d364fc37 | ||
|
|
79d51581ba | ||
|
|
9507c49b18 | ||
|
|
87b07d6f2f | ||
|
|
64711e0d56 | ||
|
|
bf33b2f862 | ||
|
|
54315252c7 | ||
|
|
733eb127e9 | ||
|
|
2132efa981 | ||
|
|
da79674f84 | ||
|
|
ae36ed3903 | ||
|
|
cc4db8e4a9 | ||
|
|
f9f8fd37de | ||
|
|
193c0a52d9 | ||
|
|
f5139f8bf4 | ||
|
|
c0920bbf6a | ||
|
|
bcf65aa503 | ||
|
|
a866a758cc | ||
|
|
e7838c5f79 | ||
|
|
f21b91f1a7 | ||
|
|
edda32e6b4 | ||
|
|
639b0b8f50 | ||
|
|
18dd0d00a6 | ||
|
|
24fd19259d | ||
|
|
bdd555990b | ||
|
|
c762b7c91b | ||
|
|
45731bd022 | ||
|
|
492ba2a111 | ||
|
|
349465b168 | ||
|
|
98427ea92a | ||
|
|
a90edd5eb4 | ||
|
|
6fdaaf3d20 | ||
|
|
406f8363bc | ||
|
|
8e03a4cb93 | ||
|
|
1403260487 | ||
|
|
6831341ab4 | ||
|
|
0988af453c | ||
|
|
631457ffea | ||
|
|
bec1844954 | ||
|
|
e6d0a8ef66 | ||
|
|
70ab146cbb | ||
|
|
33b2e12886 | ||
|
|
1de29026d5 | ||
|
|
854af7a4bf | ||
|
|
f72c559824 | ||
|
|
321afd5fef | ||
|
|
91df2bea80 | ||
|
|
5de2946999 | ||
|
|
c650b752f1 | ||
|
|
c12f41ec6f | ||
|
|
2c6ec0c999 | ||
|
|
f1e563d8cf | ||
|
|
6de179eb7d | ||
|
|
584ffc6f52 | ||
|
|
2c99c1e06f | ||
|
|
f95a2f6d91 | ||
|
|
b31e358270 | ||
|
|
673835e5d9 | ||
|
|
f5bae208cc | ||
|
|
c25c31b1de | ||
|
|
343441d746 | ||
|
|
78fc4c8947 | ||
|
|
86165ceca5 | ||
|
|
8989353fab | ||
|
|
7e0524109e | ||
|
|
d88e694d06 | ||
|
|
44d50c2bd3 | ||
|
|
58548f5051 | ||
|
|
782eabc226 | ||
|
|
0ff3ae3cc6 | ||
|
|
8088c7dcd5 | ||
|
|
604d10d307 | ||
|
|
8dcc72ce9c | ||
|
|
d06bcd6dd3 | ||
|
|
b3c2ee56f9 | ||
|
|
435e98ceed | ||
|
|
7d21dfc938 | ||
|
|
2e1ba73926 | ||
|
|
e8a62ee3cf | ||
|
|
4e8eea8e78 | ||
|
|
d83baf8925 | ||
|
|
348570fd68 | ||
|
|
cf61562196 | ||
|
|
d02d7a95d1 | ||
|
|
ba07c26761 | ||
|
|
e56295851f | ||
|
|
f7d93dadeb | ||
|
|
5c87762f9e | ||
|
|
ea78514ff3 | ||
|
|
2616feb3df | ||
|
|
f4255b14e8 |
936 changed files with 46165 additions and 26281 deletions
2
.gitattributes
vendored
2
.gitattributes
vendored
|
|
@ -17,3 +17,5 @@
|
||||||
*.png binary
|
*.png binary
|
||||||
*.jpg binary
|
*.jpg binary
|
||||||
*.fon binary
|
*.fon binary
|
||||||
|
*.bin binary
|
||||||
|
*.woff binary
|
||||||
|
|
|
||||||
5
.github/workflows/test-builds.yml
vendored
5
.github/workflows/test-builds.yml
vendored
|
|
@ -36,9 +36,11 @@ jobs:
|
||||||
# Base Environments
|
# Base Environments
|
||||||
|
|
||||||
- DUE
|
- DUE
|
||||||
|
- DUE_archim
|
||||||
- esp32
|
- esp32
|
||||||
- linux_native
|
- linux_native
|
||||||
- mega2560
|
- mega2560
|
||||||
|
- at90usb1286_dfu
|
||||||
- teensy31
|
- teensy31
|
||||||
- teensy35
|
- teensy35
|
||||||
- teensy41
|
- teensy41
|
||||||
|
|
@ -81,6 +83,8 @@ jobs:
|
||||||
- STM32F103RET6_creality
|
- STM32F103RET6_creality
|
||||||
- LERDGEX
|
- LERDGEX
|
||||||
- mks_robin_nano35
|
- mks_robin_nano35
|
||||||
|
- mks_robin_nano35_stm32
|
||||||
|
- NUCLEO_F767ZI
|
||||||
|
|
||||||
# Put lengthy tests last
|
# Put lengthy tests last
|
||||||
|
|
||||||
|
|
@ -94,7 +98,6 @@ jobs:
|
||||||
|
|
||||||
# Non-working environment tests
|
# Non-working environment tests
|
||||||
#- at90usb1286_cdc
|
#- at90usb1286_cdc
|
||||||
#- at90usb1286_dfu
|
|
||||||
#- STM32F103CB_malyan
|
#- STM32F103CB_malyan
|
||||||
#- mks_robin_mini
|
#- mks_robin_mini
|
||||||
|
|
||||||
|
|
|
||||||
4
.gitignore
vendored
4
.gitignore
vendored
|
|
@ -77,7 +77,6 @@ tags
|
||||||
*.out
|
*.out
|
||||||
*.app
|
*.app
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# C
|
# C
|
||||||
#
|
#
|
||||||
|
|
@ -184,3 +183,6 @@ cmake-build-*
|
||||||
|
|
||||||
#Python
|
#Python
|
||||||
__pycache__
|
__pycache__
|
||||||
|
|
||||||
|
#IOLogger logs
|
||||||
|
*_log.csv
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@
|
||||||
*
|
*
|
||||||
* Advanced settings can be found in Configuration_adv.h
|
* Advanced settings can be found in Configuration_adv.h
|
||||||
*/
|
*/
|
||||||
#define CONFIGURATION_H_VERSION 020007
|
#define CONFIGURATION_H_VERSION 020008
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
//============================= Getting Started =============================
|
//============================= Getting Started =============================
|
||||||
|
|
@ -107,7 +107,8 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Select a secondary serial port on the board to use for communication with the host.
|
* Select a secondary serial port on the board to use for communication with the host.
|
||||||
* :[-1, 0, 1, 2, 3, 4, 5, 6, 7]
|
* Currently Ethernet (-2) is only supported on Teensy 4.1 boards.
|
||||||
|
* :[-2, -1, 0, 1, 2, 3, 4, 5, 6, 7]
|
||||||
*/
|
*/
|
||||||
//#define SERIAL_PORT_2 -1
|
//#define SERIAL_PORT_2 -1
|
||||||
|
|
||||||
|
|
@ -334,23 +335,26 @@
|
||||||
//#define PSU_DEFAULT_OFF // Keep power off until enabled directly with M80
|
//#define PSU_DEFAULT_OFF // Keep power off until enabled directly with M80
|
||||||
//#define PSU_POWERUP_DELAY 250 // (ms) Delay for the PSU to warm up to full power
|
//#define PSU_POWERUP_DELAY 250 // (ms) Delay for the PSU to warm up to full power
|
||||||
|
|
||||||
|
//#define PSU_POWERUP_GCODE "M355 S1" // G-code to run after power-on (e.g., case light on)
|
||||||
|
//#define PSU_POWEROFF_GCODE "M355 S0" // G-code to run before power-off (e.g., case light off)
|
||||||
|
|
||||||
//#define AUTO_POWER_CONTROL // Enable automatic control of the PS_ON pin
|
//#define AUTO_POWER_CONTROL // Enable automatic control of the PS_ON pin
|
||||||
#if ENABLED(AUTO_POWER_CONTROL)
|
#if ENABLED(AUTO_POWER_CONTROL)
|
||||||
#define AUTO_POWER_FANS // Turn on PSU if fans need power
|
#define AUTO_POWER_FANS // Turn on PSU if fans need power
|
||||||
#define AUTO_POWER_E_FANS
|
#define AUTO_POWER_E_FANS
|
||||||
#define AUTO_POWER_CONTROLLERFAN
|
#define AUTO_POWER_CONTROLLERFAN
|
||||||
#define AUTO_POWER_CHAMBER_FAN
|
#define AUTO_POWER_CHAMBER_FAN
|
||||||
//#define AUTO_POWER_E_TEMP 50 // (°C) Turn on PSU over this temperature
|
//#define AUTO_POWER_E_TEMP 50 // (°C) Turn on PSU if any extruder is over this temperature
|
||||||
//#define AUTO_POWER_CHAMBER_TEMP 30 // (°C) Turn on PSU over this temperature
|
//#define AUTO_POWER_CHAMBER_TEMP 30 // (°C) Turn on PSU if the chamber is over this temperature
|
||||||
#define POWER_TIMEOUT 30
|
#define POWER_TIMEOUT 30 // (s) Turn off power if the machine is idle for this duration
|
||||||
|
//#define POWER_OFF_DELAY 60 // (s) Delay of poweroff after M81 command. Useful to let fans run for extra time.
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// @section temperature
|
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
//============================= Thermal Settings ============================
|
//============================= Thermal Settings ============================
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
// @section temperature
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* --NORMAL IS 4.7kohm PULLUP!-- 1kohm pullup can be used on hotend sensor, using correct resistor and table
|
* --NORMAL IS 4.7kohm PULLUP!-- 1kohm pullup can be used on hotend sensor, using correct resistor and table
|
||||||
|
|
@ -432,6 +436,12 @@
|
||||||
#define DUMMY_THERMISTOR_998_VALUE 25
|
#define DUMMY_THERMISTOR_998_VALUE 25
|
||||||
#define DUMMY_THERMISTOR_999_VALUE 100
|
#define DUMMY_THERMISTOR_999_VALUE 100
|
||||||
|
|
||||||
|
// Resistor values when using MAX31865 sensors (-5) on TEMP_SENSOR_0 / 1
|
||||||
|
//#define MAX31865_SENSOR_OHMS_0 100 // (Ω) Typically 100 or 1000 (PT100 or PT1000)
|
||||||
|
//#define MAX31865_CALIBRATION_OHMS_0 430 // (Ω) Typically 430 for AdaFruit PT100; 4300 for AdaFruit PT1000
|
||||||
|
//#define MAX31865_SENSOR_OHMS_1 100
|
||||||
|
//#define MAX31865_CALIBRATION_OHMS_1 430
|
||||||
|
|
||||||
// Use temp sensor 1 as a redundant sensor with sensor 0. If the readings
|
// Use temp sensor 1 as a redundant sensor with sensor 0. If the readings
|
||||||
// from the two sensors differ too much the print will be aborted.
|
// from the two sensors differ too much the print will be aborted.
|
||||||
//#define TEMP_SENSOR_1_AS_REDUNDANT
|
//#define TEMP_SENSOR_1_AS_REDUNDANT
|
||||||
|
|
@ -486,12 +496,13 @@
|
||||||
//#define PID_AUTOTUNE_MENU // Add PID auto-tuning to the "Advanced Settings" menu. (~250 bytes of PROGMEM)
|
//#define PID_AUTOTUNE_MENU // Add PID auto-tuning to the "Advanced Settings" menu. (~250 bytes of PROGMEM)
|
||||||
//#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
|
//#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
|
||||||
// Set/get with gcode: M301 E[extruder number, 0-2]
|
// Set/get with gcode: M301 E[extruder number, 0-2]
|
||||||
|
|
||||||
#if ENABLED(PID_PARAMS_PER_HOTEND)
|
#if ENABLED(PID_PARAMS_PER_HOTEND)
|
||||||
// Specify between 1 and HOTENDS values per array.
|
// Specify between 1 and HOTENDS values per array.
|
||||||
// If fewer than EXTRUDER values are provided, the last element will be repeated.
|
// If fewer than EXTRUDER values are provided, the last element will be repeated.
|
||||||
#define DEFAULT_Kp_LIST { 22.20, 20.0 }
|
#define DEFAULT_Kp_LIST { 22.20, 22.20 }
|
||||||
#define DEFAULT_Ki_LIST { 1.08, 1.0 }
|
#define DEFAULT_Ki_LIST { 1.08, 1.08 }
|
||||||
#define DEFAULT_Kd_LIST { 114.00, 112.0 }
|
#define DEFAULT_Kd_LIST { 114.00, 114.00 }
|
||||||
#else
|
#else
|
||||||
#define DEFAULT_Kp 22.20
|
#define DEFAULT_Kp 22.20
|
||||||
#define DEFAULT_Ki 1.08
|
#define DEFAULT_Ki 1.08
|
||||||
|
|
@ -664,6 +675,8 @@
|
||||||
*
|
*
|
||||||
* A4988 is assumed for unspecified drivers.
|
* A4988 is assumed for unspecified drivers.
|
||||||
*
|
*
|
||||||
|
* Use TMC2208/TMC2208_STANDALONE for TMC2225 drivers and TMC2209/TMC2209_STANDALONE for TMC2226 drivers.
|
||||||
|
*
|
||||||
* Options: A4988, A5984, DRV8825, LV8729, L6470, L6474, POWERSTEP01,
|
* Options: A4988, A5984, DRV8825, LV8729, L6470, L6474, POWERSTEP01,
|
||||||
* TB6560, TB6600, TMC2100,
|
* TB6560, TB6600, TMC2100,
|
||||||
* TMC2130, TMC2130_STANDALONE, TMC2160, TMC2160_STANDALONE,
|
* TMC2130, TMC2130_STANDALONE, TMC2160, TMC2160_STANDALONE,
|
||||||
|
|
@ -672,15 +685,15 @@
|
||||||
* TMC5130, TMC5130_STANDALONE, TMC5160, TMC5160_STANDALONE
|
* TMC5130, TMC5130_STANDALONE, TMC5160, TMC5160_STANDALONE
|
||||||
* :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'L6474', 'POWERSTEP01', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2160', 'TMC2160_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC2209', 'TMC2209_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE', 'TMC5160', 'TMC5160_STANDALONE']
|
* :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'L6474', 'POWERSTEP01', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2160', 'TMC2160_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC2209', 'TMC2209_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE', 'TMC5160', 'TMC5160_STANDALONE']
|
||||||
*/
|
*/
|
||||||
//#define X_DRIVER_TYPE A4988
|
#define X_DRIVER_TYPE A4988
|
||||||
//#define Y_DRIVER_TYPE A4988
|
#define Y_DRIVER_TYPE A4988
|
||||||
//#define Z_DRIVER_TYPE A4988
|
#define Z_DRIVER_TYPE A4988
|
||||||
//#define X2_DRIVER_TYPE A4988
|
//#define X2_DRIVER_TYPE A4988
|
||||||
//#define Y2_DRIVER_TYPE A4988
|
//#define Y2_DRIVER_TYPE A4988
|
||||||
//#define Z2_DRIVER_TYPE A4988
|
//#define Z2_DRIVER_TYPE A4988
|
||||||
//#define Z3_DRIVER_TYPE A4988
|
//#define Z3_DRIVER_TYPE A4988
|
||||||
//#define Z4_DRIVER_TYPE A4988
|
//#define Z4_DRIVER_TYPE A4988
|
||||||
//#define E0_DRIVER_TYPE A4988
|
#define E0_DRIVER_TYPE A4988
|
||||||
//#define E1_DRIVER_TYPE A4988
|
//#define E1_DRIVER_TYPE A4988
|
||||||
//#define E2_DRIVER_TYPE A4988
|
//#define E2_DRIVER_TYPE A4988
|
||||||
//#define E3_DRIVER_TYPE A4988
|
//#define E3_DRIVER_TYPE A4988
|
||||||
|
|
@ -735,7 +748,7 @@
|
||||||
* Override with M92
|
* Override with M92
|
||||||
* X, Y, Z, E0 [, E1[, E2...]]
|
* X, Y, Z, E0 [, E1[, E2...]]
|
||||||
*/
|
*/
|
||||||
#define DEFAULT_AXIS_STEPS_PER_UNIT { 80, 80, 4000, 500 }
|
#define DEFAULT_AXIS_STEPS_PER_UNIT { 80, 80, 400, 500 }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default Max Feed Rate (mm/s)
|
* Default Max Feed Rate (mm/s)
|
||||||
|
|
@ -1160,6 +1173,12 @@
|
||||||
* Filament Runout Sensors
|
* Filament Runout Sensors
|
||||||
* Mechanical or opto endstops are used to check for the presence of filament.
|
* Mechanical or opto endstops are used to check for the presence of filament.
|
||||||
*
|
*
|
||||||
|
* IMPORTANT: Runout will only trigger if Marlin is aware that a print job is running.
|
||||||
|
* Marlin knows a print job is running when:
|
||||||
|
* 1. Running a print job from media started with M24.
|
||||||
|
* 2. The Print Job Timer has been started with M75.
|
||||||
|
* 3. The heaters were turned on and PRINTJOB_TIMER_AUTOSTART is enabled.
|
||||||
|
*
|
||||||
* RAMPS-based boards use SERVO3_PIN for the first runout sensor.
|
* RAMPS-based boards use SERVO3_PIN for the first runout sensor.
|
||||||
* For other boards you may need to define FIL_RUNOUT_PIN, FIL_RUNOUT2_PIN, etc.
|
* For other boards you may need to define FIL_RUNOUT_PIN, FIL_RUNOUT2_PIN, etc.
|
||||||
*/
|
*/
|
||||||
|
|
@ -1167,9 +1186,27 @@
|
||||||
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
|
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
|
||||||
#define FIL_RUNOUT_ENABLED_DEFAULT true // Enable the sensor on startup. Override with M412 followed by M500.
|
#define FIL_RUNOUT_ENABLED_DEFAULT true // Enable the sensor on startup. Override with M412 followed by M500.
|
||||||
#define NUM_RUNOUT_SENSORS 1 // Number of sensors, up to one per extruder. Define a FIL_RUNOUT#_PIN for each.
|
#define NUM_RUNOUT_SENSORS 1 // Number of sensors, up to one per extruder. Define a FIL_RUNOUT#_PIN for each.
|
||||||
|
|
||||||
#define FIL_RUNOUT_STATE LOW // Pin state indicating that filament is NOT present.
|
#define FIL_RUNOUT_STATE LOW // Pin state indicating that filament is NOT present.
|
||||||
#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
|
#define FIL_RUNOUT_PULL // Use internal pullup / pulldown for filament runout pins.
|
||||||
//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
|
|
||||||
|
// Override individually if the runout sensors vary
|
||||||
|
//#define FIL_RUNOUT1_STATE LOW
|
||||||
|
//#define FIL_RUNOUT1_PULL
|
||||||
|
//#define FIL_RUNOUT2_STATE LOW
|
||||||
|
//#define FIL_RUNOUT2_PULL
|
||||||
|
//#define FIL_RUNOUT3_STATE LOW
|
||||||
|
//#define FIL_RUNOUT3_PULL
|
||||||
|
//#define FIL_RUNOUT4_STATE LOW
|
||||||
|
//#define FIL_RUNOUT4_PULL
|
||||||
|
//#define FIL_RUNOUT5_STATE LOW
|
||||||
|
//#define FIL_RUNOUT5_PULL
|
||||||
|
//#define FIL_RUNOUT6_STATE LOW
|
||||||
|
//#define FIL_RUNOUT6_PULL
|
||||||
|
//#define FIL_RUNOUT7_STATE LOW
|
||||||
|
//#define FIL_RUNOUT7_PULL
|
||||||
|
//#define FIL_RUNOUT8_STATE LOW
|
||||||
|
//#define FIL_RUNOUT8_PULL
|
||||||
|
|
||||||
// Set one or more commands to execute on filament runout.
|
// Set one or more commands to execute on filament runout.
|
||||||
// (After 'M412 H' Marlin will ask the host to handle the process.)
|
// (After 'M412 H' Marlin will ask the host to handle the process.)
|
||||||
|
|
@ -2077,9 +2114,10 @@
|
||||||
//
|
//
|
||||||
// Anet 128x64 full graphics lcd with rotary encoder as used on Anet A6
|
// Anet 128x64 full graphics lcd with rotary encoder as used on Anet A6
|
||||||
// A clone of the RepRapDiscount full graphics display but with
|
// A clone of the RepRapDiscount full graphics display but with
|
||||||
// different pins/wiring (see pins_ANET_10.h).
|
// different pins/wiring (see pins_ANET_10.h). Enable one of these.
|
||||||
//
|
//
|
||||||
//#define ANET_FULL_GRAPHICS_LCD
|
//#define ANET_FULL_GRAPHICS_LCD
|
||||||
|
//#define ANET_FULL_GRAPHICS_LCD_ALT_WIRING
|
||||||
|
|
||||||
//
|
//
|
||||||
// AZSMZ 12864 LCD with SD
|
// AZSMZ 12864 LCD with SD
|
||||||
|
|
@ -2186,7 +2224,7 @@
|
||||||
|
|
||||||
//
|
//
|
||||||
// Third-party or vendor-customized controller interfaces.
|
// Third-party or vendor-customized controller interfaces.
|
||||||
// Sources should be installed in 'src/lcd/extensible_ui'.
|
// Sources should be installed in 'src/lcd/extui'.
|
||||||
//
|
//
|
||||||
//#define EXTENSIBLE_UI
|
//#define EXTENSIBLE_UI
|
||||||
|
|
||||||
|
|
@ -2198,43 +2236,108 @@
|
||||||
//=============================== Graphical TFTs ==============================
|
//=============================== Graphical TFTs ==============================
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
||||||
//
|
/**
|
||||||
// TFT display with optional touch screen
|
* Specific TFT Model Presets. Enable one of the following options
|
||||||
// Color Marlin UI with standard menu system
|
* or enable TFT_GENERIC and set sub-options.
|
||||||
//
|
*/
|
||||||
//#define TFT_320x240
|
|
||||||
//#define TFT_320x240_SPI
|
|
||||||
//#define TFT_480x320
|
|
||||||
//#define TFT_480x320_SPI
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Skip autodetect and force specific TFT driver
|
// 480x320, 3.5", SPI Display From MKS
|
||||||
// Mandatory for SPI screens with no MISO line
|
// Normally used in MKS Robin Nano V2
|
||||||
// Available drivers are: ST7735, ST7789, ST7796, R61505, ILI9328, ILI9341, ILI9488
|
|
||||||
//
|
//
|
||||||
//#define TFT_DRIVER AUTO
|
//#define MKS_TS35_V2_0
|
||||||
|
|
||||||
//
|
//
|
||||||
// SPI display (MKS Robin Nano V2.0, MKS Gen L V2.0)
|
// 320x240, 2.4", FSMC Display From MKS
|
||||||
// Upscaled 128x64 Marlin UI
|
// Normally used in MKS Robin Nano V1.2
|
||||||
//
|
//
|
||||||
//#define SPI_GRAPHICAL_TFT
|
//#define MKS_ROBIN_TFT24
|
||||||
|
|
||||||
//
|
//
|
||||||
// FSMC display (MKS Robin, Alfawise U20, JGAurora A5S, REXYZ A1, etc.)
|
// 320x240, 2.8", FSMC Display From MKS
|
||||||
// Upscaled 128x64 Marlin UI
|
// Normally used in MKS Robin Nano V1.2
|
||||||
//
|
//
|
||||||
//#define FSMC_GRAPHICAL_TFT
|
//#define MKS_ROBIN_TFT28
|
||||||
|
|
||||||
//
|
//
|
||||||
// TFT LVGL UI
|
// 320x240, 3.2", FSMC Display From MKS
|
||||||
|
// Normally used in MKS Robin Nano V1.2
|
||||||
//
|
//
|
||||||
// Using default MKS icons and fonts from: https://git.io/JJvzK
|
//#define MKS_ROBIN_TFT32
|
||||||
// Just copy the 'assets' folder from the build directory to the
|
|
||||||
// root of your SD card, together with the compiled firmware.
|
|
||||||
//
|
//
|
||||||
//#define TFT_LVGL_UI_FSMC // Robin nano v1.2 uses FSMC
|
// 480x320, 3.5", FSMC Display From MKS
|
||||||
//#define TFT_LVGL_UI_SPI // Robin nano v2.0 uses SPI
|
// Normally used in MKS Robin Nano V1.2
|
||||||
|
//
|
||||||
|
//#define MKS_ROBIN_TFT35
|
||||||
|
|
||||||
|
//
|
||||||
|
// 480x272, 4.3", FSMC Display From MKS
|
||||||
|
//
|
||||||
|
//#define MKS_ROBIN_TFT43
|
||||||
|
|
||||||
|
//
|
||||||
|
// 320x240, 3.2", FSMC Display From MKS
|
||||||
|
// Normally used in MKS Robin
|
||||||
|
//
|
||||||
|
//#define MKS_ROBIN_TFT_V1_1R
|
||||||
|
|
||||||
|
//
|
||||||
|
// 480x320, 3.5", FSMC Stock Display from TronxXY
|
||||||
|
//
|
||||||
|
//#define TFT_TRONXY_X5SA
|
||||||
|
|
||||||
|
//
|
||||||
|
// 480x320, 3.5", FSMC Stock Display from AnyCubic
|
||||||
|
//
|
||||||
|
//#define ANYCUBIC_TFT35
|
||||||
|
|
||||||
|
//
|
||||||
|
// 320x240, 2.8", FSMC Stock Display from Longer/Alfawise
|
||||||
|
//
|
||||||
|
//#define LONGER_LK_TFT28
|
||||||
|
|
||||||
|
//
|
||||||
|
// Generic TFT with detailed options
|
||||||
|
//
|
||||||
|
//#define TFT_GENERIC
|
||||||
|
#if ENABLED(TFT_GENERIC)
|
||||||
|
// :[ 'AUTO', 'ST7735', 'ST7789', 'ST7796', 'R61505', 'ILI9328', 'ILI9341', 'ILI9488' ]
|
||||||
|
#define TFT_DRIVER AUTO
|
||||||
|
|
||||||
|
// Interface. Enable one of the following options:
|
||||||
|
//#define TFT_INTERFACE_FSMC
|
||||||
|
//#define TFT_INTERFACE_SPI
|
||||||
|
|
||||||
|
// TFT Resolution. Enable one of the following options:
|
||||||
|
//#define TFT_RES_320x240
|
||||||
|
//#define TFT_RES_480x272
|
||||||
|
//#define TFT_RES_480x320
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TFT UI - User Interface Selection. Enable one of the following options:
|
||||||
|
*
|
||||||
|
* TFT_CLASSIC_UI - Emulated DOGM - 128x64 Upscaled
|
||||||
|
* TFT_COLOR_UI - Marlin Default Menus, Touch Friendly, using full TFT capabilities
|
||||||
|
* TFT_LVGL_UI - A Modern UI using LVGL
|
||||||
|
*
|
||||||
|
* For LVGL_UI also copy the 'assets' folder from the build directory to the
|
||||||
|
* root of your SD card, together with the compiled firmware.
|
||||||
|
*/
|
||||||
|
//#define TFT_CLASSIC_UI
|
||||||
|
//#define TFT_COLOR_UI
|
||||||
|
//#define TFT_LVGL_UI
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TFT Rotation. Set to one of the following values:
|
||||||
|
*
|
||||||
|
* TFT_ROTATE_90, TFT_ROTATE_90_MIRROR_X, TFT_ROTATE_90_MIRROR_Y,
|
||||||
|
* TFT_ROTATE_180, TFT_ROTATE_180_MIRROR_X, TFT_ROTATE_180_MIRROR_Y,
|
||||||
|
* TFT_ROTATE_270, TFT_ROTATE_270_MIRROR_X, TFT_ROTATE_270_MIRROR_Y,
|
||||||
|
* TFT_MIRROR_X, TFT_MIRROR_Y, TFT_NO_ROTATION
|
||||||
|
*/
|
||||||
|
//#define TFT_ROTATION TFT_NO_ROTATION
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
//============================ Other Controllers ============================
|
//============================ Other Controllers ============================
|
||||||
|
|
@ -2259,6 +2362,10 @@
|
||||||
//#define XPT2046_Y_CALIBRATION -8981
|
//#define XPT2046_Y_CALIBRATION -8981
|
||||||
//#define XPT2046_X_OFFSET -43
|
//#define XPT2046_X_OFFSET -43
|
||||||
//#define XPT2046_Y_OFFSET 257
|
//#define XPT2046_Y_OFFSET 257
|
||||||
|
|
||||||
|
#if ENABLED(TFT_COLOR_UI)
|
||||||
|
//#define SINGLE_TOUCH_NAVIGATION
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
@ -2304,9 +2411,6 @@
|
||||||
// then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis)
|
// then the BLUE led is on. Otherwise the RED led is on. (1C hysteresis)
|
||||||
//#define TEMP_STAT_LEDS
|
//#define TEMP_STAT_LEDS
|
||||||
|
|
||||||
// SkeinForge sends the wrong arc G-codes when using Arc Point as fillet procedure
|
|
||||||
//#define SF_ARC_FIX
|
|
||||||
|
|
||||||
// Support for the BariCUDA Paste Extruder
|
// Support for the BariCUDA Paste Extruder
|
||||||
//#define BARICUDA
|
//#define BARICUDA
|
||||||
|
|
||||||
|
|
@ -2392,17 +2496,12 @@
|
||||||
#define PRINTER_EVENT_LEDS
|
#define PRINTER_EVENT_LEDS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
|
||||||
* R/C SERVO support
|
|
||||||
* Sponsored by TrinityLabs, Reworked by codexmas
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Number of servos
|
* Number of servos
|
||||||
*
|
*
|
||||||
* For some servo-related options NUM_SERVOS will be set automatically.
|
* For some servo-related options NUM_SERVOS will be set automatically.
|
||||||
* Set this manually if there are extra servos needing manual control.
|
* Set this manually if there are extra servos needing manual control.
|
||||||
* Leave undefined or set to 0 to entirely disable the servo subsystem.
|
* Set to 0 to turn off servo support.
|
||||||
*/
|
*/
|
||||||
//#define NUM_SERVOS 3 // Servo index starts with 0 for M280 command
|
//#define NUM_SERVOS 3 // Servo index starts with 0 for M280 command
|
||||||
|
|
||||||
|
|
@ -2414,5 +2513,5 @@
|
||||||
// Only power servos during movement, otherwise leave off to prevent jitter
|
// Only power servos during movement, otherwise leave off to prevent jitter
|
||||||
//#define DEACTIVATE_SERVOS_AFTER_MOVE
|
//#define DEACTIVATE_SERVOS_AFTER_MOVE
|
||||||
|
|
||||||
// Allow servo angle to be edited and saved to EEPROM
|
// Edit servo angles with M281 and save to EEPROM with M500
|
||||||
//#define EDITABLE_SERVO_ANGLES
|
//#define EDITABLE_SERVO_ANGLES
|
||||||
|
|
|
||||||
|
|
@ -30,13 +30,12 @@
|
||||||
*
|
*
|
||||||
* Basic settings can be found in Configuration.h
|
* Basic settings can be found in Configuration.h
|
||||||
*/
|
*/
|
||||||
#define CONFIGURATION_ADV_H_VERSION 020007
|
#define CONFIGURATION_ADV_H_VERSION 020008
|
||||||
|
|
||||||
// @section temperature
|
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
//============================= Thermal Settings ============================
|
//============================= Thermal Settings ============================
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
// @section temperature
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Thermocouple sensors are quite sensitive to noise. Any noise induced in
|
* Thermocouple sensors are quite sensitive to noise. Any noise induced in
|
||||||
|
|
@ -125,9 +124,19 @@
|
||||||
#define HEATER_BED_INVERTING true
|
#define HEATER_BED_INVERTING true
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
//
|
||||||
* Heated Chamber settings
|
// Heated Bed Bang-Bang options
|
||||||
*/
|
//
|
||||||
|
#if DISABLED(PIDTEMPBED)
|
||||||
|
#define BED_CHECK_INTERVAL 5000 // (ms) Interval between checks in bang-bang control
|
||||||
|
#if ENABLED(BED_LIMIT_SWITCHING)
|
||||||
|
#define BED_HYSTERESIS 2 // (°C) Only set the relevant heater state when ABS(T-target) > BED_HYSTERESIS
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//
|
||||||
|
// Heated Chamber options
|
||||||
|
//
|
||||||
#if TEMP_SENSOR_CHAMBER
|
#if TEMP_SENSOR_CHAMBER
|
||||||
#define CHAMBER_MINTEMP 5
|
#define CHAMBER_MINTEMP 5
|
||||||
#define CHAMBER_MAXTEMP 60
|
#define CHAMBER_MAXTEMP 60
|
||||||
|
|
@ -135,12 +144,28 @@
|
||||||
//#define CHAMBER_LIMIT_SWITCHING
|
//#define CHAMBER_LIMIT_SWITCHING
|
||||||
//#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin
|
//#define HEATER_CHAMBER_PIN 44 // Chamber heater on/off pin
|
||||||
//#define HEATER_CHAMBER_INVERTING false
|
//#define HEATER_CHAMBER_INVERTING false
|
||||||
#endif
|
|
||||||
|
|
||||||
#if DISABLED(PIDTEMPBED)
|
//#define CHAMBER_FAN // Enable a fan on the chamber
|
||||||
#define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control
|
#if ENABLED(CHAMBER_FAN)
|
||||||
#if ENABLED(BED_LIMIT_SWITCHING)
|
#define CHAMBER_FAN_MODE 2 // Fan control mode: 0=Static; 1=Linear increase when temp is higher than target; 2=V-shaped curve.
|
||||||
#define BED_HYSTERESIS 2 // Only disable heating if T>target+BED_HYSTERESIS and enable heating if T>target-BED_HYSTERESIS
|
#if CHAMBER_FAN_MODE == 0
|
||||||
|
#define CHAMBER_FAN_BASE 255 // Chamber fan PWM (0-255)
|
||||||
|
#elif CHAMBER_FAN_MODE == 1
|
||||||
|
#define CHAMBER_FAN_BASE 128 // Base chamber fan PWM (0-255); turns on when chamber temperature is above the target
|
||||||
|
#define CHAMBER_FAN_FACTOR 25 // PWM increase per °C above target
|
||||||
|
#elif CHAMBER_FAN_MODE == 2
|
||||||
|
#define CHAMBER_FAN_BASE 128 // Minimum chamber fan PWM (0-255)
|
||||||
|
#define CHAMBER_FAN_FACTOR 25 // PWM increase per °C difference from target
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//#define CHAMBER_VENT // Enable a servo-controlled vent on the chamber
|
||||||
|
#if ENABLED(CHAMBER_VENT)
|
||||||
|
#define CHAMBER_VENT_SERVO_NR 1 // Index of the vent servo
|
||||||
|
#define HIGH_EXCESS_HEAT_LIMIT 5 // How much above target temp to consider there is excess heat in the chamber
|
||||||
|
#define LOW_EXCESS_HEAT_LIMIT 3
|
||||||
|
#define MIN_COOLING_SLOPE_TIME_CHAMBER_VENT 20
|
||||||
|
#define MIN_COOLING_SLOPE_DEG_CHAMBER_VENT 1.5
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -635,6 +660,7 @@
|
||||||
|
|
||||||
//#define QUICK_HOME // If G28 contains XY do a diagonal move first
|
//#define QUICK_HOME // If G28 contains XY do a diagonal move first
|
||||||
//#define HOME_Y_BEFORE_X // If G28 contains XY home Y before X
|
//#define HOME_Y_BEFORE_X // If G28 contains XY home Y before X
|
||||||
|
//#define HOME_Z_FIRST // Home Z first. Requires a Z-MIN endstop (not a probe).
|
||||||
//#define CODEPENDENT_XY_HOMING // If X/Y can't home without homing Y/X first
|
//#define CODEPENDENT_XY_HOMING // If X/Y can't home without homing Y/X first
|
||||||
|
|
||||||
// @section bltouch
|
// @section bltouch
|
||||||
|
|
@ -771,6 +797,7 @@
|
||||||
//
|
//
|
||||||
//#define ASSISTED_TRAMMING
|
//#define ASSISTED_TRAMMING
|
||||||
#if ENABLED(ASSISTED_TRAMMING)
|
#if ENABLED(ASSISTED_TRAMMING)
|
||||||
|
|
||||||
// Define positions for probing points, use the hotend as reference not the sensor.
|
// Define positions for probing points, use the hotend as reference not the sensor.
|
||||||
#define TRAMMING_POINT_XY { { 20, 20 }, { 200, 20 }, { 200, 200 }, { 20, 200 } }
|
#define TRAMMING_POINT_XY { { 20, 20 }, { 200, 20 }, { 200, 200 }, { 20, 200 } }
|
||||||
|
|
||||||
|
|
@ -780,11 +807,12 @@
|
||||||
#define TRAMMING_POINT_NAME_3 "Back-Right"
|
#define TRAMMING_POINT_NAME_3 "Back-Right"
|
||||||
#define TRAMMING_POINT_NAME_4 "Back-Left"
|
#define TRAMMING_POINT_NAME_4 "Back-Left"
|
||||||
|
|
||||||
// Enable to restore leveling setup after operation
|
#define RESTORE_LEVELING_AFTER_G35 // Enable to restore leveling setup after operation
|
||||||
#define RESTORE_LEVELING_AFTER_G35
|
//#define REPORT_TRAMMING_MM // Report Z deviation (mm) for each point relative to the first
|
||||||
|
|
||||||
// Add a menu item for Assisted Tramming
|
//#define ASSISTED_TRAMMING_MENU_ITEM // Add a menu item to run G35 Assisted Tramming (MarlinUI)
|
||||||
//#define ASSISTED_TRAMMING_MENU_ITEM
|
//#define ASSISTED_TRAMMING_WIZARD // Make the menu item open a Tramming Wizard sub-menu
|
||||||
|
//#define ASSISTED_TRAMMING_WAIT_POSITION { X_CENTER, Y_CENTER, 30 } // Move the nozzle out of the way for adjustment
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Screw thread:
|
* Screw thread:
|
||||||
|
|
@ -793,6 +821,7 @@
|
||||||
* M5: 50 = Clockwise, 51 = Counter-Clockwise
|
* M5: 50 = Clockwise, 51 = Counter-Clockwise
|
||||||
*/
|
*/
|
||||||
#define TRAMMING_SCREW_THREAD 30
|
#define TRAMMING_SCREW_THREAD 30
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// @section motion
|
// @section motion
|
||||||
|
|
@ -1023,10 +1052,10 @@
|
||||||
|
|
||||||
// @section lcd
|
// @section lcd
|
||||||
|
|
||||||
#if EITHER(ULTIPANEL, EXTENSIBLE_UI)
|
#if EITHER(IS_ULTIPANEL, EXTENSIBLE_UI)
|
||||||
#define MANUAL_FEEDRATE { 50*60, 50*60, 4*60, 2*60 } // (mm/min) Feedrates for manual moves along X, Y, Z, E from panel
|
#define MANUAL_FEEDRATE { 50*60, 50*60, 4*60, 2*60 } // (mm/min) Feedrates for manual moves along X, Y, Z, E from panel
|
||||||
#define SHORT_MANUAL_Z_MOVE 0.025 // (mm) Smallest manual Z move (< 0.1mm)
|
#define SHORT_MANUAL_Z_MOVE 0.025 // (mm) Smallest manual Z move (< 0.1mm)
|
||||||
#if ENABLED(ULTIPANEL)
|
#if IS_ULTIPANEL
|
||||||
#define MANUAL_E_MOVES_RELATIVE // Display extruder move distance rather than "position"
|
#define MANUAL_E_MOVES_RELATIVE // Display extruder move distance rather than "position"
|
||||||
#define ULTIPANEL_FEEDMULTIPLY // Encoder sets the feedrate multiplier on the Status Screen
|
#define ULTIPANEL_FEEDMULTIPLY // Encoder sets the feedrate multiplier on the Status Screen
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -1048,6 +1077,14 @@
|
||||||
|
|
||||||
#if HAS_LCD_MENU
|
#if HAS_LCD_MENU
|
||||||
|
|
||||||
|
// Add Probe Z Offset calibration to the Z Probe Offsets menu
|
||||||
|
#if HAS_BED_PROBE
|
||||||
|
//#define PROBE_OFFSET_WIZARD
|
||||||
|
#if ENABLED(PROBE_OFFSET_WIZARD)
|
||||||
|
#define PROBE_OFFSET_START -4.0 // Estimated nozzle-to-probe Z offset, plus a little extra
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
// Include a page of printer information in the LCD Main Menu
|
// Include a page of printer information in the LCD Main Menu
|
||||||
//#define LCD_INFO_MENU
|
//#define LCD_INFO_MENU
|
||||||
#if ENABLED(LCD_INFO_MENU)
|
#if ENABLED(LCD_INFO_MENU)
|
||||||
|
|
@ -1057,6 +1094,9 @@
|
||||||
// BACK menu items keep the highlight at the top
|
// BACK menu items keep the highlight at the top
|
||||||
//#define TURBO_BACK_MENU_ITEM
|
//#define TURBO_BACK_MENU_ITEM
|
||||||
|
|
||||||
|
// Add a mute option to the LCD menu
|
||||||
|
//#define SOUND_MENU_ITEM
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* LED Control Menu
|
* LED Control Menu
|
||||||
* Add LED Control to the LCD menu
|
* Add LED Control to the LCD menu
|
||||||
|
|
@ -1133,6 +1173,7 @@
|
||||||
// Enable this option and set to HIGH if your SD cards are incorrectly detected.
|
// Enable this option and set to HIGH if your SD cards are incorrectly detected.
|
||||||
//#define SD_DETECT_STATE HIGH
|
//#define SD_DETECT_STATE HIGH
|
||||||
|
|
||||||
|
//#define SD_IGNORE_AT_STARTUP // Don't mount the SD card when starting up
|
||||||
//#define SDCARD_READONLY // Read-only SD card (to save over 2K of flash)
|
//#define SDCARD_READONLY // Read-only SD card (to save over 2K of flash)
|
||||||
|
|
||||||
#define SD_PROCEDURE_DEPTH 1 // Increase if you need more nested M32 calls
|
#define SD_PROCEDURE_DEPTH 1 // Increase if you need more nested M32 calls
|
||||||
|
|
@ -1217,6 +1258,10 @@
|
||||||
// Note: Only affects SCROLL_LONG_FILENAMES with SDSORT_CACHE_NAMES but not SDSORT_DYNAMIC_RAM.
|
// Note: Only affects SCROLL_LONG_FILENAMES with SDSORT_CACHE_NAMES but not SDSORT_DYNAMIC_RAM.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Allow international symbols in long filenames. To display correctly, the
|
||||||
|
// LCD's font must contain the characters. Check your selected LCD language.
|
||||||
|
#define UTF_FILENAME_SUPPORT
|
||||||
|
|
||||||
// This allows hosts to request long names for files and folders with M33
|
// This allows hosts to request long names for files and folders with M33
|
||||||
//#define LONG_FILENAME_HOST_SUPPORT
|
//#define LONG_FILENAME_HOST_SUPPORT
|
||||||
|
|
||||||
|
|
@ -1342,7 +1387,7 @@
|
||||||
// Western only. Not available for Cyrillic, Kana, Turkish, Greek, or Chinese.
|
// Western only. Not available for Cyrillic, Kana, Turkish, Greek, or Chinese.
|
||||||
//#define USE_BIG_EDIT_FONT
|
//#define USE_BIG_EDIT_FONT
|
||||||
|
|
||||||
// A smaller font may be used on the Info Screen. Costs 2300 bytes of PROGMEM.
|
// A smaller font may be used on the Info Screen. Costs 2434 bytes of PROGMEM.
|
||||||
// Western only. Not available for Cyrillic, Kana, Turkish, Greek, or Chinese.
|
// Western only. Not available for Cyrillic, Kana, Turkish, Greek, or Chinese.
|
||||||
//#define USE_SMALL_INFOFONT
|
//#define USE_SMALL_INFOFONT
|
||||||
|
|
||||||
|
|
@ -1527,10 +1572,9 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// FSMC / SPI Graphical TFT
|
// Classic UI Options
|
||||||
//
|
//
|
||||||
#if TFT_SCALED_DOGLCD
|
#if TFT_SCALED_DOGLCD
|
||||||
//#define GRAPHICAL_TFT_ROTATE_180
|
|
||||||
//#define TFT_MARLINUI_COLOR 0xFFFF // White
|
//#define TFT_MARLINUI_COLOR 0xFFFF // White
|
||||||
//#define TFT_MARLINBG_COLOR 0x0000 // Black
|
//#define TFT_MARLINBG_COLOR 0x0000 // Black
|
||||||
//#define TFT_DISABLED_COLOR 0x0003 // Almost black
|
//#define TFT_DISABLED_COLOR 0x0003 // Almost black
|
||||||
|
|
@ -1768,6 +1812,7 @@
|
||||||
#define N_ARC_CORRECTION 25 // Number of interpolated segments between corrections
|
#define N_ARC_CORRECTION 25 // Number of interpolated segments between corrections
|
||||||
//#define ARC_P_CIRCLES // Enable the 'P' parameter to specify complete circles
|
//#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
|
//#define CNC_WORKSPACE_PLANES // Allow G2/G3 to operate in XY, ZX, or YZ planes
|
||||||
|
//#define SF_ARC_FIX // Enable only if using SkeinForge with "Arc Point" fillet procedure
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes.
|
// Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes.
|
||||||
|
|
@ -2228,14 +2273,20 @@
|
||||||
#if HAS_TRINAMIC_CONFIG
|
#if HAS_TRINAMIC_CONFIG
|
||||||
|
|
||||||
#define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current
|
#define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current
|
||||||
#define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256
|
|
||||||
|
/**
|
||||||
|
* Interpolate microsteps to 256
|
||||||
|
* Override for each driver with <driver>_INTERPOLATE settings below
|
||||||
|
*/
|
||||||
|
#define INTERPOLATE true
|
||||||
|
|
||||||
#if AXIS_IS_TMC(X)
|
#if AXIS_IS_TMC(X)
|
||||||
#define X_CURRENT 800 // (mA) RMS current. Multiply by 1.414 for peak current.
|
#define X_CURRENT 800 // (mA) RMS current. Multiply by 1.414 for peak current.
|
||||||
#define X_CURRENT_HOME X_CURRENT // (mA) RMS current for sensorless homing
|
#define X_CURRENT_HOME X_CURRENT // (mA) RMS current for sensorless homing
|
||||||
#define X_MICROSTEPS 16 // 0..256
|
#define X_MICROSTEPS 16 // 0..256
|
||||||
#define X_RSENSE 0.11
|
#define X_RSENSE 0.11
|
||||||
#define X_CHAIN_POS -1 // <=0 : Not chained. 1 : MCU MOSI connected. 2 : Next in chain, ...
|
#define X_CHAIN_POS -1 // -1..0: Not chained. 1: MCU MOSI connected. 2: Next in chain, ...
|
||||||
|
//#define X_INTERPOLATE true // Enable to override 'INTERPOLATE' for the X axis
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if AXIS_IS_TMC(X2)
|
#if AXIS_IS_TMC(X2)
|
||||||
|
|
@ -2244,6 +2295,7 @@
|
||||||
#define X2_MICROSTEPS 16
|
#define X2_MICROSTEPS 16
|
||||||
#define X2_RSENSE 0.11
|
#define X2_RSENSE 0.11
|
||||||
#define X2_CHAIN_POS -1
|
#define X2_CHAIN_POS -1
|
||||||
|
//#define X2_INTERPOLATE true
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if AXIS_IS_TMC(Y)
|
#if AXIS_IS_TMC(Y)
|
||||||
|
|
@ -2252,6 +2304,7 @@
|
||||||
#define Y_MICROSTEPS 16
|
#define Y_MICROSTEPS 16
|
||||||
#define Y_RSENSE 0.11
|
#define Y_RSENSE 0.11
|
||||||
#define Y_CHAIN_POS -1
|
#define Y_CHAIN_POS -1
|
||||||
|
//#define Y_INTERPOLATE true
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if AXIS_IS_TMC(Y2)
|
#if AXIS_IS_TMC(Y2)
|
||||||
|
|
@ -2260,6 +2313,7 @@
|
||||||
#define Y2_MICROSTEPS 16
|
#define Y2_MICROSTEPS 16
|
||||||
#define Y2_RSENSE 0.11
|
#define Y2_RSENSE 0.11
|
||||||
#define Y2_CHAIN_POS -1
|
#define Y2_CHAIN_POS -1
|
||||||
|
//#define Y2_INTERPOLATE true
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if AXIS_IS_TMC(Z)
|
#if AXIS_IS_TMC(Z)
|
||||||
|
|
@ -2268,6 +2322,7 @@
|
||||||
#define Z_MICROSTEPS 16
|
#define Z_MICROSTEPS 16
|
||||||
#define Z_RSENSE 0.11
|
#define Z_RSENSE 0.11
|
||||||
#define Z_CHAIN_POS -1
|
#define Z_CHAIN_POS -1
|
||||||
|
//#define Z_INTERPOLATE true
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if AXIS_IS_TMC(Z2)
|
#if AXIS_IS_TMC(Z2)
|
||||||
|
|
@ -2276,6 +2331,7 @@
|
||||||
#define Z2_MICROSTEPS 16
|
#define Z2_MICROSTEPS 16
|
||||||
#define Z2_RSENSE 0.11
|
#define Z2_RSENSE 0.11
|
||||||
#define Z2_CHAIN_POS -1
|
#define Z2_CHAIN_POS -1
|
||||||
|
//#define Z2_INTERPOLATE true
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if AXIS_IS_TMC(Z3)
|
#if AXIS_IS_TMC(Z3)
|
||||||
|
|
@ -2284,6 +2340,7 @@
|
||||||
#define Z3_MICROSTEPS 16
|
#define Z3_MICROSTEPS 16
|
||||||
#define Z3_RSENSE 0.11
|
#define Z3_RSENSE 0.11
|
||||||
#define Z3_CHAIN_POS -1
|
#define Z3_CHAIN_POS -1
|
||||||
|
//#define Z3_INTERPOLATE true
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if AXIS_IS_TMC(Z4)
|
#if AXIS_IS_TMC(Z4)
|
||||||
|
|
@ -2292,6 +2349,7 @@
|
||||||
#define Z4_MICROSTEPS 16
|
#define Z4_MICROSTEPS 16
|
||||||
#define Z4_RSENSE 0.11
|
#define Z4_RSENSE 0.11
|
||||||
#define Z4_CHAIN_POS -1
|
#define Z4_CHAIN_POS -1
|
||||||
|
//#define Z4_INTERPOLATE true
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if AXIS_IS_TMC(E0)
|
#if AXIS_IS_TMC(E0)
|
||||||
|
|
@ -2299,6 +2357,7 @@
|
||||||
#define E0_MICROSTEPS 16
|
#define E0_MICROSTEPS 16
|
||||||
#define E0_RSENSE 0.11
|
#define E0_RSENSE 0.11
|
||||||
#define E0_CHAIN_POS -1
|
#define E0_CHAIN_POS -1
|
||||||
|
//#define E0_INTERPOLATE true
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if AXIS_IS_TMC(E1)
|
#if AXIS_IS_TMC(E1)
|
||||||
|
|
@ -2306,6 +2365,7 @@
|
||||||
#define E1_MICROSTEPS 16
|
#define E1_MICROSTEPS 16
|
||||||
#define E1_RSENSE 0.11
|
#define E1_RSENSE 0.11
|
||||||
#define E1_CHAIN_POS -1
|
#define E1_CHAIN_POS -1
|
||||||
|
//#define E1_INTERPOLATE true
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if AXIS_IS_TMC(E2)
|
#if AXIS_IS_TMC(E2)
|
||||||
|
|
@ -2313,6 +2373,7 @@
|
||||||
#define E2_MICROSTEPS 16
|
#define E2_MICROSTEPS 16
|
||||||
#define E2_RSENSE 0.11
|
#define E2_RSENSE 0.11
|
||||||
#define E2_CHAIN_POS -1
|
#define E2_CHAIN_POS -1
|
||||||
|
//#define E2_INTERPOLATE true
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if AXIS_IS_TMC(E3)
|
#if AXIS_IS_TMC(E3)
|
||||||
|
|
@ -2320,6 +2381,7 @@
|
||||||
#define E3_MICROSTEPS 16
|
#define E3_MICROSTEPS 16
|
||||||
#define E3_RSENSE 0.11
|
#define E3_RSENSE 0.11
|
||||||
#define E3_CHAIN_POS -1
|
#define E3_CHAIN_POS -1
|
||||||
|
//#define E3_INTERPOLATE true
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if AXIS_IS_TMC(E4)
|
#if AXIS_IS_TMC(E4)
|
||||||
|
|
@ -2327,6 +2389,7 @@
|
||||||
#define E4_MICROSTEPS 16
|
#define E4_MICROSTEPS 16
|
||||||
#define E4_RSENSE 0.11
|
#define E4_RSENSE 0.11
|
||||||
#define E4_CHAIN_POS -1
|
#define E4_CHAIN_POS -1
|
||||||
|
//#define E4_INTERPOLATE true
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if AXIS_IS_TMC(E5)
|
#if AXIS_IS_TMC(E5)
|
||||||
|
|
@ -2334,6 +2397,7 @@
|
||||||
#define E5_MICROSTEPS 16
|
#define E5_MICROSTEPS 16
|
||||||
#define E5_RSENSE 0.11
|
#define E5_RSENSE 0.11
|
||||||
#define E5_CHAIN_POS -1
|
#define E5_CHAIN_POS -1
|
||||||
|
//#define E5_INTERPOLATE true
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if AXIS_IS_TMC(E6)
|
#if AXIS_IS_TMC(E6)
|
||||||
|
|
@ -2341,6 +2405,7 @@
|
||||||
#define E6_MICROSTEPS 16
|
#define E6_MICROSTEPS 16
|
||||||
#define E6_RSENSE 0.11
|
#define E6_RSENSE 0.11
|
||||||
#define E6_CHAIN_POS -1
|
#define E6_CHAIN_POS -1
|
||||||
|
//#define E6_INTERPOLATE true
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if AXIS_IS_TMC(E7)
|
#if AXIS_IS_TMC(E7)
|
||||||
|
|
@ -2348,6 +2413,7 @@
|
||||||
#define E7_MICROSTEPS 16
|
#define E7_MICROSTEPS 16
|
||||||
#define E7_RSENSE 0.11
|
#define E7_RSENSE 0.11
|
||||||
#define E7_CHAIN_POS -1
|
#define E7_CHAIN_POS -1
|
||||||
|
//#define E7_INTERPOLATE true
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -2438,10 +2504,26 @@
|
||||||
* CHOPPER_PRUSAMK3_24V // Imported parameters from the official Průša firmware for MK3 (24V)
|
* CHOPPER_PRUSAMK3_24V // Imported parameters from the official Průša firmware for MK3 (24V)
|
||||||
* CHOPPER_MARLIN_119 // Old defaults from Marlin v1.1.9
|
* CHOPPER_MARLIN_119 // Old defaults from Marlin v1.1.9
|
||||||
*
|
*
|
||||||
* Define you own with
|
* Define your own with:
|
||||||
* { <off_time[1..15]>, <hysteresis_end[-3..12]>, hysteresis_start[1..8] }
|
* { <off_time[1..15]>, <hysteresis_end[-3..12]>, hysteresis_start[1..8] }
|
||||||
*/
|
*/
|
||||||
#define CHOPPER_TIMING CHOPPER_DEFAULT_12V
|
#define CHOPPER_TIMING CHOPPER_DEFAULT_12V // All axes (override below)
|
||||||
|
//#define CHOPPER_TIMING_X CHOPPER_DEFAULT_12V // For X Axes (override below)
|
||||||
|
//#define CHOPPER_TIMING_X2 CHOPPER_DEFAULT_12V
|
||||||
|
//#define CHOPPER_TIMING_Y CHOPPER_DEFAULT_12V // For Y Axes (override below)
|
||||||
|
//#define CHOPPER_TIMING_Y2 CHOPPER_DEFAULT_12V
|
||||||
|
//#define CHOPPER_TIMING_Z CHOPPER_DEFAULT_12V // For Z Axes (override below)
|
||||||
|
//#define CHOPPER_TIMING_Z2 CHOPPER_DEFAULT_12V
|
||||||
|
//#define CHOPPER_TIMING_Z3 CHOPPER_DEFAULT_12V
|
||||||
|
//#define CHOPPER_TIMING_Z4 CHOPPER_DEFAULT_12V
|
||||||
|
//#define CHOPPER_TIMING_E CHOPPER_DEFAULT_12V // For Extruders (override below)
|
||||||
|
//#define CHOPPER_TIMING_E1 CHOPPER_DEFAULT_12V
|
||||||
|
//#define CHOPPER_TIMING_E2 CHOPPER_DEFAULT_12V
|
||||||
|
//#define CHOPPER_TIMING_E3 CHOPPER_DEFAULT_12V
|
||||||
|
//#define CHOPPER_TIMING_E4 CHOPPER_DEFAULT_12V
|
||||||
|
//#define CHOPPER_TIMING_E5 CHOPPER_DEFAULT_12V
|
||||||
|
//#define CHOPPER_TIMING_E6 CHOPPER_DEFAULT_12V
|
||||||
|
//#define CHOPPER_TIMING_E7 CHOPPER_DEFAULT_12V
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Monitor Trinamic drivers
|
* Monitor Trinamic drivers
|
||||||
|
|
@ -2870,11 +2952,18 @@
|
||||||
|
|
||||||
#define SPINDLE_LASER_FREQUENCY 2500 // (Hz) Spindle/laser frequency (only on supported HALs: AVR and LPC)
|
#define SPINDLE_LASER_FREQUENCY 2500 // (Hz) Spindle/laser frequency (only on supported HALs: AVR and LPC)
|
||||||
|
|
||||||
|
//#define SPINDLE_SERVO // A servo converting an angle to spindle power
|
||||||
|
#ifdef SPINDLE_SERVO
|
||||||
|
#define SPINDLE_SERVO_NR 0 // Index of servo used for spindle control
|
||||||
|
#define SPINDLE_SERVO_MIN 10 // Minimum angle for servo spindle
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Speed / Power can be set ('M3 S') and displayed in terms of:
|
* Speed / Power can be set ('M3 S') and displayed in terms of:
|
||||||
* - PWM255 (S0 - S255)
|
* - PWM255 (S0 - S255)
|
||||||
* - PERCENT (S0 - S100)
|
* - PERCENT (S0 - S100)
|
||||||
* - RPM (S0 - S50000) Best for use with a spindle
|
* - RPM (S0 - S50000) Best for use with a spindle
|
||||||
|
* - SERVO (S0 - S180)
|
||||||
*/
|
*/
|
||||||
#define CUTTER_POWER_UNIT PWM255
|
#define CUTTER_POWER_UNIT PWM255
|
||||||
|
|
||||||
|
|
@ -2925,7 +3014,7 @@
|
||||||
* This allows the laser to keep in perfect sync with the planner and removes
|
* This allows the laser to keep in perfect sync with the planner and removes
|
||||||
* the powerup/down delay since lasers require negligible time.
|
* the powerup/down delay since lasers require negligible time.
|
||||||
*/
|
*/
|
||||||
#define LASER_POWER_INLINE
|
//#define LASER_POWER_INLINE
|
||||||
|
|
||||||
#if ENABLED(LASER_POWER_INLINE)
|
#if ENABLED(LASER_POWER_INLINE)
|
||||||
/**
|
/**
|
||||||
|
|
@ -3342,6 +3431,25 @@
|
||||||
//#define JOYSTICK_DEBUG
|
//#define JOYSTICK_DEBUG
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mechanical Gantry Calibration
|
||||||
|
* Modern replacement for the Prusa TMC_Z_CALIBRATION.
|
||||||
|
* Adds capability to work with any adjustable current drivers.
|
||||||
|
* Implemented as G34 because M915 is deprecated.
|
||||||
|
*/
|
||||||
|
//#define MECHANICAL_GANTRY_CALIBRATION
|
||||||
|
#if ENABLED(MECHANICAL_GANTRY_CALIBRATION)
|
||||||
|
#define GANTRY_CALIBRATION_CURRENT 600 // Default calibration current in ma
|
||||||
|
#define GANTRY_CALIBRATION_EXTRA_HEIGHT 15 // Extra distance in mm past Z_###_POS to move
|
||||||
|
#define GANTRY_CALIBRATION_FEEDRATE 500 // Feedrate for correction move
|
||||||
|
//#define GANTRY_CALIBRATION_TO_MIN // Enable to calibrate Z in the MIN direction
|
||||||
|
|
||||||
|
//#define GANTRY_CALIBRATION_SAFE_POSITION { X_CENTER, Y_CENTER } // Safe position for nozzle
|
||||||
|
//#define GANTRY_CALIBRATION_XY_PARK_FEEDRATE 3000 // XY Park Feedrate - MMM
|
||||||
|
//#define GANTRY_CALIBRATION_COMMANDS_PRE ""
|
||||||
|
#define GANTRY_CALIBRATION_COMMANDS_POST "G28" // G28 highly recommended to ensure an accurate position
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MAX7219 Debug Matrix
|
* MAX7219 Debug Matrix
|
||||||
*
|
*
|
||||||
|
|
@ -3388,6 +3496,13 @@
|
||||||
// Default behavior is limited to Z axis only.
|
// Default behavior is limited to Z axis only.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ethernet. Use M552 to enable and set the IP address.
|
||||||
|
*/
|
||||||
|
#if HAS_ETHERNET
|
||||||
|
#define MAC_ADDRESS { 0xDE, 0xAD, 0xBE, 0xEF, 0xF0, 0x0D } // A MAC address unique to your network
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* WiFi Support (Espressif ESP32 WiFi)
|
* WiFi Support (Espressif ESP32 WiFi)
|
||||||
*/
|
*/
|
||||||
|
|
@ -3523,6 +3638,11 @@
|
||||||
//
|
//
|
||||||
//#define M100_FREE_MEMORY_WATCHER
|
//#define M100_FREE_MEMORY_WATCHER
|
||||||
|
|
||||||
|
//
|
||||||
|
// M42 - Set pin states
|
||||||
|
//
|
||||||
|
//#define DIRECT_PIN_CONTROL
|
||||||
|
|
||||||
//
|
//
|
||||||
// M43 - display pin status, toggle pins, watch pins, watch endstops & toggle LED, test servo probe
|
// M43 - display pin status, toggle pins, watch pins, watch endstops & toggle LED, test servo probe
|
||||||
//
|
//
|
||||||
|
|
|
||||||
167
Marlin/Makefile
167
Marlin/Makefile
|
|
@ -22,8 +22,10 @@
|
||||||
# (e.g. UPLOAD_PORT = /dev/tty.USB0). If the exact name of this file
|
# (e.g. UPLOAD_PORT = /dev/tty.USB0). If the exact name of this file
|
||||||
# changes, you can use * as a wild card (e.g. UPLOAD_PORT = /dev/tty.usb*).
|
# changes, you can use * as a wild card (e.g. UPLOAD_PORT = /dev/tty.usb*).
|
||||||
#
|
#
|
||||||
# 3. Set the line containing "MCU" to match your board's processor.
|
# 3. Set the line containing "MCU" to match your board's processor. Set
|
||||||
# Older one's are atmega8 based, newer ones like Arduino Mini, Bluetooth
|
# "PROG_MCU" as the AVR part name corresponding to "MCU". You can use the
|
||||||
|
# following command to get a list of correspondences: `avrdude -c alf -p x`
|
||||||
|
# Older boards are atmega8 based, newer ones like Arduino Mini, Bluetooth
|
||||||
# or Diecimila have the atmega168. If you're using a LilyPad Arduino,
|
# or Diecimila have the atmega168. If you're using a LilyPad Arduino,
|
||||||
# change F_CPU to 8000000. If you are using Gen7 electronics, you
|
# change F_CPU to 8000000. If you are using Gen7 electronics, you
|
||||||
# probably need to use 20000000. Either way, you must regenerate
|
# probably need to use 20000000. Either way, you must regenerate
|
||||||
|
|
@ -34,18 +36,18 @@
|
||||||
# 5. Type "make upload", reset your Arduino board, and press enter to
|
# 5. Type "make upload", reset your Arduino board, and press enter to
|
||||||
# upload your program to the Arduino board.
|
# upload your program to the Arduino board.
|
||||||
#
|
#
|
||||||
# Note that all settings at the top of this file can be overriden from
|
# Note that all settings at the top of this file can be overridden from
|
||||||
# the command line with, for example, "make HARDWARE_MOTHERBOARD=71"
|
# the command line with, for example, "make HARDWARE_MOTHERBOARD=71"
|
||||||
#
|
#
|
||||||
# To compile for RAMPS (atmega2560) with Arduino 1.6.9 at root/arduino you would use...
|
# To compile for RAMPS (atmega2560) with Arduino 1.6.9 at root/arduino you would use...
|
||||||
#
|
#
|
||||||
# make ARDUINO_VERSION=10609 AVR_TOOLS_PATH=/root/arduino/hardware/tools/avr/bin/ \
|
# make ARDUINO_VERSION=10609 AVR_TOOLS_PATH=/root/arduino/hardware/tools/avr/bin/ \
|
||||||
# HARDWARE_MOTHERBOARD=33 ARDUINO_INSTALL_DIR=/root/arduino
|
# HARDWARE_MOTHERBOARD=1200 ARDUINO_INSTALL_DIR=/root/arduino
|
||||||
#
|
#
|
||||||
# To compile and upload simply add "upload" to the end of the line...
|
# To compile and upload simply add "upload" to the end of the line...
|
||||||
#
|
#
|
||||||
# make ARDUINO_VERSION=10609 AVR_TOOLS_PATH=/root/arduino/hardware/tools/avr/bin/ \
|
# make ARDUINO_VERSION=10609 AVR_TOOLS_PATH=/root/arduino/hardware/tools/avr/bin/ \
|
||||||
# HARDWARE_MOTHERBOARD=33 ARDUINO_INSTALL_DIR=/root/arduino upload
|
# HARDWARE_MOTHERBOARD=1200 ARDUINO_INSTALL_DIR=/root/arduino upload
|
||||||
#
|
#
|
||||||
# If uploading doesn't work try adding the parameter "AVRDUDE_PROGRAMMER=wiring" or
|
# If uploading doesn't work try adding the parameter "AVRDUDE_PROGRAMMER=wiring" or
|
||||||
# start upload manually (using stk500) like so:
|
# start upload manually (using stk500) like so:
|
||||||
|
|
@ -57,7 +59,26 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
# This defines the board to compile for (see boards.h for your board's ID)
|
# This defines the board to compile for (see boards.h for your board's ID)
|
||||||
HARDWARE_MOTHERBOARD ?= 11
|
HARDWARE_MOTHERBOARD ?= 1020
|
||||||
|
|
||||||
|
ifeq ($(OS),Windows_NT)
|
||||||
|
# Windows
|
||||||
|
ARDUINO_INSTALL_DIR ?= ${HOME}/Arduino
|
||||||
|
ARDUINO_USER_DIR ?= ${HOME}/Arduino
|
||||||
|
else
|
||||||
|
UNAME_S := $(shell uname -s)
|
||||||
|
ifeq ($(UNAME_S),Linux)
|
||||||
|
# Linux
|
||||||
|
ARDUINO_INSTALL_DIR ?= /usr/share/arduino
|
||||||
|
ARDUINO_USER_DIR ?= ${HOME}/Arduino
|
||||||
|
endif
|
||||||
|
ifeq ($(UNAME_S),Darwin)
|
||||||
|
# Darwin (macOS)
|
||||||
|
ARDUINO_INSTALL_DIR ?= /Applications/Arduino.app/Contents/Java
|
||||||
|
ARDUINO_USER_DIR ?= ${HOME}/Documents/Arduino
|
||||||
|
AVR_TOOLS_PATH ?= /Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
# Arduino source install directory, and version number
|
# Arduino source install directory, and version number
|
||||||
# On most linuxes this will be /usr/share/arduino
|
# On most linuxes this will be /usr/share/arduino
|
||||||
|
|
@ -67,32 +88,38 @@ ARDUINO_VERSION ?= 106
|
||||||
# The installed Libraries are in the User folder
|
# The installed Libraries are in the User folder
|
||||||
ARDUINO_USER_DIR ?= ${HOME}/Arduino
|
ARDUINO_USER_DIR ?= ${HOME}/Arduino
|
||||||
|
|
||||||
# You can optionally set a path to the avr-gcc tools. Requires a trailing slash. (ex: /usr/local/avr-gcc/bin)
|
# You can optionally set a path to the avr-gcc tools.
|
||||||
|
# Requires a trailing slash. For example, /usr/local/avr-gcc/bin/
|
||||||
AVR_TOOLS_PATH ?=
|
AVR_TOOLS_PATH ?=
|
||||||
|
|
||||||
#Programmer configuration
|
# Programmer configuration
|
||||||
UPLOAD_RATE ?= 57600
|
UPLOAD_RATE ?= 57600
|
||||||
AVRDUDE_PROGRAMMER ?= arduino
|
AVRDUDE_PROGRAMMER ?= arduino
|
||||||
# on most linuxes this will be /dev/ttyACM0 or /dev/ttyACM1
|
# On most linuxes this will be /dev/ttyACM0 or /dev/ttyACM1
|
||||||
UPLOAD_PORT ?= /dev/ttyUSB0
|
UPLOAD_PORT ?= /dev/ttyUSB0
|
||||||
|
|
||||||
#Directory used to build files in, contains all the build files, from object files to the final hex file
|
# Directory used to build files in, contains all the build files, from object
|
||||||
#on linux it is best to put an absolute path like /home/username/tmp .
|
# files to the final hex file on linux it is best to put an absolute path
|
||||||
|
# like /home/username/tmp .
|
||||||
BUILD_DIR ?= applet
|
BUILD_DIR ?= applet
|
||||||
|
|
||||||
# This defines whether Liquid_TWI2 support will be built
|
# This defines whether Liquid_TWI2 support will be built
|
||||||
LIQUID_TWI2 ?= 0
|
LIQUID_TWI2 ?= 0
|
||||||
|
|
||||||
# this defines if Wire is needed
|
# This defines if Wire is needed
|
||||||
WIRE ?= 0
|
WIRE ?= 0
|
||||||
|
|
||||||
# this defines if U8GLIB is needed (may require RELOC_WORKAROUND)
|
# This defines if Tone is needed (i.e SPEAKER is defined in Configuration.h)
|
||||||
U8GLIB ?= 1
|
# Disabling this (and SPEAKER) saves approximatively 350 bytes of memory.
|
||||||
|
TONE ?= 1
|
||||||
|
|
||||||
# this defines whether to include the Trinamic TMCStepper library
|
# This defines if U8GLIB is needed (may require RELOC_WORKAROUND)
|
||||||
TMC ?= 1
|
U8GLIB ?= 0
|
||||||
|
|
||||||
# this defines whether to include the AdaFruit NeoPixel library
|
# This defines whether to include the Trinamic TMCStepper library
|
||||||
|
TMC ?= 0
|
||||||
|
|
||||||
|
# This defines whether to include the AdaFruit NeoPixel library
|
||||||
NEOPIXEL ?= 0
|
NEOPIXEL ?= 0
|
||||||
|
|
||||||
############
|
############
|
||||||
|
|
@ -208,7 +235,8 @@ else ifeq ($(HARDWARE_MOTHERBOARD),1119)
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1120)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1120)
|
||||||
# Ultimaker (Older electronics. Pre 1.5.4. This is rare)
|
# Ultimaker (Older electronics. Pre 1.5.4. This is rare)
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1121)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1121)
|
||||||
MCU ?= atmega1280
|
MCU ?= atmega1280
|
||||||
|
PROG_MCU ?= m1280
|
||||||
|
|
||||||
# Azteeg X3
|
# Azteeg X3
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1122)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1122)
|
||||||
|
|
@ -350,9 +378,11 @@ else ifeq ($(HARDWARE_MOTHERBOARD),1320)
|
||||||
# Minitronics v1.0/1.1
|
# Minitronics v1.0/1.1
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1400)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1400)
|
||||||
MCU ?= atmega1281
|
MCU ?= atmega1281
|
||||||
|
PROG_MCU ?= m1281
|
||||||
# Silvergate v1.0
|
# Silvergate v1.0
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1401)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1401)
|
||||||
MCU ?= atmega1281
|
MCU ?= atmega1281
|
||||||
|
PROG_MCU ?= m1281
|
||||||
|
|
||||||
#
|
#
|
||||||
# Sanguinololu and Derivatives - ATmega644P, ATmega1284P
|
# Sanguinololu and Derivatives - ATmega644P, ATmega1284P
|
||||||
|
|
@ -362,46 +392,57 @@ else ifeq ($(HARDWARE_MOTHERBOARD),1401)
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1500)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1500)
|
||||||
HARDWARE_VARIANT ?= Sanguino
|
HARDWARE_VARIANT ?= Sanguino
|
||||||
MCU ?= atmega644p
|
MCU ?= atmega644p
|
||||||
|
PROG_MCU ?= m644p
|
||||||
# Sanguinololu 1.2 and above
|
# Sanguinololu 1.2 and above
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1501)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1501)
|
||||||
HARDWARE_VARIANT ?= Sanguino
|
HARDWARE_VARIANT ?= Sanguino
|
||||||
MCU ?= atmega644p
|
MCU ?= atmega644p
|
||||||
|
PROG_MCU ?= m644p
|
||||||
# Melzi
|
# Melzi
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1502)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1502)
|
||||||
HARDWARE_VARIANT ?= Sanguino
|
HARDWARE_VARIANT ?= Sanguino
|
||||||
MCU ?= atmega644p
|
MCU ?= atmega644p
|
||||||
|
PROG_MCU ?= m644p
|
||||||
# Melzi V2.0
|
# Melzi V2.0
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1503)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1503)
|
||||||
HARDWARE_VARIANT ?= Sanguino
|
HARDWARE_VARIANT ?= Sanguino
|
||||||
MCU ?= atmega1284p
|
MCU ?= atmega1284p
|
||||||
|
PROG_MCU ?= m1284p
|
||||||
# Melzi with ATmega1284 (MaKr3d version)
|
# Melzi with ATmega1284 (MaKr3d version)
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1504)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1504)
|
||||||
HARDWARE_VARIANT ?= Sanguino
|
HARDWARE_VARIANT ?= Sanguino
|
||||||
MCU ?= atmega1284p
|
MCU ?= atmega1284p
|
||||||
|
PROG_MCU ?= m1284p
|
||||||
# Melzi Creality3D board (for CR-10 etc)
|
# Melzi Creality3D board (for CR-10 etc)
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1505)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1505)
|
||||||
HARDWARE_VARIANT ?= Sanguino
|
HARDWARE_VARIANT ?= Sanguino
|
||||||
MCU ?= atmega1284p
|
MCU ?= atmega1284p
|
||||||
|
PROG_MCU ?= m1284p
|
||||||
# Melzi Malyan M150 board
|
# Melzi Malyan M150 board
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1506)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1506)
|
||||||
HARDWARE_VARIANT ?= Sanguino
|
HARDWARE_VARIANT ?= Sanguino
|
||||||
MCU ?= atmega1284p
|
MCU ?= atmega1284p
|
||||||
|
PROG_MCU ?= m1284p
|
||||||
# Tronxy X5S
|
# Tronxy X5S
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1507)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1507)
|
||||||
HARDWARE_VARIANT ?= Sanguino
|
HARDWARE_VARIANT ?= Sanguino
|
||||||
MCU ?= atmega1284p
|
MCU ?= atmega1284p
|
||||||
|
PROG_MCU ?= m1284p
|
||||||
# STB V1.1
|
# STB V1.1
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1508)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1508)
|
||||||
HARDWARE_VARIANT ?= Sanguino
|
HARDWARE_VARIANT ?= Sanguino
|
||||||
MCU ?= atmega1284p
|
MCU ?= atmega1284p
|
||||||
|
PROG_MCU ?= m1284p
|
||||||
# Azteeg X1
|
# Azteeg X1
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1509)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1509)
|
||||||
HARDWARE_VARIANT ?= Sanguino
|
HARDWARE_VARIANT ?= Sanguino
|
||||||
MCU ?= atmega1284p
|
MCU ?= atmega1284p
|
||||||
|
PROG_MCU ?= m1284p
|
||||||
# Anet 1.0 (Melzi clone)
|
# Anet 1.0 (Melzi clone)
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1510)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1510)
|
||||||
HARDWARE_VARIANT ?= Sanguino
|
HARDWARE_VARIANT ?= Sanguino
|
||||||
MCU ?= atmega1284p
|
MCU ?= atmega1284p
|
||||||
|
PROG_MCU ?= m1284p
|
||||||
|
|
||||||
#
|
#
|
||||||
# Other ATmega644P, ATmega644, ATmega1284P
|
# Other ATmega644P, ATmega644, ATmega1284P
|
||||||
|
|
@ -411,50 +452,61 @@ else ifeq ($(HARDWARE_MOTHERBOARD),1510)
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1600)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1600)
|
||||||
HARDWARE_VARIANT ?= Sanguino
|
HARDWARE_VARIANT ?= Sanguino
|
||||||
MCU ?= atmega644p
|
MCU ?= atmega644p
|
||||||
|
PROG_MCU ?= m644p
|
||||||
# Gen3+
|
# Gen3+
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1601)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1601)
|
||||||
HARDWARE_VARIANT ?= Sanguino
|
HARDWARE_VARIANT ?= Sanguino
|
||||||
MCU ?= atmega644p
|
MCU ?= atmega644p
|
||||||
|
PROG_MCU ?= m644p
|
||||||
# Gen6
|
# Gen6
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1602)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1602)
|
||||||
HARDWARE_VARIANT ?= Gen6
|
HARDWARE_VARIANT ?= Gen6
|
||||||
MCU ?= atmega644p
|
MCU ?= atmega644p
|
||||||
|
PROG_MCU ?= m644p
|
||||||
# Gen6 deluxe
|
# Gen6 deluxe
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1603)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1603)
|
||||||
HARDWARE_VARIANT ?= Gen6
|
HARDWARE_VARIANT ?= Gen6
|
||||||
MCU ?= atmega644p
|
MCU ?= atmega644p
|
||||||
|
PROG_MCU ?= m644p
|
||||||
# Gen7 custom (Alfons3 Version)
|
# Gen7 custom (Alfons3 Version)
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1604)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1604)
|
||||||
HARDWARE_VARIANT ?= Gen7
|
HARDWARE_VARIANT ?= Gen7
|
||||||
MCU ?= atmega644
|
MCU ?= atmega644
|
||||||
|
PROG_MCU ?= m644
|
||||||
F_CPU ?= 20000000
|
F_CPU ?= 20000000
|
||||||
# Gen7 v1.1, v1.2
|
# Gen7 v1.1, v1.2
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1605)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1605)
|
||||||
HARDWARE_VARIANT ?= Gen7
|
HARDWARE_VARIANT ?= Gen7
|
||||||
MCU ?= atmega644p
|
MCU ?= atmega644p
|
||||||
|
PROG_MCU ?= m644p
|
||||||
F_CPU ?= 20000000
|
F_CPU ?= 20000000
|
||||||
# Gen7 v1.3
|
# Gen7 v1.3
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1606)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1606)
|
||||||
HARDWARE_VARIANT ?= Gen7
|
HARDWARE_VARIANT ?= Gen7
|
||||||
MCU ?= atmega644p
|
MCU ?= atmega644p
|
||||||
|
PROG_MCU ?= m644p
|
||||||
F_CPU ?= 20000000
|
F_CPU ?= 20000000
|
||||||
# Gen7 v1.4
|
# Gen7 v1.4
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1607)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1607)
|
||||||
HARDWARE_VARIANT ?= Gen7
|
HARDWARE_VARIANT ?= Gen7
|
||||||
MCU ?= atmega1284p
|
MCU ?= atmega1284p
|
||||||
|
PROG_MCU ?= m1284p
|
||||||
F_CPU ?= 20000000
|
F_CPU ?= 20000000
|
||||||
# Alpha OMCA board
|
# Alpha OMCA board
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1608)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1608)
|
||||||
HARDWARE_VARIANT ?= SanguinoA
|
HARDWARE_VARIANT ?= SanguinoA
|
||||||
MCU ?= atmega644
|
MCU ?= atmega644
|
||||||
|
PROG_MCU ?= m644
|
||||||
# Final OMCA board
|
# Final OMCA board
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1609)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1609)
|
||||||
HARDWARE_VARIANT ?= Sanguino
|
HARDWARE_VARIANT ?= Sanguino
|
||||||
MCU ?= atmega644p
|
MCU ?= atmega644p
|
||||||
|
PROG_MCU ?= m644p
|
||||||
# Sethi 3D_1
|
# Sethi 3D_1
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1610)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1610)
|
||||||
HARDWARE_VARIANT ?= Sanguino
|
HARDWARE_VARIANT ?= Sanguino
|
||||||
MCU ?= atmega644p
|
MCU ?= atmega644p
|
||||||
|
PROG_MCU ?= m644p
|
||||||
|
|
||||||
#
|
#
|
||||||
# Teensyduino - AT90USB1286, AT90USB1286P
|
# Teensyduino - AT90USB1286, AT90USB1286P
|
||||||
|
|
@ -464,51 +516,60 @@ else ifeq ($(HARDWARE_MOTHERBOARD),1610)
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1700)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1700)
|
||||||
HARDWARE_VARIANT ?= Teensy
|
HARDWARE_VARIANT ?= Teensy
|
||||||
MCU ?= at90usb1286
|
MCU ?= at90usb1286
|
||||||
|
PROG_MCU ?= usb1286
|
||||||
# Printrboard (AT90USB1286)
|
# Printrboard (AT90USB1286)
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1701)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1701)
|
||||||
HARDWARE_VARIANT ?= Teensy
|
HARDWARE_VARIANT ?= Teensy
|
||||||
MCU ?= at90usb1286
|
MCU ?= at90usb1286
|
||||||
|
PROG_MCU ?= usb1286
|
||||||
# Printrboard Revision F (AT90USB1286)
|
# Printrboard Revision F (AT90USB1286)
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1702)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1702)
|
||||||
HARDWARE_VARIANT ?= Teensy
|
HARDWARE_VARIANT ?= Teensy
|
||||||
MCU ?= at90usb1286
|
MCU ?= at90usb1286
|
||||||
|
PROG_MCU ?= usb1286
|
||||||
# Brainwave (AT90USB646)
|
# Brainwave (AT90USB646)
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1703)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1703)
|
||||||
HARDWARE_VARIANT ?= Teensy
|
HARDWARE_VARIANT ?= Teensy
|
||||||
MCU ?= at90usb646
|
MCU ?= at90usb646
|
||||||
|
PROG_MCU ?= usb646
|
||||||
# Brainwave Pro (AT90USB1286)
|
# Brainwave Pro (AT90USB1286)
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1704)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1704)
|
||||||
HARDWARE_VARIANT ?= Teensy
|
HARDWARE_VARIANT ?= Teensy
|
||||||
MCU ?= at90usb1286
|
MCU ?= at90usb1286
|
||||||
|
PROG_MCU ?= usb1286
|
||||||
# SAV Mk-I (AT90USB1286)
|
# SAV Mk-I (AT90USB1286)
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1705)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1705)
|
||||||
HARDWARE_VARIANT ?= Teensy
|
HARDWARE_VARIANT ?= Teensy
|
||||||
MCU ?= at90usb1286
|
MCU ?= at90usb1286
|
||||||
|
PROG_MCU ?= usb1286
|
||||||
# Teensy++2.0 (AT90USB1286)
|
# Teensy++2.0 (AT90USB1286)
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1706)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1706)
|
||||||
HARDWARE_VARIANT ?= Teensy
|
HARDWARE_VARIANT ?= Teensy
|
||||||
MCU ?= at90usb1286
|
MCU ?= at90usb1286
|
||||||
|
PROG_MCU ?= usb1286
|
||||||
# 5DPrint D8 Driver Board
|
# 5DPrint D8 Driver Board
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),1707)
|
else ifeq ($(HARDWARE_MOTHERBOARD),1707)
|
||||||
HARDWARE_VARIANT ?= Teensy
|
HARDWARE_VARIANT ?= Teensy
|
||||||
MCU ?= at90usb1286
|
MCU ?= at90usb1286
|
||||||
|
PROG_MCU ?= usb1286
|
||||||
|
|
||||||
# UltiMachine Archim1 (with DRV8825 drivers)
|
# UltiMachine Archim1 (with DRV8825 drivers)
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),3023)
|
else ifeq ($(HARDWARE_MOTHERBOARD),3023)
|
||||||
HARDWARE_VARIANT ?= archim
|
HARDWARE_VARIANT ?= archim
|
||||||
MCPU = cortex-m3
|
MCPU = cortex-m3
|
||||||
F_CPU = 84000000L
|
F_CPU = 84000000
|
||||||
IS_MCU = 0
|
IS_MCU = 0
|
||||||
# UltiMachine Archim2 (with TMC2130 drivers)
|
# UltiMachine Archim2 (with TMC2130 drivers)
|
||||||
else ifeq ($(HARDWARE_MOTHERBOARD),3024)
|
else ifeq ($(HARDWARE_MOTHERBOARD),3024)
|
||||||
HARDWARE_VARIANT ?= archim
|
HARDWARE_VARIANT ?= archim
|
||||||
MCPU = cortex-m3
|
MCPU = cortex-m3
|
||||||
F_CPU = 84000000L
|
F_CPU = 84000000
|
||||||
IS_MCU = 0
|
IS_MCU = 0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Be sure to regenerate speed_lookuptable.h with create_speed_lookuptable.py
|
# Be sure to regenerate speed_lookuptable.h with create_speed_lookuptable.py
|
||||||
# if you are setting this to something other than 16MHz
|
# if you are setting this to something other than 16MHz
|
||||||
|
# Do not put the UL suffix, it's done later on.
|
||||||
# Set to 16Mhz if not yet set.
|
# Set to 16Mhz if not yet set.
|
||||||
F_CPU ?= 16000000
|
F_CPU ?= 16000000
|
||||||
|
|
||||||
|
|
@ -518,7 +579,8 @@ IS_MCU ?= 1
|
||||||
ifeq ($(IS_MCU),1)
|
ifeq ($(IS_MCU),1)
|
||||||
# Set to arduino, ATmega2560 if not yet set.
|
# Set to arduino, ATmega2560 if not yet set.
|
||||||
HARDWARE_VARIANT ?= arduino
|
HARDWARE_VARIANT ?= arduino
|
||||||
MCU ?= atmega2560
|
MCU ?= atmega2560
|
||||||
|
PROG_MCU ?= m2560
|
||||||
|
|
||||||
TOOL_PREFIX = avr
|
TOOL_PREFIX = avr
|
||||||
MCU_FLAGS = -mmcu=$(MCU)
|
MCU_FLAGS = -mmcu=$(MCU)
|
||||||
|
|
@ -549,27 +611,36 @@ VPATH += $(BUILD_DIR)
|
||||||
VPATH += $(HARDWARE_SRC)
|
VPATH += $(HARDWARE_SRC)
|
||||||
|
|
||||||
ifeq ($(HARDWARE_VARIANT), $(filter $(HARDWARE_VARIANT),arduino Teensy Sanguino))
|
ifeq ($(HARDWARE_VARIANT), $(filter $(HARDWARE_VARIANT),arduino Teensy Sanguino))
|
||||||
VPATH += $(ARDUINO_INSTALL_DIR)/hardware/marlin/avr/libraries/LiquidCrystal/src
|
# Old libraries (avr-core 1.6.21 < / Arduino < 1.6.8)
|
||||||
VPATH += $(ARDUINO_INSTALL_DIR)/hardware/marlin/avr/libraries/SPI
|
VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SPI
|
||||||
|
# New libraries (avr-core >= 1.6.21 / Arduino >= 1.6.8)
|
||||||
|
VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SPI/src
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(IS_MCU),1)
|
ifeq ($(IS_MCU),1)
|
||||||
VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/cores/arduino
|
VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/cores/arduino
|
||||||
|
|
||||||
|
# Old libraries (avr-core 1.6.21 < / Arduino < 1.6.8)
|
||||||
VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SPI
|
VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SPI
|
||||||
|
VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SoftwareSerial
|
||||||
|
# New libraries (avr-core >= 1.6.21 / Arduino >= 1.6.8)
|
||||||
VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SPI/src
|
VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SPI/src
|
||||||
VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SoftwareSerial/src
|
VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SoftwareSerial/src
|
||||||
endif
|
endif
|
||||||
|
|
||||||
VPATH += $(ARDUINO_INSTALL_DIR)/libraries/LiquidCrystal/src
|
VPATH += $(ARDUINO_INSTALL_DIR)/libraries/LiquidCrystal/src
|
||||||
|
|
||||||
ifeq ($(LIQUID_TWI2), 1)
|
ifeq ($(LIQUID_TWI2), 1)
|
||||||
VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Wire
|
WIRE = 1
|
||||||
VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Wire/utility
|
VPATH += $(ARDUINO_INSTALL_DIR)/libraries/LiquidTWI2
|
||||||
VPATH += $(ARDUINO_INSTALL_DIR)/libraries/LiquidTWI2
|
|
||||||
endif
|
endif
|
||||||
ifeq ($(WIRE), 1)
|
ifeq ($(WIRE), 1)
|
||||||
VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Wire
|
# Old libraries (avr-core 1.6.21 / Arduino < 1.6.8)
|
||||||
VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Wire/utility
|
VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/Wire
|
||||||
|
VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/Wire/utility
|
||||||
|
# New libraries (avr-core >= 1.6.21 / Arduino >= 1.6.8)
|
||||||
|
VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/Wire/src
|
||||||
|
VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/Wire/src/utility
|
||||||
endif
|
endif
|
||||||
ifeq ($(NEOPIXEL), 1)
|
ifeq ($(NEOPIXEL), 1)
|
||||||
VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Adafruit_NeoPixel
|
VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Adafruit_NeoPixel
|
||||||
|
|
@ -641,13 +712,23 @@ ifeq ($(WIRE), 1)
|
||||||
LIB_CXXSRC += Wire.cpp
|
LIB_CXXSRC += Wire.cpp
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(TONE), 1)
|
||||||
|
LIB_CXXSRC += Tone.cpp
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(U8GLIB), 1)
|
ifeq ($(U8GLIB), 1)
|
||||||
LIB_CXXSRC += U8glib.cpp
|
LIB_CXXSRC += U8glib.cpp
|
||||||
LIB_SRC += u8g_ll_api.c u8g_bitmap.c u8g_clip.c u8g_com_null.c u8g_delay.c u8g_page.c u8g_pb.c u8g_pb16h1.c u8g_rect.c u8g_state.c u8g_font.c u8g_font_6x13.c u8g_font_04b_03.c u8g_font_5x8.c
|
LIB_SRC += u8g_ll_api.c u8g_bitmap.c u8g_clip.c u8g_com_null.c u8g_delay.c \
|
||||||
|
u8g_page.c u8g_pb.c u8g_pb16h1.c u8g_rect.c u8g_state.c u8g_font.c \
|
||||||
|
u8g_font_6x13.c u8g_font_04b_03.c u8g_font_5x8.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(TMC), 1)
|
ifeq ($(TMC), 1)
|
||||||
LIB_CXXSRC += TMCStepper.cpp COOLCONF.cpp DRV_STATUS.cpp IHOLD_IRUN.cpp CHOPCONF.cpp GCONF.cpp PWMCONF.cpp DRV_CONF.cpp DRVCONF.cpp DRVCTRL.cpp DRVSTATUS.cpp ENCMODE.cpp RAMP_STAT.cpp SGCSCONF.cpp SHORT_CONF.cpp SMARTEN.cpp SW_MODE.cpp SW_SPI.cpp TMC2130Stepper.cpp TMC2208Stepper.cpp TMC2209Stepper.cpp TMC2660Stepper.cpp TMC5130Stepper.cpp TMC5160Stepper.cpp
|
LIB_CXXSRC += TMCStepper.cpp COOLCONF.cpp DRV_STATUS.cpp IHOLD_IRUN.cpp \
|
||||||
|
CHOPCONF.cpp GCONF.cpp PWMCONF.cpp DRV_CONF.cpp DRVCONF.cpp DRVCTRL.cpp \
|
||||||
|
DRVSTATUS.cpp ENCMODE.cpp RAMP_STAT.cpp SGCSCONF.cpp SHORT_CONF.cpp \
|
||||||
|
SMARTEN.cpp SW_MODE.cpp SW_SPI.cpp TMC2130Stepper.cpp TMC2208Stepper.cpp \
|
||||||
|
TMC2209Stepper.cpp TMC2660Stepper.cpp TMC5130Stepper.cpp TMC5160Stepper.cpp
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(RELOC_WORKAROUND), 1)
|
ifeq ($(RELOC_WORKAROUND), 1)
|
||||||
|
|
@ -689,17 +770,23 @@ REMOVE = rm -f
|
||||||
MV = mv -f
|
MV = mv -f
|
||||||
|
|
||||||
# Place -D or -U options here
|
# Place -D or -U options here
|
||||||
CDEFS = -DF_CPU=$(F_CPU) ${addprefix -D , $(DEFINES)} -DARDUINO=$(ARDUINO_VERSION)
|
CDEFS = -DF_CPU=$(F_CPU)UL ${addprefix -D , $(DEFINES)} -DARDUINO=$(ARDUINO_VERSION)
|
||||||
CXXDEFS = $(CDEFS)
|
CXXDEFS = $(CDEFS)
|
||||||
|
|
||||||
ifeq ($(HARDWARE_VARIANT), Teensy)
|
ifeq ($(HARDWARE_VARIANT), Teensy)
|
||||||
CDEFS += -DUSB_SERIAL
|
CDEFS += -DUSB_SERIAL
|
||||||
LIB_SRC += usb.c pins_teensy.c
|
LIB_SRC += usb.c pins_teensy.c
|
||||||
LIB_CXXSRC += usb_api.cpp
|
LIB_CXXSRC += usb_api.cpp
|
||||||
|
|
||||||
else ifeq ($(HARDWARE_VARIANT), archim)
|
else ifeq ($(HARDWARE_VARIANT), archim)
|
||||||
CDEFS += -DARDUINO_SAM_ARCHIM -DARDUINO_ARCH_SAM -D__SAM3X8E__ -DUSB_VID=0x27b1 -DUSB_PID=0x0001 -DUSBCON '-DUSB_MANUFACTURER="UltiMachine"' '-DUSB_PRODUCT_STRING="Archim"'
|
CDEFS += -DARDUINO_SAM_ARCHIM -DARDUINO_ARCH_SAM -D__SAM3X8E__
|
||||||
LIB_CXXSRC += variant.cpp IPAddress.cpp Reset.cpp RingBuffer.cpp Stream.cpp UARTClass.cpp USARTClass.cpp abi.cpp new.cpp watchdog.cpp CDC.cpp PluggableUSB.cpp USBCore.cpp
|
CDEFS += -DUSB_VID=0x27B1 -DUSB_PID=0x0001 -DUSBCON
|
||||||
|
CDEFS += '-DUSB_MANUFACTURER="UltiMachine"' '-DUSB_PRODUCT_STRING="Archim"'
|
||||||
|
|
||||||
|
LIB_CXXSRC += variant.cpp IPAddress.cpp Reset.cpp RingBuffer.cpp Stream.cpp \
|
||||||
|
UARTClass.cpp USARTClass.cpp abi.cpp new.cpp watchdog.cpp CDC.cpp \
|
||||||
|
PluggableUSB.cpp USBCore.cpp
|
||||||
|
|
||||||
LIB_SRC += cortex_handlers.c iar_calls_sam3.c syscalls_sam3.c dtostrf.c itoa.c
|
LIB_SRC += cortex_handlers.c iar_calls_sam3.c syscalls_sam3.c dtostrf.c itoa.c
|
||||||
|
|
||||||
ifeq ($(U8GLIB), 1)
|
ifeq ($(U8GLIB), 1)
|
||||||
|
|
@ -725,16 +812,20 @@ CTUNING = -fsigned-char -funsigned-bitfields -fno-exceptions \
|
||||||
ifneq ($(HARDWARE_MOTHERBOARD),)
|
ifneq ($(HARDWARE_MOTHERBOARD),)
|
||||||
CTUNING += -DMOTHERBOARD=${HARDWARE_MOTHERBOARD}
|
CTUNING += -DMOTHERBOARD=${HARDWARE_MOTHERBOARD}
|
||||||
endif
|
endif
|
||||||
|
|
||||||
#CEXTRA = -Wa,-adhlns=$(<:.c=.lst)
|
#CEXTRA = -Wa,-adhlns=$(<:.c=.lst)
|
||||||
CXXEXTRA = -fno-use-cxa-atexit -fno-threadsafe-statics -fno-rtti
|
CXXEXTRA = -fno-use-cxa-atexit -fno-threadsafe-statics -fno-rtti
|
||||||
CFLAGS := $(CDEBUG) $(CDEFS) $(CINCS) -O$(OPT) $(CEXTRA) $(CTUNING) $(CSTANDARD)
|
CFLAGS := $(CDEBUG) $(CDEFS) $(CINCS) -O$(OPT) $(CEXTRA) $(CTUNING) $(CSTANDARD)
|
||||||
CXXFLAGS := $(CDEFS) $(CINCS) -O$(OPT) $(CXXEXTRA) $(CTUNING) $(CXXSTANDARD)
|
CXXFLAGS := $(CDEFS) $(CINCS) -O$(OPT) $(CXXEXTRA) $(CTUNING) $(CXXSTANDARD)
|
||||||
ASFLAGS := $(CDEFS)
|
ASFLAGS := $(CDEFS)
|
||||||
#ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs
|
#ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs
|
||||||
|
|
||||||
ifeq ($(HARDWARE_VARIANT), archim)
|
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_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)
|
LD_SUFFIX = $(LDLIBS)
|
||||||
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
|
|
||||||
|
LDFLAGS = -lm -T$(LDSCRIPT) -u _sbrk -u link -u _close -u _fstat -u _isatty
|
||||||
|
LDFLAGS += -u _lseek -u _read -u _write -u _exit -u kill -u _getpid
|
||||||
else
|
else
|
||||||
LD_PREFIX = -Wl,--gc-sections,--relax
|
LD_PREFIX = -Wl,--gc-sections,--relax
|
||||||
LDFLAGS = -lm
|
LDFLAGS = -lm
|
||||||
|
|
@ -750,7 +841,7 @@ else
|
||||||
AVRDUDE_CONF = $(ARDUINO_INSTALL_DIR)/hardware/tools/avr/etc/avrdude.conf
|
AVRDUDE_CONF = $(ARDUINO_INSTALL_DIR)/hardware/tools/avr/etc/avrdude.conf
|
||||||
endif
|
endif
|
||||||
AVRDUDE_FLAGS = -D -C$(AVRDUDE_CONF) \
|
AVRDUDE_FLAGS = -D -C$(AVRDUDE_CONF) \
|
||||||
-p$(MCU) -P$(AVRDUDE_PORT) -c$(AVRDUDE_PROGRAMMER) \
|
-p$(PROG_MCU) -P$(AVRDUDE_PORT) -c$(AVRDUDE_PROGRAMMER) \
|
||||||
-b$(UPLOAD_RATE)
|
-b$(UPLOAD_RATE)
|
||||||
|
|
||||||
# Since Marlin 2.0, the source files may be distributed into several
|
# Since Marlin 2.0, the source files may be distributed into several
|
||||||
|
|
@ -851,7 +942,7 @@ extcoff: $(TARGET).elf
|
||||||
|
|
||||||
.elf.eep:
|
.elf.eep:
|
||||||
-$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
|
-$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
|
||||||
--change-section-lma .eeprom=0 -O $(FORMAT) $< $@
|
--change-section-lma .eeprom=0 -O $(FORMAT) $< $@
|
||||||
|
|
||||||
# Create extended listing file from ELF output file.
|
# Create extended listing file from ELF output file.
|
||||||
.elf.lss:
|
.elf.lss:
|
||||||
|
|
@ -865,7 +956,7 @@ extcoff: $(TARGET).elf
|
||||||
|
|
||||||
$(BUILD_DIR)/$(TARGET).elf: $(OBJ) Configuration.h
|
$(BUILD_DIR)/$(TARGET).elf: $(OBJ) Configuration.h
|
||||||
$(Pecho) " CXX $@"
|
$(Pecho) " CXX $@"
|
||||||
$P $(CC) $(LD_PREFIX) $(ALL_CXXFLAGS) -o $@ -L. $(OBJ) $(LDFLAGS) $(LD_SUFFIX)
|
$P $(CXX) $(LD_PREFIX) $(ALL_CXXFLAGS) -o $@ -L. $(OBJ) $(LDFLAGS) $(LD_SUFFIX)
|
||||||
|
|
||||||
# Object files that were found in "src" will be stored in $(BUILD_DIR)
|
# Object files that were found in "src" will be stored in $(BUILD_DIR)
|
||||||
# in directories that mirror the structure of "src"
|
# in directories that mirror the structure of "src"
|
||||||
|
|
|
||||||
|
|
@ -120,6 +120,8 @@ void HAL_init();
|
||||||
inline void HAL_clear_reset_source() { MCUSR = 0; }
|
inline void HAL_clear_reset_source() { MCUSR = 0; }
|
||||||
inline uint8_t HAL_get_reset_source() { return MCUSR; }
|
inline uint8_t HAL_get_reset_source() { return MCUSR; }
|
||||||
|
|
||||||
|
inline void HAL_reboot() {} // reboot the board or restart the bootloader
|
||||||
|
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#pragma GCC diagnostic ignored "-Wunused-function"
|
#pragma GCC diagnostic ignored "-Wunused-function"
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||||
do {
|
do {
|
||||||
uint8_t c = eeprom_read_byte((uint8_t*)pos);
|
uint8_t c = eeprom_read_byte((uint8_t*)pos);
|
||||||
if (writing) *value = c;
|
if (writing) *value = c;
|
||||||
|
|
|
||||||
|
|
@ -185,8 +185,8 @@ void set_pwm_frequency(const pin_t pin, int f_desired) {
|
||||||
res_temp_phase_correct = rtf / 2;
|
res_temp_phase_correct = rtf / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
LIMIT(res_temp_fast, 1u, size);
|
LIMIT(res_temp_fast, 1U, size);
|
||||||
LIMIT(res_temp_phase_correct, 1u, size);
|
LIMIT(res_temp_phase_correct, 1U, size);
|
||||||
// Calculate frequencies of test prescaler and resolution values
|
// Calculate frequencies of test prescaler and resolution values
|
||||||
const int f_temp_fast = (F_CPU) / (prescaler[i] * (1 + res_temp_fast)),
|
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_temp_phase_correct = (F_CPU) / (2 * prescaler[i] * res_temp_phase_correct),
|
||||||
|
|
|
||||||
|
|
@ -19,9 +19,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Description: HAL for Arduino Due and compatible (SAM3X8E)
|
* HAL for Arduino Due and compatible (SAM3X8E)
|
||||||
*
|
|
||||||
* For ARDUINO_ARCH_SAM
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef ARDUINO_ARCH_SAM
|
#ifdef ARDUINO_ARCH_SAM
|
||||||
|
|
|
||||||
|
|
@ -22,9 +22,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Description: HAL for Arduino Due and compatible (SAM3X8E)
|
* HAL for Arduino Due and compatible (SAM3X8E)
|
||||||
*
|
|
||||||
* For ARDUINO_ARCH_SAM
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define CPU_32_BIT
|
#define CPU_32_BIT
|
||||||
|
|
@ -107,13 +105,15 @@ void sei(); // Enable interrupts
|
||||||
void HAL_clear_reset_source(); // clear reset reason
|
void HAL_clear_reset_source(); // clear reset reason
|
||||||
uint8_t HAL_get_reset_source(); // get reset reason
|
uint8_t HAL_get_reset_source(); // get reset reason
|
||||||
|
|
||||||
|
inline void HAL_reboot() {} // reboot the board or restart the bootloader
|
||||||
|
|
||||||
//
|
//
|
||||||
// ADC
|
// ADC
|
||||||
//
|
//
|
||||||
extern uint16_t HAL_adc_result; // result of last ADC conversion
|
extern uint16_t HAL_adc_result; // result of last ADC conversion
|
||||||
|
|
||||||
#ifndef analogInputToDigitalPin
|
#ifndef analogInputToDigitalPin
|
||||||
#define analogInputToDigitalPin(p) ((p < 12u) ? (p) + 54u : -1)
|
#define analogInputToDigitalPin(p) ((p < 12U) ? (p) + 54U : -1)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define HAL_ANALOG_SELECT(ch)
|
#define HAL_ANALOG_SELECT(ch)
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Description: HAL for Arduino Due and compatible (SAM3X8E)
|
* HAL for Arduino Due and compatible (SAM3X8E)
|
||||||
*
|
*
|
||||||
* For ARDUINO_ARCH_SAM
|
* For ARDUINO_ARCH_SAM
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -145,7 +145,7 @@ uint8_t u8g_com_HAL_DUE_ST7920_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_va
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLED(LIGHTWEIGHT_UI)
|
#if ENABLED(LIGHTWEIGHT_UI)
|
||||||
#include "../../../lcd/ultralcd.h"
|
#include "../../../lcd/marlinui.h"
|
||||||
#include "../../shared/HAL_ST7920.h"
|
#include "../../shared/HAL_ST7920.h"
|
||||||
|
|
||||||
#define ST7920_CS_PIN LCD_PINS_RS
|
#define ST7920_CS_PIN LCD_PINS_RS
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@
|
||||||
#define EEPROMSize 4096
|
#define EEPROMSize 4096
|
||||||
#define PagesPerGroup 128
|
#define PagesPerGroup 128
|
||||||
#define GroupCount 2
|
#define GroupCount 2
|
||||||
#define PageSize 256u
|
#define PageSize 256U
|
||||||
|
|
||||||
/* Flash storage */
|
/* Flash storage */
|
||||||
typedef struct FLASH_SECTOR {
|
typedef struct FLASH_SECTOR {
|
||||||
|
|
@ -996,7 +996,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||||
do {
|
do {
|
||||||
uint8_t c = ee_Read(uint32_t(pos));
|
uint8_t c = ee_Read(uint32_t(pos));
|
||||||
if (writing) *value = c;
|
if (writing) *value = c;
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||||
do {
|
do {
|
||||||
uint8_t c = eeprom_read_byte((uint8_t*)pos);
|
uint8_t c = eeprom_read_byte((uint8_t*)pos);
|
||||||
if (writing) *value = c;
|
if (writing) *value = c;
|
||||||
|
|
|
||||||
|
|
@ -163,6 +163,9 @@
|
||||||
#define SET_INPUT(IO) _SET_INPUT(IO)
|
#define SET_INPUT(IO) _SET_INPUT(IO)
|
||||||
// Set pin as input with pullup (wrapper)
|
// Set pin as input with pullup (wrapper)
|
||||||
#define SET_INPUT_PULLUP(IO) do{ _SET_INPUT(IO); _PULLUP(IO, HIGH); }while(0)
|
#define SET_INPUT_PULLUP(IO) do{ _SET_INPUT(IO); _PULLUP(IO, HIGH); }while(0)
|
||||||
|
// Set pin as input with pulldown (substitution)
|
||||||
|
#define SET_INPUT_PULLDOWN SET_INPUT
|
||||||
|
|
||||||
// Set pin as output (wrapper) - reads the pin and sets the output to that value
|
// Set pin as output (wrapper) - reads the pin and sets the output to that value
|
||||||
#define SET_OUTPUT(IO) _SET_OUTPUT(IO)
|
#define SET_OUTPUT(IO) _SET_OUTPUT(IO)
|
||||||
// Set pin as PWM
|
// Set pin as PWM
|
||||||
|
|
@ -477,7 +480,7 @@
|
||||||
#define DIO91_PIN 15
|
#define DIO91_PIN 15
|
||||||
#define DIO91_WPORT PIOB
|
#define DIO91_WPORT PIOB
|
||||||
|
|
||||||
#if ARDUINO_SAM_ARCHIM
|
#ifdef ARDUINO_SAM_ARCHIM
|
||||||
|
|
||||||
#define DIO92_PIN 11
|
#define DIO92_PIN 11
|
||||||
#define DIO92_WPORT PIOC
|
#define DIO92_WPORT PIOC
|
||||||
|
|
|
||||||
|
|
@ -154,7 +154,7 @@ void Stepper::digipot_init() {
|
||||||
NVIC_SetPriority(PWM_IRQn, NVIC_EncodePriority(0, 10, 0)); // normal priority for PWM module (can stand some jitter on the Vref signals)
|
NVIC_SetPriority(PWM_IRQn, NVIC_EncodePriority(0, 10, 0)); // normal priority for PWM module (can stand some jitter on the Vref signals)
|
||||||
}
|
}
|
||||||
|
|
||||||
void Stepper::digipot_current(const uint8_t driver, const int16_t current) {
|
void Stepper::set_digipot_current(const uint8_t driver, const int16_t current) {
|
||||||
|
|
||||||
if (!(PWM->PWM_CH_NUM[0].PWM_CPRD == PWM_PERIOD_US)) digipot_init(); // Init PWM system if needed
|
if (!(PWM->PWM_CH_NUM[0].PWM_CPRD == PWM_PERIOD_US)) digipot_init(); // Init PWM system if needed
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,9 +21,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Description: HAL for Arduino Due and compatible (SAM3X8E)
|
* HAL Timers for Arduino Due and compatible (SAM3X8E)
|
||||||
*
|
|
||||||
* For ARDUINO_ARCH_SAM
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef ARDUINO_ARCH_SAM
|
#ifdef ARDUINO_ARCH_SAM
|
||||||
|
|
|
||||||
|
|
@ -21,9 +21,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* HAL for Arduino Due and compatible (SAM3X8E)
|
* HAL Timers for Arduino Due and compatible (SAM3X8E)
|
||||||
*
|
|
||||||
* For ARDUINO_ARCH_SAM
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
|
||||||
|
|
@ -14,5 +14,5 @@ if current_OS == 'Windows':
|
||||||
|
|
||||||
# Use bossac.exe on Windows
|
# Use bossac.exe on Windows
|
||||||
env.Replace(
|
env.Replace(
|
||||||
UPLOADCMD="bossac --info --unlock --write --verify --reset --erase -U false --boot"
|
UPLOADCMD="bossac --info --unlock --write --verify --reset --erase -U false --boot $SOURCE"
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -609,37 +609,37 @@ typedef struct
|
||||||
# define clz(u) ((u) ? __CLZ(u) : 32)
|
# define clz(u) ((u) ? __CLZ(u) : 32)
|
||||||
#else
|
#else
|
||||||
# define clz(u) (((u) == 0) ? 32 : \
|
# define clz(u) (((u) == 0) ? 32 : \
|
||||||
((u) & (1ul << 31)) ? 0 : \
|
((u) & (1UL << 31)) ? 0 : \
|
||||||
((u) & (1ul << 30)) ? 1 : \
|
((u) & (1UL << 30)) ? 1 : \
|
||||||
((u) & (1ul << 29)) ? 2 : \
|
((u) & (1UL << 29)) ? 2 : \
|
||||||
((u) & (1ul << 28)) ? 3 : \
|
((u) & (1UL << 28)) ? 3 : \
|
||||||
((u) & (1ul << 27)) ? 4 : \
|
((u) & (1UL << 27)) ? 4 : \
|
||||||
((u) & (1ul << 26)) ? 5 : \
|
((u) & (1UL << 26)) ? 5 : \
|
||||||
((u) & (1ul << 25)) ? 6 : \
|
((u) & (1UL << 25)) ? 6 : \
|
||||||
((u) & (1ul << 24)) ? 7 : \
|
((u) & (1UL << 24)) ? 7 : \
|
||||||
((u) & (1ul << 23)) ? 8 : \
|
((u) & (1UL << 23)) ? 8 : \
|
||||||
((u) & (1ul << 22)) ? 9 : \
|
((u) & (1UL << 22)) ? 9 : \
|
||||||
((u) & (1ul << 21)) ? 10 : \
|
((u) & (1UL << 21)) ? 10 : \
|
||||||
((u) & (1ul << 20)) ? 11 : \
|
((u) & (1UL << 20)) ? 11 : \
|
||||||
((u) & (1ul << 19)) ? 12 : \
|
((u) & (1UL << 19)) ? 12 : \
|
||||||
((u) & (1ul << 18)) ? 13 : \
|
((u) & (1UL << 18)) ? 13 : \
|
||||||
((u) & (1ul << 17)) ? 14 : \
|
((u) & (1UL << 17)) ? 14 : \
|
||||||
((u) & (1ul << 16)) ? 15 : \
|
((u) & (1UL << 16)) ? 15 : \
|
||||||
((u) & (1ul << 15)) ? 16 : \
|
((u) & (1UL << 15)) ? 16 : \
|
||||||
((u) & (1ul << 14)) ? 17 : \
|
((u) & (1UL << 14)) ? 17 : \
|
||||||
((u) & (1ul << 13)) ? 18 : \
|
((u) & (1UL << 13)) ? 18 : \
|
||||||
((u) & (1ul << 12)) ? 19 : \
|
((u) & (1UL << 12)) ? 19 : \
|
||||||
((u) & (1ul << 11)) ? 20 : \
|
((u) & (1UL << 11)) ? 20 : \
|
||||||
((u) & (1ul << 10)) ? 21 : \
|
((u) & (1UL << 10)) ? 21 : \
|
||||||
((u) & (1ul << 9)) ? 22 : \
|
((u) & (1UL << 9)) ? 22 : \
|
||||||
((u) & (1ul << 8)) ? 23 : \
|
((u) & (1UL << 8)) ? 23 : \
|
||||||
((u) & (1ul << 7)) ? 24 : \
|
((u) & (1UL << 7)) ? 24 : \
|
||||||
((u) & (1ul << 6)) ? 25 : \
|
((u) & (1UL << 6)) ? 25 : \
|
||||||
((u) & (1ul << 5)) ? 26 : \
|
((u) & (1UL << 5)) ? 26 : \
|
||||||
((u) & (1ul << 4)) ? 27 : \
|
((u) & (1UL << 4)) ? 27 : \
|
||||||
((u) & (1ul << 3)) ? 28 : \
|
((u) & (1UL << 3)) ? 28 : \
|
||||||
((u) & (1ul << 2)) ? 29 : \
|
((u) & (1UL << 2)) ? 29 : \
|
||||||
((u) & (1ul << 1)) ? 30 : \
|
((u) & (1UL << 1)) ? 30 : \
|
||||||
31)
|
31)
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -654,38 +654,38 @@ typedef struct
|
||||||
#if (defined __GNUC__) || (defined __CC_ARM)
|
#if (defined __GNUC__) || (defined __CC_ARM)
|
||||||
# define ctz(u) ((u) ? __builtin_ctz(u) : 32)
|
# define ctz(u) ((u) ? __builtin_ctz(u) : 32)
|
||||||
#else
|
#else
|
||||||
# define ctz(u) ((u) & (1ul << 0) ? 0 : \
|
# define ctz(u) ((u) & (1UL << 0) ? 0 : \
|
||||||
(u) & (1ul << 1) ? 1 : \
|
(u) & (1UL << 1) ? 1 : \
|
||||||
(u) & (1ul << 2) ? 2 : \
|
(u) & (1UL << 2) ? 2 : \
|
||||||
(u) & (1ul << 3) ? 3 : \
|
(u) & (1UL << 3) ? 3 : \
|
||||||
(u) & (1ul << 4) ? 4 : \
|
(u) & (1UL << 4) ? 4 : \
|
||||||
(u) & (1ul << 5) ? 5 : \
|
(u) & (1UL << 5) ? 5 : \
|
||||||
(u) & (1ul << 6) ? 6 : \
|
(u) & (1UL << 6) ? 6 : \
|
||||||
(u) & (1ul << 7) ? 7 : \
|
(u) & (1UL << 7) ? 7 : \
|
||||||
(u) & (1ul << 8) ? 8 : \
|
(u) & (1UL << 8) ? 8 : \
|
||||||
(u) & (1ul << 9) ? 9 : \
|
(u) & (1UL << 9) ? 9 : \
|
||||||
(u) & (1ul << 10) ? 10 : \
|
(u) & (1UL << 10) ? 10 : \
|
||||||
(u) & (1ul << 11) ? 11 : \
|
(u) & (1UL << 11) ? 11 : \
|
||||||
(u) & (1ul << 12) ? 12 : \
|
(u) & (1UL << 12) ? 12 : \
|
||||||
(u) & (1ul << 13) ? 13 : \
|
(u) & (1UL << 13) ? 13 : \
|
||||||
(u) & (1ul << 14) ? 14 : \
|
(u) & (1UL << 14) ? 14 : \
|
||||||
(u) & (1ul << 15) ? 15 : \
|
(u) & (1UL << 15) ? 15 : \
|
||||||
(u) & (1ul << 16) ? 16 : \
|
(u) & (1UL << 16) ? 16 : \
|
||||||
(u) & (1ul << 17) ? 17 : \
|
(u) & (1UL << 17) ? 17 : \
|
||||||
(u) & (1ul << 18) ? 18 : \
|
(u) & (1UL << 18) ? 18 : \
|
||||||
(u) & (1ul << 19) ? 19 : \
|
(u) & (1UL << 19) ? 19 : \
|
||||||
(u) & (1ul << 20) ? 20 : \
|
(u) & (1UL << 20) ? 20 : \
|
||||||
(u) & (1ul << 21) ? 21 : \
|
(u) & (1UL << 21) ? 21 : \
|
||||||
(u) & (1ul << 22) ? 22 : \
|
(u) & (1UL << 22) ? 22 : \
|
||||||
(u) & (1ul << 23) ? 23 : \
|
(u) & (1UL << 23) ? 23 : \
|
||||||
(u) & (1ul << 24) ? 24 : \
|
(u) & (1UL << 24) ? 24 : \
|
||||||
(u) & (1ul << 25) ? 25 : \
|
(u) & (1UL << 25) ? 25 : \
|
||||||
(u) & (1ul << 26) ? 26 : \
|
(u) & (1UL << 26) ? 26 : \
|
||||||
(u) & (1ul << 27) ? 27 : \
|
(u) & (1UL << 27) ? 27 : \
|
||||||
(u) & (1ul << 28) ? 28 : \
|
(u) & (1UL << 28) ? 28 : \
|
||||||
(u) & (1ul << 29) ? 29 : \
|
(u) & (1UL << 29) ? 29 : \
|
||||||
(u) & (1ul << 30) ? 30 : \
|
(u) & (1UL << 30) ? 30 : \
|
||||||
(u) & (1ul << 31) ? 31 : \
|
(u) & (1UL << 31) ? 31 : \
|
||||||
32)
|
32)
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,7 @@ Ctrl_status sd_mmc_spi_usb_read_10(uint32_t addr, uint16_t nb_sector) {
|
||||||
card.getSd2Card().readData(sector_buf);
|
card.getSd2Card().readData(sector_buf);
|
||||||
|
|
||||||
// RAM -> USB
|
// RAM -> USB
|
||||||
if (!udi_msc_trans_block(true, sector_buf, SD_MMC_BLOCK_SIZE, NULL)) {
|
if (!udi_msc_trans_block(true, sector_buf, SD_MMC_BLOCK_SIZE, nullptr)) {
|
||||||
card.getSd2Card().readStop();
|
card.getSd2Card().readStop();
|
||||||
return CTRL_FAIL;
|
return CTRL_FAIL;
|
||||||
}
|
}
|
||||||
|
|
@ -120,7 +120,7 @@ Ctrl_status sd_mmc_spi_usb_write_10(uint32_t addr, uint16_t nb_sector) {
|
||||||
while (nb_sector--) {
|
while (nb_sector--) {
|
||||||
|
|
||||||
// USB -> RAM
|
// USB -> RAM
|
||||||
if (!udi_msc_trans_block(false, sector_buf, SD_MMC_BLOCK_SIZE, NULL)) {
|
if (!udi_msc_trans_block(false, sector_buf, SD_MMC_BLOCK_SIZE, nullptr)) {
|
||||||
card.getSd2Card().writeStop();
|
card.getSd2Card().writeStop();
|
||||||
return CTRL_FAIL;
|
return CTRL_FAIL;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ void watchdogSetup() {
|
||||||
#if ENABLED(USE_WATCHDOG)
|
#if ENABLED(USE_WATCHDOG)
|
||||||
|
|
||||||
// 4 seconds timeout
|
// 4 seconds timeout
|
||||||
uint32_t timeout = 4000;
|
uint32_t timeout = TERN(WATCHDOG_DURATION_8S, 8000, 4000);
|
||||||
|
|
||||||
// Calculate timeout value in WDT counter ticks: This assumes
|
// Calculate timeout value in WDT counter ticks: This assumes
|
||||||
// the slow clock is running at 32.768 kHz watchdog
|
// the slow clock is running at 32.768 kHz watchdog
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ volatile int numPWMUsed = 0,
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void HAL_init() { i2s_init(); }
|
void HAL_init() { TERN_(I2S_STEPPER_STREAM, i2s_init()); }
|
||||||
|
|
||||||
void HAL_init_board() {
|
void HAL_init_board() {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Description: HAL for Espressif ESP32 WiFi
|
* HAL for Espressif ESP32 WiFi
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define CPU_32_BIT
|
#define CPU_32_BIT
|
||||||
|
|
@ -96,6 +96,8 @@ void HAL_clear_reset_source();
|
||||||
// reset reason
|
// reset reason
|
||||||
uint8_t HAL_get_reset_source();
|
uint8_t HAL_get_reset_source();
|
||||||
|
|
||||||
|
inline void HAL_reboot() {} // reboot the board or restart the bootloader
|
||||||
|
|
||||||
void _delay_ms(int delay);
|
void _delay_ms(int delay);
|
||||||
|
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
|
|
@ -155,14 +157,14 @@ FORCE_INLINE static void DELAY_CYCLES(uint32_t x) {
|
||||||
|
|
||||||
if (stop >= start) {
|
if (stop >= start) {
|
||||||
// no overflow, so only loop while in between start and stop:
|
// no overflow, so only loop while in between start and stop:
|
||||||
// 0x00000000 -----------------start****stop-- 0xffffffff
|
// 0x00000000 -----------------start****stop-- 0xFFFFFFFF
|
||||||
while (ccount >= start && ccount < stop) {
|
while (ccount >= start && ccount < stop) {
|
||||||
__asm__ __volatile__ ( "rsr %0, ccount" : "=a" (ccount) );
|
__asm__ __volatile__ ( "rsr %0, ccount" : "=a" (ccount) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// stop did overflow, so only loop while outside of stop and start:
|
// stop did overflow, so only loop while outside of stop and start:
|
||||||
// 0x00000000 **stop-------------------start** 0xffffffff
|
// 0x00000000 **stop-------------------start** 0xFFFFFFFF
|
||||||
while (ccount >= start || ccount < stop) {
|
while (ccount >= start || ccount < stop) {
|
||||||
__asm__ __volatile__ ( "rsr %0, ccount" : "=a" (ccount) );
|
__asm__ __volatile__ ( "rsr %0, ccount" : "=a" (ccount) );
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||||
for (size_t i = 0; i < size; i++) {
|
for (size_t i = 0; i < size; i++) {
|
||||||
uint8_t c = EEPROM.read(pos++);
|
uint8_t c = EEPROM.read(pos++);
|
||||||
if (writing) value[i] = c;
|
if (writing) value[i] = c;
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,9 @@
|
||||||
// Set pin as input with pullup wrapper
|
// Set pin as input with pullup wrapper
|
||||||
#define SET_INPUT_PULLUP(IO) do{ _SET_INPUT(IO); _PULLUP(IO, HIGH); }while(0)
|
#define SET_INPUT_PULLUP(IO) do{ _SET_INPUT(IO); _PULLUP(IO, HIGH); }while(0)
|
||||||
|
|
||||||
|
// Set pin as input with pulldown (substitution)
|
||||||
|
#define SET_INPUT_PULLDOWN SET_INPUT
|
||||||
|
|
||||||
// Set pin as output wrapper
|
// Set pin as output wrapper
|
||||||
#define SET_OUTPUT(IO) do{ _SET_OUTPUT(IO); }while(0)
|
#define SET_OUTPUT(IO) do{ _SET_OUTPUT(IO); }while(0)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -184,7 +184,7 @@ int i2s_init() {
|
||||||
|
|
||||||
// Allocate the array of pointers to the buffers
|
// Allocate the array of pointers to the buffers
|
||||||
dma.buffers = (uint32_t **)malloc(sizeof(uint32_t*) * DMA_BUF_COUNT);
|
dma.buffers = (uint32_t **)malloc(sizeof(uint32_t*) * DMA_BUF_COUNT);
|
||||||
if (dma.buffers == nullptr) return -1;
|
if (!dma.buffers) return -1;
|
||||||
|
|
||||||
// Allocate each buffer that can be used by the DMA controller
|
// Allocate each buffer that can be used by the DMA controller
|
||||||
for (int buf_idx = 0; buf_idx < DMA_BUF_COUNT; buf_idx++) {
|
for (int buf_idx = 0; buf_idx < DMA_BUF_COUNT; buf_idx++) {
|
||||||
|
|
@ -194,7 +194,7 @@ int i2s_init() {
|
||||||
|
|
||||||
// Allocate the array of DMA descriptors
|
// Allocate the array of DMA descriptors
|
||||||
dma.desc = (lldesc_t**) malloc(sizeof(lldesc_t*) * DMA_BUF_COUNT);
|
dma.desc = (lldesc_t**) malloc(sizeof(lldesc_t*) * DMA_BUF_COUNT);
|
||||||
if (dma.desc == nullptr) return -1;
|
if (!dma.desc) return -1;
|
||||||
|
|
||||||
// Allocate each DMA descriptor that will be used by the DMA controller
|
// Allocate each DMA descriptor that will be used by the DMA controller
|
||||||
for (int buf_idx = 0; buf_idx < DMA_BUF_COUNT; buf_idx++) {
|
for (int buf_idx = 0; buf_idx < DMA_BUF_COUNT; buf_idx++) {
|
||||||
|
|
|
||||||
|
|
@ -24,15 +24,9 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <driver/timer.h>
|
#include <driver/timer.h>
|
||||||
|
|
||||||
// Includes needed to get I2S_STEPPER_STREAM. Note that pins.h
|
|
||||||
// is included in case this header is being included early.
|
|
||||||
#include "../../inc/MarlinConfig.h"
|
|
||||||
#include "../../pins/pins.h"
|
|
||||||
|
|
||||||
// ------------------------
|
// ------------------------
|
||||||
// Defines
|
// Defines
|
||||||
// ------------------------
|
// ------------------------
|
||||||
//
|
|
||||||
#define FORCE_INLINE __attribute__((always_inline)) inline
|
#define FORCE_INLINE __attribute__((always_inline)) inline
|
||||||
|
|
||||||
typedef uint64_t hal_timer_t;
|
typedef uint64_t hal_timer_t;
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,8 @@
|
||||||
|
|
||||||
#if ENABLED(USE_WATCHDOG)
|
#if ENABLED(USE_WATCHDOG)
|
||||||
|
|
||||||
|
#define WDT_TIMEOUT_US TERN(WATCHDOG_DURATION_8S, 8000000, 4000000) // 4 or 8 second timeout
|
||||||
|
|
||||||
#include "watchdog.h"
|
#include "watchdog.h"
|
||||||
|
|
||||||
void watchdogSetup() {
|
void watchdogSetup() {
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@
|
||||||
#define HAL_ADC_RANGE _BV(HAL_ADC_RESOLUTION)
|
#define HAL_ADC_RANGE _BV(HAL_ADC_RESOLUTION)
|
||||||
|
|
||||||
#ifndef I2C_ADDRESS
|
#ifndef I2C_ADDRESS
|
||||||
#define I2C_ADDRESS(A) (A)
|
#define I2C_ADDRESS(A) uint8_t(A)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Needed for AVR sprintf_P PROGMEM extension
|
// Needed for AVR sprintf_P PROGMEM extension
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
#define CPU_32_BIT
|
#define CPU_32_BIT
|
||||||
|
|
||||||
#define F_CPU 100000000
|
#define F_CPU 100000000UL
|
||||||
#define SystemCoreClock F_CPU
|
#define SystemCoreClock F_CPU
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
@ -101,6 +101,8 @@ uint16_t HAL_adc_get_result();
|
||||||
inline void HAL_clear_reset_source(void) {}
|
inline void HAL_clear_reset_source(void) {}
|
||||||
inline uint8_t HAL_get_reset_source(void) { return RST_POWER_ON; }
|
inline uint8_t HAL_get_reset_source(void) { return RST_POWER_ON; }
|
||||||
|
|
||||||
|
inline void HAL_reboot() {} // reboot the board or restart the bootloader
|
||||||
|
|
||||||
/* ---------------- Delay in cycles */
|
/* ---------------- Delay in cycles */
|
||||||
FORCE_INLINE static void DELAY_CYCLES(uint64_t x) {
|
FORCE_INLINE static void DELAY_CYCLES(uint64_t x) {
|
||||||
Clock::delayCycles(x);
|
Clock::delayCycles(x);
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE; }
|
||||||
bool PersistentStore::access_start() {
|
bool PersistentStore::access_start() {
|
||||||
const char eeprom_erase_value = 0xFF;
|
const char eeprom_erase_value = 0xFF;
|
||||||
FILE * eeprom_file = fopen(filename, "rb");
|
FILE * eeprom_file = fopen(filename, "rb");
|
||||||
if (eeprom_file == nullptr) return false;
|
if (!eeprom_file) return false;
|
||||||
|
|
||||||
fseek(eeprom_file, 0L, SEEK_END);
|
fseek(eeprom_file, 0L, SEEK_END);
|
||||||
std::size_t file_size = ftell(eeprom_file);
|
std::size_t file_size = ftell(eeprom_file);
|
||||||
|
|
@ -59,7 +59,7 @@ bool PersistentStore::access_start() {
|
||||||
|
|
||||||
bool PersistentStore::access_finish() {
|
bool PersistentStore::access_finish() {
|
||||||
FILE * eeprom_file = fopen(filename, "wb");
|
FILE * eeprom_file = fopen(filename, "wb");
|
||||||
if (eeprom_file == nullptr) return false;
|
if (!eeprom_file) return false;
|
||||||
fwrite(buffer, sizeof(uint8_t), sizeof(buffer), eeprom_file);
|
fwrite(buffer, sizeof(uint8_t), sizeof(buffer), eeprom_file);
|
||||||
fclose(eeprom_file);
|
fclose(eeprom_file);
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -78,7 +78,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
|
||||||
return (bytes_written != size); // return true for any error
|
return (bytes_written != size); // return true for any error
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PersistentStore::read_data(int &pos, uint8_t* value, const size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
bool PersistentStore::read_data(int &pos, uint8_t *value, const size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||||
std::size_t bytes_read = 0;
|
std::size_t bytes_read = 0;
|
||||||
if (writing) {
|
if (writing) {
|
||||||
for (std::size_t i = 0; i < size; i++) {
|
for (std::size_t i = 0; i < size; i++) {
|
||||||
|
|
|
||||||
|
|
@ -86,10 +86,10 @@ public:
|
||||||
GpioEvent::Type evt_type = value > 1 ? GpioEvent::SET_VALUE : value > pin_map[pin].value ? GpioEvent::RISE : value < pin_map[pin].value ? GpioEvent::FALL : GpioEvent::NOP;
|
GpioEvent::Type evt_type = value > 1 ? GpioEvent::SET_VALUE : value > pin_map[pin].value ? GpioEvent::RISE : value < pin_map[pin].value ? GpioEvent::FALL : GpioEvent::NOP;
|
||||||
pin_map[pin].value = value;
|
pin_map[pin].value = value;
|
||||||
GpioEvent evt(Clock::nanos(), pin, evt_type);
|
GpioEvent evt(Clock::nanos(), pin, evt_type);
|
||||||
if (pin_map[pin].cb != nullptr) {
|
if (pin_map[pin].cb) {
|
||||||
pin_map[pin].cb->interrupt(evt);
|
pin_map[pin].cb->interrupt(evt);
|
||||||
}
|
}
|
||||||
if (Gpio::logger != nullptr) Gpio::logger->log(evt);
|
if (Gpio::logger) Gpio::logger->log(evt);
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint16_t get(pin_type pin) {
|
static uint16_t get(pin_type pin) {
|
||||||
|
|
@ -105,8 +105,8 @@ public:
|
||||||
if (!valid_pin(pin)) return;
|
if (!valid_pin(pin)) return;
|
||||||
pin_map[pin].mode = value;
|
pin_map[pin].mode = value;
|
||||||
GpioEvent evt(Clock::nanos(), pin, GpioEvent::Type::SETM);
|
GpioEvent evt(Clock::nanos(), pin, GpioEvent::Type::SETM);
|
||||||
if (pin_map[pin].cb != nullptr) pin_map[pin].cb->interrupt(evt);
|
if (pin_map[pin].cb) pin_map[pin].cb->interrupt(evt);
|
||||||
if (Gpio::logger != nullptr) Gpio::logger->log(evt);
|
if (Gpio::logger) Gpio::logger->log(evt);
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint8_t getMode(pin_type pin) {
|
static uint8_t getMode(pin_type pin) {
|
||||||
|
|
@ -118,8 +118,8 @@ public:
|
||||||
if (!valid_pin(pin)) return;
|
if (!valid_pin(pin)) return;
|
||||||
pin_map[pin].dir = value;
|
pin_map[pin].dir = value;
|
||||||
GpioEvent evt(Clock::nanos(), pin, GpioEvent::Type::SETD);
|
GpioEvent evt(Clock::nanos(), pin, GpioEvent::Type::SETD);
|
||||||
if (pin_map[pin].cb != nullptr) pin_map[pin].cb->interrupt(evt);
|
if (pin_map[pin].cb) pin_map[pin].cb->interrupt(evt);
|
||||||
if (Gpio::logger != nullptr) Gpio::logger->log(evt);
|
if (Gpio::logger) Gpio::logger->log(evt);
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint8_t getDir(pin_type pin) {
|
static uint8_t getDir(pin_type pin) {
|
||||||
|
|
|
||||||
|
|
@ -19,22 +19,23 @@
|
||||||
*/
|
*/
|
||||||
#ifdef __PLAT_LINUX__
|
#ifdef __PLAT_LINUX__
|
||||||
|
|
||||||
extern void setup();
|
//#define GPIO_LOGGING // Full GPIO and Positional Logging
|
||||||
extern void loop();
|
|
||||||
|
|
||||||
#include <thread>
|
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#include <fstream>
|
|
||||||
|
|
||||||
#include "../../inc/MarlinConfig.h"
|
#include "../../inc/MarlinConfig.h"
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdarg.h>
|
|
||||||
#include "../shared/Delay.h"
|
#include "../shared/Delay.h"
|
||||||
#include "hardware/IOLoggerCSV.h"
|
#include "hardware/IOLoggerCSV.h"
|
||||||
#include "hardware/Heater.h"
|
#include "hardware/Heater.h"
|
||||||
#include "hardware/LinearAxis.h"
|
#include "hardware/LinearAxis.h"
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <thread>
|
||||||
|
#include <iostream>
|
||||||
|
#include <fstream>
|
||||||
|
|
||||||
|
extern void setup();
|
||||||
|
extern void loop();
|
||||||
|
|
||||||
// simple stdout / stdin implementation for fake serial port
|
// simple stdout / stdin implementation for fake serial port
|
||||||
void write_serial_thread() {
|
void write_serial_thread() {
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
|
@ -64,8 +65,6 @@ void simulation_loop() {
|
||||||
LinearAxis z_axis(Z_ENABLE_PIN, Z_DIR_PIN, Z_STEP_PIN, Z_MIN_PIN, Z_MAX_PIN);
|
LinearAxis z_axis(Z_ENABLE_PIN, Z_DIR_PIN, Z_STEP_PIN, Z_MIN_PIN, Z_MAX_PIN);
|
||||||
LinearAxis extruder0(E0_ENABLE_PIN, E0_DIR_PIN, E0_STEP_PIN, P_NC, P_NC);
|
LinearAxis extruder0(E0_ENABLE_PIN, E0_DIR_PIN, E0_STEP_PIN, P_NC, P_NC);
|
||||||
|
|
||||||
//#define GPIO_LOGGING // Full GPIO and Positional Logging
|
|
||||||
|
|
||||||
#ifdef GPIO_LOGGING
|
#ifdef GPIO_LOGGING
|
||||||
IOLoggerCSV logger("all_gpio_log.csv");
|
IOLoggerCSV logger("all_gpio_log.csv");
|
||||||
Gpio::attachLogger(&logger);
|
Gpio::attachLogger(&logger);
|
||||||
|
|
@ -88,7 +87,7 @@ void simulation_loop() {
|
||||||
|
|
||||||
#ifdef GPIO_LOGGING
|
#ifdef GPIO_LOGGING
|
||||||
if (x_axis.position != x || y_axis.position != y || z_axis.position != z) {
|
if (x_axis.position != x || y_axis.position != y || z_axis.position != z) {
|
||||||
uint64_t update = MAX3(x_axis.last_update, y_axis.last_update, z_axis.last_update);
|
uint64_t update = _MAX(x_axis.last_update, y_axis.last_update, z_axis.last_update);
|
||||||
position_log << update << ", " << x_axis.position << ", " << y_axis.position << ", " << z_axis.position << std::endl;
|
position_log << update << ", " << x_axis.position << ", " << y_axis.position << ", " << z_axis.position << std::endl;
|
||||||
position_log.flush();
|
position_log.flush();
|
||||||
x = x_axis.position;
|
x = x_axis.position;
|
||||||
|
|
|
||||||
|
|
@ -26,15 +26,15 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define NUMBER_PINS_TOTAL NUM_DIGITAL_PINS
|
#define NUMBER_PINS_TOTAL NUM_DIGITAL_PINS
|
||||||
#define pwm_details(pin) pin = pin // do nothing // print PWM details
|
#define pwm_details(pin) NOOP // (do nothing)
|
||||||
#define pwm_status(pin) false //Print a pin's PWM status. Return true if it's currently a PWM pin.
|
#define pwm_status(pin) false // Print a pin's PWM status. Return true if it's currently a PWM pin.
|
||||||
#define IS_ANALOG(P) (DIGITAL_PIN_TO_ANALOG_PIN(P) >= 0 ? 1 : 0)
|
#define IS_ANALOG(P) (DIGITAL_PIN_TO_ANALOG_PIN(P) >= 0 ? 1 : 0)
|
||||||
#define digitalRead_mod(p) digitalRead(p)
|
#define digitalRead_mod(p) digitalRead(p)
|
||||||
#define PRINT_PORT(p)
|
#define PRINT_PORT(p)
|
||||||
#define GET_ARRAY_PIN(p) pin_array[p].pin
|
#define GET_ARRAY_PIN(p) pin_array[p].pin
|
||||||
#define PRINT_ARRAY_NAME(x) do{ sprintf_P(buffer, PSTR("%-" STRINGIFY(MAX_NAME_LENGTH) "s"), pin_array[x].name); SERIAL_ECHO(buffer); }while(0)
|
#define PRINT_ARRAY_NAME(x) do{ sprintf_P(buffer, PSTR("%-" STRINGIFY(MAX_NAME_LENGTH) "s"), pin_array[x].name); SERIAL_ECHO(buffer); }while(0)
|
||||||
#define PRINT_PIN(p) do{ sprintf_P(buffer, PSTR("%3d "), p); SERIAL_ECHO(buffer); }while(0)
|
#define PRINT_PIN(p) do{ sprintf_P(buffer, PSTR("%3d "), p); SERIAL_ECHO(buffer); }while(0)
|
||||||
#define MULTI_NAME_PAD 16 // space needed to be pretty if not first name assigned to a pin
|
#define MULTI_NAME_PAD 16 // space needed to be pretty if not first name assigned to a pin
|
||||||
|
|
||||||
// active ADC function/mode/code values for PINSEL registers
|
// active ADC function/mode/code values for PINSEL registers
|
||||||
constexpr int8_t ADC_pin_mode(pin_t pin) {
|
constexpr int8_t ADC_pin_mode(pin_t pin) {
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,8 @@
|
||||||
|
|
||||||
#include "watchdog.h"
|
#include "watchdog.h"
|
||||||
|
|
||||||
|
#define WDT_TIMEOUT_US TERN(WATCHDOG_DURATION_8S, 8000000, 4000000) // 4 or 8 second timeout
|
||||||
|
|
||||||
void watchdog_init() {}
|
void watchdog_init() {}
|
||||||
void HAL_watchdog_refresh() {}
|
void HAL_watchdog_refresh() {}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,5 @@
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define WDT_TIMEOUT 4000000 // 4 second timeout
|
|
||||||
|
|
||||||
void watchdog_init();
|
void watchdog_init();
|
||||||
void HAL_watchdog_refresh();
|
void HAL_watchdog_refresh();
|
||||||
|
|
|
||||||
|
|
@ -200,6 +200,8 @@ void set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t v_size=255,
|
||||||
void HAL_clear_reset_source(void);
|
void HAL_clear_reset_source(void);
|
||||||
uint8_t HAL_get_reset_source(void);
|
uint8_t HAL_get_reset_source(void);
|
||||||
|
|
||||||
|
inline void HAL_reboot() {} // reboot the board or restart the bootloader
|
||||||
|
|
||||||
// Add strcmp_P if missing
|
// Add strcmp_P if missing
|
||||||
#ifndef strcmp_P
|
#ifndef strcmp_P
|
||||||
#define strcmp_P(a, b) strcmp((a), (b))
|
#define strcmp_P(a, b) strcmp((a), (b))
|
||||||
|
|
|
||||||
|
|
@ -127,11 +127,9 @@
|
||||||
for (uint16_t i = 0; i < nbyte; i++) doio(buf[i]);
|
for (uint16_t i = 0; i < nbyte; i++) doio(buf[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void spiSend(uint32_t chan, byte b) {
|
void spiSend(uint32_t chan, byte b) {}
|
||||||
}
|
|
||||||
|
|
||||||
void spiSend(uint32_t chan, const uint8_t* buf, size_t nbyte) {
|
void spiSend(uint32_t chan, const uint8_t* buf, size_t nbyte) {}
|
||||||
}
|
|
||||||
|
|
||||||
// Read single byte from SPI
|
// Read single byte from SPI
|
||||||
uint8_t spiRec() { return doio(0xFF); }
|
uint8_t spiRec() { return doio(0xFF); }
|
||||||
|
|
@ -143,9 +141,7 @@
|
||||||
for (uint16_t i = 0; i < nbyte; i++) buf[i] = doio(0xFF);
|
for (uint16_t i = 0; i < nbyte; i++) buf[i] = doio(0xFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t spiTransfer(uint8_t b) {
|
uint8_t spiTransfer(uint8_t b) { return doio(b); }
|
||||||
return doio(b);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Write from buffer to SPI
|
// Write from buffer to SPI
|
||||||
void spiSendBlock(uint8_t token, const uint8_t* buf) {
|
void spiSendBlock(uint8_t token, const uint8_t* buf) {
|
||||||
|
|
@ -201,6 +197,15 @@ SPIClass::SPIClass(uint8_t device) {
|
||||||
GPDMA_Init();
|
GPDMA_Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SPIClass::SPIClass(pin_t mosi, pin_t miso, pin_t sclk, pin_t ssel) {
|
||||||
|
#if BOARD_NR_SPI >= 1
|
||||||
|
if (mosi == BOARD_SPI1_MOSI_PIN) SPIClass(1);
|
||||||
|
#endif
|
||||||
|
#if BOARD_NR_SPI >= 2
|
||||||
|
if (mosi == BOARD_SPI2_MOSI_PIN) SPIClass(2);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void SPIClass::begin() {
|
void SPIClass::begin() {
|
||||||
// Init the SPI pins in the first begin call
|
// Init the SPI pins in the first begin call
|
||||||
if ((_currentSetting->spi_d == LPC_SSP0 && spiInitialised[0] == false) ||
|
if ((_currentSetting->spi_d == LPC_SSP0 && spiInitialised[0] == false) ||
|
||||||
|
|
@ -263,8 +268,9 @@ uint16_t SPIClass::transfer16(const uint16_t data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SPIClass::end() {
|
void SPIClass::end() {
|
||||||
// SSP_Cmd(_currentSetting->spi_d, DISABLE); // stop device or SSP_DeInit?
|
// Neither is needed for Marlin
|
||||||
SSP_DeInit(_currentSetting->spi_d);
|
//SSP_Cmd(_currentSetting->spi_d, DISABLE);
|
||||||
|
//SSP_DeInit(_currentSetting->spi_d);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SPIClass::send(uint8_t data) {
|
void SPIClass::send(uint8_t data) {
|
||||||
|
|
@ -330,25 +336,15 @@ void SPIClass::read(uint8_t *buf, uint32_t len) {
|
||||||
for (uint16_t i = 0; i < len; i++) buf[i] = transfer(0xFF);
|
for (uint16_t i = 0; i < len; i++) buf[i] = transfer(0xFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SPIClass::setClock(uint32_t clock) {
|
void SPIClass::setClock(uint32_t clock) { _currentSetting->clock = clock; }
|
||||||
_currentSetting->clock = clock;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SPIClass::setModule(uint8_t device) {
|
void SPIClass::setModule(uint8_t device) { _currentSetting = &_settings[device - 1]; } // SPI channels are called 1, 2, and 3 but the array is zero-indexed
|
||||||
_currentSetting = &_settings[device - 1];// SPI channels are called 1 2 and 3 but the array is zero indexed
|
|
||||||
}
|
|
||||||
|
|
||||||
void SPIClass::setBitOrder(uint8_t bitOrder) {
|
void SPIClass::setBitOrder(uint8_t bitOrder) { _currentSetting->bitOrder = bitOrder; }
|
||||||
_currentSetting->bitOrder = bitOrder;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SPIClass::setDataMode(uint8_t dataMode) {
|
void SPIClass::setDataMode(uint8_t dataMode) { _currentSetting->dataMode = dataMode; }
|
||||||
_currentSetting->dataMode = dataMode;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SPIClass::setDataSize(uint32_t ds) {
|
void SPIClass::setDataSize(uint32_t dataSize) { _currentSetting->dataSize = dataSize; }
|
||||||
_currentSetting->dataSize = ds;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set up/tear down
|
* Set up/tear down
|
||||||
|
|
@ -356,8 +352,8 @@ void SPIClass::setDataSize(uint32_t ds) {
|
||||||
void SPIClass::updateSettings() {
|
void SPIClass::updateSettings() {
|
||||||
//SSP_DeInit(_currentSetting->spi_d); //todo: need force de init?!
|
//SSP_DeInit(_currentSetting->spi_d); //todo: need force de init?!
|
||||||
|
|
||||||
// divide PCLK by 2 for SSP0
|
// Divide PCLK by 2 for SSP0
|
||||||
CLKPWR_SetPCLKDiv(_currentSetting->spi_d == LPC_SSP0 ? CLKPWR_PCLKSEL_SSP0 : CLKPWR_PCLKSEL_SSP1, CLKPWR_PCLKSEL_CCLK_DIV_2);
|
//CLKPWR_SetPCLKDiv(_currentSetting->spi_d == LPC_SSP0 ? CLKPWR_PCLKSEL_SSP0 : CLKPWR_PCLKSEL_SSP1, CLKPWR_PCLKSEL_CCLK_DIV_2);
|
||||||
|
|
||||||
SSP_CFG_Type HW_SPI_init; // data structure to hold init values
|
SSP_CFG_Type HW_SPI_init; // data structure to hold init values
|
||||||
SSP_ConfigStructInit(&HW_SPI_init); // set values for SPI mode
|
SSP_ConfigStructInit(&HW_SPI_init); // set values for SPI mode
|
||||||
|
|
|
||||||
|
|
@ -21,22 +21,25 @@
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#if HOTENDS > 2 || E_STEPPERS > 2
|
#include <SPI.h>
|
||||||
#error "Dagoma3D F5 RAMPS supports only 2 hotends / E-steppers. Comment out this line to continue."
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define BOARD_INFO_NAME "Dagoma3D F5 RAMPS"
|
/**
|
||||||
|
* Marlin currently requires 3 SPI classes:
|
||||||
|
*
|
||||||
|
* SPIClass:
|
||||||
|
* This class is normally provided by frameworks and has a semi-default interface.
|
||||||
|
* This is needed because some libraries reference it globally.
|
||||||
|
*
|
||||||
|
* SPISettings:
|
||||||
|
* Container for SPI configs for SPIClass. As above, libraries may reference it globally.
|
||||||
|
*
|
||||||
|
* These two classes are often provided by frameworks so we cannot extend them to add
|
||||||
|
* useful methods for Marlin.
|
||||||
|
*
|
||||||
|
* MarlinSPI:
|
||||||
|
* Provides the default SPIClass interface plus some Marlin goodies such as a simplified
|
||||||
|
* interface for SPI DMA transfer.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
#define X_STOP_PIN 2
|
using MarlinSPI = SPIClass;
|
||||||
#define Y_STOP_PIN 3
|
|
||||||
#define Z_STOP_PIN 15
|
|
||||||
#define FIL_RUNOUT_PIN 39
|
|
||||||
|
|
||||||
#ifndef E0_AUTO_FAN_PIN
|
|
||||||
#define E0_AUTO_FAN_PIN 7
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//
|
|
||||||
// Import RAMPS 1.4 pins
|
|
||||||
//
|
|
||||||
#include "pins_RAMPS.h"
|
|
||||||
|
|
@ -119,7 +119,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
|
||||||
return false; // return true for any error
|
return false; // return true for any error
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||||
const uint8_t * const buff = writing ? &value[0] : &ram_eeprom[pos];
|
const uint8_t * const buff = writing ? &value[0] : &ram_eeprom[pos];
|
||||||
if (writing) for (size_t i = 0; i < size; i++) value[i] = ram_eeprom[pos + i];
|
if (writing) for (size_t i = 0; i < size; i++) value[i] = ram_eeprom[pos + i];
|
||||||
crc16(crc, buff, size);
|
crc16(crc, buff, size);
|
||||||
|
|
|
||||||
|
|
@ -143,7 +143,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
|
||||||
return bytes_written != size; // return true for any error
|
return bytes_written != size; // return true for any error
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PersistentStore::read_data(int &pos, uint8_t* value, const size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
bool PersistentStore::read_data(int &pos, uint8_t *value, const size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||||
if (!eeprom_file_open) return true;
|
if (!eeprom_file_open) return true;
|
||||||
UINT bytes_read = 0;
|
UINT bytes_read = 0;
|
||||||
FRESULT s;
|
FRESULT s;
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||||
do {
|
do {
|
||||||
// Read from external EEPROM
|
// Read from external EEPROM
|
||||||
const uint8_t c = eeprom_read_byte((uint8_t*)pos);
|
const uint8_t c = eeprom_read_byte((uint8_t*)pos);
|
||||||
|
|
|
||||||
|
|
@ -24,10 +24,3 @@
|
||||||
#if HAS_FSMC_TFT
|
#if HAS_FSMC_TFT
|
||||||
#error "Sorry! FSMC TFT displays are not current available for HAL/LPC1768."
|
#error "Sorry! FSMC TFT displays are not current available for HAL/LPC1768."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// This emulated DOGM has 'touch/xpt2046', not 'tft/xpt2046'
|
|
||||||
#if ENABLED(TOUCH_SCREEN) && !HAS_GRAPHICAL_TFT
|
|
||||||
#undef TOUCH_SCREEN
|
|
||||||
#undef TOUCH_SCREEN_CALIBRATION
|
|
||||||
#define HAS_TOUCH_XPT2046 1
|
|
||||||
#endif
|
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ static_assert(!(NUM_SERVOS && ENABLED(FAST_PWM_FAN)), "BLTOUCH and Servos are in
|
||||||
//#endif
|
//#endif
|
||||||
|
|
||||||
#if MB(RAMPS_14_RE_ARM_EFB, RAMPS_14_RE_ARM_EEB, RAMPS_14_RE_ARM_EFF, RAMPS_14_RE_ARM_EEF, RAMPS_14_RE_ARM_SF)
|
#if MB(RAMPS_14_RE_ARM_EFB, RAMPS_14_RE_ARM_EEB, RAMPS_14_RE_ARM_EFF, RAMPS_14_RE_ARM_EEF, RAMPS_14_RE_ARM_SF)
|
||||||
#if ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) && HAS_DRIVER(TMC2130) && DISABLED(TMC_USE_SW_SPI)
|
#if IS_RRD_FG_SC && HAS_DRIVER(TMC2130) && DISABLED(TMC_USE_SW_SPI)
|
||||||
#error "Re-ARM with REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER and TMC2130 requires TMC_USE_SW_SPI."
|
#error "Re-ARM with REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER and TMC2130 requires TMC_USE_SW_SPI."
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -191,7 +191,7 @@ static_assert(DISABLED(BAUD_RATE_GCODE), "BAUD_RATE_GCODE is not yet supported o
|
||||||
//
|
//
|
||||||
// Flag any i2c pin conflicts
|
// Flag any i2c pin conflicts
|
||||||
//
|
//
|
||||||
#if ANY(HAS_I2C_DIGIPOT, DAC_STEPPER_CURRENT, EXPERIMENTAL_I2CBUS, I2C_POSITION_ENCODERS, PCA9632, I2C_EEPROM)
|
#if ANY(HAS_MOTOR_CURRENT_I2C, HAS_MOTOR_CURRENT_DAC, EXPERIMENTAL_I2CBUS, I2C_POSITION_ENCODERS, PCA9632, I2C_EEPROM)
|
||||||
#define USEDI2CDEV_M 1 // <Arduino>/Wire.cpp
|
#define USEDI2CDEV_M 1 // <Arduino>/Wire.cpp
|
||||||
|
|
||||||
#if USEDI2CDEV_M == 0 // P0_27 [D57] (AUX-1) .......... P0_28 [D58] (AUX-1)
|
#if USEDI2CDEV_M == 0 // P0_27 [D57] (AUX-1) .......... P0_28 [D58] (AUX-1)
|
||||||
|
|
|
||||||
|
|
@ -37,13 +37,14 @@
|
||||||
#define DATA_SIZE_8BIT SSP_DATABIT_8
|
#define DATA_SIZE_8BIT SSP_DATABIT_8
|
||||||
#define DATA_SIZE_16BIT SSP_DATABIT_16
|
#define DATA_SIZE_16BIT SSP_DATABIT_16
|
||||||
|
|
||||||
#define SPI_CLOCK_DIV2 8333333 //(SCR: 2) desired: 8,000,000 actual: 8,333,333 +4.2% SPI_FULL_SPEED
|
#define SPI_CLOCK_MAX_TFT 30000000UL
|
||||||
#define SPI_CLOCK_DIV4 4166667 //(SCR: 5) desired: 4,000,000 actual: 4,166,667 +4.2% SPI_HALF_SPEED
|
#define SPI_CLOCK_DIV2 8333333 //(SCR: 2) desired: 8,000,000 actual: 8,333,333 +4.2% SPI_FULL_SPEED
|
||||||
#define SPI_CLOCK_DIV8 2083333 //(SCR: 11) desired: 2,000,000 actual: 2,083,333 +4.2% SPI_QUARTER_SPEED
|
#define SPI_CLOCK_DIV4 4166667 //(SCR: 5) desired: 4,000,000 actual: 4,166,667 +4.2% SPI_HALF_SPEED
|
||||||
#define SPI_CLOCK_DIV16 1000000 //(SCR: 24) desired: 1,000,000 actual: 1,000,000 SPI_EIGHTH_SPEED
|
#define SPI_CLOCK_DIV8 2083333 //(SCR: 11) desired: 2,000,000 actual: 2,083,333 +4.2% SPI_QUARTER_SPEED
|
||||||
#define SPI_CLOCK_DIV32 500000 //(SCR: 49) desired: 500,000 actual: 500,000 SPI_SPEED_5
|
#define SPI_CLOCK_DIV16 1000000 //(SCR: 24) desired: 1,000,000 actual: 1,000,000 SPI_EIGHTH_SPEED
|
||||||
#define SPI_CLOCK_DIV64 250000 //(SCR: 99) desired: 250,000 actual: 250,000 SPI_SPEED_6
|
#define SPI_CLOCK_DIV32 500000 //(SCR: 49) desired: 500,000 actual: 500,000 SPI_SPEED_5
|
||||||
#define SPI_CLOCK_DIV128 125000 //(SCR:199) desired: 125,000 actual: 125,000 Default from HAL.h
|
#define SPI_CLOCK_DIV64 250000 //(SCR: 99) desired: 250,000 actual: 250,000 SPI_SPEED_6
|
||||||
|
#define SPI_CLOCK_DIV128 125000 //(SCR:199) desired: 125,000 actual: 125,000 Default from HAL.h
|
||||||
|
|
||||||
#define SPI_CLOCK_MAX SPI_CLOCK_DIV2
|
#define SPI_CLOCK_MAX SPI_CLOCK_DIV2
|
||||||
|
|
||||||
|
|
@ -125,6 +126,11 @@ public:
|
||||||
*/
|
*/
|
||||||
SPIClass(uint8_t spiPortNumber);
|
SPIClass(uint8_t spiPortNumber);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Init using pins
|
||||||
|
*/
|
||||||
|
SPIClass(pin_t mosi, pin_t miso, pin_t sclk, pin_t ssel = (pin_t)-1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Select and configure the current selected SPI device to use
|
* Select and configure the current selected SPI device to use
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ void TFT_SPI::Init() {
|
||||||
#elif TFT_MISO_PIN == BOARD_SPI2_MISO_PIN
|
#elif TFT_MISO_PIN == BOARD_SPI2_MISO_PIN
|
||||||
SPIx.setModule(2);
|
SPIx.setModule(2);
|
||||||
#endif
|
#endif
|
||||||
SPIx.setClock(SPI_CLOCK_MAX);
|
SPIx.setClock(SPI_CLOCK_MAX_TFT);
|
||||||
SPIx.setBitOrder(MSBFIRST);
|
SPIx.setBitOrder(MSBFIRST);
|
||||||
SPIx.setDataMode(SPI_MODE0);
|
SPIx.setDataMode(SPI_MODE0);
|
||||||
}
|
}
|
||||||
|
|
@ -125,7 +125,7 @@ uint32_t TFT_SPI::ReadID(uint16_t Reg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
DataTransferEnd();
|
DataTransferEnd();
|
||||||
SPIx.setClock(SPI_CLOCK_MAX);
|
SPIx.setClock(SPI_CLOCK_MAX_TFT);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return data >> 7;
|
return data >> 7;
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@
|
||||||
|
|
||||||
#define DATASIZE_8BIT SSP_DATABIT_8
|
#define DATASIZE_8BIT SSP_DATABIT_8
|
||||||
#define DATASIZE_16BIT SSP_DATABIT_16
|
#define DATASIZE_16BIT SSP_DATABIT_16
|
||||||
#define TFT_IO TFT_SPI
|
#define TFT_IO_DRIVER TFT_SPI
|
||||||
|
|
||||||
#define DMA_MINC_ENABLE 1
|
#define DMA_MINC_ENABLE 1
|
||||||
#define DMA_MINC_DISABLE 0
|
#define DMA_MINC_DISABLE 0
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
/**
|
/**
|
||||||
* Marlin 3D Printer Firmware
|
* Marlin 3D Printer Firmware
|
||||||
* Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||||
|
*
|
||||||
|
* Based on Sprinter and grbl.
|
||||||
|
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
/**
|
/**
|
||||||
* Marlin 3D Printer Firmware
|
* Marlin 3D Printer Firmware
|
||||||
* Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||||
|
*
|
||||||
|
* Based on Sprinter and grbl.
|
||||||
|
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,8 @@
|
||||||
#include <lpc17xx_wdt.h>
|
#include <lpc17xx_wdt.h>
|
||||||
#include "watchdog.h"
|
#include "watchdog.h"
|
||||||
|
|
||||||
|
#define WDT_TIMEOUT_US TERN(WATCHDOG_DURATION_8S, 8000000, 4000000) // 4 or 8 second timeout
|
||||||
|
|
||||||
void watchdog_init() {
|
void watchdog_init() {
|
||||||
#if ENABLED(WATCHDOG_RESET_MANUAL)
|
#if ENABLED(WATCHDOG_RESET_MANUAL)
|
||||||
// We enable the watchdog timer, but only for the interrupt.
|
// We enable the watchdog timer, but only for the interrupt.
|
||||||
|
|
@ -52,7 +54,7 @@ void watchdog_init() {
|
||||||
#else
|
#else
|
||||||
WDT_Init(WDT_CLKSRC_IRC, WDT_MODE_RESET);
|
WDT_Init(WDT_CLKSRC_IRC, WDT_MODE_RESET);
|
||||||
#endif
|
#endif
|
||||||
WDT_Start(WDT_TIMEOUT);
|
WDT_Start(WDT_TIMEOUT_US);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HAL_watchdog_refresh() {
|
void HAL_watchdog_refresh() {
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,6 @@
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define WDT_TIMEOUT 4000000 // 4 second timeout
|
|
||||||
|
|
||||||
void watchdog_init();
|
void watchdog_init();
|
||||||
void HAL_watchdog_refresh();
|
void HAL_watchdog_refresh();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -300,7 +300,7 @@ uint16_t HAL_adc_result;
|
||||||
DMA_ADDRESS_INCREMENT_STEP_SIZE_1, // STEPSIZE
|
DMA_ADDRESS_INCREMENT_STEP_SIZE_1, // STEPSIZE
|
||||||
DMA_STEPSEL_SRC // STEPSEL
|
DMA_STEPSEL_SRC // STEPSEL
|
||||||
);
|
);
|
||||||
if (descriptor != nullptr)
|
if (descriptor)
|
||||||
descriptor->BTCTRL.bit.EVOSEL = DMA_EVENT_OUTPUT_BEAT;
|
descriptor->BTCTRL.bit.EVOSEL = DMA_EVENT_OUTPUT_BEAT;
|
||||||
adc0DMAProgram.startJob();
|
adc0DMAProgram.startJob();
|
||||||
}
|
}
|
||||||
|
|
@ -337,7 +337,7 @@ uint16_t HAL_adc_result;
|
||||||
DMA_ADDRESS_INCREMENT_STEP_SIZE_1, // STEPSIZE
|
DMA_ADDRESS_INCREMENT_STEP_SIZE_1, // STEPSIZE
|
||||||
DMA_STEPSEL_SRC // STEPSEL
|
DMA_STEPSEL_SRC // STEPSEL
|
||||||
);
|
);
|
||||||
if (descriptor != nullptr)
|
if (descriptor)
|
||||||
descriptor->BTCTRL.bit.EVOSEL = DMA_EVENT_OUTPUT_BEAT;
|
descriptor->BTCTRL.bit.EVOSEL = DMA_EVENT_OUTPUT_BEAT;
|
||||||
adc1DMAProgram.startJob();
|
adc1DMAProgram.startJob();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,8 @@
|
||||||
|
|
||||||
// MYSERIAL0 required before MarlinSerial includes!
|
// MYSERIAL0 required before MarlinSerial includes!
|
||||||
|
|
||||||
#define _MSERIAL(X) Serial##X
|
#define __MSERIAL(X) Serial##X
|
||||||
|
#define _MSERIAL(X) __MSERIAL(X)
|
||||||
#define MSERIAL(X) _MSERIAL(INCREMENT(X))
|
#define MSERIAL(X) _MSERIAL(INCREMENT(X))
|
||||||
|
|
||||||
#if SERIAL_PORT == -1
|
#if SERIAL_PORT == -1
|
||||||
|
|
@ -88,6 +89,8 @@ typedef int8_t pin_t;
|
||||||
void HAL_clear_reset_source(); // clear reset reason
|
void HAL_clear_reset_source(); // clear reset reason
|
||||||
uint8_t HAL_get_reset_source(); // get reset reason
|
uint8_t HAL_get_reset_source(); // get reset reason
|
||||||
|
|
||||||
|
inline void HAL_reboot() {} // reboot the board or restart the bootloader
|
||||||
|
|
||||||
//
|
//
|
||||||
// ADC
|
// ADC
|
||||||
//
|
//
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@
|
||||||
|
|
||||||
#include "QSPIFlash.h"
|
#include "QSPIFlash.h"
|
||||||
|
|
||||||
#define INVALID_ADDR 0xffffffff
|
#define INVALID_ADDR 0xFFFFFFFF
|
||||||
#define SECTOR_OF(a) (a & ~(SFLASH_SECTOR_SIZE - 1))
|
#define SECTOR_OF(a) (a & ~(SFLASH_SECTOR_SIZE - 1))
|
||||||
#define OFFSET_OF(a) (a & (SFLASH_SECTOR_SIZE - 1))
|
#define OFFSET_OF(a) (a & (SFLASH_SECTOR_SIZE - 1))
|
||||||
|
|
||||||
|
|
@ -35,10 +35,10 @@ uint8_t QSPIFlash::_buf[SFLASH_SECTOR_SIZE];
|
||||||
uint32_t QSPIFlash::_addr = INVALID_ADDR;
|
uint32_t QSPIFlash::_addr = INVALID_ADDR;
|
||||||
|
|
||||||
void QSPIFlash::begin() {
|
void QSPIFlash::begin() {
|
||||||
if (_flashBase != nullptr) return;
|
if (_flashBase) return;
|
||||||
|
|
||||||
_flashBase = new Adafruit_SPIFlashBase(new Adafruit_FlashTransport_QSPI());
|
_flashBase = new Adafruit_SPIFlashBase(new Adafruit_FlashTransport_QSPI());
|
||||||
_flashBase->begin(NULL);
|
_flashBase->begin(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t QSPIFlash::size() {
|
size_t QSPIFlash::size() {
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||||
while (size--) {
|
while (size--) {
|
||||||
SYNC(NVMCTRL->SEESTAT.bit.BUSY);
|
SYNC(NVMCTRL->SEESTAT.bit.BUSY);
|
||||||
uint8_t c = ((volatile uint8_t *)SEEPROM_ADDR)[pos];
|
uint8_t c = ((volatile uint8_t *)SEEPROM_ADDR)[pos];
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||||
while (size--) {
|
while (size--) {
|
||||||
uint8_t c = qspi.readByte(pos);
|
uint8_t c = qspi.readByte(pos);
|
||||||
if (writing) *value = c;
|
if (writing) *value = c;
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||||
while (size--) {
|
while (size--) {
|
||||||
uint8_t c = eeprom_read_byte((uint8_t*)pos);
|
uint8_t c = eeprom_read_byte((uint8_t*)pos);
|
||||||
if (writing) *value = c;
|
if (writing) *value = c;
|
||||||
|
|
|
||||||
|
|
@ -24,28 +24,30 @@
|
||||||
|
|
||||||
#if ENABLED(USE_WATCHDOG)
|
#if ENABLED(USE_WATCHDOG)
|
||||||
|
|
||||||
#include "watchdog.h"
|
#include "watchdog.h"
|
||||||
|
|
||||||
void watchdog_init() {
|
#define WDT_TIMEOUT_REG TERN(WATCHDOG_DURATION_8S, WDT_CONFIG_PER_CYC8192, WDT_CONFIG_PER_CYC4096) // 4 or 8 second timeout
|
||||||
// The low-power oscillator used by the WDT runs at 32,768 Hz with
|
|
||||||
// a 1:32 prescale, thus 1024 Hz, though probably not super precise.
|
|
||||||
|
|
||||||
// Setup WDT clocks
|
void watchdog_init() {
|
||||||
MCLK->APBAMASK.bit.OSC32KCTRL_ = true;
|
// The low-power oscillator used by the WDT runs at 32,768 Hz with
|
||||||
MCLK->APBAMASK.bit.WDT_ = true;
|
// a 1:32 prescale, thus 1024 Hz, though probably not super precise.
|
||||||
OSC32KCTRL->OSCULP32K.bit.EN1K = true; // Enable out 1K (this is what WDT uses)
|
|
||||||
|
|
||||||
WDT->CTRLA.bit.ENABLE = false; // Disable watchdog for config
|
// Setup WDT clocks
|
||||||
SYNC(WDT->SYNCBUSY.bit.ENABLE);
|
MCLK->APBAMASK.bit.OSC32KCTRL_ = true;
|
||||||
|
MCLK->APBAMASK.bit.WDT_ = true;
|
||||||
|
OSC32KCTRL->OSCULP32K.bit.EN1K = true; // Enable out 1K (this is what WDT uses)
|
||||||
|
|
||||||
WDT->INTENCLR.reg = WDT_INTENCLR_EW; // Disable early warning interrupt
|
WDT->CTRLA.bit.ENABLE = false; // Disable watchdog for config
|
||||||
WDT->CONFIG.reg = WDT_CONFIG_PER_CYC4096; // Set at least 4s period for chip reset
|
SYNC(WDT->SYNCBUSY.bit.ENABLE);
|
||||||
|
|
||||||
HAL_watchdog_refresh();
|
WDT->INTENCLR.reg = WDT_INTENCLR_EW; // Disable early warning interrupt
|
||||||
|
WDT->CONFIG.reg = WDT_TIMEOUT_REG; // Set a 4s or 8s period for chip reset
|
||||||
|
|
||||||
WDT->CTRLA.reg = WDT_CTRLA_ENABLE; // Start watchdog now in normal mode
|
HAL_watchdog_refresh();
|
||||||
SYNC(WDT->SYNCBUSY.bit.ENABLE);
|
|
||||||
}
|
WDT->CTRLA.reg = WDT_CTRLA_ENABLE; // Start watchdog now in normal mode
|
||||||
|
SYNC(WDT->SYNCBUSY.bit.ENABLE);
|
||||||
|
}
|
||||||
|
|
||||||
#endif // USE_WATCHDOG
|
#endif // USE_WATCHDOG
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ uint16_t HAL_adc_result;
|
||||||
void HAL_init() {
|
void HAL_init() {
|
||||||
FastIO_init();
|
FastIO_init();
|
||||||
|
|
||||||
#if ENABLED(SDSUPPORT) && DISABLED(SDIO_SUPPORT)
|
#if ENABLED(SDSUPPORT) && DISABLED(SDIO_SUPPORT) && (defined(SDSS) && SDSS != -1)
|
||||||
OUT_WRITE(SDSS, HIGH); // Try to set SDSS inactive before any other SPI users start up
|
OUT_WRITE(SDSS, HIGH); // Try to set SDSS inactive before any other SPI users start up
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -81,7 +81,9 @@ void HAL_init() {
|
||||||
|
|
||||||
SetTimerInterruptPriorities();
|
SetTimerInterruptPriorities();
|
||||||
|
|
||||||
TERN_(EMERGENCY_PARSER, USB_Hook_init());
|
#if ENABLED(EMERGENCY_PARSER) && USBD_USE_CDC
|
||||||
|
USB_Hook_init();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void HAL_clear_reset_source() { __HAL_RCC_CLEAR_RESET_FLAGS(); }
|
void HAL_clear_reset_source() { __HAL_RCC_CLEAR_RESET_FLAGS(); }
|
||||||
|
|
@ -122,9 +124,18 @@ extern "C" {
|
||||||
|
|
||||||
// TODO: Make sure this doesn't cause any delay
|
// TODO: Make sure this doesn't cause any delay
|
||||||
void HAL_adc_start_conversion(const uint8_t adc_pin) { HAL_adc_result = analogRead(adc_pin); }
|
void HAL_adc_start_conversion(const uint8_t adc_pin) { HAL_adc_result = analogRead(adc_pin); }
|
||||||
|
|
||||||
uint16_t HAL_adc_get_result() { return HAL_adc_result; }
|
uint16_t HAL_adc_get_result() { return HAL_adc_result; }
|
||||||
|
|
||||||
|
// Reset the system (to initiate a firmware flash)
|
||||||
void flashFirmware(const int16_t) { NVIC_SystemReset(); }
|
void flashFirmware(const int16_t) { NVIC_SystemReset(); }
|
||||||
|
|
||||||
|
// Maple Compatibility
|
||||||
|
volatile uint32_t systick_uptime_millis = 0;
|
||||||
|
systickCallback_t systick_user_callback;
|
||||||
|
void systick_attach_callback(systickCallback_t cb) { systick_user_callback = cb; }
|
||||||
|
void HAL_SYSTICK_Callback() {
|
||||||
|
systick_uptime_millis++;
|
||||||
|
if (systick_user_callback) systick_user_callback();
|
||||||
|
}
|
||||||
|
|
||||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC
|
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC
|
||||||
|
|
|
||||||
|
|
@ -134,6 +134,8 @@ void HAL_clear_reset_source();
|
||||||
// Reset reason
|
// Reset reason
|
||||||
uint8_t HAL_get_reset_source();
|
uint8_t HAL_get_reset_source();
|
||||||
|
|
||||||
|
inline void HAL_reboot() {} // reboot the board or restart the bootloader
|
||||||
|
|
||||||
void _delay_ms(const int delay);
|
void _delay_ms(const int delay);
|
||||||
|
|
||||||
extern "C" char* _sbrk(int incr);
|
extern "C" char* _sbrk(int incr);
|
||||||
|
|
@ -177,3 +179,26 @@ uint16_t HAL_adc_get_result();
|
||||||
|
|
||||||
#define PLATFORM_M997_SUPPORT
|
#define PLATFORM_M997_SUPPORT
|
||||||
void flashFirmware(const int16_t);
|
void flashFirmware(const int16_t);
|
||||||
|
|
||||||
|
// Maple Compatibility
|
||||||
|
typedef void (*systickCallback_t)(void);
|
||||||
|
void systick_attach_callback(systickCallback_t cb);
|
||||||
|
void HAL_SYSTICK_Callback();
|
||||||
|
extern volatile uint32_t systick_uptime_millis;
|
||||||
|
|
||||||
|
#define HAL_CAN_SET_PWM_FREQ // This HAL supports PWM Frequency adjustment
|
||||||
|
|
||||||
|
/**
|
||||||
|
* set_pwm_frequency
|
||||||
|
* Set the frequency of the timer corresponding to the provided pin
|
||||||
|
* All Timer 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);
|
||||||
|
|
|
||||||
|
|
@ -132,11 +132,9 @@ static SPISettings spiConfig;
|
||||||
* @details Only configures SS pin since stm32duino creates and initialize the SPI object
|
* @details Only configures SS pin since stm32duino creates and initialize the SPI object
|
||||||
*/
|
*/
|
||||||
void spiBegin() {
|
void spiBegin() {
|
||||||
#if !PIN_EXISTS(SS)
|
#if PIN_EXISTS(SS)
|
||||||
#error "SS_PIN not defined!"
|
OUT_WRITE(SS_PIN, HIGH);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
OUT_WRITE(SS_PIN, HIGH);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Configure SPI for specified SPI speed
|
// Configure SPI for specified SPI speed
|
||||||
|
|
@ -173,9 +171,7 @@ static SPISettings spiConfig;
|
||||||
* @details
|
* @details
|
||||||
*/
|
*/
|
||||||
uint8_t spiRec() {
|
uint8_t spiRec() {
|
||||||
SPI.beginTransaction(spiConfig);
|
|
||||||
uint8_t returnByte = SPI.transfer(0xFF);
|
uint8_t returnByte = SPI.transfer(0xFF);
|
||||||
SPI.endTransaction();
|
|
||||||
return returnByte;
|
return returnByte;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -191,9 +187,7 @@ static SPISettings spiConfig;
|
||||||
void spiRead(uint8_t* buf, uint16_t nbyte) {
|
void spiRead(uint8_t* buf, uint16_t nbyte) {
|
||||||
if (nbyte == 0) return;
|
if (nbyte == 0) return;
|
||||||
memset(buf, 0xFF, nbyte);
|
memset(buf, 0xFF, nbyte);
|
||||||
SPI.beginTransaction(spiConfig);
|
|
||||||
SPI.transfer(buf, nbyte);
|
SPI.transfer(buf, nbyte);
|
||||||
SPI.endTransaction();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -204,9 +198,7 @@ static SPISettings spiConfig;
|
||||||
* @details
|
* @details
|
||||||
*/
|
*/
|
||||||
void spiSend(uint8_t b) {
|
void spiSend(uint8_t b) {
|
||||||
SPI.beginTransaction(spiConfig);
|
|
||||||
SPI.transfer(b);
|
SPI.transfer(b);
|
||||||
SPI.endTransaction();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -219,10 +211,8 @@ static SPISettings spiConfig;
|
||||||
*/
|
*/
|
||||||
void spiSendBlock(uint8_t token, const uint8_t* buf) {
|
void spiSendBlock(uint8_t token, const uint8_t* buf) {
|
||||||
uint8_t rxBuf[512];
|
uint8_t rxBuf[512];
|
||||||
SPI.beginTransaction(spiConfig);
|
|
||||||
SPI.transfer(token);
|
SPI.transfer(token);
|
||||||
SPI.transfer((uint8_t*)buf, &rxBuf, 512);
|
SPI.transfer((uint8_t*)buf, &rxBuf, 512);
|
||||||
SPI.endTransaction();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // SOFTWARE_SPI
|
#endif // SOFTWARE_SPI
|
||||||
|
|
|
||||||
165
Marlin/src/HAL/STM32/MarlinSPI.cpp
Normal file
165
Marlin/src/HAL/STM32/MarlinSPI.cpp
Normal file
|
|
@ -0,0 +1,165 @@
|
||||||
|
/**
|
||||||
|
* Marlin 3D Printer Firmware
|
||||||
|
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||||
|
*
|
||||||
|
* Based on Sprinter and grbl.
|
||||||
|
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC)
|
||||||
|
|
||||||
|
#include "MarlinSPI.h"
|
||||||
|
|
||||||
|
static void spi_init(spi_t *obj, uint32_t speed, spi_mode_e mode, uint8_t msb, uint32_t dataSize) {
|
||||||
|
spi_init(obj, speed, mode, msb);
|
||||||
|
// spi_init set 8bit always
|
||||||
|
// TODO: copy the code from spi_init and handle data size, to avoid double init always!!
|
||||||
|
if (dataSize != SPI_DATASIZE_8BIT) {
|
||||||
|
obj->handle.Init.DataSize = dataSize;
|
||||||
|
HAL_SPI_Init(&obj->handle);
|
||||||
|
__HAL_SPI_ENABLE(&obj->handle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MarlinSPI::setClockDivider(uint8_t _div) {
|
||||||
|
_speed = spi_getClkFreq(&_spi);// / _div;
|
||||||
|
_clockDivider = _div;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MarlinSPI::begin(void) {
|
||||||
|
//TODO: only call spi_init if any parameter changed!!
|
||||||
|
spi_init(&_spi, _speed, _dataMode, _bitOrder, _dataSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MarlinSPI::setupDma(SPI_HandleTypeDef &_spiHandle, DMA_HandleTypeDef &_dmaHandle, uint32_t direction, bool minc) {
|
||||||
|
_dmaHandle.Init.Direction = direction;
|
||||||
|
_dmaHandle.Init.PeriphInc = DMA_PINC_DISABLE;
|
||||||
|
_dmaHandle.Init.Mode = DMA_NORMAL;
|
||||||
|
_dmaHandle.Init.Priority = DMA_PRIORITY_LOW;
|
||||||
|
_dmaHandle.Init.MemInc = minc ? DMA_MINC_ENABLE : DMA_MINC_DISABLE;
|
||||||
|
|
||||||
|
if (_dataSize == DATA_SIZE_8BIT) {
|
||||||
|
_dmaHandle.Init.PeriphDataAlignment = DMA_PDATAALIGN_BYTE;
|
||||||
|
_dmaHandle.Init.MemDataAlignment = DMA_MDATAALIGN_BYTE;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
_dmaHandle.Init.PeriphDataAlignment = DMA_PDATAALIGN_HALFWORD;
|
||||||
|
_dmaHandle.Init.MemDataAlignment = DMA_MDATAALIGN_HALFWORD;
|
||||||
|
}
|
||||||
|
#ifdef STM32F4xx
|
||||||
|
_dmaHandle.Init.Channel = DMA_CHANNEL_3;
|
||||||
|
_dmaHandle.Init.FIFOMode = DMA_FIFOMODE_DISABLE;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// start DMA hardware
|
||||||
|
// TODO: check if hardware is already enabled
|
||||||
|
#ifdef SPI1_BASE
|
||||||
|
if (_spiHandle.Instance == SPI1) {
|
||||||
|
#ifdef STM32F1xx
|
||||||
|
__HAL_RCC_DMA1_CLK_ENABLE();
|
||||||
|
_dmaHandle.Instance = (direction == DMA_MEMORY_TO_PERIPH) ? DMA1_Channel3 : DMA1_Channel2;
|
||||||
|
#elif defined(STM32F4xx)
|
||||||
|
__HAL_RCC_DMA2_CLK_ENABLE();
|
||||||
|
_dmaHandle.Instance = DMA2_Stream3;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#ifdef SPI2_BASE
|
||||||
|
if (_spiHandle.Instance == SPI2) {
|
||||||
|
#ifdef STM32F1xx
|
||||||
|
__HAL_RCC_DMA1_CLK_ENABLE();
|
||||||
|
_dmaHandle.Instance = (direction == DMA_MEMORY_TO_PERIPH) ? DMA1_Channel5 : DMA1_Channel4;
|
||||||
|
#elif defined(STM32F4xx)
|
||||||
|
//TODO: f4 dma config
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#ifdef SPI3_BASE
|
||||||
|
if (_spiHandle.Instance == SPI3) {
|
||||||
|
#ifdef STM32F1xx
|
||||||
|
__HAL_RCC_DMA2_CLK_ENABLE();
|
||||||
|
_dmaHandle.Instance = (direction == DMA_MEMORY_TO_PERIPH) ? DMA2_Channel2 : DMA2_Channel1;
|
||||||
|
#elif defined(STM32F4xx)
|
||||||
|
//TODO: f4 dma config
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
HAL_DMA_Init(&_dmaHandle);
|
||||||
|
}
|
||||||
|
|
||||||
|
byte MarlinSPI::transfer(uint8_t _data) {
|
||||||
|
uint8_t rxData = 0xFF;
|
||||||
|
HAL_SPI_TransmitReceive(&_spi.handle, &_data, &rxData, 1, HAL_MAX_DELAY);
|
||||||
|
return rxData;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t MarlinSPI::dmaTransfer(const void *transmitBuf, void *receiveBuf, uint16_t length) {
|
||||||
|
const uint8_t ff = 0xFF;
|
||||||
|
|
||||||
|
//if ((hspi->Instance->CR1 & SPI_CR1_SPE) != SPI_CR1_SPE) //only enable if disabled
|
||||||
|
__HAL_SPI_ENABLE(&_spi.handle);
|
||||||
|
|
||||||
|
if (receiveBuf) {
|
||||||
|
setupDma(_spi.handle, _dmaRx, DMA_PERIPH_TO_MEMORY, true);
|
||||||
|
HAL_DMA_Start(&_dmaRx, (uint32_t)&(_spi.handle.Instance->DR), (uint32_t)receiveBuf, length);
|
||||||
|
SET_BIT(_spi.handle.Instance->CR2, SPI_CR2_RXDMAEN); /* Enable Rx DMA Request */
|
||||||
|
}
|
||||||
|
|
||||||
|
// check for 2 lines transfer
|
||||||
|
bool mincTransmit = true;
|
||||||
|
if (transmitBuf == nullptr && _spi.handle.Init.Direction == SPI_DIRECTION_2LINES && _spi.handle.Init.Mode == SPI_MODE_MASTER) {
|
||||||
|
transmitBuf = &ff;
|
||||||
|
mincTransmit = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (transmitBuf) {
|
||||||
|
setupDma(_spi.handle, _dmaTx, DMA_MEMORY_TO_PERIPH, mincTransmit);
|
||||||
|
HAL_DMA_Start(&_dmaTx, (uint32_t)transmitBuf, (uint32_t)&(_spi.handle.Instance->DR), length);
|
||||||
|
SET_BIT(_spi.handle.Instance->CR2, SPI_CR2_TXDMAEN); /* Enable Tx DMA Request */
|
||||||
|
}
|
||||||
|
|
||||||
|
if (transmitBuf) {
|
||||||
|
HAL_DMA_PollForTransfer(&_dmaTx, HAL_DMA_FULL_TRANSFER, HAL_MAX_DELAY);
|
||||||
|
HAL_DMA_Abort(&_dmaTx);
|
||||||
|
HAL_DMA_DeInit(&_dmaTx);
|
||||||
|
}
|
||||||
|
|
||||||
|
// while ((_spi.handle.Instance->SR & SPI_FLAG_RXNE) != SPI_FLAG_RXNE) {}
|
||||||
|
|
||||||
|
if (receiveBuf) {
|
||||||
|
HAL_DMA_PollForTransfer(&_dmaRx, HAL_DMA_FULL_TRANSFER, HAL_MAX_DELAY);
|
||||||
|
HAL_DMA_Abort(&_dmaRx);
|
||||||
|
HAL_DMA_DeInit(&_dmaRx);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t MarlinSPI::dmaSend(const void * transmitBuf, uint16_t length, bool minc) {
|
||||||
|
setupDma(_spi.handle, _dmaTx, DMA_MEMORY_TO_PERIPH, minc);
|
||||||
|
HAL_DMA_Start(&_dmaTx, (uint32_t)transmitBuf, (uint32_t)&(_spi.handle.Instance->DR), length);
|
||||||
|
__HAL_SPI_ENABLE(&_spi.handle);
|
||||||
|
SET_BIT(_spi.handle.Instance->CR2, SPI_CR2_TXDMAEN); /* Enable Tx DMA Request */
|
||||||
|
HAL_DMA_PollForTransfer(&_dmaTx, HAL_DMA_FULL_TRANSFER, HAL_MAX_DELAY);
|
||||||
|
HAL_DMA_Abort(&_dmaTx);
|
||||||
|
// DeInit objects
|
||||||
|
HAL_DMA_DeInit(&_dmaTx);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC
|
||||||
107
Marlin/src/HAL/STM32/MarlinSPI.h
Normal file
107
Marlin/src/HAL/STM32/MarlinSPI.h
Normal file
|
|
@ -0,0 +1,107 @@
|
||||||
|
/**
|
||||||
|
* Marlin 3D Printer Firmware
|
||||||
|
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||||
|
*
|
||||||
|
* Based on Sprinter and grbl.
|
||||||
|
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "HAL.h"
|
||||||
|
#include <SPI.h>
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
#include <utility/spi_com.h>
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Marlin currently requires 3 SPI classes:
|
||||||
|
*
|
||||||
|
* SPIClass:
|
||||||
|
* This class is normally provided by frameworks and has a semi-default interface.
|
||||||
|
* This is needed because some libraries reference it globally.
|
||||||
|
*
|
||||||
|
* SPISettings:
|
||||||
|
* Container for SPI configs for SPIClass. As above, libraries may reference it globally.
|
||||||
|
*
|
||||||
|
* These two classes are often provided by frameworks so we cannot extend them to add
|
||||||
|
* useful methods for Marlin.
|
||||||
|
*
|
||||||
|
* MarlinSPI:
|
||||||
|
* Provides the default SPIClass interface plus some Marlin goodies such as a simplified
|
||||||
|
* interface for SPI DMA transfer.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define DATA_SIZE_8BIT SPI_DATASIZE_8BIT
|
||||||
|
#define DATA_SIZE_16BIT SPI_DATASIZE_16BIT
|
||||||
|
|
||||||
|
class MarlinSPI {
|
||||||
|
public:
|
||||||
|
MarlinSPI() : MarlinSPI(NC, NC, NC, NC) {}
|
||||||
|
|
||||||
|
MarlinSPI(pin_t mosi, pin_t miso, pin_t sclk, pin_t ssel = (pin_t)NC) : _mosiPin(mosi), _misoPin(miso), _sckPin(sclk), _ssPin(ssel) {
|
||||||
|
_spi.pin_miso = digitalPinToPinName(_misoPin);
|
||||||
|
_spi.pin_mosi = digitalPinToPinName(_mosiPin);
|
||||||
|
_spi.pin_sclk = digitalPinToPinName(_sckPin);
|
||||||
|
_spi.pin_ssel = digitalPinToPinName(_ssPin);
|
||||||
|
_dataSize = DATA_SIZE_8BIT;
|
||||||
|
_bitOrder = MSBFIRST;
|
||||||
|
_dataMode = SPI_MODE_0;
|
||||||
|
_spi.handle.State = HAL_SPI_STATE_RESET;
|
||||||
|
setClockDivider(SPI_SPEED_CLOCK_DIV2_MHZ);
|
||||||
|
}
|
||||||
|
|
||||||
|
void begin(void);
|
||||||
|
void end(void) {}
|
||||||
|
|
||||||
|
byte transfer(uint8_t _data);
|
||||||
|
uint8_t dmaTransfer(const void *transmitBuf, void *receiveBuf, uint16_t length);
|
||||||
|
uint8_t dmaSend(const void * transmitBuf, uint16_t length, bool minc = true);
|
||||||
|
|
||||||
|
/* These methods are deprecated and kept for compatibility.
|
||||||
|
* Use SPISettings with SPI.beginTransaction() to configure SPI parameters.
|
||||||
|
*/
|
||||||
|
void setBitOrder(BitOrder _order) { _bitOrder = _order; }
|
||||||
|
|
||||||
|
void setDataMode(uint8_t _mode) {
|
||||||
|
switch (_mode) {
|
||||||
|
case SPI_MODE0: _dataMode = SPI_MODE_0; break;
|
||||||
|
case SPI_MODE1: _dataMode = SPI_MODE_1; break;
|
||||||
|
case SPI_MODE2: _dataMode = SPI_MODE_2; break;
|
||||||
|
case SPI_MODE3: _dataMode = SPI_MODE_3; break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void setClockDivider(uint8_t _div);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void setupDma(SPI_HandleTypeDef &_spiHandle, DMA_HandleTypeDef &_dmaHandle, uint32_t direction, bool minc = false);
|
||||||
|
|
||||||
|
spi_t _spi;
|
||||||
|
DMA_HandleTypeDef _dmaTx;
|
||||||
|
DMA_HandleTypeDef _dmaRx;
|
||||||
|
BitOrder _bitOrder;
|
||||||
|
spi_mode_e _dataMode;
|
||||||
|
uint8_t _clockDivider;
|
||||||
|
uint32_t _speed;
|
||||||
|
uint32_t _dataSize;
|
||||||
|
pin_t _mosiPin;
|
||||||
|
pin_t _misoPin;
|
||||||
|
pin_t _sckPin;
|
||||||
|
pin_t _ssPin;
|
||||||
|
};
|
||||||
|
|
@ -113,7 +113,7 @@ bool PersistentStore::access_start() {
|
||||||
// This must be the first time since power on that we have accessed the storage, or someone
|
// This must be the first time since power on that we have accessed the storage, or someone
|
||||||
// loaded and called write_data and never called access_finish.
|
// loaded and called write_data and never called access_finish.
|
||||||
// Lets go looking for the slot that holds our configuration.
|
// Lets go looking for the slot that holds our configuration.
|
||||||
if (eeprom_data_written) DEBUG_ECHOLN("Dangling EEPROM write_data");
|
if (eeprom_data_written) DEBUG_ECHOLNPGM("Dangling EEPROM write_data");
|
||||||
uint32_t address = FLASH_ADDRESS_START;
|
uint32_t address = FLASH_ADDRESS_START;
|
||||||
while (address <= FLASH_ADDRESS_END) {
|
while (address <= FLASH_ADDRESS_END) {
|
||||||
uint32_t address_value = (*(__IO uint32_t*)address);
|
uint32_t address_value = (*(__IO uint32_t*)address);
|
||||||
|
|
@ -261,7 +261,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||||
do {
|
do {
|
||||||
const uint8_t c = TERN(FLASH_EEPROM_LEVELING, ram_eeprom[pos], eeprom_buffered_read_byte(pos));
|
const uint8_t c = TERN(FLASH_EEPROM_LEVELING, ram_eeprom[pos], eeprom_buffered_read_byte(pos));
|
||||||
if (writing) *value = c;
|
if (writing) *value = c;
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PersistentStore::read_data(int &pos, uint8_t* value, const size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
bool PersistentStore::read_data(int &pos, uint8_t *value, const size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||||
for (size_t i = 0; i < size; i++) {
|
for (size_t i = 0; i < size; i++) {
|
||||||
uint8_t c = HAL_eeprom_data[pos + i];
|
uint8_t c = HAL_eeprom_data[pos + i];
|
||||||
if (writing) value[i] = c;
|
if (writing) value[i] = c;
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||||
do {
|
do {
|
||||||
// Read from either external EEPROM, program flash or Backup SRAM
|
// Read from either external EEPROM, program flash or Backup SRAM
|
||||||
const uint8_t c = ( *(__IO uint8_t *)(BKPSRAM_BASE + ((uint8_t*)pos)) );
|
const uint8_t c = ( *(__IO uint8_t *)(BKPSRAM_BASE + ((uint8_t*)pos)) );
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||||
do {
|
do {
|
||||||
// Read from either external EEPROM, program flash or Backup SRAM
|
// Read from either external EEPROM, program flash or Backup SRAM
|
||||||
const uint8_t c = eeprom_read_byte((uint8_t*)pos);
|
const uint8_t c = eeprom_read_byte((uint8_t*)pos);
|
||||||
|
|
|
||||||
57
Marlin/src/HAL/STM32/fast_pwm.cpp
Normal file
57
Marlin/src/HAL/STM32/fast_pwm.cpp
Normal file
|
|
@ -0,0 +1,57 @@
|
||||||
|
/**
|
||||||
|
* Marlin 3D Printer Firmware
|
||||||
|
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||||
|
*
|
||||||
|
* Based on Sprinter and grbl.
|
||||||
|
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "../../inc/MarlinConfigPre.h"
|
||||||
|
|
||||||
|
#if NEEDS_HARDWARE_PWM
|
||||||
|
|
||||||
|
#include "HAL.h"
|
||||||
|
#include "timers.h"
|
||||||
|
|
||||||
|
void set_pwm_frequency(const pin_t pin, int f_desired) {
|
||||||
|
if (!PWM_PIN(pin)) return; // Don't proceed if no hardware timer
|
||||||
|
|
||||||
|
PinName pin_name = digitalPinToPinName(pin);
|
||||||
|
TIM_TypeDef *Instance = (TIM_TypeDef *)pinmap_peripheral(pin_name, PinMap_PWM); // Get HAL timer instance
|
||||||
|
|
||||||
|
LOOP_S_L_N(i, 0, NUM_HARDWARE_TIMERS) // Protect used timers
|
||||||
|
if (timer_instance[i] && timer_instance[i]->getHandle()->Instance == Instance)
|
||||||
|
return;
|
||||||
|
|
||||||
|
pwm_start(pin_name, f_desired, 0, RESOLUTION_8B_COMPARE_FORMAT);
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t v_size/*=255*/, const bool invert/*=false*/) {
|
||||||
|
PinName pin_name = digitalPinToPinName(pin);
|
||||||
|
TIM_TypeDef *Instance = (TIM_TypeDef *)pinmap_peripheral(pin_name, PinMap_PWM);
|
||||||
|
uint16_t adj_val = Instance->ARR * v / v_size;
|
||||||
|
if (invert) adj_val = Instance->ARR - adj_val;
|
||||||
|
|
||||||
|
switch (get_pwm_channel(pin_name)) {
|
||||||
|
case TIM_CHANNEL_1: LL_TIM_OC_SetCompareCH1(Instance, adj_val); break;
|
||||||
|
case TIM_CHANNEL_2: LL_TIM_OC_SetCompareCH2(Instance, adj_val); break;
|
||||||
|
case TIM_CHANNEL_3: LL_TIM_OC_SetCompareCH3(Instance, adj_val); break;
|
||||||
|
case TIM_CHANNEL_4: LL_TIM_OC_SetCompareCH4(Instance, adj_val); break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // NEEDS_HARDWARE_PWM
|
||||||
|
|
@ -51,19 +51,19 @@ void FastIO_init(); // Must be called before using fast io macros
|
||||||
|
|
||||||
#if defined(STM32F0xx) || defined(STM32F1xx) || defined(STM32F3xx) || defined(STM32L0xx) || defined(STM32L4xx)
|
#if defined(STM32F0xx) || defined(STM32F1xx) || defined(STM32F3xx) || defined(STM32L0xx) || defined(STM32L4xx)
|
||||||
#define _WRITE(IO, V) do { \
|
#define _WRITE(IO, V) do { \
|
||||||
if (V) FastIOPortMap[STM_PORT(digitalPin[IO])]->BSRR = _BV32(STM_PIN(digitalPin[IO])) ; \
|
if (V) FastIOPortMap[STM_PORT(digitalPinToPinName(IO))]->BSRR = _BV32(STM_PIN(digitalPinToPinName(IO))) ; \
|
||||||
else FastIOPortMap[STM_PORT(digitalPin[IO])]->BRR = _BV32(STM_PIN(digitalPin[IO])) ; \
|
else FastIOPortMap[STM_PORT(digitalPinToPinName(IO))]->BRR = _BV32(STM_PIN(digitalPinToPinName(IO))) ; \
|
||||||
}while(0)
|
}while(0)
|
||||||
#else
|
#else
|
||||||
#define _WRITE(IO, V) (FastIOPortMap[STM_PORT(digitalPin[IO])]->BSRR = _BV32(STM_PIN(digitalPin[IO]) + ((V) ? 0 : 16)))
|
#define _WRITE(IO, V) (FastIOPortMap[STM_PORT(digitalPinToPinName(IO))]->BSRR = _BV32(STM_PIN(digitalPinToPinName(IO)) + ((V) ? 0 : 16)))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define _READ(IO) bool(READ_BIT(FastIOPortMap[STM_PORT(digitalPin[IO])]->IDR, _BV32(STM_PIN(digitalPin[IO]))))
|
#define _READ(IO) bool(READ_BIT(FastIOPortMap[STM_PORT(digitalPinToPinName(IO))]->IDR, _BV32(STM_PIN(digitalPinToPinName(IO)))))
|
||||||
#define _TOGGLE(IO) (FastIOPortMap[STM_PORT(digitalPin[IO])]->ODR ^= _BV32(STM_PIN(digitalPin[IO])))
|
#define _TOGGLE(IO) (FastIOPortMap[STM_PORT(digitalPinToPinName(IO))]->ODR ^= _BV32(STM_PIN(digitalPinToPinName(IO))))
|
||||||
|
|
||||||
#define _GET_MODE(IO)
|
#define _GET_MODE(IO)
|
||||||
#define _SET_MODE(IO,M) pinMode(IO, M)
|
#define _SET_MODE(IO,M) pinMode(IO, M)
|
||||||
#define _SET_OUTPUT(IO) pinMode(IO, OUTPUT) /*!< Output Push Pull Mode & GPIO_NOPULL */
|
#define _SET_OUTPUT(IO) pinMode(IO, OUTPUT) //!< Output Push Pull Mode & GPIO_NOPULL
|
||||||
#define _SET_OUTPUT_OD(IO) pinMode(IO, OUTPUT_OPEN_DRAIN)
|
#define _SET_OUTPUT_OD(IO) pinMode(IO, OUTPUT_OPEN_DRAIN)
|
||||||
|
|
||||||
#define WRITE(IO,V) _WRITE(IO,V)
|
#define WRITE(IO,V) _WRITE(IO,V)
|
||||||
|
|
@ -73,9 +73,9 @@ void FastIO_init(); // Must be called before using fast io macros
|
||||||
#define OUT_WRITE(IO,V) do{ _SET_OUTPUT(IO); WRITE(IO,V); }while(0)
|
#define OUT_WRITE(IO,V) do{ _SET_OUTPUT(IO); WRITE(IO,V); }while(0)
|
||||||
#define OUT_WRITE_OD(IO,V) do{ _SET_OUTPUT_OD(IO); WRITE(IO,V); }while(0)
|
#define OUT_WRITE_OD(IO,V) do{ _SET_OUTPUT_OD(IO); WRITE(IO,V); }while(0)
|
||||||
|
|
||||||
#define SET_INPUT(IO) _SET_MODE(IO, INPUT) /*!< Input Floating Mode */
|
#define SET_INPUT(IO) _SET_MODE(IO, INPUT) //!< Input Floating Mode
|
||||||
#define SET_INPUT_PULLUP(IO) _SET_MODE(IO, INPUT_PULLUP) /*!< Input with Pull-up activation */
|
#define SET_INPUT_PULLUP(IO) _SET_MODE(IO, INPUT_PULLUP) //!< Input with Pull-up activation
|
||||||
#define SET_INPUT_PULLDOWN(IO) _SET_MODE(IO, INPUT_PULLDOWN) /*!< Input with Pull-down activation */
|
#define SET_INPUT_PULLDOWN(IO) _SET_MODE(IO, INPUT_PULLDOWN) //!< Input with Pull-down activation
|
||||||
#define SET_OUTPUT(IO) OUT_WRITE(IO, LOW)
|
#define SET_OUTPUT(IO) OUT_WRITE(IO, LOW)
|
||||||
#define SET_PWM(IO) _SET_MODE(IO, PWM)
|
#define SET_PWM(IO) _SET_MODE(IO, PWM)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,9 +28,6 @@
|
||||||
// #error "SPINDLE_LASER_PWM_PIN must use SERVO0, SERVO1 or SERVO3 connector"
|
// #error "SPINDLE_LASER_PWM_PIN must use SERVO0, SERVO1 or SERVO3 connector"
|
||||||
//#endif
|
//#endif
|
||||||
|
|
||||||
#if ENABLED(FAST_PWM_FAN) || SPINDLE_LASER_FREQUENCY
|
|
||||||
#error "Features requiring Hardware PWM (FAST_PWM_FAN, SPINDLE_LASER_FREQUENCY) are not yet supported on STM32."
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if ENABLED(SDCARD_EEPROM_EMULATION) && DISABLED(SDSUPPORT)
|
#if ENABLED(SDCARD_EEPROM_EMULATION) && DISABLED(SDSUPPORT)
|
||||||
#undef SDCARD_EEPROM_EMULATION // Avoid additional error noise
|
#undef SDCARD_EEPROM_EMULATION // Avoid additional error noise
|
||||||
|
|
|
||||||
|
|
@ -51,8 +51,8 @@
|
||||||
* It contains:
|
* It contains:
|
||||||
* - name of the signal
|
* - name of the signal
|
||||||
* - the Ard_num assigned by the pins_YOUR_BOARD.h file using the platform defines.
|
* - the Ard_num assigned by the pins_YOUR_BOARD.h file using the platform defines.
|
||||||
* EXAMPLE: "#define KILL_PIN PB1" results in Ard_num of 57. 57 is then used as an
|
* EXAMPLE: "#define KILL_PIN PB1" results in Ard_num of 57. 57 is then used as the
|
||||||
* index into digitalPin[] to get the Port_pin number
|
* argument to digitalPinToPinName(IO) to get the Port_pin number
|
||||||
* - if it is a digital or analog signal. PWMs are considered digital here.
|
* - if it is a digital or analog signal. PWMs are considered digital here.
|
||||||
*
|
*
|
||||||
* pin_xref is a structure generated by this header file. It is generated by the
|
* pin_xref is a structure generated by this header file. It is generated by the
|
||||||
|
|
@ -68,8 +68,6 @@
|
||||||
* signal. The Arduino pin number is listed by the M43 I command.
|
* signal. The Arduino pin number is listed by the M43 I command.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern const PinName digitalPin[]; // provided by the platform
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// make a list of the Arduino pin numbers in the Port/Pin order
|
// make a list of the Arduino pin numbers in the Port/Pin order
|
||||||
|
|
@ -137,7 +135,7 @@ const XrefInfo pin_xref[] PROGMEM = {
|
||||||
|
|
||||||
uint8_t get_pin_mode(const pin_t Ard_num) {
|
uint8_t get_pin_mode(const pin_t Ard_num) {
|
||||||
uint32_t mode_all = 0;
|
uint32_t mode_all = 0;
|
||||||
const PinName dp = digitalPin[Ard_num];
|
const PinName dp = digitalPinToPinName(Ard_num);
|
||||||
switch (PORT_ALPHA(dp)) {
|
switch (PORT_ALPHA(dp)) {
|
||||||
case 'A' : mode_all = GPIOA->MODER; break;
|
case 'A' : mode_all = GPIOA->MODER; break;
|
||||||
case 'B' : mode_all = GPIOB->MODER; break;
|
case 'B' : mode_all = GPIOB->MODER; break;
|
||||||
|
|
@ -218,7 +216,7 @@ bool pwm_status(const pin_t Ard_num) {
|
||||||
void pwm_details(const pin_t Ard_num) {
|
void pwm_details(const pin_t Ard_num) {
|
||||||
if (pwm_status(Ard_num)) {
|
if (pwm_status(Ard_num)) {
|
||||||
uint32_t alt_all = 0;
|
uint32_t alt_all = 0;
|
||||||
const PinName dp = digitalPin[Ard_num];
|
const PinName dp = digitalPinToPinName(Ard_num);
|
||||||
pin_t pin_number = uint8_t(PIN_NUM(dp));
|
pin_t pin_number = uint8_t(PIN_NUM(dp));
|
||||||
const bool over_7 = pin_number >= 8;
|
const bool over_7 = pin_number >= 8;
|
||||||
const uint8_t ind = over_7 ? 1 : 0;
|
const uint8_t ind = over_7 ? 1 : 0;
|
||||||
|
|
|
||||||
|
|
@ -21,30 +21,28 @@
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "../../../inc/MarlinConfig.h"
|
||||||
|
|
||||||
#ifdef STM32F1xx
|
#ifdef STM32F1xx
|
||||||
#include "stm32f1xx_hal.h"
|
#include "stm32f1xx_hal.h"
|
||||||
|
#define __IS_DMA_ENABLED(__HANDLE__) ((__HANDLE__)->Instance->CCR & DMA_CCR_EN)
|
||||||
#elif defined(STM32F4xx)
|
#elif defined(STM32F4xx)
|
||||||
#include "stm32f4xx_hal.h"
|
#include "stm32f4xx_hal.h"
|
||||||
|
#define __IS_DMA_ENABLED(__HANDLE__) ((__HANDLE__)->Instance->CR & DMA_SxCR_EN)
|
||||||
#else
|
#else
|
||||||
#error FSMC TFT is currently only supported on STM32F1 and STM32F4 hardware.
|
#error "FSMC TFT is currently only supported on STM32F1 and STM32F4 hardware."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef LCD_READ_ID
|
#ifndef LCD_READ_ID
|
||||||
#define LCD_READ_ID 0x04 // Read display identification information (0xD3 on ILI9341)
|
#define LCD_READ_ID 0x04 // Read display identification information (0xD3 on ILI9341)
|
||||||
#endif
|
#endif
|
||||||
#ifndef LCD_READ_ID4
|
#ifndef LCD_READ_ID4
|
||||||
#define LCD_READ_ID4 0xD3 // Read display identification information (0xD3 on ILI9341)
|
#define LCD_READ_ID4 0xD3 // Read display identification information (0xD3 on ILI9341)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define DATASIZE_8BIT SPI_DATASIZE_8BIT
|
#define DATASIZE_8BIT SPI_DATASIZE_8BIT
|
||||||
#define DATASIZE_16BIT SPI_DATASIZE_16BIT
|
#define DATASIZE_16BIT SPI_DATASIZE_16BIT
|
||||||
#define TFT_IO TFT_FSMC
|
#define TFT_IO_DRIVER TFT_FSMC
|
||||||
|
|
||||||
#ifdef STM32F1xx
|
|
||||||
#define __IS_DMA_ENABLED(__HANDLE__) ((__HANDLE__)->Instance->CCR & DMA_CCR_EN)
|
|
||||||
#elif defined(STM32F4xx)
|
|
||||||
#define __IS_DMA_ENABLED(__HANDLE__) ((__HANDLE__)->Instance->CR & DMA_SxCR_EN)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
__IO uint16_t REG;
|
__IO uint16_t REG;
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@
|
||||||
|
|
||||||
#define DATASIZE_8BIT SPI_DATASIZE_8BIT
|
#define DATASIZE_8BIT SPI_DATASIZE_8BIT
|
||||||
#define DATASIZE_16BIT SPI_DATASIZE_16BIT
|
#define DATASIZE_16BIT SPI_DATASIZE_16BIT
|
||||||
#define TFT_IO TFT_SPI
|
#define TFT_IO_DRIVER TFT_SPI
|
||||||
|
|
||||||
class TFT_SPI {
|
class TFT_SPI {
|
||||||
private:
|
private:
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
/**
|
/**
|
||||||
* Marlin 3D Printer Firmware
|
* Marlin 3D Printer Firmware
|
||||||
* Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||||
|
*
|
||||||
|
* Based on Sprinter and grbl.
|
||||||
|
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -99,7 +102,7 @@ void XPT2046::Init() {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
SPIx.Instance = NULL;
|
SPIx.Instance = nullptr;
|
||||||
SET_INPUT(TOUCH_MISO_PIN);
|
SET_INPUT(TOUCH_MISO_PIN);
|
||||||
SET_OUTPUT(TOUCH_MOSI_PIN);
|
SET_OUTPUT(TOUCH_MOSI_PIN);
|
||||||
SET_OUTPUT(TOUCH_SCK_PIN);
|
SET_OUTPUT(TOUCH_SCK_PIN);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
/**
|
/**
|
||||||
* Marlin 3D Printer Firmware
|
* Marlin 3D Printer Firmware
|
||||||
* Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||||
|
*
|
||||||
|
* Based on Sprinter and grbl.
|
||||||
|
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,6 @@
|
||||||
// Local defines
|
// Local defines
|
||||||
// ------------------------
|
// ------------------------
|
||||||
|
|
||||||
#define NUM_HARDWARE_TIMERS 2
|
|
||||||
|
|
||||||
// Default timer priorities. Override by specifying alternate priorities in the board pins file.
|
// Default timer priorities. Override by specifying alternate priorities in the board pins file.
|
||||||
// The TONE timer is not present here, as it currently cannot be set programmatically. It is set
|
// The TONE timer is not present here, as it currently cannot be set programmatically. It is set
|
||||||
|
|
@ -68,26 +67,23 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef STM32F0xx
|
#ifdef STM32F0xx
|
||||||
#define MCU_TIMER_RATE (F_CPU) // Frequency of timer peripherals
|
|
||||||
#define MCU_STEP_TIMER 16
|
#define MCU_STEP_TIMER 16
|
||||||
#define MCU_TEMP_TIMER 17
|
#define MCU_TEMP_TIMER 17
|
||||||
#elif defined(STM32F1xx)
|
#elif defined(STM32F1xx)
|
||||||
#define MCU_TIMER_RATE (F_CPU)
|
|
||||||
#define MCU_STEP_TIMER 4
|
#define MCU_STEP_TIMER 4
|
||||||
#define MCU_TEMP_TIMER 2
|
#define MCU_TEMP_TIMER 2
|
||||||
#elif defined(STM32F401xC) || defined(STM32F401xE)
|
#elif defined(STM32F401xC) || defined(STM32F401xE)
|
||||||
#define MCU_TIMER_RATE (F_CPU / 2)
|
|
||||||
#define MCU_STEP_TIMER 9
|
#define MCU_STEP_TIMER 9
|
||||||
#define MCU_TEMP_TIMER 10
|
#define MCU_TEMP_TIMER 10
|
||||||
#elif defined(STM32F4xx) || defined(STM32F7xx)
|
#elif defined(STM32F4xx) || defined(STM32F7xx)
|
||||||
#define MCU_TIMER_RATE (F_CPU / 2)
|
|
||||||
#define MCU_STEP_TIMER 6 // STM32F401 has no TIM6, TIM7, or TIM8
|
#define MCU_STEP_TIMER 6 // STM32F401 has no TIM6, TIM7, or TIM8
|
||||||
#define MCU_TEMP_TIMER 14 // TIM7 is consumed by Software Serial if used.
|
#define MCU_TEMP_TIMER 14 // TIM7 is consumed by Software Serial if used.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef HAL_TIMER_RATE
|
#ifndef HAL_TIMER_RATE
|
||||||
#define HAL_TIMER_RATE MCU_TIMER_RATE
|
#define HAL_TIMER_RATE GetStepperTimerClkFreq()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef STEP_TIMER
|
#ifndef STEP_TIMER
|
||||||
#define STEP_TIMER MCU_STEP_TIMER
|
#define STEP_TIMER MCU_STEP_TIMER
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -109,12 +105,19 @@
|
||||||
// Private Variables
|
// Private Variables
|
||||||
// ------------------------
|
// ------------------------
|
||||||
|
|
||||||
HardwareTimer *timer_instance[NUM_HARDWARE_TIMERS] = { NULL };
|
HardwareTimer *timer_instance[NUM_HARDWARE_TIMERS] = { nullptr };
|
||||||
|
|
||||||
// ------------------------
|
// ------------------------
|
||||||
// Public functions
|
// Public functions
|
||||||
// ------------------------
|
// ------------------------
|
||||||
|
|
||||||
|
uint32_t GetStepperTimerClkFreq() {
|
||||||
|
// Timer input clocks vary between devices, and in some cases between timers on the same device.
|
||||||
|
// Retrieve at runtime to ensure device compatibility. Cache result to avoid repeated overhead.
|
||||||
|
static uint32_t clkfreq = timer_instance[STEP_TIMER_NUM]->getTimerClkFreq();
|
||||||
|
return clkfreq;
|
||||||
|
}
|
||||||
|
|
||||||
// frequency is in Hertz
|
// frequency is in Hertz
|
||||||
void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency) {
|
void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency) {
|
||||||
if (!HAL_timer_initialized(timer_num)) {
|
if (!HAL_timer_initialized(timer_num)) {
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,8 @@
|
||||||
#define hal_timer_t uint32_t
|
#define hal_timer_t uint32_t
|
||||||
#define HAL_TIMER_TYPE_MAX UINT16_MAX
|
#define HAL_TIMER_TYPE_MAX UINT16_MAX
|
||||||
|
|
||||||
|
#define NUM_HARDWARE_TIMERS 2
|
||||||
|
|
||||||
#ifndef STEP_TIMER_NUM
|
#ifndef STEP_TIMER_NUM
|
||||||
#define STEP_TIMER_NUM 0 // Timer Index for Stepper
|
#define STEP_TIMER_NUM 0 // Timer Index for Stepper
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -57,7 +59,8 @@
|
||||||
|
|
||||||
// TODO: get rid of manual rate/prescale/ticks/cycles taken for procedures in stepper.cpp
|
// TODO: get rid of manual rate/prescale/ticks/cycles taken for procedures in stepper.cpp
|
||||||
#define STEPPER_TIMER_RATE 2000000 // 2 Mhz
|
#define STEPPER_TIMER_RATE 2000000 // 2 Mhz
|
||||||
#define STEPPER_TIMER_PRESCALE ((HAL_TIMER_RATE)/(STEPPER_TIMER_RATE))
|
extern uint32_t GetStepperTimerClkFreq();
|
||||||
|
#define STEPPER_TIMER_PRESCALE (GetStepperTimerClkFreq() / (STEPPER_TIMER_RATE))
|
||||||
#define STEPPER_TIMER_TICKS_PER_US ((STEPPER_TIMER_RATE) / 1000000) // stepper timer ticks per µs
|
#define STEPPER_TIMER_TICKS_PER_US ((STEPPER_TIMER_RATE) / 1000000) // stepper timer ticks per µs
|
||||||
|
|
||||||
#define PULSE_TIMER_RATE STEPPER_TIMER_RATE
|
#define PULSE_TIMER_RATE STEPPER_TIMER_RATE
|
||||||
|
|
@ -102,7 +105,7 @@ void SetTimerInterruptPriorities();
|
||||||
|
|
||||||
// FORCE_INLINE because these are used in performance-critical situations
|
// FORCE_INLINE because these are used in performance-critical situations
|
||||||
FORCE_INLINE bool HAL_timer_initialized(const uint8_t timer_num) {
|
FORCE_INLINE bool HAL_timer_initialized(const uint8_t timer_num) {
|
||||||
return timer_instance[timer_num] != NULL;
|
return timer_instance[timer_num] != nullptr;
|
||||||
}
|
}
|
||||||
FORCE_INLINE static hal_timer_t HAL_timer_get_count(const uint8_t timer_num) {
|
FORCE_INLINE static hal_timer_t HAL_timer_get_count(const uint8_t timer_num) {
|
||||||
return HAL_timer_initialized(timer_num) ? timer_instance[timer_num]->getCount() : 0;
|
return HAL_timer_initialized(timer_num) ? timer_instance[timer_num]->getCount() : 0;
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
#include "../../inc/MarlinConfigPre.h"
|
#include "../../inc/MarlinConfigPre.h"
|
||||||
|
|
||||||
#if ENABLED(EMERGENCY_PARSER)
|
#if ENABLED(EMERGENCY_PARSER) && USBD_USE_CDC
|
||||||
|
|
||||||
#include "usb_serial.h"
|
#include "usb_serial.h"
|
||||||
#include "../../feature/e_parser.h"
|
#include "../../feature/e_parser.h"
|
||||||
|
|
|
||||||
|
|
@ -25,19 +25,26 @@
|
||||||
|
|
||||||
#if ENABLED(USE_WATCHDOG)
|
#if ENABLED(USE_WATCHDOG)
|
||||||
|
|
||||||
#include "../../inc/MarlinConfig.h"
|
#define WDT_TIMEOUT_US TERN(WATCHDOG_DURATION_8S, 8000000, 4000000) // 4 or 8 second timeout
|
||||||
|
|
||||||
#include "watchdog.h"
|
#include "../../inc/MarlinConfig.h"
|
||||||
#include <IWatchdog.h>
|
|
||||||
|
|
||||||
void watchdog_init() { IWatchdog.begin(4000000); } // 4 sec timeout
|
#include "watchdog.h"
|
||||||
|
#include <IWatchdog.h>
|
||||||
|
|
||||||
void HAL_watchdog_refresh() {
|
void watchdog_init() {
|
||||||
IWatchdog.reload();
|
#if DISABLED(DISABLE_WATCHDOG_INIT)
|
||||||
#if DISABLED(PINS_DEBUGGING) && PIN_EXISTS(LED)
|
IWatchdog.begin(WDT_TIMEOUT_US);
|
||||||
TOGGLE(LED_PIN); // heartbeat indicator
|
#endif
|
||||||
#endif
|
}
|
||||||
}
|
|
||||||
|
void HAL_watchdog_refresh() {
|
||||||
|
IWatchdog.reload();
|
||||||
|
#if DISABLED(PINS_DEBUGGING) && PIN_EXISTS(LED)
|
||||||
|
TOGGLE(LED_PIN); // heartbeat indicator
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
#endif // USE_WATCHDOG
|
#endif // USE_WATCHDOG
|
||||||
|
|
||||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC
|
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC
|
||||||
|
|
|
||||||
|
|
@ -97,6 +97,9 @@ const uint8_t adc_pins[] = {
|
||||||
#if HAS_TEMP_ADC_0
|
#if HAS_TEMP_ADC_0
|
||||||
TEMP_0_PIN,
|
TEMP_0_PIN,
|
||||||
#endif
|
#endif
|
||||||
|
#if HAS_TEMP_ADC_PROBE
|
||||||
|
TEMP_PROBE_PIN,
|
||||||
|
#endif
|
||||||
#if HAS_HEATED_BED
|
#if HAS_HEATED_BED
|
||||||
TEMP_BED_PIN,
|
TEMP_BED_PIN,
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -127,7 +130,7 @@ const uint8_t adc_pins[] = {
|
||||||
#if ENABLED(FILAMENT_WIDTH_SENSOR)
|
#if ENABLED(FILAMENT_WIDTH_SENSOR)
|
||||||
FILWIDTH_PIN,
|
FILWIDTH_PIN,
|
||||||
#endif
|
#endif
|
||||||
#if ENABLED(ADC_KEYPAD)
|
#if HAS_ADC_BUTTONS
|
||||||
ADC_KEYPAD_PIN,
|
ADC_KEYPAD_PIN,
|
||||||
#endif
|
#endif
|
||||||
#if HAS_JOY_ADC_X
|
#if HAS_JOY_ADC_X
|
||||||
|
|
@ -151,6 +154,9 @@ enum TempPinIndex : char {
|
||||||
#if HAS_TEMP_ADC_0
|
#if HAS_TEMP_ADC_0
|
||||||
TEMP_0,
|
TEMP_0,
|
||||||
#endif
|
#endif
|
||||||
|
#if HAS_TEMP_ADC_PROBE
|
||||||
|
TEMP_PROBE,
|
||||||
|
#endif
|
||||||
#if HAS_HEATED_BED
|
#if HAS_HEATED_BED
|
||||||
TEMP_BED,
|
TEMP_BED,
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -181,7 +187,7 @@ enum TempPinIndex : char {
|
||||||
#if ENABLED(FILAMENT_WIDTH_SENSOR)
|
#if ENABLED(FILAMENT_WIDTH_SENSOR)
|
||||||
FILWIDTH,
|
FILWIDTH,
|
||||||
#endif
|
#endif
|
||||||
#if ENABLED(ADC_KEYPAD)
|
#if HAS_ADC_BUTTONS
|
||||||
ADC_KEY,
|
ADC_KEY,
|
||||||
#endif
|
#endif
|
||||||
#if HAS_JOY_ADC_X
|
#if HAS_JOY_ADC_X
|
||||||
|
|
@ -341,6 +347,9 @@ void HAL_adc_start_conversion(const uint8_t adc_pin) {
|
||||||
#if HAS_TEMP_ADC_0
|
#if HAS_TEMP_ADC_0
|
||||||
case TEMP_0_PIN: pin_index = TEMP_0; break;
|
case TEMP_0_PIN: pin_index = TEMP_0; break;
|
||||||
#endif
|
#endif
|
||||||
|
#if HAS_TEMP_ADC_PROBE
|
||||||
|
case TEMP_PROBE_PIN: pin_index = TEMP_PROBE; break;
|
||||||
|
#endif
|
||||||
#if HAS_HEATED_BED
|
#if HAS_HEATED_BED
|
||||||
case TEMP_BED_PIN: pin_index = TEMP_BED; break;
|
case TEMP_BED_PIN: pin_index = TEMP_BED; break;
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -380,7 +389,7 @@ void HAL_adc_start_conversion(const uint8_t adc_pin) {
|
||||||
#if ENABLED(FILAMENT_WIDTH_SENSOR)
|
#if ENABLED(FILAMENT_WIDTH_SENSOR)
|
||||||
case FILWIDTH_PIN: pin_index = FILWIDTH; break;
|
case FILWIDTH_PIN: pin_index = FILWIDTH; break;
|
||||||
#endif
|
#endif
|
||||||
#if ENABLED(ADC_KEYPAD)
|
#if HAS_ADC_BUTTONS
|
||||||
case ADC_KEYPAD_PIN: pin_index = ADC_KEY; break;
|
case ADC_KEYPAD_PIN: pin_index = ADC_KEY; break;
|
||||||
#endif
|
#endif
|
||||||
#if ENABLED(POWER_MONITOR_CURRENT)
|
#if ENABLED(POWER_MONITOR_CURRENT)
|
||||||
|
|
|
||||||
|
|
@ -124,7 +124,7 @@ void HAL_idletask();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef digitalPinHasPWM
|
#ifndef digitalPinHasPWM
|
||||||
#define digitalPinHasPWM(P) (PIN_MAP[P].timer_device != nullptr)
|
#define digitalPinHasPWM(P) !!PIN_MAP[P].timer_device
|
||||||
#define NO_COMPILE_TIME_PWM
|
#define NO_COMPILE_TIME_PWM
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -185,6 +185,8 @@ void HAL_clear_reset_source();
|
||||||
// Reset reason
|
// Reset reason
|
||||||
uint8_t HAL_get_reset_source();
|
uint8_t HAL_get_reset_source();
|
||||||
|
|
||||||
|
inline void HAL_reboot() {} // reboot the board or restart the bootloader
|
||||||
|
|
||||||
void _delay_ms(const int delay);
|
void _delay_ms(const int delay);
|
||||||
|
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
|
|
@ -242,3 +244,20 @@ void analogWrite(pin_t pin, int pwm_val8); // PWM only! mul by 257 in maple!?
|
||||||
|
|
||||||
#define PLATFORM_M997_SUPPORT
|
#define PLATFORM_M997_SUPPORT
|
||||||
void flashFirmware(const int16_t);
|
void flashFirmware(const int16_t);
|
||||||
|
|
||||||
|
#define HAL_CAN_SET_PWM_FREQ // This HAL supports PWM Frequency adjustment
|
||||||
|
|
||||||
|
/**
|
||||||
|
* set_pwm_frequency
|
||||||
|
* Set the frequency of the timer corresponding to the provided pin
|
||||||
|
* All Timer 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);
|
||||||
|
|
|
||||||
|
|
@ -24,9 +24,6 @@
|
||||||
/**
|
/**
|
||||||
* Software SPI functions originally from Arduino Sd2Card Library
|
* Software SPI functions originally from Arduino Sd2Card Library
|
||||||
* Copyright (c) 2009 by William Greiman
|
* Copyright (c) 2009 by William Greiman
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adapted to the STM32F1 HAL
|
* Adapted to the STM32F1 HAL
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -113,7 +110,7 @@ void spiInit(uint8_t spiRate) {
|
||||||
* @details
|
* @details
|
||||||
*/
|
*/
|
||||||
uint8_t spiRec() {
|
uint8_t spiRec() {
|
||||||
uint8_t returnByte = SPI.transfer(ff);
|
uint8_t returnByte = SPI.transfer(0xFF);
|
||||||
return returnByte;
|
return returnByte;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -157,7 +154,7 @@ void spiSendBlock(uint8_t token, const uint8_t* buf) {
|
||||||
#if ENABLED(SPI_EEPROM)
|
#if ENABLED(SPI_EEPROM)
|
||||||
|
|
||||||
// Read single byte from specified SPI channel
|
// Read single byte from specified SPI channel
|
||||||
uint8_t spiRec(uint32_t chan) { return SPI.transfer(ff); }
|
uint8_t spiRec(uint32_t chan) { return SPI.transfer(0xFF); }
|
||||||
|
|
||||||
// Write single byte to specified SPI channel
|
// Write single byte to specified SPI channel
|
||||||
void spiSend(uint32_t chan, byte b) { SPI.send(b); }
|
void spiSend(uint32_t chan, byte b) { SPI.send(b); }
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,9 @@
|
||||||
* Marlin 3D Printer Firmware
|
* Marlin 3D Printer Firmware
|
||||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||||
*
|
*
|
||||||
|
* Based on Sprinter and grbl.
|
||||||
|
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||||
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
|
@ -18,27 +21,25 @@
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <SPI.h>
|
||||||
|
|
||||||
#ifndef HAVE_SW_SERIAL
|
/**
|
||||||
#define SW_SERIAL_PLACEHOLDER 1
|
* Marlin currently requires 3 SPI classes:
|
||||||
#endif
|
*
|
||||||
|
* SPIClass:
|
||||||
|
* This class is normally provided by frameworks and has a semi-default interface.
|
||||||
|
* This is needed because some libraries reference it globally.
|
||||||
|
*
|
||||||
|
* SPISettings:
|
||||||
|
* Container for SPI configs for SPIClass. As above, libraries may reference it globally.
|
||||||
|
*
|
||||||
|
* These two classes are often provided by frameworks so we cannot extend them to add
|
||||||
|
* useful methods for Marlin.
|
||||||
|
*
|
||||||
|
* MarlinSPI:
|
||||||
|
* Provides the default SPIClass interface plus some Marlin goodies such as a simplified
|
||||||
|
* interface for SPI DMA transfer.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
class SoftwareSerial {
|
using MarlinSPI = SPIClass;
|
||||||
public:
|
|
||||||
SoftwareSerial(int8_t RX_pin, int8_t TX_pin);
|
|
||||||
|
|
||||||
void begin(const uint32_t baudrate);
|
|
||||||
|
|
||||||
bool available();
|
|
||||||
|
|
||||||
uint8_t read();
|
|
||||||
uint16_t write(uint8_t byte);
|
|
||||||
void flush();
|
|
||||||
|
|
||||||
void listen();
|
|
||||||
void stopListening();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
bool listening;
|
|
||||||
};
|
|
||||||
|
|
@ -147,6 +147,18 @@ SPIClass::SPIClass(uint32_t spi_num) {
|
||||||
_currentSetting->state = SPI_STATE_IDLE;
|
_currentSetting->state = SPI_STATE_IDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SPIClass::SPIClass(int8_t mosi, int8_t miso, int8_t sclk, int8_t ssel) {
|
||||||
|
#if BOARD_NR_SPI >= 1
|
||||||
|
if (mosi == BOARD_SPI1_MOSI_PIN) SPIClass(1);
|
||||||
|
#endif
|
||||||
|
#if BOARD_NR_SPI >= 2
|
||||||
|
if (mosi == BOARD_SPI2_MOSI_PIN) SPIClass(2);
|
||||||
|
#endif
|
||||||
|
#if BOARD_NR_SPI >= 3
|
||||||
|
if (mosi == BOARD_SPI3_MOSI_PIN) SPIClass(3);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set up/tear down
|
* Set up/tear down
|
||||||
*/
|
*/
|
||||||
|
|
@ -656,7 +668,7 @@ static const spi_pins* dev_to_spi_pins(spi_dev *dev) {
|
||||||
#if BOARD_NR_SPI >= 3
|
#if BOARD_NR_SPI >= 3
|
||||||
case RCC_SPI3: return board_spi_pins + 2;
|
case RCC_SPI3: return board_spi_pins + 2;
|
||||||
#endif
|
#endif
|
||||||
default: return NULL;
|
default: return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -163,6 +163,11 @@ public:
|
||||||
*/
|
*/
|
||||||
SPIClass(uint32_t spiPortNumber);
|
SPIClass(uint32_t spiPortNumber);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Init using pins
|
||||||
|
*/
|
||||||
|
SPIClass(int8_t mosi, int8_t miso, int8_t sclk, int8_t ssel=-1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Equivalent to begin(SPI_1_125MHZ, MSBFIRST, 0).
|
* @brief Equivalent to begin(SPI_1_125MHZ, MSBFIRST, 0).
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -1,60 +0,0 @@
|
||||||
/**
|
|
||||||
* Marlin 3D Printer Firmware
|
|
||||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#if defined(__STM32F1__) && !defined(HAVE_SW_SERIAL)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Empty class for Software Serial implementation (Custom RX/TX pins)
|
|
||||||
*
|
|
||||||
* TODO: Optionally use https://github.com/FYSETC/SoftwareSerialM if TMC UART is wanted
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "SoftwareSerial.h"
|
|
||||||
|
|
||||||
// Constructor
|
|
||||||
|
|
||||||
SoftwareSerial::SoftwareSerial(int8_t RX_pin, int8_t TX_pin) {}
|
|
||||||
|
|
||||||
// Public
|
|
||||||
|
|
||||||
void SoftwareSerial::begin(const uint32_t baudrate) {
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SoftwareSerial::available() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t SoftwareSerial::read() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint16_t SoftwareSerial::write(uint8_t byte) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SoftwareSerial::flush() {}
|
|
||||||
|
|
||||||
void SoftwareSerial::listen() {
|
|
||||||
listening = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SoftwareSerial::stopListening() {
|
|
||||||
listening = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // __STM32F1__
|
|
||||||
|
|
@ -3,7 +3,7 @@ import sys
|
||||||
|
|
||||||
#dynamic build flags for generic compile options
|
#dynamic build flags for generic compile options
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
args = " ".join([ "-std=gnu11",
|
args = " ".join([ "-std=gnu++14",
|
||||||
"-Os",
|
"-Os",
|
||||||
"-mcpu=cortex-m3",
|
"-mcpu=cortex-m3",
|
||||||
"-mthumb",
|
"-mthumb",
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,6 @@
|
||||||
|
|
||||||
#if BOTH(HAS_MARLINUI_U8GLIB, FORCE_SOFT_SPI)
|
#if BOTH(HAS_MARLINUI_U8GLIB, FORCE_SOFT_SPI)
|
||||||
|
|
||||||
#include "../HAL.h"
|
|
||||||
#include <U8glib.h>
|
#include <U8glib.h>
|
||||||
|
|
||||||
#undef SPI_SPEED
|
#undef SPI_SPEED
|
||||||
|
|
@ -161,5 +160,5 @@ uint8_t u8g_com_HAL_STM32F1_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val,
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // HAS_MARLINUI_U8GLIB
|
#endif // HAS_MARLINUI_U8GLIB && FORCE_SOFT_SPI
|
||||||
#endif // STM32F1
|
#endif // STM32F1
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,8 @@
|
||||||
* with simple implementations supplied by Marlin.
|
* with simple implementations supplied by Marlin.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef __STM32F1__
|
||||||
|
|
||||||
#include "../../inc/MarlinConfig.h"
|
#include "../../inc/MarlinConfig.h"
|
||||||
|
|
||||||
#if ENABLED(IIC_BL24CXX_EEPROM)
|
#if ENABLED(IIC_BL24CXX_EEPROM)
|
||||||
|
|
@ -66,7 +68,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||||
do {
|
do {
|
||||||
uint8_t * const p = (uint8_t * const)pos;
|
uint8_t * const p = (uint8_t * const)pos;
|
||||||
uint8_t c = eeprom_read_byte(p);
|
uint8_t c = eeprom_read_byte(p);
|
||||||
|
|
@ -79,3 +81,4 @@ bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // IIC_BL24CXX_EEPROM
|
#endif // IIC_BL24CXX_EEPROM
|
||||||
|
#endif // __STM32F1__
|
||||||
|
|
|
||||||
|
|
@ -101,7 +101,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
|
||||||
return false; // return true for any error
|
return false; // return true for any error
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PersistentStore::read_data(int &pos, uint8_t* value, const size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
bool PersistentStore::read_data(int &pos, uint8_t *value, const size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||||
const uint8_t * const buff = writing ? &value[0] : &ram_eeprom[pos];
|
const uint8_t * const buff = writing ? &value[0] : &ram_eeprom[pos];
|
||||||
if (writing) for (size_t i = 0; i < size; i++) value[i] = ram_eeprom[pos + i];
|
if (writing) for (size_t i = 0; i < size; i++) value[i] = ram_eeprom[pos + i];
|
||||||
crc16(crc, buff, size);
|
crc16(crc, buff, size);
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,8 @@
|
||||||
* Enable USE_SHARED_EEPROM if not supplied by the framework.
|
* Enable USE_SHARED_EEPROM if not supplied by the framework.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef __STM32F1__
|
||||||
|
|
||||||
#include "../../inc/MarlinConfig.h"
|
#include "../../inc/MarlinConfig.h"
|
||||||
|
|
||||||
#if ENABLED(IIC_BL24CXX_EEPROM)
|
#if ENABLED(IIC_BL24CXX_EEPROM)
|
||||||
|
|
@ -49,3 +51,4 @@ uint8_t eeprom_read_byte(uint8_t *pos) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // IIC_BL24CXX_EEPROM
|
#endif // IIC_BL24CXX_EEPROM
|
||||||
|
#endif // __STM32F1__
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PersistentStore::read_data(int &pos, uint8_t* value, const size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
bool PersistentStore::read_data(int &pos, uint8_t *value, const size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||||
for (size_t i = 0; i < size; i++) {
|
for (size_t i = 0; i < size; i++) {
|
||||||
uint8_t c = HAL_eeprom_data[pos + i];
|
uint8_t c = HAL_eeprom_data[pos + i];
|
||||||
if (writing) value[i] = c;
|
if (writing) value[i] = c;
|
||||||
|
|
|
||||||
|
|
@ -17,17 +17,17 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HAL PersistentStore for STM32F1
|
||||||
|
*/
|
||||||
|
|
||||||
#ifdef __STM32F1__
|
#ifdef __STM32F1__
|
||||||
|
|
||||||
#include "../../inc/MarlinConfig.h"
|
#include "../../inc/MarlinConfig.h"
|
||||||
|
|
||||||
#if USE_WIRED_EEPROM
|
#if USE_WIRED_EEPROM
|
||||||
|
|
||||||
/**
|
|
||||||
* PersistentStore for Arduino-style EEPROM interface
|
|
||||||
* with simple implementations supplied by Marlin.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "../shared/eeprom_if.h"
|
#include "../shared/eeprom_if.h"
|
||||||
#include "../shared/eeprom_api.h"
|
#include "../shared/eeprom_api.h"
|
||||||
|
|
||||||
|
|
@ -72,7 +72,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||||
do {
|
do {
|
||||||
uint8_t c = eeprom_read_byte((uint8_t*)pos);
|
uint8_t c = eeprom_read_byte((uint8_t*)pos);
|
||||||
if (writing && value) *value = c;
|
if (writing && value) *value = c;
|
||||||
|
|
|
||||||
68
Marlin/src/HAL/STM32F1/fast_pwm.cpp
Normal file
68
Marlin/src/HAL/STM32F1/fast_pwm.cpp
Normal file
|
|
@ -0,0 +1,68 @@
|
||||||
|
/**
|
||||||
|
* Marlin 3D Printer Firmware
|
||||||
|
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||||
|
*
|
||||||
|
* Based on Sprinter and grbl.
|
||||||
|
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#ifdef __STM32F1__
|
||||||
|
|
||||||
|
#include "../../inc/MarlinConfigPre.h"
|
||||||
|
|
||||||
|
#if NEEDS_HARDWARE_PWM
|
||||||
|
|
||||||
|
#include <pwm.h>
|
||||||
|
#include "HAL.h"
|
||||||
|
#include "timers.h"
|
||||||
|
|
||||||
|
void set_pwm_frequency(const pin_t pin, int f_desired) {
|
||||||
|
if (!PWM_PIN(pin)) return; // Don't proceed if no hardware timer
|
||||||
|
|
||||||
|
timer_dev *timer = PIN_MAP[pin].timer_device;
|
||||||
|
uint8_t channel = PIN_MAP[pin].timer_channel;
|
||||||
|
|
||||||
|
// Protect used timers
|
||||||
|
if (timer == get_timer_dev(TEMP_TIMER_NUM)) return;
|
||||||
|
if (timer == get_timer_dev(STEP_TIMER_NUM)) return;
|
||||||
|
#if PULSE_TIMER_NUM != STEP_TIMER_NUM
|
||||||
|
if (timer == get_timer_dev(PULSE_TIMER_NUM)) return;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (!(timer->regs.bas->SR & TIMER_CR1_CEN)) // Ensure the timer is enabled
|
||||||
|
timer_init(timer);
|
||||||
|
|
||||||
|
timer_set_mode(timer, channel, TIMER_PWM);
|
||||||
|
uint16_t preload = 255; // Lock 255 PWM resolution for high frequencies
|
||||||
|
int32_t prescaler = (HAL_TIMER_RATE) / (preload + 1) / f_desired - 1;
|
||||||
|
if (prescaler > 65535) { // For low frequencies increase prescaler
|
||||||
|
prescaler = 65535;
|
||||||
|
preload = (HAL_TIMER_RATE) / (prescaler + 1) / f_desired - 1;
|
||||||
|
}
|
||||||
|
if (prescaler < 0) return; // Too high frequency
|
||||||
|
timer_set_reload(timer, preload);
|
||||||
|
timer_set_prescaler(timer, prescaler);
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t v_size/*=255*/, const bool invert/*=false*/) {
|
||||||
|
timer_dev *timer = PIN_MAP[pin].timer_device;
|
||||||
|
uint16_t max_val = timer->regs.bas->ARR * v / v_size;
|
||||||
|
if (invert) max_val = v_size - max_val;
|
||||||
|
pwmWrite(pin, max_val);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // NEEDS_HARDWARE_PWM
|
||||||
|
#endif // __STM32F1__
|
||||||
|
|
@ -51,7 +51,7 @@
|
||||||
#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_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 || _GET_MODE(IO) == GPIO_OUTPUT_OD)
|
#define IS_OUTPUT(IO) (_GET_MODE(IO) == GPIO_OUTPUT_PP || _GET_MODE(IO) == GPIO_OUTPUT_OD)
|
||||||
|
|
||||||
#define PWM_PIN(IO) (PIN_MAP[IO].timer_device != nullptr)
|
#define PWM_PIN(IO) !!PIN_MAP[IO].timer_device
|
||||||
|
|
||||||
// digitalRead/Write wrappers
|
// digitalRead/Write wrappers
|
||||||
#define extDigitalRead(IO) digitalRead(IO)
|
#define extDigitalRead(IO) digitalRead(IO)
|
||||||
|
|
|
||||||
|
|
@ -25,10 +25,3 @@
|
||||||
//#warning "SD_CHECK_AND_RETRY isn't needed with USE_USB_COMPOSITE."
|
//#warning "SD_CHECK_AND_RETRY isn't needed with USE_USB_COMPOSITE."
|
||||||
#undef SD_CHECK_AND_RETRY
|
#undef SD_CHECK_AND_RETRY
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// This emulated DOGM has 'touch/xpt2046', not 'tft/xpt2046'
|
|
||||||
#if ENABLED(TOUCH_SCREEN) && !HAS_GRAPHICAL_TFT
|
|
||||||
#undef TOUCH_SCREEN
|
|
||||||
#undef TOUCH_SCREEN_CALIBRATION
|
|
||||||
#define HAS_TOUCH_XPT2046 1
|
|
||||||
#endif
|
|
||||||
|
|
|
||||||
|
|
@ -25,15 +25,6 @@
|
||||||
* Test STM32F1-specific configuration values for errors at compile-time.
|
* Test STM32F1-specific configuration values for errors at compile-time.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if ENABLED(FAST_PWM_FAN) || SPINDLE_LASER_FREQUENCY
|
|
||||||
#error "Features requiring Hardware PWM (FAST_PWM_FAN, SPINDLE_LASER_FREQUENCY) are not yet supported on STM32F1."
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(HAVE_SW_SERIAL) && HAS_TMC_SW_SERIAL
|
|
||||||
#warning "With TMC2208/9 consider using SoftwareSerialM with HAVE_SW_SERIAL and appropriate SS_TIMER."
|
|
||||||
#error "Missing SoftwareSerial implementation."
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if ENABLED(SDCARD_EEPROM_EMULATION) && DISABLED(SDSUPPORT)
|
#if ENABLED(SDCARD_EEPROM_EMULATION) && DISABLED(SDSUPPORT)
|
||||||
#undef SDCARD_EEPROM_EMULATION // Avoid additional error noise
|
#undef SDCARD_EEPROM_EMULATION // Avoid additional error noise
|
||||||
#if USE_FALLBACK_EEPROM
|
#if USE_FALLBACK_EEPROM
|
||||||
|
|
@ -51,3 +42,10 @@
|
||||||
#if ENABLED(NEOPIXEL_LED)
|
#if ENABLED(NEOPIXEL_LED)
|
||||||
#error "NEOPIXEL_LED (Adafruit NeoPixel) is not supported for HAL/STM32F1. Comment out this line to proceed at your own risk!"
|
#error "NEOPIXEL_LED (Adafruit NeoPixel) is not supported for HAL/STM32F1. Comment out this line to proceed at your own risk!"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Emergency Parser needs at least one serial with HardwareSerial or USBComposite.
|
||||||
|
// The USBSerial maple don't allow any hook to implement EMERGENCY_PARSER.
|
||||||
|
// And copy all USBSerial code to marlin space to support EMERGENCY_PARSER, when we have another options, don't worth it.
|
||||||
|
#if ENABLED(EMERGENCY_PARSER) && !defined(USE_USB_COMPOSITE) && ((SERIAL_PORT == -1 && !defined(SERIAL_PORT_2)) || (SERIAL_PORT_2 == -1 && !defined(SERIAL_PORT)))
|
||||||
|
#error "EMERGENCY_PARSER is only supported by HardwareSerial or USBComposite in HAL/STM32F1."
|
||||||
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#ifdef USE_USB_COMPOSITE
|
#if defined(__STM32F1__) && defined(USE_USB_COMPOSITE)
|
||||||
|
|
||||||
#include "msc_sd.h"
|
#include "msc_sd.h"
|
||||||
#include "SPI.h"
|
#include "SPI.h"
|
||||||
|
|
@ -77,4 +77,4 @@ void MSC_SD_init() {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // USE_USB_COMPOSITE
|
#endif // __STM32F1__ && USE_USB_COMPOSITE
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue