Bump to head
This commit is contained in:
@@ -54,10 +54,9 @@ jobs:
|
||||
generate_version ./Marlin/src/inc
|
||||
cat ./Marlin/src/inc/_Version.h
|
||||
#
|
||||
# Backup pins_RAMPS.h
|
||||
#
|
||||
cp Marlin/src/pins/pins_RAMPS.h Marlin/src/pins/pins_RAMPS.h.backup
|
||||
# Back up pins_RAMPS.h
|
||||
#
|
||||
backup_ramps
|
||||
|
||||
env_backup
|
||||
|
||||
@@ -243,12 +242,12 @@ jobs:
|
||||
echo testing STM32F1 targets...
|
||||
export TEST_PLATFORM="-e STM32F1"
|
||||
restore_configs
|
||||
echo use_example_configs STM32F10
|
||||
use_example_configs STM32F10
|
||||
echo use_example_configs STM32/STM32F10
|
||||
use_example_configs STM32/STM32F10
|
||||
build_marlin_pio ./ ${TEST_PLATFORM}
|
||||
restore_configs
|
||||
echo use_example_configs stm32f103ret6
|
||||
use_example_configs stm32f103ret6
|
||||
echo use_example_configs STM32/stm32f103ret6
|
||||
use_example_configs STM32/stm32f103ret6
|
||||
build_marlin_pio ./ ${TEST_PLATFORM}
|
||||
restore_configs
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
custom: http://www.thinkyhead.com/donate-to-marlin
|
||||
@@ -1,8 +1,8 @@
|
||||
<!--
|
||||
|
||||
Have you read Marlin's Code of Conduct? By filing an Issue, you are expected to comply with it, including treating everyone with respect: https://github.com/MarlinFirmware/Marlin/blob/master/.github/code_of_conduct.md
|
||||
Have you read Marlin's Code of Conduct? By filing an Issue, you are expected to comply with it, including treating everyone with respect: https://github.com/MarlinFirmware/Marlin/blob/bugfix-2.0.x/.github/code_of_conduct.md
|
||||
|
||||
Do you want to ask a question? Are you looking for support? Please don't post here. Instead please use the Marlin Firmware forum at http://forums.reprap.org/list.php?415 or the Marlin Facebook Group https://www.facebook.com/groups/1049718498464482/.
|
||||
Do you want to ask a question? Are you looking for support? Please don't post here. Instead please use the Marlin Firmware forum at http://forums.reprap.org/list.php?415 or the Marlin Facebook Group https://www.facebook.com/groups/1049718498464482/ or the Marlin Discord Server https://discord.gg/n5NJ59y.
|
||||
|
||||
Before filing an issue be sure to test the 1.1 and/or 2.0 "bugfix" branches to see whether the issue is already addressed.
|
||||
|
||||
|
||||
+12
-2
@@ -1,9 +1,9 @@
|
||||
#
|
||||
# Marlin 3D Printer Firmware
|
||||
# Copyright (C) 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
# Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
#
|
||||
# Based on Sprinter and grbl.
|
||||
# Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
# 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
|
||||
@@ -171,3 +171,13 @@ CMakeListsPrivate.txt
|
||||
|
||||
#CLion
|
||||
cmake-build-*
|
||||
|
||||
#Eclipse
|
||||
.project
|
||||
.cproject
|
||||
.pydevproject
|
||||
.settings
|
||||
.classpath
|
||||
|
||||
#Python
|
||||
__pycache__
|
||||
|
||||
+7
-18
@@ -1,39 +1,28 @@
|
||||
dist: xenial
|
||||
sudo: require
|
||||
dist: bionic
|
||||
sudo: false
|
||||
|
||||
language: python
|
||||
python:
|
||||
- "2.7"
|
||||
- "3.7"
|
||||
|
||||
notifications:
|
||||
email: false
|
||||
|
||||
# Cache PlatformIO packages using Travis CI container-based infrastructure
|
||||
sudo: false
|
||||
cache:
|
||||
pip: true
|
||||
directories:
|
||||
- "~/.platformio"
|
||||
|
||||
env:
|
||||
- TEST_PLATFORM="megaatmega2560"
|
||||
- TEST_PLATFORM="DUE"
|
||||
- TEST_PLATFORM="LPC1768"
|
||||
- TEST_PLATFORM="LPC1769"
|
||||
- TEST_PLATFORM="STM32F1"
|
||||
- TEST_PLATFORM="teensy31"
|
||||
- TEST_PLATFORM="teensy35"
|
||||
- TEST_PLATFORM="linux_native"
|
||||
- TEST_PLATFORM="esp32"
|
||||
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- g++-7
|
||||
- TEST_PLATFORM="alfawise_U20"
|
||||
- TEST_PLATFORM="black_stm32f407ve"
|
||||
- TEST_PLATFORM="adafruit_grandcentral_m4"
|
||||
|
||||
before_install:
|
||||
- sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-7 90
|
||||
#
|
||||
# Fetch the tag information for the current branch
|
||||
- git fetch origin --tags
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Copyright (c) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
@@ -634,7 +634,7 @@ state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
{one line to give the program's name and a brief idea of what it does.}
|
||||
Copyright (C) {year} {name of author}
|
||||
Copyright (c) {year} {name of author}
|
||||
|
||||
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
|
||||
@@ -654,7 +654,7 @@ Also add information on how to contact you by electronic and paper mail.
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
{project} Copyright (C) {year} {fullname}
|
||||
{project} Copyright (c) {year} {fullname}
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
+24
-16
@@ -4,25 +4,25 @@
|
||||
// CUSTOMIZE FOR YOUR MACHINE BELOW
|
||||
// CUSTOMIZE FOR YOUR MACHINE BELOW
|
||||
|
||||
// Enable this is you have a raptor 2.
|
||||
// Enable this is you have a raptor 2.
|
||||
// Selects pin file, runout sensor and stock TMC Drivers automatically
|
||||
//#define RAPTOR2
|
||||
#define RAPTOR2
|
||||
|
||||
/**
|
||||
* Enable if you replace the stepper drivers with TMC 2208. Be sure to remove MS3 jumper
|
||||
* Enable if you replace the stepper drivers with TMC 2208. Be sure to remove MS3 jumper
|
||||
* underneath the stepper driver! Plug and Play will result in Stealth Chop 2 Mode enabled
|
||||
* Stealthchop with 2208 on E will disabe Linear Advance! Please enable stealthchop if
|
||||
* you require Linear Advance with a TMC2208 on the extruder!
|
||||
* If you have used a UART connection to program the driver to SpreadCycle mode, pease seect that as well
|
||||
*/
|
||||
#define X_2208
|
||||
//#define X_2208
|
||||
//#define X_SpreadCycle
|
||||
#define Y_2208
|
||||
#define Y_SpreadCycle // Highly recommended as large prints with high mass can cause layer shifts with stealthchop at high speed
|
||||
//#define Y_2208
|
||||
//#define Y_SpreadCycle // Highly recommended as large prints with high mass can cause layer shifts with stealthchop at high speed
|
||||
//#define Y_4988 // Some machines shipped with 4988 drivers across the board. Set this if you arent sure what you have and all the drivers look identical
|
||||
//#define Z_2208 // NOT Recommended! Dual stepper current draw is above the recommended limit for this driver
|
||||
//#define Z_SpreadCycle
|
||||
#define Z_4988 // Some machines shipped with 4988 drivers across the board. Set this if you arent sure what you have and all the drivers look identical
|
||||
//#define Z_4988 // Some machines shipped with 4988 drivers across the board. Set this if you arent sure what you have and all the drivers look identical
|
||||
//#define E_2208 // Not Recommended! Stealthchop mode faults with linear advance
|
||||
//#define E_SpreadCycle
|
||||
|
||||
@@ -423,6 +423,7 @@
|
||||
* -1 : thermocouple with AD595
|
||||
* 0 : not used
|
||||
* 1 : 100k thermistor - best choice for EPCOS 100k (4.7k pullup)
|
||||
* 331 : (3.3V scaled thermistor 1 table)
|
||||
* 2 : 200k thermistor - ATC Semitec 204GT-2 (4.7k pullup)
|
||||
* 3 : Mendel-parts thermistor (4.7k pullup)
|
||||
* 4 : 10k thermistor !! do not use it for a hotend. It gives bad resolution at high temp. !!
|
||||
@@ -440,7 +441,8 @@
|
||||
* 13 : 100k Hisens 3950 1% up to 300°C for hotend "Simple ONE " & "Hotend "All In ONE"
|
||||
* 15 : 100k thermistor calibration for JGAurora A5 hotend
|
||||
* 18 : ATC Semitec 204GT-2 (4.7k pullup) Dagoma.Fr - MKS_Base_DKU001327
|
||||
* 20 : the PT100 circuit found in the Ultimainboard V2.x
|
||||
* 20 : Pt100 with circuit in the Ultimainboard V2.x
|
||||
* 201 : Pt100 with circuit in Overlord, similar to Ultimainboard V2.x
|
||||
* 60 : 100k Maker's Tool Works Kapton Bed Thermistor beta=3950
|
||||
* 61 : 100k Formbot / Vivedino 3950 350C thermistor 4.7k pullup
|
||||
* 66 : 4.7M High Temperature thermistor from Dyze Design
|
||||
@@ -465,7 +467,7 @@
|
||||
* 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.
|
||||
*
|
||||
* :{ '0':"Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '512':"100k RPW-Ultra hotend thermistor", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '18':"ATC Semitec 204GT-2 (4.7k pullup) Dagoma.Fr - MKS_Base_DKU001327" '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '61':"100k Formbot / Vivedino 3950 350C thermistor 4.7k pullup", '66':"Dyze Design 4.7M High Temperature thermistor", '67':"Slice Engineering 450C High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595", '998':"Dummy 1", '999':"Dummy 2", '1000':"Custom thermistor params" }
|
||||
* :{ '0':"Not used", '1':"100k / 4.7k - EPCOS", '331':"(3.3V thermistor 1)", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '512':"100k RPW-Ultra hotend thermistor", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '18':"ATC Semitec 204GT-2 (4.7k pullup) Dagoma.Fr - MKS_Base_DKU001327" '20':"Pt100 (Ultimainboard V2.x)", '201':"Pt100 (Overlord)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '61':"100k Formbot / Vivedino 3950 350C thermistor 4.7k pullup", '66':"Dyze Design 4.7M High Temperature thermistor", '67':"Slice Engineering 450C High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595", '998':"Dummy 1", '999':"Dummy 2", '1000':"Custom thermistor params" }
|
||||
*/
|
||||
#if ENABLED(RAPTOR2)
|
||||
#define TEMP_SENSOR_0 61
|
||||
@@ -844,7 +846,7 @@
|
||||
* Override with M203
|
||||
* X, Y, Z, E0 [, E1[, E2[, E3[, E4[, E5]]]]]
|
||||
*/
|
||||
#define DEFAULT_MAX_FEEDRATE { 250, 120, 5, 25 }
|
||||
#define DEFAULT_MAX_FEEDRATE { 250, 120, 5, 70 }
|
||||
|
||||
/**
|
||||
* Default Max Acceleration (change/s) change = mm/s
|
||||
@@ -1358,8 +1360,8 @@
|
||||
// For Cartesian machines, instead of dividing moves on mesh boundaries,
|
||||
// split up moves into short segments like a Delta. This follows the
|
||||
// contours of the bed more closely than edge-to-edge straight moves.
|
||||
#define SEGMENT_LEVELED_MOVES
|
||||
#define LEVELED_SEGMENT_LENGTH 5.0 // (mm) Length of all segments (except the last one)
|
||||
//#define SEGMENT_LEVELED_MOVES
|
||||
//#define LEVELED_SEGMENT_LENGTH 5.0 // (mm) Length of all segments (except the last one)
|
||||
|
||||
/**
|
||||
* Enable the G26 Mesh Validation Pattern tool.
|
||||
@@ -1479,7 +1481,7 @@
|
||||
* Commands to execute at the end of G29 probing.
|
||||
* Useful to retract or move the Z probe out of the way.
|
||||
*/
|
||||
#define Z_PROBE_END_SCRIPT "M280 P0 S90"
|
||||
//#define Z_PROBE_END_SCRIPT "M280 P0 S90"
|
||||
|
||||
|
||||
// @section homing
|
||||
@@ -1760,10 +1762,10 @@
|
||||
*
|
||||
* Select the language to display on the LCD. These languages are available:
|
||||
*
|
||||
* en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it,
|
||||
* jp-kana, ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, zh_CN, zh_TW, test
|
||||
* en, an, bg, ca, cz, da, de, el, el-gr, es, eu, fi, fr, gl, hr, it, jp-kana,
|
||||
* ko_KR, nl, pl, pt, pt-br, ru, sk, tr, uk, vi, zh_CN, zh_TW, test
|
||||
*
|
||||
* :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' }
|
||||
* :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el-gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'it':'Italian', 'jp-kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt-br':'Portuguese (Brazilian)', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'vi':'Vietnamese', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' }
|
||||
*/
|
||||
#define LCD_LANGUAGE en
|
||||
|
||||
@@ -2214,6 +2216,12 @@
|
||||
//
|
||||
//#define MALYAN_LCD
|
||||
|
||||
//
|
||||
// LulzBot Color Touch UI for FTDI EVE (FT800/FT810) displays
|
||||
// See Configuration_adv.h for all configuration options.
|
||||
//
|
||||
//#define LULZBOT_TOUCH_UI
|
||||
|
||||
//
|
||||
// Third-party or vendor-customized controller interfaces.
|
||||
// Sources should be installed in 'src/lcd/extensible_ui'.
|
||||
|
||||
+144
-49
@@ -279,9 +279,10 @@
|
||||
*/
|
||||
//#define USE_CONTROLLER_FAN
|
||||
#if ENABLED(USE_CONTROLLER_FAN)
|
||||
//#define CONTROLLER_FAN_PIN -1 // Set a custom pin for the controller fan
|
||||
#define CONTROLLERFAN_SECS 60 // Duration in seconds for the fan to run after all motors are disabled
|
||||
#define CONTROLLERFAN_SPEED 255 // 255 == full speed
|
||||
//#define CONTROLLER_FAN_PIN -1 // Set a custom pin for the controller fan
|
||||
#define CONTROLLERFAN_SECS 60 // Duration in seconds for the fan to run after all motors are disabled
|
||||
#define CONTROLLERFAN_SPEED 255 // 255 == full speed
|
||||
//#define CONTROLLERFAN_SPEED_Z_ONLY 127 // Reduce noise on machines that keep Z enabled
|
||||
#endif
|
||||
|
||||
// When first starting the main fan, run it at full speed for the
|
||||
@@ -661,10 +662,10 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// @section extras
|
||||
// @section motion
|
||||
|
||||
// minimum time in microseconds that a movement needs to take if the buffer is emptied.
|
||||
#define DEFAULT_MINSEGMENTTIME 20000
|
||||
// Minimum time that a segment needs to take if the buffer is emptied
|
||||
#define DEFAULT_MINSEGMENTTIME 20000 // (ms)
|
||||
|
||||
// If defined the movements slow down when the look ahead buffer is only half full
|
||||
#define SLOWDOWN
|
||||
@@ -854,11 +855,35 @@
|
||||
#define FEEDRATE_CHANGE_BEEP_FREQUENCY 440
|
||||
#endif
|
||||
|
||||
// Include a page of printer information in the LCD Main Menu
|
||||
#define LCD_INFO_MENU
|
||||
#if ENABLED(LCD_INFO_MENU)
|
||||
//#define LCD_PRINTER_INFO_IS_BOOTSCREEN // Show bootscreen(s) instead of Printer Info pages
|
||||
#endif
|
||||
#if HAS_LCD_MENU
|
||||
|
||||
// Include a page of printer information in the LCD Main Menu
|
||||
//#define LCD_INFO_MENU
|
||||
#if ENABLED(LCD_INFO_MENU)
|
||||
//#define LCD_PRINTER_INFO_IS_BOOTSCREEN // Show bootscreen(s) instead of Printer Info pages
|
||||
#endif
|
||||
|
||||
// BACK menu items keep the highlight at the top
|
||||
//#define TURBO_BACK_MENU_ITEM
|
||||
|
||||
/**
|
||||
* LED Control Menu
|
||||
* Add LED Control to the LCD menu
|
||||
*/
|
||||
//#define LED_CONTROL_MENU
|
||||
#if ENABLED(LED_CONTROL_MENU)
|
||||
#define LED_COLOR_PRESETS // Enable the Preset Color menu option
|
||||
#if ENABLED(LED_COLOR_PRESETS)
|
||||
#define LED_USER_PRESET_RED 255 // User defined RED value
|
||||
#define LED_USER_PRESET_GREEN 128 // User defined GREEN value
|
||||
#define LED_USER_PRESET_BLUE 0 // User defined BLUE value
|
||||
#define LED_USER_PRESET_WHITE 255 // User defined WHITE value
|
||||
#define LED_USER_PRESET_BRIGHTNESS 255 // User defined intensity
|
||||
//#define LED_USER_PRESET_STARTUP // Have the printer display the user preset color on startup
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif // HAS_LCD_MENU
|
||||
|
||||
// Scroll a longer status message into view
|
||||
#define STATUS_MESSAGE_SCROLLING
|
||||
@@ -883,23 +908,6 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
* LED Control Menu
|
||||
* Enable this feature to add LED Control to the LCD menu
|
||||
*/
|
||||
//#define LED_CONTROL_MENU
|
||||
#if ENABLED(LED_CONTROL_MENU)
|
||||
#define LED_COLOR_PRESETS // Enable the Preset Color menu option
|
||||
#if ENABLED(LED_COLOR_PRESETS)
|
||||
#define LED_USER_PRESET_RED 255 // User defined RED value
|
||||
#define LED_USER_PRESET_GREEN 128 // User defined GREEN value
|
||||
#define LED_USER_PRESET_BLUE 0 // User defined BLUE value
|
||||
#define LED_USER_PRESET_WHITE 255 // User defined WHITE value
|
||||
#define LED_USER_PRESET_BRIGHTNESS 255 // User defined intensity
|
||||
//#define LED_USER_PRESET_STARTUP // Have the printer display the user preset color on startup
|
||||
#endif
|
||||
#endif // LED_CONTROL_MENU
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
|
||||
// Some RAMPS and other boards don't detect when an SD card is inserted. You can work
|
||||
@@ -934,6 +942,7 @@
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
//#define POWER_LOSS_PIN 44 // Pin to detect power loss
|
||||
//#define POWER_LOSS_STATE HIGH // State of pin indicating power loss
|
||||
//#define POWER_LOSS_PULL // Set pullup / pulldown as appropriate
|
||||
//#define POWER_LOSS_PURGE_LEN 20 // (mm) Length of filament to purge on resume
|
||||
//#define POWER_LOSS_RETRACT_LEN 10 // (mm) Length of filament to retract on fail. Requires backup power.
|
||||
|
||||
@@ -1013,17 +1022,31 @@
|
||||
* equivalent MAX3421E breakout board. The USB thumb drive will appear
|
||||
* to Marlin as an SD card.
|
||||
*
|
||||
* The MAX3421E must be assigned the same pins as the SD card reader, with
|
||||
* The MAX3421E can be assigned the same pins as the SD card reader, with
|
||||
* the following pin mapping:
|
||||
*
|
||||
* SCLK, MOSI, MISO --> SCLK, MOSI, MISO
|
||||
* INT --> SD_DETECT_PIN
|
||||
* INT --> SD_DETECT_PIN [1]
|
||||
* SS --> SDSS
|
||||
*
|
||||
* [1] On AVR an interrupt-capable pin is best for UHS3 compatibility.
|
||||
*/
|
||||
//#define USB_FLASH_DRIVE_SUPPORT
|
||||
#if ENABLED(USB_FLASH_DRIVE_SUPPORT)
|
||||
#define USB_CS_PIN SDSS
|
||||
#define USB_INTR_PIN SD_DETECT_PIN
|
||||
#define USB_CS_PIN SDSS
|
||||
#define USB_INTR_PIN SD_DETECT_PIN
|
||||
|
||||
/**
|
||||
* USB Host Shield Library
|
||||
*
|
||||
* - UHS2 uses no interrupts and has been production-tested
|
||||
* on a LulzBot TAZ Pro with a 32-bit Archim board.
|
||||
*
|
||||
* - UHS3 is newer code with better USB compatibility. But it
|
||||
* is less tested and is known to interfere with Servos.
|
||||
* [1] This requires USB_INTR_PIN to be interrupt-capable.
|
||||
*/
|
||||
//#define USE_UHS3_USB
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -1138,6 +1161,7 @@
|
||||
//#define STATUS_FAN_FRAMES 3 // :[0,1,2,3,4] Number of fan animation frames
|
||||
//#define STATUS_HEAT_PERCENT // Show heating in a progress bar
|
||||
#define BOOT_MARLIN_LOGO_SMALL // Show a smaller Marlin logo on the Boot Screen (saving 399 bytes of flash)
|
||||
//#define BOOT_MARLIN_LOGO_ANIMATED // Animated Marlin logo. Costs ~3260 (or ~940) bytes of PROGMEM.
|
||||
|
||||
// Frivolous Game Options
|
||||
//#define MARLIN_BRICKOUT
|
||||
@@ -1147,6 +1171,53 @@
|
||||
|
||||
#endif // HAS_GRAPHICAL_LCD
|
||||
|
||||
//
|
||||
// Lulzbot Touch UI
|
||||
//
|
||||
#if ENABLED(LULZBOT_TOUCH_UI)
|
||||
// Display board used
|
||||
//#define LCD_FTDI_VM800B35A // FTDI 3.5" with FT800 (320x240)
|
||||
//#define LCD_4DSYSTEMS_4DLCD_FT843 // 4D Systems 4.3" (480x272)
|
||||
//#define LCD_HAOYU_FT800CB // Haoyu with 4.3" or 5" (480x272)
|
||||
//#define LCD_HAOYU_FT810CB // Haoyu with 5" (800x480)
|
||||
//#define LCD_ALEPHOBJECTS_CLCD_UI // Aleph Objects Color LCD UI
|
||||
|
||||
// Correct the resolution if not using the stock TFT panel.
|
||||
//#define TOUCH_UI_320x240
|
||||
//#define TOUCH_UI_480x272
|
||||
//#define TOUCH_UI_800x480
|
||||
|
||||
// Mappings for boards with a standard RepRapDiscount Display connector
|
||||
//#define AO_EXP1_PINMAP // AlephObjects CLCD UI EXP1 mapping
|
||||
//#define AO_EXP2_PINMAP // AlephObjects CLCD UI EXP2 mapping
|
||||
//#define CR10_TFT_PINMAP // Rudolph Riedel's CR10 pin mapping
|
||||
//#define OTHER_PIN_LAYOUT // Define pins manually below
|
||||
#if ENABLED(OTHER_PIN_LAYOUT)
|
||||
// The pins for CS and MOD_RESET (PD) must be chosen.
|
||||
#define CLCD_MOD_RESET 9
|
||||
#define CLCD_SPI_CS 10
|
||||
|
||||
// If using software SPI, specify pins for SCLK, MOSI, MISO
|
||||
//#define CLCD_USE_SOFT_SPI
|
||||
#if ENABLED(CLCD_USE_SOFT_SPI)
|
||||
#define CLCD_SOFT_SPI_MOSI 11
|
||||
#define CLCD_SOFT_SPI_MISO 12
|
||||
#define CLCD_SOFT_SPI_SCLK 13
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Display Orientation. An inverted (i.e. upside-down) display
|
||||
// is supported on the FT800. The FT810 and beyond also support
|
||||
// portrait and mirrored orientations.
|
||||
//#define TOUCH_UI_INVERTED
|
||||
//#define TOUCH_UI_PORTRAIT
|
||||
//#define TOUCH_UI_MIRRORED
|
||||
|
||||
// Use a numeric passcode for "Screen lock" keypad.
|
||||
// (recommended for smaller displays)
|
||||
//#define TOUCH_UI_PASSCODE
|
||||
#endif
|
||||
|
||||
// @section safety
|
||||
|
||||
/**
|
||||
@@ -1857,17 +1928,25 @@
|
||||
#define E5_HYBRID_THRESHOLD 30
|
||||
|
||||
/**
|
||||
* Use StallGuard2 to home / probe X, Y, Z.
|
||||
*
|
||||
* TMC2130, TMC2160, TMC2209, TMC2660, TMC5130, and TMC5160 only
|
||||
* Use StallGuard2 to sense an obstacle and trigger an endstop.
|
||||
* Connect the stepper driver's DIAG1 pin to the X/Y endstop pin.
|
||||
* X, Y, and Z homing will always be done in spreadCycle mode.
|
||||
*
|
||||
* X/Y/Z_STALL_SENSITIVITY is used for tuning the trigger sensitivity.
|
||||
* Higher values make the system LESS sensitive.
|
||||
* Lower value make the system MORE sensitive.
|
||||
* Too low values can lead to false positives, while too high values will collide the axis without triggering.
|
||||
* It is advised to set X/Y/Z_HOME_BUMP_MM to 0.
|
||||
* M914 X/Y/Z to live tune the setting
|
||||
* X/Y/Z_STALL_SENSITIVITY is used to tune the trigger sensitivity.
|
||||
* Use M914 X Y Z to live-adjust the sensitivity.
|
||||
* Higher: LESS sensitive. (Too high => failure to trigger)
|
||||
* Lower: MORE sensitive. (Too low => false positives)
|
||||
*
|
||||
* It is recommended to set [XYZ]_HOME_BUMP_MM to 0.
|
||||
*
|
||||
* SPI_ENDSTOPS *** Beta feature! *** TMC2130 Only ***
|
||||
* Poll the driver through SPI to determine load when homing.
|
||||
* Removes the need for a wire from DIAG1 to an endstop pin.
|
||||
*
|
||||
* IMPROVE_HOMING_RELIABILITY tunes acceleration and jerk when
|
||||
* homing and adds a guard period for endstop triggering.
|
||||
*/
|
||||
//#define SENSORLESS_HOMING // StallGuard capable drivers only
|
||||
|
||||
@@ -1884,6 +1963,8 @@
|
||||
#define X_STALL_SENSITIVITY 8
|
||||
#define Y_STALL_SENSITIVITY 8
|
||||
//#define Z_STALL_SENSITIVITY 8
|
||||
//#define SPI_ENDSTOPS // TMC2130 only
|
||||
//#define IMPROVE_HOMING_RELIABILITY
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -2240,6 +2321,13 @@
|
||||
*/
|
||||
#define EXTENDED_CAPABILITIES_REPORT
|
||||
|
||||
/**
|
||||
* Expected Printer Check
|
||||
* Add the M16 G-code to compare a string to the MACHINE_NAME.
|
||||
* M16 with a non-matching string causes the printer to halt.
|
||||
*/
|
||||
//#define EXPECTED_PRINTER_CHECK
|
||||
|
||||
/**
|
||||
* Disable all Volumetric extrusion options
|
||||
*/
|
||||
@@ -2294,6 +2382,13 @@
|
||||
//#define VARIABLE_G0_FEEDRATE // The G0 feedrate is set by F in G0 motion mode
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Startup commands
|
||||
*
|
||||
* Execute certain G-code commands immediately after power-on.
|
||||
*/
|
||||
//#define STARTUP_COMMANDS "M17 Z"
|
||||
|
||||
/**
|
||||
* G-code Macros
|
||||
*
|
||||
@@ -2313,27 +2408,27 @@
|
||||
#define CUSTOM_USER_MENUS
|
||||
#if ENABLED(CUSTOM_USER_MENUS)
|
||||
//#define USER_SCRIPT_DONE "M117 User Script Done"
|
||||
#define CUSTOM_USER_MENU_TITLE "Commissioning"
|
||||
#define CUSTOM_USER_MENU_TITLE "Leveling Tools"
|
||||
#define USER_SCRIPT_AUDIBLE_FEEDBACK
|
||||
#define USER_SCRIPT_RETURN // Return to status screen after a script
|
||||
|
||||
#define USER_DESC_1 "Setup"
|
||||
#if ENABLED(UBL)
|
||||
#define USER_DESC_1 "UBL Commission 1"
|
||||
#define USER_GCODE_1 "M502 \n M500 \n M501 \n M190 S75 \n G28 \n G29 P1 \n G29 S1 \n G29 S0 \n G29 F 10.0 \n G29 A \n M500 \n G28 \n G29 L1 \n M109 S225 \n G1 X150 Y 150 \n G1 Z0 \n M77 \n M117 Set Z Offset"
|
||||
#define USER_GCODE_1 "M190S75\nG28\nG29P1\nG29P3\nM109S215\nG29S1\nG29S0\nG29F0.0\nG29A\nG28\nG1X150Y150F5000\nG1Z0\nM500\nM400\nM117 Set Z Offset"
|
||||
#else
|
||||
#define USER_DESC_1 "BIL Commission"
|
||||
#define USER_GCODE_1 "M502 \n M500 \n M501 \n M190 75 \n M104 S225 \n G28 \n G29 \n M500 \n G28 \n M420 S \n M109 S225 \n G1 X100 Y 100 \n G1 Z0 \n M77 \n M117 Set Z Offset"
|
||||
#define USER_GCODE_1 "M190S75\nG28\nG29\nM400\nM109S215\nG28\nM420S1\nG1X100Y100F5000\nG1Z0\nM500\nM117 Set Z Offset"
|
||||
#endif
|
||||
|
||||
#define USER_DESC_2 "PID Tune"
|
||||
#define USER_GCODE_2 "M106 S128 \n M303 C8 S225 E1 U \n M500 \n M117 PID Tune Done"
|
||||
#define USER_GCODE_2 "G28\nG1X200Y200Z5\nM106S128\nM303C8S215E1U\nM500\nM117 PID Tune Done"
|
||||
|
||||
#define USER_DESC_3 "Prep for Z Adjust"
|
||||
#define USER_GCODE_3 "M190 75 \n M104 235 \n G28 \n G29 L1 \n G1 X150 Y 150 \n G1 Z0"
|
||||
#define USER_GCODE_3 "M190S75\nM104S215\nG28\nG29L1\nG1 X100Y100F5000\nG1Z0"
|
||||
|
||||
#define USER_DESC_4 "Fill Mesh Points"
|
||||
#define USER_GCODE_4 "G29 P3 \n G29 P3 \n G29 P3 \n G29 T "
|
||||
#define USER_DESC_4 "Store Settings"
|
||||
#define USER_GCODE_4 "M500\nM117 Settings Stored"
|
||||
|
||||
#define USER_DESC_5 "Run Mesh Validation"
|
||||
#define USER_DESC_5 "Run Mesh Validation"
|
||||
#define USER_GCODE_5 "G26"
|
||||
#endif
|
||||
|
||||
|
||||
@@ -114,9 +114,12 @@ void HAL_init(void);
|
||||
inline void HAL_clear_reset_source(void) { MCUSR = 0; }
|
||||
inline uint8_t HAL_get_reset_source(void) { return MCUSR; }
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wunused-function"
|
||||
extern "C" {
|
||||
int freeMemory(void);
|
||||
}
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
// timers
|
||||
#define HAL_TIMER_RATE ((F_CPU) / 8) // i.e., 2MHz or 2.5MHz
|
||||
|
||||
@@ -156,12 +156,16 @@ void HAL_init(void);
|
||||
// Utility functions
|
||||
//
|
||||
void _delay_ms(const int delay);
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wunused-function"
|
||||
int freeMemory(void);
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
char *dtostrf (double __val, signed char __width, unsigned char __prec, char *__s);
|
||||
char *dtostrf(double __val, signed char __width, unsigned char __prec, char *__s);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
#include "../../../inc/MarlinConfigPre.h"
|
||||
#include "../../shared/Marduino.h"
|
||||
#include <U8glib.h>
|
||||
|
||||
void u8g_SetPIOutput_DUE(u8g_t *u8g, uint8_t pin_index);
|
||||
void u8g_SetPILevel_DUE(u8g_t *u8g, uint8_t pin_index, uint8_t level);
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
const uint32_t mask = MASK(DIO ## IO ## _PIN); \
|
||||
if (V) port->PIO_SODR = mask; \
|
||||
else port->PIO_CODR = mask; \
|
||||
} while(0)
|
||||
}while(0)
|
||||
|
||||
// Toggle a pin
|
||||
#define _TOGGLE(IO) _WRITE(IO, !READ(IO))
|
||||
|
||||
@@ -112,7 +112,7 @@
|
||||
* \def unused
|
||||
* \brief Marking \a v as a unused parameter or value.
|
||||
*/
|
||||
#define unused(v) do { (void)(v); } while(0)
|
||||
#define unused(v) do { (void)(v); }while(0)
|
||||
|
||||
/**
|
||||
* \def barrier
|
||||
@@ -169,7 +169,7 @@
|
||||
* heuristics and inline the function no matter how big it thinks it
|
||||
* becomes.
|
||||
*/
|
||||
#if defined(__CC_ARM)
|
||||
#ifdef __CC_ARM
|
||||
# define __always_inline __forceinline
|
||||
#elif (defined __GNUC__)
|
||||
#ifdef __always_inline
|
||||
@@ -187,7 +187,7 @@
|
||||
* This annotation instructs the compiler to ignore its inlining
|
||||
* heuristics and not inline the function.
|
||||
*/
|
||||
#if defined(__CC_ARM)
|
||||
#ifdef __CC_ARM
|
||||
# define __no_inline __attribute__((noinline))
|
||||
#elif (defined __GNUC__)
|
||||
# define __no_inline __attribute__((__noinline__))
|
||||
@@ -204,7 +204,7 @@
|
||||
*
|
||||
* \param expr Expression to evaluate and supposed to be nonzero.
|
||||
*/
|
||||
#if defined(_ASSERT_ENABLE_)
|
||||
#ifdef _ASSERT_ENABLE_
|
||||
# if defined(TEST_SUITE_DEFINE_ASSERT_MACRO)
|
||||
// Assert() is defined in unit_test/suite.h
|
||||
# include "unit_test/suite.h"
|
||||
@@ -998,14 +998,14 @@ typedef U8 Byte; //!< 8-bit unsigned integer.
|
||||
#endif // #ifndef __ASSEMBLY__
|
||||
|
||||
|
||||
#if defined(__ICCARM__)
|
||||
#ifdef __ICCARM__
|
||||
#define SHORTENUM __packed
|
||||
#elif defined(__GNUC__)
|
||||
#define SHORTENUM __attribute__((packed))
|
||||
#endif
|
||||
|
||||
/* No operation */
|
||||
#if defined(__ICCARM__)
|
||||
#ifdef __ICCARM__
|
||||
#define nop() __no_operation()
|
||||
#elif defined(__GNUC__)
|
||||
#define nop() (__NOP())
|
||||
|
||||
@@ -92,7 +92,10 @@ uint8_t HAL_get_reset_source(void);
|
||||
|
||||
void _delay_ms(int delay);
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wunused-function"
|
||||
int freeMemory(void);
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
void analogWrite(pin_t pin, int value);
|
||||
|
||||
|
||||
@@ -81,7 +81,10 @@ extern HalSerial usb_serial;
|
||||
inline void HAL_init(void) { }
|
||||
|
||||
// Utility functions
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wunused-function"
|
||||
int freeMemory(void);
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
// SPI: Extended functions which take a channel number (hardware SPI only)
|
||||
/** Write single byte to specified SPI channel */
|
||||
|
||||
@@ -142,10 +142,10 @@ public:
|
||||
void print_bin(uint32_t value, uint8_t num_digits) {
|
||||
uint32_t mask = 1 << (num_digits -1);
|
||||
for (uint8_t i = 0; i < num_digits; i++) {
|
||||
if (!(i % 4) && i) write(' ');
|
||||
if (!(i % 16) && i) write(' ');
|
||||
if (value & mask) write('1');
|
||||
else write('0');
|
||||
if (!(i % 4) && i) write(' ');
|
||||
if (!(i % 16) && i) write(' ');
|
||||
if (value & mask) write('1');
|
||||
else write('0');
|
||||
value <<= 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,7 +111,10 @@ extern "C" volatile uint32_t _millis;
|
||||
//
|
||||
// Utility functions
|
||||
//
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wunused-function"
|
||||
int freeMemory(void);
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
//
|
||||
// SPI: Extended functions taking a channel number (Hardware SPI only)
|
||||
@@ -146,11 +149,6 @@ using FilteredADC = LPC176x::ADC<ADC_LOWPASS_K_VALUE, ADC_MEDIAN_FILTER_SIZE>;
|
||||
#define HAL_READ_ADC() FilteredADC::get_result()
|
||||
#define HAL_ADC_READY() FilteredADC::finished_conversion()
|
||||
|
||||
// A grace period to allow ADC readings to stabilize, preventing false alarms
|
||||
#ifndef THERMAL_PROTECTION_GRACE_PERIOD
|
||||
#define THERMAL_PROTECTION_GRACE_PERIOD 1000
|
||||
#endif
|
||||
|
||||
// Parse a G-code word into a pin index
|
||||
int16_t PARSED_PIN_INDEX(const char code, const int16_t dval);
|
||||
// P0.6 thru P0.9 are for the onboard SD card
|
||||
|
||||
@@ -17,7 +17,7 @@ def print_error(e):
|
||||
print('\nUnable to find destination disk (' + e + ')\n' \
|
||||
'Please select it in platformio.ini using the upload_port keyword ' \
|
||||
'(https://docs.platformio.org/en/latest/projectconf/section_env_upload.html) ' \
|
||||
'or copy the firmware (.pioenvs/' + env.get('PIOENV') + '/firmware.bin) manually to the appropriate disk\n')
|
||||
'or copy the firmware (.pio/build/' + env.get('PIOENV') + '/firmware.bin) manually to the appropriate disk\n')
|
||||
|
||||
try:
|
||||
if current_OS == 'Windows':
|
||||
|
||||
@@ -1,13 +1,37 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef TARGET_LPC1768
|
||||
|
||||
#include "../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if ENABLED(EMERGENCY_PARSER)
|
||||
#include "../../feature/emergency_parser.h"
|
||||
EmergencyParser::State emergency_state;
|
||||
bool CDC_RecvCallback(const char buffer) {
|
||||
emergency_parser.update(emergency_state, buffer);
|
||||
return true;
|
||||
}
|
||||
#endif // ENABLED(EMERGENCY_PARSER)
|
||||
|
||||
#include "../../feature/emergency_parser.h"
|
||||
EmergencyParser::State emergency_state;
|
||||
bool CDC_RecvCallback(const char buffer) {
|
||||
emergency_parser.update(emergency_state, buffer);
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif // EMERGENCY_PARSER
|
||||
#endif // TARGET_LPC1768
|
||||
|
||||
@@ -59,12 +59,12 @@
|
||||
#else
|
||||
#define GET_TEMP_5_ADC() -1
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
#if HAS_TEMP_ADC_BED
|
||||
#define GET_BED_ADC() PIN_TO_ADC(TEMP_BED_PIN)
|
||||
#else
|
||||
#define GET_BED_ADC() -1
|
||||
#endif
|
||||
#if HAS_HEATED_CHAMBER
|
||||
#if HAS_TEMP_ADC_CHAMBER
|
||||
#define GET_CHAMBER_ADC() PIN_TO_ADC(TEMP_CHAMBER_PIN)
|
||||
#else
|
||||
#define GET_CHAMBER_ADC() -1
|
||||
|
||||
@@ -132,11 +132,17 @@ void noTone(const pin_t _pin);
|
||||
|
||||
// Enable hooks into idle and setup for HAL
|
||||
void HAL_init(void);
|
||||
/*#define HAL_IDLETASK 1
|
||||
void HAL_idletask(void);*/
|
||||
/*
|
||||
#define HAL_IDLETASK 1
|
||||
void HAL_idletask(void);
|
||||
*/
|
||||
|
||||
//
|
||||
// Utility functions
|
||||
//
|
||||
FORCE_INLINE void _delay_ms(const int delay_ms) { delay(delay_ms); }
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wunused-function"
|
||||
int freeMemory(void);
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
@@ -115,12 +115,12 @@ HAL_SERVO_TIMER_ISR() {
|
||||
tc->COUNT16.CC[tcChannel].reg = (uint16_t)(tcCounterValue - 4UL); // at least REFRESH_INTERVAL has elapsed
|
||||
}
|
||||
if (tcChannel == 0) {
|
||||
SYNC(tc->COUNT16.SYNCBUSY.bit.CC0);
|
||||
SYNC(tc->COUNT16.SYNCBUSY.bit.CC0);
|
||||
// Clear the interrupt
|
||||
tc->COUNT16.INTFLAG.reg = TC_INTFLAG_MC0;
|
||||
}
|
||||
else {
|
||||
SYNC(tc->COUNT16.SYNCBUSY.bit.CC1);
|
||||
SYNC(tc->COUNT16.SYNCBUSY.bit.CC1);
|
||||
// Clear the interrupt
|
||||
tc->COUNT16.INTFLAG.reg = TC_INTFLAG_MC1;
|
||||
}
|
||||
@@ -163,7 +163,7 @@ void initISR(timer16_Sequence_t timer) {
|
||||
SYNC(tc->COUNT16.SYNCBUSY.bit.CTRLB);
|
||||
|
||||
// Reset all servo indexes
|
||||
memset(currentServoIndex, 0xFF, sizeof(currentServoIndex));
|
||||
memset((void *)currentServoIndex, 0xFF, sizeof(currentServoIndex));
|
||||
|
||||
// Configure interrupt request
|
||||
NVIC_ClearPendingIRQ(SERVO_IRQn);
|
||||
|
||||
@@ -243,6 +243,7 @@
|
||||
#define DIO5_PIN PIN_PC21
|
||||
#define DIO16_PIN PIN_PC22
|
||||
#define DIO17_PIN PIN_PC23
|
||||
#define DIO88_PIN PIN_PC24 // NEOPIXEL
|
||||
// PORTD
|
||||
#define DIO22_PIN PIN_PD12
|
||||
#define DIO6_PIN PIN_PD20
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
#endif
|
||||
|
||||
#if ENABLED(EMERGENCY_PARSER)
|
||||
#error "EMERGENCY_PARSER is not yet implemented for STM32F4. Disable EMERGENCY_PARSER to continue."
|
||||
#error "EMERGENCY_PARSER is not yet implemented for SAMD51. Disable EMERGENCY_PARSER to continue."
|
||||
#endif
|
||||
|
||||
#if ENABLED(SDIO_SUPPORT)
|
||||
|
||||
@@ -136,7 +136,7 @@ typedef int16_t pin_t;
|
||||
// Public Variables
|
||||
// ------------------------
|
||||
|
||||
/** result of last ADC conversion */
|
||||
// result of last ADC conversion
|
||||
extern uint16_t HAL_adc_result;
|
||||
|
||||
// ------------------------
|
||||
@@ -149,30 +149,35 @@ extern uint16_t HAL_adc_result;
|
||||
// Enable hooks into setup for HAL
|
||||
void HAL_init(void);
|
||||
|
||||
/** clear reset reason */
|
||||
// Clear reset reason
|
||||
void HAL_clear_reset_source (void);
|
||||
|
||||
/** reset reason */
|
||||
// Reset reason
|
||||
uint8_t HAL_get_reset_source(void);
|
||||
|
||||
void _delay_ms(const int delay);
|
||||
|
||||
extern "C" char* _sbrk(int incr);
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wunused-function"
|
||||
|
||||
static inline int freeMemory() {
|
||||
volatile char top;
|
||||
return &top - reinterpret_cast<char*>(_sbrk(0));
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
//
|
||||
// SPI: Extended functions which take a channel number (hardware SPI only)
|
||||
//
|
||||
|
||||
/** Write single byte to specified SPI channel */
|
||||
// Write single byte to specified SPI channel
|
||||
void spiSend(uint32_t chan, byte 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);
|
||||
/** Read single byte from specified SPI channel */
|
||||
// Read single byte from specified SPI channel
|
||||
uint8_t spiRec(uint32_t chan);
|
||||
|
||||
//
|
||||
@@ -182,8 +187,8 @@ uint8_t spiRec(uint32_t chan);
|
||||
// Wire library should work for i2c EEPROMs
|
||||
void eeprom_write_byte(uint8_t *pos, unsigned char value);
|
||||
uint8_t eeprom_read_byte(uint8_t *pos);
|
||||
void eeprom_read_block (void *__dst, const void *__src, size_t __n);
|
||||
void eeprom_update_block (const void *__src, void *__dst, size_t __n);
|
||||
void eeprom_read_block(void *__dst, const void *__src, size_t __n);
|
||||
void eeprom_update_block(const void *__src, void *__dst, size_t __n);
|
||||
|
||||
//
|
||||
// ADC
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
*/
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC)
|
||||
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
#include <SPI.h>
|
||||
@@ -73,16 +72,22 @@ void spiInit(uint8_t spiRate) {
|
||||
// Use datarates Marlin uses
|
||||
uint32_t clock;
|
||||
switch (spiRate) {
|
||||
case SPI_FULL_SPEED: clock = 20000000; break; // 13.9mhz=20000000 6.75mhz=10000000 3.38mhz=5000000 .833mhz=1000000
|
||||
case SPI_HALF_SPEED: clock = 5000000; break;
|
||||
case SPI_QUARTER_SPEED: clock = 2500000; break;
|
||||
case SPI_EIGHTH_SPEED: clock = 1250000; break;
|
||||
case SPI_SPEED_5: clock = 625000; break;
|
||||
case SPI_SPEED_6: clock = 300000; break;
|
||||
default:
|
||||
clock = 4000000; // Default from the SPI library
|
||||
case SPI_FULL_SPEED: clock = 20000000; break; // 13.9mhz=20000000 6.75mhz=10000000 3.38mhz=5000000 .833mhz=1000000
|
||||
case SPI_HALF_SPEED: clock = 5000000; break;
|
||||
case SPI_QUARTER_SPEED: clock = 2500000; break;
|
||||
case SPI_EIGHTH_SPEED: clock = 1250000; break;
|
||||
case SPI_SPEED_5: clock = 625000; break;
|
||||
case SPI_SPEED_6: clock = 300000; break;
|
||||
default:
|
||||
clock = 4000000; // Default from the SPI library
|
||||
}
|
||||
spiConfig = SPISettings(clock, MSBFIRST, SPI_MODE0);
|
||||
#if defined(MISO_PIN) && defined(SDSS) && defined(MOSI_PIN) && defined(SCK_PIN)
|
||||
SPI.setMISO(MISO_PIN);
|
||||
SPI.setSSEL(SDSS);
|
||||
SPI.setMOSI(MOSI_PIN);
|
||||
SPI.setSCLK(SCK_PIN);
|
||||
#endif
|
||||
SPI.begin();
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ void FastIO_init(); // Must be called before using fast io macros
|
||||
#define _WRITE(IO, V) do { \
|
||||
if (V) FastIOPortMap[STM_PORT(digitalPin[IO])]->BSRR = _BV32(STM_PIN(digitalPin[IO])) ; \
|
||||
else FastIOPortMap[STM_PORT(digitalPin[IO])]->BRR = _BV32(STM_PIN(digitalPin[IO])) ; \
|
||||
} while(0)
|
||||
}while(0)
|
||||
#else
|
||||
#define _WRITE(IO, V) (FastIOPortMap[STM_PORT(digitalPin[IO])]->BSRR = _BV32(STM_PIN(digitalPin[IO]) + (V ? 0 : 16)))
|
||||
#endif
|
||||
|
||||
@@ -21,24 +21,23 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* HAL for stm32duino.com based on Libmaple and compatible (STM32F1)
|
||||
* Implementation of EEPROM settings in SD Card
|
||||
*/
|
||||
|
||||
#ifdef TARGET_STM32F4
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC)
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(EEPROM_SETTINGS) && NONE(FLASH_EEPROM_EMULATION, SPI_EEPROM, I2C_EEPROM)
|
||||
#if ENABLED(EEPROM_SETTINGS) && NONE(FLASH_EEPROM_EMULATION, SRAM_EEPROM_EMULATION, SPI_EEPROM, I2C_EEPROM)
|
||||
|
||||
#include "../shared/persistent_store_api.h"
|
||||
|
||||
#ifndef E2END
|
||||
#define E2END 0xFFF // 4KB
|
||||
#endif
|
||||
#define HAL_EEPROM_SIZE (E2END + 1) // 16KB
|
||||
#define HAL_EEPROM_SIZE int(E2END + 1)
|
||||
|
||||
#define _ALIGN(x) __attribute__ ((aligned(x))) // SDIO uint32_t* compat.
|
||||
#define _ALIGN(x) __attribute__ ((aligned(x)))
|
||||
static char _ALIGN(4) HAL_eeprom_data[HAL_EEPROM_SIZE];
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
@@ -52,11 +51,11 @@ static char _ALIGN(4) HAL_eeprom_data[HAL_EEPROM_SIZE];
|
||||
|
||||
SdFile file, root = card.getroot();
|
||||
if (!file.open(&root, EEPROM_FILENAME, O_RDONLY))
|
||||
return false;
|
||||
return true;
|
||||
|
||||
int16_t bytes_read = file.read(HAL_eeprom_data, HAL_STM32F4_EEPROM_SIZE);
|
||||
int bytes_read = file.read(HAL_eeprom_data, HAL_EEPROM_SIZE);
|
||||
if (bytes_read < 0) return false;
|
||||
for (; bytes_read < HAL_STM32F4_EEPROM_SIZE; bytes_read++)
|
||||
for (; bytes_read < HAL_EEPROM_SIZE; bytes_read++)
|
||||
HAL_eeprom_data[bytes_read] = 0xFF;
|
||||
file.close();
|
||||
return true;
|
||||
@@ -66,17 +65,17 @@ static char _ALIGN(4) HAL_eeprom_data[HAL_EEPROM_SIZE];
|
||||
if (!card.isDetected()) return false;
|
||||
|
||||
SdFile file, root = card.getroot();
|
||||
int16_t bytes_written = 0;
|
||||
int bytes_written = 0;
|
||||
if (file.open(&root, EEPROM_FILENAME, O_CREAT | O_WRITE | O_TRUNC)) {
|
||||
bytes_written = file.write(HAL_eeprom_data, HAL_STM32F4_EEPROM_SIZE);
|
||||
bytes_written = file.write(HAL_eeprom_data, HAL_EEPROM_SIZE);
|
||||
file.close();
|
||||
}
|
||||
return (bytes_written == HAL_STM32F4_EEPROM_SIZE);
|
||||
return (bytes_written == HAL_EEPROM_SIZE);
|
||||
}
|
||||
|
||||
#else // !SDSUPPORT
|
||||
|
||||
#error "Please define SPI_EEPROM (in Configuration.h) or disable EEPROM_SETTINGS."
|
||||
#error "Please define an EEPROM, a SDCARD or disable EEPROM_SETTINGS."
|
||||
|
||||
#endif // !SDSUPPORT
|
||||
|
||||
@@ -98,7 +97,7 @@ bool PersistentStore::read_data(int &pos, uint8_t* value, const size_t size, uin
|
||||
return false;
|
||||
}
|
||||
|
||||
size_t PersistentStore::capacity() { return HAL_STM32F4_EEPROM_SIZE; }
|
||||
size_t PersistentStore::capacity() { return HAL_EEPROM_SIZE; }
|
||||
|
||||
#endif // EEPROM_SETTINGS
|
||||
#endif // __STM32F4__
|
||||
#endif // STM32
|
||||
|
||||
@@ -189,7 +189,7 @@ void port_print(const pin_t Ard_num) {
|
||||
for (Index = 0; Index < NUMBER_PINS_TOTAL; Index++)
|
||||
if (Ard_num == GET_PIN_MAP_PIN_M43(Index)) break;
|
||||
|
||||
char * const ppa = pin_xref[Index].Port_pin_alpha;
|
||||
const char * ppa = pin_xref[Index].Port_pin_alpha;
|
||||
sprintf_P(buffer, PSTR("%s"), ppa);
|
||||
SERIAL_ECHO(buffer);
|
||||
if (ppa[3] == '\0') SERIAL_CHAR(' ');
|
||||
|
||||
@@ -93,7 +93,7 @@ uint16_t HAL_adc_result;
|
||||
// ------------------------
|
||||
STM32ADC adc(ADC1);
|
||||
|
||||
uint8_t adc_pins[] = {
|
||||
const uint8_t adc_pins[] = {
|
||||
#if HAS_TEMP_ADC_0
|
||||
TEMP_0_PIN,
|
||||
#endif
|
||||
@@ -270,7 +270,7 @@ void HAL_adc_init(void) {
|
||||
#else
|
||||
adc.setSampleRate(ADC_SMPR_41_5); // 41.5 ADC cycles
|
||||
#endif
|
||||
adc.setPins(adc_pins, ADC_PIN_COUNT);
|
||||
adc.setPins((uint8_t *)adc_pins, ADC_PIN_COUNT);
|
||||
adc.setDMA(HAL_adc_results, (uint16_t)ADC_PIN_COUNT, (uint32_t)(DMA_MINC_MODE | DMA_CIRC_MODE), nullptr);
|
||||
adc.setScanMode();
|
||||
adc.setContinuous();
|
||||
|
||||
@@ -158,7 +158,7 @@ typedef int8_t pin_t;
|
||||
// Public Variables
|
||||
// ------------------------
|
||||
|
||||
/** result of last ADC conversion */
|
||||
// Result of last ADC conversion
|
||||
extern uint16_t HAL_adc_result;
|
||||
|
||||
// ------------------------
|
||||
@@ -174,14 +174,17 @@ extern uint16_t HAL_adc_result;
|
||||
// Memory related
|
||||
#define __bss_end __bss_end__
|
||||
|
||||
/** clear reset reason */
|
||||
// Clear reset reason
|
||||
void HAL_clear_reset_source(void);
|
||||
|
||||
/** reset reason */
|
||||
// Reset reason
|
||||
uint8_t HAL_get_reset_source(void);
|
||||
|
||||
void _delay_ms(const int delay);
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wunused-function"
|
||||
|
||||
/*
|
||||
extern "C" {
|
||||
int freeMemory(void);
|
||||
@@ -189,6 +192,7 @@ extern "C" {
|
||||
*/
|
||||
|
||||
extern "C" char* _sbrk(int incr);
|
||||
|
||||
/*
|
||||
static int freeMemory() {
|
||||
volatile int top;
|
||||
@@ -197,9 +201,6 @@ static int freeMemory() {
|
||||
}
|
||||
*/
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wunused-function"
|
||||
|
||||
static int freeMemory() {
|
||||
volatile char top;
|
||||
return &top - reinterpret_cast<char*>(_sbrk(0));
|
||||
@@ -211,11 +212,11 @@ static int freeMemory() {
|
||||
// SPI: Extended functions which take a channel number (hardware SPI only)
|
||||
//
|
||||
|
||||
/** Write single byte to specified SPI channel */
|
||||
// Write single byte to specified SPI channel
|
||||
void spiSend(uint32_t chan, byte 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);
|
||||
/** Read single byte from specified SPI channel */
|
||||
// Read single byte from specified SPI channel
|
||||
uint8_t spiRec(uint32_t chan);
|
||||
|
||||
//
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#ifdef __STM32F1__
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
#include <SPI.h>
|
||||
#include "SPI.h"
|
||||
|
||||
// ------------------------
|
||||
// Public functions
|
||||
@@ -64,10 +64,9 @@
|
||||
* @details Only configures SS pin since libmaple creates and initialize the SPI object
|
||||
*/
|
||||
void spiBegin() {
|
||||
#if !PIN_EXISTS(SS)
|
||||
#error "SS_PIN not defined!"
|
||||
#if PIN_EXISTS(SS)
|
||||
OUT_WRITE(SS_PIN, HIGH);
|
||||
#endif
|
||||
OUT_WRITE(SS_PIN, HIGH);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,741 @@
|
||||
/******************************************************************************
|
||||
* The MIT License
|
||||
*
|
||||
* Copyright (c) 2010 Perry Hung.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
* files (the "Software"), to deal in the Software without
|
||||
* restriction, including without limitation the rights to use, copy,
|
||||
* modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
* of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
||||
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*****************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Marti Bolivar <mbolivar@leaflabs.com>
|
||||
* @brief Wirish SPI implementation.
|
||||
*/
|
||||
|
||||
#ifdef __STM32F1__
|
||||
|
||||
#include "SPI.h"
|
||||
|
||||
#include <libmaple/timer.h>
|
||||
#include <libmaple/util.h>
|
||||
#include <libmaple/rcc.h>
|
||||
|
||||
#include <boards.h>
|
||||
#include <wirish.h>
|
||||
|
||||
/** Time in ms for DMA receive timeout */
|
||||
#define DMA_TIMEOUT 100
|
||||
|
||||
#if CYCLES_PER_MICROSECOND != 72
|
||||
#warning "Unexpected clock speed; SPI frequency calculation will be incorrect"
|
||||
#endif
|
||||
|
||||
struct spi_pins {
|
||||
uint8_t nss;
|
||||
uint8_t sck;
|
||||
uint8_t miso;
|
||||
uint8_t mosi;
|
||||
};
|
||||
|
||||
static const spi_pins* dev_to_spi_pins(spi_dev *dev);
|
||||
static void configure_gpios(spi_dev *dev, bool as_master);
|
||||
static spi_baud_rate determine_baud_rate(spi_dev *dev, uint32_t freq);
|
||||
|
||||
#if (BOARD_NR_SPI >= 3) && !defined(STM32_HIGH_DENSITY)
|
||||
#error "The SPI library is misconfigured: 3 SPI ports only available on high density STM32 devices"
|
||||
#endif
|
||||
|
||||
static const spi_pins board_spi_pins[] __FLASH__ = {
|
||||
#if BOARD_NR_SPI >= 1
|
||||
{ BOARD_SPI1_NSS_PIN,
|
||||
BOARD_SPI1_SCK_PIN,
|
||||
BOARD_SPI1_MISO_PIN,
|
||||
BOARD_SPI1_MOSI_PIN },
|
||||
#endif
|
||||
#if BOARD_NR_SPI >= 2
|
||||
{ BOARD_SPI2_NSS_PIN,
|
||||
BOARD_SPI2_SCK_PIN,
|
||||
BOARD_SPI2_MISO_PIN,
|
||||
BOARD_SPI2_MOSI_PIN },
|
||||
#endif
|
||||
#if BOARD_NR_SPI >= 3
|
||||
{ BOARD_SPI3_NSS_PIN,
|
||||
BOARD_SPI3_SCK_PIN,
|
||||
BOARD_SPI3_MISO_PIN,
|
||||
BOARD_SPI3_MOSI_PIN },
|
||||
#endif
|
||||
};
|
||||
|
||||
#if BOARD_NR_SPI >= 1
|
||||
static void (*_spi1_this);
|
||||
#endif
|
||||
#if BOARD_NR_SPI >= 2
|
||||
static void (*_spi2_this);
|
||||
#endif
|
||||
#if BOARD_NR_SPI >= 3
|
||||
static void (*_spi3_this);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
SPIClass::SPIClass(uint32_t spi_num) {
|
||||
_currentSetting=&_settings[spi_num-1];// SPI channels are called 1 2 and 3 but the array is zero indexed
|
||||
|
||||
switch (spi_num) {
|
||||
#if BOARD_NR_SPI >= 1
|
||||
case 1:
|
||||
_currentSetting->spi_d = SPI1;
|
||||
_spi1_this = (void*)this;
|
||||
break;
|
||||
#endif
|
||||
#if BOARD_NR_SPI >= 2
|
||||
case 2:
|
||||
_currentSetting->spi_d = SPI2;
|
||||
_spi2_this = (void*)this;
|
||||
break;
|
||||
#endif
|
||||
#if BOARD_NR_SPI >= 3
|
||||
case 3:
|
||||
_currentSetting->spi_d = SPI3;
|
||||
_spi3_this = (void*)this;
|
||||
break;
|
||||
#endif
|
||||
default: ASSERT(0);
|
||||
}
|
||||
|
||||
// Init things specific to each SPI device
|
||||
// clock divider setup is a bit of hack, and needs to be improved at a later date.
|
||||
#if BOARD_NR_SPI >= 1
|
||||
_settings[0].spi_d = SPI1;
|
||||
_settings[0].clockDivider = determine_baud_rate(_settings[0].spi_d, _settings[0].clock);
|
||||
_settings[0].spiDmaDev = DMA1;
|
||||
_settings[0].spiTxDmaChannel = DMA_CH3;
|
||||
_settings[0].spiRxDmaChannel = DMA_CH2;
|
||||
#endif
|
||||
#if BOARD_NR_SPI >= 2
|
||||
_settings[1].spi_d = SPI2;
|
||||
_settings[1].clockDivider = determine_baud_rate(_settings[1].spi_d, _settings[1].clock);
|
||||
_settings[1].spiDmaDev = DMA1;
|
||||
_settings[1].spiTxDmaChannel = DMA_CH5;
|
||||
_settings[1].spiRxDmaChannel = DMA_CH4;
|
||||
#endif
|
||||
#if BOARD_NR_SPI >= 3
|
||||
_settings[2].spi_d = SPI3;
|
||||
_settings[2].clockDivider = determine_baud_rate(_settings[2].spi_d, _settings[2].clock);
|
||||
_settings[2].spiDmaDev = DMA2;
|
||||
_settings[2].spiTxDmaChannel = DMA_CH2;
|
||||
_settings[2].spiRxDmaChannel = DMA_CH1;
|
||||
#endif
|
||||
|
||||
// added for DMA callbacks.
|
||||
_currentSetting->state = SPI_STATE_IDLE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Set up/tear down
|
||||
*/
|
||||
void SPIClass::updateSettings() {
|
||||
uint32_t flags = ((_currentSetting->bitOrder == MSBFIRST ? SPI_FRAME_MSB : SPI_FRAME_LSB) | _currentSetting->dataSize | SPI_SW_SLAVE | SPI_SOFT_SS);
|
||||
spi_master_enable(_currentSetting->spi_d, (spi_baud_rate)_currentSetting->clockDivider, (spi_mode)_currentSetting->dataMode, flags);
|
||||
}
|
||||
|
||||
void SPIClass::begin() {
|
||||
spi_init(_currentSetting->spi_d);
|
||||
configure_gpios(_currentSetting->spi_d, 1);
|
||||
updateSettings();
|
||||
// added for DMA callbacks.
|
||||
_currentSetting->state = SPI_STATE_READY;
|
||||
}
|
||||
|
||||
void SPIClass::beginSlave() {
|
||||
spi_init(_currentSetting->spi_d);
|
||||
configure_gpios(_currentSetting->spi_d, 0);
|
||||
uint32_t flags = ((_currentSetting->bitOrder == MSBFIRST ? SPI_FRAME_MSB : SPI_FRAME_LSB) | _currentSetting->dataSize);
|
||||
spi_slave_enable(_currentSetting->spi_d, (spi_mode)_currentSetting->dataMode, flags);
|
||||
// added for DMA callbacks.
|
||||
_currentSetting->state = SPI_STATE_READY;
|
||||
}
|
||||
|
||||
void SPIClass::end() {
|
||||
if (!spi_is_enabled(_currentSetting->spi_d))
|
||||
return;
|
||||
|
||||
// Follows RM0008's sequence for disabling a SPI in master/slave
|
||||
// full duplex mode.
|
||||
while (spi_is_rx_nonempty(_currentSetting->spi_d)) {
|
||||
// FIXME [0.1.0] remove this once you have an interrupt based driver
|
||||
volatile uint16_t rx __attribute__((unused)) = spi_rx_reg(_currentSetting->spi_d);
|
||||
}
|
||||
while (!spi_is_tx_empty(_currentSetting->spi_d)) {};
|
||||
while (spi_is_busy(_currentSetting->spi_d)) {};
|
||||
|
||||
spi_peripheral_disable(_currentSetting->spi_d);
|
||||
// added for DMA callbacks.
|
||||
// Need to add unsetting the callbacks for the DMA channels.
|
||||
_currentSetting->state = SPI_STATE_IDLE;
|
||||
}
|
||||
|
||||
/* Roger Clark added 3 functions */
|
||||
void SPIClass::setClockDivider(uint32_t clockDivider) {
|
||||
_currentSetting->clockDivider = clockDivider;
|
||||
uint32_t cr1 = _currentSetting->spi_d->regs->CR1 & ~(SPI_CR1_BR);
|
||||
_currentSetting->spi_d->regs->CR1 = cr1 | (clockDivider & SPI_CR1_BR);
|
||||
}
|
||||
|
||||
void SPIClass::setBitOrder(BitOrder bitOrder) {
|
||||
_currentSetting->bitOrder = bitOrder;
|
||||
uint32_t cr1 = _currentSetting->spi_d->regs->CR1 & ~(SPI_CR1_LSBFIRST);
|
||||
if (bitOrder == LSBFIRST) cr1 |= SPI_CR1_LSBFIRST;
|
||||
_currentSetting->spi_d->regs->CR1 = cr1;
|
||||
}
|
||||
|
||||
/* Victor Perez. Added to test changing datasize from 8 to 16 bit modes on the fly.
|
||||
* Input parameter should be SPI_CR1_DFF set to 0 or 1 on a 32bit word.
|
||||
*
|
||||
*/
|
||||
void SPIClass::setDataSize(uint32_t datasize) {
|
||||
_currentSetting->dataSize = datasize;
|
||||
uint32_t cr1 = _currentSetting->spi_d->regs->CR1 & ~(SPI_CR1_DFF);
|
||||
uint8_t en = spi_is_enabled(_currentSetting->spi_d);
|
||||
spi_peripheral_disable(_currentSetting->spi_d);
|
||||
_currentSetting->spi_d->regs->CR1 = cr1 | (datasize & SPI_CR1_DFF) | en;
|
||||
}
|
||||
|
||||
void SPIClass::setDataMode(uint8_t dataMode) {
|
||||
/* Notes:
|
||||
As far as I can tell, the AVR numbers for dataMode appear to match the numbers required by the STM32
|
||||
From the AVR doc http://www.atmel.com/images/doc2585.pdf section 2.4
|
||||
SPI Mode CPOL CPHA Shift SCK-edge Capture SCK-edge
|
||||
0 0 0 Falling Rising
|
||||
1 0 1 Rising Falling
|
||||
2 1 0 Rising Falling
|
||||
3 1 1 Falling Rising
|
||||
|
||||
On the STM32 it appears to be
|
||||
|
||||
bit 1 - CPOL : Clock polarity
|
||||
(This bit should not be changed when communication is ongoing)
|
||||
0 : CLK to 0 when idle
|
||||
1 : CLK to 1 when idle
|
||||
|
||||
bit 0 - CPHA : Clock phase
|
||||
(This bit should not be changed when communication is ongoing)
|
||||
0 : The first clock transition is the first data capture edge
|
||||
1 : The second clock transition is the first data capture edge
|
||||
|
||||
If someone finds this is not the case or sees a logic error with this let me know ;-)
|
||||
*/
|
||||
_currentSetting->dataMode = dataMode;
|
||||
uint32_t cr1 = _currentSetting->spi_d->regs->CR1 & ~(SPI_CR1_CPOL|SPI_CR1_CPHA);
|
||||
_currentSetting->spi_d->regs->CR1 = cr1 | (dataMode & (SPI_CR1_CPOL|SPI_CR1_CPHA));
|
||||
}
|
||||
|
||||
void SPIClass::beginTransaction(uint8_t pin, SPISettings settings) {
|
||||
setBitOrder(settings.bitOrder);
|
||||
setDataMode(settings.dataMode);
|
||||
setDataSize(settings.dataSize);
|
||||
setClockDivider(determine_baud_rate(_currentSetting->spi_d, settings.clock));
|
||||
begin();
|
||||
}
|
||||
|
||||
void SPIClass::beginTransactionSlave(SPISettings settings) {
|
||||
setBitOrder(settings.bitOrder);
|
||||
setDataMode(settings.dataMode);
|
||||
setDataSize(settings.dataSize);
|
||||
beginSlave();
|
||||
}
|
||||
|
||||
void SPIClass::endTransaction() { }
|
||||
|
||||
|
||||
/*
|
||||
* I/O
|
||||
*/
|
||||
|
||||
uint16_t SPIClass::read() {
|
||||
while ( spi_is_rx_nonempty(_currentSetting->spi_d)==0 ) ;
|
||||
return (uint16)spi_rx_reg(_currentSetting->spi_d);
|
||||
}
|
||||
|
||||
void SPIClass::read(uint8_t *buf, uint32_t len) {
|
||||
if (len == 0) return;
|
||||
spi_rx_reg(_currentSetting->spi_d); // clear the RX buffer in case a byte is waiting on it.
|
||||
spi_reg_map * regs = _currentSetting->spi_d->regs;
|
||||
// start sequence: write byte 0
|
||||
regs->DR = 0x00FF; // write the first byte
|
||||
// main loop
|
||||
while ( (--len) ) {
|
||||
while( !(regs->SR & SPI_SR_TXE) ); // wait for TXE flag
|
||||
noInterrupts(); // go atomic level - avoid interrupts to surely get the previously received data
|
||||
regs->DR = 0x00FF; // write the next data item to be transmitted into the SPI_DR register. This clears the TXE flag.
|
||||
while ( !(regs->SR & SPI_SR_RXNE) ); // wait till data is available in the DR register
|
||||
*buf++ = (uint8)(regs->DR); // read and store the received byte. This clears the RXNE flag.
|
||||
interrupts(); // let systick do its job
|
||||
}
|
||||
// read remaining last byte
|
||||
while ( !(regs->SR & SPI_SR_RXNE) ) {} // wait till data is available in the Rx register
|
||||
*buf++ = (uint8)(regs->DR); // read and store the received byte
|
||||
}
|
||||
|
||||
void SPIClass::write(uint16_t data) {
|
||||
/* Added for 16bit data Victor Perez. Roger Clark
|
||||
* Improved speed by just directly writing the single byte to the SPI data reg and wait for completion,
|
||||
* by taking the Tx code from transfer(byte)
|
||||
* This almost doubles the speed of this function.
|
||||
*/
|
||||
spi_tx_reg(_currentSetting->spi_d, data); // write the data to be transmitted into the SPI_DR register (this clears the TXE flag)
|
||||
while (spi_is_tx_empty(_currentSetting->spi_d) == 0); // "5. Wait until TXE=1 ..."
|
||||
while (spi_is_busy(_currentSetting->spi_d) != 0); // "... and then wait until BSY=0 before disabling the SPI."
|
||||
}
|
||||
|
||||
void SPIClass::write16(uint16_t data) {
|
||||
// Added by stevestrong: write two consecutive bytes in 8 bit mode (DFF=0)
|
||||
spi_tx_reg(_currentSetting->spi_d, data>>8); // write high byte
|
||||
while (spi_is_tx_empty(_currentSetting->spi_d) == 0); // Wait until TXE=1
|
||||
spi_tx_reg(_currentSetting->spi_d, data); // write low byte
|
||||
while (spi_is_tx_empty(_currentSetting->spi_d) == 0); // Wait until TXE=1
|
||||
while (spi_is_busy(_currentSetting->spi_d) != 0); // wait until BSY=0
|
||||
}
|
||||
|
||||
void SPIClass::write(uint16_t data, uint32_t n) {
|
||||
// Added by stevstrong: Repeatedly send same data by the specified number of times
|
||||
spi_reg_map * regs = _currentSetting->spi_d->regs;
|
||||
while ( (n--)>0 ) {
|
||||
regs->DR = data; // write the data to be transmitted into the SPI_DR register (this clears the TXE flag)
|
||||
while ( (regs->SR & SPI_SR_TXE)==0 ) ; // wait till Tx empty
|
||||
}
|
||||
while ( (regs->SR & SPI_SR_BSY) != 0); // wait until BSY=0 before returning
|
||||
}
|
||||
|
||||
void SPIClass::write(const void *data, uint32_t length) {
|
||||
spi_dev * spi_d = _currentSetting->spi_d;
|
||||
spi_tx(spi_d, data, length); // data can be array of bytes or words
|
||||
while (spi_is_tx_empty(spi_d) == 0); // "5. Wait until TXE=1 ..."
|
||||
while (spi_is_busy(spi_d) != 0); // "... and then wait until BSY=0 before disabling the SPI."
|
||||
}
|
||||
|
||||
uint8_t SPIClass::transfer(uint8_t byte) const {
|
||||
spi_dev * spi_d = _currentSetting->spi_d;
|
||||
spi_rx_reg(spi_d); // read any previous data
|
||||
spi_tx_reg(spi_d, byte); // Write the data item to be transmitted into the SPI_DR register
|
||||
while (spi_is_tx_empty(spi_d) == 0); // "5. Wait until TXE=1 ..."
|
||||
while (spi_is_busy(spi_d) != 0); // "... and then wait until BSY=0 before disabling the SPI."
|
||||
return (uint8)spi_rx_reg(spi_d); // "... and read the last received data."
|
||||
}
|
||||
|
||||
uint16_t SPIClass::transfer16(uint16_t data) const {
|
||||
// Modified by stevestrong: write & read two consecutive bytes in 8 bit mode (DFF=0)
|
||||
// This is more effective than two distinct byte transfers
|
||||
spi_dev * spi_d = _currentSetting->spi_d;
|
||||
spi_rx_reg(spi_d); // read any previous data
|
||||
spi_tx_reg(spi_d, data>>8); // write high byte
|
||||
while (spi_is_tx_empty(spi_d) == 0); // wait until TXE=1
|
||||
while (spi_is_busy(spi_d) != 0); // wait until BSY=0
|
||||
uint16_t ret = spi_rx_reg(spi_d)<<8; // read and shift high byte
|
||||
spi_tx_reg(spi_d, data); // write low byte
|
||||
while (spi_is_tx_empty(spi_d) == 0); // wait until TXE=1
|
||||
while (spi_is_busy(spi_d) != 0); // wait until BSY=0
|
||||
ret += spi_rx_reg(spi_d); // read low byte
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Roger Clark and Victor Perez, 2015
|
||||
* Performs a DMA SPI transfer with at least a receive buffer.
|
||||
* If a TX buffer is not provided, FF is sent over and over for the lenght of the transfer.
|
||||
* On exit TX buffer is not modified, and RX buffer cotains the received data.
|
||||
* Still in progress.
|
||||
*/
|
||||
void SPIClass::dmaTransferSet(const void *transmitBuf, void *receiveBuf) {
|
||||
dma_init(_currentSetting->spiDmaDev);
|
||||
//spi_rx_dma_enable(_currentSetting->spi_d);
|
||||
//spi_tx_dma_enable(_currentSetting->spi_d);
|
||||
dma_xfer_size dma_bit_size = (_currentSetting->dataSize==DATA_SIZE_16BIT) ? DMA_SIZE_16BITS : DMA_SIZE_8BITS;
|
||||
dma_setup_transfer(_currentSetting->spiDmaDev, _currentSetting->spiRxDmaChannel, &_currentSetting->spi_d->regs->DR,
|
||||
dma_bit_size, receiveBuf, dma_bit_size, (DMA_MINC_MODE | DMA_TRNS_CMPLT ));// receive buffer DMA
|
||||
if (!transmitBuf) {
|
||||
transmitBuf = &ff;
|
||||
dma_setup_transfer(_currentSetting->spiDmaDev, _currentSetting->spiTxDmaChannel, &_currentSetting->spi_d->regs->DR,
|
||||
dma_bit_size, (volatile void*)transmitBuf, dma_bit_size, (DMA_FROM_MEM));// Transmit FF repeatedly
|
||||
}
|
||||
else {
|
||||
dma_setup_transfer(_currentSetting->spiDmaDev, _currentSetting->spiTxDmaChannel, &_currentSetting->spi_d->regs->DR,
|
||||
dma_bit_size, (volatile void*)transmitBuf, dma_bit_size, (DMA_MINC_MODE | DMA_FROM_MEM ));// Transmit buffer DMA
|
||||
}
|
||||
dma_set_priority(_currentSetting->spiDmaDev, _currentSetting->spiTxDmaChannel, DMA_PRIORITY_LOW);
|
||||
dma_set_priority(_currentSetting->spiDmaDev, _currentSetting->spiRxDmaChannel, DMA_PRIORITY_VERY_HIGH);
|
||||
}
|
||||
|
||||
uint8_t SPIClass::dmaTransferRepeat(uint16_t length) {
|
||||
if (length == 0) return 0;
|
||||
if (spi_is_rx_nonempty(_currentSetting->spi_d) == 1) spi_rx_reg(_currentSetting->spi_d);
|
||||
_currentSetting->state = SPI_STATE_TRANSFER;
|
||||
dma_set_num_transfers(_currentSetting->spiDmaDev, _currentSetting->spiRxDmaChannel, length);
|
||||
dma_set_num_transfers(_currentSetting->spiDmaDev, _currentSetting->spiTxDmaChannel, length);
|
||||
dma_enable(_currentSetting->spiDmaDev, _currentSetting->spiRxDmaChannel);// enable receive
|
||||
dma_enable(_currentSetting->spiDmaDev, _currentSetting->spiTxDmaChannel);// enable transmit
|
||||
spi_rx_dma_enable(_currentSetting->spi_d);
|
||||
spi_tx_dma_enable(_currentSetting->spi_d);
|
||||
if (_currentSetting->receiveCallback)
|
||||
return 0;
|
||||
|
||||
//uint32_t m = millis();
|
||||
uint8_t b = 0;
|
||||
uint32_t m = millis();
|
||||
while ((dma_get_isr_bits(_currentSetting->spiDmaDev, _currentSetting->spiTxDmaChannel) & DMA_ISR_TCIF1) == 0) {
|
||||
//Avoid interrupts and just loop waiting for the flag to be set.
|
||||
if ((millis() - m) > DMA_TIMEOUT) { b = 2; break; }
|
||||
}
|
||||
|
||||
while (spi_is_tx_empty(_currentSetting->spi_d) == 0); // "5. Wait until TXE=1 ..."
|
||||
while (spi_is_busy(_currentSetting->spi_d) != 0); // "... and then wait until BSY=0 before disabling the SPI."
|
||||
spi_tx_dma_disable(_currentSetting->spi_d);
|
||||
spi_rx_dma_disable(_currentSetting->spi_d);
|
||||
dma_disable(_currentSetting->spiDmaDev, _currentSetting->spiTxDmaChannel);
|
||||
dma_disable(_currentSetting->spiDmaDev, _currentSetting->spiRxDmaChannel);
|
||||
dma_clear_isr_bits(_currentSetting->spiDmaDev, _currentSetting->spiRxDmaChannel);
|
||||
dma_clear_isr_bits(_currentSetting->spiDmaDev, _currentSetting->spiTxDmaChannel);
|
||||
_currentSetting->state = SPI_STATE_READY;
|
||||
return b;
|
||||
}
|
||||
|
||||
/* Roger Clark and Victor Perez, 2015
|
||||
* Performs a DMA SPI transfer with at least a receive buffer.
|
||||
* If a TX buffer is not provided, FF is sent over and over for the length of the transfer.
|
||||
* On exit TX buffer is not modified, and RX buffer contains the received data.
|
||||
* Still in progress.
|
||||
*/
|
||||
uint8_t SPIClass::dmaTransfer(const void *transmitBuf, void *receiveBuf, uint16_t length) {
|
||||
dmaTransferSet(transmitBuf, receiveBuf);
|
||||
return dmaTransferRepeat(length);
|
||||
}
|
||||
|
||||
/* Roger Clark and Victor Perez, 2015
|
||||
* Performs a DMA SPI send using a TX buffer.
|
||||
* On exit TX buffer is not modified.
|
||||
* Still in progress.
|
||||
* 2016 - stevstrong - reworked to automatically detect bit size from SPI setting
|
||||
*/
|
||||
void SPIClass::dmaSendSet(const void * transmitBuf, bool minc) {
|
||||
uint32_t flags = ( (DMA_MINC_MODE*minc) | DMA_FROM_MEM | DMA_TRNS_CMPLT);
|
||||
dma_init(_currentSetting->spiDmaDev);
|
||||
dma_xfer_size dma_bit_size = (_currentSetting->dataSize==DATA_SIZE_16BIT) ? DMA_SIZE_16BITS : DMA_SIZE_8BITS;
|
||||
dma_setup_transfer(_currentSetting->spiDmaDev, _currentSetting->spiTxDmaChannel, &_currentSetting->spi_d->regs->DR, dma_bit_size,
|
||||
(volatile void*)transmitBuf, dma_bit_size, flags);// Transmit buffer DMA
|
||||
dma_set_priority(_currentSetting->spiDmaDev, _currentSetting->spiTxDmaChannel, DMA_PRIORITY_LOW);
|
||||
}
|
||||
|
||||
uint8_t SPIClass::dmaSendRepeat(uint16_t length) {
|
||||
if (length == 0) return 0;
|
||||
|
||||
dma_clear_isr_bits(_currentSetting->spiDmaDev, _currentSetting->spiTxDmaChannel);
|
||||
dma_set_num_transfers(_currentSetting->spiDmaDev, _currentSetting->spiTxDmaChannel, length);
|
||||
_currentSetting->state = SPI_STATE_TRANSMIT;
|
||||
dma_enable(_currentSetting->spiDmaDev, _currentSetting->spiTxDmaChannel);// enable transmit
|
||||
spi_tx_dma_enable(_currentSetting->spi_d);
|
||||
if (_currentSetting->transmitCallback)
|
||||
return 0;
|
||||
|
||||
uint32_t m = millis();
|
||||
uint8_t b = 0;
|
||||
while ((dma_get_isr_bits(_currentSetting->spiDmaDev, _currentSetting->spiTxDmaChannel) & DMA_ISR_TCIF1)==0) {
|
||||
//Avoid interrupts and just loop waiting for the flag to be set.
|
||||
if ((millis() - m) > DMA_TIMEOUT) { b = 2; break; }
|
||||
}
|
||||
while (spi_is_tx_empty(_currentSetting->spi_d) == 0); // "5. Wait until TXE=1 ..."
|
||||
while (spi_is_busy(_currentSetting->spi_d) != 0); // "... and then wait until BSY=0 before disabling the SPI."
|
||||
spi_tx_dma_disable(_currentSetting->spi_d);
|
||||
dma_disable(_currentSetting->spiDmaDev, _currentSetting->spiTxDmaChannel);
|
||||
dma_clear_isr_bits(_currentSetting->spiDmaDev, _currentSetting->spiTxDmaChannel);
|
||||
_currentSetting->state = SPI_STATE_READY;
|
||||
return b;
|
||||
}
|
||||
|
||||
uint8_t SPIClass::dmaSend(const void * transmitBuf, uint16_t length, bool minc) {
|
||||
dmaSendSet(transmitBuf, minc);
|
||||
return dmaSendRepeat(length);
|
||||
}
|
||||
|
||||
uint8_t SPIClass::dmaSendAsync(const void * transmitBuf, uint16_t length, bool minc) {
|
||||
uint8_t b = 0;
|
||||
|
||||
if (_currentSetting->state != SPI_STATE_READY) {
|
||||
uint32_t m = millis();
|
||||
while ((dma_get_isr_bits(_currentSetting->spiDmaDev, _currentSetting->spiTxDmaChannel) & DMA_ISR_TCIF1)==0) {
|
||||
//Avoid interrupts and just loop waiting for the flag to be set.
|
||||
//delayMicroseconds(10);
|
||||
if ((millis() - m) > DMA_TIMEOUT) { b = 2; break; }
|
||||
}
|
||||
|
||||
while (spi_is_tx_empty(_currentSetting->spi_d) == 0); // "5. Wait until TXE=1 ..."
|
||||
while (spi_is_busy(_currentSetting->spi_d) != 0); // "... and then wait until BSY=0 before disabling the SPI."
|
||||
spi_tx_dma_disable(_currentSetting->spi_d);
|
||||
dma_disable(_currentSetting->spiDmaDev, _currentSetting->spiTxDmaChannel);
|
||||
_currentSetting->state = SPI_STATE_READY;
|
||||
}
|
||||
|
||||
if (length == 0) return 0;
|
||||
uint32_t flags = ( (DMA_MINC_MODE*minc) | DMA_FROM_MEM | DMA_TRNS_CMPLT);
|
||||
|
||||
dma_init(_currentSetting->spiDmaDev);
|
||||
// TX
|
||||
dma_xfer_size dma_bit_size = (_currentSetting->dataSize==DATA_SIZE_16BIT) ? DMA_SIZE_16BITS : DMA_SIZE_8BITS;
|
||||
dma_setup_transfer(_currentSetting->spiDmaDev, _currentSetting->spiTxDmaChannel, &_currentSetting->spi_d->regs->DR,
|
||||
dma_bit_size, (volatile void*)transmitBuf, dma_bit_size, flags);// Transmit buffer DMA
|
||||
dma_set_num_transfers(_currentSetting->spiDmaDev, _currentSetting->spiTxDmaChannel, length);
|
||||
dma_clear_isr_bits(_currentSetting->spiDmaDev, _currentSetting->spiTxDmaChannel);
|
||||
dma_enable(_currentSetting->spiDmaDev, _currentSetting->spiTxDmaChannel);// enable transmit
|
||||
spi_tx_dma_enable(_currentSetting->spi_d);
|
||||
|
||||
_currentSetting->state = SPI_STATE_TRANSMIT;
|
||||
return b;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* New functions added to manage callbacks.
|
||||
* Victor Perez 2017
|
||||
*/
|
||||
void SPIClass::onReceive(void(*callback)(void)) {
|
||||
_currentSetting->receiveCallback = callback;
|
||||
if (callback) {
|
||||
switch (_currentSetting->spi_d->clk_id) {
|
||||
#if BOARD_NR_SPI >= 1
|
||||
case RCC_SPI1:
|
||||
dma_attach_interrupt(_currentSetting->spiDmaDev, _currentSetting->spiRxDmaChannel, &SPIClass::_spi1EventCallback);
|
||||
break;
|
||||
#endif
|
||||
#if BOARD_NR_SPI >= 2
|
||||
case RCC_SPI2:
|
||||
dma_attach_interrupt(_currentSetting->spiDmaDev, _currentSetting->spiRxDmaChannel, &SPIClass::_spi2EventCallback);
|
||||
break;
|
||||
#endif
|
||||
#if BOARD_NR_SPI >= 3
|
||||
case RCC_SPI3:
|
||||
dma_attach_interrupt(_currentSetting->spiDmaDev, _currentSetting->spiRxDmaChannel, &SPIClass::_spi3EventCallback);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
ASSERT(0);
|
||||
}
|
||||
}
|
||||
else {
|
||||
dma_detach_interrupt(_currentSetting->spiDmaDev, _currentSetting->spiRxDmaChannel);
|
||||
}
|
||||
}
|
||||
|
||||
void SPIClass::onTransmit(void(*callback)(void)) {
|
||||
_currentSetting->transmitCallback = callback;
|
||||
if (callback) {
|
||||
switch (_currentSetting->spi_d->clk_id) {
|
||||
#if BOARD_NR_SPI >= 1
|
||||
case RCC_SPI1:
|
||||
dma_attach_interrupt(_currentSetting->spiDmaDev, _currentSetting->spiTxDmaChannel, &SPIClass::_spi1EventCallback);
|
||||
break;
|
||||
#endif
|
||||
#if BOARD_NR_SPI >= 2
|
||||
case RCC_SPI2:
|
||||
dma_attach_interrupt(_currentSetting->spiDmaDev, _currentSetting->spiTxDmaChannel, &SPIClass::_spi2EventCallback);
|
||||
break;
|
||||
#endif
|
||||
#if BOARD_NR_SPI >= 3
|
||||
case RCC_SPI3:
|
||||
dma_attach_interrupt(_currentSetting->spiDmaDev, _currentSetting->spiTxDmaChannel, &SPIClass::_spi3EventCallback);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
ASSERT(0);
|
||||
}
|
||||
}
|
||||
else {
|
||||
dma_detach_interrupt(_currentSetting->spiDmaDev, _currentSetting->spiTxDmaChannel);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: check if better to first call the customer code, next disable the DMA requests.
|
||||
* Also see if we need to check whether callbacks are set or not, may be better to be checked
|
||||
* during the initial setup and only set the callback to EventCallback if they are set.
|
||||
*/
|
||||
void SPIClass::EventCallback() {
|
||||
while (spi_is_tx_empty(_currentSetting->spi_d) == 0); // "5. Wait until TXE=1 ..."
|
||||
while (spi_is_busy(_currentSetting->spi_d) != 0); // "... and then wait until BSY=0"
|
||||
switch (_currentSetting->state) {
|
||||
case SPI_STATE_TRANSFER:
|
||||
while (spi_is_rx_nonempty(_currentSetting->spi_d));
|
||||
_currentSetting->state = SPI_STATE_READY;
|
||||
spi_tx_dma_disable(_currentSetting->spi_d);
|
||||
spi_rx_dma_disable(_currentSetting->spi_d);
|
||||
//dma_disable(_currentSetting->spiDmaDev, _currentSetting->spiTxDmaChannel);
|
||||
//dma_disable(_currentSetting->spiDmaDev, _currentSetting->spiRxDmaChannel);
|
||||
if (_currentSetting->receiveCallback)
|
||||
_currentSetting->receiveCallback();
|
||||
break;
|
||||
case SPI_STATE_TRANSMIT:
|
||||
_currentSetting->state = SPI_STATE_READY;
|
||||
spi_tx_dma_disable(_currentSetting->spi_d);
|
||||
//dma_disable(_currentSetting->spiDmaDev, _currentSetting->spiTxDmaChannel);
|
||||
if (_currentSetting->transmitCallback)
|
||||
_currentSetting->transmitCallback();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void SPIClass::attachInterrupt() {
|
||||
// Should be enableInterrupt()
|
||||
}
|
||||
|
||||
void SPIClass::detachInterrupt() {
|
||||
// Should be disableInterrupt()
|
||||
}
|
||||
|
||||
/*
|
||||
* Pin accessors
|
||||
*/
|
||||
|
||||
uint8_t SPIClass::misoPin() {
|
||||
return dev_to_spi_pins(_currentSetting->spi_d)->miso;
|
||||
}
|
||||
|
||||
uint8_t SPIClass::mosiPin() {
|
||||
return dev_to_spi_pins(_currentSetting->spi_d)->mosi;
|
||||
}
|
||||
|
||||
uint8_t SPIClass::sckPin() {
|
||||
return dev_to_spi_pins(_currentSetting->spi_d)->sck;
|
||||
}
|
||||
|
||||
uint8_t SPIClass::nssPin() {
|
||||
return dev_to_spi_pins(_currentSetting->spi_d)->nss;
|
||||
}
|
||||
|
||||
/*
|
||||
* Deprecated functions
|
||||
*/
|
||||
|
||||
uint8_t SPIClass::send(uint8_t data) {
|
||||
this->write(data);
|
||||
return 1;
|
||||
}
|
||||
|
||||
uint8_t SPIClass::send(uint8_t *buf, uint32_t len) {
|
||||
this->write(buf, len);
|
||||
return len;
|
||||
}
|
||||
|
||||
uint8_t SPIClass::recv() {
|
||||
return this->read();
|
||||
}
|
||||
|
||||
/*
|
||||
* DMA call back functions, one per port.
|
||||
*/
|
||||
#if BOARD_NR_SPI >= 1
|
||||
void SPIClass::_spi1EventCallback() {
|
||||
reinterpret_cast<class SPIClass*>(_spi1_this)->EventCallback();
|
||||
}
|
||||
#endif
|
||||
#if BOARD_NR_SPI >= 2
|
||||
void SPIClass::_spi2EventCallback() {
|
||||
reinterpret_cast<class SPIClass*>(_spi2_this)->EventCallback();
|
||||
}
|
||||
#endif
|
||||
#if BOARD_NR_SPI >= 3
|
||||
void SPIClass::_spi3EventCallback() {
|
||||
reinterpret_cast<class SPIClass*>(_spi3_this)->EventCallback();
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Auxiliary functions
|
||||
*/
|
||||
static const spi_pins* dev_to_spi_pins(spi_dev *dev) {
|
||||
switch (dev->clk_id) {
|
||||
#if BOARD_NR_SPI >= 1
|
||||
case RCC_SPI1: return board_spi_pins;
|
||||
#endif
|
||||
#if BOARD_NR_SPI >= 2
|
||||
case RCC_SPI2: return board_spi_pins + 1;
|
||||
#endif
|
||||
#if BOARD_NR_SPI >= 3
|
||||
case RCC_SPI3: return board_spi_pins + 2;
|
||||
#endif
|
||||
default: return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void disable_pwm(const stm32_pin_info *i) {
|
||||
if (i->timer_device)
|
||||
timer_set_mode(i->timer_device, i->timer_channel, TIMER_DISABLED);
|
||||
}
|
||||
|
||||
static void configure_gpios(spi_dev *dev, bool as_master) {
|
||||
const spi_pins *pins = dev_to_spi_pins(dev);
|
||||
if (!pins) return;
|
||||
|
||||
const stm32_pin_info *nssi = &PIN_MAP[pins->nss],
|
||||
*scki = &PIN_MAP[pins->sck],
|
||||
*misoi = &PIN_MAP[pins->miso],
|
||||
*mosii = &PIN_MAP[pins->mosi];
|
||||
|
||||
disable_pwm(nssi);
|
||||
disable_pwm(scki);
|
||||
disable_pwm(misoi);
|
||||
disable_pwm(mosii);
|
||||
|
||||
spi_config_gpios(dev, as_master, nssi->gpio_device, nssi->gpio_bit,
|
||||
scki->gpio_device, scki->gpio_bit, misoi->gpio_bit,
|
||||
mosii->gpio_bit);
|
||||
}
|
||||
|
||||
static const spi_baud_rate baud_rates[8] __FLASH__ = {
|
||||
SPI_BAUD_PCLK_DIV_2,
|
||||
SPI_BAUD_PCLK_DIV_4,
|
||||
SPI_BAUD_PCLK_DIV_8,
|
||||
SPI_BAUD_PCLK_DIV_16,
|
||||
SPI_BAUD_PCLK_DIV_32,
|
||||
SPI_BAUD_PCLK_DIV_64,
|
||||
SPI_BAUD_PCLK_DIV_128,
|
||||
SPI_BAUD_PCLK_DIV_256,
|
||||
};
|
||||
|
||||
/*
|
||||
* Note: This assumes you're on a LeafLabs-style board
|
||||
* (CYCLES_PER_MICROSECOND == 72, APB2 at 72MHz, APB1 at 36MHz).
|
||||
*/
|
||||
static spi_baud_rate determine_baud_rate(spi_dev *dev, uint32_t freq) {
|
||||
uint32_t clock = 0;
|
||||
switch (rcc_dev_clk(dev->clk_id)) {
|
||||
case RCC_AHB:
|
||||
case RCC_APB2: clock = STM32_PCLK2; break; // 72 Mhz
|
||||
case RCC_APB1: clock = STM32_PCLK1; break; // 36 Mhz
|
||||
}
|
||||
clock >>= 1;
|
||||
|
||||
uint8_t i = 0;
|
||||
while (i < 7 && freq < clock) { clock >>= 1; i++; }
|
||||
return baud_rates[i];
|
||||
}
|
||||
|
||||
SPIClass SPI(1);
|
||||
|
||||
#endif // __STM32F1__
|
||||
@@ -0,0 +1,409 @@
|
||||
/******************************************************************************
|
||||
* The MIT License
|
||||
*
|
||||
* Copyright (c) 2010 Perry Hung.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
* files (the "Software"), to deal in the Software without
|
||||
* restriction, including without limitation the rights to use, copy,
|
||||
* modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
* of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
||||
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#include <libmaple/libmaple_types.h>
|
||||
#include <libmaple/spi.h>
|
||||
#include <libmaple/dma.h>
|
||||
|
||||
#include <boards.h>
|
||||
#include <stdint.h>
|
||||
#include <wirish.h>
|
||||
|
||||
// SPI_HAS_TRANSACTION means SPI has
|
||||
// - beginTransaction()
|
||||
// - endTransaction()
|
||||
// - usingInterrupt()
|
||||
// - SPISetting(clock, bitOrder, dataMode)
|
||||
//#define SPI_HAS_TRANSACTION
|
||||
|
||||
#define SPI_CLOCK_DIV2 SPI_BAUD_PCLK_DIV_2
|
||||
#define SPI_CLOCK_DIV4 SPI_BAUD_PCLK_DIV_4
|
||||
#define SPI_CLOCK_DIV8 SPI_BAUD_PCLK_DIV_8
|
||||
#define SPI_CLOCK_DIV16 SPI_BAUD_PCLK_DIV_16
|
||||
#define SPI_CLOCK_DIV32 SPI_BAUD_PCLK_DIV_32
|
||||
#define SPI_CLOCK_DIV64 SPI_BAUD_PCLK_DIV_64
|
||||
#define SPI_CLOCK_DIV128 SPI_BAUD_PCLK_DIV_128
|
||||
#define SPI_CLOCK_DIV256 SPI_BAUD_PCLK_DIV_256
|
||||
|
||||
/*
|
||||
* Roger Clark. 20150106
|
||||
* Commented out redundant AVR defined
|
||||
*
|
||||
#define SPI_MODE_MASK 0x0C // CPOL = bit 3, CPHA = bit 2 on SPCR
|
||||
#define SPI_CLOCK_MASK 0x03 // SPR1 = bit 1, SPR0 = bit 0 on SPCR
|
||||
#define SPI_2XCLOCK_MASK 0x01 // SPI2X = bit 0 on SPSR
|
||||
|
||||
// define SPI_AVR_EIMSK for AVR boards with external interrupt pins
|
||||
#if defined(EIMSK)
|
||||
#define SPI_AVR_EIMSK EIMSK
|
||||
#elif defined(GICR)
|
||||
#define SPI_AVR_EIMSK GICR
|
||||
#elif defined(GIMSK)
|
||||
#define SPI_AVR_EIMSK GIMSK
|
||||
#endif
|
||||
*/
|
||||
|
||||
#ifndef STM32_LSBFIRST
|
||||
#define STM32_LSBFIRST 0
|
||||
#endif
|
||||
#ifndef STM32_MSBFIRST
|
||||
#define STM32_MSBFIRST 1
|
||||
#endif
|
||||
|
||||
// PC13 or PA4
|
||||
#define BOARD_SPI_DEFAULT_SS PA4
|
||||
//#define BOARD_SPI_DEFAULT_SS PC13
|
||||
|
||||
#define SPI_MODE0 SPI_MODE_0
|
||||
#define SPI_MODE1 SPI_MODE_1
|
||||
#define SPI_MODE2 SPI_MODE_2
|
||||
#define SPI_MODE3 SPI_MODE_3
|
||||
|
||||
#define DATA_SIZE_8BIT SPI_CR1_DFF_8_BIT
|
||||
#define DATA_SIZE_16BIT SPI_CR1_DFF_16_BIT
|
||||
|
||||
typedef enum {
|
||||
SPI_STATE_IDLE,
|
||||
SPI_STATE_READY,
|
||||
SPI_STATE_RECEIVE,
|
||||
SPI_STATE_TRANSMIT,
|
||||
SPI_STATE_TRANSFER
|
||||
} spi_mode_t;
|
||||
|
||||
class SPISettings {
|
||||
public:
|
||||
SPISettings(uint32_t clock, BitOrder bitOrder, uint8_t dataMode) {
|
||||
if (__builtin_constant_p(clock))
|
||||
init_AlwaysInline(clock, bitOrder, dataMode, DATA_SIZE_8BIT);
|
||||
else
|
||||
init_MightInline(clock, bitOrder, dataMode, DATA_SIZE_8BIT);
|
||||
}
|
||||
SPISettings(uint32_t clock, BitOrder bitOrder, uint8_t dataMode, uint32_t dataSize) {
|
||||
if (__builtin_constant_p(clock))
|
||||
init_AlwaysInline(clock, bitOrder, dataMode, dataSize);
|
||||
else
|
||||
init_MightInline(clock, bitOrder, dataMode, dataSize);
|
||||
}
|
||||
SPISettings(uint32_t clock) {
|
||||
if (__builtin_constant_p(clock))
|
||||
init_AlwaysInline(clock, MSBFIRST, SPI_MODE0, DATA_SIZE_8BIT);
|
||||
else
|
||||
init_MightInline(clock, MSBFIRST, SPI_MODE0, DATA_SIZE_8BIT);
|
||||
}
|
||||
SPISettings() {
|
||||
init_AlwaysInline(4000000, MSBFIRST, SPI_MODE0, DATA_SIZE_8BIT);
|
||||
}
|
||||
private:
|
||||
void init_MightInline(uint32_t clock, BitOrder bitOrder, uint8_t dataMode, uint32_t dataSize) {
|
||||
init_AlwaysInline(clock, bitOrder, dataMode, dataSize);
|
||||
}
|
||||
void init_AlwaysInline(uint32_t clock, BitOrder bitOrder, uint8_t dataMode, uint32_t dataSize) __attribute__((__always_inline__)) {
|
||||
this->clock = clock;
|
||||
this->bitOrder = bitOrder;
|
||||
this->dataMode = dataMode;
|
||||
this->dataSize = dataSize;
|
||||
}
|
||||
uint32_t clock;
|
||||
uint32_t dataSize;
|
||||
uint32_t clockDivider;
|
||||
BitOrder bitOrder;
|
||||
uint8_t dataMode;
|
||||
uint8_t _SSPin;
|
||||
volatile spi_mode_t state;
|
||||
spi_dev *spi_d;
|
||||
dma_channel spiRxDmaChannel, spiTxDmaChannel;
|
||||
dma_dev* spiDmaDev;
|
||||
void (*receiveCallback)(void) = NULL;
|
||||
void (*transmitCallback)(void) = NULL;
|
||||
|
||||
friend class SPIClass;
|
||||
};
|
||||
|
||||
/*
|
||||
* Kept for compat.
|
||||
*/
|
||||
static const uint8_t ff = 0xFF;
|
||||
|
||||
/**
|
||||
* @brief Wirish SPI interface.
|
||||
*
|
||||
* This implementation uses software slave management, so the caller
|
||||
* is responsible for controlling the slave select line.
|
||||
*/
|
||||
class SPIClass {
|
||||
|
||||
public:
|
||||
/**
|
||||
* @param spiPortNumber Number of the SPI port to manage.
|
||||
*/
|
||||
SPIClass(uint32_t spiPortNumber);
|
||||
|
||||
/**
|
||||
* @brief Equivalent to begin(SPI_1_125MHZ, MSBFIRST, 0).
|
||||
*/
|
||||
void begin();
|
||||
|
||||
/**
|
||||
* @brief Turn on a SPI port and set its GPIO pin modes for use as a slave.
|
||||
*
|
||||
* SPI port is enabled in full duplex mode, with software slave management.
|
||||
*
|
||||
* @param bitOrder Either LSBFIRST (little-endian) or MSBFIRST(big-endian)
|
||||
* @param mode SPI mode to use
|
||||
*/
|
||||
void beginSlave(uint32_t bitOrder, uint32_t mode);
|
||||
|
||||
/**
|
||||
* @brief Equivalent to beginSlave(MSBFIRST, 0).
|
||||
*/
|
||||
void beginSlave();
|
||||
|
||||
/**
|
||||
* @brief Disables the SPI port, but leaves its GPIO pin modes unchanged.
|
||||
*/
|
||||
void end();
|
||||
|
||||
void beginTransaction(SPISettings settings) { beginTransaction(BOARD_SPI_DEFAULT_SS, settings); }
|
||||
void beginTransaction(uint8_t pin, SPISettings settings);
|
||||
void endTransaction();
|
||||
|
||||
void beginTransactionSlave(SPISettings settings);
|
||||
|
||||
void setClockDivider(uint32_t clockDivider);
|
||||
void setBitOrder(BitOrder bitOrder);
|
||||
void setDataMode(uint8_t dataMode);
|
||||
|
||||
// SPI Configuration methods
|
||||
void attachInterrupt();
|
||||
void detachInterrupt();
|
||||
|
||||
/* Victor Perez. Added to change datasize from 8 to 16 bit modes on the fly.
|
||||
* Input parameter should be SPI_CR1_DFF set to 0 or 1 on a 32bit word.
|
||||
* Requires an added function spi_data_size on STM32F1 / cores / maple / libmaple / spi.c
|
||||
*/
|
||||
void setDataSize(uint32_t ds);
|
||||
|
||||
/* Victor Perez 2017. Added to set and clear callback functions for callback
|
||||
* on DMA transfer completion.
|
||||
* onReceive used to set the callback in case of dmaTransfer (tx/rx), once rx is completed
|
||||
* onTransmit used to set the callback in case of dmaSend (tx only). That function
|
||||
* will NOT be called in case of TX/RX
|
||||
*/
|
||||
void onReceive(void(*)(void));
|
||||
void onTransmit(void(*)(void));
|
||||
|
||||
/*
|
||||
* I/O
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Return the next unread byte/word.
|
||||
*
|
||||
* If there is no unread byte/word waiting, this function will block
|
||||
* until one is received.
|
||||
*/
|
||||
uint16_t read();
|
||||
|
||||
/**
|
||||
* @brief Read length bytes, storing them into buffer.
|
||||
* @param buffer Buffer to store received bytes into.
|
||||
* @param length Number of bytes to store in buffer. This
|
||||
* function will block until the desired number of
|
||||
* bytes have been read.
|
||||
*/
|
||||
void read(uint8_t *buffer, uint32_t length);
|
||||
|
||||
/**
|
||||
* @brief Transmit one byte/word.
|
||||
* @param data to transmit.
|
||||
*/
|
||||
void write(uint16_t data);
|
||||
void write16(uint16_t data); // write 2 bytes in 8 bit mode (DFF=0)
|
||||
|
||||
/**
|
||||
* @brief Transmit one byte/word a specified number of times.
|
||||
* @param data to transmit.
|
||||
*/
|
||||
void write(uint16_t data, uint32_t n);
|
||||
|
||||
/**
|
||||
* @brief Transmit multiple bytes/words.
|
||||
* @param buffer Bytes/words to transmit.
|
||||
* @param length Number of bytes/words in buffer to transmit.
|
||||
*/
|
||||
void write(const void * buffer, uint32_t length);
|
||||
|
||||
/**
|
||||
* @brief Transmit a byte, then return the next unread byte.
|
||||
*
|
||||
* This function transmits before receiving.
|
||||
*
|
||||
* @param data Byte to transmit.
|
||||
* @return Next unread byte.
|
||||
*/
|
||||
uint8_t transfer(uint8_t data) const;
|
||||
uint16_t transfer16(uint16_t data) const;
|
||||
|
||||
/**
|
||||
* @brief Sets up a DMA Transfer for "length" bytes.
|
||||
* The transfer mode (8 or 16 bit mode) is evaluated from the SPI peripheral setting.
|
||||
*
|
||||
* This function transmits and receives to buffers.
|
||||
*
|
||||
* @param transmitBuf buffer Bytes to transmit. If passed as 0, it sends FF repeatedly for "length" bytes
|
||||
* @param receiveBuf buffer Bytes to save received data.
|
||||
* @param length Number of bytes in buffer to transmit.
|
||||
*/
|
||||
uint8_t dmaTransfer(const void * transmitBuf, void * receiveBuf, uint16_t length);
|
||||
void dmaTransferSet(const void *transmitBuf, void *receiveBuf);
|
||||
uint8_t dmaTransferRepeat(uint16_t length);
|
||||
|
||||
/**
|
||||
* @brief Sets up a DMA Transmit for SPI 8 or 16 bit transfer mode.
|
||||
* The transfer mode (8 or 16 bit mode) is evaluated from the SPI peripheral setting.
|
||||
*
|
||||
* This function only transmits and does not care about the RX fifo.
|
||||
*
|
||||
* @param data buffer half words to transmit,
|
||||
* @param length Number of bytes in buffer to transmit.
|
||||
* @param minc Set to use Memory Increment mode, clear to use Circular mode.
|
||||
*/
|
||||
uint8_t dmaSend(const void * transmitBuf, uint16_t length, bool minc = 1);
|
||||
void dmaSendSet(const void * transmitBuf, bool minc);
|
||||
uint8_t dmaSendRepeat(uint16_t length);
|
||||
|
||||
uint8_t dmaSendAsync(const void * transmitBuf, uint16_t length, bool minc = 1);
|
||||
/*
|
||||
* Pin accessors
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Return the number of the MISO (master in, slave out) pin
|
||||
*/
|
||||
uint8_t misoPin();
|
||||
|
||||
/**
|
||||
* @brief Return the number of the MOSI (master out, slave in) pin
|
||||
*/
|
||||
uint8_t mosiPin();
|
||||
|
||||
/**
|
||||
* @brief Return the number of the SCK (serial clock) pin
|
||||
*/
|
||||
uint8_t sckPin();
|
||||
|
||||
/**
|
||||
* @brief Return the number of the NSS (slave select) pin
|
||||
*/
|
||||
uint8_t nssPin();
|
||||
|
||||
/* Escape hatch */
|
||||
|
||||
/**
|
||||
* @brief Get a pointer to the underlying libmaple spi_dev for
|
||||
* this HardwareSPI instance.
|
||||
*/
|
||||
spi_dev* c_dev(void) { return _currentSetting->spi_d; }
|
||||
|
||||
spi_dev* dev() { return _currentSetting->spi_d; }
|
||||
|
||||
/**
|
||||
* @brief Sets the number of the SPI peripheral to be used by
|
||||
* this HardwareSPI instance.
|
||||
*
|
||||
* @param spi_num Number of the SPI port. 1-2 in low density devices
|
||||
* or 1-3 in high density devices.
|
||||
*/
|
||||
void setModule(int spi_num) {
|
||||
_currentSetting=&_settings[spi_num-1];// SPI channels are called 1 2 and 3 but the array is zero indexed
|
||||
}
|
||||
|
||||
/* -- The following methods are deprecated --------------------------- */
|
||||
|
||||
/**
|
||||
* @brief Deprecated.
|
||||
*
|
||||
* Use HardwareSPI::transfer() instead.
|
||||
*
|
||||
* @see HardwareSPI::transfer()
|
||||
*/
|
||||
uint8_t send(uint8_t data);
|
||||
|
||||
/**
|
||||
* @brief Deprecated.
|
||||
*
|
||||
* Use HardwareSPI::write() in combination with
|
||||
* HardwareSPI::read() (or HardwareSPI::transfer()) instead.
|
||||
*
|
||||
* @see HardwareSPI::write()
|
||||
* @see HardwareSPI::read()
|
||||
* @see HardwareSPI::transfer()
|
||||
*/
|
||||
uint8_t send(uint8_t *data, uint32_t length);
|
||||
|
||||
/**
|
||||
* @brief Deprecated.
|
||||
*
|
||||
* Use HardwareSPI::read() instead.
|
||||
*
|
||||
* @see HardwareSPI::read()
|
||||
*/
|
||||
uint8_t recv();
|
||||
|
||||
private:
|
||||
|
||||
SPISettings _settings[BOARD_NR_SPI];
|
||||
SPISettings *_currentSetting;
|
||||
|
||||
void updateSettings();
|
||||
|
||||
/*
|
||||
* Functions added for DMA transfers with Callback.
|
||||
* Experimental.
|
||||
*/
|
||||
|
||||
void EventCallback();
|
||||
|
||||
#if BOARD_NR_SPI >= 1
|
||||
static void _spi1EventCallback();
|
||||
#endif
|
||||
#if BOARD_NR_SPI >= 2
|
||||
static void _spi2EventCallback();
|
||||
#endif
|
||||
#if BOARD_NR_SPI >= 3
|
||||
static void _spi3EventCallback();
|
||||
#endif
|
||||
/*
|
||||
spi_dev *spi_d;
|
||||
uint8_t _SSPin;
|
||||
uint32_t clockDivider;
|
||||
uint8_t dataMode;
|
||||
BitOrder bitOrder;
|
||||
*/
|
||||
};
|
||||
|
||||
extern SPIClass SPI;
|
||||
@@ -0,0 +1,60 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#if defined(__STM32F1__) && !defined(HAVE_SW_SERIAL)
|
||||
|
||||
/**
|
||||
* Empty class for Software Serial implementation (Custom RX/TX pins)
|
||||
*
|
||||
* TODO: Optionally use https://github.com/FYSETC/SoftwareSerialM if TMC UART is wanted
|
||||
*/
|
||||
|
||||
#include "SoftwareSerial.h"
|
||||
|
||||
// Constructor
|
||||
|
||||
SoftwareSerial::SoftwareSerial(int8_t RX_pin, int8_t TX_pin) {}
|
||||
|
||||
// Public
|
||||
|
||||
void SoftwareSerial::begin(const uint32_t baudrate) {
|
||||
}
|
||||
|
||||
bool SoftwareSerial::available() {
|
||||
return false;
|
||||
}
|
||||
|
||||
uint8_t SoftwareSerial::read() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint16_t SoftwareSerial::write(uint8_t byte) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void SoftwareSerial::flush() {}
|
||||
|
||||
void SoftwareSerial::listen() {
|
||||
listening = true;
|
||||
}
|
||||
|
||||
void SoftwareSerial::stopListening() {
|
||||
listening = false;
|
||||
}
|
||||
|
||||
#endif //__STM32F1__
|
||||
@@ -0,0 +1,42 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define SW_SERIAL_PLACEHOLDER 1
|
||||
|
||||
class SoftwareSerial {
|
||||
public:
|
||||
SoftwareSerial(int8_t RX_pin, int8_t TX_pin);
|
||||
|
||||
void begin(const uint32_t baudrate);
|
||||
|
||||
bool available();
|
||||
|
||||
uint8_t read();
|
||||
uint16_t write(uint8_t byte);
|
||||
void flush();
|
||||
|
||||
void listen();
|
||||
void stopListening();
|
||||
|
||||
protected:
|
||||
bool listening;
|
||||
};
|
||||
@@ -38,8 +38,8 @@
|
||||
#define _SET_OUTPUT(IO) _SET_MODE(IO, GPIO_OUTPUT_PP)
|
||||
#define _SET_OUTPUT_OD(IO) _SET_MODE(IO, GPIO_OUTPUT_OD)
|
||||
|
||||
#define OUT_WRITE(IO,V) do{ _SET_OUTPUT(IO); WRITE(IO,V); } while(0)
|
||||
#define OUT_WRITE_OD(IO,V) do{ _SET_OUTPUT_OD(IO); WRITE(IO,V); } while(0)
|
||||
#define OUT_WRITE(IO,V) do{ _SET_OUTPUT(IO); WRITE(IO,V); }while(0)
|
||||
#define OUT_WRITE_OD(IO,V) do{ _SET_OUTPUT_OD(IO); WRITE(IO,V); }while(0)
|
||||
|
||||
#define SET_INPUT(IO) _SET_MODE(IO, GPIO_INPUT_FLOATING)
|
||||
#define SET_INPUT_PULLUP(IO) _SET_MODE(IO, GPIO_INPUT_PU)
|
||||
|
||||
@@ -26,7 +26,18 @@
|
||||
|
||||
#include "../shared/persistent_store_api.h"
|
||||
|
||||
bool PersistentStore::access_start() { return true; }
|
||||
bool PersistentStore::access_start() {
|
||||
#if ENABLED(SPI_EEPROM)
|
||||
#if SPI_CHAN_EEPROM1 == 1
|
||||
SET_OUTPUT(BOARD_SPI1_SCK_PIN);
|
||||
SET_OUTPUT(BOARD_SPI1_MOSI_PIN);
|
||||
SET_INPUT(BOARD_SPI1_MISO_PIN);
|
||||
SET_OUTPUT(SPI_EEPROM1_CS);
|
||||
#endif
|
||||
spiInit(0);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
bool PersistentStore::access_finish() { return true; }
|
||||
|
||||
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
|
||||
|
||||
@@ -42,7 +42,6 @@
|
||||
// Store settings in the last two pages
|
||||
// Flash pages must be erased before writing, so keep track.
|
||||
bool firstWrite = false;
|
||||
uint32_t pageBase = EEPROM_START_ADDRESS;
|
||||
|
||||
bool PersistentStore::access_start() {
|
||||
firstWrite = true;
|
||||
@@ -67,42 +66,27 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
|
||||
firstWrite = false;
|
||||
}
|
||||
|
||||
// First write full words
|
||||
int i = 0;
|
||||
int wordsToWrite = size / sizeof(uint16_t);
|
||||
uint16_t* wordBuffer = (uint16_t *)value;
|
||||
while (wordsToWrite) {
|
||||
status = FLASH_ProgramHalfWord(pageBase + pos + (i * 2), wordBuffer[i]);
|
||||
if (status != FLASH_COMPLETE) return true;
|
||||
wordsToWrite--;
|
||||
i++;
|
||||
}
|
||||
|
||||
// Now, write any remaining single byte
|
||||
const uint16_t odd = size & 1;
|
||||
if (odd) {
|
||||
uint16_t temp = value[size - 1];
|
||||
status = FLASH_ProgramHalfWord(pageBase + pos + i, temp);
|
||||
if (status != FLASH_COMPLETE) return true;
|
||||
for (size_t i = 0; i < size; i++) {
|
||||
if (FLASH_ProgramHalfWord(EEPROM_PAGE0_BASE + (pos + i) * 2, value[i]) != FLASH_COMPLETE)
|
||||
return true;
|
||||
}
|
||||
|
||||
crc16(crc, value, size);
|
||||
pos += size + odd;
|
||||
pos += size;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool PersistentStore::read_data(int &pos, uint8_t* value, const size_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||
for (uint16_t i = 0; i < size; i++) {
|
||||
byte* accessPoint = (byte*)(pageBase + pos + i);
|
||||
uint8_t c = *accessPoint;
|
||||
if (writing) value[i] = c;
|
||||
crc16(crc, &c, 1);
|
||||
for (size_t i = 0; i < size; i++) {
|
||||
uint8_t v = *(uint16_t *)(EEPROM_PAGE0_BASE + (pos + i) * 2);
|
||||
if (writing) value[i] = v;
|
||||
crc16(crc, &v, 1);
|
||||
}
|
||||
pos += ((size + 1) & ~1); // i.e., size+(size&1), round up odd values
|
||||
pos += size;
|
||||
return false;
|
||||
}
|
||||
|
||||
size_t PersistentStore::capacity() { return E2END + 1; }
|
||||
size_t PersistentStore::capacity() { return size_t(E2END + 1); }
|
||||
|
||||
#endif // EEPROM_SETTINGS && EEPROM FLASH
|
||||
#endif // __STM32F1__
|
||||
|
||||
@@ -52,7 +52,7 @@ static char _ALIGN(4) HAL_eeprom_data[HAL_EEPROM_SIZE];
|
||||
|
||||
SdFile file, root = card.getroot();
|
||||
if (!file.open(&root, EEPROM_FILENAME, O_RDONLY))
|
||||
return false;
|
||||
return true; // false aborts the save
|
||||
|
||||
int bytes_read = file.read(HAL_eeprom_data, HAL_EEPROM_SIZE);
|
||||
if (bytes_read < 0) return false;
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef defined(STM32F4) && USBCON
|
||||
#if defined(STM32F4) && USBCON
|
||||
#include <USBSerial.h>
|
||||
#endif
|
||||
|
||||
@@ -100,8 +100,6 @@
|
||||
#define NUM_SERIAL 1
|
||||
#endif
|
||||
|
||||
#define _BV(b) (1 << (b))
|
||||
|
||||
/**
|
||||
* TODO: review this to return 1 for pins that are not analog input
|
||||
*/
|
||||
@@ -142,7 +140,7 @@ typedef int8_t pin_t;
|
||||
// Public Variables
|
||||
// ------------------------
|
||||
|
||||
/** result of last ADC conversion */
|
||||
// Result of last ADC conversion
|
||||
extern uint16_t HAL_adc_result;
|
||||
|
||||
// ------------------------
|
||||
@@ -154,14 +152,17 @@ extern uint16_t HAL_adc_result;
|
||||
|
||||
inline void HAL_init(void) { }
|
||||
|
||||
/** clear reset reason */
|
||||
// Clear reset reason
|
||||
void HAL_clear_reset_source (void);
|
||||
|
||||
/** reset reason */
|
||||
// Reset reason
|
||||
uint8_t HAL_get_reset_source(void);
|
||||
|
||||
void _delay_ms(const int delay);
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wunused-function"
|
||||
|
||||
/*
|
||||
extern "C" {
|
||||
int freeMemory(void);
|
||||
@@ -183,15 +184,17 @@ static int freeMemory() {
|
||||
return &top - reinterpret_cast<char*>(_sbrk(0));
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
//
|
||||
// SPI: Extended functions which take a channel number (hardware SPI only)
|
||||
//
|
||||
|
||||
/** Write single byte to specified SPI channel */
|
||||
// Write single byte to specified SPI channel
|
||||
void spiSend(uint32_t chan, byte 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);
|
||||
/** Read single byte from specified SPI channel */
|
||||
// Read single byte from specified SPI channel
|
||||
uint8_t spiRec(uint32_t chan);
|
||||
|
||||
//
|
||||
|
||||
@@ -53,56 +53,40 @@ void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency) {
|
||||
switch (timer_num) {
|
||||
case STEP_TIMER_NUM:
|
||||
// STEPPER TIMER TIM5 - use a 32bit timer
|
||||
#ifdef STM32GENERIC
|
||||
__HAL_RCC_TIM5_CLK_ENABLE();
|
||||
TimerHandle[timer_num].handle.Instance = TIM5;
|
||||
TimerHandle[timer_num].handle.Init.Prescaler = step_prescaler;
|
||||
TimerHandle[timer_num].handle.Init.CounterMode = TIM_COUNTERMODE_UP;
|
||||
TimerHandle[timer_num].handle.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
|
||||
TimerHandle[timer_num].callback = (uint32_t)TC5_Handler;
|
||||
#else
|
||||
TimerHandle[timer_num].timer = TIM5;
|
||||
TimerHandle[timer_num].irqHandle = TC5_Handler;
|
||||
TimerHandleInit(&TimerHandle[timer_num], (((HAL_TIMER_RATE) / step_prescaler) / frequency) - 1, step_prescaler);
|
||||
#endif
|
||||
__HAL_RCC_TIM5_CLK_ENABLE();
|
||||
TimerHandle[timer_num].handle.Instance = TIM5;
|
||||
TimerHandle[timer_num].handle.Init.Prescaler = step_prescaler;
|
||||
TimerHandle[timer_num].handle.Init.CounterMode = TIM_COUNTERMODE_UP;
|
||||
TimerHandle[timer_num].handle.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
|
||||
TimerHandle[timer_num].callback = (uint32_t)TC5_Handler;
|
||||
HAL_NVIC_SetPriority(STEP_TIMER_IRQ_ID, 1, 0);
|
||||
break;
|
||||
|
||||
case TEMP_TIMER_NUM:
|
||||
// TEMP TIMER TIM7 - any available 16bit Timer (1 already used for PWM)
|
||||
#ifdef STM32GENERIC
|
||||
__HAL_RCC_TIM7_CLK_ENABLE();
|
||||
TimerHandle[timer_num].handle.Instance = TIM7;
|
||||
TimerHandle[timer_num].handle.Init.Prescaler = temp_prescaler;
|
||||
TimerHandle[timer_num].handle.Init.CounterMode = TIM_COUNTERMODE_UP;
|
||||
TimerHandle[timer_num].handle.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
|
||||
TimerHandle[timer_num].callback = (uint32_t)TC7_Handler;
|
||||
#else
|
||||
TimerHandle[timer_num].timer = TIM7;
|
||||
TimerHandle[timer_num].irqHandle = TC7_Handler;
|
||||
TimerHandleInit(&TimerHandle[timer_num], (((HAL_TIMER_RATE) / temp_prescaler) / frequency) - 1, temp_prescaler);
|
||||
#endif
|
||||
__HAL_RCC_TIM7_CLK_ENABLE();
|
||||
TimerHandle[timer_num].handle.Instance = TIM7;
|
||||
TimerHandle[timer_num].handle.Init.Prescaler = temp_prescaler;
|
||||
TimerHandle[timer_num].handle.Init.CounterMode = TIM_COUNTERMODE_UP;
|
||||
TimerHandle[timer_num].handle.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
|
||||
TimerHandle[timer_num].callback = (uint32_t)TC7_Handler;
|
||||
HAL_NVIC_SetPriority(TEMP_TIMER_IRQ_ID, 2, 0);
|
||||
break;
|
||||
}
|
||||
timers_initialized[timer_num] = true;
|
||||
}
|
||||
|
||||
#ifdef STM32GENERIC
|
||||
TimerHandle[timer_num].handle.Init.Period = (((HAL_TIMER_RATE) / TimerHandle[timer_num].handle.Init.Prescaler) / frequency) - 1;
|
||||
if (HAL_TIM_Base_Init(&TimerHandle[timer_num].handle) == HAL_OK)
|
||||
HAL_TIM_Base_Start_IT(&TimerHandle[timer_num].handle);
|
||||
#endif
|
||||
TimerHandle[timer_num].handle.Init.Period = (((HAL_TIMER_RATE) / TimerHandle[timer_num].handle.Init.Prescaler) / frequency) - 1;
|
||||
if (HAL_TIM_Base_Init(&TimerHandle[timer_num].handle) == HAL_OK)
|
||||
HAL_TIM_Base_Start_IT(&TimerHandle[timer_num].handle);
|
||||
}
|
||||
|
||||
#ifdef STM32GENERIC
|
||||
extern "C" void TIM5_IRQHandler() {
|
||||
((void(*)(void))TimerHandle[0].callback)();
|
||||
}
|
||||
extern "C" void TIM7_IRQHandler() {
|
||||
((void(*)(void))TimerHandle[1].callback)();
|
||||
}
|
||||
#endif
|
||||
extern "C" void TIM5_IRQHandler() {
|
||||
((void(*)(void))TimerHandle[0].callback)();
|
||||
}
|
||||
extern "C" void TIM7_IRQHandler() {
|
||||
((void(*)(void))TimerHandle[1].callback)();
|
||||
}
|
||||
|
||||
void HAL_timer_enable_interrupt(const uint8_t timer_num) {
|
||||
switch (timer_num) {
|
||||
|
||||
@@ -59,8 +59,9 @@ void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency) {
|
||||
timerConfig[0].IRQ_Id = TIM5_IRQn;
|
||||
timerConfig[0].callback = (uint32_t)TC5_Handler;
|
||||
HAL_NVIC_SetPriority(timerConfig[0].IRQ_Id, 1, 0);
|
||||
SET_OUTPUT(STEPPER_ENABLE_PIN);
|
||||
WRITE(STEPPER_ENABLE_PIN);
|
||||
#if PIN_EXISTS(STEPPER_ENABLE)
|
||||
OUT_WRITE(STEPPER_ENABLE_PIN, HIGH);
|
||||
#endif
|
||||
break;
|
||||
case TEMP_TIMER_NUM:
|
||||
//TEMP TIMER TIM7 // any available 16bit Timer (1 already used for PWM)
|
||||
|
||||
@@ -189,7 +189,6 @@ void TMC26XStepper::start() {
|
||||
pinMode(step_pin, OUTPUT);
|
||||
pinMode(dir_pin, OUTPUT);
|
||||
pinMode(cs_pin, OUTPUT);
|
||||
//SET_OUTPUT(STEPPER_ENABLE_PIN);
|
||||
extDigitalWrite(step_pin, LOW);
|
||||
extDigitalWrite(dir_pin, LOW);
|
||||
extDigitalWrite(cs_pin, HIGH);
|
||||
|
||||
@@ -86,6 +86,8 @@ uint16_t EE_Initialize(void) {
|
||||
pEraseInit.NbSectors = 1;
|
||||
pEraseInit.VoltageRange = VOLTAGE_RANGE;
|
||||
|
||||
HAL_StatusTypeDef FlashStatus; // = HAL_OK
|
||||
|
||||
/* Check for invalid header states and repair if necessary */
|
||||
uint32_t SectorError;
|
||||
switch (PageStatus0) {
|
||||
@@ -135,7 +137,7 @@ uint16_t EE_Initialize(void) {
|
||||
}
|
||||
}
|
||||
/* Mark Page0 as valid */
|
||||
HAL_StatusTypeDef FlashStatus = HAL_FLASH_Program(TYPEPROGRAM_HALFWORD, PAGE0_BASE_ADDRESS, VALID_PAGE);
|
||||
FlashStatus = HAL_FLASH_Program(TYPEPROGRAM_HALFWORD, PAGE0_BASE_ADDRESS, VALID_PAGE);
|
||||
/* If program operation was failed, a Flash error code is returned */
|
||||
if (FlashStatus != HAL_OK) return FlashStatus;
|
||||
pEraseInit.Sector = PAGE1_ID;
|
||||
|
||||
@@ -27,8 +27,6 @@
|
||||
* These use GPIO functions instead of Direct Port Manipulation, as on AVR.
|
||||
*/
|
||||
|
||||
#define _BV(b) (1 << (b))
|
||||
|
||||
#define READ(IO) digitalRead(IO)
|
||||
#define WRITE(IO,V) digitalWrite(IO,V)
|
||||
|
||||
@@ -66,127 +64,141 @@
|
||||
|
||||
#define _STM32_PIN(P,PN) ((PORT##P * 16) + PN)
|
||||
|
||||
#define PA0 _STM32_PIN(A, 0)
|
||||
#define PA1 _STM32_PIN(A, 1)
|
||||
#define PA2 _STM32_PIN(A, 2)
|
||||
#define PA3 _STM32_PIN(A, 3)
|
||||
#define PA4 _STM32_PIN(A, 4)
|
||||
#define PA5 _STM32_PIN(A, 5)
|
||||
#define PA6 _STM32_PIN(A, 6)
|
||||
#define PA7 _STM32_PIN(A, 7)
|
||||
#define PA8 _STM32_PIN(A, 8)
|
||||
#define PA9 _STM32_PIN(A, 9)
|
||||
#define PA10 _STM32_PIN(A, 10)
|
||||
#define PA11 _STM32_PIN(A, 11)
|
||||
#define PA12 _STM32_PIN(A, 12)
|
||||
#define PA13 _STM32_PIN(A, 13)
|
||||
#define PA14 _STM32_PIN(A, 14)
|
||||
#define PA15 _STM32_PIN(A, 15)
|
||||
#ifndef PA0
|
||||
#define PA0 _STM32_PIN(A, 0)
|
||||
#define PA1 _STM32_PIN(A, 1)
|
||||
#define PA2 _STM32_PIN(A, 2)
|
||||
#define PA3 _STM32_PIN(A, 3)
|
||||
#define PA4 _STM32_PIN(A, 4)
|
||||
#define PA5 _STM32_PIN(A, 5)
|
||||
#define PA6 _STM32_PIN(A, 6)
|
||||
#define PA7 _STM32_PIN(A, 7)
|
||||
#define PA8 _STM32_PIN(A, 8)
|
||||
#define PA9 _STM32_PIN(A, 9)
|
||||
#define PA10 _STM32_PIN(A, 10)
|
||||
#define PA11 _STM32_PIN(A, 11)
|
||||
#define PA12 _STM32_PIN(A, 12)
|
||||
#define PA13 _STM32_PIN(A, 13)
|
||||
#define PA14 _STM32_PIN(A, 14)
|
||||
#define PA15 _STM32_PIN(A, 15)
|
||||
#endif
|
||||
|
||||
#define PB0 _STM32_PIN(B, 0)
|
||||
#define PB1 _STM32_PIN(B, 1)
|
||||
#define PB2 _STM32_PIN(B, 2)
|
||||
#define PB3 _STM32_PIN(B, 3)
|
||||
#define PB4 _STM32_PIN(B, 4)
|
||||
#define PB5 _STM32_PIN(B, 5)
|
||||
#define PB6 _STM32_PIN(B, 6)
|
||||
#define PB7 _STM32_PIN(B, 7)
|
||||
#define PB8 _STM32_PIN(B, 8)
|
||||
#define PB9 _STM32_PIN(B, 9)
|
||||
#define PB10 _STM32_PIN(B, 10)
|
||||
#define PB11 _STM32_PIN(B, 11)
|
||||
#define PB12 _STM32_PIN(B, 12)
|
||||
#define PB13 _STM32_PIN(B, 13)
|
||||
#define PB14 _STM32_PIN(B, 14)
|
||||
#define PB15 _STM32_PIN(B, 15)
|
||||
#ifndef PB0
|
||||
#define PB0 _STM32_PIN(B, 0)
|
||||
#define PB1 _STM32_PIN(B, 1)
|
||||
#define PB2 _STM32_PIN(B, 2)
|
||||
#define PB3 _STM32_PIN(B, 3)
|
||||
#define PB4 _STM32_PIN(B, 4)
|
||||
#define PB5 _STM32_PIN(B, 5)
|
||||
#define PB6 _STM32_PIN(B, 6)
|
||||
#define PB7 _STM32_PIN(B, 7)
|
||||
#define PB8 _STM32_PIN(B, 8)
|
||||
#define PB9 _STM32_PIN(B, 9)
|
||||
#define PB10 _STM32_PIN(B, 10)
|
||||
#define PB11 _STM32_PIN(B, 11)
|
||||
#define PB12 _STM32_PIN(B, 12)
|
||||
#define PB13 _STM32_PIN(B, 13)
|
||||
#define PB14 _STM32_PIN(B, 14)
|
||||
#define PB15 _STM32_PIN(B, 15)
|
||||
#endif
|
||||
|
||||
#define PC0 _STM32_PIN(C, 0)
|
||||
#define PC1 _STM32_PIN(C, 1)
|
||||
#define PC2 _STM32_PIN(C, 2)
|
||||
#define PC3 _STM32_PIN(C, 3)
|
||||
#define PC4 _STM32_PIN(C, 4)
|
||||
#define PC5 _STM32_PIN(C, 5)
|
||||
#define PC6 _STM32_PIN(C, 6)
|
||||
#define PC7 _STM32_PIN(C, 7)
|
||||
#define PC8 _STM32_PIN(C, 8)
|
||||
#define PC9 _STM32_PIN(C, 9)
|
||||
#define PC10 _STM32_PIN(C, 10)
|
||||
#define PC11 _STM32_PIN(C, 11)
|
||||
#define PC12 _STM32_PIN(C, 12)
|
||||
#define PC13 _STM32_PIN(C, 13)
|
||||
#define PC14 _STM32_PIN(C, 14)
|
||||
#define PC15 _STM32_PIN(C, 15)
|
||||
#ifndef PC0
|
||||
#define PC0 _STM32_PIN(C, 0)
|
||||
#define PC1 _STM32_PIN(C, 1)
|
||||
#define PC2 _STM32_PIN(C, 2)
|
||||
#define PC3 _STM32_PIN(C, 3)
|
||||
#define PC4 _STM32_PIN(C, 4)
|
||||
#define PC5 _STM32_PIN(C, 5)
|
||||
#define PC6 _STM32_PIN(C, 6)
|
||||
#define PC7 _STM32_PIN(C, 7)
|
||||
#define PC8 _STM32_PIN(C, 8)
|
||||
#define PC9 _STM32_PIN(C, 9)
|
||||
#define PC10 _STM32_PIN(C, 10)
|
||||
#define PC11 _STM32_PIN(C, 11)
|
||||
#define PC12 _STM32_PIN(C, 12)
|
||||
#define PC13 _STM32_PIN(C, 13)
|
||||
#define PC14 _STM32_PIN(C, 14)
|
||||
#define PC15 _STM32_PIN(C, 15)
|
||||
#endif
|
||||
|
||||
#define PD0 _STM32_PIN(D, 0)
|
||||
#define PD1 _STM32_PIN(D, 1)
|
||||
#define PD2 _STM32_PIN(D, 2)
|
||||
#define PD3 _STM32_PIN(D, 3)
|
||||
#define PD4 _STM32_PIN(D, 4)
|
||||
#define PD5 _STM32_PIN(D, 5)
|
||||
#define PD6 _STM32_PIN(D, 6)
|
||||
#define PD7 _STM32_PIN(D, 7)
|
||||
#define PD8 _STM32_PIN(D, 8)
|
||||
#define PD9 _STM32_PIN(D, 9)
|
||||
#define PD10 _STM32_PIN(D, 10)
|
||||
#define PD11 _STM32_PIN(D, 11)
|
||||
#define PD12 _STM32_PIN(D, 12)
|
||||
#define PD13 _STM32_PIN(D, 13)
|
||||
#define PD14 _STM32_PIN(D, 14)
|
||||
#define PD15 _STM32_PIN(D, 15)
|
||||
#ifndef PD0
|
||||
#define PD0 _STM32_PIN(D, 0)
|
||||
#define PD1 _STM32_PIN(D, 1)
|
||||
#define PD2 _STM32_PIN(D, 2)
|
||||
#define PD3 _STM32_PIN(D, 3)
|
||||
#define PD4 _STM32_PIN(D, 4)
|
||||
#define PD5 _STM32_PIN(D, 5)
|
||||
#define PD6 _STM32_PIN(D, 6)
|
||||
#define PD7 _STM32_PIN(D, 7)
|
||||
#define PD8 _STM32_PIN(D, 8)
|
||||
#define PD9 _STM32_PIN(D, 9)
|
||||
#define PD10 _STM32_PIN(D, 10)
|
||||
#define PD11 _STM32_PIN(D, 11)
|
||||
#define PD12 _STM32_PIN(D, 12)
|
||||
#define PD13 _STM32_PIN(D, 13)
|
||||
#define PD14 _STM32_PIN(D, 14)
|
||||
#define PD15 _STM32_PIN(D, 15)
|
||||
#endif
|
||||
|
||||
#define PE0 _STM32_PIN(E, 0)
|
||||
#define PE1 _STM32_PIN(E, 1)
|
||||
#define PE2 _STM32_PIN(E, 2)
|
||||
#define PE3 _STM32_PIN(E, 3)
|
||||
#define PE4 _STM32_PIN(E, 4)
|
||||
#define PE5 _STM32_PIN(E, 5)
|
||||
#define PE6 _STM32_PIN(E, 6)
|
||||
#define PE7 _STM32_PIN(E, 7)
|
||||
#define PE8 _STM32_PIN(E, 8)
|
||||
#define PE9 _STM32_PIN(E, 9)
|
||||
#define PE10 _STM32_PIN(E, 10)
|
||||
#define PE11 _STM32_PIN(E, 11)
|
||||
#define PE12 _STM32_PIN(E, 12)
|
||||
#define PE13 _STM32_PIN(E, 13)
|
||||
#define PE14 _STM32_PIN(E, 14)
|
||||
#define PE15 _STM32_PIN(E, 15)
|
||||
#ifndef PE0
|
||||
#define PE0 _STM32_PIN(E, 0)
|
||||
#define PE1 _STM32_PIN(E, 1)
|
||||
#define PE2 _STM32_PIN(E, 2)
|
||||
#define PE3 _STM32_PIN(E, 3)
|
||||
#define PE4 _STM32_PIN(E, 4)
|
||||
#define PE5 _STM32_PIN(E, 5)
|
||||
#define PE6 _STM32_PIN(E, 6)
|
||||
#define PE7 _STM32_PIN(E, 7)
|
||||
#define PE8 _STM32_PIN(E, 8)
|
||||
#define PE9 _STM32_PIN(E, 9)
|
||||
#define PE10 _STM32_PIN(E, 10)
|
||||
#define PE11 _STM32_PIN(E, 11)
|
||||
#define PE12 _STM32_PIN(E, 12)
|
||||
#define PE13 _STM32_PIN(E, 13)
|
||||
#define PE14 _STM32_PIN(E, 14)
|
||||
#define PE15 _STM32_PIN(E, 15)
|
||||
#endif
|
||||
|
||||
#ifdef STM32F7
|
||||
#define PORTF 5
|
||||
#define PORTG 6
|
||||
|
||||
#define PF0 _STM32_PIN(F, 0)
|
||||
#define PF1 _STM32_PIN(F, 1)
|
||||
#define PF2 _STM32_PIN(F, 2)
|
||||
#define PF3 _STM32_PIN(F, 3)
|
||||
#define PF4 _STM32_PIN(F, 4)
|
||||
#define PF5 _STM32_PIN(F, 5)
|
||||
#define PF6 _STM32_PIN(F, 6)
|
||||
#define PF7 _STM32_PIN(F, 7)
|
||||
#define PF8 _STM32_PIN(F, 8)
|
||||
#define PF9 _STM32_PIN(F, 9)
|
||||
#define PF10 _STM32_PIN(F, 10)
|
||||
#define PF11 _STM32_PIN(F, 11)
|
||||
#define PF12 _STM32_PIN(F, 12)
|
||||
#define PF13 _STM32_PIN(F, 13)
|
||||
#define PF14 _STM32_PIN(F, 14)
|
||||
#define PF15 _STM32_PIN(F, 15)
|
||||
#ifndef PF0
|
||||
#define PORTF 5
|
||||
#define PF0 _STM32_PIN(F, 0)
|
||||
#define PF1 _STM32_PIN(F, 1)
|
||||
#define PF2 _STM32_PIN(F, 2)
|
||||
#define PF3 _STM32_PIN(F, 3)
|
||||
#define PF4 _STM32_PIN(F, 4)
|
||||
#define PF5 _STM32_PIN(F, 5)
|
||||
#define PF6 _STM32_PIN(F, 6)
|
||||
#define PF7 _STM32_PIN(F, 7)
|
||||
#define PF8 _STM32_PIN(F, 8)
|
||||
#define PF9 _STM32_PIN(F, 9)
|
||||
#define PF10 _STM32_PIN(F, 10)
|
||||
#define PF11 _STM32_PIN(F, 11)
|
||||
#define PF12 _STM32_PIN(F, 12)
|
||||
#define PF13 _STM32_PIN(F, 13)
|
||||
#define PF14 _STM32_PIN(F, 14)
|
||||
#define PF15 _STM32_PIN(F, 15)
|
||||
#endif
|
||||
|
||||
#define PG0 _STM32_PIN(G, 0)
|
||||
#define PG1 _STM32_PIN(G, 1)
|
||||
#define PG2 _STM32_PIN(G, 2)
|
||||
#define PG3 _STM32_PIN(G, 3)
|
||||
#define PG4 _STM32_PIN(G, 4)
|
||||
#define PG5 _STM32_PIN(G, 5)
|
||||
#define PG6 _STM32_PIN(G, 6)
|
||||
#define PG7 _STM32_PIN(G, 7)
|
||||
#define PG8 _STM32_PIN(G, 8)
|
||||
#define PG9 _STM32_PIN(G, 9)
|
||||
#define PG10 _STM32_PIN(G, 10)
|
||||
#define PG11 _STM32_PIN(G, 11)
|
||||
#define PG12 _STM32_PIN(G, 12)
|
||||
#define PG13 _STM32_PIN(G, 13)
|
||||
#define PG14 _STM32_PIN(G, 14)
|
||||
#define PG15 _STM32_PIN(G, 15)
|
||||
#ifndef PG0
|
||||
#define PORTG 6
|
||||
#define PG0 _STM32_PIN(G, 0)
|
||||
#define PG1 _STM32_PIN(G, 1)
|
||||
#define PG2 _STM32_PIN(G, 2)
|
||||
#define PG3 _STM32_PIN(G, 3)
|
||||
#define PG4 _STM32_PIN(G, 4)
|
||||
#define PG5 _STM32_PIN(G, 5)
|
||||
#define PG6 _STM32_PIN(G, 6)
|
||||
#define PG7 _STM32_PIN(G, 7)
|
||||
#define PG8 _STM32_PIN(G, 8)
|
||||
#define PG9 _STM32_PIN(G, 9)
|
||||
#define PG10 _STM32_PIN(G, 10)
|
||||
#define PG11 _STM32_PIN(G, 11)
|
||||
#define PG12 _STM32_PIN(G, 12)
|
||||
#define PG13 _STM32_PIN(G, 13)
|
||||
#define PG14 _STM32_PIN(G, 14)
|
||||
#define PG15 _STM32_PIN(G, 15)
|
||||
#endif
|
||||
|
||||
#endif // STM32GENERIC && STM32F7
|
||||
|
||||
@@ -97,9 +97,12 @@ uint8_t HAL_get_reset_source(void);
|
||||
|
||||
FORCE_INLINE void _delay_ms(const int delay_ms) { delay(delay_ms); }
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wunused-function"
|
||||
extern "C" {
|
||||
int freeMemory(void);
|
||||
}
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
// SPI: Extended functions which take a channel number (hardware SPI only)
|
||||
|
||||
|
||||
@@ -95,24 +95,27 @@ typedef int8_t pin_t;
|
||||
|
||||
inline void HAL_init(void) { }
|
||||
|
||||
/** clear reset reason */
|
||||
// Clear reset reason
|
||||
void HAL_clear_reset_source(void);
|
||||
|
||||
/** reset reason */
|
||||
// Reset reason
|
||||
uint8_t HAL_get_reset_source(void);
|
||||
|
||||
FORCE_INLINE void _delay_ms(const int delay_ms) { delay(delay_ms); }
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wunused-function"
|
||||
extern "C" {
|
||||
int freeMemory(void);
|
||||
}
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
// SPI: Extended functions which take a channel number (hardware SPI only)
|
||||
/** Write single byte to specified SPI channel */
|
||||
// Write single byte to specified SPI channel
|
||||
void spiSend(uint32_t chan, byte 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);
|
||||
/** Read single byte from specified SPI channel */
|
||||
// Read single byte from specified SPI channel
|
||||
uint8_t spiRec(uint32_t chan);
|
||||
|
||||
// ADC
|
||||
|
||||
+42
-12
@@ -65,7 +65,7 @@
|
||||
#include "feature/host_actions.h"
|
||||
#endif
|
||||
|
||||
#if HAS_BUZZER && DISABLED(LCD_USE_I2C_BUZZER)
|
||||
#if USE_BEEPER
|
||||
#include "libs/buzzer.h"
|
||||
#endif
|
||||
|
||||
@@ -290,6 +290,15 @@ void enable_all_steppers() {
|
||||
enable_E5();
|
||||
}
|
||||
|
||||
void enable_e_steppers() {
|
||||
enable_E0();
|
||||
enable_E1();
|
||||
enable_E2();
|
||||
enable_E3();
|
||||
enable_E4();
|
||||
enable_E5();
|
||||
}
|
||||
|
||||
void disable_e_steppers() {
|
||||
disable_E0();
|
||||
disable_E1();
|
||||
@@ -539,28 +548,28 @@ void manage_inactivity(const bool ignore_stepper_queue/*=false*/) {
|
||||
#if ENABLED(SWITCHING_EXTRUDER)
|
||||
bool oldstatus;
|
||||
switch (active_extruder) {
|
||||
default: oldstatus = E0_ENABLE_READ; enable_E0(); break;
|
||||
default: oldstatus = E0_ENABLE_READ(); enable_E0(); break;
|
||||
#if E_STEPPERS > 1
|
||||
case 2: case 3: oldstatus = E1_ENABLE_READ; enable_E1(); break;
|
||||
case 2: case 3: oldstatus = E1_ENABLE_READ(); enable_E1(); break;
|
||||
#if E_STEPPERS > 2
|
||||
case 4: case 5: oldstatus = E2_ENABLE_READ; enable_E2(); break;
|
||||
case 4: case 5: oldstatus = E2_ENABLE_READ(); enable_E2(); break;
|
||||
#endif // E_STEPPERS > 2
|
||||
#endif // E_STEPPERS > 1
|
||||
}
|
||||
#else // !SWITCHING_EXTRUDER
|
||||
bool oldstatus;
|
||||
switch (active_extruder) {
|
||||
default: oldstatus = E0_ENABLE_READ; enable_E0(); break;
|
||||
default: oldstatus = E0_ENABLE_READ(); enable_E0(); break;
|
||||
#if E_STEPPERS > 1
|
||||
case 1: oldstatus = E1_ENABLE_READ; enable_E1(); break;
|
||||
case 1: oldstatus = E1_ENABLE_READ(); enable_E1(); break;
|
||||
#if E_STEPPERS > 2
|
||||
case 2: oldstatus = E2_ENABLE_READ; enable_E2(); break;
|
||||
case 2: oldstatus = E2_ENABLE_READ(); enable_E2(); break;
|
||||
#if E_STEPPERS > 3
|
||||
case 3: oldstatus = E3_ENABLE_READ; enable_E3(); break;
|
||||
case 3: oldstatus = E3_ENABLE_READ(); enable_E3(); break;
|
||||
#if E_STEPPERS > 4
|
||||
case 4: oldstatus = E4_ENABLE_READ; enable_E4(); break;
|
||||
case 4: oldstatus = E4_ENABLE_READ(); enable_E4(); break;
|
||||
#if E_STEPPERS > 5
|
||||
case 5: oldstatus = E5_ENABLE_READ; enable_E5(); break;
|
||||
case 5: oldstatus = E5_ENABLE_READ(); enable_E5(); break;
|
||||
#endif // E_STEPPERS > 5
|
||||
#endif // E_STEPPERS > 4
|
||||
#endif // E_STEPPERS > 3
|
||||
@@ -659,6 +668,18 @@ void idle(
|
||||
bool no_stepper_sleep/*=false*/
|
||||
#endif
|
||||
) {
|
||||
|
||||
#if ENABLED(SPI_ENDSTOPS)
|
||||
if (endstops.tmc_spi_homing.any
|
||||
#if ENABLED(IMPROVE_HOMING_RELIABILITY)
|
||||
&& ELAPSED(millis(), sg_guard_period)
|
||||
#endif
|
||||
) {
|
||||
for (uint8_t i = 4; i--;) // Read SGT 4 times per idle loop
|
||||
if (endstops.tmc_spi_homing_check()) break;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if ENABLED(MAX7219_DEBUG)
|
||||
max7219.idle_tasks();
|
||||
#endif
|
||||
@@ -681,7 +702,7 @@ void idle(
|
||||
print_job_timer.tick();
|
||||
#endif
|
||||
|
||||
#if HAS_BUZZER && DISABLED(LCD_USE_I2C_BUZZER)
|
||||
#if USE_BEEPER
|
||||
buzzer.tick();
|
||||
#endif
|
||||
|
||||
@@ -865,6 +886,10 @@ void setup() {
|
||||
runout.setup();
|
||||
#endif
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
recovery.setup();
|
||||
#endif
|
||||
|
||||
setup_killpin();
|
||||
|
||||
#if HAS_TMC220x
|
||||
@@ -1105,6 +1130,10 @@ void setup() {
|
||||
init_closedloop();
|
||||
#endif
|
||||
|
||||
#ifdef STARTUP_COMMANDS
|
||||
queue.inject_P(PSTR(STARTUP_COMMANDS));
|
||||
#endif
|
||||
|
||||
#if ENABLED(INIT_SDCARD_ON_BOOT) && !HAS_SPI_LCD
|
||||
card.beginautostart();
|
||||
#endif
|
||||
@@ -1130,6 +1159,8 @@ void loop() {
|
||||
|
||||
for (;;) {
|
||||
|
||||
idle(); // Do an idle first so boot is slightly faster
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
|
||||
card.checkautostart();
|
||||
@@ -1161,6 +1192,5 @@ void loop() {
|
||||
if (queue.length < BUFSIZE) queue.get_available_commands();
|
||||
queue.advance();
|
||||
endstops.event_handler();
|
||||
idle();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -316,6 +316,7 @@ void manage_inactivity(const bool ignore_stepper_queue=false);
|
||||
/**
|
||||
* The axis order in all axis related arrays is X, Y, Z, E
|
||||
*/
|
||||
void enable_e_steppers();
|
||||
void enable_all_steppers();
|
||||
void disable_e_stepper(const uint8_t e);
|
||||
void disable_e_steppers();
|
||||
|
||||
+22
-18
@@ -95,6 +95,8 @@
|
||||
#define BOARD_Z_BOLT_X_SERIES 1141 // Z-Bolt X Series
|
||||
#define BOARD_TT_OSCAR 1142 // TT OSCAR
|
||||
#define BOARD_OVERLORD 1143 // Overlord/Overlord Pro
|
||||
#define BOARD_HJC2560C_REV1 1144 // ADIMLab Granty v1
|
||||
#define BOARD_HJC2560C_REV2 1145 // ADIMLab Granty v2
|
||||
|
||||
//
|
||||
// RAMBo and derivatives
|
||||
@@ -113,24 +115,25 @@
|
||||
|
||||
#define BOARD_CNCONTROLS_11 1300 // Cartesio CN Controls V11
|
||||
#define BOARD_CNCONTROLS_12 1301 // Cartesio CN Controls V12
|
||||
#define BOARD_CHEAPTRONIC 1302 // Cheaptronic v1.0
|
||||
#define BOARD_CHEAPTRONIC_V2 1303 // Cheaptronic v2.0
|
||||
#define BOARD_MIGHTYBOARD_REVE 1304 // Makerbot Mightyboard Revision E
|
||||
#define BOARD_MEGATRONICS 1305 // Megatronics
|
||||
#define BOARD_MEGATRONICS_2 1306 // Megatronics v2.0
|
||||
#define BOARD_MEGATRONICS_3 1307 // Megatronics v3.0
|
||||
#define BOARD_MEGATRONICS_31 1308 // Megatronics v3.1
|
||||
#define BOARD_MEGATRONICS_32 1309 // Megatronics v3.2
|
||||
#define BOARD_ELEFU_3 1310 // Elefu Ra Board (v3)
|
||||
#define BOARD_LEAPFROG 1311 // Leapfrog
|
||||
#define BOARD_MEGACONTROLLER 1312 // Mega controller
|
||||
#define BOARD_GT2560_REV_A 1313 // Geeetech GT2560 Rev. A
|
||||
#define BOARD_GT2560_REV_A_PLUS 1314 // Geeetech GT2560 Rev. A+ (with auto level probe)
|
||||
#define BOARD_GT2560_V3 1315 // Geeetech GT2560 Rev B for A10(M/D)
|
||||
#define BOARD_GT2560_V3_MC2 1316 // Geeetech GT2560 Rev B for Mecreator2
|
||||
#define BOARD_GT2560_V3_A20 1317 // Geeetech GT2560 Rev B for A20(M/D)
|
||||
#define BOARD_EINSTART_S 1318 // Einstart retrofit
|
||||
#define BOARD_WANHAO_ONEPLUS 1319 // Wanhao 0ne+ i3 Mini
|
||||
#define BOARD_CNCONTROLS_15 1302 // Cartesio CN Controls V15
|
||||
#define BOARD_CHEAPTRONIC 1303 // Cheaptronic v1.0
|
||||
#define BOARD_CHEAPTRONIC_V2 1304 // Cheaptronic v2.0
|
||||
#define BOARD_MIGHTYBOARD_REVE 1305 // Makerbot Mightyboard Revision E
|
||||
#define BOARD_MEGATRONICS 1306 // Megatronics
|
||||
#define BOARD_MEGATRONICS_2 1307 // Megatronics v2.0
|
||||
#define BOARD_MEGATRONICS_3 1308 // Megatronics v3.0
|
||||
#define BOARD_MEGATRONICS_31 1309 // Megatronics v3.1
|
||||
#define BOARD_MEGATRONICS_32 1310 // Megatronics v3.2
|
||||
#define BOARD_ELEFU_3 1311 // Elefu Ra Board (v3)
|
||||
#define BOARD_LEAPFROG 1312 // Leapfrog
|
||||
#define BOARD_MEGACONTROLLER 1313 // Mega controller
|
||||
#define BOARD_GT2560_REV_A 1314 // Geeetech GT2560 Rev. A
|
||||
#define BOARD_GT2560_REV_A_PLUS 1315 // Geeetech GT2560 Rev. A+ (with auto level probe)
|
||||
#define BOARD_GT2560_V3 1316 // Geeetech GT2560 Rev B for A10(M/D)
|
||||
#define BOARD_GT2560_V3_MC2 1317 // Geeetech GT2560 Rev B for Mecreator2
|
||||
#define BOARD_GT2560_V3_A20 1318 // Geeetech GT2560 Rev B for A20(M/D)
|
||||
#define BOARD_EINSTART_S 1319 // Einstart retrofit
|
||||
#define BOARD_WANHAO_ONEPLUS 1320 // Wanhao 0ne+ i3 Mini
|
||||
|
||||
//
|
||||
// ATmega1281, ATmega2561
|
||||
@@ -290,6 +293,7 @@
|
||||
#define BOARD_BLACK_STM32F407ZE 4205 // BLACK_STM32F407ZE
|
||||
#define BOARD_STEVAL 4206 // STEVAL-3DP001V1 3D PRINTER BOARD
|
||||
#define BOARD_BIGTREE_SKR_PRO_V1_1 4207 // BigTreeTech SKR Pro v1.1 (STM32F407ZG)
|
||||
#define BOARD_BIGTREE_BTT002_V1_0 4208 // BigTreeTech BTT002 v1.0 (STM32F407VE)
|
||||
|
||||
//
|
||||
// ARM Cortex M7
|
||||
|
||||
@@ -67,12 +67,14 @@
|
||||
|
||||
#define AXIS_DRIVER_TYPE(A,T) AXIS_DRIVER_TYPE_##A(T)
|
||||
|
||||
#define HAS_E_DRIVER(T) ( AXIS_DRIVER_TYPE_E0(T) || AXIS_DRIVER_TYPE_E1(T) \
|
||||
|| AXIS_DRIVER_TYPE_E2(T) || AXIS_DRIVER_TYPE_E3(T) \
|
||||
|| AXIS_DRIVER_TYPE_E4(T) || AXIS_DRIVER_TYPE_E5(T) )
|
||||
|
||||
#define HAS_DRIVER(T) ( AXIS_DRIVER_TYPE_X(T) || AXIS_DRIVER_TYPE_X2(T) \
|
||||
|| AXIS_DRIVER_TYPE_Y(T) || AXIS_DRIVER_TYPE_Y2(T) \
|
||||
|| AXIS_DRIVER_TYPE_Z(T) || AXIS_DRIVER_TYPE_Z2(T) || AXIS_DRIVER_TYPE_Z3(T) \
|
||||
|| AXIS_DRIVER_TYPE_E0(T) || AXIS_DRIVER_TYPE_E1(T) \
|
||||
|| AXIS_DRIVER_TYPE_E2(T) || AXIS_DRIVER_TYPE_E3(T) \
|
||||
|| AXIS_DRIVER_TYPE_E4(T) || AXIS_DRIVER_TYPE_E5(T) )
|
||||
|| HAS_E_DRIVER(T) )
|
||||
|
||||
// Test for supported TMC drivers that require advanced configuration
|
||||
// Does not match standalone configurations
|
||||
|
||||
@@ -67,6 +67,7 @@
|
||||
// sk Slovak
|
||||
// tr Turkish
|
||||
// uk Ukrainian
|
||||
// vi Vietnamese
|
||||
// zh_CN Chinese (Simplified)
|
||||
// zh_TW Chinese (Traditional)
|
||||
|
||||
|
||||
@@ -118,24 +118,24 @@
|
||||
// Using GCC extensions, but Travis GCC version does not like it and gives
|
||||
// "error: statement-expressions are not allowed outside functions nor in template-argument lists"
|
||||
#define NOLESS(v, n) \
|
||||
do { \
|
||||
do{ \
|
||||
__typeof__(n) _n = (n); \
|
||||
if (v < _n) v = _n; \
|
||||
} while(0)
|
||||
}while(0)
|
||||
|
||||
#define NOMORE(v, n) \
|
||||
do { \
|
||||
do{ \
|
||||
__typeof__(n) _n = (n); \
|
||||
if (v > _n) v = _n; \
|
||||
} while(0)
|
||||
}while(0)
|
||||
|
||||
#define LIMIT(v, n1, n2) \
|
||||
do { \
|
||||
do{ \
|
||||
__typeof__(n1) _n1 = (n1); \
|
||||
__typeof__(n2) _n2 = (n2); \
|
||||
if (v < _n1) v = _n1; \
|
||||
else if (v > _n2) v = _n2; \
|
||||
} while(0)
|
||||
}while(0)
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -184,5 +184,5 @@ void print_bin(const uint16_t val);
|
||||
|
||||
void print_xyz(PGM_P const prefix, PGM_P const suffix, const float x, const float y, const float z);
|
||||
void print_xyz(PGM_P const prefix, PGM_P const suffix, const float xyz[]);
|
||||
#define SERIAL_POS(SUFFIX,VAR) do { print_xyz(PSTR(" " STRINGIFY(VAR) "="), PSTR(" : " SUFFIX "\n"), VAR); } while(0)
|
||||
#define SERIAL_XYZ(PREFIX,V...) do { print_xyz(PSTR(PREFIX), nullptr, V); } while(0)
|
||||
#define SERIAL_POS(SUFFIX,VAR) do { print_xyz(PSTR(" " STRINGIFY(VAR) "="), PSTR(" : " SUFFIX "\n"), VAR); }while(0)
|
||||
#define SERIAL_XYZ(PREFIX,V...) do { print_xyz(PSTR(PREFIX), nullptr, V); }while(0)
|
||||
|
||||
@@ -37,7 +37,7 @@ Babystep babystep;
|
||||
|
||||
volatile int16_t Babystep::todo[BS_TODO_AXIS(Z_AXIS) + 1];
|
||||
|
||||
#if HAS_LCD_MENU
|
||||
#if HAS_LCD_MENU || ENABLED(EXTENSIBLE_UI)
|
||||
int16_t Babystep::accum;
|
||||
#if ENABLED(BABYSTEP_DISPLAY_TOTAL)
|
||||
int16_t Babystep::axis_total[BS_TOTAL_AXIS(Z_AXIS) + 1];
|
||||
@@ -75,7 +75,7 @@ void Babystep::add_steps(const AxisEnum axis, const int16_t distance) {
|
||||
|
||||
if (!CAN_BABYSTEP(axis)) return;
|
||||
|
||||
#if HAS_LCD_MENU
|
||||
#if HAS_LCD_MENU || ENABLED(EXTENSIBLE_UI)
|
||||
accum += distance; // Count up babysteps for the UI
|
||||
#if ENABLED(BABYSTEP_DISPLAY_TOTAL)
|
||||
axis_total[BS_TOTAL_AXIS(axis)] += distance;
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#define BS_TODO_AXIS(A) 0
|
||||
#endif
|
||||
|
||||
#if HAS_LCD_MENU && ENABLED(BABYSTEP_DISPLAY_TOTAL)
|
||||
#if (HAS_LCD_MENU || ENABLED(EXTENSIBLE_UI)) && ENABLED(BABYSTEP_DISPLAY_TOTAL)
|
||||
#if ENABLED(BABYSTEP_XY)
|
||||
#define BS_TOTAL_AXIS(A) A
|
||||
#else
|
||||
@@ -41,7 +41,7 @@
|
||||
class Babystep {
|
||||
public:
|
||||
static volatile int16_t todo[BS_TODO_AXIS(Z_AXIS) + 1];
|
||||
#if HAS_LCD_MENU
|
||||
#if HAS_LCD_MENU || ENABLED(EXTENSIBLE_UI)
|
||||
static int16_t accum; // Total babysteps in current edit
|
||||
#if ENABLED(BABYSTEP_DISPLAY_TOTAL)
|
||||
static int16_t axis_total[BS_TOTAL_AXIS(Z_AXIS) + 1]; // Total babysteps since G28
|
||||
|
||||
@@ -752,16 +752,15 @@
|
||||
save_ubl_active_state_and_disable(); // No bed level correction so only raw data is obtained
|
||||
DEPLOY_PROBE();
|
||||
|
||||
uint8_t count = GRID_MAX_POINTS, current = 1;
|
||||
uint8_t count = GRID_MAX_POINTS;
|
||||
|
||||
do {
|
||||
current = (GRID_MAX_POINTS) - count + 1;
|
||||
|
||||
if (do_ubl_mesh_map) display_map(g29_map_type);
|
||||
|
||||
SERIAL_ECHOLNPAIR("\nProbing mesh point ", int(current), "/", int(GRID_MAX_POINTS), ".\n");
|
||||
const int current = (GRID_MAX_POINTS) - count + 1;
|
||||
SERIAL_ECHOLNPAIR("\nProbing mesh point ", current, "/", int(GRID_MAX_POINTS), ".\n");
|
||||
#if HAS_DISPLAY
|
||||
ui.status_printf_P(0, PSTR(MSG_PROBING_MESH " %i/%i"), int(current), int(GRID_MAX_POINTS));
|
||||
ui.status_printf_P(0, PSTR(MSG_PROBING_MESH " %i/%i"), current, int(GRID_MAX_POINTS));
|
||||
#endif
|
||||
|
||||
#if HAS_LCD_MENU
|
||||
@@ -1500,8 +1499,7 @@
|
||||
DEBUG_ECHO_F(rx, 7);
|
||||
DEBUG_CHAR(',');
|
||||
DEBUG_ECHO_F(ry, 7);
|
||||
DEBUG_ECHOPGM(") logical: ");
|
||||
DEBUG_CHAR('(');
|
||||
DEBUG_ECHOPGM(") logical: (");
|
||||
DEBUG_ECHO_F(LOGICAL_X_POSITION(rx), 7);
|
||||
DEBUG_CHAR(',');
|
||||
DEBUG_ECHO_F(LOGICAL_Y_POSITION(ry), 7);
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../inc/MarlinConfigPre.h"
|
||||
|
||||
#if ENABLED(BINARY_FILE_TRANSFER)
|
||||
|
||||
#include "../sd/cardreader.h"
|
||||
#include "binary_protocol.h"
|
||||
|
||||
char* SDFileTransferProtocol::Packet::Open::data = nullptr;
|
||||
size_t SDFileTransferProtocol::data_waiting, SDFileTransferProtocol::transfer_timeout, SDFileTransferProtocol::idle_timeout;
|
||||
bool SDFileTransferProtocol::transfer_active, SDFileTransferProtocol::dummy_transfer, SDFileTransferProtocol::compression;
|
||||
|
||||
BinaryStream binaryStream[NUM_SERIAL];
|
||||
|
||||
#endif // BINARY_FILE_TRANSFER
|
||||
@@ -0,0 +1,471 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "../inc/MarlinConfig.h"
|
||||
|
||||
#define BINARY_STREAM_COMPRESSION
|
||||
|
||||
#if ENABLED(BINARY_STREAM_COMPRESSION)
|
||||
#include "../libs/heatshrink/heatshrink_decoder.h"
|
||||
#endif
|
||||
|
||||
inline bool bs_serial_data_available(const uint8_t index) {
|
||||
switch (index) {
|
||||
case 0: return MYSERIAL0.available();
|
||||
#if NUM_SERIAL > 1
|
||||
case 1: return MYSERIAL1.available();
|
||||
#endif
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
inline int bs_read_serial(const uint8_t index) {
|
||||
switch (index) {
|
||||
case 0: return MYSERIAL0.read();
|
||||
#if NUM_SERIAL > 1
|
||||
case 1: return MYSERIAL1.read();
|
||||
#endif
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
#if ENABLED(BINARY_STREAM_COMPRESSION)
|
||||
static heatshrink_decoder hsd;
|
||||
static uint8_t decode_buffer[512] = {};
|
||||
#endif
|
||||
|
||||
class SDFileTransferProtocol {
|
||||
private:
|
||||
struct Packet {
|
||||
struct [[gnu::packed]] Open {
|
||||
static bool validate(char* buffer, size_t length) {
|
||||
return (length > sizeof(Open) && buffer[length - 1] == '\0');
|
||||
}
|
||||
static Open& decode(char* buffer) {
|
||||
data = &buffer[2];
|
||||
return *reinterpret_cast<Open*>(buffer);
|
||||
}
|
||||
bool compression_enabled() { return compression & 0x1; }
|
||||
bool dummy_transfer() { return dummy & 0x1; }
|
||||
static char* filename() { return data; }
|
||||
private:
|
||||
uint8_t dummy, compression;
|
||||
static char* data; // variable length strings complicate things
|
||||
};
|
||||
};
|
||||
|
||||
static bool file_open(char* filename) {
|
||||
if (!dummy_transfer) {
|
||||
card.initsd();
|
||||
card.openFile(filename, false);
|
||||
if (!card.isFileOpen()) return false;
|
||||
}
|
||||
transfer_active = true;
|
||||
data_waiting = 0;
|
||||
#if ENABLED(BINARY_STREAM_COMPRESSION)
|
||||
heatshrink_decoder_reset(&hsd);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool file_write(char* buffer, const size_t length) {
|
||||
#if ENABLED(BINARY_STREAM_COMPRESSION)
|
||||
if (compression) {
|
||||
size_t total_processed = 0, processed_count = 0;
|
||||
HSD_poll_res presult;
|
||||
|
||||
while (total_processed < length) {
|
||||
heatshrink_decoder_sink(&hsd, reinterpret_cast<uint8_t*>(&buffer[total_processed]), length - total_processed, &processed_count);
|
||||
total_processed += processed_count;
|
||||
do {
|
||||
presult = heatshrink_decoder_poll(&hsd, &decode_buffer[data_waiting], sizeof(decode_buffer) - data_waiting, &processed_count);
|
||||
data_waiting += processed_count;
|
||||
if (data_waiting == sizeof(decode_buffer)) {
|
||||
if (!dummy_transfer)
|
||||
if (card.write(decode_buffer, data_waiting) < 0) {
|
||||
return false;
|
||||
}
|
||||
data_waiting = 0;
|
||||
}
|
||||
} while (presult == HSDR_POLL_MORE);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
return (dummy_transfer || card.write(buffer, length) >= 0);
|
||||
}
|
||||
|
||||
static bool file_close() {
|
||||
if (!dummy_transfer) {
|
||||
#if ENABLED(BINARY_STREAM_COMPRESSION)
|
||||
// flush any buffered data
|
||||
if (data_waiting) {
|
||||
if (card.write(decode_buffer, data_waiting) < 0) return false;
|
||||
data_waiting = 0;
|
||||
}
|
||||
#endif
|
||||
card.closefile();
|
||||
card.release();
|
||||
}
|
||||
#if ENABLED(BINARY_STREAM_COMPRESSION)
|
||||
heatshrink_decoder_finish(&hsd);
|
||||
#endif
|
||||
transfer_active = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
static void transfer_abort() {
|
||||
if (!dummy_transfer) {
|
||||
card.closefile();
|
||||
card.removeFile(card.filename);
|
||||
card.release();
|
||||
#if ENABLED(BINARY_STREAM_COMPRESSION)
|
||||
heatshrink_decoder_finish(&hsd);
|
||||
#endif
|
||||
}
|
||||
transfer_active = false;
|
||||
return;
|
||||
}
|
||||
|
||||
enum class FileTransfer : uint8_t { QUERY, OPEN, CLOSE, WRITE, ABORT };
|
||||
|
||||
static size_t data_waiting, transfer_timeout, idle_timeout;
|
||||
static bool transfer_active, dummy_transfer, compression;
|
||||
|
||||
public:
|
||||
|
||||
static void idle() {
|
||||
// If a transfer is interrupted and a file is left open, abort it after TIMEOUT ms
|
||||
const millis_t ms = millis();
|
||||
if (transfer_active && ELAPSED(ms, idle_timeout)) {
|
||||
idle_timeout = ms + IDLE_PERIOD;
|
||||
if (ELAPSED(ms, transfer_timeout)) transfer_abort();
|
||||
}
|
||||
}
|
||||
|
||||
static void process(uint8_t packet_type, char* buffer, const uint16_t length) {
|
||||
transfer_timeout = millis() + TIMEOUT;
|
||||
switch (static_cast<FileTransfer>(packet_type)) {
|
||||
case FileTransfer::QUERY:
|
||||
SERIAL_ECHOPAIR("PFT:version:", VERSION_MAJOR, ".", VERSION_MINOR, ".", VERSION_PATCH);
|
||||
#if ENABLED(BINARY_STREAM_COMPRESSION)
|
||||
SERIAL_ECHOLNPAIR(":compresion:heatshrink,", HEATSHRINK_STATIC_WINDOW_BITS, ",", HEATSHRINK_STATIC_LOOKAHEAD_BITS);
|
||||
#else
|
||||
SERIAL_ECHOLNPGM(":compresion:none");
|
||||
#endif
|
||||
break;
|
||||
case FileTransfer::OPEN:
|
||||
if (transfer_active)
|
||||
SERIAL_ECHOLNPGM("PFT:busy");
|
||||
else {
|
||||
if (Packet::Open::validate(buffer, length)) {
|
||||
auto packet = Packet::Open::decode(buffer);
|
||||
compression = packet.compression_enabled();
|
||||
dummy_transfer = packet.dummy_transfer();
|
||||
if (file_open(packet.filename())) {
|
||||
SERIAL_ECHOLNPGM("PFT:success");
|
||||
break;
|
||||
}
|
||||
}
|
||||
SERIAL_ECHOLNPGM("PFT:fail");
|
||||
}
|
||||
break;
|
||||
case FileTransfer::CLOSE:
|
||||
if (transfer_active) {
|
||||
if (file_close())
|
||||
SERIAL_ECHOLNPGM("PFT:success");
|
||||
else
|
||||
SERIAL_ECHOLNPGM("PFT:ioerror");
|
||||
}
|
||||
else SERIAL_ECHOLNPGM("PFT:invalid");
|
||||
break;
|
||||
case FileTransfer::WRITE:
|
||||
if (!transfer_active)
|
||||
SERIAL_ECHOLNPGM("PFT:invalid");
|
||||
else if (!file_write(buffer, length))
|
||||
SERIAL_ECHOLNPGM("PFT:ioerror");
|
||||
break;
|
||||
case FileTransfer::ABORT:
|
||||
transfer_abort();
|
||||
SERIAL_ECHOLNPGM("PFT:success");
|
||||
break;
|
||||
default:
|
||||
SERIAL_ECHOLNPGM("PTF:invalid");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static const uint16_t VERSION_MAJOR = 0, VERSION_MINOR = 1, VERSION_PATCH = 0, TIMEOUT = 10000, IDLE_PERIOD = 1000;
|
||||
};
|
||||
|
||||
class BinaryStream {
|
||||
public:
|
||||
enum class Protocol : uint8_t { CONTROL, FILE_TRANSFER };
|
||||
|
||||
enum class ProtocolControl : uint8_t { SYNC = 1, CLOSE };
|
||||
|
||||
enum class StreamState : uint8_t { PACKET_RESET, PACKET_WAIT, PACKET_HEADER, PACKET_DATA, PACKET_FOOTER,
|
||||
PACKET_PROCESS, PACKET_RESEND, PACKET_TIMEOUT, PACKET_ERROR };
|
||||
|
||||
struct Packet { // 10 byte protocol overhead, ascii with checksum and line number has a minimum of 7 increasing with line
|
||||
struct [[gnu::packed]] Header {
|
||||
static constexpr uint16_t HEADER_TOKEN = 0xB5AD;
|
||||
uint16_t token; // packet start token
|
||||
uint8_t sync; // stream sync, resend id and packet loss detection
|
||||
uint8_t meta; // 4 bit protocol,
|
||||
// 4 bit packet type
|
||||
uint16_t size; // data length
|
||||
uint16_t checksum; // header checksum
|
||||
|
||||
uint8_t protocol() { return (meta >> 4) & 0xF; }
|
||||
uint8_t type() { return meta & 0xF; }
|
||||
void reset() { token = 0; sync = 0; meta = 0; size = 0; checksum = 0; }
|
||||
};
|
||||
|
||||
struct [[gnu::packed]] Footer {
|
||||
uint16_t checksum; // full packet checksum
|
||||
void reset() { checksum = 0; }
|
||||
};
|
||||
|
||||
uint8_t header_data[sizeof(Header)],
|
||||
footer_data[sizeof(Footer)];
|
||||
uint32_t bytes_received;
|
||||
uint16_t checksum, header_checksum;
|
||||
millis_t timeout;
|
||||
char* buffer;
|
||||
|
||||
Header& header() { return *reinterpret_cast<Header*>(header_data); }
|
||||
Footer& footer() { return *reinterpret_cast<Footer*>(footer_data); }
|
||||
void reset() {
|
||||
header().reset();
|
||||
footer().reset();
|
||||
bytes_received = 0;
|
||||
checksum = 0;
|
||||
header_checksum = 0;
|
||||
timeout = millis() + PACKET_MAX_WAIT;
|
||||
buffer = nullptr;
|
||||
}
|
||||
} packet{};
|
||||
|
||||
void reset() {
|
||||
sync = 0;
|
||||
packet_retries = 0;
|
||||
buffer_next_index = 0;
|
||||
}
|
||||
|
||||
// fletchers 16 checksum
|
||||
uint32_t checksum(uint32_t cs, uint8_t value) {
|
||||
uint16_t cs_low = (((cs & 0xFF) + value) % 255);
|
||||
return ((((cs >> 8) + cs_low) % 255) << 8) | cs_low;
|
||||
}
|
||||
|
||||
// read the next byte from the data stream keeping track of
|
||||
// whether the stream times out from data starvation
|
||||
// takes the data variable by reference in order to return status
|
||||
bool stream_read(uint8_t& data) {
|
||||
if (stream_state != StreamState::PACKET_WAIT && ELAPSED(millis(), packet.timeout)) {
|
||||
stream_state = StreamState::PACKET_TIMEOUT;
|
||||
return false;
|
||||
}
|
||||
if (!bs_serial_data_available(card.transfer_port_index)) return false;
|
||||
data = bs_read_serial(card.transfer_port_index);
|
||||
packet.timeout = millis() + PACKET_MAX_WAIT;
|
||||
return true;
|
||||
}
|
||||
|
||||
template<const size_t buffer_size>
|
||||
void receive(char (&buffer)[buffer_size]) {
|
||||
uint8_t data = 0;
|
||||
millis_t transfer_window = millis() + RX_TIMESLICE;
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
PORT_REDIRECT(card.transfer_port_index);
|
||||
#endif
|
||||
|
||||
while (PENDING(millis(), transfer_window)) {
|
||||
switch (stream_state) {
|
||||
/**
|
||||
* Data stream packet handling
|
||||
*/
|
||||
case StreamState::PACKET_RESET:
|
||||
packet.reset();
|
||||
stream_state = StreamState::PACKET_WAIT;
|
||||
case StreamState::PACKET_WAIT:
|
||||
if (!stream_read(data)) { idle(); return; } // no active packet so don't wait
|
||||
packet.header_data[1] = data;
|
||||
if (packet.header().token == Packet::Header::HEADER_TOKEN) {
|
||||
packet.bytes_received = 2;
|
||||
stream_state = StreamState::PACKET_HEADER;
|
||||
}
|
||||
else {
|
||||
// stream corruption drop data
|
||||
packet.header_data[0] = data;
|
||||
}
|
||||
break;
|
||||
case StreamState::PACKET_HEADER:
|
||||
if (!stream_read(data)) break;
|
||||
|
||||
packet.header_data[packet.bytes_received++] = data;
|
||||
packet.checksum = checksum(packet.checksum, data);
|
||||
|
||||
// header checksum calculation can't contain the checksum
|
||||
if (packet.bytes_received == sizeof(Packet::Header) - 2)
|
||||
packet.header_checksum = packet.checksum;
|
||||
|
||||
if (packet.bytes_received == sizeof(Packet::Header)) {
|
||||
if (packet.header().checksum == packet.header_checksum) {
|
||||
// The SYNC control packet is a special case in that it doesn't require the stream sync to be correct
|
||||
if (static_cast<Protocol>(packet.header().protocol()) == Protocol::CONTROL && static_cast<ProtocolControl>(packet.header().type()) == ProtocolControl::SYNC) {
|
||||
SERIAL_ECHOLNPAIR("ss", sync, ",", buffer_size, ",", VERSION_MAJOR, ".", VERSION_MINOR, ".", VERSION_PATCH);
|
||||
stream_state = StreamState::PACKET_RESET;
|
||||
break;
|
||||
}
|
||||
if (packet.header().sync == sync) {
|
||||
buffer_next_index = 0;
|
||||
packet.bytes_received = 0;
|
||||
if (packet.header().size) {
|
||||
stream_state = StreamState::PACKET_DATA;
|
||||
packet.buffer = static_cast<char *>(&buffer[0]); // multipacket buffering not implemented, always allocate whole buffer to packet
|
||||
}
|
||||
else
|
||||
stream_state = StreamState::PACKET_PROCESS;
|
||||
}
|
||||
else if (packet.header().sync == sync - 1) { // ok response must have been lost
|
||||
SERIAL_ECHOLNPAIR("ok", packet.header().sync); // transmit valid packet received and drop the payload
|
||||
stream_state = StreamState::PACKET_RESET;
|
||||
}
|
||||
else if (packet_retries) {
|
||||
stream_state = StreamState::PACKET_RESET; // could be packets already buffered on flow controlled connections, drop them without ack
|
||||
}
|
||||
else {
|
||||
SERIAL_ECHO_MSG("Datastream packet out of order");
|
||||
stream_state = StreamState::PACKET_RESEND;
|
||||
}
|
||||
}
|
||||
else {
|
||||
SERIAL_ECHO_START();
|
||||
SERIAL_ECHOLNPAIR("Packet Header(", packet.header().sync, "?) Corrupt");
|
||||
stream_state = StreamState::PACKET_RESEND;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case StreamState::PACKET_DATA:
|
||||
if (!stream_read(data)) break;
|
||||
|
||||
if (buffer_next_index < buffer_size)
|
||||
packet.buffer[buffer_next_index] = data;
|
||||
else {
|
||||
SERIAL_ECHO_MSG("Datastream packet data buffer overrun");
|
||||
stream_state = StreamState::PACKET_ERROR;
|
||||
break;
|
||||
}
|
||||
|
||||
packet.checksum = checksum(packet.checksum, data);
|
||||
packet.bytes_received++;
|
||||
buffer_next_index++;
|
||||
|
||||
if (packet.bytes_received == packet.header().size) {
|
||||
stream_state = StreamState::PACKET_FOOTER;
|
||||
packet.bytes_received = 0;
|
||||
}
|
||||
break;
|
||||
case StreamState::PACKET_FOOTER:
|
||||
if (!stream_read(data)) break;
|
||||
|
||||
packet.footer_data[packet.bytes_received++] = data;
|
||||
if (packet.bytes_received == sizeof(Packet::Footer)) {
|
||||
if (packet.footer().checksum == packet.checksum) {
|
||||
stream_state = StreamState::PACKET_PROCESS;
|
||||
}
|
||||
else {
|
||||
SERIAL_ECHO_START();
|
||||
SERIAL_ECHOLNPAIR("Packet(", packet.header().sync, ") Payload Corrupt");
|
||||
stream_state = StreamState::PACKET_RESEND;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case StreamState::PACKET_PROCESS:
|
||||
sync++;
|
||||
packet_retries = 0;
|
||||
bytes_received += packet.header().size;
|
||||
|
||||
SERIAL_ECHOLNPAIR("ok", packet.header().sync); // transmit valid packet received
|
||||
dispatch();
|
||||
stream_state = StreamState::PACKET_RESET;
|
||||
break;
|
||||
case StreamState::PACKET_RESEND:
|
||||
if (packet_retries < MAX_RETRIES || MAX_RETRIES == 0) {
|
||||
packet_retries++;
|
||||
stream_state = StreamState::PACKET_RESET;
|
||||
SERIAL_ECHO_START();
|
||||
SERIAL_ECHOLNPAIR("Resend request ", int(packet_retries));
|
||||
SERIAL_ECHOLNPAIR("rs", sync);
|
||||
}
|
||||
else
|
||||
stream_state = StreamState::PACKET_ERROR;
|
||||
break;
|
||||
case StreamState::PACKET_TIMEOUT:
|
||||
SERIAL_ECHO_MSG("Datastream timeout");
|
||||
stream_state = StreamState::PACKET_RESEND;
|
||||
break;
|
||||
case StreamState::PACKET_ERROR:
|
||||
SERIAL_ECHOLNPAIR("fe", packet.header().sync);
|
||||
reset(); // reset everything, resync required
|
||||
stream_state = StreamState::PACKET_RESET;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void dispatch() {
|
||||
switch(static_cast<Protocol>(packet.header().protocol())) {
|
||||
case Protocol::CONTROL:
|
||||
switch(static_cast<ProtocolControl>(packet.header().type())) {
|
||||
case ProtocolControl::CLOSE: // revert back to ASCII mode
|
||||
card.flag.binary_mode = false;
|
||||
break;
|
||||
default:
|
||||
SERIAL_ECHO_MSG("Unknown BinaryProtocolControl Packet");
|
||||
}
|
||||
break;
|
||||
case Protocol::FILE_TRANSFER:
|
||||
SDFileTransferProtocol::process(packet.header().type(), packet.buffer, packet.header().size); // send user data to be processed
|
||||
break;
|
||||
default:
|
||||
SERIAL_ECHO_MSG("Unsupported Binary Protocol");
|
||||
}
|
||||
}
|
||||
|
||||
void idle() {
|
||||
// Some Protocols may need periodic updates without new data
|
||||
SDFileTransferProtocol::idle();
|
||||
}
|
||||
|
||||
static const uint16_t PACKET_MAX_WAIT = 500, RX_TIMESLICE = 20, MAX_RETRIES = 0, VERSION_MAJOR = 0, VERSION_MINOR = 1, VERSION_PATCH = 0;
|
||||
uint8_t packet_retries, sync;
|
||||
uint16_t buffer_next_index;
|
||||
uint32_t bytes_received;
|
||||
StreamState stream_state = StreamState::PACKET_RESET;
|
||||
};
|
||||
|
||||
extern BinaryStream binaryStream[NUM_SERIAL];
|
||||
@@ -36,35 +36,37 @@ void controllerfan_update() {
|
||||
if (ELAPSED(ms, nextMotorCheck)) {
|
||||
nextMotorCheck = ms + 2500UL; // Not a time critical function, so only check every 2.5s
|
||||
|
||||
const bool xory = X_ENABLE_READ() == X_ENABLE_ON || Y_ENABLE_READ() == Y_ENABLE_ON;
|
||||
|
||||
// If any of the drivers or the bed are enabled...
|
||||
if (X_ENABLE_READ == X_ENABLE_ON || Y_ENABLE_READ == Y_ENABLE_ON || Z_ENABLE_READ == Z_ENABLE_ON
|
||||
if (xory || Z_ENABLE_READ() == Z_ENABLE_ON
|
||||
#if HAS_HEATED_BED
|
||||
|| thermalManager.temp_bed.soft_pwm_amount > 0
|
||||
#endif
|
||||
#if HAS_X2_ENABLE
|
||||
|| X2_ENABLE_READ == X_ENABLE_ON
|
||||
|| X2_ENABLE_READ() == X_ENABLE_ON
|
||||
#endif
|
||||
#if HAS_Y2_ENABLE
|
||||
|| Y2_ENABLE_READ == Y_ENABLE_ON
|
||||
|| Y2_ENABLE_READ() == Y_ENABLE_ON
|
||||
#endif
|
||||
#if HAS_Z2_ENABLE
|
||||
|| Z2_ENABLE_READ == Z_ENABLE_ON
|
||||
|| Z2_ENABLE_READ() == Z_ENABLE_ON
|
||||
#endif
|
||||
#if HAS_Z3_ENABLE
|
||||
|| Z3_ENABLE_READ == Z_ENABLE_ON
|
||||
|| Z3_ENABLE_READ() == Z_ENABLE_ON
|
||||
#endif
|
||||
#if E_STEPPERS
|
||||
|| E0_ENABLE_READ == E_ENABLE_ON
|
||||
|| E0_ENABLE_READ() == E_ENABLE_ON
|
||||
#if E_STEPPERS > 1
|
||||
|| E1_ENABLE_READ == E_ENABLE_ON
|
||||
|| E1_ENABLE_READ() == E_ENABLE_ON
|
||||
#if E_STEPPERS > 2
|
||||
|| E2_ENABLE_READ == E_ENABLE_ON
|
||||
|| E2_ENABLE_READ() == E_ENABLE_ON
|
||||
#if E_STEPPERS > 3
|
||||
|| E3_ENABLE_READ == E_ENABLE_ON
|
||||
|| E3_ENABLE_READ() == E_ENABLE_ON
|
||||
#if E_STEPPERS > 4
|
||||
|| E4_ENABLE_READ == E_ENABLE_ON
|
||||
|| E4_ENABLE_READ() == E_ENABLE_ON
|
||||
#if E_STEPPERS > 5
|
||||
|| E5_ENABLE_READ == E_ENABLE_ON
|
||||
|| E5_ENABLE_READ() == E_ENABLE_ON
|
||||
#endif // E_STEPPERS > 5
|
||||
#endif // E_STEPPERS > 4
|
||||
#endif // E_STEPPERS > 3
|
||||
@@ -76,12 +78,17 @@ void controllerfan_update() {
|
||||
}
|
||||
|
||||
// Fan off if no steppers have been enabled for CONTROLLERFAN_SECS seconds
|
||||
uint8_t speed = (!lastMotorOn || ELAPSED(ms, lastMotorOn + (CONTROLLERFAN_SECS) * 1000UL)) ? 0 : CONTROLLERFAN_SPEED;
|
||||
controllerfan_speed = speed;
|
||||
controllerfan_speed = (!lastMotorOn || ELAPSED(ms, lastMotorOn + (CONTROLLERFAN_SECS) * 1000UL)) ? 0 : (
|
||||
#ifdef CONTROLLERFAN_SPEED_Z_ONLY
|
||||
xory ? CONTROLLERFAN_SPEED : CONTROLLERFAN_SPEED_Z_ONLY
|
||||
#else
|
||||
CONTROLLERFAN_SPEED
|
||||
#endif
|
||||
);
|
||||
|
||||
// allows digital or PWM fan output to be used (see M42 handling)
|
||||
WRITE(CONTROLLER_FAN_PIN, speed);
|
||||
analogWrite(pin_t(CONTROLLER_FAN_PIN), speed);
|
||||
// Allow digital or PWM fan output (see M42 handling)
|
||||
WRITE(CONTROLLER_FAN_PIN, controllerfan_speed);
|
||||
analogWrite(pin_t(CONTROLLER_FAN_PIN), controllerfan_speed);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -125,7 +125,7 @@ void LEDLights::set_color(const LEDColor &incol
|
||||
// If the pins can do PWM then their intensity will be set.
|
||||
#define UPDATE_RGBW(C,c) do { if (PWM_PIN(RGB_LED_##C##_PIN)) \
|
||||
analogWrite(pin_t(RGB_LED_##C##_PIN), incol.c); \
|
||||
else WRITE(RGB_LED_##C##_PIN, incol.c ? HIGH : LOW); } while(0)
|
||||
else WRITE(RGB_LED_##C##_PIN, incol.c ? HIGH : LOW); }while(0)
|
||||
UPDATE_RGBW(R,r);
|
||||
UPDATE_RGBW(G,g);
|
||||
UPDATE_RGBW(B,b);
|
||||
|
||||
@@ -137,13 +137,15 @@ void pca9632_set_led_color(const LEDColor &color) {
|
||||
}
|
||||
|
||||
#if ENABLED(PCA9632_BUZZER)
|
||||
void pca9632_buzz(uint16_t const f, uint16_t d) {
|
||||
UNUSED(f); UNUSED(d);
|
||||
|
||||
void pca9632_buzz(const long duration, const uint16_t freq) {
|
||||
UNUSED(duration); UNUSED(freq);
|
||||
uint8_t data[] = PCA9632_BUZZER_DATA;
|
||||
Wire.beginTransmission(I2C_ADDRESS(PCA9632_ADDRESS));
|
||||
Wire.write(data, sizeof(data));
|
||||
Wire.endTransmission();
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // PCA9632_BUZZER
|
||||
|
||||
#endif // PCA9632
|
||||
|
||||
@@ -32,5 +32,6 @@ typedef LEDColor LEDColor;
|
||||
void pca9632_set_led_color(const LEDColor &color);
|
||||
|
||||
#if ENABLED(PCA9632_BUZZER)
|
||||
void pca9632_buzz(uint16_t const, uint16_t);
|
||||
#include <stdint.h>
|
||||
void pca9632_buzz(const long, const uint16_t);
|
||||
#endif
|
||||
|
||||
@@ -187,6 +187,9 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l
|
||||
host_action_prompt_button(PSTR("Continue"));
|
||||
host_action_prompt_show();
|
||||
#endif
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onUserConfirmRequired(PSTR("Load Filament"));
|
||||
#endif
|
||||
while (wait_for_user) {
|
||||
#if HAS_BUZZER
|
||||
filament_change_beep(max_beep_count);
|
||||
@@ -239,6 +242,9 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l
|
||||
#if ENABLED(HOST_PROMPT_SUPPORT)
|
||||
host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Continuous Purge Running..."), PSTR("Continue"));
|
||||
#endif
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onUserConfirmRequired(PSTR("Continuous Purge Running..."));
|
||||
#endif
|
||||
for (float purge_count = purge_length; purge_count > 0 && wait_for_user; --purge_count)
|
||||
do_pause_e_move(1, ADVANCED_PAUSE_PURGE_FEEDRATE);
|
||||
wait_for_user = false;
|
||||
@@ -353,8 +359,8 @@ bool unload_filament(const float &unload_length, const bool show_lcd/*=false*/,
|
||||
planner.settings.retract_acceleration = saved_acceleration;
|
||||
#endif
|
||||
|
||||
// Disable extruders steppers for manual filament changing (only on boards that have separate ENABLE_PINS)
|
||||
#if (E0_ENABLE_PIN != X_ENABLE_PIN && E1_ENABLE_PIN != Y_ENABLE_PIN) || AXIS_DRIVER_TYPE_E0(TMC2660) || AXIS_DRIVER_TYPE_E1(TMC2660) || AXIS_DRIVER_TYPE_E2(TMC2660) || AXIS_DRIVER_TYPE_E3(TMC2660) || AXIS_DRIVER_TYPE_E4(TMC2660) || AXIS_DRIVER_TYPE_E5(TMC2660)
|
||||
// Disable E steppers for manual change
|
||||
#if HAS_E_STEPPER_ENABLE
|
||||
disable_e_stepper(active_extruder);
|
||||
safe_delay(100);
|
||||
#endif
|
||||
@@ -517,6 +523,9 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep
|
||||
#if ENABLED(HOST_PROMPT_SUPPORT)
|
||||
host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Nozzle Parked"), PSTR("Continue"));
|
||||
#endif
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onUserConfirmRequired(PSTR("Nozzle Parked"));
|
||||
#endif
|
||||
while (wait_for_user) {
|
||||
#if HAS_BUZZER
|
||||
filament_change_beep(max_beep_count);
|
||||
@@ -538,6 +547,10 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep
|
||||
host_prompt_do(PROMPT_USER_CONTINUE, PSTR("HeaterTimeout"), PSTR("Reheat"));
|
||||
#endif
|
||||
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onUserConfirmRequired(PSTR("HeaterTimeout"));
|
||||
#endif
|
||||
|
||||
// Wait for LCD click or M108
|
||||
while (wait_for_user) idle(true);
|
||||
|
||||
|
||||
@@ -55,31 +55,31 @@ bool Power::is_power_needed() {
|
||||
#endif
|
||||
|
||||
// If any of the drivers or the bed are enabled...
|
||||
if (X_ENABLE_READ == X_ENABLE_ON || Y_ENABLE_READ == Y_ENABLE_ON || Z_ENABLE_READ == Z_ENABLE_ON
|
||||
if (X_ENABLE_READ() == X_ENABLE_ON || Y_ENABLE_READ() == Y_ENABLE_ON || Z_ENABLE_READ() == Z_ENABLE_ON
|
||||
#if HAS_HEATED_BED
|
||||
|| thermalManager.temp_bed.soft_pwm_amount > 0
|
||||
#endif
|
||||
#if HAS_X2_ENABLE
|
||||
|| X2_ENABLE_READ == X_ENABLE_ON
|
||||
|| X2_ENABLE_READ() == X_ENABLE_ON
|
||||
#endif
|
||||
#if HAS_Y2_ENABLE
|
||||
|| Y2_ENABLE_READ == Y_ENABLE_ON
|
||||
|| Y2_ENABLE_READ() == Y_ENABLE_ON
|
||||
#endif
|
||||
#if HAS_Z2_ENABLE
|
||||
|| Z2_ENABLE_READ == Z_ENABLE_ON
|
||||
|| Z2_ENABLE_READ() == Z_ENABLE_ON
|
||||
#endif
|
||||
#if E_STEPPERS
|
||||
|| E0_ENABLE_READ == E_ENABLE_ON
|
||||
|| E0_ENABLE_READ() == E_ENABLE_ON
|
||||
#if E_STEPPERS > 1
|
||||
|| E1_ENABLE_READ == E_ENABLE_ON
|
||||
|| E1_ENABLE_READ() == E_ENABLE_ON
|
||||
#if E_STEPPERS > 2
|
||||
|| E2_ENABLE_READ == E_ENABLE_ON
|
||||
|| E2_ENABLE_READ() == E_ENABLE_ON
|
||||
#if E_STEPPERS > 3
|
||||
|| E3_ENABLE_READ == E_ENABLE_ON
|
||||
|| E3_ENABLE_READ() == E_ENABLE_ON
|
||||
#if E_STEPPERS > 4
|
||||
|| E4_ENABLE_READ == E_ENABLE_ON
|
||||
|| E4_ENABLE_READ() == E_ENABLE_ON
|
||||
#if E_STEPPERS > 5
|
||||
|| E5_ENABLE_READ == E_ENABLE_ON
|
||||
|| E5_ENABLE_READ() == E_ENABLE_ON
|
||||
#endif // E_STEPPERS > 5
|
||||
#endif // E_STEPPERS > 4
|
||||
#endif // E_STEPPERS > 3
|
||||
|
||||
@@ -332,8 +332,7 @@ void PrintJobRecovery::resume() {
|
||||
// Restore leveling state before 'G92 Z' to ensure
|
||||
// the Z stepper count corresponds to the native Z.
|
||||
if (info.fade || info.leveling) {
|
||||
dtostrf(info.fade, 1, 1, str_1);
|
||||
sprintf_P(cmd, PSTR("M420 S%i Z%s"), int(info.leveling), str_1);
|
||||
sprintf_P(cmd, PSTR("M420 S%i Z%s"), int(info.leveling), dtostrf(info.fade, 1, 1, str_1));
|
||||
gcode.process_subcommands_now(cmd);
|
||||
}
|
||||
#endif
|
||||
@@ -355,9 +354,10 @@ void PrintJobRecovery::resume() {
|
||||
#endif
|
||||
|
||||
// Move back to the saved XY
|
||||
dtostrf(info.current_position[X_AXIS], 1, 3, str_1);
|
||||
dtostrf(info.current_position[Y_AXIS], 1, 3, str_2);
|
||||
sprintf_P(cmd, PSTR("G1 X%s Y%s F3000"), str_1, str_2);
|
||||
sprintf_P(cmd, PSTR("G1 X%s Y%s F3000"),
|
||||
dtostrf(info.current_position[X_AXIS], 1, 3, str_1),
|
||||
dtostrf(info.current_position[Y_AXIS], 1, 3, str_2)
|
||||
);
|
||||
gcode.process_subcommands_now(cmd);
|
||||
|
||||
// Move back to the saved Z
|
||||
@@ -382,8 +382,7 @@ void PrintJobRecovery::resume() {
|
||||
gcode.process_subcommands_now(cmd);
|
||||
|
||||
// Restore E position with G92.9
|
||||
dtostrf(info.current_position[E_AXIS], 1, 3, str_1);
|
||||
sprintf_P(cmd, PSTR("G92.9 E%s"), str_1);
|
||||
sprintf_P(cmd, PSTR("G92.9 E%s"), dtostrf(info.current_position[E_AXIS], 1, 3, str_1));
|
||||
gcode.process_subcommands_now(cmd);
|
||||
|
||||
// Relative mode
|
||||
|
||||
@@ -26,12 +26,16 @@
|
||||
*/
|
||||
|
||||
#include "../sd/cardreader.h"
|
||||
#include "../inc/MarlinConfigPre.h"
|
||||
#include "../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(MIXING_EXTRUDER)
|
||||
#include "../feature/mixing.h"
|
||||
#endif
|
||||
|
||||
#if !defined(POWER_LOSS_STATE) && PIN_EXISTS(POWER_LOSS)
|
||||
#define POWER_LOSS_STATE HIGH
|
||||
#endif
|
||||
|
||||
//#define DEBUG_POWER_LOSS_RECOVERY
|
||||
//#define SAVE_EACH_CMD_MODE
|
||||
//#define SAVE_INFO_INTERVAL_MS 0
|
||||
@@ -110,6 +114,20 @@ class PrintJobRecovery {
|
||||
|
||||
static void init();
|
||||
|
||||
static inline void setup() {
|
||||
#if PIN_EXISTS(POWER_LOSS)
|
||||
#if ENABLED(POWER_LOSS_PULL)
|
||||
#if POWER_LOSS_STATE == LOW
|
||||
SET_INPUT_PULLUP(POWER_LOSS_PIN);
|
||||
#else
|
||||
SET_INPUT_PULLDOWN(POWER_LOSS_PIN);
|
||||
#endif
|
||||
#else
|
||||
SET_INPUT(POWER_LOSS_PIN);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
static bool enabled;
|
||||
static void enable(const bool onoff);
|
||||
static void changed();
|
||||
|
||||
@@ -42,6 +42,10 @@ MMU2 mmu2;
|
||||
#include "../../feature/host_actions.h"
|
||||
#endif
|
||||
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
#include "../../lcd/extensible_ui/ui_api.h"
|
||||
#endif
|
||||
|
||||
#define DEBUG_OUT ENABLED(MMU2_DEBUG)
|
||||
#include "../../core/debug_out.h"
|
||||
|
||||
@@ -711,6 +715,9 @@ void MMU2::filament_runout() {
|
||||
#if ENABLED(HOST_PROMPT_SUPPORT)
|
||||
host_prompt_do(PROMPT_USER_CONTINUE, PSTR("MMU2 Eject Recover"), PSTR("Continue"));
|
||||
#endif
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onUserConfirmRequired(PSTR("MMU2 Eject Recover"));
|
||||
#endif
|
||||
while (wait_for_user) idle();
|
||||
BUZZ(200, 404);
|
||||
BUZZ(200, 404);
|
||||
|
||||
@@ -249,6 +249,8 @@ class FilamentSensorBase {
|
||||
&& (dual_x_carriage_mode == DXC_DUPLICATION_MODE || dual_x_carriage_mode == DXC_MIRRORED_MODE)
|
||||
#elif ENABLED(MULTI_NOZZLE_DUPLICATION)
|
||||
&& extruder_duplication_enabled
|
||||
#else
|
||||
&& false
|
||||
#endif
|
||||
#endif
|
||||
) return runout_states; // Any extruder
|
||||
|
||||
@@ -140,6 +140,9 @@ class TMCMarlin : public TMC, public TMCStorage<AXIS_LETTER, DRIVER_ID> {
|
||||
this->stored.homing_thrs = sgt_val;
|
||||
#endif
|
||||
}
|
||||
#if ENABLED(SPI_ENDSTOPS)
|
||||
bool test_stall_status();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if HAS_LCD_MENU
|
||||
@@ -355,9 +358,22 @@ void test_tmc_connection(const bool test_x, const bool test_y, const bool test_z
|
||||
* Defined here because of limitations with templates and headers.
|
||||
*/
|
||||
#if USE_SENSORLESS
|
||||
|
||||
// Track enabled status of stealthChop and only re-enable where applicable
|
||||
struct sensorless_t { bool x, y, z, x2, y2, z2, z3; };
|
||||
|
||||
#if ENABLED(IMPROVE_HOMING_RELIABILITY)
|
||||
extern millis_t sg_guard_period;
|
||||
constexpr uint16_t default_sg_guard_duration = 400;
|
||||
|
||||
struct slow_homing_t {
|
||||
struct { uint32_t x, y; } acceleration;
|
||||
#if HAS_CLASSIC_JERK
|
||||
struct { float x, y; } jerk;
|
||||
#endif
|
||||
};
|
||||
#endif
|
||||
|
||||
bool tmc_enable_stallguard(TMC2130Stepper &st);
|
||||
void tmc_disable_stallguard(TMC2130Stepper &st, const bool restore_stealth);
|
||||
|
||||
@@ -366,7 +382,42 @@ void test_tmc_connection(const bool test_x, const bool test_y, const bool test_z
|
||||
|
||||
bool tmc_enable_stallguard(TMC2660Stepper);
|
||||
void tmc_disable_stallguard(TMC2660Stepper, const bool);
|
||||
#endif
|
||||
|
||||
#if ENABLED(SPI_ENDSTOPS)
|
||||
|
||||
template<class TMC, char AXIS_LETTER, char DRIVER_ID, AxisEnum AXIS_ID>
|
||||
bool TMCMarlin<TMC, AXIS_LETTER, DRIVER_ID, AXIS_ID>::test_stall_status() {
|
||||
uint16_t sg_result = 0;
|
||||
|
||||
this->switchCSpin(LOW);
|
||||
|
||||
if (this->TMC_SW_SPI != nullptr) {
|
||||
this->TMC_SW_SPI->transfer(TMC2130_n::DRV_STATUS_t::address);
|
||||
this->TMC_SW_SPI->transfer16(0);
|
||||
// We only care about the last 10 bits
|
||||
sg_result = this->TMC_SW_SPI->transfer(0);
|
||||
sg_result <<= 8;
|
||||
sg_result |= this->TMC_SW_SPI->transfer(0);
|
||||
}
|
||||
else {
|
||||
SPI.beginTransaction(SPISettings(16000000/8, MSBFIRST, SPI_MODE3));
|
||||
// Read DRV_STATUS
|
||||
SPI.transfer(TMC2130_n::DRV_STATUS_t::address);
|
||||
SPI.transfer16(0);
|
||||
// We only care about the last 10 bits
|
||||
sg_result = SPI.transfer(0);
|
||||
sg_result <<= 8;
|
||||
sg_result |= SPI.transfer(0);
|
||||
SPI.endTransaction();
|
||||
}
|
||||
this->switchCSpin(HIGH);
|
||||
|
||||
return (sg_result & 0x3FF) == 0;
|
||||
}
|
||||
|
||||
#endif // SPI_ENDSTOPS
|
||||
|
||||
#endif // USE_SENSORLESS
|
||||
|
||||
#if TMC_HAS_SPI
|
||||
void tmc_init_cs_pins();
|
||||
|
||||
@@ -63,10 +63,6 @@ void XPT2046::init(void) {
|
||||
uint8_t XPT2046::read_buttons() {
|
||||
int16_t tsoffsets[4] = { 0 };
|
||||
|
||||
static uint32_t touchtimeout = 0;
|
||||
if (PENDING(millis(), touchtimeout)) return 0;
|
||||
touchtimeout = millis() + 80; // ideally want to set this lower for the games... 30 or 40.
|
||||
|
||||
if (tsoffsets[0] + tsoffsets[1] == 0) {
|
||||
// Not yet set, so use defines as fallback...
|
||||
tsoffsets[0] = XPT2046_X_CALIBRATION;
|
||||
@@ -84,10 +80,10 @@ uint8_t XPT2046::read_buttons() {
|
||||
|
||||
if (y < 175 || y > 234) return 0;
|
||||
|
||||
if (WITHIN(x, 11, 109)) encoderDiff = -(ENCODER_STEPS_PER_MENU_ITEM) * ENCODER_PULSES_PER_STEP;
|
||||
else if (WITHIN(x, 111, 209)) encoderDiff = ENCODER_STEPS_PER_MENU_ITEM * ENCODER_PULSES_PER_STEP;
|
||||
else if (WITHIN(x, 211, 309)) return EN_C;
|
||||
return 0;
|
||||
return WITHIN(x, 11, 109) ? EN_A
|
||||
: WITHIN(x, 111, 209) ? EN_B
|
||||
: WITHIN(x, 211, 309) ? EN_C
|
||||
: 0;
|
||||
}
|
||||
|
||||
bool XPT2046::isTouched() {
|
||||
|
||||
@@ -78,15 +78,19 @@
|
||||
fr_mm_s = _MIN(homing_feedrate(X_AXIS), homing_feedrate(Y_AXIS)) * SQRT(sq(mlratio) + 1.0);
|
||||
|
||||
#if ENABLED(SENSORLESS_HOMING)
|
||||
sensorless_t stealth_states { false };
|
||||
stealth_states.x = tmc_enable_stallguard(stepperX);
|
||||
stealth_states.y = tmc_enable_stallguard(stepperY);
|
||||
#if AXIS_HAS_STALLGUARD(X2)
|
||||
stealth_states.x2 = tmc_enable_stallguard(stepperX2);
|
||||
#endif
|
||||
#if AXIS_HAS_STALLGUARD(Y2)
|
||||
stealth_states.y2 = tmc_enable_stallguard(stepperY2);
|
||||
#endif
|
||||
sensorless_t stealth_states {
|
||||
tmc_enable_stallguard(stepperX)
|
||||
, tmc_enable_stallguard(stepperY)
|
||||
, false
|
||||
, false
|
||||
#if AXIS_HAS_STALLGUARD(X2)
|
||||
|| tmc_enable_stallguard(stepperX2)
|
||||
#endif
|
||||
, false
|
||||
#if AXIS_HAS_STALLGUARD(Y2)
|
||||
|| tmc_enable_stallguard(stepperY2)
|
||||
#endif
|
||||
};
|
||||
#endif
|
||||
|
||||
do_blocking_move_to_xy(1.5 * mlx * x_axis_home_dir, 1.5 * mly * home_dir(Y_AXIS), fr_mm_s);
|
||||
@@ -229,6 +233,22 @@ void GcodeSuite::G28(const bool always_home_all) {
|
||||
workspace_plane = PLANE_XY;
|
||||
#endif
|
||||
|
||||
#if ENABLED(IMPROVE_HOMING_RELIABILITY)
|
||||
slow_homing_t slow_homing { 0 };
|
||||
slow_homing.acceleration.x = planner.settings.max_acceleration_mm_per_s2[X_AXIS];
|
||||
slow_homing.acceleration.y = planner.settings.max_acceleration_mm_per_s2[Y_AXIS];
|
||||
planner.settings.max_acceleration_mm_per_s2[X_AXIS] = 100;
|
||||
planner.settings.max_acceleration_mm_per_s2[Y_AXIS] = 100;
|
||||
#if HAS_CLASSIC_JERK
|
||||
slow_homing.jerk.x = planner.max_jerk[X_AXIS];
|
||||
slow_homing.jerk.y = planner.max_jerk[Y_AXIS];
|
||||
planner.max_jerk[X_AXIS] = 0;
|
||||
planner.max_jerk[Y_AXIS] = 0;
|
||||
#endif
|
||||
|
||||
planner.reset_acceleration_rates();
|
||||
#endif
|
||||
|
||||
// Always home with tool 0 active
|
||||
#if HOTENDS > 1
|
||||
#if DISABLED(DELTA) || ENABLED(DELTA_HOME_TO_SAFE_ZONE)
|
||||
@@ -393,6 +413,11 @@ void GcodeSuite::G28(const bool always_home_all) {
|
||||
|
||||
endstops.not_homing();
|
||||
|
||||
// Clear endstop state for polled stallGuard endstops
|
||||
#if ENABLED(SPI_ENDSTOPS)
|
||||
endstops.clear_endstop_state();
|
||||
#endif
|
||||
|
||||
#if BOTH(DELTA, DELTA_HOME_TO_SAFE_ZONE)
|
||||
// move to a height where we can use the full xy-area
|
||||
do_blocking_move_to_z(delta_clip_start_height);
|
||||
@@ -414,6 +439,17 @@ void GcodeSuite::G28(const bool always_home_all) {
|
||||
tool_change(old_tool_index, NO_FETCH);
|
||||
#endif
|
||||
|
||||
#if ENABLED(IMPROVE_HOMING_RELIABILITY)
|
||||
planner.settings.max_acceleration_mm_per_s2[X_AXIS] = slow_homing.acceleration.x;
|
||||
planner.settings.max_acceleration_mm_per_s2[Y_AXIS] = slow_homing.acceleration.y;
|
||||
#if HAS_CLASSIC_JERK
|
||||
planner.max_jerk[X_AXIS] = slow_homing.jerk.x;
|
||||
planner.max_jerk[Y_AXIS] = slow_homing.jerk.y;
|
||||
#endif
|
||||
|
||||
planner.reset_acceleration_rates();
|
||||
#endif
|
||||
|
||||
ui.refresh();
|
||||
|
||||
report_current_position();
|
||||
|
||||
@@ -445,7 +445,7 @@ void GcodeSuite::G33() {
|
||||
_tower_results = (_4p_calibration && towers_set) || probe_points >= 3,
|
||||
_opposite_results = (_4p_calibration && !towers_set) || probe_points >= 3,
|
||||
_endstop_results = probe_points != 1 && probe_points != -1 && probe_points != 0,
|
||||
_angle_results = probe_points >= 3 && towers_set;
|
||||
_angle_results = probe_points >= 3 && towers_set;
|
||||
static const char save_message[] PROGMEM = "Save with M500 and/or copy to Configuration.h";
|
||||
int8_t iterations = 0;
|
||||
float test_precision,
|
||||
|
||||
@@ -284,7 +284,7 @@ void GcodeSuite::G34() {
|
||||
// Home Z after the alignment procedure
|
||||
process_subcommands_now_P(PSTR("G28 Z"));
|
||||
|
||||
} while(0);
|
||||
}while(0);
|
||||
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("<<< G34");
|
||||
}
|
||||
|
||||
@@ -123,45 +123,47 @@ void GcodeSuite::M48() {
|
||||
randomSeed(millis());
|
||||
|
||||
for (uint8_t n = 0; n < n_samples; n++) {
|
||||
#if HAS_SPI_LCD
|
||||
// Display M48 progress in the status bar
|
||||
ui.status_printf_P(0, PSTR(MSG_M48_POINT ": %d/%d"), int(n + 1), int(n_samples));
|
||||
#endif
|
||||
if (n_legs) {
|
||||
const int dir = (random(0, 10) > 5.0) ? -1 : 1; // clockwise or counter clockwise
|
||||
float angle = random(0, 360);
|
||||
const float radius = random(
|
||||
#if ENABLED(DELTA)
|
||||
(int) (0.1250000000 * (DELTA_PRINTABLE_RADIUS)),
|
||||
(int) (0.3333333333 * (DELTA_PRINTABLE_RADIUS))
|
||||
int(0.1250000000 * (DELTA_PRINTABLE_RADIUS)),
|
||||
int(0.3333333333 * (DELTA_PRINTABLE_RADIUS))
|
||||
#else
|
||||
(int) 5.0, (int) (0.125 * _MIN(X_BED_SIZE, Y_BED_SIZE))
|
||||
int(5), int(0.125 * _MIN(X_BED_SIZE, Y_BED_SIZE))
|
||||
#endif
|
||||
);
|
||||
|
||||
if (verbose_level > 3) {
|
||||
SERIAL_ECHOPAIR("Starting radius: ", radius);
|
||||
SERIAL_ECHOPAIR(" angle: ", angle);
|
||||
SERIAL_ECHOPGM(" Direction: ");
|
||||
if (dir > 0) SERIAL_ECHOPGM("Counter-");
|
||||
SERIAL_ECHOLNPGM("Clockwise");
|
||||
SERIAL_ECHOPAIR("Start radius:", radius, " angle:", angle, " dir:");
|
||||
if (dir > 0) SERIAL_CHAR('C');
|
||||
SERIAL_ECHOLNPGM("CW");
|
||||
}
|
||||
|
||||
for (uint8_t l = 0; l < n_legs - 1; l++) {
|
||||
float delta_angle;
|
||||
|
||||
if (schizoid_flag)
|
||||
if (schizoid_flag) {
|
||||
// The points of a 5 point star are 72 degrees apart. We need to
|
||||
// skip a point and go to the next one on the star.
|
||||
delta_angle = dir * 2.0 * 72.0;
|
||||
|
||||
else
|
||||
}
|
||||
else {
|
||||
// If we do this line, we are just trying to move further
|
||||
// around the circle.
|
||||
delta_angle = dir * (float) random(25, 45);
|
||||
}
|
||||
|
||||
angle += delta_angle;
|
||||
|
||||
while (angle > 360.0) // We probably do not need to keep the angle between 0 and 2*PI, but the
|
||||
angle -= 360.0; // Arduino documentation says the trig functions should not be given values
|
||||
while (angle < 0.0) // outside of this range. It looks like they behave correctly with
|
||||
angle += 360.0; // numbers outside of the range, but just to be safe we clamp them.
|
||||
while (angle > 360.0) angle -= 360.0; // We probably do not need to keep the angle between 0 and 2*PI, but the
|
||||
// Arduino documentation says the trig functions should not be given values
|
||||
while (angle < 0.0) angle += 360.0; // outside of this range. It looks like they behave correctly with
|
||||
// numbers outside of the range, but just to be safe we clamp them.
|
||||
|
||||
X_current = X_probe_location - (X_PROBE_OFFSET_FROM_EXTRUDER) + cos(RADIANS(angle)) * radius;
|
||||
Y_current = Y_probe_location - (Y_PROBE_OFFSET_FROM_EXTRUDER) + sin(RADIANS(angle)) * radius;
|
||||
@@ -175,18 +177,14 @@ void GcodeSuite::M48() {
|
||||
while (!position_is_reachable_by_probe(X_current, Y_current)) {
|
||||
X_current *= 0.8;
|
||||
Y_current *= 0.8;
|
||||
if (verbose_level > 3) {
|
||||
SERIAL_ECHOPAIR("Pulling point towards center:", X_current);
|
||||
SERIAL_ECHOLNPAIR(", ", Y_current);
|
||||
}
|
||||
if (verbose_level > 3)
|
||||
SERIAL_ECHOLNPAIR("Moving inward: X", X_current, " Y", Y_current);
|
||||
}
|
||||
#endif
|
||||
if (verbose_level > 3) {
|
||||
SERIAL_ECHOPGM("Going to:");
|
||||
SERIAL_ECHOPAIR(" X", X_current);
|
||||
SERIAL_ECHOPAIR(" Y", Y_current);
|
||||
SERIAL_ECHOLNPAIR(" Z", current_position[Z_AXIS]);
|
||||
}
|
||||
|
||||
if (verbose_level > 3)
|
||||
SERIAL_ECHOLNPAIR("Going to: X", X_current, " Y", Y_current, " Z", current_position[Z_AXIS]);
|
||||
|
||||
do_blocking_move_to_xy(X_current, Y_current);
|
||||
} // n_legs loop
|
||||
} // n_legs
|
||||
@@ -220,7 +218,7 @@ void GcodeSuite::M48() {
|
||||
if (verbose_level > 0) {
|
||||
if (verbose_level > 1) {
|
||||
SERIAL_ECHO(n + 1);
|
||||
SERIAL_ECHOPAIR(" of ", (int)n_samples);
|
||||
SERIAL_ECHOPAIR(" of ", int(n_samples));
|
||||
SERIAL_ECHOPAIR_F(": z: ", sample_set[n], 3);
|
||||
if (verbose_level > 2) {
|
||||
SERIAL_ECHOPAIR_F(" mean: ", mean, 4);
|
||||
@@ -254,8 +252,7 @@ void GcodeSuite::M48() {
|
||||
#if HAS_SPI_LCD
|
||||
// Display M48 results in the status bar
|
||||
char sigma_str[8];
|
||||
dtostrf(sigma, 2, 6, sigma_str);
|
||||
ui.status_printf_P(0, PSTR(MSG_M48_DEVIATION ": %s"), sigma_str);
|
||||
ui.status_printf_P(0, PSTR(MSG_M48_DEVIATION ": %s"), dtostrf(sigma, 2, 6, sigma_str));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -42,6 +42,10 @@
|
||||
#include "../../feature/host_actions.h"
|
||||
#endif
|
||||
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
#include "../../lcd/extensible_ui/ui_api.h"
|
||||
#endif
|
||||
|
||||
#ifndef GET_PIN_MAP_PIN_M43
|
||||
#define GET_PIN_MAP_PIN_M43(Q) GET_PIN_MAP_PIN(Q)
|
||||
#endif
|
||||
@@ -329,6 +333,9 @@ void GcodeSuite::M43() {
|
||||
#if ENABLED(HOST_PROMPT_SUPPORT)
|
||||
host_prompt_do(PROMPT_USER_CONTINUE, PSTR("M43 Wait Called"), PSTR("Continue"));
|
||||
#endif
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onUserConfirmRequired(PSTR("M43 Wait Called"));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
for (;;) {
|
||||
|
||||
@@ -30,11 +30,21 @@
|
||||
#endif
|
||||
|
||||
/**
|
||||
* M17: Enable power on all stepper motors
|
||||
* M17: Enable stepper motors
|
||||
*/
|
||||
void GcodeSuite::M17() {
|
||||
LCD_MESSAGEPGM(MSG_NO_MOVE);
|
||||
enable_all_steppers();
|
||||
if (parser.seen("XYZE")) {
|
||||
if (parser.seen('X')) enable_X();
|
||||
if (parser.seen('Y')) enable_Y();
|
||||
if (parser.seen('Z')) enable_Z();
|
||||
#if HAS_E_STEPPER_ENABLE
|
||||
if (parser.seen('E')) enable_e_steppers();
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
LCD_MESSAGEPGM(MSG_NO_MOVE);
|
||||
enable_all_steppers();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -45,20 +55,17 @@ void GcodeSuite::M18_M84() {
|
||||
stepper_inactive_time = parser.value_millis_from_seconds();
|
||||
}
|
||||
else {
|
||||
bool all_axis = !(parser.seen('X') || parser.seen('Y') || parser.seen('Z') || parser.seen('E'));
|
||||
if (all_axis) {
|
||||
planner.finish_and_disable();
|
||||
}
|
||||
else {
|
||||
if (parser.seen("XYZE")) {
|
||||
planner.synchronize();
|
||||
if (parser.seen('X')) disable_X();
|
||||
if (parser.seen('Y')) disable_Y();
|
||||
if (parser.seen('Z')) disable_Z();
|
||||
// Only disable on boards that have separate ENABLE_PINS or another method for disabling the driver
|
||||
#if (E0_ENABLE_PIN != X_ENABLE_PIN && E1_ENABLE_PIN != Y_ENABLE_PIN) || AXIS_DRIVER_TYPE_E0(TMC2660) || AXIS_DRIVER_TYPE_E1(TMC2660) || AXIS_DRIVER_TYPE_E2(TMC2660) || AXIS_DRIVER_TYPE_E3(TMC2660) || AXIS_DRIVER_TYPE_E4(TMC2660) || AXIS_DRIVER_TYPE_E5(TMC2660)
|
||||
#if HAS_E_STEPPER_ENABLE
|
||||
if (parser.seen('E')) disable_e_steppers();
|
||||
#endif
|
||||
}
|
||||
else
|
||||
planner.finish_and_disable();
|
||||
|
||||
#if HAS_LCD_MENU && ENABLED(AUTO_BED_LEVELING_UBL)
|
||||
if (ubl.lcd_map_control) {
|
||||
|
||||
@@ -52,7 +52,7 @@ void GcodeSuite::M502() {
|
||||
* M503: print settings currently in memory
|
||||
*/
|
||||
void GcodeSuite::M503() {
|
||||
(void)settings.report(parser.boolval('S', true));
|
||||
(void)settings.report(!parser.boolval('S', true));
|
||||
}
|
||||
|
||||
#endif // !DISABLE_M503
|
||||
|
||||
@@ -101,8 +101,12 @@ void L6470_report_current(L6470 &motor, const uint8_t axis) {
|
||||
#endif
|
||||
sprintf_P(temp_buf, PSTR("\n...OverCurrent Threshold: %2d (%4d mA)"), overcurrent_threshold, (overcurrent_threshold + 1) * 375);
|
||||
SERIAL_ECHO(temp_buf);
|
||||
sprintf_P(temp_buf, PSTR(" Stall Threshold: %2d (%7.2f mA)"), stall_threshold, (stall_threshold + 1) * 31.25);
|
||||
|
||||
char numstr[11];
|
||||
dtostrf((stall_threshold + 1) * 31.25, 1, 2, numstr);
|
||||
sprintf_P(temp_buf, PSTR(" Stall Threshold: %2d (%s mA)"), stall_threshold, numstr);
|
||||
SERIAL_ECHO(temp_buf);
|
||||
|
||||
SERIAL_ECHOPGM(" Motor Status: ");
|
||||
const char * const stat_str;
|
||||
switch (motor_status) {
|
||||
@@ -114,24 +118,42 @@ void L6470_report_current(L6470 &motor, const uint8_t axis) {
|
||||
}
|
||||
serialprintPGM(stat_str);
|
||||
SERIAL_EOL();
|
||||
|
||||
SERIAL_ECHOPAIR("...microsteps: ", microsteps);
|
||||
SERIAL_ECHOPAIR(" ADC_OUT: ", adc_out);
|
||||
SERIAL_ECHOPGM(" Vs_compensation: ");
|
||||
serialprintPGM((motor.GetParam(L6470_CONFIG) & CONFIG_EN_VSCOMP) ? PSTR("ENABLED ") : PSTR("DISABLED"));
|
||||
sprintf_P(temp_buf, PSTR(" Compensation coefficient: ~%4.2f\n"), comp_coef * 0.01f);
|
||||
SERIAL_ECHO(temp_buf);
|
||||
|
||||
SERIAL_ECHOLNPGM(" Compensation coefficient: ", dtostrf(comp_coef * 0.01f, 7, 2, numstr));
|
||||
SERIAL_ECHOPAIR("...KVAL_HOLD: ", motor.GetParam(L6470_KVAL_HOLD));
|
||||
SERIAL_ECHOPAIR(" KVAL_RUN : ", motor.GetParam(L6470_KVAL_RUN));
|
||||
SERIAL_ECHOPAIR(" KVAL_ACC: ", motor.GetParam(L6470_KVAL_ACC));
|
||||
SERIAL_ECHOPAIR(" KVAL_DEC: ", motor.GetParam(L6470_KVAL_DEC));
|
||||
SERIAL_ECHOPGM(" V motor max = ");
|
||||
float val;
|
||||
PGM_P suf;
|
||||
switch (motor_status) {
|
||||
case 0: sprintf_P(temp_buf, PSTR(" %4.1f%% (KVAL_HOLD)\n"), float(motor.GetParam(L6470_KVAL_HOLD)) * 100 / 256); break;
|
||||
case 1: sprintf_P(temp_buf, PSTR(" %4.1f%% (KVAL_RUN) \n"), float(motor.GetParam(L6470_KVAL_RUN)) * 100 / 256); break;
|
||||
case 2: sprintf_P(temp_buf, PSTR(" %4.1f%% (KVAL_ACC) \n"), float(motor.GetParam(L6470_KVAL_ACC)) * 100 / 256); break;
|
||||
case 3: sprintf_P(temp_buf, PSTR(" %4.1f%% (KVAL_DEC) \n"), float(motor.GetParam(L6470_KVAL_DEC)) * 100 / 256); break;
|
||||
case 0:
|
||||
val = motor.GetParam(L6470_KVAL_HOLD);
|
||||
suf = PSTR("(KVAL_HOLD)");
|
||||
break;
|
||||
case 1:
|
||||
val = motor.GetParam(L6470_KVAL_RUN);
|
||||
suf = PSTR("(KVAL_RUN)");
|
||||
break;
|
||||
case 2:
|
||||
val = motor.GetParam(L6470_KVAL_ACC);
|
||||
suf = PSTR("(KVAL_ACC)");
|
||||
break;
|
||||
case 3:
|
||||
val = motor.GetParam(L6470_KVAL_DEC);
|
||||
suf = PSTR("(KVAL_DEC)");
|
||||
break;
|
||||
}
|
||||
SERIAL_ECHO(temp_buf);
|
||||
SERIAL_ECHO(dtostrf(val * 100 / 256, 10, 2, numstr));
|
||||
SERIAL_ECHO("%% ");
|
||||
serialprintPGM(suf);
|
||||
SERIAL_EOL();
|
||||
}
|
||||
|
||||
void GcodeSuite::M906() {
|
||||
@@ -150,7 +172,7 @@ void GcodeSuite::M906() {
|
||||
report_current = false;
|
||||
|
||||
if (planner.has_blocks_queued() || planner.cleaning_buffer_counter) {
|
||||
SERIAL_ECHOLNPGM("ERROR - can't set KVAL_HOLD while steppers are moving");
|
||||
SERIAL_ECHOLNPGM("!Can't set KVAL_HOLD with steppers moving");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,6 +32,19 @@
|
||||
#define DEBUG_OUT ENABLED(L6470_CHITCHAT)
|
||||
#include "../../../core/debug_out.h"
|
||||
|
||||
static void jiggle_axis(const char axis_char, const float &min, const float &max, const float &rate) {
|
||||
char gcode_string[30], str1[11], str2[11];
|
||||
|
||||
// Turn the motor(s) both directions
|
||||
sprintf_P(gcode_string, PSTR("G0 %c%s F%s"), axis_char, dtostrf(min, 1, 3, str1), dtostrf(rate, 1, 3, str2));
|
||||
process_subcommands_now(gcode_string);
|
||||
|
||||
sprintf_P(gcode_string, PSTR("G0 %c%s F%s"), axis_char, dtostrf(max, 1, 3, str1), str2);
|
||||
process_subcommands_now(gcode_string);
|
||||
|
||||
planner.synchronize();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* M916: Increase KVAL_HOLD until thermal warning
|
||||
@@ -85,14 +98,11 @@ void GcodeSuite::M916() {
|
||||
|
||||
DEBUG_ECHOLNPAIR("feedrate = ", final_feedrate);
|
||||
|
||||
planner.synchronize(); // wait for all current movement commands to complete
|
||||
planner.synchronize(); // Wait for moves to finish
|
||||
|
||||
for (j = 0; j < driver_count; j++)
|
||||
L6470.get_status(axis_index[j]); // clear out any pre-existing error flags
|
||||
L6470.get_status(axis_index[j]); // Clear out error flags
|
||||
|
||||
char temp_axis_string[] = " ";
|
||||
temp_axis_string[0] = axis_mon[0][0]; // need to have a string for use within sprintf format section
|
||||
char gcode_string[80];
|
||||
uint16_t status_composite = 0;
|
||||
|
||||
DEBUG_ECHOLNPGM(".\n.");
|
||||
@@ -104,15 +114,8 @@ void GcodeSuite::M916() {
|
||||
for (j = 0; j < driver_count; j++)
|
||||
L6470.set_param(axis_index[j], L6470_KVAL_HOLD, kval_hold);
|
||||
|
||||
// turn the motor(s) both directions
|
||||
sprintf_P(gcode_string, PSTR("G0 %s%4.3f F%4.3f"), temp_axis_string, position_min, final_feedrate);
|
||||
process_subcommands_now(gcode_string);
|
||||
|
||||
sprintf_P(gcode_string, PSTR("G0 %s%4.3f F%4.3f"), temp_axis_string, position_max, final_feedrate);
|
||||
process_subcommands_now(gcode_string);
|
||||
|
||||
// get the status after the motors have stopped
|
||||
planner.synchronize();
|
||||
// Turn the motor(s) both directions
|
||||
jiggle_axis(axis_mon[0][0], position_min, position_max, final_feedrate);
|
||||
|
||||
status_composite = 0; // clear out the old bits
|
||||
|
||||
@@ -201,12 +204,9 @@ void GcodeSuite::M917() {
|
||||
|
||||
DEBUG_ECHOLNPAIR("feedrate = ", final_feedrate);
|
||||
|
||||
planner.synchronize(); // wait for all current movement commands to complete
|
||||
planner.synchronize(); // Wait for moves to finish
|
||||
for (j = 0; j < driver_count; j++)
|
||||
L6470.get_status(axis_index[j]); // clear out any pre-existing error flags
|
||||
char temp_axis_string[] = " ";
|
||||
temp_axis_string[0] = axis_mon[0][0]; // need to have a string for use within sprintf format section
|
||||
char gcode_string[80];
|
||||
L6470.get_status(axis_index[j]); // Clear out error flags
|
||||
uint16_t status_composite = 0;
|
||||
uint8_t test_phase = 0;
|
||||
// 0 - decreasing OCD - exit when OCD warning occurs (ignore STALL)
|
||||
@@ -225,13 +225,7 @@ void GcodeSuite::M917() {
|
||||
DEBUG_ECHOPAIR("STALL threshold : ", (stall_th_val + 1) * 31.25);
|
||||
DEBUG_ECHOLNPAIR(" OCD threshold : ", (ocd_th_val + 1) * 375);
|
||||
|
||||
sprintf_P(gcode_string, PSTR("G0 %s%4.3f F%4.3f"), temp_axis_string, position_min, final_feedrate);
|
||||
process_subcommands_now(gcode_string);
|
||||
|
||||
sprintf_P(gcode_string, PSTR("G0 %s%4.3f F%4.3f"), temp_axis_string, position_max, final_feedrate);
|
||||
process_subcommands_now(gcode_string);
|
||||
|
||||
planner.synchronize();
|
||||
jiggle_axis(axis_mon[0][0], position_min, position_max, final_feedrate);
|
||||
|
||||
status_composite = 0; // clear out the old bits
|
||||
|
||||
@@ -500,30 +494,19 @@ void GcodeSuite::M918() {
|
||||
float feedrate_inc = final_feedrate / 10, // start at 1/10 of max & go up by 1/10 per step)
|
||||
current_feedrate = 0;
|
||||
|
||||
planner.synchronize(); // wait for all current movement commands to complete
|
||||
planner.synchronize(); // Wait for moves to finish
|
||||
|
||||
for (j = 0; j < driver_count; j++)
|
||||
L6470.get_status(axis_index[j]); // clear all error flags
|
||||
L6470.get_status(axis_index[j]); // Clear all error flags
|
||||
|
||||
char temp_axis_string[2];
|
||||
temp_axis_string[0] = axis_mon[0][0]; // need to have a string for use within sprintf format section
|
||||
temp_axis_string[1] = '\n';
|
||||
|
||||
char gcode_string[80];
|
||||
uint16_t status_composite = 0;
|
||||
DEBUG_ECHOLNPGM(".\n.\n."); // make the feedrate prints easier to see
|
||||
DEBUG_ECHOLNPGM(".\n.\n."); // Make the feedrate prints easier to see
|
||||
|
||||
do {
|
||||
current_feedrate += feedrate_inc;
|
||||
DEBUG_ECHOLNPAIR("...feedrate = ", current_feedrate);
|
||||
|
||||
sprintf_P(gcode_string, PSTR("G0 %s%4.3f F%4.3f"), temp_axis_string, position_min, current_feedrate);
|
||||
process_subcommands_now(gcode_string);
|
||||
|
||||
sprintf_P(gcode_string, PSTR("G0 %s%4.3f F%4.3f"), temp_axis_string, position_max, current_feedrate);
|
||||
process_subcommands_now(gcode_string);
|
||||
|
||||
planner.synchronize();
|
||||
jiggle_axis(axis_mon[0][0], position_min, position_max, current_feedrate);
|
||||
|
||||
for (j = 0; j < driver_count; j++) {
|
||||
axis_status[j] = (~L6470.get_status(axis_index[j])) & 0x0800; // bits of interest are all active low
|
||||
|
||||
@@ -342,6 +342,10 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
|
||||
case 12: M12(); break; // M12: Synchronize and optionally force a CLC set
|
||||
#endif
|
||||
|
||||
#if ENABLED(EXPECTED_PRINTER_CHECK)
|
||||
case 16: M16(); break; // M16: Expected printer check
|
||||
#endif
|
||||
|
||||
case 17: M17(); break; // M17: Enable all stepper motors
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
|
||||
@@ -83,6 +83,7 @@
|
||||
* M8 - Turn flood coolant ON. (Requires COOLANT_CONTROL)
|
||||
* M9 - Turn coolant OFF. (Requires COOLANT_CONTROL)
|
||||
* M12 - Set up closed loop control system. (Requires EXTERNAL_CLOSED_LOOP_CONTROLLER)
|
||||
* M16 - Expected printer check. (Requires EXPECTED_PRINTER_CHECK)
|
||||
* M17 - Enable/Power all stepper motors
|
||||
* M18 - Disable all stepper motors; same as M84
|
||||
* M20 - List SD card. (Requires SDSUPPORT)
|
||||
@@ -472,6 +473,10 @@ private:
|
||||
static void M12();
|
||||
#endif
|
||||
|
||||
#if ENABLED(EXPECTED_PRINTER_CHECK)
|
||||
static void M16();
|
||||
#endif
|
||||
|
||||
static void M17();
|
||||
|
||||
static void M18_M84();
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
SERIAL_CHAR(' ');
|
||||
SERIAL_CHAR(axis_codes[i]);
|
||||
SERIAL_CHAR(':');
|
||||
SERIAL_ECHO(dtostrf(pos[i], 8, precision, str));
|
||||
SERIAL_ECHO(dtostrf(pos[i], 1, precision, str));
|
||||
}
|
||||
SERIAL_EOL();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if ENABLED(EXPECTED_PRINTER_CHECK)
|
||||
|
||||
#include "../gcode.h"
|
||||
#include "../../Marlin.h"
|
||||
|
||||
/**
|
||||
* M16: Expected Printer Check
|
||||
*/
|
||||
void GcodeSuite::M16() {
|
||||
|
||||
if (strcmp_P(parser.string_arg, PSTR(MACHINE_NAME)))
|
||||
kill(PSTR(MSG_EXPECTED_PRINTER));
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -97,6 +97,9 @@ void GcodeSuite::M0_M1() {
|
||||
#if ENABLED(HOST_PROMPT_SUPPORT)
|
||||
host_prompt_do(PROMPT_USER_CONTINUE, PSTR("M0/1 Break Called"), PSTR("Continue"));
|
||||
#endif
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onUserConfirmRequired(PSTR("M0/1 Break Called"));
|
||||
#endif
|
||||
|
||||
if (ms > 0) {
|
||||
ms += millis(); // wait until this time for a click
|
||||
@@ -105,10 +108,6 @@ void GcodeSuite::M0_M1() {
|
||||
else
|
||||
while (wait_for_user) idle();
|
||||
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onUserConfirmRequired(nullptr);
|
||||
#endif
|
||||
|
||||
#if HAS_LEDS_OFF_FLAG
|
||||
printerEventLEDs.onResumeAfterWait();
|
||||
#endif
|
||||
|
||||
@@ -225,6 +225,9 @@ void GCodeParser::parse(char *p) {
|
||||
case 810: case 811: case 812: case 813: case 814:
|
||||
case 815: case 816: case 817: case 818: case 819:
|
||||
#endif
|
||||
#if ENABLED(EXPECTED_PRINTER_CHECK)
|
||||
case 16:
|
||||
#endif
|
||||
case 23: case 28: case 30: case 117: case 118: case 928: string_arg = p; return;
|
||||
default: break;
|
||||
}
|
||||
|
||||
+7
-252
@@ -39,6 +39,11 @@ GCodeQueue queue;
|
||||
#include "../feature/leds/printer_event_leds.h"
|
||||
#endif
|
||||
|
||||
#if ENABLED(BINARY_FILE_TRANSFER)
|
||||
#include "../feature/binary_protocol.h"
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* GCode line number handling. Hosts may opt to include line numbers when
|
||||
* sending commands to Marlin, and lines will be checked for sequentiality.
|
||||
@@ -285,256 +290,6 @@ inline int read_serial(const uint8_t index) {
|
||||
}
|
||||
}
|
||||
|
||||
#if ENABLED(BINARY_FILE_TRANSFER)
|
||||
|
||||
inline bool serial_data_available(const uint8_t index) {
|
||||
switch (index) {
|
||||
case 0: return MYSERIAL0.available();
|
||||
#if NUM_SERIAL > 1
|
||||
case 1: return MYSERIAL1.available();
|
||||
#endif
|
||||
default: return false;
|
||||
}
|
||||
}
|
||||
|
||||
class BinaryStream {
|
||||
public:
|
||||
enum class StreamState : uint8_t {
|
||||
STREAM_RESET,
|
||||
PACKET_RESET,
|
||||
STREAM_HEADER,
|
||||
PACKET_HEADER,
|
||||
PACKET_DATA,
|
||||
PACKET_VALIDATE,
|
||||
PACKET_RESEND,
|
||||
PACKET_FLUSHRX,
|
||||
PACKET_TIMEOUT,
|
||||
STREAM_COMPLETE,
|
||||
STREAM_FAILED,
|
||||
};
|
||||
|
||||
#pragma pack(push, 1)
|
||||
|
||||
struct StreamHeader {
|
||||
uint16_t token;
|
||||
uint32_t filesize;
|
||||
};
|
||||
union {
|
||||
uint8_t stream_header_bytes[sizeof(StreamHeader)];
|
||||
StreamHeader stream_header;
|
||||
};
|
||||
|
||||
struct Packet {
|
||||
struct Header {
|
||||
uint32_t id;
|
||||
uint16_t size, checksum;
|
||||
};
|
||||
union {
|
||||
uint8_t header_bytes[sizeof(Header)];
|
||||
Header header;
|
||||
};
|
||||
uint32_t bytes_received;
|
||||
uint16_t checksum;
|
||||
millis_t timeout;
|
||||
} packet{};
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
void packet_reset() {
|
||||
packet.header.id = 0;
|
||||
packet.header.size = 0;
|
||||
packet.header.checksum = 0;
|
||||
packet.bytes_received = 0;
|
||||
packet.checksum = 0x53A2;
|
||||
packet.timeout = millis() + STREAM_MAX_WAIT;
|
||||
}
|
||||
|
||||
void stream_reset() {
|
||||
packets_received = 0;
|
||||
bytes_received = 0;
|
||||
packet_retries = 0;
|
||||
buffer_next_index = 0;
|
||||
stream_header.token = 0;
|
||||
stream_header.filesize = 0;
|
||||
}
|
||||
|
||||
uint32_t checksum(uint32_t seed, uint8_t value) {
|
||||
return ((seed ^ value) ^ (seed << 8)) & 0xFFFF;
|
||||
}
|
||||
|
||||
// read the next byte from the data stream keeping track of
|
||||
// whether the stream times out from data starvation
|
||||
// takes the data variable by reference in order to return status
|
||||
bool stream_read(uint8_t& data) {
|
||||
if (ELAPSED(millis(), packet.timeout)) {
|
||||
stream_state = StreamState::PACKET_TIMEOUT;
|
||||
return false;
|
||||
}
|
||||
if (!serial_data_available(card.transfer_port_index)) return false;
|
||||
data = read_serial(card.transfer_port_index);
|
||||
packet.timeout = millis() + STREAM_MAX_WAIT;
|
||||
return true;
|
||||
}
|
||||
|
||||
template<const size_t buffer_size>
|
||||
void receive(char (&buffer)[buffer_size]) {
|
||||
uint8_t data = 0;
|
||||
millis_t transfer_timeout = millis() + RX_TIMESLICE;
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
PORT_REDIRECT(card.transfer_port_index);
|
||||
#endif
|
||||
|
||||
while (PENDING(millis(), transfer_timeout)) {
|
||||
switch (stream_state) {
|
||||
case StreamState::STREAM_RESET:
|
||||
stream_reset();
|
||||
case StreamState::PACKET_RESET:
|
||||
packet_reset();
|
||||
stream_state = StreamState::PACKET_HEADER;
|
||||
break;
|
||||
case StreamState::STREAM_HEADER: // The filename could also be in this packet, rather than handling it in the gcode
|
||||
for (size_t i = 0; i < sizeof(stream_header); ++i)
|
||||
stream_header_bytes[i] = buffer[i];
|
||||
|
||||
if (stream_header.token == 0x1234) {
|
||||
stream_state = StreamState::PACKET_RESET;
|
||||
bytes_received = 0;
|
||||
time_stream_start = millis();
|
||||
// confirm active stream and the maximum block size supported
|
||||
SERIAL_ECHO_START();
|
||||
SERIAL_ECHOLNPAIR("Datastream initialized (", stream_header.filesize, " bytes expected)");
|
||||
SERIAL_ECHOLNPAIR("so", buffer_size);
|
||||
}
|
||||
else {
|
||||
SERIAL_ECHO_MSG("Datastream init error (invalid token)");
|
||||
stream_state = StreamState::STREAM_FAILED;
|
||||
}
|
||||
buffer_next_index = 0;
|
||||
break;
|
||||
case StreamState::PACKET_HEADER:
|
||||
if (!stream_read(data)) break;
|
||||
|
||||
packet.header_bytes[packet.bytes_received++] = data;
|
||||
if (packet.bytes_received == sizeof(Packet::Header)) {
|
||||
if (packet.header.id == packets_received) {
|
||||
buffer_next_index = 0;
|
||||
packet.bytes_received = 0;
|
||||
stream_state = StreamState::PACKET_DATA;
|
||||
}
|
||||
else {
|
||||
SERIAL_ECHO_MSG("Datastream packet out of order");
|
||||
stream_state = StreamState::PACKET_FLUSHRX;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case StreamState::PACKET_DATA:
|
||||
if (!stream_read(data)) break;
|
||||
|
||||
if (buffer_next_index < buffer_size)
|
||||
buffer[buffer_next_index] = data;
|
||||
else {
|
||||
SERIAL_ECHO_MSG("Datastream packet data buffer overrun");
|
||||
stream_state = StreamState::STREAM_FAILED;
|
||||
break;
|
||||
}
|
||||
|
||||
packet.checksum = checksum(packet.checksum, data);
|
||||
packet.bytes_received++;
|
||||
buffer_next_index++;
|
||||
|
||||
if (packet.bytes_received == packet.header.size)
|
||||
stream_state = StreamState::PACKET_VALIDATE;
|
||||
|
||||
break;
|
||||
case StreamState::PACKET_VALIDATE:
|
||||
if (packet.header.checksum == packet.checksum) {
|
||||
packet_retries = 0;
|
||||
packets_received++;
|
||||
bytes_received += packet.header.size;
|
||||
|
||||
if (packet.header.id == 0) // id 0 is always the stream descriptor
|
||||
stream_state = StreamState::STREAM_HEADER; // defer packet confirmation to STREAM_HEADER state
|
||||
else {
|
||||
if (bytes_received < stream_header.filesize) {
|
||||
stream_state = StreamState::PACKET_RESET; // reset and receive next packet
|
||||
SERIAL_ECHOLNPAIR("ok", packet.header.id); // transmit confirm packet received and valid token
|
||||
}
|
||||
else
|
||||
stream_state = StreamState::STREAM_COMPLETE; // no more data required
|
||||
|
||||
if (card.write(buffer, buffer_next_index) < 0) {
|
||||
stream_state = StreamState::STREAM_FAILED;
|
||||
SERIAL_ECHO_MSG("SDCard IO Error");
|
||||
break;
|
||||
};
|
||||
}
|
||||
}
|
||||
else {
|
||||
SERIAL_ECHO_START();
|
||||
SERIAL_ECHOLNPAIR("Block(", packet.header.id, ") Corrupt");
|
||||
stream_state = StreamState::PACKET_FLUSHRX;
|
||||
}
|
||||
break;
|
||||
case StreamState::PACKET_RESEND:
|
||||
if (packet_retries < MAX_RETRIES) {
|
||||
packet_retries++;
|
||||
stream_state = StreamState::PACKET_RESET;
|
||||
SERIAL_ECHO_START();
|
||||
SERIAL_ECHOLNPAIR("Resend request ", int(packet_retries));
|
||||
SERIAL_ECHOLNPAIR("rs", packet.header.id); // transmit resend packet token
|
||||
}
|
||||
else {
|
||||
stream_state = StreamState::STREAM_FAILED;
|
||||
}
|
||||
break;
|
||||
case StreamState::PACKET_FLUSHRX:
|
||||
if (ELAPSED(millis(), packet.timeout)) {
|
||||
stream_state = StreamState::PACKET_RESEND;
|
||||
break;
|
||||
}
|
||||
if (!serial_data_available(card.transfer_port_index)) break;
|
||||
read_serial(card.transfer_port_index); // throw away data
|
||||
packet.timeout = millis() + STREAM_MAX_WAIT;
|
||||
break;
|
||||
case StreamState::PACKET_TIMEOUT:
|
||||
SERIAL_ECHO_START();
|
||||
SERIAL_ECHOLNPGM("Datastream timeout");
|
||||
stream_state = StreamState::PACKET_RESEND;
|
||||
break;
|
||||
case StreamState::STREAM_COMPLETE:
|
||||
stream_state = StreamState::STREAM_RESET;
|
||||
card.flag.binary_mode = false;
|
||||
SERIAL_ECHO_START();
|
||||
SERIAL_ECHO(card.filename);
|
||||
SERIAL_ECHOLNPAIR(" transfer completed @ ", ((bytes_received / (millis() - time_stream_start) * 1000) / 1024), "KiB/s");
|
||||
SERIAL_ECHOLNPGM("sc"); // transmit stream complete token
|
||||
card.closefile();
|
||||
return;
|
||||
case StreamState::STREAM_FAILED:
|
||||
stream_state = StreamState::STREAM_RESET;
|
||||
card.flag.binary_mode = false;
|
||||
card.closefile();
|
||||
card.removeFile(card.filename);
|
||||
SERIAL_ECHO_START();
|
||||
SERIAL_ECHOLNPGM("File transfer failed");
|
||||
SERIAL_ECHOLNPGM("sf"); // transmit stream failed token
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static const uint16_t STREAM_MAX_WAIT = 500, RX_TIMESLICE = 20, MAX_RETRIES = 3;
|
||||
uint8_t packet_retries;
|
||||
uint16_t buffer_next_index;
|
||||
uint32_t packets_received, bytes_received;
|
||||
millis_t time_stream_start;
|
||||
StreamState stream_state = StreamState::STREAM_RESET;
|
||||
|
||||
} binaryStream{};
|
||||
|
||||
#endif // BINARY_FILE_TRANSFER
|
||||
|
||||
void GCodeQueue::gcode_line_error(PGM_P const err, const int8_t port) {
|
||||
PORT_REDIRECT(port);
|
||||
SERIAL_ERROR_START();
|
||||
@@ -564,13 +319,13 @@ void GCodeQueue::get_serial_commands() {
|
||||
;
|
||||
|
||||
#if ENABLED(BINARY_FILE_TRANSFER)
|
||||
if (card.flag.saving && card.flag.binary_mode) {
|
||||
if (card.flag.binary_mode) {
|
||||
/**
|
||||
* For binary stream file transfer, use serial_line_buffer as the working
|
||||
* receive buffer (which limits the packet size to MAX_CMD_SIZE).
|
||||
* The receive buffer also limits the packet size for reliable transmission.
|
||||
*/
|
||||
binaryStream.receive(serial_line_buffer[card.transfer_port_index]);
|
||||
binaryStream[card.transfer_port_index].receive(serial_line_buffer[card.transfer_port_index]);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -48,10 +48,7 @@ void GcodeSuite::M28() {
|
||||
|
||||
// Binary transfer mode
|
||||
if ((card.flag.binary_mode = binary_mode)) {
|
||||
SERIAL_ECHO_START();
|
||||
SERIAL_ECHO(" preparing to receive: ");
|
||||
SERIAL_ECHOLN(p);
|
||||
card.openFile(p, false);
|
||||
SERIAL_ECHO_MSG("Switching to Binary Protocol");
|
||||
#if NUM_SERIAL > 1
|
||||
card.transfer_port_index = queue.port[queue.index_r];
|
||||
#endif
|
||||
|
||||
@@ -33,9 +33,6 @@
|
||||
*/
|
||||
void GcodeSuite::M75() {
|
||||
print_job_timer.start();
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onPrintTimerStarted();
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -30,9 +30,6 @@
|
||||
|
||||
#define DOGLCD
|
||||
#define IS_ULTIPANEL
|
||||
#define DEFAULT_LCD_CONTRAST 90
|
||||
#define LCD_CONTRAST_MIN 60
|
||||
#define LCD_CONTRAST_MAX 140
|
||||
|
||||
#elif ENABLED(ZONESTAR_LCD)
|
||||
|
||||
@@ -63,25 +60,13 @@
|
||||
#define IS_ULTIPANEL
|
||||
|
||||
#if ENABLED(miniVIKI)
|
||||
#define LCD_CONTRAST_MIN 75
|
||||
#define LCD_CONTRAST_MAX 115
|
||||
#define DEFAULT_LCD_CONTRAST 95
|
||||
#define U8GLIB_ST7565_64128N
|
||||
#elif ENABLED(VIKI2)
|
||||
#define LCD_CONTRAST_MIN 0
|
||||
#define LCD_CONTRAST_MAX 255
|
||||
#define DEFAULT_LCD_CONTRAST 140
|
||||
#define U8GLIB_ST7565_64128N
|
||||
#elif ENABLED(ELB_FULL_GRAPHIC_CONTROLLER)
|
||||
#define LCD_CONTRAST_MIN 90
|
||||
#define LCD_CONTRAST_MAX 130
|
||||
#define DEFAULT_LCD_CONTRAST 110
|
||||
#define U8GLIB_LM6059_AF
|
||||
#define SD_DETECT_INVERTED
|
||||
#elif ENABLED(AZSMZ_12864)
|
||||
#define LCD_CONTRAST_MIN 120
|
||||
#define LCD_CONTRAST_MAX 255
|
||||
#define DEFAULT_LCD_CONTRAST 190
|
||||
#define U8GLIB_ST7565_64128N
|
||||
#endif
|
||||
|
||||
@@ -128,17 +113,12 @@
|
||||
#elif ENABLED(MKS_MINI_12864)
|
||||
|
||||
#define MINIPANEL
|
||||
#define DEFAULT_LCD_CONTRAST 150
|
||||
#define LCD_CONTRAST_MAX 255
|
||||
|
||||
#elif ANY(FYSETC_MINI_12864_X_X, FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0, FYSETC_MINI_12864_2_1)
|
||||
|
||||
#define FYSETC_MINI_12864
|
||||
#define DOGLCD
|
||||
#define IS_ULTIPANEL
|
||||
#define LCD_CONTRAST_MIN 0
|
||||
#define LCD_CONTRAST_MAX 255
|
||||
#define DEFAULT_LCD_CONTRAST 220
|
||||
#define LED_COLORS_REDUCE_GREEN
|
||||
#if HAS_POWER_SWITCH && EITHER(FYSETC_MINI_12864_2_0, FYSETC_MINI_12864_2_1)
|
||||
#define LED_BACKLIGHT_TIMEOUT 10000
|
||||
@@ -166,9 +146,6 @@
|
||||
#define IS_ULTIPANEL
|
||||
#define U8GLIB_SSD1309
|
||||
#define LCD_RESET_PIN LCD_PINS_D6 // This controller need a reset pin
|
||||
#define LCD_CONTRAST_MIN 0
|
||||
#define LCD_CONTRAST_MAX 254
|
||||
#define DEFAULT_LCD_CONTRAST 127
|
||||
#define ENCODER_PULSES_PER_STEP 2
|
||||
#define ENCODER_STEPS_PER_MENU_ITEM 2
|
||||
|
||||
@@ -190,9 +167,6 @@
|
||||
#if ENABLED(MAKRPANEL)
|
||||
#define U8GLIB_ST7565_64128N
|
||||
#endif
|
||||
#ifndef DEFAULT_LCD_CONTRAST
|
||||
#define DEFAULT_LCD_CONTRAST 17
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if ENABLED(IS_U8GLIB_SSD1306)
|
||||
@@ -368,7 +342,7 @@
|
||||
#endif
|
||||
|
||||
// Extensible UI serial touch screens. (See src/lcd/extensible_ui)
|
||||
#if EITHER(MALYAN_LCD, DGUS_LCD)
|
||||
#if ANY(MALYAN_LCD, DGUS_LCD, LULZBOT_TOUCH_UI)
|
||||
#define IS_EXTUI
|
||||
#define EXTENSIBLE_UI
|
||||
#endif
|
||||
@@ -381,22 +355,6 @@
|
||||
#define HAS_LCD_MENU (ENABLED(ULTIPANEL) && DISABLED(NO_LCD_MENUS))
|
||||
#define HAS_ADC_BUTTONS ENABLED(ADC_KEYPAD)
|
||||
|
||||
/**
|
||||
* Default LCD contrast for Graphical LCD displays
|
||||
*/
|
||||
#define HAS_LCD_CONTRAST (HAS_GRAPHICAL_LCD && defined(DEFAULT_LCD_CONTRAST))
|
||||
#if HAS_LCD_CONTRAST
|
||||
#ifndef LCD_CONTRAST_MIN
|
||||
#define LCD_CONTRAST_MIN 0
|
||||
#endif
|
||||
#ifndef LCD_CONTRAST_MAX
|
||||
#define LCD_CONTRAST_MAX 63
|
||||
#endif
|
||||
#ifndef DEFAULT_LCD_CONTRAST
|
||||
#define DEFAULT_LCD_CONTRAST 32
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Extruders have some combination of stepper motors and hotends
|
||||
* so we separate these concepts into the defines:
|
||||
@@ -567,7 +525,7 @@
|
||||
#define HAS_COLOR_LEDS ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED)
|
||||
#define HAS_LEDS_OFF_FLAG (BOTH(PRINTER_EVENT_LEDS, SDSUPPORT) && HAS_RESUME_CONTINUE)
|
||||
#define HAS_PRINT_PROGRESS EITHER(SDSUPPORT, LCD_SET_PROGRESS_MANUALLY)
|
||||
#define HAS_SERVICE_INTERVALS (SERVICE_INTERVAL_1 > 0 || SERVICE_INTERVAL_2 > 0 || SERVICE_INTERVAL_3 > 0)
|
||||
#define HAS_SERVICE_INTERVALS (ENABLED(PRINTCOUNTER) && (SERVICE_INTERVAL_1 > 0 || SERVICE_INTERVAL_2 > 0 || SERVICE_INTERVAL_3 > 0))
|
||||
#define HAS_FILAMENT_SENSOR ENABLED(FILAMENT_RUNOUT_SENSOR)
|
||||
|
||||
#define Z_MULTI_STEPPER_DRIVERS EITHER(Z_DUAL_STEPPER_DRIVERS, Z_TRIPLE_STEPPER_DRIVERS)
|
||||
@@ -594,32 +552,6 @@
|
||||
#define INVERT_E_DIR false
|
||||
#endif
|
||||
|
||||
#if ENABLED(HOST_ACTION_COMMANDS)
|
||||
#ifndef ACTION_ON_PAUSE
|
||||
#define ACTION_ON_PAUSE "pause"
|
||||
#endif
|
||||
#ifndef ACTION_ON_RESUME
|
||||
#define ACTION_ON_RESUME "resume"
|
||||
#endif
|
||||
#ifndef ACTION_ON_PAUSED
|
||||
#define ACTION_ON_PAUSED "paused"
|
||||
#endif
|
||||
#ifndef ACTION_ON_RESUMED
|
||||
#define ACTION_ON_RESUMED "resumed"
|
||||
#endif
|
||||
#ifndef ACTION_ON_CANCEL
|
||||
#define ACTION_ON_CANCEL "cancel"
|
||||
#endif
|
||||
#if ENABLED(G29_RETRY_AND_RECOVER)
|
||||
#ifndef ACTION_ON_G29_RECOVER
|
||||
#define ACTION_ON_G29_RECOVER "probe_rewipe"
|
||||
#endif
|
||||
#ifndef ACTION_ON_G29_FAILURE
|
||||
#define ACTION_ON_G29_FAILURE "probe_failed"
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if ENABLED(SLIM_LCD_MENUS)
|
||||
#define BOOT_MARLIN_LOGO_SMALL
|
||||
#endif
|
||||
|
||||
@@ -99,3 +99,6 @@
|
||||
#define LED_USER_PRESET_BRIGHTNESS 255
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Extensible UI pin mapping for RepRapDiscount
|
||||
#define TOUCH_UI_ULTIPANEL ENABLED(LULZBOT_TOUCH_UI) && ANY(AO_EXP1_PINMAP, AO_EXP2_PINMAP, CR10_TFT_PINMAP)
|
||||
|
||||
@@ -246,6 +246,63 @@
|
||||
#define MAX_AUTORETRACT 99
|
||||
#endif
|
||||
|
||||
/**
|
||||
* LCD Contrast for Graphical Displays
|
||||
*/
|
||||
#if ENABLED(CARTESIO_UI)
|
||||
#define _LCD_CONTRAST_MIN 60
|
||||
#define _LCD_CONTRAST_INIT 90
|
||||
#define _LCD_CONTRAST_MAX 140
|
||||
#elif ENABLED(miniVIKI)
|
||||
#define _LCD_CONTRAST_MIN 75
|
||||
#define _LCD_CONTRAST_INIT 95
|
||||
#define _LCD_CONTRAST_MAX 115
|
||||
#elif ENABLED(VIKI2)
|
||||
#define _LCD_CONTRAST_INIT 140
|
||||
#elif ENABLED(ELB_FULL_GRAPHIC_CONTROLLER)
|
||||
#define _LCD_CONTRAST_MIN 90
|
||||
#define _LCD_CONTRAST_INIT 110
|
||||
#define _LCD_CONTRAST_MAX 130
|
||||
#elif ENABLED(AZSMZ_12864)
|
||||
#define _LCD_CONTRAST_MIN 120
|
||||
#define _LCD_CONTRAST_INIT 190
|
||||
#elif ENABLED(MKS_MINI_12864)
|
||||
#define _LCD_CONTRAST_INIT 150
|
||||
#elif ANY(FYSETC_MINI_12864_X_X, FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0, FYSETC_MINI_12864_2_1)
|
||||
#define _LCD_CONTRAST_INIT 220
|
||||
#elif ENABLED(ULTI_CONTROLLER)
|
||||
#define _LCD_CONTRAST_INIT 127
|
||||
#define _LCD_CONTRAST_MAX 254
|
||||
#elif EITHER(MAKRPANEL, MINIPANEL)
|
||||
#define _LCD_CONTRAST_INIT 17
|
||||
#endif
|
||||
|
||||
#define HAS_LCD_CONTRAST defined(_LCD_CONTRAST_INIT)
|
||||
#if HAS_LCD_CONTRAST
|
||||
#ifndef LCD_CONTRAST_MIN
|
||||
#ifdef _LCD_CONTRAST_MIN
|
||||
#define LCD_CONTRAST_MIN _LCD_CONTRAST_MIN
|
||||
#else
|
||||
#define LCD_CONTRAST_MIN 0
|
||||
#endif
|
||||
#endif
|
||||
#ifndef LCD_CONTRAST_INIT
|
||||
#define LCD_CONTRAST_INIT _LCD_CONTRAST_INIT
|
||||
#endif
|
||||
#ifndef LCD_CONTRAST_MAX
|
||||
#ifdef _LCD_CONTRAST_MAX
|
||||
#define LCD_CONTRAST_MAX _LCD_CONTRAST_MAX
|
||||
#elif _LCD_CONTRAST_INIT > 63
|
||||
#define LCD_CONTRAST_MAX 255
|
||||
#else
|
||||
#define LCD_CONTRAST_MAX 63 // ST7567 6-bits contrast
|
||||
#endif
|
||||
#endif
|
||||
#ifndef DEFAULT_LCD_CONTRAST
|
||||
#define DEFAULT_LCD_CONTRAST LCD_CONTRAST_INIT
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Override here because this is set in Configuration_adv.h
|
||||
*/
|
||||
@@ -920,8 +977,18 @@
|
||||
#define X_SENSORLESS (AXIS_HAS_STALLGUARD(X) && defined(X_STALL_SENSITIVITY))
|
||||
#define Y_SENSORLESS (AXIS_HAS_STALLGUARD(Y) && defined(Y_STALL_SENSITIVITY))
|
||||
#define Z_SENSORLESS (AXIS_HAS_STALLGUARD(Z) && defined(Z_STALL_SENSITIVITY))
|
||||
#if ENABLED(SPI_ENDSTOPS)
|
||||
#define X_SPI_SENSORLESS X_SENSORLESS
|
||||
#define Y_SPI_SENSORLESS Y_SENSORLESS
|
||||
#define Z_SPI_SENSORLESS Z_SENSORLESS
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define HAS_E_STEPPER_ENABLE (HAS_E_DRIVER(TMC2660) \
|
||||
|| ( E0_ENABLE_PIN != X_ENABLE_PIN && E1_ENABLE_PIN != X_ENABLE_PIN \
|
||||
&& E0_ENABLE_PIN != Y_ENABLE_PIN && E1_ENABLE_PIN != Y_ENABLE_PIN ) \
|
||||
)
|
||||
|
||||
// Endstops and bed probe
|
||||
#define _HAS_STOP(A,M) (PIN_EXISTS(A##_##M) && !IS_X2_ENDSTOP(A,M) && !IS_Y2_ENDSTOP(A,M) && !IS_Z2_OR_PROBE(A,M))
|
||||
#define HAS_X_MIN _HAS_STOP(X,MIN)
|
||||
@@ -991,7 +1058,21 @@
|
||||
#define HAS_AUTO_FAN_4 (HOTENDS > 4 && PIN_EXISTS(E4_AUTO_FAN))
|
||||
#define HAS_AUTO_FAN_5 (HOTENDS > 5 && PIN_EXISTS(E5_AUTO_FAN))
|
||||
#define HAS_AUTO_CHAMBER_FAN (HAS_TEMP_CHAMBER && PIN_EXISTS(CHAMBER_AUTO_FAN))
|
||||
|
||||
#define HAS_AUTO_FAN (HAS_AUTO_FAN_0 || HAS_AUTO_FAN_1 || HAS_AUTO_FAN_2 || HAS_AUTO_FAN_3 || HAS_AUTO_FAN_4 || HAS_AUTO_FAN_5 || HAS_AUTO_CHAMBER_FAN)
|
||||
#if HAS_AUTO_FAN
|
||||
#define AUTO_CHAMBER_IS_0 (CHAMBER_AUTO_FAN_PIN == E0_AUTO_FAN_PIN)
|
||||
#define AUTO_CHAMBER_IS_1 (CHAMBER_AUTO_FAN_PIN == E1_AUTO_FAN_PIN)
|
||||
#define AUTO_CHAMBER_IS_2 (CHAMBER_AUTO_FAN_PIN == E2_AUTO_FAN_PIN)
|
||||
#define AUTO_CHAMBER_IS_3 (CHAMBER_AUTO_FAN_PIN == E3_AUTO_FAN_PIN)
|
||||
#define AUTO_CHAMBER_IS_4 (CHAMBER_AUTO_FAN_PIN == E4_AUTO_FAN_PIN)
|
||||
#define AUTO_CHAMBER_IS_5 (CHAMBER_AUTO_FAN_PIN == E5_AUTO_FAN_PIN)
|
||||
#define AUTO_CHAMBER_IS_E (AUTO_CHAMBER_IS_0 || AUTO_CHAMBER_IS_1 || AUTO_CHAMBER_IS_2 || AUTO_CHAMBER_IS_3 || AUTO_CHAMBER_IS_4 || AUTO_CHAMBER_IS_5)
|
||||
#endif
|
||||
|
||||
#if !HAS_AUTO_CHAMBER_FAN || AUTO_CHAMBER_IS_E
|
||||
#undef AUTO_POWER_CHAMBER_FAN
|
||||
#endif
|
||||
|
||||
// Other fans
|
||||
#define HAS_FAN0 (PIN_EXISTS(FAN))
|
||||
@@ -1024,7 +1105,8 @@
|
||||
#define HAS_KILL (PIN_EXISTS(KILL))
|
||||
#define HAS_SUICIDE (PIN_EXISTS(SUICIDE))
|
||||
#define HAS_PHOTOGRAPH (PIN_EXISTS(PHOTOGRAPH))
|
||||
#define HAS_BUZZER (PIN_EXISTS(BEEPER) || ENABLED(LCD_USE_I2C_BUZZER) || ENABLED(PCA9632_BUZZER))
|
||||
#define HAS_BUZZER (PIN_EXISTS(BEEPER) || EITHER(LCD_USE_I2C_BUZZER, PCA9632_BUZZER))
|
||||
#define USE_BEEPER (HAS_BUZZER && DISABLED(LCD_USE_I2C_BUZZER, PCA9632_BUZZER))
|
||||
#define HAS_CASE_LIGHT (PIN_EXISTS(CASE_LIGHT) && ENABLED(CASE_LIGHT_ENABLE))
|
||||
|
||||
// Digital control
|
||||
@@ -1546,7 +1628,7 @@
|
||||
#ifndef LCD_FEEDBACK_FREQUENCY_DURATION_MS
|
||||
#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100
|
||||
#endif
|
||||
#else
|
||||
#elif HAS_BUZZER
|
||||
#ifndef LCD_FEEDBACK_FREQUENCY_HZ
|
||||
#define LCD_FEEDBACK_FREQUENCY_HZ 5000
|
||||
#endif
|
||||
|
||||
@@ -1009,6 +1009,13 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Junction deviation is not compatible with kinematic systems.
|
||||
*/
|
||||
#if ENABLED(JUNCTION_DEVIATION) && IS_KINEMATIC
|
||||
#error "Junction deviation is only compatible with Cartesians."
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Probes
|
||||
*/
|
||||
@@ -1892,6 +1899,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
|
||||
+ ENABLED(OVERLORD_OLED) \
|
||||
+ ENABLED(DGUS_LCD) \
|
||||
+ ENABLED(MALYAN_LCD) \
|
||||
+ ENABLED(LULZBOT_TOUCH_UI) \
|
||||
+ ENABLED(FSMC_GRAPHICAL_TFT)
|
||||
#error "Please select no more than one LCD controller option."
|
||||
#endif
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
/**
|
||||
* Marlin release version identifier
|
||||
*/
|
||||
#define SHORT_BUILD_VERSION "2.0.x_R17"
|
||||
#define SHORT_BUILD_VERSION "2.0.x_R1"
|
||||
|
||||
/**
|
||||
* Verbose version identifier which should contain a reference to the location
|
||||
@@ -51,7 +51,7 @@
|
||||
* here we define this default string as the date where the latest release
|
||||
* version was tagged.
|
||||
*/
|
||||
#define STRING_DISTRIBUTION_DATE "2019-08-02"
|
||||
#define STRING_DISTRIBUTION_DATE "2019-08-25"
|
||||
|
||||
/**
|
||||
* Required minimum Configuration.h and Configuration_adv.h file versions.
|
||||
|
||||
@@ -877,7 +877,7 @@ static int pf_bsearch_cb_comp_hd4map_pgm(void *userdata, size_t idx, void * data
|
||||
return hd44780_charmap_compare(&localval, (hd44780_charmap_t *)data_pin);
|
||||
}
|
||||
|
||||
void lcd_moveto(const uint8_t col, const uint8_t row) { lcd.setCursor(col, row); }
|
||||
void lcd_moveto(const lcd_uint_t col, const lcd_uint_t row) { lcd.setCursor(col, row); }
|
||||
|
||||
void lcd_put_int(const int i) { lcd.print(i); }
|
||||
|
||||
|
||||
@@ -269,7 +269,7 @@ void MarlinUI::set_custom_characters(const HD44780CharSet screen_charset/*=CHARS
|
||||
|
||||
#endif // LCD_PROGRESS_BAR
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
#if ENABLED(SDSUPPORT) && HAS_LCD_MENU
|
||||
|
||||
// CHARSET_MENU
|
||||
const static PROGMEM byte refresh[8] = {
|
||||
@@ -319,7 +319,7 @@ void MarlinUI::set_custom_characters(const HD44780CharSet screen_charset/*=CHARS
|
||||
#endif
|
||||
{
|
||||
createChar_P(LCD_STR_UPLEVEL[0], uplevel);
|
||||
#if ENABLED(SDSUPPORT)
|
||||
#if ENABLED(SDSUPPORT) && HAS_LCD_MENU
|
||||
// SD Card sub-menu special characters
|
||||
createChar_P(LCD_STR_REFRESH[0], refresh);
|
||||
createChar_P(LCD_STR_FOLDER[0], folder);
|
||||
@@ -360,23 +360,48 @@ void MarlinUI::init_lcd() {
|
||||
lcd.clear();
|
||||
}
|
||||
|
||||
bool MarlinUI::detected() {
|
||||
return true
|
||||
#if EITHER(LCD_I2C_TYPE_MCP23017, LCD_I2C_TYPE_MCP23008) && defined(DETECT_DEVICE)
|
||||
&& lcd.LcdDetected() == 1
|
||||
#endif
|
||||
;
|
||||
}
|
||||
|
||||
#if HAS_SLOW_BUTTONS
|
||||
uint8_t MarlinUI::read_slow_buttons() {
|
||||
#if ENABLED(LCD_I2C_TYPE_MCP23017)
|
||||
// Reading these buttons this is likely to be too slow to call inside interrupt context
|
||||
// so they are called during normal lcd_update
|
||||
uint8_t slow_bits = lcd.readButtons()
|
||||
#if !BUTTON_EXISTS(ENC)
|
||||
<< B_I2C_BTN_OFFSET
|
||||
#endif
|
||||
;
|
||||
#if ENABLED(LCD_I2C_VIKI)
|
||||
if ((slow_bits & (B_MI | B_RI)) && PENDING(millis(), next_button_update_ms)) // LCD clicked
|
||||
slow_bits &= ~(B_MI | B_RI); // Disable LCD clicked buttons if screen is updated
|
||||
#endif // LCD_I2C_VIKI
|
||||
return slow_bits;
|
||||
#endif // LCD_I2C_TYPE_MCP23017
|
||||
}
|
||||
#endif
|
||||
|
||||
void MarlinUI::clear_lcd() { lcd.clear(); }
|
||||
|
||||
#if ENABLED(SHOW_BOOTSCREEN)
|
||||
|
||||
void lcd_erase_line(const int16_t line) {
|
||||
void lcd_erase_line(const lcd_uint_t line) {
|
||||
lcd_moveto(0, line);
|
||||
for (uint8_t i = LCD_WIDTH + 1; --i;)
|
||||
lcd_put_wchar(' ');
|
||||
}
|
||||
|
||||
// Scroll the PSTR 'text' in a 'len' wide field for 'time' milliseconds at position col,line
|
||||
void lcd_scroll(const uint8_t col, const uint8_t line, PGM_P const text, const uint8_t len, const int16_t time) {
|
||||
void lcd_scroll(const lcd_uint_t col, const lcd_uint_t line, PGM_P const text, const uint8_t len, const int16_t time) {
|
||||
uint8_t slen = utf8_strlen_P(text);
|
||||
if (slen < len) {
|
||||
// Fits into,
|
||||
lcd_moveto(col, line);
|
||||
lcd_put_u8str_max_P(text, len);
|
||||
lcd_put_u8str_max_P(col, line, text, len);
|
||||
for (; slen < len; ++slen) lcd_put_wchar(' ');
|
||||
safe_delay(time);
|
||||
}
|
||||
@@ -385,11 +410,8 @@ void MarlinUI::clear_lcd() { lcd.clear(); }
|
||||
int dly = time / _MAX(slen, 1);
|
||||
for (uint8_t i = 0; i <= slen; i++) {
|
||||
|
||||
// Go to the correct place
|
||||
lcd_moveto(col, line);
|
||||
|
||||
// Print the text
|
||||
lcd_put_u8str_max_P(p, len);
|
||||
// Print the text at the correct place
|
||||
lcd_put_u8str_max_P(col, line, p, len);
|
||||
|
||||
// Fill with spaces
|
||||
for (uint8_t ix = slen - i; ix < len; ++ix) lcd_put_wchar(' ');
|
||||
@@ -406,9 +428,9 @@ void MarlinUI::clear_lcd() { lcd.clear(); }
|
||||
|
||||
static void logo_lines(PGM_P const extra) {
|
||||
int16_t indent = (LCD_WIDTH - 8 - utf8_strlen_P(extra)) / 2;
|
||||
lcd_moveto(indent, 0); lcd_put_wchar('\x00'); lcd_put_u8str_P(PSTR( "------" )); lcd_put_wchar('\x01');
|
||||
lcd_moveto(indent, 1); lcd_put_u8str_P(PSTR("|Marlin|")); lcd_put_u8str_P(extra);
|
||||
lcd_moveto(indent, 2); lcd_put_wchar('\x02'); lcd_put_u8str_P(PSTR( "------" )); lcd_put_wchar('\x03');
|
||||
lcd_put_wchar(indent, 0, '\x00'); lcd_put_u8str_P(PSTR( "------" )); lcd_put_wchar('\x01');
|
||||
lcd_put_u8str_P(indent, 1, PSTR("|Marlin|")); lcd_put_u8str_P(extra);
|
||||
lcd_put_wchar(indent, 2, '\x02'); lcd_put_u8str_P(PSTR( "------" )); lcd_put_wchar('\x03');
|
||||
}
|
||||
|
||||
void MarlinUI::show_bootscreen() {
|
||||
@@ -420,8 +442,7 @@ void MarlinUI::clear_lcd() { lcd.clear(); }
|
||||
#define CENTER_OR_SCROLL(STRING,DELAY) \
|
||||
lcd_erase_line(3); \
|
||||
if (utf8_strlen(STRING) <= LCD_WIDTH) { \
|
||||
lcd_moveto((LCD_WIDTH - utf8_strlen_P(PSTR(STRING))) / 2, 3); \
|
||||
lcd_put_u8str_P(PSTR(STRING)); \
|
||||
lcd_put_u8str_P((LCD_WIDTH - utf8_strlen_P(PSTR(STRING))) / 2, 3, PSTR(STRING)); \
|
||||
safe_delay(DELAY); \
|
||||
} \
|
||||
else { \
|
||||
@@ -491,16 +512,12 @@ void MarlinUI::clear_lcd() { lcd.clear(); }
|
||||
#endif // SHOW_BOOTSCREEN
|
||||
|
||||
void MarlinUI::draw_kill_screen() {
|
||||
lcd_moveto(0, 0);
|
||||
lcd_put_u8str(status_message);
|
||||
#if LCD_HEIGHT < 4
|
||||
lcd_moveto(0, 2);
|
||||
#else
|
||||
lcd_moveto(0, 2);
|
||||
lcd_put_u8str_P(PSTR(MSG_HALTED));
|
||||
lcd_moveto(0, 3);
|
||||
lcd_put_u8str(0, 0, status_message);
|
||||
lcd_uint_t y = 2;
|
||||
#if LCD_HEIGHT >= 4
|
||||
lcd_put_u8str_P(0, y++, PSTR(MSG_HALTED));
|
||||
#endif
|
||||
lcd_put_u8str_P(PSTR(MSG_PLEASE_RESET));
|
||||
lcd_put_u8str_P(0, y, PSTR(MSG_PLEASE_RESET));
|
||||
}
|
||||
|
||||
//
|
||||
@@ -859,8 +876,7 @@ void MarlinUI::draw_status_screen() {
|
||||
|
||||
#if LCD_HEIGHT > 3
|
||||
|
||||
lcd_moveto(0, 2);
|
||||
lcd_put_wchar(LCD_STR_FEEDRATE[0]);
|
||||
lcd_put_wchar(0, 2, LCD_STR_FEEDRATE[0]);
|
||||
lcd_put_u8str(i16tostr3(feedrate_percentage));
|
||||
lcd_put_wchar('%');
|
||||
|
||||
@@ -868,8 +884,7 @@ void MarlinUI::draw_status_screen() {
|
||||
duration_t elapsed = print_job_timer.duration();
|
||||
const uint8_t len = elapsed.toDigital(buffer),
|
||||
timepos = LCD_WIDTH - len - 1;
|
||||
lcd_moveto(timepos, 2);
|
||||
lcd_put_wchar(LCD_STR_CLOCK[0]);
|
||||
lcd_put_wchar(timepos, 2, LCD_STR_CLOCK[0]);
|
||||
lcd_put_u8str(buffer);
|
||||
|
||||
#if LCD_WIDTH >= 20
|
||||
@@ -918,8 +933,7 @@ void MarlinUI::draw_status_screen() {
|
||||
_draw_axis_value(Z_AXIS, ftostr52sp(LOGICAL_Z_POSITION(current_position[Z_AXIS])), blink);
|
||||
|
||||
#if HAS_LEVELING && (HOTENDS > 1 || !HAS_HEATED_BED)
|
||||
lcd_moveto(LCD_WIDTH - 1, 0);
|
||||
lcd_put_wchar(planner.leveling_active || blink ? '_' : ' ');
|
||||
lcd_put_wchar(LCD_WIDTH - 1, 0, planner.leveling_active || blink ? '_' : ' ');
|
||||
#endif
|
||||
|
||||
// ========== Line 2 ==========
|
||||
@@ -934,8 +948,7 @@ void MarlinUI::draw_status_screen() {
|
||||
_draw_bed_status(blink);
|
||||
#endif
|
||||
|
||||
lcd_moveto(LCD_WIDTH - 9, 1);
|
||||
lcd_put_wchar(LCD_STR_FEEDRATE[0]);
|
||||
lcd_put_wchar(LCD_WIDTH - 9, 1, LCD_STR_FEEDRATE[0]);
|
||||
lcd_put_u8str(i16tostr3(feedrate_percentage));
|
||||
lcd_put_wchar('%');
|
||||
|
||||
@@ -1006,8 +1019,7 @@ void MarlinUI::draw_status_screen() {
|
||||
|
||||
void draw_menu_item(const bool sel, const uint8_t row, PGM_P pstr, const char pre_char, const char post_char) {
|
||||
uint8_t n = LCD_WIDTH - 2;
|
||||
lcd_moveto(0, row);
|
||||
lcd_put_wchar(sel ? pre_char : ' ');
|
||||
lcd_put_wchar(0, row, sel ? pre_char : ' ');
|
||||
n -= lcd_put_u8str_max_P(pstr, n);
|
||||
for (; n; --n) lcd_put_wchar(' ');
|
||||
lcd_put_wchar(post_char);
|
||||
@@ -1015,8 +1027,7 @@ void MarlinUI::draw_status_screen() {
|
||||
|
||||
void _draw_menu_item_edit(const bool sel, const uint8_t row, PGM_P pstr, const char* const data, const bool pgm) {
|
||||
uint8_t n = LCD_WIDTH - 2 - (pgm ? utf8_strlen_P(data) : utf8_strlen(data));
|
||||
lcd_moveto(0, row);
|
||||
lcd_put_wchar(sel ? LCD_STR_ARROW_RIGHT[0] : ' ');
|
||||
lcd_put_wchar(0, row, sel ? LCD_STR_ARROW_RIGHT[0] : ' ');
|
||||
n -= lcd_put_u8str_max_P(pstr, n);
|
||||
lcd_put_wchar(':');
|
||||
for (; n; --n) lcd_put_wchar(' ');
|
||||
@@ -1026,14 +1037,12 @@ void MarlinUI::draw_status_screen() {
|
||||
void draw_edit_screen(PGM_P const pstr, const char* const value/*=nullptr*/) {
|
||||
ui.encoder_direction_normal();
|
||||
|
||||
lcd_moveto(0, 1);
|
||||
lcd_put_u8str_P(pstr);
|
||||
lcd_put_u8str_P(0, 1, pstr);
|
||||
if (value != nullptr) {
|
||||
lcd_put_wchar(':');
|
||||
int len = utf8_strlen(value);
|
||||
const uint8_t valrow = (utf8_strlen_P(pstr) + 1 + len + 1) > (LCD_WIDTH - 2) ? 2 : 1; // Value on the next row if it won't fit
|
||||
lcd_moveto((LCD_WIDTH - 1) - (len + 1), valrow); // Right-justified, padded by spaces
|
||||
lcd_put_wchar(' '); // Overwrite char if value gets shorter
|
||||
const lcd_uint_t valrow = (utf8_strlen_P(pstr) + 1 + len + 1) > (LCD_WIDTH - 2) ? 2 : 1; // Value on the next row if it won't fit
|
||||
lcd_put_wchar((LCD_WIDTH - 1) - (len + 1), valrow, ' '); // Right-justified, padded, add a leading space
|
||||
lcd_put_u8str(value);
|
||||
}
|
||||
}
|
||||
@@ -1051,8 +1060,7 @@ void MarlinUI::draw_status_screen() {
|
||||
void draw_sd_menu_item(const bool sel, const uint8_t row, PGM_P const pstr, CardReader &theCard, const bool isDir) {
|
||||
UNUSED(pstr);
|
||||
|
||||
lcd_moveto(0, row);
|
||||
lcd_put_wchar(sel ? LCD_STR_ARROW_RIGHT[0] : ' ');
|
||||
lcd_put_wchar(0, row, sel ? LCD_STR_ARROW_RIGHT[0] : ' ');
|
||||
constexpr uint8_t maxlen = LCD_WIDTH - 2;
|
||||
uint8_t n = maxlen - lcd_put_u8str_max(ui.scrolled_filename(theCard, maxlen, row, sel), maxlen);
|
||||
for (; n; --n) lcd_put_wchar(' ');
|
||||
@@ -1063,7 +1071,7 @@ void MarlinUI::draw_status_screen() {
|
||||
|
||||
#if ENABLED(LCD_HAS_STATUS_INDICATORS)
|
||||
|
||||
static void MarlinUI::update_indicators() {
|
||||
void MarlinUI::update_indicators() {
|
||||
// Set the LEDS - referred to as backlights by the LiquidTWI2 library
|
||||
static uint8_t ledsprev = 0;
|
||||
uint8_t leds = 0;
|
||||
@@ -1144,9 +1152,9 @@ void MarlinUI::draw_status_screen() {
|
||||
} custom_char;
|
||||
|
||||
typedef struct {
|
||||
uint8_t column, row,
|
||||
x_pixel_offset, y_pixel_offset,
|
||||
x_pixel_mask;
|
||||
lcd_uint_t column, row,
|
||||
x_pixel_offset, y_pixel_offset;
|
||||
uint8_t x_pixel_mask;
|
||||
} coordinate;
|
||||
|
||||
void add_edges_to_custom_char(custom_char &custom, const coordinate &ul, const coordinate &lr, const coordinate &brc, const uint8_t cell_location);
|
||||
@@ -1174,22 +1182,21 @@ void MarlinUI::draw_status_screen() {
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
inline coordinate pixel_location(const uint8_t x, const uint8_t y) { return pixel_location((int16_t)x, (int16_t)y); }
|
||||
inline coordinate pixel_location(const lcd_uint_t x, const lcd_uint_t y) { return pixel_location((int16_t)x, (int16_t)y); }
|
||||
|
||||
void prep_and_put_map_char(custom_char &chrdata, const coordinate &ul, const coordinate &lr, const coordinate &brc, const uint8_t cl, const char c, const uint8_t x, const uint8_t y) {
|
||||
void prep_and_put_map_char(custom_char &chrdata, const coordinate &ul, const coordinate &lr, const coordinate &brc, const uint8_t cl, const char c, const lcd_uint_t x, const lcd_uint_t y) {
|
||||
add_edges_to_custom_char(chrdata, ul, lr, brc, cl);
|
||||
lcd.createChar(c, (uint8_t*)&chrdata);
|
||||
lcd_moveto(x, y);
|
||||
lcd_put_wchar(c);
|
||||
lcd_put_wchar(x, y, c);
|
||||
}
|
||||
|
||||
void MarlinUI::ubl_plot(const uint8_t x, const uint8_t inverted_y) {
|
||||
void MarlinUI::ubl_plot(const uint8_t x_plot, const uint8_t y_plot) {
|
||||
|
||||
#if LCD_WIDTH >= 20
|
||||
#define _LCD_W_POS 12
|
||||
#define _PLOT_X 1
|
||||
#define _MAP_X 3
|
||||
#define _LABEL(C,X,Y) lcd_moveto(X, Y); lcd_put_u8str(C)
|
||||
#define _LABEL(C,X,Y) lcd_put_u8str(X, Y, C)
|
||||
#define _XLABEL(X,Y) _LABEL("X:",X,Y)
|
||||
#define _YLABEL(X,Y) _LABEL("Y:",X,Y)
|
||||
#define _ZLABEL(X,Y) _LABEL("Z:",X,Y)
|
||||
@@ -1197,7 +1204,7 @@ void MarlinUI::draw_status_screen() {
|
||||
#define _LCD_W_POS 8
|
||||
#define _PLOT_X 0
|
||||
#define _MAP_X 1
|
||||
#define _LABEL(X,Y,C) lcd_moveto(X, Y); lcd_put_wchar(C)
|
||||
#define _LABEL(X,Y,C) lcd_put_wchar(X, Y, C)
|
||||
#define _XLABEL(X,Y) _LABEL('X',X,Y)
|
||||
#define _YLABEL(X,Y) _LABEL('Y',X,Y)
|
||||
#define _ZLABEL(X,Y) _LABEL('Z',X,Y)
|
||||
@@ -1209,10 +1216,10 @@ void MarlinUI::draw_status_screen() {
|
||||
* Show X and Y positions
|
||||
*/
|
||||
_XLABEL(_PLOT_X, 0);
|
||||
lcd_put_u8str(ftostr52(LOGICAL_X_POSITION(pgm_read_float(&ubl._mesh_index_to_xpos[x]))));
|
||||
lcd_put_u8str(ftostr52(LOGICAL_X_POSITION(pgm_read_float(&ubl._mesh_index_to_xpos[x_plot]))));
|
||||
|
||||
_YLABEL(_LCD_W_POS, 0);
|
||||
lcd_put_u8str(ftostr52(LOGICAL_Y_POSITION(pgm_read_float(&ubl._mesh_index_to_ypos[inverted_y]))));
|
||||
lcd_put_u8str(ftostr52(LOGICAL_Y_POSITION(pgm_read_float(&ubl._mesh_index_to_ypos[y_plot]))));
|
||||
|
||||
lcd_moveto(_PLOT_X, 0);
|
||||
|
||||
@@ -1220,13 +1227,13 @@ void MarlinUI::draw_status_screen() {
|
||||
|
||||
coordinate upper_left, lower_right, bottom_right_corner;
|
||||
custom_char new_char;
|
||||
uint8_t i, j, k, l, m, n, n_rows, n_cols, y,
|
||||
bottom_line, right_edge,
|
||||
x_map_pixels, y_map_pixels,
|
||||
pixels_per_x_mesh_pnt, pixels_per_y_mesh_pnt,
|
||||
suppress_x_offset = 0, suppress_y_offset = 0;
|
||||
uint8_t i, n, n_rows, n_cols;
|
||||
lcd_uint_t j, k, l, m, bottom_line, right_edge,
|
||||
x_map_pixels, y_map_pixels,
|
||||
pixels_per_x_mesh_pnt, pixels_per_y_mesh_pnt,
|
||||
suppress_x_offset = 0, suppress_y_offset = 0;
|
||||
|
||||
y = GRID_MAX_POINTS_Y - inverted_y - 1;
|
||||
const uint8_t y_plot_inv = (GRID_MAX_POINTS_Y - 1) - y_plot;
|
||||
|
||||
upper_left.column = 0;
|
||||
upper_left.row = 0;
|
||||
@@ -1261,17 +1268,13 @@ void MarlinUI::draw_status_screen() {
|
||||
n_cols = right_edge / (HD44780_CHAR_WIDTH) + 1;
|
||||
|
||||
for (i = 0; i < n_cols; i++) {
|
||||
lcd_moveto(i, 0);
|
||||
lcd_put_wchar(CHAR_LINE_TOP); // Box Top line
|
||||
lcd_moveto(i, n_rows - 1);
|
||||
lcd_put_wchar(CHAR_LINE_BOT); // Box Bottom line
|
||||
lcd_put_wchar(i, 0, CHAR_LINE_TOP); // Box Top line
|
||||
lcd_put_wchar(i, n_rows - 1, CHAR_LINE_BOT); // Box Bottom line
|
||||
}
|
||||
|
||||
for (j = 0; j < n_rows; j++) {
|
||||
lcd_moveto(0, j);
|
||||
lcd_put_wchar(CHAR_EDGE_L); // Box Left edge
|
||||
lcd_moveto(n_cols - 1, j);
|
||||
lcd_put_wchar(CHAR_EDGE_R); // Box Right edge
|
||||
lcd_put_wchar(0, j, CHAR_EDGE_L); // Box Left edge
|
||||
lcd_put_wchar(n_cols - 1, j, CHAR_EDGE_R); // Box Right edge
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1281,10 +1284,8 @@ void MarlinUI::draw_status_screen() {
|
||||
k = pixels_per_y_mesh_pnt * (GRID_MAX_POINTS_Y) + 2;
|
||||
l = (HD44780_CHAR_HEIGHT) * n_rows;
|
||||
if (l > k && l - k >= (HD44780_CHAR_HEIGHT) / 2) {
|
||||
lcd_moveto(0, n_rows - 1); // Box Left edge
|
||||
lcd_put_wchar(' ');
|
||||
lcd_moveto(n_cols - 1, n_rows - 1); // Box Right edge
|
||||
lcd_put_wchar(' ');
|
||||
lcd_put_wchar(0, n_rows - 1, ' '); // Box Left edge
|
||||
lcd_put_wchar(n_cols - 1, n_rows - 1, ' '); // Box Right edge
|
||||
}
|
||||
|
||||
clear_custom_char(&new_char);
|
||||
@@ -1310,12 +1311,12 @@ void MarlinUI::draw_status_screen() {
|
||||
new_char.custom_char_bits[j] = (uint8_t)_BV(i); // Char #3 is used for the box right edge
|
||||
lcd.createChar(CHAR_EDGE_R, (uint8_t*)&new_char);
|
||||
|
||||
i = x * pixels_per_x_mesh_pnt - suppress_x_offset;
|
||||
j = y * pixels_per_y_mesh_pnt - suppress_y_offset;
|
||||
i = x_plot * pixels_per_x_mesh_pnt - suppress_x_offset;
|
||||
j = y_plot_inv * pixels_per_y_mesh_pnt - suppress_y_offset;
|
||||
upper_left = pixel_location(i, j);
|
||||
|
||||
k = (x + 1) * pixels_per_x_mesh_pnt - 1 - suppress_x_offset;
|
||||
l = (y + 1) * pixels_per_y_mesh_pnt - 1 - suppress_y_offset;
|
||||
k = (x_plot + 1) * pixels_per_x_mesh_pnt - 1 - suppress_x_offset;
|
||||
l = (y_plot_inv + 1) * pixels_per_y_mesh_pnt - 1 - suppress_y_offset;
|
||||
lower_right = pixel_location(k, l);
|
||||
|
||||
bottom_right_corner = pixel_location(x_map_pixels, y_map_pixels);
|
||||
@@ -1327,7 +1328,7 @@ void MarlinUI::draw_status_screen() {
|
||||
*/
|
||||
|
||||
clear_custom_char(&new_char);
|
||||
const uint8_t ypix = _MIN(upper_left.y_pixel_offset + pixels_per_y_mesh_pnt, HD44780_CHAR_HEIGHT);
|
||||
const lcd_uint_t ypix = _MIN(upper_left.y_pixel_offset + pixels_per_y_mesh_pnt, HD44780_CHAR_HEIGHT);
|
||||
for (j = upper_left.y_pixel_offset; j < ypix; j++) {
|
||||
i = upper_left.x_pixel_mask;
|
||||
for (k = 0; k < pixels_per_x_mesh_pnt; k++) {
|
||||
@@ -1398,11 +1399,10 @@ void MarlinUI::draw_status_screen() {
|
||||
/**
|
||||
* Print plot position
|
||||
*/
|
||||
lcd_moveto(_LCD_W_POS, 0);
|
||||
lcd_put_wchar('(');
|
||||
lcd_put_u8str(ui8tostr3(x));
|
||||
lcd_put_wchar(_LCD_W_POS, 0, '(');
|
||||
lcd_put_u8str(ui8tostr3(x_plot));
|
||||
lcd_put_wchar(',');
|
||||
lcd_put_u8str(ui8tostr3(inverted_y));
|
||||
lcd_put_u8str(ui8tostr3(y_plot));
|
||||
lcd_put_wchar(')');
|
||||
|
||||
#if LCD_HEIGHT <= 3 // 16x2 or 20x2 display
|
||||
@@ -1411,8 +1411,8 @@ void MarlinUI::draw_status_screen() {
|
||||
* Print Z values
|
||||
*/
|
||||
_ZLABEL(_LCD_W_POS, 1);
|
||||
if (!isnan(ubl.z_values[x][inverted_y]))
|
||||
lcd_put_u8str(ftostr43sign(ubl.z_values[x][inverted_y]));
|
||||
if (!isnan(ubl.z_values[x_plot][y_plot]))
|
||||
lcd_put_u8str(ftostr43sign(ubl.z_values[x_plot][y_plot]));
|
||||
else
|
||||
lcd_put_u8str_P(PSTR(" -----"));
|
||||
|
||||
@@ -1422,16 +1422,16 @@ void MarlinUI::draw_status_screen() {
|
||||
* Show all values at right of screen
|
||||
*/
|
||||
_XLABEL(_LCD_W_POS, 1);
|
||||
lcd_put_u8str(ftostr52(LOGICAL_X_POSITION(pgm_read_float(&ubl._mesh_index_to_xpos[x]))));
|
||||
lcd_put_u8str(ftostr52(LOGICAL_X_POSITION(pgm_read_float(&ubl._mesh_index_to_xpos[x_plot]))));
|
||||
_YLABEL(_LCD_W_POS, 2);
|
||||
lcd_put_u8str(ftostr52(LOGICAL_Y_POSITION(pgm_read_float(&ubl._mesh_index_to_ypos[inverted_y]))));
|
||||
lcd_put_u8str(ftostr52(LOGICAL_Y_POSITION(pgm_read_float(&ubl._mesh_index_to_ypos[y_plot]))));
|
||||
|
||||
/**
|
||||
* Show the location value
|
||||
*/
|
||||
_ZLABEL(_LCD_W_POS, 3);
|
||||
if (!isnan(ubl.z_values[x][inverted_y]))
|
||||
lcd_put_u8str(ftostr43sign(ubl.z_values[x][inverted_y]));
|
||||
if (!isnan(ubl.z_values[x_plot][y_plot]))
|
||||
lcd_put_u8str(ftostr43sign(ubl.z_values[x_plot][y_plot]));
|
||||
else
|
||||
lcd_put_u8str_P(PSTR(" -----"));
|
||||
|
||||
|
||||
@@ -40,10 +40,14 @@
|
||||
#define U8G_COM_ST7920_HAL_SW_SPI u8g_com_std_sw_spi_fn
|
||||
#define U8G_COM_ST7920_HAL_HW_SPI u8g_com_stm32duino_hw_spi_fn
|
||||
#elif defined(ARDUINO_ARCH_STM32)
|
||||
uint8_t u8g_com_arduino_std_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
|
||||
#define U8G_COM_HAL_SW_SPI_FN u8g_com_arduino_std_sw_spi_fn
|
||||
uint8_t u8g_com_stm32duino_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
|
||||
#define U8G_COM_HAL_HW_SPI_FN u8g_com_stm32duino_hw_spi_fn
|
||||
uint8_t u8g_com_arduino_st7920_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
|
||||
#define U8G_COM_ST7920_HAL_SW_SPI u8g_com_arduino_st7920_spi_fn
|
||||
#define U8G_COM_ST7920_HAL_HW_SPI u8g_com_stm32duino_hw_spi_fn
|
||||
uint8_t u8g_com_arduino_st7920_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
|
||||
#define U8G_COM_ST7920_HAL_HW_SPI u8g_com_arduino_st7920_hw_spi_fn
|
||||
#elif defined(__AVR__)
|
||||
uint8_t u8g_com_HAL_AVR_sw_sp_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
|
||||
#define U8G_COM_HAL_SW_SPI_FN u8g_com_HAL_AVR_sw_sp_fn
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#include "../../../_Bootscreen.h"
|
||||
|
||||
#ifndef CUSTOM_BOOTSCREEN_BMP_BYTEWIDTH
|
||||
#define CUSTOM_BOOTSCREEN_BMP_BYTEWIDTH ((CUSTOM_BOOTSCREEN_BMPWIDTH + 7) / 8)
|
||||
#define CUSTOM_BOOTSCREEN_BMP_BYTEWIDTH CEILING(CUSTOM_BOOTSCREEN_BMPWIDTH, 8)
|
||||
#endif
|
||||
#ifndef CUSTOM_BOOTSCREEN_BMPHEIGHT
|
||||
#define CUSTOM_BOOTSCREEN_BMPHEIGHT (sizeof(custom_start_bmp) / (CUSTOM_BOOTSCREEN_BMP_BYTEWIDTH))
|
||||
@@ -69,6 +69,142 @@
|
||||
B00011111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111000
|
||||
};
|
||||
|
||||
#if ENABLED(BOOT_MARLIN_LOGO_ANIMATED)
|
||||
|
||||
const unsigned char start_bmp1[] PROGMEM = {
|
||||
B00011111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,
|
||||
B01100000,B00000000,B00000000,B00000000,B00000000,B00000001,B11111111,
|
||||
B01000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111,
|
||||
B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01111111,
|
||||
B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,
|
||||
B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00011111,
|
||||
B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00001111,
|
||||
B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,
|
||||
B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
|
||||
B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000001,
|
||||
B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000001,
|
||||
B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000001,
|
||||
B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000001,
|
||||
B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000001,
|
||||
B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000001,
|
||||
B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000001,
|
||||
B01000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000010,
|
||||
B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000110,
|
||||
B00011111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111000
|
||||
};
|
||||
|
||||
const unsigned char start_bmp2[] PROGMEM = {
|
||||
B00011111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,
|
||||
B01100000,B00000000,B00000000,B00000000,B00000000,B00000001,B11111111,
|
||||
B01000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111,
|
||||
B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01111111,
|
||||
B10000011,B11001111,B00000000,B00000000,B00000000,B00000000,B00111111,
|
||||
B10000111,B11111111,B10000000,B00000000,B00000000,B00000000,B00011111,
|
||||
B10000110,B01111001,B10000000,B00000000,B00000000,B00000000,B00001111,
|
||||
B10001100,B00110000,B11000000,B00000000,B00000000,B00000000,B00000111,
|
||||
B10001100,B00110000,B11000000,B00000000,B00000000,B00000000,B00000011,
|
||||
B10001100,B00110000,B11000000,B00000000,B00000000,B00000000,B00000001,
|
||||
B10001100,B00110000,B11000000,B00000000,B00000000,B00000000,B00000001,
|
||||
B10001100,B00110000,B11000000,B00000000,B00000000,B00000000,B00000001,
|
||||
B10001100,B00110000,B11000000,B00000000,B00000000,B00000000,B00000001,
|
||||
B10001100,B00110000,B11000000,B00000000,B00000000,B00000000,B00000001,
|
||||
B10001100,B00110000,B11000000,B00000000,B00000000,B00000000,B00000001,
|
||||
B10001100,B00110000,B11000000,B00000000,B00000000,B00000000,B00000001,
|
||||
B01000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000010,
|
||||
B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000110,
|
||||
B00011111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111000
|
||||
};
|
||||
|
||||
const unsigned char start_bmp3[] PROGMEM = {
|
||||
B00011111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,
|
||||
B01100000,B00000000,B00000000,B00000000,B00000000,B00000001,B11111111,
|
||||
B01000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111,
|
||||
B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01111111,
|
||||
B10000011,B11001111,B00000000,B00000000,B00000000,B00000000,B00111111,
|
||||
B10000111,B11111111,B10000000,B00000000,B00000000,B00000000,B00011111,
|
||||
B10000110,B01111001,B10000000,B00000000,B00000000,B00000000,B00001111,
|
||||
B10001100,B00110000,B11000111,B10000000,B00000000,B00000000,B00000111,
|
||||
B10001100,B00110000,B11001111,B11000000,B00000000,B00000000,B00000011,
|
||||
B10001100,B00110000,B11011100,B11100000,B00000000,B00000000,B00000001,
|
||||
B10001100,B00110000,B11011000,B01100000,B00000000,B00000000,B00000001,
|
||||
B10001100,B00110000,B11010000,B01100000,B00000000,B00000000,B00000001,
|
||||
B10001100,B00110000,B11011000,B01100000,B00000000,B00000000,B00000001,
|
||||
B10001100,B00110000,B11011100,B01100000,B00000000,B00000000,B00000001,
|
||||
B10001100,B00110000,B11001111,B01110000,B00000000,B00000000,B00000001,
|
||||
B10001100,B00110000,B11000111,B01110000,B00000000,B00000000,B00000001,
|
||||
B01000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000010,
|
||||
B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000110,
|
||||
B00011111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111000
|
||||
};
|
||||
|
||||
const unsigned char start_bmp4[] PROGMEM = {
|
||||
B00011111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,
|
||||
B01100000,B00000000,B00000000,B00000000,B00000000,B00000001,B11111111,
|
||||
B01000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111,
|
||||
B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01111111,
|
||||
B10000011,B11001111,B00000000,B00000000,B00000000,B00000000,B00111111,
|
||||
B10000111,B11111111,B10000000,B00000000,B00000000,B00000000,B00011111,
|
||||
B10000110,B01111001,B10000000,B00000000,B00000000,B00000000,B00001111,
|
||||
B10001100,B00110000,B11000111,B10000011,B10000000,B00000000,B00000111,
|
||||
B10001100,B00110000,B11001111,B11000111,B11000000,B00000000,B00000011,
|
||||
B10001100,B00110000,B11011100,B11101100,B11100000,B00000000,B00000001,
|
||||
B10001100,B00110000,B11011000,B01101100,B01100000,B00000000,B00000001,
|
||||
B10001100,B00110000,B11010000,B01101100,B00000000,B00000000,B00000001,
|
||||
B10001100,B00110000,B11011000,B01101100,B00000000,B00000000,B00000001,
|
||||
B10001100,B00110000,B11011100,B01101100,B00000000,B00000000,B00000001,
|
||||
B10001100,B00110000,B11001111,B01111100,B00000000,B00000000,B00000001,
|
||||
B10001100,B00110000,B11000111,B01111100,B00000000,B00000000,B00000001,
|
||||
B01000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000010,
|
||||
B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000110,
|
||||
B00011111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111000
|
||||
};
|
||||
|
||||
const unsigned char start_bmp5[] PROGMEM = {
|
||||
B00011111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,
|
||||
B01100000,B00000000,B00000000,B00000000,B00000000,B00000001,B11111111,
|
||||
B01000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111,
|
||||
B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01111111,
|
||||
B10000011,B11001111,B00000000,B00000000,B00001100,B00000000,B00111111,
|
||||
B10000111,B11111111,B10000000,B00000000,B00001100,B00000000,B00011111,
|
||||
B10000110,B01111001,B10000000,B00000000,B00001100,B00000000,B00001111,
|
||||
B10001100,B00110000,B11000111,B10000011,B10001100,B00000000,B00000111,
|
||||
B10001100,B00110000,B11001111,B11000111,B11001100,B00000000,B00000011,
|
||||
B10001100,B00110000,B11011100,B11101100,B11101100,B00000000,B00000001,
|
||||
B10001100,B00110000,B11011000,B01101100,B01101100,B00000000,B00000001,
|
||||
B10001100,B00110000,B11010000,B01101100,B00001100,B00000000,B00000001,
|
||||
B10001100,B00110000,B11011000,B01101100,B00001100,B00000000,B00000001,
|
||||
B10001100,B00110000,B11011100,B01101100,B00001110,B00000000,B00000001,
|
||||
B10001100,B00110000,B11001111,B01111100,B00000111,B10000000,B00000001,
|
||||
B10001100,B00110000,B11000111,B01111100,B00000011,B10000000,B00000001,
|
||||
B01000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000010,
|
||||
B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000110,
|
||||
B00011111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111000
|
||||
};
|
||||
|
||||
const unsigned char start_bmp6[] PROGMEM = {
|
||||
B00011111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,
|
||||
B01100000,B00000000,B00000000,B00000000,B00000000,B00000001,B11111111,
|
||||
B01000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111,
|
||||
B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01111111,
|
||||
B10000011,B11001111,B00000000,B00000000,B00001100,B00110000,B00111111,
|
||||
B10000111,B11111111,B10000000,B00000000,B00001100,B00110000,B00011111,
|
||||
B10000110,B01111001,B10000000,B00000000,B00001100,B00000000,B00001111,
|
||||
B10001100,B00110000,B11000111,B10000011,B10001100,B00110000,B00000111,
|
||||
B10001100,B00110000,B11001111,B11000111,B11001100,B00110000,B00000011,
|
||||
B10001100,B00110000,B11011100,B11101100,B11101100,B00110000,B00000001,
|
||||
B10001100,B00110000,B11011000,B01101100,B01101100,B00110000,B00000001,
|
||||
B10001100,B00110000,B11010000,B01101100,B00001100,B00110000,B00000001,
|
||||
B10001100,B00110000,B11011000,B01101100,B00001100,B00110000,B00000001,
|
||||
B10001100,B00110000,B11011100,B01101100,B00001110,B00111000,B00000001,
|
||||
B10001100,B00110000,B11001111,B01111100,B00000111,B10011100,B00000001,
|
||||
B10001100,B00110000,B11000111,B01111100,B00000011,B10001100,B00000001,
|
||||
B01000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000010,
|
||||
B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000110,
|
||||
B00011111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111000
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#define START_BMPWIDTH 112
|
||||
@@ -114,10 +250,269 @@
|
||||
B00000001,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B10000000
|
||||
};
|
||||
|
||||
#if ENABLED(BOOT_MARLIN_LOGO_ANIMATED)
|
||||
|
||||
const unsigned char start_bmp1[] PROGMEM = {
|
||||
B00000001,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,
|
||||
B00001111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,
|
||||
B00011110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B11111111,B11111111,
|
||||
B00111000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,B11111111,B11111111,
|
||||
B01110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000001,B11111111,B11111111,
|
||||
B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111,B11111111,
|
||||
B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01111111,B11111111,
|
||||
B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,
|
||||
B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00011111,B11111111,
|
||||
B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00001111,B11111111,
|
||||
B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B11111111,
|
||||
B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,B11111111,
|
||||
B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000001,B11111111,
|
||||
B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111,
|
||||
B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01111111,
|
||||
B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,
|
||||
B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00011111,
|
||||
B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00001111,
|
||||
B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,
|
||||
B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,
|
||||
B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
|
||||
B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
|
||||
B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
|
||||
B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
|
||||
B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
|
||||
B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
|
||||
B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
|
||||
B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
|
||||
B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
|
||||
B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
|
||||
B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
|
||||
B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,
|
||||
B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000110,
|
||||
B01110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00001110,
|
||||
B00111000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00011100,
|
||||
B00011110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01111000,
|
||||
B00001111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11110000,
|
||||
B00000001,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B10000000
|
||||
};
|
||||
|
||||
const unsigned char start_bmp2[] PROGMEM = {
|
||||
B00000001,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,
|
||||
B00001111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,
|
||||
B00011110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B11111111,B11111111,
|
||||
B00111000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,B11111111,B11111111,
|
||||
B01110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000001,B11111111,B11111111,
|
||||
B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111,B11111111,
|
||||
B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01111111,B11111111,
|
||||
B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,
|
||||
B11000000,B00001111,B11000000,B11111100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00011111,B11111111,
|
||||
B11000000,B00111111,B11100001,B11111111,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00001111,B11111111,
|
||||
B11000000,B01111111,B11110011,B11111111,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B11111111,
|
||||
B11000000,B11111111,B11111111,B11111111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,B11111111,
|
||||
B11000001,B11111000,B01111111,B10000111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000001,B11111111,
|
||||
B11000001,B11110000,B00111111,B00000011,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01111111,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00011111,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00001111,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
|
||||
B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,
|
||||
B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000110,
|
||||
B01110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00001110,
|
||||
B00111000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00011100,
|
||||
B00011110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01111000,
|
||||
B00001111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11110000,
|
||||
B00000001,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B10000000
|
||||
};
|
||||
|
||||
const unsigned char start_bmp3[] PROGMEM = {
|
||||
B00000001,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,
|
||||
B00001111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,
|
||||
B00011110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B11111111,B11111111,
|
||||
B00111000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,B11111111,B11111111,
|
||||
B01110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000001,B11111111,B11111111,
|
||||
B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111,B11111111,
|
||||
B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01111111,B11111111,
|
||||
B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,
|
||||
B11000000,B00001111,B11000000,B11111100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00011111,B11111111,
|
||||
B11000000,B00111111,B11100001,B11111111,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00001111,B11111111,
|
||||
B11000000,B01111111,B11110011,B11111111,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B11111111,
|
||||
B11000000,B11111111,B11111111,B11111111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,B11111111,
|
||||
B11000001,B11111000,B01111111,B10000111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000001,B11111111,
|
||||
B11000001,B11110000,B00111111,B00000011,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100000,B00011111,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01111111,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100000,B01111111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100001,B11111111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00011111,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100011,B11111111,B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00001111,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100011,B11110011,B11111000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100111,B11100000,B11111100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100111,B11000000,B01111100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100111,B10000000,B01111100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100111,B10000000,B00111100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100111,B10000000,B00111100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100111,B10000000,B00111100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100111,B11000000,B00111100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100011,B11100000,B00111100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100011,B11111111,B00111111,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100001,B11111111,B00111111,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100000,B11111111,B00111111,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100000,B01111111,B00111111,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
|
||||
B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,
|
||||
B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000110,
|
||||
B01110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00001110,
|
||||
B00111000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00011100,
|
||||
B00011110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01111000,
|
||||
B00001111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11110000,
|
||||
B00000001,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B10000000
|
||||
};
|
||||
|
||||
const unsigned char start_bmp4[] PROGMEM = {
|
||||
B00000001,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,
|
||||
B00001111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,
|
||||
B00011110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B11111111,B11111111,
|
||||
B00111000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,B11111111,B11111111,
|
||||
B01110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000001,B11111111,B11111111,
|
||||
B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111,B11111111,
|
||||
B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01111111,B11111111,
|
||||
B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,
|
||||
B11000000,B00001111,B11000000,B11111100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00011111,B11111111,
|
||||
B11000000,B00111111,B11100001,B11111111,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00001111,B11111111,
|
||||
B11000000,B01111111,B11110011,B11111111,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B11111111,
|
||||
B11000000,B11111111,B11111111,B11111111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,B11111111,
|
||||
B11000001,B11111000,B01111111,B10000111,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000001,B11111111,
|
||||
B11000001,B11110000,B00111111,B00000011,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100000,B00011111,B00000000,B00000011,B11100000,B00000000,B00000000,B00000000,B00000000,B01111111,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100000,B01111111,B11000000,B00001111,B11111000,B00000000,B00000000,B00000000,B00000000,B00111111,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100001,B11111111,B11100000,B00011111,B11111100,B00000000,B00000000,B00000000,B00000000,B00011111,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100011,B11111111,B11110000,B00111111,B11111110,B00000000,B00000000,B00000000,B00000000,B00001111,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100011,B11110011,B11111000,B00111111,B00111110,B00000000,B00000000,B00000000,B00000000,B00000111,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100111,B11100000,B11111100,B01111100,B00011111,B00000000,B00000000,B00000000,B00000000,B00000111,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100111,B11000000,B01111100,B01111100,B00001111,B00000000,B00000000,B00000000,B00000000,B00000011,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100111,B10000000,B01111100,B01111000,B00001111,B00000000,B00000000,B00000000,B00000000,B00000011,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100111,B10000000,B00111100,B01111000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100111,B10000000,B00111100,B01111000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100111,B10000000,B00111100,B01111000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100111,B11000000,B00111100,B01111000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100011,B11100000,B00111100,B01111000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100011,B11111111,B00111111,B11111000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100001,B11111111,B00111111,B11111000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100000,B11111111,B00111111,B11111000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100000,B01111111,B00111111,B11111000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,
|
||||
B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,
|
||||
B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000110,
|
||||
B01110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00001110,
|
||||
B00111000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00011100,
|
||||
B00011110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01111000,
|
||||
B00001111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11110000,
|
||||
B00000001,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B10000000
|
||||
};
|
||||
|
||||
const unsigned char start_bmp5[] PROGMEM = {
|
||||
B00000001,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,
|
||||
B00001111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,
|
||||
B00011110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B11111111,B11111111,
|
||||
B00111000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,B11111111,B11111111,
|
||||
B01110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000001,B11111111,B11111111,
|
||||
B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111,B11111111,
|
||||
B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01111111,B11111111,
|
||||
B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01111000,B00000000,B00000000,B00111111,B11111111,
|
||||
B11000000,B00001111,B11000000,B11111100,B00000000,B00000000,B00000000,B00000000,B00000000,B01111000,B00000000,B00000000,B00011111,B11111111,
|
||||
B11000000,B00111111,B11100001,B11111111,B00000000,B00000000,B00000000,B00000000,B00000000,B01111000,B00000000,B00000000,B00001111,B11111111,
|
||||
B11000000,B01111111,B11110011,B11111111,B10000000,B00000000,B00000000,B00000000,B00000000,B01111000,B00000000,B00000000,B00000111,B11111111,
|
||||
B11000000,B11111111,B11111111,B11111111,B11000000,B00000000,B00000000,B00000000,B00000000,B01111000,B00000000,B00000000,B00000011,B11111111,
|
||||
B11000001,B11111000,B01111111,B10000111,B11100000,B00000000,B00000000,B00000000,B00000000,B01111000,B00000000,B00000000,B00000001,B11111111,
|
||||
B11000001,B11110000,B00111111,B00000011,B11100000,B00000000,B00000000,B00000000,B00000000,B01111000,B00000000,B00000000,B00000000,B11111111,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100000,B00011111,B00000000,B00000011,B11100000,B01111000,B00000000,B00000000,B00000000,B01111111,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100000,B01111111,B11000000,B00001111,B11111000,B01111000,B00000000,B00000000,B00000000,B00111111,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100001,B11111111,B11100000,B00011111,B11111100,B01111000,B00000000,B00000000,B00000000,B00011111,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100011,B11111111,B11110000,B00111111,B11111110,B01111000,B00000000,B00000000,B00000000,B00001111,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100011,B11110011,B11111000,B00111111,B00111110,B01111000,B00000000,B00000000,B00000000,B00000111,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100111,B11100000,B11111100,B01111100,B00011111,B01111000,B00000000,B00000000,B00000000,B00000111,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100111,B11000000,B01111100,B01111100,B00001111,B01111000,B00000000,B00000000,B00000000,B00000011,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100111,B10000000,B01111100,B01111000,B00001111,B01111000,B00000000,B00000000,B00000000,B00000011,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100111,B10000000,B00111100,B01111000,B00000000,B01111000,B00000000,B00000000,B00000000,B00000011,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100111,B10000000,B00111100,B01111000,B00000000,B01111000,B00000000,B00000000,B00000000,B00000011,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100111,B10000000,B00111100,B01111000,B00000000,B01111000,B00000000,B00000000,B00000000,B00000011,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100111,B11000000,B00111100,B01111000,B00000000,B01111000,B00000000,B00000000,B00000000,B00000011,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100011,B11100000,B00111100,B01111000,B00000000,B01111100,B00000000,B00000000,B00000000,B00000011,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100011,B11111111,B00111111,B11111000,B00000000,B01111111,B00000000,B00000000,B00000000,B00000011,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100001,B11111111,B00111111,B11111000,B00000000,B00111111,B00000000,B00000000,B00000000,B00000011,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100000,B11111111,B00111111,B11111000,B00000000,B00011111,B00000000,B00000000,B00000000,B00000011,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100000,B01111111,B00111111,B11111000,B00000000,B00001111,B00000000,B00000000,B00000000,B00000011,
|
||||
B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,
|
||||
B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000110,
|
||||
B01110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00001110,
|
||||
B00111000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00011100,
|
||||
B00011110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01111000,
|
||||
B00001111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11110000,
|
||||
B00000001,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B10000000
|
||||
};
|
||||
|
||||
const unsigned char start_bmp6[] PROGMEM = {
|
||||
B00000001,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,
|
||||
B00001111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,
|
||||
B00011110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B11111111,B11111111,
|
||||
B00111000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000011,B11111111,B11111111,
|
||||
B01110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000001,B11111111,B11111111,
|
||||
B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111,B11111111,
|
||||
B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01111111,B11111111,
|
||||
B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01111000,B00000000,B00000000,B00111111,B11111111,
|
||||
B11000000,B00001111,B11000000,B11111100,B00000000,B00000000,B00000000,B00000000,B00000000,B01111000,B00011000,B00000000,B00011111,B11111111,
|
||||
B11000000,B00111111,B11100001,B11111111,B00000000,B00000000,B00000000,B00000000,B00000000,B01111000,B00111100,B00000000,B00001111,B11111111,
|
||||
B11000000,B01111111,B11110011,B11111111,B10000000,B00000000,B00000000,B00000000,B00000000,B01111000,B00111100,B00000000,B00000111,B11111111,
|
||||
B11000000,B11111111,B11111111,B11111111,B11000000,B00000000,B00000000,B00000000,B00000000,B01111000,B00111100,B00000000,B00000011,B11111111,
|
||||
B11000001,B11111000,B01111111,B10000111,B11100000,B00000000,B00000000,B00000000,B00000000,B01111000,B00000000,B00000000,B00000001,B11111111,
|
||||
B11000001,B11110000,B00111111,B00000011,B11100000,B00000000,B00000000,B00000000,B00000000,B01111000,B00000000,B00000000,B00000000,B11111111,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100000,B00011111,B00000000,B00000011,B11100000,B01111000,B00111100,B00000000,B00000000,B01111111,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100000,B01111111,B11000000,B00001111,B11111000,B01111000,B00111100,B00000000,B00000000,B00111111,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100001,B11111111,B11100000,B00011111,B11111100,B01111000,B00111100,B00000000,B00000000,B00011111,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100011,B11111111,B11110000,B00111111,B11111110,B01111000,B00111100,B00000000,B00000000,B00001111,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100011,B11110011,B11111000,B00111111,B00111110,B01111000,B00111100,B00000000,B00000000,B00000111,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100111,B11100000,B11111100,B01111100,B00011111,B01111000,B00111100,B00000000,B00000000,B00000111,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100111,B11000000,B01111100,B01111100,B00001111,B01111000,B00111100,B00000000,B00000000,B00000011,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100111,B10000000,B01111100,B01111000,B00001111,B01111000,B00111100,B00000000,B00000000,B00000011,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100111,B10000000,B00111100,B01111000,B00000000,B01111000,B00111100,B00000000,B00000000,B00000011,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100111,B10000000,B00111100,B01111000,B00000000,B01111000,B00111100,B00000000,B00000000,B00000011,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100111,B10000000,B00111100,B01111000,B00000000,B01111000,B00111100,B00000000,B00000000,B00000011,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100111,B11000000,B00111100,B01111000,B00000000,B01111000,B00111100,B00000000,B00000000,B00000011,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100011,B11100000,B00111100,B01111000,B00000000,B01111100,B00111100,B00000000,B00000000,B00000011,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100011,B11111111,B00111111,B11111000,B00000000,B01111111,B10111100,B00000000,B00000000,B00000011,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100001,B11111111,B00111111,B11111000,B00000000,B00111111,B10111111,B00000000,B00000000,B00000011,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100000,B11111111,B00111111,B11111000,B00000000,B00011111,B10111111,B00000000,B00000000,B00000011,
|
||||
B11000001,B11100000,B00011110,B00000001,B11100000,B01111111,B00111111,B11111000,B00000000,B00001111,B10111111,B00000000,B00000000,B00000011,
|
||||
B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,
|
||||
B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000110,
|
||||
B01110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00001110,
|
||||
B00111000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00011100,
|
||||
B00011110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01111000,
|
||||
B00001111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11110000,
|
||||
B00000001,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B10000000
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#if ENABLED(BOOT_MARLIN_LOGO_ANIMATED)
|
||||
#ifndef MARLIN_BOOTSCREEN_FRAME_TIME
|
||||
#define MARLIN_BOOTSCREEN_FRAME_TIME 100 // (ms)
|
||||
#endif
|
||||
const unsigned char * const marlin_bootscreen_animation[] PROGMEM = {
|
||||
start_bmp1, start_bmp2, start_bmp3, start_bmp4, start_bmp5, start_bmp6, start_bmp
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifndef START_BMP_BYTEWIDTH
|
||||
#define START_BMP_BYTEWIDTH ((START_BMPWIDTH + 7) / 8)
|
||||
#define START_BMP_BYTEWIDTH CEILING(START_BMPWIDTH, 8)
|
||||
#endif
|
||||
#ifndef START_BMPHEIGHT
|
||||
#define START_BMPHEIGHT (sizeof(start_bmp) / (START_BMP_BYTEWIDTH))
|
||||
|
||||
@@ -1220,10 +1220,10 @@
|
||||
#define STATUS_HOTEND4_WIDTH STATUS_HOTEND3_WIDTH
|
||||
#endif
|
||||
#ifndef STATUS_HOTEND5_WIDTH
|
||||
#define STATUS_HOTEND5_WIDTH STATUS_HOTEND5_WIDTH
|
||||
#define STATUS_HOTEND5_WIDTH STATUS_HOTEND4_WIDTH
|
||||
#endif
|
||||
#ifndef STATUS_HOTEND6_WIDTH
|
||||
#define STATUS_HOTEND6_WIDTH STATUS_HOTEND6_WIDTH
|
||||
#define STATUS_HOTEND6_WIDTH STATUS_HOTEND5_WIDTH
|
||||
#endif
|
||||
|
||||
constexpr uint8_t status_hotend_width[HOTENDS] = ARRAY_N(HOTENDS, STATUS_HOTEND1_WIDTH, STATUS_HOTEND2_WIDTH, STATUS_HOTEND3_WIDTH, STATUS_HOTEND4_WIDTH, STATUS_HOTEND5_WIDTH, STATUS_HOTEND6_WIDTH);
|
||||
@@ -1264,10 +1264,10 @@
|
||||
#define STATUS_HOTEND4_X STATUS_HOTEND3_X + STATUS_HEATERS_XSPACE
|
||||
#endif
|
||||
#ifndef STATUS_HOTEND5_X
|
||||
#define STATUS_HOTEND5_X STATUS_HOTEND5_X + STATUS_HEATERS_XSPACE
|
||||
#define STATUS_HOTEND5_X STATUS_HOTEND4_X + STATUS_HEATERS_XSPACE
|
||||
#endif
|
||||
#ifndef STATUS_HOTEND6_X
|
||||
#define STATUS_HOTEND6_X STATUS_HOTEND6_X + STATUS_HEATERS_XSPACE
|
||||
#define STATUS_HOTEND6_X STATUS_HOTEND5_X + STATUS_HEATERS_XSPACE
|
||||
#endif
|
||||
|
||||
#if HOTENDS > 2
|
||||
@@ -1291,10 +1291,10 @@
|
||||
#define STATUS_HOTEND4_TEXT_X STATUS_HOTEND3_TEXT_X + STATUS_HEATERS_XSPACE
|
||||
#endif
|
||||
#ifndef STATUS_HOTEND5_TEXT_X
|
||||
#define STATUS_HOTEND5_TEXT_X STATUS_HOTEND5_TEXT_X + STATUS_HEATERS_XSPACE
|
||||
#define STATUS_HOTEND5_TEXT_X STATUS_HOTEND4_TEXT_X + STATUS_HEATERS_XSPACE
|
||||
#endif
|
||||
#ifndef STATUS_HOTEND6_TEXT_X
|
||||
#define STATUS_HOTEND6_TEXT_X STATUS_HOTEND6_TEXT_X + STATUS_HEATERS_XSPACE
|
||||
#define STATUS_HOTEND6_TEXT_X STATUS_HOTEND5_TEXT_X + STATUS_HEATERS_XSPACE
|
||||
#endif
|
||||
constexpr uint8_t status_hotend_text_x[] = ARRAY_N(HOTENDS, STATUS_HOTEND1_TEXT_X, STATUS_HOTEND2_TEXT_X, STATUS_HOTEND3_TEXT_X, STATUS_HOTEND4_TEXT_X, STATUS_HOTEND5_TEXT_X, STATUS_HOTEND6_TEXT_X);
|
||||
#define STATUS_HOTEND_TEXT_X(N) status_hotend_text_x[N]
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user