Merge branch 'bugfix-2.0.x' of https://github.com/MarlinFirmware/Marlin into bugfix-2.0.x

This commit is contained in:
InsanityAutomation
2020-11-21 14:33:24 -05:00
272 changed files with 3157 additions and 2425 deletions
+1 -5
View File
@@ -119,8 +119,4 @@ jobs:
- name: Run ${{ matrix.test-platform }} Tests
run: |
# Inline tests script
chmod +x buildroot/bin/*
chmod +x buildroot/tests/*
export PATH=./buildroot/bin/:./buildroot/tests/:${PATH}
run_tests . ${{ matrix.test-platform }}
make tests-single-ci TEST_TARGET=${{ matrix.test-platform }}
+56
View File
@@ -0,0 +1,56 @@
help:
@echo "Tasks for local development:"
@echo "* tests-single-ci: Run a single test from inside the CI"
@echo "* tests-single-local: Run a single test locally"
@echo "* tests-single-local-docker: Run a single test locally, using docker-compose"
@echo "* tests-all-local: Run all tests locally"
@echo "* tests-all-local-docker: Run all tests locally, using docker-compose"
@echo "* setup-local-docker: Setup local docker-compose"
@echo ""
@echo "Options for testing:"
@echo " TEST_TARGET Set when running tests-single-*, to select the"
@echo " test. If you set it to ALL it will run all "
@echo " tests, but some of them are broken: use "
@echo " tests-all-* instead to run only the ones that "
@echo " run on GitHub CI"
@echo " ONLY_TEST Limit tests to only those that contain this, or"
@echo " the index of the test (1-based)"
@echo " VERBOSE_PLATFORMIO If you want the full PIO output, set any value"
@echo " GIT_RESET_HARD Used by CI: reset all local changes. WARNING:"
@echo " THIS WILL UNDO ANY CHANGES YOU'VE MADE!"
.PHONY: help
tests-single-ci:
export GIT_RESET_HARD=true
$(MAKE) tests-single-local TEST_TARGET=$(TEST_TARGET)
.PHONY: tests-single-ci
tests-single-local:
@if ! test -n "$(TEST_TARGET)" ; then echo "***ERROR*** Set TEST_TARGET=<your-module> or use make tests-all-local" ; return 1; fi
chmod +x buildroot/bin/*
chmod +x buildroot/tests/*
export PATH=./buildroot/bin/:./buildroot/tests/:${PATH} \
&& export VERBOSE_PLATFORMIO=$(VERBOSE_PLATFORMIO) \
&& run_tests . $(TEST_TARGET) "$(ONLY_TEST)"
.PHONY: tests-single-local
tests-single-local-docker:
@if ! test -n "$(TEST_TARGET)" ; then echo "***ERROR*** Set TEST_TARGET=<your-module> or use make tests-all-local-docker" ; return 1; fi
docker-compose run --rm marlin $(MAKE) tests-single-local TEST_TARGET=$(TEST_TARGET) VERBOSE_PLATFORMIO=$(VERBOSE_PLATFORMIO) GIT_RESET_HARD=$(GIT_RESET_HARD) ONLY_TEST="$(ONLY_TEST)"
.PHONY: tests-single-local-docker
tests-all-local:
chmod +x buildroot/bin/*
chmod +x buildroot/tests/*
export PATH=./buildroot/bin/:./buildroot/tests/:${PATH} \
&& export VERBOSE_PLATFORMIO=$(VERBOSE_PLATFORMIO) \
&& for TEST_TARGET in $$(./get_test_targets.py) ; do echo "Running tests for $$TEST_TARGET" ; run_tests . $$TEST_TARGET ; done
.PHONY: tests-all-local
tests-all-local-docker:
docker-compose run --rm marlin $(MAKE) tests-all-local VERBOSE_PLATFORMIO=$(VERBOSE_PLATFORMIO) GIT_RESET_HARD=$(GIT_RESET_HARD)
.PHONY: tests-all-local-docker
setup-local-docker:
docker-compose build
.PHONY: setup-local-docker
+17 -29
View File
@@ -158,33 +158,19 @@
#endif
/**
* Průša MK2 Single Nozzle Multi-Material Multiplexer, and variants.
* Multi-Material Unit
* Set to one of these predefined models:
*
* This device allows one stepper driver on a control board to drive
* two to eight stepper motors, one at a time, in a manner suitable
* for extruders.
*
* This option only allows the multiplexer to switch on tool-change.
* Additional options to configure custom E moves are pending.
*/
//#define MK2_MULTIPLEXER
#if ENABLED(MK2_MULTIPLEXER)
// Override the default DIO selector pins here, if needed.
// Some pins files may provide defaults for these pins.
//#define E_MUX0_PIN 40 // Always Required
//#define E_MUX1_PIN 42 // Needed for 3 to 8 inputs
//#define E_MUX2_PIN 44 // Needed for 5 to 8 inputs
#endif
/**
* Průša Multi-Material Unit v2
* PRUSA_MMU1 : Průša MMU1 (The "multiplexer" version)
* PRUSA_MMU2 : Průša MMU2
* PRUSA_MMU2S : Průša MMU2S (Requires MK3S extruder with motion sensor, EXTRUDERS = 5)
* SMUFF_EMU_MMU2 : Technik Gegg SMUFF (Průša MMU2 emulation mode)
* SMUFF_EMU_MMU2S : Technik Gegg SMUFF (Průša MMU2S emulation mode)
*
* Requires NOZZLE_PARK_FEATURE to park print head in case MMU unit fails.
* Requires EXTRUDERS = 5
*
* For additional configuration see Configuration_adv.h
* See additional options in Configuration_adv.h.
*/
//#define PRUSA_MMU2
//#define MMU_MODEL PRUSA_MMU2
// A dual extruder that uses a single stepper motor
//#define SWITCHING_EXTRUDER
@@ -389,8 +375,10 @@
* 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 : Pt100 with circuit in the Ultimainboard V2.x with 5v excitation (AVR)
* 21 : Pt100 with circuit in the Ultimainboard V2.x with 3.3v excitation (STM32 \ LPC176x....)
* 20 : Pt100 with circuit in the Ultimainboard V2.x with mainboard ADC reference voltage = INA826 amplifier-board supply voltage.
* NOTES: (1) Must use an ADC input with no pullup. (2) Some INA826 amplifiers are unreliable at 3.3V so consider using sensor 147, 110, or 21.
* 21 : Pt100 with circuit in the Ultimainboard V2.x with 3.3v ADC reference voltage (STM32, LPC176x....) and 5V INA826 amplifier board supply.
* NOTE: ADC pins are not 5V tolerant. Not recommended because it's possible to damage the CPU by going over 500°C.
* 22 : 100k (hotend) with 4.7k pullup to 3.3V and 220R to analog input (as in GTM32 Pro vB)
* 23 : 100k (bed) with 4.7k pullup to 3.3v and 220R to analog input (as in GTM32 Pro vB)
* 30 : Kis3d Silicone heating mat 200W/300W with 6mm precision cast plate (EN AW 5083) NTC100K / B3950 (4.7k pullup)
@@ -2358,10 +2346,10 @@
#define TOUCH_SCREEN_CALIBRATION
//#define XPT2046_X_CALIBRATION 12316
//#define XPT2046_Y_CALIBRATION -8981
//#define XPT2046_X_OFFSET -43
//#define XPT2046_Y_OFFSET 257
//#define TOUCH_CALIBRATION_X 12316
//#define TOUCH_CALIBRATION_Y -8981
//#define TOUCH_OFFSET_X -43
//#define TOUCH_OFFSET_Y 257
#if ENABLED(TFT_COLOR_UI)
//#define SINGLE_TOUCH_NAVIGATION
+45 -25
View File
@@ -637,6 +637,9 @@
// Default x offset in duplication mode (typically set to half print bed width)
#define DEFAULT_DUPLICATION_X_OFFSET 100
// Default action to execute following M605 mode change commands. Typically G28X to apply new mode.
//#define EVENT_GCODE_IDEX_AFTER_MODECHANGE "G28X"
#endif
// Activate a solenoid on the active extruder with M380. Disable all with M381.
@@ -1082,6 +1085,7 @@
//#define PROBE_OFFSET_WIZARD
#if ENABLED(PROBE_OFFSET_WIZARD)
#define PROBE_OFFSET_START -4.0 // Estimated nozzle-to-probe Z offset, plus a little extra
//#define PROBE_OFFSET_WIZARD_XY_POS XY_CENTER // Set a convenient position to do the measurement
#endif
#endif
@@ -1189,6 +1193,8 @@
//#define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files
//#define BROWSE_MEDIA_ON_INSERT // Open the file browser when media is inserted
#define EVENT_GCODE_SD_ABORT "G28XY" // G-code to run on SD Abort Print (e.g., "G28XY" or "G27")
#if ENABLED(PRINTER_EVENT_LEDS)
@@ -1260,7 +1266,7 @@
// Allow international symbols in long filenames. To display correctly, the
// LCD's font must contain the characters. Check your selected LCD language.
#define UTF_FILENAME_SUPPORT
//#define UTF_FILENAME_SUPPORT
// This allows hosts to request long names for files and folders with M33
//#define LONG_FILENAME_HOST_SUPPORT
@@ -3444,7 +3450,7 @@
#define GANTRY_CALIBRATION_FEEDRATE 500 // Feedrate for correction move
//#define GANTRY_CALIBRATION_TO_MIN // Enable to calibrate Z in the MIN direction
//#define GANTRY_CALIBRATION_SAFE_POSITION { X_CENTER, Y_CENTER } // Safe position for nozzle
//#define GANTRY_CALIBRATION_SAFE_POSITION XY_CENTER // Safe position for nozzle
//#define GANTRY_CALIBRATION_XY_PARK_FEEDRATE 3000 // XY Park Feedrate - MMM
//#define GANTRY_CALIBRATION_COMMANDS_PRE ""
#define GANTRY_CALIBRATION_COMMANDS_POST "G28" // G28 highly recommended to ensure an accurate position
@@ -3526,11 +3532,24 @@
#endif
/**
* Průša Multi-Material Unit v2
* Průša Multi-Material Unit (MMU)
* Enable in Configuration.h
*
* These devices allow a single stepper driver on the board to drive
* multi-material feeders with any number of stepper motors.
*/
#if ENABLED(PRUSA_MMU2)
#if HAS_PRUSA_MMU1
/**
* This option only allows the multiplexer to switch on tool-change.
* Additional options to configure custom E moves are pending.
*
* Override the default DIO selector pins here, if needed.
* Some pins files may provide defaults for these pins.
*/
//#define E_MUX0_PIN 40 // Always Required
//#define E_MUX1_PIN 42 // Needed for 3 to 8 inputs
//#define E_MUX2_PIN 44 // Needed for 5 to 8 inputs
#elif HAS_PRUSA_MMU2
// Serial port used for communication with MMU2.
// For AVR enable the UART port used for the MMU. (e.g., mmuSerial)
// For 32-bit boards check your HAL for available serial ports. (e.g., Serial2)
@@ -3548,7 +3567,7 @@
// Add an LCD menu for MMU2
//#define MMU2_MENUS
#if ENABLED(MMU2_MENUS)
#if EITHER(MMU2_MENUS, HAS_PRUSA_MMU2S)
// Settings for filament load / unload from the LCD menu.
// This is for Průša MK3-style extruders. Customize for your hardware.
#define MMU2_FILAMENTCHANGE_EJECT_FEED 80.0
@@ -3573,29 +3592,12 @@
{ -50.0, 2000 }
#endif
/**
* MMU Extruder Sensor
*
* Support for a Průša (or other) IR Sensor to detect filament near the extruder
* and make loading more reliable. Suitable for an extruder equipped with a filament
* sensor less than 38mm from the gears.
*
* During loading the extruder will stop when the sensor is triggered, then do a last
* move up to the gears. If no filament is detected, the MMU2 can make some more attempts.
* If all attempts fail, a filament runout will be triggered.
*/
//#define MMU_EXTRUDER_SENSOR
#if ENABLED(MMU_EXTRUDER_SENSOR)
#define MMU_LOADING_ATTEMPTS_NR 5 // max. number of attempts to load filament if first load fail
#endif
/**
* Using a sensor like the MMU2S
* This mode requires a MK3S extruder with a sensor at the extruder idler, like the MMU2S.
* See https://help.prusa3d.com/en/guide/3b-mk3s-mk2-5s-extruder-upgrade_41560, step 11
*/
//#define PRUSA_MMU2_S_MODE
#if ENABLED(PRUSA_MMU2_S_MODE)
#if HAS_PRUSA_MMU2S
#define MMU2_C0_RETRY 5 // Number of retries (total time = timeout*retries)
#define MMU2_CAN_LOAD_FEEDRATE 800 // (mm/min)
@@ -3611,11 +3613,29 @@
#define MMU2_CAN_LOAD_INCREMENT_SEQUENCE \
{ -MMU2_CAN_LOAD_INCREMENT, MMU2_CAN_LOAD_FEEDRATE }
#else
/**
* MMU1 Extruder Sensor
*
* Support for a Průša (or other) IR Sensor to detect filament near the extruder
* and make loading more reliable. Suitable for an extruder equipped with a filament
* sensor less than 38mm from the gears.
*
* During loading the extruder will stop when the sensor is triggered, then do a last
* move up to the gears. If no filament is detected, the MMU2 can make some more attempts.
* If all attempts fail, a filament runout will be triggered.
*/
//#define MMU_EXTRUDER_SENSOR
#if ENABLED(MMU_EXTRUDER_SENSOR)
#define MMU_LOADING_ATTEMPTS_NR 5 // max. number of attempts to load filament if first load fail
#endif
#endif
//#define MMU2_DEBUG // Write debug info to serial output
#endif // PRUSA_MMU2
#endif // HAS_PRUSA_MMU2
/**
* Advanced Print Counter settings
@@ -20,3 +20,7 @@
*
*/
#pragma once
#if DISABLED(NO_SD_HOST_DRIVE)
#define HAS_SD_HOST_DRIVE 1
#endif
+2 -2
View File
@@ -97,8 +97,8 @@ static_assert(DISABLED(BAUD_RATE_GCODE), "BAUD_RATE_GCODE is not yet supported o
#define IS_RX0(P) (P == P0_03)
#if IS_TX0(TMC_SW_MISO) || IS_RX0(TMC_SW_MOSI)
#error "Serial port pins (0) conflict with Trinamic SPI pins!"
#elif ENABLED(MK2_MULTIPLEXER) && (IS_TX0(E_MUX1_PIN) || IS_RX0(E_MUX0_PIN))
#error "Serial port pins (0) conflict with MK2 multiplexer pins!"
#elif HAS_PRUSA_MMU1 && (IS_TX0(E_MUX1_PIN) || IS_RX0(E_MUX0_PIN))
#error "Serial port pins (0) conflict with Multi-Material-Unit multiplexer pins!"
#elif (AXIS_HAS_SPI(X) && IS_TX0(X_CS_PIN)) || (AXIS_HAS_SPI(Y) && IS_RX0(Y_CS_PIN))
#error "Serial port pins (0) conflict with X/Y axis SPI pins!"
#endif
+3 -2
View File
@@ -35,10 +35,11 @@ extern "C" {
#include <debug_frmwrk.h>
}
#include "../../sd/cardreader.h"
#include "../../inc/MarlinConfig.h"
#include "../../core/millis_t.h"
#include "../../sd/cardreader.h"
extern uint32_t MSC_SD_Init(uint8_t pdrv);
extern "C" int isLPC1769();
extern "C" void disk_timerproc();
@@ -122,7 +123,7 @@ void HAL_init() {
delay(1000); // Give OS time to notice
USB_Connect(TRUE);
#if DISABLED(NO_SD_HOST_DRIVE)
#if HAS_SD_HOST_DRIVE
MSC_SD_Init(0); // Enable USB SD card access
#endif
+1 -1
View File
@@ -22,7 +22,7 @@
#include "../../../inc/MarlinConfig.h"
#if HAS_TFT_XPT2046 || HAS_TOUCH_XPT2046
#if HAS_TFT_XPT2046 || HAS_TOUCH_BUTTONS
#include "xpt2046.h"
#include <SPI.h>
+33 -55
View File
@@ -23,63 +23,50 @@ def print_error(e):
%(e, env.get('PIOENV')))
try:
#
# Find a disk for upload
#
upload_disk = 'Disk not found'
target_file_found = False
target_drive_found = False
if current_OS == 'Windows':
#
# platformio.ini will accept this for a Windows upload port designation: 'upload_port = L:'
# Windows - doesn't care about the disk's name, only cares about the drive letter
#
#
# get all drives on this computer
#
import subprocess
# typical result (string): 'Drives: C:\ D:\ E:\ F:\ G:\ H:\ I:\ J:\ K:\ L:\ M:\ Y:\ Z:\'
driveStr = str(subprocess.check_output("fsutil fsinfo drives"))
# typical result (string): 'C:\ D:\ E:\ F:\ G:\ H:\ I:\ J:\ K:\ L:\ M:\ Y:\ Z:\'
# driveStr = driveStr.strip().lstrip('Drives: ') <- Doesn't work in other Languages as English. In German is "Drives:" = "Laufwerke:"
FirstFound = driveStr.find(':',0,-1) # Find the first ":" and
driveStr = driveStr[FirstFound + 1 : -1] # truncate to the rest
# typical result (array of stings): ['C:\\', 'D:\\', 'E:\\', 'F:\\',
# 'G:\\', 'H:\\', 'I:\\', 'J:\\', 'K:\\', 'L:\\', 'M:\\', 'Y:\\', 'Z:\\']
drives = driveStr.split()
from ctypes import windll
import string
# getting list of drives
# https://stackoverflow.com/questions/827371/is-there-a-way-to-list-all-the-available-drive-letters-in-python
drives = []
bitmask = windll.kernel32.GetLogicalDrives()
for letter in string.ascii_uppercase:
if bitmask & 1:
drives.append(letter)
bitmask >>= 1
upload_disk = 'Disk not found'
target_file_found = False
target_drive_found = False
for drive in drives:
final_drive_name = drive.strip().rstrip('\\') # typical result (string): 'C:'
final_drive_name = drive + ':\\'
# print ('disc check: {}'.format(final_drive_name))
try:
volume_info = str(subprocess.check_output('cmd /C dir ' + final_drive_name, stderr=subprocess.STDOUT))
except Exception as e:
print ('error:{}'.format(e))
continue
else:
if target_drive in volume_info and target_file_found == False: # set upload if not found target file yet
if target_drive in volume_info and not target_file_found: # set upload if not found target file yet
target_drive_found = True
upload_disk = final_drive_name
if target_filename in volume_info:
if target_file_found == False:
if not target_file_found:
upload_disk = final_drive_name
target_file_found = True
#
# set upload_port to drive if found
#
if target_file_found == True or target_drive_found == True:
env.Replace(
UPLOAD_PORT=upload_disk
)
print('upload disk: ', upload_disk)
else:
print_error('Autodetect Error')
elif current_OS == 'Linux':
#
# platformio.ini will accept this for a Linux upload port designation: 'upload_port = /media/media_name/drive'
#
upload_disk = 'Disk not found'
target_file_found = False
target_drive_found = False
drives = os.listdir(os.path.join(os.sep, 'media', getpass.getuser()))
if target_drive in drives: # If target drive is found, use it.
target_drive_found = True
@@ -101,22 +88,15 @@ try:
if target_file_found or target_drive_found:
env.Replace(
UPLOAD_FLAGS="-P$UPLOAD_PORT",
UPLOAD_PORT=upload_disk
UPLOAD_FLAGS="-P$UPLOAD_PORT"
)
print('upload disk: ', upload_disk)
else:
print_error('Autodetect Error')
elif current_OS == 'Darwin': # MAC
#
# platformio.ini will accept this for a OSX upload port designation: 'upload_port = /media/media_name/drive'
#
upload_disk = 'Disk not found'
drives = os.listdir('/Volumes') # human readable names
target_file_found = False
target_drive_found = False
if target_drive in drives and target_file_found == False: # set upload if not found target file yet
if target_drive in drives and not target_file_found: # set upload if not found target file yet
target_drive_found = True
upload_disk = '/Volumes/' + target_drive + '/'
for drive in drives:
@@ -126,20 +106,18 @@ try:
continue
else:
if target_filename in filenames:
if target_file_found == False:
if not target_file_found:
upload_disk = '/Volumes/' + drive + '/'
target_file_found = True
#
# set upload_port to drive if found
#
if target_file_found == True or target_drive_found == True:
env.Replace(
UPLOAD_PORT=upload_disk
)
print('\nupload disk: ', upload_disk, '\n')
else:
print_error('Autodetect Error')
#
# Set upload_port to drive if found
#
if target_file_found or target_drive_found:
env.Replace(UPLOAD_PORT=upload_disk)
print('\nUpload disk: ', upload_disk, '\n')
else:
print_error('Autodetect Error')
except Exception as e:
print_error(str(e))
@@ -31,7 +31,7 @@
#error "ERROR - Only STM32F103xE, STM32F103xG, STM32F4xx or STM32F7xx CPUs supported"
#endif
#ifdef USBD_USE_CDC_COMPOSITE
#if HAS_SD_HOST_DRIVE
// use USB drivers
@@ -20,3 +20,7 @@
*
*/
#pragma once
#if defined(USBD_USE_CDC_COMPOSITE) && DISABLED(NO_SD_HOST_DRIVE)
#define HAS_SD_HOST_DRIVE 1
#endif
+11 -13
View File
@@ -82,7 +82,7 @@
// Public Variables
// ------------------------
#if (defined(SERIAL_USB) && !defined(USE_USB_COMPOSITE))
#if defined(SERIAL_USB) && !HAS_SD_HOST_DRIVE
USBSerial SerialUSB;
#endif
@@ -251,7 +251,7 @@ void HAL_init() {
#if PIN_EXISTS(LED)
OUT_WRITE(LED_PIN, LOW);
#endif
#ifdef USE_USB_COMPOSITE
#if HAS_SD_HOST_DRIVE
MSC_SD_init();
#endif
#if PIN_EXISTS(USB_CONNECT)
@@ -263,17 +263,15 @@ void HAL_init() {
// HAL idle task
void HAL_idletask() {
#ifdef USE_USB_COMPOSITE
#if HAS_SHARED_MEDIA
// If Marlin is using the SD card we need to lock it to prevent access from
// a PC via USB.
// Other HALs use IS_SD_PRINTING() and IS_SD_FILE_OPEN() to check for access but
// this will not reliably detect delete operations. To be safe we will lock
// the disk if Marlin has it mounted. Unfortunately there is currently no way
// to unmount the disk from the LCD menu.
// if (IS_SD_PRINTING() || IS_SD_FILE_OPEN())
/* copy from lpc1768 framework, should be fixed later for process HAS_SHARED_MEDIA*/
#endif
#if HAS_SHARED_MEDIA
// If Marlin is using the SD card we need to lock it to prevent access from
// a PC via USB.
// Other HALs use IS_SD_PRINTING() and IS_SD_FILE_OPEN() to check for access but
// this will not reliably detect delete operations. To be safe we will lock
// the disk if Marlin has it mounted. Unfortunately there is currently no way
// to unmount the disk from the LCD menu.
// if (IS_SD_PRINTING() || IS_SD_FILE_OPEN())
/* copy from lpc1768 framework, should be fixed later for process HAS_SD_HOST_DRIVE*/
// process USB mass storage device class loop
MarlinMSC.loop();
#endif
+2 -2
View File
@@ -42,7 +42,7 @@
#include "../../inc/MarlinConfigPre.h"
#ifdef USE_USB_COMPOSITE
#if HAS_SD_HOST_DRIVE
#include "msc_sd.h"
#endif
@@ -61,7 +61,7 @@
#endif
#ifdef SERIAL_USB
#ifndef USE_USB_COMPOSITE
#if !HAS_SD_HOST_DRIVE
#define UsbSerial Serial
#else
#define UsbSerial MarlinCompositeSerial
+3 -1
View File
@@ -111,7 +111,9 @@ constexpr bool serial_handles_emergency(int port) {
// Instantiate all UARTs even if they are not needed
// This avoids a bunch of logic to figure out every serial
// port which may be in use on the system.
DEFINE_HWSERIAL_MARLIN(MSerial1, 1);
#if DISABLED(MKS_WIFI_MODULE)
DEFINE_HWSERIAL_MARLIN(MSerial1, 1);
#endif
DEFINE_HWSERIAL_MARLIN(MSerial2, 2);
DEFINE_HWSERIAL_MARLIN(MSerial3, 3);
#if EITHER(STM32_HIGH_DENSITY, STM32_XL_DENSITY)
+4 -4
View File
@@ -147,15 +147,15 @@ SPIClass::SPIClass(uint32_t spi_num) {
_currentSetting->state = SPI_STATE_IDLE;
}
SPIClass::SPIClass(int8_t mosi, int8_t miso, int8_t sclk, int8_t ssel) {
SPIClass::SPIClass(int8_t mosi, int8_t miso, int8_t sclk, int8_t ssel) : SPIClass(1) {
#if BOARD_NR_SPI >= 1
if (mosi == BOARD_SPI1_MOSI_PIN) SPIClass(1);
if (mosi == BOARD_SPI1_MOSI_PIN) setModule(1);
#endif
#if BOARD_NR_SPI >= 2
if (mosi == BOARD_SPI2_MOSI_PIN) SPIClass(2);
if (mosi == BOARD_SPI2_MOSI_PIN) setModule(2);
#endif
#if BOARD_NR_SPI >= 3
if (mosi == BOARD_SPI3_MOSI_PIN) SPIClass(3);
if (mosi == BOARD_SPI3_MOSI_PIN) setModule(3);
#endif
}
@@ -20,8 +20,3 @@
*
*/
#pragma once
#if ENABLED(USE_USB_COMPOSITE)
//#warning "SD_CHECK_AND_RETRY isn't needed with USE_USB_COMPOSITE."
#undef SD_CHECK_AND_RETRY
#endif
@@ -20,3 +20,11 @@
*
*/
#pragma once
#ifdef USE_USB_COMPOSITE
//#warning "SD_CHECK_AND_RETRY isn't needed with USE_USB_COMPOSITE."
#undef SD_CHECK_AND_RETRY
#if DISABLED(NO_SD_HOST_DRIVE)
#define HAS_SD_HOST_DRIVE 1
#endif
#endif
+2 -2
View File
@@ -13,7 +13,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#if defined(__STM32F1__) && defined(USE_USB_COMPOSITE)
#if defined(__STM32F1__) && HAS_SD_HOST_DRIVE
#include "msc_sd.h"
#include "SPI.h"
@@ -77,4 +77,4 @@ void MSC_SD_init() {
#endif
}
#endif // __STM32F1__ && USE_USB_COMPOSITE
#endif // __STM32F1__ && HAS_SD_HOST_DRIVE
+5 -4
View File
@@ -21,10 +21,11 @@
#include "SPI.h"
#include "fastio.h"
#if HAS_SHARED_MEDIA
#ifndef ONBOARD_SPI_DEVICE
#define ONBOARD_SPI_DEVICE SPI_DEVICE
#endif
#ifndef ONBOARD_SPI_DEVICE
#define ONBOARD_SPI_DEVICE SPI_DEVICE
#endif
#if HAS_SD_HOST_DRIVE
#define ONBOARD_SD_SPI SPI
#else
SPIClass OnboardSPI(ONBOARD_SPI_DEVICE);
+1 -1
View File
@@ -22,7 +22,7 @@
#include "../../../inc/MarlinConfig.h"
#if HAS_TFT_XPT2046 || HAS_TOUCH_XPT2046
#if HAS_TFT_XPT2046 || HAS_TOUCH_BUTTONS
#include "xpt2046.h"
#include <SPI.h>
+16 -15
View File
@@ -60,7 +60,7 @@
#include "sd/cardreader.h"
#include "lcd/marlinui.h"
#if HAS_TOUCH_XPT2046
#if HAS_TOUCH_BUTTONS
#include "lcd/touch/touch_buttons.h"
#endif
@@ -213,8 +213,8 @@
#include "feature/controllerfan.h"
#endif
#if ENABLED(PRUSA_MMU2)
#include "feature/mmu2/mmu2.h"
#if HAS_PRUSA_MMU2
#include "feature/mmu/mmu2.h"
#endif
#if HAS_L64XX
@@ -713,9 +713,7 @@ void idle(TERN_(ADVANCED_PAUSE_FEATURE, bool no_stepper_sleep/*=false*/)) {
TERN_(HAS_FILAMENT_SENSOR, runout.run());
// Run HAL idle tasks
#ifdef HAL_IDLETASK
HAL_idletask();
#endif
TERN_(HAL_IDLETASK, HAL_idletask());
// Check network connection
TERN_(HAS_ETHERNET, ethernet.check());
@@ -772,7 +770,7 @@ void idle(TERN_(ADVANCED_PAUSE_FEATURE, bool no_stepper_sleep/*=false*/)) {
#endif
// Update the Průša MMU2
TERN_(PRUSA_MMU2, mmu2.mmu_loop());
TERN_(HAS_PRUSA_MMU2, mmu2.mmu_loop());
// Handle Joystick jogging
TERN_(POLL_JOG, joystick.inject_jog_moves());
@@ -780,9 +778,8 @@ void idle(TERN_(ADVANCED_PAUSE_FEATURE, bool no_stepper_sleep/*=false*/)) {
// Direct Stepping
TERN_(DIRECT_STEPPING, page_manager.write_responses());
#if HAS_TFT_LVGL_UI
LV_TASK_HANDLER();
#endif
// Update the LVGL interface
TERN_(HAS_TFT_LVGL_UI, LV_TASK_HANDLER());
}
/**
@@ -982,7 +979,7 @@ void setup() {
#endif
SERIAL_ECHO_MSG("start");
#if BOTH(HAS_TFT_LVGL_UI, USE_WIFI_FUNCTION)
#if BOTH(HAS_TFT_LVGL_UI, MKS_WIFI_MODULE)
mks_esp_wifi_init();
WIFISERIAL.begin(WIFI_BAUDRATE);
serial_connect_timeout = millis() + 1000UL;
@@ -1109,7 +1106,7 @@ void setup() {
SETUP_RUN(ethernet.init());
#endif
#if HAS_TOUCH_XPT2046
#if HAS_TOUCH_BUTTONS
SETUP_RUN(touch.init());
#endif
@@ -1187,8 +1184,8 @@ void setup() {
SETUP_RUN(caselight.update_brightness());
#endif
#if ENABLED(MK2_MULTIPLEXER)
SETUP_LOG("MK2_MULTIPLEXER");
#if HAS_PRUSA_MMU1
SETUP_LOG("Prusa MMU1");
SET_OUTPUT(E_MUX0_PIN);
SET_OUTPUT(E_MUX1_PIN);
SET_OUTPUT(E_MUX2_PIN);
@@ -1268,7 +1265,7 @@ void setup() {
SETUP_RUN(test_tmc_connection(true, true, true, true));
#endif
#if ENABLED(PRUSA_MMU2)
#if HAS_PRUSA_MMU2
SETUP_RUN(mmu2.init());
#endif
@@ -1307,6 +1304,10 @@ void setup() {
SETUP_RUN(password.lock_machine()); // Will not proceed until correct password provided
#endif
#if BOTH(HAS_LCD_MENU, TOUCH_SCREEN_CALIBRATION) && EITHER(TFT_CLASSIC_UI, TFT_COLOR_UI)
ui.check_touch_calibration();
#endif
marlin_state = MF_RUNNING;
SETUP_LOG("setup() completed.");
+2
View File
@@ -113,6 +113,7 @@
#define BOARD_RAMPS_S_12_EEFB 1157 // Ramps S 1.2 by Sakul.cz (Power outputs: Hotend0, Hotend1, Fan, Bed)
#define BOARD_RAMPS_S_12_EEEB 1158 // Ramps S 1.2 by Sakul.cz (Power outputs: Hotend0, Hotend1, Hotend2, Bed)
#define BOARD_RAMPS_S_12_EFFB 1159 // Ramps S 1.2 by Sakul.cz (Power outputs: Hotend, Fan0, Fan1, Bed)
#define BOARD_RAMPS_LONGER3D_LK4PRO 1160 // Longer LKxxPRO/ Alfawise UxxPro (PRO version)
//
// RAMBo and derivatives
@@ -243,6 +244,7 @@
#define BOARD_BTT_SKR_V1_4_TURBO 2508 // BigTreeTech SKR v1.4 TURBO (Power outputs: Hotend0, Hotend1, Fan, Bed)
#define BOARD_MKS_SGEN_L_V2 2509 // MKS SGEN_L V2 (Power outputs: Hotend0, Hotend1, Bed, Fan)
#define BOARD_BTT_SKR_E3_TURBO 2510 // BigTreeTech SKR E3 Turbo (Power outputs: Hotend0, Hotend1, Bed, Fan0, Fan1)
#define BOARD_FLY_CDY 2511 // FLY_CDY (Power outputs: Hotend0, Hotend1, Hotend2, Bed, Fan0, Fan1, Fan2)
//
// SAM3X8E ARM Cortex M3
+4
View File
@@ -380,6 +380,10 @@
#define LCD_STR_E6 "E" LCD_STR_N6
#define LCD_STR_E7 "E" LCD_STR_N7
// Use superscripts, if possible. Evaluated at point of use.
#define SUPERSCRIPT_TWO TERN(NOT_EXTENDED_ISO10646_1_5X7, "^2", "²")
#define SUPERSCRIPT_THREE TERN(NOT_EXTENDED_ISO10646_1_5X7, "^3", "³")
#include "multi_language.h" // Allow multiple languages
#include "../lcd/language/language_en.h"
+8
View File
@@ -161,6 +161,14 @@ void print_bilinear_leveling_grid() {
#define LINEAR_EXTRAPOLATION(E, I) ((E) * 2 - (I))
float bed_level_virt_coord(const uint8_t x, const uint8_t y) {
uint8_t ep = 0, ip = 1;
if (x > GRID_MAX_POINTS_X + 1 || y > GRID_MAX_POINTS_Y + 1) {
// The requested point requires extrapolating two points beyond the mesh.
// These values are only requested for the edges of the mesh, which are always an actual mesh point,
// and do not require interpolation. When interpolation is not needed, this "Mesh + 2" point is
// cancelled out in bed_level_virt_cmr and does not impact the result. Return 0.0 rather than
// making this function more complex by extrapolating two points.
return 0.0;
}
if (!x || x == ABL_TEMP_POINTS_X - 1) {
if (x) {
ep = GRID_MAX_POINTS_X - 1;
+1 -1
View File
@@ -62,7 +62,7 @@ class unified_bed_leveling {
#if IS_NEWPANEL
static void move_z_with_encoder(const float &multiplier);
static float measure_point_with_encoder();
static float measure_business_card_thickness(float in_height);
static float measure_business_card_thickness();
static void manually_probe_remaining_mesh(const xy_pos_t&, const float&, const float&, const bool) _O0;
static void fine_tune_mesh(const xy_pos_t &pos, const bool do_ubl_mesh_map) _O0;
#endif
+3 -3
View File
@@ -484,7 +484,7 @@
}
if (parser.seen('B')) {
g29_card_thickness = parser.has_value() ? parser.value_float() : measure_business_card_thickness(float(Z_CLEARANCE_BETWEEN_PROBES));
g29_card_thickness = parser.has_value() ? parser.value_float() : measure_business_card_thickness();
if (ABS(g29_card_thickness) > 1.5f) {
SERIAL_ECHOLNPGM("?Error in Business Card measurement.");
return;
@@ -837,11 +837,11 @@
static void echo_and_take_a_measurement() { SERIAL_ECHOLNPGM(" and take a measurement."); }
float unified_bed_leveling::measure_business_card_thickness(float in_height) {
float unified_bed_leveling::measure_business_card_thickness() {
ui.capture();
save_ubl_active_state_and_disable(); // Disable bed level correction for probing
do_blocking_move_to(0.5f * (MESH_MAX_X - (MESH_MIN_X)), 0.5f * (MESH_MAX_Y - (MESH_MIN_Y)), in_height);
do_blocking_move_to(0.5f * (MESH_MAX_X - (MESH_MIN_X)), 0.5f * (MESH_MAX_Y - (MESH_MIN_Y)), MANUAL_PROBE_START_Z);
//, _MIN(planner.settings.max_feedrate_mm_s[X_AXIS], planner.settings.max_feedrate_mm_s[Y_AXIS]) * 0.5f);
planner.synchronize();
+2 -2
View File
@@ -123,8 +123,8 @@ uint8_t MCP4728::getDrvPct(const uint8_t channel) { return uint8_t(100.0 * dac_v
* Receives all Drive strengths as 0-100 percent values, updates
* DAC Values array and calls fastwrite to update the DAC.
*/
void MCP4728::setDrvPct(xyze_uint8_t &pct) {
dac_values *= pct.asFloat() * 0.01f * (DAC_STEPPER_MAX);
void MCP4728::setDrvPct(xyze_uint_t &pct) {
dac_values = pct * (DAC_STEPPER_MAX) * 0.01f;
fastWrite();
}
+1 -1
View File
@@ -76,7 +76,7 @@ public:
static uint8_t fastWrite();
static uint8_t simpleCommand(const byte simpleCommand);
static uint8_t getDrvPct(const uint8_t channel);
static void setDrvPct(xyze_uint8_t &pct);
static void setDrvPct(xyze_uint_t &pct);
};
extern MCP4728 mcp4728;
+3 -3
View File
@@ -33,7 +33,7 @@
bool dac_present = false;
constexpr xyze_uint8_t dac_order = DAC_STEPPER_ORDER;
xyze_uint8_t dac_channel_pct = DAC_MOTOR_CURRENT_DEFAULT;
xyze_uint_t dac_channel_pct = DAC_MOTOR_CURRENT_DEFAULT;
StepperDAC stepper_dac;
@@ -72,8 +72,8 @@ void StepperDAC::set_current_percent(const uint8_t channel, float val) {
set_current_value(channel, _MIN(val, 100.0f) * (DAC_STEPPER_MAX) / 100.0f);
}
static float dac_perc(int8_t n) { return 100.0 * mcp4728.getValue(dac_order[n]) * RECIPROCAL(DAC_STEPPER_MAX); }
static float dac_amps(int8_t n) { return mcp4728.getDrvPct(dac_order[n]) * (DAC_STEPPER_MAX) * 0.125 * RECIPROCAL(DAC_STEPPER_SENSE); }
static float dac_perc(int8_t n) { return mcp4728.getDrvPct(dac_order[n]); }
static float dac_amps(int8_t n) { return mcp4728.getValue(dac_order[n]) * 0.125 * RECIPROCAL(DAC_STEPPER_SENSE * 1000); }
uint8_t StepperDAC::get_current_percent(const AxisEnum axis) { return mcp4728.getDrvPct(dac_order[axis]); }
void StepperDAC::set_current_percents(xyze_uint8_t &pct) {
@@ -41,6 +41,7 @@ PrinterEventLEDs printerEventLEDs;
uint8_t PrinterEventLEDs::old_intensity = 0;
inline uint8_t pel_intensity(const float &start, const float &current, const float &target) {
if (uint16_t(start) == uint16_t(target)) return 255;
return (uint8_t)map(constrain(current, start, target), start, target, 0.f, 255.f);
}
@@ -20,9 +20,9 @@
*
*/
#include "../inc/MarlinConfig.h"
#include "../../inc/MarlinConfig.h"
#if ENABLED(MK2_MULTIPLEXER)
#if HAS_PRUSA_MMU1
#include "../module/stepper.h"
@@ -35,4 +35,4 @@ void select_multiplexed_stepper(const uint8_t e) {
safe_delay(100);
}
#endif // MK2_MULTIPLEXER
#endif // HAS_PRUSA_MMU1
@@ -22,7 +22,7 @@
#include "../../inc/MarlinConfig.h"
#if ENABLED(PRUSA_MMU2)
#if HAS_PRUSA_MMU2
#include "mmu2.h"
#include "../../lcd/menu/menu_mmu2.h"
@@ -94,7 +94,7 @@ MMU2 mmu2;
#define mmuSerial MMU2_SERIAL
bool MMU2::enabled, MMU2::ready, MMU2::mmu_print_saved;
#if ENABLED(PRUSA_MMU2_S_MODE)
#if HAS_PRUSA_MMU2S
bool MMU2::mmu2s_triggered;
#endif
uint8_t MMU2::cmd, MMU2::cmd_arg, MMU2::last_cmd, MMU2::extruder;
@@ -105,23 +105,19 @@ int16_t MMU2::version = -1, MMU2::buildnr = -1;
millis_t MMU2::prev_request, MMU2::prev_P0_request;
char MMU2::rx_buffer[MMU_RX_SIZE], MMU2::tx_buffer[MMU_TX_SIZE];
#if BOTH(HAS_LCD_MENU, MMU2_MENUS)
struct E_Step {
float extrude; //!< extrude distance in mm
feedRate_t feedRate; //!< feed rate in mm/s
};
struct E_Step {
float extrude; //!< extrude distance in mm
feedRate_t feedRate; //!< feed rate in mm/s
};
static constexpr E_Step
ramming_sequence[] PROGMEM = { MMU2_RAMMING_SEQUENCE }
, load_to_nozzle_sequence[] PROGMEM = { MMU2_LOAD_TO_NOZZLE_SEQUENCE }
#if ENABLED(PRUSA_MMU2_S_MODE)
, can_load_sequence[] PROGMEM = { MMU2_CAN_LOAD_SEQUENCE }
, can_load_increment_sequence[] PROGMEM = { MMU2_CAN_LOAD_INCREMENT_SEQUENCE }
#endif
;
#endif // MMU2_MENUS
static constexpr E_Step
ramming_sequence[] PROGMEM = { MMU2_RAMMING_SEQUENCE }
, load_to_nozzle_sequence[] PROGMEM = { MMU2_LOAD_TO_NOZZLE_SEQUENCE }
#if HAS_PRUSA_MMU2S
, can_load_sequence[] PROGMEM = { MMU2_CAN_LOAD_SEQUENCE }
, can_load_increment_sequence[] PROGMEM = { MMU2_CAN_LOAD_INCREMENT_SEQUENCE }
#endif
;
MMU2::MMU2() {
rx_buffer[0] = '\0';
@@ -162,7 +158,7 @@ uint8_t MMU2::get_current_tool() {
return extruder == MMU2_NO_TOOL ? -1 : extruder;
}
#if EITHER(PRUSA_MMU2_S_MODE, MMU_EXTRUDER_SENSOR)
#if EITHER(HAS_PRUSA_MMU2S, MMU_EXTRUDER_SENSOR)
#define FILAMENT_PRESENT() (READ(FIL_RUNOUT1_PIN) != FIL_RUNOUT1_STATE)
#endif
@@ -188,7 +184,7 @@ void MMU2::mmu_loop() {
case -2:
if (rx_ok()) {
sscanf(rx_buffer, "%uok\n", &version);
sscanf(rx_buffer, "%huok\n", &version);
DEBUG_ECHOLNPAIR("MMU => ", version, "\nMMU <= 'S2'");
@@ -199,7 +195,7 @@ void MMU2::mmu_loop() {
case -3:
if (rx_ok()) {
sscanf(rx_buffer, "%uok\n", &buildnr);
sscanf(rx_buffer, "%huok\n", &buildnr);
DEBUG_ECHOLNPAIR("MMU => ", buildnr);
@@ -242,7 +238,7 @@ void MMU2::mmu_loop() {
enabled = true;
state = 1;
TERN_(PRUSA_MMU2_S_MODE, mmu2s_triggered = false);
TERN_(HAS_PRUSA_MMU2S, mmu2s_triggered = false);
}
break;
@@ -307,7 +303,7 @@ void MMU2::mmu_loop() {
state = 2; // wait for response
}
TERN_(PRUSA_MMU2_S_MODE, check_filament());
TERN_(HAS_PRUSA_MMU2S, check_filament());
break;
case 2: // response to command P0
@@ -324,7 +320,7 @@ void MMU2::mmu_loop() {
else if (ELAPSED(millis(), prev_request + MMU_P0_TIMEOUT)) // Resend request after timeout (3s)
state = 1;
TERN_(PRUSA_MMU2_S_MODE, check_filament());
TERN_(HAS_PRUSA_MMU2S, check_filament());
break;
case 3: // response to mmu commands
@@ -340,9 +336,9 @@ void MMU2::mmu_loop() {
#endif
if (rx_ok()) {
// Response to C0 mmu command in PRUSA_MMU2_S_MODE
// Response to C0 mmu command in MMU2S model
bool can_reset = true;
#if ENABLED(PRUSA_MMU2_S_MODE)
#if HAS_PRUSA_MMU2S
if (!mmu2s_triggered && last_cmd == MMU_CMD_C0) {
can_reset = false;
// MMU ok received but filament sensor not triggered, retrying...
@@ -367,7 +363,7 @@ void MMU2::mmu_loop() {
}
state = 1;
}
TERN_(PRUSA_MMU2_S_MODE, check_filament());
TERN_(HAS_PRUSA_MMU2S, check_filament());
break;
}
}
@@ -487,7 +483,7 @@ static void mmu2_not_responding() {
BUZZ(100, 659);
}
#if ENABLED(PRUSA_MMU2_S_MODE)
#if HAS_PRUSA_MMU2S
bool MMU2::load_to_gears() {
command(MMU_CMD_C0);
@@ -541,33 +537,38 @@ static void mmu2_not_responding() {
* Tc Load to nozzle after filament was prepared by Tx and extruder nozzle is already heated.
*/
void MMU2::tool_change(const char* special) {
if (!enabled) return;
#if ENABLED(MMU2_MENUS)
if (!enabled) return;
set_runout_valid(false);
switch (*special) {
case '?': {
uint8_t index = mmu2_choose_filament();
while (!thermalManager.wait_for_hotend(active_extruder, false)) safe_delay(100);
load_filament_to_nozzle(index);
#if ENABLED(MMU2_MENUS)
const uint8_t index = mmu2_choose_filament();
while (!thermalManager.wait_for_hotend(active_extruder, false)) safe_delay(100);
load_filament_to_nozzle(index);
#else
BUZZ(400, 40);
#endif
} break;
case 'x': {
planner.synchronize();
uint8_t index = mmu2_choose_filament();
DISABLE_AXIS_E0();
command(MMU_CMD_T0 + index);
manage_response(true, true);
#if ENABLED(MMU2_MENUS)
planner.synchronize();
const uint8_t index = mmu2_choose_filament();
DISABLE_AXIS_E0();
command(MMU_CMD_T0 + index);
manage_response(true, true);
if (load_to_gears()) {
mmu_loop();
ENABLE_AXIS_E0();
extruder = index;
active_extruder = 0;
}
if (load_to_gears()) {
mmu_loop();
ENABLE_AXIS_E0();
extruder = index;
active_extruder = 0;
}
#else
BUZZ(400, 40);
#endif
} break;
case 'c': {
@@ -577,8 +578,6 @@ static void mmu2_not_responding() {
}
set_runout_valid(true);
#endif // MMU2_MENUS
}
#elif ENABLED(MMU_EXTRUDER_SENSOR)
@@ -628,20 +627,23 @@ static void mmu2_not_responding() {
void MMU2::tool_change(const char* special) {
if (!enabled) return;
#if ENABLED(MMU2_MENUS)
set_runout_valid(false);
set_runout_valid(false);
switch (*special) {
case '?': {
DEBUG_ECHOLNPGM("case ?\n");
switch (*special) {
case '?': {
DEBUG_ECHOLNPGM("case ?\n");
#if ENABLED(MMU2_MENUS)
uint8_t index = mmu2_choose_filament();
while (!thermalManager.wait_for_hotend(active_extruder, false)) safe_delay(100);
load_filament_to_nozzle(index);
} break;
#else
BUZZ(400, 40);
#endif
} break;
case 'x': {
DEBUG_ECHOLNPGM("case x\n");
case 'x': {
DEBUG_ECHOLNPGM("case x\n");
#if ENABLED(MMU2_MENUS)
planner.synchronize();
uint8_t index = mmu2_choose_filament();
DISABLE_AXIS_E0();
@@ -654,18 +656,19 @@ static void mmu2_not_responding() {
ENABLE_AXIS_E0();
extruder = index;
active_extruder = 0;
} break;
#else
BUZZ(400, 40);
#endif
} break;
case 'c': {
DEBUG_ECHOLNPGM("case c\n");
while (!thermalManager.wait_for_hotend(active_extruder, false)) safe_delay(100);
execute_extruder_sequence((const E_Step *)load_to_nozzle_sequence, COUNT(load_to_nozzle_sequence));
} break;
}
case 'c': {
DEBUG_ECHOLNPGM("case c\n");
while (!thermalManager.wait_for_hotend(active_extruder, false)) safe_delay(100);
execute_extruder_sequence((const E_Step *)load_to_nozzle_sequence, COUNT(load_to_nozzle_sequence));
} break;
}
set_runout_valid(true);
#endif // MMU2_MENUS
set_runout_valid(true);
}
void MMU2::mmu_continue_loading() {
@@ -682,68 +685,74 @@ static void mmu2_not_responding() {
mmu_idl_sens = 0;
}
#elif DISABLED(MMU_EXTRUDER_SENSOR) && DISABLED(PRUSA_MMU2_S_MODE)
#else // !HAS_PRUSA_MMU2S && !MMU_EXTRUDER_SENSOR
/**
* Handle tool change
*/
void MMU2::tool_change(const uint8_t index) {
if (!enabled) return;
/**
* Handle tool change
*/
void MMU2::tool_change(const uint8_t index) {
if (!enabled) return;
set_runout_valid(false);
set_runout_valid(false);
if (index != extruder) {
DISABLE_AXIS_E0();
ui.status_printf_P(0, GET_TEXT(MSG_MMU2_LOADING_FILAMENT), int(index + 1));
command(MMU_CMD_T0 + index);
manage_response(true, true);
command(MMU_CMD_C0);
extruder = index; //filament change is finished
active_extruder = 0;
ENABLE_AXIS_E0();
SERIAL_ECHO_START();
SERIAL_ECHOLNPAIR(STR_ACTIVE_EXTRUDER, int(extruder));
ui.reset_status();
if (index != extruder) {
DISABLE_AXIS_E0();
ui.status_printf_P(0, GET_TEXT(MSG_MMU2_LOADING_FILAMENT), int(index + 1));
command(MMU_CMD_T0 + index);
manage_response(true, true);
command(MMU_CMD_C0);
extruder = index; //filament change is finished
active_extruder = 0;
ENABLE_AXIS_E0();
SERIAL_ECHO_START();
SERIAL_ECHOLNPAIR(STR_ACTIVE_EXTRUDER, int(extruder));
ui.reset_status();
}
set_runout_valid(true);
}
set_runout_valid(true);
}
/**
* Handle special T?/Tx/Tc commands
*
* T? Gcode to extrude shouldn't have to follow, load to extruder wheels is done automatically
* Tx Same as T?, except nozzle doesn't have to be preheated. Tc must be placed after extruder nozzle is preheated to finish filament load.
* Tc Load to nozzle after filament was prepared by Tx and extruder nozzle is already heated.
*/
void MMU2::tool_change(const char* special) {
if (!enabled) return;
#if ENABLED(MMU2_MENUS)
/**
* Handle special T?/Tx/Tc commands
*
* T? Gcode to extrude shouldn't have to follow, load to extruder wheels is done automatically
* Tx Same as T?, except nozzle doesn't have to be preheated. Tc must be placed after extruder nozzle is preheated to finish filament load.
* Tc Load to nozzle after filament was prepared by Tx and extruder nozzle is already heated.
*/
void MMU2::tool_change(const char* special) {
if (!enabled) return;
set_runout_valid(false);
switch (*special) {
case '?': {
DEBUG_ECHOLNPGM("case ?\n");
uint8_t index = mmu2_choose_filament();
while (!thermalManager.wait_for_hotend(active_extruder, false)) safe_delay(100);
load_filament_to_nozzle(index);
#if ENABLED(MMU2_MENUS)
uint8_t index = mmu2_choose_filament();
while (!thermalManager.wait_for_hotend(active_extruder, false)) safe_delay(100);
load_filament_to_nozzle(index);
#else
BUZZ(400, 40);
#endif
} break;
case 'x': {
DEBUG_ECHOLNPGM("case x\n");
planner.synchronize();
uint8_t index = mmu2_choose_filament();
DISABLE_AXIS_E0();
command(MMU_CMD_T0 + index);
manage_response(true, true);
command(MMU_CMD_C0);
mmu_loop();
#if ENABLED(MMU2_MENUS)
planner.synchronize();
uint8_t index = mmu2_choose_filament();
DISABLE_AXIS_E0();
command(MMU_CMD_T0 + index);
manage_response(true, true);
command(MMU_CMD_C0);
mmu_loop();
ENABLE_AXIS_E0();
extruder = index;
active_extruder = 0;
ENABLE_AXIS_E0();
extruder = index;
active_extruder = 0;
#else
BUZZ(400, 40);
#endif
} break;
case 'c': {
@@ -754,11 +763,9 @@ void MMU2::tool_change(const char* special) {
}
set_runout_valid(true);
#endif
}
#endif // MMU_EXTRUDER_SENSOR
#endif // HAS_PRUSA_MMU2S
/**
* Set next command
@@ -866,7 +873,7 @@ void MMU2::filament_runout() {
planner.synchronize();
}
#if ENABLED(PRUSA_MMU2_S_MODE)
#if HAS_PRUSA_MMU2S
void MMU2::check_filament() {
const bool present = FILAMENT_PRESENT();
@@ -907,162 +914,159 @@ void MMU2::filament_runout() {
DEBUG_ECHOLNPGM(" succeeded.");
return true;
}
#endif
#if BOTH(HAS_LCD_MENU, MMU2_MENUS)
// Load filament into MMU2
void MMU2::load_filament(const uint8_t index) {
if (!enabled) return;
command(MMU_CMD_L0 + index);
manage_response(false, false);
BUZZ(200, 404);
}
// Load filament into MMU2
void MMU2::load_filament(const uint8_t index) {
if (!enabled) return;
command(MMU_CMD_L0 + index);
/**
* Switch material and load to nozzle
*/
bool MMU2::load_filament_to_nozzle(const uint8_t index) {
if (!enabled) return false;
if (thermalManager.tooColdToExtrude(active_extruder)) {
BUZZ(200, 404);
LCD_ALERTMESSAGEPGM(MSG_HOTEND_TOO_COLD);
return false;
}
command(MMU_CMD_T0 + index);
manage_response(true, true);
const bool success = load_to_gears();
if (success) {
mmu_loop();
extruder = index;
active_extruder = 0;
load_to_nozzle();
BUZZ(200, 404);
}
return success;
}
/**
* Load filament to nozzle of multimaterial printer
*
* This function is used only only after T? (user select filament) and M600 (change filament).
* It is not used after T0 .. T4 command (select filament), in such case, gcode is responsible for loading
* filament to nozzle.
*/
void MMU2::load_to_nozzle() {
if (!enabled) return;
execute_extruder_sequence((const E_Step *)load_to_nozzle_sequence, COUNT(load_to_nozzle_sequence));
}
bool MMU2::eject_filament(const uint8_t index, const bool recover) {
if (!enabled) return false;
if (thermalManager.tooColdToExtrude(active_extruder)) {
BUZZ(200, 404);
LCD_ALERTMESSAGEPGM(MSG_HOTEND_TOO_COLD);
return false;
}
LCD_MESSAGEPGM(MSG_MMU2_EJECTING_FILAMENT);
ENABLE_AXIS_E0();
current_position.e -= MMU2_FILAMENTCHANGE_EJECT_FEED;
line_to_current_position(MMM_TO_MMS(2500));
planner.synchronize();
command(MMU_CMD_E0 + index);
manage_response(false, false);
if (recover) {
LCD_MESSAGEPGM(MSG_MMU2_EJECT_RECOVER);
BUZZ(200, 404);
TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, PSTR("MMU2 Eject Recover"), CONTINUE_STR));
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(PSTR("MMU2 Eject Recover")));
wait_for_user_response();
BUZZ(200, 404);
BUZZ(200, 404);
command(MMU_CMD_R0);
manage_response(false, false);
}
ui.reset_status();
// no active tool
extruder = MMU2_NO_TOOL;
set_runout_valid(false);
BUZZ(200, 404);
DISABLE_AXIS_E0();
return true;
}
/**
* Unload from hotend and retract to MMU
*/
bool MMU2::unload() {
if (!enabled) return false;
if (thermalManager.tooColdToExtrude(active_extruder)) {
BUZZ(200, 404);
LCD_ALERTMESSAGEPGM(MSG_HOTEND_TOO_COLD);
return false;
}
/**
* Switch material and load to nozzle
*/
bool MMU2::load_filament_to_nozzle(const uint8_t index) {
filament_ramming();
if (!enabled) return false;
command(MMU_CMD_U0);
manage_response(false, true);
if (thermalManager.tooColdToExtrude(active_extruder)) {
BUZZ(200, 404);
LCD_ALERTMESSAGEPGM(MSG_HOTEND_TOO_COLD);
return false;
}
BUZZ(200, 404);
command(MMU_CMD_T0 + index);
manage_response(true, true);
// no active tool
extruder = MMU2_NO_TOOL;
const bool success = load_to_gears();
if (success) {
mmu_loop();
extruder = index;
active_extruder = 0;
load_to_nozzle();
BUZZ(200, 404);
}
return success;
}
set_runout_valid(false);
/**
* Load filament to nozzle of multimaterial printer
*
* This function is used only only after T? (user select filament) and M600 (change filament).
* It is not used after T0 .. T4 command (select filament), in such case, gcode is responsible for loading
* filament to nozzle.
*/
void MMU2::load_to_nozzle() {
if (!enabled) return;
execute_extruder_sequence((const E_Step *)load_to_nozzle_sequence, COUNT(load_to_nozzle_sequence));
}
return true;
}
bool MMU2::eject_filament(const uint8_t index, const bool recover) {
/**
* Unload sequence to optimize shape of the tip of the unloaded filament
*/
void MMU2::filament_ramming() {
execute_extruder_sequence((const E_Step *)ramming_sequence, sizeof(ramming_sequence) / sizeof(E_Step));
}
if (!enabled) return false;
void MMU2::execute_extruder_sequence(const E_Step * sequence, int steps) {
if (thermalManager.tooColdToExtrude(active_extruder)) {
BUZZ(200, 404);
LCD_ALERTMESSAGEPGM(MSG_HOTEND_TOO_COLD);
return false;
}
planner.synchronize();
ENABLE_AXIS_E0();
LCD_MESSAGEPGM(MSG_MMU2_EJECTING_FILAMENT);
const E_Step* step = sequence;
ENABLE_AXIS_E0();
current_position.e -= MMU2_FILAMENTCHANGE_EJECT_FEED;
line_to_current_position(2500 / 60);
LOOP_L_N(i, steps) {
const float es = pgm_read_float(&(step->extrude));
const feedRate_t fr_mm_m = pgm_read_float(&(step->feedRate));
DEBUG_ECHO_START();
DEBUG_ECHOLNPAIR("E step ", es, "/", fr_mm_m);
current_position.e += es;
line_to_current_position(MMM_TO_MMS(fr_mm_m));
planner.synchronize();
command(MMU_CMD_E0 + index);
manage_response(false, false);
if (recover) {
LCD_MESSAGEPGM(MSG_MMU2_EJECT_RECOVER);
BUZZ(200, 404);
TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, PSTR("MMU2 Eject Recover"), CONTINUE_STR));
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(PSTR("MMU2 Eject Recover")));
wait_for_user_response();
BUZZ(200, 404);
BUZZ(200, 404);
command(MMU_CMD_R0);
manage_response(false, false);
}
ui.reset_status();
// no active tool
extruder = MMU2_NO_TOOL;
set_runout_valid(false);
BUZZ(200, 404);
DISABLE_AXIS_E0();
return true;
step++;
}
/**
* Unload from hotend and retract to MMU
*/
bool MMU2::unload() {
DISABLE_AXIS_E0();
}
if (!enabled) return false;
if (thermalManager.tooColdToExtrude(active_extruder)) {
BUZZ(200, 404);
LCD_ALERTMESSAGEPGM(MSG_HOTEND_TOO_COLD);
return false;
}
filament_ramming();
command(MMU_CMD_U0);
manage_response(false, true);
BUZZ(200, 404);
// no active tool
extruder = MMU2_NO_TOOL;
set_runout_valid(false);
return true;
}
/**
* Unload sequence to optimize shape of the tip of the unloaded filament
*/
void MMU2::filament_ramming() {
execute_extruder_sequence((const E_Step *)ramming_sequence, sizeof(ramming_sequence) / sizeof(E_Step));
}
void MMU2::execute_extruder_sequence(const E_Step * sequence, int steps) {
planner.synchronize();
ENABLE_AXIS_E0();
const E_Step* step = sequence;
LOOP_L_N(i, steps) {
const float es = pgm_read_float(&(step->extrude));
const feedRate_t fr_mm_m = pgm_read_float(&(step->feedRate));
DEBUG_ECHO_START();
DEBUG_ECHOLNPAIR("E step ", es, "/", fr_mm_m);
current_position.e += es;
line_to_current_position(MMM_TO_MMS(fr_mm_m));
planner.synchronize();
step++;
}
DISABLE_AXIS_E0();
}
#endif // HAS_LCD_MENU && MMU2_MENUS
#endif // PRUSA_MMU2
#endif // HAS_PRUSA_MMU2
@@ -49,13 +49,11 @@ public:
static uint8_t get_current_tool();
static void set_filament_type(const uint8_t index, const uint8_t type);
#if BOTH(HAS_LCD_MENU, MMU2_MENUS)
static bool unload();
static void load_filament(uint8_t);
static void load_all();
static bool load_filament_to_nozzle(const uint8_t index);
static bool eject_filament(const uint8_t index, const bool recover);
#endif
static bool unload();
static void load_filament(uint8_t);
static void load_all();
static bool load_filament_to_nozzle(const uint8_t index);
static bool eject_filament(const uint8_t index, const bool recover);
private:
static bool rx_str_P(const char* str);
@@ -72,15 +70,13 @@ private:
static bool get_response();
static void manage_response(const bool move_axes, const bool turn_off_nozzle);
#if BOTH(HAS_LCD_MENU, MMU2_MENUS)
static void load_to_nozzle();
static void filament_ramming();
static void execute_extruder_sequence(const E_Step * sequence, int steps);
#endif
static void load_to_nozzle();
static void filament_ramming();
static void execute_extruder_sequence(const E_Step * sequence, int steps);
static void filament_runout();
#if ENABLED(PRUSA_MMU2_S_MODE)
#if HAS_PRUSA_MMU2S
static bool mmu2s_triggered;
static void check_filament();
static bool can_load();
+1 -1
View File
@@ -47,7 +47,7 @@ public:
static void start_over();
static void digit_entered();
static void set_password_done();
static void set_password_done(const bool with_set=true);
static void menu_password_report();
static void remove_password();
+11 -11
View File
@@ -180,10 +180,10 @@ void PrintJobRecovery::save(const bool force/*=false*/, const float zraise/*=0*/
// Machine state
info.current_position = current_position;
info.feedrate = uint16_t(feedrate_mm_s * 60.0f);
info.zraise = zraise;
TERN_(HAS_HOME_OFFSET, info.home_offset = home_offset);
TERN_(HAS_POSITION_SHIFT, info.position_shift = position_shift);
info.feedrate = uint16_t(feedrate_mm_s * 60.0f);
#if HAS_MULTI_EXTRUDER
info.active_extruder = active_extruder;
@@ -209,7 +209,7 @@ void PrintJobRecovery::save(const bool force/*=false*/, const float zraise/*=0*/
#endif
#if HAS_LEVELING
info.leveling = planner.leveling_active;
info.flag.leveling = planner.leveling_active;
info.fade = TERN0(ENABLE_LEVELING_FADE_HEIGHT, planner.z_fade_height);
#endif
@@ -220,12 +220,12 @@ void PrintJobRecovery::save(const bool force/*=false*/, const float zraise/*=0*/
info.retract_hop = fwretract.current_hop;
#endif
// Relative axis modes
info.axis_relative = gcode.axis_relative;
// Elapsed print job time
info.print_job_elapsed = print_job_timer.duration();
// Relative axis modes
info.axis_relative = gcode.axis_relative;
// Misc. Marlin flags
info.flag.dryrun = !!(marlin_debug_flags & MARLIN_DEBUG_DRYRUN);
info.flag.allow_cold_extrusion = TERN0(PREVENT_COLD_EXTRUSION, thermalManager.allow_cold_extrude);
@@ -457,8 +457,8 @@ void PrintJobRecovery::resume() {
#if HAS_LEVELING
// Restore leveling state before 'G92 Z' to ensure
// the Z stepper count corresponds to the native Z.
if (info.fade || info.leveling) {
sprintf_P(cmd, PSTR("M420 S%i Z%s"), int(info.leveling), dtostrf(info.fade, 1, 1, str_1));
if (info.fade || info.flag.leveling) {
sprintf_P(cmd, PSTR("M420 S%i Z%s"), int(info.flag.leveling), dtostrf(info.fade, 1, 1, str_1));
gcode.process_subcommands_now(cmd);
}
#endif
@@ -507,15 +507,15 @@ void PrintJobRecovery::resume() {
sprintf_P(cmd, PSTR("G92.9 E%s"), dtostrf(info.current_position.e, 1, 3, str_1));
gcode.process_subcommands_now(cmd);
// Relative axis modes
gcode.axis_relative = info.axis_relative;
TERN_(HAS_HOME_OFFSET, home_offset = info.home_offset);
TERN_(HAS_POSITION_SHIFT, position_shift = info.position_shift);
#if HAS_HOME_OFFSET || HAS_POSITION_SHIFT
LOOP_XYZ(i) update_workspace_offset((AxisEnum)i);
#endif
// Relative axis modes
gcode.axis_relative = info.axis_relative;
#if ENABLED(DEBUG_POWER_LOSS_RECOVERY)
const uint8_t old_flags = marlin_debug_flags;
marlin_debug_flags |= MARLIN_DEBUG_ECHO;
@@ -598,7 +598,7 @@ void PrintJobRecovery::resume() {
#endif
#if HAS_LEVELING
DEBUG_ECHOLNPAIR("leveling: ", int(info.leveling), " fade: ", info.fade);
DEBUG_ECHOLNPAIR("leveling: ", int(info.flag.leveling), " fade: ", info.fade);
#endif
#if ENABLED(FWRETRACT)
DEBUG_ECHOPGM("retract: ");
+13 -32
View File
@@ -47,42 +47,24 @@ typedef struct {
// Machine state
xyze_pos_t current_position;
uint16_t feedrate;
float zraise;
#if HAS_HOME_OFFSET
xyz_pos_t home_offset;
#endif
#if HAS_POSITION_SHIFT
xyz_pos_t position_shift;
#endif
uint16_t feedrate;
#if HAS_MULTI_EXTRUDER
uint8_t active_extruder;
#endif
TERN_(HAS_HOME_OFFSET, xyz_pos_t home_offset);
TERN_(HAS_POSITION_SHIFT, xyz_pos_t position_shift);
TERN_(HAS_MULTI_EXTRUDER, uint8_t active_extruder);
#if DISABLED(NO_VOLUMETRICS)
bool volumetric_enabled;
float filament_size[EXTRUDERS];
#endif
#if HAS_HOTEND
int16_t target_temperature[HOTENDS];
#endif
TERN_(HAS_HOTEND, int16_t target_temperature[HOTENDS]);
TERN_(HAS_HEATED_BED, int16_t target_temperature_bed);
TERN_(HAS_FAN, uint8_t fan_speed[FAN_COUNT]);
#if HAS_HEATED_BED
int16_t target_temperature_bed;
#endif
#if HAS_FAN
uint8_t fan_speed[FAN_COUNT];
#endif
#if HAS_LEVELING
bool leveling;
float fade;
#endif
TERN_(HAS_LEVELING, float fade);
#if ENABLED(FWRETRACT)
float retract[EXTRUDERS], retract_hop;
@@ -92,14 +74,9 @@ typedef struct {
#if ENABLED(MIXING_EXTRUDER)
//uint_fast8_t selected_vtool;
//mixer_comp_t color[NR_MIXING_VIRTUAL_TOOLS][MIXING_STEPPERS];
#if ENABLED(GRADIENT_MIX)
gradient_t gradient;
#endif
TERN_(GRADIENT_MIX, gradient_t gradient);
#endif
// Relative axis modes
uint8_t axis_relative;
// SD Filename and position
char sd_filename[MAXPATHNAMELENGTH];
volatile uint32_t sdpos;
@@ -107,10 +84,14 @@ typedef struct {
// Job elapsed time
millis_t print_job_elapsed;
// Relative axis modes
uint8_t axis_relative;
// Misc. Marlin flags
struct {
bool dryrun:1; // M111 S8
bool allow_cold_extrusion:1; // M302 P1
TERN_(HAS_LEVELING, bool leveling:1);
} flag;
uint8_t valid_foot;
+1 -1
View File
@@ -149,7 +149,7 @@ class FilamentSensorBase {
public:
static inline void setup() {
#define _INIT_RUNOUT_PIN(P,S,U) do{ if (DISABLED(U)) SET_INPUT(P); else if (S) SET_INPUT_PULLDOWN(P); else SET_INPUT_PULLUP(P); }while(0)
#define _INIT_RUNOUT_PIN(P,S,U) do{ if (DISABLED(U)) SET_INPUT(P); else if (S) SET_INPUT_PULLUP(P); else SET_INPUT_PULLDOWN(P); }while(0)
#define INIT_RUNOUT_PIN(N) _INIT_RUNOUT_PIN(FIL_RUNOUT##N##_PIN, FIL_RUNOUT##N##_STATE, FIL_RUNOUT##N##_PULL)
#if NUM_RUNOUT_SENSORS >= 1
INIT_RUNOUT_PIN(1);
+1 -1
View File
@@ -405,7 +405,7 @@ inline bool turn_on_heaters() {
inline bool prime_nozzle() {
const feedRate_t fr_slow_e = planner.settings.max_feedrate_mm_s[E_AXIS] / 15.0f;
#if HAS_LCD_MENU && !HAS_TOUCH_XPT2046 // ui.button_pressed issue with touchscreen
#if HAS_LCD_MENU && !HAS_TOUCH_BUTTONS // ui.button_pressed issue with touchscreen
#if ENABLED(PREVENT_LENGTHY_EXTRUDE)
float Total_Prime = 0.0;
#endif
+2 -2
View File
@@ -31,13 +31,13 @@
*
* Report the current speed percentage factor if no parameter is specified
*
* With PRUSA_MMU2...
* For MMU2 and MMU2S devices...
* B : Flag to back up the current factor
* R : Flag to restore the last-saved factor
*/
void GcodeSuite::M220() {
#if ENABLED(PRUSA_MMU2)
#if HAS_PRUSA_MMU2
static int16_t backup_feedrate_percentage = 100;
if (parser.seen('B')) backup_feedrate_percentage = feedrate_percentage;
if (parser.seen('R')) feedrate_percentage = backup_feedrate_percentage;
+4
View File
@@ -103,6 +103,10 @@
}
idex_set_parked(false);
set_duplication_enabled(false);
#ifdef EVENT_GCODE_IDEX_AFTER_MODECHANGE
gcode.process_subcommands_now_P(PSTR(EVENT_GCODE_IDEX_AFTER_MODECHANGE));
#endif
}
else if (!parser.seen('W')) // if no S or W parameter, the DXC mode gets reset to the user's default
dual_x_carriage_mode = DEFAULT_DUAL_X_CARRIAGE_MODE;
+4 -4
View File
@@ -27,8 +27,8 @@
#include "../../module/motion.h"
#endif
#if ENABLED(PRUSA_MMU2)
#include "../../feature/mmu2/mmu2.h"
#if HAS_PRUSA_MMU2
#include "../../feature/mmu/mmu2.h"
#endif
#define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE)
@@ -40,7 +40,7 @@
* F[units/min] Set the movement feedrate
* S1 Don't move the tool in XY after change
*
* For PRUSA_MMU2:
* For PRUSA_MMU2(S) and SMUFF_EMU_MMU2(S)
* T[n] Gcode to extrude at least 38.10 mm at feedrate 19.02 mm/s must follow immediately to load to extruder wheels.
* T? Gcode to extrude shouldn't have to follow. Load to extruder wheels is done automatically.
* Tx Same as T?, but nozzle doesn't have to be preheated. Tc requires a preheated nozzle to finish filament load.
@@ -54,7 +54,7 @@ void GcodeSuite::T(const int8_t tool_index) {
// Count this command as movement / activity
reset_stepper_timeout();
#if ENABLED(PRUSA_MMU2)
#if HAS_PRUSA_MMU2
if (parser.string_arg) {
mmu2.tool_change(parser.string_arg); // Special commands T?/Tx/Tc
return;
+2 -2
View File
@@ -308,8 +308,8 @@ void GcodeSuite::M917() {
L64xxManager.set_param(axis_index[j], L6470_KVAL_HOLD, kval_hold);
}
DEBUG_ECHOLNPGM(".");
gcode.reset_stepper_timeout(); // reset_stepper_timeout to keep steppers powered
watchdog_refresh();; // beat the dog
gcode.reset_stepper_timeout(); // keep steppers powered
watchdog_refresh();
safe_delay(5000);
status_composite_temp = 0;
for (j = 0; j < driver_count; j++) {
+8 -8
View File
@@ -38,8 +38,8 @@
#include "../../../lcd/marlinui.h"
#endif
#if ENABLED(PRUSA_MMU2)
#include "../../../feature/mmu2/mmu2.h"
#if HAS_PRUSA_MMU2
#include "../../../feature/mmu/mmu2.h"
#endif
#if ENABLED(MIXING_EXTRUDER)
@@ -86,7 +86,7 @@ void GcodeSuite::M701() {
// Show initial "wait for load" message
TERN_(HAS_LCD_MENU, lcd_pause_show_message(PAUSE_MESSAGE_LOAD, PAUSE_MODE_LOAD_FILAMENT, target_extruder));
#if HAS_MULTI_EXTRUDER && DISABLED(PRUSA_MMU2)
#if HAS_MULTI_EXTRUDER && (HAS_PRUSA_MMU1 || !HAS_MMU)
// Change toolhead if specified
uint8_t active_extruder_before_filament_change = active_extruder;
if (active_extruder != target_extruder)
@@ -98,7 +98,7 @@ void GcodeSuite::M701() {
do_blocking_move_to_z(_MIN(current_position.z + park_point.z, Z_MAX_POS), feedRate_t(NOZZLE_PARK_Z_FEEDRATE));
// Load filament
#if ENABLED(PRUSA_MMU2)
#if HAS_PRUSA_MMU2
mmu2.load_filament_to_nozzle(target_extruder);
#else
constexpr float purge_length = ADVANCED_PAUSE_PURGE_LENGTH,
@@ -121,7 +121,7 @@ void GcodeSuite::M701() {
if (park_point.z > 0)
do_blocking_move_to_z(_MAX(current_position.z - park_point.z, 0), feedRate_t(NOZZLE_PARK_Z_FEEDRATE));
#if HAS_MULTI_EXTRUDER && DISABLED(PRUSA_MMU2)
#if HAS_MULTI_EXTRUDER && (HAS_PRUSA_MMU1 || !HAS_MMU)
// Restore toolhead if it was changed
if (active_extruder_before_filament_change != active_extruder)
tool_change(active_extruder_before_filament_change, false);
@@ -186,7 +186,7 @@ void GcodeSuite::M702() {
// Show initial "wait for unload" message
TERN_(HAS_LCD_MENU, lcd_pause_show_message(PAUSE_MESSAGE_UNLOAD, PAUSE_MODE_UNLOAD_FILAMENT, target_extruder));
#if HAS_MULTI_EXTRUDER && DISABLED(PRUSA_MMU2)
#if HAS_MULTI_EXTRUDER && (HAS_PRUSA_MMU1 || !HAS_MMU)
// Change toolhead if specified
uint8_t active_extruder_before_filament_change = active_extruder;
if (active_extruder != target_extruder)
@@ -198,7 +198,7 @@ void GcodeSuite::M702() {
do_blocking_move_to_z(_MIN(current_position.z + park_point.z, Z_MAX_POS), feedRate_t(NOZZLE_PARK_Z_FEEDRATE));
// Unload filament
#if ENABLED(PRUSA_MMU2)
#if HAS_PRUSA_MMU2
mmu2.unload();
#else
#if BOTH(HAS_MULTI_EXTRUDER, FILAMENT_UNLOAD_ALL_EXTRUDERS)
@@ -227,7 +227,7 @@ void GcodeSuite::M702() {
if (park_point.z > 0)
do_blocking_move_to_z(_MAX(current_position.z - park_point.z, 0), feedRate_t(NOZZLE_PARK_Z_FEEDRATE));
#if HAS_MULTI_EXTRUDER && DISABLED(PRUSA_MMU2)
#if HAS_MULTI_EXTRUDER && (HAS_PRUSA_MMU1 || !HAS_MMU)
// Restore toolhead if it was changed
if (active_extruder_before_filament_change != active_extruder)
tool_change(active_extruder_before_filament_change, false);
+3 -3
View File
@@ -22,10 +22,10 @@
#include "../../../inc/MarlinConfigPre.h"
#if ENABLED(PRUSA_MMU2)
#if HAS_PRUSA_MMU2
#include "../../gcode.h"
#include "../../../feature/mmu2/mmu2.h"
#include "../../../feature/mmu/mmu2.h"
/**
* M403: Set filament type for MMU2
@@ -46,4 +46,4 @@ void GcodeSuite::M403() {
SERIAL_ECHO_MSG("M403 - bad arguments.");
}
#endif // PRUSA_MMU2
#endif // HAS_PRUSA_MMU2
+2 -2
View File
@@ -250,7 +250,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
* Will still block Gcodes if M511 is disabled, in which case the printer should be unlocked via LCD Menu
*/
#if ENABLED(PASSWORD_FEATURE)
if (password.is_locked && !(parser.command_letter == 'M' && parser.codenum == 511)) {
if (password.is_locked && !parser.is_command('M', 511)) {
SERIAL_ECHO_MSG(STR_PRINTER_LOCKED);
return;
}
@@ -702,7 +702,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
case 402: M402(); break; // M402: Stow probe
#endif
#if ENABLED(PRUSA_MMU2)
#if HAS_PRUSA_MMU2
case 403: M403(); break;
#endif
+4 -8
View File
@@ -181,7 +181,7 @@
* M217 - Set filament swap parameters: "M217 S<length> P<feedrate> R<feedrate>". (Requires SINGLENOZZLE)
* M218 - Set/get a tool offset: "M218 T<index> X<offset> Y<offset>". (Requires 2 or more extruders)
* M220 - Set Feedrate Percentage: "M220 S<percent>" (i.e., "FR" on the LCD)
* Use "M220 B" to back up the Feedrate Percentage and "M220 R" to restore it. (Requires PRUSA_MMU2)
* Use "M220 B" to back up the Feedrate Percentage and "M220 R" to restore it. (Requires an MMU_MODEL version 2 or 2S)
* M221 - Set Flow Percentage: "M221 S<percent>"
* M226 - Wait until a pin is in a given state: "M226 P<pin> S<state>" (Requires DIRECT_PIN_CONTROL)
* M240 - Trigger a camera to take a photograph. (Requires PHOTO_GCODE)
@@ -735,7 +735,7 @@ private:
static void M402();
#endif
TERN_(PRUSA_MMU2, static void M403());
TERN_(HAS_PRUSA_MMU2, static void M403());
#if ENABLED(FILAMENT_WIDTH_SENSOR)
static void M404();
@@ -769,12 +769,8 @@ private:
#if ENABLED(PASSWORD_FEATURE)
static void M510();
#if ENABLED(PASSWORD_UNLOCK_GCODE)
static void M511();
#endif
#if ENABLED(PASSWORD_CHANGE_GCODE)
static void M512();
#endif
TERN_(PASSWORD_UNLOCK_GCODE, static void M511());
TERN_(PASSWORD_CHANGE_GCODE, static void M512());
#endif
TERN_(SDSUPPORT, static void M524());
+2 -2
View File
@@ -39,7 +39,7 @@ static void config_prefix(PGM_P const name, PGM_P const pref=nullptr, const int8
serialprintPGM(name);
SERIAL_CHAR(':');
}
static void config_line(PGM_P const name, const float val, PGM_P const pref=nullptr, , const int8_t ind=-1) {
static void config_line(PGM_P const name, const float val, PGM_P const pref=nullptr, const int8_t ind=-1) {
config_prefix(name, pref, ind);
SERIAL_ECHOLN(val);
}
@@ -174,7 +174,7 @@ void GcodeSuite::M360() {
config_line(PSTR("NumExtruder"), EXTRUDERS);
#if EXTRUDERS
LOOP_L_N(e, EXTRUDERS) {
config_line_e(e, TERN(HAS_LINEAR_E_JERK, planner.max_e_jerk[E_INDEX_N(e)], TERN(HAS_CLASSIC_JERK, planner.max_jerk.e, DEFAULT_EJERK)), E_JERK_VAL(e));
config_line_e(e, JERK_STR, TERN(HAS_LINEAR_E_JERK, planner.max_e_jerk[E_INDEX_N(e)], TERN(HAS_CLASSIC_JERK, planner.max_jerk.e, DEFAULT_EJERK)));
config_line_e(e, PSTR("MaxSpeed"), planner.settings.max_feedrate_mm_s[E_AXIS_N(e)]);
config_line_e(e, PSTR("Acceleration"), planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(e)]);
config_line_e(e, PSTR("Diameter"), TERN(NO_VOLUMETRICS, DEFAULT_NOMINAL_FILAMENT_DIA, planner.filament_size[e]));
+11 -2
View File
@@ -25,14 +25,23 @@
#if ENABLED(TOUCH_SCREEN_CALIBRATION)
#include "../gcode.h"
#include "../../lcd/menu/menu.h"
#if ENABLED(TFT_LVGL_UI)
#include "../../lcd/extui/lib/mks_ui/draw_touch_calibration.h"
#else
#include "../../lcd/menu/menu.h"
#endif
/**
* M995: Touch screen calibration for TFT display
*/
void GcodeSuite::M995() {
ui.goto_screen(touch_screen_calibration);
#if ENABLED(TFT_LVGL_UI)
lv_draw_touch_calibration_screen();
#else
ui.goto_screen(touch_screen_calibration);
#endif
}
+3 -3
View File
@@ -45,7 +45,7 @@ char *GCodeParser::command_ptr,
*GCodeParser::string_arg,
*GCodeParser::value_ptr;
char GCodeParser::command_letter;
int GCodeParser::codenum;
uint16_t GCodeParser::codenum;
#if ENABLED(USE_GCODE_SUBCODES)
uint8_t GCodeParser::subcode;
@@ -155,7 +155,7 @@ void GCodeParser::parse(char *p) {
// Skip spaces to get the numeric part
while (*p == ' ') p++;
#if ENABLED(PRUSA_MMU2)
#if HAS_PRUSA_MMU2
if (letter == 'T') {
// check for special MMU2 T?/Tx/Tc commands
if (*p == '?' || *p == 'x' || *p == 'c') {
@@ -270,7 +270,7 @@ void GCodeParser::parse(char *p) {
// Special handling for M32 [P] !/path/to/file.g#
// The path must be the last parameter
if (param == '!' && letter == 'M' && codenum == 32) {
if (param == '!' && is_command('M', 32)) {
string_arg = p; // Name starts after '!'
char * const lb = strchr(p, '#'); // Already seen '#' as SD char (to pause buffering)
if (lb) *lb = '\0'; // Safe to mark the end of the filename
+4 -1
View File
@@ -84,7 +84,7 @@ public:
static char *command_ptr, // The command, so it can be echoed
*string_arg, // string of command line
command_letter; // G, M, or T
static int codenum; // 123
static uint16_t codenum; // 123
#if ENABLED(USE_GCODE_SUBCODES)
static uint8_t subcode; // .1
#endif
@@ -244,6 +244,9 @@ public:
static bool chain();
#endif
// Test whether the parsed command matches the input
static inline bool is_command(const char ltr, const uint16_t num) { return command_letter == ltr && codenum == num; }
// The code value pointer was set
FORCE_INLINE static bool has_value() { return !!value_ptr; }
+8 -5
View File
@@ -416,11 +416,14 @@ inline void process_stream_char(const char c, uint8_t &sis, char (&buff)[MAX_CMD
* keep sensor readings going and watchdog alive.
*/
inline bool process_line_done(uint8_t &sis, char (&buff)[MAX_CMD_SIZE], int &ind) {
sis = PS_NORMAL;
buff[ind] = 0;
if (ind) { ind = 0; return false; }
thermalManager.manage_heater();
return true;
sis = PS_NORMAL; // "Normal" Serial Input State
buff[ind] = '\0'; // Of course, I'm a Terminator.
const bool is_empty = (ind == 0); // An empty line?
if (is_empty)
thermalManager.manage_heater(); // Keep sensors satisfied
else
ind = 0; // Start a new line
return is_empty; // Inform the caller
}
/**
+53 -9
View File
@@ -495,6 +495,36 @@
#endif
#endif
/**
* Multi-Material-Unit supported models
*/
#define PRUSA_MMU1 1
#define PRUSA_MMU2 2
#define PRUSA_MMU2S 3
#define SMUFF_EMU_MMU2 12
#define SMUFF_EMU_MMU2S 13
#ifdef MMU_MODEL
#define HAS_MMU 1
#if MMU_MODEL == PRUSA_MMU1
#define HAS_PRUSA_MMU1 1
#elif MMU_MODEL % 10 == PRUSA_MMU2
#define HAS_PRUSA_MMU2 1
#elif MMU_MODEL % 10 == PRUSA_MMU2S
#define HAS_PRUSA_MMU2 1
#define HAS_PRUSA_MMU2S 1
#endif
#if MMU_MODEL >= SMUFF_EMU_MMU2
#define HAS_SMUFF 1
#endif
#endif
#undef PRUSA_MMU1
#undef PRUSA_MMU2
#undef PRUSA_MMU2S
#undef SMUFF_EMU_MMU2
#undef SMUFF_EMU_MMU2S
/**
* Extruders have some combination of stepper motors and hotends
* so we separate these concepts into the defines:
@@ -512,8 +542,6 @@
#undef SWITCHING_EXTRUDER
#undef SWITCHING_NOZZLE
#undef MIXING_EXTRUDER
#undef MK2_MULTIPLEXER
#undef PRUSA_MMU2
#undef HOTEND_IDLE_TIMEOUT
#elif EXTRUDERS > 1
#define HAS_MULTI_EXTRUDER 1
@@ -539,17 +567,17 @@
#elif ENABLED(SWITCHING_TOOLHEAD)
#define E_STEPPERS EXTRUDERS
#define E_MANUAL EXTRUDERS
#elif ENABLED(PRUSA_MMU2)
#elif HAS_PRUSA_MMU2
#define E_STEPPERS 1
#endif
// No inactive extruders with MK2_MULTIPLEXER or SWITCHING_NOZZLE
#if EITHER(MK2_MULTIPLEXER, SWITCHING_NOZZLE)
// No inactive extruders with SWITCHING_NOZZLE or Průša MMU1
#if ENABLED(SWITCHING_NOZZLE) || HAS_PRUSA_MMU1
#undef DISABLE_INACTIVE_EXTRUDER
#endif
// Průša MK2 Multiplexer and MMU 2.0 force SINGLENOZZLE
#if EITHER(MK2_MULTIPLEXER, PRUSA_MMU2)
// Průša MMU1, MMU 2.0, MMUS 2.0 and SMUFF force SINGLENOZZLE
#if HAS_MMU
#define SINGLENOZZLE
#endif
@@ -1073,8 +1101,24 @@
// This emulated DOGM has 'touch/xpt2046', not 'tft/xpt2046'
#if ENABLED(TOUCH_SCREEN) && !HAS_GRAPHICAL_TFT
#undef TOUCH_SCREEN
#undef TOUCH_SCREEN_CALIBRATION
#if !HAS_TFT_LVGL_UI
#define HAS_TOUCH_XPT2046 1
#define HAS_TOUCH_BUTTONS 1
#endif
#endif
// XPT2046_** Compatibility
#if !(defined(TOUCH_CALIBRATION_X) || defined(TOUCH_CALIBRATION_Y) || defined(TOUCH_OFFSET_X) || defined(TOUCH_OFFSET_Y) || defined(TOUCH_ORIENTATION))
#if defined(XPT2046_X_CALIBRATION) && defined(XPT2046_Y_CALIBRATION) && defined(XPT2046_X_OFFSET) && defined(XPT2046_Y_OFFSET)
#define TOUCH_CALIBRATION_X XPT2046_X_CALIBRATION
#define TOUCH_CALIBRATION_Y XPT2046_Y_CALIBRATION
#define TOUCH_OFFSET_X XPT2046_X_OFFSET
#define TOUCH_OFFSET_Y XPT2046_Y_OFFSET
#define TOUCH_ORIENTATION TOUCH_LANDSCAPE
#else
#define TOUCH_CALIBRATION_X 0
#define TOUCH_CALIBRATION_Y 0
#define TOUCH_OFFSET_X 0
#define TOUCH_OFFSET_Y 0
#define TOUCH_ORIENTATION TOUCH_ORIENTATION_NONE
#endif
#endif
+1 -1
View File
@@ -364,7 +364,7 @@
// Touch Screen or "Touch Buttons" need XPT2046 pins
// but they use different components
#if EITHER(HAS_TFT_XPT2046, HAS_TOUCH_XPT2046)
#if EITHER(HAS_TFT_XPT2046, HAS_TOUCH_BUTTONS)
#define NEED_TOUCH_PINS 1
#endif
+30 -4
View File
@@ -100,6 +100,7 @@
#define _Y_HALF_BED ((Y_BED_SIZE) / 2)
#define X_CENTER TERN(BED_CENTER_AT_0_0, 0, _X_HALF_BED)
#define Y_CENTER TERN(BED_CENTER_AT_0_0, 0, _Y_HALF_BED)
#define XY_CENTER { X_CENTER, Y_CENTER }
// Get the linear boundaries of the bed
#define X_MIN_BED (X_CENTER - _X_HALF_BED)
@@ -359,7 +360,7 @@
*/
#if ENABLED(SDSUPPORT)
#if SD_CONNECTION_IS(ONBOARD) && DISABLED(NO_SD_HOST_DRIVE) && !defined(ARDUINO_GRAND_CENTRAL_M4)
#if HAS_SD_HOST_DRIVE && SD_CONNECTION_IS(ONBOARD)
//
// The external SD card is not used. Hardware SPI is used to access the card.
// When sharing the SD card with a PC we want the menu options to
@@ -380,7 +381,6 @@
#define SD_DETECT_STATE LOW
#endif
#endif
#endif
#if ANY(HAS_GRAPHICAL_TFT, LCD_USE_DMA_FSMC, HAS_FSMC_GRAPHICAL_TFT, HAS_SPI_GRAPHICAL_TFT) || !PIN_EXISTS(SD_DETECT)
@@ -458,6 +458,8 @@
#define HEATER_0_USES_THERMISTOR 1
#if TEMP_SENSOR_0 == 1000
#define HEATER_0_USER_THERMISTOR 1
#elif TEMP_SENSOR_0 == 998 || TEMP_SENSOR_0 == 999
#define HEATER_0_DUMMY_THERMISTOR 1
#endif
#else
#undef HEATER_0_MINTEMP
@@ -496,6 +498,8 @@
#define HEATER_1_USES_THERMISTOR 1
#if TEMP_SENSOR_1 == 1000
#define HEATER_1_USER_THERMISTOR 1
#elif TEMP_SENSOR_1 == 998 || TEMP_SENSOR_1 == 999
#define HEATER_1_DUMMY_THERMISTOR 1
#endif
#else
#undef HEATER_1_MINTEMP
@@ -515,6 +519,8 @@
#define HEATER_2_USES_THERMISTOR 1
#if TEMP_SENSOR_2 == 1000
#define HEATER_2_USER_THERMISTOR 1
#elif TEMP_SENSOR_2 == 998 || TEMP_SENSOR_2 == 999
#define HEATER_2_DUMMY_THERMISTOR 1
#endif
#else
#undef HEATER_2_MINTEMP
@@ -534,6 +540,8 @@
#define HEATER_3_USES_THERMISTOR 1
#if TEMP_SENSOR_3 == 1000
#define HEATER_3_USER_THERMISTOR 1
#elif TEMP_SENSOR_3 == 998 || TEMP_SENSOR_3 == 999
#define HEATER_3_DUMMY_THERMISTOR 1
#endif
#else
#undef HEATER_3_MINTEMP
@@ -553,6 +561,8 @@
#define HEATER_4_USES_THERMISTOR 1
#if TEMP_SENSOR_4 == 1000
#define HEATER_4_USER_THERMISTOR 1
#elif TEMP_SENSOR_4 == 998 || TEMP_SENSOR_4 == 999
#define HEATER_4_DUMMY_THERMISTOR 1
#endif
#else
#undef HEATER_4_MINTEMP
@@ -572,6 +582,8 @@
#define HEATER_5_USES_THERMISTOR 1
#if TEMP_SENSOR_5 == 1000
#define HEATER_5_USER_THERMISTOR 1
#elif TEMP_SENSOR_5 == 998 || TEMP_SENSOR_5 == 999
#define HEATER_5_DUMMY_THERMISTOR 1
#endif
#else
#undef HEATER_5_MINTEMP
@@ -591,6 +603,8 @@
#define HEATER_6_USES_THERMISTOR 1
#if TEMP_SENSOR_6 == 1000
#define HEATER_6_USER_THERMISTOR 1
#elif TEMP_SENSOR_6 == 998 || TEMP_SENSOR_6 == 999
#define HEATER_6_DUMMY_THERMISTOR 1
#endif
#else
#undef HEATER_6_MINTEMP
@@ -610,6 +624,8 @@
#define HEATER_7_USES_THERMISTOR 1
#if TEMP_SENSOR_7 == 1000
#define HEATER_7_USER_THERMISTOR 1
#elif TEMP_SENSOR_7 == 998 || TEMP_SENSOR_7 == 999
#define HEATER_7_DUMMY_THERMISTOR 1
#endif
#else
#undef HEATER_7_MINTEMP
@@ -629,6 +645,8 @@
#define HEATER_BED_USES_THERMISTOR 1
#if TEMP_SENSOR_BED == 1000
#define HEATER_BED_USER_THERMISTOR 1
#elif TEMP_SENSOR_BED == 998 || TEMP_SENSOR_BED == 999
#define HEATER_BED_DUMMY_THERMISTOR 1
#endif
#else
#undef BED_MINTEMP
@@ -648,6 +666,8 @@
#define HEATER_CHAMBER_USES_THERMISTOR 1
#if TEMP_SENSOR_CHAMBER == 1000
#define HEATER_CHAMBER_USER_THERMISTOR 1
#elif TEMP_SENSOR_CHAMBER == 998 || TEMP_SENSOR_CHAMBER == 999
#define HEATER_CHAMBER_DUMMY_THERMISTOR 1
#endif
#else
#undef CHAMBER_MINTEMP
@@ -667,6 +687,8 @@
#define HEATER_PROBE_USES_THERMISTOR 1
#if TEMP_SENSOR_PROBE == 1000
#define HEATER_PROBE_USER_THERMISTOR 1
#elif TEMP_SENSOR_PROBE == 998 || TEMP_SENSOR_PROBE == 999
#define HEATER_PROBE_DUMMY_THERMISTOR 1
#endif
#endif
@@ -1754,7 +1776,7 @@
//
// ADC Temp Sensors (Thermistor or Thermocouple with amplifier ADC interface)
//
#define HAS_ADC_TEST(P) (PIN_EXISTS(TEMP_##P) && TEMP_SENSOR_##P != 0 && DISABLED(HEATER_##P##_USES_MAX6675))
#define HAS_ADC_TEST(P) (PIN_EXISTS(TEMP_##P) && TEMP_SENSOR_##P != 0 && NONE(HEATER_##P##_USES_MAX6675, HEATER_##P##_DUMMY_THERMISTOR))
#if HAS_ADC_TEST(0)
#define HAS_TEMP_ADC_0 1
#endif
@@ -1789,7 +1811,7 @@
#define HAS_TEMP_ADC_CHAMBER 1
#endif
#if HAS_HOTEND && EITHER(HAS_TEMP_ADC_0, HEATER_0_USES_MAX6675)
#if HAS_HOTEND && ANY(HAS_TEMP_ADC_0, HEATER_0_USES_MAX6675, HEATER_0_DUMMY_THERMISTOR)
#define HAS_TEMP_HOTEND 1
#endif
#define HAS_TEMP_BED HAS_TEMP_ADC_BED
@@ -2582,6 +2604,10 @@
#endif
#endif
#if !defined(MANUAL_PROBE_START_Z) && defined(Z_CLEARANCE_BETWEEN_PROBES)
#define MANUAL_PROBE_START_Z Z_CLEARANCE_BETWEEN_PROBES
#endif
#ifndef __SAM3X8E__ //todo: hal: broken hal encapsulation
#undef UI_VOLTAGE_LEVEL
#undef RADDS_DISPLAY
+99 -79
View File
@@ -804,7 +804,11 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
#if !PIN_EXISTS(FIL_RUNOUT)
#error "FILAMENT_RUNOUT_SENSOR requires FIL_RUNOUT_PIN."
#elif NUM_RUNOUT_SENSORS > E_STEPPERS
#error "NUM_RUNOUT_SENSORS cannot exceed the number of E steppers."
#if HAS_PRUSA_MMU2
#error "NUM_RUNOUT_SENSORS must be 1 with MMU2 / MMU2S."
#else
#error "NUM_RUNOUT_SENSORS cannot exceed the number of E steppers."
#endif
#elif NUM_RUNOUT_SENSORS >= 2 && !PIN_EXISTS(FIL_RUNOUT2)
#error "FIL_RUNOUT2_PIN is required with NUM_RUNOUT_SENSORS >= 2."
#elif NUM_RUNOUT_SENSORS >= 3 && !PIN_EXISTS(FIL_RUNOUT3)
@@ -867,6 +871,42 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
#error "INDIVIDUAL_AXIS_HOMING_MENU is incompatible with DELTA kinematics."
#endif
/**
* Sanity checking for all Průša MMU
*/
#ifdef SNMM
#error "SNMM is obsolete. Define MMU_MODEL as PRUSA_MMU1 instead."
#elif ENABLED(MK2_MULTIPLEXER)
#error "MK2_MULTIPLEXER is obsolete. Define MMU_MODEL as PRUSA_MMU1 instead."
#elif ENABLED(PRUSA_MMU2)
#error "PRUSA_MMU2 is obsolete. Define MMU_MODEL as PRUSA_MMU2 instead."
#elif ENABLED(PRUSA_MMU2_S_MODE)
#error "PRUSA_MMU2_S_MODE is obsolete. Define MMU_MODEL as PRUSA_MMU2S instead."
#endif
/**
* Multi-Material-Unit 2 / SMUFF requirements
*/
#if HAS_PRUSA_MMU2
#if EXTRUDERS != 5
#undef SINGLENOZZLE
#error "PRUSA_MMU2(S) requires exactly 5 EXTRUDERS. Please update your Configuration."
#elif DISABLED(NOZZLE_PARK_FEATURE)
#error "PRUSA_MMU2(S) requires NOZZLE_PARK_FEATURE. Enable it to continue."
#elif HAS_PRUSA_MMU2S && DISABLED(FILAMENT_RUNOUT_SENSOR)
#error "PRUSA_MMU2S requires FILAMENT_RUNOUT_SENSOR. Enable it to continue."
#elif ENABLED(MMU_EXTRUDER_SENSOR) && DISABLED(FILAMENT_RUNOUT_SENSOR)
#error "MMU_EXTRUDER_SENSOR requires FILAMENT_RUNOUT_SENSOR. Enable it to continue."
#elif ENABLED(MMU_EXTRUDER_SENSOR) && !HAS_LCD_MENU
#error "MMU_EXTRUDER_SENSOR requires an LCD supporting MarlinUI to be enabled."
#elif DISABLED(ADVANCED_PAUSE_FEATURE)
static_assert(nullptr == strstr(MMU2_FILAMENT_RUNOUT_SCRIPT, "M600"), "ADVANCED_PAUSE_FEATURE is required to use M600 with PRUSA_MMU2(S) / SMUFF_EMU_MMU2(S).");
#endif
#endif
#if HAS_SMUFF && EXTRUDERS > 12
#error "Too many extruders for SMUFF_EMU_MMU2(S). (12 maximum)."
#endif
/**
* Options only for EXTRUDERS > 1
*/
@@ -902,17 +942,14 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
#error "TOOLCHANGE_ZRAISE required for EXTRUDERS > 1."
#endif
#elif ENABLED(MK2_MULTIPLEXER)
#error "MK2_MULTIPLEXER requires 2 or more EXTRUDERS."
#elif ENABLED(SINGLENOZZLE)
#error "SINGLENOZZLE requires 2 or more EXTRUDERS."
#endif
#elif HAS_PRUSA_MMU1 || HAS_SMUFF
#error "Multi-Material-Unit requires 2 or more EXTRUDERS."
#elif ENABLED(SINGLENOZZLE)
#error "SINGLENOZZLE requires 2 or more EXTRUDERS."
/**
* Sanity checking for the Průša MK2 Multiplexer
*/
#ifdef SNMM
#error "SNMM is now MK2_MULTIPLEXER."
#endif
/**
@@ -1638,7 +1675,7 @@ static_assert(hbm[Z_AXIS] >= 0, "HOMING_BUMP_MM.Z must be greater than or equal
*/
#if HEATER_0_USES_MAX6675 && !PIN_EXISTS(MAX6675_SS)
#error "MAX6675_SS_PIN (required for TEMP_SENSOR_0) not defined for this board."
#elif HAS_HOTEND && !HAS_TEMP_HOTEND
#elif HAS_HOTEND && !HAS_TEMP_HOTEND && !HEATER_0_DUMMY_THERMISTOR
#error "TEMP_0_PIN (required for TEMP_SENSOR_0) not defined for this board."
#elif EITHER(HAS_MULTI_HOTEND, HEATERS_PARALLEL) && !HAS_HEATER_1
#error "HEATER_1_PIN is not defined. TEMP_SENSOR_1 might not be set, or the board (not EEB / EEF?) doesn't define a pin."
@@ -1649,7 +1686,7 @@ static_assert(hbm[Z_AXIS] >= 0, "HOMING_BUMP_MM.Z must be greater than or equal
#error "MAX6675_SS2_PIN (required for TEMP_SENSOR_1) not defined for this board."
#elif TEMP_SENSOR_1 == 0
#error "TEMP_SENSOR_1 is required with 2 or more HOTENDS."
#elif !ANY_PIN(TEMP_1, MAX6675_SS2)
#elif !ANY_PIN(TEMP_1, MAX6675_SS2) && !HEATER_1_DUMMY_THERMISTOR
#error "TEMP_1_PIN not defined for this board."
#elif ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
#error "HOTENDS must be 1 with TEMP_SENSOR_1_AS_REDUNDANT."
@@ -1659,7 +1696,7 @@ static_assert(hbm[Z_AXIS] >= 0, "HOMING_BUMP_MM.Z must be greater than or equal
#error "TEMP_SENSOR_2 is required with 3 or more HOTENDS."
#elif !HAS_HEATER_2
#error "HEATER_2_PIN not defined for this board."
#elif !PIN_EXISTS(TEMP_2)
#elif !PIN_EXISTS(TEMP_2) && !HEATER_2_DUMMY_THERMISTOR
#error "TEMP_2_PIN not defined for this board."
#endif
#if HOTENDS > 3
@@ -1667,7 +1704,7 @@ static_assert(hbm[Z_AXIS] >= 0, "HOMING_BUMP_MM.Z must be greater than or equal
#error "TEMP_SENSOR_3 is required with 4 or more HOTENDS."
#elif !HAS_HEATER_3
#error "HEATER_3_PIN not defined for this board."
#elif !PIN_EXISTS(TEMP_3)
#elif !PIN_EXISTS(TEMP_3) && !HEATER_3_DUMMY_THERMISTOR
#error "TEMP_3_PIN not defined for this board."
#endif
#if HOTENDS > 4
@@ -1675,7 +1712,7 @@ static_assert(hbm[Z_AXIS] >= 0, "HOMING_BUMP_MM.Z must be greater than or equal
#error "TEMP_SENSOR_4 is required with 5 or more HOTENDS."
#elif !HAS_HEATER_4
#error "HEATER_4_PIN not defined for this board."
#elif !PIN_EXISTS(TEMP_4)
#elif !PIN_EXISTS(TEMP_4) && !HEATER_4_DUMMY_THERMISTOR
#error "TEMP_4_PIN not defined for this board."
#endif
#if HOTENDS > 5
@@ -1683,7 +1720,7 @@ static_assert(hbm[Z_AXIS] >= 0, "HOMING_BUMP_MM.Z must be greater than or equal
#error "TEMP_SENSOR_5 is required with 6 HOTENDS."
#elif !HAS_HEATER_5
#error "HEATER_5_PIN not defined for this board."
#elif !PIN_EXISTS(TEMP_5)
#elif !PIN_EXISTS(TEMP_5) && !HEATER_5_DUMMY_THERMISTOR
#error "TEMP_5_PIN not defined for this board."
#endif
#if HOTENDS > 6
@@ -1691,7 +1728,7 @@ static_assert(hbm[Z_AXIS] >= 0, "HOMING_BUMP_MM.Z must be greater than or equal
#error "TEMP_SENSOR_6 is required with 6 HOTENDS."
#elif !HAS_HEATER_6
#error "HEATER_6_PIN not defined for this board."
#elif !PIN_EXISTS(TEMP_6)
#elif !PIN_EXISTS(TEMP_6) && !HEATER_6_DUMMY_THERMISTOR
#error "TEMP_6_PIN not defined for this board."
#endif
#if HOTENDS > 7
@@ -1699,7 +1736,7 @@ static_assert(hbm[Z_AXIS] >= 0, "HOMING_BUMP_MM.Z must be greater than or equal
#error "TEMP_SENSOR_7 is required with 7 HOTENDS."
#elif !HAS_HEATER_7
#error "HEATER_7_PIN not defined for this board."
#elif !PIN_EXISTS(TEMP_7)
#elif !PIN_EXISTS(TEMP_7) && !HEATER_7_DUMMY_THERMISTOR
#error "TEMP_7_PIN not defined for this board."
#endif
#elif TEMP_SENSOR_7 != 0
@@ -1870,48 +1907,46 @@ static_assert(hbm[Z_AXIS] >= 0, "HOMING_BUMP_MM.Z must be greater than or equal
/**
* Test Extruder Stepper Pins
*/
#if DISABLED(MK2_MULTIPLEXER) // MK2_MULTIPLEXER uses E0 stepper only
#if E_STEPPERS
#if !(PINS_EXIST(E0_STEP, E0_DIR) && HAS_E0_ENABLE)
#error "E0_STEP_PIN, E0_DIR_PIN, or E0_ENABLE_PIN not defined for this board."
#if E_STEPPERS
#if !(PINS_EXIST(E0_STEP, E0_DIR) && HAS_E0_ENABLE)
#error "E0_STEP_PIN, E0_DIR_PIN, or E0_ENABLE_PIN not defined for this board."
#endif
#if E_STEPPERS > 1
#if !(PINS_EXIST(E1_STEP, E1_DIR) && HAS_E1_ENABLE)
#error "E1_STEP_PIN, E1_DIR_PIN, or E1_ENABLE_PIN not defined for this board."
#endif
#if E_STEPPERS > 1
#if !(PINS_EXIST(E1_STEP, E1_DIR) && HAS_E1_ENABLE)
#error "E1_STEP_PIN, E1_DIR_PIN, or E1_ENABLE_PIN not defined for this board."
#if E_STEPPERS > 2
#if !(PINS_EXIST(E2_STEP, E2_DIR) && HAS_E2_ENABLE)
#error "E2_STEP_PIN, E2_DIR_PIN, or E2_ENABLE_PIN not defined for this board."
#endif
#if E_STEPPERS > 2
#if !(PINS_EXIST(E2_STEP, E2_DIR) && HAS_E2_ENABLE)
#error "E2_STEP_PIN, E2_DIR_PIN, or E2_ENABLE_PIN not defined for this board."
#if E_STEPPERS > 3
#if !(PINS_EXIST(E3_STEP, E3_DIR) && HAS_E3_ENABLE)
#error "E3_STEP_PIN, E3_DIR_PIN, or E3_ENABLE_PIN not defined for this board."
#endif
#if E_STEPPERS > 3
#if !(PINS_EXIST(E3_STEP, E3_DIR) && HAS_E3_ENABLE)
#error "E3_STEP_PIN, E3_DIR_PIN, or E3_ENABLE_PIN not defined for this board."
#if E_STEPPERS > 4
#if !(PINS_EXIST(E4_STEP, E4_DIR) && HAS_E4_ENABLE)
#error "E4_STEP_PIN, E4_DIR_PIN, or E4_ENABLE_PIN not defined for this board."
#endif
#if E_STEPPERS > 4
#if !(PINS_EXIST(E4_STEP, E4_DIR) && HAS_E4_ENABLE)
#error "E4_STEP_PIN, E4_DIR_PIN, or E4_ENABLE_PIN not defined for this board."
#if E_STEPPERS > 5
#if !(PINS_EXIST(E5_STEP, E5_DIR) && HAS_E5_ENABLE)
#error "E5_STEP_PIN, E5_DIR_PIN, or E5_ENABLE_PIN not defined for this board."
#endif
#if E_STEPPERS > 5
#if !(PINS_EXIST(E5_STEP, E5_DIR) && HAS_E5_ENABLE)
#error "E5_STEP_PIN, E5_DIR_PIN, or E5_ENABLE_PIN not defined for this board."
#if E_STEPPERS > 6
#if !(PINS_EXIST(E6_STEP, E6_DIR) && HAS_E6_ENABLE)
#error "E6_STEP_PIN, E6_DIR_PIN, or E6_ENABLE_PIN not defined for this board."
#endif
#if E_STEPPERS > 6
#if !(PINS_EXIST(E6_STEP, E6_DIR) && HAS_E6_ENABLE)
#error "E6_STEP_PIN, E6_DIR_PIN, or E6_ENABLE_PIN not defined for this board."
#if E_STEPPERS > 7
#if !(PINS_EXIST(E7_STEP, E7_DIR) && HAS_E7_ENABLE)
#error "E7_STEP_PIN, E7_DIR_PIN, or E7_ENABLE_PIN not defined for this board."
#endif
#if E_STEPPERS > 7
#if !(PINS_EXIST(E7_STEP, E7_DIR) && HAS_E7_ENABLE)
#error "E7_STEP_PIN, E7_DIR_PIN, or E7_ENABLE_PIN not defined for this board."
#endif
#endif // E_STEPPERS > 7
#endif // E_STEPPERS > 6
#endif // E_STEPPERS > 5
#endif // E_STEPPERS > 4
#endif // E_STEPPERS > 3
#endif // E_STEPPERS > 2
#endif // E_STEPPERS > 1
#endif // E_STEPPERS
#endif
#endif // E_STEPPERS > 7
#endif // E_STEPPERS > 6
#endif // E_STEPPERS > 5
#endif // E_STEPPERS > 4
#endif // E_STEPPERS > 3
#endif // E_STEPPERS > 2
#endif // E_STEPPERS > 1
#endif // E_STEPPERS
/**
* Endstop Tests
@@ -2759,6 +2794,8 @@ static_assert( _ARR_TEST(3,0) && _ARR_TEST(3,1) && _ARR_TEST(3,2)
#if !BLOCK_BUFFER_SIZE || !IS_POWER_OF_2(BLOCK_BUFFER_SIZE)
#error "BLOCK_BUFFER_SIZE must be a power of 2."
#elif BLOCK_BUFFER_SIZE > 64
#error "A very large BLOCK_BUFFER_SIZE is not needed and takes longer to drain the buffer on pause / cancel."
#endif
#if ENABLED(LED_CONTROL_MENU) && !IS_ULTIPANEL
@@ -2975,23 +3012,6 @@ static_assert( _ARR_TEST(3,0) && _ARR_TEST(3,1) && _ARR_TEST(3,2)
#endif
#endif
/**
* Průša MMU2 requirements
*/
#if ENABLED(PRUSA_MMU2)
#if EXTRUDERS != 5
#error "PRUSA_MMU2 requires EXTRUDERS = 5."
#elif DISABLED(NOZZLE_PARK_FEATURE)
#error "PRUSA_MMU2 requires NOZZLE_PARK_FEATURE. Enable it to continue."
#elif EITHER(PRUSA_MMU2_S_MODE, MMU_EXTRUDER_SENSOR) && DISABLED(FILAMENT_RUNOUT_SENSOR)
#error "PRUSA_MMU2_S_MODE or MMU_EXTRUDER_SENSOR requires FILAMENT_RUNOUT_SENSOR. Enable it to continue."
#elif BOTH(PRUSA_MMU2_S_MODE, MMU_EXTRUDER_SENSOR)
#error "Enable only one of PRUSA_MMU2_S_MODE or MMU_EXTRUDER_SENSOR."
#elif DISABLED(ADVANCED_PAUSE_FEATURE)
static_assert(nullptr == strstr(MMU2_FILAMENT_RUNOUT_SCRIPT, "M600"), "ADVANCED_PAUSE_FEATURE is required to use M600 with PRUSA_MMU2.");
#endif
#endif
/**
* Advanced PRINTCOUNTER settings
*/
@@ -3172,17 +3192,17 @@ static_assert( _ARR_TEST(3,0) && _ARR_TEST(3,1) && _ARR_TEST(3,2)
* Touch Buttons
*/
#if ENABLED(TOUCH_SCREEN)
#ifndef XPT2046_X_CALIBRATION
#error "XPT2046_X_CALIBRATION must be defined with TOUCH_SCREEN."
#ifndef TOUCH_CALIBRATION_X
#error "TOUCH_CALIBRATION_X must be defined with TOUCH_SCREEN."
#endif
#ifndef XPT2046_Y_CALIBRATION
#error "XPT2046_Y_CALIBRATION must be defined with TOUCH_SCREEN."
#ifndef TOUCH_CALIBRATION_Y
#error "TOUCH_CALIBRATION_Y must be defined with TOUCH_SCREEN."
#endif
#ifndef XPT2046_X_OFFSET
#error "XPT2046_X_OFFSET must be defined with TOUCH_SCREEN."
#ifndef TOUCH_OFFSET_X
#error "TOUCH_OFFSET_X must be defined with TOUCH_SCREEN."
#endif
#ifndef XPT2046_Y_OFFSET
#error "XPT2046_Y_OFFSET must be defined with TOUCH_SCREEN."
#ifndef TOUCH_OFFSET_Y
#error "TOUCH_OFFSET_Y must be defined with TOUCH_SCREEN."
#endif
#endif
+1 -1
View File
@@ -42,7 +42,7 @@
* version was tagged.
*/
#ifndef STRING_DISTRIBUTION_DATE
#define STRING_DISTRIBUTION_DATE "2020-11-14"
#define STRING_DISTRIBUTION_DATE "2020-11-21"
#endif
/**
+38 -34
View File
@@ -707,6 +707,35 @@ void MarlinUI::draw_status_message(const bool blink) {
* |01234567890123456789|
*/
inline uint8_t draw_elapsed_or_remaining_time(uint8_t timepos, const bool blink) {
char buffer[14];
#if ENABLED(SHOW_REMAINING_TIME)
const bool show_remain = TERN1(ROTATE_PROGRESS_DISPLAY, blink) && (printingIsActive() || marlin_state == MF_SD_COMPLETE);
if (show_remain) {
#if ENABLED(USE_M73_REMAINING_TIME)
duration_t remaining = get_remaining_time();
#else
uint8_t progress = ui.get_progress_percent();
uint32_t elapsed = print_job_timer.duration();
duration_t remaining = (progress > 0) ? ((elapsed * 25600 / progress) >> 8) - elapsed : 0;
#endif
timepos -= remaining.toDigital(buffer);
lcd_put_wchar(timepos, 2, 'R');
}
#else
constexpr bool show_remain = false;
#endif
if (!show_remain) {
duration_t elapsed = print_job_timer.duration();
timepos -= elapsed.toDigital(buffer);
lcd_put_wchar(timepos, 2, LCD_STR_CLOCK[0]);
}
lcd_put_u8str(buffer);
return timepos;
}
void MarlinUI::draw_status_screen() {
const bool blink = get_blink();
@@ -845,33 +874,7 @@ void MarlinUI::draw_status_screen() {
lcd_put_u8str(i16tostr3rj(feedrate_percentage));
lcd_put_wchar('%');
char buffer[14];
uint8_t timepos = 0;
#if ENABLED(SHOW_REMAINING_TIME)
const bool show_remain = TERN1(ROTATE_PROGRESS_DISPLAY, blink) && (printingIsActive() || marlin_state == MF_SD_COMPLETE);
if (show_remain) {
#if ENABLED(USE_M73_REMAINING_TIME)
duration_t remaining = get_remaining_time();
#else
uint8_t progress = get_progress_percent();
uint32_t elapsed = print_job_timer.duration();
duration_t remaining = (progress > 0) ? ((elapsed * 25600 / progress) >> 8) - elapsed : 0;
#endif
const uint8_t len = remaining.toDigital(buffer);
timepos = LCD_WIDTH - 1 - len;
lcd_put_wchar(timepos, 2, 'R');
}
#else
constexpr bool show_remain = false;
#endif
if (!show_remain) {
duration_t elapsed = print_job_timer.duration();
const uint8_t len = elapsed.toDigital(buffer);
timepos = LCD_WIDTH - 1 - len;
lcd_put_wchar(timepos, 2, LCD_STR_CLOCK[0]);
}
lcd_put_u8str(buffer);
const uint8_t timepos = draw_elapsed_or_remaining_time(LCD_WIDTH - 1, blink);
#if LCD_WIDTH >= 20
lcd_moveto(timepos - 7, 2);
@@ -955,7 +958,7 @@ void MarlinUI::draw_status_screen() {
#elif HAS_MULTI_HOTEND && HAS_HEATED_BED
_draw_bed_status(blink);
#elif HAS_PRINT_PROGRESS
#define DREW_PRINT_PROGRESS
#define DREW_PRINT_PROGRESS 1
_draw_print_progress();
#endif
@@ -963,14 +966,15 @@ void MarlinUI::draw_status_screen() {
// Elapsed Time or SD Percent
//
lcd_moveto(LCD_WIDTH - 9, 2);
#if HAS_PRINT_PROGRESS && !defined(DREW_PRINT_PROGRESS)
#if HAS_PRINT_PROGRESS && !DREW_PRINT_PROGRESS
_draw_print_progress();
#else
duration_t elapsed = print_job_timer.duration();
char buffer[14];
(void)elapsed.toDigital(buffer);
lcd_put_wchar(LCD_STR_CLOCK[0]);
lcd_put_u8str(buffer);
(void)draw_elapsed_or_remaining_time(LCD_WIDTH - 4, blink);
#endif
#endif // LCD_INFO_SCREEN_STYLE 1
+8 -8
View File
@@ -204,7 +204,7 @@ void TFTGLCD::print_line() {
#endif
}
void TFTGLCD::print_screen(){
void TFTGLCD::print_screen() {
if (!PanelDetected) return;
framebuffer[FBSIZE - 2] = picBits & PIC_MASK;
framebuffer[FBSIZE - 1] = ledBits;
@@ -675,8 +675,8 @@ void MarlinUI::draw_status_screen() {
//
lcd.setCursor(0, 0);
_draw_axis_value(X_AXIS, ftostr4sign(LOGICAL_X_POSITION(current_position[X_AXIS])), blink); lcd.write(' ');
_draw_axis_value(Y_AXIS, ftostr4sign(LOGICAL_Y_POSITION(current_position[Y_AXIS])), blink); lcd.write(' ');
_draw_axis_value(X_AXIS, ftostr4sign(LOGICAL_X_POSITION(current_position[X_AXIS])), blink); lcd.write(' ');
_draw_axis_value(Y_AXIS, ftostr4sign(LOGICAL_Y_POSITION(current_position[Y_AXIS])), blink); lcd.write(' ');
_draw_axis_value(Z_AXIS, ftostr52sp(LOGICAL_Z_POSITION(current_position[Z_AXIS])), blink);
#if HAS_LEVELING && !HAS_HEATED_BED
@@ -700,7 +700,7 @@ void MarlinUI::draw_status_screen() {
uint8_t len = elapsed.toDigital(buffer);
lcd.setCursor((LCD_WIDTH - 1) - len, 1);
lcd.write(0x07); lcd.print(buffer); // LCD_CLOCK_CHAR
lcd.write(LCD_STR_CLOCK[0]); lcd.print(buffer);
//
// Line 3 - progressbar
@@ -807,13 +807,13 @@ void MarlinUI::draw_status_screen() {
void MarlinUI::draw_hotend_status(const uint8_t row, const uint8_t extruder) {
if (!PanelDetected) return;
lcd.setCursor((LCD_WIDTH - 14) / 2, row + 1);
lcd.write(0x02); lcd_put_u8str_P(" E"); lcd.write('1' + extruder); lcd.write(' ');
lcd.print(i16tostr3rj(thermalManager.degHotend(extruder))); lcd.write(0x01); lcd.write('/');
lcd.print(i16tostr3rj(thermalManager.degTargetHotend(extruder))); lcd.write(0x01);
lcd.write(LCD_STR_THERMOMETER[0]); lcd_put_u8str_P(PSTR(" E")); lcd.write('1' + extruder); lcd.write(' ');
lcd.print(i16tostr3rj(thermalManager.degHotend(extruder))); lcd.write(LCD_STR_DEGREE[0]); lcd.write('/');
lcd.print(i16tostr3rj(thermalManager.degTargetHotend(extruder))); lcd.write(LCD_STR_DEGREE[0]);
lcd.print_line();
}
#endif // ADVANCED_PAUSE_FEATURE
#endif
// Draw a static item with no left-right margin required. Centered by default.
void MenuItem_static::draw(const uint8_t row, PGM_P const pstr, const uint8_t style/*=SS_DEFAULT*/, const char * const valstr/*=nullptr*/) {
@@ -75,6 +75,11 @@ TFT_IO tftio;
#include "../touch/touch_buttons.h"
#if ENABLED(TOUCH_SCREEN_CALIBRATION)
#include "../tft_io/touch_calibration.h"
#include "../marlinui.h"
#endif
#define X_HI (UPSCALE(TFT_PIXEL_OFFSET_X, WIDTH) - 1)
#define Y_HI (UPSCALE(TFT_PIXEL_OFFSET_Y, HEIGHT) - 1)
@@ -129,7 +134,7 @@ static void setWindow(u8g_t *u8g, u8g_dev_t *dev, uint16_t Xmin, uint16_t Ymin,
tftio.set_window(Xmin, Ymin, Xmax, Ymax);
}
#if HAS_TOUCH_XPT2046
#if HAS_TOUCH_BUTTONS
static const uint8_t buttonD[] = {
B01111111,B11111111,B11111111,B11111110,
@@ -302,7 +307,7 @@ static void setWindow(u8g_t *u8g, u8g_dev_t *dev, uint16_t Xmin, uint16_t Ymin,
}
}
#endif // HAS_TOUCH_XPT2046
#endif // HAS_TOUCH_BUTTONS
// Used to fill RGB565 (16bits) background
inline void memset2(const void *ptr, uint16_t fill, size_t cnt) {
@@ -313,6 +318,27 @@ inline void memset2(const void *ptr, uint16_t fill, size_t cnt) {
static bool preinit = true;
static uint8_t page;
#if HAS_TOUCH_BUTTONS
static bool redrawTouchButtons = true;
static void drawTouchButtons(u8g_t *u8g, u8g_dev_t *dev) {
if (!redrawTouchButtons) return;
redrawTouchButtons = false;
// Bottom buttons
setWindow(u8g, dev, BUTTOND_X_LO, BUTTON_Y_LO, BUTTOND_X_HI, BUTTON_Y_HI);
drawImage(buttonD, u8g, dev, BUTTON_DRAW_WIDTH, BUTTON_DRAW_HEIGHT, TFT_BTCANCEL_COLOR);
setWindow(u8g, dev, BUTTONA_X_LO, BUTTON_Y_LO, BUTTONA_X_HI, BUTTON_Y_HI);
drawImage(buttonA, u8g, dev, BUTTON_DRAW_WIDTH, BUTTON_DRAW_HEIGHT, TFT_BTARROWS_COLOR);
setWindow(u8g, dev, BUTTONB_X_LO, BUTTON_Y_LO, BUTTONB_X_HI, BUTTON_Y_HI);
drawImage(buttonB, u8g, dev, BUTTON_DRAW_WIDTH, BUTTON_DRAW_HEIGHT, TFT_BTARROWS_COLOR);
setWindow(u8g, dev, BUTTONC_X_LO, BUTTON_Y_LO, BUTTONC_X_HI, BUTTON_Y_HI);
drawImage(buttonC, u8g, dev, BUTTON_DRAW_WIDTH, BUTTON_DRAW_HEIGHT, TFT_BTOKMENU_COLOR);
}
#endif // HAS_TOUCH_BUTTONS
uint8_t u8g_dev_tft_320x240_upscale_from_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg) {
u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
@@ -328,6 +354,7 @@ uint8_t u8g_dev_tft_320x240_upscale_from_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, u
dev->com_fn(u8g, U8G_COM_MSG_INIT, U8G_SPI_CLK_CYCLE_NONE, nullptr);
tftio.Init();
tftio.InitTFT();
TERN_(TOUCH_SCREEN_CALIBRATION, touch_calibration.calibration_reset());
if (preinit) {
preinit = false;
@@ -343,28 +370,13 @@ uint8_t u8g_dev_tft_320x240_upscale_from_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, u
for (uint16_t i = 0; i < (TFT_HEIGHT) * sq(GRAPHICAL_TFT_UPSCALE); i++)
u8g_WriteSequence(u8g, dev, (TFT_WIDTH) / 2, (uint8_t *)buffer);
#endif
// Bottom buttons
#if HAS_TOUCH_XPT2046
setWindow(u8g, dev, BUTTOND_X_LO, BUTTON_Y_LO, BUTTOND_X_HI, BUTTON_Y_HI);
drawImage(buttonD, u8g, dev, BUTTON_DRAW_WIDTH, BUTTON_DRAW_HEIGHT, TFT_BTCANCEL_COLOR);
setWindow(u8g, dev, BUTTONA_X_LO, BUTTON_Y_LO, BUTTONA_X_HI, BUTTON_Y_HI);
drawImage(buttonA, u8g, dev, BUTTON_DRAW_WIDTH, BUTTON_DRAW_HEIGHT, TFT_BTARROWS_COLOR);
setWindow(u8g, dev, BUTTONB_X_LO, BUTTON_Y_LO, BUTTONB_X_HI, BUTTON_Y_HI);
drawImage(buttonB, u8g, dev, BUTTON_DRAW_WIDTH, BUTTON_DRAW_HEIGHT, TFT_BTARROWS_COLOR);
setWindow(u8g, dev, BUTTONC_X_LO, BUTTON_Y_LO, BUTTONC_X_HI, BUTTON_Y_HI);
drawImage(buttonC, u8g, dev, BUTTON_DRAW_WIDTH, BUTTON_DRAW_HEIGHT, TFT_BTOKMENU_COLOR);
#endif // HAS_TOUCH_XPT2046
return 0;
case U8G_DEV_MSG_STOP: preinit = true; break;
case U8G_DEV_MSG_PAGE_FIRST:
page = 0;
TERN_(HAS_TOUCH_BUTTONS, drawTouchButtons(u8g, dev));
setWindow(u8g, dev, TFT_PIXEL_OFFSET_X, TFT_PIXEL_OFFSET_Y, X_HI, Y_HI);
break;
@@ -446,7 +458,7 @@ uint8_t u8g_com_hal_tft_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_p
case U8G_COM_MSG_WRITE_SEQ:
tftio.DataTransferBegin(DATASIZE_16BIT);
for (uint8_t i = 0; i < arg_val; i += 2)
tftio.WriteData(*(uint16_t *)(((uint32_t)arg_ptr) + i));
tftio.WriteData(*(uint16_t *)(((uintptr_t)arg_ptr) + i));
tftio.DataTransferEnd();
break;
@@ -456,4 +468,65 @@ uint8_t u8g_com_hal_tft_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_p
U8G_PB_DEV(u8g_dev_tft_320x240_upscale_from_128x64, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_tft_320x240_upscale_from_128x64_fn, U8G_COM_HAL_TFT_FN);
#if ENABLED(TOUCH_SCREEN_CALIBRATION)
static void drawCross(uint16_t x, uint16_t y, uint16_t color) {
tftio.set_window(x - 15, y, x + 15, y);
tftio.WriteMultiple(color, 31);
tftio.set_window(x, y - 15, x, y + 15);
tftio.WriteMultiple(color, 31);
}
void MarlinUI::touch_calibration_screen() {
uint16_t x, y;
calibrationState calibration_stage = touch_calibration.get_calibration_state();
if (calibration_stage == CALIBRATION_NONE) {
// start and clear screen
defer_status_screen(true);
calibration_stage = touch_calibration.calibration_start();
tftio.set_window(0, 0, (TFT_WIDTH) - 1, (TFT_HEIGHT) - 1);
tftio.WriteMultiple(TFT_MARLINBG_COLOR, uint32_t(TFT_WIDTH) * (TFT_HEIGHT));
}
else {
// clear last cross
x = touch_calibration.calibration_points[_MIN(calibration_stage - 1, CALIBRATION_BOTTOM_RIGHT)].x;
y = touch_calibration.calibration_points[_MIN(calibration_stage - 1, CALIBRATION_BOTTOM_RIGHT)].y;
drawCross(x, y, TFT_MARLINBG_COLOR);
}
const char *str = nullptr;
if (calibration_stage < CALIBRATION_SUCCESS) {
// handle current state
switch (calibration_stage) {
case CALIBRATION_TOP_LEFT: str = GET_TEXT(MSG_TOP_LEFT); break;
case CALIBRATION_BOTTOM_LEFT: str = GET_TEXT(MSG_BOTTOM_LEFT); break;
case CALIBRATION_TOP_RIGHT: str = GET_TEXT(MSG_TOP_RIGHT); break;
case CALIBRATION_BOTTOM_RIGHT: str = GET_TEXT(MSG_BOTTOM_RIGHT); break;
default: break;
}
x = touch_calibration.calibration_points[calibration_stage].x;
y = touch_calibration.calibration_points[calibration_stage].y;
drawCross(x, y, TFT_MARLINUI_COLOR);
}
else {
// end calibration
str = calibration_stage == CALIBRATION_SUCCESS ? GET_TEXT(MSG_CALIBRATION_COMPLETED) : GET_TEXT(MSG_CALIBRATION_FAILED);
defer_status_screen(false);
touch_calibration.calibration_end();
TERN_(HAS_TOUCH_BUTTONS, redrawTouchButtons = true);
}
// draw current message
tftio.set_window(TFT_PIXEL_OFFSET_X, TFT_PIXEL_OFFSET_Y, X_HI, Y_HI);
do {
set_font(FONT_MENU);
lcd_put_u8str(0, LCD_PIXEL_HEIGHT / 2, str);
} while (u8g.nextPage());
drawing_screen = false;
}
#endif // TOUCH_SCREEN_CALIBRATION
#endif // HAS_MARLINUI_U8GLIB && (FSMC_CS_PIN || HAS_SPI_GRAPHICAL_TFT)
@@ -364,7 +364,7 @@ namespace Anycubic {
faultDuration++;
if (faultDuration >= AC_HEATER_FAULT_VALIDATION_TIME) {
SendtoTFTLN(AC_msg_nozzle_temp_abnormal);
SERIAL_ECHOLNPAIR_P("Bed temp abnormal! : ", temp);
SERIAL_ECHOLNPAIR("Bed temp abnormal! : ", temp);
break;
}
delay_ms(500);
@@ -29,15 +29,12 @@
*
* The DLCache can be used like so:
*
* void some_function() {
* DLCache dlcache(UNIQUE_ID);
* DLCache dlcache(UNIQUE_ID);
*
* if (dlcache.hasData()) {
* dlcache.append();
* } else {
* // Add stuff to the DL
* dlcache.store();
* }
* if (dlcache.hasData())
* dlcache.append();
* else
* dlcache.store(); // Add stuff to the DL
*/
class DLCache {
private:
@@ -32,11 +32,7 @@ bool tiny_timer_t::elapsed(tiny_time_t duration) {
#endif
);
uint8_t elapsed = now - _start;
if (elapsed >= duration._duration) {
return true;
} else {
return false;
}
return elapsed >= duration._duration;
}
void tiny_timer_t::start() {
@@ -78,9 +78,9 @@ void BedMeshScreen::drawMesh(int16_t x, int16_t y, int16_t w, int16_t h, ExtUI::
}
}
}
if (val_cnt) {
if (val_cnt)
val_mean /= val_cnt;
} else {
else {
val_mean = 0;
val_min = 0;
val_max = 0;
@@ -327,11 +327,10 @@ void BedMeshScreen::onMeshUpdate(const int8_t x, const int8_t y, const ExtUI::pr
screen_data.BedMeshScreen.message = screen_data.BedMeshScreen.MSG_NONE;
break;
case ExtUI::MESH_FINISH:
if (screen_data.BedMeshScreen.count == GRID_MAX_POINTS && isMeshComplete(ExtUI::getMeshArray())) {
if (screen_data.BedMeshScreen.count == GRID_MAX_POINTS && isMeshComplete(ExtUI::getMeshArray()))
screen_data.BedMeshScreen.message = screen_data.BedMeshScreen.MSG_MESH_COMPLETE;
} else {
else
screen_data.BedMeshScreen.message = screen_data.BedMeshScreen.MSG_MESH_INCOMPLETE;
}
screen_data.BedMeshScreen.count = GRID_MAX_POINTS;
break;
case ExtUI::PROBE_START:
@@ -72,7 +72,8 @@ void BootScreen::onIdle() {
GOTO_SCREEN(TouchCalibrationScreen);
current_screen.forget();
PUSH_SCREEN(StatusScreen);
} else {
}
else {
if (!UIFlashStorage::is_valid()) {
StatusScreen::loadBitmaps();
SpinnerDialogBox::show(GET_TEXT_F(MSG_PLEASE_WAIT));
@@ -152,11 +152,11 @@ void FilesScreen::drawFooter() {
#undef MARGIN_T
#undef MARGIN_B
#ifdef TOUCH_UI_PORTRAIT
#define MARGIN_T 15
#define MARGIN_B 5
#define MARGIN_T 15
#define MARGIN_B 5
#else
#define MARGIN_T 5
#define MARGIN_B 5
#define MARGIN_T 5
#define MARGIN_B 5
#endif
const bool has_selection = screen_data.FilesScreen.selected_tag != 0xFF;
const uint8_t back_tag = screen_data.FilesScreen.flags.is_root ? 240 : 245;
@@ -170,11 +170,11 @@ void FilesScreen::drawFooter() {
.tag(back_tag).button( BTN_POS(4,y), BTN_SIZE(3,h), GET_TEXT_F(MSG_BACK))
.enabled(has_selection)
.colors(has_selection ? action_btn : normal_btn);
if (screen_data.FilesScreen.flags.is_dir) {
if (screen_data.FilesScreen.flags.is_dir)
cmd.tag(244).button( BTN_POS(1, y), BTN_SIZE(3,h), GET_TEXT_F(MSG_BUTTON_OPEN));
} else {
else
cmd.tag(243).button( BTN_POS(1, y), BTN_SIZE(3,h), GET_TEXT_F(MSG_BUTTON_PRINT));
}
}
void FilesScreen::onRedraw(draw_mode_t what) {
@@ -122,28 +122,25 @@ char &LockScreen::message_style() {
}
void LockScreen::onPasscodeEntered() {
if (passcode == 0) {
// We are defining a passcode
if (passcode == 0) { // We are defining a passcode
message_style() = 0;
onRefresh();
sound.play(twinkle, PLAY_SYNCHRONOUS);
passcode = compute_checksum();
GOTO_PREVIOUS();
} else {
// We are verifying a passcode
if (passcode == compute_checksum()) {
message_style() = 'g';
onRefresh();
sound.play(twinkle, PLAY_SYNCHRONOUS);
GOTO_PREVIOUS();
}
else {
message_style() = 'w';
onRefresh();
sound.play(sad_trombone, PLAY_SYNCHRONOUS);
current_screen.forget(); // Discard the screen the user was trying to go to.
GOTO_PREVIOUS();
}
}
else if (passcode == compute_checksum()) { // We are verifying a passcode
message_style() = 'g';
onRefresh();
sound.play(twinkle, PLAY_SYNCHRONOUS);
GOTO_PREVIOUS();
}
else {
message_style() = 'w';
onRefresh();
sound.play(sad_trombone, PLAY_SYNCHRONOUS);
current_screen.forget(); // Discard the screen the user was trying to go to.
GOTO_PREVIOUS();
}
}
@@ -56,10 +56,9 @@ void SaveSettingsDialogBox::promptToSaveSettings() {
// so SaveSettingsDialogBox doesn't return here.
GOTO_SCREEN(SaveSettingsDialogBox);
current_screen.forget();
} else {
// No save needed.
GOTO_PREVIOUS();
}
else
GOTO_PREVIOUS(); // No save needed.
}
#endif // TOUCH_UI_FTDI_EVE
@@ -54,7 +54,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
lv_clear_advance_settings();
lv_draw_filament_settings();
break;
#if ENABLED(USE_WIFI_FUNCTION)
#if ENABLED(MKS_WIFI_MODULE)
case ID_WIFI_PARA:
lv_clear_advance_settings();
lv_draw_wifi_settings();
@@ -75,7 +75,7 @@ void lv_draw_advance_settings(void) {
int index = 0;
lv_screen_menu_item(scr, machine_menu.PausePosition, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_PAUSE_POS, index++);
lv_screen_menu_item(scr, machine_menu.FilamentConf, PARA_UI_POS_X, PARA_UI_POS_Y * 2, event_handler, ID_FILAMENT_SETTINGS, index++);
#if ENABLED(USE_WIFI_FUNCTION)
#if ENABLED(MKS_WIFI_MODULE)
lv_screen_menu_item(scr, machine_menu.WifiSettings, PARA_UI_POS_X, PARA_UI_POS_Y * 3, event_handler, ID_WIFI_PARA, index++);
#endif
#if HAS_ROTARY_ENCODER
@@ -239,7 +239,7 @@ void lv_draw_dialog(uint8_t type) {
lv_obj_t *labelCancel = lv_label_create_empty(btnCancel);
lv_label_set_text(labelCancel, print_file_dialog_menu.cancle);
}
#if ENABLED(USE_WIFI_FUNCTION)
#if ENABLED(MKS_WIFI_MODULE)
else if (DIALOG_IS(TYPE_UPLOAD_FILE)) {
if (upload_result == 2) {
btnCancel = lv_button_btn_create(scr, BTN_OK_X + 90, BTN_OK_Y, 100, 50, btn_cancel_event_cb);
@@ -377,7 +377,7 @@ void lv_draw_dialog(uint8_t type) {
lv_label_set_text(labelDialog, DIALOG_UPDATE_NO_DEVICE_EN);
lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -20);
}
#if ENABLED(USE_WIFI_FUNCTION)
#if ENABLED(MKS_WIFI_MODULE)
else if (DIALOG_IS(TYPE_UPLOAD_FILE)) {
if (upload_result == 1) {
lv_label_set_text(labelDialog, DIALOG_UPLOAD_ING_EN);
@@ -418,7 +418,7 @@ void lv_draw_dialog(uint8_t type) {
lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -20);
}
}
#endif // USE_WIFI_FUNCTION
#endif // MKS_WIFI_MODULE
else if (DIALOG_IS(TYPE_FILAMENT_LOAD_HEAT)) {
lv_label_set_text(labelDialog, filament_menu.filament_dialog_load_heat);
lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -20);
@@ -122,7 +122,7 @@ static void lv_kb_event_cb(lv_obj_t *kb, lv_event_t event) {
//if (res != LV_RES_OK) return;
const char * ret_ta_txt = lv_ta_get_text(ext->ta);
switch (keyboard_value) {
#if ENABLED(USE_WIFI_FUNCTION)
#if ENABLED(MKS_WIFI_MODULE)
case wifiName:
memcpy(uiCfg.wifi_name,ret_ta_txt,sizeof(uiCfg.wifi_name));
lv_clear_keyboard();
@@ -158,7 +158,7 @@ static void lv_kb_event_cb(lv_obj_t *kb, lv_event_t event) {
wifi_tips_type = TIPS_TYPE_JOINING;
lv_draw_wifi_tips();
break;
#endif // USE_WIFI_FUNCTION
#endif // MKS_WIFI_MODULE
case gcodeCommand:
uint8_t buf[100];
strncpy((char *)buf,ret_ta_txt,sizeof(buf));
@@ -180,10 +180,7 @@ void lv_draw_operation(void) {
label_PowerOff = lv_label_create_empty(buttonPowerOff);
if (uiCfg.print_state != WORKING) {
/*
label_Filament = lv_label_create_empty(buttonFilament);
} else {
*/
//label_Filament = lv_label_create_empty(buttonFilament);
labelExtrusion = lv_label_create_empty(buttonExtrusion);
label_Move = lv_label_create_empty(buttonMove);
}
@@ -210,11 +207,8 @@ void lv_draw_operation(void) {
lv_obj_align(label_PowerOff, buttonPowerOff, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
if (uiCfg.print_state != WORKING) {
/*
lv_label_set_text(label_Filament, operation_menu.filament);
lv_obj_align(label_Filament, buttonFilament, LV_ALIGN_IN_BOTTOM_MID,0, BUTTON_TEXT_Y_OFFSET);
} else {
*/
//lv_label_set_text(label_Filament, operation_menu.filament);
//lv_obj_align(label_Filament, buttonFilament, LV_ALIGN_IN_BOTTOM_MID,0, BUTTON_TEXT_Y_OFFSET);
lv_label_set_text(labelExtrusion, operation_menu.extr);
lv_obj_align(labelExtrusion, buttonExtrusion, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
@@ -219,7 +219,7 @@ void lv_draw_ready_print(void) {
void lv_clear_ready_print() {
#if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable == true) lv_group_remove_all_objs(g);
if (gCfgItems.encoder_enable) lv_group_remove_all_objs(g);
#endif
lv_obj_del(scr);
}
+7 -3
View File
@@ -37,6 +37,10 @@
#include "../../../../gcode/queue.h"
#include "../../../../inc/MarlinConfig.h"
#if HAS_SUICIDE
#include "../../../../MarlinCore.h"
#endif
static lv_obj_t *scr;
extern lv_group_t* g;
@@ -54,7 +58,7 @@ enum {
static void event_handler(lv_obj_t *obj, lv_event_t event) {
if (event != LV_EVENT_RELEASED) return;
#if ENABLED(USE_WIFI_FUNCTION)
#if ENABLED(MKS_WIFI_MODULE)
char buf[6] = { 0 };
#endif
switch (obj->mks_obj_id) {
@@ -87,7 +91,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
lv_draw_ready_print();
break;
#if ENABLED(USE_WIFI_FUNCTION)
#if ENABLED(MKS_WIFI_MODULE)
case ID_S_WIFI:
if (gCfgItems.wifi_mode_sel == STA_MODEL) {
if (wifi_link_state == WIFI_CONNECTED) {
@@ -135,7 +139,7 @@ void lv_draw_set(void) {
#if HAS_LANG_SELECT_SCREEN
lv_big_button_create(scr, "F:/bmp_language.bin", set_menu.language, BTN_X_PIXEL + INTERVAL_V * 2, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_S_LANGUAGE);
#endif
#if ENABLED(USE_WIFI_FUNCTION)
#if ENABLED(MKS_WIFI_MODULE)
lv_big_button_create(scr, "F:/bmp_wifi.bin", set_menu.wifi, BTN_X_PIXEL * 2 + INTERVAL_V * 3, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_S_WIFI);
#endif
lv_big_button_create(scr, "F:/bmp_return.bin", common_menu.text_back, BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_S_RETURN);
@@ -0,0 +1,120 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#include "../../../../inc/MarlinConfigPre.h"
#if BOTH(HAS_TFT_LVGL_UI, TOUCH_SCREEN_CALIBRATION)
#include "draw_ui.h"
#include "draw_touch_calibration.h"
#include <lv_conf.h>
#include "../../../../inc/MarlinConfig.h"
#include "../../../tft_io/touch_calibration.h"
#include "SPI_TFT.h"
static lv_obj_t *scr;
static lv_obj_t *status_label;
static void event_handler(lv_obj_t *obj, lv_event_t event);
enum {
ID_TC_RETURN = 1
};
static void drawCross(uint16_t x, uint16_t y, uint16_t color) {
SPI_TFT.tftio.set_window(x - 15, y, x + 15, y);
SPI_TFT.tftio.WriteMultiple(color, 31);
SPI_TFT.tftio.set_window(x, y - 15, x, y + 15);
SPI_TFT.tftio.WriteMultiple(color, 31);
}
void lv_update_touch_calibration_screen() {
uint16_t x, y;
calibrationState calibration_stage = touch_calibration.get_calibration_state();
if (calibration_stage == CALIBRATION_NONE) {
// start and clear screen
calibration_stage = touch_calibration.calibration_start();
}
else {
// clear last cross
x = touch_calibration.calibration_points[_MIN(calibration_stage - 1, CALIBRATION_BOTTOM_RIGHT)].x;
y = touch_calibration.calibration_points[_MIN(calibration_stage - 1, CALIBRATION_BOTTOM_RIGHT)].y;
drawCross(x, y, LV_COLOR_BACKGROUND.full);
}
const char *str = nullptr;
if (calibration_stage < CALIBRATION_SUCCESS) {
// handle current state
switch (calibration_stage) {
case CALIBRATION_TOP_LEFT: str = GET_TEXT(MSG_TOP_LEFT); break;
case CALIBRATION_BOTTOM_LEFT: str = GET_TEXT(MSG_BOTTOM_LEFT); break;
case CALIBRATION_TOP_RIGHT: str = GET_TEXT(MSG_TOP_RIGHT); break;
case CALIBRATION_BOTTOM_RIGHT: str = GET_TEXT(MSG_BOTTOM_RIGHT); break;
default: break;
}
x = touch_calibration.calibration_points[calibration_stage].x;
y = touch_calibration.calibration_points[calibration_stage].y;
drawCross(x, y, LV_COLOR_WHITE.full);
}
else {
// end calibration
str = calibration_stage == CALIBRATION_SUCCESS ? GET_TEXT(MSG_CALIBRATION_COMPLETED) : GET_TEXT(MSG_CALIBRATION_FAILED);
touch_calibration.calibration_end();
lv_big_button_create(scr, "F:/bmp_return.bin", common_menu.text_back, BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_TC_RETURN);
}
// draw current message
lv_label_set_text(status_label, str);
lv_obj_align(status_label, nullptr, LV_ALIGN_CENTER, 0, 0);
}
static void event_handler(lv_obj_t *obj, lv_event_t event) {
if (event != LV_EVENT_RELEASED) return;
switch (obj->mks_obj_id) {
case ID_TC_RETURN:
TERN_(MKS_TEST, curent_disp_ui = 1);
lv_clear_touch_calibration_screen();
lv_draw_ready_print();
break;
}
}
void lv_draw_touch_calibration_screen() {
disp_state_stack._disp_index = 0;
ZERO(disp_state_stack._disp_state);
scr = lv_screen_create(TOUCH_CALIBRATION_UI, "");
status_label = lv_label_create(scr, "");
lv_obj_align(status_label, nullptr, LV_ALIGN_CENTER, 0, 0);
lv_refr_now(lv_refr_get_disp_refreshing());
lv_update_touch_calibration_screen();
}
void lv_clear_touch_calibration_screen() {
lv_obj_del(scr);
}
#endif // HAS_TFT_LVGL_UI && TOUCH_SCREEN_CALIBRATION
@@ -0,0 +1,35 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#pragma once
#ifdef __cplusplus
extern "C" { /* C-declarations for C++ */
#endif
extern void lv_draw_touch_calibration_screen();
extern void lv_clear_touch_calibration_screen();
extern void lv_update_touch_calibration_screen();
//extern void disp_temp_ready_print();
#ifdef __cplusplus
} /* C-declarations for C++ */
#endif
+174 -441
View File
@@ -48,6 +48,10 @@
#include "../../../../feature/pause.h"
#endif
#if ENABLED(TOUCH_SCREEN_CALIBRATION)
#include "draw_touch_calibration.h"
#endif
CFG_ITMES gCfgItems;
UI_CFG uiCfg;
DISP_STATE_STACK disp_state_stack;
@@ -134,7 +138,7 @@ void gCfgItems_init() {
gCfgItems.levelingPos[4][0] = X_BED_SIZE / 2;
gCfgItems.levelingPos[4][1] = Y_BED_SIZE / 2;
gCfgItems.cloud_enable = true;
#if ENABLED(USE_WIFI_FUNCTION)
#if ENABLED(MKS_WIFI_MODULE)
gCfgItems.wifi_mode_sel = STA_MODEL;
gCfgItems.fileSysType = FILE_SYS_SD;
gCfgItems.wifi_type = ESP_WIFI;
@@ -199,7 +203,7 @@ void ui_cfg_init() {
uiCfg.filament_unloading_time_flg = 0;
uiCfg.filament_unloading_time_cnt = 0;
#if ENABLED(USE_WIFI_FUNCTION)
#if ENABLED(MKS_WIFI_MODULE)
memset(&wifiPara, 0, sizeof(wifiPara));
memset(&ipPara, 0, sizeof(ipPara));
strcpy(wifiPara.ap_name, WIFI_AP_NAME);
@@ -538,7 +542,7 @@ char *getDispText(int index) {
strcpy(public_buf_l, tool_menu.title);
break;
case WIFI_LIST_UI:
#if ENABLED(USE_WIFI_FUNCTION)
#if ENABLED(MKS_WIFI_MODULE)
strcpy(public_buf_l, list_menu.title);
break;
#endif
@@ -1036,7 +1040,7 @@ void GUI_RefreshPage() {
*/
break;
#if ENABLED(USE_WIFI_FUNCTION)
#if ENABLED(MKS_WIFI_MODULE)
case WIFI_UI:
if (temps_update_flag) {
disp_wifi_state();
@@ -1057,7 +1061,7 @@ void GUI_RefreshPage() {
break;
case DIALOG_UI:
filament_dialog_handle();
TERN_(USE_WIFI_FUNCTION, wifi_scan_handle());
TERN_(MKS_WIFI_MODULE, wifi_scan_handle());
break;
case MESHLEVELING_UI:
/*disp_zpos();*/
@@ -1065,7 +1069,7 @@ void GUI_RefreshPage() {
case HARDWARE_TEST_UI:
break;
case WIFI_LIST_UI:
#if ENABLED(USE_WIFI_FUNCTION)
#if ENABLED(MKS_WIFI_MODULE)
if (printing_rate_update_flag) {
disp_wifi_list();
printing_rate_update_flag = false;
@@ -1076,7 +1080,7 @@ void GUI_RefreshPage() {
/*update_password_disp();
update_join_state_disp();*/
break;
#if ENABLED(USE_WIFI_FUNCTION)
#if ENABLED(MKS_WIFI_MODULE)
case WIFI_TIPS_UI:
switch (wifi_tips_type) {
case TIPS_TYPE_JOINING:
@@ -1138,227 +1142,94 @@ void clear_cur_ui() {
last_disp_state = disp_state_stack._disp_state[disp_state_stack._disp_index];
switch (disp_state_stack._disp_state[disp_state_stack._disp_index]) {
case PRINT_READY_UI:
//Get_Temperature_Flg = 0;
lv_clear_ready_print();
break;
case PRINT_FILE_UI:
lv_clear_print_file();
break;
case PRINTING_UI:
lv_clear_printing();
break;
case MOVE_MOTOR_UI:
lv_clear_move_motor();
break;
case OPERATE_UI:
lv_clear_operation();
break;
case PAUSE_UI:
//Clear_pause();
break;
case EXTRUSION_UI:
lv_clear_extrusion();
break;
case PRE_HEAT_UI:
lv_clear_preHeat();
break;
case CHANGE_SPEED_UI:
lv_clear_change_speed();
break;
case FAN_UI:
lv_clear_fan();
break;
case SET_UI:
lv_clear_set();
break;
case ZERO_UI:
lv_clear_home();
break;
case SPRAYER_UI:
//Clear_Sprayer();
break;
case MACHINE_UI:
//Clear_Machine();
break;
case LANGUAGE_UI:
lv_clear_language();
break;
case ABOUT_UI:
lv_clear_about();
break;
case LOG_UI:
//Clear_Connect();
break;
case DISK_UI:
//Clear_Disk();
break;
#if ENABLED(USE_WIFI_FUNCTION)
case WIFI_UI:
lv_clear_wifi();
break;
case PRINT_READY_UI: //Get_Temperature_Flg = 0;
lv_clear_ready_print(); break;
case PRINT_FILE_UI: lv_clear_print_file(); break;
case PRINTING_UI: lv_clear_printing(); break;
case MOVE_MOTOR_UI: lv_clear_move_motor(); break;
case OPERATE_UI: lv_clear_operation(); break;
case PAUSE_UI: /* Clear_pause(); */ break;
case EXTRUSION_UI: lv_clear_extrusion(); break;
case PRE_HEAT_UI: lv_clear_preHeat(); break;
case CHANGE_SPEED_UI: lv_clear_change_speed(); break;
case FAN_UI: lv_clear_fan(); break;
case SET_UI: lv_clear_set(); break;
case ZERO_UI: lv_clear_home(); break;
case SPRAYER_UI: /* Clear_Sprayer(); */ break;
case MACHINE_UI: /* Clear_Machine(); */ break;
case LANGUAGE_UI: lv_clear_language(); break;
case ABOUT_UI: lv_clear_about(); break;
case LOG_UI: /* Clear_Connect(); */ break;
case DISK_UI: /* Clear_Disk(); */ break;
#if ENABLED(MKS_WIFI_MODULE)
case WIFI_UI: lv_clear_wifi(); break;
#endif
case MORE_UI:
//Clear_more();
break;
case FILETRANSFER_UI:
//Clear_fileTransfer();
break;
case DIALOG_UI:
lv_clear_dialog();
break;
case FILETRANSFERSTATE_UI:
//Clear_WifiFileTransferdialog();
break;
case PRINT_MORE_UI:
//Clear_Printmore();
break;
case FILAMENTCHANGE_UI:
lv_clear_filament_change();
break;
case LEVELING_UI:
lv_clear_manualLevel();
break;
case BIND_UI:
//Clear_Bind();
break;
case MORE_UI: /* Clear_more(); */ break;
case FILETRANSFER_UI: /* Clear_fileTransfer(); */ break;
case DIALOG_UI: lv_clear_dialog(); break;
case FILETRANSFERSTATE_UI: /* Clear_WifiFileTransferdialog(); */ break;
case PRINT_MORE_UI: /* Clear_Printmore(); */ break;
case FILAMENTCHANGE_UI: lv_clear_filament_change(); break;
case LEVELING_UI: lv_clear_manualLevel(); break;
case BIND_UI: /* Clear_Bind(); */ break;
#if HAS_BED_PROBE
case NOZZLE_PROBE_OFFSET_UI:
lv_clear_auto_level_offset_settings();
break;
case NOZZLE_PROBE_OFFSET_UI: lv_clear_auto_level_offset_settings(); break;
#endif
case TOOL_UI:
lv_clear_tool();
break;
case MESHLEVELING_UI:
//Clear_MeshLeveling();
break;
case HARDWARE_TEST_UI:
//Clear_Hardwaretest();
break;
#if ENABLED(USE_WIFI_FUNCTION)
case WIFI_LIST_UI:
lv_clear_wifi_list();
break;
case TOOL_UI: lv_clear_tool(); break;
case MESHLEVELING_UI: /* Clear_MeshLeveling(); */ break;
case HARDWARE_TEST_UI: /* Clear_Hardwaretest(); */ break;
#if ENABLED(MKS_WIFI_MODULE)
case WIFI_LIST_UI: lv_clear_wifi_list(); break;
#endif
case KEY_BOARD_UI:
lv_clear_keyboard();
break;
#if ENABLED(USE_WIFI_FUNCTION)
case WIFI_TIPS_UI:
lv_clear_wifi_tips();
break;
case KEY_BOARD_UI: lv_clear_keyboard(); break;
#if ENABLED(MKS_WIFI_MODULE)
case WIFI_TIPS_UI: lv_clear_wifi_tips(); break;
#endif
case MACHINE_PARA_UI:
lv_clear_machine_para();
break;
case MACHINE_SETTINGS_UI:
lv_clear_machine_settings();
break;
case TEMPERATURE_SETTINGS_UI:
//Clear_TemperatureSettings();
break;
case MOTOR_SETTINGS_UI:
lv_clear_motor_settings();
break;
case MACHINETYPE_UI:
//Clear_MachineType();
break;
case STROKE_UI:
//Clear_Stroke();
break;
case HOME_DIR_UI:
//Clear_HomeDir();
break;
case ENDSTOP_TYPE_UI:
//Clear_EndstopType();
break;
case FILAMENT_SETTINGS_UI:
lv_clear_filament_settings();
break;
case LEVELING_SETTIGNS_UI:
//Clear_LevelingSettings();
break;
case LEVELING_PARA_UI:
lv_clear_level_settings();
break;
case DELTA_LEVELING_PARA_UI:
//Clear_DeltaLevelPara();
break;
case MANUAL_LEVELING_POSIGION_UI:
lv_clear_manual_level_pos_settings();
break;
case MAXFEEDRATE_UI:
lv_clear_max_feedrate_settings();
break;
case STEPS_UI:
lv_clear_step_settings();
break;
case ACCELERATION_UI:
lv_clear_acceleration_settings();
break;
case JERK_UI:
#if HAS_CLASSIC_JERK
lv_clear_jerk_settings();
#endif
break;
case MOTORDIR_UI:
//Clear_MotorDir();
break;
case HOMESPEED_UI:
//Clear_HomeSpeed();
break;
case NOZZLE_CONFIG_UI:
//Clear_NozzleConfig();
break;
case HOTBED_CONFIG_UI:
//Clear_HotbedConfig();
break;
case ADVANCED_UI:
lv_clear_advance_settings();
break;
case DOUBLE_Z_UI:
//Clear_DoubleZ();
break;
case ENABLE_INVERT_UI:
//Clear_EnableInvert();
break;
case NUMBER_KEY_UI:
lv_clear_number_key();
break;
case BABY_STEP_UI:
lv_clear_baby_stepping();
break;
case PAUSE_POS_UI:
lv_clear_pause_position();
break;
case MACHINE_PARA_UI: lv_clear_machine_para(); break;
case MACHINE_SETTINGS_UI: lv_clear_machine_settings(); break;
case TEMPERATURE_SETTINGS_UI: /* Clear_TemperatureSettings(); */ break;
case MOTOR_SETTINGS_UI: lv_clear_motor_settings(); break;
case MACHINETYPE_UI: /* Clear_MachineType(); */ break;
case STROKE_UI: /* Clear_Stroke(); */ break;
case HOME_DIR_UI: /* Clear_HomeDir(); */ break;
case ENDSTOP_TYPE_UI: /* Clear_EndstopType(); */ break;
case FILAMENT_SETTINGS_UI: lv_clear_filament_settings(); break;
case LEVELING_SETTIGNS_UI: /* Clear_LevelingSettings(); */ break;
case LEVELING_PARA_UI: lv_clear_level_settings(); break;
case DELTA_LEVELING_PARA_UI: /* Clear_DeltaLevelPara(); */ break;
case MANUAL_LEVELING_POSIGION_UI: lv_clear_manual_level_pos_settings(); break;
case MAXFEEDRATE_UI: lv_clear_max_feedrate_settings(); break;
case STEPS_UI: lv_clear_step_settings(); break;
case ACCELERATION_UI: lv_clear_acceleration_settings(); break;
case JERK_UI: TERN_(HAS_CLASSIC_JERK, lv_clear_jerk_settings()); break;
case MOTORDIR_UI: /* Clear_MotorDir(); */ break;
case HOMESPEED_UI: /* Clear_HomeSpeed(); */ break;
case NOZZLE_CONFIG_UI: /* Clear_NozzleConfig(); */ break;
case HOTBED_CONFIG_UI: /* Clear_HotbedConfig(); */ break;
case ADVANCED_UI: lv_clear_advance_settings(); break;
case DOUBLE_Z_UI: /* Clear_DoubleZ(); */ break;
case ENABLE_INVERT_UI: /* Clear_EnableInvert(); */ break;
case NUMBER_KEY_UI: lv_clear_number_key(); break;
case BABY_STEP_UI: lv_clear_baby_stepping(); break;
case PAUSE_POS_UI: lv_clear_pause_position(); break;
#if HAS_TRINAMIC_CONFIG
case TMC_CURRENT_UI:
lv_clear_tmc_current_settings();
break;
case TMC_CURRENT_UI: lv_clear_tmc_current_settings(); break;
#endif
case EEPROM_SETTINGS_UI:
lv_clear_eeprom_settings();
break;
#if HAS_STEALTHCHOP
case TMC_MODE_UI:
lv_clear_tmc_step_mode_settings();
break;
#endif
#if ENABLED(USE_WIFI_FUNCTION)
case WIFI_SETTINGS_UI:
lv_clear_wifi_settings();
break;
case EEPROM_SETTINGS_UI: lv_clear_eeprom_settings(); break;
#if HAS_STEALTHCHOP
case TMC_MODE_UI: lv_clear_tmc_step_mode_settings(); break;
#endif
#if ENABLED(MKS_WIFI_MODULE)
case WIFI_SETTINGS_UI: lv_clear_wifi_settings(); break;
#endif
#if USE_SENSORLESS
case HOMING_SENSITIVITY_UI:
lv_clear_homing_sensitivity_settings();
break;
case HOMING_SENSITIVITY_UI: lv_clear_homing_sensitivity_settings(); break;
#endif
#if HAS_ROTARY_ENCODER
case ENCODER_SETTINGS_UI:
lv_clear_encoder_settings();
break;
case ENCODER_SETTINGS_UI: lv_clear_encoder_settings(); break;
#endif
#if ENABLED(TOUCH_SCREEN_CALIBRATION)
case TOUCH_CALIBRATION_UI: lv_clear_touch_calibration_screen(); break;
#endif
default: break;
}
@@ -1370,227 +1241,98 @@ void draw_return_ui() {
disp_state_stack._disp_index--;
switch (disp_state_stack._disp_state[disp_state_stack._disp_index]) {
case PRINT_READY_UI:
lv_draw_ready_print();
break;
case PRINT_FILE_UI:
lv_draw_print_file();
break;
case PRINTING_UI:
if (gCfgItems.from_flash_pic) flash_preview_begin = true;
else default_preview_flg = true;
lv_draw_printing();
break;
case MOVE_MOTOR_UI:
lv_draw_move_motor();
break;
case OPERATE_UI:
lv_draw_operation();
break;
case PRINT_READY_UI: lv_draw_ready_print(); break;
case PRINT_FILE_UI: lv_draw_print_file(); break;
#if 1
case PAUSE_UI:
//draw_pause();
break;
#endif
case PRINTING_UI: if (gCfgItems.from_flash_pic)
flash_preview_begin = true;
else
default_preview_flg = true;
lv_draw_printing();
break;
case EXTRUSION_UI:
lv_draw_extrusion();
break;
case PRE_HEAT_UI:
lv_draw_preHeat();
break;
case CHANGE_SPEED_UI:
lv_draw_change_speed();
break;
case FAN_UI:
lv_draw_fan();
break;
case SET_UI:
lv_draw_set();
break;
case ZERO_UI:
lv_draw_home();
break;
case SPRAYER_UI:
//draw_Sprayer();
break;
case MACHINE_UI:
//draw_Machine();
break;
case LANGUAGE_UI:
lv_draw_language();
break;
case ABOUT_UI:
lv_draw_about();
break;
case MOVE_MOTOR_UI: lv_draw_move_motor(); break;
case OPERATE_UI: lv_draw_operation(); break;
case PAUSE_UI: /* draw_pause(); */ break;
case EXTRUSION_UI: lv_draw_extrusion(); break;
case PRE_HEAT_UI: lv_draw_preHeat(); break;
case CHANGE_SPEED_UI: lv_draw_change_speed(); break;
case FAN_UI: lv_draw_fan(); break;
case SET_UI: lv_draw_set(); break;
case ZERO_UI: lv_draw_home(); break;
case SPRAYER_UI: /* draw_Sprayer(); */ break;
case MACHINE_UI: /* draw_Machine(); */ break;
case LANGUAGE_UI: lv_draw_language(); break;
case ABOUT_UI: lv_draw_about(); break;
case CALIBRATE_UI:
//draw_calibrate();
break;
case DISK_UI:
//draw_Disk();
break;
#if ENABLED(USE_WIFI_FUNCTION)
case WIFI_UI:
lv_draw_wifi();
break;
case CALIBRATE_UI: /* draw_calibrate(); */ break;
case DISK_UI: /* draw_Disk(); */ break;
#if ENABLED(MKS_WIFI_MODULE)
case WIFI_UI: lv_draw_wifi(); break;
#endif
case MORE_UI:
//draw_More();
break;
case PRINT_MORE_UI:
//draw_printmore();
break;
case FILAMENTCHANGE_UI:
lv_draw_filament_change();
break;
case LEVELING_UI:
lv_draw_manualLevel();
break;
case BIND_UI:
//draw_bind();
break;
case MORE_UI: /* draw_More(); */ break;
case PRINT_MORE_UI: /* draw_printmore(); */ break;
case FILAMENTCHANGE_UI: lv_draw_filament_change(); break;
case LEVELING_UI: lv_draw_manualLevel(); break;
case BIND_UI: /* draw_bind(); */ break;
#if HAS_BED_PROBE
case NOZZLE_PROBE_OFFSET_UI:
lv_draw_auto_level_offset_settings();
break;
case NOZZLE_PROBE_OFFSET_UI: lv_draw_auto_level_offset_settings(); break;
#endif
case TOOL_UI:
lv_draw_tool();
break;
case MESHLEVELING_UI:
//draw_meshleveling();
break;
case HARDWARE_TEST_UI:
//draw_Hardwaretest();
break;
case WIFI_LIST_UI:
#if ENABLED(USE_WIFI_FUNCTION)
lv_draw_wifi_list();
#endif
break;
case KEY_BOARD_UI:
lv_draw_keyboard();
break;
case WIFI_TIPS_UI:
#if ENABLED(USE_WIFI_FUNCTION)
lv_draw_wifi_tips();
#endif
break;
case MACHINE_PARA_UI:
lv_draw_machine_para();
break;
case MACHINE_SETTINGS_UI:
lv_draw_machine_settings();
break;
case TEMPERATURE_SETTINGS_UI:
//draw_TemperatureSettings();
break;
case MOTOR_SETTINGS_UI:
lv_draw_motor_settings();
break;
case MACHINETYPE_UI:
//draw_MachineType();
break;
case STROKE_UI:
//draw_Stroke();
break;
case HOME_DIR_UI:
//draw_HomeDir();
break;
case ENDSTOP_TYPE_UI:
//draw_EndstopType();
break;
case FILAMENT_SETTINGS_UI:
lv_draw_filament_settings();
break;
case LEVELING_SETTIGNS_UI:
//draw_LevelingSettings();
break;
case LEVELING_PARA_UI:
lv_draw_level_settings();
break;
case DELTA_LEVELING_PARA_UI:
//draw_DeltaLevelPara();
break;
case MANUAL_LEVELING_POSIGION_UI:
lv_draw_manual_level_pos_settings();
break;
case MAXFEEDRATE_UI:
lv_draw_max_feedrate_settings();
break;
case STEPS_UI:
lv_draw_step_settings();
break;
case ACCELERATION_UI:
lv_draw_acceleration_settings();
break;
case JERK_UI:
#if HAS_CLASSIC_JERK
lv_draw_jerk_settings();
#endif
break;
case MOTORDIR_UI:
//draw_MotorDir();
break;
case HOMESPEED_UI:
//draw_HomeSpeed();
break;
case NOZZLE_CONFIG_UI:
//draw_NozzleConfig();
break;
case HOTBED_CONFIG_UI:
//draw_HotbedConfig();
break;
case ADVANCED_UI:
lv_draw_advance_settings();
break;
case DOUBLE_Z_UI:
//draw_DoubleZ();
break;
case ENABLE_INVERT_UI:
//draw_EnableInvert();
break;
case NUMBER_KEY_UI:
lv_draw_number_key();
break;
case DIALOG_UI:
//draw_dialog(uiCfg.dialogType);
break;
case BABY_STEP_UI:
lv_draw_baby_stepping();
break;
case PAUSE_POS_UI:
lv_draw_pause_position();
break;
#if HAS_TRINAMIC_CONFIG
case TMC_CURRENT_UI:
lv_draw_tmc_current_settings();
break;
#endif
case EEPROM_SETTINGS_UI:
lv_draw_eeprom_settings();
break;
case TOOL_UI: lv_draw_tool(); break;
case MESHLEVELING_UI: /* draw_meshleveling(); */ break;
case HARDWARE_TEST_UI: /* draw_Hardwaretest(); */ break;
#if ENABLED(MKS_WIFI_MODULE)
case WIFI_LIST_UI: lv_draw_wifi_list(); break;
#endif
case KEY_BOARD_UI: lv_draw_keyboard(); break;
#if ENABLED(MKS_WIFI_MODULE)
case WIFI_TIPS_UI: lv_draw_wifi_tips(); break;
#endif
case MACHINE_PARA_UI: lv_draw_machine_para(); break;
case MACHINE_SETTINGS_UI: lv_draw_machine_settings(); break;
case TEMPERATURE_SETTINGS_UI: /* draw_TemperatureSettings(); */ break;
case MOTOR_SETTINGS_UI: lv_draw_motor_settings(); break;
case MACHINETYPE_UI: /* draw_MachineType(); */ break;
case STROKE_UI: /* draw_Stroke(); */ break;
case HOME_DIR_UI: /* draw_HomeDir(); */ break;
case ENDSTOP_TYPE_UI: /* draw_EndstopType(); */ break;
case FILAMENT_SETTINGS_UI: lv_draw_filament_settings(); break;
case LEVELING_SETTIGNS_UI: /* draw_LevelingSettings(); */ break;
case LEVELING_PARA_UI: lv_draw_level_settings(); break;
case DELTA_LEVELING_PARA_UI: /* draw_DeltaLevelPara(); */ break;
case MANUAL_LEVELING_POSIGION_UI: lv_draw_manual_level_pos_settings(); break;
case MAXFEEDRATE_UI: lv_draw_max_feedrate_settings(); break;
case STEPS_UI: lv_draw_step_settings(); break;
case ACCELERATION_UI: lv_draw_acceleration_settings(); break;
#if HAS_CLASSIC_JERK
case JERK_UI: lv_draw_jerk_settings(); break;
#endif
case MOTORDIR_UI: /* draw_MotorDir(); */ break;
case HOMESPEED_UI: /* draw_HomeSpeed(); */ break;
case NOZZLE_CONFIG_UI: /* draw_NozzleConfig(); */ break;
case HOTBED_CONFIG_UI: /* draw_HotbedConfig(); */ break;
case ADVANCED_UI: lv_draw_advance_settings(); break;
case DOUBLE_Z_UI: /* draw_DoubleZ(); */ break;
case ENABLE_INVERT_UI: /* draw_EnableInvert(); */ break;
case NUMBER_KEY_UI: lv_draw_number_key(); break;
case DIALOG_UI: /* draw_dialog(uiCfg.dialogType); */ break;
case BABY_STEP_UI: lv_draw_baby_stepping(); break;
case PAUSE_POS_UI: lv_draw_pause_position(); break;
#if HAS_TRINAMIC_CONFIG
case TMC_CURRENT_UI: lv_draw_tmc_current_settings(); break;
#endif
case EEPROM_SETTINGS_UI: lv_draw_eeprom_settings(); break;
#if HAS_STEALTHCHOP
case TMC_MODE_UI:
lv_draw_tmc_step_mode_settings();
break;
case TMC_MODE_UI: lv_draw_tmc_step_mode_settings(); break;
#endif
#if ENABLED(USE_WIFI_FUNCTION)
case WIFI_SETTINGS_UI:
lv_draw_wifi_settings();
break;
#if ENABLED(MKS_WIFI_MODULE)
case WIFI_SETTINGS_UI: lv_draw_wifi_settings(); break;
#endif
#if USE_SENSORLESS
case HOMING_SENSITIVITY_UI:
lv_draw_homing_sensitivity_settings();
break;
case HOMING_SENSITIVITY_UI: lv_draw_homing_sensitivity_settings(); break;
#endif
#if HAS_ROTARY_ENCODER
case ENCODER_SETTINGS_UI:
lv_draw_encoder_settings();
break;
case ENCODER_SETTINGS_UI: lv_draw_encoder_settings(); break;
#endif
default: break;
}
@@ -1774,10 +1516,8 @@ lv_obj_t* lv_big_button_create(lv_obj_t *par, const char *img, const char *text,
else
lv_obj_align(label, btn, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
}
#if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable == true)
lv_group_add_obj(g, btn);
#endif
if (TERN0(HAS_ROTARY_ENCODER, gCfgItems.encoder_enable))
lv_group_add_obj(g, btn);
return btn;
}
@@ -1793,11 +1533,8 @@ lv_obj_t* lv_screen_menu_item(lv_obj_t *par, const char *text, lv_coord_t x, lv_
lv_label_set_text(label, text);
lv_obj_align(label, btn, LV_ALIGN_IN_LEFT_MID, 0, 0);
}
#if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable == true) {
lv_group_add_obj(g, btn);
}
#endif
if (TERN0(HAS_ROTARY_ENCODER, gCfgItems.encoder_enable))
lv_group_add_obj(g, btn);
if (drawArrow) (void)lv_imgbtn_create(par, "F:/bmp_arrow.bin", x + PARA_UI_SIZE_X, y + PARA_UI_ARROW_V, cb, id);
@@ -1879,15 +1616,11 @@ void LV_TASK_HANDLER() {
lv_task_handler();
if (mks_test_flag == 0x1E) mks_hardware_test();
#if HAS_GCODE_PREVIEW
disp_pre_gcode(2, 36);
#endif
TERN_(HAS_GCODE_PREVIEW, disp_pre_gcode(2, 36));
GUI_RefreshPage();
#if ENABLED(USE_WIFI_FUNCTION)
get_wifi_commands();
#endif
TERN_(MKS_WIFI_MODULE, get_wifi_commands());
//sd_detection();
+5 -6
View File
@@ -76,7 +76,7 @@
#include "draw_keyboard.h"
#include "draw_encoder_settings.h"
#if ENABLED(USE_WIFI_FUNCTION)
#if ENABLED(MKS_WIFI_MODULE)
#include "wifiSerial.h"
#include "wifi_module.h"
#include "wifi_upload.h"
@@ -313,7 +313,8 @@ typedef enum {
EEPROM_SETTINGS_UI,
WIFI_SETTINGS_UI,
HOMING_SENSITIVITY_UI,
ENCODER_SETTINGS_UI
ENCODER_SETTINGS_UI,
TOUCH_CALIBRATION_UI
} DISP_STATE;
typedef struct {
@@ -377,14 +378,12 @@ typedef enum {
level_pos_x4,
level_pos_y4,
level_pos_x5,
level_pos_y5
level_pos_y5,
#if HAS_BED_PROBE
,
x_offset,
y_offset,
z_offset
z_offset,
#endif
,
load_length,
load_speed,
unload_length,
@@ -26,7 +26,7 @@
#include <lv_conf.h>
#include "tft_lvgl_configuration.h"
#if ENABLED(USE_WIFI_FUNCTION)
#if ENABLED(MKS_WIFI_MODULE)
#include "draw_ui.h"
@@ -159,5 +159,5 @@ void lv_clear_wifi() {
lv_obj_del(scr);
}
#endif // USE_WIFI_FUNCTION
#endif // MKS_WIFI_MODULE
#endif // HAS_TFT_LVGL_UI
@@ -26,7 +26,7 @@
#include <lv_conf.h>
#include "tft_lvgl_configuration.h"
#if ENABLED(USE_WIFI_FUNCTION)
#if ENABLED(MKS_WIFI_MODULE)
#include "draw_ui.h"
@@ -170,6 +170,5 @@ void lv_clear_wifi_list() {
lv_obj_del(scr);
}
#endif // USE_WIFI_FUNCTION
#endif // MKS_WIFI_MODULE
#endif // HAS_TFT_LVGL_UI
@@ -26,7 +26,7 @@
#include <lv_conf.h>
#include "tft_lvgl_configuration.h"
#if ENABLED(USE_WIFI_FUNCTION)
#if ENABLED(MKS_WIFI_MODULE)
#include "draw_ui.h"
@@ -96,7 +96,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
void lv_draw_wifi_settings(void) {
scr = lv_screen_create(WIFI_SETTINGS_UI, machine_menu.WifiConfTitle);
lv_obj_t *labelModelText = lv_label_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y + 10, machine_menu.wifiMode);
lv_label_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y + 10, machine_menu.wifiMode);
lv_obj_t *buttonModelValue = lv_imgbtn_create(scr, "F:/bmp_blank_sel.bin", PARA_UI_VALUE_POS_X, PARA_UI_POS_Y + PARA_UI_VALUE_V, event_handler, ID_WIFI_MODEL);
lv_btn_set_style_both(buttonModelValue, &style_para_value_pre);
@@ -119,7 +119,7 @@ void lv_draw_wifi_settings(void) {
lv_obj_t *line3 = lv_line_create(scr, nullptr);
lv_ex_line(line3, line_points[2]);
lv_obj_t *labelCloudText = lv_label_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y * 4 + 10, machine_menu.wifiCloud);
lv_label_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y * 4 + 10, machine_menu.wifiCloud);
lv_obj_t *buttonCloudValue = lv_imgbtn_create(scr, gCfgItems.cloud_enable ? "F:/bmp_enable.bin" : "F:/bmp_disable.bin", PARA_UI_STATE_POS_X, PARA_UI_POS_Y * 4 + PARA_UI_STATE_V, event_handler, ID_WIFI_CLOUD);
labelCloudValue = lv_label_create_empty(buttonCloudValue);
@@ -141,14 +141,14 @@ void lv_draw_wifi_settings(void) {
lv_label_set_text(labelModelValue, WIFI_STA_TEXT);
lv_obj_align(labelModelValue, buttonModelValue, LV_ALIGN_CENTER, 0, 0);
}
strcat(public_buf_m, machine_menu.wifiName);
strcpy(public_buf_m, machine_menu.wifiName);
strcat(public_buf_m, (const char *)uiCfg.wifi_name);
lv_label_set_text(labelNameText, public_buf_m);
lv_label_set_text(labelNameValue, machine_menu.wifiEdit);
lv_obj_align(labelNameValue, buttonNameValue, LV_ALIGN_CENTER, 0, 0);
strcat(public_buf_m, machine_menu.wifiPassWord);
strcpy(public_buf_m, machine_menu.wifiPassWord);
strcat(public_buf_m, (const char *)uiCfg.wifi_key);
lv_label_set_text(labelPassWordText, public_buf_m);
@@ -184,5 +184,5 @@ void lv_clear_wifi_settings() {
lv_obj_del(scr);
}
#endif // USE_WIFI_FUNCTION
#endif // MKS_WIFI_MODULE
#endif // HAS_TFT_LVGL_UI
@@ -26,7 +26,7 @@
#include <lv_conf.h>
#include "tft_lvgl_configuration.h"
#if ENABLED(USE_WIFI_FUNCTION)
#if ENABLED(MKS_WIFI_MODULE)
#include "draw_ui.h"
@@ -64,5 +64,5 @@ void lv_draw_wifi_tips(void) {
void lv_clear_wifi_tips() { lv_obj_del(scr); }
#endif // USE_WIFI_FUNCTION
#endif // MKS_WIFI_MODULE
#endif // HAS_TFT_LVGL_UI
@@ -25,7 +25,7 @@
#include "tft_lvgl_configuration.h"
#if ENABLED(USE_WIFI_FUNCTION)
#if ENABLED(MKS_WIFI_MODULE)
#include "draw_ui.h"
#include "wifiSerial.h"
@@ -66,5 +66,5 @@ void __irq_usart1(void) {
} /* C-declarations for C++ */
#endif
#endif // USE_WIFI_FUNCTION
#endif // MKS_WIFI_MODULE
#endif // HAS_TFT_LVGL_UI
@@ -205,7 +205,7 @@ static const char assets[][LONG_FILENAME_LENGTH] = {
"bmp_enable.bin",
"bmp_return.bin",
#if ENABLED(USE_WIFI_FUNCTION)
#if ENABLED(MKS_WIFI_MODULE)
// wifi screen
"bmp_wifi.bin",
#endif
@@ -148,7 +148,7 @@ void printer_state_polling() {
if (uiCfg.print_state == WORKING)
filament_check();
TERN_(USE_WIFI_FUNCTION, wifi_looping());
TERN_(MKS_WIFI_MODULE, wifi_looping());
}
void filament_pin_setup() {
@@ -48,7 +48,7 @@
#define MACHINE_TYPE_CNOFIG_EN "Machine settings"
#define MOTOR_CONFIG_EN "Motor settings"
#define MACHINE_LEVELING_CONFIG_EN "Leveling settings"
#define ADVANCE_CONFIG_EN "Adavance settings"
#define ADVANCE_CONFIG_EN "Advanced settings"
#define MACHINE_CONFIG_TITLE_EN "Machine Settings"
#define MACHINE_TYPE_EN "Machine type"
@@ -82,9 +82,9 @@
#define MIN_ENDSTOP_X_EN "X-axis minimum Endstop"
#define MIN_ENDSTOP_Y_EN "Y-axis minimum Endstop"
#define MIN_ENDSTOP_Z_EN "Z-axis minimum Endstop"
#define MAX_ENDSTOP_X_EN "X axis maximum Endstop"
#define MAX_ENDSTOP_Y_EN "Y axis maximum Endstop"
#define MAX_ENDSTOP_Z_EN "Z axis maximum Endstop"
#define MAX_ENDSTOP_X_EN "X-axis maximum Endstop"
#define MAX_ENDSTOP_Y_EN "Y-axis maximum Endstop"
#define MAX_ENDSTOP_Z_EN "Z-axis maximum Endstop"
#define ENDSTOP_FIL_EN "Filament sensor"
#define ENDSTOP_LEVEL_EN "Leveling sensor"
#define ENDSTOP_OPENED_EN "Open"
@@ -107,11 +107,11 @@
#define AUTO_LEVELING_ENABLE_EN "Enable auto leveling"
#define BLTOUCH_LEVELING_ENABLE_EN "Enable BLtouch"
#define PROBE_PORT_EN "Probe connector"
#define PROBE_X_OFFSET_EN "Probe x axis offset"
#define PROBE_Y_OFFSET_EN "Probe y axis offset"
#define PROBE_Z_OFFSET_EN "Probe z axis offset"
#define PROBE_XY_SPEED_EN "Probe xy axis speed"
#define PROBE_Z_SPEED_EN "Probe z axis speed"
#define PROBE_X_OFFSET_EN "Probe X-axis offset"
#define PROBE_Y_OFFSET_EN "Probe Y-axis offset"
#define PROBE_Z_OFFSET_EN "Probe Z-axis offset"
#define PROBE_XY_SPEED_EN "Probe XY-axis speed"
#define PROBE_Z_SPEED_EN "Probe Z-axis speed"
#define ENABLE_EN "YES"
#define DISABLE_EN "NO"
#define Z_MIN_EN "ZMin"
@@ -162,11 +162,11 @@
#define HOMEFEEDRATECONF_EN "Home speed setting"
#define MAXFEEDRATE_CONF_TITLE_EN "Machine Settings>Maximum speed"
#define X_MAXFEEDRATE_EN "X axis maximum speed"
#define Y_MAXFEEDRATE_EN "Y axis maximum speed"
#define Z_MAXFEEDRATE_EN "Z axis maximum speed"
#define E0_MAXFEEDRATE_EN "E0 axis maximum speed"
#define E1_MAXFEEDRATE_EN "E1 axis maximum speed"
#define X_MAXFEEDRATE_EN "X-axis maximum speed"
#define Y_MAXFEEDRATE_EN "Y-axis maximum speed"
#define Z_MAXFEEDRATE_EN "Z-axis maximum speed"
#define E0_MAXFEEDRATE_EN "E0 maximum speed"
#define E1_MAXFEEDRATE_EN "E1 maximum speed"
#define ACCELERATION_CONF_TITLE_EN "Machine Settings>Acceleration"
#define PRINT_ACCELERATION_EN "Print acceleration"
@@ -175,49 +175,49 @@
#define X_ACCELERATION_EN "X-axis acceleration"
#define Y_ACCELERATION_EN "Y-axis acceleration"
#define Z_ACCELERATION_EN "Z-axis acceleration"
#define E0_ACCELERATION_EN "E0-axis acceleration"
#define E1_ACCELERATION_EN "E1-axis acceleration"
#define E0_ACCELERATION_EN "E0 acceleration"
#define E1_ACCELERATION_EN "E1 acceleration"
#define JERK_CONF_TITLE_EN "Machine Settings>Jerk speed"
#define X_JERK_EN "X-axis jerk speed"
#define Y_JERK_EN "Y-axis jerk speed"
#define Z_JERK_EN "J-axis jerk speed"
#define E_JERK_EN "E-axis jerk speed"
#define Z_JERK_EN "Z-axis jerk speed"
#define E_JERK_EN "Extruder jerk speed"
#define STEPS_CONF_TITLE_EN "Machine Settings>Steps settings"
#define X_STEPS_EN "X-axis steps"
#define Y_STEPS_EN "Y-axis stepS"
#define Z_STEPS_EN "Z-axis stepS"
#define E0_STEPS_EN "E0-axis steps"
#define E1_STEPS_EN "E1-axis steps"
#define Y_STEPS_EN "Y-axis steps"
#define Z_STEPS_EN "Z-axis steps"
#define E0_STEPS_EN "E0 steps"
#define E1_STEPS_EN "E1 steps"
#define TMC_CURRENT_CONF_TITLE_EN "Machine Settings>TMC current settings"
#define X_TMC_CURRENT_EN "X axis current (mA)"
#define Y_TMC_CURRENT_EN "Y axis current (mA)"
#define Z_TMC_CURRENT_EN "Z axis current (mA)"
#define E0_TMC_CURRENT_EN "E0 axis current (mA)"
#define E1_TMC_CURRENT_EN "E1 axis current (mA)"
#define X_TMC_CURRENT_EN "X-axis current (mA)"
#define Y_TMC_CURRENT_EN "Y-axis current (mA)"
#define Z_TMC_CURRENT_EN "Z-axis current (mA)"
#define E0_TMC_CURRENT_EN "E0 current (mA)"
#define E1_TMC_CURRENT_EN "E1 current (mA)"
#define TMC_MODE_CONF_TITLE_EN "Machine Settings>TMC step mode settings"
#define X_TMC_MODE_EN "Whether X axis enable stealthChop modes"
#define Y_TMC_MODE_EN "Whether Y axis enable stealthChop modes"
#define Z_TMC_MODE_EN "Whether Z axis enable stealthChop modes"
#define E0_TMC_MODE_EN "Whether E0 axis enable stealthChop modes"
#define E1_TMC_MODE_EN "Whether E1 axis enable stealthChop modes"
#define X_TMC_MODE_EN "Whether X-axis enables stealthChop mode"
#define Y_TMC_MODE_EN "Whether Y-axis enables stealthChop mode"
#define Z_TMC_MODE_EN "Whether Z-axis enables stealthChop mode"
#define E0_TMC_MODE_EN "Whether E0 enables stealthChop mode"
#define E1_TMC_MODE_EN "Whether E1 enables stealthChop mode"
#define MOTORDIR_CONF_TITLE_EN "Machine Settings>Motor direction"
#define X_MOTORDIR_EN "X-axis motor direction invert"
#define Y_MOTORDIR_EN "Y-axis motor direction invert"
#define Z_MOTORDIR_EN "Z-axis motor direction invert"
#define E0_MOTORDIR_EN "E0-axis motor direction invert"
#define E1_MOTORDIR_EN "E1-axis motor direction invert"
#define E0_MOTORDIR_EN "E0 motor direction invert"
#define E1_MOTORDIR_EN "E1 motor direction invert"
#define INVERT_P_EN "YES"
#define INVERT_N_EN "NO"
#define HOMEFEEDRATE_CONF_TITLE_EN "Machine Settings>Home speed"
#define X_HOMESPEED_EN "XY-axis Home speed"
#define Y_HOMESPEED_EN "Y-axis Home speed"
#define Z_HOMESPEED_EN "Z-axis Home speed"
#define X_HOMESPEED_EN "XY-axis home speed"
#define Y_HOMESPEED_EN "Y-axis home speed"
#define Z_HOMESPEED_EN "Z-axis home speed"
#define ADVANCED_CONF_TITLE_EN "Machine Settings>Advance"
#define PWROFF_DECTION_EN "power off dection module"
@@ -241,9 +241,9 @@
#define E_ENABLE_PINS_INVERT_EN "E_ENABLE_PIN_INVERT"
#define PAUSE_POSITION_EN "Printing pause position settings"
#define PAUSE_POSITION_X_EN "X axis position (Absolute position,-1 invalid)"
#define PAUSE_POSITION_Y_EN "Y axis position (Absolute position,-1 invalid)"
#define PAUSE_POSITION_Z_EN "Z axis position (Relative position,-1 invalid)"
#define PAUSE_POSITION_X_EN "X-axis position (Absolute position,-1 invalid)"
#define PAUSE_POSITION_Y_EN "Y-axis position (Absolute position,-1 invalid)"
#define PAUSE_POSITION_Z_EN "Z-axis position (Relative position,-1 invalid)"
#define WIFI_SETTINGS_TITLE_EN "Machine Settings>Wi-Fi Parameter"
#define WIFI_SETTINGS_MODE_EN "Wi-Fi Mode"
@@ -260,10 +260,10 @@
#define OFFSET_Z_EN "Z offset"
#define HOMING_SENSITIVITY_CONF_TITLE_EN "Machine Settings>Sensitivity"
#define X_SENSITIVITY_EN "X Axis Sensitivity"
#define Y_SENSITIVITY_EN "Y Axis Sensitivity"
#define Z_SENSITIVITY_EN "Z Axis Sensitivity"
#define Z2_SENSITIVITY_EN "Z2 Axis Sensitivity"
#define X_SENSITIVITY_EN "X-axis sensitivity"
#define Y_SENSITIVITY_EN "Y-axis sensitivity"
#define Z_SENSITIVITY_EN "Z-axis sensitivity"
#define Z2_SENSITIVITY_EN "Z2-axis sensitivity"
#define ENCODER_CONF_TITLE_EN "Machine Settings>Rotary encoder settings"
#define ENCODER_CONF_TEXT_EN "Is the encoder function used?"
@@ -51,6 +51,11 @@ XPT2046 touch;
#include "../../../../feature/powerloss.h"
#endif
#if ENABLED(TOUCH_SCREEN_CALIBRATION)
#include "../../../tft_io/touch_calibration.h"
#include "draw_touch_calibration.h"
#endif
#include <SPI.h>
#ifndef TFT_WIDTH
@@ -79,7 +84,7 @@ uint8_t bmp_public_buf[17 * 1024];
void SysTick_Callback() {
lv_tick_inc(1);
print_time_count();
#if ENABLED(USE_WIFI_FUNCTION)
#if ENABLED(MKS_WIFI_MODULE)
if (tips_disp.timer == TIPS_TIMER_START)
tips_disp.timer_count++;
#endif
@@ -211,7 +216,14 @@ void tft_lvgl_init() {
}
#endif
if (ready) lv_draw_ready_print();
if (ready) {
#if ENABLED(TOUCH_SCREEN_CALIBRATION)
if (touch_calibration.need_calibration()) lv_draw_touch_calibration_screen();
else lv_draw_ready_print();
#else
lv_draw_ready_print();
#endif
}
if (mks_test_flag == 0x1E)
mks_gpio_test();
@@ -240,17 +252,22 @@ unsigned int getTickDiff(unsigned int curTick, unsigned int lastTick) {
static bool get_point(int16_t *x, int16_t *y) {
bool is_touched = touch.getRawPoint(x, y);
if (is_touched) {
*x = int16_t((int32_t(*x) * XPT2046_X_CALIBRATION) >> 16) + XPT2046_X_OFFSET;
*y = int16_t((int32_t(*y) * XPT2046_Y_CALIBRATION) >> 16) + XPT2046_Y_OFFSET;
}
if (!is_touched) return false;
#if (TFT_ROTATION & TFT_ROTATE_180)
*x = int16_t((TFT_WIDTH) - (int)(*x));
*y = int16_t((TFT_HEIGHT) - (int)(*y));
#if ENABLED(TOUCH_SCREEN_CALIBRATION)
const calibrationState state = touch_calibration.get_calibration_state();
if (state >= CALIBRATION_TOP_LEFT && state <= CALIBRATION_BOTTOM_RIGHT) {
if (touch_calibration.handleTouch(*x, *y)) lv_update_touch_calibration_screen();
return false;
}
*x = int16_t((int32_t(*x) * touch_calibration.calibration.x) >> 16) + touch_calibration.calibration.offset_x;
*y = int16_t((int32_t(*y) * touch_calibration.calibration.y) >> 16) + touch_calibration.calibration.offset_y;
#else
*x = int16_t((int32_t(*x) * TOUCH_CALIBRATION_X) >> 16) + TOUCH_OFFSET_X;
*y = int16_t((int32_t(*y) * TOUCH_CALIBRATION_Y) >> 16) + TOUCH_OFFSET_Y;
#endif
return is_touched;
return true;
}
bool my_touchpad_read(lv_indev_drv_t * indev_driver, lv_indev_data_t * data) {
@@ -506,7 +523,6 @@ void lv_encoder_pin_init() {
const uint8_t enc_c = (buttons & EN_C) ? LV_INDEV_STATE_PR : LV_INDEV_STATE_REL;
if (enc_c != last_button_state) {
state = enc_c ? LV_INDEV_STATE_PR : LV_INDEV_STATE_REL;
last_button_state = enc_c;
}
@@ -33,7 +33,7 @@
#include <lvgl.h>
//#define TFT_ROTATION TFT_ROTATE_180
#define USE_WIFI_FUNCTION 0
#define MKS_WIFI_MODULE 0
extern void tft_lvgl_init();
extern void my_disp_flush(lv_disp_drv_t * disp, const lv_area_t * area, lv_color_t * color_p);
@@ -853,7 +853,7 @@ void disp_language_init() {
machine_menu.key_point = KEYBOARD_KEY_POINT_EN;
machine_menu.negative = KEYBOARD_KEY_NEGATIVE_EN;
// wifi-list
#if ENABLED(USE_WIFI_FUNCTION)
#if ENABLED(MKS_WIFI_MODULE)
list_menu.title = TEXT_WIFI_MENU_TITLE_EN;
list_menu.file_pages = FILE_PAGES_EN;
@@ -861,7 +861,7 @@ void disp_language_init() {
tips_menu.joining = TEXT_WIFI_JOINING_EN;
tips_menu.failedJoin = TEXT_WIFI_FAILED_JOIN_EN;
tips_menu.wifiConected = TEXT_WIFI_WIFI_CONECTED_EN;
#endif //USE_WIFI_FUNCTION
#endif //MKS_WIFI_MODULE
machine_setting_disp();
operation_menu.babystep = TEXT_BABY_STEP_EN;
@@ -25,7 +25,7 @@
#include "tft_lvgl_configuration.h"
#if ENABLED(USE_WIFI_FUNCTION)
#if ENABLED(MKS_WIFI_MODULE)
#include "draw_ui.h"
#include "wifiSerial.h"
@@ -118,5 +118,5 @@ int WifiSerial::wifi_rb_is_full(void) {
return rb_is_full(this->usart_device->rb);
}
#endif // USE_WIFI_FUNCTION
#endif // MKS_WIFI_MODULE
#endif // HAS_TFT_LVGL_UI
+4 -4
View File
@@ -23,10 +23,10 @@
#include "tft_lvgl_configuration.h"
#if ENABLED(USE_WIFI_FUNCTION)
#if ENABLED(MKS_WIFI_MODULE)
#if SERIAL_PORT_2 != -1
#error "SERIAL_PORT_2 must be set to -1 with HAS_TFT_LVGL_UI and USE_WIFI_FUNCTION."
#ifdef SERIAL_PORT_2
#error "SERIAL_PORT_2 must be disabled with HAS_TFT_LVGL_UI and MKS_WIFI_MODULE."
#endif
#define WIFI_BAUDRATE 115200
@@ -99,4 +99,4 @@ extern WifiSerial WifiSerial1;
#define WIFISERIAL WifiSerial1
#endif // USE_WIFI_FUNCTION
#endif // MKS_WIFI_MODULE
@@ -27,7 +27,7 @@
#include "wifi_module.h"
#include "wifi_upload.h"
#if ENABLED(USE_WIFI_FUNCTION)
#if ENABLED(MKS_WIFI_MODULE)
#include "../../../../MarlinCore.h"
#include "../../../../module/temperature.h"
@@ -283,7 +283,7 @@ void esp_port_begin(uint8_t interrupt) {
}
#endif
if (interrupt) {
#if ENABLED(USE_WIFI_FUNCTION)
#if ENABLED(MKS_WIFI_MODULE)
WIFISERIAL.end();
for (uint16_t i = 0; i < 65535; i++);
WIFISERIAL.begin(WIFI_BAUDRATE);
@@ -293,7 +293,7 @@ void esp_port_begin(uint8_t interrupt) {
#endif
}
else {
#if ENABLED(USE_WIFI_FUNCTION)
#if ENABLED(MKS_WIFI_MODULE)
WIFISERIAL.end();
for (uint16_t i = 0; i < 65535; i++);
WIFISERIAL.begin(WIFI_UPLOAD_BAUDRATE);
@@ -305,7 +305,7 @@ void esp_port_begin(uint8_t interrupt) {
}
}
#if ENABLED(USE_WIFI_FUNCTION)
#if ENABLED(MKS_WIFI_MODULE)
int raw_send_to_wifi(char *buf, int len) {
if (buf == 0 || len <= 0) return 0;
@@ -1811,5 +1811,5 @@ int readWifiBuf(int8_t *buf, int32_t len) {
return i;
}
#endif // USE_WIFI_FUNCTION
#endif // MKS_WIFI_MODULE
#endif // HAS_TFT_LVGL_UI
@@ -21,7 +21,7 @@
*/
#include "../../../../inc/MarlinConfigPre.h"
#if BOTH(HAS_TFT_LVGL_UI, USE_WIFI_FUNCTION)
#if BOTH(HAS_TFT_LVGL_UI, MKS_WIFI_MODULE)
#include "draw_ui.h"
#include "wifi_module.h"
@@ -822,4 +822,4 @@ int32_t wifi_upload(int type) {
return esp_upload.uploadResult == success ? 0 : -1;
}
#endif // HAS_TFT_LVGL_UI && USE_WIFI_FUNCTION
#endif // HAS_TFT_LVGL_UI && MKS_WIFI_MODULE
+1 -1
View File
@@ -626,7 +626,7 @@ namespace ExtUI {
void setLinearAdvance_mm_mm_s(const float value, const extruder_t extruder) {
if (extruder < EXTRUDERS)
planner.extruder_advance_K[extruder - E0] = constrain(value, 0, 999);
planner.extruder_advance_K[extruder - E0] = constrain(value, 0, 10);
}
#endif
+1 -1
View File
@@ -121,7 +121,7 @@ namespace Language_an {
PROGMEM Language_Str MSG_TEMPERATURE = _UxGT("Temperatura");
PROGMEM Language_Str MSG_MOTION = _UxGT("Movimiento");
PROGMEM Language_Str MSG_FILAMENT = _UxGT("Filamento");
PROGMEM Language_Str MSG_VOLUMETRIC_ENABLED = _UxGT("E in mm³");
PROGMEM Language_Str MSG_VOLUMETRIC_ENABLED = _UxGT("E in mm") SUPERSCRIPT_THREE;
PROGMEM Language_Str MSG_FILAMENT_DIAM = _UxGT("Fil. Dia.");
PROGMEM Language_Str MSG_FILAMENT_DIAM_E = _UxGT("Fil. Dia. *");
PROGMEM Language_Str MSG_CONTRAST = _UxGT("Contraste");
+1 -1
View File
@@ -106,7 +106,7 @@ namespace Language_bg {
PROGMEM Language_Str MSG_TEMPERATURE = _UxGT("Температура");
PROGMEM Language_Str MSG_MOTION = _UxGT("Движение");
PROGMEM Language_Str MSG_FILAMENT = _UxGT("Нишка");
PROGMEM Language_Str MSG_VOLUMETRIC_ENABLED = _UxGT("E in mm³");
PROGMEM Language_Str MSG_VOLUMETRIC_ENABLED = _UxGT("E in mm") SUPERSCRIPT_THREE;
PROGMEM Language_Str MSG_FILAMENT_DIAM = _UxGT("Диам. нишка");
PROGMEM Language_Str MSG_FILAMENT_DIAM_E = _UxGT("Диам. нишка *");
PROGMEM Language_Str MSG_CONTRAST = _UxGT("LCD контраст");
+1 -1
View File
@@ -111,7 +111,7 @@ namespace Language_ca {
PROGMEM Language_Str MSG_TEMPERATURE = _UxGT("Temperatura");
PROGMEM Language_Str MSG_MOTION = _UxGT("Moviment");
PROGMEM Language_Str MSG_FILAMENT = _UxGT("Filament");
PROGMEM Language_Str MSG_VOLUMETRIC_ENABLED = _UxGT("E en mm³");
PROGMEM Language_Str MSG_VOLUMETRIC_ENABLED = _UxGT("E en mm") SUPERSCRIPT_THREE;
PROGMEM Language_Str MSG_FILAMENT_DIAM = _UxGT("Diam. Fil.");
PROGMEM Language_Str MSG_FILAMENT_DIAM_E = _UxGT("Diam. Fil. *");
PROGMEM Language_Str MSG_CONTRAST = _UxGT("Contrast de LCD");
+1 -1
View File
@@ -301,7 +301,7 @@ namespace Language_cz {
PROGMEM Language_Str MSG_TEMPERATURE = _UxGT("Teplota");
PROGMEM Language_Str MSG_MOTION = _UxGT("Pohyb");
PROGMEM Language_Str MSG_FILAMENT = _UxGT("Filament");
PROGMEM Language_Str MSG_VOLUMETRIC_ENABLED = _UxGT("E na mm³");
PROGMEM Language_Str MSG_VOLUMETRIC_ENABLED = _UxGT("E na mm") SUPERSCRIPT_THREE;
PROGMEM Language_Str MSG_FILAMENT_DIAM = _UxGT("Fil. Prum.");
PROGMEM Language_Str MSG_FILAMENT_DIAM_E = _UxGT("Fil. Prum. *");
PROGMEM Language_Str MSG_FILAMENT_UNLOAD = _UxGT("Vysunout mm");
+1 -1
View File
@@ -101,7 +101,7 @@ namespace Language_da {
PROGMEM Language_Str MSG_TEMPERATURE = _UxGT("Temperatur");
PROGMEM Language_Str MSG_MOTION = _UxGT("Bevægelse");
PROGMEM Language_Str MSG_FILAMENT = _UxGT("Filament");
PROGMEM Language_Str MSG_VOLUMETRIC_ENABLED = _UxGT("E i mm³");
PROGMEM Language_Str MSG_VOLUMETRIC_ENABLED = _UxGT("E i mm") SUPERSCRIPT_THREE;
PROGMEM Language_Str MSG_FILAMENT_DIAM = _UxGT("Fil. Dia.");
PROGMEM Language_Str MSG_FILAMENT_DIAM_E = _UxGT("Fil. Dia. *");
PROGMEM Language_Str MSG_CONTRAST = _UxGT("LCD kontrast");

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