Compare commits

..

31 Commits

Author SHA1 Message Date
InsanityAutomation 988140a467 Update Configuration_adv.h 2021-03-20 13:42:07 -04:00
InsanityAutomation c320503d78 Merge branch 'bugfix-2.0.x' into FunmatHT 2021-03-20 12:30:49 -04:00
InsanityAutomation d90d15817c Merge branch 'bugfix-2.0.x' of https://github.com/MarlinFirmware/Marlin into bugfix-2.0.x 2021-03-20 11:16:35 -04:00
InsanityAutomation 4479f438fd Merge branch 'FunmatHT' of https://github.com/InsanityAutomation/Marlin into FunmatHT 2021-03-20 11:16:23 -04:00
InsanityAutomation e05616ada1 Merge branch 'bugfix-2.0.x' of https://github.com/MarlinFirmware/Marlin into bugfix-2.0.x 2021-03-12 16:16:33 -05:00
InsanityAutomation b4402a789a Merge branch 'bugfix-2.0.x' of https://github.com/MarlinFirmware/Marlin into bugfix-2.0.x 2021-03-06 14:13:22 -05:00
InsanityAutomation b385758e22 Merge branch 'bugfix-2.0.x' of https://github.com/MarlinFirmware/Marlin into bugfix-2.0.x 2021-02-27 11:17:18 -05:00
Marcio T 34cda524c4 LVGL Touch UI followup (#21167) 2021-02-22 22:38:54 -06:00
InsanityAutomation 900047298e Update pins_INTAMSYS40.h 2020-08-01 12:56:16 -04:00
InsanityAutomation c86c85437f Update Configuration_adv.h 2020-08-01 12:54:39 -04:00
InsanityAutomation 18d0e1b365 Update Configuration.h 2020-08-01 12:54:38 -04:00
InsanityAutomation a34b4471b5 more config 2020-08-01 12:54:38 -04:00
InsanityAutomation ae9372bc16 ITS ALIVE! 2020-08-01 12:53:45 -04:00
InsanityAutomation 848e9ea241 progress 2020-08-01 12:53:39 -04:00
InsanityAutomation d21d6f6c9e Support all but motion 2020-08-01 12:52:13 -04:00
InsanityAutomation b35d0c61b9 Merge branch 'bugfix-2.0.x' of https://github.com/MarlinFirmware/Marlin into bugfix-2.0.x 2020-08-01 12:49:56 -04:00
InsanityAutomation 5c1c99da0c Update Configuration_adv.h 2020-07-23 11:47:55 -04:00
InsanityAutomation 261778e540 Merge branch 'bugfix-2.0.x' of https://github.com/MarlinFirmware/Marlin into bugfix-2.0.x 2020-03-30 20:11:40 -04:00
InsanityAutomation 6ee6205e18 Update Configuration.h 2020-03-26 12:25:08 -04:00
InsanityAutomation d47ceb2e8b more config 2020-03-26 10:55:46 -04:00
InsanityAutomation 75beeb7b25 Update pins_INTAMSYS40.h 2020-03-26 09:54:50 -04:00
InsanityAutomation 522735b858 ITS ALIVE! 2020-03-26 09:54:50 -04:00
InsanityAutomation 4f7d610c96 progress 2020-03-26 09:54:50 -04:00
InsanityAutomation d2cee0be7a Support all but motion 2020-03-26 09:54:49 -04:00
InsanityAutomation 20c60fe8f1 Merge branch 'bugfix-2.0.x' of https://github.com/MarlinFirmware/Marlin into bugfix-2.0.x 2020-03-26 09:54:31 -04:00
InsanityAutomation 877b3c65f9 Merge branch 'bugfix-2.0.x' of https://github.com/MarlinFirmware/Marlin into bugfix-2.0.x 2020-03-14 16:28:14 -04:00
InsanityAutomation aa9b6280ff Merge branch 'bugfix-2.0.x' of https://github.com/MarlinFirmware/Marlin into bugfix-2.0.x 2020-01-29 23:12:48 -05:00
InsanityAutomation 2a9ecf46a5 Merge branch 'bugfix-2.0.x' of https://github.com/MarlinFirmware/Marlin into bugfix-2.0.x 2020-01-27 20:52:29 -05:00
InsanityAutomation cf9a8e184e Merge branch 'bugfix-2.0.x' of https://github.com/MarlinFirmware/Marlin into bugfix-2.0.x 2020-01-18 23:29:55 -05:00
InsanityAutomation b12fe74d75 Merge branch 'bugfix-2.0.x' of https://github.com/MarlinFirmware/Marlin into bugfix-2.0.x 2020-01-02 23:00:52 -05:00
Scott Lahteine 8b927a283e Fix binary protocol buffer overrun 2019-10-07 19:13:53 -05:00
1180 changed files with 21172 additions and 39766 deletions
+2 -2
View File
@@ -4,10 +4,10 @@ root = true
[{*.patch,syntax_test_*}] [{*.patch,syntax_test_*}]
trim_trailing_whitespace = false trim_trailing_whitespace = false
[{*.c,*.cpp,*.h,*.ino}] [{*.c,*.cpp,*.h}]
charset = utf-8 charset = utf-8
[{*.c,*.cpp,*.h,*.ino,Makefile}] [{*.c,*.cpp,*.h,Makefile}]
trim_trailing_whitespace = true trim_trailing_whitespace = true
insert_final_newline = true insert_final_newline = true
end_of_line = lf end_of_line = lf
+9 -16
View File
@@ -56,31 +56,28 @@ jobs:
# STM32F1 (Maple) Environments # STM32F1 (Maple) Environments
#- STM32F103RC_btt_maple - STM32F103RC_btt
- STM32F103RC_btt_USB_maple - STM32F103RC_btt_USB
- STM32F103RE_btt
- STM32F103RE_btt_USB
- STM32F103RC_fysetc - STM32F103RC_fysetc
- STM32F103RC_meeb - STM32F103RC_meeb
- jgaurora_a5s_a1 - jgaurora_a5s_a1
- STM32F103VE_longer - STM32F103VE_longer
#- mks_robin_maple - mks_robin
- mks_robin_lite - mks_robin_lite
- mks_robin_pro - mks_robin_pro
#- mks_robin_nano35_maple - STM32F103RET6_creality
#- STM32F103RET6_creality_maple - mks_robin_nano35
# STM32 (ST) Environments # STM32 (ST) Environments
- STM32F103RC_btt
#- STM32F103RC_btt_USB
- STM32F103RE_btt
- STM32F103RE_btt_USB
- STM32F103RET6_creality
- STM32F407VE_black - STM32F407VE_black
- STM32F401VE_STEVAL - STM32F401VE_STEVAL
- BIGTREE_BTT002 - BIGTREE_BTT002
- BIGTREE_SKR_PRO - BIGTREE_SKR_PRO
- BIGTREE_GTR_V1_0 - BIGTREE_GTR_V1_0
- mks_robin - mks_robin_stm32
- ARMED - ARMED
- FYSETC_S6 - FYSETC_S6
- STM32F070CB_malyan - STM32F070CB_malyan
@@ -89,12 +86,9 @@ jobs:
- FLYF407ZG - FLYF407ZG
- rumba32 - rumba32
- LERDGEX - LERDGEX
- LERDGEK - mks_robin_nano35_stm32
- mks_robin_nano35
- NUCLEO_F767ZI - NUCLEO_F767ZI
- REMRAM_V1 - REMRAM_V1
- BTT_SKR_SE_BX
- chitu_f103
# Put lengthy tests last # Put lengthy tests last
@@ -104,7 +98,6 @@ jobs:
# Non-working environment tests # Non-working environment tests
#- at90usb1286_cdc #- at90usb1286_cdc
#- STM32F103CB_malyan #- STM32F103CB_malyan
#- STM32F103RE
#- mks_robin_mini #- mks_robin_mini
steps: steps:
+23
View File
@@ -122,6 +122,29 @@ tags
.gcc-flags.json .gcc-flags.json
/lib/ /lib/
# Workaround for Deviot+platformio quirks
Marlin/lib
Marlin/platformio.ini
Marlin/*/platformio.ini
Marlin/*/*/platformio.ini
Marlin/*/*/*/platformio.ini
Marlin/*/*/*/*/platformio.ini
Marlin/.travis.yml
Marlin/*/.travis.yml
Marlin/*/*/.travis.yml
Marlin/*/*/*/.travis.yml
Marlin/*/*/*/*/.travis.yml
Marlin/.gitignore
Marlin/*/.gitignore
Marlin/*/*/.gitignore
Marlin/*/*/*/.gitignore
Marlin/*/*/*/*/.gitignore
Marlin/readme.txt
Marlin/*/readme.txt
Marlin/*/*/readme.txt
Marlin/*/*/*/readme.txt
Marlin/*/*/*/*/readme.txt
# Secure Credentials # Secure Credentials
Configuration_Secure.h Configuration_Secure.h
+93 -240
View File
@@ -1,5 +1,4 @@
/** /** 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. * Based on Sprinter and grbl.
@@ -35,7 +34,7 @@
* *
* Advanced settings can be found in Configuration_adv.h * Advanced settings can be found in Configuration_adv.h
*/ */
#define CONFIGURATION_H_VERSION 02000900 #define CONFIGURATION_H_VERSION 020008
//=========================================================================== //===========================================================================
//============================= Getting Started ============================= //============================= Getting Started =============================
@@ -66,19 +65,11 @@
// //
//=========================================================================== //===========================================================================
//===========================================================================
//=========================== FOAMCUTTER_XYUV ==============================
//===========================================================================
// For a hot wire cutter with parallel horizontal axes X, I where the hights
// of the two wire ends are controlled by parallel axes Y, J.
//
//#define FOAMCUTTER_XYUV
// @section info // @section info
// Author info of this build printed to the host during boot and M115 // Author info of this build printed to the host during boot and M115
#define STRING_CONFIG_H_AUTHOR "InsanityAutomation" // Who made the changes. #define STRING_CONFIG_H_AUTHOR "3DXtech / Insanity Automation" // Who made the changes.
#define CUSTOM_VERSION_FILE Version.h // Path from the root directory (no quotes) //#define CUSTOM_VERSION_FILE Version.h // Path from the root directory (no quotes)
/** /**
* *** VENDORS PLEASE READ *** * *** VENDORS PLEASE READ ***
@@ -95,7 +86,7 @@
#define SHOW_BOOTSCREEN #define SHOW_BOOTSCREEN
// Show the bitmap in Marlin/_Bootscreen.h on startup. // Show the bitmap in Marlin/_Bootscreen.h on startup.
#define SHOW_CUSTOM_BOOTSCREEN //#define SHOW_CUSTOM_BOOTSCREEN
// Show the bitmap in Marlin/_Statusscreen.h on the status screen. // Show the bitmap in Marlin/_Statusscreen.h on the status screen.
//#define CUSTOM_STATUS_SCREEN_IMAGE //#define CUSTOM_STATUS_SCREEN_IMAGE
@@ -113,9 +104,14 @@
#define SERIAL_PORT 0 #define SERIAL_PORT 0
/** /**
* Serial Port Baud Rate * Select a secondary serial port on the board to use for communication with the host.
* This is the default communication speed for all serial ports. * Currently Ethernet (-2) is only supported on Teensy 4.1 boards.
* Set the baud rate defaults for additional serial ports below. * :[-2, -1, 0, 1, 2, 3, 4, 5, 6, 7]
*/
//#define SERIAL_PORT_2 -1
/**
* This setting determines the communication speed of the printer.
* *
* 250000 works in most cases, but you might try a lower speed if * 250000 works in most cases, but you might try a lower speed if
* you commonly experience drop-outs during host printing. * you commonly experience drop-outs during host printing.
@@ -124,30 +120,13 @@
* :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000] * :[2400, 9600, 19200, 38400, 57600, 115200, 250000, 500000, 1000000]
*/ */
#define BAUDRATE 250000 #define BAUDRATE 250000
//#define BAUD_RATE_GCODE // Enable G-code M575 to set the baud rate
/**
* Select a secondary serial port on the board to use for communication with the host.
* 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 BAUDRATE_2 250000 // Enable to override BAUDRATE
/**
* Select a third serial port on the board to use for communication with the host.
* Currently only supported for AVR, DUE, LPC1768/9 and STM32/STM32F1
* :[-1, 0, 1, 2, 3, 4, 5, 6, 7]
*/
//#define SERIAL_PORT_3 1
//#define BAUDRATE_3 250000 // Enable to override BAUDRATE
// Enable the Bluetooth serial interface on AT90USB devices // Enable the Bluetooth serial interface on AT90USB devices
//#define BLUETOOTH //#define BLUETOOTH
// Choose the name from boards.h that matches your setup // Choose the name from boards.h that matches your setup
#ifndef MOTHERBOARD #ifndef MOTHERBOARD
#define MOTHERBOARD BOARD_RAMPS_14_EFB #define MOTHERBOARD BOARD_INTAMSYS40
#endif #endif
// Name displayed in the LCD "Ready" message and Info menu // Name displayed in the LCD "Ready" message and Info menu
@@ -157,45 +136,6 @@
// Choose your own or use a service like https://www.uuidgenerator.net/version4 // Choose your own or use a service like https://www.uuidgenerator.net/version4
//#define MACHINE_UUID "00000000-0000-0000-0000-000000000000" //#define MACHINE_UUID "00000000-0000-0000-0000-000000000000"
/**
* Define the number of coordinated linear axes.
* See https://github.com/DerAndere1/Marlin/wiki
* Each linear axis gets its own stepper control and endstop:
*
* Steppers: *_STEP_PIN, *_ENABLE_PIN, *_DIR_PIN, *_ENABLE_ON
* Endstops: *_STOP_PIN, USE_*MIN_PLUG, USE_*MAX_PLUG
* Axes: *_MIN_POS, *_MAX_POS, INVERT_*_DIR
* Planner: DEFAULT_AXIS_STEPS_PER_UNIT, DEFAULT_MAX_FEEDRATE
* DEFAULT_MAX_ACCELERATION, AXIS_RELATIVE_MODES,
* MICROSTEP_MODES, MANUAL_FEEDRATE
*
* :[3, 4, 5, 6]
*/
//#define LINEAR_AXES 3
/**
* Axis codes for additional axes:
* This defines the axis code that is used in G-code commands to
* reference a specific axis.
* 'A' for rotational axis parallel to X
* 'B' for rotational axis parallel to Y
* 'C' for rotational axis parallel to Z
* 'U' for secondary linear axis parallel to X
* 'V' for secondary linear axis parallel to Y
* 'W' for secondary linear axis parallel to Z
* Regardless of the settings, firmware-internal axis IDs are
* I (AXIS4), J (AXIS5), K (AXIS6).
*/
#if LINEAR_AXES >= 4
#define AXIS4_NAME 'A' // :['A', 'B', 'C', 'U', 'V', 'W']
#endif
#if LINEAR_AXES >= 5
#define AXIS5_NAME 'B' // :['A', 'B', 'C', 'U', 'V', 'W']
#endif
#if LINEAR_AXES >= 6
#define AXIS6_NAME 'C' // :['A', 'B', 'C', 'U', 'V', 'W']
#endif
// @section extruder // @section extruder
// This defines the number of extruders // This defines the number of extruders
@@ -219,11 +159,11 @@
* Multi-Material Unit * Multi-Material Unit
* Set to one of these predefined models: * Set to one of these predefined models:
* *
* PRUSA_MMU1 : Průša MMU1 (The "multiplexer" version) * PRUSA_MMU1 : Průša MMU1 (The "multiplexer" version)
* PRUSA_MMU2 : Průša MMU2 * PRUSA_MMU2 : Průša MMU2
* PRUSA_MMU2S : Průša MMU2S (Requires MK3S extruder with motion sensor, EXTRUDERS = 5) * PRUSA_MMU2S : Průša MMU2S (Requires MK3S extruder with motion sensor, EXTRUDERS = 5)
* EXTENDABLE_EMU_MMU2 : MMU with configurable number of filaments (ERCF, SMuFF or similar with Průša MMU2 compatible firmware) * SMUFF_EMU_MMU2 : Technik Gegg SMuFF (Průša MMU2 emulation mode)
* EXTENDABLE_EMU_MMU2S : MMUS with configurable number of filaments (ERCF, SMuFF or similar with Průša MMU2 compatible firmware) * SMUFF_EMU_MMU2S : Technik Gegg SMuFF (Průša MMU2S emulation mode)
* *
* Requires NOZZLE_PARK_FEATURE to park print head in case MMU unit fails. * Requires NOZZLE_PARK_FEATURE to park print head in case MMU unit fails.
* See additional options in Configuration_adv.h. * See additional options in Configuration_adv.h.
@@ -370,29 +310,29 @@
* Enable and connect the power supply to the PS_ON_PIN. * Enable and connect the power supply to the PS_ON_PIN.
* Specify whether the power supply is active HIGH or active LOW. * Specify whether the power supply is active HIGH or active LOW.
*/ */
//#define PSU_CONTROL #define PSU_CONTROL
//#define PSU_NAME "Power Supply" //#define PSU_NAME "Power Supply"
#if ENABLED(PSU_CONTROL) #if ENABLED(PSU_CONTROL)
#define PSU_ACTIVE_STATE LOW // Set 'LOW' for ATX, 'HIGH' for X-Box #define PSU_ACTIVE_STATE HIGH // Set 'LOW' for ATX, 'HIGH' for X-Box
//#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_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 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_COOLER_FAN #define AUTO_POWER_COOLER_FAN
//#define AUTO_POWER_E_TEMP 50 // (°C) Turn on PSU if any extruder is 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 if the chamber is over this temperature #define AUTO_POWER_CHAMBER_TEMP 30 // (°C) Turn on PSU if the chamber is over this temperature
//#define AUTO_POWER_COOLER_TEMP 26 // (°C) Turn on PSU if the cooler is over this temperature //#define AUTO_POWER_COOLER_TEMP 26 // (°C) Turn on PSU if the cooler is over this temperature
#define POWER_TIMEOUT 30 // (s) Turn off power if the machine is idle for this duration #define POWER_TIMEOUT 120 // (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. //#define POWER_OFF_DELAY 60 // (s) Delay of poweroff after M81 command. Useful to let fans run for extra time.
#endif #endif
#endif #endif
@@ -468,7 +408,7 @@
* 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below. * 998 : Dummy Table that ALWAYS reads 25°C or the temperature defined below.
* 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below. * 999 : Dummy Table that ALWAYS reads 100°C or the temperature defined below.
*/ */
#define TEMP_SENSOR_0 1 #define TEMP_SENSOR_0 20
#define TEMP_SENSOR_1 0 #define TEMP_SENSOR_1 0
#define TEMP_SENSOR_2 0 #define TEMP_SENSOR_2 0
#define TEMP_SENSOR_3 0 #define TEMP_SENSOR_3 0
@@ -478,7 +418,7 @@
#define TEMP_SENSOR_7 0 #define TEMP_SENSOR_7 0
#define TEMP_SENSOR_BED 1 #define TEMP_SENSOR_BED 1
#define TEMP_SENSOR_PROBE 0 #define TEMP_SENSOR_PROBE 0
#define TEMP_SENSOR_CHAMBER 0 #define TEMP_SENSOR_CHAMBER 1
#define TEMP_SENSOR_COOLER 0 #define TEMP_SENSOR_COOLER 0
// Dummy thermistor constant temperature readings, for use with 998 and 999 // Dummy thermistor constant temperature readings, for use with 998 and 999
@@ -496,17 +436,17 @@
//#define TEMP_SENSOR_1_AS_REDUNDANT //#define TEMP_SENSOR_1_AS_REDUNDANT
#define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10 #define MAX_REDUNDANT_TEMP_SENSOR_DIFF 10
#define TEMP_RESIDENCY_TIME 5 // (seconds) Time to wait for hotend to "settle" in M109 #define TEMP_RESIDENCY_TIME 3 // (seconds) Time to wait for hotend to "settle" in M109
#define TEMP_WINDOW 3 // (°C) Temperature proximity for the "temperature reached" timer #define TEMP_WINDOW 3 // (°C) Temperature proximity for the "temperature reached" timer
#define TEMP_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target #define TEMP_HYSTERESIS 5 // (°C) Temperature proximity considered "close enough" to the target
#define TEMP_BED_RESIDENCY_TIME 5 // (seconds) Time to wait for bed to "settle" in M190 #define TEMP_BED_RESIDENCY_TIME 5 // (seconds) Time to wait for bed to "settle" in M190
#define TEMP_BED_WINDOW 2 // (°C) Temperature proximity for the "temperature reached" timer #define TEMP_BED_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer
#define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target #define TEMP_BED_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target
#define TEMP_CHAMBER_RESIDENCY_TIME 10 // (seconds) Time to wait for chamber to "settle" in M191 #define TEMP_CHAMBER_RESIDENCY_TIME 10 // (seconds) Time to wait for chamber to "settle" in M191
#define TEMP_CHAMBER_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer #define TEMP_CHAMBER_WINDOW 1 // (°C) Temperature proximity for the "temperature reached" timer
#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target #define TEMP_CHAMBER_HYSTERESIS 5 // (°C) Temperature proximity considered "close enough" to the target
// Below this temperature the heater will be switched off // Below this temperature the heater will be switched off
// because it probably indicates a broken thermistor wire. // because it probably indicates a broken thermistor wire.
@@ -524,7 +464,7 @@
// Above this temperature the heater will be switched off. // Above this temperature the heater will be switched off.
// This can protect components from overheating, but NOT from shorts and failures. // This can protect components from overheating, but NOT from shorts and failures.
// (Use MINTEMP for thermistor short/failure protection.) // (Use MINTEMP for thermistor short/failure protection.)
#define HEATER_0_MAXTEMP 305 #define HEATER_0_MAXTEMP 415
#define HEATER_1_MAXTEMP 275 #define HEATER_1_MAXTEMP 275
#define HEATER_2_MAXTEMP 275 #define HEATER_2_MAXTEMP 275
#define HEATER_3_MAXTEMP 275 #define HEATER_3_MAXTEMP 275
@@ -533,7 +473,7 @@
#define HEATER_6_MAXTEMP 275 #define HEATER_6_MAXTEMP 275
#define HEATER_7_MAXTEMP 275 #define HEATER_7_MAXTEMP 275
#define BED_MAXTEMP 150 #define BED_MAXTEMP 150
#define CHAMBER_MAXTEMP 60 #define CHAMBER_MAXTEMP 80
/** /**
* Thermal Overshoot * Thermal Overshoot
@@ -543,7 +483,6 @@
*/ */
#define HOTEND_OVERSHOOT 15 // (°C) Forbid temperatures over MAXTEMP - OVERSHOOT #define HOTEND_OVERSHOOT 15 // (°C) Forbid temperatures over MAXTEMP - OVERSHOOT
#define BED_OVERSHOOT 10 // (°C) Forbid temperatures over MAXTEMP - OVERSHOOT #define BED_OVERSHOOT 10 // (°C) Forbid temperatures over MAXTEMP - OVERSHOOT
#define COOLER_OVERSHOOT 2 // (°C) Forbid temperatures closer than OVERSHOOT
//=========================================================================== //===========================================================================
//============================= PID Settings ================================ //============================= PID Settings ================================
@@ -569,9 +508,9 @@
#define DEFAULT_Ki_LIST { 1.08, 1.08 } #define DEFAULT_Ki_LIST { 1.08, 1.08 }
#define DEFAULT_Kd_LIST { 114.00, 114.00 } #define DEFAULT_Kd_LIST { 114.00, 114.00 }
#else #else
#define DEFAULT_Kp 19.0 #define DEFAULT_Kp 10.5
#define DEFAULT_Ki 1.47 #define DEFAULT_Ki 0.45
#define DEFAULT_Kd 61.00 #define DEFAULT_Kd 70
#endif #endif
#endif // PIDTEMP #endif // PIDTEMP
@@ -608,11 +547,11 @@
//#define MIN_BED_POWER 0 //#define MIN_BED_POWER 0
//#define PID_BED_DEBUG // Sends debug data to the serial port. //#define PID_BED_DEBUG // Sends debug data to the serial port.
// 120V 250W silicone heater into 4mm borosilicate (MendelMax 1.5+) //120V 250W silicone heater into 4mm borosilicate (MendelMax 1.5+)
// from FOPDT model - kp=.39 Tp=405 Tdead=66, Tc set to 79.2, aggressive factor of .15 (vs .1, 1, 10) //from FOPDT model - kp=.39 Tp=405 Tdead=66, Tc set to 79.2, aggressive factor of .15 (vs .1, 1, 10)
#define DEFAULT_bedKp 195.13 #define DEFAULT_bedKp 104.28
#define DEFAULT_bedKi 29.05 #define DEFAULT_bedKi 20.53
#define DEFAULT_bedKd 873.85 #define DEFAULT_bedKd 353.10
// FIND YOUR OWN: "M303 E-1 C8 S90" to run autotune on the bed at 90 degreesC for 8 cycles. // FIND YOUR OWN: "M303 E-1 C8 S90" to run autotune on the bed at 90 degreesC for 8 cycles.
#endif // PIDTEMPBED #endif // PIDTEMPBED
@@ -738,15 +677,9 @@
#define USE_XMIN_PLUG #define USE_XMIN_PLUG
#define USE_YMIN_PLUG #define USE_YMIN_PLUG
#define USE_ZMIN_PLUG #define USE_ZMIN_PLUG
//#define USE_IMIN_PLUG
//#define USE_JMIN_PLUG
//#define USE_KMIN_PLUG
//#define USE_XMAX_PLUG //#define USE_XMAX_PLUG
//#define USE_YMAX_PLUG //#define USE_YMAX_PLUG
//#define USE_ZMAX_PLUG //#define USE_ZMAX_PLUG
//#define USE_IMAX_PLUG
//#define USE_JMAX_PLUG
//#define USE_KMAX_PLUG
// Enable pullup for all endstops to prevent a floating state // Enable pullup for all endstops to prevent a floating state
#define ENDSTOPPULLUPS #define ENDSTOPPULLUPS
@@ -755,15 +688,9 @@
//#define ENDSTOPPULLUP_XMAX //#define ENDSTOPPULLUP_XMAX
//#define ENDSTOPPULLUP_YMAX //#define ENDSTOPPULLUP_YMAX
//#define ENDSTOPPULLUP_ZMAX //#define ENDSTOPPULLUP_ZMAX
//#define ENDSTOPPULLUP_IMAX
//#define ENDSTOPPULLUP_JMAX
//#define ENDSTOPPULLUP_KMAX
//#define ENDSTOPPULLUP_XMIN //#define ENDSTOPPULLUP_XMIN
//#define ENDSTOPPULLUP_YMIN //#define ENDSTOPPULLUP_YMIN
//#define ENDSTOPPULLUP_ZMIN //#define ENDSTOPPULLUP_ZMIN
//#define ENDSTOPPULLUP_IMIN
//#define ENDSTOPPULLUP_JMIN
//#define ENDSTOPPULLUP_KMIN
//#define ENDSTOPPULLUP_ZMIN_PROBE //#define ENDSTOPPULLUP_ZMIN_PROBE
#endif #endif
@@ -774,15 +701,9 @@
//#define ENDSTOPPULLDOWN_XMAX //#define ENDSTOPPULLDOWN_XMAX
//#define ENDSTOPPULLDOWN_YMAX //#define ENDSTOPPULLDOWN_YMAX
//#define ENDSTOPPULLDOWN_ZMAX //#define ENDSTOPPULLDOWN_ZMAX
//#define ENDSTOPPULLDOWN_IMAX
//#define ENDSTOPPULLDOWN_JMAX
//#define ENDSTOPPULLDOWN_KMAX
//#define ENDSTOPPULLDOWN_XMIN //#define ENDSTOPPULLDOWN_XMIN
//#define ENDSTOPPULLDOWN_YMIN //#define ENDSTOPPULLDOWN_YMIN
//#define ENDSTOPPULLDOWN_ZMIN //#define ENDSTOPPULLDOWN_ZMIN
//#define ENDSTOPPULLDOWN_IMIN
//#define ENDSTOPPULLDOWN_JMIN
//#define ENDSTOPPULLDOWN_KMIN
//#define ENDSTOPPULLDOWN_ZMIN_PROBE //#define ENDSTOPPULLDOWN_ZMIN_PROBE
#endif #endif
@@ -790,16 +711,10 @@
#define X_MIN_ENDSTOP_INVERTING true // Set to true to invert the logic of the endstop. #define X_MIN_ENDSTOP_INVERTING true // Set to true to invert the logic of the endstop.
#define Y_MIN_ENDSTOP_INVERTING true // Set to true to invert the logic of the endstop. #define Y_MIN_ENDSTOP_INVERTING true // Set to true to invert the logic of the endstop.
#define Z_MIN_ENDSTOP_INVERTING true // Set to true to invert the logic of the endstop. #define Z_MIN_ENDSTOP_INVERTING true // Set to true to invert the logic of the endstop.
#define I_MIN_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop. #define X_MAX_ENDSTOP_INVERTING true // Set to true to invert the logic of the endstop.
#define J_MIN_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop. #define Y_MAX_ENDSTOP_INVERTING true // Set to true to invert the logic of the endstop.
#define K_MIN_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop. #define Z_MAX_ENDSTOP_INVERTING true // Set to true to invert the logic of the endstop.
#define X_MAX_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop. #define Z_MIN_PROBE_ENDSTOP_INVERTING true // Set to true to invert the logic of the probe.
#define Y_MAX_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop.
#define Z_MAX_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop.
#define I_MAX_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop.
#define J_MAX_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop.
#define K_MAX_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop.
#define Z_MIN_PROBE_ENDSTOP_INVERTING false // Set to true to invert the logic of the probe.
/** /**
* Stepper Drivers * Stepper Drivers
@@ -827,9 +742,6 @@
//#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 I_DRIVER_TYPE A4988
//#define J_DRIVER_TYPE A4988
//#define K_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
@@ -883,16 +795,16 @@
/** /**
* Default Axis Steps Per Unit (steps/mm) * Default Axis Steps Per Unit (steps/mm)
* Override with M92 * Override with M92
* X, Y, Z [, I [, J [, K]]], E0 [, E1[, E2...]] * X, Y, Z, E0 [, E1[, E2...]]
*/ */
#define DEFAULT_AXIS_STEPS_PER_UNIT { 80, 80, 400, 106.09 } #define DEFAULT_AXIS_STEPS_PER_UNIT { 80, 80, 800, 92.6 }
/** /**
* Default Max Feed Rate (mm/s) * Default Max Feed Rate (mm/s)
* Override with M203 * Override with M203
* X, Y, Z [, I [, J [, K]]], E0 [, E1[, E2...]] * X, Y, Z, E0 [, E1[, E2...]]
*/ */
#define DEFAULT_MAX_FEEDRATE { 300, 300, 15, 75 } #define DEFAULT_MAX_FEEDRATE { 300, 300, 20, 70 }
//#define LIMITED_MAX_FR_EDITING // Limit edit via M203 or LCD to DEFAULT_MAX_FEEDRATE * 2 //#define LIMITED_MAX_FR_EDITING // Limit edit via M203 or LCD to DEFAULT_MAX_FEEDRATE * 2
#if ENABLED(LIMITED_MAX_FR_EDITING) #if ENABLED(LIMITED_MAX_FR_EDITING)
@@ -903,9 +815,9 @@
* Default Max Acceleration (change/s) change = mm/s * Default Max Acceleration (change/s) change = mm/s
* (Maximum start speed for accelerated moves) * (Maximum start speed for accelerated moves)
* Override with M201 * Override with M201
* X, Y, Z [, I [, J [, K]]], E0 [, E1[, E2...]] * X, Y, Z, E0 [, E1[, E2...]]
*/ */
#define DEFAULT_MAX_ACCELERATION { 1500, 1500, 100, 10000 } #define DEFAULT_MAX_ACCELERATION { 9000, 9000, 100, 10000 }
//#define LIMITED_MAX_ACCEL_EDITING // Limit edit via M201 or LCD to DEFAULT_MAX_ACCELERATION * 2 //#define LIMITED_MAX_ACCEL_EDITING // Limit edit via M201 or LCD to DEFAULT_MAX_ACCELERATION * 2
#if ENABLED(LIMITED_MAX_ACCEL_EDITING) #if ENABLED(LIMITED_MAX_ACCEL_EDITING)
@@ -920,9 +832,9 @@
* M204 R Retract Acceleration * M204 R Retract Acceleration
* M204 T Travel Acceleration * M204 T Travel Acceleration
*/ */
#define DEFAULT_ACCELERATION 750 // X, Y, Z and E acceleration for printing moves #define DEFAULT_ACCELERATION 3000 // X, Y, Z and E acceleration for printing moves
#define DEFAULT_RETRACT_ACCELERATION 3000 // E acceleration for retracts #define DEFAULT_RETRACT_ACCELERATION 3000 // E acceleration for retracts
#define DEFAULT_TRAVEL_ACCELERATION 750 // X, Y, Z acceleration for travel (non printing) moves #define DEFAULT_TRAVEL_ACCELERATION 3000 // X, Y, Z acceleration for travel (non printing) moves
/** /**
* Default Jerk limits (mm/s) * Default Jerk limits (mm/s)
@@ -937,9 +849,6 @@
#define DEFAULT_XJERK 10.0 #define DEFAULT_XJERK 10.0
#define DEFAULT_YJERK 10.0 #define DEFAULT_YJERK 10.0
#define DEFAULT_ZJERK 0.3 #define DEFAULT_ZJERK 0.3
//#define DEFAULT_IJERK 0.3
//#define DEFAULT_JJERK 0.3
//#define DEFAULT_KJERK 0.3
//#define TRAVEL_EXTRA_XYJERK 0.0 // Additional jerk allowance for all travel moves //#define TRAVEL_EXTRA_XYJERK 0.0 // Additional jerk allowance for all travel moves
@@ -1022,7 +931,8 @@
* Use G29 repeatedly, adjusting the Z height at each point with movement commands * Use G29 repeatedly, adjusting the Z height at each point with movement commands
* or (with LCD_BED_LEVELING) the LCD controller. * or (with LCD_BED_LEVELING) the LCD controller.
*/ */
#define PROBE_MANUALLY //#define PROBE_MANUALLY
//#define MANUAL_PROBE_START_Z 0.2
/** /**
* A Fix-Mounted Probe either doesn't deploy or needs manual deployment. * A Fix-Mounted Probe either doesn't deploy or needs manual deployment.
@@ -1213,8 +1123,8 @@
#define Z_PROBE_LOW_POINT -2 // Farthest distance below the trigger-point to go before stopping #define Z_PROBE_LOW_POINT -2 // Farthest distance below the trigger-point to go before stopping
// For M851 give a range for adjusting the Z probe offset // For M851 give a range for adjusting the Z probe offset
#define Z_PROBE_OFFSET_RANGE_MIN -20 #define Z_PROBE_OFFSET_RANGE_MIN -9
#define Z_PROBE_OFFSET_RANGE_MAX 20 #define Z_PROBE_OFFSET_RANGE_MAX 9
// Enable the M48 repeatability test to test probe accuracy // Enable the M48 repeatability test to test probe accuracy
//#define Z_MIN_PROBE_REPEATABILITY_TEST //#define Z_MIN_PROBE_REPEATABILITY_TEST
@@ -1254,18 +1164,12 @@
#define Y_ENABLE_ON 0 #define Y_ENABLE_ON 0
#define Z_ENABLE_ON 0 #define Z_ENABLE_ON 0
#define E_ENABLE_ON 0 // For all extruders #define E_ENABLE_ON 0 // For all extruders
//#define I_ENABLE_ON 0
//#define J_ENABLE_ON 0
//#define K_ENABLE_ON 0
// Disable axis steppers immediately when they're not being stepped. // Disable axis steppers immediately when they're not being stepped.
// WARNING: When motors turn off there is a chance of losing position accuracy! // WARNING: When motors turn off there is a chance of losing position accuracy!
#define DISABLE_X false #define DISABLE_X false
#define DISABLE_Y false #define DISABLE_Y false
#define DISABLE_Z false #define DISABLE_Z false
//#define DISABLE_I false
//#define DISABLE_J false
//#define DISABLE_K false
// Turn off the display blinking that warns about possible accuracy reduction // Turn off the display blinking that warns about possible accuracy reduction
//#define DISABLE_REDUCED_ACCURACY_WARNING //#define DISABLE_REDUCED_ACCURACY_WARNING
@@ -1279,16 +1183,13 @@
// Invert the stepper direction. Change (or reverse the motor connector) if an axis goes the wrong way. // Invert the stepper direction. Change (or reverse the motor connector) if an axis goes the wrong way.
#define INVERT_X_DIR true #define INVERT_X_DIR true
#define INVERT_Y_DIR true #define INVERT_Y_DIR false
#define INVERT_Z_DIR false #define INVERT_Z_DIR true
//#define INVERT_I_DIR false
//#define INVERT_J_DIR false
//#define INVERT_K_DIR false
// @section extruder // @section extruder
// For direct drive extruder v9 set to true, for geared extruder set to false. // For direct drive extruder v9 set to true, for geared extruder set to false.
#define INVERT_E0_DIR true #define INVERT_E0_DIR false
#define INVERT_E1_DIR false #define INVERT_E1_DIR false
#define INVERT_E2_DIR false #define INVERT_E2_DIR false
#define INVERT_E3_DIR false #define INVERT_E3_DIR false
@@ -1319,29 +1220,20 @@
#define X_HOME_DIR -1 #define X_HOME_DIR -1
#define Y_HOME_DIR -1 #define Y_HOME_DIR -1
#define Z_HOME_DIR -1 #define Z_HOME_DIR -1
//#define I_HOME_DIR -1
//#define J_HOME_DIR -1
//#define K_HOME_DIR -1
// @section machine // @section machine
// The size of the printable area // The size of the print bed
#define X_BED_SIZE 310 #define X_BED_SIZE 260
#define Y_BED_SIZE 310 #define Y_BED_SIZE 260
// Travel limits (mm) after homing, corresponding to endstop positions. // Travel limits (mm) after homing, corresponding to endstop positions.
#define X_MIN_POS -10 #define X_MIN_POS 0
#define Y_MIN_POS -10 #define Y_MIN_POS 0
#define Z_MIN_POS 0 #define Z_MIN_POS 0
#define X_MAX_POS X_BED_SIZE #define X_MAX_POS X_BED_SIZE
#define Y_MAX_POS Y_BED_SIZE #define Y_MAX_POS Y_BED_SIZE
#define Z_MAX_POS 400 #define Z_MAX_POS 260
//#define I_MIN_POS 0
//#define I_MAX_POS 50
//#define J_MIN_POS 0
//#define J_MAX_POS 50
//#define K_MIN_POS 0
//#define K_MAX_POS 50
/** /**
* Software Endstops * Software Endstops
@@ -1358,9 +1250,6 @@
#define MIN_SOFTWARE_ENDSTOP_X #define MIN_SOFTWARE_ENDSTOP_X
#define MIN_SOFTWARE_ENDSTOP_Y #define MIN_SOFTWARE_ENDSTOP_Y
#define MIN_SOFTWARE_ENDSTOP_Z #define MIN_SOFTWARE_ENDSTOP_Z
#define MIN_SOFTWARE_ENDSTOP_I
#define MIN_SOFTWARE_ENDSTOP_J
#define MIN_SOFTWARE_ENDSTOP_K
#endif #endif
// Max software endstops constrain movement within maximum coordinate bounds // Max software endstops constrain movement within maximum coordinate bounds
@@ -1369,9 +1258,6 @@
#define MAX_SOFTWARE_ENDSTOP_X #define MAX_SOFTWARE_ENDSTOP_X
#define MAX_SOFTWARE_ENDSTOP_Y #define MAX_SOFTWARE_ENDSTOP_Y
#define MAX_SOFTWARE_ENDSTOP_Z #define MAX_SOFTWARE_ENDSTOP_Z
#define MAX_SOFTWARE_ENDSTOP_I
#define MAX_SOFTWARE_ENDSTOP_J
#define MAX_SOFTWARE_ENDSTOP_K
#endif #endif
#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS) #if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS)
@@ -1395,7 +1281,6 @@
#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_PIN 2
#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_PULLUP // Use internal pullup for filament runout pins.
@@ -1494,9 +1379,9 @@
*/ */
//#define AUTO_BED_LEVELING_3POINT //#define AUTO_BED_LEVELING_3POINT
//#define AUTO_BED_LEVELING_LINEAR //#define AUTO_BED_LEVELING_LINEAR
#define AUTO_BED_LEVELING_BILINEAR //#define AUTO_BED_LEVELING_BILINEAR
//#define AUTO_BED_LEVELING_UBL //#define AUTO_BED_LEVELING_UBL
//#define MESH_BED_LEVELING #define MESH_BED_LEVELING
/** /**
* Normally G28 leaves leveling disabled on completion. Enable one of * Normally G28 leaves leveling disabled on completion. Enable one of
@@ -1522,18 +1407,13 @@
*/ */
//#define DEBUG_LEVELING_FEATURE //#define DEBUG_LEVELING_FEATURE
#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_UBL, PROBE_MANUALLY)
// Set a height for the start of manual adjustment
#define MANUAL_PROBE_START_Z 0.2 // (mm) Comment out to use the last-measured height
#endif
#if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, AUTO_BED_LEVELING_UBL) #if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_BILINEAR, AUTO_BED_LEVELING_UBL)
// Gradually reduce leveling correction until a set height is reached, // Gradually reduce leveling correction until a set height is reached,
// at which point movement will be level to the machine's XY plane. // at which point movement will be level to the machine's XY plane.
// The height can be set with M420 Z<height> // The height can be set with M420 Z<height>
#define ENABLE_LEVELING_FADE_HEIGHT #define ENABLE_LEVELING_FADE_HEIGHT
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
#define DEFAULT_LEVELING_FADE_HEIGHT 00.0 // (mm) Default fade height. #define DEFAULT_LEVELING_FADE_HEIGHT 10.0 // (mm) Default fade height.
#endif #endif
// For Cartesian machines, instead of dividing moves on mesh boundaries, // For Cartesian machines, instead of dividing moves on mesh boundaries,
@@ -1561,7 +1441,7 @@
#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) #if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR)
// Set the number of grid points per dimension. // Set the number of grid points per dimension.
#define GRID_MAX_POINTS_X 5 #define GRID_MAX_POINTS_X 3
#define GRID_MAX_POINTS_Y GRID_MAX_POINTS_X #define GRID_MAX_POINTS_Y GRID_MAX_POINTS_X
// Probe along the Y axis, advancing X after each column // Probe along the Y axis, advancing X after each column
@@ -1571,13 +1451,13 @@
// Beyond the probed grid, continue the implied tilt? // Beyond the probed grid, continue the implied tilt?
// Default is to maintain the height of the nearest edge. // Default is to maintain the height of the nearest edge.
#define EXTRAPOLATE_BEYOND_GRID //#define EXTRAPOLATE_BEYOND_GRID
// //
// Experimental Subdivision of the grid by Catmull-Rom method. // Experimental Subdivision of the grid by Catmull-Rom method.
// Synthesizes intermediate points to produce a more detailed mesh. // Synthesizes intermediate points to produce a more detailed mesh.
// //
#define ABL_BILINEAR_SUBDIVISION //#define ABL_BILINEAR_SUBDIVISION
#if ENABLED(ABL_BILINEAR_SUBDIVISION) #if ENABLED(ABL_BILINEAR_SUBDIVISION)
// Number of subdivisions between probe points // Number of subdivisions between probe points
#define BILINEAR_SUBDIVISIONS 3 #define BILINEAR_SUBDIVISIONS 3
@@ -1597,23 +1477,19 @@
#define GRID_MAX_POINTS_X 10 // Don't use more than 15 points per axis, implementation limited. #define GRID_MAX_POINTS_X 10 // Don't use more than 15 points per axis, implementation limited.
#define GRID_MAX_POINTS_Y GRID_MAX_POINTS_X #define GRID_MAX_POINTS_Y GRID_MAX_POINTS_X
//#define UBL_HILBERT_CURVE // Use Hilbert distribution for less travel when probing multiple points
#define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle
#define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500
//#define UBL_Z_RAISE_WHEN_OFF_MESH 2.5 // When the nozzle is off the mesh, this value is used //#define UBL_Z_RAISE_WHEN_OFF_MESH 2.5 // When the nozzle is off the mesh, this value is used
// as the Z-Height correction value. // as the Z-Height correction value.
//#define UBL_MESH_WIZARD // Run several commands in a row to get a complete mesh
#elif ENABLED(MESH_BED_LEVELING) #elif ENABLED(MESH_BED_LEVELING)
//=========================================================================== //===========================================================================
//=================================== Mesh ================================== //=================================== Mesh ==================================
//=========================================================================== //===========================================================================
#define MESH_INSET 5 // Set Mesh bounds as an inset region of the bed #define MESH_INSET 10 // Set Mesh bounds as an inset region of the bed
#define GRID_MAX_POINTS_X 5 // Don't use more than 7 points per axis, implementation limited. #define GRID_MAX_POINTS_X 5 // Don't use more than 7 points per axis, implementation limited.
#define GRID_MAX_POINTS_Y GRID_MAX_POINTS_X #define GRID_MAX_POINTS_Y GRID_MAX_POINTS_X
@@ -1634,7 +1510,7 @@
#endif #endif
// Add a menu item to move between bed corners for manual bed adjustment // Add a menu item to move between bed corners for manual bed adjustment
//#define LEVEL_BED_CORNERS #define LEVEL_BED_CORNERS
#if ENABLED(LEVEL_BED_CORNERS) #if ENABLED(LEVEL_BED_CORNERS)
#define LEVEL_CORNERS_INSET_LFRB { 30, 30, 30, 30 } // (mm) Left, Front, Right, Back insets #define LEVEL_CORNERS_INSET_LFRB { 30, 30, 30, 30 } // (mm) Left, Front, Right, Back insets
@@ -1684,9 +1560,6 @@
//#define MANUAL_X_HOME_POS 0 //#define MANUAL_X_HOME_POS 0
//#define MANUAL_Y_HOME_POS 0 //#define MANUAL_Y_HOME_POS 0
//#define MANUAL_Z_HOME_POS 0 //#define MANUAL_Z_HOME_POS 0
//#define MANUAL_I_HOME_POS 0
//#define MANUAL_J_HOME_POS 0
//#define MANUAL_K_HOME_POS 0
// Use "Z Safe Homing" to avoid homing with a Z probe outside the bed area. // Use "Z Safe Homing" to avoid homing with a Z probe outside the bed area.
// //
@@ -1824,7 +1697,7 @@
#define PREHEAT_2_LABEL "ABS" #define PREHEAT_2_LABEL "ABS"
#define PREHEAT_2_TEMP_HOTEND 240 #define PREHEAT_2_TEMP_HOTEND 240
#define PREHEAT_2_TEMP_BED 110 #define PREHEAT_2_TEMP_BED 110
#define PREHEAT_2_TEMP_CHAMBER 35 #define PREHEAT_2_TEMP_CHAMBER 45
#define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255 #define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255
/** /**
@@ -1842,7 +1715,7 @@
#if ENABLED(NOZZLE_PARK_FEATURE) #if ENABLED(NOZZLE_PARK_FEATURE)
// Specify a park position as { X, Y, Z_raise } // Specify a park position as { X, Y, Z_raise }
#define NOZZLE_PARK_POINT { (X_MIN_POS + 10), (Y_MIN_POS + 10), 5 } #define NOZZLE_PARK_POINT { (X_CENTER), (Y_CENTER), 20 }
//#define NOZZLE_PARK_X_ONLY // X move only is required to park //#define NOZZLE_PARK_X_ONLY // X move only is required to park
//#define NOZZLE_PARK_Y_ONLY // Y move only is required to park //#define NOZZLE_PARK_Y_ONLY // Y move only is required to park
#define NOZZLE_PARK_Z_RAISE_MIN 2 // (mm) Always raise Z by at least this distance #define NOZZLE_PARK_Z_RAISE_MIN 2 // (mm) Always raise Z by at least this distance
@@ -1929,20 +1802,11 @@
/** /**
* Print Job Timer * Print Job Timer
* *
* Automatically start and stop the print job timer on M104/M109/M140/M190/M141/M191. * Automatically start and stop the print job timer on M104/M109/M190.
* The print job timer will only be stopped if the bed/chamber target temp is
* below BED_MINTEMP/CHAMBER_MINTEMP.
* *
* M104 (hotend, no wait) - high temp = none, low temp = stop timer * M104 (hotend, no wait) - high temp = none, low temp = stop timer
* M109 (hotend, wait) - high temp = start timer, low temp = stop timer * M109 (hotend, wait) - high temp = start timer, low temp = stop timer
* M140 (bed, no wait) - high temp = none, low temp = stop timer * M190 (bed, wait) - high temp = start timer, low temp = none
* M190 (bed, wait) - high temp = start timer, low temp = none
* M141 (chamber, no wait) - high temp = none, low temp = stop timer
* M191 (chamber, wait) - high temp = start timer, low temp = none
*
* For M104/M109, high temp is anything over EXTRUDE_MINTEMP / 2.
* For M140/M190, high temp is anything over BED_MINTEMP.
* For M141/M191, high temp is anything over CHAMBER_MINTEMP.
* *
* The timer can also be controlled with the following commands: * The timer can also be controlled with the following commands:
* *
@@ -2133,7 +1997,7 @@
// If you have a speaker that can produce tones, enable it here. // If you have a speaker that can produce tones, enable it here.
// By default Marlin assumes you have a buzzer with a fixed frequency. // By default Marlin assumes you have a buzzer with a fixed frequency.
// //
//#define SPEAKER #define SPEAKER
// //
// The duration and frequency for the UI feedback sound. // The duration and frequency for the UI feedback sound.
@@ -2386,8 +2250,7 @@
// MKS LCD12864A/B with graphic controller and SD support. Follows MKS_MINI_12864 pinout. // MKS LCD12864A/B with graphic controller and SD support. Follows MKS_MINI_12864 pinout.
// https://www.aliexpress.com/item/33018110072.html // https://www.aliexpress.com/item/33018110072.html
// //
//#define MKS_LCD12864A //#define MKS_LCD12864
//#define MKS_LCD12864B
// //
// FYSETC variant of the MINI12864 graphic controller with SD support // FYSETC variant of the MINI12864 graphic controller with SD support
@@ -2506,11 +2369,7 @@
//#define DGUS_LCD_UI_ORIGIN //#define DGUS_LCD_UI_ORIGIN
//#define DGUS_LCD_UI_FYSETC //#define DGUS_LCD_UI_FYSETC
//#define DGUS_LCD_UI_HIPRECY //#define DGUS_LCD_UI_HIPRECY
//#define DGUS_LCD_UI_MKS //#define DGUS_LCD_UI_MKS
#if ENABLED(DGUS_LCD_UI_MKS)
#define USE_MKS_GREEN_UI
#endif
// //
// Touch-screen LCD for Malyan M200/M300 printers // Touch-screen LCD for Malyan M200/M300 printers
@@ -2629,11 +2488,6 @@
// //
//#define ANET_ET5_TFT35 //#define ANET_ET5_TFT35
//
// 1024x600, 7", RGB Stock Display from BIQU-BX
//
//#define BIQU_BX_TFT70
// //
// Generic TFT with detailed options // Generic TFT with detailed options
// //
@@ -2690,7 +2544,7 @@
//#define DWIN_CREALITY_LCD //#define DWIN_CREALITY_LCD
// //
// Touch Screen Settings // ADS7843/XPT2046 ADC Touchscreen such as ILI9341 2.8
// //
//#define TOUCH_SCREEN //#define TOUCH_SCREEN
#if ENABLED(TOUCH_SCREEN) #if ENABLED(TOUCH_SCREEN)
@@ -2804,7 +2658,7 @@
//#define NEOPIXEL_LED //#define NEOPIXEL_LED
#if ENABLED(NEOPIXEL_LED) #if ENABLED(NEOPIXEL_LED)
#define NEOPIXEL_TYPE NEO_GRBW // NEO_GRBW / NEO_GRB - four/three channel driver type (defined in Adafruit_NeoPixel.h) #define NEOPIXEL_TYPE NEO_GRBW // NEO_GRBW / NEO_GRB - four/three channel driver type (defined in Adafruit_NeoPixel.h)
//#define NEOPIXEL_PIN 4 // LED driving pin #define NEOPIXEL_PIN 4 // LED driving pin
//#define NEOPIXEL2_TYPE NEOPIXEL_TYPE //#define NEOPIXEL2_TYPE NEOPIXEL_TYPE
//#define NEOPIXEL2_PIN 5 //#define NEOPIXEL2_PIN 5
#define NEOPIXEL_PIXELS 30 // Number of LEDs in the strip. (Longest strip when NEOPIXEL2_SEPARATE is disabled.) #define NEOPIXEL_PIXELS 30 // Number of LEDs in the strip. (Longest strip when NEOPIXEL2_SEPARATE is disabled.)
@@ -2822,11 +2676,10 @@
//#define NEOPIXEL2_INSERIES // Default behavior is NeoPixel 2 in parallel //#define NEOPIXEL2_INSERIES // Default behavior is NeoPixel 2 in parallel
#endif #endif
// Use some of the NeoPixel LEDs for static (background) lighting // Use a single NeoPixel LED for static (background) lighting
//#define NEOPIXEL_BKGD_INDEX_FIRST 0 // Index of the first background LED //#define NEOPIXEL_BKGD_LED_INDEX 0 // Index of the LED to use
//#define NEOPIXEL_BKGD_INDEX_LAST 5 // Index of the last background LED //#define NEOPIXEL_BKGD_COLOR { 255, 255, 255, 0 } // R, G, B, W
//#define NEOPIXEL_BKGD_COLOR { 255, 255, 255, 0 } // R, G, B, W //#define NEOPIXEL_BKGD_ALWAYS_ON // Keep the backlight on when other NeoPixels are off
//#define NEOPIXEL_BKGD_ALWAYS_ON // Keep the backlight on when other NeoPixels are off
#endif #endif
/** /**
+117 -397
View File
@@ -30,7 +30,7 @@
* *
* Basic settings can be found in Configuration.h * Basic settings can be found in Configuration.h
*/ */
#define CONFIGURATION_ADV_H_VERSION 02000900 #define CONFIGURATION_ADV_H_VERSION 020008
//=========================================================================== //===========================================================================
//============================= Thermal Settings ============================ //============================= Thermal Settings ============================
@@ -152,7 +152,7 @@
#if DISABLED(PIDTEMPCHAMBER) #if DISABLED(PIDTEMPCHAMBER)
#define CHAMBER_CHECK_INTERVAL 5000 // (ms) Interval between checks in bang-bang control #define CHAMBER_CHECK_INTERVAL 5000 // (ms) Interval between checks in bang-bang control
#if ENABLED(CHAMBER_LIMIT_SWITCHING) #if ENABLED(CHAMBER_LIMIT_SWITCHING)
#define CHAMBER_HYSTERESIS 2 // (°C) Only set the relevant heater state when ABS(T-target) > CHAMBER_HYSTERESIS #define CHAMBER_HYSTERESIS 5 // (°C) Only set the relevant heater state when ABS(T-target) > CHAMBER_HYSTERESIS
#endif #endif
#endif #endif
@@ -163,7 +163,7 @@
//#define CHAMBER_FAN // Enable a fan on the chamber //#define CHAMBER_FAN // Enable a fan on the chamber
#if ENABLED(CHAMBER_FAN) #if ENABLED(CHAMBER_FAN)
#define CHAMBER_FAN_MODE 2 // Fan control mode: 0=Static; 1=Linear increase when temp is higher than target; 2=V-shaped curve; 3=similar to 1 but fan is always on. #define CHAMBER_FAN_MODE 2 // Fan control mode: 0=Static; 1=Linear increase when temp is higher than target; 2=V-shaped curve.
#if CHAMBER_FAN_MODE == 0 #if CHAMBER_FAN_MODE == 0
#define CHAMBER_FAN_BASE 255 // Chamber fan PWM (0-255) #define CHAMBER_FAN_BASE 255 // Chamber fan PWM (0-255)
#elif CHAMBER_FAN_MODE == 1 #elif CHAMBER_FAN_MODE == 1
@@ -172,9 +172,6 @@
#elif CHAMBER_FAN_MODE == 2 #elif CHAMBER_FAN_MODE == 2
#define CHAMBER_FAN_BASE 128 // Minimum chamber fan PWM (0-255) #define CHAMBER_FAN_BASE 128 // Minimum chamber fan PWM (0-255)
#define CHAMBER_FAN_FACTOR 25 // PWM increase per °C difference from target #define CHAMBER_FAN_FACTOR 25 // PWM increase per °C difference from target
#elif CHAMBER_FAN_MODE == 3
#define CHAMBER_FAN_BASE 128 // Base chamber fan PWM (0-255)
#define CHAMBER_FAN_FACTOR 25 // PWM increase per °C above target
#endif #endif
#endif #endif
@@ -207,20 +204,6 @@
#endif #endif
#endif #endif
//
// Laser Coolant Flow Meter
//
//#define LASER_COOLANT_FLOW_METER
#if ENABLED(LASER_COOLANT_FLOW_METER)
#define FLOWMETER_PIN 20 // Requires an external interrupt-enabled pin (e.g., RAMPS 2,3,18,19,20,21)
#define FLOWMETER_PPL 5880 // (pulses/liter) Flow meter pulses-per-liter on the input pin
#define FLOWMETER_INTERVAL 1000 // (ms) Flow rate calculation interval in milliseconds
#define FLOWMETER_SAFETY // Prevent running the laser without the minimum flow rate set below
#if ENABLED(FLOWMETER_SAFETY)
#define FLOWMETER_MIN_LITERS_PER_MINUTE 1.5 // (liters/min) Minimum flow required when enabled
#endif
#endif
/** /**
* Thermal Protection provides additional protection to your printer from damage * Thermal Protection provides additional protection to your printer from damage
* and fire. Marlin always includes safe min and max temperature ranges which * and fire. Marlin always includes safe min and max temperature ranges which
@@ -238,8 +221,8 @@
* THERMAL_PROTECTION_HYSTERESIS and/or THERMAL_PROTECTION_PERIOD * THERMAL_PROTECTION_HYSTERESIS and/or THERMAL_PROTECTION_PERIOD
*/ */
#if ENABLED(THERMAL_PROTECTION_HOTENDS) #if ENABLED(THERMAL_PROTECTION_HOTENDS)
#define THERMAL_PROTECTION_PERIOD 60 // Seconds #define THERMAL_PROTECTION_PERIOD 70 // Seconds
#define THERMAL_PROTECTION_HYSTERESIS 15 // Degrees Celsius #define THERMAL_PROTECTION_HYSTERESIS 10 // Degrees Celsius
#define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops #define ADAPTIVE_FAN_SLOWING // Slow part cooling fan if temperature drops
#if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP) #if BOTH(ADAPTIVE_FAN_SLOWING, PIDTEMP)
@@ -258,35 +241,35 @@
* and/or decrease WATCH_TEMP_INCREASE. WATCH_TEMP_INCREASE should not be set * and/or decrease WATCH_TEMP_INCREASE. WATCH_TEMP_INCREASE should not be set
* below 2. * below 2.
*/ */
#define WATCH_TEMP_PERIOD 20 // Seconds #define WATCH_TEMP_PERIOD 40 // Seconds
#define WATCH_TEMP_INCREASE 2 // Degrees Celsius #define WATCH_TEMP_INCREASE 2 // Degrees Celsius
#endif #endif
/** /**
* Thermal Protection parameters for the bed are just as above for hotends. * Thermal Protection parameters for the bed are just as above for hotends.
*/ */
#if ENABLED(THERMAL_PROTECTION_BED) #if ENABLED(THERMAL_PROTECTION_BED)
#define THERMAL_PROTECTION_BED_PERIOD 20 // Seconds #define THERMAL_PROTECTION_BED_PERIOD 30 // Seconds
#define THERMAL_PROTECTION_BED_HYSTERESIS 2 // Degrees Celsius #define THERMAL_PROTECTION_BED_HYSTERESIS 2 // Degrees Celsius
/** /**
* As described above, except for the bed (M140/M190/M303). * As described above, except for the bed (M140/M190/M303).
*/ */
#define WATCH_BED_TEMP_PERIOD 60 // Seconds #define WATCH_BED_TEMP_PERIOD 60 // Seconds
#define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius #define WATCH_BED_TEMP_INCREASE 1 // Degrees Celsius
#endif #endif
/** /**
* Thermal Protection parameters for the heated chamber. * Thermal Protection parameters for the heated chamber.
*/ */
#if ENABLED(THERMAL_PROTECTION_CHAMBER) #if ENABLED(THERMAL_PROTECTION_CHAMBER)
#define THERMAL_PROTECTION_CHAMBER_PERIOD 20 // Seconds #define THERMAL_PROTECTION_CHAMBER_PERIOD 60 // Seconds
#define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius #define THERMAL_PROTECTION_CHAMBER_HYSTERESIS 2 // Degrees Celsius
/** /**
* Heated chamber watch settings (M141/M191). * Heated chamber watch settings (M141/M191).
*/ */
#define WATCH_CHAMBER_TEMP_PERIOD 60 // Seconds #define WATCH_CHAMBER_TEMP_PERIOD 360 // Seconds
#define WATCH_CHAMBER_TEMP_INCREASE 2 // Degrees Celsius #define WATCH_CHAMBER_TEMP_INCREASE 2 // Degrees Celsius
#endif #endif
@@ -437,9 +420,9 @@
* Hotend Idle Timeout * Hotend Idle Timeout
* Prevent filament in the nozzle from charring and causing a critical jam. * Prevent filament in the nozzle from charring and causing a critical jam.
*/ */
#define HOTEND_IDLE_TIMEOUT //#define HOTEND_IDLE_TIMEOUT
#if ENABLED(HOTEND_IDLE_TIMEOUT) #if ENABLED(HOTEND_IDLE_TIMEOUT)
#define HOTEND_IDLE_TIMEOUT_SEC (15*60) // (seconds) Time without extruder movement to trigger protection #define HOTEND_IDLE_TIMEOUT_SEC (5*60) // (seconds) Time without extruder movement to trigger protection
#define HOTEND_IDLE_MIN_TRIGGER 180 // (°C) Minimum temperature to enable hotend protection #define HOTEND_IDLE_MIN_TRIGGER 180 // (°C) Minimum temperature to enable hotend protection
#define HOTEND_IDLE_NOZZLE_TARGET 0 // (°C) Safe temperature for the nozzle after timeout #define HOTEND_IDLE_NOZZLE_TARGET 0 // (°C) Safe temperature for the nozzle after timeout
#define HOTEND_IDLE_BED_TARGET 0 // (°C) Safe temperature for the bed after timeout #define HOTEND_IDLE_BED_TARGET 0 // (°C) Safe temperature for the bed after timeout
@@ -573,13 +556,13 @@
/** /**
* M355 Case Light on-off / brightness * M355 Case Light on-off / brightness
*/ */
//#define CASE_LIGHT_ENABLE #define CASE_LIGHT_ENABLE
#if ENABLED(CASE_LIGHT_ENABLE) #if ENABLED(CASE_LIGHT_ENABLE)
//#define CASE_LIGHT_PIN 4 // Override the default pin if needed //#define CASE_LIGHT_PIN 4 // Override the default pin if needed
#define INVERT_CASE_LIGHT false // Set true if Case Light is ON when pin is LOW #define INVERT_CASE_LIGHT false // Set true if Case Light is ON when pin is LOW
#define CASE_LIGHT_DEFAULT_ON true // Set default power-up state on #define CASE_LIGHT_DEFAULT_ON true // Set default power-up state on
#define CASE_LIGHT_DEFAULT_BRIGHTNESS 105 // Set default power-up brightness (0-255, requires PWM pin) #define CASE_LIGHT_DEFAULT_BRIGHTNESS 255 // Set default power-up brightness (0-255, requires PWM pin)
//#define CASE_LIGHT_NO_BRIGHTNESS // Disable brightness control. Enable for non-PWM lighting. #define CASE_LIGHT_NO_BRIGHTNESS // Disable brightness control. Enable for non-PWM lighting.
//#define CASE_LIGHT_MAX_PWM 128 // Limit PWM duty cycle (0-255) //#define CASE_LIGHT_MAX_PWM 128 // Limit PWM duty cycle (0-255)
//#define CASE_LIGHT_MENU // Add Case Light options to the LCD menu //#define CASE_LIGHT_MENU // Add Case Light options to the LCD menu
#if ENABLED(NEOPIXEL_LED) #if ENABLED(NEOPIXEL_LED)
@@ -915,13 +898,10 @@
//#define MULTI_NOZZLE_DUPLICATION //#define MULTI_NOZZLE_DUPLICATION
// By default pololu step drivers require an active high signal. However, some high power drivers require an active low signal as step. // By default pololu step drivers require an active high signal. However, some high power drivers require an active low signal as step.
#define INVERT_X_STEP_PIN false #define INVERT_X_STEP_PIN true
#define INVERT_Y_STEP_PIN false #define INVERT_Y_STEP_PIN true
#define INVERT_Z_STEP_PIN false #define INVERT_Z_STEP_PIN true
#define INVERT_I_STEP_PIN false #define INVERT_E_STEP_PIN true
#define INVERT_J_STEP_PIN false
#define INVERT_K_STEP_PIN false
#define INVERT_E_STEP_PIN false
/** /**
* Idle Stepper Shutdown * Idle Stepper Shutdown
@@ -932,9 +912,6 @@
#define DISABLE_INACTIVE_X true #define DISABLE_INACTIVE_X true
#define DISABLE_INACTIVE_Y true #define DISABLE_INACTIVE_Y true
#define DISABLE_INACTIVE_Z true // Set 'false' if the nozzle could fall onto your printed part! #define DISABLE_INACTIVE_Z true // Set 'false' if the nozzle could fall onto your printed part!
#define DISABLE_INACTIVE_I true
#define DISABLE_INACTIVE_J true
#define DISABLE_INACTIVE_K true
#define DISABLE_INACTIVE_E true #define DISABLE_INACTIVE_E true
// Default Minimum Feedrates for printing and travel moves // Default Minimum Feedrates for printing and travel moves
@@ -971,26 +948,23 @@
// Backlash Compensation // Backlash Compensation
// Adds extra movement to axes on direction-changes to account for backlash. // Adds extra movement to axes on direction-changes to account for backlash.
// //
#define BACKLASH_COMPENSATION //#define BACKLASH_COMPENSATION
#if ENABLED(BACKLASH_COMPENSATION) #if ENABLED(BACKLASH_COMPENSATION)
// Define values for backlash distance and correction. // Define values for backlash distance and correction.
// If BACKLASH_GCODE is enabled these values are the defaults. // If BACKLASH_GCODE is enabled these values are the defaults.
#define BACKLASH_DISTANCE_MM { 0, 0, 0 } // (mm) One value for each linear axis #define BACKLASH_DISTANCE_MM { 0, 0, 0 } // (mm)
#define BACKLASH_CORRECTION 0.02 // 0.0 = no correction; 1.0 = full correction #define BACKLASH_CORRECTION 0.0 // 0.0 = no correction; 1.0 = full correction
// Add steps for motor direction changes on CORE kinematics
//#define CORE_BACKLASH
// Set BACKLASH_SMOOTHING_MM to spread backlash correction over multiple segments // Set BACKLASH_SMOOTHING_MM to spread backlash correction over multiple segments
// to reduce print artifacts. (Enabling this is costly in memory and computation!) // to reduce print artifacts. (Enabling this is costly in memory and computation!)
//#define BACKLASH_SMOOTHING_MM 3 // (mm) //#define BACKLASH_SMOOTHING_MM 3 // (mm)
// Add runtime configuration and tuning of backlash values (M425) // Add runtime configuration and tuning of backlash values (M425)
#define BACKLASH_GCODE //#define BACKLASH_GCODE
#if ENABLED(BACKLASH_GCODE) #if ENABLED(BACKLASH_GCODE)
// Measure the Z backlash when probing (G29) and set with "M425 Z" // Measure the Z backlash when probing (G29) and set with "M425 Z"
//#define MEASURE_BACKLASH_WHEN_PROBING #define MEASURE_BACKLASH_WHEN_PROBING
#if ENABLED(MEASURE_BACKLASH_WHEN_PROBING) #if ENABLED(MEASURE_BACKLASH_WHEN_PROBING)
// When measuring, the probe will move up to BACKLASH_MEASUREMENT_LIMIT // When measuring, the probe will move up to BACKLASH_MEASUREMENT_LIMIT
@@ -1046,13 +1020,6 @@
#define CALIBRATION_MEASURE_LEFT #define CALIBRATION_MEASURE_LEFT
#define CALIBRATION_MEASURE_BACK #define CALIBRATION_MEASURE_BACK
//#define CALIBRATION_MEASURE_IMIN
//#define CALIBRATION_MEASURE_IMAX
//#define CALIBRATION_MEASURE_JMIN
//#define CALIBRATION_MEASURE_JMAX
//#define CALIBRATION_MEASURE_KMIN
//#define CALIBRATION_MEASURE_KMAX
// Probing at the exact top center only works if the center is flat. If // Probing at the exact top center only works if the center is flat. If
// probing on a screwhead or hollow washer, probe near the edges. // probing on a screwhead or hollow washer, probe near the edges.
//#define CALIBRATION_MEASURE_AT_TOP_EDGES //#define CALIBRATION_MEASURE_AT_TOP_EDGES
@@ -1108,7 +1075,7 @@
* M908 - BQ_ZUM_MEGA_3D, RAMBO, PRINTRBOARD_REVF, RIGIDBOARD_V2 & SCOOVO_X9H * M908 - BQ_ZUM_MEGA_3D, RAMBO, PRINTRBOARD_REVF, RIGIDBOARD_V2 & SCOOVO_X9H
* M909, M910 & LCD - only PRINTRBOARD_REVF & RIGIDBOARD_V2 * M909, M910 & LCD - only PRINTRBOARD_REVF & RIGIDBOARD_V2
*/ */
//#define PWM_MOTOR_CURRENT { 1300, 1300, 1250 } // Values in milliamps #define PWM_MOTOR_CURRENT { 1300, 1300, 1250 } // Values in milliamps
//#define DIGIPOT_MOTOR_CURRENT { 135,135,135,135,135 } // Values 0-255 (RAMBO 135 = ~0.75A, 185 = ~1A) //#define DIGIPOT_MOTOR_CURRENT { 135,135,135,135,135 } // Values 0-255 (RAMBO 135 = ~0.75A, 185 = ~1A)
//#define DAC_MOTOR_CURRENT_DEFAULT { 70, 80, 90, 80 } // Default drive percent - X, Y, Z, E axis //#define DAC_MOTOR_CURRENT_DEFAULT { 70, 80, 90, 80 } // Default drive percent - X, Y, Z, E axis
@@ -1188,7 +1155,7 @@
#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)
//#define LCD_PRINTER_INFO_IS_BOOTSCREEN // Show bootscreen(s) instead of Printer Info pages //#define LCD_PRINTER_INFO_IS_BOOTSCREEN // Show bootscreen(s) instead of Printer Info pages
#endif #endif
@@ -1232,7 +1199,7 @@
#if HAS_DISPLAY #if HAS_DISPLAY
// The timeout (in ms) to return to the status screen from sub-menus // The timeout (in ms) to return to the status screen from sub-menus
//#define LCD_TIMEOUT_TO_STATUS 15000 #define LCD_TIMEOUT_TO_STATUS 15000
#if ENABLED(SHOW_BOOTSCREEN) #if ENABLED(SHOW_BOOTSCREEN)
#define BOOTSCREEN_TIMEOUT 4000 // (ms) Total Duration to display the boot screen(s) #define BOOTSCREEN_TIMEOUT 4000 // (ms) Total Duration to display the boot screen(s)
@@ -1314,9 +1281,7 @@
//#define BROWSE_MEDIA_ON_INSERT // Open the file browser when media is inserted //#define BROWSE_MEDIA_ON_INSERT // Open the file browser when media is inserted
//#define MEDIA_MENU_AT_TOP // Force the media menu to be listed on the top of the main menu #define EVENT_GCODE_SD_ABORT "G28XY" // G-code to run on SD Abort Print (e.g., "G28XY" or "G27")
#define EVENT_GCODE_SD_ABORT "M84" // G-code to run on SD Abort Print (e.g., "G28XY" or "G27")
#if ENABLED(PRINTER_EVENT_LEDS) #if ENABLED(PRINTER_EVENT_LEDS)
#define PE_LEDS_COMPLETED_TIME (30*60) // (seconds) Time to keep the LED "done" color before restoring normal illumination #define PE_LEDS_COMPLETED_TIME (30*60) // (seconds) Time to keep the LED "done" color before restoring normal illumination
@@ -1330,7 +1295,7 @@
* an option on the LCD screen to continue the print from the last-known * an option on the LCD screen to continue the print from the last-known
* point in the file. * point in the file.
*/ */
#define POWER_LOSS_RECOVERY //#define POWER_LOSS_RECOVERY
#if ENABLED(POWER_LOSS_RECOVERY) #if ENABLED(POWER_LOSS_RECOVERY)
#define PLR_ENABLED_DEFAULT false // Power Loss Recovery enabled by default. (Set with 'M413 Sn' & M500) #define PLR_ENABLED_DEFAULT false // Power Loss Recovery enabled by default. (Set with 'M413 Sn' & M500)
//#define BACKUP_POWER_SUPPLY // Backup power / UPS to move the steppers on power loss //#define BACKUP_POWER_SUPPLY // Backup power / UPS to move the steppers on power loss
@@ -1496,15 +1461,6 @@
// Enable if SD detect is rendered useless (e.g., by using an SD extender) // Enable if SD detect is rendered useless (e.g., by using an SD extender)
//#define NO_SD_DETECT //#define NO_SD_DETECT
// Multiple volume support - EXPERIMENTAL.
//#define MULTI_VOLUME
#if ENABLED(MULTI_VOLUME)
#define VOLUME_SD_ONBOARD
#define VOLUME_USB_FLASH_DRIVE
#define DEFAULT_VOLUME SV_SD_ONBOARD
#define DEFAULT_SHARED_VOLUME SV_USB_FLASH_DRIVE
#endif
#endif // SDSUPPORT #endif // SDSUPPORT
/** /**
@@ -1583,11 +1539,11 @@
#define STATUS_CHAMBER_ANIM // Use a second bitmap to indicate chamber heating #define STATUS_CHAMBER_ANIM // Use a second bitmap to indicate chamber heating
//#define STATUS_CUTTER_ANIM // Use a second bitmap to indicate spindle / laser active //#define STATUS_CUTTER_ANIM // Use a second bitmap to indicate spindle / laser active
//#define STATUS_COOLER_ANIM // Use a second bitmap to indicate laser cooling //#define STATUS_COOLER_ANIM // Use a second bitmap to indicate laser cooling
//#define STATUS_FLOWMETER_ANIM // Use multiple bitmaps to indicate coolant flow
//#define STATUS_ALT_BED_BITMAP // Use the alternative bed bitmap //#define STATUS_ALT_BED_BITMAP // Use the alternative bed bitmap
//#define STATUS_ALT_FAN_BITMAP // Use the alternative fan bitmap //#define STATUS_ALT_FAN_BITMAP // Use the alternative fan bitmap
//#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames //#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames
//#define STATUS_HEAT_PERCENT // Show heating in a progress bar //#define STATUS_HEAT_PERCENT // Show heating in a progress bar
#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash)
//#define BOOT_MARLIN_LOGO_ANIMATED // Animated Marlin logo. Costs ~3260 (or ~940) bytes of PROGMEM. //#define BOOT_MARLIN_LOGO_ANIMATED // Animated Marlin logo. Costs ~3260 (or ~940) bytes of PROGMEM.
// Frivolous Game Options // Frivolous Game Options
@@ -1635,31 +1591,6 @@
#endif #endif
#endif // HAS_DGUS_LCD #endif // HAS_DGUS_LCD
//
// Additional options for AnyCubic Chiron TFT displays
//
#if ENABLED(ANYCUBIC_LCD_CHIRON)
// By default the type of panel is automatically detected.
// Enable one of these options if you know the panel type.
//#define CHIRON_TFT_STANDARD
//#define CHIRON_TFT_NEW
// Enable the longer Anycubic powerup startup tune
//#define AC_DEFAULT_STARTUP_TUNE
/**
* Display Folders
* By default the file browser lists all G-code files (including those in subfolders) in a flat list.
* Enable this option to display a hierarchical file browser.
*
* NOTES:
* - Without this option it helps to enable SDCARD_SORT_ALPHA so files are sorted before/after folders.
* - When used with the "new" panel, folder names will also have '.gcode' appended to their names.
* This hack is currently required to force the panel to show folders.
*/
#define AC_SD_FOLDER_VIEW
#endif
// //
// Specify additional languages for the UI. Default specified by LCD_LANGUAGE. // Specify additional languages for the UI. Default specified by LCD_LANGUAGE.
// //
@@ -1813,13 +1744,14 @@
//#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA!
#define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way
//#define BABYSTEP_MILLIMETER_UNITS // Specify BABYSTEP_MULTIPLICATOR_(XY|Z) in mm instead of micro-steps //#define BABYSTEP_MILLIMETER_UNITS // Specify BABYSTEP_MULTIPLICATOR_(XY|Z) in mm instead of micro-steps
#define BABYSTEP_MULTIPLICATOR_Z 1 // (steps or mm) Steps or millimeter distance for each Z babystep #define BABYSTEP_MULTIPLICATOR_Z 20 // (steps or mm) Steps or millimeter distance for each Z babystep
#define BABYSTEP_MULTIPLICATOR_XY 1 // (steps or mm) Steps or millimeter distance for each XY babystep #define BABYSTEP_MULTIPLICATOR_XY 1 // (steps or mm) Steps or millimeter distance for each XY babystep
#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. #define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping.
#if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING)
#define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds.
// Note: Extra time may be added to mitigate controller latency. // Note: Extra time may be added to mitigate controller latency.
#define BABYSTEP_ALWAYS_AVAILABLE // Allow babystepping at all times (not just during movement).
//#define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. //#define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle.
#if ENABLED(MOVE_Z_WHEN_IDLE) #if ENABLED(MOVE_Z_WHEN_IDLE)
#define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size.
@@ -1831,7 +1763,7 @@
//#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping //#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping
#if ENABLED(BABYSTEP_ZPROBE_OFFSET) #if ENABLED(BABYSTEP_ZPROBE_OFFSET)
//#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets //#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets
//#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor #define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor
#endif #endif
#endif #endif
@@ -2129,6 +2061,9 @@
//#define SERIAL_XON_XOFF //#define SERIAL_XON_XOFF
#endif #endif
// Add M575 G-code to change the baud rate
//#define BAUD_RATE_GCODE
#if ENABLED(SDSUPPORT) #if ENABLED(SDSUPPORT)
// Enable this option to collect and display the maximum // Enable this option to collect and display the maximum
// RX queue usage after transferring a file to SD. // RX queue usage after transferring a file to SD.
@@ -2155,26 +2090,6 @@
*/ */
#define EMERGENCY_PARSER #define EMERGENCY_PARSER
/**
* Realtime Reporting (requires EMERGENCY_PARSER)
*
* - Report position and state of the machine (like Grbl).
* - Auto-report position during long moves.
* - Useful for CNC/LASER.
*
* Adds support for commands:
* S000 : Report State and Position while moving.
* P000 : Instant Pause / Hold while moving.
* R000 : Resume from Pause / Hold.
*
* - During Hold all Emergency Parser commands are available, as usual.
* - Enable NANODLP_Z_SYNC and NANODLP_ALL_AXIS for move command end-state reports.
*/
//#define REALTIME_REPORTING_COMMANDS
#if ENABLED(REALTIME_REPORTING_COMMANDS)
//#define FULL_REPORT_TO_HOST_FEATURE // Auto-report the machine status like Grbl CNC
#endif
// Bad Serial-connections can miss a received command by sending an 'ok' // Bad Serial-connections can miss a received command by sending an 'ok'
// Therefore some clients abort after 30 seconds in a timeout. // Therefore some clients abort after 30 seconds in a timeout.
// Some other clients start sending commands while receiving a 'wait'. // Some other clients start sending commands while receiving a 'wait'.
@@ -2249,19 +2164,6 @@
//#define EVENT_GCODE_AFTER_TOOLCHANGE "G12X" // Extra G-code to run after tool-change //#define EVENT_GCODE_AFTER_TOOLCHANGE "G12X" // Extra G-code to run after tool-change
#endif #endif
/**
* Extra G-code to run while executing tool-change commands. Can be used to use an additional
* stepper motor (I axis, see option LINEAR_AXES in Configuration.h) to drive the tool-changer.
*/
//#define EVENT_GCODE_TOOLCHANGE_T0 "G28 A\nG1 I0" // Extra G-code to run while executing tool-change command T0
//#define EVENT_GCODE_TOOLCHANGE_T1 "G1 A10" // Extra G-code to run while executing tool-change command T1
/**
* Tool Sensors detect when tools have been picked up or dropped.
* Requires the pins TOOL_SENSOR1_PIN, TOOL_SENSOR2_PIN, etc.
*/
//#define TOOL_SENSOR
/** /**
* Retract and prime filament on tool-change to reduce * Retract and prime filament on tool-change to reduce
* ooze and stringing and to get cleaner transitions. * ooze and stringing and to get cleaner transitions.
@@ -2320,15 +2222,14 @@
#endif // HAS_MULTI_EXTRUDER #endif // HAS_MULTI_EXTRUDER
/** /**
* Advanced Pause for Filament Change * Advanced Pause
* - Adds the G-code M600 Filament Change to initiate a filament change. * Experimental feature for filament change support and for parking the nozzle when paused.
* - This feature is required for the default FILAMENT_RUNOUT_SCRIPT. * Adds the GCode M600 for initiating filament change.
* If PARK_HEAD_ON_PAUSE enabled, adds the GCode M125 to pause printing and park the nozzle.
* *
* Requirements: * Requires an LCD display.
* - For Filament Change parking enable and configure NOZZLE_PARK_FEATURE. * Requires NOZZLE_PARK_FEATURE.
* - For user interaction enable an LCD display, HOST_PROMPT_SUPPORT, or EMERGENCY_PARSER. * This feature is required for the default FILAMENT_RUNOUT_SCRIPT.
*
* Enable PARK_HEAD_ON_PAUSE to add the G-code M125 Pause and Park.
*/ */
#define ADVANCED_PAUSE_FEATURE #define ADVANCED_PAUSE_FEATURE
#if ENABLED(ADVANCED_PAUSE_FEATURE) #if ENABLED(ADVANCED_PAUSE_FEATURE)
@@ -2356,7 +2257,7 @@
// Filament can be extruded repeatedly from the Filament Change menu // Filament can be extruded repeatedly from the Filament Change menu
// until extrusion is consistent, and to purge old filament. // until extrusion is consistent, and to purge old filament.
#define ADVANCED_PAUSE_RESUME_PRIME 0 // (mm) Extra distance to prime nozzle after returning from park. #define ADVANCED_PAUSE_RESUME_PRIME 0 // (mm) Extra distance to prime nozzle after returning from park.
//#define ADVANCED_PAUSE_FANS_PAUSE // Turn off print-cooling fans while the machine is paused. #define ADVANCED_PAUSE_FANS_PAUSE // Turn off print-cooling fans while the machine is paused.
// Filament Unload does a Retract, Delay, and Purge first: // Filament Unload does a Retract, Delay, and Purge first:
#define FILAMENT_UNLOAD_PURGE_RETRACT 13 // (mm) Unload initial retract length. #define FILAMENT_UNLOAD_PURGE_RETRACT 13 // (mm) Unload initial retract length.
@@ -2365,7 +2266,7 @@
#define FILAMENT_UNLOAD_PURGE_FEEDRATE 25 // (mm/s) feedrate to purge before unload #define FILAMENT_UNLOAD_PURGE_FEEDRATE 25 // (mm/s) feedrate to purge before unload
#define PAUSE_PARK_NOZZLE_TIMEOUT 45 // (seconds) Time limit before the nozzle is turned off for safety. #define PAUSE_PARK_NOZZLE_TIMEOUT 45 // (seconds) Time limit before the nozzle is turned off for safety.
#define FILAMENT_CHANGE_ALERT_BEEPS 10 // Number of alert beeps to play when a response is needed. #define FILAMENT_CHANGE_ALERT_BEEPS 2 // Number of alert beeps to play when a response is needed.
#define PAUSE_PARK_NO_STEPPER_TIMEOUT // Enable for XYZ steppers to stay powered on during filament change. #define PAUSE_PARK_NO_STEPPER_TIMEOUT // Enable for XYZ steppers to stay powered on during filament change.
#define PARK_HEAD_ON_PAUSE // Park the nozzle during pause and filament change. #define PARK_HEAD_ON_PAUSE // Park the nozzle during pause and filament change.
@@ -2433,24 +2334,6 @@
#define Z4_MICROSTEPS Z_MICROSTEPS #define Z4_MICROSTEPS Z_MICROSTEPS
#endif #endif
#if AXIS_DRIVER_TYPE_I(TMC26X)
#define I_MAX_CURRENT 1000
#define I_SENSE_RESISTOR 91
#define I_MICROSTEPS 16
#endif
#if AXIS_DRIVER_TYPE_J(TMC26X)
#define J_MAX_CURRENT 1000
#define J_SENSE_RESISTOR 91
#define J_MICROSTEPS 16
#endif
#if AXIS_DRIVER_TYPE_K(TMC26X)
#define K_MAX_CURRENT 1000
#define K_SENSE_RESISTOR 91
#define K_MICROSTEPS 16
#endif
#if AXIS_DRIVER_TYPE_E0(TMC26X) #if AXIS_DRIVER_TYPE_E0(TMC26X)
#define E0_MAX_CURRENT 1000 #define E0_MAX_CURRENT 1000
#define E0_SENSE_RESISTOR 91 #define E0_SENSE_RESISTOR 91
@@ -2601,33 +2484,6 @@
//#define Z4_INTERPOLATE true //#define Z4_INTERPOLATE true
#endif #endif
#if AXIS_IS_TMC(I)
#define I_CURRENT 800
#define I_CURRENT_HOME I_CURRENT
#define I_MICROSTEPS 16
#define I_RSENSE 0.11
#define I_CHAIN_POS -1
//#define I_INTERPOLATE true
#endif
#if AXIS_IS_TMC(J)
#define J_CURRENT 800
#define J_CURRENT_HOME J_CURRENT
#define J_MICROSTEPS 16
#define J_RSENSE 0.11
#define J_CHAIN_POS -1
//#define J_INTERPOLATE true
#endif
#if AXIS_IS_TMC(K)
#define K_CURRENT 800
#define K_CURRENT_HOME K_CURRENT
#define K_MICROSTEPS 16
#define K_RSENSE 0.11
#define K_CHAIN_POS -1
//#define K_INTERPOLATE true
#endif
#if AXIS_IS_TMC(E0) #if AXIS_IS_TMC(E0)
#define E0_CURRENT 800 #define E0_CURRENT 800
#define E0_MICROSTEPS 16 #define E0_MICROSTEPS 16
@@ -2638,7 +2494,7 @@
#if AXIS_IS_TMC(E1) #if AXIS_IS_TMC(E1)
#define E1_CURRENT 800 #define E1_CURRENT 800
#define E1_MICROSTEPS E0_MICROSTEPS #define E1_MICROSTEPS E0_MICROSTEPS
#define E1_RSENSE 0.11 #define E1_RSENSE 0.11
#define E1_CHAIN_POS -1 #define E1_CHAIN_POS -1
//#define E1_INTERPOLATE true //#define E1_INTERPOLATE true
@@ -2646,7 +2502,7 @@
#if AXIS_IS_TMC(E2) #if AXIS_IS_TMC(E2)
#define E2_CURRENT 800 #define E2_CURRENT 800
#define E2_MICROSTEPS E0_MICROSTEPS #define E2_MICROSTEPS E0_MICROSTEPS
#define E2_RSENSE 0.11 #define E2_RSENSE 0.11
#define E2_CHAIN_POS -1 #define E2_CHAIN_POS -1
//#define E2_INTERPOLATE true //#define E2_INTERPOLATE true
@@ -2654,7 +2510,7 @@
#if AXIS_IS_TMC(E3) #if AXIS_IS_TMC(E3)
#define E3_CURRENT 800 #define E3_CURRENT 800
#define E3_MICROSTEPS E0_MICROSTEPS #define E3_MICROSTEPS E0_MICROSTEPS
#define E3_RSENSE 0.11 #define E3_RSENSE 0.11
#define E3_CHAIN_POS -1 #define E3_CHAIN_POS -1
//#define E3_INTERPOLATE true //#define E3_INTERPOLATE true
@@ -2662,7 +2518,7 @@
#if AXIS_IS_TMC(E4) #if AXIS_IS_TMC(E4)
#define E4_CURRENT 800 #define E4_CURRENT 800
#define E4_MICROSTEPS E0_MICROSTEPS #define E4_MICROSTEPS E0_MICROSTEPS
#define E4_RSENSE 0.11 #define E4_RSENSE 0.11
#define E4_CHAIN_POS -1 #define E4_CHAIN_POS -1
//#define E4_INTERPOLATE true //#define E4_INTERPOLATE true
@@ -2670,7 +2526,7 @@
#if AXIS_IS_TMC(E5) #if AXIS_IS_TMC(E5)
#define E5_CURRENT 800 #define E5_CURRENT 800
#define E5_MICROSTEPS E0_MICROSTEPS #define E5_MICROSTEPS E0_MICROSTEPS
#define E5_RSENSE 0.11 #define E5_RSENSE 0.11
#define E5_CHAIN_POS -1 #define E5_CHAIN_POS -1
//#define E5_INTERPOLATE true //#define E5_INTERPOLATE true
@@ -2678,7 +2534,7 @@
#if AXIS_IS_TMC(E6) #if AXIS_IS_TMC(E6)
#define E6_CURRENT 800 #define E6_CURRENT 800
#define E6_MICROSTEPS E0_MICROSTEPS #define E6_MICROSTEPS E0_MICROSTEPS
#define E6_RSENSE 0.11 #define E6_RSENSE 0.11
#define E6_CHAIN_POS -1 #define E6_CHAIN_POS -1
//#define E6_INTERPOLATE true //#define E6_INTERPOLATE true
@@ -2686,7 +2542,7 @@
#if AXIS_IS_TMC(E7) #if AXIS_IS_TMC(E7)
#define E7_CURRENT 800 #define E7_CURRENT 800
#define E7_MICROSTEPS E0_MICROSTEPS #define E7_MICROSTEPS E0_MICROSTEPS
#define E7_RSENSE 0.11 #define E7_RSENSE 0.11
#define E7_CHAIN_POS -1 #define E7_CHAIN_POS -1
//#define E7_INTERPOLATE true //#define E7_INTERPOLATE true
@@ -2703,10 +2559,6 @@
//#define Y2_CS_PIN -1 //#define Y2_CS_PIN -1
//#define Z2_CS_PIN -1 //#define Z2_CS_PIN -1
//#define Z3_CS_PIN -1 //#define Z3_CS_PIN -1
//#define Z4_CS_PIN -1
//#define I_CS_PIN -1
//#define J_CS_PIN -1
//#define K_CS_PIN -1
//#define E0_CS_PIN -1 //#define E0_CS_PIN -1
//#define E1_CS_PIN -1 //#define E1_CS_PIN -1
//#define E2_CS_PIN -1 //#define E2_CS_PIN -1
@@ -2746,9 +2598,6 @@
//#define Z2_SLAVE_ADDRESS 0 //#define Z2_SLAVE_ADDRESS 0
//#define Z3_SLAVE_ADDRESS 0 //#define Z3_SLAVE_ADDRESS 0
//#define Z4_SLAVE_ADDRESS 0 //#define Z4_SLAVE_ADDRESS 0
//#define I_SLAVE_ADDRESS 0
//#define J_SLAVE_ADDRESS 0
//#define K_SLAVE_ADDRESS 0
//#define E0_SLAVE_ADDRESS 0 //#define E0_SLAVE_ADDRESS 0
//#define E1_SLAVE_ADDRESS 0 //#define E1_SLAVE_ADDRESS 0
//#define E2_SLAVE_ADDRESS 0 //#define E2_SLAVE_ADDRESS 0
@@ -2773,9 +2622,6 @@
*/ */
#define STEALTHCHOP_XY #define STEALTHCHOP_XY
#define STEALTHCHOP_Z #define STEALTHCHOP_Z
#define STEALTHCHOP_I
#define STEALTHCHOP_J
#define STEALTHCHOP_K
#define STEALTHCHOP_E #define STEALTHCHOP_E
/** /**
@@ -2794,22 +2640,22 @@
* { <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 // All axes (override below) #define CHOPPER_TIMING CHOPPER_DEFAULT_12V // All axes (override below)
//#define CHOPPER_TIMING_X CHOPPER_TIMING // For X Axes (override below) //#define CHOPPER_TIMING_X CHOPPER_DEFAULT_12V // For X Axes (override below)
//#define CHOPPER_TIMING_X2 CHOPPER_TIMING_X //#define CHOPPER_TIMING_X2 CHOPPER_DEFAULT_12V
//#define CHOPPER_TIMING_Y CHOPPER_TIMING // For Y Axes (override below) //#define CHOPPER_TIMING_Y CHOPPER_DEFAULT_12V // For Y Axes (override below)
//#define CHOPPER_TIMING_Y2 CHOPPER_TIMING_Y //#define CHOPPER_TIMING_Y2 CHOPPER_DEFAULT_12V
//#define CHOPPER_TIMING_Z CHOPPER_TIMING // For Z Axes (override below) //#define CHOPPER_TIMING_Z CHOPPER_DEFAULT_12V // For Z Axes (override below)
//#define CHOPPER_TIMING_Z2 CHOPPER_TIMING_Z //#define CHOPPER_TIMING_Z2 CHOPPER_DEFAULT_12V
//#define CHOPPER_TIMING_Z3 CHOPPER_TIMING_Z //#define CHOPPER_TIMING_Z3 CHOPPER_DEFAULT_12V
//#define CHOPPER_TIMING_Z4 CHOPPER_TIMING_Z //#define CHOPPER_TIMING_Z4 CHOPPER_DEFAULT_12V
//#define CHOPPER_TIMING_E CHOPPER_TIMING // For Extruders (override below) //#define CHOPPER_TIMING_E CHOPPER_DEFAULT_12V // For Extruders (override below)
//#define CHOPPER_TIMING_E1 CHOPPER_TIMING_E //#define CHOPPER_TIMING_E1 CHOPPER_DEFAULT_12V
//#define CHOPPER_TIMING_E2 CHOPPER_TIMING_E //#define CHOPPER_TIMING_E2 CHOPPER_DEFAULT_12V
//#define CHOPPER_TIMING_E3 CHOPPER_TIMING_E //#define CHOPPER_TIMING_E3 CHOPPER_DEFAULT_12V
//#define CHOPPER_TIMING_E4 CHOPPER_TIMING_E //#define CHOPPER_TIMING_E4 CHOPPER_DEFAULT_12V
//#define CHOPPER_TIMING_E5 CHOPPER_TIMING_E //#define CHOPPER_TIMING_E5 CHOPPER_DEFAULT_12V
//#define CHOPPER_TIMING_E6 CHOPPER_TIMING_E //#define CHOPPER_TIMING_E6 CHOPPER_DEFAULT_12V
//#define CHOPPER_TIMING_E7 CHOPPER_TIMING_E //#define CHOPPER_TIMING_E7 CHOPPER_DEFAULT_12V
/** /**
* Monitor Trinamic drivers * Monitor Trinamic drivers
@@ -2847,9 +2693,6 @@
#define Z2_HYBRID_THRESHOLD 3 #define Z2_HYBRID_THRESHOLD 3
#define Z3_HYBRID_THRESHOLD 3 #define Z3_HYBRID_THRESHOLD 3
#define Z4_HYBRID_THRESHOLD 3 #define Z4_HYBRID_THRESHOLD 3
#define I_HYBRID_THRESHOLD 3
#define J_HYBRID_THRESHOLD 3
#define K_HYBRID_THRESHOLD 3
#define E0_HYBRID_THRESHOLD 30 #define E0_HYBRID_THRESHOLD 30
#define E1_HYBRID_THRESHOLD 30 #define E1_HYBRID_THRESHOLD 30
#define E2_HYBRID_THRESHOLD 30 #define E2_HYBRID_THRESHOLD 30
@@ -2896,9 +2739,6 @@
//#define Z2_STALL_SENSITIVITY Z_STALL_SENSITIVITY //#define Z2_STALL_SENSITIVITY Z_STALL_SENSITIVITY
//#define Z3_STALL_SENSITIVITY Z_STALL_SENSITIVITY //#define Z3_STALL_SENSITIVITY Z_STALL_SENSITIVITY
//#define Z4_STALL_SENSITIVITY Z_STALL_SENSITIVITY //#define Z4_STALL_SENSITIVITY Z_STALL_SENSITIVITY
//#define I_STALL_SENSITIVITY 8
//#define J_STALL_SENSITIVITY 8
//#define K_STALL_SENSITIVITY 8
//#define SPI_ENDSTOPS // TMC2130 only //#define SPI_ENDSTOPS // TMC2130 only
//#define IMPROVE_HOMING_RELIABILITY //#define IMPROVE_HOMING_RELIABILITY
#endif #endif
@@ -2923,7 +2763,7 @@
/** /**
* Enable M122 debugging command for TMC stepper drivers. * Enable M122 debugging command for TMC stepper drivers.
* M122 S0/1 will enable continuous reporting. * M122 S0/1 will enable continous reporting.
*/ */
//#define TMC_DEBUG //#define TMC_DEBUG
@@ -3039,33 +2879,6 @@
#define Z4_SLEW_RATE 1 #define Z4_SLEW_RATE 1
#endif #endif
#if AXIS_DRIVER_TYPE_I(L6470)
#define I_MICROSTEPS 128
#define I_OVERCURRENT 2000
#define I_STALLCURRENT 1500
#define I_MAX_VOLTAGE 127
#define I_CHAIN_POS -1
#define I_SLEW_RATE 1
#endif
#if AXIS_DRIVER_TYPE_J(L6470)
#define J_MICROSTEPS 128
#define J_OVERCURRENT 2000
#define J_STALLCURRENT 1500
#define J_MAX_VOLTAGE 127
#define J_CHAIN_POS -1
#define J_SLEW_RATE 1
#endif
#if AXIS_DRIVER_TYPE_K(L6470)
#define K_MICROSTEPS 128
#define K_OVERCURRENT 2000
#define K_STALLCURRENT 1500
#define K_MAX_VOLTAGE 127
#define K_CHAIN_POS -1
#define K_SLEW_RATE 1
#endif
#if AXIS_IS_L64XX(E0) #if AXIS_IS_L64XX(E0)
#define E0_MICROSTEPS 128 #define E0_MICROSTEPS 128
#define E0_OVERCURRENT 2000 #define E0_OVERCURRENT 2000
@@ -3271,22 +3084,10 @@
#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 AIR_EVACUATION // Cutter Vacuum / Laser Blower motor control with G-codes M10-M11 //#define SPINDLE_SERVO // A servo converting an angle to spindle power
#if ENABLED(AIR_EVACUATION)
#define AIR_EVACUATION_ACTIVE LOW // Set to "HIGH" if the on/off function is active HIGH
//#define AIR_EVACUATION_PIN 42 // Override the default Cutter Vacuum or Laser Blower pin
#endif
//#define AIR_ASSIST // Air Assist control with G-codes M8-M9
#if ENABLED(AIR_ASSIST)
#define AIR_ASSIST_ACTIVE LOW // Active state on air assist pin
//#define AIR_ASSIST_PIN 44 // Override the default Air Assist pin
#endif
//#define SPINDLE_SERVO // A servo converting an angle to spindle power
#ifdef SPINDLE_SERVO #ifdef SPINDLE_SERVO
#define SPINDLE_SERVO_NR 0 // Index of servo used for spindle control #define SPINDLE_SERVO_NR 0 // Index of servo used for spindle control
#define SPINDLE_SERVO_MIN 10 // Minimum angle for servo spindle #define SPINDLE_SERVO_MIN 10 // Minimum angle for servo spindle
#endif #endif
/** /**
@@ -3418,18 +3219,6 @@
#endif #endif
#endif #endif
/**
* Synchronous Laser Control with M106/M107
*
* Marlin normally applies M106/M107 fan speeds at a time "soon after" processing
* a planner block. This is too inaccurate for a PWM/TTL laser attached to the fan
* header (as with some add-on laser kits). Enable this option to set fan/laser
* speeds with much more exact timing for improved print fidelity.
*
* NOTE: This option sacrifices some cooling fan speed options.
*/
//#define LASER_SYNCHRONOUS_M106_M107
/** /**
* Coolant Control * Coolant Control
* *
@@ -3489,27 +3278,13 @@
*/ */
//#define POWER_MONITOR_CURRENT // Monitor the system current //#define POWER_MONITOR_CURRENT // Monitor the system current
//#define POWER_MONITOR_VOLTAGE // Monitor the system voltage //#define POWER_MONITOR_VOLTAGE // Monitor the system voltage
#if EITHER(POWER_MONITOR_CURRENT, POWER_MONITOR_VOLTAGE)
#if ENABLED(POWER_MONITOR_CURRENT) #define POWER_MONITOR_VOLTS_PER_AMP 0.05000 // Input voltage to the MCU analog pin per amp - DO NOT apply more than ADC_VREF!
#define POWER_MONITOR_VOLTS_PER_AMP 0.05000 // Input voltage to the MCU analog pin per amp - DO NOT apply more than ADC_VREF! #define POWER_MONITOR_CURRENT_OFFSET -1 // Offset value for current sensors with linear function output
#define POWER_MONITOR_CURRENT_OFFSET 0 // Offset (in amps) applied to the calculated current #define POWER_MONITOR_VOLTS_PER_VOLT 0.11786 // Input voltage to the MCU analog pin per volt - DO NOT apply more than ADC_VREF!
#define POWER_MONITOR_FIXED_VOLTAGE 13.6 // Voltage for a current sensor with no voltage sensor (for power display) #define POWER_MONITOR_FIXED_VOLTAGE 13.6 // Voltage for a current sensor with no voltage sensor (for power display)
#endif #endif
#if ENABLED(POWER_MONITOR_VOLTAGE)
#define POWER_MONITOR_VOLTS_PER_VOLT 0.077933 // Input voltage to the MCU analog pin per volt - DO NOT apply more than ADC_VREF!
#define POWER_MONITOR_VOLTAGE_OFFSET 0 // Offset (in volts) applied to the calculated voltage
#endif
/**
* Stepper Driver Anti-SNAFU Protection
*
* If the SAFE_POWER_PIN is defined for your board, Marlin will check
* that stepper drivers are properly plugged in before applying power.
* Disable protection if your stepper drivers don't support the feature.
*/
//#define DISABLE_DRIVER_SAFE_POWER_PROTECT
/** /**
* CNC Coordinate Systems * CNC Coordinate Systems
* *
@@ -3523,11 +3298,6 @@
*/ */
#define AUTO_REPORT_TEMPERATURES #define AUTO_REPORT_TEMPERATURES
/**
* Auto-report position with M154 S<seconds>
*/
//#define AUTO_REPORT_POSITION
/** /**
* Include capabilities in M115 output * Include capabilities in M115 output
*/ */
@@ -3597,7 +3367,7 @@
#define PROPORTIONAL_FONT_RATIO 1.0 #define PROPORTIONAL_FONT_RATIO 1.0
/** /**
* Spend 28 bytes of SRAM to optimize the G-code parser * Spend 28 bytes of SRAM to optimize the GCode parser
*/ */
#define FASTER_GCODE_PARSER #define FASTER_GCODE_PARSER
@@ -3647,71 +3417,6 @@
#define GCODE_MACROS_SLOT_SIZE 50 // Maximum length of a single macro #define GCODE_MACROS_SLOT_SIZE 50 // Maximum length of a single macro
#endif #endif
/**
* User-defined menu items to run custom G-code.
* Up to 25 may be defined, but the actual number is LCD-dependent.
*/
// Custom Menu: Main Menu
//#define CUSTOM_MENU_MAIN
#if ENABLED(CUSTOM_MENU_MAIN)
//#define CUSTOM_MENU_MAIN_TITLE "Custom Commands"
#define CUSTOM_MENU_MAIN_SCRIPT_DONE "M117 User Script Done"
#define CUSTOM_MENU_MAIN_SCRIPT_AUDIBLE_FEEDBACK
//#define CUSTOM_MENU_MAIN_SCRIPT_RETURN // Return to status screen after a script
#define CUSTOM_MENU_MAIN_ONLY_IDLE // Only show custom menu when the machine is idle
#define MAIN_MENU_ITEM_1_DESC "Home & UBL Info"
#define MAIN_MENU_ITEM_1_GCODE "G28\nG29 W"
//#define MAIN_MENU_ITEM_1_CONFIRM // Show a confirmation dialog before this action
#define MAIN_MENU_ITEM_2_DESC "Preheat for " PREHEAT_1_LABEL
#define MAIN_MENU_ITEM_2_GCODE "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND)
//#define MAIN_MENU_ITEM_2_CONFIRM
//#define MAIN_MENU_ITEM_3_DESC "Preheat for " PREHEAT_2_LABEL
//#define MAIN_MENU_ITEM_3_GCODE "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND)
//#define MAIN_MENU_ITEM_3_CONFIRM
//#define MAIN_MENU_ITEM_4_DESC "Heat Bed/Home/Level"
//#define MAIN_MENU_ITEM_4_GCODE "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nG28\nG29"
//#define MAIN_MENU_ITEM_4_CONFIRM
//#define MAIN_MENU_ITEM_5_DESC "Home & Info"
//#define MAIN_MENU_ITEM_5_GCODE "G28\nM503"
//#define MAIN_MENU_ITEM_5_CONFIRM
#endif
// Custom Menu: Configuration Menu
//#define CUSTOM_MENU_CONFIG
#if ENABLED(CUSTOM_MENU_CONFIG)
//#define CUSTOM_MENU_CONFIG_TITLE "Custom Commands"
#define CUSTOM_MENU_CONFIG_SCRIPT_DONE "M117 Wireless Script Done"
#define CUSTOM_MENU_CONFIG_SCRIPT_AUDIBLE_FEEDBACK
//#define CUSTOM_MENU_CONFIG_SCRIPT_RETURN // Return to status screen after a script
#define CUSTOM_MENU_CONFIG_ONLY_IDLE // Only show custom menu when the machine is idle
#define CONFIG_MENU_ITEM_1_DESC "Wifi ON"
#define CONFIG_MENU_ITEM_1_GCODE "M118 [ESP110] WIFI-STA pwd=12345678"
//#define CONFIG_MENU_ITEM_1_CONFIRM // Show a confirmation dialog before this action
#define CONFIG_MENU_ITEM_2_DESC "Bluetooth ON"
#define CONFIG_MENU_ITEM_2_GCODE "M118 [ESP110] BT pwd=12345678"
//#define CONFIG_MENU_ITEM_2_CONFIRM
//#define CONFIG_MENU_ITEM_3_DESC "Radio OFF"
//#define CONFIG_MENU_ITEM_3_GCODE "M118 [ESP110] OFF pwd=12345678"
//#define CONFIG_MENU_ITEM_3_CONFIRM
//#define CONFIG_MENU_ITEM_4_DESC "Wifi ????"
//#define CONFIG_MENU_ITEM_4_GCODE "M118 ????"
//#define CONFIG_MENU_ITEM_4_CONFIRM
//#define CONFIG_MENU_ITEM_5_DESC "Wifi ????"
//#define CONFIG_MENU_ITEM_5_GCODE "M118 ????"
//#define CONFIG_MENU_ITEM_5_CONFIRM
#endif
/** /**
* User-defined buttons to run custom G-code. * User-defined buttons to run custom G-code.
* Up to 25 may be defined. * Up to 25 may be defined.
@@ -3743,6 +3448,39 @@
#endif #endif
#endif #endif
/**
* User-defined menu items to run custom G-code.
* Up to 25 may be defined, but the actual number is LCD-dependent.
*/
//#define CUSTOM_USER_MENUS
#if ENABLED(CUSTOM_USER_MENUS)
//#define CUSTOM_USER_MENU_TITLE "Custom Commands"
#define USER_SCRIPT_DONE "M117 User Script Done"
#define USER_SCRIPT_AUDIBLE_FEEDBACK
//#define USER_SCRIPT_RETURN // Return to status screen after a script
#define CUSTOM_MENU_ONLY_IDLE // Only show custom menu when the machine is idle
#define USER_DESC_1 "Home & UBL Info"
#define USER_GCODE_1 "G28\nG29W"
//#define USER_CONFIRM_1 // Show a confirmation dialog before this action
#define USER_DESC_2 "Preheat for " PREHEAT_1_LABEL
#define USER_GCODE_2 "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND)
//#define USER_CONFIRM_2
#define USER_DESC_3 "Preheat for " PREHEAT_2_LABEL
#define USER_GCODE_3 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND)
//#define USER_CONFIRM_3
#define USER_DESC_4 "Heat Bed/Home/Level"
#define USER_GCODE_4 "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nG28\nG29"
//#define USER_CONFIRM_4
#define USER_DESC_5 "Home & Info"
#define USER_GCODE_5 "G28\nM503"
//#define USER_CONFIRM_5
#endif
/** /**
* Host Action Commands * Host Action Commands
* *
@@ -3769,9 +3507,6 @@
* Implement M486 to allow Marlin to skip objects * Implement M486 to allow Marlin to skip objects
*/ */
//#define CANCEL_OBJECTS //#define CANCEL_OBJECTS
#if ENABLED(CANCEL_OBJECTS)
#define CANCEL_OBJECTS_REPORTING // Emit the current object as a status message
#endif
/** /**
* I2C position encoders for closed loop control. * I2C position encoders for closed loop control.
@@ -3893,16 +3628,6 @@
#define GANTRY_CALIBRATION_COMMANDS_POST "G28" // G28 highly recommended to ensure an accurate position #define GANTRY_CALIBRATION_COMMANDS_POST "G28" // G28 highly recommended to ensure an accurate position
#endif #endif
/**
* Instant freeze / unfreeze functionality
* Specified pin has pullup and connecting to ground will instantly pause motion.
* Potentially useful for emergency stop that allows being resumed.
*/
//#define FREEZE_FEATURE
#if ENABLED(FREEZE_FEATURE)
//#define FREEZE_PIN 41 // Override the default (KILL) pin here
#endif
/** /**
* MAX7219 Debug Matrix * MAX7219 Debug Matrix
* *
@@ -3939,13 +3664,14 @@
/** /**
* NanoDLP Sync support * NanoDLP Sync support
* *
* Support for Synchronized Z moves when used with NanoDLP. G0/G1 axis moves will * Add support for Synchronized Z moves when using with NanoDLP. G0/G1 axis moves will output "Z_move_comp"
* output a "Z_move_comp" string to enable synchronization with DLP projector exposure. * string to enable synchronization with DLP projector exposure. This change will allow to use
* This feature allows you to use [[WaitForDoneMessage]] instead of M400 commands. * [[WaitForDoneMessage]] instead of populating your gcode with M400 commands
*/ */
//#define NANODLP_Z_SYNC //#define NANODLP_Z_SYNC
#if ENABLED(NANODLP_Z_SYNC) #if ENABLED(NANODLP_Z_SYNC)
//#define NANODLP_ALL_AXIS // Send a "Z_move_comp" report for any axis move (not just Z). //#define NANODLP_ALL_AXIS // Enables "Z_move_comp" output on any axis move.
// Default behavior is limited to Z axis only.
#endif #endif
/** /**
@@ -4109,7 +3835,7 @@
// //
// 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
// //
//#define PINS_DEBUGGING #define PINS_DEBUGGING
// Enable Marlin dev mode which adds some special commands // Enable Marlin dev mode which adds some special commands
//#define MARLIN_DEV_MODE //#define MARLIN_DEV_MODE
@@ -4120,9 +3846,3 @@
* a crash from a remote location. Requires ~400 bytes of SRAM and 5Kb of flash. * a crash from a remote location. Requires ~400 bytes of SRAM and 5Kb of flash.
*/ */
//#define POSTMORTEM_DEBUGGING //#define POSTMORTEM_DEBUGGING
/**
* Software Reset options
*/
//#define SOFT_RESET_VIA_SERIAL // 'KILL' and '^X' commands will soft-reset the controller
//#define SOFT_RESET_ON_KILL // Use a digital button to soft-reset the controller after KILL
+2 -2
View File
@@ -219,7 +219,7 @@ else ifeq ($(HARDWARE_MOTHERBOARD),1111)
else ifeq ($(HARDWARE_MOTHERBOARD),1112) else ifeq ($(HARDWARE_MOTHERBOARD),1112)
# MKS GEN L # MKS GEN L
else ifeq ($(HARDWARE_MOTHERBOARD),1113) else ifeq ($(HARDWARE_MOTHERBOARD),1113)
# zrib V2.0 control board (Chinese RAMPS replica) # zrib V2.0 control board (Chinese knock off RAMPS replica)
else ifeq ($(HARDWARE_MOTHERBOARD),1114) else ifeq ($(HARDWARE_MOTHERBOARD),1114)
# BigTreeTech or BIQU KFB2.0 # BigTreeTech or BIQU KFB2.0
else ifeq ($(HARDWARE_MOTHERBOARD),1115) else ifeq ($(HARDWARE_MOTHERBOARD),1115)
@@ -993,5 +993,5 @@ clean:
.PHONY: all build elf hex eep lss sym program coff extcoff clean depend sizebefore sizeafter .PHONY: all build elf hex eep lss sym program coff extcoff clean depend sizebefore sizeafter
# Automatically include the dependency files created by gcc # Automaticaly include the dependency files created by gcc
-include ${patsubst %.o, %.d, ${OBJ}} -include ${patsubst %.o, %.d, ${OBJ}}
+6 -6
View File
@@ -28,25 +28,25 @@
/** /**
* Marlin release version identifier * Marlin release version identifier
*/ */
#define SHORT_BUILD_VERSION "2.0.8" //#define SHORT_BUILD_VERSION "bugfix-2.0.x"
/** /**
* Verbose version identifier which should contain a reference to the location * Verbose version identifier which should contain a reference to the location
* from where the binary was downloaded or the source code was compiled. * from where the binary was downloaded or the source code was compiled.
*/ */
#define DETAILED_BUILD_VERSION "IA_" SHORT_BUILD_VERSION //#define DETAILED_BUILD_VERSION SHORT_BUILD_VERSION
/** /**
* The STRING_DISTRIBUTION_DATE represents when the binary file was built, * The STRING_DISTRIBUTION_DATE represents when the binary file was built,
* here we define this default string as the date where the latest release * here we define this default string as the date where the latest release
* version was tagged. * version was tagged.
*/ */
#define STRING_DISTRIBUTION_DATE "2021-06-05" //#define STRING_DISTRIBUTION_DATE "2019-07-10"
/** /**
* Defines a generic printer name to be output to the LCD after booting Marlin. * Defines a generic printer name to be output to the LCD after booting Marlin.
*/ */
#define MACHINE_NAME "Insanity Automation S8" //#define MACHINE_NAME "3D Printer"
/** /**
* The SOURCE_CODE_URL is the location where users will find the Marlin Source * The SOURCE_CODE_URL is the location where users will find the Marlin Source
@@ -54,7 +54,7 @@
* has a distinct Github fork— the Source Code URL should just be the main * has a distinct Github fork— the Source Code URL should just be the main
* Marlin repository. * Marlin repository.
*/ */
#define SOURCE_CODE_URL "github.com/InsanityAutomation" //#define SOURCE_CODE_URL "github.com/MarlinFirmware/Marlin"
/** /**
* Default generic printer UUID. * Default generic printer UUID.
@@ -65,7 +65,7 @@
* The WEBSITE_URL is the location where users can get more information such as * The WEBSITE_URL is the location where users can get more information such as
* documentation about a specific Marlin release. * documentation about a specific Marlin release.
*/ */
//#define WEBSITE_URL "insanityautomation.com" //#define WEBSITE_URL "marlinfw.org"
/** /**
* Set the vendor info the serial USB interface, if changable * Set the vendor info the serial USB interface, if changable
+67 -77
View File
@@ -29,85 +29,75 @@
* - http://www.marlinfw.org/tools/u8glib/converter.html * - http://www.marlinfw.org/tools/u8glib/converter.html
* - http://www.digole.com/tools/PicturetoC_Hex_converter.php * - http://www.digole.com/tools/PicturetoC_Hex_converter.php
*/ */
#pragma once #include <avr/pgmspace.h>
#define CUSTOM_BOOTSCREEN_TIMEOUT 2500 #define CUSTOM_BOOTSCREEN_TIMEOUT 2500
#define CUSTOM_BOOTSCREEN_BMPWIDTH 128 #define CUSTOM_BOOTSCREEN_BMPWIDTH 125
#define CUSTOM_BOOTSCREEN_BMPHEIGHT 64 //#define CUSTOM_BOOTSCREEN_INVERTED
/**
* Made with Marlin Bitmap Converter
* https://marlinfw.org/tools/u8glib/converter.html
*
* This bitmap from 128x64 C/C++ data
*/
#define HMIJ3S_BMPWIDTH 128
const unsigned char custom_start_bmp[] PROGMEM = { const unsigned char custom_start_bmp[] PROGMEM = {
B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // ..............................................................##................................................................
B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // ..............................................................##.##.............................................................
B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00001111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x88,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // ................................................................#...#...........................................................
B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE7,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // ................................................................###..###........................................................
B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01111111,B11111100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x71,0x80,0x00,0x00,0x00,0x00,0x00,0x00, // .................................................................###...##.......................................................
B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111,B11111110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x40,0x00,0x00,0x00,0x00,0x00,0x00, // ..................................................................##.....#......................................................
B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111,B11111110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x20,0x00,0x00,0x00,0x00,0x00,0x00, // ..................................................................####....#.....................................................
B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000001,B11111111,B11111111,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x20,0x00,0x00,0x00,0x00,0x00,0x00, // ................................................................########..#.....................................................
B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000001,B11111111,B11111111,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, 0x00,0x00,0x00,0x00,0x00,0x01,0xF8,0x00,0x87,0xF8,0x00,0x00,0x00,0x00,0x00,0x00, // ...............................................######...........#....########...................................................
B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000001,B11111111,B11111111,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, 0x00,0x00,0x00,0x00,0x00,0x03,0x0C,0x00,0x83,0xE0,0x00,0x00,0x00,0x00,0x00,0x00, // ..............................................##....##..........#.....#####.....................................................
B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,B11111111,B11111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, 0x00,0x00,0x00,0x00,0x00,0x06,0x0C,0x00,0x81,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, // .............................................##.....##..........#......###......................................................
B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B11111111,B11111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, 0x00,0x00,0x00,0x00,0x00,0x0C,0x06,0x00,0x80,0xE3,0x00,0x00,0x00,0x00,0x00,0x00, // ............................................##.......##.........#.......###...##................................................
B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B11111111,B11111111,B11111000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, 0x00,0x00,0x00,0x00,0x00,0x18,0x06,0x00,0x80,0x6F,0x80,0x00,0x00,0x00,0x00,0x00, // ...........................................##........##.........#........##.#####...............................................
B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00001111,B11111111,B11111111,B11111000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, 0x00,0x00,0x00,0x00,0x1C,0x38,0x02,0x00,0x80,0x3C,0xC0,0x00,0x00,0x00,0x00,0x00, // ...................................###....###.........#.........#.........####..##..............................................
B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00011111,B11111111,B11111111,B11111100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, 0x00,0x00,0x00,0x00,0x1F,0x30,0x03,0x00,0xC0,0x3C,0x60,0x00,0x00,0x00,0x00,0x00, // ...................................#####..##..........##........##........####...##.............................................
B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111111,B11111110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, 0x00,0x00,0x00,0x00,0x77,0xB0,0x02,0xFF,0x60,0x3C,0x30,0x00,0x00,0x00,0x00,0x00, // .................................###.####.##..........#.########.##.......####....##............................................
B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01111111,B11111111,B01111111,B11111111,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000, 0x00,0x00,0x00,0x00,0xE0,0xF8,0x06,0xFF,0xB0,0x3C,0x18,0x00,0x00,0x00,0x00,0x00, // ................................###.....#####........##.#########.##......####.....##...........................................
B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111,B11111110,B00011111,B11111111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000, 0x00,0x00,0x00,0x00,0xC0,0xD8,0x0D,0x81,0x98,0x1C,0x08,0x00,0x00,0x00,0x00,0x00, // ................................##......##.##.......##.##......##..##......###......#...........................................
B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111,B11111100,B00001111,B11111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000, 0x00,0x00,0x00,0x03,0x80,0xD8,0x09,0x80,0xDC,0xFC,0x08,0x00,0x00,0x00,0x00,0x00, // ..............................###.......##.##.......#..##.......##.###..######......#...........................................
B00000000,B00000000,B00000000,B00000000,B00000000,B00000001,B11111111,B11111000,B00000011,B11111111,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000, 0x00,0x00,0x00,0x02,0x00,0xD8,0x1B,0x00,0x6F,0xE4,0x0C,0x00,0x00,0x00,0x00,0x00, // ..............................#.........##.##......##.##.........##.#######..#......##..........................................
B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,B11111111,B11111000,B00000001,B11111111,B11111000,B00000000,B00000000,B00000000,B00000000,B00000000, 0x00,0x00,0x00,0x02,0x00,0xDF,0xFB,0x00,0x37,0x06,0x0C,0x00,0x00,0x00,0x00,0x00, // ..............................#.........##.##########.##..........##.###.....##.....##..........................................
B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B11111111,B11110000,B00000000,B11111111,B11111100,B00000000,B00000000,B00000000,B00000000,B00000000, 0x00,0x00,0x00,0x06,0x00,0xE7,0xF6,0x00,0x18,0x03,0x04,0x00,0x00,0x00,0x00,0x00, // .............................##.........###..#######.##............##.........##.....#..........................................
B00000000,B00000000,B00000000,B00000000,B00000000,B00001111,B11111111,B11100000,B00000000,B00111111,B11111110,B00000000,B00000000,B00000000,B00000000,B00000000, 0x00,0x00,0x00,0x06,0x00,0xE0,0x0E,0x00,0x18,0x0F,0x04,0x00,0x00,0x00,0x00,0x00, // .............................##.........###.........###............##.......####.....#..........................................
B00000000,B00000000,B00000000,B00000000,B00000000,B00011111,B11111111,B11000000,B00000000,B00001111,B11111111,B00000000,B00000000,B00000000,B00000000,B00000000, 0x00,0x00,0x00,0x06,0x00,0xC0,0x2E,0x00,0x1B,0xFF,0xC6,0x00,0x00,0x00,0x00,0x00, // .............................##.........##........#.###............##.############...##.........................................
B00000000,B00000000,B00000000,B00000000,B00000000,B00011111,B11111111,B10000000,B00000000,B00000111,B11111111,B10000000,B00000000,B00000000,B00000000,B00000000, 0x3F,0xFC,0x1F,0xF6,0x7D,0x81,0xE6,0x00,0x1B,0xC7,0xC6,0x00,0x00,0x00,0x00,0x00, // ..############.....#########.##..#####.##......####..##............##.####...#####...##.........................................
B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B00000000,B00000000,B00000001,B11111111,B11111000,B00000000,B00000000,B00000000,B00000000, 0x7F,0xFE,0x3F,0xFF,0x1F,0x8F,0xC3,0xFF,0xFF,0xFF,0xFC,0x1F,0xFF,0x38,0x03,0xC0, // .##############...##############...######...######....################################.....#############..###.........####......
B00000000,B00000000,B00000000,B00000000,B00000000,B01111111,B11111111,B00000000,B00000000,B00000000,B11111111,B11111110,B00000000,B00000000,B00000000,B00000000, 0xFF,0xFF,0xFF,0xFF,0x8F,0x1F,0xC7,0xFF,0xFF,0xFF,0xF8,0xFF,0xFF,0x3C,0x03,0xE0, // #################################...####...#######...################################...################..####........#####.....
B00000000,B00000000,B00000000,B00000000,B00000000,B11111111,B11111110,B00000000,B00000000,B00000000,B01111111,B11111111,B00000000,B00000000,B00000000,B00000000, 0x10,0x0F,0xF0,0x0F,0x8F,0xFF,0x83,0xFF,0xF7,0xFF,0xF8,0xFF,0xFC,0x3C,0x03,0xE0, // ...#........########........#####...#############.....##############.################...##############....####........#####.....
B00000000,B00000000,B00000000,B00000000,B00000001,B11111111,B11111100,B00000000,B00000000,B00000000,B00011111,B11111111,B10000000,B00000000,B00000000,B00000000, 0x00,0x0F,0xF0,0x07,0xFF,0xFF,0x01,0x9E,0x27,0xFC,0xC2,0xF8,0x00,0x3E,0x03,0xE0, // ............########.........###################.......##..####...#..#########..##....#.#####.............#####.......#####.....
B00000000,B00000000,B00000000,B00000000,B00000001,B11111111,B11111000,B00000000,B00000000,B00000000,B00001111,B11111111,B10000000,B00000000,B00000000,B00000000, 0x0F,0xFF,0xF0,0x03,0xDF,0xFE,0x01,0xCE,0x6C,0xFC,0x47,0xF8,0x00,0x3F,0xFF,0xE0, // ....################..........####.############........###..###..##.##..######...#...########.............#################.....
B00000000,B00000000,B00000000,B00000000,B00000011,B11111111,B11110000,B00000000,B00000000,B00000000,B00000111,B11111111,B10000000,B00000000,B00000000,B00000000, 0x1F,0xFF,0xF0,0x03,0xC3,0xFC,0x00,0xFF,0xCC,0xFF,0xFF,0xF0,0x00,0x3F,0xFF,0xE0, // ...#################..........####....########..........##########..##..####################..............#################.....
B00000000,B00000000,B00000000,B00000000,B00000111,B11111111,B11100000,B00000000,B00000000,B00000000,B00000111,B11111111,B11100000,B00000000,B00000000,B00000000, 0x1F,0xFF,0xF0,0x03,0xC3,0xFC,0x00,0x0E,0x1C,0xFF,0xF9,0xE0,0x00,0x3F,0xFF,0xE0, // ...#################..........####....########..............###....###..#############..####...............#################.....
B00000000,B00000000,B00000000,B00000000,B00001111,B11111111,B11100000,B00000000,B00000000,B00000000,B00000011,B11111111,B11111110,B00000000,B00000000,B00000000, 0x00,0x0F,0xF0,0x0F,0xC7,0xFC,0x00,0x0E,0x1C,0xFF,0xF1,0xE0,0x00,0x3F,0xFF,0xE0, // ............########........######...#########..............###....###..############...####...............#################.....
B00000000,B00000000,B00000000,B00000000,B00011111,B11111111,B11000000,B00000000,B00000000,B00000000,B00000001,B11111111,B11111110,B00000000,B00000000,B00000000, 0x00,0x0F,0xF8,0x0F,0x87,0xFE,0x00,0x0E,0x0C,0xF8,0xF0,0xF0,0x00,0x3C,0x03,0xE0, // ............#########.......#####....##########.............###.....##..#####...####....####..............####........#####.....
B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B10000000,B00000000,B00000000,B00000000,B00000000,B11111110,B01111110,B00000000,B00000000,B00000000, 0x7F,0xFF,0xFF,0xFF,0xBF,0x8F,0x00,0x3F,0xE6,0xF8,0xE0,0xFC,0x00,0x3C,0x03,0xE0, // .################################.#######...####..........#########..##.#####...###.....######............####........#####.....
B00000000,B00000000,B00000000,B00000001,B11111111,B11111111,B00000000,B00000000,B00000000,B00000000,B00000000,B11111000,B00001110,B00000000,B00000000,B00000000, 0x7F,0xFF,0xFF,0xFF,0xFF,0x07,0xC0,0xFF,0xE7,0xFF,0xFC,0xFF,0xFF,0x3C,0x03,0xE0, // .#######################################.....#####......###########..#################..################..####........#####.....
B00000000,B00000000,B00000000,B00001111,B11111111,B11111110,B00000000,B00000000,B00000000,B00000000,B00000000,B11110000,B00001110,B00000000,B00000000,B00000000, 0xFF,0xFF,0xFF,0xFF,0xFE,0x03,0xE0,0x8E,0x33,0xFF,0xFC,0x1F,0xFF,0x3C,0x03,0xE0, // #######################################.......#####.....#...###...##..################.....#############..####........#####.....
B00000000,B00000000,B00000000,B00011111,B11111111,B11111100,B00000000,B00000000,B00000000,B00000000,B00000000,B11100000,B00000110,B00000000,B00000000,B00000000, 0x7F,0xFC,0x3F,0xF0,0x3C,0x01,0xF1,0x9E,0x31,0xFF,0xF9,0x0F,0xFE,0x3C,0x03,0xC0, // .#############....##########......####.........#####...##..####...##...##############..#....###########...####........####......
B00000000,B00000000,B00000000,B00111111,B11111111,B11111100,B00000000,B00000000,B00000000,B00000000,B00000000,B11100000,B00000110,B00000000,B00000000,B00000000, 0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x19,0xFF,0xC1,0x00,0x00,0x00,0x00,0x00, // ......................................................##...........##..###########.....#........................................
B00000000,B00000000,B00000000,B01111111,B11111111,B11111000,B00000000,B00000000,B00000000,B00000000,B00000001,B11100000,B00000110,B00000000,B00000000,B00000000, 0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x0C,0xE0,0xC1,0x00,0x00,0x00,0x00,0x00, // ......................................................##............##..###.....##.....#........................................
B00000000,B00000000,B00000000,B01111111,B11111111,B11110000,B00000000,B00000000,B00000000,B00000000,B00000001,B11111000,B00000110,B00000000,B00000000,B00000000, 0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x0C,0x00,0x42,0x00,0x00,0x00,0x00,0x00, // .....................................................##.............##...........#....#.........................................
B00000000,B00000111,B11111111,B11111111,B11111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000001,B11111111,B00111110,B00000000,B00000000,B00000000, 0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x06,0x01,0x62,0x00,0x00,0x00,0x00,0x00, // .....................................................##..............##........#.##...#.........................................
B00000000,B00011111,B11111111,B11111111,B11111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00011111,B11111001,B11110000,B00000000,B00000000, 0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x06,0x3F,0x62,0x00,0x00,0x00,0x00,0x00, // ....................................................##...............##...######.##...#.........................................
B00000000,B00011111,B11111111,B11111111,B11111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000001,B11111111,B11110000,B00000000,B00000000, 0x00,0x00,0x00,0x00,0x00,0x38,0x0E,0x00,0x0D,0xFD,0xEE,0x00,0x00,0x00,0x00,0x00, // ..........................................###.......###.............##.#######.####.###.........................................
B00000000,B00011111,B11111111,B11111111,B11111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,B11111111,B11000000,B00000000,B00000000, 0x00,0x00,0x00,0x00,0x00,0x7F,0xE6,0x00,0x19,0x81,0xFC,0x00,0x00,0x00,0x00,0x00, // .........................................##########..##............##..##......#######..........................................
B00000000,B00011111,B11111111,B11111111,B11111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,B11111111,B11100010,B00000000,B00000000, 0x00,0x00,0x00,0x00,0x00,0xEF,0xF7,0x00,0x1B,0x01,0xF0,0x00,0x00,0x00,0x00,0x00, // ........................................###.########.###...........##.##.......#####............................................
B00000000,B00011111,B11111111,B11111111,B11111111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111,B11111111,B10000000,B00000000, 0x00,0x00,0x00,0x00,0x00,0xC0,0x33,0x00,0x33,0x01,0xC8,0x00,0x00,0x00,0x00,0x00, // ........................................##........##..##..........##..##.......###..#...........................................
B00000000,B00011111,B11111111,B11111111,B11111111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01000011,B11111111,B11000000,B00000000, 0x00,0x00,0x00,0x00,0x00,0x80,0x1B,0x00,0x36,0x01,0x98,0x00,0x00,0x00,0x00,0x00, // ........................................#..........##.##..........##.##........##..##...........................................
B00000000,B00011111,B11111111,B11111111,B11111111,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B11111111,B10000000,B00000000, 0x00,0x00,0x00,0x00,0x01,0x80,0x0D,0xFF,0xEC,0x01,0xF0,0x00,0x00,0x00,0x00,0x00, // .......................................##...........##.############.##.........#####............................................
B00000000,B00011111,B11111111,B11111111,B11111111,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00001111,B11111100,B00000000,B00000000, 0x00,0x00,0x00,0x00,0x01,0x00,0x0E,0xFF,0xD8,0x01,0xE0,0x00,0x00,0x00,0x00,0x00, // .......................................#............###.##########.##..........####.............................................
B00000000,B00001111,B11111111,B11111111,B11111000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00011111,B11111100,B00000000,B00000000, 0x00,0x00,0x00,0x01,0xF1,0x80,0x06,0x60,0x38,0x07,0xA0,0x00,0x00,0x00,0x00,0x00, // ...............................#####...##............##..##.......###........####.#.............................................
B00011111,B11111111,B11111111,B11111111,B11111111,B11111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000100,B00111100,B00000000,B00000000, 0x00,0x00,0x00,0x01,0xFD,0x80,0x03,0x00,0x18,0x05,0x40,0x00,0x00,0x00,0x00,0x00, // ...............................#######.##.............##...........##........#.#.#..............................................
B00111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111001,B00000000,B00000000, 0x00,0x00,0x00,0x01,0x8F,0xC0,0x06,0xFF,0xDC,0x0A,0x80,0x00,0x00,0x00,0x00,0x00, // ...............................##...######...........##.##########.###......#.#.#...............................................
B00111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11100001,B11000000,B00000000, 0x00,0x00,0x00,0x00,0x81,0xE0,0x0C,0xFF,0xCC,0x1F,0x00,0x00,0x00,0x00,0x00,0x00, // ................................#......####.........##..##########..##.....#####................................................
B00111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000001,B11111111,B11110000,B00000000, 0x00,0x00,0x00,0x00,0x81,0xF0,0x0D,0x80,0x6C,0xFE,0x00,0x00,0x00,0x00,0x00,0x00, // ................................#......#####........##.##........##.##..#######.................................................
B00111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111,B11111100,B00000000, 0x00,0x00,0x00,0x00,0x40,0xFE,0x1B,0x00,0x67,0x8C,0x00,0x00,0x00,0x00,0x00,0x00, // .................................#......#######....##.##.........##..####...##..................................................
B00111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111,B11111111,B00000000, 0x00,0x00,0x00,0x00,0x20,0x7F,0xF6,0x00,0x20,0x18,0x00,0x00,0x00,0x00,0x00,0x00, // ..................................#......###########.##...........#........##...................................................
B00011111,B11111111,B11111111,B11111111,B11111111,B11111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B11111111,B11100111,B11000000, 0x00,0x00,0x00,0x00,0x10,0x30,0x6E,0x00,0x3F,0xF0,0x00,0x00,0x00,0x00,0x00,0x00, // ...................................#......##.....##.###...........##########....................................................
B00001111,B11111111,B11111111,B11111111,B11111111,B11111111,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B11111111,B11000011,B11110000, 0x00,0x00,0x00,0x00,0x04,0x30,0x0E,0x00,0xFF,0xA0,0x00,0x00,0x00,0x00,0x00,0x00, // .....................................#....##........###.........#########.#.....................................................
B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,B11011111,B11100001,B10000000, 0x00,0x00,0x00,0x00,0x03,0x30,0x06,0x00,0xE1,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // ......................................##..##.........##.........###....#........................................................
B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00001111,B11110000,B00000000, 0x00,0x00,0x00,0x00,0x01,0xF0,0x03,0x03,0xE2,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // .......................................#####..........##......#####...#.........................................................
B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B11100000,B00000000, 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xFF,0x88,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // .......................................................##########...#...........................................................
B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,B00000000,B00000000, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // ..............................................................#...##............................................................
B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 // .............................................................###................................................................
}; };
+72
View File
@@ -0,0 +1,72 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* Custom Status Screen bitmap
*
* Place this file in the root with your configuration files
* and enable CUSTOM_STATUS_SCREEN_IMAGE in Configuration.h.
*
* Use the Marlin Bitmap Converter to make your own:
* http://marlinfw.org/tools/u8glib/converter.html
*/
//
// Status Screen Logo bitmap
//
#define STATUS_LOGO_Y 1
#define STATUS_LOGO_WIDTH 32
const unsigned char status_logo_bmp[] PROGMEM = {
0x00,0x00,0x00,0x00, // ................................
0x00,0x00,0x00,0x00, // ................................
0x00,0x00,0x00,0x00, // ................................
0x00,0x00,0x10,0x00, // ...................#............
0x00,0x00,0x06,0x00, // .....................##.........
0x00,0x00,0x00,0x00, // ................................
0x01,0x00,0x00,0x00, // .......#........................
0x08,0x00,0x01,0x00, // ....#..................#........
0x01,0x00,0x41,0x00, // .......#.........#.....#........
0x01,0x00,0x02,0x00, // .......#..............#.........
0x00,0xE0,0x00,0x00, // ........###.....................
0x80,0x08,0x10,0x80, // #...........#......#....#.......
0x04,0x00,0x00,0x40, // .....#...................#......
0x08,0x00,0x08,0x00, // ....#...............#...........
0x10,0x04,0x00,0x00, // ...#.........#..................
0x00,0x00,0x00,0x30, // ..........................##....
0x00,0x00,0x00,0x20, // ..........................#.....
0x00,0x01,0xE8,0x20, // ...............####.#.....#.....
0x00,0x00,0x00,0x60, // .........................##.....
0x00,0x00,0x02,0x00, // ......................#.........
0x00,0x08,0x00,0x00, // ............#...................
0x00,0x00,0x01,0x20, // .......................#..#.....
0x02,0xE8,0x10,0x60, // ......#.###.#......#.....##.....
0x00,0x00,0x00,0x40, // .........................#......
0x00,0x03,0xC0,0x60, // ..............####.......##.....
0x64,0x00,0x10,0x00, // .##..#.............#............
0x04,0x03,0xC0,0x00, // .....#........####..............
0x02,0x00,0x20,0x00, // ......#...........#.............
0x00,0x28,0x00,0x00, // ..........#.#...................
0x00,0x08,0x20,0x00, // ............#.....#.............
0x00,0x00,0x40,0x00, // .................#..............
0x00,0x00,0x00,0x00 // ................................
};
-9
View File
@@ -58,15 +58,6 @@ void HAL_init() {
#endif #endif
} }
void HAL_reboot() {
#if ENABLED(USE_WATCHDOG)
while (1) { /* run out the watchdog */ }
#else
void (*resetFunc)() = 0; // Declare resetFunc() at address 0
resetFunc(); // Jump to address 0
#endif
}
#if ENABLED(SDSUPPORT) #if ENABLED(SDSUPPORT)
#include "../../sd/SdFatUtil.h" #include "../../sd/SdFatUtil.h"
+5 -12
View File
@@ -93,35 +93,28 @@ typedef int8_t pin_t;
#define MYSERIAL1 TERN(BLUETOOTH, btSerial, MSerial0) #define MYSERIAL1 TERN(BLUETOOTH, btSerial, MSerial0)
#else #else
#if !WITHIN(SERIAL_PORT, -1, 3) #if !WITHIN(SERIAL_PORT, -1, 3)
#error "SERIAL_PORT must be from 0 to 3, or -1 for USB Serial." #error "SERIAL_PORT must be from -1 to 3. Please update your configuration."
#endif #endif
#define MYSERIAL1 customizedSerial1 #define MYSERIAL1 customizedSerial1
#ifdef SERIAL_PORT_2 #ifdef SERIAL_PORT_2
#if !WITHIN(SERIAL_PORT_2, -1, 3) #if !WITHIN(SERIAL_PORT_2, -1, 3)
#error "SERIAL_PORT_2 must be from 0 to 3, or -1 for USB Serial." #error "SERIAL_PORT_2 must be from -1 to 3. Please update your configuration."
#endif #endif
#define MYSERIAL2 customizedSerial2 #define MYSERIAL2 customizedSerial2
#endif #endif
#ifdef SERIAL_PORT_3
#if !WITHIN(SERIAL_PORT_3, -1, 3)
#error "SERIAL_PORT_3 must be from 0 to 3, or -1 for USB Serial."
#endif
#define MYSERIAL3 customizedSerial3
#endif
#endif #endif
#ifdef MMU2_SERIAL_PORT #ifdef MMU2_SERIAL_PORT
#if !WITHIN(MMU2_SERIAL_PORT, -1, 3) #if !WITHIN(MMU2_SERIAL_PORT, -1, 3)
#error "MMU2_SERIAL_PORT must be from 0 to 3, or -1 for USB Serial." #error "MMU2_SERIAL_PORT must be from -1 to 3. Please update your configuration."
#endif #endif
#define MMU2_SERIAL mmuSerial #define MMU2_SERIAL mmuSerial
#endif #endif
#ifdef LCD_SERIAL_PORT #ifdef LCD_SERIAL_PORT
#if !WITHIN(LCD_SERIAL_PORT, -1, 3) #if !WITHIN(LCD_SERIAL_PORT, -1, 3)
#error "LCD_SERIAL_PORT must be from 0 to 3, or -1 for USB Serial." #error "LCD_SERIAL_PORT must be from -1 to 3. Please update your configuration."
#endif #endif
#define LCD_SERIAL lcdSerial #define LCD_SERIAL lcdSerial
#if HAS_DGUS_LCD #if HAS_DGUS_LCD
@@ -142,7 +135,7 @@ 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; }
void HAL_reboot(); inline void HAL_reboot() {} // reboot the board or restart the bootloader
#if GCC_VERSION <= 50000 #if GCC_VERSION <= 50000
#pragma GCC diagnostic push #pragma GCC diagnostic push
+4 -4
View File
@@ -88,7 +88,7 @@ void spiBegin() {
} }
/** SPI read data */ /** SPI read data */
void spiRead(uint8_t *buf, uint16_t nbyte) { void spiRead(uint8_t* buf, uint16_t nbyte) {
if (nbyte-- == 0) return; if (nbyte-- == 0) return;
SPDR = 0xFF; SPDR = 0xFF;
for (uint16_t i = 0; i < nbyte; i++) { for (uint16_t i = 0; i < nbyte; i++) {
@@ -107,7 +107,7 @@ void spiBegin() {
} }
/** SPI send block */ /** SPI send block */
void spiSendBlock(uint8_t token, const uint8_t *buf) { void spiSendBlock(uint8_t token, const uint8_t* buf) {
SPDR = token; SPDR = token;
for (uint16_t i = 0; i < 512; i += 2) { for (uint16_t i = 0; i < 512; i += 2) {
while (!TEST(SPSR, SPIF)) { /* Intentionally left empty */ } while (!TEST(SPSR, SPIF)) { /* Intentionally left empty */ }
@@ -215,7 +215,7 @@ void spiBegin() {
} }
// Soft SPI read data // Soft SPI read data
void spiRead(uint8_t *buf, uint16_t nbyte) { void spiRead(uint8_t* buf, uint16_t nbyte) {
for (uint16_t i = 0; i < nbyte; i++) for (uint16_t i = 0; i < nbyte; i++)
buf[i] = spiRec(); buf[i] = spiRec();
} }
@@ -242,7 +242,7 @@ void spiBegin() {
} }
// Soft SPI send block // Soft SPI send block
void spiSendBlock(uint8_t token, const uint8_t *buf) { void spiSendBlock(uint8_t token, const uint8_t* buf) {
spiSend(token); spiSend(token);
for (uint16_t i = 0; i < 512; i++) for (uint16_t i = 0; i < 512; i++)
spiSend(buf[i]); spiSend(buf[i]);
+10 -27
View File
@@ -454,7 +454,7 @@ void MarlinSerial<Cfg>::flush() {
} }
template<typename Cfg> template<typename Cfg>
void MarlinSerial<Cfg>::write(const uint8_t c) { size_t MarlinSerial<Cfg>::write(const uint8_t c) {
if (Cfg::TX_SIZE == 0) { if (Cfg::TX_SIZE == 0) {
_written = true; _written = true;
@@ -480,7 +480,7 @@ void MarlinSerial<Cfg>::write(const uint8_t c) {
// location". This makes sure flush() won't return until the bytes // location". This makes sure flush() won't return until the bytes
// actually got written // actually got written
B_TXC = 1; B_TXC = 1;
return; return 1;
} }
const uint8_t i = (tx_buffer.head + 1) & (Cfg::TX_SIZE - 1); const uint8_t i = (tx_buffer.head + 1) & (Cfg::TX_SIZE - 1);
@@ -510,6 +510,7 @@ void MarlinSerial<Cfg>::write(const uint8_t c) {
// Enable TX ISR - Non atomic, but it will eventually enable TX ISR // Enable TX ISR - Non atomic, but it will eventually enable TX ISR
B_UDRIE = 1; B_UDRIE = 1;
} }
return 1;
} }
template<typename Cfg> template<typename Cfg>
@@ -567,7 +568,7 @@ ISR(SERIAL_REGNAME(USART, SERIAL_PORT, _UDRE_vect)) {
// Because of the template definition above, it's required to instantiate the template to have all methods generated // Because of the template definition above, it's required to instantiate the template to have all methods generated
template class MarlinSerial< MarlinSerialCfg<SERIAL_PORT> >; template class MarlinSerial< MarlinSerialCfg<SERIAL_PORT> >;
MSerialT1 customizedSerial1(MSerialT1::HasEmergencyParser); MSerialT customizedSerial1(MSerialT::HasEmergencyParser);
#ifdef SERIAL_PORT_2 #ifdef SERIAL_PORT_2
@@ -582,24 +583,7 @@ MSerialT1 customizedSerial1(MSerialT1::HasEmergencyParser);
template class MarlinSerial< MarlinSerialCfg<SERIAL_PORT_2> >; template class MarlinSerial< MarlinSerialCfg<SERIAL_PORT_2> >;
MSerialT2 customizedSerial2(MSerialT2::HasEmergencyParser); MSerialT2 customizedSerial2(MSerialT2::HasEmergencyParser);
#endif
#endif // SERIAL_PORT_2
#ifdef SERIAL_PORT_3
// Hookup ISR handlers
ISR(SERIAL_REGNAME(USART, SERIAL_PORT_3, _RX_vect)) {
MarlinSerial<MarlinSerialCfg<SERIAL_PORT_3>>::store_rxd_char();
}
ISR(SERIAL_REGNAME(USART, SERIAL_PORT_3, _UDRE_vect)) {
MarlinSerial<MarlinSerialCfg<SERIAL_PORT_3>>::_tx_udr_empty_irq();
}
template class MarlinSerial< MarlinSerialCfg<SERIAL_PORT_3> >;
MSerialT3 customizedSerial3(MSerialT3::HasEmergencyParser);
#endif // SERIAL_PORT_3
#ifdef MMU2_SERIAL_PORT #ifdef MMU2_SERIAL_PORT
@@ -612,9 +596,8 @@ MSerialT1 customizedSerial1(MSerialT1::HasEmergencyParser);
} }
template class MarlinSerial< MMU2SerialCfg<MMU2_SERIAL_PORT> >; template class MarlinSerial< MMU2SerialCfg<MMU2_SERIAL_PORT> >;
MSerialMMU2 mmuSerial(MSerialMMU2::HasEmergencyParser); MSerialT3 mmuSerial(MSerialT3::HasEmergencyParser);
#endif
#endif // MMU2_SERIAL_PORT
#ifdef LCD_SERIAL_PORT #ifdef LCD_SERIAL_PORT
@@ -627,7 +610,7 @@ MSerialT1 customizedSerial1(MSerialT1::HasEmergencyParser);
} }
template class MarlinSerial< LCDSerialCfg<LCD_SERIAL_PORT> >; template class MarlinSerial< LCDSerialCfg<LCD_SERIAL_PORT> >;
MSerialLCD lcdSerial(MSerialLCD::HasEmergencyParser); MSerialT4 lcdSerial(MSerialT4::HasEmergencyParser);
#if HAS_DGUS_LCD #if HAS_DGUS_LCD
template<typename Cfg> template<typename Cfg>
@@ -640,13 +623,13 @@ MSerialT1 customizedSerial1(MSerialT1::HasEmergencyParser);
} }
#endif #endif
#endif // LCD_SERIAL_PORT #endif
#endif // !USBCON && (UBRRH || UBRR0H || UBRR1H || UBRR2H || UBRR3H) #endif // !USBCON && (UBRRH || UBRR0H || UBRR1H || UBRR2H || UBRR3H)
// For AT90USB targets use the UART for BT interfacing // For AT90USB targets use the UART for BT interfacing
#if defined(USBCON) && ENABLED(BLUETOOTH) #if defined(USBCON) && ENABLED(BLUETOOTH)
MSerialBT bluetoothSerial(false); MSerialT5 bluetoothSerial(false);
#endif #endif
#endif // __AVR__ #endif // __AVR__
+9 -14
View File
@@ -210,7 +210,7 @@
static int read(); static int read();
static void flush(); static void flush();
static ring_buffer_pos_t available(); static ring_buffer_pos_t available();
static void write(const uint8_t c); static size_t write(const uint8_t c);
static void flushTX(); static void flushTX();
#if HAS_DGUS_LCD #if HAS_DGUS_LCD
static ring_buffer_pos_t get_tx_buffer_free(); static ring_buffer_pos_t get_tx_buffer_free();
@@ -238,19 +238,14 @@
static constexpr bool MAX_RX_QUEUED = ENABLED(SERIAL_STATS_MAX_RX_QUEUED); static constexpr bool MAX_RX_QUEUED = ENABLED(SERIAL_STATS_MAX_RX_QUEUED);
}; };
typedef Serial1Class< MarlinSerial< MarlinSerialCfg<SERIAL_PORT> > > MSerialT1; typedef Serial1Class< MarlinSerial< MarlinSerialCfg<SERIAL_PORT> > > MSerialT;
extern MSerialT1 customizedSerial1; extern MSerialT customizedSerial1;
#ifdef SERIAL_PORT_2 #ifdef SERIAL_PORT_2
typedef Serial1Class< MarlinSerial< MarlinSerialCfg<SERIAL_PORT_2> > > MSerialT2; typedef Serial1Class< MarlinSerial< MarlinSerialCfg<SERIAL_PORT_2> > > MSerialT2;
extern MSerialT2 customizedSerial2; extern MSerialT2 customizedSerial2;
#endif #endif
#ifdef SERIAL_PORT_3
typedef Serial1Class< MarlinSerial< MarlinSerialCfg<SERIAL_PORT_3> > > MSerialT3;
extern MSerialT3 customizedSerial3;
#endif
#endif // !USBCON #endif // !USBCON
#ifdef MMU2_SERIAL_PORT #ifdef MMU2_SERIAL_PORT
@@ -267,8 +262,8 @@
static constexpr bool RX_OVERRUNS = false; static constexpr bool RX_OVERRUNS = false;
}; };
typedef Serial1Class< MarlinSerial< MMU2SerialCfg<MMU2_SERIAL_PORT> > > MSerialMMU2; typedef Serial1Class< MarlinSerial< MMU2SerialCfg<MMU2_SERIAL_PORT> > > MSerialT3;
extern MSerialMMU2 mmuSerial; extern MSerialT3 mmuSerial;
#endif #endif
#ifdef LCD_SERIAL_PORT #ifdef LCD_SERIAL_PORT
@@ -286,12 +281,12 @@
static constexpr bool RX_OVERRUNS = BOTH(HAS_DGUS_LCD, SERIAL_STATS_RX_BUFFER_OVERRUNS); static constexpr bool RX_OVERRUNS = BOTH(HAS_DGUS_LCD, SERIAL_STATS_RX_BUFFER_OVERRUNS);
}; };
typedef Serial1Class< MarlinSerial< LCDSerialCfg<LCD_SERIAL_PORT> > > MSerialLCD; typedef Serial1Class< MarlinSerial< LCDSerialCfg<LCD_SERIAL_PORT> > > MSerialT4;
extern MSerialLCD lcdSerial; extern MSerialT4 lcdSerial;
#endif #endif
// Use the UART for Bluetooth in AT90USB configurations // Use the UART for Bluetooth in AT90USB configurations
#if defined(USBCON) && ENABLED(BLUETOOTH) #if defined(USBCON) && ENABLED(BLUETOOTH)
typedef Serial1Class<HardwareSerial> MSerialBT; typedef Serial1Class<HardwareSerial> MSerialT5;
extern MSerialBT bluetoothSerial; extern MSerialT5 bluetoothSerial;
#endif #endif
+3 -3
View File
@@ -40,13 +40,13 @@ bool PersistentStore::access_start() { return true; }
bool PersistentStore::access_finish() { return true; } bool PersistentStore::access_finish() { return true; }
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) { bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
uint16_t written = 0;
while (size--) { while (size--) {
uint8_t * const p = (uint8_t * const)pos; uint8_t * const p = (uint8_t * const)pos;
uint8_t v = *value; uint8_t v = *value;
if (v != eeprom_read_byte(p)) { // EEPROM has only ~100,000 write cycles, so only write bytes that have changed! // EEPROM has only ~100,000 write cycles,
// so only write bytes that have changed!
if (v != eeprom_read_byte(p)) {
eeprom_write_byte(p, v); eeprom_write_byte(p, v);
if (++written & 0x7F) delay(2); else safe_delay(2); // Avoid triggering watchdog during long EEPROM writes
if (eeprom_read_byte(p) != v) { if (eeprom_read_byte(p) != v) {
SERIAL_ECHO_MSG(STR_ERR_EEPROM_WRITE); SERIAL_ECHO_MSG(STR_ERR_EEPROM_WRITE);
return true; return true;
+1 -45
View File
@@ -168,51 +168,6 @@ void setup_endstop_interrupts() {
pciSetup(Z_MIN_PIN); pciSetup(Z_MIN_PIN);
#endif #endif
#endif #endif
#if HAS_I_MAX
#if (digitalPinToInterrupt(I_MAX_PIN) != NOT_AN_INTERRUPT)
_ATTACH(I_MAX_PIN);
#else
static_assert(digitalPinHasPCICR(I_MAX_PIN), "I_MAX_PIN is not interrupt-capable");
pciSetup(I_MAX_PIN);
#endif
#elif HAS_I_MIN
#if (digitalPinToInterrupt(I_MIN_PIN) != NOT_AN_INTERRUPT)
_ATTACH(I_MIN_PIN);
#else
static_assert(digitalPinHasPCICR(I_MIN_PIN), "I_MIN_PIN is not interrupt-capable");
pciSetup(I_MIN_PIN);
#endif
#endif
#if HAS_J_MAX
#if (digitalPinToInterrupt(J_MAX_PIN) != NOT_AN_INTERRUPT)
_ATTACH(J_MAX_PIN);
#else
static_assert(digitalPinHasPCICR(J_MAX_PIN), "J_MAX_PIN is not interrupt-capable");
pciSetup(J_MAX_PIN);
#endif
#elif HAS_J_MIN
#if (digitalPinToInterrupt(J_MIN_PIN) != NOT_AN_INTERRUPT)
_ATTACH(J_MIN_PIN);
#else
static_assert(digitalPinHasPCICR(J_MIN_PIN), "J_MIN_PIN is not interrupt-capable");
pciSetup(J_MIN_PIN);
#endif
#endif
#if HAS_K_MAX
#if (digitalPinToInterrupt(K_MAX_PIN) != NOT_AN_INTERRUPT)
_ATTACH(K_MAX_PIN);
#else
static_assert(digitalPinHasPCICR(K_MAX_PIN), "K_MAX_PIN is not interrupt-capable");
pciSetup(K_MAX_PIN);
#endif
#elif HAS_K_MIN
#if (digitalPinToInterrupt(K_MIN_PIN) != NOT_AN_INTERRUPT)
_ATTACH(K_MIN_PIN);
#else
static_assert(digitalPinHasPCICR(K_MIN_PIN), "K_MIN_PIN is not interrupt-capable");
pciSetup(K_MIN_PIN);
#endif
#endif
#if HAS_X2_MAX #if HAS_X2_MAX
#if (digitalPinToInterrupt(X2_MAX_PIN) != NOT_AN_INTERRUPT) #if (digitalPinToInterrupt(X2_MAX_PIN) != NOT_AN_INTERRUPT)
_ATTACH(X2_MAX_PIN); _ATTACH(X2_MAX_PIN);
@@ -301,5 +256,6 @@ void setup_endstop_interrupts() {
pciSetup(Z_MIN_PROBE_PIN); pciSetup(Z_MIN_PROBE_PIN);
#endif #endif
#endif #endif
// If we arrive here without raising an assertion, each pin has either an EXT-interrupt or a PCI. // If we arrive here without raising an assertion, each pin has either an EXT-interrupt or a PCI.
} }
+1 -1
View File
@@ -241,7 +241,7 @@ uint8_t extDigitalRead(const int8_t pin) {
* *
* DC values -1.0 to 1.0. Negative duty cycle inverts the pulse. * DC values -1.0 to 1.0. Negative duty cycle inverts the pulse.
*/ */
uint16_t set_pwm_frequency_hz(const_float_t hz, const float dca, const float dcb, const float dcc) { uint16_t set_pwm_frequency_hz(const float &hz, const float dca, const float dcb, const float dcc) {
float count = 0; float count = 0;
if (hz > 0 && (dca || dcb || dcc)) { if (hz > 0 && (dca || dcb || dcc)) {
count = float(F_CPU) / hz; // 1x prescaler, TOP for 16MHz base freq. count = float(F_CPU) / hz; // 1x prescaler, TOP for 16MHz base freq.
+1 -1
View File
@@ -38,7 +38,7 @@
// portModeRegister takes a different argument // portModeRegister takes a different argument
#define digitalPinToTimer_DEBUG(p) digitalPinToTimer(p) #define digitalPinToTimer_DEBUG(p) digitalPinToTimer(p)
#define digitalPinToBitMask_DEBUG(p) digitalPinToBitMask(p) #define digitalPinToBitMask_DEBUG(p) digitalPinToBitMask(p)
#define digitalPinToPort_DEBUG(p) digitalPinToPort(p) #define digitalPinToPort_DEBUG(p) digitalPinToPort_Teensy(p)
#define GET_PINMODE(pin) (*portModeRegister(pin) & digitalPinToBitMask_DEBUG(pin)) #define GET_PINMODE(pin) (*portModeRegister(pin) & digitalPinToBitMask_DEBUG(pin))
#elif AVR_ATmega2560_FAMILY_PLUS_70 // So we can access/display all the pins on boards using more than 70 #elif AVR_ATmega2560_FAMILY_PLUS_70 // So we can access/display all the pins on boards using more than 70
+4 -6
View File
@@ -77,8 +77,6 @@ uint8_t HAL_get_reset_source() {
} }
} }
void HAL_reboot() { rstc_start_software_reset(RSTC); }
void _delay_ms(const int delay_ms) { void _delay_ms(const int delay_ms) {
// Todo: port for Due? // Todo: port for Due?
delay(delay_ms); delay(delay_ms);
@@ -108,16 +106,16 @@ uint16_t HAL_adc_get_result() {
} }
// Forward the default serial ports // Forward the default serial ports
#if USING_HW_SERIAL0 #if ANY_SERIAL_IS(0)
DefaultSerial1 MSerial0(false, Serial); DefaultSerial1 MSerial0(false, Serial);
#endif #endif
#if USING_HW_SERIAL1 #if ANY_SERIAL_IS(1)
DefaultSerial2 MSerial1(false, Serial1); DefaultSerial2 MSerial1(false, Serial1);
#endif #endif
#if USING_HW_SERIAL2 #if ANY_SERIAL_IS(2)
DefaultSerial3 MSerial2(false, Serial2); DefaultSerial3 MSerial2(false, Serial2);
#endif #endif
#if USING_HW_SERIAL3 #if ANY_SERIAL_IS(3)
DefaultSerial4 MSerial3(false, Serial3); DefaultSerial4 MSerial3(false, Serial3);
#endif #endif
+9 -16
View File
@@ -50,12 +50,13 @@ extern DefaultSerial4 MSerial3;
#define _MSERIAL(X) MSerial##X #define _MSERIAL(X) MSerial##X
#define MSERIAL(X) _MSERIAL(X) #define MSERIAL(X) _MSERIAL(X)
// Define MYSERIAL1/2 before MarlinSerial includes!
#if SERIAL_PORT == -1 || ENABLED(EMERGENCY_PARSER) #if SERIAL_PORT == -1 || ENABLED(EMERGENCY_PARSER)
#define MYSERIAL1 customizedSerial1 #define MYSERIAL1 customizedSerial1
#elif WITHIN(SERIAL_PORT, 0, 3) #elif WITHIN(SERIAL_PORT, 0, 3)
#define MYSERIAL1 MSERIAL(SERIAL_PORT) #define MYSERIAL1 MSERIAL(SERIAL_PORT)
#else #else
#error "The required SERIAL_PORT must be from 0 to 3, or -1 for USB Serial." #error "The required SERIAL_PORT must be from -1 to 3. Please update your configuration."
#endif #endif
#ifdef SERIAL_PORT_2 #ifdef SERIAL_PORT_2
@@ -64,17 +65,7 @@ extern DefaultSerial4 MSerial3;
#elif WITHIN(SERIAL_PORT_2, 0, 3) #elif WITHIN(SERIAL_PORT_2, 0, 3)
#define MYSERIAL2 MSERIAL(SERIAL_PORT_2) #define MYSERIAL2 MSERIAL(SERIAL_PORT_2)
#else #else
#error "SERIAL_PORT_2 must be from 0 to 3, or -1 for USB Serial." #error "SERIAL_PORT_2 must be from -1 to 3. Please update your configuration."
#endif
#endif
#ifdef SERIAL_PORT_3
#if SERIAL_PORT_3 == -1 || ENABLED(EMERGENCY_PARSER)
#define MYSERIAL3 customizedSerial3
#elif WITHIN(SERIAL_PORT_3, 0, 3)
#define MYSERIAL3 MSERIAL(SERIAL_PORT_3)
#else
#error "SERIAL_PORT_3 must be from 0 to 3, or -1 for USB Serial."
#endif #endif
#endif #endif
@@ -82,15 +73,17 @@ extern DefaultSerial4 MSerial3;
#if WITHIN(MMU2_SERIAL_PORT, 0, 3) #if WITHIN(MMU2_SERIAL_PORT, 0, 3)
#define MMU2_SERIAL MSERIAL(MMU2_SERIAL_PORT) #define MMU2_SERIAL MSERIAL(MMU2_SERIAL_PORT)
#else #else
#error "MMU2_SERIAL_PORT must be from 0 to 3." #error "MMU2_SERIAL_PORT must be from 0 to 3. Please update your configuration."
#endif #endif
#endif #endif
#ifdef LCD_SERIAL_PORT #ifdef LCD_SERIAL_PORT
#if WITHIN(LCD_SERIAL_PORT, 0, 3) #if LCD_SERIAL_PORT == -1
#define LCD_SERIAL lcdSerial
#elif WITHIN(LCD_SERIAL_PORT, 0, 3)
#define LCD_SERIAL MSERIAL(LCD_SERIAL_PORT) #define LCD_SERIAL MSERIAL(LCD_SERIAL_PORT)
#else #else
#error "LCD_SERIAL_PORT must be from 0 to 3." #error "LCD_SERIAL_PORT must be from -1 to 3. Please update your configuration."
#endif #endif
#endif #endif
@@ -120,7 +113,7 @@ 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
void HAL_reboot(); inline void HAL_reboot() {} // reboot the board or restart the bootloader
// //
// ADC // ADC
+15 -15
View File
@@ -56,8 +56,8 @@
#pragma GCC optimize (3) #pragma GCC optimize (3)
typedef uint8_t (*pfnSpiTransfer)(uint8_t b); typedef uint8_t (*pfnSpiTransfer)(uint8_t b);
typedef void (*pfnSpiRxBlock)(uint8_t *buf, uint32_t nbyte); typedef void (*pfnSpiRxBlock)(uint8_t* buf, uint32_t nbyte);
typedef void (*pfnSpiTxBlock)(const uint8_t *buf, uint32_t nbyte); typedef void (*pfnSpiTxBlock)(const uint8_t* buf, uint32_t nbyte);
/* ---------------- Macros to be able to access definitions from asm */ /* ---------------- Macros to be able to access definitions from asm */
#define _PORT(IO) DIO ## IO ## _WPORT #define _PORT(IO) DIO ## IO ## _WPORT
@@ -270,7 +270,7 @@
static pfnSpiTransfer spiTransferTx = (pfnSpiTransfer)spiTransferX; static pfnSpiTransfer spiTransferTx = (pfnSpiTransfer)spiTransferX;
// Block transfers run at ~8 .. ~10Mhz - Tx version (Rx data discarded) // Block transfers run at ~8 .. ~10Mhz - Tx version (Rx data discarded)
static void spiTxBlock0(const uint8_t *ptr, uint32_t todo) { static void spiTxBlock0(const uint8_t* ptr, uint32_t todo) {
uint32_t MOSI_PORT_PLUS30 = ((uint32_t) PORT(SD_MOSI_PIN)) + 0x30; /* SODR of port */ uint32_t MOSI_PORT_PLUS30 = ((uint32_t) PORT(SD_MOSI_PIN)) + 0x30; /* SODR of port */
uint32_t MOSI_MASK = PIN_MASK(SD_MOSI_PIN); uint32_t MOSI_MASK = PIN_MASK(SD_MOSI_PIN);
uint32_t SCK_PORT_PLUS30 = ((uint32_t) PORT(SD_SCK_PIN)) + 0x30; /* SODR of port */ uint32_t SCK_PORT_PLUS30 = ((uint32_t) PORT(SD_SCK_PIN)) + 0x30; /* SODR of port */
@@ -349,7 +349,7 @@
); );
} }
static void spiRxBlock0(uint8_t *ptr, uint32_t todo) { static void spiRxBlock0(uint8_t* ptr, uint32_t todo) {
uint32_t bin = 0; uint32_t bin = 0;
uint32_t work = 0; uint32_t work = 0;
uint32_t BITBAND_MISO_PORT = BITBAND_ADDRESS( ((uint32_t)PORT(SD_MISO_PIN))+0x3C, PIN_SHIFT(SD_MISO_PIN)); /* PDSR of port in bitband area */ uint32_t BITBAND_MISO_PORT = BITBAND_ADDRESS( ((uint32_t)PORT(SD_MISO_PIN))+0x3C, PIN_SHIFT(SD_MISO_PIN)); /* PDSR of port in bitband area */
@@ -425,13 +425,13 @@
); );
} }
static void spiTxBlockX(const uint8_t *buf, uint32_t todo) { static void spiTxBlockX(const uint8_t* buf, uint32_t todo) {
do { do {
(void)spiTransferTx(*buf++); (void)spiTransferTx(*buf++);
} while (--todo); } while (--todo);
} }
static void spiRxBlockX(uint8_t *buf, uint32_t todo) { static void spiRxBlockX(uint8_t* buf, uint32_t todo) {
do { do {
*buf++ = spiTransferRx(0xFF); *buf++ = spiTransferRx(0xFF);
} while (--todo); } while (--todo);
@@ -463,7 +463,7 @@
return b; return b;
} }
void spiRead(uint8_t *buf, uint16_t nbyte) { void spiRead(uint8_t* buf, uint16_t nbyte) {
if (nbyte) { if (nbyte) {
_SS_WRITE(LOW); _SS_WRITE(LOW);
WRITE(SD_MOSI_PIN, HIGH); // Output 1s 1 WRITE(SD_MOSI_PIN, HIGH); // Output 1s 1
@@ -478,7 +478,7 @@
_SS_WRITE(HIGH); _SS_WRITE(HIGH);
} }
void spiSendBlock(uint8_t token, const uint8_t *buf) { void spiSendBlock(uint8_t token, const uint8_t* buf) {
_SS_WRITE(LOW); _SS_WRITE(LOW);
(void)spiTransferTx(token); (void)spiTransferTx(token);
spiTxBlock(buf, 512); spiTxBlock(buf, 512);
@@ -645,7 +645,7 @@
} }
// Read from SPI into buffer // Read from SPI into buffer
void spiRead(uint8_t *buf, uint16_t nbyte) { void spiRead(uint8_t* buf, uint16_t nbyte) {
if (!nbyte) return; if (!nbyte) return;
--nbyte; --nbyte;
for (int i = 0; i < nbyte; i++) { for (int i = 0; i < nbyte; i++) {
@@ -668,7 +668,7 @@
//DELAY_US(1U); //DELAY_US(1U);
} }
void spiSend(const uint8_t *buf, size_t nbyte) { void spiSend(const uint8_t* buf, size_t nbyte) {
if (!nbyte) return; if (!nbyte) return;
--nbyte; --nbyte;
for (size_t i = 0; i < nbyte; i++) { for (size_t i = 0; i < nbyte; i++) {
@@ -689,7 +689,7 @@
FLUSH_RX(); FLUSH_RX();
} }
void spiSend(uint32_t chan, const uint8_t *buf, size_t nbyte) { void spiSend(uint32_t chan, const uint8_t* buf, size_t nbyte) {
if (!nbyte) return; if (!nbyte) return;
--nbyte; --nbyte;
for (size_t i = 0; i < nbyte; i++) { for (size_t i = 0; i < nbyte; i++) {
@@ -702,7 +702,7 @@
} }
// 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) {
SPI0->SPI_TDR = (uint32_t)token | SPI_PCS(SPI_CHAN); SPI0->SPI_TDR = (uint32_t)token | SPI_PCS(SPI_CHAN);
WHILE_TX(0); WHILE_TX(0);
//WHILE_RX(0); //WHILE_RX(0);
@@ -801,19 +801,19 @@
uint8_t spiRec() { return (uint8_t)spiTransfer(0xFF); } uint8_t spiRec() { return (uint8_t)spiTransfer(0xFF); }
void spiRead(uint8_t *buf, uint16_t nbyte) { void spiRead(uint8_t* buf, uint16_t nbyte) {
for (int i = 0; i < nbyte; i++) for (int i = 0; i < nbyte; i++)
buf[i] = spiTransfer(0xFF); buf[i] = spiTransfer(0xFF);
} }
void spiSend(uint8_t data) { spiTransfer(data); } void spiSend(uint8_t data) { spiTransfer(data); }
void spiSend(const uint8_t *buf, size_t nbyte) { void spiSend(const uint8_t* buf, size_t nbyte) {
for (uint16_t i = 0; i < nbyte; i++) for (uint16_t i = 0; i < nbyte; i++)
spiTransfer(buf[i]); spiTransfer(buf[i]);
} }
void spiSendBlock(uint8_t token, const uint8_t *buf) { void spiSendBlock(uint8_t token, const uint8_t* buf) {
spiTransfer(token); spiTransfer(token);
for (uint16_t i = 0; i < 512; i++) for (uint16_t i = 0; i < 512; i++)
spiTransfer(buf[i]); spiTransfer(buf[i]);
+2 -7
View File
@@ -476,9 +476,9 @@ void MarlinSerial<Cfg>::flushTX() {
// If not using the USB port as serial port // If not using the USB port as serial port
#if defined(SERIAL_PORT) && SERIAL_PORT >= 0 #if SERIAL_PORT >= 0
template class MarlinSerial< MarlinSerialCfg<SERIAL_PORT> >; template class MarlinSerial< MarlinSerialCfg<SERIAL_PORT> >;
MSerialT1 customizedSerial1(MarlinSerialCfg<SERIAL_PORT>::EMERGENCYPARSER); MSerialT customizedSerial1(MarlinSerialCfg<SERIAL_PORT>::EMERGENCYPARSER);
#endif #endif
#if defined(SERIAL_PORT_2) && SERIAL_PORT_2 >= 0 #if defined(SERIAL_PORT_2) && SERIAL_PORT_2 >= 0
@@ -486,9 +486,4 @@ void MarlinSerial<Cfg>::flushTX() {
MSerialT2 customizedSerial2(MarlinSerialCfg<SERIAL_PORT_2>::EMERGENCYPARSER); MSerialT2 customizedSerial2(MarlinSerialCfg<SERIAL_PORT_2>::EMERGENCYPARSER);
#endif #endif
#if defined(SERIAL_PORT_3) && SERIAL_PORT_3 >= 0
template class MarlinSerial< MarlinSerialCfg<SERIAL_PORT_3> >;
MSerialT3 customizedSerial3(MarlinSerialCfg<SERIAL_PORT_3>::EMERGENCYPARSER);
#endif
#endif // ARDUINO_ARCH_SAM #endif // ARDUINO_ARCH_SAM
+3 -8
View File
@@ -140,17 +140,12 @@ struct MarlinSerialCfg {
static constexpr bool MAX_RX_QUEUED = ENABLED(SERIAL_STATS_MAX_RX_QUEUED); static constexpr bool MAX_RX_QUEUED = ENABLED(SERIAL_STATS_MAX_RX_QUEUED);
}; };
#if defined(SERIAL_PORT) && SERIAL_PORT >= 0 #if SERIAL_PORT >= 0
typedef Serial1Class< MarlinSerial< MarlinSerialCfg<SERIAL_PORT> > > MSerialT1; typedef Serial1Class< MarlinSerial< MarlinSerialCfg<SERIAL_PORT> > > MSerialT;
extern MSerialT1 customizedSerial1; extern MSerialT customizedSerial1;
#endif #endif
#if defined(SERIAL_PORT_2) && SERIAL_PORT_2 >= 0 #if defined(SERIAL_PORT_2) && SERIAL_PORT_2 >= 0
typedef Serial1Class< MarlinSerial< MarlinSerialCfg<SERIAL_PORT_2> > > MSerialT2; typedef Serial1Class< MarlinSerial< MarlinSerialCfg<SERIAL_PORT_2> > > MSerialT2;
extern MSerialT2 customizedSerial2; extern MSerialT2 customizedSerial2;
#endif #endif
#if defined(SERIAL_PORT_3) && SERIAL_PORT_3 >= 0
typedef Serial1Class< MarlinSerial< MarlinSerialCfg<SERIAL_PORT_3> > > MSerialT3;
extern MSerialT3 customizedSerial3;
#endif
+5 -8
View File
@@ -19,13 +19,13 @@
* 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 ARDUINO_ARCH_SAM
/** /**
* MarlinSerial_Due.cpp - Hardware serial library for Arduino DUE * MarlinSerial_Due.cpp - Hardware serial library for Arduino DUE
* Copyright (c) 2017 Eduardo José Tagle. All right reserved * Copyright (c) 2017 Eduardo José Tagle. All right reserved
* Based on MarlinSerial for AVR, copyright (c) 2006 Nicholas Zambetti. All right reserved. * Based on MarlinSerial for AVR, copyright (c) 2006 Nicholas Zambetti. All right reserved.
*/ */
#ifdef ARDUINO_ARCH_SAM
#include "../../inc/MarlinConfig.h" #include "../../inc/MarlinConfig.h"
@@ -65,7 +65,7 @@ int MarlinSerialUSB::peek() {
pending_char = udi_cdc_getc(); pending_char = udi_cdc_getc();
TERN_(EMERGENCY_PARSER, emergency_parser.update(static_cast<MSerialT1*>(this)->emergency_state, (char)pending_char)); TERN_(EMERGENCY_PARSER, emergency_parser.update(static_cast<MSerialT*>(this)->emergency_state, (char)pending_char));
return pending_char; return pending_char;
} }
@@ -87,7 +87,7 @@ int MarlinSerialUSB::read() {
int c = udi_cdc_getc(); int c = udi_cdc_getc();
TERN_(EMERGENCY_PARSER, emergency_parser.update(static_cast<MSerialT1*>(this)->emergency_state, (char)c)); TERN_(EMERGENCY_PARSER, emergency_parser.update(static_cast<MSerialT*>(this)->emergency_state, (char)c));
return c; return c;
} }
@@ -129,13 +129,10 @@ size_t MarlinSerialUSB::write(const uint8_t c) {
// Preinstantiate // Preinstantiate
#if SERIAL_PORT == -1 #if SERIAL_PORT == -1
MSerialT1 customizedSerial1(TERN0(EMERGENCY_PARSER, true)); MSerialT customizedSerial1(TERN0(EMERGENCY_PARSER, true));
#endif #endif
#if SERIAL_PORT_2 == -1 #if SERIAL_PORT_2 == -1
MSerialT2 customizedSerial2(TERN0(EMERGENCY_PARSER, true)); MSerialT customizedSerial2(TERN0(EMERGENCY_PARSER, true));
#endif
#if SERIAL_PORT_3 == -1
MSerialT3 customizedSerial3(TERN0(EMERGENCY_PARSER, true));
#endif #endif
#endif // HAS_USB_SERIAL #endif // HAS_USB_SERIAL
+7 -9
View File
@@ -27,9 +27,11 @@
*/ */
#include "../../inc/MarlinConfig.h" #include "../../inc/MarlinConfig.h"
#include "../../core/serial_hook.h" #if HAS_USB_SERIAL
#include <WString.h> #include <WString.h>
#include "../../core/serial_hook.h"
struct MarlinSerialUSB { struct MarlinSerialUSB {
void begin(const long); void begin(const long);
@@ -48,18 +50,14 @@ struct MarlinSerialUSB {
FORCE_INLINE int rxMaxEnqueued() { return 0; } FORCE_INLINE int rxMaxEnqueued() { return 0; }
#endif #endif
}; };
typedef Serial1Class<MarlinSerialUSB> MSerialT;
#if SERIAL_PORT == -1 #if SERIAL_PORT == -1
typedef Serial1Class<MarlinSerialUSB> MSerialT1; extern MSerialT customizedSerial1;
extern MSerialT1 customizedSerial1;
#endif #endif
#if SERIAL_PORT_2 == -1 #if SERIAL_PORT_2 == -1
typedef Serial1Class<MarlinSerialUSB> MSerialT2; extern MSerialT customizedSerial2;
extern MSerialT2 customizedSerial2;
#endif #endif
#if SERIAL_PORT_3 == -1 #endif // HAS_USB_SERIAL
typedef Serial1Class<MarlinSerialUSB> MSerialT3;
extern MSerialT3 customizedSerial3;
#endif
+13 -12
View File
@@ -135,11 +135,11 @@ static uint8_t buffer[256] = {0}, // The RAM buffer to accumulate writes
#define DEBUG_OUT ENABLED(EE_EMU_DEBUG) #define DEBUG_OUT ENABLED(EE_EMU_DEBUG)
#include "../../core/debug_out.h" #include "../../core/debug_out.h"
static void ee_Dump(const int page, const void *data) { static void ee_Dump(const int page, const void* data) {
#ifdef EE_EMU_DEBUG #ifdef EE_EMU_DEBUG
const uint8_t *c = (const uint8_t*) data; const uint8_t* c = (const uint8_t*) data;
char buffer[80]; char buffer[80];
sprintf_P(buffer, PSTR("Page: %d (0x%04x)\n"), page, page); sprintf_P(buffer, PSTR("Page: %d (0x%04x)\n"), page, page);
@@ -181,7 +181,7 @@ static void ee_Dump(const int page, const void *data) {
* @param data (pointer to the data buffer) * @param data (pointer to the data buffer)
*/ */
__attribute__ ((long_call, section (".ramfunc"))) __attribute__ ((long_call, section (".ramfunc")))
static bool ee_PageWrite(uint16_t page, const void *data) { static bool ee_PageWrite(uint16_t page, const void* data) {
uint16_t i; uint16_t i;
uint32_t addrflash = uint32_t(getFlashStorage(page)); uint32_t addrflash = uint32_t(getFlashStorage(page));
@@ -293,8 +293,8 @@ static bool ee_PageWrite(uint16_t page, const void *data) {
ee_Dump(-page, data); ee_Dump(-page, data);
// Calculate count of changed bits // Calculate count of changed bits
uint32_t *p1 = (uint32_t*)addrflash; uint32_t* p1 = (uint32_t*)addrflash;
uint32_t *p2 = (uint32_t*)data; uint32_t* p2 = (uint32_t*)data;
int count = 0; int count = 0;
for (i =0; i<PageSize >> 2; i++) { for (i =0; i<PageSize >> 2; i++) {
if (p1[i] != p2[i]) { if (p1[i] != p2[i]) {
@@ -470,7 +470,7 @@ static uint8_t ee_Read(uint32_t address, bool excludeRAMBuffer=false) {
for (int page = curPage - 1; page >= 0; --page) { for (int page = curPage - 1; page >= 0; --page) {
// Get a pointer to the flash page // Get a pointer to the flash page
uint8_t *pflash = (uint8_t*)getFlashStorage(page + curGroup * PagesPerGroup); uint8_t* pflash = (uint8_t*)getFlashStorage(page + curGroup * PagesPerGroup);
uint16_t i = 0; uint16_t i = 0;
while (i <= (PageSize - 4)) { /* (PageSize - 4) because otherwise, there is not enough room for data and headers */ while (i <= (PageSize - 4)) { /* (PageSize - 4) because otherwise, there is not enough room for data and headers */
@@ -550,7 +550,7 @@ static uint32_t ee_GetAddrRange(uint32_t address, bool excludeRAMBuffer=false) {
for (int page = curPage - 1; page >= 0; --page) { for (int page = curPage - 1; page >= 0; --page) {
// Get a pointer to the flash page // Get a pointer to the flash page
uint8_t *pflash = (uint8_t*)getFlashStorage(page + curGroup * PagesPerGroup); uint8_t* pflash = (uint8_t*)getFlashStorage(page + curGroup * PagesPerGroup);
uint16_t i = 0; uint16_t i = 0;
while (i <= (PageSize - 4)) { /* (PageSize - 4) because otherwise, there is not enough room for data and headers */ while (i <= (PageSize - 4)) { /* (PageSize - 4) because otherwise, there is not enough room for data and headers */
@@ -589,7 +589,7 @@ static uint32_t ee_GetAddrRange(uint32_t address, bool excludeRAMBuffer=false) {
} }
static bool ee_IsPageClean(int page) { static bool ee_IsPageClean(int page) {
uint32_t *pflash = (uint32_t*) getFlashStorage(page); uint32_t* pflash = (uint32_t*) getFlashStorage(page);
for (uint16_t i = 0; i < (PageSize >> 2); ++i) for (uint16_t i = 0; i < (PageSize >> 2); ++i)
if (*pflash++ != 0xFFFFFFFF) return false; if (*pflash++ != 0xFFFFFFFF) return false;
return true; return true;
@@ -599,7 +599,7 @@ static bool ee_Flush(uint32_t overrideAddress = 0xFFFFFFFF, uint8_t overrideData
// Check if RAM buffer has something to be written // Check if RAM buffer has something to be written
bool isEmpty = true; bool isEmpty = true;
uint32_t *p = (uint32_t*) &buffer[0]; uint32_t* p = (uint32_t*) &buffer[0];
for (uint16_t j = 0; j < (PageSize >> 2); j++) { for (uint16_t j = 0; j < (PageSize >> 2); j++) {
if (*p++ != 0xFFFFFFFF) { if (*p++ != 0xFFFFFFFF) {
isEmpty = false; isEmpty = false;
@@ -976,13 +976,14 @@ bool PersistentStore::access_start() { ee_Init(); return true; }
bool PersistentStore::access_finish() { ee_Flush(); return true; } bool PersistentStore::access_finish() { ee_Flush(); return true; }
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) { bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
uint16_t written = 0;
while (size--) { while (size--) {
uint8_t * const p = (uint8_t * const)pos; uint8_t * const p = (uint8_t * const)pos;
uint8_t v = *value; uint8_t v = *value;
if (v != ee_Read(uint32_t(p))) { // EEPROM has only ~100,000 write cycles, so only write bytes that have changed! // EEPROM has only ~100,000 write cycles,
// so only write bytes that have changed!
if (v != ee_Read(uint32_t(p))) {
ee_Write(uint32_t(p), v); ee_Write(uint32_t(p), v);
if (++written & 0x7F) delay(2); else safe_delay(2); // Avoid triggering watchdog during long EEPROM writes delay(2);
if (ee_Read(uint32_t(p)) != v) { if (ee_Read(uint32_t(p)) != v) {
SERIAL_ECHO_MSG(STR_ERR_EEPROM_WRITE); SERIAL_ECHO_MSG(STR_ERR_EEPROM_WRITE);
return true; return true;
+4 -3
View File
@@ -42,13 +42,14 @@ bool PersistentStore::access_start() { eeprom_init(); return true; }
bool PersistentStore::access_finish() { return true; } bool PersistentStore::access_finish() { return true; }
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) { bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
uint16_t written = 0;
while (size--) { while (size--) {
uint8_t * const p = (uint8_t * const)pos; uint8_t * const p = (uint8_t * const)pos;
uint8_t v = *value; uint8_t v = *value;
if (v != eeprom_read_byte(p)) { // EEPROM has only ~100,000 write cycles, so only write bytes that have changed! // EEPROM has only ~100,000 write cycles,
// so only write bytes that have changed!
if (v != eeprom_read_byte(p)) {
eeprom_write_byte(p, v); eeprom_write_byte(p, v);
if (++written & 0x7F) delay(2); else safe_delay(2); // Avoid triggering watchdog during long EEPROM writes delay(2);
if (eeprom_read_byte(p) != v) { if (eeprom_read_byte(p) != v) {
SERIAL_ECHO_MSG(STR_ERR_EEPROM_WRITE); SERIAL_ECHO_MSG(STR_ERR_EEPROM_WRITE);
return true; return true;
-6
View File
@@ -64,10 +64,4 @@ void setup_endstop_interrupts() {
TERN_(HAS_Z4_MAX, _ATTACH(Z4_MAX_PIN)); TERN_(HAS_Z4_MAX, _ATTACH(Z4_MAX_PIN));
TERN_(HAS_Z4_MIN, _ATTACH(Z4_MIN_PIN)); TERN_(HAS_Z4_MIN, _ATTACH(Z4_MIN_PIN));
TERN_(HAS_Z_MIN_PROBE_PIN, _ATTACH(Z_MIN_PROBE_PIN)); TERN_(HAS_Z_MIN_PROBE_PIN, _ATTACH(Z_MIN_PROBE_PIN));
TERN_(HAS_I_MAX, _ATTACH(I_MAX_PIN));
TERN_(HAS_I_MIN, _ATTACH(I_MIN_PIN));
TERN_(HAS_J_MAX, _ATTACH(J_MAX_PIN));
TERN_(HAS_J_MIN, _ATTACH(J_MIN_PIN));
TERN_(HAS_K_MAX, _ATTACH(K_MAX_PIN));
TERN_(HAS_K_MIN, _ATTACH(K_MIN_PIN));
} }
+1 -1
View File
@@ -33,7 +33,7 @@
* For ARDUINO_ARCH_SAM * For ARDUINO_ARCH_SAM
* Note the code here was specifically crafted by disassembling what GCC produces * Note the code here was specifically crafted by disassembling what GCC produces
* out of it, so GCC is able to optimize it out as much as possible to the least * out of it, so GCC is able to optimize it out as much as possible to the least
* amount of instructions. Be very careful if you modify them, as "clean code" * amount of instructions. Be very carefull if you modify them, as "clean code"
* leads to less efficient compiled code!! * leads to less efficient compiled code!!
*/ */
+9 -9
View File
@@ -32,7 +32,7 @@ Ctrl_status sd_mmc_spi_test_unit_ready() {
Ctrl_status sd_mmc_spi_read_capacity(uint32_t *nb_sector) { Ctrl_status sd_mmc_spi_read_capacity(uint32_t *nb_sector) {
if (!IS_SD_INSERTED() || IS_SD_PRINTING() || IS_SD_FILE_OPEN() || !card.isMounted()) if (!IS_SD_INSERTED() || IS_SD_PRINTING() || IS_SD_FILE_OPEN() || !card.isMounted())
return CTRL_NO_PRESENT; return CTRL_NO_PRESENT;
*nb_sector = card.diskIODriver()->cardSize() - 1; *nb_sector = card.getSd2Card().cardSize() - 1;
return CTRL_GOOD; return CTRL_GOOD;
} }
@@ -74,24 +74,24 @@ Ctrl_status sd_mmc_spi_usb_read_10(uint32_t addr, uint16_t nb_sector) {
#endif #endif
// Start reading // Start reading
if (!card.diskIODriver()->readStart(addr)) if (!card.getSd2Card().readStart(addr))
return CTRL_FAIL; return CTRL_FAIL;
// For each specified sector // For each specified sector
while (nb_sector--) { while (nb_sector--) {
// Read a sector // Read a sector
card.diskIODriver()->readData(sector_buf); card.getSd2Card().readData(sector_buf);
// RAM -> USB // RAM -> USB
if (!udi_msc_trans_block(true, sector_buf, SD_MMC_BLOCK_SIZE, nullptr)) { if (!udi_msc_trans_block(true, sector_buf, SD_MMC_BLOCK_SIZE, nullptr)) {
card.diskIODriver()->readStop(); card.getSd2Card().readStop();
return CTRL_FAIL; return CTRL_FAIL;
} }
} }
// Stop reading // Stop reading
card.diskIODriver()->readStop(); card.getSd2Card().readStop();
// Done // Done
return CTRL_GOOD; return CTRL_GOOD;
@@ -113,7 +113,7 @@ Ctrl_status sd_mmc_spi_usb_write_10(uint32_t addr, uint16_t nb_sector) {
} }
#endif #endif
if (!card.diskIODriver()->writeStart(addr, nb_sector)) if (!card.getSd2Card().writeStart(addr, nb_sector))
return CTRL_FAIL; return CTRL_FAIL;
// For each specified sector // For each specified sector
@@ -121,16 +121,16 @@ Ctrl_status sd_mmc_spi_usb_write_10(uint32_t addr, uint16_t nb_sector) {
// USB -> RAM // USB -> RAM
if (!udi_msc_trans_block(false, sector_buf, SD_MMC_BLOCK_SIZE, nullptr)) { if (!udi_msc_trans_block(false, sector_buf, SD_MMC_BLOCK_SIZE, nullptr)) {
card.diskIODriver()->writeStop(); card.getSd2Card().writeStop();
return CTRL_FAIL; return CTRL_FAIL;
} }
// Write a sector // Write a sector
card.diskIODriver()->writeData(sector_buf); card.getSd2Card().writeData(sector_buf);
} }
// Stop writing // Stop writing
card.diskIODriver()->writeStop(); card.getSd2Card().writeStop();
// Done // Done
return CTRL_GOOD; return CTRL_GOOD;
+2 -2
View File
@@ -675,11 +675,11 @@ iram_size_t udi_cdc_multi_write_buf(uint8_t port, const void* buf, iram_size_t s
* - \code // Waits and gets a value on CDC line * - \code // Waits and gets a value on CDC line
int udi_cdc_getc(void); int udi_cdc_getc(void);
// Reads a RAM buffer on CDC line // Reads a RAM buffer on CDC line
iram_size_t udi_cdc_read_buf(int *buf, iram_size_t size); iram_size_t udi_cdc_read_buf(int* buf, iram_size_t size);
// Puts a byte on CDC line // Puts a byte on CDC line
int udi_cdc_putc(int value); int udi_cdc_putc(int value);
// Writes a RAM buffer on CDC line // Writes a RAM buffer on CDC line
iram_size_t udi_cdc_write_buf(const int *buf, iram_size_t size); \endcode iram_size_t udi_cdc_write_buf(const int* buf, iram_size_t size); \endcode
* *
* \section udi_cdc_use_cases Advanced use cases * \section udi_cdc_use_cases Advanced use cases
* For more advanced use of the UDI CDC module, see the following use cases: * For more advanced use of the UDI CDC module, see the following use cases:
+2 -2
View File
@@ -264,7 +264,7 @@ bool usb_task_extra_string(void) {
** Handle device requests that the ASF stack doesn't ** Handle device requests that the ASF stack doesn't
*/ */
bool usb_task_other_requests(void) { bool usb_task_other_requests(void) {
uint8_t *ptr = 0; uint8_t* ptr = 0;
uint16_t size = 0; uint16_t size = 0;
if (Udd_setup_type() == USB_REQ_TYPE_VENDOR) { if (Udd_setup_type() == USB_REQ_TYPE_VENDOR) {
@@ -322,7 +322,7 @@ void usb_task_init(void) {
char *sptr; char *sptr;
// Patch in the filament diameter // Patch in the filament diameter
itoa((int)((DEFAULT_NOMINAL_FILAMENT_DIA) * 1000), diam, 10); sprintf_P(diam, PSTR("%d"), (int)((DEFAULT_NOMINAL_FILAMENT_DIA) * 1000.0));
// And copy it to the proper place, expanding it to unicode // And copy it to the proper place, expanding it to unicode
sptr = &diam[0]; sptr = &diam[0];
-2
View File
@@ -141,8 +141,6 @@ void HAL_clear_reset_source() { }
uint8_t HAL_get_reset_source() { return rtc_get_reset_reason(1); } uint8_t HAL_get_reset_source() { return rtc_get_reset_reason(1); }
void HAL_reboot() { ESP.restart(); }
void _delay_ms(int delay_ms) { delay(delay_ms); } void _delay_ms(int delay_ms) { delay(delay_ms); }
// return free memory between end of heap (or end bss) and whatever is current // return free memory between end of heap (or end bss) and whatever is current
+1 -1
View File
@@ -101,7 +101,7 @@ void HAL_clear_reset_source();
// reset reason // reset reason
uint8_t HAL_get_reset_source(); uint8_t HAL_get_reset_source();
void HAL_reboot(); inline void HAL_reboot() {} // reboot the board or restart the bootloader
void _delay_ms(int delay); void _delay_ms(int delay);
+2 -2
View File
@@ -85,7 +85,7 @@ uint8_t spiRec() {
return returnByte; return returnByte;
} }
void spiRead(uint8_t *buf, uint16_t nbyte) { void spiRead(uint8_t* buf, uint16_t nbyte) {
SPI.beginTransaction(spiConfig); SPI.beginTransaction(spiConfig);
SPI.transferBytes(0, buf, nbyte); SPI.transferBytes(0, buf, nbyte);
SPI.endTransaction(); SPI.endTransaction();
@@ -97,7 +97,7 @@ void spiSend(uint8_t b) {
SPI.endTransaction(); SPI.endTransaction();
} }
void spiSendBlock(uint8_t token, const uint8_t *buf) { void spiSendBlock(uint8_t token, const uint8_t* buf) {
SPI.beginTransaction(spiConfig); SPI.beginTransaction(spiConfig);
SPI.transfer(token); SPI.transfer(token);
SPI.writeBytes(const_cast<uint8_t*>(buf), 512); SPI.writeBytes(const_cast<uint8_t*>(buf), 512);
+2 -2
View File
@@ -29,7 +29,7 @@
#include "wifi.h" #include "wifi.h"
#include <ESPAsyncWebServer.h> #include <ESPAsyncWebServer.h>
MSerialWebSocketT webSocketSerial(false); MSerialT webSocketSerial(false);
AsyncWebSocket ws("/ws"); // TODO Move inside the class. AsyncWebSocket ws("/ws"); // TODO Move inside the class.
// RingBuffer impl // RingBuffer impl
@@ -137,7 +137,7 @@ size_t WebSocketSerial::write(const uint8_t c) {
return ret; return ret;
} }
size_t WebSocketSerial::write(const uint8_t *buffer, size_t size) { size_t WebSocketSerial::write(const uint8_t* buffer, size_t size) {
size_t written = 0; size_t written = 0;
for (size_t i = 0; i < size; i++) for (size_t i = 0; i < size; i++)
written += write(buffer[i]); written += write(buffer[i]);
+4 -4
View File
@@ -54,7 +54,7 @@ public:
ring_buffer_pos_t read(uint8_t *buffer); ring_buffer_pos_t read(uint8_t *buffer);
void flush(); void flush();
ring_buffer_pos_t write(const uint8_t c); ring_buffer_pos_t write(const uint8_t c);
ring_buffer_pos_t write(const uint8_t *buffer, ring_buffer_pos_t size); ring_buffer_pos_t write(const uint8_t* buffer, ring_buffer_pos_t size);
}; };
class WebSocketSerial: public Stream { class WebSocketSerial: public Stream {
@@ -70,7 +70,7 @@ public:
int read(); int read();
void flush(); void flush();
size_t write(const uint8_t c); size_t write(const uint8_t c);
size_t write(const uint8_t *buffer, size_t size); size_t write(const uint8_t* buffer, size_t size);
#if ENABLED(SERIAL_STATS_DROPPED_RX) #if ENABLED(SERIAL_STATS_DROPPED_RX)
FORCE_INLINE uint32_t dropped() { return 0; } FORCE_INLINE uint32_t dropped() { return 0; }
@@ -81,5 +81,5 @@ public:
#endif #endif
}; };
typedef Serial1Class<WebSocketSerial> MSerialWebSocketT; typedef Serial1Class<WebSocketSerial> MSerialT;
extern MSerialWebSocketT webSocketSerial; extern MSerialT webSocketSerial;
@@ -59,10 +59,4 @@ void setup_endstop_interrupts() {
TERN_(HAS_Z4_MAX, _ATTACH(Z4_MAX_PIN)); TERN_(HAS_Z4_MAX, _ATTACH(Z4_MAX_PIN));
TERN_(HAS_Z4_MIN, _ATTACH(Z4_MIN_PIN)); TERN_(HAS_Z4_MIN, _ATTACH(Z4_MIN_PIN));
TERN_(HAS_Z_MIN_PROBE_PIN, _ATTACH(Z_MIN_PROBE_PIN)); TERN_(HAS_Z_MIN_PROBE_PIN, _ATTACH(Z_MIN_PROBE_PIN));
TERN_(HAS_I_MAX, _ATTACH(I_MAX_PIN));
TERN_(HAS_I_MIN, _ATTACH(I_MIN_PIN));
TERN_(HAS_J_MAX, _ATTACH(J_MAX_PIN));
TERN_(HAS_J_MIN, _ATTACH(J_MIN_PIN));
TERN_(HAS_K_MAX, _ATTACH(K_MAX_PIN));
TERN_(HAS_K_MIN, _ATTACH(K_MIN_PIN));
} }
+1 -1
View File
@@ -139,7 +139,7 @@ static void IRAM_ATTR i2s_intr_handler_default(void *arg) {
I2S0.int_clr.val = I2S0.int_st.val; //clear pending interrupt I2S0.int_clr.val = I2S0.int_st.val; //clear pending interrupt
} }
void stepperTask(void *parameter) { void stepperTask(void* parameter) {
uint32_t remaining = 0; uint32_t remaining = 0;
while (1) { while (1) {
-2
View File
@@ -73,6 +73,4 @@ void HAL_pwm_init() {
} }
void HAL_reboot() { /* Reset the application state and GPIO */ }
#endif // __PLAT_LINUX__ #endif // __PLAT_LINUX__
+1 -1
View File
@@ -107,7 +107,7 @@ 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; }
void HAL_reboot(); // Reset the application state and GPIO 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) {
+1 -3
View File
@@ -67,7 +67,7 @@ void flashFirmware(const int16_t) {
delay(500); // Give OS time to disconnect delay(500); // Give OS time to disconnect
USB_Connect(false); // USB clear connection USB_Connect(false); // USB clear connection
delay(1000); // Give OS time to notice delay(1000); // Give OS time to notice
HAL_reboot(); NVIC_SystemReset();
} }
void HAL_clear_reset_source(void) { void HAL_clear_reset_source(void) {
@@ -81,6 +81,4 @@ uint8_t HAL_get_reset_source(void) {
return RST_POWER_ON; return RST_POWER_ON;
} }
void HAL_reboot() { NVIC_SystemReset(); }
#endif // TARGET_LPC1768 #endif // TARGET_LPC1768
+5 -18
View File
@@ -71,7 +71,7 @@ extern DefaultSerial1 USBSerial;
#elif WITHIN(SERIAL_PORT, 0, 3) #elif WITHIN(SERIAL_PORT, 0, 3)
#define MYSERIAL1 MSERIAL(SERIAL_PORT) #define MYSERIAL1 MSERIAL(SERIAL_PORT)
#else #else
#error "SERIAL_PORT must be from 0 to 3. You can also use -1 if the board supports Native USB." #error "SERIAL_PORT must be from -1 to 3. Please update your configuration."
#endif #endif
#ifdef SERIAL_PORT_2 #ifdef SERIAL_PORT_2
@@ -80,17 +80,7 @@ extern DefaultSerial1 USBSerial;
#elif WITHIN(SERIAL_PORT_2, 0, 3) #elif WITHIN(SERIAL_PORT_2, 0, 3)
#define MYSERIAL2 MSERIAL(SERIAL_PORT_2) #define MYSERIAL2 MSERIAL(SERIAL_PORT_2)
#else #else
#error "SERIAL_PORT_2 must be from 0 to 3. You can also use -1 if the board supports Native USB." #error "SERIAL_PORT_2 must be from -1 to 3. Please update your configuration."
#endif
#endif
#ifdef SERIAL_PORT_3
#if SERIAL_PORT_3 == -1
#define MYSERIAL3 USBSerial
#elif WITHIN(SERIAL_PORT_3, 0, 3)
#define MYSERIAL3 MSERIAL(SERIAL_PORT_3)
#else
#error "SERIAL_PORT_3 must be from 0 to 3. You can also use -1 if the board supports Native USB."
#endif #endif
#endif #endif
@@ -100,7 +90,7 @@ extern DefaultSerial1 USBSerial;
#elif WITHIN(MMU2_SERIAL_PORT, 0, 3) #elif WITHIN(MMU2_SERIAL_PORT, 0, 3)
#define MMU2_SERIAL MSERIAL(MMU2_SERIAL_PORT) #define MMU2_SERIAL MSERIAL(MMU2_SERIAL_PORT)
#else #else
#error "MMU2_SERIAL_PORT must be from 0 to 3. You can also use -1 if the board supports Native USB." #error "MMU2_SERIAL_PORT must be from -1 to 3. Please update your configuration."
#endif #endif
#endif #endif
@@ -110,10 +100,7 @@ extern DefaultSerial1 USBSerial;
#elif WITHIN(LCD_SERIAL_PORT, 0, 3) #elif WITHIN(LCD_SERIAL_PORT, 0, 3)
#define LCD_SERIAL MSERIAL(LCD_SERIAL_PORT) #define LCD_SERIAL MSERIAL(LCD_SERIAL_PORT)
#else #else
#error "LCD_SERIAL_PORT must be from 0 to 3. You can also use -1 if the board supports Native USB." #error "LCD_SERIAL_PORT must be from -1 to 3. Please update your configuration."
#endif
#if HAS_DGUS_LCD
#define SERIAL_GET_TX_BUFFER_FREE() MSerial0.available()
#endif #endif
#endif #endif
@@ -228,4 +215,4 @@ 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);
void HAL_reboot(); inline void HAL_reboot() {} // reboot the board or restart the bootloader
-1
View File
@@ -21,7 +21,6 @@
*/ */
#ifdef TARGET_LPC1768 #ifdef TARGET_LPC1768
#include "../../inc/MarlinConfig.h"
#include "HAL.h" #include "HAL.h"
#if ENABLED(POSTMORTEM_DEBUGGING) #if ENABLED(POSTMORTEM_DEBUGGING)
+5 -5
View File
@@ -93,12 +93,12 @@
void spiSend(uint8_t b) { (void)spiTransfer(b); } void spiSend(uint8_t b) { (void)spiTransfer(b); }
void spiSend(const uint8_t *buf, size_t nbyte) { void spiSend(const uint8_t* buf, size_t nbyte) {
for (uint16_t i = 0; i < nbyte; i++) for (uint16_t i = 0; i < nbyte; i++)
(void)spiTransfer(buf[i]); (void)spiTransfer(buf[i]);
} }
void spiSendBlock(uint8_t token, const uint8_t *buf) { void spiSendBlock(uint8_t token, const uint8_t* buf) {
(void)spiTransfer(token); (void)spiTransfer(token);
for (uint16_t i = 0; i < 512; i++) for (uint16_t i = 0; i < 512; i++)
(void)spiTransfer(buf[i]); (void)spiTransfer(buf[i]);
@@ -135,13 +135,13 @@
void spiSend(uint8_t b) { doio(b); } void spiSend(uint8_t b) { doio(b); }
void spiSend(const uint8_t *buf, size_t nbyte) { void spiSend(const uint8_t* buf, size_t nbyte) {
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); }
@@ -156,7 +156,7 @@
uint8_t spiTransfer(uint8_t b) { return doio(b); } uint8_t spiTransfer(uint8_t 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) {
(void)spiTransfer(token); (void)spiTransfer(token);
for (uint16_t i = 0; i < 512; i++) for (uint16_t i = 0; i < 512; i++)
(void)spiTransfer(buf[i]); (void)spiTransfer(buf[i]);
+13 -14
View File
@@ -21,26 +21,25 @@
*/ */
#ifdef TARGET_LPC1768 #ifdef TARGET_LPC1768
#include "../../inc/MarlinConfigPre.h"
#include "MarlinSerial.h" #include "MarlinSerial.h"
#include "../../inc/MarlinConfig.h" #if ANY_SERIAL_IS(0)
MarlinSerial _MSerial(LPC_UART0);
#if USING_HW_SERIAL0 MSerialT MSerial0(true, _MSerial);
MarlinSerial _MSerial0(LPC_UART0); extern "C" void UART0_IRQHandler() { _MSerial.IRQHandler(); }
MSerialT MSerial0(true, _MSerial0);
extern "C" void UART0_IRQHandler() { _MSerial0.IRQHandler(); }
#endif #endif
#if USING_HW_SERIAL1 #if ANY_SERIAL_IS(1)
MarlinSerial _MSerial1((LPC_UART_TypeDef *) LPC_UART1); MarlinSerial _MSerial1((LPC_UART_TypeDef *) LPC_UART1);
MSerialT MSerial1(true, _MSerial1); MSerialT MSerial1(true, _MSerial1);
extern "C" void UART1_IRQHandler() { _MSerial1.IRQHandler(); } extern "C" void UART1_IRQHandler() { _MSerial1.IRQHandler(); }
#endif #endif
#if USING_HW_SERIAL2 #if ANY_SERIAL_IS(2)
MarlinSerial _MSerial2(LPC_UART2); MarlinSerial _MSerial2(LPC_UART2);
MSerialT MSerial2(true, _MSerial2); MSerialT MSerial2(true, _MSerial2);
extern "C" void UART2_IRQHandler() { _MSerial2.IRQHandler(); } extern "C" void UART2_IRQHandler() { _MSerial2.IRQHandler(); }
#endif #endif
#if USING_HW_SERIAL3 #if ANY_SERIAL_IS(3)
MarlinSerial _MSerial3(LPC_UART3); MarlinSerial _MSerial3(LPC_UART3);
MSerialT MSerial3(true, _MSerial3); MSerialT MSerial3(true, _MSerial3);
extern "C" void UART3_IRQHandler() { _MSerial3.IRQHandler(); } extern "C" void UART3_IRQHandler() { _MSerial3.IRQHandler(); }
@@ -51,16 +50,16 @@
bool MarlinSerial::recv_callback(const char c) { bool MarlinSerial::recv_callback(const char c) {
// Need to figure out which serial port we are and react in consequence (Marlin does not have CONTAINER_OF macro) // Need to figure out which serial port we are and react in consequence (Marlin does not have CONTAINER_OF macro)
if (false) {} if (false) {}
#if USING_HW_SERIAL0 #if ANY_SERIAL_IS(0)
else if (this == &_MSerial0) emergency_parser.update(MSerial0.emergency_state, c); else if (this == &_MSerial) emergency_parser.update(MSerial0.emergency_state, c);
#endif #endif
#if USING_HW_SERIAL1 #if ANY_SERIAL_IS(1)
else if (this == &_MSerial1) emergency_parser.update(MSerial1.emergency_state, c); else if (this == &_MSerial1) emergency_parser.update(MSerial1.emergency_state, c);
#endif #endif
#if USING_HW_SERIAL2 #if ANY_SERIAL_IS(2)
else if (this == &_MSerial2) emergency_parser.update(MSerial2.emergency_state, c); else if (this == &_MSerial2) emergency_parser.update(MSerial2.emergency_state, c);
#endif #endif
#if USING_HW_SERIAL3 #if ANY_SERIAL_IS(3)
else if (this == &_MSerial3) emergency_parser.update(MSerial3.emergency_state, c); else if (this == &_MSerial3) emergency_parser.update(MSerial3.emergency_state, c);
#endif #endif
return true; return true;
+2 -2
View File
@@ -60,8 +60,8 @@ extern MSerialT MSerial1;
extern MSerialT MSerial2; extern MSerialT MSerial2;
extern MSerialT MSerial3; extern MSerialT MSerial3;
// Consequently, we can't use a RuntimeSerial either. The workaround would be to use // Consequently, we can't use a RuntimeSerial either. The workaround would be to use a RuntimeSerial<ForwardSerial<MarlinSerial>> type here
// a RuntimeSerial<ForwardSerial<MarlinSerial>> type here. Ignore for now until it's actually required. // Right now, let's ignore this until it's actually required.
#if ENABLED(SERIAL_RUNTIME_HOOK) #if ENABLED(SERIAL_RUNTIME_HOOK)
#error "SERIAL_RUNTIME_HOOK is not yet supported for LPC176x." #error "SERIAL_RUNTIME_HOOK is not yet supported for LPC176x."
#endif #endif
+8 -4
View File
@@ -42,22 +42,25 @@ bool PersistentStore::access_start() { eeprom_init(); return true; }
bool PersistentStore::access_finish() { return true; } bool PersistentStore::access_finish() { return true; }
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) { bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
uint16_t written = 0;
while (size--) { while (size--) {
uint8_t v = *value; uint8_t v = *value;
// EEPROM has only ~100,000 write cycles,
// so only write bytes that have changed!
uint8_t * const p = (uint8_t * const)pos; uint8_t * const p = (uint8_t * const)pos;
if (v != eeprom_read_byte(p)) { // EEPROM has only ~100,000 write cycles, so only write bytes that have changed! if (v != eeprom_read_byte(p)) {
eeprom_write_byte(p, v); eeprom_write_byte(p, v);
if (++written & 0x7F) delay(2); else safe_delay(2); // Avoid triggering watchdog during long EEPROM writes
if (eeprom_read_byte(p) != v) { if (eeprom_read_byte(p) != v) {
SERIAL_ECHO_MSG(STR_ERR_EEPROM_WRITE); SERIAL_ECHO_MSG(STR_ERR_EEPROM_WRITE);
return true; return true;
} }
} }
crc16(crc, &v, 1); crc16(crc, &v, 1);
pos++; pos++;
value++; value++;
} };
return false; return false;
} }
@@ -65,6 +68,7 @@ bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t
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);
if (writing) *value = c; if (writing) *value = c;
crc16(crc, &c, 1); crc16(crc, &c, 1);
pos++; pos++;
@@ -122,37 +122,4 @@ void setup_endstop_interrupts() {
#endif #endif
_ATTACH(Z_MIN_PROBE_PIN); _ATTACH(Z_MIN_PROBE_PIN);
#endif #endif
#if HAS_I_MAX
#if !LPC1768_PIN_INTERRUPT_M(I_MAX_PIN)
#error "I_MAX_PIN is not INTERRUPT-capable."
#endif
_ATTACH(I_MAX_PIN);
#elif HAS_I_MIN
#if !LPC1768_PIN_INTERRUPT_M(I_MIN_PIN)
#error "I_MIN_PIN is not INTERRUPT-capable."
#endif
_ATTACH(I_MIN_PIN);
#endif
#if HAS_J_MAX
#if !LPC1768_PIN_INTERRUPT_M(J_MAX_PIN)
#error "J_MAX_PIN is not INTERRUPT-capable."
#endif
_ATTACH(J_MAX_PIN);
#elif HAS_J_MIN
#if !LPC1768_PIN_INTERRUPT_M(J_MIN_PIN)
#error "J_MIN_PIN is not INTERRUPT-capable."
#endif
_ATTACH(J_MIN_PIN);
#endif
#if HAS_K_MAX
#if !LPC1768_PIN_INTERRUPT_M(K_MAX_PIN)
#error "K_MAX_PIN is not INTERRUPT-capable."
#endif
_ATTACH(K_MAX_PIN);
#elif HAS_K_MIN
#if !LPC1768_PIN_INTERRUPT_M(K_MIN_PIN)
#error "K_MIN_PIN is not INTERRUPT-capable."
#endif
_ATTACH(K_MIN_PIN);
#endif
} }
+5 -5
View File
@@ -92,7 +92,7 @@ static_assert(DISABLED(BAUD_RATE_GCODE), "BAUD_RATE_GCODE is not yet supported o
#define ANY_TX(N,V...) DO(IS_TX##N,||,V) #define ANY_TX(N,V...) DO(IS_TX##N,||,V)
#define ANY_RX(N,V...) DO(IS_RX##N,||,V) #define ANY_RX(N,V...) DO(IS_RX##N,||,V)
#if USING_HW_SERIAL0 #if ANY_SERIAL_IS(0)
#define IS_TX0(P) (P == P0_02) #define IS_TX0(P) (P == P0_02)
#define IS_RX0(P) (P == P0_03) #define IS_RX0(P) (P == P0_03)
#if IS_TX0(TMC_SW_MISO) || IS_RX0(TMC_SW_MOSI) #if IS_TX0(TMC_SW_MISO) || IS_RX0(TMC_SW_MOSI)
@@ -106,7 +106,7 @@ static_assert(DISABLED(BAUD_RATE_GCODE), "BAUD_RATE_GCODE is not yet supported o
#undef IS_RX0 #undef IS_RX0
#endif #endif
#if USING_HW_SERIAL1 #if ANY_SERIAL_IS(1)
#define IS_TX1(P) (P == P0_15) #define IS_TX1(P) (P == P0_15)
#define IS_RX1(P) (P == P0_16) #define IS_RX1(P) (P == P0_16)
#define _IS_TX1_1 IS_TX1 #define _IS_TX1_1 IS_TX1
@@ -127,7 +127,7 @@ static_assert(DISABLED(BAUD_RATE_GCODE), "BAUD_RATE_GCODE is not yet supported o
#undef _IS_RX1_1 #undef _IS_RX1_1
#endif #endif
#if USING_HW_SERIAL2 #if ANY_SERIAL_IS(2)
#define IS_TX2(P) (P == P0_10) #define IS_TX2(P) (P == P0_10)
#define IS_RX2(P) (P == P0_11) #define IS_RX2(P) (P == P0_11)
#define _IS_TX2_1 IS_TX2 #define _IS_TX2_1 IS_TX2
@@ -144,7 +144,7 @@ static_assert(DISABLED(BAUD_RATE_GCODE), "BAUD_RATE_GCODE is not yet supported o
#error "Serial port pins (2) conflict with Z4 pins!" #error "Serial port pins (2) conflict with Z4 pins!"
#elif ANY_RX(2, X_DIR_PIN, Y_DIR_PIN) #elif ANY_RX(2, X_DIR_PIN, Y_DIR_PIN)
#error "Serial port pins (2) conflict with other pins!" #error "Serial port pins (2) conflict with other pins!"
#elif Y_HOME_TO_MIN && IS_TX2(Y_STOP_PIN) #elif Y_HOME_DIR < 0 && IS_TX2(Y_STOP_PIN)
#error "Serial port pins (2) conflict with Y endstop pin!" #error "Serial port pins (2) conflict with Y endstop pin!"
#elif HAS_CUSTOM_PROBE_PIN && IS_TX2(Z_MIN_PROBE_PIN) #elif HAS_CUSTOM_PROBE_PIN && IS_TX2(Z_MIN_PROBE_PIN)
#error "Serial port pins (2) conflict with probe pin!" #error "Serial port pins (2) conflict with probe pin!"
@@ -161,7 +161,7 @@ static_assert(DISABLED(BAUD_RATE_GCODE), "BAUD_RATE_GCODE is not yet supported o
#undef _IS_RX2_1 #undef _IS_RX2_1
#endif #endif
#if USING_HW_SERIAL3 #if ANY_SERIAL_IS(3)
#define PIN_IS_TX3(P) (PIN_EXISTS(P) && P##_PIN == P0_00) #define PIN_IS_TX3(P) (PIN_EXISTS(P) && P##_PIN == P0_00)
#define PIN_IS_RX3(P) (P##_PIN == P0_01) #define PIN_IS_RX3(P) (P##_PIN == P0_01)
#if PIN_IS_TX3(X_MIN) || PIN_IS_RX3(X_MAX) #if PIN_IS_TX3(X_MIN) || PIN_IS_RX3(X_MAX)
+1 -1
View File
@@ -117,7 +117,7 @@ void HAL_init() {
PinCfg.Pinmode = 2; // no pull-up/pull-down PinCfg.Pinmode = 2; // no pull-up/pull-down
PINSEL_ConfigPin(&PinCfg); PINSEL_ConfigPin(&PinCfg);
// now set CLKOUT_EN bit // now set CLKOUT_EN bit
SBI(LPC_SC->CLKOUTCFG, 8); LPC_SC->CLKOUTCFG |= (1<<8);
#endif #endif
USB_Init(); // USB Initialization USB_Init(); // USB Initialization
+1 -1
View File
@@ -22,7 +22,7 @@
#include "../../../inc/MarlinConfig.h" #include "../../../inc/MarlinConfig.h"
#if HAS_TFT_XPT2046 || HAS_RES_TOUCH_BUTTONS #if HAS_TFT_XPT2046 || HAS_TOUCH_BUTTONS
#include "xpt2046.h" #include "xpt2046.h"
#include <SPI.h> #include <SPI.h>
@@ -66,7 +66,7 @@
void spiBegin(); void spiBegin();
void spiInit(uint8_t spiRate); void spiInit(uint8_t spiRate);
void spiSend(uint8_t b); void spiSend(uint8_t b);
void spiSend(const uint8_t *buf, size_t n); void spiSend(const uint8_t* buf, size_t n);
static uint8_t rs_last_state = 255; static uint8_t rs_last_state = 255;
+83 -86
View File
@@ -20,104 +20,101 @@ def print_error(e):
'or copy the firmware (.pio/build/%s/firmware.bin) manually to the appropriate disk\n' \ 'or copy the firmware (.pio/build/%s/firmware.bin) manually to the appropriate disk\n' \
%(e, env.get('PIOENV'))) %(e, env.get('PIOENV')))
def before_upload(source, target, env): try:
try: #
# Find a disk for upload
#
upload_disk = 'Disk not found'
target_file_found = False
target_drive_found = False
if current_OS == 'Windows':
# #
# Find a disk for upload # platformio.ini will accept this for a Windows upload port designation: 'upload_port = L:'
# # Windows - doesn't care about the disk's name, only cares about the drive letter
upload_disk = 'Disk not found' import subprocess,string
target_file_found = False from ctypes import windll
target_drive_found = False
if current_OS == 'Windows':
#
# platformio.ini will accept this for a Windows upload port designation: 'upload_port = L:'
# Windows - doesn't care about the disk's name, only cares about the drive letter
import subprocess,string
from ctypes import windll
# getting list of drives # getting list of drives
# https://stackoverflow.com/questions/827371/is-there-a-way-to-list-all-the-available-drive-letters-in-python # https://stackoverflow.com/questions/827371/is-there-a-way-to-list-all-the-available-drive-letters-in-python
drives = [] drives = []
bitmask = windll.kernel32.GetLogicalDrives() bitmask = windll.kernel32.GetLogicalDrives()
for letter in string.ascii_uppercase: for letter in string.ascii_uppercase:
if bitmask & 1: if bitmask & 1:
drives.append(letter) drives.append(letter)
bitmask >>= 1 bitmask >>= 1
for drive in drives: for drive in drives:
final_drive_name = drive + ':\\' final_drive_name = drive + ':\\'
# print ('disc check: {}'.format(final_drive_name)) # print ('disc check: {}'.format(final_drive_name))
try: try:
volume_info = str(subprocess.check_output('cmd /C dir ' + final_drive_name, stderr=subprocess.STDOUT)) volume_info = str(subprocess.check_output('cmd /C dir ' + final_drive_name, stderr=subprocess.STDOUT))
except Exception as e: except Exception as e:
print ('error:{}'.format(e)) print ('error:{}'.format(e))
continue continue
else:
if target_drive in volume_info and not target_file_found: # set upload if not found target file yet
target_drive_found = True
upload_disk = final_drive_name
if target_filename in volume_info:
if not target_file_found:
upload_disk = final_drive_name
target_file_found = True
elif current_OS == 'Linux':
#
# platformio.ini will accept this for a Linux upload port designation: 'upload_port = /media/media_name/drive'
#
drives = os.listdir(os.path.join(os.sep, 'media', getpass.getuser()))
if target_drive in drives: # If target drive is found, use it.
target_drive_found = True
upload_disk = os.path.join(os.sep, 'media', getpass.getuser(), target_drive) + os.sep
else: else:
for drive in drives: if target_drive in volume_info and not target_file_found: # set upload if not found target file yet
try: target_drive_found = True
files = os.listdir(os.path.join(os.sep, 'media', getpass.getuser(), drive)) upload_disk = final_drive_name
except: if target_filename in volume_info:
continue if not target_file_found:
else: upload_disk = final_drive_name
if target_filename in files: target_file_found = True
upload_disk = os.path.join(os.sep, 'media', getpass.getuser(), drive) + os.sep
target_file_found = True
break
#
# set upload_port to drive if found
#
if target_file_found or target_drive_found: elif current_OS == 'Linux':
env.Replace( #
UPLOAD_FLAGS="-P$UPLOAD_PORT" # platformio.ini will accept this for a Linux upload port designation: 'upload_port = /media/media_name/drive'
) #
drives = os.listdir(os.path.join(os.sep, 'media', getpass.getuser()))
elif current_OS == 'Darwin': # MAC if target_drive in drives: # If target drive is found, use it.
# target_drive_found = True
# platformio.ini will accept this for a OSX upload port designation: 'upload_port = /media/media_name/drive' upload_disk = os.path.join(os.sep, 'media', getpass.getuser(), target_drive) + os.sep
# else:
drives = os.listdir('/Volumes') # human readable names
if target_drive in drives and not target_file_found: # set upload if not found target file yet
target_drive_found = True
upload_disk = '/Volumes/' + target_drive + '/'
for drive in drives: for drive in drives:
try: try:
filenames = os.listdir('/Volumes/' + drive + '/') # will get an error if the drive is protected files = os.listdir(os.path.join(os.sep, 'media', getpass.getuser(), drive))
except: except:
continue continue
else: else:
if target_filename in filenames: if target_filename in files:
if not target_file_found: upload_disk = os.path.join(os.sep, 'media', getpass.getuser(), drive) + os.sep
upload_disk = '/Volumes/' + drive + '/'
target_file_found = True target_file_found = True
break
#
# set upload_port to drive if found
#
#
# Set upload_port to drive if found
#
if target_file_found or target_drive_found: if target_file_found or target_drive_found:
env.Replace(UPLOAD_PORT=upload_disk) env.Replace(
print('\nUpload disk: ', upload_disk, '\n') UPLOAD_FLAGS="-P$UPLOAD_PORT"
else: )
print_error('Autodetect Error')
except Exception as e: elif current_OS == 'Darwin': # MAC
print_error(str(e)) #
# platformio.ini will accept this for a OSX upload port designation: 'upload_port = /media/media_name/drive'
#
drives = os.listdir('/Volumes') # human readable names
if target_drive in drives and not target_file_found: # set upload if not found target file yet
target_drive_found = True
upload_disk = '/Volumes/' + target_drive + '/'
for drive in drives:
try:
filenames = os.listdir('/Volumes/' + drive + '/') # will get an error if the drive is protected
except:
continue
else:
if target_filename in filenames:
if not target_file_found:
upload_disk = '/Volumes/' + drive + '/'
target_file_found = True
env.AddPreAction("upload", before_upload) #
# Set upload_port to drive if found
#
if target_file_found or target_drive_found:
env.Replace(UPLOAD_PORT=upload_disk)
print('\nUpload disk: ', upload_disk, '\n')
else:
print_error('Autodetect Error')
except Exception as e:
print_error(str(e))
+5 -7
View File
@@ -25,19 +25,19 @@
#include <wiring_private.h> #include <wiring_private.h>
#ifdef ADAFRUIT_GRAND_CENTRAL_M4 #ifdef ADAFRUIT_GRAND_CENTRAL_M4
#if USING_HW_SERIALUSB #if ANY_SERIAL_IS(-1)
DefaultSerial1 MSerial0(false, Serial); DefaultSerial1 MSerial0(false, Serial);
#endif #endif
#if USING_HW_SERIAL0 #if ANY_SERIAL_IS(0)
DefaultSerial2 MSerial1(false, Serial1); DefaultSerial2 MSerial1(false, Serial1);
#endif #endif
#if USING_HW_SERIAL1 #if ANY_SERIAL_IS(1)
DefaultSerial3 MSerial2(false, Serial2); DefaultSerial3 MSerial2(false, Serial2);
#endif #endif
#if USING_HW_SERIAL2 #if ANY_SERIAL_IS(2)
DefaultSerial4 MSerial3(false, Serial3); DefaultSerial4 MSerial3(false, Serial3);
#endif #endif
#if USING_HW_SERIAL3 #if ANY_SERIAL_IS(3)
DefaultSerial5 MSerial4(false, Serial4); DefaultSerial5 MSerial4(false, Serial4);
#endif #endif
#endif #endif
@@ -436,8 +436,6 @@ uint8_t HAL_get_reset_source() {
} }
#pragma pop_macro("WDT") #pragma pop_macro("WDT")
void HAL_reboot() { NVIC_SystemReset(); }
extern "C" { extern "C" {
void * _sbrk(int incr); void * _sbrk(int incr);
+7 -5
View File
@@ -43,6 +43,8 @@
extern DefaultSerial4 MSerial3; extern DefaultSerial4 MSerial3;
extern DefaultSerial5 MSerial4; extern DefaultSerial5 MSerial4;
// MYSERIAL1 required before MarlinSerial includes!
#define __MSERIAL(X) MSerial##X #define __MSERIAL(X) MSerial##X
#define _MSERIAL(X) __MSERIAL(X) #define _MSERIAL(X) __MSERIAL(X)
#define MSERIAL(X) _MSERIAL(INCREMENT(X)) #define MSERIAL(X) _MSERIAL(INCREMENT(X))
@@ -52,7 +54,7 @@
#elif WITHIN(SERIAL_PORT, 0, 3) #elif WITHIN(SERIAL_PORT, 0, 3)
#define MYSERIAL1 MSERIAL(SERIAL_PORT) #define MYSERIAL1 MSERIAL(SERIAL_PORT)
#else #else
#error "SERIAL_PORT must be from 0 to 3. You can also use -1 if the board supports Native USB." #error "SERIAL_PORT must be from -1 to 3. Please update your configuration."
#endif #endif
#ifdef SERIAL_PORT_2 #ifdef SERIAL_PORT_2
@@ -61,7 +63,7 @@
#elif WITHIN(SERIAL_PORT_2, 0, 3) #elif WITHIN(SERIAL_PORT_2, 0, 3)
#define MYSERIAL2 MSERIAL(SERIAL_PORT_2) #define MYSERIAL2 MSERIAL(SERIAL_PORT_2)
#else #else
#error "SERIAL_PORT_2 must be from 0 to 3. You can also use -1 if the board supports Native USB." #error "SERIAL_PORT_2 must be from -1 to 3. Please update your configuration."
#endif #endif
#endif #endif
@@ -71,7 +73,7 @@
#elif WITHIN(MMU2_SERIAL_PORT, 0, 3) #elif WITHIN(MMU2_SERIAL_PORT, 0, 3)
#define MMU2_SERIAL MSERIAL(MMU2_SERIAL_PORT) #define MMU2_SERIAL MSERIAL(MMU2_SERIAL_PORT)
#else #else
#error "MMU2_SERIAL_PORT must be from 0 to 3. You can also use -1 if the board supports Native USB." #error "MMU2_SERIAL_PORT must be from -1 to 3. Please update your configuration."
#endif #endif
#endif #endif
@@ -81,7 +83,7 @@
#elif WITHIN(LCD_SERIAL_PORT, 0, 3) #elif WITHIN(LCD_SERIAL_PORT, 0, 3)
#define LCD_SERIAL MSERIAL(LCD_SERIAL_PORT) #define LCD_SERIAL MSERIAL(LCD_SERIAL_PORT)
#else #else
#error "LCD_SERIAL_PORT must be from 0 to 3. You can also use -1 if the board supports Native USB." #error "LCD_SERIAL_PORT must be from -1 to 3. Please update your configuration."
#endif #endif
#endif #endif
@@ -107,7 +109,7 @@ 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
void HAL_reboot(); inline void HAL_reboot() {} // reboot the board or restart the bootloader
// //
// ADC // ADC
+2 -2
View File
@@ -103,7 +103,7 @@
* @param nbyte Number of bytes to receive. * @param nbyte Number of bytes to receive.
* @return Nothing * @return Nothing
*/ */
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);
sdSPI.beginTransaction(spiConfig); sdSPI.beginTransaction(spiConfig);
@@ -132,7 +132,7 @@
* *
* @details Uses DMA * @details Uses DMA
*/ */
void spiSendBlock(uint8_t token, const uint8_t *buf) { void spiSendBlock(uint8_t token, const uint8_t* buf) {
sdSPI.beginTransaction(spiConfig); sdSPI.beginTransaction(spiConfig);
sdSPI.transfer(token); sdSPI.transfer(token);
sdSPI.transfer((uint8_t*)buf, nullptr, 512); sdSPI.transfer((uint8_t*)buf, nullptr, 512);
+3 -3
View File
@@ -27,7 +27,7 @@
#include "../../inc/MarlinConfig.h" #include "../../inc/MarlinConfig.h"
#if USING_HW_SERIAL1 #if ANY_SERIAL_IS(1)
UartT Serial2(false, &sercom4, PIN_SERIAL2_RX, PIN_SERIAL2_TX, PAD_SERIAL2_RX, PAD_SERIAL2_TX); UartT Serial2(false, &sercom4, PIN_SERIAL2_RX, PIN_SERIAL2_TX, PAD_SERIAL2_RX, PAD_SERIAL2_TX);
void SERCOM4_0_Handler() { Serial2.IrqHandler(); } void SERCOM4_0_Handler() { Serial2.IrqHandler(); }
void SERCOM4_1_Handler() { Serial2.IrqHandler(); } void SERCOM4_1_Handler() { Serial2.IrqHandler(); }
@@ -35,7 +35,7 @@
void SERCOM4_3_Handler() { Serial2.IrqHandler(); } void SERCOM4_3_Handler() { Serial2.IrqHandler(); }
#endif #endif
#if USING_HW_SERIAL2 #if ANY_SERIAL_IS(2)
UartT Serial3(false, &sercom1, PIN_SERIAL3_RX, PIN_SERIAL3_TX, PAD_SERIAL3_RX, PAD_SERIAL3_TX); UartT Serial3(false, &sercom1, PIN_SERIAL3_RX, PIN_SERIAL3_TX, PAD_SERIAL3_RX, PAD_SERIAL3_TX);
void SERCOM1_0_Handler() { Serial3.IrqHandler(); } void SERCOM1_0_Handler() { Serial3.IrqHandler(); }
void SERCOM1_1_Handler() { Serial3.IrqHandler(); } void SERCOM1_1_Handler() { Serial3.IrqHandler(); }
@@ -43,7 +43,7 @@
void SERCOM1_3_Handler() { Serial3.IrqHandler(); } void SERCOM1_3_Handler() { Serial3.IrqHandler(); }
#endif #endif
#if USING_HW_SERIAL3 #if ANY_SERIAL_IS(3)
UartT Serial4(false, &sercom5, PIN_SERIAL4_RX, PIN_SERIAL4_TX, PAD_SERIAL4_RX, PAD_SERIAL4_TX); UartT Serial4(false, &sercom5, PIN_SERIAL4_RX, PIN_SERIAL4_TX, PAD_SERIAL4_RX, PAD_SERIAL4_TX);
void SERCOM5_0_Handler() { Serial4.IrqHandler(); } void SERCOM5_0_Handler() { Serial4.IrqHandler(); }
void SERCOM5_1_Handler() { Serial4.IrqHandler(); } void SERCOM5_1_Handler() { Serial4.IrqHandler(); }
+2 -3
View File
@@ -41,13 +41,12 @@ bool PersistentStore::access_start() { eeprom_init(); return true; }
bool PersistentStore::access_finish() { return true; } bool PersistentStore::access_finish() { return true; }
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) { bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
uint16_t written = 0;
while (size--) { while (size--) {
const uint8_t v = *value; const uint8_t v = *value;
uint8_t * const p = (uint8_t * const)pos; uint8_t * const p = (uint8_t * const)pos;
if (v != eeprom_read_byte(p)) { // EEPROM has only ~100,000 write cycles, so only write bytes that have changed! if (v != eeprom_read_byte(p)) {
eeprom_write_byte(p, v); eeprom_write_byte(p, v);
if (++written & 0x7F) delay(2); else safe_delay(2); // Avoid triggering watchdog during long EEPROM writes delay(2);
if (eeprom_read_byte(p) != v) { if (eeprom_read_byte(p) != v) {
SERIAL_ECHO_MSG(STR_ERR_EEPROM_WRITE); SERIAL_ECHO_MSG(STR_ERR_EEPROM_WRITE);
return true; return true;
+74 -64
View File
@@ -47,38 +47,80 @@
#include "../../module/endstops.h" #include "../../module/endstops.h"
#define MATCH_EILINE(P1,P2) (P1 != P2 && PIN_TO_EILINE(P1) == PIN_TO_EILINE(P2)) #define MATCH_EILINE(P1,P2) (P1 != P2 && PIN_TO_EILINE(P1) == PIN_TO_EILINE(P2))
#define MATCH_X_MAX_EILINE(P) TERN0(HAS_X_MAX, DEFER4(MATCH_EILINE)(P, X_MAX_PIN)) #if HAS_X_MAX
#define MATCH_X_MIN_EILINE(P) TERN0(HAS_X_MIN, DEFER4(MATCH_EILINE)(P, X_MIN_PIN)) #define MATCH_X_MAX_EILINE(P) MATCH_EILINE(P, X_MAX_PIN)
#define MATCH_Y_MAX_EILINE(P) TERN0(HAS_Y_MAX, DEFER4(MATCH_EILINE)(P, Y_MAX_PIN)) #else
#define MATCH_Y_MIN_EILINE(P) TERN0(HAS_Y_MIN, DEFER4(MATCH_EILINE)(P, Y_MIN_PIN)) #define MATCH_X_MAX_EILINE(P) false
#define MATCH_Z_MAX_EILINE(P) TERN0(HAS_Z_MAX, DEFER4(MATCH_EILINE)(P, Z_MAX_PIN)) #endif
#define MATCH_Z_MIN_EILINE(P) TERN0(HAS_Z_MIN, DEFER4(MATCH_EILINE)(P, Z_MIN_PIN)) #if HAS_X_MIN
#define MATCH_I_MAX_EILINE(P) TERN0(HAS_I_MAX, DEFER4(MATCH_EILINE)(P, I_MAX_PIN)) #define MATCH_X_MIN_EILINE(P) MATCH_EILINE(P, X_MIN_PIN)
#define MATCH_I_MIN_EILINE(P) TERN0(HAS_I_MIN, DEFER4(MATCH_EILINE)(P, I_MIN_PIN)) #else
#define MATCH_J_MAX_EILINE(P) TERN0(HAS_J_MAX, DEFER4(MATCH_EILINE)(P, J_MAX_PIN)) #define MATCH_X_MIN_EILINE(P) false
#define MATCH_J_MIN_EILINE(P) TERN0(HAS_J_MIN, DEFER4(MATCH_EILINE)(P, J_MIN_PIN)) #endif
#define MATCH_K_MAX_EILINE(P) TERN0(HAS_K_MAX, DEFER4(MATCH_EILINE)(P, K_MAX_PIN)) #if HAS_Y_MAX
#define MATCH_K_MIN_EILINE(P) TERN0(HAS_K_MIN, DEFER4(MATCH_EILINE)(P, K_MIN_PIN)) #define MATCH_Y_MAX_EILINE(P) MATCH_EILINE(P, Y_MAX_PIN)
#define MATCH_Z2_MAX_EILINE(P) TERN0(HAS_Z2_MAX, DEFER4(MATCH_EILINE)(P, Z2_MAX_PIN)) #else
#define MATCH_Z2_MIN_EILINE(P) TERN0(HAS_Z2_MIN, DEFER4(MATCH_EILINE)(P, Z2_MIN_PIN)) #define MATCH_Y_MAX_EILINE(P) false
#define MATCH_Z3_MAX_EILINE(P) TERN0(HAS_Z3_MAX, DEFER4(MATCH_EILINE)(P, Z3_MAX_PIN)) #endif
#define MATCH_Z3_MIN_EILINE(P) TERN0(HAS_Z3_MIN, DEFER4(MATCH_EILINE)(P, Z3_MIN_PIN)) #if HAS_Y_MIN
#define MATCH_Z4_MAX_EILINE(P) TERN0(HAS_Z4_MAX, DEFER4(MATCH_EILINE)(P, Z4_MAX_PIN)) #define MATCH_Y_MIN_EILINE(P) MATCH_EILINE(P, Y_MIN_PIN)
#define MATCH_Z4_MIN_EILINE(P) TERN0(HAS_Z4_MIN, DEFER4(MATCH_EILINE)(P, Z4_MIN_PIN)) #else
#define MATCH_Z_MIN_PROBE_EILINE(P) TERN0(HAS_Z_MIN_PROBE_PIN, DEFER4(MATCH_EILINE)(P, Z_MIN_PROBE_PIN)) #define MATCH_Y_MIN_EILINE(P) false
#endif
#define AVAILABLE_EILINE(P) ( PIN_TO_EILINE(P) != -1 \ #if HAS_Z_MAX
&& !MATCH_X_MAX_EILINE(P) && !MATCH_X_MIN_EILINE(P) \ #define MATCH_Z_MAX_EILINE(P) MATCH_EILINE(P, Z_MAX_PIN)
&& !MATCH_Y_MAX_EILINE(P) && !MATCH_Y_MIN_EILINE(P) \ #else
&& !MATCH_Z_MAX_EILINE(P) && !MATCH_Z_MIN_EILINE(P) \ #define MATCH_Z_MAX_EILINE(P) false
&& !MATCH_I_MAX_EILINE(P) && !MATCH_I_MIN_EILINE(P) \ #endif
&& !MATCH_J_MAX_EILINE(P) && !MATCH_J_MIN_EILINE(P) \ #if HAS_Z_MIN
&& !MATCH_K_MAX_EILINE(P) && !MATCH_K_MIN_EILINE(P) \ #define MATCH_Z_MIN_EILINE(P) MATCH_EILINE(P, Z_MIN_PIN)
&& !MATCH_Z2_MAX_EILINE(P) && !MATCH_Z2_MIN_EILINE(P) \ #else
&& !MATCH_Z3_MAX_EILINE(P) && !MATCH_Z3_MIN_EILINE(P) \ #define MATCH_Z_MIN_EILINE(P) false
&& !MATCH_Z4_MAX_EILINE(P) && !MATCH_Z4_MIN_EILINE(P) \ #endif
&& !MATCH_Z_MIN_PROBE_EILINE(P) ) #if HAS_Z2_MAX
#define MATCH_Z2_MAX_EILINE(P) MATCH_EILINE(P, Z2_MAX_PIN)
#else
#define MATCH_Z2_MAX_EILINE(P) false
#endif
#if HAS_Z2_MIN
#define MATCH_Z2_MIN_EILINE(P) MATCH_EILINE(P, Z2_MIN_PIN)
#else
#define MATCH_Z2_MIN_EILINE(P) false
#endif
#if HAS_Z3_MAX
#define MATCH_Z3_MAX_EILINE(P) MATCH_EILINE(P, Z3_MAX_PIN)
#else
#define MATCH_Z3_MAX_EILINE(P) false
#endif
#if HAS_Z3_MIN
#define MATCH_Z3_MIN_EILINE(P) MATCH_EILINE(P, Z3_MIN_PIN)
#else
#define MATCH_Z3_MIN_EILINE(P) false
#endif
#if HAS_Z4_MAX
#define MATCH_Z4_MAX_EILINE(P) MATCH_EILINE(P, Z4_MAX_PIN)
#else
#define MATCH_Z4_MAX_EILINE(P) false
#endif
#if HAS_Z4_MIN
#define MATCH_Z4_MIN_EILINE(P) MATCH_EILINE(P, Z4_MIN_PIN)
#else
#define MATCH_Z4_MIN_EILINE(P) false
#endif
#if HAS_Z_MIN_PROBE_PIN
#define MATCH_Z_MIN_PROBE_EILINE(P) MATCH_EILINE(P, Z_MIN_PROBE_PIN)
#else
#define MATCH_Z_MIN_PROBE_EILINE(P) false
#endif
#define AVAILABLE_EILINE(P) (PIN_TO_EILINE(P) != -1 \
&& !MATCH_X_MAX_EILINE(P) && !MATCH_X_MIN_EILINE(P) \
&& !MATCH_Y_MAX_EILINE(P) && !MATCH_Y_MIN_EILINE(P) \
&& !MATCH_Z_MAX_EILINE(P) && !MATCH_Z_MIN_EILINE(P) \
&& !MATCH_Z2_MAX_EILINE(P) && !MATCH_Z2_MIN_EILINE(P) \
&& !MATCH_Z3_MAX_EILINE(P) && !MATCH_Z3_MIN_EILINE(P) \
&& !MATCH_Z4_MAX_EILINE(P) && !MATCH_Z4_MIN_EILINE(P) \
&& !MATCH_Z_MIN_PROBE_EILINE(P))
// One ISR for all EXT-Interrupts // One ISR for all EXT-Interrupts
void endstop_ISR() { endstops.update(); } void endstop_ISR() { endstops.update(); }
@@ -162,37 +204,5 @@ void setup_endstop_interrupts() {
#error "Z_MIN_PROBE_PIN has no EXTINT line available." #error "Z_MIN_PROBE_PIN has no EXTINT line available."
#endif #endif
_ATTACH(Z_MIN_PROBE_PIN); _ATTACH(Z_MIN_PROBE_PIN);
#elif HAS_I_MAX
#if !AVAILABLE_EILINE(I_MAX_PIN)
#error "I_MAX_PIN has no EXTINT line available."
#endif
attachInterrupt(I_MAX_PIN, endstop_ISR, CHANGE);
#elif HAS_I_MIN
#if !AVAILABLE_EILINE(I_MIN_PIN)
#error "I_MIN_PIN has no EXTINT line available."
#endif
attachInterrupt(I_MIN_PIN, endstop_ISR, CHANGE);
#endif
#if HAS_J_MAX
#if !AVAILABLE_EILINE(J_MAX_PIN)
#error "J_MAX_PIN has no EXTINT line available."
#endif
attachInterrupt(J_MAX_PIN, endstop_ISR, CHANGE);
#elif HAS_J_MIN
#if !AVAILABLE_EILINE(J_MIN_PIN)
#error "J_MIN_PIN has no EXTINT line available."
#endif
attachInterrupt(J_MIN_PIN, endstop_ISR, CHANGE);
#endif
#if HAS_K_MAX
#if !AVAILABLE_EILINE(K_MAX_PIN)
#error "K_MAX_PIN has no EXTINT line available."
#endif
attachInterrupt(K_MAX_PIN, endstop_ISR, CHANGE);
#elif HAS_K_MIN
#if !AVAILABLE_EILINE(K_MIN_PIN)
#error "K_MIN_PIN has no EXTINT line available."
#endif
attachInterrupt(K_MIN_PIN, endstop_ISR, CHANGE);
#endif #endif
} }
+2 -10
View File
@@ -96,12 +96,6 @@ void HAL_init() {
#if HAS_SD_HOST_DRIVE #if HAS_SD_HOST_DRIVE
MSC_SD_init(); // Enable USB SD card access MSC_SD_init(); // Enable USB SD card access
#endif #endif
#if PIN_EXISTS(USB_CONNECT)
OUT_WRITE(USB_CONNECT_PIN, !USB_CONNECT_INVERTING); // USB clear connection
delay(1000); // Give OS time to notice
WRITE(USB_CONNECT_PIN, USB_CONNECT_INVERTING);
#endif
} }
// HAL idle task // HAL idle task
@@ -139,8 +133,6 @@ uint8_t HAL_get_reset_source() {
; ;
} }
void HAL_reboot() { NVIC_SystemReset(); }
void _delay_ms(const int delay_ms) { delay(delay_ms); } void _delay_ms(const int delay_ms) { delay(delay_ms); }
extern "C" { extern "C" {
@@ -155,8 +147,8 @@ extern "C" {
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 // Reset the system (to initiate a firmware flash)
void flashFirmware(const int16_t) { HAL_reboot(); } void flashFirmware(const int16_t) { NVIC_SystemReset(); }
// Maple Compatibility // Maple Compatibility
volatile uint32_t systick_uptime_millis = 0; volatile uint32_t systick_uptime_millis = 0;
+8 -18
View File
@@ -37,9 +37,6 @@
#include <stdint.h> #include <stdint.h>
//
// Serial Ports
//
#ifdef USBCON #ifdef USBCON
#include <USBSerial.h> #include <USBSerial.h>
#include "../../core/serial_hook.h" #include "../../core/serial_hook.h"
@@ -47,6 +44,9 @@
extern DefaultSerial1 MSerial0; extern DefaultSerial1 MSerial0;
#endif #endif
// ------------------------
// Defines
// ------------------------
#define _MSERIAL(X) MSerial##X #define _MSERIAL(X) MSerial##X
#define MSERIAL(X) _MSERIAL(X) #define MSERIAL(X) _MSERIAL(X)
@@ -55,7 +55,7 @@
#elif WITHIN(SERIAL_PORT, 1, 6) #elif WITHIN(SERIAL_PORT, 1, 6)
#define MYSERIAL1 MSERIAL(SERIAL_PORT) #define MYSERIAL1 MSERIAL(SERIAL_PORT)
#else #else
#error "SERIAL_PORT must be from 1 to 6. You can also use -1 if the board supports Native USB." #error "SERIAL_PORT must be -1 or from 1 to 6. Please update your configuration."
#endif #endif
#ifdef SERIAL_PORT_2 #ifdef SERIAL_PORT_2
@@ -64,17 +64,7 @@
#elif WITHIN(SERIAL_PORT_2, 1, 6) #elif WITHIN(SERIAL_PORT_2, 1, 6)
#define MYSERIAL2 MSERIAL(SERIAL_PORT_2) #define MYSERIAL2 MSERIAL(SERIAL_PORT_2)
#else #else
#error "SERIAL_PORT_2 must be from 1 to 6. You can also use -1 if the board supports Native USB." #error "SERIAL_PORT_2 must be -1 or from 1 to 6. Please update your configuration."
#endif
#endif
#ifdef SERIAL_PORT_3
#if SERIAL_PORT_3 == -1
#define MYSERIAL3 MSerial0
#elif WITHIN(SERIAL_PORT_3, 1, 6)
#define MYSERIAL3 MSERIAL(SERIAL_PORT_3)
#else
#error "SERIAL_PORT_3 must be from 1 to 6. You can also use -1 if the board supports Native USB."
#endif #endif
#endif #endif
@@ -84,7 +74,7 @@
#elif WITHIN(MMU2_SERIAL_PORT, 1, 6) #elif WITHIN(MMU2_SERIAL_PORT, 1, 6)
#define MMU2_SERIAL MSERIAL(MMU2_SERIAL_PORT) #define MMU2_SERIAL MSERIAL(MMU2_SERIAL_PORT)
#else #else
#error "MMU2_SERIAL_PORT must be from 1 to 6. You can also use -1 if the board supports Native USB." #error "MMU2_SERIAL_PORT must be -1 or from 1 to 6. Please update your configuration."
#endif #endif
#endif #endif
@@ -94,7 +84,7 @@
#elif WITHIN(LCD_SERIAL_PORT, 1, 6) #elif WITHIN(LCD_SERIAL_PORT, 1, 6)
#define LCD_SERIAL MSERIAL(LCD_SERIAL_PORT) #define LCD_SERIAL MSERIAL(LCD_SERIAL_PORT)
#else #else
#error "LCD_SERIAL_PORT must be from 1 to 6. You can also use -1 if the board supports Native USB." #error "LCD_SERIAL_PORT must be -1 or from 1 to 6. Please update your configuration."
#endif #endif
#if HAS_DGUS_LCD #if HAS_DGUS_LCD
#define SERIAL_GET_TX_BUFFER_FREE() LCD_SERIAL.availableForWrite() #define SERIAL_GET_TX_BUFFER_FREE() LCD_SERIAL.availableForWrite()
@@ -154,7 +144,7 @@ void HAL_clear_reset_source();
// Reset reason // Reset reason
uint8_t HAL_get_reset_source(); uint8_t HAL_get_reset_source();
void HAL_reboot(); inline void HAL_reboot() {} // reboot the board or restart the bootloader
void _delay_ms(const int delay); void _delay_ms(const int delay);
+2 -2
View File
@@ -71,8 +71,8 @@ static void TXBegin() {
volatile uint32_t ICER[32]; volatile uint32_t ICER[32];
}; };
NVICMin *nvicBase = (NVICMin*)0xE000E100; NVICMin * nvicBase = (NVICMin*)0xE000E100;
SBI32(nvicBase->ICER[nvicIndex >> 5], nvicIndex & 0x1F); nvicBase->ICER[nvicIndex / 32] |= _BV32(nvicIndex % 32);
// We NEED memory barriers to ensure Interrupts are actually disabled! // We NEED memory barriers to ensure Interrupts are actually disabled!
// ( https://dzone.com/articles/nvic-disabling-interrupts-on-arm-cortex-m-and-the ) // ( https://dzone.com/articles/nvic-disabling-interrupts-on-arm-cortex-m-and-the )
+2 -2
View File
@@ -193,7 +193,7 @@ static SPISettings spiConfig;
* *
* @details Uses DMA * @details Uses DMA
*/ */
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.transfer(buf, nbyte); SPI.transfer(buf, nbyte);
@@ -218,7 +218,7 @@ static SPISettings spiConfig;
* *
* @details Use DMA * @details Use DMA
*/ */
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.transfer(token); SPI.transfer(token);
SPI.transfer((uint8_t*)buf, &rxBuf, 512); SPI.transfer((uint8_t*)buf, &rxBuf, 512);
+1 -1
View File
@@ -19,7 +19,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/>.
* *
*/ */
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(STM32H7xx) #if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC)
#include "MarlinSPI.h" #include "MarlinSPI.h"
+14 -29
View File
@@ -28,6 +28,7 @@
#ifndef USART4 #ifndef USART4
#define USART4 UART4 #define USART4 UART4
#endif #endif
#ifndef USART5 #ifndef USART5
#define USART5 UART5 #define USART5 UART5
#endif #endif
@@ -37,38 +38,22 @@
MSerialT MSerial ## ser_num (true, USART ## ser_num, &_rx_complete_irq_ ## ser_num); \ MSerialT MSerial ## ser_num (true, USART ## ser_num, &_rx_complete_irq_ ## ser_num); \
void _rx_complete_irq_ ## ser_num (serial_t * obj) { MSerial ## ser_num ._rx_complete_irq(obj); } void _rx_complete_irq_ ## ser_num (serial_t * obj) { MSerial ## ser_num ._rx_complete_irq(obj); }
#if USING_HW_SERIAL1 #define DECLARE_SERIAL_PORT_EXP(ser_num) DECLARE_SERIAL_PORT(ser_num)
DECLARE_SERIAL_PORT(1)
#if defined(SERIAL_PORT) && SERIAL_PORT >= 0
DECLARE_SERIAL_PORT_EXP(SERIAL_PORT)
#endif #endif
#if USING_HW_SERIAL2
DECLARE_SERIAL_PORT(2) #if defined(SERIAL_PORT_2) && SERIAL_PORT_2 >= 0
DECLARE_SERIAL_PORT_EXP(SERIAL_PORT_2)
#endif #endif
#if USING_HW_SERIAL3
DECLARE_SERIAL_PORT(3) #if defined(MMU2_SERIAL_PORT) && MMU2_SERIAL_PORT >= 0
DECLARE_SERIAL_PORT_EXP(MMU2_SERIAL_PORT)
#endif #endif
#if USING_HW_SERIAL4
DECLARE_SERIAL_PORT(4) #if defined(LCD_SERIAL_PORT) && LCD_SERIAL_PORT >= 0
#endif DECLARE_SERIAL_PORT_EXP(LCD_SERIAL_PORT)
#if USING_HW_SERIAL5
DECLARE_SERIAL_PORT(5)
#endif
#if USING_HW_SERIAL6
DECLARE_SERIAL_PORT(6)
#endif
#if USING_HW_SERIAL7
DECLARE_SERIAL_PORT(7)
#endif
#if USING_HW_SERIAL8
DECLARE_SERIAL_PORT(8)
#endif
#if USING_HW_SERIAL9
DECLARE_SERIAL_PORT(9)
#endif
#if USING_HW_SERIAL10
DECLARE_SERIAL_PORT(10)
#endif
#if USING_HW_SERIALLP1
DECLARE_SERIAL_PORT(LP1)
#endif #endif
void MarlinSerial::begin(unsigned long baud, uint8_t config) { void MarlinSerial::begin(unsigned long baud, uint8_t config) {
+2 -2
View File
@@ -29,14 +29,14 @@
typedef void (*usart_rx_callback_t)(serial_t * obj); typedef void (*usart_rx_callback_t)(serial_t * obj);
struct MarlinSerial : public HardwareSerial { struct MarlinSerial : public HardwareSerial {
MarlinSerial(void *peripheral, usart_rx_callback_t rx_callback) : MarlinSerial(void* peripheral, usart_rx_callback_t rx_callback) :
HardwareSerial(peripheral), _rx_callback(rx_callback) HardwareSerial(peripheral), _rx_callback(rx_callback)
{ } { }
void begin(unsigned long baud, uint8_t config); void begin(unsigned long baud, uint8_t config);
inline void begin(unsigned long baud) { begin(baud, SERIAL_8N1); } inline void begin(unsigned long baud) { begin(baud, SERIAL_8N1); }
void _rx_complete_irq(serial_t *obj); void _rx_complete_irq(serial_t* obj);
protected: protected:
usart_rx_callback_t _rx_callback; usart_rx_callback_t _rx_callback;
+99 -117
View File
@@ -36,10 +36,9 @@
// use USB drivers // use USB drivers
extern "C" { extern "C" { int8_t SD_MSC_Read(uint8_t lun, uint8_t *buf, uint32_t blk_addr, uint16_t blk_len);
int8_t SD_MSC_Read(uint8_t lun, uint8_t *buf, uint32_t blk_addr, uint16_t blk_len); int8_t SD_MSC_Write(uint8_t lun, uint8_t *buf, uint32_t blk_addr, uint16_t blk_len);
int8_t SD_MSC_Write(uint8_t lun, uint8_t *buf, uint32_t blk_addr, uint16_t blk_len); extern SD_HandleTypeDef hsd;
extern SD_HandleTypeDef hsd;
} }
bool SDIO_Init() { bool SDIO_Init() {
@@ -76,18 +75,7 @@
#error "ERROR - Only STM32F103xE, STM32F103xG, STM32F4xx or STM32F7xx CPUs supported" #error "ERROR - Only STM32F103xE, STM32F103xG, STM32F4xx or STM32F7xx CPUs supported"
#endif #endif
// Fixed
#define SDIO_D0_PIN PC8
#define SDIO_D1_PIN PC9
#define SDIO_D2_PIN PC10
#define SDIO_D3_PIN PC11
#define SDIO_CK_PIN PC12
#define SDIO_CMD_PIN PD2
SD_HandleTypeDef hsd; // create SDIO structure SD_HandleTypeDef hsd; // create SDIO structure
// F4 supports one DMA for RX and another for TX, but Marlin will never
// do read and write at same time, so we use the same DMA for both.
DMA_HandleTypeDef hdma_sdio;
/* /*
SDIO_INIT_CLK_DIV is 118 SDIO_INIT_CLK_DIV is 118
@@ -108,12 +96,12 @@
// Target Clock, configurable. Default is 18MHz, from STM32F1 // Target Clock, configurable. Default is 18MHz, from STM32F1
#ifndef SDIO_CLOCK #ifndef SDIO_CLOCK
#define SDIO_CLOCK 18000000 // 18 MHz #define SDIO_CLOCK 18000000 /* 18 MHz */
#endif #endif
// SDIO retries, configurable. Default is 3, from STM32F1 // SDIO retries, configurable. Default is 3, from STM32F1
#ifndef SDIO_READ_RETRIES #ifndef SDIO_READ_RETRIES
#define SDIO_READ_RETRIES 3 #define SDIO_READ_RETRIES 3
#endif #endif
// SDIO Max Clock (naming from STM Manual, don't change) // SDIO Max Clock (naming from STM Manual, don't change)
@@ -132,21 +120,24 @@
} }
void go_to_transfer_speed() { void go_to_transfer_speed() {
SD_InitTypeDef Init;
/* Default SDIO peripheral configuration for SD card initialization */ /* Default SDIO peripheral configuration for SD card initialization */
hsd.Init.ClockEdge = hsd.Init.ClockEdge; Init.ClockEdge = hsd.Init.ClockEdge;
hsd.Init.ClockBypass = hsd.Init.ClockBypass; Init.ClockBypass = hsd.Init.ClockBypass;
hsd.Init.ClockPowerSave = hsd.Init.ClockPowerSave; Init.ClockPowerSave = hsd.Init.ClockPowerSave;
hsd.Init.BusWide = hsd.Init.BusWide; Init.BusWide = hsd.Init.BusWide;
hsd.Init.HardwareFlowControl = hsd.Init.HardwareFlowControl; Init.HardwareFlowControl = hsd.Init.HardwareFlowControl;
hsd.Init.ClockDiv = clock_to_divider(SDIO_CLOCK); Init.ClockDiv = clock_to_divider(SDIO_CLOCK);
/* Initialize SDIO peripheral interface with default configuration */ /* Initialize SDIO peripheral interface with default configuration */
SDIO_Init(hsd.Instance, hsd.Init); SDIO_Init(hsd.Instance, Init);
} }
void SD_LowLevel_Init(void) { void SD_LowLevel_Init(void) {
uint32_t tempreg; uint32_t tempreg;
__HAL_RCC_SDIO_CLK_ENABLE();
__HAL_RCC_GPIOC_CLK_ENABLE(); //enable GPIO clocks __HAL_RCC_GPIOC_CLK_ENABLE(); //enable GPIO clocks
__HAL_RCC_GPIOD_CLK_ENABLE(); //enable GPIO clocks __HAL_RCC_GPIOD_CLK_ENABLE(); //enable GPIO clocks
@@ -172,45 +163,11 @@
GPIO_InitStruct.Pin = GPIO_PIN_2; GPIO_InitStruct.Pin = GPIO_PIN_2;
HAL_GPIO_Init(GPIOD, &GPIO_InitStruct); HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
// Setup DMA #if DISABLED(STM32F1xx)
#if defined(STM32F1xx) // TODO: use __HAL_RCC_SDIO_RELEASE_RESET() and __HAL_RCC_SDIO_CLK_ENABLE();
hdma_sdio.Init.Mode = DMA_NORMAL; RCC->APB2RSTR &= ~RCC_APB2RSTR_SDIORST_Msk; // take SDIO out of reset
hdma_sdio.Instance = DMA2_Channel4; RCC->APB2ENR |= RCC_APB2RSTR_SDIORST_Msk; // enable SDIO clock
HAL_NVIC_EnableIRQ(DMA2_Channel4_5_IRQn); // Enable the DMA2 Clock
#elif defined(STM32F4xx)
hdma_sdio.Init.Mode = DMA_PFCTRL;
hdma_sdio.Instance = DMA2_Stream3;
hdma_sdio.Init.Channel = DMA_CHANNEL_4;
hdma_sdio.Init.FIFOMode = DMA_FIFOMODE_ENABLE;
hdma_sdio.Init.FIFOThreshold = DMA_FIFO_THRESHOLD_FULL;
hdma_sdio.Init.MemBurst = DMA_MBURST_INC4;
hdma_sdio.Init.PeriphBurst = DMA_PBURST_INC4;
HAL_NVIC_EnableIRQ(DMA2_Stream3_IRQn);
#endif
HAL_NVIC_EnableIRQ(SDIO_IRQn);
hdma_sdio.Init.PeriphInc = DMA_PINC_DISABLE;
hdma_sdio.Init.MemInc = DMA_MINC_ENABLE;
hdma_sdio.Init.PeriphDataAlignment = DMA_PDATAALIGN_WORD;
hdma_sdio.Init.MemDataAlignment = DMA_MDATAALIGN_WORD;
hdma_sdio.Init.Priority = DMA_PRIORITY_LOW;
__HAL_LINKDMA(&hsd, hdmarx, hdma_sdio);
__HAL_LINKDMA(&hsd, hdmatx, hdma_sdio);
#if defined(STM32F1xx)
__HAL_RCC_SDIO_CLK_ENABLE();
__HAL_RCC_DMA2_CLK_ENABLE();
#else
__HAL_RCC_SDIO_FORCE_RESET();
delay(2);
__HAL_RCC_SDIO_RELEASE_RESET();
delay(2);
__HAL_RCC_SDIO_CLK_ENABLE();
__HAL_RCC_DMA2_FORCE_RESET();
delay(2);
__HAL_RCC_DMA2_RELEASE_RESET();
delay(2);
__HAL_RCC_DMA2_CLK_ENABLE();
#endif #endif
//Initialize the SDIO (with initial <400Khz Clock) //Initialize the SDIO (with initial <400Khz Clock)
@@ -222,7 +179,6 @@
// Power up the SDIO // Power up the SDIO
SDIO_PowerState_ON(SDIO); SDIO_PowerState_ON(SDIO);
hsd.Instance = SDIO;
} }
void HAL_SD_MspInit(SD_HandleTypeDef *hsd) { // application specific init void HAL_SD_MspInit(SD_HandleTypeDef *hsd) { // application specific init
@@ -266,81 +222,107 @@
if (!status) break; if (!status) break;
if (!--retry_Cnt) return false; // return failing status if retries are exhausted if (!--retry_Cnt) return false; // return failing status if retries are exhausted
} }
go_to_transfer_speed();
} }
#endif #endif
return true; return true;
} }
/*
void init_SDIO_pins(void) {
GPIO_InitTypeDef GPIO_InitStruct = {0};
static bool SDIO_ReadWriteBlock_DMA(uint32_t block, const uint8_t *src, uint8_t *dst) { // SDIO GPIO Configuration
if (HAL_SD_GetCardState(&hsd) != HAL_SD_CARD_TRANSFER) return false; // PC8 ------> SDIO_D0
// PC12 ------> SDIO_CK
// PD2 ------> SDIO_CMD
TERN_(USE_WATCHDOG, HAL_watchdog_refresh()); GPIO_InitStruct.Pin = GPIO_PIN_8;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF12_SDIO;
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
HAL_StatusTypeDef ret; GPIO_InitStruct.Pin = GPIO_PIN_12;
if (src) { GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
hdma_sdio.Init.Direction = DMA_MEMORY_TO_PERIPH; GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_DMA_Init(&hdma_sdio); GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
ret = HAL_SD_WriteBlocks_DMA(&hsd, (uint8_t *)src, block, 1); GPIO_InitStruct.Alternate = GPIO_AF12_SDIO;
} HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
else {
hdma_sdio.Init.Direction = DMA_PERIPH_TO_MEMORY; GPIO_InitStruct.Pin = GPIO_PIN_2;
HAL_DMA_Init(&hdma_sdio); GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
ret = HAL_SD_ReadBlocks_DMA(&hsd, (uint8_t *)dst, block, 1); GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF12_SDIO;
HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
}
*/
//bool SDIO_init() { return (bool) (SD_SDIO_Init() ? 1 : 0);}
//bool SDIO_Init_C() { return (bool) (SD_SDIO_Init() ? 1 : 0);}
bool SDIO_ReadBlock(uint32_t block, uint8_t *dst) {
hsd.Instance = SDIO;
uint8_t retryCnt = SDIO_READ_RETRIES;
bool status;
for (;;) {
TERN_(USE_WATCHDOG, HAL_watchdog_refresh());
status = (bool) HAL_SD_ReadBlocks(&hsd, (uint8_t*)dst, block, 1, 1000); // read one 512 byte block with 500mS timeout
status |= (bool) HAL_SD_GetCardState(&hsd); // make sure all is OK
if (!status) break; // return passing status
if (!--retryCnt) break; // return failing status if retries are exhausted
} }
return status;
if (ret != HAL_OK) { /*
HAL_DMA_Abort_IT(&hdma_sdio); return (bool) ((status_read | status_card) ? 1 : 0);
HAL_DMA_DeInit(&hdma_sdio);
if (SDIO_GetCardState() != SDIO_CARD_TRANSFER) return false;
if (blockAddress >= SdCard.LogBlockNbr) return false;
if ((0x03 & (uint32_t)data)) return false; // misaligned data
if (SdCard.CardType != CARD_SDHC_SDXC) { blockAddress *= 512U; }
if (!SDIO_CmdReadSingleBlock(blockAddress)) {
SDIO_CLEAR_FLAG(SDIO_ICR_CMD_FLAGS);
dma_disable(SDIO_DMA_DEV, SDIO_DMA_CHANNEL);
return false; return false;
} }
millis_t timeout = millis() + 500; while (!SDIO_GET_FLAG(SDIO_STA_DATAEND | SDIO_STA_TRX_ERROR_FLAGS)) {}
// Wait the transfer
while (hsd.State != HAL_SD_STATE_READY) { dma_disable(SDIO_DMA_DEV, SDIO_DMA_CHANNEL);
if (ELAPSED(millis(), timeout)) {
HAL_DMA_Abort_IT(&hdma_sdio); if (SDIO->STA & SDIO_STA_RXDAVL) {
HAL_DMA_DeInit(&hdma_sdio); while (SDIO->STA & SDIO_STA_RXDAVL) (void)SDIO->FIFO;
return false; SDIO_CLEAR_FLAG(SDIO_ICR_CMD_FLAGS | SDIO_ICR_DATA_FLAGS);
} return false;
} }
while (__HAL_DMA_GET_FLAG(&hdma_sdio, __HAL_DMA_GET_TC_FLAG_INDEX(&hdma_sdio)) != 0 if (SDIO_GET_FLAG(SDIO_STA_TRX_ERROR_FLAGS)) {
|| __HAL_DMA_GET_FLAG(&hdma_sdio, __HAL_DMA_GET_TE_FLAG_INDEX(&hdma_sdio)) != 0) { /* nada */ } SDIO_CLEAR_FLAG(SDIO_ICR_CMD_FLAGS | SDIO_ICR_DATA_FLAGS);
return false;
HAL_DMA_Abort_IT(&hdma_sdio); }
HAL_DMA_DeInit(&hdma_sdio); SDIO_CLEAR_FLAG(SDIO_ICR_CMD_FLAGS | SDIO_ICR_DATA_FLAGS);
*/
timeout = millis() + 500;
while (HAL_SD_GetCardState(&hsd) != HAL_SD_CARD_TRANSFER) if (ELAPSED(millis(), timeout)) return false;
return true; return true;
} }
bool SDIO_ReadBlock(uint32_t block, uint8_t *dst) {
uint8_t retries = SDIO_READ_RETRIES;
while (retries--) if (SDIO_ReadWriteBlock_DMA(block, NULL, dst)) return true;
return false;
}
bool SDIO_WriteBlock(uint32_t block, const uint8_t *src) { bool SDIO_WriteBlock(uint32_t block, const uint8_t *src) {
uint8_t retries = SDIO_READ_RETRIES; hsd.Instance = SDIO;
while (retries--) if (SDIO_ReadWriteBlock_DMA(block, src, NULL)) return true; uint8_t retryCnt = SDIO_READ_RETRIES;
return false; bool status;
for (;;) {
status = (bool) HAL_SD_WriteBlocks(&hsd, (uint8_t*)src, block, 1, 500); // write one 512 byte block with 500mS timeout
status |= (bool) HAL_SD_GetCardState(&hsd); // make sure all is OK
if (!status) break; // return passing status
if (!--retryCnt) break; // return failing status if retries are exhausted
}
return status;
} }
#if defined(STM32F1xx)
#define DMA_IRQ_HANDLER DMA2_Channel4_5_IRQHandler
#elif defined(STM32F4xx)
#define DMA_IRQ_HANDLER DMA2_Stream3_IRQHandler
#else
#error "Unknown STM32 architecture."
#endif
extern "C" void SDIO_IRQHandler(void) { HAL_SD_IRQHandler(&hsd); }
extern "C" void DMA_IRQ_HANDLER(void) { HAL_DMA_IRQHandler(&hdma_sdio); }
#endif // !USBD_USE_CDC_COMPOSITE #endif // !USBD_USE_CDC_COMPOSITE
#endif // SDIO_SUPPORT #endif // SDIO_SUPPORT
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC #endif // ARDUINO_ARCH_STM32 && !STM32GENERIC
-82
View File
@@ -1,82 +0,0 @@
/**
* 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
/**
* PersistentStore for Arduino-style EEPROM interface
* with simple implementations supplied by Marlin.
*/
#include "../../inc/MarlinConfig.h"
#if ENABLED(IIC_BL24CXX_EEPROM)
#include "../shared/eeprom_if.h"
#include "../shared/eeprom_api.h"
//
// PersistentStore
//
#ifndef MARLIN_EEPROM_SIZE
#error "MARLIN_EEPROM_SIZE is required for IIC_BL24CXX_EEPROM."
#endif
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE; }
bool PersistentStore::access_start() { eeprom_init(); return true; }
bool PersistentStore::access_finish() { return true; }
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
uint16_t written = 0;
while (size--) {
uint8_t v = *value;
uint8_t * const p = (uint8_t * const)pos;
if (v != eeprom_read_byte(p)) { // EEPROM has only ~100,000 write cycles, so only write bytes that have changed!
eeprom_write_byte(p, v);
if (++written & 0x7F) delay(2); else safe_delay(2); // Avoid triggering watchdog during long EEPROM writes
if (eeprom_read_byte(p) != v) {
SERIAL_ECHO_MSG(STR_ERR_EEPROM_WRITE);
return true;
}
}
crc16(crc, &v, 1);
pos++;
value++;
}
return false;
}
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
do {
uint8_t * const p = (uint8_t * const)pos;
uint8_t c = eeprom_read_byte(p);
if (writing) *value = c;
crc16(crc, &c, 1);
pos++;
value++;
} while (--size);
return false;
}
#endif // IIC_BL24CXX_EEPROM
#endif // STM32F1
-54
View File
@@ -1,54 +0,0 @@
/**
* 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/>.
*
*/
/**
* Platform-independent Arduino functions for I2C EEPROM.
* Enable USE_SHARED_EEPROM if not supplied by the framework.
*/
#ifdef STM32F1
#include "../../inc/MarlinConfig.h"
#if ENABLED(IIC_BL24CXX_EEPROM)
#include "../../libs/BL24CXX.h"
#include "../shared/eeprom_if.h"
void eeprom_init() { BL24CXX::init(); }
// ------------------------
// Public functions
// ------------------------
void eeprom_write_byte(uint8_t *pos, uint8_t value) {
const unsigned eeprom_address = (unsigned)pos;
return BL24CXX::writeOneByte(eeprom_address, value);
}
uint8_t eeprom_read_byte(uint8_t *pos) {
const unsigned eeprom_address = (unsigned)pos;
return BL24CXX::readOneByte(eeprom_address);
}
#endif // IIC_BL24CXX_EEPROM
#endif // STM32F1
+7 -4
View File
@@ -43,22 +43,25 @@ bool PersistentStore::access_start() { eeprom_init(); return true; }
bool PersistentStore::access_finish() { return true; } bool PersistentStore::access_finish() { return true; }
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) { bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
uint16_t written = 0;
while (size--) { while (size--) {
uint8_t v = *value; uint8_t v = *value;
// EEPROM has only ~100,000 write cycles,
// so only write bytes that have changed!
uint8_t * const p = (uint8_t * const)pos; uint8_t * const p = (uint8_t * const)pos;
if (v != eeprom_read_byte(p)) { // EEPROM has only ~100,000 write cycles, so only write bytes that have changed! if (v != eeprom_read_byte(p)) {
eeprom_write_byte(p, v); eeprom_write_byte(p, v);
if (++written & 0x7F) delay(2); else safe_delay(2); // Avoid triggering watchdog during long EEPROM writes
if (eeprom_read_byte(p) != v) { if (eeprom_read_byte(p) != v) {
SERIAL_ECHO_MSG(STR_ERR_EEPROM_WRITE); SERIAL_ECHO_MSG(STR_ERR_EEPROM_WRITE);
return true; return true;
} }
} }
crc16(crc, &v, 1); crc16(crc, &v, 1);
pos++; pos++;
value++; value++;
} };
return false; return false;
} }
@@ -46,10 +46,4 @@ void setup_endstop_interrupts() {
TERN_(HAS_Z4_MAX, _ATTACH(Z4_MAX_PIN)); TERN_(HAS_Z4_MAX, _ATTACH(Z4_MAX_PIN));
TERN_(HAS_Z4_MIN, _ATTACH(Z4_MIN_PIN)); TERN_(HAS_Z4_MIN, _ATTACH(Z4_MIN_PIN));
TERN_(HAS_Z_MIN_PROBE_PIN, _ATTACH(Z_MIN_PROBE_PIN)); TERN_(HAS_Z_MIN_PROBE_PIN, _ATTACH(Z_MIN_PROBE_PIN));
TERN_(HAS_I_MAX, _ATTACH(I_MAX_PIN));
TERN_(HAS_I_MIN, _ATTACH(I_MIN_PIN));
TERN_(HAS_J_MAX, _ATTACH(J_MAX_PIN));
TERN_(HAS_J_MIN, _ATTACH(J_MIN_PIN));
TERN_(HAS_K_MAX, _ATTACH(K_MAX_PIN));
TERN_(HAS_K_MIN, _ATTACH(K_MIN_PIN));
} }
+1 -1
View File
@@ -21,7 +21,7 @@
*/ */
#pragma once #pragma once
#if BOTH(SDSUPPORT, USBD_USE_CDC_MSC) && DISABLED(NO_SD_HOST_DRIVE) #if defined(USBD_USE_CDC_MSC) && DISABLED(NO_SD_HOST_DRIVE)
#define HAS_SD_HOST_DRIVE 1 #define HAS_SD_HOST_DRIVE 1
#endif #endif
+2 -2
View File
@@ -52,6 +52,6 @@
#error "SERIAL_STATS_DROPPED_RX is not supported on STM32." #error "SERIAL_STATS_DROPPED_RX is not supported on STM32."
#endif #endif
#if ANY(TFT_COLOR_UI, TFT_LVGL_UI, TFT_CLASSIC_UI) && NOT_TARGET(STM32H7xx, STM32F4xx, STM32F1xx) #if ANY(TFT_COLOR_UI, TFT_LVGL_UI, TFT_CLASSIC_UI) && NOT_TARGET(STM32F4xx, STM32F1xx)
#error "TFT_COLOR_UI, TFT_LVGL_UI and TFT_CLASSIC_UI are currently only supported on STM32H7, STM32F4 and STM32F1 hardware." #error "TFT_COLOR_UI, TFT_LVGL_UI and TFT_CLASSIC_UI are currently only supported on STM32F4 and STM32F1 hardware."
#endif #endif
+13 -25
View File
@@ -30,66 +30,54 @@
class Sd2CardUSBMscHandler : public USBMscHandler { class Sd2CardUSBMscHandler : public USBMscHandler {
public: public:
DiskIODriver* diskIODriver() {
#if ENABLED(MULTI_VOLUME)
#if SHARED_VOLUME_IS(SD_ONBOARD)
return &card.media_sd_spi;
#elif SHARED_VOLUME_IS(USB_FLASH_DRIVE)
return &card.media_usbFlashDrive;
#endif
#else
return card.diskIODriver();
#endif
}
bool GetCapacity(uint32_t *pBlockNum, uint16_t *pBlockSize) { bool GetCapacity(uint32_t *pBlockNum, uint16_t *pBlockSize) {
*pBlockNum = diskIODriver()->cardSize(); *pBlockNum = card.getSd2Card().cardSize();
*pBlockSize = BLOCK_SIZE; *pBlockSize = BLOCK_SIZE;
return true; return true;
} }
bool Write(uint8_t *pBuf, uint32_t blkAddr, uint16_t blkLen) { bool Write(uint8_t *pBuf, uint32_t blkAddr, uint16_t blkLen) {
auto sd2card = diskIODriver(); auto sd2card = card.getSd2Card();
// single block // single block
if (blkLen == 1) { if (blkLen == 1) {
watchdog_refresh(); watchdog_refresh();
sd2card->writeBlock(blkAddr, pBuf); sd2card.writeBlock(blkAddr, pBuf);
return true; return true;
} }
// multi block optmization // multi block optmization
sd2card->writeStart(blkAddr, blkLen); sd2card.writeStart(blkAddr, blkLen);
while (blkLen--) { while (blkLen--) {
watchdog_refresh(); watchdog_refresh();
sd2card->writeData(pBuf); sd2card.writeData(pBuf);
pBuf += BLOCK_SIZE; pBuf += BLOCK_SIZE;
} }
sd2card->writeStop(); sd2card.writeStop();
return true; return true;
} }
bool Read(uint8_t *pBuf, uint32_t blkAddr, uint16_t blkLen) { bool Read(uint8_t *pBuf, uint32_t blkAddr, uint16_t blkLen) {
auto sd2card = diskIODriver(); auto sd2card = card.getSd2Card();
// single block // single block
if (blkLen == 1) { if (blkLen == 1) {
watchdog_refresh(); watchdog_refresh();
sd2card->readBlock(blkAddr, pBuf); sd2card.readBlock(blkAddr, pBuf);
return true; return true;
} }
// multi block optmization // multi block optmization
sd2card->readStart(blkAddr); sd2card.readStart(blkAddr);
while (blkLen--) { while (blkLen--) {
watchdog_refresh(); watchdog_refresh();
sd2card->readData(pBuf); sd2card.readData(pBuf);
pBuf += BLOCK_SIZE; pBuf += BLOCK_SIZE;
} }
sd2card->readStop(); sd2card.readStop();
return true; return true;
} }
bool IsReady() { bool IsReady() {
return diskIODriver()->isReady(); return card.isMounted();
} }
}; };
@@ -117,8 +105,8 @@ USBMscHandler *pSingleMscHandler = &usbMscHandler;
void MSC_SD_init() { void MSC_SD_init() {
USBDevice.end(); USBDevice.end();
delay(200); delay(200);
USBDevice.registerMscHandlers(1, &pSingleMscHandler, Marlin_STORAGE_Inquirydata);
USBDevice.begin(); USBDevice.begin();
USBDevice.registerMscHandlers(1, &pSingleMscHandler, Marlin_STORAGE_Inquirydata);
} }
#endif // __STM32F1__ && HAS_SD_HOST_DRIVE #endif // __STM32F1__ && HAS_SD_HOST_DRIVE
-202
View File
@@ -1,202 +0,0 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2021 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 "../../../inc/MarlinConfig.h"
#if ENABLED(TFT_TOUCH_DEVICE_GT911)
#include "gt911.h"
#include "pinconfig.h"
SW_IIC::SW_IIC(uint16_t sda, uint16_t scl) {
scl_pin = scl;
sda_pin = sda;
}
// Software I2C hardware io init
void SW_IIC::init() {
OUT_WRITE(scl_pin, HIGH);
OUT_WRITE(sda_pin, HIGH);
}
// Software I2C start signal
void SW_IIC::start() {
write_sda(HIGH); // SDA = 1
write_scl(HIGH); // SCL = 1
iic_delay(2);
write_sda(LOW); // SDA = 0
iic_delay(1);
write_scl(LOW); // SCL = 0 // keep SCL low, avoid false stop caused by level jump caused by SDA switching IN/OUT
}
// Software I2C stop signal
void SW_IIC::stop() {
write_scl(LOW); // SCL = 0
iic_delay(2);
write_sda(LOW); // SDA = 0
iic_delay(2);
write_scl(HIGH); // SCL = 1
iic_delay(2);
write_sda(HIGH); // SDA = 1
}
// Software I2C sends ACK or NACK signal
void SW_IIC::send_ack(bool ack) {
write_sda(ack ? LOW : HIGH); // SDA = !ack
iic_delay(2);
write_scl(HIGH); // SCL = 1
iic_delay(2);
write_scl(LOW); // SCL = 0
}
// Software I2C read ACK or NACK signal
bool SW_IIC::read_ack() {
bool error = 0;
set_sda_in();
iic_delay(2);
write_scl(HIGH); // SCL = 1
error = read_sda();
iic_delay(2);
write_scl(LOW); // SCL = 0
set_sda_out();
return error;
}
void SW_IIC::send_byte(uint8_t txd) {
LOOP_L_N(i, 8) {
write_sda(txd & 0x80); // write data bit
txd <<= 1;
iic_delay(1);
write_scl(HIGH); // SCL = 1
iic_delay(2);
write_scl(LOW); // SCL = 0
iic_delay(1);
}
read_ack(); // wait ack
}
uint8_t SW_IIC::read_byte(bool ack) {
uint8_t data = 0;
set_sda_in();
LOOP_L_N(i, 8) {
write_scl(HIGH); // SCL = 1
iic_delay(1);
data <<= 1;
if (read_sda()) data++;
write_scl(LOW); // SCL = 0
iic_delay(2);
}
set_sda_out();
send_ack(ack);
return data;
}
GT911_REG_MAP GT911::reg;
SW_IIC GT911::sw_iic = SW_IIC(GT911_SW_I2C_SDA_PIN, GT911_SW_I2C_SCL_PIN);
void GT911::write_reg(uint16_t reg, uint8_t reg_len, uint8_t* w_data, uint8_t w_len) {
sw_iic.start();
sw_iic.send_byte(gt911_slave_address); // Set IIC Slave address
LOOP_L_N(i, reg_len) { // Set reg address
uint8_t r = (reg >> (8 * (reg_len - 1 - i))) & 0xFF;
sw_iic.send_byte(r);
}
LOOP_L_N(i, w_len) { // Write data to reg
sw_iic.send_byte(w_data[i]);
}
sw_iic.stop();
}
void GT911::read_reg(uint16_t reg, uint8_t reg_len, uint8_t* r_data, uint8_t r_len) {
sw_iic.start();
sw_iic.send_byte(gt911_slave_address); // Set IIC Slave address
LOOP_L_N(i, reg_len) { // Set reg address
uint8_t r = (reg >> (8 * (reg_len - 1 - i))) & 0xFF;
sw_iic.send_byte(r);
}
sw_iic.start();
sw_iic.send_byte(gt911_slave_address + 1); // Set read mode
LOOP_L_N(i, r_len) {
r_data[i] = sw_iic.read_byte(1); // Read data from reg
}
sw_iic.stop();
}
void GT911::Init() {
OUT_WRITE(GT911_RST_PIN, LOW);
OUT_WRITE(GT911_INT_PIN, LOW);
delay(20);
WRITE(GT911_RST_PIN, HIGH);
SET_INPUT(GT911_INT_PIN);
sw_iic.init();
uint8_t clear_reg = 0x0000;
write_reg(0x814E, 2, &clear_reg, 2); // Reset to 0 for start
}
bool GT911::getFirstTouchPoint(int16_t *x, int16_t *y) {
read_reg(0x814E, 2, &reg.REG.status, 1);
if (reg.REG.status & 0x80) {
uint8_t clear_reg = 0x00;
write_reg(0x814E, 2, &clear_reg, 1); // Reset to 0 for start
read_reg(0x8150, 2, reg.map + 2, 8 * (reg.REG.status & 0x0F));
// First touch point
*x = ((reg.REG.point[0].xh & 0x0F) << 8) | reg.REG.point[0].xl;
*y = ((reg.REG.point[0].yh & 0x0F) << 8) | reg.REG.point[0].yl;
return true;
}
return false;
}
bool GT911::getPoint(int16_t *x, int16_t *y) {
static bool touched = 0;
static int16_t read_x = 0, read_y = 0;
static millis_t next_time = 0;
if (ELAPSED(millis(), next_time)) {
touched = getFirstTouchPoint(&read_x, &read_y);
next_time = millis() + 20;
}
*x = read_x;
*y = read_y;
return touched;
}
#endif // TFT_TOUCH_DEVICE_GT911
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC
-120
View File
@@ -1,120 +0,0 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#pragma once
#include "../../../inc/MarlinConfig.h"
#define GT911_SLAVE_ADDRESS 0xBA
#if !PIN_EXISTS(GT911_RST)
#error "GT911_RST_PIN is not defined."
#elif !PIN_EXISTS(GT911_INT)
#error "GT911_INT_PIN is not defined."
#elif !PIN_EXISTS(GT911_SW_I2C_SCL)
#error "GT911_SW_I2C_SCL_PIN is not defined."
#elif !PIN_EXISTS(GT911_SW_I2C_SDA)
#error "GT911_SW_I2C_SDA_PIN is not defined."
#endif
class SW_IIC {
private:
uint16_t scl_pin;
uint16_t sda_pin;
void write_scl(bool level)
{
WRITE(scl_pin, level);
}
void write_sda(bool level)
{
WRITE(sda_pin, level);
}
bool read_sda()
{
return READ(sda_pin);
}
void set_sda_out()
{
SET_OUTPUT(sda_pin);
}
void set_sda_in()
{
SET_INPUT_PULLUP(sda_pin);
}
static void iic_delay(uint8_t t)
{
delayMicroseconds(t);
}
public:
SW_IIC(uint16_t sda, uint16_t scl);
// setSCL/SDA have to be called before begin()
void setSCL(uint16_t scl)
{
scl_pin = scl;
};
void setSDA(uint16_t sda)
{
sda_pin = sda;
};
void init(); // Initialize the IO port of IIC
void start(); // Send IIC start signal
void stop(); // Send IIC stop signal
void send_byte(uint8_t txd); // IIC sends a byte
uint8_t read_byte(bool ack); // IIC reads a byte
void send_ack(bool ack); // IIC sends ACK or NACK signal
bool read_ack();
};
typedef struct __attribute__((__packed__)) {
uint8_t xl;
uint8_t xh;
uint8_t yl;
uint8_t yh;
uint8_t sizel;
uint8_t sizeh;
uint8_t reserved;
uint8_t track_id;
} GT911_POINT;
typedef union __attribute__((__packed__)) {
uint8_t map[42];
struct {
uint8_t status; // 0x814E
uint8_t track_id; // 0x814F
GT911_POINT point[5]; // [0]:0x8150 - 0x8157 / [1]:0x8158 - 0x815F / [2]:0x8160 - 0x8167 / [3]:0x8168 - 0x816F / [4]:0x8170 - 0x8177
} REG;
} GT911_REG_MAP;
class GT911 {
private:
static const uint8_t gt911_slave_address = GT911_SLAVE_ADDRESS;
static GT911_REG_MAP reg;
static SW_IIC sw_iic;
static void write_reg(uint16_t reg, uint8_t reg_len, uint8_t* w_data, uint8_t w_len);
static void read_reg(uint16_t reg, uint8_t reg_len, uint8_t* r_data, uint8_t r_len);
public:
static void Init();
static bool getFirstTouchPoint(int16_t *x, int16_t *y);
static bool getPoint(int16_t *x, int16_t *y);
};
-387
View File
@@ -1,387 +0,0 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2021 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 "../../../inc/MarlinConfig.h"
#if HAS_LTDC_TFT
#include "tft_ltdc.h"
#include "pinconfig.h"
#define FRAME_BUFFER_ADDRESS 0XC0000000 // SDRAM address
#define SDRAM_TIMEOUT ((uint32_t)0xFFFF)
#define REFRESH_COUNT ((uint32_t)0x02A5) // SDRAM refresh counter
#define SDRAM_MODEREG_BURST_LENGTH_1 ((uint16_t)0x0000)
#define SDRAM_MODEREG_BURST_LENGTH_2 ((uint16_t)0x0001)
#define SDRAM_MODEREG_BURST_LENGTH_4 ((uint16_t)0x0002)
#define SDRAM_MODEREG_BURST_LENGTH_8 ((uint16_t)0x0004)
#define SDRAM_MODEREG_BURST_TYPE_SEQUENTIAL ((uint16_t)0x0000)
#define SDRAM_MODEREG_BURST_TYPE_INTERLEAVED ((uint16_t)0x0008)
#define SDRAM_MODEREG_CAS_LATENCY_2 ((uint16_t)0x0020)
#define SDRAM_MODEREG_CAS_LATENCY_3 ((uint16_t)0x0030)
#define SDRAM_MODEREG_OPERATING_MODE_STANDARD ((uint16_t)0x0000)
#define SDRAM_MODEREG_WRITEBURST_MODE_PROGRAMMED ((uint16_t)0x0000)
#define SDRAM_MODEREG_WRITEBURST_MODE_SINGLE ((uint16_t)0x0200)
void SDRAM_Initialization_Sequence(SDRAM_HandleTypeDef *hsdram, FMC_SDRAM_CommandTypeDef *Command) {
__IO uint32_t tmpmrd =0;
/* Step 1: Configure a clock configuration enable command */
Command->CommandMode = FMC_SDRAM_CMD_CLK_ENABLE;
Command->CommandTarget = FMC_SDRAM_CMD_TARGET_BANK1;
Command->AutoRefreshNumber = 1;
Command->ModeRegisterDefinition = 0;
/* Send the command */
HAL_SDRAM_SendCommand(hsdram, Command, SDRAM_TIMEOUT);
/* Step 2: Insert 100 us minimum delay */
/* Inserted delay is equal to 1 ms due to systick time base unit (ms) */
HAL_Delay(1);
/* Step 3: Configure a PALL (precharge all) command */
Command->CommandMode = FMC_SDRAM_CMD_PALL;
Command->CommandTarget = FMC_SDRAM_CMD_TARGET_BANK1;
Command->AutoRefreshNumber = 1;
Command->ModeRegisterDefinition = 0;
/* Send the command */
HAL_SDRAM_SendCommand(hsdram, Command, SDRAM_TIMEOUT);
/* Step 4 : Configure a Auto-Refresh command */
Command->CommandMode = FMC_SDRAM_CMD_AUTOREFRESH_MODE;
Command->CommandTarget = FMC_SDRAM_CMD_TARGET_BANK1;
Command->AutoRefreshNumber = 8;
Command->ModeRegisterDefinition = 0;
/* Send the command */
HAL_SDRAM_SendCommand(hsdram, Command, SDRAM_TIMEOUT);
/* Step 5: Program the external memory mode register */
tmpmrd = (uint32_t)(SDRAM_MODEREG_BURST_LENGTH_1 |
SDRAM_MODEREG_BURST_TYPE_SEQUENTIAL |
SDRAM_MODEREG_CAS_LATENCY_2 |
SDRAM_MODEREG_OPERATING_MODE_STANDARD |
SDRAM_MODEREG_WRITEBURST_MODE_SINGLE);
Command->CommandMode = FMC_SDRAM_CMD_LOAD_MODE;
Command->CommandTarget = FMC_SDRAM_CMD_TARGET_BANK1;
Command->AutoRefreshNumber = 1;
Command->ModeRegisterDefinition = tmpmrd;
/* Send the command */
HAL_SDRAM_SendCommand(hsdram, Command, SDRAM_TIMEOUT);
/* Step 6: Set the refresh rate counter */
/* Set the device refresh rate */
HAL_SDRAM_ProgramRefreshRate(hsdram, REFRESH_COUNT);
}
void SDRAM_Config() {
__HAL_RCC_SYSCFG_CLK_ENABLE();
__HAL_RCC_FMC_CLK_ENABLE();
SDRAM_HandleTypeDef hsdram;
FMC_SDRAM_TimingTypeDef SDRAM_Timing;
FMC_SDRAM_CommandTypeDef command;
/* Configure the SDRAM device */
hsdram.Instance = FMC_SDRAM_DEVICE;
hsdram.Init.SDBank = FMC_SDRAM_BANK1;
hsdram.Init.ColumnBitsNumber = FMC_SDRAM_COLUMN_BITS_NUM_9;
hsdram.Init.RowBitsNumber = FMC_SDRAM_ROW_BITS_NUM_13;
hsdram.Init.MemoryDataWidth = FMC_SDRAM_MEM_BUS_WIDTH_16;
hsdram.Init.InternalBankNumber = FMC_SDRAM_INTERN_BANKS_NUM_4;
hsdram.Init.CASLatency = FMC_SDRAM_CAS_LATENCY_2;
hsdram.Init.WriteProtection = FMC_SDRAM_WRITE_PROTECTION_DISABLE;
hsdram.Init.SDClockPeriod = FMC_SDRAM_CLOCK_PERIOD_2;
hsdram.Init.ReadBurst = FMC_SDRAM_RBURST_ENABLE;
hsdram.Init.ReadPipeDelay = FMC_SDRAM_RPIPE_DELAY_0;
/* Timing configuration for 100Mhz as SDRAM clock frequency (System clock is up to 200Mhz) */
SDRAM_Timing.LoadToActiveDelay = 2;
SDRAM_Timing.ExitSelfRefreshDelay = 8;
SDRAM_Timing.SelfRefreshTime = 6;
SDRAM_Timing.RowCycleDelay = 6;
SDRAM_Timing.WriteRecoveryTime = 2;
SDRAM_Timing.RPDelay = 2;
SDRAM_Timing.RCDDelay = 2;
/* Initialize the SDRAM controller */
if (HAL_SDRAM_Init(&hsdram, &SDRAM_Timing) != HAL_OK)
{
/* Initialization Error */
}
/* Program the SDRAM external device */
SDRAM_Initialization_Sequence(&hsdram, &command);
}
void LTDC_Config() {
__HAL_RCC_LTDC_CLK_ENABLE();
__HAL_RCC_DMA2D_CLK_ENABLE();
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct;
/* The PLL3R is configured to provide the LTDC PCLK clock */
/* PLL3_VCO Input = HSE_VALUE / PLL3M = 25Mhz / 5 = 5 Mhz */
/* PLL3_VCO Output = PLL3_VCO Input * PLL3N = 5Mhz * 160 = 800 Mhz */
/* PLLLCDCLK = PLL3_VCO Output/PLL3R = 800Mhz / 16 = 50Mhz */
/* LTDC clock frequency = PLLLCDCLK = 50 Mhz */
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_LTDC;
PeriphClkInitStruct.PLL3.PLL3M = 5;
PeriphClkInitStruct.PLL3.PLL3N = 160;
PeriphClkInitStruct.PLL3.PLL3FRACN = 0;
PeriphClkInitStruct.PLL3.PLL3P = 2;
PeriphClkInitStruct.PLL3.PLL3Q = 2;
PeriphClkInitStruct.PLL3.PLL3R = (800 / LTDC_LCD_CLK);
PeriphClkInitStruct.PLL3.PLL3VCOSEL = RCC_PLL3VCOWIDE;
PeriphClkInitStruct.PLL3.PLL3RGE = RCC_PLL3VCIRANGE_2;
HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct);
LTDC_HandleTypeDef hltdc_F;
LTDC_LayerCfgTypeDef pLayerCfg;
/* LTDC Initialization -------------------------------------------------------*/
/* Polarity configuration */
/* Initialize the horizontal synchronization polarity as active low */
hltdc_F.Init.HSPolarity = LTDC_HSPOLARITY_AL;
/* Initialize the vertical synchronization polarity as active low */
hltdc_F.Init.VSPolarity = LTDC_VSPOLARITY_AL;
/* Initialize the data enable polarity as active low */
hltdc_F.Init.DEPolarity = LTDC_DEPOLARITY_AL;
/* Initialize the pixel clock polarity as input pixel clock */
hltdc_F.Init.PCPolarity = LTDC_PCPOLARITY_IPC;
/* Timing configuration */
hltdc_F.Init.HorizontalSync = (LTDC_LCD_HSYNC - 1);
hltdc_F.Init.VerticalSync = (LTDC_LCD_VSYNC - 1);
hltdc_F.Init.AccumulatedHBP = (LTDC_LCD_HSYNC + LTDC_LCD_HBP - 1);
hltdc_F.Init.AccumulatedVBP = (LTDC_LCD_VSYNC + LTDC_LCD_VBP - 1);
hltdc_F.Init.AccumulatedActiveH = (TFT_HEIGHT + LTDC_LCD_VSYNC + LTDC_LCD_VBP - 1);
hltdc_F.Init.AccumulatedActiveW = (TFT_WIDTH + LTDC_LCD_HSYNC + LTDC_LCD_HBP - 1);
hltdc_F.Init.TotalHeigh = (TFT_HEIGHT + LTDC_LCD_VSYNC + LTDC_LCD_VBP + LTDC_LCD_VFP - 1);
hltdc_F.Init.TotalWidth = (TFT_WIDTH + LTDC_LCD_HSYNC + LTDC_LCD_HBP + LTDC_LCD_HFP - 1);
/* Configure R,G,B component values for LCD background color : all black background */
hltdc_F.Init.Backcolor.Blue = 0;
hltdc_F.Init.Backcolor.Green = 0;
hltdc_F.Init.Backcolor.Red = 0;
hltdc_F.Instance = LTDC;
/* Layer0 Configuration ------------------------------------------------------*/
/* Windowing configuration */
pLayerCfg.WindowX0 = 0;
pLayerCfg.WindowX1 = TFT_WIDTH;
pLayerCfg.WindowY0 = 0;
pLayerCfg.WindowY1 = TFT_HEIGHT;
/* Pixel Format configuration*/
pLayerCfg.PixelFormat = LTDC_PIXEL_FORMAT_RGB565;
/* Start Address configuration : frame buffer is located at SDRAM memory */
pLayerCfg.FBStartAdress = (uint32_t)(FRAME_BUFFER_ADDRESS);
/* Alpha constant (255 == totally opaque) */
pLayerCfg.Alpha = 255;
/* Default Color configuration (configure A,R,G,B component values) : no background color */
pLayerCfg.Alpha0 = 0; /* fully transparent */
pLayerCfg.Backcolor.Blue = 0;
pLayerCfg.Backcolor.Green = 0;
pLayerCfg.Backcolor.Red = 0;
/* Configure blending factors */
pLayerCfg.BlendingFactor1 = LTDC_BLENDING_FACTOR1_CA;
pLayerCfg.BlendingFactor2 = LTDC_BLENDING_FACTOR2_CA;
/* Configure the number of lines and number of pixels per line */
pLayerCfg.ImageWidth = TFT_WIDTH;
pLayerCfg.ImageHeight = TFT_HEIGHT;
/* Configure the LTDC */
if (HAL_LTDC_Init(&hltdc_F) != HAL_OK)
{
/* Initialization Error */
}
/* Configure the Layer*/
if (HAL_LTDC_ConfigLayer(&hltdc_F, &pLayerCfg, 0) != HAL_OK)
{
/* Initialization Error */
}
}
uint16_t TFT_LTDC::x_min = 0;
uint16_t TFT_LTDC::x_max = 0;
uint16_t TFT_LTDC::y_min = 0;
uint16_t TFT_LTDC::y_max = 0;
uint16_t TFT_LTDC::x_cur = 0;
uint16_t TFT_LTDC::y_cur = 0;
uint8_t TFT_LTDC::reg = 0;
volatile uint16_t* TFT_LTDC::framebuffer = (volatile uint16_t* )FRAME_BUFFER_ADDRESS;
void TFT_LTDC::Init() {
// SDRAM pins init
for (uint16_t i = 0; PinMap_SDRAM[i].pin != NC; i++)
pinmap_pinout(PinMap_SDRAM[i].pin, PinMap_SDRAM);
// SDRAM peripheral config
SDRAM_Config();
// LTDC pins init
for (uint16_t i = 0; PinMap_LTDC[i].pin != NC; i++)
pinmap_pinout(PinMap_LTDC[i].pin, PinMap_LTDC);
// LTDC peripheral config
LTDC_Config();
}
uint32_t TFT_LTDC::GetID() {
return 0xABAB;
}
uint32_t TFT_LTDC::ReadID(tft_data_t Reg) {
return 0xABAB;
}
bool TFT_LTDC::isBusy() {
return false;
}
uint16_t TFT_LTDC::ReadPoint(uint16_t x, uint16_t y) {
return framebuffer[(TFT_WIDTH * y) + x];
}
void TFT_LTDC::DrawPoint(uint16_t x, uint16_t y, uint16_t color) {
framebuffer[(TFT_WIDTH * y) + x] = color;
}
void TFT_LTDC::DrawRect(uint16_t sx, uint16_t sy, uint16_t ex, uint16_t ey, uint16_t color) {
if (sx == ex || sy == ey) return;
uint16_t offline = TFT_WIDTH - (ex - sx);
uint32_t addr = (uint32_t)&framebuffer[(TFT_WIDTH * sy) + sx];
CBI(DMA2D->CR, 0);
DMA2D->CR = 3 << 16;
DMA2D->OPFCCR = 0X02;
DMA2D->OOR = offline;
DMA2D->OMAR = addr;
DMA2D->NLR = (ey - sy) | ((ex - sx) << 16);
DMA2D->OCOLR = color;
SBI(DMA2D->CR, 0);
uint32_t timeout = 0;
while (!TEST(DMA2D->ISR, 1)) {
timeout++;
if (timeout > 0x1FFFFF) break;
}
SBI(DMA2D->IFCR, 1);
}
void TFT_LTDC::DrawImage(uint16_t sx, uint16_t sy, uint16_t ex, uint16_t ey, uint16_t *colors) {
if (sx == ex || sy == ey) return;
uint16_t offline = TFT_WIDTH - (ex - sx);
uint32_t addr = (uint32_t)&framebuffer[(TFT_WIDTH * sy) + sx];
CBI(DMA2D->CR, 0);
DMA2D->CR = 0 << 16;
DMA2D->FGPFCCR = 0X02;
DMA2D->FGOR = 0;
DMA2D->OOR = offline;
DMA2D->FGMAR = (uint32_t)colors;
DMA2D->OMAR = addr;
DMA2D->NLR = (ey - sy) | ((ex - sx) << 16);
SBI(DMA2D->CR, 0);
uint32_t timeout = 0;
while (!TEST(DMA2D->ISR, 1)) {
timeout++;
if (timeout > 0x1FFFFF) break;
}
SBI(DMA2D->IFCR, 1);
}
void TFT_LTDC::WriteData(uint16_t data) {
switch (reg) {
case 0x01: x_cur = x_min = data; return;
case 0x02: x_max = data; return;
case 0x03: y_cur = y_min = data; return;
case 0x04: y_max = data; return;
}
Transmit(data);
}
void TFT_LTDC::Transmit(tft_data_t Data) {
DrawPoint(x_cur, y_cur, Data);
x_cur++;
if (x_cur > x_max) {
x_cur = x_min;
y_cur++;
if (y_cur > y_max) y_cur = y_min;
}
}
void TFT_LTDC::WriteReg(uint16_t Reg) {
reg = Reg;
}
void TFT_LTDC::TransmitDMA(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count) {
while (x_cur != x_min && Count) {
Transmit(*Data);
if (MemoryIncrease == DMA_PINC_ENABLE) Data++;
Count--;
}
uint16_t width = x_max - x_min + 1;
uint16_t height = Count / width;
uint16_t x_end_cnt = Count - (width * height);
if (height) {
if (MemoryIncrease == DMA_PINC_ENABLE) {
DrawImage(x_min, y_cur, x_min + width, y_cur + height, Data);
Data += width * height;
} else {
DrawRect(x_min, y_cur, x_min + width, y_cur + height, *Data);
}
y_cur += height;
}
while (x_end_cnt) {
Transmit(*Data);
if (MemoryIncrease == DMA_PINC_ENABLE) Data++;
x_end_cnt--;
}
}
#endif // HAS_LTDC_TFT
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC
-155
View File
@@ -1,155 +0,0 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#pragma once
#include "../../../inc/MarlinConfig.h"
#ifdef STM32H7xx
#include "stm32h7xx_hal.h"
#else
#error "LTDC TFT is currently only supported on STM32H7 hardware."
#endif
#define DATASIZE_8BIT SPI_DATASIZE_8BIT
#define DATASIZE_16BIT SPI_DATASIZE_16BIT
#define TFT_IO_DRIVER TFT_LTDC
#define TFT_DATASIZE DATASIZE_16BIT
typedef uint16_t tft_data_t;
class TFT_LTDC {
private:
static volatile uint16_t *framebuffer;
static uint16_t x_min, x_max, y_min, y_max, x_cur, y_cur;
static uint8_t reg;
static uint32_t ReadID(tft_data_t Reg);
static uint16_t ReadPoint(uint16_t x, uint16_t y);
static void DrawPoint(uint16_t x, uint16_t y, uint16_t color);
static void DrawRect(uint16_t sx, uint16_t sy, uint16_t ex, uint16_t ey, uint16_t color);
static void DrawImage(uint16_t sx, uint16_t sy, uint16_t ex, uint16_t ey, uint16_t *colors);
static void Transmit(tft_data_t Data);
static void TransmitDMA(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count);
public:
static void Init();
static uint32_t GetID();
static bool isBusy();
static void Abort() { /*__HAL_DMA_DISABLE(&DMAtx);*/ }
static void DataTransferBegin(uint16_t DataWidth = TFT_DATASIZE) {}
static void DataTransferEnd() {};
static void WriteData(uint16_t Data);
static void WriteReg(uint16_t Reg);
static void WriteSequence(uint16_t *Data, uint16_t Count) { TransmitDMA(DMA_PINC_ENABLE, Data, Count); }
static void WriteMultiple(uint16_t Color, uint16_t Count) { static uint16_t Data; Data = Color; TransmitDMA(DMA_PINC_DISABLE, &Data, Count); }
static void WriteMultiple(uint16_t Color, uint32_t Count) {
static uint16_t Data; Data = Color;
while (Count > 0) {
TransmitDMA(DMA_MINC_DISABLE, &Data, Count > 0xFFFF ? 0xFFFF : Count);
Count = Count > 0xFFFF ? Count - 0xFFFF : 0;
}
}
};
const PinMap PinMap_LTDC[] = {
{PF_10, LTDC, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_LTDC)}, // LCD_DE
{PG_7, LTDC, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_LTDC)}, // LCD_CLK
{PI_9, LTDC, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_LTDC)}, // LCD_VSYNC
{PI_10, LTDC, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_LTDC)}, // LCD_HSYNC
{PG_6, LTDC, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_LTDC)}, // LCD_R7
{PH_12, LTDC, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_LTDC)}, // LCD_R6
{PH_11, LTDC, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_LTDC)}, // LCD_R5
{PH_10, LTDC, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_LTDC)}, // LCD_R4
{PH_9, LTDC, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_LTDC)}, // LCD_R3
{PI_2, LTDC, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_LTDC)}, // LCD_G7
{PI_1, LTDC, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_LTDC)}, // LCD_G6
{PI_0, LTDC, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_LTDC)}, // LCD_G5
{PH_15, LTDC, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_LTDC)}, // LCD_G4
{PH_14, LTDC, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_LTDC)}, // LCD_G3
{PH_13, LTDC, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_LTDC)}, // LCD_G2
{PI_7, LTDC, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_LTDC)}, // LCD_B7
{PI_6, LTDC, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_LTDC)}, // LCD_B6
{PI_5, LTDC, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_LTDC)}, // LCD_B5
{PI_4, LTDC, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_LTDC)}, // LCD_B4
{PG_11, LTDC, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_LTDC)}, // LCD_B3
{NC, NP, 0}
};
const PinMap PinMap_SDRAM[] = {
{PC_0, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_SDNWE
{PC_2, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_SDNE0
{PC_3, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_SDCKE0
{PE_0, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_NBL0
{PE_1, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_NBL1
{PF_11, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_SDNRAS
{PG_8, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_SDCLK
{PG_15, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_SDNCAS
{PG_4, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_BA0
{PG_5, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_BA1
{PD_14, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_D0
{PD_15, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_D1
{PD_0, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_D2
{PD_1, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_D3
{PE_7, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_D4
{PE_8, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_D5
{PE_9, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_D6
{PE_10, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_D7
{PE_11, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_D8
{PE_12, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_D9
{PE_13, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_D10
{PE_14, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_D11
{PE_15, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_D12
{PD_8, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_D13
{PD_9, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_D14
{PD_10, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_D15
{PF_0, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_A0
{PF_1, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_A1
{PF_2, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_A2
{PF_3, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_A3
{PF_4, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_A4
{PF_5, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_A5
{PF_12, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_A6
{PF_13, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_A7
{PF_14, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_A8
{PF_15, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_A9
{PG_0, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_A10
{PG_1, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_A11
{PG_2, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_A12
{NC, NP, 0}
};
const PinMap PinMap_QUADSPI[] = {
{PB_2, QUADSPI, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_QUADSPI)}, // QUADSPI_CLK
{PB_10, QUADSPI, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_QUADSPI)}, // QUADSPI_BK1_NCS
{PF_6, QUADSPI, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_QUADSPI)}, // QUADSPI_BK1_IO3
{PF_7, QUADSPI, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_QUADSPI)}, // QUADSPI_BK1_IO2
{PF_8, QUADSPI, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_QUADSPI)}, // QUADSPI_BK1_IO0
{PF_9, QUADSPI, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_QUADSPI)}, // QUADSPI_BK1_IO1
{NC, NP, 0}
};
+1 -1
View File
@@ -23,7 +23,7 @@
#include "../../../inc/MarlinConfig.h" #include "../../../inc/MarlinConfig.h"
#if HAS_TFT_XPT2046 || HAS_RES_TOUCH_BUTTONS #if HAS_TFT_XPT2046 || HAS_TOUCH_BUTTONS
#include "xpt2046.h" #include "xpt2046.h"
#include "pinconfig.h" #include "pinconfig.h"
+1 -1
View File
@@ -74,7 +74,7 @@
#elif defined(STM32F401xC) || defined(STM32F401xE) #elif defined(STM32F401xC) || defined(STM32F401xE)
#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) || defined(STM32H7xx) #elif defined(STM32F4xx) || defined(STM32F7xx)
#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
+3
View File
@@ -21,12 +21,15 @@
*/ */
#pragma once #pragma once
#include <stdint.h>
#include "../../inc/MarlinConfig.h" #include "../../inc/MarlinConfig.h"
// ------------------------ // ------------------------
// Defines // Defines
// ------------------------ // ------------------------
#define FORCE_INLINE __attribute__((always_inline)) inline
// STM32 timers may be 16 or 32 bit. Limiting HAL_TIMER_TYPE_MAX to 16 bits // STM32 timers may be 16 or 32 bit. Limiting HAL_TIMER_TYPE_MAX to 16 bits
// avoids issues with STM32F0 MCUs, which seem to pause timers if UINT32_MAX // avoids issues with STM32F0 MCUs, which seem to pause timers if UINT32_MAX
// is written to the register. STM32F4 timers do not manifest this issue, // is written to the register. STM32F4 timers do not manifest this issue,
+1 -1
View File
@@ -110,7 +110,7 @@ uint8_t BulkStorage::Read(uint8_t lun, uint32_t addr, uint16_t bsize, uint8_t bl
} }
uint8_t BulkStorage::Write(uint8_t lun, uint32_t addr, uint16_t bsize, uint8_t blocks, const uint8_t * buf) { uint8_t BulkStorage::Write(uint8_t lun, uint32_t addr, uint16_t bsize, uint8_t blocks, const uint8_t * buf) {
return USBH_MSC_Write(&hUsbHost, lun, addr, const_cast<uint8_t*>(buf), blocks) != USBH_OK; return USBH_MSC_Write(&hUsbHost, lun, addr, const_cast <uint8_t*>(buf), blocks) != USBH_OK;
} }
#endif // USE_OTG_USB_HOST && USBHOST #endif // USE_OTG_USB_HOST && USBHOST
+2 -4
View File
@@ -293,7 +293,7 @@ void HAL_init() {
#if PIN_EXISTS(USB_CONNECT) #if PIN_EXISTS(USB_CONNECT)
OUT_WRITE(USB_CONNECT_PIN, !USB_CONNECT_INVERTING); // USB clear connection OUT_WRITE(USB_CONNECT_PIN, !USB_CONNECT_INVERTING); // USB clear connection
delay(1000); // Give OS time to notice delay(1000); // Give OS time to notice
WRITE(USB_CONNECT_PIN, USB_CONNECT_INVERTING); OUT_WRITE(USB_CONNECT_PIN, USB_CONNECT_INVERTING);
#endif #endif
TERN_(POSTMORTEM_DEBUGGING, install_min_serial()); // Install the minimal serial handler TERN_(POSTMORTEM_DEBUGGING, install_min_serial()); // Install the minimal serial handler
} }
@@ -453,8 +453,6 @@ void analogWrite(pin_t pin, int pwm_val8) {
analogWrite(uint8_t(pin), pwm_val8); analogWrite(uint8_t(pin), pwm_val8);
} }
void HAL_reboot() { nvic_sys_reset(); } void flashFirmware(const int16_t) { nvic_sys_reset(); }
void flashFirmware(const int16_t) { HAL_reboot(); }
#endif // __STM32F1__ #endif // __STM32F1__
+19 -24
View File
@@ -36,6 +36,7 @@
#include "fastio.h" #include "fastio.h"
#include "watchdog.h" #include "watchdog.h"
#include <stdint.h> #include <stdint.h>
#include <util/atomic.h> #include <util/atomic.h>
@@ -52,7 +53,7 @@
// ------------------------ // ------------------------
#ifndef STM32_FLASH_SIZE #ifndef STM32_FLASH_SIZE
#if ANY(MCU_STM32F103RE, MCU_STM32F103VE, MCU_STM32F103ZE) #if EITHER(MCU_STM32F103RE, MCU_STM32F103VE)
#define STM32_FLASH_SIZE 512 #define STM32_FLASH_SIZE 512
#else #else
#define STM32_FLASH_SIZE 256 #define STM32_FLASH_SIZE 256
@@ -62,10 +63,11 @@
#ifdef SERIAL_USB #ifdef SERIAL_USB
typedef ForwardSerial1Class< USBSerial > DefaultSerial1; typedef ForwardSerial1Class< USBSerial > DefaultSerial1;
extern DefaultSerial1 MSerial0; extern DefaultSerial1 MSerial0;
#if HAS_SD_HOST_DRIVE
#define UsbSerial MarlinCompositeSerial #if !HAS_SD_HOST_DRIVE
#else
#define UsbSerial MSerial0 #define UsbSerial MSerial0
#else
#define UsbSerial MarlinCompositeSerial
#endif #endif
#endif #endif
@@ -82,9 +84,10 @@
#define MYSERIAL1 UsbSerial #define MYSERIAL1 UsbSerial
#elif WITHIN(SERIAL_PORT, 1, NUM_UARTS) #elif WITHIN(SERIAL_PORT, 1, NUM_UARTS)
#define MYSERIAL1 MSERIAL(SERIAL_PORT) #define MYSERIAL1 MSERIAL(SERIAL_PORT)
#elif NUM_UARTS == 5
#error "SERIAL_PORT must be -1 or from 1 to 5. Please update your configuration."
#else #else
#define MYSERIAL1 MSERIAL(1) // dummy port #error "SERIAL_PORT must be -1 or from 1 to 3. Please update your configuration."
static_assert(false, "SERIAL_PORT must be from 1 to " STRINGIFY(NUM_UARTS) ". You can also use -1 if the board supports Native USB.")
#endif #endif
#ifdef SERIAL_PORT_2 #ifdef SERIAL_PORT_2
@@ -92,20 +95,10 @@
#define MYSERIAL2 UsbSerial #define MYSERIAL2 UsbSerial
#elif WITHIN(SERIAL_PORT_2, 1, NUM_UARTS) #elif WITHIN(SERIAL_PORT_2, 1, NUM_UARTS)
#define MYSERIAL2 MSERIAL(SERIAL_PORT_2) #define MYSERIAL2 MSERIAL(SERIAL_PORT_2)
#elif NUM_UARTS == 5
#error "SERIAL_PORT_2 must be -1 or from 1 to 5. Please update your configuration."
#else #else
#define MYSERIAL2 MSERIAL(1) // dummy port #error "SERIAL_PORT_2 must be -1 or from 1 to 3. Please update your configuration."
static_assert(false, "SERIAL_PORT_2 must be from 1 to " STRINGIFY(NUM_UARTS) ". You can also use -1 if the board supports Native USB.")
#endif
#endif
#ifdef SERIAL_PORT_3
#if SERIAL_PORT_3 == -1
#define MYSERIAL3 UsbSerial
#elif WITHIN(SERIAL_PORT_3, 1, NUM_UARTS)
#define MYSERIAL3 MSERIAL(SERIAL_PORT_3)
#else
#define MYSERIAL3 MSERIAL(1) // dummy port
static_assert(false, "SERIAL_PORT_3 must be from 1 to " STRINGIFY(NUM_UARTS) ". You can also use -1 if the board supports Native USB.")
#endif #endif
#endif #endif
@@ -114,9 +107,10 @@
#define MMU2_SERIAL UsbSerial #define MMU2_SERIAL UsbSerial
#elif WITHIN(MMU2_SERIAL_PORT, 1, NUM_UARTS) #elif WITHIN(MMU2_SERIAL_PORT, 1, NUM_UARTS)
#define MMU2_SERIAL MSERIAL(MMU2_SERIAL_PORT) #define MMU2_SERIAL MSERIAL(MMU2_SERIAL_PORT)
#elif NUM_UARTS == 5
#error "MMU2_SERIAL_PORT must be -1 or from 1 to 5. Please update your configuration."
#else #else
#define MMU2_SERIAL MSERIAL(1) // dummy port #error "MMU2_SERIAL_PORT must be -1 or from 1 to 3. Please update your configuration."
static_assert(false, "MMU2_SERIAL_PORT must be from 1 to " STRINGIFY(NUM_UARTS) ". You can also use -1 if the board supports Native USB.")
#endif #endif
#endif #endif
@@ -125,9 +119,10 @@
#define LCD_SERIAL UsbSerial #define LCD_SERIAL UsbSerial
#elif WITHIN(LCD_SERIAL_PORT, 1, NUM_UARTS) #elif WITHIN(LCD_SERIAL_PORT, 1, NUM_UARTS)
#define LCD_SERIAL MSERIAL(LCD_SERIAL_PORT) #define LCD_SERIAL MSERIAL(LCD_SERIAL_PORT)
#elif NUM_UARTS == 5
#error "LCD_SERIAL_PORT must be -1 or from 1 to 5. Please update your configuration."
#else #else
#define LCD_SERIAL MSERIAL(1) // dummy port #error "LCD_SERIAL_PORT must be -1 or from 1 to 3. Please update your configuration."
static_assert(false, "LCD_SERIAL_PORT must be from 1 to " STRINGIFY(NUM_UARTS) ". You can also use -1 if the board supports Native USB.")
#endif #endif
#if HAS_DGUS_LCD #if HAS_DGUS_LCD
#define SERIAL_GET_TX_BUFFER_FREE() LCD_SERIAL.availableForWrite() #define SERIAL_GET_TX_BUFFER_FREE() LCD_SERIAL.availableForWrite()
@@ -200,7 +195,7 @@ void HAL_clear_reset_source();
// Reset reason // Reset reason
uint8_t HAL_get_reset_source(); uint8_t HAL_get_reset_source();
void HAL_reboot(); inline void HAL_reboot() {} // reboot the board or restart the bootloader
void _delay_ms(const int delay); void _delay_ms(const int delay);
+1 -1
View File
@@ -55,7 +55,7 @@ static void TXBegin() {
nvic_irq_disable(dev->irq_num); nvic_irq_disable(dev->irq_num);
// Use this if removing libmaple // Use this if removing libmaple
//SBI(NVIC_BASE->ICER[1], irq - 32); //NVIC_BASE->ICER[1] |= _BV(irq - 32);
// We NEED memory barriers to ensure Interrupts are actually disabled! // We NEED memory barriers to ensure Interrupts are actually disabled!
// ( https://dzone.com/articles/nvic-disabling-interrupts-on-arm-cortex-m-and-the ) // ( https://dzone.com/articles/nvic-disabling-interrupts-on-arm-cortex-m-and-the )
+3 -3
View File
@@ -123,7 +123,7 @@ uint8_t spiRec() {
* *
* @details Uses DMA * @details Uses DMA
*/ */
void spiRead(uint8_t *buf, uint16_t nbyte) { void spiRead(uint8_t* buf, uint16_t nbyte) {
SPI.dmaTransfer(0, const_cast<uint8_t*>(buf), nbyte); SPI.dmaTransfer(0, const_cast<uint8_t*>(buf), nbyte);
} }
@@ -146,7 +146,7 @@ void spiSend(uint8_t b) {
* *
* @details Use DMA * @details Use DMA
*/ */
void spiSendBlock(uint8_t token, const uint8_t *buf) { void spiSendBlock(uint8_t token, const uint8_t* buf) {
SPI.send(token); SPI.send(token);
SPI.dmaSend(const_cast<uint8_t*>(buf), 512); SPI.dmaSend(const_cast<uint8_t*>(buf), 512);
} }
@@ -160,7 +160,7 @@ uint8_t spiRec(uint32_t chan) { return SPI.transfer(0xFF); }
void spiSend(uint32_t chan, byte b) { SPI.send(b); } void spiSend(uint32_t chan, byte b) { SPI.send(b); }
// Write buffer to specified SPI channel // Write buffer to specified SPI channel
void spiSend(uint32_t chan, const uint8_t *buf, size_t n) { void spiSend(uint32_t chan, const uint8_t* buf, size_t n) {
for (size_t p = 0; p < n; p++) spiSend(chan, buf[p]); for (size_t p = 0; p < n; p++) spiSend(chan, buf[p]);
} }
+1 -10
View File
@@ -60,7 +60,7 @@ static inline __always_inline void my_usart_irq(ring_buffer *rb, ring_buffer *wb
} }
else if (srflags & USART_SR_ORE) { else if (srflags & USART_SR_ORE) {
// overrun and empty data, just do a dummy read to clear ORE // overrun and empty data, just do a dummy read to clear ORE
// and prevent a raise condition where a continuous interrupt stream (due to ORE set) occurs // and prevent a raise condition where a continous interrupt stream (due to ORE set) occurs
// (see chapter "Overrun error" ) in STM32 reference manual // (see chapter "Overrun error" ) in STM32 reference manual
regs->DR; regs->DR;
} }
@@ -167,15 +167,6 @@ constexpr bool IsSerialClassAllowed(const HardwareSerial&) { return false; }
#if AXIS_HAS_HW_SERIAL(Z4) #if AXIS_HAS_HW_SERIAL(Z4)
CHECK_AXIS_SERIAL(Z4); CHECK_AXIS_SERIAL(Z4);
#endif #endif
#if AXIS_HAS_HW_SERIAL(I)
CHECK_AXIS_SERIAL(I);
#endif
#if AXIS_HAS_HW_SERIAL(J)
CHECK_AXIS_SERIAL(J);
#endif
#if AXIS_HAS_HW_SERIAL(K)
CHECK_AXIS_SERIAL(K);
#endif
#if AXIS_HAS_HW_SERIAL(E0) #if AXIS_HAS_HW_SERIAL(E0)
CHECK_AXIS_SERIAL(E0); CHECK_AXIS_SERIAL(E0);
#endif #endif
-1
View File
@@ -11,7 +11,6 @@ if __name__ == "__main__":
"-fsigned-char", "-fsigned-char",
"-fno-move-loop-invariants", "-fno-move-loop-invariants",
"-fno-strict-aliasing", "-fno-strict-aliasing",
"-fsingle-precision-constant",
"--specs=nano.specs", "--specs=nano.specs",
"--specs=nosys.specs", "--specs=nosys.specs",
+6 -3
View File
@@ -19,13 +19,14 @@
* 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 __STM32F1__
/** /**
* PersistentStore for Arduino-style EEPROM interface * PersistentStore for Arduino-style EEPROM interface
* 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)
@@ -47,11 +48,13 @@ bool PersistentStore::access_start() { eeprom_init(); return true; }
bool PersistentStore::access_finish() { return true; } bool PersistentStore::access_finish() { return true; }
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) { bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
uint16_t written = 0; size_t written = 0;
while (size--) { while (size--) {
uint8_t v = *value; uint8_t v = *value;
uint8_t * const p = (uint8_t * const)pos; uint8_t * const p = (uint8_t * const)pos;
if (v != eeprom_read_byte(p)) { // EEPROM has only ~100,000 write cycles, so only write bytes that have changed! // EEPROM has only ~100,000 write cycles,
// so only write bytes that have changed!
if (v != eeprom_read_byte(p)) {
eeprom_write_byte(p, v); eeprom_write_byte(p, v);
if (++written & 0x7F) delay(2); else safe_delay(2); // Avoid triggering watchdog during long EEPROM writes if (++written & 0x7F) delay(2); else safe_delay(2); // Avoid triggering watchdog during long EEPROM writes
if (eeprom_read_byte(p) != v) { if (eeprom_read_byte(p) != v) {
+2 -2
View File
@@ -48,8 +48,8 @@ static uint8_t ram_eeprom[MARLIN_EEPROM_SIZE] __attribute__((aligned(4))) = {0};
static bool eeprom_dirty = false; static bool eeprom_dirty = false;
bool PersistentStore::access_start() { bool PersistentStore::access_start() {
const uint32_t *source = reinterpret_cast<const uint32_t*>(EEPROM_PAGE0_BASE); const uint32_t* source = reinterpret_cast<const uint32_t*>(EEPROM_PAGE0_BASE);
uint32_t *destination = reinterpret_cast<uint32_t*>(ram_eeprom); uint32_t* destination = reinterpret_cast<uint32_t*>(ram_eeprom);
static_assert(0 == (MARLIN_EEPROM_SIZE) % 4, "MARLIN_EEPROM_SIZE is corrupted. (Must be a multiple of 4.)"); // Ensure copying as uint32_t is safe static_assert(0 == (MARLIN_EEPROM_SIZE) % 4, "MARLIN_EEPROM_SIZE is corrupted. (Must be a multiple of 4.)"); // Ensure copying as uint32_t is safe
constexpr size_t eeprom_size_u32 = (MARLIN_EEPROM_SIZE) / 4; constexpr size_t eeprom_size_u32 = (MARLIN_EEPROM_SIZE) / 4;
+3 -3
View File
@@ -52,13 +52,13 @@ bool PersistentStore::access_start() {
} }
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) { bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
uint16_t written = 0;
while (size--) { while (size--) {
uint8_t * const p = (uint8_t * const)pos; uint8_t * const p = (uint8_t * const)pos;
uint8_t v = *value; uint8_t v = *value;
if (v != eeprom_read_byte(p)) { // EEPROM has only ~100,000 write cycles, so only write bytes that have changed! // EEPROM has only ~100,000 write cycles,
// so only write bytes that have changed!
if (v != eeprom_read_byte(p)) {
eeprom_write_byte(p, v); eeprom_write_byte(p, v);
if (++written & 0x7F) delay(2); else safe_delay(2); // Avoid triggering watchdog during long EEPROM writes
if (eeprom_read_byte(p) != v) { if (eeprom_read_byte(p) != v) {
SERIAL_ECHO_MSG(STR_ERR_EEPROM_WRITE); SERIAL_ECHO_MSG(STR_ERR_EEPROM_WRITE);
return true; return true;
@@ -71,10 +71,4 @@ void setup_endstop_interrupts() {
TERN_(HAS_Z4_MAX, _ATTACH(Z4_MAX_PIN)); TERN_(HAS_Z4_MAX, _ATTACH(Z4_MAX_PIN));
TERN_(HAS_Z4_MIN, _ATTACH(Z4_MIN_PIN)); TERN_(HAS_Z4_MIN, _ATTACH(Z4_MIN_PIN));
TERN_(HAS_Z_MIN_PROBE_PIN, _ATTACH(Z_MIN_PROBE_PIN)); TERN_(HAS_Z_MIN_PROBE_PIN, _ATTACH(Z_MIN_PROBE_PIN));
TERN_(HAS_I_MAX, _ATTACH(I_MAX_PIN));
TERN_(HAS_I_MIN, _ATTACH(I_MIN_PIN));
TERN_(HAS_J_MAX, _ATTACH(J_MAX_PIN));
TERN_(HAS_J_MIN, _ATTACH(J_MIN_PIN));
TERN_(HAS_K_MAX, _ATTACH(K_MAX_PIN));
TERN_(HAS_K_MIN, _ATTACH(K_MIN_PIN));
} }
+1 -1
View File
@@ -48,7 +48,7 @@ DRESULT disk_read(BYTE pdrv, BYTE* buff, DWORD sector, UINT count);
DRESULT disk_write(BYTE pdrv, const BYTE* buff, DWORD sector, UINT count); DRESULT disk_write(BYTE pdrv, const BYTE* buff, DWORD sector, UINT count);
#endif #endif
#if _DISKIO_IOCTL #if _DISKIO_IOCTL
DRESULT disk_ioctl(BYTE pdrv, BYTE cmd, void *buff); DRESULT disk_ioctl(BYTE pdrv, BYTE cmd, void* buff);
#endif #endif
/* Disk Status Bits (DSTATUS) */ /* Disk Status Bits (DSTATUS) */
+1 -1
View File
@@ -22,7 +22,7 @@
#include "../../../inc/MarlinConfig.h" #include "../../../inc/MarlinConfig.h"
#if HAS_TFT_XPT2046 || HAS_RES_TOUCH_BUTTONS #if HAS_TFT_XPT2046 || HAS_TOUCH_BUTTONS
#include "xpt2046.h" #include "xpt2046.h"
#include <SPI.h> #include <SPI.h>
+4 -4
View File
@@ -25,10 +25,9 @@
* HAL for stm32duino.com based on Libmaple and compatible (STM32F1) * HAL for stm32duino.com based on Libmaple and compatible (STM32F1)
*/ */
#include "../../inc/MarlinConfig.h" #include <stdint.h>
#include "HAL.h"
#include <libmaple/timer.h> #include <libmaple/timer.h>
#include "../../core/boards.h"
// ------------------------ // ------------------------
// Defines // Defines
@@ -38,6 +37,7 @@
* TODO: Check and confirm what timer we will use for each Temps and stepper driving. * TODO: Check and confirm what timer we will use for each Temps and stepper driving.
* We should probable drive temps with PWM. * We should probable drive temps with PWM.
*/ */
#define FORCE_INLINE __attribute__((always_inline)) inline
typedef uint16_t hal_timer_t; typedef uint16_t hal_timer_t;
#define HAL_TIMER_TYPE_MAX 0xFFFF #define HAL_TIMER_TYPE_MAX 0xFFFF
@@ -80,7 +80,7 @@ typedef uint16_t hal_timer_t;
//#define TEMP_TIMER_NUM 4 // 2->4, Timer 2 for Stepper Current PWM //#define TEMP_TIMER_NUM 4 // 2->4, Timer 2 for Stepper Current PWM
#endif #endif
#if MB(BTT_SKR_MINI_E3_V1_0, BTT_SKR_E3_DIP, BTT_SKR_MINI_E3_V1_2, MKS_ROBIN_LITE, MKS_ROBIN_E3D, MKS_ROBIN_E3) #if MB(BTT_SKR_MINI_E3_V1_0, BTT_SKR_E3_DIP, BTT_SKR_MINI_E3_V1_2, MKS_ROBIN_LITE)
// SKR Mini E3 boards use PA8 as FAN_PIN, so TIMER 1 is used for Fan PWM. // SKR Mini E3 boards use PA8 as FAN_PIN, so TIMER 1 is used for Fan PWM.
#ifdef STM32_HIGH_DENSITY #ifdef STM32_HIGH_DENSITY
#define SERVO0_TIMER_NUM 8 // tone.cpp uses Timer 4 #define SERVO0_TIMER_NUM 8 // tone.cpp uses Timer 4
-4
View File
@@ -35,8 +35,6 @@
#define IMPLEMENT_SERIAL(X) _IMPLEMENT_SERIAL(X) #define IMPLEMENT_SERIAL(X) _IMPLEMENT_SERIAL(X)
#if WITHIN(SERIAL_PORT, 0, 3) #if WITHIN(SERIAL_PORT, 0, 3)
IMPLEMENT_SERIAL(SERIAL_PORT); IMPLEMENT_SERIAL(SERIAL_PORT);
#else
#error "SERIAL_PORT must be from 0 to 3."
#endif #endif
USBSerialType USBSerial(false, SerialUSB); USBSerialType USBSerial(false, SerialUSB);
@@ -78,8 +76,6 @@ uint8_t HAL_get_reset_source() {
return 0; return 0;
} }
void HAL_reboot() { _reboot_Teensyduino_(); }
extern "C" { extern "C" {
extern char __bss_end; extern char __bss_end;
extern char __heap_start; extern char __heap_start;
+2 -3
View File
@@ -34,6 +34,7 @@
#include "fastio.h" #include "fastio.h"
#include "watchdog.h" #include "watchdog.h"
#include <stdint.h> #include <stdint.h>
#define ST7920_DELAY_1 DELAY_NS(600) #define ST7920_DELAY_1 DELAY_NS(600)
@@ -68,8 +69,6 @@ extern USBSerialType USBSerial;
#elif WITHIN(SERIAL_PORT, 0, 3) #elif WITHIN(SERIAL_PORT, 0, 3)
DECLARE_SERIAL(SERIAL_PORT); DECLARE_SERIAL(SERIAL_PORT);
#define MYSERIAL1 MSERIAL(SERIAL_PORT) #define MYSERIAL1 MSERIAL(SERIAL_PORT)
#else
#error "The required SERIAL_PORT must be from 0 to 3, or -1 for Native USB."
#endif #endif
#define HAL_SERVO_LIB libServo #define HAL_SERVO_LIB libServo
@@ -94,7 +93,7 @@ void HAL_clear_reset_source();
// Get the reason for the reset // Get the reason for the reset
uint8_t HAL_get_reset_source(); uint8_t HAL_get_reset_source();
void HAL_reboot(); inline void HAL_reboot() {} // reboot the board or restart the bootloader
FORCE_INLINE void _delay_ms(const int delay_ms) { delay(delay_ms); } FORCE_INLINE void _delay_ms(const int delay_ms) { delay(delay_ms); }
+3 -4
View File
@@ -21,12 +21,11 @@
*/ */
#ifdef __MK20DX256__ #ifdef __MK20DX256__
#include "../../inc/MarlinConfig.h"
#include "HAL.h" #include "HAL.h"
#include <SPI.h> #include <SPI.h>
#include <pins_arduino.h> #include <pins_arduino.h>
#include "spi_pins.h" #include "spi_pins.h"
#include "../../core/macros.h"
static SPISettings spiConfig; static SPISettings spiConfig;
@@ -83,7 +82,7 @@ uint8_t spiRec() {
} }
// SPI read data // SPI read data
void spiRead(uint8_t *buf, uint16_t nbyte) { void spiRead(uint8_t* buf, uint16_t nbyte) {
SPI.beginTransaction(spiConfig); SPI.beginTransaction(spiConfig);
SPI.transfer(buf, nbyte); SPI.transfer(buf, nbyte);
SPI.endTransaction(); SPI.endTransaction();
@@ -108,7 +107,7 @@ void spiSend(uint8_t b) {
} }
// SPI send block // SPI send block
void spiSendBlock(uint8_t token, const uint8_t *buf) { void spiSendBlock(uint8_t token, const uint8_t* buf) {
SPI.beginTransaction(spiConfig); SPI.beginTransaction(spiConfig);
SPDR = token; SPDR = token;
for (uint16_t i = 0; i < 512; i += 2) { for (uint16_t i = 0; i < 512; i += 2) {
+7 -7
View File
@@ -18,14 +18,14 @@
*/ */
#ifdef __MK20DX256__ #ifdef __MK20DX256__
/**
* HAL PersistentStore for Teensy 3.2 (MK20DX256)
*/
#include "../../inc/MarlinConfig.h" #include "../../inc/MarlinConfig.h"
#if USE_WIRED_EEPROM #if USE_WIRED_EEPROM
/**
* HAL PersistentStore for Teensy 3.2 (MK20DX256)
*/
#include "../shared/eeprom_api.h" #include "../shared/eeprom_api.h"
#include <avr/eeprom.h> #include <avr/eeprom.h>
@@ -38,13 +38,13 @@ bool PersistentStore::access_start() { return true; }
bool PersistentStore::access_finish() { return true; } bool PersistentStore::access_finish() { return true; }
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) { bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
uint16_t written = 0;
while (size--) { while (size--) {
uint8_t * const p = (uint8_t * const)pos; uint8_t * const p = (uint8_t * const)pos;
uint8_t v = *value; uint8_t v = *value;
if (v != eeprom_read_byte(p)) { // EEPROM has only ~100,000 write cycles, so only write bytes that have changed! // EEPROM has only ~100,000 write cycles,
// so only write bytes that have changed!
if (v != eeprom_read_byte(p)) {
eeprom_write_byte(p, v); eeprom_write_byte(p, v);
if (++written & 0x7F) delay(2); else safe_delay(2); // Avoid triggering watchdog during long EEPROM writes
if (eeprom_read_byte(p) != v) { if (eeprom_read_byte(p) != v) {
SERIAL_ECHO_MSG(STR_ERR_EEPROM_WRITE); SERIAL_ECHO_MSG(STR_ERR_EEPROM_WRITE);
return true; return true;

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